@treasuredata/tdx 2026.3.43 → 2026.3.45

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_0x2758f3=a33_0x3939;(function(_0x5cb737,_0xcc8b60){const _0x988dee=a33_0x3939,_0x107da2=_0x5cb737();while(!![]){try{const _0x543cab=-parseInt(_0x988dee(0x83))/0x1*(parseInt(_0x988dee(0xa0))/0x2)+-parseInt(_0x988dee(0x91))/0x3+parseInt(_0x988dee(0x7f))/0x4+parseInt(_0x988dee(0xaa))/0x5*(parseInt(_0x988dee(0x7d))/0x6)+-parseInt(_0x988dee(0x92))/0x7*(parseInt(_0x988dee(0x99))/0x8)+parseInt(_0x988dee(0x9a))/0x9*(parseInt(_0x988dee(0x80))/0xa)+parseInt(_0x988dee(0x7c))/0xb;if(_0x543cab===_0xcc8b60)break;else _0x107da2['push'](_0x107da2['shift']());}catch(_0x1602c5){_0x107da2['push'](_0x107da2['shift']());}}}(a33_0x2fb0,0x987cb));import{BaseCommand}from'./command.js';function a33_0x3939(_0x81d572,_0x47130e){_0x81d572=_0x81d572-0x7c;const _0x2fb093=a33_0x2fb0();let _0x393927=_0x2fb093[_0x81d572];return _0x393927;}import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';function a33_0x2fb0(){const _0x224fdc=['getPolicyPermissions','name','Fetching\x20policy...','length','log',',\x20user_id:','3049260dnxsbr','148295NsXOky','error','Fetching\x20permissions...','listPolicies','dim','policy\x20show','email','32qxdeWb','108IeuCBi','context','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','description','\x20user','\x20—\x20','52AxRzvF','validate','bold','user','getCurrent','site','permissions','\x20polic','execute','ies','25nPayVc','policy','getMyPermissions','Account\x20Owner','\x20\x20\x20','✔\x20Found\x20','policies','data','(ID:\x20','args','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','verbose','getPolicyUsers','11419760GUKSJW','636108TPOqRc','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','1999820ZtblBX','259990wRPvEh','account_id','\x20\x20•\x20','25171TVpMaJ','all','map','📋\x20Assigned\x20Policies','account_owner','administrator','max','🔑\x20Effective\x20Permissions'];a33_0x2fb0=function(){return _0x224fdc;};return a33_0x2fb0();}import{withSpinner}from'../utils/spinner.js';import a33_0x3c6caa from'chalk';export class PolicyCommand extends BaseCommand{[a33_0x2758f3(0x8c)]='policy';[a33_0x2758f3(0x9d)]=a33_0x2758f3(0xb5);async[a33_0x2758f3(0xa8)](_0x1c41a4){const _0x5eee0e=a33_0x2758f3,{options:_0x99adf3,tdx:_0x2a6a29}=_0x1c41a4,_0x5f1af4=await withSpinner(_0x5eee0e(0x94),async()=>{const _0x2ed5bd=_0x5eee0e,[_0x48f9b2,_0x181b03]=await Promise[_0x2ed5bd(0x84)]([_0x2a6a29[_0x2ed5bd(0xa3)][_0x2ed5bd(0xa4)](),_0x2a6a29['policy'][_0x2ed5bd(0xac)]()]);return{'userInfo':_0x48f9b2,'permissions':_0x181b03};},{'verbose':_0x99adf3[_0x5eee0e(0xb6)]}),{userInfo:_0x274879,permissions:_0x5abc39}=_0x5f1af4[_0x5eee0e(0xb1)];if(isStructuredFormat(_0x99adf3))return await handleSingleObjectOutput(_0x5abc39,_0x99adf3),0x0;const _0x3f4a0a=_0x274879[_0x5eee0e(0x87)]?_0x5eee0e(0xad):_0x274879[_0x5eee0e(0x88)]?'Administrator':'Member';console[_0x5eee0e(0x8f)]('\x0a'+a33_0x3c6caa[_0x5eee0e(0xa2)]('👤')+'\x20'+a33_0x3c6caa['bold'](_0x274879[_0x5eee0e(0x8c)])+'\x20'+a33_0x3c6caa['dim']('('+_0x274879[_0x5eee0e(0x98)]+')')+_0x5eee0e(0x9f)+_0x3f4a0a),console['log'](a33_0x3c6caa[_0x5eee0e(0x96)](_0x5eee0e(0xae)+_0x2a6a29[_0x5eee0e(0x9b)][_0x5eee0e(0xa5)]+':'+_0x274879[_0x5eee0e(0x81)]+_0x5eee0e(0x90)+_0x274879['id']));const _0x2f4a95=_0x5abc39[_0x5eee0e(0xb0)];console[_0x5eee0e(0x8f)]('\x0a'+a33_0x3c6caa[_0x5eee0e(0xa2)](_0x5eee0e(0x86))+'\x20('+_0x2f4a95[_0x5eee0e(0x8e)]+'):');if(_0x2f4a95[_0x5eee0e(0x8e)]===0x0)console[_0x5eee0e(0x8f)](a33_0x3c6caa[_0x5eee0e(0x96)]('\x20\x20No\x20policies\x20assigned'));else for(const _0x488cdb of _0x2f4a95){console[_0x5eee0e(0x8f)]('\x20\x20•\x20'+_0x488cdb[_0x5eee0e(0x8c)]);}return printPermissionsMap(_0x5abc39[_0x5eee0e(0xa6)]),console['log'](),0x0;}}export class PolicyListCommand extends BaseCommand{[a33_0x2758f3(0x8c)]='policy\x20list';[a33_0x2758f3(0x9d)]=a33_0x2758f3(0xb4);async[a33_0x2758f3(0xa8)](_0x262d22){const _0x464324=a33_0x2758f3,{options:_0x5abc07,tdx:_0x3c43a3}=_0x262d22,_0x1c1a2d=await withSpinner('Listing\x20policies...',()=>_0x3c43a3[_0x464324(0xab)][_0x464324(0x95)](),{'verbose':_0x5abc07[_0x464324(0xb6)]}),_0x2594f6=_0x1c1a2d[_0x464324(0xb1)];console[_0x464324(0x93)](_0x464324(0xaf)+_0x2594f6[_0x464324(0x8e)]+_0x464324(0xa7)+(_0x2594f6[_0x464324(0x8e)]!==0x1?_0x464324(0xa9):'y'));if(isStructuredFormat(_0x5abc07))return await handleSDKOutput(_0x2594f6,_0x5abc07),0x0;if(_0x2594f6[_0x464324(0x8e)]===0x0)console['log'](a33_0x3c6caa[_0x464324(0x96)]('No\x20policies\x20found'));else for(const _0x1c0bb2 of _0x2594f6){const _0xaaeb31=_0x1c0bb2[_0x464324(0x9d)]?a33_0x3c6caa[_0x464324(0x96)](_0x464324(0x9f)+_0x1c0bb2[_0x464324(0x9d)]):'';console[_0x464324(0x8f)]('\x20\x20•\x20'+_0x1c0bb2[_0x464324(0x8c)]+_0xaaeb31);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a33_0x2758f3(0x8c)]=a33_0x2758f3(0x97);[a33_0x2758f3(0x9d)]=a33_0x2758f3(0x7e);[a33_0x2758f3(0xa1)](_0x21d309){const _0x335033=a33_0x2758f3;if(_0x21d309[_0x335033(0xb3)][_0x335033(0x8e)]===0x0)return _0x335033(0x9c);return undefined;}async['execute'](_0xe4905e){const _0xf1a5b9=a33_0x2758f3,{options:_0x57dbbf,tdx:_0x3d92bb}=_0xe4905e,_0x586162=_0xe4905e[_0xf1a5b9(0xb3)][0x0],_0x958289=await withSpinner(_0xf1a5b9(0x8d),async()=>{const _0x36e7c0=_0xf1a5b9,_0x1540b5=await _0x3d92bb[_0x36e7c0(0xab)]['getPolicy'](_0x586162),[_0x3a80c2,_0x5432e1]=await Promise[_0x36e7c0(0x84)]([_0x3d92bb['policy'][_0x36e7c0(0x8b)](_0x1540b5['id']),_0x3d92bb['policy'][_0x36e7c0(0xb7)](_0x1540b5['id'])]);return{'policy':_0x1540b5,'perms':_0x3a80c2,'users':_0x5432e1};},{'verbose':_0x57dbbf[_0xf1a5b9(0xb6)]}),{policy:_0x7bec46,perms:_0x6f4959,users:_0x259258}=_0x958289['data'];if(isStructuredFormat(_0x57dbbf))return await handleSingleObjectOutput({..._0x7bec46,'permissions':_0x6f4959[_0xf1a5b9(0xa6)],'users':_0x259258},_0x57dbbf),0x0;console[_0xf1a5b9(0x8f)]('\x0a'+a33_0x3c6caa['bold']('📋')+'\x20'+a33_0x3c6caa[_0xf1a5b9(0xa2)](_0x7bec46['name'])+'\x20'+a33_0x3c6caa['dim'](_0xf1a5b9(0xb2)+_0x7bec46['id']+')'));_0x7bec46['description']&&console[_0xf1a5b9(0x8f)](_0xf1a5b9(0xae)+a33_0x3c6caa[_0xf1a5b9(0x96)](_0x7bec46['description']));console[_0xf1a5b9(0x8f)](_0xf1a5b9(0xae)+_0x259258['length']+_0xf1a5b9(0x9e)+(_0x259258['length']!==0x1?'s':'')+'\x20assigned'),printPermissionsMap(_0x6f4959[_0xf1a5b9(0xa6)]);if(_0x259258['length']>0x0){console[_0xf1a5b9(0x8f)]('\x0a'+a33_0x3c6caa['bold']('👥\x20Assigned\x20Users')+':');for(const _0x422e35 of _0x259258){const _0x13f75d=_0x422e35[_0xf1a5b9(0x98)]&&_0x422e35[_0xf1a5b9(0x98)]!==_0x422e35[_0xf1a5b9(0x8c)]?a33_0x3c6caa['dim']('\x20<'+_0x422e35[_0xf1a5b9(0x98)]+'>'):'';console['log'](_0xf1a5b9(0x82)+_0x422e35['name']+_0x13f75d);}}return console[_0xf1a5b9(0x8f)](),0x0;}}function printPermissionsMap(_0x5c1c0e){const _0x32a229=a33_0x2758f3,_0x49b503=Object['entries'](_0x5c1c0e);console['log']('\x0a'+a33_0x3c6caa[_0x32a229(0xa2)](_0x32a229(0x8a))+':');if(_0x49b503[_0x32a229(0x8e)]===0x0){console[_0x32a229(0x8f)](a33_0x3c6caa[_0x32a229(0x96)]('\x20\x20No\x20permissions'));return;}const _0x4199cc=Math[_0x32a229(0x89)](..._0x49b503[_0x32a229(0x85)](([_0x4abf7e])=>_0x4abf7e[_0x32a229(0x8e)]));for(const [_0x58eac6,_0x5790f2]of _0x49b503){const _0x15094b=formatOperations(_0x5790f2);console[_0x32a229(0x8f)]('\x20\x20'+_0x58eac6['padEnd'](_0x4199cc+0x2)+_0x15094b);}}function formatOperations(_0x2396fd){const _0x50eb20=a33_0x2758f3,_0x21515f=[...new Set(_0x2396fd[_0x50eb20(0x85)](_0x2ec537=>_0x2ec537['operation']))];return _0x21515f['join'](',\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_0x58a36d=a34_0xeafe;(function(_0x13136f,_0xa879f2){const _0x5412d2=a34_0xeafe,_0x4fb046=_0x13136f();while(!![]){try{const _0x40ef15=parseInt(_0x5412d2(0x1e2))/0x1+-parseInt(_0x5412d2(0x1a7))/0x2+parseInt(_0x5412d2(0x195))/0x3*(parseInt(_0x5412d2(0x1c8))/0x4)+-parseInt(_0x5412d2(0x1f0))/0x5+parseInt(_0x5412d2(0x1bb))/0x6*(-parseInt(_0x5412d2(0x1c6))/0x7)+parseInt(_0x5412d2(0x1e6))/0x8+parseInt(_0x5412d2(0x1b5))/0x9;if(_0x40ef15===_0xa879f2)break;else _0x4fb046['push'](_0x4fb046['shift']());}catch(_0x453771){_0x4fb046['push'](_0x4fb046['shift']());}}}(a34_0x5639,0xbc721));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_0x4a7149 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';function a34_0x5639(){const _0x82f5a8=['VALID_KEYS','email','database','\x27.\x0a\x0aValid\x20keys:\x20','warn','yellow','dim','\x0aSetup\x20cancelled','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','apiKey','Session\x20profile\x20set\x20to:\x20','error','2283224PRonpf','method','profile:set','password','message','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','select','ERROR','tdx.json','join','profileName','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','tdx:\x20profile\x20set','apikey','22156542aaPetu','Setup\x20cancelled','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','execute','us01','\x0aSaved\x20to:\x20','6IHVWoP','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','log','status','validate','profile:use','Enter\x20profile\x20name:','\x27\x20requires\x20API\x20key\x20validation.','\x27\x20updated:\x20','7418684zRVlDV','\x20--default\x27\x20to\x20save\x20permanently','2007116DVWoDI','Create\x20a\x20new\x20profile','Set\x20session\x20profile','Remove\x20a\x20profile','trim','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','llm_project','\x20\x20(no\x20profiles\x20found)','You\x20can\x20find\x20your\x20API\x20key\x20at:','(cleared)','\x20Profile\x20\x27','(session:\x20','Unknown\x20key\x20\x27','Changing\x20site\x20to\x20\x27','logLevel','config','name','OAuth\x20(browser\x20login)','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x20\x20tdx\x20--profile\x20','split','\x0aAvailable\x20profiles:','Profile\x20\x27','oauth','Removal\x20cancelled','\x27\x20removed\x20from\x20configuration','225910FjhkBm','text','default','getUserInfo','8200880tGmhUI','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','red','site','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','profile:create','\x20API\x20key\x20removed\x20from\x20system\x20keychain','\x27\x20does\x20not\x20exist.\x20Create\x20it?','length','Site\x20was\x20not\x20changed.','6206700lkCMQF','bold','includes','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Choose\x20authentication\x20method:','\x20\x20-\x20','Profile\x20name\x20cannot\x20be\x20empty','description','Validating\x20API\x20key...','Failed\x20to\x20remove\x20profile:\x20','Set\x20a\x20profile\x20configuration\x20value','✗\x20Validation\x20failed:\x20','tdx:\x20profile\x20create','Default\x20profile\x20set\x20to:\x20','\x27\x20created','\x27\x20does\x20not\x20exist.','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>','tdx:\x20profile\x20remove','profile','confirm','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','profile:remove','3NDlYhi','test','Enter\x20description\x20(optional):','session','/app/mp/ak','green'];a34_0x5639=function(){return _0x82f5a8;};return a34_0x5639();}import{LogLevel}from'../utils/tdx-logger.js';function a34_0xeafe(_0x550f83,_0x41b04e){_0x550f83=_0x550f83-0x18f;const _0x563983=a34_0x5639();let _0xeafed9=_0x563983[_0x550f83];return _0xeafed9;}import a34_0x5902d7 from'prompts';import a34_0x594c6b from'chalk';function validateProfileName(_0x27d663){const _0x2d738e=a34_0xeafe;if(!_0x27d663||!_0x27d663['trim']())return _0x2d738e(0x1f6);const _0x2e0d99=_0x27d663['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x2d738e(0x196)](_0x2e0d99))return _0x2d738e(0x1a3);if(profileExists(_0x2e0d99))return _0x2d738e(0x1de)+_0x2e0d99+_0x2d738e(0x193);return!![];}export class ProfileCreateCommand extends BaseCommand{[a34_0x58a36d(0x1d8)]=a34_0x58a36d(0x1eb);[a34_0x58a36d(0x1f7)]=a34_0x58a36d(0x1c9);async[a34_0x58a36d(0x1b8)](_0x4e62ec){const _0x4e23a2=a34_0x58a36d,{options:_0x4e0917,args:_0x466d20}=_0x4e62ec;console[_0x4e23a2(0x1bf)](a34_0x594c6b['bold'](_0x4e23a2(0x1fc)));let _0x3fe408;if(_0x466d20['length']>0x0&&_0x466d20[0x0]){const _0x4b4888=_0x466d20[0x0][_0x4e23a2(0x1cc)](),_0x38df1c=validateProfileName(_0x4b4888);if(_0x38df1c!==!![])return console[_0x4e23a2(0x1a6)](a34_0x594c6b[_0x4e23a2(0x1e8)](_0x38df1c)),0x1;_0x3fe408=_0x4b4888;}else{const _0x160f9d=await a34_0x5902d7({'type':_0x4e23a2(0x1e3),'name':'profileName','message':_0x4e23a2(0x1c3),'validate':validateProfileName});if(!_0x160f9d[_0x4e23a2(0x1b1)])return console[_0x4e23a2(0x1bf)](_0x4e23a2(0x1a2)),0x1;_0x3fe408=_0x160f9d[_0x4e23a2(0x1b1)][_0x4e23a2(0x1cc)]();}const _0x1148a3=await a34_0x5902d7({'type':'text','name':_0x4e23a2(0x1f7),'message':_0x4e23a2(0x197)}),_0x4b446b=_0x1148a3[_0x4e23a2(0x1f7)]?.[_0x4e23a2(0x1cc)]()||undefined,_0x6cd6d6=_0x4e0917[_0x4e23a2(0x1e9)]||_0x4e23a2(0x1b9),_0x2c5061=await promptSiteSelection(_0x6cd6d6,_0x3fe408,_0x4e23a2(0x1b6));if(!_0x2c5061)return 0x1;const _0xb18297=resolveSite(_0x2c5061);if(isOAuthSupported(_0xb18297)){const _0x18b799=await a34_0x5902d7({'type':_0x4e23a2(0x1ad),'name':_0x4e23a2(0x1a8),'message':_0x4e23a2(0x1f4),'choices':[{'title':_0x4e23a2(0x1d9),'value':_0x4e23a2(0x1df)},{'title':'API\x20Key','value':_0x4e23a2(0x1b4)}]});if(!_0x18b799[_0x4e23a2(0x1a8)])return console[_0x4e23a2(0x1bf)](_0x4e23a2(0x1a2)),0x1;if(_0x18b799[_0x4e23a2(0x1a8)]===_0x4e23a2(0x1df)){if(_0x4b446b){const _0x4f4db8={'site':_0xb18297,'description':_0x4b446b};saveProfileToUserConfig(_0x3fe408,_0x4f4db8);}return await runOAuthLoginFlow(_0xb18297,_0x3fe408,_0x4e0917[_0x4e23a2(0x1d6)]??LogLevel[_0x4e23a2(0x1ae)]),0x0;}}console['log'](_0x4e23a2(0x1b2)+_0xb18297),console['log'](_0x4e23a2(0x1d0)),console[_0x4e23a2(0x1bf)]('\x20\x20'+getConsoleUrl(_0xb18297,'/app/mp/ak'));const _0x6afcf7=await a34_0x5902d7({'type':_0x4e23a2(0x1aa),'name':_0x4e23a2(0x1a4),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x526a89=>{if(!_0x526a89||!_0x526a89['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x6afcf7['apiKey'])return console[_0x4e23a2(0x1bf)](_0x4e23a2(0x1a2)),0x1;const _0x3c482f=_0x6afcf7[_0x4e23a2(0x1a4)];console[_0x4e23a2(0x1bf)](_0x4e23a2(0x1f8));try{const _0x212244=TDX['create']({'site':_0xb18297,'apiKey':_0x3c482f[_0x4e23a2(0x1cc)](),'logLevel':_0x4e0917[_0x4e23a2(0x1d6)]??LogLevel[_0x4e23a2(0x1ae)]}),_0x1d8fa3=await _0x212244['jobs'][_0x4e23a2(0x1e5)]();console[_0x4e23a2(0x1bf)](a34_0x594c6b[_0x4e23a2(0x19a)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x1d8fa3['email']+')');const _0x4ca8fb=await isKeychainAvailable();_0x4ca8fb?(await saveAPIKeyAsync(_0x3c482f['trim'](),_0xb18297,_0x3fe408),console['log'](a34_0x594c6b['green']('✓')+_0x4e23a2(0x1bd)+_0x3fe408+')')):(console['warn'](a34_0x594c6b[_0x4e23a2(0x1a0)](_0x4e23a2(0x1be))),console[_0x4e23a2(0x19f)](a34_0x594c6b[_0x4e23a2(0x1a0)](_0x4e23a2(0x1ea))));const _0x5372c9={'site':_0xb18297,..._0x4b446b&&{'description':_0x4b446b}};return saveProfileToUserConfig(_0x3fe408,_0x5372c9),console[_0x4e23a2(0x1bf)](a34_0x594c6b[_0x4e23a2(0x19a)]('✓')+'\x20Profile\x20\x27'+_0x3fe408+_0x4e23a2(0x1fe)),console['log'](),console[_0x4e23a2(0x1bf)](_0x4e23a2(0x192)),console[_0x4e23a2(0x1bf)]('\x20\x20tdx\x20--profile\x20'+_0x3fe408+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x4e23a2(0x1bf)](_0x4e23a2(0x1db)+_0x3fe408+_0x4e23a2(0x1f3)),0x0;}catch(_0x1bcedb){if(_0x1bcedb instanceof HTTPClientError&&_0x1bcedb['status']===0x191)return printAuthError(_0x1bcedb),0x1;return console[_0x4e23a2(0x1a6)](a34_0x594c6b[_0x4e23a2(0x1e8)]('✗\x20Validation\x20failed:\x20'+(_0x1bcedb instanceof Error?_0x1bcedb['message']:String(_0x1bcedb)))),console['error'](_0x4e23a2(0x1ac)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a34_0x58a36d(0x1d8)]=a34_0x58a36d(0x194);['description']=a34_0x58a36d(0x1cb);['validate'](_0x232f93){const _0x200b42=a34_0x58a36d,{args:_0x12a325}=_0x232f93;if(_0x12a325[_0x200b42(0x1ee)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async[a34_0x58a36d(0x1b8)](_0x50ba60){const _0x2e511e=a34_0x58a36d,{args:_0x2c95b2}=_0x50ba60,_0x8ab998=_0x2c95b2[0x0];console['log'](a34_0x594c6b[_0x2e511e(0x1f1)](_0x2e511e(0x18f)));if(!profileExists(_0x8ab998)){console[_0x2e511e(0x1a6)](a34_0x594c6b[_0x2e511e(0x1e8)]('Profile\x20\x27'+_0x8ab998+_0x2e511e(0x1ff))),console[_0x2e511e(0x1bf)](_0x2e511e(0x1dd));const _0x2ce88d=listProfiles();if(_0x2ce88d[_0x2e511e(0x1ee)]===0x0)console[_0x2e511e(0x1bf)](_0x2e511e(0x1cf));else for(const _0x5c0a62 of _0x2ce88d){console[_0x2e511e(0x1bf)](_0x2e511e(0x1f5)+_0x5c0a62[_0x2e511e(0x1d8)]);}return 0x1;}const _0x24d0f6=await a34_0x5902d7({'type':_0x2e511e(0x191),'name':_0x2e511e(0x191),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x8ab998+'\x27?','initial':![]});if(!_0x24d0f6['confirm'])return console[_0x2e511e(0x1bf)](_0x2e511e(0x1e0)),0x0;try{removeProfileFromUserConfig(_0x8ab998),console['log'](a34_0x594c6b[_0x2e511e(0x19a)]('✓')+_0x2e511e(0x1d2)+_0x8ab998+_0x2e511e(0x1e1));}catch(_0x55a635){return console[_0x2e511e(0x1a6)](a34_0x594c6b[_0x2e511e(0x1e8)](_0x2e511e(0x1f9)+(_0x55a635 instanceof Error?_0x55a635[_0x2e511e(0x1ab)]:String(_0x55a635)))),0x1;}const _0xb6db79=await isKeychainAvailable();if(_0xb6db79){const _0x18d636=await deleteKeychainAPIKey(_0x8ab998);_0x18d636&&console[_0x2e511e(0x1bf)](a34_0x594c6b[_0x2e511e(0x19a)]('✓')+_0x2e511e(0x1ec));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a34_0x58a36d(0x1d8)]=a34_0x58a36d(0x1a9);[a34_0x58a36d(0x1f7)]=a34_0x58a36d(0x1fa);static [a34_0x58a36d(0x19b)]=[a34_0x58a36d(0x1e9),a34_0x58a36d(0x19d),'parent_segment',a34_0x58a36d(0x1ce),'llm_agent',a34_0x58a36d(0x1f7)];[a34_0x58a36d(0x1c1)](_0x50ff1f){const _0x5deb95=a34_0x58a36d,{args:_0x3d72f5,options:_0x1e6467}=_0x50ff1f,_0x51c4e7=_0x1e6467['profile']||getActiveProfile();if(!_0x51c4e7)return _0x5deb95(0x200);if(_0x3d72f5[_0x5deb95(0x1ee)]===0x0)return _0x5deb95(0x1da)+ProfileSetCommand[_0x5deb95(0x19b)][_0x5deb95(0x1b0)](',\x20');const _0x426df7=_0x3d72f5[0x0];if(!_0x426df7['includes']('='))return _0x5deb95(0x1cd)+ProfileSetCommand[_0x5deb95(0x19b)][_0x5deb95(0x1b0)](',\x20');const [_0x10943d]=_0x426df7[_0x5deb95(0x1dc)]('=',0x2);if(!ProfileSetCommand[_0x5deb95(0x19b)][_0x5deb95(0x1f2)](_0x10943d))return _0x5deb95(0x1d4)+_0x10943d+_0x5deb95(0x19e)+ProfileSetCommand['VALID_KEYS'][_0x5deb95(0x1b0)](',\x20');return undefined;}async[a34_0x58a36d(0x1b8)](_0x571430){const _0x3138dd=a34_0x58a36d,{args:_0x3ec9d1,options:_0x1f0450}=_0x571430,_0x4981f0=_0x1f0450[_0x3138dd(0x190)]||getActiveProfile(),[_0x310b71,..._0xd46617]=_0x3ec9d1[0x0][_0x3138dd(0x1dc)]('='),_0x34f047=_0xd46617[_0x3138dd(0x1b0)]('=');console[_0x3138dd(0x1bf)](a34_0x594c6b[_0x3138dd(0x1f1)](_0x3138dd(0x1b3)));if(!profileExists(_0x4981f0)){const _0x1dc488=await a34_0x5902d7({'type':_0x3138dd(0x191),'name':'create','message':_0x3138dd(0x1de)+_0x4981f0+_0x3138dd(0x1ed),'initial':!![]});if(!_0x1dc488['create'])return console[_0x3138dd(0x1bf)]('Operation\x20cancelled'),0x1;}const _0x4602f8=loadProfile(_0x4981f0),_0x41fc2b=_0x4602f8?.[_0x3138dd(0x1d7)]||{};if(_0x310b71===_0x3138dd(0x1e9)){const _0x374aad=resolveSite(_0x34f047);console[_0x3138dd(0x1bf)](_0x3138dd(0x1d5)+_0x374aad+_0x3138dd(0x1c4)),console[_0x3138dd(0x1bf)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x3138dd(0x1bf)]('\x20\x20'+getConsoleUrl(_0x374aad,_0x3138dd(0x199)));const _0xfef125=await a34_0x5902d7({'type':_0x3138dd(0x1aa),'name':_0x3138dd(0x1a4),'message':_0x3138dd(0x1e7),'validate':_0x5ea828=>{const _0x122a00=_0x3138dd;if(!_0x5ea828||!_0x5ea828[_0x122a00(0x1cc)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0xfef125[_0x3138dd(0x1a4)])return console[_0x3138dd(0x1bf)]('\x0aOperation\x20cancelled'),0x1;console[_0x3138dd(0x1bf)](_0x3138dd(0x1f8));try{const _0x18b6b6=TDX['create']({'site':_0x374aad,'apiKey':_0xfef125[_0x3138dd(0x1a4)][_0x3138dd(0x1cc)](),'logLevel':_0x1f0450[_0x3138dd(0x1d6)]??LogLevel['ERROR']}),_0x35e91d=await _0x18b6b6['jobs'][_0x3138dd(0x1e5)]();console[_0x3138dd(0x1bf)](a34_0x594c6b['green']('✓')+_0x3138dd(0x1bc)+_0x35e91d[_0x3138dd(0x19c)]+')');const _0x4ca88c=await isKeychainAvailable();_0x4ca88c?(await saveAPIKeyAsync(_0xfef125[_0x3138dd(0x1a4)][_0x3138dd(0x1cc)](),_0x374aad,_0x4981f0),console['log'](a34_0x594c6b[_0x3138dd(0x19a)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x3138dd(0x19f)](a34_0x594c6b['yellow']('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x41fc2b['site']=_0x374aad;}catch(_0x316f82){if(_0x316f82 instanceof HTTPClientError&&_0x316f82[_0x3138dd(0x1c0)]===0x191)return printAuthError(_0x316f82),0x1;return console[_0x3138dd(0x1a6)](a34_0x594c6b[_0x3138dd(0x1e8)](_0x3138dd(0x1fb)+(_0x316f82 instanceof Error?_0x316f82[_0x3138dd(0x1ab)]:String(_0x316f82)))),console[_0x3138dd(0x1a6)](_0x3138dd(0x1ef)),0x1;}}else _0x41fc2b[_0x310b71]=_0x34f047||undefined;return saveProfileToUserConfig(_0x4981f0,_0x41fc2b),console['log'](a34_0x594c6b[_0x3138dd(0x19a)]('✓')+_0x3138dd(0x1d2)+_0x4981f0+_0x3138dd(0x1c5)+_0x310b71+'='+(_0x34f047||_0x3138dd(0x1d1))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a34_0x58a36d(0x1d8)]=a34_0x58a36d(0x1c2);[a34_0x58a36d(0x1f7)]=a34_0x58a36d(0x1ca);[a34_0x58a36d(0x1c1)](_0x553e34){const _0x5006dc=a34_0x58a36d,{args:_0x224c1f}=_0x553e34;if(_0x224c1f['length']===0x0)return _0x5006dc(0x1b7);return undefined;}async[a34_0x58a36d(0x1b8)](_0xf520b4){const _0x2138e7=a34_0x58a36d,{args:_0x55ed20,options:_0x3ab9ae}=_0xf520b4,_0x356e27=_0x55ed20[0x0],_0x594370=_0x3ab9ae[_0x2138e7(0x1e4)];cleanExpiredSessions();if(!profileExists(_0x356e27)){console[_0x2138e7(0x1a6)](a34_0x594c6b['red']('Profile\x20\x27'+_0x356e27+_0x2138e7(0x1ff))),console[_0x2138e7(0x1bf)](_0x2138e7(0x1dd));const _0x4d36ab=listProfiles();if(_0x4d36ab[_0x2138e7(0x1ee)]===0x0)console[_0x2138e7(0x1bf)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x2beaf5 of _0x4d36ab){console[_0x2138e7(0x1bf)](_0x2138e7(0x1f5)+_0x2beaf5[_0x2138e7(0x1d8)]);}return 0x1;}if(_0x594370){const _0x44d9cb=a34_0x4a7149[_0x2138e7(0x1b0)](getConfigDir(),_0x2138e7(0x1af));return saveActiveProfileToUserConfig(_0x356e27),console[_0x2138e7(0x1bf)](_0x2138e7(0x1fd)+a34_0x594c6b[_0x2138e7(0x19a)](_0x356e27)),console[_0x2138e7(0x1bf)](a34_0x594c6b['dim'](_0x2138e7(0x1ba)+_0x44d9cb)),0x0;}const _0x4a2475=getSessionID(_0x3ab9ae[_0x2138e7(0x198)]);return saveSessionContext({'profile':_0x356e27},_0x3ab9ae[_0x2138e7(0x198)]),console[_0x2138e7(0x1bf)](_0x2138e7(0x1a5)+a34_0x594c6b[_0x2138e7(0x19a)](_0x356e27)+'\x20'+a34_0x594c6b[_0x2138e7(0x1a1)](_0x2138e7(0x1d3)+_0x4a2475+')')),console['log'](a34_0x594c6b['dim']('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x356e27+_0x2138e7(0x1c7))),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
+ function a35_0x222e(_0x2bb6fe,_0x2bcd07){_0x2bb6fe=_0x2bb6fe-0xc6;const _0x1a6ce9=a35_0x1a6c();let _0x222e07=_0x1a6ce9[_0x2bb6fe];return _0x222e07;}const a35_0x1bf2b0=a35_0x222e;(function(_0x5ad417,_0xce82ac){const _0x531c6b=a35_0x222e,_0x1a9b22=_0x5ad417();while(!![]){try{const _0x4b7e31=-parseInt(_0x531c6b(0xd7))/0x1*(parseInt(_0x531c6b(0xdc))/0x2)+parseInt(_0x531c6b(0xda))/0x3*(-parseInt(_0x531c6b(0xdf))/0x4)+parseInt(_0x531c6b(0xd1))/0x5*(parseInt(_0x531c6b(0xd5))/0x6)+-parseInt(_0x531c6b(0xcd))/0x7*(parseInt(_0x531c6b(0xc6))/0x8)+-parseInt(_0x531c6b(0xd8))/0x9*(parseInt(_0x531c6b(0xcc))/0xa)+parseInt(_0x531c6b(0xd3))/0xb*(parseInt(_0x531c6b(0xd2))/0xc)+parseInt(_0x531c6b(0xce))/0xd;if(_0x4b7e31===_0xce82ac)break;else _0x1a9b22['push'](_0x1a9b22['shift']());}catch(_0x184067){_0x1a9b22['push'](_0x1a9b22['shift']());}}}(a35_0x1a6c,0x9e454));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a35_0x292656 from'chalk';function a35_0x1a6c(){const _0x38e6c2=['message','11444conaYa','profiles','log','2710664sFTuGB','👤\x20','dim','List\x20all\x20available\x20profiles','site','name','709270cLMTbL','21wQtmwu','34334885kCXDLA','Error:\x20','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','2417570MQOgBQ','54408FAedYl','847jKBeXc','\x20\x20Global:\x20~/.config/tdx/tdx.json','6IzKzoZ','config','402TMgpYO','9aDoBxh','description','1041JDzbvX','length','3708oaarOv','scope'];a35_0x1a6c=function(){return _0x38e6c2;};return a35_0x1a6c();}export class ProfilesCommand extends BaseCommand{[a35_0x1bf2b0(0xcb)]=a35_0x1bf2b0(0xe0);['description']=a35_0x1bf2b0(0xc9);async['execute'](_0x321d62){const _0x54ffd6=a35_0x1bf2b0,{options:_0x26e460}=_0x321d62;try{const _0xd47780=listProfiles(),_0x29ab37=getActiveProfile();if(_0xd47780[_0x54ffd6(0xdb)]===0x0)return console[_0x54ffd6(0xe1)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console[_0x54ffd6(0xe1)](_0x54ffd6(0xd0)),console[_0x54ffd6(0xe1)](_0x54ffd6(0xd4)),0x0;const _0x4d8d2f=_0xd47780['map'](_0x8c8b4b=>{const _0x226bd7=_0x54ffd6,_0x4c07fe=_0x8c8b4b[_0x226bd7(0xcb)]===_0x29ab37,_0x448e86=getProfileParams(_0x8c8b4b[_0x226bd7(0xd6)]);return{'name':_0x8c8b4b[_0x226bd7(0xcb)],'active':_0x4c07fe,'scope':_0x8c8b4b[_0x226bd7(0xdd)],'description':_0x8c8b4b[_0x226bd7(0xd6)][_0x226bd7(0xd9)]||'','params':_0x448e86};});if(isStructuredFormat(_0x26e460))await handleSDKOutput(_0x4d8d2f,_0x26e460);else for(const _0x121ac5 of _0xd47780){const _0x496abb=_0x121ac5['name']===_0x29ab37?a35_0x292656['green']('\x20✓'):'',_0x531a87=_0x121ac5['config'][_0x54ffd6(0xca)]?a35_0x292656[_0x54ffd6(0xc8)]('\x20'+_0x121ac5[_0x54ffd6(0xd6)][_0x54ffd6(0xca)]):'',_0x52921b=_0x121ac5[_0x54ffd6(0xd6)][_0x54ffd6(0xd9)]?a35_0x292656[_0x54ffd6(0xc8)]('\x20\x20'+_0x121ac5[_0x54ffd6(0xd6)][_0x54ffd6(0xd9)]):'';console[_0x54ffd6(0xe1)](_0x54ffd6(0xc7)+_0x121ac5[_0x54ffd6(0xcb)]+_0x496abb+_0x531a87+_0x52921b);}return 0x0;}catch(_0x418f1d){return _0x418f1d instanceof Error&&console['error'](_0x54ffd6(0xcf)+_0x418f1d[_0x54ffd6(0xde)]),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_0x41c0ff=a36_0xb941;(function(_0x3f8764,_0x3d859d){const _0xd228b7=a36_0xb941,_0x354d7b=_0x3f8764();while(!![]){try{const _0x265c39=parseInt(_0xd228b7(0xc7))/0x1*(parseInt(_0xd228b7(0xd2))/0x2)+parseInt(_0xd228b7(0xbd))/0x3*(parseInt(_0xd228b7(0xbe))/0x4)+-parseInt(_0xd228b7(0xd1))/0x5+-parseInt(_0xd228b7(0xb9))/0x6+-parseInt(_0xd228b7(0xab))/0x7+parseInt(_0xd228b7(0xad))/0x8+parseInt(_0xd228b7(0xb7))/0x9;if(_0x265c39===_0x3d859d)break;else _0x354d7b['push'](_0x354d7b['shift']());}catch(_0x4ecf8e){_0x354d7b['push'](_0x354d7b['shift']());}}}(a36_0x4f4f,0x7b7e0));import{BaseCommand}from'./command.js';function a36_0xb941(_0x54c15b,_0x3aea51){_0x54c15b=_0x54c15b-0xa9;const _0x4f4f5a=a36_0x4f4f();let _0xb9419=_0x4f4f5a[_0x54c15b];return _0xb9419;}import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a36_0x41c0ff(0xa9)]=a36_0x41c0ff(0xc5);['description']=a36_0x41c0ff(0xd0);async[a36_0x41c0ff(0xcb)](_0xf7253f){const _0x621527=a36_0x41c0ff,{options:_0x1be537,args:_0x3dae3e,tdx:_0x4d7baa}=_0xf7253f,_0x1a460f={..._0x1be537,'limitStructuredFormats':!![]},_0x469de9=_0x3dae3e[0x0],_0x44d1b8=_0x1be537['file'];let _0x2f0695;try{if(_0x44d1b8)_0x2f0695=readSqlStatementsFromFile(_0x44d1b8);else{if(_0x469de9==='-')_0x2f0695=await readSqlStatementsFromStdin();else{if(_0x469de9&&isSqlFilePath(_0x469de9))_0x2f0695=readSqlStatementsFromFile(_0x469de9);else{if(_0x469de9)_0x2f0695=splitSqlStatements(_0x469de9);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x456400){return console[_0x621527(0xd5)](_0x621527(0xc6)+_0x456400[_0x621527(0xc3)]),0x1;}const _0x499510=_0x1be537[_0x621527(0xb5)]||_0x621527(0xb3),_0x410942=_0x1be537[_0x621527(0xb1)];try{const _0x294988=[],_0x25ae72=!!_0x1be537[_0x621527(0xcc)];for(let _0x42b54e=0x0;_0x42b54e<_0x2f0695[_0x621527(0xbf)];_0x42b54e++){const _0x4617dd=_0x2f0695[_0x42b54e],_0x21a55c=_0x42b54e+0x1,_0x39941b=_0x2f0695['length'],_0x1c15e1=_0x39941b>0x1;_0x1be537[_0x621527(0xc0)]&&(console[_0x621527(0xd5)]('\x0a'+(_0x1c15e1?_0x621527(0xb8)+_0x21a55c+'/'+_0x39941b+':':'')),console[_0x621527(0xd5)](_0x621527(0xaa)+_0x1be537[_0x621527(0xd7)]),console[_0x621527(0xd5)](_0x621527(0xb6)+(_0x410942||'td')),console[_0x621527(0xd5)](_0x621527(0xce)+_0x499510),console[_0x621527(0xd5)]('SQL:\x20'+_0x4617dd));const _0x428ec9=_0x1c15e1?'Executing\x20statement\x20'+_0x21a55c+'/'+_0x39941b+'...':_0x621527(0xb4);try{const _0x5181a=await withProgressSpinner(_0x428ec9,async _0x1b7ab0=>{const _0x2e0ebb=_0x621527,_0x3f1a4c=await _0x4d7baa[_0x2e0ebb(0xc5)]['execute'](_0x4617dd,{'catalog':_0x410942,'schema':_0x499510,'onJobId':_0x53ff3a=>{_0x1b7ab0['setJobId'](_0x53ff3a);},'onProgress':_0x111f19=>{const _0x1645e7=_0x2e0ebb;_0x1b7ab0['setPhase']('Executing\x20query\x20['+_0x111f19[_0x1645e7(0xcf)]+']'),_0x1b7ab0[_0x1645e7(0xc1)](formatRows(_0x111f19[_0x1645e7(0xaf)])+_0x1645e7(0xd3)+_0x111f19[_0x1645e7(0xd4)]+'/'+_0x111f19['totalSplits']+_0x1645e7(0xbc));}});return _0x3f1a4c;},{'verbose':_0x1be537[_0x621527(0xc0)]}),_0x3d6987=_0x5181a[_0x621527(0xae)],_0x49edb9=_0x3d6987['jobId']?_0x621527(0xd6)+_0x3d6987[_0x621527(0xc2)]+']':'',_0x4dbf63=_0x1c15e1?_0x621527(0xb8)+_0x21a55c+'/'+_0x39941b+'\x20-\x20':'';console[_0x621527(0xd5)]('✔\x20'+_0x4dbf63+_0x621527(0xb0)+formatRows(_0x3d6987[_0x621527(0xba)][_0x621527(0xaf)])+_0x621527(0xd3)+(_0x621527(0xc4)+formatElapsed(_0x3d6987[_0x621527(0xba)]['elapsedTimeMillis'])+_0x49edb9));if(_0x1c15e1&&_0x25ae72){const _0x4b3183=resolveOutputOptions(_0x1a460f),_0x59829a=await formatQueryOutput(_0x3d6987,_0x4b3183);_0x294988[_0x621527(0xcd)](_0x59829a);}else await handleQueryOutput(_0x3d6987,_0x1a460f);}catch(_0xa4c6a1){const _0x5791b6=_0x1c15e1?_0x621527(0xb8)+_0x21a55c+'/'+_0x39941b+':\x0a':'',_0x3fa2db=_0xa4c6a1 instanceof SDKError?_0xa4c6a1[_0x621527(0xc9)]:_0xa4c6a1[_0x621527(0xc3)];return console[_0x621527(0xd5)](''+_0x5791b6+_0x3fa2db),0x1;}}if(_0x2f0695[_0x621527(0xbf)]>0x1&&_0x25ae72&&_0x294988['length']>0x0){const _0x5b8755=_0x294988[_0x621527(0xbb)]('\x0a');writeFileSync(_0x1be537[_0x621527(0xcc)],_0x5b8755),console['error']('\x0aAll\x20results\x20saved\x20to\x20'+_0x1be537[_0x621527(0xcc)]);}return 0x0;}catch(_0x12228e){throw _0x12228e;}}['validate'](_0x583d5a){const _0x34964f=a36_0x41c0ff,_0x54ff88=_0x583d5a[_0x34964f(0xca)][0x0],_0x24093b=_0x583d5a['options'][_0x34964f(0xb2)];if(!_0x54ff88&&!_0x24093b)return _0x34964f(0xac);if(_0x54ff88&&_0x24093b)return _0x34964f(0xc8);return undefined;}}function a36_0x4f4f(){const _0x2fc893=['6RJCnWm','1535976xsgHlX','length','verbose','setExtra','jobId','message','in\x20','query','Error:\x20','30893qOvjYw','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','originalMessage','args','execute','output','push','Schema:\x20','state','Run\x20Trino\x20queries\x20(streaming)','3557600ayfzPw','18ZbQieo','\x20rows\x20','completedSplits','error','\x20[Job\x20ID:\x20','site','name','Site:\x20','1513295hrncuq','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','4924504lRFbOb','data','processedRows','Query\x20completed:\x20Processed\x20','catalog','file','information_schema','Executing\x20query...','database','Catalog:\x20','1192041oqtYNK','Statement\x20','2163048SduHmH','stats','join','\x20splits'];a36_0x4f4f=function(){return _0x2fc893;};return a36_0x4f4f();}
@@ -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_0x3a4fc6=a37_0x3d0c;(function(_0xdd44a5,_0x3b7cb6){const _0x57fedc=a37_0x3d0c,_0x48b908=_0xdd44a5();while(!![]){try{const _0x382826=parseInt(_0x57fedc(0x1e2))/0x1+-parseInt(_0x57fedc(0x223))/0x2*(parseInt(_0x57fedc(0x228))/0x3)+parseInt(_0x57fedc(0x212))/0x4+parseInt(_0x57fedc(0x224))/0x5+parseInt(_0x57fedc(0x1ed))/0x6*(-parseInt(_0x57fedc(0x21a))/0x7)+parseInt(_0x57fedc(0x229))/0x8*(parseInt(_0x57fedc(0x1d9))/0x9)+parseInt(_0x57fedc(0x1d8))/0xa*(-parseInt(_0x57fedc(0x1e9))/0xb);if(_0x382826===_0x3b7cb6)break;else _0x48b908['push'](_0x48b908['shift']());}catch(_0x44f8e1){_0x48b908['push'](_0x48b908['shift']());}}}(a37_0x2db9,0x2d578));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';function a37_0x3d0c(_0x2c3920,_0x218045){_0x2c3920=_0x2c3920-0x1d1;const _0x2db9f1=a37_0x2db9();let _0x3d0ced=_0x2db9f1[_0x2c3920];return _0x3d0ced;}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_0x25e7d0 from'chalk';function formatRelativeTime(_0x3053f5){const _0x45a50f=a37_0x3d0c,_0x5a524c=new Date(_0x3053f5),_0x3b98a0=new Date(),_0x2e5dc4=_0x5a524c['getTime']()-_0x3b98a0['getTime'](),_0x1b4716=Math[_0x45a50f(0x256)](_0x2e5dc4)/0x3e8,_0x5cc823=_0x2e5dc4<0x0;if(_0x1b4716<0x3c)return _0x5cc823?_0x45a50f(0x255):_0x45a50f(0x240);else{if(_0x1b4716<0xe10){const _0x22e301=Math[_0x45a50f(0x254)](_0x1b4716/0x3c);return _0x5cc823?_0x22e301+_0x45a50f(0x227):_0x45a50f(0x1df)+_0x22e301+'m';}else{if(_0x1b4716<0x15180){const _0x22856a=Math[_0x45a50f(0x254)](_0x1b4716/0xe10);return _0x5cc823?_0x22856a+_0x45a50f(0x207):_0x45a50f(0x1df)+_0x22856a+'h';}else{if(_0x1b4716<0x93a80){const _0x1f41e4=Math[_0x45a50f(0x254)](_0x1b4716/0x15180);return _0x5cc823?_0x1f41e4+_0x45a50f(0x203):_0x45a50f(0x1df)+_0x1f41e4+'d';}else return _0x5a524c[_0x45a50f(0x226)]();}}}}export class ScheduleListCommand extends BaseCommand{['name']=a37_0x3a4fc6(0x200);[a37_0x3a4fc6(0x24a)]=a37_0x3a4fc6(0x1ec);async[a37_0x3a4fc6(0x1d3)](_0x3bd2ca){const _0x462e1e=a37_0x3a4fc6,{options:_0x2c39ac,args:_0x13ebd9,tdx:_0xfb32dd}=_0x3bd2ca,_0x1e03c4=resolveLimit(_0x2c39ac[_0x462e1e(0x252)],DEFAULT_DISPLAY_LIMIT),_0x451228=_0x13ebd9[0x0],_0x471db3=_0x451228?_0x462e1e(0x230)+_0x451228+_0x462e1e(0x23c):'Listing\x20scheduled\x20queries...',_0x13d677=await withSpinner(_0x471db3,()=>_0xfb32dd['schedules'][_0x462e1e(0x231)]({'limit':_0x1e03c4,'scheduled':!![],'pattern':_0x451228}),{'verbose':_0x2c39ac[_0x462e1e(0x215)]}),_0x359fc2=_0x13d677['data'][_0x462e1e(0x24c)],_0x485caa=_0x13d677['data'][_0x462e1e(0x22f)][_0x462e1e(0x1f7)],_0x37065e=_0x451228?_0x462e1e(0x23b)+_0x451228+'\x22':'';_0x485caa?console[_0x462e1e(0x23f)](_0x462e1e(0x234)+_0x359fc2[_0x462e1e(0x214)]+_0x462e1e(0x1f4)+_0x37065e+_0x462e1e(0x202)):console[_0x462e1e(0x23f)]('Found\x20'+_0x359fc2[_0x462e1e(0x214)]+_0x462e1e(0x251)+(_0x359fc2['length']!==0x1?_0x462e1e(0x1f1):'y')+_0x37065e);if(_0x2c39ac[_0x462e1e(0x211)]===_0x462e1e(0x1ea)||_0x2c39ac[_0x462e1e(0x211)]===_0x462e1e(0x1db)||_0x2c39ac[_0x462e1e(0x211)]==='table'||_0x2c39ac[_0x462e1e(0x211)]===_0x462e1e(0x20c)){const _0x3a93ca=_0x359fc2[_0x462e1e(0x225)](_0x17110d=>({'id':_0x17110d['id'],'name':_0x17110d['name'],'cron':_0x17110d[_0x462e1e(0x23d)],'database':_0x17110d[_0x462e1e(0x25c)]?.[_0x462e1e(0x21b)],'type':_0x17110d[_0x462e1e(0x1f2)],'timezone':_0x17110d[_0x462e1e(0x1f8)],'user_name':_0x17110d[_0x462e1e(0x1d5)]?.[_0x462e1e(0x21b)],'updated_at':_0x17110d[_0x462e1e(0x1fd)],'next_run_at':_0x17110d[_0x462e1e(0x249)],'last_job_status':_0x17110d[_0x462e1e(0x247)]?.[_0x462e1e(0x1f0)]}));await handleSDKOutput(_0x3a93ca,_0x2c39ac);}else{if(_0x359fc2['length']===0x0)console[_0x462e1e(0x220)]('No\x20scheduled\x20queries\x20found');else{const _0x1b3b51=_0x2c39ac['site'],_0x2eeb3c=_0x359fc2['map'](_0x52d2b7=>{const _0x1ee715=_0x462e1e,_0x218a49=_0x52d2b7['last_job']?.[_0x1ee715(0x1f0)]?_0x52d2b7['last_job'][_0x1ee715(0x1f0)]===_0x1ee715(0x1f6)?'✓':'✗':'-',_0x4a226f=_0x52d2b7['last_job']?.[_0x1ee715(0x25d)]?formatRelativeTime(_0x52d2b7['last_job'][_0x1ee715(0x25d)]):_0x1ee715(0x21c),_0x299ab0=_0x52d2b7[_0x1ee715(0x249)]?formatRelativeTime(_0x52d2b7[_0x1ee715(0x249)]):'-',_0x5aba95=_0x52d2b7['cron']||'',_0x4dd82e=_0x52d2b7[_0x1ee715(0x21b)]||'(unnamed)',_0x4fb171=getConsoleUrl(_0x1b3b51,'/app/queries/editor?queryId='+_0x52d2b7['id']);return{'statusIcon':_0x218a49,'lastRun':_0x4a226f,'nextRun':_0x299ab0,'cron':_0x5aba95,'name':_0x4dd82e,'queryUrl':_0x4fb171,'status':_0x52d2b7[_0x1ee715(0x247)]?.[_0x1ee715(0x1f0)]};}),_0x468fa6=Math['max'](..._0x2eeb3c[_0x462e1e(0x225)](_0x28f0b3=>_0x28f0b3['lastRun'][_0x462e1e(0x214)])),_0x51b04b=Math[_0x462e1e(0x235)](..._0x2eeb3c['map'](_0x607015=>_0x607015[_0x462e1e(0x1fb)][_0x462e1e(0x214)])),_0x46f52c=Math[_0x462e1e(0x235)](..._0x2eeb3c['map'](_0x3c818f=>_0x3c818f[_0x462e1e(0x23d)][_0x462e1e(0x214)])),_0x23559d=_0x2eeb3c[_0x462e1e(0x225)](_0x365683=>{const _0x43ec54=_0x462e1e,_0x473ac8=_0x365683[_0x43ec54(0x1f0)]===_0x43ec54(0x1f6)?a37_0x25e7d0[_0x43ec54(0x236)](_0x365683['statusIcon']):_0x365683['status']===_0x43ec54(0x23f)?a37_0x25e7d0['red'](_0x365683['statusIcon']):a37_0x25e7d0[_0x43ec54(0x22a)](_0x365683[_0x43ec54(0x218)]),_0x4184c3=_0x365683['lastRun'][_0x43ec54(0x1d1)](_0x468fa6),_0x3b9cad=_0x365683[_0x43ec54(0x1fb)]['padEnd'](_0x51b04b),_0x4fe769=_0x365683['cron']?a37_0x25e7d0[_0x43ec54(0x250)](_0x365683['cron']['padEnd'](_0x46f52c)):'\x20'['repeat'](_0x46f52c),_0x3947d8=hyperlink(_0x365683['name'],_0x365683[_0x43ec54(0x1fc)]);return _0x43ec54(0x1f5)+_0x473ac8+'\x20'+_0x4184c3+_0x43ec54(0x24d)+_0x3b9cad+'\x20\x20'+_0x4fe769+'\x20\x20'+_0x3947d8;});await writeOutput(_0x23559d[_0x462e1e(0x232)]('\x0a'),_0x2c39ac[_0x462e1e(0x248)],_0x462e1e(0x1da));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a37_0x3a4fc6(0x21b)]=a37_0x3a4fc6(0x1ff);[a37_0x3a4fc6(0x24a)]=a37_0x3a4fc6(0x237);['validate'](_0x219eef){const _0x543232=a37_0x3a4fc6,_0xa0496a=_0x219eef[_0x543232(0x243)][0x0];if(!_0xa0496a)return _0x543232(0x1f9);return undefined;}async[a37_0x3a4fc6(0x1d3)](_0x481e93){const _0x5cc4d1=a37_0x3a4fc6,{options:_0x5c77d2,args:_0x3ae58b,tdx:_0x6445de}=_0x481e93,_0x53d63e=_0x3ae58b[0x0],_0x1fb25c=await withSpinner(_0x5cc4d1(0x219),()=>_0x6445de[_0x5cc4d1(0x1e3)][_0x5cc4d1(0x25a)](_0x53d63e),{'verbose':_0x5c77d2['verbose']}),_0x216c3f=_0x1fb25c[_0x5cc4d1(0x206)],_0x51e83a={'name':_0x216c3f[_0x5cc4d1(0x21b)],'cron':_0x216c3f[_0x5cc4d1(0x23d)],'database':_0x216c3f[_0x5cc4d1(0x25c)],'type':_0x216c3f[_0x5cc4d1(0x1f2)],'timezone':_0x216c3f['timezone'],'user_name':_0x216c3f[_0x5cc4d1(0x1eb)],'created_at':_0x216c3f['created_at'],'engine_version':_0x216c3f[_0x5cc4d1(0x1f3)],'executing_user_id':_0x216c3f['executing_user_id'],'query':_0x216c3f['query'],'delay':_0x216c3f[_0x5cc4d1(0x1e4)],'priority':_0x216c3f['priority'],'retry_limit':_0x216c3f[_0x5cc4d1(0x1d6)],..._0x216c3f[_0x5cc4d1(0x242)]&&{'result':_0x216c3f[_0x5cc4d1(0x242)]}};return await handleSingleObjectOutput(_0x51e83a,_0x5c77d2),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a37_0x3a4fc6(0x21b)]='schedule:create';['description']='Create\x20a\x20scheduled\x20query';[a37_0x3a4fc6(0x209)](_0x36e1c3){const _0xf5551f=a37_0x3a4fc6,_0x3450da=_0x36e1c3['args'][0x0];if(!_0x3450da)return _0xf5551f(0x1fa);const _0x51bd1e=_0x36e1c3[_0xf5551f(0x210)];if(!_0x51bd1e[_0xf5551f(0x25c)])return'Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';return undefined;}async[a37_0x3a4fc6(0x1d3)](_0x9f1b77){const _0x51511d=a37_0x3a4fc6,{options:_0x2e292b,args:_0x44af03,tdx:_0x53a3db}=_0x9f1b77,_0x321c24=_0x44af03[0x0],_0x27e946=_0x2e292b,_0x3c94cc=_0x27e946[_0x51511d(0x25c)],_0x4b2bd7=_0x27e946['file'],_0x40aecf=_0x27e946[_0x51511d(0x1f2)]||_0x51511d(0x1e8);let _0x1b8f51;try{_0x1b8f51=readFileSync(_0x4b2bd7,_0x51511d(0x239))[_0x51511d(0x1e7)]();}catch(_0x127b3e){throw new SDKError(ErrorCode[_0x51511d(0x238)],_0x51511d(0x21e)+_0x4b2bd7,_0x127b3e instanceof Error?_0x127b3e:undefined);}if(!_0x1b8f51)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x51511d(0x221));const _0x5755e0={'database':_0x3c94cc,'query':_0x1b8f51,'type':_0x40aecf};if(_0x27e946[_0x51511d(0x23d)])_0x5755e0[_0x51511d(0x23d)]=_0x27e946[_0x51511d(0x23d)];if(_0x27e946['timezone'])_0x5755e0[_0x51511d(0x1ee)]=_0x27e946['timezone'];if(_0x27e946[_0x51511d(0x1e4)]!==undefined)_0x5755e0[_0x51511d(0x1e4)]=Number(_0x27e946[_0x51511d(0x1e4)]);if(_0x27e946[_0x51511d(0x22d)]!==undefined)_0x5755e0[_0x51511d(0x22d)]=Number(_0x27e946[_0x51511d(0x22d)]);if(_0x27e946[_0x51511d(0x1d4)]!==undefined)_0x5755e0['retry_limit']=Number(_0x27e946['retryLimit']);if(_0x27e946['engineVersion'])_0x5755e0['engine_version']=_0x27e946[_0x51511d(0x204)];if(_0x27e946['result'])_0x5755e0[_0x51511d(0x242)]=_0x27e946[_0x51511d(0x242)];if(_0x2e292b[_0x51511d(0x215)]){console[_0x51511d(0x23f)](_0x51511d(0x213)+_0x321c24),console[_0x51511d(0x23f)](_0x51511d(0x24f)+_0x3c94cc),console[_0x51511d(0x23f)](_0x51511d(0x1ef)+_0x40aecf);if(_0x5755e0[_0x51511d(0x23d)])console[_0x51511d(0x23f)](_0x51511d(0x253)+_0x5755e0[_0x51511d(0x23d)]);if(_0x5755e0['timezone'])console[_0x51511d(0x23f)](_0x51511d(0x246)+_0x5755e0[_0x51511d(0x1ee)]);}const _0x2eaa95=await withSpinner(_0x51511d(0x21d),()=>_0x53a3db[_0x51511d(0x1e3)][_0x51511d(0x20d)](_0x321c24,_0x5755e0),{'verbose':_0x2e292b[_0x51511d(0x215)]});return console[_0x51511d(0x23f)]('Schedule\x20created:\x20'+_0x2eaa95['data'][_0x51511d(0x21b)]),await handleSingleObjectOutput(_0x2eaa95[_0x51511d(0x206)],_0x2e292b),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a37_0x3a4fc6(0x21b)]='schedule:update';['description']='Update\x20a\x20scheduled\x20query';['validate'](_0x2e678b){const _0x20613c=a37_0x3a4fc6,_0x4e5501=_0x2e678b[_0x20613c(0x243)][0x0];if(!_0x4e5501)return _0x20613c(0x23a);return undefined;}async['execute'](_0x33a25b){const _0xf0bce4=a37_0x3a4fc6,{options:_0x134f01,args:_0x2d534f,tdx:_0x12b06c}=_0x33a25b,_0x29cea3=_0x2d534f[0x0],_0x5bdf90=_0x134f01,_0x130aeb={};if(_0x5bdf90[_0xf0bce4(0x25c)])_0x130aeb[_0xf0bce4(0x25c)]=_0x5bdf90['database'];if(_0x5bdf90[_0xf0bce4(0x1f2)])_0x130aeb[_0xf0bce4(0x1f2)]=_0x5bdf90[_0xf0bce4(0x1f2)];if(_0x5bdf90[_0xf0bce4(0x23d)])_0x130aeb['cron']=_0x5bdf90['cron'];if(_0x5bdf90['timezone'])_0x130aeb[_0xf0bce4(0x1ee)]=_0x5bdf90[_0xf0bce4(0x1ee)];if(_0x5bdf90[_0xf0bce4(0x1e4)]!==undefined)_0x130aeb[_0xf0bce4(0x1e4)]=Number(_0x5bdf90[_0xf0bce4(0x1e4)]);if(_0x5bdf90[_0xf0bce4(0x22d)]!==undefined)_0x130aeb[_0xf0bce4(0x22d)]=Number(_0x5bdf90['priority']);if(_0x5bdf90[_0xf0bce4(0x1d4)]!==undefined)_0x130aeb[_0xf0bce4(0x1d6)]=Number(_0x5bdf90[_0xf0bce4(0x1d4)]);if(_0x5bdf90[_0xf0bce4(0x204)])_0x130aeb[_0xf0bce4(0x1f3)]=_0x5bdf90['engineVersion'];if(_0x5bdf90[_0xf0bce4(0x242)])_0x130aeb[_0xf0bce4(0x242)]=_0x5bdf90[_0xf0bce4(0x242)];if(_0x5bdf90[_0xf0bce4(0x1e0)])try{_0x130aeb[_0xf0bce4(0x257)]=readFileSync(_0x5bdf90[_0xf0bce4(0x1e0)],_0xf0bce4(0x239))[_0xf0bce4(0x1e7)]();}catch(_0x5c2d0c){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0xf0bce4(0x21e)+_0x5bdf90[_0xf0bce4(0x1e0)],_0x5c2d0c instanceof Error?_0x5c2d0c:undefined);}if(Object['keys'](_0x130aeb)[_0xf0bce4(0x214)]===0x0)throw new SDKError(ErrorCode[_0xf0bce4(0x238)],_0xf0bce4(0x22e));if(_0x134f01[_0xf0bce4(0x215)]){console[_0xf0bce4(0x23f)]('Updating\x20schedule:\x20'+_0x29cea3);for(const [_0x34942d,_0x188620]of Object[_0xf0bce4(0x20e)](_0x130aeb)){_0x34942d===_0xf0bce4(0x257)?console[_0xf0bce4(0x23f)]('\x20\x20'+_0x34942d+':\x20'+_0x188620[_0xf0bce4(0x233)](0x0,0x32)+'...'):console[_0xf0bce4(0x23f)]('\x20\x20'+_0x34942d+':\x20'+_0x188620);}}const _0x57b46e=await withSpinner('Updating\x20schedule...',()=>_0x12b06c[_0xf0bce4(0x1e3)][_0xf0bce4(0x21f)](_0x29cea3,_0x130aeb),{'verbose':_0x134f01[_0xf0bce4(0x215)]});return console[_0xf0bce4(0x23f)](_0xf0bce4(0x20b)+_0x57b46e[_0xf0bce4(0x206)][_0xf0bce4(0x21b)]),await handleSingleObjectOutput(_0x57b46e[_0xf0bce4(0x206)],_0x134f01),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{['name']=a37_0x3a4fc6(0x1e1);[a37_0x3a4fc6(0x24a)]='Delete\x20a\x20scheduled\x20query';[a37_0x3a4fc6(0x209)](_0x1850ec){const _0x58107c=a37_0x3a4fc6,_0x42a968=_0x1850ec['args'][0x0];if(!_0x42a968)return _0x58107c(0x1e5);return undefined;}async[a37_0x3a4fc6(0x1d3)](_0x4c5fe1){const _0x1ea9d6=a37_0x3a4fc6,{options:_0x3d96b7,args:_0x20e697,tdx:_0x134bdc}=_0x4c5fe1,_0x24d52a=_0x20e697[0x0];if(!_0x3d96b7[_0x1ea9d6(0x20f)]){const _0x411b8a=await confirm(_0x1ea9d6(0x25b)+_0x24d52a+'\x22?');if(!_0x411b8a)return console[_0x1ea9d6(0x23f)]('Cancelled'),0x0;}const _0x49093f=await withSpinner(_0x1ea9d6(0x205),()=>_0x134bdc[_0x1ea9d6(0x1e3)][_0x1ea9d6(0x23e)](_0x24d52a),{'verbose':_0x3d96b7[_0x1ea9d6(0x215)]});return console[_0x1ea9d6(0x23f)]('Schedule\x20deleted:\x20'+_0x49093f[_0x1ea9d6(0x206)]['name']),0x0;}}function a37_0x2db9(){const _0x2493a2=['\x20schedules','📅\x20','success','has_next_page','time_zone','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','nextRun','queryUrl','updated_at','num','schedule:show','schedule:list','from','\x20(use\x20--limit\x20to\x20see\x20more)','d\x20ago','engineVersion','Deleting\x20schedule...','data','h\x20ago','\x20job','validate','jobs','Schedule\x20updated:\x20','tsv','create','entries','yes','options','format','335752dxmsKT','Creating\x20schedule:\x20','length','verbose','Getting\x20schedule\x20history...','run','statusIcon','Getting\x20schedule\x20details...','1186885XCUeJP','name','never','Creating\x20schedule...','Failed\x20to\x20read\x20file:\x20','update','log','Query\x20file\x20is\x20empty','Found\x20','20wyyEVr','743490AdwEbF','map','toLocaleDateString','m\x20ago','67764mAdZsr','8xHmlmI','dim','schedule:run','Run\x20a\x20scheduled\x20query\x20immediately','priority','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','pagination','Searching\x20scheduled\x20queries\x20matching\x20\x22','listQueries','join','substring','Showing\x20first\x20','max','green','Show\x20schedule\x20details','INVALID_ARGUMENT','utf-8','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','\x20matching\x20\x22','\x22...','cron','delete','error','soon','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','result','args','\x20(showing\x20','\x20created','\x20\x20Timezone:\x20','last_job','output','next_run_at','description','Running\x20schedule...','queries','\x20\x20→\x20','history','\x20\x20Database:\x20','cyan','\x20scheduled\x20quer','limit','\x20\x20Cron:\x20','round','just\x20now','abs','query','end_at','job_id','show','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','database','ended_at','padEnd','time','execute','retryLimit','user','retry_limit','scheduled_at','76490fdTpCP','226161JXXSrl','list','jsonl','Show\x20schedule\x20execution\x20history','count','schedule:history','in\x20','file','schedule:delete','369284Xxylmz','schedules','delay','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','Running\x20schedule:\x20','trim','trino','66WjSQlZ','json','user_name','List\x20scheduled\x20queries','6WlihDh','timezone','\x20\x20Type:\x20','status','ies','type','engine_version'];a37_0x2db9=function(){return _0x2493a2;};return a37_0x2db9();}export class ScheduleRunCommand extends BaseCommand{[a37_0x3a4fc6(0x21b)]=a37_0x3a4fc6(0x22b);[a37_0x3a4fc6(0x24a)]=a37_0x3a4fc6(0x22c);[a37_0x3a4fc6(0x209)](_0xa9eb98){const _0x1a5835=a37_0x3a4fc6,_0x54a354=_0xa9eb98[_0x1a5835(0x243)][0x0];if(!_0x54a354)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async[a37_0x3a4fc6(0x1d3)](_0x5578b2){const _0x4513e9=a37_0x3a4fc6,{options:_0x594e72,args:_0x27584f,tdx:_0x4df187}=_0x5578b2,_0x294e42=_0x27584f[0x0],_0x216cfd=_0x594e72,_0x382ab8=_0x216cfd[_0x4513e9(0x1d2)],_0x4d7964=_0x216cfd['num']!==undefined?Number(_0x216cfd[_0x4513e9(0x1fe)]):undefined;if(_0x594e72[_0x4513e9(0x215)]){console[_0x4513e9(0x23f)](_0x4513e9(0x1e6)+_0x294e42);if(_0x382ab8)console['error']('\x20\x20Time:\x20'+_0x382ab8);if(_0x4d7964)console[_0x4513e9(0x23f)]('\x20\x20Num:\x20'+_0x4d7964);}const _0x3692db=await withSpinner(_0x4513e9(0x24b),()=>_0x4df187['schedules'][_0x4513e9(0x217)](_0x294e42,{'time':_0x382ab8,'num':_0x4d7964}),{'verbose':_0x594e72['verbose']}),_0x388d43=_0x3692db[_0x4513e9(0x206)][_0x4513e9(0x20a)];console['error']('Schedule\x20run\x20submitted:\x20'+_0x388d43[_0x4513e9(0x214)]+_0x4513e9(0x208)+(_0x388d43[_0x4513e9(0x214)]!==0x1?'s':'')+_0x4513e9(0x245));for(const _0x577a7e of _0x388d43){console['error']('\x20\x20Job\x20ID:\x20'+_0x577a7e[_0x4513e9(0x259)]);}return await handleSDKOutput(_0x388d43,_0x594e72),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a37_0x3a4fc6(0x21b)]=a37_0x3a4fc6(0x1de);[a37_0x3a4fc6(0x24a)]=a37_0x3a4fc6(0x1dc);[a37_0x3a4fc6(0x209)](_0x8c4781){const _0x8bb98f=a37_0x3a4fc6,_0x508345=_0x8c4781[_0x8bb98f(0x243)][0x0];if(!_0x508345)return _0x8bb98f(0x241);return undefined;}async[a37_0x3a4fc6(0x1d3)](_0x26ce01){const _0x5648d4=a37_0x3a4fc6,{options:_0x5ce03a,args:_0x4df53a,tdx:_0x1b0ac2}=_0x26ce01,_0x5dd6c8=_0x4df53a[0x0],_0x55d5f3=_0x5ce03a,_0x4646f8=_0x55d5f3[_0x5648d4(0x201)]!==undefined?Number(_0x55d5f3[_0x5648d4(0x201)]):undefined,_0x152a23=_0x55d5f3['to']!==undefined?Number(_0x55d5f3['to']):undefined,_0x2b616b=await withSpinner(_0x5648d4(0x216),()=>_0x1b0ac2[_0x5648d4(0x1e3)][_0x5648d4(0x24e)](_0x5dd6c8,{'from':_0x4646f8,'to':_0x152a23}),{'verbose':_0x5ce03a[_0x5648d4(0x215)]}),_0x4433c1=_0x2b616b[_0x5648d4(0x206)];console[_0x5648d4(0x23f)](_0x5648d4(0x222)+_0x4433c1[_0x5648d4(0x1dd)]+'\x20execution'+(_0x4433c1[_0x5648d4(0x1dd)]!==0x1?'s':'')+_0x5648d4(0x244)+_0x4433c1['from']+'-'+_0x4433c1['to']+')');const _0x38c1af=_0x4433c1[_0x5648d4(0x24e)][_0x5648d4(0x225)](_0x488bfb=>({'job_id':_0x488bfb[_0x5648d4(0x259)],'type':_0x488bfb[_0x5648d4(0x1f2)],'status':_0x488bfb[_0x5648d4(0x1f0)],'scheduled_at':_0x488bfb[_0x5648d4(0x1d7)],'created_at':_0x488bfb['created_at'],'start_at':_0x488bfb['start_at'],'end_at':_0x488bfb[_0x5648d4(0x258)]}));return await handleSDKOutput(_0x38c1af,_0x5ce03a),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_0x177d32=a38_0x4de3;function a38_0x4de3(_0x34ee96,_0x350476){_0x34ee96=_0x34ee96-0x1eb;const _0x3e2946=a38_0x3e29();let _0x4de365=_0x3e2946[_0x34ee96];return _0x4de365;}(function(_0x1e8361,_0x32055b){const _0x2ecaec=a38_0x4de3,_0x3baa06=_0x1e8361();while(!![]){try{const _0x2671fb=parseInt(_0x2ecaec(0x210))/0x1*(-parseInt(_0x2ecaec(0x27d))/0x2)+-parseInt(_0x2ecaec(0x211))/0x3*(parseInt(_0x2ecaec(0x24a))/0x4)+-parseInt(_0x2ecaec(0x24d))/0x5*(-parseInt(_0x2ecaec(0x1f4))/0x6)+-parseInt(_0x2ecaec(0x22c))/0x7+-parseInt(_0x2ecaec(0x24c))/0x8+-parseInt(_0x2ecaec(0x281))/0x9+parseInt(_0x2ecaec(0x235))/0xa;if(_0x2671fb===_0x32055b)break;else _0x3baa06['push'](_0x3baa06['shift']());}catch(_0x51c977){_0x3baa06['push'](_0x3baa06['shift']());}}}(a38_0x3e29,0xb21a4));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a38_0x31978e from'chalk';async function resolveSegmentTarget(_0x4c5794,_0x33336a,_0x441e11){const _0x2a8a45=a38_0x4de3;if(isYamlFilePath(_0x4c5794))try{const _0xf6c6d2=await resolveYamlFilePath(_0x4c5794);return _0x441e11&&(console[_0x2a8a45(0x240)](_0x2a8a45(0x25b)+_0x4c5794),console[_0x2a8a45(0x240)](_0x2a8a45(0x238)+_0xf6c6d2['parentSegment']),console['error'](_0x2a8a45(0x257)+_0xf6c6d2[_0x2a8a45(0x236)]),console['error'](_0x2a8a45(0x284)+(_0xf6c6d2[_0x2a8a45(0x1f2)]||_0x2a8a45(0x228))),console[_0x2a8a45(0x240)](_0x2a8a45(0x27e)+_0xf6c6d2['fullPath'])),_0xf6c6d2['fullPath'];}catch(_0x448a20){throw new SDKError(ErrorCode[_0x2a8a45(0x259)],_0x2a8a45(0x216)+_0x448a20['message']);}if(!_0x33336a)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x33336a+'/'+_0x4c5794;}export class SegmentDescribeCommand extends BaseCommand{['name']=a38_0x177d32(0x21e);[a38_0x177d32(0x273)]='Show\x20segment\x20or\x20folder\x20details';async[a38_0x177d32(0x27b)](_0x54f3e8){const _0xb5fc6a=a38_0x177d32,{options:_0x165aaf,args:_0x211c5c,tdx:_0x31f44f}=_0x54f3e8,_0x46d60e=_0x211c5c[0x0],_0xb9b911=!_0x46d60e&&!!_0x165aaf[_0xb5fc6a(0x202)],_0x2314c1=_0x46d60e||_0x165aaf['parentSegment'];if(!_0x2314c1)return console[_0xb5fc6a(0x240)](_0xb5fc6a(0x206)),console[_0xb5fc6a(0x240)](_0xb5fc6a(0x27f)),console[_0xb5fc6a(0x240)]('Examples:'),console[_0xb5fc6a(0x240)](_0xb5fc6a(0x220)),console[_0xb5fc6a(0x240)](_0xb5fc6a(0x251)),console[_0xb5fc6a(0x240)](_0xb5fc6a(0x268)),console[_0xb5fc6a(0x240)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0x2f9396=_0x165aaf['segmentPath'];let _0x3bb381=_0x2314c1;!_0xb9b911&&_0x2f9396&&!_0x2314c1[_0xb5fc6a(0x28b)]('/')&&(_0x3bb381=_0x2f9396+'/'+_0x2314c1,_0x165aaf[_0xb5fc6a(0x263)]&&console[_0xb5fc6a(0x240)](_0xb5fc6a(0x269)+_0x3bb381));const _0x20203b=await withSpinner(_0xb5fc6a(0x25d)+_0x3bb381+_0xb5fc6a(0x248),()=>_0x31f44f[_0xb5fc6a(0x253)][_0xb5fc6a(0x20f)](_0x3bb381),{'verbose':_0x165aaf[_0xb5fc6a(0x263)]}),_0x4ce4ed=_0x20203b[_0xb5fc6a(0x1ee)];_0x165aaf[_0xb5fc6a(0x263)]&&(console['error'](_0xb5fc6a(0x200)+_0x4ce4ed['type']),console[_0xb5fc6a(0x240)](_0xb5fc6a(0x227)+_0x4ce4ed['parentId']),_0x4ce4ed['folderId']&&console[_0xb5fc6a(0x240)]('Folder\x20ID:\x20'+_0x4ce4ed[_0xb5fc6a(0x28a)]),_0x4ce4ed[_0xb5fc6a(0x267)]&&console[_0xb5fc6a(0x240)](_0xb5fc6a(0x266)+_0x4ce4ed[_0xb5fc6a(0x267)]));if(_0x4ce4ed[_0xb5fc6a(0x260)]===_0xb5fc6a(0x234)){const _0x46f357=await withSpinner(_0xb5fc6a(0x26b),()=>_0x31f44f[_0xb5fc6a(0x253)][_0xb5fc6a(0x26c)](_0x4ce4ed[_0xb5fc6a(0x286)]),{'verbose':_0x165aaf['verbose']});await handleSingleObjectOutput(_0x46f357[_0xb5fc6a(0x1ee)],_0x165aaf);}else{if(_0x4ce4ed[_0xb5fc6a(0x260)]===_0xb5fc6a(0x265)){if(!_0x4ce4ed[_0xb5fc6a(0x28a)])throw new SDKError(ErrorCode[_0xb5fc6a(0x1eb)],_0xb5fc6a(0x1f3));const _0x122b14=await withSpinner(_0xb5fc6a(0x23c),()=>_0x31f44f[_0xb5fc6a(0x253)][_0xb5fc6a(0x264)](_0x4ce4ed[_0xb5fc6a(0x28a)]),{'verbose':_0x165aaf[_0xb5fc6a(0x263)]});await handleSingleObjectOutput(_0x122b14[_0xb5fc6a(0x1ee)],_0x165aaf);}else{if(_0x4ce4ed[_0xb5fc6a(0x260)]===_0xb5fc6a(0x253)){if(!_0x4ce4ed[_0xb5fc6a(0x267)])throw new SDKError(ErrorCode[_0xb5fc6a(0x1f7)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x131b8a=await withSpinner('Fetching\x20segment\x20details...',()=>_0x31f44f[_0xb5fc6a(0x253)]['getSegment'](_0x4ce4ed[_0xb5fc6a(0x286)],_0x4ce4ed[_0xb5fc6a(0x267)]),{'verbose':_0x165aaf[_0xb5fc6a(0x263)]});await handleSingleObjectOutput(_0x131b8a[_0xb5fc6a(0x1ee)],_0x165aaf);}}}return 0x0;}catch(_0x230f1e){if(_0x230f1e instanceof SDKError)return console[_0xb5fc6a(0x240)]('Error:\x20'+_0x230f1e[_0xb5fc6a(0x23a)]),_0x230f1e[_0xb5fc6a(0x270)]&&console[_0xb5fc6a(0x240)]('\x20\x20Cause:\x20'+_0x230f1e[_0xb5fc6a(0x270)]),0x1;throw _0x230f1e;}}}export class SegmentShowCommand extends BaseCommand{['name']='segment:show';[a38_0x177d32(0x273)]=a38_0x177d32(0x1fc);async[a38_0x177d32(0x27b)](_0xd4fde3){const _0x4000b8=a38_0x177d32,{options:_0x21748b,args:_0x24f530,tdx:_0x279c70}=_0xd4fde3,_0x3595ba=_0x24f530[0x0];if(!_0x3595ba)return console['error'](_0x4000b8(0x204)),console[_0x4000b8(0x240)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console[_0x4000b8(0x240)](_0x4000b8(0x249)),console[_0x4000b8(0x240)]('Examples:'),console[_0x4000b8(0x240)](_0x4000b8(0x292)),console['error'](_0x4000b8(0x209)),0x1;try{const _0x322e85=_0x21748b[_0x4000b8(0x202)],_0x3696fe=await resolveSegmentTarget(_0x3595ba,_0x322e85,_0x21748b['verbose']);_0x21748b[_0x4000b8(0x263)]&&console[_0x4000b8(0x240)](_0x4000b8(0x24b)+_0x3696fe);const _0x54ed68=await withSpinner(_0x4000b8(0x217)+_0x3595ba+_0x4000b8(0x248),()=>_0x279c70['segment'][_0x4000b8(0x20f)](_0x3696fe),{'verbose':_0x21748b['verbose']}),_0x5a274a=_0x54ed68[_0x4000b8(0x1ee)];_0x21748b[_0x4000b8(0x263)]&&(console[_0x4000b8(0x240)](_0x4000b8(0x200)+_0x5a274a[_0x4000b8(0x260)]),console[_0x4000b8(0x240)](_0x4000b8(0x227)+_0x5a274a['parentId']));if(_0x5a274a['type']===_0x4000b8(0x265))return console['error'](_0x4000b8(0x28d)),console[_0x4000b8(0x240)](_0x4000b8(0x293)),0x1;if(_0x5a274a[_0x4000b8(0x260)]===_0x4000b8(0x234))return console[_0x4000b8(0x240)](_0x4000b8(0x1fb)),console[_0x4000b8(0x240)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x5a274a[_0x4000b8(0x267)])throw new SDKError(ErrorCode[_0x4000b8(0x1f7)],_0x4000b8(0x254));const _0x564cae=await withSpinner(_0x4000b8(0x1ec),()=>_0x279c70[_0x4000b8(0x253)][_0x4000b8(0x20b)](_0x5a274a[_0x4000b8(0x286)],_0x5a274a[_0x4000b8(0x267)]),{'verbose':_0x21748b[_0x4000b8(0x263)]});let _0x3cb833=_0x564cae['data'];const _0x17f829=resolveLimit(_0x21748b[_0x4000b8(0x1ed)],DEFAULT_DISPLAY_LIMIT),_0xcab949=/\bLIMIT\s+\d+/i['test'](_0x3cb833);!_0xcab949&&(_0x3cb833=_0x3cb833[_0x4000b8(0x201)]()[_0x4000b8(0x25e)](/;+$/,''),_0x3cb833='SELECT\x20*\x20FROM\x20(\x0a'+_0x3cb833+_0x4000b8(0x226)+_0x17f829);_0x21748b[_0x4000b8(0x263)]&&console[_0x4000b8(0x240)]('SQL\x20query:\x0a'+_0x3cb833);const _0x5f2dcd=await withProgressSpinner(_0x4000b8(0x26d),async _0x1d3bf2=>{const _0x506503=_0x4000b8,_0x3c6a7f=await _0x279c70[_0x506503(0x289)][_0x506503(0x27b)](_0x3cb833,{'catalog':'td','schema':_0x506503(0x21f),'onJobId':_0x3548f1=>{const _0x91b872=_0x506503;_0x1d3bf2[_0x91b872(0x275)](_0x3548f1);}});return _0x3c6a7f;},{'verbose':_0x21748b[_0x4000b8(0x263)]}),_0x431983=_0x5f2dcd[_0x4000b8(0x1ee)],_0x5e4336=_0x431983[_0x4000b8(0x22f)]?_0x4000b8(0x205)+_0x431983[_0x4000b8(0x22f)]+']':'';return console[_0x4000b8(0x240)](_0x4000b8(0x27c)+_0x431983[_0x4000b8(0x22d)][_0x4000b8(0x1f8)][_0x4000b8(0x287)]()+_0x4000b8(0x221)+(_0x4000b8(0x277)+formatElapsed(_0x431983['stats']['elapsedTimeMillis'])+_0x5e4336)),await handleQueryOutput(_0x431983,_0x21748b),0x0;}catch(_0x9db1aa){if(_0x9db1aa instanceof SDKError)return console[_0x4000b8(0x240)](_0x4000b8(0x203)+_0x9db1aa[_0x4000b8(0x272)]+']'),console['error']('\x0a'+_0x9db1aa[_0x4000b8(0x23a)]),0x1;throw _0x9db1aa;}}}export class SegmentFolderListCommand extends BaseCommand{[a38_0x177d32(0x1fa)]=a38_0x177d32(0x21b);[a38_0x177d32(0x273)]=a38_0x177d32(0x24e);async['execute'](_0x275d90){const _0x16204c=a38_0x177d32,{options:_0x2b2a0a,args:_0x259699,tdx:_0x469382}=_0x275d90;if(_0x259699[_0x16204c(0x262)]===0x0)return console[_0x16204c(0x240)](_0x16204c(0x243)),console['error'](_0x16204c(0x21c)),0x1;const _0x5e0c41=_0x259699[0x0];try{_0x2b2a0a[_0x16204c(0x263)]&&(console[_0x16204c(0x240)](_0x16204c(0x231)+_0x2b2a0a[_0x16204c(0x1f5)]),console[_0x16204c(0x240)](_0x16204c(0x229)+_0x5e0c41));const _0x37de94=await withSpinner(_0x16204c(0x208)+_0x5e0c41+'\x27...',()=>_0x469382[_0x16204c(0x253)][_0x16204c(0x25c)](_0x5e0c41),{'verbose':_0x2b2a0a[_0x16204c(0x263)]}),_0x57f561=_0x37de94[_0x16204c(0x1ee)];_0x2b2a0a[_0x16204c(0x263)]&&console[_0x16204c(0x240)](_0x16204c(0x212)+_0x57f561);const _0x4df916=await withSpinner(_0x16204c(0x258)+_0x5e0c41+_0x16204c(0x248),()=>_0x469382['segment'][_0x16204c(0x207)](_0x57f561),{'verbose':_0x2b2a0a[_0x16204c(0x263)]}),_0x2b321d=_0x4df916[_0x16204c(0x1ee)];return console[_0x16204c(0x240)](_0x16204c(0x1f1)+_0x2b321d[_0x16204c(0x262)]+_0x16204c(0x237)+(_0x2b321d[_0x16204c(0x262)]!==0x1?'s':'')),await handleSDKOutput(_0x2b321d,_0x2b2a0a),0x0;}catch(_0x5bf462){if(_0x5bf462 instanceof SDKError)return console[_0x16204c(0x240)]('Error:\x20'+_0x5bf462['message']),_0x5bf462[_0x16204c(0x270)]&&console[_0x16204c(0x240)]('\x20\x20Cause:\x20'+_0x5bf462['cause']),0x1;throw _0x5bf462;}}}export class SegmentFolderShowCommand extends BaseCommand{[a38_0x177d32(0x1fa)]='segment:folder:show';['description']='Show\x20segment\x20folder\x20details';async[a38_0x177d32(0x27b)](_0x3645cb){const _0x1379cb=a38_0x177d32,{options:_0x485dbb,args:_0x343561,tdx:_0x5e314e}=_0x3645cb;if(_0x343561[_0x1379cb(0x262)]===0x0)return console[_0x1379cb(0x240)](_0x1379cb(0x247)),console['error'](_0x1379cb(0x296)),0x1;try{const {parentId:_0x405c11,childId:_0x26c34a}=parseSegmentRef(_0x343561[0x0]);_0x485dbb[_0x1379cb(0x263)]&&(console[_0x1379cb(0x240)](_0x1379cb(0x231)+_0x485dbb[_0x1379cb(0x1f5)]),console[_0x1379cb(0x240)]('Parent\x20name:\x20'+_0x405c11),_0x26c34a&&console[_0x1379cb(0x240)](_0x1379cb(0x21a)+_0x26c34a));if(!_0x26c34a)return console[_0x1379cb(0x240)](_0x1379cb(0x245)),0x1;const _0x47f6d0=await withSpinner(_0x1379cb(0x208)+_0x405c11+_0x1379cb(0x248),()=>_0x5e314e[_0x1379cb(0x253)][_0x1379cb(0x25c)](_0x405c11),{'verbose':_0x485dbb['verbose']}),_0x3b7f21=_0x47f6d0[_0x1379cb(0x1ee)];_0x485dbb[_0x1379cb(0x263)]&&console[_0x1379cb(0x240)](_0x1379cb(0x212)+_0x3b7f21);const _0x3d92eb=await withSpinner(_0x1379cb(0x23e)+_0x26c34a+_0x1379cb(0x248),()=>_0x5e314e[_0x1379cb(0x253)][_0x1379cb(0x297)](_0x3b7f21,_0x26c34a),{'verbose':_0x485dbb[_0x1379cb(0x263)]}),_0x1de3ff=_0x3d92eb['data'];_0x485dbb[_0x1379cb(0x263)]&&console[_0x1379cb(0x240)](_0x1379cb(0x261)+_0x1de3ff);const _0x2c0eb2=await withSpinner('Fetching\x20folder\x20\x27'+_0x26c34a+_0x1379cb(0x248),()=>_0x5e314e[_0x1379cb(0x253)][_0x1379cb(0x264)](_0x1de3ff),{'verbose':_0x485dbb[_0x1379cb(0x263)]});return await handleSDKOutput([_0x2c0eb2[_0x1379cb(0x1ee)]],_0x485dbb),0x0;}catch(_0x42b979){if(_0x42b979 instanceof SDKError)return console[_0x1379cb(0x240)](_0x1379cb(0x214)+_0x42b979[_0x1379cb(0x23a)]),_0x42b979[_0x1379cb(0x270)]&&console['error'](_0x1379cb(0x28e)+_0x42b979[_0x1379cb(0x270)]),0x1;throw _0x42b979;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a38_0x177d32(0x28c);['description']='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a38_0x177d32(0x27b)](_0x3eef66){const _0x3fd675=a38_0x177d32,{options:_0x279a2d,args:_0x3c37d4}=_0x3eef66,_0x26f89a=_0x279a2d,_0x22fee1=_0x26f89a[_0x3fd675(0x21d)],_0x548d78=_0x3c37d4[0x0];if(!_0x548d78&&!_0x22fee1)return console['error'](a38_0x31978e[_0x3fd675(0x23b)](_0x3fd675(0x225))),console['error'](_0x3fd675(0x20c)),console[_0x3fd675(0x240)](_0x3fd675(0x256)),console[_0x3fd675(0x240)](_0x3fd675(0x219)),console[_0x3fd675(0x240)](_0x3fd675(0x288)),console[_0x3fd675(0x240)](_0x3fd675(0x25a)),console[_0x3fd675(0x240)](_0x3fd675(0x22a)),0x1;if(_0x548d78&&_0x22fee1)return console[_0x3fd675(0x240)](a38_0x31978e[_0x3fd675(0x23b)](_0x3fd675(0x283))),0x1;try{let _0x36f428;if(_0x22fee1)_0x36f428=await this[_0x3fd675(0x271)](_0x22fee1,_0x3eef66);else{if(isYamlFilePath(_0x548d78))return console[_0x3fd675(0x240)](a38_0x31978e['red'](_0x3fd675(0x1ef))),console[_0x3fd675(0x240)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20'+_0x548d78),0x1;else _0x36f428=await this[_0x3fd675(0x20d)](_0x548d78,_0x3eef66);}return _0x279a2d['format']===_0x3fd675(0x1f0)||_0x279a2d[_0x3fd675(0x280)]===_0x3fd675(0x24f)?await handleSDKOutput([{'sql':_0x36f428}],_0x279a2d):console[_0x3fd675(0x244)](_0x36f428),0x0;}catch(_0x3ff6e5){if(_0x3ff6e5 instanceof SDKError)return console[_0x3fd675(0x240)](_0x3fd675(0x214)+_0x3ff6e5[_0x3fd675(0x23a)]),_0x3ff6e5[_0x3fd675(0x270)]&&console[_0x3fd675(0x240)](_0x3fd675(0x28e)+_0x3ff6e5[_0x3fd675(0x270)]),0x1;throw _0x3ff6e5;}}async[a38_0x177d32(0x271)](_0x55e136,_0x22b471){const _0x3cea68=a38_0x177d32,{options:_0x545944,tdx:_0x3d3e7d}=_0x22b471;let _0x50230d;try{_0x50230d=await resolveYamlFilePath(_0x55e136);}catch(_0xcb9060){throw new SDKError(ErrorCode[_0x3cea68(0x259)],_0x3cea68(0x216)+_0xcb9060[_0x3cea68(0x23a)]);}_0x545944['verbose']&&console['error'](_0x3cea68(0x246)+_0x50230d[_0x3cea68(0x202)]+'/'+_0x50230d[_0x3cea68(0x236)]);const _0x34b244=await withSpinner(_0x3cea68(0x242),()=>_0x3d3e7d['segment'][_0x3cea68(0x1f6)](_0x50230d[_0x3cea68(0x294)],_0x50230d[_0x3cea68(0x202)],_0x50230d[_0x3cea68(0x236)]),{'verbose':_0x545944[_0x3cea68(0x263)]});return _0x34b244[_0x3cea68(0x1ee)];}async[a38_0x177d32(0x20d)](_0x50ebfb,_0x328e33){const _0x355ff5=a38_0x177d32,{options:_0x2979b2,tdx:_0x4c2f7a}=_0x328e33,_0x26f3c4=_0x2979b2['parentSegment'],_0x5f332c=await resolveSegmentTarget(_0x50ebfb,_0x26f3c4,_0x2979b2[_0x355ff5(0x263)]);_0x2979b2[_0x355ff5(0x263)]&&console[_0x355ff5(0x240)](_0x355ff5(0x24b)+_0x5f332c);const _0x17f120=await withSpinner('Resolving\x20\x27'+_0x50ebfb+_0x355ff5(0x248),()=>_0x4c2f7a[_0x355ff5(0x253)][_0x355ff5(0x20f)](_0x5f332c),{'verbose':_0x2979b2[_0x355ff5(0x263)]}),_0x270f71=_0x17f120[_0x355ff5(0x1ee)];_0x2979b2[_0x355ff5(0x263)]&&(console[_0x355ff5(0x240)](_0x355ff5(0x200)+_0x270f71[_0x355ff5(0x260)]),console[_0x355ff5(0x240)](_0x355ff5(0x227)+_0x270f71[_0x355ff5(0x286)]));if(_0x270f71[_0x355ff5(0x260)]==='folder')throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x355ff5(0x215));if(_0x270f71[_0x355ff5(0x260)]===_0x355ff5(0x234))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x355ff5(0x28f));if(!_0x270f71[_0x355ff5(0x267)])throw new SDKError(ErrorCode[_0x355ff5(0x1f7)],_0x355ff5(0x254));const _0x439837=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x4c2f7a[_0x355ff5(0x253)]['getSegmentSQL'](_0x270f71[_0x355ff5(0x286)],_0x270f71[_0x355ff5(0x267)]),{'verbose':_0x2979b2[_0x355ff5(0x263)]});return _0x439837['data'];}}function a38_0x3e29(){const _0x3e0e1b=['site','getSegmentSQLFromYaml','SEGMENT_NOT_FOUND','processedRows','Show\x20child\x20segment\x20schema\x20(column\x20types)','name','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Folder\x20ID:\x20','segment:folder:create','Create\x20segment\x20folder\x20for\x20organization','Resolved\x20type:\x20','trim','parentSegment','✖\x20Query\x20failed\x20[','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20[Job\x20ID:\x20','Error:\x20Path\x20or\x20name\x20is\x20required','listFolders','Resolving\x20parent\x20segment\x20\x27','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','parentFolder','getSegmentSQL','Usage:','getSQLFromServerSegment','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','resolvePathToResource','515wurAhL','133827cNrWoQ','Resolved\x20parent\x20ID:\x20','getSegment','Error:\x20','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Resolving\x20\x27','/app/ps/','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','Folder\x20name:\x20','segment:folder:list','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','path','segment:describe','information_schema','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','\x20rows\x20','Resolving\x20parent\x20folder\x20\x27','Use:\x20tdx\x20ps\x20view\x20-w','Usage:\x20tdx\x20sg\x20desc\x20<name>','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Parent\x20ID:\x20','(root)','Parent\x20name:\x20','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','4725959kKTMAB','stats','green','jobId','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Site:\x20','Creating\x20folder\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','parent','22751820BtVKgV','segmentName','\x20folder','\x20\x20Parent\x20segment:\x20','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','message','red','Fetching\x20folder\x20details...','createFolder','Resolving\x20folder\x20\x27','Use:\x20tdx\x20ps\x20view','error','\x27\x20with\x20ID:\x20','Fetching\x20SQL\x20from\x20rule...','Error:\x20Parent\x20segment\x20name\x20is\x20required','log','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Resolved:\x20','Error:\x20Folder\x20reference\x20is\x20required','\x27...','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','32WWOrCO','Target\x20path:\x20','4054776FKJEIP','225985cBjWyH','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','jsonl','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','cyan','segment','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Options:','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','\x20\x20Segment\x20name:\x20','Listing\x20folders\x20for\x20parent\x20\x27','INVALID_ARGUMENT','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Resolved\x20YAML\x20file:\x20','resolveParentId','Resolving\x20path\x20\x27','replace','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','type','Resolved\x20folder\x20ID:\x20','length','verbose','getFolder','folder','Segment\x20ID:\x20','segmentId','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Resolved\x20relative\x20path\x20to:\x20','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Fetching\x20parent\x20segment\x20details...','getParent','Executing\x20segment\x20query...','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','cause','getSQLFromYamlFile','code','description','Show\x20folder\x20or\x20child\x20segment\x20details','setJobId','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','in\x20','\x20Opening\x20','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Fetching\x20segment\x20details...','execute','✔\x20Query\x20completed:\x20Processed\x20','3214aYaYCk','\x20\x20Full\x20path:\x20','Usage:\x20tdx\x20segment\x20describe\x20<path>','format','341604oDXESl','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','\x20\x20Folder\x20path:\x20','url','parentId','toLocaleString','Examples:','query','folderId','includes','segment:sql','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','\x20\x20Cause:\x20','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Parent\x20segment:\x20','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','content','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','resolveFolderId','SEGMENT_FOLDER_NOT_FOUND','Fetching\x20SQL\x20for\x20segment...','limit','data','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','json','✔\x20Found\x20','folderPath','Folder\x20ID\x20missing\x20from\x20resolved\x20path','114cWnHgG'];a38_0x3e29=function(){return _0x3e0e1b;};return a38_0x3e29();}export class SegmentFolderCreateCommand extends BaseCommand{[a38_0x177d32(0x1fa)]=a38_0x177d32(0x1fe);[a38_0x177d32(0x273)]=a38_0x177d32(0x1ff);async[a38_0x177d32(0x27b)](_0x4d04e1){const _0x3f990=a38_0x177d32,{options:_0x4a0d1a,args:_0x32c6df,tdx:_0x7ec1ef}=_0x4d04e1,_0x3dc058=_0x4a0d1a;if(_0x32c6df[_0x3f990(0x262)]<0x2)return console['error'](_0x3f990(0x239)),console[_0x3f990(0x240)](_0x3f990(0x22b)),0x1;const _0x29ebaa=_0x32c6df[0x0],_0x47cf55=_0x32c6df[0x1];_0x3dc058[_0x3f990(0x263)]&&(console[_0x3f990(0x240)](_0x3f990(0x231)+_0x3dc058[_0x3f990(0x1f5)]),console[_0x3f990(0x240)](_0x3f990(0x291)+_0x29ebaa),console[_0x3f990(0x240)](_0x3f990(0x21a)+_0x47cf55));let _0xc80269;if(_0x3dc058[_0x3f990(0x20a)]){const _0x7df274=_0x3dc058[_0x3f990(0x20a)],_0xe3b036=await withSpinner(_0x3f990(0x208)+_0x29ebaa+_0x3f990(0x248),()=>_0x7ec1ef['segment'][_0x3f990(0x25c)](_0x29ebaa),{'verbose':_0x3dc058[_0x3f990(0x263)]}),_0x536b66=_0xe3b036[_0x3f990(0x1ee)],_0x4ffcdd=await withSpinner(_0x3f990(0x222)+_0x7df274+'\x27...',()=>_0x7ec1ef[_0x3f990(0x253)][_0x3f990(0x297)](_0x536b66,_0x7df274),{'verbose':_0x3dc058[_0x3f990(0x263)]});_0xc80269=_0x4ffcdd[_0x3f990(0x1ee)],_0x3dc058[_0x3f990(0x263)]&&console[_0x3f990(0x240)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0xc80269);}const _0x447dd2={'name':_0x47cf55,'description':_0x3dc058[_0x3f990(0x273)],'parentFolderId':_0xc80269},_0x26c466=await withSpinner(_0x3f990(0x232)+_0x47cf55+'\x27...',()=>_0x7ec1ef[_0x3f990(0x253)][_0x3f990(0x23d)](_0x29ebaa,_0x447dd2),{'verbose':_0x3dc058[_0x3f990(0x263)]}),_0x1ab663=_0x26c466['data'];return console[_0x3f990(0x240)]('✔\x20Created\x20folder\x20\x27'+_0x1ab663[_0x3f990(0x1fa)]+_0x3f990(0x241)+_0x1ab663['id']),await handleSDKOutput([_0x1ab663],_0x3dc058),0x0;}}export class SegmentViewCommand extends BaseCommand{[a38_0x177d32(0x1fa)]='segment:view';[a38_0x177d32(0x273)]=a38_0x177d32(0x274);async[a38_0x177d32(0x27b)](_0x39a3b8){const _0x4b164b=a38_0x177d32,{options:_0x4bfc05,args:_0x377906,tdx:_0x5c3ac5}=_0x39a3b8,_0x4f8f57=_0x377906[0x0];if(!_0x4f8f57)return console[_0x4b164b(0x240)](_0x4b164b(0x295)),console[_0x4b164b(0x240)](_0x4b164b(0x282)),console['error'](_0x4b164b(0x290)),console[_0x4b164b(0x240)](_0x4b164b(0x255)),console[_0x4b164b(0x240)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x4b164b(0x240)](_0x4b164b(0x288)),console[_0x4b164b(0x240)](_0x4b164b(0x26f)),console[_0x4b164b(0x240)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x4b164b(0x240)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console['error'](_0x4b164b(0x279)),0x1;try{const _0x1e0195=_0x4bfc05[_0x4b164b(0x202)],_0x2dd317=await resolveSegmentTarget(_0x4f8f57,_0x1e0195,_0x4bfc05[_0x4b164b(0x263)]);_0x4bfc05['verbose']&&console[_0x4b164b(0x240)](_0x4b164b(0x24b)+_0x2dd317);const _0x1200f6=await withSpinner(_0x4b164b(0x217)+_0x4f8f57+'\x27...',()=>_0x5c3ac5[_0x4b164b(0x253)]['resolvePathToResource'](_0x2dd317),{'verbose':_0x4bfc05[_0x4b164b(0x263)]}),_0x5c3665=_0x1200f6['data'];_0x4bfc05[_0x4b164b(0x263)]&&(console[_0x4b164b(0x240)](_0x4b164b(0x200)+_0x5c3665[_0x4b164b(0x260)]),console[_0x4b164b(0x240)](_0x4b164b(0x227)+_0x5c3665[_0x4b164b(0x286)]),_0x5c3665['folderId']&&console[_0x4b164b(0x240)](_0x4b164b(0x1fd)+_0x5c3665['folderId']),_0x5c3665[_0x4b164b(0x267)]&&console[_0x4b164b(0x240)](_0x4b164b(0x266)+_0x5c3665[_0x4b164b(0x267)]));if(_0x4bfc05['web']){if(_0x5c3665['type']===_0x4b164b(0x265))return console[_0x4b164b(0x240)](_0x4b164b(0x230)),0x1;if(_0x5c3665[_0x4b164b(0x260)]===_0x4b164b(0x234))return console[_0x4b164b(0x240)](_0x4b164b(0x26e)),console['error'](_0x4b164b(0x223)),0x1;if(!_0x5c3665[_0x4b164b(0x267)])throw new SDKError(ErrorCode[_0x4b164b(0x1f7)],_0x4b164b(0x254));const _0x2c137f=getConsoleNextUrl(_0x4bfc05[_0x4b164b(0x1f5)],_0x4b164b(0x218)+_0x5c3665[_0x4b164b(0x286)]+'/e/'+_0x5c3665[_0x4b164b(0x267)]);return console['error'](a38_0x31978e[_0x4b164b(0x22e)]('✔')+_0x4b164b(0x278)+a38_0x31978e[_0x4b164b(0x252)](_0x2c137f)),openBrowser(_0x2c137f),0x0;}if(_0x5c3665[_0x4b164b(0x260)]===_0x4b164b(0x265)){if(!_0x5c3665['folderId'])throw new SDKError(ErrorCode[_0x4b164b(0x1eb)],_0x4b164b(0x1f3));const _0xd28d2b=await withSpinner('Fetching\x20folder\x20details...',()=>_0x5c3ac5[_0x4b164b(0x253)][_0x4b164b(0x264)](_0x5c3665[_0x4b164b(0x28a)]),{'verbose':_0x4bfc05[_0x4b164b(0x263)]});await handleSingleObjectOutput(_0xd28d2b[_0x4b164b(0x1ee)],_0x4bfc05);}else{if(_0x5c3665[_0x4b164b(0x260)]===_0x4b164b(0x253)){if(!_0x5c3665[_0x4b164b(0x267)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x4b164b(0x254));const _0x5add00=await withSpinner(_0x4b164b(0x27a),()=>_0x5c3ac5['segment'][_0x4b164b(0x213)](_0x5c3665[_0x4b164b(0x286)],_0x5c3665[_0x4b164b(0x267)]),{'verbose':_0x4bfc05[_0x4b164b(0x263)]}),_0x451e1c=getConsoleNextUrl(_0x4bfc05[_0x4b164b(0x1f5)],_0x4b164b(0x218)+_0x5c3665[_0x4b164b(0x286)]+'/e/'+_0x5c3665[_0x4b164b(0x267)]),_0x2fe7ce=_0x5add00[_0x4b164b(0x1ee)];_0x2fe7ce[_0x4b164b(0x285)]=_0x451e1c,await handleSingleObjectOutput(_0x2fe7ce,_0x4bfc05);}else return console[_0x4b164b(0x240)](_0x4b164b(0x25f)),console[_0x4b164b(0x240)](_0x4b164b(0x23f)),0x1;}return 0x0;}catch(_0xd4fdc5){if(_0xd4fdc5 instanceof SDKError)return console[_0x4b164b(0x240)](_0x4b164b(0x214)+_0xd4fdc5[_0x4b164b(0x23a)]),_0xd4fdc5[_0x4b164b(0x270)]&&console[_0x4b164b(0x240)](_0x4b164b(0x28e)+_0xd4fdc5[_0x4b164b(0x270)]),0x1;throw _0xd4fdc5;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']='segment:desc';[a38_0x177d32(0x273)]=a38_0x177d32(0x1f9);async['execute'](_0x5da29e){const _0x1471f9=a38_0x177d32,{options:_0x3296ed,args:_0x3d8fd3,tdx:_0x542f7a}=_0x5da29e,_0x4d03bc=_0x3d8fd3[0x0];if(!_0x4d03bc)return console[_0x1471f9(0x240)](_0x1471f9(0x204)),console[_0x1471f9(0x240)](_0x1471f9(0x224)),console[_0x1471f9(0x240)](_0x1471f9(0x233)),console[_0x1471f9(0x240)](_0x1471f9(0x288)),console['error'](_0x1471f9(0x26a)),console['error'](_0x1471f9(0x20e)),0x1;try{const _0x311ff1=_0x3296ed[_0x1471f9(0x202)],_0x598a1a=await resolveSegmentTarget(_0x4d03bc,_0x311ff1,_0x3296ed[_0x1471f9(0x263)]);_0x3296ed[_0x1471f9(0x263)]&&console[_0x1471f9(0x240)](_0x1471f9(0x24b)+_0x598a1a);const _0x247e34=await withSpinner(_0x1471f9(0x217)+_0x4d03bc+_0x1471f9(0x248),()=>_0x542f7a[_0x1471f9(0x253)][_0x1471f9(0x20f)](_0x598a1a),{'verbose':_0x3296ed[_0x1471f9(0x263)]}),_0x4d6eff=_0x247e34[_0x1471f9(0x1ee)];_0x3296ed[_0x1471f9(0x263)]&&(console[_0x1471f9(0x240)](_0x1471f9(0x200)+_0x4d6eff['type']),console[_0x1471f9(0x240)](_0x1471f9(0x227)+_0x4d6eff[_0x1471f9(0x286)]));if(_0x4d6eff['type']===_0x1471f9(0x265))return console['error'](_0x1471f9(0x250)),console[_0x1471f9(0x240)](_0x1471f9(0x276)),0x1;if(_0x4d6eff[_0x1471f9(0x260)]===_0x1471f9(0x234))return console[_0x1471f9(0x240)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x1471f9(0x240)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x4d6eff[_0x1471f9(0x267)])throw new SDKError(ErrorCode[_0x1471f9(0x1f7)],_0x1471f9(0x254));const _0x4004c9=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x542f7a[_0x1471f9(0x253)][_0x1471f9(0x20b)](_0x4d6eff[_0x1471f9(0x286)],_0x4d6eff['segmentId']),{'verbose':_0x3296ed[_0x1471f9(0x263)]}),_0x1b57e0=_0x4004c9[_0x1471f9(0x1ee)],_0xbbe755=await executeSchemaQuery(_0x1b57e0,_0x542f7a,_0x3296ed);return await handleQueryOutput(_0xbbe755,_0x3296ed),0x0;}catch(_0x215834){if(_0x215834 instanceof SDKError)return console['error'](_0x1471f9(0x214)+_0x215834[_0x1471f9(0x23a)]),_0x215834[_0x1471f9(0x270)]&&console[_0x1471f9(0x240)]('\x20\x20Cause:\x20'+_0x215834[_0x1471f9(0x270)]),0x1;throw _0x215834;}}}
@@ -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_0x5266c1=a39_0x14f7;(function(_0x2a0f0a,_0x52096a){const _0x342c95=a39_0x14f7,_0x3e01a1=_0x2a0f0a();while(!![]){try{const _0x332264=-parseInt(_0x342c95(0x7c))/0x1+parseInt(_0x342c95(0xa7))/0x2*(-parseInt(_0x342c95(0x92))/0x3)+-parseInt(_0x342c95(0xaa))/0x4+-parseInt(_0x342c95(0x81))/0x5+parseInt(_0x342c95(0x8d))/0x6*(parseInt(_0x342c95(0x94))/0x7)+parseInt(_0x342c95(0x8e))/0x8+parseInt(_0x342c95(0x90))/0x9;if(_0x332264===_0x52096a)break;else _0x3e01a1['push'](_0x3e01a1['shift']());}catch(_0x1865bd){_0x3e01a1['push'](_0x3e01a1['shift']());}}}(a39_0x446b,0x90782));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a39_0x446b(){const _0x5eeb7d=['42InajOu','segmentPath','ruleFile','Resolved\x20relative\x20path\x20to:\x20','execute','error','segment:create','name','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','resolvePathToResource','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','rule','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','site','includes','kind','description','length','segment','4Pwmfik','verbose','Parent:\x20','3610380SwFjhw','Parent\x20path:\x20','invisible','Segment\x20name:\x20','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Resolving\x20folder\x20path\x20\x27','\x27...','resolveParentId','450935hoXRNZ','✔\x20Created\x20segment\x20\x27','parent','Resolved\x20folder\x20ID:\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','2707185uhiHDI','yellow','Resolving\x20folder\x20\x27','createSegment','folder','noCountPopulation','\x20\x20\x20Path:\x20','Examples:','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','folderId','segments','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','286332FaMXyo','3956624AYGfhG','Resolving\x20parent\x20segment\x20\x27','15807141aHfvaj','Target\x20path:\x20','75819RmoHxO','type'];a39_0x446b=function(){return _0x5eeb7d;};return a39_0x446b();}import{loadJSONFromOptions}from'../utils/json-loader.js';function a39_0x14f7(_0x51d723,_0x4ef1df){_0x51d723=_0x51d723-0x74;const _0x446b5e=a39_0x446b();let _0x14f72a=_0x446b5e[_0x51d723];return _0x14f72a;}import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a39_0x45bfe7 from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']=a39_0x5266c1(0x9a);[a39_0x5266c1(0xa4)]='Create\x20child\x20segment\x20with\x20filtering\x20rules';async[a39_0x5266c1(0x98)](_0x5ba576){const _0x3e0c18=a39_0x5266c1;console[_0x3e0c18(0x99)](a39_0x45bfe7['yellow'](_0x3e0c18(0x77))),console[_0x3e0c18(0x99)](a39_0x45bfe7[_0x3e0c18(0x82)](_0x3e0c18(0x80)));const {options:_0x4b9027,args:_0x5648e2,tdx:_0x4dd029}=_0x5ba576,_0x1152f1=_0x4b9027;if(_0x5648e2[_0x3e0c18(0xa5)]===0x0)return console['error'](_0x3e0c18(0xa0)),console[_0x3e0c18(0x99)](_0x3e0c18(0x9e)),console['error'](_0x3e0c18(0x88)),console[_0x3e0c18(0x99)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console[_0x3e0c18(0x99)](_0x3e0c18(0x9c)),console[_0x3e0c18(0x99)](_0x3e0c18(0x78)),0x1;const _0x3f3df4=_0x5648e2[0x0],_0x79c729=_0x4b9027[_0x3e0c18(0x95)];let _0x24dba5=_0x3f3df4;_0x79c729&&!_0x3f3df4[_0x3e0c18(0xa2)]('/')&&(_0x24dba5=_0x79c729+'/'+_0x3f3df4,_0x1152f1[_0x3e0c18(0xa8)]&&console['error'](_0x3e0c18(0x97)+_0x24dba5));const _0x80e933=parsePath(_0x24dba5);if(_0x80e933['segments'][_0x3e0c18(0xa5)]<0x2)return console['error'](_0x3e0c18(0x89)),console[_0x3e0c18(0x99)](_0x3e0c18(0x8c)),0x1;const _0x545adc=_0x80e933[_0x3e0c18(0x8b)][0x0],_0x2c59cd=getBaseName(_0x24dba5),_0x5284c7=getParentPath(_0x24dba5);_0x1152f1[_0x3e0c18(0xa8)]&&(console['error']('Site:\x20'+_0x1152f1[_0x3e0c18(0xa1)]),console[_0x3e0c18(0x99)](_0x3e0c18(0x91)+_0x24dba5),console[_0x3e0c18(0x99)](_0x3e0c18(0xa9)+_0x545adc),console['error'](_0x3e0c18(0x76)+_0x2c59cd),console['error'](_0x3e0c18(0x74)+_0x5284c7));const _0x8083a1=await withSpinner(_0x3e0c18(0x8f)+_0x545adc+_0x3e0c18(0x7a),()=>_0x4dd029['segment'][_0x3e0c18(0x7b)](_0x545adc),{'verbose':_0x1152f1[_0x3e0c18(0xa8)]}),_0x4a6ecb=_0x8083a1['data'];let _0x402229;if(_0x80e933['segments'][_0x3e0c18(0xa5)]>0x2){const _0x9e1f9d=await withSpinner(_0x3e0c18(0x79)+_0x5284c7+_0x3e0c18(0x7a),()=>_0x4dd029[_0x3e0c18(0xa6)][_0x3e0c18(0x9d)](_0x5284c7),{'verbose':_0x1152f1[_0x3e0c18(0xa8)]}),_0x20014c=_0x9e1f9d['data'];if(_0x20014c[_0x3e0c18(0x93)]!==_0x3e0c18(0x85)&&_0x20014c[_0x3e0c18(0x93)]!==_0x3e0c18(0x7e))return console[_0x3e0c18(0x99)]('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x402229=_0x20014c[_0x3e0c18(0x8a)];}else{if(_0x1152f1[_0x3e0c18(0x85)]){const _0x3cddd4=await withSpinner(_0x3e0c18(0x83)+_0x1152f1[_0x3e0c18(0x85)]+'\x27...',()=>_0x4dd029['segment']['resolveFolderId'](_0x4a6ecb,_0x1152f1[_0x3e0c18(0x85)]),{'verbose':_0x1152f1[_0x3e0c18(0xa8)]});_0x402229=_0x3cddd4['data'];}}_0x1152f1[_0x3e0c18(0xa8)]&&_0x402229&&console[_0x3e0c18(0x99)](_0x3e0c18(0x7f)+_0x402229);const _0x546b40=await loadJSONFromOptions(_0x1152f1[_0x3e0c18(0x9f)],_0x1152f1[_0x3e0c18(0x96)]),_0x13e10f={'name':_0x2c59cd,'description':_0x1152f1['description'],'rule':_0x546b40,'kind':_0x1152f1[_0x3e0c18(0xa3)]!==undefined?parseInt(_0x1152f1[_0x3e0c18(0xa3)],0xa):undefined,'isVisible':_0x1152f1[_0x3e0c18(0x75)]?![]:undefined,'segmentFolderId':_0x402229,'countPopulation':_0x1152f1[_0x3e0c18(0x86)]?![]:undefined},_0x540f9a=await withSpinner('Creating\x20segment\x20\x27'+_0x2c59cd+_0x3e0c18(0x7a),()=>_0x4dd029[_0x3e0c18(0xa6)][_0x3e0c18(0x84)](_0x4a6ecb,_0x13e10f),{'verbose':_0x1152f1[_0x3e0c18(0xa8)]}),_0x42cbeb=_0x540f9a['data'];return console[_0x3e0c18(0x99)](_0x3e0c18(0x7d)+_0x42cbeb[_0x3e0c18(0x9b)]+'\x27\x20with\x20ID:\x20'+_0x42cbeb['id']),_0x24dba5!==_0x3f3df4&&console[_0x3e0c18(0x99)](_0x3e0c18(0x87)+_0x24dba5),await handleSDKOutput([_0x42cbeb],_0x1152f1),0x0;}}
@@ -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
+ const a40_0x34a6aa=a40_0x5e6d;(function(_0x33fc4c,_0x3a4b48){const _0x50b19a=a40_0x5e6d,_0x418105=_0x33fc4c();while(!![]){try{const _0x47972c=-parseInt(_0x50b19a(0x1a3))/0x1*(-parseInt(_0x50b19a(0x1aa))/0x2)+-parseInt(_0x50b19a(0x19b))/0x3*(parseInt(_0x50b19a(0x18e))/0x4)+parseInt(_0x50b19a(0x1a1))/0x5*(parseInt(_0x50b19a(0x194))/0x6)+parseInt(_0x50b19a(0x198))/0x7+-parseInt(_0x50b19a(0x193))/0x8*(parseInt(_0x50b19a(0x19c))/0x9)+-parseInt(_0x50b19a(0x1a5))/0xa*(-parseInt(_0x50b19a(0x1a0))/0xb)+-parseInt(_0x50b19a(0x192))/0xc;if(_0x47972c===_0x3a4b48)break;else _0x418105['push'](_0x418105['shift']());}catch(_0x22dc00){_0x418105['push'](_0x418105['shift']());}}}(a40_0x3f43,0xcf4c1));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a40_0x3f43(){const _0x18d6fb=['344gCIyAx','length','execute','347216faPvAP','Error:\x20Parent\x20segment\x20name\x20is\x20required','json','List\x20available\x20fields\x20for\x20segmentation','39075696mcUcbq','16SBoLbu','813186pRNwuH','✔\x20Found\x20','verbose','segment','5408025QZZCht','Listing\x20fields\x20for\x20\x27','Parent\x20segment:\x20','12kaCiip','165195YYqufw','listFields','description','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','11dVbWvJ','50BGPBMF','error','9724rytIwJ','site','6889100FgDZoy','jsonl','\x27...','Site:\x20','segment:fields'];a40_0x3f43=function(){return _0x18d6fb;};return a40_0x3f43();}function a40_0x5e6d(_0x1cafab,_0x2e28d4){_0x1cafab=_0x1cafab-0x18c;const _0x3f434a=a40_0x3f43();let _0x5e6d87=_0x3f434a[_0x1cafab];return _0x5e6d87;}import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{['name']=a40_0x34a6aa(0x1a9);[a40_0x34a6aa(0x19e)]=a40_0x34a6aa(0x191);async[a40_0x34a6aa(0x18d)](_0x2525ff){const _0x140b4c=a40_0x34a6aa,{options:_0x13e458,args:_0xe7754f,tdx:_0x38f6a9}=_0x2525ff,_0x489a45=_0xe7754f[0x0]||_0x13e458['parentSegment'];if(!_0x489a45)return console[_0x140b4c(0x1a2)](_0x140b4c(0x18f)),console['error'](_0x140b4c(0x19f)),console[_0x140b4c(0x1a2)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;_0x13e458['verbose']&&(console[_0x140b4c(0x1a2)](_0x140b4c(0x1a8)+_0x13e458[_0x140b4c(0x1a4)]),console['error'](_0x140b4c(0x19a)+_0x489a45));const _0x57ebd5=await withSpinner(_0x140b4c(0x199)+_0x489a45+_0x140b4c(0x1a7),()=>_0x38f6a9[_0x140b4c(0x197)][_0x140b4c(0x19d)](_0x489a45),{'verbose':_0x13e458[_0x140b4c(0x196)]}),_0x2bbf62=_0x57ebd5['data'];console['error'](_0x140b4c(0x195)+_0x2bbf62['length']+'\x20field'+(_0x2bbf62[_0x140b4c(0x18c)]!==0x1?'s':''));if(_0x13e458[_0x140b4c(0x190)]||_0x13e458[_0x140b4c(0x1a6)])return await handleSDKOutput(_0x2bbf62,_0x13e458),0x0;return displayFieldsHumanReadable(_0x2bbf62,_0x489a45),0x0;}}