@treasuredata/tdx 2026.8.4 → 2026.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/cas-command.js +1 -1
  11. package/dist/commands/cas-segment-command.d.ts.map +1 -1
  12. package/dist/commands/cas-segment-command.js +1 -1
  13. package/dist/commands/cas-segment-command.js.map +1 -1
  14. package/dist/commands/chat-command.js +1 -1
  15. package/dist/commands/claude-command.js +1 -1
  16. package/dist/commands/claude-statusline-command.js +1 -1
  17. package/dist/commands/claude-usage-command.js +1 -1
  18. package/dist/commands/command.js +1 -1
  19. package/dist/commands/connection-command.js +1 -1
  20. package/dist/commands/databases.js +1 -1
  21. package/dist/commands/delivery-command.js +1 -1
  22. package/dist/commands/describe.js +1 -1
  23. package/dist/commands/engage-always-on-campaign-pull-command.js +1 -1
  24. package/dist/commands/engage-always-on-campaign-push-command.js +1 -1
  25. package/dist/commands/engage-always-on-campaign-validate-command.js +1 -1
  26. package/dist/commands/engage-campaign-pull-command.js +1 -1
  27. package/dist/commands/engage-campaign-push-command.js +1 -1
  28. package/dist/commands/engage-campaign-validate-command.js +1 -1
  29. package/dist/commands/engage-command.js +1 -1
  30. package/dist/commands/engage-template-pull-command.js +1 -1
  31. package/dist/commands/engage-template-push-command.js +1 -1
  32. package/dist/commands/engage-template-validate-command.js +1 -1
  33. package/dist/commands/job-command.js +1 -1
  34. package/dist/commands/journey-command.js +1 -1
  35. package/dist/commands/journey-validate-command.js +1 -1
  36. package/dist/commands/llm-command.js +1 -1
  37. package/dist/commands/mcp-command.js +1 -1
  38. package/dist/commands/p13n-command.js +1 -1
  39. package/dist/commands/parent-segment-command.js +1 -1
  40. package/dist/commands/policy-command.js +1 -1
  41. package/dist/commands/profile-command.js +1 -1
  42. package/dist/commands/profiles-command.js +1 -1
  43. package/dist/commands/query-command.js +1 -1
  44. package/dist/commands/schedule-command.js +1 -1
  45. package/dist/commands/segment-command.js +1 -1
  46. package/dist/commands/segment-create-command.js +1 -1
  47. package/dist/commands/segment-fields-command.js +1 -1
  48. package/dist/commands/segment-move-command.js +1 -1
  49. package/dist/commands/segment-pull-command.js +1 -1
  50. package/dist/commands/segment-push-command.js +1 -1
  51. package/dist/commands/segment-update-command.js +1 -1
  52. package/dist/commands/segment-use-command.js +1 -1
  53. package/dist/commands/segment-validate-command.js +1 -1
  54. package/dist/commands/segments.js +1 -1
  55. package/dist/commands/show.js +1 -1
  56. package/dist/commands/status-command.js +1 -1
  57. package/dist/commands/table-deleted.js +1 -1
  58. package/dist/commands/tables.js +1 -1
  59. package/dist/commands/unset-command.js +1 -1
  60. package/dist/commands/upgrade-command.js +1 -1
  61. package/dist/commands/use-command.js +1 -1
  62. package/dist/commands/user-command.js +1 -1
  63. package/dist/commands/work-command.js +1 -1
  64. package/dist/commands/workflow-command.js +1 -1
  65. package/dist/core/auth.js +1 -1
  66. package/dist/core/command-output.js +1 -1
  67. package/dist/core/config.js +1 -1
  68. package/dist/core/connection-cache.js +1 -1
  69. package/dist/core/constants.js +1 -1
  70. package/dist/core/credential-cache.js +1 -1
  71. package/dist/core/global-context.js +1 -1
  72. package/dist/core/keychain.js +1 -1
  73. package/dist/core/oauth-keychain.js +1 -1
  74. package/dist/core/oauth.js +1 -1
  75. package/dist/core/profile.js +1 -1
  76. package/dist/core/project-config.js +1 -1
  77. package/dist/core/session.js +1 -1
  78. package/dist/core/site-mismatch.js +1 -1
  79. package/dist/core/user-cache.js +1 -1
  80. package/dist/core/version.js +1 -1
  81. package/dist/index.js +1 -1
  82. package/dist/mcp/server.js +1 -1
  83. package/dist/mcp/tools/index.js +1 -1
  84. package/dist/mcp/tools/tdx-run.js +1 -1
  85. package/dist/mcp/tools/tdx-search.js +1 -1
  86. package/dist/mcp/tools/work-create-item.js +1 -1
  87. package/dist/mcp/utils.js +1 -1
  88. package/dist/proxy/claude-usage-tracker.js +1 -1
  89. package/dist/proxy/passthrough-server.js +1 -1
  90. package/dist/proxy/sse-usage-parser.js +1 -1
  91. package/dist/sdk/agent/agent-config.js +1 -1
  92. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  93. package/dist/sdk/agent/agent-yaml.js +1 -1
  94. package/dist/sdk/agent/test/evaluator.js +1 -1
  95. package/dist/sdk/agent/test/executor.js +1 -1
  96. package/dist/sdk/agent/test/index.js +1 -1
  97. package/dist/sdk/agent/test/output.js +1 -1
  98. package/dist/sdk/agent/test/parser.js +1 -1
  99. package/dist/sdk/agent/tool-target-registry.js +1 -1
  100. package/dist/sdk/api.js +1 -1
  101. package/dist/sdk/auth-token.js +1 -1
  102. package/dist/sdk/cas/cas-api-client.js +1 -1
  103. package/dist/sdk/cas/cas-audience-schema.js +1 -1
  104. package/dist/sdk/cas/cas-audience-validator.js +1 -1
  105. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  106. package/dist/sdk/cas/cas-segment-schema.d.ts +63 -0
  107. package/dist/sdk/cas/cas-segment-schema.d.ts.map +1 -0
  108. package/dist/sdk/cas/cas-segment-schema.js +1 -0
  109. package/dist/sdk/cas/cas-segment-schema.js.map +1 -0
  110. package/dist/sdk/cas/cas-segment-validator.d.ts +76 -0
  111. package/dist/sdk/cas/cas-segment-validator.d.ts.map +1 -0
  112. package/dist/sdk/cas/cas-segment-validator.js +1 -0
  113. package/dist/sdk/cas/cas-segment-validator.js.map +1 -0
  114. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  115. package/dist/sdk/cas/index.js +1 -1
  116. package/dist/sdk/cas/pull-workflow.js +1 -1
  117. package/dist/sdk/cas/push-workflow.js +1 -1
  118. package/dist/sdk/cas/validate-files.d.ts +23 -6
  119. package/dist/sdk/cas/validate-files.d.ts.map +1 -1
  120. package/dist/sdk/cas/validate-files.js +1 -1
  121. package/dist/sdk/cas/validate-files.js.map +1 -1
  122. package/dist/sdk/client/cdp-api-client.js +1 -1
  123. package/dist/sdk/client/delivery-api-client.js +1 -1
  124. package/dist/sdk/client/endpoints.js +1 -1
  125. package/dist/sdk/client/engage-api-client.js +1 -1
  126. package/dist/sdk/client/http-client.js +1 -1
  127. package/dist/sdk/client/llm-api-client.js +1 -1
  128. package/dist/sdk/client/oauth-refresh.js +1 -1
  129. package/dist/sdk/client/p13n-studio-api-client.js +1 -1
  130. package/dist/sdk/client/rate-limiter.js +1 -1
  131. package/dist/sdk/client/td-api-client.js +1 -1
  132. package/dist/sdk/client/trino-api-client.js +1 -1
  133. package/dist/sdk/client/workflow-client.js +1 -1
  134. package/dist/sdk/connection-validator.js +1 -1
  135. package/dist/sdk/connection.js +1 -1
  136. package/dist/sdk/delivery.js +1 -1
  137. package/dist/sdk/engage/always-on-campaign-pull.js +1 -1
  138. package/dist/sdk/engage/always-on-campaign-push.js +1 -1
  139. package/dist/sdk/engage/always-on-campaign-validator.js +1 -1
  140. package/dist/sdk/engage/always-on-campaign-yaml.js +1 -1
  141. package/dist/sdk/engage/campaign-pull.js +1 -1
  142. package/dist/sdk/engage/campaign-push.js +1 -1
  143. package/dist/sdk/engage/campaign-validator.js +1 -1
  144. package/dist/sdk/engage/campaign-yaml.js +1 -1
  145. package/dist/sdk/engage/template-pull.js +1 -1
  146. package/dist/sdk/engage/template-push.js +1 -1
  147. package/dist/sdk/engage/template-validator.js +1 -1
  148. package/dist/sdk/engage/template-yaml.js +1 -1
  149. package/dist/sdk/engage/types/always-on-campaign-schema.js +1 -1
  150. package/dist/sdk/engage/types/campaign-def.js +1 -1
  151. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  152. package/dist/sdk/engage/types/template-schema.js +1 -1
  153. package/dist/sdk/engage.js +1 -1
  154. package/dist/sdk/errors.js +1 -1
  155. package/dist/sdk/index.js +1 -1
  156. package/dist/sdk/io/index.js +1 -1
  157. package/dist/sdk/io/node-filesystem.js +1 -1
  158. package/dist/sdk/job.js +1 -1
  159. package/dist/sdk/journey.js +1 -1
  160. package/dist/sdk/llm/chat-cache.js +1 -1
  161. package/dist/sdk/llm/index.js +1 -1
  162. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  163. package/dist/sdk/llm/model-factors.js +1 -1
  164. package/dist/sdk/llm/user-settings.js +1 -1
  165. package/dist/sdk/p13n-studio.js +1 -1
  166. package/dist/sdk/personalization.js +1 -1
  167. package/dist/sdk/policy.js +1 -1
  168. package/dist/sdk/query/deleted-table-validation.js +1 -1
  169. package/dist/sdk/query/index.js +1 -1
  170. package/dist/sdk/query/sql-parser.js +1 -1
  171. package/dist/sdk/realtime.js +1 -1
  172. package/dist/sdk/schedule.js +1 -1
  173. package/dist/sdk/segment/child-segment-yaml.d.ts.map +1 -1
  174. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  175. package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
  176. package/dist/sdk/segment/fields-display.js +1 -1
  177. package/dist/sdk/segment/file-discovery.js +1 -1
  178. package/dist/sdk/segment/journey-utils.js +1 -1
  179. package/dist/sdk/segment/journey-validator.js +1 -1
  180. package/dist/sdk/segment/journey-yaml.js +1 -1
  181. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  182. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  183. package/dist/sdk/segment/pull-workflow.js +1 -1
  184. package/dist/sdk/segment/push-recovery.js +1 -1
  185. package/dist/sdk/segment/push-workflow.js +1 -1
  186. package/dist/sdk/segment/resolution-context.js +1 -1
  187. package/dist/sdk/segment/segment-path-parser.js +1 -1
  188. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  189. package/dist/sdk/segment/segment-validator.js +1 -1
  190. package/dist/sdk/segment/target-resolution.js +1 -1
  191. package/dist/sdk/segment/tdx-config.js +1 -1
  192. package/dist/sdk/segment/types/activation-schema.js +1 -1
  193. package/dist/sdk/segment/types/journey-def.js +1 -1
  194. package/dist/sdk/segment/types/journey-schema.js +1 -1
  195. package/dist/sdk/segment/types/segment-def.js +1 -1
  196. package/dist/sdk/segment/types/segment-schema.d.ts.map +1 -1
  197. package/dist/sdk/segment/types/segment-schema.js +1 -1
  198. package/dist/sdk/segment/types/segment-schema.js.map +1 -1
  199. package/dist/sdk/segment/validate-files.js +1 -1
  200. package/dist/sdk/segment/yaml-validator.d.ts +1 -1
  201. package/dist/sdk/segment/yaml-validator.d.ts.map +1 -1
  202. package/dist/sdk/segment/yaml-validator.js +1 -1
  203. package/dist/sdk/segment/yaml-validator.js.map +1 -1
  204. package/dist/sdk/segment.js +1 -1
  205. package/dist/sdk/types/index.js +1 -1
  206. package/dist/sdk/types/progress.js +1 -1
  207. package/dist/sdk/types/workspace.js +1 -1
  208. package/dist/sdk/user.js +1 -1
  209. package/dist/sdk/util/format-detector.js +1 -1
  210. package/dist/sdk/util/formatters.js +1 -1
  211. package/dist/sdk/util/index.js +1 -1
  212. package/dist/sdk/util/paginate.js +1 -1
  213. package/dist/sdk/util/tree-formatter.js +1 -1
  214. package/dist/sdk/util/tree-search.js +1 -1
  215. package/dist/sdk/workflow/archive-validation.js +1 -1
  216. package/dist/sdk/workflow/clone-workflow.js +1 -1
  217. package/dist/sdk/workflow/index.js +1 -1
  218. package/dist/sdk/workflow/pull-workflow.js +1 -1
  219. package/dist/sdk/workflow/push-workflow.js +1 -1
  220. package/dist/sdk/workflow/task-graph.js +1 -1
  221. package/dist/sdk/workflow/tdx-config.js +1 -1
  222. package/dist/sdk/workflow/workflow-utils.js +1 -1
  223. package/dist/sdk/workspace/access-tracker.js +1 -1
  224. package/dist/sdk/workspace/frontmatter.js +1 -1
  225. package/dist/sdk/workspace/git.js +1 -1
  226. package/dist/sdk/workspace/index.js +1 -1
  227. package/dist/sdk/workspace/templates.js +1 -1
  228. package/dist/sdk/workspace/weekly.js +1 -1
  229. package/dist/sdk/workspace/wikilinks.js +1 -1
  230. package/dist/test-utils/command-runner.js +1 -1
  231. package/dist/test-utils/factories.js +1 -1
  232. package/dist/test-utils/fixtures.js +1 -1
  233. package/dist/test-utils/http-mock.js +1 -1
  234. package/dist/test-utils/index.js +1 -1
  235. package/dist/utils/async.js +1 -1
  236. package/dist/utils/claude-code-state.js +1 -1
  237. package/dist/utils/colors.js +1 -1
  238. package/dist/utils/diff.js +1 -1
  239. package/dist/utils/file-permissions.js +1 -1
  240. package/dist/utils/file-reader.js +1 -1
  241. package/dist/utils/github-releases.js +1 -1
  242. package/dist/utils/global-cache.js +1 -1
  243. package/dist/utils/json-loader.js +1 -1
  244. package/dist/utils/local-cache.js +1 -1
  245. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  246. package/dist/utils/logger/formatters/index.js +1 -1
  247. package/dist/utils/logger/handlers/console-handler.js +1 -1
  248. package/dist/utils/logger/handlers/file-handler.js +1 -1
  249. package/dist/utils/logger/handlers/index.js +1 -1
  250. package/dist/utils/logger/handlers/null-handler.js +1 -1
  251. package/dist/utils/logger/index.js +1 -1
  252. package/dist/utils/logger/logger.js +1 -1
  253. package/dist/utils/logger/types.js +1 -1
  254. package/dist/utils/option-validation.js +1 -1
  255. package/dist/utils/process.js +1 -1
  256. package/dist/utils/prompt.js +1 -1
  257. package/dist/utils/proxy-fetch.js +1 -1
  258. package/dist/utils/spinner.js +1 -1
  259. package/dist/utils/sse-parser.js +1 -1
  260. package/dist/utils/string-utils.js +1 -1
  261. package/dist/utils/table-ref-parser.js +1 -1
  262. package/dist/utils/tdx-logger.js +1 -1
  263. package/dist/utils/version-check.js +1 -1
  264. package/package.json +1 -1
