@treasuredata/tdx 2026.3.33 → 2026.3.35

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 (253) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/auth-login-command.js +1 -1
  13. package/dist/commands/cas-command.js +1 -1
  14. package/dist/commands/cas-segment-command.js +1 -1
  15. package/dist/commands/chat-command.js +1 -1
  16. package/dist/commands/claude-command.js +1 -1
  17. package/dist/commands/claude-statusline-command.js +1 -1
  18. package/dist/commands/claude-usage-command.js +1 -1
  19. package/dist/commands/command.js +1 -1
  20. package/dist/commands/connection-command.js +1 -1
  21. package/dist/commands/databases.js +1 -1
  22. package/dist/commands/delivery-command.js +1 -1
  23. package/dist/commands/describe.js +1 -1
  24. package/dist/commands/engage-campaign-pull-command.js +1 -1
  25. package/dist/commands/engage-campaign-push-command.js +1 -1
  26. package/dist/commands/engage-campaign-validate-command.js +1 -1
  27. package/dist/commands/engage-command.js +1 -1
  28. package/dist/commands/engage-template-pull-command.js +1 -1
  29. package/dist/commands/engage-template-push-command.js +1 -1
  30. package/dist/commands/engage-template-validate-command.js +1 -1
  31. package/dist/commands/job-command.js +1 -1
  32. package/dist/commands/journey-command.js +1 -1
  33. package/dist/commands/journey-validate-command.js +1 -1
  34. package/dist/commands/llm-command.js +1 -1
  35. package/dist/commands/mcp-command.js +1 -1
  36. package/dist/commands/parent-segment-command.js +1 -1
  37. package/dist/commands/policy-command.js +1 -1
  38. package/dist/commands/profile-command.js +1 -1
  39. package/dist/commands/profiles-command.js +1 -1
  40. package/dist/commands/query-command.js +1 -1
  41. package/dist/commands/schedule-command.js +1 -1
  42. package/dist/commands/segment-command.js +1 -1
  43. package/dist/commands/segment-create-command.js +1 -1
  44. package/dist/commands/segment-fields-command.js +1 -1
  45. package/dist/commands/segment-pull-command.js +1 -1
  46. package/dist/commands/segment-push-command.js +1 -1
  47. package/dist/commands/segment-update-command.js +1 -1
  48. package/dist/commands/segment-use-command.js +1 -1
  49. package/dist/commands/segment-validate-command.js +1 -1
  50. package/dist/commands/segments.js +1 -1
  51. package/dist/commands/show.js +1 -1
  52. package/dist/commands/status-command.js +1 -1
  53. package/dist/commands/tables.js +1 -1
  54. package/dist/commands/unset-command.js +1 -1
  55. package/dist/commands/upgrade-command.js +1 -1
  56. package/dist/commands/use-command.js +1 -1
  57. package/dist/commands/user-command.js +1 -1
  58. package/dist/commands/work-command.js +1 -1
  59. package/dist/commands/workflow-command.js +1 -1
  60. package/dist/core/auth.js +1 -1
  61. package/dist/core/command-output.js +1 -1
  62. package/dist/core/config.js +1 -1
  63. package/dist/core/connection-cache.js +1 -1
  64. package/dist/core/constants.js +1 -1
  65. package/dist/core/credential-cache.js +1 -1
  66. package/dist/core/global-context.js +1 -1
  67. package/dist/core/keychain.js +1 -1
  68. package/dist/core/oauth-keychain.js +1 -1
  69. package/dist/core/oauth.js +1 -1
  70. package/dist/core/profile.js +1 -1
  71. package/dist/core/project-config.js +1 -1
  72. package/dist/core/session.js +1 -1
  73. package/dist/core/user-cache.js +1 -1
  74. package/dist/core/version.js +1 -1
  75. package/dist/index.js +1 -1
  76. package/dist/mcp/server.js +1 -1
  77. package/dist/mcp/tools/index.js +1 -1
  78. package/dist/mcp/tools/tdx-run.js +1 -1
  79. package/dist/mcp/tools/tdx-search.js +1 -1
  80. package/dist/mcp/utils.js +1 -1
  81. package/dist/proxy/claude-usage-tracker.js +1 -1
  82. package/dist/proxy/passthrough-server.js +1 -1
  83. package/dist/proxy/sse-usage-parser.js +1 -1
  84. package/dist/sdk/agent/agent-config.js +1 -1
  85. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  86. package/dist/sdk/agent/agent-yaml.js +1 -1
  87. package/dist/sdk/agent/test/evaluator.js +1 -1
  88. package/dist/sdk/agent/test/executor.js +1 -1
  89. package/dist/sdk/agent/test/index.js +1 -1
  90. package/dist/sdk/agent/test/output.js +1 -1
  91. package/dist/sdk/agent/test/parser.js +1 -1
  92. package/dist/sdk/agent/tool-target-registry.js +1 -1
  93. package/dist/sdk/api.d.ts.map +1 -1
  94. package/dist/sdk/api.js +1 -1
  95. package/dist/sdk/api.js.map +1 -1
  96. package/dist/sdk/cas/cas-api-client.d.ts.map +1 -1
  97. package/dist/sdk/cas/cas-api-client.js +1 -1
  98. package/dist/sdk/cas/cas-api-client.js.map +1 -1
  99. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  100. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  101. package/dist/sdk/cas/index.js +1 -1
  102. package/dist/sdk/cas/pull-workflow.js +1 -1
  103. package/dist/sdk/cas/push-workflow.js +1 -1
  104. package/dist/sdk/client/cdp-api-client.d.ts.map +1 -1
  105. package/dist/sdk/client/cdp-api-client.js +1 -1
  106. package/dist/sdk/client/cdp-api-client.js.map +1 -1
  107. package/dist/sdk/client/delivery-api-client.d.ts.map +1 -1
  108. package/dist/sdk/client/delivery-api-client.js +1 -1
  109. package/dist/sdk/client/delivery-api-client.js.map +1 -1
  110. package/dist/sdk/client/endpoints.js +1 -1
  111. package/dist/sdk/client/engage-api-client.d.ts.map +1 -1
  112. package/dist/sdk/client/engage-api-client.js +1 -1
  113. package/dist/sdk/client/engage-api-client.js.map +1 -1
  114. package/dist/sdk/client/http-client.d.ts +7 -0
  115. package/dist/sdk/client/http-client.d.ts.map +1 -1
  116. package/dist/sdk/client/http-client.js +1 -1
  117. package/dist/sdk/client/http-client.js.map +1 -1
  118. package/dist/sdk/client/llm-api-client.d.ts.map +1 -1
  119. package/dist/sdk/client/llm-api-client.js +1 -1
  120. package/dist/sdk/client/llm-api-client.js.map +1 -1
  121. package/dist/sdk/client/oauth-refresh.js +1 -1
  122. package/dist/sdk/client/rate-limiter.js +1 -1
  123. package/dist/sdk/client/td-api-client.d.ts.map +1 -1
  124. package/dist/sdk/client/td-api-client.js +1 -1
  125. package/dist/sdk/client/td-api-client.js.map +1 -1
  126. package/dist/sdk/client/trino-api-client.d.ts.map +1 -1
  127. package/dist/sdk/client/trino-api-client.js +1 -1
  128. package/dist/sdk/client/trino-api-client.js.map +1 -1
  129. package/dist/sdk/client/workflow-client.d.ts.map +1 -1
  130. package/dist/sdk/client/workflow-client.js +1 -1
  131. package/dist/sdk/client/workflow-client.js.map +1 -1
  132. package/dist/sdk/connection-validator.js +1 -1
  133. package/dist/sdk/connection.js +1 -1
  134. package/dist/sdk/delivery.js +1 -1
  135. package/dist/sdk/engage/campaign-pull.js +1 -1
  136. package/dist/sdk/engage/campaign-push.js +1 -1
  137. package/dist/sdk/engage/campaign-validator.js +1 -1
  138. package/dist/sdk/engage/campaign-yaml.js +1 -1
  139. package/dist/sdk/engage/template-pull.js +1 -1
  140. package/dist/sdk/engage/template-push.js +1 -1
  141. package/dist/sdk/engage/template-validator.js +1 -1
  142. package/dist/sdk/engage/template-yaml.js +1 -1
  143. package/dist/sdk/engage/types/campaign-def.js +1 -1
  144. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  145. package/dist/sdk/engage/types/template-schema.js +1 -1
  146. package/dist/sdk/engage.js +1 -1
  147. package/dist/sdk/errors.js +1 -1
  148. package/dist/sdk/index.d.ts +12 -0
  149. package/dist/sdk/index.d.ts.map +1 -1
  150. package/dist/sdk/index.js +1 -1
  151. package/dist/sdk/index.js.map +1 -1
  152. package/dist/sdk/io/index.js +1 -1
  153. package/dist/sdk/io/node-filesystem.js +1 -1
  154. package/dist/sdk/job.js +1 -1
  155. package/dist/sdk/journey.js +1 -1
  156. package/dist/sdk/llm/chat-cache.js +1 -1
  157. package/dist/sdk/llm/index.js +1 -1
  158. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  159. package/dist/sdk/llm/model-factors.js +1 -1
  160. package/dist/sdk/personalization.d.ts.map +1 -1
  161. package/dist/sdk/personalization.js +1 -1
  162. package/dist/sdk/personalization.js.map +1 -1
  163. package/dist/sdk/policy.d.ts.map +1 -1
  164. package/dist/sdk/policy.js +1 -1
  165. package/dist/sdk/policy.js.map +1 -1
  166. package/dist/sdk/query/index.js +1 -1
  167. package/dist/sdk/query/sql-parser.js +1 -1
  168. package/dist/sdk/realtime.d.ts.map +1 -1
  169. package/dist/sdk/realtime.js +1 -1
  170. package/dist/sdk/realtime.js.map +1 -1
  171. package/dist/sdk/schedule.js +1 -1
  172. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  173. package/dist/sdk/segment/fields-display.js +1 -1
  174. package/dist/sdk/segment/file-discovery.js +1 -1
  175. package/dist/sdk/segment/journey-utils.js +1 -1
  176. package/dist/sdk/segment/journey-validator.js +1 -1
  177. package/dist/sdk/segment/journey-yaml.js +1 -1
  178. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  179. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  180. package/dist/sdk/segment/pull-workflow.js +1 -1
  181. package/dist/sdk/segment/push-recovery.js +1 -1
  182. package/dist/sdk/segment/push-workflow.js +1 -1
  183. package/dist/sdk/segment/resolution-context.js +1 -1
  184. package/dist/sdk/segment/segment-path-parser.js +1 -1
  185. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  186. package/dist/sdk/segment/segment-validator.js +1 -1
  187. package/dist/sdk/segment/target-resolution.js +1 -1
  188. package/dist/sdk/segment/tdx-config.js +1 -1
  189. package/dist/sdk/segment/types/activation-schema.js +1 -1
  190. package/dist/sdk/segment/types/journey-def.js +1 -1
  191. package/dist/sdk/segment/types/journey-schema.js +1 -1
  192. package/dist/sdk/segment/types/segment-def.js +1 -1
  193. package/dist/sdk/segment/types/segment-schema.js +1 -1
  194. package/dist/sdk/segment/validate-files.js +1 -1
  195. package/dist/sdk/segment/yaml-validator.js +1 -1
  196. package/dist/sdk/segment.js +1 -1
  197. package/dist/sdk/types/index.js +1 -1
  198. package/dist/sdk/types/progress.js +1 -1
  199. package/dist/sdk/types/workspace.d.ts +1 -0
  200. package/dist/sdk/types/workspace.d.ts.map +1 -1
  201. package/dist/sdk/types/workspace.js +1 -1
  202. package/dist/sdk/user.js +1 -1
  203. package/dist/sdk/util/format-detector.js +1 -1
  204. package/dist/sdk/util/formatters.js +1 -1
  205. package/dist/sdk/util/index.js +1 -1
  206. package/dist/sdk/util/paginate.js +1 -1
  207. package/dist/sdk/util/tree-formatter.js +1 -1
  208. package/dist/sdk/workflow/archive-validation.js +1 -1
  209. package/dist/sdk/workflow/clone-workflow.js +1 -1
  210. package/dist/sdk/workflow/index.js +1 -1
  211. package/dist/sdk/workflow/pull-workflow.js +1 -1
  212. package/dist/sdk/workflow/push-workflow.js +1 -1
  213. package/dist/sdk/workflow/tdx-config.js +1 -1
  214. package/dist/sdk/workflow/workflow-utils.js +1 -1
  215. package/dist/sdk/workspace/frontmatter.js +1 -1
  216. package/dist/sdk/workspace/git.js +1 -1
  217. package/dist/sdk/workspace/index.js +1 -1
  218. package/dist/sdk/workspace/templates.js +1 -1
  219. package/dist/sdk/workspace/weekly.js +1 -1
  220. package/dist/sdk/workspace/wikilinks.js +1 -1
  221. package/dist/test-utils/command-runner.js +1 -1
  222. package/dist/test-utils/factories.js +1 -1
  223. package/dist/test-utils/fixtures.js +1 -1
  224. package/dist/test-utils/http-mock.js +1 -1
  225. package/dist/test-utils/index.js +1 -1
  226. package/dist/utils/async.js +1 -1
  227. package/dist/utils/colors.js +1 -1
  228. package/dist/utils/diff.js +1 -1
  229. package/dist/utils/file-permissions.js +1 -1
  230. package/dist/utils/file-reader.js +1 -1
  231. package/dist/utils/github-releases.js +1 -1
  232. package/dist/utils/global-cache.js +1 -1
  233. package/dist/utils/json-loader.js +1 -1
  234. package/dist/utils/local-cache.js +1 -1
  235. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  236. package/dist/utils/logger/formatters/index.js +1 -1
  237. package/dist/utils/logger/handlers/console-handler.js +1 -1
  238. package/dist/utils/logger/handlers/file-handler.js +1 -1
  239. package/dist/utils/logger/handlers/index.js +1 -1
  240. package/dist/utils/logger/handlers/null-handler.js +1 -1
  241. package/dist/utils/logger/index.js +1 -1
  242. package/dist/utils/logger/logger.js +1 -1
  243. package/dist/utils/logger/types.js +1 -1
  244. package/dist/utils/option-validation.js +1 -1
  245. package/dist/utils/process.js +1 -1
  246. package/dist/utils/prompt.js +1 -1
  247. package/dist/utils/spinner.js +1 -1
  248. package/dist/utils/sse-parser.js +1 -1
  249. package/dist/utils/string-utils.js +1 -1
  250. package/dist/utils/table-ref-parser.js +1 -1
  251. package/dist/utils/tdx-logger.js +1 -1
  252. package/dist/utils/version-check.js +1 -1
  253. package/package.json +1 -1
