@treasuredata/tdx 2026.4.15 → 2026.4.16

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 (220) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/cas-command.js +1 -1
  11. package/dist/commands/cas-segment-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/delivery-command.js +1 -1
  20. package/dist/commands/describe.js +1 -1
  21. package/dist/commands/engage-campaign-pull-command.js +1 -1
  22. package/dist/commands/engage-campaign-push-command.js +1 -1
  23. package/dist/commands/engage-campaign-validate-command.js +1 -1
  24. package/dist/commands/engage-command.js +1 -1
  25. package/dist/commands/engage-template-pull-command.js +1 -1
  26. package/dist/commands/engage-template-push-command.js +1 -1
  27. package/dist/commands/engage-template-validate-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/journey-command.js +1 -1
  30. package/dist/commands/journey-validate-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/mcp-command.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/policy-command.js +1 -1
  35. package/dist/commands/profile-command.js +1 -1
  36. package/dist/commands/profiles-command.js +1 -1
  37. package/dist/commands/query-command.js +1 -1
  38. package/dist/commands/schedule-command.js +1 -1
  39. package/dist/commands/segment-command.js +1 -1
  40. package/dist/commands/segment-create-command.js +1 -1
  41. package/dist/commands/segment-fields-command.js +1 -1
  42. package/dist/commands/segment-pull-command.js +1 -1
  43. package/dist/commands/segment-push-command.js +1 -1
  44. package/dist/commands/segment-update-command.js +1 -1
  45. package/dist/commands/segment-use-command.js +1 -1
  46. package/dist/commands/segment-validate-command.js +1 -1
  47. package/dist/commands/segments.js +1 -1
  48. package/dist/commands/show.js +1 -1
  49. package/dist/commands/status-command.js +1 -1
  50. package/dist/commands/tables.js +1 -1
  51. package/dist/commands/unset-command.js +1 -1
  52. package/dist/commands/upgrade-command.js +1 -1
  53. package/dist/commands/use-command.js +1 -1
  54. package/dist/commands/user-command.js +1 -1
  55. package/dist/commands/work-command.js +1 -1
  56. package/dist/commands/workflow-command.js +1 -1
  57. package/dist/core/auth.js +1 -1
  58. package/dist/core/command-output.js +1 -1
  59. package/dist/core/config.js +1 -1
  60. package/dist/core/connection-cache.js +1 -1
  61. package/dist/core/constants.js +1 -1
  62. package/dist/core/credential-cache.js +1 -1
  63. package/dist/core/global-context.js +1 -1
  64. package/dist/core/keychain.js +1 -1
  65. package/dist/core/oauth-keychain.js +1 -1
  66. package/dist/core/oauth.js +1 -1
  67. package/dist/core/profile.js +1 -1
  68. package/dist/core/project-config.js +1 -1
  69. package/dist/core/session.js +1 -1
  70. package/dist/core/user-cache.js +1 -1
  71. package/dist/core/version.js +1 -1
  72. package/dist/index.js +1 -1
  73. package/dist/mcp/server.js +1 -1
  74. package/dist/mcp/tools/index.js +1 -1
  75. package/dist/mcp/tools/tdx-run.js +1 -1
  76. package/dist/mcp/tools/tdx-search.js +1 -1
  77. package/dist/mcp/tools/work-create-item.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.js +1 -1
  141. package/dist/sdk/segment/fields-display.js +1 -1
  142. package/dist/sdk/segment/file-discovery.js +1 -1
  143. package/dist/sdk/segment/journey-utils.js +1 -1
  144. package/dist/sdk/segment/journey-validator.js +1 -1
  145. package/dist/sdk/segment/journey-yaml.js +1 -1
  146. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  147. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  148. package/dist/sdk/segment/pull-workflow.js +1 -1
  149. package/dist/sdk/segment/push-recovery.js +1 -1
  150. package/dist/sdk/segment/push-workflow.js +1 -1
  151. package/dist/sdk/segment/resolution-context.js +1 -1
  152. package/dist/sdk/segment/segment-path-parser.js +1 -1
  153. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  154. package/dist/sdk/segment/segment-validator.js +1 -1
  155. package/dist/sdk/segment/target-resolution.js +1 -1
  156. package/dist/sdk/segment/tdx-config.js +1 -1
  157. package/dist/sdk/segment/types/activation-schema.js +1 -1
  158. package/dist/sdk/segment/types/journey-def.js +1 -1
  159. package/dist/sdk/segment/types/journey-schema.js +1 -1
  160. package/dist/sdk/segment/types/segment-def.js +1 -1
  161. package/dist/sdk/segment/types/segment-schema.js +1 -1
  162. package/dist/sdk/segment/validate-files.js +1 -1
  163. package/dist/sdk/segment/yaml-validator.js +1 -1
  164. package/dist/sdk/segment.js +1 -1
  165. package/dist/sdk/types/index.js +1 -1
  166. package/dist/sdk/types/progress.js +1 -1
  167. package/dist/sdk/types/workspace.js +1 -1
  168. package/dist/sdk/user.js +1 -1
  169. package/dist/sdk/util/format-detector.js +1 -1
  170. package/dist/sdk/util/formatters.js +1 -1
  171. package/dist/sdk/util/index.js +1 -1
  172. package/dist/sdk/util/paginate.js +1 -1
  173. package/dist/sdk/util/tree-formatter.js +1 -1
  174. package/dist/sdk/workflow/archive-validation.js +1 -1
  175. package/dist/sdk/workflow/clone-workflow.js +1 -1
  176. package/dist/sdk/workflow/index.js +1 -1
  177. package/dist/sdk/workflow/pull-workflow.js +1 -1
  178. package/dist/sdk/workflow/push-workflow.js +1 -1
  179. package/dist/sdk/workflow/tdx-config.js +1 -1
  180. package/dist/sdk/workflow/workflow-utils.js +1 -1
  181. package/dist/sdk/workspace/access-tracker.js +1 -1
  182. package/dist/sdk/workspace/frontmatter.js +1 -1
  183. package/dist/sdk/workspace/git.js +1 -1
  184. package/dist/sdk/workspace/index.js +1 -1
  185. package/dist/sdk/workspace/templates.js +1 -1
  186. package/dist/sdk/workspace/weekly.js +1 -1
  187. package/dist/sdk/workspace/wikilinks.js +1 -1
  188. package/dist/test-utils/command-runner.js +1 -1
  189. package/dist/test-utils/factories.js +1 -1
  190. package/dist/test-utils/fixtures.js +1 -1
  191. package/dist/test-utils/http-mock.js +1 -1
  192. package/dist/test-utils/index.js +1 -1
  193. package/dist/utils/async.js +1 -1
  194. package/dist/utils/colors.js +1 -1
  195. package/dist/utils/diff.js +1 -1
  196. package/dist/utils/file-permissions.js +1 -1
  197. package/dist/utils/file-reader.js +1 -1
  198. package/dist/utils/github-releases.js +1 -1
  199. package/dist/utils/global-cache.js +1 -1
  200. package/dist/utils/json-loader.js +1 -1
  201. package/dist/utils/local-cache.js +1 -1
  202. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  203. package/dist/utils/logger/formatters/index.js +1 -1
  204. package/dist/utils/logger/handlers/console-handler.js +1 -1
  205. package/dist/utils/logger/handlers/file-handler.js +1 -1
  206. package/dist/utils/logger/handlers/index.js +1 -1
  207. package/dist/utils/logger/handlers/null-handler.js +1 -1
  208. package/dist/utils/logger/index.js +1 -1
  209. package/dist/utils/logger/logger.js +1 -1
  210. package/dist/utils/logger/types.js +1 -1
  211. package/dist/utils/option-validation.js +1 -1
  212. package/dist/utils/process.js +1 -1
  213. package/dist/utils/prompt.js +1 -1
  214. package/dist/utils/spinner.js +1 -1
  215. package/dist/utils/sse-parser.js +1 -1
  216. package/dist/utils/string-utils.js +1 -1
  217. package/dist/utils/table-ref-parser.js +1 -1
  218. package/dist/utils/tdx-logger.js +1 -1
  219. package/dist/utils/version-check.js +1 -1
  220. package/package.json +1 -1