@@ -1 +1 @@
1
- const a36_0x5333b2=a36_0x4000;function a36_0x4000(_0x265837,_0x2d75b9){_0x265837=_0x265837-0x17e;const _0x4f14b2=a36_0x4f14();let _0x40000f=_0x4f14b2[_0x265837];return _0x40000f;}(function(_0x2aab17,_0x11be36){const _0x11957c=a36_0x4000,_0x51f464=_0x2aab17();while(!![]){try{const _0x35342c=-parseInt(_0x11957c(0x186))/0x1+-parseInt(_0x11957c(0x1b0))/0x2*(-parseInt(_0x11957c(0x17f))/0x3)+parseInt(_0x11957c(0x1b1))/0x4*(parseInt(_0x11957c(0x19b))/0x5)+-parseInt(_0x11957c(0x184))/0x6+parseInt(_0x11957c(0x187))/0x7+-parseInt(_0x11957c(0x1a5))/0x8*(-parseInt(_0x11957c(0x1ae))/0x9)+parseInt(_0x11957c(0x1a9))/0xa*(parseInt(_0x11957c(0x198))/0xb);if(_0x35342c===_0x11be36)break;else _0x51f464['push'](_0x51f464['shift']());}catch(_0x258f72){_0x51f464['push'](_0x51f464['shift']());}}}(a36_0x4f14,0xcc66e));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a36_0x26e563 from'chalk';function a36_0x4f14(){const _0x22c4b0=['context','description','execute','No\x20policies\x20found','getMyPermissions','name','length','entries','👥\x20Assigned\x20Users','account_owner','args',',\x20user_id:','\x20\x20No\x20permissions','verbose','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','padEnd','16013591cDKEps','policy','all','5GVjomB','administrator','Administrator','map','\x20\x20•\x20','\x20\x20No\x20policies\x20assigned','🔑\x20Effective\x20Permissions','Listing\x20policies...','dim','max','14752XMvCwJ','listPolicies','bold','policies','10hFIJIq','Fetching\x20permissions...','email','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','\x20\x20\x20','1332tKmMUN','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','1676490oLUGLy','500228xDXXCK','join','getPolicy','log','data','user','Member','permissions','3hvJTIM','account_id','getPolicyPermissions','policy\x20list','Fetching\x20policy...','8915214KwuTwZ','validate','900310yYDmIS','3719898XLnigC'];a36_0x4f14=function(){return _0x22c4b0;};return a36_0x4f14();}export class PolicyCommand extends BaseCommand{[a36_0x5333b2(0x18d)]='policy';[a36_0x5333b2(0x189)]=a36_0x5333b2(0x1af);async[a36_0x5333b2(0x18a)](_0x1b2ae7){const _0x1c485f=a36_0x5333b2,{options:_0x29a040,tdx:_0x1a54ba}=_0x1b2ae7,_0x531aac=await withSpinner(_0x1c485f(0x1aa),async()=>{const _0xb45603=_0x1c485f,[_0x3c6aa4,_0x33b9c9]=await Promise[_0xb45603(0x19a)]([_0x1a54ba[_0xb45603(0x1b6)]['getCurrent'](),_0x1a54ba[_0xb45603(0x199)][_0xb45603(0x18c)]()]);return{'userInfo':_0x3c6aa4,'permissions':_0x33b9c9};},{'verbose':_0x29a040['verbose']}),{userInfo:_0x3eaf9a,permissions:_0x511585}=_0x531aac[_0x1c485f(0x1b5)];if(isStructuredFormat(_0x29a040))return await handleSingleObjectOutput(_0x511585,_0x29a040),0x0;const _0x12799c=_0x3eaf9a[_0x1c485f(0x191)]?'Account\x20Owner':_0x3eaf9a[_0x1c485f(0x19c)]?_0x1c485f(0x19d):_0x1c485f(0x1b7);console[_0x1c485f(0x1b4)]('\x0a'+a36_0x26e563[_0x1c485f(0x1a7)]('👤')+'\x20'+a36_0x26e563['bold'](_0x3eaf9a[_0x1c485f(0x18d)])+'\x20'+a36_0x26e563[_0x1c485f(0x1a3)]('('+_0x3eaf9a[_0x1c485f(0x1ab)]+')')+'\x20—\x20'+_0x12799c),console[_0x1c485f(0x1b4)](a36_0x26e563[_0x1c485f(0x1a3)]('\x20\x20\x20'+_0x1a54ba[_0x1c485f(0x188)]['site']+':'+_0x3eaf9a[_0x1c485f(0x180)]+_0x1c485f(0x193)+_0x3eaf9a['id']));const _0x3565cb=_0x511585[_0x1c485f(0x1a8)];console[_0x1c485f(0x1b4)]('\x0a'+a36_0x26e563[_0x1c485f(0x1a7)]('📋\x20Assigned\x20Policies')+'\x20('+_0x3565cb[_0x1c485f(0x18e)]+'):');if(_0x3565cb[_0x1c485f(0x18e)]===0x0)console[_0x1c485f(0x1b4)](a36_0x26e563[_0x1c485f(0x1a3)](_0x1c485f(0x1a0)));else for(const _0x548bed of _0x3565cb){console[_0x1c485f(0x1b4)](_0x1c485f(0x19f)+_0x548bed[_0x1c485f(0x18d)]);}return printPermissionsMap(_0x511585[_0x1c485f(0x17e)]),console['log'](),0x0;}}export class PolicyListCommand extends BaseCommand{[a36_0x5333b2(0x18d)]=a36_0x5333b2(0x182);[a36_0x5333b2(0x189)]=a36_0x5333b2(0x196);async[a36_0x5333b2(0x18a)](_0x5c0d57){const _0xd7f34f=a36_0x5333b2,{options:_0x1068d9,tdx:_0x387532}=_0x5c0d57,_0x33a2=await withSpinner(_0xd7f34f(0x1a2),()=>_0x387532[_0xd7f34f(0x199)][_0xd7f34f(0x1a6)](),{'verbose':_0x1068d9['verbose']}),_0x1ab1b8=_0x33a2[_0xd7f34f(0x1b5)];console['error']('✔\x20Found\x20'+_0x1ab1b8[_0xd7f34f(0x18e)]+'\x20polic'+(_0x1ab1b8[_0xd7f34f(0x18e)]!==0x1?'ies':'y'));if(isStructuredFormat(_0x1068d9))return await handleSDKOutput(_0x1ab1b8,_0x1068d9),0x0;if(_0x1ab1b8[_0xd7f34f(0x18e)]===0x0)console[_0xd7f34f(0x1b4)](a36_0x26e563[_0xd7f34f(0x1a3)](_0xd7f34f(0x18b)));else for(const _0x4b783e of _0x1ab1b8){const _0x415d1d=_0x4b783e[_0xd7f34f(0x189)]?a36_0x26e563['dim']('\x20—\x20'+_0x4b783e['description']):'';console[_0xd7f34f(0x1b4)](_0xd7f34f(0x19f)+_0x4b783e[_0xd7f34f(0x18d)]+_0x415d1d);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a36_0x5333b2(0x18d)]='policy\x20show';['description']=a36_0x5333b2(0x1ac);[a36_0x5333b2(0x185)](_0x5b6ff7){if(_0x5b6ff7['args']['length']===0x0)return'Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>';return undefined;}async[a36_0x5333b2(0x18a)](_0x52b374){const _0x954397=a36_0x5333b2,{options:_0x473baf,tdx:_0x23dec2}=_0x52b374,_0x429480=_0x52b374[_0x954397(0x192)][0x0],_0x406448=await withSpinner(_0x954397(0x183),async()=>{const _0x1e09bc=_0x954397,_0x74b523=await _0x23dec2[_0x1e09bc(0x199)][_0x1e09bc(0x1b3)](_0x429480),[_0x3298cc,_0x5b93b0]=await Promise[_0x1e09bc(0x19a)]([_0x23dec2[_0x1e09bc(0x199)][_0x1e09bc(0x181)](_0x74b523['id']),_0x23dec2[_0x1e09bc(0x199)]['getPolicyUsers'](_0x74b523['id'])]);return{'policy':_0x74b523,'perms':_0x3298cc,'users':_0x5b93b0};},{'verbose':_0x473baf[_0x954397(0x195)]}),{policy:_0x49714f,perms:_0x2de935,users:_0x5e9ef5}=_0x406448[_0x954397(0x1b5)];if(isStructuredFormat(_0x473baf))return await handleSingleObjectOutput({..._0x49714f,'permissions':_0x2de935[_0x954397(0x17e)],'users':_0x5e9ef5},_0x473baf),0x0;console[_0x954397(0x1b4)]('\x0a'+a36_0x26e563[_0x954397(0x1a7)]('📋')+'\x20'+a36_0x26e563[_0x954397(0x1a7)](_0x49714f[_0x954397(0x18d)])+'\x20'+a36_0x26e563[_0x954397(0x1a3)]('(ID:\x20'+_0x49714f['id']+')'));_0x49714f[_0x954397(0x189)]&&console[_0x954397(0x1b4)](_0x954397(0x1ad)+a36_0x26e563[_0x954397(0x1a3)](_0x49714f[_0x954397(0x189)]));console[_0x954397(0x1b4)](_0x954397(0x1ad)+_0x5e9ef5['length']+'\x20user'+(_0x5e9ef5[_0x954397(0x18e)]!==0x1?'s':'')+'\x20assigned'),printPermissionsMap(_0x2de935[_0x954397(0x17e)]);if(_0x5e9ef5[_0x954397(0x18e)]>0x0){console[_0x954397(0x1b4)]('\x0a'+a36_0x26e563[_0x954397(0x1a7)](_0x954397(0x190))+':');for(const _0x4fc475 of _0x5e9ef5){const _0x21ca79=_0x4fc475[_0x954397(0x1ab)]&&_0x4fc475['email']!==_0x4fc475[_0x954397(0x18d)]?a36_0x26e563[_0x954397(0x1a3)]('\x20<'+_0x4fc475[_0x954397(0x1ab)]+'>'):'';console['log'](_0x954397(0x19f)+_0x4fc475[_0x954397(0x18d)]+_0x21ca79);}}return console['log'](),0x0;}}function printPermissionsMap(_0x50472f){const _0x13a6c1=a36_0x5333b2,_0x392525=Object[_0x13a6c1(0x18f)](_0x50472f);console[_0x13a6c1(0x1b4)]('\x0a'+a36_0x26e563[_0x13a6c1(0x1a7)](_0x13a6c1(0x1a1))+':');if(_0x392525[_0x13a6c1(0x18e)]===0x0){console[_0x13a6c1(0x1b4)](a36_0x26e563[_0x13a6c1(0x1a3)](_0x13a6c1(0x194)));return;}const _0xb54386=Math[_0x13a6c1(0x1a4)](..._0x392525[_0x13a6c1(0x19e)](([_0x19d1bf])=>_0x19d1bf[_0x13a6c1(0x18e)]));for(const [_0x5725bb,_0x24998d]of _0x392525){const _0x2e3a8a=formatOperations(_0x24998d);console['log']('\x20\x20'+_0x5725bb[_0x13a6c1(0x197)](_0xb54386+0x2)+_0x2e3a8a);}}function formatOperations(_0x5728bb){const _0x3d7076=a36_0x5333b2,_0x13af56=[...new Set(_0x5728bb[_0x3d7076(0x19e)](_0x45a988=>_0x45a988['operation']))];return _0x13af56[_0x3d7076(0x1b2)](',\x20');}
1
+ const a36_0x23b0c8=a36_0x59f1;(function(_0xc51394,_0x544ef3){const _0x5bc7fc=a36_0x59f1,_0xddb1f8=_0xc51394();while(!![]){try{const _0x440e35=parseInt(_0x5bc7fc(0xe6))/0x1*(-parseInt(_0x5bc7fc(0x112))/0x2)+-parseInt(_0x5bc7fc(0x114))/0x3+-parseInt(_0x5bc7fc(0x120))/0x4*(parseInt(_0x5bc7fc(0x102))/0x5)+parseInt(_0x5bc7fc(0xeb))/0x6*(parseInt(_0x5bc7fc(0x10b))/0x7)+-parseInt(_0x5bc7fc(0xf5))/0x8*(parseInt(_0x5bc7fc(0x10e))/0x9)+parseInt(_0x5bc7fc(0x10a))/0xa+parseInt(_0x5bc7fc(0xef))/0xb*(parseInt(_0x5bc7fc(0x101))/0xc);if(_0x440e35===_0x544ef3)break;else _0xddb1f8['push'](_0xddb1f8['shift']());}catch(_0x38f609){_0xddb1f8['push'](_0xddb1f8['shift']());}}}(a36_0xbc79,0xe9f11));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';function a36_0x59f1(_0x2cecf2,_0x2ddf17){_0x2cecf2=_0x2cecf2-0xe2;const _0xbc792f=a36_0xbc79();let _0x59f19c=_0xbc792f[_0x2cecf2];return _0x59f19c;}import{withSpinner}from'../utils/spinner.js';import a36_0xc0c3bd from'chalk';export class PolicyCommand extends BaseCommand{['name']=a36_0x23b0c8(0x11b);['description']=a36_0x23b0c8(0x107);async[a36_0x23b0c8(0xec)](_0x26c179){const _0x1509d5=a36_0x23b0c8,{options:_0x435e63,tdx:_0x341c40}=_0x26c179,_0x515db5=await withSpinner(_0x1509d5(0xf0),async()=>{const _0x451539=_0x1509d5,[_0x470484,_0x45739a]=await Promise[_0x451539(0xea)]([_0x341c40[_0x451539(0xe7)][_0x451539(0xfe)](),_0x341c40[_0x451539(0x11b)][_0x451539(0xff)]()]);return{'userInfo':_0x470484,'permissions':_0x45739a};},{'verbose':_0x435e63[_0x1509d5(0xe2)]}),{userInfo:_0x3b40ef,permissions:_0x3f66ba}=_0x515db5[_0x1509d5(0x118)];if(isStructuredFormat(_0x435e63))return await handleSingleObjectOutput(_0x3f66ba,_0x435e63),0x0;const _0x1794e7=_0x3b40ef[_0x1509d5(0xe8)]?_0x1509d5(0x109):_0x3b40ef[_0x1509d5(0x11d)]?_0x1509d5(0x10c):_0x1509d5(0xf9);console[_0x1509d5(0x11e)]('\x0a'+a36_0xc0c3bd['bold']('👤')+'\x20'+a36_0xc0c3bd[_0x1509d5(0x11a)](_0x3b40ef[_0x1509d5(0xf8)])+'\x20'+a36_0xc0c3bd['dim']('('+_0x3b40ef[_0x1509d5(0x105)]+')')+_0x1509d5(0x106)+_0x1794e7),console['log'](a36_0xc0c3bd[_0x1509d5(0x110)]('\x20\x20\x20'+_0x341c40[_0x1509d5(0xfd)][_0x1509d5(0xee)]+':'+_0x3b40ef[_0x1509d5(0x113)]+_0x1509d5(0x123)+_0x3b40ef['id']));const _0x46bc85=_0x3f66ba['policies'];console[_0x1509d5(0x11e)]('\x0a'+a36_0xc0c3bd[_0x1509d5(0x11a)](_0x1509d5(0x11c))+'\x20('+_0x46bc85[_0x1509d5(0xf4)]+'):');if(_0x46bc85[_0x1509d5(0xf4)]===0x0)console[_0x1509d5(0x11e)](a36_0xc0c3bd[_0x1509d5(0x110)](_0x1509d5(0x121)));else for(const _0x5f0617 of _0x46bc85){console[_0x1509d5(0x11e)]('\x20\x20•\x20'+_0x5f0617[_0x1509d5(0xf8)]);}return printPermissionsMap(_0x3f66ba[_0x1509d5(0x10f)]),console['log'](),0x0;}}export class PolicyListCommand extends BaseCommand{['name']='policy\x20list';[a36_0x23b0c8(0xfb)]=a36_0x23b0c8(0x122);async['execute'](_0x58abc3){const _0x570788=a36_0x23b0c8,{options:_0x40e2df,tdx:_0x144d10}=_0x58abc3,_0x30cd50=await withSpinner(_0x570788(0x108),()=>_0x144d10[_0x570788(0x11b)][_0x570788(0x100)](),{'verbose':_0x40e2df[_0x570788(0xe2)]}),_0x39d56d=_0x30cd50[_0x570788(0x118)];console['error'](_0x570788(0x10d)+_0x39d56d[_0x570788(0xf4)]+_0x570788(0xf1)+(_0x39d56d[_0x570788(0xf4)]!==0x1?_0x570788(0xe9):'y'));if(isStructuredFormat(_0x40e2df))return await handleSDKOutput(_0x39d56d,_0x40e2df),0x0;if(_0x39d56d[_0x570788(0xf4)]===0x0)console[_0x570788(0x11e)](a36_0xc0c3bd[_0x570788(0x110)]('No\x20policies\x20found'));else for(const _0x4f3496 of _0x39d56d){const _0x436dba=_0x4f3496[_0x570788(0xfb)]?a36_0xc0c3bd[_0x570788(0x110)](_0x570788(0x106)+_0x4f3496['description']):'';console[_0x570788(0x11e)](_0x570788(0x115)+_0x4f3496[_0x570788(0xf8)]+_0x436dba);}return 0x0;}}function a36_0xbc79(){const _0x3c40fd=['all','217182AWSkjh','execute','args','site','410179BxKUTM','Fetching\x20permissions...','\x20polic','\x20\x20No\x20permissions','operation','length','4798696oxrVFm','join','getPolicy','name','Member','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','description','map','context','getCurrent','getMyPermissions','listPolicies','672WbWnNj','943145JOiFTd','\x20\x20\x20','🔑\x20Effective\x20Permissions','email','\x20—\x20','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','Listing\x20policies...','Account\x20Owner','16565420giUAln','140AeGXRn','Administrator','✔\x20Found\x20','27BZhgYi','permissions','dim','getPolicyPermissions','14KPYSjO','account_id','2478390IlJYZe','\x20\x20•\x20','\x20assigned','(ID:\x20','data','Fetching\x20policy...','bold','policy','📋\x20Assigned\x20Policies','administrator','log','max','4XwyMUU','\x20\x20No\x20policies\x20assigned','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)',',\x20user_id:','policy\x20show','verbose','padEnd','\x20user','entries','99453zECWcN','user','account_owner','ies'];a36_0xbc79=function(){return _0x3c40fd;};return a36_0xbc79();}export class PolicyShowCommand extends BaseCommand{['name']=a36_0x23b0c8(0x124);[a36_0x23b0c8(0xfb)]='Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)';['validate'](_0x2478b7){const _0x54aac5=a36_0x23b0c8;if(_0x2478b7[_0x54aac5(0xed)][_0x54aac5(0xf4)]===0x0)return _0x54aac5(0xfa);return undefined;}async[a36_0x23b0c8(0xec)](_0x3ce3a0){const _0x4d9fb5=a36_0x23b0c8,{options:_0x5e0148,tdx:_0x56c24f}=_0x3ce3a0,_0x2116ce=_0x3ce3a0[_0x4d9fb5(0xed)][0x0],_0x31413c=await withSpinner(_0x4d9fb5(0x119),async()=>{const _0xf13f45=_0x4d9fb5,_0x5e972a=await _0x56c24f['policy'][_0xf13f45(0xf7)](_0x2116ce),[_0x2f58ce,_0x168e4b]=await Promise[_0xf13f45(0xea)]([_0x56c24f[_0xf13f45(0x11b)][_0xf13f45(0x111)](_0x5e972a['id']),_0x56c24f[_0xf13f45(0x11b)]['getPolicyUsers'](_0x5e972a['id'])]);return{'policy':_0x5e972a,'perms':_0x2f58ce,'users':_0x168e4b};},{'verbose':_0x5e0148['verbose']}),{policy:_0x241cb6,perms:_0x3b6507,users:_0x529d5e}=_0x31413c[_0x4d9fb5(0x118)];if(isStructuredFormat(_0x5e0148))return await handleSingleObjectOutput({..._0x241cb6,'permissions':_0x3b6507[_0x4d9fb5(0x10f)],'users':_0x529d5e},_0x5e0148),0x0;console[_0x4d9fb5(0x11e)]('\x0a'+a36_0xc0c3bd[_0x4d9fb5(0x11a)]('📋')+'\x20'+a36_0xc0c3bd[_0x4d9fb5(0x11a)](_0x241cb6['name'])+'\x20'+a36_0xc0c3bd[_0x4d9fb5(0x110)](_0x4d9fb5(0x117)+_0x241cb6['id']+')'));_0x241cb6[_0x4d9fb5(0xfb)]&&console[_0x4d9fb5(0x11e)]('\x20\x20\x20'+a36_0xc0c3bd[_0x4d9fb5(0x110)](_0x241cb6[_0x4d9fb5(0xfb)]));console[_0x4d9fb5(0x11e)](_0x4d9fb5(0x103)+_0x529d5e[_0x4d9fb5(0xf4)]+_0x4d9fb5(0xe4)+(_0x529d5e[_0x4d9fb5(0xf4)]!==0x1?'s':'')+_0x4d9fb5(0x116)),printPermissionsMap(_0x3b6507[_0x4d9fb5(0x10f)]);if(_0x529d5e[_0x4d9fb5(0xf4)]>0x0){console['log']('\x0a'+a36_0xc0c3bd[_0x4d9fb5(0x11a)]('👥\x20Assigned\x20Users')+':');for(const _0x241c04 of _0x529d5e){const _0x4f0347=_0x241c04[_0x4d9fb5(0x105)]&&_0x241c04[_0x4d9fb5(0x105)]!==_0x241c04[_0x4d9fb5(0xf8)]?a36_0xc0c3bd[_0x4d9fb5(0x110)]('\x20<'+_0x241c04['email']+'>'):'';console[_0x4d9fb5(0x11e)](_0x4d9fb5(0x115)+_0x241c04[_0x4d9fb5(0xf8)]+_0x4f0347);}}return console[_0x4d9fb5(0x11e)](),0x0;}}function printPermissionsMap(_0x125a88){const _0x445e5a=a36_0x23b0c8,_0x3c40bd=Object[_0x445e5a(0xe5)](_0x125a88);console[_0x445e5a(0x11e)]('\x0a'+a36_0xc0c3bd['bold'](_0x445e5a(0x104))+':');if(_0x3c40bd[_0x445e5a(0xf4)]===0x0){console[_0x445e5a(0x11e)](a36_0xc0c3bd[_0x445e5a(0x110)](_0x445e5a(0xf2)));return;}const _0x23ab95=Math[_0x445e5a(0x11f)](..._0x3c40bd[_0x445e5a(0xfc)](([_0x3376e9])=>_0x3376e9['length']));for(const [_0x28b017,_0x2e80a9]of _0x3c40bd){const _0x48d1a4=formatOperations(_0x2e80a9);console[_0x445e5a(0x11e)]('\x20\x20'+_0x28b017[_0x445e5a(0xe3)](_0x23ab95+0x2)+_0x48d1a4);}}function formatOperations(_0x1abf21){const _0x5ac3cb=a36_0x23b0c8,_0x3d0b24=[...new Set(_0x1abf21[_0x5ac3cb(0xfc)](_0x4d65d6=>_0x4d65d6[_0x5ac3cb(0xf3)]))];return _0x3d0b24[_0x5ac3cb(0xf6)](',\x20');}
@@ -1 +1 @@
1
- const a37_0x2d612b=a37_0x5932;(function(_0x5d5400,_0x160c06){const _0x17d276=a37_0x5932,_0x1c10d2=_0x5d5400();while(!![]){try{const _0x2c5cbd=parseInt(_0x17d276(0x91))/0x1+-parseInt(_0x17d276(0xb6))/0x2+parseInt(_0x17d276(0x94))/0x3+-parseInt(_0x17d276(0xc5))/0x4*(-parseInt(_0x17d276(0x98))/0x5)+-parseInt(_0x17d276(0xbf))/0x6*(parseInt(_0x17d276(0xe0))/0x7)+parseInt(_0x17d276(0xb5))/0x8*(parseInt(_0x17d276(0xe6))/0x9)+-parseInt(_0x17d276(0xa5))/0xa;if(_0x2c5cbd===_0x160c06)break;else _0x1c10d2['push'](_0x1c10d2['shift']());}catch(_0x170cd2){_0x1c10d2['push'](_0x1c10d2['shift']());}}}(a37_0x387d,0x69cfc));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 a37_0x218573 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a37_0x3ee18c from'prompts';import a37_0x1922e5 from'chalk';function a37_0x387d(){const _0x13c038=['dim','green','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','force','Failed\x20to\x20delete\x20profile:\x20','\x0aAvailable\x20profiles:','Removed\x20existing\x20profile\x20\x27','profileName','Profile\x20\x27','\x20API\x20key\x20saved\x20to\x20system\x20keychain','validate','\x20\x20(no\x20profiles\x20found)','(session:\x20','join','673832zitTXA','description','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','2459931vKDkeI','logLevel','\x27\x20deleted','trim','1630BtlMeY','default','session','\x27\x20updated:\x20','bold','confirm','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','log','Operation\x20cancelled','\x20API\x20key\x20is\x20valid\x20(User:\x20','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','VALID_KEYS','message','6051440cIimnI','name','email','\x27.\x0a\x0aValid\x20keys:\x20','tdx:\x20profile\x20delete','ERROR','\x20\x20tdx\x20--profile\x20','config','(cleared)','warn','jobs','profile:create','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','\x27\x20does\x20not\x20exist.','\x20Profile\x20\x27','Enter\x20profile\x20name:','8LRUjaP','710196bpVJGd','Session\x20profile\x20set\x20to:\x20','apiKey','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','tdx:\x20profile\x20set','error','Site\x20was\x20not\x20changed.','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>','status','133704egyogG','Default\x20profile\x20set\x20to:\x20','oauth','test','Unknown\x20key\x20\x27','Create\x20a\x20new\x20profile','1740kPJDgZ','parent_segment','\x20--default\x27\x20to\x20save\x20permanently','\x27\x20created','\x0aSetup\x20cancelled','create','/app/mp/ak','Enter\x20description\x20(optional):','llm_agent','Set\x20session\x20profile','red','includes','execute','split','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','skipExistsCheck','yellow','Enter\x20your\x20TD\x20API\x20key:','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','all','profile','llm_project','password','\x20\x20-\x20','\x0aSaved\x20to:\x20','site','245OeKWOm','length','\x27\x20does\x20not\x20exist.\x20Create\x20it?','You\x20can\x20find\x20your\x20API\x20key\x20at:','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','database','4841703OxcjHB','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','us01','Delete\x20a\x20profile'];a37_0x387d=function(){return _0x13c038;};return a37_0x387d();}function a37_0x5932(_0x531526,_0x42b792){_0x531526=_0x531526-0x8e;const _0x387df1=a37_0x387d();let _0x593257=_0x387df1[_0x531526];return _0x593257;}function validateProfileName(_0x5c2015,_0x20bcd2){const _0x267f69=a37_0x5932;if(!_0x5c2015||!_0x5c2015[_0x267f69(0x97)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x3a44a7=_0x5c2015[_0x267f69(0x97)]();if(!/^[a-zA-Z0-9_-]+$/[_0x267f69(0xc2)](_0x3a44a7))return _0x267f69(0xd3);if(!_0x20bcd2?.[_0x267f69(0xd5)]&&profileExists(_0x3a44a7))return'Profile\x20\x27'+_0x3a44a7+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20'+_0x3a44a7+'\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.';return!![];}async function deleteProfileAndCredentials(_0x233d22){const _0x2355e4=a37_0x5932;removeProfileFromUserConfig(_0x233d22);const _0x501931=await isKeychainAvailable();_0x501931&&await Promise[_0x2355e4(0xd9)]([deleteKeychainAPIKey(_0x233d22),deleteOAuthTokens(_0x233d22)]);}export class ProfileCreateCommand extends BaseCommand{[a37_0x2d612b(0xa6)]=a37_0x2d612b(0xb0);['description']=a37_0x2d612b(0xc4);async[a37_0x2d612b(0xd1)](_0x4453b1){const _0x2faff5=a37_0x2d612b,{options:_0x560b5d,args:_0x547c16}=_0x4453b1,_0x1d1d53=!!_0x560b5d[_0x2faff5(0xed)];console['log'](a37_0x1922e5[_0x2faff5(0x9c)]('tdx:\x20profile\x20create'));let _0xfb2436;if(_0x547c16['length']>0x0&&_0x547c16[0x0]){const _0xaf5fa3=_0x547c16[0x0][_0x2faff5(0x97)]();_0x1d1d53&&profileExists(_0xaf5fa3)&&(await deleteProfileAndCredentials(_0xaf5fa3),console['log'](_0x2faff5(0xf0)+_0xaf5fa3+'\x27'));const _0x2ddeac=validateProfileName(_0xaf5fa3);if(_0x2ddeac!==!![])return console['error'](a37_0x1922e5[_0x2faff5(0xcf)](_0x2ddeac)),0x1;_0xfb2436=_0xaf5fa3;}else{const _0x1cdaef=await a37_0x3ee18c({'type':'text','name':_0x2faff5(0xf1),'message':_0x2faff5(0xb4),'validate':_0x5d8575=>validateProfileName(_0x5d8575,{'skipExistsCheck':_0x1d1d53})});if(!_0x1cdaef[_0x2faff5(0xf1)])return console[_0x2faff5(0x9f)](_0x2faff5(0xc9)),0x1;_0xfb2436=_0x1cdaef[_0x2faff5(0xf1)][_0x2faff5(0x97)](),_0x1d1d53&&profileExists(_0xfb2436)&&(await deleteProfileAndCredentials(_0xfb2436),console[_0x2faff5(0x9f)](_0x2faff5(0xf0)+_0xfb2436+'\x27'));}const _0x58e801=await a37_0x3ee18c({'type':'text','name':'description','message':_0x2faff5(0xcc)}),_0x3243f8=_0x58e801[_0x2faff5(0x92)]?.[_0x2faff5(0x97)]()||undefined,_0x3e4736=_0x560b5d[_0x2faff5(0xdf)]||_0x2faff5(0xe8),_0x3362c6=await promptSiteSelection(_0x3e4736,_0xfb2436,'Setup\x20cancelled');if(!_0x3362c6)return 0x1;const _0x424bb8=resolveSite(_0x3362c6),_0x52894e=await promptAuthMethod();if(!_0x52894e)return console[_0x2faff5(0x9f)]('\x0aSetup\x20cancelled'),0x1;if(_0x52894e===_0x2faff5(0xc1)){if(_0x3243f8){const _0x160dee={'site':_0x424bb8,'description':_0x3243f8};saveProfileToUserConfig(_0xfb2436,_0x160dee);}const {accountName:_0x1f4ac7}=_0x560b5d;return await runOAuthLoginFlow(_0x424bb8,_0xfb2436,_0x560b5d['logLevel']??LogLevel['ERROR'],{'accountName':_0x1f4ac7}),0x0;}console['log']('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x424bb8),console[_0x2faff5(0x9f)](_0x2faff5(0xe3)),console[_0x2faff5(0x9f)]('\x20\x20'+getConsoleUrl(_0x424bb8,_0x2faff5(0xcb)));const _0x551476=await a37_0x3ee18c({'type':_0x2faff5(0xdc),'name':_0x2faff5(0xb8),'message':_0x2faff5(0xd7),'validate':_0x1806ea=>{const _0x39233d=_0x2faff5;if(!_0x1806ea||!_0x1806ea[_0x39233d(0x97)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x551476[_0x2faff5(0xb8)])return console['log'](_0x2faff5(0xc9)),0x1;const _0x204924=_0x551476[_0x2faff5(0xb8)];console[_0x2faff5(0x9f)]('Validating\x20API\x20key...');try{const _0x4bc0be=TDX[_0x2faff5(0xca)]({'site':_0x424bb8,'apiKey':_0x204924[_0x2faff5(0x97)](),'logLevel':_0x560b5d['logLevel']??LogLevel[_0x2faff5(0xaa)]}),_0x590a09=await _0x4bc0be[_0x2faff5(0xaf)]['getUserInfo']();console['log'](a37_0x1922e5[_0x2faff5(0xeb)]('✓')+_0x2faff5(0xa1)+_0x590a09[_0x2faff5(0xa7)]+')');const _0x554c0b=await isKeychainAvailable();_0x554c0b?(await saveAPIKeyAsync(_0x204924[_0x2faff5(0x97)](),_0x424bb8,_0xfb2436),console[_0x2faff5(0x9f)](a37_0x1922e5[_0x2faff5(0xeb)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0xfb2436+')')):(console[_0x2faff5(0xae)](a37_0x1922e5[_0x2faff5(0xd6)](_0x2faff5(0xe7))),console['warn'](a37_0x1922e5[_0x2faff5(0xd6)](_0x2faff5(0xb1))));const _0x558a0b={'site':_0x424bb8,..._0x3243f8&&{'description':_0x3243f8}};return saveProfileToUserConfig(_0xfb2436,_0x558a0b),console[_0x2faff5(0x9f)](a37_0x1922e5['green']('✓')+_0x2faff5(0xb3)+_0xfb2436+_0x2faff5(0xc8)),console['log'](),console['log']('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console['log'](_0x2faff5(0xab)+_0xfb2436+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console['log'](_0x2faff5(0xab)+_0xfb2436+_0x2faff5(0xb9)),0x0;}catch(_0x3a919c){if(_0x3a919c instanceof HTTPClientError&&_0x3a919c[_0x2faff5(0xbe)]===0x191)return printAuthError(_0x3a919c),0x1;return console[_0x2faff5(0xbb)](a37_0x1922e5[_0x2faff5(0xcf)]('✗\x20Validation\x20failed:\x20'+(_0x3a919c instanceof Error?_0x3a919c[_0x2faff5(0xa4)]:String(_0x3a919c)))),console['error'](_0x2faff5(0x9e)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a37_0x2d612b(0xa6)]='profile:delete';[a37_0x2d612b(0x92)]=a37_0x2d612b(0xe9);[a37_0x2d612b(0xf4)](_0x347622){const _0x310978=a37_0x2d612b,{args:_0x1a7310}=_0x347622;if(_0x1a7310[_0x310978(0xe1)]===0x0)return _0x310978(0xe4);return undefined;}async[a37_0x2d612b(0xd1)](_0xdede11){const _0x5c30ed=a37_0x2d612b,{args:_0x3a1c2f}=_0xdede11,_0x243c6a=_0x3a1c2f[0x0];console[_0x5c30ed(0x9f)](a37_0x1922e5[_0x5c30ed(0x9c)](_0x5c30ed(0xa9)));if(!profileExists(_0x243c6a)){console['error'](a37_0x1922e5[_0x5c30ed(0xcf)]('Profile\x20\x27'+_0x243c6a+_0x5c30ed(0xb2))),console[_0x5c30ed(0x9f)](_0x5c30ed(0xef));const _0xda2ba4=listProfiles();if(_0xda2ba4[_0x5c30ed(0xe1)]===0x0)console[_0x5c30ed(0x9f)](_0x5c30ed(0x8e));else for(const _0x11db7d of _0xda2ba4){console[_0x5c30ed(0x9f)](_0x5c30ed(0xdd)+_0x11db7d[_0x5c30ed(0xa6)]);}return 0x1;}const _0x6d3221=await a37_0x3ee18c({'type':_0x5c30ed(0x9d),'name':'confirm','message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x243c6a+'\x27?','initial':![]});if(!_0x6d3221['confirm'])return console['log']('Removal\x20cancelled'),0x0;try{await deleteProfileAndCredentials(_0x243c6a),console[_0x5c30ed(0x9f)](a37_0x1922e5['green']('✓')+_0x5c30ed(0xb3)+_0x243c6a+_0x5c30ed(0x96));}catch(_0x38b0a0){return console[_0x5c30ed(0xbb)](a37_0x1922e5[_0x5c30ed(0xcf)](_0x5c30ed(0xee)+(_0x38b0a0 instanceof Error?_0x38b0a0[_0x5c30ed(0xa4)]:String(_0x38b0a0)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']='profile:set';[a37_0x2d612b(0x92)]='Set\x20a\x20profile\x20configuration\x20value';static ['VALID_KEYS']=['site',a37_0x2d612b(0xe5),a37_0x2d612b(0xc6),a37_0x2d612b(0xdb),a37_0x2d612b(0xcd),a37_0x2d612b(0x92)];[a37_0x2d612b(0xf4)](_0x4c97b2){const _0x3cc496=a37_0x2d612b,{args:_0x2b14b7,options:_0x7c6ca}=_0x4c97b2,_0x42a494=_0x7c6ca[_0x3cc496(0xda)]||getActiveProfile();if(!_0x42a494)return _0x3cc496(0xbd);if(_0x2b14b7[_0x3cc496(0xe1)]===0x0)return _0x3cc496(0xa2)+ProfileSetCommand[_0x3cc496(0xa3)][_0x3cc496(0x90)](',\x20');const _0x52abfd=_0x2b14b7[0x0];if(!_0x52abfd[_0x3cc496(0xd0)]('='))return _0x3cc496(0xd4)+ProfileSetCommand['VALID_KEYS'][_0x3cc496(0x90)](',\x20');const [_0x53d08e]=_0x52abfd[_0x3cc496(0xd2)]('=',0x2);if(!ProfileSetCommand[_0x3cc496(0xa3)]['includes'](_0x53d08e))return _0x3cc496(0xc3)+_0x53d08e+_0x3cc496(0xa8)+ProfileSetCommand[_0x3cc496(0xa3)][_0x3cc496(0x90)](',\x20');return undefined;}async[a37_0x2d612b(0xd1)](_0xe107c6){const _0x4b06d5=a37_0x2d612b,{args:_0x235b49,options:_0x4577b0}=_0xe107c6,_0x280db6=_0x4577b0['profile']||getActiveProfile(),[_0x5d4596,..._0x1bf166]=_0x235b49[0x0]['split']('='),_0x1fc6c6=_0x1bf166[_0x4b06d5(0x90)]('=');console['log'](a37_0x1922e5[_0x4b06d5(0x9c)](_0x4b06d5(0xba)));if(!profileExists(_0x280db6)){const _0x387df9=await a37_0x3ee18c({'type':_0x4b06d5(0x9d),'name':_0x4b06d5(0xca),'message':'Profile\x20\x27'+_0x280db6+_0x4b06d5(0xe2),'initial':!![]});if(!_0x387df9['create'])return console['log'](_0x4b06d5(0xa0)),0x1;}const _0x116552=loadProfile(_0x280db6),_0x3a99c9=_0x116552?.[_0x4b06d5(0xac)]||{};if(_0x5d4596===_0x4b06d5(0xdf)){const _0x48d253=resolveSite(_0x1fc6c6);console[_0x4b06d5(0x9f)]('Changing\x20site\x20to\x20\x27'+_0x48d253+'\x27\x20requires\x20API\x20key\x20validation.'),console['log']('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x4b06d5(0x9f)]('\x20\x20'+getConsoleUrl(_0x48d253,_0x4b06d5(0xcb)));const _0x3fda4a=await a37_0x3ee18c({'type':_0x4b06d5(0xdc),'name':_0x4b06d5(0xb8),'message':_0x4b06d5(0xd8),'validate':_0x509b42=>{if(!_0x509b42||!_0x509b42['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x3fda4a[_0x4b06d5(0xb8)])return console[_0x4b06d5(0x9f)]('\x0aOperation\x20cancelled'),0x1;console['log']('Validating\x20API\x20key...');try{const _0xd119e7=TDX['create']({'site':_0x48d253,'apiKey':_0x3fda4a[_0x4b06d5(0xb8)]['trim'](),'logLevel':_0x4577b0[_0x4b06d5(0x95)]??LogLevel[_0x4b06d5(0xaa)]}),_0x1749dc=await _0xd119e7[_0x4b06d5(0xaf)]['getUserInfo']();console[_0x4b06d5(0x9f)](a37_0x1922e5[_0x4b06d5(0xeb)]('✓')+_0x4b06d5(0xa1)+_0x1749dc['email']+')');const _0x164850=await isKeychainAvailable();_0x164850?(await saveAPIKeyAsync(_0x3fda4a[_0x4b06d5(0xb8)][_0x4b06d5(0x97)](),_0x48d253,_0x280db6),console[_0x4b06d5(0x9f)](a37_0x1922e5['green']('✓')+_0x4b06d5(0xf3))):console[_0x4b06d5(0xae)](a37_0x1922e5[_0x4b06d5(0xd6)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x3a99c9[_0x4b06d5(0xdf)]=_0x48d253;}catch(_0x3ba940){if(_0x3ba940 instanceof HTTPClientError&&_0x3ba940[_0x4b06d5(0xbe)]===0x191)return printAuthError(_0x3ba940),0x1;return console[_0x4b06d5(0xbb)](a37_0x1922e5['red']('✗\x20Validation\x20failed:\x20'+(_0x3ba940 instanceof Error?_0x3ba940[_0x4b06d5(0xa4)]:String(_0x3ba940)))),console[_0x4b06d5(0xbb)](_0x4b06d5(0xbc)),0x1;}}else _0x3a99c9[_0x5d4596]=_0x1fc6c6||undefined;return saveProfileToUserConfig(_0x280db6,_0x3a99c9),console[_0x4b06d5(0x9f)](a37_0x1922e5['green']('✓')+'\x20Profile\x20\x27'+_0x280db6+_0x4b06d5(0x9b)+_0x5d4596+'='+(_0x1fc6c6||_0x4b06d5(0xad))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a37_0x2d612b(0xa6)]='profile:use';[a37_0x2d612b(0x92)]=a37_0x2d612b(0xce);[a37_0x2d612b(0xf4)](_0x29ab05){const _0x29a539=a37_0x2d612b,{args:_0x23deca}=_0x29ab05;if(_0x23deca['length']===0x0)return _0x29a539(0xec);return undefined;}async[a37_0x2d612b(0xd1)](_0x848e04){const _0x11ec2a=a37_0x2d612b,{args:_0x39c553,options:_0x5c6e2f}=_0x848e04,_0x3cb9f5=_0x39c553[0x0],_0x44d97e=_0x5c6e2f[_0x11ec2a(0x99)];cleanExpiredSessions();if(!profileExists(_0x3cb9f5)){console[_0x11ec2a(0xbb)](a37_0x1922e5[_0x11ec2a(0xcf)](_0x11ec2a(0xf2)+_0x3cb9f5+'\x27\x20does\x20not\x20exist.')),console[_0x11ec2a(0x9f)]('\x0aAvailable\x20profiles:');const _0x52b414=listProfiles();if(_0x52b414[_0x11ec2a(0xe1)]===0x0)console[_0x11ec2a(0x9f)](_0x11ec2a(0x8e));else for(const _0x49a663 of _0x52b414){console[_0x11ec2a(0x9f)](_0x11ec2a(0xdd)+_0x49a663[_0x11ec2a(0xa6)]);}return 0x1;}if(_0x44d97e){const _0x495d36=a37_0x218573[_0x11ec2a(0x90)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x3cb9f5),console['log'](_0x11ec2a(0xc0)+a37_0x1922e5[_0x11ec2a(0xeb)](_0x3cb9f5)),console[_0x11ec2a(0x9f)](a37_0x1922e5[_0x11ec2a(0xea)](_0x11ec2a(0xde)+_0x495d36)),0x0;}const _0x25067f=getSessionID(_0x5c6e2f[_0x11ec2a(0x9a)]);return saveSessionContext({'profile':_0x3cb9f5},_0x5c6e2f['session']),console[_0x11ec2a(0x9f)](_0x11ec2a(0xb7)+a37_0x1922e5[_0x11ec2a(0xeb)](_0x3cb9f5)+'\x20'+a37_0x1922e5[_0x11ec2a(0xea)](_0x11ec2a(0x8f)+_0x25067f+')')),console['log'](a37_0x1922e5['dim'](_0x11ec2a(0x93)+_0x3cb9f5+_0x11ec2a(0xc7))),0x0;}}
1
+ const a37_0x117c24=a37_0x2952;(function(_0x1420a4,_0x1e2c7a){const _0x2f723f=a37_0x2952,_0x5389ba=_0x1420a4();while(!![]){try{const _0x37b728=-parseInt(_0x2f723f(0xa0))/0x1+-parseInt(_0x2f723f(0xd3))/0x2+-parseInt(_0x2f723f(0x78))/0x3*(parseInt(_0x2f723f(0x97))/0x4)+-parseInt(_0x2f723f(0xc3))/0x5+parseInt(_0x2f723f(0xaf))/0x6*(parseInt(_0x2f723f(0x77))/0x7)+-parseInt(_0x2f723f(0x9d))/0x8+parseInt(_0x2f723f(0xa9))/0x9;if(_0x37b728===_0x1e2c7a)break;else _0x5389ba['push'](_0x5389ba['shift']());}catch(_0x564727){_0x5389ba['push'](_0x5389ba['shift']());}}}(a37_0x1bb8,0xe6e12));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 a37_0x540451 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a37_0x1578a1 from'prompts';function a37_0x2952(_0x287b74,_0x562eff){_0x287b74=_0x287b74-0x6f;const _0x1bb8eb=a37_0x1bb8();let _0x2952dc=_0x1bb8eb[_0x287b74];return _0x2952dc;}import a37_0x7bacd3 from'chalk';function validateProfileName(_0x3a6bf8,_0x4684a3){const _0x150b30=a37_0x2952;if(!_0x3a6bf8||!_0x3a6bf8['trim']())return _0x150b30(0xaa);const _0x152910=_0x3a6bf8[_0x150b30(0xdd)]();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x152910))return _0x150b30(0x96);if(!_0x4684a3?.[_0x150b30(0x75)]&&profileExists(_0x152910))return _0x150b30(0x79)+_0x152910+_0x150b30(0x74)+_0x152910+_0x150b30(0x87);return!![];}async function deleteProfileAndCredentials(_0x2533fb){const _0x55e084=a37_0x2952;removeProfileFromUserConfig(_0x2533fb);const _0x9a4dbe=await isKeychainAvailable();_0x9a4dbe&&await Promise[_0x55e084(0xd2)]([deleteKeychainAPIKey(_0x2533fb),deleteOAuthTokens(_0x2533fb)]);}export class ProfileCreateCommand extends BaseCommand{['name']=a37_0x117c24(0xda);[a37_0x117c24(0x70)]=a37_0x117c24(0x7a);async[a37_0x117c24(0x83)](_0x44a745){const _0x504e53=a37_0x117c24,{options:_0x15db58,args:_0xc243b0}=_0x44a745,_0x39ebce=!!_0x15db58[_0x504e53(0x89)];console[_0x504e53(0x72)](a37_0x7bacd3[_0x504e53(0xd6)](_0x504e53(0xc0)));let _0x3274c2;if(_0xc243b0[_0x504e53(0x90)]>0x0&&_0xc243b0[0x0]){const _0x56f618=_0xc243b0[0x0][_0x504e53(0xdd)]();_0x39ebce&&profileExists(_0x56f618)&&(await deleteProfileAndCredentials(_0x56f618),console[_0x504e53(0x72)](_0x504e53(0x98)+_0x56f618+'\x27'));const _0x2d42e9=validateProfileName(_0x56f618);if(_0x2d42e9!==!![])return console[_0x504e53(0xa1)](a37_0x7bacd3[_0x504e53(0xad)](_0x2d42e9)),0x1;_0x3274c2=_0x56f618;}else{const _0x4e9422=await a37_0x1578a1({'type':_0x504e53(0xa6),'name':_0x504e53(0x73),'message':_0x504e53(0xab),'validate':_0x2005d8=>validateProfileName(_0x2005d8,{'skipExistsCheck':_0x39ebce})});if(!_0x4e9422[_0x504e53(0x73)])return console[_0x504e53(0x72)]('\x0aSetup\x20cancelled'),0x1;_0x3274c2=_0x4e9422[_0x504e53(0x73)]['trim'](),_0x39ebce&&profileExists(_0x3274c2)&&(await deleteProfileAndCredentials(_0x3274c2),console['log']('Removed\x20existing\x20profile\x20\x27'+_0x3274c2+'\x27'));}const _0x17a7ff=await a37_0x1578a1({'type':_0x504e53(0xa6),'name':_0x504e53(0x70),'message':_0x504e53(0x9b)}),_0x225d05=_0x17a7ff[_0x504e53(0x70)]?.[_0x504e53(0xdd)]()||undefined,_0x1912dc=_0x15db58[_0x504e53(0xc7)]||_0x504e53(0x86),_0x1045bd=await promptSiteSelection(_0x1912dc,_0x3274c2,'Setup\x20cancelled');if(!_0x1045bd)return 0x1;const _0x2d5664=resolveSite(_0x1045bd),_0x40a2d4=await promptAuthMethod();if(!_0x40a2d4)return console[_0x504e53(0x72)]('\x0aSetup\x20cancelled'),0x1;if(_0x40a2d4===_0x504e53(0x7f)){if(_0x225d05){const _0x282229={'site':_0x2d5664,'description':_0x225d05};saveProfileToUserConfig(_0x3274c2,_0x282229);}const {accountName:_0x18a5e4}=_0x15db58;return await runOAuthLoginFlow(_0x2d5664,_0x3274c2,_0x15db58[_0x504e53(0xcf)]??LogLevel[_0x504e53(0x88)],{'accountName':_0x18a5e4}),0x0;}console[_0x504e53(0x72)](_0x504e53(0xbb)+_0x2d5664),console[_0x504e53(0x72)](_0x504e53(0x93)),console[_0x504e53(0x72)]('\x20\x20'+getConsoleUrl(_0x2d5664,_0x504e53(0xb8)));const _0x1490d5=await a37_0x1578a1({'type':_0x504e53(0x7e),'name':_0x504e53(0xd9),'message':_0x504e53(0xb0),'validate':_0x551736=>{const _0x1562e3=_0x504e53;if(!_0x551736||!_0x551736[_0x1562e3(0xdd)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x1490d5[_0x504e53(0xd9)])return console[_0x504e53(0x72)](_0x504e53(0xc9)),0x1;const _0x3c1a34=_0x1490d5[_0x504e53(0xd9)];console[_0x504e53(0x72)](_0x504e53(0xd5));try{const _0x2e4c05=TDX[_0x504e53(0xcc)]({'site':_0x2d5664,'apiKey':_0x3c1a34[_0x504e53(0xdd)](),'logLevel':_0x15db58[_0x504e53(0xcf)]??LogLevel[_0x504e53(0x88)]}),_0x360972=await _0x2e4c05[_0x504e53(0xb6)][_0x504e53(0xc1)]();console[_0x504e53(0x72)](a37_0x7bacd3[_0x504e53(0xdc)]('✓')+_0x504e53(0xe0)+_0x360972[_0x504e53(0xd0)]+')');const _0x16ac31=await isKeychainAvailable();_0x16ac31?(await saveAPIKeyAsync(_0x3c1a34[_0x504e53(0xdd)](),_0x2d5664,_0x3274c2),console[_0x504e53(0x72)](a37_0x7bacd3[_0x504e53(0xdc)]('✓')+_0x504e53(0xcb)+_0x3274c2+')')):(console['warn'](a37_0x7bacd3[_0x504e53(0x9c)](_0x504e53(0x80))),console[_0x504e53(0xa3)](a37_0x7bacd3['yellow'](_0x504e53(0xb4))));const _0x4f7845={'site':_0x2d5664,..._0x225d05&&{'description':_0x225d05}};return saveProfileToUserConfig(_0x3274c2,_0x4f7845),console[_0x504e53(0x72)](a37_0x7bacd3[_0x504e53(0xdc)]('✓')+_0x504e53(0x85)+_0x3274c2+_0x504e53(0xa2)),console[_0x504e53(0x72)](),console['log'](_0x504e53(0xc4)),console[_0x504e53(0x72)](_0x504e53(0xb3)+_0x3274c2+_0x504e53(0xd8)),console[_0x504e53(0x72)](_0x504e53(0xb3)+_0x3274c2+_0x504e53(0xca)),0x0;}catch(_0x283feb){if(_0x283feb instanceof HTTPClientError&&_0x283feb['status']===0x191)return printAuthError(_0x283feb),0x1;return console[_0x504e53(0xa1)](a37_0x7bacd3[_0x504e53(0xad)](_0x504e53(0xa8)+(_0x283feb instanceof Error?_0x283feb[_0x504e53(0x76)]:String(_0x283feb)))),console['error']('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a37_0x117c24(0xbf)]=a37_0x117c24(0xb5);['description']='Delete\x20a\x20profile';[a37_0x117c24(0x7b)](_0x57d74f){const _0x262c59=a37_0x117c24,{args:_0x3fdd56}=_0x57d74f;if(_0x3fdd56['length']===0x0)return _0x262c59(0x91);return undefined;}async[a37_0x117c24(0x83)](_0x1acac0){const _0x1912f1=a37_0x117c24,{args:_0x8045e9}=_0x1acac0,_0x20e794=_0x8045e9[0x0];console[_0x1912f1(0x72)](a37_0x7bacd3['bold'](_0x1912f1(0x95)));if(!profileExists(_0x20e794)){console[_0x1912f1(0xa1)](a37_0x7bacd3[_0x1912f1(0xad)](_0x1912f1(0x79)+_0x20e794+_0x1912f1(0x71))),console['log'](_0x1912f1(0x94));const _0xdde605=listProfiles();if(_0xdde605['length']===0x0)console['log'](_0x1912f1(0xbe));else for(const _0x55569d of _0xdde605){console[_0x1912f1(0x72)](_0x1912f1(0x99)+_0x55569d[_0x1912f1(0xbf)]);}return 0x1;}const _0x5d0a75=await a37_0x1578a1({'type':_0x1912f1(0xcd),'name':'confirm','message':_0x1912f1(0xa7)+_0x20e794+'\x27?','initial':![]});if(!_0x5d0a75['confirm'])return console['log'](_0x1912f1(0xb1)),0x0;try{await deleteProfileAndCredentials(_0x20e794),console[_0x1912f1(0x72)](a37_0x7bacd3['green']('✓')+_0x1912f1(0x85)+_0x20e794+_0x1912f1(0x9e));}catch(_0xbfeabf){return console[_0x1912f1(0xa1)](a37_0x7bacd3['red'](_0x1912f1(0x9f)+(_0xbfeabf instanceof Error?_0xbfeabf[_0x1912f1(0x76)]:String(_0xbfeabf)))),0x1;}return 0x0;}}function a37_0x1bb8(){const _0x3b3e32=['\x0aSetup\x20cancelled','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','create','confirm','config','logLevel','email','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','all','1465294MugGjw','split','Validating\x20API\x20key...','bold','VALID_KEYS','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','apiKey','profile:create','Session\x20profile\x20set\x20to:\x20','green','trim','join','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>','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x0aSaved\x20to:\x20','description','\x27\x20does\x20not\x20exist.','log','profileName','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','skipExistsCheck','message','1540483APzNVQ','935271ltshlF','Profile\x20\x27','Create\x20a\x20new\x20profile','validate','Default\x20profile\x20set\x20to:\x20','database','password','oauth','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','(session:\x20','includes','execute','session','\x20Profile\x20\x27','us01','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','ERROR','force','Operation\x20cancelled','profile:use','\x27.\x0a\x0aValid\x20keys:\x20','\x27\x20updated:\x20','tdx.json','dim','length','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','\x0aOperation\x20cancelled','You\x20can\x20find\x20your\x20API\x20key\x20at:','\x0aAvailable\x20profiles:','tdx:\x20profile\x20delete','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','8BMISDK','Removed\x20existing\x20profile\x20\x27','\x20\x20-\x20','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','Enter\x20description\x20(optional):','yellow','908520POKhaI','\x27\x20deleted','Failed\x20to\x20delete\x20profile:\x20','1265685yoffSv','error','\x27\x20created','warn','profile','Changing\x20site\x20to\x20\x27','text','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','✗\x20Validation\x20failed:\x20','36748944odUIKN','Profile\x20name\x20cannot\x20be\x20empty','Enter\x20profile\x20name:','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','red','llm_project','36FzDsFZ','Enter\x20your\x20TD\x20API\x20key:','Removal\x20cancelled','Site\x20was\x20not\x20changed.','\x20\x20tdx\x20--profile\x20','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','profile:delete','jobs','tdx:\x20profile\x20set','/app/mp/ak','profile:set','Set\x20session\x20profile','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','\x20--default\x27\x20to\x20save\x20permanently','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x20\x20(no\x20profiles\x20found)','name','tdx:\x20profile\x20create','getUserInfo','\x27\x20does\x20not\x20exist.\x20Create\x20it?','8612685hexMBU','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','\x27\x20requires\x20API\x20key\x20validation.','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','site','parent_segment'];a37_0x1bb8=function(){return _0x3b3e32;};return a37_0x1bb8();}export class ProfileSetCommand extends BaseCommand{[a37_0x117c24(0xbf)]=a37_0x117c24(0xb9);[a37_0x117c24(0x70)]='Set\x20a\x20profile\x20configuration\x20value';static [a37_0x117c24(0xd7)]=[a37_0x117c24(0xc7),a37_0x117c24(0x7d),a37_0x117c24(0xc8),a37_0x117c24(0xae),'llm_agent',a37_0x117c24(0x70)];[a37_0x117c24(0x7b)](_0x1bfdc0){const _0x2ba0c8=a37_0x117c24,{args:_0x1a4357,options:_0x1c5d9f}=_0x1bfdc0,_0x11fcec=_0x1c5d9f[_0x2ba0c8(0xa4)]||getActiveProfile();if(!_0x11fcec)return _0x2ba0c8(0xdf);if(_0x1a4357[_0x2ba0c8(0x90)]===0x0)return _0x2ba0c8(0xbd)+ProfileSetCommand['VALID_KEYS'][_0x2ba0c8(0xde)](',\x20');const _0x8fbc02=_0x1a4357[0x0];if(!_0x8fbc02[_0x2ba0c8(0x82)]('='))return _0x2ba0c8(0xac)+ProfileSetCommand[_0x2ba0c8(0xd7)][_0x2ba0c8(0xde)](',\x20');const [_0x18a74d]=_0x8fbc02['split']('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x2ba0c8(0x82)](_0x18a74d))return'Unknown\x20key\x20\x27'+_0x18a74d+_0x2ba0c8(0x8c)+ProfileSetCommand[_0x2ba0c8(0xd7)]['join'](',\x20');return undefined;}async[a37_0x117c24(0x83)](_0x3cd28a){const _0x12725d=a37_0x117c24,{args:_0x10941b,options:_0x31d5c2}=_0x3cd28a,_0x2ea7d4=_0x31d5c2[_0x12725d(0xa4)]||getActiveProfile(),[_0x428058,..._0x4f94c2]=_0x10941b[0x0][_0x12725d(0xd4)]('='),_0x3e0af8=_0x4f94c2[_0x12725d(0xde)]('=');console[_0x12725d(0x72)](a37_0x7bacd3['bold'](_0x12725d(0xb7)));if(!profileExists(_0x2ea7d4)){const _0x1405b2=await a37_0x1578a1({'type':_0x12725d(0xcd),'name':'create','message':_0x12725d(0x79)+_0x2ea7d4+_0x12725d(0xc2),'initial':!![]});if(!_0x1405b2[_0x12725d(0xcc)])return console['log'](_0x12725d(0x8a)),0x1;}const _0x120eba=loadProfile(_0x2ea7d4),_0x5ba9f3=_0x120eba?.[_0x12725d(0xce)]||{};if(_0x428058===_0x12725d(0xc7)){const _0x332abf=resolveSite(_0x3e0af8);console[_0x12725d(0x72)](_0x12725d(0xa5)+_0x332abf+_0x12725d(0xc5)),console[_0x12725d(0x72)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x12725d(0x72)]('\x20\x20'+getConsoleUrl(_0x332abf,'/app/mp/ak'));const _0x22121b=await a37_0x1578a1({'type':_0x12725d(0x7e),'name':_0x12725d(0xd9),'message':_0x12725d(0xd1),'validate':_0x46490c=>{const _0x5c5650=_0x12725d;if(!_0x46490c||!_0x46490c[_0x5c5650(0xdd)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x22121b[_0x12725d(0xd9)])return console[_0x12725d(0x72)](_0x12725d(0x92)),0x1;console['log']('Validating\x20API\x20key...');try{const _0x31fe6a=TDX['create']({'site':_0x332abf,'apiKey':_0x22121b[_0x12725d(0xd9)][_0x12725d(0xdd)](),'logLevel':_0x31d5c2[_0x12725d(0xcf)]??LogLevel[_0x12725d(0x88)]}),_0x5f2b47=await _0x31fe6a['jobs'][_0x12725d(0xc1)]();console[_0x12725d(0x72)](a37_0x7bacd3[_0x12725d(0xdc)]('✓')+_0x12725d(0xe0)+_0x5f2b47[_0x12725d(0xd0)]+')');const _0x103ff6=await isKeychainAvailable();_0x103ff6?(await saveAPIKeyAsync(_0x22121b[_0x12725d(0xd9)][_0x12725d(0xdd)](),_0x332abf,_0x2ea7d4),console[_0x12725d(0x72)](a37_0x7bacd3['green']('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console['warn'](a37_0x7bacd3[_0x12725d(0x9c)](_0x12725d(0x80))),_0x5ba9f3[_0x12725d(0xc7)]=_0x332abf;}catch(_0x296eff){if(_0x296eff instanceof HTTPClientError&&_0x296eff['status']===0x191)return printAuthError(_0x296eff),0x1;return console[_0x12725d(0xa1)](a37_0x7bacd3[_0x12725d(0xad)]('✗\x20Validation\x20failed:\x20'+(_0x296eff instanceof Error?_0x296eff[_0x12725d(0x76)]:String(_0x296eff)))),console[_0x12725d(0xa1)](_0x12725d(0xb2)),0x1;}}else _0x5ba9f3[_0x428058]=_0x3e0af8||undefined;return saveProfileToUserConfig(_0x2ea7d4,_0x5ba9f3),console[_0x12725d(0x72)](a37_0x7bacd3[_0x12725d(0xdc)]('✓')+_0x12725d(0x85)+_0x2ea7d4+_0x12725d(0x8d)+_0x428058+'='+(_0x3e0af8||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{[a37_0x117c24(0xbf)]=a37_0x117c24(0x8b);[a37_0x117c24(0x70)]=a37_0x117c24(0xba);[a37_0x117c24(0x7b)](_0x2a0c6d){const _0x2fadf1=a37_0x117c24,{args:_0x7d2b65}=_0x2a0c6d;if(_0x7d2b65[_0x2fadf1(0x90)]===0x0)return _0x2fadf1(0xc6);return undefined;}async['execute'](_0x20b7c8){const _0x4ccba1=a37_0x117c24,{args:_0x58bcfa,options:_0x509cdc}=_0x20b7c8,_0x1828f4=_0x58bcfa[0x0],_0x2400bb=_0x509cdc['default'];cleanExpiredSessions();if(!profileExists(_0x1828f4)){console[_0x4ccba1(0xa1)](a37_0x7bacd3[_0x4ccba1(0xad)](_0x4ccba1(0x79)+_0x1828f4+'\x27\x20does\x20not\x20exist.')),console[_0x4ccba1(0x72)](_0x4ccba1(0x94));const _0x58e06b=listProfiles();if(_0x58e06b[_0x4ccba1(0x90)]===0x0)console[_0x4ccba1(0x72)](_0x4ccba1(0xbe));else for(const _0x118c5c of _0x58e06b){console[_0x4ccba1(0x72)](_0x4ccba1(0x99)+_0x118c5c['name']);}return 0x1;}if(_0x2400bb){const _0x126480=a37_0x540451[_0x4ccba1(0xde)](getConfigDir(),_0x4ccba1(0x8e));return saveActiveProfileToUserConfig(_0x1828f4),console[_0x4ccba1(0x72)](_0x4ccba1(0x7c)+a37_0x7bacd3[_0x4ccba1(0xdc)](_0x1828f4)),console['log'](a37_0x7bacd3[_0x4ccba1(0x8f)](_0x4ccba1(0x6f)+_0x126480)),0x0;}const _0x55d066=getSessionID(_0x509cdc[_0x4ccba1(0x84)]);return saveSessionContext({'profile':_0x1828f4},_0x509cdc[_0x4ccba1(0x84)]),console[_0x4ccba1(0x72)](_0x4ccba1(0xdb)+a37_0x7bacd3['green'](_0x1828f4)+'\x20'+a37_0x7bacd3[_0x4ccba1(0x8f)](_0x4ccba1(0x81)+_0x55d066+')')),console[_0x4ccba1(0x72)](a37_0x7bacd3[_0x4ccba1(0x8f)](_0x4ccba1(0x9a)+_0x1828f4+_0x4ccba1(0xbc))),0x0;}}
@@ -1 +1 @@
1
- const a38_0x276b36=a38_0x4bc5;(function(_0x4f3105,_0x1c8639){const _0x427845=a38_0x4bc5,_0x21320b=_0x4f3105();while(!![]){try{const _0x51d196=parseInt(_0x427845(0x145))/0x1+-parseInt(_0x427845(0x144))/0x2+parseInt(_0x427845(0x141))/0x3+parseInt(_0x427845(0x146))/0x4*(parseInt(_0x427845(0x13f))/0x5)+parseInt(_0x427845(0x148))/0x6+-parseInt(_0x427845(0x149))/0x7*(parseInt(_0x427845(0x151))/0x8)+parseInt(_0x427845(0x14d))/0x9*(parseInt(_0x427845(0x147))/0xa);if(_0x51d196===_0x1c8639)break;else _0x21320b['push'](_0x21320b['shift']());}catch(_0x1b2c3d){_0x21320b['push'](_0x21320b['shift']());}}}(a38_0x5c87,0xf3ade));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';function a38_0x4bc5(_0x24ef46,_0x33bfab){_0x24ef46=_0x24ef46-0x13a;const _0x5c879d=a38_0x5c87();let _0x4bc5c5=_0x5c879d[_0x24ef46];return _0x4bc5c5;}function a38_0x5c87(){const _0x286764=['\x20\x20Global:\x20~/.config/tdx/tdx.json','1086005omFkAV','site','848139muyKTH','👤\x20','config','2704848zFhRap','239529HxVWjr','8yAOHTc','2584090oRqpZu','1675596rljjoL','4319niLRqN','Error:\x20','length','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','72jnXXJs','log','map','dim','12352McdLEg','execute','description','name','message'];a38_0x5c87=function(){return _0x286764;};return a38_0x5c87();}import a38_0x43c3fa from'chalk';export class ProfilesCommand extends BaseCommand{[a38_0x276b36(0x13c)]='profiles';[a38_0x276b36(0x13b)]='List\x20all\x20available\x20profiles';async[a38_0x276b36(0x13a)](_0x1197ab){const _0x3172fa=a38_0x276b36,{options:_0x3c1c83}=_0x1197ab;try{const _0x442be0=listProfiles(),_0x1c382b=getActiveProfile();if(_0x442be0[_0x3172fa(0x14b)]===0x0)return console['log'](_0x3172fa(0x14c)),console[_0x3172fa(0x14e)]('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console[_0x3172fa(0x14e)](_0x3172fa(0x13e)),0x0;const _0x1a566c=_0x442be0[_0x3172fa(0x14f)](_0x5d7021=>{const _0xcaa42e=_0x3172fa,_0x26ca5b=_0x5d7021[_0xcaa42e(0x13c)]===_0x1c382b,_0xb1c1c2=getProfileParams(_0x5d7021['config']);return{'name':_0x5d7021[_0xcaa42e(0x13c)],'active':_0x26ca5b,'scope':_0x5d7021['scope'],'description':_0x5d7021[_0xcaa42e(0x143)]['description']||'','params':_0xb1c1c2};});if(isStructuredFormat(_0x3c1c83))await handleSDKOutput(_0x1a566c,_0x3c1c83);else for(const _0x128314 of _0x442be0){const _0x287f63=_0x128314[_0x3172fa(0x13c)]===_0x1c382b?a38_0x43c3fa['green']('\x20✓'):'',_0x5e7365=_0x128314[_0x3172fa(0x143)][_0x3172fa(0x140)]?a38_0x43c3fa['dim']('\x20'+_0x128314['config'][_0x3172fa(0x140)]):'',_0x304aaf=_0x128314[_0x3172fa(0x143)][_0x3172fa(0x13b)]?a38_0x43c3fa[_0x3172fa(0x150)]('\x20\x20'+_0x128314[_0x3172fa(0x143)][_0x3172fa(0x13b)]):'';console[_0x3172fa(0x14e)](_0x3172fa(0x142)+_0x128314[_0x3172fa(0x13c)]+_0x287f63+_0x5e7365+_0x304aaf);}return 0x0;}catch(_0x45c6c5){return _0x45c6c5 instanceof Error&&console['error'](_0x3172fa(0x14a)+_0x45c6c5[_0x3172fa(0x13d)]),0x1;}}}
1
+ function a38_0x46fe(_0x41c439,_0x11372d){_0x41c439=_0x41c439-0xcf;const _0x3782f3=a38_0x3782();let _0x46fe63=_0x3782f3[_0x41c439];return _0x46fe63;}const a38_0x287b10=a38_0x46fe;(function(_0x2376e9,_0x1de7bd){const _0x4dd1de=a38_0x46fe,_0x1ed6bd=_0x2376e9();while(!![]){try{const _0x2722b3=-parseInt(_0x4dd1de(0xdf))/0x1*(-parseInt(_0x4dd1de(0xe3))/0x2)+parseInt(_0x4dd1de(0xd0))/0x3*(-parseInt(_0x4dd1de(0xe0))/0x4)+parseInt(_0x4dd1de(0xe5))/0x5+-parseInt(_0x4dd1de(0xdd))/0x6*(-parseInt(_0x4dd1de(0xcf))/0x7)+-parseInt(_0x4dd1de(0xd5))/0x8*(parseInt(_0x4dd1de(0xdc))/0x9)+-parseInt(_0x4dd1de(0xd1))/0xa*(-parseInt(_0x4dd1de(0xd7))/0xb)+-parseInt(_0x4dd1de(0xe8))/0xc;if(_0x2722b3===_0x1de7bd)break;else _0x1ed6bd['push'](_0x1ed6bd['shift']());}catch(_0x5dd2fe){_0x1ed6bd['push'](_0x1ed6bd['shift']());}}}(a38_0x3782,0xdabff));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a38_0xce6e54 from'chalk';function a38_0x3782(){const _0x5c46e3=['667779wVUdLC','58680HLyjlq','Error:\x20','\x20\x20Global:\x20~/.config/tdx/tdx.json','config','1405032qLSQqI','name','1738FdDVJg','map','scope','List\x20all\x20available\x20profiles','site','9QziyDC','4177542jInBOL','message','1sDboYG','32unhNlf','👤\x20','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','221974bDWHYd','profiles','8934925TuJaza','description','execute','8028012PGqvch','green','log','7eSuVCz'];a38_0x3782=function(){return _0x5c46e3;};return a38_0x3782();}export class ProfilesCommand extends BaseCommand{[a38_0x287b10(0xd6)]=a38_0x287b10(0xe4);[a38_0x287b10(0xe6)]=a38_0x287b10(0xda);async[a38_0x287b10(0xe7)](_0x457d67){const _0x43d396=a38_0x287b10,{options:_0x1c019b}=_0x457d67;try{const _0x5b4c27=listProfiles(),_0x43510d=getActiveProfile();if(_0x5b4c27['length']===0x0)return console[_0x43d396(0xea)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console[_0x43d396(0xea)](_0x43d396(0xe2)),console[_0x43d396(0xea)](_0x43d396(0xd3)),0x0;const _0x12e9f7=_0x5b4c27[_0x43d396(0xd8)](_0x201a2b=>{const _0x1ec5f1=_0x43d396,_0x51a2fb=_0x201a2b['name']===_0x43510d,_0x335748=getProfileParams(_0x201a2b[_0x1ec5f1(0xd4)]);return{'name':_0x201a2b['name'],'active':_0x51a2fb,'scope':_0x201a2b[_0x1ec5f1(0xd9)],'description':_0x201a2b[_0x1ec5f1(0xd4)][_0x1ec5f1(0xe6)]||'','params':_0x335748};});if(isStructuredFormat(_0x1c019b))await handleSDKOutput(_0x12e9f7,_0x1c019b);else for(const _0x280fe7 of _0x5b4c27){const _0x412b8f=_0x280fe7[_0x43d396(0xd6)]===_0x43510d?a38_0xce6e54[_0x43d396(0xe9)]('\x20✓'):'',_0x329c6e=_0x280fe7[_0x43d396(0xd4)][_0x43d396(0xdb)]?a38_0xce6e54['dim']('\x20'+_0x280fe7[_0x43d396(0xd4)][_0x43d396(0xdb)]):'',_0x5f41ad=_0x280fe7[_0x43d396(0xd4)][_0x43d396(0xe6)]?a38_0xce6e54['dim']('\x20\x20'+_0x280fe7[_0x43d396(0xd4)][_0x43d396(0xe6)]):'';console[_0x43d396(0xea)](_0x43d396(0xe1)+_0x280fe7[_0x43d396(0xd6)]+_0x412b8f+_0x329c6e+_0x5f41ad);}return 0x0;}catch(_0x40f450){return _0x40f450 instanceof Error&&console['error'](_0x43d396(0xd2)+_0x40f450[_0x43d396(0xde)]),0x1;}}}
@@ -1 +1 @@
1
- const a39_0x2428ba=a39_0x1e90;function a39_0x1e90(_0xed18f0,_0x32e689){_0xed18f0=_0xed18f0-0xeb;const _0x5063a2=a39_0x5063();let _0x1e907b=_0x5063a2[_0xed18f0];return _0x1e907b;}(function(_0x5676fa,_0x432656){const _0x57b7bb=a39_0x1e90,_0x50dded=_0x5676fa();while(!![]){try{const _0x398c3b=parseInt(_0x57b7bb(0xf4))/0x1*(-parseInt(_0x57b7bb(0x103))/0x2)+parseInt(_0x57b7bb(0x100))/0x3*(parseInt(_0x57b7bb(0xeb))/0x4)+parseInt(_0x57b7bb(0xf9))/0x5*(-parseInt(_0x57b7bb(0xf5))/0x6)+parseInt(_0x57b7bb(0x109))/0x7*(parseInt(_0x57b7bb(0xf6))/0x8)+parseInt(_0x57b7bb(0x10f))/0x9*(parseInt(_0x57b7bb(0xf0))/0xa)+parseInt(_0x57b7bb(0x110))/0xb*(parseInt(_0x57b7bb(0xfe))/0xc)+-parseInt(_0x57b7bb(0x116))/0xd;if(_0x398c3b===_0x432656)break;else _0x50dded['push'](_0x50dded['shift']());}catch(_0x29f42f){_0x50dded['push'](_0x50dded['shift']());}}}(a39_0x5063,0xe72ff));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 a39_0x5063(){const _0x315124=['information_schema','2523404LZXKTi','SQL:\x20','processedRows','completedSplits','\x20splits','\x20-\x20','verbose','14220cXxtCB','file','Executing\x20query...','setPhase','execute','722430hXrMes','options','Query\x20completed:\x20Processed\x20','join','750473tNHRAV','4037622LzqfGj','683632mJvudA','message','Error:\x20','5XafAoF','output','Executing\x20query\x20[','originalMessage','state','12raxZmX','Schema:\x20','555fgUvob','\x20rows\x20','query','2HJwWJq','Statement\x20','setJobId','\x20[Job\x20ID:\x20','catalog','length','21VcdTEJ','Executing\x20statement\x20','error','elapsedTimeMillis','\x0aAll\x20results\x20saved\x20to\x20','Run\x20Trino\x20queries\x20(streaming)','45TNIKrr','14181299USeYFl','Catalog:\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','jobId','description'];a39_0x5063=function(){return _0x315124;};return a39_0x5063();}export class QueryCommand extends BaseCommand{['name']='query';[a39_0x2428ba(0x114)]=a39_0x2428ba(0x10e);async[a39_0x2428ba(0xef)](_0x3dd691){const _0x59fc05=a39_0x2428ba,{options:_0x2d289f,args:_0x1293f5,tdx:_0x53a2b5}=_0x3dd691,_0x679ce2={..._0x2d289f,'limitStructuredFormats':!![]},_0x21d16f=_0x1293f5[0x0],_0x1e3d58=_0x2d289f['file'];let _0x55f71a;try{if(_0x1e3d58)_0x55f71a=readSqlStatementsFromFile(_0x1e3d58);else{if(_0x21d16f==='-')_0x55f71a=await readSqlStatementsFromStdin();else{if(_0x21d16f&&isSqlFilePath(_0x21d16f))_0x55f71a=readSqlStatementsFromFile(_0x21d16f);else{if(_0x21d16f)_0x55f71a=splitSqlStatements(_0x21d16f);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x363e38){return console[_0x59fc05(0x10b)](_0x59fc05(0xf8)+_0x363e38[_0x59fc05(0xf7)]),0x1;}const _0x37a3d9=_0x2d289f['database']||_0x59fc05(0x115),_0x4f44c6=_0x2d289f[_0x59fc05(0x107)];try{const _0x4aff49=[],_0x44f97e=!!_0x2d289f['output'];for(let _0x110c3a=0x0;_0x110c3a<_0x55f71a[_0x59fc05(0x108)];_0x110c3a++){const _0xd3f772=_0x55f71a[_0x110c3a],_0x4cd116=_0x110c3a+0x1,_0x9f06e7=_0x55f71a[_0x59fc05(0x108)],_0x11fdbb=_0x9f06e7>0x1;_0x2d289f['verbose']&&(console['error']('\x0a'+(_0x11fdbb?_0x59fc05(0x104)+_0x4cd116+'/'+_0x9f06e7+':':'')),console['error']('Site:\x20'+_0x2d289f['site']),console[_0x59fc05(0x10b)](_0x59fc05(0x111)+(_0x4f44c6||'td')),console[_0x59fc05(0x10b)](_0x59fc05(0xff)+_0x37a3d9),console[_0x59fc05(0x10b)](_0x59fc05(0x117)+_0xd3f772));const _0x24d56c=_0x11fdbb?_0x59fc05(0x10a)+_0x4cd116+'/'+_0x9f06e7+'...':_0x59fc05(0xed);try{const _0x2e30cd=await withProgressSpinner(_0x24d56c,async _0x174870=>{const _0xda4ed2=_0x59fc05,_0x49ebd0=await _0x53a2b5[_0xda4ed2(0x102)]['execute'](_0xd3f772,{'catalog':_0x4f44c6,'schema':_0x37a3d9,'onJobId':_0x839fe0=>{const _0x9d828b=_0xda4ed2;_0x174870[_0x9d828b(0x105)](_0x839fe0);},'onProgress':_0x3929cb=>{const _0x2e19fa=_0xda4ed2;_0x174870[_0x2e19fa(0xee)](_0x2e19fa(0xfb)+_0x3929cb[_0x2e19fa(0xfd)]+']'),_0x174870['setExtra'](formatRows(_0x3929cb['processedRows'])+'\x20rows\x20'+_0x3929cb[_0x2e19fa(0x119)]+'/'+_0x3929cb['totalSplits']+_0x2e19fa(0x11a));}});return _0x49ebd0;},{'verbose':_0x2d289f[_0x59fc05(0x11c)]}),_0x3ec853=_0x2e30cd['data'],_0x274a08=_0x3ec853['jobId']?_0x59fc05(0x106)+_0x3ec853[_0x59fc05(0x113)]+']':'',_0x55b4dc=_0x11fdbb?_0x59fc05(0x104)+_0x4cd116+'/'+_0x9f06e7+_0x59fc05(0x11b):'';console[_0x59fc05(0x10b)]('✔\x20'+_0x55b4dc+_0x59fc05(0xf2)+formatRows(_0x3ec853['stats'][_0x59fc05(0x118)])+_0x59fc05(0x101)+('in\x20'+formatElapsed(_0x3ec853['stats'][_0x59fc05(0x10c)])+_0x274a08));if(_0x11fdbb&&_0x44f97e){const _0x22b011=resolveOutputOptions(_0x679ce2),_0x4a1596=await formatQueryOutput(_0x3ec853,_0x22b011);_0x4aff49['push'](_0x4a1596);}else await handleQueryOutput(_0x3ec853,_0x679ce2);}catch(_0x4027a8){const _0x1c8382=_0x11fdbb?_0x59fc05(0x104)+_0x4cd116+'/'+_0x9f06e7+':\x0a':'',_0x59c6fa=_0x4027a8 instanceof SDKError?_0x4027a8[_0x59fc05(0xfc)]:_0x4027a8[_0x59fc05(0xf7)];return console['error'](''+_0x1c8382+_0x59c6fa),0x1;}}if(_0x55f71a['length']>0x1&&_0x44f97e&&_0x4aff49['length']>0x0){const _0xba1c70=_0x4aff49[_0x59fc05(0xf3)]('\x0a');writeFileSync(_0x2d289f[_0x59fc05(0xfa)],_0xba1c70),console[_0x59fc05(0x10b)](_0x59fc05(0x10d)+_0x2d289f[_0x59fc05(0xfa)]);}return 0x0;}catch(_0x11f53c){throw _0x11f53c;}}['validate'](_0x468392){const _0xf02522=a39_0x2428ba,_0x339dd9=_0x468392['args'][0x0],_0x15fe6e=_0x468392[_0xf02522(0xf1)][_0xf02522(0xec)];if(!_0x339dd9&&!_0x15fe6e)return'Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options';if(_0x339dd9&&_0x15fe6e)return _0xf02522(0x112);return undefined;}}
1
+ const a39_0x124a51=a39_0x18c6;(function(_0x79ee40,_0x7b68e){const _0x6a9b36=a39_0x18c6,_0x1ae8d7=_0x79ee40();while(!![]){try{const _0x122de2=parseInt(_0x6a9b36(0x82))/0x1+-parseInt(_0x6a9b36(0xa5))/0x2*(-parseInt(_0x6a9b36(0x84))/0x3)+parseInt(_0x6a9b36(0xb3))/0x4+-parseInt(_0x6a9b36(0x91))/0x5*(-parseInt(_0x6a9b36(0x8e))/0x6)+-parseInt(_0x6a9b36(0xa2))/0x7*(-parseInt(_0x6a9b36(0x98))/0x8)+parseInt(_0x6a9b36(0xa8))/0x9*(parseInt(_0x6a9b36(0x92))/0xa)+-parseInt(_0x6a9b36(0x9e))/0xb;if(_0x122de2===_0x7b68e)break;else _0x1ae8d7['push'](_0x1ae8d7['shift']());}catch(_0x20961c){_0x1ae8d7['push'](_0x1ae8d7['shift']());}}}(a39_0x17d7,0x92b4f));import{BaseCommand}from'./command.js';function a39_0x18c6(_0x475298,_0x1243b9){_0x475298=_0x475298-0x7e;const _0x17d7e6=a39_0x17d7();let _0x18c6cb=_0x17d7e6[_0x475298];return _0x18c6cb;}function a39_0x17d7(){const _0x44bf78=['totalSplits','data','args','SQL:\x20','Statement\x20','4288684kxYMwq','validate','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','state','length','1143495JDPeFp','\x0aAll\x20results\x20saved\x20to\x20','3QvAWkP','information_schema','originalMessage','stats','Schema:\x20','Error:\x20','\x20splits','elapsedTimeMillis','Run\x20Trino\x20queries\x20(streaming)','completedSplits','6lrMGuE','in\x20','execute','3037235MTuSZs','9443310MvLezt','jobId','error','...','setJobId','Catalog:\x20','131592LNAvJe','options','output','processedRows','site','database','45684331EXbVzD','query','Executing\x20statement\x20','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','371NesNxW','Site:\x20','file','229582KqIlcY','verbose','setExtra','9Pcyebs','\x20[Job\x20ID:\x20','setPhase','Executing\x20query\x20[','name','\x20rows\x20'];a39_0x17d7=function(){return _0x44bf78;};return a39_0x17d7();}import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a39_0x124a51(0xac)]=a39_0x124a51(0x9f);['description']=a39_0x124a51(0x8c);async[a39_0x124a51(0x90)](_0x382033){const _0x24dba3=a39_0x124a51,{options:_0x18d030,args:_0x5cdf65,tdx:_0x29b9ea}=_0x382033,_0x359cfb={..._0x18d030,'limitStructuredFormats':!![]},_0x369d25=_0x5cdf65[0x0],_0x3db4c4=_0x18d030[_0x24dba3(0xa4)];let _0x28d4e9;try{if(_0x3db4c4)_0x28d4e9=readSqlStatementsFromFile(_0x3db4c4);else{if(_0x369d25==='-')_0x28d4e9=await readSqlStatementsFromStdin();else{if(_0x369d25&&isSqlFilePath(_0x369d25))_0x28d4e9=readSqlStatementsFromFile(_0x369d25);else{if(_0x369d25)_0x28d4e9=splitSqlStatements(_0x369d25);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x5884a1){return console[_0x24dba3(0x94)](_0x24dba3(0x89)+_0x5884a1['message']),0x1;}const _0x473fde=_0x18d030[_0x24dba3(0x9d)]||_0x24dba3(0x85),_0x34b93d=_0x18d030['catalog'];try{const _0x9fecd4=[],_0x1588ad=!!_0x18d030[_0x24dba3(0x9a)];for(let _0x368f69=0x0;_0x368f69<_0x28d4e9[_0x24dba3(0x81)];_0x368f69++){const _0x471360=_0x28d4e9[_0x368f69],_0x21ed6b=_0x368f69+0x1,_0x25ca7d=_0x28d4e9[_0x24dba3(0x81)],_0x1e4126=_0x25ca7d>0x1;_0x18d030[_0x24dba3(0xa6)]&&(console[_0x24dba3(0x94)]('\x0a'+(_0x1e4126?'Statement\x20'+_0x21ed6b+'/'+_0x25ca7d+':':'')),console[_0x24dba3(0x94)](_0x24dba3(0xa3)+_0x18d030[_0x24dba3(0x9c)]),console[_0x24dba3(0x94)](_0x24dba3(0x97)+(_0x34b93d||'td')),console['error'](_0x24dba3(0x88)+_0x473fde),console[_0x24dba3(0x94)](_0x24dba3(0xb1)+_0x471360));const _0x49a4f8=_0x1e4126?_0x24dba3(0xa0)+_0x21ed6b+'/'+_0x25ca7d+_0x24dba3(0x95):'Executing\x20query...';try{const _0x4298f6=await withProgressSpinner(_0x49a4f8,async _0x570782=>{const _0x112944=_0x24dba3,_0x39a507=await _0x29b9ea[_0x112944(0x9f)][_0x112944(0x90)](_0x471360,{'catalog':_0x34b93d,'schema':_0x473fde,'onJobId':_0x138c38=>{const _0x139aa8=_0x112944;_0x570782[_0x139aa8(0x96)](_0x138c38);},'onProgress':_0x43ad95=>{const _0x221f4c=_0x112944;_0x570782[_0x221f4c(0xaa)](_0x221f4c(0xab)+_0x43ad95[_0x221f4c(0x80)]+']'),_0x570782[_0x221f4c(0xa7)](formatRows(_0x43ad95[_0x221f4c(0x9b)])+_0x221f4c(0xad)+_0x43ad95[_0x221f4c(0x8d)]+'/'+_0x43ad95[_0x221f4c(0xae)]+_0x221f4c(0x8a));}});return _0x39a507;},{'verbose':_0x18d030['verbose']}),_0x317734=_0x4298f6[_0x24dba3(0xaf)],_0x141d93=_0x317734[_0x24dba3(0x93)]?_0x24dba3(0xa9)+_0x317734[_0x24dba3(0x93)]+']':'',_0x216bd1=_0x1e4126?_0x24dba3(0xb2)+_0x21ed6b+'/'+_0x25ca7d+'\x20-\x20':'';console[_0x24dba3(0x94)]('✔\x20'+_0x216bd1+'Query\x20completed:\x20Processed\x20'+formatRows(_0x317734[_0x24dba3(0x87)][_0x24dba3(0x9b)])+_0x24dba3(0xad)+(_0x24dba3(0x8f)+formatElapsed(_0x317734[_0x24dba3(0x87)][_0x24dba3(0x8b)])+_0x141d93));if(_0x1e4126&&_0x1588ad){const _0x572860=resolveOutputOptions(_0x359cfb),_0x1cbb5b=await formatQueryOutput(_0x317734,_0x572860);_0x9fecd4['push'](_0x1cbb5b);}else await handleQueryOutput(_0x317734,_0x359cfb);}catch(_0x48ed09){const _0x542a2d=_0x1e4126?'Statement\x20'+_0x21ed6b+'/'+_0x25ca7d+':\x0a':'',_0x1d4a8e=_0x48ed09 instanceof SDKError?_0x48ed09[_0x24dba3(0x86)]:_0x48ed09['message'];return console[_0x24dba3(0x94)](''+_0x542a2d+_0x1d4a8e),0x1;}}if(_0x28d4e9[_0x24dba3(0x81)]>0x1&&_0x1588ad&&_0x9fecd4['length']>0x0){const _0x3630a5=_0x9fecd4['join']('\x0a');writeFileSync(_0x18d030[_0x24dba3(0x9a)],_0x3630a5),console[_0x24dba3(0x94)](_0x24dba3(0x83)+_0x18d030[_0x24dba3(0x9a)]);}return 0x0;}catch(_0x2c763c){throw _0x2c763c;}}[a39_0x124a51(0x7e)](_0x12c6fb){const _0x3a3cde=a39_0x124a51,_0x3e20c2=_0x12c6fb[_0x3a3cde(0xb0)][0x0],_0xf61647=_0x12c6fb[_0x3a3cde(0x99)][_0x3a3cde(0xa4)];if(!_0x3e20c2&&!_0xf61647)return _0x3a3cde(0xa1);if(_0x3e20c2&&_0xf61647)return _0x3a3cde(0x7f);return undefined;}}
@@ -1 +1 @@
1
- const a40_0x3ce7ae=a40_0x292b;(function(_0x1938b6,_0x3d955e){const _0x4f2410=a40_0x292b,_0x506c2d=_0x1938b6();while(!![]){try{const _0x1842ad=parseInt(_0x4f2410(0x1d7))/0x1+parseInt(_0x4f2410(0x1f6))/0x2*(parseInt(_0x4f2410(0x1ce))/0x3)+parseInt(_0x4f2410(0x1be))/0x4*(parseInt(_0x4f2410(0x1c0))/0x5)+-parseInt(_0x4f2410(0x217))/0x6*(parseInt(_0x4f2410(0x1c2))/0x7)+parseInt(_0x4f2410(0x213))/0x8*(-parseInt(_0x4f2410(0x212))/0x9)+-parseInt(_0x4f2410(0x1ba))/0xa*(parseInt(_0x4f2410(0x22c))/0xb)+-parseInt(_0x4f2410(0x223))/0xc*(-parseInt(_0x4f2410(0x1ed))/0xd);if(_0x1842ad===_0x3d955e)break;else _0x506c2d['push'](_0x506c2d['shift']());}catch(_0x519051){_0x506c2d['push'](_0x506c2d['shift']());}}}(a40_0x71f7,0xd5d2e));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';function a40_0x71f7(){const _0x5c0927=['trino','\x20\x20Time:\x20','keys','Failed\x20to\x20read\x20file:\x20','just\x20now','Cancelled','h\x20ago','json','Update\x20a\x20scheduled\x20query','Delete\x20a\x20scheduled\x20query','queryUrl','validate','\x20\x20Type:\x20','\x20schedules','Getting\x20schedule\x20details...','last_job','delay','from','cyan','📅\x20','d\x20ago','show','INVALID_ARGUMENT','end_at','Creating\x20schedule...','List\x20scheduled\x20queries','execute','Getting\x20schedule\x20history...','dim','verbose','file','\x22...','(unnamed)','jobs','9900230UBzovq','Found\x20','priority','job_id','126428WsvjkY','/app/queries/editor?queryId=','245pwaJLe','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','21GMLMIr','\x20\x20Job\x20ID:\x20','time_zone','\x20job','output','yes','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','never','Creating\x20schedule:\x20','entries','Schedule\x20deleted:\x20','updated_at','3EPkXTy','...','Searching\x20scheduled\x20queries\x20matching\x20\x22','error','args','query','list','\x20(showing\x20','\x20(use\x20--limit\x20to\x20see\x20more)','326242QsrDee','trim','pagination','schedules','m\x20ago','database','listQueries','user_name','site','getTime','schedule:create','status','Deleting\x20schedule...','create','round','schedule:run','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','type','format','description','\x20\x20Num:\x20','engine_version','74477GfhQYh','\x20created','\x20\x20Database:\x20','padEnd','Query\x20file\x20is\x20empty','time','green','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','has_next_page','1372710dQXlyB','\x20scheduled\x20quer','Updating\x20schedule...','queries','\x20\x20Cron:\x20','ies','lastRun','in\x20','retryLimit','join','max','Create\x20a\x20scheduled\x20query','Show\x20schedule\x20execution\x20history','success','ended_at','\x20matching\x20\x22','nextRun','scheduled_at','run','timezone','cron','retry_limit','engineVersion','Schedule\x20created:\x20','red','No\x20scheduled\x20queries\x20found','count','\x20\x20Timezone:\x20','9nVxAoe','1711408ZRcmjq','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','executing_user_id','data','3403692oqtHXL','created_at','Running\x20schedule:\x20','schedule:show','tsv','name','Run\x20a\x20scheduled\x20query\x20immediately','Listing\x20scheduled\x20queries...','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','num','map','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','2556EIVjKS','history','Schedule\x20updated:\x20','statusIcon','Schedule\x20run\x20submitted:\x20','schedule:delete','result','Updating\x20schedule:\x20','substring','11KOPScY','length','utf-8'];a40_0x71f7=function(){return _0x5c0927;};return a40_0x71f7();}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 a40_0xa953bb from'chalk';function formatRelativeTime(_0x5c22cc){const _0x40c379=a40_0x292b,_0x4415dd=new Date(_0x5c22cc),_0xfdf740=new Date(),_0x217f8c=_0x4415dd[_0x40c379(0x1e0)]()-_0xfdf740['getTime'](),_0x209bcb=Math['abs'](_0x217f8c)/0x3e8,_0x46c932=_0x217f8c<0x0;if(_0x209bcb<0x3c)return _0x46c932?_0x40c379(0x233):'soon';else{if(_0x209bcb<0xe10){const _0x30bee4=Math['round'](_0x209bcb/0x3c);return _0x46c932?_0x30bee4+_0x40c379(0x1db):_0x40c379(0x1fd)+_0x30bee4+'m';}else{if(_0x209bcb<0x15180){const _0x1174f5=Math[_0x40c379(0x1e5)](_0x209bcb/0xe10);return _0x46c932?_0x1174f5+_0x40c379(0x235):'in\x20'+_0x1174f5+'h';}else{if(_0x209bcb<0x93a80){const _0x49c856=Math[_0x40c379(0x1e5)](_0x209bcb/0x15180);return _0x46c932?_0x49c856+_0x40c379(0x243):_0x40c379(0x1fd)+_0x49c856+'d';}else return _0x4415dd['toLocaleDateString']();}}}}export class ScheduleListCommand extends BaseCommand{[a40_0x3ce7ae(0x21c)]='schedule:list';[a40_0x3ce7ae(0x1ea)]=a40_0x3ce7ae(0x248);async[a40_0x3ce7ae(0x249)](_0x2ee6ce){const _0x3c7e3f=a40_0x3ce7ae,{options:_0x1d872f,args:_0x412b2b,tdx:_0x39111f}=_0x2ee6ce,_0x3b8173=resolveLimit(_0x1d872f['limit'],DEFAULT_DISPLAY_LIMIT),_0xe5d3bf=_0x412b2b[0x0],_0x566b31=_0xe5d3bf?_0x3c7e3f(0x1d0)+_0xe5d3bf+_0x3c7e3f(0x24e):_0x3c7e3f(0x21e),_0x51725a=await withSpinner(_0x566b31,()=>_0x39111f[_0x3c7e3f(0x1da)][_0x3c7e3f(0x1dd)]({'limit':_0x3b8173,'scheduled':!![],'pattern':_0xe5d3bf}),{'verbose':_0x1d872f[_0x3c7e3f(0x24c)]}),_0x4e03af=_0x51725a[_0x3c7e3f(0x216)][_0x3c7e3f(0x1f9)],_0x24b5a0=_0x51725a[_0x3c7e3f(0x216)][_0x3c7e3f(0x1d9)][_0x3c7e3f(0x1f5)],_0x4c26d2=_0xe5d3bf?_0x3c7e3f(0x205)+_0xe5d3bf+'\x22':'';_0x24b5a0?console[_0x3c7e3f(0x1d1)]('Showing\x20first\x20'+_0x4e03af[_0x3c7e3f(0x22d)]+_0x3c7e3f(0x23c)+_0x4c26d2+_0x3c7e3f(0x1d6)):console['error'](_0x3c7e3f(0x1bb)+_0x4e03af[_0x3c7e3f(0x22d)]+_0x3c7e3f(0x1f7)+(_0x4e03af[_0x3c7e3f(0x22d)]!==0x1?_0x3c7e3f(0x1fb):'y')+_0x4c26d2);if(_0x1d872f['format']===_0x3c7e3f(0x236)||_0x1d872f['format']==='jsonl'||_0x1d872f[_0x3c7e3f(0x1e9)]==='table'||_0x1d872f[_0x3c7e3f(0x1e9)]===_0x3c7e3f(0x21b)){const _0x41703a=_0x4e03af[_0x3c7e3f(0x221)](_0xe66b2d=>({'id':_0xe66b2d['id'],'name':_0xe66b2d[_0x3c7e3f(0x21c)],'cron':_0xe66b2d['cron'],'database':_0xe66b2d[_0x3c7e3f(0x1dc)]?.[_0x3c7e3f(0x21c)],'type':_0xe66b2d[_0x3c7e3f(0x1e8)],'timezone':_0xe66b2d[_0x3c7e3f(0x1c4)],'user_name':_0xe66b2d['user']?.[_0x3c7e3f(0x21c)],'updated_at':_0xe66b2d[_0x3c7e3f(0x1cd)],'next_run_at':_0xe66b2d['next_run_at'],'last_job_status':_0xe66b2d[_0x3c7e3f(0x23e)]?.['status']}));await handleSDKOutput(_0x41703a,_0x1d872f);}else{if(_0x4e03af[_0x3c7e3f(0x22d)]===0x0)console['log'](_0x3c7e3f(0x20f));else{const _0x1b0685=_0x1d872f[_0x3c7e3f(0x1df)],_0x479384=_0x4e03af['map'](_0x1333b=>{const _0x404bbc=_0x3c7e3f,_0x472d76=_0x1333b[_0x404bbc(0x23e)]?.[_0x404bbc(0x1e2)]?_0x1333b[_0x404bbc(0x23e)][_0x404bbc(0x1e2)]===_0x404bbc(0x203)?'✓':'✗':'-',_0x177cb6=_0x1333b['last_job']?.[_0x404bbc(0x204)]?formatRelativeTime(_0x1333b[_0x404bbc(0x23e)][_0x404bbc(0x204)]):_0x404bbc(0x1c9),_0x130915=_0x1333b['next_run_at']?formatRelativeTime(_0x1333b['next_run_at']):'-',_0x753dc4=_0x1333b[_0x404bbc(0x20a)]||'',_0x199793=_0x1333b['name']||_0x404bbc(0x24f),_0x161e2a=getConsoleUrl(_0x1b0685,_0x404bbc(0x1bf)+_0x1333b['id']);return{'statusIcon':_0x472d76,'lastRun':_0x177cb6,'nextRun':_0x130915,'cron':_0x753dc4,'name':_0x199793,'queryUrl':_0x161e2a,'status':_0x1333b[_0x404bbc(0x23e)]?.[_0x404bbc(0x1e2)]};}),_0x426cd3=Math[_0x3c7e3f(0x200)](..._0x479384[_0x3c7e3f(0x221)](_0x5a86ed=>_0x5a86ed[_0x3c7e3f(0x1fc)][_0x3c7e3f(0x22d)])),_0x25bc09=Math['max'](..._0x479384[_0x3c7e3f(0x221)](_0x3ceb18=>_0x3ceb18[_0x3c7e3f(0x206)]['length'])),_0x1552bf=Math['max'](..._0x479384['map'](_0x5af56d=>_0x5af56d[_0x3c7e3f(0x20a)][_0x3c7e3f(0x22d)])),_0xd57805=_0x479384[_0x3c7e3f(0x221)](_0x29def3=>{const _0x29ef0b=_0x3c7e3f,_0x759712=_0x29def3[_0x29ef0b(0x1e2)]==='success'?a40_0xa953bb[_0x29ef0b(0x1f3)](_0x29def3[_0x29ef0b(0x226)]):_0x29def3[_0x29ef0b(0x1e2)]===_0x29ef0b(0x1d1)?a40_0xa953bb[_0x29ef0b(0x20e)](_0x29def3[_0x29ef0b(0x226)]):a40_0xa953bb[_0x29ef0b(0x24b)](_0x29def3[_0x29ef0b(0x226)]),_0x2075ef=_0x29def3[_0x29ef0b(0x1fc)][_0x29ef0b(0x1f0)](_0x426cd3),_0x45cde7=_0x29def3[_0x29ef0b(0x206)][_0x29ef0b(0x1f0)](_0x25bc09),_0x49937c=_0x29def3[_0x29ef0b(0x20a)]?a40_0xa953bb[_0x29ef0b(0x241)](_0x29def3['cron'][_0x29ef0b(0x1f0)](_0x1552bf)):'\x20'['repeat'](_0x1552bf),_0x95d669=hyperlink(_0x29def3[_0x29ef0b(0x21c)],_0x29def3[_0x29ef0b(0x239)]);return _0x29ef0b(0x242)+_0x759712+'\x20'+_0x2075ef+'\x20\x20→\x20'+_0x45cde7+'\x20\x20'+_0x49937c+'\x20\x20'+_0x95d669;});await writeOutput(_0xd57805[_0x3c7e3f(0x1ff)]('\x0a'),_0x1d872f[_0x3c7e3f(0x1c6)],_0x3c7e3f(0x1d4));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a40_0x3ce7ae(0x21c)]=a40_0x3ce7ae(0x21a);[a40_0x3ce7ae(0x1ea)]='Show\x20schedule\x20details';[a40_0x3ce7ae(0x23a)](_0x32e56c){const _0x48a64a=a40_0x3ce7ae,_0x1ccf85=_0x32e56c['args'][0x0];if(!_0x1ccf85)return _0x48a64a(0x1c8);return undefined;}async[a40_0x3ce7ae(0x249)](_0x2b6216){const _0x3cfeff=a40_0x3ce7ae,{options:_0x180b94,args:_0x546b98,tdx:_0x3a7f78}=_0x2b6216,_0x563f3d=_0x546b98[0x0],_0x1422e1=await withSpinner(_0x3cfeff(0x23d),()=>_0x3a7f78[_0x3cfeff(0x1da)][_0x3cfeff(0x244)](_0x563f3d),{'verbose':_0x180b94[_0x3cfeff(0x24c)]}),_0x95e9a0=_0x1422e1['data'],_0x359e36={'name':_0x95e9a0['name'],'cron':_0x95e9a0[_0x3cfeff(0x20a)],'database':_0x95e9a0[_0x3cfeff(0x1dc)],'type':_0x95e9a0['type'],'timezone':_0x95e9a0[_0x3cfeff(0x209)],'user_name':_0x95e9a0[_0x3cfeff(0x1de)],'created_at':_0x95e9a0[_0x3cfeff(0x218)],'engine_version':_0x95e9a0[_0x3cfeff(0x1ec)],'executing_user_id':_0x95e9a0[_0x3cfeff(0x215)],'query':_0x95e9a0['query'],'delay':_0x95e9a0[_0x3cfeff(0x23f)],'priority':_0x95e9a0[_0x3cfeff(0x1bc)],'retry_limit':_0x95e9a0[_0x3cfeff(0x20b)],..._0x95e9a0[_0x3cfeff(0x229)]&&{'result':_0x95e9a0['result']}};return await handleSingleObjectOutput(_0x359e36,_0x180b94),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']=a40_0x3ce7ae(0x1e1);['description']=a40_0x3ce7ae(0x201);[a40_0x3ce7ae(0x23a)](_0x2b106d){const _0x9046ef=a40_0x3ce7ae,_0xa779c8=_0x2b106d[_0x9046ef(0x1d2)][0x0];if(!_0xa779c8)return _0x9046ef(0x21f);const _0x4621f6=_0x2b106d['options'];if(!_0x4621f6[_0x9046ef(0x1dc)])return'Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';return undefined;}async[a40_0x3ce7ae(0x249)](_0x1e82a8){const _0x1ce623=a40_0x3ce7ae,{options:_0x49ea3c,args:_0xd338b1,tdx:_0x2cd646}=_0x1e82a8,_0x21de17=_0xd338b1[0x0],_0x13f42d=_0x49ea3c,_0x39e74d=_0x13f42d['database'],_0x58ae87=_0x13f42d[_0x1ce623(0x24d)],_0x178a21=_0x13f42d[_0x1ce623(0x1e8)]||_0x1ce623(0x22f);let _0x3ff0f9;try{_0x3ff0f9=readFileSync(_0x58ae87,_0x1ce623(0x22e))[_0x1ce623(0x1d8)]();}catch(_0x4350e3){throw new SDKError(ErrorCode[_0x1ce623(0x245)],_0x1ce623(0x232)+_0x58ae87,_0x4350e3 instanceof Error?_0x4350e3:undefined);}if(!_0x3ff0f9)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1ce623(0x1f1));const _0x35eaf4={'database':_0x39e74d,'query':_0x3ff0f9,'type':_0x178a21};if(_0x13f42d[_0x1ce623(0x20a)])_0x35eaf4[_0x1ce623(0x20a)]=_0x13f42d[_0x1ce623(0x20a)];if(_0x13f42d['timezone'])_0x35eaf4[_0x1ce623(0x209)]=_0x13f42d[_0x1ce623(0x209)];if(_0x13f42d[_0x1ce623(0x23f)]!==undefined)_0x35eaf4['delay']=Number(_0x13f42d['delay']);if(_0x13f42d[_0x1ce623(0x1bc)]!==undefined)_0x35eaf4[_0x1ce623(0x1bc)]=Number(_0x13f42d['priority']);if(_0x13f42d[_0x1ce623(0x1fe)]!==undefined)_0x35eaf4[_0x1ce623(0x20b)]=Number(_0x13f42d[_0x1ce623(0x1fe)]);if(_0x13f42d[_0x1ce623(0x20c)])_0x35eaf4[_0x1ce623(0x1ec)]=_0x13f42d['engineVersion'];if(_0x13f42d[_0x1ce623(0x229)])_0x35eaf4['result']=_0x13f42d[_0x1ce623(0x229)];if(_0x49ea3c[_0x1ce623(0x24c)]){console[_0x1ce623(0x1d1)](_0x1ce623(0x1ca)+_0x21de17),console[_0x1ce623(0x1d1)](_0x1ce623(0x1ef)+_0x39e74d),console[_0x1ce623(0x1d1)](_0x1ce623(0x23b)+_0x178a21);if(_0x35eaf4[_0x1ce623(0x20a)])console[_0x1ce623(0x1d1)](_0x1ce623(0x1fa)+_0x35eaf4[_0x1ce623(0x20a)]);if(_0x35eaf4[_0x1ce623(0x209)])console[_0x1ce623(0x1d1)](_0x1ce623(0x211)+_0x35eaf4[_0x1ce623(0x209)]);}const _0x23b6c1=await withSpinner(_0x1ce623(0x247),()=>_0x2cd646[_0x1ce623(0x1da)][_0x1ce623(0x1e4)](_0x21de17,_0x35eaf4),{'verbose':_0x49ea3c[_0x1ce623(0x24c)]});return console[_0x1ce623(0x1d1)](_0x1ce623(0x20d)+_0x23b6c1[_0x1ce623(0x216)]['name']),await handleSingleObjectOutput(_0x23b6c1['data'],_0x49ea3c),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a40_0x3ce7ae(0x21c)]='schedule:update';[a40_0x3ce7ae(0x1ea)]=a40_0x3ce7ae(0x237);['validate'](_0x5d7344){const _0x1edfce=a40_0x3ce7ae,_0x128723=_0x5d7344[_0x1edfce(0x1d2)][0x0];if(!_0x128723)return _0x1edfce(0x214);return undefined;}async[a40_0x3ce7ae(0x249)](_0x2588bc){const _0x396881=a40_0x3ce7ae,{options:_0x39f86c,args:_0x1e345d,tdx:_0x5dfd47}=_0x2588bc,_0x5dab1a=_0x1e345d[0x0],_0xf5345d=_0x39f86c,_0x1e54aa={};if(_0xf5345d[_0x396881(0x1dc)])_0x1e54aa[_0x396881(0x1dc)]=_0xf5345d[_0x396881(0x1dc)];if(_0xf5345d['type'])_0x1e54aa[_0x396881(0x1e8)]=_0xf5345d[_0x396881(0x1e8)];if(_0xf5345d[_0x396881(0x20a)])_0x1e54aa[_0x396881(0x20a)]=_0xf5345d[_0x396881(0x20a)];if(_0xf5345d[_0x396881(0x209)])_0x1e54aa[_0x396881(0x209)]=_0xf5345d[_0x396881(0x209)];if(_0xf5345d[_0x396881(0x23f)]!==undefined)_0x1e54aa[_0x396881(0x23f)]=Number(_0xf5345d[_0x396881(0x23f)]);if(_0xf5345d[_0x396881(0x1bc)]!==undefined)_0x1e54aa[_0x396881(0x1bc)]=Number(_0xf5345d['priority']);if(_0xf5345d[_0x396881(0x1fe)]!==undefined)_0x1e54aa[_0x396881(0x20b)]=Number(_0xf5345d[_0x396881(0x1fe)]);if(_0xf5345d[_0x396881(0x20c)])_0x1e54aa['engine_version']=_0xf5345d['engineVersion'];if(_0xf5345d['result'])_0x1e54aa[_0x396881(0x229)]=_0xf5345d['result'];if(_0xf5345d['file'])try{_0x1e54aa[_0x396881(0x1d3)]=readFileSync(_0xf5345d[_0x396881(0x24d)],_0x396881(0x22e))[_0x396881(0x1d8)]();}catch(_0x961387){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x396881(0x232)+_0xf5345d[_0x396881(0x24d)],_0x961387 instanceof Error?_0x961387:undefined);}if(Object[_0x396881(0x231)](_0x1e54aa)[_0x396881(0x22d)]===0x0)throw new SDKError(ErrorCode[_0x396881(0x245)],_0x396881(0x1c1));if(_0x39f86c['verbose']){console[_0x396881(0x1d1)](_0x396881(0x22a)+_0x5dab1a);for(const [_0x43b57f,_0x57b34d]of Object[_0x396881(0x1cb)](_0x1e54aa)){_0x43b57f==='query'?console[_0x396881(0x1d1)]('\x20\x20'+_0x43b57f+':\x20'+_0x57b34d[_0x396881(0x22b)](0x0,0x32)+_0x396881(0x1cf)):console[_0x396881(0x1d1)]('\x20\x20'+_0x43b57f+':\x20'+_0x57b34d);}}const _0x282bb5=await withSpinner(_0x396881(0x1f8),()=>_0x5dfd47[_0x396881(0x1da)]['update'](_0x5dab1a,_0x1e54aa),{'verbose':_0x39f86c[_0x396881(0x24c)]});return console[_0x396881(0x1d1)](_0x396881(0x225)+_0x282bb5[_0x396881(0x216)]['name']),await handleSingleObjectOutput(_0x282bb5[_0x396881(0x216)],_0x39f86c),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a40_0x3ce7ae(0x21c)]=a40_0x3ce7ae(0x228);[a40_0x3ce7ae(0x1ea)]=a40_0x3ce7ae(0x238);[a40_0x3ce7ae(0x23a)](_0x14858a){const _0x2a82cb=a40_0x3ce7ae,_0x527085=_0x14858a[_0x2a82cb(0x1d2)][0x0];if(!_0x527085)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async[a40_0x3ce7ae(0x249)](_0x41e798){const _0x5db8c5=a40_0x3ce7ae,{options:_0x2b0904,args:_0x244bd9,tdx:_0x2b3811}=_0x41e798,_0x407813=_0x244bd9[0x0];if(!_0x2b0904[_0x5db8c5(0x1c7)]){const _0xbe2587=await confirm(_0x5db8c5(0x1f4)+_0x407813+'\x22?');if(!_0xbe2587)return console[_0x5db8c5(0x1d1)](_0x5db8c5(0x234)),0x0;}const _0x19d2cc=await withSpinner(_0x5db8c5(0x1e3),()=>_0x2b3811[_0x5db8c5(0x1da)]['delete'](_0x407813),{'verbose':_0x2b0904[_0x5db8c5(0x24c)]});return console[_0x5db8c5(0x1d1)](_0x5db8c5(0x1cc)+_0x19d2cc['data'][_0x5db8c5(0x21c)]),0x0;}}function a40_0x292b(_0x57f798,_0x56817e){_0x57f798=_0x57f798-0x1ba;const _0x71f795=a40_0x71f7();let _0x292b60=_0x71f795[_0x57f798];return _0x292b60;}export class ScheduleRunCommand extends BaseCommand{[a40_0x3ce7ae(0x21c)]=a40_0x3ce7ae(0x1e6);[a40_0x3ce7ae(0x1ea)]=a40_0x3ce7ae(0x21d);[a40_0x3ce7ae(0x23a)](_0x38a05d){const _0xffce53=a40_0x3ce7ae,_0x1726ab=_0x38a05d[_0xffce53(0x1d2)][0x0];if(!_0x1726ab)return _0xffce53(0x1e7);return undefined;}async[a40_0x3ce7ae(0x249)](_0x52f0e3){const _0x29bdb0=a40_0x3ce7ae,{options:_0x5e0741,args:_0x492f3,tdx:_0xeb4a16}=_0x52f0e3,_0x29f2de=_0x492f3[0x0],_0x425079=_0x5e0741,_0x1a4ee3=_0x425079[_0x29bdb0(0x1f2)],_0x99f2ce=_0x425079[_0x29bdb0(0x220)]!==undefined?Number(_0x425079[_0x29bdb0(0x220)]):undefined;if(_0x5e0741[_0x29bdb0(0x24c)]){console[_0x29bdb0(0x1d1)](_0x29bdb0(0x219)+_0x29f2de);if(_0x1a4ee3)console['error'](_0x29bdb0(0x230)+_0x1a4ee3);if(_0x99f2ce)console[_0x29bdb0(0x1d1)](_0x29bdb0(0x1eb)+_0x99f2ce);}const _0x2835b3=await withSpinner('Running\x20schedule...',()=>_0xeb4a16[_0x29bdb0(0x1da)][_0x29bdb0(0x208)](_0x29f2de,{'time':_0x1a4ee3,'num':_0x99f2ce}),{'verbose':_0x5e0741[_0x29bdb0(0x24c)]}),_0x659654=_0x2835b3[_0x29bdb0(0x216)][_0x29bdb0(0x250)];console[_0x29bdb0(0x1d1)](_0x29bdb0(0x227)+_0x659654['length']+_0x29bdb0(0x1c5)+(_0x659654['length']!==0x1?'s':'')+_0x29bdb0(0x1ee));for(const _0x577a33 of _0x659654){console[_0x29bdb0(0x1d1)](_0x29bdb0(0x1c3)+_0x577a33['job_id']);}return await handleSDKOutput(_0x659654,_0x5e0741),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a40_0x3ce7ae(0x21c)]='schedule:history';[a40_0x3ce7ae(0x1ea)]=a40_0x3ce7ae(0x202);['validate'](_0x28afa7){const _0x3ac650=a40_0x3ce7ae,_0x366aa9=_0x28afa7[_0x3ac650(0x1d2)][0x0];if(!_0x366aa9)return _0x3ac650(0x222);return undefined;}async['execute'](_0x344136){const _0x10b995=a40_0x3ce7ae,{options:_0x4edb3e,args:_0xdb109b,tdx:_0x33c1f5}=_0x344136,_0x32d3ef=_0xdb109b[0x0],_0x324e25=_0x4edb3e,_0x4e7126=_0x324e25[_0x10b995(0x240)]!==undefined?Number(_0x324e25[_0x10b995(0x240)]):undefined,_0x4d7ca6=_0x324e25['to']!==undefined?Number(_0x324e25['to']):undefined,_0x24890a=await withSpinner(_0x10b995(0x24a),()=>_0x33c1f5[_0x10b995(0x1da)]['history'](_0x32d3ef,{'from':_0x4e7126,'to':_0x4d7ca6}),{'verbose':_0x4edb3e[_0x10b995(0x24c)]}),_0x3272cf=_0x24890a[_0x10b995(0x216)];console[_0x10b995(0x1d1)](_0x10b995(0x1bb)+_0x3272cf['count']+'\x20execution'+(_0x3272cf[_0x10b995(0x210)]!==0x1?'s':'')+_0x10b995(0x1d5)+_0x3272cf[_0x10b995(0x240)]+'-'+_0x3272cf['to']+')');const _0x3029da=_0x3272cf[_0x10b995(0x224)][_0x10b995(0x221)](_0x40ccff=>({'job_id':_0x40ccff[_0x10b995(0x1bd)],'type':_0x40ccff[_0x10b995(0x1e8)],'status':_0x40ccff['status'],'scheduled_at':_0x40ccff[_0x10b995(0x207)],'created_at':_0x40ccff[_0x10b995(0x218)],'start_at':_0x40ccff['start_at'],'end_at':_0x40ccff[_0x10b995(0x246)]}));return await handleSDKOutput(_0x3029da,_0x4edb3e),0x0;}}
1
+ const a40_0x7f884=a40_0x1347;(function(_0x5715f5,_0x4a6fbf){const _0x4d366d=a40_0x1347,_0x2fb129=_0x5715f5();while(!![]){try{const _0x1d69ab=parseInt(_0x4d366d(0x1e6))/0x1*(parseInt(_0x4d366d(0x1c1))/0x2)+-parseInt(_0x4d366d(0x1e2))/0x3+-parseInt(_0x4d366d(0x1c8))/0x4+-parseInt(_0x4d366d(0x1f7))/0x5+parseInt(_0x4d366d(0x1c2))/0x6+-parseInt(_0x4d366d(0x1b7))/0x7*(parseInt(_0x4d366d(0x1d0))/0x8)+parseInt(_0x4d366d(0x1c5))/0x9;if(_0x1d69ab===_0x4a6fbf)break;else _0x2fb129['push'](_0x2fb129['shift']());}catch(_0x57207a){_0x2fb129['push'](_0x2fb129['shift']());}}}(a40_0x59a1,0xc4680));import{BaseCommand}from'./command.js';function a40_0x1347(_0x323e39,_0x30df7d){_0x323e39=_0x323e39-0x17d;const _0x59a12a=a40_0x59a1();let _0x1347d6=_0x59a12a[_0x323e39];return _0x1347d6;}import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a40_0x59a1(){const _0x2a2270=['cron','ies','engine_version','in\x20','keys','error','created_at','Searching\x20scheduled\x20queries\x20matching\x20\x22','type','Cancelled','\x20\x20Timezone:\x20','\x20\x20Database:\x20','INVALID_ARGUMENT','Getting\x20schedule\x20history...','has_next_page','queryUrl','num','executing_user_id','schedule:delete','round','\x20matching\x20\x22','description','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','last_job','trino','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','join','Creating\x20schedule:\x20','list','lastRun','\x20\x20→\x20','map','red','count','time_zone','log','query','\x20\x20Cron:\x20','retry_limit','dim','Schedule\x20updated:\x20','497980hEBJZH','history','next_run_at','Running\x20schedule...','name','status','Schedule\x20created:\x20','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','max','Running\x20schedule:\x20','50oKdIOc','9271710PFDzYY','\x20\x20Job\x20ID:\x20','job_id','33959952jwaQKO','queries','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','3069416BgntnI','Updating\x20schedule...','ended_at','\x20(use\x20--limit\x20to\x20see\x20more)','data','from','validate','priority','120oAoNVl','execute','pagination','database','📅\x20','Create\x20a\x20scheduled\x20query','just\x20now','listQueries','substring','Schedule\x20deleted:\x20','\x20created','h\x20ago','format','Creating\x20schedule...','args','toLocaleDateString','padEnd','never','3461022JVVmqU','length','yes','Show\x20schedule\x20execution\x20history','31XEqyWm','utf-8','retryLimit','Query\x20file\x20is\x20empty','\x20\x20Time:\x20','\x20scheduled\x20quer','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','d\x20ago','schedules','/app/queries/editor?queryId=','entries','Delete\x20a\x20scheduled\x20query','No\x20scheduled\x20queries\x20found','\x20execution','schedule:list','statusIcon','file','7633900aDQsXl','\x20schedules','timezone','schedule:run','green','(unnamed)','getTime','Schedule\x20run\x20submitted:\x20','result','limit','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','time','verbose','end_at','Deleting\x20schedule...','run','delay','update','...','success','Getting\x20schedule\x20details...','trim','Failed\x20to\x20read\x20file:\x20','engineVersion','abs','table','Update\x20a\x20scheduled\x20query','m\x20ago','\x20\x20Type:\x20','nextRun','\x20job','Found\x20','repeat'];a40_0x59a1=function(){return _0x2a2270;};return a40_0x59a1();}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 a40_0x363502 from'chalk';function formatRelativeTime(_0x17deaa){const _0x40a147=a40_0x1347,_0xf91536=new Date(_0x17deaa),_0xa77d81=new Date(),_0xd68577=_0xf91536['getTime']()-_0xa77d81[_0x40a147(0x1fd)](),_0x3b6f00=Math[_0x40a147(0x185)](_0xd68577)/0x3e8,_0x354964=_0xd68577<0x0;if(_0x3b6f00<0x3c)return _0x354964?_0x40a147(0x1d6):'soon';else{if(_0x3b6f00<0xe10){const _0xfe09d3=Math[_0x40a147(0x1a1)](_0x3b6f00/0x3c);return _0x354964?_0xfe09d3+_0x40a147(0x188):_0x40a147(0x191)+_0xfe09d3+'m';}else{if(_0x3b6f00<0x15180){const _0x3c696b=Math[_0x40a147(0x1a1)](_0x3b6f00/0xe10);return _0x354964?_0x3c696b+_0x40a147(0x1db):_0x40a147(0x191)+_0x3c696b+'h';}else{if(_0x3b6f00<0x93a80){const _0x38a047=Math[_0x40a147(0x1a1)](_0x3b6f00/0x15180);return _0x354964?_0x38a047+_0x40a147(0x1ed):_0x40a147(0x191)+_0x38a047+'d';}else return _0xf91536[_0x40a147(0x1df)]();}}}}export class ScheduleListCommand extends BaseCommand{[a40_0x7f884(0x1bb)]=a40_0x7f884(0x1f4);[a40_0x7f884(0x1a3)]='List\x20scheduled\x20queries';async['execute'](_0x33981d){const _0x504624=a40_0x7f884,{options:_0x25ca7e,args:_0x2e7c88,tdx:_0x5e3e57}=_0x33981d,_0x212291=resolveLimit(_0x25ca7e[_0x504624(0x200)],DEFAULT_DISPLAY_LIMIT),_0x170da8=_0x2e7c88[0x0],_0x51f86e=_0x170da8?_0x504624(0x195)+_0x170da8+'\x22...':'Listing\x20scheduled\x20queries...',_0xbc2cdc=await withSpinner(_0x51f86e,()=>_0x5e3e57[_0x504624(0x1ee)][_0x504624(0x1d7)]({'limit':_0x212291,'scheduled':!![],'pattern':_0x170da8}),{'verbose':_0x25ca7e[_0x504624(0x203)]}),_0x4a50a2=_0xbc2cdc[_0x504624(0x1cc)][_0x504624(0x1c6)],_0x1a7751=_0xbc2cdc[_0x504624(0x1cc)][_0x504624(0x1d2)][_0x504624(0x19c)],_0x381b72=_0x170da8?_0x504624(0x1a2)+_0x170da8+'\x22':'';_0x1a7751?console[_0x504624(0x193)]('Showing\x20first\x20'+_0x4a50a2[_0x504624(0x1e3)]+_0x504624(0x1f8)+_0x381b72+_0x504624(0x1cb)):console['error'](_0x504624(0x18c)+_0x4a50a2[_0x504624(0x1e3)]+_0x504624(0x1eb)+(_0x4a50a2[_0x504624(0x1e3)]!==0x1?_0x504624(0x18f):'y')+_0x381b72);if(_0x25ca7e['format']==='json'||_0x25ca7e[_0x504624(0x1dc)]==='jsonl'||_0x25ca7e[_0x504624(0x1dc)]===_0x504624(0x186)||_0x25ca7e[_0x504624(0x1dc)]==='tsv'){const _0x59121a=_0x4a50a2['map'](_0x5684da=>({'id':_0x5684da['id'],'name':_0x5684da['name'],'cron':_0x5684da[_0x504624(0x18e)],'database':_0x5684da[_0x504624(0x1d3)]?.['name'],'type':_0x5684da[_0x504624(0x196)],'timezone':_0x5684da[_0x504624(0x1b0)],'user_name':_0x5684da['user']?.['name'],'updated_at':_0x5684da['updated_at'],'next_run_at':_0x5684da['next_run_at'],'last_job_status':_0x5684da['last_job']?.[_0x504624(0x1bc)]}));await handleSDKOutput(_0x59121a,_0x25ca7e);}else{if(_0x4a50a2['length']===0x0)console[_0x504624(0x1b1)](_0x504624(0x1f2));else{const _0x3d934d=_0x25ca7e['site'],_0x514e4f=_0x4a50a2[_0x504624(0x1ad)](_0x4b70d0=>{const _0x38a14b=_0x504624,_0x296c20=_0x4b70d0[_0x38a14b(0x1a5)]?.[_0x38a14b(0x1bc)]?_0x4b70d0['last_job'][_0x38a14b(0x1bc)]==='success'?'✓':'✗':'-',_0x473aa2=_0x4b70d0[_0x38a14b(0x1a5)]?.['ended_at']?formatRelativeTime(_0x4b70d0[_0x38a14b(0x1a5)][_0x38a14b(0x1ca)]):_0x38a14b(0x1e1),_0x28be97=_0x4b70d0['next_run_at']?formatRelativeTime(_0x4b70d0[_0x38a14b(0x1b9)]):'-',_0x5e1ecb=_0x4b70d0[_0x38a14b(0x18e)]||'',_0x328ebf=_0x4b70d0[_0x38a14b(0x1bb)]||_0x38a14b(0x1fc),_0x6b0c66=getConsoleUrl(_0x3d934d,_0x38a14b(0x1ef)+_0x4b70d0['id']);return{'statusIcon':_0x296c20,'lastRun':_0x473aa2,'nextRun':_0x28be97,'cron':_0x5e1ecb,'name':_0x328ebf,'queryUrl':_0x6b0c66,'status':_0x4b70d0['last_job']?.['status']};}),_0x4149e8=Math['max'](..._0x514e4f[_0x504624(0x1ad)](_0xfc726d=>_0xfc726d[_0x504624(0x1ab)][_0x504624(0x1e3)])),_0x2cf0be=Math[_0x504624(0x1bf)](..._0x514e4f['map'](_0x4fc404=>_0x4fc404[_0x504624(0x18a)]['length'])),_0x553d10=Math[_0x504624(0x1bf)](..._0x514e4f[_0x504624(0x1ad)](_0x18f0b6=>_0x18f0b6[_0x504624(0x18e)][_0x504624(0x1e3)])),_0x3f168c=_0x514e4f[_0x504624(0x1ad)](_0x4256e5=>{const _0x3d7600=_0x504624,_0x39e437=_0x4256e5[_0x3d7600(0x1bc)]===_0x3d7600(0x180)?a40_0x363502[_0x3d7600(0x1fb)](_0x4256e5[_0x3d7600(0x1f5)]):_0x4256e5[_0x3d7600(0x1bc)]===_0x3d7600(0x193)?a40_0x363502[_0x3d7600(0x1ae)](_0x4256e5['statusIcon']):a40_0x363502[_0x3d7600(0x1b5)](_0x4256e5[_0x3d7600(0x1f5)]),_0xb6bbfc=_0x4256e5['lastRun']['padEnd'](_0x4149e8),_0x21d4db=_0x4256e5[_0x3d7600(0x18a)][_0x3d7600(0x1e0)](_0x2cf0be),_0x483ec8=_0x4256e5[_0x3d7600(0x18e)]?a40_0x363502['cyan'](_0x4256e5[_0x3d7600(0x18e)][_0x3d7600(0x1e0)](_0x553d10)):'\x20'[_0x3d7600(0x18d)](_0x553d10),_0x25f413=hyperlink(_0x4256e5[_0x3d7600(0x1bb)],_0x4256e5[_0x3d7600(0x19d)]);return _0x3d7600(0x1d4)+_0x39e437+'\x20'+_0xb6bbfc+_0x3d7600(0x1ac)+_0x21d4db+'\x20\x20'+_0x483ec8+'\x20\x20'+_0x25f413;});await writeOutput(_0x3f168c[_0x504624(0x1a8)]('\x0a'),_0x25ca7e['output'],_0x504624(0x1aa));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a40_0x7f884(0x1bb)]='schedule:show';[a40_0x7f884(0x1a3)]='Show\x20schedule\x20details';[a40_0x7f884(0x1ce)](_0x313913){const _0x327bf4=a40_0x7f884,_0xdc7e69=_0x313913[_0x327bf4(0x1de)][0x0];if(!_0xdc7e69)return _0x327bf4(0x1ec);return undefined;}async[a40_0x7f884(0x1d1)](_0x5b3af1){const _0x138656=a40_0x7f884,{options:_0x718525,args:_0x1bb408,tdx:_0x216c3f}=_0x5b3af1,_0x5660d1=_0x1bb408[0x0],_0x792814=await withSpinner(_0x138656(0x181),()=>_0x216c3f[_0x138656(0x1ee)]['show'](_0x5660d1),{'verbose':_0x718525[_0x138656(0x203)]}),_0x28463b=_0x792814['data'],_0x59179f={'name':_0x28463b[_0x138656(0x1bb)],'cron':_0x28463b[_0x138656(0x18e)],'database':_0x28463b[_0x138656(0x1d3)],'type':_0x28463b[_0x138656(0x196)],'timezone':_0x28463b['timezone'],'user_name':_0x28463b['user_name'],'created_at':_0x28463b[_0x138656(0x194)],'engine_version':_0x28463b[_0x138656(0x190)],'executing_user_id':_0x28463b[_0x138656(0x19f)],'query':_0x28463b['query'],'delay':_0x28463b['delay'],'priority':_0x28463b['priority'],'retry_limit':_0x28463b[_0x138656(0x1b4)],..._0x28463b[_0x138656(0x1ff)]&&{'result':_0x28463b[_0x138656(0x1ff)]}};return await handleSingleObjectOutput(_0x59179f,_0x718525),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a40_0x7f884(0x1bb)]='schedule:create';['description']=a40_0x7f884(0x1d5);[a40_0x7f884(0x1ce)](_0x460b75){const _0x3f2748=a40_0x7f884,_0x51f0e1=_0x460b75['args'][0x0];if(!_0x51f0e1)return _0x3f2748(0x1a7);const _0x1c9b73=_0x460b75['options'];if(!_0x1c9b73['database'])return _0x3f2748(0x1c7);return undefined;}async['execute'](_0x9b184a){const _0x47cbd7=a40_0x7f884,{options:_0x36c55a,args:_0x1a0067,tdx:_0x21ae44}=_0x9b184a,_0x444d8a=_0x1a0067[0x0],_0x144e81=_0x36c55a,_0x5edc73=_0x144e81[_0x47cbd7(0x1d3)],_0x1678f7=_0x144e81['file'],_0x4ebded=_0x144e81['type']||_0x47cbd7(0x1a6);let _0x1aa269;try{_0x1aa269=readFileSync(_0x1678f7,_0x47cbd7(0x1e7))[_0x47cbd7(0x182)]();}catch(_0x3179f1){throw new SDKError(ErrorCode[_0x47cbd7(0x19a)],'Failed\x20to\x20read\x20file:\x20'+_0x1678f7,_0x3179f1 instanceof Error?_0x3179f1:undefined);}if(!_0x1aa269)throw new SDKError(ErrorCode[_0x47cbd7(0x19a)],_0x47cbd7(0x1e9));const _0x4483ee={'database':_0x5edc73,'query':_0x1aa269,'type':_0x4ebded};if(_0x144e81[_0x47cbd7(0x18e)])_0x4483ee[_0x47cbd7(0x18e)]=_0x144e81[_0x47cbd7(0x18e)];if(_0x144e81[_0x47cbd7(0x1f9)])_0x4483ee[_0x47cbd7(0x1f9)]=_0x144e81[_0x47cbd7(0x1f9)];if(_0x144e81[_0x47cbd7(0x17d)]!==undefined)_0x4483ee['delay']=Number(_0x144e81['delay']);if(_0x144e81[_0x47cbd7(0x1cf)]!==undefined)_0x4483ee[_0x47cbd7(0x1cf)]=Number(_0x144e81[_0x47cbd7(0x1cf)]);if(_0x144e81[_0x47cbd7(0x1e8)]!==undefined)_0x4483ee['retry_limit']=Number(_0x144e81[_0x47cbd7(0x1e8)]);if(_0x144e81[_0x47cbd7(0x184)])_0x4483ee[_0x47cbd7(0x190)]=_0x144e81[_0x47cbd7(0x184)];if(_0x144e81['result'])_0x4483ee[_0x47cbd7(0x1ff)]=_0x144e81[_0x47cbd7(0x1ff)];if(_0x36c55a['verbose']){console[_0x47cbd7(0x193)](_0x47cbd7(0x1a9)+_0x444d8a),console[_0x47cbd7(0x193)](_0x47cbd7(0x199)+_0x5edc73),console['error'](_0x47cbd7(0x189)+_0x4ebded);if(_0x4483ee[_0x47cbd7(0x18e)])console[_0x47cbd7(0x193)](_0x47cbd7(0x1b3)+_0x4483ee[_0x47cbd7(0x18e)]);if(_0x4483ee['timezone'])console[_0x47cbd7(0x193)](_0x47cbd7(0x198)+_0x4483ee['timezone']);}const _0x5cc754=await withSpinner(_0x47cbd7(0x1dd),()=>_0x21ae44[_0x47cbd7(0x1ee)]['create'](_0x444d8a,_0x4483ee),{'verbose':_0x36c55a['verbose']});return console[_0x47cbd7(0x193)](_0x47cbd7(0x1bd)+_0x5cc754[_0x47cbd7(0x1cc)][_0x47cbd7(0x1bb)]),await handleSingleObjectOutput(_0x5cc754[_0x47cbd7(0x1cc)],_0x36c55a),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{['name']='schedule:update';['description']=a40_0x7f884(0x187);['validate'](_0x23f0e5){const _0x3801a6=a40_0x7f884,_0x864458=_0x23f0e5[_0x3801a6(0x1de)][0x0];if(!_0x864458)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]';return undefined;}async['execute'](_0x5b6b35){const _0x31f67d=a40_0x7f884,{options:_0x43e262,args:_0x52d5e8,tdx:_0x2f47ba}=_0x5b6b35,_0x2d5f91=_0x52d5e8[0x0],_0x2b75c7=_0x43e262,_0x26f8d6={};if(_0x2b75c7[_0x31f67d(0x1d3)])_0x26f8d6[_0x31f67d(0x1d3)]=_0x2b75c7[_0x31f67d(0x1d3)];if(_0x2b75c7[_0x31f67d(0x196)])_0x26f8d6[_0x31f67d(0x196)]=_0x2b75c7[_0x31f67d(0x196)];if(_0x2b75c7[_0x31f67d(0x18e)])_0x26f8d6[_0x31f67d(0x18e)]=_0x2b75c7['cron'];if(_0x2b75c7[_0x31f67d(0x1f9)])_0x26f8d6[_0x31f67d(0x1f9)]=_0x2b75c7[_0x31f67d(0x1f9)];if(_0x2b75c7[_0x31f67d(0x17d)]!==undefined)_0x26f8d6[_0x31f67d(0x17d)]=Number(_0x2b75c7[_0x31f67d(0x17d)]);if(_0x2b75c7[_0x31f67d(0x1cf)]!==undefined)_0x26f8d6['priority']=Number(_0x2b75c7[_0x31f67d(0x1cf)]);if(_0x2b75c7[_0x31f67d(0x1e8)]!==undefined)_0x26f8d6[_0x31f67d(0x1b4)]=Number(_0x2b75c7[_0x31f67d(0x1e8)]);if(_0x2b75c7[_0x31f67d(0x184)])_0x26f8d6[_0x31f67d(0x190)]=_0x2b75c7[_0x31f67d(0x184)];if(_0x2b75c7[_0x31f67d(0x1ff)])_0x26f8d6[_0x31f67d(0x1ff)]=_0x2b75c7[_0x31f67d(0x1ff)];if(_0x2b75c7['file'])try{_0x26f8d6[_0x31f67d(0x1b2)]=readFileSync(_0x2b75c7[_0x31f67d(0x1f6)],_0x31f67d(0x1e7))[_0x31f67d(0x182)]();}catch(_0x239a1e){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x31f67d(0x183)+_0x2b75c7[_0x31f67d(0x1f6)],_0x239a1e instanceof Error?_0x239a1e:undefined);}if(Object[_0x31f67d(0x192)](_0x26f8d6)[_0x31f67d(0x1e3)]===0x0)throw new SDKError(ErrorCode[_0x31f67d(0x19a)],_0x31f67d(0x1be));if(_0x43e262[_0x31f67d(0x203)]){console[_0x31f67d(0x193)]('Updating\x20schedule:\x20'+_0x2d5f91);for(const [_0x4f6398,_0x2a5e1c]of Object[_0x31f67d(0x1f0)](_0x26f8d6)){_0x4f6398===_0x31f67d(0x1b2)?console[_0x31f67d(0x193)]('\x20\x20'+_0x4f6398+':\x20'+_0x2a5e1c[_0x31f67d(0x1d8)](0x0,0x32)+_0x31f67d(0x17f)):console[_0x31f67d(0x193)]('\x20\x20'+_0x4f6398+':\x20'+_0x2a5e1c);}}const _0x4c75ed=await withSpinner(_0x31f67d(0x1c9),()=>_0x2f47ba[_0x31f67d(0x1ee)][_0x31f67d(0x17e)](_0x2d5f91,_0x26f8d6),{'verbose':_0x43e262[_0x31f67d(0x203)]});return console[_0x31f67d(0x193)](_0x31f67d(0x1b6)+_0x4c75ed[_0x31f67d(0x1cc)][_0x31f67d(0x1bb)]),await handleSingleObjectOutput(_0x4c75ed[_0x31f67d(0x1cc)],_0x43e262),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{['name']=a40_0x7f884(0x1a0);[a40_0x7f884(0x1a3)]=a40_0x7f884(0x1f1);[a40_0x7f884(0x1ce)](_0x5665da){const _0x1c3e93=a40_0x7f884,_0x598658=_0x5665da['args'][0x0];if(!_0x598658)return _0x1c3e93(0x201);return undefined;}async[a40_0x7f884(0x1d1)](_0xb3b727){const _0x29a23b=a40_0x7f884,{options:_0x262f31,args:_0x2eafec,tdx:_0x4aea5b}=_0xb3b727,_0x273388=_0x2eafec[0x0];if(!_0x262f31[_0x29a23b(0x1e4)]){const _0x18d420=await confirm(_0x29a23b(0x1a4)+_0x273388+'\x22?');if(!_0x18d420)return console[_0x29a23b(0x193)](_0x29a23b(0x197)),0x0;}const _0xc89485=await withSpinner(_0x29a23b(0x205),()=>_0x4aea5b[_0x29a23b(0x1ee)]['delete'](_0x273388),{'verbose':_0x262f31[_0x29a23b(0x203)]});return console[_0x29a23b(0x193)](_0x29a23b(0x1d9)+_0xc89485['data'][_0x29a23b(0x1bb)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{['name']=a40_0x7f884(0x1fa);[a40_0x7f884(0x1a3)]='Run\x20a\x20scheduled\x20query\x20immediately';['validate'](_0x5d300a){const _0x1c9309=a40_0x7f884,_0x245423=_0x5d300a[_0x1c9309(0x1de)][0x0];if(!_0x245423)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async[a40_0x7f884(0x1d1)](_0x21317c){const _0x5d0229=a40_0x7f884,{options:_0x51ff2e,args:_0x250210,tdx:_0x50de9d}=_0x21317c,_0x32355f=_0x250210[0x0],_0x116d81=_0x51ff2e,_0x5d9720=_0x116d81[_0x5d0229(0x202)],_0x4d7d44=_0x116d81[_0x5d0229(0x19e)]!==undefined?Number(_0x116d81['num']):undefined;if(_0x51ff2e[_0x5d0229(0x203)]){console[_0x5d0229(0x193)](_0x5d0229(0x1c0)+_0x32355f);if(_0x5d9720)console['error'](_0x5d0229(0x1ea)+_0x5d9720);if(_0x4d7d44)console[_0x5d0229(0x193)]('\x20\x20Num:\x20'+_0x4d7d44);}const _0x5290c0=await withSpinner(_0x5d0229(0x1ba),()=>_0x50de9d['schedules'][_0x5d0229(0x206)](_0x32355f,{'time':_0x5d9720,'num':_0x4d7d44}),{'verbose':_0x51ff2e['verbose']}),_0x3cae59=_0x5290c0[_0x5d0229(0x1cc)]['jobs'];console[_0x5d0229(0x193)](_0x5d0229(0x1fe)+_0x3cae59['length']+_0x5d0229(0x18b)+(_0x3cae59[_0x5d0229(0x1e3)]!==0x1?'s':'')+_0x5d0229(0x1da));for(const _0x5c06fe of _0x3cae59){console[_0x5d0229(0x193)](_0x5d0229(0x1c3)+_0x5c06fe['job_id']);}return await handleSDKOutput(_0x3cae59,_0x51ff2e),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a40_0x7f884(0x1bb)]='schedule:history';['description']=a40_0x7f884(0x1e5);[a40_0x7f884(0x1ce)](_0x460369){const _0x540b6e=_0x460369['args'][0x0];if(!_0x540b6e)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async[a40_0x7f884(0x1d1)](_0x4e6489){const _0x11401f=a40_0x7f884,{options:_0x58b144,args:_0x31e4e8,tdx:_0xac8f56}=_0x4e6489,_0x99ee93=_0x31e4e8[0x0],_0x4ae402=_0x58b144,_0x3c91ce=_0x4ae402[_0x11401f(0x1cd)]!==undefined?Number(_0x4ae402[_0x11401f(0x1cd)]):undefined,_0x55c22c=_0x4ae402['to']!==undefined?Number(_0x4ae402['to']):undefined,_0x5b52ac=await withSpinner(_0x11401f(0x19b),()=>_0xac8f56['schedules']['history'](_0x99ee93,{'from':_0x3c91ce,'to':_0x55c22c}),{'verbose':_0x58b144['verbose']}),_0x524c20=_0x5b52ac['data'];console[_0x11401f(0x193)](_0x11401f(0x18c)+_0x524c20[_0x11401f(0x1af)]+_0x11401f(0x1f3)+(_0x524c20[_0x11401f(0x1af)]!==0x1?'s':'')+'\x20(showing\x20'+_0x524c20[_0x11401f(0x1cd)]+'-'+_0x524c20['to']+')');const _0x4e39ff=_0x524c20[_0x11401f(0x1b8)][_0x11401f(0x1ad)](_0x141377=>({'job_id':_0x141377[_0x11401f(0x1c4)],'type':_0x141377[_0x11401f(0x196)],'status':_0x141377[_0x11401f(0x1bc)],'scheduled_at':_0x141377['scheduled_at'],'created_at':_0x141377[_0x11401f(0x194)],'start_at':_0x141377['start_at'],'end_at':_0x141377[_0x11401f(0x204)]}));return await handleSDKOutput(_0x4e39ff,_0x58b144),0x0;}}
@@ -1 +1 @@
1
- const a41_0xb7bcf4=a41_0x3420;(function(_0x29f2eb,_0x53e23d){const _0x2c5b77=a41_0x3420,_0x189a5c=_0x29f2eb();while(!![]){try{const _0x598262=parseInt(_0x2c5b77(0x181))/0x1+-parseInt(_0x2c5b77(0x20c))/0x2+parseInt(_0x2c5b77(0x1f6))/0x3+-parseInt(_0x2c5b77(0x18a))/0x4*(-parseInt(_0x2c5b77(0x1c3))/0x5)+parseInt(_0x2c5b77(0x1b0))/0x6*(parseInt(_0x2c5b77(0x1b7))/0x7)+parseInt(_0x2c5b77(0x1a1))/0x8*(parseInt(_0x2c5b77(0x201))/0x9)+-parseInt(_0x2c5b77(0x1df))/0xa*(parseInt(_0x2c5b77(0x179))/0xb);if(_0x598262===_0x53e23d)break;else _0x189a5c['push'](_0x189a5c['shift']());}catch(_0x566df5){_0x189a5c['push'](_0x189a5c['shift']());}}}(a41_0xa828,0x48fb9));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 a41_0xa828(){const _0x74e209=['Get\x20SQL\x20query\x20for\x20child\x20segment','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','cause','getSegmentSQL','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Segment\x20ID:\x20','6qagtUJ','Show\x20child\x20segment\x20schema\x20(column\x20types)','web','Use:\x20tdx\x20ps\x20show','length','cyan','includes','3399501mBmQuf','error','getParent','Folder\x20ID:\x20','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','content','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Create\x20segment\x20folder\x20for\x20organization','getSQLFromServerSegment','INVALID_ARGUMENT','(root)','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','1565nbQHeF','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','folderId','\x20folder','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Parent\x20segment:\x20','Usage:\x20tdx\x20segment\x20describe\x20<path>','Executing\x20segment\x20query...','Resolved:\x20','resolveParentId','Options:','segment:folder:show','segment:desc','Resolved\x20parent\x20ID:\x20','verbose','log','✔\x20Found\x20','parentId','folderPath','replace','\x27\x20with\x20ID:\x20','\x27...','name','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','toLocaleString','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','segment:show','70cjqJjI','information_schema','segment:folder:create','Usage:\x20tdx\x20sg\x20show\x20<name>','Error:\x20Path\x20or\x20name\x20is\x20required','execute','/app/ps/','Resolved\x20type:\x20','Parent\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Fetching\x20SQL\x20from\x20rule...','Use:\x20tdx\x20ps\x20view','Folder\x20name:\x20','parentSegment','json','\x20Opening\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Fetching\x20parent\x20segment\x20details...','segmentPath','Fetching\x20SQL\x20for\x20segment...','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','\x20rows\x20','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','318975WfMjZC','jsonl','setJobId','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','segment','resolvePathToResource','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','SQL\x20query:\x0a','✔\x20Created\x20folder\x20\x27','Resolved\x20relative\x20path\x20to:\x20','segment:describe','893313IsTOuv','Use:\x20tdx\x20ps\x20view\x20-w','/e/','folder','✔\x20Query\x20completed:\x20Processed\x20','test','red','\x20\x20Parent\x20segment:\x20','createFolder','code','data','746508lbcHUQ','getFolder','Site:\x20','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Resolving\x20\x27','\x20\x20Segment\x20name:\x20','Target\x20path:\x20','segment:folder:list','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Parent\x20name:\x20','✖\x20Query\x20failed\x20[','processedRows','\x20\x20Full\x20path:\x20','message','Resolving\x20path\x20\x27','stats','Folder\x20ID\x20missing\x20from\x20resolved\x20path','getSegment','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','description','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','fullPath','in\x20','\x20[Job\x20ID:\x20','query','SEGMENT_NOT_FOUND','Resolved\x20YAML\x20file:\x20','1522521UbEDui','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','Segment\x20ID\x20missing\x20from\x20resolved\x20path','resolveFolderId','parentFolder','segmentName','Resolving\x20parent\x20folder\x20\x27','523080qwjuAr','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Error:\x20Parent\x20segment\x20name\x20is\x20required','Fetching\x20segment\x20details...','Error:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Show\x20folder\x20or\x20child\x20segment\x20details','format','Use:\x20tdx\x20ps\x20desc','380cwxlrm','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','SEGMENT_FOLDER_NOT_FOUND','green','Show\x20segment\x20folder\x20details','Creating\x20folder\x20\x27','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Error:\x20Folder\x20reference\x20is\x20required','Examples:','segmentId','Fetching\x20folder\x20details...','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','\x20\x20Folder\x20path:\x20','getSQLFromYamlFile','parent','path','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','jobId','\x20\x20Cause:\x20','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','40wuIDKS','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','site','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','type'];a41_0xa828=function(){return _0x74e209;};return a41_0xa828();}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 a41_0x10d9f5 from'chalk';async function resolveSegmentTarget(_0x14cff2,_0x11a960,_0x161925){const _0xce609d=a41_0x3420;if(isYamlFilePath(_0x14cff2))try{const _0x41e587=await resolveYamlFilePath(_0x14cff2);return _0x161925&&(console[_0xce609d(0x1b8)](_0xce609d(0x178)+_0x14cff2),console[_0xce609d(0x1b8)](_0xce609d(0x208)+_0x41e587[_0xce609d(0x1ec)]),console[_0xce609d(0x1b8)](_0xce609d(0x211)+_0x41e587[_0xce609d(0x17f)]),console[_0xce609d(0x1b8)](_0xce609d(0x197)+(_0x41e587[_0xce609d(0x1d5)]||_0xce609d(0x1c1))),console['error'](_0xce609d(0x16a)+_0x41e587['fullPath'])),_0x41e587[_0xce609d(0x173)];}catch(_0x277772){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0xce609d(0x1da)+_0x277772[_0xce609d(0x16b)]);}if(!_0x11a960)throw new SDKError(ErrorCode[_0xce609d(0x1c0)],_0xce609d(0x1f5));return _0x11a960+'/'+_0x14cff2;}export class SegmentDescribeCommand extends BaseCommand{[a41_0xb7bcf4(0x1d9)]=a41_0xb7bcf4(0x200);['description']='Show\x20segment\x20or\x20folder\x20details';async['execute'](_0x3bf14c){const _0x11e86c=a41_0xb7bcf4,{options:_0x48fd87,args:_0x3a684d,tdx:_0x19b7cf}=_0x3bf14c,_0xeff956=_0x3a684d[0x0],_0x43c657=!_0xeff956&&!!_0x48fd87[_0x11e86c(0x1ec)],_0x4336d3=_0xeff956||_0x48fd87['parentSegment'];if(!_0x4336d3)return console[_0x11e86c(0x1b8)](_0x11e86c(0x1e3)),console[_0x11e86c(0x1b8)](_0x11e86c(0x1c9)),console[_0x11e86c(0x1b8)](_0x11e86c(0x193)),console[_0x11e86c(0x1b8)](_0x11e86c(0x19b)),console[_0x11e86c(0x1b8)](_0x11e86c(0x1bd)),console[_0x11e86c(0x1b8)](_0x11e86c(0x1f9)),console['error'](_0x11e86c(0x1a2)),0x1;try{const _0x3d9c3f=_0x48fd87[_0x11e86c(0x1f1)];let _0x3806a7=_0x4336d3;!_0x43c657&&_0x3d9c3f&&!_0x4336d3[_0x11e86c(0x1b6)]('/')&&(_0x3806a7=_0x3d9c3f+'/'+_0x4336d3,_0x48fd87['verbose']&&console['error'](_0x11e86c(0x1ff)+_0x3806a7));const _0x2dc6bf=await withSpinner(_0x11e86c(0x16c)+_0x3806a7+_0x11e86c(0x1d8),()=>_0x19b7cf[_0x11e86c(0x1fa)][_0x11e86c(0x1fb)](_0x3806a7),{'verbose':_0x48fd87[_0x11e86c(0x1d1)]}),_0x3ce972=_0x2dc6bf[_0x11e86c(0x20b)];_0x48fd87[_0x11e86c(0x1d1)]&&(console['error'](_0x11e86c(0x1e6)+_0x3ce972['type']),console['error']('Parent\x20ID:\x20'+_0x3ce972[_0x11e86c(0x1d4)]),_0x3ce972[_0x11e86c(0x1c5)]&&console[_0x11e86c(0x1b8)](_0x11e86c(0x1ba)+_0x3ce972[_0x11e86c(0x1c5)]),_0x3ce972[_0x11e86c(0x194)]&&console[_0x11e86c(0x1b8)](_0x11e86c(0x1af)+_0x3ce972[_0x11e86c(0x194)]));if(_0x3ce972[_0x11e86c(0x1a7)]==='parent'){const _0x511a72=await withSpinner(_0x11e86c(0x1f0),()=>_0x19b7cf[_0x11e86c(0x1fa)][_0x11e86c(0x1b9)](_0x3ce972[_0x11e86c(0x1d4)]),{'verbose':_0x48fd87[_0x11e86c(0x1d1)]});await handleSingleObjectOutput(_0x511a72[_0x11e86c(0x20b)],_0x48fd87);}else{if(_0x3ce972[_0x11e86c(0x1a7)]===_0x11e86c(0x204)){if(!_0x3ce972[_0x11e86c(0x1c5)])throw new SDKError(ErrorCode[_0x11e86c(0x18d)],_0x11e86c(0x16e));const _0x519b26=await withSpinner(_0x11e86c(0x195),()=>_0x19b7cf[_0x11e86c(0x1fa)]['getFolder'](_0x3ce972[_0x11e86c(0x1c5)]),{'verbose':_0x48fd87[_0x11e86c(0x1d1)]});await handleSingleObjectOutput(_0x519b26[_0x11e86c(0x20b)],_0x48fd87);}else{if(_0x3ce972['type']===_0x11e86c(0x1fa)){if(!_0x3ce972[_0x11e86c(0x194)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x11e86c(0x17c));const _0x3588f2=await withSpinner(_0x11e86c(0x184),()=>_0x19b7cf[_0x11e86c(0x1fa)][_0x11e86c(0x16f)](_0x3ce972['parentId'],_0x3ce972[_0x11e86c(0x194)]),{'verbose':_0x48fd87[_0x11e86c(0x1d1)]});await handleSingleObjectOutput(_0x3588f2[_0x11e86c(0x20b)],_0x48fd87);}}}return 0x0;}catch(_0xc360e){if(_0xc360e instanceof SDKError)return console[_0x11e86c(0x1b8)]('Error:\x20'+_0xc360e[_0x11e86c(0x16b)]),_0xc360e[_0x11e86c(0x1ac)]&&console[_0x11e86c(0x1b8)]('\x20\x20Cause:\x20'+_0xc360e[_0x11e86c(0x1ac)]),0x1;throw _0xc360e;}}}export class SegmentShowCommand extends BaseCommand{['name']=a41_0xb7bcf4(0x1de);[a41_0xb7bcf4(0x171)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async['execute'](_0x48a6b8){const _0x95b0ef=a41_0xb7bcf4,{options:_0x588885,args:_0x8b5867,tdx:_0x536015}=_0x48a6b8,_0x23eadd=_0x8b5867[0x0];if(!_0x23eadd)return console[_0x95b0ef(0x1b8)](_0x95b0ef(0x1c4)),console[_0x95b0ef(0x1b8)](_0x95b0ef(0x1e2)),console[_0x95b0ef(0x1b8)](_0x95b0ef(0x196)),console['error'](_0x95b0ef(0x193)),console[_0x95b0ef(0x1b8)](_0x95b0ef(0x1ae)),console[_0x95b0ef(0x1b8)](_0x95b0ef(0x1dd)),0x1;try{const _0x797205=_0x588885[_0x95b0ef(0x1ec)],_0x348fa9=await resolveSegmentTarget(_0x23eadd,_0x797205,_0x588885[_0x95b0ef(0x1d1)]);_0x588885[_0x95b0ef(0x1d1)]&&console[_0x95b0ef(0x1b8)](_0x95b0ef(0x164)+_0x348fa9);const _0xf10c1f=await withSpinner(_0x95b0ef(0x210)+_0x23eadd+_0x95b0ef(0x1d8),()=>_0x536015[_0x95b0ef(0x1fa)]['resolvePathToResource'](_0x348fa9),{'verbose':_0x588885[_0x95b0ef(0x1d1)]}),_0x591bd3=_0xf10c1f[_0x95b0ef(0x20b)];_0x588885['verbose']&&(console[_0x95b0ef(0x1b8)](_0x95b0ef(0x1e6)+_0x591bd3['type']),console[_0x95b0ef(0x1b8)](_0x95b0ef(0x1e7)+_0x591bd3['parentId']));if(_0x591bd3[_0x95b0ef(0x1a7)]==='folder')return console[_0x95b0ef(0x1b8)](_0x95b0ef(0x1a5)),console[_0x95b0ef(0x1b8)](_0x95b0ef(0x18c)),0x1;if(_0x591bd3['type']===_0x95b0ef(0x199))return console[_0x95b0ef(0x1b8)](_0x95b0ef(0x17a)),console[_0x95b0ef(0x1b8)](_0x95b0ef(0x1b3)),0x1;if(!_0x591bd3['segmentId'])throw new SDKError(ErrorCode[_0x95b0ef(0x177)],_0x95b0ef(0x17c));const _0x3ef8cd=await withSpinner(_0x95b0ef(0x1f2),()=>_0x536015[_0x95b0ef(0x1fa)][_0x95b0ef(0x1ad)](_0x591bd3[_0x95b0ef(0x1d4)],_0x591bd3['segmentId']),{'verbose':_0x588885['verbose']});let _0x15b0b6=_0x3ef8cd[_0x95b0ef(0x20b)];const _0x1557bd=resolveLimit(_0x588885['limit'],DEFAULT_DISPLAY_LIMIT),_0x5dac84=/\bLIMIT\s+\d+/i[_0x95b0ef(0x206)](_0x15b0b6);!_0x5dac84&&(_0x15b0b6=_0x15b0b6['trim']()[_0x95b0ef(0x1d6)](/;+$/,''),_0x15b0b6='SELECT\x20*\x20FROM\x20(\x0a'+_0x15b0b6+_0x95b0ef(0x1ef)+_0x1557bd);_0x588885[_0x95b0ef(0x1d1)]&&console[_0x95b0ef(0x1b8)](_0x95b0ef(0x1fd)+_0x15b0b6);const _0x54787f=await withProgressSpinner(_0x95b0ef(0x1ca),async _0x15b35d=>{const _0x348629=_0x95b0ef,_0x185c79=await _0x536015[_0x348629(0x176)][_0x348629(0x1e4)](_0x15b0b6,{'catalog':'td','schema':_0x348629(0x1e0),'onJobId':_0x42f899=>{const _0x27e29c=_0x348629;_0x15b35d[_0x27e29c(0x1f8)](_0x42f899);}});return _0x185c79;},{'verbose':_0x588885['verbose']}),_0x407572=_0x54787f[_0x95b0ef(0x20b)],_0x1b93d6=_0x407572[_0x95b0ef(0x19c)]?_0x95b0ef(0x175)+_0x407572[_0x95b0ef(0x19c)]+']':'';return console[_0x95b0ef(0x1b8)](_0x95b0ef(0x205)+_0x407572[_0x95b0ef(0x16d)][_0x95b0ef(0x169)][_0x95b0ef(0x1dc)]()+_0x95b0ef(0x1f4)+(_0x95b0ef(0x174)+formatElapsed(_0x407572[_0x95b0ef(0x16d)]['elapsedTimeMillis'])+_0x1b93d6)),await handleQueryOutput(_0x407572,_0x588885),0x0;}catch(_0x4929ed){if(_0x4929ed instanceof SDKError)return console[_0x95b0ef(0x1b8)](_0x95b0ef(0x168)+_0x4929ed[_0x95b0ef(0x20a)]+']'),console[_0x95b0ef(0x1b8)]('\x0a'+_0x4929ed[_0x95b0ef(0x16b)]),0x1;throw _0x4929ed;}}}export class SegmentFolderListCommand extends BaseCommand{[a41_0xb7bcf4(0x1d9)]=a41_0xb7bcf4(0x165);[a41_0xb7bcf4(0x171)]=a41_0xb7bcf4(0x1f3);async[a41_0xb7bcf4(0x1e4)](_0x2e6923){const _0x4b6698=a41_0xb7bcf4,{options:_0x558532,args:_0x6ac943,tdx:_0x50e5d9}=_0x2e6923;if(_0x6ac943['length']===0x0)return console[_0x4b6698(0x1b8)](_0x4b6698(0x183)),console[_0x4b6698(0x1b8)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x5acd59=_0x6ac943[0x0];try{_0x558532[_0x4b6698(0x1d1)]&&(console[_0x4b6698(0x1b8)](_0x4b6698(0x20e)+_0x558532[_0x4b6698(0x1a4)]),console[_0x4b6698(0x1b8)](_0x4b6698(0x167)+_0x5acd59));const _0xac0e01=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5acd59+'\x27...',()=>_0x50e5d9[_0x4b6698(0x1fa)][_0x4b6698(0x1cc)](_0x5acd59),{'verbose':_0x558532[_0x4b6698(0x1d1)]}),_0x308976=_0xac0e01[_0x4b6698(0x20b)];_0x558532[_0x4b6698(0x1d1)]&&console['error'](_0x4b6698(0x1d0)+_0x308976);const _0x566615=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x5acd59+'\x27...',()=>_0x50e5d9['segment']['listFolders'](_0x308976),{'verbose':_0x558532[_0x4b6698(0x1d1)]}),_0x2d7e72=_0x566615[_0x4b6698(0x20b)];return console[_0x4b6698(0x1b8)](_0x4b6698(0x1d3)+_0x2d7e72['length']+_0x4b6698(0x1c6)+(_0x2d7e72[_0x4b6698(0x1b4)]!==0x1?'s':'')),await handleSDKOutput(_0x2d7e72,_0x558532),0x0;}catch(_0x294c62){if(_0x294c62 instanceof SDKError)return console[_0x4b6698(0x1b8)]('Error:\x20'+_0x294c62[_0x4b6698(0x16b)]),_0x294c62[_0x4b6698(0x1ac)]&&console['error'](_0x4b6698(0x19d)+_0x294c62['cause']),0x1;throw _0x294c62;}}}function a41_0x3420(_0x1f02d1,_0x393e9f){_0x1f02d1=_0x1f02d1-0x164;const _0xa8288=a41_0xa828();let _0x3420f2=_0xa8288[_0x1f02d1];return _0x3420f2;}export class SegmentFolderShowCommand extends BaseCommand{[a41_0xb7bcf4(0x1d9)]=a41_0xb7bcf4(0x1ce);[a41_0xb7bcf4(0x171)]=a41_0xb7bcf4(0x18f);async[a41_0xb7bcf4(0x1e4)](_0x5ca443){const _0x6e2c38=a41_0xb7bcf4,{options:_0x92171d,args:_0x940a96,tdx:_0xe5b82f}=_0x5ca443;if(_0x940a96['length']===0x0)return console['error'](_0x6e2c38(0x192)),console['error'](_0x6e2c38(0x1a3)),0x1;try{const {parentId:_0x4bde45,childId:_0x1a07e0}=parseSegmentRef(_0x940a96[0x0]);_0x92171d[_0x6e2c38(0x1d1)]&&(console[_0x6e2c38(0x1b8)](_0x6e2c38(0x20e)+_0x92171d['site']),console['error'](_0x6e2c38(0x167)+_0x4bde45),_0x1a07e0&&console[_0x6e2c38(0x1b8)]('Folder\x20name:\x20'+_0x1a07e0));if(!_0x1a07e0)return console['error'](_0x6e2c38(0x172)),0x1;const _0x461ca6=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x4bde45+_0x6e2c38(0x1d8),()=>_0xe5b82f[_0x6e2c38(0x1fa)][_0x6e2c38(0x1cc)](_0x4bde45),{'verbose':_0x92171d[_0x6e2c38(0x1d1)]}),_0x141a33=_0x461ca6[_0x6e2c38(0x20b)];_0x92171d['verbose']&&console[_0x6e2c38(0x1b8)](_0x6e2c38(0x1d0)+_0x141a33);const _0x2921bb=await withSpinner('Resolving\x20folder\x20\x27'+_0x1a07e0+_0x6e2c38(0x1d8),()=>_0xe5b82f[_0x6e2c38(0x1fa)][_0x6e2c38(0x17d)](_0x141a33,_0x1a07e0),{'verbose':_0x92171d[_0x6e2c38(0x1d1)]}),_0x51f379=_0x2921bb[_0x6e2c38(0x20b)];_0x92171d['verbose']&&console[_0x6e2c38(0x1b8)]('Resolved\x20folder\x20ID:\x20'+_0x51f379);const _0x5587b1=await withSpinner('Fetching\x20folder\x20\x27'+_0x1a07e0+_0x6e2c38(0x1d8),()=>_0xe5b82f[_0x6e2c38(0x1fa)][_0x6e2c38(0x20d)](_0x51f379),{'verbose':_0x92171d['verbose']});return await handleSDKOutput([_0x5587b1['data']],_0x92171d),0x0;}catch(_0x2442bd){if(_0x2442bd instanceof SDKError)return console[_0x6e2c38(0x1b8)]('Error:\x20'+_0x2442bd[_0x6e2c38(0x16b)]),_0x2442bd[_0x6e2c38(0x1ac)]&&console[_0x6e2c38(0x1b8)](_0x6e2c38(0x19d)+_0x2442bd['cause']),0x1;throw _0x2442bd;}}}export class SegmentSQLCommand extends BaseCommand{[a41_0xb7bcf4(0x1d9)]='segment:sql';['description']=a41_0xb7bcf4(0x1a8);async[a41_0xb7bcf4(0x1e4)](_0x10a886){const _0x21b862=a41_0xb7bcf4,{options:_0x42d8db,args:_0x492509}=_0x10a886,_0x258113=_0x42d8db,_0x134d04=_0x258113[_0x21b862(0x19a)],_0x1d1ffb=_0x492509[0x0];if(!_0x1d1ffb&&!_0x134d04)return console['error'](a41_0x10d9f5[_0x21b862(0x207)](_0x21b862(0x1db))),console[_0x21b862(0x1b8)]('Usage:'),console[_0x21b862(0x1b8)](_0x21b862(0x1ab)),console[_0x21b862(0x1b8)](_0x21b862(0x17b)),console['error'](_0x21b862(0x193)),console[_0x21b862(0x1b8)](_0x21b862(0x182)),console['error'](_0x21b862(0x19f)),0x1;if(_0x1d1ffb&&_0x134d04)return console[_0x21b862(0x1b8)](a41_0x10d9f5['red']('Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both')),0x1;try{let _0x28cec3;if(_0x134d04)_0x28cec3=await this[_0x21b862(0x198)](_0x134d04,_0x10a886);else{if(isYamlFilePath(_0x1d1ffb))return console[_0x21b862(0x1b8)](a41_0x10d9f5[_0x21b862(0x207)](_0x21b862(0x1a6))),console[_0x21b862(0x1b8)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20'+_0x1d1ffb),0x1;else _0x28cec3=await this[_0x21b862(0x1bf)](_0x1d1ffb,_0x10a886);}return _0x42d8db[_0x21b862(0x188)]===_0x21b862(0x1ed)||_0x42d8db['format']===_0x21b862(0x1f7)?await handleSDKOutput([{'sql':_0x28cec3}],_0x42d8db):console[_0x21b862(0x1d2)](_0x28cec3),0x0;}catch(_0x3c9da7){if(_0x3c9da7 instanceof SDKError)return console[_0x21b862(0x1b8)]('Error:\x20'+_0x3c9da7[_0x21b862(0x16b)]),_0x3c9da7[_0x21b862(0x1ac)]&&console['error'](_0x21b862(0x19d)+_0x3c9da7[_0x21b862(0x1ac)]),0x1;throw _0x3c9da7;}}async[a41_0xb7bcf4(0x198)](_0x2803fc,_0x548093){const _0x41d12d=a41_0xb7bcf4,{options:_0x39dce1,tdx:_0x5bacd1}=_0x548093;let _0x160749;try{_0x160749=await resolveYamlFilePath(_0x2803fc);}catch(_0x3d1834){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x3d1834[_0x41d12d(0x16b)]);}_0x39dce1['verbose']&&console[_0x41d12d(0x1b8)](_0x41d12d(0x1cb)+_0x160749[_0x41d12d(0x1ec)]+'/'+_0x160749[_0x41d12d(0x17f)]);const _0x2064f6=await withSpinner(_0x41d12d(0x1e9),()=>_0x5bacd1['segment']['getSegmentSQLFromYaml'](_0x160749[_0x41d12d(0x1bc)],_0x160749[_0x41d12d(0x1ec)],_0x160749[_0x41d12d(0x17f)]),{'verbose':_0x39dce1['verbose']});return _0x2064f6[_0x41d12d(0x20b)];}async[a41_0xb7bcf4(0x1bf)](_0x1a0c33,_0x26a1a6){const _0x5711f7=a41_0xb7bcf4,{options:_0x2878f7,tdx:_0x54683d}=_0x26a1a6,_0x27e1bc=_0x2878f7[_0x5711f7(0x1ec)],_0x16bb12=await resolveSegmentTarget(_0x1a0c33,_0x27e1bc,_0x2878f7[_0x5711f7(0x1d1)]);_0x2878f7[_0x5711f7(0x1d1)]&&console[_0x5711f7(0x1b8)](_0x5711f7(0x164)+_0x16bb12);const _0xe52bac=await withSpinner(_0x5711f7(0x210)+_0x1a0c33+_0x5711f7(0x1d8),()=>_0x54683d['segment']['resolvePathToResource'](_0x16bb12),{'verbose':_0x2878f7[_0x5711f7(0x1d1)]}),_0x458c68=_0xe52bac[_0x5711f7(0x20b)];_0x2878f7[_0x5711f7(0x1d1)]&&(console[_0x5711f7(0x1b8)](_0x5711f7(0x1e6)+_0x458c68[_0x5711f7(0x1a7)]),console['error'](_0x5711f7(0x1e7)+_0x458c68[_0x5711f7(0x1d4)]));if(_0x458c68[_0x5711f7(0x1a7)]===_0x5711f7(0x204))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x5711f7(0x20f));if(_0x458c68['type']===_0x5711f7(0x199))throw new SDKError(ErrorCode[_0x5711f7(0x1c0)],_0x5711f7(0x1aa));if(!_0x458c68['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x5711f7(0x17c));const _0x2c2e41=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x54683d['segment'][_0x5711f7(0x1ad)](_0x458c68['parentId'],_0x458c68[_0x5711f7(0x194)]),{'verbose':_0x2878f7['verbose']});return _0x2c2e41[_0x5711f7(0x20b)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a41_0xb7bcf4(0x1d9)]=a41_0xb7bcf4(0x1e1);[a41_0xb7bcf4(0x171)]=a41_0xb7bcf4(0x1be);async[a41_0xb7bcf4(0x1e4)](_0x582efc){const _0x53b084=a41_0xb7bcf4,{options:_0x2ccbf3,args:_0x247a53,tdx:_0x45e858}=_0x582efc,_0x5901b8=_0x2ccbf3;if(_0x247a53[_0x53b084(0x1b4)]<0x2)return console[_0x53b084(0x1b8)](_0x53b084(0x170)),console[_0x53b084(0x1b8)](_0x53b084(0x1a9)),0x1;const _0x5819fd=_0x247a53[0x0],_0x3d0732=_0x247a53[0x1];_0x5901b8[_0x53b084(0x1d1)]&&(console[_0x53b084(0x1b8)](_0x53b084(0x20e)+_0x5901b8[_0x53b084(0x1a4)]),console[_0x53b084(0x1b8)](_0x53b084(0x1c8)+_0x5819fd),console[_0x53b084(0x1b8)](_0x53b084(0x1eb)+_0x3d0732));let _0x36ad04;if(_0x5901b8[_0x53b084(0x17e)]){const _0x5e14df=_0x5901b8['parentFolder'],_0x2b9c48=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5819fd+'\x27...',()=>_0x45e858['segment'][_0x53b084(0x1cc)](_0x5819fd),{'verbose':_0x5901b8[_0x53b084(0x1d1)]}),_0x413c67=_0x2b9c48[_0x53b084(0x20b)],_0xef02d1=await withSpinner(_0x53b084(0x180)+_0x5e14df+'\x27...',()=>_0x45e858[_0x53b084(0x1fa)]['resolveFolderId'](_0x413c67,_0x5e14df),{'verbose':_0x5901b8['verbose']});_0x36ad04=_0xef02d1['data'],_0x5901b8[_0x53b084(0x1d1)]&&console[_0x53b084(0x1b8)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x36ad04);}const _0x223230={'name':_0x3d0732,'description':_0x5901b8[_0x53b084(0x171)],'parentFolderId':_0x36ad04},_0x18f0d5=await withSpinner(_0x53b084(0x190)+_0x3d0732+_0x53b084(0x1d8),()=>_0x45e858[_0x53b084(0x1fa)][_0x53b084(0x209)](_0x5819fd,_0x223230),{'verbose':_0x5901b8['verbose']}),_0x1c950c=_0x18f0d5[_0x53b084(0x20b)];return console[_0x53b084(0x1b8)](_0x53b084(0x1fe)+_0x1c950c[_0x53b084(0x1d9)]+_0x53b084(0x1d7)+_0x1c950c['id']),await handleSDKOutput([_0x1c950c],_0x5901b8),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']='segment:view';[a41_0xb7bcf4(0x171)]=a41_0xb7bcf4(0x187);async[a41_0xb7bcf4(0x1e4)](_0x2f5ad6){const _0x412630=a41_0xb7bcf4,{options:_0x1c4ee4,args:_0xde0efb,tdx:_0x4eac58}=_0x2f5ad6,_0x40d664=_0xde0efb[0x0];if(!_0x40d664)return console[_0x412630(0x1b8)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error'](_0x412630(0x166)),console[_0x412630(0x1b8)](_0x412630(0x1e8)),console['error'](_0x412630(0x1cd)),console['error'](_0x412630(0x19e)),console['error']('Examples:'),console[_0x412630(0x1b8)](_0x412630(0x18b)),console['error'](_0x412630(0x1c2)),console[_0x412630(0x1b8)](_0x412630(0x1a0)),console['error']('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x307352=_0x1c4ee4[_0x412630(0x1ec)],_0x774062=await resolveSegmentTarget(_0x40d664,_0x307352,_0x1c4ee4['verbose']);_0x1c4ee4[_0x412630(0x1d1)]&&console['error'](_0x412630(0x164)+_0x774062);const _0x57c4b8=await withSpinner(_0x412630(0x210)+_0x40d664+_0x412630(0x1d8),()=>_0x4eac58[_0x412630(0x1fa)][_0x412630(0x1fb)](_0x774062),{'verbose':_0x1c4ee4[_0x412630(0x1d1)]}),_0x4b0106=_0x57c4b8[_0x412630(0x20b)];_0x1c4ee4['verbose']&&(console[_0x412630(0x1b8)]('Resolved\x20type:\x20'+_0x4b0106[_0x412630(0x1a7)]),console[_0x412630(0x1b8)](_0x412630(0x1e7)+_0x4b0106[_0x412630(0x1d4)]),_0x4b0106[_0x412630(0x1c5)]&&console[_0x412630(0x1b8)](_0x412630(0x1ba)+_0x4b0106[_0x412630(0x1c5)]),_0x4b0106['segmentId']&&console[_0x412630(0x1b8)](_0x412630(0x1af)+_0x4b0106[_0x412630(0x194)]));if(_0x1c4ee4[_0x412630(0x1b2)]){if(_0x4b0106[_0x412630(0x1a7)]===_0x412630(0x204))return console['error']('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x4b0106[_0x412630(0x1a7)]==='parent')return console[_0x412630(0x1b8)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x412630(0x1b8)](_0x412630(0x202)),0x1;if(!_0x4b0106[_0x412630(0x194)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x412630(0x17c));const _0x48e5ca=getConsoleNextUrl(_0x1c4ee4[_0x412630(0x1a4)],_0x412630(0x1e5)+_0x4b0106[_0x412630(0x1d4)]+_0x412630(0x203)+_0x4b0106['segmentId']);return console['error'](a41_0x10d9f5[_0x412630(0x18e)]('✔')+_0x412630(0x1ee)+a41_0x10d9f5[_0x412630(0x1b5)](_0x48e5ca)),openBrowser(_0x48e5ca),0x0;}if(_0x4b0106[_0x412630(0x1a7)]===_0x412630(0x204)){if(!_0x4b0106['folderId'])throw new SDKError(ErrorCode[_0x412630(0x18d)],_0x412630(0x16e));const _0x4e049c=await withSpinner(_0x412630(0x195),()=>_0x4eac58[_0x412630(0x1fa)]['getFolder'](_0x4b0106[_0x412630(0x1c5)]),{'verbose':_0x1c4ee4[_0x412630(0x1d1)]});await handleSingleObjectOutput(_0x4e049c[_0x412630(0x20b)],_0x1c4ee4);}else{if(_0x4b0106['type']===_0x412630(0x1fa)){if(!_0x4b0106[_0x412630(0x194)])throw new SDKError(ErrorCode[_0x412630(0x177)],_0x412630(0x17c));const _0x1b933b=await withSpinner(_0x412630(0x184),()=>_0x4eac58[_0x412630(0x1fa)][_0x412630(0x16f)](_0x4b0106['parentId'],_0x4b0106[_0x412630(0x194)]),{'verbose':_0x1c4ee4[_0x412630(0x1d1)]}),_0xef2d0d=getConsoleNextUrl(_0x1c4ee4[_0x412630(0x1a4)],_0x412630(0x1e5)+_0x4b0106[_0x412630(0x1d4)]+_0x412630(0x203)+_0x4b0106[_0x412630(0x194)]),_0x1fc237=_0x1b933b[_0x412630(0x20b)];_0x1fc237['url']=_0xef2d0d,await handleSingleObjectOutput(_0x1fc237,_0x1c4ee4);}else return console[_0x412630(0x1b8)](_0x412630(0x1fc)),console[_0x412630(0x1b8)](_0x412630(0x1ea)),0x1;}return 0x0;}catch(_0x10ad20){if(_0x10ad20 instanceof SDKError)return console[_0x412630(0x1b8)]('Error:\x20'+_0x10ad20['message']),_0x10ad20[_0x412630(0x1ac)]&&console['error'](_0x412630(0x19d)+_0x10ad20[_0x412630(0x1ac)]),0x1;throw _0x10ad20;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']=a41_0xb7bcf4(0x1cf);['description']=a41_0xb7bcf4(0x1b1);async[a41_0xb7bcf4(0x1e4)](_0x4d2e42){const _0x131da4=a41_0xb7bcf4,{options:_0xc0beef,args:_0x20f576,tdx:_0x13c10a}=_0x4d2e42,_0x9f0045=_0x20f576[0x0];if(!_0x9f0045)return console[_0x131da4(0x1b8)](_0x131da4(0x1c4)),console[_0x131da4(0x1b8)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x131da4(0x1b8)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console[_0x131da4(0x1b8)]('Examples:'),console[_0x131da4(0x1b8)](_0x131da4(0x191)),console[_0x131da4(0x1b8)](_0x131da4(0x1bb)),0x1;try{const _0x139778=_0xc0beef[_0x131da4(0x1ec)],_0x5c17d6=await resolveSegmentTarget(_0x9f0045,_0x139778,_0xc0beef[_0x131da4(0x1d1)]);_0xc0beef[_0x131da4(0x1d1)]&&console[_0x131da4(0x1b8)]('Target\x20path:\x20'+_0x5c17d6);const _0x1ce8e4=await withSpinner(_0x131da4(0x210)+_0x9f0045+_0x131da4(0x1d8),()=>_0x13c10a[_0x131da4(0x1fa)][_0x131da4(0x1fb)](_0x5c17d6),{'verbose':_0xc0beef[_0x131da4(0x1d1)]}),_0x5a3917=_0x1ce8e4['data'];_0xc0beef[_0x131da4(0x1d1)]&&(console[_0x131da4(0x1b8)](_0x131da4(0x1e6)+_0x5a3917[_0x131da4(0x1a7)]),console[_0x131da4(0x1b8)](_0x131da4(0x1e7)+_0x5a3917[_0x131da4(0x1d4)]));if(_0x5a3917[_0x131da4(0x1a7)]===_0x131da4(0x204))return console[_0x131da4(0x1b8)](_0x131da4(0x186)),console[_0x131da4(0x1b8)](_0x131da4(0x1c7)),0x1;if(_0x5a3917['type']==='parent')return console[_0x131da4(0x1b8)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x131da4(0x1b8)](_0x131da4(0x189)),0x1;if(!_0x5a3917[_0x131da4(0x194)])throw new SDKError(ErrorCode[_0x131da4(0x177)],_0x131da4(0x17c));const _0x54e681=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x13c10a[_0x131da4(0x1fa)]['getSegmentSQL'](_0x5a3917[_0x131da4(0x1d4)],_0x5a3917['segmentId']),{'verbose':_0xc0beef[_0x131da4(0x1d1)]}),_0x19c771=_0x54e681[_0x131da4(0x20b)],_0x29741d=await executeSchemaQuery(_0x19c771,_0x13c10a,_0xc0beef);return await handleQueryOutput(_0x29741d,_0xc0beef),0x0;}catch(_0x30af16){if(_0x30af16 instanceof SDKError)return console[_0x131da4(0x1b8)](_0x131da4(0x185)+_0x30af16['message']),_0x30af16[_0x131da4(0x1ac)]&&console[_0x131da4(0x1b8)]('\x20\x20Cause:\x20'+_0x30af16[_0x131da4(0x1ac)]),0x1;throw _0x30af16;}}}
1
+ const a41_0x47ad23=a41_0x5b7b;(function(_0x422517,_0x16ae21){const _0x1d9660=a41_0x5b7b,_0x222d91=_0x422517();while(!![]){try{const _0x1ecc75=parseInt(_0x1d9660(0x108))/0x1*(parseInt(_0x1d9660(0xc0))/0x2)+parseInt(_0x1d9660(0x105))/0x3*(-parseInt(_0x1d9660(0xff))/0x4)+parseInt(_0x1d9660(0x10e))/0x5+-parseInt(_0x1d9660(0x130))/0x6*(parseInt(_0x1d9660(0xfe))/0x7)+-parseInt(_0x1d9660(0x131))/0x8+-parseInt(_0x1d9660(0xb5))/0x9*(-parseInt(_0x1d9660(0xf6))/0xa)+parseInt(_0x1d9660(0x106))/0xb;if(_0x1ecc75===_0x16ae21)break;else _0x222d91['push'](_0x222d91['shift']());}catch(_0x7020c8){_0x222d91['push'](_0x222d91['shift']());}}}(a41_0xb829,0x925bf));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';function a41_0xb829(){const _0x20f8e7=['\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','jsonl','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','log','/e/','Segment\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Folder\x20ID:\x20','SEGMENT_NOT_FOUND','Resolving\x20\x27','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20\x20tdx\x20sg\x20sql\x20--path\x20','stats','\x20\x20Folder\x20path:\x20','segmentName','segment:folder:show','verbose','/app/ps/','getSegmentSQL','✔\x20Created\x20folder\x20\x27','getSegmentSQLFromYaml','Resolved\x20parent\x20ID:\x20','Folder\x20ID\x20missing\x20from\x20resolved\x20path','folderId','error','SQL\x20query:\x0a','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Fetching\x20parent\x20segment\x20details...','\x27...','message','Parent\x20ID:\x20','getParent','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','segmentId','Usage:\x20tdx\x20segment\x20describe\x20<path>','getSQLFromServerSegment','Options:','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','data','Target\x20path:\x20','Error:\x20Path\x20or\x20name\x20is\x20required','\x20rows\x20','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','web','resolvePathToResource','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','parent','110txhwGY','Resolved\x20parent\x20folder\x20ID:\x20','Error:\x20','resolveFolderId','Resolving\x20parent\x20segment\x20\x27','\x20\x20Cause:\x20','Use:\x20tdx\x20ps\x20view','green','17731dnuGhe','2316GRKpnT','resolveParentId','segment:desc','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','getSegment','toLocaleString','3273TDjANp','7646155KpmTji','folder','196017KmljAN','Resolved\x20relative\x20path\x20to:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','fullPath','information_schema','SELECT\x20*\x20FROM\x20(\x0a','3832800klUmJw','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','cyan','Resolved\x20YAML\x20file:\x20','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Get\x20SQL\x20query\x20for\x20child\x20segment','Create\x20segment\x20folder\x20for\x20organization','parentSegment','Fetching\x20folder\x20details...','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Resolved\x20folder\x20ID:\x20','red','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','folderPath','cause','segment:describe','Fetching\x20SQL\x20from\x20rule...','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','createFolder','Usage:\x20tdx\x20sg\x20desc\x20<name>','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','Resolved\x20type:\x20','segment','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Examples:','Resolving\x20parent\x20folder\x20\x27','✔\x20Found\x20','execute','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','site','(root)','parentId','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','✖\x20Query\x20failed\x20[','342ZYjwtD','6840304YnwKSQ','\x20\x20Segment\x20name:\x20','Segment\x20ID:\x20','\x27\x20with\x20ID:\x20','segmentPath','Usage:','processedRows','Use:\x20tdx\x20ps\x20show','type','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','segment:folder:list','segment:sql','\x20\x20Parent\x20segment:\x20','getSQLFromYamlFile','format','Fetching\x20SQL\x20for\x20segment...','Folder\x20name:\x20','Use:\x20tdx\x20ps\x20desc','getFolder','segment:view','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','\x20Opening\x20','SEGMENT_FOLDER_NOT_FOUND','Use:\x20tdx\x20ps\x20view\x20-w','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Show\x20segment\x20folder\x20details','Resolved:\x20','name','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','description','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Show\x20child\x20segment\x20schema\x20(column\x20types)','Site:\x20','replace','length','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','\x20folder','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','Fetching\x20folder\x20\x27','Listing\x20folders\x20for\x20parent\x20\x27','Parent\x20name:\x20','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','parentFolder','Resolving\x20folder\x20\x27','468747NwKMbS','\x20[Job\x20ID:\x20','setJobId','Fetching\x20segment\x20details...','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','json','segment:folder:create','jobId','segment:show','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','INVALID_ARGUMENT','2RhuVAL','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'];a41_0xb829=function(){return _0x20f8e7;};return a41_0xb829();}import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a41_0x48433e from'chalk';async function resolveSegmentTarget(_0x4d04f1,_0x4d9159,_0x5cf064){const _0x245b3a=a41_0x5b7b;if(isYamlFilePath(_0x4d04f1))try{const _0x30dcc2=await resolveYamlFilePath(_0x4d04f1);return _0x5cf064&&(console[_0x245b3a(0xdd)](_0x245b3a(0x111)+_0x4d04f1),console[_0x245b3a(0xdd)](_0x245b3a(0x13e)+_0x30dcc2[_0x245b3a(0x115)]),console['error'](_0x245b3a(0x132)+_0x30dcc2[_0x245b3a(0xd3)]),console[_0x245b3a(0xdd)](_0x245b3a(0xd2)+(_0x30dcc2[_0x245b3a(0x11b)]||_0x245b3a(0x12c))),console['error']('\x20\x20Full\x20path:\x20'+_0x30dcc2['fullPath'])),_0x30dcc2[_0x245b3a(0x10b)];}catch(_0x1e9089){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x1e9089[_0x245b3a(0xe2)]);}if(!_0x4d9159)throw new SDKError(ErrorCode[_0x245b3a(0xbf)],_0x245b3a(0x146));return _0x4d9159+'/'+_0x4d04f1;}export class SegmentDescribeCommand extends BaseCommand{[a41_0x47ad23(0x14d)]=a41_0x47ad23(0x11d);[a41_0x47ad23(0x14f)]='Show\x20segment\x20or\x20folder\x20details';async[a41_0x47ad23(0x129)](_0x4fd8fd){const _0x35bced=a41_0x47ad23,{options:_0x296a09,args:_0x101570,tdx:_0x339b5a}=_0x4fd8fd,_0x30edd7=_0x101570[0x0],_0x208865=!_0x30edd7&&!!_0x296a09[_0x35bced(0x115)],_0x144a49=_0x30edd7||_0x296a09[_0x35bced(0x115)];if(!_0x144a49)return console['error'](_0x35bced(0xee)),console[_0x35bced(0xdd)](_0x35bced(0xe8)),console[_0x35bced(0xdd)](_0x35bced(0x126)),console[_0x35bced(0xdd)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console['error'](_0x35bced(0x157)),console['error']('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console[_0x35bced(0xdd)](_0x35bced(0xbe)),0x1;try{const _0x404d0e=_0x296a09[_0x35bced(0x135)];let _0x520657=_0x144a49;!_0x208865&&_0x404d0e&&!_0x144a49['includes']('/')&&(_0x520657=_0x404d0e+'/'+_0x144a49,_0x296a09[_0x35bced(0xd5)]&&console[_0x35bced(0xdd)](_0x35bced(0x109)+_0x520657));const _0x411a97=await withSpinner('Resolving\x20path\x20\x27'+_0x520657+'\x27...',()=>_0x339b5a['segment'][_0x35bced(0xf3)](_0x520657),{'verbose':_0x296a09['verbose']}),_0x52fba5=_0x411a97[_0x35bced(0xec)];_0x296a09[_0x35bced(0xd5)]&&(console[_0x35bced(0xdd)](_0x35bced(0x123)+_0x52fba5[_0x35bced(0x139)]),console['error'](_0x35bced(0xe3)+_0x52fba5['parentId']),_0x52fba5['folderId']&&console[_0x35bced(0xdd)](_0x35bced(0xcb)+_0x52fba5[_0x35bced(0xdc)]),_0x52fba5['segmentId']&&console[_0x35bced(0xdd)]('Segment\x20ID:\x20'+_0x52fba5['segmentId']));if(_0x52fba5[_0x35bced(0x139)]==='parent'){const _0xcaf242=await withSpinner(_0x35bced(0xe0),()=>_0x339b5a[_0x35bced(0x124)][_0x35bced(0xe4)](_0x52fba5[_0x35bced(0x12d)]),{'verbose':_0x296a09[_0x35bced(0xd5)]});await handleSingleObjectOutput(_0xcaf242[_0x35bced(0xec)],_0x296a09);}else{if(_0x52fba5[_0x35bced(0x139)]==='folder'){if(!_0x52fba5['folderId'])throw new SDKError(ErrorCode[_0x35bced(0x148)],_0x35bced(0xdb));const _0x256358=await withSpinner(_0x35bced(0x116),()=>_0x339b5a['segment'][_0x35bced(0x144)](_0x52fba5[_0x35bced(0xdc)]),{'verbose':_0x296a09[_0x35bced(0xd5)]});await handleSingleObjectOutput(_0x256358['data'],_0x296a09);}else{if(_0x52fba5['type']==='segment'){if(!_0x52fba5[_0x35bced(0xe7)])throw new SDKError(ErrorCode[_0x35bced(0xcc)],_0x35bced(0xc9));const _0xeb1cb8=await withSpinner(_0x35bced(0xb8),()=>_0x339b5a[_0x35bced(0x124)][_0x35bced(0x103)](_0x52fba5[_0x35bced(0x12d)],_0x52fba5[_0x35bced(0xe7)]),{'verbose':_0x296a09[_0x35bced(0xd5)]});await handleSingleObjectOutput(_0xeb1cb8[_0x35bced(0xec)],_0x296a09);}}}return 0x0;}catch(_0x11b934){if(_0x11b934 instanceof SDKError)return console[_0x35bced(0xdd)](_0x35bced(0xf8)+_0x11b934[_0x35bced(0xe2)]),_0x11b934['cause']&&console[_0x35bced(0xdd)](_0x35bced(0xfb)+_0x11b934[_0x35bced(0x11c)]),0x1;throw _0x11b934;}}}export class SegmentShowCommand extends BaseCommand{['name']=a41_0x47ad23(0xbd);[a41_0x47ad23(0x14f)]=a41_0x47ad23(0x11f);async['execute'](_0x29c04f){const _0xb31b0c=a41_0x47ad23,{options:_0x195cc4,args:_0x5d8a89,tdx:_0x403b31}=_0x29c04f,_0x24fb11=_0x5d8a89[0x0];if(!_0x24fb11)return console[_0xb31b0c(0xdd)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0xb31b0c(0xdd)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console[_0xb31b0c(0xdd)](_0xb31b0c(0x117)),console['error']('Examples:'),console[_0xb31b0c(0xdd)](_0xb31b0c(0xe5)),console['error'](_0xb31b0c(0x13a)),0x1;try{const _0x207853=_0x195cc4['parentSegment'],_0x8d2f4=await resolveSegmentTarget(_0x24fb11,_0x207853,_0x195cc4[_0xb31b0c(0xd5)]);_0x195cc4['verbose']&&console['error'](_0xb31b0c(0xed)+_0x8d2f4);const _0x1c7bcb=await withSpinner(_0xb31b0c(0xcd)+_0x24fb11+'\x27...',()=>_0x403b31[_0xb31b0c(0x124)][_0xb31b0c(0xf3)](_0x8d2f4),{'verbose':_0x195cc4[_0xb31b0c(0xd5)]}),_0x227c28=_0x1c7bcb[_0xb31b0c(0xec)];_0x195cc4[_0xb31b0c(0xd5)]&&(console[_0xb31b0c(0xdd)](_0xb31b0c(0x123)+_0x227c28[_0xb31b0c(0x139)]),console[_0xb31b0c(0xdd)](_0xb31b0c(0xe3)+_0x227c28[_0xb31b0c(0x12d)]));if(_0x227c28[_0xb31b0c(0x139)]===_0xb31b0c(0x107))return console['error']('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0xb31b0c(0xdd)](_0xb31b0c(0xeb)),0x1;if(_0x227c28[_0xb31b0c(0x139)]===_0xb31b0c(0xf5))return console[_0xb31b0c(0xdd)](_0xb31b0c(0xf4)),console[_0xb31b0c(0xdd)](_0xb31b0c(0x138)),0x1;if(!_0x227c28['segmentId'])throw new SDKError(ErrorCode[_0xb31b0c(0xcc)],_0xb31b0c(0xc9));const _0x15053c=await withSpinner(_0xb31b0c(0x141),()=>_0x403b31[_0xb31b0c(0x124)][_0xb31b0c(0xd7)](_0x227c28[_0xb31b0c(0x12d)],_0x227c28['segmentId']),{'verbose':_0x195cc4[_0xb31b0c(0xd5)]});let _0x4abcc6=_0x15053c[_0xb31b0c(0xec)];const _0x307796=resolveLimit(_0x195cc4['limit'],DEFAULT_DISPLAY_LIMIT),_0x1bc9d7=/\bLIMIT\s+\d+/i['test'](_0x4abcc6);!_0x1bc9d7&&(_0x4abcc6=_0x4abcc6['trim']()[_0xb31b0c(0x154)](/;+$/,''),_0x4abcc6=_0xb31b0c(0x10d)+_0x4abcc6+_0xb31b0c(0xcf)+_0x307796);_0x195cc4[_0xb31b0c(0xd5)]&&console['error'](_0xb31b0c(0xde)+_0x4abcc6);const _0x31e444=await withProgressSpinner('Executing\x20segment\x20query...',async _0x596303=>{const _0x2cc40f=_0xb31b0c,_0x4c46cc=await _0x403b31['query'][_0x2cc40f(0x129)](_0x4abcc6,{'catalog':'td','schema':_0x2cc40f(0x10c),'onJobId':_0x1a86c8=>{const _0x296eec=_0x2cc40f;_0x596303[_0x296eec(0xb7)](_0x1a86c8);}});return _0x4c46cc;},{'verbose':_0x195cc4[_0xb31b0c(0xd5)]}),_0x270d2c=_0x31e444[_0xb31b0c(0xec)],_0x2d9781=_0x270d2c[_0xb31b0c(0xbc)]?_0xb31b0c(0xb6)+_0x270d2c['jobId']+']':'';return console['error']('✔\x20Query\x20completed:\x20Processed\x20'+_0x270d2c[_0xb31b0c(0xd1)][_0xb31b0c(0x137)][_0xb31b0c(0x104)]()+_0xb31b0c(0xef)+('in\x20'+formatElapsed(_0x270d2c[_0xb31b0c(0xd1)]['elapsedTimeMillis'])+_0x2d9781)),await handleQueryOutput(_0x270d2c,_0x195cc4),0x0;}catch(_0x4364f6){if(_0x4364f6 instanceof SDKError)return console[_0xb31b0c(0xdd)](_0xb31b0c(0x12f)+_0x4364f6['code']+']'),console[_0xb31b0c(0xdd)]('\x0a'+_0x4364f6[_0xb31b0c(0xe2)]),0x1;throw _0x4364f6;}}}export class SegmentFolderListCommand extends BaseCommand{[a41_0x47ad23(0x14d)]=a41_0x47ad23(0x13c);[a41_0x47ad23(0x14f)]=a41_0x47ad23(0x14e);async[a41_0x47ad23(0x129)](_0x1ad433){const _0x1b372e=a41_0x47ad23,{options:_0xc562b3,args:_0x3f757e,tdx:_0x2d798d}=_0x1ad433;if(_0x3f757e['length']===0x0)return console[_0x1b372e(0xdd)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x1b372e(0xdd)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x5d4e2e=_0x3f757e[0x0];try{_0xc562b3['verbose']&&(console[_0x1b372e(0xdd)](_0x1b372e(0x153)+_0xc562b3['site']),console[_0x1b372e(0xdd)](_0x1b372e(0x15c)+_0x5d4e2e));const _0x1b8e89=await withSpinner(_0x1b372e(0xfa)+_0x5d4e2e+_0x1b372e(0xe1),()=>_0x2d798d[_0x1b372e(0x124)][_0x1b372e(0x100)](_0x5d4e2e),{'verbose':_0xc562b3[_0x1b372e(0xd5)]}),_0x3473fc=_0x1b8e89['data'];_0xc562b3[_0x1b372e(0xd5)]&&console[_0x1b372e(0xdd)](_0x1b372e(0xda)+_0x3473fc);const _0x32b0cd=await withSpinner(_0x1b372e(0x15b)+_0x5d4e2e+_0x1b372e(0xe1),()=>_0x2d798d['segment']['listFolders'](_0x3473fc),{'verbose':_0xc562b3[_0x1b372e(0xd5)]}),_0xd9c64c=_0x32b0cd[_0x1b372e(0xec)];return console[_0x1b372e(0xdd)](_0x1b372e(0x128)+_0xd9c64c[_0x1b372e(0x155)]+_0x1b372e(0x158)+(_0xd9c64c[_0x1b372e(0x155)]!==0x1?'s':'')),await handleSDKOutput(_0xd9c64c,_0xc562b3),0x0;}catch(_0x1bf7ad){if(_0x1bf7ad instanceof SDKError)return console[_0x1b372e(0xdd)](_0x1b372e(0xf8)+_0x1bf7ad[_0x1b372e(0xe2)]),_0x1bf7ad[_0x1b372e(0x11c)]&&console[_0x1b372e(0xdd)](_0x1b372e(0xfb)+_0x1bf7ad[_0x1b372e(0x11c)]),0x1;throw _0x1bf7ad;}}}export class SegmentFolderShowCommand extends BaseCommand{[a41_0x47ad23(0x14d)]=a41_0x47ad23(0xd4);[a41_0x47ad23(0x14f)]=a41_0x47ad23(0x14b);async[a41_0x47ad23(0x129)](_0x5b4ad5){const _0x590694=a41_0x47ad23,{options:_0x2e2b27,args:_0x1af650,tdx:_0x52c22b}=_0x5b4ad5;if(_0x1af650[_0x590694(0x155)]===0x0)return console['error']('Error:\x20Folder\x20reference\x20is\x20required'),console[_0x590694(0xdd)](_0x590694(0x112)),0x1;try{const {parentId:_0x59a57b,childId:_0x1b346b}=parseSegmentRef(_0x1af650[0x0]);_0x2e2b27[_0x590694(0xd5)]&&(console[_0x590694(0xdd)](_0x590694(0x153)+_0x2e2b27[_0x590694(0x12b)]),console[_0x590694(0xdd)]('Parent\x20name:\x20'+_0x59a57b),_0x1b346b&&console[_0x590694(0xdd)](_0x590694(0x142)+_0x1b346b));if(!_0x1b346b)return console['error']('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x553ff2=await withSpinner(_0x590694(0xfa)+_0x59a57b+_0x590694(0xe1),()=>_0x52c22b[_0x590694(0x124)][_0x590694(0x100)](_0x59a57b),{'verbose':_0x2e2b27[_0x590694(0xd5)]}),_0x1a73a2=_0x553ff2[_0x590694(0xec)];_0x2e2b27[_0x590694(0xd5)]&&console['error'](_0x590694(0xda)+_0x1a73a2);const _0x4e4c84=await withSpinner(_0x590694(0xb4)+_0x1b346b+_0x590694(0xe1),()=>_0x52c22b['segment'][_0x590694(0xf9)](_0x1a73a2,_0x1b346b),{'verbose':_0x2e2b27[_0x590694(0xd5)]}),_0x3ad3d5=_0x4e4c84[_0x590694(0xec)];_0x2e2b27['verbose']&&console[_0x590694(0xdd)](_0x590694(0x118)+_0x3ad3d5);const _0x3f4d06=await withSpinner(_0x590694(0x15a)+_0x1b346b+_0x590694(0xe1),()=>_0x52c22b[_0x590694(0x124)][_0x590694(0x144)](_0x3ad3d5),{'verbose':_0x2e2b27[_0x590694(0xd5)]});return await handleSDKOutput([_0x3f4d06[_0x590694(0xec)]],_0x2e2b27),0x0;}catch(_0x278564){if(_0x278564 instanceof SDKError)return console[_0x590694(0xdd)]('Error:\x20'+_0x278564['message']),_0x278564[_0x590694(0x11c)]&&console[_0x590694(0xdd)](_0x590694(0xfb)+_0x278564['cause']),0x1;throw _0x278564;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a41_0x47ad23(0x13d);[a41_0x47ad23(0x14f)]=a41_0x47ad23(0x113);async[a41_0x47ad23(0x129)](_0x4f21f8){const _0x723a10=a41_0x47ad23,{options:_0x191134,args:_0x29f9d9}=_0x4f21f8,_0xcb4adc=_0x191134,_0x5af0a1=_0xcb4adc['path'],_0x58974d=_0x29f9d9[0x0];if(!_0x58974d&&!_0x5af0a1)return console[_0x723a10(0xdd)](a41_0x48433e['red'](_0x723a10(0x122))),console[_0x723a10(0xdd)](_0x723a10(0x136)),console[_0x723a10(0xdd)](_0x723a10(0xc4)),console[_0x723a10(0xdd)](_0x723a10(0x150)),console[_0x723a10(0xdd)]('Examples:'),console['error'](_0x723a10(0x15d)),console[_0x723a10(0xdd)](_0x723a10(0x12a)),0x1;if(_0x58974d&&_0x5af0a1)return console[_0x723a10(0xdd)](a41_0x48433e[_0x723a10(0x119)](_0x723a10(0x13b))),0x1;try{let _0x522cd2;if(_0x5af0a1)_0x522cd2=await this[_0x723a10(0x13f)](_0x5af0a1,_0x4f21f8);else{if(isYamlFilePath(_0x58974d))return console['error'](a41_0x48433e[_0x723a10(0x119)](_0x723a10(0x159))),console[_0x723a10(0xdd)](_0x723a10(0xd0)+_0x58974d),0x1;else _0x522cd2=await this[_0x723a10(0xe9)](_0x58974d,_0x4f21f8);}return _0x191134['format']===_0x723a10(0xba)||_0x191134[_0x723a10(0x140)]===_0x723a10(0xc5)?await handleSDKOutput([{'sql':_0x522cd2}],_0x191134):console[_0x723a10(0xc7)](_0x522cd2),0x0;}catch(_0x55a0b9){if(_0x55a0b9 instanceof SDKError)return console[_0x723a10(0xdd)]('Error:\x20'+_0x55a0b9[_0x723a10(0xe2)]),_0x55a0b9[_0x723a10(0x11c)]&&console[_0x723a10(0xdd)](_0x723a10(0xfb)+_0x55a0b9[_0x723a10(0x11c)]),0x1;throw _0x55a0b9;}}async['getSQLFromYamlFile'](_0x2761ae,_0x9ea4aa){const _0x1ae16a=a41_0x47ad23,{options:_0x54a97d,tdx:_0x1bd57d}=_0x9ea4aa;let _0xdb8e4e;try{_0xdb8e4e=await resolveYamlFilePath(_0x2761ae);}catch(_0x42774b){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1ae16a(0x102)+_0x42774b[_0x1ae16a(0xe2)]);}_0x54a97d['verbose']&&console[_0x1ae16a(0xdd)](_0x1ae16a(0x14c)+_0xdb8e4e[_0x1ae16a(0x115)]+'/'+_0xdb8e4e[_0x1ae16a(0xd3)]);const _0x1834c9=await withSpinner(_0x1ae16a(0x11e),()=>_0x1bd57d['segment'][_0x1ae16a(0xd9)](_0xdb8e4e['content'],_0xdb8e4e[_0x1ae16a(0x115)],_0xdb8e4e[_0x1ae16a(0xd3)]),{'verbose':_0x54a97d[_0x1ae16a(0xd5)]});return _0x1834c9['data'];}async['getSQLFromServerSegment'](_0x30edd8,_0x990cb7){const _0x18e9ae=a41_0x47ad23,{options:_0x1f1e34,tdx:_0x2716a6}=_0x990cb7,_0x53efd8=_0x1f1e34[_0x18e9ae(0x115)],_0x2822a9=await resolveSegmentTarget(_0x30edd8,_0x53efd8,_0x1f1e34['verbose']);_0x1f1e34[_0x18e9ae(0xd5)]&&console[_0x18e9ae(0xdd)]('Target\x20path:\x20'+_0x2822a9);const _0x1d5a8c=await withSpinner('Resolving\x20\x27'+_0x30edd8+_0x18e9ae(0xe1),()=>_0x2716a6['segment'][_0x18e9ae(0xf3)](_0x2822a9),{'verbose':_0x1f1e34[_0x18e9ae(0xd5)]}),_0x19960e=_0x1d5a8c[_0x18e9ae(0xec)];_0x1f1e34[_0x18e9ae(0xd5)]&&(console[_0x18e9ae(0xdd)](_0x18e9ae(0x123)+_0x19960e[_0x18e9ae(0x139)]),console['error'](_0x18e9ae(0xe3)+_0x19960e[_0x18e9ae(0x12d)]));if(_0x19960e[_0x18e9ae(0x139)]===_0x18e9ae(0x107))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.');if(_0x19960e[_0x18e9ae(0x139)]==='parent')throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x18e9ae(0xf1));if(!_0x19960e[_0x18e9ae(0xe7)])throw new SDKError(ErrorCode[_0x18e9ae(0xcc)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x3895e9=await withSpinner(_0x18e9ae(0x141),()=>_0x2716a6['segment'][_0x18e9ae(0xd7)](_0x19960e['parentId'],_0x19960e[_0x18e9ae(0xe7)]),{'verbose':_0x1f1e34[_0x18e9ae(0xd5)]});return _0x3895e9[_0x18e9ae(0xec)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a41_0x47ad23(0x14d)]=a41_0x47ad23(0xbb);['description']=a41_0x47ad23(0x114);async[a41_0x47ad23(0x129)](_0x1fab6f){const _0x354375=a41_0x47ad23,{options:_0x2cddf2,args:_0x3918a9,tdx:_0xeb1705}=_0x1fab6f,_0x37f63e=_0x2cddf2;if(_0x3918a9['length']<0x2)return console[_0x354375(0xdd)](_0x354375(0xdf)),console[_0x354375(0xdd)](_0x354375(0xc2)),0x1;const _0x11b3ab=_0x3918a9[0x0],_0x2d1300=_0x3918a9[0x1];_0x37f63e['verbose']&&(console[_0x354375(0xdd)]('Site:\x20'+_0x37f63e['site']),console['error']('Parent\x20segment:\x20'+_0x11b3ab),console[_0x354375(0xdd)](_0x354375(0x142)+_0x2d1300));let _0x35b33a;if(_0x37f63e[_0x354375(0x15e)]){const _0x70aefd=_0x37f63e[_0x354375(0x15e)],_0x18904e=await withSpinner(_0x354375(0xfa)+_0x11b3ab+_0x354375(0xe1),()=>_0xeb1705[_0x354375(0x124)]['resolveParentId'](_0x11b3ab),{'verbose':_0x37f63e['verbose']}),_0x40348e=_0x18904e[_0x354375(0xec)],_0x7527cc=await withSpinner(_0x354375(0x127)+_0x70aefd+_0x354375(0xe1),()=>_0xeb1705['segment'][_0x354375(0xf9)](_0x40348e,_0x70aefd),{'verbose':_0x37f63e[_0x354375(0xd5)]});_0x35b33a=_0x7527cc[_0x354375(0xec)],_0x37f63e[_0x354375(0xd5)]&&console[_0x354375(0xdd)](_0x354375(0xf7)+_0x35b33a);}const _0x49d523={'name':_0x2d1300,'description':_0x37f63e[_0x354375(0x14f)],'parentFolderId':_0x35b33a},_0x247c68=await withSpinner('Creating\x20folder\x20\x27'+_0x2d1300+'\x27...',()=>_0xeb1705[_0x354375(0x124)][_0x354375(0x120)](_0x11b3ab,_0x49d523),{'verbose':_0x37f63e[_0x354375(0xd5)]}),_0x320858=_0x247c68[_0x354375(0xec)];return console[_0x354375(0xdd)](_0x354375(0xd8)+_0x320858[_0x354375(0x14d)]+_0x354375(0x134)+_0x320858['id']),await handleSDKOutput([_0x320858],_0x37f63e),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a41_0x47ad23(0x145);[a41_0x47ad23(0x14f)]='Show\x20folder\x20or\x20child\x20segment\x20details';async[a41_0x47ad23(0x129)](_0x5ce743){const _0x17daa2=a41_0x47ad23,{options:_0x2dd49d,args:_0x31103e,tdx:_0xf21728}=_0x5ce743,_0x2386b3=_0x31103e[0x0];if(!_0x2386b3)return console[_0x17daa2(0xdd)](_0x17daa2(0xc1)),console[_0x17daa2(0xdd)](_0x17daa2(0xce)),console[_0x17daa2(0xdd)](_0x17daa2(0xc3)),console[_0x17daa2(0xdd)](_0x17daa2(0xea)),console[_0x17daa2(0xdd)](_0x17daa2(0x156)),console['error'](_0x17daa2(0x126)),console['error'](_0x17daa2(0x14a)),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console['error'](_0x17daa2(0x125)),console[_0x17daa2(0xdd)](_0x17daa2(0xca)),0x1;try{const _0x16424f=_0x2dd49d[_0x17daa2(0x115)],_0x1f8718=await resolveSegmentTarget(_0x2386b3,_0x16424f,_0x2dd49d['verbose']);_0x2dd49d[_0x17daa2(0xd5)]&&console[_0x17daa2(0xdd)](_0x17daa2(0xed)+_0x1f8718);const _0x55e4e9=await withSpinner(_0x17daa2(0xcd)+_0x2386b3+'\x27...',()=>_0xf21728['segment'][_0x17daa2(0xf3)](_0x1f8718),{'verbose':_0x2dd49d[_0x17daa2(0xd5)]}),_0x3e4ae6=_0x55e4e9[_0x17daa2(0xec)];_0x2dd49d[_0x17daa2(0xd5)]&&(console[_0x17daa2(0xdd)](_0x17daa2(0x123)+_0x3e4ae6[_0x17daa2(0x139)]),console[_0x17daa2(0xdd)](_0x17daa2(0xe3)+_0x3e4ae6[_0x17daa2(0x12d)]),_0x3e4ae6['folderId']&&console[_0x17daa2(0xdd)](_0x17daa2(0xcb)+_0x3e4ae6[_0x17daa2(0xdc)]),_0x3e4ae6[_0x17daa2(0xe7)]&&console[_0x17daa2(0xdd)](_0x17daa2(0x133)+_0x3e4ae6['segmentId']));if(_0x2dd49d[_0x17daa2(0xf2)]){if(_0x3e4ae6[_0x17daa2(0x139)]===_0x17daa2(0x107))return console['error'](_0x17daa2(0x10f)),0x1;if(_0x3e4ae6[_0x17daa2(0x139)]===_0x17daa2(0xf5))return console[_0x17daa2(0xdd)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x17daa2(0xdd)](_0x17daa2(0x149)),0x1;if(!_0x3e4ae6[_0x17daa2(0xe7)])throw new SDKError(ErrorCode[_0x17daa2(0xcc)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x4f40af=getConsoleNextUrl(_0x2dd49d['site'],'/app/ps/'+_0x3e4ae6[_0x17daa2(0x12d)]+_0x17daa2(0xc8)+_0x3e4ae6[_0x17daa2(0xe7)]);return console[_0x17daa2(0xdd)](a41_0x48433e[_0x17daa2(0xfd)]('✔')+_0x17daa2(0x147)+a41_0x48433e[_0x17daa2(0x110)](_0x4f40af)),openBrowser(_0x4f40af),0x0;}if(_0x3e4ae6[_0x17daa2(0x139)]===_0x17daa2(0x107)){if(!_0x3e4ae6[_0x17daa2(0xdc)])throw new SDKError(ErrorCode[_0x17daa2(0x148)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0xc88e38=await withSpinner(_0x17daa2(0x116),()=>_0xf21728[_0x17daa2(0x124)]['getFolder'](_0x3e4ae6['folderId']),{'verbose':_0x2dd49d[_0x17daa2(0xd5)]});await handleSingleObjectOutput(_0xc88e38['data'],_0x2dd49d);}else{if(_0x3e4ae6[_0x17daa2(0x139)]===_0x17daa2(0x124)){if(!_0x3e4ae6[_0x17daa2(0xe7)])throw new SDKError(ErrorCode[_0x17daa2(0xcc)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x525179=await withSpinner('Fetching\x20segment\x20details...',()=>_0xf21728['segment'][_0x17daa2(0x103)](_0x3e4ae6[_0x17daa2(0x12d)],_0x3e4ae6[_0x17daa2(0xe7)]),{'verbose':_0x2dd49d[_0x17daa2(0xd5)]}),_0x562d86=getConsoleNextUrl(_0x2dd49d[_0x17daa2(0x12b)],_0x17daa2(0xd6)+_0x3e4ae6[_0x17daa2(0x12d)]+'/e/'+_0x3e4ae6['segmentId']),_0xf6b1ce=_0x525179[_0x17daa2(0xec)];_0xf6b1ce['url']=_0x562d86,await handleSingleObjectOutput(_0xf6b1ce,_0x2dd49d);}else return console[_0x17daa2(0xdd)](_0x17daa2(0x151)),console['error'](_0x17daa2(0xfc)),0x1;}return 0x0;}catch(_0x1020f9){if(_0x1020f9 instanceof SDKError)return console[_0x17daa2(0xdd)](_0x17daa2(0xf8)+_0x1020f9[_0x17daa2(0xe2)]),_0x1020f9[_0x17daa2(0x11c)]&&console[_0x17daa2(0xdd)]('\x20\x20Cause:\x20'+_0x1020f9[_0x17daa2(0x11c)]),0x1;throw _0x1020f9;}}}export const SegmentInfoCommand=SegmentViewCommand;function a41_0x5b7b(_0xea936d,_0x153833){_0xea936d=_0xea936d-0xb4;const _0xb829ca=a41_0xb829();let _0x5b7be3=_0xb829ca[_0xea936d];return _0x5b7be3;}export class SegmentDescCommand extends BaseCommand{[a41_0x47ad23(0x14d)]=a41_0x47ad23(0x101);[a41_0x47ad23(0x14f)]=a41_0x47ad23(0x152);async[a41_0x47ad23(0x129)](_0x203fc9){const _0x89ac7b=a41_0x47ad23,{options:_0x1e1989,args:_0x108636,tdx:_0x9a3854}=_0x203fc9,_0x36c889=_0x108636[0x0];if(!_0x36c889)return console['error'](_0x89ac7b(0xe6)),console[_0x89ac7b(0xdd)](_0x89ac7b(0x121)),console[_0x89ac7b(0xdd)](_0x89ac7b(0x10a)),console[_0x89ac7b(0xdd)]('Examples:'),console['error'](_0x89ac7b(0xc6)),console[_0x89ac7b(0xdd)](_0x89ac7b(0x12e)),0x1;try{const _0x37a25d=_0x1e1989['parentSegment'],_0x5800ef=await resolveSegmentTarget(_0x36c889,_0x37a25d,_0x1e1989[_0x89ac7b(0xd5)]);_0x1e1989['verbose']&&console['error'](_0x89ac7b(0xed)+_0x5800ef);const _0x302ad9=await withSpinner('Resolving\x20\x27'+_0x36c889+_0x89ac7b(0xe1),()=>_0x9a3854[_0x89ac7b(0x124)][_0x89ac7b(0xf3)](_0x5800ef),{'verbose':_0x1e1989[_0x89ac7b(0xd5)]}),_0x44e4af=_0x302ad9[_0x89ac7b(0xec)];_0x1e1989[_0x89ac7b(0xd5)]&&(console[_0x89ac7b(0xdd)](_0x89ac7b(0x123)+_0x44e4af[_0x89ac7b(0x139)]),console[_0x89ac7b(0xdd)]('Parent\x20ID:\x20'+_0x44e4af[_0x89ac7b(0x12d)]));if(_0x44e4af[_0x89ac7b(0x139)]===_0x89ac7b(0x107))return console[_0x89ac7b(0xdd)](_0x89ac7b(0xb9)),console['error'](_0x89ac7b(0xf0)),0x1;if(_0x44e4af['type']==='parent')return console[_0x89ac7b(0xdd)](_0x89ac7b(0x11a)),console[_0x89ac7b(0xdd)](_0x89ac7b(0x143)),0x1;if(!_0x44e4af[_0x89ac7b(0xe7)])throw new SDKError(ErrorCode[_0x89ac7b(0xcc)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x19e772=await withSpinner(_0x89ac7b(0x141),()=>_0x9a3854[_0x89ac7b(0x124)]['getSegmentSQL'](_0x44e4af['parentId'],_0x44e4af[_0x89ac7b(0xe7)]),{'verbose':_0x1e1989['verbose']}),_0x3a2373=_0x19e772[_0x89ac7b(0xec)],_0x1cadc7=await executeSchemaQuery(_0x3a2373,_0x9a3854,_0x1e1989);return await handleQueryOutput(_0x1cadc7,_0x1e1989),0x0;}catch(_0x202d9e){if(_0x202d9e instanceof SDKError)return console[_0x89ac7b(0xdd)](_0x89ac7b(0xf8)+_0x202d9e[_0x89ac7b(0xe2)]),_0x202d9e['cause']&&console[_0x89ac7b(0xdd)]('\x20\x20Cause:\x20'+_0x202d9e[_0x89ac7b(0x11c)]),0x1;throw _0x202d9e;}}}
@@ -1 +1 @@
1
- const a42_0x23b1e1=a42_0x2aee;function a42_0x55b4(){const _0x1a05c2=['verbose','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','2104150htpTKi','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','data','kind','resolveFolderId','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','segmentPath','635544aYJpYM','Parent:\x20','description','folder','\x27...','6jllHRJ','Resolved\x20relative\x20path\x20to:\x20','\x20\x20\x20Path:\x20','folderId','Resolving\x20folder\x20\x27','10jnaniD','segments','segment:create','execute','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','57556nSGdLM','segment','2098350IFTxXi','15rwzemq','Creating\x20segment\x20\x27','name','error','Resolved\x20folder\x20ID:\x20','Create\x20child\x20segment\x20with\x20filtering\x20rules','parent','Resolving\x20parent\x20segment\x20\x27','resolvePathToResource','Segment\x20name:\x20','2631144QFHuiI','site','yellow','rule','✔\x20Created\x20segment\x20\x27','includes','47331AZqGnt','1384115QMrIRK','length','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','Resolving\x20folder\x20path\x20\x27','type'];a42_0x55b4=function(){return _0x1a05c2;};return a42_0x55b4();}(function(_0x15085a,_0x39e7a6){const _0x248355=a42_0x2aee,_0x3ac777=_0x15085a();while(!![]){try{const _0x7e371=-parseInt(_0x248355(0x1e1))/0x1*(parseInt(_0x248355(0x1c9))/0x2)+parseInt(_0x248355(0x1d1))/0x3*(-parseInt(_0x248355(0x1ce))/0x4)+parseInt(_0x248355(0x1e2))/0x5*(parseInt(_0x248355(0x1c4))/0x6)+-parseInt(_0x248355(0x1bf))/0x7+parseInt(_0x248355(0x1db))/0x8+-parseInt(_0x248355(0x1d0))/0x9+parseInt(_0x248355(0x1b8))/0xa;if(_0x7e371===_0x39e7a6)break;else _0x3ac777['push'](_0x3ac777['shift']());}catch(_0x4459d3){_0x3ac777['push'](_0x3ac777['shift']());}}}(a42_0x55b4,0x2cd25));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a42_0x2aee(_0x4d8815,_0x9da76b){_0x4d8815=_0x4d8815-0x1b3;const _0x55b450=a42_0x55b4();let _0x2aee9e=_0x55b450[_0x4d8815];return _0x2aee9e;}import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a42_0x5b053f from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']=a42_0x23b1e1(0x1cb);[a42_0x23b1e1(0x1c1)]=a42_0x23b1e1(0x1d6);async[a42_0x23b1e1(0x1cc)](_0x4828ef){const _0x57fc14=a42_0x23b1e1;console[_0x57fc14(0x1d4)](a42_0x5b053f['yellow'](_0x57fc14(0x1b3))),console[_0x57fc14(0x1d4)](a42_0x5b053f[_0x57fc14(0x1dd)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x480447,args:_0x429b14,tdx:_0x2cda6a}=_0x4828ef,_0x3be9f4=_0x480447;if(_0x429b14[_0x57fc14(0x1e3)]===0x0)return console[_0x57fc14(0x1d4)](_0x57fc14(0x1cd)),console[_0x57fc14(0x1d4)]('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console[_0x57fc14(0x1d4)]('Examples:'),console[_0x57fc14(0x1d4)](_0x57fc14(0x1b7)),console[_0x57fc14(0x1d4)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console[_0x57fc14(0x1d4)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x170f83=_0x429b14[0x0],_0x32f615=_0x480447[_0x57fc14(0x1be)];let _0x439aa4=_0x170f83;_0x32f615&&!_0x170f83[_0x57fc14(0x1e0)]('/')&&(_0x439aa4=_0x32f615+'/'+_0x170f83,_0x3be9f4[_0x57fc14(0x1b6)]&&console[_0x57fc14(0x1d4)](_0x57fc14(0x1c5)+_0x439aa4));const _0x2dd483=parsePath(_0x439aa4);if(_0x2dd483[_0x57fc14(0x1ca)][_0x57fc14(0x1e3)]<0x2)return console[_0x57fc14(0x1d4)]('Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'),console[_0x57fc14(0x1d4)](_0x57fc14(0x1bd)),0x1;const _0x3e9aa9=_0x2dd483[_0x57fc14(0x1ca)][0x0],_0x473bd9=getBaseName(_0x439aa4),_0x454a53=getParentPath(_0x439aa4);_0x3be9f4[_0x57fc14(0x1b6)]&&(console[_0x57fc14(0x1d4)]('Site:\x20'+_0x3be9f4[_0x57fc14(0x1dc)]),console['error']('Target\x20path:\x20'+_0x439aa4),console[_0x57fc14(0x1d4)](_0x57fc14(0x1c0)+_0x3e9aa9),console[_0x57fc14(0x1d4)](_0x57fc14(0x1da)+_0x473bd9),console[_0x57fc14(0x1d4)]('Parent\x20path:\x20'+_0x454a53));const _0x141cbf=await withSpinner(_0x57fc14(0x1d8)+_0x3e9aa9+_0x57fc14(0x1c3),()=>_0x2cda6a[_0x57fc14(0x1cf)]['resolveParentId'](_0x3e9aa9),{'verbose':_0x3be9f4['verbose']}),_0x36d04d=_0x141cbf['data'];let _0x1e2022;if(_0x2dd483[_0x57fc14(0x1ca)][_0x57fc14(0x1e3)]>0x2){const _0x3a009f=await withSpinner(_0x57fc14(0x1b4)+_0x454a53+_0x57fc14(0x1c3),()=>_0x2cda6a['segment'][_0x57fc14(0x1d9)](_0x454a53),{'verbose':_0x3be9f4[_0x57fc14(0x1b6)]}),_0x1c73de=_0x3a009f[_0x57fc14(0x1ba)];if(_0x1c73de['type']!==_0x57fc14(0x1c2)&&_0x1c73de[_0x57fc14(0x1b5)]!==_0x57fc14(0x1d7))return console[_0x57fc14(0x1d4)](_0x57fc14(0x1b9)),0x1;_0x1e2022=_0x1c73de[_0x57fc14(0x1c7)];}else{if(_0x3be9f4[_0x57fc14(0x1c2)]){const _0x5adcf3=await withSpinner(_0x57fc14(0x1c8)+_0x3be9f4['folder']+'\x27...',()=>_0x2cda6a[_0x57fc14(0x1cf)][_0x57fc14(0x1bc)](_0x36d04d,_0x3be9f4[_0x57fc14(0x1c2)]),{'verbose':_0x3be9f4['verbose']});_0x1e2022=_0x5adcf3[_0x57fc14(0x1ba)];}}_0x3be9f4[_0x57fc14(0x1b6)]&&_0x1e2022&&console[_0x57fc14(0x1d4)](_0x57fc14(0x1d5)+_0x1e2022);const _0xdf6cd5=await loadJSONFromOptions(_0x3be9f4[_0x57fc14(0x1de)],_0x3be9f4['ruleFile']),_0x44a163={'name':_0x473bd9,'description':_0x3be9f4[_0x57fc14(0x1c1)],'rule':_0xdf6cd5,'kind':_0x3be9f4[_0x57fc14(0x1bb)]!==undefined?parseInt(_0x3be9f4['kind'],0xa):undefined,'isVisible':_0x3be9f4['invisible']?![]:undefined,'segmentFolderId':_0x1e2022,'countPopulation':_0x3be9f4['noCountPopulation']?![]:undefined},_0x3610e7=await withSpinner(_0x57fc14(0x1d2)+_0x473bd9+_0x57fc14(0x1c3),()=>_0x2cda6a[_0x57fc14(0x1cf)]['createSegment'](_0x36d04d,_0x44a163),{'verbose':_0x3be9f4[_0x57fc14(0x1b6)]}),_0x1fae19=_0x3610e7[_0x57fc14(0x1ba)];return console[_0x57fc14(0x1d4)](_0x57fc14(0x1df)+_0x1fae19[_0x57fc14(0x1d3)]+'\x27\x20with\x20ID:\x20'+_0x1fae19['id']),_0x439aa4!==_0x170f83&&console['error'](_0x57fc14(0x1c6)+_0x439aa4),await handleSDKOutput([_0x1fae19],_0x3be9f4),0x0;}}
1
+ const a42_0x2bbae0=a42_0x3b68;function a42_0x45a5(){const _0x2d834c=['site','segment','resolvePathToResource','name','1499854esvzLh','\x27...','length','segmentPath','yellow','Create\x20child\x20segment\x20with\x20filtering\x20rules','12386121gUoNnt','3189DkJeRs','✔\x20Created\x20segment\x20\x27','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','2393909XGlzXt','folder','verbose','invisible','Examples:','execute','80610BNufch','createSegment','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','4108VIJtjY','12229832kmfJTi','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','Site:\x20','folderId','error','Resolving\x20folder\x20path\x20\x27','1422ROQeZr','parent','24gJRnZw','rule','kind','6093440vBIxkd','Parent\x20path:\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','segment:create','description','Parent:\x20','segments','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','type','Resolving\x20folder\x20\x27','Resolved\x20folder\x20ID:\x20','2pGJFox','ruleFile','data','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','noCountPopulation','\x27\x20with\x20ID:\x20','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'];a42_0x45a5=function(){return _0x2d834c;};return a42_0x45a5();}(function(_0x69201d,_0x2577a1){const _0x389ed3=a42_0x3b68,_0x3ea95f=_0x69201d();while(!![]){try{const _0xf75893=-parseInt(_0x389ed3(0x217))/0x1*(parseInt(_0x389ed3(0x222))/0x2)+parseInt(_0x389ed3(0x1f4))/0x3*(parseInt(_0x389ed3(0x200))/0x4)+parseInt(_0x389ed3(0x20c))/0x5+-parseInt(_0x389ed3(0x209))/0x6*(-parseInt(_0x389ed3(0x1f7))/0x7)+-parseInt(_0x389ed3(0x201))/0x8+-parseInt(_0x389ed3(0x207))/0x9*(-parseInt(_0x389ed3(0x1fd))/0xa)+-parseInt(_0x389ed3(0x1f3))/0xb;if(_0xf75893===_0x2577a1)break;else _0x3ea95f['push'](_0x3ea95f['shift']());}catch(_0x52e6cb){_0x3ea95f['push'](_0x3ea95f['shift']());}}}(a42_0x45a5,0xc2ac5));function a42_0x3b68(_0x25d60a,_0x33e1ae){_0x25d60a=_0x25d60a-0x1ef;const _0x45a55b=a42_0x45a5();let _0x3b684b=_0x45a55b[_0x25d60a];return _0x3b684b;}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a42_0x3008ab from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']=a42_0x2bbae0(0x20f);[a42_0x2bbae0(0x210)]=a42_0x2bbae0(0x1f2);async[a42_0x2bbae0(0x1fc)](_0x47ea39){const _0x585766=a42_0x2bbae0;console[_0x585766(0x205)](a42_0x3008ab[_0x585766(0x1f1)](_0x585766(0x213))),console['error'](a42_0x3008ab[_0x585766(0x1f1)](_0x585766(0x20e)));const {options:_0x4cbc2c,args:_0x2a849e,tdx:_0xec10f}=_0x47ea39,_0x1b790e=_0x4cbc2c;if(_0x2a849e[_0x585766(0x1ef)]===0x0)return console['error'](_0x585766(0x1f6)),console[_0x585766(0x205)](_0x585766(0x21d)),console['error'](_0x585766(0x1fb)),console[_0x585766(0x205)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console[_0x585766(0x205)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console[_0x585766(0x205)](_0x585766(0x21a)),0x1;const _0x4ca7d0=_0x2a849e[0x0],_0xb79b45=_0x4cbc2c[_0x585766(0x1f0)];let _0x1658a2=_0x4ca7d0;_0xb79b45&&!_0x4ca7d0['includes']('/')&&(_0x1658a2=_0xb79b45+'/'+_0x4ca7d0,_0x1b790e[_0x585766(0x1f9)]&&console[_0x585766(0x205)]('Resolved\x20relative\x20path\x20to:\x20'+_0x1658a2));const _0xaa58f9=parsePath(_0x1658a2);if(_0xaa58f9['segments'][_0x585766(0x1ef)]<0x2)return console[_0x585766(0x205)]('Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'),console[_0x585766(0x205)](_0x585766(0x202)),0x1;const _0x3110a6=_0xaa58f9[_0x585766(0x212)][0x0],_0x38483f=getBaseName(_0x1658a2),_0x248a46=getParentPath(_0x1658a2);_0x1b790e['verbose']&&(console[_0x585766(0x205)](_0x585766(0x203)+_0x1b790e[_0x585766(0x21e)]),console[_0x585766(0x205)]('Target\x20path:\x20'+_0x1658a2),console[_0x585766(0x205)](_0x585766(0x211)+_0x3110a6),console[_0x585766(0x205)]('Segment\x20name:\x20'+_0x38483f),console[_0x585766(0x205)](_0x585766(0x20d)+_0x248a46));const _0x9d4bc0=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3110a6+_0x585766(0x223),()=>_0xec10f[_0x585766(0x21f)]['resolveParentId'](_0x3110a6),{'verbose':_0x1b790e[_0x585766(0x1f9)]}),_0x28a03c=_0x9d4bc0[_0x585766(0x219)];let _0x241dcc;if(_0xaa58f9['segments'][_0x585766(0x1ef)]>0x2){const _0x23c419=await withSpinner(_0x585766(0x206)+_0x248a46+_0x585766(0x223),()=>_0xec10f[_0x585766(0x21f)][_0x585766(0x220)](_0x248a46),{'verbose':_0x1b790e[_0x585766(0x1f9)]}),_0x3a3b08=_0x23c419[_0x585766(0x219)];if(_0x3a3b08[_0x585766(0x214)]!==_0x585766(0x1f8)&&_0x3a3b08[_0x585766(0x214)]!==_0x585766(0x208))return console[_0x585766(0x205)](_0x585766(0x1ff)),0x1;_0x241dcc=_0x3a3b08[_0x585766(0x204)];}else{if(_0x1b790e[_0x585766(0x1f8)]){const _0x1bc72e=await withSpinner(_0x585766(0x215)+_0x1b790e[_0x585766(0x1f8)]+'\x27...',()=>_0xec10f[_0x585766(0x21f)]['resolveFolderId'](_0x28a03c,_0x1b790e[_0x585766(0x1f8)]),{'verbose':_0x1b790e['verbose']});_0x241dcc=_0x1bc72e[_0x585766(0x219)];}}_0x1b790e[_0x585766(0x1f9)]&&_0x241dcc&&console[_0x585766(0x205)](_0x585766(0x216)+_0x241dcc);const _0x5cdfa0=await loadJSONFromOptions(_0x1b790e[_0x585766(0x20a)],_0x1b790e[_0x585766(0x218)]),_0x21a72a={'name':_0x38483f,'description':_0x1b790e[_0x585766(0x210)],'rule':_0x5cdfa0,'kind':_0x1b790e[_0x585766(0x20b)]!==undefined?parseInt(_0x1b790e['kind'],0xa):undefined,'isVisible':_0x1b790e[_0x585766(0x1fa)]?![]:undefined,'segmentFolderId':_0x241dcc,'countPopulation':_0x1b790e[_0x585766(0x21b)]?![]:undefined},_0x1c90f8=await withSpinner('Creating\x20segment\x20\x27'+_0x38483f+_0x585766(0x223),()=>_0xec10f[_0x585766(0x21f)][_0x585766(0x1fe)](_0x28a03c,_0x21a72a),{'verbose':_0x1b790e['verbose']}),_0x5665d4=_0x1c90f8[_0x585766(0x219)];return console[_0x585766(0x205)](_0x585766(0x1f5)+_0x5665d4[_0x585766(0x221)]+_0x585766(0x21c)+_0x5665d4['id']),_0x1658a2!==_0x4ca7d0&&console['error']('\x20\x20\x20Path:\x20'+_0x1658a2),await handleSDKOutput([_0x5665d4],_0x1b790e),0x0;}}