@@ -1 +1 @@
1
- const a33_0x4bd0f8=a33_0x942c;(function(_0x439627,_0x5bc5d4){const _0x56287e=a33_0x942c,_0x5d0969=_0x439627();while(!![]){try{const _0xe98f71=-parseInt(_0x56287e(0x1bb))/0x1+parseInt(_0x56287e(0x1d6))/0x2+parseInt(_0x56287e(0x1eb))/0x3+parseInt(_0x56287e(0x1e8))/0x4*(parseInt(_0x56287e(0x1c1))/0x5)+parseInt(_0x56287e(0x1d8))/0x6*(-parseInt(_0x56287e(0x1c7))/0x7)+-parseInt(_0x56287e(0x1e3))/0x8+parseInt(_0x56287e(0x1bc))/0x9;if(_0xe98f71===_0x5bc5d4)break;else _0x5d0969['push'](_0x5d0969['shift']());}catch(_0x1f749f){_0x5d0969['push'](_0x5d0969['shift']());}}}(a33_0x5aed,0x6612c));import{BaseCommand}from'./command.js';function a33_0x5aed(){const _0x49d85d=['1297977fvfblc','user','policy\x20show','(ID:\x20','map','email','verbose','account_owner','Listing\x20policies...','account_id','ies','740728YbgeWN','13152861liLhNY','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','description','policies','administrator','199555CLWKUM','join','policy','context','getCurrent','Account\x20Owner','798IAIMLP','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','Fetching\x20policy...','\x20\x20\x20','\x20assigned','error','name','log','getPolicy','data','all','\x20\x20•\x20',',\x20user_id:','👥\x20Assigned\x20Users','Member','328556mNcYAy','📋\x20Assigned\x20Policies','22584JBVdST','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','padEnd','getMyPermissions','length','\x20\x20No\x20permissions','No\x20policies\x20found','args','site','\x20user','execute','4082888KHWcwR','dim','permissions','Administrator','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','4tzXBgE','bold','operation'];a33_0x5aed=function(){return _0x49d85d;};return a33_0x5aed();}import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a33_0x1d82ee from'chalk';export class PolicyCommand extends BaseCommand{['name']=a33_0x4bd0f8(0x1c3);[a33_0x4bd0f8(0x1be)]=a33_0x4bd0f8(0x1bd);async[a33_0x4bd0f8(0x1e2)](_0x10e468){const _0x5b3249=a33_0x4bd0f8,{options:_0x620226,tdx:_0x3738d9}=_0x10e468,_0x498e56=await withSpinner('Fetching\x20permissions...',async()=>{const _0x22e4d8=a33_0x942c,[_0x317123,_0x2f7bb4]=await Promise[_0x22e4d8(0x1d1)]([_0x3738d9[_0x22e4d8(0x1ec)][_0x22e4d8(0x1c5)](),_0x3738d9['policy'][_0x22e4d8(0x1db)]()]);return{'userInfo':_0x317123,'permissions':_0x2f7bb4};},{'verbose':_0x620226[_0x5b3249(0x1f1)]}),{userInfo:_0x5f795b,permissions:_0x1cea7f}=_0x498e56['data'];if(isStructuredFormat(_0x620226))return await handleSingleObjectOutput(_0x1cea7f,_0x620226),0x0;const _0x4748e3=_0x5f795b[_0x5b3249(0x1f2)]?_0x5b3249(0x1c6):_0x5f795b[_0x5b3249(0x1c0)]?_0x5b3249(0x1e6):_0x5b3249(0x1d5);console[_0x5b3249(0x1ce)]('\x0a'+a33_0x1d82ee[_0x5b3249(0x1e9)]('👤')+'\x20'+a33_0x1d82ee[_0x5b3249(0x1e9)](_0x5f795b['name'])+'\x20'+a33_0x1d82ee['dim']('('+_0x5f795b[_0x5b3249(0x1f0)]+')')+'\x20—\x20'+_0x4748e3),console[_0x5b3249(0x1ce)](a33_0x1d82ee[_0x5b3249(0x1e4)](_0x5b3249(0x1ca)+_0x3738d9[_0x5b3249(0x1c4)][_0x5b3249(0x1e0)]+':'+_0x5f795b[_0x5b3249(0x1b9)]+_0x5b3249(0x1d3)+_0x5f795b['id']));const _0x39706e=_0x1cea7f[_0x5b3249(0x1bf)];console[_0x5b3249(0x1ce)]('\x0a'+a33_0x1d82ee[_0x5b3249(0x1e9)](_0x5b3249(0x1d7))+'\x20('+_0x39706e['length']+'):');if(_0x39706e[_0x5b3249(0x1dc)]===0x0)console['log'](a33_0x1d82ee[_0x5b3249(0x1e4)]('\x20\x20No\x20policies\x20assigned'));else for(const _0x445d43 of _0x39706e){console[_0x5b3249(0x1ce)](_0x5b3249(0x1d2)+_0x445d43[_0x5b3249(0x1cd)]);}return printPermissionsMap(_0x1cea7f[_0x5b3249(0x1e5)]),console['log'](),0x0;}}export class PolicyListCommand extends BaseCommand{[a33_0x4bd0f8(0x1cd)]='policy\x20list';[a33_0x4bd0f8(0x1be)]=a33_0x4bd0f8(0x1e7);async[a33_0x4bd0f8(0x1e2)](_0x1ec1a7){const _0x234ae3=a33_0x4bd0f8,{options:_0x573db6,tdx:_0x3be189}=_0x1ec1a7,_0x45e7b2=await withSpinner(_0x234ae3(0x1f3),()=>_0x3be189['policy']['listPolicies'](),{'verbose':_0x573db6[_0x234ae3(0x1f1)]}),_0x295bc1=_0x45e7b2[_0x234ae3(0x1d0)];console[_0x234ae3(0x1cc)]('✔\x20Found\x20'+_0x295bc1['length']+'\x20polic'+(_0x295bc1['length']!==0x1?_0x234ae3(0x1ba):'y'));if(isStructuredFormat(_0x573db6))return await handleSDKOutput(_0x295bc1,_0x573db6),0x0;if(_0x295bc1[_0x234ae3(0x1dc)]===0x0)console[_0x234ae3(0x1ce)](a33_0x1d82ee[_0x234ae3(0x1e4)](_0x234ae3(0x1de)));else for(const _0x1028b6 of _0x295bc1){const _0x50e689=_0x1028b6[_0x234ae3(0x1be)]?a33_0x1d82ee[_0x234ae3(0x1e4)]('\x20—\x20'+_0x1028b6[_0x234ae3(0x1be)]):'';console['log'](_0x234ae3(0x1d2)+_0x1028b6[_0x234ae3(0x1cd)]+_0x50e689);}return 0x0;}}function a33_0x942c(_0x2e1a2c,_0x4b21d){_0x2e1a2c=_0x2e1a2c-0x1b9;const _0x5aed0a=a33_0x5aed();let _0x942c09=_0x5aed0a[_0x2e1a2c];return _0x942c09;}export class PolicyShowCommand extends BaseCommand{['name']=a33_0x4bd0f8(0x1ed);[a33_0x4bd0f8(0x1be)]=a33_0x4bd0f8(0x1c8);['validate'](_0x330b50){const _0x18ba58=a33_0x4bd0f8;if(_0x330b50['args'][_0x18ba58(0x1dc)]===0x0)return _0x18ba58(0x1d9);return undefined;}async[a33_0x4bd0f8(0x1e2)](_0x47c4f8){const _0x13ef9f=a33_0x4bd0f8,{options:_0x2cf126,tdx:_0x554b4a}=_0x47c4f8,_0xd2171c=_0x47c4f8[_0x13ef9f(0x1df)][0x0],_0x25ff2b=await withSpinner(_0x13ef9f(0x1c9),async()=>{const _0x2d5a9e=_0x13ef9f,_0x4566ed=await _0x554b4a[_0x2d5a9e(0x1c3)][_0x2d5a9e(0x1cf)](_0xd2171c),[_0x3f71f6,_0x5491a4]=await Promise[_0x2d5a9e(0x1d1)]([_0x554b4a['policy']['getPolicyPermissions'](_0x4566ed['id']),_0x554b4a['policy']['getPolicyUsers'](_0x4566ed['id'])]);return{'policy':_0x4566ed,'perms':_0x3f71f6,'users':_0x5491a4};},{'verbose':_0x2cf126['verbose']}),{policy:_0x2c79b4,perms:_0x1b1d87,users:_0x201ab2}=_0x25ff2b[_0x13ef9f(0x1d0)];if(isStructuredFormat(_0x2cf126))return await handleSingleObjectOutput({..._0x2c79b4,'permissions':_0x1b1d87['permissions'],'users':_0x201ab2},_0x2cf126),0x0;console[_0x13ef9f(0x1ce)]('\x0a'+a33_0x1d82ee[_0x13ef9f(0x1e9)]('📋')+'\x20'+a33_0x1d82ee[_0x13ef9f(0x1e9)](_0x2c79b4[_0x13ef9f(0x1cd)])+'\x20'+a33_0x1d82ee[_0x13ef9f(0x1e4)](_0x13ef9f(0x1ee)+_0x2c79b4['id']+')'));_0x2c79b4[_0x13ef9f(0x1be)]&&console[_0x13ef9f(0x1ce)](_0x13ef9f(0x1ca)+a33_0x1d82ee[_0x13ef9f(0x1e4)](_0x2c79b4['description']));console[_0x13ef9f(0x1ce)](_0x13ef9f(0x1ca)+_0x201ab2[_0x13ef9f(0x1dc)]+_0x13ef9f(0x1e1)+(_0x201ab2[_0x13ef9f(0x1dc)]!==0x1?'s':'')+_0x13ef9f(0x1cb)),printPermissionsMap(_0x1b1d87[_0x13ef9f(0x1e5)]);if(_0x201ab2[_0x13ef9f(0x1dc)]>0x0){console[_0x13ef9f(0x1ce)]('\x0a'+a33_0x1d82ee[_0x13ef9f(0x1e9)](_0x13ef9f(0x1d4))+':');for(const _0x20dd8e of _0x201ab2){const _0x6ea395=_0x20dd8e[_0x13ef9f(0x1f0)]&&_0x20dd8e['email']!==_0x20dd8e[_0x13ef9f(0x1cd)]?a33_0x1d82ee[_0x13ef9f(0x1e4)]('\x20<'+_0x20dd8e[_0x13ef9f(0x1f0)]+'>'):'';console['log'](_0x13ef9f(0x1d2)+_0x20dd8e['name']+_0x6ea395);}}return console['log'](),0x0;}}function printPermissionsMap(_0x296585){const _0x3a9b4d=a33_0x4bd0f8,_0x211ada=Object['entries'](_0x296585);console['log']('\x0a'+a33_0x1d82ee['bold']('🔑\x20Effective\x20Permissions')+':');if(_0x211ada['length']===0x0){console[_0x3a9b4d(0x1ce)](a33_0x1d82ee[_0x3a9b4d(0x1e4)](_0x3a9b4d(0x1dd)));return;}const _0x334cff=Math['max'](..._0x211ada[_0x3a9b4d(0x1ef)](([_0xaed865])=>_0xaed865['length']));for(const [_0x29f6b9,_0x535660]of _0x211ada){const _0x56da04=formatOperations(_0x535660);console[_0x3a9b4d(0x1ce)]('\x20\x20'+_0x29f6b9[_0x3a9b4d(0x1da)](_0x334cff+0x2)+_0x56da04);}}function formatOperations(_0x35cf84){const _0x449961=a33_0x4bd0f8,_0x2b9492=[...new Set(_0x35cf84[_0x449961(0x1ef)](_0x5303bf=>_0x5303bf[_0x449961(0x1ea)]))];return _0x2b9492[_0x449961(0x1c2)](',\x20');}
1
+ const a33_0x29d97f=a33_0x3ce1;(function(_0x2b0fe8,_0x46ee96){const _0x39c40c=a33_0x3ce1,_0x33ac4f=_0x2b0fe8();while(!![]){try{const _0x4d634d=parseInt(_0x39c40c(0x8d))/0x1+-parseInt(_0x39c40c(0x95))/0x2+-parseInt(_0x39c40c(0xc2))/0x3+-parseInt(_0x39c40c(0x90))/0x4*(parseInt(_0x39c40c(0xad))/0x5)+parseInt(_0x39c40c(0x97))/0x6*(parseInt(_0x39c40c(0xb3))/0x7)+-parseInt(_0x39c40c(0xb4))/0x8*(parseInt(_0x39c40c(0xc0))/0x9)+parseInt(_0x39c40c(0xb2))/0xa;if(_0x4d634d===_0x46ee96)break;else _0x33ac4f['push'](_0x33ac4f['shift']());}catch(_0x4b2bb8){_0x33ac4f['push'](_0x33ac4f['shift']());}}}(a33_0x2a5b,0xe49c7));function a33_0x2a5b(){const _0x1cfbd1=['account_id','dim','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','email','27603bIjBSa','\x20\x20\x20','828906lpILkT','log','length',',\x20user_id:','verbose','join','policies','\x20—\x20','bold','\x20polic','policy\x20list','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','221014WitKYm','description','✔\x20Found\x20','24nTaJYA','getPolicyPermissions','administrator','args','No\x20policies\x20found','3060882OhmvNc','\x20\x20No\x20policies\x20assigned','11676CTlPVm','getCurrent','padEnd','data','operation','Account\x20Owner','name','policy','validate','ies','🔑\x20Effective\x20Permissions','Fetching\x20policy...','account_owner','\x20user','getPolicyUsers','📋\x20Assigned\x20Policies','Listing\x20policies...','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','all','Administrator','map','\x20\x20•\x20','1325965OQTocD','policy\x20show','execute','(ID:\x20','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','43310980ZugLrg','77dZvcrH','624FzTyqM','\x20assigned','user','entries','permissions','\x20\x20No\x20permissions','max','listPolicies'];a33_0x2a5b=function(){return _0x1cfbd1;};return a33_0x2a5b();}import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a33_0x342d9d from'chalk';function a33_0x3ce1(_0x2af1d6,_0x1272da){_0x2af1d6=_0x2af1d6-0x8a;const _0x2a5b7b=a33_0x2a5b();let _0x3ce1ea=_0x2a5b7b[_0x2af1d6];return _0x3ce1ea;}export class PolicyCommand extends BaseCommand{['name']=a33_0x29d97f(0x9e);[a33_0x29d97f(0x8e)]=a33_0x29d97f(0x8c);async[a33_0x29d97f(0xaf)](_0x4eae7d){const _0x47e655=a33_0x29d97f,{options:_0x51dfed,tdx:_0x50781e}=_0x4eae7d,_0x1eff62=await withSpinner('Fetching\x20permissions...',async()=>{const _0x500482=a33_0x3ce1,[_0x1104e0,_0x5af7d6]=await Promise[_0x500482(0xa9)]([_0x50781e[_0x500482(0xb6)][_0x500482(0x98)](),_0x50781e[_0x500482(0x9e)]['getMyPermissions']()]);return{'userInfo':_0x1104e0,'permissions':_0x5af7d6};},{'verbose':_0x51dfed['verbose']}),{userInfo:_0x3e0f16,permissions:_0x2ee024}=_0x1eff62['data'];if(isStructuredFormat(_0x51dfed))return await handleSingleObjectOutput(_0x2ee024,_0x51dfed),0x0;const _0x5db527=_0x3e0f16[_0x47e655(0xa3)]?_0x47e655(0x9c):_0x3e0f16[_0x47e655(0x92)]?_0x47e655(0xaa):'Member';console['log']('\x0a'+a33_0x342d9d['bold']('👤')+'\x20'+a33_0x342d9d[_0x47e655(0xca)](_0x3e0f16[_0x47e655(0x9d)])+'\x20'+a33_0x342d9d['dim']('('+_0x3e0f16[_0x47e655(0xbf)]+')')+'\x20—\x20'+_0x5db527),console[_0x47e655(0xc3)](a33_0x342d9d[_0x47e655(0xbd)]('\x20\x20\x20'+_0x50781e['context']['site']+':'+_0x3e0f16[_0x47e655(0xbc)]+_0x47e655(0xc5)+_0x3e0f16['id']));const _0x50cffa=_0x2ee024[_0x47e655(0xc8)];console[_0x47e655(0xc3)]('\x0a'+a33_0x342d9d[_0x47e655(0xca)](_0x47e655(0xa6))+'\x20('+_0x50cffa[_0x47e655(0xc4)]+'):');if(_0x50cffa['length']===0x0)console['log'](a33_0x342d9d[_0x47e655(0xbd)](_0x47e655(0x96)));else for(const _0x263bd5 of _0x50cffa){console[_0x47e655(0xc3)](_0x47e655(0xac)+_0x263bd5[_0x47e655(0x9d)]);}return printPermissionsMap(_0x2ee024[_0x47e655(0xb8)]),console[_0x47e655(0xc3)](),0x0;}}export class PolicyListCommand extends BaseCommand{['name']=a33_0x29d97f(0x8b);[a33_0x29d97f(0x8e)]=a33_0x29d97f(0xb1);async['execute'](_0x2822fb){const _0x19723c=a33_0x29d97f,{options:_0x4f282f,tdx:_0x3dc5e5}=_0x2822fb,_0x1c99a0=await withSpinner(_0x19723c(0xa7),()=>_0x3dc5e5['policy'][_0x19723c(0xbb)](),{'verbose':_0x4f282f[_0x19723c(0xc6)]}),_0x556200=_0x1c99a0[_0x19723c(0x9a)];console['error'](_0x19723c(0x8f)+_0x556200[_0x19723c(0xc4)]+_0x19723c(0x8a)+(_0x556200[_0x19723c(0xc4)]!==0x1?_0x19723c(0xa0):'y'));if(isStructuredFormat(_0x4f282f))return await handleSDKOutput(_0x556200,_0x4f282f),0x0;if(_0x556200[_0x19723c(0xc4)]===0x0)console[_0x19723c(0xc3)](a33_0x342d9d[_0x19723c(0xbd)](_0x19723c(0x94)));else for(const _0x48aae7 of _0x556200){const _0x2480a4=_0x48aae7[_0x19723c(0x8e)]?a33_0x342d9d[_0x19723c(0xbd)](_0x19723c(0xc9)+_0x48aae7[_0x19723c(0x8e)]):'';console['log'](_0x19723c(0xac)+_0x48aae7['name']+_0x2480a4);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a33_0x29d97f(0x9d)]=a33_0x29d97f(0xae);[a33_0x29d97f(0x8e)]=a33_0x29d97f(0xbe);[a33_0x29d97f(0x9f)](_0x174361){const _0x59ee52=a33_0x29d97f;if(_0x174361[_0x59ee52(0x93)][_0x59ee52(0xc4)]===0x0)return _0x59ee52(0xa8);return undefined;}async[a33_0x29d97f(0xaf)](_0x438dfb){const _0x2ad1b3=a33_0x29d97f,{options:_0x4a8bfe,tdx:_0x374172}=_0x438dfb,_0xed6d60=_0x438dfb['args'][0x0],_0x333240=await withSpinner(_0x2ad1b3(0xa2),async()=>{const _0x5b4d99=_0x2ad1b3,_0x26c1df=await _0x374172[_0x5b4d99(0x9e)]['getPolicy'](_0xed6d60),[_0x5e02e9,_0xbfa4c0]=await Promise['all']([_0x374172[_0x5b4d99(0x9e)][_0x5b4d99(0x91)](_0x26c1df['id']),_0x374172[_0x5b4d99(0x9e)][_0x5b4d99(0xa5)](_0x26c1df['id'])]);return{'policy':_0x26c1df,'perms':_0x5e02e9,'users':_0xbfa4c0};},{'verbose':_0x4a8bfe['verbose']}),{policy:_0x39f357,perms:_0x181e3b,users:_0x25280b}=_0x333240[_0x2ad1b3(0x9a)];if(isStructuredFormat(_0x4a8bfe))return await handleSingleObjectOutput({..._0x39f357,'permissions':_0x181e3b['permissions'],'users':_0x25280b},_0x4a8bfe),0x0;console[_0x2ad1b3(0xc3)]('\x0a'+a33_0x342d9d[_0x2ad1b3(0xca)]('📋')+'\x20'+a33_0x342d9d[_0x2ad1b3(0xca)](_0x39f357[_0x2ad1b3(0x9d)])+'\x20'+a33_0x342d9d['dim'](_0x2ad1b3(0xb0)+_0x39f357['id']+')'));_0x39f357[_0x2ad1b3(0x8e)]&&console[_0x2ad1b3(0xc3)]('\x20\x20\x20'+a33_0x342d9d[_0x2ad1b3(0xbd)](_0x39f357['description']));console[_0x2ad1b3(0xc3)](_0x2ad1b3(0xc1)+_0x25280b[_0x2ad1b3(0xc4)]+_0x2ad1b3(0xa4)+(_0x25280b[_0x2ad1b3(0xc4)]!==0x1?'s':'')+_0x2ad1b3(0xb5)),printPermissionsMap(_0x181e3b['permissions']);if(_0x25280b['length']>0x0){console[_0x2ad1b3(0xc3)]('\x0a'+a33_0x342d9d[_0x2ad1b3(0xca)]('👥\x20Assigned\x20Users')+':');for(const _0x3d2322 of _0x25280b){const _0x589739=_0x3d2322['email']&&_0x3d2322['email']!==_0x3d2322[_0x2ad1b3(0x9d)]?a33_0x342d9d[_0x2ad1b3(0xbd)]('\x20<'+_0x3d2322[_0x2ad1b3(0xbf)]+'>'):'';console[_0x2ad1b3(0xc3)](_0x2ad1b3(0xac)+_0x3d2322[_0x2ad1b3(0x9d)]+_0x589739);}}return console[_0x2ad1b3(0xc3)](),0x0;}}function printPermissionsMap(_0xb3e2e8){const _0x3145b0=a33_0x29d97f,_0x2ec371=Object[_0x3145b0(0xb7)](_0xb3e2e8);console[_0x3145b0(0xc3)]('\x0a'+a33_0x342d9d['bold'](_0x3145b0(0xa1))+':');if(_0x2ec371[_0x3145b0(0xc4)]===0x0){console[_0x3145b0(0xc3)](a33_0x342d9d[_0x3145b0(0xbd)](_0x3145b0(0xb9)));return;}const _0x1d238b=Math[_0x3145b0(0xba)](..._0x2ec371[_0x3145b0(0xab)](([_0x31870f])=>_0x31870f[_0x3145b0(0xc4)]));for(const [_0x5e7c0d,_0x230ccf]of _0x2ec371){const _0x1763e0=formatOperations(_0x230ccf);console[_0x3145b0(0xc3)]('\x20\x20'+_0x5e7c0d[_0x3145b0(0x99)](_0x1d238b+0x2)+_0x1763e0);}}function formatOperations(_0x424417){const _0x25badc=a33_0x29d97f,_0x2aaa28=[...new Set(_0x424417[_0x25badc(0xab)](_0xd0550=>_0xd0550[_0x25badc(0x9b)]))];return _0x2aaa28[_0x25badc(0xc7)](',\x20');}
@@ -1 +1 @@
1
- const a34_0x37cb7a=a34_0x45e9;(function(_0x46027a,_0x3461c1){const _0x5606c9=a34_0x45e9,_0x3fbecb=_0x46027a();while(!![]){try{const _0x4755f8=parseInt(_0x5606c9(0x158))/0x1+-parseInt(_0x5606c9(0x197))/0x2+-parseInt(_0x5606c9(0x172))/0x3*(-parseInt(_0x5606c9(0x180))/0x4)+parseInt(_0x5606c9(0x13d))/0x5*(parseInt(_0x5606c9(0x186))/0x6)+-parseInt(_0x5606c9(0x170))/0x7*(-parseInt(_0x5606c9(0x19b))/0x8)+-parseInt(_0x5606c9(0x16f))/0x9*(-parseInt(_0x5606c9(0x171))/0xa)+-parseInt(_0x5606c9(0x19d))/0xb;if(_0x4755f8===_0x3461c1)break;else _0x3fbecb['push'](_0x3fbecb['shift']());}catch(_0x44d7f5){_0x3fbecb['push'](_0x3fbecb['shift']());}}}(a34_0x4646,0x6484d));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 a34_0x3e2f82 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{runOAuthLoginFlow}from'./auth-login-command.js';import{isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';function a34_0x45e9(_0x2f437f,_0x2ba12f){_0x2f437f=_0x2f437f-0x138;const _0x464672=a34_0x4646();let _0x45e9e7=_0x464672[_0x2f437f];return _0x45e9e7;}import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a34_0x56bb7a from'prompts';import a34_0x47dd0d from'chalk';function validateProfileName(_0xa33188){const _0x371ad=a34_0x45e9;if(!_0xa33188||!_0xa33188['trim']())return _0x371ad(0x196);const _0x14adc1=_0xa33188[_0x371ad(0x15c)]();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x14adc1))return _0x371ad(0x1a7);if(profileExists(_0x14adc1))return _0x371ad(0x1ab)+_0x14adc1+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{[a34_0x37cb7a(0x194)]=a34_0x37cb7a(0x1a5);[a34_0x37cb7a(0x13e)]=a34_0x37cb7a(0x179);async[a34_0x37cb7a(0x187)](_0x5ac99d){const _0x4a127a=a34_0x37cb7a,{options:_0x58c7df,args:_0x152e0a}=_0x5ac99d;console['log'](a34_0x47dd0d['bold'](_0x4a127a(0x1a8)));let _0x1e955b;if(_0x152e0a[_0x4a127a(0x183)]>0x0&&_0x152e0a[0x0]){const _0x2da64=_0x152e0a[0x0][_0x4a127a(0x15c)](),_0x5a6bd4=validateProfileName(_0x2da64);if(_0x5a6bd4!==!![])return console['error'](a34_0x47dd0d[_0x4a127a(0x181)](_0x5a6bd4)),0x1;_0x1e955b=_0x2da64;}else{const _0x5d321c=await a34_0x56bb7a({'type':_0x4a127a(0x15d),'name':_0x4a127a(0x1a4),'message':_0x4a127a(0x189),'validate':validateProfileName});if(!_0x5d321c[_0x4a127a(0x1a4)])return console[_0x4a127a(0x156)](_0x4a127a(0x16b)),0x1;_0x1e955b=_0x5d321c[_0x4a127a(0x1a4)]['trim']();}const _0x22e475=await a34_0x56bb7a({'type':_0x4a127a(0x15d),'name':_0x4a127a(0x13e),'message':_0x4a127a(0x18b)}),_0x386b9a=_0x22e475['description']?.[_0x4a127a(0x15c)]()||undefined,_0x3d74f9=_0x58c7df[_0x4a127a(0x14a)]||'us01',_0x5ddf3d=await promptSiteSelection(_0x3d74f9,_0x1e955b,_0x4a127a(0x163));if(!_0x5ddf3d)return 0x1;const _0x3e3887=resolveSite(_0x5ddf3d);if(isOAuthSupported(_0x3e3887)){const _0x4c337f=await a34_0x56bb7a({'type':_0x4a127a(0x153),'name':_0x4a127a(0x182),'message':'Choose\x20authentication\x20method:','choices':[{'title':_0x4a127a(0x173),'value':_0x4a127a(0x141)},{'title':_0x4a127a(0x157),'value':_0x4a127a(0x14b)}]});if(!_0x4c337f[_0x4a127a(0x182)])return console[_0x4a127a(0x156)](_0x4a127a(0x16b)),0x1;if(_0x4c337f[_0x4a127a(0x182)]===_0x4a127a(0x141)){if(_0x386b9a){const _0x42dbdc={'site':_0x3e3887,'description':_0x386b9a};saveProfileToUserConfig(_0x1e955b,_0x42dbdc);}return await runOAuthLoginFlow(_0x3e3887,_0x1e955b,_0x58c7df[_0x4a127a(0x168)]??LogLevel['ERROR']),0x0;}}console[_0x4a127a(0x156)](_0x4a127a(0x152)+_0x3e3887),console[_0x4a127a(0x156)](_0x4a127a(0x198)),console[_0x4a127a(0x156)]('\x20\x20'+getConsoleUrl(_0x3e3887,'/app/mp/ak'));const _0x27f06f=await a34_0x56bb7a({'type':_0x4a127a(0x18e),'name':_0x4a127a(0x188),'message':_0x4a127a(0x150),'validate':_0x348a7a=>{const _0x47da22=_0x4a127a;if(!_0x348a7a||!_0x348a7a[_0x47da22(0x15c)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x27f06f[_0x4a127a(0x188)])return console[_0x4a127a(0x156)](_0x4a127a(0x16b)),0x1;const _0x47ed66=_0x27f06f['apiKey'];console[_0x4a127a(0x156)](_0x4a127a(0x144));try{const _0x377ec9=TDX[_0x4a127a(0x16d)]({'site':_0x3e3887,'apiKey':_0x47ed66[_0x4a127a(0x15c)](),'logLevel':_0x58c7df[_0x4a127a(0x168)]??LogLevel['ERROR']}),_0x14f88b=await _0x377ec9['jobs']['getUserInfo']();console[_0x4a127a(0x156)](a34_0x47dd0d['green']('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x14f88b['email']+')');const _0x4fd3bf=await isKeychainAvailable();_0x4fd3bf?(await saveAPIKeyAsync(_0x47ed66[_0x4a127a(0x15c)](),_0x3e3887,_0x1e955b),console['log'](a34_0x47dd0d[_0x4a127a(0x15f)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x1e955b+')')):(console[_0x4a127a(0x15a)](a34_0x47dd0d['yellow'](_0x4a127a(0x195))),console['warn'](a34_0x47dd0d[_0x4a127a(0x166)](_0x4a127a(0x13f))));const _0x4cf3dd={'site':_0x3e3887,..._0x386b9a&&{'description':_0x386b9a}};return saveProfileToUserConfig(_0x1e955b,_0x4cf3dd),console[_0x4a127a(0x156)](a34_0x47dd0d['green']('✓')+'\x20Profile\x20\x27'+_0x1e955b+_0x4a127a(0x151)),console[_0x4a127a(0x156)](),console[_0x4a127a(0x156)](_0x4a127a(0x17c)),console[_0x4a127a(0x156)](_0x4a127a(0x185)+_0x1e955b+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x4a127a(0x156)](_0x4a127a(0x185)+_0x1e955b+_0x4a127a(0x145)),0x0;}catch(_0x4251ea){if(_0x4251ea instanceof HTTPClientError&&_0x4251ea[_0x4a127a(0x174)]===0x191)return printAuthError(_0x4251ea),0x1;return console['error'](a34_0x47dd0d[_0x4a127a(0x181)](_0x4a127a(0x17d)+(_0x4251ea instanceof Error?_0x4251ea[_0x4a127a(0x190)]:String(_0x4251ea)))),console[_0x4a127a(0x17a)](_0x4a127a(0x146)),0x1;}}}function a34_0x4646(){const _0xf720fe=['Profile\x20\x27','profile','\x20\x20(no\x20profiles\x20found)','\x20API\x20key\x20removed\x20from\x20system\x20keychain','\x27\x20does\x20not\x20exist.','tdx.json','30vOAcRf','description','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','includes','oauth','\x27\x20does\x20not\x20exist.\x20Create\x20it?','jobs','Validating\x20API\x20key...','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','getUserInfo','Session\x20profile\x20set\x20to:\x20','\x27\x20updated:\x20','site','apikey','\x20--default\x27\x20to\x20save\x20permanently','ERROR','Remove\x20a\x20profile','dim','Enter\x20your\x20TD\x20API\x20key:','\x27\x20created','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','select','VALID_KEYS','database','log','API\x20Key','73575XqHEGI','\x27\x20removed\x20from\x20configuration','warn','email','trim','text','config','green','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','profile:use','Set\x20session\x20profile','Setup\x20cancelled','\x0aOperation\x20cancelled','\x20Profile\x20\x27','yellow','Removal\x20cancelled','logLevel','parent_segment','tdx:\x20profile\x20remove','\x0aSetup\x20cancelled','profile:set','create','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','2979swlUiA','8743xlzEzK','11710vDLBky','5307FrkHLw','OAuth\x20(browser\x20login)','status','\x20API\x20key\x20saved\x20to\x20system\x20keychain','\x20\x20-\x20','confirm','bold','Create\x20a\x20new\x20profile','error','\x27\x20requires\x20API\x20key\x20validation.','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','✗\x20Validation\x20failed:\x20','session','default','920jBaICV','red','method','length','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x20\x20tdx\x20--profile\x20','418950froLrI','execute','apiKey','Enter\x20profile\x20name:','join','Enter\x20description\x20(optional):','Failed\x20to\x20remove\x20profile:\x20','Default\x20profile\x20set\x20to:\x20','password','split','message','Set\x20a\x20profile\x20configuration\x20value','profile:remove','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','name','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Profile\x20name\x20cannot\x20be\x20empty','1330272SfdJRd','You\x20can\x20find\x20your\x20API\x20key\x20at:','validate','\x0aAvailable\x20profiles:','792igEscL','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','3671646wEJqTq','API\x20key\x20cannot\x20be\x20empty','(cleared)','\x0aSaved\x20to:\x20','/app/mp/ak','tdx:\x20profile\x20set','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>','profileName','profile:create','llm_project','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','tdx:\x20profile\x20create','Operation\x20cancelled','\x20API\x20key\x20is\x20valid\x20(User:\x20'];a34_0x4646=function(){return _0xf720fe;};return a34_0x4646();}export class ProfileRemoveCommand extends BaseCommand{[a34_0x37cb7a(0x194)]=a34_0x37cb7a(0x192);[a34_0x37cb7a(0x13e)]=a34_0x37cb7a(0x14e);[a34_0x37cb7a(0x199)](_0x468c93){const _0xd8a1e0=a34_0x37cb7a,{args:_0xba32cf}=_0x468c93;if(_0xba32cf[_0xd8a1e0(0x183)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async['execute'](_0x4598fe){const _0x52418f=a34_0x37cb7a,{args:_0x8a262d}=_0x4598fe,_0x45cce4=_0x8a262d[0x0];console['log'](a34_0x47dd0d[_0x52418f(0x178)](_0x52418f(0x16a)));if(!profileExists(_0x45cce4)){console[_0x52418f(0x17a)](a34_0x47dd0d[_0x52418f(0x181)]('Profile\x20\x27'+_0x45cce4+_0x52418f(0x13b))),console[_0x52418f(0x156)]('\x0aAvailable\x20profiles:');const _0x16611a=listProfiles();if(_0x16611a[_0x52418f(0x183)]===0x0)console[_0x52418f(0x156)](_0x52418f(0x139));else for(const _0x1626f8 of _0x16611a){console[_0x52418f(0x156)]('\x20\x20-\x20'+_0x1626f8[_0x52418f(0x194)]);}return 0x1;}const _0x20f3db=await a34_0x56bb7a({'type':_0x52418f(0x177),'name':_0x52418f(0x177),'message':_0x52418f(0x193)+_0x45cce4+'\x27?','initial':![]});if(!_0x20f3db[_0x52418f(0x177)])return console[_0x52418f(0x156)](_0x52418f(0x167)),0x0;try{removeProfileFromUserConfig(_0x45cce4),console['log'](a34_0x47dd0d[_0x52418f(0x15f)]('✓')+_0x52418f(0x165)+_0x45cce4+_0x52418f(0x159));}catch(_0x3e668b){return console[_0x52418f(0x17a)](a34_0x47dd0d[_0x52418f(0x181)](_0x52418f(0x18c)+(_0x3e668b instanceof Error?_0x3e668b['message']:String(_0x3e668b)))),0x1;}const _0x4fce89=await isKeychainAvailable();if(_0x4fce89){const _0x2eccb6=await deleteKeychainAPIKey(_0x45cce4);_0x2eccb6&&console[_0x52418f(0x156)](a34_0x47dd0d[_0x52418f(0x15f)]('✓')+_0x52418f(0x13a));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a34_0x37cb7a(0x194)]=a34_0x37cb7a(0x16c);[a34_0x37cb7a(0x13e)]=a34_0x37cb7a(0x191);static [a34_0x37cb7a(0x154)]=[a34_0x37cb7a(0x14a),a34_0x37cb7a(0x155),a34_0x37cb7a(0x169),a34_0x37cb7a(0x1a6),'llm_agent',a34_0x37cb7a(0x13e)];['validate'](_0x634b18){const _0x5e1ff4=a34_0x37cb7a,{args:_0x3f9cc3,options:_0x2b4198}=_0x634b18,_0x5b635f=_0x2b4198['profile']||getActiveProfile();if(!_0x5b635f)return _0x5e1ff4(0x1a3);if(_0x3f9cc3[_0x5e1ff4(0x183)]===0x0)return _0x5e1ff4(0x19c)+ProfileSetCommand['VALID_KEYS'][_0x5e1ff4(0x18a)](',\x20');const _0x54b71b=_0x3f9cc3[0x0];if(!_0x54b71b[_0x5e1ff4(0x140)]('='))return _0x5e1ff4(0x184)+ProfileSetCommand[_0x5e1ff4(0x154)]['join'](',\x20');const [_0x8bf5fd]=_0x54b71b[_0x5e1ff4(0x18f)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x5e1ff4(0x140)](_0x8bf5fd))return'Unknown\x20key\x20\x27'+_0x8bf5fd+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x5e1ff4(0x154)]['join'](',\x20');return undefined;}async[a34_0x37cb7a(0x187)](_0x279831){const _0x2f8657=a34_0x37cb7a,{args:_0xee8d9e,options:_0x261ab0}=_0x279831,_0x5705b5=_0x261ab0[_0x2f8657(0x138)]||getActiveProfile(),[_0x406256,..._0xa9182]=_0xee8d9e[0x0]['split']('='),_0x63e39a=_0xa9182['join']('=');console[_0x2f8657(0x156)](a34_0x47dd0d['bold'](_0x2f8657(0x1a2)));if(!profileExists(_0x5705b5)){const _0x5cc948=await a34_0x56bb7a({'type':_0x2f8657(0x177),'name':'create','message':_0x2f8657(0x1ab)+_0x5705b5+_0x2f8657(0x142),'initial':!![]});if(!_0x5cc948[_0x2f8657(0x16d)])return console[_0x2f8657(0x156)](_0x2f8657(0x1a9)),0x1;}const _0x4c19a1=loadProfile(_0x5705b5),_0x5dc0ae=_0x4c19a1?.[_0x2f8657(0x15e)]||{};if(_0x406256===_0x2f8657(0x14a)){const _0x31e27d=resolveSite(_0x63e39a);console[_0x2f8657(0x156)]('Changing\x20site\x20to\x20\x27'+_0x31e27d+_0x2f8657(0x17b)),console[_0x2f8657(0x156)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x2f8657(0x156)]('\x20\x20'+getConsoleUrl(_0x31e27d,_0x2f8657(0x1a1)));const _0x5521e6=await a34_0x56bb7a({'type':_0x2f8657(0x18e),'name':_0x2f8657(0x188),'message':_0x2f8657(0x16e),'validate':_0x10c268=>{const _0x46f618=_0x2f8657;if(!_0x10c268||!_0x10c268[_0x46f618(0x15c)]())return _0x46f618(0x19e);return!![];}});if(!_0x5521e6[_0x2f8657(0x188)])return console[_0x2f8657(0x156)](_0x2f8657(0x164)),0x1;console[_0x2f8657(0x156)](_0x2f8657(0x144));try{const _0x39cde3=TDX[_0x2f8657(0x16d)]({'site':_0x31e27d,'apiKey':_0x5521e6[_0x2f8657(0x188)]['trim'](),'logLevel':_0x261ab0[_0x2f8657(0x168)]??LogLevel[_0x2f8657(0x14d)]}),_0x5e71bb=await _0x39cde3[_0x2f8657(0x143)][_0x2f8657(0x147)]();console[_0x2f8657(0x156)](a34_0x47dd0d[_0x2f8657(0x15f)]('✓')+_0x2f8657(0x1aa)+_0x5e71bb[_0x2f8657(0x15b)]+')');const _0x4660c4=await isKeychainAvailable();_0x4660c4?(await saveAPIKeyAsync(_0x5521e6[_0x2f8657(0x188)][_0x2f8657(0x15c)](),_0x31e27d,_0x5705b5),console[_0x2f8657(0x156)](a34_0x47dd0d['green']('✓')+_0x2f8657(0x175))):console['warn'](a34_0x47dd0d['yellow'](_0x2f8657(0x195))),_0x5dc0ae[_0x2f8657(0x14a)]=_0x31e27d;}catch(_0x2e48e7){if(_0x2e48e7 instanceof HTTPClientError&&_0x2e48e7[_0x2f8657(0x174)]===0x191)return printAuthError(_0x2e48e7),0x1;return console['error'](a34_0x47dd0d['red'](_0x2f8657(0x17d)+(_0x2e48e7 instanceof Error?_0x2e48e7[_0x2f8657(0x190)]:String(_0x2e48e7)))),console[_0x2f8657(0x17a)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x5dc0ae[_0x406256]=_0x63e39a||undefined;return saveProfileToUserConfig(_0x5705b5,_0x5dc0ae),console['log'](a34_0x47dd0d[_0x2f8657(0x15f)]('✓')+_0x2f8657(0x165)+_0x5705b5+_0x2f8657(0x149)+_0x406256+'='+(_0x63e39a||_0x2f8657(0x19f))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a34_0x37cb7a(0x194)]=a34_0x37cb7a(0x161);[a34_0x37cb7a(0x13e)]=a34_0x37cb7a(0x162);[a34_0x37cb7a(0x199)](_0x52e56c){const _0x7338d=a34_0x37cb7a,{args:_0x2e523d}=_0x52e56c;if(_0x2e523d[_0x7338d(0x183)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a34_0x37cb7a(0x187)](_0x3c8eb3){const _0x1b395e=a34_0x37cb7a,{args:_0x30e097,options:_0x36fd5f}=_0x3c8eb3,_0x3ad409=_0x30e097[0x0],_0x28d5ab=_0x36fd5f[_0x1b395e(0x17f)];cleanExpiredSessions();if(!profileExists(_0x3ad409)){console[_0x1b395e(0x17a)](a34_0x47dd0d[_0x1b395e(0x181)](_0x1b395e(0x1ab)+_0x3ad409+_0x1b395e(0x13b))),console[_0x1b395e(0x156)](_0x1b395e(0x19a));const _0x9a7cd2=listProfiles();if(_0x9a7cd2[_0x1b395e(0x183)]===0x0)console[_0x1b395e(0x156)](_0x1b395e(0x139));else for(const _0x255f8f of _0x9a7cd2){console[_0x1b395e(0x156)](_0x1b395e(0x176)+_0x255f8f[_0x1b395e(0x194)]);}return 0x1;}if(_0x28d5ab){const _0xe5b12e=a34_0x3e2f82[_0x1b395e(0x18a)](getConfigDir(),_0x1b395e(0x13c));return saveActiveProfileToUserConfig(_0x3ad409),console[_0x1b395e(0x156)](_0x1b395e(0x18d)+a34_0x47dd0d[_0x1b395e(0x15f)](_0x3ad409)),console[_0x1b395e(0x156)](a34_0x47dd0d[_0x1b395e(0x14f)](_0x1b395e(0x1a0)+_0xe5b12e)),0x0;}const _0x53eccf=getSessionID(_0x36fd5f[_0x1b395e(0x17e)]);return saveSessionContext({'profile':_0x3ad409},_0x36fd5f[_0x1b395e(0x17e)]),console['log'](_0x1b395e(0x148)+a34_0x47dd0d[_0x1b395e(0x15f)](_0x3ad409)+'\x20'+a34_0x47dd0d[_0x1b395e(0x14f)]('(session:\x20'+_0x53eccf+')')),console[_0x1b395e(0x156)](a34_0x47dd0d[_0x1b395e(0x14f)](_0x1b395e(0x160)+_0x3ad409+_0x1b395e(0x14c))),0x0;}}
1
+ const a34_0x2ac38b=a34_0x455f;(function(_0x430467,_0x39a427){const _0x2e021c=a34_0x455f,_0x1c4750=_0x430467();while(!![]){try{const _0x1b52e3=parseInt(_0x2e021c(0x128))/0x1*(-parseInt(_0x2e021c(0x118))/0x2)+parseInt(_0x2e021c(0x129))/0x3*(parseInt(_0x2e021c(0x125))/0x4)+-parseInt(_0x2e021c(0x12d))/0x5+-parseInt(_0x2e021c(0x139))/0x6+-parseInt(_0x2e021c(0x109))/0x7*(-parseInt(_0x2e021c(0x121))/0x8)+-parseInt(_0x2e021c(0x161))/0x9+parseInt(_0x2e021c(0x162))/0xa;if(_0x1b52e3===_0x39a427)break;else _0x1c4750['push'](_0x1c4750['shift']());}catch(_0x45e183){_0x1c4750['push'](_0x1c4750['shift']());}}}(a34_0x4f32,0xf10ff));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 a34_0x283eef from'node:path';function a34_0x455f(_0x3d306c,_0x1e53bb){_0x3d306c=_0x3d306c-0x108;const _0x4f3214=a34_0x4f32();let _0x455f50=_0x4f3214[_0x3d306c];return _0x455f50;}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{runOAuthLoginFlow}from'./auth-login-command.js';import{isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';function a34_0x4f32(){const _0x35e484=['\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','session','15862VdVibX','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','error','Operation\x20cancelled','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','Profile\x20name\x20cannot\x20be\x20empty','execute','Unknown\x20key\x20\x27','Remove\x20a\x20profile','\x20\x20tdx\x20--profile\x20','API\x20key\x20cannot\x20be\x20empty','config','password','validate','Session\x20profile\x20set\x20to:\x20','16UrnMsH','\x27.\x0a\x0aValid\x20keys:\x20','\x27\x20removed\x20from\x20configuration','tdx:\x20profile\x20remove','\x27\x20created','parent_segment','/app/mp/ak','log','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','5912gBhovE','Setup\x20cancelled','status','trim','143984szmCTT','\x0aSaved\x20to:\x20','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','13757ajhUPo','72uBfkAv','profile:use','includes','dim','1261680ZgAqzL','profile','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x27\x20requires\x20API\x20key\x20validation.','Failed\x20to\x20remove\x20profile:\x20','join','jobs','split','tdx:\x20profile\x20create','\x27\x20does\x20not\x20exist.\x20Create\x20it?','description','\x0aOperation\x20cancelled','11568606cWdMQT','red','profileName','profile:create','site','\x20API\x20key\x20is\x20valid\x20(User:\x20','bold','getUserInfo','\x0aSetup\x20cancelled','\x27\x20does\x20not\x20exist.','warn','database','apiKey','Enter\x20your\x20TD\x20API\x20key:','\x20\x20(no\x20profiles\x20found)','method','API\x20Key','message','ERROR','tdx.json','test','logLevel','green','\x0aAvailable\x20profiles:','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x27\x20updated:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','length','\x20\x20-\x20','profile:set','✗\x20Validation\x20failed:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','tdx:\x20profile\x20set','Site\x20was\x20not\x20changed.','llm_project','llm_agent','VALID_KEYS','name','\x20Profile\x20\x27','14595624pSJOXC','23611420Ikeglr','text','Choose\x20authentication\x20method:','confirm','select','apikey','Profile\x20\x27','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Create\x20a\x20new\x20profile','yellow','Default\x20profile\x20set\x20to:\x20','email','create','Enter\x20description\x20(optional):','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>'];a34_0x4f32=function(){return _0x35e484;};return a34_0x4f32();}import a34_0x56a30e from'prompts';import a34_0x3535c5 from'chalk';function validateProfileName(_0x2e91a4){const _0x40ea19=a34_0x455f;if(!_0x2e91a4||!_0x2e91a4['trim']())return _0x40ea19(0x10e);const _0x54804d=_0x2e91a4[_0x40ea19(0x124)]();if(!/^[a-zA-Z0-9_-]+$/[_0x40ea19(0x14d)](_0x54804d))return _0x40ea19(0x172);if(profileExists(_0x54804d))return'Profile\x20\x27'+_0x54804d+_0x40ea19(0x10d);return!![];}export class ProfileCreateCommand extends BaseCommand{[a34_0x2ac38b(0x15f)]=a34_0x2ac38b(0x13c);[a34_0x2ac38b(0x137)]=a34_0x2ac38b(0x16a);async[a34_0x2ac38b(0x10f)](_0x434306){const _0xc14fdc=a34_0x2ac38b,{options:_0x532bb7,args:_0x17d3e7}=_0x434306;console[_0xc14fdc(0x11f)](a34_0x3535c5[_0xc14fdc(0x13f)](_0xc14fdc(0x135)));let _0x4e967f;if(_0x17d3e7['length']>0x0&&_0x17d3e7[0x0]){const _0xb5ed0a=_0x17d3e7[0x0]['trim'](),_0x59c32f=validateProfileName(_0xb5ed0a);if(_0x59c32f!==!![])return console[_0xc14fdc(0x10b)](a34_0x3535c5['red'](_0x59c32f)),0x1;_0x4e967f=_0xb5ed0a;}else{const _0x1ec393=await a34_0x56a30e({'type':_0xc14fdc(0x163),'name':_0xc14fdc(0x13b),'message':'Enter\x20profile\x20name:','validate':validateProfileName});if(!_0x1ec393[_0xc14fdc(0x13b)])return console[_0xc14fdc(0x11f)](_0xc14fdc(0x141)),0x1;_0x4e967f=_0x1ec393[_0xc14fdc(0x13b)][_0xc14fdc(0x124)]();}const _0x3703c7=await a34_0x56a30e({'type':_0xc14fdc(0x163),'name':_0xc14fdc(0x137),'message':_0xc14fdc(0x16f)}),_0x4e7d6f=_0x3703c7[_0xc14fdc(0x137)]?.[_0xc14fdc(0x124)]()||undefined,_0x1e1e4d=_0x532bb7[_0xc14fdc(0x13d)]||'us01',_0x5f3d7b=await promptSiteSelection(_0x1e1e4d,_0x4e967f,_0xc14fdc(0x122));if(!_0x5f3d7b)return 0x1;const _0x3cfb44=resolveSite(_0x5f3d7b);if(isOAuthSupported(_0x3cfb44)){const _0x498100=await a34_0x56a30e({'type':_0xc14fdc(0x166),'name':'method','message':_0xc14fdc(0x164),'choices':[{'title':'OAuth\x20(browser\x20login)','value':'oauth'},{'title':_0xc14fdc(0x149),'value':_0xc14fdc(0x167)}]});if(!_0x498100[_0xc14fdc(0x148)])return console[_0xc14fdc(0x11f)](_0xc14fdc(0x141)),0x1;if(_0x498100[_0xc14fdc(0x148)]==='oauth'){if(_0x4e7d6f){const _0x343c1e={'site':_0x3cfb44,'description':_0x4e7d6f};saveProfileToUserConfig(_0x4e967f,_0x343c1e);}return await runOAuthLoginFlow(_0x3cfb44,_0x4e967f,_0x532bb7[_0xc14fdc(0x14e)]??LogLevel[_0xc14fdc(0x14b)]),0x0;}}console[_0xc14fdc(0x11f)](_0xc14fdc(0x171)+_0x3cfb44),console[_0xc14fdc(0x11f)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console['log']('\x20\x20'+getConsoleUrl(_0x3cfb44,_0xc14fdc(0x11e)));const _0x7e527c=await a34_0x56a30e({'type':_0xc14fdc(0x115),'name':_0xc14fdc(0x145),'message':_0xc14fdc(0x146),'validate':_0x1d842b=>{const _0x55f2f6=_0xc14fdc;if(!_0x1d842b||!_0x1d842b[_0x55f2f6(0x124)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x7e527c[_0xc14fdc(0x145)])return console[_0xc14fdc(0x11f)](_0xc14fdc(0x141)),0x1;const _0x33949d=_0x7e527c[_0xc14fdc(0x145)];console[_0xc14fdc(0x11f)]('Validating\x20API\x20key...');try{const _0x4cdf81=TDX['create']({'site':_0x3cfb44,'apiKey':_0x33949d[_0xc14fdc(0x124)](),'logLevel':_0x532bb7[_0xc14fdc(0x14e)]??LogLevel[_0xc14fdc(0x14b)]}),_0x27bbdf=await _0x4cdf81[_0xc14fdc(0x133)][_0xc14fdc(0x140)]();console[_0xc14fdc(0x11f)](a34_0x3535c5[_0xc14fdc(0x14f)]('✓')+_0xc14fdc(0x13e)+_0x27bbdf[_0xc14fdc(0x16d)]+')');const _0x5bbd99=await isKeychainAvailable();_0x5bbd99?(await saveAPIKeyAsync(_0x33949d[_0xc14fdc(0x124)](),_0x3cfb44,_0x4e967f),console[_0xc14fdc(0x11f)](a34_0x3535c5[_0xc14fdc(0x14f)]('✓')+_0xc14fdc(0x154)+_0x4e967f+')')):(console['warn'](a34_0x3535c5['yellow']('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0xc14fdc(0x143)](a34_0x3535c5[_0xc14fdc(0x16b)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x3ae6f2={'site':_0x3cfb44,..._0x4e7d6f&&{'description':_0x4e7d6f}};return saveProfileToUserConfig(_0x4e967f,_0x3ae6f2),console['log'](a34_0x3535c5[_0xc14fdc(0x14f)]('✓')+_0xc14fdc(0x160)+_0x4e967f+_0xc14fdc(0x11c)),console['log'](),console[_0xc14fdc(0x11f)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0xc14fdc(0x11f)](_0xc14fdc(0x112)+_0x4e967f+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0xc14fdc(0x11f)](_0xc14fdc(0x112)+_0x4e967f+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x11f327){if(_0x11f327 instanceof HTTPClientError&&_0x11f327['status']===0x191)return printAuthError(_0x11f327),0x1;return console['error'](a34_0x3535c5['red'](_0xc14fdc(0x158)+(_0x11f327 instanceof Error?_0x11f327[_0xc14fdc(0x14a)]:String(_0x11f327)))),console['error'](_0xc14fdc(0x169)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']='profile:remove';[a34_0x2ac38b(0x137)]=a34_0x2ac38b(0x111);[a34_0x2ac38b(0x116)](_0x7d445){const _0xc8bcb4=a34_0x2ac38b,{args:_0x2d066a}=_0x7d445;if(_0x2d066a[_0xc8bcb4(0x155)]===0x0)return _0xc8bcb4(0x159);return undefined;}async[a34_0x2ac38b(0x10f)](_0x8b916a){const _0x16fe37=a34_0x2ac38b,{args:_0x438849}=_0x8b916a,_0x2f622e=_0x438849[0x0];console[_0x16fe37(0x11f)](a34_0x3535c5[_0x16fe37(0x13f)](_0x16fe37(0x11b)));if(!profileExists(_0x2f622e)){console[_0x16fe37(0x10b)](a34_0x3535c5[_0x16fe37(0x13a)](_0x16fe37(0x168)+_0x2f622e+_0x16fe37(0x142))),console[_0x16fe37(0x11f)](_0x16fe37(0x150));const _0x50ff27=listProfiles();if(_0x50ff27[_0x16fe37(0x155)]===0x0)console[_0x16fe37(0x11f)](_0x16fe37(0x147));else for(const _0x10fa6e of _0x50ff27){console[_0x16fe37(0x11f)](_0x16fe37(0x156)+_0x10fa6e[_0x16fe37(0x15f)]);}return 0x1;}const _0x574dcc=await a34_0x56a30e({'type':_0x16fe37(0x165),'name':'confirm','message':_0x16fe37(0x153)+_0x2f622e+'\x27?','initial':![]});if(!_0x574dcc[_0x16fe37(0x165)])return console['log']('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x2f622e),console[_0x16fe37(0x11f)](a34_0x3535c5[_0x16fe37(0x14f)]('✓')+_0x16fe37(0x160)+_0x2f622e+_0x16fe37(0x11a));}catch(_0x1fc0ec){return console[_0x16fe37(0x10b)](a34_0x3535c5[_0x16fe37(0x13a)](_0x16fe37(0x131)+(_0x1fc0ec instanceof Error?_0x1fc0ec['message']:String(_0x1fc0ec)))),0x1;}const _0x32fd2e=await isKeychainAvailable();if(_0x32fd2e){const _0xdf89f2=await deleteKeychainAPIKey(_0x2f622e);_0xdf89f2&&console[_0x16fe37(0x11f)](a34_0x3535c5[_0x16fe37(0x14f)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a34_0x2ac38b(0x157);[a34_0x2ac38b(0x137)]='Set\x20a\x20profile\x20configuration\x20value';static ['VALID_KEYS']=[a34_0x2ac38b(0x13d),a34_0x2ac38b(0x144),a34_0x2ac38b(0x11d),a34_0x2ac38b(0x15c),a34_0x2ac38b(0x15d),a34_0x2ac38b(0x137)];['validate'](_0x3aa30a){const _0x5b0da3=a34_0x2ac38b,{args:_0x258da6,options:_0x24d898}=_0x3aa30a,_0x29be71=_0x24d898[_0x5b0da3(0x12e)]||getActiveProfile();if(!_0x29be71)return _0x5b0da3(0x170);if(_0x258da6[_0x5b0da3(0x155)]===0x0)return _0x5b0da3(0x10a)+ProfileSetCommand[_0x5b0da3(0x15e)][_0x5b0da3(0x132)](',\x20');const _0x22c240=_0x258da6[0x0];if(!_0x22c240[_0x5b0da3(0x12b)]('='))return _0x5b0da3(0x151)+ProfileSetCommand[_0x5b0da3(0x15e)]['join'](',\x20');const [_0x59f2fe]=_0x22c240['split']('=',0x2);if(!ProfileSetCommand[_0x5b0da3(0x15e)][_0x5b0da3(0x12b)](_0x59f2fe))return _0x5b0da3(0x110)+_0x59f2fe+_0x5b0da3(0x119)+ProfileSetCommand[_0x5b0da3(0x15e)][_0x5b0da3(0x132)](',\x20');return undefined;}async[a34_0x2ac38b(0x10f)](_0x2ace78){const _0x2c93fd=a34_0x2ac38b,{args:_0x5615b4,options:_0x15a5e2}=_0x2ace78,_0x46c09e=_0x15a5e2[_0x2c93fd(0x12e)]||getActiveProfile(),[_0x256fba,..._0x444b8d]=_0x5615b4[0x0][_0x2c93fd(0x134)]('='),_0x1f0a07=_0x444b8d[_0x2c93fd(0x132)]('=');console[_0x2c93fd(0x11f)](a34_0x3535c5[_0x2c93fd(0x13f)](_0x2c93fd(0x15a)));if(!profileExists(_0x46c09e)){const _0x4c2903=await a34_0x56a30e({'type':_0x2c93fd(0x165),'name':_0x2c93fd(0x16e),'message':'Profile\x20\x27'+_0x46c09e+_0x2c93fd(0x136),'initial':!![]});if(!_0x4c2903[_0x2c93fd(0x16e)])return console['log'](_0x2c93fd(0x10c)),0x1;}const _0x74ca99=loadProfile(_0x46c09e),_0x1b0fe2=_0x74ca99?.[_0x2c93fd(0x114)]||{};if(_0x256fba===_0x2c93fd(0x13d)){const _0x3ad58f=resolveSite(_0x1f0a07);console[_0x2c93fd(0x11f)]('Changing\x20site\x20to\x20\x27'+_0x3ad58f+_0x2c93fd(0x130)),console[_0x2c93fd(0x11f)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x2c93fd(0x11f)]('\x20\x20'+getConsoleUrl(_0x3ad58f,_0x2c93fd(0x11e)));const _0x14d551=await a34_0x56a30e({'type':_0x2c93fd(0x115),'name':_0x2c93fd(0x145),'message':_0x2c93fd(0x127),'validate':_0x4db131=>{const _0x5ebf53=_0x2c93fd;if(!_0x4db131||!_0x4db131[_0x5ebf53(0x124)]())return _0x5ebf53(0x113);return!![];}});if(!_0x14d551['apiKey'])return console[_0x2c93fd(0x11f)](_0x2c93fd(0x138)),0x1;console[_0x2c93fd(0x11f)]('Validating\x20API\x20key...');try{const _0x16cab1=TDX['create']({'site':_0x3ad58f,'apiKey':_0x14d551['apiKey']['trim'](),'logLevel':_0x15a5e2[_0x2c93fd(0x14e)]??LogLevel[_0x2c93fd(0x14b)]}),_0x3cf62a=await _0x16cab1[_0x2c93fd(0x133)][_0x2c93fd(0x140)]();console[_0x2c93fd(0x11f)](a34_0x3535c5[_0x2c93fd(0x14f)]('✓')+_0x2c93fd(0x13e)+_0x3cf62a[_0x2c93fd(0x16d)]+')');const _0x5a669d=await isKeychainAvailable();_0x5a669d?(await saveAPIKeyAsync(_0x14d551[_0x2c93fd(0x145)][_0x2c93fd(0x124)](),_0x3ad58f,_0x46c09e),console['log'](a34_0x3535c5[_0x2c93fd(0x14f)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x2c93fd(0x143)](a34_0x3535c5[_0x2c93fd(0x16b)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x1b0fe2[_0x2c93fd(0x13d)]=_0x3ad58f;}catch(_0x4b26ce){if(_0x4b26ce instanceof HTTPClientError&&_0x4b26ce[_0x2c93fd(0x123)]===0x191)return printAuthError(_0x4b26ce),0x1;return console['error'](a34_0x3535c5[_0x2c93fd(0x13a)](_0x2c93fd(0x158)+(_0x4b26ce instanceof Error?_0x4b26ce[_0x2c93fd(0x14a)]:String(_0x4b26ce)))),console['error'](_0x2c93fd(0x15b)),0x1;}}else _0x1b0fe2[_0x256fba]=_0x1f0a07||undefined;return saveProfileToUserConfig(_0x46c09e,_0x1b0fe2),console[_0x2c93fd(0x11f)](a34_0x3535c5[_0x2c93fd(0x14f)]('✓')+_0x2c93fd(0x160)+_0x46c09e+_0x2c93fd(0x152)+_0x256fba+'='+(_0x1f0a07||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{[a34_0x2ac38b(0x15f)]=a34_0x2ac38b(0x12a);['description']='Set\x20session\x20profile';[a34_0x2ac38b(0x116)](_0x49bb55){const _0x1c2478=a34_0x2ac38b,{args:_0x59d7d6}=_0x49bb55;if(_0x59d7d6[_0x1c2478(0x155)]===0x0)return _0x1c2478(0x120);return undefined;}async[a34_0x2ac38b(0x10f)](_0x480d80){const _0x8ad395=a34_0x2ac38b,{args:_0x59ac44,options:_0x4758c8}=_0x480d80,_0x11a032=_0x59ac44[0x0],_0x327466=_0x4758c8['default'];cleanExpiredSessions();if(!profileExists(_0x11a032)){console[_0x8ad395(0x10b)](a34_0x3535c5[_0x8ad395(0x13a)](_0x8ad395(0x168)+_0x11a032+'\x27\x20does\x20not\x20exist.')),console[_0x8ad395(0x11f)]('\x0aAvailable\x20profiles:');const _0x3135ac=listProfiles();if(_0x3135ac[_0x8ad395(0x155)]===0x0)console[_0x8ad395(0x11f)](_0x8ad395(0x147));else for(const _0x5d32ea of _0x3135ac){console[_0x8ad395(0x11f)](_0x8ad395(0x156)+_0x5d32ea[_0x8ad395(0x15f)]);}return 0x1;}if(_0x327466){const _0x29d0fc=a34_0x283eef['join'](getConfigDir(),_0x8ad395(0x14c));return saveActiveProfileToUserConfig(_0x11a032),console[_0x8ad395(0x11f)](_0x8ad395(0x16c)+a34_0x3535c5[_0x8ad395(0x14f)](_0x11a032)),console[_0x8ad395(0x11f)](a34_0x3535c5[_0x8ad395(0x12c)](_0x8ad395(0x126)+_0x29d0fc)),0x0;}const _0x2639b7=getSessionID(_0x4758c8[_0x8ad395(0x108)]);return saveSessionContext({'profile':_0x11a032},_0x4758c8['session']),console[_0x8ad395(0x11f)](_0x8ad395(0x117)+a34_0x3535c5[_0x8ad395(0x14f)](_0x11a032)+'\x20'+a34_0x3535c5[_0x8ad395(0x12c)]('(session:\x20'+_0x2639b7+')')),console[_0x8ad395(0x11f)](a34_0x3535c5[_0x8ad395(0x12c)](_0x8ad395(0x12f)+_0x11a032+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
@@ -1 +1 @@
1
- function a35_0x5726(){const _0x2a398e=['map','9496HAlNDH','description','791070MZixjI','Error:\x20','3185231shjkEb','error','4340404zbUpNe','length','site','👤\x20','1558302axBGGL','List\x20all\x20available\x20profiles','dim','\x20\x20Global:\x20~/.config/tdx/tdx.json','profiles','5112MrpPbV','execute','name','3QtkOGR','36581DvUBgu','scope','log','4674240kuKhFv','green','config'];a35_0x5726=function(){return _0x2a398e;};return a35_0x5726();}const a35_0x52aebf=a35_0x2aa3;function a35_0x2aa3(_0x4320d5,_0x80d3a5){_0x4320d5=_0x4320d5-0x188;const _0x5726a1=a35_0x5726();let _0x2aa38e=_0x5726a1[_0x4320d5];return _0x2aa38e;}(function(_0x1da449,_0x20e17a){const _0x32e787=a35_0x2aa3,_0x34a026=_0x1da449();while(!![]){try{const _0xb7236=-parseInt(_0x32e787(0x189))/0x1+-parseInt(_0x32e787(0x192))/0x2+-parseInt(_0x32e787(0x188))/0x3*(-parseInt(_0x32e787(0x196))/0x4)+-parseInt(_0x32e787(0x18c))/0x5+-parseInt(_0x32e787(0x19a))/0x6+parseInt(_0x32e787(0x194))/0x7+-parseInt(_0x32e787(0x190))/0x8*(-parseInt(_0x32e787(0x19f))/0x9);if(_0xb7236===_0x20e17a)break;else _0x34a026['push'](_0x34a026['shift']());}catch(_0xf3abfd){_0x34a026['push'](_0x34a026['shift']());}}}(a35_0x5726,0x8f795));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a35_0x32552d from'chalk';export class ProfilesCommand extends BaseCommand{[a35_0x52aebf(0x1a1)]=a35_0x52aebf(0x19e);['description']=a35_0x52aebf(0x19b);async[a35_0x52aebf(0x1a0)](_0x3e031){const _0x4d8772=a35_0x52aebf,{options:_0x5ec4b8}=_0x3e031;try{const _0x1f237=listProfiles(),_0x51a3c6=getActiveProfile();if(_0x1f237[_0x4d8772(0x197)]===0x0)return console['log']('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console['log']('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console[_0x4d8772(0x18b)](_0x4d8772(0x19d)),0x0;const _0xb18bc7=_0x1f237[_0x4d8772(0x18f)](_0x13e362=>{const _0x2326cf=_0x4d8772,_0x3d3c6e=_0x13e362['name']===_0x51a3c6,_0x25542f=getProfileParams(_0x13e362[_0x2326cf(0x18e)]);return{'name':_0x13e362['name'],'active':_0x3d3c6e,'scope':_0x13e362[_0x2326cf(0x18a)],'description':_0x13e362[_0x2326cf(0x18e)][_0x2326cf(0x191)]||'','params':_0x25542f};});if(isStructuredFormat(_0x5ec4b8))await handleSDKOutput(_0xb18bc7,_0x5ec4b8);else for(const _0x25d21f of _0x1f237){const _0x293552=_0x25d21f['name']===_0x51a3c6?a35_0x32552d[_0x4d8772(0x18d)]('\x20✓'):'',_0x163a44=_0x25d21f[_0x4d8772(0x18e)][_0x4d8772(0x198)]?a35_0x32552d['dim']('\x20'+_0x25d21f[_0x4d8772(0x18e)][_0x4d8772(0x198)]):'',_0x4f0832=_0x25d21f[_0x4d8772(0x18e)]['description']?a35_0x32552d[_0x4d8772(0x19c)]('\x20\x20'+_0x25d21f[_0x4d8772(0x18e)][_0x4d8772(0x191)]):'';console[_0x4d8772(0x18b)](_0x4d8772(0x199)+_0x25d21f[_0x4d8772(0x1a1)]+_0x293552+_0x163a44+_0x4f0832);}return 0x0;}catch(_0x4d27d9){return _0x4d27d9 instanceof Error&&console[_0x4d8772(0x195)](_0x4d8772(0x193)+_0x4d27d9['message']),0x1;}}}
1
+ const a35_0x402504=a35_0x590a;(function(_0x85cf6d,_0x2c6240){const _0x2dcc3e=a35_0x590a,_0x55d020=_0x85cf6d();while(!![]){try{const _0x438a8b=-parseInt(_0x2dcc3e(0x88))/0x1*(parseInt(_0x2dcc3e(0x7f))/0x2)+parseInt(_0x2dcc3e(0x78))/0x3*(parseInt(_0x2dcc3e(0x7d))/0x4)+-parseInt(_0x2dcc3e(0x7b))/0x5+parseInt(_0x2dcc3e(0x8f))/0x6+-parseInt(_0x2dcc3e(0x8e))/0x7+parseInt(_0x2dcc3e(0x8d))/0x8*(-parseInt(_0x2dcc3e(0x8a))/0x9)+-parseInt(_0x2dcc3e(0x8c))/0xa*(-parseInt(_0x2dcc3e(0x80))/0xb);if(_0x438a8b===_0x2c6240)break;else _0x55d020['push'](_0x55d020['shift']());}catch(_0x233589){_0x55d020['push'](_0x55d020['shift']());}}}(a35_0x5aa8,0x6ccef));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a35_0x5aa8(){const _0x13f68f=['message','16pjWAAo','\x20\x20Global:\x20~/.config/tdx/tdx.json','282awYsqV','2398aSayXo','length','config','error','dim','List\x20all\x20available\x20profiles','site','log','2721uzRPXB','Error:\x20','51201aysjkm','map','55770UQJjye','296KIvTuK','1718486bawhab','4081392RjjpbH','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','green','scope','description','31143aWMnkm','name','👤\x20','3261055YrEjjB'];a35_0x5aa8=function(){return _0x13f68f;};return a35_0x5aa8();}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';function a35_0x590a(_0x2ebcae,_0x498d9a){_0x2ebcae=_0x2ebcae-0x76;const _0x5aa8c3=a35_0x5aa8();let _0x590a2f=_0x5aa8c3[_0x2ebcae];return _0x590a2f;}import a35_0x8e6730 from'chalk';export class ProfilesCommand extends BaseCommand{['name']='profiles';[a35_0x402504(0x77)]=a35_0x402504(0x85);async['execute'](_0x10149e){const _0xf55be2=a35_0x402504,{options:_0x298087}=_0x10149e;try{const _0x10510e=listProfiles(),_0x2baa1d=getActiveProfile();if(_0x10510e[_0xf55be2(0x81)]===0x0)return console['log']('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console[_0xf55be2(0x87)](_0xf55be2(0x90)),console[_0xf55be2(0x87)](_0xf55be2(0x7e)),0x0;const _0x46016b=_0x10510e[_0xf55be2(0x8b)](_0x37625d=>{const _0x5f14ad=_0xf55be2,_0x19f509=_0x37625d[_0x5f14ad(0x79)]===_0x2baa1d,_0x40df40=getProfileParams(_0x37625d['config']);return{'name':_0x37625d[_0x5f14ad(0x79)],'active':_0x19f509,'scope':_0x37625d[_0x5f14ad(0x76)],'description':_0x37625d[_0x5f14ad(0x82)][_0x5f14ad(0x77)]||'','params':_0x40df40};});if(isStructuredFormat(_0x298087))await handleSDKOutput(_0x46016b,_0x298087);else for(const _0x3a2821 of _0x10510e){const _0x3b9d15=_0x3a2821[_0xf55be2(0x79)]===_0x2baa1d?a35_0x8e6730[_0xf55be2(0x91)]('\x20✓'):'',_0x2ff571=_0x3a2821[_0xf55be2(0x82)][_0xf55be2(0x86)]?a35_0x8e6730[_0xf55be2(0x84)]('\x20'+_0x3a2821['config'][_0xf55be2(0x86)]):'',_0x273990=_0x3a2821[_0xf55be2(0x82)]['description']?a35_0x8e6730[_0xf55be2(0x84)]('\x20\x20'+_0x3a2821[_0xf55be2(0x82)][_0xf55be2(0x77)]):'';console['log'](_0xf55be2(0x7a)+_0x3a2821['name']+_0x3b9d15+_0x2ff571+_0x273990);}return 0x0;}catch(_0x1d87e0){return _0x1d87e0 instanceof Error&&console[_0xf55be2(0x83)](_0xf55be2(0x89)+_0x1d87e0[_0xf55be2(0x7c)]),0x1;}}}
@@ -1 +1 @@
1
- const a36_0x9d2a58=a36_0x5588;(function(_0x52ac91,_0x40985f){const _0xc58189=a36_0x5588,_0x375bd8=_0x52ac91();while(!![]){try{const _0x31d7d4=parseInt(_0xc58189(0x1ab))/0x1+parseInt(_0xc58189(0x198))/0x2+-parseInt(_0xc58189(0x1a7))/0x3+-parseInt(_0xc58189(0x192))/0x4+-parseInt(_0xc58189(0x18a))/0x5+-parseInt(_0xc58189(0x19d))/0x6*(parseInt(_0xc58189(0x1b2))/0x7)+-parseInt(_0xc58189(0x1b9))/0x8*(-parseInt(_0xc58189(0x197))/0x9);if(_0x31d7d4===_0x40985f)break;else _0x375bd8['push'](_0x375bd8['shift']());}catch(_0x42ed11){_0x375bd8['push'](_0x375bd8['shift']());}}}(a36_0x11b2,0xf1534));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';function a36_0x11b2(){const _0x3aecf8=['length','72WInFNz','totalSplits','catalog','Site:\x20','Executing\x20query\x20[','Schema:\x20','3295165eBxlEX','information_schema','message','jobId','args','\x20[Job\x20ID:\x20','No\x20SQL\x20provided','output','3380568kgQbFt','setPhase','execute','site','Error:\x20','2712672dLdjol','2110552cbGzPs','validate','originalMessage','\x0aAll\x20results\x20saved\x20to\x20','elapsedTimeMillis','5610lvjynF','setJobId','completedSplits','SQL:\x20','file','in\x20','data','Run\x20Trino\x20queries\x20(streaming)','database','Query\x20completed:\x20Processed\x20','3702327hZopvq','...','options','query','15839iMmHWU','Executing\x20statement\x20','join','error','setExtra','stats','\x20rows\x20','427teZLRw','processedRows','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','name','Statement\x20','description'];a36_0x11b2=function(){return _0x3aecf8;};return a36_0x11b2();}function a36_0x5588(_0x15b109,_0x481152){_0x15b109=_0x15b109-0x189;const _0x11b25b=a36_0x11b2();let _0x5588bc=_0x11b25b[_0x15b109];return _0x5588bc;}export class QueryCommand extends BaseCommand{[a36_0x9d2a58(0x1b5)]=a36_0x9d2a58(0x1aa);[a36_0x9d2a58(0x1b7)]=a36_0x9d2a58(0x1a4);async[a36_0x9d2a58(0x194)](_0x5e80c4){const _0xadcb7c=a36_0x9d2a58,{options:_0x596329,args:_0x56ced0,tdx:_0x194118}=_0x5e80c4,_0x340e3d={..._0x596329,'limitStructuredFormats':!![]},_0x6b8b42=_0x56ced0[0x0],_0x58e706=_0x596329['file'];let _0x232163;try{if(_0x58e706)_0x232163=readSqlStatementsFromFile(_0x58e706);else{if(_0x6b8b42==='-')_0x232163=await readSqlStatementsFromStdin();else{if(_0x6b8b42&&isSqlFilePath(_0x6b8b42))_0x232163=readSqlStatementsFromFile(_0x6b8b42);else{if(_0x6b8b42)_0x232163=splitSqlStatements(_0x6b8b42);else throw new Error(_0xadcb7c(0x190));}}}}catch(_0x424c12){return console[_0xadcb7c(0x1ae)](_0xadcb7c(0x196)+_0x424c12[_0xadcb7c(0x18c)]),0x1;}const _0xc56288=_0x596329[_0xadcb7c(0x1a5)]||_0xadcb7c(0x18b),_0x3ae8a0=_0x596329[_0xadcb7c(0x1bb)];try{const _0xe075f6=[],_0x1c5ae2=!!_0x596329[_0xadcb7c(0x191)];for(let _0x33eea0=0x0;_0x33eea0<_0x232163['length'];_0x33eea0++){const _0xdfef11=_0x232163[_0x33eea0],_0x4b5810=_0x33eea0+0x1,_0x197b18=_0x232163[_0xadcb7c(0x1b8)],_0x5d01fd=_0x197b18>0x1;_0x596329['verbose']&&(console[_0xadcb7c(0x1ae)]('\x0a'+(_0x5d01fd?_0xadcb7c(0x1b6)+_0x4b5810+'/'+_0x197b18+':':'')),console[_0xadcb7c(0x1ae)](_0xadcb7c(0x1bc)+_0x596329[_0xadcb7c(0x195)]),console[_0xadcb7c(0x1ae)]('Catalog:\x20'+(_0x3ae8a0||'td')),console[_0xadcb7c(0x1ae)](_0xadcb7c(0x189)+_0xc56288),console[_0xadcb7c(0x1ae)](_0xadcb7c(0x1a0)+_0xdfef11));const _0x39e397=_0x5d01fd?_0xadcb7c(0x1ac)+_0x4b5810+'/'+_0x197b18+_0xadcb7c(0x1a8):'Executing\x20query...';try{const _0x59a5be=await withProgressSpinner(_0x39e397,async _0x4bf850=>{const _0x1a9497=_0xadcb7c,_0x15260a=await _0x194118[_0x1a9497(0x1aa)][_0x1a9497(0x194)](_0xdfef11,{'catalog':_0x3ae8a0,'schema':_0xc56288,'onJobId':_0x587050=>{const _0x3e6782=_0x1a9497;_0x4bf850[_0x3e6782(0x19e)](_0x587050);},'onProgress':_0x5e9590=>{const _0x3fa65d=_0x1a9497;_0x4bf850[_0x3fa65d(0x193)](_0x3fa65d(0x1bd)+_0x5e9590['state']+']'),_0x4bf850[_0x3fa65d(0x1af)](formatRows(_0x5e9590[_0x3fa65d(0x1b3)])+_0x3fa65d(0x1b1)+_0x5e9590[_0x3fa65d(0x19f)]+'/'+_0x5e9590[_0x3fa65d(0x1ba)]+'\x20splits');}});return _0x15260a;},{'verbose':_0x596329['verbose']}),_0x1ed01c=_0x59a5be[_0xadcb7c(0x1a3)],_0x180b02=_0x1ed01c['jobId']?_0xadcb7c(0x18f)+_0x1ed01c[_0xadcb7c(0x18d)]+']':'',_0x191587=_0x5d01fd?'Statement\x20'+_0x4b5810+'/'+_0x197b18+'\x20-\x20':'';console[_0xadcb7c(0x1ae)]('✔\x20'+_0x191587+_0xadcb7c(0x1a6)+formatRows(_0x1ed01c['stats'][_0xadcb7c(0x1b3)])+_0xadcb7c(0x1b1)+(_0xadcb7c(0x1a2)+formatElapsed(_0x1ed01c[_0xadcb7c(0x1b0)][_0xadcb7c(0x19c)])+_0x180b02));if(_0x5d01fd&&_0x1c5ae2){const _0x59f602=resolveOutputOptions(_0x340e3d),_0x511a25=await formatQueryOutput(_0x1ed01c,_0x59f602);_0xe075f6['push'](_0x511a25);}else await handleQueryOutput(_0x1ed01c,_0x340e3d);}catch(_0x46af99){const _0x3b94bd=_0x5d01fd?_0xadcb7c(0x1b6)+_0x4b5810+'/'+_0x197b18+':\x0a':'',_0x18d2a5=_0x46af99 instanceof SDKError?_0x46af99[_0xadcb7c(0x19a)]:_0x46af99[_0xadcb7c(0x18c)];return console[_0xadcb7c(0x1ae)](''+_0x3b94bd+_0x18d2a5),0x1;}}if(_0x232163[_0xadcb7c(0x1b8)]>0x1&&_0x1c5ae2&&_0xe075f6[_0xadcb7c(0x1b8)]>0x0){const _0x344fea=_0xe075f6[_0xadcb7c(0x1ad)]('\x0a');writeFileSync(_0x596329['output'],_0x344fea),console[_0xadcb7c(0x1ae)](_0xadcb7c(0x19b)+_0x596329[_0xadcb7c(0x191)]);}return 0x0;}catch(_0x17d888){throw _0x17d888;}}[a36_0x9d2a58(0x199)](_0x53945c){const _0x3268e5=a36_0x9d2a58,_0x137040=_0x53945c[_0x3268e5(0x18e)][0x0],_0x5d814d=_0x53945c[_0x3268e5(0x1a9)][_0x3268e5(0x1a1)];if(!_0x137040&&!_0x5d814d)return _0x3268e5(0x1b4);if(_0x137040&&_0x5d814d)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}
1
+ const a36_0x2cf192=a36_0x2fa9;(function(_0x318084,_0x2203c9){const _0x510a08=a36_0x2fa9,_0x5a2334=_0x318084();while(!![]){try{const _0x4b50d4=-parseInt(_0x510a08(0x187))/0x1+-parseInt(_0x510a08(0x170))/0x2*(-parseInt(_0x510a08(0x179))/0x3)+parseInt(_0x510a08(0x167))/0x4*(-parseInt(_0x510a08(0x18d))/0x5)+parseInt(_0x510a08(0x190))/0x6+-parseInt(_0x510a08(0x16f))/0x7+parseInt(_0x510a08(0x186))/0x8*(parseInt(_0x510a08(0x197))/0x9)+parseInt(_0x510a08(0x188))/0xa;if(_0x4b50d4===_0x2203c9)break;else _0x5a2334['push'](_0x5a2334['shift']());}catch(_0x5bd7b4){_0x5a2334['push'](_0x5a2334['shift']());}}}(a36_0x108f,0xd1de4));import{BaseCommand}from'./command.js';function a36_0x108f(){const _0x4e9314=['description','Executing\x20statement\x20','execute','1251795EjbOrm','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','options','7766424aSSmqB','totalSplits','Error:\x20','validate','query','push','catalog','9UDapsh','\x20rows\x20','in\x20','20kUuBWT','No\x20SQL\x20provided','data','message','output','verbose','Schema:\x20','information_schema','6197499KIpWTY','1966eWlGxy','Catalog:\x20','completedSplits','processedRows','setExtra','file','\x20splits','stats','Site:\x20','2343BOtpNC','length','\x20[Job\x20ID:\x20','Executing\x20query\x20[','\x0aAll\x20results\x20saved\x20to\x20','Executing\x20query...','originalMessage','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','Run\x20Trino\x20queries\x20(streaming)','database','Query\x20completed:\x20Processed\x20','Statement\x20','error','2278472QzIIyX','1312416saAXAs','19622520KUgDTg','site'];a36_0x108f=function(){return _0x4e9314;};return a36_0x108f();}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 a36_0x2fa9(_0x44659f,_0x17e778){_0x44659f=_0x44659f-0x165;const _0x108f1b=a36_0x108f();let _0x2fa9fc=_0x108f1b[_0x44659f];return _0x2fa9fc;}export class QueryCommand extends BaseCommand{['name']=a36_0x2cf192(0x194);[a36_0x2cf192(0x18a)]=a36_0x2cf192(0x181);async[a36_0x2cf192(0x18c)](_0x543236){const _0x41d086=a36_0x2cf192,{options:_0x4cb100,args:_0x207ce4,tdx:_0x1364b4}=_0x543236,_0x511c35={..._0x4cb100,'limitStructuredFormats':!![]},_0x1b0678=_0x207ce4[0x0],_0x1c6b41=_0x4cb100[_0x41d086(0x175)];let _0x4bb1c3;try{if(_0x1c6b41)_0x4bb1c3=readSqlStatementsFromFile(_0x1c6b41);else{if(_0x1b0678==='-')_0x4bb1c3=await readSqlStatementsFromStdin();else{if(_0x1b0678&&isSqlFilePath(_0x1b0678))_0x4bb1c3=readSqlStatementsFromFile(_0x1b0678);else{if(_0x1b0678)_0x4bb1c3=splitSqlStatements(_0x1b0678);else throw new Error(_0x41d086(0x168));}}}}catch(_0x31a1ce){return console['error'](_0x41d086(0x192)+_0x31a1ce[_0x41d086(0x16a)]),0x1;}const _0x5ec131=_0x4cb100[_0x41d086(0x182)]||_0x41d086(0x16e),_0x39eac1=_0x4cb100[_0x41d086(0x196)];try{const _0x321b78=[],_0x53f911=!!_0x4cb100['output'];for(let _0x847968=0x0;_0x847968<_0x4bb1c3[_0x41d086(0x17a)];_0x847968++){const _0x70f719=_0x4bb1c3[_0x847968],_0x1784a9=_0x847968+0x1,_0xae187f=_0x4bb1c3[_0x41d086(0x17a)],_0x5176d2=_0xae187f>0x1;_0x4cb100['verbose']&&(console[_0x41d086(0x185)]('\x0a'+(_0x5176d2?'Statement\x20'+_0x1784a9+'/'+_0xae187f+':':'')),console[_0x41d086(0x185)](_0x41d086(0x178)+_0x4cb100[_0x41d086(0x189)]),console['error'](_0x41d086(0x171)+(_0x39eac1||'td')),console[_0x41d086(0x185)](_0x41d086(0x16d)+_0x5ec131),console[_0x41d086(0x185)]('SQL:\x20'+_0x70f719));const _0x494fd7=_0x5176d2?_0x41d086(0x18b)+_0x1784a9+'/'+_0xae187f+'...':_0x41d086(0x17e);try{const _0x486e1d=await withProgressSpinner(_0x494fd7,async _0x2700dd=>{const _0x3777d4=_0x41d086,_0x2b8558=await _0x1364b4['query'][_0x3777d4(0x18c)](_0x70f719,{'catalog':_0x39eac1,'schema':_0x5ec131,'onJobId':_0x4ecf6c=>{_0x2700dd['setJobId'](_0x4ecf6c);},'onProgress':_0x34d6bf=>{const _0x1ceb8b=_0x3777d4;_0x2700dd['setPhase'](_0x1ceb8b(0x17c)+_0x34d6bf['state']+']'),_0x2700dd[_0x1ceb8b(0x174)](formatRows(_0x34d6bf[_0x1ceb8b(0x173)])+_0x1ceb8b(0x165)+_0x34d6bf[_0x1ceb8b(0x172)]+'/'+_0x34d6bf[_0x1ceb8b(0x191)]+_0x1ceb8b(0x176));}});return _0x2b8558;},{'verbose':_0x4cb100[_0x41d086(0x16c)]}),_0x214fa7=_0x486e1d[_0x41d086(0x169)],_0x33feda=_0x214fa7['jobId']?_0x41d086(0x17b)+_0x214fa7['jobId']+']':'',_0x2e3ea2=_0x5176d2?_0x41d086(0x184)+_0x1784a9+'/'+_0xae187f+'\x20-\x20':'';console[_0x41d086(0x185)]('✔\x20'+_0x2e3ea2+_0x41d086(0x183)+formatRows(_0x214fa7['stats'][_0x41d086(0x173)])+_0x41d086(0x165)+(_0x41d086(0x166)+formatElapsed(_0x214fa7[_0x41d086(0x177)]['elapsedTimeMillis'])+_0x33feda));if(_0x5176d2&&_0x53f911){const _0x42913d=resolveOutputOptions(_0x511c35),_0x5e658a=await formatQueryOutput(_0x214fa7,_0x42913d);_0x321b78[_0x41d086(0x195)](_0x5e658a);}else await handleQueryOutput(_0x214fa7,_0x511c35);}catch(_0x21e7b0){const _0x5b60e8=_0x5176d2?_0x41d086(0x184)+_0x1784a9+'/'+_0xae187f+':\x0a':'',_0x3bff6d=_0x21e7b0 instanceof SDKError?_0x21e7b0[_0x41d086(0x17f)]:_0x21e7b0[_0x41d086(0x16a)];return console['error'](''+_0x5b60e8+_0x3bff6d),0x1;}}if(_0x4bb1c3[_0x41d086(0x17a)]>0x1&&_0x53f911&&_0x321b78['length']>0x0){const _0x752935=_0x321b78['join']('\x0a');writeFileSync(_0x4cb100[_0x41d086(0x16b)],_0x752935),console[_0x41d086(0x185)](_0x41d086(0x17d)+_0x4cb100[_0x41d086(0x16b)]);}return 0x0;}catch(_0x224f43){throw _0x224f43;}}[a36_0x2cf192(0x193)](_0x5075b4){const _0x4e15c3=a36_0x2cf192,_0x416e4f=_0x5075b4['args'][0x0],_0x546066=_0x5075b4[_0x4e15c3(0x18f)][_0x4e15c3(0x175)];if(!_0x416e4f&&!_0x546066)return _0x4e15c3(0x18e);if(_0x416e4f&&_0x546066)return _0x4e15c3(0x180);return undefined;}}
@@ -1 +1 @@
1
- const a37_0x474c2c=a37_0x175b;(function(_0x293803,_0x1c2cea){const _0x42d03b=a37_0x175b,_0x34de6d=_0x293803();while(!![]){try{const _0x3a7aba=parseInt(_0x42d03b(0x11b))/0x1*(parseInt(_0x42d03b(0xcc))/0x2)+-parseInt(_0x42d03b(0x122))/0x3*(parseInt(_0x42d03b(0xbb))/0x4)+parseInt(_0x42d03b(0xbf))/0x5+-parseInt(_0x42d03b(0x144))/0x6+-parseInt(_0x42d03b(0x131))/0x7*(-parseInt(_0x42d03b(0x127))/0x8)+-parseInt(_0x42d03b(0xce))/0x9*(parseInt(_0x42d03b(0xdd))/0xa)+-parseInt(_0x42d03b(0xfe))/0xb;if(_0x3a7aba===_0x1c2cea)break;else _0x34de6d['push'](_0x34de6d['shift']());}catch(_0x22351c){_0x34de6d['push'](_0x34de6d['shift']());}}}(a37_0x2542,0xb2272));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a37_0x1ddbc8 from'chalk';function a37_0x2542(){const _0x301ee7=['Show\x20schedule\x20execution\x20history','\x20created','Schedule\x20deleted:\x20','queryUrl','Searching\x20scheduled\x20queries\x20matching\x20\x22','Creating\x20schedule:\x20','log','name','Schedule\x20updated:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','m\x20ago','\x20(showing\x20','Found\x20','never','Showing\x20first\x20','user','database','padEnd','show','2939574OgUDwd','options','from','execute','start_at','success','last_job','queries','\x20\x20Num:\x20','schedule:update','Query\x20file\x20is\x20empty','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','timezone','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','h\x20ago','INVALID_ARGUMENT','create','scheduled_at','Delete\x20a\x20scheduled\x20query','created_at','schedules','\x20matching\x20\x22','No\x20scheduled\x20queries\x20found','\x22...','schedule:history','table','Getting\x20schedule\x20details...','length','abs','449348OosuWu','Schedule\x20run\x20submitted:\x20','Creating\x20schedule...','List\x20scheduled\x20queries','count','status','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','474PsVNNJ','soon','priority','map','round','8UJyRyc','num','schedule:show','type','file','run','(unnamed)','\x20\x20Timezone:\x20','time_zone','job_id','7738717XDqogN','ended_at','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','history','repeat','listQueries','pagination','trim','format','lastRun','jobs','update','Show\x20schedule\x20details','Getting\x20schedule\x20history...','query','in\x20','delete','\x20\x20Time:\x20','green','3819870gnmnyx','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','args','\x20\x20Type:\x20','delay','join','toLocaleDateString','Cancelled','...','cyan','\x20schedules','data','jsonl','Running\x20schedule:\x20','max','21804ZGHcTN','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','utf-8','\x20\x20Database:\x20','4644180NdriaU','\x20\x20→\x20','\x20execution','red','description','schedule:run','tsv','just\x20now','engineVersion','output','list','nextRun','Create\x20a\x20scheduled\x20query','4qUZAcU','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','985977agYRGN','validate','Deleting\x20schedule...','Running\x20schedule...','end_at','retry_limit','trino','updated_at','Updating\x20schedule...','retryLimit','Failed\x20to\x20read\x20file:\x20','verbose','/app/queries/editor?queryId=','cron','\x20job','40aOzmup','json','keys','user_name','statusIcon','engine_version','result','error','next_run_at','d\x20ago','getTime','dim','\x20\x20Job\x20ID:\x20','executing_user_id'];a37_0x2542=function(){return _0x301ee7;};return a37_0x2542();}function a37_0x175b(_0x1d36d4,_0x3f2f2b){_0x1d36d4=_0x1d36d4-0xba;const _0x254240=a37_0x2542();let _0x175b7c=_0x254240[_0x1d36d4];return _0x175b7c;}function formatRelativeTime(_0x11b074){const _0x54e002=a37_0x175b,_0xf7bbbf=new Date(_0x11b074),_0x24cf84=new Date(),_0x48257e=_0xf7bbbf['getTime']()-_0x24cf84[_0x54e002(0xe7)](),_0x2a01e3=Math[_0x54e002(0x11a)](_0x48257e)/0x3e8,_0x28e14a=_0x48257e<0x0;if(_0x2a01e3<0x3c)return _0x28e14a?_0x54e002(0xc6):_0x54e002(0x123);else{if(_0x2a01e3<0xe10){const _0x5a8587=Math['round'](_0x2a01e3/0x3c);return _0x28e14a?_0x5a8587+_0x54e002(0xf5):_0x54e002(0x140)+_0x5a8587+'m';}else{if(_0x2a01e3<0x15180){const _0x1b1605=Math[_0x54e002(0x126)](_0x2a01e3/0xe10);return _0x28e14a?_0x1b1605+_0x54e002(0x10c):_0x54e002(0x140)+_0x1b1605+'h';}else{if(_0x2a01e3<0x93a80){const _0x411898=Math[_0x54e002(0x126)](_0x2a01e3/0x15180);return _0x28e14a?_0x411898+_0x54e002(0xe6):_0x54e002(0x140)+_0x411898+'d';}else return _0xf7bbbf[_0x54e002(0x14a)]();}}}}export class ScheduleListCommand extends BaseCommand{['name']='schedule:list';[a37_0x474c2c(0xc3)]=a37_0x474c2c(0x11e);async[a37_0x474c2c(0x101)](_0x2f4bc3){const _0x21679c=a37_0x474c2c,{options:_0x212ec1,args:_0x5010c9,tdx:_0x23375a}=_0x2f4bc3,_0x5ff770=resolveLimit(_0x212ec1['limit'],DEFAULT_DISPLAY_LIMIT),_0x1ea1bd=_0x5010c9[0x0],_0x34d672=_0x1ea1bd?_0x21679c(0xef)+_0x1ea1bd+_0x21679c(0x115):'Listing\x20scheduled\x20queries...',_0x251c53=await withSpinner(_0x34d672,()=>_0x23375a['schedules'][_0x21679c(0x136)]({'limit':_0x5ff770,'scheduled':!![],'pattern':_0x1ea1bd}),{'verbose':_0x212ec1[_0x21679c(0xd9)]}),_0x5995bc=_0x251c53[_0x21679c(0x14f)][_0x21679c(0x105)],_0xebfeed=_0x251c53[_0x21679c(0x14f)][_0x21679c(0x137)]['has_next_page'],_0x4a9575=_0x1ea1bd?_0x21679c(0x113)+_0x1ea1bd+'\x22':'';_0xebfeed?console[_0x21679c(0xe4)](_0x21679c(0xf9)+_0x5995bc['length']+_0x21679c(0x14e)+_0x4a9575+'\x20(use\x20--limit\x20to\x20see\x20more)'):console['error'](_0x21679c(0xf7)+_0x5995bc[_0x21679c(0x119)]+'\x20scheduled\x20quer'+(_0x5995bc['length']!==0x1?'ies':'y')+_0x4a9575);if(_0x212ec1[_0x21679c(0x139)]===_0x21679c(0xde)||_0x212ec1[_0x21679c(0x139)]===_0x21679c(0x150)||_0x212ec1['format']===_0x21679c(0x117)||_0x212ec1['format']===_0x21679c(0xc5)){const _0x384f92=_0x5995bc[_0x21679c(0x125)](_0x3b4810=>({'id':_0x3b4810['id'],'name':_0x3b4810[_0x21679c(0xf2)],'cron':_0x3b4810[_0x21679c(0xdb)],'database':_0x3b4810[_0x21679c(0xfb)]?.['name'],'type':_0x3b4810[_0x21679c(0x12a)],'timezone':_0x3b4810[_0x21679c(0x12f)],'user_name':_0x3b4810[_0x21679c(0xfa)]?.[_0x21679c(0xf2)],'updated_at':_0x3b4810[_0x21679c(0xd5)],'next_run_at':_0x3b4810[_0x21679c(0xe5)],'last_job_status':_0x3b4810[_0x21679c(0x104)]?.['status']}));await handleSDKOutput(_0x384f92,_0x212ec1);}else{if(_0x5995bc[_0x21679c(0x119)]===0x0)console[_0x21679c(0xf1)](_0x21679c(0x114));else{const _0x45f1f8=_0x212ec1['site'],_0xafe3d8=_0x5995bc['map'](_0x58b01d=>{const _0x8dd711=_0x21679c,_0x240c23=_0x58b01d[_0x8dd711(0x104)]?.[_0x8dd711(0x120)]?_0x58b01d[_0x8dd711(0x104)][_0x8dd711(0x120)]===_0x8dd711(0x103)?'✓':'✗':'-',_0x3c0d42=_0x58b01d['last_job']?.[_0x8dd711(0x132)]?formatRelativeTime(_0x58b01d[_0x8dd711(0x104)][_0x8dd711(0x132)]):_0x8dd711(0xf8),_0xc4e0f1=_0x58b01d[_0x8dd711(0xe5)]?formatRelativeTime(_0x58b01d['next_run_at']):'-',_0x335604=_0x58b01d[_0x8dd711(0xdb)]||'',_0x59ab79=_0x58b01d['name']||_0x8dd711(0x12d),_0x549003=getConsoleUrl(_0x45f1f8,_0x8dd711(0xda)+_0x58b01d['id']);return{'statusIcon':_0x240c23,'lastRun':_0x3c0d42,'nextRun':_0xc4e0f1,'cron':_0x335604,'name':_0x59ab79,'queryUrl':_0x549003,'status':_0x58b01d[_0x8dd711(0x104)]?.[_0x8dd711(0x120)]};}),_0xcbf8e=Math[_0x21679c(0xba)](..._0xafe3d8[_0x21679c(0x125)](_0x152821=>_0x152821[_0x21679c(0x13a)][_0x21679c(0x119)])),_0x16a88f=Math[_0x21679c(0xba)](..._0xafe3d8[_0x21679c(0x125)](_0x3e2480=>_0x3e2480[_0x21679c(0xca)][_0x21679c(0x119)])),_0x8511f2=Math[_0x21679c(0xba)](..._0xafe3d8['map'](_0x5cd4a1=>_0x5cd4a1[_0x21679c(0xdb)]['length'])),_0x19143c=_0xafe3d8[_0x21679c(0x125)](_0x8adc29=>{const _0xc37899=_0x21679c,_0x7a5182=_0x8adc29[_0xc37899(0x120)]==='success'?a37_0x1ddbc8[_0xc37899(0x143)](_0x8adc29['statusIcon']):_0x8adc29[_0xc37899(0x120)]===_0xc37899(0xe4)?a37_0x1ddbc8[_0xc37899(0xc2)](_0x8adc29[_0xc37899(0xe1)]):a37_0x1ddbc8[_0xc37899(0xe8)](_0x8adc29[_0xc37899(0xe1)]),_0x2177d6=_0x8adc29[_0xc37899(0x13a)][_0xc37899(0xfc)](_0xcbf8e),_0x1e7ba1=_0x8adc29['nextRun'][_0xc37899(0xfc)](_0x16a88f),_0x3fcaa2=_0x8adc29[_0xc37899(0xdb)]?a37_0x1ddbc8[_0xc37899(0x14d)](_0x8adc29[_0xc37899(0xdb)][_0xc37899(0xfc)](_0x8511f2)):'\x20'[_0xc37899(0x135)](_0x8511f2),_0x1711e4=hyperlink(_0x8adc29[_0xc37899(0xf2)],_0x8adc29[_0xc37899(0xee)]);return'📅\x20'+_0x7a5182+'\x20'+_0x2177d6+_0xc37899(0xc0)+_0x1e7ba1+'\x20\x20'+_0x3fcaa2+'\x20\x20'+_0x1711e4;});await writeOutput(_0x19143c[_0x21679c(0x149)]('\x0a'),_0x212ec1[_0x21679c(0xc8)],_0x21679c(0xc9));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a37_0x474c2c(0xf2)]=a37_0x474c2c(0x129);[a37_0x474c2c(0xc3)]=a37_0x474c2c(0x13d);[a37_0x474c2c(0xcf)](_0x4f21dc){const _0x467570=a37_0x474c2c,_0x262b05=_0x4f21dc[_0x467570(0x146)][0x0];if(!_0x262b05)return _0x467570(0x133);return undefined;}async[a37_0x474c2c(0x101)](_0x17ea6e){const _0x108c0f=a37_0x474c2c,{options:_0x12bca6,args:_0x3c80f5,tdx:_0x398d11}=_0x17ea6e,_0x1aa7cf=_0x3c80f5[0x0],_0x4cf6f6=await withSpinner(_0x108c0f(0x118),()=>_0x398d11['schedules'][_0x108c0f(0xfd)](_0x1aa7cf),{'verbose':_0x12bca6[_0x108c0f(0xd9)]}),_0x14647d=_0x4cf6f6[_0x108c0f(0x14f)],_0x380eac={'name':_0x14647d['name'],'cron':_0x14647d[_0x108c0f(0xdb)],'database':_0x14647d[_0x108c0f(0xfb)],'type':_0x14647d['type'],'timezone':_0x14647d[_0x108c0f(0x10a)],'user_name':_0x14647d[_0x108c0f(0xe0)],'created_at':_0x14647d[_0x108c0f(0x111)],'engine_version':_0x14647d[_0x108c0f(0xe2)],'executing_user_id':_0x14647d[_0x108c0f(0xea)],'query':_0x14647d[_0x108c0f(0x13f)],'delay':_0x14647d[_0x108c0f(0x148)],'priority':_0x14647d[_0x108c0f(0x124)],'retry_limit':_0x14647d[_0x108c0f(0xd3)],..._0x14647d[_0x108c0f(0xe3)]&&{'result':_0x14647d[_0x108c0f(0xe3)]}};return await handleSingleObjectOutput(_0x380eac,_0x12bca6),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a37_0x474c2c(0xf2)]='schedule:create';[a37_0x474c2c(0xc3)]=a37_0x474c2c(0xcb);['validate'](_0x4732b1){const _0x2142d8=a37_0x474c2c,_0x3b8e9d=_0x4732b1[_0x2142d8(0x146)][0x0];if(!_0x3b8e9d)return _0x2142d8(0xcd);const _0xc81c5b=_0x4732b1[_0x2142d8(0xff)];if(!_0xc81c5b[_0x2142d8(0xfb)])return _0x2142d8(0x109);return undefined;}async[a37_0x474c2c(0x101)](_0x1878c8){const _0x53892d=a37_0x474c2c,{options:_0x28a3b7,args:_0xb65f34,tdx:_0x5ca7b2}=_0x1878c8,_0x5f091b=_0xb65f34[0x0],_0x1479e4=_0x28a3b7,_0xa72444=_0x1479e4[_0x53892d(0xfb)],_0x436881=_0x1479e4[_0x53892d(0x12b)],_0x58d5e5=_0x1479e4['type']||_0x53892d(0xd4);let _0x1e6616;try{_0x1e6616=readFileSync(_0x436881,'utf-8')[_0x53892d(0x138)]();}catch(_0x20aeab){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x53892d(0xd8)+_0x436881,_0x20aeab instanceof Error?_0x20aeab:undefined);}if(!_0x1e6616)throw new SDKError(ErrorCode[_0x53892d(0x10d)],_0x53892d(0x108));const _0xd688d7={'database':_0xa72444,'query':_0x1e6616,'type':_0x58d5e5};if(_0x1479e4[_0x53892d(0xdb)])_0xd688d7[_0x53892d(0xdb)]=_0x1479e4[_0x53892d(0xdb)];if(_0x1479e4[_0x53892d(0x10a)])_0xd688d7[_0x53892d(0x10a)]=_0x1479e4[_0x53892d(0x10a)];if(_0x1479e4[_0x53892d(0x148)]!==undefined)_0xd688d7[_0x53892d(0x148)]=Number(_0x1479e4['delay']);if(_0x1479e4[_0x53892d(0x124)]!==undefined)_0xd688d7['priority']=Number(_0x1479e4['priority']);if(_0x1479e4[_0x53892d(0xd7)]!==undefined)_0xd688d7[_0x53892d(0xd3)]=Number(_0x1479e4[_0x53892d(0xd7)]);if(_0x1479e4['engineVersion'])_0xd688d7[_0x53892d(0xe2)]=_0x1479e4[_0x53892d(0xc7)];if(_0x1479e4[_0x53892d(0xe3)])_0xd688d7[_0x53892d(0xe3)]=_0x1479e4['result'];if(_0x28a3b7[_0x53892d(0xd9)]){console['error'](_0x53892d(0xf0)+_0x5f091b),console[_0x53892d(0xe4)](_0x53892d(0xbe)+_0xa72444),console[_0x53892d(0xe4)](_0x53892d(0x147)+_0x58d5e5);if(_0xd688d7[_0x53892d(0xdb)])console['error']('\x20\x20Cron:\x20'+_0xd688d7['cron']);if(_0xd688d7[_0x53892d(0x10a)])console[_0x53892d(0xe4)](_0x53892d(0x12e)+_0xd688d7[_0x53892d(0x10a)]);}const _0x5a6427=await withSpinner(_0x53892d(0x11d),()=>_0x5ca7b2[_0x53892d(0x112)][_0x53892d(0x10e)](_0x5f091b,_0xd688d7),{'verbose':_0x28a3b7[_0x53892d(0xd9)]});return console[_0x53892d(0xe4)]('Schedule\x20created:\x20'+_0x5a6427[_0x53892d(0x14f)][_0x53892d(0xf2)]),await handleSingleObjectOutput(_0x5a6427[_0x53892d(0x14f)],_0x28a3b7),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a37_0x474c2c(0xf2)]=a37_0x474c2c(0x107);[a37_0x474c2c(0xc3)]='Update\x20a\x20scheduled\x20query';[a37_0x474c2c(0xcf)](_0x329ba4){const _0x455b3c=a37_0x474c2c,_0x2e9c04=_0x329ba4['args'][0x0];if(!_0x2e9c04)return _0x455b3c(0xbc);return undefined;}async[a37_0x474c2c(0x101)](_0x35d376){const _0x3ab33a=a37_0x474c2c,{options:_0x31b1e9,args:_0x12acc5,tdx:_0x2ff186}=_0x35d376,_0x29e17a=_0x12acc5[0x0],_0x46e5fd=_0x31b1e9,_0x1e81ce={};if(_0x46e5fd['database'])_0x1e81ce[_0x3ab33a(0xfb)]=_0x46e5fd[_0x3ab33a(0xfb)];if(_0x46e5fd[_0x3ab33a(0x12a)])_0x1e81ce[_0x3ab33a(0x12a)]=_0x46e5fd['type'];if(_0x46e5fd[_0x3ab33a(0xdb)])_0x1e81ce[_0x3ab33a(0xdb)]=_0x46e5fd['cron'];if(_0x46e5fd[_0x3ab33a(0x10a)])_0x1e81ce[_0x3ab33a(0x10a)]=_0x46e5fd[_0x3ab33a(0x10a)];if(_0x46e5fd[_0x3ab33a(0x148)]!==undefined)_0x1e81ce[_0x3ab33a(0x148)]=Number(_0x46e5fd[_0x3ab33a(0x148)]);if(_0x46e5fd['priority']!==undefined)_0x1e81ce[_0x3ab33a(0x124)]=Number(_0x46e5fd[_0x3ab33a(0x124)]);if(_0x46e5fd[_0x3ab33a(0xd7)]!==undefined)_0x1e81ce[_0x3ab33a(0xd3)]=Number(_0x46e5fd[_0x3ab33a(0xd7)]);if(_0x46e5fd[_0x3ab33a(0xc7)])_0x1e81ce['engine_version']=_0x46e5fd[_0x3ab33a(0xc7)];if(_0x46e5fd[_0x3ab33a(0xe3)])_0x1e81ce[_0x3ab33a(0xe3)]=_0x46e5fd[_0x3ab33a(0xe3)];if(_0x46e5fd[_0x3ab33a(0x12b)])try{_0x1e81ce['query']=readFileSync(_0x46e5fd[_0x3ab33a(0x12b)],_0x3ab33a(0xbd))[_0x3ab33a(0x138)]();}catch(_0x5799ff){throw new SDKError(ErrorCode[_0x3ab33a(0x10d)],_0x3ab33a(0xd8)+_0x46e5fd[_0x3ab33a(0x12b)],_0x5799ff instanceof Error?_0x5799ff:undefined);}if(Object[_0x3ab33a(0xdf)](_0x1e81ce)[_0x3ab33a(0x119)]===0x0)throw new SDKError(ErrorCode[_0x3ab33a(0x10d)],_0x3ab33a(0x121));if(_0x31b1e9[_0x3ab33a(0xd9)]){console['error']('Updating\x20schedule:\x20'+_0x29e17a);for(const [_0x4938f7,_0x27ce20]of Object['entries'](_0x1e81ce)){_0x4938f7==='query'?console[_0x3ab33a(0xe4)]('\x20\x20'+_0x4938f7+':\x20'+_0x27ce20['substring'](0x0,0x32)+_0x3ab33a(0x14c)):console[_0x3ab33a(0xe4)]('\x20\x20'+_0x4938f7+':\x20'+_0x27ce20);}}const _0x3530f3=await withSpinner(_0x3ab33a(0xd6),()=>_0x2ff186[_0x3ab33a(0x112)][_0x3ab33a(0x13c)](_0x29e17a,_0x1e81ce),{'verbose':_0x31b1e9[_0x3ab33a(0xd9)]});return console[_0x3ab33a(0xe4)](_0x3ab33a(0xf3)+_0x3530f3[_0x3ab33a(0x14f)][_0x3ab33a(0xf2)]),await handleSingleObjectOutput(_0x3530f3[_0x3ab33a(0x14f)],_0x31b1e9),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a37_0x474c2c(0xf2)]='schedule:delete';[a37_0x474c2c(0xc3)]=a37_0x474c2c(0x110);[a37_0x474c2c(0xcf)](_0x559c6d){const _0x5e87d2=a37_0x474c2c,_0x16c6cd=_0x559c6d['args'][0x0];if(!_0x16c6cd)return _0x5e87d2(0x145);return undefined;}async['execute'](_0x4c001d){const _0x3aaeef=a37_0x474c2c,{options:_0x19fb77,args:_0x336222,tdx:_0x4ff8dd}=_0x4c001d,_0x1495d0=_0x336222[0x0];if(!_0x19fb77['yes']){const _0x332788=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22'+_0x1495d0+'\x22?');if(!_0x332788)return console[_0x3aaeef(0xe4)](_0x3aaeef(0x14b)),0x0;}const _0x463e1b=await withSpinner(_0x3aaeef(0xd0),()=>_0x4ff8dd['schedules'][_0x3aaeef(0x141)](_0x1495d0),{'verbose':_0x19fb77['verbose']});return console[_0x3aaeef(0xe4)](_0x3aaeef(0xed)+_0x463e1b[_0x3aaeef(0x14f)][_0x3aaeef(0xf2)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a37_0x474c2c(0xf2)]=a37_0x474c2c(0xc4);[a37_0x474c2c(0xc3)]='Run\x20a\x20scheduled\x20query\x20immediately';['validate'](_0x49fcd1){const _0x567961=a37_0x474c2c,_0x2c6484=_0x49fcd1[_0x567961(0x146)][0x0];if(!_0x2c6484)return _0x567961(0xf4);return undefined;}async[a37_0x474c2c(0x101)](_0x4cac17){const _0x223e42=a37_0x474c2c,{options:_0x151b62,args:_0x411d4e,tdx:_0x52bb9b}=_0x4cac17,_0x1a1753=_0x411d4e[0x0],_0x99f45d=_0x151b62,_0x5bfc6c=_0x99f45d['time'],_0x5b991e=_0x99f45d[_0x223e42(0x128)]!==undefined?Number(_0x99f45d[_0x223e42(0x128)]):undefined;if(_0x151b62[_0x223e42(0xd9)]){console[_0x223e42(0xe4)](_0x223e42(0x151)+_0x1a1753);if(_0x5bfc6c)console[_0x223e42(0xe4)](_0x223e42(0x142)+_0x5bfc6c);if(_0x5b991e)console[_0x223e42(0xe4)](_0x223e42(0x106)+_0x5b991e);}const _0x8ee493=await withSpinner(_0x223e42(0xd1),()=>_0x52bb9b['schedules'][_0x223e42(0x12c)](_0x1a1753,{'time':_0x5bfc6c,'num':_0x5b991e}),{'verbose':_0x151b62[_0x223e42(0xd9)]}),_0x56f2e2=_0x8ee493[_0x223e42(0x14f)][_0x223e42(0x13b)];console['error'](_0x223e42(0x11c)+_0x56f2e2[_0x223e42(0x119)]+_0x223e42(0xdc)+(_0x56f2e2[_0x223e42(0x119)]!==0x1?'s':'')+_0x223e42(0xec));for(const _0x1c2c72 of _0x56f2e2){console['error'](_0x223e42(0xe9)+_0x1c2c72['job_id']);}return await handleSDKOutput(_0x56f2e2,_0x151b62),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a37_0x474c2c(0xf2)]=a37_0x474c2c(0x116);[a37_0x474c2c(0xc3)]=a37_0x474c2c(0xeb);[a37_0x474c2c(0xcf)](_0x3f0069){const _0x5ceec9=a37_0x474c2c,_0x27742b=_0x3f0069[_0x5ceec9(0x146)][0x0];if(!_0x27742b)return _0x5ceec9(0x10b);return undefined;}async[a37_0x474c2c(0x101)](_0x18bfcd){const _0x5846a4=a37_0x474c2c,{options:_0x585c02,args:_0x2efbc4,tdx:_0x4fa06f}=_0x18bfcd,_0x1bc2ac=_0x2efbc4[0x0],_0x229495=_0x585c02,_0x5390a7=_0x229495[_0x5846a4(0x100)]!==undefined?Number(_0x229495[_0x5846a4(0x100)]):undefined,_0x4a8f27=_0x229495['to']!==undefined?Number(_0x229495['to']):undefined,_0x2c0715=await withSpinner(_0x5846a4(0x13e),()=>_0x4fa06f[_0x5846a4(0x112)][_0x5846a4(0x134)](_0x1bc2ac,{'from':_0x5390a7,'to':_0x4a8f27}),{'verbose':_0x585c02['verbose']}),_0x1f2aac=_0x2c0715[_0x5846a4(0x14f)];console[_0x5846a4(0xe4)](_0x5846a4(0xf7)+_0x1f2aac[_0x5846a4(0x11f)]+_0x5846a4(0xc1)+(_0x1f2aac[_0x5846a4(0x11f)]!==0x1?'s':'')+_0x5846a4(0xf6)+_0x1f2aac['from']+'-'+_0x1f2aac['to']+')');const _0x45abc6=_0x1f2aac[_0x5846a4(0x134)]['map'](_0x2be303=>({'job_id':_0x2be303[_0x5846a4(0x130)],'type':_0x2be303[_0x5846a4(0x12a)],'status':_0x2be303['status'],'scheduled_at':_0x2be303[_0x5846a4(0x10f)],'created_at':_0x2be303[_0x5846a4(0x111)],'start_at':_0x2be303[_0x5846a4(0x102)],'end_at':_0x2be303[_0x5846a4(0xd2)]}));return await handleSDKOutput(_0x45abc6,_0x585c02),0x0;}}
1
+ const a37_0xcb1009=a37_0x1001;(function(_0x5f138d,_0x2f71c1){const _0x503cd1=a37_0x1001,_0x4c6aac=_0x5f138d();while(!![]){try{const _0x29f010=-parseInt(_0x503cd1(0x143))/0x1+parseInt(_0x503cd1(0xb7))/0x2*(parseInt(_0x503cd1(0x11f))/0x3)+parseInt(_0x503cd1(0xdd))/0x4+parseInt(_0x503cd1(0xc4))/0x5*(parseInt(_0x503cd1(0xe1))/0x6)+-parseInt(_0x503cd1(0xd9))/0x7+-parseInt(_0x503cd1(0xbb))/0x8*(parseInt(_0x503cd1(0x10a))/0x9)+parseInt(_0x503cd1(0xf0))/0xa;if(_0x29f010===_0x2f71c1)break;else _0x4c6aac['push'](_0x4c6aac['shift']());}catch(_0x21aed0){_0x4c6aac['push'](_0x4c6aac['shift']());}}}(a37_0x541b,0x3cf0a));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a37_0x38395d from'chalk';function formatRelativeTime(_0xa26682){const _0x111276=a37_0x1001,_0x91e161=new Date(_0xa26682),_0x36ca47=new Date(),_0x17da90=_0x91e161[_0x111276(0xc3)]()-_0x36ca47[_0x111276(0xc3)](),_0x659b4=Math['abs'](_0x17da90)/0x3e8,_0x369035=_0x17da90<0x0;if(_0x659b4<0x3c)return _0x369035?'just\x20now':_0x111276(0xdc);else{if(_0x659b4<0xe10){const _0x389883=Math['round'](_0x659b4/0x3c);return _0x369035?_0x389883+_0x111276(0xc0):'in\x20'+_0x389883+'m';}else{if(_0x659b4<0x15180){const _0x21fb52=Math[_0x111276(0xfd)](_0x659b4/0xe10);return _0x369035?_0x21fb52+_0x111276(0xde):_0x111276(0x125)+_0x21fb52+'h';}else{if(_0x659b4<0x93a80){const _0x49e04c=Math['round'](_0x659b4/0x15180);return _0x369035?_0x49e04c+_0x111276(0x124):_0x111276(0x125)+_0x49e04c+'d';}else return _0x91e161['toLocaleDateString']();}}}}export class ScheduleListCommand extends BaseCommand{['name']='schedule:list';[a37_0xcb1009(0x118)]=a37_0xcb1009(0xf7);async[a37_0xcb1009(0xe9)](_0x1dea77){const _0x4ec433=a37_0xcb1009,{options:_0x56cb87,args:_0x482c39,tdx:_0x28dbc8}=_0x1dea77,_0x5cebff=resolveLimit(_0x56cb87[_0x4ec433(0xd0)],DEFAULT_DISPLAY_LIMIT),_0x574f35=_0x482c39[0x0],_0x1f8aeb=_0x574f35?'Searching\x20scheduled\x20queries\x20matching\x20\x22'+_0x574f35+_0x4ec433(0x138):_0x4ec433(0x13f),_0x29edf3=await withSpinner(_0x1f8aeb,()=>_0x28dbc8['schedules'][_0x4ec433(0xe7)]({'limit':_0x5cebff,'scheduled':!![],'pattern':_0x574f35}),{'verbose':_0x56cb87[_0x4ec433(0x13e)]}),_0x530d34=_0x29edf3[_0x4ec433(0x149)][_0x4ec433(0xf6)],_0x50aef4=_0x29edf3['data'][_0x4ec433(0x105)][_0x4ec433(0xc5)],_0x1910c4=_0x574f35?_0x4ec433(0xfc)+_0x574f35+'\x22':'';_0x50aef4?console[_0x4ec433(0xff)](_0x4ec433(0x112)+_0x530d34[_0x4ec433(0x11e)]+_0x4ec433(0x10d)+_0x1910c4+'\x20(use\x20--limit\x20to\x20see\x20more)'):console[_0x4ec433(0xff)](_0x4ec433(0x146)+_0x530d34[_0x4ec433(0x11e)]+_0x4ec433(0x139)+(_0x530d34[_0x4ec433(0x11e)]!==0x1?_0x4ec433(0x131):'y')+_0x1910c4);if(_0x56cb87[_0x4ec433(0x134)]===_0x4ec433(0xec)||_0x56cb87[_0x4ec433(0x134)]===_0x4ec433(0xc1)||_0x56cb87[_0x4ec433(0x134)]===_0x4ec433(0x13a)||_0x56cb87[_0x4ec433(0x134)]===_0x4ec433(0xe3)){const _0x2a7fd9=_0x530d34[_0x4ec433(0xed)](_0x397707=>({'id':_0x397707['id'],'name':_0x397707[_0x4ec433(0xba)],'cron':_0x397707[_0x4ec433(0xd8)],'database':_0x397707['database']?.[_0x4ec433(0xba)],'type':_0x397707[_0x4ec433(0xbf)],'timezone':_0x397707[_0x4ec433(0xe4)],'user_name':_0x397707['user']?.[_0x4ec433(0xba)],'updated_at':_0x397707['updated_at'],'next_run_at':_0x397707[_0x4ec433(0xcd)],'last_job_status':_0x397707['last_job']?.[_0x4ec433(0xe0)]}));await handleSDKOutput(_0x2a7fd9,_0x56cb87);}else{if(_0x530d34[_0x4ec433(0x11e)]===0x0)console[_0x4ec433(0x116)](_0x4ec433(0x109));else{const _0x23c039=_0x56cb87[_0x4ec433(0xd7)],_0x43da20=_0x530d34[_0x4ec433(0xed)](_0x40f22c=>{const _0x23ff6d=_0x4ec433,_0x32edf8=_0x40f22c['last_job']?.[_0x23ff6d(0xe0)]?_0x40f22c[_0x23ff6d(0xf8)][_0x23ff6d(0xe0)]===_0x23ff6d(0xf2)?'✓':'✗':'-',_0x503b0c=_0x40f22c[_0x23ff6d(0xf8)]?.[_0x23ff6d(0x128)]?formatRelativeTime(_0x40f22c[_0x23ff6d(0xf8)][_0x23ff6d(0x128)]):_0x23ff6d(0x115),_0x56b5ba=_0x40f22c[_0x23ff6d(0xcd)]?formatRelativeTime(_0x40f22c[_0x23ff6d(0xcd)]):'-',_0x15c6a5=_0x40f22c[_0x23ff6d(0xd8)]||'',_0x4700eb=_0x40f22c[_0x23ff6d(0xba)]||'(unnamed)',_0x2c4305=getConsoleUrl(_0x23c039,_0x23ff6d(0xd4)+_0x40f22c['id']);return{'statusIcon':_0x32edf8,'lastRun':_0x503b0c,'nextRun':_0x56b5ba,'cron':_0x15c6a5,'name':_0x4700eb,'queryUrl':_0x2c4305,'status':_0x40f22c[_0x23ff6d(0xf8)]?.[_0x23ff6d(0xe0)]};}),_0x3c48d1=Math['max'](..._0x43da20[_0x4ec433(0xed)](_0x1d7733=>_0x1d7733[_0x4ec433(0xfb)][_0x4ec433(0x11e)])),_0x3b0615=Math[_0x4ec433(0x100)](..._0x43da20[_0x4ec433(0xed)](_0x11deee=>_0x11deee['nextRun'][_0x4ec433(0x11e)])),_0xef3987=Math[_0x4ec433(0x100)](..._0x43da20['map'](_0x48e28a=>_0x48e28a[_0x4ec433(0xd8)][_0x4ec433(0x11e)])),_0x4a239e=_0x43da20[_0x4ec433(0xed)](_0x49e073=>{const _0x5c7d2d=_0x4ec433,_0x135eca=_0x49e073['status']===_0x5c7d2d(0xf2)?a37_0x38395d[_0x5c7d2d(0x101)](_0x49e073[_0x5c7d2d(0xf4)]):_0x49e073[_0x5c7d2d(0xe0)]===_0x5c7d2d(0xff)?a37_0x38395d[_0x5c7d2d(0x12e)](_0x49e073[_0x5c7d2d(0xf4)]):a37_0x38395d['dim'](_0x49e073[_0x5c7d2d(0xf4)]),_0x523f76=_0x49e073[_0x5c7d2d(0xfb)]['padEnd'](_0x3c48d1),_0x31e489=_0x49e073[_0x5c7d2d(0xef)][_0x5c7d2d(0x11a)](_0x3b0615),_0x309528=_0x49e073['cron']?a37_0x38395d[_0x5c7d2d(0xe2)](_0x49e073[_0x5c7d2d(0xd8)][_0x5c7d2d(0x11a)](_0xef3987)):'\x20'[_0x5c7d2d(0x114)](_0xef3987),_0x2c19ad=hyperlink(_0x49e073[_0x5c7d2d(0xba)],_0x49e073[_0x5c7d2d(0x10c)]);return _0x5c7d2d(0xc7)+_0x135eca+'\x20'+_0x523f76+_0x5c7d2d(0xdb)+_0x31e489+'\x20\x20'+_0x309528+'\x20\x20'+_0x2c19ad;});await writeOutput(_0x4a239e[_0x4ec433(0x12f)]('\x0a'),_0x56cb87[_0x4ec433(0x137)],_0x4ec433(0xcc));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a37_0xcb1009(0xba)]='schedule:show';[a37_0xcb1009(0x118)]=a37_0xcb1009(0xb8);['validate'](_0x42f0bd){const _0x1126c9=a37_0xcb1009,_0x4bc0c9=_0x42f0bd[_0x1126c9(0xce)][0x0];if(!_0x4bc0c9)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async['execute'](_0x577c65){const _0x1fe66f=a37_0xcb1009,{options:_0x31a3b4,args:_0x5ebc4c,tdx:_0x2a7c76}=_0x577c65,_0x110842=_0x5ebc4c[0x0],_0x1e9fd4=await withSpinner(_0x1fe66f(0xc2),()=>_0x2a7c76[_0x1fe66f(0xd3)][_0x1fe66f(0x123)](_0x110842),{'verbose':_0x31a3b4['verbose']}),_0x14c269=_0x1e9fd4['data'],_0xb83830={'name':_0x14c269['name'],'cron':_0x14c269[_0x1fe66f(0xd8)],'database':_0x14c269['database'],'type':_0x14c269[_0x1fe66f(0xbf)],'timezone':_0x14c269['timezone'],'user_name':_0x14c269[_0x1fe66f(0xd6)],'created_at':_0x14c269[_0x1fe66f(0x127)],'engine_version':_0x14c269[_0x1fe66f(0x12d)],'executing_user_id':_0x14c269['executing_user_id'],'query':_0x14c269[_0x1fe66f(0x102)],'delay':_0x14c269[_0x1fe66f(0x130)],'priority':_0x14c269[_0x1fe66f(0x126)],'retry_limit':_0x14c269['retry_limit'],..._0x14c269[_0x1fe66f(0xbc)]&&{'result':_0x14c269[_0x1fe66f(0xbc)]}};return await handleSingleObjectOutput(_0xb83830,_0x31a3b4),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']=a37_0xcb1009(0x122);[a37_0xcb1009(0x118)]=a37_0xcb1009(0x135);[a37_0xcb1009(0xeb)](_0x3f1b02){const _0x2510d3=a37_0xcb1009,_0x2ec588=_0x3f1b02[_0x2510d3(0xce)][0x0];if(!_0x2ec588)return _0x2510d3(0xca);const _0x28839f=_0x3f1b02[_0x2510d3(0x107)];if(!_0x28839f['database'])return'Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';return undefined;}async[a37_0xcb1009(0xe9)](_0x107402){const _0x4399b4=a37_0xcb1009,{options:_0x165b4,args:_0x1033cb,tdx:_0x38c35a}=_0x107402,_0x32b205=_0x1033cb[0x0],_0x12dc43=_0x165b4,_0x410b19=_0x12dc43['database'],_0x137885=_0x12dc43[_0x4399b4(0x11b)],_0x169c48=_0x12dc43[_0x4399b4(0xbf)]||_0x4399b4(0x13c);let _0x97660e;try{_0x97660e=readFileSync(_0x137885,_0x4399b4(0x10e))[_0x4399b4(0xbe)]();}catch(_0x4b132c){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x4399b4(0x121)+_0x137885,_0x4b132c instanceof Error?_0x4b132c:undefined);}if(!_0x97660e)throw new SDKError(ErrorCode[_0x4399b4(0xb9)],_0x4399b4(0xbd));const _0x483db5={'database':_0x410b19,'query':_0x97660e,'type':_0x169c48};if(_0x12dc43[_0x4399b4(0xd8)])_0x483db5[_0x4399b4(0xd8)]=_0x12dc43[_0x4399b4(0xd8)];if(_0x12dc43['timezone'])_0x483db5[_0x4399b4(0xcf)]=_0x12dc43['timezone'];if(_0x12dc43[_0x4399b4(0x130)]!==undefined)_0x483db5['delay']=Number(_0x12dc43['delay']);if(_0x12dc43[_0x4399b4(0x126)]!==undefined)_0x483db5[_0x4399b4(0x126)]=Number(_0x12dc43[_0x4399b4(0x126)]);if(_0x12dc43['retryLimit']!==undefined)_0x483db5[_0x4399b4(0x106)]=Number(_0x12dc43[_0x4399b4(0xd5)]);if(_0x12dc43[_0x4399b4(0x108)])_0x483db5['engine_version']=_0x12dc43[_0x4399b4(0x108)];if(_0x12dc43[_0x4399b4(0xbc)])_0x483db5['result']=_0x12dc43[_0x4399b4(0xbc)];if(_0x165b4['verbose']){console[_0x4399b4(0xff)](_0x4399b4(0xf3)+_0x32b205),console[_0x4399b4(0xff)]('\x20\x20Database:\x20'+_0x410b19),console[_0x4399b4(0xff)]('\x20\x20Type:\x20'+_0x169c48);if(_0x483db5[_0x4399b4(0xd8)])console['error'](_0x4399b4(0x145)+_0x483db5[_0x4399b4(0xd8)]);if(_0x483db5['timezone'])console['error'](_0x4399b4(0xfe)+_0x483db5[_0x4399b4(0xcf)]);}const _0x1347cb=await withSpinner(_0x4399b4(0xda),()=>_0x38c35a['schedules'][_0x4399b4(0xe8)](_0x32b205,_0x483db5),{'verbose':_0x165b4[_0x4399b4(0x13e)]});return console['error'](_0x4399b4(0x10f)+_0x1347cb[_0x4399b4(0x149)][_0x4399b4(0xba)]),await handleSingleObjectOutput(_0x1347cb[_0x4399b4(0x149)],_0x165b4),0x0;}}function a37_0x541b(){const _0x17ae09=['cyan','tsv','time_zone','history','delete','listQueries','create','execute','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','validate','json','map','\x20execution','nextRun','1338910TURGpq','Running\x20schedule:\x20','success','Creating\x20schedule:\x20','statusIcon','\x20job','queries','List\x20scheduled\x20queries','last_job','entries','Show\x20schedule\x20execution\x20history','lastRun','\x20matching\x20\x22','round','\x20\x20Timezone:\x20','error','max','green','query','Getting\x20schedule\x20history...','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','pagination','retry_limit','options','engineVersion','No\x20scheduled\x20queries\x20found','9kEmdMa','Updating\x20schedule...','queryUrl','\x20schedules','utf-8','Schedule\x20created:\x20','update','\x20\x20Time:\x20','Showing\x20first\x20','from','repeat','never','log','\x20\x20Num:\x20','description','end_at','padEnd','file','\x20created','database','length','585NWjEnR','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','Failed\x20to\x20read\x20file:\x20','schedule:create','show','d\x20ago','in\x20','priority','created_at','ended_at','Delete\x20a\x20scheduled\x20query','keys','Update\x20a\x20scheduled\x20query','Updating\x20schedule:\x20','engine_version','red','join','delay','ies','substring','num','format','Create\x20a\x20scheduled\x20query','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','output','\x22...','\x20scheduled\x20quer','table','Schedule\x20run\x20submitted:\x20','trino','...','verbose','Listing\x20scheduled\x20queries...','schedule:run','Running\x20schedule...','time','111645YbgTCC','\x20\x20Job\x20ID:\x20','\x20\x20Cron:\x20','Found\x20','job_id','scheduled_at','data','2182HRdUQv','Show\x20schedule\x20details','INVALID_ARGUMENT','name','3584200pbqWPw','result','Query\x20file\x20is\x20empty','trim','type','m\x20ago','jsonl','Getting\x20schedule\x20details...','getTime','281655BjaITq','has_next_page','\x20(showing\x20','📅\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','Cancelled','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','run','list','next_run_at','args','timezone','limit','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','Schedule\x20deleted:\x20','schedules','/app/queries/editor?queryId=','retryLimit','user_name','site','cron','1201774DHDQZm','Creating\x20schedule...','\x20\x20→\x20','soon','960036BhBpvt','h\x20ago','start_at','status','42NWdZRr'];a37_0x541b=function(){return _0x17ae09;};return a37_0x541b();}export class ScheduleUpdateCommand extends BaseCommand{['name']='schedule:update';[a37_0xcb1009(0x118)]=a37_0xcb1009(0x12b);[a37_0xcb1009(0xeb)](_0x49c010){const _0x25bfbd=a37_0xcb1009,_0xc9875f=_0x49c010[_0x25bfbd(0xce)][0x0];if(!_0xc9875f)return _0x25bfbd(0xea);return undefined;}async['execute'](_0x318089){const _0x598f50=a37_0xcb1009,{options:_0x4d6f8a,args:_0x4019ad,tdx:_0x1fd32c}=_0x318089,_0x23da8c=_0x4019ad[0x0],_0x646385=_0x4d6f8a,_0x200dc8={};if(_0x646385[_0x598f50(0x11d)])_0x200dc8[_0x598f50(0x11d)]=_0x646385['database'];if(_0x646385[_0x598f50(0xbf)])_0x200dc8[_0x598f50(0xbf)]=_0x646385[_0x598f50(0xbf)];if(_0x646385['cron'])_0x200dc8[_0x598f50(0xd8)]=_0x646385[_0x598f50(0xd8)];if(_0x646385[_0x598f50(0xcf)])_0x200dc8[_0x598f50(0xcf)]=_0x646385['timezone'];if(_0x646385['delay']!==undefined)_0x200dc8['delay']=Number(_0x646385[_0x598f50(0x130)]);if(_0x646385[_0x598f50(0x126)]!==undefined)_0x200dc8[_0x598f50(0x126)]=Number(_0x646385['priority']);if(_0x646385[_0x598f50(0xd5)]!==undefined)_0x200dc8[_0x598f50(0x106)]=Number(_0x646385[_0x598f50(0xd5)]);if(_0x646385[_0x598f50(0x108)])_0x200dc8[_0x598f50(0x12d)]=_0x646385[_0x598f50(0x108)];if(_0x646385[_0x598f50(0xbc)])_0x200dc8[_0x598f50(0xbc)]=_0x646385['result'];if(_0x646385['file'])try{_0x200dc8['query']=readFileSync(_0x646385['file'],'utf-8')[_0x598f50(0xbe)]();}catch(_0x5ea651){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x598f50(0x121)+_0x646385[_0x598f50(0x11b)],_0x5ea651 instanceof Error?_0x5ea651:undefined);}if(Object[_0x598f50(0x12a)](_0x200dc8)[_0x598f50(0x11e)]===0x0)throw new SDKError(ErrorCode[_0x598f50(0xb9)],_0x598f50(0xd1));if(_0x4d6f8a[_0x598f50(0x13e)]){console[_0x598f50(0xff)](_0x598f50(0x12c)+_0x23da8c);for(const [_0x209de3,_0x50b9f5]of Object[_0x598f50(0xf9)](_0x200dc8)){_0x209de3===_0x598f50(0x102)?console[_0x598f50(0xff)]('\x20\x20'+_0x209de3+':\x20'+_0x50b9f5[_0x598f50(0x132)](0x0,0x32)+_0x598f50(0x13d)):console[_0x598f50(0xff)]('\x20\x20'+_0x209de3+':\x20'+_0x50b9f5);}}const _0x8ba52c=await withSpinner(_0x598f50(0x10b),()=>_0x1fd32c['schedules'][_0x598f50(0x110)](_0x23da8c,_0x200dc8),{'verbose':_0x4d6f8a['verbose']});return console[_0x598f50(0xff)]('Schedule\x20updated:\x20'+_0x8ba52c[_0x598f50(0x149)][_0x598f50(0xba)]),await handleSingleObjectOutput(_0x8ba52c[_0x598f50(0x149)],_0x4d6f8a),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{['name']='schedule:delete';['description']=a37_0xcb1009(0x129);[a37_0xcb1009(0xeb)](_0x232b66){const _0x197fc2=a37_0xcb1009,_0x240676=_0x232b66['args'][0x0];if(!_0x240676)return _0x197fc2(0xc8);return undefined;}async[a37_0xcb1009(0xe9)](_0x51718f){const _0x2b9af3=a37_0xcb1009,{options:_0x9a06bf,args:_0x130404,tdx:_0x3867bc}=_0x51718f,_0x15bcf5=_0x130404[0x0];if(!_0x9a06bf['yes']){const _0x24ecb6=await confirm(_0x2b9af3(0x104)+_0x15bcf5+'\x22?');if(!_0x24ecb6)return console[_0x2b9af3(0xff)](_0x2b9af3(0xc9)),0x0;}const _0x23d194=await withSpinner('Deleting\x20schedule...',()=>_0x3867bc[_0x2b9af3(0xd3)][_0x2b9af3(0xe6)](_0x15bcf5),{'verbose':_0x9a06bf[_0x2b9af3(0x13e)]});return console[_0x2b9af3(0xff)](_0x2b9af3(0xd2)+_0x23d194['data'][_0x2b9af3(0xba)]),0x0;}}function a37_0x1001(_0x5286a3,_0x3f7e93){_0x5286a3=_0x5286a3-0xb7;const _0x541ba7=a37_0x541b();let _0x10010b=_0x541ba7[_0x5286a3];return _0x10010b;}export class ScheduleRunCommand extends BaseCommand{[a37_0xcb1009(0xba)]=a37_0xcb1009(0x140);['description']='Run\x20a\x20scheduled\x20query\x20immediately';[a37_0xcb1009(0xeb)](_0x1feb77){const _0x4e8d68=a37_0xcb1009,_0x255b05=_0x1feb77['args'][0x0];if(!_0x255b05)return _0x4e8d68(0x136);return undefined;}async[a37_0xcb1009(0xe9)](_0x4f454d){const _0x4a5974=a37_0xcb1009,{options:_0xb7ad88,args:_0x25089e,tdx:_0x132215}=_0x4f454d,_0x2b6fb7=_0x25089e[0x0],_0x49a134=_0xb7ad88,_0x5c030e=_0x49a134[_0x4a5974(0x142)],_0x3d146c=_0x49a134[_0x4a5974(0x133)]!==undefined?Number(_0x49a134['num']):undefined;if(_0xb7ad88[_0x4a5974(0x13e)]){console[_0x4a5974(0xff)](_0x4a5974(0xf1)+_0x2b6fb7);if(_0x5c030e)console[_0x4a5974(0xff)](_0x4a5974(0x111)+_0x5c030e);if(_0x3d146c)console['error'](_0x4a5974(0x117)+_0x3d146c);}const _0x2ed1ef=await withSpinner(_0x4a5974(0x141),()=>_0x132215[_0x4a5974(0xd3)][_0x4a5974(0xcb)](_0x2b6fb7,{'time':_0x5c030e,'num':_0x3d146c}),{'verbose':_0xb7ad88[_0x4a5974(0x13e)]}),_0x3d3b0c=_0x2ed1ef[_0x4a5974(0x149)]['jobs'];console[_0x4a5974(0xff)](_0x4a5974(0x13b)+_0x3d3b0c[_0x4a5974(0x11e)]+_0x4a5974(0xf5)+(_0x3d3b0c[_0x4a5974(0x11e)]!==0x1?'s':'')+_0x4a5974(0x11c));for(const _0x40ea18 of _0x3d3b0c){console[_0x4a5974(0xff)](_0x4a5974(0x144)+_0x40ea18[_0x4a5974(0x147)]);}return await handleSDKOutput(_0x3d3b0c,_0xb7ad88),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a37_0xcb1009(0xba)]='schedule:history';[a37_0xcb1009(0x118)]=a37_0xcb1009(0xfa);['validate'](_0x1f2599){const _0x2e1517=a37_0xcb1009,_0x467f07=_0x1f2599[_0x2e1517(0xce)][0x0];if(!_0x467f07)return _0x2e1517(0x120);return undefined;}async[a37_0xcb1009(0xe9)](_0x1e7825){const _0x2e843d=a37_0xcb1009,{options:_0x35d081,args:_0x3be624,tdx:_0x2a27ce}=_0x1e7825,_0x355052=_0x3be624[0x0],_0x1064af=_0x35d081,_0x213485=_0x1064af[_0x2e843d(0x113)]!==undefined?Number(_0x1064af[_0x2e843d(0x113)]):undefined,_0x471d15=_0x1064af['to']!==undefined?Number(_0x1064af['to']):undefined,_0x3ad48e=await withSpinner(_0x2e843d(0x103),()=>_0x2a27ce['schedules'][_0x2e843d(0xe5)](_0x355052,{'from':_0x213485,'to':_0x471d15}),{'verbose':_0x35d081[_0x2e843d(0x13e)]}),_0x228148=_0x3ad48e[_0x2e843d(0x149)];console['error']('Found\x20'+_0x228148['count']+_0x2e843d(0xee)+(_0x228148['count']!==0x1?'s':'')+_0x2e843d(0xc6)+_0x228148[_0x2e843d(0x113)]+'-'+_0x228148['to']+')');const _0x1ba725=_0x228148[_0x2e843d(0xe5)][_0x2e843d(0xed)](_0xaad94=>({'job_id':_0xaad94[_0x2e843d(0x147)],'type':_0xaad94[_0x2e843d(0xbf)],'status':_0xaad94[_0x2e843d(0xe0)],'scheduled_at':_0xaad94[_0x2e843d(0x148)],'created_at':_0xaad94['created_at'],'start_at':_0xaad94[_0x2e843d(0xdf)],'end_at':_0xaad94[_0x2e843d(0x119)]}));return await handleSDKOutput(_0x1ba725,_0x35d081),0x0;}}
@@ -1 +1 @@
1
- const a38_0x53b30b=a38_0x4d9d;(function(_0xd7878b,_0x313c30){const _0x2a506d=a38_0x4d9d,_0x4a0bf4=_0xd7878b();while(!![]){try{const _0x51a26f=-parseInt(_0x2a506d(0x12e))/0x1*(parseInt(_0x2a506d(0xc5))/0x2)+-parseInt(_0x2a506d(0x117))/0x3*(parseInt(_0x2a506d(0xd0))/0x4)+parseInt(_0x2a506d(0xc9))/0x5*(-parseInt(_0x2a506d(0xb5))/0x6)+parseInt(_0x2a506d(0xf5))/0x7*(parseInt(_0x2a506d(0x110))/0x8)+parseInt(_0x2a506d(0xbe))/0x9+parseInt(_0x2a506d(0x13f))/0xa+parseInt(_0x2a506d(0x10a))/0xb;if(_0x51a26f===_0x313c30)break;else _0x4a0bf4['push'](_0x4a0bf4['shift']());}catch(_0x56116b){_0x4a0bf4['push'](_0x4a0bf4['shift']());}}}(a38_0x5348,0xbb21a));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';function a38_0x5348(){const _0x3d5238=['getSegment','Resolved\x20parent\x20folder\x20ID:\x20','\x20Opening\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','message','folderPath','json','red','Resolved\x20parent\x20ID:\x20','segment:show','✖\x20Query\x20failed\x20[','jsonl','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','✔\x20Created\x20folder\x20\x27','resolvePathToResource','toLocaleString','SEGMENT_FOLDER_NOT_FOUND','segment:folder:show','21tGWtde','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Use:\x20tdx\x20ps\x20view','Fetching\x20SQL\x20for\x20segment...','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','(root)','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Resolved:\x20','execute','\x20folder','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','INVALID_ARGUMENT','resolveParentId','SELECT\x20*\x20FROM\x20(\x0a','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20Segment\x20name:\x20','parentFolder','setJobId','Options:','✔\x20Found\x20','1383151sXeMkF','getFolder','segment','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','Usage:\x20tdx\x20sg\x20show\x20<name>','Fetching\x20folder\x20details...','2553992OooSwQ','trim','segmentId','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','\x20\x20Cause:\x20','Resolving\x20\x27','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','3771CgQSme','query','getSQLFromServerSegment','green','Show\x20folder\x20or\x20child\x20segment\x20details','getParent','Examples:','/e/','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','name','Target\x20path:\x20','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Usage:','/app/ps/','resolveFolderId','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','information_schema','folder','segment:describe','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Fetching\x20SQL\x20from\x20rule...','replace','1GhMzYR','Use:\x20tdx\x20ps\x20view\x20-w','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','jobId','Error:\x20Folder\x20reference\x20is\x20required','Error:\x20','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','stats','web','test','Use:\x20tdx\x20ps\x20desc','Resolved\x20folder\x20ID:\x20','Use:\x20tdx\x20ps\x20show','elapsedTimeMillis','site','segmentName','parent','4529920msmsQU','verbose','folderId','format','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x27\x20with\x20ID:\x20','path','\x20\x20Parent\x20segment:\x20','segment:folder:list','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Segment\x20ID:\x20','Resolving\x20parent\x20segment\x20\x27','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Site:\x20','processedRows','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','Folder\x20ID\x20missing\x20from\x20resolved\x20path','cause','Resolving\x20folder\x20\x27','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','\x27...','\x20[Job\x20ID:\x20','getSQLFromYamlFile','segment:desc','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','code','segment:sql','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Fetching\x20segment\x20details...','107904nXYibw','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','type','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Show\x20segment\x20folder\x20details','Parent\x20segment:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','7371036HAbqbk','parentId','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','parentSegment','Show\x20segment\x20or\x20folder\x20details','Folder\x20ID:\x20','in\x20','1828366rbAehA','Fetching\x20parent\x20segment\x20details...','getSegmentSQL','Segment\x20ID\x20missing\x20from\x20resolved\x20path','30mbbohd','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','listFolders','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','segmentPath','length','1804YQqQle','description','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','data','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','error','segment:folder:create','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','✔\x20Query\x20completed:\x20Processed\x20','Error:\x20Path\x20or\x20name\x20is\x20required','\x20\x20Full\x20path:\x20','Executing\x20segment\x20query...','Folder\x20name:\x20','log','fullPath','getSegmentSQLFromYaml','SEGMENT_NOT_FOUND','Parent\x20ID:\x20','Resolved\x20type:\x20'];a38_0x5348=function(){return _0x3d5238;};return a38_0x5348();}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 a38_0x4ae481 from'chalk';async function resolveSegmentTarget(_0x2a482e,_0x5e9f49,_0x444549){const _0x18fe01=a38_0x4d9d;if(isYamlFilePath(_0x2a482e))try{const _0x1fcffe=await resolveYamlFilePath(_0x2a482e);return _0x444549&&(console[_0x18fe01(0xd5)]('Resolved\x20YAML\x20file:\x20'+_0x2a482e),console[_0x18fe01(0xd5)](_0x18fe01(0x147)+_0x1fcffe[_0x18fe01(0xc1)]),console[_0x18fe01(0xd5)](_0x18fe01(0x105)+_0x1fcffe['segmentName']),console[_0x18fe01(0xd5)]('\x20\x20Folder\x20path:\x20'+(_0x1fcffe[_0x18fe01(0xe8)]||_0x18fe01(0xfb))),console[_0x18fe01(0xd5)](_0x18fe01(0xda)+_0x1fcffe[_0x18fe01(0xde)])),_0x1fcffe[_0x18fe01(0xde)];}catch(_0x36456b){throw new SDKError(ErrorCode[_0x18fe01(0x101)],_0x18fe01(0xfa)+_0x36456b[_0x18fe01(0xe7)]);}if(!_0x5e9f49)throw new SDKError(ErrorCode[_0x18fe01(0x101)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x5e9f49+'/'+_0x2a482e;}export class SegmentDescribeCommand extends BaseCommand{['name']=a38_0x53b30b(0x129);[a38_0x53b30b(0xd1)]=a38_0x53b30b(0xc2);async[a38_0x53b30b(0xfe)](_0x142161){const _0x39dbf2=a38_0x53b30b,{options:_0x3928c2,args:_0x4fb2e6,tdx:_0xf7e8b3}=_0x142161,_0x15874a=_0x4fb2e6[0x0],_0x85b3d6=!_0x15874a&&!!_0x3928c2[_0x39dbf2(0xc1)],_0x4b988a=_0x15874a||_0x3928c2[_0x39dbf2(0xc1)];if(!_0x4b988a)return console[_0x39dbf2(0xd5)](_0x39dbf2(0xd9)),console[_0x39dbf2(0xd5)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x39dbf2(0xd5)](_0x39dbf2(0x11d)),console[_0x39dbf2(0xd5)](_0x39dbf2(0x100)),console[_0x39dbf2(0xd5)](_0x39dbf2(0xbb)),console[_0x39dbf2(0xd5)](_0x39dbf2(0x12a)),console['error'](_0x39dbf2(0xb0)),0x1;try{const _0x101df=_0x3928c2[_0x39dbf2(0xce)];let _0x5b20cf=_0x4b988a;!_0x85b3d6&&_0x101df&&!_0x4b988a['includes']('/')&&(_0x5b20cf=_0x101df+'/'+_0x4b988a,_0x3928c2[_0x39dbf2(0x140)]&&console[_0x39dbf2(0xd5)]('Resolved\x20relative\x20path\x20to:\x20'+_0x5b20cf));const _0x5a72c1=await withSpinner('Resolving\x20path\x20\x27'+_0x5b20cf+'\x27...',()=>_0xf7e8b3[_0x39dbf2(0x10c)][_0x39dbf2(0xf1)](_0x5b20cf),{'verbose':_0x3928c2[_0x39dbf2(0x140)]}),_0x3a1aed=_0x5a72c1[_0x39dbf2(0xd3)];_0x3928c2['verbose']&&(console['error'](_0x39dbf2(0xe2)+_0x3a1aed[_0x39dbf2(0xb7)]),console[_0x39dbf2(0xd5)]('Parent\x20ID:\x20'+_0x3a1aed[_0x39dbf2(0xbf)]),_0x3a1aed[_0x39dbf2(0x141)]&&console[_0x39dbf2(0xd5)](_0x39dbf2(0xc3)+_0x3a1aed[_0x39dbf2(0x141)]),_0x3a1aed[_0x39dbf2(0x112)]&&console['error'](_0x39dbf2(0x14a)+_0x3a1aed[_0x39dbf2(0x112)]));if(_0x3a1aed[_0x39dbf2(0xb7)]===_0x39dbf2(0x13e)){const _0x146ae5=await withSpinner(_0x39dbf2(0xc6),()=>_0xf7e8b3['segment'][_0x39dbf2(0x11c)](_0x3a1aed[_0x39dbf2(0xbf)]),{'verbose':_0x3928c2[_0x39dbf2(0x140)]});await handleSingleObjectOutput(_0x146ae5[_0x39dbf2(0xd3)],_0x3928c2);}else{if(_0x3a1aed['type']===_0x39dbf2(0x128)){if(!_0x3a1aed[_0x39dbf2(0x141)])throw new SDKError(ErrorCode[_0x39dbf2(0xf3)],_0x39dbf2(0x150));const _0x26d119=await withSpinner(_0x39dbf2(0x10f),()=>_0xf7e8b3[_0x39dbf2(0x10c)][_0x39dbf2(0x10b)](_0x3a1aed[_0x39dbf2(0x141)]),{'verbose':_0x3928c2['verbose']});await handleSingleObjectOutput(_0x26d119['data'],_0x3928c2);}else{if(_0x3a1aed[_0x39dbf2(0xb7)]===_0x39dbf2(0x10c)){if(!_0x3a1aed[_0x39dbf2(0x112)])throw new SDKError(ErrorCode[_0x39dbf2(0xe0)],_0x39dbf2(0xc8));const _0x4d636c=await withSpinner(_0x39dbf2(0xb4),()=>_0xf7e8b3[_0x39dbf2(0x10c)]['getSegment'](_0x3a1aed[_0x39dbf2(0xbf)],_0x3a1aed[_0x39dbf2(0x112)]),{'verbose':_0x3928c2[_0x39dbf2(0x140)]});await handleSingleObjectOutput(_0x4d636c['data'],_0x3928c2);}}}return 0x0;}catch(_0x5c72b1){if(_0x5c72b1 instanceof SDKError)return console[_0x39dbf2(0xd5)]('Error:\x20'+_0x5c72b1['message']),_0x5c72b1[_0x39dbf2(0x151)]&&console[_0x39dbf2(0xd5)](_0x39dbf2(0x114)+_0x5c72b1[_0x39dbf2(0x151)]),0x1;throw _0x5c72b1;}}}export class SegmentShowCommand extends BaseCommand{['name']=a38_0x53b30b(0xec);[a38_0x53b30b(0xd1)]=a38_0x53b30b(0xd4);async[a38_0x53b30b(0xfe)](_0x20f8ad){const _0x10f8d2=a38_0x53b30b,{options:_0x373a4,args:_0x5b9c6f,tdx:_0x29331c}=_0x20f8ad,_0x102608=_0x5b9c6f[0x0];if(!_0x102608)return console[_0x10f8d2(0xd5)](_0x10f8d2(0x11f)),console['error'](_0x10f8d2(0x10e)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x10f8d2(0xd5)](_0x10f8d2(0x11d)),console[_0x10f8d2(0xd5)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console['error'](_0x10f8d2(0xb6)),0x1;try{const _0x35080e=_0x373a4[_0x10f8d2(0xc1)],_0x515a98=await resolveSegmentTarget(_0x102608,_0x35080e,_0x373a4[_0x10f8d2(0x140)]);_0x373a4['verbose']&&console[_0x10f8d2(0xd5)]('Target\x20path:\x20'+_0x515a98);const _0x5d04ae=await withSpinner('Resolving\x20\x27'+_0x102608+'\x27...',()=>_0x29331c[_0x10f8d2(0x10c)][_0x10f8d2(0xf1)](_0x515a98),{'verbose':_0x373a4['verbose']}),_0x3c9eec=_0x5d04ae['data'];_0x373a4[_0x10f8d2(0x140)]&&(console['error'](_0x10f8d2(0xe2)+_0x3c9eec['type']),console[_0x10f8d2(0xd5)](_0x10f8d2(0xe1)+_0x3c9eec[_0x10f8d2(0xbf)]));if(_0x3c9eec[_0x10f8d2(0xb7)]===_0x10f8d2(0x128))return console['error'](_0x10f8d2(0xef)),console['error']('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x3c9eec[_0x10f8d2(0xb7)]===_0x10f8d2(0x13e))return console['error'](_0x10f8d2(0x12b)),console['error'](_0x10f8d2(0x13a)),0x1;if(!_0x3c9eec['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x10f8d2(0xc8));const _0x52d2d0=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x29331c[_0x10f8d2(0x10c)][_0x10f8d2(0xc7)](_0x3c9eec[_0x10f8d2(0xbf)],_0x3c9eec[_0x10f8d2(0x112)]),{'verbose':_0x373a4[_0x10f8d2(0x140)]});let _0x123fbd=_0x52d2d0[_0x10f8d2(0xd3)];const _0x28cfd5=resolveLimit(_0x373a4['limit'],DEFAULT_DISPLAY_LIMIT),_0x32f153=/\bLIMIT\s+\d+/i[_0x10f8d2(0x137)](_0x123fbd);!_0x32f153&&(_0x123fbd=_0x123fbd[_0x10f8d2(0x111)]()[_0x10f8d2(0x12d)](/;+$/,''),_0x123fbd=_0x10f8d2(0x103)+_0x123fbd+_0x10f8d2(0xe6)+_0x28cfd5);_0x373a4[_0x10f8d2(0x140)]&&console['error']('SQL\x20query:\x0a'+_0x123fbd);const _0x3f3c60=await withProgressSpinner(_0x10f8d2(0xdb),async _0x758546=>{const _0x55a9ec=_0x10f8d2,_0xaf9bea=await _0x29331c[_0x55a9ec(0x118)][_0x55a9ec(0xfe)](_0x123fbd,{'catalog':'td','schema':_0x55a9ec(0x127),'onJobId':_0x447b00=>{const _0x56f380=_0x55a9ec;_0x758546[_0x56f380(0x107)](_0x447b00);}});return _0xaf9bea;},{'verbose':_0x373a4[_0x10f8d2(0x140)]}),_0x276d46=_0x3f3c60[_0x10f8d2(0xd3)],_0x421ccc=_0x276d46[_0x10f8d2(0x131)]?_0x10f8d2(0xad)+_0x276d46[_0x10f8d2(0x131)]+']':'';return console[_0x10f8d2(0xd5)](_0x10f8d2(0xd8)+_0x276d46[_0x10f8d2(0x135)][_0x10f8d2(0x14e)][_0x10f8d2(0xf2)]()+'\x20rows\x20'+(_0x10f8d2(0xc4)+formatElapsed(_0x276d46['stats'][_0x10f8d2(0x13b)])+_0x421ccc)),await handleQueryOutput(_0x276d46,_0x373a4),0x0;}catch(_0x5439bd){if(_0x5439bd instanceof SDKError)return console[_0x10f8d2(0xd5)](_0x10f8d2(0xed)+_0x5439bd[_0x10f8d2(0xb1)]+']'),console[_0x10f8d2(0xd5)]('\x0a'+_0x5439bd[_0x10f8d2(0xe7)]),0x1;throw _0x5439bd;}}}export class SegmentFolderListCommand extends BaseCommand{[a38_0x53b30b(0x120)]=a38_0x53b30b(0x148);[a38_0x53b30b(0xd1)]=a38_0x53b30b(0xb8);async[a38_0x53b30b(0xfe)](_0x4347c8){const _0x57c3b2=a38_0x53b30b,{options:_0x4a357b,args:_0x2c45a4,tdx:_0x41862b}=_0x4347c8;if(_0x2c45a4[_0x57c3b2(0xcf)]===0x0)return console[_0x57c3b2(0xd5)](_0x57c3b2(0x144)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x3407b2=_0x2c45a4[0x0];try{_0x4a357b[_0x57c3b2(0x140)]&&(console[_0x57c3b2(0xd5)]('Site:\x20'+_0x4a357b[_0x57c3b2(0x13c)]),console[_0x57c3b2(0xd5)]('Parent\x20name:\x20'+_0x3407b2));const _0x5040f3=await withSpinner(_0x57c3b2(0x14b)+_0x3407b2+_0x57c3b2(0xac),()=>_0x41862b['segment'][_0x57c3b2(0x102)](_0x3407b2),{'verbose':_0x4a357b[_0x57c3b2(0x140)]}),_0x3a1bcb=_0x5040f3[_0x57c3b2(0xd3)];_0x4a357b[_0x57c3b2(0x140)]&&console[_0x57c3b2(0xd5)](_0x57c3b2(0xeb)+_0x3a1bcb);const _0x5016c0=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x3407b2+_0x57c3b2(0xac),()=>_0x41862b[_0x57c3b2(0x10c)][_0x57c3b2(0xcb)](_0x3a1bcb),{'verbose':_0x4a357b[_0x57c3b2(0x140)]}),_0x1fdece=_0x5016c0[_0x57c3b2(0xd3)];return console[_0x57c3b2(0xd5)](_0x57c3b2(0x109)+_0x1fdece[_0x57c3b2(0xcf)]+_0x57c3b2(0xff)+(_0x1fdece[_0x57c3b2(0xcf)]!==0x1?'s':'')),await handleSDKOutput(_0x1fdece,_0x4a357b),0x0;}catch(_0x52d3b3){if(_0x52d3b3 instanceof SDKError)return console[_0x57c3b2(0xd5)](_0x57c3b2(0x133)+_0x52d3b3[_0x57c3b2(0xe7)]),_0x52d3b3[_0x57c3b2(0x151)]&&console[_0x57c3b2(0xd5)](_0x57c3b2(0x114)+_0x52d3b3[_0x57c3b2(0x151)]),0x1;throw _0x52d3b3;}}}export class SegmentFolderShowCommand extends BaseCommand{[a38_0x53b30b(0x120)]=a38_0x53b30b(0xf4);[a38_0x53b30b(0xd1)]=a38_0x53b30b(0xb9);async['execute'](_0x1bffa6){const _0x57b342=a38_0x53b30b,{options:_0x229c59,args:_0x2c6511,tdx:_0x5ad301}=_0x1bffa6;if(_0x2c6511[_0x57b342(0xcf)]===0x0)return console[_0x57b342(0xd5)](_0x57b342(0x132)),console[_0x57b342(0xd5)](_0x57b342(0xfc)),0x1;try{const {parentId:_0x5d2c5f,childId:_0x465e2e}=parseSegmentRef(_0x2c6511[0x0]);_0x229c59['verbose']&&(console['error'](_0x57b342(0x14d)+_0x229c59['site']),console['error']('Parent\x20name:\x20'+_0x5d2c5f),_0x465e2e&&console[_0x57b342(0xd5)](_0x57b342(0xdc)+_0x465e2e));if(!_0x465e2e)return console[_0x57b342(0xd5)](_0x57b342(0x149)),0x1;const _0x10cccc=await withSpinner(_0x57b342(0x14b)+_0x5d2c5f+_0x57b342(0xac),()=>_0x5ad301[_0x57b342(0x10c)]['resolveParentId'](_0x5d2c5f),{'verbose':_0x229c59[_0x57b342(0x140)]}),_0x12f3eb=_0x10cccc['data'];_0x229c59[_0x57b342(0x140)]&&console['error'](_0x57b342(0xeb)+_0x12f3eb);const _0x5cc8b8=await withSpinner(_0x57b342(0x152)+_0x465e2e+'\x27...',()=>_0x5ad301[_0x57b342(0x10c)][_0x57b342(0x125)](_0x12f3eb,_0x465e2e),{'verbose':_0x229c59[_0x57b342(0x140)]}),_0x418161=_0x5cc8b8[_0x57b342(0xd3)];_0x229c59[_0x57b342(0x140)]&&console[_0x57b342(0xd5)](_0x57b342(0x139)+_0x418161);const _0x3ab868=await withSpinner('Fetching\x20folder\x20\x27'+_0x465e2e+'\x27...',()=>_0x5ad301['segment'][_0x57b342(0x10b)](_0x418161),{'verbose':_0x229c59[_0x57b342(0x140)]});return await handleSDKOutput([_0x3ab868[_0x57b342(0xd3)]],_0x229c59),0x0;}catch(_0x9a630b){if(_0x9a630b instanceof SDKError)return console[_0x57b342(0xd5)](_0x57b342(0x133)+_0x9a630b['message']),_0x9a630b[_0x57b342(0x151)]&&console[_0x57b342(0xd5)]('\x20\x20Cause:\x20'+_0x9a630b[_0x57b342(0x151)]),0x1;throw _0x9a630b;}}}export class SegmentSQLCommand extends BaseCommand{[a38_0x53b30b(0x120)]=a38_0x53b30b(0xb2);['description']='Get\x20SQL\x20query\x20for\x20child\x20segment';async['execute'](_0x424df4){const _0x3f0a15=a38_0x53b30b,{options:_0x4fa83c,args:_0x3c88ef}=_0x424df4,_0x42c8d6=_0x4fa83c,_0x282139=_0x42c8d6[_0x3f0a15(0x146)],_0x82552a=_0x3c88ef[0x0];if(!_0x82552a&&!_0x282139)return console['error'](a38_0x4ae481[_0x3f0a15(0xea)]('Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required')),console[_0x3f0a15(0xd5)](_0x3f0a15(0x123)),console[_0x3f0a15(0xd5)](_0x3f0a15(0x10d)),console[_0x3f0a15(0xd5)](_0x3f0a15(0xf6)),console['error'](_0x3f0a15(0x11d)),console[_0x3f0a15(0xd5)](_0x3f0a15(0x130)),console[_0x3f0a15(0xd5)](_0x3f0a15(0xd2)),0x1;if(_0x82552a&&_0x282139)return console['error'](a38_0x4ae481[_0x3f0a15(0xea)](_0x3f0a15(0x14f))),0x1;try{let _0x3fcc8a;if(_0x282139)_0x3fcc8a=await this[_0x3f0a15(0xae)](_0x282139,_0x424df4);else{if(isYamlFilePath(_0x82552a))return console['error'](a38_0x4ae481['red'](_0x3f0a15(0xbd))),console[_0x3f0a15(0xd5)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20'+_0x82552a),0x1;else _0x3fcc8a=await this[_0x3f0a15(0x119)](_0x82552a,_0x424df4);}return _0x4fa83c[_0x3f0a15(0x142)]===_0x3f0a15(0xe9)||_0x4fa83c[_0x3f0a15(0x142)]===_0x3f0a15(0xee)?await handleSDKOutput([{'sql':_0x3fcc8a}],_0x4fa83c):console[_0x3f0a15(0xdd)](_0x3fcc8a),0x0;}catch(_0x45c6a3){if(_0x45c6a3 instanceof SDKError)return console['error']('Error:\x20'+_0x45c6a3[_0x3f0a15(0xe7)]),_0x45c6a3[_0x3f0a15(0x151)]&&console[_0x3f0a15(0xd5)](_0x3f0a15(0x114)+_0x45c6a3[_0x3f0a15(0x151)]),0x1;throw _0x45c6a3;}}async[a38_0x53b30b(0xae)](_0x5b22ad,_0x8ca7a1){const _0x18df5f=a38_0x53b30b,{options:_0x746e0b,tdx:_0xd471f5}=_0x8ca7a1;let _0x580199;try{_0x580199=await resolveYamlFilePath(_0x5b22ad);}catch(_0x40594d){throw new SDKError(ErrorCode[_0x18df5f(0x101)],_0x18df5f(0xfa)+_0x40594d['message']);}_0x746e0b[_0x18df5f(0x140)]&&console[_0x18df5f(0xd5)](_0x18df5f(0xfd)+_0x580199[_0x18df5f(0xc1)]+'/'+_0x580199['segmentName']);const _0x3eab8c=await withSpinner(_0x18df5f(0x12c),()=>_0xd471f5[_0x18df5f(0x10c)][_0x18df5f(0xdf)](_0x580199['content'],_0x580199['parentSegment'],_0x580199[_0x18df5f(0x13d)]),{'verbose':_0x746e0b[_0x18df5f(0x140)]});return _0x3eab8c[_0x18df5f(0xd3)];}async[a38_0x53b30b(0x119)](_0x464dcc,_0x38fc53){const _0x2e2e36=a38_0x53b30b,{options:_0x29ee14,tdx:_0x25313f}=_0x38fc53,_0x55d162=_0x29ee14[_0x2e2e36(0xc1)],_0x57a129=await resolveSegmentTarget(_0x464dcc,_0x55d162,_0x29ee14['verbose']);_0x29ee14['verbose']&&console[_0x2e2e36(0xd5)](_0x2e2e36(0x121)+_0x57a129);const _0x13a735=await withSpinner(_0x2e2e36(0x115)+_0x464dcc+'\x27...',()=>_0x25313f[_0x2e2e36(0x10c)][_0x2e2e36(0xf1)](_0x57a129),{'verbose':_0x29ee14[_0x2e2e36(0x140)]}),_0x3186e7=_0x13a735[_0x2e2e36(0xd3)];_0x29ee14[_0x2e2e36(0x140)]&&(console[_0x2e2e36(0xd5)](_0x2e2e36(0xe2)+_0x3186e7[_0x2e2e36(0xb7)]),console[_0x2e2e36(0xd5)](_0x2e2e36(0xe1)+_0x3186e7['parentId']));if(_0x3186e7[_0x2e2e36(0xb7)]==='folder')throw new SDKError(ErrorCode[_0x2e2e36(0x101)],'Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.');if(_0x3186e7['type']===_0x2e2e36(0x13e))throw new SDKError(ErrorCode[_0x2e2e36(0x101)],'Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql');if(!_0x3186e7['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x2e2e36(0xc8));const _0x54388a=await withSpinner(_0x2e2e36(0xf9),()=>_0x25313f[_0x2e2e36(0x10c)][_0x2e2e36(0xc7)](_0x3186e7[_0x2e2e36(0xbf)],_0x3186e7[_0x2e2e36(0x112)]),{'verbose':_0x29ee14['verbose']});return _0x54388a[_0x2e2e36(0xd3)];}}function a38_0x4d9d(_0x1ee1a7,_0x307d69){_0x1ee1a7=_0x1ee1a7-0xab;const _0x5348b3=a38_0x5348();let _0x4d9dc0=_0x5348b3[_0x1ee1a7];return _0x4d9dc0;}export class SegmentFolderCreateCommand extends BaseCommand{[a38_0x53b30b(0x120)]=a38_0x53b30b(0xd6);['description']='Create\x20segment\x20folder\x20for\x20organization';async[a38_0x53b30b(0xfe)](_0x2dd542){const _0x481db4=a38_0x53b30b,{options:_0x456e25,args:_0x3b1ea1,tdx:_0x1c802b}=_0x2dd542,_0x2c58d9=_0x456e25;if(_0x3b1ea1['length']<0x2)return console[_0x481db4(0xd5)](_0x481db4(0x122)),console['error'](_0x481db4(0x134)),0x1;const _0x344ed1=_0x3b1ea1[0x0],_0x45e909=_0x3b1ea1[0x1];_0x2c58d9[_0x481db4(0x140)]&&(console['error'](_0x481db4(0x14d)+_0x2c58d9[_0x481db4(0x13c)]),console[_0x481db4(0xd5)](_0x481db4(0xba)+_0x344ed1),console[_0x481db4(0xd5)](_0x481db4(0xdc)+_0x45e909));let _0xa56138;if(_0x2c58d9[_0x481db4(0x106)]){const _0x1c0128=_0x2c58d9['parentFolder'],_0x24e89d=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x344ed1+_0x481db4(0xac),()=>_0x1c802b[_0x481db4(0x10c)][_0x481db4(0x102)](_0x344ed1),{'verbose':_0x2c58d9[_0x481db4(0x140)]}),_0xafe282=_0x24e89d[_0x481db4(0xd3)],_0x537f65=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x1c0128+'\x27...',()=>_0x1c802b[_0x481db4(0x10c)][_0x481db4(0x125)](_0xafe282,_0x1c0128),{'verbose':_0x2c58d9[_0x481db4(0x140)]});_0xa56138=_0x537f65['data'],_0x2c58d9[_0x481db4(0x140)]&&console[_0x481db4(0xd5)](_0x481db4(0xe4)+_0xa56138);}const _0x2b1270={'name':_0x45e909,'description':_0x2c58d9[_0x481db4(0xd1)],'parentFolderId':_0xa56138},_0x2699a3=await withSpinner('Creating\x20folder\x20\x27'+_0x45e909+_0x481db4(0xac),()=>_0x1c802b[_0x481db4(0x10c)]['createFolder'](_0x344ed1,_0x2b1270),{'verbose':_0x2c58d9[_0x481db4(0x140)]}),_0x14295d=_0x2699a3['data'];return console[_0x481db4(0xd5)](_0x481db4(0xf0)+_0x14295d[_0x481db4(0x120)]+_0x481db4(0x145)+_0x14295d['id']),await handleSDKOutput([_0x14295d],_0x2c58d9),0x0;}}export class SegmentViewCommand extends BaseCommand{[a38_0x53b30b(0x120)]='segment:view';['description']=a38_0x53b30b(0x11b);async[a38_0x53b30b(0xfe)](_0x29967a){const _0x5e8100=a38_0x53b30b,{options:_0x2454a2,args:_0x28f951,tdx:_0x273a89}=_0x29967a,_0x457965=_0x28f951[0x0];if(!_0x457965)return console[_0x5e8100(0xd5)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x5e8100(0xd5)](_0x5e8100(0x143)),console['error'](_0x5e8100(0xca)),console[_0x5e8100(0xd5)](_0x5e8100(0x108)),console[_0x5e8100(0xd5)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x5e8100(0xd5)](_0x5e8100(0x11d)),console[_0x5e8100(0xd5)](_0x5e8100(0xd7)),console['error'](_0x5e8100(0x116)),console[_0x5e8100(0xd5)](_0x5e8100(0xcc)),console[_0x5e8100(0xd5)](_0x5e8100(0xbc)),0x1;try{const _0x5a58ed=_0x2454a2['parentSegment'],_0x42a4cb=await resolveSegmentTarget(_0x457965,_0x5a58ed,_0x2454a2[_0x5e8100(0x140)]);_0x2454a2[_0x5e8100(0x140)]&&console['error'](_0x5e8100(0x121)+_0x42a4cb);const _0x2d174e=await withSpinner('Resolving\x20\x27'+_0x457965+'\x27...',()=>_0x273a89['segment']['resolvePathToResource'](_0x42a4cb),{'verbose':_0x2454a2[_0x5e8100(0x140)]}),_0x1d75b3=_0x2d174e[_0x5e8100(0xd3)];_0x2454a2[_0x5e8100(0x140)]&&(console[_0x5e8100(0xd5)](_0x5e8100(0xe2)+_0x1d75b3['type']),console['error'](_0x5e8100(0xe1)+_0x1d75b3[_0x5e8100(0xbf)]),_0x1d75b3[_0x5e8100(0x141)]&&console['error']('Folder\x20ID:\x20'+_0x1d75b3['folderId']),_0x1d75b3['segmentId']&&console[_0x5e8100(0xd5)](_0x5e8100(0x14a)+_0x1d75b3[_0x5e8100(0x112)]));if(_0x2454a2[_0x5e8100(0x136)]){if(_0x1d75b3[_0x5e8100(0xb7)]===_0x5e8100(0x128))return console[_0x5e8100(0xd5)](_0x5e8100(0x14c)),0x1;if(_0x1d75b3['type']==='parent')return console['error'](_0x5e8100(0x104)),console[_0x5e8100(0xd5)](_0x5e8100(0x12f)),0x1;if(!_0x1d75b3['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x5e8100(0xc8));const _0x38e4fd=getConsoleNextUrl(_0x2454a2[_0x5e8100(0x13c)],_0x5e8100(0x124)+_0x1d75b3[_0x5e8100(0xbf)]+_0x5e8100(0x11e)+_0x1d75b3[_0x5e8100(0x112)]);return console[_0x5e8100(0xd5)](a38_0x4ae481[_0x5e8100(0x11a)]('✔')+_0x5e8100(0xe5)+a38_0x4ae481['cyan'](_0x38e4fd)),openBrowser(_0x38e4fd),0x0;}if(_0x1d75b3['type']==='folder'){if(!_0x1d75b3[_0x5e8100(0x141)])throw new SDKError(ErrorCode[_0x5e8100(0xf3)],_0x5e8100(0x150));const _0x3cb13a=await withSpinner(_0x5e8100(0x10f),()=>_0x273a89['segment'][_0x5e8100(0x10b)](_0x1d75b3[_0x5e8100(0x141)]),{'verbose':_0x2454a2[_0x5e8100(0x140)]});await handleSingleObjectOutput(_0x3cb13a[_0x5e8100(0xd3)],_0x2454a2);}else{if(_0x1d75b3['type']==='segment'){if(!_0x1d75b3[_0x5e8100(0x112)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x5e8100(0xc8));const _0x3728e2=await withSpinner(_0x5e8100(0xb4),()=>_0x273a89[_0x5e8100(0x10c)][_0x5e8100(0xe3)](_0x1d75b3[_0x5e8100(0xbf)],_0x1d75b3[_0x5e8100(0x112)]),{'verbose':_0x2454a2[_0x5e8100(0x140)]}),_0x140440=getConsoleNextUrl(_0x2454a2[_0x5e8100(0x13c)],_0x5e8100(0x124)+_0x1d75b3['parentId']+'/e/'+_0x1d75b3[_0x5e8100(0x112)]),_0x2ead6f=_0x3728e2[_0x5e8100(0xd3)];_0x2ead6f['url']=_0x140440,await handleSingleObjectOutput(_0x2ead6f,_0x2454a2);}else return console['error'](_0x5e8100(0xab)),console[_0x5e8100(0xd5)](_0x5e8100(0xf8)),0x1;}return 0x0;}catch(_0x11c3a0){if(_0x11c3a0 instanceof SDKError)return console[_0x5e8100(0xd5)]('Error:\x20'+_0x11c3a0[_0x5e8100(0xe7)]),_0x11c3a0['cause']&&console[_0x5e8100(0xd5)]('\x20\x20Cause:\x20'+_0x11c3a0[_0x5e8100(0x151)]),0x1;throw _0x11c3a0;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a38_0x53b30b(0x120)]=a38_0x53b30b(0xaf);[a38_0x53b30b(0xd1)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async['execute'](_0x41daad){const _0x5ab3fd=a38_0x53b30b,{options:_0x571661,args:_0x3995e7,tdx:_0x386295}=_0x41daad,_0x50a975=_0x3995e7[0x0];if(!_0x50a975)return console[_0x5ab3fd(0xd5)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error']('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x5ab3fd(0xd5)](_0x5ab3fd(0xc0)),console[_0x5ab3fd(0xd5)](_0x5ab3fd(0x11d)),console['error'](_0x5ab3fd(0x113)),console[_0x5ab3fd(0xd5)](_0x5ab3fd(0xcd)),0x1;try{const _0x5634bc=_0x571661['parentSegment'],_0x35ac3c=await resolveSegmentTarget(_0x50a975,_0x5634bc,_0x571661[_0x5ab3fd(0x140)]);_0x571661[_0x5ab3fd(0x140)]&&console[_0x5ab3fd(0xd5)](_0x5ab3fd(0x121)+_0x35ac3c);const _0x4eac13=await withSpinner(_0x5ab3fd(0x115)+_0x50a975+_0x5ab3fd(0xac),()=>_0x386295['segment']['resolvePathToResource'](_0x35ac3c),{'verbose':_0x571661[_0x5ab3fd(0x140)]}),_0x2bce56=_0x4eac13['data'];_0x571661[_0x5ab3fd(0x140)]&&(console[_0x5ab3fd(0xd5)]('Resolved\x20type:\x20'+_0x2bce56[_0x5ab3fd(0xb7)]),console['error'](_0x5ab3fd(0xe1)+_0x2bce56['parentId']));if(_0x2bce56['type']===_0x5ab3fd(0x128))return console['error'](_0x5ab3fd(0x126)),console[_0x5ab3fd(0xd5)](_0x5ab3fd(0xb3)),0x1;if(_0x2bce56[_0x5ab3fd(0xb7)]===_0x5ab3fd(0x13e))return console[_0x5ab3fd(0xd5)](_0x5ab3fd(0xf7)),console[_0x5ab3fd(0xd5)](_0x5ab3fd(0x138)),0x1;if(!_0x2bce56['segmentId'])throw new SDKError(ErrorCode[_0x5ab3fd(0xe0)],_0x5ab3fd(0xc8));const _0x2e3dbb=await withSpinner(_0x5ab3fd(0xf9),()=>_0x386295[_0x5ab3fd(0x10c)][_0x5ab3fd(0xc7)](_0x2bce56[_0x5ab3fd(0xbf)],_0x2bce56[_0x5ab3fd(0x112)]),{'verbose':_0x571661[_0x5ab3fd(0x140)]}),_0x48c3fc=_0x2e3dbb[_0x5ab3fd(0xd3)],_0x1b330a=await executeSchemaQuery(_0x48c3fc,_0x386295,_0x571661);return await handleQueryOutput(_0x1b330a,_0x571661),0x0;}catch(_0x499164){if(_0x499164 instanceof SDKError)return console[_0x5ab3fd(0xd5)](_0x5ab3fd(0x133)+_0x499164[_0x5ab3fd(0xe7)]),_0x499164[_0x5ab3fd(0x151)]&&console[_0x5ab3fd(0xd5)](_0x5ab3fd(0x114)+_0x499164['cause']),0x1;throw _0x499164;}}}
1
+ function a38_0x4999(_0x2b393a,_0x3c629d){_0x2b393a=_0x2b393a-0x1e8;const _0x4729cd=a38_0x4729();let _0x49991f=_0x4729cd[_0x2b393a];return _0x49991f;}const a38_0x359782=a38_0x4999;(function(_0x345128,_0x32c28a){const _0xd85f62=a38_0x4999,_0x391d5a=_0x345128();while(!![]){try{const _0x43ab61=parseInt(_0xd85f62(0x203))/0x1*(-parseInt(_0xd85f62(0x280))/0x2)+-parseInt(_0xd85f62(0x1e8))/0x3+-parseInt(_0xd85f62(0x243))/0x4*(-parseInt(_0xd85f62(0x236))/0x5)+parseInt(_0xd85f62(0x271))/0x6*(parseInt(_0xd85f62(0x208))/0x7)+parseInt(_0xd85f62(0x270))/0x8+parseInt(_0xd85f62(0x26d))/0x9+-parseInt(_0xd85f62(0x238))/0xa*(parseInt(_0xd85f62(0x228))/0xb);if(_0x43ab61===_0x32c28a)break;else _0x391d5a['push'](_0x391d5a['shift']());}catch(_0x5e299e){_0x391d5a['push'](_0x391d5a['shift']());}}}(a38_0x4729,0xb696f));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';function a38_0x4729(){const _0xf8dd46=['SQL\x20query:\x0a','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','format','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','folder','Show\x20folder\x20or\x20child\x20segment\x20details','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','getSQLFromYamlFile','processedRows','Usage:','resolveParentId','SEGMENT_FOLDER_NOT_FOUND','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','message','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Examples:','Resolved\x20relative\x20path\x20to:\x20','Show\x20segment\x20or\x20folder\x20details','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','segment:sql','\x20\x20Parent\x20segment:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','listFolders','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','3949WpWuWP','Folder\x20ID:\x20','site','Use:\x20tdx\x20ps\x20view','INVALID_ARGUMENT','159635PIazJH','jobId','Show\x20child\x20segment\x20schema\x20(column\x20types)','Usage:\x20tdx\x20sg\x20desc\x20<name>','SELECT\x20*\x20FROM\x20(\x0a','jsonl','Options:','Use:\x20tdx\x20ps\x20desc','/e/','parentFolder','\x20rows\x20','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Parent\x20name:\x20','Fetching\x20segment\x20details...','Segment\x20ID:\x20','query','Error:\x20','\x27...','segment','length','toLocaleString','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Site:\x20','description','data','Resolved\x20type:\x20','trim','Folder\x20ID\x20missing\x20from\x20resolved\x20path','segmentId','Use:\x20tdx\x20ps\x20show','Use:\x20tdx\x20ps\x20view\x20-w','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','6094NmiZna','Creating\x20folder\x20\x27','✖\x20Query\x20failed\x20[','\x20\x20Segment\x20name:\x20','SEGMENT_NOT_FOUND','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','getParent','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','code','(root)','folderId','resolvePathToResource','5MdZBMj','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','3430oKkwqI','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Parent\x20ID:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','stats','Fetching\x20folder\x20\x27','parentSegment','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','segment:folder:show','\x20\x20Cause:\x20','1085380lwEXra','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','content','Usage:\x20tdx\x20sg\x20show\x20<name>','Resolving\x20parent\x20segment\x20\x27','Parent\x20segment:\x20','Target\x20path:\x20','Resolved:\x20','Resolving\x20\x27','\x20\x20Full\x20path:\x20','segment:folder:list','Resolved\x20parent\x20folder\x20ID:\x20','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','replace','Fetching\x20parent\x20segment\x20details...','green','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','verbose','Resolving\x20folder\x20\x27','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Folder\x20name:\x20','Resolving\x20path\x20\x27','error','Fetching\x20SQL\x20for\x20segment...','execute','name','\x20[Job\x20ID:\x20','path','elapsedTimeMillis','\x27\x20with\x20ID:\x20','getSQLFromServerSegment','url','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','folderPath','type','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','cause','parentId','segment:describe','6434316AnXuzl','\x20\x20tdx\x20sg\x20sql\x20--path\x20','getSegmentSQL','7238984AuZfLw','270dmijqH','cyan','getSegment','setJobId','Resolved\x20YAML\x20file:\x20','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','segment:desc','Show\x20segment\x20folder\x20details','segmentName','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Usage:\x20tdx\x20segment\x20describe\x20<path>','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','parent','✔\x20Created\x20folder\x20\x27','resolveFolderId','688cEmOIB','fullPath','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','✔\x20Query\x20completed:\x20Processed\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','getFolder','test','/app/ps/','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','red','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','1863006lIkVVI'];a38_0x4729=function(){return _0xf8dd46;};return a38_0x4729();}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 a38_0x3a705a from'chalk';async function resolveSegmentTarget(_0x3c5aab,_0xf9a7c3,_0x5b7fc0){const _0x4b2ff9=a38_0x4999;if(isYamlFilePath(_0x3c5aab))try{const _0x55474a=await resolveYamlFilePath(_0x3c5aab);return _0x5b7fc0&&(console[_0x4b2ff9(0x25b)](_0x4b2ff9(0x275)+_0x3c5aab),console['error'](_0x4b2ff9(0x1fe)+_0x55474a[_0x4b2ff9(0x23f)]),console[_0x4b2ff9(0x25b)](_0x4b2ff9(0x22b)+_0x55474a[_0x4b2ff9(0x279)]),console[_0x4b2ff9(0x25b)]('\x20\x20Folder\x20path:\x20'+(_0x55474a[_0x4b2ff9(0x267)]||_0x4b2ff9(0x233))),console['error'](_0x4b2ff9(0x24d)+_0x55474a[_0x4b2ff9(0x281)])),_0x55474a['fullPath'];}catch(_0x25d004){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x25d004[_0x4b2ff9(0x1f6)]);}if(!_0xf9a7c3)throw new SDKError(ErrorCode[_0x4b2ff9(0x207)],_0x4b2ff9(0x244));return _0xf9a7c3+'/'+_0x3c5aab;}export class SegmentDescribeCommand extends BaseCommand{[a38_0x359782(0x25e)]=a38_0x359782(0x26c);[a38_0x359782(0x21f)]=a38_0x359782(0x1fa);async[a38_0x359782(0x25d)](_0x2a7fd8){const _0x2f2b5c=a38_0x359782,{options:_0x1ee347,args:_0x1e8a00,tdx:_0x55d51e}=_0x2a7fd8,_0x2139d9=_0x1e8a00[0x0],_0x26849a=!_0x2139d9&&!!_0x1ee347[_0x2f2b5c(0x23f)],_0x1abbbf=_0x2139d9||_0x1ee347[_0x2f2b5c(0x23f)];if(!_0x1abbbf)return console['error']('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x2f2b5c(0x25b)](_0x2f2b5c(0x27b)),console['error'](_0x2f2b5c(0x1f8)),console[_0x2f2b5c(0x25b)](_0x2f2b5c(0x21d)),console[_0x2f2b5c(0x25b)](_0x2f2b5c(0x284)),console['error'](_0x2f2b5c(0x282)),console[_0x2f2b5c(0x25b)](_0x2f2b5c(0x1f7)),0x1;try{const _0x34386f=_0x1ee347['segmentPath'];let _0x5e9b65=_0x1abbbf;!_0x26849a&&_0x34386f&&!_0x1abbbf['includes']('/')&&(_0x5e9b65=_0x34386f+'/'+_0x1abbbf,_0x1ee347[_0x2f2b5c(0x256)]&&console[_0x2f2b5c(0x25b)](_0x2f2b5c(0x1f9)+_0x5e9b65));const _0xa13fc4=await withSpinner(_0x2f2b5c(0x25a)+_0x5e9b65+_0x2f2b5c(0x219),()=>_0x55d51e[_0x2f2b5c(0x21a)][_0x2f2b5c(0x235)](_0x5e9b65),{'verbose':_0x1ee347['verbose']}),_0x2c8523=_0xa13fc4[_0x2f2b5c(0x220)];_0x1ee347[_0x2f2b5c(0x256)]&&(console['error'](_0x2f2b5c(0x221)+_0x2c8523[_0x2f2b5c(0x268)]),console[_0x2f2b5c(0x25b)](_0x2f2b5c(0x23a)+_0x2c8523['parentId']),_0x2c8523[_0x2f2b5c(0x234)]&&console['error'](_0x2f2b5c(0x204)+_0x2c8523[_0x2f2b5c(0x234)]),_0x2c8523[_0x2f2b5c(0x224)]&&console['error'](_0x2f2b5c(0x216)+_0x2c8523[_0x2f2b5c(0x224)]));if(_0x2c8523[_0x2f2b5c(0x268)]===_0x2f2b5c(0x27d)){const _0x309f0a=await withSpinner(_0x2f2b5c(0x252),()=>_0x55d51e[_0x2f2b5c(0x21a)][_0x2f2b5c(0x22f)](_0x2c8523[_0x2f2b5c(0x26b)]),{'verbose':_0x1ee347[_0x2f2b5c(0x256)]});await handleSingleObjectOutput(_0x309f0a[_0x2f2b5c(0x220)],_0x1ee347);}else{if(_0x2c8523[_0x2f2b5c(0x268)]==='folder'){if(!_0x2c8523['folderId'])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x148c8a=await withSpinner('Fetching\x20folder\x20details...',()=>_0x55d51e[_0x2f2b5c(0x21a)][_0x2f2b5c(0x285)](_0x2c8523['folderId']),{'verbose':_0x1ee347[_0x2f2b5c(0x256)]});await handleSingleObjectOutput(_0x148c8a[_0x2f2b5c(0x220)],_0x1ee347);}else{if(_0x2c8523['type']===_0x2f2b5c(0x21a)){if(!_0x2c8523['segmentId'])throw new SDKError(ErrorCode[_0x2f2b5c(0x22c)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x5f50bd=await withSpinner(_0x2f2b5c(0x215),()=>_0x55d51e[_0x2f2b5c(0x21a)]['getSegment'](_0x2c8523[_0x2f2b5c(0x26b)],_0x2c8523[_0x2f2b5c(0x224)]),{'verbose':_0x1ee347['verbose']});await handleSingleObjectOutput(_0x5f50bd[_0x2f2b5c(0x220)],_0x1ee347);}}}return 0x0;}catch(_0x5721d8){if(_0x5721d8 instanceof SDKError)return console[_0x2f2b5c(0x25b)](_0x2f2b5c(0x218)+_0x5721d8[_0x2f2b5c(0x1f6)]),_0x5721d8['cause']&&console[_0x2f2b5c(0x25b)]('\x20\x20Cause:\x20'+_0x5721d8[_0x2f2b5c(0x26a)]),0x1;throw _0x5721d8;}}}export class SegmentShowCommand extends BaseCommand{['name']='segment:show';[a38_0x359782(0x21f)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async['execute'](_0x4554e3){const _0x1d7306=a38_0x359782,{options:_0x159a0b,args:_0x20c7b4,tdx:_0x30dda0}=_0x4554e3,_0x139dad=_0x20c7b4[0x0];if(!_0x139dad)return console['error'](_0x1d7306(0x27a)),console[_0x1d7306(0x25b)](_0x1d7306(0x247)),console[_0x1d7306(0x25b)](_0x1d7306(0x22d)),console[_0x1d7306(0x25b)](_0x1d7306(0x1f8)),console[_0x1d7306(0x25b)](_0x1d7306(0x213)),console['error'](_0x1d7306(0x240)),0x1;try{const _0x31883f=_0x159a0b[_0x1d7306(0x23f)],_0x3e1177=await resolveSegmentTarget(_0x139dad,_0x31883f,_0x159a0b[_0x1d7306(0x256)]);_0x159a0b[_0x1d7306(0x256)]&&console[_0x1d7306(0x25b)](_0x1d7306(0x24a)+_0x3e1177);const _0x52eba=await withSpinner(_0x1d7306(0x24c)+_0x139dad+'\x27...',()=>_0x30dda0[_0x1d7306(0x21a)]['resolvePathToResource'](_0x3e1177),{'verbose':_0x159a0b[_0x1d7306(0x256)]}),_0x5eabd1=_0x52eba['data'];_0x159a0b['verbose']&&(console[_0x1d7306(0x25b)](_0x1d7306(0x221)+_0x5eabd1[_0x1d7306(0x268)]),console[_0x1d7306(0x25b)]('Parent\x20ID:\x20'+_0x5eabd1[_0x1d7306(0x26b)]));if(_0x5eabd1[_0x1d7306(0x268)]===_0x1d7306(0x1ed))return console[_0x1d7306(0x25b)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0x1d7306(0x25b)](_0x1d7306(0x265)),0x1;if(_0x5eabd1[_0x1d7306(0x268)]===_0x1d7306(0x27d))return console['error'](_0x1d7306(0x227)),console[_0x1d7306(0x25b)](_0x1d7306(0x225)),0x1;if(!_0x5eabd1[_0x1d7306(0x224)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x580a8c=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x30dda0['segment'][_0x1d7306(0x26f)](_0x5eabd1[_0x1d7306(0x26b)],_0x5eabd1['segmentId']),{'verbose':_0x159a0b['verbose']});let _0x586ec8=_0x580a8c['data'];const _0xcd6505=resolveLimit(_0x159a0b['limit'],DEFAULT_DISPLAY_LIMIT),_0x239e47=/\bLIMIT\s+\d+/i[_0x1d7306(0x286)](_0x586ec8);!_0x239e47&&(_0x586ec8=_0x586ec8[_0x1d7306(0x222)]()[_0x1d7306(0x251)](/;+$/,''),_0x586ec8=_0x1d7306(0x20c)+_0x586ec8+_0x1d7306(0x1ec)+_0xcd6505);_0x159a0b['verbose']&&console[_0x1d7306(0x25b)](_0x1d7306(0x1e9)+_0x586ec8);const _0x81abf9=await withProgressSpinner('Executing\x20segment\x20query...',async _0x43150d=>{const _0x123321=_0x1d7306,_0x416c8c=await _0x30dda0[_0x123321(0x217)]['execute'](_0x586ec8,{'catalog':'td','schema':'information_schema','onJobId':_0x471a2e=>{const _0x5e5e8f=_0x123321;_0x43150d[_0x5e5e8f(0x274)](_0x471a2e);}});return _0x416c8c;},{'verbose':_0x159a0b[_0x1d7306(0x256)]}),_0x4fb713=_0x81abf9[_0x1d7306(0x220)],_0x5cb3fc=_0x4fb713[_0x1d7306(0x209)]?_0x1d7306(0x25f)+_0x4fb713[_0x1d7306(0x209)]+']':'';return console[_0x1d7306(0x25b)](_0x1d7306(0x283)+_0x4fb713[_0x1d7306(0x23d)][_0x1d7306(0x1f1)][_0x1d7306(0x21c)]()+_0x1d7306(0x212)+('in\x20'+formatElapsed(_0x4fb713[_0x1d7306(0x23d)][_0x1d7306(0x261)])+_0x5cb3fc)),await handleQueryOutput(_0x4fb713,_0x159a0b),0x0;}catch(_0x3eb104){if(_0x3eb104 instanceof SDKError)return console[_0x1d7306(0x25b)](_0x1d7306(0x22a)+_0x3eb104[_0x1d7306(0x232)]+']'),console[_0x1d7306(0x25b)]('\x0a'+_0x3eb104[_0x1d7306(0x1f6)]),0x1;throw _0x3eb104;}}}export class SegmentFolderListCommand extends BaseCommand{[a38_0x359782(0x25e)]=a38_0x359782(0x24e);[a38_0x359782(0x21f)]=a38_0x359782(0x28a);async[a38_0x359782(0x25d)](_0x468641){const _0x32b9cc=a38_0x359782,{options:_0xd4f89e,args:_0x10d17e,tdx:_0x55c45b}=_0x468641;if(_0x10d17e[_0x32b9cc(0x21b)]===0x0)return console[_0x32b9cc(0x25b)](_0x32b9cc(0x254)),console[_0x32b9cc(0x25b)](_0x32b9cc(0x266)),0x1;const _0x17db4c=_0x10d17e[0x0];try{_0xd4f89e[_0x32b9cc(0x256)]&&(console[_0x32b9cc(0x25b)](_0x32b9cc(0x21e)+_0xd4f89e[_0x32b9cc(0x205)]),console[_0x32b9cc(0x25b)](_0x32b9cc(0x214)+_0x17db4c));const _0x50cef6=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x17db4c+_0x32b9cc(0x219),()=>_0x55c45b['segment'][_0x32b9cc(0x1f3)](_0x17db4c),{'verbose':_0xd4f89e[_0x32b9cc(0x256)]}),_0x2ddc0d=_0x50cef6[_0x32b9cc(0x220)];_0xd4f89e['verbose']&&console[_0x32b9cc(0x25b)]('Resolved\x20parent\x20ID:\x20'+_0x2ddc0d);const _0x18614c=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x17db4c+_0x32b9cc(0x219),()=>_0x55c45b[_0x32b9cc(0x21a)][_0x32b9cc(0x201)](_0x2ddc0d),{'verbose':_0xd4f89e[_0x32b9cc(0x256)]}),_0x3174b6=_0x18614c[_0x32b9cc(0x220)];return console[_0x32b9cc(0x25b)]('✔\x20Found\x20'+_0x3174b6[_0x32b9cc(0x21b)]+'\x20folder'+(_0x3174b6[_0x32b9cc(0x21b)]!==0x1?'s':'')),await handleSDKOutput(_0x3174b6,_0xd4f89e),0x0;}catch(_0x3072ef){if(_0x3072ef instanceof SDKError)return console[_0x32b9cc(0x25b)](_0x32b9cc(0x218)+_0x3072ef['message']),_0x3072ef[_0x32b9cc(0x26a)]&&console['error']('\x20\x20Cause:\x20'+_0x3072ef[_0x32b9cc(0x26a)]),0x1;throw _0x3072ef;}}}export class SegmentFolderShowCommand extends BaseCommand{[a38_0x359782(0x25e)]=a38_0x359782(0x241);[a38_0x359782(0x21f)]=a38_0x359782(0x278);async['execute'](_0x177bb5){const _0x1e19c0=a38_0x359782,{options:_0x2a7cb2,args:_0x2f8bf8,tdx:_0x544f42}=_0x177bb5;if(_0x2f8bf8['length']===0x0)return console[_0x1e19c0(0x25b)]('Error:\x20Folder\x20reference\x20is\x20required'),console[_0x1e19c0(0x25b)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x277287,childId:_0x36f4ed}=parseSegmentRef(_0x2f8bf8[0x0]);_0x2a7cb2['verbose']&&(console[_0x1e19c0(0x25b)](_0x1e19c0(0x21e)+_0x2a7cb2[_0x1e19c0(0x205)]),console[_0x1e19c0(0x25b)](_0x1e19c0(0x214)+_0x277287),_0x36f4ed&&console[_0x1e19c0(0x25b)](_0x1e19c0(0x259)+_0x36f4ed));if(!_0x36f4ed)return console[_0x1e19c0(0x25b)](_0x1e19c0(0x288)),0x1;const _0x2bbc28=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x277287+'\x27...',()=>_0x544f42[_0x1e19c0(0x21a)][_0x1e19c0(0x1f3)](_0x277287),{'verbose':_0x2a7cb2[_0x1e19c0(0x256)]}),_0x50b87e=_0x2bbc28['data'];_0x2a7cb2['verbose']&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x50b87e);const _0x2fd337=await withSpinner(_0x1e19c0(0x257)+_0x36f4ed+_0x1e19c0(0x219),()=>_0x544f42[_0x1e19c0(0x21a)][_0x1e19c0(0x27f)](_0x50b87e,_0x36f4ed),{'verbose':_0x2a7cb2[_0x1e19c0(0x256)]}),_0x5a1aba=_0x2fd337[_0x1e19c0(0x220)];_0x2a7cb2[_0x1e19c0(0x256)]&&console[_0x1e19c0(0x25b)]('Resolved\x20folder\x20ID:\x20'+_0x5a1aba);const _0x2307c3=await withSpinner(_0x1e19c0(0x23e)+_0x36f4ed+_0x1e19c0(0x219),()=>_0x544f42[_0x1e19c0(0x21a)][_0x1e19c0(0x285)](_0x5a1aba),{'verbose':_0x2a7cb2[_0x1e19c0(0x256)]});return await handleSDKOutput([_0x2307c3[_0x1e19c0(0x220)]],_0x2a7cb2),0x0;}catch(_0x53d9bb){if(_0x53d9bb instanceof SDKError)return console[_0x1e19c0(0x25b)](_0x1e19c0(0x218)+_0x53d9bb[_0x1e19c0(0x1f6)]),_0x53d9bb['cause']&&console[_0x1e19c0(0x25b)](_0x1e19c0(0x242)+_0x53d9bb[_0x1e19c0(0x26a)]),0x1;throw _0x53d9bb;}}}export class SegmentSQLCommand extends BaseCommand{[a38_0x359782(0x25e)]=a38_0x359782(0x1fd);['description']='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a38_0x359782(0x25d)](_0x12da08){const _0x443524=a38_0x359782,{options:_0x160e41,args:_0x31cf17}=_0x12da08,_0x5d220e=_0x160e41,_0x1ab16b=_0x5d220e[_0x443524(0x260)],_0x536241=_0x31cf17[0x0];if(!_0x536241&&!_0x1ab16b)return console[_0x443524(0x25b)](a38_0x3a705a['red'](_0x443524(0x1ef))),console[_0x443524(0x25b)](_0x443524(0x1f2)),console[_0x443524(0x25b)]('\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>'),console[_0x443524(0x25b)](_0x443524(0x255)),console['error']('Examples:'),console[_0x443524(0x25b)](_0x443524(0x230)),console[_0x443524(0x25b)](_0x443524(0x23c)),0x1;if(_0x536241&&_0x1ab16b)return console['error'](a38_0x3a705a['red']('Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both')),0x1;try{let _0x3f652c;if(_0x1ab16b)_0x3f652c=await this[_0x443524(0x1f0)](_0x1ab16b,_0x12da08);else{if(isYamlFilePath(_0x536241))return console[_0x443524(0x25b)](a38_0x3a705a[_0x443524(0x289)](_0x443524(0x202))),console[_0x443524(0x25b)](_0x443524(0x26e)+_0x536241),0x1;else _0x3f652c=await this[_0x443524(0x263)](_0x536241,_0x12da08);}return _0x160e41[_0x443524(0x1eb)]==='json'||_0x160e41[_0x443524(0x1eb)]===_0x443524(0x20d)?await handleSDKOutput([{'sql':_0x3f652c}],_0x160e41):console['log'](_0x3f652c),0x0;}catch(_0x1f7ba6){if(_0x1f7ba6 instanceof SDKError)return console[_0x443524(0x25b)]('Error:\x20'+_0x1f7ba6[_0x443524(0x1f6)]),_0x1f7ba6[_0x443524(0x26a)]&&console[_0x443524(0x25b)](_0x443524(0x242)+_0x1f7ba6[_0x443524(0x26a)]),0x1;throw _0x1f7ba6;}}async['getSQLFromYamlFile'](_0x4ad7b2,_0x4ce1d8){const _0x348266=a38_0x359782,{options:_0x4b70f5,tdx:_0x5ce15f}=_0x4ce1d8;let _0x4dcac8;try{_0x4dcac8=await resolveYamlFilePath(_0x4ad7b2);}catch(_0x29d002){throw new SDKError(ErrorCode[_0x348266(0x207)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x29d002['message']);}_0x4b70f5[_0x348266(0x256)]&&console[_0x348266(0x25b)](_0x348266(0x24b)+_0x4dcac8[_0x348266(0x23f)]+'/'+_0x4dcac8[_0x348266(0x279)]);const _0x319178=await withSpinner('Fetching\x20SQL\x20from\x20rule...',()=>_0x5ce15f[_0x348266(0x21a)]['getSegmentSQLFromYaml'](_0x4dcac8[_0x348266(0x246)],_0x4dcac8[_0x348266(0x23f)],_0x4dcac8[_0x348266(0x279)]),{'verbose':_0x4b70f5[_0x348266(0x256)]});return _0x319178['data'];}async[a38_0x359782(0x263)](_0x467819,_0x4ef122){const _0x1bcc14=a38_0x359782,{options:_0x5a8f9c,tdx:_0x43dcc0}=_0x4ef122,_0x150a65=_0x5a8f9c['parentSegment'],_0x4bf5d5=await resolveSegmentTarget(_0x467819,_0x150a65,_0x5a8f9c[_0x1bcc14(0x256)]);_0x5a8f9c[_0x1bcc14(0x256)]&&console[_0x1bcc14(0x25b)]('Target\x20path:\x20'+_0x4bf5d5);const _0x5c489b=await withSpinner('Resolving\x20\x27'+_0x467819+_0x1bcc14(0x219),()=>_0x43dcc0[_0x1bcc14(0x21a)][_0x1bcc14(0x235)](_0x4bf5d5),{'verbose':_0x5a8f9c[_0x1bcc14(0x256)]}),_0x26201e=_0x5c489b[_0x1bcc14(0x220)];_0x5a8f9c['verbose']&&(console[_0x1bcc14(0x25b)](_0x1bcc14(0x221)+_0x26201e[_0x1bcc14(0x268)]),console[_0x1bcc14(0x25b)](_0x1bcc14(0x23a)+_0x26201e[_0x1bcc14(0x26b)]));if(_0x26201e[_0x1bcc14(0x268)]===_0x1bcc14(0x1ed))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.');if(_0x26201e[_0x1bcc14(0x268)]===_0x1bcc14(0x27d))throw new SDKError(ErrorCode[_0x1bcc14(0x207)],_0x1bcc14(0x1fb));if(!_0x26201e[_0x1bcc14(0x224)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x1bcc14(0x258));const _0x4eb5a5=await withSpinner(_0x1bcc14(0x25c),()=>_0x43dcc0[_0x1bcc14(0x21a)][_0x1bcc14(0x26f)](_0x26201e['parentId'],_0x26201e[_0x1bcc14(0x224)]),{'verbose':_0x5a8f9c[_0x1bcc14(0x256)]});return _0x4eb5a5[_0x1bcc14(0x220)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a38_0x359782(0x25e)]='segment:folder:create';[a38_0x359782(0x21f)]='Create\x20segment\x20folder\x20for\x20organization';async[a38_0x359782(0x25d)](_0x34f591){const _0x570947=a38_0x359782,{options:_0x118437,args:_0x4b9a16,tdx:_0x3375cf}=_0x34f591,_0xba5b13=_0x118437;if(_0x4b9a16[_0x570947(0x21b)]<0x2)return console[_0x570947(0x25b)](_0x570947(0x200)),console['error'](_0x570947(0x27c)),0x1;const _0x4a1cfb=_0x4b9a16[0x0],_0x57f10c=_0x4b9a16[0x1];_0xba5b13[_0x570947(0x256)]&&(console[_0x570947(0x25b)](_0x570947(0x21e)+_0xba5b13[_0x570947(0x205)]),console['error'](_0x570947(0x249)+_0x4a1cfb),console['error'](_0x570947(0x259)+_0x57f10c));let _0x1f4841;if(_0xba5b13[_0x570947(0x211)]){const _0x1d7e42=_0xba5b13[_0x570947(0x211)],_0x2fc784=await withSpinner(_0x570947(0x248)+_0x4a1cfb+_0x570947(0x219),()=>_0x3375cf['segment'][_0x570947(0x1f3)](_0x4a1cfb),{'verbose':_0xba5b13[_0x570947(0x256)]}),_0x2123e9=_0x2fc784[_0x570947(0x220)],_0x114087=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x1d7e42+'\x27...',()=>_0x3375cf[_0x570947(0x21a)][_0x570947(0x27f)](_0x2123e9,_0x1d7e42),{'verbose':_0xba5b13[_0x570947(0x256)]});_0x1f4841=_0x114087[_0x570947(0x220)],_0xba5b13[_0x570947(0x256)]&&console['error'](_0x570947(0x24f)+_0x1f4841);}const _0x4b1727={'name':_0x57f10c,'description':_0xba5b13[_0x570947(0x21f)],'parentFolderId':_0x1f4841},_0x5a793e=await withSpinner(_0x570947(0x229)+_0x57f10c+_0x570947(0x219),()=>_0x3375cf[_0x570947(0x21a)]['createFolder'](_0x4a1cfb,_0x4b1727),{'verbose':_0xba5b13[_0x570947(0x256)]}),_0x1734ab=_0x5a793e['data'];return console[_0x570947(0x25b)](_0x570947(0x27e)+_0x1734ab[_0x570947(0x25e)]+_0x570947(0x262)+_0x1734ab['id']),await handleSDKOutput([_0x1734ab],_0xba5b13),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']='segment:view';[a38_0x359782(0x21f)]=a38_0x359782(0x1ee);async[a38_0x359782(0x25d)](_0x5cafbd){const _0x4e416a=a38_0x359782,{options:_0x18e35d,args:_0x3c50cf,tdx:_0x1a467e}=_0x5cafbd,_0x23baa2=_0x3c50cf[0x0];if(!_0x23baa2)return console[_0x4e416a(0x25b)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error'](_0x4e416a(0x276)),console['error'](_0x4e416a(0x1ff)),console[_0x4e416a(0x25b)](_0x4e416a(0x20e)),console[_0x4e416a(0x25b)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console['error'](_0x4e416a(0x1f8)),console['error'](_0x4e416a(0x1fc)),console[_0x4e416a(0x25b)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x4e416a(0x25b)](_0x4e416a(0x22e)),console['error'](_0x4e416a(0x231)),0x1;try{const _0x2571cd=_0x18e35d[_0x4e416a(0x23f)],_0x4e20b7=await resolveSegmentTarget(_0x23baa2,_0x2571cd,_0x18e35d[_0x4e416a(0x256)]);_0x18e35d[_0x4e416a(0x256)]&&console[_0x4e416a(0x25b)]('Target\x20path:\x20'+_0x4e20b7);const _0xc6e158=await withSpinner('Resolving\x20\x27'+_0x23baa2+'\x27...',()=>_0x1a467e[_0x4e416a(0x21a)][_0x4e416a(0x235)](_0x4e20b7),{'verbose':_0x18e35d[_0x4e416a(0x256)]}),_0x58d199=_0xc6e158[_0x4e416a(0x220)];_0x18e35d[_0x4e416a(0x256)]&&(console[_0x4e416a(0x25b)](_0x4e416a(0x221)+_0x58d199[_0x4e416a(0x268)]),console['error'](_0x4e416a(0x23a)+_0x58d199[_0x4e416a(0x26b)]),_0x58d199[_0x4e416a(0x234)]&&console[_0x4e416a(0x25b)](_0x4e416a(0x204)+_0x58d199['folderId']),_0x58d199[_0x4e416a(0x224)]&&console[_0x4e416a(0x25b)](_0x4e416a(0x216)+_0x58d199['segmentId']));if(_0x18e35d['web']){if(_0x58d199[_0x4e416a(0x268)]===_0x4e416a(0x1ed))return console[_0x4e416a(0x25b)](_0x4e416a(0x237)),0x1;if(_0x58d199['type']===_0x4e416a(0x27d))return console[_0x4e416a(0x25b)](_0x4e416a(0x269)),console[_0x4e416a(0x25b)](_0x4e416a(0x226)),0x1;if(!_0x58d199['segmentId'])throw new SDKError(ErrorCode[_0x4e416a(0x22c)],_0x4e416a(0x258));const _0x727664=getConsoleNextUrl(_0x18e35d[_0x4e416a(0x205)],_0x4e416a(0x287)+_0x58d199['parentId']+_0x4e416a(0x210)+_0x58d199[_0x4e416a(0x224)]);return console['error'](a38_0x3a705a[_0x4e416a(0x253)]('✔')+'\x20Opening\x20'+a38_0x3a705a[_0x4e416a(0x272)](_0x727664)),openBrowser(_0x727664),0x0;}if(_0x58d199[_0x4e416a(0x268)]===_0x4e416a(0x1ed)){if(!_0x58d199[_0x4e416a(0x234)])throw new SDKError(ErrorCode[_0x4e416a(0x1f4)],_0x4e416a(0x223));const _0x4683a8=await withSpinner('Fetching\x20folder\x20details...',()=>_0x1a467e[_0x4e416a(0x21a)]['getFolder'](_0x58d199[_0x4e416a(0x234)]),{'verbose':_0x18e35d['verbose']});await handleSingleObjectOutput(_0x4683a8[_0x4e416a(0x220)],_0x18e35d);}else{if(_0x58d199[_0x4e416a(0x268)]===_0x4e416a(0x21a)){if(!_0x58d199[_0x4e416a(0x224)])throw new SDKError(ErrorCode[_0x4e416a(0x22c)],_0x4e416a(0x258));const _0x21d26a=await withSpinner(_0x4e416a(0x215),()=>_0x1a467e['segment'][_0x4e416a(0x273)](_0x58d199['parentId'],_0x58d199['segmentId']),{'verbose':_0x18e35d[_0x4e416a(0x256)]}),_0x15d770=getConsoleNextUrl(_0x18e35d[_0x4e416a(0x205)],_0x4e416a(0x287)+_0x58d199[_0x4e416a(0x26b)]+_0x4e416a(0x210)+_0x58d199['segmentId']),_0x513ee8=_0x21d26a[_0x4e416a(0x220)];_0x513ee8[_0x4e416a(0x264)]=_0x15d770,await handleSingleObjectOutput(_0x513ee8,_0x18e35d);}else return console[_0x4e416a(0x25b)](_0x4e416a(0x245)),console[_0x4e416a(0x25b)](_0x4e416a(0x206)),0x1;}return 0x0;}catch(_0x59440d){if(_0x59440d instanceof SDKError)return console[_0x4e416a(0x25b)](_0x4e416a(0x218)+_0x59440d[_0x4e416a(0x1f6)]),_0x59440d[_0x4e416a(0x26a)]&&console[_0x4e416a(0x25b)](_0x4e416a(0x242)+_0x59440d[_0x4e416a(0x26a)]),0x1;throw _0x59440d;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a38_0x359782(0x25e)]=a38_0x359782(0x277);[a38_0x359782(0x21f)]=a38_0x359782(0x20a);async[a38_0x359782(0x25d)](_0x3923c7){const _0x2aee5e=a38_0x359782,{options:_0x44b0b9,args:_0x5b7161,tdx:_0x5acebd}=_0x3923c7,_0x38d2f5=_0x5b7161[0x0];if(!_0x38d2f5)return console[_0x2aee5e(0x25b)](_0x2aee5e(0x27a)),console[_0x2aee5e(0x25b)](_0x2aee5e(0x20b)),console[_0x2aee5e(0x25b)](_0x2aee5e(0x239)),console['error'](_0x2aee5e(0x1f8)),console[_0x2aee5e(0x25b)](_0x2aee5e(0x1ea)),console[_0x2aee5e(0x25b)](_0x2aee5e(0x250)),0x1;try{const _0x222fc8=_0x44b0b9[_0x2aee5e(0x23f)],_0x3e9822=await resolveSegmentTarget(_0x38d2f5,_0x222fc8,_0x44b0b9[_0x2aee5e(0x256)]);_0x44b0b9[_0x2aee5e(0x256)]&&console[_0x2aee5e(0x25b)]('Target\x20path:\x20'+_0x3e9822);const _0x4e7f3b=await withSpinner(_0x2aee5e(0x24c)+_0x38d2f5+'\x27...',()=>_0x5acebd[_0x2aee5e(0x21a)]['resolvePathToResource'](_0x3e9822),{'verbose':_0x44b0b9[_0x2aee5e(0x256)]}),_0x1f1987=_0x4e7f3b[_0x2aee5e(0x220)];_0x44b0b9[_0x2aee5e(0x256)]&&(console['error'](_0x2aee5e(0x221)+_0x1f1987[_0x2aee5e(0x268)]),console[_0x2aee5e(0x25b)](_0x2aee5e(0x23a)+_0x1f1987['parentId']));if(_0x1f1987[_0x2aee5e(0x268)]===_0x2aee5e(0x1ed))return console[_0x2aee5e(0x25b)](_0x2aee5e(0x1f5)),console[_0x2aee5e(0x25b)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x1f1987[_0x2aee5e(0x268)]===_0x2aee5e(0x27d))return console[_0x2aee5e(0x25b)](_0x2aee5e(0x23b)),console[_0x2aee5e(0x25b)](_0x2aee5e(0x20f)),0x1;if(!_0x1f1987[_0x2aee5e(0x224)])throw new SDKError(ErrorCode[_0x2aee5e(0x22c)],_0x2aee5e(0x258));const _0x2a1fc5=await withSpinner(_0x2aee5e(0x25c),()=>_0x5acebd['segment']['getSegmentSQL'](_0x1f1987['parentId'],_0x1f1987[_0x2aee5e(0x224)]),{'verbose':_0x44b0b9[_0x2aee5e(0x256)]}),_0x44f3d5=_0x2a1fc5['data'],_0x5dc2f6=await executeSchemaQuery(_0x44f3d5,_0x5acebd,_0x44b0b9);return await handleQueryOutput(_0x5dc2f6,_0x44b0b9),0x0;}catch(_0x4ea668){if(_0x4ea668 instanceof SDKError)return console[_0x2aee5e(0x25b)]('Error:\x20'+_0x4ea668['message']),_0x4ea668[_0x2aee5e(0x26a)]&&console['error'](_0x2aee5e(0x242)+_0x4ea668['cause']),0x1;throw _0x4ea668;}}}
@@ -1 +1 @@
1
- function a39_0x109b(){const _0x16f1ea=['7077WKkwmq','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','noCountPopulation','kind','Resolving\x20folder\x20path\x20\x27','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','resolveParentId','323876YCbSst','resolvePathToResource','136653PrkXgq','216MbJVCd','4696326BqliCF','rule','Site:\x20','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','resolveFolderId','Resolving\x20parent\x20segment\x20\x27','segmentPath','data','parent','segment:create','Segment\x20name:\x20','4qdAvgN','segments','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','Resolving\x20folder\x20\x27','name','\x27...','Examples:','1141820UECZNk','1901238SchIoo','segment','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Creating\x20segment\x20\x27','error','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','createSegment','folder','✔\x20Created\x20segment\x20\x27','\x27\x20with\x20ID:\x20','type','Parent\x20path:\x20','yellow','601161YgBKOt','execute','description','site','verbose','length','Resolved\x20relative\x20path\x20to:\x20'];a39_0x109b=function(){return _0x16f1ea;};return a39_0x109b();}const a39_0x115c26=a39_0x46be;(function(_0x174c7e,_0x397dd4){const _0x200ee2=a39_0x46be,_0x2c73bb=_0x174c7e();while(!![]){try{const _0x791d9f=-parseInt(_0x200ee2(0x1b5))/0x1+parseInt(_0x200ee2(0x1b3))/0x2+-parseInt(_0x200ee2(0x1a5))/0x3*(parseInt(_0x200ee2(0x18f))/0x4)+parseInt(_0x200ee2(0x197))/0x5+-parseInt(_0x200ee2(0x198))/0x6+parseInt(_0x200ee2(0x1ac))/0x7*(-parseInt(_0x200ee2(0x1b6))/0x8)+parseInt(_0x200ee2(0x1b7))/0x9;if(_0x791d9f===_0x397dd4)break;else _0x2c73bb['push'](_0x2c73bb['shift']());}catch(_0xb3d529){_0x2c73bb['push'](_0x2c73bb['shift']());}}}(a39_0x109b,0x385fa));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';function a39_0x46be(_0x2e20e3,_0x1cf1e8){_0x2e20e3=_0x2e20e3-0x188;const _0x109b9c=a39_0x109b();let _0x46be2b=_0x109b9c[_0x2e20e3];return _0x46be2b;}import a39_0x1485ef from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']=a39_0x115c26(0x18d);[a39_0x115c26(0x1a7)]='Create\x20child\x20segment\x20with\x20filtering\x20rules';async[a39_0x115c26(0x1a6)](_0x79a5cc){const _0x1ebdde=a39_0x115c26;console['error'](a39_0x1485ef['yellow'](_0x1ebdde(0x191))),console[_0x1ebdde(0x19c)](a39_0x1485ef[_0x1ebdde(0x1a4)](_0x1ebdde(0x19a)));const {options:_0x165f85,args:_0x353dcc,tdx:_0x2f595c}=_0x79a5cc,_0x51d756=_0x165f85;if(_0x353dcc[_0x1ebdde(0x1aa)]===0x0)return console[_0x1ebdde(0x19c)](_0x1ebdde(0x1ad)),console[_0x1ebdde(0x19c)](_0x1ebdde(0x1b1)),console[_0x1ebdde(0x19c)](_0x1ebdde(0x196)),console[_0x1ebdde(0x19c)](_0x1ebdde(0x192)),console[_0x1ebdde(0x19c)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console[_0x1ebdde(0x19c)](_0x1ebdde(0x1ba)),0x1;const _0x52e1c2=_0x353dcc[0x0],_0x706e33=_0x165f85[_0x1ebdde(0x18a)];let _0x693a5a=_0x52e1c2;_0x706e33&&!_0x52e1c2['includes']('/')&&(_0x693a5a=_0x706e33+'/'+_0x52e1c2,_0x51d756[_0x1ebdde(0x1a9)]&&console[_0x1ebdde(0x19c)](_0x1ebdde(0x1ab)+_0x693a5a));const _0x5986c1=parsePath(_0x693a5a);if(_0x5986c1[_0x1ebdde(0x190)]['length']<0x2)return console[_0x1ebdde(0x19c)]('Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'),console[_0x1ebdde(0x19c)]('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0xdebeb2=_0x5986c1[_0x1ebdde(0x190)][0x0],_0x5e3daa=getBaseName(_0x693a5a),_0x37565a=getParentPath(_0x693a5a);_0x51d756[_0x1ebdde(0x1a9)]&&(console[_0x1ebdde(0x19c)](_0x1ebdde(0x1b9)+_0x51d756[_0x1ebdde(0x1a8)]),console[_0x1ebdde(0x19c)]('Target\x20path:\x20'+_0x693a5a),console[_0x1ebdde(0x19c)]('Parent:\x20'+_0xdebeb2),console['error'](_0x1ebdde(0x18e)+_0x5e3daa),console['error'](_0x1ebdde(0x1a3)+_0x37565a));const _0x2602d4=await withSpinner(_0x1ebdde(0x189)+_0xdebeb2+_0x1ebdde(0x195),()=>_0x2f595c[_0x1ebdde(0x199)][_0x1ebdde(0x1b2)](_0xdebeb2),{'verbose':_0x51d756[_0x1ebdde(0x1a9)]}),_0x8d4d67=_0x2602d4[_0x1ebdde(0x18b)];let _0x11e997;if(_0x5986c1[_0x1ebdde(0x190)][_0x1ebdde(0x1aa)]>0x2){const _0x1be544=await withSpinner(_0x1ebdde(0x1b0)+_0x37565a+'\x27...',()=>_0x2f595c[_0x1ebdde(0x199)][_0x1ebdde(0x1b4)](_0x37565a),{'verbose':_0x51d756[_0x1ebdde(0x1a9)]}),_0x5c78fa=_0x1be544[_0x1ebdde(0x18b)];if(_0x5c78fa['type']!==_0x1ebdde(0x19f)&&_0x5c78fa[_0x1ebdde(0x1a2)]!==_0x1ebdde(0x18c))return console[_0x1ebdde(0x19c)](_0x1ebdde(0x19d)),0x1;_0x11e997=_0x5c78fa['folderId'];}else{if(_0x51d756[_0x1ebdde(0x19f)]){const _0x27d00d=await withSpinner(_0x1ebdde(0x193)+_0x51d756['folder']+_0x1ebdde(0x195),()=>_0x2f595c[_0x1ebdde(0x199)][_0x1ebdde(0x188)](_0x8d4d67,_0x51d756[_0x1ebdde(0x19f)]),{'verbose':_0x51d756[_0x1ebdde(0x1a9)]});_0x11e997=_0x27d00d['data'];}}_0x51d756['verbose']&&_0x11e997&&console[_0x1ebdde(0x19c)]('Resolved\x20folder\x20ID:\x20'+_0x11e997);const _0x1ce602=await loadJSONFromOptions(_0x51d756[_0x1ebdde(0x1b8)],_0x51d756['ruleFile']),_0x195073={'name':_0x5e3daa,'description':_0x51d756[_0x1ebdde(0x1a7)],'rule':_0x1ce602,'kind':_0x51d756[_0x1ebdde(0x1af)]!==undefined?parseInt(_0x51d756['kind'],0xa):undefined,'isVisible':_0x51d756['invisible']?![]:undefined,'segmentFolderId':_0x11e997,'countPopulation':_0x51d756[_0x1ebdde(0x1ae)]?![]:undefined},_0xfa0e9a=await withSpinner(_0x1ebdde(0x19b)+_0x5e3daa+_0x1ebdde(0x195),()=>_0x2f595c['segment'][_0x1ebdde(0x19e)](_0x8d4d67,_0x195073),{'verbose':_0x51d756['verbose']}),_0x28236c=_0xfa0e9a[_0x1ebdde(0x18b)];return console['error'](_0x1ebdde(0x1a0)+_0x28236c[_0x1ebdde(0x194)]+_0x1ebdde(0x1a1)+_0x28236c['id']),_0x693a5a!==_0x52e1c2&&console['error']('\x20\x20\x20Path:\x20'+_0x693a5a),await handleSDKOutput([_0x28236c],_0x51d756),0x0;}}
1
+ const a39_0x29f973=a39_0x221b;(function(_0x3795f2,_0x4fe440){const _0x41544d=a39_0x221b,_0x56db08=_0x3795f2();while(!![]){try{const _0x1ea82d=-parseInt(_0x41544d(0xfc))/0x1+-parseInt(_0x41544d(0xf3))/0x2*(parseInt(_0x41544d(0xdc))/0x3)+parseInt(_0x41544d(0xff))/0x4+-parseInt(_0x41544d(0xef))/0x5*(parseInt(_0x41544d(0x10b))/0x6)+-parseInt(_0x41544d(0x103))/0x7+-parseInt(_0x41544d(0xec))/0x8*(parseInt(_0x41544d(0xea))/0x9)+parseInt(_0x41544d(0xf7))/0xa;if(_0x1ea82d===_0x4fe440)break;else _0x56db08['push'](_0x56db08['shift']());}catch(_0xe979b){_0x56db08['push'](_0x56db08['shift']());}}}(a39_0x3b2d,0x3c646));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';function a39_0x221b(_0xb59788,_0x59ab6f){_0xb59788=_0xb59788-0xd5;const _0x3b2d08=a39_0x3b2d();let _0x221b76=_0x3b2d08[_0xb59788];return _0x221b76;}import a39_0x1bf031 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a39_0x29f973(0x100)]=a39_0x29f973(0xd7);['description']=a39_0x29f973(0xf9);async[a39_0x29f973(0xfe)](_0x2ef543){const _0x28fd23=a39_0x29f973;console[_0x28fd23(0xd5)](a39_0x1bf031[_0x28fd23(0xf0)]('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console['error'](a39_0x1bf031[_0x28fd23(0xf0)](_0x28fd23(0xed)));const {options:_0x1b67b5,args:_0x4debe2,tdx:_0x34d3b1}=_0x2ef543,_0x40066c=_0x1b67b5;if(_0x4debe2[_0x28fd23(0xda)]===0x0)return console[_0x28fd23(0xd5)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console['error'](_0x28fd23(0xe7)),console[_0x28fd23(0xd5)](_0x28fd23(0xfa)),console[_0x28fd23(0xd5)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console[_0x28fd23(0xd5)](_0x28fd23(0xe3)),console[_0x28fd23(0xd5)](_0x28fd23(0xf6)),0x1;const _0x21234c=_0x4debe2[0x0],_0x5985c4=_0x1b67b5[_0x28fd23(0x105)];let _0x22887f=_0x21234c;_0x5985c4&&!_0x21234c['includes']('/')&&(_0x22887f=_0x5985c4+'/'+_0x21234c,_0x40066c[_0x28fd23(0xd6)]&&console['error'](_0x28fd23(0xe2)+_0x22887f));const _0x20585a=parsePath(_0x22887f);if(_0x20585a[_0x28fd23(0xfb)][_0x28fd23(0xda)]<0x2)return console[_0x28fd23(0xd5)](_0x28fd23(0xee)),console['error'](_0x28fd23(0xe0)),0x1;const _0x36e6b8=_0x20585a[_0x28fd23(0xfb)][0x0],_0x4eba68=getBaseName(_0x22887f),_0xc65197=getParentPath(_0x22887f);_0x40066c[_0x28fd23(0xd6)]&&(console[_0x28fd23(0xd5)]('Site:\x20'+_0x40066c[_0x28fd23(0xf4)]),console['error']('Target\x20path:\x20'+_0x22887f),console[_0x28fd23(0xd5)](_0x28fd23(0xdb)+_0x36e6b8),console[_0x28fd23(0xd5)](_0x28fd23(0xd8)+_0x4eba68),console[_0x28fd23(0xd5)](_0x28fd23(0xe1)+_0xc65197));const _0x59c5cb=await withSpinner(_0x28fd23(0xdd)+_0x36e6b8+_0x28fd23(0xe5),()=>_0x34d3b1[_0x28fd23(0xf5)][_0x28fd23(0x102)](_0x36e6b8),{'verbose':_0x40066c[_0x28fd23(0xd6)]}),_0x446015=_0x59c5cb[_0x28fd23(0x108)];let _0x583139;if(_0x20585a[_0x28fd23(0xfb)][_0x28fd23(0xda)]>0x2){const _0x9a5ebd=await withSpinner(_0x28fd23(0x101)+_0xc65197+_0x28fd23(0xe5),()=>_0x34d3b1[_0x28fd23(0xf5)]['resolvePathToResource'](_0xc65197),{'verbose':_0x40066c[_0x28fd23(0xd6)]}),_0x224e3b=_0x9a5ebd[_0x28fd23(0x108)];if(_0x224e3b[_0x28fd23(0xf1)]!==_0x28fd23(0xd9)&&_0x224e3b[_0x28fd23(0xf1)]!==_0x28fd23(0x106))return console[_0x28fd23(0xd5)](_0x28fd23(0x10a)),0x1;_0x583139=_0x224e3b[_0x28fd23(0x109)];}else{if(_0x40066c[_0x28fd23(0xd9)]){const _0x33414b=await withSpinner(_0x28fd23(0x104)+_0x40066c[_0x28fd23(0xd9)]+_0x28fd23(0xe5),()=>_0x34d3b1[_0x28fd23(0xf5)][_0x28fd23(0xe8)](_0x446015,_0x40066c[_0x28fd23(0xd9)]),{'verbose':_0x40066c[_0x28fd23(0xd6)]});_0x583139=_0x33414b[_0x28fd23(0x108)];}}_0x40066c[_0x28fd23(0xd6)]&&_0x583139&&console['error'](_0x28fd23(0xe4)+_0x583139);const _0x4f822a=await loadJSONFromOptions(_0x40066c[_0x28fd23(0xde)],_0x40066c[_0x28fd23(0xdf)]),_0x122507={'name':_0x4eba68,'description':_0x40066c[_0x28fd23(0x107)],'rule':_0x4f822a,'kind':_0x40066c[_0x28fd23(0xe9)]!==undefined?parseInt(_0x40066c[_0x28fd23(0xe9)],0xa):undefined,'isVisible':_0x40066c[_0x28fd23(0xeb)]?![]:undefined,'segmentFolderId':_0x583139,'countPopulation':_0x40066c[_0x28fd23(0xf2)]?![]:undefined},_0x17a8c2=await withSpinner(_0x28fd23(0xf8)+_0x4eba68+'\x27...',()=>_0x34d3b1[_0x28fd23(0xf5)]['createSegment'](_0x446015,_0x122507),{'verbose':_0x40066c[_0x28fd23(0xd6)]}),_0x55e5a9=_0x17a8c2[_0x28fd23(0x108)];return console[_0x28fd23(0xd5)](_0x28fd23(0xfd)+_0x55e5a9[_0x28fd23(0x100)]+'\x27\x20with\x20ID:\x20'+_0x55e5a9['id']),_0x22887f!==_0x21234c&&console[_0x28fd23(0xd5)](_0x28fd23(0xe6)+_0x22887f),await handleSDKOutput([_0x55e5a9],_0x40066c),0x0;}}function a39_0x3b2d(){const _0x4b057e=['3evtPtA','Resolving\x20parent\x20segment\x20\x27','rule','ruleFile','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','Parent\x20path:\x20','Resolved\x20relative\x20path\x20to:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','Resolved\x20folder\x20ID:\x20','\x27...','\x20\x20\x20Path:\x20','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','resolveFolderId','kind','4743rhlFkB','invisible','3880pXRFKl','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','895670aPXNGr','yellow','type','noCountPopulation','249514syARve','site','segment','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','9631760UnzyjH','Creating\x20segment\x20\x27','Create\x20child\x20segment\x20with\x20filtering\x20rules','Examples:','segments','306449xzpxDb','✔\x20Created\x20segment\x20\x27','execute','1388472dKEXun','name','Resolving\x20folder\x20path\x20\x27','resolveParentId','1378951ipeunS','Resolving\x20folder\x20\x27','segmentPath','parent','description','data','folderId','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','6HJqzJU','error','verbose','segment:create','Segment\x20name:\x20','folder','length','Parent:\x20'];a39_0x3b2d=function(){return _0x4b057e;};return a39_0x3b2d();}
@@ -1 +1 @@
1
- const a40_0x2d08c9=a40_0x5a0a;(function(_0x1d381e,_0x222251){const _0x77e977=a40_0x5a0a,_0x11bd11=_0x1d381e();while(!![]){try{const _0x228d79=-parseInt(_0x77e977(0x104))/0x1+parseInt(_0x77e977(0x109))/0x2*(-parseInt(_0x77e977(0x117))/0x3)+parseInt(_0x77e977(0x115))/0x4*(-parseInt(_0x77e977(0x118))/0x5)+-parseInt(_0x77e977(0x110))/0x6*(-parseInt(_0x77e977(0x11c))/0x7)+parseInt(_0x77e977(0x10e))/0x8+parseInt(_0x77e977(0x10f))/0x9*(-parseInt(_0x77e977(0x106))/0xa)+parseInt(_0x77e977(0x116))/0xb;if(_0x228d79===_0x222251)break;else _0x11bd11['push'](_0x11bd11['shift']());}catch(_0x5b89ad){_0x11bd11['push'](_0x11bd11['shift']());}}}(a40_0x4a2e,0xa222d));function a40_0x5a0a(_0x2dc93f,_0x49cce3){_0x2dc93f=_0x2dc93f-0xff;const _0x4a2e25=a40_0x4a2e();let _0x5a0a56=_0x4a2e25[_0x2dc93f];return _0x5a0a56;}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 a40_0x4a2e(){const _0x536226=['json','33446iQXuzR','segment:fields','\x20field','length','\x27...','✔\x20Found\x20','64049EnCDLf','description','401330bLgudL','Site:\x20','name','1635966qoUQBq','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','error','Error:\x20Parent\x20segment\x20name\x20is\x20required','verbose','8755024VyJVAm','126Iqkrrt','1518TPGQTb','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','data','Listing\x20fields\x20for\x20\x27','parentSegment','132500VLhtdw','403326nJEEtT','3ZekDIn','35NnBbqw','jsonl','listFields'];a40_0x4a2e=function(){return _0x536226;};return a40_0x4a2e();}export class SegmentFieldsCommand extends BaseCommand{[a40_0x2d08c9(0x108)]=a40_0x2d08c9(0xff);[a40_0x2d08c9(0x105)]='List\x20available\x20fields\x20for\x20segmentation';async['execute'](_0x18fec1){const _0x9cce85=a40_0x2d08c9,{options:_0x1b9f1d,args:_0x370024,tdx:_0x18d13d}=_0x18fec1,_0x5ee3d6=_0x370024[0x0]||_0x1b9f1d[_0x9cce85(0x114)];if(!_0x5ee3d6)return console['error'](_0x9cce85(0x10c)),console[_0x9cce85(0x10b)](_0x9cce85(0x10a)),console['error'](_0x9cce85(0x111)),0x1;_0x1b9f1d[_0x9cce85(0x10d)]&&(console['error'](_0x9cce85(0x107)+_0x1b9f1d['site']),console[_0x9cce85(0x10b)]('Parent\x20segment:\x20'+_0x5ee3d6));const _0x3bdbf4=await withSpinner(_0x9cce85(0x113)+_0x5ee3d6+_0x9cce85(0x102),()=>_0x18d13d['segment'][_0x9cce85(0x11a)](_0x5ee3d6),{'verbose':_0x1b9f1d['verbose']}),_0x17cf96=_0x3bdbf4[_0x9cce85(0x112)];console[_0x9cce85(0x10b)](_0x9cce85(0x103)+_0x17cf96[_0x9cce85(0x101)]+_0x9cce85(0x100)+(_0x17cf96[_0x9cce85(0x101)]!==0x1?'s':''));if(_0x1b9f1d[_0x9cce85(0x11b)]||_0x1b9f1d[_0x9cce85(0x119)])return await handleSDKOutput(_0x17cf96,_0x1b9f1d),0x0;return displayFieldsHumanReadable(_0x17cf96,_0x5ee3d6),0x0;}}
1
+ const a40_0x902c3d=a40_0x40a4;(function(_0x54340e,_0x4c3e83){const _0x1d01f4=a40_0x40a4,_0x57da8f=_0x54340e();while(!![]){try{const _0x5626e4=-parseInt(_0x1d01f4(0x197))/0x1+parseInt(_0x1d01f4(0x195))/0x2+-parseInt(_0x1d01f4(0x19d))/0x3+-parseInt(_0x1d01f4(0x196))/0x4*(-parseInt(_0x1d01f4(0x194))/0x5)+-parseInt(_0x1d01f4(0x1ab))/0x6+-parseInt(_0x1d01f4(0x1aa))/0x7+parseInt(_0x1d01f4(0x19a))/0x8;if(_0x5626e4===_0x4c3e83)break;else _0x57da8f['push'](_0x57da8f['shift']());}catch(_0x2c02b6){_0x57da8f['push'](_0x57da8f['shift']());}}}(a40_0x37c5,0xb8959));import{BaseCommand}from'./command.js';function a40_0x37c5(){const _0x3e238e=['\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','\x20field','481852RuIBzu','3398424sZaAex','listFields','parentSegment','15XXJNgM','2822792hEfKBd','508708RrUdzW','887607vPHnkO','site','segment:fields','5906216DPnjMU','name','description','756900cSoTwx','segment','verbose','\x27...','Error:\x20Parent\x20segment\x20name\x20is\x20required','length','error','jsonl','✔\x20Found\x20','List\x20available\x20fields\x20for\x20segmentation','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'];a40_0x37c5=function(){return _0x3e238e;};return a40_0x37c5();}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a40_0x40a4(_0x5a6bdc,_0x2b7fda){_0x5a6bdc=_0x5a6bdc-0x192;const _0x37c585=a40_0x37c5();let _0x40a473=_0x37c585[_0x5a6bdc];return _0x40a473;}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a40_0x902c3d(0x19b)]=a40_0x902c3d(0x199);[a40_0x902c3d(0x19c)]=a40_0x902c3d(0x1a6);async['execute'](_0x36187e){const _0xf47d33=a40_0x902c3d,{options:_0x1abeb4,args:_0x15c7d9,tdx:_0x4d98c4}=_0x36187e,_0x2206cf=_0x15c7d9[0x0]||_0x1abeb4[_0xf47d33(0x193)];if(!_0x2206cf)return console['error'](_0xf47d33(0x1a1)),console[_0xf47d33(0x1a3)](_0xf47d33(0x1a7)),console[_0xf47d33(0x1a3)](_0xf47d33(0x1a8)),0x1;_0x1abeb4[_0xf47d33(0x19f)]&&(console[_0xf47d33(0x1a3)]('Site:\x20'+_0x1abeb4[_0xf47d33(0x198)]),console[_0xf47d33(0x1a3)]('Parent\x20segment:\x20'+_0x2206cf));const _0x34406d=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x2206cf+_0xf47d33(0x1a0),()=>_0x4d98c4[_0xf47d33(0x19e)][_0xf47d33(0x192)](_0x2206cf),{'verbose':_0x1abeb4[_0xf47d33(0x19f)]}),_0x328cc5=_0x34406d['data'];console[_0xf47d33(0x1a3)](_0xf47d33(0x1a5)+_0x328cc5[_0xf47d33(0x1a2)]+_0xf47d33(0x1a9)+(_0x328cc5['length']!==0x1?'s':''));if(_0x1abeb4['json']||_0x1abeb4[_0xf47d33(0x1a4)])return await handleSDKOutput(_0x328cc5,_0x1abeb4),0x0;return displayFieldsHumanReadable(_0x328cc5,_0x2206cf),0x0;}}