@treasuredata/tdx 2026.3.43 → 2026.3.44

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 (222) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/auth-login-command.js +1 -1
  11. package/dist/commands/cas-command.js +1 -1
  12. package/dist/commands/cas-segment-command.js +1 -1
  13. package/dist/commands/chat-command.js +1 -1
  14. package/dist/commands/claude-command.js +1 -1
  15. package/dist/commands/claude-statusline-command.js +1 -1
  16. package/dist/commands/claude-usage-command.js +1 -1
  17. package/dist/commands/command.js +1 -1
  18. package/dist/commands/connection-command.js +1 -1
  19. package/dist/commands/databases.js +1 -1
  20. package/dist/commands/delivery-command.js +1 -1
  21. package/dist/commands/describe.js +1 -1
  22. package/dist/commands/engage-campaign-pull-command.js +1 -1
  23. package/dist/commands/engage-campaign-push-command.js +1 -1
  24. package/dist/commands/engage-campaign-validate-command.js +1 -1
  25. package/dist/commands/engage-command.js +1 -1
  26. package/dist/commands/engage-template-pull-command.js +1 -1
  27. package/dist/commands/engage-template-push-command.js +1 -1
  28. package/dist/commands/engage-template-validate-command.js +1 -1
  29. package/dist/commands/job-command.js +1 -1
  30. package/dist/commands/journey-command.js +1 -1
  31. package/dist/commands/journey-validate-command.js +1 -1
  32. package/dist/commands/llm-command.js +1 -1
  33. package/dist/commands/mcp-command.js +1 -1
  34. package/dist/commands/parent-segment-command.js +1 -1
  35. package/dist/commands/policy-command.js +1 -1
  36. package/dist/commands/profile-command.js +1 -1
  37. package/dist/commands/profiles-command.js +1 -1
  38. package/dist/commands/query-command.js +1 -1
  39. package/dist/commands/schedule-command.js +1 -1
  40. package/dist/commands/segment-command.js +1 -1
  41. package/dist/commands/segment-create-command.js +1 -1
  42. package/dist/commands/segment-fields-command.js +1 -1
  43. package/dist/commands/segment-pull-command.js +1 -1
  44. package/dist/commands/segment-push-command.js +1 -1
  45. package/dist/commands/segment-update-command.js +1 -1
  46. package/dist/commands/segment-use-command.js +1 -1
  47. package/dist/commands/segment-validate-command.js +1 -1
  48. package/dist/commands/segments.js +1 -1
  49. package/dist/commands/show.js +1 -1
  50. package/dist/commands/status-command.js +1 -1
  51. package/dist/commands/tables.js +1 -1
  52. package/dist/commands/unset-command.js +1 -1
  53. package/dist/commands/upgrade-command.js +1 -1
  54. package/dist/commands/use-command.js +1 -1
  55. package/dist/commands/user-command.js +1 -1
  56. package/dist/commands/work-command.js +1 -1
  57. package/dist/commands/workflow-command.js +1 -1
  58. package/dist/core/auth.js +1 -1
  59. package/dist/core/command-output.js +1 -1
  60. package/dist/core/config.js +1 -1
  61. package/dist/core/connection-cache.js +1 -1
  62. package/dist/core/constants.js +1 -1
  63. package/dist/core/credential-cache.js +1 -1
  64. package/dist/core/global-context.js +1 -1
  65. package/dist/core/keychain.js +1 -1
  66. package/dist/core/oauth-keychain.js +1 -1
  67. package/dist/core/oauth.js +1 -1
  68. package/dist/core/profile.js +1 -1
  69. package/dist/core/project-config.js +1 -1
  70. package/dist/core/session.js +1 -1
  71. package/dist/core/user-cache.js +1 -1
  72. package/dist/core/version.js +1 -1
  73. package/dist/index.js +1 -1
  74. package/dist/mcp/server.js +1 -1
  75. package/dist/mcp/tools/index.js +1 -1
  76. package/dist/mcp/tools/tdx-run.js +1 -1
  77. package/dist/mcp/tools/tdx-search.js +1 -1
  78. package/dist/mcp/utils.js +1 -1
  79. package/dist/proxy/claude-usage-tracker.js +1 -1
  80. package/dist/proxy/passthrough-server.js +1 -1
  81. package/dist/proxy/sse-usage-parser.js +1 -1
  82. package/dist/sdk/agent/agent-config.js +1 -1
  83. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  84. package/dist/sdk/agent/agent-yaml.js +1 -1
  85. package/dist/sdk/agent/test/evaluator.js +1 -1
  86. package/dist/sdk/agent/test/executor.js +1 -1
  87. package/dist/sdk/agent/test/index.js +1 -1
  88. package/dist/sdk/agent/test/output.js +1 -1
  89. package/dist/sdk/agent/test/parser.js +1 -1
  90. package/dist/sdk/agent/tool-target-registry.js +1 -1
  91. package/dist/sdk/api.js +1 -1
  92. package/dist/sdk/cas/cas-api-client.js +1 -1
  93. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  94. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  95. package/dist/sdk/cas/index.js +1 -1
  96. package/dist/sdk/cas/pull-workflow.js +1 -1
  97. package/dist/sdk/cas/push-workflow.js +1 -1
  98. package/dist/sdk/client/cdp-api-client.js +1 -1
  99. package/dist/sdk/client/delivery-api-client.js +1 -1
  100. package/dist/sdk/client/endpoints.js +1 -1
  101. package/dist/sdk/client/engage-api-client.js +1 -1
  102. package/dist/sdk/client/http-client.js +1 -1
  103. package/dist/sdk/client/llm-api-client.js +1 -1
  104. package/dist/sdk/client/oauth-refresh.js +1 -1
  105. package/dist/sdk/client/rate-limiter.js +1 -1
  106. package/dist/sdk/client/td-api-client.js +1 -1
  107. package/dist/sdk/client/trino-api-client.js +1 -1
  108. package/dist/sdk/client/workflow-client.js +1 -1
  109. package/dist/sdk/connection-validator.js +1 -1
  110. package/dist/sdk/connection.js +1 -1
  111. package/dist/sdk/delivery.js +1 -1
  112. package/dist/sdk/engage/campaign-pull.js +1 -1
  113. package/dist/sdk/engage/campaign-push.js +1 -1
  114. package/dist/sdk/engage/campaign-validator.js +1 -1
  115. package/dist/sdk/engage/campaign-yaml.js +1 -1
  116. package/dist/sdk/engage/template-pull.js +1 -1
  117. package/dist/sdk/engage/template-push.js +1 -1
  118. package/dist/sdk/engage/template-validator.js +1 -1
  119. package/dist/sdk/engage/template-yaml.js +1 -1
  120. package/dist/sdk/engage/types/campaign-def.js +1 -1
  121. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  122. package/dist/sdk/engage/types/template-schema.js +1 -1
  123. package/dist/sdk/engage.js +1 -1
  124. package/dist/sdk/errors.js +1 -1
  125. package/dist/sdk/index.js +1 -1
  126. package/dist/sdk/io/index.js +1 -1
  127. package/dist/sdk/io/node-filesystem.js +1 -1
  128. package/dist/sdk/job.js +1 -1
  129. package/dist/sdk/journey.js +1 -1
  130. package/dist/sdk/llm/chat-cache.js +1 -1
  131. package/dist/sdk/llm/index.js +1 -1
  132. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  133. package/dist/sdk/llm/model-factors.js +1 -1
  134. package/dist/sdk/personalization.js +1 -1
  135. package/dist/sdk/policy.js +1 -1
  136. package/dist/sdk/query/index.js +1 -1
  137. package/dist/sdk/query/sql-parser.js +1 -1
  138. package/dist/sdk/realtime.js +1 -1
  139. package/dist/sdk/schedule.js +1 -1
  140. package/dist/sdk/segment/child-segment-yaml.d.ts +4 -1
  141. package/dist/sdk/segment/child-segment-yaml.d.ts.map +1 -1
  142. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  143. package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
  144. package/dist/sdk/segment/fields-display.js +1 -1
  145. package/dist/sdk/segment/file-discovery.js +1 -1
  146. package/dist/sdk/segment/journey-utils.js +1 -1
  147. package/dist/sdk/segment/journey-validator.js +1 -1
  148. package/dist/sdk/segment/journey-yaml.js +1 -1
  149. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  150. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  151. package/dist/sdk/segment/pull-workflow.js +1 -1
  152. package/dist/sdk/segment/push-recovery.js +1 -1
  153. package/dist/sdk/segment/push-workflow.js +1 -1
  154. package/dist/sdk/segment/resolution-context.js +1 -1
  155. package/dist/sdk/segment/segment-path-parser.js +1 -1
  156. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  157. package/dist/sdk/segment/segment-validator.js +1 -1
  158. package/dist/sdk/segment/target-resolution.js +1 -1
  159. package/dist/sdk/segment/tdx-config.js +1 -1
  160. package/dist/sdk/segment/types/activation-schema.js +1 -1
  161. package/dist/sdk/segment/types/journey-def.js +1 -1
  162. package/dist/sdk/segment/types/journey-schema.js +1 -1
  163. package/dist/sdk/segment/types/segment-def.js +1 -1
  164. package/dist/sdk/segment/types/segment-schema.js +1 -1
  165. package/dist/sdk/segment/validate-files.js +1 -1
  166. package/dist/sdk/segment/yaml-validator.js +1 -1
  167. package/dist/sdk/segment.js +1 -1
  168. package/dist/sdk/types/index.js +1 -1
  169. package/dist/sdk/types/progress.js +1 -1
  170. package/dist/sdk/types/workspace.js +1 -1
  171. package/dist/sdk/user.js +1 -1
  172. package/dist/sdk/util/format-detector.js +1 -1
  173. package/dist/sdk/util/formatters.js +1 -1
  174. package/dist/sdk/util/index.js +1 -1
  175. package/dist/sdk/util/paginate.js +1 -1
  176. package/dist/sdk/util/tree-formatter.js +1 -1
  177. package/dist/sdk/workflow/archive-validation.js +1 -1
  178. package/dist/sdk/workflow/clone-workflow.js +1 -1
  179. package/dist/sdk/workflow/index.js +1 -1
  180. package/dist/sdk/workflow/pull-workflow.js +1 -1
  181. package/dist/sdk/workflow/push-workflow.js +1 -1
  182. package/dist/sdk/workflow/tdx-config.js +1 -1
  183. package/dist/sdk/workflow/workflow-utils.js +1 -1
  184. package/dist/sdk/workspace/frontmatter.js +1 -1
  185. package/dist/sdk/workspace/git.js +1 -1
  186. package/dist/sdk/workspace/index.js +1 -1
  187. package/dist/sdk/workspace/templates.js +1 -1
  188. package/dist/sdk/workspace/weekly.js +1 -1
  189. package/dist/sdk/workspace/wikilinks.js +1 -1
  190. package/dist/test-utils/command-runner.js +1 -1
  191. package/dist/test-utils/factories.js +1 -1
  192. package/dist/test-utils/fixtures.js +1 -1
  193. package/dist/test-utils/http-mock.js +1 -1
  194. package/dist/test-utils/index.js +1 -1
  195. package/dist/utils/async.js +1 -1
  196. package/dist/utils/colors.js +1 -1
  197. package/dist/utils/diff.js +1 -1
  198. package/dist/utils/file-permissions.js +1 -1
  199. package/dist/utils/file-reader.js +1 -1
  200. package/dist/utils/github-releases.js +1 -1
  201. package/dist/utils/global-cache.js +1 -1
  202. package/dist/utils/json-loader.js +1 -1
  203. package/dist/utils/local-cache.js +1 -1
  204. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  205. package/dist/utils/logger/formatters/index.js +1 -1
  206. package/dist/utils/logger/handlers/console-handler.js +1 -1
  207. package/dist/utils/logger/handlers/file-handler.js +1 -1
  208. package/dist/utils/logger/handlers/index.js +1 -1
  209. package/dist/utils/logger/handlers/null-handler.js +1 -1
  210. package/dist/utils/logger/index.js +1 -1
  211. package/dist/utils/logger/logger.js +1 -1
  212. package/dist/utils/logger/types.js +1 -1
  213. package/dist/utils/option-validation.js +1 -1
  214. package/dist/utils/process.js +1 -1
  215. package/dist/utils/prompt.js +1 -1
  216. package/dist/utils/spinner.js +1 -1
  217. package/dist/utils/sse-parser.js +1 -1
  218. package/dist/utils/string-utils.js +1 -1
  219. package/dist/utils/table-ref-parser.js +1 -1
  220. package/dist/utils/tdx-logger.js +1 -1
  221. package/dist/utils/version-check.js +1 -1
  222. package/package.json +1 -1
