@treasuredata/tdx 2026.4.20 → 2026.4.22

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 (247) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/cas-command.js +1 -1
  13. package/dist/commands/cas-segment-command.js +1 -1
  14. package/dist/commands/chat-command.js +1 -1
  15. package/dist/commands/claude-command.d.ts.map +1 -1
  16. package/dist/commands/claude-command.js +1 -1
  17. package/dist/commands/claude-command.js.map +1 -1
  18. package/dist/commands/claude-statusline-command.js +1 -1
  19. package/dist/commands/claude-usage-command.js +1 -1
  20. package/dist/commands/command.js +1 -1
  21. package/dist/commands/connection-command.js +1 -1
  22. package/dist/commands/databases.js +1 -1
  23. package/dist/commands/delivery-command.js +1 -1
  24. package/dist/commands/describe.js +1 -1
  25. package/dist/commands/engage-campaign-pull-command.js +1 -1
  26. package/dist/commands/engage-campaign-push-command.js +1 -1
  27. package/dist/commands/engage-campaign-validate-command.js +1 -1
  28. package/dist/commands/engage-command.d.ts +47 -0
  29. package/dist/commands/engage-command.d.ts.map +1 -1
  30. package/dist/commands/engage-command.js +1 -1
  31. package/dist/commands/engage-command.js.map +1 -1
  32. package/dist/commands/engage-template-pull-command.js +1 -1
  33. package/dist/commands/engage-template-push-command.js +1 -1
  34. package/dist/commands/engage-template-validate-command.js +1 -1
  35. package/dist/commands/job-command.js +1 -1
  36. package/dist/commands/journey-command.js +1 -1
  37. package/dist/commands/journey-validate-command.js +1 -1
  38. package/dist/commands/llm-command.js +1 -1
  39. package/dist/commands/mcp-command.js +1 -1
  40. package/dist/commands/parent-segment-command.js +1 -1
  41. package/dist/commands/policy-command.js +1 -1
  42. package/dist/commands/profile-command.js +1 -1
  43. package/dist/commands/profiles-command.js +1 -1
  44. package/dist/commands/query-command.js +1 -1
  45. package/dist/commands/schedule-command.js +1 -1
  46. package/dist/commands/segment-command.js +1 -1
  47. package/dist/commands/segment-create-command.js +1 -1
  48. package/dist/commands/segment-fields-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/tables.js +1 -1
  58. package/dist/commands/unset-command.js +1 -1
  59. package/dist/commands/upgrade-command.js +1 -1
  60. package/dist/commands/use-command.js +1 -1
  61. package/dist/commands/user-command.js +1 -1
  62. package/dist/commands/work-command.js +1 -1
  63. package/dist/commands/workflow-command.js +1 -1
  64. package/dist/core/auth.js +1 -1
  65. package/dist/core/command-output.js +1 -1
  66. package/dist/core/config.js +1 -1
  67. package/dist/core/connection-cache.js +1 -1
  68. package/dist/core/constants.js +1 -1
  69. package/dist/core/credential-cache.js +1 -1
  70. package/dist/core/global-context.js +1 -1
  71. package/dist/core/keychain.js +1 -1
  72. package/dist/core/oauth-keychain.js +1 -1
  73. package/dist/core/oauth.js +1 -1
  74. package/dist/core/profile.js +1 -1
  75. package/dist/core/project-config.js +1 -1
  76. package/dist/core/session.js +1 -1
  77. package/dist/core/user-cache.js +1 -1
  78. package/dist/core/version.js +1 -1
  79. package/dist/index.js +1 -1
  80. package/dist/mcp/server.js +1 -1
  81. package/dist/mcp/tools/index.js +1 -1
  82. package/dist/mcp/tools/tdx-run.js +1 -1
  83. package/dist/mcp/tools/tdx-search.js +1 -1
  84. package/dist/mcp/tools/work-create-item.js +1 -1
  85. package/dist/mcp/utils.js +1 -1
  86. package/dist/proxy/claude-usage-tracker.d.ts.map +1 -1
  87. package/dist/proxy/claude-usage-tracker.js +1 -1
  88. package/dist/proxy/claude-usage-tracker.js.map +1 -1
  89. package/dist/proxy/passthrough-server.d.ts +10 -0
  90. package/dist/proxy/passthrough-server.d.ts.map +1 -1
  91. package/dist/proxy/passthrough-server.js +1 -1
  92. package/dist/proxy/passthrough-server.js.map +1 -1
  93. package/dist/proxy/sse-usage-parser.js +1 -1
  94. package/dist/sdk/agent/agent-config.js +1 -1
  95. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  96. package/dist/sdk/agent/agent-yaml.js +1 -1
  97. package/dist/sdk/agent/test/evaluator.js +1 -1
  98. package/dist/sdk/agent/test/executor.js +1 -1
  99. package/dist/sdk/agent/test/index.js +1 -1
  100. package/dist/sdk/agent/test/output.js +1 -1
  101. package/dist/sdk/agent/test/parser.js +1 -1
  102. package/dist/sdk/agent/tool-target-registry.js +1 -1
  103. package/dist/sdk/api.js +1 -1
  104. package/dist/sdk/cas/cas-api-client.js +1 -1
  105. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  106. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  107. package/dist/sdk/cas/index.js +1 -1
  108. package/dist/sdk/cas/pull-workflow.js +1 -1
  109. package/dist/sdk/cas/push-workflow.js +1 -1
  110. package/dist/sdk/client/cdp-api-client.js +1 -1
  111. package/dist/sdk/client/delivery-api-client.js +1 -1
  112. package/dist/sdk/client/endpoints.js +1 -1
  113. package/dist/sdk/client/engage-api-client.d.ts +50 -1
  114. package/dist/sdk/client/engage-api-client.d.ts.map +1 -1
  115. package/dist/sdk/client/engage-api-client.js +1 -1
  116. package/dist/sdk/client/engage-api-client.js.map +1 -1
  117. package/dist/sdk/client/http-client.js +1 -1
  118. package/dist/sdk/client/llm-api-client.js +1 -1
  119. package/dist/sdk/client/oauth-refresh.js +1 -1
  120. package/dist/sdk/client/rate-limiter.js +1 -1
  121. package/dist/sdk/client/td-api-client.js +1 -1
  122. package/dist/sdk/client/trino-api-client.js +1 -1
  123. package/dist/sdk/client/workflow-client.js +1 -1
  124. package/dist/sdk/connection-validator.js +1 -1
  125. package/dist/sdk/connection.js +1 -1
  126. package/dist/sdk/delivery.js +1 -1
  127. package/dist/sdk/engage/campaign-pull.js +1 -1
  128. package/dist/sdk/engage/campaign-push.js +1 -1
  129. package/dist/sdk/engage/campaign-validator.js +1 -1
  130. package/dist/sdk/engage/campaign-yaml.js +1 -1
  131. package/dist/sdk/engage/template-pull.js +1 -1
  132. package/dist/sdk/engage/template-push.js +1 -1
  133. package/dist/sdk/engage/template-validator.js +1 -1
  134. package/dist/sdk/engage/template-yaml.js +1 -1
  135. package/dist/sdk/engage/types/campaign-def.js +1 -1
  136. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  137. package/dist/sdk/engage/types/template-schema.js +1 -1
  138. package/dist/sdk/engage.d.ts +35 -1
  139. package/dist/sdk/engage.d.ts.map +1 -1
  140. package/dist/sdk/engage.js +1 -1
  141. package/dist/sdk/engage.js.map +1 -1
  142. package/dist/sdk/errors.js +1 -1
  143. package/dist/sdk/index.js +1 -1
  144. package/dist/sdk/io/index.js +1 -1
  145. package/dist/sdk/io/node-filesystem.js +1 -1
  146. package/dist/sdk/job.js +1 -1
  147. package/dist/sdk/journey.js +1 -1
  148. package/dist/sdk/llm/chat-cache.js +1 -1
  149. package/dist/sdk/llm/index.js +1 -1
  150. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  151. package/dist/sdk/llm/model-factors.d.ts +33 -9
  152. package/dist/sdk/llm/model-factors.d.ts.map +1 -1
  153. package/dist/sdk/llm/model-factors.js +1 -1
  154. package/dist/sdk/llm/model-factors.js.map +1 -1
  155. package/dist/sdk/personalization.js +1 -1
  156. package/dist/sdk/policy.js +1 -1
  157. package/dist/sdk/query/index.js +1 -1
  158. package/dist/sdk/query/sql-parser.js +1 -1
  159. package/dist/sdk/realtime.js +1 -1
  160. package/dist/sdk/schedule.js +1 -1
  161. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  162. package/dist/sdk/segment/fields-display.js +1 -1
  163. package/dist/sdk/segment/file-discovery.js +1 -1
  164. package/dist/sdk/segment/journey-utils.js +1 -1
  165. package/dist/sdk/segment/journey-validator.js +1 -1
  166. package/dist/sdk/segment/journey-yaml.js +1 -1
  167. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  168. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  169. package/dist/sdk/segment/pull-workflow.js +1 -1
  170. package/dist/sdk/segment/push-recovery.js +1 -1
  171. package/dist/sdk/segment/push-workflow.js +1 -1
  172. package/dist/sdk/segment/resolution-context.js +1 -1
  173. package/dist/sdk/segment/segment-path-parser.js +1 -1
  174. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  175. package/dist/sdk/segment/segment-validator.js +1 -1
  176. package/dist/sdk/segment/target-resolution.js +1 -1
  177. package/dist/sdk/segment/tdx-config.js +1 -1
  178. package/dist/sdk/segment/types/activation-schema.js +1 -1
  179. package/dist/sdk/segment/types/journey-def.js +1 -1
  180. package/dist/sdk/segment/types/journey-schema.js +1 -1
  181. package/dist/sdk/segment/types/segment-def.js +1 -1
  182. package/dist/sdk/segment/types/segment-schema.js +1 -1
  183. package/dist/sdk/segment/validate-files.js +1 -1
  184. package/dist/sdk/segment/yaml-validator.js +1 -1
  185. package/dist/sdk/segment.js +1 -1
  186. package/dist/sdk/types/engage.d.ts +53 -0
  187. package/dist/sdk/types/engage.d.ts.map +1 -1
  188. package/dist/sdk/types/index.d.ts +1 -1
  189. package/dist/sdk/types/index.d.ts.map +1 -1
  190. package/dist/sdk/types/index.js +1 -1
  191. package/dist/sdk/types/index.js.map +1 -1
  192. package/dist/sdk/types/progress.js +1 -1
  193. package/dist/sdk/types/workspace.js +1 -1
  194. package/dist/sdk/user.js +1 -1
  195. package/dist/sdk/util/format-detector.js +1 -1
  196. package/dist/sdk/util/formatters.js +1 -1
  197. package/dist/sdk/util/index.js +1 -1
  198. package/dist/sdk/util/paginate.js +1 -1
  199. package/dist/sdk/util/tree-formatter.js +1 -1
  200. package/dist/sdk/workflow/archive-validation.js +1 -1
  201. package/dist/sdk/workflow/clone-workflow.js +1 -1
  202. package/dist/sdk/workflow/index.js +1 -1
  203. package/dist/sdk/workflow/pull-workflow.js +1 -1
  204. package/dist/sdk/workflow/push-workflow.js +1 -1
  205. package/dist/sdk/workflow/task-graph.js +1 -1
  206. package/dist/sdk/workflow/tdx-config.js +1 -1
  207. package/dist/sdk/workflow/workflow-utils.js +1 -1
  208. package/dist/sdk/workspace/access-tracker.js +1 -1
  209. package/dist/sdk/workspace/frontmatter.js +1 -1
  210. package/dist/sdk/workspace/git.js +1 -1
  211. package/dist/sdk/workspace/index.js +1 -1
  212. package/dist/sdk/workspace/templates.js +1 -1
  213. package/dist/sdk/workspace/weekly.js +1 -1
  214. package/dist/sdk/workspace/wikilinks.js +1 -1
  215. package/dist/test-utils/command-runner.js +1 -1
  216. package/dist/test-utils/factories.js +1 -1
  217. package/dist/test-utils/fixtures.js +1 -1
  218. package/dist/test-utils/http-mock.js +1 -1
  219. package/dist/test-utils/index.js +1 -1
  220. package/dist/utils/async.js +1 -1
  221. package/dist/utils/colors.js +1 -1
  222. package/dist/utils/diff.js +1 -1
  223. package/dist/utils/file-permissions.js +1 -1
  224. package/dist/utils/file-reader.js +1 -1
  225. package/dist/utils/github-releases.js +1 -1
  226. package/dist/utils/global-cache.js +1 -1
  227. package/dist/utils/json-loader.js +1 -1
  228. package/dist/utils/local-cache.js +1 -1
  229. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  230. package/dist/utils/logger/formatters/index.js +1 -1
  231. package/dist/utils/logger/handlers/console-handler.js +1 -1
  232. package/dist/utils/logger/handlers/file-handler.js +1 -1
  233. package/dist/utils/logger/handlers/index.js +1 -1
  234. package/dist/utils/logger/handlers/null-handler.js +1 -1
  235. package/dist/utils/logger/index.js +1 -1
  236. package/dist/utils/logger/logger.js +1 -1
  237. package/dist/utils/logger/types.js +1 -1
  238. package/dist/utils/option-validation.js +1 -1
  239. package/dist/utils/process.js +1 -1
  240. package/dist/utils/prompt.js +1 -1
  241. package/dist/utils/spinner.js +1 -1
  242. package/dist/utils/sse-parser.js +1 -1
  243. package/dist/utils/string-utils.js +1 -1
  244. package/dist/utils/table-ref-parser.js +1 -1
  245. package/dist/utils/tdx-logger.js +1 -1
  246. package/dist/utils/version-check.js +1 -1
  247. package/package.json +1 -1