@@ -1 +1 @@
1
- function a32_0x1eb8(){const _0xda05ab=[',\x20user_id:','\x20user','24MFoTvR','\x20assigned','context','join','267255slzaKX','getCurrent','map','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','validate','execute','\x20\x20No\x20permissions','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','Member','\x20\x20No\x20policies\x20assigned','getMyPermissions','1199gFetzB','data','site','bold','policies','\x20\x20\x20','No\x20policies\x20found','216XflFbf','97140DqAIyq','6757020YXNiJV','Fetching\x20permissions...','(ID:\x20','account_owner','dim','✔\x20Found\x20','👥\x20Assigned\x20Users','name','getPolicyPermissions','policy','policy\x20show','listPolicies','email','verbose','176390SBjvfH','ies','getPolicyUsers','permissions','user','\x20—\x20','Administrator','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','length','description','Fetching\x20policy...','all','3466708sYoYws','\x20polic','\x20\x20•\x20','109643fpSgJc','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','args','7WbgCZA','administrator','5GXMXzu','2699697RSNwZi','account_id','log'];a32_0x1eb8=function(){return _0xda05ab;};return a32_0x1eb8();}function a32_0x4bfd(_0x4fd5ad,_0x3fa121){_0x4fd5ad=_0x4fd5ad-0x96;const _0x1eb8ad=a32_0x1eb8();let _0x4bfde8=_0x1eb8ad[_0x4fd5ad];return _0x4bfde8;}const a32_0x32b3cb=a32_0x4bfd;(function(_0x3fa904,_0x581d74){const _0x39db27=a32_0x4bfd,_0x3d153b=_0x3fa904();while(!![]){try{const _0xf6f72=-parseInt(_0x39db27(0xd4))/0x1*(-parseInt(_0x39db27(0x9f))/0x2)+-parseInt(_0x39db27(0x9a))/0x3+parseInt(_0x39db27(0xd1))/0x4*(parseInt(_0x39db27(0x99))/0x5)+parseInt(_0x39db27(0xb7))/0x6*(parseInt(_0x39db27(0x97))/0x7)+-parseInt(_0x39db27(0xb5))/0x8*(parseInt(_0x39db27(0xa3))/0x9)+parseInt(_0x39db27(0xc5))/0xa+-parseInt(_0x39db27(0xae))/0xb*(parseInt(_0x39db27(0xb6))/0xc);if(_0xf6f72===_0x581d74)break;else _0x3d153b['push'](_0x3d153b['shift']());}catch(_0x2dc927){_0x3d153b['push'](_0x3d153b['shift']());}}}(a32_0x1eb8,0xb5327));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x188f0e from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x32b3cb(0xbe)]=a32_0x32b3cb(0xc0);['description']=a32_0x32b3cb(0xaa);async[a32_0x32b3cb(0xa8)](_0x294912){const _0x43f71c=a32_0x32b3cb,{options:_0x2786cb,tdx:_0x5ea2c1}=_0x294912,_0x4ca05b=await withSpinner(_0x43f71c(0xb8),async()=>{const _0x365905=_0x43f71c,[_0x3d8387,_0xf80ccd]=await Promise[_0x365905(0xd0)]([_0x5ea2c1[_0x365905(0xc9)][_0x365905(0xa4)](),_0x5ea2c1[_0x365905(0xc0)][_0x365905(0xad)]()]);return{'userInfo':_0x3d8387,'permissions':_0xf80ccd};},{'verbose':_0x2786cb[_0x43f71c(0xc4)]}),{userInfo:_0x4fbbd2,permissions:_0x43832a}=_0x4ca05b[_0x43f71c(0xaf)];if(isStructuredFormat(_0x2786cb))return await handleSingleObjectOutput(_0x43832a,_0x2786cb),0x0;const _0x194e98=_0x4fbbd2[_0x43f71c(0xba)]?'Account\x20Owner':_0x4fbbd2[_0x43f71c(0x98)]?_0x43f71c(0xcb):_0x43f71c(0xab);console[_0x43f71c(0x9c)]('\x0a'+a32_0x188f0e[_0x43f71c(0xb1)]('👤')+'\x20'+a32_0x188f0e[_0x43f71c(0xb1)](_0x4fbbd2['name'])+'\x20'+a32_0x188f0e[_0x43f71c(0xbb)]('('+_0x4fbbd2['email']+')')+_0x43f71c(0xca)+_0x194e98),console[_0x43f71c(0x9c)](a32_0x188f0e[_0x43f71c(0xbb)](_0x43f71c(0xb3)+_0x5ea2c1[_0x43f71c(0xa1)][_0x43f71c(0xb0)]+':'+_0x4fbbd2[_0x43f71c(0x9b)]+_0x43f71c(0x9d)+_0x4fbbd2['id']));const _0x35300e=_0x43832a[_0x43f71c(0xb2)];console['log']('\x0a'+a32_0x188f0e[_0x43f71c(0xb1)]('📋\x20Assigned\x20Policies')+'\x20('+_0x35300e[_0x43f71c(0xcd)]+'):');if(_0x35300e[_0x43f71c(0xcd)]===0x0)console['log'](a32_0x188f0e[_0x43f71c(0xbb)](_0x43f71c(0xac)));else for(const _0x1c9f01 of _0x35300e){console[_0x43f71c(0x9c)](_0x43f71c(0xd3)+_0x1c9f01[_0x43f71c(0xbe)]);}return printPermissionsMap(_0x43832a['permissions']),console[_0x43f71c(0x9c)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x32b3cb(0xbe)]='policy\x20list';['description']=a32_0x32b3cb(0xd5);async['execute'](_0x2d0af2){const _0x2b5f08=a32_0x32b3cb,{options:_0x246cf4,tdx:_0x5166cb}=_0x2d0af2,_0x3cf047=await withSpinner('Listing\x20policies...',()=>_0x5166cb[_0x2b5f08(0xc0)][_0x2b5f08(0xc2)](),{'verbose':_0x246cf4[_0x2b5f08(0xc4)]}),_0x164edd=_0x3cf047['data'];console['error'](_0x2b5f08(0xbc)+_0x164edd[_0x2b5f08(0xcd)]+_0x2b5f08(0xd2)+(_0x164edd[_0x2b5f08(0xcd)]!==0x1?_0x2b5f08(0xc6):'y'));if(isStructuredFormat(_0x246cf4))return await handleSDKOutput(_0x164edd,_0x246cf4),0x0;if(_0x164edd[_0x2b5f08(0xcd)]===0x0)console[_0x2b5f08(0x9c)](a32_0x188f0e[_0x2b5f08(0xbb)](_0x2b5f08(0xb4)));else for(const _0x5ee632 of _0x164edd){const _0x3d0f44=_0x5ee632[_0x2b5f08(0xce)]?a32_0x188f0e[_0x2b5f08(0xbb)]('\x20—\x20'+_0x5ee632[_0x2b5f08(0xce)]):'';console[_0x2b5f08(0x9c)]('\x20\x20•\x20'+_0x5ee632[_0x2b5f08(0xbe)]+_0x3d0f44);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{['name']=a32_0x32b3cb(0xc1);[a32_0x32b3cb(0xce)]=a32_0x32b3cb(0xcc);[a32_0x32b3cb(0xa7)](_0x59f83c){const _0x45dcf6=a32_0x32b3cb;if(_0x59f83c[_0x45dcf6(0x96)][_0x45dcf6(0xcd)]===0x0)return _0x45dcf6(0xa6);return undefined;}async[a32_0x32b3cb(0xa8)](_0xc2294c){const _0x23d05a=a32_0x32b3cb,{options:_0x1c4a80,tdx:_0x10f006}=_0xc2294c,_0x2b722a=_0xc2294c[_0x23d05a(0x96)][0x0],_0x181602=await withSpinner(_0x23d05a(0xcf),async()=>{const _0x385ec3=_0x23d05a,_0x3f334f=await _0x10f006[_0x385ec3(0xc0)]['getPolicy'](_0x2b722a),[_0x52d929,_0x34fd87]=await Promise[_0x385ec3(0xd0)]([_0x10f006[_0x385ec3(0xc0)][_0x385ec3(0xbf)](_0x3f334f['id']),_0x10f006['policy'][_0x385ec3(0xc7)](_0x3f334f['id'])]);return{'policy':_0x3f334f,'perms':_0x52d929,'users':_0x34fd87};},{'verbose':_0x1c4a80[_0x23d05a(0xc4)]}),{policy:_0x5a6636,perms:_0x4fb0d1,users:_0x3d1275}=_0x181602['data'];if(isStructuredFormat(_0x1c4a80))return await handleSingleObjectOutput({..._0x5a6636,'permissions':_0x4fb0d1[_0x23d05a(0xc8)],'users':_0x3d1275},_0x1c4a80),0x0;console[_0x23d05a(0x9c)]('\x0a'+a32_0x188f0e['bold']('📋')+'\x20'+a32_0x188f0e['bold'](_0x5a6636['name'])+'\x20'+a32_0x188f0e['dim'](_0x23d05a(0xb9)+_0x5a6636['id']+')'));_0x5a6636[_0x23d05a(0xce)]&&console[_0x23d05a(0x9c)](_0x23d05a(0xb3)+a32_0x188f0e[_0x23d05a(0xbb)](_0x5a6636[_0x23d05a(0xce)]));console[_0x23d05a(0x9c)](_0x23d05a(0xb3)+_0x3d1275[_0x23d05a(0xcd)]+_0x23d05a(0x9e)+(_0x3d1275[_0x23d05a(0xcd)]!==0x1?'s':'')+_0x23d05a(0xa0)),printPermissionsMap(_0x4fb0d1[_0x23d05a(0xc8)]);if(_0x3d1275[_0x23d05a(0xcd)]>0x0){console[_0x23d05a(0x9c)]('\x0a'+a32_0x188f0e['bold'](_0x23d05a(0xbd))+':');for(const _0x4bb304 of _0x3d1275){const _0x5822ea=_0x4bb304['email']&&_0x4bb304[_0x23d05a(0xc3)]!==_0x4bb304[_0x23d05a(0xbe)]?a32_0x188f0e['dim']('\x20<'+_0x4bb304[_0x23d05a(0xc3)]+'>'):'';console[_0x23d05a(0x9c)](_0x23d05a(0xd3)+_0x4bb304[_0x23d05a(0xbe)]+_0x5822ea);}}return console['log'](),0x0;}}function printPermissionsMap(_0x38cb32){const _0x245127=a32_0x32b3cb,_0x972836=Object['entries'](_0x38cb32);console[_0x245127(0x9c)]('\x0a'+a32_0x188f0e['bold']('🔑\x20Effective\x20Permissions')+':');if(_0x972836['length']===0x0){console[_0x245127(0x9c)](a32_0x188f0e[_0x245127(0xbb)](_0x245127(0xa9)));return;}const _0x2fce70=Math['max'](..._0x972836[_0x245127(0xa5)](([_0x184a24])=>_0x184a24[_0x245127(0xcd)]));for(const [_0x4de9e,_0x27f28a]of _0x972836){const _0x55c43f=formatOperations(_0x27f28a);console[_0x245127(0x9c)]('\x20\x20'+_0x4de9e['padEnd'](_0x2fce70+0x2)+_0x55c43f);}}function formatOperations(_0x37f130){const _0xf4719=a32_0x32b3cb,_0x1187c2=[...new Set(_0x37f130['map'](_0x3b39b6=>_0x3b39b6['operation']))];return _0x1187c2[_0xf4719(0xa2)](',\x20');}
1
+ const a32_0x44f75c=a32_0xcfda;(function(_0x56c12f,_0x1ff6fb){const _0x232484=a32_0xcfda,_0x4b81a1=_0x56c12f();while(!![]){try{const _0x40f3b8=parseInt(_0x232484(0x1c7))/0x1+parseInt(_0x232484(0x1b1))/0x2*(parseInt(_0x232484(0x1b5))/0x3)+-parseInt(_0x232484(0x1a2))/0x4+parseInt(_0x232484(0x1cf))/0x5*(parseInt(_0x232484(0x1dc))/0x6)+-parseInt(_0x232484(0x1aa))/0x7+-parseInt(_0x232484(0x1d1))/0x8*(parseInt(_0x232484(0x1d9))/0x9)+-parseInt(_0x232484(0x1d2))/0xa*(parseInt(_0x232484(0x1d6))/0xb);if(_0x40f3b8===_0x1ff6fb)break;else _0x4b81a1['push'](_0x4b81a1['shift']());}catch(_0x12db1b){_0x4b81a1['push'](_0x4b81a1['shift']());}}}(a32_0x3afc,0x48ac1));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x22a455 from'chalk';export class PolicyCommand extends BaseCommand{['name']=a32_0x44f75c(0x1d7);[a32_0x44f75c(0x1d5)]='Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions';async[a32_0x44f75c(0x1bc)](_0x339a18){const _0x29a47f=a32_0x44f75c,{options:_0x18ad0b,tdx:_0x3f7652}=_0x339a18,_0x3bbb30=await withSpinner(_0x29a47f(0x1a4),async()=>{const _0x4557d8=_0x29a47f,[_0x4d764b,_0x4761b4]=await Promise[_0x4557d8(0x1cc)]([_0x3f7652[_0x4557d8(0x1b7)][_0x4557d8(0x1c9)](),_0x3f7652['policy'][_0x4557d8(0x1c4)]()]);return{'userInfo':_0x4d764b,'permissions':_0x4761b4};},{'verbose':_0x18ad0b[_0x29a47f(0x1de)]}),{userInfo:_0x207473,permissions:_0x439fc2}=_0x3bbb30['data'];if(isStructuredFormat(_0x18ad0b))return await handleSingleObjectOutput(_0x439fc2,_0x18ad0b),0x0;const _0x681cb2=_0x207473['account_owner']?_0x29a47f(0x1d0):_0x207473[_0x29a47f(0x1df)]?_0x29a47f(0x1a5):_0x29a47f(0x1c6);console[_0x29a47f(0x1c2)]('\x0a'+a32_0x22a455[_0x29a47f(0x1ba)]('👤')+'\x20'+a32_0x22a455[_0x29a47f(0x1ba)](_0x207473[_0x29a47f(0x1a6)])+'\x20'+a32_0x22a455[_0x29a47f(0x1d8)]('('+_0x207473['email']+')')+_0x29a47f(0x1dd)+_0x681cb2),console['log'](a32_0x22a455[_0x29a47f(0x1d8)](_0x29a47f(0x1be)+_0x3f7652[_0x29a47f(0x1d3)]['site']+':'+_0x207473[_0x29a47f(0x1cb)]+_0x29a47f(0x1c1)+_0x207473['id']));const _0x4c7e71=_0x439fc2[_0x29a47f(0x1af)];console[_0x29a47f(0x1c2)]('\x0a'+a32_0x22a455[_0x29a47f(0x1ba)](_0x29a47f(0x1c8))+'\x20('+_0x4c7e71['length']+'):');if(_0x4c7e71['length']===0x0)console[_0x29a47f(0x1c2)](a32_0x22a455[_0x29a47f(0x1d8)](_0x29a47f(0x1a9)));else for(const _0x174567 of _0x4c7e71){console['log'](_0x29a47f(0x1db)+_0x174567[_0x29a47f(0x1a6)]);}return printPermissionsMap(_0x439fc2[_0x29a47f(0x1bf)]),console[_0x29a47f(0x1c2)](),0x0;}}function a32_0xcfda(_0x5ea5f8,_0x536bf8){_0x5ea5f8=_0x5ea5f8-0x1a1;const _0x3afcf5=a32_0x3afc();let _0xcfdafe=_0x3afcf5[_0x5ea5f8];return _0xcfdafe;}export class PolicyListCommand extends BaseCommand{['name']=a32_0x44f75c(0x1ad);[a32_0x44f75c(0x1d5)]=a32_0x44f75c(0x1d4);async['execute'](_0x33da1c){const _0x35f83a=a32_0x44f75c,{options:_0xad5338,tdx:_0x4ce262}=_0x33da1c,_0x26f06c=await withSpinner(_0x35f83a(0x1b2),()=>_0x4ce262['policy'][_0x35f83a(0x1a7)](),{'verbose':_0xad5338[_0x35f83a(0x1de)]}),_0x442bfd=_0x26f06c['data'];console[_0x35f83a(0x1a8)](_0x35f83a(0x1e0)+_0x442bfd['length']+_0x35f83a(0x1c3)+(_0x442bfd[_0x35f83a(0x1ae)]!==0x1?'ies':'y'));if(isStructuredFormat(_0xad5338))return await handleSDKOutput(_0x442bfd,_0xad5338),0x0;if(_0x442bfd[_0x35f83a(0x1ae)]===0x0)console[_0x35f83a(0x1c2)](a32_0x22a455[_0x35f83a(0x1d8)](_0x35f83a(0x1c0)));else for(const _0x2e912f of _0x442bfd){const _0x475604=_0x2e912f[_0x35f83a(0x1d5)]?a32_0x22a455['dim'](_0x35f83a(0x1dd)+_0x2e912f[_0x35f83a(0x1d5)]):'';console[_0x35f83a(0x1c2)]('\x20\x20•\x20'+_0x2e912f[_0x35f83a(0x1a6)]+_0x475604);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{['name']=a32_0x44f75c(0x1b4);[a32_0x44f75c(0x1d5)]=a32_0x44f75c(0x1bd);[a32_0x44f75c(0x1b6)](_0x208131){const _0x40d7f0=a32_0x44f75c;if(_0x208131[_0x40d7f0(0x1b0)]['length']===0x0)return _0x40d7f0(0x1bb);return undefined;}async[a32_0x44f75c(0x1bc)](_0x38d004){const _0x41fc55=a32_0x44f75c,{options:_0x5db834,tdx:_0x496cad}=_0x38d004,_0x2b1325=_0x38d004[_0x41fc55(0x1b0)][0x0],_0x2b8f78=await withSpinner(_0x41fc55(0x1a1),async()=>{const _0x582cac=_0x41fc55,_0x3ba349=await _0x496cad[_0x582cac(0x1d7)][_0x582cac(0x1ac)](_0x2b1325),[_0x5852b8,_0x1e5f86]=await Promise[_0x582cac(0x1cc)]([_0x496cad[_0x582cac(0x1d7)]['getPolicyPermissions'](_0x3ba349['id']),_0x496cad[_0x582cac(0x1d7)]['getPolicyUsers'](_0x3ba349['id'])]);return{'policy':_0x3ba349,'perms':_0x5852b8,'users':_0x1e5f86};},{'verbose':_0x5db834['verbose']}),{policy:_0x181294,perms:_0x496421,users:_0x5f107a}=_0x2b8f78[_0x41fc55(0x1c5)];if(isStructuredFormat(_0x5db834))return await handleSingleObjectOutput({..._0x181294,'permissions':_0x496421[_0x41fc55(0x1bf)],'users':_0x5f107a},_0x5db834),0x0;console['log']('\x0a'+a32_0x22a455['bold']('📋')+'\x20'+a32_0x22a455[_0x41fc55(0x1ba)](_0x181294[_0x41fc55(0x1a6)])+'\x20'+a32_0x22a455[_0x41fc55(0x1d8)](_0x41fc55(0x1ab)+_0x181294['id']+')'));_0x181294['description']&&console[_0x41fc55(0x1c2)](_0x41fc55(0x1be)+a32_0x22a455[_0x41fc55(0x1d8)](_0x181294['description']));console[_0x41fc55(0x1c2)](_0x41fc55(0x1be)+_0x5f107a[_0x41fc55(0x1ae)]+'\x20user'+(_0x5f107a['length']!==0x1?'s':'')+_0x41fc55(0x1ce)),printPermissionsMap(_0x496421['permissions']);if(_0x5f107a[_0x41fc55(0x1ae)]>0x0){console[_0x41fc55(0x1c2)]('\x0a'+a32_0x22a455[_0x41fc55(0x1ba)]('👥\x20Assigned\x20Users')+':');for(const _0x4e6055 of _0x5f107a){const _0x5e887e=_0x4e6055['email']&&_0x4e6055[_0x41fc55(0x1b3)]!==_0x4e6055[_0x41fc55(0x1a6)]?a32_0x22a455[_0x41fc55(0x1d8)]('\x20<'+_0x4e6055['email']+'>'):'';console[_0x41fc55(0x1c2)](_0x41fc55(0x1db)+_0x4e6055[_0x41fc55(0x1a6)]+_0x5e887e);}}return console[_0x41fc55(0x1c2)](),0x0;}}function printPermissionsMap(_0x5d3571){const _0x573362=a32_0x44f75c,_0x35628d=Object[_0x573362(0x1a3)](_0x5d3571);console[_0x573362(0x1c2)]('\x0a'+a32_0x22a455[_0x573362(0x1ba)](_0x573362(0x1ca))+':');if(_0x35628d['length']===0x0){console[_0x573362(0x1c2)](a32_0x22a455[_0x573362(0x1d8)](_0x573362(0x1b8)));return;}const _0x1c093b=Math[_0x573362(0x1b9)](..._0x35628d['map'](([_0x37b0b8])=>_0x37b0b8[_0x573362(0x1ae)]));for(const [_0x5a2860,_0x90ff42]of _0x35628d){const _0x39b105=formatOperations(_0x90ff42);console[_0x573362(0x1c2)]('\x20\x20'+_0x5a2860[_0x573362(0x1cd)](_0x1c093b+0x2)+_0x39b105);}}function a32_0x3afc(){const _0x5e995e=['context','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','description','286WDTAyx','policy','dim','321921zXPQsj','map','\x20\x20•\x20','1199310yTQLvx','\x20—\x20','verbose','administrator','✔\x20Found\x20','Fetching\x20policy...','141716cQcdzx','entries','Fetching\x20permissions...','Administrator','name','listPolicies','error','\x20\x20No\x20policies\x20assigned','1860047udAEPL','(ID:\x20','getPolicy','policy\x20list','length','policies','args','30tZzQtB','Listing\x20policies...','email','policy\x20show','111765RVDIfP','validate','user','\x20\x20No\x20permissions','max','bold','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','execute','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','\x20\x20\x20','permissions','No\x20policies\x20found',',\x20user_id:','log','\x20polic','getMyPermissions','data','Member','490845DyshDr','📋\x20Assigned\x20Policies','getCurrent','🔑\x20Effective\x20Permissions','account_id','all','padEnd','\x20assigned','5zIEMYt','Account\x20Owner','16Mxebki','222770HSRQeE'];a32_0x3afc=function(){return _0x5e995e;};return a32_0x3afc();}function formatOperations(_0x2a0d64){const _0x201963=a32_0x44f75c,_0x1a0a07=[...new Set(_0x2a0d64[_0x201963(0x1da)](_0x5c4ec4=>_0x5c4ec4['operation']))];return _0x1a0a07['join'](',\x20');}
@@ -1 +1 @@
1
- function a33_0x347d(_0x54b87d,_0x4e94b8){_0x54b87d=_0x54b87d-0x1ba;const _0x1f6f96=a33_0x1f6f();let _0x347d95=_0x1f6f96[_0x54b87d];return _0x347d95;}const a33_0xaf0397=a33_0x347d;(function(_0x58c5eb,_0xef0972){const _0x532a91=a33_0x347d,_0xe01ef7=_0x58c5eb();while(!![]){try{const _0x3d4bbf=parseInt(_0x532a91(0x1d7))/0x1+-parseInt(_0x532a91(0x1d4))/0x2+-parseInt(_0x532a91(0x21d))/0x3*(-parseInt(_0x532a91(0x1e7))/0x4)+-parseInt(_0x532a91(0x1d9))/0x5+-parseInt(_0x532a91(0x1e4))/0x6+-parseInt(_0x532a91(0x1d2))/0x7*(-parseInt(_0x532a91(0x1ce))/0x8)+parseInt(_0x532a91(0x20a))/0x9*(-parseInt(_0x532a91(0x1d6))/0xa);if(_0x3d4bbf===_0xef0972)break;else _0xe01ef7['push'](_0xe01ef7['shift']());}catch(_0x20dd29){_0xe01ef7['push'](_0xe01ef7['shift']());}}}(a33_0x1f6f,0xdf413));function a33_0x1f6f(){const _0x3e6bc6=['profile:use','Set\x20a\x20profile\x20configuration\x20value','message','Create\x20a\x20new\x20profile','yellow','Enter\x20description\x20(optional):','\x27\x20deleted','confirm','Default\x20profile\x20set\x20to:\x20','getUserInfo','session','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','llm_agent','ERROR','test','\x0aAvailable\x20profiles:','profile','\x20\x20tdx\x20--profile\x20','all','Set\x20session\x20profile','✗\x20Validation\x20failed:\x20','/app/mp/ak','8bNxntk','\x27\x20created','split','\x20API\x20key\x20is\x20valid\x20(User:\x20','5012651XutpIj','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','1964770hjODgP','Failed\x20to\x20delete\x20profile:\x20','10zJxeuH','1540426xdTCbL','profile:delete','5959085qwNqcL','Validating\x20API\x20key...','Session\x20profile\x20set\x20to:\x20','green','default','includes','Profile\x20name\x20cannot\x20be\x20empty','name','red','Removed\x20existing\x20profile\x20\x27','\x0aSaved\x20to:\x20','1505490aNfUWY','tdx.json','API\x20key\x20cannot\x20be\x20empty','4dbwufb','force','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','bold','create','\x27.\x0a\x0aValid\x20keys:\x20','\x20Profile\x20\x27','\x0aOperation\x20cancelled','profile:set','tdx:\x20profile\x20set','log','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x20--default\x27\x20to\x20save\x20permanently','site','us01','oauth','description','tdx:\x20profile\x20delete','dim','\x20API\x20key\x20saved\x20to\x20system\x20keychain','trim','length','error','\x27\x20does\x20not\x20exist.','execute','\x27\x20updated:\x20','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','warn','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','status','logLevel','VALID_KEYS','\x27\x20requires\x20API\x20key\x20validation.','Enter\x20profile\x20name:','74583YUKSHo','\x0aSetup\x20cancelled','\x20\x20-\x20','join','(session:\x20','database','email','tdx:\x20profile\x20create','Operation\x20cancelled','profileName','apiKey','Profile\x20\x27','password','llm_project','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','jobs','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>','text','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','3274008Wikntb','validate','Enter\x20your\x20TD\x20API\x20key:','Unknown\x20key\x20\x27','Site\x20was\x20not\x20changed.'];a33_0x1f6f=function(){return _0x3e6bc6;};return a33_0x1f6f();}import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a33_0x21128d from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a33_0x7bf2df from'prompts';import a33_0x1bf537 from'chalk';function validateProfileName(_0xb818fd,_0x2686e5){const _0x7f0131=a33_0x347d;if(!_0xb818fd||!_0xb818fd[_0x7f0131(0x1fb)]())return _0x7f0131(0x1df);const _0x5302c7=_0xb818fd[_0x7f0131(0x1fb)]();if(!/^[a-zA-Z0-9_-]+$/[_0x7f0131(0x1c6)](_0x5302c7))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(!_0x2686e5?.['skipExistsCheck']&&profileExists(_0x5302c7))return'Profile\x20\x27'+_0x5302c7+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20'+_0x5302c7+_0x7f0131(0x21c);return!![];}async function deleteProfileAndCredentials(_0x53ae1f){const _0x3a053a=a33_0x347d;removeProfileFromUserConfig(_0x53ae1f);const _0x527287=await isKeychainAvailable();_0x527287&&await Promise[_0x3a053a(0x1ca)]([deleteKeychainAPIKey(_0x53ae1f),deleteOAuthTokens(_0x53ae1f)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0xaf0397(0x1e0)]='profile:create';[a33_0xaf0397(0x1f7)]=a33_0xaf0397(0x1bb);async[a33_0xaf0397(0x1ff)](_0x1a133c){const _0x581619=a33_0xaf0397,{options:_0x1c6ef7,args:_0x31a213}=_0x1a133c,_0x20f75f=!!_0x1c6ef7[_0x581619(0x1e8)];console[_0x581619(0x1f1)](a33_0x1bf537[_0x581619(0x1ea)](_0x581619(0x211)));let _0x5e99b4;if(_0x31a213[_0x581619(0x1fc)]>0x0&&_0x31a213[0x0]){const _0x1cd777=_0x31a213[0x0][_0x581619(0x1fb)]();_0x20f75f&&profileExists(_0x1cd777)&&(await deleteProfileAndCredentials(_0x1cd777),console[_0x581619(0x1f1)]('Removed\x20existing\x20profile\x20\x27'+_0x1cd777+'\x27'));const _0x510dd9=validateProfileName(_0x1cd777);if(_0x510dd9!==!![])return console[_0x581619(0x1fd)](a33_0x1bf537[_0x581619(0x1e1)](_0x510dd9)),0x1;_0x5e99b4=_0x1cd777;}else{const _0x1dfd0d=await a33_0x7bf2df({'type':_0x581619(0x21b),'name':_0x581619(0x213),'message':_0x581619(0x209),'validate':_0x1ec974=>validateProfileName(_0x1ec974,{'skipExistsCheck':_0x20f75f})});if(!_0x1dfd0d[_0x581619(0x213)])return console[_0x581619(0x1f1)]('\x0aSetup\x20cancelled'),0x1;_0x5e99b4=_0x1dfd0d[_0x581619(0x213)]['trim'](),_0x20f75f&&profileExists(_0x5e99b4)&&(await deleteProfileAndCredentials(_0x5e99b4),console[_0x581619(0x1f1)](_0x581619(0x1e2)+_0x5e99b4+'\x27'));}const _0xb10178=await a33_0x7bf2df({'type':'text','name':_0x581619(0x1f7),'message':_0x581619(0x1bd)}),_0x2918f8=_0xb10178[_0x581619(0x1f7)]?.['trim']()||undefined,_0x3855e7=_0x1c6ef7['site']||_0x581619(0x1f5),_0x69ef24=await promptSiteSelection(_0x3855e7,_0x5e99b4,'Setup\x20cancelled');if(!_0x69ef24)return 0x1;const _0x26b76d=resolveSite(_0x69ef24),_0x2b6094=await promptAuthMethod();if(!_0x2b6094)return console['log'](_0x581619(0x20b)),0x1;if(_0x2b6094===_0x581619(0x1f6)){if(_0x2918f8){const _0x2403ce={'site':_0x26b76d,'description':_0x2918f8};saveProfileToUserConfig(_0x5e99b4,_0x2403ce);}const {accountName:_0x3730b1}=_0x1c6ef7;return await runOAuthLoginFlow(_0x26b76d,_0x5e99b4,_0x1c6ef7[_0x581619(0x206)]??LogLevel['ERROR'],{'accountName':_0x3730b1}),0x0;}console[_0x581619(0x1f1)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x26b76d),console['log']('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x581619(0x1f1)]('\x20\x20'+getConsoleUrl(_0x26b76d,_0x581619(0x1cd)));const _0xd3c1d1=await a33_0x7bf2df({'type':_0x581619(0x216),'name':_0x581619(0x214),'message':_0x581619(0x21f),'validate':_0x7dc241=>{const _0x1735ec=_0x581619;if(!_0x7dc241||!_0x7dc241['trim']())return _0x1735ec(0x1e6);return!![];}});if(!_0xd3c1d1['apiKey'])return console[_0x581619(0x1f1)]('\x0aSetup\x20cancelled'),0x1;const _0x2b1f20=_0xd3c1d1[_0x581619(0x214)];console[_0x581619(0x1f1)]('Validating\x20API\x20key...');try{const _0x5e5ca6=TDX[_0x581619(0x1eb)]({'site':_0x26b76d,'apiKey':_0x2b1f20[_0x581619(0x1fb)](),'logLevel':_0x1c6ef7['logLevel']??LogLevel[_0x581619(0x1c5)]}),_0x1113a4=await _0x5e5ca6[_0x581619(0x219)][_0x581619(0x1c1)]();console['log'](a33_0x1bf537[_0x581619(0x1dc)]('✓')+_0x581619(0x1d1)+_0x1113a4['email']+')');const _0x2a426f=await isKeychainAvailable();_0x2a426f?(await saveAPIKeyAsync(_0x2b1f20['trim'](),_0x26b76d,_0x5e99b4),console[_0x581619(0x1f1)](a33_0x1bf537[_0x581619(0x1dc)]('✓')+_0x581619(0x1d3)+_0x5e99b4+')')):(console['warn'](a33_0x1bf537[_0x581619(0x1bc)](_0x581619(0x204))),console['warn'](a33_0x1bf537[_0x581619(0x1bc)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x195080={'site':_0x26b76d,..._0x2918f8&&{'description':_0x2918f8}};return saveProfileToUserConfig(_0x5e99b4,_0x195080),console['log'](a33_0x1bf537[_0x581619(0x1dc)]('✓')+'\x20Profile\x20\x27'+_0x5e99b4+_0x581619(0x1cf)),console[_0x581619(0x1f1)](),console[_0x581619(0x1f1)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x581619(0x1f1)](_0x581619(0x1c9)+_0x5e99b4+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x581619(0x1f1)](_0x581619(0x1c9)+_0x5e99b4+_0x581619(0x201)),0x0;}catch(_0x48f9f8){if(_0x48f9f8 instanceof HTTPClientError&&_0x48f9f8[_0x581619(0x205)]===0x191)return printAuthError(_0x48f9f8),0x1;return console['error'](a33_0x1bf537[_0x581619(0x1e1)](_0x581619(0x1cc)+(_0x48f9f8 instanceof Error?_0x48f9f8[_0x581619(0x1ba)]:String(_0x48f9f8)))),console[_0x581619(0x1fd)](_0x581619(0x202)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0xaf0397(0x1e0)]=a33_0xaf0397(0x1d8);[a33_0xaf0397(0x1f7)]='Delete\x20a\x20profile';[a33_0xaf0397(0x21e)](_0x508a7d){const _0x2c0ca3=a33_0xaf0397,{args:_0x1a326c}=_0x508a7d;if(_0x1a326c[_0x2c0ca3(0x1fc)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>';return undefined;}async[a33_0xaf0397(0x1ff)](_0x30987d){const _0x5cae4f=a33_0xaf0397,{args:_0x5412ec}=_0x30987d,_0x30c4b3=_0x5412ec[0x0];console[_0x5cae4f(0x1f1)](a33_0x1bf537['bold'](_0x5cae4f(0x1f8)));if(!profileExists(_0x30c4b3)){console[_0x5cae4f(0x1fd)](a33_0x1bf537[_0x5cae4f(0x1e1)](_0x5cae4f(0x215)+_0x30c4b3+_0x5cae4f(0x1fe))),console[_0x5cae4f(0x1f1)](_0x5cae4f(0x1c7));const _0x4f884e=listProfiles();if(_0x4f884e[_0x5cae4f(0x1fc)]===0x0)console[_0x5cae4f(0x1f1)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x2ca8ee of _0x4f884e){console['log'](_0x5cae4f(0x20c)+_0x2ca8ee[_0x5cae4f(0x1e0)]);}return 0x1;}const _0x2048e2=await a33_0x7bf2df({'type':_0x5cae4f(0x1bf),'name':_0x5cae4f(0x1bf),'message':_0x5cae4f(0x1e9)+_0x30c4b3+'\x27?','initial':![]});if(!_0x2048e2[_0x5cae4f(0x1bf)])return console[_0x5cae4f(0x1f1)]('Removal\x20cancelled'),0x0;try{await deleteProfileAndCredentials(_0x30c4b3),console[_0x5cae4f(0x1f1)](a33_0x1bf537[_0x5cae4f(0x1dc)]('✓')+_0x5cae4f(0x1ed)+_0x30c4b3+_0x5cae4f(0x1be));}catch(_0x1aa962){return console[_0x5cae4f(0x1fd)](a33_0x1bf537[_0x5cae4f(0x1e1)](_0x5cae4f(0x1d5)+(_0x1aa962 instanceof Error?_0x1aa962['message']:String(_0x1aa962)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0xaf0397(0x1e0)]=a33_0xaf0397(0x1ef);['description']=a33_0xaf0397(0x223);static [a33_0xaf0397(0x207)]=['site',a33_0xaf0397(0x20f),'parent_segment',a33_0xaf0397(0x217),a33_0xaf0397(0x1c4),a33_0xaf0397(0x1f7)];[a33_0xaf0397(0x21e)](_0x1cc1e1){const _0x6735b=a33_0xaf0397,{args:_0x396ca5,options:_0x30bb36}=_0x1cc1e1,_0x1dd9c9=_0x30bb36[_0x6735b(0x1c8)]||getActiveProfile();if(!_0x1dd9c9)return _0x6735b(0x21a);if(_0x396ca5[_0x6735b(0x1fc)]===0x0)return _0x6735b(0x218)+ProfileSetCommand[_0x6735b(0x207)][_0x6735b(0x20d)](',\x20');const _0x2d7d6d=_0x396ca5[0x0];if(!_0x2d7d6d[_0x6735b(0x1de)]('='))return _0x6735b(0x1f2)+ProfileSetCommand[_0x6735b(0x207)][_0x6735b(0x20d)](',\x20');const [_0x13c9a6]=_0x2d7d6d[_0x6735b(0x1d0)]('=',0x2);if(!ProfileSetCommand[_0x6735b(0x207)]['includes'](_0x13c9a6))return _0x6735b(0x220)+_0x13c9a6+_0x6735b(0x1ec)+ProfileSetCommand[_0x6735b(0x207)][_0x6735b(0x20d)](',\x20');return undefined;}async[a33_0xaf0397(0x1ff)](_0x50fae9){const _0x10b0c1=a33_0xaf0397,{args:_0x526443,options:_0x365d41}=_0x50fae9,_0x1f309d=_0x365d41[_0x10b0c1(0x1c8)]||getActiveProfile(),[_0x168e60,..._0x127bb3]=_0x526443[0x0][_0x10b0c1(0x1d0)]('='),_0xb89c3b=_0x127bb3[_0x10b0c1(0x20d)]('=');console['log'](a33_0x1bf537[_0x10b0c1(0x1ea)](_0x10b0c1(0x1f0)));if(!profileExists(_0x1f309d)){const _0x514079=await a33_0x7bf2df({'type':_0x10b0c1(0x1bf),'name':'create','message':_0x10b0c1(0x215)+_0x1f309d+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x514079[_0x10b0c1(0x1eb)])return console[_0x10b0c1(0x1f1)](_0x10b0c1(0x212)),0x1;}const _0x48ec12=loadProfile(_0x1f309d),_0x24cd4f=_0x48ec12?.['config']||{};if(_0x168e60===_0x10b0c1(0x1f4)){const _0x1121c0=resolveSite(_0xb89c3b);console[_0x10b0c1(0x1f1)]('Changing\x20site\x20to\x20\x27'+_0x1121c0+_0x10b0c1(0x208)),console['log']('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x10b0c1(0x1f1)]('\x20\x20'+getConsoleUrl(_0x1121c0,_0x10b0c1(0x1cd)));const _0x349d69=await a33_0x7bf2df({'type':_0x10b0c1(0x216),'name':_0x10b0c1(0x214),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x5d3916=>{const _0x4a6f56=_0x10b0c1;if(!_0x5d3916||!_0x5d3916[_0x4a6f56(0x1fb)]())return _0x4a6f56(0x1e6);return!![];}});if(!_0x349d69[_0x10b0c1(0x214)])return console[_0x10b0c1(0x1f1)](_0x10b0c1(0x1ee)),0x1;console[_0x10b0c1(0x1f1)](_0x10b0c1(0x1da));try{const _0xdcd2bb=TDX[_0x10b0c1(0x1eb)]({'site':_0x1121c0,'apiKey':_0x349d69[_0x10b0c1(0x214)]['trim'](),'logLevel':_0x365d41['logLevel']??LogLevel[_0x10b0c1(0x1c5)]}),_0x5624b2=await _0xdcd2bb[_0x10b0c1(0x219)]['getUserInfo']();console[_0x10b0c1(0x1f1)](a33_0x1bf537['green']('✓')+_0x10b0c1(0x1d1)+_0x5624b2[_0x10b0c1(0x210)]+')');const _0x4a8628=await isKeychainAvailable();_0x4a8628?(await saveAPIKeyAsync(_0x349d69[_0x10b0c1(0x214)][_0x10b0c1(0x1fb)](),_0x1121c0,_0x1f309d),console['log'](a33_0x1bf537[_0x10b0c1(0x1dc)]('✓')+_0x10b0c1(0x1fa))):console[_0x10b0c1(0x203)](a33_0x1bf537[_0x10b0c1(0x1bc)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x24cd4f[_0x10b0c1(0x1f4)]=_0x1121c0;}catch(_0x42be44){if(_0x42be44 instanceof HTTPClientError&&_0x42be44['status']===0x191)return printAuthError(_0x42be44),0x1;return console[_0x10b0c1(0x1fd)](a33_0x1bf537[_0x10b0c1(0x1e1)](_0x10b0c1(0x1cc)+(_0x42be44 instanceof Error?_0x42be44[_0x10b0c1(0x1ba)]:String(_0x42be44)))),console['error'](_0x10b0c1(0x221)),0x1;}}else _0x24cd4f[_0x168e60]=_0xb89c3b||undefined;return saveProfileToUserConfig(_0x1f309d,_0x24cd4f),console[_0x10b0c1(0x1f1)](a33_0x1bf537[_0x10b0c1(0x1dc)]('✓')+_0x10b0c1(0x1ed)+_0x1f309d+_0x10b0c1(0x200)+_0x168e60+'='+(_0xb89c3b||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a33_0xaf0397(0x222);['description']=a33_0xaf0397(0x1cb);[a33_0xaf0397(0x21e)](_0xd0543f){const _0x220987=a33_0xaf0397,{args:_0x536f30}=_0xd0543f;if(_0x536f30[_0x220987(0x1fc)]===0x0)return _0x220987(0x1c3);return undefined;}async[a33_0xaf0397(0x1ff)](_0x467864){const _0x1c8102=a33_0xaf0397,{args:_0x36fd92,options:_0x2bdd28}=_0x467864,_0x41d604=_0x36fd92[0x0],_0x3e1233=_0x2bdd28[_0x1c8102(0x1dd)];cleanExpiredSessions();if(!profileExists(_0x41d604)){console[_0x1c8102(0x1fd)](a33_0x1bf537[_0x1c8102(0x1e1)]('Profile\x20\x27'+_0x41d604+'\x27\x20does\x20not\x20exist.')),console['log'](_0x1c8102(0x1c7));const _0x2f3889=listProfiles();if(_0x2f3889[_0x1c8102(0x1fc)]===0x0)console[_0x1c8102(0x1f1)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x1a8660 of _0x2f3889){console[_0x1c8102(0x1f1)]('\x20\x20-\x20'+_0x1a8660[_0x1c8102(0x1e0)]);}return 0x1;}if(_0x3e1233){const _0x4a2904=a33_0x21128d['join'](getConfigDir(),_0x1c8102(0x1e5));return saveActiveProfileToUserConfig(_0x41d604),console[_0x1c8102(0x1f1)](_0x1c8102(0x1c0)+a33_0x1bf537[_0x1c8102(0x1dc)](_0x41d604)),console['log'](a33_0x1bf537['dim'](_0x1c8102(0x1e3)+_0x4a2904)),0x0;}const _0x2b0a11=getSessionID(_0x2bdd28['session']);return saveSessionContext({'profile':_0x41d604},_0x2bdd28[_0x1c8102(0x1c2)]),console[_0x1c8102(0x1f1)](_0x1c8102(0x1db)+a33_0x1bf537[_0x1c8102(0x1dc)](_0x41d604)+'\x20'+a33_0x1bf537[_0x1c8102(0x1f9)](_0x1c8102(0x20e)+_0x2b0a11+')')),console[_0x1c8102(0x1f1)](a33_0x1bf537['dim']('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x41d604+_0x1c8102(0x1f3))),0x0;}}
1
+ function a33_0x4a79(_0x5961c3,_0x5a887b){_0x5961c3=_0x5961c3-0xf8;const _0x42ec31=a33_0x42ec();let _0x4a79d6=_0x42ec31[_0x5961c3];return _0x4a79d6;}const a33_0x36aa88=a33_0x4a79;(function(_0x1002ce,_0x1e4fa3){const _0x26f814=a33_0x4a79,_0x5b4ad9=_0x1002ce();while(!![]){try{const _0x47edb1=-parseInt(_0x26f814(0xfd))/0x1+parseInt(_0x26f814(0x12d))/0x2+-parseInt(_0x26f814(0x127))/0x3+-parseInt(_0x26f814(0x118))/0x4*(parseInt(_0x26f814(0x11f))/0x5)+-parseInt(_0x26f814(0x15e))/0x6+-parseInt(_0x26f814(0x109))/0x7+parseInt(_0x26f814(0x10d))/0x8;if(_0x47edb1===_0x1e4fa3)break;else _0x5b4ad9['push'](_0x5b4ad9['shift']());}catch(_0x516a01){_0x5b4ad9['push'](_0x5b4ad9['shift']());}}}(a33_0x42ec,0xe8708));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a33_0x408218 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';function a33_0x42ec(){const _0x3cfc02=['Changing\x20site\x20to\x20\x27','(cleared)','parent_segment','profile:create','force','execute','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x20\x20(no\x20profiles\x20found)','Unknown\x20key\x20\x27','status','red','create','includes','Removed\x20existing\x20profile\x20\x27','\x20\x20tdx\x20--profile\x20','\x27\x20deleted','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','oauth','apiKey','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','message','confirm','\x20API\x20key\x20is\x20valid\x20(User:\x20','tdx.json','default','site','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','session','/app/mp/ak','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Set\x20a\x20profile\x20configuration\x20value','Profile\x20\x27','llm_project','✗\x20Validation\x20failed:\x20','\x20Profile\x20\x27','Enter\x20description\x20(optional):','8561430tKfyxJ','\x27\x20does\x20not\x20exist.','\x27\x20updated:\x20','jobs','VALID_KEYS','config','us01','Default\x20profile\x20set\x20to:\x20','\x0aSetup\x20cancelled','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','tdx:\x20profile\x20delete','954789cXBxSp','Delete\x20a\x20profile','Set\x20session\x20profile','Create\x20a\x20new\x20profile','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','tdx:\x20profile\x20create','profile','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','all','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','join','yellow','4111723Xbovpk','Session\x20profile\x20set\x20to:\x20','profile:delete','length','32929608ZeLhXd','trim','split','Operation\x20cancelled','description','green','bold','database','validate','API\x20key\x20cannot\x20be\x20empty','name','4TkTHcG','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','\x0aAvailable\x20profiles:','email','ERROR','profile:set','\x20API\x20key\x20saved\x20to\x20system\x20keychain','890665tHpbfc','log','error','getUserInfo','text','profile:use','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','\x20--default\x27\x20to\x20save\x20permanently','568662onzFBa','Validating\x20API\x20key...','(session:\x20','llm_agent','password','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','345282kbmZoW','profileName','logLevel','dim','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','\x27\x20requires\x20API\x20key\x20validation.','Enter\x20your\x20TD\x20API\x20key:','\x27.\x0a\x0aValid\x20keys:\x20','warn','Profile\x20name\x20cannot\x20be\x20empty'];a33_0x42ec=function(){return _0x3cfc02;};return a33_0x42ec();}import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a33_0xa63d20 from'prompts';import a33_0x2ddaba from'chalk';function validateProfileName(_0x31d064,_0x19869b){const _0x51490b=a33_0x4a79;if(!_0x31d064||!_0x31d064[_0x51490b(0x10e)]())return _0x51490b(0x136);const _0x10a244=_0x31d064[_0x51490b(0x10e)]();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x10a244))return _0x51490b(0x101);if(!_0x19869b?.['skipExistsCheck']&&profileExists(_0x10a244))return'Profile\x20\x27'+_0x10a244+_0x51490b(0x147)+_0x10a244+'\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.';return!![];}async function deleteProfileAndCredentials(_0x256d66){const _0x473c53=a33_0x4a79;removeProfileFromUserConfig(_0x256d66);const _0x23399e=await isKeychainAvailable();_0x23399e&&await Promise[_0x473c53(0x105)]([deleteKeychainAPIKey(_0x256d66),deleteOAuthTokens(_0x256d66)]);}export class ProfileCreateCommand extends BaseCommand{['name']=a33_0x36aa88(0x13a);[a33_0x36aa88(0x111)]=a33_0x36aa88(0x100);async['execute'](_0x2672c1){const _0x450580=a33_0x36aa88,{options:_0x2cfaee,args:_0x4c6eba}=_0x2672c1,_0x49775=!!_0x2cfaee[_0x450580(0x13b)];console[_0x450580(0x120)](a33_0x2ddaba[_0x450580(0x113)](_0x450580(0x102)));let _0x4dcd67;if(_0x4c6eba[_0x450580(0x10c)]>0x0&&_0x4c6eba[0x0]){const _0x1a8127=_0x4c6eba[0x0]['trim']();_0x49775&&profileExists(_0x1a8127)&&(await deleteProfileAndCredentials(_0x1a8127),console[_0x450580(0x120)](_0x450580(0x144)+_0x1a8127+'\x27'));const _0x47045f=validateProfileName(_0x1a8127);if(_0x47045f!==!![])return console[_0x450580(0x121)](a33_0x2ddaba[_0x450580(0x141)](_0x47045f)),0x1;_0x4dcd67=_0x1a8127;}else{const _0xe86dde=await a33_0xa63d20({'type':_0x450580(0x123),'name':_0x450580(0x12e),'message':'Enter\x20profile\x20name:','validate':_0x384286=>validateProfileName(_0x384286,{'skipExistsCheck':_0x49775})});if(!_0xe86dde[_0x450580(0x12e)])return console[_0x450580(0x120)]('\x0aSetup\x20cancelled'),0x1;_0x4dcd67=_0xe86dde[_0x450580(0x12e)]['trim'](),_0x49775&&profileExists(_0x4dcd67)&&(await deleteProfileAndCredentials(_0x4dcd67),console[_0x450580(0x120)](_0x450580(0x144)+_0x4dcd67+'\x27'));}const _0x8e3af1=await a33_0xa63d20({'type':_0x450580(0x123),'name':_0x450580(0x111),'message':_0x450580(0x15d)}),_0x281932=_0x8e3af1['description']?.[_0x450580(0x10e)]()||undefined,_0x4fd741=_0x2cfaee[_0x450580(0x152)]||_0x450580(0xf8),_0x3ff392=await promptSiteSelection(_0x4fd741,_0x4dcd67,'Setup\x20cancelled');if(!_0x3ff392)return 0x1;const _0x4f2475=resolveSite(_0x3ff392),_0x403451=await promptAuthMethod();if(!_0x403451)return console[_0x450580(0x120)](_0x450580(0xfa)),0x1;if(_0x403451===_0x450580(0x149)){if(_0x281932){const _0x29097d={'site':_0x4f2475,'description':_0x281932};saveProfileToUserConfig(_0x4dcd67,_0x29097d);}const {accountName:_0x5bff95}=_0x2cfaee;return await runOAuthLoginFlow(_0x4f2475,_0x4dcd67,_0x2cfaee['logLevel']??LogLevel[_0x450580(0x11c)],{'accountName':_0x5bff95}),0x0;}console['log'](_0x450580(0x14c)+_0x4f2475),console[_0x450580(0x120)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x450580(0x120)]('\x20\x20'+getConsoleUrl(_0x4f2475,_0x450580(0x156)));const _0x1c9cae=await a33_0xa63d20({'type':_0x450580(0x12b),'name':'apiKey','message':_0x450580(0x133),'validate':_0x40a436=>{const _0x11fdd0=_0x450580;if(!_0x40a436||!_0x40a436['trim']())return _0x11fdd0(0x116);return!![];}});if(!_0x1c9cae[_0x450580(0x14a)])return console['log'](_0x450580(0xfa)),0x1;const _0x2d6d29=_0x1c9cae[_0x450580(0x14a)];console[_0x450580(0x120)](_0x450580(0x128));try{const _0x5391ec=TDX[_0x450580(0x142)]({'site':_0x4f2475,'apiKey':_0x2d6d29['trim'](),'logLevel':_0x2cfaee['logLevel']??LogLevel[_0x450580(0x11c)]}),_0x318d70=await _0x5391ec[_0x450580(0x161)][_0x450580(0x122)]();console['log'](a33_0x2ddaba[_0x450580(0x112)]('✓')+_0x450580(0x14f)+_0x318d70['email']+')');const _0x532c21=await isKeychainAvailable();_0x532c21?(await saveAPIKeyAsync(_0x2d6d29[_0x450580(0x10e)](),_0x4f2475,_0x4dcd67),console[_0x450580(0x120)](a33_0x2ddaba[_0x450580(0x112)]('✓')+_0x450580(0x119)+_0x4dcd67+')')):(console[_0x450580(0x135)](a33_0x2ddaba[_0x450580(0x108)](_0x450580(0x157))),console['warn'](a33_0x2ddaba['yellow'](_0x450580(0x131))));const _0x373b3e={'site':_0x4f2475,..._0x281932&&{'description':_0x281932}};return saveProfileToUserConfig(_0x4dcd67,_0x373b3e),console[_0x450580(0x120)](a33_0x2ddaba[_0x450580(0x112)]('✓')+_0x450580(0x15c)+_0x4dcd67+'\x27\x20created'),console[_0x450580(0x120)](),console['log'](_0x450580(0x106)),console[_0x450580(0x120)](_0x450580(0x145)+_0x4dcd67+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console['log'](_0x450580(0x145)+_0x4dcd67+_0x450580(0x12c)),0x0;}catch(_0x2d5ef6){if(_0x2d5ef6 instanceof HTTPClientError&&_0x2d5ef6[_0x450580(0x140)]===0x191)return printAuthError(_0x2d5ef6),0x1;return console[_0x450580(0x121)](a33_0x2ddaba[_0x450580(0x141)](_0x450580(0x15b)+(_0x2d5ef6 instanceof Error?_0x2d5ef6[_0x450580(0x14d)]:String(_0x2d5ef6)))),console[_0x450580(0x121)](_0x450580(0x125)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x36aa88(0x117)]=a33_0x36aa88(0x10b);[a33_0x36aa88(0x111)]=a33_0x36aa88(0xfe);['validate'](_0x5d5667){const _0x4976be=a33_0x36aa88,{args:_0x144007}=_0x5d5667;if(_0x144007[_0x4976be(0x10c)]===0x0)return _0x4976be(0x154);return undefined;}async[a33_0x36aa88(0x13c)](_0x2d3bc4){const _0xf1ac1e=a33_0x36aa88,{args:_0x131296}=_0x2d3bc4,_0x234b5b=_0x131296[0x0];console[_0xf1ac1e(0x120)](a33_0x2ddaba[_0xf1ac1e(0x113)](_0xf1ac1e(0xfc)));if(!profileExists(_0x234b5b)){console[_0xf1ac1e(0x121)](a33_0x2ddaba[_0xf1ac1e(0x141)](_0xf1ac1e(0x159)+_0x234b5b+_0xf1ac1e(0x15f))),console[_0xf1ac1e(0x120)]('\x0aAvailable\x20profiles:');const _0x71f669=listProfiles();if(_0x71f669['length']===0x0)console[_0xf1ac1e(0x120)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x5e772a of _0x71f669){console[_0xf1ac1e(0x120)]('\x20\x20-\x20'+_0x5e772a[_0xf1ac1e(0x117)]);}return 0x1;}const _0x5b3e7f=await a33_0xa63d20({'type':_0xf1ac1e(0x14e),'name':'confirm','message':_0xf1ac1e(0x104)+_0x234b5b+'\x27?','initial':![]});if(!_0x5b3e7f[_0xf1ac1e(0x14e)])return console[_0xf1ac1e(0x120)]('Removal\x20cancelled'),0x0;try{await deleteProfileAndCredentials(_0x234b5b),console[_0xf1ac1e(0x120)](a33_0x2ddaba['green']('✓')+_0xf1ac1e(0x15c)+_0x234b5b+_0xf1ac1e(0x146));}catch(_0x2e56f1){return console[_0xf1ac1e(0x121)](a33_0x2ddaba[_0xf1ac1e(0x141)]('Failed\x20to\x20delete\x20profile:\x20'+(_0x2e56f1 instanceof Error?_0x2e56f1[_0xf1ac1e(0x14d)]:String(_0x2e56f1)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a33_0x36aa88(0x11d);[a33_0x36aa88(0x111)]=a33_0x36aa88(0x158);static [a33_0x36aa88(0x162)]=[a33_0x36aa88(0x152),a33_0x36aa88(0x114),a33_0x36aa88(0x139),a33_0x36aa88(0x15a),a33_0x36aa88(0x12a),'description'];[a33_0x36aa88(0x115)](_0x46304d){const _0x1a6c41=a33_0x36aa88,{args:_0x2193f7,options:_0x44ef5c}=_0x46304d,_0x5af316=_0x44ef5c[_0x1a6c41(0x103)]||getActiveProfile();if(!_0x5af316)return'No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>';if(_0x2193f7[_0x1a6c41(0x10c)]===0x0)return _0x1a6c41(0x148)+ProfileSetCommand[_0x1a6c41(0x162)][_0x1a6c41(0x107)](',\x20');const _0x8e4c9d=_0x2193f7[0x0];if(!_0x8e4c9d[_0x1a6c41(0x143)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x1a6c41(0x162)]['join'](',\x20');const [_0x4c9712]=_0x8e4c9d[_0x1a6c41(0x10f)]('=',0x2);if(!ProfileSetCommand[_0x1a6c41(0x162)][_0x1a6c41(0x143)](_0x4c9712))return _0x1a6c41(0x13f)+_0x4c9712+_0x1a6c41(0x134)+ProfileSetCommand[_0x1a6c41(0x162)][_0x1a6c41(0x107)](',\x20');return undefined;}async[a33_0x36aa88(0x13c)](_0x255078){const _0x5c00e7=a33_0x36aa88,{args:_0x22b923,options:_0xfec72a}=_0x255078,_0x171b12=_0xfec72a[_0x5c00e7(0x103)]||getActiveProfile(),[_0x53f7bd,..._0x338a3c]=_0x22b923[0x0][_0x5c00e7(0x10f)]('='),_0x3c47b7=_0x338a3c[_0x5c00e7(0x107)]('=');console[_0x5c00e7(0x120)](a33_0x2ddaba[_0x5c00e7(0x113)]('tdx:\x20profile\x20set'));if(!profileExists(_0x171b12)){const _0x58b61a=await a33_0xa63d20({'type':_0x5c00e7(0x14e),'name':'create','message':_0x5c00e7(0x159)+_0x171b12+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x58b61a[_0x5c00e7(0x142)])return console[_0x5c00e7(0x120)](_0x5c00e7(0x110)),0x1;}const _0x3f2e19=loadProfile(_0x171b12),_0x60245b=_0x3f2e19?.[_0x5c00e7(0x163)]||{};if(_0x53f7bd===_0x5c00e7(0x152)){const _0x1721e6=resolveSite(_0x3c47b7);console[_0x5c00e7(0x120)](_0x5c00e7(0x137)+_0x1721e6+_0x5c00e7(0x132)),console[_0x5c00e7(0x120)](_0x5c00e7(0x153)),console[_0x5c00e7(0x120)]('\x20\x20'+getConsoleUrl(_0x1721e6,'/app/mp/ak'));const _0x41f077=await a33_0xa63d20({'type':'password','name':_0x5c00e7(0x14a),'message':_0x5c00e7(0x13d),'validate':_0x26eee8=>{if(!_0x26eee8||!_0x26eee8['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x41f077['apiKey'])return console[_0x5c00e7(0x120)]('\x0aOperation\x20cancelled'),0x1;console['log'](_0x5c00e7(0x128));try{const _0xf1fce7=TDX[_0x5c00e7(0x142)]({'site':_0x1721e6,'apiKey':_0x41f077[_0x5c00e7(0x14a)]['trim'](),'logLevel':_0xfec72a[_0x5c00e7(0x12f)]??LogLevel[_0x5c00e7(0x11c)]}),_0x52187f=await _0xf1fce7[_0x5c00e7(0x161)][_0x5c00e7(0x122)]();console[_0x5c00e7(0x120)](a33_0x2ddaba[_0x5c00e7(0x112)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x52187f[_0x5c00e7(0x11b)]+')');const _0x5e9ad7=await isKeychainAvailable();_0x5e9ad7?(await saveAPIKeyAsync(_0x41f077['apiKey'][_0x5c00e7(0x10e)](),_0x1721e6,_0x171b12),console[_0x5c00e7(0x120)](a33_0x2ddaba[_0x5c00e7(0x112)]('✓')+_0x5c00e7(0x11e))):console[_0x5c00e7(0x135)](a33_0x2ddaba[_0x5c00e7(0x108)](_0x5c00e7(0x157))),_0x60245b['site']=_0x1721e6;}catch(_0xf00909){if(_0xf00909 instanceof HTTPClientError&&_0xf00909[_0x5c00e7(0x140)]===0x191)return printAuthError(_0xf00909),0x1;return console[_0x5c00e7(0x121)](a33_0x2ddaba[_0x5c00e7(0x141)]('✗\x20Validation\x20failed:\x20'+(_0xf00909 instanceof Error?_0xf00909[_0x5c00e7(0x14d)]:String(_0xf00909)))),console[_0x5c00e7(0x121)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x60245b[_0x53f7bd]=_0x3c47b7||undefined;return saveProfileToUserConfig(_0x171b12,_0x60245b),console['log'](a33_0x2ddaba['green']('✓')+_0x5c00e7(0x15c)+_0x171b12+_0x5c00e7(0x160)+_0x53f7bd+'='+(_0x3c47b7||_0x5c00e7(0x138))),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a33_0x36aa88(0x124);['description']=a33_0x36aa88(0xff);[a33_0x36aa88(0x115)](_0x30c34b){const _0x4f55c8=a33_0x36aa88,{args:_0x72ad81}=_0x30c34b;if(_0x72ad81[_0x4f55c8(0x10c)]===0x0)return _0x4f55c8(0x14b);return undefined;}async[a33_0x36aa88(0x13c)](_0x4ab256){const _0x4307ea=a33_0x36aa88,{args:_0x4f298c,options:_0x1ac797}=_0x4ab256,_0x41a9e=_0x4f298c[0x0],_0x360ea7=_0x1ac797[_0x4307ea(0x151)];cleanExpiredSessions();if(!profileExists(_0x41a9e)){console[_0x4307ea(0x121)](a33_0x2ddaba['red']('Profile\x20\x27'+_0x41a9e+'\x27\x20does\x20not\x20exist.')),console[_0x4307ea(0x120)](_0x4307ea(0x11a));const _0x27a1b4=listProfiles();if(_0x27a1b4[_0x4307ea(0x10c)]===0x0)console[_0x4307ea(0x120)](_0x4307ea(0x13e));else for(const _0x31c547 of _0x27a1b4){console['log']('\x20\x20-\x20'+_0x31c547[_0x4307ea(0x117)]);}return 0x1;}if(_0x360ea7){const _0x1cea0f=a33_0x408218[_0x4307ea(0x107)](getConfigDir(),_0x4307ea(0x150));return saveActiveProfileToUserConfig(_0x41a9e),console[_0x4307ea(0x120)](_0x4307ea(0xf9)+a33_0x2ddaba[_0x4307ea(0x112)](_0x41a9e)),console[_0x4307ea(0x120)](a33_0x2ddaba['dim']('\x0aSaved\x20to:\x20'+_0x1cea0f)),0x0;}const _0x5d4629=getSessionID(_0x1ac797[_0x4307ea(0x155)]);return saveSessionContext({'profile':_0x41a9e},_0x1ac797[_0x4307ea(0x155)]),console[_0x4307ea(0x120)](_0x4307ea(0x10a)+a33_0x2ddaba[_0x4307ea(0x112)](_0x41a9e)+'\x20'+a33_0x2ddaba[_0x4307ea(0x130)](_0x4307ea(0x129)+_0x5d4629+')')),console[_0x4307ea(0x120)](a33_0x2ddaba[_0x4307ea(0x130)](_0x4307ea(0xfb)+_0x41a9e+_0x4307ea(0x126))),0x0;}}
@@ -1 +1 @@
1
- function a34_0xe1eb(){const _0x1270d5=['1348968RJiDAt','description','profiles','👤\x20','18335061lVNGEQ','70542AFtsuV','2823632yXwymO','4814dMNBGm','green','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','execute','log','7IeKVBi','scope','error','site','name','length','dim','430843OYOpIT','config','417SmDgMm','message','3681915AXnSwJ'];a34_0xe1eb=function(){return _0x1270d5;};return a34_0xe1eb();}const a34_0x2c7e34=a34_0x5b24;(function(_0x56d0c6,_0x531e6f){const _0x61e898=a34_0x5b24,_0x3815eb=_0x56d0c6();while(!![]){try{const _0x5341c2=parseInt(_0x61e898(0x9e))/0x1+-parseInt(_0x61e898(0x92))/0x2*(parseInt(_0x61e898(0xa0))/0x3)+-parseInt(_0x61e898(0x91))/0x4+-parseInt(_0x61e898(0xa2))/0x5+-parseInt(_0x61e898(0x90))/0x6+-parseInt(_0x61e898(0x97))/0x7*(parseInt(_0x61e898(0xa3))/0x8)+parseInt(_0x61e898(0x8f))/0x9;if(_0x5341c2===_0x531e6f)break;else _0x3815eb['push'](_0x3815eb['shift']());}catch(_0x3cdada){_0x3815eb['push'](_0x3815eb['shift']());}}}(a34_0xe1eb,0x7cb6e));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a34_0x5b24(_0x88696c,_0x4b69c4){_0x88696c=_0x88696c-0x8c;const _0xe1eb83=a34_0xe1eb();let _0x5b24c9=_0xe1eb83[_0x88696c];return _0x5b24c9;}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x1b2ac2 from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x2c7e34(0x9b)]=a34_0x2c7e34(0x8d);[a34_0x2c7e34(0x8c)]='List\x20all\x20available\x20profiles';async[a34_0x2c7e34(0x95)](_0xb859ad){const _0x30cd83=a34_0x2c7e34,{options:_0x30c898}=_0xb859ad;try{const _0x53dfc0=listProfiles(),_0x3535d1=getActiveProfile();if(_0x53dfc0[_0x30cd83(0x9c)]===0x0)return console[_0x30cd83(0x96)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console['log'](_0x30cd83(0x94)),console[_0x30cd83(0x96)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x11e51c=_0x53dfc0['map'](_0x1ec1e3=>{const _0x30874b=_0x30cd83,_0x56e680=_0x1ec1e3[_0x30874b(0x9b)]===_0x3535d1,_0x4d3714=getProfileParams(_0x1ec1e3['config']);return{'name':_0x1ec1e3[_0x30874b(0x9b)],'active':_0x56e680,'scope':_0x1ec1e3[_0x30874b(0x98)],'description':_0x1ec1e3['config'][_0x30874b(0x8c)]||'','params':_0x4d3714};});if(isStructuredFormat(_0x30c898))await handleSDKOutput(_0x11e51c,_0x30c898);else for(const _0x59e45c of _0x53dfc0){const _0xfe5f51=_0x59e45c['name']===_0x3535d1?a34_0x1b2ac2[_0x30cd83(0x93)]('\x20✓'):'',_0x1d63e1=_0x59e45c[_0x30cd83(0x9f)]['site']?a34_0x1b2ac2[_0x30cd83(0x9d)]('\x20'+_0x59e45c['config'][_0x30cd83(0x9a)]):'',_0x2d4547=_0x59e45c[_0x30cd83(0x9f)][_0x30cd83(0x8c)]?a34_0x1b2ac2[_0x30cd83(0x9d)]('\x20\x20'+_0x59e45c[_0x30cd83(0x9f)][_0x30cd83(0x8c)]):'';console[_0x30cd83(0x96)](_0x30cd83(0x8e)+_0x59e45c[_0x30cd83(0x9b)]+_0xfe5f51+_0x1d63e1+_0x2d4547);}return 0x0;}catch(_0x7a8961){return _0x7a8961 instanceof Error&&console[_0x30cd83(0x99)]('Error:\x20'+_0x7a8961[_0x30cd83(0xa1)]),0x1;}}}
1
+ const a34_0x4a5e6e=a34_0x1e87;(function(_0x3de506,_0x4b10fa){const _0x393774=a34_0x1e87,_0x617e25=_0x3de506();while(!![]){try{const _0x7519bf=parseInt(_0x393774(0x6d))/0x1*(-parseInt(_0x393774(0x80))/0x2)+-parseInt(_0x393774(0x79))/0x3+parseInt(_0x393774(0x70))/0x4*(-parseInt(_0x393774(0x7b))/0x5)+-parseInt(_0x393774(0x71))/0x6+-parseInt(_0x393774(0x77))/0x7*(parseInt(_0x393774(0x82))/0x8)+parseInt(_0x393774(0x6c))/0x9*(parseInt(_0x393774(0x84))/0xa)+parseInt(_0x393774(0x81))/0xb;if(_0x7519bf===_0x4b10fa)break;else _0x617e25['push'](_0x617e25['shift']());}catch(_0x531228){_0x617e25['push'](_0x617e25['shift']());}}}(a34_0x18e8,0x4d065));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a34_0x1e87(_0x55065e,_0x18b9f7){_0x55065e=_0x55065e-0x6a;const _0x18e815=a34_0x18e8();let _0x1e8700=_0x18e815[_0x55065e];return _0x1e8700;}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x34a8fa from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x4a5e6e(0x75)]=a34_0x4a5e6e(0x74);['description']=a34_0x4a5e6e(0x7c);async[a34_0x4a5e6e(0x83)](_0x26e474){const _0x4a7d0a=a34_0x4a5e6e,{options:_0x5c171b}=_0x26e474;try{const _0x13a15e=listProfiles(),_0x377885=getActiveProfile();if(_0x13a15e[_0x4a7d0a(0x7d)]===0x0)return console[_0x4a7d0a(0x7a)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console['log']('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console['log'](_0x4a7d0a(0x78)),0x0;const _0x38ace6=_0x13a15e[_0x4a7d0a(0x76)](_0x222ad6=>{const _0x129c59=_0x4a7d0a,_0x5b31ea=_0x222ad6['name']===_0x377885,_0x24c7df=getProfileParams(_0x222ad6['config']);return{'name':_0x222ad6['name'],'active':_0x5b31ea,'scope':_0x222ad6[_0x129c59(0x73)],'description':_0x222ad6[_0x129c59(0x72)][_0x129c59(0x6b)]||'','params':_0x24c7df};});if(isStructuredFormat(_0x5c171b))await handleSDKOutput(_0x38ace6,_0x5c171b);else for(const _0x3468f5 of _0x13a15e){const _0x571e10=_0x3468f5[_0x4a7d0a(0x75)]===_0x377885?a34_0x34a8fa['green']('\x20✓'):'',_0x6035d4=_0x3468f5[_0x4a7d0a(0x72)][_0x4a7d0a(0x6f)]?a34_0x34a8fa[_0x4a7d0a(0x7f)]('\x20'+_0x3468f5['config'][_0x4a7d0a(0x6f)]):'',_0x7a64ea=_0x3468f5[_0x4a7d0a(0x72)][_0x4a7d0a(0x6b)]?a34_0x34a8fa[_0x4a7d0a(0x7f)]('\x20\x20'+_0x3468f5[_0x4a7d0a(0x72)][_0x4a7d0a(0x6b)]):'';console['log'](_0x4a7d0a(0x6a)+_0x3468f5[_0x4a7d0a(0x75)]+_0x571e10+_0x6035d4+_0x7a64ea);}return 0x0;}catch(_0x3c1186){return _0x3c1186 instanceof Error&&console['error'](_0x4a7d0a(0x7e)+_0x3c1186[_0x4a7d0a(0x6e)]),0x1;}}}function a34_0x18e8(){const _0x2d56ab=['258ecvHvz','17565317SzZCpk','40izZoUk','execute','10XuIcAN','👤\x20','description','5629473qefvmo','4243pFQNEh','message','site','12ODhYkA','760506NQMxqq','config','scope','profiles','name','map','646128rGouKx','\x20\x20Global:\x20~/.config/tdx/tdx.json','1005108fEMQav','log','726995ruAroV','List\x20all\x20available\x20profiles','length','Error:\x20','dim'];a34_0x18e8=function(){return _0x2d56ab;};return a34_0x18e8();}
@@ -1 +1 @@
1
- const a35_0x315343=a35_0x49cd;(function(_0x2fe816,_0x52a3f6){const _0x5642d3=a35_0x49cd,_0x5c7e94=_0x2fe816();while(!![]){try{const _0x20cb2e=parseInt(_0x5642d3(0x7f))/0x1+parseInt(_0x5642d3(0x77))/0x2+parseInt(_0x5642d3(0x8a))/0x3+-parseInt(_0x5642d3(0x7e))/0x4+parseInt(_0x5642d3(0x76))/0x5+-parseInt(_0x5642d3(0x7d))/0x6+parseInt(_0x5642d3(0x78))/0x7*(parseInt(_0x5642d3(0x9a))/0x8);if(_0x20cb2e===_0x52a3f6)break;else _0x5c7e94['push'](_0x5c7e94['shift']());}catch(_0xe364a5){_0x5c7e94['push'](_0x5c7e94['shift']());}}}(a35_0x3a70,0x8dff3));import{BaseCommand}from'./command.js';function a35_0x49cd(_0x2b3c52,_0xc64523){_0x2b3c52=_0x2b3c52-0x70;const _0x3a7027=a35_0x3a70();let _0x49cd51=_0x3a7027[_0x2b3c52];return _0x49cd51;}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 a35_0x3a70(){const _0x3ac62a=['setPhase','information_schema','Run\x20Trino\x20queries\x20(streaming)','Executing\x20query...','site','file','\x0aAll\x20results\x20saved\x20to\x20','Site:\x20','...','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','Catalog:\x20','3157540whdezn','781326UhkbEE','87297FHcStY','setExtra','catalog','\x20[Job\x20ID:\x20','execute','6704886pMqOGF','1574544gdQNmy','708520KygnnK','args','length','Executing\x20statement\x20','setJobId','Schema:\x20','Executing\x20query\x20[','database','totalSplits','Query\x20completed:\x20Processed\x20','processedRows','337875vKbXaK','message','verbose','stats','\x20-\x20','\x20splits','description','Error:\x20','SQL:\x20','error','Statement\x20','No\x20SQL\x20provided','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','join','output','jobId','160syUlEB'];a35_0x3a70=function(){return _0x3ac62a;};return a35_0x3a70();}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']='query';[a35_0x315343(0x90)]=a35_0x315343(0x9d);async[a35_0x315343(0x7c)](_0x37cba1){const _0x3d0630=a35_0x315343,{options:_0x4b85c4,args:_0x465463,tdx:_0x1e88df}=_0x37cba1,_0x108cba={..._0x4b85c4,'limitStructuredFormats':!![]},_0x299b20=_0x465463[0x0],_0x5a21fe=_0x4b85c4[_0x3d0630(0x70)];let _0x23f0a5;try{if(_0x5a21fe)_0x23f0a5=readSqlStatementsFromFile(_0x5a21fe);else{if(_0x299b20==='-')_0x23f0a5=await readSqlStatementsFromStdin();else{if(_0x299b20&&isSqlFilePath(_0x299b20))_0x23f0a5=readSqlStatementsFromFile(_0x299b20);else{if(_0x299b20)_0x23f0a5=splitSqlStatements(_0x299b20);else throw new Error(_0x3d0630(0x95));}}}}catch(_0x46e34d){return console[_0x3d0630(0x93)](_0x3d0630(0x91)+_0x46e34d[_0x3d0630(0x8b)]),0x1;}const _0x1d983a=_0x4b85c4[_0x3d0630(0x86)]||_0x3d0630(0x9c),_0x36639c=_0x4b85c4[_0x3d0630(0x7a)];try{const _0x3f9f9d=[],_0x3b006d=!!_0x4b85c4['output'];for(let _0x9e464f=0x0;_0x9e464f<_0x23f0a5[_0x3d0630(0x81)];_0x9e464f++){const _0x2975ee=_0x23f0a5[_0x9e464f],_0xa7817=_0x9e464f+0x1,_0x430551=_0x23f0a5[_0x3d0630(0x81)],_0x5da2b3=_0x430551>0x1;_0x4b85c4[_0x3d0630(0x8c)]&&(console[_0x3d0630(0x93)]('\x0a'+(_0x5da2b3?'Statement\x20'+_0xa7817+'/'+_0x430551+':':'')),console[_0x3d0630(0x93)](_0x3d0630(0x72)+_0x4b85c4[_0x3d0630(0x9f)]),console[_0x3d0630(0x93)](_0x3d0630(0x75)+(_0x36639c||'td')),console[_0x3d0630(0x93)](_0x3d0630(0x84)+_0x1d983a),console[_0x3d0630(0x93)](_0x3d0630(0x92)+_0x2975ee));const _0xc07b66=_0x5da2b3?_0x3d0630(0x82)+_0xa7817+'/'+_0x430551+_0x3d0630(0x73):_0x3d0630(0x9e);try{const _0x258de6=await withProgressSpinner(_0xc07b66,async _0x10ef95=>{const _0x3d50b9=_0x3d0630,_0x3524e8=await _0x1e88df['query'][_0x3d50b9(0x7c)](_0x2975ee,{'catalog':_0x36639c,'schema':_0x1d983a,'onJobId':_0x45d09a=>{const _0xa6eed1=_0x3d50b9;_0x10ef95[_0xa6eed1(0x83)](_0x45d09a);},'onProgress':_0x162683=>{const _0x3b0c59=_0x3d50b9;_0x10ef95[_0x3b0c59(0x9b)](_0x3b0c59(0x85)+_0x162683['state']+']'),_0x10ef95[_0x3b0c59(0x79)](formatRows(_0x162683[_0x3b0c59(0x89)])+'\x20rows\x20'+_0x162683['completedSplits']+'/'+_0x162683[_0x3b0c59(0x87)]+_0x3b0c59(0x8f));}});return _0x3524e8;},{'verbose':_0x4b85c4['verbose']}),_0x5a6483=_0x258de6['data'],_0x474417=_0x5a6483[_0x3d0630(0x99)]?_0x3d0630(0x7b)+_0x5a6483[_0x3d0630(0x99)]+']':'',_0x4db39a=_0x5da2b3?_0x3d0630(0x94)+_0xa7817+'/'+_0x430551+_0x3d0630(0x8e):'';console[_0x3d0630(0x93)]('✔\x20'+_0x4db39a+_0x3d0630(0x88)+formatRows(_0x5a6483[_0x3d0630(0x8d)]['processedRows'])+'\x20rows\x20'+('in\x20'+formatElapsed(_0x5a6483['stats']['elapsedTimeMillis'])+_0x474417));if(_0x5da2b3&&_0x3b006d){const _0x291973=resolveOutputOptions(_0x108cba),_0x1cc75e=await formatQueryOutput(_0x5a6483,_0x291973);_0x3f9f9d['push'](_0x1cc75e);}else await handleQueryOutput(_0x5a6483,_0x108cba);}catch(_0x13a6e5){const _0x4c536d=_0x5da2b3?'Statement\x20'+_0xa7817+'/'+_0x430551+':\x0a':'',_0x5a522a=_0x13a6e5 instanceof SDKError?_0x13a6e5['originalMessage']:_0x13a6e5['message'];return console[_0x3d0630(0x93)](''+_0x4c536d+_0x5a522a),0x1;}}if(_0x23f0a5[_0x3d0630(0x81)]>0x1&&_0x3b006d&&_0x3f9f9d[_0x3d0630(0x81)]>0x0){const _0x4b8ee3=_0x3f9f9d[_0x3d0630(0x97)]('\x0a');writeFileSync(_0x4b85c4[_0x3d0630(0x98)],_0x4b8ee3),console['error'](_0x3d0630(0x71)+_0x4b85c4[_0x3d0630(0x98)]);}return 0x0;}catch(_0x3bfdfa){throw _0x3bfdfa;}}['validate'](_0x3e55fd){const _0x38a509=a35_0x315343,_0x100a57=_0x3e55fd[_0x38a509(0x80)][0x0],_0x4ff245=_0x3e55fd['options'][_0x38a509(0x70)];if(!_0x100a57&&!_0x4ff245)return _0x38a509(0x96);if(_0x100a57&&_0x4ff245)return _0x38a509(0x74);return undefined;}}
1
+ const a35_0x1b7c43=a35_0x3018;(function(_0x36107a,_0x4d75c1){const _0xc74fdf=a35_0x3018,_0x414d25=_0x36107a();while(!![]){try{const _0x590c55=parseInt(_0xc74fdf(0x91))/0x1*(parseInt(_0xc74fdf(0x96))/0x2)+parseInt(_0xc74fdf(0x73))/0x3+-parseInt(_0xc74fdf(0xa0))/0x4+parseInt(_0xc74fdf(0x77))/0x5*(-parseInt(_0xc74fdf(0x9f))/0x6)+parseInt(_0xc74fdf(0x90))/0x7+-parseInt(_0xc74fdf(0x97))/0x8*(parseInt(_0xc74fdf(0x86))/0x9)+parseInt(_0xc74fdf(0x83))/0xa*(parseInt(_0xc74fdf(0x87))/0xb);if(_0x590c55===_0x4d75c1)break;else _0x414d25['push'](_0x414d25['shift']());}catch(_0x18aa7c){_0x414d25['push'](_0x414d25['shift']());}}}(a35_0x3e31,0x72525));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a35_0x3e31(){const _0x3fdd2b=['output','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','completedSplits','push','information_schema','options','Statement\x20','50nroRaQ','name','\x20-\x20','28413xXjPSN','1627450fkqlis','Site:\x20','database','Run\x20Trino\x20queries\x20(streaming)','Executing\x20query...','No\x20SQL\x20provided','elapsedTimeMillis','setJobId','verbose','3067575mlAxBW','80263Ftjogr','description','catalog','args','...','10FqOyJz','1352xipWcl','validate','length','jobId','\x20[Job\x20ID:\x20','data','totalSplits','message','3532854eIByig','649220izoxeA','originalMessage','\x20splits','\x20rows\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','query','state','error','execute','Executing\x20statement\x20','setExtra','520854XitKMZ','Executing\x20query\x20[','\x0aAll\x20results\x20saved\x20to\x20','processedRows','5PbiNUP','in\x20','Schema:\x20','stats','file'];a35_0x3e31=function(){return _0x3fdd2b;};return a35_0x3e31();}function a35_0x3018(_0x11fef7,_0x36c53a){_0x11fef7=_0x11fef7-0x71;const _0x3e31ca=a35_0x3e31();let _0x301835=_0x3e31ca[_0x11fef7];return _0x301835;}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a35_0x1b7c43(0x84)]=a35_0x1b7c43(0xa5);[a35_0x1b7c43(0x92)]=a35_0x1b7c43(0x8a);async[a35_0x1b7c43(0xa8)](_0x149ffd){const _0x47a91f=a35_0x1b7c43,{options:_0x15eee5,args:_0x56a1b5,tdx:_0x2a7334}=_0x149ffd,_0x58f3e7={..._0x15eee5,'limitStructuredFormats':!![]},_0x1d5136=_0x56a1b5[0x0],_0x3edc5a=_0x15eee5[_0x47a91f(0x7b)];let _0x394e08;try{if(_0x3edc5a)_0x394e08=readSqlStatementsFromFile(_0x3edc5a);else{if(_0x1d5136==='-')_0x394e08=await readSqlStatementsFromStdin();else{if(_0x1d5136&&isSqlFilePath(_0x1d5136))_0x394e08=readSqlStatementsFromFile(_0x1d5136);else{if(_0x1d5136)_0x394e08=splitSqlStatements(_0x1d5136);else throw new Error(_0x47a91f(0x8c));}}}}catch(_0x3c22c2){return console[_0x47a91f(0xa7)]('Error:\x20'+_0x3c22c2[_0x47a91f(0x9e)]),0x1;}const _0x3d8878=_0x15eee5[_0x47a91f(0x89)]||_0x47a91f(0x80),_0x13f28d=_0x15eee5[_0x47a91f(0x93)];try{const _0x444681=[],_0x1bd5ba=!!_0x15eee5[_0x47a91f(0x7c)];for(let _0x17b10f=0x0;_0x17b10f<_0x394e08['length'];_0x17b10f++){const _0xcbab4f=_0x394e08[_0x17b10f],_0x44aa56=_0x17b10f+0x1,_0x57ba7e=_0x394e08['length'],_0x32b12f=_0x57ba7e>0x1;_0x15eee5['verbose']&&(console[_0x47a91f(0xa7)]('\x0a'+(_0x32b12f?_0x47a91f(0x82)+_0x44aa56+'/'+_0x57ba7e+':':'')),console[_0x47a91f(0xa7)](_0x47a91f(0x88)+_0x15eee5['site']),console['error']('Catalog:\x20'+(_0x13f28d||'td')),console['error'](_0x47a91f(0x79)+_0x3d8878),console['error']('SQL:\x20'+_0xcbab4f));const _0x14fe5f=_0x32b12f?_0x47a91f(0x71)+_0x44aa56+'/'+_0x57ba7e+_0x47a91f(0x95):_0x47a91f(0x8b);try{const _0x1ec253=await withProgressSpinner(_0x14fe5f,async _0x40b849=>{const _0x740b31=_0x47a91f,_0x343ca4=await _0x2a7334[_0x740b31(0xa5)][_0x740b31(0xa8)](_0xcbab4f,{'catalog':_0x13f28d,'schema':_0x3d8878,'onJobId':_0x5bcef2=>{const _0xf4b22d=_0x740b31;_0x40b849[_0xf4b22d(0x8e)](_0x5bcef2);},'onProgress':_0x474bf1=>{const _0xd1d9db=_0x740b31;_0x40b849['setPhase'](_0xd1d9db(0x74)+_0x474bf1[_0xd1d9db(0xa6)]+']'),_0x40b849[_0xd1d9db(0x72)](formatRows(_0x474bf1[_0xd1d9db(0x76)])+_0xd1d9db(0xa3)+_0x474bf1[_0xd1d9db(0x7e)]+'/'+_0x474bf1[_0xd1d9db(0x9d)]+_0xd1d9db(0xa2));}});return _0x343ca4;},{'verbose':_0x15eee5[_0x47a91f(0x8f)]}),_0x384d72=_0x1ec253[_0x47a91f(0x9c)],_0x11c8cf=_0x384d72[_0x47a91f(0x9a)]?_0x47a91f(0x9b)+_0x384d72[_0x47a91f(0x9a)]+']':'',_0x9a893e=_0x32b12f?_0x47a91f(0x82)+_0x44aa56+'/'+_0x57ba7e+_0x47a91f(0x85):'';console[_0x47a91f(0xa7)]('✔\x20'+_0x9a893e+'Query\x20completed:\x20Processed\x20'+formatRows(_0x384d72['stats'][_0x47a91f(0x76)])+_0x47a91f(0xa3)+(_0x47a91f(0x78)+formatElapsed(_0x384d72[_0x47a91f(0x7a)][_0x47a91f(0x8d)])+_0x11c8cf));if(_0x32b12f&&_0x1bd5ba){const _0x150c2b=resolveOutputOptions(_0x58f3e7),_0x1ff7dd=await formatQueryOutput(_0x384d72,_0x150c2b);_0x444681[_0x47a91f(0x7f)](_0x1ff7dd);}else await handleQueryOutput(_0x384d72,_0x58f3e7);}catch(_0x29b9c0){const _0x3c7a76=_0x32b12f?_0x47a91f(0x82)+_0x44aa56+'/'+_0x57ba7e+':\x0a':'',_0x2817a1=_0x29b9c0 instanceof SDKError?_0x29b9c0[_0x47a91f(0xa1)]:_0x29b9c0[_0x47a91f(0x9e)];return console[_0x47a91f(0xa7)](''+_0x3c7a76+_0x2817a1),0x1;}}if(_0x394e08[_0x47a91f(0x99)]>0x1&&_0x1bd5ba&&_0x444681[_0x47a91f(0x99)]>0x0){const _0x50a6e7=_0x444681['join']('\x0a');writeFileSync(_0x15eee5[_0x47a91f(0x7c)],_0x50a6e7),console['error'](_0x47a91f(0x75)+_0x15eee5[_0x47a91f(0x7c)]);}return 0x0;}catch(_0x454575){throw _0x454575;}}[a35_0x1b7c43(0x98)](_0x552363){const _0x48cf3a=a35_0x1b7c43,_0x132c62=_0x552363[_0x48cf3a(0x94)][0x0],_0x4e2135=_0x552363[_0x48cf3a(0x81)][_0x48cf3a(0x7b)];if(!_0x132c62&&!_0x4e2135)return _0x48cf3a(0x7d);if(_0x132c62&&_0x4e2135)return _0x48cf3a(0xa4);return undefined;}}
@@ -1 +1 @@
1
- const a36_0x45a24d=a36_0x14ee;(function(_0xfe5a3c,_0x189aed){const _0x23c835=a36_0x14ee,_0x41a00c=_0xfe5a3c();while(!![]){try{const _0x2fb4b1=parseInt(_0x23c835(0xf9))/0x1*(parseInt(_0x23c835(0xda))/0x2)+-parseInt(_0x23c835(0x103))/0x3*(parseInt(_0x23c835(0x115))/0x4)+parseInt(_0x23c835(0xf2))/0x5+parseInt(_0x23c835(0x10b))/0x6*(parseInt(_0x23c835(0x84))/0x7)+-parseInt(_0x23c835(0xa6))/0x8+-parseInt(_0x23c835(0x10f))/0x9*(-parseInt(_0x23c835(0xfa))/0xa)+-parseInt(_0x23c835(0xff))/0xb;if(_0x2fb4b1===_0x189aed)break;else _0x41a00c['push'](_0x41a00c['shift']());}catch(_0x94e613){_0x41a00c['push'](_0x41a00c['shift']());}}}(a36_0x1b09,0xf393d));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 a36_0x1e95e1 from'chalk';function formatRelativeTime(_0x41a21c){const _0x5c4c56=a36_0x14ee,_0xb55674=new Date(_0x41a21c),_0x10ad2a=new Date(),_0x4816b3=_0xb55674[_0x5c4c56(0xbd)]()-_0x10ad2a[_0x5c4c56(0xbd)](),_0x2208d5=Math[_0x5c4c56(0xde)](_0x4816b3)/0x3e8,_0xef74ef=_0x4816b3<0x0;if(_0x2208d5<0x3c)return _0xef74ef?_0x5c4c56(0xfb):'soon';else{if(_0x2208d5<0xe10){const _0x4b58ec=Math[_0x5c4c56(0x10d)](_0x2208d5/0x3c);return _0xef74ef?_0x4b58ec+'m\x20ago':'in\x20'+_0x4b58ec+'m';}else{if(_0x2208d5<0x15180){const _0x1a9f8d=Math['round'](_0x2208d5/0xe10);return _0xef74ef?_0x1a9f8d+_0x5c4c56(0xe7):_0x5c4c56(0xb5)+_0x1a9f8d+'h';}else{if(_0x2208d5<0x93a80){const _0x2b02ce=Math[_0x5c4c56(0x10d)](_0x2208d5/0x15180);return _0xef74ef?_0x2b02ce+_0x5c4c56(0xb3):_0x5c4c56(0xb5)+_0x2b02ce+'d';}else return _0xb55674['toLocaleDateString']();}}}}export class ScheduleListCommand extends BaseCommand{['name']=a36_0x45a24d(0xc7);[a36_0x45a24d(0xe0)]=a36_0x45a24d(0xb7);async[a36_0x45a24d(0x113)](_0x20a255){const _0x32b404=a36_0x45a24d,{options:_0x2af460,args:_0x5728cc,tdx:_0x15ca5a}=_0x20a255,_0x31036f=resolveLimit(_0x2af460[_0x32b404(0xdf)],DEFAULT_DISPLAY_LIMIT),_0x2b3934=_0x5728cc[0x0],_0x3a6e6d=_0x2b3934?_0x32b404(0x109)+_0x2b3934+'\x22...':_0x32b404(0x8c),_0x3e9cc1=await withSpinner(_0x3a6e6d,()=>_0x15ca5a[_0x32b404(0xee)][_0x32b404(0xcc)]({'limit':_0x31036f,'scheduled':!![],'pattern':_0x2b3934}),{'verbose':_0x2af460[_0x32b404(0xc3)]}),_0x314bb9=_0x3e9cc1[_0x32b404(0xca)]['queries'],_0x1d2df9=_0x3e9cc1[_0x32b404(0xca)][_0x32b404(0xf8)][_0x32b404(0xa2)],_0x32c2aa=_0x2b3934?_0x32b404(0xf0)+_0x2b3934+'\x22':'';_0x1d2df9?console[_0x32b404(0x98)](_0x32b404(0xf7)+_0x314bb9[_0x32b404(0xa3)]+_0x32b404(0xaf)+_0x32c2aa+_0x32b404(0x9f)):console[_0x32b404(0x98)](_0x32b404(0x8e)+_0x314bb9[_0x32b404(0xa3)]+_0x32b404(0xd8)+(_0x314bb9[_0x32b404(0xa3)]!==0x1?_0x32b404(0xc5):'y')+_0x32c2aa);if(_0x2af460[_0x32b404(0x100)]===_0x32b404(0xb4)||_0x2af460['format']==='jsonl'||_0x2af460[_0x32b404(0x100)]==='table'||_0x2af460[_0x32b404(0x100)]===_0x32b404(0x110)){const _0x5edb43=_0x314bb9['map'](_0x559926=>({'id':_0x559926['id'],'name':_0x559926['name'],'cron':_0x559926[_0x32b404(0xb1)],'database':_0x559926[_0x32b404(0x104)]?.['name'],'type':_0x559926[_0x32b404(0xa0)],'timezone':_0x559926['time_zone'],'user_name':_0x559926[_0x32b404(0x114)]?.[_0x32b404(0xef)],'updated_at':_0x559926[_0x32b404(0xd7)],'next_run_at':_0x559926['next_run_at'],'last_job_status':_0x559926[_0x32b404(0x8f)]?.[_0x32b404(0x88)]}));await handleSDKOutput(_0x5edb43,_0x2af460);}else{if(_0x314bb9[_0x32b404(0xa3)]===0x0)console[_0x32b404(0xed)](_0x32b404(0xd3));else{const _0x17e251=_0x2af460[_0x32b404(0x106)],_0x40dc92=_0x314bb9[_0x32b404(0x101)](_0x23488d=>{const _0x5aad17=_0x32b404,_0x3412be=_0x23488d[_0x5aad17(0x8f)]?.['status']?_0x23488d['last_job'][_0x5aad17(0x88)]===_0x5aad17(0x10e)?'✓':'✗':'-',_0x12f673=_0x23488d[_0x5aad17(0x8f)]?.[_0x5aad17(0xab)]?formatRelativeTime(_0x23488d[_0x5aad17(0x8f)][_0x5aad17(0xab)]):_0x5aad17(0xc2),_0x14d1a2=_0x23488d[_0x5aad17(0x8a)]?formatRelativeTime(_0x23488d['next_run_at']):'-',_0x4c4dea=_0x23488d['cron']||'',_0x35952e=_0x23488d['name']||'(unnamed)',_0x442ebc=getConsoleUrl(_0x17e251,'/app/queries/editor?queryId='+_0x23488d['id']);return{'statusIcon':_0x3412be,'lastRun':_0x12f673,'nextRun':_0x14d1a2,'cron':_0x4c4dea,'name':_0x35952e,'queryUrl':_0x442ebc,'status':_0x23488d['last_job']?.[_0x5aad17(0x88)]};}),_0x34cfbf=Math['max'](..._0x40dc92[_0x32b404(0x101)](_0x2da09c=>_0x2da09c[_0x32b404(0xd5)][_0x32b404(0xa3)])),_0x1bd557=Math[_0x32b404(0x86)](..._0x40dc92[_0x32b404(0x101)](_0x2dfdbd=>_0x2dfdbd[_0x32b404(0x91)][_0x32b404(0xa3)])),_0x4cf88c=Math[_0x32b404(0x86)](..._0x40dc92[_0x32b404(0x101)](_0x5251e6=>_0x5251e6[_0x32b404(0xb1)][_0x32b404(0xa3)])),_0x367e44=_0x40dc92[_0x32b404(0x101)](_0x56f31f=>{const _0x4b43fd=_0x32b404,_0xe74878=_0x56f31f[_0x4b43fd(0x88)]==='success'?a36_0x1e95e1[_0x4b43fd(0xd4)](_0x56f31f['statusIcon']):_0x56f31f[_0x4b43fd(0x88)]===_0x4b43fd(0x98)?a36_0x1e95e1['red'](_0x56f31f['statusIcon']):a36_0x1e95e1[_0x4b43fd(0xe3)](_0x56f31f[_0x4b43fd(0xad)]),_0x324067=_0x56f31f[_0x4b43fd(0xd5)][_0x4b43fd(0xc1)](_0x34cfbf),_0x5c0f07=_0x56f31f[_0x4b43fd(0x91)][_0x4b43fd(0xc1)](_0x1bd557),_0x44d815=_0x56f31f[_0x4b43fd(0xb1)]?a36_0x1e95e1[_0x4b43fd(0x87)](_0x56f31f[_0x4b43fd(0xb1)]['padEnd'](_0x4cf88c)):'\x20'['repeat'](_0x4cf88c),_0x536350=hyperlink(_0x56f31f['name'],_0x56f31f[_0x4b43fd(0x9b)]);return _0x4b43fd(0xbb)+_0xe74878+'\x20'+_0x324067+_0x4b43fd(0xd1)+_0x5c0f07+'\x20\x20'+_0x44d815+'\x20\x20'+_0x536350;});await writeOutput(_0x367e44[_0x32b404(0xb8)]('\x0a'),_0x2af460[_0x32b404(0x9c)],_0x32b404(0x90));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x45a24d(0xef)]=a36_0x45a24d(0xea);['description']=a36_0x45a24d(0xc6);[a36_0x45a24d(0x10a)](_0x53031d){const _0x1c3793=a36_0x45a24d,_0xebc0f8=_0x53031d[_0x1c3793(0xbf)][0x0];if(!_0xebc0f8)return _0x1c3793(0x96);return undefined;}async[a36_0x45a24d(0x113)](_0x1e0c7b){const _0x2db8f2=a36_0x45a24d,{options:_0x20a6ff,args:_0xa425d7,tdx:_0x2aac83}=_0x1e0c7b,_0x86875a=_0xa425d7[0x0],_0x4ededa=await withSpinner('Getting\x20schedule\x20details...',()=>_0x2aac83[_0x2db8f2(0xee)][_0x2db8f2(0xc8)](_0x86875a),{'verbose':_0x20a6ff[_0x2db8f2(0xc3)]}),_0xe770d=_0x4ededa['data'],_0x2994bc={'name':_0xe770d[_0x2db8f2(0xef)],'cron':_0xe770d['cron'],'database':_0xe770d[_0x2db8f2(0x104)],'type':_0xe770d[_0x2db8f2(0xa0)],'timezone':_0xe770d[_0x2db8f2(0xe8)],'user_name':_0xe770d['user_name'],'created_at':_0xe770d['created_at'],'engine_version':_0xe770d[_0x2db8f2(0xeb)],'executing_user_id':_0xe770d[_0x2db8f2(0xe5)],'query':_0xe770d[_0x2db8f2(0x8d)],'delay':_0xe770d['delay'],'priority':_0xe770d['priority'],'retry_limit':_0xe770d['retry_limit'],..._0xe770d[_0x2db8f2(0xcd)]&&{'result':_0xe770d['result']}};return await handleSingleObjectOutput(_0x2994bc,_0x20a6ff),0x0;}}function a36_0x1b09(){const _0x25137a=['type','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','has_next_page','length','time','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','5328048bQyrxq','history','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','options','Schedule\x20run\x20submitted:\x20','ended_at','...','statusIcon','Deleting\x20schedule...','\x20schedules','retry_limit','cron','Creating\x20schedule:\x20','d\x20ago','json','in\x20','Show\x20schedule\x20execution\x20history','List\x20scheduled\x20queries','join','\x20job','yes','📅\x20','Failed\x20to\x20read\x20file:\x20','getTime','Schedule\x20created:\x20','args','file','padEnd','never','verbose','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','ies','Show\x20schedule\x20details','schedule:list','show','trim','data','jobs','listQueries','result','Schedule\x20deleted:\x20','run','priority','\x20\x20→\x20','engineVersion','No\x20scheduled\x20queries\x20found','green','lastRun','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','updated_at','\x20scheduled\x20quer','retryLimit','298VzbEdh','start_at','num','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','abs','limit','description','Delete\x20a\x20scheduled\x20query','update','dim','scheduled_at','executing_user_id','INVALID_ARGUMENT','h\x20ago','timezone','Updating\x20schedule:\x20','schedule:show','engine_version','schedule:create','log','schedules','name','\x20matching\x20\x22','\x20created','3753035eHPIuk','Running\x20schedule:\x20','\x20\x20Timezone:\x20','Query\x20file\x20is\x20empty','\x20\x20Job\x20ID:\x20','Showing\x20first\x20','pagination','8273HGlQhS','190TgNURf','just\x20now','schedule:run','Updating\x20schedule...','Getting\x20schedule\x20history...','14643882hiUFQM','format','map','\x20\x20Type:\x20','261jJGDtV','database','\x20\x20Num:\x20','site','entries','utf-8','Searching\x20scheduled\x20queries\x20matching\x20\x22','validate','3606yFdyFr','\x20execution','round','success','250695vTMzPn','tsv','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','from','execute','user','64004OsMVuJ','21833SKpZjx','\x20\x20Time:\x20','max','cyan','status','schedule:update','next_run_at','\x20\x20Cron:\x20','Listing\x20scheduled\x20queries...','query','Found\x20','last_job','list','nextRun','schedule:history','Schedule\x20updated:\x20','job_id','delay','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','Run\x20a\x20scheduled\x20query\x20immediately','error','trino','created_at','queryUrl','output','delete','substring','\x20(use\x20--limit\x20to\x20see\x20more)'];a36_0x1b09=function(){return _0x25137a;};return a36_0x1b09();}export class ScheduleCreateCommand extends BaseCommand{['name']=a36_0x45a24d(0xec);['description']='Create\x20a\x20scheduled\x20query';[a36_0x45a24d(0x10a)](_0x481f06){const _0x4155c1=a36_0x45a24d,_0x78135b=_0x481f06['args'][0x0];if(!_0x78135b)return _0x4155c1(0x111);const _0x58ec0a=_0x481f06[_0x4155c1(0xa9)];if(!_0x58ec0a[_0x4155c1(0x104)])return _0x4155c1(0xc4);return undefined;}async[a36_0x45a24d(0x113)](_0x3ff241){const _0x2d7ab7=a36_0x45a24d,{options:_0x11957f,args:_0x2d6e3f,tdx:_0x8e696f}=_0x3ff241,_0x537c04=_0x2d6e3f[0x0],_0x2e49ed=_0x11957f,_0x3e49ee=_0x2e49ed['database'],_0x214a18=_0x2e49ed['file'],_0x3cd271=_0x2e49ed[_0x2d7ab7(0xa0)]||_0x2d7ab7(0x99);let _0x24bb57;try{_0x24bb57=readFileSync(_0x214a18,_0x2d7ab7(0x108))[_0x2d7ab7(0xc9)]();}catch(_0x5be9b9){throw new SDKError(ErrorCode[_0x2d7ab7(0xe6)],_0x2d7ab7(0xbc)+_0x214a18,_0x5be9b9 instanceof Error?_0x5be9b9:undefined);}if(!_0x24bb57)throw new SDKError(ErrorCode[_0x2d7ab7(0xe6)],_0x2d7ab7(0xf5));const _0x231a18={'database':_0x3e49ee,'query':_0x24bb57,'type':_0x3cd271};if(_0x2e49ed[_0x2d7ab7(0xb1)])_0x231a18[_0x2d7ab7(0xb1)]=_0x2e49ed[_0x2d7ab7(0xb1)];if(_0x2e49ed[_0x2d7ab7(0xe8)])_0x231a18['timezone']=_0x2e49ed[_0x2d7ab7(0xe8)];if(_0x2e49ed[_0x2d7ab7(0x95)]!==undefined)_0x231a18[_0x2d7ab7(0x95)]=Number(_0x2e49ed['delay']);if(_0x2e49ed[_0x2d7ab7(0xd0)]!==undefined)_0x231a18['priority']=Number(_0x2e49ed['priority']);if(_0x2e49ed[_0x2d7ab7(0xd9)]!==undefined)_0x231a18['retry_limit']=Number(_0x2e49ed['retryLimit']);if(_0x2e49ed[_0x2d7ab7(0xd2)])_0x231a18[_0x2d7ab7(0xeb)]=_0x2e49ed[_0x2d7ab7(0xd2)];if(_0x2e49ed[_0x2d7ab7(0xcd)])_0x231a18[_0x2d7ab7(0xcd)]=_0x2e49ed[_0x2d7ab7(0xcd)];if(_0x11957f[_0x2d7ab7(0xc3)]){console[_0x2d7ab7(0x98)](_0x2d7ab7(0xb2)+_0x537c04),console[_0x2d7ab7(0x98)]('\x20\x20Database:\x20'+_0x3e49ee),console['error'](_0x2d7ab7(0x102)+_0x3cd271);if(_0x231a18[_0x2d7ab7(0xb1)])console[_0x2d7ab7(0x98)](_0x2d7ab7(0x8b)+_0x231a18[_0x2d7ab7(0xb1)]);if(_0x231a18[_0x2d7ab7(0xe8)])console[_0x2d7ab7(0x98)](_0x2d7ab7(0xf4)+_0x231a18[_0x2d7ab7(0xe8)]);}const _0x5069a4=await withSpinner('Creating\x20schedule...',()=>_0x8e696f[_0x2d7ab7(0xee)]['create'](_0x537c04,_0x231a18),{'verbose':_0x11957f[_0x2d7ab7(0xc3)]});return console['error'](_0x2d7ab7(0xbe)+_0x5069a4[_0x2d7ab7(0xca)][_0x2d7ab7(0xef)]),await handleSingleObjectOutput(_0x5069a4[_0x2d7ab7(0xca)],_0x11957f),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{['name']=a36_0x45a24d(0x89);[a36_0x45a24d(0xe0)]='Update\x20a\x20scheduled\x20query';[a36_0x45a24d(0x10a)](_0x170bdd){const _0xdd9565=a36_0x45a24d,_0x1f00f2=_0x170bdd[_0xdd9565(0xbf)][0x0];if(!_0x1f00f2)return _0xdd9565(0xa5);return undefined;}async[a36_0x45a24d(0x113)](_0x5200cc){const _0x55343f=a36_0x45a24d,{options:_0x34cca9,args:_0x1cdc2f,tdx:_0x5c8b42}=_0x5200cc,_0x360c59=_0x1cdc2f[0x0],_0x803f93=_0x34cca9,_0xc6f700={};if(_0x803f93[_0x55343f(0x104)])_0xc6f700[_0x55343f(0x104)]=_0x803f93[_0x55343f(0x104)];if(_0x803f93[_0x55343f(0xa0)])_0xc6f700['type']=_0x803f93[_0x55343f(0xa0)];if(_0x803f93[_0x55343f(0xb1)])_0xc6f700[_0x55343f(0xb1)]=_0x803f93['cron'];if(_0x803f93['timezone'])_0xc6f700[_0x55343f(0xe8)]=_0x803f93[_0x55343f(0xe8)];if(_0x803f93[_0x55343f(0x95)]!==undefined)_0xc6f700['delay']=Number(_0x803f93[_0x55343f(0x95)]);if(_0x803f93[_0x55343f(0xd0)]!==undefined)_0xc6f700[_0x55343f(0xd0)]=Number(_0x803f93[_0x55343f(0xd0)]);if(_0x803f93['retryLimit']!==undefined)_0xc6f700[_0x55343f(0xb0)]=Number(_0x803f93[_0x55343f(0xd9)]);if(_0x803f93[_0x55343f(0xd2)])_0xc6f700[_0x55343f(0xeb)]=_0x803f93[_0x55343f(0xd2)];if(_0x803f93[_0x55343f(0xcd)])_0xc6f700[_0x55343f(0xcd)]=_0x803f93[_0x55343f(0xcd)];if(_0x803f93[_0x55343f(0xc0)])try{_0xc6f700[_0x55343f(0x8d)]=readFileSync(_0x803f93[_0x55343f(0xc0)],'utf-8')[_0x55343f(0xc9)]();}catch(_0x33aed5){throw new SDKError(ErrorCode[_0x55343f(0xe6)],_0x55343f(0xbc)+_0x803f93[_0x55343f(0xc0)],_0x33aed5 instanceof Error?_0x33aed5:undefined);}if(Object['keys'](_0xc6f700)['length']===0x0)throw new SDKError(ErrorCode[_0x55343f(0xe6)],_0x55343f(0xa1));if(_0x34cca9[_0x55343f(0xc3)]){console[_0x55343f(0x98)](_0x55343f(0xe9)+_0x360c59);for(const [_0x479b05,_0x3c59a7]of Object[_0x55343f(0x107)](_0xc6f700)){_0x479b05===_0x55343f(0x8d)?console[_0x55343f(0x98)]('\x20\x20'+_0x479b05+':\x20'+_0x3c59a7[_0x55343f(0x9e)](0x0,0x32)+_0x55343f(0xac)):console[_0x55343f(0x98)]('\x20\x20'+_0x479b05+':\x20'+_0x3c59a7);}}const _0x2fe97a=await withSpinner(_0x55343f(0xfd),()=>_0x5c8b42[_0x55343f(0xee)][_0x55343f(0xe2)](_0x360c59,_0xc6f700),{'verbose':_0x34cca9['verbose']});return console[_0x55343f(0x98)](_0x55343f(0x93)+_0x2fe97a['data']['name']),await handleSingleObjectOutput(_0x2fe97a[_0x55343f(0xca)],_0x34cca9),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x45a24d(0xef)]='schedule:delete';[a36_0x45a24d(0xe0)]=a36_0x45a24d(0xe1);[a36_0x45a24d(0x10a)](_0xa700b4){const _0x31b8b9=a36_0x45a24d,_0x46a1eb=_0xa700b4[_0x31b8b9(0xbf)][0x0];if(!_0x46a1eb)return _0x31b8b9(0xa8);return undefined;}async[a36_0x45a24d(0x113)](_0x432a11){const _0x37ddc6=a36_0x45a24d,{options:_0x30cbd5,args:_0x2a7a61,tdx:_0x3260ad}=_0x432a11,_0x410461=_0x2a7a61[0x0];if(!_0x30cbd5[_0x37ddc6(0xba)]){const _0x506417=await confirm(_0x37ddc6(0xdd)+_0x410461+'\x22?');if(!_0x506417)return console[_0x37ddc6(0x98)]('Cancelled'),0x0;}const _0x5a1d03=await withSpinner(_0x37ddc6(0xae),()=>_0x3260ad['schedules'][_0x37ddc6(0x9d)](_0x410461),{'verbose':_0x30cbd5[_0x37ddc6(0xc3)]});return console[_0x37ddc6(0x98)](_0x37ddc6(0xce)+_0x5a1d03[_0x37ddc6(0xca)][_0x37ddc6(0xef)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x45a24d(0xef)]=a36_0x45a24d(0xfc);['description']=a36_0x45a24d(0x97);[a36_0x45a24d(0x10a)](_0x43b870){const _0x1292c8=a36_0x45a24d,_0x147a88=_0x43b870[_0x1292c8(0xbf)][0x0];if(!_0x147a88)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async[a36_0x45a24d(0x113)](_0x32e139){const _0x56188a=a36_0x45a24d,{options:_0x3bb0bd,args:_0x25159c,tdx:_0xa888ab}=_0x32e139,_0x3fd271=_0x25159c[0x0],_0x2b0c90=_0x3bb0bd,_0x2f88b1=_0x2b0c90[_0x56188a(0xa4)],_0x53bec2=_0x2b0c90[_0x56188a(0xdc)]!==undefined?Number(_0x2b0c90['num']):undefined;if(_0x3bb0bd[_0x56188a(0xc3)]){console[_0x56188a(0x98)](_0x56188a(0xf3)+_0x3fd271);if(_0x2f88b1)console['error'](_0x56188a(0x85)+_0x2f88b1);if(_0x53bec2)console['error'](_0x56188a(0x105)+_0x53bec2);}const _0x2defd7=await withSpinner('Running\x20schedule...',()=>_0xa888ab[_0x56188a(0xee)][_0x56188a(0xcf)](_0x3fd271,{'time':_0x2f88b1,'num':_0x53bec2}),{'verbose':_0x3bb0bd['verbose']}),_0x493aa7=_0x2defd7[_0x56188a(0xca)][_0x56188a(0xcb)];console[_0x56188a(0x98)](_0x56188a(0xaa)+_0x493aa7['length']+_0x56188a(0xb9)+(_0x493aa7[_0x56188a(0xa3)]!==0x1?'s':'')+_0x56188a(0xf1));for(const _0x2cb6c7 of _0x493aa7){console['error'](_0x56188a(0xf6)+_0x2cb6c7[_0x56188a(0x94)]);}return await handleSDKOutput(_0x493aa7,_0x3bb0bd),0x0;}}function a36_0x14ee(_0x30eadb,_0x36406e){_0x30eadb=_0x30eadb-0x84;const _0x1b0916=a36_0x1b09();let _0x14ee4c=_0x1b0916[_0x30eadb];return _0x14ee4c;}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x45a24d(0xef)]=a36_0x45a24d(0x92);[a36_0x45a24d(0xe0)]=a36_0x45a24d(0xb6);['validate'](_0x1d3624){const _0x1b558b=a36_0x45a24d,_0x17979e=_0x1d3624[_0x1b558b(0xbf)][0x0];if(!_0x17979e)return _0x1b558b(0xd6);return undefined;}async[a36_0x45a24d(0x113)](_0x3e3220){const _0x163178=a36_0x45a24d,{options:_0x5aa5ec,args:_0x468e36,tdx:_0x545923}=_0x3e3220,_0x3cbebc=_0x468e36[0x0],_0x5eb9bf=_0x5aa5ec,_0x16453b=_0x5eb9bf[_0x163178(0x112)]!==undefined?Number(_0x5eb9bf[_0x163178(0x112)]):undefined,_0x30f579=_0x5eb9bf['to']!==undefined?Number(_0x5eb9bf['to']):undefined,_0x2e421c=await withSpinner(_0x163178(0xfe),()=>_0x545923[_0x163178(0xee)]['history'](_0x3cbebc,{'from':_0x16453b,'to':_0x30f579}),{'verbose':_0x5aa5ec[_0x163178(0xc3)]}),_0x3d842b=_0x2e421c[_0x163178(0xca)];console[_0x163178(0x98)](_0x163178(0x8e)+_0x3d842b['count']+_0x163178(0x10c)+(_0x3d842b['count']!==0x1?'s':'')+'\x20(showing\x20'+_0x3d842b[_0x163178(0x112)]+'-'+_0x3d842b['to']+')');const _0x2a8a5d=_0x3d842b[_0x163178(0xa7)][_0x163178(0x101)](_0x3dcdf4=>({'job_id':_0x3dcdf4[_0x163178(0x94)],'type':_0x3dcdf4['type'],'status':_0x3dcdf4[_0x163178(0x88)],'scheduled_at':_0x3dcdf4[_0x163178(0xe4)],'created_at':_0x3dcdf4[_0x163178(0x9a)],'start_at':_0x3dcdf4[_0x163178(0xdb)],'end_at':_0x3dcdf4['end_at']}));return await handleSDKOutput(_0x2a8a5d,_0x5aa5ec),0x0;}}
1
+ const a36_0x165db1=a36_0x541e;(function(_0x278b58,_0x33dc69){const _0x3377fc=a36_0x541e,_0x20e6bd=_0x278b58();while(!![]){try{const _0x3eedf2=-parseInt(_0x3377fc(0x17e))/0x1*(-parseInt(_0x3377fc(0x166))/0x2)+parseInt(_0x3377fc(0x139))/0x3+parseInt(_0x3377fc(0x19e))/0x4+-parseInt(_0x3377fc(0x177))/0x5+-parseInt(_0x3377fc(0x197))/0x6*(-parseInt(_0x3377fc(0x11a))/0x7)+parseInt(_0x3377fc(0x184))/0x8*(parseInt(_0x3377fc(0x13f))/0x9)+parseInt(_0x3377fc(0x171))/0xa*(-parseInt(_0x3377fc(0x196))/0xb);if(_0x3eedf2===_0x33dc69)break;else _0x20e6bd['push'](_0x20e6bd['shift']());}catch(_0x104a4f){_0x20e6bd['push'](_0x20e6bd['shift']());}}}(a36_0x217e,0x2617e));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 a36_0x1b765b from'chalk';function formatRelativeTime(_0x154286){const _0x2574d2=a36_0x541e,_0x57d852=new Date(_0x154286),_0x177a26=new Date(),_0x49165b=_0x57d852[_0x2574d2(0x128)]()-_0x177a26[_0x2574d2(0x128)](),_0x1ee755=Math[_0x2574d2(0x186)](_0x49165b)/0x3e8,_0x432c5f=_0x49165b<0x0;if(_0x1ee755<0x3c)return _0x432c5f?_0x2574d2(0x19d):_0x2574d2(0x19f);else{if(_0x1ee755<0xe10){const _0x31e348=Math[_0x2574d2(0x160)](_0x1ee755/0x3c);return _0x432c5f?_0x31e348+'m\x20ago':'in\x20'+_0x31e348+'m';}else{if(_0x1ee755<0x15180){const _0x97aef5=Math[_0x2574d2(0x160)](_0x1ee755/0xe10);return _0x432c5f?_0x97aef5+_0x2574d2(0x15d):_0x2574d2(0x15c)+_0x97aef5+'h';}else{if(_0x1ee755<0x93a80){const _0x140a80=Math[_0x2574d2(0x160)](_0x1ee755/0x15180);return _0x432c5f?_0x140a80+'d\x20ago':_0x2574d2(0x15c)+_0x140a80+'d';}else return _0x57d852[_0x2574d2(0x162)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x165db1(0x182)]=a36_0x165db1(0x19b);[a36_0x165db1(0x11b)]=a36_0x165db1(0x156);async[a36_0x165db1(0x13d)](_0x5df2d2){const _0x1dbc89=a36_0x165db1,{options:_0x5ef5ec,args:_0x9f2c73,tdx:_0x188bfc}=_0x5df2d2,_0x3fe472=resolveLimit(_0x5ef5ec['limit'],DEFAULT_DISPLAY_LIMIT),_0x3c8165=_0x9f2c73[0x0],_0x12a50d=_0x3c8165?_0x1dbc89(0x12e)+_0x3c8165+_0x1dbc89(0x15b):_0x1dbc89(0x131),_0x11409f=await withSpinner(_0x12a50d,()=>_0x188bfc['schedules'][_0x1dbc89(0x1a1)]({'limit':_0x3fe472,'scheduled':!![],'pattern':_0x3c8165}),{'verbose':_0x5ef5ec[_0x1dbc89(0x15a)]}),_0x1e4c8a=_0x11409f['data'][_0x1dbc89(0x17c)],_0x5c1078=_0x11409f[_0x1dbc89(0x143)][_0x1dbc89(0x133)][_0x1dbc89(0x138)],_0x42db92=_0x3c8165?'\x20matching\x20\x22'+_0x3c8165+'\x22':'';_0x5c1078?console[_0x1dbc89(0x19c)](_0x1dbc89(0x12f)+_0x1e4c8a[_0x1dbc89(0x123)]+'\x20schedules'+_0x42db92+_0x1dbc89(0x16b)):console[_0x1dbc89(0x19c)](_0x1dbc89(0x14f)+_0x1e4c8a[_0x1dbc89(0x123)]+_0x1dbc89(0x14c)+(_0x1e4c8a[_0x1dbc89(0x123)]!==0x1?_0x1dbc89(0x194):'y')+_0x42db92);if(_0x5ef5ec['format']===_0x1dbc89(0x130)||_0x5ef5ec[_0x1dbc89(0x152)]===_0x1dbc89(0x17f)||_0x5ef5ec[_0x1dbc89(0x152)]===_0x1dbc89(0x163)||_0x5ef5ec[_0x1dbc89(0x152)]===_0x1dbc89(0x18e)){const _0x1dcf9a=_0x1e4c8a[_0x1dbc89(0x199)](_0x342d65=>({'id':_0x342d65['id'],'name':_0x342d65['name'],'cron':_0x342d65[_0x1dbc89(0x14e)],'database':_0x342d65[_0x1dbc89(0x176)]?.[_0x1dbc89(0x182)],'type':_0x342d65['type'],'timezone':_0x342d65['time_zone'],'user_name':_0x342d65[_0x1dbc89(0x14a)]?.[_0x1dbc89(0x182)],'updated_at':_0x342d65[_0x1dbc89(0x175)],'next_run_at':_0x342d65[_0x1dbc89(0x165)],'last_job_status':_0x342d65[_0x1dbc89(0x13b)]?.['status']}));await handleSDKOutput(_0x1dcf9a,_0x5ef5ec);}else{if(_0x1e4c8a['length']===0x0)console['log'](_0x1dbc89(0x134));else{const _0x17a03f=_0x5ef5ec[_0x1dbc89(0x198)],_0x41226b=_0x1e4c8a[_0x1dbc89(0x199)](_0x1769ca=>{const _0x8dbb0d=_0x1dbc89,_0x47c2f6=_0x1769ca[_0x8dbb0d(0x13b)]?.[_0x8dbb0d(0x159)]?_0x1769ca[_0x8dbb0d(0x13b)]['status']===_0x8dbb0d(0x1a0)?'✓':'✗':'-',_0x1dab0b=_0x1769ca[_0x8dbb0d(0x13b)]?.[_0x8dbb0d(0x18b)]?formatRelativeTime(_0x1769ca[_0x8dbb0d(0x13b)]['ended_at']):_0x8dbb0d(0x16e),_0x15da91=_0x1769ca[_0x8dbb0d(0x165)]?formatRelativeTime(_0x1769ca[_0x8dbb0d(0x165)]):'-',_0x30f6de=_0x1769ca[_0x8dbb0d(0x14e)]||'',_0x46803d=_0x1769ca[_0x8dbb0d(0x182)]||_0x8dbb0d(0x141),_0x5288ce=getConsoleUrl(_0x17a03f,_0x8dbb0d(0x1a4)+_0x1769ca['id']);return{'statusIcon':_0x47c2f6,'lastRun':_0x1dab0b,'nextRun':_0x15da91,'cron':_0x30f6de,'name':_0x46803d,'queryUrl':_0x5288ce,'status':_0x1769ca[_0x8dbb0d(0x13b)]?.['status']};}),_0x3136d7=Math['max'](..._0x41226b[_0x1dbc89(0x199)](_0x44428c=>_0x44428c[_0x1dbc89(0x191)][_0x1dbc89(0x123)])),_0xd235b1=Math[_0x1dbc89(0x174)](..._0x41226b[_0x1dbc89(0x199)](_0x30374c=>_0x30374c[_0x1dbc89(0x125)]['length'])),_0xd6bc5=Math[_0x1dbc89(0x174)](..._0x41226b[_0x1dbc89(0x199)](_0x57dde9=>_0x57dde9['cron'][_0x1dbc89(0x123)])),_0x61aa9c=_0x41226b[_0x1dbc89(0x199)](_0x4a4883=>{const _0x15af92=_0x1dbc89,_0x324153=_0x4a4883[_0x15af92(0x159)]==='success'?a36_0x1b765b[_0x15af92(0x173)](_0x4a4883['statusIcon']):_0x4a4883[_0x15af92(0x159)]==='error'?a36_0x1b765b[_0x15af92(0x19a)](_0x4a4883['statusIcon']):a36_0x1b765b[_0x15af92(0x137)](_0x4a4883[_0x15af92(0x18f)]),_0x37635a=_0x4a4883[_0x15af92(0x191)]['padEnd'](_0x3136d7),_0x2018fa=_0x4a4883['nextRun']['padEnd'](_0xd235b1),_0x266be5=_0x4a4883[_0x15af92(0x14e)]?a36_0x1b765b[_0x15af92(0x187)](_0x4a4883[_0x15af92(0x14e)]['padEnd'](_0xd6bc5)):'\x20'['repeat'](_0xd6bc5),_0x65f2cd=hyperlink(_0x4a4883['name'],_0x4a4883['queryUrl']);return _0x15af92(0x1a5)+_0x324153+'\x20'+_0x37635a+_0x15af92(0x140)+_0x2018fa+'\x20\x20'+_0x266be5+'\x20\x20'+_0x65f2cd;});await writeOutput(_0x61aa9c[_0x1dbc89(0x179)]('\x0a'),_0x5ef5ec[_0x1dbc89(0x122)],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x165db1(0x182)]=a36_0x165db1(0x149);[a36_0x165db1(0x11b)]=a36_0x165db1(0x17d);[a36_0x165db1(0x13a)](_0x2fdfb5){const _0x474806=a36_0x165db1,_0x190efe=_0x2fdfb5[_0x474806(0x142)][0x0];if(!_0x190efe)return _0x474806(0x168);return undefined;}async[a36_0x165db1(0x13d)](_0x6fb533){const _0x462782=a36_0x165db1,{options:_0xb43eb1,args:_0x132c4,tdx:_0x23005b}=_0x6fb533,_0xdaa1c7=_0x132c4[0x0],_0x809349=await withSpinner('Getting\x20schedule\x20details...',()=>_0x23005b['schedules'][_0x462782(0x129)](_0xdaa1c7),{'verbose':_0xb43eb1[_0x462782(0x15a)]}),_0x4f2526=_0x809349[_0x462782(0x143)],_0xeb5534={'name':_0x4f2526[_0x462782(0x182)],'cron':_0x4f2526[_0x462782(0x14e)],'database':_0x4f2526[_0x462782(0x176)],'type':_0x4f2526[_0x462782(0x17a)],'timezone':_0x4f2526[_0x462782(0x190)],'user_name':_0x4f2526[_0x462782(0x1a3)],'created_at':_0x4f2526[_0x462782(0x121)],'engine_version':_0x4f2526[_0x462782(0x172)],'executing_user_id':_0x4f2526[_0x462782(0x195)],'query':_0x4f2526['query'],'delay':_0x4f2526['delay'],'priority':_0x4f2526[_0x462782(0x18c)],'retry_limit':_0x4f2526['retry_limit'],..._0x4f2526[_0x462782(0x11c)]&&{'result':_0x4f2526[_0x462782(0x11c)]}};return await handleSingleObjectOutput(_0xeb5534,_0xb43eb1),0x0;}}function a36_0x541e(_0x21a7ca,_0x1a4251){_0x21a7ca=_0x21a7ca-0x119;const _0x217e9a=a36_0x217e();let _0x541ef8=_0x217e9a[_0x21a7ca];return _0x541ef8;}export class ScheduleCreateCommand extends BaseCommand{[a36_0x165db1(0x182)]='schedule:create';['description']=a36_0x165db1(0x192);['validate'](_0x42e782){const _0x2d1705=a36_0x165db1,_0x4e453c=_0x42e782['args'][0x0];if(!_0x4e453c)return _0x2d1705(0x120);const _0x1012ef=_0x42e782[_0x2d1705(0x16d)];if(!_0x1012ef[_0x2d1705(0x176)])return _0x2d1705(0x124);return undefined;}async[a36_0x165db1(0x13d)](_0x45b04f){const _0x25e8c=a36_0x165db1,{options:_0x23bee7,args:_0x585922,tdx:_0xb0871d}=_0x45b04f,_0x47688d=_0x585922[0x0],_0x2692ee=_0x23bee7,_0x47d4af=_0x2692ee['database'],_0x5b4c89=_0x2692ee[_0x25e8c(0x180)],_0x3618eb=_0x2692ee['type']||'trino';let _0x22f8a0;try{_0x22f8a0=readFileSync(_0x5b4c89,'utf-8')[_0x25e8c(0x16c)]();}catch(_0x23ff55){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x25e8c(0x13c)+_0x5b4c89,_0x23ff55 instanceof Error?_0x23ff55:undefined);}if(!_0x22f8a0)throw new SDKError(ErrorCode[_0x25e8c(0x11f)],_0x25e8c(0x13e));const _0x4166f8={'database':_0x47d4af,'query':_0x22f8a0,'type':_0x3618eb};if(_0x2692ee[_0x25e8c(0x14e)])_0x4166f8['cron']=_0x2692ee['cron'];if(_0x2692ee[_0x25e8c(0x190)])_0x4166f8['timezone']=_0x2692ee[_0x25e8c(0x190)];if(_0x2692ee['delay']!==undefined)_0x4166f8[_0x25e8c(0x148)]=Number(_0x2692ee[_0x25e8c(0x148)]);if(_0x2692ee['priority']!==undefined)_0x4166f8[_0x25e8c(0x18c)]=Number(_0x2692ee['priority']);if(_0x2692ee[_0x25e8c(0x155)]!==undefined)_0x4166f8[_0x25e8c(0x181)]=Number(_0x2692ee[_0x25e8c(0x155)]);if(_0x2692ee[_0x25e8c(0x12a)])_0x4166f8[_0x25e8c(0x172)]=_0x2692ee[_0x25e8c(0x12a)];if(_0x2692ee[_0x25e8c(0x11c)])_0x4166f8[_0x25e8c(0x11c)]=_0x2692ee[_0x25e8c(0x11c)];if(_0x23bee7[_0x25e8c(0x15a)]){console[_0x25e8c(0x19c)](_0x25e8c(0x167)+_0x47688d),console['error']('\x20\x20Database:\x20'+_0x47d4af),console[_0x25e8c(0x19c)](_0x25e8c(0x136)+_0x3618eb);if(_0x4166f8[_0x25e8c(0x14e)])console[_0x25e8c(0x19c)]('\x20\x20Cron:\x20'+_0x4166f8[_0x25e8c(0x14e)]);if(_0x4166f8[_0x25e8c(0x190)])console[_0x25e8c(0x19c)](_0x25e8c(0x188)+_0x4166f8['timezone']);}const _0x3fde9d=await withSpinner(_0x25e8c(0x1a2),()=>_0xb0871d['schedules'][_0x25e8c(0x12b)](_0x47688d,_0x4166f8),{'verbose':_0x23bee7[_0x25e8c(0x15a)]});return console[_0x25e8c(0x19c)](_0x25e8c(0x169)+_0x3fde9d[_0x25e8c(0x143)][_0x25e8c(0x182)]),await handleSingleObjectOutput(_0x3fde9d['data'],_0x23bee7),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{['name']=a36_0x165db1(0x15f);[a36_0x165db1(0x11b)]=a36_0x165db1(0x150);['validate'](_0x598790){const _0x2d7741=a36_0x165db1,_0x3a545e=_0x598790['args'][0x0];if(!_0x3a545e)return _0x2d7741(0x18d);return undefined;}async[a36_0x165db1(0x13d)](_0xf561ac){const _0x2bf146=a36_0x165db1,{options:_0x279a88,args:_0x2fd939,tdx:_0x1425bd}=_0xf561ac,_0x4be804=_0x2fd939[0x0],_0xebef0e=_0x279a88,_0x360691={};if(_0xebef0e[_0x2bf146(0x176)])_0x360691[_0x2bf146(0x176)]=_0xebef0e['database'];if(_0xebef0e[_0x2bf146(0x17a)])_0x360691[_0x2bf146(0x17a)]=_0xebef0e['type'];if(_0xebef0e[_0x2bf146(0x14e)])_0x360691[_0x2bf146(0x14e)]=_0xebef0e['cron'];if(_0xebef0e[_0x2bf146(0x190)])_0x360691[_0x2bf146(0x190)]=_0xebef0e[_0x2bf146(0x190)];if(_0xebef0e[_0x2bf146(0x148)]!==undefined)_0x360691['delay']=Number(_0xebef0e[_0x2bf146(0x148)]);if(_0xebef0e[_0x2bf146(0x18c)]!==undefined)_0x360691[_0x2bf146(0x18c)]=Number(_0xebef0e[_0x2bf146(0x18c)]);if(_0xebef0e['retryLimit']!==undefined)_0x360691['retry_limit']=Number(_0xebef0e[_0x2bf146(0x155)]);if(_0xebef0e[_0x2bf146(0x12a)])_0x360691[_0x2bf146(0x172)]=_0xebef0e[_0x2bf146(0x12a)];if(_0xebef0e[_0x2bf146(0x11c)])_0x360691[_0x2bf146(0x11c)]=_0xebef0e[_0x2bf146(0x11c)];if(_0xebef0e[_0x2bf146(0x180)])try{_0x360691['query']=readFileSync(_0xebef0e['file'],_0x2bf146(0x119))['trim']();}catch(_0x1cc92d){throw new SDKError(ErrorCode[_0x2bf146(0x11f)],'Failed\x20to\x20read\x20file:\x20'+_0xebef0e[_0x2bf146(0x180)],_0x1cc92d instanceof Error?_0x1cc92d:undefined);}if(Object[_0x2bf146(0x12d)](_0x360691)[_0x2bf146(0x123)]===0x0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update');if(_0x279a88[_0x2bf146(0x15a)]){console['error'](_0x2bf146(0x11e)+_0x4be804);for(const [_0x35eb78,_0x5df665]of Object[_0x2bf146(0x164)](_0x360691)){_0x35eb78===_0x2bf146(0x14d)?console[_0x2bf146(0x19c)]('\x20\x20'+_0x35eb78+':\x20'+_0x5df665['substring'](0x0,0x32)+_0x2bf146(0x16f)):console[_0x2bf146(0x19c)]('\x20\x20'+_0x35eb78+':\x20'+_0x5df665);}}const _0x58f26c=await withSpinner(_0x2bf146(0x157),()=>_0x1425bd[_0x2bf146(0x154)][_0x2bf146(0x170)](_0x4be804,_0x360691),{'verbose':_0x279a88[_0x2bf146(0x15a)]});return console[_0x2bf146(0x19c)]('Schedule\x20updated:\x20'+_0x58f26c['data'][_0x2bf146(0x182)]),await handleSingleObjectOutput(_0x58f26c[_0x2bf146(0x143)],_0x279a88),0x0;}}function a36_0x217e(){const _0x171ecb=['6673giIRDm','jsonl','file','retry_limit','name','from','1829752nHOMsI','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','abs','cyan','\x20\x20Timezone:\x20','Running\x20schedule:\x20','run','ended_at','priority','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','tsv','statusIcon','timezone','lastRun','Create\x20a\x20scheduled\x20query','\x20created','ies','executing_user_id','4241578PyrvvG','24VgQSsZ','site','map','red','schedule:list','error','just\x20now','91384lgnIRW','soon','success','listQueries','Creating\x20schedule...','user_name','/app/queries/editor?queryId=','📅\x20','utf-8','411376fupwsN','description','result','\x20job','Updating\x20schedule:\x20','INVALID_ARGUMENT','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','created_at','output','length','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','nextRun','history','\x20\x20Time:\x20','getTime','show','engineVersion','create','scheduled_at','keys','Searching\x20scheduled\x20queries\x20matching\x20\x22','Showing\x20first\x20','json','Listing\x20scheduled\x20queries...','schedule:run','pagination','No\x20scheduled\x20queries\x20found','count','\x20\x20Type:\x20','dim','has_next_page','217260SyNbeg','validate','last_job','Failed\x20to\x20read\x20file:\x20','execute','Query\x20file\x20is\x20empty','9nESCtC','\x20\x20→\x20','(unnamed)','args','data','Cancelled','\x20(showing\x20','job_id','Schedule\x20run\x20submitted:\x20','delay','schedule:show','user','Running\x20schedule...','\x20scheduled\x20quer','query','cron','Found\x20','Update\x20a\x20scheduled\x20query','start_at','format','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','schedules','retryLimit','List\x20scheduled\x20queries','Updating\x20schedule...','Schedule\x20deleted:\x20','status','verbose','\x22...','in\x20','h\x20ago','Show\x20schedule\x20execution\x20history','schedule:update','round','\x20\x20Num:\x20','toLocaleDateString','table','entries','next_run_at','2rnaSVs','Creating\x20schedule:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','Schedule\x20created:\x20','num','\x20(use\x20--limit\x20to\x20see\x20more)','trim','options','never','...','update','10MdowhG','engine_version','green','max','updated_at','database','120510zQuQcC','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','join','type','schedule:delete','queries','Show\x20schedule\x20details'];a36_0x217e=function(){return _0x171ecb;};return a36_0x217e();}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x165db1(0x182)]=a36_0x165db1(0x17b);[a36_0x165db1(0x11b)]='Delete\x20a\x20scheduled\x20query';[a36_0x165db1(0x13a)](_0x2c3e08){const _0x3618ae=a36_0x165db1,_0x30adc9=_0x2c3e08[_0x3618ae(0x142)][0x0];if(!_0x30adc9)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async[a36_0x165db1(0x13d)](_0x1fe796){const _0x467500=a36_0x165db1,{options:_0x580794,args:_0x4f2461,tdx:_0x102911}=_0x1fe796,_0x511de0=_0x4f2461[0x0];if(!_0x580794['yes']){const _0x29124c=await confirm(_0x467500(0x153)+_0x511de0+'\x22?');if(!_0x29124c)return console[_0x467500(0x19c)](_0x467500(0x144)),0x0;}const _0x1f5b95=await withSpinner('Deleting\x20schedule...',()=>_0x102911[_0x467500(0x154)]['delete'](_0x511de0),{'verbose':_0x580794[_0x467500(0x15a)]});return console[_0x467500(0x19c)](_0x467500(0x158)+_0x1f5b95[_0x467500(0x143)][_0x467500(0x182)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x165db1(0x182)]=a36_0x165db1(0x132);[a36_0x165db1(0x11b)]='Run\x20a\x20scheduled\x20query\x20immediately';[a36_0x165db1(0x13a)](_0x342263){const _0x39fed7=a36_0x165db1,_0x1a5006=_0x342263[_0x39fed7(0x142)][0x0];if(!_0x1a5006)return _0x39fed7(0x178);return undefined;}async[a36_0x165db1(0x13d)](_0x5d0b40){const _0x1611ec=a36_0x165db1,{options:_0x3a99e0,args:_0x4e2ef2,tdx:_0x445a2e}=_0x5d0b40,_0x4fc44d=_0x4e2ef2[0x0],_0x14900e=_0x3a99e0,_0xf3f003=_0x14900e['time'],_0x146a98=_0x14900e[_0x1611ec(0x16a)]!==undefined?Number(_0x14900e['num']):undefined;if(_0x3a99e0[_0x1611ec(0x15a)]){console[_0x1611ec(0x19c)](_0x1611ec(0x189)+_0x4fc44d);if(_0xf3f003)console['error'](_0x1611ec(0x127)+_0xf3f003);if(_0x146a98)console[_0x1611ec(0x19c)](_0x1611ec(0x161)+_0x146a98);}const _0x52d073=await withSpinner(_0x1611ec(0x14b),()=>_0x445a2e['schedules'][_0x1611ec(0x18a)](_0x4fc44d,{'time':_0xf3f003,'num':_0x146a98}),{'verbose':_0x3a99e0[_0x1611ec(0x15a)]}),_0x3e9b4e=_0x52d073[_0x1611ec(0x143)]['jobs'];console['error'](_0x1611ec(0x147)+_0x3e9b4e[_0x1611ec(0x123)]+_0x1611ec(0x11d)+(_0x3e9b4e[_0x1611ec(0x123)]!==0x1?'s':'')+_0x1611ec(0x193));for(const _0x3043cb of _0x3e9b4e){console['error']('\x20\x20Job\x20ID:\x20'+_0x3043cb[_0x1611ec(0x146)]);}return await handleSDKOutput(_0x3e9b4e,_0x3a99e0),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x165db1(0x182)]='schedule:history';['description']=a36_0x165db1(0x15e);[a36_0x165db1(0x13a)](_0x18c334){const _0x2cd05b=a36_0x165db1,_0x830269=_0x18c334[_0x2cd05b(0x142)][0x0];if(!_0x830269)return _0x2cd05b(0x185);return undefined;}async[a36_0x165db1(0x13d)](_0x2cdc6a){const _0x24dee6=a36_0x165db1,{options:_0x3a1e01,args:_0x599a8d,tdx:_0x457ce6}=_0x2cdc6a,_0x3def5e=_0x599a8d[0x0],_0xd12ef3=_0x3a1e01,_0x141d5e=_0xd12ef3[_0x24dee6(0x183)]!==undefined?Number(_0xd12ef3[_0x24dee6(0x183)]):undefined,_0x32095a=_0xd12ef3['to']!==undefined?Number(_0xd12ef3['to']):undefined,_0x1eff8a=await withSpinner('Getting\x20schedule\x20history...',()=>_0x457ce6['schedules']['history'](_0x3def5e,{'from':_0x141d5e,'to':_0x32095a}),{'verbose':_0x3a1e01[_0x24dee6(0x15a)]}),_0xe61f8e=_0x1eff8a['data'];console[_0x24dee6(0x19c)](_0x24dee6(0x14f)+_0xe61f8e[_0x24dee6(0x135)]+'\x20execution'+(_0xe61f8e['count']!==0x1?'s':'')+_0x24dee6(0x145)+_0xe61f8e[_0x24dee6(0x183)]+'-'+_0xe61f8e['to']+')');const _0x18fd58=_0xe61f8e[_0x24dee6(0x126)][_0x24dee6(0x199)](_0x1db098=>({'job_id':_0x1db098[_0x24dee6(0x146)],'type':_0x1db098['type'],'status':_0x1db098['status'],'scheduled_at':_0x1db098[_0x24dee6(0x12c)],'created_at':_0x1db098[_0x24dee6(0x121)],'start_at':_0x1db098[_0x24dee6(0x151)],'end_at':_0x1db098['end_at']}));return await handleSDKOutput(_0x18fd58,_0x3a1e01),0x0;}}
@@ -1 +1 @@
1
- const a37_0x2f5cd1=a37_0x32b7;(function(_0x4f90f8,_0x5227a7){const _0x152a41=a37_0x32b7,_0x5286a3=_0x4f90f8();while(!![]){try{const _0x543ef1=-parseInt(_0x152a41(0x152))/0x1+-parseInt(_0x152a41(0x138))/0x2*(-parseInt(_0x152a41(0x17e))/0x3)+parseInt(_0x152a41(0x180))/0x4+-parseInt(_0x152a41(0x101))/0x5*(parseInt(_0x152a41(0x108))/0x6)+parseInt(_0x152a41(0x15d))/0x7+parseInt(_0x152a41(0x18c))/0x8*(-parseInt(_0x152a41(0x110))/0x9)+parseInt(_0x152a41(0x106))/0xa;if(_0x543ef1===_0x5227a7)break;else _0x5286a3['push'](_0x5286a3['shift']());}catch(_0x26ec07){_0x5286a3['push'](_0x5286a3['shift']());}}}(a37_0x592c,0xba559));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';function a37_0x32b7(_0x56ee53,_0x3e5d1a){_0x56ee53=_0x56ee53-0xf3;const _0x592cf8=a37_0x592c();let _0x32b74b=_0x592cf8[_0x56ee53];return _0x32b74b;}import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0xf4558b from'chalk';async function resolveSegmentTarget(_0x2bd2d6,_0xaa5c22,_0x3a353a){const _0x39d7a7=a37_0x32b7;if(isYamlFilePath(_0x2bd2d6))try{const _0xc94fa2=await resolveYamlFilePath(_0x2bd2d6);return _0x3a353a&&(console[_0x39d7a7(0x144)]('Resolved\x20YAML\x20file:\x20'+_0x2bd2d6),console[_0x39d7a7(0x144)](_0x39d7a7(0xf5)+_0xc94fa2[_0x39d7a7(0x120)]),console[_0x39d7a7(0x144)](_0x39d7a7(0x15a)+_0xc94fa2[_0x39d7a7(0xfe)]),console[_0x39d7a7(0x144)](_0x39d7a7(0x11b)+(_0xc94fa2[_0x39d7a7(0x176)]||_0x39d7a7(0x13e))),console[_0x39d7a7(0x144)]('\x20\x20Full\x20path:\x20'+_0xc94fa2[_0x39d7a7(0x11c)])),_0xc94fa2[_0x39d7a7(0x11c)];}catch(_0x560894){throw new SDKError(ErrorCode[_0x39d7a7(0x12c)],_0x39d7a7(0x129)+_0x560894[_0x39d7a7(0x150)]);}if(!_0xaa5c22)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x39d7a7(0x190));return _0xaa5c22+'/'+_0x2bd2d6;}export class SegmentDescribeCommand extends BaseCommand{['name']=a37_0x2f5cd1(0xf4);[a37_0x2f5cd1(0x146)]=a37_0x2f5cd1(0x139);async[a37_0x2f5cd1(0x10b)](_0x2238d1){const _0xb93d66=a37_0x2f5cd1,{options:_0x407a4f,args:_0x3e3277,tdx:_0x16182b}=_0x2238d1,_0xfa31da=_0x3e3277[0x0],_0x591dd3=!_0xfa31da&&!!_0x407a4f[_0xb93d66(0x120)],_0x3a0559=_0xfa31da||_0x407a4f[_0xb93d66(0x120)];if(!_0x3a0559)return console[_0xb93d66(0x144)](_0xb93d66(0x184)),console['error'](_0xb93d66(0x151)),console[_0xb93d66(0x144)](_0xb93d66(0x14d)),console['error'](_0xb93d66(0x18f)),console[_0xb93d66(0x144)](_0xb93d66(0x142)),console[_0xb93d66(0x144)](_0xb93d66(0x105)),console[_0xb93d66(0x144)](_0xb93d66(0x11f)),0x1;try{const _0x580515=_0x407a4f[_0xb93d66(0x12b)];let _0x388371=_0x3a0559;!_0x591dd3&&_0x580515&&!_0x3a0559['includes']('/')&&(_0x388371=_0x580515+'/'+_0x3a0559,_0x407a4f[_0xb93d66(0x154)]&&console[_0xb93d66(0x144)](_0xb93d66(0x13c)+_0x388371));const _0x414a30=await withSpinner(_0xb93d66(0x123)+_0x388371+_0xb93d66(0x13a),()=>_0x16182b[_0xb93d66(0x188)][_0xb93d66(0x141)](_0x388371),{'verbose':_0x407a4f[_0xb93d66(0x154)]}),_0x5d5403=_0x414a30[_0xb93d66(0x11d)];_0x407a4f[_0xb93d66(0x154)]&&(console[_0xb93d66(0x144)](_0xb93d66(0x114)+_0x5d5403[_0xb93d66(0x163)]),console[_0xb93d66(0x144)](_0xb93d66(0x10f)+_0x5d5403[_0xb93d66(0x165)]),_0x5d5403[_0xb93d66(0x126)]&&console[_0xb93d66(0x144)](_0xb93d66(0x178)+_0x5d5403[_0xb93d66(0x126)]),_0x5d5403[_0xb93d66(0x18a)]&&console[_0xb93d66(0x144)](_0xb93d66(0x113)+_0x5d5403['segmentId']));if(_0x5d5403[_0xb93d66(0x163)]===_0xb93d66(0x15f)){const _0x5014bc=await withSpinner(_0xb93d66(0x14a),()=>_0x16182b[_0xb93d66(0x188)]['getParent'](_0x5d5403[_0xb93d66(0x165)]),{'verbose':_0x407a4f['verbose']});await handleSingleObjectOutput(_0x5014bc[_0xb93d66(0x11d)],_0x407a4f);}else{if(_0x5d5403[_0xb93d66(0x163)]===_0xb93d66(0x14e)){if(!_0x5d5403[_0xb93d66(0x126)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0xb93d66(0xfd));const _0x418f10=await withSpinner(_0xb93d66(0x132),()=>_0x16182b['segment'][_0xb93d66(0x16d)](_0x5d5403[_0xb93d66(0x126)]),{'verbose':_0x407a4f['verbose']});await handleSingleObjectOutput(_0x418f10['data'],_0x407a4f);}else{if(_0x5d5403['type']==='segment'){if(!_0x5d5403[_0xb93d66(0x18a)])throw new SDKError(ErrorCode[_0xb93d66(0x147)],_0xb93d66(0x193));const _0x28cadf=await withSpinner(_0xb93d66(0xf3),()=>_0x16182b['segment']['getSegment'](_0x5d5403[_0xb93d66(0x165)],_0x5d5403[_0xb93d66(0x18a)]),{'verbose':_0x407a4f['verbose']});await handleSingleObjectOutput(_0x28cadf[_0xb93d66(0x11d)],_0x407a4f);}}}return 0x0;}catch(_0x4cbe5f){if(_0x4cbe5f instanceof SDKError)return console[_0xb93d66(0x144)](_0xb93d66(0x14f)+_0x4cbe5f[_0xb93d66(0x150)]),_0x4cbe5f['cause']&&console[_0xb93d66(0x144)](_0xb93d66(0x199)+_0x4cbe5f['cause']),0x1;throw _0x4cbe5f;}}}export class SegmentShowCommand extends BaseCommand{['name']=a37_0x2f5cd1(0x169);['description']=a37_0x2f5cd1(0x153);async[a37_0x2f5cd1(0x10b)](_0x353112){const _0x7b9f6f=a37_0x2f5cd1,{options:_0x32c86f,args:_0x27ab85,tdx:_0x4bbd5e}=_0x353112,_0x5c1dcd=_0x27ab85[0x0];if(!_0x5c1dcd)return console[_0x7b9f6f(0x144)](_0x7b9f6f(0x19b)),console[_0x7b9f6f(0x144)](_0x7b9f6f(0x185)),console[_0x7b9f6f(0x144)](_0x7b9f6f(0x195)),console[_0x7b9f6f(0x144)](_0x7b9f6f(0x14d)),console[_0x7b9f6f(0x144)](_0x7b9f6f(0x18e)),console[_0x7b9f6f(0x144)](_0x7b9f6f(0xfb)),0x1;try{const _0x7ebbe2=_0x32c86f['parentSegment'],_0x37aad5=await resolveSegmentTarget(_0x5c1dcd,_0x7ebbe2,_0x32c86f[_0x7b9f6f(0x154)]);_0x32c86f[_0x7b9f6f(0x154)]&&console[_0x7b9f6f(0x144)](_0x7b9f6f(0x117)+_0x37aad5);const _0xed9b4=await withSpinner('Resolving\x20\x27'+_0x5c1dcd+_0x7b9f6f(0x13a),()=>_0x4bbd5e[_0x7b9f6f(0x188)][_0x7b9f6f(0x141)](_0x37aad5),{'verbose':_0x32c86f[_0x7b9f6f(0x154)]}),_0x18635b=_0xed9b4[_0x7b9f6f(0x11d)];_0x32c86f[_0x7b9f6f(0x154)]&&(console[_0x7b9f6f(0x144)](_0x7b9f6f(0x114)+_0x18635b[_0x7b9f6f(0x163)]),console[_0x7b9f6f(0x144)](_0x7b9f6f(0x10f)+_0x18635b[_0x7b9f6f(0x165)]));if(_0x18635b[_0x7b9f6f(0x163)]===_0x7b9f6f(0x14e))return console[_0x7b9f6f(0x144)](_0x7b9f6f(0x158)),console[_0x7b9f6f(0x144)]('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x18635b['type']===_0x7b9f6f(0x15f))return console['error'](_0x7b9f6f(0x191)),console[_0x7b9f6f(0x144)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x18635b['segmentId'])throw new SDKError(ErrorCode[_0x7b9f6f(0x147)],_0x7b9f6f(0x193));const _0x42fbbc=await withSpinner(_0x7b9f6f(0x15c),()=>_0x4bbd5e['segment']['getSegmentSQL'](_0x18635b[_0x7b9f6f(0x165)],_0x18635b['segmentId']),{'verbose':_0x32c86f['verbose']});let _0x5b6e9e=_0x42fbbc[_0x7b9f6f(0x11d)];const _0x2984ff=resolveLimit(_0x32c86f[_0x7b9f6f(0xf7)],DEFAULT_DISPLAY_LIMIT),_0x228e7b=/\bLIMIT\s+\d+/i[_0x7b9f6f(0x18b)](_0x5b6e9e);!_0x228e7b&&(_0x5b6e9e=_0x5b6e9e['trim']()[_0x7b9f6f(0x135)](/;+$/,''),_0x5b6e9e=_0x7b9f6f(0x11e)+_0x5b6e9e+_0x7b9f6f(0x197)+_0x2984ff);_0x32c86f[_0x7b9f6f(0x154)]&&console[_0x7b9f6f(0x144)](_0x7b9f6f(0x189)+_0x5b6e9e);const _0x508aa8=await withProgressSpinner(_0x7b9f6f(0x112),async _0x51a078=>{const _0x391b40=_0x7b9f6f,_0x1e43fe=await _0x4bbd5e[_0x391b40(0x13f)][_0x391b40(0x10b)](_0x5b6e9e,{'catalog':'td','schema':_0x391b40(0x145),'onJobId':_0x8ca050=>{_0x51a078['setJobId'](_0x8ca050);}});return _0x1e43fe;},{'verbose':_0x32c86f['verbose']}),_0x14a227=_0x508aa8[_0x7b9f6f(0x11d)],_0x93f5e1=_0x14a227[_0x7b9f6f(0x157)]?_0x7b9f6f(0x119)+_0x14a227[_0x7b9f6f(0x157)]+']':'';return console[_0x7b9f6f(0x144)](_0x7b9f6f(0x16a)+_0x14a227[_0x7b9f6f(0x149)][_0x7b9f6f(0x173)][_0x7b9f6f(0x17b)]()+_0x7b9f6f(0x171)+(_0x7b9f6f(0x143)+formatElapsed(_0x14a227[_0x7b9f6f(0x149)]['elapsedTimeMillis'])+_0x93f5e1)),await handleQueryOutput(_0x14a227,_0x32c86f),0x0;}catch(_0x287f55){if(_0x287f55 instanceof SDKError)return console[_0x7b9f6f(0x144)](_0x7b9f6f(0x103)+_0x287f55[_0x7b9f6f(0x159)]+']'),console['error']('\x0a'+_0x287f55[_0x7b9f6f(0x150)]),0x1;throw _0x287f55;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x2f5cd1(0x136)]=a37_0x2f5cd1(0x177);[a37_0x2f5cd1(0x146)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async['execute'](_0x5187a4){const _0xbd56bb=a37_0x2f5cd1,{options:_0x11c2b7,args:_0x3f255d,tdx:_0x12cf2a}=_0x5187a4;if(_0x3f255d[_0xbd56bb(0x127)]===0x0)return console[_0xbd56bb(0x144)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0xbd56bb(0x144)](_0xbd56bb(0x170)),0x1;const _0x19848d=_0x3f255d[0x0];try{_0x11c2b7[_0xbd56bb(0x154)]&&(console[_0xbd56bb(0x144)]('Site:\x20'+_0x11c2b7[_0xbd56bb(0x12a)]),console[_0xbd56bb(0x144)](_0xbd56bb(0x179)+_0x19848d));const _0x5a054f=await withSpinner(_0xbd56bb(0xf6)+_0x19848d+_0xbd56bb(0x13a),()=>_0x12cf2a[_0xbd56bb(0x188)]['resolveParentId'](_0x19848d),{'verbose':_0x11c2b7['verbose']}),_0x59e838=_0x5a054f[_0xbd56bb(0x11d)];_0x11c2b7[_0xbd56bb(0x154)]&&console['error'](_0xbd56bb(0x182)+_0x59e838);const _0x435077=await withSpinner(_0xbd56bb(0x17d)+_0x19848d+_0xbd56bb(0x13a),()=>_0x12cf2a[_0xbd56bb(0x188)][_0xbd56bb(0x17f)](_0x59e838),{'verbose':_0x11c2b7[_0xbd56bb(0x154)]}),_0x509aa2=_0x435077[_0xbd56bb(0x11d)];return console[_0xbd56bb(0x144)](_0xbd56bb(0x109)+_0x509aa2[_0xbd56bb(0x127)]+'\x20folder'+(_0x509aa2[_0xbd56bb(0x127)]!==0x1?'s':'')),await handleSDKOutput(_0x509aa2,_0x11c2b7),0x0;}catch(_0x3ed66c){if(_0x3ed66c instanceof SDKError)return console[_0xbd56bb(0x144)](_0xbd56bb(0x14f)+_0x3ed66c['message']),_0x3ed66c[_0xbd56bb(0xfc)]&&console['error'](_0xbd56bb(0x199)+_0x3ed66c['cause']),0x1;throw _0x3ed66c;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x2f5cd1(0x136)]='segment:folder:show';['description']=a37_0x2f5cd1(0x118);async[a37_0x2f5cd1(0x10b)](_0x5c2a60){const _0x308b10=a37_0x2f5cd1,{options:_0x573616,args:_0x56e513,tdx:_0x5a911b}=_0x5c2a60;if(_0x56e513[_0x308b10(0x127)]===0x0)return console['error']('Error:\x20Folder\x20reference\x20is\x20required'),console[_0x308b10(0x144)](_0x308b10(0xff)),0x1;try{const {parentId:_0xea3dc4,childId:_0x3a8c6e}=parseSegmentRef(_0x56e513[0x0]);_0x573616[_0x308b10(0x154)]&&(console[_0x308b10(0x144)](_0x308b10(0x12d)+_0x573616[_0x308b10(0x12a)]),console[_0x308b10(0x144)](_0x308b10(0x179)+_0xea3dc4),_0x3a8c6e&&console['error']('Folder\x20name:\x20'+_0x3a8c6e));if(!_0x3a8c6e)return console[_0x308b10(0x144)](_0x308b10(0x174)),0x1;const _0x3fca7b=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0xea3dc4+_0x308b10(0x13a),()=>_0x5a911b['segment']['resolveParentId'](_0xea3dc4),{'verbose':_0x573616['verbose']}),_0x17b6c9=_0x3fca7b[_0x308b10(0x11d)];_0x573616['verbose']&&console['error'](_0x308b10(0x182)+_0x17b6c9);const _0x49b2d5=await withSpinner(_0x308b10(0x196)+_0x3a8c6e+_0x308b10(0x13a),()=>_0x5a911b[_0x308b10(0x188)][_0x308b10(0x19a)](_0x17b6c9,_0x3a8c6e),{'verbose':_0x573616[_0x308b10(0x154)]}),_0x2b9ebf=_0x49b2d5[_0x308b10(0x11d)];_0x573616[_0x308b10(0x154)]&&console[_0x308b10(0x144)](_0x308b10(0x16c)+_0x2b9ebf);const _0x1e9e8b=await withSpinner('Fetching\x20folder\x20\x27'+_0x3a8c6e+_0x308b10(0x13a),()=>_0x5a911b[_0x308b10(0x188)][_0x308b10(0x16d)](_0x2b9ebf),{'verbose':_0x573616[_0x308b10(0x154)]});return await handleSDKOutput([_0x1e9e8b[_0x308b10(0x11d)]],_0x573616),0x0;}catch(_0x50b755){if(_0x50b755 instanceof SDKError)return console[_0x308b10(0x144)](_0x308b10(0x14f)+_0x50b755[_0x308b10(0x150)]),_0x50b755[_0x308b10(0xfc)]&&console[_0x308b10(0x144)](_0x308b10(0x199)+_0x50b755['cause']),0x1;throw _0x50b755;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a37_0x2f5cd1(0x198);[a37_0x2f5cd1(0x146)]='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a37_0x2f5cd1(0x10b)](_0x531060){const _0x755d9c=a37_0x2f5cd1,{options:_0x442e6d,args:_0x123a48}=_0x531060,_0x3643e0=_0x442e6d,_0x38e76b=_0x3643e0[_0x755d9c(0x155)],_0x252ba8=_0x123a48[0x0];if(!_0x252ba8&&!_0x38e76b)return console[_0x755d9c(0x144)](a37_0xf4558b[_0x755d9c(0x111)](_0x755d9c(0x17c))),console['error'](_0x755d9c(0x167)),console[_0x755d9c(0x144)](_0x755d9c(0x10e)),console[_0x755d9c(0x144)]('\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>'),console[_0x755d9c(0x144)](_0x755d9c(0x14d)),console['error'](_0x755d9c(0x10c)),console['error'](_0x755d9c(0x121)),0x1;if(_0x252ba8&&_0x38e76b)return console[_0x755d9c(0x144)](a37_0xf4558b[_0x755d9c(0x111)](_0x755d9c(0x164))),0x1;try{let _0x4c174a;if(_0x38e76b)_0x4c174a=await this['getSQLFromYamlFile'](_0x38e76b,_0x531060);else{if(isYamlFilePath(_0x252ba8))return console[_0x755d9c(0x144)](a37_0xf4558b[_0x755d9c(0x111)](_0x755d9c(0x156))),console['error'](_0x755d9c(0x14b)+_0x252ba8),0x1;else _0x4c174a=await this[_0x755d9c(0x125)](_0x252ba8,_0x531060);}return _0x442e6d[_0x755d9c(0x100)]===_0x755d9c(0x166)||_0x442e6d[_0x755d9c(0x100)]===_0x755d9c(0x13b)?await handleSDKOutput([{'sql':_0x4c174a}],_0x442e6d):console[_0x755d9c(0x115)](_0x4c174a),0x0;}catch(_0x21eb3a){if(_0x21eb3a instanceof SDKError)return console[_0x755d9c(0x144)](_0x755d9c(0x14f)+_0x21eb3a[_0x755d9c(0x150)]),_0x21eb3a[_0x755d9c(0xfc)]&&console[_0x755d9c(0x144)](_0x755d9c(0x199)+_0x21eb3a[_0x755d9c(0xfc)]),0x1;throw _0x21eb3a;}}async[a37_0x2f5cd1(0x16b)](_0x3085c4,_0x3901de){const _0x2fd519=a37_0x2f5cd1,{options:_0x59c124,tdx:_0x25dd3b}=_0x3901de;let _0x112783;try{_0x112783=await resolveYamlFilePath(_0x3085c4);}catch(_0x28019c){throw new SDKError(ErrorCode[_0x2fd519(0x12c)],_0x2fd519(0x129)+_0x28019c[_0x2fd519(0x150)]);}_0x59c124[_0x2fd519(0x154)]&&console[_0x2fd519(0x144)](_0x2fd519(0x17a)+_0x112783['parentSegment']+'/'+_0x112783[_0x2fd519(0xfe)]);const _0x2e3285=await withSpinner(_0x2fd519(0x16f),()=>_0x25dd3b[_0x2fd519(0x188)]['getSegmentSQLFromYaml'](_0x112783[_0x2fd519(0x12e)],_0x112783[_0x2fd519(0x120)],_0x112783[_0x2fd519(0xfe)]),{'verbose':_0x59c124[_0x2fd519(0x154)]});return _0x2e3285[_0x2fd519(0x11d)];}async[a37_0x2f5cd1(0x125)](_0x27d321,_0xd306ae){const _0x3377eb=a37_0x2f5cd1,{options:_0x2672aa,tdx:_0x4a9ea9}=_0xd306ae,_0x347be2=_0x2672aa[_0x3377eb(0x120)],_0x36d57c=await resolveSegmentTarget(_0x27d321,_0x347be2,_0x2672aa[_0x3377eb(0x154)]);_0x2672aa[_0x3377eb(0x154)]&&console[_0x3377eb(0x144)](_0x3377eb(0x117)+_0x36d57c);const _0x4146b4=await withSpinner(_0x3377eb(0x10d)+_0x27d321+_0x3377eb(0x13a),()=>_0x4a9ea9[_0x3377eb(0x188)][_0x3377eb(0x141)](_0x36d57c),{'verbose':_0x2672aa[_0x3377eb(0x154)]}),_0x69f897=_0x4146b4[_0x3377eb(0x11d)];_0x2672aa[_0x3377eb(0x154)]&&(console[_0x3377eb(0x144)]('Resolved\x20type:\x20'+_0x69f897[_0x3377eb(0x163)]),console[_0x3377eb(0x144)](_0x3377eb(0x10f)+_0x69f897['parentId']));if(_0x69f897['type']==='folder')throw new SDKError(ErrorCode[_0x3377eb(0x12c)],_0x3377eb(0xf9));if(_0x69f897[_0x3377eb(0x163)]===_0x3377eb(0x15f))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql');if(!_0x69f897[_0x3377eb(0x18a)])throw new SDKError(ErrorCode[_0x3377eb(0x147)],_0x3377eb(0x193));const _0x1dab68=await withSpinner(_0x3377eb(0x15c),()=>_0x4a9ea9[_0x3377eb(0x188)]['getSegmentSQL'](_0x69f897[_0x3377eb(0x165)],_0x69f897[_0x3377eb(0x18a)]),{'verbose':_0x2672aa[_0x3377eb(0x154)]});return _0x1dab68[_0x3377eb(0x11d)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x2f5cd1(0x136)]='segment:folder:create';[a37_0x2f5cd1(0x146)]=a37_0x2f5cd1(0x181);async[a37_0x2f5cd1(0x10b)](_0xe28e){const _0x6a7a3a=a37_0x2f5cd1,{options:_0x16219d,args:_0x3e45d5,tdx:_0x49d7f2}=_0xe28e,_0x345669=_0x16219d;if(_0x3e45d5[_0x6a7a3a(0x127)]<0x2)return console[_0x6a7a3a(0x144)](_0x6a7a3a(0x122)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x58a999=_0x3e45d5[0x0],_0x512de7=_0x3e45d5[0x1];_0x345669[_0x6a7a3a(0x154)]&&(console[_0x6a7a3a(0x144)]('Site:\x20'+_0x345669[_0x6a7a3a(0x12a)]),console[_0x6a7a3a(0x144)]('Parent\x20segment:\x20'+_0x58a999),console[_0x6a7a3a(0x144)]('Folder\x20name:\x20'+_0x512de7));let _0x383ff4;if(_0x345669[_0x6a7a3a(0xfa)]){const _0xbf6525=_0x345669[_0x6a7a3a(0xfa)],_0x40bb97=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x58a999+'\x27...',()=>_0x49d7f2[_0x6a7a3a(0x188)][_0x6a7a3a(0x130)](_0x58a999),{'verbose':_0x345669[_0x6a7a3a(0x154)]}),_0xc010c0=_0x40bb97['data'],_0x4dbf86=await withSpinner(_0x6a7a3a(0x104)+_0xbf6525+_0x6a7a3a(0x13a),()=>_0x49d7f2['segment'][_0x6a7a3a(0x19a)](_0xc010c0,_0xbf6525),{'verbose':_0x345669[_0x6a7a3a(0x154)]});_0x383ff4=_0x4dbf86[_0x6a7a3a(0x11d)],_0x345669[_0x6a7a3a(0x154)]&&console['error']('Resolved\x20parent\x20folder\x20ID:\x20'+_0x383ff4);}const _0x3c5f73={'name':_0x512de7,'description':_0x345669[_0x6a7a3a(0x146)],'parentFolderId':_0x383ff4},_0x68e2f=await withSpinner(_0x6a7a3a(0x10a)+_0x512de7+_0x6a7a3a(0x13a),()=>_0x49d7f2[_0x6a7a3a(0x188)]['createFolder'](_0x58a999,_0x3c5f73),{'verbose':_0x345669['verbose']}),_0x27cf75=_0x68e2f[_0x6a7a3a(0x11d)];return console['error'](_0x6a7a3a(0x14c)+_0x27cf75['name']+_0x6a7a3a(0x186)+_0x27cf75['id']),await handleSDKOutput([_0x27cf75],_0x345669),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a37_0x2f5cd1(0x12f);[a37_0x2f5cd1(0x146)]='Show\x20folder\x20or\x20child\x20segment\x20details';async[a37_0x2f5cd1(0x10b)](_0x16b0cb){const _0x3e34ec=a37_0x2f5cd1,{options:_0x366353,args:_0x296c15,tdx:_0x56a29b}=_0x16b0cb,_0xb0fb7d=_0x296c15[0x0];if(!_0xb0fb7d)return console[_0x3e34ec(0x144)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x3e34ec(0x144)]('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console[_0x3e34ec(0x144)](_0x3e34ec(0x187)),console['error'](_0x3e34ec(0x107)),console[_0x3e34ec(0x144)](_0x3e34ec(0x116)),console[_0x3e34ec(0x144)]('Examples:'),console['error'](_0x3e34ec(0x11a)),console[_0x3e34ec(0x144)](_0x3e34ec(0x131)),console[_0x3e34ec(0x144)](_0x3e34ec(0x194)),console[_0x3e34ec(0x144)](_0x3e34ec(0x175)),0x1;try{const _0x9b50c3=_0x366353[_0x3e34ec(0x120)],_0x5d4da1=await resolveSegmentTarget(_0xb0fb7d,_0x9b50c3,_0x366353['verbose']);_0x366353[_0x3e34ec(0x154)]&&console[_0x3e34ec(0x144)](_0x3e34ec(0x117)+_0x5d4da1);const _0x1aa2b7=await withSpinner('Resolving\x20\x27'+_0xb0fb7d+'\x27...',()=>_0x56a29b[_0x3e34ec(0x188)]['resolvePathToResource'](_0x5d4da1),{'verbose':_0x366353[_0x3e34ec(0x154)]}),_0x2271be=_0x1aa2b7['data'];_0x366353[_0x3e34ec(0x154)]&&(console[_0x3e34ec(0x144)](_0x3e34ec(0x114)+_0x2271be[_0x3e34ec(0x163)]),console[_0x3e34ec(0x144)]('Parent\x20ID:\x20'+_0x2271be[_0x3e34ec(0x165)]),_0x2271be['folderId']&&console[_0x3e34ec(0x144)](_0x3e34ec(0x178)+_0x2271be['folderId']),_0x2271be[_0x3e34ec(0x18a)]&&console[_0x3e34ec(0x144)]('Segment\x20ID:\x20'+_0x2271be[_0x3e34ec(0x18a)]));if(_0x366353[_0x3e34ec(0x140)]){if(_0x2271be['type']===_0x3e34ec(0x14e))return console['error'](_0x3e34ec(0x102)),0x1;if(_0x2271be[_0x3e34ec(0x163)]===_0x3e34ec(0x15f))return console['error'](_0x3e34ec(0x16e)),console[_0x3e34ec(0x144)]('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x2271be['segmentId'])throw new SDKError(ErrorCode[_0x3e34ec(0x147)],_0x3e34ec(0x193));const _0x6872bf=getConsoleNextUrl(_0x366353[_0x3e34ec(0x12a)],_0x3e34ec(0x18d)+_0x2271be[_0x3e34ec(0x165)]+_0x3e34ec(0x128)+_0x2271be[_0x3e34ec(0x18a)]);return console[_0x3e34ec(0x144)](a37_0xf4558b[_0x3e34ec(0x15b)]('✔')+_0x3e34ec(0x192)+a37_0xf4558b[_0x3e34ec(0xf8)](_0x6872bf)),openBrowser(_0x6872bf),0x0;}if(_0x2271be[_0x3e34ec(0x163)]===_0x3e34ec(0x14e)){if(!_0x2271be[_0x3e34ec(0x126)])throw new SDKError(ErrorCode[_0x3e34ec(0x172)],_0x3e34ec(0xfd));const _0x4284b7=await withSpinner(_0x3e34ec(0x132),()=>_0x56a29b[_0x3e34ec(0x188)][_0x3e34ec(0x16d)](_0x2271be[_0x3e34ec(0x126)]),{'verbose':_0x366353['verbose']});await handleSingleObjectOutput(_0x4284b7[_0x3e34ec(0x11d)],_0x366353);}else{if(_0x2271be[_0x3e34ec(0x163)]===_0x3e34ec(0x188)){if(!_0x2271be[_0x3e34ec(0x18a)])throw new SDKError(ErrorCode[_0x3e34ec(0x147)],_0x3e34ec(0x193));const _0xb57d2c=await withSpinner('Fetching\x20segment\x20details...',()=>_0x56a29b[_0x3e34ec(0x188)][_0x3e34ec(0x134)](_0x2271be[_0x3e34ec(0x165)],_0x2271be['segmentId']),{'verbose':_0x366353[_0x3e34ec(0x154)]}),_0x3fdfe6=getConsoleNextUrl(_0x366353[_0x3e34ec(0x12a)],'/app/ps/'+_0x2271be['parentId']+'/e/'+_0x2271be['segmentId']),_0x700b0a=_0xb57d2c[_0x3e34ec(0x11d)];_0x700b0a[_0x3e34ec(0x19c)]=_0x3fdfe6,await handleSingleObjectOutput(_0x700b0a,_0x366353);}else return console[_0x3e34ec(0x144)](_0x3e34ec(0x162)),console[_0x3e34ec(0x144)](_0x3e34ec(0x160)),0x1;}return 0x0;}catch(_0x29bc4a){if(_0x29bc4a instanceof SDKError)return console[_0x3e34ec(0x144)]('Error:\x20'+_0x29bc4a['message']),_0x29bc4a[_0x3e34ec(0xfc)]&&console[_0x3e34ec(0x144)]('\x20\x20Cause:\x20'+_0x29bc4a[_0x3e34ec(0xfc)]),0x1;throw _0x29bc4a;}}}export const SegmentInfoCommand=SegmentViewCommand;function a37_0x592c(){const _0x1468b7=['Fetching\x20SQL\x20from\x20rule...','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','\x20rows\x20','SEGMENT_FOLDER_NOT_FOUND','processedRows','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','folderPath','segment:folder:list','Folder\x20ID:\x20','Parent\x20name:\x20','Resolved:\x20','toLocaleString','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','Listing\x20folders\x20for\x20parent\x20\x27','6kDqiyW','listFolders','1369040bNfFoR','Create\x20segment\x20folder\x20for\x20organization','Resolved\x20parent\x20ID:\x20','Use:\x20tdx\x20ps\x20desc','Error:\x20Path\x20or\x20name\x20is\x20required','Usage:\x20tdx\x20sg\x20show\x20<name>','\x27\x20with\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','segment','SQL\x20query:\x0a','segmentId','test','48YtlSES','/app/ps/','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20Opening\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Resolving\x20folder\x20\x27','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','segment:sql','\x20\x20Cause:\x20','resolveFolderId','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','url','Fetching\x20segment\x20details...','segment:describe','\x20\x20Parent\x20segment:\x20','Resolving\x20parent\x20segment\x20\x27','limit','cyan','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','parentFolder','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','cause','Folder\x20ID\x20missing\x20from\x20resolved\x20path','segmentName','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','format','20mLOXuQ','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','✖\x20Query\x20failed\x20[','Resolving\x20parent\x20folder\x20\x27','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','5434710jganZd','Options:','1887792stsjzA','✔\x20Found\x20','Creating\x20folder\x20\x27','execute','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Resolving\x20\x27','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','Parent\x20ID:\x20','836343CxcBXM','red','Executing\x20segment\x20query...','Segment\x20ID:\x20','Resolved\x20type:\x20','log','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Target\x20path:\x20','Show\x20segment\x20folder\x20details','\x20[Job\x20ID:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','\x20\x20Folder\x20path:\x20','fullPath','data','SELECT\x20*\x20FROM\x20(\x0a','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','parentSegment','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Resolving\x20path\x20\x27','getSegmentSQL','getSQLFromServerSegment','folderId','length','/e/','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','site','segmentPath','INVALID_ARGUMENT','Site:\x20','content','segment:view','resolveParentId','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Fetching\x20folder\x20details...','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','getSegment','replace','name','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','624656yNAmiy','Show\x20segment\x20or\x20folder\x20details','\x27...','jsonl','Resolved\x20relative\x20path\x20to:\x20','segment:desc','(root)','query','web','resolvePathToResource','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','in\x20','error','information_schema','description','SEGMENT_NOT_FOUND','Usage:\x20tdx\x20sg\x20desc\x20<name>','stats','Fetching\x20parent\x20segment\x20details...','\x20\x20tdx\x20sg\x20sql\x20--path\x20','✔\x20Created\x20folder\x20\x27','Examples:','folder','Error:\x20','message','Usage:\x20tdx\x20segment\x20describe\x20<path>','304236clnDDe','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','verbose','path','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','jobId','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','code','\x20\x20Segment\x20name:\x20','green','Fetching\x20SQL\x20for\x20segment...','9612148yTmmou','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','parent','Use:\x20tdx\x20ps\x20view','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','type','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','parentId','json','Usage:','Show\x20child\x20segment\x20schema\x20(column\x20types)','segment:show','✔\x20Query\x20completed:\x20Processed\x20','getSQLFromYamlFile','Resolved\x20folder\x20ID:\x20','getFolder','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'];a37_0x592c=function(){return _0x1468b7;};return a37_0x592c();}export class SegmentDescCommand extends BaseCommand{[a37_0x2f5cd1(0x136)]=a37_0x2f5cd1(0x13d);[a37_0x2f5cd1(0x146)]=a37_0x2f5cd1(0x168);async[a37_0x2f5cd1(0x10b)](_0x84b96){const _0xeafdd7=a37_0x2f5cd1,{options:_0x14e08d,args:_0x4c47b9,tdx:_0xc0cee4}=_0x84b96,_0x36d791=_0x4c47b9[0x0];if(!_0x36d791)return console[_0xeafdd7(0x144)](_0xeafdd7(0x19b)),console[_0xeafdd7(0x144)](_0xeafdd7(0x148)),console['error'](_0xeafdd7(0x15e)),console[_0xeafdd7(0x144)]('Examples:'),console[_0xeafdd7(0x144)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0xeafdd7(0x144)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x29cdb8=_0x14e08d['parentSegment'],_0x5668bb=await resolveSegmentTarget(_0x36d791,_0x29cdb8,_0x14e08d['verbose']);_0x14e08d['verbose']&&console[_0xeafdd7(0x144)](_0xeafdd7(0x117)+_0x5668bb);const _0x4ad7e1=await withSpinner(_0xeafdd7(0x10d)+_0x36d791+'\x27...',()=>_0xc0cee4[_0xeafdd7(0x188)]['resolvePathToResource'](_0x5668bb),{'verbose':_0x14e08d[_0xeafdd7(0x154)]}),_0x331cf0=_0x4ad7e1[_0xeafdd7(0x11d)];_0x14e08d[_0xeafdd7(0x154)]&&(console[_0xeafdd7(0x144)](_0xeafdd7(0x114)+_0x331cf0['type']),console[_0xeafdd7(0x144)](_0xeafdd7(0x10f)+_0x331cf0[_0xeafdd7(0x165)]));if(_0x331cf0[_0xeafdd7(0x163)]===_0xeafdd7(0x14e))return console[_0xeafdd7(0x144)](_0xeafdd7(0x161)),console[_0xeafdd7(0x144)](_0xeafdd7(0x133)),0x1;if(_0x331cf0[_0xeafdd7(0x163)]===_0xeafdd7(0x15f))return console[_0xeafdd7(0x144)](_0xeafdd7(0x137)),console['error'](_0xeafdd7(0x183)),0x1;if(!_0x331cf0[_0xeafdd7(0x18a)])throw new SDKError(ErrorCode[_0xeafdd7(0x147)],_0xeafdd7(0x193));const _0x18571a=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0xc0cee4['segment'][_0xeafdd7(0x124)](_0x331cf0[_0xeafdd7(0x165)],_0x331cf0[_0xeafdd7(0x18a)]),{'verbose':_0x14e08d[_0xeafdd7(0x154)]}),_0x82671=_0x18571a[_0xeafdd7(0x11d)],_0x8877b3=await executeSchemaQuery(_0x82671,_0xc0cee4,_0x14e08d);return await handleQueryOutput(_0x8877b3,_0x14e08d),0x0;}catch(_0x356862){if(_0x356862 instanceof SDKError)return console[_0xeafdd7(0x144)](_0xeafdd7(0x14f)+_0x356862[_0xeafdd7(0x150)]),_0x356862['cause']&&console[_0xeafdd7(0x144)](_0xeafdd7(0x199)+_0x356862['cause']),0x1;throw _0x356862;}}}
1
+ const a37_0x3d08b7=a37_0x5f39;(function(_0x446d44,_0x33f469){const _0x3a2efa=a37_0x5f39,_0x34b899=_0x446d44();while(!![]){try{const _0xedba6c=-parseInt(_0x3a2efa(0x1b1))/0x1*(-parseInt(_0x3a2efa(0x1bf))/0x2)+parseInt(_0x3a2efa(0x24f))/0x3*(parseInt(_0x3a2efa(0x1cc))/0x4)+parseInt(_0x3a2efa(0x1c2))/0x5+-parseInt(_0x3a2efa(0x223))/0x6*(-parseInt(_0x3a2efa(0x209))/0x7)+parseInt(_0x3a2efa(0x227))/0x8+-parseInt(_0x3a2efa(0x21f))/0x9*(-parseInt(_0x3a2efa(0x1d3))/0xa)+-parseInt(_0x3a2efa(0x203))/0xb;if(_0xedba6c===_0x33f469)break;else _0x34b899['push'](_0x34b899['shift']());}catch(_0x507cfd){_0x34b899['push'](_0x34b899['shift']());}}}(a37_0x24b5,0x49fbd));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';function a37_0x5f39(_0x24c602,_0x28383d){_0x24c602=_0x24c602-0x1b0;const _0x24b5a2=a37_0x24b5();let _0x5f3960=_0x24b5a2[_0x24c602];return _0x5f3960;}import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';function a37_0x24b5(){const _0x46ac79=['log','Show\x20folder\x20or\x20child\x20segment\x20details','✔\x20Found\x20','parent','getFolder','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Target\x20path:\x20','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Resolved:\x20','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','12106plAyfX','\x20rows\x20','parentSegment','1953940hoFPJG','stats','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Use:\x20tdx\x20ps\x20desc','query','site','segment:folder:list','includes','getParent','52aNnsXY','trim','Fetching\x20folder\x20\x27','Show\x20segment\x20folder\x20details','Resolving\x20path\x20\x27','segment:folder:show','data','2010axxHvg','segmentPath','segment:sql','Options:','segment:view','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','parentId','processedRows','segmentName','red','Executing\x20segment\x20query...','getSQLFromYamlFile','web','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','folderId','cause','Show\x20child\x20segment\x20schema\x20(column\x20types)','/e/','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','parentFolder','getSegmentSQL','replace','resolvePathToResource','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Resolved\x20parent\x20folder\x20ID:\x20','\x20Opening\x20','✔\x20Query\x20completed:\x20Processed\x20','segment','Resolved\x20parent\x20ID:\x20','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','Parent\x20name:\x20','verbose','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Resolving\x20folder\x20\x27','Fetching\x20segment\x20details...','execute','Folder\x20name:\x20','\x20\x20Cause:\x20','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','Site:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Resolving\x20\x27','Usage:','toLocaleString','SELECT\x20*\x20FROM\x20(\x0a','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Resolving\x20parent\x20segment\x20\x27','14169947spYxEQ','(root)','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Use:\x20tdx\x20ps\x20view','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','35hcAETC','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Fetching\x20SQL\x20for\x20segment...','elapsedTimeMillis','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','✔\x20Created\x20folder\x20\x27','Segment\x20ID:\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','INVALID_ARGUMENT','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Folder\x20ID\x20missing\x20from\x20resolved\x20path','\x20folder','segmentId','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Resolved\x20relative\x20path\x20to:\x20','url','/app/ps/','\x27\x20with\x20ID:\x20','SEGMENT_FOLDER_NOT_FOUND','8487yrZugw','Resolving\x20parent\x20folder\x20\x27','setJobId','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','222930sCBKFz','Use:\x20tdx\x20ps\x20view\x20-w','type','Show\x20segment\x20or\x20folder\x20details','1816376nKqYSz','resolveParentId','green','segment:describe','\x20\x20Parent\x20segment:\x20','name','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','message','error','jobId','Error:\x20','length','getSegment','limit','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Examples:','format','test','Parent\x20segment:\x20','Parent\x20ID:\x20','description','Fetching\x20parent\x20segment\x20details...','Get\x20SQL\x20query\x20for\x20child\x20segment','Usage:\x20tdx\x20sg\x20desc\x20<name>','Folder\x20ID:\x20','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','Listing\x20folders\x20for\x20parent\x20\x27','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Fetching\x20folder\x20details...','\x27...','\x20\x20Full\x20path:\x20','content','segment:desc','✖\x20Query\x20failed\x20[','folder','in\x20','resolveFolderId','75156hafmsi','Creating\x20folder\x20\x27','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Error:\x20Parent\x20segment\x20name\x20is\x20required','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','code','SEGMENT_NOT_FOUND','\x20\x20Folder\x20path:\x20','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Usage:\x20tdx\x20sg\x20show\x20<name>','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','jsonl','\x20[Job\x20ID:\x20','Resolved\x20type:\x20','fullPath','45bGmojH','getSQLFromServerSegment','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'];a37_0x24b5=function(){return _0x46ac79;};return a37_0x24b5();}import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0x4e311e from'chalk';async function resolveSegmentTarget(_0x3b9c6d,_0x4f3249,_0xf090ea){const _0x2f8830=a37_0x5f39;if(isYamlFilePath(_0x3b9c6d))try{const _0x44243b=await resolveYamlFilePath(_0x3b9c6d);return _0xf090ea&&(console[_0x2f8830(0x230)]('Resolved\x20YAML\x20file:\x20'+_0x3b9c6d),console[_0x2f8830(0x230)](_0x2f8830(0x22b)+_0x44243b[_0x2f8830(0x1c1)]),console[_0x2f8830(0x230)]('\x20\x20Segment\x20name:\x20'+_0x44243b['segmentName']),console['error'](_0x2f8830(0x256)+(_0x44243b['folderPath']||_0x2f8830(0x204))),console[_0x2f8830(0x230)](_0x2f8830(0x248)+_0x44243b[_0x2f8830(0x1b0)])),_0x44243b[_0x2f8830(0x1b0)];}catch(_0x214ec){throw new SDKError(ErrorCode[_0x2f8830(0x211)],_0x2f8830(0x25b)+_0x214ec[_0x2f8830(0x22f)]);}if(!_0x4f3249)throw new SDKError(ErrorCode[_0x2f8830(0x211)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x4f3249+'/'+_0x3b9c6d;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x3d08b7(0x22c)]=a37_0x3d08b7(0x22a);['description']=a37_0x3d08b7(0x226);async[a37_0x3d08b7(0x1f6)](_0x1d6501){const _0x59bbac=a37_0x3d08b7,{options:_0x2eddd3,args:_0x1586d2,tdx:_0x16302f}=_0x1d6501,_0x44736=_0x1586d2[0x0],_0x3f9785=!_0x44736&&!!_0x2eddd3['parentSegment'],_0x1609c3=_0x44736||_0x2eddd3[_0x59bbac(0x1c1)];if(!_0x1609c3)return console[_0x59bbac(0x230)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x59bbac(0x230)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x59bbac(0x230)]('Examples:'),console[_0x59bbac(0x230)](_0x59bbac(0x1fc)),console[_0x59bbac(0x230)](_0x59bbac(0x212)),console[_0x59bbac(0x230)](_0x59bbac(0x1b3)),console[_0x59bbac(0x230)](_0x59bbac(0x1bb)),0x1;try{const _0x4fdad6=_0x2eddd3[_0x59bbac(0x1d4)];let _0x15190d=_0x1609c3;!_0x3f9785&&_0x4fdad6&&!_0x1609c3[_0x59bbac(0x1ca)]('/')&&(_0x15190d=_0x4fdad6+'/'+_0x1609c3,_0x2eddd3[_0x59bbac(0x1f2)]&&console[_0x59bbac(0x230)](_0x59bbac(0x21a)+_0x15190d));const _0x2fd296=await withSpinner(_0x59bbac(0x1d0)+_0x15190d+_0x59bbac(0x247),()=>_0x16302f[_0x59bbac(0x1ee)][_0x59bbac(0x1e9)](_0x15190d),{'verbose':_0x2eddd3['verbose']}),_0x548659=_0x2fd296[_0x59bbac(0x1d2)];_0x2eddd3[_0x59bbac(0x1f2)]&&(console[_0x59bbac(0x230)](_0x59bbac(0x25e)+_0x548659[_0x59bbac(0x225)]),console[_0x59bbac(0x230)](_0x59bbac(0x23c)+_0x548659['parentId']),_0x548659[_0x59bbac(0x1e1)]&&console[_0x59bbac(0x230)](_0x59bbac(0x241)+_0x548659[_0x59bbac(0x1e1)]),_0x548659[_0x59bbac(0x217)]&&console[_0x59bbac(0x230)]('Segment\x20ID:\x20'+_0x548659['segmentId']));if(_0x548659[_0x59bbac(0x225)]===_0x59bbac(0x1b7)){const _0x458f00=await withSpinner(_0x59bbac(0x23e),()=>_0x16302f[_0x59bbac(0x1ee)][_0x59bbac(0x1cb)](_0x548659['parentId']),{'verbose':_0x2eddd3[_0x59bbac(0x1f2)]});await handleSingleObjectOutput(_0x458f00['data'],_0x2eddd3);}else{if(_0x548659[_0x59bbac(0x225)]===_0x59bbac(0x24c)){if(!_0x548659[_0x59bbac(0x1e1)])throw new SDKError(ErrorCode[_0x59bbac(0x21e)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x188679=await withSpinner('Fetching\x20folder\x20details...',()=>_0x16302f[_0x59bbac(0x1ee)][_0x59bbac(0x1b8)](_0x548659[_0x59bbac(0x1e1)]),{'verbose':_0x2eddd3[_0x59bbac(0x1f2)]});await handleSingleObjectOutput(_0x188679[_0x59bbac(0x1d2)],_0x2eddd3);}else{if(_0x548659[_0x59bbac(0x225)]===_0x59bbac(0x1ee)){if(!_0x548659['segmentId'])throw new SDKError(ErrorCode[_0x59bbac(0x255)],_0x59bbac(0x210));const _0x3c8c2e=await withSpinner(_0x59bbac(0x1f5),()=>_0x16302f['segment'][_0x59bbac(0x234)](_0x548659['parentId'],_0x548659['segmentId']),{'verbose':_0x2eddd3['verbose']});await handleSingleObjectOutput(_0x3c8c2e[_0x59bbac(0x1d2)],_0x2eddd3);}}}return 0x0;}catch(_0x26ff9d){if(_0x26ff9d instanceof SDKError)return console['error'](_0x59bbac(0x232)+_0x26ff9d[_0x59bbac(0x22f)]),_0x26ff9d[_0x59bbac(0x1e2)]&&console[_0x59bbac(0x230)](_0x59bbac(0x1f8)+_0x26ff9d[_0x59bbac(0x1e2)]),0x1;throw _0x26ff9d;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x3d08b7(0x22c)]='segment:show';[a37_0x3d08b7(0x23d)]=a37_0x3d08b7(0x22d);async[a37_0x3d08b7(0x1f6)](_0x5dd0d5){const _0x34a8ff=a37_0x3d08b7,{options:_0x13ed94,args:_0x5eba20,tdx:_0x4c9a75}=_0x5dd0d5,_0x339662=_0x5eba20[0x0];if(!_0x339662)return console[_0x34a8ff(0x230)](_0x34a8ff(0x1ea)),console[_0x34a8ff(0x230)](_0x34a8ff(0x258)),console['error'](_0x34a8ff(0x25a)),console[_0x34a8ff(0x230)](_0x34a8ff(0x238)),console[_0x34a8ff(0x230)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x34a8ff(0x230)](_0x34a8ff(0x222)),0x1;try{const _0x3ccbca=_0x13ed94[_0x34a8ff(0x1c1)],_0x44f317=await resolveSegmentTarget(_0x339662,_0x3ccbca,_0x13ed94['verbose']);_0x13ed94[_0x34a8ff(0x1f2)]&&console[_0x34a8ff(0x230)](_0x34a8ff(0x1ba)+_0x44f317);const _0x31fb94=await withSpinner(_0x34a8ff(0x1fd)+_0x339662+_0x34a8ff(0x247),()=>_0x4c9a75[_0x34a8ff(0x1ee)][_0x34a8ff(0x1e9)](_0x44f317),{'verbose':_0x13ed94['verbose']}),_0x35162a=_0x31fb94[_0x34a8ff(0x1d2)];_0x13ed94['verbose']&&(console[_0x34a8ff(0x230)]('Resolved\x20type:\x20'+_0x35162a[_0x34a8ff(0x225)]),console[_0x34a8ff(0x230)](_0x34a8ff(0x23c)+_0x35162a['parentId']));if(_0x35162a['type']===_0x34a8ff(0x24c))return console[_0x34a8ff(0x230)](_0x34a8ff(0x207)),console[_0x34a8ff(0x230)](_0x34a8ff(0x1e5)),0x1;if(_0x35162a[_0x34a8ff(0x225)]==='parent')return console['error'](_0x34a8ff(0x22e)),console[_0x34a8ff(0x230)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x35162a[_0x34a8ff(0x217)])throw new SDKError(ErrorCode[_0x34a8ff(0x255)],_0x34a8ff(0x210));const _0x19476a=await withSpinner(_0x34a8ff(0x20b),()=>_0x4c9a75['segment'][_0x34a8ff(0x1e7)](_0x35162a[_0x34a8ff(0x1d9)],_0x35162a[_0x34a8ff(0x217)]),{'verbose':_0x13ed94[_0x34a8ff(0x1f2)]});let _0x35466=_0x19476a['data'];const _0x1d2802=resolveLimit(_0x13ed94[_0x34a8ff(0x235)],DEFAULT_DISPLAY_LIMIT),_0x27478d=/\bLIMIT\s+\d+/i[_0x34a8ff(0x23a)](_0x35466);!_0x27478d&&(_0x35466=_0x35466[_0x34a8ff(0x1cd)]()[_0x34a8ff(0x1e8)](/;+$/,''),_0x35466=_0x34a8ff(0x200)+_0x35466+_0x34a8ff(0x1c4)+_0x1d2802);_0x13ed94[_0x34a8ff(0x1f2)]&&console[_0x34a8ff(0x230)]('SQL\x20query:\x0a'+_0x35466);const _0x77a5c3=await withProgressSpinner(_0x34a8ff(0x1dd),async _0x36856d=>{const _0x2883e0=_0x34a8ff,_0x4e6ebf=await _0x4c9a75[_0x2883e0(0x1c7)]['execute'](_0x35466,{'catalog':'td','schema':'information_schema','onJobId':_0x3bd369=>{const _0x502b0a=_0x2883e0;_0x36856d[_0x502b0a(0x221)](_0x3bd369);}});return _0x4e6ebf;},{'verbose':_0x13ed94[_0x34a8ff(0x1f2)]}),_0x418622=_0x77a5c3['data'],_0x2513f5=_0x418622[_0x34a8ff(0x231)]?_0x34a8ff(0x25d)+_0x418622[_0x34a8ff(0x231)]+']':'';return console['error'](_0x34a8ff(0x1ed)+_0x418622[_0x34a8ff(0x1c3)][_0x34a8ff(0x1da)][_0x34a8ff(0x1ff)]()+_0x34a8ff(0x1c0)+(_0x34a8ff(0x24d)+formatElapsed(_0x418622[_0x34a8ff(0x1c3)][_0x34a8ff(0x20c)])+_0x2513f5)),await handleQueryOutput(_0x418622,_0x13ed94),0x0;}catch(_0x334f7f){if(_0x334f7f instanceof SDKError)return console['error'](_0x34a8ff(0x24b)+_0x334f7f[_0x34a8ff(0x254)]+']'),console['error']('\x0a'+_0x334f7f[_0x34a8ff(0x22f)]),0x1;throw _0x334f7f;}}}export class SegmentFolderListCommand extends BaseCommand{['name']=a37_0x3d08b7(0x1c9);[a37_0x3d08b7(0x23d)]=a37_0x3d08b7(0x218);async[a37_0x3d08b7(0x1f6)](_0x4f7438){const _0x11f895=a37_0x3d08b7,{options:_0x1528d9,args:_0x4eaaf1,tdx:_0x31d60c}=_0x4f7438;if(_0x4eaaf1[_0x11f895(0x233)]===0x0)return console[_0x11f895(0x230)](_0x11f895(0x252)),console[_0x11f895(0x230)](_0x11f895(0x1e0)),0x1;const _0x1f2ff1=_0x4eaaf1[0x0];try{_0x1528d9[_0x11f895(0x1f2)]&&(console[_0x11f895(0x230)](_0x11f895(0x1fb)+_0x1528d9[_0x11f895(0x1c8)]),console['error'](_0x11f895(0x1f1)+_0x1f2ff1));const _0x4e49f8=await withSpinner(_0x11f895(0x202)+_0x1f2ff1+_0x11f895(0x247),()=>_0x31d60c[_0x11f895(0x1ee)][_0x11f895(0x228)](_0x1f2ff1),{'verbose':_0x1528d9[_0x11f895(0x1f2)]}),_0x4370e3=_0x4e49f8[_0x11f895(0x1d2)];_0x1528d9['verbose']&&console[_0x11f895(0x230)](_0x11f895(0x1ef)+_0x4370e3);const _0x221c17=await withSpinner(_0x11f895(0x244)+_0x1f2ff1+'\x27...',()=>_0x31d60c[_0x11f895(0x1ee)]['listFolders'](_0x4370e3),{'verbose':_0x1528d9['verbose']}),_0x49a31f=_0x221c17['data'];return console[_0x11f895(0x230)](_0x11f895(0x1b6)+_0x49a31f[_0x11f895(0x233)]+_0x11f895(0x216)+(_0x49a31f['length']!==0x1?'s':'')),await handleSDKOutput(_0x49a31f,_0x1528d9),0x0;}catch(_0x35931f){if(_0x35931f instanceof SDKError)return console['error'](_0x11f895(0x232)+_0x35931f[_0x11f895(0x22f)]),_0x35931f[_0x11f895(0x1e2)]&&console[_0x11f895(0x230)](_0x11f895(0x1f8)+_0x35931f[_0x11f895(0x1e2)]),0x1;throw _0x35931f;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x3d08b7(0x22c)]=a37_0x3d08b7(0x1d1);[a37_0x3d08b7(0x23d)]=a37_0x3d08b7(0x1cf);async[a37_0x3d08b7(0x1f6)](_0x1f170c){const _0xe644e1=a37_0x3d08b7,{options:_0x5862cf,args:_0x40dbc4,tdx:_0x5aab27}=_0x1f170c;if(_0x40dbc4['length']===0x0)return console[_0xe644e1(0x230)]('Error:\x20Folder\x20reference\x20is\x20required'),console['error'](_0xe644e1(0x214)),0x1;try{const {parentId:_0x3fbf61,childId:_0x49ec2d}=parseSegmentRef(_0x40dbc4[0x0]);_0x5862cf[_0xe644e1(0x1f2)]&&(console[_0xe644e1(0x230)](_0xe644e1(0x1fb)+_0x5862cf[_0xe644e1(0x1c8)]),console['error']('Parent\x20name:\x20'+_0x3fbf61),_0x49ec2d&&console[_0xe644e1(0x230)](_0xe644e1(0x1f7)+_0x49ec2d));if(!_0x49ec2d)return console['error'](_0xe644e1(0x205)),0x1;const _0xb3e9b5=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3fbf61+_0xe644e1(0x247),()=>_0x5aab27[_0xe644e1(0x1ee)][_0xe644e1(0x228)](_0x3fbf61),{'verbose':_0x5862cf['verbose']}),_0x2d67e2=_0xb3e9b5['data'];_0x5862cf['verbose']&&console[_0xe644e1(0x230)](_0xe644e1(0x1ef)+_0x2d67e2);const _0x2877ed=await withSpinner(_0xe644e1(0x1f4)+_0x49ec2d+'\x27...',()=>_0x5aab27[_0xe644e1(0x1ee)][_0xe644e1(0x24e)](_0x2d67e2,_0x49ec2d),{'verbose':_0x5862cf[_0xe644e1(0x1f2)]}),_0x1ae9f9=_0x2877ed[_0xe644e1(0x1d2)];_0x5862cf[_0xe644e1(0x1f2)]&&console[_0xe644e1(0x230)]('Resolved\x20folder\x20ID:\x20'+_0x1ae9f9);const _0x638320=await withSpinner(_0xe644e1(0x1ce)+_0x49ec2d+'\x27...',()=>_0x5aab27[_0xe644e1(0x1ee)][_0xe644e1(0x1b8)](_0x1ae9f9),{'verbose':_0x5862cf[_0xe644e1(0x1f2)]});return await handleSDKOutput([_0x638320['data']],_0x5862cf),0x0;}catch(_0x51d95d){if(_0x51d95d instanceof SDKError)return console[_0xe644e1(0x230)](_0xe644e1(0x232)+_0x51d95d[_0xe644e1(0x22f)]),_0x51d95d['cause']&&console[_0xe644e1(0x230)](_0xe644e1(0x1f8)+_0x51d95d[_0xe644e1(0x1e2)]),0x1;throw _0x51d95d;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x3d08b7(0x22c)]=a37_0x3d08b7(0x1d5);[a37_0x3d08b7(0x23d)]=a37_0x3d08b7(0x23f);async[a37_0x3d08b7(0x1f6)](_0x4d897d){const _0x5985ea=a37_0x3d08b7,{options:_0x39a45d,args:_0x38cb7d}=_0x4d897d,_0x33835c=_0x39a45d,_0x10663a=_0x33835c['path'],_0x490d9e=_0x38cb7d[0x0];if(!_0x490d9e&&!_0x10663a)return console[_0x5985ea(0x230)](a37_0x4e311e[_0x5985ea(0x1dc)]('Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required')),console[_0x5985ea(0x230)](_0x5985ea(0x1fe)),console[_0x5985ea(0x230)](_0x5985ea(0x259)),console['error'](_0x5985ea(0x243)),console['error'](_0x5985ea(0x238)),console[_0x5985ea(0x230)]('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x5985ea(0x230)](_0x5985ea(0x1bc)),0x1;if(_0x490d9e&&_0x10663a)return console[_0x5985ea(0x230)](a37_0x4e311e[_0x5985ea(0x1dc)](_0x5985ea(0x242))),0x1;try{let _0x279e4b;if(_0x10663a)_0x279e4b=await this['getSQLFromYamlFile'](_0x10663a,_0x4d897d);else{if(isYamlFilePath(_0x490d9e))return console['error'](a37_0x4e311e[_0x5985ea(0x1dc)](_0x5985ea(0x1fa))),console[_0x5985ea(0x230)](_0x5985ea(0x237)+_0x490d9e),0x1;else _0x279e4b=await this[_0x5985ea(0x1b2)](_0x490d9e,_0x4d897d);}return _0x39a45d[_0x5985ea(0x239)]==='json'||_0x39a45d[_0x5985ea(0x239)]===_0x5985ea(0x25c)?await handleSDKOutput([{'sql':_0x279e4b}],_0x39a45d):console[_0x5985ea(0x1b4)](_0x279e4b),0x0;}catch(_0x1dfccb){if(_0x1dfccb instanceof SDKError)return console[_0x5985ea(0x230)](_0x5985ea(0x232)+_0x1dfccb[_0x5985ea(0x22f)]),_0x1dfccb['cause']&&console['error'](_0x5985ea(0x1f8)+_0x1dfccb[_0x5985ea(0x1e2)]),0x1;throw _0x1dfccb;}}async[a37_0x3d08b7(0x1de)](_0xe67e60,_0x4bad38){const _0x3e42ef=a37_0x3d08b7,{options:_0x52c0cd,tdx:_0x1e4796}=_0x4bad38;let _0x31102e;try{_0x31102e=await resolveYamlFilePath(_0xe67e60);}catch(_0x1e4ff3){throw new SDKError(ErrorCode[_0x3e42ef(0x211)],_0x3e42ef(0x25b)+_0x1e4ff3[_0x3e42ef(0x22f)]);}_0x52c0cd[_0x3e42ef(0x1f2)]&&console[_0x3e42ef(0x230)](_0x3e42ef(0x1bd)+_0x31102e[_0x3e42ef(0x1c1)]+'/'+_0x31102e[_0x3e42ef(0x1db)]);const _0x4280c8=await withSpinner('Fetching\x20SQL\x20from\x20rule...',()=>_0x1e4796[_0x3e42ef(0x1ee)]['getSegmentSQLFromYaml'](_0x31102e[_0x3e42ef(0x249)],_0x31102e[_0x3e42ef(0x1c1)],_0x31102e[_0x3e42ef(0x1db)]),{'verbose':_0x52c0cd[_0x3e42ef(0x1f2)]});return _0x4280c8[_0x3e42ef(0x1d2)];}async[a37_0x3d08b7(0x1b2)](_0x5cc109,_0xaad7af){const _0x3731ec=a37_0x3d08b7,{options:_0x2a33d9,tdx:_0x1d2025}=_0xaad7af,_0x57a27e=_0x2a33d9[_0x3731ec(0x1c1)],_0x26bc56=await resolveSegmentTarget(_0x5cc109,_0x57a27e,_0x2a33d9[_0x3731ec(0x1f2)]);_0x2a33d9[_0x3731ec(0x1f2)]&&console['error'](_0x3731ec(0x1ba)+_0x26bc56);const _0x4892f7=await withSpinner(_0x3731ec(0x1fd)+_0x5cc109+_0x3731ec(0x247),()=>_0x1d2025['segment'][_0x3731ec(0x1e9)](_0x26bc56),{'verbose':_0x2a33d9[_0x3731ec(0x1f2)]}),_0x24d0d2=_0x4892f7[_0x3731ec(0x1d2)];_0x2a33d9[_0x3731ec(0x1f2)]&&(console[_0x3731ec(0x230)]('Resolved\x20type:\x20'+_0x24d0d2['type']),console[_0x3731ec(0x230)]('Parent\x20ID:\x20'+_0x24d0d2[_0x3731ec(0x1d9)]));if(_0x24d0d2[_0x3731ec(0x225)]===_0x3731ec(0x24c))throw new SDKError(ErrorCode[_0x3731ec(0x211)],'Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.');if(_0x24d0d2[_0x3731ec(0x225)]===_0x3731ec(0x1b7))throw new SDKError(ErrorCode[_0x3731ec(0x211)],_0x3731ec(0x1f0));if(!_0x24d0d2[_0x3731ec(0x217)])throw new SDKError(ErrorCode[_0x3731ec(0x255)],_0x3731ec(0x210));const _0x4d84e6=await withSpinner(_0x3731ec(0x20b),()=>_0x1d2025['segment'][_0x3731ec(0x1e7)](_0x24d0d2[_0x3731ec(0x1d9)],_0x24d0d2[_0x3731ec(0x217)]),{'verbose':_0x2a33d9['verbose']});return _0x4d84e6[_0x3731ec(0x1d2)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x3d08b7(0x22c)]='segment:folder:create';[a37_0x3d08b7(0x23d)]='Create\x20segment\x20folder\x20for\x20organization';async[a37_0x3d08b7(0x1f6)](_0x217a99){const _0x14295b=a37_0x3d08b7,{options:_0x3e792d,args:_0x358188,tdx:_0x1fd415}=_0x217a99,_0x33b540=_0x3e792d;if(_0x358188['length']<0x2)return console[_0x14295b(0x230)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console[_0x14295b(0x230)](_0x14295b(0x1be)),0x1;const _0xd6b81d=_0x358188[0x0],_0xab93ef=_0x358188[0x1];_0x33b540[_0x14295b(0x1f2)]&&(console['error']('Site:\x20'+_0x33b540['site']),console[_0x14295b(0x230)](_0x14295b(0x23b)+_0xd6b81d),console['error'](_0x14295b(0x1f7)+_0xab93ef));let _0x4b9c71;if(_0x33b540[_0x14295b(0x1e6)]){const _0x10f7b5=_0x33b540[_0x14295b(0x1e6)],_0x566f5b=await withSpinner(_0x14295b(0x202)+_0xd6b81d+_0x14295b(0x247),()=>_0x1fd415[_0x14295b(0x1ee)][_0x14295b(0x228)](_0xd6b81d),{'verbose':_0x33b540[_0x14295b(0x1f2)]}),_0x28f9df=_0x566f5b[_0x14295b(0x1d2)],_0x29fa83=await withSpinner(_0x14295b(0x220)+_0x10f7b5+'\x27...',()=>_0x1fd415[_0x14295b(0x1ee)][_0x14295b(0x24e)](_0x28f9df,_0x10f7b5),{'verbose':_0x33b540[_0x14295b(0x1f2)]});_0x4b9c71=_0x29fa83['data'],_0x33b540[_0x14295b(0x1f2)]&&console[_0x14295b(0x230)](_0x14295b(0x1eb)+_0x4b9c71);}const _0x3e0c4f={'name':_0xab93ef,'description':_0x33b540['description'],'parentFolderId':_0x4b9c71},_0x41c60b=await withSpinner(_0x14295b(0x250)+_0xab93ef+_0x14295b(0x247),()=>_0x1fd415[_0x14295b(0x1ee)]['createFolder'](_0xd6b81d,_0x3e0c4f),{'verbose':_0x33b540['verbose']}),_0x2f7ef5=_0x41c60b[_0x14295b(0x1d2)];return console[_0x14295b(0x230)](_0x14295b(0x20e)+_0x2f7ef5[_0x14295b(0x22c)]+_0x14295b(0x21d)+_0x2f7ef5['id']),await handleSDKOutput([_0x2f7ef5],_0x33b540),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x3d08b7(0x22c)]=a37_0x3d08b7(0x1d7);[a37_0x3d08b7(0x23d)]=a37_0x3d08b7(0x1b5);async[a37_0x3d08b7(0x1f6)](_0x5775be){const _0x4897b1=a37_0x3d08b7,{options:_0x3a10bf,args:_0x474be9,tdx:_0xd45989}=_0x5775be,_0x2e66fc=_0x474be9[0x0];if(!_0x2e66fc)return console['error'](_0x4897b1(0x251)),console[_0x4897b1(0x230)](_0x4897b1(0x1f3)),console[_0x4897b1(0x230)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console[_0x4897b1(0x230)](_0x4897b1(0x1d6)),console['error'](_0x4897b1(0x1f9)),console['error'](_0x4897b1(0x238)),console[_0x4897b1(0x230)](_0x4897b1(0x1b9)),console[_0x4897b1(0x230)](_0x4897b1(0x20a)),console[_0x4897b1(0x230)](_0x4897b1(0x236)),console[_0x4897b1(0x230)](_0x4897b1(0x1c5)),0x1;try{const _0x46128f=_0x3a10bf[_0x4897b1(0x1c1)],_0x452e4e=await resolveSegmentTarget(_0x2e66fc,_0x46128f,_0x3a10bf[_0x4897b1(0x1f2)]);_0x3a10bf[_0x4897b1(0x1f2)]&&console[_0x4897b1(0x230)](_0x4897b1(0x1ba)+_0x452e4e);const _0x48821c=await withSpinner(_0x4897b1(0x1fd)+_0x2e66fc+_0x4897b1(0x247),()=>_0xd45989['segment'][_0x4897b1(0x1e9)](_0x452e4e),{'verbose':_0x3a10bf[_0x4897b1(0x1f2)]}),_0x8b145a=_0x48821c[_0x4897b1(0x1d2)];_0x3a10bf[_0x4897b1(0x1f2)]&&(console['error'](_0x4897b1(0x25e)+_0x8b145a[_0x4897b1(0x225)]),console[_0x4897b1(0x230)](_0x4897b1(0x23c)+_0x8b145a[_0x4897b1(0x1d9)]),_0x8b145a[_0x4897b1(0x1e1)]&&console[_0x4897b1(0x230)](_0x4897b1(0x241)+_0x8b145a[_0x4897b1(0x1e1)]),_0x8b145a['segmentId']&&console[_0x4897b1(0x230)](_0x4897b1(0x20f)+_0x8b145a[_0x4897b1(0x217)]));if(_0x3a10bf[_0x4897b1(0x1df)]){if(_0x8b145a[_0x4897b1(0x225)]===_0x4897b1(0x24c))return console[_0x4897b1(0x230)](_0x4897b1(0x245)),0x1;if(_0x8b145a[_0x4897b1(0x225)]==='parent')return console['error'](_0x4897b1(0x219)),console[_0x4897b1(0x230)](_0x4897b1(0x224)),0x1;if(!_0x8b145a[_0x4897b1(0x217)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x4897b1(0x210));const _0x284344=getConsoleNextUrl(_0x3a10bf[_0x4897b1(0x1c8)],_0x4897b1(0x21c)+_0x8b145a['parentId']+'/e/'+_0x8b145a['segmentId']);return console[_0x4897b1(0x230)](a37_0x4e311e[_0x4897b1(0x229)]('✔')+_0x4897b1(0x1ec)+a37_0x4e311e['cyan'](_0x284344)),openBrowser(_0x284344),0x0;}if(_0x8b145a[_0x4897b1(0x225)]==='folder'){if(!_0x8b145a['folderId'])throw new SDKError(ErrorCode[_0x4897b1(0x21e)],_0x4897b1(0x215));const _0x1ccd1e=await withSpinner(_0x4897b1(0x246),()=>_0xd45989[_0x4897b1(0x1ee)][_0x4897b1(0x1b8)](_0x8b145a[_0x4897b1(0x1e1)]),{'verbose':_0x3a10bf[_0x4897b1(0x1f2)]});await handleSingleObjectOutput(_0x1ccd1e[_0x4897b1(0x1d2)],_0x3a10bf);}else{if(_0x8b145a['type']==='segment'){if(!_0x8b145a[_0x4897b1(0x217)])throw new SDKError(ErrorCode[_0x4897b1(0x255)],_0x4897b1(0x210));const _0x52216d=await withSpinner(_0x4897b1(0x1f5),()=>_0xd45989[_0x4897b1(0x1ee)][_0x4897b1(0x234)](_0x8b145a[_0x4897b1(0x1d9)],_0x8b145a[_0x4897b1(0x217)]),{'verbose':_0x3a10bf[_0x4897b1(0x1f2)]}),_0x1a1a64=getConsoleNextUrl(_0x3a10bf[_0x4897b1(0x1c8)],_0x4897b1(0x21c)+_0x8b145a[_0x4897b1(0x1d9)]+_0x4897b1(0x1e4)+_0x8b145a[_0x4897b1(0x217)]),_0x457bf1=_0x52216d[_0x4897b1(0x1d2)];_0x457bf1[_0x4897b1(0x21b)]=_0x1a1a64,await handleSingleObjectOutput(_0x457bf1,_0x3a10bf);}else return console[_0x4897b1(0x230)](_0x4897b1(0x201)),console[_0x4897b1(0x230)](_0x4897b1(0x206)),0x1;}return 0x0;}catch(_0x57d093){if(_0x57d093 instanceof SDKError)return console['error']('Error:\x20'+_0x57d093[_0x4897b1(0x22f)]),_0x57d093[_0x4897b1(0x1e2)]&&console['error'](_0x4897b1(0x1f8)+_0x57d093[_0x4897b1(0x1e2)]),0x1;throw _0x57d093;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x3d08b7(0x22c)]=a37_0x3d08b7(0x24a);[a37_0x3d08b7(0x23d)]=a37_0x3d08b7(0x1e3);async[a37_0x3d08b7(0x1f6)](_0x18b61b){const _0x213a35=a37_0x3d08b7,{options:_0x203b46,args:_0x365066,tdx:_0x1f5d1c}=_0x18b61b,_0x559ff6=_0x365066[0x0];if(!_0x559ff6)return console[_0x213a35(0x230)](_0x213a35(0x1ea)),console[_0x213a35(0x230)](_0x213a35(0x240)),console['error'](_0x213a35(0x20d)),console[_0x213a35(0x230)]('Examples:'),console[_0x213a35(0x230)](_0x213a35(0x213)),console[_0x213a35(0x230)](_0x213a35(0x257)),0x1;try{const _0x35e9b5=_0x203b46[_0x213a35(0x1c1)],_0x3b47ef=await resolveSegmentTarget(_0x559ff6,_0x35e9b5,_0x203b46['verbose']);_0x203b46[_0x213a35(0x1f2)]&&console['error']('Target\x20path:\x20'+_0x3b47ef);const _0x5aec9c=await withSpinner(_0x213a35(0x1fd)+_0x559ff6+_0x213a35(0x247),()=>_0x1f5d1c[_0x213a35(0x1ee)]['resolvePathToResource'](_0x3b47ef),{'verbose':_0x203b46[_0x213a35(0x1f2)]}),_0x3d6f90=_0x5aec9c[_0x213a35(0x1d2)];_0x203b46[_0x213a35(0x1f2)]&&(console[_0x213a35(0x230)](_0x213a35(0x25e)+_0x3d6f90[_0x213a35(0x225)]),console[_0x213a35(0x230)](_0x213a35(0x23c)+_0x3d6f90[_0x213a35(0x1d9)]));if(_0x3d6f90[_0x213a35(0x225)]===_0x213a35(0x24c))return console[_0x213a35(0x230)](_0x213a35(0x1d8)),console[_0x213a35(0x230)](_0x213a35(0x253)),0x1;if(_0x3d6f90[_0x213a35(0x225)]==='parent')return console['error'](_0x213a35(0x208)),console[_0x213a35(0x230)](_0x213a35(0x1c6)),0x1;if(!_0x3d6f90[_0x213a35(0x217)])throw new SDKError(ErrorCode[_0x213a35(0x255)],_0x213a35(0x210));const _0x213525=await withSpinner(_0x213a35(0x20b),()=>_0x1f5d1c[_0x213a35(0x1ee)]['getSegmentSQL'](_0x3d6f90[_0x213a35(0x1d9)],_0x3d6f90[_0x213a35(0x217)]),{'verbose':_0x203b46[_0x213a35(0x1f2)]}),_0x1fb22f=_0x213525[_0x213a35(0x1d2)],_0x3d6a08=await executeSchemaQuery(_0x1fb22f,_0x1f5d1c,_0x203b46);return await handleQueryOutput(_0x3d6a08,_0x203b46),0x0;}catch(_0x1ec9b5){if(_0x1ec9b5 instanceof SDKError)return console['error']('Error:\x20'+_0x1ec9b5['message']),_0x1ec9b5['cause']&&console[_0x213a35(0x230)](_0x213a35(0x1f8)+_0x1ec9b5[_0x213a35(0x1e2)]),0x1;throw _0x1ec9b5;}}}
@@ -1 +1 @@
1
- const a38_0x55a448=a38_0x2932;function a38_0x3f54(){const _0x49c237=['1112szpmUt','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','139401SBXRfv','Segment\x20name:\x20','parent','3220588pFLWXk','yellow','segment:create','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','folder','\x20\x20\x20Path:\x20','kind','resolveFolderId','Resolving\x20folder\x20\x27','620452RgOSlV','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','createSegment','Resolved\x20folder\x20ID:\x20','858300esxqvp','segments','type','length','ruleFile','includes','name','2961048UpQaAe','Parent:\x20','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','verbose','Target\x20path:\x20','Parent\x20path:\x20','invisible','Resolved\x20relative\x20path\x20to:\x20','error','segment','segmentPath','\x27...','2023586bwbDhb','5BwONem','328352vTuhNp','data','noCountPopulation','✔\x20Created\x20segment\x20\x27','resolveParentId','Creating\x20segment\x20\x27','Examples:','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','Create\x20child\x20segment\x20with\x20filtering\x20rules','description','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','\x27\x20with\x20ID:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'];a38_0x3f54=function(){return _0x49c237;};return a38_0x3f54();}(function(_0x165fb8,_0x27bef6){const _0x25df17=a38_0x2932,_0x3499b9=_0x165fb8();while(!![]){try{const _0x575916=parseInt(_0x25df17(0x14d))/0x1+-parseInt(_0x25df17(0x164))/0x2+-parseInt(_0x25df17(0x158))/0x3+parseInt(_0x25df17(0x166))/0x4*(parseInt(_0x25df17(0x165))/0x5)+parseInt(_0x25df17(0x151))/0x6+-parseInt(_0x25df17(0x179))/0x7+parseInt(_0x25df17(0x174))/0x8*(parseInt(_0x25df17(0x176))/0x9);if(_0x575916===_0x27bef6)break;else _0x3499b9['push'](_0x3499b9['shift']());}catch(_0x56f272){_0x3499b9['push'](_0x3499b9['shift']());}}}(a38_0x3f54,0x83c14));import{BaseCommand}from'./command.js';function a38_0x2932(_0x191a7e,_0x54e807){_0x191a7e=_0x191a7e-0x14b;const _0x3f54d0=a38_0x3f54();let _0x2932c5=_0x3f54d0[_0x191a7e];return _0x2932c5;}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x1a3760 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x55a448(0x157)]=a38_0x55a448(0x17b);[a38_0x55a448(0x16f)]=a38_0x55a448(0x16e);async['execute'](_0x1639e9){const _0x4006e8=a38_0x55a448;console[_0x4006e8(0x160)](a38_0x1a3760[_0x4006e8(0x17a)](_0x4006e8(0x170))),console['error'](a38_0x1a3760['yellow'](_0x4006e8(0x17c)));const {options:_0x3df9c7,args:_0x8fcf83,tdx:_0x5108a6}=_0x1639e9,_0x548b5e=_0x3df9c7;if(_0x8fcf83[_0x4006e8(0x154)]===0x0)return console[_0x4006e8(0x160)](_0x4006e8(0x173)),console['error'](_0x4006e8(0x15a)),console[_0x4006e8(0x160)](_0x4006e8(0x16c)),console[_0x4006e8(0x160)](_0x4006e8(0x172)),console[_0x4006e8(0x160)](_0x4006e8(0x14e)),console[_0x4006e8(0x160)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x4ce8ac=_0x8fcf83[0x0],_0x28d4b7=_0x3df9c7[_0x4006e8(0x162)];let _0x40afea=_0x4ce8ac;_0x28d4b7&&!_0x4ce8ac[_0x4006e8(0x156)]('/')&&(_0x40afea=_0x28d4b7+'/'+_0x4ce8ac,_0x548b5e[_0x4006e8(0x15b)]&&console[_0x4006e8(0x160)](_0x4006e8(0x15f)+_0x40afea));const _0x3860ac=parsePath(_0x40afea);if(_0x3860ac['segments']['length']<0x2)return console[_0x4006e8(0x160)](_0x4006e8(0x16d)),console[_0x4006e8(0x160)](_0x4006e8(0x175)),0x1;const _0x1283fe=_0x3860ac[_0x4006e8(0x152)][0x0],_0x18cc00=getBaseName(_0x40afea),_0x37562b=getParentPath(_0x40afea);_0x548b5e['verbose']&&(console[_0x4006e8(0x160)]('Site:\x20'+_0x548b5e['site']),console[_0x4006e8(0x160)](_0x4006e8(0x15c)+_0x40afea),console[_0x4006e8(0x160)](_0x4006e8(0x159)+_0x1283fe),console[_0x4006e8(0x160)](_0x4006e8(0x177)+_0x18cc00),console[_0x4006e8(0x160)](_0x4006e8(0x15d)+_0x37562b));const _0x4b5cb0=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x1283fe+'\x27...',()=>_0x5108a6[_0x4006e8(0x161)][_0x4006e8(0x16a)](_0x1283fe),{'verbose':_0x548b5e[_0x4006e8(0x15b)]}),_0x25ac39=_0x4b5cb0[_0x4006e8(0x167)];let _0x4012df;if(_0x3860ac[_0x4006e8(0x152)][_0x4006e8(0x154)]>0x2){const _0x18bbbd=await withSpinner('Resolving\x20folder\x20path\x20\x27'+_0x37562b+_0x4006e8(0x163),()=>_0x5108a6[_0x4006e8(0x161)]['resolvePathToResource'](_0x37562b),{'verbose':_0x548b5e[_0x4006e8(0x15b)]}),_0x6f6dc1=_0x18bbbd[_0x4006e8(0x167)];if(_0x6f6dc1['type']!=='folder'&&_0x6f6dc1[_0x4006e8(0x153)]!==_0x4006e8(0x178))return console[_0x4006e8(0x160)]('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x4012df=_0x6f6dc1['folderId'];}else{if(_0x548b5e['folder']){const _0x1f79e7=await withSpinner(_0x4006e8(0x14c)+_0x548b5e[_0x4006e8(0x17d)]+_0x4006e8(0x163),()=>_0x5108a6['segment'][_0x4006e8(0x14b)](_0x25ac39,_0x548b5e[_0x4006e8(0x17d)]),{'verbose':_0x548b5e[_0x4006e8(0x15b)]});_0x4012df=_0x1f79e7['data'];}}_0x548b5e[_0x4006e8(0x15b)]&&_0x4012df&&console[_0x4006e8(0x160)](_0x4006e8(0x150)+_0x4012df);const _0x2550e7=await loadJSONFromOptions(_0x548b5e['rule'],_0x548b5e[_0x4006e8(0x155)]),_0xe35cfd={'name':_0x18cc00,'description':_0x548b5e[_0x4006e8(0x16f)],'rule':_0x2550e7,'kind':_0x548b5e['kind']!==undefined?parseInt(_0x548b5e[_0x4006e8(0x17f)],0xa):undefined,'isVisible':_0x548b5e[_0x4006e8(0x15e)]?![]:undefined,'segmentFolderId':_0x4012df,'countPopulation':_0x548b5e[_0x4006e8(0x168)]?![]:undefined},_0x442c64=await withSpinner(_0x4006e8(0x16b)+_0x18cc00+_0x4006e8(0x163),()=>_0x5108a6['segment'][_0x4006e8(0x14f)](_0x25ac39,_0xe35cfd),{'verbose':_0x548b5e[_0x4006e8(0x15b)]}),_0xc36448=_0x442c64[_0x4006e8(0x167)];return console[_0x4006e8(0x160)](_0x4006e8(0x169)+_0xc36448[_0x4006e8(0x157)]+_0x4006e8(0x171)+_0xc36448['id']),_0x40afea!==_0x4ce8ac&&console['error'](_0x4006e8(0x17e)+_0x40afea),await handleSDKOutput([_0xc36448],_0x548b5e),0x0;}}
1
+ const a38_0x1d60e2=a38_0x57f2;(function(_0x298f91,_0x278b5d){const _0x162dbe=a38_0x57f2,_0x15f28d=_0x298f91();while(!![]){try{const _0x54526b=-parseInt(_0x162dbe(0x94))/0x1+-parseInt(_0x162dbe(0x95))/0x2+-parseInt(_0x162dbe(0x69))/0x3+parseInt(_0x162dbe(0x90))/0x4*(-parseInt(_0x162dbe(0x75))/0x5)+-parseInt(_0x162dbe(0x8a))/0x6+parseInt(_0x162dbe(0x82))/0x7+-parseInt(_0x162dbe(0x6e))/0x8*(-parseInt(_0x162dbe(0x96))/0x9);if(_0x54526b===_0x278b5d)break;else _0x15f28d['push'](_0x15f28d['shift']());}catch(_0x43f21b){_0x15f28d['push'](_0x15f28d['shift']());}}}(a38_0x6e70,0xa0dd3));import{BaseCommand}from'./command.js';function a38_0x57f2(_0x5e0f97,_0x55d4c6){_0x5e0f97=_0x5e0f97-0x65;const _0x6e7016=a38_0x6e70();let _0x57f266=_0x6e7016[_0x5e0f97];return _0x57f266;}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a38_0x6e70(){const _0x3fab99=['5337647CXYKYv','resolveParentId','Resolving\x20folder\x20\x27','\x27\x20with\x20ID:\x20','invisible','description','segmentPath','yellow','6735234sxstZJ','kind','\x27...','resolvePathToResource','Examples:','execute','1144DZEHJH','segment','length','ruleFile','770771IheATi','2558060rIbEQV','9qayYeH','createSegment','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','folderId','Resolving\x20parent\x20segment\x20\x27','Site:\x20','includes','3346695GeDZFx','Resolving\x20folder\x20path\x20\x27','verbose','✔\x20Created\x20segment\x20\x27','folder','35510584XKdlRi','Parent\x20path:\x20','segments','name','noCountPopulation','segment:create','Creating\x20segment\x20\x27','4450PTJaOB','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','error','Target\x20path:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','\x20\x20\x20Path:\x20','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','data','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','type','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'];a38_0x6e70=function(){return _0x3fab99;};return a38_0x6e70();}import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x1f2b25 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x1d60e2(0x71)]=a38_0x1d60e2(0x73);[a38_0x1d60e2(0x87)]='Create\x20child\x20segment\x20with\x20filtering\x20rules';async[a38_0x1d60e2(0x8f)](_0x235e22){const _0x3ae920=a38_0x1d60e2;console[_0x3ae920(0x77)](a38_0x1f2b25[_0x3ae920(0x89)]('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x3ae920(0x77)](a38_0x1f2b25[_0x3ae920(0x89)](_0x3ae920(0x7e)));const {options:_0x3e2bb1,args:_0x5e6978,tdx:_0xf88765}=_0x235e22,_0x3cf40d=_0x3e2bb1;if(_0x5e6978[_0x3ae920(0x92)]===0x0)return console['error'](_0x3ae920(0x7b)),console[_0x3ae920(0x77)](_0x3ae920(0x7c)),console[_0x3ae920(0x77)](_0x3ae920(0x8e)),console[_0x3ae920(0x77)](_0x3ae920(0x79)),console[_0x3ae920(0x77)](_0x3ae920(0x80)),console[_0x3ae920(0x77)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x2ffb4a=_0x5e6978[0x0],_0xc4907e=_0x3e2bb1[_0x3ae920(0x88)];let _0x3cfe3c=_0x2ffb4a;_0xc4907e&&!_0x2ffb4a[_0x3ae920(0x68)]('/')&&(_0x3cfe3c=_0xc4907e+'/'+_0x2ffb4a,_0x3cf40d[_0x3ae920(0x6b)]&&console['error']('Resolved\x20relative\x20path\x20to:\x20'+_0x3cfe3c));const _0x27b273=parsePath(_0x3cfe3c);if(_0x27b273[_0x3ae920(0x70)]['length']<0x2)return console['error'](_0x3ae920(0x81)),console['error'](_0x3ae920(0x98)),0x1;const _0x20e685=_0x27b273[_0x3ae920(0x70)][0x0],_0x516eab=getBaseName(_0x3cfe3c),_0x5ce9c9=getParentPath(_0x3cfe3c);_0x3cf40d['verbose']&&(console['error'](_0x3ae920(0x67)+_0x3cf40d['site']),console[_0x3ae920(0x77)](_0x3ae920(0x78)+_0x3cfe3c),console['error']('Parent:\x20'+_0x20e685),console[_0x3ae920(0x77)]('Segment\x20name:\x20'+_0x516eab),console[_0x3ae920(0x77)](_0x3ae920(0x6f)+_0x5ce9c9));const _0x5cc61a=await withSpinner(_0x3ae920(0x66)+_0x20e685+_0x3ae920(0x8c),()=>_0xf88765[_0x3ae920(0x91)][_0x3ae920(0x83)](_0x20e685),{'verbose':_0x3cf40d[_0x3ae920(0x6b)]}),_0x7b4bc5=_0x5cc61a[_0x3ae920(0x7d)];let _0x27d7bd;if(_0x27b273[_0x3ae920(0x70)]['length']>0x2){const _0x5cff31=await withSpinner(_0x3ae920(0x6a)+_0x5ce9c9+_0x3ae920(0x8c),()=>_0xf88765['segment'][_0x3ae920(0x8d)](_0x5ce9c9),{'verbose':_0x3cf40d['verbose']}),_0x46c152=_0x5cff31[_0x3ae920(0x7d)];if(_0x46c152[_0x3ae920(0x7f)]!=='folder'&&_0x46c152[_0x3ae920(0x7f)]!=='parent')return console[_0x3ae920(0x77)](_0x3ae920(0x76)),0x1;_0x27d7bd=_0x46c152[_0x3ae920(0x65)];}else{if(_0x3cf40d[_0x3ae920(0x6d)]){const _0x4dfc6f=await withSpinner(_0x3ae920(0x84)+_0x3cf40d['folder']+'\x27...',()=>_0xf88765[_0x3ae920(0x91)]['resolveFolderId'](_0x7b4bc5,_0x3cf40d['folder']),{'verbose':_0x3cf40d[_0x3ae920(0x6b)]});_0x27d7bd=_0x4dfc6f[_0x3ae920(0x7d)];}}_0x3cf40d[_0x3ae920(0x6b)]&&_0x27d7bd&&console[_0x3ae920(0x77)]('Resolved\x20folder\x20ID:\x20'+_0x27d7bd);const _0x48b280=await loadJSONFromOptions(_0x3cf40d['rule'],_0x3cf40d[_0x3ae920(0x93)]),_0x1dfb9a={'name':_0x516eab,'description':_0x3cf40d[_0x3ae920(0x87)],'rule':_0x48b280,'kind':_0x3cf40d[_0x3ae920(0x8b)]!==undefined?parseInt(_0x3cf40d[_0x3ae920(0x8b)],0xa):undefined,'isVisible':_0x3cf40d[_0x3ae920(0x86)]?![]:undefined,'segmentFolderId':_0x27d7bd,'countPopulation':_0x3cf40d[_0x3ae920(0x72)]?![]:undefined},_0x4f3a2e=await withSpinner(_0x3ae920(0x74)+_0x516eab+_0x3ae920(0x8c),()=>_0xf88765[_0x3ae920(0x91)][_0x3ae920(0x97)](_0x7b4bc5,_0x1dfb9a),{'verbose':_0x3cf40d[_0x3ae920(0x6b)]}),_0x4e9a0e=_0x4f3a2e[_0x3ae920(0x7d)];return console[_0x3ae920(0x77)](_0x3ae920(0x6c)+_0x4e9a0e[_0x3ae920(0x71)]+_0x3ae920(0x85)+_0x4e9a0e['id']),_0x3cfe3c!==_0x2ffb4a&&console['error'](_0x3ae920(0x7a)+_0x3cfe3c),await handleSDKOutput([_0x4e9a0e],_0x3cf40d),0x0;}}
@@ -1 +1 @@
1
- function a39_0x34fa(_0x279dcd,_0x2ca04a){_0x279dcd=_0x279dcd-0xa5;const _0x32f557=a39_0x32f5();let _0x34fad4=_0x32f557[_0x279dcd];return _0x34fad4;}const a39_0x2aca55=a39_0x34fa;(function(_0x4b0970,_0x220d16){const _0x27f369=a39_0x34fa,_0x48cd23=_0x4b0970();while(!![]){try{const _0x51f550=parseInt(_0x27f369(0xb4))/0x1*(-parseInt(_0x27f369(0xb7))/0x2)+-parseInt(_0x27f369(0xa6))/0x3*(-parseInt(_0x27f369(0xba))/0x4)+-parseInt(_0x27f369(0xb1))/0x5+-parseInt(_0x27f369(0xc0))/0x6*(-parseInt(_0x27f369(0xab))/0x7)+parseInt(_0x27f369(0xb5))/0x8*(parseInt(_0x27f369(0xb0))/0x9)+parseInt(_0x27f369(0xac))/0xa+parseInt(_0x27f369(0xb2))/0xb;if(_0x51f550===_0x220d16)break;else _0x48cd23['push'](_0x48cd23['shift']());}catch(_0x153b5f){_0x48cd23['push'](_0x48cd23['shift']());}}}(a39_0x32f5,0x2ccb9));import{BaseCommand}from'./command.js';function a39_0x32f5(){const _0x548af9=['description','verbose','261583NMPAAF','622310lxVMyu','Listing\x20fields\x20for\x20\x27','Site:\x20','✔\x20Found\x20','108OsDQYX','1820695CKTgaH','1068595owmdsZ','Parent\x20segment:\x20','1ZZahAx','116576mdzeUl','name','370134tLpHjV','\x27...','\x20field','4BhfsqZ','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Error:\x20Parent\x20segment\x20name\x20is\x20required','length','parentSegment','execute','30rHAgkd','List\x20available\x20fields\x20for\x20segmentation','segment:fields','segment','site','listFields','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','634806uBDwfe','error','jsonl'];a39_0x32f5=function(){return _0x548af9;};return a39_0x32f5();}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a39_0x2aca55(0xb6)]=a39_0x2aca55(0xc2);[a39_0x2aca55(0xa9)]=a39_0x2aca55(0xc1);async[a39_0x2aca55(0xbf)](_0xc20041){const _0xcb3e5d=a39_0x2aca55,{options:_0x397870,args:_0x1573fb,tdx:_0x32dfda}=_0xc20041,_0x91cf2e=_0x1573fb[0x0]||_0x397870[_0xcb3e5d(0xbe)];if(!_0x91cf2e)return console[_0xcb3e5d(0xa7)](_0xcb3e5d(0xbc)),console[_0xcb3e5d(0xa7)](_0xcb3e5d(0xa5)),console[_0xcb3e5d(0xa7)](_0xcb3e5d(0xbb)),0x1;_0x397870[_0xcb3e5d(0xaa)]&&(console['error'](_0xcb3e5d(0xae)+_0x397870[_0xcb3e5d(0xc4)]),console['error'](_0xcb3e5d(0xb3)+_0x91cf2e));const _0x4bedc3=await withSpinner(_0xcb3e5d(0xad)+_0x91cf2e+_0xcb3e5d(0xb8),()=>_0x32dfda[_0xcb3e5d(0xc3)][_0xcb3e5d(0xc5)](_0x91cf2e),{'verbose':_0x397870[_0xcb3e5d(0xaa)]}),_0xcc2ed1=_0x4bedc3['data'];console[_0xcb3e5d(0xa7)](_0xcb3e5d(0xaf)+_0xcc2ed1['length']+_0xcb3e5d(0xb9)+(_0xcc2ed1[_0xcb3e5d(0xbd)]!==0x1?'s':''));if(_0x397870['json']||_0x397870[_0xcb3e5d(0xa8)])return await handleSDKOutput(_0xcc2ed1,_0x397870),0x0;return displayFieldsHumanReadable(_0xcc2ed1,_0x91cf2e),0x0;}}
1
+ const a39_0x23bc44=a39_0x3777;(function(_0x35ff3c,_0x923cc0){const _0x1c8e61=a39_0x3777,_0x21e9c8=_0x35ff3c();while(!![]){try{const _0x4da851=parseInt(_0x1c8e61(0x1b1))/0x1+-parseInt(_0x1c8e61(0x1b3))/0x2+parseInt(_0x1c8e61(0x1b8))/0x3+parseInt(_0x1c8e61(0x1ac))/0x4+parseInt(_0x1c8e61(0x1b2))/0x5*(-parseInt(_0x1c8e61(0x1ba))/0x6)+parseInt(_0x1c8e61(0x1b9))/0x7+-parseInt(_0x1c8e61(0x1c1))/0x8;if(_0x4da851===_0x923cc0)break;else _0x21e9c8['push'](_0x21e9c8['shift']());}catch(_0x2bdbcd){_0x21e9c8['push'](_0x21e9c8['shift']());}}}(a39_0x625e,0x35440));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a39_0x3777(_0x4b16bd,_0x5aa20c){_0x4b16bd=_0x4b16bd-0x1ac;const _0x625ede=a39_0x625e();let _0x37774b=_0x625ede[_0x4b16bd];return _0x37774b;}function a39_0x625e(){const _0x2834e3=['verbose','length','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','Site:\x20','549696BsdawO','644175GPsJlI','3318CjWnnh','site','error','listFields','name','✔\x20Found\x20','List\x20available\x20fields\x20for\x20segmentation','3887208OezIrj','jsonl','segment','674460TXOtFd','description','\x20field','data','Listing\x20fields\x20for\x20\x27','292462IbjGRT','165TeIljn','28016dvLzQt'];a39_0x625e=function(){return _0x2834e3;};return a39_0x625e();}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a39_0x23bc44(0x1be)]='segment:fields';[a39_0x23bc44(0x1ad)]=a39_0x23bc44(0x1c0);async['execute'](_0x427bdd){const _0x31ccd9=a39_0x23bc44,{options:_0x3f63cf,args:_0x2509ad,tdx:_0x4ac4c4}=_0x427bdd,_0x576c63=_0x2509ad[0x0]||_0x3f63cf['parentSegment'];if(!_0x576c63)return console[_0x31ccd9(0x1bc)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console['error'](_0x31ccd9(0x1b6)),console['error']('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;_0x3f63cf[_0x31ccd9(0x1b4)]&&(console[_0x31ccd9(0x1bc)](_0x31ccd9(0x1b7)+_0x3f63cf[_0x31ccd9(0x1bb)]),console['error']('Parent\x20segment:\x20'+_0x576c63));const _0xc84cb6=await withSpinner(_0x31ccd9(0x1b0)+_0x576c63+'\x27...',()=>_0x4ac4c4[_0x31ccd9(0x1c3)][_0x31ccd9(0x1bd)](_0x576c63),{'verbose':_0x3f63cf[_0x31ccd9(0x1b4)]}),_0x61baf7=_0xc84cb6[_0x31ccd9(0x1af)];console[_0x31ccd9(0x1bc)](_0x31ccd9(0x1bf)+_0x61baf7[_0x31ccd9(0x1b5)]+_0x31ccd9(0x1ae)+(_0x61baf7[_0x31ccd9(0x1b5)]!==0x1?'s':''));if(_0x3f63cf['json']||_0x3f63cf[_0x31ccd9(0x1c2)])return await handleSDKOutput(_0x61baf7,_0x3f63cf),0x0;return displayFieldsHumanReadable(_0x61baf7,_0x576c63),0x0;}}