@@ -1 +1 @@
1
- function a33_0x107f(_0x3addd9,_0x4736b0){_0x3addd9=_0x3addd9-0x173;const _0x2e1743=a33_0x2e17();let _0x107f8b=_0x2e1743[_0x3addd9];return _0x107f8b;}const a33_0x1fb440=a33_0x107f;(function(_0x54927f,_0x137a42){const _0x50aef4=a33_0x107f,_0x4f3dbc=_0x54927f();while(!![]){try{const _0x25871d=-parseInt(_0x50aef4(0x181))/0x1+parseInt(_0x50aef4(0x1aa))/0x2*(-parseInt(_0x50aef4(0x173))/0x3)+parseInt(_0x50aef4(0x193))/0x4*(parseInt(_0x50aef4(0x190))/0x5)+-parseInt(_0x50aef4(0x1af))/0x6*(-parseInt(_0x50aef4(0x1a6))/0x7)+parseInt(_0x50aef4(0x176))/0x8*(-parseInt(_0x50aef4(0x1a3))/0x9)+parseInt(_0x50aef4(0x17f))/0xa*(-parseInt(_0x50aef4(0x1b2))/0xb)+parseInt(_0x50aef4(0x19b))/0xc;if(_0x25871d===_0x137a42)break;else _0x4f3dbc['push'](_0x4f3dbc['shift']());}catch(_0x596aea){_0x4f3dbc['push'](_0x4f3dbc['shift']());}}}(a33_0x2e17,0x4b87f));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a33_0x64c7af from'chalk';function a33_0x2e17(){const _0x5a5692=['data','administrator','operation','policy\x20list','25305MYtMAT','log','email','284uWghjq','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','account_id','listPolicies','getMyPermissions','\x20polic','Member','site','12934020FrzSYy','getPolicy','description','\x20user','length','📋\x20Assigned\x20Policies','user','No\x20policies\x20found','3547683ZtHwpm','verbose','execute','7EecadT','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','\x20\x20No\x20permissions',',\x20user_id:','4996GTkHcF','\x20assigned','name','(ID:\x20','👥\x20Assigned\x20Users','1422192YPAxts','bold','all','11781XaIQGK','231CmYBDG','getCurrent','Fetching\x20permissions...','8HoyouX','ies','context','validate','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','permissions','\x20\x20•\x20','getPolicyPermissions','policy\x20show','5210EDmVfP','error','220299DgQUky','max','\x20\x20No\x20policies\x20assigned','Account\x20Owner','\x20\x20\x20','dim','map','padEnd','policy','join','args'];a33_0x2e17=function(){return _0x5a5692;};return a33_0x2e17();}export class PolicyCommand extends BaseCommand{[a33_0x1fb440(0x1ac)]=a33_0x1fb440(0x189);[a33_0x1fb440(0x19d)]=a33_0x1fb440(0x17a);async[a33_0x1fb440(0x1a5)](_0x23c91f){const _0x3a3730=a33_0x1fb440,{options:_0x3bcf9c,tdx:_0x1de6a3}=_0x23c91f,_0x5532ad=await withSpinner(_0x3a3730(0x175),async()=>{const _0x38a72f=_0x3a3730,[_0x1ffcce,_0x2e3c4c]=await Promise[_0x38a72f(0x1b1)]([_0x1de6a3[_0x38a72f(0x1a1)][_0x38a72f(0x174)](),_0x1de6a3[_0x38a72f(0x189)][_0x38a72f(0x197)]()]);return{'userInfo':_0x1ffcce,'permissions':_0x2e3c4c};},{'verbose':_0x3bcf9c[_0x3a3730(0x1a4)]}),{userInfo:_0x3dcec0,permissions:_0x4604a2}=_0x5532ad[_0x3a3730(0x18c)];if(isStructuredFormat(_0x3bcf9c))return await handleSingleObjectOutput(_0x4604a2,_0x3bcf9c),0x0;const _0x4236dd=_0x3dcec0['account_owner']?_0x3a3730(0x184):_0x3dcec0[_0x3a3730(0x18d)]?'Administrator':_0x3a3730(0x199);console[_0x3a3730(0x191)]('\x0a'+a33_0x64c7af[_0x3a3730(0x1b0)]('👤')+'\x20'+a33_0x64c7af['bold'](_0x3dcec0[_0x3a3730(0x1ac)])+'\x20'+a33_0x64c7af[_0x3a3730(0x186)]('('+_0x3dcec0['email']+')')+'\x20—\x20'+_0x4236dd),console['log'](a33_0x64c7af[_0x3a3730(0x186)]('\x20\x20\x20'+_0x1de6a3[_0x3a3730(0x178)][_0x3a3730(0x19a)]+':'+_0x3dcec0[_0x3a3730(0x195)]+_0x3a3730(0x1a9)+_0x3dcec0['id']));const _0x5ee7df=_0x4604a2['policies'];console[_0x3a3730(0x191)]('\x0a'+a33_0x64c7af[_0x3a3730(0x1b0)](_0x3a3730(0x1a0))+'\x20('+_0x5ee7df[_0x3a3730(0x19f)]+'):');if(_0x5ee7df['length']===0x0)console[_0x3a3730(0x191)](a33_0x64c7af[_0x3a3730(0x186)](_0x3a3730(0x183)));else for(const _0x418a67 of _0x5ee7df){console[_0x3a3730(0x191)](_0x3a3730(0x17c)+_0x418a67['name']);}return printPermissionsMap(_0x4604a2[_0x3a3730(0x17b)]),console[_0x3a3730(0x191)](),0x0;}}export class PolicyListCommand extends BaseCommand{['name']=a33_0x1fb440(0x18f);['description']='List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)';async[a33_0x1fb440(0x1a5)](_0x1550fe){const _0x4f57b0=a33_0x1fb440,{options:_0xb4982f,tdx:_0x5d8304}=_0x1550fe,_0x4b7658=await withSpinner('Listing\x20policies...',()=>_0x5d8304[_0x4f57b0(0x189)][_0x4f57b0(0x196)](),{'verbose':_0xb4982f[_0x4f57b0(0x1a4)]}),_0x2a97c7=_0x4b7658[_0x4f57b0(0x18c)];console[_0x4f57b0(0x180)]('✔\x20Found\x20'+_0x2a97c7['length']+_0x4f57b0(0x198)+(_0x2a97c7[_0x4f57b0(0x19f)]!==0x1?_0x4f57b0(0x177):'y'));if(isStructuredFormat(_0xb4982f))return await handleSDKOutput(_0x2a97c7,_0xb4982f),0x0;if(_0x2a97c7[_0x4f57b0(0x19f)]===0x0)console[_0x4f57b0(0x191)](a33_0x64c7af[_0x4f57b0(0x186)](_0x4f57b0(0x1a2)));else for(const _0x4bb7ff of _0x2a97c7){const _0x127751=_0x4bb7ff[_0x4f57b0(0x19d)]?a33_0x64c7af[_0x4f57b0(0x186)]('\x20—\x20'+_0x4bb7ff['description']):'';console[_0x4f57b0(0x191)](_0x4f57b0(0x17c)+_0x4bb7ff[_0x4f57b0(0x1ac)]+_0x127751);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a33_0x1fb440(0x1ac)]=a33_0x1fb440(0x17e);[a33_0x1fb440(0x19d)]=a33_0x1fb440(0x194);[a33_0x1fb440(0x179)](_0xeddc2d){const _0x38c909=a33_0x1fb440;if(_0xeddc2d[_0x38c909(0x18b)][_0x38c909(0x19f)]===0x0)return _0x38c909(0x1a7);return undefined;}async[a33_0x1fb440(0x1a5)](_0x5ee831){const _0x281db9=a33_0x1fb440,{options:_0x57fbda,tdx:_0x2287c8}=_0x5ee831,_0x298f74=_0x5ee831['args'][0x0],_0x666a64=await withSpinner('Fetching\x20policy...',async()=>{const _0x43dae2=a33_0x107f,_0x2280e1=await _0x2287c8[_0x43dae2(0x189)][_0x43dae2(0x19c)](_0x298f74),[_0x41c258,_0x158e1c]=await Promise[_0x43dae2(0x1b1)]([_0x2287c8['policy'][_0x43dae2(0x17d)](_0x2280e1['id']),_0x2287c8[_0x43dae2(0x189)]['getPolicyUsers'](_0x2280e1['id'])]);return{'policy':_0x2280e1,'perms':_0x41c258,'users':_0x158e1c};},{'verbose':_0x57fbda[_0x281db9(0x1a4)]}),{policy:_0x47e61e,perms:_0x32cc73,users:_0x355582}=_0x666a64[_0x281db9(0x18c)];if(isStructuredFormat(_0x57fbda))return await handleSingleObjectOutput({..._0x47e61e,'permissions':_0x32cc73[_0x281db9(0x17b)],'users':_0x355582},_0x57fbda),0x0;console['log']('\x0a'+a33_0x64c7af[_0x281db9(0x1b0)]('📋')+'\x20'+a33_0x64c7af[_0x281db9(0x1b0)](_0x47e61e[_0x281db9(0x1ac)])+'\x20'+a33_0x64c7af[_0x281db9(0x186)](_0x281db9(0x1ad)+_0x47e61e['id']+')'));_0x47e61e[_0x281db9(0x19d)]&&console['log'](_0x281db9(0x185)+a33_0x64c7af[_0x281db9(0x186)](_0x47e61e[_0x281db9(0x19d)]));console['log'](_0x281db9(0x185)+_0x355582[_0x281db9(0x19f)]+_0x281db9(0x19e)+(_0x355582['length']!==0x1?'s':'')+_0x281db9(0x1ab)),printPermissionsMap(_0x32cc73[_0x281db9(0x17b)]);if(_0x355582[_0x281db9(0x19f)]>0x0){console[_0x281db9(0x191)]('\x0a'+a33_0x64c7af[_0x281db9(0x1b0)](_0x281db9(0x1ae))+':');for(const _0x56493e of _0x355582){const _0x3c65da=_0x56493e['email']&&_0x56493e[_0x281db9(0x192)]!==_0x56493e[_0x281db9(0x1ac)]?a33_0x64c7af['dim']('\x20<'+_0x56493e[_0x281db9(0x192)]+'>'):'';console[_0x281db9(0x191)](_0x281db9(0x17c)+_0x56493e[_0x281db9(0x1ac)]+_0x3c65da);}}return console['log'](),0x0;}}function printPermissionsMap(_0x187dcb){const _0x172b56=a33_0x1fb440,_0x43d958=Object['entries'](_0x187dcb);console[_0x172b56(0x191)]('\x0a'+a33_0x64c7af['bold']('🔑\x20Effective\x20Permissions')+':');if(_0x43d958[_0x172b56(0x19f)]===0x0){console[_0x172b56(0x191)](a33_0x64c7af['dim'](_0x172b56(0x1a8)));return;}const _0xda628c=Math[_0x172b56(0x182)](..._0x43d958[_0x172b56(0x187)](([_0x1ab471])=>_0x1ab471[_0x172b56(0x19f)]));for(const [_0x48dbe5,_0x476d22]of _0x43d958){const _0x26d409=formatOperations(_0x476d22);console[_0x172b56(0x191)]('\x20\x20'+_0x48dbe5[_0x172b56(0x188)](_0xda628c+0x2)+_0x26d409);}}function formatOperations(_0x2ffeda){const _0x3f641a=a33_0x1fb440,_0x5c5362=[...new Set(_0x2ffeda['map'](_0x4d60ce=>_0x4d60ce[_0x3f641a(0x18e)]))];return _0x5c5362[_0x3f641a(0x18a)](',\x20');}
1
+ const a33_0x64bf40=a33_0x3058;function a33_0x3058(_0x651657,_0x1a4ba5){_0x651657=_0x651657-0xa7;const _0xa167b8=a33_0xa167();let _0x305834=_0xa167b8[_0x651657];return _0x305834;}(function(_0x17e742,_0x2f815d){const _0x583b57=a33_0x3058,_0x22751d=_0x17e742();while(!![]){try{const _0x4139f5=-parseInt(_0x583b57(0xab))/0x1+-parseInt(_0x583b57(0xb1))/0x2*(parseInt(_0x583b57(0xc7))/0x3)+parseInt(_0x583b57(0xad))/0x4+-parseInt(_0x583b57(0xe3))/0x5+parseInt(_0x583b57(0xbc))/0x6+parseInt(_0x583b57(0xd8))/0x7*(parseInt(_0x583b57(0xb3))/0x8)+parseInt(_0x583b57(0xb0))/0x9*(parseInt(_0x583b57(0xb6))/0xa);if(_0x4139f5===_0x2f815d)break;else _0x22751d['push'](_0x22751d['shift']());}catch(_0x206862){_0x22751d['push'](_0x22751d['shift']());}}}(a33_0xa167,0x915d2));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a33_0x2d2cc3 from'chalk';export class PolicyCommand extends BaseCommand{[a33_0x64bf40(0xc6)]='policy';['description']=a33_0x64bf40(0xc5);async[a33_0x64bf40(0xd7)](_0x2c4480){const _0xec56fe=a33_0x64bf40,{options:_0x28cfc5,tdx:_0x5ddc9e}=_0x2c4480,_0x3f6b95=await withSpinner(_0xec56fe(0xe4),async()=>{const _0x19547d=_0xec56fe,[_0x5b4611,_0x2ac6e5]=await Promise[_0x19547d(0xb4)]([_0x5ddc9e[_0x19547d(0xce)][_0x19547d(0xd4)](),_0x5ddc9e[_0x19547d(0xaf)][_0x19547d(0xda)]()]);return{'userInfo':_0x5b4611,'permissions':_0x2ac6e5};},{'verbose':_0x28cfc5[_0xec56fe(0xc2)]}),{userInfo:_0xc36a4e,permissions:_0x553944}=_0x3f6b95['data'];if(isStructuredFormat(_0x28cfc5))return await handleSingleObjectOutput(_0x553944,_0x28cfc5),0x0;const _0x28712f=_0xc36a4e['account_owner']?_0xec56fe(0xca):_0xc36a4e[_0xec56fe(0xc4)]?'Administrator':'Member';console[_0xec56fe(0xcf)]('\x0a'+a33_0x2d2cc3['bold']('👤')+'\x20'+a33_0x2d2cc3[_0xec56fe(0xa9)](_0xc36a4e['name'])+'\x20'+a33_0x2d2cc3[_0xec56fe(0xac)]('('+_0xc36a4e[_0xec56fe(0xcb)]+')')+_0xec56fe(0xbe)+_0x28712f),console['log'](a33_0x2d2cc3[_0xec56fe(0xac)](_0xec56fe(0xba)+_0x5ddc9e[_0xec56fe(0xc9)][_0xec56fe(0xb5)]+':'+_0xc36a4e[_0xec56fe(0xd0)]+_0xec56fe(0xe2)+_0xc36a4e['id']));const _0x3ec8f7=_0x553944['policies'];console[_0xec56fe(0xcf)]('\x0a'+a33_0x2d2cc3[_0xec56fe(0xa9)](_0xec56fe(0xd3))+'\x20('+_0x3ec8f7['length']+'):');if(_0x3ec8f7[_0xec56fe(0xdf)]===0x0)console[_0xec56fe(0xcf)](a33_0x2d2cc3[_0xec56fe(0xac)](_0xec56fe(0xb8)));else for(const _0xaaf00d of _0x3ec8f7){console[_0xec56fe(0xcf)]('\x20\x20•\x20'+_0xaaf00d['name']);}return printPermissionsMap(_0x553944[_0xec56fe(0xc3)]),console[_0xec56fe(0xcf)](),0x0;}}function a33_0xa167(){const _0x1f6dcd=['1802228gsByRK','args','policy','4581juyzfm','2Isvedy','ies','691224GSPUqE','all','site','36110MfrJns','max','\x20\x20No\x20policies\x20assigned','getPolicy','\x20\x20\x20','\x20user','118992tlBjQi','Fetching\x20policy...','\x20—\x20','description','error','No\x20policies\x20found','verbose','permissions','administrator','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','name','2803791xoVhKN','entries','context','Account\x20Owner','email','✔\x20Found\x20','policy\x20show','user','log','account_id','\x20assigned','padEnd','📋\x20Assigned\x20Policies','getCurrent','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','execute','35gPnWAN','\x20\x20No\x20permissions','getMyPermissions','data','🔑\x20Effective\x20Permissions','\x20polic','map','length','join','operation',',\x20user_id:','622745WaFNKr','Fetching\x20permissions...','\x20\x20•\x20','getPolicyUsers','listPolicies','bold','(ID:\x20','1085847hRWpfh','dim'];a33_0xa167=function(){return _0x1f6dcd;};return a33_0xa167();}export class PolicyListCommand extends BaseCommand{[a33_0x64bf40(0xc6)]='policy\x20list';[a33_0x64bf40(0xbf)]=a33_0x64bf40(0xd6);async[a33_0x64bf40(0xd7)](_0xa3e271){const _0x19fc2f=a33_0x64bf40,{options:_0x1f5362,tdx:_0x139ba3}=_0xa3e271,_0x405db0=await withSpinner('Listing\x20policies...',()=>_0x139ba3[_0x19fc2f(0xaf)][_0x19fc2f(0xa8)](),{'verbose':_0x1f5362['verbose']}),_0x3e6fca=_0x405db0['data'];console[_0x19fc2f(0xc0)](_0x19fc2f(0xcc)+_0x3e6fca[_0x19fc2f(0xdf)]+_0x19fc2f(0xdd)+(_0x3e6fca[_0x19fc2f(0xdf)]!==0x1?_0x19fc2f(0xb2):'y'));if(isStructuredFormat(_0x1f5362))return await handleSDKOutput(_0x3e6fca,_0x1f5362),0x0;if(_0x3e6fca[_0x19fc2f(0xdf)]===0x0)console[_0x19fc2f(0xcf)](a33_0x2d2cc3['dim'](_0x19fc2f(0xc1)));else for(const _0x46a70a of _0x3e6fca){const _0x41b2bb=_0x46a70a[_0x19fc2f(0xbf)]?a33_0x2d2cc3['dim'](_0x19fc2f(0xbe)+_0x46a70a[_0x19fc2f(0xbf)]):'';console[_0x19fc2f(0xcf)]('\x20\x20•\x20'+_0x46a70a[_0x19fc2f(0xc6)]+_0x41b2bb);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a33_0x64bf40(0xc6)]=a33_0x64bf40(0xcd);[a33_0x64bf40(0xbf)]=a33_0x64bf40(0xd5);['validate'](_0x5a9469){const _0x2f91d9=a33_0x64bf40;if(_0x5a9469['args'][_0x2f91d9(0xdf)]===0x0)return'Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>';return undefined;}async[a33_0x64bf40(0xd7)](_0x46e4ba){const _0x4cb929=a33_0x64bf40,{options:_0x54ee35,tdx:_0x3debe5}=_0x46e4ba,_0x147d07=_0x46e4ba[_0x4cb929(0xae)][0x0],_0x327151=await withSpinner(_0x4cb929(0xbd),async()=>{const _0x41fb8a=_0x4cb929,_0x390290=await _0x3debe5[_0x41fb8a(0xaf)][_0x41fb8a(0xb9)](_0x147d07),[_0x1ead33,_0xc26d99]=await Promise[_0x41fb8a(0xb4)]([_0x3debe5[_0x41fb8a(0xaf)]['getPolicyPermissions'](_0x390290['id']),_0x3debe5['policy'][_0x41fb8a(0xa7)](_0x390290['id'])]);return{'policy':_0x390290,'perms':_0x1ead33,'users':_0xc26d99};},{'verbose':_0x54ee35[_0x4cb929(0xc2)]}),{policy:_0x9340fd,perms:_0x4d1a1a,users:_0x3ce520}=_0x327151[_0x4cb929(0xdb)];if(isStructuredFormat(_0x54ee35))return await handleSingleObjectOutput({..._0x9340fd,'permissions':_0x4d1a1a['permissions'],'users':_0x3ce520},_0x54ee35),0x0;console[_0x4cb929(0xcf)]('\x0a'+a33_0x2d2cc3[_0x4cb929(0xa9)]('📋')+'\x20'+a33_0x2d2cc3['bold'](_0x9340fd[_0x4cb929(0xc6)])+'\x20'+a33_0x2d2cc3['dim'](_0x4cb929(0xaa)+_0x9340fd['id']+')'));_0x9340fd[_0x4cb929(0xbf)]&&console[_0x4cb929(0xcf)](_0x4cb929(0xba)+a33_0x2d2cc3['dim'](_0x9340fd[_0x4cb929(0xbf)]));console[_0x4cb929(0xcf)](_0x4cb929(0xba)+_0x3ce520['length']+_0x4cb929(0xbb)+(_0x3ce520[_0x4cb929(0xdf)]!==0x1?'s':'')+_0x4cb929(0xd1)),printPermissionsMap(_0x4d1a1a[_0x4cb929(0xc3)]);if(_0x3ce520[_0x4cb929(0xdf)]>0x0){console['log']('\x0a'+a33_0x2d2cc3['bold']('👥\x20Assigned\x20Users')+':');for(const _0x15253e of _0x3ce520){const _0x257ef1=_0x15253e[_0x4cb929(0xcb)]&&_0x15253e[_0x4cb929(0xcb)]!==_0x15253e['name']?a33_0x2d2cc3[_0x4cb929(0xac)]('\x20<'+_0x15253e['email']+'>'):'';console[_0x4cb929(0xcf)](_0x4cb929(0xe5)+_0x15253e[_0x4cb929(0xc6)]+_0x257ef1);}}return console[_0x4cb929(0xcf)](),0x0;}}function printPermissionsMap(_0xceb0ad){const _0x1751ec=a33_0x64bf40,_0x1a5170=Object[_0x1751ec(0xc8)](_0xceb0ad);console[_0x1751ec(0xcf)]('\x0a'+a33_0x2d2cc3[_0x1751ec(0xa9)](_0x1751ec(0xdc))+':');if(_0x1a5170['length']===0x0){console[_0x1751ec(0xcf)](a33_0x2d2cc3[_0x1751ec(0xac)](_0x1751ec(0xd9)));return;}const _0x39d850=Math[_0x1751ec(0xb7)](..._0x1a5170['map'](([_0x2d2657])=>_0x2d2657[_0x1751ec(0xdf)]));for(const [_0x5ce72a,_0x30cbe2]of _0x1a5170){const _0xc67274=formatOperations(_0x30cbe2);console['log']('\x20\x20'+_0x5ce72a[_0x1751ec(0xd2)](_0x39d850+0x2)+_0xc67274);}}function formatOperations(_0x3317db){const _0xbadf2c=a33_0x64bf40,_0x38cc28=[...new Set(_0x3317db[_0xbadf2c(0xde)](_0xa0b8f6=>_0xa0b8f6[_0xbadf2c(0xe1)]))];return _0x38cc28[_0xbadf2c(0xe0)](',\x20');}
@@ -1 +1 @@
1
- const a34_0xe1bbbd=a34_0x1b43;(function(_0x2e894b,_0x40065f){const _0x57ccf9=a34_0x1b43,_0x159533=_0x2e894b();while(!![]){try{const _0x53cc82=parseInt(_0x57ccf9(0xf7))/0x1+-parseInt(_0x57ccf9(0x101))/0x2+-parseInt(_0x57ccf9(0x128))/0x3*(parseInt(_0x57ccf9(0x134))/0x4)+parseInt(_0x57ccf9(0x122))/0x5+-parseInt(_0x57ccf9(0xff))/0x6+parseInt(_0x57ccf9(0xef))/0x7+parseInt(_0x57ccf9(0xfb))/0x8*(parseInt(_0x57ccf9(0x13c))/0x9);if(_0x53cc82===_0x40065f)break;else _0x159533['push'](_0x159533['shift']());}catch(_0x14638a){_0x159533['push'](_0x159533['shift']());}}}(a34_0x3a80,0xf2262));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a34_0x2edced 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 a34_0x1b43(_0x165687,_0x1f45b1){_0x165687=_0x165687-0xe7;const _0x3a80af=a34_0x3a80();let _0x1b4302=_0x3a80af[_0x165687];return _0x1b4302;}import{runOAuthLoginFlow}from'./auth-login-command.js';import{isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';function a34_0x3a80(){const _0x58a634=['1895148qQkuXu','Changing\x20site\x20to\x20\x27','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','/app/mp/ak','default','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','getUserInfo','profile','us01','\x20\x20tdx\x20--profile\x20','llm_agent','\x27.\x0a\x0aValid\x20keys:\x20','profile:create','\x20API\x20key\x20removed\x20from\x20system\x20keychain','bold','create','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x27\x20updated:\x20','\x27\x20does\x20not\x20exist.','log','split','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','length','Create\x20a\x20new\x20profile','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','API\x20key\x20cannot\x20be\x20empty','validate','ERROR','config','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','name','1790475UKHduP','\x20Profile\x20\x27','\x20API\x20key\x20is\x20valid\x20(User:\x20','message','oauth','session','6246TQYdGy','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>','Set\x20session\x20profile','Enter\x20your\x20TD\x20API\x20key:','includes','apiKey','\x0aAvailable\x20profiles:','join','\x27\x20requires\x20API\x20key\x20validation.','dim','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','status','3596AfXPzS','Removal\x20cancelled','Choose\x20authentication\x20method:','\x0aOperation\x20cancelled','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','✗\x20Validation\x20failed:\x20','database','logLevel','7083qYufPx','warn','(cleared)','test','VALID_KEYS','method','tdx.json','trim','text','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Enter\x20description\x20(optional):','Profile\x20\x27','site','tdx:\x20profile\x20remove','password','\x27\x20removed\x20from\x20configuration','description','Remove\x20a\x20profile','profile:set','Default\x20profile\x20set\x20to:\x20','tdx:\x20profile\x20set','(session:\x20','Operation\x20cancelled','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','error','Validating\x20API\x20key...','Profile\x20name\x20cannot\x20be\x20empty','\x20\x20-\x20','\x20--default\x27\x20to\x20save\x20permanently','parent_segment','confirm','execute','red','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','\x0aSetup\x20cancelled','Enter\x20profile\x20name:','green','9319324iKxDSk','Set\x20a\x20profile\x20configuration\x20value','\x20\x20(no\x20profiles\x20found)','Failed\x20to\x20remove\x20profile:\x20','jobs','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','Setup\x20cancelled','271428qnQOCL','tdx:\x20profile\x20create','profile:use','Site\x20was\x20not\x20changed.','27304jddeXt','email','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','profileName','5014512LAgjAg','yellow'];a34_0x3a80=function(){return _0x58a634;};return a34_0x3a80();}import a34_0x737734 from'prompts';import a34_0x1907ae from'chalk';function validateProfileName(_0x1171ec){const _0x74810=a34_0x1b43;if(!_0x1171ec||!_0x1171ec[_0x74810(0x143)]())return _0x74810(0x156);const _0x4cfd31=_0x1171ec['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x74810(0x13f)](_0x4cfd31))return _0x74810(0x11f);if(profileExists(_0x4cfd31))return _0x74810(0x147)+_0x4cfd31+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{['name']=a34_0xe1bbbd(0x10e);[a34_0xe1bbbd(0x14c)]=a34_0xe1bbbd(0x119);async[a34_0xe1bbbd(0xe9)](_0xa4e4b5){const _0xfde55d=a34_0xe1bbbd,{options:_0x6b516,args:_0xc633f0}=_0xa4e4b5;console[_0xfde55d(0x115)](a34_0x1907ae['bold'](_0xfde55d(0xf8)));let _0x59a555;if(_0xc633f0[_0xfde55d(0x118)]>0x0&&_0xc633f0[0x0]){const _0x21f8ec=_0xc633f0[0x0][_0xfde55d(0x143)](),_0x3039d5=validateProfileName(_0x21f8ec);if(_0x3039d5!==!![])return console[_0xfde55d(0x154)](a34_0x1907ae['red'](_0x3039d5)),0x1;_0x59a555=_0x21f8ec;}else{const _0x1e0b1b=await a34_0x737734({'type':_0xfde55d(0x144),'name':_0xfde55d(0xfe),'message':_0xfde55d(0xed),'validate':validateProfileName});if(!_0x1e0b1b[_0xfde55d(0xfe)])return console[_0xfde55d(0x115)](_0xfde55d(0xec)),0x1;_0x59a555=_0x1e0b1b[_0xfde55d(0xfe)][_0xfde55d(0x143)]();}const _0x87f3f7=await a34_0x737734({'type':_0xfde55d(0x144),'name':_0xfde55d(0x14c),'message':_0xfde55d(0x146)}),_0xcda8e8=_0x87f3f7['description']?.[_0xfde55d(0x143)]()||undefined,_0xbffbd5=_0x6b516['site']||_0xfde55d(0x10a),_0x495da8=await promptSiteSelection(_0xbffbd5,_0x59a555,_0xfde55d(0xf6));if(!_0x495da8)return 0x1;const _0x59161a=resolveSite(_0x495da8);if(isOAuthSupported(_0x59161a)){const _0x4655f5=await a34_0x737734({'type':'select','name':_0xfde55d(0x141),'message':_0xfde55d(0x136),'choices':[{'title':'OAuth\x20(browser\x20login)','value':'oauth'},{'title':'API\x20Key','value':'apikey'}]});if(!_0x4655f5['method'])return console[_0xfde55d(0x115)](_0xfde55d(0xec)),0x1;if(_0x4655f5[_0xfde55d(0x141)]===_0xfde55d(0x126)){if(_0xcda8e8){const _0x24aa1e={'site':_0x59161a,'description':_0xcda8e8};saveProfileToUserConfig(_0x59a555,_0x24aa1e);}return await runOAuthLoginFlow(_0x59161a,_0x59a555,_0x6b516['logLevel']??LogLevel['ERROR']),0x0;}}console[_0xfde55d(0x115)](_0xfde55d(0x117)+_0x59161a),console[_0xfde55d(0x115)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0xfde55d(0x115)]('\x20\x20'+getConsoleUrl(_0x59161a,'/app/mp/ak'));const _0x410f5b=await a34_0x737734({'type':'password','name':_0xfde55d(0x12d),'message':_0xfde55d(0x12b),'validate':_0x3f8fa2=>{const _0xbcc669=_0xfde55d;if(!_0x3f8fa2||!_0x3f8fa2[_0xbcc669(0x143)]())return _0xbcc669(0x11b);return!![];}});if(!_0x410f5b['apiKey'])return console[_0xfde55d(0x115)](_0xfde55d(0xec)),0x1;const _0x137531=_0x410f5b[_0xfde55d(0x12d)];console['log'](_0xfde55d(0x155));try{const _0x2a55ac=TDX[_0xfde55d(0x111)]({'site':_0x59161a,'apiKey':_0x137531[_0xfde55d(0x143)](),'logLevel':_0x6b516[_0xfde55d(0x13b)]??LogLevel[_0xfde55d(0x11d)]}),_0x599837=await _0x2a55ac['jobs'][_0xfde55d(0x108)]();console[_0xfde55d(0x115)](a34_0x1907ae[_0xfde55d(0xee)]('✓')+_0xfde55d(0x124)+_0x599837[_0xfde55d(0xfc)]+')');const _0x2603e0=await isKeychainAvailable();_0x2603e0?(await saveAPIKeyAsync(_0x137531['trim'](),_0x59161a,_0x59a555),console['log'](a34_0x1907ae[_0xfde55d(0xee)]('✓')+_0xfde55d(0x104)+_0x59a555+')')):(console['warn'](a34_0x1907ae[_0xfde55d(0x100)](_0xfde55d(0x120))),console[_0xfde55d(0x13d)](a34_0x1907ae[_0xfde55d(0x100)](_0xfde55d(0x138))));const _0x3c9f20={'site':_0x59161a,..._0xcda8e8&&{'description':_0xcda8e8}};return saveProfileToUserConfig(_0x59a555,_0x3c9f20),console[_0xfde55d(0x115)](a34_0x1907ae[_0xfde55d(0xee)]('✓')+_0xfde55d(0x123)+_0x59a555+'\x27\x20created'),console[_0xfde55d(0x115)](),console[_0xfde55d(0x115)](_0xfde55d(0x107)),console[_0xfde55d(0x115)](_0xfde55d(0x10b)+_0x59a555+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console['log'](_0xfde55d(0x10b)+_0x59a555+_0xfde55d(0x153)),0x0;}catch(_0x557659){if(_0x557659 instanceof HTTPClientError&&_0x557659[_0xfde55d(0x133)]===0x191)return printAuthError(_0x557659),0x1;return console[_0xfde55d(0x154)](a34_0x1907ae[_0xfde55d(0xea)](_0xfde55d(0x139)+(_0x557659 instanceof Error?_0x557659['message']:String(_0x557659)))),console[_0xfde55d(0x154)](_0xfde55d(0x132)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a34_0xe1bbbd(0x121)]='profile:remove';[a34_0xe1bbbd(0x14c)]=a34_0xe1bbbd(0x14d);[a34_0xe1bbbd(0x11c)](_0x1169d0){const _0x185e99=a34_0xe1bbbd,{args:_0x4c0b90}=_0x1169d0;if(_0x4c0b90['length']===0x0)return _0x185e99(0xeb);return undefined;}async[a34_0xe1bbbd(0xe9)](_0x28e3fc){const _0x3ec2e6=a34_0xe1bbbd,{args:_0x175a5d}=_0x28e3fc,_0x18dace=_0x175a5d[0x0];console[_0x3ec2e6(0x115)](a34_0x1907ae[_0x3ec2e6(0x110)](_0x3ec2e6(0x149)));if(!profileExists(_0x18dace)){console[_0x3ec2e6(0x154)](a34_0x1907ae['red'](_0x3ec2e6(0x147)+_0x18dace+_0x3ec2e6(0x114))),console[_0x3ec2e6(0x115)](_0x3ec2e6(0x12e));const _0x4c8941=listProfiles();if(_0x4c8941[_0x3ec2e6(0x118)]===0x0)console['log'](_0x3ec2e6(0xf1));else for(const _0xc1b841 of _0x4c8941){console[_0x3ec2e6(0x115)](_0x3ec2e6(0x157)+_0xc1b841['name']);}return 0x1;}const _0x4038a3=await a34_0x737734({'type':_0x3ec2e6(0xe8),'name':_0x3ec2e6(0xe8),'message':_0x3ec2e6(0xf5)+_0x18dace+'\x27?','initial':![]});if(!_0x4038a3[_0x3ec2e6(0xe8)])return console['log'](_0x3ec2e6(0x135)),0x0;try{removeProfileFromUserConfig(_0x18dace),console['log'](a34_0x1907ae[_0x3ec2e6(0xee)]('✓')+_0x3ec2e6(0x123)+_0x18dace+_0x3ec2e6(0x14b));}catch(_0x5da1be){return console[_0x3ec2e6(0x154)](a34_0x1907ae['red'](_0x3ec2e6(0xf2)+(_0x5da1be instanceof Error?_0x5da1be[_0x3ec2e6(0x125)]:String(_0x5da1be)))),0x1;}const _0x137a07=await isKeychainAvailable();if(_0x137a07){const _0x35c18f=await deleteKeychainAPIKey(_0x18dace);_0x35c18f&&console['log'](a34_0x1907ae[_0x3ec2e6(0xee)]('✓')+_0x3ec2e6(0x10f));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a34_0xe1bbbd(0x121)]=a34_0xe1bbbd(0x14e);['description']=a34_0xe1bbbd(0xf0);static [a34_0xe1bbbd(0x140)]=[a34_0xe1bbbd(0x148),a34_0xe1bbbd(0x13a),a34_0xe1bbbd(0xe7),'llm_project',a34_0xe1bbbd(0x10c),a34_0xe1bbbd(0x14c)];[a34_0xe1bbbd(0x11c)](_0x3b5a23){const _0x357fe1=a34_0xe1bbbd,{args:_0x399629,options:_0x3a3751}=_0x3b5a23,_0x5caf31=_0x3a3751['profile']||getActiveProfile();if(!_0x5caf31)return _0x357fe1(0x129);if(_0x399629[_0x357fe1(0x118)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x357fe1(0x140)]['join'](',\x20');const _0xabc06d=_0x399629[0x0];if(!_0xabc06d[_0x357fe1(0x12c)]('='))return _0x357fe1(0xf4)+ProfileSetCommand[_0x357fe1(0x140)]['join'](',\x20');const [_0x4ff376]=_0xabc06d[_0x357fe1(0x116)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS']['includes'](_0x4ff376))return'Unknown\x20key\x20\x27'+_0x4ff376+_0x357fe1(0x10d)+ProfileSetCommand[_0x357fe1(0x140)][_0x357fe1(0x12f)](',\x20');return undefined;}async['execute'](_0x1db378){const _0x50f8f1=a34_0xe1bbbd,{args:_0x4eeabd,options:_0xd846f2}=_0x1db378,_0x38f829=_0xd846f2[_0x50f8f1(0x109)]||getActiveProfile(),[_0x41d230,..._0x2c529b]=_0x4eeabd[0x0]['split']('='),_0x5ebb2d=_0x2c529b['join']('=');console['log'](a34_0x1907ae[_0x50f8f1(0x110)](_0x50f8f1(0x150)));if(!profileExists(_0x38f829)){const _0x2423a9=await a34_0x737734({'type':'confirm','name':'create','message':_0x50f8f1(0x147)+_0x38f829+_0x50f8f1(0x103),'initial':!![]});if(!_0x2423a9[_0x50f8f1(0x111)])return console[_0x50f8f1(0x115)](_0x50f8f1(0x152)),0x1;}const _0x17e59d=loadProfile(_0x38f829),_0x591570=_0x17e59d?.[_0x50f8f1(0x11e)]||{};if(_0x41d230===_0x50f8f1(0x148)){const _0x5b6338=resolveSite(_0x5ebb2d);console['log'](_0x50f8f1(0x102)+_0x5b6338+_0x50f8f1(0x130)),console[_0x50f8f1(0x115)](_0x50f8f1(0x145)),console[_0x50f8f1(0x115)]('\x20\x20'+getConsoleUrl(_0x5b6338,_0x50f8f1(0x105)));const _0x33775c=await a34_0x737734({'type':_0x50f8f1(0x14a),'name':_0x50f8f1(0x12d),'message':_0x50f8f1(0xfd),'validate':_0x4e11d9=>{const _0x5177b5=_0x50f8f1;if(!_0x4e11d9||!_0x4e11d9[_0x5177b5(0x143)]())return _0x5177b5(0x11b);return!![];}});if(!_0x33775c[_0x50f8f1(0x12d)])return console['log'](_0x50f8f1(0x137)),0x1;console['log'](_0x50f8f1(0x155));try{const _0x492ed8=TDX['create']({'site':_0x5b6338,'apiKey':_0x33775c[_0x50f8f1(0x12d)][_0x50f8f1(0x143)](),'logLevel':_0xd846f2[_0x50f8f1(0x13b)]??LogLevel[_0x50f8f1(0x11d)]}),_0xf7f3cb=await _0x492ed8[_0x50f8f1(0xf3)]['getUserInfo']();console['log'](a34_0x1907ae['green']('✓')+_0x50f8f1(0x124)+_0xf7f3cb[_0x50f8f1(0xfc)]+')');const _0x270403=await isKeychainAvailable();_0x270403?(await saveAPIKeyAsync(_0x33775c['apiKey'][_0x50f8f1(0x143)](),_0x5b6338,_0x38f829),console['log'](a34_0x1907ae[_0x50f8f1(0xee)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x50f8f1(0x13d)](a34_0x1907ae[_0x50f8f1(0x100)](_0x50f8f1(0x120))),_0x591570[_0x50f8f1(0x148)]=_0x5b6338;}catch(_0x7d6fc5){if(_0x7d6fc5 instanceof HTTPClientError&&_0x7d6fc5[_0x50f8f1(0x133)]===0x191)return printAuthError(_0x7d6fc5),0x1;return console[_0x50f8f1(0x154)](a34_0x1907ae['red']('✗\x20Validation\x20failed:\x20'+(_0x7d6fc5 instanceof Error?_0x7d6fc5[_0x50f8f1(0x125)]:String(_0x7d6fc5)))),console[_0x50f8f1(0x154)](_0x50f8f1(0xfa)),0x1;}}else _0x591570[_0x41d230]=_0x5ebb2d||undefined;return saveProfileToUserConfig(_0x38f829,_0x591570),console[_0x50f8f1(0x115)](a34_0x1907ae[_0x50f8f1(0xee)]('✓')+_0x50f8f1(0x123)+_0x38f829+_0x50f8f1(0x113)+_0x41d230+'='+(_0x5ebb2d||_0x50f8f1(0x13e))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a34_0xe1bbbd(0x121)]=a34_0xe1bbbd(0xf9);[a34_0xe1bbbd(0x14c)]=a34_0xe1bbbd(0x12a);[a34_0xe1bbbd(0x11c)](_0x18865c){const _0x593302=a34_0xe1bbbd,{args:_0x22ab7b}=_0x18865c;if(_0x22ab7b[_0x593302(0x118)]===0x0)return _0x593302(0x11a);return undefined;}async[a34_0xe1bbbd(0xe9)](_0x4c64b2){const _0x26b63b=a34_0xe1bbbd,{args:_0x1b9bb9,options:_0x40950f}=_0x4c64b2,_0x5d6f61=_0x1b9bb9[0x0],_0x19a73e=_0x40950f[_0x26b63b(0x106)];cleanExpiredSessions();if(!profileExists(_0x5d6f61)){console[_0x26b63b(0x154)](a34_0x1907ae['red'](_0x26b63b(0x147)+_0x5d6f61+_0x26b63b(0x114))),console[_0x26b63b(0x115)](_0x26b63b(0x12e));const _0x3dc767=listProfiles();if(_0x3dc767['length']===0x0)console[_0x26b63b(0x115)](_0x26b63b(0xf1));else for(const _0x277f75 of _0x3dc767){console[_0x26b63b(0x115)](_0x26b63b(0x157)+_0x277f75[_0x26b63b(0x121)]);}return 0x1;}if(_0x19a73e){const _0x33aa4f=a34_0x2edced[_0x26b63b(0x12f)](getConfigDir(),_0x26b63b(0x142));return saveActiveProfileToUserConfig(_0x5d6f61),console[_0x26b63b(0x115)](_0x26b63b(0x14f)+a34_0x1907ae[_0x26b63b(0xee)](_0x5d6f61)),console[_0x26b63b(0x115)](a34_0x1907ae[_0x26b63b(0x131)]('\x0aSaved\x20to:\x20'+_0x33aa4f)),0x0;}const _0xc6878d=getSessionID(_0x40950f['session']);return saveSessionContext({'profile':_0x5d6f61},_0x40950f[_0x26b63b(0x127)]),console[_0x26b63b(0x115)]('Session\x20profile\x20set\x20to:\x20'+a34_0x1907ae['green'](_0x5d6f61)+'\x20'+a34_0x1907ae[_0x26b63b(0x131)](_0x26b63b(0x151)+_0xc6878d+')')),console['log'](a34_0x1907ae['dim'](_0x26b63b(0x112)+_0x5d6f61+_0x26b63b(0x158))),0x0;}}
1
+ const a34_0x57ee8c=a34_0x5d71;(function(_0x35d557,_0x35ffea){const _0x16da3a=a34_0x5d71,_0x293703=_0x35d557();while(!![]){try{const _0xceaa09=-parseInt(_0x16da3a(0x122))/0x1*(parseInt(_0x16da3a(0x147))/0x2)+-parseInt(_0x16da3a(0x14e))/0x3+-parseInt(_0x16da3a(0x10b))/0x4+-parseInt(_0x16da3a(0x134))/0x5*(-parseInt(_0x16da3a(0x121))/0x6)+parseInt(_0x16da3a(0x14d))/0x7*(parseInt(_0x16da3a(0x155))/0x8)+parseInt(_0x16da3a(0x149))/0x9+-parseInt(_0x16da3a(0x12a))/0xa*(-parseInt(_0x16da3a(0x156))/0xb);if(_0xceaa09===_0x35ffea)break;else _0x293703['push'](_0x293703['shift']());}catch(_0x2122b8){_0x293703['push'](_0x293703['shift']());}}}(a34_0x3e4e,0xaf58c));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a34_0xf719a3 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{runOAuthLoginFlow}from'./auth-login-command.js';import{isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';function a34_0x3e4e(){const _0x274097=['VALID_KEYS','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','join','\x20API\x20key\x20removed\x20from\x20system\x20keychain','11573440VlcDrl','oauth','profile','\x20API\x20key\x20saved\x20to\x20system\x20keychain','profile:create','error','confirm','\x27\x20created','\x0aSetup\x20cancelled','✗\x20Validation\x20failed:\x20','10dbJoJb','default','Choose\x20authentication\x20method:','validate','length','\x0aOperation\x20cancelled','Profile\x20\x27','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','tdx:\x20profile\x20set','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','/app/mp/ak','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>','Default\x20profile\x20set\x20to:\x20','\x27\x20does\x20not\x20exist.','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Set\x20a\x20profile\x20configuration\x20value','includes','You\x20can\x20find\x20your\x20API\x20key\x20at:','text','65710DWOJnJ','description','11859147ngtiTt','Removal\x20cancelled','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','Enter\x20your\x20TD\x20API\x20key:','5045957JUFqwQ','3590208jAYHLV','tdx:\x20profile\x20remove','API\x20Key','\x20Profile\x20\x27','method','OAuth\x20(browser\x20login)','Session\x20profile\x20set\x20to:\x20','8gGvEkn','11SmLHQz','green','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','yellow','logLevel','trim','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','tdx.json','apiKey','jobs','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Failed\x20to\x20remove\x20profile:\x20','ERROR','\x27\x20updated:\x20','email','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','Setup\x20cancelled','name','message','apikey','\x27\x20does\x20not\x20exist.\x20Create\x20it?','split','database','status','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','test','(cleared)','\x20\x20-\x20','\x20\x20(no\x20profiles\x20found)','\x27.\x0a\x0aValid\x20keys:\x20','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','profileName','getUserInfo','\x0aSaved\x20to:\x20','dim','site','\x20\x20tdx\x20--profile\x20','778980LDfvTg','red','create','config','warn','Operation\x20cancelled','\x27\x20removed\x20from\x20configuration','\x27\x20requires\x20API\x20key\x20validation.','us01','Enter\x20description\x20(optional):','execute','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','log','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','Remove\x20a\x20profile','llm_project','password','profile:set','bold','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','\x20API\x20key\x20is\x20valid\x20(User:\x20','Profile\x20name\x20cannot\x20be\x20empty','782634CXqyEP','41oUdvaV','Changing\x20site\x20to\x20\x27','select','Unknown\x20key\x20\x27'];a34_0x3e4e=function(){return _0x274097;};return a34_0x3e4e();}import a34_0x25024f from'prompts';function a34_0x5d71(_0x3b012e,_0x592f3b){_0x3b012e=_0x3b012e-0x101;const _0x3e4ed9=a34_0x3e4e();let _0x5d7101=_0x3e4ed9[_0x3b012e];return _0x5d7101;}import a34_0x115598 from'chalk';function validateProfileName(_0x10e1e3){const _0x5a43dd=a34_0x5d71;if(!_0x10e1e3||!_0x10e1e3[_0x5a43dd(0x15b)]())return _0x5a43dd(0x120);const _0x1e51f2=_0x10e1e3[_0x5a43dd(0x15b)]();if(!/^[a-zA-Z0-9_-]+$/[_0x5a43dd(0x16f)](_0x1e51f2))return _0x5a43dd(0x127);if(profileExists(_0x1e51f2))return _0x5a43dd(0x13a)+_0x1e51f2+_0x5a43dd(0x14b);return!![];}export class ProfileCreateCommand extends BaseCommand{[a34_0x57ee8c(0x167)]=a34_0x57ee8c(0x12e);[a34_0x57ee8c(0x148)]='Create\x20a\x20new\x20profile';async['execute'](_0x2b3368){const _0x12f01f=a34_0x57ee8c,{options:_0x3dc4b7,args:_0x2217e2}=_0x2b3368;console['log'](a34_0x115598[_0x12f01f(0x11d)]('tdx:\x20profile\x20create'));let _0x113272;if(_0x2217e2['length']>0x0&&_0x2217e2[0x0]){const _0x29871b=_0x2217e2[0x0][_0x12f01f(0x15b)](),_0x340d81=validateProfileName(_0x29871b);if(_0x340d81!==!![])return console[_0x12f01f(0x12f)](a34_0x115598[_0x12f01f(0x10c)](_0x340d81)),0x1;_0x113272=_0x29871b;}else{const _0x3ce8d9=await a34_0x25024f({'type':_0x12f01f(0x146),'name':'profileName','message':'Enter\x20profile\x20name:','validate':validateProfileName});if(!_0x3ce8d9[_0x12f01f(0x105)])return console[_0x12f01f(0x117)]('\x0aSetup\x20cancelled'),0x1;_0x113272=_0x3ce8d9[_0x12f01f(0x105)][_0x12f01f(0x15b)]();}const _0x424055=await a34_0x25024f({'type':_0x12f01f(0x146),'name':'description','message':_0x12f01f(0x114)}),_0xca2d64=_0x424055[_0x12f01f(0x148)]?.['trim']()||undefined,_0xd18215=_0x3dc4b7[_0x12f01f(0x109)]||_0x12f01f(0x113),_0xb3a7ee=await promptSiteSelection(_0xd18215,_0x113272,_0x12f01f(0x166));if(!_0xb3a7ee)return 0x1;const _0x411a98=resolveSite(_0xb3a7ee);if(isOAuthSupported(_0x411a98)){const _0x43ce69=await a34_0x25024f({'type':_0x12f01f(0x124),'name':_0x12f01f(0x152),'message':_0x12f01f(0x136),'choices':[{'title':_0x12f01f(0x153),'value':_0x12f01f(0x12b)},{'title':_0x12f01f(0x150),'value':_0x12f01f(0x169)}]});if(!_0x43ce69['method'])return console['log'](_0x12f01f(0x132)),0x1;if(_0x43ce69[_0x12f01f(0x152)]===_0x12f01f(0x12b)){if(_0xca2d64){const _0x4dd52b={'site':_0x411a98,'description':_0xca2d64};saveProfileToUserConfig(_0x113272,_0x4dd52b);}return await runOAuthLoginFlow(_0x411a98,_0x113272,_0x3dc4b7[_0x12f01f(0x15a)]??LogLevel[_0x12f01f(0x162)]),0x0;}}console[_0x12f01f(0x117)](_0x12f01f(0x15c)+_0x411a98),console[_0x12f01f(0x117)](_0x12f01f(0x145)),console[_0x12f01f(0x117)]('\x20\x20'+getConsoleUrl(_0x411a98,_0x12f01f(0x13e)));const _0x90c47f=await a34_0x25024f({'type':_0x12f01f(0x11b),'name':_0x12f01f(0x15e),'message':_0x12f01f(0x14c),'validate':_0x5629d5=>{if(!_0x5629d5||!_0x5629d5['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x90c47f[_0x12f01f(0x15e)])return console[_0x12f01f(0x117)]('\x0aSetup\x20cancelled'),0x1;const _0x393274=_0x90c47f['apiKey'];console[_0x12f01f(0x117)]('Validating\x20API\x20key...');try{const _0x128afd=TDX['create']({'site':_0x411a98,'apiKey':_0x393274['trim'](),'logLevel':_0x3dc4b7[_0x12f01f(0x15a)]??LogLevel['ERROR']}),_0x444ce1=await _0x128afd[_0x12f01f(0x15f)][_0x12f01f(0x106)]();console[_0x12f01f(0x117)](a34_0x115598[_0x12f01f(0x157)]('✓')+_0x12f01f(0x11f)+_0x444ce1[_0x12f01f(0x164)]+')');const _0xe00b0c=await isKeychainAvailable();_0xe00b0c?(await saveAPIKeyAsync(_0x393274[_0x12f01f(0x15b)](),_0x411a98,_0x113272),console['log'](a34_0x115598[_0x12f01f(0x157)]('✓')+_0x12f01f(0x160)+_0x113272+')')):(console['warn'](a34_0x115598[_0x12f01f(0x159)](_0x12f01f(0x142))),console[_0x12f01f(0x10f)](a34_0x115598[_0x12f01f(0x159)](_0x12f01f(0x13b))));const _0x4ec436={'site':_0x411a98,..._0xca2d64&&{'description':_0xca2d64}};return saveProfileToUserConfig(_0x113272,_0x4ec436),console[_0x12f01f(0x117)](a34_0x115598[_0x12f01f(0x157)]('✓')+_0x12f01f(0x151)+_0x113272+_0x12f01f(0x131)),console[_0x12f01f(0x117)](),console[_0x12f01f(0x117)](_0x12f01f(0x118)),console[_0x12f01f(0x117)]('\x20\x20tdx\x20--profile\x20'+_0x113272+_0x12f01f(0x11e)),console['log'](_0x12f01f(0x10a)+_0x113272+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x507efa){if(_0x507efa instanceof HTTPClientError&&_0x507efa[_0x12f01f(0x16d)]===0x191)return printAuthError(_0x507efa),0x1;return console[_0x12f01f(0x12f)](a34_0x115598[_0x12f01f(0x10c)](_0x12f01f(0x133)+(_0x507efa instanceof Error?_0x507efa[_0x12f01f(0x168)]:String(_0x507efa)))),console[_0x12f01f(0x12f)](_0x12f01f(0x13d)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a34_0x57ee8c(0x167)]='profile:remove';[a34_0x57ee8c(0x148)]=a34_0x57ee8c(0x119);[a34_0x57ee8c(0x137)](_0x13ccc3){const _0x241868=a34_0x57ee8c,{args:_0x2e77d9}=_0x13ccc3;if(_0x2e77d9[_0x241868(0x138)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async['execute'](_0x130fc0){const _0x298f43=a34_0x57ee8c,{args:_0x32ff45}=_0x130fc0,_0x1f6694=_0x32ff45[0x0];console['log'](a34_0x115598['bold'](_0x298f43(0x14f)));if(!profileExists(_0x1f6694)){console[_0x298f43(0x12f)](a34_0x115598[_0x298f43(0x10c)]('Profile\x20\x27'+_0x1f6694+_0x298f43(0x141))),console[_0x298f43(0x117)]('\x0aAvailable\x20profiles:');const _0xd08354=listProfiles();if(_0xd08354[_0x298f43(0x138)]===0x0)console[_0x298f43(0x117)](_0x298f43(0x102));else for(const _0x1abc20 of _0xd08354){console['log']('\x20\x20-\x20'+_0x1abc20['name']);}return 0x1;}const _0x4bb9cd=await a34_0x25024f({'type':_0x298f43(0x130),'name':_0x298f43(0x130),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x1f6694+'\x27?','initial':![]});if(!_0x4bb9cd['confirm'])return console[_0x298f43(0x117)](_0x298f43(0x14a)),0x0;try{removeProfileFromUserConfig(_0x1f6694),console['log'](a34_0x115598['green']('✓')+_0x298f43(0x151)+_0x1f6694+_0x298f43(0x111));}catch(_0x33e655){return console[_0x298f43(0x12f)](a34_0x115598[_0x298f43(0x10c)](_0x298f43(0x161)+(_0x33e655 instanceof Error?_0x33e655[_0x298f43(0x168)]:String(_0x33e655)))),0x1;}const _0x241d9d=await isKeychainAvailable();if(_0x241d9d){const _0x3d0908=await deleteKeychainAPIKey(_0x1f6694);_0x3d0908&&console[_0x298f43(0x117)](a34_0x115598['green']('✓')+_0x298f43(0x129));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a34_0x57ee8c(0x167)]=a34_0x57ee8c(0x11c);[a34_0x57ee8c(0x148)]=a34_0x57ee8c(0x143);static ['VALID_KEYS']=['site',a34_0x57ee8c(0x16c),'parent_segment',a34_0x57ee8c(0x11a),'llm_agent',a34_0x57ee8c(0x148)];[a34_0x57ee8c(0x137)](_0x39f4ae){const _0x463536=a34_0x57ee8c,{args:_0x19a54d,options:_0x1fcae7}=_0x39f4ae,_0x415234=_0x1fcae7[_0x463536(0x12c)]||getActiveProfile();if(!_0x415234)return _0x463536(0x13f);if(_0x19a54d[_0x463536(0x138)]===0x0)return _0x463536(0x104)+ProfileSetCommand[_0x463536(0x126)]['join'](',\x20');const _0x267ab5=_0x19a54d[0x0];if(!_0x267ab5[_0x463536(0x144)]('='))return _0x463536(0x16e)+ProfileSetCommand['VALID_KEYS'][_0x463536(0x128)](',\x20');const [_0x4e8a82]=_0x267ab5[_0x463536(0x16b)]('=',0x2);if(!ProfileSetCommand[_0x463536(0x126)][_0x463536(0x144)](_0x4e8a82))return _0x463536(0x125)+_0x4e8a82+_0x463536(0x103)+ProfileSetCommand[_0x463536(0x126)]['join'](',\x20');return undefined;}async[a34_0x57ee8c(0x115)](_0x2d508b){const _0x58eb99=a34_0x57ee8c,{args:_0x50ade7,options:_0xc3f1c9}=_0x2d508b,_0x4ed98e=_0xc3f1c9[_0x58eb99(0x12c)]||getActiveProfile(),[_0x2f718d,..._0x255828]=_0x50ade7[0x0]['split']('='),_0x10db16=_0x255828[_0x58eb99(0x128)]('=');console[_0x58eb99(0x117)](a34_0x115598[_0x58eb99(0x11d)](_0x58eb99(0x13c)));if(!profileExists(_0x4ed98e)){const _0x187868=await a34_0x25024f({'type':'confirm','name':_0x58eb99(0x10d),'message':_0x58eb99(0x13a)+_0x4ed98e+_0x58eb99(0x16a),'initial':!![]});if(!_0x187868[_0x58eb99(0x10d)])return console[_0x58eb99(0x117)](_0x58eb99(0x110)),0x1;}const _0x3c6134=loadProfile(_0x4ed98e),_0x41ce3b=_0x3c6134?.[_0x58eb99(0x10e)]||{};if(_0x2f718d===_0x58eb99(0x109)){const _0x412ef9=resolveSite(_0x10db16);console['log'](_0x58eb99(0x123)+_0x412ef9+_0x58eb99(0x112)),console[_0x58eb99(0x117)](_0x58eb99(0x116)),console[_0x58eb99(0x117)]('\x20\x20'+getConsoleUrl(_0x412ef9,'/app/mp/ak'));const _0x4a39f4=await a34_0x25024f({'type':'password','name':_0x58eb99(0x15e),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x44e1c6=>{if(!_0x44e1c6||!_0x44e1c6['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x4a39f4['apiKey'])return console['log'](_0x58eb99(0x139)),0x1;console[_0x58eb99(0x117)]('Validating\x20API\x20key...');try{const _0x120731=TDX[_0x58eb99(0x10d)]({'site':_0x412ef9,'apiKey':_0x4a39f4[_0x58eb99(0x15e)][_0x58eb99(0x15b)](),'logLevel':_0xc3f1c9['logLevel']??LogLevel['ERROR']}),_0x2ade97=await _0x120731['jobs']['getUserInfo']();console[_0x58eb99(0x117)](a34_0x115598['green']('✓')+_0x58eb99(0x11f)+_0x2ade97[_0x58eb99(0x164)]+')');const _0x4c04d6=await isKeychainAvailable();_0x4c04d6?(await saveAPIKeyAsync(_0x4a39f4[_0x58eb99(0x15e)][_0x58eb99(0x15b)](),_0x412ef9,_0x4ed98e),console['log'](a34_0x115598['green']('✓')+_0x58eb99(0x12d))):console['warn'](a34_0x115598[_0x58eb99(0x159)](_0x58eb99(0x142))),_0x41ce3b['site']=_0x412ef9;}catch(_0xd581fa){if(_0xd581fa instanceof HTTPClientError&&_0xd581fa[_0x58eb99(0x16d)]===0x191)return printAuthError(_0xd581fa),0x1;return console['error'](a34_0x115598[_0x58eb99(0x10c)]('✗\x20Validation\x20failed:\x20'+(_0xd581fa instanceof Error?_0xd581fa[_0x58eb99(0x168)]:String(_0xd581fa)))),console[_0x58eb99(0x12f)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x41ce3b[_0x2f718d]=_0x10db16||undefined;return saveProfileToUserConfig(_0x4ed98e,_0x41ce3b),console[_0x58eb99(0x117)](a34_0x115598[_0x58eb99(0x157)]('✓')+_0x58eb99(0x151)+_0x4ed98e+_0x58eb99(0x163)+_0x2f718d+'='+(_0x10db16||_0x58eb99(0x170))),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']='profile:use';[a34_0x57ee8c(0x148)]='Set\x20session\x20profile';['validate'](_0x2ec780){const _0x5b5943=a34_0x57ee8c,{args:_0xe08d72}=_0x2ec780;if(_0xe08d72[_0x5b5943(0x138)]===0x0)return _0x5b5943(0x158);return undefined;}async[a34_0x57ee8c(0x115)](_0x2e9262){const _0x51889b=a34_0x57ee8c,{args:_0x3c916c,options:_0x375f7b}=_0x2e9262,_0x81b617=_0x3c916c[0x0],_0x46671a=_0x375f7b[_0x51889b(0x135)];cleanExpiredSessions();if(!profileExists(_0x81b617)){console[_0x51889b(0x12f)](a34_0x115598[_0x51889b(0x10c)](_0x51889b(0x13a)+_0x81b617+'\x27\x20does\x20not\x20exist.')),console[_0x51889b(0x117)]('\x0aAvailable\x20profiles:');const _0xf164f7=listProfiles();if(_0xf164f7[_0x51889b(0x138)]===0x0)console[_0x51889b(0x117)](_0x51889b(0x102));else for(const _0x43ad08 of _0xf164f7){console[_0x51889b(0x117)](_0x51889b(0x101)+_0x43ad08['name']);}return 0x1;}if(_0x46671a){const _0x3cf54b=a34_0xf719a3['join'](getConfigDir(),_0x51889b(0x15d));return saveActiveProfileToUserConfig(_0x81b617),console[_0x51889b(0x117)](_0x51889b(0x140)+a34_0x115598[_0x51889b(0x157)](_0x81b617)),console[_0x51889b(0x117)](a34_0x115598[_0x51889b(0x108)](_0x51889b(0x107)+_0x3cf54b)),0x0;}const _0x4064ae=getSessionID(_0x375f7b['session']);return saveSessionContext({'profile':_0x81b617},_0x375f7b['session']),console['log'](_0x51889b(0x154)+a34_0x115598[_0x51889b(0x157)](_0x81b617)+'\x20'+a34_0x115598['dim']('(session:\x20'+_0x4064ae+')')),console[_0x51889b(0x117)](a34_0x115598[_0x51889b(0x108)](_0x51889b(0x165)+_0x81b617+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
@@ -1 +1 @@
1
- const a35_0x4a4914=a35_0x2677;function a35_0x4a30(){const _0x516c7f=['map','description','97302oNndum','159894QxAGha','green','profiles','site','Error:\x20','dim','execute','name','276nEkvsO','2830554eVqZjp','28TlVsOT','log','config','👤\x20','819159jMjLQY','scope','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','56XVPQTI','145kxVVZe','269223khQJSt','\x20\x20Global:\x20~/.config/tdx/tdx.json','error','20eRMrWk','574847RFkfRX','798343Dxwemn','List\x20all\x20available\x20profiles'];a35_0x4a30=function(){return _0x516c7f;};return a35_0x4a30();}(function(_0x4c5a0f,_0x1aa476){const _0x1925a7=a35_0x2677,_0x269ee3=_0x4c5a0f();while(!![]){try{const _0x3216e7=-parseInt(_0x1925a7(0xdd))/0x1+-parseInt(_0x1925a7(0xe2))/0x2+-parseInt(_0x1925a7(0xd8))/0x3*(-parseInt(_0x1925a7(0xcf))/0x4)+-parseInt(_0x1925a7(0xd7))/0x5*(parseInt(_0x1925a7(0xe1))/0x6)+parseInt(_0x1925a7(0xdc))/0x7*(parseInt(_0x1925a7(0xd6))/0x8)+-parseInt(_0x1925a7(0xce))/0x9*(parseInt(_0x1925a7(0xdb))/0xa)+parseInt(_0x1925a7(0xd3))/0xb*(parseInt(_0x1925a7(0xcd))/0xc);if(_0x3216e7===_0x1aa476)break;else _0x269ee3['push'](_0x269ee3['shift']());}catch(_0x52d228){_0x269ee3['push'](_0x269ee3['shift']());}}}(a35_0x4a30,0xe50f2));function a35_0x2677(_0x7cea6c,_0x341600){_0x7cea6c=_0x7cea6c-0xcb;const _0x4a30d4=a35_0x4a30();let _0x26773e=_0x4a30d4[_0x7cea6c];return _0x26773e;}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a35_0x149bcc from'chalk';export class ProfilesCommand extends BaseCommand{[a35_0x4a4914(0xcc)]=a35_0x4a4914(0xe4);[a35_0x4a4914(0xe0)]=a35_0x4a4914(0xde);async[a35_0x4a4914(0xcb)](_0xaaf4bf){const _0x54c5f6=a35_0x4a4914,{options:_0xe32e8b}=_0xaaf4bf;try{const _0x5ab329=listProfiles(),_0x249b62=getActiveProfile();if(_0x5ab329['length']===0x0)return console[_0x54c5f6(0xd0)](_0x54c5f6(0xd5)),console[_0x54c5f6(0xd0)]('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console[_0x54c5f6(0xd0)](_0x54c5f6(0xd9)),0x0;const _0x5127e7=_0x5ab329[_0x54c5f6(0xdf)](_0x50c79c=>{const _0x230261=_0x54c5f6,_0x42ba29=_0x50c79c[_0x230261(0xcc)]===_0x249b62,_0xc25314=getProfileParams(_0x50c79c[_0x230261(0xd1)]);return{'name':_0x50c79c[_0x230261(0xcc)],'active':_0x42ba29,'scope':_0x50c79c[_0x230261(0xd4)],'description':_0x50c79c[_0x230261(0xd1)][_0x230261(0xe0)]||'','params':_0xc25314};});if(isStructuredFormat(_0xe32e8b))await handleSDKOutput(_0x5127e7,_0xe32e8b);else for(const _0x285975 of _0x5ab329){const _0x25698f=_0x285975['name']===_0x249b62?a35_0x149bcc[_0x54c5f6(0xe3)]('\x20✓'):'',_0x4101cf=_0x285975[_0x54c5f6(0xd1)][_0x54c5f6(0xe5)]?a35_0x149bcc['dim']('\x20'+_0x285975[_0x54c5f6(0xd1)]['site']):'',_0x2f479c=_0x285975[_0x54c5f6(0xd1)]['description']?a35_0x149bcc[_0x54c5f6(0xe7)]('\x20\x20'+_0x285975[_0x54c5f6(0xd1)][_0x54c5f6(0xe0)]):'';console[_0x54c5f6(0xd0)](_0x54c5f6(0xd2)+_0x285975[_0x54c5f6(0xcc)]+_0x25698f+_0x4101cf+_0x2f479c);}return 0x0;}catch(_0x2de343){return _0x2de343 instanceof Error&&console[_0x54c5f6(0xda)](_0x54c5f6(0xe6)+_0x2de343['message']),0x1;}}}
1
+ const a35_0x10feb9=a35_0x28e4;(function(_0x42a4b1,_0x460ad4){const _0x1849e7=a35_0x28e4,_0x3c2f52=_0x42a4b1();while(!![]){try{const _0x52daf7=-parseInt(_0x1849e7(0x198))/0x1*(-parseInt(_0x1849e7(0x19e))/0x2)+parseInt(_0x1849e7(0x18b))/0x3+parseInt(_0x1849e7(0x19f))/0x4+parseInt(_0x1849e7(0x18f))/0x5*(-parseInt(_0x1849e7(0x19b))/0x6)+-parseInt(_0x1849e7(0x192))/0x7+parseInt(_0x1849e7(0x191))/0x8+parseInt(_0x1849e7(0x18c))/0x9;if(_0x52daf7===_0x460ad4)break;else _0x3c2f52['push'](_0x3c2f52['shift']());}catch(_0x403e8b){_0x3c2f52['push'](_0x3c2f52['shift']());}}}(a35_0x4a0d,0xcb377));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a35_0x4a0d(){const _0x2546b6=['80whdgnU','4297120OrLjqe','site','Error:\x20','config','81588wAhreR','5704452pLwmKJ','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','name','8140955UwhHTe','description','3442368DKsowi','4187078LuWhom','List\x20all\x20available\x20profiles','dim','👤\x20','map','error','22328ArNakO','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','log','6dhCXtC','\x20\x20Global:\x20~/.config/tdx/tdx.json','scope'];a35_0x4a0d=function(){return _0x2546b6;};return a35_0x4a0d();}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';function a35_0x28e4(_0x2fcc51,_0x43e032){_0x2fcc51=_0x2fcc51-0x189;const _0x4a0d8c=a35_0x4a0d();let _0x28e4e9=_0x4a0d8c[_0x2fcc51];return _0x28e4e9;}import a35_0xe17a83 from'chalk';export class ProfilesCommand extends BaseCommand{[a35_0x10feb9(0x18e)]='profiles';[a35_0x10feb9(0x190)]=a35_0x10feb9(0x193);async['execute'](_0x30b7c9){const _0x1960bc=a35_0x10feb9,{options:_0x2e6cd7}=_0x30b7c9;try{const _0x1ecf52=listProfiles(),_0x332771=getActiveProfile();if(_0x1ecf52['length']===0x0)return console[_0x1960bc(0x19a)](_0x1960bc(0x199)),console[_0x1960bc(0x19a)](_0x1960bc(0x18d)),console[_0x1960bc(0x19a)](_0x1960bc(0x19c)),0x0;const _0x2dcc52=_0x1ecf52[_0x1960bc(0x196)](_0x317025=>{const _0x428dd3=_0x1960bc,_0x26aaef=_0x317025[_0x428dd3(0x18e)]===_0x332771,_0x5eb1af=getProfileParams(_0x317025[_0x428dd3(0x18a)]);return{'name':_0x317025[_0x428dd3(0x18e)],'active':_0x26aaef,'scope':_0x317025[_0x428dd3(0x19d)],'description':_0x317025['config']['description']||'','params':_0x5eb1af};});if(isStructuredFormat(_0x2e6cd7))await handleSDKOutput(_0x2dcc52,_0x2e6cd7);else for(const _0xa9c0be of _0x1ecf52){const _0x47b748=_0xa9c0be[_0x1960bc(0x18e)]===_0x332771?a35_0xe17a83['green']('\x20✓'):'',_0x31e096=_0xa9c0be[_0x1960bc(0x18a)][_0x1960bc(0x1a0)]?a35_0xe17a83[_0x1960bc(0x194)]('\x20'+_0xa9c0be['config']['site']):'',_0x557ae4=_0xa9c0be[_0x1960bc(0x18a)][_0x1960bc(0x190)]?a35_0xe17a83[_0x1960bc(0x194)]('\x20\x20'+_0xa9c0be['config'][_0x1960bc(0x190)]):'';console[_0x1960bc(0x19a)](_0x1960bc(0x195)+_0xa9c0be[_0x1960bc(0x18e)]+_0x47b748+_0x31e096+_0x557ae4);}return 0x0;}catch(_0x141cb8){return _0x141cb8 instanceof Error&&console[_0x1960bc(0x197)](_0x1960bc(0x189)+_0x141cb8['message']),0x1;}}}
@@ -1 +1 @@
1
- const a36_0x56fa18=a36_0x352a;function a36_0x352a(_0x317d56,_0x40c168){_0x317d56=_0x317d56-0xef;const _0x5fc5f0=a36_0x5fc5();let _0x352a43=_0x5fc5f0[_0x317d56];return _0x352a43;}(function(_0xd5e62c,_0x52cdfa){const _0x8cd1a2=a36_0x352a,_0x4d448f=_0xd5e62c();while(!![]){try{const _0x39c5e2=-parseInt(_0x8cd1a2(0x104))/0x1*(-parseInt(_0x8cd1a2(0x11e))/0x2)+parseInt(_0x8cd1a2(0xef))/0x3+parseInt(_0x8cd1a2(0x11d))/0x4+-parseInt(_0x8cd1a2(0xf3))/0x5+-parseInt(_0x8cd1a2(0xf6))/0x6+parseInt(_0x8cd1a2(0x105))/0x7+-parseInt(_0x8cd1a2(0x11c))/0x8;if(_0x39c5e2===_0x52cdfa)break;else _0x4d448f['push'](_0x4d448f['shift']());}catch(_0x375bb6){_0x4d448f['push'](_0x4d448f['shift']());}}}(a36_0x5fc5,0x94af4));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';function a36_0x5fc5(){const _0x19da2d=['elapsedTimeMillis','Query\x20completed:\x20Processed\x20','catalog','jobId','state','verbose','join','query','push','options','Schema:\x20','No\x20SQL\x20provided','15231992gsZrGG','3765456xtFmQt','2085422PgRMii','Executing\x20statement\x20','error','2161707DpqViA','information_schema','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','setPhase','2908200FCfHtm','output','site','2104962QTKnnD','validate','description','SQL:\x20','in\x20','name','args','Statement\x20','\x20rows\x20','stats','data','Catalog:\x20','processedRows','file','1GtLGxZ','5185838nVauYt','length','execute','message','originalMessage','setJobId','database','...','completedSplits','totalSplits','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'];a36_0x5fc5=function(){return _0x19da2d;};return a36_0x5fc5();}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a36_0x56fa18(0xfb)]=a36_0x56fa18(0x117);[a36_0x56fa18(0xf8)]='Run\x20Trino\x20queries\x20(streaming)';async[a36_0x56fa18(0x107)](_0x1f68a3){const _0x45a5f8=a36_0x56fa18,{options:_0x34cfdf,args:_0x2d9a8b,tdx:_0x3e2a30}=_0x1f68a3,_0x1f6d9e={..._0x34cfdf,'limitStructuredFormats':!![]},_0x128729=_0x2d9a8b[0x0],_0x47edeb=_0x34cfdf[_0x45a5f8(0x103)];let _0x256011;try{if(_0x47edeb)_0x256011=readSqlStatementsFromFile(_0x47edeb);else{if(_0x128729==='-')_0x256011=await readSqlStatementsFromStdin();else{if(_0x128729&&isSqlFilePath(_0x128729))_0x256011=readSqlStatementsFromFile(_0x128729);else{if(_0x128729)_0x256011=splitSqlStatements(_0x128729);else throw new Error(_0x45a5f8(0x11b));}}}}catch(_0x512fd2){return console[_0x45a5f8(0x120)]('Error:\x20'+_0x512fd2[_0x45a5f8(0x108)]),0x1;}const _0x2184ea=_0x34cfdf[_0x45a5f8(0x10b)]||_0x45a5f8(0xf0),_0x2b0d4c=_0x34cfdf[_0x45a5f8(0x112)];try{const _0x3dd8e5=[],_0x3873dc=!!_0x34cfdf[_0x45a5f8(0xf4)];for(let _0x11839f=0x0;_0x11839f<_0x256011[_0x45a5f8(0x106)];_0x11839f++){const _0x319297=_0x256011[_0x11839f],_0x92c51e=_0x11839f+0x1,_0x27f099=_0x256011[_0x45a5f8(0x106)],_0x1832d1=_0x27f099>0x1;_0x34cfdf[_0x45a5f8(0x115)]&&(console[_0x45a5f8(0x120)]('\x0a'+(_0x1832d1?'Statement\x20'+_0x92c51e+'/'+_0x27f099+':':'')),console[_0x45a5f8(0x120)]('Site:\x20'+_0x34cfdf[_0x45a5f8(0xf5)]),console[_0x45a5f8(0x120)](_0x45a5f8(0x101)+(_0x2b0d4c||'td')),console[_0x45a5f8(0x120)](_0x45a5f8(0x11a)+_0x2184ea),console[_0x45a5f8(0x120)](_0x45a5f8(0xf9)+_0x319297));const _0xe57d01=_0x1832d1?_0x45a5f8(0x11f)+_0x92c51e+'/'+_0x27f099+_0x45a5f8(0x10c):'Executing\x20query...';try{const _0x182230=await withProgressSpinner(_0xe57d01,async _0x27e290=>{const _0x36c07f=_0x45a5f8,_0x1f54a0=await _0x3e2a30[_0x36c07f(0x117)][_0x36c07f(0x107)](_0x319297,{'catalog':_0x2b0d4c,'schema':_0x2184ea,'onJobId':_0x3d52bc=>{const _0x4a5439=_0x36c07f;_0x27e290[_0x4a5439(0x10a)](_0x3d52bc);},'onProgress':_0x27b820=>{const _0x5a096d=_0x36c07f;_0x27e290[_0x5a096d(0xf2)]('Executing\x20query\x20['+_0x27b820[_0x5a096d(0x114)]+']'),_0x27e290['setExtra'](formatRows(_0x27b820[_0x5a096d(0x102)])+'\x20rows\x20'+_0x27b820[_0x5a096d(0x10d)]+'/'+_0x27b820[_0x5a096d(0x10e)]+'\x20splits');}});return _0x1f54a0;},{'verbose':_0x34cfdf[_0x45a5f8(0x115)]}),_0x3d7bfc=_0x182230[_0x45a5f8(0x100)],_0x253bcd=_0x3d7bfc[_0x45a5f8(0x113)]?'\x20[Job\x20ID:\x20'+_0x3d7bfc[_0x45a5f8(0x113)]+']':'',_0x4f6006=_0x1832d1?'Statement\x20'+_0x92c51e+'/'+_0x27f099+'\x20-\x20':'';console['error']('✔\x20'+_0x4f6006+_0x45a5f8(0x111)+formatRows(_0x3d7bfc[_0x45a5f8(0xff)][_0x45a5f8(0x102)])+_0x45a5f8(0xfe)+(_0x45a5f8(0xfa)+formatElapsed(_0x3d7bfc[_0x45a5f8(0xff)][_0x45a5f8(0x110)])+_0x253bcd));if(_0x1832d1&&_0x3873dc){const _0x44732c=resolveOutputOptions(_0x1f6d9e),_0x53d095=await formatQueryOutput(_0x3d7bfc,_0x44732c);_0x3dd8e5[_0x45a5f8(0x118)](_0x53d095);}else await handleQueryOutput(_0x3d7bfc,_0x1f6d9e);}catch(_0x45af75){const _0x3684fc=_0x1832d1?_0x45a5f8(0xfd)+_0x92c51e+'/'+_0x27f099+':\x0a':'',_0x179b9b=_0x45af75 instanceof SDKError?_0x45af75[_0x45a5f8(0x109)]:_0x45af75[_0x45a5f8(0x108)];return console[_0x45a5f8(0x120)](''+_0x3684fc+_0x179b9b),0x1;}}if(_0x256011[_0x45a5f8(0x106)]>0x1&&_0x3873dc&&_0x3dd8e5[_0x45a5f8(0x106)]>0x0){const _0x2065ff=_0x3dd8e5[_0x45a5f8(0x116)]('\x0a');writeFileSync(_0x34cfdf['output'],_0x2065ff),console[_0x45a5f8(0x120)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x34cfdf[_0x45a5f8(0xf4)]);}return 0x0;}catch(_0xdf0fb4){throw _0xdf0fb4;}}[a36_0x56fa18(0xf7)](_0x4cafa3){const _0x475ec9=a36_0x56fa18,_0x265e96=_0x4cafa3[_0x475ec9(0xfc)][0x0],_0x4faf87=_0x4cafa3[_0x475ec9(0x119)]['file'];if(!_0x265e96&&!_0x4faf87)return _0x475ec9(0x10f);if(_0x265e96&&_0x4faf87)return _0x475ec9(0xf1);return undefined;}}
1
+ const a36_0x4b6545=a36_0x13f3;(function(_0x3b4536,_0x5a89e1){const _0x494e3d=a36_0x13f3,_0x4ee231=_0x3b4536();while(!![]){try{const _0x2d6e7d=parseInt(_0x494e3d(0x1ce))/0x1+-parseInt(_0x494e3d(0x1e4))/0x2*(-parseInt(_0x494e3d(0x1d6))/0x3)+-parseInt(_0x494e3d(0x1dd))/0x4+parseInt(_0x494e3d(0x1d4))/0x5+parseInt(_0x494e3d(0x1e8))/0x6*(parseInt(_0x494e3d(0x1d9))/0x7)+parseInt(_0x494e3d(0x1dc))/0x8*(-parseInt(_0x494e3d(0x1cf))/0x9)+parseInt(_0x494e3d(0x1ec))/0xa;if(_0x2d6e7d===_0x5a89e1)break;else _0x4ee231['push'](_0x4ee231['shift']());}catch(_0x1cb6d7){_0x4ee231['push'](_0x4ee231['shift']());}}}(a36_0x1e80,0x41f97));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';function a36_0x1e80(){const _0x227994=['query','\x20rows\x20','error','672540pSPAlO','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','elapsedTimeMillis','database','in\x20','information_schema','message','stats','output','length','name','jobId','Catalog:\x20','originalMessage','completedSplits','catalog','options','SQL:\x20','validate','data','234766RDsNcG','265761BTWFGN','setJobId','args','...','setExtra','833005QBPLoN','verbose','87mUpnoE','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','Query\x20completed:\x20Processed\x20','665fgJozV','Statement\x20','state','136evJtDZ','614900bWiMTE','site','\x20-\x20','totalSplits','push','Executing\x20query...','Site:\x20','18764XPyQWE','\x20splits','Schema:\x20','\x0aAll\x20results\x20saved\x20to\x20','11700UMIOUC'];a36_0x1e80=function(){return _0x227994;};return a36_0x1e80();}import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';function a36_0x13f3(_0x125d73,_0x56abaa){_0x125d73=_0x125d73-0x1c0;const _0x1e8079=a36_0x1e80();let _0x13f347=_0x1e8079[_0x125d73];return _0x13f347;}export class QueryCommand extends BaseCommand{[a36_0x4b6545(0x1c4)]=a36_0x4b6545(0x1e9);['description']='Run\x20Trino\x20queries\x20(streaming)';async['execute'](_0x4c5f91){const _0x5906a9=a36_0x4b6545,{options:_0xe66add,args:_0x533f8e,tdx:_0x525f7d}=_0x4c5f91,_0x3253a0={..._0xe66add,'limitStructuredFormats':!![]},_0x4ace2f=_0x533f8e[0x0],_0x5deb3e=_0xe66add['file'];let _0x145c70;try{if(_0x5deb3e)_0x145c70=readSqlStatementsFromFile(_0x5deb3e);else{if(_0x4ace2f==='-')_0x145c70=await readSqlStatementsFromStdin();else{if(_0x4ace2f&&isSqlFilePath(_0x4ace2f))_0x145c70=readSqlStatementsFromFile(_0x4ace2f);else{if(_0x4ace2f)_0x145c70=splitSqlStatements(_0x4ace2f);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x2f2112){return console[_0x5906a9(0x1eb)]('Error:\x20'+_0x2f2112[_0x5906a9(0x1c0)]),0x1;}const _0x7ff62f=_0xe66add[_0x5906a9(0x1ef)]||_0x5906a9(0x1f1),_0x24948f=_0xe66add[_0x5906a9(0x1c9)];try{const _0x2aadd7=[],_0x33efdf=!!_0xe66add['output'];for(let _0x391537=0x0;_0x391537<_0x145c70[_0x5906a9(0x1c3)];_0x391537++){const _0x4f4136=_0x145c70[_0x391537],_0x20cd5c=_0x391537+0x1,_0x152ee4=_0x145c70[_0x5906a9(0x1c3)],_0x36af5f=_0x152ee4>0x1;_0xe66add['verbose']&&(console[_0x5906a9(0x1eb)]('\x0a'+(_0x36af5f?'Statement\x20'+_0x20cd5c+'/'+_0x152ee4+':':'')),console[_0x5906a9(0x1eb)](_0x5906a9(0x1e3)+_0xe66add[_0x5906a9(0x1de)]),console[_0x5906a9(0x1eb)](_0x5906a9(0x1c6)+(_0x24948f||'td')),console[_0x5906a9(0x1eb)](_0x5906a9(0x1e6)+_0x7ff62f),console[_0x5906a9(0x1eb)](_0x5906a9(0x1cb)+_0x4f4136));const _0x387c19=_0x36af5f?'Executing\x20statement\x20'+_0x20cd5c+'/'+_0x152ee4+_0x5906a9(0x1d2):_0x5906a9(0x1e2);try{const _0x296f30=await withProgressSpinner(_0x387c19,async _0x426d8d=>{const _0x17d2ec=_0x5906a9,_0x425b40=await _0x525f7d[_0x17d2ec(0x1e9)]['execute'](_0x4f4136,{'catalog':_0x24948f,'schema':_0x7ff62f,'onJobId':_0x22b7a5=>{const _0x6f8eba=_0x17d2ec;_0x426d8d[_0x6f8eba(0x1d0)](_0x22b7a5);},'onProgress':_0x3422dc=>{const _0x4c09ff=_0x17d2ec;_0x426d8d['setPhase']('Executing\x20query\x20['+_0x3422dc[_0x4c09ff(0x1db)]+']'),_0x426d8d[_0x4c09ff(0x1d3)](formatRows(_0x3422dc['processedRows'])+_0x4c09ff(0x1ea)+_0x3422dc[_0x4c09ff(0x1c8)]+'/'+_0x3422dc[_0x4c09ff(0x1e0)]+_0x4c09ff(0x1e5));}});return _0x425b40;},{'verbose':_0xe66add[_0x5906a9(0x1d5)]}),_0x43ea3d=_0x296f30[_0x5906a9(0x1cd)],_0x2e3a15=_0x43ea3d[_0x5906a9(0x1c5)]?'\x20[Job\x20ID:\x20'+_0x43ea3d[_0x5906a9(0x1c5)]+']':'',_0x53d196=_0x36af5f?'Statement\x20'+_0x20cd5c+'/'+_0x152ee4+_0x5906a9(0x1df):'';console[_0x5906a9(0x1eb)]('✔\x20'+_0x53d196+_0x5906a9(0x1d8)+formatRows(_0x43ea3d[_0x5906a9(0x1c1)]['processedRows'])+_0x5906a9(0x1ea)+(_0x5906a9(0x1f0)+formatElapsed(_0x43ea3d[_0x5906a9(0x1c1)][_0x5906a9(0x1ee)])+_0x2e3a15));if(_0x36af5f&&_0x33efdf){const _0x245bfa=resolveOutputOptions(_0x3253a0),_0x35ba5a=await formatQueryOutput(_0x43ea3d,_0x245bfa);_0x2aadd7[_0x5906a9(0x1e1)](_0x35ba5a);}else await handleQueryOutput(_0x43ea3d,_0x3253a0);}catch(_0x210634){const _0x2739d7=_0x36af5f?_0x5906a9(0x1da)+_0x20cd5c+'/'+_0x152ee4+':\x0a':'',_0x26fdbc=_0x210634 instanceof SDKError?_0x210634[_0x5906a9(0x1c7)]:_0x210634[_0x5906a9(0x1c0)];return console[_0x5906a9(0x1eb)](''+_0x2739d7+_0x26fdbc),0x1;}}if(_0x145c70[_0x5906a9(0x1c3)]>0x1&&_0x33efdf&&_0x2aadd7[_0x5906a9(0x1c3)]>0x0){const _0x399eaf=_0x2aadd7['join']('\x0a');writeFileSync(_0xe66add[_0x5906a9(0x1c2)],_0x399eaf),console['error'](_0x5906a9(0x1e7)+_0xe66add[_0x5906a9(0x1c2)]);}return 0x0;}catch(_0x31d895){throw _0x31d895;}}[a36_0x4b6545(0x1cc)](_0x2ad4b6){const _0x1d71ee=a36_0x4b6545,_0x496c3a=_0x2ad4b6[_0x1d71ee(0x1d1)][0x0],_0x5f29ec=_0x2ad4b6[_0x1d71ee(0x1ca)]['file'];if(!_0x496c3a&&!_0x5f29ec)return _0x1d71ee(0x1d7);if(_0x496c3a&&_0x5f29ec)return _0x1d71ee(0x1ed);return undefined;}}
@@ -1 +1 @@
1
- const a37_0x59b560=a37_0x2da3;(function(_0x3e99b3,_0x21fa57){const _0x400c00=a37_0x2da3,_0x244dca=_0x3e99b3();while(!![]){try{const _0x1d39bb=-parseInt(_0x400c00(0x1b4))/0x1+-parseInt(_0x400c00(0x191))/0x2+-parseInt(_0x400c00(0x1ab))/0x3*(parseInt(_0x400c00(0x166))/0x4)+-parseInt(_0x400c00(0x17e))/0x5+-parseInt(_0x400c00(0x1d8))/0x6+parseInt(_0x400c00(0x1af))/0x7+parseInt(_0x400c00(0x173))/0x8*(parseInt(_0x400c00(0x165))/0x9);if(_0x1d39bb===_0x21fa57)break;else _0x244dca['push'](_0x244dca['shift']());}catch(_0x53e3dd){_0x244dca['push'](_0x244dca['shift']());}}}(a37_0x1109,0xd6903));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a37_0x477677 from'chalk';function a37_0x2da3(_0x5b788d,_0x555ed1){_0x5b788d=_0x5b788d-0x15a;const _0x11090d=a37_0x1109();let _0x2da34d=_0x11090d[_0x5b788d];return _0x2da34d;}function formatRelativeTime(_0xd30f21){const _0x5dcdd3=a37_0x2da3,_0xd9b017=new Date(_0xd30f21),_0x5a06d6=new Date(),_0x5dcf48=_0xd9b017[_0x5dcdd3(0x189)]()-_0x5a06d6[_0x5dcdd3(0x189)](),_0x1570f0=Math[_0x5dcdd3(0x184)](_0x5dcf48)/0x3e8,_0x256a5b=_0x5dcf48<0x0;if(_0x1570f0<0x3c)return _0x256a5b?_0x5dcdd3(0x1d0):'soon';else{if(_0x1570f0<0xe10){const _0x3c15e8=Math[_0x5dcdd3(0x1b0)](_0x1570f0/0x3c);return _0x256a5b?_0x3c15e8+'m\x20ago':_0x5dcdd3(0x180)+_0x3c15e8+'m';}else{if(_0x1570f0<0x15180){const _0x2316e3=Math[_0x5dcdd3(0x1b0)](_0x1570f0/0xe10);return _0x256a5b?_0x2316e3+'h\x20ago':'in\x20'+_0x2316e3+'h';}else{if(_0x1570f0<0x93a80){const _0x575b1e=Math[_0x5dcdd3(0x1b0)](_0x1570f0/0x15180);return _0x256a5b?_0x575b1e+'d\x20ago':_0x5dcdd3(0x180)+_0x575b1e+'d';}else return _0xd9b017[_0x5dcdd3(0x18c)]();}}}}export class ScheduleListCommand extends BaseCommand{[a37_0x59b560(0x19c)]=a37_0x59b560(0x185);[a37_0x59b560(0x1a8)]='List\x20scheduled\x20queries';async[a37_0x59b560(0x1b5)](_0x1991a8){const _0x1350dd=a37_0x59b560,{options:_0x516f95,args:_0x587188,tdx:_0x40f8fd}=_0x1991a8,_0x47fef9=resolveLimit(_0x516f95[_0x1350dd(0x183)],DEFAULT_DISPLAY_LIMIT),_0x4e2255=_0x587188[0x0],_0x1e2d91=_0x4e2255?_0x1350dd(0x1e0)+_0x4e2255+'\x22...':'Listing\x20scheduled\x20queries...',_0x1769b6=await withSpinner(_0x1e2d91,()=>_0x40f8fd[_0x1350dd(0x196)][_0x1350dd(0x1cb)]({'limit':_0x47fef9,'scheduled':!![],'pattern':_0x4e2255}),{'verbose':_0x516f95[_0x1350dd(0x177)]}),_0x38070b=_0x1769b6[_0x1350dd(0x1c8)][_0x1350dd(0x174)],_0x4fc879=_0x1769b6[_0x1350dd(0x1c8)][_0x1350dd(0x181)][_0x1350dd(0x1a4)],_0x132d21=_0x4e2255?_0x1350dd(0x1c6)+_0x4e2255+'\x22':'';_0x4fc879?console[_0x1350dd(0x16e)](_0x1350dd(0x15f)+_0x38070b['length']+'\x20schedules'+_0x132d21+_0x1350dd(0x1d4)):console['error']('Found\x20'+_0x38070b[_0x1350dd(0x1a3)]+_0x1350dd(0x1ba)+(_0x38070b['length']!==0x1?'ies':'y')+_0x132d21);if(_0x516f95['format']===_0x1350dd(0x16d)||_0x516f95[_0x1350dd(0x1be)]===_0x1350dd(0x1b6)||_0x516f95[_0x1350dd(0x1be)]===_0x1350dd(0x188)||_0x516f95[_0x1350dd(0x1be)]==='tsv'){const _0x5d0975=_0x38070b[_0x1350dd(0x162)](_0x5c06d8=>({'id':_0x5c06d8['id'],'name':_0x5c06d8[_0x1350dd(0x19c)],'cron':_0x5c06d8[_0x1350dd(0x187)],'database':_0x5c06d8[_0x1350dd(0x182)]?.['name'],'type':_0x5c06d8['type'],'timezone':_0x5c06d8[_0x1350dd(0x1c4)],'user_name':_0x5c06d8[_0x1350dd(0x1d3)]?.[_0x1350dd(0x19c)],'updated_at':_0x5c06d8[_0x1350dd(0x1c5)],'next_run_at':_0x5c06d8[_0x1350dd(0x168)],'last_job_status':_0x5c06d8['last_job']?.['status']}));await handleSDKOutput(_0x5d0975,_0x516f95);}else{if(_0x38070b[_0x1350dd(0x1a3)]===0x0)console[_0x1350dd(0x1cc)](_0x1350dd(0x1ce));else{const _0x4e8c03=_0x516f95[_0x1350dd(0x1cf)],_0x2df98d=_0x38070b[_0x1350dd(0x162)](_0x2a6558=>{const _0x43e7b6=_0x1350dd,_0x16bc73=_0x2a6558['last_job']?.['status']?_0x2a6558['last_job']['status']==='success'?'✓':'✗':'-',_0x14e3a7=_0x2a6558['last_job']?.[_0x43e7b6(0x1a2)]?formatRelativeTime(_0x2a6558[_0x43e7b6(0x171)][_0x43e7b6(0x1a2)]):'never',_0x25d28b=_0x2a6558[_0x43e7b6(0x168)]?formatRelativeTime(_0x2a6558[_0x43e7b6(0x168)]):'-',_0xd4d4c1=_0x2a6558[_0x43e7b6(0x187)]||'',_0x38fe9a=_0x2a6558[_0x43e7b6(0x19c)]||_0x43e7b6(0x1bc),_0x37ab4e=getConsoleUrl(_0x4e8c03,_0x43e7b6(0x16f)+_0x2a6558['id']);return{'statusIcon':_0x16bc73,'lastRun':_0x14e3a7,'nextRun':_0x25d28b,'cron':_0xd4d4c1,'name':_0x38fe9a,'queryUrl':_0x37ab4e,'status':_0x2a6558[_0x43e7b6(0x171)]?.['status']};}),_0x18b84b=Math[_0x1350dd(0x1d2)](..._0x2df98d[_0x1350dd(0x162)](_0x41525c=>_0x41525c[_0x1350dd(0x18d)][_0x1350dd(0x1a3)])),_0x5dbfd8=Math['max'](..._0x2df98d['map'](_0x2855fd=>_0x2855fd[_0x1350dd(0x1d6)][_0x1350dd(0x1a3)])),_0x31d812=Math['max'](..._0x2df98d[_0x1350dd(0x162)](_0xbf7159=>_0xbf7159[_0x1350dd(0x187)]['length'])),_0x446749=_0x2df98d[_0x1350dd(0x162)](_0x262f6f=>{const _0x110019=_0x1350dd,_0x2be93d=_0x262f6f[_0x110019(0x164)]===_0x110019(0x1db)?a37_0x477677[_0x110019(0x19b)](_0x262f6f[_0x110019(0x1df)]):_0x262f6f['status']===_0x110019(0x16e)?a37_0x477677['red'](_0x262f6f[_0x110019(0x1df)]):a37_0x477677[_0x110019(0x18b)](_0x262f6f[_0x110019(0x1df)]),_0x267ff7=_0x262f6f[_0x110019(0x18d)][_0x110019(0x160)](_0x18b84b),_0x52930a=_0x262f6f[_0x110019(0x1d6)][_0x110019(0x160)](_0x5dbfd8),_0x3b22a7=_0x262f6f[_0x110019(0x187)]?a37_0x477677[_0x110019(0x161)](_0x262f6f[_0x110019(0x187)][_0x110019(0x160)](_0x31d812)):'\x20'[_0x110019(0x198)](_0x31d812),_0x2bc5f6=hyperlink(_0x262f6f[_0x110019(0x19c)],_0x262f6f['queryUrl']);return'📅\x20'+_0x2be93d+'\x20'+_0x267ff7+'\x20\x20→\x20'+_0x52930a+'\x20\x20'+_0x3b22a7+'\x20\x20'+_0x2bc5f6;});await writeOutput(_0x446749['join']('\x0a'),_0x516f95['output'],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a37_0x59b560(0x19c)]='schedule:show';[a37_0x59b560(0x1a8)]=a37_0x59b560(0x1dd);[a37_0x59b560(0x1b3)](_0x30bad8){const _0x2b7b71=a37_0x59b560,_0x1aa5d3=_0x30bad8[_0x2b7b71(0x1d5)][0x0];if(!_0x1aa5d3)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async['execute'](_0x2d1421){const _0x147dcf=a37_0x59b560,{options:_0x34ea2a,args:_0x1961d6,tdx:_0x5d2134}=_0x2d1421,_0x39c0e4=_0x1961d6[0x0],_0x3e7edb=await withSpinner(_0x147dcf(0x15b),()=>_0x5d2134[_0x147dcf(0x196)][_0x147dcf(0x190)](_0x39c0e4),{'verbose':_0x34ea2a['verbose']}),_0x1904d0=_0x3e7edb[_0x147dcf(0x1c8)],_0x47ff23={'name':_0x1904d0['name'],'cron':_0x1904d0[_0x147dcf(0x187)],'database':_0x1904d0[_0x147dcf(0x182)],'type':_0x1904d0[_0x147dcf(0x1c1)],'timezone':_0x1904d0[_0x147dcf(0x1e1)],'user_name':_0x1904d0[_0x147dcf(0x170)],'created_at':_0x1904d0[_0x147dcf(0x17f)],'engine_version':_0x1904d0[_0x147dcf(0x175)],'executing_user_id':_0x1904d0['executing_user_id'],'query':_0x1904d0[_0x147dcf(0x1b7)],'delay':_0x1904d0[_0x147dcf(0x17d)],'priority':_0x1904d0['priority'],'retry_limit':_0x1904d0[_0x147dcf(0x15e)],..._0x1904d0['result']&&{'result':_0x1904d0[_0x147dcf(0x16b)]}};return await handleSingleObjectOutput(_0x47ff23,_0x34ea2a),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']=a37_0x59b560(0x1da);[a37_0x59b560(0x1a8)]=a37_0x59b560(0x15a);[a37_0x59b560(0x1b3)](_0x5d9ab3){const _0x4f8947=a37_0x59b560,_0x135d83=_0x5d9ab3['args'][0x0];if(!_0x135d83)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';const _0x22b871=_0x5d9ab3[_0x4f8947(0x167)];if(!_0x22b871['database'])return _0x4f8947(0x179);return undefined;}async[a37_0x59b560(0x1b5)](_0x361f17){const _0x53e2a3=a37_0x59b560,{options:_0xb51b69,args:_0x6d96e3,tdx:_0x561c33}=_0x361f17,_0x392c27=_0x6d96e3[0x0],_0x2dffd6=_0xb51b69,_0x6625c5=_0x2dffd6['database'],_0x26d7fa=_0x2dffd6[_0x53e2a3(0x1b2)],_0x144725=_0x2dffd6[_0x53e2a3(0x1c1)]||_0x53e2a3(0x178);let _0x2913fe;try{_0x2913fe=readFileSync(_0x26d7fa,_0x53e2a3(0x19e))['trim']();}catch(_0x541c3b){throw new SDKError(ErrorCode[_0x53e2a3(0x17c)],_0x53e2a3(0x15d)+_0x26d7fa,_0x541c3b instanceof Error?_0x541c3b:undefined);}if(!_0x2913fe)throw new SDKError(ErrorCode[_0x53e2a3(0x17c)],_0x53e2a3(0x195));const _0x47f11b={'database':_0x6625c5,'query':_0x2913fe,'type':_0x144725};if(_0x2dffd6['cron'])_0x47f11b[_0x53e2a3(0x187)]=_0x2dffd6[_0x53e2a3(0x187)];if(_0x2dffd6[_0x53e2a3(0x1e1)])_0x47f11b[_0x53e2a3(0x1e1)]=_0x2dffd6['timezone'];if(_0x2dffd6[_0x53e2a3(0x17d)]!==undefined)_0x47f11b['delay']=Number(_0x2dffd6[_0x53e2a3(0x17d)]);if(_0x2dffd6['priority']!==undefined)_0x47f11b['priority']=Number(_0x2dffd6['priority']);if(_0x2dffd6['retryLimit']!==undefined)_0x47f11b['retry_limit']=Number(_0x2dffd6[_0x53e2a3(0x1a5)]);if(_0x2dffd6[_0x53e2a3(0x1c7)])_0x47f11b[_0x53e2a3(0x175)]=_0x2dffd6[_0x53e2a3(0x1c7)];if(_0x2dffd6[_0x53e2a3(0x16b)])_0x47f11b[_0x53e2a3(0x16b)]=_0x2dffd6[_0x53e2a3(0x16b)];if(_0xb51b69[_0x53e2a3(0x177)]){console['error'](_0x53e2a3(0x1ac)+_0x392c27),console['error']('\x20\x20Database:\x20'+_0x6625c5),console[_0x53e2a3(0x16e)]('\x20\x20Type:\x20'+_0x144725);if(_0x47f11b['cron'])console[_0x53e2a3(0x16e)]('\x20\x20Cron:\x20'+_0x47f11b[_0x53e2a3(0x187)]);if(_0x47f11b[_0x53e2a3(0x1e1)])console['error'](_0x53e2a3(0x193)+_0x47f11b[_0x53e2a3(0x1e1)]);}const _0x2dcb2c=await withSpinner(_0x53e2a3(0x1e2),()=>_0x561c33[_0x53e2a3(0x196)][_0x53e2a3(0x1de)](_0x392c27,_0x47f11b),{'verbose':_0xb51b69['verbose']});return console[_0x53e2a3(0x16e)](_0x53e2a3(0x1c0)+_0x2dcb2c['data'][_0x53e2a3(0x19c)]),await handleSingleObjectOutput(_0x2dcb2c[_0x53e2a3(0x1c8)],_0xb51b69),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a37_0x59b560(0x19c)]='schedule:update';[a37_0x59b560(0x1a8)]=a37_0x59b560(0x19d);[a37_0x59b560(0x1b3)](_0x1f3460){const _0x4844fb=a37_0x59b560,_0x1687ca=_0x1f3460[_0x4844fb(0x1d5)][0x0];if(!_0x1687ca)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]';return undefined;}async[a37_0x59b560(0x1b5)](_0x175d5f){const _0x29520f=a37_0x59b560,{options:_0x5bfd31,args:_0x1a37ef,tdx:_0x31e5a7}=_0x175d5f,_0x5366d1=_0x1a37ef[0x0],_0x531c32=_0x5bfd31,_0x247e01={};if(_0x531c32['database'])_0x247e01[_0x29520f(0x182)]=_0x531c32[_0x29520f(0x182)];if(_0x531c32[_0x29520f(0x1c1)])_0x247e01[_0x29520f(0x1c1)]=_0x531c32[_0x29520f(0x1c1)];if(_0x531c32[_0x29520f(0x187)])_0x247e01[_0x29520f(0x187)]=_0x531c32[_0x29520f(0x187)];if(_0x531c32[_0x29520f(0x1e1)])_0x247e01[_0x29520f(0x1e1)]=_0x531c32[_0x29520f(0x1e1)];if(_0x531c32[_0x29520f(0x17d)]!==undefined)_0x247e01[_0x29520f(0x17d)]=Number(_0x531c32[_0x29520f(0x17d)]);if(_0x531c32['priority']!==undefined)_0x247e01['priority']=Number(_0x531c32[_0x29520f(0x1c9)]);if(_0x531c32[_0x29520f(0x1a5)]!==undefined)_0x247e01[_0x29520f(0x15e)]=Number(_0x531c32[_0x29520f(0x1a5)]);if(_0x531c32[_0x29520f(0x1c7)])_0x247e01['engine_version']=_0x531c32[_0x29520f(0x1c7)];if(_0x531c32[_0x29520f(0x16b)])_0x247e01[_0x29520f(0x16b)]=_0x531c32[_0x29520f(0x16b)];if(_0x531c32[_0x29520f(0x1b2)])try{_0x247e01[_0x29520f(0x1b7)]=readFileSync(_0x531c32['file'],_0x29520f(0x19e))['trim']();}catch(_0x360370){throw new SDKError(ErrorCode[_0x29520f(0x17c)],_0x29520f(0x15d)+_0x531c32[_0x29520f(0x1b2)],_0x360370 instanceof Error?_0x360370:undefined);}if(Object[_0x29520f(0x1bb)](_0x247e01)[_0x29520f(0x1a3)]===0x0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x29520f(0x1dc));if(_0x5bfd31['verbose']){console['error'](_0x29520f(0x17b)+_0x5366d1);for(const [_0x43d501,_0x49ba94]of Object[_0x29520f(0x18a)](_0x247e01)){_0x43d501===_0x29520f(0x1b7)?console[_0x29520f(0x16e)]('\x20\x20'+_0x43d501+':\x20'+_0x49ba94[_0x29520f(0x1b9)](0x0,0x32)+_0x29520f(0x199)):console['error']('\x20\x20'+_0x43d501+':\x20'+_0x49ba94);}}const _0xa502ad=await withSpinner(_0x29520f(0x17a),()=>_0x31e5a7['schedules'][_0x29520f(0x1b1)](_0x5366d1,_0x247e01),{'verbose':_0x5bfd31[_0x29520f(0x177)]});return console[_0x29520f(0x16e)](_0x29520f(0x1cd)+_0xa502ad[_0x29520f(0x1c8)]['name']),await handleSingleObjectOutput(_0xa502ad[_0x29520f(0x1c8)],_0x5bfd31),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a37_0x59b560(0x19c)]=a37_0x59b560(0x18f);[a37_0x59b560(0x1a8)]='Delete\x20a\x20scheduled\x20query';[a37_0x59b560(0x1b3)](_0x17d49c){const _0x216c79=a37_0x59b560,_0x1e879b=_0x17d49c[_0x216c79(0x1d5)][0x0];if(!_0x1e879b)return _0x216c79(0x1d1);return undefined;}async[a37_0x59b560(0x1b5)](_0x383449){const _0x26a6ae=a37_0x59b560,{options:_0xefb48c,args:_0x48f2aa,tdx:_0x38cc0f}=_0x383449,_0x83a461=_0x48f2aa[0x0];if(!_0xefb48c[_0x26a6ae(0x1d7)]){const _0xb89a84=await confirm(_0x26a6ae(0x1ae)+_0x83a461+'\x22?');if(!_0xb89a84)return console[_0x26a6ae(0x16e)](_0x26a6ae(0x1a7)),0x0;}const _0x3bdc0c=await withSpinner(_0x26a6ae(0x1ad),()=>_0x38cc0f[_0x26a6ae(0x196)]['delete'](_0x83a461),{'verbose':_0xefb48c[_0x26a6ae(0x177)]});return console[_0x26a6ae(0x16e)](_0x26a6ae(0x16a)+_0x3bdc0c[_0x26a6ae(0x1c8)][_0x26a6ae(0x19c)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a37_0x59b560(0x19c)]='schedule:run';['description']=a37_0x59b560(0x192);[a37_0x59b560(0x1b3)](_0x4bb456){const _0x1df101=a37_0x59b560,_0x5ebc1a=_0x4bb456[_0x1df101(0x1d5)][0x0];if(!_0x5ebc1a)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async[a37_0x59b560(0x1b5)](_0x5945e9){const _0x1e4e8e=a37_0x59b560,{options:_0x52516f,args:_0x1cc159,tdx:_0x44d376}=_0x5945e9,_0x572968=_0x1cc159[0x0],_0x58adb5=_0x52516f,_0x42964b=_0x58adb5[_0x1e4e8e(0x197)],_0x35ad12=_0x58adb5[_0x1e4e8e(0x186)]!==undefined?Number(_0x58adb5[_0x1e4e8e(0x186)]):undefined;if(_0x52516f[_0x1e4e8e(0x177)]){console[_0x1e4e8e(0x16e)](_0x1e4e8e(0x1c2)+_0x572968);if(_0x42964b)console[_0x1e4e8e(0x16e)](_0x1e4e8e(0x1a0)+_0x42964b);if(_0x35ad12)console[_0x1e4e8e(0x16e)](_0x1e4e8e(0x169)+_0x35ad12);}const _0x169043=await withSpinner(_0x1e4e8e(0x1aa),()=>_0x44d376[_0x1e4e8e(0x196)][_0x1e4e8e(0x16c)](_0x572968,{'time':_0x42964b,'num':_0x35ad12}),{'verbose':_0x52516f[_0x1e4e8e(0x177)]}),_0x528b3a=_0x169043['data'][_0x1e4e8e(0x1e3)];console['error'](_0x1e4e8e(0x19a)+_0x528b3a[_0x1e4e8e(0x1a3)]+_0x1e4e8e(0x1a1)+(_0x528b3a[_0x1e4e8e(0x1a3)]!==0x1?'s':'')+_0x1e4e8e(0x1a6));for(const _0x296ce7 of _0x528b3a){console[_0x1e4e8e(0x16e)](_0x1e4e8e(0x1ca)+_0x296ce7[_0x1e4e8e(0x1bd)]);}return await handleSDKOutput(_0x528b3a,_0x52516f),0x0;}}function a37_0x1109(){const _0x4bac89=['map','from','status','36ravQvd','4YQFhzu','options','next_run_at','\x20\x20Num:\x20','Schedule\x20deleted:\x20','result','run','json','error','/app/queries/editor?queryId=','user_name','last_job','count','6644328dQQqlb','queries','engine_version','start_at','verbose','trino','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','Updating\x20schedule...','Updating\x20schedule:\x20','INVALID_ARGUMENT','delay','1689465BAsUHh','created_at','in\x20','pagination','database','limit','abs','schedule:list','num','cron','table','getTime','entries','dim','toLocaleDateString','lastRun','scheduled_at','schedule:delete','show','1383554DPdWXF','Run\x20a\x20scheduled\x20query\x20immediately','\x20\x20Timezone:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','Query\x20file\x20is\x20empty','schedules','time','repeat','...','Schedule\x20run\x20submitted:\x20','green','name','Update\x20a\x20scheduled\x20query','utf-8','Show\x20schedule\x20execution\x20history','\x20\x20Time:\x20','\x20job','ended_at','length','has_next_page','retryLimit','\x20created','Cancelled','description','Found\x20','Running\x20schedule...','854205fpHaYl','Creating\x20schedule:\x20','Deleting\x20schedule...','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','9931726IWRepx','round','update','file','validate','941846OMcZIo','execute','jsonl','query','schedule:history','substring','\x20scheduled\x20quer','keys','(unnamed)','job_id','format','history','Schedule\x20created:\x20','type','Running\x20schedule:\x20','\x20(showing\x20','time_zone','updated_at','\x20matching\x20\x22','engineVersion','data','priority','\x20\x20Job\x20ID:\x20','listQueries','log','Schedule\x20updated:\x20','No\x20scheduled\x20queries\x20found','site','just\x20now','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','max','user','\x20(use\x20--limit\x20to\x20see\x20more)','args','nextRun','yes','9635280mvvyYn','\x20execution','schedule:create','success','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','Show\x20schedule\x20details','create','statusIcon','Searching\x20scheduled\x20queries\x20matching\x20\x22','timezone','Creating\x20schedule...','jobs','Create\x20a\x20scheduled\x20query','Getting\x20schedule\x20details...','Getting\x20schedule\x20history...','Failed\x20to\x20read\x20file:\x20','retry_limit','Showing\x20first\x20','padEnd','cyan'];a37_0x1109=function(){return _0x4bac89;};return a37_0x1109();}export class ScheduleHistoryCommand extends BaseCommand{[a37_0x59b560(0x19c)]=a37_0x59b560(0x1b8);['description']=a37_0x59b560(0x19f);[a37_0x59b560(0x1b3)](_0x41c38e){const _0x4d9b71=a37_0x59b560,_0x541280=_0x41c38e['args'][0x0];if(!_0x541280)return _0x4d9b71(0x194);return undefined;}async[a37_0x59b560(0x1b5)](_0x4efba3){const _0x8b71b=a37_0x59b560,{options:_0xf93699,args:_0x56c8bd,tdx:_0x23e2cb}=_0x4efba3,_0x3b1b6d=_0x56c8bd[0x0],_0x4eb9ba=_0xf93699,_0x41c9d5=_0x4eb9ba[_0x8b71b(0x163)]!==undefined?Number(_0x4eb9ba[_0x8b71b(0x163)]):undefined,_0x22f1c5=_0x4eb9ba['to']!==undefined?Number(_0x4eb9ba['to']):undefined,_0x419e60=await withSpinner(_0x8b71b(0x15c),()=>_0x23e2cb[_0x8b71b(0x196)][_0x8b71b(0x1bf)](_0x3b1b6d,{'from':_0x41c9d5,'to':_0x22f1c5}),{'verbose':_0xf93699[_0x8b71b(0x177)]}),_0x119e81=_0x419e60[_0x8b71b(0x1c8)];console['error'](_0x8b71b(0x1a9)+_0x119e81[_0x8b71b(0x172)]+_0x8b71b(0x1d9)+(_0x119e81[_0x8b71b(0x172)]!==0x1?'s':'')+_0x8b71b(0x1c3)+_0x119e81[_0x8b71b(0x163)]+'-'+_0x119e81['to']+')');const _0x294a15=_0x119e81[_0x8b71b(0x1bf)][_0x8b71b(0x162)](_0x25bb51=>({'job_id':_0x25bb51[_0x8b71b(0x1bd)],'type':_0x25bb51[_0x8b71b(0x1c1)],'status':_0x25bb51['status'],'scheduled_at':_0x25bb51[_0x8b71b(0x18e)],'created_at':_0x25bb51[_0x8b71b(0x17f)],'start_at':_0x25bb51[_0x8b71b(0x176)],'end_at':_0x25bb51['end_at']}));return await handleSDKOutput(_0x294a15,_0xf93699),0x0;}}
1
+ const a37_0x2ec4b7=a37_0x4a8e;(function(_0x2c6da0,_0x158a00){const _0xce4e0e=a37_0x4a8e,_0x58e6b3=_0x2c6da0();while(!![]){try{const _0x5c307b=parseInt(_0xce4e0e(0x208))/0x1*(parseInt(_0xce4e0e(0x1b8))/0x2)+parseInt(_0xce4e0e(0x1ad))/0x3*(parseInt(_0xce4e0e(0x232))/0x4)+parseInt(_0xce4e0e(0x1ee))/0x5*(-parseInt(_0xce4e0e(0x1da))/0x6)+parseInt(_0xce4e0e(0x1db))/0x7*(parseInt(_0xce4e0e(0x1b2))/0x8)+parseInt(_0xce4e0e(0x224))/0x9+-parseInt(_0xce4e0e(0x1d4))/0xa+parseInt(_0xce4e0e(0x1f0))/0xb*(parseInt(_0xce4e0e(0x1c2))/0xc);if(_0x5c307b===_0x158a00)break;else _0x58e6b3['push'](_0x58e6b3['shift']());}catch(_0x250117){_0x58e6b3['push'](_0x58e6b3['shift']());}}}(a37_0x2628,0x8d3f2));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a37_0x4a8e(_0x5dff3e,_0x229bc9){_0x5dff3e=_0x5dff3e-0x1a3;const _0x2628ab=a37_0x2628();let _0x4a8e22=_0x2628ab[_0x5dff3e];return _0x4a8e22;}import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a37_0x1b2a99 from'chalk';function formatRelativeTime(_0x3cabc8){const _0x2c4a19=a37_0x4a8e,_0x545fa2=new Date(_0x3cabc8),_0x37507b=new Date(),_0x3814f4=_0x545fa2[_0x2c4a19(0x206)]()-_0x37507b['getTime'](),_0x2f18e4=Math['abs'](_0x3814f4)/0x3e8,_0x52bfb6=_0x3814f4<0x0;if(_0x2f18e4<0x3c)return _0x52bfb6?_0x2c4a19(0x1e7):_0x2c4a19(0x1ef);else{if(_0x2f18e4<0xe10){const _0x2c1f4f=Math[_0x2c4a19(0x1ec)](_0x2f18e4/0x3c);return _0x52bfb6?_0x2c1f4f+_0x2c4a19(0x201):_0x2c4a19(0x1a7)+_0x2c1f4f+'m';}else{if(_0x2f18e4<0x15180){const _0x173995=Math[_0x2c4a19(0x1ec)](_0x2f18e4/0xe10);return _0x52bfb6?_0x173995+_0x2c4a19(0x1aa):_0x2c4a19(0x1a7)+_0x173995+'h';}else{if(_0x2f18e4<0x93a80){const _0x2e17bc=Math[_0x2c4a19(0x1ec)](_0x2f18e4/0x15180);return _0x52bfb6?_0x2e17bc+_0x2c4a19(0x1de):_0x2c4a19(0x1a7)+_0x2e17bc+'d';}else return _0x545fa2[_0x2c4a19(0x1fe)]();}}}}function a37_0x2628(){const _0x3fdecb=['1932990BFSQBY','schedules','updated_at','verbose','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','description','828MZZIiL','7IdHxGj','\x20\x20Type:\x20','Showing\x20first\x20','d\x20ago','status','trino','executing_user_id','schedule:update','tsv','green','padEnd','scheduled_at','just\x20now','table','result','retry_limit','priority','round','options','39675zcFhoa','soon','2962685kNMPAz','created_at','limit','Deleting\x20schedule...','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','\x20execution','Updating\x20schedule...','\x20job','nextRun','retryLimit','user_name','query','jsonl','cron','toLocaleDateString','count','\x20created','m\x20ago','create','Creating\x20schedule...','schedule:history','delete','getTime','data','3tZUDny','Running\x20schedule...','pagination','run','utf-8','\x20scheduled\x20quer','Running\x20schedule:\x20','database','timezone','repeat','List\x20scheduled\x20queries','error','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','yes','schedule:create','length','\x22...','...','Getting\x20schedule\x20details...','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','Found\x20','Schedule\x20updated:\x20','start_at','map','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','next_run_at','file','validate','2026161oJXYne','type','\x20\x20Time:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','site','show','from','\x20\x20Job\x20ID:\x20','never','ies','args','Schedule\x20run\x20submitted:\x20','Query\x20file\x20is\x20empty','Cancelled','1868LdaLQn','list','engine_version','listQueries','schedule:delete','statusIcon','delay','in\x20','(unnamed)','schedule:list','h\x20ago','output','\x20schedules','1221dZdxWu','Failed\x20to\x20read\x20file:\x20','Schedule\x20deleted:\x20','Show\x20schedule\x20details','max','535352GBgNmQ','history','dim','\x20matching\x20\x22','Delete\x20a\x20scheduled\x20query','job_id','384502VxkDUs','success','queryUrl','name','\x20\x20Timezone:\x20','has_next_page','format','end_at','INVALID_ARGUMENT','num','36MPIVAJ','user','trim','lastRun','execute','📅\x20','Create\x20a\x20scheduled\x20query','engineVersion','\x20\x20Num:\x20','jobs','substring','Schedule\x20created:\x20','last_job','Update\x20a\x20scheduled\x20query','Run\x20a\x20scheduled\x20query\x20immediately','schedule:run','Getting\x20schedule\x20history...','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]'];a37_0x2628=function(){return _0x3fdecb;};return a37_0x2628();}export class ScheduleListCommand extends BaseCommand{['name']=a37_0x2ec4b7(0x1a9);[a37_0x2ec4b7(0x1d9)]=a37_0x2ec4b7(0x212);async[a37_0x2ec4b7(0x1c6)](_0x464b1f){const _0x227dbd=a37_0x2ec4b7,{options:_0x351fc0,args:_0xffc875,tdx:_0x147f9e}=_0x464b1f,_0x10ff2f=resolveLimit(_0x351fc0[_0x227dbd(0x1f2)],DEFAULT_DISPLAY_LIMIT),_0x33a1d1=_0xffc875[0x0],_0x42be23=_0x33a1d1?'Searching\x20scheduled\x20queries\x20matching\x20\x22'+_0x33a1d1+_0x227dbd(0x218):'Listing\x20scheduled\x20queries...',_0x3ef4c1=await withSpinner(_0x42be23,()=>_0x147f9e[_0x227dbd(0x1d5)][_0x227dbd(0x1a3)]({'limit':_0x10ff2f,'scheduled':!![],'pattern':_0x33a1d1}),{'verbose':_0x351fc0[_0x227dbd(0x1d7)]}),_0x5c796f=_0x3ef4c1['data']['queries'],_0x16d238=_0x3ef4c1[_0x227dbd(0x207)][_0x227dbd(0x20a)][_0x227dbd(0x1bd)],_0x423b43=_0x33a1d1?_0x227dbd(0x1b5)+_0x33a1d1+'\x22':'';_0x16d238?console[_0x227dbd(0x213)](_0x227dbd(0x1dd)+_0x5c796f['length']+_0x227dbd(0x1ac)+_0x423b43+'\x20(use\x20--limit\x20to\x20see\x20more)'):console[_0x227dbd(0x213)](_0x227dbd(0x21c)+_0x5c796f['length']+_0x227dbd(0x20d)+(_0x5c796f['length']!==0x1?_0x227dbd(0x22d):'y')+_0x423b43);if(_0x351fc0[_0x227dbd(0x1be)]==='json'||_0x351fc0[_0x227dbd(0x1be)]===_0x227dbd(0x1fc)||_0x351fc0[_0x227dbd(0x1be)]===_0x227dbd(0x1e8)||_0x351fc0[_0x227dbd(0x1be)]===_0x227dbd(0x1e3)){const _0x320538=_0x5c796f[_0x227dbd(0x21f)](_0x5633c7=>({'id':_0x5633c7['id'],'name':_0x5633c7[_0x227dbd(0x1bb)],'cron':_0x5633c7[_0x227dbd(0x1fd)],'database':_0x5633c7['database']?.['name'],'type':_0x5633c7[_0x227dbd(0x225)],'timezone':_0x5633c7['time_zone'],'user_name':_0x5633c7[_0x227dbd(0x1c3)]?.[_0x227dbd(0x1bb)],'updated_at':_0x5633c7[_0x227dbd(0x1d6)],'next_run_at':_0x5633c7[_0x227dbd(0x221)],'last_job_status':_0x5633c7[_0x227dbd(0x1ce)]?.[_0x227dbd(0x1df)]}));await handleSDKOutput(_0x320538,_0x351fc0);}else{if(_0x5c796f['length']===0x0)console['log']('No\x20scheduled\x20queries\x20found');else{const _0x4105a5=_0x351fc0[_0x227dbd(0x228)],_0x56ece3=_0x5c796f[_0x227dbd(0x21f)](_0x1271b6=>{const _0x39a99e=_0x227dbd,_0x399990=_0x1271b6['last_job']?.[_0x39a99e(0x1df)]?_0x1271b6['last_job'][_0x39a99e(0x1df)]===_0x39a99e(0x1b9)?'✓':'✗':'-',_0x32be4d=_0x1271b6[_0x39a99e(0x1ce)]?.['ended_at']?formatRelativeTime(_0x1271b6[_0x39a99e(0x1ce)]['ended_at']):_0x39a99e(0x22c),_0x1840a5=_0x1271b6[_0x39a99e(0x221)]?formatRelativeTime(_0x1271b6[_0x39a99e(0x221)]):'-',_0x49af5e=_0x1271b6[_0x39a99e(0x1fd)]||'',_0x107199=_0x1271b6[_0x39a99e(0x1bb)]||_0x39a99e(0x1a8),_0x2e87a8=getConsoleUrl(_0x4105a5,'/app/queries/editor?queryId='+_0x1271b6['id']);return{'statusIcon':_0x399990,'lastRun':_0x32be4d,'nextRun':_0x1840a5,'cron':_0x49af5e,'name':_0x107199,'queryUrl':_0x2e87a8,'status':_0x1271b6['last_job']?.[_0x39a99e(0x1df)]};}),_0x2d2de8=Math[_0x227dbd(0x1b1)](..._0x56ece3[_0x227dbd(0x21f)](_0x443989=>_0x443989[_0x227dbd(0x1c5)]['length'])),_0x31b3cc=Math[_0x227dbd(0x1b1)](..._0x56ece3[_0x227dbd(0x21f)](_0x448eb7=>_0x448eb7[_0x227dbd(0x1f8)][_0x227dbd(0x217)])),_0x5d57f7=Math[_0x227dbd(0x1b1)](..._0x56ece3['map'](_0x4c4ffc=>_0x4c4ffc['cron'][_0x227dbd(0x217)])),_0x37d7a4=_0x56ece3[_0x227dbd(0x21f)](_0x249498=>{const _0x202503=_0x227dbd,_0x482ffa=_0x249498[_0x202503(0x1df)]===_0x202503(0x1b9)?a37_0x1b2a99[_0x202503(0x1e4)](_0x249498[_0x202503(0x1a5)]):_0x249498[_0x202503(0x1df)]===_0x202503(0x213)?a37_0x1b2a99['red'](_0x249498['statusIcon']):a37_0x1b2a99[_0x202503(0x1b4)](_0x249498[_0x202503(0x1a5)]),_0x31934f=_0x249498[_0x202503(0x1c5)][_0x202503(0x1e5)](_0x2d2de8),_0x50b546=_0x249498['nextRun']['padEnd'](_0x31b3cc),_0x278841=_0x249498[_0x202503(0x1fd)]?a37_0x1b2a99['cyan'](_0x249498[_0x202503(0x1fd)]['padEnd'](_0x5d57f7)):'\x20'[_0x202503(0x211)](_0x5d57f7),_0x270bd2=hyperlink(_0x249498['name'],_0x249498[_0x202503(0x1ba)]);return _0x202503(0x1c7)+_0x482ffa+'\x20'+_0x31934f+'\x20\x20→\x20'+_0x50b546+'\x20\x20'+_0x278841+'\x20\x20'+_0x270bd2;});await writeOutput(_0x37d7a4['join']('\x0a'),_0x351fc0[_0x227dbd(0x1ab)],_0x227dbd(0x233));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a37_0x2ec4b7(0x1bb)]='schedule:show';[a37_0x2ec4b7(0x1d9)]=a37_0x2ec4b7(0x1b0);[a37_0x2ec4b7(0x223)](_0x1a1af5){const _0x54ffba=a37_0x2ec4b7,_0x2548c1=_0x1a1af5['args'][0x0];if(!_0x2548c1)return _0x54ffba(0x21b);return undefined;}async['execute'](_0xea6c56){const _0x49183f=a37_0x2ec4b7,{options:_0x16e9fe,args:_0x272a8e,tdx:_0x37e447}=_0xea6c56,_0x6d8594=_0x272a8e[0x0],_0x21ede6=await withSpinner(_0x49183f(0x21a),()=>_0x37e447[_0x49183f(0x1d5)][_0x49183f(0x229)](_0x6d8594),{'verbose':_0x16e9fe['verbose']}),_0x36aed7=_0x21ede6[_0x49183f(0x207)],_0x2239bb={'name':_0x36aed7['name'],'cron':_0x36aed7[_0x49183f(0x1fd)],'database':_0x36aed7[_0x49183f(0x20f)],'type':_0x36aed7[_0x49183f(0x225)],'timezone':_0x36aed7[_0x49183f(0x210)],'user_name':_0x36aed7[_0x49183f(0x1fa)],'created_at':_0x36aed7[_0x49183f(0x1f1)],'engine_version':_0x36aed7[_0x49183f(0x234)],'executing_user_id':_0x36aed7[_0x49183f(0x1e1)],'query':_0x36aed7[_0x49183f(0x1fb)],'delay':_0x36aed7['delay'],'priority':_0x36aed7[_0x49183f(0x1eb)],'retry_limit':_0x36aed7[_0x49183f(0x1ea)],..._0x36aed7[_0x49183f(0x1e9)]&&{'result':_0x36aed7[_0x49183f(0x1e9)]}};return await handleSingleObjectOutput(_0x2239bb,_0x16e9fe),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a37_0x2ec4b7(0x1bb)]=a37_0x2ec4b7(0x216);[a37_0x2ec4b7(0x1d9)]=a37_0x2ec4b7(0x1c8);[a37_0x2ec4b7(0x223)](_0x17345d){const _0x37c7d6=a37_0x2ec4b7,_0x47873a=_0x17345d['args'][0x0];if(!_0x47873a)return _0x37c7d6(0x214);const _0xb5b665=_0x17345d[_0x37c7d6(0x1ed)];if(!_0xb5b665[_0x37c7d6(0x20f)])return _0x37c7d6(0x1d3);return undefined;}async[a37_0x2ec4b7(0x1c6)](_0x3b0d61){const _0x55d992=a37_0x2ec4b7,{options:_0x9f868a,args:_0x24a2cc,tdx:_0x1f865b}=_0x3b0d61,_0x1aff33=_0x24a2cc[0x0],_0x3844b2=_0x9f868a,_0x4784d5=_0x3844b2[_0x55d992(0x20f)],_0x31b0cc=_0x3844b2[_0x55d992(0x222)],_0x3c5e7f=_0x3844b2[_0x55d992(0x225)]||_0x55d992(0x1e0);let _0x395c34;try{_0x395c34=readFileSync(_0x31b0cc,_0x55d992(0x20c))[_0x55d992(0x1c4)]();}catch(_0x41b685){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x55d992(0x1ae)+_0x31b0cc,_0x41b685 instanceof Error?_0x41b685:undefined);}if(!_0x395c34)throw new SDKError(ErrorCode[_0x55d992(0x1c0)],_0x55d992(0x230));const _0x258648={'database':_0x4784d5,'query':_0x395c34,'type':_0x3c5e7f};if(_0x3844b2[_0x55d992(0x1fd)])_0x258648[_0x55d992(0x1fd)]=_0x3844b2[_0x55d992(0x1fd)];if(_0x3844b2[_0x55d992(0x210)])_0x258648['timezone']=_0x3844b2['timezone'];if(_0x3844b2[_0x55d992(0x1a6)]!==undefined)_0x258648[_0x55d992(0x1a6)]=Number(_0x3844b2['delay']);if(_0x3844b2[_0x55d992(0x1eb)]!==undefined)_0x258648['priority']=Number(_0x3844b2[_0x55d992(0x1eb)]);if(_0x3844b2[_0x55d992(0x1f9)]!==undefined)_0x258648[_0x55d992(0x1ea)]=Number(_0x3844b2[_0x55d992(0x1f9)]);if(_0x3844b2[_0x55d992(0x1c9)])_0x258648[_0x55d992(0x234)]=_0x3844b2[_0x55d992(0x1c9)];if(_0x3844b2[_0x55d992(0x1e9)])_0x258648[_0x55d992(0x1e9)]=_0x3844b2['result'];if(_0x9f868a['verbose']){console['error']('Creating\x20schedule:\x20'+_0x1aff33),console[_0x55d992(0x213)]('\x20\x20Database:\x20'+_0x4784d5),console[_0x55d992(0x213)](_0x55d992(0x1dc)+_0x3c5e7f);if(_0x258648[_0x55d992(0x1fd)])console[_0x55d992(0x213)]('\x20\x20Cron:\x20'+_0x258648[_0x55d992(0x1fd)]);if(_0x258648[_0x55d992(0x210)])console[_0x55d992(0x213)](_0x55d992(0x1bc)+_0x258648[_0x55d992(0x210)]);}const _0x37ace2=await withSpinner(_0x55d992(0x203),()=>_0x1f865b[_0x55d992(0x1d5)][_0x55d992(0x202)](_0x1aff33,_0x258648),{'verbose':_0x9f868a['verbose']});return console[_0x55d992(0x213)](_0x55d992(0x1cd)+_0x37ace2[_0x55d992(0x207)][_0x55d992(0x1bb)]),await handleSingleObjectOutput(_0x37ace2[_0x55d992(0x207)],_0x9f868a),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{['name']=a37_0x2ec4b7(0x1e2);[a37_0x2ec4b7(0x1d9)]=a37_0x2ec4b7(0x1cf);['validate'](_0x4a7c05){const _0x4f10ad=a37_0x2ec4b7,_0x2ba7c0=_0x4a7c05[_0x4f10ad(0x22e)][0x0];if(!_0x2ba7c0)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]';return undefined;}async[a37_0x2ec4b7(0x1c6)](_0x2f5994){const _0x45eba8=a37_0x2ec4b7,{options:_0x78c915,args:_0xa6f41c,tdx:_0x363e14}=_0x2f5994,_0x419958=_0xa6f41c[0x0],_0x1c73ef=_0x78c915,_0x160fef={};if(_0x1c73ef[_0x45eba8(0x20f)])_0x160fef['database']=_0x1c73ef['database'];if(_0x1c73ef[_0x45eba8(0x225)])_0x160fef[_0x45eba8(0x225)]=_0x1c73ef[_0x45eba8(0x225)];if(_0x1c73ef['cron'])_0x160fef[_0x45eba8(0x1fd)]=_0x1c73ef[_0x45eba8(0x1fd)];if(_0x1c73ef['timezone'])_0x160fef[_0x45eba8(0x210)]=_0x1c73ef[_0x45eba8(0x210)];if(_0x1c73ef[_0x45eba8(0x1a6)]!==undefined)_0x160fef[_0x45eba8(0x1a6)]=Number(_0x1c73ef[_0x45eba8(0x1a6)]);if(_0x1c73ef[_0x45eba8(0x1eb)]!==undefined)_0x160fef[_0x45eba8(0x1eb)]=Number(_0x1c73ef[_0x45eba8(0x1eb)]);if(_0x1c73ef['retryLimit']!==undefined)_0x160fef[_0x45eba8(0x1ea)]=Number(_0x1c73ef['retryLimit']);if(_0x1c73ef[_0x45eba8(0x1c9)])_0x160fef[_0x45eba8(0x234)]=_0x1c73ef['engineVersion'];if(_0x1c73ef[_0x45eba8(0x1e9)])_0x160fef[_0x45eba8(0x1e9)]=_0x1c73ef['result'];if(_0x1c73ef[_0x45eba8(0x222)])try{_0x160fef[_0x45eba8(0x1fb)]=readFileSync(_0x1c73ef[_0x45eba8(0x222)],'utf-8')[_0x45eba8(0x1c4)]();}catch(_0x4129fe){throw new SDKError(ErrorCode[_0x45eba8(0x1c0)],'Failed\x20to\x20read\x20file:\x20'+_0x1c73ef[_0x45eba8(0x222)],_0x4129fe instanceof Error?_0x4129fe:undefined);}if(Object['keys'](_0x160fef)[_0x45eba8(0x217)]===0x0)throw new SDKError(ErrorCode[_0x45eba8(0x1c0)],_0x45eba8(0x1d8));if(_0x78c915[_0x45eba8(0x1d7)]){console[_0x45eba8(0x213)]('Updating\x20schedule:\x20'+_0x419958);for(const [_0x3d2189,_0xc67699]of Object['entries'](_0x160fef)){_0x3d2189===_0x45eba8(0x1fb)?console[_0x45eba8(0x213)]('\x20\x20'+_0x3d2189+':\x20'+_0xc67699[_0x45eba8(0x1cc)](0x0,0x32)+_0x45eba8(0x219)):console[_0x45eba8(0x213)]('\x20\x20'+_0x3d2189+':\x20'+_0xc67699);}}const _0x44ded1=await withSpinner(_0x45eba8(0x1f6),()=>_0x363e14[_0x45eba8(0x1d5)]['update'](_0x419958,_0x160fef),{'verbose':_0x78c915[_0x45eba8(0x1d7)]});return console['error'](_0x45eba8(0x21d)+_0x44ded1[_0x45eba8(0x207)]['name']),await handleSingleObjectOutput(_0x44ded1[_0x45eba8(0x207)],_0x78c915),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{['name']=a37_0x2ec4b7(0x1a4);[a37_0x2ec4b7(0x1d9)]=a37_0x2ec4b7(0x1b6);[a37_0x2ec4b7(0x223)](_0x3fef84){const _0x1c6bed=a37_0x2ec4b7,_0x2a3061=_0x3fef84[_0x1c6bed(0x22e)][0x0];if(!_0x2a3061)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async[a37_0x2ec4b7(0x1c6)](_0x4477e3){const _0x590737=a37_0x2ec4b7,{options:_0x49d999,args:_0x2fe870,tdx:_0xe03e65}=_0x4477e3,_0x564a2d=_0x2fe870[0x0];if(!_0x49d999[_0x590737(0x215)]){const _0x2081f3=await confirm(_0x590737(0x227)+_0x564a2d+'\x22?');if(!_0x2081f3)return console[_0x590737(0x213)](_0x590737(0x231)),0x0;}const _0x1baf41=await withSpinner(_0x590737(0x1f3),()=>_0xe03e65[_0x590737(0x1d5)][_0x590737(0x205)](_0x564a2d),{'verbose':_0x49d999[_0x590737(0x1d7)]});return console['error'](_0x590737(0x1af)+_0x1baf41[_0x590737(0x207)][_0x590737(0x1bb)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a37_0x2ec4b7(0x1bb)]=a37_0x2ec4b7(0x1d1);[a37_0x2ec4b7(0x1d9)]=a37_0x2ec4b7(0x1d0);[a37_0x2ec4b7(0x223)](_0x5311b2){const _0x8f2a9c=a37_0x2ec4b7,_0x18c1e6=_0x5311b2[_0x8f2a9c(0x22e)][0x0];if(!_0x18c1e6)return _0x8f2a9c(0x1f4);return undefined;}async[a37_0x2ec4b7(0x1c6)](_0x4153ec){const _0x3b8bbc=a37_0x2ec4b7,{options:_0x5c6d64,args:_0x1e3666,tdx:_0x5d0b94}=_0x4153ec,_0x43495c=_0x1e3666[0x0],_0x5ae054=_0x5c6d64,_0x18ed52=_0x5ae054['time'],_0x1d0194=_0x5ae054[_0x3b8bbc(0x1c1)]!==undefined?Number(_0x5ae054[_0x3b8bbc(0x1c1)]):undefined;if(_0x5c6d64['verbose']){console[_0x3b8bbc(0x213)](_0x3b8bbc(0x20e)+_0x43495c);if(_0x18ed52)console[_0x3b8bbc(0x213)](_0x3b8bbc(0x226)+_0x18ed52);if(_0x1d0194)console['error'](_0x3b8bbc(0x1ca)+_0x1d0194);}const _0x41d444=await withSpinner(_0x3b8bbc(0x209),()=>_0x5d0b94[_0x3b8bbc(0x1d5)][_0x3b8bbc(0x20b)](_0x43495c,{'time':_0x18ed52,'num':_0x1d0194}),{'verbose':_0x5c6d64['verbose']}),_0x2da0d8=_0x41d444[_0x3b8bbc(0x207)][_0x3b8bbc(0x1cb)];console[_0x3b8bbc(0x213)](_0x3b8bbc(0x22f)+_0x2da0d8['length']+_0x3b8bbc(0x1f7)+(_0x2da0d8[_0x3b8bbc(0x217)]!==0x1?'s':'')+_0x3b8bbc(0x200));for(const _0x394355 of _0x2da0d8){console[_0x3b8bbc(0x213)](_0x3b8bbc(0x22b)+_0x394355[_0x3b8bbc(0x1b7)]);}return await handleSDKOutput(_0x2da0d8,_0x5c6d64),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a37_0x2ec4b7(0x1bb)]=a37_0x2ec4b7(0x204);[a37_0x2ec4b7(0x1d9)]='Show\x20schedule\x20execution\x20history';[a37_0x2ec4b7(0x223)](_0x13b09d){const _0x530b80=a37_0x2ec4b7,_0x394b9a=_0x13b09d['args'][0x0];if(!_0x394b9a)return _0x530b80(0x220);return undefined;}async['execute'](_0x1cf194){const _0x13884a=a37_0x2ec4b7,{options:_0x4a316a,args:_0x478207,tdx:_0x35706b}=_0x1cf194,_0x503ebc=_0x478207[0x0],_0x2e050a=_0x4a316a,_0x73f51e=_0x2e050a[_0x13884a(0x22a)]!==undefined?Number(_0x2e050a['from']):undefined,_0x42334f=_0x2e050a['to']!==undefined?Number(_0x2e050a['to']):undefined,_0xc5a131=await withSpinner(_0x13884a(0x1d2),()=>_0x35706b[_0x13884a(0x1d5)][_0x13884a(0x1b3)](_0x503ebc,{'from':_0x73f51e,'to':_0x42334f}),{'verbose':_0x4a316a['verbose']}),_0x6006f4=_0xc5a131['data'];console[_0x13884a(0x213)](_0x13884a(0x21c)+_0x6006f4[_0x13884a(0x1ff)]+_0x13884a(0x1f5)+(_0x6006f4[_0x13884a(0x1ff)]!==0x1?'s':'')+'\x20(showing\x20'+_0x6006f4[_0x13884a(0x22a)]+'-'+_0x6006f4['to']+')');const _0x59fef1=_0x6006f4[_0x13884a(0x1b3)][_0x13884a(0x21f)](_0x4f5903=>({'job_id':_0x4f5903[_0x13884a(0x1b7)],'type':_0x4f5903[_0x13884a(0x225)],'status':_0x4f5903[_0x13884a(0x1df)],'scheduled_at':_0x4f5903[_0x13884a(0x1e6)],'created_at':_0x4f5903['created_at'],'start_at':_0x4f5903[_0x13884a(0x21e)],'end_at':_0x4f5903[_0x13884a(0x1bf)]}));return await handleSDKOutput(_0x59fef1,_0x4a316a),0x0;}}
@@ -1 +1 @@
1
- const a38_0x3d8182=a38_0x8d41;(function(_0x487843,_0x21c8a7){const _0x5b165e=a38_0x8d41,_0x269501=_0x487843();while(!![]){try{const _0x410387=parseInt(_0x5b165e(0x11f))/0x1*(-parseInt(_0x5b165e(0x10f))/0x2)+parseInt(_0x5b165e(0x108))/0x3*(parseInt(_0x5b165e(0x13d))/0x4)+parseInt(_0x5b165e(0x149))/0x5*(-parseInt(_0x5b165e(0x1a4))/0x6)+-parseInt(_0x5b165e(0x192))/0x7*(parseInt(_0x5b165e(0x144))/0x8)+-parseInt(_0x5b165e(0x13e))/0x9*(-parseInt(_0x5b165e(0x10a))/0xa)+parseInt(_0x5b165e(0x175))/0xb+-parseInt(_0x5b165e(0x17b))/0xc;if(_0x410387===_0x21c8a7)break;else _0x269501['push'](_0x269501['shift']());}catch(_0x37741b){_0x269501['push'](_0x269501['shift']());}}}(a38_0x1fb2,0xe0923));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';function a38_0x8d41(_0xb3bdd2,_0x239151){_0xb3bdd2=_0xb3bdd2-0xfc;const _0x1fb2fa=a38_0x1fb2();let _0x8d4174=_0x1fb2fa[_0xb3bdd2];return _0x8d4174;}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';function a38_0x1fb2(){const _0x19dc04=['resolveParentId','Target\x20path:\x20','site','getParent','parentFolder','web','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Resolved\x20parent\x20folder\x20ID:\x20','parentId','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Error:\x20Path\x20or\x20name\x20is\x20required','processedRows','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','segmentId','createFolder','data','getSegment','parentSegment','Usage:\x20tdx\x20sg\x20show\x20<name>','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','red','format','24404VWCWJN','20664jRMGGO','Resolved\x20type:\x20','Examples:','content','segment:folder:create','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','3896IzhIBb','/app/ps/','Fetching\x20SQL\x20from\x20rule...','Show\x20folder\x20or\x20child\x20segment\x20details','Folder\x20ID\x20missing\x20from\x20resolved\x20path','332670MWAZBD','\x20\x20Segment\x20name:\x20','log','segment','/e/','Parent\x20segment:\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Resolved\x20relative\x20path\x20to:\x20','SEGMENT_FOLDER_NOT_FOUND','Parent\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','\x20\x20Parent\x20segment:\x20','json','Folder\x20name:\x20','description','stats','cyan','\x20\x20Full\x20path:\x20','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Resolved\x20folder\x20ID:\x20','resolveFolderId','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','message','Error:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','(root)','path','getSegmentSQLFromYaml','url','execute','Use:\x20tdx\x20ps\x20view\x20-w','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Resolving\x20path\x20\x27','elapsedTimeMillis','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','green','limit','Site:\x20','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','11141482iecrpM','segment:folder:show','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Executing\x20segment\x20query...','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Get\x20SQL\x20query\x20for\x20child\x20segment','13937880SvGDij','segmentPath','replace','parent','type','includes','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','SELECT\x20*\x20FROM\x20(\x0a','segment:describe','Creating\x20folder\x20\x27','jsonl','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Folder\x20ID:\x20','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','segment:sql','SQL\x20query:\x0a','Resolving\x20parent\x20folder\x20\x27','jobId','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Use:\x20tdx\x20ps\x20view','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','1897gtuiMR','information_schema','SEGMENT_NOT_FOUND','getSegmentSQL','segment:show','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','Resolving\x20\x27','Resolved\x20parent\x20ID:\x20','segmentName','error','segment:desc','\x20[Job\x20ID:\x20','fullPath','\x20folder','Segment\x20ID:\x20','Fetching\x20folder\x20\x27','66GsgWoc','listFolders','Show\x20segment\x20folder\x20details','code','getSQLFromYamlFile','verbose','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','setJobId','Resolving\x20parent\x20segment\x20\x27','✔\x20Query\x20completed:\x20Processed\x20','Fetching\x20segment\x20details...','folder','INVALID_ARGUMENT','885pKkkyf','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','2390efkzvo','folderId','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Create\x20segment\x20folder\x20for\x20organization','2QSsIff','resolvePathToResource','Resolved:\x20','Use:\x20tdx\x20ps\x20desc','Fetching\x20SQL\x20for\x20segment...','Show\x20child\x20segment\x20schema\x20(column\x20types)','\x27...','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','\x20rows\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','cause','length','\x27\x20with\x20ID:\x20','name','\x20\x20Cause:\x20','getFolder','416217bjbcHt','segment:folder:list','Resolving\x20folder\x20\x27','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Fetching\x20parent\x20segment\x20details...','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both'];a38_0x1fb2=function(){return _0x19dc04;};return a38_0x1fb2();}import{openBrowser}from'../utils/process.js';import a38_0x2e9d84 from'chalk';async function resolveSegmentTarget(_0x5023b1,_0x4d75da,_0x2e7e59){const _0x418e53=a38_0x8d41;if(isYamlFilePath(_0x5023b1))try{const _0x14df5e=await resolveYamlFilePath(_0x5023b1);return _0x2e7e59&&(console[_0x418e53(0x19d)]('Resolved\x20YAML\x20file:\x20'+_0x5023b1),console['error'](_0x418e53(0x155)+_0x14df5e[_0x418e53(0x138)]),console[_0x418e53(0x19d)](_0x418e53(0x14a)+_0x14df5e[_0x418e53(0x19c)]),console[_0x418e53(0x19d)]('\x20\x20Folder\x20path:\x20'+(_0x14df5e['folderPath']||_0x418e53(0x164))),console[_0x418e53(0x19d)](_0x418e53(0x15b)+_0x14df5e[_0x418e53(0x1a0)])),_0x14df5e[_0x418e53(0x1a0)];}catch(_0x3e5cf9){throw new SDKError(ErrorCode[_0x418e53(0x107)],_0x418e53(0x123)+_0x3e5cf9[_0x418e53(0x161)]);}if(!_0x4d75da)throw new SDKError(ErrorCode[_0x418e53(0x107)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x4d75da+'/'+_0x5023b1;}export class SegmentDescribeCommand extends BaseCommand{[a38_0x3d8182(0x11c)]=a38_0x3d8182(0x183);['description']='Show\x20segment\x20or\x20folder\x20details';async['execute'](_0x40a09a){const _0x1f8e8e=a38_0x3d8182,{options:_0x1a930f,args:_0x576bf7,tdx:_0x4812cd}=_0x40a09a,_0xc698a3=_0x576bf7[0x0],_0xf5ad68=!_0xc698a3&&!!_0x1a930f['parentSegment'],_0x739df=_0xc698a3||_0x1a930f['parentSegment'];if(!_0x739df)return console['error'](_0x1f8e8e(0x131)),console['error']('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x1f8e8e(0x19d)]('Examples:'),console[_0x1f8e8e(0x19d)](_0x1f8e8e(0x16c)),console['error'](_0x1f8e8e(0x179)),console[_0x1f8e8e(0x19d)](_0x1f8e8e(0x15f)),console[_0x1f8e8e(0x19d)](_0x1f8e8e(0x13a)),0x1;try{const _0x1a2aab=_0x1a930f[_0x1f8e8e(0x17c)];let _0x583968=_0x739df;!_0xf5ad68&&_0x1a2aab&&!_0x739df[_0x1f8e8e(0x180)]('/')&&(_0x583968=_0x1a2aab+'/'+_0x739df,_0x1a930f['verbose']&&console[_0x1f8e8e(0x19d)](_0x1f8e8e(0x151)+_0x583968));const _0x176877=await withSpinner(_0x1f8e8e(0x16d)+_0x583968+'\x27...',()=>_0x4812cd[_0x1f8e8e(0x14c)][_0x1f8e8e(0x110)](_0x583968),{'verbose':_0x1a930f[_0x1f8e8e(0x100)]}),_0x49d9b8=_0x176877['data'];_0x1a930f['verbose']&&(console[_0x1f8e8e(0x19d)]('Resolved\x20type:\x20'+_0x49d9b8[_0x1f8e8e(0x17f)]),console[_0x1f8e8e(0x19d)](_0x1f8e8e(0x153)+_0x49d9b8[_0x1f8e8e(0x12f)]),_0x49d9b8[_0x1f8e8e(0x10b)]&&console['error'](_0x1f8e8e(0x187)+_0x49d9b8[_0x1f8e8e(0x10b)]),_0x49d9b8[_0x1f8e8e(0x134)]&&console[_0x1f8e8e(0x19d)](_0x1f8e8e(0x1a2)+_0x49d9b8[_0x1f8e8e(0x134)]));if(_0x49d9b8[_0x1f8e8e(0x17f)]===_0x1f8e8e(0x17e)){const _0x44c0f0=await withSpinner(_0x1f8e8e(0x124),()=>_0x4812cd[_0x1f8e8e(0x14c)][_0x1f8e8e(0x129)](_0x49d9b8[_0x1f8e8e(0x12f)]),{'verbose':_0x1a930f[_0x1f8e8e(0x100)]});await handleSingleObjectOutput(_0x44c0f0[_0x1f8e8e(0x136)],_0x1a930f);}else{if(_0x49d9b8[_0x1f8e8e(0x17f)]===_0x1f8e8e(0x106)){if(!_0x49d9b8[_0x1f8e8e(0x10b)])throw new SDKError(ErrorCode[_0x1f8e8e(0x152)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x44f008=await withSpinner('Fetching\x20folder\x20details...',()=>_0x4812cd[_0x1f8e8e(0x14c)][_0x1f8e8e(0x11e)](_0x49d9b8['folderId']),{'verbose':_0x1a930f['verbose']});await handleSingleObjectOutput(_0x44f008[_0x1f8e8e(0x136)],_0x1a930f);}else{if(_0x49d9b8['type']==='segment'){if(!_0x49d9b8['segmentId'])throw new SDKError(ErrorCode[_0x1f8e8e(0x194)],_0x1f8e8e(0x150));const _0x32a63f=await withSpinner(_0x1f8e8e(0x105),()=>_0x4812cd['segment'][_0x1f8e8e(0x137)](_0x49d9b8[_0x1f8e8e(0x12f)],_0x49d9b8[_0x1f8e8e(0x134)]),{'verbose':_0x1a930f[_0x1f8e8e(0x100)]});await handleSingleObjectOutput(_0x32a63f[_0x1f8e8e(0x136)],_0x1a930f);}}}return 0x0;}catch(_0x2f6525){if(_0x2f6525 instanceof SDKError)return console['error']('Error:\x20'+_0x2f6525['message']),_0x2f6525['cause']&&console[_0x1f8e8e(0x19d)](_0x1f8e8e(0x11d)+_0x2f6525['cause']),0x1;throw _0x2f6525;}}}export class SegmentShowCommand extends BaseCommand{[a38_0x3d8182(0x11c)]=a38_0x3d8182(0x196);[a38_0x3d8182(0x158)]=a38_0x3d8182(0x177);async[a38_0x3d8182(0x168)](_0x28c8eb){const _0x120964=a38_0x3d8182,{options:_0x3ec2d3,args:_0x423966,tdx:_0x4b08ff}=_0x28c8eb,_0x327e4e=_0x423966[0x0];if(!_0x327e4e)return console[_0x120964(0x19d)](_0x120964(0x10c)),console[_0x120964(0x19d)](_0x120964(0x139)),console[_0x120964(0x19d)](_0x120964(0x118)),console[_0x120964(0x19d)](_0x120964(0x140)),console[_0x120964(0x19d)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x120964(0x19d)](_0x120964(0x189)),0x1;try{const _0x3bffb5=_0x3ec2d3['parentSegment'],_0x4116c6=await resolveSegmentTarget(_0x327e4e,_0x3bffb5,_0x3ec2d3['verbose']);_0x3ec2d3['verbose']&&console[_0x120964(0x19d)]('Target\x20path:\x20'+_0x4116c6);const _0x57f37e=await withSpinner(_0x120964(0x19a)+_0x327e4e+_0x120964(0x115),()=>_0x4b08ff[_0x120964(0x14c)][_0x120964(0x110)](_0x4116c6),{'verbose':_0x3ec2d3[_0x120964(0x100)]}),_0x50766e=_0x57f37e['data'];_0x3ec2d3[_0x120964(0x100)]&&(console[_0x120964(0x19d)](_0x120964(0x13f)+_0x50766e['type']),console['error']('Parent\x20ID:\x20'+_0x50766e[_0x120964(0x12f)]));if(_0x50766e[_0x120964(0x17f)]===_0x120964(0x106))return console[_0x120964(0x19d)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0x120964(0x19d)](_0x120964(0x109)),0x1;if(_0x50766e[_0x120964(0x17f)]==='parent')return console[_0x120964(0x19d)](_0x120964(0x197)),console[_0x120964(0x19d)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x50766e[_0x120964(0x134)])throw new SDKError(ErrorCode[_0x120964(0x194)],_0x120964(0x150));const _0x2654a7=await withSpinner(_0x120964(0x113),()=>_0x4b08ff[_0x120964(0x14c)][_0x120964(0x195)](_0x50766e[_0x120964(0x12f)],_0x50766e['segmentId']),{'verbose':_0x3ec2d3[_0x120964(0x100)]});let _0x405761=_0x2654a7[_0x120964(0x136)];const _0x13dae1=resolveLimit(_0x3ec2d3[_0x120964(0x172)],DEFAULT_DISPLAY_LIMIT),_0x271f23=/\bLIMIT\s+\d+/i['test'](_0x405761);!_0x271f23&&(_0x405761=_0x405761['trim']()[_0x120964(0x17d)](/;+$/,''),_0x405761=_0x120964(0x182)+_0x405761+_0x120964(0x12d)+_0x13dae1);_0x3ec2d3[_0x120964(0x100)]&&console[_0x120964(0x19d)](_0x120964(0x18b)+_0x405761);const _0x5e8e52=await withProgressSpinner(_0x120964(0x178),async _0x3ab730=>{const _0x146efd=_0x120964,_0x4e151a=await _0x4b08ff['query'][_0x146efd(0x168)](_0x405761,{'catalog':'td','schema':_0x146efd(0x193),'onJobId':_0x17b6f1=>{const _0x57e0d1=_0x146efd;_0x3ab730[_0x57e0d1(0x102)](_0x17b6f1);}});return _0x4e151a;},{'verbose':_0x3ec2d3[_0x120964(0x100)]}),_0x36ba2b=_0x5e8e52[_0x120964(0x136)],_0x44eb4c=_0x36ba2b[_0x120964(0x18d)]?_0x120964(0x19f)+_0x36ba2b[_0x120964(0x18d)]+']':'';return console['error'](_0x120964(0x104)+_0x36ba2b[_0x120964(0x159)][_0x120964(0x132)]['toLocaleString']()+_0x120964(0x117)+('in\x20'+formatElapsed(_0x36ba2b[_0x120964(0x159)][_0x120964(0x16e)])+_0x44eb4c)),await handleQueryOutput(_0x36ba2b,_0x3ec2d3),0x0;}catch(_0x47d9ca){if(_0x47d9ca instanceof SDKError)return console[_0x120964(0x19d)]('✖\x20Query\x20failed\x20['+_0x47d9ca[_0x120964(0xfe)]+']'),console['error']('\x0a'+_0x47d9ca[_0x120964(0x161)]),0x1;throw _0x47d9ca;}}}export class SegmentFolderListCommand extends BaseCommand{[a38_0x3d8182(0x11c)]=a38_0x3d8182(0x120);[a38_0x3d8182(0x158)]=a38_0x3d8182(0x130);async[a38_0x3d8182(0x168)](_0x433b17){const _0x5a0063=a38_0x3d8182,{options:_0x425495,args:_0xa8d82e,tdx:_0x1d38ca}=_0x433b17;if(_0xa8d82e[_0x5a0063(0x11a)]===0x0)return console[_0x5a0063(0x19d)](_0x5a0063(0x14f)),console[_0x5a0063(0x19d)](_0x5a0063(0x181)),0x1;const _0x45892e=_0xa8d82e[0x0];try{_0x425495['verbose']&&(console[_0x5a0063(0x19d)]('Site:\x20'+_0x425495[_0x5a0063(0x128)]),console[_0x5a0063(0x19d)]('Parent\x20name:\x20'+_0x45892e));const _0x3fe689=await withSpinner(_0x5a0063(0x103)+_0x45892e+_0x5a0063(0x115),()=>_0x1d38ca[_0x5a0063(0x14c)][_0x5a0063(0x126)](_0x45892e),{'verbose':_0x425495[_0x5a0063(0x100)]}),_0x367ee0=_0x3fe689[_0x5a0063(0x136)];_0x425495[_0x5a0063(0x100)]&&console[_0x5a0063(0x19d)](_0x5a0063(0x19b)+_0x367ee0);const _0x5e91bf=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x45892e+'\x27...',()=>_0x1d38ca['segment'][_0x5a0063(0xfc)](_0x367ee0),{'verbose':_0x425495[_0x5a0063(0x100)]}),_0x1476f9=_0x5e91bf[_0x5a0063(0x136)];return console[_0x5a0063(0x19d)]('✔\x20Found\x20'+_0x1476f9['length']+_0x5a0063(0x1a1)+(_0x1476f9['length']!==0x1?'s':'')),await handleSDKOutput(_0x1476f9,_0x425495),0x0;}catch(_0x1c2215){if(_0x1c2215 instanceof SDKError)return console[_0x5a0063(0x19d)](_0x5a0063(0x162)+_0x1c2215[_0x5a0063(0x161)]),_0x1c2215['cause']&&console[_0x5a0063(0x19d)]('\x20\x20Cause:\x20'+_0x1c2215[_0x5a0063(0x119)]),0x1;throw _0x1c2215;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a38_0x3d8182(0x176);[a38_0x3d8182(0x158)]=a38_0x3d8182(0xfd);async[a38_0x3d8182(0x168)](_0x778fcc){const _0x33b351=a38_0x3d8182,{options:_0x4296aa,args:_0x1a0717,tdx:_0x227b22}=_0x778fcc;if(_0x1a0717['length']===0x0)return console[_0x33b351(0x19d)]('Error:\x20Folder\x20reference\x20is\x20required'),console[_0x33b351(0x19d)](_0x33b351(0x188)),0x1;try{const {parentId:_0x10b119,childId:_0x1e0fcf}=parseSegmentRef(_0x1a0717[0x0]);_0x4296aa[_0x33b351(0x100)]&&(console[_0x33b351(0x19d)](_0x33b351(0x173)+_0x4296aa[_0x33b351(0x128)]),console[_0x33b351(0x19d)]('Parent\x20name:\x20'+_0x10b119),_0x1e0fcf&&console['error'](_0x33b351(0x157)+_0x1e0fcf));if(!_0x1e0fcf)return console[_0x33b351(0x19d)](_0x33b351(0x101)),0x1;const _0x4f06ec=await withSpinner(_0x33b351(0x103)+_0x10b119+_0x33b351(0x115),()=>_0x227b22[_0x33b351(0x14c)]['resolveParentId'](_0x10b119),{'verbose':_0x4296aa[_0x33b351(0x100)]}),_0x8eab9b=_0x4f06ec['data'];_0x4296aa['verbose']&&console[_0x33b351(0x19d)](_0x33b351(0x19b)+_0x8eab9b);const _0x2c96fd=await withSpinner(_0x33b351(0x121)+_0x1e0fcf+_0x33b351(0x115),()=>_0x227b22[_0x33b351(0x14c)][_0x33b351(0x15e)](_0x8eab9b,_0x1e0fcf),{'verbose':_0x4296aa['verbose']}),_0x3f3e89=_0x2c96fd[_0x33b351(0x136)];_0x4296aa[_0x33b351(0x100)]&&console['error'](_0x33b351(0x15d)+_0x3f3e89);const _0x2cb34d=await withSpinner(_0x33b351(0x1a3)+_0x1e0fcf+'\x27...',()=>_0x227b22[_0x33b351(0x14c)][_0x33b351(0x11e)](_0x3f3e89),{'verbose':_0x4296aa[_0x33b351(0x100)]});return await handleSDKOutput([_0x2cb34d[_0x33b351(0x136)]],_0x4296aa),0x0;}catch(_0x375947){if(_0x375947 instanceof SDKError)return console[_0x33b351(0x19d)](_0x33b351(0x162)+_0x375947['message']),_0x375947[_0x33b351(0x119)]&&console[_0x33b351(0x19d)](_0x33b351(0x11d)+_0x375947[_0x33b351(0x119)]),0x1;throw _0x375947;}}}export class SegmentSQLCommand extends BaseCommand{[a38_0x3d8182(0x11c)]=a38_0x3d8182(0x18a);[a38_0x3d8182(0x158)]=a38_0x3d8182(0x17a);async[a38_0x3d8182(0x168)](_0x174d35){const _0x38121f=a38_0x3d8182,{options:_0x4fdd73,args:_0xa8a0cf}=_0x174d35,_0x5b40a2=_0x4fdd73,_0xf09389=_0x5b40a2[_0x38121f(0x165)],_0xbd97a3=_0xa8a0cf[0x0];if(!_0xbd97a3&&!_0xf09389)return console[_0x38121f(0x19d)](a38_0x2e9d84[_0x38121f(0x13b)](_0x38121f(0x133))),console[_0x38121f(0x19d)]('Usage:'),console[_0x38121f(0x19d)]('\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>'),console[_0x38121f(0x19d)](_0x38121f(0x199)),console[_0x38121f(0x19d)](_0x38121f(0x140)),console[_0x38121f(0x19d)]('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x38121f(0x19d)](_0x38121f(0x122)),0x1;if(_0xbd97a3&&_0xf09389)return console[_0x38121f(0x19d)](a38_0x2e9d84[_0x38121f(0x13b)](_0x38121f(0x125))),0x1;try{let _0x2bf6da;if(_0xf09389)_0x2bf6da=await this[_0x38121f(0xff)](_0xf09389,_0x174d35);else{if(isYamlFilePath(_0xbd97a3))return console['error'](a38_0x2e9d84[_0x38121f(0x13b)](_0x38121f(0x143))),console['error']('\x20\x20tdx\x20sg\x20sql\x20--path\x20'+_0xbd97a3),0x1;else _0x2bf6da=await this['getSQLFromServerSegment'](_0xbd97a3,_0x174d35);}return _0x4fdd73[_0x38121f(0x13c)]===_0x38121f(0x156)||_0x4fdd73[_0x38121f(0x13c)]===_0x38121f(0x185)?await handleSDKOutput([{'sql':_0x2bf6da}],_0x4fdd73):console[_0x38121f(0x14b)](_0x2bf6da),0x0;}catch(_0x1e1205){if(_0x1e1205 instanceof SDKError)return console['error']('Error:\x20'+_0x1e1205[_0x38121f(0x161)]),_0x1e1205[_0x38121f(0x119)]&&console['error']('\x20\x20Cause:\x20'+_0x1e1205[_0x38121f(0x119)]),0x1;throw _0x1e1205;}}async[a38_0x3d8182(0xff)](_0x4ec826,_0x766fb0){const _0x2649ce=a38_0x3d8182,{options:_0x3095be,tdx:_0x262d64}=_0x766fb0;let _0x617730;try{_0x617730=await resolveYamlFilePath(_0x4ec826);}catch(_0x529edc){throw new SDKError(ErrorCode[_0x2649ce(0x107)],_0x2649ce(0x123)+_0x529edc[_0x2649ce(0x161)]);}_0x3095be[_0x2649ce(0x100)]&&console['error'](_0x2649ce(0x111)+_0x617730['parentSegment']+'/'+_0x617730['segmentName']);const _0x377472=await withSpinner(_0x2649ce(0x146),()=>_0x262d64['segment'][_0x2649ce(0x166)](_0x617730[_0x2649ce(0x141)],_0x617730[_0x2649ce(0x138)],_0x617730['segmentName']),{'verbose':_0x3095be[_0x2649ce(0x100)]});return _0x377472[_0x2649ce(0x136)];}async['getSQLFromServerSegment'](_0x3fcee5,_0xa9f855){const _0x31316f=a38_0x3d8182,{options:_0x49d408,tdx:_0x1550bc}=_0xa9f855,_0x1cc909=_0x49d408['parentSegment'],_0x2404fe=await resolveSegmentTarget(_0x3fcee5,_0x1cc909,_0x49d408[_0x31316f(0x100)]);_0x49d408[_0x31316f(0x100)]&&console[_0x31316f(0x19d)](_0x31316f(0x127)+_0x2404fe);const _0x12d189=await withSpinner(_0x31316f(0x19a)+_0x3fcee5+_0x31316f(0x115),()=>_0x1550bc[_0x31316f(0x14c)][_0x31316f(0x110)](_0x2404fe),{'verbose':_0x49d408[_0x31316f(0x100)]}),_0x28a529=_0x12d189[_0x31316f(0x136)];_0x49d408[_0x31316f(0x100)]&&(console['error'](_0x31316f(0x13f)+_0x28a529[_0x31316f(0x17f)]),console[_0x31316f(0x19d)](_0x31316f(0x153)+_0x28a529[_0x31316f(0x12f)]));if(_0x28a529[_0x31316f(0x17f)]==='folder')throw new SDKError(ErrorCode[_0x31316f(0x107)],_0x31316f(0x160));if(_0x28a529[_0x31316f(0x17f)]==='parent')throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x31316f(0x191));if(!_0x28a529[_0x31316f(0x134)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x31316f(0x150));const _0x576798=await withSpinner(_0x31316f(0x113),()=>_0x1550bc['segment']['getSegmentSQL'](_0x28a529['parentId'],_0x28a529[_0x31316f(0x134)]),{'verbose':_0x49d408['verbose']});return _0x576798[_0x31316f(0x136)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a38_0x3d8182(0x11c)]=a38_0x3d8182(0x142);[a38_0x3d8182(0x158)]=a38_0x3d8182(0x10e);async[a38_0x3d8182(0x168)](_0x225d35){const _0x288d9d=a38_0x3d8182,{options:_0x4cbd57,args:_0x52ac16,tdx:_0x10adfd}=_0x225d35,_0x42462=_0x4cbd57;if(_0x52ac16[_0x288d9d(0x11a)]<0x2)return console['error'](_0x288d9d(0x16f)),console[_0x288d9d(0x19d)](_0x288d9d(0x174)),0x1;const _0x1f4af7=_0x52ac16[0x0],_0x4524ef=_0x52ac16[0x1];_0x42462[_0x288d9d(0x100)]&&(console['error'](_0x288d9d(0x173)+_0x42462[_0x288d9d(0x128)]),console[_0x288d9d(0x19d)](_0x288d9d(0x14e)+_0x1f4af7),console[_0x288d9d(0x19d)](_0x288d9d(0x157)+_0x4524ef));let _0x789f8f;if(_0x42462['parentFolder']){const _0x12c22c=_0x42462[_0x288d9d(0x12a)],_0x19a94=await withSpinner(_0x288d9d(0x103)+_0x1f4af7+_0x288d9d(0x115),()=>_0x10adfd[_0x288d9d(0x14c)][_0x288d9d(0x126)](_0x1f4af7),{'verbose':_0x42462['verbose']}),_0x384071=_0x19a94['data'],_0x167f98=await withSpinner(_0x288d9d(0x18c)+_0x12c22c+'\x27...',()=>_0x10adfd[_0x288d9d(0x14c)][_0x288d9d(0x15e)](_0x384071,_0x12c22c),{'verbose':_0x42462[_0x288d9d(0x100)]});_0x789f8f=_0x167f98[_0x288d9d(0x136)],_0x42462[_0x288d9d(0x100)]&&console['error'](_0x288d9d(0x12e)+_0x789f8f);}const _0x131ba5={'name':_0x4524ef,'description':_0x42462[_0x288d9d(0x158)],'parentFolderId':_0x789f8f},_0x560a23=await withSpinner(_0x288d9d(0x184)+_0x4524ef+'\x27...',()=>_0x10adfd[_0x288d9d(0x14c)][_0x288d9d(0x135)](_0x1f4af7,_0x131ba5),{'verbose':_0x42462[_0x288d9d(0x100)]}),_0x5c4729=_0x560a23[_0x288d9d(0x136)];return console[_0x288d9d(0x19d)]('✔\x20Created\x20folder\x20\x27'+_0x5c4729['name']+_0x288d9d(0x11b)+_0x5c4729['id']),await handleSDKOutput([_0x5c4729],_0x42462),0x0;}}export class SegmentViewCommand extends BaseCommand{[a38_0x3d8182(0x11c)]='segment:view';[a38_0x3d8182(0x158)]=a38_0x3d8182(0x147);async['execute'](_0x5e0486){const _0x18c60b=a38_0x3d8182,{options:_0x36afd0,args:_0x1df92e,tdx:_0x5de38a}=_0x5e0486,_0x3705dc=_0x1df92e[0x0];if(!_0x3705dc)return console[_0x18c60b(0x19d)](_0x18c60b(0x12c)),console['error']('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console['error'](_0x18c60b(0x16b)),console['error']('Options:'),console[_0x18c60b(0x19d)](_0x18c60b(0x190)),console['error'](_0x18c60b(0x140)),console[_0x18c60b(0x19d)](_0x18c60b(0x16a)),console['error'](_0x18c60b(0x198)),console['error'](_0x18c60b(0x116)),console[_0x18c60b(0x19d)](_0x18c60b(0x18e)),0x1;try{const _0x25d593=_0x36afd0[_0x18c60b(0x138)],_0x49b638=await resolveSegmentTarget(_0x3705dc,_0x25d593,_0x36afd0[_0x18c60b(0x100)]);_0x36afd0[_0x18c60b(0x100)]&&console['error'](_0x18c60b(0x127)+_0x49b638);const _0x1a3e0b=await withSpinner(_0x18c60b(0x19a)+_0x3705dc+_0x18c60b(0x115),()=>_0x5de38a[_0x18c60b(0x14c)][_0x18c60b(0x110)](_0x49b638),{'verbose':_0x36afd0[_0x18c60b(0x100)]}),_0x3c34c7=_0x1a3e0b['data'];_0x36afd0[_0x18c60b(0x100)]&&(console[_0x18c60b(0x19d)]('Resolved\x20type:\x20'+_0x3c34c7[_0x18c60b(0x17f)]),console[_0x18c60b(0x19d)]('Parent\x20ID:\x20'+_0x3c34c7[_0x18c60b(0x12f)]),_0x3c34c7['folderId']&&console['error'](_0x18c60b(0x187)+_0x3c34c7[_0x18c60b(0x10b)]),_0x3c34c7[_0x18c60b(0x134)]&&console[_0x18c60b(0x19d)]('Segment\x20ID:\x20'+_0x3c34c7[_0x18c60b(0x134)]));if(_0x36afd0[_0x18c60b(0x12b)]){if(_0x3c34c7[_0x18c60b(0x17f)]==='folder')return console[_0x18c60b(0x19d)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x3c34c7[_0x18c60b(0x17f)]===_0x18c60b(0x17e))return console[_0x18c60b(0x19d)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x18c60b(0x19d)](_0x18c60b(0x169)),0x1;if(!_0x3c34c7[_0x18c60b(0x134)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x18c60b(0x150));const _0x1d22b1=getConsoleNextUrl(_0x36afd0[_0x18c60b(0x128)],'/app/ps/'+_0x3c34c7[_0x18c60b(0x12f)]+_0x18c60b(0x14d)+_0x3c34c7[_0x18c60b(0x134)]);return console['error'](a38_0x2e9d84[_0x18c60b(0x171)]('✔')+'\x20Opening\x20'+a38_0x2e9d84[_0x18c60b(0x15a)](_0x1d22b1)),openBrowser(_0x1d22b1),0x0;}if(_0x3c34c7[_0x18c60b(0x17f)]===_0x18c60b(0x106)){if(!_0x3c34c7['folderId'])throw new SDKError(ErrorCode[_0x18c60b(0x152)],_0x18c60b(0x148));const _0x19f78b=await withSpinner('Fetching\x20folder\x20details...',()=>_0x5de38a[_0x18c60b(0x14c)][_0x18c60b(0x11e)](_0x3c34c7[_0x18c60b(0x10b)]),{'verbose':_0x36afd0['verbose']});await handleSingleObjectOutput(_0x19f78b[_0x18c60b(0x136)],_0x36afd0);}else{if(_0x3c34c7[_0x18c60b(0x17f)]===_0x18c60b(0x14c)){if(!_0x3c34c7[_0x18c60b(0x134)])throw new SDKError(ErrorCode[_0x18c60b(0x194)],_0x18c60b(0x150));const _0xdc042b=await withSpinner('Fetching\x20segment\x20details...',()=>_0x5de38a[_0x18c60b(0x14c)][_0x18c60b(0x137)](_0x3c34c7[_0x18c60b(0x12f)],_0x3c34c7[_0x18c60b(0x134)]),{'verbose':_0x36afd0[_0x18c60b(0x100)]}),_0x11723d=getConsoleNextUrl(_0x36afd0[_0x18c60b(0x128)],_0x18c60b(0x145)+_0x3c34c7['parentId']+'/e/'+_0x3c34c7[_0x18c60b(0x134)]),_0x20cc9d=_0xdc042b[_0x18c60b(0x136)];_0x20cc9d[_0x18c60b(0x167)]=_0x11723d,await handleSingleObjectOutput(_0x20cc9d,_0x36afd0);}else return console[_0x18c60b(0x19d)](_0x18c60b(0x170)),console[_0x18c60b(0x19d)](_0x18c60b(0x18f)),0x1;}return 0x0;}catch(_0x3ed7e9){if(_0x3ed7e9 instanceof SDKError)return console['error'](_0x18c60b(0x162)+_0x3ed7e9[_0x18c60b(0x161)]),_0x3ed7e9[_0x18c60b(0x119)]&&console[_0x18c60b(0x19d)](_0x18c60b(0x11d)+_0x3ed7e9[_0x18c60b(0x119)]),0x1;throw _0x3ed7e9;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a38_0x3d8182(0x11c)]=a38_0x3d8182(0x19e);[a38_0x3d8182(0x158)]=a38_0x3d8182(0x114);async[a38_0x3d8182(0x168)](_0x5da467){const _0x1b639e=a38_0x3d8182,{options:_0x3cba44,args:_0x214cb2,tdx:_0x1f268e}=_0x5da467,_0xa31263=_0x214cb2[0x0];if(!_0xa31263)return console[_0x1b639e(0x19d)](_0x1b639e(0x10c)),console['error']('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x1b639e(0x19d)](_0x1b639e(0x154)),console['error'](_0x1b639e(0x140)),console['error']('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x1b639e(0x19d)](_0x1b639e(0x10d)),0x1;try{const _0x1cfd34=_0x3cba44['parentSegment'],_0x330049=await resolveSegmentTarget(_0xa31263,_0x1cfd34,_0x3cba44[_0x1b639e(0x100)]);_0x3cba44['verbose']&&console['error'](_0x1b639e(0x127)+_0x330049);const _0x268a9e=await withSpinner(_0x1b639e(0x19a)+_0xa31263+_0x1b639e(0x115),()=>_0x1f268e['segment'][_0x1b639e(0x110)](_0x330049),{'verbose':_0x3cba44[_0x1b639e(0x100)]}),_0x7b26ae=_0x268a9e[_0x1b639e(0x136)];_0x3cba44[_0x1b639e(0x100)]&&(console['error']('Resolved\x20type:\x20'+_0x7b26ae[_0x1b639e(0x17f)]),console[_0x1b639e(0x19d)]('Parent\x20ID:\x20'+_0x7b26ae[_0x1b639e(0x12f)]));if(_0x7b26ae['type']==='folder')return console[_0x1b639e(0x19d)](_0x1b639e(0x163)),console[_0x1b639e(0x19d)](_0x1b639e(0x15c)),0x1;if(_0x7b26ae[_0x1b639e(0x17f)]==='parent')return console[_0x1b639e(0x19d)](_0x1b639e(0x186)),console[_0x1b639e(0x19d)](_0x1b639e(0x112)),0x1;if(!_0x7b26ae[_0x1b639e(0x134)])throw new SDKError(ErrorCode[_0x1b639e(0x194)],_0x1b639e(0x150));const _0x5bfbeb=await withSpinner(_0x1b639e(0x113),()=>_0x1f268e[_0x1b639e(0x14c)][_0x1b639e(0x195)](_0x7b26ae[_0x1b639e(0x12f)],_0x7b26ae[_0x1b639e(0x134)]),{'verbose':_0x3cba44['verbose']}),_0xf33627=_0x5bfbeb[_0x1b639e(0x136)],_0x51ad8e=await executeSchemaQuery(_0xf33627,_0x1f268e,_0x3cba44);return await handleQueryOutput(_0x51ad8e,_0x3cba44),0x0;}catch(_0x242558){if(_0x242558 instanceof SDKError)return console[_0x1b639e(0x19d)]('Error:\x20'+_0x242558[_0x1b639e(0x161)]),_0x242558['cause']&&console['error']('\x20\x20Cause:\x20'+_0x242558[_0x1b639e(0x119)]),0x1;throw _0x242558;}}}
1
+ const a38_0x523d6c=a38_0x45ee;(function(_0x5152d3,_0x1d09e7){const _0x3460f6=a38_0x45ee,_0x5b5efc=_0x5152d3();while(!![]){try{const _0x3be318=parseInt(_0x3460f6(0x220))/0x1*(parseInt(_0x3460f6(0x226))/0x2)+parseInt(_0x3460f6(0x21e))/0x3+parseInt(_0x3460f6(0x1e1))/0x4+-parseInt(_0x3460f6(0x21d))/0x5+parseInt(_0x3460f6(0x1af))/0x6+parseInt(_0x3460f6(0x1da))/0x7+parseInt(_0x3460f6(0x236))/0x8*(-parseInt(_0x3460f6(0x1c9))/0x9);if(_0x3be318===_0x1d09e7)break;else _0x5b5efc['push'](_0x5b5efc['shift']());}catch(_0x31b1ba){_0x5b5efc['push'](_0x5b5efc['shift']());}}}(a38_0x5a72,0x593fe));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';function a38_0x45ee(_0x2286da,_0x5dc47c){_0x2286da=_0x2286da-0x1ab;const _0x5a72a1=a38_0x5a72();let _0x45ee0a=_0x5a72a1[_0x2286da];return _0x45ee0a;}import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';function a38_0x5a72(){const _0x101fe5=['14isFyZg','Folder\x20name:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Resolving\x20parent\x20segment\x20\x27','fullPath','\x20Opening\x20','setJobId','execute','Usage:\x20tdx\x20sg\x20show\x20<name>','(root)','Parent\x20name:\x20','Segment\x20ID:\x20','replace','folderId','trim','green','5848MayfkY','segmentPath','Resolving\x20\x27','site','parentSegment','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','message','folder','getSQLFromServerSegment','Resolved\x20relative\x20path\x20to:\x20','Usage:\x20tdx\x20segment\x20describe\x20<path>','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','resolveParentId','/app/ps/','Error:\x20Path\x20or\x20name\x20is\x20required','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','Folder\x20ID:\x20','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','length','Use:\x20tdx\x20ps\x20desc','limit','createFolder','Use:\x20tdx\x20ps\x20view\x20-w','\x27...','2856630GVCNgm','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','✖\x20Query\x20failed\x20[','Resolved\x20folder\x20ID:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','segment:sql','parentFolder','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','data','segment:view','in\x20','format','resolvePathToResource','cyan','\x20rows\x20','verbose','Fetching\x20SQL\x20for\x20segment...','getFolder','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','getSegment','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Fetching\x20SQL\x20from\x20rule...','22509BzETwi','Target\x20path:\x20','✔\x20Found\x20','\x20\x20Segment\x20name:\x20','content','description','✔\x20Created\x20folder\x20\x27','SEGMENT_FOLDER_NOT_FOUND','getSQLFromYamlFile','\x27\x20with\x20ID:\x20','jobId','elapsedTimeMillis','resolveFolderId','Resolving\x20path\x20\x27','Error:\x20Folder\x20reference\x20is\x20required','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','INVALID_ARGUMENT','4858266QgSffu','web','Fetching\x20folder\x20\x27','getParent','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','information_schema','Parent\x20ID:\x20','2540784xBWnra','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','stats','Folder\x20ID\x20missing\x20from\x20resolved\x20path','includes','Resolved\x20parent\x20ID:\x20','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','url','\x20\x20Folder\x20path:\x20','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','SEGMENT_NOT_FOUND','Error:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','SQL\x20query:\x0a','Site:\x20','Examples:','segment','type','Fetching\x20segment\x20details...','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Show\x20segment\x20folder\x20details','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','cause','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Get\x20SQL\x20query\x20for\x20child\x20segment','Show\x20segment\x20or\x20folder\x20details','/e/','code','Fetching\x20folder\x20details...','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','processedRows','segmentId','segment:desc','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','error','Options:','Listing\x20folders\x20for\x20parent\x20\x27','Resolving\x20folder\x20\x27','getSegmentSQL','SELECT\x20*\x20FROM\x20(\x0a','Usage:\x20tdx\x20sg\x20desc\x20<name>','Usage:','parentId','red','segmentName','\x20\x20Full\x20path:\x20','\x20\x20Cause:\x20','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','Show\x20child\x20segment\x20schema\x20(column\x20types)','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','jsonl','Create\x20segment\x20folder\x20for\x20organization','Show\x20folder\x20or\x20child\x20segment\x20details','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','Use:\x20tdx\x20ps\x20show','name','Resolved\x20type:\x20','932560zIyczk','658992uipBSa','path','50758xkdOpY','Resolving\x20parent\x20folder\x20\x27','segment:describe','log','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Parent\x20segment:\x20'];a38_0x5a72=function(){return _0x101fe5;};return a38_0x5a72();}import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a38_0x3a7df9 from'chalk';async function resolveSegmentTarget(_0x31d4ea,_0x27ae24,_0x5b1caf){const _0x2ae93c=a38_0x45ee;if(isYamlFilePath(_0x31d4ea))try{const _0x3311b2=await resolveYamlFilePath(_0x31d4ea);return _0x5b1caf&&(console[_0x2ae93c(0x206)]('Resolved\x20YAML\x20file:\x20'+_0x31d4ea),console[_0x2ae93c(0x206)]('\x20\x20Parent\x20segment:\x20'+_0x3311b2[_0x2ae93c(0x23a)]),console[_0x2ae93c(0x206)](_0x2ae93c(0x1cc)+_0x3311b2[_0x2ae93c(0x210)]),console[_0x2ae93c(0x206)](_0x2ae93c(0x1ea)+(_0x3311b2['folderPath']||_0x2ae93c(0x22f))),console[_0x2ae93c(0x206)](_0x2ae93c(0x211)+_0x3311b2[_0x2ae93c(0x22a)])),_0x3311b2[_0x2ae93c(0x22a)];}catch(_0x573130){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2ae93c(0x1eb)+_0x573130['message']);}if(!_0x27ae24)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2ae93c(0x1fa));return _0x27ae24+'/'+_0x31d4ea;}export class SegmentDescribeCommand extends BaseCommand{[a38_0x523d6c(0x21b)]=a38_0x523d6c(0x222);[a38_0x523d6c(0x1ce)]=a38_0x523d6c(0x1fc);async[a38_0x523d6c(0x22d)](_0x41cea8){const _0x3bda3d=a38_0x523d6c,{options:_0x291ac5,args:_0x36085a,tdx:_0x431aa2}=_0x41cea8,_0x102faf=_0x36085a[0x0],_0x39a86a=!_0x102faf&&!!_0x291ac5[_0x3bda3d(0x23a)],_0x47637e=_0x102faf||_0x291ac5[_0x3bda3d(0x23a)];if(!_0x47637e)return console[_0x3bda3d(0x206)](_0x3bda3d(0x244)),console[_0x3bda3d(0x206)](_0x3bda3d(0x240)),console[_0x3bda3d(0x206)](_0x3bda3d(0x1f1)),console[_0x3bda3d(0x206)](_0x3bda3d(0x205)),console[_0x3bda3d(0x206)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console[_0x3bda3d(0x206)](_0x3bda3d(0x1f5)),console[_0x3bda3d(0x206)](_0x3bda3d(0x247)),0x1;try{const _0x3a1276=_0x291ac5[_0x3bda3d(0x237)];let _0x3d4b07=_0x47637e;!_0x39a86a&&_0x3a1276&&!_0x47637e[_0x3bda3d(0x1e6)]('/')&&(_0x3d4b07=_0x3a1276+'/'+_0x47637e,_0x291ac5[_0x3bda3d(0x1c2)]&&console[_0x3bda3d(0x206)](_0x3bda3d(0x23f)+_0x3d4b07));const _0xb4b159=await withSpinner(_0x3bda3d(0x1d6)+_0x3d4b07+_0x3bda3d(0x1ae),()=>_0x431aa2[_0x3bda3d(0x1f2)][_0x3bda3d(0x1bf)](_0x3d4b07),{'verbose':_0x291ac5[_0x3bda3d(0x1c2)]}),_0x1f9005=_0xb4b159['data'];_0x291ac5[_0x3bda3d(0x1c2)]&&(console[_0x3bda3d(0x206)](_0x3bda3d(0x21c)+_0x1f9005[_0x3bda3d(0x1f3)]),console[_0x3bda3d(0x206)](_0x3bda3d(0x1e0)+_0x1f9005[_0x3bda3d(0x20e)]),_0x1f9005['folderId']&&console[_0x3bda3d(0x206)](_0x3bda3d(0x246)+_0x1f9005[_0x3bda3d(0x233)]),_0x1f9005['segmentId']&&console[_0x3bda3d(0x206)](_0x3bda3d(0x231)+_0x1f9005[_0x3bda3d(0x203)]));if(_0x1f9005['type']==='parent'){const _0x507d96=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x431aa2[_0x3bda3d(0x1f2)][_0x3bda3d(0x1dd)](_0x1f9005[_0x3bda3d(0x20e)]),{'verbose':_0x291ac5[_0x3bda3d(0x1c2)]});await handleSingleObjectOutput(_0x507d96['data'],_0x291ac5);}else{if(_0x1f9005[_0x3bda3d(0x1f3)]===_0x3bda3d(0x23d)){if(!_0x1f9005[_0x3bda3d(0x233)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x3bda3d(0x1e5));const _0x26a02d=await withSpinner(_0x3bda3d(0x1ff),()=>_0x431aa2[_0x3bda3d(0x1f2)][_0x3bda3d(0x1c4)](_0x1f9005[_0x3bda3d(0x233)]),{'verbose':_0x291ac5['verbose']});await handleSingleObjectOutput(_0x26a02d[_0x3bda3d(0x1bb)],_0x291ac5);}else{if(_0x1f9005[_0x3bda3d(0x1f3)]===_0x3bda3d(0x1f2)){if(!_0x1f9005['segmentId'])throw new SDKError(ErrorCode[_0x3bda3d(0x1ec)],_0x3bda3d(0x1c7));const _0x1efa01=await withSpinner('Fetching\x20segment\x20details...',()=>_0x431aa2[_0x3bda3d(0x1f2)][_0x3bda3d(0x1c6)](_0x1f9005[_0x3bda3d(0x20e)],_0x1f9005[_0x3bda3d(0x203)]),{'verbose':_0x291ac5['verbose']});await handleSingleObjectOutput(_0x1efa01[_0x3bda3d(0x1bb)],_0x291ac5);}}}return 0x0;}catch(_0xb01834){if(_0xb01834 instanceof SDKError)return console[_0x3bda3d(0x206)](_0x3bda3d(0x1ed)+_0xb01834['message']),_0xb01834[_0x3bda3d(0x1f9)]&&console[_0x3bda3d(0x206)](_0x3bda3d(0x212)+_0xb01834['cause']),0x1;throw _0xb01834;}}}export class SegmentShowCommand extends BaseCommand{[a38_0x523d6c(0x21b)]='segment:show';[a38_0x523d6c(0x1ce)]=a38_0x523d6c(0x201);async['execute'](_0x78ad91){const _0x4e7309=a38_0x523d6c,{options:_0x8b0923,args:_0x1c6546,tdx:_0x9268ab}=_0x78ad91,_0x1df103=_0x1c6546[0x0];if(!_0x1df103)return console[_0x4e7309(0x206)](_0x4e7309(0x1de)),console[_0x4e7309(0x206)](_0x4e7309(0x22e)),console[_0x4e7309(0x206)](_0x4e7309(0x228)),console[_0x4e7309(0x206)](_0x4e7309(0x1f1)),console[_0x4e7309(0x206)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console['error'](_0x4e7309(0x1e8)),0x1;try{const _0x387af2=_0x8b0923[_0x4e7309(0x23a)],_0x5f269d=await resolveSegmentTarget(_0x1df103,_0x387af2,_0x8b0923['verbose']);_0x8b0923[_0x4e7309(0x1c2)]&&console[_0x4e7309(0x206)](_0x4e7309(0x1ca)+_0x5f269d);const _0x307da9=await withSpinner(_0x4e7309(0x238)+_0x1df103+_0x4e7309(0x1ae),()=>_0x9268ab[_0x4e7309(0x1f2)][_0x4e7309(0x1bf)](_0x5f269d),{'verbose':_0x8b0923[_0x4e7309(0x1c2)]}),_0x263639=_0x307da9[_0x4e7309(0x1bb)];_0x8b0923[_0x4e7309(0x1c2)]&&(console[_0x4e7309(0x206)](_0x4e7309(0x21c)+_0x263639['type']),console[_0x4e7309(0x206)](_0x4e7309(0x1e0)+_0x263639[_0x4e7309(0x20e)]));if(_0x263639[_0x4e7309(0x1f3)]===_0x4e7309(0x23d))return console['error'](_0x4e7309(0x1b4)),console[_0x4e7309(0x206)](_0x4e7309(0x23b)),0x1;if(_0x263639[_0x4e7309(0x1f3)]==='parent')return console[_0x4e7309(0x206)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console['error'](_0x4e7309(0x21a)),0x1;if(!_0x263639[_0x4e7309(0x203)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x4e7309(0x1c7));const _0x1ffa90=await withSpinner(_0x4e7309(0x1c3),()=>_0x9268ab[_0x4e7309(0x1f2)][_0x4e7309(0x20a)](_0x263639[_0x4e7309(0x20e)],_0x263639[_0x4e7309(0x203)]),{'verbose':_0x8b0923[_0x4e7309(0x1c2)]});let _0x374bf6=_0x1ffa90[_0x4e7309(0x1bb)];const _0x1a2120=resolveLimit(_0x8b0923[_0x4e7309(0x1ab)],DEFAULT_DISPLAY_LIMIT),_0x452fcd=/\bLIMIT\s+\d+/i['test'](_0x374bf6);!_0x452fcd&&(_0x374bf6=_0x374bf6[_0x4e7309(0x234)]()[_0x4e7309(0x232)](/;+$/,''),_0x374bf6=_0x4e7309(0x20b)+_0x374bf6+_0x4e7309(0x1b3)+_0x1a2120);_0x8b0923['verbose']&&console[_0x4e7309(0x206)](_0x4e7309(0x1ef)+_0x374bf6);const _0x55765c=await withProgressSpinner('Executing\x20segment\x20query...',async _0x195b03=>{const _0x335eb1=_0x4e7309,_0x4b4dda=await _0x9268ab['query']['execute'](_0x374bf6,{'catalog':'td','schema':_0x335eb1(0x1df),'onJobId':_0x2f71f3=>{const _0x22cd0f=_0x335eb1;_0x195b03[_0x22cd0f(0x22c)](_0x2f71f3);}});return _0x4b4dda;},{'verbose':_0x8b0923['verbose']}),_0x3cb0fe=_0x55765c[_0x4e7309(0x1bb)],_0x3a586e=_0x3cb0fe[_0x4e7309(0x1d3)]?'\x20[Job\x20ID:\x20'+_0x3cb0fe[_0x4e7309(0x1d3)]+']':'';return console['error']('✔\x20Query\x20completed:\x20Processed\x20'+_0x3cb0fe[_0x4e7309(0x1e4)][_0x4e7309(0x202)]['toLocaleString']()+_0x4e7309(0x1c1)+(_0x4e7309(0x1bd)+formatElapsed(_0x3cb0fe[_0x4e7309(0x1e4)][_0x4e7309(0x1d4)])+_0x3a586e)),await handleQueryOutput(_0x3cb0fe,_0x8b0923),0x0;}catch(_0x40d87a){if(_0x40d87a instanceof SDKError)return console[_0x4e7309(0x206)](_0x4e7309(0x1b1)+_0x40d87a[_0x4e7309(0x1fe)]+']'),console[_0x4e7309(0x206)]('\x0a'+_0x40d87a['message']),0x1;throw _0x40d87a;}}}export class SegmentFolderListCommand extends BaseCommand{[a38_0x523d6c(0x21b)]='segment:folder:list';['description']=a38_0x523d6c(0x1f6);async[a38_0x523d6c(0x22d)](_0x27ca70){const _0x17da43=a38_0x523d6c,{options:_0x4e02a1,args:_0x39996b,tdx:_0xf2487d}=_0x27ca70;if(_0x39996b['length']===0x0)return console[_0x17da43(0x206)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x17da43(0x206)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x1f590d=_0x39996b[0x0];try{_0x4e02a1[_0x17da43(0x1c2)]&&(console[_0x17da43(0x206)](_0x17da43(0x1f0)+_0x4e02a1[_0x17da43(0x239)]),console['error'](_0x17da43(0x230)+_0x1f590d));const _0x2400aa=await withSpinner(_0x17da43(0x229)+_0x1f590d+_0x17da43(0x1ae),()=>_0xf2487d[_0x17da43(0x1f2)][_0x17da43(0x242)](_0x1f590d),{'verbose':_0x4e02a1['verbose']}),_0x95cf97=_0x2400aa[_0x17da43(0x1bb)];_0x4e02a1[_0x17da43(0x1c2)]&&console[_0x17da43(0x206)](_0x17da43(0x1e7)+_0x95cf97);const _0x126d01=await withSpinner(_0x17da43(0x208)+_0x1f590d+_0x17da43(0x1ae),()=>_0xf2487d[_0x17da43(0x1f2)]['listFolders'](_0x95cf97),{'verbose':_0x4e02a1[_0x17da43(0x1c2)]}),_0x3d59ce=_0x126d01[_0x17da43(0x1bb)];return console['error'](_0x17da43(0x1cb)+_0x3d59ce[_0x17da43(0x248)]+'\x20folder'+(_0x3d59ce[_0x17da43(0x248)]!==0x1?'s':'')),await handleSDKOutput(_0x3d59ce,_0x4e02a1),0x0;}catch(_0x42a37c){if(_0x42a37c instanceof SDKError)return console[_0x17da43(0x206)](_0x17da43(0x1ed)+_0x42a37c[_0x17da43(0x23c)]),_0x42a37c['cause']&&console['error'](_0x17da43(0x212)+_0x42a37c['cause']),0x1;throw _0x42a37c;}}}export class SegmentFolderShowCommand extends BaseCommand{[a38_0x523d6c(0x21b)]='segment:folder:show';[a38_0x523d6c(0x1ce)]=a38_0x523d6c(0x1f7);async[a38_0x523d6c(0x22d)](_0x48c17f){const _0x271031=a38_0x523d6c,{options:_0x22ca03,args:_0x3e6eb3,tdx:_0x5e3ace}=_0x48c17f;if(_0x3e6eb3[_0x271031(0x248)]===0x0)return console[_0x271031(0x206)](_0x271031(0x1d7)),console['error'](_0x271031(0x224)),0x1;try{const {parentId:_0x50c41d,childId:_0x130238}=parseSegmentRef(_0x3e6eb3[0x0]);_0x22ca03[_0x271031(0x1c2)]&&(console[_0x271031(0x206)](_0x271031(0x1f0)+_0x22ca03[_0x271031(0x239)]),console[_0x271031(0x206)](_0x271031(0x230)+_0x50c41d),_0x130238&&console[_0x271031(0x206)](_0x271031(0x227)+_0x130238));if(!_0x130238)return console[_0x271031(0x206)]('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x3c3259=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x50c41d+'\x27...',()=>_0x5e3ace[_0x271031(0x1f2)][_0x271031(0x242)](_0x50c41d),{'verbose':_0x22ca03[_0x271031(0x1c2)]}),_0x157468=_0x3c3259['data'];_0x22ca03[_0x271031(0x1c2)]&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x157468);const _0x348140=await withSpinner(_0x271031(0x209)+_0x130238+_0x271031(0x1ae),()=>_0x5e3ace['segment'][_0x271031(0x1d5)](_0x157468,_0x130238),{'verbose':_0x22ca03['verbose']}),_0x3eae67=_0x348140[_0x271031(0x1bb)];_0x22ca03[_0x271031(0x1c2)]&&console['error'](_0x271031(0x1b2)+_0x3eae67);const _0xaf4830=await withSpinner(_0x271031(0x1dc)+_0x130238+_0x271031(0x1ae),()=>_0x5e3ace[_0x271031(0x1f2)]['getFolder'](_0x3eae67),{'verbose':_0x22ca03[_0x271031(0x1c2)]});return await handleSDKOutput([_0xaf4830[_0x271031(0x1bb)]],_0x22ca03),0x0;}catch(_0x92238e){if(_0x92238e instanceof SDKError)return console[_0x271031(0x206)]('Error:\x20'+_0x92238e['message']),_0x92238e[_0x271031(0x1f9)]&&console['error'](_0x271031(0x212)+_0x92238e[_0x271031(0x1f9)]),0x1;throw _0x92238e;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a38_0x523d6c(0x1b5);[a38_0x523d6c(0x1ce)]=a38_0x523d6c(0x1fb);async['execute'](_0x4e6a2c){const _0x1e42e1=a38_0x523d6c,{options:_0xd818f8,args:_0x34859f}=_0x4e6a2c,_0x31eac1=_0xd818f8,_0x5cd0a0=_0x31eac1[_0x1e42e1(0x21f)],_0x22c0b4=_0x34859f[0x0];if(!_0x22c0b4&&!_0x5cd0a0)return console[_0x1e42e1(0x206)](a38_0x3a7df9[_0x1e42e1(0x20f)](_0x1e42e1(0x213))),console[_0x1e42e1(0x206)](_0x1e42e1(0x20d)),console[_0x1e42e1(0x206)]('\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>'),console[_0x1e42e1(0x206)](_0x1e42e1(0x219)),console[_0x1e42e1(0x206)](_0x1e42e1(0x1f1)),console[_0x1e42e1(0x206)](_0x1e42e1(0x1e3)),console[_0x1e42e1(0x206)](_0x1e42e1(0x1c5)),0x1;if(_0x22c0b4&&_0x5cd0a0)return console[_0x1e42e1(0x206)](a38_0x3a7df9[_0x1e42e1(0x20f)](_0x1e42e1(0x1e2))),0x1;try{let _0x433c2f;if(_0x5cd0a0)_0x433c2f=await this['getSQLFromYamlFile'](_0x5cd0a0,_0x4e6a2c);else{if(isYamlFilePath(_0x22c0b4))return console[_0x1e42e1(0x206)](a38_0x3a7df9['red'](_0x1e42e1(0x245))),console[_0x1e42e1(0x206)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20'+_0x22c0b4),0x1;else _0x433c2f=await this[_0x1e42e1(0x23e)](_0x22c0b4,_0x4e6a2c);}return _0xd818f8[_0x1e42e1(0x1be)]==='json'||_0xd818f8['format']===_0x1e42e1(0x216)?await handleSDKOutput([{'sql':_0x433c2f}],_0xd818f8):console[_0x1e42e1(0x223)](_0x433c2f),0x0;}catch(_0x377f86){if(_0x377f86 instanceof SDKError)return console[_0x1e42e1(0x206)](_0x1e42e1(0x1ed)+_0x377f86[_0x1e42e1(0x23c)]),_0x377f86[_0x1e42e1(0x1f9)]&&console[_0x1e42e1(0x206)](_0x1e42e1(0x212)+_0x377f86[_0x1e42e1(0x1f9)]),0x1;throw _0x377f86;}}async[a38_0x523d6c(0x1d1)](_0x132443,_0x18b22a){const _0x443117=a38_0x523d6c,{options:_0x1d7bf1,tdx:_0x29e407}=_0x18b22a;let _0x4ea4f0;try{_0x4ea4f0=await resolveYamlFilePath(_0x132443);}catch(_0x4768a7){throw new SDKError(ErrorCode[_0x443117(0x1d9)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x4768a7[_0x443117(0x23c)]);}_0x1d7bf1['verbose']&&console[_0x443117(0x206)]('Resolved:\x20'+_0x4ea4f0[_0x443117(0x23a)]+'/'+_0x4ea4f0['segmentName']);const _0x505430=await withSpinner(_0x443117(0x1c8),()=>_0x29e407[_0x443117(0x1f2)]['getSegmentSQLFromYaml'](_0x4ea4f0[_0x443117(0x1cd)],_0x4ea4f0[_0x443117(0x23a)],_0x4ea4f0[_0x443117(0x210)]),{'verbose':_0x1d7bf1[_0x443117(0x1c2)]});return _0x505430[_0x443117(0x1bb)];}async[a38_0x523d6c(0x23e)](_0x6900ef,_0x32aa3f){const _0x49f3a2=a38_0x523d6c,{options:_0x5ba881,tdx:_0xd38ed9}=_0x32aa3f,_0x16a356=_0x5ba881[_0x49f3a2(0x23a)],_0x347194=await resolveSegmentTarget(_0x6900ef,_0x16a356,_0x5ba881[_0x49f3a2(0x1c2)]);_0x5ba881[_0x49f3a2(0x1c2)]&&console[_0x49f3a2(0x206)](_0x49f3a2(0x1ca)+_0x347194);const _0x1f2394=await withSpinner(_0x49f3a2(0x238)+_0x6900ef+'\x27...',()=>_0xd38ed9[_0x49f3a2(0x1f2)][_0x49f3a2(0x1bf)](_0x347194),{'verbose':_0x5ba881[_0x49f3a2(0x1c2)]}),_0xef93ea=_0x1f2394['data'];_0x5ba881['verbose']&&(console['error'](_0x49f3a2(0x21c)+_0xef93ea['type']),console[_0x49f3a2(0x206)](_0x49f3a2(0x1e0)+_0xef93ea[_0x49f3a2(0x20e)]));if(_0xef93ea[_0x49f3a2(0x1f3)]===_0x49f3a2(0x23d))throw new SDKError(ErrorCode[_0x49f3a2(0x1d9)],_0x49f3a2(0x1b7));if(_0xef93ea[_0x49f3a2(0x1f3)]==='parent')throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql');if(!_0xef93ea[_0x49f3a2(0x203)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x49f3a2(0x1c7));const _0x41469a=await withSpinner(_0x49f3a2(0x1c3),()=>_0xd38ed9['segment'][_0x49f3a2(0x20a)](_0xef93ea['parentId'],_0xef93ea['segmentId']),{'verbose':_0x5ba881[_0x49f3a2(0x1c2)]});return _0x41469a[_0x49f3a2(0x1bb)];}}export class SegmentFolderCreateCommand extends BaseCommand{['name']='segment:folder:create';[a38_0x523d6c(0x1ce)]=a38_0x523d6c(0x217);async[a38_0x523d6c(0x22d)](_0x44dfb3){const _0xb23fe1=a38_0x523d6c,{options:_0x2b7a5d,args:_0x44175f,tdx:_0x1c296b}=_0x44dfb3,_0x2e00d8=_0x2b7a5d;if(_0x44175f[_0xb23fe1(0x248)]<0x2)return console[_0xb23fe1(0x206)](_0xb23fe1(0x1b0)),console[_0xb23fe1(0x206)](_0xb23fe1(0x1b9)),0x1;const _0x5080e6=_0x44175f[0x0],_0x2e3fc9=_0x44175f[0x1];_0x2e00d8[_0xb23fe1(0x1c2)]&&(console['error'](_0xb23fe1(0x1f0)+_0x2e00d8['site']),console[_0xb23fe1(0x206)](_0xb23fe1(0x225)+_0x5080e6),console['error'](_0xb23fe1(0x227)+_0x2e3fc9));let _0x49a04d;if(_0x2e00d8[_0xb23fe1(0x1b6)]){const _0x1e7ab1=_0x2e00d8[_0xb23fe1(0x1b6)],_0x1807d1=await withSpinner(_0xb23fe1(0x229)+_0x5080e6+'\x27...',()=>_0x1c296b[_0xb23fe1(0x1f2)]['resolveParentId'](_0x5080e6),{'verbose':_0x2e00d8[_0xb23fe1(0x1c2)]}),_0x596b35=_0x1807d1[_0xb23fe1(0x1bb)],_0x51b01a=await withSpinner(_0xb23fe1(0x221)+_0x1e7ab1+'\x27...',()=>_0x1c296b[_0xb23fe1(0x1f2)][_0xb23fe1(0x1d5)](_0x596b35,_0x1e7ab1),{'verbose':_0x2e00d8[_0xb23fe1(0x1c2)]});_0x49a04d=_0x51b01a['data'],_0x2e00d8[_0xb23fe1(0x1c2)]&&console[_0xb23fe1(0x206)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x49a04d);}const _0x1ff193={'name':_0x2e3fc9,'description':_0x2e00d8[_0xb23fe1(0x1ce)],'parentFolderId':_0x49a04d},_0x80304b=await withSpinner('Creating\x20folder\x20\x27'+_0x2e3fc9+'\x27...',()=>_0x1c296b[_0xb23fe1(0x1f2)][_0xb23fe1(0x1ac)](_0x5080e6,_0x1ff193),{'verbose':_0x2e00d8[_0xb23fe1(0x1c2)]}),_0x49bd86=_0x80304b['data'];return console['error'](_0xb23fe1(0x1cf)+_0x49bd86[_0xb23fe1(0x21b)]+_0xb23fe1(0x1d2)+_0x49bd86['id']),await handleSDKOutput([_0x49bd86],_0x2e00d8),0x0;}}export class SegmentViewCommand extends BaseCommand{[a38_0x523d6c(0x21b)]=a38_0x523d6c(0x1bc);[a38_0x523d6c(0x1ce)]=a38_0x523d6c(0x218);async['execute'](_0x5794a0){const _0x1336c9=a38_0x523d6c,{options:_0x48929f,args:_0x45e066,tdx:_0x43d7e5}=_0x5794a0,_0x459cb7=_0x45e066[0x0];if(!_0x459cb7)return console['error']('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error'](_0x1336c9(0x1b8)),console[_0x1336c9(0x206)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console['error'](_0x1336c9(0x207)),console[_0x1336c9(0x206)](_0x1336c9(0x200)),console[_0x1336c9(0x206)](_0x1336c9(0x1f1)),console[_0x1336c9(0x206)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console['error'](_0x1336c9(0x1ee)),console[_0x1336c9(0x206)](_0x1336c9(0x1f8)),console['error']('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x233b4a=_0x48929f[_0x1336c9(0x23a)],_0x59ae6f=await resolveSegmentTarget(_0x459cb7,_0x233b4a,_0x48929f[_0x1336c9(0x1c2)]);_0x48929f['verbose']&&console[_0x1336c9(0x206)](_0x1336c9(0x1ca)+_0x59ae6f);const _0x384600=await withSpinner('Resolving\x20\x27'+_0x459cb7+'\x27...',()=>_0x43d7e5[_0x1336c9(0x1f2)]['resolvePathToResource'](_0x59ae6f),{'verbose':_0x48929f[_0x1336c9(0x1c2)]}),_0x4967be=_0x384600['data'];_0x48929f[_0x1336c9(0x1c2)]&&(console[_0x1336c9(0x206)](_0x1336c9(0x21c)+_0x4967be['type']),console[_0x1336c9(0x206)](_0x1336c9(0x1e0)+_0x4967be[_0x1336c9(0x20e)]),_0x4967be[_0x1336c9(0x233)]&&console[_0x1336c9(0x206)](_0x1336c9(0x246)+_0x4967be[_0x1336c9(0x233)]),_0x4967be['segmentId']&&console[_0x1336c9(0x206)]('Segment\x20ID:\x20'+_0x4967be[_0x1336c9(0x203)]));if(_0x48929f[_0x1336c9(0x1db)]){if(_0x4967be[_0x1336c9(0x1f3)]===_0x1336c9(0x23d))return console[_0x1336c9(0x206)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x4967be['type']==='parent')return console[_0x1336c9(0x206)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console['error'](_0x1336c9(0x1ad)),0x1;if(!_0x4967be[_0x1336c9(0x203)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x1336c9(0x1c7));const _0x15c02a=getConsoleNextUrl(_0x48929f['site'],_0x1336c9(0x243)+_0x4967be[_0x1336c9(0x20e)]+_0x1336c9(0x1fd)+_0x4967be[_0x1336c9(0x203)]);return console[_0x1336c9(0x206)](a38_0x3a7df9[_0x1336c9(0x235)]('✔')+_0x1336c9(0x22b)+a38_0x3a7df9[_0x1336c9(0x1c0)](_0x15c02a)),openBrowser(_0x15c02a),0x0;}if(_0x4967be['type']==='folder'){if(!_0x4967be[_0x1336c9(0x233)])throw new SDKError(ErrorCode[_0x1336c9(0x1d0)],_0x1336c9(0x1e5));const _0x4bca24=await withSpinner(_0x1336c9(0x1ff),()=>_0x43d7e5[_0x1336c9(0x1f2)][_0x1336c9(0x1c4)](_0x4967be[_0x1336c9(0x233)]),{'verbose':_0x48929f[_0x1336c9(0x1c2)]});await handleSingleObjectOutput(_0x4bca24[_0x1336c9(0x1bb)],_0x48929f);}else{if(_0x4967be[_0x1336c9(0x1f3)]==='segment'){if(!_0x4967be[_0x1336c9(0x203)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0xce7c73=await withSpinner(_0x1336c9(0x1f4),()=>_0x43d7e5[_0x1336c9(0x1f2)]['getSegment'](_0x4967be[_0x1336c9(0x20e)],_0x4967be[_0x1336c9(0x203)]),{'verbose':_0x48929f[_0x1336c9(0x1c2)]}),_0x1282b6=getConsoleNextUrl(_0x48929f[_0x1336c9(0x239)],'/app/ps/'+_0x4967be[_0x1336c9(0x20e)]+_0x1336c9(0x1fd)+_0x4967be[_0x1336c9(0x203)]),_0x452dc9=_0xce7c73[_0x1336c9(0x1bb)];_0x452dc9[_0x1336c9(0x1e9)]=_0x1282b6,await handleSingleObjectOutput(_0x452dc9,_0x48929f);}else return console[_0x1336c9(0x206)]('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console[_0x1336c9(0x206)]('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0xb53bea){if(_0xb53bea instanceof SDKError)return console[_0x1336c9(0x206)](_0x1336c9(0x1ed)+_0xb53bea[_0x1336c9(0x23c)]),_0xb53bea[_0x1336c9(0x1f9)]&&console[_0x1336c9(0x206)]('\x20\x20Cause:\x20'+_0xb53bea['cause']),0x1;throw _0xb53bea;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a38_0x523d6c(0x21b)]=a38_0x523d6c(0x204);['description']=a38_0x523d6c(0x214);async[a38_0x523d6c(0x22d)](_0x256c82){const _0x5a8af0=a38_0x523d6c,{options:_0x4ad2a1,args:_0x6f855b,tdx:_0x4bf6e1}=_0x256c82,_0x731595=_0x6f855b[0x0];if(!_0x731595)return console[_0x5a8af0(0x206)](_0x5a8af0(0x1de)),console['error'](_0x5a8af0(0x20c)),console[_0x5a8af0(0x206)](_0x5a8af0(0x241)),console[_0x5a8af0(0x206)](_0x5a8af0(0x1f1)),console[_0x5a8af0(0x206)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x5a8af0(0x206)](_0x5a8af0(0x1d8)),0x1;try{const _0x906f5d=_0x4ad2a1[_0x5a8af0(0x23a)],_0x570d62=await resolveSegmentTarget(_0x731595,_0x906f5d,_0x4ad2a1[_0x5a8af0(0x1c2)]);_0x4ad2a1['verbose']&&console[_0x5a8af0(0x206)](_0x5a8af0(0x1ca)+_0x570d62);const _0x21f053=await withSpinner(_0x5a8af0(0x238)+_0x731595+_0x5a8af0(0x1ae),()=>_0x4bf6e1[_0x5a8af0(0x1f2)][_0x5a8af0(0x1bf)](_0x570d62),{'verbose':_0x4ad2a1['verbose']}),_0x30b994=_0x21f053[_0x5a8af0(0x1bb)];_0x4ad2a1[_0x5a8af0(0x1c2)]&&(console['error'](_0x5a8af0(0x21c)+_0x30b994['type']),console[_0x5a8af0(0x206)](_0x5a8af0(0x1e0)+_0x30b994[_0x5a8af0(0x20e)]));if(_0x30b994[_0x5a8af0(0x1f3)]==='folder')return console[_0x5a8af0(0x206)](_0x5a8af0(0x1ba)),console[_0x5a8af0(0x206)](_0x5a8af0(0x215)),0x1;if(_0x30b994['type']==='parent')return console[_0x5a8af0(0x206)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console['error'](_0x5a8af0(0x249)),0x1;if(!_0x30b994[_0x5a8af0(0x203)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x79deec=await withSpinner(_0x5a8af0(0x1c3),()=>_0x4bf6e1[_0x5a8af0(0x1f2)][_0x5a8af0(0x20a)](_0x30b994[_0x5a8af0(0x20e)],_0x30b994[_0x5a8af0(0x203)]),{'verbose':_0x4ad2a1[_0x5a8af0(0x1c2)]}),_0x2e4065=_0x79deec[_0x5a8af0(0x1bb)],_0xafcea5=await executeSchemaQuery(_0x2e4065,_0x4bf6e1,_0x4ad2a1);return await handleQueryOutput(_0xafcea5,_0x4ad2a1),0x0;}catch(_0x1cfff5){if(_0x1cfff5 instanceof SDKError)return console['error']('Error:\x20'+_0x1cfff5[_0x5a8af0(0x23c)]),_0x1cfff5[_0x5a8af0(0x1f9)]&&console['error']('\x20\x20Cause:\x20'+_0x1cfff5[_0x5a8af0(0x1f9)]),0x1;throw _0x1cfff5;}}}
@@ -1 +1 @@
1
- const a39_0xacfbdc=a39_0x3216;(function(_0x2d8e52,_0x1192f5){const _0x188048=a39_0x3216,_0xa232d3=_0x2d8e52();while(!![]){try{const _0x4fba82=parseInt(_0x188048(0xe2))/0x1+parseInt(_0x188048(0xcb))/0x2*(-parseInt(_0x188048(0xd1))/0x3)+-parseInt(_0x188048(0xef))/0x4+-parseInt(_0x188048(0xed))/0x5+parseInt(_0x188048(0xeb))/0x6*(-parseInt(_0x188048(0xd4))/0x7)+parseInt(_0x188048(0xd5))/0x8*(parseInt(_0x188048(0xc9))/0x9)+parseInt(_0x188048(0xe9))/0xa;if(_0x4fba82===_0x1192f5)break;else _0xa232d3['push'](_0xa232d3['shift']());}catch(_0x3f176b){_0xa232d3['push'](_0xa232d3['shift']());}}}(a39_0x50a9,0x2a95a));function a39_0x50a9(){const _0x2708cd=['segmentPath','execute','segments','name','1134650aWIOwS','segment:create','3168QEZOXA','includes','881635siMNFA','noCountPopulation','82164EKCaPW','Segment\x20name:\x20','yellow','Resolving\x20folder\x20path\x20\x27','verbose','resolveFolderId','Resolving\x20folder\x20\x27','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','data','\x27...','Site:\x20','length','\x27\x20with\x20ID:\x20','createSegment','1519056CZMPiE','parent','72220aEfKse','site','Resolving\x20parent\x20segment\x20\x27','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','Resolved\x20relative\x20path\x20to:\x20','resolveParentId','12xpvifo','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','folderId','119qFntTi','8aWITfg','error','Creating\x20segment\x20\x27','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','Examples:','resolvePathToResource','kind','Parent\x20path:\x20','type','segment','description','invisible','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','242461tEmUpA','Parent:\x20','folder'];a39_0x50a9=function(){return _0x2708cd;};return a39_0x50a9();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a39_0x3216(_0x319e77,_0x2d2d20){_0x319e77=_0x319e77-0xbd;const _0x50a930=a39_0x50a9();let _0x321650=_0x50a930[_0x319e77];return _0x321650;}import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a39_0x1a1af0 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a39_0xacfbdc(0xe8)]=a39_0xacfbdc(0xea);[a39_0xacfbdc(0xdf)]='Create\x20child\x20segment\x20with\x20filtering\x20rules';async[a39_0xacfbdc(0xe6)](_0xa85490){const _0x1d579f=a39_0xacfbdc;console[_0x1d579f(0xd6)](a39_0x1a1af0['yellow'](_0x1d579f(0xc2))),console[_0x1d579f(0xd6)](a39_0x1a1af0[_0x1d579f(0xbd)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x3fea11,args:_0x3e1633,tdx:_0x2f95fd}=_0xa85490,_0x39762f=_0x3fea11;if(_0x3e1633[_0x1d579f(0xc6)]===0x0)return console[_0x1d579f(0xd6)](_0x1d579f(0xd2)),console[_0x1d579f(0xd6)](_0x1d579f(0xe1)),console[_0x1d579f(0xd6)](_0x1d579f(0xd9)),console['error']('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console['error'](_0x1d579f(0xce)),console[_0x1d579f(0xd6)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x509d1c=_0x3e1633[0x0],_0x523409=_0x3fea11[_0x1d579f(0xe5)];let _0xff9e28=_0x509d1c;_0x523409&&!_0x509d1c[_0x1d579f(0xec)]('/')&&(_0xff9e28=_0x523409+'/'+_0x509d1c,_0x39762f['verbose']&&console[_0x1d579f(0xd6)](_0x1d579f(0xcf)+_0xff9e28));const _0x3b3f30=parsePath(_0xff9e28);if(_0x3b3f30[_0x1d579f(0xe7)][_0x1d579f(0xc6)]<0x2)return console[_0x1d579f(0xd6)]('Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'),console[_0x1d579f(0xd6)](_0x1d579f(0xd8)),0x1;const _0x2f7d34=_0x3b3f30[_0x1d579f(0xe7)][0x0],_0x5373de=getBaseName(_0xff9e28),_0x36f185=getParentPath(_0xff9e28);_0x39762f[_0x1d579f(0xbf)]&&(console[_0x1d579f(0xd6)](_0x1d579f(0xc5)+_0x39762f[_0x1d579f(0xcc)]),console[_0x1d579f(0xd6)]('Target\x20path:\x20'+_0xff9e28),console[_0x1d579f(0xd6)](_0x1d579f(0xe3)+_0x2f7d34),console[_0x1d579f(0xd6)](_0x1d579f(0xf0)+_0x5373de),console[_0x1d579f(0xd6)](_0x1d579f(0xdc)+_0x36f185));const _0x4e1932=await withSpinner(_0x1d579f(0xcd)+_0x2f7d34+_0x1d579f(0xc4),()=>_0x2f95fd[_0x1d579f(0xde)][_0x1d579f(0xd0)](_0x2f7d34),{'verbose':_0x39762f[_0x1d579f(0xbf)]}),_0x394526=_0x4e1932['data'];let _0x271074;if(_0x3b3f30[_0x1d579f(0xe7)]['length']>0x2){const _0x383072=await withSpinner(_0x1d579f(0xbe)+_0x36f185+_0x1d579f(0xc4),()=>_0x2f95fd['segment'][_0x1d579f(0xda)](_0x36f185),{'verbose':_0x39762f[_0x1d579f(0xbf)]}),_0x50c05c=_0x383072[_0x1d579f(0xc3)];if(_0x50c05c[_0x1d579f(0xdd)]!==_0x1d579f(0xe4)&&_0x50c05c[_0x1d579f(0xdd)]!==_0x1d579f(0xca))return console[_0x1d579f(0xd6)]('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x271074=_0x50c05c[_0x1d579f(0xd3)];}else{if(_0x39762f[_0x1d579f(0xe4)]){const _0x4ff9dd=await withSpinner(_0x1d579f(0xc1)+_0x39762f[_0x1d579f(0xe4)]+'\x27...',()=>_0x2f95fd[_0x1d579f(0xde)][_0x1d579f(0xc0)](_0x394526,_0x39762f[_0x1d579f(0xe4)]),{'verbose':_0x39762f[_0x1d579f(0xbf)]});_0x271074=_0x4ff9dd[_0x1d579f(0xc3)];}}_0x39762f[_0x1d579f(0xbf)]&&_0x271074&&console[_0x1d579f(0xd6)]('Resolved\x20folder\x20ID:\x20'+_0x271074);const _0x46f65b=await loadJSONFromOptions(_0x39762f['rule'],_0x39762f['ruleFile']),_0x4563ba={'name':_0x5373de,'description':_0x39762f['description'],'rule':_0x46f65b,'kind':_0x39762f[_0x1d579f(0xdb)]!==undefined?parseInt(_0x39762f['kind'],0xa):undefined,'isVisible':_0x39762f[_0x1d579f(0xe0)]?![]:undefined,'segmentFolderId':_0x271074,'countPopulation':_0x39762f[_0x1d579f(0xee)]?![]:undefined},_0x4edb03=await withSpinner(_0x1d579f(0xd7)+_0x5373de+'\x27...',()=>_0x2f95fd[_0x1d579f(0xde)][_0x1d579f(0xc8)](_0x394526,_0x4563ba),{'verbose':_0x39762f[_0x1d579f(0xbf)]}),_0x19a770=_0x4edb03[_0x1d579f(0xc3)];return console['error']('✔\x20Created\x20segment\x20\x27'+_0x19a770[_0x1d579f(0xe8)]+_0x1d579f(0xc7)+_0x19a770['id']),_0xff9e28!==_0x509d1c&&console[_0x1d579f(0xd6)]('\x20\x20\x20Path:\x20'+_0xff9e28),await handleSDKOutput([_0x19a770],_0x39762f),0x0;}}
1
+ const a39_0x95d88f=a39_0x49cd;(function(_0x4bb49d,_0xdc310b){const _0x489a97=a39_0x49cd,_0x1ba36e=_0x4bb49d();while(!![]){try{const _0x5f0fe4=parseInt(_0x489a97(0x197))/0x1+parseInt(_0x489a97(0x17c))/0x2*(-parseInt(_0x489a97(0x195))/0x3)+parseInt(_0x489a97(0x182))/0x4+-parseInt(_0x489a97(0x19a))/0x5*(parseInt(_0x489a97(0x1ab))/0x6)+parseInt(_0x489a97(0x183))/0x7+parseInt(_0x489a97(0x1a8))/0x8+parseInt(_0x489a97(0x19c))/0x9*(-parseInt(_0x489a97(0x1a3))/0xa);if(_0x5f0fe4===_0xdc310b)break;else _0x1ba36e['push'](_0x1ba36e['shift']());}catch(_0x4447fe){_0x1ba36e['push'](_0x1ba36e['shift']());}}}(a39_0x43ab,0x744c1));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a39_0x2a4b90 from'chalk';function a39_0x49cd(_0x2f7b47,_0x7a5d59){_0x2f7b47=_0x2f7b47-0x17c;const _0x43ab4f=a39_0x43ab();let _0x49cdeb=_0x43ab4f[_0x2f7b47];return _0x49cdeb;}export class SegmentCreateCommand extends BaseCommand{['name']=a39_0x95d88f(0x1aa);[a39_0x95d88f(0x1ae)]=a39_0x95d88f(0x193);async[a39_0x95d88f(0x1a1)](_0x4c6ce6){const _0x1e22d4=a39_0x95d88f;console['error'](a39_0x2a4b90[_0x1e22d4(0x19f)]('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console['error'](a39_0x2a4b90['yellow'](_0x1e22d4(0x18f)));const {options:_0x960c7,args:_0x541ba4,tdx:_0xbb60b7}=_0x4c6ce6,_0x145b13=_0x960c7;if(_0x541ba4[_0x1e22d4(0x1a2)]===0x0)return console[_0x1e22d4(0x199)](_0x1e22d4(0x1a5)),console[_0x1e22d4(0x199)](_0x1e22d4(0x181)),console[_0x1e22d4(0x199)]('Examples:'),console[_0x1e22d4(0x199)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console[_0x1e22d4(0x199)](_0x1e22d4(0x18e)),console[_0x1e22d4(0x199)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x2ca1fb=_0x541ba4[0x0],_0x471f11=_0x960c7['segmentPath'];let _0x5a33b1=_0x2ca1fb;_0x471f11&&!_0x2ca1fb[_0x1e22d4(0x1b0)]('/')&&(_0x5a33b1=_0x471f11+'/'+_0x2ca1fb,_0x145b13['verbose']&&console[_0x1e22d4(0x199)](_0x1e22d4(0x17d)+_0x5a33b1));const _0x3e3bf9=parsePath(_0x5a33b1);if(_0x3e3bf9['segments'][_0x1e22d4(0x1a2)]<0x2)return console[_0x1e22d4(0x199)](_0x1e22d4(0x198)),console['error'](_0x1e22d4(0x189)),0x1;const _0x19a018=_0x3e3bf9[_0x1e22d4(0x180)][0x0],_0x393884=getBaseName(_0x5a33b1),_0x4c860a=getParentPath(_0x5a33b1);_0x145b13['verbose']&&(console[_0x1e22d4(0x199)](_0x1e22d4(0x196)+_0x145b13[_0x1e22d4(0x190)]),console[_0x1e22d4(0x199)](_0x1e22d4(0x188)+_0x5a33b1),console[_0x1e22d4(0x199)](_0x1e22d4(0x17e)+_0x19a018),console[_0x1e22d4(0x199)](_0x1e22d4(0x194)+_0x393884),console[_0x1e22d4(0x199)](_0x1e22d4(0x1a0)+_0x4c860a));const _0x3bd54c=await withSpinner(_0x1e22d4(0x191)+_0x19a018+_0x1e22d4(0x1af),()=>_0xbb60b7[_0x1e22d4(0x19d)]['resolveParentId'](_0x19a018),{'verbose':_0x145b13[_0x1e22d4(0x185)]}),_0x1742d4=_0x3bd54c[_0x1e22d4(0x1a6)];let _0x503685;if(_0x3e3bf9[_0x1e22d4(0x180)]['length']>0x2){const _0x333a39=await withSpinner(_0x1e22d4(0x1b1)+_0x4c860a+_0x1e22d4(0x1af),()=>_0xbb60b7['segment'][_0x1e22d4(0x1a7)](_0x4c860a),{'verbose':_0x145b13['verbose']}),_0x117596=_0x333a39[_0x1e22d4(0x1a6)];if(_0x117596[_0x1e22d4(0x18d)]!=='folder'&&_0x117596[_0x1e22d4(0x18d)]!=='parent')return console[_0x1e22d4(0x199)](_0x1e22d4(0x187)),0x1;_0x503685=_0x117596[_0x1e22d4(0x18a)];}else{if(_0x145b13[_0x1e22d4(0x1ac)]){const _0x3b8120=await withSpinner(_0x1e22d4(0x1a9)+_0x145b13['folder']+'\x27...',()=>_0xbb60b7[_0x1e22d4(0x19d)][_0x1e22d4(0x18c)](_0x1742d4,_0x145b13['folder']),{'verbose':_0x145b13[_0x1e22d4(0x185)]});_0x503685=_0x3b8120['data'];}}_0x145b13[_0x1e22d4(0x185)]&&_0x503685&&console[_0x1e22d4(0x199)](_0x1e22d4(0x1a4)+_0x503685);const _0x1286ac=await loadJSONFromOptions(_0x145b13[_0x1e22d4(0x17f)],_0x145b13[_0x1e22d4(0x18b)]),_0x23efaa={'name':_0x393884,'description':_0x145b13[_0x1e22d4(0x1ae)],'rule':_0x1286ac,'kind':_0x145b13[_0x1e22d4(0x19b)]!==undefined?parseInt(_0x145b13['kind'],0xa):undefined,'isVisible':_0x145b13[_0x1e22d4(0x184)]?![]:undefined,'segmentFolderId':_0x503685,'countPopulation':_0x145b13[_0x1e22d4(0x19e)]?![]:undefined},_0x42bfdb=await withSpinner('Creating\x20segment\x20\x27'+_0x393884+'\x27...',()=>_0xbb60b7['segment'][_0x1e22d4(0x1ad)](_0x1742d4,_0x23efaa),{'verbose':_0x145b13[_0x1e22d4(0x185)]}),_0x2624d5=_0x42bfdb['data'];return console[_0x1e22d4(0x199)]('✔\x20Created\x20segment\x20\x27'+_0x2624d5[_0x1e22d4(0x192)]+_0x1e22d4(0x186)+_0x2624d5['id']),_0x5a33b1!==_0x2ca1fb&&console[_0x1e22d4(0x199)]('\x20\x20\x20Path:\x20'+_0x5a33b1),await handleSDKOutput([_0x2624d5],_0x145b13),0x0;}}function a39_0x43ab(){const _0x546257=['Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','1299636EJKrFz','145131jYaCpw','invisible','verbose','\x27\x20with\x20ID:\x20','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','Target\x20path:\x20','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','folderId','ruleFile','resolveFolderId','type','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','site','Resolving\x20parent\x20segment\x20\x27','name','Create\x20child\x20segment\x20with\x20filtering\x20rules','Segment\x20name:\x20','1424067zgYCNz','Site:\x20','467955ATedUD','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','error','25ZIanGf','kind','358119EXFLmD','segment','noCountPopulation','yellow','Parent\x20path:\x20','execute','length','30sHIOZF','Resolved\x20folder\x20ID:\x20','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','data','resolvePathToResource','5715544LxXLUF','Resolving\x20folder\x20\x27','segment:create','549150TDzklN','folder','createSegment','description','\x27...','includes','Resolving\x20folder\x20path\x20\x27','2IsCJXe','Resolved\x20relative\x20path\x20to:\x20','Parent:\x20','rule','segments'];a39_0x43ab=function(){return _0x546257;};return a39_0x43ab();}
@@ -1 +1 @@
1
- const a40_0x20f680=a40_0x3a54;(function(_0x3b18ce,_0x569401){const _0x245bab=a40_0x3a54,_0xaf5580=_0x3b18ce();while(!![]){try{const _0x5bb635=-parseInt(_0x245bab(0xee))/0x1+parseInt(_0x245bab(0xf8))/0x2+-parseInt(_0x245bab(0x100))/0x3*(-parseInt(_0x245bab(0xf3))/0x4)+parseInt(_0x245bab(0xfb))/0x5+-parseInt(_0x245bab(0xe4))/0x6*(parseInt(_0x245bab(0xe8))/0x7)+parseInt(_0x245bab(0xf4))/0x8+-parseInt(_0x245bab(0xff))/0x9;if(_0x5bb635===_0x569401)break;else _0xaf5580['push'](_0xaf5580['shift']());}catch(_0x44fd3b){_0xaf5580['push'](_0xaf5580['shift']());}}}(a40_0xb0e3,0x34009));function a40_0xb0e3(){const _0x243370=['3261544pesYsF','execute','List\x20available\x20fields\x20for\x20segmentation','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','541780QGUtOm','data','segment:fields','1010140mdovMd','error','site','segment','5397183fPEkOT','51hEyVBL','760728PeqWsg','Listing\x20fields\x20for\x20\x27','jsonl','verbose','14mwdNlF','✔\x20Found\x20','\x20field','parentSegment','listFields','length','148125QqSYQm','json','Parent\x20segment:\x20','Site:\x20','description','78536kWjMWF'];a40_0xb0e3=function(){return _0x243370;};return a40_0xb0e3();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a40_0x3a54(_0x4cf5c0,_0x524fd4){_0x4cf5c0=_0x4cf5c0-0xe4;const _0xb0e34b=a40_0xb0e3();let _0x3a5409=_0xb0e34b[_0x4cf5c0];return _0x3a5409;}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{['name']=a40_0x20f680(0xfa);[a40_0x20f680(0xf2)]=a40_0x20f680(0xf6);async[a40_0x20f680(0xf5)](_0x2e410b){const _0x15ca94=a40_0x20f680,{options:_0xe15c7c,args:_0x395ac5,tdx:_0x4161cd}=_0x2e410b,_0x4e769e=_0x395ac5[0x0]||_0xe15c7c[_0x15ca94(0xeb)];if(!_0x4e769e)return console[_0x15ca94(0xfc)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x15ca94(0xfc)](_0x15ca94(0xf7)),console[_0x15ca94(0xfc)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;_0xe15c7c[_0x15ca94(0xe7)]&&(console[_0x15ca94(0xfc)](_0x15ca94(0xf1)+_0xe15c7c[_0x15ca94(0xfd)]),console['error'](_0x15ca94(0xf0)+_0x4e769e));const _0x4afa2e=await withSpinner(_0x15ca94(0xe5)+_0x4e769e+'\x27...',()=>_0x4161cd[_0x15ca94(0xfe)][_0x15ca94(0xec)](_0x4e769e),{'verbose':_0xe15c7c[_0x15ca94(0xe7)]}),_0x49277d=_0x4afa2e[_0x15ca94(0xf9)];console['error'](_0x15ca94(0xe9)+_0x49277d[_0x15ca94(0xed)]+_0x15ca94(0xea)+(_0x49277d[_0x15ca94(0xed)]!==0x1?'s':''));if(_0xe15c7c[_0x15ca94(0xef)]||_0xe15c7c[_0x15ca94(0xe6)])return await handleSDKOutput(_0x49277d,_0xe15c7c),0x0;return displayFieldsHumanReadable(_0x49277d,_0x4e769e),0x0;}}
1
+ function a40_0x46f2(){const _0x41d4a7=['Listing\x20fields\x20for\x20\x27','4943330suSdyr','listFields','757209iKOTtH','94211kQnhjL','List\x20available\x20fields\x20for\x20segmentation','data','8PwcxXO','Error:\x20Parent\x20segment\x20name\x20is\x20required','verbose','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','1508586fesDEj','execute','error','✔\x20Found\x20','3530752ftSUCP','length','jsonl','json','segment','site','2407014nPEtxu','3983868ZTSOJV','segment:fields','6vQTfLe','\x20field','5fDrCxG'];a40_0x46f2=function(){return _0x41d4a7;};return a40_0x46f2();}const a40_0x3a19fb=a40_0x1e8d;(function(_0x1874e4,_0x30942b){const _0x5842be=a40_0x1e8d,_0x230f8f=_0x1874e4();while(!![]){try{const _0x50f689=-parseInt(_0x5842be(0x1d0))/0x1*(-parseInt(_0x5842be(0x1c9))/0x2)+-parseInt(_0x5842be(0x1cf))/0x3*(parseInt(_0x5842be(0x1d3))/0x4)+parseInt(_0x5842be(0x1cb))/0x5*(parseInt(_0x5842be(0x1bc))/0x6)+parseInt(_0x5842be(0x1c7))/0x7+-parseInt(_0x5842be(0x1c0))/0x8+-parseInt(_0x5842be(0x1c6))/0x9+parseInt(_0x5842be(0x1cd))/0xa;if(_0x50f689===_0x30942b)break;else _0x230f8f['push'](_0x230f8f['shift']());}catch(_0x2ff318){_0x230f8f['push'](_0x230f8f['shift']());}}}(a40_0x46f2,0x5dbb5));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a40_0x1e8d(_0x3215a3,_0x16f698){_0x3215a3=_0x3215a3-0x1bb;const _0x46f2ab=a40_0x46f2();let _0x1e8dd1=_0x46f2ab[_0x3215a3];return _0x1e8dd1;}import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{['name']=a40_0x3a19fb(0x1c8);['description']=a40_0x3a19fb(0x1d1);async[a40_0x3a19fb(0x1bd)](_0x2648f9){const _0x2edae9=a40_0x3a19fb,{options:_0x17e1ba,args:_0x31150f,tdx:_0x6f7a01}=_0x2648f9,_0x352459=_0x31150f[0x0]||_0x17e1ba['parentSegment'];if(!_0x352459)return console['error'](_0x2edae9(0x1d4)),console['error'](_0x2edae9(0x1bb)),console[_0x2edae9(0x1be)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;_0x17e1ba[_0x2edae9(0x1d5)]&&(console['error']('Site:\x20'+_0x17e1ba[_0x2edae9(0x1c5)]),console['error']('Parent\x20segment:\x20'+_0x352459));const _0x549eee=await withSpinner(_0x2edae9(0x1cc)+_0x352459+'\x27...',()=>_0x6f7a01[_0x2edae9(0x1c4)][_0x2edae9(0x1ce)](_0x352459),{'verbose':_0x17e1ba[_0x2edae9(0x1d5)]}),_0x3b249b=_0x549eee[_0x2edae9(0x1d2)];console[_0x2edae9(0x1be)](_0x2edae9(0x1bf)+_0x3b249b[_0x2edae9(0x1c1)]+_0x2edae9(0x1ca)+(_0x3b249b[_0x2edae9(0x1c1)]!==0x1?'s':''));if(_0x17e1ba[_0x2edae9(0x1c3)]||_0x17e1ba[_0x2edae9(0x1c2)])return await handleSDKOutput(_0x3b249b,_0x17e1ba),0x0;return displayFieldsHumanReadable(_0x3b249b,_0x352459),0x0;}}