@@ -1 +1 @@
1
- const a32_0x518886=a32_0x16c8;(function(_0x33c8a7,_0x190de5){const _0x26e624=a32_0x16c8,_0x246388=_0x33c8a7();while(!![]){try{const _0x4d782d=parseInt(_0x26e624(0x195))/0x1+-parseInt(_0x26e624(0x179))/0x2+-parseInt(_0x26e624(0x185))/0x3*(parseInt(_0x26e624(0x1a0))/0x4)+parseInt(_0x26e624(0x16f))/0x5+parseInt(_0x26e624(0x196))/0x6*(parseInt(_0x26e624(0x193))/0x7)+-parseInt(_0x26e624(0x199))/0x8+parseInt(_0x26e624(0x194))/0x9;if(_0x4d782d===_0x190de5)break;else _0x246388['push'](_0x246388['shift']());}catch(_0x46340f){_0x246388['push'](_0x246388['shift']());}}}(a32_0x15ec,0xc1dfd));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a32_0x15ec(){const _0x10b7a5=['Fetching\x20permissions...','data','4HtnWhX','✔\x20Found\x20','all','Account\x20Owner',',\x20user_id:','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','account_owner','length','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','log','email','\x20\x20No\x20permissions','4433565EqenbY','verbose','permissions','args','operation','execute','policy\x20list','policy\x20show','\x20\x20\x20','\x20polic','2806694XJwJdR','policies','site','\x20assigned','(ID:\x20','padEnd','\x20user','No\x20policies\x20found','\x20\x20No\x20policies\x20assigned','validate','user','\x20—\x20','3280269UckZmN','ies','getCurrent','\x20\x20•\x20','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','getPolicyUsers','administrator','description','name','Administrator','getPolicy','dim','error','Listing\x20policies...','1988akJcky','19199619BjiUvA','231731PXcUYM','882cpWfhP','👥\x20Assigned\x20Users','max','20832yLRYNI','Fetching\x20policy...','bold','policy','join'];a32_0x15ec=function(){return _0x10b7a5;};return a32_0x15ec();}import a32_0x3b94e9 from'chalk';export class PolicyCommand extends BaseCommand{['name']=a32_0x518886(0x19c);['description']=a32_0x518886(0x168);async[a32_0x518886(0x174)](_0x3bfad0){const _0x3c6739=a32_0x518886,{options:_0x3c60fb,tdx:_0x52e8d8}=_0x3bfad0,_0xaab57b=await withSpinner(_0x3c6739(0x19e),async()=>{const _0x539293=_0x3c6739,[_0x50c309,_0x588896]=await Promise[_0x539293(0x1a2)]([_0x52e8d8[_0x539293(0x183)][_0x539293(0x187)](),_0x52e8d8[_0x539293(0x19c)]['getMyPermissions']()]);return{'userInfo':_0x50c309,'permissions':_0x588896};},{'verbose':_0x3c60fb[_0x3c6739(0x170)]}),{userInfo:_0x12f68a,permissions:_0x48ea3b}=_0xaab57b[_0x3c6739(0x19f)];if(isStructuredFormat(_0x3c60fb))return await handleSingleObjectOutput(_0x48ea3b,_0x3c60fb),0x0;const _0xf64d5=_0x12f68a[_0x3c6739(0x169)]?_0x3c6739(0x1a3):_0x12f68a[_0x3c6739(0x18b)]?_0x3c6739(0x18e):'Member';console[_0x3c6739(0x16c)]('\x0a'+a32_0x3b94e9[_0x3c6739(0x19b)]('👤')+'\x20'+a32_0x3b94e9['bold'](_0x12f68a[_0x3c6739(0x18d)])+'\x20'+a32_0x3b94e9[_0x3c6739(0x190)]('('+_0x12f68a[_0x3c6739(0x16d)]+')')+_0x3c6739(0x184)+_0xf64d5),console[_0x3c6739(0x16c)](a32_0x3b94e9['dim'](_0x3c6739(0x177)+_0x52e8d8['context'][_0x3c6739(0x17b)]+':'+_0x12f68a['account_id']+_0x3c6739(0x1a4)+_0x12f68a['id']));const _0xa44cb8=_0x48ea3b[_0x3c6739(0x17a)];console[_0x3c6739(0x16c)]('\x0a'+a32_0x3b94e9[_0x3c6739(0x19b)]('📋\x20Assigned\x20Policies')+'\x20('+_0xa44cb8[_0x3c6739(0x16a)]+'):');if(_0xa44cb8[_0x3c6739(0x16a)]===0x0)console[_0x3c6739(0x16c)](a32_0x3b94e9['dim'](_0x3c6739(0x181)));else for(const _0x3ea95e of _0xa44cb8){console[_0x3c6739(0x16c)](_0x3c6739(0x188)+_0x3ea95e[_0x3c6739(0x18d)]);}return printPermissionsMap(_0x48ea3b[_0x3c6739(0x171)]),console[_0x3c6739(0x16c)](),0x0;}}export class PolicyListCommand extends BaseCommand{['name']=a32_0x518886(0x175);[a32_0x518886(0x18c)]=a32_0x518886(0x16b);async['execute'](_0x2d2f60){const _0x38eb0a=a32_0x518886,{options:_0x2ac4b6,tdx:_0x5afa48}=_0x2d2f60,_0x4a75d1=await withSpinner(_0x38eb0a(0x192),()=>_0x5afa48[_0x38eb0a(0x19c)]['listPolicies'](),{'verbose':_0x2ac4b6[_0x38eb0a(0x170)]}),_0x1b274b=_0x4a75d1[_0x38eb0a(0x19f)];console[_0x38eb0a(0x191)](_0x38eb0a(0x1a1)+_0x1b274b[_0x38eb0a(0x16a)]+_0x38eb0a(0x178)+(_0x1b274b[_0x38eb0a(0x16a)]!==0x1?_0x38eb0a(0x186):'y'));if(isStructuredFormat(_0x2ac4b6))return await handleSDKOutput(_0x1b274b,_0x2ac4b6),0x0;if(_0x1b274b['length']===0x0)console['log'](a32_0x3b94e9['dim'](_0x38eb0a(0x180)));else for(const _0x418177 of _0x1b274b){const _0xa3fccc=_0x418177['description']?a32_0x3b94e9[_0x38eb0a(0x190)](_0x38eb0a(0x184)+_0x418177[_0x38eb0a(0x18c)]):'';console[_0x38eb0a(0x16c)]('\x20\x20•\x20'+_0x418177[_0x38eb0a(0x18d)]+_0xa3fccc);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{['name']=a32_0x518886(0x176);['description']='Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)';[a32_0x518886(0x182)](_0x3a0b16){const _0x31140a=a32_0x518886;if(_0x3a0b16[_0x31140a(0x172)][_0x31140a(0x16a)]===0x0)return _0x31140a(0x189);return undefined;}async[a32_0x518886(0x174)](_0x503840){const _0x1de459=a32_0x518886,{options:_0x46086a,tdx:_0xfec238}=_0x503840,_0x3df79c=_0x503840[_0x1de459(0x172)][0x0],_0x2fa7f1=await withSpinner(_0x1de459(0x19a),async()=>{const _0x953651=_0x1de459,_0x1b6317=await _0xfec238['policy'][_0x953651(0x18f)](_0x3df79c),[_0x306735,_0x278d3c]=await Promise[_0x953651(0x1a2)]([_0xfec238['policy']['getPolicyPermissions'](_0x1b6317['id']),_0xfec238['policy'][_0x953651(0x18a)](_0x1b6317['id'])]);return{'policy':_0x1b6317,'perms':_0x306735,'users':_0x278d3c};},{'verbose':_0x46086a[_0x1de459(0x170)]}),{policy:_0x2544dc,perms:_0x22d609,users:_0xb40632}=_0x2fa7f1[_0x1de459(0x19f)];if(isStructuredFormat(_0x46086a))return await handleSingleObjectOutput({..._0x2544dc,'permissions':_0x22d609[_0x1de459(0x171)],'users':_0xb40632},_0x46086a),0x0;console[_0x1de459(0x16c)]('\x0a'+a32_0x3b94e9[_0x1de459(0x19b)]('📋')+'\x20'+a32_0x3b94e9[_0x1de459(0x19b)](_0x2544dc[_0x1de459(0x18d)])+'\x20'+a32_0x3b94e9[_0x1de459(0x190)](_0x1de459(0x17d)+_0x2544dc['id']+')'));_0x2544dc['description']&&console[_0x1de459(0x16c)](_0x1de459(0x177)+a32_0x3b94e9[_0x1de459(0x190)](_0x2544dc[_0x1de459(0x18c)]));console[_0x1de459(0x16c)]('\x20\x20\x20'+_0xb40632[_0x1de459(0x16a)]+_0x1de459(0x17f)+(_0xb40632['length']!==0x1?'s':'')+_0x1de459(0x17c)),printPermissionsMap(_0x22d609[_0x1de459(0x171)]);if(_0xb40632[_0x1de459(0x16a)]>0x0){console[_0x1de459(0x16c)]('\x0a'+a32_0x3b94e9['bold'](_0x1de459(0x197))+':');for(const _0x571642 of _0xb40632){const _0x23bb72=_0x571642[_0x1de459(0x16d)]&&_0x571642[_0x1de459(0x16d)]!==_0x571642[_0x1de459(0x18d)]?a32_0x3b94e9[_0x1de459(0x190)]('\x20<'+_0x571642[_0x1de459(0x16d)]+'>'):'';console[_0x1de459(0x16c)](_0x1de459(0x188)+_0x571642[_0x1de459(0x18d)]+_0x23bb72);}}return console[_0x1de459(0x16c)](),0x0;}}function printPermissionsMap(_0x1140c4){const _0x449204=a32_0x518886,_0x12b06e=Object['entries'](_0x1140c4);console[_0x449204(0x16c)]('\x0a'+a32_0x3b94e9[_0x449204(0x19b)]('🔑\x20Effective\x20Permissions')+':');if(_0x12b06e[_0x449204(0x16a)]===0x0){console[_0x449204(0x16c)](a32_0x3b94e9[_0x449204(0x190)](_0x449204(0x16e)));return;}const _0x52c36b=Math[_0x449204(0x198)](..._0x12b06e['map'](([_0x22844e])=>_0x22844e[_0x449204(0x16a)]));for(const [_0x245653,_0x1f4d36]of _0x12b06e){const _0x537c2e=formatOperations(_0x1f4d36);console[_0x449204(0x16c)]('\x20\x20'+_0x245653[_0x449204(0x17e)](_0x52c36b+0x2)+_0x537c2e);}}function a32_0x16c8(_0x3dc0c6,_0x58ca67){_0x3dc0c6=_0x3dc0c6-0x168;const _0x15ec00=a32_0x15ec();let _0x16c836=_0x15ec00[_0x3dc0c6];return _0x16c836;}function formatOperations(_0xfd2405){const _0x167f00=a32_0x518886,_0x5347a6=[...new Set(_0xfd2405['map'](_0x3d22a2=>_0x3d22a2[_0x167f00(0x173)]))];return _0x5347a6[_0x167f00(0x19d)](',\x20');}
1
+ const a32_0x541fd6=a32_0x4869;(function(_0x1b28eb,_0x127e39){const _0x508134=a32_0x4869,_0x70e648=_0x1b28eb();while(!![]){try{const _0x4e523b=parseInt(_0x508134(0x10e))/0x1+parseInt(_0x508134(0x122))/0x2+-parseInt(_0x508134(0x12f))/0x3*(parseInt(_0x508134(0x12b))/0x4)+-parseInt(_0x508134(0x111))/0x5*(parseInt(_0x508134(0x117))/0x6)+parseInt(_0x508134(0x101))/0x7*(-parseInt(_0x508134(0x126))/0x8)+-parseInt(_0x508134(0x112))/0x9+parseInt(_0x508134(0x138))/0xa;if(_0x4e523b===_0x127e39)break;else _0x70e648['push'](_0x70e648['shift']());}catch(_0x5cadff){_0x70e648['push'](_0x70e648['shift']());}}}(a32_0x5e31,0x4d66a));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';function a32_0x4869(_0x1b0bcb,_0x424be8){_0x1b0bcb=_0x1b0bcb-0x100;const _0x5e31b0=a32_0x5e31();let _0x48690a=_0x5e31b0[_0x1b0bcb];return _0x48690a;}import{withSpinner}from'../utils/spinner.js';import a32_0x4c4d20 from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x541fd6(0x125)]=a32_0x541fd6(0x10c);[a32_0x541fd6(0x127)]='Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions';async[a32_0x541fd6(0x13b)](_0x68c601){const _0x2c646b=a32_0x541fd6,{options:_0x131af0,tdx:_0x1a6e0e}=_0x68c601,_0x5ea915=await withSpinner(_0x2c646b(0x12e),async()=>{const _0x320f4b=_0x2c646b,[_0x3a9733,_0x5b2a04]=await Promise[_0x320f4b(0x11c)]([_0x1a6e0e['user'][_0x320f4b(0x116)](),_0x1a6e0e[_0x320f4b(0x10c)][_0x320f4b(0x133)]()]);return{'userInfo':_0x3a9733,'permissions':_0x5b2a04};},{'verbose':_0x131af0[_0x2c646b(0x13a)]}),{userInfo:_0x40ec32,permissions:_0x572ab0}=_0x5ea915['data'];if(isStructuredFormat(_0x131af0))return await handleSingleObjectOutput(_0x572ab0,_0x131af0),0x0;const _0x3134f9=_0x40ec32[_0x2c646b(0x123)]?_0x2c646b(0x10f):_0x40ec32[_0x2c646b(0x120)]?_0x2c646b(0x139):_0x2c646b(0x113);console[_0x2c646b(0x115)]('\x0a'+a32_0x4c4d20['bold']('👤')+'\x20'+a32_0x4c4d20['bold'](_0x40ec32['name'])+'\x20'+a32_0x4c4d20[_0x2c646b(0x109)]('('+_0x40ec32[_0x2c646b(0x131)]+')')+_0x2c646b(0x134)+_0x3134f9),console[_0x2c646b(0x115)](a32_0x4c4d20[_0x2c646b(0x109)]('\x20\x20\x20'+_0x1a6e0e['context'][_0x2c646b(0x132)]+':'+_0x40ec32[_0x2c646b(0x128)]+_0x2c646b(0x10b)+_0x40ec32['id']));const _0x37f22f=_0x572ab0[_0x2c646b(0x12c)];console[_0x2c646b(0x115)]('\x0a'+a32_0x4c4d20[_0x2c646b(0x100)](_0x2c646b(0x110))+'\x20('+_0x37f22f[_0x2c646b(0x107)]+'):');if(_0x37f22f[_0x2c646b(0x107)]===0x0)console[_0x2c646b(0x115)](a32_0x4c4d20[_0x2c646b(0x109)](_0x2c646b(0x10d)));else for(const _0x3a339d of _0x37f22f){console[_0x2c646b(0x115)](_0x2c646b(0x106)+_0x3a339d['name']);}return printPermissionsMap(_0x572ab0[_0x2c646b(0x119)]),console[_0x2c646b(0x115)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x541fd6(0x125)]=a32_0x541fd6(0x104);['description']='List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)';async['execute'](_0x58a2fe){const _0x526589=a32_0x541fd6,{options:_0x3ea831,tdx:_0x3b1005}=_0x58a2fe,_0x1f7e3b=await withSpinner(_0x526589(0x108),()=>_0x3b1005[_0x526589(0x10c)][_0x526589(0x136)](),{'verbose':_0x3ea831[_0x526589(0x13a)]}),_0x5460b9=_0x1f7e3b[_0x526589(0x103)];console[_0x526589(0x11d)](_0x526589(0x11f)+_0x5460b9[_0x526589(0x107)]+'\x20polic'+(_0x5460b9['length']!==0x1?_0x526589(0x135):'y'));if(isStructuredFormat(_0x3ea831))return await handleSDKOutput(_0x5460b9,_0x3ea831),0x0;if(_0x5460b9[_0x526589(0x107)]===0x0)console['log'](a32_0x4c4d20['dim']('No\x20policies\x20found'));else for(const _0x3e51df of _0x5460b9){const _0x3ee1e3=_0x3e51df[_0x526589(0x127)]?a32_0x4c4d20[_0x526589(0x109)](_0x526589(0x134)+_0x3e51df[_0x526589(0x127)]):'';console['log'](_0x526589(0x106)+_0x3e51df[_0x526589(0x125)]+_0x3ee1e3);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x541fd6(0x125)]=a32_0x541fd6(0x121);[a32_0x541fd6(0x127)]=a32_0x541fd6(0x114);['validate'](_0x4069c7){const _0x244454=a32_0x541fd6;if(_0x4069c7[_0x244454(0x10a)]['length']===0x0)return'Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>';return undefined;}async[a32_0x541fd6(0x13b)](_0x196860){const _0x420fbd=a32_0x541fd6,{options:_0x7948f2,tdx:_0x631139}=_0x196860,_0x21c9b0=_0x196860[_0x420fbd(0x10a)][0x0],_0x3cf898=await withSpinner(_0x420fbd(0x137),async()=>{const _0x58377c=_0x420fbd,_0x2ef598=await _0x631139['policy'][_0x58377c(0x12d)](_0x21c9b0),[_0x4fc9e7,_0x4a30a3]=await Promise[_0x58377c(0x11c)]([_0x631139[_0x58377c(0x10c)][_0x58377c(0x129)](_0x2ef598['id']),_0x631139[_0x58377c(0x10c)][_0x58377c(0x11e)](_0x2ef598['id'])]);return{'policy':_0x2ef598,'perms':_0x4fc9e7,'users':_0x4a30a3};},{'verbose':_0x7948f2[_0x420fbd(0x13a)]}),{policy:_0x4d7ac2,perms:_0x3b1a86,users:_0x3e28a9}=_0x3cf898['data'];if(isStructuredFormat(_0x7948f2))return await handleSingleObjectOutput({..._0x4d7ac2,'permissions':_0x3b1a86[_0x420fbd(0x119)],'users':_0x3e28a9},_0x7948f2),0x0;console['log']('\x0a'+a32_0x4c4d20['bold']('📋')+'\x20'+a32_0x4c4d20[_0x420fbd(0x100)](_0x4d7ac2[_0x420fbd(0x125)])+'\x20'+a32_0x4c4d20[_0x420fbd(0x109)](_0x420fbd(0x124)+_0x4d7ac2['id']+')'));_0x4d7ac2[_0x420fbd(0x127)]&&console[_0x420fbd(0x115)](_0x420fbd(0x105)+a32_0x4c4d20[_0x420fbd(0x109)](_0x4d7ac2[_0x420fbd(0x127)]));console['log'](_0x420fbd(0x105)+_0x3e28a9['length']+_0x420fbd(0x12a)+(_0x3e28a9[_0x420fbd(0x107)]!==0x1?'s':'')+'\x20assigned'),printPermissionsMap(_0x3b1a86[_0x420fbd(0x119)]);if(_0x3e28a9[_0x420fbd(0x107)]>0x0){console[_0x420fbd(0x115)]('\x0a'+a32_0x4c4d20[_0x420fbd(0x100)]('👥\x20Assigned\x20Users')+':');for(const _0x277af5 of _0x3e28a9){const _0x19ddf0=_0x277af5[_0x420fbd(0x131)]&&_0x277af5[_0x420fbd(0x131)]!==_0x277af5[_0x420fbd(0x125)]?a32_0x4c4d20[_0x420fbd(0x109)]('\x20<'+_0x277af5[_0x420fbd(0x131)]+'>'):'';console[_0x420fbd(0x115)](_0x420fbd(0x106)+_0x277af5[_0x420fbd(0x125)]+_0x19ddf0);}}return console[_0x420fbd(0x115)](),0x0;}}function printPermissionsMap(_0x48abc1){const _0x1be4c2=a32_0x541fd6,_0x1df7a0=Object[_0x1be4c2(0x118)](_0x48abc1);console['log']('\x0a'+a32_0x4c4d20['bold'](_0x1be4c2(0x11a))+':');if(_0x1df7a0[_0x1be4c2(0x107)]===0x0){console[_0x1be4c2(0x115)](a32_0x4c4d20['dim']('\x20\x20No\x20permissions'));return;}const _0x2090ff=Math[_0x1be4c2(0x11b)](..._0x1df7a0[_0x1be4c2(0x130)](([_0x2124ac])=>_0x2124ac[_0x1be4c2(0x107)]));for(const [_0x4b1612,_0x2cc211]of _0x1df7a0){const _0x2ef689=formatOperations(_0x2cc211);console[_0x1be4c2(0x115)]('\x20\x20'+_0x4b1612[_0x1be4c2(0x102)](_0x2090ff+0x2)+_0x2ef689);}}function a32_0x5e31(){const _0x501267=['data','policy\x20list','\x20\x20\x20','\x20\x20•\x20','length','Listing\x20policies...','dim','args',',\x20user_id:','policy','\x20\x20No\x20policies\x20assigned','236889NrcUmH','Account\x20Owner','📋\x20Assigned\x20Policies','2268355AJeGVo','1744047zPunDI','Member','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','log','getCurrent','6xqZQMq','entries','permissions','🔑\x20Effective\x20Permissions','max','all','error','getPolicyUsers','✔\x20Found\x20','administrator','policy\x20show','951812akOJXF','account_owner','(ID:\x20','name','1441624rbuuTJ','description','account_id','getPolicyPermissions','\x20user','794776ssiBMN','policies','getPolicy','Fetching\x20permissions...','3aGLWKZ','map','email','site','getMyPermissions','\x20—\x20','ies','listPolicies','Fetching\x20policy...','6305900viyAoA','Administrator','verbose','execute','operation','bold','7lShRcG','padEnd'];a32_0x5e31=function(){return _0x501267;};return a32_0x5e31();}function formatOperations(_0x2db6eb){const _0x37ce20=a32_0x541fd6,_0x30ca0f=[...new Set(_0x2db6eb[_0x37ce20(0x130)](_0x36ff11=>_0x36ff11[_0x37ce20(0x13c)]))];return _0x30ca0f['join'](',\x20');}
@@ -1 +1 @@
1
- const a33_0x3ba123=a33_0x2555;(function(_0x2d85c6,_0x275386){const _0x1d7404=a33_0x2555,_0x5e3dc6=_0x2d85c6();while(!![]){try{const _0x3b0864=parseInt(_0x1d7404(0xa8))/0x1+parseInt(_0x1d7404(0x7c))/0x2+-parseInt(_0x1d7404(0xaa))/0x3+-parseInt(_0x1d7404(0x75))/0x4+parseInt(_0x1d7404(0x99))/0x5+parseInt(_0x1d7404(0x9c))/0x6+parseInt(_0x1d7404(0xc0))/0x7;if(_0x3b0864===_0x275386)break;else _0x5e3dc6['push'](_0x5e3dc6['shift']());}catch(_0x3d442b){_0x5e3dc6['push'](_0x5e3dc6['shift']());}}}(a33_0x247c,0x396a8));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a33_0x4976e3 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';function a33_0x2555(_0x8ab4e6,_0xe09aae){_0x8ab4e6=_0x8ab4e6-0x6e;const _0x247c11=a33_0x247c();let _0x255519=_0x247c11[_0x8ab4e6];return _0x255519;}import a33_0x31107e from'prompts';import a33_0x43a05f from'chalk';function a33_0x247c(){const _0x525426=['execute','trim','ERROR','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','VALID_KEYS','log','Setup\x20cancelled','1241093ZpHXyW','profile:delete','config','yellow','profileName','skipExistsCheck','tdx:\x20profile\x20delete','/app/mp/ak','\x20\x20-\x20','name','API\x20key\x20cannot\x20be\x20empty','validate','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','profile','tdx:\x20profile\x20create','password','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','\x27\x20does\x20not\x20exist.','text','create','Operation\x20cancelled','\x0aSetup\x20cancelled','status','\x20API\x20key\x20saved\x20to\x20system\x20keychain','\x20Profile\x20\x27','Session\x20profile\x20set\x20to:\x20','database','\x27.\x0a\x0aValid\x20keys:\x20','message','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>','Unknown\x20key\x20\x27','1604284INflOD','split','\x20\x20tdx\x20--profile\x20','force','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','default','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','324750JhIwYM','Profile\x20\x27','green','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','join','\x27\x20deleted','bold','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Enter\x20your\x20TD\x20API\x20key:','Set\x20session\x20profile','Site\x20was\x20not\x20changed.','Removed\x20existing\x20profile\x20\x27','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','length','error','Enter\x20description\x20(optional):','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','\x27\x20updated:\x20','email','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','dim','red','\x27\x20requires\x20API\x20key\x20validation.','Failed\x20to\x20delete\x20profile:\x20','us01','apiKey','\x27\x20created','1081950QwlkIL','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','992220FHjBFA','llm_agent','\x20\x20(no\x20profiles\x20found)','\x20--default\x27\x20to\x20save\x20permanently','profile:use','site','\x0aAvailable\x20profiles:','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','jobs','confirm','includes','profile:create','326381pkTWNP','✗\x20Validation\x20failed:\x20','1234704ENuIHn','Set\x20a\x20profile\x20configuration\x20value','warn','getUserInfo','session','profile:set','description','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','logLevel','llm_project','Removal\x20cancelled','parent_segment','oauth','\x0aSaved\x20to:\x20'];a33_0x247c=function(){return _0x525426;};return a33_0x247c();}function validateProfileName(_0x5de8de,_0x3843e2){const _0x3e2599=a33_0x2555;if(!_0x5de8de||!_0x5de8de['trim']())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x5f71e8=_0x5de8de['trim']();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x5f71e8))return _0x3e2599(0xbb);if(!_0x3843e2?.[_0x3e2599(0xc5)]&&profileExists(_0x5f71e8))return'Profile\x20\x27'+_0x5f71e8+_0x3e2599(0x79)+_0x5f71e8+'\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.';return!![];}async function deleteProfileAndCredentials(_0x41bb0e){removeProfileFromUserConfig(_0x41bb0e);const _0xfdbeb1=await isKeychainAvailable();_0xfdbeb1&&await Promise['all']([deleteKeychainAPIKey(_0x41bb0e),deleteOAuthTokens(_0x41bb0e)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x3ba123(0xc9)]=a33_0x3ba123(0xa7);[a33_0x3ba123(0xb0)]='Create\x20a\x20new\x20profile';async[a33_0x3ba123(0xb8)](_0x24264d){const _0x1a2f1d=a33_0x3ba123,{options:_0x4c5b14,args:_0x1caadf}=_0x24264d,_0x315ecb=!!_0x4c5b14[_0x1a2f1d(0x78)];console[_0x1a2f1d(0xbe)](a33_0x43a05f[_0x1a2f1d(0x82)](_0x1a2f1d(0xce)));let _0x22c1dc;if(_0x1caadf['length']>0x0&&_0x1caadf[0x0]){const _0x1e50a8=_0x1caadf[0x0][_0x1a2f1d(0xb9)]();_0x315ecb&&profileExists(_0x1e50a8)&&(await deleteProfileAndCredentials(_0x1e50a8),console[_0x1a2f1d(0xbe)]('Removed\x20existing\x20profile\x20\x27'+_0x1e50a8+'\x27'));const _0xc45c4d=validateProfileName(_0x1e50a8);if(_0xc45c4d!==!![])return console['error'](a33_0x43a05f[_0x1a2f1d(0x93)](_0xc45c4d)),0x1;_0x22c1dc=_0x1e50a8;}else{const _0x2cbc05=await a33_0x31107e({'type':_0x1a2f1d(0xd2),'name':_0x1a2f1d(0xc4),'message':'Enter\x20profile\x20name:','validate':_0x20ee4=>validateProfileName(_0x20ee4,{'skipExistsCheck':_0x315ecb})});if(!_0x2cbc05[_0x1a2f1d(0xc4)])return console[_0x1a2f1d(0xbe)]('\x0aSetup\x20cancelled'),0x1;_0x22c1dc=_0x2cbc05['profileName'][_0x1a2f1d(0xb9)](),_0x315ecb&&profileExists(_0x22c1dc)&&(await deleteProfileAndCredentials(_0x22c1dc),console[_0x1a2f1d(0xbe)](_0x1a2f1d(0x88)+_0x22c1dc+'\x27'));}const _0x46c74b=await a33_0x31107e({'type':_0x1a2f1d(0xd2),'name':_0x1a2f1d(0xb0),'message':_0x1a2f1d(0x8d)}),_0xbba1a6=_0x46c74b[_0x1a2f1d(0xb0)]?.[_0x1a2f1d(0xb9)]()||undefined,_0x4bcc2a=_0x4c5b14['site']||_0x1a2f1d(0x96),_0x47113a=await promptSiteSelection(_0x4bcc2a,_0x22c1dc,_0x1a2f1d(0xbf));if(!_0x47113a)return 0x1;const _0x50e8f7=resolveSite(_0x47113a),_0xebae1e=await promptAuthMethod();if(!_0xebae1e)return console[_0x1a2f1d(0xbe)](_0x1a2f1d(0xd5)),0x1;if(_0xebae1e===_0x1a2f1d(0xb6)){if(_0xbba1a6){const _0x2ebaf2={'site':_0x50e8f7,'description':_0xbba1a6};saveProfileToUserConfig(_0x22c1dc,_0x2ebaf2);}const {accountName:_0x1dac4e}=_0x4c5b14;return await runOAuthLoginFlow(_0x50e8f7,_0x22c1dc,_0x4c5b14[_0x1a2f1d(0xb2)]??LogLevel['ERROR'],{'accountName':_0x1dac4e}),0x0;}console[_0x1a2f1d(0xbe)](_0x1a2f1d(0x9a)+_0x50e8f7),console[_0x1a2f1d(0xbe)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console['log']('\x20\x20'+getConsoleUrl(_0x50e8f7,_0x1a2f1d(0xc7)));const _0x4d0f7f=await a33_0x31107e({'type':_0x1a2f1d(0xcf),'name':'apiKey','message':_0x1a2f1d(0x85),'validate':_0x4423cb=>{const _0x2d532f=_0x1a2f1d;if(!_0x4423cb||!_0x4423cb[_0x2d532f(0xb9)]())return _0x2d532f(0xca);return!![];}});if(!_0x4d0f7f[_0x1a2f1d(0x97)])return console['log'](_0x1a2f1d(0xd5)),0x1;const _0x4927ac=_0x4d0f7f[_0x1a2f1d(0x97)];console[_0x1a2f1d(0xbe)]('Validating\x20API\x20key...');try{const _0x238866=TDX['create']({'site':_0x50e8f7,'apiKey':_0x4927ac[_0x1a2f1d(0xb9)](),'logLevel':_0x4c5b14[_0x1a2f1d(0xb2)]??LogLevel[_0x1a2f1d(0xba)]}),_0x559dc4=await _0x238866[_0x1a2f1d(0xa4)][_0x1a2f1d(0xad)]();console[_0x1a2f1d(0xbe)](a33_0x43a05f[_0x1a2f1d(0x7e)]('✓')+_0x1a2f1d(0x83)+_0x559dc4[_0x1a2f1d(0x90)]+')');const _0x3a2c29=await isKeychainAvailable();_0x3a2c29?(await saveAPIKeyAsync(_0x4927ac['trim'](),_0x50e8f7,_0x22c1dc),console[_0x1a2f1d(0xbe)](a33_0x43a05f['green']('✓')+_0x1a2f1d(0xd0)+_0x22c1dc+')')):(console['warn'](a33_0x43a05f['yellow'](_0x1a2f1d(0x91))),console[_0x1a2f1d(0xac)](a33_0x43a05f[_0x1a2f1d(0xc3)](_0x1a2f1d(0x9b))));const _0x1aa5d2={'site':_0x50e8f7,..._0xbba1a6&&{'description':_0xbba1a6}};return saveProfileToUserConfig(_0x22c1dc,_0x1aa5d2),console[_0x1a2f1d(0xbe)](a33_0x43a05f[_0x1a2f1d(0x7e)]('✓')+_0x1a2f1d(0x6e)+_0x22c1dc+_0x1a2f1d(0x98)),console['log'](),console[_0x1a2f1d(0xbe)](_0x1a2f1d(0x8e)),console['log'](_0x1a2f1d(0x77)+_0x22c1dc+_0x1a2f1d(0x84)),console['log']('\x20\x20tdx\x20--profile\x20'+_0x22c1dc+_0x1a2f1d(0x8a)),0x0;}catch(_0x32bd9f){if(_0x32bd9f instanceof HTTPClientError&&_0x32bd9f['status']===0x191)return printAuthError(_0x32bd9f),0x1;return console[_0x1a2f1d(0x8c)](a33_0x43a05f[_0x1a2f1d(0x93)](_0x1a2f1d(0xa9)+(_0x32bd9f instanceof Error?_0x32bd9f[_0x1a2f1d(0x72)]:String(_0x32bd9f)))),console[_0x1a2f1d(0x8c)](_0x1a2f1d(0x89)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{['name']=a33_0x3ba123(0xc1);['description']='Delete\x20a\x20profile';[a33_0x3ba123(0xcb)](_0x42bdee){const _0x5dbc5c=a33_0x3ba123,{args:_0x2eeedc}=_0x42bdee;if(_0x2eeedc[_0x5dbc5c(0x8b)]===0x0)return _0x5dbc5c(0xb1);return undefined;}async[a33_0x3ba123(0xb8)](_0x176ab7){const _0x4cfab7=a33_0x3ba123,{args:_0x19218b}=_0x176ab7,_0x443d78=_0x19218b[0x0];console['log'](a33_0x43a05f[_0x4cfab7(0x82)](_0x4cfab7(0xc6)));if(!profileExists(_0x443d78)){console[_0x4cfab7(0x8c)](a33_0x43a05f['red']('Profile\x20\x27'+_0x443d78+_0x4cfab7(0xd1))),console['log'](_0x4cfab7(0xa2));const _0x3d172b=listProfiles();if(_0x3d172b[_0x4cfab7(0x8b)]===0x0)console[_0x4cfab7(0xbe)](_0x4cfab7(0x9e));else for(const _0x2c7ace of _0x3d172b){console['log']('\x20\x20-\x20'+_0x2c7ace[_0x4cfab7(0xc9)]);}return 0x1;}const _0x41be8d=await a33_0x31107e({'type':_0x4cfab7(0xa5),'name':'confirm','message':_0x4cfab7(0xbc)+_0x443d78+'\x27?','initial':![]});if(!_0x41be8d[_0x4cfab7(0xa5)])return console[_0x4cfab7(0xbe)](_0x4cfab7(0xb4)),0x0;try{await deleteProfileAndCredentials(_0x443d78),console[_0x4cfab7(0xbe)](a33_0x43a05f['green']('✓')+_0x4cfab7(0x6e)+_0x443d78+_0x4cfab7(0x81));}catch(_0x1b4bd5){return console[_0x4cfab7(0x8c)](a33_0x43a05f[_0x4cfab7(0x93)](_0x4cfab7(0x95)+(_0x1b4bd5 instanceof Error?_0x1b4bd5[_0x4cfab7(0x72)]:String(_0x1b4bd5)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0x3ba123(0xc9)]=a33_0x3ba123(0xaf);[a33_0x3ba123(0xb0)]=a33_0x3ba123(0xab);static [a33_0x3ba123(0xbd)]=['site',a33_0x3ba123(0x70),a33_0x3ba123(0xb5),a33_0x3ba123(0xb3),a33_0x3ba123(0x9d),a33_0x3ba123(0xb0)];[a33_0x3ba123(0xcb)](_0xad7d96){const _0x4b322f=a33_0x3ba123,{args:_0x4bfeec,options:_0x4003d8}=_0xad7d96,_0x240ff1=_0x4003d8[_0x4b322f(0xcd)]||getActiveProfile();if(!_0x240ff1)return _0x4b322f(0x73);if(_0x4bfeec[_0x4b322f(0x8b)]===0x0)return _0x4b322f(0xa3)+ProfileSetCommand[_0x4b322f(0xbd)]['join'](',\x20');const _0x5d54ba=_0x4bfeec[0x0];if(!_0x5d54ba['includes']('='))return _0x4b322f(0x7b)+ProfileSetCommand[_0x4b322f(0xbd)][_0x4b322f(0x80)](',\x20');const [_0x2dfb18]=_0x5d54ba[_0x4b322f(0x76)]('=',0x2);if(!ProfileSetCommand[_0x4b322f(0xbd)][_0x4b322f(0xa6)](_0x2dfb18))return _0x4b322f(0x74)+_0x2dfb18+_0x4b322f(0x71)+ProfileSetCommand['VALID_KEYS'][_0x4b322f(0x80)](',\x20');return undefined;}async['execute'](_0x2114d5){const _0x50ac60=a33_0x3ba123,{args:_0x339002,options:_0x1a5eb3}=_0x2114d5,_0x15ba39=_0x1a5eb3[_0x50ac60(0xcd)]||getActiveProfile(),[_0x247d82,..._0x1a88b3]=_0x339002[0x0][_0x50ac60(0x76)]('='),_0x3e89dc=_0x1a88b3[_0x50ac60(0x80)]('=');console[_0x50ac60(0xbe)](a33_0x43a05f['bold']('tdx:\x20profile\x20set'));if(!profileExists(_0x15ba39)){const _0x5468fc=await a33_0x31107e({'type':'confirm','name':'create','message':_0x50ac60(0x7d)+_0x15ba39+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x5468fc[_0x50ac60(0xd3)])return console[_0x50ac60(0xbe)](_0x50ac60(0xd4)),0x1;}const _0x486ed6=loadProfile(_0x15ba39),_0x4c41d7=_0x486ed6?.[_0x50ac60(0xc2)]||{};if(_0x247d82===_0x50ac60(0xa1)){const _0xa505c=resolveSite(_0x3e89dc);console[_0x50ac60(0xbe)]('Changing\x20site\x20to\x20\x27'+_0xa505c+_0x50ac60(0x94)),console[_0x50ac60(0xbe)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x50ac60(0xbe)]('\x20\x20'+getConsoleUrl(_0xa505c,_0x50ac60(0xc7)));const _0x12d01f=await a33_0x31107e({'type':_0x50ac60(0xcf),'name':'apiKey','message':_0x50ac60(0xcc),'validate':_0x477c46=>{const _0x21a2bf=_0x50ac60;if(!_0x477c46||!_0x477c46['trim']())return _0x21a2bf(0xca);return!![];}});if(!_0x12d01f[_0x50ac60(0x97)])return console[_0x50ac60(0xbe)]('\x0aOperation\x20cancelled'),0x1;console[_0x50ac60(0xbe)]('Validating\x20API\x20key...');try{const _0x193d6f=TDX['create']({'site':_0xa505c,'apiKey':_0x12d01f[_0x50ac60(0x97)][_0x50ac60(0xb9)](),'logLevel':_0x1a5eb3['logLevel']??LogLevel[_0x50ac60(0xba)]}),_0xe4d34d=await _0x193d6f[_0x50ac60(0xa4)][_0x50ac60(0xad)]();console[_0x50ac60(0xbe)](a33_0x43a05f[_0x50ac60(0x7e)]('✓')+_0x50ac60(0x83)+_0xe4d34d[_0x50ac60(0x90)]+')');const _0x1a6ba2=await isKeychainAvailable();_0x1a6ba2?(await saveAPIKeyAsync(_0x12d01f[_0x50ac60(0x97)][_0x50ac60(0xb9)](),_0xa505c,_0x15ba39),console[_0x50ac60(0xbe)](a33_0x43a05f[_0x50ac60(0x7e)]('✓')+_0x50ac60(0xd7))):console['warn'](a33_0x43a05f[_0x50ac60(0xc3)](_0x50ac60(0x91))),_0x4c41d7[_0x50ac60(0xa1)]=_0xa505c;}catch(_0x250022){if(_0x250022 instanceof HTTPClientError&&_0x250022[_0x50ac60(0xd6)]===0x191)return printAuthError(_0x250022),0x1;return console[_0x50ac60(0x8c)](a33_0x43a05f[_0x50ac60(0x93)](_0x50ac60(0xa9)+(_0x250022 instanceof Error?_0x250022[_0x50ac60(0x72)]:String(_0x250022)))),console[_0x50ac60(0x8c)](_0x50ac60(0x87)),0x1;}}else _0x4c41d7[_0x247d82]=_0x3e89dc||undefined;return saveProfileToUserConfig(_0x15ba39,_0x4c41d7),console[_0x50ac60(0xbe)](a33_0x43a05f[_0x50ac60(0x7e)]('✓')+_0x50ac60(0x6e)+_0x15ba39+_0x50ac60(0x8f)+_0x247d82+'='+(_0x3e89dc||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x3ba123(0xc9)]=a33_0x3ba123(0xa0);[a33_0x3ba123(0xb0)]=a33_0x3ba123(0x86);[a33_0x3ba123(0xcb)](_0x5cdbc1){const _0x3d0c97=a33_0x3ba123,{args:_0x503e36}=_0x5cdbc1;if(_0x503e36['length']===0x0)return _0x3d0c97(0x7f);return undefined;}async[a33_0x3ba123(0xb8)](_0x59f48b){const _0x3bf407=a33_0x3ba123,{args:_0x229634,options:_0x2e7950}=_0x59f48b,_0x4c9974=_0x229634[0x0],_0x8d1883=_0x2e7950[_0x3bf407(0x7a)];cleanExpiredSessions();if(!profileExists(_0x4c9974)){console[_0x3bf407(0x8c)](a33_0x43a05f[_0x3bf407(0x93)](_0x3bf407(0x7d)+_0x4c9974+'\x27\x20does\x20not\x20exist.')),console[_0x3bf407(0xbe)](_0x3bf407(0xa2));const _0x4b5c90=listProfiles();if(_0x4b5c90[_0x3bf407(0x8b)]===0x0)console[_0x3bf407(0xbe)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x3d9d87 of _0x4b5c90){console[_0x3bf407(0xbe)](_0x3bf407(0xc8)+_0x3d9d87[_0x3bf407(0xc9)]);}return 0x1;}if(_0x8d1883){const _0x2753e1=a33_0x4976e3[_0x3bf407(0x80)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x4c9974),console[_0x3bf407(0xbe)]('Default\x20profile\x20set\x20to:\x20'+a33_0x43a05f[_0x3bf407(0x7e)](_0x4c9974)),console[_0x3bf407(0xbe)](a33_0x43a05f[_0x3bf407(0x92)](_0x3bf407(0xb7)+_0x2753e1)),0x0;}const _0x2f809a=getSessionID(_0x2e7950[_0x3bf407(0xae)]);return saveSessionContext({'profile':_0x4c9974},_0x2e7950[_0x3bf407(0xae)]),console['log'](_0x3bf407(0x6f)+a33_0x43a05f[_0x3bf407(0x7e)](_0x4c9974)+'\x20'+a33_0x43a05f[_0x3bf407(0x92)]('(session:\x20'+_0x2f809a+')')),console['log'](a33_0x43a05f['dim']('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x4c9974+_0x3bf407(0x9f))),0x0;}}
1
+ const a33_0x1bc630=a33_0x1586;(function(_0x425893,_0x159e6e){const _0x1e7894=a33_0x1586,_0x3046b5=_0x425893();while(!![]){try{const _0x1e1a5f=-parseInt(_0x1e7894(0xaa))/0x1+-parseInt(_0x1e7894(0xca))/0x2+-parseInt(_0x1e7894(0xbb))/0x3*(-parseInt(_0x1e7894(0xcf))/0x4)+parseInt(_0x1e7894(0x6b))/0x5*(parseInt(_0x1e7894(0xd2))/0x6)+-parseInt(_0x1e7894(0xa5))/0x7*(-parseInt(_0x1e7894(0xa0))/0x8)+parseInt(_0x1e7894(0x85))/0x9*(-parseInt(_0x1e7894(0xb0))/0xa)+parseInt(_0x1e7894(0x7c))/0xb;if(_0x1e1a5f===_0x159e6e)break;else _0x3046b5['push'](_0x3046b5['shift']());}catch(_0x5b5a8c){_0x3046b5['push'](_0x3046b5['shift']());}}}(a33_0x508f,0x1df64));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a33_0x53994c 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';function a33_0x1586(_0x11a791,_0x569bb2){_0x11a791=_0x11a791-0x68;const _0x508f04=a33_0x508f();let _0x1586a4=_0x508f04[_0x11a791];return _0x1586a4;}import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';function a33_0x508f(){const _0x4965ca=['length','21512zCWHoE','\x0aSaved\x20to:\x20','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','72QxGvvL','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','tdx:\x20profile\x20create','\x27\x20updated:\x20','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','password','(cleared)','\x0aSetup\x20cancelled','Changing\x20site\x20to\x20\x27','\x27\x20created','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','profileName','create','71580fquFkN','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','\x20Profile\x20\x27','bold','Delete\x20a\x20profile','Operation\x20cancelled','Session\x20profile\x20set\x20to:\x20','default','Validating\x20API\x20key...','\x27\x20requires\x20API\x20key\x20validation.','profile:delete','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','us01','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Removal\x20cancelled','Profile\x20\x27','Site\x20was\x20not\x20changed.','1579303IQVMgO','/app/mp/ak','ERROR','logLevel','email','\x20\x20-\x20','\x20API\x20key\x20is\x20valid\x20(User:\x20','session','apiKey','255699BnhjJo','llm_agent','VALID_KEYS','API\x20key\x20cannot\x20be\x20empty','Create\x20a\x20new\x20profile','dim','\x27\x20does\x20not\x20exist.','Profile\x20name\x20cannot\x20be\x20empty','Removed\x20existing\x20profile\x20\x27','\x27\x20deleted','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','force','Enter\x20description\x20(optional):','\x20API\x20key\x20saved\x20to\x20system\x20keychain','llm_project','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','Setup\x20cancelled','execute','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','status','\x20\x20tdx\x20--profile\x20','includes','green','profile:set','You\x20can\x20find\x20your\x20API\x20key\x20at:','name','Enter\x20profile\x20name:','91096SIrdDP','text','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','site','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','49WdjvDp','warn','oauth','confirm','Default\x20profile\x20set\x20to:\x20','208272AeEoOo','test','\x20\x20(no\x20profiles\x20found)','description','config','message','10iKxltg','split','Set\x20session\x20profile','join','jobs','\x27.\x0a\x0aValid\x20keys:\x20','validate','yellow','log','trim','profile','111PTzuZH','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','skipExistsCheck','red','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','database','\x27\x20does\x20not\x20exist.\x20Create\x20it?','profile:create','Enter\x20your\x20TD\x20API\x20key:','getUserInfo','✗\x20Validation\x20failed:\x20','Failed\x20to\x20delete\x20profile:\x20','Set\x20a\x20profile\x20configuration\x20value','error','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','469306UmdDlR','\x0aAvailable\x20profiles:','tdx.json','tdx:\x20profile\x20delete'];a33_0x508f=function(){return _0x4965ca;};return a33_0x508f();}import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a33_0x3b2d5b from'prompts';import a33_0x4c36d0 from'chalk';function validateProfileName(_0x2fd1a6,_0x40205f){const _0x57a35c=a33_0x1586;if(!_0x2fd1a6||!_0x2fd1a6[_0x57a35c(0xb9)]())return _0x57a35c(0x8c);const _0x3c6429=_0x2fd1a6['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x57a35c(0xab)](_0x3c6429))return _0x57a35c(0xbf);if(!_0x40205f?.[_0x57a35c(0xbd)]&&profileExists(_0x3c6429))return _0x57a35c(0x7a)+_0x3c6429+_0x57a35c(0xd6)+_0x3c6429+_0x57a35c(0xa2);return!![];}async function deleteProfileAndCredentials(_0x420676){removeProfileFromUserConfig(_0x420676);const _0x3c4baf=await isKeychainAvailable();_0x3c4baf&&await Promise['all']([deleteKeychainAPIKey(_0x420676),deleteOAuthTokens(_0x420676)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x1bc630(0x9e)]=a33_0x1bc630(0xc2);[a33_0x1bc630(0xad)]=a33_0x1bc630(0x89);async[a33_0x1bc630(0x96)](_0x5000b4){const _0x4eb2a6=a33_0x1bc630,{options:_0x5c9486,args:_0x111231}=_0x5000b4,_0x15c586=!!_0x5c9486[_0x4eb2a6(0x90)];console['log'](a33_0x4c36d0['bold'](_0x4eb2a6(0xd4)));let _0x5f3fb9;if(_0x111231[_0x4eb2a6(0xce)]>0x0&&_0x111231[0x0]){const _0x209867=_0x111231[0x0][_0x4eb2a6(0xb9)]();_0x15c586&&profileExists(_0x209867)&&(await deleteProfileAndCredentials(_0x209867),console[_0x4eb2a6(0xb8)](_0x4eb2a6(0x8d)+_0x209867+'\x27'));const _0x52ba08=validateProfileName(_0x209867);if(_0x52ba08!==!![])return console[_0x4eb2a6(0xc8)](a33_0x4c36d0[_0x4eb2a6(0xbe)](_0x52ba08)),0x1;_0x5f3fb9=_0x209867;}else{const _0x279f24=await a33_0x3b2d5b({'type':'text','name':_0x4eb2a6(0x69),'message':_0x4eb2a6(0x9f),'validate':_0x595193=>validateProfileName(_0x595193,{'skipExistsCheck':_0x15c586})});if(!_0x279f24[_0x4eb2a6(0x69)])return console[_0x4eb2a6(0xb8)](_0x4eb2a6(0xd9)),0x1;_0x5f3fb9=_0x279f24[_0x4eb2a6(0x69)][_0x4eb2a6(0xb9)](),_0x15c586&&profileExists(_0x5f3fb9)&&(await deleteProfileAndCredentials(_0x5f3fb9),console[_0x4eb2a6(0xb8)](_0x4eb2a6(0x8d)+_0x5f3fb9+'\x27'));}const _0x485878=await a33_0x3b2d5b({'type':_0x4eb2a6(0xa1),'name':_0x4eb2a6(0xad),'message':_0x4eb2a6(0x91)}),_0x4a9a89=_0x485878[_0x4eb2a6(0xad)]?.[_0x4eb2a6(0xb9)]()||undefined,_0x4b110e=_0x5c9486[_0x4eb2a6(0xa3)]||_0x4eb2a6(0x77),_0x329c70=await promptSiteSelection(_0x4b110e,_0x5f3fb9,_0x4eb2a6(0x95));if(!_0x329c70)return 0x1;const _0x38e2b3=resolveSite(_0x329c70),_0x2ef27c=await promptAuthMethod();if(!_0x2ef27c)return console[_0x4eb2a6(0xb8)]('\x0aSetup\x20cancelled'),0x1;if(_0x2ef27c===_0x4eb2a6(0xa7)){if(_0x4a9a89){const _0x5e29cb={'site':_0x38e2b3,'description':_0x4a9a89};saveProfileToUserConfig(_0x5f3fb9,_0x5e29cb);}const {accountName:_0x48bfcb}=_0x5c9486;return await runOAuthLoginFlow(_0x38e2b3,_0x5f3fb9,_0x5c9486['logLevel']??LogLevel[_0x4eb2a6(0x7e)],{'accountName':_0x48bfcb}),0x0;}console[_0x4eb2a6(0xb8)](_0x4eb2a6(0x68)+_0x38e2b3),console['log'](_0x4eb2a6(0x9d)),console['log']('\x20\x20'+getConsoleUrl(_0x38e2b3,_0x4eb2a6(0x7d)));const _0x455b97=await a33_0x3b2d5b({'type':_0x4eb2a6(0xd7),'name':_0x4eb2a6(0x84),'message':_0x4eb2a6(0xc3),'validate':_0x350980=>{const _0x4aeb38=_0x4eb2a6;if(!_0x350980||!_0x350980[_0x4aeb38(0xb9)]())return _0x4aeb38(0x88);return!![];}});if(!_0x455b97[_0x4eb2a6(0x84)])return console[_0x4eb2a6(0xb8)](_0x4eb2a6(0xd9)),0x1;const _0x5417ba=_0x455b97[_0x4eb2a6(0x84)];console['log'](_0x4eb2a6(0x73));try{const _0x422ed5=TDX[_0x4eb2a6(0x6a)]({'site':_0x38e2b3,'apiKey':_0x5417ba['trim'](),'logLevel':_0x5c9486['logLevel']??LogLevel['ERROR']}),_0x2c29eb=await _0x422ed5[_0x4eb2a6(0xb4)]['getUserInfo']();console[_0x4eb2a6(0xb8)](a33_0x4c36d0[_0x4eb2a6(0x9b)]('✓')+_0x4eb2a6(0x82)+_0x2c29eb[_0x4eb2a6(0x80)]+')');const _0xfe643d=await isKeychainAvailable();_0xfe643d?(await saveAPIKeyAsync(_0x5417ba[_0x4eb2a6(0xb9)](),_0x38e2b3,_0x5f3fb9),console[_0x4eb2a6(0xb8)](a33_0x4c36d0['green']('✓')+_0x4eb2a6(0x6c)+_0x5f3fb9+')')):(console[_0x4eb2a6(0xa6)](a33_0x4c36d0[_0x4eb2a6(0xb7)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x4eb2a6(0xa6)](a33_0x4c36d0[_0x4eb2a6(0xb7)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x5a47be={'site':_0x38e2b3,..._0x4a9a89&&{'description':_0x4a9a89}};return saveProfileToUserConfig(_0x5f3fb9,_0x5a47be),console['log'](a33_0x4c36d0['green']('✓')+_0x4eb2a6(0x6d)+_0x5f3fb9+_0x4eb2a6(0xdb)),console[_0x4eb2a6(0xb8)](),console[_0x4eb2a6(0xb8)](_0x4eb2a6(0xbc)),console['log'](_0x4eb2a6(0x99)+_0x5f3fb9+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x4eb2a6(0xb8)]('\x20\x20tdx\x20--profile\x20'+_0x5f3fb9+_0x4eb2a6(0x78)),0x0;}catch(_0xcafe0d){if(_0xcafe0d instanceof HTTPClientError&&_0xcafe0d[_0x4eb2a6(0x98)]===0x191)return printAuthError(_0xcafe0d),0x1;return console[_0x4eb2a6(0xc8)](a33_0x4c36d0[_0x4eb2a6(0xbe)](_0x4eb2a6(0xc5)+(_0xcafe0d instanceof Error?_0xcafe0d[_0x4eb2a6(0xaf)]:String(_0xcafe0d)))),console['error'](_0x4eb2a6(0xd3)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x1bc630(0x9e)]=a33_0x1bc630(0x75);[a33_0x1bc630(0xad)]=a33_0x1bc630(0x6f);['validate'](_0x95f561){const _0x1f5682=a33_0x1bc630,{args:_0x92257f}=_0x95f561;if(_0x92257f[_0x1f5682(0xce)]===0x0)return _0x1f5682(0x97);return undefined;}async[a33_0x1bc630(0x96)](_0x2abba8){const _0x2e46e0=a33_0x1bc630,{args:_0x40913c}=_0x2abba8,_0x22d735=_0x40913c[0x0];console['log'](a33_0x4c36d0[_0x2e46e0(0x6e)](_0x2e46e0(0xcd)));if(!profileExists(_0x22d735)){console[_0x2e46e0(0xc8)](a33_0x4c36d0[_0x2e46e0(0xbe)](_0x2e46e0(0x7a)+_0x22d735+_0x2e46e0(0x8b))),console[_0x2e46e0(0xb8)](_0x2e46e0(0xcb));const _0xecfd5a=listProfiles();if(_0xecfd5a[_0x2e46e0(0xce)]===0x0)console[_0x2e46e0(0xb8)](_0x2e46e0(0xac));else for(const _0x35bec2 of _0xecfd5a){console[_0x2e46e0(0xb8)]('\x20\x20-\x20'+_0x35bec2[_0x2e46e0(0x9e)]);}return 0x1;}const _0x317c37=await a33_0x3b2d5b({'type':_0x2e46e0(0xa8),'name':'confirm','message':_0x2e46e0(0x94)+_0x22d735+'\x27?','initial':![]});if(!_0x317c37['confirm'])return console[_0x2e46e0(0xb8)](_0x2e46e0(0x79)),0x0;try{await deleteProfileAndCredentials(_0x22d735),console['log'](a33_0x4c36d0[_0x2e46e0(0x9b)]('✓')+_0x2e46e0(0x6d)+_0x22d735+_0x2e46e0(0x8e));}catch(_0x6903eb){return console[_0x2e46e0(0xc8)](a33_0x4c36d0[_0x2e46e0(0xbe)](_0x2e46e0(0xc6)+(_0x6903eb instanceof Error?_0x6903eb[_0x2e46e0(0xaf)]:String(_0x6903eb)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0x1bc630(0x9e)]=a33_0x1bc630(0x9c);[a33_0x1bc630(0xad)]=a33_0x1bc630(0xc7);static [a33_0x1bc630(0x87)]=[a33_0x1bc630(0xa3),a33_0x1bc630(0xc0),'parent_segment',a33_0x1bc630(0x93),a33_0x1bc630(0x86),'description'];[a33_0x1bc630(0xb6)](_0x430f6c){const _0x525f6a=a33_0x1bc630,{args:_0x2c5554,options:_0x114a3c}=_0x430f6c,_0x1db0d2=_0x114a3c[_0x525f6a(0xba)]||getActiveProfile();if(!_0x1db0d2)return'No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>';if(_0x2c5554['length']===0x0)return _0x525f6a(0xd1)+ProfileSetCommand[_0x525f6a(0x87)][_0x525f6a(0xb3)](',\x20');const _0x435152=_0x2c5554[0x0];if(!_0x435152[_0x525f6a(0x9a)]('='))return _0x525f6a(0xa4)+ProfileSetCommand[_0x525f6a(0x87)][_0x525f6a(0xb3)](',\x20');const [_0x731ba4]=_0x435152[_0x525f6a(0xb1)]('=',0x2);if(!ProfileSetCommand[_0x525f6a(0x87)][_0x525f6a(0x9a)](_0x731ba4))return'Unknown\x20key\x20\x27'+_0x731ba4+_0x525f6a(0xb5)+ProfileSetCommand[_0x525f6a(0x87)][_0x525f6a(0xb3)](',\x20');return undefined;}async[a33_0x1bc630(0x96)](_0x4ebb1a){const _0x46720b=a33_0x1bc630,{args:_0x322cd7,options:_0x36c4b2}=_0x4ebb1a,_0x41e404=_0x36c4b2[_0x46720b(0xba)]||getActiveProfile(),[_0x3ba449,..._0x5a7925]=_0x322cd7[0x0]['split']('='),_0x3b44bc=_0x5a7925[_0x46720b(0xb3)]('=');console['log'](a33_0x4c36d0[_0x46720b(0x6e)]('tdx:\x20profile\x20set'));if(!profileExists(_0x41e404)){const _0x42a5bb=await a33_0x3b2d5b({'type':_0x46720b(0xa8),'name':'create','message':_0x46720b(0x7a)+_0x41e404+_0x46720b(0xc1),'initial':!![]});if(!_0x42a5bb[_0x46720b(0x6a)])return console[_0x46720b(0xb8)](_0x46720b(0x70)),0x1;}const _0x8781c6=loadProfile(_0x41e404),_0x43679d=_0x8781c6?.[_0x46720b(0xae)]||{};if(_0x3ba449===_0x46720b(0xa3)){const _0x55c78d=resolveSite(_0x3b44bc);console['log'](_0x46720b(0xda)+_0x55c78d+_0x46720b(0x74)),console[_0x46720b(0xb8)](_0x46720b(0xdc)),console[_0x46720b(0xb8)]('\x20\x20'+getConsoleUrl(_0x55c78d,_0x46720b(0x7d)));const _0xede66=await a33_0x3b2d5b({'type':_0x46720b(0xd7),'name':_0x46720b(0x84),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x5c9265=>{const _0x1d4ce3=_0x46720b;if(!_0x5c9265||!_0x5c9265[_0x1d4ce3(0xb9)]())return _0x1d4ce3(0x88);return!![];}});if(!_0xede66['apiKey'])return console['log']('\x0aOperation\x20cancelled'),0x1;console['log'](_0x46720b(0x73));try{const _0x2dc2be=TDX['create']({'site':_0x55c78d,'apiKey':_0xede66[_0x46720b(0x84)][_0x46720b(0xb9)](),'logLevel':_0x36c4b2[_0x46720b(0x7f)]??LogLevel[_0x46720b(0x7e)]}),_0xbef1fc=await _0x2dc2be[_0x46720b(0xb4)][_0x46720b(0xc4)]();console[_0x46720b(0xb8)](a33_0x4c36d0[_0x46720b(0x9b)]('✓')+_0x46720b(0x82)+_0xbef1fc[_0x46720b(0x80)]+')');const _0x6cfd44=await isKeychainAvailable();_0x6cfd44?(await saveAPIKeyAsync(_0xede66['apiKey'][_0x46720b(0xb9)](),_0x55c78d,_0x41e404),console[_0x46720b(0xb8)](a33_0x4c36d0[_0x46720b(0x9b)]('✓')+_0x46720b(0x92))):console[_0x46720b(0xa6)](a33_0x4c36d0[_0x46720b(0xb7)](_0x46720b(0xc9))),_0x43679d['site']=_0x55c78d;}catch(_0x262af3){if(_0x262af3 instanceof HTTPClientError&&_0x262af3[_0x46720b(0x98)]===0x191)return printAuthError(_0x262af3),0x1;return console[_0x46720b(0xc8)](a33_0x4c36d0[_0x46720b(0xbe)]('✗\x20Validation\x20failed:\x20'+(_0x262af3 instanceof Error?_0x262af3['message']:String(_0x262af3)))),console[_0x46720b(0xc8)](_0x46720b(0x7b)),0x1;}}else _0x43679d[_0x3ba449]=_0x3b44bc||undefined;return saveProfileToUserConfig(_0x41e404,_0x43679d),console[_0x46720b(0xb8)](a33_0x4c36d0['green']('✓')+_0x46720b(0x6d)+_0x41e404+_0x46720b(0xd5)+_0x3ba449+'='+(_0x3b44bc||_0x46720b(0xd8))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x1bc630(0x9e)]='profile:use';[a33_0x1bc630(0xad)]=a33_0x1bc630(0xb2);[a33_0x1bc630(0xb6)](_0xc9f395){const _0x21c83e=a33_0x1bc630,{args:_0x4d4c1e}=_0xc9f395;if(_0x4d4c1e[_0x21c83e(0xce)]===0x0)return _0x21c83e(0x76);return undefined;}async[a33_0x1bc630(0x96)](_0x37c73b){const _0x4ef4e5=a33_0x1bc630,{args:_0x5203ce,options:_0x1fb7ca}=_0x37c73b,_0x335fa9=_0x5203ce[0x0],_0x3794cc=_0x1fb7ca[_0x4ef4e5(0x72)];cleanExpiredSessions();if(!profileExists(_0x335fa9)){console['error'](a33_0x4c36d0[_0x4ef4e5(0xbe)]('Profile\x20\x27'+_0x335fa9+_0x4ef4e5(0x8b))),console[_0x4ef4e5(0xb8)](_0x4ef4e5(0xcb));const _0x4bf9cf=listProfiles();if(_0x4bf9cf['length']===0x0)console['log'](_0x4ef4e5(0xac));else for(const _0x6e303a of _0x4bf9cf){console[_0x4ef4e5(0xb8)](_0x4ef4e5(0x81)+_0x6e303a[_0x4ef4e5(0x9e)]);}return 0x1;}if(_0x3794cc){const _0x5baa86=a33_0x53994c[_0x4ef4e5(0xb3)](getConfigDir(),_0x4ef4e5(0xcc));return saveActiveProfileToUserConfig(_0x335fa9),console['log'](_0x4ef4e5(0xa9)+a33_0x4c36d0['green'](_0x335fa9)),console[_0x4ef4e5(0xb8)](a33_0x4c36d0[_0x4ef4e5(0x8a)](_0x4ef4e5(0xd0)+_0x5baa86)),0x0;}const _0x4ddfce=getSessionID(_0x1fb7ca[_0x4ef4e5(0x83)]);return saveSessionContext({'profile':_0x335fa9},_0x1fb7ca[_0x4ef4e5(0x83)]),console[_0x4ef4e5(0xb8)](_0x4ef4e5(0x71)+a33_0x4c36d0['green'](_0x335fa9)+'\x20'+a33_0x4c36d0[_0x4ef4e5(0x8a)]('(session:\x20'+_0x4ddfce+')')),console[_0x4ef4e5(0xb8)](a33_0x4c36d0[_0x4ef4e5(0x8a)](_0x4ef4e5(0x8f)+_0x335fa9+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
@@ -1 +1 @@
1
- const a34_0x3eca5a=a34_0x25be;(function(_0x3830aa,_0x4ae339){const _0x4bec6b=a34_0x25be,_0x3da1ca=_0x3830aa();while(!![]){try{const _0xa1dc1a=-parseInt(_0x4bec6b(0x106))/0x1*(parseInt(_0x4bec6b(0xf2))/0x2)+-parseInt(_0x4bec6b(0xf8))/0x3+-parseInt(_0x4bec6b(0xee))/0x4+-parseInt(_0x4bec6b(0xff))/0x5+parseInt(_0x4bec6b(0xfa))/0x6*(-parseInt(_0x4bec6b(0x101))/0x7)+-parseInt(_0x4bec6b(0xfb))/0x8*(-parseInt(_0x4bec6b(0x100))/0x9)+-parseInt(_0x4bec6b(0xec))/0xa*(-parseInt(_0x4bec6b(0x105))/0xb);if(_0xa1dc1a===_0x4ae339)break;else _0x3da1ca['push'](_0x3da1ca['shift']());}catch(_0x4d8871){_0x3da1ca['push'](_0x3da1ca['shift']());}}}(a34_0x4eb6,0x6a33b));function a34_0x25be(_0x3557c9,_0x5ae370){_0x3557c9=_0x3557c9-0xec;const _0x4eb637=a34_0x4eb6();let _0x25be9d=_0x4eb637[_0x3557c9];return _0x25be9d;}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x1c9986 from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x3eca5a(0xf1)]=a34_0x3eca5a(0x104);['description']=a34_0x3eca5a(0xf3);async[a34_0x3eca5a(0xf4)](_0x191149){const _0x5d6530=a34_0x3eca5a,{options:_0x329761}=_0x191149;try{const _0x288be8=listProfiles(),_0x1ac99b=getActiveProfile();if(_0x288be8[_0x5d6530(0x107)]===0x0)return console[_0x5d6530(0xed)](_0x5d6530(0xef)),console[_0x5d6530(0xed)]('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console[_0x5d6530(0xed)](_0x5d6530(0x103)),0x0;const _0x5b240b=_0x288be8[_0x5d6530(0xfc)](_0x5139da=>{const _0x1d4125=_0x5d6530,_0xc8cdac=_0x5139da[_0x1d4125(0xf1)]===_0x1ac99b,_0x5b72d7=getProfileParams(_0x5139da[_0x1d4125(0xfe)]);return{'name':_0x5139da[_0x1d4125(0xf1)],'active':_0xc8cdac,'scope':_0x5139da['scope'],'description':_0x5139da[_0x1d4125(0xfe)][_0x1d4125(0xf5)]||'','params':_0x5b72d7};});if(isStructuredFormat(_0x329761))await handleSDKOutput(_0x5b240b,_0x329761);else for(const _0x8bde88 of _0x288be8){const _0x49157=_0x8bde88['name']===_0x1ac99b?a34_0x1c9986['green']('\x20✓'):'',_0xd902fe=_0x8bde88[_0x5d6530(0xfe)][_0x5d6530(0x102)]?a34_0x1c9986[_0x5d6530(0xf0)]('\x20'+_0x8bde88[_0x5d6530(0xfe)][_0x5d6530(0x102)]):'',_0x2b14f8=_0x8bde88[_0x5d6530(0xfe)]['description']?a34_0x1c9986[_0x5d6530(0xf0)]('\x20\x20'+_0x8bde88['config'][_0x5d6530(0xf5)]):'';console[_0x5d6530(0xed)](_0x5d6530(0xfd)+_0x8bde88[_0x5d6530(0xf1)]+_0x49157+_0xd902fe+_0x2b14f8);}return 0x0;}catch(_0x3514df){return _0x3514df instanceof Error&&console[_0x5d6530(0xf9)](_0x5d6530(0xf6)+_0x3514df[_0x5d6530(0xf7)]),0x1;}}}function a34_0x4eb6(){const _0x3a700c=['site','\x20\x20Global:\x20~/.config/tdx/tdx.json','profiles','11IFFuqJ','3SleCPx','length','30394570ZVarrK','log','2519296ySwneS','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','dim','name','319862tQcjmD','List\x20all\x20available\x20profiles','execute','description','Error:\x20','message','1700658qcmYIz','error','105114XvEkkV','121272nBOSPx','map','👤\x20','config','1858505FOlUgp','117vCRjGE','301TJsrWS'];a34_0x4eb6=function(){return _0x3a700c;};return a34_0x4eb6();}
1
+ const a34_0x347a22=a34_0x2afd;(function(_0x31941d,_0x87718c){const _0x5508cd=a34_0x2afd,_0x33fbf5=_0x31941d();while(!![]){try{const _0x50a450=parseInt(_0x5508cd(0x7d))/0x1+parseInt(_0x5508cd(0x92))/0x2*(parseInt(_0x5508cd(0x8b))/0x3)+-parseInt(_0x5508cd(0x81))/0x4+-parseInt(_0x5508cd(0x7e))/0x5+-parseInt(_0x5508cd(0x95))/0x6*(parseInt(_0x5508cd(0x94))/0x7)+parseInt(_0x5508cd(0x89))/0x8*(-parseInt(_0x5508cd(0x82))/0x9)+parseInt(_0x5508cd(0x90))/0xa;if(_0x50a450===_0x87718c)break;else _0x33fbf5['push'](_0x33fbf5['shift']());}catch(_0x1b900f){_0x33fbf5['push'](_0x33fbf5['shift']());}}}(a34_0x53e2,0xc4fa1));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a34_0x53e2(){const _0x3c4ac7=['scope','753538SqMyiE','execute','1533Zclbrz','40548csgjiA','dim','👤\x20','description','42322JGYRkG','630695EkkhMd','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','List\x20all\x20available\x20profiles','3091356lnMlql','117WatRrE','Error:\x20','profiles','error','site','length','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','871576ezwyYj','green','9plnuYs','config','log','message','name','34294790YugFBy'];a34_0x53e2=function(){return _0x3c4ac7;};return a34_0x53e2();}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x38b3cd from'chalk';function a34_0x2afd(_0x365e0e,_0x17621c){_0x365e0e=_0x365e0e-0x7a;const _0x53e23b=a34_0x53e2();let _0x2afd2f=_0x53e23b[_0x365e0e];return _0x2afd2f;}export class ProfilesCommand extends BaseCommand{['name']=a34_0x347a22(0x84);['description']=a34_0x347a22(0x80);async[a34_0x347a22(0x93)](_0x220785){const _0x5da7c8=a34_0x347a22,{options:_0x1c2504}=_0x220785;try{const _0x12ccdb=listProfiles(),_0x31564f=getActiveProfile();if(_0x12ccdb[_0x5da7c8(0x87)]===0x0)return console[_0x5da7c8(0x8d)](_0x5da7c8(0x88)),console[_0x5da7c8(0x8d)](_0x5da7c8(0x7f)),console[_0x5da7c8(0x8d)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x56954f=_0x12ccdb['map'](_0x7721ac=>{const _0x4efd90=_0x5da7c8,_0x7a1644=_0x7721ac[_0x4efd90(0x8f)]===_0x31564f,_0x5b6fa1=getProfileParams(_0x7721ac[_0x4efd90(0x8c)]);return{'name':_0x7721ac[_0x4efd90(0x8f)],'active':_0x7a1644,'scope':_0x7721ac[_0x4efd90(0x91)],'description':_0x7721ac['config'][_0x4efd90(0x7c)]||'','params':_0x5b6fa1};});if(isStructuredFormat(_0x1c2504))await handleSDKOutput(_0x56954f,_0x1c2504);else for(const _0x393382 of _0x12ccdb){const _0xd4aa14=_0x393382[_0x5da7c8(0x8f)]===_0x31564f?a34_0x38b3cd[_0x5da7c8(0x8a)]('\x20✓'):'',_0x58d5c3=_0x393382['config'][_0x5da7c8(0x86)]?a34_0x38b3cd[_0x5da7c8(0x7a)]('\x20'+_0x393382[_0x5da7c8(0x8c)][_0x5da7c8(0x86)]):'',_0x5767ed=_0x393382['config']['description']?a34_0x38b3cd[_0x5da7c8(0x7a)]('\x20\x20'+_0x393382[_0x5da7c8(0x8c)]['description']):'';console[_0x5da7c8(0x8d)](_0x5da7c8(0x7b)+_0x393382['name']+_0xd4aa14+_0x58d5c3+_0x5767ed);}return 0x0;}catch(_0x4d3eb2){return _0x4d3eb2 instanceof Error&&console[_0x5da7c8(0x85)](_0x5da7c8(0x83)+_0x4d3eb2[_0x5da7c8(0x8e)]),0x1;}}}
@@ -1 +1 @@
1
- const a35_0x4705cc=a35_0x5565;function a35_0x5d21(){const _0x5de4f8=['199584MQmfPV','Executing\x20statement\x20','output','Error:\x20','152120iIonax','Schema:\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','SQL:\x20','verbose','58924dSLiyP','message','setPhase','jobId','\x20splits','1896224yhyggp','join','data','args','validate','75ERgCwJ','120HZhnic','error','\x0aAll\x20results\x20saved\x20to\x20','stats','Query\x20completed:\x20Processed\x20','373332ZNffxY','14JkdSUy','elapsedTimeMillis','database','length','information_schema','query','originalMessage','557062DGyvmS','\x20[Job\x20ID:\x20','name','execute','\x20-\x20','setExtra','Run\x20Trino\x20queries\x20(streaming)','30Zlrppl','processedRows','push','file','6754308txzEos','Catalog:\x20','Statement\x20','description','\x20rows\x20','site','completedSplits','catalog','Executing\x20query...','No\x20SQL\x20provided'];a35_0x5d21=function(){return _0x5de4f8;};return a35_0x5d21();}(function(_0x489b69,_0xbb901b){const _0x23246f=a35_0x5565,_0x50f665=_0x489b69();while(!![]){try{const _0x160662=-parseInt(_0x23246f(0x1fb))/0x1+parseInt(_0x23246f(0x218))/0x2+parseInt(_0x23246f(0x20a))/0x3*(parseInt(_0x23246f(0x200))/0x4)+parseInt(_0x23246f(0x1e9))/0x5*(-parseInt(_0x23246f(0x210))/0x6)+-parseInt(_0x23246f(0x211))/0x7*(-parseInt(_0x23246f(0x205))/0x8)+parseInt(_0x23246f(0x1f7))/0x9*(parseInt(_0x23246f(0x20b))/0xa)+-parseInt(_0x23246f(0x1ed))/0xb;if(_0x160662===_0xbb901b)break;else _0x50f665['push'](_0x50f665['shift']());}catch(_0x3825ad){_0x50f665['push'](_0x50f665['shift']());}}}(a35_0x5d21,0x3c6c6));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a35_0x5565(_0x188fc3,_0x3ddae8){_0x188fc3=_0x188fc3-0x1e8;const _0x5d2159=a35_0x5d21();let _0x556584=_0x5d2159[_0x188fc3];return _0x556584;}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a35_0x4705cc(0x21a)]=a35_0x4705cc(0x216);[a35_0x4705cc(0x1f0)]=a35_0x4705cc(0x1e8);async[a35_0x4705cc(0x21b)](_0x2152c6){const _0x4eed9d=a35_0x4705cc,{options:_0x5116f8,args:_0x3f80f7,tdx:_0x7229b4}=_0x2152c6,_0x1e4d65={..._0x5116f8,'limitStructuredFormats':!![]},_0xc21150=_0x3f80f7[0x0],_0x261b02=_0x5116f8[_0x4eed9d(0x1ec)];let _0x40b5d6;try{if(_0x261b02)_0x40b5d6=readSqlStatementsFromFile(_0x261b02);else{if(_0xc21150==='-')_0x40b5d6=await readSqlStatementsFromStdin();else{if(_0xc21150&&isSqlFilePath(_0xc21150))_0x40b5d6=readSqlStatementsFromFile(_0xc21150);else{if(_0xc21150)_0x40b5d6=splitSqlStatements(_0xc21150);else throw new Error(_0x4eed9d(0x1f6));}}}}catch(_0x4e5bd4){return console[_0x4eed9d(0x20c)](_0x4eed9d(0x1fa)+_0x4e5bd4[_0x4eed9d(0x201)]),0x1;}const _0x34e462=_0x5116f8[_0x4eed9d(0x213)]||_0x4eed9d(0x215),_0x5701f3=_0x5116f8[_0x4eed9d(0x1f4)];try{const _0x38024f=[],_0x490aee=!!_0x5116f8[_0x4eed9d(0x1f9)];for(let _0x568d1e=0x0;_0x568d1e<_0x40b5d6[_0x4eed9d(0x214)];_0x568d1e++){const _0x2b4d41=_0x40b5d6[_0x568d1e],_0x571707=_0x568d1e+0x1,_0x3a9570=_0x40b5d6[_0x4eed9d(0x214)],_0x265f4b=_0x3a9570>0x1;_0x5116f8[_0x4eed9d(0x1ff)]&&(console[_0x4eed9d(0x20c)]('\x0a'+(_0x265f4b?_0x4eed9d(0x1ef)+_0x571707+'/'+_0x3a9570+':':'')),console[_0x4eed9d(0x20c)]('Site:\x20'+_0x5116f8[_0x4eed9d(0x1f2)]),console[_0x4eed9d(0x20c)](_0x4eed9d(0x1ee)+(_0x5701f3||'td')),console[_0x4eed9d(0x20c)](_0x4eed9d(0x1fc)+_0x34e462),console[_0x4eed9d(0x20c)](_0x4eed9d(0x1fe)+_0x2b4d41));const _0x581558=_0x265f4b?_0x4eed9d(0x1f8)+_0x571707+'/'+_0x3a9570+'...':_0x4eed9d(0x1f5);try{const _0x1aed84=await withProgressSpinner(_0x581558,async _0x4815c4=>{const _0x3f5588=_0x4eed9d,_0x2afe11=await _0x7229b4['query'][_0x3f5588(0x21b)](_0x2b4d41,{'catalog':_0x5701f3,'schema':_0x34e462,'onJobId':_0x10bd1b=>{_0x4815c4['setJobId'](_0x10bd1b);},'onProgress':_0x114d00=>{const _0x536790=_0x3f5588;_0x4815c4[_0x536790(0x202)]('Executing\x20query\x20['+_0x114d00['state']+']'),_0x4815c4[_0x536790(0x21d)](formatRows(_0x114d00[_0x536790(0x1ea)])+_0x536790(0x1f1)+_0x114d00[_0x536790(0x1f3)]+'/'+_0x114d00['totalSplits']+_0x536790(0x204));}});return _0x2afe11;},{'verbose':_0x5116f8['verbose']}),_0x1c2416=_0x1aed84[_0x4eed9d(0x207)],_0x28025e=_0x1c2416[_0x4eed9d(0x203)]?_0x4eed9d(0x219)+_0x1c2416['jobId']+']':'',_0x1cdc05=_0x265f4b?_0x4eed9d(0x1ef)+_0x571707+'/'+_0x3a9570+_0x4eed9d(0x21c):'';console[_0x4eed9d(0x20c)]('✔\x20'+_0x1cdc05+_0x4eed9d(0x20f)+formatRows(_0x1c2416[_0x4eed9d(0x20e)]['processedRows'])+_0x4eed9d(0x1f1)+('in\x20'+formatElapsed(_0x1c2416[_0x4eed9d(0x20e)][_0x4eed9d(0x212)])+_0x28025e));if(_0x265f4b&&_0x490aee){const _0x239bf9=resolveOutputOptions(_0x1e4d65),_0x23928f=await formatQueryOutput(_0x1c2416,_0x239bf9);_0x38024f[_0x4eed9d(0x1eb)](_0x23928f);}else await handleQueryOutput(_0x1c2416,_0x1e4d65);}catch(_0x8094d6){const _0xd0e82f=_0x265f4b?_0x4eed9d(0x1ef)+_0x571707+'/'+_0x3a9570+':\x0a':'',_0x14e8ca=_0x8094d6 instanceof SDKError?_0x8094d6[_0x4eed9d(0x217)]:_0x8094d6['message'];return console[_0x4eed9d(0x20c)](''+_0xd0e82f+_0x14e8ca),0x1;}}if(_0x40b5d6[_0x4eed9d(0x214)]>0x1&&_0x490aee&&_0x38024f[_0x4eed9d(0x214)]>0x0){const _0xb5b68e=_0x38024f[_0x4eed9d(0x206)]('\x0a');writeFileSync(_0x5116f8[_0x4eed9d(0x1f9)],_0xb5b68e),console[_0x4eed9d(0x20c)](_0x4eed9d(0x20d)+_0x5116f8[_0x4eed9d(0x1f9)]);}return 0x0;}catch(_0x559e2f){throw _0x559e2f;}}[a35_0x4705cc(0x209)](_0x33b312){const _0x34d6b7=a35_0x4705cc,_0x2b7ca9=_0x33b312[_0x34d6b7(0x208)][0x0],_0x1dc368=_0x33b312['options']['file'];if(!_0x2b7ca9&&!_0x1dc368)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(_0x2b7ca9&&_0x1dc368)return _0x34d6b7(0x1fd);return undefined;}}
1
+ function a35_0x4b49(_0x3587b9,_0x405151){_0x3587b9=_0x3587b9-0x1b0;const _0x5e2dfb=a35_0x5e2d();let _0x4b49e8=_0x5e2dfb[_0x3587b9];return _0x4b49e8;}function a35_0x5e2d(){const _0xeb388=['totalSplits','data','validate','\x20-\x20','jobId','739614pZkNhZ','completedSplits','1647UoNbSp','in\x20','information_schema','output','375040YGNBCb','elapsedTimeMillis','setPhase','execute','state','file','error','SQL:\x20','stats','args','\x20[Job\x20ID:\x20','Schema:\x20','originalMessage','60730wZlujh','processedRows','message','No\x20SQL\x20provided','Query\x20completed:\x20Processed\x20','\x0aAll\x20results\x20saved\x20to\x20','3119724vGNKWq','verbose','1JHaEvx','1042726siiZNb','setExtra','Run\x20Trino\x20queries\x20(streaming)','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','site','Statement\x20','2127900eccFIG','Site:\x20','database','918084qWpVYP','7wySyEx','setJobId','\x20rows\x20','options','join','push','catalog','query','length','Executing\x20query\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'];a35_0x5e2d=function(){return _0xeb388;};return a35_0x5e2d();}const a35_0x1b7f47=a35_0x4b49;(function(_0x13a775,_0x11eb18){const _0x436653=a35_0x4b49,_0x235656=_0x13a775();while(!![]){try{const _0x3398ae=-parseInt(_0x436653(0x1c2))/0x1*(-parseInt(_0x436653(0x1c3))/0x2)+-parseInt(_0x436653(0x1cc))/0x3+parseInt(_0x436653(0x1c0))/0x4+parseInt(_0x436653(0x1c9))/0x5+parseInt(_0x436653(0x1dd))/0x6*(parseInt(_0x436653(0x1cd))/0x7)+parseInt(_0x436653(0x1e3))/0x8+-parseInt(_0x436653(0x1df))/0x9*(parseInt(_0x436653(0x1ba))/0xa);if(_0x3398ae===_0x11eb18)break;else _0x235656['push'](_0x235656['shift']());}catch(_0x1f1c0a){_0x235656['push'](_0x235656['shift']());}}}(a35_0x5e2d,0x75194));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';export class QueryCommand extends BaseCommand{['name']=a35_0x1b7f47(0x1d4);['description']=a35_0x1b7f47(0x1c5);async['execute'](_0x29f0c9){const _0x2c4a67=a35_0x1b7f47,{options:_0xd160c1,args:_0x2d901f,tdx:_0x1c6de1}=_0x29f0c9,_0x54391e={..._0xd160c1,'limitStructuredFormats':!![]},_0x40ff47=_0x2d901f[0x0],_0x5abbed=_0xd160c1[_0x2c4a67(0x1b2)];let _0x380540;try{if(_0x5abbed)_0x380540=readSqlStatementsFromFile(_0x5abbed);else{if(_0x40ff47==='-')_0x380540=await readSqlStatementsFromStdin();else{if(_0x40ff47&&isSqlFilePath(_0x40ff47))_0x380540=readSqlStatementsFromFile(_0x40ff47);else{if(_0x40ff47)_0x380540=splitSqlStatements(_0x40ff47);else throw new Error(_0x2c4a67(0x1bd));}}}}catch(_0x18eac3){return console[_0x2c4a67(0x1b3)]('Error:\x20'+_0x18eac3[_0x2c4a67(0x1bc)]),0x1;}const _0x2ca935=_0xd160c1[_0x2c4a67(0x1cb)]||_0x2c4a67(0x1e1),_0x50f08d=_0xd160c1[_0x2c4a67(0x1d3)];try{const _0xc374a6=[],_0x360647=!!_0xd160c1[_0x2c4a67(0x1e2)];for(let _0x47af98=0x0;_0x47af98<_0x380540[_0x2c4a67(0x1d5)];_0x47af98++){const _0x46af62=_0x380540[_0x47af98],_0x412f82=_0x47af98+0x1,_0x34db28=_0x380540[_0x2c4a67(0x1d5)],_0x32d819=_0x34db28>0x1;_0xd160c1[_0x2c4a67(0x1c1)]&&(console[_0x2c4a67(0x1b3)]('\x0a'+(_0x32d819?_0x2c4a67(0x1c8)+_0x412f82+'/'+_0x34db28+':':'')),console[_0x2c4a67(0x1b3)](_0x2c4a67(0x1ca)+_0xd160c1[_0x2c4a67(0x1c7)]),console[_0x2c4a67(0x1b3)]('Catalog:\x20'+(_0x50f08d||'td')),console[_0x2c4a67(0x1b3)](_0x2c4a67(0x1b8)+_0x2ca935),console['error'](_0x2c4a67(0x1b4)+_0x46af62));const _0x4c84e6=_0x32d819?'Executing\x20statement\x20'+_0x412f82+'/'+_0x34db28+'...':'Executing\x20query...';try{const _0x10ba41=await withProgressSpinner(_0x4c84e6,async _0x22b480=>{const _0x1b49c1=_0x2c4a67,_0x2db52d=await _0x1c6de1[_0x1b49c1(0x1d4)][_0x1b49c1(0x1b0)](_0x46af62,{'catalog':_0x50f08d,'schema':_0x2ca935,'onJobId':_0xd9a660=>{const _0x35f22a=_0x1b49c1;_0x22b480[_0x35f22a(0x1ce)](_0xd9a660);},'onProgress':_0x21690a=>{const _0x3f0430=_0x1b49c1;_0x22b480[_0x3f0430(0x1e5)](_0x3f0430(0x1d6)+_0x21690a[_0x3f0430(0x1b1)]+']'),_0x22b480[_0x3f0430(0x1c4)](formatRows(_0x21690a[_0x3f0430(0x1bb)])+'\x20rows\x20'+_0x21690a[_0x3f0430(0x1de)]+'/'+_0x21690a[_0x3f0430(0x1d8)]+'\x20splits');}});return _0x2db52d;},{'verbose':_0xd160c1[_0x2c4a67(0x1c1)]}),_0x4c605d=_0x10ba41[_0x2c4a67(0x1d9)],_0x4a63e3=_0x4c605d['jobId']?_0x2c4a67(0x1b7)+_0x4c605d[_0x2c4a67(0x1dc)]+']':'',_0x53e749=_0x32d819?'Statement\x20'+_0x412f82+'/'+_0x34db28+_0x2c4a67(0x1db):'';console['error']('✔\x20'+_0x53e749+_0x2c4a67(0x1be)+formatRows(_0x4c605d[_0x2c4a67(0x1b5)][_0x2c4a67(0x1bb)])+_0x2c4a67(0x1cf)+(_0x2c4a67(0x1e0)+formatElapsed(_0x4c605d[_0x2c4a67(0x1b5)][_0x2c4a67(0x1e4)])+_0x4a63e3));if(_0x32d819&&_0x360647){const _0x76e957=resolveOutputOptions(_0x54391e),_0x2310fb=await formatQueryOutput(_0x4c605d,_0x76e957);_0xc374a6[_0x2c4a67(0x1d2)](_0x2310fb);}else await handleQueryOutput(_0x4c605d,_0x54391e);}catch(_0x11e3ca){const _0x4036c5=_0x32d819?'Statement\x20'+_0x412f82+'/'+_0x34db28+':\x0a':'',_0x144264=_0x11e3ca instanceof SDKError?_0x11e3ca[_0x2c4a67(0x1b9)]:_0x11e3ca['message'];return console[_0x2c4a67(0x1b3)](''+_0x4036c5+_0x144264),0x1;}}if(_0x380540[_0x2c4a67(0x1d5)]>0x1&&_0x360647&&_0xc374a6['length']>0x0){const _0x3e376e=_0xc374a6[_0x2c4a67(0x1d1)]('\x0a');writeFileSync(_0xd160c1[_0x2c4a67(0x1e2)],_0x3e376e),console['error'](_0x2c4a67(0x1bf)+_0xd160c1[_0x2c4a67(0x1e2)]);}return 0x0;}catch(_0x1a3c15){throw _0x1a3c15;}}[a35_0x1b7f47(0x1da)](_0x33a985){const _0x5a57ef=a35_0x1b7f47,_0xcd496b=_0x33a985[_0x5a57ef(0x1b6)][0x0],_0x5aa0b6=_0x33a985[_0x5a57ef(0x1d0)]['file'];if(!_0xcd496b&&!_0x5aa0b6)return _0x5a57ef(0x1d7);if(_0xcd496b&&_0x5aa0b6)return _0x5a57ef(0x1c6);return undefined;}}
@@ -1 +1 @@
1
- const a36_0x4d473b=a36_0x5945;(function(_0x32c80a,_0xe1a4d7){const _0x2f4ea9=a36_0x5945,_0x50ccc4=_0x32c80a();while(!![]){try{const _0x94e87f=-parseInt(_0x2f4ea9(0xfa))/0x1+-parseInt(_0x2f4ea9(0xe0))/0x2+parseInt(_0x2f4ea9(0x11e))/0x3+-parseInt(_0x2f4ea9(0x123))/0x4*(-parseInt(_0x2f4ea9(0x109))/0x5)+parseInt(_0x2f4ea9(0xed))/0x6+-parseInt(_0x2f4ea9(0xeb))/0x7+parseInt(_0x2f4ea9(0x107))/0x8;if(_0x94e87f===_0xe1a4d7)break;else _0x50ccc4['push'](_0x50ccc4['shift']());}catch(_0x5cacb5){_0x50ccc4['push'](_0x50ccc4['shift']());}}}(a36_0x3f01,0x5f69c));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';function a36_0x3f01(){const _0x362214=['in\x20','4BdcZFp','Update\x20a\x20scheduled\x20query','length','data','\x20execution','Running\x20schedule...','retry_limit','No\x20scheduled\x20queries\x20found','history','count','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','updated_at','name','schedule:history','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','file','create','engine_version','Schedule\x20updated:\x20','red','result','INVALID_ARGUMENT','\x20\x20→\x20','delete','verbose','entries','Run\x20a\x20scheduled\x20query\x20immediately','\x20\x20Cron:\x20','engineVersion','limit','description','show','last_job','padEnd','Schedule\x20created:\x20','📅\x20','\x20(showing\x20','has_next_page','\x20scheduled\x20quer','map','Failed\x20to\x20read\x20file:\x20','priority','\x20\x20Num:\x20','start_at','database','Create\x20a\x20scheduled\x20query','Delete\x20a\x20scheduled\x20query','Schedule\x20deleted:\x20','Listing\x20scheduled\x20queries...','...','from','keys','Updating\x20schedule:\x20','update','\x22...','query','round','user','next_run_at','max','error','output','jobs','Creating\x20schedule:\x20','schedule:delete','ended_at','scheduled_at','listQueries','end_at','d\x20ago','queryUrl','repeat','jsonl','lastRun','delay','site','1351508jEnPrN','executing_user_id','\x20\x20Time:\x20','green','job_id','tsv','soon','Cancelled','retryLimit','Show\x20schedule\x20execution\x20history','\x20(use\x20--limit\x20to\x20see\x20more)','2641149tGkZoT','num','387612GioeQX','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','validate','user_name','Running\x20schedule:\x20','Getting\x20schedule\x20history...','list','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','never','trim','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','args','schedule:update','505753JYgQoj','run','\x20\x20Timezone:\x20','statusIcon','toLocaleDateString','format','execute','(unnamed)','Show\x20schedule\x20details','h\x20ago','ies','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','cyan','10172480lPRKxS','cron','513420WYgUkr','utf-8','Query\x20file\x20is\x20empty','Updating\x20schedule...','yes','\x20matching\x20\x22','schedules','Searching\x20scheduled\x20queries\x20matching\x20\x22','/app/queries/editor?queryId=','Getting\x20schedule\x20details...','timezone','queries','schedule:list','type','Found\x20','options','\x20created','success','Schedule\x20run\x20submitted:\x20','schedule:show','substring','1532340JuivIL','status','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','created_at'];a36_0x3f01=function(){return _0x362214;};return a36_0x3f01();}import a36_0x370d76 from'chalk';function formatRelativeTime(_0x56cfbf){const _0x5706d4=a36_0x5945,_0x81018f=new Date(_0x56cfbf),_0x299e00=new Date(),_0x17a2c2=_0x81018f['getTime']()-_0x299e00['getTime'](),_0x550f2b=Math['abs'](_0x17a2c2)/0x3e8,_0x1c8e95=_0x17a2c2<0x0;if(_0x550f2b<0x3c)return _0x1c8e95?'just\x20now':_0x5706d4(0xe6);else{if(_0x550f2b<0xe10){const _0x457efc=Math[_0x5706d4(0xcc)](_0x550f2b/0x3c);return _0x1c8e95?_0x457efc+'m\x20ago':_0x5706d4(0x122)+_0x457efc+'m';}else{if(_0x550f2b<0x15180){const _0x171031=Math[_0x5706d4(0xcc)](_0x550f2b/0xe10);return _0x1c8e95?_0x171031+_0x5706d4(0x103):_0x5706d4(0x122)+_0x171031+'h';}else{if(_0x550f2b<0x93a80){const _0x455f21=Math[_0x5706d4(0xcc)](_0x550f2b/0x15180);return _0x1c8e95?_0x455f21+_0x5706d4(0xd9):_0x5706d4(0x122)+_0x455f21+'d';}else return _0x81018f[_0x5706d4(0xfe)]();}}}}export class ScheduleListCommand extends BaseCommand{['name']=a36_0x4d473b(0x115);[a36_0x4d473b(0xb2)]='List\x20scheduled\x20queries';async[a36_0x4d473b(0x100)](_0x5a96f7){const _0x353c6b=a36_0x4d473b,{options:_0x57cdd5,args:_0x4e9da0,tdx:_0x1e915d}=_0x5a96f7,_0x2ea8f9=resolveLimit(_0x57cdd5[_0x353c6b(0xb1)],DEFAULT_DISPLAY_LIMIT),_0x398828=_0x4e9da0[0x0],_0x3f570e=_0x398828?_0x353c6b(0x110)+_0x398828+_0x353c6b(0xca):_0x353c6b(0xc4),_0x384757=await withSpinner(_0x3f570e,()=>_0x1e915d[_0x353c6b(0x10f)][_0x353c6b(0xd7)]({'limit':_0x2ea8f9,'scheduled':!![],'pattern':_0x398828}),{'verbose':_0x57cdd5['verbose']}),_0xdc3e31=_0x384757[_0x353c6b(0x126)][_0x353c6b(0x114)],_0x1a8bb4=_0x384757[_0x353c6b(0x126)]['pagination'][_0x353c6b(0xb9)],_0x428f90=_0x398828?_0x353c6b(0x10e)+_0x398828+'\x22':'';_0x1a8bb4?console['error']('Showing\x20first\x20'+_0xdc3e31['length']+'\x20schedules'+_0x428f90+_0x353c6b(0xea)):console[_0x353c6b(0xd0)](_0x353c6b(0x117)+_0xdc3e31[_0x353c6b(0x125)]+_0x353c6b(0xba)+(_0xdc3e31[_0x353c6b(0x125)]!==0x1?_0x353c6b(0x104):'y')+_0x428f90);if(_0x57cdd5[_0x353c6b(0xff)]==='json'||_0x57cdd5[_0x353c6b(0xff)]===_0x353c6b(0xdc)||_0x57cdd5[_0x353c6b(0xff)]==='table'||_0x57cdd5[_0x353c6b(0xff)]===_0x353c6b(0xe5)){const _0x1ef2c8=_0xdc3e31[_0x353c6b(0xbb)](_0x284469=>({'id':_0x284469['id'],'name':_0x284469[_0x353c6b(0x12f)],'cron':_0x284469[_0x353c6b(0x108)],'database':_0x284469[_0x353c6b(0xc0)]?.['name'],'type':_0x284469[_0x353c6b(0x116)],'timezone':_0x284469['time_zone'],'user_name':_0x284469[_0x353c6b(0xcd)]?.['name'],'updated_at':_0x284469[_0x353c6b(0x12e)],'next_run_at':_0x284469[_0x353c6b(0xce)],'last_job_status':_0x284469[_0x353c6b(0xb4)]?.[_0x353c6b(0x11f)]}));await handleSDKOutput(_0x1ef2c8,_0x57cdd5);}else{if(_0xdc3e31[_0x353c6b(0x125)]===0x0)console['log'](_0x353c6b(0x12a));else{const _0x41c632=_0x57cdd5[_0x353c6b(0xdf)],_0x51e3c6=_0xdc3e31[_0x353c6b(0xbb)](_0x13e72c=>{const _0x17bdbd=_0x353c6b,_0xa9e3c5=_0x13e72c[_0x17bdbd(0xb4)]?.[_0x17bdbd(0x11f)]?_0x13e72c[_0x17bdbd(0xb4)][_0x17bdbd(0x11f)]===_0x17bdbd(0x11a)?'✓':'✗':'-',_0x61e465=_0x13e72c['last_job']?.[_0x17bdbd(0xd5)]?formatRelativeTime(_0x13e72c[_0x17bdbd(0xb4)][_0x17bdbd(0xd5)]):_0x17bdbd(0xf5),_0x496aaa=_0x13e72c[_0x17bdbd(0xce)]?formatRelativeTime(_0x13e72c['next_run_at']):'-',_0x5b5f4c=_0x13e72c[_0x17bdbd(0x108)]||'',_0x300ca4=_0x13e72c[_0x17bdbd(0x12f)]||_0x17bdbd(0x101),_0x1d7ff6=getConsoleUrl(_0x41c632,_0x17bdbd(0x111)+_0x13e72c['id']);return{'statusIcon':_0xa9e3c5,'lastRun':_0x61e465,'nextRun':_0x496aaa,'cron':_0x5b5f4c,'name':_0x300ca4,'queryUrl':_0x1d7ff6,'status':_0x13e72c['last_job']?.[_0x17bdbd(0x11f)]};}),_0xf68d7a=Math[_0x353c6b(0xcf)](..._0x51e3c6['map'](_0x4f7cad=>_0x4f7cad[_0x353c6b(0xdd)]['length'])),_0x454692=Math[_0x353c6b(0xcf)](..._0x51e3c6[_0x353c6b(0xbb)](_0x57fc8e=>_0x57fc8e['nextRun']['length'])),_0xb16cd3=Math[_0x353c6b(0xcf)](..._0x51e3c6[_0x353c6b(0xbb)](_0x2c1131=>_0x2c1131[_0x353c6b(0x108)]['length'])),_0x228ee1=_0x51e3c6['map'](_0x26a37a=>{const _0xfe2000=_0x353c6b,_0x4a4899=_0x26a37a[_0xfe2000(0x11f)]===_0xfe2000(0x11a)?a36_0x370d76[_0xfe2000(0xe3)](_0x26a37a[_0xfe2000(0xfd)]):_0x26a37a[_0xfe2000(0x11f)]===_0xfe2000(0xd0)?a36_0x370d76[_0xfe2000(0x136)](_0x26a37a[_0xfe2000(0xfd)]):a36_0x370d76['dim'](_0x26a37a['statusIcon']),_0x45e48d=_0x26a37a['lastRun'][_0xfe2000(0xb5)](_0xf68d7a),_0x17bec6=_0x26a37a['nextRun'][_0xfe2000(0xb5)](_0x454692),_0x21bb91=_0x26a37a[_0xfe2000(0x108)]?a36_0x370d76[_0xfe2000(0x106)](_0x26a37a[_0xfe2000(0x108)][_0xfe2000(0xb5)](_0xb16cd3)):'\x20'[_0xfe2000(0xdb)](_0xb16cd3),_0x4e557b=hyperlink(_0x26a37a[_0xfe2000(0x12f)],_0x26a37a[_0xfe2000(0xda)]);return _0xfe2000(0xb7)+_0x4a4899+'\x20'+_0x45e48d+_0xfe2000(0x139)+_0x17bec6+'\x20\x20'+_0x21bb91+'\x20\x20'+_0x4e557b;});await writeOutput(_0x228ee1['join']('\x0a'),_0x57cdd5[_0x353c6b(0xd1)],_0x353c6b(0xf3));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{['name']=a36_0x4d473b(0x11c);[a36_0x4d473b(0xb2)]=a36_0x4d473b(0x102);[a36_0x4d473b(0xef)](_0x3d2f4f){const _0x52fbad=_0x3d2f4f['args'][0x0];if(!_0x52fbad)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async[a36_0x4d473b(0x100)](_0x3034e9){const _0x23ac51=a36_0x4d473b,{options:_0x34b625,args:_0x4e7b0a,tdx:_0x5f30f9}=_0x3034e9,_0x216061=_0x4e7b0a[0x0],_0x31a6ec=await withSpinner(_0x23ac51(0x112),()=>_0x5f30f9[_0x23ac51(0x10f)][_0x23ac51(0xb3)](_0x216061),{'verbose':_0x34b625[_0x23ac51(0x13b)]}),_0x17fd04=_0x31a6ec[_0x23ac51(0x126)],_0x5477b9={'name':_0x17fd04[_0x23ac51(0x12f)],'cron':_0x17fd04[_0x23ac51(0x108)],'database':_0x17fd04[_0x23ac51(0xc0)],'type':_0x17fd04[_0x23ac51(0x116)],'timezone':_0x17fd04['timezone'],'user_name':_0x17fd04[_0x23ac51(0xf0)],'created_at':_0x17fd04[_0x23ac51(0x121)],'engine_version':_0x17fd04[_0x23ac51(0x134)],'executing_user_id':_0x17fd04[_0x23ac51(0xe1)],'query':_0x17fd04['query'],'delay':_0x17fd04['delay'],'priority':_0x17fd04[_0x23ac51(0xbd)],'retry_limit':_0x17fd04[_0x23ac51(0x129)],..._0x17fd04[_0x23ac51(0x137)]&&{'result':_0x17fd04[_0x23ac51(0x137)]}};return await handleSingleObjectOutput(_0x5477b9,_0x34b625),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x4d473b(0x12f)]='schedule:create';[a36_0x4d473b(0xb2)]=a36_0x4d473b(0xc1);[a36_0x4d473b(0xef)](_0x47287){const _0x17b356=a36_0x4d473b,_0x1d3801=_0x47287['args'][0x0];if(!_0x1d3801)return _0x17b356(0xf7);const _0xfdf4dd=_0x47287[_0x17b356(0x118)];if(!_0xfdf4dd['database'])return _0x17b356(0xee);return undefined;}async['execute'](_0x57e9b7){const _0x5d34cb=a36_0x4d473b,{options:_0xc4daae,args:_0x3c0e9b,tdx:_0x20ace8}=_0x57e9b7,_0x1d1048=_0x3c0e9b[0x0],_0x472b02=_0xc4daae,_0x4afcb6=_0x472b02[_0x5d34cb(0xc0)],_0x5c1227=_0x472b02[_0x5d34cb(0x132)],_0xe24dce=_0x472b02['type']||'trino';let _0x50aa40;try{_0x50aa40=readFileSync(_0x5c1227,_0x5d34cb(0x10a))[_0x5d34cb(0xf6)]();}catch(_0x3114f2){throw new SDKError(ErrorCode[_0x5d34cb(0x138)],_0x5d34cb(0xbc)+_0x5c1227,_0x3114f2 instanceof Error?_0x3114f2:undefined);}if(!_0x50aa40)throw new SDKError(ErrorCode[_0x5d34cb(0x138)],_0x5d34cb(0x10b));const _0x351254={'database':_0x4afcb6,'query':_0x50aa40,'type':_0xe24dce};if(_0x472b02['cron'])_0x351254[_0x5d34cb(0x108)]=_0x472b02[_0x5d34cb(0x108)];if(_0x472b02[_0x5d34cb(0x113)])_0x351254[_0x5d34cb(0x113)]=_0x472b02[_0x5d34cb(0x113)];if(_0x472b02[_0x5d34cb(0xde)]!==undefined)_0x351254[_0x5d34cb(0xde)]=Number(_0x472b02['delay']);if(_0x472b02[_0x5d34cb(0xbd)]!==undefined)_0x351254[_0x5d34cb(0xbd)]=Number(_0x472b02[_0x5d34cb(0xbd)]);if(_0x472b02[_0x5d34cb(0xe8)]!==undefined)_0x351254[_0x5d34cb(0x129)]=Number(_0x472b02[_0x5d34cb(0xe8)]);if(_0x472b02[_0x5d34cb(0x13f)])_0x351254[_0x5d34cb(0x134)]=_0x472b02[_0x5d34cb(0x13f)];if(_0x472b02[_0x5d34cb(0x137)])_0x351254[_0x5d34cb(0x137)]=_0x472b02['result'];if(_0xc4daae['verbose']){console['error'](_0x5d34cb(0xd3)+_0x1d1048),console[_0x5d34cb(0xd0)]('\x20\x20Database:\x20'+_0x4afcb6),console[_0x5d34cb(0xd0)]('\x20\x20Type:\x20'+_0xe24dce);if(_0x351254[_0x5d34cb(0x108)])console[_0x5d34cb(0xd0)](_0x5d34cb(0x13e)+_0x351254['cron']);if(_0x351254[_0x5d34cb(0x113)])console[_0x5d34cb(0xd0)](_0x5d34cb(0xfc)+_0x351254[_0x5d34cb(0x113)]);}const _0x5406cf=await withSpinner('Creating\x20schedule...',()=>_0x20ace8[_0x5d34cb(0x10f)][_0x5d34cb(0x133)](_0x1d1048,_0x351254),{'verbose':_0xc4daae[_0x5d34cb(0x13b)]});return console[_0x5d34cb(0xd0)](_0x5d34cb(0xb6)+_0x5406cf[_0x5d34cb(0x126)]['name']),await handleSingleObjectOutput(_0x5406cf[_0x5d34cb(0x126)],_0xc4daae),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x4d473b(0x12f)]=a36_0x4d473b(0xf9);[a36_0x4d473b(0xb2)]=a36_0x4d473b(0x124);[a36_0x4d473b(0xef)](_0x349442){const _0x330c3c=a36_0x4d473b,_0x5649de=_0x349442[_0x330c3c(0xf8)][0x0];if(!_0x5649de)return _0x330c3c(0xf4);return undefined;}async[a36_0x4d473b(0x100)](_0x334d47){const _0x501ca7=a36_0x4d473b,{options:_0x5c70ea,args:_0x2d2aea,tdx:_0x36d278}=_0x334d47,_0x50bafc=_0x2d2aea[0x0],_0x12b7e5=_0x5c70ea,_0x3c42e6={};if(_0x12b7e5['database'])_0x3c42e6[_0x501ca7(0xc0)]=_0x12b7e5[_0x501ca7(0xc0)];if(_0x12b7e5['type'])_0x3c42e6[_0x501ca7(0x116)]=_0x12b7e5[_0x501ca7(0x116)];if(_0x12b7e5[_0x501ca7(0x108)])_0x3c42e6[_0x501ca7(0x108)]=_0x12b7e5['cron'];if(_0x12b7e5['timezone'])_0x3c42e6['timezone']=_0x12b7e5['timezone'];if(_0x12b7e5[_0x501ca7(0xde)]!==undefined)_0x3c42e6[_0x501ca7(0xde)]=Number(_0x12b7e5['delay']);if(_0x12b7e5['priority']!==undefined)_0x3c42e6[_0x501ca7(0xbd)]=Number(_0x12b7e5[_0x501ca7(0xbd)]);if(_0x12b7e5[_0x501ca7(0xe8)]!==undefined)_0x3c42e6[_0x501ca7(0x129)]=Number(_0x12b7e5['retryLimit']);if(_0x12b7e5['engineVersion'])_0x3c42e6[_0x501ca7(0x134)]=_0x12b7e5[_0x501ca7(0x13f)];if(_0x12b7e5[_0x501ca7(0x137)])_0x3c42e6[_0x501ca7(0x137)]=_0x12b7e5[_0x501ca7(0x137)];if(_0x12b7e5[_0x501ca7(0x132)])try{_0x3c42e6[_0x501ca7(0xcb)]=readFileSync(_0x12b7e5[_0x501ca7(0x132)],_0x501ca7(0x10a))[_0x501ca7(0xf6)]();}catch(_0x4fc241){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x501ca7(0xbc)+_0x12b7e5['file'],_0x4fc241 instanceof Error?_0x4fc241:undefined);}if(Object[_0x501ca7(0xc7)](_0x3c42e6)[_0x501ca7(0x125)]===0x0)throw new SDKError(ErrorCode[_0x501ca7(0x138)],_0x501ca7(0x120));if(_0x5c70ea['verbose']){console[_0x501ca7(0xd0)](_0x501ca7(0xc8)+_0x50bafc);for(const [_0x4767a5,_0x2b7ce3]of Object[_0x501ca7(0x13c)](_0x3c42e6)){_0x4767a5===_0x501ca7(0xcb)?console['error']('\x20\x20'+_0x4767a5+':\x20'+_0x2b7ce3[_0x501ca7(0x11d)](0x0,0x32)+_0x501ca7(0xc5)):console[_0x501ca7(0xd0)]('\x20\x20'+_0x4767a5+':\x20'+_0x2b7ce3);}}const _0x18133b=await withSpinner(_0x501ca7(0x10c),()=>_0x36d278[_0x501ca7(0x10f)][_0x501ca7(0xc9)](_0x50bafc,_0x3c42e6),{'verbose':_0x5c70ea[_0x501ca7(0x13b)]});return console[_0x501ca7(0xd0)](_0x501ca7(0x135)+_0x18133b[_0x501ca7(0x126)][_0x501ca7(0x12f)]),await handleSingleObjectOutput(_0x18133b[_0x501ca7(0x126)],_0x5c70ea),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x4d473b(0x12f)]=a36_0x4d473b(0xd4);[a36_0x4d473b(0xb2)]=a36_0x4d473b(0xc2);['validate'](_0x3f4fcc){const _0x2903f8=a36_0x4d473b,_0x8954e8=_0x3f4fcc[_0x2903f8(0xf8)][0x0];if(!_0x8954e8)return _0x2903f8(0x105);return undefined;}async['execute'](_0x2cd026){const _0x15534e=a36_0x4d473b,{options:_0x46454e,args:_0x114984,tdx:_0x4346ca}=_0x2cd026,_0x36f403=_0x114984[0x0];if(!_0x46454e[_0x15534e(0x10d)]){const _0x7676db=await confirm(_0x15534e(0x131)+_0x36f403+'\x22?');if(!_0x7676db)return console[_0x15534e(0xd0)](_0x15534e(0xe7)),0x0;}const _0x477dea=await withSpinner('Deleting\x20schedule...',()=>_0x4346ca[_0x15534e(0x10f)][_0x15534e(0x13a)](_0x36f403),{'verbose':_0x46454e[_0x15534e(0x13b)]});return console[_0x15534e(0xd0)](_0x15534e(0xc3)+_0x477dea['data'][_0x15534e(0x12f)]),0x0;}}function a36_0x5945(_0x1465f6,_0xc3c8b3){_0x1465f6=_0x1465f6-0xb1;const _0x3f01db=a36_0x3f01();let _0x5945fa=_0x3f01db[_0x1465f6];return _0x5945fa;}export class ScheduleRunCommand extends BaseCommand{[a36_0x4d473b(0x12f)]='schedule:run';[a36_0x4d473b(0xb2)]=a36_0x4d473b(0x13d);[a36_0x4d473b(0xef)](_0x358ca5){const _0x2142fb=a36_0x4d473b,_0x573a7b=_0x358ca5['args'][0x0];if(!_0x573a7b)return _0x2142fb(0x12d);return undefined;}async[a36_0x4d473b(0x100)](_0x32d315){const _0xe8e8ec=a36_0x4d473b,{options:_0x2accfb,args:_0x420987,tdx:_0xf228e5}=_0x32d315,_0xec2af0=_0x420987[0x0],_0x2de2fe=_0x2accfb,_0x5d14cb=_0x2de2fe['time'],_0x40fd9f=_0x2de2fe['num']!==undefined?Number(_0x2de2fe[_0xe8e8ec(0xec)]):undefined;if(_0x2accfb[_0xe8e8ec(0x13b)]){console[_0xe8e8ec(0xd0)](_0xe8e8ec(0xf1)+_0xec2af0);if(_0x5d14cb)console['error'](_0xe8e8ec(0xe2)+_0x5d14cb);if(_0x40fd9f)console[_0xe8e8ec(0xd0)](_0xe8e8ec(0xbe)+_0x40fd9f);}const _0x1b0b9b=await withSpinner(_0xe8e8ec(0x128),()=>_0xf228e5[_0xe8e8ec(0x10f)][_0xe8e8ec(0xfb)](_0xec2af0,{'time':_0x5d14cb,'num':_0x40fd9f}),{'verbose':_0x2accfb[_0xe8e8ec(0x13b)]}),_0x2119f5=_0x1b0b9b[_0xe8e8ec(0x126)][_0xe8e8ec(0xd2)];console[_0xe8e8ec(0xd0)](_0xe8e8ec(0x11b)+_0x2119f5['length']+'\x20job'+(_0x2119f5[_0xe8e8ec(0x125)]!==0x1?'s':'')+_0xe8e8ec(0x119));for(const _0x3ea578 of _0x2119f5){console[_0xe8e8ec(0xd0)]('\x20\x20Job\x20ID:\x20'+_0x3ea578[_0xe8e8ec(0xe4)]);}return await handleSDKOutput(_0x2119f5,_0x2accfb),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x4d473b(0x12f)]=a36_0x4d473b(0x130);[a36_0x4d473b(0xb2)]=a36_0x4d473b(0xe9);[a36_0x4d473b(0xef)](_0x4cee3f){const _0x27ceb6=a36_0x4d473b,_0xc12948=_0x4cee3f[_0x27ceb6(0xf8)][0x0];if(!_0xc12948)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async[a36_0x4d473b(0x100)](_0x471ff7){const _0x341cfe=a36_0x4d473b,{options:_0x11ee27,args:_0x4a7fad,tdx:_0x1f5c8e}=_0x471ff7,_0x150d13=_0x4a7fad[0x0],_0x1a8e4f=_0x11ee27,_0x10b351=_0x1a8e4f[_0x341cfe(0xc6)]!==undefined?Number(_0x1a8e4f[_0x341cfe(0xc6)]):undefined,_0x158775=_0x1a8e4f['to']!==undefined?Number(_0x1a8e4f['to']):undefined,_0x25658f=await withSpinner(_0x341cfe(0xf2),()=>_0x1f5c8e['schedules'][_0x341cfe(0x12b)](_0x150d13,{'from':_0x10b351,'to':_0x158775}),{'verbose':_0x11ee27[_0x341cfe(0x13b)]}),_0x3f6948=_0x25658f[_0x341cfe(0x126)];console['error'](_0x341cfe(0x117)+_0x3f6948[_0x341cfe(0x12c)]+_0x341cfe(0x127)+(_0x3f6948[_0x341cfe(0x12c)]!==0x1?'s':'')+_0x341cfe(0xb8)+_0x3f6948[_0x341cfe(0xc6)]+'-'+_0x3f6948['to']+')');const _0x3d7340=_0x3f6948['history'][_0x341cfe(0xbb)](_0x13f564=>({'job_id':_0x13f564['job_id'],'type':_0x13f564[_0x341cfe(0x116)],'status':_0x13f564[_0x341cfe(0x11f)],'scheduled_at':_0x13f564[_0x341cfe(0xd6)],'created_at':_0x13f564[_0x341cfe(0x121)],'start_at':_0x13f564[_0x341cfe(0xbf)],'end_at':_0x13f564[_0x341cfe(0xd8)]}));return await handleSDKOutput(_0x3d7340,_0x11ee27),0x0;}}
1
+ const a36_0x32adf0=a36_0x43b7;(function(_0x189c67,_0x5c9000){const _0x2b23d8=a36_0x43b7,_0x43486b=_0x189c67();while(!![]){try{const _0x9509b=-parseInt(_0x2b23d8(0x149))/0x1+parseInt(_0x2b23d8(0x135))/0x2+parseInt(_0x2b23d8(0x143))/0x3+parseInt(_0x2b23d8(0x114))/0x4+-parseInt(_0x2b23d8(0x144))/0x5+-parseInt(_0x2b23d8(0x16b))/0x6*(parseInt(_0x2b23d8(0x142))/0x7)+parseInt(_0x2b23d8(0x139))/0x8*(parseInt(_0x2b23d8(0x10a))/0x9);if(_0x9509b===_0x5c9000)break;else _0x43486b['push'](_0x43486b['shift']());}catch(_0x286e4a){_0x43486b['push'](_0x43486b['shift']());}}}(a36_0x3ec2,0x4580f));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';function a36_0x3ec2(){const _0x52e2d8=['entries','\x20schedules','delay','d\x20ago','getTime','verbose','Show\x20schedule\x20details','Searching\x20scheduled\x20queries\x20matching\x20\x22','queryUrl','file','schedule:create','listQueries','name','last_job','engineVersion','abs','substring','ended_at','red','\x20\x20Job\x20ID:\x20','length','INVALID_ARGUMENT','limit','execute','retry_limit','Creating\x20schedule...','description','list','format','404526qDPJWA','Creating\x20schedule:\x20','nextRun','tsv','schedule:show','keys','\x20\x20Type:\x20','\x20matching\x20\x22','Getting\x20schedule\x20history...','json','success','\x20(showing\x20','Found\x20','next_run_at','error','type','max','No\x20scheduled\x20queries\x20found','options','schedule:update','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','padEnd','\x20\x20Cron:\x20','h\x20ago','statusIcon','show','Listing\x20scheduled\x20queries...','trim','executing_user_id','Schedule\x20run\x20submitted:\x20','Running\x20schedule...','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','query','Updating\x20schedule...','(unnamed)','output','Getting\x20schedule\x20details...','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','Delete\x20a\x20scheduled\x20query','Deleting\x20schedule...','utf-8','user_name','\x20execution','Showing\x20first\x20','Schedule\x20deleted:\x20','18yQwLDQ','job_id','in\x20','queries','soon','map','cron','\x20\x20→\x20','table','dim','904164ofZNyr','delete','Query\x20file\x20is\x20empty','history','/app/queries/editor?queryId=','log','round','schedule:list','has_next_page','timezone','result','engine_version','Update\x20a\x20scheduled\x20query','join','Create\x20a\x20scheduled\x20query','time_zone','end_at','green','pagination','from','update','args','jsonl','Cancelled','updated_at','created_at','status','start_at','create','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','validate','database','Updating\x20schedule:\x20','137646HdhBDF','schedules','count','\x20created','1656296URHvBb','repeat','📅\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','num','data','priority','site','\x20(use\x20--limit\x20to\x20see\x20more)','49hVPJYI','1003602EFSdXk','519225MjPBlI','retryLimit','schedule:delete','\x20\x20Database:\x20','\x20scheduled\x20quer','182993JzFBJI','never','scheduled_at','\x20\x20Time:\x20','Run\x20a\x20scheduled\x20query\x20immediately'];a36_0x3ec2=function(){return _0x52e2d8;};return a36_0x3ec2();}import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a36_0x134565 from'chalk';function formatRelativeTime(_0x4c0a47){const _0x1064ea=a36_0x43b7,_0x1a935d=new Date(_0x4c0a47),_0x11f380=new Date(),_0x4c300c=_0x1a935d['getTime']()-_0x11f380[_0x1064ea(0x152)](),_0x2497e3=Math[_0x1064ea(0x15d)](_0x4c300c)/0x3e8,_0x2757e6=_0x4c300c<0x0;if(_0x2497e3<0x3c)return _0x2757e6?'just\x20now':_0x1064ea(0x10e);else{if(_0x2497e3<0xe10){const _0xadc471=Math['round'](_0x2497e3/0x3c);return _0x2757e6?_0xadc471+'m\x20ago':_0x1064ea(0x10c)+_0xadc471+'m';}else{if(_0x2497e3<0x15180){const _0x2ebf6c=Math[_0x1064ea(0x11a)](_0x2497e3/0xe10);return _0x2757e6?_0x2ebf6c+_0x1064ea(0x182):_0x1064ea(0x10c)+_0x2ebf6c+'h';}else{if(_0x2497e3<0x93a80){const _0x9aa629=Math[_0x1064ea(0x11a)](_0x2497e3/0x15180);return _0x2757e6?_0x9aa629+_0x1064ea(0x151):_0x1064ea(0x10c)+_0x9aa629+'d';}else return _0x1a935d['toLocaleDateString']();}}}}export class ScheduleListCommand extends BaseCommand{['name']=a36_0x32adf0(0x11b);[a36_0x32adf0(0x168)]='List\x20scheduled\x20queries';async[a36_0x32adf0(0x165)](_0xf39ea5){const _0x599394=a36_0x32adf0,{options:_0x54134e,args:_0x26f085,tdx:_0x510b47}=_0xf39ea5,_0x2e5278=resolveLimit(_0x54134e[_0x599394(0x164)],DEFAULT_DISPLAY_LIMIT),_0x5b456b=_0x26f085[0x0],_0x550794=_0x5b456b?_0x599394(0x155)+_0x5b456b+'\x22...':_0x599394(0x185),_0x1432c3=await withSpinner(_0x550794,()=>_0x510b47['schedules'][_0x599394(0x159)]({'limit':_0x2e5278,'scheduled':!![],'pattern':_0x5b456b}),{'verbose':_0x54134e['verbose']}),_0xd26bb3=_0x1432c3['data'][_0x599394(0x10d)],_0x232e5d=_0x1432c3[_0x599394(0x13e)][_0x599394(0x126)][_0x599394(0x11c)],_0x4897ef=_0x5b456b?_0x599394(0x172)+_0x5b456b+'\x22':'';_0x232e5d?console[_0x599394(0x179)](_0x599394(0x196)+_0xd26bb3[_0x599394(0x162)]+_0x599394(0x14f)+_0x4897ef+_0x599394(0x141)):console['error'](_0x599394(0x177)+_0xd26bb3[_0x599394(0x162)]+_0x599394(0x148)+(_0xd26bb3[_0x599394(0x162)]!==0x1?'ies':'y')+_0x4897ef);if(_0x54134e[_0x599394(0x16a)]===_0x599394(0x174)||_0x54134e['format']===_0x599394(0x12a)||_0x54134e[_0x599394(0x16a)]===_0x599394(0x112)||_0x54134e['format']===_0x599394(0x16e)){const _0x4552d6=_0xd26bb3[_0x599394(0x10f)](_0xed2380=>({'id':_0xed2380['id'],'name':_0xed2380['name'],'cron':_0xed2380[_0x599394(0x110)],'database':_0xed2380[_0x599394(0x133)]?.['name'],'type':_0xed2380[_0x599394(0x17a)],'timezone':_0xed2380[_0x599394(0x123)],'user_name':_0xed2380['user']?.['name'],'updated_at':_0xed2380[_0x599394(0x12c)],'next_run_at':_0xed2380['next_run_at'],'last_job_status':_0xed2380[_0x599394(0x15b)]?.['status']}));await handleSDKOutput(_0x4552d6,_0x54134e);}else{if(_0xd26bb3[_0x599394(0x162)]===0x0)console[_0x599394(0x119)](_0x599394(0x17c));else{const _0x2b74c7=_0x54134e[_0x599394(0x140)],_0x1b5258=_0xd26bb3[_0x599394(0x10f)](_0x23e39b=>{const _0x4d53b9=_0x599394,_0xcea8f4=_0x23e39b['last_job']?.['status']?_0x23e39b[_0x4d53b9(0x15b)][_0x4d53b9(0x12e)]===_0x4d53b9(0x175)?'✓':'✗':'-',_0x535013=_0x23e39b[_0x4d53b9(0x15b)]?.[_0x4d53b9(0x15f)]?formatRelativeTime(_0x23e39b[_0x4d53b9(0x15b)][_0x4d53b9(0x15f)]):_0x4d53b9(0x14a),_0x186e55=_0x23e39b['next_run_at']?formatRelativeTime(_0x23e39b[_0x4d53b9(0x178)]):'-',_0x4b45a1=_0x23e39b[_0x4d53b9(0x110)]||'',_0x1036e2=_0x23e39b['name']||_0x4d53b9(0x18d),_0x17ada9=getConsoleUrl(_0x2b74c7,_0x4d53b9(0x118)+_0x23e39b['id']);return{'statusIcon':_0xcea8f4,'lastRun':_0x535013,'nextRun':_0x186e55,'cron':_0x4b45a1,'name':_0x1036e2,'queryUrl':_0x17ada9,'status':_0x23e39b['last_job']?.[_0x4d53b9(0x12e)]};}),_0x28125d=Math['max'](..._0x1b5258[_0x599394(0x10f)](_0x127e2f=>_0x127e2f['lastRun']['length'])),_0x3d3774=Math[_0x599394(0x17b)](..._0x1b5258[_0x599394(0x10f)](_0x15f1dc=>_0x15f1dc[_0x599394(0x16d)][_0x599394(0x162)])),_0x396286=Math['max'](..._0x1b5258[_0x599394(0x10f)](_0x2620a2=>_0x2620a2['cron'][_0x599394(0x162)])),_0x3f6dcf=_0x1b5258['map'](_0x52c56e=>{const _0x306f4b=_0x599394,_0x159e47=_0x52c56e[_0x306f4b(0x12e)]===_0x306f4b(0x175)?a36_0x134565[_0x306f4b(0x125)](_0x52c56e[_0x306f4b(0x183)]):_0x52c56e[_0x306f4b(0x12e)]===_0x306f4b(0x179)?a36_0x134565[_0x306f4b(0x160)](_0x52c56e[_0x306f4b(0x183)]):a36_0x134565[_0x306f4b(0x113)](_0x52c56e[_0x306f4b(0x183)]),_0x5d830f=_0x52c56e['lastRun'][_0x306f4b(0x180)](_0x28125d),_0x512a26=_0x52c56e[_0x306f4b(0x16d)]['padEnd'](_0x3d3774),_0x335591=_0x52c56e[_0x306f4b(0x110)]?a36_0x134565['cyan'](_0x52c56e[_0x306f4b(0x110)][_0x306f4b(0x180)](_0x396286)):'\x20'[_0x306f4b(0x13a)](_0x396286),_0x32381f=hyperlink(_0x52c56e[_0x306f4b(0x15a)],_0x52c56e[_0x306f4b(0x156)]);return _0x306f4b(0x13b)+_0x159e47+'\x20'+_0x5d830f+_0x306f4b(0x111)+_0x512a26+'\x20\x20'+_0x335591+'\x20\x20'+_0x32381f;});await writeOutput(_0x3f6dcf[_0x599394(0x121)]('\x0a'),_0x54134e[_0x599394(0x18e)],_0x599394(0x169));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x32adf0(0x15a)]=a36_0x32adf0(0x16f);['description']=a36_0x32adf0(0x154);['validate'](_0x58d41e){const _0x59b827=a36_0x32adf0,_0xe160a4=_0x58d41e[_0x59b827(0x129)][0x0];if(!_0xe160a4)return _0x59b827(0x13c);return undefined;}async['execute'](_0x1b1daa){const _0x3c7bfb=a36_0x32adf0,{options:_0x63abda,args:_0x4f3a3f,tdx:_0x17e827}=_0x1b1daa,_0x2fd404=_0x4f3a3f[0x0],_0x2a8408=await withSpinner(_0x3c7bfb(0x18f),()=>_0x17e827[_0x3c7bfb(0x136)][_0x3c7bfb(0x184)](_0x2fd404),{'verbose':_0x63abda[_0x3c7bfb(0x153)]}),_0x12eac0=_0x2a8408['data'],_0x2c7dc9={'name':_0x12eac0[_0x3c7bfb(0x15a)],'cron':_0x12eac0[_0x3c7bfb(0x110)],'database':_0x12eac0[_0x3c7bfb(0x133)],'type':_0x12eac0[_0x3c7bfb(0x17a)],'timezone':_0x12eac0[_0x3c7bfb(0x11d)],'user_name':_0x12eac0[_0x3c7bfb(0x194)],'created_at':_0x12eac0[_0x3c7bfb(0x12d)],'engine_version':_0x12eac0[_0x3c7bfb(0x11f)],'executing_user_id':_0x12eac0[_0x3c7bfb(0x187)],'query':_0x12eac0['query'],'delay':_0x12eac0[_0x3c7bfb(0x150)],'priority':_0x12eac0[_0x3c7bfb(0x13f)],'retry_limit':_0x12eac0[_0x3c7bfb(0x166)],..._0x12eac0[_0x3c7bfb(0x11e)]&&{'result':_0x12eac0[_0x3c7bfb(0x11e)]}};return await handleSingleObjectOutput(_0x2c7dc9,_0x63abda),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x32adf0(0x15a)]=a36_0x32adf0(0x158);[a36_0x32adf0(0x168)]=a36_0x32adf0(0x122);[a36_0x32adf0(0x132)](_0x1c36df){const _0x34782e=a36_0x32adf0,_0x177156=_0x1c36df[_0x34782e(0x129)][0x0];if(!_0x177156)return _0x34782e(0x190);const _0x2d5242=_0x1c36df[_0x34782e(0x17d)];if(!_0x2d5242[_0x34782e(0x133)])return _0x34782e(0x17f);return undefined;}async['execute'](_0x32373b){const _0x4193bb=a36_0x32adf0,{options:_0x5c27ed,args:_0x378f72,tdx:_0x5c2d24}=_0x32373b,_0xed009c=_0x378f72[0x0],_0x1e6c92=_0x5c27ed,_0x9325ba=_0x1e6c92[_0x4193bb(0x133)],_0x431cb5=_0x1e6c92[_0x4193bb(0x157)],_0x4db273=_0x1e6c92[_0x4193bb(0x17a)]||'trino';let _0x4c9fdb;try{_0x4c9fdb=readFileSync(_0x431cb5,_0x4193bb(0x193))[_0x4193bb(0x186)]();}catch(_0x4b9662){throw new SDKError(ErrorCode[_0x4193bb(0x163)],'Failed\x20to\x20read\x20file:\x20'+_0x431cb5,_0x4b9662 instanceof Error?_0x4b9662:undefined);}if(!_0x4c9fdb)throw new SDKError(ErrorCode[_0x4193bb(0x163)],_0x4193bb(0x116));const _0x2a1d7b={'database':_0x9325ba,'query':_0x4c9fdb,'type':_0x4db273};if(_0x1e6c92[_0x4193bb(0x110)])_0x2a1d7b[_0x4193bb(0x110)]=_0x1e6c92[_0x4193bb(0x110)];if(_0x1e6c92['timezone'])_0x2a1d7b[_0x4193bb(0x11d)]=_0x1e6c92['timezone'];if(_0x1e6c92[_0x4193bb(0x150)]!==undefined)_0x2a1d7b['delay']=Number(_0x1e6c92[_0x4193bb(0x150)]);if(_0x1e6c92['priority']!==undefined)_0x2a1d7b[_0x4193bb(0x13f)]=Number(_0x1e6c92[_0x4193bb(0x13f)]);if(_0x1e6c92['retryLimit']!==undefined)_0x2a1d7b[_0x4193bb(0x166)]=Number(_0x1e6c92[_0x4193bb(0x145)]);if(_0x1e6c92['engineVersion'])_0x2a1d7b['engine_version']=_0x1e6c92[_0x4193bb(0x15c)];if(_0x1e6c92['result'])_0x2a1d7b['result']=_0x1e6c92[_0x4193bb(0x11e)];if(_0x5c27ed[_0x4193bb(0x153)]){console['error'](_0x4193bb(0x16c)+_0xed009c),console[_0x4193bb(0x179)](_0x4193bb(0x147)+_0x9325ba),console[_0x4193bb(0x179)](_0x4193bb(0x171)+_0x4db273);if(_0x2a1d7b['cron'])console[_0x4193bb(0x179)](_0x4193bb(0x181)+_0x2a1d7b['cron']);if(_0x2a1d7b['timezone'])console[_0x4193bb(0x179)]('\x20\x20Timezone:\x20'+_0x2a1d7b['timezone']);}const _0x684e5c=await withSpinner(_0x4193bb(0x167),()=>_0x5c2d24['schedules'][_0x4193bb(0x130)](_0xed009c,_0x2a1d7b),{'verbose':_0x5c27ed[_0x4193bb(0x153)]});return console['error']('Schedule\x20created:\x20'+_0x684e5c[_0x4193bb(0x13e)][_0x4193bb(0x15a)]),await handleSingleObjectOutput(_0x684e5c[_0x4193bb(0x13e)],_0x5c27ed),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x32adf0(0x15a)]=a36_0x32adf0(0x17e);[a36_0x32adf0(0x168)]=a36_0x32adf0(0x120);['validate'](_0x3d35f1){const _0x16ccf7=a36_0x32adf0,_0x1a9ef4=_0x3d35f1[_0x16ccf7(0x129)][0x0];if(!_0x1a9ef4)return _0x16ccf7(0x131);return undefined;}async[a36_0x32adf0(0x165)](_0x40ab5d){const _0x50b483=a36_0x32adf0,{options:_0x577b27,args:_0x2bcbde,tdx:_0x3951f2}=_0x40ab5d,_0x1f9545=_0x2bcbde[0x0],_0x2ec507=_0x577b27,_0x356ff3={};if(_0x2ec507[_0x50b483(0x133)])_0x356ff3[_0x50b483(0x133)]=_0x2ec507['database'];if(_0x2ec507['type'])_0x356ff3[_0x50b483(0x17a)]=_0x2ec507[_0x50b483(0x17a)];if(_0x2ec507[_0x50b483(0x110)])_0x356ff3[_0x50b483(0x110)]=_0x2ec507['cron'];if(_0x2ec507[_0x50b483(0x11d)])_0x356ff3[_0x50b483(0x11d)]=_0x2ec507[_0x50b483(0x11d)];if(_0x2ec507[_0x50b483(0x150)]!==undefined)_0x356ff3[_0x50b483(0x150)]=Number(_0x2ec507[_0x50b483(0x150)]);if(_0x2ec507[_0x50b483(0x13f)]!==undefined)_0x356ff3[_0x50b483(0x13f)]=Number(_0x2ec507[_0x50b483(0x13f)]);if(_0x2ec507[_0x50b483(0x145)]!==undefined)_0x356ff3[_0x50b483(0x166)]=Number(_0x2ec507['retryLimit']);if(_0x2ec507[_0x50b483(0x15c)])_0x356ff3['engine_version']=_0x2ec507[_0x50b483(0x15c)];if(_0x2ec507[_0x50b483(0x11e)])_0x356ff3['result']=_0x2ec507[_0x50b483(0x11e)];if(_0x2ec507[_0x50b483(0x157)])try{_0x356ff3['query']=readFileSync(_0x2ec507[_0x50b483(0x157)],'utf-8')['trim']();}catch(_0x29b7b8){throw new SDKError(ErrorCode[_0x50b483(0x163)],'Failed\x20to\x20read\x20file:\x20'+_0x2ec507['file'],_0x29b7b8 instanceof Error?_0x29b7b8:undefined);}if(Object[_0x50b483(0x170)](_0x356ff3)[_0x50b483(0x162)]===0x0)throw new SDKError(ErrorCode[_0x50b483(0x163)],'At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update');if(_0x577b27['verbose']){console['error'](_0x50b483(0x134)+_0x1f9545);for(const [_0x3193aa,_0x41f30f]of Object[_0x50b483(0x14e)](_0x356ff3)){_0x3193aa===_0x50b483(0x18b)?console[_0x50b483(0x179)]('\x20\x20'+_0x3193aa+':\x20'+_0x41f30f[_0x50b483(0x15e)](0x0,0x32)+'...'):console[_0x50b483(0x179)]('\x20\x20'+_0x3193aa+':\x20'+_0x41f30f);}}const _0x38fabc=await withSpinner(_0x50b483(0x18c),()=>_0x3951f2[_0x50b483(0x136)][_0x50b483(0x128)](_0x1f9545,_0x356ff3),{'verbose':_0x577b27[_0x50b483(0x153)]});return console['error']('Schedule\x20updated:\x20'+_0x38fabc['data'][_0x50b483(0x15a)]),await handleSingleObjectOutput(_0x38fabc[_0x50b483(0x13e)],_0x577b27),0x0;}}function a36_0x43b7(_0xba73be,_0x553949){_0xba73be=_0xba73be-0x10a;const _0x3ec2cc=a36_0x3ec2();let _0x43b722=_0x3ec2cc[_0xba73be];return _0x43b722;}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x32adf0(0x15a)]=a36_0x32adf0(0x146);[a36_0x32adf0(0x168)]=a36_0x32adf0(0x191);[a36_0x32adf0(0x132)](_0x713d4c){const _0x4bace=a36_0x32adf0,_0xbe3e96=_0x713d4c[_0x4bace(0x129)][0x0];if(!_0xbe3e96)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async['execute'](_0x2def39){const _0x29a622=a36_0x32adf0,{options:_0x5fdb93,args:_0x532ef3,tdx:_0x112288}=_0x2def39,_0xb0aa38=_0x532ef3[0x0];if(!_0x5fdb93['yes']){const _0x27b58b=await confirm(_0x29a622(0x18a)+_0xb0aa38+'\x22?');if(!_0x27b58b)return console[_0x29a622(0x179)](_0x29a622(0x12b)),0x0;}const _0x11245b=await withSpinner(_0x29a622(0x192),()=>_0x112288[_0x29a622(0x136)][_0x29a622(0x115)](_0xb0aa38),{'verbose':_0x5fdb93[_0x29a622(0x153)]});return console[_0x29a622(0x179)](_0x29a622(0x197)+_0x11245b['data']['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x32adf0(0x15a)]='schedule:run';[a36_0x32adf0(0x168)]=a36_0x32adf0(0x14d);['validate'](_0x451cd1){const _0x4abb4f=a36_0x32adf0,_0xd1976f=_0x451cd1[_0x4abb4f(0x129)][0x0];if(!_0xd1976f)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async['execute'](_0x796fc8){const _0x2fae99=a36_0x32adf0,{options:_0x1fba4d,args:_0x4773bb,tdx:_0x391af7}=_0x796fc8,_0x246a82=_0x4773bb[0x0],_0x5892c8=_0x1fba4d,_0x5cd840=_0x5892c8['time'],_0x124ca6=_0x5892c8['num']!==undefined?Number(_0x5892c8[_0x2fae99(0x13d)]):undefined;if(_0x1fba4d[_0x2fae99(0x153)]){console[_0x2fae99(0x179)]('Running\x20schedule:\x20'+_0x246a82);if(_0x5cd840)console[_0x2fae99(0x179)](_0x2fae99(0x14c)+_0x5cd840);if(_0x124ca6)console['error']('\x20\x20Num:\x20'+_0x124ca6);}const _0x4b3f60=await withSpinner(_0x2fae99(0x189),()=>_0x391af7[_0x2fae99(0x136)]['run'](_0x246a82,{'time':_0x5cd840,'num':_0x124ca6}),{'verbose':_0x1fba4d['verbose']}),_0x1f167a=_0x4b3f60[_0x2fae99(0x13e)]['jobs'];console['error'](_0x2fae99(0x188)+_0x1f167a[_0x2fae99(0x162)]+'\x20job'+(_0x1f167a['length']!==0x1?'s':'')+_0x2fae99(0x138));for(const _0x2644a9 of _0x1f167a){console['error'](_0x2fae99(0x161)+_0x2644a9[_0x2fae99(0x10b)]);}return await handleSDKOutput(_0x1f167a,_0x1fba4d),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{['name']='schedule:history';[a36_0x32adf0(0x168)]='Show\x20schedule\x20execution\x20history';[a36_0x32adf0(0x132)](_0x5f2319){const _0x1cf919=a36_0x32adf0,_0xe3de30=_0x5f2319[_0x1cf919(0x129)][0x0];if(!_0xe3de30)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async[a36_0x32adf0(0x165)](_0x215487){const _0x3675a1=a36_0x32adf0,{options:_0x158fbc,args:_0x2b7270,tdx:_0x1643a8}=_0x215487,_0x548d9b=_0x2b7270[0x0],_0x4f1959=_0x158fbc,_0xca32c0=_0x4f1959[_0x3675a1(0x127)]!==undefined?Number(_0x4f1959[_0x3675a1(0x127)]):undefined,_0x3c3124=_0x4f1959['to']!==undefined?Number(_0x4f1959['to']):undefined,_0x245dd9=await withSpinner(_0x3675a1(0x173),()=>_0x1643a8['schedules'][_0x3675a1(0x117)](_0x548d9b,{'from':_0xca32c0,'to':_0x3c3124}),{'verbose':_0x158fbc[_0x3675a1(0x153)]}),_0x19e807=_0x245dd9['data'];console[_0x3675a1(0x179)]('Found\x20'+_0x19e807[_0x3675a1(0x137)]+_0x3675a1(0x195)+(_0x19e807[_0x3675a1(0x137)]!==0x1?'s':'')+_0x3675a1(0x176)+_0x19e807[_0x3675a1(0x127)]+'-'+_0x19e807['to']+')');const _0x4f3b3b=_0x19e807['history']['map'](_0x1858e2=>({'job_id':_0x1858e2[_0x3675a1(0x10b)],'type':_0x1858e2[_0x3675a1(0x17a)],'status':_0x1858e2[_0x3675a1(0x12e)],'scheduled_at':_0x1858e2[_0x3675a1(0x14b)],'created_at':_0x1858e2[_0x3675a1(0x12d)],'start_at':_0x1858e2[_0x3675a1(0x12f)],'end_at':_0x1858e2[_0x3675a1(0x124)]}));return await handleSDKOutput(_0x4f3b3b,_0x158fbc),0x0;}}
@@ -1 +1 @@
1
- const a37_0x44b3f5=a37_0x3870;(function(_0x47de8c,_0xe666e){const _0x5d9fc3=a37_0x3870,_0x144684=_0x47de8c();while(!![]){try{const _0x24a0ca=parseInt(_0x5d9fc3(0xa3))/0x1+-parseInt(_0x5d9fc3(0xba))/0x2+parseInt(_0x5d9fc3(0xad))/0x3+parseInt(_0x5d9fc3(0xb5))/0x4+parseInt(_0x5d9fc3(0x108))/0x5*(parseInt(_0x5d9fc3(0x10f))/0x6)+-parseInt(_0x5d9fc3(0x119))/0x7+-parseInt(_0x5d9fc3(0xc7))/0x8*(-parseInt(_0x5d9fc3(0xbb))/0x9);if(_0x24a0ca===_0xe666e)break;else _0x144684['push'](_0x144684['shift']());}catch(_0x2d3000){_0x144684['push'](_0x144684['shift']());}}}(a37_0x154d,0x2c126));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';function a37_0x3870(_0x8141a9,_0x264482){_0x8141a9=_0x8141a9-0x7a;const _0x154dcc=a37_0x154d();let _0x3870a7=_0x154dcc[_0x8141a9];return _0x3870a7;}import a37_0x11382c from'chalk';async function resolveSegmentTarget(_0x565e21,_0x1e3365,_0x591c38){const _0x150a89=a37_0x3870;if(isYamlFilePath(_0x565e21))try{const _0x23fefe=await resolveYamlFilePath(_0x565e21);return _0x591c38&&(console[_0x150a89(0xc9)](_0x150a89(0x93)+_0x565e21),console[_0x150a89(0xc9)](_0x150a89(0x83)+_0x23fefe[_0x150a89(0x107)]),console[_0x150a89(0xc9)](_0x150a89(0x89)+_0x23fefe['segmentName']),console['error'](_0x150a89(0x106)+(_0x23fefe['folderPath']||_0x150a89(0xf0))),console['error']('\x20\x20Full\x20path:\x20'+_0x23fefe[_0x150a89(0xaf)])),_0x23fefe[_0x150a89(0xaf)];}catch(_0x244929){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x150a89(0x92)+_0x244929[_0x150a89(0xe3)]);}if(!_0x1e3365)throw new SDKError(ErrorCode[_0x150a89(0xa9)],_0x150a89(0xc4));return _0x1e3365+'/'+_0x565e21;}function a37_0x154d(){const _0xf9718=['Listing\x20folders\x20for\x20parent\x20\x27','segment:show','red','test','segmentId','getSQLFromYamlFile','130672ZkpnPV','\x27...','Creating\x20folder\x20\x27','Site:\x20','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','INVALID_ARGUMENT','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Fetching\x20SQL\x20for\x20segment...','Resolved\x20type:\x20','981mYxTkv','description','fullPath','Get\x20SQL\x20query\x20for\x20child\x20segment','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','getSQLFromServerSegment','web','segment:sql','218584bmpajC','Target\x20path:\x20','resolveParentId','✔\x20Created\x20folder\x20\x27','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','423422FEEWgk','280683lpYgzH','Create\x20segment\x20folder\x20for\x20organization','stats','Usage:','segment','Usage:\x20tdx\x20segment\x20describe\x20<path>','toLocaleString','segment:folder:list','Resolving\x20\x27','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','24AGILwG','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','error','name','execute','cause','green','processedRows','Fetching\x20parent\x20segment\x20details...','Show\x20segment\x20or\x20folder\x20details','cyan','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','content','Folder\x20name:\x20','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','query','Use:\x20tdx\x20ps\x20show','Folder\x20ID:\x20','getSegmentSQL','✔\x20Query\x20completed:\x20Processed\x20','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','/app/ps/','setJobId','Resolved\x20folder\x20ID:\x20','segment:describe','segment:desc','message','Error:\x20Parent\x20segment\x20name\x20is\x20required','in\x20','segmentName','Error:\x20Folder\x20reference\x20is\x20required','folder','folderId','parentId','Use:\x20tdx\x20ps\x20desc','Fetching\x20folder\x20details...','type','segmentPath','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','(root)','verbose','/e/','json','Executing\x20segment\x20query...','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','Usage:\x20tdx\x20sg\x20desc\x20<name>','Segment\x20ID:\x20','Parent\x20ID:\x20','length','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','code','\x20folder','Show\x20child\x20segment\x20schema\x20(column\x20types)','getSegment','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','parent','segment:folder:show','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','\x20\x20Folder\x20path:\x20','parentSegment','14855wAtbAz','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','listFolders','Show\x20folder\x20or\x20child\x20segment\x20details','Parent\x20segment:\x20','segment:view','312yCkAqe','SEGMENT_FOLDER_NOT_FOUND','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Resolved\x20parent\x20ID:\x20','url','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Use:\x20tdx\x20ps\x20view','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','✖\x20Query\x20failed\x20[','format','290283cebwea','Options:','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','segment:folder:create','elapsedTimeMillis','Resolving\x20parent\x20folder\x20\x27','log','includes','\x20rows\x20','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Use:\x20tdx\x20ps\x20view\x20-w','trim','Resolved\x20parent\x20folder\x20ID:\x20','Parent\x20name:\x20','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','parentFolder','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','getFolder','resolveFolderId','Fetching\x20SQL\x20from\x20rule...','jobId','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','SELECT\x20*\x20FROM\x20(\x0a','\x20Opening\x20','limit','Resolving\x20parent\x20segment\x20\x27','\x20\x20Parent\x20segment:\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Show\x20segment\x20folder\x20details','Usage:\x20tdx\x20sg\x20show\x20<name>','Examples:','\x20\x20Cause:\x20','\x20\x20Segment\x20name:\x20','site','jsonl','Folder\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20sg\x20sql\x20--path\x20','resolvePathToResource','data','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Error:\x20Path\x20or\x20name\x20is\x20required','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Resolved\x20YAML\x20file:\x20','Resolving\x20folder\x20\x27','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Error:\x20','Fetching\x20segment\x20details...','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Resolved\x20relative\x20path\x20to:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','SEGMENT_NOT_FOUND','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'];a37_0x154d=function(){return _0xf9718;};return a37_0x154d();}export class SegmentDescribeCommand extends BaseCommand{[a37_0x44b3f5(0xca)]=a37_0x44b3f5(0xe1);['description']=a37_0x44b3f5(0xd0);async[a37_0x44b3f5(0xcb)](_0x320ec4){const _0x35d381=a37_0x44b3f5,{options:_0x6c3681,args:_0x1b19b1,tdx:_0x535dba}=_0x320ec4,_0xab76a6=_0x1b19b1[0x0],_0x466d85=!_0xab76a6&&!!_0x6c3681[_0x35d381(0x107)],_0x1adfc9=_0xab76a6||_0x6c3681[_0x35d381(0x107)];if(!_0x1adfc9)return console[_0x35d381(0xc9)](_0x35d381(0x91)),console['error'](_0x35d381(0xc0)),console[_0x35d381(0xc9)](_0x35d381(0x87)),console[_0x35d381(0xc9)](_0x35d381(0xa8)),console['error'](_0x35d381(0xb9)),console[_0x35d381(0xc9)](_0x35d381(0x102)),console[_0x35d381(0xc9)](_0x35d381(0xd5)),0x1;try{const _0x5e2b86=_0x6c3681[_0x35d381(0xee)];let _0x946273=_0x1adfc9;!_0x466d85&&_0x5e2b86&&!_0x1adfc9[_0x35d381(0x120)]('/')&&(_0x946273=_0x5e2b86+'/'+_0x1adfc9,_0x6c3681['verbose']&&console['error'](_0x35d381(0x99)+_0x946273));const _0x42d508=await withSpinner('Resolving\x20path\x20\x27'+_0x946273+_0x35d381(0xa4),()=>_0x535dba[_0x35d381(0xbf)]['resolvePathToResource'](_0x946273),{'verbose':_0x6c3681[_0x35d381(0xf1)]}),_0x54c19c=_0x42d508['data'];_0x6c3681[_0x35d381(0xf1)]&&(console[_0x35d381(0xc9)]('Resolved\x20type:\x20'+_0x54c19c['type']),console[_0x35d381(0xc9)]('Parent\x20ID:\x20'+_0x54c19c[_0x35d381(0xea)]),_0x54c19c[_0x35d381(0xe9)]&&console[_0x35d381(0xc9)](_0x35d381(0xda)+_0x54c19c[_0x35d381(0xe9)]),_0x54c19c[_0x35d381(0xa1)]&&console[_0x35d381(0xc9)](_0x35d381(0xf7)+_0x54c19c['segmentId']));if(_0x54c19c[_0x35d381(0xed)]===_0x35d381(0x103)){const _0x47793d=await withSpinner(_0x35d381(0xcf),()=>_0x535dba[_0x35d381(0xbf)]['getParent'](_0x54c19c[_0x35d381(0xea)]),{'verbose':_0x6c3681[_0x35d381(0xf1)]});await handleSingleObjectOutput(_0x47793d[_0x35d381(0x8f)],_0x6c3681);}else{if(_0x54c19c[_0x35d381(0xed)]===_0x35d381(0xe8)){if(!_0x54c19c[_0x35d381(0xe9)])throw new SDKError(ErrorCode[_0x35d381(0x110)],_0x35d381(0x8c));const _0x555efb=await withSpinner(_0x35d381(0xec),()=>_0x535dba[_0x35d381(0xbf)]['getFolder'](_0x54c19c['folderId']),{'verbose':_0x6c3681['verbose']});await handleSingleObjectOutput(_0x555efb[_0x35d381(0x8f)],_0x6c3681);}else{if(_0x54c19c[_0x35d381(0xed)]===_0x35d381(0xbf)){if(!_0x54c19c[_0x35d381(0xa1)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x35d381(0x84));const _0x1aa9a1=await withSpinner(_0x35d381(0x97),()=>_0x535dba[_0x35d381(0xbf)][_0x35d381(0x101)](_0x54c19c['parentId'],_0x54c19c[_0x35d381(0xa1)]),{'verbose':_0x6c3681[_0x35d381(0xf1)]});await handleSingleObjectOutput(_0x1aa9a1[_0x35d381(0x8f)],_0x6c3681);}}}return 0x0;}catch(_0x36fc98){if(_0x36fc98 instanceof SDKError)return console['error'](_0x35d381(0x96)+_0x36fc98['message']),_0x36fc98[_0x35d381(0xcc)]&&console[_0x35d381(0xc9)](_0x35d381(0x88)+_0x36fc98['cause']),0x1;throw _0x36fc98;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x44b3f5(0xca)]=a37_0x44b3f5(0x9e);[a37_0x44b3f5(0xae)]=a37_0x44b3f5(0x7e);async['execute'](_0x521d50){const _0x235113=a37_0x44b3f5,{options:_0x278651,args:_0x33c95a,tdx:_0x54f389}=_0x521d50,_0x3ba88c=_0x33c95a[0x0];if(!_0x3ba88c)return console[_0x235113(0xc9)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x235113(0xc9)](_0x235113(0x86)),console['error'](_0x235113(0x105)),console[_0x235113(0xc9)](_0x235113(0x87)),console['error']('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x235113(0xc9)](_0x235113(0x127)),0x1;try{const _0x10bb29=_0x278651[_0x235113(0x107)],_0x310929=await resolveSegmentTarget(_0x3ba88c,_0x10bb29,_0x278651[_0x235113(0xf1)]);_0x278651['verbose']&&console[_0x235113(0xc9)](_0x235113(0xb6)+_0x310929);const _0x508375=await withSpinner(_0x235113(0xc3)+_0x3ba88c+'\x27...',()=>_0x54f389[_0x235113(0xbf)][_0x235113(0x8e)](_0x310929),{'verbose':_0x278651[_0x235113(0xf1)]}),_0x57879b=_0x508375[_0x235113(0x8f)];_0x278651[_0x235113(0xf1)]&&(console[_0x235113(0xc9)](_0x235113(0xac)+_0x57879b['type']),console[_0x235113(0xc9)](_0x235113(0xf8)+_0x57879b['parentId']));if(_0x57879b['type']==='folder')return console[_0x235113(0xc9)](_0x235113(0x9c)),console[_0x235113(0xc9)](_0x235113(0xb1)),0x1;if(_0x57879b[_0x235113(0xed)]===_0x235113(0x103))return console[_0x235113(0xc9)](_0x235113(0xc6)),console[_0x235113(0xc9)](_0x235113(0xd9)),0x1;if(!_0x57879b[_0x235113(0xa1)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x235113(0x84));const _0x45ce19=await withSpinner(_0x235113(0xab),()=>_0x54f389[_0x235113(0xbf)][_0x235113(0xdb)](_0x57879b[_0x235113(0xea)],_0x57879b[_0x235113(0xa1)]),{'verbose':_0x278651[_0x235113(0xf1)]});let _0x56003d=_0x45ce19['data'];const _0x360e60=resolveLimit(_0x278651[_0x235113(0x81)],DEFAULT_DISPLAY_LIMIT),_0x57d6b9=/\bLIMIT\s+\d+/i[_0x235113(0xa0)](_0x56003d);!_0x57d6b9&&(_0x56003d=_0x56003d[_0x235113(0x124)]()['replace'](/;+$/,''),_0x56003d=_0x235113(0x7f)+_0x56003d+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x360e60);_0x278651['verbose']&&console['error']('SQL\x20query:\x0a'+_0x56003d);const _0x46dacb=await withProgressSpinner(_0x235113(0xf4),async _0x1ec267=>{const _0x44ac1e=_0x235113,_0x4e0998=await _0x54f389[_0x44ac1e(0xd8)][_0x44ac1e(0xcb)](_0x56003d,{'catalog':'td','schema':'information_schema','onJobId':_0x2f39c6=>{const _0x569176=_0x44ac1e;_0x1ec267[_0x569176(0xdf)](_0x2f39c6);}});return _0x4e0998;},{'verbose':_0x278651[_0x235113(0xf1)]}),_0x2c4584=_0x46dacb[_0x235113(0x8f)],_0x3d43d3=_0x2c4584[_0x235113(0x7d)]?'\x20[Job\x20ID:\x20'+_0x2c4584[_0x235113(0x7d)]+']':'';return console['error'](_0x235113(0xdc)+_0x2c4584[_0x235113(0xbd)][_0x235113(0xce)][_0x235113(0xc1)]()+_0x235113(0x121)+(_0x235113(0xe5)+formatElapsed(_0x2c4584[_0x235113(0xbd)][_0x235113(0x11d)])+_0x3d43d3)),await handleQueryOutput(_0x2c4584,_0x278651),0x0;}catch(_0x2fec30){if(_0x2fec30 instanceof SDKError)return console[_0x235113(0xc9)](_0x235113(0x117)+_0x2fec30[_0x235113(0xfe)]+']'),console[_0x235113(0xc9)]('\x0a'+_0x2fec30['message']),0x1;throw _0x2fec30;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x44b3f5(0xca)]=a37_0x44b3f5(0xc2);['description']=a37_0x44b3f5(0x122);async['execute'](_0x351375){const _0x3b6a9f=a37_0x44b3f5,{options:_0x1fea13,args:_0x39be73,tdx:_0x43326e}=_0x351375;if(_0x39be73[_0x3b6a9f(0xf9)]===0x0)return console[_0x3b6a9f(0xc9)](_0x3b6a9f(0xe4)),console[_0x3b6a9f(0xc9)](_0x3b6a9f(0xfc)),0x1;const _0x234748=_0x39be73[0x0];try{_0x1fea13['verbose']&&(console[_0x3b6a9f(0xc9)](_0x3b6a9f(0xa6)+_0x1fea13[_0x3b6a9f(0x8a)]),console['error'](_0x3b6a9f(0x126)+_0x234748));const _0x1e572c=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x234748+'\x27...',()=>_0x43326e[_0x3b6a9f(0xbf)][_0x3b6a9f(0xb7)](_0x234748),{'verbose':_0x1fea13[_0x3b6a9f(0xf1)]}),_0x4df194=_0x1e572c[_0x3b6a9f(0x8f)];_0x1fea13[_0x3b6a9f(0xf1)]&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x4df194);const _0x47d224=await withSpinner(_0x3b6a9f(0x9d)+_0x234748+_0x3b6a9f(0xa4),()=>_0x43326e['segment'][_0x3b6a9f(0x10b)](_0x4df194),{'verbose':_0x1fea13[_0x3b6a9f(0xf1)]}),_0x396988=_0x47d224['data'];return console[_0x3b6a9f(0xc9)]('✔\x20Found\x20'+_0x396988[_0x3b6a9f(0xf9)]+_0x3b6a9f(0xff)+(_0x396988[_0x3b6a9f(0xf9)]!==0x1?'s':'')),await handleSDKOutput(_0x396988,_0x1fea13),0x0;}catch(_0x36ecdf){if(_0x36ecdf instanceof SDKError)return console[_0x3b6a9f(0xc9)](_0x3b6a9f(0x96)+_0x36ecdf[_0x3b6a9f(0xe3)]),_0x36ecdf[_0x3b6a9f(0xcc)]&&console[_0x3b6a9f(0xc9)](_0x3b6a9f(0x88)+_0x36ecdf[_0x3b6a9f(0xcc)]),0x1;throw _0x36ecdf;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x44b3f5(0xca)]=a37_0x44b3f5(0x104);[a37_0x44b3f5(0xae)]=a37_0x44b3f5(0x85);async[a37_0x44b3f5(0xcb)](_0x450b47){const _0x12cf15=a37_0x44b3f5,{options:_0x22e8c7,args:_0x2f2bbc,tdx:_0x47b1bf}=_0x450b47;if(_0x2f2bbc[_0x12cf15(0xf9)]===0x0)return console['error'](_0x12cf15(0xe7)),console[_0x12cf15(0xc9)](_0x12cf15(0xdd)),0x1;try{const {parentId:_0x34a756,childId:_0x50766a}=parseSegmentRef(_0x2f2bbc[0x0]);_0x22e8c7[_0x12cf15(0xf1)]&&(console[_0x12cf15(0xc9)](_0x12cf15(0xa6)+_0x22e8c7[_0x12cf15(0x8a)]),console[_0x12cf15(0xc9)](_0x12cf15(0x126)+_0x34a756),_0x50766a&&console[_0x12cf15(0xc9)](_0x12cf15(0xd4)+_0x50766a));if(!_0x50766a)return console['error'](_0x12cf15(0xa7)),0x1;const _0x4c4b16=await withSpinner(_0x12cf15(0x82)+_0x34a756+_0x12cf15(0xa4),()=>_0x47b1bf[_0x12cf15(0xbf)][_0x12cf15(0xb7)](_0x34a756),{'verbose':_0x22e8c7[_0x12cf15(0xf1)]}),_0x586529=_0x4c4b16[_0x12cf15(0x8f)];_0x22e8c7[_0x12cf15(0xf1)]&&console[_0x12cf15(0xc9)](_0x12cf15(0x112)+_0x586529);const _0x431f53=await withSpinner(_0x12cf15(0x94)+_0x50766a+_0x12cf15(0xa4),()=>_0x47b1bf[_0x12cf15(0xbf)][_0x12cf15(0x7b)](_0x586529,_0x50766a),{'verbose':_0x22e8c7[_0x12cf15(0xf1)]}),_0x454180=_0x431f53[_0x12cf15(0x8f)];_0x22e8c7[_0x12cf15(0xf1)]&&console[_0x12cf15(0xc9)](_0x12cf15(0xe0)+_0x454180);const _0x5f3014=await withSpinner('Fetching\x20folder\x20\x27'+_0x50766a+_0x12cf15(0xa4),()=>_0x47b1bf['segment'][_0x12cf15(0x7a)](_0x454180),{'verbose':_0x22e8c7[_0x12cf15(0xf1)]});return await handleSDKOutput([_0x5f3014[_0x12cf15(0x8f)]],_0x22e8c7),0x0;}catch(_0x323038){if(_0x323038 instanceof SDKError)return console[_0x12cf15(0xc9)]('Error:\x20'+_0x323038['message']),_0x323038[_0x12cf15(0xcc)]&&console[_0x12cf15(0xc9)]('\x20\x20Cause:\x20'+_0x323038[_0x12cf15(0xcc)]),0x1;throw _0x323038;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x44b3f5(0xca)]=a37_0x44b3f5(0xb4);[a37_0x44b3f5(0xae)]=a37_0x44b3f5(0xb0);async['execute'](_0x3031b5){const _0x3ae8ab=a37_0x44b3f5,{options:_0x5185ec,args:_0x4580f4}=_0x3031b5,_0x225437=_0x5185ec,_0x4b3b31=_0x225437['path'],_0x24e991=_0x4580f4[0x0];if(!_0x24e991&&!_0x4b3b31)return console[_0x3ae8ab(0xc9)](a37_0x11382c[_0x3ae8ab(0x9f)](_0x3ae8ab(0xd7))),console[_0x3ae8ab(0xc9)](_0x3ae8ab(0xbe)),console[_0x3ae8ab(0xc9)]('\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>'),console[_0x3ae8ab(0xc9)](_0x3ae8ab(0x11b)),console[_0x3ae8ab(0xc9)](_0x3ae8ab(0x87)),console[_0x3ae8ab(0xc9)]('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x3ae8ab(0xc9)](_0x3ae8ab(0x109)),0x1;if(_0x24e991&&_0x4b3b31)return console[_0x3ae8ab(0xc9)](a37_0x11382c[_0x3ae8ab(0x9f)](_0x3ae8ab(0x10a))),0x1;try{let _0x4d3adc;if(_0x4b3b31)_0x4d3adc=await this[_0x3ae8ab(0xa2)](_0x4b3b31,_0x3031b5);else{if(isYamlFilePath(_0x24e991))return console[_0x3ae8ab(0xc9)](a37_0x11382c['red'](_0x3ae8ab(0xf5))),console[_0x3ae8ab(0xc9)](_0x3ae8ab(0x8d)+_0x24e991),0x1;else _0x4d3adc=await this['getSQLFromServerSegment'](_0x24e991,_0x3031b5);}return _0x5185ec[_0x3ae8ab(0x118)]===_0x3ae8ab(0xf3)||_0x5185ec[_0x3ae8ab(0x118)]===_0x3ae8ab(0x8b)?await handleSDKOutput([{'sql':_0x4d3adc}],_0x5185ec):console[_0x3ae8ab(0x11f)](_0x4d3adc),0x0;}catch(_0x25fa9e){if(_0x25fa9e instanceof SDKError)return console['error']('Error:\x20'+_0x25fa9e[_0x3ae8ab(0xe3)]),_0x25fa9e[_0x3ae8ab(0xcc)]&&console[_0x3ae8ab(0xc9)](_0x3ae8ab(0x88)+_0x25fa9e[_0x3ae8ab(0xcc)]),0x1;throw _0x25fa9e;}}async[a37_0x44b3f5(0xa2)](_0x4d9cd4,_0x3f8fa6){const _0x47b7c8=a37_0x44b3f5,{options:_0x21f42f,tdx:_0x58eb22}=_0x3f8fa6;let _0x319f4a;try{_0x319f4a=await resolveYamlFilePath(_0x4d9cd4);}catch(_0x5ef30d){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x5ef30d[_0x47b7c8(0xe3)]);}_0x21f42f[_0x47b7c8(0xf1)]&&console['error']('Resolved:\x20'+_0x319f4a[_0x47b7c8(0x107)]+'/'+_0x319f4a[_0x47b7c8(0xe6)]);const _0x3ee19e=await withSpinner(_0x47b7c8(0x7c),()=>_0x58eb22[_0x47b7c8(0xbf)]['getSegmentSQLFromYaml'](_0x319f4a[_0x47b7c8(0xd3)],_0x319f4a[_0x47b7c8(0x107)],_0x319f4a[_0x47b7c8(0xe6)]),{'verbose':_0x21f42f[_0x47b7c8(0xf1)]});return _0x3ee19e[_0x47b7c8(0x8f)];}async[a37_0x44b3f5(0xb2)](_0x491273,_0x3922b1){const _0x3f36d1=a37_0x44b3f5,{options:_0x1b80cf,tdx:_0x3c48c5}=_0x3922b1,_0x17cbed=_0x1b80cf[_0x3f36d1(0x107)],_0x5f43a6=await resolveSegmentTarget(_0x491273,_0x17cbed,_0x1b80cf[_0x3f36d1(0xf1)]);_0x1b80cf[_0x3f36d1(0xf1)]&&console['error'](_0x3f36d1(0xb6)+_0x5f43a6);const _0x53291b=await withSpinner('Resolving\x20\x27'+_0x491273+_0x3f36d1(0xa4),()=>_0x3c48c5[_0x3f36d1(0xbf)][_0x3f36d1(0x8e)](_0x5f43a6),{'verbose':_0x1b80cf[_0x3f36d1(0xf1)]}),_0x3ba79c=_0x53291b[_0x3f36d1(0x8f)];_0x1b80cf[_0x3f36d1(0xf1)]&&(console['error'](_0x3f36d1(0xac)+_0x3ba79c[_0x3f36d1(0xed)]),console[_0x3f36d1(0xc9)]('Parent\x20ID:\x20'+_0x3ba79c[_0x3f36d1(0xea)]));if(_0x3ba79c[_0x3f36d1(0xed)]==='folder')throw new SDKError(ErrorCode[_0x3f36d1(0xa9)],_0x3f36d1(0x129));if(_0x3ba79c[_0x3f36d1(0xed)]===_0x3f36d1(0x103))throw new SDKError(ErrorCode[_0x3f36d1(0xa9)],_0x3f36d1(0xef));if(!_0x3ba79c[_0x3f36d1(0xa1)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x3f36d1(0x84));const _0x30f3e5=await withSpinner(_0x3f36d1(0xab),()=>_0x3c48c5[_0x3f36d1(0xbf)]['getSegmentSQL'](_0x3ba79c[_0x3f36d1(0xea)],_0x3ba79c[_0x3f36d1(0xa1)]),{'verbose':_0x1b80cf['verbose']});return _0x30f3e5[_0x3f36d1(0x8f)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x44b3f5(0xca)]=a37_0x44b3f5(0x11c);[a37_0x44b3f5(0xae)]=a37_0x44b3f5(0xbc);async[a37_0x44b3f5(0xcb)](_0xbdf59d){const _0x26d8b4=a37_0x44b3f5,{options:_0x458c7d,args:_0x10e064,tdx:_0x1b94e2}=_0xbdf59d,_0x58f4cc=_0x458c7d;if(_0x10e064['length']<0x2)return console[_0x26d8b4(0xc9)](_0x26d8b4(0xc8)),console[_0x26d8b4(0xc9)](_0x26d8b4(0x95)),0x1;const _0x5fb390=_0x10e064[0x0],_0x40e88b=_0x10e064[0x1];_0x58f4cc[_0x26d8b4(0xf1)]&&(console['error'](_0x26d8b4(0xa6)+_0x58f4cc[_0x26d8b4(0x8a)]),console[_0x26d8b4(0xc9)](_0x26d8b4(0x10d)+_0x5fb390),console[_0x26d8b4(0xc9)](_0x26d8b4(0xd4)+_0x40e88b));let _0x448bae;if(_0x58f4cc[_0x26d8b4(0x128)]){const _0x30665d=_0x58f4cc['parentFolder'],_0x3d8dd3=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5fb390+'\x27...',()=>_0x1b94e2[_0x26d8b4(0xbf)]['resolveParentId'](_0x5fb390),{'verbose':_0x58f4cc['verbose']}),_0x132c45=_0x3d8dd3[_0x26d8b4(0x8f)],_0xad0727=await withSpinner(_0x26d8b4(0x11e)+_0x30665d+_0x26d8b4(0xa4),()=>_0x1b94e2[_0x26d8b4(0xbf)]['resolveFolderId'](_0x132c45,_0x30665d),{'verbose':_0x58f4cc[_0x26d8b4(0xf1)]});_0x448bae=_0xad0727[_0x26d8b4(0x8f)],_0x58f4cc['verbose']&&console[_0x26d8b4(0xc9)](_0x26d8b4(0x125)+_0x448bae);}const _0x32b9f4={'name':_0x40e88b,'description':_0x58f4cc['description'],'parentFolderId':_0x448bae},_0x3529e5=await withSpinner(_0x26d8b4(0xa5)+_0x40e88b+_0x26d8b4(0xa4),()=>_0x1b94e2['segment']['createFolder'](_0x5fb390,_0x32b9f4),{'verbose':_0x58f4cc[_0x26d8b4(0xf1)]}),_0x91a67e=_0x3529e5['data'];return console['error'](_0x26d8b4(0xb8)+_0x91a67e['name']+'\x27\x20with\x20ID:\x20'+_0x91a67e['id']),await handleSDKOutput([_0x91a67e],_0x58f4cc),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x44b3f5(0xca)]=a37_0x44b3f5(0x10e);[a37_0x44b3f5(0xae)]=a37_0x44b3f5(0x10c);async[a37_0x44b3f5(0xcb)](_0x5279ea){const _0x115479=a37_0x44b3f5,{options:_0x21e5f9,args:_0x30578b,tdx:_0x244201}=_0x5279ea,_0x5d8cf9=_0x30578b[0x0];if(!_0x5d8cf9)return console['error']('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x115479(0xc9)](_0x115479(0x90)),console['error'](_0x115479(0x9a)),console[_0x115479(0xc9)](_0x115479(0x11a)),console[_0x115479(0xc9)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x115479(0xc9)](_0x115479(0x87)),console[_0x115479(0xc9)](_0x115479(0xd2)),console['error'](_0x115479(0x114)),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console['error']('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0xcc271f=_0x21e5f9[_0x115479(0x107)],_0x6a3e89=await resolveSegmentTarget(_0x5d8cf9,_0xcc271f,_0x21e5f9[_0x115479(0xf1)]);_0x21e5f9[_0x115479(0xf1)]&&console[_0x115479(0xc9)]('Target\x20path:\x20'+_0x6a3e89);const _0x3d589c=await withSpinner('Resolving\x20\x27'+_0x5d8cf9+_0x115479(0xa4),()=>_0x244201[_0x115479(0xbf)][_0x115479(0x8e)](_0x6a3e89),{'verbose':_0x21e5f9[_0x115479(0xf1)]}),_0x8d1464=_0x3d589c['data'];_0x21e5f9[_0x115479(0xf1)]&&(console['error'](_0x115479(0xac)+_0x8d1464[_0x115479(0xed)]),console[_0x115479(0xc9)]('Parent\x20ID:\x20'+_0x8d1464[_0x115479(0xea)]),_0x8d1464[_0x115479(0xe9)]&&console[_0x115479(0xc9)](_0x115479(0xda)+_0x8d1464[_0x115479(0xe9)]),_0x8d1464['segmentId']&&console[_0x115479(0xc9)](_0x115479(0xf7)+_0x8d1464['segmentId']));if(_0x21e5f9[_0x115479(0xb3)]){if(_0x8d1464[_0x115479(0xed)]===_0x115479(0xe8))return console['error']('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x8d1464[_0x115479(0xed)]===_0x115479(0x103))return console[_0x115479(0xc9)](_0x115479(0xfd)),console[_0x115479(0xc9)](_0x115479(0x123)),0x1;if(!_0x8d1464[_0x115479(0xa1)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x115479(0x84));const _0x479a2e=getConsoleNextUrl(_0x21e5f9[_0x115479(0x8a)],'/app/ps/'+_0x8d1464['parentId']+_0x115479(0xf2)+_0x8d1464['segmentId']);return console[_0x115479(0xc9)](a37_0x11382c[_0x115479(0xcd)]('✔')+_0x115479(0x80)+a37_0x11382c[_0x115479(0xd1)](_0x479a2e)),openBrowser(_0x479a2e),0x0;}if(_0x8d1464[_0x115479(0xed)]==='folder'){if(!_0x8d1464[_0x115479(0xe9)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x115479(0x8c));const _0x3249c8=await withSpinner('Fetching\x20folder\x20details...',()=>_0x244201['segment'][_0x115479(0x7a)](_0x8d1464[_0x115479(0xe9)]),{'verbose':_0x21e5f9['verbose']});await handleSingleObjectOutput(_0x3249c8['data'],_0x21e5f9);}else{if(_0x8d1464['type']==='segment'){if(!_0x8d1464['segmentId'])throw new SDKError(ErrorCode[_0x115479(0x9b)],_0x115479(0x84));const _0x166b43=await withSpinner(_0x115479(0x97),()=>_0x244201[_0x115479(0xbf)]['getSegment'](_0x8d1464[_0x115479(0xea)],_0x8d1464['segmentId']),{'verbose':_0x21e5f9[_0x115479(0xf1)]}),_0x5697a9=getConsoleNextUrl(_0x21e5f9['site'],_0x115479(0xde)+_0x8d1464[_0x115479(0xea)]+'/e/'+_0x8d1464[_0x115479(0xa1)]),_0x55d2b5=_0x166b43[_0x115479(0x8f)];_0x55d2b5[_0x115479(0x113)]=_0x5697a9,await handleSingleObjectOutput(_0x55d2b5,_0x21e5f9);}else return console[_0x115479(0xc9)](_0x115479(0xfb)),console[_0x115479(0xc9)](_0x115479(0x115)),0x1;}return 0x0;}catch(_0x2faaf9){if(_0x2faaf9 instanceof SDKError)return console['error'](_0x115479(0x96)+_0x2faaf9[_0x115479(0xe3)]),_0x2faaf9[_0x115479(0xcc)]&&console[_0x115479(0xc9)](_0x115479(0x88)+_0x2faaf9[_0x115479(0xcc)]),0x1;throw _0x2faaf9;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']=a37_0x44b3f5(0xe2);[a37_0x44b3f5(0xae)]=a37_0x44b3f5(0x100);async[a37_0x44b3f5(0xcb)](_0x504d4c){const _0x389c8d=a37_0x44b3f5,{options:_0x30b8f3,args:_0x14ec3c,tdx:_0x3477f7}=_0x504d4c,_0x5f5012=_0x14ec3c[0x0];if(!_0x5f5012)return console['error'](_0x389c8d(0xaa)),console[_0x389c8d(0xc9)](_0x389c8d(0xf6)),console[_0x389c8d(0xc9)](_0x389c8d(0xd6)),console[_0x389c8d(0xc9)](_0x389c8d(0x87)),console[_0x389c8d(0xc9)](_0x389c8d(0x116)),console[_0x389c8d(0xc9)](_0x389c8d(0xfa)),0x1;try{const _0x3c530a=_0x30b8f3['parentSegment'],_0x2e202c=await resolveSegmentTarget(_0x5f5012,_0x3c530a,_0x30b8f3[_0x389c8d(0xf1)]);_0x30b8f3[_0x389c8d(0xf1)]&&console[_0x389c8d(0xc9)](_0x389c8d(0xb6)+_0x2e202c);const _0x4cdbad=await withSpinner('Resolving\x20\x27'+_0x5f5012+_0x389c8d(0xa4),()=>_0x3477f7['segment'][_0x389c8d(0x8e)](_0x2e202c),{'verbose':_0x30b8f3[_0x389c8d(0xf1)]}),_0x4e15d3=_0x4cdbad['data'];_0x30b8f3['verbose']&&(console[_0x389c8d(0xc9)](_0x389c8d(0xac)+_0x4e15d3['type']),console[_0x389c8d(0xc9)](_0x389c8d(0xf8)+_0x4e15d3['parentId']));if(_0x4e15d3[_0x389c8d(0xed)]===_0x389c8d(0xe8))return console[_0x389c8d(0xc9)](_0x389c8d(0xc5)),console[_0x389c8d(0xc9)](_0x389c8d(0x111)),0x1;if(_0x4e15d3['type']===_0x389c8d(0x103))return console['error'](_0x389c8d(0x98)),console[_0x389c8d(0xc9)](_0x389c8d(0xeb)),0x1;if(!_0x4e15d3['segmentId'])throw new SDKError(ErrorCode[_0x389c8d(0x9b)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x25d405=await withSpinner(_0x389c8d(0xab),()=>_0x3477f7[_0x389c8d(0xbf)][_0x389c8d(0xdb)](_0x4e15d3[_0x389c8d(0xea)],_0x4e15d3[_0x389c8d(0xa1)]),{'verbose':_0x30b8f3['verbose']}),_0x4713d1=_0x25d405['data'],_0x19dd7b=await executeSchemaQuery(_0x4713d1,_0x3477f7,_0x30b8f3);return await handleQueryOutput(_0x19dd7b,_0x30b8f3),0x0;}catch(_0x449514){if(_0x449514 instanceof SDKError)return console[_0x389c8d(0xc9)](_0x389c8d(0x96)+_0x449514[_0x389c8d(0xe3)]),_0x449514[_0x389c8d(0xcc)]&&console[_0x389c8d(0xc9)](_0x389c8d(0x88)+_0x449514[_0x389c8d(0xcc)]),0x1;throw _0x449514;}}}
1
+ const a37_0xfb19a1=a37_0x2221;(function(_0x5390b9,_0x16f7f8){const _0x104298=a37_0x2221,_0x440e9e=_0x5390b9();while(!![]){try{const _0x485c66=parseInt(_0x104298(0x1f1))/0x1+parseInt(_0x104298(0x1b0))/0x2+-parseInt(_0x104298(0x23c))/0x3+parseInt(_0x104298(0x219))/0x4*(-parseInt(_0x104298(0x1c1))/0x5)+parseInt(_0x104298(0x1b4))/0x6*(parseInt(_0x104298(0x1db))/0x7)+-parseInt(_0x104298(0x21a))/0x8*(parseInt(_0x104298(0x1e3))/0x9)+parseInt(_0x104298(0x1ad))/0xa;if(_0x485c66===_0x16f7f8)break;else _0x440e9e['push'](_0x440e9e['shift']());}catch(_0x39e7d6){_0x440e9e['push'](_0x440e9e['shift']());}}}(a37_0x243a,0x9b606));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0x57c980 from'chalk';async function resolveSegmentTarget(_0x7d6104,_0x2504e3,_0x12721d){const _0x5ce0c5=a37_0x2221;if(isYamlFilePath(_0x7d6104))try{const _0x263e71=await resolveYamlFilePath(_0x7d6104);return _0x12721d&&(console[_0x5ce0c5(0x22f)](_0x5ce0c5(0x20a)+_0x7d6104),console[_0x5ce0c5(0x22f)](_0x5ce0c5(0x218)+_0x263e71[_0x5ce0c5(0x1ae)]),console['error'](_0x5ce0c5(0x1e7)+_0x263e71[_0x5ce0c5(0x1fc)]),console['error'](_0x5ce0c5(0x245)+(_0x263e71[_0x5ce0c5(0x21b)]||_0x5ce0c5(0x1e9))),console[_0x5ce0c5(0x22f)](_0x5ce0c5(0x1cf)+_0x263e71[_0x5ce0c5(0x1dc)])),_0x263e71[_0x5ce0c5(0x1dc)];}catch(_0x571676){throw new SDKError(ErrorCode[_0x5ce0c5(0x1ef)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x571676[_0x5ce0c5(0x251)]);}if(!_0x2504e3)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x2504e3+'/'+_0x7d6104;}export class SegmentDescribeCommand extends BaseCommand{[a37_0xfb19a1(0x209)]='segment:describe';[a37_0xfb19a1(0x1b1)]='Show\x20segment\x20or\x20folder\x20details';async[a37_0xfb19a1(0x1bf)](_0x2de510){const _0x2a3c21=a37_0xfb19a1,{options:_0x2cb654,args:_0x1f0ec7,tdx:_0x41085d}=_0x2de510,_0xf27fe=_0x1f0ec7[0x0],_0x486cd2=!_0xf27fe&&!!_0x2cb654[_0x2a3c21(0x1ae)],_0x30132d=_0xf27fe||_0x2cb654[_0x2a3c21(0x1ae)];if(!_0x30132d)return console[_0x2a3c21(0x22f)](_0x2a3c21(0x242)),console[_0x2a3c21(0x22f)](_0x2a3c21(0x208)),console[_0x2a3c21(0x22f)](_0x2a3c21(0x1b5)),console[_0x2a3c21(0x22f)](_0x2a3c21(0x223)),console[_0x2a3c21(0x22f)](_0x2a3c21(0x1fb)),console[_0x2a3c21(0x22f)](_0x2a3c21(0x1e1)),console[_0x2a3c21(0x22f)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0x18f354=_0x2cb654['segmentPath'];let _0x300a04=_0x30132d;!_0x486cd2&&_0x18f354&&!_0x30132d['includes']('/')&&(_0x300a04=_0x18f354+'/'+_0x30132d,_0x2cb654[_0x2a3c21(0x1d5)]&&console[_0x2a3c21(0x22f)](_0x2a3c21(0x1ce)+_0x300a04));const _0x5e2951=await withSpinner(_0x2a3c21(0x1ed)+_0x300a04+_0x2a3c21(0x205),()=>_0x41085d['segment'][_0x2a3c21(0x24f)](_0x300a04),{'verbose':_0x2cb654[_0x2a3c21(0x1d5)]}),_0x69de25=_0x5e2951[_0x2a3c21(0x257)];_0x2cb654[_0x2a3c21(0x1d5)]&&(console[_0x2a3c21(0x22f)](_0x2a3c21(0x20e)+_0x69de25[_0x2a3c21(0x1af)]),console[_0x2a3c21(0x22f)]('Parent\x20ID:\x20'+_0x69de25[_0x2a3c21(0x1c8)]),_0x69de25[_0x2a3c21(0x201)]&&console[_0x2a3c21(0x22f)](_0x2a3c21(0x256)+_0x69de25[_0x2a3c21(0x201)]),_0x69de25[_0x2a3c21(0x253)]&&console[_0x2a3c21(0x22f)](_0x2a3c21(0x1c0)+_0x69de25['segmentId']));if(_0x69de25[_0x2a3c21(0x1af)]==='parent'){const _0x32f4ed=await withSpinner(_0x2a3c21(0x247),()=>_0x41085d[_0x2a3c21(0x227)][_0x2a3c21(0x225)](_0x69de25[_0x2a3c21(0x1c8)]),{'verbose':_0x2cb654[_0x2a3c21(0x1d5)]});await handleSingleObjectOutput(_0x32f4ed[_0x2a3c21(0x257)],_0x2cb654);}else{if(_0x69de25[_0x2a3c21(0x1af)]===_0x2a3c21(0x238)){if(!_0x69de25[_0x2a3c21(0x201)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x2a3c21(0x211));const _0x55257b=await withSpinner(_0x2a3c21(0x204),()=>_0x41085d[_0x2a3c21(0x227)][_0x2a3c21(0x254)](_0x69de25[_0x2a3c21(0x201)]),{'verbose':_0x2cb654['verbose']});await handleSingleObjectOutput(_0x55257b['data'],_0x2cb654);}else{if(_0x69de25[_0x2a3c21(0x1af)]===_0x2a3c21(0x227)){if(!_0x69de25[_0x2a3c21(0x253)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x2a3c21(0x1d6));const _0x39ad57=await withSpinner(_0x2a3c21(0x1c2),()=>_0x41085d[_0x2a3c21(0x227)][_0x2a3c21(0x1bd)](_0x69de25[_0x2a3c21(0x1c8)],_0x69de25[_0x2a3c21(0x253)]),{'verbose':_0x2cb654[_0x2a3c21(0x1d5)]});await handleSingleObjectOutput(_0x39ad57['data'],_0x2cb654);}}}return 0x0;}catch(_0x509aaa){if(_0x509aaa instanceof SDKError)return console[_0x2a3c21(0x22f)](_0x2a3c21(0x1d7)+_0x509aaa['message']),_0x509aaa['cause']&&console['error'](_0x2a3c21(0x233)+_0x509aaa[_0x2a3c21(0x22e)]),0x1;throw _0x509aaa;}}}export class SegmentShowCommand extends BaseCommand{[a37_0xfb19a1(0x209)]='segment:show';[a37_0xfb19a1(0x1b1)]=a37_0xfb19a1(0x20b);async['execute'](_0x29aad7){const _0x3ddd9d=a37_0xfb19a1,{options:_0xe8204a,args:_0x3d40ee,tdx:_0x229b62}=_0x29aad7,_0xaf202a=_0x3d40ee[0x0];if(!_0xaf202a)return console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x206)),console[_0x3ddd9d(0x22f)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console['error'](_0x3ddd9d(0x224)),console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x1b5)),console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x1e8)),console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x1ba)),0x1;try{const _0xd2f64d=_0xe8204a[_0x3ddd9d(0x1ae)],_0x43e162=await resolveSegmentTarget(_0xaf202a,_0xd2f64d,_0xe8204a[_0x3ddd9d(0x1d5)]);_0xe8204a[_0x3ddd9d(0x1d5)]&&console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x20c)+_0x43e162);const _0x5e288a=await withSpinner(_0x3ddd9d(0x1c6)+_0xaf202a+_0x3ddd9d(0x205),()=>_0x229b62[_0x3ddd9d(0x227)][_0x3ddd9d(0x24f)](_0x43e162),{'verbose':_0xe8204a['verbose']}),_0x2e5195=_0x5e288a[_0x3ddd9d(0x257)];_0xe8204a['verbose']&&(console['error'](_0x3ddd9d(0x20e)+_0x2e5195[_0x3ddd9d(0x1af)]),console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x1ee)+_0x2e5195[_0x3ddd9d(0x1c8)]));if(_0x2e5195['type']===_0x3ddd9d(0x238))return console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x216)),console[_0x3ddd9d(0x22f)]('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x2e5195[_0x3ddd9d(0x1af)]==='parent')return console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x1fe)),console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x200)),0x1;if(!_0x2e5195[_0x3ddd9d(0x253)])throw new SDKError(ErrorCode[_0x3ddd9d(0x1e5)],_0x3ddd9d(0x1d6));const _0x94b60d=await withSpinner(_0x3ddd9d(0x1f4),()=>_0x229b62[_0x3ddd9d(0x227)][_0x3ddd9d(0x207)](_0x2e5195['parentId'],_0x2e5195[_0x3ddd9d(0x253)]),{'verbose':_0xe8204a['verbose']});let _0x26aed1=_0x94b60d['data'];const _0x595d00=resolveLimit(_0xe8204a[_0x3ddd9d(0x1cc)],DEFAULT_DISPLAY_LIMIT),_0x2ba99d=/\bLIMIT\s+\d+/i['test'](_0x26aed1);!_0x2ba99d&&(_0x26aed1=_0x26aed1['trim']()[_0x3ddd9d(0x244)](/;+$/,''),_0x26aed1=_0x3ddd9d(0x21c)+_0x26aed1+_0x3ddd9d(0x246)+_0x595d00);_0xe8204a['verbose']&&console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x237)+_0x26aed1);const _0x20c079=await withProgressSpinner(_0x3ddd9d(0x221),async _0xb1d487=>{const _0x43f7ad=_0x3ddd9d,_0x52f365=await _0x229b62[_0x43f7ad(0x23f)][_0x43f7ad(0x1bf)](_0x26aed1,{'catalog':'td','schema':_0x43f7ad(0x1c9),'onJobId':_0x26b4d6=>{_0xb1d487['setJobId'](_0x26b4d6);}});return _0x52f365;},{'verbose':_0xe8204a[_0x3ddd9d(0x1d5)]}),_0x587018=_0x20c079[_0x3ddd9d(0x257)],_0xf2ed08=_0x587018[_0x3ddd9d(0x1f3)]?'\x20[Job\x20ID:\x20'+_0x587018[_0x3ddd9d(0x1f3)]+']':'';return console['error'](_0x3ddd9d(0x222)+_0x587018[_0x3ddd9d(0x229)][_0x3ddd9d(0x1f5)][_0x3ddd9d(0x1c5)]()+_0x3ddd9d(0x20d)+(_0x3ddd9d(0x1ec)+formatElapsed(_0x587018[_0x3ddd9d(0x229)][_0x3ddd9d(0x202)])+_0xf2ed08)),await handleQueryOutput(_0x587018,_0xe8204a),0x0;}catch(_0x4908fb){if(_0x4908fb instanceof SDKError)return console[_0x3ddd9d(0x22f)]('✖\x20Query\x20failed\x20['+_0x4908fb['code']+']'),console[_0x3ddd9d(0x22f)]('\x0a'+_0x4908fb[_0x3ddd9d(0x251)]),0x1;throw _0x4908fb;}}}function a37_0x2221(_0x272921,_0x1d4199){_0x272921=_0x272921-0x1ad;const _0x243a7c=a37_0x243a();let _0x2221a5=_0x243a7c[_0x272921];return _0x2221a5;}export class SegmentFolderListCommand extends BaseCommand{[a37_0xfb19a1(0x209)]=a37_0xfb19a1(0x235);[a37_0xfb19a1(0x1b1)]=a37_0xfb19a1(0x1de);async[a37_0xfb19a1(0x1bf)](_0x3fab1f){const _0x4d45db=a37_0xfb19a1,{options:_0x4d8b6a,args:_0x29790d,tdx:_0x43d762}=_0x3fab1f;if(_0x29790d['length']===0x0)return console[_0x4d45db(0x22f)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x4d45db(0x22f)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x1d29cf=_0x29790d[0x0];try{_0x4d8b6a[_0x4d45db(0x1d5)]&&(console[_0x4d45db(0x22f)]('Site:\x20'+_0x4d8b6a[_0x4d45db(0x226)]),console[_0x4d45db(0x22f)]('Parent\x20name:\x20'+_0x1d29cf));const _0x465959=await withSpinner(_0x4d45db(0x1e4)+_0x1d29cf+_0x4d45db(0x205),()=>_0x43d762[_0x4d45db(0x227)][_0x4d45db(0x255)](_0x1d29cf),{'verbose':_0x4d8b6a[_0x4d45db(0x1d5)]}),_0xa2836f=_0x465959[_0x4d45db(0x257)];_0x4d8b6a[_0x4d45db(0x1d5)]&&console[_0x4d45db(0x22f)](_0x4d45db(0x1fd)+_0xa2836f);const _0x4fa309=await withSpinner(_0x4d45db(0x252)+_0x1d29cf+_0x4d45db(0x205),()=>_0x43d762['segment'][_0x4d45db(0x1e0)](_0xa2836f),{'verbose':_0x4d8b6a['verbose']}),_0x5aa488=_0x4fa309[_0x4d45db(0x257)];return console[_0x4d45db(0x22f)](_0x4d45db(0x24a)+_0x5aa488[_0x4d45db(0x1b9)]+_0x4d45db(0x213)+(_0x5aa488[_0x4d45db(0x1b9)]!==0x1?'s':'')),await handleSDKOutput(_0x5aa488,_0x4d8b6a),0x0;}catch(_0x4fff28){if(_0x4fff28 instanceof SDKError)return console[_0x4d45db(0x22f)](_0x4d45db(0x1d7)+_0x4fff28['message']),_0x4fff28[_0x4d45db(0x22e)]&&console[_0x4d45db(0x22f)](_0x4d45db(0x233)+_0x4fff28[_0x4d45db(0x22e)]),0x1;throw _0x4fff28;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0xfb19a1(0x209)]='segment:folder:show';[a37_0xfb19a1(0x1b1)]='Show\x20segment\x20folder\x20details';async[a37_0xfb19a1(0x1bf)](_0x2fff99){const _0x1e8bea=a37_0xfb19a1,{options:_0x336c81,args:_0xc5ed19,tdx:_0x5cb48f}=_0x2fff99;if(_0xc5ed19[_0x1e8bea(0x1b9)]===0x0)return console[_0x1e8bea(0x22f)]('Error:\x20Folder\x20reference\x20is\x20required'),console['error'](_0x1e8bea(0x228)),0x1;try{const {parentId:_0x33b596,childId:_0x12cdbd}=parseSegmentRef(_0xc5ed19[0x0]);_0x336c81[_0x1e8bea(0x1d5)]&&(console['error'](_0x1e8bea(0x220)+_0x336c81[_0x1e8bea(0x226)]),console[_0x1e8bea(0x22f)](_0x1e8bea(0x1b8)+_0x33b596),_0x12cdbd&&console[_0x1e8bea(0x22f)](_0x1e8bea(0x1bc)+_0x12cdbd));if(!_0x12cdbd)return console[_0x1e8bea(0x22f)](_0x1e8bea(0x1bb)),0x1;const _0x15af19=await withSpinner(_0x1e8bea(0x1e4)+_0x33b596+_0x1e8bea(0x205),()=>_0x5cb48f[_0x1e8bea(0x227)][_0x1e8bea(0x255)](_0x33b596),{'verbose':_0x336c81[_0x1e8bea(0x1d5)]}),_0x353fc1=_0x15af19[_0x1e8bea(0x257)];_0x336c81['verbose']&&console[_0x1e8bea(0x22f)]('Resolved\x20parent\x20ID:\x20'+_0x353fc1);const _0x282c58=await withSpinner(_0x1e8bea(0x236)+_0x12cdbd+_0x1e8bea(0x205),()=>_0x5cb48f[_0x1e8bea(0x227)][_0x1e8bea(0x239)](_0x353fc1,_0x12cdbd),{'verbose':_0x336c81[_0x1e8bea(0x1d5)]}),_0x1898ca=_0x282c58[_0x1e8bea(0x257)];_0x336c81['verbose']&&console[_0x1e8bea(0x22f)](_0x1e8bea(0x1d2)+_0x1898ca);const _0x5087a7=await withSpinner(_0x1e8bea(0x1d1)+_0x12cdbd+'\x27...',()=>_0x5cb48f['segment'][_0x1e8bea(0x254)](_0x1898ca),{'verbose':_0x336c81[_0x1e8bea(0x1d5)]});return await handleSDKOutput([_0x5087a7['data']],_0x336c81),0x0;}catch(_0xa559c6){if(_0xa559c6 instanceof SDKError)return console[_0x1e8bea(0x22f)](_0x1e8bea(0x1d7)+_0xa559c6[_0x1e8bea(0x251)]),_0xa559c6['cause']&&console[_0x1e8bea(0x22f)](_0x1e8bea(0x233)+_0xa559c6['cause']),0x1;throw _0xa559c6;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a37_0xfb19a1(0x1d8);[a37_0xfb19a1(0x1b1)]=a37_0xfb19a1(0x1ea);async[a37_0xfb19a1(0x1bf)](_0x5961c2){const _0x513a9f=a37_0xfb19a1,{options:_0x322b60,args:_0x5eef32}=_0x5961c2,_0x5dfb7c=_0x322b60,_0x22f854=_0x5dfb7c[_0x513a9f(0x1b6)],_0x56ad3e=_0x5eef32[0x0];if(!_0x56ad3e&&!_0x22f854)return console[_0x513a9f(0x22f)](a37_0x57c980[_0x513a9f(0x22d)](_0x513a9f(0x1fa))),console[_0x513a9f(0x22f)](_0x513a9f(0x250)),console[_0x513a9f(0x22f)](_0x513a9f(0x22c)),console[_0x513a9f(0x22f)](_0x513a9f(0x240)),console[_0x513a9f(0x22f)]('Examples:'),console['error'](_0x513a9f(0x1c7)),console[_0x513a9f(0x22f)](_0x513a9f(0x24e)),0x1;if(_0x56ad3e&&_0x22f854)return console['error'](a37_0x57c980[_0x513a9f(0x22d)](_0x513a9f(0x1b3))),0x1;try{let _0x18b4cf;if(_0x22f854)_0x18b4cf=await this[_0x513a9f(0x1f6)](_0x22f854,_0x5961c2);else{if(isYamlFilePath(_0x56ad3e))return console['error'](a37_0x57c980[_0x513a9f(0x22d)](_0x513a9f(0x1ff))),console['error'](_0x513a9f(0x23d)+_0x56ad3e),0x1;else _0x18b4cf=await this['getSQLFromServerSegment'](_0x56ad3e,_0x5961c2);}return _0x322b60['format']===_0x513a9f(0x1dd)||_0x322b60[_0x513a9f(0x1cb)]===_0x513a9f(0x1f9)?await handleSDKOutput([{'sql':_0x18b4cf}],_0x322b60):console[_0x513a9f(0x232)](_0x18b4cf),0x0;}catch(_0x480a02){if(_0x480a02 instanceof SDKError)return console[_0x513a9f(0x22f)]('Error:\x20'+_0x480a02['message']),_0x480a02['cause']&&console[_0x513a9f(0x22f)]('\x20\x20Cause:\x20'+_0x480a02[_0x513a9f(0x22e)]),0x1;throw _0x480a02;}}async[a37_0xfb19a1(0x1f6)](_0x135aae,_0x444c11){const _0x3b42f9=a37_0xfb19a1,{options:_0x23983a,tdx:_0x557062}=_0x444c11;let _0x5da537;try{_0x5da537=await resolveYamlFilePath(_0x135aae);}catch(_0x5c1210){throw new SDKError(ErrorCode[_0x3b42f9(0x1ef)],_0x3b42f9(0x231)+_0x5c1210['message']);}_0x23983a[_0x3b42f9(0x1d5)]&&console[_0x3b42f9(0x22f)]('Resolved:\x20'+_0x5da537[_0x3b42f9(0x1ae)]+'/'+_0x5da537[_0x3b42f9(0x1fc)]);const _0x3198eb=await withSpinner(_0x3b42f9(0x1d0),()=>_0x557062[_0x3b42f9(0x227)][_0x3b42f9(0x23a)](_0x5da537['content'],_0x5da537[_0x3b42f9(0x1ae)],_0x5da537[_0x3b42f9(0x1fc)]),{'verbose':_0x23983a[_0x3b42f9(0x1d5)]});return _0x3198eb[_0x3b42f9(0x257)];}async[a37_0xfb19a1(0x1b7)](_0x3dc34f,_0x643706){const _0x377ff4=a37_0xfb19a1,{options:_0x332ad6,tdx:_0x24ad60}=_0x643706,_0x286ab1=_0x332ad6['parentSegment'],_0x5be8d8=await resolveSegmentTarget(_0x3dc34f,_0x286ab1,_0x332ad6[_0x377ff4(0x1d5)]);_0x332ad6[_0x377ff4(0x1d5)]&&console[_0x377ff4(0x22f)]('Target\x20path:\x20'+_0x5be8d8);const _0x196106=await withSpinner(_0x377ff4(0x1c6)+_0x3dc34f+_0x377ff4(0x205),()=>_0x24ad60[_0x377ff4(0x227)][_0x377ff4(0x24f)](_0x5be8d8),{'verbose':_0x332ad6[_0x377ff4(0x1d5)]}),_0x1361e4=_0x196106[_0x377ff4(0x257)];_0x332ad6[_0x377ff4(0x1d5)]&&(console[_0x377ff4(0x22f)](_0x377ff4(0x20e)+_0x1361e4[_0x377ff4(0x1af)]),console[_0x377ff4(0x22f)](_0x377ff4(0x1ee)+_0x1361e4[_0x377ff4(0x1c8)]));if(_0x1361e4[_0x377ff4(0x1af)]==='folder')throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x377ff4(0x1f0));if(_0x1361e4[_0x377ff4(0x1af)]===_0x377ff4(0x1e6))throw new SDKError(ErrorCode[_0x377ff4(0x1ef)],_0x377ff4(0x23e));if(!_0x1361e4[_0x377ff4(0x253)])throw new SDKError(ErrorCode[_0x377ff4(0x1e5)],_0x377ff4(0x1d6));const _0x181c59=await withSpinner(_0x377ff4(0x1f4),()=>_0x24ad60[_0x377ff4(0x227)][_0x377ff4(0x207)](_0x1361e4[_0x377ff4(0x1c8)],_0x1361e4[_0x377ff4(0x253)]),{'verbose':_0x332ad6[_0x377ff4(0x1d5)]});return _0x181c59[_0x377ff4(0x257)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0xfb19a1(0x209)]=a37_0xfb19a1(0x217);['description']=a37_0xfb19a1(0x22a);async[a37_0xfb19a1(0x1bf)](_0x5c3c63){const _0x4c23b7=a37_0xfb19a1,{options:_0x50f776,args:_0x48814d,tdx:_0x42a01b}=_0x5c3c63,_0x1f041b=_0x50f776;if(_0x48814d[_0x4c23b7(0x1b9)]<0x2)return console[_0x4c23b7(0x22f)](_0x4c23b7(0x21e)),console['error'](_0x4c23b7(0x248)),0x1;const _0x5b5ef6=_0x48814d[0x0],_0x5a84f1=_0x48814d[0x1];_0x1f041b[_0x4c23b7(0x1d5)]&&(console[_0x4c23b7(0x22f)](_0x4c23b7(0x220)+_0x1f041b[_0x4c23b7(0x226)]),console[_0x4c23b7(0x22f)](_0x4c23b7(0x21f)+_0x5b5ef6),console['error'](_0x4c23b7(0x1bc)+_0x5a84f1));let _0x94e906;if(_0x1f041b[_0x4c23b7(0x22b)]){const _0x368e6a=_0x1f041b['parentFolder'],_0x159a51=await withSpinner(_0x4c23b7(0x1e4)+_0x5b5ef6+'\x27...',()=>_0x42a01b[_0x4c23b7(0x227)][_0x4c23b7(0x255)](_0x5b5ef6),{'verbose':_0x1f041b[_0x4c23b7(0x1d5)]}),_0x12b913=_0x159a51[_0x4c23b7(0x257)],_0x5e6350=await withSpinner(_0x4c23b7(0x24c)+_0x368e6a+'\x27...',()=>_0x42a01b[_0x4c23b7(0x227)][_0x4c23b7(0x239)](_0x12b913,_0x368e6a),{'verbose':_0x1f041b[_0x4c23b7(0x1d5)]});_0x94e906=_0x5e6350[_0x4c23b7(0x257)],_0x1f041b['verbose']&&console[_0x4c23b7(0x22f)](_0x4c23b7(0x21d)+_0x94e906);}const _0x3d6ce6={'name':_0x5a84f1,'description':_0x1f041b['description'],'parentFolderId':_0x94e906},_0x33104f=await withSpinner(_0x4c23b7(0x1c3)+_0x5a84f1+_0x4c23b7(0x205),()=>_0x42a01b[_0x4c23b7(0x227)][_0x4c23b7(0x23b)](_0x5b5ef6,_0x3d6ce6),{'verbose':_0x1f041b['verbose']}),_0x423ef5=_0x33104f['data'];return console['error'](_0x4c23b7(0x1d4)+_0x423ef5[_0x4c23b7(0x209)]+_0x4c23b7(0x1f2)+_0x423ef5['id']),await handleSDKOutput([_0x423ef5],_0x1f041b),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a37_0xfb19a1(0x243);['description']=a37_0xfb19a1(0x1eb);async['execute'](_0x1692fc){const _0x1f41ef=a37_0xfb19a1,{options:_0x404d83,args:_0x201097,tdx:_0x30b4b4}=_0x1692fc,_0x115812=_0x201097[0x0];if(!_0x115812)return console[_0x1f41ef(0x22f)](_0x1f41ef(0x1d3)),console[_0x1f41ef(0x22f)](_0x1f41ef(0x1ca)),console[_0x1f41ef(0x22f)](_0x1f41ef(0x24b)),console['error'](_0x1f41ef(0x214)),console[_0x1f41ef(0x22f)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x1f41ef(0x22f)](_0x1f41ef(0x1b5)),console[_0x1f41ef(0x22f)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console['error'](_0x1f41ef(0x1e2)),console[_0x1f41ef(0x22f)](_0x1f41ef(0x1da)),console[_0x1f41ef(0x22f)](_0x1f41ef(0x1be)),0x1;try{const _0x3f8f54=_0x404d83[_0x1f41ef(0x1ae)],_0x5166c8=await resolveSegmentTarget(_0x115812,_0x3f8f54,_0x404d83[_0x1f41ef(0x1d5)]);_0x404d83[_0x1f41ef(0x1d5)]&&console['error'](_0x1f41ef(0x20c)+_0x5166c8);const _0x3de974=await withSpinner(_0x1f41ef(0x1c6)+_0x115812+_0x1f41ef(0x205),()=>_0x30b4b4[_0x1f41ef(0x227)][_0x1f41ef(0x24f)](_0x5166c8),{'verbose':_0x404d83[_0x1f41ef(0x1d5)]}),_0x301d1c=_0x3de974['data'];_0x404d83[_0x1f41ef(0x1d5)]&&(console[_0x1f41ef(0x22f)](_0x1f41ef(0x20e)+_0x301d1c[_0x1f41ef(0x1af)]),console[_0x1f41ef(0x22f)]('Parent\x20ID:\x20'+_0x301d1c[_0x1f41ef(0x1c8)]),_0x301d1c['folderId']&&console['error']('Folder\x20ID:\x20'+_0x301d1c[_0x1f41ef(0x201)]),_0x301d1c[_0x1f41ef(0x253)]&&console[_0x1f41ef(0x22f)](_0x1f41ef(0x1c0)+_0x301d1c[_0x1f41ef(0x253)]));if(_0x404d83[_0x1f41ef(0x1d9)]){if(_0x301d1c[_0x1f41ef(0x1af)]===_0x1f41ef(0x238))return console['error'](_0x1f41ef(0x212)),0x1;if(_0x301d1c[_0x1f41ef(0x1af)]===_0x1f41ef(0x1e6))return console[_0x1f41ef(0x22f)](_0x1f41ef(0x230)),console['error']('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x301d1c[_0x1f41ef(0x253)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x1f41ef(0x1d6));const _0x10ada2=getConsoleNextUrl(_0x404d83['site'],_0x1f41ef(0x20f)+_0x301d1c[_0x1f41ef(0x1c8)]+'/e/'+_0x301d1c['segmentId']);return console[_0x1f41ef(0x22f)](a37_0x57c980[_0x1f41ef(0x210)]('✔')+_0x1f41ef(0x241)+a37_0x57c980[_0x1f41ef(0x203)](_0x10ada2)),openBrowser(_0x10ada2),0x0;}if(_0x301d1c[_0x1f41ef(0x1af)]===_0x1f41ef(0x238)){if(!_0x301d1c['folderId'])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x6c59aa=await withSpinner(_0x1f41ef(0x204),()=>_0x30b4b4[_0x1f41ef(0x227)][_0x1f41ef(0x254)](_0x301d1c[_0x1f41ef(0x201)]),{'verbose':_0x404d83[_0x1f41ef(0x1d5)]});await handleSingleObjectOutput(_0x6c59aa[_0x1f41ef(0x257)],_0x404d83);}else{if(_0x301d1c['type']===_0x1f41ef(0x227)){if(!_0x301d1c[_0x1f41ef(0x253)])throw new SDKError(ErrorCode[_0x1f41ef(0x1e5)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x31ae6a=await withSpinner('Fetching\x20segment\x20details...',()=>_0x30b4b4[_0x1f41ef(0x227)][_0x1f41ef(0x1bd)](_0x301d1c[_0x1f41ef(0x1c8)],_0x301d1c[_0x1f41ef(0x253)]),{'verbose':_0x404d83[_0x1f41ef(0x1d5)]}),_0x360563=getConsoleNextUrl(_0x404d83['site'],_0x1f41ef(0x20f)+_0x301d1c[_0x1f41ef(0x1c8)]+_0x1f41ef(0x1cd)+_0x301d1c[_0x1f41ef(0x253)]),_0x109cc4=_0x31ae6a[_0x1f41ef(0x257)];_0x109cc4[_0x1f41ef(0x1b2)]=_0x360563,await handleSingleObjectOutput(_0x109cc4,_0x404d83);}else return console[_0x1f41ef(0x22f)](_0x1f41ef(0x234)),console[_0x1f41ef(0x22f)](_0x1f41ef(0x1df)),0x1;}return 0x0;}catch(_0x5e7407){if(_0x5e7407 instanceof SDKError)return console['error'](_0x1f41ef(0x1d7)+_0x5e7407[_0x1f41ef(0x251)]),_0x5e7407[_0x1f41ef(0x22e)]&&console[_0x1f41ef(0x22f)](_0x1f41ef(0x233)+_0x5e7407[_0x1f41ef(0x22e)]),0x1;throw _0x5e7407;}}}export const SegmentInfoCommand=SegmentViewCommand;function a37_0x243a(){const _0x3f15b2=['Options:','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','segment:folder:create','\x20\x20Parent\x20segment:\x20','4288964mKJPNf','1859056QaAktK','folderPath','SELECT\x20*\x20FROM\x20(\x0a','Resolved\x20parent\x20folder\x20ID:\x20','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Parent\x20segment:\x20','Site:\x20','Executing\x20segment\x20query...','✔\x20Query\x20completed:\x20Processed\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','getParent','site','segment','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','stats','Create\x20segment\x20folder\x20for\x20organization','parentFolder','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','red','cause','error','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','log','\x20\x20Cause:\x20','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','segment:folder:list','Resolving\x20folder\x20\x27','SQL\x20query:\x0a','folder','resolveFolderId','getSegmentSQLFromYaml','createFolder','3712803vHiSBT','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','query','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','\x20Opening\x20','Error:\x20Path\x20or\x20name\x20is\x20required','segment:view','replace','\x20\x20Folder\x20path:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Fetching\x20parent\x20segment\x20details...','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Show\x20child\x20segment\x20schema\x20(column\x20types)','✔\x20Found\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Resolving\x20parent\x20folder\x20\x27','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','resolvePathToResource','Usage:','message','Listing\x20folders\x20for\x20parent\x20\x27','segmentId','getFolder','resolveParentId','Folder\x20ID:\x20','data','13878950fopvOT','parentSegment','type','426552AEbIku','description','url','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','6deGmKk','Examples:','path','getSQLFromServerSegment','Parent\x20name:\x20','length','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Folder\x20name:\x20','getSegment','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','execute','Segment\x20ID:\x20','5eSmrgl','Fetching\x20segment\x20details...','Creating\x20folder\x20\x27','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','toLocaleString','Resolving\x20\x27','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','parentId','information_schema','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','format','limit','/e/','Resolved\x20relative\x20path\x20to:\x20','\x20\x20Full\x20path:\x20','Fetching\x20SQL\x20from\x20rule...','Fetching\x20folder\x20\x27','Resolved\x20folder\x20ID:\x20','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','✔\x20Created\x20folder\x20\x27','verbose','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20','segment:sql','web','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','7222117bHwQON','fullPath','json','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Use:\x20tdx\x20ps\x20view','listFolders','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','18mKcBxx','Resolving\x20parent\x20segment\x20\x27','SEGMENT_NOT_FOUND','parent','\x20\x20Segment\x20name:\x20','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','(root)','Get\x20SQL\x20query\x20for\x20child\x20segment','Show\x20folder\x20or\x20child\x20segment\x20details','in\x20','Resolving\x20path\x20\x27','Parent\x20ID:\x20','INVALID_ARGUMENT','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','778126jODmYC','\x27\x20with\x20ID:\x20','jobId','Fetching\x20SQL\x20for\x20segment...','processedRows','getSQLFromYamlFile','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Usage:\x20tdx\x20sg\x20desc\x20<name>','jsonl','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','segmentName','Resolved\x20parent\x20ID:\x20','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','Use:\x20tdx\x20ps\x20show','folderId','elapsedTimeMillis','cyan','Fetching\x20folder\x20details...','\x27...','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','getSegmentSQL','Usage:\x20tdx\x20segment\x20describe\x20<path>','name','Resolved\x20YAML\x20file:\x20','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Target\x20path:\x20','\x20rows\x20','Resolved\x20type:\x20','/app/ps/','green','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','\x20folder'];a37_0x243a=function(){return _0x3f15b2;};return a37_0x243a();}export class SegmentDescCommand extends BaseCommand{[a37_0xfb19a1(0x209)]='segment:desc';[a37_0xfb19a1(0x1b1)]=a37_0xfb19a1(0x249);async[a37_0xfb19a1(0x1bf)](_0xe940c0){const _0x4b7a51=a37_0xfb19a1,{options:_0x403a3e,args:_0x4ab6b7,tdx:_0x23a3a3}=_0xe940c0,_0x1ee296=_0x4ab6b7[0x0];if(!_0x1ee296)return console[_0x4b7a51(0x22f)](_0x4b7a51(0x206)),console[_0x4b7a51(0x22f)](_0x4b7a51(0x1f8)),console['error'](_0x4b7a51(0x215)),console[_0x4b7a51(0x22f)](_0x4b7a51(0x1b5)),console[_0x4b7a51(0x22f)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x4b7a51(0x22f)](_0x4b7a51(0x1f7)),0x1;try{const _0x502ca5=_0x403a3e[_0x4b7a51(0x1ae)],_0xd5997c=await resolveSegmentTarget(_0x1ee296,_0x502ca5,_0x403a3e[_0x4b7a51(0x1d5)]);_0x403a3e[_0x4b7a51(0x1d5)]&&console[_0x4b7a51(0x22f)](_0x4b7a51(0x20c)+_0xd5997c);const _0x3b88ef=await withSpinner(_0x4b7a51(0x1c6)+_0x1ee296+_0x4b7a51(0x205),()=>_0x23a3a3[_0x4b7a51(0x227)][_0x4b7a51(0x24f)](_0xd5997c),{'verbose':_0x403a3e['verbose']}),_0xe1281c=_0x3b88ef[_0x4b7a51(0x257)];_0x403a3e['verbose']&&(console[_0x4b7a51(0x22f)]('Resolved\x20type:\x20'+_0xe1281c[_0x4b7a51(0x1af)]),console[_0x4b7a51(0x22f)](_0x4b7a51(0x1ee)+_0xe1281c[_0x4b7a51(0x1c8)]));if(_0xe1281c[_0x4b7a51(0x1af)]==='folder')return console[_0x4b7a51(0x22f)](_0x4b7a51(0x1c4)),console[_0x4b7a51(0x22f)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0xe1281c[_0x4b7a51(0x1af)]===_0x4b7a51(0x1e6))return console[_0x4b7a51(0x22f)](_0x4b7a51(0x24d)),console[_0x4b7a51(0x22f)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0xe1281c[_0x4b7a51(0x253)])throw new SDKError(ErrorCode[_0x4b7a51(0x1e5)],_0x4b7a51(0x1d6));const _0x56621a=await withSpinner(_0x4b7a51(0x1f4),()=>_0x23a3a3[_0x4b7a51(0x227)][_0x4b7a51(0x207)](_0xe1281c[_0x4b7a51(0x1c8)],_0xe1281c['segmentId']),{'verbose':_0x403a3e[_0x4b7a51(0x1d5)]}),_0x27874e=_0x56621a[_0x4b7a51(0x257)],_0x2b0390=await executeSchemaQuery(_0x27874e,_0x23a3a3,_0x403a3e);return await handleQueryOutput(_0x2b0390,_0x403a3e),0x0;}catch(_0x51d0e4){if(_0x51d0e4 instanceof SDKError)return console[_0x4b7a51(0x22f)]('Error:\x20'+_0x51d0e4[_0x4b7a51(0x251)]),_0x51d0e4['cause']&&console['error'](_0x4b7a51(0x233)+_0x51d0e4['cause']),0x1;throw _0x51d0e4;}}}
@@ -1 +1 @@
1
- const a38_0x3c7f7f=a38_0x5287;(function(_0xd5150c,_0x3aadf0){const _0x1e2310=a38_0x5287,_0x1485f8=_0xd5150c();while(!![]){try{const _0x1f8f29=-parseInt(_0x1e2310(0xe5))/0x1*(-parseInt(_0x1e2310(0xd3))/0x2)+-parseInt(_0x1e2310(0xd4))/0x3+-parseInt(_0x1e2310(0xdf))/0x4+-parseInt(_0x1e2310(0x107))/0x5*(parseInt(_0x1e2310(0xe4))/0x6)+-parseInt(_0x1e2310(0xe0))/0x7*(-parseInt(_0x1e2310(0x10a))/0x8)+-parseInt(_0x1e2310(0xd6))/0x9*(-parseInt(_0x1e2310(0xfb))/0xa)+-parseInt(_0x1e2310(0xfa))/0xb*(-parseInt(_0x1e2310(0xf0))/0xc);if(_0x1f8f29===_0x3aadf0)break;else _0x1485f8['push'](_0x1485f8['shift']());}catch(_0x3a306f){_0x1485f8['push'](_0x1485f8['shift']());}}}(a38_0x3852,0x4f86a));function a38_0x5287(_0x3baf7a,_0x4dcfce){_0x3baf7a=_0x3baf7a-0xd3;const _0x385279=a38_0x3852();let _0x52873c=_0x385279[_0x3baf7a];return _0x52873c;}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a38_0x3852(){const _0x5aa4f8=['\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','segment','7855noTHRq','verbose','error','3458128VRCEWt','5956oLYMnf','953556SyTGkc','execute','101187shXxJf','Create\x20child\x20segment\x20with\x20filtering\x20rules','Resolved\x20relative\x20path\x20to:\x20','createSegment','description','segmentPath','kind','name','resolveParentId','2090788ZpFnPM','7RwoUQm','Resolving\x20folder\x20path\x20\x27','Creating\x20segment\x20\x27','folder','354JbMkzX','13OQHzAJ','yellow','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','site','parent','type','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','\x27...','Target\x20path:\x20','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','Resolving\x20folder\x20\x27','66696SDkHIX','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','\x20\x20\x20Path:\x20','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','ruleFile','segment:create','segments','\x27\x20with\x20ID:\x20','803uZHfky','340UALMls','Parent:\x20','Examples:','data','Resolved\x20folder\x20ID:\x20','noCountPopulation','resolveFolderId','length','folderId','Segment\x20name:\x20'];a38_0x3852=function(){return _0x5aa4f8;};return a38_0x3852();}import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x17b385 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x3c7f7f(0xdd)]=a38_0x3c7f7f(0xf7);[a38_0x3c7f7f(0xda)]=a38_0x3c7f7f(0xd7);async[a38_0x3c7f7f(0xd5)](_0x2e146f){const _0x5addd3=a38_0x3c7f7f;console[_0x5addd3(0x109)](a38_0x17b385[_0x5addd3(0xe6)](_0x5addd3(0xe7))),console[_0x5addd3(0x109)](a38_0x17b385[_0x5addd3(0xe6)](_0x5addd3(0xf1)));const {options:_0x1d13fa,args:_0x207188,tdx:_0x505995}=_0x2e146f,_0x4a67ed=_0x1d13fa;if(_0x207188[_0x5addd3(0x102)]===0x0)return console['error']('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console['error'](_0x5addd3(0xeb)),console[_0x5addd3(0x109)](_0x5addd3(0xfd)),console[_0x5addd3(0x109)](_0x5addd3(0x105)),console['error']('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console[_0x5addd3(0x109)](_0x5addd3(0xf5)),0x1;const _0x24041b=_0x207188[0x0],_0x3f02f0=_0x1d13fa[_0x5addd3(0xdb)];let _0x5d75b1=_0x24041b;_0x3f02f0&&!_0x24041b['includes']('/')&&(_0x5d75b1=_0x3f02f0+'/'+_0x24041b,_0x4a67ed[_0x5addd3(0x108)]&&console[_0x5addd3(0x109)](_0x5addd3(0xd8)+_0x5d75b1));const _0x444108=parsePath(_0x5d75b1);if(_0x444108['segments']['length']<0x2)return console['error'](_0x5addd3(0xee)),console[_0x5addd3(0x109)](_0x5addd3(0xf4)),0x1;const _0x3217cf=_0x444108[_0x5addd3(0xf8)][0x0],_0x27b425=getBaseName(_0x5d75b1),_0x1b1644=getParentPath(_0x5d75b1);_0x4a67ed[_0x5addd3(0x108)]&&(console[_0x5addd3(0x109)]('Site:\x20'+_0x4a67ed[_0x5addd3(0xe8)]),console[_0x5addd3(0x109)](_0x5addd3(0xed)+_0x5d75b1),console[_0x5addd3(0x109)](_0x5addd3(0xfc)+_0x3217cf),console[_0x5addd3(0x109)](_0x5addd3(0x104)+_0x27b425),console['error']('Parent\x20path:\x20'+_0x1b1644));const _0x27e631=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3217cf+'\x27...',()=>_0x505995[_0x5addd3(0x106)][_0x5addd3(0xde)](_0x3217cf),{'verbose':_0x4a67ed[_0x5addd3(0x108)]}),_0x1a4410=_0x27e631[_0x5addd3(0xfe)];let _0x33fd60;if(_0x444108[_0x5addd3(0xf8)][_0x5addd3(0x102)]>0x2){const _0x1b9b5f=await withSpinner(_0x5addd3(0xe1)+_0x1b1644+_0x5addd3(0xec),()=>_0x505995[_0x5addd3(0x106)]['resolvePathToResource'](_0x1b1644),{'verbose':_0x4a67ed[_0x5addd3(0x108)]}),_0x8aab92=_0x1b9b5f['data'];if(_0x8aab92[_0x5addd3(0xea)]!==_0x5addd3(0xe3)&&_0x8aab92['type']!==_0x5addd3(0xe9))return console['error'](_0x5addd3(0xf2)),0x1;_0x33fd60=_0x8aab92[_0x5addd3(0x103)];}else{if(_0x4a67ed[_0x5addd3(0xe3)]){const _0x2a8c14=await withSpinner(_0x5addd3(0xef)+_0x4a67ed[_0x5addd3(0xe3)]+_0x5addd3(0xec),()=>_0x505995[_0x5addd3(0x106)][_0x5addd3(0x101)](_0x1a4410,_0x4a67ed['folder']),{'verbose':_0x4a67ed[_0x5addd3(0x108)]});_0x33fd60=_0x2a8c14[_0x5addd3(0xfe)];}}_0x4a67ed[_0x5addd3(0x108)]&&_0x33fd60&&console[_0x5addd3(0x109)](_0x5addd3(0xff)+_0x33fd60);const _0x4e9020=await loadJSONFromOptions(_0x4a67ed['rule'],_0x4a67ed[_0x5addd3(0xf6)]),_0x4e7cc9={'name':_0x27b425,'description':_0x4a67ed['description'],'rule':_0x4e9020,'kind':_0x4a67ed['kind']!==undefined?parseInt(_0x4a67ed[_0x5addd3(0xdc)],0xa):undefined,'isVisible':_0x4a67ed['invisible']?![]:undefined,'segmentFolderId':_0x33fd60,'countPopulation':_0x4a67ed[_0x5addd3(0x100)]?![]:undefined},_0x2a0864=await withSpinner(_0x5addd3(0xe2)+_0x27b425+_0x5addd3(0xec),()=>_0x505995[_0x5addd3(0x106)][_0x5addd3(0xd9)](_0x1a4410,_0x4e7cc9),{'verbose':_0x4a67ed[_0x5addd3(0x108)]}),_0x2ac1c3=_0x2a0864[_0x5addd3(0xfe)];return console[_0x5addd3(0x109)]('✔\x20Created\x20segment\x20\x27'+_0x2ac1c3['name']+_0x5addd3(0xf9)+_0x2ac1c3['id']),_0x5d75b1!==_0x24041b&&console[_0x5addd3(0x109)](_0x5addd3(0xf3)+_0x5d75b1),await handleSDKOutput([_0x2ac1c3],_0x4a67ed),0x0;}}
1
+ const a38_0x4ad0ff=a38_0x4b2b;(function(_0x24eb00,_0x3c5ce3){const _0xa0a6a0=a38_0x4b2b,_0x5f4bbd=_0x24eb00();while(!![]){try{const _0x384137=parseInt(_0xa0a6a0(0x153))/0x1*(parseInt(_0xa0a6a0(0x143))/0x2)+parseInt(_0xa0a6a0(0x144))/0x3*(-parseInt(_0xa0a6a0(0x135))/0x4)+parseInt(_0xa0a6a0(0x145))/0x5*(-parseInt(_0xa0a6a0(0x136))/0x6)+parseInt(_0xa0a6a0(0x134))/0x7*(-parseInt(_0xa0a6a0(0x148))/0x8)+parseInt(_0xa0a6a0(0x131))/0x9+-parseInt(_0xa0a6a0(0x155))/0xa+parseInt(_0xa0a6a0(0x12d))/0xb;if(_0x384137===_0x3c5ce3)break;else _0x5f4bbd['push'](_0x5f4bbd['shift']());}catch(_0x448213){_0x5f4bbd['push'](_0x5f4bbd['shift']());}}}(a38_0x2f7a,0xdb676));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a38_0x2f7a(){const _0x3ece54=['Create\x20child\x20segment\x20with\x20filtering\x20rules','8317001zuPtTA','8XUuVOM','102fHCWyS','name','createSegment','segments','rule','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','verbose','Parent\x20path:\x20','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','\x27\x20with\x20ID:\x20','folder','type','1306pZvWew','460563CnenOp','489605HTzTNK','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','yellow','8XzdDjd','length','Resolving\x20parent\x20segment\x20\x27','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','✔\x20Created\x20segment\x20\x27','kind','Resolving\x20folder\x20path\x20\x27','Resolved\x20folder\x20ID:\x20','segment','ruleFile','includes','2556kVnIzP','parent','10638240EjIEma','description','folderId','error','\x27...','\x20\x20\x20Path:\x20','Creating\x20segment\x20\x27','invisible','data','segment:create','20274529birkPU','Target\x20path:\x20','site','noCountPopulation','14491233nkvsSl','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'];a38_0x2f7a=function(){return _0x3ece54;};return a38_0x2f7a();}import{withSpinner}from'../utils/spinner.js';function a38_0x4b2b(_0x3d7ca7,_0x2ea350){_0x3d7ca7=_0x3d7ca7-0x124;const _0x2f7a34=a38_0x2f7a();let _0x4b2bb9=_0x2f7a34[_0x3d7ca7];return _0x4b2bb9;}import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x2a5f8e from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x4ad0ff(0x137)]=a38_0x4ad0ff(0x12c);['description']=a38_0x4ad0ff(0x133);async['execute'](_0xa4cfb2){const _0x1813e6=a38_0x4ad0ff;console[_0x1813e6(0x126)](a38_0x2a5f8e[_0x1813e6(0x147)]('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x1813e6(0x126)](a38_0x2a5f8e[_0x1813e6(0x147)](_0x1813e6(0x146)));const {options:_0x1e1bb1,args:_0x164318,tdx:_0xc841bb}=_0xa4cfb2,_0x1218d2=_0x1e1bb1;if(_0x164318[_0x1813e6(0x149)]===0x0)return console[_0x1813e6(0x126)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console['error'](_0x1813e6(0x13f)),console[_0x1813e6(0x126)]('Examples:'),console[_0x1813e6(0x126)](_0x1813e6(0x14b)),console[_0x1813e6(0x126)](_0x1813e6(0x132)),console[_0x1813e6(0x126)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x5d6066=_0x164318[0x0],_0x2b3175=_0x1e1bb1['segmentPath'];let _0x2ea68a=_0x5d6066;_0x2b3175&&!_0x5d6066[_0x1813e6(0x152)]('/')&&(_0x2ea68a=_0x2b3175+'/'+_0x5d6066,_0x1218d2[_0x1813e6(0x13c)]&&console[_0x1813e6(0x126)]('Resolved\x20relative\x20path\x20to:\x20'+_0x2ea68a));const _0x2c4e5e=parsePath(_0x2ea68a);if(_0x2c4e5e[_0x1813e6(0x139)][_0x1813e6(0x149)]<0x2)return console[_0x1813e6(0x126)](_0x1813e6(0x13b)),console[_0x1813e6(0x126)](_0x1813e6(0x13e)),0x1;const _0x559197=_0x2c4e5e['segments'][0x0],_0x42e61d=getBaseName(_0x2ea68a),_0x368fec=getParentPath(_0x2ea68a);_0x1218d2[_0x1813e6(0x13c)]&&(console[_0x1813e6(0x126)]('Site:\x20'+_0x1218d2[_0x1813e6(0x12f)]),console[_0x1813e6(0x126)](_0x1813e6(0x12e)+_0x2ea68a),console[_0x1813e6(0x126)]('Parent:\x20'+_0x559197),console['error']('Segment\x20name:\x20'+_0x42e61d),console[_0x1813e6(0x126)](_0x1813e6(0x13d)+_0x368fec));const _0x2816ef=await withSpinner(_0x1813e6(0x14a)+_0x559197+_0x1813e6(0x127),()=>_0xc841bb[_0x1813e6(0x150)]['resolveParentId'](_0x559197),{'verbose':_0x1218d2[_0x1813e6(0x13c)]}),_0x11a71f=_0x2816ef[_0x1813e6(0x12b)];let _0xc245fe;if(_0x2c4e5e['segments'][_0x1813e6(0x149)]>0x2){const _0x409a7f=await withSpinner(_0x1813e6(0x14e)+_0x368fec+_0x1813e6(0x127),()=>_0xc841bb[_0x1813e6(0x150)]['resolvePathToResource'](_0x368fec),{'verbose':_0x1218d2['verbose']}),_0x1a8ff0=_0x409a7f[_0x1813e6(0x12b)];if(_0x1a8ff0[_0x1813e6(0x142)]!==_0x1813e6(0x141)&&_0x1a8ff0[_0x1813e6(0x142)]!==_0x1813e6(0x154))return console[_0x1813e6(0x126)]('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0xc245fe=_0x1a8ff0[_0x1813e6(0x125)];}else{if(_0x1218d2[_0x1813e6(0x141)]){const _0x5759f4=await withSpinner('Resolving\x20folder\x20\x27'+_0x1218d2['folder']+'\x27...',()=>_0xc841bb[_0x1813e6(0x150)]['resolveFolderId'](_0x11a71f,_0x1218d2['folder']),{'verbose':_0x1218d2[_0x1813e6(0x13c)]});_0xc245fe=_0x5759f4[_0x1813e6(0x12b)];}}_0x1218d2['verbose']&&_0xc245fe&&console['error'](_0x1813e6(0x14f)+_0xc245fe);const _0x34419c=await loadJSONFromOptions(_0x1218d2[_0x1813e6(0x13a)],_0x1218d2[_0x1813e6(0x151)]),_0x56ff4f={'name':_0x42e61d,'description':_0x1218d2[_0x1813e6(0x124)],'rule':_0x34419c,'kind':_0x1218d2[_0x1813e6(0x14d)]!==undefined?parseInt(_0x1218d2[_0x1813e6(0x14d)],0xa):undefined,'isVisible':_0x1218d2[_0x1813e6(0x12a)]?![]:undefined,'segmentFolderId':_0xc245fe,'countPopulation':_0x1218d2[_0x1813e6(0x130)]?![]:undefined},_0x30f1fc=await withSpinner(_0x1813e6(0x129)+_0x42e61d+'\x27...',()=>_0xc841bb[_0x1813e6(0x150)][_0x1813e6(0x138)](_0x11a71f,_0x56ff4f),{'verbose':_0x1218d2[_0x1813e6(0x13c)]}),_0x5d5c00=_0x30f1fc[_0x1813e6(0x12b)];return console['error'](_0x1813e6(0x14c)+_0x5d5c00[_0x1813e6(0x137)]+_0x1813e6(0x140)+_0x5d5c00['id']),_0x2ea68a!==_0x5d6066&&console[_0x1813e6(0x126)](_0x1813e6(0x128)+_0x2ea68a),await handleSDKOutput([_0x5d5c00],_0x1218d2),0x0;}}
@@ -1 +1 @@
1
- const a39_0x499f8d=a39_0xf3da;(function(_0x5db0fb,_0x20466c){const _0xb7a642=a39_0xf3da,_0x1d2c92=_0x5db0fb();while(!![]){try{const _0x286bb6=parseInt(_0xb7a642(0x115))/0x1*(parseInt(_0xb7a642(0x112))/0x2)+-parseInt(_0xb7a642(0x10e))/0x3*(-parseInt(_0xb7a642(0x101))/0x4)+-parseInt(_0xb7a642(0x113))/0x5*(parseInt(_0xb7a642(0x11c))/0x6)+parseInt(_0xb7a642(0x11a))/0x7*(parseInt(_0xb7a642(0x117))/0x8)+-parseInt(_0xb7a642(0x109))/0x9*(-parseInt(_0xb7a642(0x111))/0xa)+-parseInt(_0xb7a642(0xfd))/0xb+-parseInt(_0xb7a642(0x116))/0xc*(parseInt(_0xb7a642(0x110))/0xd);if(_0x286bb6===_0x20466c)break;else _0x1d2c92['push'](_0x1d2c92['shift']());}catch(_0x189add){_0x1d2c92['push'](_0x1d2c92['shift']());}}}(a39_0x1262,0xa8f38));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a39_0xf3da(_0x3ef365,_0x20eae4){_0x3ef365=_0x3ef365-0xfd;const _0x12622f=a39_0x1262();let _0xf3dae3=_0x12622f[_0x3ef365];return _0xf3dae3;}import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a39_0x499f8d(0x10c)]=a39_0x499f8d(0xff);[a39_0x499f8d(0x105)]=a39_0x499f8d(0x100);async['execute'](_0x2cc786){const _0xcb18a1=a39_0x499f8d,{options:_0x1a59c8,args:_0x22c313,tdx:_0x144697}=_0x2cc786,_0x20242a=_0x22c313[0x0]||_0x1a59c8[_0xcb18a1(0x11b)];if(!_0x20242a)return console[_0xcb18a1(0xfe)](_0xcb18a1(0x106)),console[_0xcb18a1(0xfe)]('Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'),console[_0xcb18a1(0xfe)](_0xcb18a1(0x10d)),0x1;_0x1a59c8[_0xcb18a1(0x102)]&&(console[_0xcb18a1(0xfe)](_0xcb18a1(0x103)+_0x1a59c8['site']),console['error'](_0xcb18a1(0x108)+_0x20242a));const _0x4bcec1=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x20242a+_0xcb18a1(0x10a),()=>_0x144697[_0xcb18a1(0x119)][_0xcb18a1(0x114)](_0x20242a),{'verbose':_0x1a59c8[_0xcb18a1(0x102)]}),_0x462c34=_0x4bcec1[_0xcb18a1(0x118)];console[_0xcb18a1(0xfe)]('✔\x20Found\x20'+_0x462c34['length']+_0xcb18a1(0x10f)+(_0x462c34[_0xcb18a1(0x107)]!==0x1?'s':''));if(_0x1a59c8[_0xcb18a1(0x104)]||_0x1a59c8[_0xcb18a1(0x10b)])return await handleSDKOutput(_0x462c34,_0x1a59c8),0x0;return displayFieldsHumanReadable(_0x462c34,_0x20242a),0x0;}}function a39_0x1262(){const _0x535fd7=['listFields','1tCDJbT','20393004tpaSJw','8cAZFaz','data','segment','6742701zjAZDV','parentSegment','315516VzEOWs','10182370KyPQgR','error','segment:fields','List\x20available\x20fields\x20for\x20segmentation','2638628qXEKch','verbose','Site:\x20','json','description','Error:\x20Parent\x20segment\x20name\x20is\x20required','length','Parent\x20segment:\x20','9156582aYEbPu','\x27...','jsonl','name','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','3UWeQUh','\x20field','13bvjKBL','10YrvZHe','2195002sZXlXn','40tNwvVY'];a39_0x1262=function(){return _0x535fd7;};return a39_0x1262();}
1
+ const a39_0x4bfc92=a39_0x1afb;(function(_0x58f2b2,_0x517b81){const _0x51f70d=a39_0x1afb,_0x3c8f06=_0x58f2b2();while(!![]){try{const _0x403787=parseInt(_0x51f70d(0x1ef))/0x1+-parseInt(_0x51f70d(0x1ec))/0x2*(parseInt(_0x51f70d(0x1e1))/0x3)+-parseInt(_0x51f70d(0x1f9))/0x4+parseInt(_0x51f70d(0x1f0))/0x5*(-parseInt(_0x51f70d(0x1e3))/0x6)+parseInt(_0x51f70d(0x1ea))/0x7+-parseInt(_0x51f70d(0x1ed))/0x8*(parseInt(_0x51f70d(0x1e0))/0x9)+-parseInt(_0x51f70d(0x1eb))/0xa*(-parseInt(_0x51f70d(0x1e4))/0xb);if(_0x403787===_0x517b81)break;else _0x3c8f06['push'](_0x3c8f06['shift']());}catch(_0x2aab7a){_0x3c8f06['push'](_0x3c8f06['shift']());}}}(a39_0x41b7,0x5f5c3));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a39_0x41b7(){const _0x2d837f=['segment','\x20field','segment:fields','json','4723404mOdsOK','142320EZFcKW','109420etyYFN','8ePFZpf','execute','765678GLKtqC','759685yEipxO','data','parentSegment','List\x20available\x20fields\x20for\x20segmentation','Parent\x20segment:\x20','jsonl','name','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','✔\x20Found\x20','1623124jVspDA','Site:\x20','2479635mGaJNr','15SLoqKJ','verbose','6vkQxMI','44ptEKfi','error'];a39_0x41b7=function(){return _0x2d837f;};return a39_0x41b7();}import{withSpinner}from'../utils/spinner.js';function a39_0x1afb(_0x3f3719,_0x52d08a){_0x3f3719=_0x3f3719-0x1e0;const _0x41b716=a39_0x41b7();let _0x1afb86=_0x41b716[_0x3f3719];return _0x1afb86;}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a39_0x4bfc92(0x1f6)]=a39_0x4bfc92(0x1e8);['description']=a39_0x4bfc92(0x1f3);async[a39_0x4bfc92(0x1ee)](_0xe72934){const _0xd92da=a39_0x4bfc92,{options:_0x18dc92,args:_0x1ba91b,tdx:_0x42976b}=_0xe72934,_0x7df27=_0x1ba91b[0x0]||_0x18dc92[_0xd92da(0x1f2)];if(!_0x7df27)return console[_0xd92da(0x1e5)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0xd92da(0x1e5)]('Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'),console['error'](_0xd92da(0x1f7)),0x1;_0x18dc92[_0xd92da(0x1e2)]&&(console['error'](_0xd92da(0x1fa)+_0x18dc92['site']),console['error'](_0xd92da(0x1f4)+_0x7df27));const _0xd0034e=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x7df27+'\x27...',()=>_0x42976b[_0xd92da(0x1e6)]['listFields'](_0x7df27),{'verbose':_0x18dc92[_0xd92da(0x1e2)]}),_0x3a1d11=_0xd0034e[_0xd92da(0x1f1)];console['error'](_0xd92da(0x1f8)+_0x3a1d11['length']+_0xd92da(0x1e7)+(_0x3a1d11['length']!==0x1?'s':''));if(_0x18dc92[_0xd92da(0x1e9)]||_0x18dc92[_0xd92da(0x1f5)])return await handleSDKOutput(_0x3a1d11,_0x18dc92),0x0;return displayFieldsHumanReadable(_0x3a1d11,_0x7df27),0x0;}}