@treasuredata/tdx 2026.4.0 → 2026.4.2

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 (219) 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/frontmatter.js +1 -1
  182. package/dist/sdk/workspace/git.js +1 -1
  183. package/dist/sdk/workspace/index.js +1 -1
  184. package/dist/sdk/workspace/templates.js +1 -1
  185. package/dist/sdk/workspace/weekly.js +1 -1
  186. package/dist/sdk/workspace/wikilinks.js +1 -1
  187. package/dist/test-utils/command-runner.js +1 -1
  188. package/dist/test-utils/factories.js +1 -1
  189. package/dist/test-utils/fixtures.js +1 -1
  190. package/dist/test-utils/http-mock.js +1 -1
  191. package/dist/test-utils/index.js +1 -1
  192. package/dist/utils/async.js +1 -1
  193. package/dist/utils/colors.js +1 -1
  194. package/dist/utils/diff.js +1 -1
  195. package/dist/utils/file-permissions.js +1 -1
  196. package/dist/utils/file-reader.js +1 -1
  197. package/dist/utils/github-releases.js +1 -1
  198. package/dist/utils/global-cache.js +1 -1
  199. package/dist/utils/json-loader.js +1 -1
  200. package/dist/utils/local-cache.js +1 -1
  201. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  202. package/dist/utils/logger/formatters/index.js +1 -1
  203. package/dist/utils/logger/handlers/console-handler.js +1 -1
  204. package/dist/utils/logger/handlers/file-handler.js +1 -1
  205. package/dist/utils/logger/handlers/index.js +1 -1
  206. package/dist/utils/logger/handlers/null-handler.js +1 -1
  207. package/dist/utils/logger/index.js +1 -1
  208. package/dist/utils/logger/logger.js +1 -1
  209. package/dist/utils/logger/types.js +1 -1
  210. package/dist/utils/option-validation.js +1 -1
  211. package/dist/utils/process.js +1 -1
  212. package/dist/utils/prompt.js +1 -1
  213. package/dist/utils/spinner.js +1 -1
  214. package/dist/utils/sse-parser.js +1 -1
  215. package/dist/utils/string-utils.js +1 -1
  216. package/dist/utils/table-ref-parser.js +1 -1
  217. package/dist/utils/tdx-logger.js +1 -1
  218. package/dist/utils/version-check.js +1 -1
  219. package/package.json +1 -1
@@ -1 +1 @@
1
- function a32_0x5c32(){const _0x3134a3=['log','(ID:\x20','all','data','2813844cQVwgM','getMyPermissions','account_id','\x20\x20No\x20policies\x20assigned','\x20\x20\x20','max','\x20assigned','bold','error','account_owner','\x20polic','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','permissions','name','map','200fjMoaN','Account\x20Owner','policy\x20show','2977250eQeFVG','Administrator','length','📋\x20Assigned\x20Policies','args','\x20\x20•\x20','email','Fetching\x20policy...','74unqbPH','policies','entries','getPolicyPermissions','\x20user','site','600929idBYHW',',\x20user_id:','Fetching\x20permissions...','verbose','✔\x20Found\x20','ies','\x20\x20No\x20permissions','context','listPolicies','Member','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','description','8KYjVwv','validate','29817hijYtA','Listing\x20policies...','policy','policy\x20list','👥\x20Assigned\x20Users','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','9323sNzVdE','execute','dim','1501992cFRCdf','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','1279506CXSSdM'];a32_0x5c32=function(){return _0x3134a3;};return a32_0x5c32();}const a32_0xa1fa41=a32_0x5435;(function(_0x43ca30,_0x201774){const _0x51c2d0=a32_0x5435,_0x43c2ac=_0x43ca30();while(!![]){try{const _0x16e818=parseInt(_0x51c2d0(0x173))/0x1*(parseInt(_0x51c2d0(0x197))/0x2)+parseInt(_0x51c2d0(0x178))/0x3+-parseInt(_0x51c2d0(0x17d))/0x4+parseInt(_0x51c2d0(0x18f))/0x5+-parseInt(_0x51c2d0(0x176))/0x6+-parseInt(_0x51c2d0(0x15f))/0x7*(-parseInt(_0x51c2d0(0x16b))/0x8)+parseInt(_0x51c2d0(0x16d))/0x9*(-parseInt(_0x51c2d0(0x18c))/0xa);if(_0x16e818===_0x201774)break;else _0x43c2ac['push'](_0x43c2ac['shift']());}catch(_0x2f8423){_0x43c2ac['push'](_0x43c2ac['shift']());}}}(a32_0x5c32,0x69a39));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x1f492c from'chalk';export class PolicyCommand extends BaseCommand{[a32_0xa1fa41(0x18a)]=a32_0xa1fa41(0x16f);[a32_0xa1fa41(0x16a)]=a32_0xa1fa41(0x169);async['execute'](_0x475a99){const _0x37b96d=a32_0xa1fa41,{options:_0x339323,tdx:_0x8fc576}=_0x475a99,_0x576736=await withSpinner(_0x37b96d(0x161),async()=>{const _0xc78594=_0x37b96d,[_0x3288bc,_0x16046a]=await Promise[_0xc78594(0x17b)]([_0x8fc576['user']['getCurrent'](),_0x8fc576[_0xc78594(0x16f)][_0xc78594(0x17e)]()]);return{'userInfo':_0x3288bc,'permissions':_0x16046a};},{'verbose':_0x339323[_0x37b96d(0x162)]}),{userInfo:_0x19058a,permissions:_0x8e4a19}=_0x576736[_0x37b96d(0x17c)];if(isStructuredFormat(_0x339323))return await handleSingleObjectOutput(_0x8e4a19,_0x339323),0x0;const _0x37f2db=_0x19058a[_0x37b96d(0x186)]?_0x37b96d(0x18d):_0x19058a['administrator']?_0x37b96d(0x190):_0x37b96d(0x168);console[_0x37b96d(0x179)]('\x0a'+a32_0x1f492c[_0x37b96d(0x184)]('👤')+'\x20'+a32_0x1f492c[_0x37b96d(0x184)](_0x19058a[_0x37b96d(0x18a)])+'\x20'+a32_0x1f492c[_0x37b96d(0x175)]('('+_0x19058a[_0x37b96d(0x195)]+')')+'\x20—\x20'+_0x37f2db),console[_0x37b96d(0x179)](a32_0x1f492c[_0x37b96d(0x175)](_0x37b96d(0x181)+_0x8fc576[_0x37b96d(0x166)][_0x37b96d(0x15e)]+':'+_0x19058a[_0x37b96d(0x17f)]+_0x37b96d(0x160)+_0x19058a['id']));const _0x3d88bd=_0x8e4a19[_0x37b96d(0x198)];console['log']('\x0a'+a32_0x1f492c[_0x37b96d(0x184)](_0x37b96d(0x192))+'\x20('+_0x3d88bd[_0x37b96d(0x191)]+'):');if(_0x3d88bd[_0x37b96d(0x191)]===0x0)console[_0x37b96d(0x179)](a32_0x1f492c[_0x37b96d(0x175)](_0x37b96d(0x180)));else for(const _0x2f3dc2 of _0x3d88bd){console[_0x37b96d(0x179)](_0x37b96d(0x194)+_0x2f3dc2['name']);}return printPermissionsMap(_0x8e4a19[_0x37b96d(0x189)]),console['log'](),0x0;}}export class PolicyListCommand extends BaseCommand{['name']=a32_0xa1fa41(0x170);[a32_0xa1fa41(0x16a)]=a32_0xa1fa41(0x188);async[a32_0xa1fa41(0x174)](_0x19e671){const _0x10d796=a32_0xa1fa41,{options:_0x29ce99,tdx:_0x3adac7}=_0x19e671,_0x2cbf8f=await withSpinner(_0x10d796(0x16e),()=>_0x3adac7[_0x10d796(0x16f)][_0x10d796(0x167)](),{'verbose':_0x29ce99[_0x10d796(0x162)]}),_0x4f1677=_0x2cbf8f['data'];console[_0x10d796(0x185)](_0x10d796(0x163)+_0x4f1677['length']+_0x10d796(0x187)+(_0x4f1677[_0x10d796(0x191)]!==0x1?_0x10d796(0x164):'y'));if(isStructuredFormat(_0x29ce99))return await handleSDKOutput(_0x4f1677,_0x29ce99),0x0;if(_0x4f1677[_0x10d796(0x191)]===0x0)console['log'](a32_0x1f492c['dim']('No\x20policies\x20found'));else for(const _0x23526c of _0x4f1677){const _0x1ba2cc=_0x23526c['description']?a32_0x1f492c[_0x10d796(0x175)]('\x20—\x20'+_0x23526c['description']):'';console[_0x10d796(0x179)](_0x10d796(0x194)+_0x23526c[_0x10d796(0x18a)]+_0x1ba2cc);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0xa1fa41(0x18a)]=a32_0xa1fa41(0x18e);[a32_0xa1fa41(0x16a)]=a32_0xa1fa41(0x172);[a32_0xa1fa41(0x16c)](_0x2b57cc){const _0x3f0645=a32_0xa1fa41;if(_0x2b57cc[_0x3f0645(0x193)][_0x3f0645(0x191)]===0x0)return _0x3f0645(0x177);return undefined;}async[a32_0xa1fa41(0x174)](_0x29efbc){const _0xbbacf=a32_0xa1fa41,{options:_0x33853e,tdx:_0x3a819e}=_0x29efbc,_0x2fab0c=_0x29efbc[_0xbbacf(0x193)][0x0],_0x1d1aac=await withSpinner(_0xbbacf(0x196),async()=>{const _0x2fd3ee=_0xbbacf,_0x56446b=await _0x3a819e[_0x2fd3ee(0x16f)]['getPolicy'](_0x2fab0c),[_0xd980ed,_0x574d8b]=await Promise[_0x2fd3ee(0x17b)]([_0x3a819e[_0x2fd3ee(0x16f)][_0x2fd3ee(0x15c)](_0x56446b['id']),_0x3a819e['policy']['getPolicyUsers'](_0x56446b['id'])]);return{'policy':_0x56446b,'perms':_0xd980ed,'users':_0x574d8b};},{'verbose':_0x33853e[_0xbbacf(0x162)]}),{policy:_0x5a3dd6,perms:_0x116923,users:_0x2cf462}=_0x1d1aac['data'];if(isStructuredFormat(_0x33853e))return await handleSingleObjectOutput({..._0x5a3dd6,'permissions':_0x116923['permissions'],'users':_0x2cf462},_0x33853e),0x0;console[_0xbbacf(0x179)]('\x0a'+a32_0x1f492c['bold']('📋')+'\x20'+a32_0x1f492c['bold'](_0x5a3dd6[_0xbbacf(0x18a)])+'\x20'+a32_0x1f492c[_0xbbacf(0x175)](_0xbbacf(0x17a)+_0x5a3dd6['id']+')'));_0x5a3dd6[_0xbbacf(0x16a)]&&console[_0xbbacf(0x179)](_0xbbacf(0x181)+a32_0x1f492c[_0xbbacf(0x175)](_0x5a3dd6['description']));console[_0xbbacf(0x179)](_0xbbacf(0x181)+_0x2cf462[_0xbbacf(0x191)]+_0xbbacf(0x15d)+(_0x2cf462['length']!==0x1?'s':'')+_0xbbacf(0x183)),printPermissionsMap(_0x116923[_0xbbacf(0x189)]);if(_0x2cf462[_0xbbacf(0x191)]>0x0){console[_0xbbacf(0x179)]('\x0a'+a32_0x1f492c[_0xbbacf(0x184)](_0xbbacf(0x171))+':');for(const _0x1f1c4d of _0x2cf462){const _0x32c1bf=_0x1f1c4d['email']&&_0x1f1c4d[_0xbbacf(0x195)]!==_0x1f1c4d[_0xbbacf(0x18a)]?a32_0x1f492c[_0xbbacf(0x175)]('\x20<'+_0x1f1c4d[_0xbbacf(0x195)]+'>'):'';console[_0xbbacf(0x179)](_0xbbacf(0x194)+_0x1f1c4d[_0xbbacf(0x18a)]+_0x32c1bf);}}return console[_0xbbacf(0x179)](),0x0;}}function a32_0x5435(_0x261c98,_0x4967cc){_0x261c98=_0x261c98-0x15c;const _0x5c324f=a32_0x5c32();let _0x54357c=_0x5c324f[_0x261c98];return _0x54357c;}function printPermissionsMap(_0x2a04fe){const _0x9486fb=a32_0xa1fa41,_0x1a32e0=Object[_0x9486fb(0x199)](_0x2a04fe);console['log']('\x0a'+a32_0x1f492c['bold']('🔑\x20Effective\x20Permissions')+':');if(_0x1a32e0[_0x9486fb(0x191)]===0x0){console[_0x9486fb(0x179)](a32_0x1f492c[_0x9486fb(0x175)](_0x9486fb(0x165)));return;}const _0xf064cf=Math[_0x9486fb(0x182)](..._0x1a32e0['map'](([_0x1b2f8b])=>_0x1b2f8b[_0x9486fb(0x191)]));for(const [_0x74f71f,_0x585693]of _0x1a32e0){const _0x439d96=formatOperations(_0x585693);console[_0x9486fb(0x179)]('\x20\x20'+_0x74f71f['padEnd'](_0xf064cf+0x2)+_0x439d96);}}function formatOperations(_0x2582f6){const _0x29a5a7=a32_0xa1fa41,_0x193e17=[...new Set(_0x2582f6[_0x29a5a7(0x18b)](_0x2b109e=>_0x2b109e['operation']))];return _0x193e17['join'](',\x20');}
1
+ const a32_0x4331a2=a32_0x5f1f;(function(_0x309e7a,_0x1a26ac){const _0x2df83e=a32_0x5f1f,_0x1e073b=_0x309e7a();while(!![]){try{const _0x11f1dc=-parseInt(_0x2df83e(0xee))/0x1+parseInt(_0x2df83e(0xf2))/0x2+-parseInt(_0x2df83e(0xe6))/0x3+parseInt(_0x2df83e(0xeb))/0x4*(-parseInt(_0x2df83e(0xdf))/0x5)+-parseInt(_0x2df83e(0xda))/0x6*(parseInt(_0x2df83e(0xe5))/0x7)+parseInt(_0x2df83e(0xfd))/0x8*(-parseInt(_0x2df83e(0xea))/0x9)+parseInt(_0x2df83e(0xdc))/0xa;if(_0x11f1dc===_0x1a26ac)break;else _0x1e073b['push'](_0x1e073b['shift']());}catch(_0x1f4fab){_0x1e073b['push'](_0x1e073b['shift']());}}}(a32_0x5699,0xc2152));function a32_0x5f1f(_0x3eb645,_0x280216){_0x3eb645=_0x3eb645-0xc4;const _0x569951=a32_0x5699();let _0x5f1fd0=_0x569951[_0x3eb645];return _0x5f1fd0;}import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x326b22 from'chalk';export class PolicyCommand extends BaseCommand{['name']='policy';[a32_0x4331a2(0xcf)]=a32_0x4331a2(0xe8);async[a32_0x4331a2(0xfc)](_0x38d5b7){const _0x2f4deb=a32_0x4331a2,{options:_0x2daf5b,tdx:_0x353f8b}=_0x38d5b7,_0x5aa728=await withSpinner(_0x2f4deb(0xd8),async()=>{const _0x1bd0dc=_0x2f4deb,[_0x36701e,_0x2547e5]=await Promise[_0x1bd0dc(0xf9)]([_0x353f8b[_0x1bd0dc(0xe4)]['getCurrent'](),_0x353f8b['policy'][_0x1bd0dc(0xed)]()]);return{'userInfo':_0x36701e,'permissions':_0x2547e5};},{'verbose':_0x2daf5b[_0x2f4deb(0xf4)]}),{userInfo:_0x5e661a,permissions:_0x5d3024}=_0x5aa728[_0x2f4deb(0xe1)];if(isStructuredFormat(_0x2daf5b))return await handleSingleObjectOutput(_0x5d3024,_0x2daf5b),0x0;const _0x1d2c39=_0x5e661a['account_owner']?_0x2f4deb(0xcd):_0x5e661a[_0x2f4deb(0xf5)]?_0x2f4deb(0xde):_0x2f4deb(0xd6);console[_0x2f4deb(0xf3)]('\x0a'+a32_0x326b22[_0x2f4deb(0xca)]('👤')+'\x20'+a32_0x326b22['bold'](_0x5e661a[_0x2f4deb(0xd1)])+'\x20'+a32_0x326b22[_0x2f4deb(0xc6)]('('+_0x5e661a['email']+')')+_0x2f4deb(0xfb)+_0x1d2c39),console[_0x2f4deb(0xf3)](a32_0x326b22['dim'](_0x2f4deb(0xd4)+_0x353f8b['context']['site']+':'+_0x5e661a[_0x2f4deb(0xc9)]+',\x20user_id:'+_0x5e661a['id']));const _0x18b965=_0x5d3024['policies'];console[_0x2f4deb(0xf3)]('\x0a'+a32_0x326b22[_0x2f4deb(0xca)](_0x2f4deb(0xe0))+'\x20('+_0x18b965[_0x2f4deb(0xf7)]+'):');if(_0x18b965[_0x2f4deb(0xf7)]===0x0)console[_0x2f4deb(0xf3)](a32_0x326b22[_0x2f4deb(0xc6)]('\x20\x20No\x20policies\x20assigned'));else for(const _0x50d6fa of _0x18b965){console[_0x2f4deb(0xf3)](_0x2f4deb(0xd7)+_0x50d6fa['name']);}return printPermissionsMap(_0x5d3024['permissions']),console['log'](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x4331a2(0xd1)]='policy\x20list';[a32_0x4331a2(0xcf)]=a32_0x4331a2(0xce);async[a32_0x4331a2(0xfc)](_0x4d678d){const _0x19ade2=a32_0x4331a2,{options:_0x2c6b80,tdx:_0x5cc44e}=_0x4d678d,_0x29fb8a=await withSpinner(_0x19ade2(0xd5),()=>_0x5cc44e['policy'][_0x19ade2(0xc4)](),{'verbose':_0x2c6b80[_0x19ade2(0xf4)]}),_0x34b241=_0x29fb8a['data'];console[_0x19ade2(0xc8)](_0x19ade2(0xe3)+_0x34b241['length']+_0x19ade2(0xec)+(_0x34b241[_0x19ade2(0xf7)]!==0x1?'ies':'y'));if(isStructuredFormat(_0x2c6b80))return await handleSDKOutput(_0x34b241,_0x2c6b80),0x0;if(_0x34b241[_0x19ade2(0xf7)]===0x0)console[_0x19ade2(0xf3)](a32_0x326b22[_0x19ade2(0xc6)](_0x19ade2(0xef)));else for(const _0x12bb26 of _0x34b241){const _0x45692e=_0x12bb26[_0x19ade2(0xcf)]?a32_0x326b22[_0x19ade2(0xc6)](_0x19ade2(0xfb)+_0x12bb26[_0x19ade2(0xcf)]):'';console['log'](_0x19ade2(0xd7)+_0x12bb26['name']+_0x45692e);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{['name']=a32_0x4331a2(0xe2);[a32_0x4331a2(0xcf)]='Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)';[a32_0x4331a2(0xe9)](_0x2a34fd){const _0x56bb93=a32_0x4331a2;if(_0x2a34fd[_0x56bb93(0xd9)][_0x56bb93(0xf7)]===0x0)return _0x56bb93(0xe7);return undefined;}async[a32_0x4331a2(0xfc)](_0x46fed7){const _0x3ecf6e=a32_0x4331a2,{options:_0x562570,tdx:_0x800d45}=_0x46fed7,_0xcff161=_0x46fed7['args'][0x0],_0x4db8b3=await withSpinner(_0x3ecf6e(0xf6),async()=>{const _0xff98ae=_0x3ecf6e,_0x30d5bc=await _0x800d45[_0xff98ae(0xf1)][_0xff98ae(0xf0)](_0xcff161),[_0x579220,_0x29cc57]=await Promise[_0xff98ae(0xf9)]([_0x800d45['policy'][_0xff98ae(0xd3)](_0x30d5bc['id']),_0x800d45['policy'][_0xff98ae(0xdb)](_0x30d5bc['id'])]);return{'policy':_0x30d5bc,'perms':_0x579220,'users':_0x29cc57};},{'verbose':_0x562570[_0x3ecf6e(0xf4)]}),{policy:_0x2d1ee9,perms:_0x44fede,users:_0x52c332}=_0x4db8b3[_0x3ecf6e(0xe1)];if(isStructuredFormat(_0x562570))return await handleSingleObjectOutput({..._0x2d1ee9,'permissions':_0x44fede[_0x3ecf6e(0xcb)],'users':_0x52c332},_0x562570),0x0;console[_0x3ecf6e(0xf3)]('\x0a'+a32_0x326b22[_0x3ecf6e(0xca)]('📋')+'\x20'+a32_0x326b22[_0x3ecf6e(0xca)](_0x2d1ee9['name'])+'\x20'+a32_0x326b22[_0x3ecf6e(0xc6)](_0x3ecf6e(0xfa)+_0x2d1ee9['id']+')'));_0x2d1ee9['description']&&console[_0x3ecf6e(0xf3)](_0x3ecf6e(0xd4)+a32_0x326b22[_0x3ecf6e(0xc6)](_0x2d1ee9['description']));console[_0x3ecf6e(0xf3)](_0x3ecf6e(0xd4)+_0x52c332[_0x3ecf6e(0xf7)]+_0x3ecf6e(0xf8)+(_0x52c332[_0x3ecf6e(0xf7)]!==0x1?'s':'')+_0x3ecf6e(0xd0)),printPermissionsMap(_0x44fede[_0x3ecf6e(0xcb)]);if(_0x52c332[_0x3ecf6e(0xf7)]>0x0){console[_0x3ecf6e(0xf3)]('\x0a'+a32_0x326b22['bold'](_0x3ecf6e(0xc7))+':');for(const _0x217563 of _0x52c332){const _0xa747fd=_0x217563[_0x3ecf6e(0xdd)]&&_0x217563['email']!==_0x217563['name']?a32_0x326b22['dim']('\x20<'+_0x217563[_0x3ecf6e(0xdd)]+'>'):'';console['log'](_0x3ecf6e(0xd7)+_0x217563[_0x3ecf6e(0xd1)]+_0xa747fd);}}return console[_0x3ecf6e(0xf3)](),0x0;}}function a32_0x5699(){const _0x4256be=['getMyPermissions','5318NYginf','No\x20policies\x20found','getPolicy','policy','2357512sniaTt','log','verbose','administrator','Fetching\x20policy...','length','\x20user','all','(ID:\x20','\x20—\x20','execute','7324552VmcmAT','map','listPolicies','join','dim','👥\x20Assigned\x20Users','error','account_id','bold','permissions','entries','Account\x20Owner','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','description','\x20assigned','name','max','getPolicyPermissions','\x20\x20\x20','Listing\x20policies...','Member','\x20\x20•\x20','Fetching\x20permissions...','args','6Pldywi','getPolicyUsers','27036180GWRvUw','email','Administrator','128185RtIaqw','📋\x20Assigned\x20Policies','data','policy\x20show','✔\x20Found\x20','user','8537690IcZRzw','917790QEqUYF','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','validate','9MCHJON','100kSjzjz','\x20polic'];a32_0x5699=function(){return _0x4256be;};return a32_0x5699();}function printPermissionsMap(_0x365432){const _0xb78354=a32_0x4331a2,_0xa04396=Object[_0xb78354(0xcc)](_0x365432);console[_0xb78354(0xf3)]('\x0a'+a32_0x326b22[_0xb78354(0xca)]('🔑\x20Effective\x20Permissions')+':');if(_0xa04396[_0xb78354(0xf7)]===0x0){console[_0xb78354(0xf3)](a32_0x326b22[_0xb78354(0xc6)]('\x20\x20No\x20permissions'));return;}const _0x4e4bc4=Math[_0xb78354(0xd2)](..._0xa04396['map'](([_0xa0a895])=>_0xa0a895[_0xb78354(0xf7)]));for(const [_0x4e307d,_0x1fad15]of _0xa04396){const _0x113039=formatOperations(_0x1fad15);console[_0xb78354(0xf3)]('\x20\x20'+_0x4e307d['padEnd'](_0x4e4bc4+0x2)+_0x113039);}}function formatOperations(_0x54d4c9){const _0x3eb480=a32_0x4331a2,_0xc39048=[...new Set(_0x54d4c9[_0x3eb480(0xfe)](_0x5d6b01=>_0x5d6b01['operation']))];return _0xc39048[_0x3eb480(0xc5)](',\x20');}
@@ -1 +1 @@
1
- const a33_0x4340cb=a33_0xa09b;(function(_0x12e671,_0x6157df){const _0x40a8b3=a33_0xa09b,_0x4fb095=_0x12e671();while(!![]){try{const _0x589c20=parseInt(_0x40a8b3(0x175))/0x1*(parseInt(_0x40a8b3(0x162))/0x2)+parseInt(_0x40a8b3(0x160))/0x3*(-parseInt(_0x40a8b3(0x1c6))/0x4)+-parseInt(_0x40a8b3(0x196))/0x5+-parseInt(_0x40a8b3(0x1a4))/0x6*(parseInt(_0x40a8b3(0x167))/0x7)+-parseInt(_0x40a8b3(0x1a3))/0x8*(-parseInt(_0x40a8b3(0x15b))/0x9)+parseInt(_0x40a8b3(0x19b))/0xa+-parseInt(_0x40a8b3(0x170))/0xb*(parseInt(_0x40a8b3(0x1ac))/0xc);if(_0x589c20===_0x6157df)break;else _0x4fb095['push'](_0x4fb095['shift']());}catch(_0x2bb9fe){_0x4fb095['push'](_0x4fb095['shift']());}}}(a33_0x53ef,0x3c6a7));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_0x24b064 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';function a33_0x53ef(){const _0x3ecad1=['tdx:\x20profile\x20delete','create','yellow','\x27\x20deleted','\x27\x20created','validate','Removed\x20existing\x20profile\x20\x27','(session:\x20','Set\x20a\x20profile\x20configuration\x20value','split','jobs','tdx:\x20profile\x20set','apiKey','Validating\x20API\x20key...','warn','Unknown\x20key\x20\x27','Failed\x20to\x20delete\x20profile:\x20','/app/mp/ak','Setup\x20cancelled','You\x20can\x20find\x20your\x20API\x20key\x20at:','1020590sVemNy','length','Changing\x20site\x20to\x20\x27','\x0aSaved\x20to:\x20','API\x20key\x20cannot\x20be\x20empty','1260150MGgCNt','log','ERROR','database','\x0aSetup\x20cancelled','llm_agent','Site\x20was\x20not\x20changed.','default','3636392BHxZni','1987998UGvDHu','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','all','bold','password','trim','Delete\x20a\x20profile','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','1819284IcygVq','\x20\x20tdx\x20--profile\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','config','\x0aOperation\x20cancelled','profile:use','error','\x20--default\x27\x20to\x20save\x20permanently','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>','\x27\x20updated:\x20','Removal\x20cancelled','Set\x20session\x20profile','getUserInfo','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','\x20Profile\x20\x27','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','text','status','message','Enter\x20your\x20TD\x20API\x20key:','\x20\x20-\x20','Default\x20profile\x20set\x20to:\x20','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','profile:create','force','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','8moENsE','✗\x20Validation\x20failed:\x20','9vYmAgI','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','\x20API\x20key\x20is\x20valid\x20(User:\x20','VALID_KEYS','\x20\x20(no\x20profiles\x20found)','129942PAegah','execute','176234UYnVzp','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','session','email','Profile\x20name\x20cannot\x20be\x20empty','7dCAwXR','skipExistsCheck','join','\x27\x20does\x20not\x20exist.\x20Create\x20it?','green','profile','profile:set','logLevel','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','11sAZIEz','red','confirm','Enter\x20profile\x20name:','profile:delete','5icJbKp','\x20API\x20key\x20saved\x20to\x20system\x20keychain','includes','Profile\x20\x27','description','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','name','profileName','Create\x20a\x20new\x20profile','site','\x0aAvailable\x20profiles:','dim','us01'];a33_0x53ef=function(){return _0x3ecad1;};return a33_0x53ef();}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';function a33_0xa09b(_0x4e3133,_0x3dcd80){_0x4e3133=_0x4e3133-0x15a;const _0x53efb0=a33_0x53ef();let _0xa09b10=_0x53efb0[_0x4e3133];return _0xa09b10;}import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a33_0x4f755e from'prompts';import a33_0xf38270 from'chalk';function validateProfileName(_0x126972,_0x538d07){const _0xed9e75=a33_0xa09b;if(!_0x126972||!_0x126972[_0xed9e75(0x1a9)]())return _0xed9e75(0x166);const _0x208598=_0x126972[_0xed9e75(0x1a9)]();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x208598))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(!_0x538d07?.[_0xed9e75(0x168)]&&profileExists(_0x208598))return _0xed9e75(0x178)+_0x208598+_0xed9e75(0x1a5)+_0x208598+_0xed9e75(0x1b9);return!![];}async function deleteProfileAndCredentials(_0x2e726c){const _0x2619fd=a33_0xa09b;removeProfileFromUserConfig(_0x2e726c);const _0x4e265b=await isKeychainAvailable();_0x4e265b&&await Promise[_0x2619fd(0x1a6)]([deleteKeychainAPIKey(_0x2e726c),deleteOAuthTokens(_0x2e726c)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x4340cb(0x17b)]=a33_0x4340cb(0x1c3);['description']=a33_0x4340cb(0x17d);async[a33_0x4340cb(0x161)](_0x13d80e){const _0x2fb6c8=a33_0x4340cb,{options:_0x562ad4,args:_0x468544}=_0x13d80e,_0x464f34=!!_0x562ad4[_0x2fb6c8(0x1c4)];console[_0x2fb6c8(0x19c)](a33_0xf38270[_0x2fb6c8(0x1a7)]('tdx:\x20profile\x20create'));let _0x2fc2d6;if(_0x468544[_0x2fb6c8(0x197)]>0x0&&_0x468544[0x0]){const _0x4733ba=_0x468544[0x0]['trim']();_0x464f34&&profileExists(_0x4733ba)&&(await deleteProfileAndCredentials(_0x4733ba),console[_0x2fb6c8(0x19c)]('Removed\x20existing\x20profile\x20\x27'+_0x4733ba+'\x27'));const _0x117194=validateProfileName(_0x4733ba);if(_0x117194!==!![])return console[_0x2fb6c8(0x1b2)](a33_0xf38270[_0x2fb6c8(0x171)](_0x117194)),0x1;_0x2fc2d6=_0x4733ba;}else{const _0x4c0366=await a33_0x4f755e({'type':_0x2fb6c8(0x1bc),'name':'profileName','message':_0x2fb6c8(0x173),'validate':_0x2309fb=>validateProfileName(_0x2309fb,{'skipExistsCheck':_0x464f34})});if(!_0x4c0366[_0x2fb6c8(0x17c)])return console['log'](_0x2fb6c8(0x19f)),0x1;_0x2fc2d6=_0x4c0366[_0x2fb6c8(0x17c)][_0x2fb6c8(0x1a9)](),_0x464f34&&profileExists(_0x2fc2d6)&&(await deleteProfileAndCredentials(_0x2fc2d6),console[_0x2fb6c8(0x19c)](_0x2fb6c8(0x188)+_0x2fc2d6+'\x27'));}const _0x38c02a=await a33_0x4f755e({'type':_0x2fb6c8(0x1bc),'name':_0x2fb6c8(0x179),'message':'Enter\x20description\x20(optional):'}),_0x1f4cdf=_0x38c02a['description']?.[_0x2fb6c8(0x1a9)]()||undefined,_0x38e199=_0x562ad4[_0x2fb6c8(0x17e)]||_0x2fb6c8(0x181),_0xce4199=await promptSiteSelection(_0x38e199,_0x2fc2d6,_0x2fb6c8(0x194));if(!_0xce4199)return 0x1;const _0x4f296e=resolveSite(_0xce4199),_0x13a8f3=await promptAuthMethod();if(!_0x13a8f3)return console[_0x2fb6c8(0x19c)](_0x2fb6c8(0x19f)),0x1;if(_0x13a8f3==='oauth'){if(_0x1f4cdf){const _0x1a9298={'site':_0x4f296e,'description':_0x1f4cdf};saveProfileToUserConfig(_0x2fc2d6,_0x1a9298);}const {accountName:_0x289e73}=_0x562ad4;return await runOAuthLoginFlow(_0x4f296e,_0x2fc2d6,_0x562ad4[_0x2fb6c8(0x16e)]??LogLevel[_0x2fb6c8(0x19d)],{'accountName':_0x289e73}),0x0;}console[_0x2fb6c8(0x19c)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x4f296e),console[_0x2fb6c8(0x19c)](_0x2fb6c8(0x195)),console['log']('\x20\x20'+getConsoleUrl(_0x4f296e,_0x2fb6c8(0x193)));const _0x2b1f58=await a33_0x4f755e({'type':_0x2fb6c8(0x1a8),'name':'apiKey','message':_0x2fb6c8(0x1bf),'validate':_0x2e5b4a=>{const _0x1891a1=_0x2fb6c8;if(!_0x2e5b4a||!_0x2e5b4a[_0x1891a1(0x1a9)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x2b1f58['apiKey'])return console[_0x2fb6c8(0x19c)]('\x0aSetup\x20cancelled'),0x1;const _0x141ff3=_0x2b1f58[_0x2fb6c8(0x18e)];console[_0x2fb6c8(0x19c)](_0x2fb6c8(0x18f));try{const _0x194b26=TDX[_0x2fb6c8(0x183)]({'site':_0x4f296e,'apiKey':_0x141ff3[_0x2fb6c8(0x1a9)](),'logLevel':_0x562ad4[_0x2fb6c8(0x16e)]??LogLevel[_0x2fb6c8(0x19d)]}),_0x52e1d6=await _0x194b26[_0x2fb6c8(0x18c)][_0x2fb6c8(0x1b8)]();console['log'](a33_0xf38270[_0x2fb6c8(0x16b)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x52e1d6[_0x2fb6c8(0x165)]+')');const _0x139558=await isKeychainAvailable();_0x139558?(await saveAPIKeyAsync(_0x141ff3[_0x2fb6c8(0x1a9)](),_0x4f296e,_0x2fc2d6),console[_0x2fb6c8(0x19c)](a33_0xf38270[_0x2fb6c8(0x16b)]('✓')+_0x2fb6c8(0x17a)+_0x2fc2d6+')')):(console['warn'](a33_0xf38270['yellow'](_0x2fb6c8(0x1c2))),console[_0x2fb6c8(0x190)](a33_0xf38270['yellow']('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x4528f5={'site':_0x4f296e,..._0x1f4cdf&&{'description':_0x1f4cdf}};return saveProfileToUserConfig(_0x2fc2d6,_0x4528f5),console[_0x2fb6c8(0x19c)](a33_0xf38270['green']('✓')+_0x2fb6c8(0x1ba)+_0x2fc2d6+_0x2fb6c8(0x186)),console[_0x2fb6c8(0x19c)](),console[_0x2fb6c8(0x19c)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x2fb6c8(0x19c)]('\x20\x20tdx\x20--profile\x20'+_0x2fc2d6+_0x2fb6c8(0x163)),console[_0x2fb6c8(0x19c)](_0x2fb6c8(0x1ad)+_0x2fc2d6+_0x2fb6c8(0x15c)),0x0;}catch(_0x24956f){if(_0x24956f instanceof HTTPClientError&&_0x24956f[_0x2fb6c8(0x1bd)]===0x191)return printAuthError(_0x24956f),0x1;return console['error'](a33_0xf38270[_0x2fb6c8(0x171)](_0x2fb6c8(0x15a)+(_0x24956f instanceof Error?_0x24956f['message']:String(_0x24956f)))),console['error']('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x4340cb(0x17b)]=a33_0x4340cb(0x174);[a33_0x4340cb(0x179)]=a33_0x4340cb(0x1aa);['validate'](_0x18d37a){const _0x150601=a33_0x4340cb,{args:_0x1d1146}=_0x18d37a;if(_0x1d1146['length']===0x0)return _0x150601(0x1ae);return undefined;}async[a33_0x4340cb(0x161)](_0x34321f){const _0x176323=a33_0x4340cb,{args:_0x4f886f}=_0x34321f,_0x511baf=_0x4f886f[0x0];console[_0x176323(0x19c)](a33_0xf38270[_0x176323(0x1a7)](_0x176323(0x182)));if(!profileExists(_0x511baf)){console['error'](a33_0xf38270['red'](_0x176323(0x178)+_0x511baf+'\x27\x20does\x20not\x20exist.')),console[_0x176323(0x19c)](_0x176323(0x17f));const _0x5670c0=listProfiles();if(_0x5670c0[_0x176323(0x197)]===0x0)console[_0x176323(0x19c)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x40bb8f of _0x5670c0){console['log'](_0x176323(0x1c0)+_0x40bb8f['name']);}return 0x1;}const _0x1e98e9=await a33_0x4f755e({'type':'confirm','name':'confirm','message':_0x176323(0x1c5)+_0x511baf+'\x27?','initial':![]});if(!_0x1e98e9[_0x176323(0x172)])return console[_0x176323(0x19c)](_0x176323(0x1b6)),0x0;try{await deleteProfileAndCredentials(_0x511baf),console['log'](a33_0xf38270[_0x176323(0x16b)]('✓')+_0x176323(0x1ba)+_0x511baf+_0x176323(0x185));}catch(_0x35e820){return console[_0x176323(0x1b2)](a33_0xf38270[_0x176323(0x171)](_0x176323(0x192)+(_0x35e820 instanceof Error?_0x35e820[_0x176323(0x1be)]:String(_0x35e820)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a33_0x4340cb(0x16d);[a33_0x4340cb(0x179)]=a33_0x4340cb(0x18a);static ['VALID_KEYS']=[a33_0x4340cb(0x17e),a33_0x4340cb(0x19e),'parent_segment','llm_project',a33_0x4340cb(0x1a0),a33_0x4340cb(0x179)];[a33_0x4340cb(0x187)](_0x45b911){const _0x4f5650=a33_0x4340cb,{args:_0x4e5cbc,options:_0x5eab4f}=_0x45b911,_0x20e6f5=_0x5eab4f[_0x4f5650(0x16c)]||getActiveProfile();if(!_0x20e6f5)return _0x4f5650(0x1b4);if(_0x4e5cbc['length']===0x0)return _0x4f5650(0x16f)+ProfileSetCommand['VALID_KEYS'][_0x4f5650(0x169)](',\x20');const _0x58a8dd=_0x4e5cbc[0x0];if(!_0x58a8dd[_0x4f5650(0x177)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x4f5650(0x15e)][_0x4f5650(0x169)](',\x20');const [_0xd1f1ce]=_0x58a8dd[_0x4f5650(0x18b)]('=',0x2);if(!ProfileSetCommand[_0x4f5650(0x15e)][_0x4f5650(0x177)](_0xd1f1ce))return _0x4f5650(0x191)+_0xd1f1ce+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x4f5650(0x15e)]['join'](',\x20');return undefined;}async[a33_0x4340cb(0x161)](_0x13b2c3){const _0x592b44=a33_0x4340cb,{args:_0x1d813e,options:_0x1d49a4}=_0x13b2c3,_0x5ad785=_0x1d49a4[_0x592b44(0x16c)]||getActiveProfile(),[_0x3954fc,..._0x1f57dd]=_0x1d813e[0x0][_0x592b44(0x18b)]('='),_0x3f5452=_0x1f57dd[_0x592b44(0x169)]('=');console['log'](a33_0xf38270[_0x592b44(0x1a7)](_0x592b44(0x18d)));if(!profileExists(_0x5ad785)){const _0x35fa6=await a33_0x4f755e({'type':'confirm','name':_0x592b44(0x183),'message':_0x592b44(0x178)+_0x5ad785+_0x592b44(0x16a),'initial':!![]});if(!_0x35fa6[_0x592b44(0x183)])return console['log']('Operation\x20cancelled'),0x1;}const _0x18c92d=loadProfile(_0x5ad785),_0x108dce=_0x18c92d?.[_0x592b44(0x1af)]||{};if(_0x3954fc==='site'){const _0x22f2ab=resolveSite(_0x3f5452);console[_0x592b44(0x19c)](_0x592b44(0x198)+_0x22f2ab+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x592b44(0x19c)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x592b44(0x19c)]('\x20\x20'+getConsoleUrl(_0x22f2ab,_0x592b44(0x193)));const _0x11a92d=await a33_0x4f755e({'type':_0x592b44(0x1a8),'name':_0x592b44(0x18e),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x3fb4aa=>{const _0x15d042=_0x592b44;if(!_0x3fb4aa||!_0x3fb4aa[_0x15d042(0x1a9)]())return _0x15d042(0x19a);return!![];}});if(!_0x11a92d['apiKey'])return console[_0x592b44(0x19c)](_0x592b44(0x1b0)),0x1;console[_0x592b44(0x19c)](_0x592b44(0x18f));try{const _0x513911=TDX[_0x592b44(0x183)]({'site':_0x22f2ab,'apiKey':_0x11a92d['apiKey'][_0x592b44(0x1a9)](),'logLevel':_0x1d49a4[_0x592b44(0x16e)]??LogLevel[_0x592b44(0x19d)]}),_0x286416=await _0x513911[_0x592b44(0x18c)]['getUserInfo']();console[_0x592b44(0x19c)](a33_0xf38270[_0x592b44(0x16b)]('✓')+_0x592b44(0x15d)+_0x286416[_0x592b44(0x165)]+')');const _0x12bc63=await isKeychainAvailable();_0x12bc63?(await saveAPIKeyAsync(_0x11a92d[_0x592b44(0x18e)][_0x592b44(0x1a9)](),_0x22f2ab,_0x5ad785),console['log'](a33_0xf38270[_0x592b44(0x16b)]('✓')+_0x592b44(0x176))):console['warn'](a33_0xf38270[_0x592b44(0x184)](_0x592b44(0x1c2))),_0x108dce[_0x592b44(0x17e)]=_0x22f2ab;}catch(_0x133f9c){if(_0x133f9c instanceof HTTPClientError&&_0x133f9c[_0x592b44(0x1bd)]===0x191)return printAuthError(_0x133f9c),0x1;return console['error'](a33_0xf38270[_0x592b44(0x171)](_0x592b44(0x15a)+(_0x133f9c instanceof Error?_0x133f9c[_0x592b44(0x1be)]:String(_0x133f9c)))),console[_0x592b44(0x1b2)](_0x592b44(0x1a1)),0x1;}}else _0x108dce[_0x3954fc]=_0x3f5452||undefined;return saveProfileToUserConfig(_0x5ad785,_0x108dce),console[_0x592b44(0x19c)](a33_0xf38270[_0x592b44(0x16b)]('✓')+_0x592b44(0x1ba)+_0x5ad785+_0x592b44(0x1b5)+_0x3954fc+'='+(_0x3f5452||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a33_0x4340cb(0x1b1);[a33_0x4340cb(0x179)]=a33_0x4340cb(0x1b7);[a33_0x4340cb(0x187)](_0x87ee28){const _0x1754df=a33_0x4340cb,{args:_0x8e0c6e}=_0x87ee28;if(_0x8e0c6e['length']===0x0)return _0x1754df(0x1ab);return undefined;}async[a33_0x4340cb(0x161)](_0x2fedd4){const _0xdd8b22=a33_0x4340cb,{args:_0x14acf0,options:_0x7759e9}=_0x2fedd4,_0x5df4a3=_0x14acf0[0x0],_0x4d9fcb=_0x7759e9[_0xdd8b22(0x1a2)];cleanExpiredSessions();if(!profileExists(_0x5df4a3)){console[_0xdd8b22(0x1b2)](a33_0xf38270[_0xdd8b22(0x171)]('Profile\x20\x27'+_0x5df4a3+'\x27\x20does\x20not\x20exist.')),console[_0xdd8b22(0x19c)](_0xdd8b22(0x17f));const _0x172a0e=listProfiles();if(_0x172a0e['length']===0x0)console[_0xdd8b22(0x19c)](_0xdd8b22(0x15f));else for(const _0x1b5ff3 of _0x172a0e){console[_0xdd8b22(0x19c)](_0xdd8b22(0x1c0)+_0x1b5ff3[_0xdd8b22(0x17b)]);}return 0x1;}if(_0x4d9fcb){const _0x57d28a=a33_0x24b064[_0xdd8b22(0x169)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x5df4a3),console['log'](_0xdd8b22(0x1c1)+a33_0xf38270[_0xdd8b22(0x16b)](_0x5df4a3)),console[_0xdd8b22(0x19c)](a33_0xf38270[_0xdd8b22(0x180)](_0xdd8b22(0x199)+_0x57d28a)),0x0;}const _0x4a814d=getSessionID(_0x7759e9[_0xdd8b22(0x164)]);return saveSessionContext({'profile':_0x5df4a3},_0x7759e9[_0xdd8b22(0x164)]),console[_0xdd8b22(0x19c)]('Session\x20profile\x20set\x20to:\x20'+a33_0xf38270['green'](_0x5df4a3)+'\x20'+a33_0xf38270[_0xdd8b22(0x180)](_0xdd8b22(0x189)+_0x4a814d+')')),console[_0xdd8b22(0x19c)](a33_0xf38270['dim'](_0xdd8b22(0x1bb)+_0x5df4a3+_0xdd8b22(0x1b3))),0x0;}}
1
+ const a33_0xaa65ad=a33_0x4e98;(function(_0x488345,_0x5f4bd0){const _0x28068d=a33_0x4e98,_0x205786=_0x488345();while(!![]){try{const _0x9f317a=parseInt(_0x28068d(0xa8))/0x1*(-parseInt(_0x28068d(0x9f))/0x2)+-parseInt(_0x28068d(0xcb))/0x3*(-parseInt(_0x28068d(0x8a))/0x4)+parseInt(_0x28068d(0x7e))/0x5+-parseInt(_0x28068d(0xc7))/0x6*(parseInt(_0x28068d(0x97))/0x7)+-parseInt(_0x28068d(0xa0))/0x8+parseInt(_0x28068d(0x84))/0x9*(parseInt(_0x28068d(0xaa))/0xa)+parseInt(_0x28068d(0xbb))/0xb;if(_0x9f317a===_0x5f4bd0)break;else _0x205786['push'](_0x205786['shift']());}catch(_0x16c7b4){_0x205786['push'](_0x205786['shift']());}}}(a33_0x3226,0xaffbf));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_0x514fcd from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';function a33_0x4e98(_0x311dd9,_0x40f316){_0x311dd9=_0x311dd9-0x74;const _0x32263d=a33_0x3226();let _0x4e9811=_0x32263d[_0x311dd9];return _0x4e9811;}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_0x30b068 from'prompts';import a33_0x428c87 from'chalk';function validateProfileName(_0x37b7e6,_0x228b02){const _0x31f96e=a33_0x4e98;if(!_0x37b7e6||!_0x37b7e6[_0x31f96e(0xc4)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x56da24=_0x37b7e6[_0x31f96e(0xc4)]();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x56da24))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(!_0x228b02?.[_0x31f96e(0xd9)]&&profileExists(_0x56da24))return _0x31f96e(0x89)+_0x56da24+_0x31f96e(0xa2)+_0x56da24+_0x31f96e(0xa9);return!![];}async function deleteProfileAndCredentials(_0x205151){removeProfileFromUserConfig(_0x205151);const _0x3f7985=await isKeychainAvailable();_0x3f7985&&await Promise['all']([deleteKeychainAPIKey(_0x205151),deleteOAuthTokens(_0x205151)]);}function a33_0x3226(){const _0x1948b8=['\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','11190bdVtlP','ERROR','tdx:\x20profile\x20delete','profile:delete','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x20\x20-\x20','config','profile','VALID_KEYS','dim','Operation\x20cancelled','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','\x27.\x0a\x0aValid\x20keys:\x20','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','status','9058863aFiOcW','name','API\x20key\x20cannot\x20be\x20empty','length','Validating\x20API\x20key...','Session\x20profile\x20set\x20to:\x20','password','\x20\x20tdx\x20--profile\x20','message','trim','Enter\x20profile\x20name:','Set\x20session\x20profile','6wpBmJJ','text','yellow','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','22779BoEIEi','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','profile:use','error','\x0aSaved\x20to:\x20','Create\x20a\x20new\x20profile','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','site','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','profileName','\x20API\x20key\x20saved\x20to\x20system\x20keychain','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x0aAvailable\x20profiles:','Removed\x20existing\x20profile\x20\x27','skipExistsCheck','bold','Set\x20a\x20profile\x20configuration\x20value','includes','create','llm_agent','\x27\x20does\x20not\x20exist.','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Default\x20profile\x20set\x20to:\x20','\x20\x20(no\x20profiles\x20found)','split','email','force','1007375ahxsou','green','tdx:\x20profile\x20set','Enter\x20description\x20(optional):','Unknown\x20key\x20\x27','llm_project','6219PXJQmh','logLevel','default','join','(cleared)','Profile\x20\x27','568MAvqBh','validate','You\x20can\x20find\x20your\x20API\x20key\x20at:','tdx:\x20profile\x20create','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','jobs','\x0aSetup\x20cancelled','\x20Profile\x20\x27','warn','\x20API\x20key\x20is\x20valid\x20(User:\x20','log','apiKey','getUserInfo','9119089eWsXpC','confirm','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','/app/mp/ak','\x20--default\x27\x20to\x20save\x20permanently','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>','description','\x27\x20created','4yxDmSa','1229256MKWpEg','✗\x20Validation\x20failed:\x20','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','red','execute','\x27\x20requires\x20API\x20key\x20validation.','Setup\x20cancelled','\x27\x20updated:\x20','349614mLIpIA'];a33_0x3226=function(){return _0x1948b8;};return a33_0x3226();}export class ProfileCreateCommand extends BaseCommand{[a33_0xaa65ad(0xbc)]='profile:create';[a33_0xaa65ad(0x9d)]=a33_0xaa65ad(0xd0);async[a33_0xaa65ad(0xa4)](_0x10d601){const _0x3647ae=a33_0xaa65ad,{options:_0x64de5,args:_0x556095}=_0x10d601,_0x44992a=!!_0x64de5[_0x3647ae(0x7d)];console[_0x3647ae(0x94)](a33_0x428c87[_0x3647ae(0xda)](_0x3647ae(0x8d)));let _0x2a0065;if(_0x556095[_0x3647ae(0xbe)]>0x0&&_0x556095[0x0]){const _0x461c5e=_0x556095[0x0][_0x3647ae(0xc4)]();_0x44992a&&profileExists(_0x461c5e)&&(await deleteProfileAndCredentials(_0x461c5e),console[_0x3647ae(0x94)](_0x3647ae(0xd8)+_0x461c5e+'\x27'));const _0x9ddce0=validateProfileName(_0x461c5e);if(_0x9ddce0!==!![])return console[_0x3647ae(0xce)](a33_0x428c87[_0x3647ae(0xa3)](_0x9ddce0)),0x1;_0x2a0065=_0x461c5e;}else{const _0x25ea96=await a33_0x30b068({'type':_0x3647ae(0xc8),'name':_0x3647ae(0xd4),'message':_0x3647ae(0xc5),'validate':_0x5d7887=>validateProfileName(_0x5d7887,{'skipExistsCheck':_0x44992a})});if(!_0x25ea96[_0x3647ae(0xd4)])return console['log'](_0x3647ae(0x90)),0x1;_0x2a0065=_0x25ea96[_0x3647ae(0xd4)][_0x3647ae(0xc4)](),_0x44992a&&profileExists(_0x2a0065)&&(await deleteProfileAndCredentials(_0x2a0065),console[_0x3647ae(0x94)]('Removed\x20existing\x20profile\x20\x27'+_0x2a0065+'\x27'));}const _0x1df1e0=await a33_0x30b068({'type':_0x3647ae(0xc8),'name':_0x3647ae(0x9d),'message':_0x3647ae(0x81)}),_0x4e0e66=_0x1df1e0['description']?.[_0x3647ae(0xc4)]()||undefined,_0xa1eeac=_0x64de5[_0x3647ae(0xd2)]||'us01',_0x39e932=await promptSiteSelection(_0xa1eeac,_0x2a0065,_0x3647ae(0xa6));if(!_0x39e932)return 0x1;const _0x21de88=resolveSite(_0x39e932),_0x153bce=await promptAuthMethod();if(!_0x153bce)return console['log'](_0x3647ae(0x90)),0x1;if(_0x153bce==='oauth'){if(_0x4e0e66){const _0xaef661={'site':_0x21de88,'description':_0x4e0e66};saveProfileToUserConfig(_0x2a0065,_0xaef661);}const {accountName:_0x38f4d4}=_0x64de5;return await runOAuthLoginFlow(_0x21de88,_0x2a0065,_0x64de5[_0x3647ae(0x85)]??LogLevel['ERROR'],{'accountName':_0x38f4d4}),0x0;}console[_0x3647ae(0x94)](_0x3647ae(0x8e)+_0x21de88),console[_0x3647ae(0x94)](_0x3647ae(0x8c)),console[_0x3647ae(0x94)]('\x20\x20'+getConsoleUrl(_0x21de88,_0x3647ae(0x9a)));const _0x3f6e8=await a33_0x30b068({'type':_0x3647ae(0xc1),'name':_0x3647ae(0x95),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x51356f=>{if(!_0x51356f||!_0x51356f['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x3f6e8[_0x3647ae(0x95)])return console[_0x3647ae(0x94)](_0x3647ae(0x90)),0x1;const _0xa24d22=_0x3f6e8['apiKey'];console['log'](_0x3647ae(0xbf));try{const _0x2b4972=TDX[_0x3647ae(0x75)]({'site':_0x21de88,'apiKey':_0xa24d22[_0x3647ae(0xc4)](),'logLevel':_0x64de5[_0x3647ae(0x85)]??LogLevel[_0x3647ae(0xab)]}),_0x4e10e6=await _0x2b4972['jobs'][_0x3647ae(0x96)]();console[_0x3647ae(0x94)](a33_0x428c87[_0x3647ae(0x7f)]('✓')+_0x3647ae(0x93)+_0x4e10e6[_0x3647ae(0x7c)]+')');const _0x399d9e=await isKeychainAvailable();_0x399d9e?(await saveAPIKeyAsync(_0xa24d22[_0x3647ae(0xc4)](),_0x21de88,_0x2a0065),console[_0x3647ae(0x94)](a33_0x428c87[_0x3647ae(0x7f)]('✓')+_0x3647ae(0xd3)+_0x2a0065+')')):(console['warn'](a33_0x428c87['yellow'](_0x3647ae(0xca))),console[_0x3647ae(0x92)](a33_0x428c87[_0x3647ae(0xc9)](_0x3647ae(0xb9))));const _0x2ff6aa={'site':_0x21de88,..._0x4e0e66&&{'description':_0x4e0e66}};return saveProfileToUserConfig(_0x2a0065,_0x2ff6aa),console[_0x3647ae(0x94)](a33_0x428c87[_0x3647ae(0x7f)]('✓')+_0x3647ae(0x91)+_0x2a0065+_0x3647ae(0x9e)),console['log'](),console['log'](_0x3647ae(0xae)),console[_0x3647ae(0x94)](_0x3647ae(0xc2)+_0x2a0065+_0x3647ae(0x99)),console['log'](_0x3647ae(0xc2)+_0x2a0065+_0x3647ae(0xd1)),0x0;}catch(_0x54e1d7){if(_0x54e1d7 instanceof HTTPClientError&&_0x54e1d7[_0x3647ae(0xba)]===0x191)return printAuthError(_0x54e1d7),0x1;return console[_0x3647ae(0xce)](a33_0x428c87[_0x3647ae(0xa3)](_0x3647ae(0xa1)+(_0x54e1d7 instanceof Error?_0x54e1d7['message']:String(_0x54e1d7)))),console[_0x3647ae(0xce)](_0x3647ae(0xcc)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0xaa65ad(0xbc)]=a33_0xaa65ad(0xad);[a33_0xaa65ad(0x9d)]='Delete\x20a\x20profile';[a33_0xaa65ad(0x8b)](_0x52db04){const _0x1a7e54=a33_0xaa65ad,{args:_0x4d9fec}=_0x52db04;if(_0x4d9fec[_0x1a7e54(0xbe)]===0x0)return _0x1a7e54(0xb7);return undefined;}async[a33_0xaa65ad(0xa4)](_0x1c606d){const _0x5cb24b=a33_0xaa65ad,{args:_0x15d095}=_0x1c606d,_0x129e37=_0x15d095[0x0];console['log'](a33_0x428c87[_0x5cb24b(0xda)](_0x5cb24b(0xac)));if(!profileExists(_0x129e37)){console[_0x5cb24b(0xce)](a33_0x428c87[_0x5cb24b(0xa3)]('Profile\x20\x27'+_0x129e37+_0x5cb24b(0x77))),console['log']('\x0aAvailable\x20profiles:');const _0x307c34=listProfiles();if(_0x307c34['length']===0x0)console[_0x5cb24b(0x94)](_0x5cb24b(0x7a));else for(const _0x500b70 of _0x307c34){console[_0x5cb24b(0x94)](_0x5cb24b(0xb0)+_0x500b70[_0x5cb24b(0xbc)]);}return 0x1;}const _0x5795f8=await a33_0x30b068({'type':_0x5cb24b(0x98),'name':'confirm','message':_0x5cb24b(0xaf)+_0x129e37+'\x27?','initial':![]});if(!_0x5795f8[_0x5cb24b(0x98)])return console['log']('Removal\x20cancelled'),0x0;try{await deleteProfileAndCredentials(_0x129e37),console[_0x5cb24b(0x94)](a33_0x428c87[_0x5cb24b(0x7f)]('✓')+_0x5cb24b(0x91)+_0x129e37+'\x27\x20deleted');}catch(_0x5733b8){return console[_0x5cb24b(0xce)](a33_0x428c87[_0x5cb24b(0xa3)]('Failed\x20to\x20delete\x20profile:\x20'+(_0x5733b8 instanceof Error?_0x5733b8[_0x5cb24b(0xc3)]:String(_0x5733b8)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0xaa65ad(0xbc)]='profile:set';[a33_0xaa65ad(0x9d)]=a33_0xaa65ad(0xdb);static ['VALID_KEYS']=[a33_0xaa65ad(0xd2),'database','parent_segment',a33_0xaa65ad(0x83),a33_0xaa65ad(0x76),a33_0xaa65ad(0x9d)];['validate'](_0x5214ef){const _0x11e4b4=a33_0xaa65ad,{args:_0x168a9d,options:_0x5e7bbc}=_0x5214ef,_0x75148d=_0x5e7bbc[_0x11e4b4(0xb2)]||getActiveProfile();if(!_0x75148d)return _0x11e4b4(0x9c);if(_0x168a9d[_0x11e4b4(0xbe)]===0x0)return _0x11e4b4(0xb6)+ProfileSetCommand['VALID_KEYS'][_0x11e4b4(0x87)](',\x20');const _0x2986fb=_0x168a9d[0x0];if(!_0x2986fb['includes']('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x11e4b4(0xb3)][_0x11e4b4(0x87)](',\x20');const [_0x27abf1]=_0x2986fb[_0x11e4b4(0x7b)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x11e4b4(0x74)](_0x27abf1))return _0x11e4b4(0x82)+_0x27abf1+_0x11e4b4(0xb8)+ProfileSetCommand[_0x11e4b4(0xb3)][_0x11e4b4(0x87)](',\x20');return undefined;}async[a33_0xaa65ad(0xa4)](_0x1a8e6e){const _0x277361=a33_0xaa65ad,{args:_0x4229ad,options:_0x344f39}=_0x1a8e6e,_0x22bf0b=_0x344f39[_0x277361(0xb2)]||getActiveProfile(),[_0x3d8f8b,..._0x45145e]=_0x4229ad[0x0][_0x277361(0x7b)]('='),_0x32e9d6=_0x45145e[_0x277361(0x87)]('=');console[_0x277361(0x94)](a33_0x428c87[_0x277361(0xda)](_0x277361(0x80)));if(!profileExists(_0x22bf0b)){const _0x389c81=await a33_0x30b068({'type':'confirm','name':_0x277361(0x75),'message':_0x277361(0x89)+_0x22bf0b+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x389c81[_0x277361(0x75)])return console['log'](_0x277361(0xb5)),0x1;}const _0x3b6ae7=loadProfile(_0x22bf0b),_0x44166f=_0x3b6ae7?.[_0x277361(0xb1)]||{};if(_0x3d8f8b===_0x277361(0xd2)){const _0x5ecafe=resolveSite(_0x32e9d6);console[_0x277361(0x94)]('Changing\x20site\x20to\x20\x27'+_0x5ecafe+_0x277361(0xa5)),console[_0x277361(0x94)](_0x277361(0x78)),console[_0x277361(0x94)]('\x20\x20'+getConsoleUrl(_0x5ecafe,_0x277361(0x9a)));const _0x4b98ea=await a33_0x30b068({'type':_0x277361(0xc1),'name':_0x277361(0x95),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x26466c=>{const _0x41e59c=_0x277361;if(!_0x26466c||!_0x26466c[_0x41e59c(0xc4)]())return _0x41e59c(0xbd);return!![];}});if(!_0x4b98ea[_0x277361(0x95)])return console[_0x277361(0x94)]('\x0aOperation\x20cancelled'),0x1;console[_0x277361(0x94)](_0x277361(0xbf));try{const _0x156037=TDX[_0x277361(0x75)]({'site':_0x5ecafe,'apiKey':_0x4b98ea[_0x277361(0x95)][_0x277361(0xc4)](),'logLevel':_0x344f39[_0x277361(0x85)]??LogLevel[_0x277361(0xab)]}),_0xfab3fe=await _0x156037[_0x277361(0x8f)]['getUserInfo']();console[_0x277361(0x94)](a33_0x428c87[_0x277361(0x7f)]('✓')+_0x277361(0x93)+_0xfab3fe[_0x277361(0x7c)]+')');const _0x6bf913=await isKeychainAvailable();_0x6bf913?(await saveAPIKeyAsync(_0x4b98ea[_0x277361(0x95)][_0x277361(0xc4)](),_0x5ecafe,_0x22bf0b),console[_0x277361(0x94)](a33_0x428c87['green']('✓')+_0x277361(0xd5))):console['warn'](a33_0x428c87[_0x277361(0xc9)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x44166f['site']=_0x5ecafe;}catch(_0x5acda7){if(_0x5acda7 instanceof HTTPClientError&&_0x5acda7['status']===0x191)return printAuthError(_0x5acda7),0x1;return console[_0x277361(0xce)](a33_0x428c87[_0x277361(0xa3)](_0x277361(0xa1)+(_0x5acda7 instanceof Error?_0x5acda7[_0x277361(0xc3)]:String(_0x5acda7)))),console['error']('Site\x20was\x20not\x20changed.'),0x1;}}else _0x44166f[_0x3d8f8b]=_0x32e9d6||undefined;return saveProfileToUserConfig(_0x22bf0b,_0x44166f),console[_0x277361(0x94)](a33_0x428c87[_0x277361(0x7f)]('✓')+_0x277361(0x91)+_0x22bf0b+_0x277361(0xa7)+_0x3d8f8b+'='+(_0x32e9d6||_0x277361(0x88))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0xaa65ad(0xbc)]=a33_0xaa65ad(0xcd);[a33_0xaa65ad(0x9d)]=a33_0xaa65ad(0xc6);[a33_0xaa65ad(0x8b)](_0x1d5023){const {args:_0x292214}=_0x1d5023;if(_0x292214['length']===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a33_0xaa65ad(0xa4)](_0x59b4cd){const _0x1952f0=a33_0xaa65ad,{args:_0x1c4a24,options:_0x402244}=_0x59b4cd,_0x56c2db=_0x1c4a24[0x0],_0x1b3ff9=_0x402244[_0x1952f0(0x86)];cleanExpiredSessions();if(!profileExists(_0x56c2db)){console[_0x1952f0(0xce)](a33_0x428c87[_0x1952f0(0xa3)](_0x1952f0(0x89)+_0x56c2db+'\x27\x20does\x20not\x20exist.')),console[_0x1952f0(0x94)](_0x1952f0(0xd7));const _0x35e8b8=listProfiles();if(_0x35e8b8[_0x1952f0(0xbe)]===0x0)console[_0x1952f0(0x94)](_0x1952f0(0x7a));else for(const _0x3f089c of _0x35e8b8){console[_0x1952f0(0x94)](_0x1952f0(0xb0)+_0x3f089c[_0x1952f0(0xbc)]);}return 0x1;}if(_0x1b3ff9){const _0x328b52=a33_0x514fcd['join'](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x56c2db),console['log'](_0x1952f0(0x79)+a33_0x428c87[_0x1952f0(0x7f)](_0x56c2db)),console[_0x1952f0(0x94)](a33_0x428c87[_0x1952f0(0xb4)](_0x1952f0(0xcf)+_0x328b52)),0x0;}const _0x580d9f=getSessionID(_0x402244['session']);return saveSessionContext({'profile':_0x56c2db},_0x402244['session']),console[_0x1952f0(0x94)](_0x1952f0(0xc0)+a33_0x428c87[_0x1952f0(0x7f)](_0x56c2db)+'\x20'+a33_0x428c87[_0x1952f0(0xb4)]('(session:\x20'+_0x580d9f+')')),console[_0x1952f0(0x94)](a33_0x428c87[_0x1952f0(0xb4)](_0x1952f0(0xd6)+_0x56c2db+_0x1952f0(0x9b))),0x0;}}
@@ -1 +1 @@
1
- const a34_0x6c075a=a34_0x2481;function a34_0x4a04(){const _0x56daff=['220770BYLCOe','50okjlNp','1KVBCwy','93051hGxLRZ','message','Error:\x20','length','description','62846Xaijmn','\x20\x20Global:\x20~/.config/tdx/tdx.json','map','green','name','config','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','909227WEOzOJ','site','error','execute','248ovgCdK','List\x20all\x20available\x20profiles','698120eHUago','21fxpoDU','dim','profiles','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','35136MdsKzk','47620MSHcVJ','log'];a34_0x4a04=function(){return _0x56daff;};return a34_0x4a04();}(function(_0x4a0449,_0x218241){const _0x161186=a34_0x2481,_0x4aff5a=_0x4a0449();while(!![]){try{const _0x226042=-parseInt(_0x161186(0x8d))/0x1*(-parseInt(_0x161186(0x93))/0x2)+parseInt(_0x161186(0x8e))/0x3+parseInt(_0x161186(0x89))/0x4+-parseInt(_0x161186(0xa0))/0x5+parseInt(_0x161186(0x8b))/0x6*(-parseInt(_0x161186(0xa1))/0x7)+-parseInt(_0x161186(0x9e))/0x8*(parseInt(_0x161186(0x88))/0x9)+parseInt(_0x161186(0x8c))/0xa*(parseInt(_0x161186(0x9a))/0xb);if(_0x226042===_0x218241)break;else _0x4aff5a['push'](_0x4aff5a['shift']());}catch(_0x2fa432){_0x4aff5a['push'](_0x4aff5a['shift']());}}}(a34_0x4a04,0x1c775));function a34_0x2481(_0x228c59,_0xe8a677){_0x228c59=_0x228c59-0x85;const _0x4a04f0=a34_0x4a04();let _0x2481f6=_0x4a04f0[_0x228c59];return _0x2481f6;}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x31e942 from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x6c075a(0x97)]=a34_0x6c075a(0x86);[a34_0x6c075a(0x92)]=a34_0x6c075a(0x9f);async[a34_0x6c075a(0x9d)](_0x53ad99){const _0x3c26b7=a34_0x6c075a,{options:_0x2dbe84}=_0x53ad99;try{const _0x59c895=listProfiles(),_0x1c0091=getActiveProfile();if(_0x59c895[_0x3c26b7(0x91)]===0x0)return console[_0x3c26b7(0x8a)](_0x3c26b7(0x99)),console[_0x3c26b7(0x8a)](_0x3c26b7(0x87)),console[_0x3c26b7(0x8a)](_0x3c26b7(0x94)),0x0;const _0xd8be0a=_0x59c895[_0x3c26b7(0x95)](_0x2af5e1=>{const _0x2e93cb=_0x3c26b7,_0x18c8d1=_0x2af5e1['name']===_0x1c0091,_0x4f8e76=getProfileParams(_0x2af5e1['config']);return{'name':_0x2af5e1[_0x2e93cb(0x97)],'active':_0x18c8d1,'scope':_0x2af5e1['scope'],'description':_0x2af5e1[_0x2e93cb(0x98)][_0x2e93cb(0x92)]||'','params':_0x4f8e76};});if(isStructuredFormat(_0x2dbe84))await handleSDKOutput(_0xd8be0a,_0x2dbe84);else for(const _0x226dcf of _0x59c895){const _0x221573=_0x226dcf[_0x3c26b7(0x97)]===_0x1c0091?a34_0x31e942[_0x3c26b7(0x96)]('\x20✓'):'',_0x2080d3=_0x226dcf[_0x3c26b7(0x98)][_0x3c26b7(0x9b)]?a34_0x31e942[_0x3c26b7(0x85)]('\x20'+_0x226dcf[_0x3c26b7(0x98)][_0x3c26b7(0x9b)]):'',_0x3c48b9=_0x226dcf[_0x3c26b7(0x98)][_0x3c26b7(0x92)]?a34_0x31e942['dim']('\x20\x20'+_0x226dcf[_0x3c26b7(0x98)][_0x3c26b7(0x92)]):'';console[_0x3c26b7(0x8a)]('👤\x20'+_0x226dcf['name']+_0x221573+_0x2080d3+_0x3c48b9);}return 0x0;}catch(_0x7408c){return _0x7408c instanceof Error&&console[_0x3c26b7(0x9c)](_0x3c26b7(0x90)+_0x7408c[_0x3c26b7(0x8f)]),0x1;}}}
1
+ const a34_0x242160=a34_0xadc8;(function(_0x4d31ee,_0x3d3618){const _0x368175=a34_0xadc8,_0x2f9522=_0x4d31ee();while(!![]){try{const _0x1e9116=-parseInt(_0x368175(0x141))/0x1*(parseInt(_0x368175(0x13d))/0x2)+parseInt(_0x368175(0x137))/0x3*(parseInt(_0x368175(0x13c))/0x4)+parseInt(_0x368175(0x12f))/0x5+-parseInt(_0x368175(0x12e))/0x6+-parseInt(_0x368175(0x130))/0x7*(-parseInt(_0x368175(0x142))/0x8)+parseInt(_0x368175(0x12c))/0x9*(-parseInt(_0x368175(0x12d))/0xa)+parseInt(_0x368175(0x133))/0xb;if(_0x1e9116===_0x3d3618)break;else _0x2f9522['push'](_0x2f9522['shift']());}catch(_0x505475){_0x2f9522['push'](_0x2f9522['shift']());}}}(a34_0xe9f0,0xd3aed));function a34_0xadc8(_0x4335dd,_0x126f21){_0x4335dd=_0x4335dd-0x12c;const _0xe9f045=a34_0xe9f0();let _0xadc81c=_0xe9f045[_0x4335dd];return _0xadc81c;}import{BaseCommand}from'./command.js';function a34_0xe9f0(){const _0x366057=['error','description','log','3463508GzWdzs','1300rXhGEZ','execute','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','scope','1913BChQsK','16lNZkhj','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','7434HAUybv','680tiybme','2112408MDfhDf','2544060zVwGWQ','1726676bQMHLf','message','config','7157854IPCpXx','👤\x20','site','green','3HvShix','name'];a34_0xe9f0=function(){return _0x366057;};return a34_0xe9f0();}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x451f7d from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x242160(0x138)]='profiles';['description']='List\x20all\x20available\x20profiles';async[a34_0x242160(0x13e)](_0x295b12){const _0x505e84=a34_0x242160,{options:_0x291c2a}=_0x295b12;try{const _0x5c75d4=listProfiles(),_0x598a00=getActiveProfile();if(_0x5c75d4['length']===0x0)return console[_0x505e84(0x13b)](_0x505e84(0x13f)),console[_0x505e84(0x13b)](_0x505e84(0x143)),console['log']('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x5ed88b=_0x5c75d4['map'](_0x555e6b=>{const _0x401de4=_0x505e84,_0x1833b1=_0x555e6b[_0x401de4(0x138)]===_0x598a00,_0x3421fa=getProfileParams(_0x555e6b[_0x401de4(0x132)]);return{'name':_0x555e6b[_0x401de4(0x138)],'active':_0x1833b1,'scope':_0x555e6b[_0x401de4(0x140)],'description':_0x555e6b[_0x401de4(0x132)]['description']||'','params':_0x3421fa};});if(isStructuredFormat(_0x291c2a))await handleSDKOutput(_0x5ed88b,_0x291c2a);else for(const _0x5464d4 of _0x5c75d4){const _0x4e58df=_0x5464d4[_0x505e84(0x138)]===_0x598a00?a34_0x451f7d[_0x505e84(0x136)]('\x20✓'):'',_0x1e58d1=_0x5464d4['config'][_0x505e84(0x135)]?a34_0x451f7d['dim']('\x20'+_0x5464d4[_0x505e84(0x132)]['site']):'',_0x3d8b33=_0x5464d4['config'][_0x505e84(0x13a)]?a34_0x451f7d['dim']('\x20\x20'+_0x5464d4['config'][_0x505e84(0x13a)]):'';console['log'](_0x505e84(0x134)+_0x5464d4['name']+_0x4e58df+_0x1e58d1+_0x3d8b33);}return 0x0;}catch(_0x3d69c0){return _0x3d69c0 instanceof Error&&console[_0x505e84(0x139)]('Error:\x20'+_0x3d69c0[_0x505e84(0x131)]),0x1;}}}
@@ -1 +1 @@
1
- const a35_0x5cc773=a35_0x5612;(function(_0x448cc1,_0x1a47df){const _0x1cee72=a35_0x5612,_0x5b7139=_0x448cc1();while(!![]){try{const _0xf38580=parseInt(_0x1cee72(0x1a9))/0x1*(parseInt(_0x1cee72(0x1a1))/0x2)+-parseInt(_0x1cee72(0x19d))/0x3*(-parseInt(_0x1cee72(0x1b6))/0x4)+-parseInt(_0x1cee72(0x1c9))/0x5*(-parseInt(_0x1cee72(0x1c3))/0x6)+parseInt(_0x1cee72(0x19a))/0x7*(parseInt(_0x1cee72(0x1b0))/0x8)+parseInt(_0x1cee72(0x196))/0x9+parseInt(_0x1cee72(0x1ac))/0xa*(parseInt(_0x1cee72(0x1c6))/0xb)+-parseInt(_0x1cee72(0x1a2))/0xc;if(_0xf38580===_0x1a47df)break;else _0x5b7139['push'](_0x5b7139['shift']());}catch(_0x2b89a4){_0x5b7139['push'](_0x5b7139['shift']());}}}(a35_0x1a08,0xb5031));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';function a35_0x1a08(){const _0x27f56f=['in\x20','1518294FJgSUo','query','Query\x20completed:\x20Processed\x20','14234803BWFWNJ','verbose','setPhase','15IQBNxC','\x20[Job\x20ID:\x20','Site:\x20','\x20rows\x20','args','execute','10967535YWRlQd','description','No\x20SQL\x20provided','setJobId','9001034BhlLwe','validate','catalog','75XCgnVT','Catalog:\x20','message','SQL:\x20','2VUANht','69865224LpbUjZ','Executing\x20statement\x20','state','Executing\x20query...','output','originalMessage','database','1075505TKpAlz','name','completedSplits','10CMWnfe','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','site','length','8gYPysW','elapsedTimeMillis','information_schema','\x20splits','\x20-\x20','Run\x20Trino\x20queries\x20(streaming)','148852WEUxjh','jobId','Statement\x20','error','data','\x0aAll\x20results\x20saved\x20to\x20','...','stats','file','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','options','setExtra'];a35_0x1a08=function(){return _0x27f56f;};return a35_0x1a08();}function a35_0x5612(_0x30ad7e,_0x2ecf8c){_0x30ad7e=_0x30ad7e-0x191;const _0x1a080c=a35_0x1a08();let _0x5612df=_0x1a080c[_0x30ad7e];return _0x5612df;}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a35_0x5cc773(0x1aa)]=a35_0x5cc773(0x1c4);[a35_0x5cc773(0x197)]=a35_0x5cc773(0x1b5);async['execute'](_0x401327){const _0x2fb94d=a35_0x5cc773,{options:_0x4b5ecf,args:_0x37d693,tdx:_0x27e84c}=_0x401327,_0x325c2d={..._0x4b5ecf,'limitStructuredFormats':!![]},_0x113853=_0x37d693[0x0],_0x429e28=_0x4b5ecf[_0x2fb94d(0x1be)];let _0x1f16c4;try{if(_0x429e28)_0x1f16c4=readSqlStatementsFromFile(_0x429e28);else{if(_0x113853==='-')_0x1f16c4=await readSqlStatementsFromStdin();else{if(_0x113853&&isSqlFilePath(_0x113853))_0x1f16c4=readSqlStatementsFromFile(_0x113853);else{if(_0x113853)_0x1f16c4=splitSqlStatements(_0x113853);else throw new Error(_0x2fb94d(0x198));}}}}catch(_0x3dbad4){return console[_0x2fb94d(0x1b9)]('Error:\x20'+_0x3dbad4[_0x2fb94d(0x19f)]),0x1;}const _0x414ddd=_0x4b5ecf[_0x2fb94d(0x1a8)]||_0x2fb94d(0x1b2),_0x2c6977=_0x4b5ecf[_0x2fb94d(0x19c)];try{const _0x33630e=[],_0xb51855=!!_0x4b5ecf[_0x2fb94d(0x1a6)];for(let _0x44b77f=0x0;_0x44b77f<_0x1f16c4[_0x2fb94d(0x1af)];_0x44b77f++){const _0x163f00=_0x1f16c4[_0x44b77f],_0x54812b=_0x44b77f+0x1,_0x5e98bb=_0x1f16c4[_0x2fb94d(0x1af)],_0x25453b=_0x5e98bb>0x1;_0x4b5ecf[_0x2fb94d(0x1c7)]&&(console[_0x2fb94d(0x1b9)]('\x0a'+(_0x25453b?'Statement\x20'+_0x54812b+'/'+_0x5e98bb+':':'')),console[_0x2fb94d(0x1b9)](_0x2fb94d(0x192)+_0x4b5ecf[_0x2fb94d(0x1ae)]),console['error'](_0x2fb94d(0x19e)+(_0x2c6977||'td')),console[_0x2fb94d(0x1b9)]('Schema:\x20'+_0x414ddd),console[_0x2fb94d(0x1b9)](_0x2fb94d(0x1a0)+_0x163f00));const _0x18ba8c=_0x25453b?_0x2fb94d(0x1a3)+_0x54812b+'/'+_0x5e98bb+_0x2fb94d(0x1bc):_0x2fb94d(0x1a5);try{const _0x21e3a5=await withProgressSpinner(_0x18ba8c,async _0x9b9b47=>{const _0x116159=_0x2fb94d,_0x835e54=await _0x27e84c[_0x116159(0x1c4)][_0x116159(0x195)](_0x163f00,{'catalog':_0x2c6977,'schema':_0x414ddd,'onJobId':_0x44234e=>{const _0x1459d2=_0x116159;_0x9b9b47[_0x1459d2(0x199)](_0x44234e);},'onProgress':_0x4e586b=>{const _0x257cc7=_0x116159;_0x9b9b47[_0x257cc7(0x1c8)]('Executing\x20query\x20['+_0x4e586b[_0x257cc7(0x1a4)]+']'),_0x9b9b47[_0x257cc7(0x1c1)](formatRows(_0x4e586b['processedRows'])+_0x257cc7(0x193)+_0x4e586b[_0x257cc7(0x1ab)]+'/'+_0x4e586b['totalSplits']+_0x257cc7(0x1b3));}});return _0x835e54;},{'verbose':_0x4b5ecf[_0x2fb94d(0x1c7)]}),_0x89c618=_0x21e3a5[_0x2fb94d(0x1ba)],_0x3c5422=_0x89c618[_0x2fb94d(0x1b7)]?_0x2fb94d(0x191)+_0x89c618[_0x2fb94d(0x1b7)]+']':'',_0x2fbe0e=_0x25453b?_0x2fb94d(0x1b8)+_0x54812b+'/'+_0x5e98bb+_0x2fb94d(0x1b4):'';console[_0x2fb94d(0x1b9)]('✔\x20'+_0x2fbe0e+_0x2fb94d(0x1c5)+formatRows(_0x89c618[_0x2fb94d(0x1bd)]['processedRows'])+_0x2fb94d(0x193)+(_0x2fb94d(0x1c2)+formatElapsed(_0x89c618[_0x2fb94d(0x1bd)][_0x2fb94d(0x1b1)])+_0x3c5422));if(_0x25453b&&_0xb51855){const _0x240a89=resolveOutputOptions(_0x325c2d),_0x2c7a7b=await formatQueryOutput(_0x89c618,_0x240a89);_0x33630e['push'](_0x2c7a7b);}else await handleQueryOutput(_0x89c618,_0x325c2d);}catch(_0x352ac5){const _0x853e5b=_0x25453b?_0x2fb94d(0x1b8)+_0x54812b+'/'+_0x5e98bb+':\x0a':'',_0xae3ee1=_0x352ac5 instanceof SDKError?_0x352ac5[_0x2fb94d(0x1a7)]:_0x352ac5['message'];return console['error'](''+_0x853e5b+_0xae3ee1),0x1;}}if(_0x1f16c4[_0x2fb94d(0x1af)]>0x1&&_0xb51855&&_0x33630e[_0x2fb94d(0x1af)]>0x0){const _0x161468=_0x33630e['join']('\x0a');writeFileSync(_0x4b5ecf[_0x2fb94d(0x1a6)],_0x161468),console['error'](_0x2fb94d(0x1bb)+_0x4b5ecf[_0x2fb94d(0x1a6)]);}return 0x0;}catch(_0x599af0){throw _0x599af0;}}[a35_0x5cc773(0x19b)](_0x342eda){const _0x433059=a35_0x5cc773,_0x5653c0=_0x342eda[_0x433059(0x194)][0x0],_0x4fedd6=_0x342eda[_0x433059(0x1c0)][_0x433059(0x1be)];if(!_0x5653c0&&!_0x4fedd6)return _0x433059(0x1bf);if(_0x5653c0&&_0x4fedd6)return _0x433059(0x1ad);return undefined;}}
1
+ const a35_0x43812e=a35_0x11aa;(function(_0x34cf99,_0xb22fda){const _0x126ad3=a35_0x11aa,_0xc7a996=_0x34cf99();while(!![]){try{const _0x46af30=-parseInt(_0x126ad3(0xcf))/0x1+parseInt(_0x126ad3(0xf0))/0x2+parseInt(_0x126ad3(0xfd))/0x3+parseInt(_0x126ad3(0xfc))/0x4*(-parseInt(_0x126ad3(0xef))/0x5)+parseInt(_0x126ad3(0xed))/0x6*(parseInt(_0x126ad3(0xeb))/0x7)+-parseInt(_0x126ad3(0xd4))/0x8*(parseInt(_0x126ad3(0x100))/0x9)+parseInt(_0x126ad3(0xdd))/0xa;if(_0x46af30===_0xb22fda)break;else _0xc7a996['push'](_0xc7a996['shift']());}catch(_0x473dc6){_0xc7a996['push'](_0xc7a996['shift']());}}}(a35_0x3740,0xce368));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a35_0x11aa(_0x88a022,_0x4f35e5){_0x88a022=_0x88a022-0xce;const _0x374069=a35_0x3740();let _0x11aa7e=_0x374069[_0x88a022];return _0x11aa7e;}function a35_0x3740(){const _0xe2ecf9=['837521slDRWA','jobId','elapsedTimeMillis','No\x20SQL\x20provided','Catalog:\x20','8KBULJQ','...','name','Run\x20Trino\x20queries\x20(streaming)','database','\x20splits','processedRows','error','query','11327180NrkfRH','length','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','Statement\x20','Schema:\x20','join','totalSplits','\x0aAll\x20results\x20saved\x20to\x20','message','SQL:\x20','description','completedSplits','args','push','7ESQOiT','\x20rows\x20','7403586Psitgb','Query\x20completed:\x20Processed\x20','665555YoSaFQ','121762NmbqJB','output','catalog','Executing\x20statement\x20','\x20[Job\x20ID:\x20','stats','file','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','state','options','setExtra','Executing\x20query\x20[','20vGsdSR','1609293oXROhQ','verbose','in\x20','5546133GcBohk','site','information_schema','validate','execute'];a35_0x3740=function(){return _0xe2ecf9;};return a35_0x3740();}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_0x43812e(0xd6)]=a35_0x43812e(0xdc);[a35_0x43812e(0xe7)]=a35_0x43812e(0xd7);async[a35_0x43812e(0xce)](_0x41c9ba){const _0x2dce85=a35_0x43812e,{options:_0x52c91e,args:_0x439760,tdx:_0x3ecf65}=_0x41c9ba,_0x4dc213={..._0x52c91e,'limitStructuredFormats':!![]},_0x4f7685=_0x439760[0x0],_0x12534c=_0x52c91e[_0x2dce85(0xf6)];let _0x55beca;try{if(_0x12534c)_0x55beca=readSqlStatementsFromFile(_0x12534c);else{if(_0x4f7685==='-')_0x55beca=await readSqlStatementsFromStdin();else{if(_0x4f7685&&isSqlFilePath(_0x4f7685))_0x55beca=readSqlStatementsFromFile(_0x4f7685);else{if(_0x4f7685)_0x55beca=splitSqlStatements(_0x4f7685);else throw new Error(_0x2dce85(0xd2));}}}}catch(_0x150e93){return console[_0x2dce85(0xdb)]('Error:\x20'+_0x150e93[_0x2dce85(0xe5)]),0x1;}const _0x57abdd=_0x52c91e[_0x2dce85(0xd8)]||_0x2dce85(0x102),_0x238aa9=_0x52c91e[_0x2dce85(0xf2)];try{const _0x37b24d=[],_0x122b53=!!_0x52c91e[_0x2dce85(0xf1)];for(let _0x9e2764=0x0;_0x9e2764<_0x55beca[_0x2dce85(0xde)];_0x9e2764++){const _0x35c030=_0x55beca[_0x9e2764],_0x3b3da3=_0x9e2764+0x1,_0x10b594=_0x55beca['length'],_0xfb251f=_0x10b594>0x1;_0x52c91e[_0x2dce85(0xfe)]&&(console['error']('\x0a'+(_0xfb251f?'Statement\x20'+_0x3b3da3+'/'+_0x10b594+':':'')),console[_0x2dce85(0xdb)]('Site:\x20'+_0x52c91e[_0x2dce85(0x101)]),console[_0x2dce85(0xdb)](_0x2dce85(0xd3)+(_0x238aa9||'td')),console[_0x2dce85(0xdb)](_0x2dce85(0xe1)+_0x57abdd),console[_0x2dce85(0xdb)](_0x2dce85(0xe6)+_0x35c030));const _0x3e0135=_0xfb251f?_0x2dce85(0xf3)+_0x3b3da3+'/'+_0x10b594+_0x2dce85(0xd5):'Executing\x20query...';try{const _0x2061fa=await withProgressSpinner(_0x3e0135,async _0x91749=>{const _0x6aeb5f=_0x2dce85,_0x51e1d6=await _0x3ecf65['query'][_0x6aeb5f(0xce)](_0x35c030,{'catalog':_0x238aa9,'schema':_0x57abdd,'onJobId':_0x3c400d=>{_0x91749['setJobId'](_0x3c400d);},'onProgress':_0x52b80c=>{const _0x4c54a9=_0x6aeb5f;_0x91749['setPhase'](_0x4c54a9(0xfb)+_0x52b80c[_0x4c54a9(0xf8)]+']'),_0x91749[_0x4c54a9(0xfa)](formatRows(_0x52b80c[_0x4c54a9(0xda)])+'\x20rows\x20'+_0x52b80c[_0x4c54a9(0xe8)]+'/'+_0x52b80c[_0x4c54a9(0xe3)]+_0x4c54a9(0xd9));}});return _0x51e1d6;},{'verbose':_0x52c91e[_0x2dce85(0xfe)]}),_0x1ef303=_0x2061fa['data'],_0xf0ee0=_0x1ef303[_0x2dce85(0xd0)]?_0x2dce85(0xf4)+_0x1ef303[_0x2dce85(0xd0)]+']':'',_0x48cd50=_0xfb251f?'Statement\x20'+_0x3b3da3+'/'+_0x10b594+'\x20-\x20':'';console['error']('✔\x20'+_0x48cd50+_0x2dce85(0xee)+formatRows(_0x1ef303[_0x2dce85(0xf5)][_0x2dce85(0xda)])+_0x2dce85(0xec)+(_0x2dce85(0xff)+formatElapsed(_0x1ef303['stats'][_0x2dce85(0xd1)])+_0xf0ee0));if(_0xfb251f&&_0x122b53){const _0x47a8c3=resolveOutputOptions(_0x4dc213),_0x1fcc18=await formatQueryOutput(_0x1ef303,_0x47a8c3);_0x37b24d[_0x2dce85(0xea)](_0x1fcc18);}else await handleQueryOutput(_0x1ef303,_0x4dc213);}catch(_0x427f47){const _0x40995a=_0xfb251f?_0x2dce85(0xe0)+_0x3b3da3+'/'+_0x10b594+':\x0a':'',_0x5aa6f6=_0x427f47 instanceof SDKError?_0x427f47['originalMessage']:_0x427f47[_0x2dce85(0xe5)];return console[_0x2dce85(0xdb)](''+_0x40995a+_0x5aa6f6),0x1;}}if(_0x55beca[_0x2dce85(0xde)]>0x1&&_0x122b53&&_0x37b24d['length']>0x0){const _0x5d7c68=_0x37b24d[_0x2dce85(0xe2)]('\x0a');writeFileSync(_0x52c91e[_0x2dce85(0xf1)],_0x5d7c68),console[_0x2dce85(0xdb)](_0x2dce85(0xe4)+_0x52c91e[_0x2dce85(0xf1)]);}return 0x0;}catch(_0x441c7f){throw _0x441c7f;}}[a35_0x43812e(0x103)](_0x66de6){const _0x54a74d=a35_0x43812e,_0x2324a7=_0x66de6[_0x54a74d(0xe9)][0x0],_0xe89f84=_0x66de6[_0x54a74d(0xf9)]['file'];if(!_0x2324a7&&!_0xe89f84)return _0x54a74d(0xdf);if(_0x2324a7&&_0xe89f84)return _0x54a74d(0xf7);return undefined;}}
@@ -1 +1 @@
1
- function a36_0xc21e(_0xc2438a,_0x3d1ddb){_0xc2438a=_0xc2438a-0x1c3;const _0x4b83f3=a36_0x4b83();let _0xc21edb=_0x4b83f3[_0xc2438a];return _0xc21edb;}const a36_0x1bfbb1=a36_0xc21e;(function(_0x2fc2cc,_0x4ee7ec){const _0x162b3d=a36_0xc21e,_0x53aadd=_0x2fc2cc();while(!![]){try{const _0x2e5482=-parseInt(_0x162b3d(0x1c4))/0x1*(-parseInt(_0x162b3d(0x233))/0x2)+parseInt(_0x162b3d(0x258))/0x3*(-parseInt(_0x162b3d(0x20d))/0x4)+-parseInt(_0x162b3d(0x227))/0x5*(-parseInt(_0x162b3d(0x222))/0x6)+parseInt(_0x162b3d(0x1fd))/0x7+parseInt(_0x162b3d(0x254))/0x8*(-parseInt(_0x162b3d(0x218))/0x9)+-parseInt(_0x162b3d(0x1e0))/0xa*(-parseInt(_0x162b3d(0x1f1))/0xb)+-parseInt(_0x162b3d(0x251))/0xc;if(_0x2e5482===_0x4ee7ec)break;else _0x53aadd['push'](_0x53aadd['shift']());}catch(_0x726390){_0x53aadd['push'](_0x53aadd['shift']());}}}(a36_0x4b83,0xc8a3c));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';function a36_0x4b83(){const _0x21639f=['Update\x20a\x20scheduled\x20query','log','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','Found\x20','delay','name','\x20(use\x20--limit\x20to\x20see\x20more)','padEnd','from','join','listQueries','Searching\x20scheduled\x20queries\x20matching\x20\x22','\x20schedules','red','cyan','last_job','engine_version','options','toLocaleDateString','green','json','query','cron','trim','max','Run\x20a\x20scheduled\x20query\x20immediately','24208332WQoekl','nextRun','engineVersion','8ZlEfGP','(unnamed)','d\x20ago','start_at','23811GDBAXx','count','user','238PEerXr','history','user_name','updated_at','success','data','trino','in\x20','schedule:run','\x20execution','retryLimit','schedule:history','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','schedules','entries','round','\x20\x20Cron:\x20','/app/queries/editor?queryId=','tsv','...','lastRun','priority','Schedule\x20run\x20submitted:\x20','utf-8','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','\x20scheduled\x20quer','\x22...','format','149570bCaWrm','update','Getting\x20schedule\x20details...','statusIcon','abs','Running\x20schedule:\x20','keys','executing_user_id','file','verbose','substring','scheduled_at','schedule:create','\x20created','\x20\x20Job\x20ID:\x20','Schedule\x20updated:\x20','dim','671PfwJFl','result','Running\x20schedule...','next_run_at','type','\x20\x20→\x20','limit','database','execute','Updating\x20schedule...','description','retry_limit','10425289ZtSQen','table','validate','ies','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','never','Creating\x20schedule...','length','Failed\x20to\x20read\x20file:\x20','time','jobs','repeat','end_at','m\x20ago','Query\x20file\x20is\x20empty','output','648qaarMT','args','queries','Cancelled','\x20(showing\x20','Show\x20schedule\x20details','num','queryUrl','map','schedule:show','Deleting\x20schedule...','1461546zyxoWu','\x20\x20Num:\x20','ended_at','Schedule\x20deleted:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','INVALID_ARGUMENT','Updating\x20schedule:\x20','just\x20now','\x20\x20Type:\x20','getTime','66hvvYqe','error','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','h\x20ago','yes','677755CaXgcU','soon','Getting\x20schedule\x20history...','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','create','list','Showing\x20first\x20','status','job_id','created_at','has_next_page','3316qbLMTL','jsonl','timezone','No\x20scheduled\x20queries\x20found'];a36_0x4b83=function(){return _0x21639f;};return a36_0x4b83();}import a36_0x29eb2d from'chalk';function formatRelativeTime(_0x5a6046){const _0x57680d=a36_0xc21e,_0x1c792b=new Date(_0x5a6046),_0x27fa3b=new Date(),_0x5e0d7a=_0x1c792b[_0x57680d(0x221)]()-_0x27fa3b['getTime'](),_0xfae46=Math[_0x57680d(0x1e4)](_0x5e0d7a)/0x3e8,_0xe0070d=_0x5e0d7a<0x0;if(_0xfae46<0x3c)return _0xe0070d?_0x57680d(0x21f):_0x57680d(0x228);else{if(_0xfae46<0xe10){const _0x58885b=Math[_0x57680d(0x1d3)](_0xfae46/0x3c);return _0xe0070d?_0x58885b+_0x57680d(0x20a):_0x57680d(0x1cb)+_0x58885b+'m';}else{if(_0xfae46<0x15180){const _0x57dd26=Math[_0x57680d(0x1d3)](_0xfae46/0xe10);return _0xe0070d?_0x57dd26+_0x57680d(0x225):'in\x20'+_0x57dd26+'h';}else{if(_0xfae46<0x93a80){const _0x554f48=Math[_0x57680d(0x1d3)](_0xfae46/0x15180);return _0xe0070d?_0x554f48+_0x57680d(0x256):_0x57680d(0x1cb)+_0x554f48+'d';}else return _0x1c792b[_0x57680d(0x249)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x1bfbb1(0x23c)]='schedule:list';[a36_0x1bfbb1(0x1fb)]='List\x20scheduled\x20queries';async[a36_0x1bfbb1(0x1f9)](_0xae4f08){const _0x233bbe=a36_0x1bfbb1,{options:_0xf88f5e,args:_0x3421d5,tdx:_0x1fc8ad}=_0xae4f08,_0x412052=resolveLimit(_0xf88f5e[_0x233bbe(0x1f7)],DEFAULT_DISPLAY_LIMIT),_0x27cfdd=_0x3421d5[0x0],_0x14ca99=_0x27cfdd?_0x233bbe(0x242)+_0x27cfdd+_0x233bbe(0x1de):'Listing\x20scheduled\x20queries...',_0x129229=await withSpinner(_0x14ca99,()=>_0x1fc8ad['schedules'][_0x233bbe(0x241)]({'limit':_0x412052,'scheduled':!![],'pattern':_0x27cfdd}),{'verbose':_0xf88f5e[_0x233bbe(0x1e9)]}),_0x9f94a6=_0x129229[_0x233bbe(0x1c9)][_0x233bbe(0x20f)],_0x16bd6d=_0x129229[_0x233bbe(0x1c9)]['pagination'][_0x233bbe(0x232)],_0x19bca=_0x27cfdd?'\x20matching\x20\x22'+_0x27cfdd+'\x22':'';_0x16bd6d?console['error'](_0x233bbe(0x22e)+_0x9f94a6[_0x233bbe(0x204)]+_0x233bbe(0x243)+_0x19bca+_0x233bbe(0x23d)):console[_0x233bbe(0x223)](_0x233bbe(0x23a)+_0x9f94a6['length']+_0x233bbe(0x1dd)+(_0x9f94a6['length']!==0x1?_0x233bbe(0x200):'y')+_0x19bca);if(_0xf88f5e[_0x233bbe(0x1df)]===_0x233bbe(0x24b)||_0xf88f5e[_0x233bbe(0x1df)]===_0x233bbe(0x234)||_0xf88f5e[_0x233bbe(0x1df)]===_0x233bbe(0x1fe)||_0xf88f5e[_0x233bbe(0x1df)]===_0x233bbe(0x1d6)){const _0x47cbff=_0x9f94a6[_0x233bbe(0x215)](_0x34b7b7=>({'id':_0x34b7b7['id'],'name':_0x34b7b7[_0x233bbe(0x23c)],'cron':_0x34b7b7[_0x233bbe(0x24d)],'database':_0x34b7b7[_0x233bbe(0x1f8)]?.[_0x233bbe(0x23c)],'type':_0x34b7b7[_0x233bbe(0x1f5)],'timezone':_0x34b7b7['time_zone'],'user_name':_0x34b7b7[_0x233bbe(0x1c3)]?.[_0x233bbe(0x23c)],'updated_at':_0x34b7b7[_0x233bbe(0x1c7)],'next_run_at':_0x34b7b7['next_run_at'],'last_job_status':_0x34b7b7['last_job']?.[_0x233bbe(0x22f)]}));await handleSDKOutput(_0x47cbff,_0xf88f5e);}else{if(_0x9f94a6[_0x233bbe(0x204)]===0x0)console[_0x233bbe(0x238)](_0x233bbe(0x236));else{const _0x49a8f8=_0xf88f5e['site'],_0x2dab15=_0x9f94a6[_0x233bbe(0x215)](_0x1abd67=>{const _0x163483=_0x233bbe,_0x52c892=_0x1abd67[_0x163483(0x246)]?.[_0x163483(0x22f)]?_0x1abd67[_0x163483(0x246)][_0x163483(0x22f)]===_0x163483(0x1c8)?'✓':'✗':'-',_0x204ca7=_0x1abd67['last_job']?.[_0x163483(0x21a)]?formatRelativeTime(_0x1abd67[_0x163483(0x246)][_0x163483(0x21a)]):_0x163483(0x202),_0x1847df=_0x1abd67[_0x163483(0x1f4)]?formatRelativeTime(_0x1abd67[_0x163483(0x1f4)]):'-',_0x231b68=_0x1abd67['cron']||'',_0x1c94da=_0x1abd67['name']||_0x163483(0x255),_0x260de1=getConsoleUrl(_0x49a8f8,_0x163483(0x1d5)+_0x1abd67['id']);return{'statusIcon':_0x52c892,'lastRun':_0x204ca7,'nextRun':_0x1847df,'cron':_0x231b68,'name':_0x1c94da,'queryUrl':_0x260de1,'status':_0x1abd67[_0x163483(0x246)]?.[_0x163483(0x22f)]};}),_0x460407=Math[_0x233bbe(0x24f)](..._0x2dab15['map'](_0x130696=>_0x130696[_0x233bbe(0x1d8)][_0x233bbe(0x204)])),_0x4b2c6a=Math[_0x233bbe(0x24f)](..._0x2dab15['map'](_0x54eaa0=>_0x54eaa0[_0x233bbe(0x252)][_0x233bbe(0x204)])),_0x8fac8b=Math[_0x233bbe(0x24f)](..._0x2dab15[_0x233bbe(0x215)](_0x43f015=>_0x43f015[_0x233bbe(0x24d)][_0x233bbe(0x204)])),_0x180282=_0x2dab15[_0x233bbe(0x215)](_0x390254=>{const _0x169354=_0x233bbe,_0x388886=_0x390254[_0x169354(0x22f)]===_0x169354(0x1c8)?a36_0x29eb2d[_0x169354(0x24a)](_0x390254[_0x169354(0x1e3)]):_0x390254[_0x169354(0x22f)]===_0x169354(0x223)?a36_0x29eb2d[_0x169354(0x244)](_0x390254['statusIcon']):a36_0x29eb2d[_0x169354(0x1f0)](_0x390254[_0x169354(0x1e3)]),_0x5a7cb7=_0x390254['lastRun']['padEnd'](_0x460407),_0x12f564=_0x390254[_0x169354(0x252)]['padEnd'](_0x4b2c6a),_0x5363c7=_0x390254['cron']?a36_0x29eb2d[_0x169354(0x245)](_0x390254['cron'][_0x169354(0x23e)](_0x8fac8b)):'\x20'[_0x169354(0x208)](_0x8fac8b),_0x5b69fc=hyperlink(_0x390254[_0x169354(0x23c)],_0x390254[_0x169354(0x214)]);return'📅\x20'+_0x388886+'\x20'+_0x5a7cb7+_0x169354(0x1f6)+_0x12f564+'\x20\x20'+_0x5363c7+'\x20\x20'+_0x5b69fc;});await writeOutput(_0x180282[_0x233bbe(0x240)]('\x0a'),_0xf88f5e[_0x233bbe(0x20c)],_0x233bbe(0x22d));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x1bfbb1(0x23c)]=a36_0x1bfbb1(0x216);[a36_0x1bfbb1(0x1fb)]=a36_0x1bfbb1(0x212);[a36_0x1bfbb1(0x1ff)](_0x17bc54){const _0x4309e3=a36_0x1bfbb1,_0x2656e1=_0x17bc54['args'][0x0];if(!_0x2656e1)return _0x4309e3(0x1d0);return undefined;}async[a36_0x1bfbb1(0x1f9)](_0x4b2bf8){const _0x299c78=a36_0x1bfbb1,{options:_0x1d21e3,args:_0x45027a,tdx:_0x47abfb}=_0x4b2bf8,_0x420dc8=_0x45027a[0x0],_0x19e188=await withSpinner(_0x299c78(0x1e2),()=>_0x47abfb[_0x299c78(0x1d1)]['show'](_0x420dc8),{'verbose':_0x1d21e3['verbose']}),_0x1acd6a=_0x19e188[_0x299c78(0x1c9)],_0x5ce681={'name':_0x1acd6a[_0x299c78(0x23c)],'cron':_0x1acd6a[_0x299c78(0x24d)],'database':_0x1acd6a[_0x299c78(0x1f8)],'type':_0x1acd6a[_0x299c78(0x1f5)],'timezone':_0x1acd6a['timezone'],'user_name':_0x1acd6a[_0x299c78(0x1c6)],'created_at':_0x1acd6a[_0x299c78(0x231)],'engine_version':_0x1acd6a[_0x299c78(0x247)],'executing_user_id':_0x1acd6a[_0x299c78(0x1e7)],'query':_0x1acd6a['query'],'delay':_0x1acd6a[_0x299c78(0x23b)],'priority':_0x1acd6a[_0x299c78(0x1d9)],'retry_limit':_0x1acd6a[_0x299c78(0x1fc)],..._0x1acd6a['result']&&{'result':_0x1acd6a['result']}};return await handleSingleObjectOutput(_0x5ce681,_0x1d21e3),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']=a36_0x1bfbb1(0x1ec);[a36_0x1bfbb1(0x1fb)]='Create\x20a\x20scheduled\x20query';[a36_0x1bfbb1(0x1ff)](_0x3718e8){const _0x194cb9=a36_0x1bfbb1,_0x3504e7=_0x3718e8[_0x194cb9(0x20e)][0x0];if(!_0x3504e7)return _0x194cb9(0x1dc);const _0x325b70=_0x3718e8[_0x194cb9(0x248)];if(!_0x325b70[_0x194cb9(0x1f8)])return _0x194cb9(0x239);return undefined;}async[a36_0x1bfbb1(0x1f9)](_0x1a70d0){const _0x89b3d=a36_0x1bfbb1,{options:_0x5281f6,args:_0x30446f,tdx:_0x587785}=_0x1a70d0,_0x10e224=_0x30446f[0x0],_0xd01be2=_0x5281f6,_0x565096=_0xd01be2[_0x89b3d(0x1f8)],_0x5bbfe6=_0xd01be2[_0x89b3d(0x1e8)],_0x25bdbf=_0xd01be2['type']||_0x89b3d(0x1ca);let _0x5b9442;try{_0x5b9442=readFileSync(_0x5bbfe6,'utf-8')[_0x89b3d(0x24e)]();}catch(_0x234e87){throw new SDKError(ErrorCode[_0x89b3d(0x21d)],_0x89b3d(0x205)+_0x5bbfe6,_0x234e87 instanceof Error?_0x234e87:undefined);}if(!_0x5b9442)throw new SDKError(ErrorCode[_0x89b3d(0x21d)],_0x89b3d(0x20b));const _0xe274ff={'database':_0x565096,'query':_0x5b9442,'type':_0x25bdbf};if(_0xd01be2['cron'])_0xe274ff[_0x89b3d(0x24d)]=_0xd01be2[_0x89b3d(0x24d)];if(_0xd01be2[_0x89b3d(0x235)])_0xe274ff['timezone']=_0xd01be2[_0x89b3d(0x235)];if(_0xd01be2[_0x89b3d(0x23b)]!==undefined)_0xe274ff[_0x89b3d(0x23b)]=Number(_0xd01be2[_0x89b3d(0x23b)]);if(_0xd01be2['priority']!==undefined)_0xe274ff[_0x89b3d(0x1d9)]=Number(_0xd01be2[_0x89b3d(0x1d9)]);if(_0xd01be2[_0x89b3d(0x1ce)]!==undefined)_0xe274ff[_0x89b3d(0x1fc)]=Number(_0xd01be2[_0x89b3d(0x1ce)]);if(_0xd01be2[_0x89b3d(0x253)])_0xe274ff[_0x89b3d(0x247)]=_0xd01be2['engineVersion'];if(_0xd01be2['result'])_0xe274ff[_0x89b3d(0x1f2)]=_0xd01be2[_0x89b3d(0x1f2)];if(_0x5281f6['verbose']){console[_0x89b3d(0x223)]('Creating\x20schedule:\x20'+_0x10e224),console['error']('\x20\x20Database:\x20'+_0x565096),console['error'](_0x89b3d(0x220)+_0x25bdbf);if(_0xe274ff[_0x89b3d(0x24d)])console[_0x89b3d(0x223)](_0x89b3d(0x1d4)+_0xe274ff[_0x89b3d(0x24d)]);if(_0xe274ff['timezone'])console[_0x89b3d(0x223)]('\x20\x20Timezone:\x20'+_0xe274ff[_0x89b3d(0x235)]);}const _0x4c6ca5=await withSpinner(_0x89b3d(0x203),()=>_0x587785['schedules'][_0x89b3d(0x22c)](_0x10e224,_0xe274ff),{'verbose':_0x5281f6[_0x89b3d(0x1e9)]});return console[_0x89b3d(0x223)]('Schedule\x20created:\x20'+_0x4c6ca5[_0x89b3d(0x1c9)][_0x89b3d(0x23c)]),await handleSingleObjectOutput(_0x4c6ca5['data'],_0x5281f6),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x1bfbb1(0x23c)]='schedule:update';[a36_0x1bfbb1(0x1fb)]=a36_0x1bfbb1(0x237);[a36_0x1bfbb1(0x1ff)](_0x48e825){const _0x120a4e=a36_0x1bfbb1,_0x3a77ea=_0x48e825[_0x120a4e(0x20e)][0x0];if(!_0x3a77ea)return _0x120a4e(0x21c);return undefined;}async['execute'](_0x40cac3){const _0xffdb06=a36_0x1bfbb1,{options:_0x2fc2e1,args:_0x4198d7,tdx:_0x5d5a5e}=_0x40cac3,_0x45bf62=_0x4198d7[0x0],_0x294683=_0x2fc2e1,_0x3365ef={};if(_0x294683[_0xffdb06(0x1f8)])_0x3365ef['database']=_0x294683[_0xffdb06(0x1f8)];if(_0x294683[_0xffdb06(0x1f5)])_0x3365ef[_0xffdb06(0x1f5)]=_0x294683[_0xffdb06(0x1f5)];if(_0x294683[_0xffdb06(0x24d)])_0x3365ef[_0xffdb06(0x24d)]=_0x294683[_0xffdb06(0x24d)];if(_0x294683[_0xffdb06(0x235)])_0x3365ef[_0xffdb06(0x235)]=_0x294683['timezone'];if(_0x294683[_0xffdb06(0x23b)]!==undefined)_0x3365ef[_0xffdb06(0x23b)]=Number(_0x294683[_0xffdb06(0x23b)]);if(_0x294683[_0xffdb06(0x1d9)]!==undefined)_0x3365ef[_0xffdb06(0x1d9)]=Number(_0x294683['priority']);if(_0x294683[_0xffdb06(0x1ce)]!==undefined)_0x3365ef['retry_limit']=Number(_0x294683['retryLimit']);if(_0x294683[_0xffdb06(0x253)])_0x3365ef['engine_version']=_0x294683[_0xffdb06(0x253)];if(_0x294683['result'])_0x3365ef[_0xffdb06(0x1f2)]=_0x294683[_0xffdb06(0x1f2)];if(_0x294683[_0xffdb06(0x1e8)])try{_0x3365ef[_0xffdb06(0x24c)]=readFileSync(_0x294683[_0xffdb06(0x1e8)],_0xffdb06(0x1db))['trim']();}catch(_0x1f6add){throw new SDKError(ErrorCode[_0xffdb06(0x21d)],_0xffdb06(0x205)+_0x294683[_0xffdb06(0x1e8)],_0x1f6add instanceof Error?_0x1f6add:undefined);}if(Object[_0xffdb06(0x1e6)](_0x3365ef)['length']===0x0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update');if(_0x2fc2e1[_0xffdb06(0x1e9)]){console[_0xffdb06(0x223)](_0xffdb06(0x21e)+_0x45bf62);for(const [_0xa17c97,_0x1c1f65]of Object[_0xffdb06(0x1d2)](_0x3365ef)){_0xa17c97===_0xffdb06(0x24c)?console[_0xffdb06(0x223)]('\x20\x20'+_0xa17c97+':\x20'+_0x1c1f65[_0xffdb06(0x1ea)](0x0,0x32)+_0xffdb06(0x1d7)):console[_0xffdb06(0x223)]('\x20\x20'+_0xa17c97+':\x20'+_0x1c1f65);}}const _0x4f1cd2=await withSpinner(_0xffdb06(0x1fa),()=>_0x5d5a5e[_0xffdb06(0x1d1)][_0xffdb06(0x1e1)](_0x45bf62,_0x3365ef),{'verbose':_0x2fc2e1['verbose']});return console['error'](_0xffdb06(0x1ef)+_0x4f1cd2['data'][_0xffdb06(0x23c)]),await handleSingleObjectOutput(_0x4f1cd2[_0xffdb06(0x1c9)],_0x2fc2e1),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x1bfbb1(0x23c)]='schedule:delete';[a36_0x1bfbb1(0x1fb)]='Delete\x20a\x20scheduled\x20query';[a36_0x1bfbb1(0x1ff)](_0x3b78f8){const _0x5c9d67=a36_0x1bfbb1,_0x49cf36=_0x3b78f8[_0x5c9d67(0x20e)][0x0];if(!_0x49cf36)return _0x5c9d67(0x22b);return undefined;}async[a36_0x1bfbb1(0x1f9)](_0x5457f3){const _0x2558b1=a36_0x1bfbb1,{options:_0x369d5e,args:_0x27bc66,tdx:_0x33db9c}=_0x5457f3,_0x4f075d=_0x27bc66[0x0];if(!_0x369d5e[_0x2558b1(0x226)]){const _0x2c03bd=await confirm(_0x2558b1(0x22a)+_0x4f075d+'\x22?');if(!_0x2c03bd)return console[_0x2558b1(0x223)](_0x2558b1(0x210)),0x0;}const _0x3a5002=await withSpinner(_0x2558b1(0x217),()=>_0x33db9c[_0x2558b1(0x1d1)]['delete'](_0x4f075d),{'verbose':_0x369d5e['verbose']});return console[_0x2558b1(0x223)](_0x2558b1(0x21b)+_0x3a5002['data']['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{['name']=a36_0x1bfbb1(0x1cc);['description']=a36_0x1bfbb1(0x250);[a36_0x1bfbb1(0x1ff)](_0x2e1d3d){const _0x591a7a=a36_0x1bfbb1,_0x265435=_0x2e1d3d['args'][0x0];if(!_0x265435)return _0x591a7a(0x224);return undefined;}async[a36_0x1bfbb1(0x1f9)](_0x320043){const _0x577925=a36_0x1bfbb1,{options:_0xc76f0e,args:_0x38b736,tdx:_0x6cc2d7}=_0x320043,_0x486f05=_0x38b736[0x0],_0x439b82=_0xc76f0e,_0x4b7a09=_0x439b82[_0x577925(0x206)],_0x6583f6=_0x439b82[_0x577925(0x213)]!==undefined?Number(_0x439b82[_0x577925(0x213)]):undefined;if(_0xc76f0e[_0x577925(0x1e9)]){console[_0x577925(0x223)](_0x577925(0x1e5)+_0x486f05);if(_0x4b7a09)console[_0x577925(0x223)]('\x20\x20Time:\x20'+_0x4b7a09);if(_0x6583f6)console[_0x577925(0x223)](_0x577925(0x219)+_0x6583f6);}const _0x4cffdb=await withSpinner(_0x577925(0x1f3),()=>_0x6cc2d7[_0x577925(0x1d1)]['run'](_0x486f05,{'time':_0x4b7a09,'num':_0x6583f6}),{'verbose':_0xc76f0e[_0x577925(0x1e9)]}),_0xc62cc3=_0x4cffdb[_0x577925(0x1c9)][_0x577925(0x207)];console[_0x577925(0x223)](_0x577925(0x1da)+_0xc62cc3[_0x577925(0x204)]+'\x20job'+(_0xc62cc3[_0x577925(0x204)]!==0x1?'s':'')+_0x577925(0x1ed));for(const _0x24669b of _0xc62cc3){console['error'](_0x577925(0x1ee)+_0x24669b[_0x577925(0x230)]);}return await handleSDKOutput(_0xc62cc3,_0xc76f0e),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{['name']=a36_0x1bfbb1(0x1cf);[a36_0x1bfbb1(0x1fb)]='Show\x20schedule\x20execution\x20history';['validate'](_0x148ebb){const _0x580447=a36_0x1bfbb1,_0x14a9ed=_0x148ebb['args'][0x0];if(!_0x14a9ed)return _0x580447(0x201);return undefined;}async[a36_0x1bfbb1(0x1f9)](_0x4aec27){const _0x25a4ca=a36_0x1bfbb1,{options:_0x5d6401,args:_0x332de3,tdx:_0x5d6d73}=_0x4aec27,_0x1308ce=_0x332de3[0x0],_0x41a568=_0x5d6401,_0x374499=_0x41a568[_0x25a4ca(0x23f)]!==undefined?Number(_0x41a568[_0x25a4ca(0x23f)]):undefined,_0x3fcb95=_0x41a568['to']!==undefined?Number(_0x41a568['to']):undefined,_0x4078a8=await withSpinner(_0x25a4ca(0x229),()=>_0x5d6d73[_0x25a4ca(0x1d1)][_0x25a4ca(0x1c5)](_0x1308ce,{'from':_0x374499,'to':_0x3fcb95}),{'verbose':_0x5d6401[_0x25a4ca(0x1e9)]}),_0x1e5cb4=_0x4078a8[_0x25a4ca(0x1c9)];console[_0x25a4ca(0x223)](_0x25a4ca(0x23a)+_0x1e5cb4['count']+_0x25a4ca(0x1cd)+(_0x1e5cb4[_0x25a4ca(0x259)]!==0x1?'s':'')+_0x25a4ca(0x211)+_0x1e5cb4[_0x25a4ca(0x23f)]+'-'+_0x1e5cb4['to']+')');const _0xb5e5b9=_0x1e5cb4[_0x25a4ca(0x1c5)][_0x25a4ca(0x215)](_0x3baa90=>({'job_id':_0x3baa90[_0x25a4ca(0x230)],'type':_0x3baa90['type'],'status':_0x3baa90[_0x25a4ca(0x22f)],'scheduled_at':_0x3baa90[_0x25a4ca(0x1eb)],'created_at':_0x3baa90['created_at'],'start_at':_0x3baa90[_0x25a4ca(0x257)],'end_at':_0x3baa90[_0x25a4ca(0x209)]}));return await handleSDKOutput(_0xb5e5b9,_0x5d6401),0x0;}}
1
+ function a36_0x593b(_0x1c5f01,_0x86eed9){_0x1c5f01=_0x1c5f01-0x172;const _0x3c9286=a36_0x3c92();let _0x593b66=_0x3c9286[_0x1c5f01];return _0x593b66;}const a36_0x1f517d=a36_0x593b;(function(_0x537b38,_0x51e50b){const _0x7bc4c6=a36_0x593b,_0x379489=_0x537b38();while(!![]){try{const _0x1347cf=-parseInt(_0x7bc4c6(0x1b4))/0x1+-parseInt(_0x7bc4c6(0x1e2))/0x2+-parseInt(_0x7bc4c6(0x1c1))/0x3*(-parseInt(_0x7bc4c6(0x1ab))/0x4)+parseInt(_0x7bc4c6(0x1c6))/0x5+parseInt(_0x7bc4c6(0x192))/0x6+-parseInt(_0x7bc4c6(0x1ae))/0x7+-parseInt(_0x7bc4c6(0x1c8))/0x8;if(_0x1347cf===_0x51e50b)break;else _0x379489['push'](_0x379489['shift']());}catch(_0x35381a){_0x379489['push'](_0x379489['shift']());}}}(a36_0x3c92,0xcd660));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a36_0x3c92(){const _0x1b9ac4=['green','toLocaleDateString','last_job','job_id','ended_at','trino','12nOqngt','lastRun','(unnamed)','format','Schedule\x20run\x20submitted:\x20','5601645hsqzlB','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','15648360HEhTfH','Show\x20schedule\x20execution\x20history','schedules','Running\x20schedule...','\x20created','\x20\x20Cron:\x20','tsv','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','schedule:show','substring','cyan','getTime','Update\x20a\x20scheduled\x20query','\x20\x20Time:\x20','INVALID_ARGUMENT','Schedule\x20updated:\x20','update','limit','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','timezone','trim','\x20\x20Timezone:\x20','entries','type','never','engine_version','634438cNJDpN','created_at','end_at','file','count','status','validate','pagination','map','retryLimit','history','\x22...','site','schedule:update','red','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','Updating\x20schedule:\x20','Running\x20schedule:\x20','json','name','repeat','Show\x20schedule\x20details','user','Schedule\x20created:\x20','time','Failed\x20to\x20read\x20file:\x20','queries','schedule:create','updated_at','No\x20scheduled\x20queries\x20found','utf-8','yes','output','num','priority','engineVersion','user_name','round','from','\x20\x20Num:\x20','nextRun','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','Getting\x20schedule\x20details...','verbose','Deleting\x20schedule...','delay','\x20\x20Database:\x20','padEnd','error','options','statusIcon','abs','schedule:list','args','Schedule\x20deleted:\x20','jsonl','success','ies','jobs','Run\x20a\x20scheduled\x20query\x20immediately','start_at','soon','9455436oukpmA','just\x20now','cron','description','data','result','schedule:delete','schedule:run','\x20schedules','query','Found\x20','\x20(use\x20--limit\x20to\x20see\x20more)','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','\x20\x20Type:\x20','Listing\x20scheduled\x20queries...','execute','Cancelled','retry_limit','\x20matching\x20\x22','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','Create\x20a\x20scheduled\x20query','\x20job','in\x20','d\x20ago','next_run_at','934204rLbnuQ','\x20execution','database','3599477uNzURF','show','table','has_next_page','length','dim','1652EtrMSY','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','\x20\x20Job\x20ID:\x20','keys','\x20\x20→\x20','listQueries','max'];a36_0x3c92=function(){return _0x1b9ac4;};return a36_0x3c92();}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_0x3928a5 from'chalk';function formatRelativeTime(_0x2ed3dc){const _0x66c91b=a36_0x593b,_0x5b419a=new Date(_0x2ed3dc),_0x5aceca=new Date(),_0x2eb4e5=_0x5b419a[_0x66c91b(0x1d3)]()-_0x5aceca[_0x66c91b(0x1d3)](),_0x401b16=Math[_0x66c91b(0x187)](_0x2eb4e5)/0x3e8,_0x45e0c5=_0x2eb4e5<0x0;if(_0x401b16<0x3c)return _0x45e0c5?_0x66c91b(0x193):_0x66c91b(0x191);else{if(_0x401b16<0xe10){const _0x589176=Math[_0x66c91b(0x179)](_0x401b16/0x3c);return _0x45e0c5?_0x589176+'m\x20ago':_0x66c91b(0x1a8)+_0x589176+'m';}else{if(_0x401b16<0x15180){const _0x94b26a=Math[_0x66c91b(0x179)](_0x401b16/0xe10);return _0x45e0c5?_0x94b26a+'h\x20ago':_0x66c91b(0x1a8)+_0x94b26a+'h';}else{if(_0x401b16<0x93a80){const _0x34a5fa=Math[_0x66c91b(0x179)](_0x401b16/0x15180);return _0x45e0c5?_0x34a5fa+_0x66c91b(0x1a9):_0x66c91b(0x1a8)+_0x34a5fa+'d';}else return _0x5b419a[_0x66c91b(0x1bc)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x1f517d(0x1f5)]=a36_0x1f517d(0x188);[a36_0x1f517d(0x195)]='List\x20scheduled\x20queries';async[a36_0x1f517d(0x1a1)](_0x44045b){const _0x4524ee=a36_0x1f517d,{options:_0x3c357e,args:_0x59d2ed,tdx:_0x2810da}=_0x44045b,_0xa0c91a=resolveLimit(_0x3c357e[_0x4524ee(0x1d9)],DEFAULT_DISPLAY_LIMIT),_0x78841c=_0x59d2ed[0x0],_0x2d54cf=_0x78841c?'Searching\x20scheduled\x20queries\x20matching\x20\x22'+_0x78841c+_0x4524ee(0x1ed):_0x4524ee(0x1a0),_0x527f02=await withSpinner(_0x2d54cf,()=>_0x2810da['schedules'][_0x4524ee(0x1b9)]({'limit':_0xa0c91a,'scheduled':!![],'pattern':_0x78841c}),{'verbose':_0x3c357e[_0x4524ee(0x17f)]}),_0x5db7ac=_0x527f02['data'][_0x4524ee(0x1fc)],_0x309d2c=_0x527f02['data'][_0x4524ee(0x1e9)][_0x4524ee(0x1b1)],_0x4afb01=_0x78841c?_0x4524ee(0x1a4)+_0x78841c+'\x22':'';_0x309d2c?console[_0x4524ee(0x184)]('Showing\x20first\x20'+_0x5db7ac['length']+_0x4524ee(0x19a)+_0x4afb01+_0x4524ee(0x19d)):console['error'](_0x4524ee(0x19c)+_0x5db7ac[_0x4524ee(0x1b2)]+'\x20scheduled\x20quer'+(_0x5db7ac['length']!==0x1?_0x4524ee(0x18d):'y')+_0x4afb01);if(_0x3c357e['format']===_0x4524ee(0x1f4)||_0x3c357e['format']===_0x4524ee(0x18b)||_0x3c357e[_0x4524ee(0x1c4)]===_0x4524ee(0x1b0)||_0x3c357e['format']===_0x4524ee(0x1ce)){const _0x377ea8=_0x5db7ac[_0x4524ee(0x1ea)](_0x26f1ff=>({'id':_0x26f1ff['id'],'name':_0x26f1ff['name'],'cron':_0x26f1ff[_0x4524ee(0x194)],'database':_0x26f1ff[_0x4524ee(0x1ad)]?.['name'],'type':_0x26f1ff[_0x4524ee(0x1df)],'timezone':_0x26f1ff['time_zone'],'user_name':_0x26f1ff[_0x4524ee(0x1f8)]?.[_0x4524ee(0x1f5)],'updated_at':_0x26f1ff[_0x4524ee(0x1fe)],'next_run_at':_0x26f1ff['next_run_at'],'last_job_status':_0x26f1ff[_0x4524ee(0x1bd)]?.[_0x4524ee(0x1e7)]}));await handleSDKOutput(_0x377ea8,_0x3c357e);}else{if(_0x5db7ac[_0x4524ee(0x1b2)]===0x0)console['log'](_0x4524ee(0x1ff));else{const _0x250bf5=_0x3c357e[_0x4524ee(0x1ee)],_0x2d849b=_0x5db7ac['map'](_0x56ffb7=>{const _0x5b3a6b=_0x4524ee,_0x3da9c6=_0x56ffb7[_0x5b3a6b(0x1bd)]?.[_0x5b3a6b(0x1e7)]?_0x56ffb7[_0x5b3a6b(0x1bd)]['status']===_0x5b3a6b(0x18c)?'✓':'✗':'-',_0x3e2493=_0x56ffb7['last_job']?.[_0x5b3a6b(0x1bf)]?formatRelativeTime(_0x56ffb7['last_job'][_0x5b3a6b(0x1bf)]):_0x5b3a6b(0x1e0),_0x257427=_0x56ffb7['next_run_at']?formatRelativeTime(_0x56ffb7[_0x5b3a6b(0x1aa)]):'-',_0x56c318=_0x56ffb7[_0x5b3a6b(0x194)]||'',_0xe0759b=_0x56ffb7['name']||_0x5b3a6b(0x1c3),_0x1b9885=getConsoleUrl(_0x250bf5,'/app/queries/editor?queryId='+_0x56ffb7['id']);return{'statusIcon':_0x3da9c6,'lastRun':_0x3e2493,'nextRun':_0x257427,'cron':_0x56c318,'name':_0xe0759b,'queryUrl':_0x1b9885,'status':_0x56ffb7[_0x5b3a6b(0x1bd)]?.[_0x5b3a6b(0x1e7)]};}),_0x227488=Math[_0x4524ee(0x1ba)](..._0x2d849b['map'](_0x7d69a=>_0x7d69a[_0x4524ee(0x1c2)][_0x4524ee(0x1b2)])),_0x357411=Math[_0x4524ee(0x1ba)](..._0x2d849b['map'](_0x16fa71=>_0x16fa71[_0x4524ee(0x17c)][_0x4524ee(0x1b2)])),_0x230deb=Math[_0x4524ee(0x1ba)](..._0x2d849b['map'](_0x59d185=>_0x59d185[_0x4524ee(0x194)][_0x4524ee(0x1b2)])),_0x19ed1f=_0x2d849b['map'](_0x43351a=>{const _0x3a6552=_0x4524ee,_0x3d3cf1=_0x43351a[_0x3a6552(0x1e7)]===_0x3a6552(0x18c)?a36_0x3928a5[_0x3a6552(0x1bb)](_0x43351a[_0x3a6552(0x186)]):_0x43351a['status']===_0x3a6552(0x184)?a36_0x3928a5[_0x3a6552(0x1f0)](_0x43351a['statusIcon']):a36_0x3928a5[_0x3a6552(0x1b3)](_0x43351a[_0x3a6552(0x186)]),_0x2a95e4=_0x43351a[_0x3a6552(0x1c2)][_0x3a6552(0x183)](_0x227488),_0x5dd3ef=_0x43351a[_0x3a6552(0x17c)][_0x3a6552(0x183)](_0x357411),_0x1981af=_0x43351a[_0x3a6552(0x194)]?a36_0x3928a5[_0x3a6552(0x1d2)](_0x43351a[_0x3a6552(0x194)][_0x3a6552(0x183)](_0x230deb)):'\x20'[_0x3a6552(0x1f6)](_0x230deb),_0x1c4247=hyperlink(_0x43351a[_0x3a6552(0x1f5)],_0x43351a['queryUrl']);return'📅\x20'+_0x3d3cf1+'\x20'+_0x2a95e4+_0x3a6552(0x1b8)+_0x5dd3ef+'\x20\x20'+_0x1981af+'\x20\x20'+_0x1c4247;});await writeOutput(_0x19ed1f['join']('\x0a'),_0x3c357e[_0x4524ee(0x174)],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x1f517d(0x1f5)]=a36_0x1f517d(0x1d0);[a36_0x1f517d(0x195)]=a36_0x1f517d(0x1f7);[a36_0x1f517d(0x1e8)](_0x215a04){const _0x1420e1=a36_0x1f517d,_0x439e12=_0x215a04['args'][0x0];if(!_0x439e12)return _0x1420e1(0x1f1);return undefined;}async['execute'](_0x4e78d8){const _0x13a289=a36_0x1f517d,{options:_0x156e4c,args:_0x3efe58,tdx:_0x3c141a}=_0x4e78d8,_0x5b129c=_0x3efe58[0x0],_0x449a5c=await withSpinner(_0x13a289(0x17e),()=>_0x3c141a[_0x13a289(0x1ca)][_0x13a289(0x1af)](_0x5b129c),{'verbose':_0x156e4c[_0x13a289(0x17f)]}),_0x422d12=_0x449a5c[_0x13a289(0x196)],_0x3b87b7={'name':_0x422d12[_0x13a289(0x1f5)],'cron':_0x422d12[_0x13a289(0x194)],'database':_0x422d12[_0x13a289(0x1ad)],'type':_0x422d12[_0x13a289(0x1df)],'timezone':_0x422d12['timezone'],'user_name':_0x422d12[_0x13a289(0x178)],'created_at':_0x422d12[_0x13a289(0x1e3)],'engine_version':_0x422d12[_0x13a289(0x1e1)],'executing_user_id':_0x422d12['executing_user_id'],'query':_0x422d12[_0x13a289(0x19b)],'delay':_0x422d12[_0x13a289(0x181)],'priority':_0x422d12['priority'],'retry_limit':_0x422d12['retry_limit'],..._0x422d12[_0x13a289(0x197)]&&{'result':_0x422d12[_0x13a289(0x197)]}};return await handleSingleObjectOutput(_0x3b87b7,_0x156e4c),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x1f517d(0x1f5)]=a36_0x1f517d(0x1fd);['description']=a36_0x1f517d(0x1a6);[a36_0x1f517d(0x1e8)](_0x21423d){const _0x1af455=a36_0x1f517d,_0x4baf19=_0x21423d['args'][0x0];if(!_0x4baf19)return _0x1af455(0x1c7);const _0x5ef6cc=_0x21423d[_0x1af455(0x185)];if(!_0x5ef6cc[_0x1af455(0x1ad)])return _0x1af455(0x1da);return undefined;}async[a36_0x1f517d(0x1a1)](_0x5d8196){const _0x13548c=a36_0x1f517d,{options:_0x5ca4e8,args:_0x6bd320,tdx:_0x44d7aa}=_0x5d8196,_0x44340a=_0x6bd320[0x0],_0x862796=_0x5ca4e8,_0x2e88ab=_0x862796['database'],_0x51ac16=_0x862796['file'],_0x561c09=_0x862796['type']||_0x13548c(0x1c0);let _0x4ce36d;try{_0x4ce36d=readFileSync(_0x51ac16,'utf-8')[_0x13548c(0x1dc)]();}catch(_0x3ed30f){throw new SDKError(ErrorCode[_0x13548c(0x1d6)],'Failed\x20to\x20read\x20file:\x20'+_0x51ac16,_0x3ed30f instanceof Error?_0x3ed30f:undefined);}if(!_0x4ce36d)throw new SDKError(ErrorCode[_0x13548c(0x1d6)],'Query\x20file\x20is\x20empty');const _0x1477ce={'database':_0x2e88ab,'query':_0x4ce36d,'type':_0x561c09};if(_0x862796[_0x13548c(0x194)])_0x1477ce[_0x13548c(0x194)]=_0x862796[_0x13548c(0x194)];if(_0x862796[_0x13548c(0x1db)])_0x1477ce['timezone']=_0x862796[_0x13548c(0x1db)];if(_0x862796[_0x13548c(0x181)]!==undefined)_0x1477ce[_0x13548c(0x181)]=Number(_0x862796[_0x13548c(0x181)]);if(_0x862796['priority']!==undefined)_0x1477ce[_0x13548c(0x176)]=Number(_0x862796[_0x13548c(0x176)]);if(_0x862796[_0x13548c(0x1eb)]!==undefined)_0x1477ce[_0x13548c(0x1a3)]=Number(_0x862796[_0x13548c(0x1eb)]);if(_0x862796[_0x13548c(0x177)])_0x1477ce[_0x13548c(0x1e1)]=_0x862796['engineVersion'];if(_0x862796['result'])_0x1477ce['result']=_0x862796['result'];if(_0x5ca4e8[_0x13548c(0x17f)]){console[_0x13548c(0x184)]('Creating\x20schedule:\x20'+_0x44340a),console[_0x13548c(0x184)](_0x13548c(0x182)+_0x2e88ab),console[_0x13548c(0x184)](_0x13548c(0x19f)+_0x561c09);if(_0x1477ce[_0x13548c(0x194)])console[_0x13548c(0x184)](_0x13548c(0x1cd)+_0x1477ce['cron']);if(_0x1477ce[_0x13548c(0x1db)])console[_0x13548c(0x184)](_0x13548c(0x1dd)+_0x1477ce['timezone']);}const _0x2dcdcf=await withSpinner('Creating\x20schedule...',()=>_0x44d7aa['schedules']['create'](_0x44340a,_0x1477ce),{'verbose':_0x5ca4e8['verbose']});return console[_0x13548c(0x184)](_0x13548c(0x1f9)+_0x2dcdcf[_0x13548c(0x196)]['name']),await handleSingleObjectOutput(_0x2dcdcf[_0x13548c(0x196)],_0x5ca4e8),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x1f517d(0x1f5)]=a36_0x1f517d(0x1ef);[a36_0x1f517d(0x195)]=a36_0x1f517d(0x1d4);[a36_0x1f517d(0x1e8)](_0x17bbfd){const _0x20d924=a36_0x1f517d,_0x4e9f6e=_0x17bbfd[_0x20d924(0x189)][0x0];if(!_0x4e9f6e)return _0x20d924(0x1a5);return undefined;}async[a36_0x1f517d(0x1a1)](_0x1c9802){const _0x4532ee=a36_0x1f517d,{options:_0x2069fc,args:_0x449b2a,tdx:_0x469125}=_0x1c9802,_0x43dbfe=_0x449b2a[0x0],_0x45930f=_0x2069fc,_0x504cf3={};if(_0x45930f['database'])_0x504cf3[_0x4532ee(0x1ad)]=_0x45930f[_0x4532ee(0x1ad)];if(_0x45930f[_0x4532ee(0x1df)])_0x504cf3['type']=_0x45930f['type'];if(_0x45930f[_0x4532ee(0x194)])_0x504cf3['cron']=_0x45930f[_0x4532ee(0x194)];if(_0x45930f[_0x4532ee(0x1db)])_0x504cf3['timezone']=_0x45930f[_0x4532ee(0x1db)];if(_0x45930f['delay']!==undefined)_0x504cf3[_0x4532ee(0x181)]=Number(_0x45930f[_0x4532ee(0x181)]);if(_0x45930f[_0x4532ee(0x176)]!==undefined)_0x504cf3['priority']=Number(_0x45930f[_0x4532ee(0x176)]);if(_0x45930f['retryLimit']!==undefined)_0x504cf3[_0x4532ee(0x1a3)]=Number(_0x45930f[_0x4532ee(0x1eb)]);if(_0x45930f[_0x4532ee(0x177)])_0x504cf3[_0x4532ee(0x1e1)]=_0x45930f[_0x4532ee(0x177)];if(_0x45930f[_0x4532ee(0x197)])_0x504cf3[_0x4532ee(0x197)]=_0x45930f['result'];if(_0x45930f[_0x4532ee(0x1e5)])try{_0x504cf3['query']=readFileSync(_0x45930f[_0x4532ee(0x1e5)],_0x4532ee(0x172))[_0x4532ee(0x1dc)]();}catch(_0x4c1ca1){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x4532ee(0x1fb)+_0x45930f['file'],_0x4c1ca1 instanceof Error?_0x4c1ca1:undefined);}if(Object[_0x4532ee(0x1b7)](_0x504cf3)['length']===0x0)throw new SDKError(ErrorCode[_0x4532ee(0x1d6)],'At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update');if(_0x2069fc[_0x4532ee(0x17f)]){console[_0x4532ee(0x184)](_0x4532ee(0x1f2)+_0x43dbfe);for(const [_0x64db9b,_0x4c6c07]of Object[_0x4532ee(0x1de)](_0x504cf3)){_0x64db9b===_0x4532ee(0x19b)?console['error']('\x20\x20'+_0x64db9b+':\x20'+_0x4c6c07[_0x4532ee(0x1d1)](0x0,0x32)+'...'):console[_0x4532ee(0x184)]('\x20\x20'+_0x64db9b+':\x20'+_0x4c6c07);}}const _0x35afd3=await withSpinner('Updating\x20schedule...',()=>_0x469125[_0x4532ee(0x1ca)][_0x4532ee(0x1d8)](_0x43dbfe,_0x504cf3),{'verbose':_0x2069fc['verbose']});return console['error'](_0x4532ee(0x1d7)+_0x35afd3[_0x4532ee(0x196)][_0x4532ee(0x1f5)]),await handleSingleObjectOutput(_0x35afd3['data'],_0x2069fc),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x1f517d(0x1f5)]=a36_0x1f517d(0x198);[a36_0x1f517d(0x195)]='Delete\x20a\x20scheduled\x20query';[a36_0x1f517d(0x1e8)](_0x53e92c){const _0x4c8d23=a36_0x1f517d,_0x4f0a54=_0x53e92c[_0x4c8d23(0x189)][0x0];if(!_0x4f0a54)return _0x4c8d23(0x1cf);return undefined;}async[a36_0x1f517d(0x1a1)](_0x5a78e0){const _0xddb4d3=a36_0x1f517d,{options:_0x68ff0a,args:_0xce91dc,tdx:_0x390f92}=_0x5a78e0,_0x3d5e64=_0xce91dc[0x0];if(!_0x68ff0a[_0xddb4d3(0x173)]){const _0x3ea39f=await confirm(_0xddb4d3(0x17d)+_0x3d5e64+'\x22?');if(!_0x3ea39f)return console[_0xddb4d3(0x184)](_0xddb4d3(0x1a2)),0x0;}const _0x1fcac0=await withSpinner(_0xddb4d3(0x180),()=>_0x390f92['schedules']['delete'](_0x3d5e64),{'verbose':_0x68ff0a[_0xddb4d3(0x17f)]});return console[_0xddb4d3(0x184)](_0xddb4d3(0x18a)+_0x1fcac0[_0xddb4d3(0x196)][_0xddb4d3(0x1f5)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x1f517d(0x1f5)]=a36_0x1f517d(0x199);[a36_0x1f517d(0x195)]=a36_0x1f517d(0x18f);['validate'](_0x4e56e5){const _0x527e59=a36_0x1f517d,_0x3cd5e7=_0x4e56e5[_0x527e59(0x189)][0x0];if(!_0x3cd5e7)return _0x527e59(0x1b5);return undefined;}async[a36_0x1f517d(0x1a1)](_0x36b0bd){const _0x52b8f5=a36_0x1f517d,{options:_0x1b8a7b,args:_0x5492e5,tdx:_0x3cd5ca}=_0x36b0bd,_0x41f40e=_0x5492e5[0x0],_0x4bd825=_0x1b8a7b,_0x366c0a=_0x4bd825[_0x52b8f5(0x1fa)],_0x3adaa9=_0x4bd825[_0x52b8f5(0x175)]!==undefined?Number(_0x4bd825[_0x52b8f5(0x175)]):undefined;if(_0x1b8a7b[_0x52b8f5(0x17f)]){console['error'](_0x52b8f5(0x1f3)+_0x41f40e);if(_0x366c0a)console['error'](_0x52b8f5(0x1d5)+_0x366c0a);if(_0x3adaa9)console['error'](_0x52b8f5(0x17b)+_0x3adaa9);}const _0x5f5d90=await withSpinner(_0x52b8f5(0x1cb),()=>_0x3cd5ca[_0x52b8f5(0x1ca)]['run'](_0x41f40e,{'time':_0x366c0a,'num':_0x3adaa9}),{'verbose':_0x1b8a7b[_0x52b8f5(0x17f)]}),_0x5b5a8a=_0x5f5d90['data'][_0x52b8f5(0x18e)];console['error'](_0x52b8f5(0x1c5)+_0x5b5a8a['length']+_0x52b8f5(0x1a7)+(_0x5b5a8a['length']!==0x1?'s':'')+_0x52b8f5(0x1cc));for(const _0x54d26a of _0x5b5a8a){console['error'](_0x52b8f5(0x1b6)+_0x54d26a['job_id']);}return await handleSDKOutput(_0x5b5a8a,_0x1b8a7b),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{['name']='schedule:history';['description']=a36_0x1f517d(0x1c9);['validate'](_0x245113){const _0x1d774d=a36_0x1f517d,_0x2697c4=_0x245113[_0x1d774d(0x189)][0x0];if(!_0x2697c4)return _0x1d774d(0x19e);return undefined;}async[a36_0x1f517d(0x1a1)](_0x979d64){const _0x16ba7c=a36_0x1f517d,{options:_0x3b6427,args:_0x280a29,tdx:_0xdb95d2}=_0x979d64,_0x1e87f9=_0x280a29[0x0],_0x114cbe=_0x3b6427,_0x3bd100=_0x114cbe[_0x16ba7c(0x17a)]!==undefined?Number(_0x114cbe['from']):undefined,_0x4f1904=_0x114cbe['to']!==undefined?Number(_0x114cbe['to']):undefined,_0x448126=await withSpinner('Getting\x20schedule\x20history...',()=>_0xdb95d2[_0x16ba7c(0x1ca)]['history'](_0x1e87f9,{'from':_0x3bd100,'to':_0x4f1904}),{'verbose':_0x3b6427[_0x16ba7c(0x17f)]}),_0x5c0f2b=_0x448126[_0x16ba7c(0x196)];console[_0x16ba7c(0x184)](_0x16ba7c(0x19c)+_0x5c0f2b[_0x16ba7c(0x1e6)]+_0x16ba7c(0x1ac)+(_0x5c0f2b[_0x16ba7c(0x1e6)]!==0x1?'s':'')+'\x20(showing\x20'+_0x5c0f2b['from']+'-'+_0x5c0f2b['to']+')');const _0x5de20a=_0x5c0f2b[_0x16ba7c(0x1ec)]['map'](_0x18867b=>({'job_id':_0x18867b[_0x16ba7c(0x1be)],'type':_0x18867b[_0x16ba7c(0x1df)],'status':_0x18867b[_0x16ba7c(0x1e7)],'scheduled_at':_0x18867b['scheduled_at'],'created_at':_0x18867b['created_at'],'start_at':_0x18867b[_0x16ba7c(0x190)],'end_at':_0x18867b[_0x16ba7c(0x1e4)]}));return await handleSDKOutput(_0x5de20a,_0x3b6427),0x0;}}
@@ -1 +1 @@
1
- const a37_0x561433=a37_0x42d3;(function(_0x169d66,_0x1ac9a2){const _0x52f76d=a37_0x42d3,_0x42fd84=_0x169d66();while(!![]){try{const _0x3a76ff=-parseInt(_0x52f76d(0x258))/0x1*(-parseInt(_0x52f76d(0x244))/0x2)+-parseInt(_0x52f76d(0x251))/0x3+-parseInt(_0x52f76d(0x249))/0x4*(-parseInt(_0x52f76d(0x1f8))/0x5)+-parseInt(_0x52f76d(0x20f))/0x6+-parseInt(_0x52f76d(0x21f))/0x7*(-parseInt(_0x52f76d(0x275))/0x8)+-parseInt(_0x52f76d(0x247))/0x9+parseInt(_0x52f76d(0x206))/0xa*(parseInt(_0x52f76d(0x1f2))/0xb);if(_0x3a76ff===_0x1ac9a2)break;else _0x42fd84['push'](_0x42fd84['shift']());}catch(_0x525a36){_0x42fd84['push'](_0x42fd84['shift']());}}}(a37_0x35eb,0xe334c));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0x3d36f4 from'chalk';function a37_0x42d3(_0x490692,_0x2d5a12){_0x490692=_0x490692-0x1e1;const _0x35eb9a=a37_0x35eb();let _0x42d363=_0x35eb9a[_0x490692];return _0x42d363;}async function resolveSegmentTarget(_0x31b0e1,_0x2d0d55,_0x5db63f){const _0x365e87=a37_0x42d3;if(isYamlFilePath(_0x31b0e1))try{const _0x106d71=await resolveYamlFilePath(_0x31b0e1);return _0x5db63f&&(console[_0x365e87(0x200)](_0x365e87(0x1f4)+_0x31b0e1),console[_0x365e87(0x200)](_0x365e87(0x21b)+_0x106d71[_0x365e87(0x230)]),console[_0x365e87(0x200)](_0x365e87(0x268)+_0x106d71[_0x365e87(0x284)]),console[_0x365e87(0x200)]('\x20\x20Folder\x20path:\x20'+(_0x106d71[_0x365e87(0x220)]||_0x365e87(0x1fb))),console['error'](_0x365e87(0x282)+_0x106d71['fullPath'])),_0x106d71[_0x365e87(0x224)];}catch(_0x4e80c9){throw new SDKError(ErrorCode[_0x365e87(0x261)],_0x365e87(0x25c)+_0x4e80c9['message']);}if(!_0x2d0d55)throw new SDKError(ErrorCode[_0x365e87(0x261)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x2d0d55+'/'+_0x31b0e1;}function a37_0x35eb(){const _0x3f4fce=['Resolved:\x20','Usage:\x20tdx\x20sg\x20desc\x20<name>','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','folderId','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','trim','Parent\x20segment:\x20','stats','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','\x20\x20Parent\x20segment:\x20','Usage:\x20tdx\x20segment\x20describe\x20<path>','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','Parent\x20ID:\x20','74515VtrIrs','folderPath','Resolving\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','parentFolder','fullPath','segmentPath','Folder\x20ID:\x20','Fetching\x20segment\x20details...','Resolved\x20type:\x20','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','information_schema','Resolving\x20parent\x20folder\x20\x27','Get\x20SQL\x20query\x20for\x20child\x20segment','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','SQL\x20query:\x0a','parentSegment','parentId','resolveFolderId','getParent','type','segmentId','SEGMENT_NOT_FOUND','Create\x20segment\x20folder\x20for\x20organization','Error:\x20','Options:','url','segment:folder:show','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Creating\x20folder\x20\x27','getSegmentSQL','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Target\x20path:\x20','\x20rows\x20','toLocaleString','Resolved\x20parent\x20folder\x20ID:\x20','4VPzEbq','includes','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','7893198lBACTI','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','68raeeCH','SELECT\x20*\x20FROM\x20(\x0a','test','Fetching\x20SQL\x20from\x20rule...','cyan','setJobId','✔\x20Query\x20completed:\x20Processed\x20','/e/','1680576HEqhDu','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Segment\x20ID:\x20','/app/ps/','Fetching\x20folder\x20\x27','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Site:\x20','546836deTcaf','code','description','folder','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','segment:view','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Usage:','INVALID_ARGUMENT','in\x20','length','Use:\x20tdx\x20ps\x20view','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','getSegment','SEGMENT_FOLDER_NOT_FOUND','\x20\x20Segment\x20name:\x20','site','processedRows','Parent\x20name:\x20','getFolder','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','content','Examples:','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','name','Use:\x20tdx\x20ps\x20view\x20-w','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','\x20[Job\x20ID:\x20','880fmndmx','segment:folder:create','Fetching\x20folder\x20details...','verbose','elapsedTimeMillis','segment:sql','Fetching\x20parent\x20segment\x20details...','Resolving\x20\x27','Folder\x20name:\x20','✔\x20Found\x20','data','Resolved\x20parent\x20ID:\x20','listFolders','\x20\x20Full\x20path:\x20','Show\x20segment\x20folder\x20details','segmentName','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','cause','getSQLFromServerSegment','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','\x27\x20with\x20ID:\x20','resolvePathToResource','limit','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Folder\x20ID\x20missing\x20from\x20resolved\x20path','segment:folder:list','\x27...','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','segment:desc','segment:describe','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Segment\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Fetching\x20SQL\x20for\x20segment...','message','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','22UUroaD','log','Resolved\x20YAML\x20file:\x20','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','red','resolveParentId','230735ofGVYa','createFolder','jobId','(root)','parent','Show\x20child\x20segment\x20schema\x20(column\x20types)','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','\x20\x20tdx\x20sg\x20sql\x20--path\x20','error','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','web','Use:\x20tdx\x20ps\x20desc','\x20\x20Cause:\x20','Resolved\x20relative\x20path\x20to:\x20','51590FtYOMN','Error:\x20Path\x20or\x20name\x20is\x20required','green','\x20Opening\x20','execute','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','segment','json','getSQLFromYamlFile','4149534oEcbHh','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','query'];a37_0x35eb=function(){return _0x3f4fce;};return a37_0x35eb();}export class SegmentDescribeCommand extends BaseCommand{['name']=a37_0x561433(0x1eb);[a37_0x561433(0x25a)]='Show\x20segment\x20or\x20folder\x20details';async[a37_0x561433(0x20a)](_0x195223){const _0xbcb704=a37_0x561433,{options:_0xfd5c04,args:_0x275c6b,tdx:_0x1c935f}=_0x195223,_0x1598ec=_0x275c6b[0x0],_0x4dbfd8=!_0x1598ec&&!!_0xfd5c04['parentSegment'],_0x3d6ad9=_0x1598ec||_0xfd5c04['parentSegment'];if(!_0x3d6ad9)return console['error'](_0xbcb704(0x207)),console[_0xbcb704(0x200)](_0xbcb704(0x21c)),console[_0xbcb704(0x200)]('Examples:'),console[_0xbcb704(0x200)](_0xbcb704(0x246)),console[_0xbcb704(0x200)](_0xbcb704(0x1ee)),console[_0xbcb704(0x200)](_0xbcb704(0x252)),console[_0xbcb704(0x200)](_0xbcb704(0x1fe)),0x1;try{const _0x61d521=_0xfd5c04[_0xbcb704(0x225)];let _0xca1f48=_0x3d6ad9;!_0x4dbfd8&&_0x61d521&&!_0x3d6ad9[_0xbcb704(0x245)]('/')&&(_0xca1f48=_0x61d521+'/'+_0x3d6ad9,_0xfd5c04[_0xbcb704(0x278)]&&console[_0xbcb704(0x200)](_0xbcb704(0x205)+_0xca1f48));const _0x211fa2=await withSpinner('Resolving\x20path\x20\x27'+_0xca1f48+_0xbcb704(0x1e8),()=>_0x1c935f[_0xbcb704(0x20c)]['resolvePathToResource'](_0xca1f48),{'verbose':_0xfd5c04[_0xbcb704(0x278)]}),_0x2b76f0=_0x211fa2[_0xbcb704(0x27f)];_0xfd5c04[_0xbcb704(0x278)]&&(console[_0xbcb704(0x200)](_0xbcb704(0x228)+_0x2b76f0[_0xbcb704(0x234)]),console['error'](_0xbcb704(0x21e)+_0x2b76f0[_0xbcb704(0x231)]),_0x2b76f0[_0xbcb704(0x215)]&&console[_0xbcb704(0x200)](_0xbcb704(0x226)+_0x2b76f0[_0xbcb704(0x215)]),_0x2b76f0[_0xbcb704(0x235)]&&console[_0xbcb704(0x200)](_0xbcb704(0x253)+_0x2b76f0[_0xbcb704(0x235)]));if(_0x2b76f0[_0xbcb704(0x234)]===_0xbcb704(0x1fc)){const _0x48a99c=await withSpinner(_0xbcb704(0x27b),()=>_0x1c935f[_0xbcb704(0x20c)][_0xbcb704(0x233)](_0x2b76f0[_0xbcb704(0x231)]),{'verbose':_0xfd5c04[_0xbcb704(0x278)]});await handleSingleObjectOutput(_0x48a99c[_0xbcb704(0x27f)],_0xfd5c04);}else{if(_0x2b76f0['type']==='folder'){if(!_0x2b76f0[_0xbcb704(0x215)])throw new SDKError(ErrorCode[_0xbcb704(0x267)],_0xbcb704(0x1e6));const _0x4b3fb8=await withSpinner(_0xbcb704(0x277),()=>_0x1c935f[_0xbcb704(0x20c)]['getFolder'](_0x2b76f0[_0xbcb704(0x215)]),{'verbose':_0xfd5c04[_0xbcb704(0x278)]});await handleSingleObjectOutput(_0x4b3fb8[_0xbcb704(0x27f)],_0xfd5c04);}else{if(_0x2b76f0[_0xbcb704(0x234)]===_0xbcb704(0x20c)){if(!_0x2b76f0[_0xbcb704(0x235)])throw new SDKError(ErrorCode[_0xbcb704(0x236)],_0xbcb704(0x1ed));const _0x20b456=await withSpinner(_0xbcb704(0x227),()=>_0x1c935f[_0xbcb704(0x20c)][_0xbcb704(0x266)](_0x2b76f0[_0xbcb704(0x231)],_0x2b76f0['segmentId']),{'verbose':_0xfd5c04[_0xbcb704(0x278)]});await handleSingleObjectOutput(_0x20b456[_0xbcb704(0x27f)],_0xfd5c04);}}}return 0x0;}catch(_0x48b64){if(_0x48b64 instanceof SDKError)return console[_0xbcb704(0x200)](_0xbcb704(0x238)+_0x48b64[_0xbcb704(0x1f0)]),_0x48b64[_0xbcb704(0x286)]&&console[_0xbcb704(0x200)](_0xbcb704(0x204)+_0x48b64[_0xbcb704(0x286)]),0x1;throw _0x48b64;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x561433(0x271)]='segment:show';[a37_0x561433(0x25a)]=a37_0x561433(0x1ec);async[a37_0x561433(0x20a)](_0x386977){const _0x14f682=a37_0x561433,{options:_0x1075b8,args:_0x8ef93,tdx:_0x431d8e}=_0x386977,_0x342c0a=_0x8ef93[0x0];if(!_0x342c0a)return console['error'](_0x14f682(0x25d)),console[_0x14f682(0x200)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console[_0x14f682(0x200)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x14f682(0x200)](_0x14f682(0x26f)),console[_0x14f682(0x200)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console['error']('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x3d602d=_0x1075b8[_0x14f682(0x230)],_0x2868d8=await resolveSegmentTarget(_0x342c0a,_0x3d602d,_0x1075b8['verbose']);_0x1075b8[_0x14f682(0x278)]&&console[_0x14f682(0x200)](_0x14f682(0x240)+_0x2868d8);const _0x3f7e8a=await withSpinner(_0x14f682(0x27c)+_0x342c0a+_0x14f682(0x1e8),()=>_0x431d8e[_0x14f682(0x20c)][_0x14f682(0x1e3)](_0x2868d8),{'verbose':_0x1075b8[_0x14f682(0x278)]}),_0x3fc3c1=_0x3f7e8a[_0x14f682(0x27f)];_0x1075b8[_0x14f682(0x278)]&&(console['error'](_0x14f682(0x228)+_0x3fc3c1[_0x14f682(0x234)]),console['error']('Parent\x20ID:\x20'+_0x3fc3c1[_0x14f682(0x231)]));if(_0x3fc3c1[_0x14f682(0x234)]==='folder')return console[_0x14f682(0x200)](_0x14f682(0x256)),console[_0x14f682(0x200)](_0x14f682(0x210)),0x1;if(_0x3fc3c1[_0x14f682(0x234)]===_0x14f682(0x1fc))return console[_0x14f682(0x200)](_0x14f682(0x25f)),console[_0x14f682(0x200)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x3fc3c1[_0x14f682(0x235)])throw new SDKError(ErrorCode[_0x14f682(0x236)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x18d0f2=await withSpinner(_0x14f682(0x1ef),()=>_0x431d8e[_0x14f682(0x20c)][_0x14f682(0x23e)](_0x3fc3c1[_0x14f682(0x231)],_0x3fc3c1[_0x14f682(0x235)]),{'verbose':_0x1075b8[_0x14f682(0x278)]});let _0x2778c6=_0x18d0f2[_0x14f682(0x27f)];const _0x5efe65=resolveLimit(_0x1075b8[_0x14f682(0x1e4)],DEFAULT_DISPLAY_LIMIT),_0xd7a49d=/\bLIMIT\s+\d+/i[_0x14f682(0x24b)](_0x2778c6);!_0xd7a49d&&(_0x2778c6=_0x2778c6[_0x14f682(0x217)]()['replace'](/;+$/,''),_0x2778c6=_0x14f682(0x24a)+_0x2778c6+_0x14f682(0x248)+_0x5efe65);_0x1075b8[_0x14f682(0x278)]&&console[_0x14f682(0x200)](_0x14f682(0x22f)+_0x2778c6);const _0x8b7ee4=await withProgressSpinner('Executing\x20segment\x20query...',async _0x4afa28=>{const _0x822581=_0x14f682,_0x9d4f4=await _0x431d8e[_0x822581(0x211)][_0x822581(0x20a)](_0x2778c6,{'catalog':'td','schema':_0x822581(0x22a),'onJobId':_0x13c4d7=>{const _0x17d65c=_0x822581;_0x4afa28[_0x17d65c(0x24e)](_0x13c4d7);}});return _0x9d4f4;},{'verbose':_0x1075b8[_0x14f682(0x278)]}),_0x47fda6=_0x8b7ee4[_0x14f682(0x27f)],_0x2ca2f8=_0x47fda6[_0x14f682(0x1fa)]?_0x14f682(0x274)+_0x47fda6['jobId']+']':'';return console[_0x14f682(0x200)](_0x14f682(0x24f)+_0x47fda6[_0x14f682(0x219)][_0x14f682(0x26a)][_0x14f682(0x242)]()+_0x14f682(0x241)+(_0x14f682(0x262)+formatElapsed(_0x47fda6[_0x14f682(0x219)][_0x14f682(0x279)])+_0x2ca2f8)),await handleQueryOutput(_0x47fda6,_0x1075b8),0x0;}catch(_0x528f5f){if(_0x528f5f instanceof SDKError)return console['error']('✖\x20Query\x20failed\x20['+_0x528f5f[_0x14f682(0x259)]+']'),console[_0x14f682(0x200)]('\x0a'+_0x528f5f[_0x14f682(0x1f0)]),0x1;throw _0x528f5f;}}}export class SegmentFolderListCommand extends BaseCommand{['name']=a37_0x561433(0x1e7);['description']=a37_0x561433(0x22d);async[a37_0x561433(0x20a)](_0xe9026a){const _0x5c5f55=a37_0x561433,{options:_0x429438,args:_0x4cbca3,tdx:_0x22b0fa}=_0xe9026a;if(_0x4cbca3[_0x5c5f55(0x263)]===0x0)return console[_0x5c5f55(0x200)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x5c5f55(0x200)](_0x5c5f55(0x1f5)),0x1;const _0x246463=_0x4cbca3[0x0];try{_0x429438[_0x5c5f55(0x278)]&&(console[_0x5c5f55(0x200)](_0x5c5f55(0x257)+_0x429438['site']),console[_0x5c5f55(0x200)](_0x5c5f55(0x26b)+_0x246463));const _0x2bbb0e=await withSpinner(_0x5c5f55(0x221)+_0x246463+_0x5c5f55(0x1e8),()=>_0x22b0fa['segment']['resolveParentId'](_0x246463),{'verbose':_0x429438[_0x5c5f55(0x278)]}),_0x155816=_0x2bbb0e['data'];_0x429438[_0x5c5f55(0x278)]&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x155816);const _0x3d30db=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x246463+'\x27...',()=>_0x22b0fa['segment'][_0x5c5f55(0x281)](_0x155816),{'verbose':_0x429438['verbose']}),_0x4da6f9=_0x3d30db[_0x5c5f55(0x27f)];return console['error'](_0x5c5f55(0x27e)+_0x4da6f9[_0x5c5f55(0x263)]+'\x20folder'+(_0x4da6f9[_0x5c5f55(0x263)]!==0x1?'s':'')),await handleSDKOutput(_0x4da6f9,_0x429438),0x0;}catch(_0x197c4a){if(_0x197c4a instanceof SDKError)return console['error'](_0x5c5f55(0x238)+_0x197c4a[_0x5c5f55(0x1f0)]),_0x197c4a[_0x5c5f55(0x286)]&&console['error'](_0x5c5f55(0x204)+_0x197c4a[_0x5c5f55(0x286)]),0x1;throw _0x197c4a;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x561433(0x271)]=a37_0x561433(0x23b);['description']=a37_0x561433(0x283);async[a37_0x561433(0x20a)](_0xe9c706){const _0x416f90=a37_0x561433,{options:_0x459afc,args:_0x58d3fc,tdx:_0x485647}=_0xe9c706;if(_0x58d3fc['length']===0x0)return console[_0x416f90(0x200)]('Error:\x20Folder\x20reference\x20is\x20required'),console['error']('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x20847c,childId:_0x2446fa}=parseSegmentRef(_0x58d3fc[0x0]);_0x459afc[_0x416f90(0x278)]&&(console[_0x416f90(0x200)]('Site:\x20'+_0x459afc[_0x416f90(0x269)]),console[_0x416f90(0x200)](_0x416f90(0x26b)+_0x20847c),_0x2446fa&&console[_0x416f90(0x200)](_0x416f90(0x27d)+_0x2446fa));if(!_0x2446fa)return console[_0x416f90(0x200)](_0x416f90(0x285)),0x1;const _0x4f5095=await withSpinner(_0x416f90(0x221)+_0x20847c+_0x416f90(0x1e8),()=>_0x485647['segment'][_0x416f90(0x1f7)](_0x20847c),{'verbose':_0x459afc[_0x416f90(0x278)]}),_0x409f01=_0x4f5095[_0x416f90(0x27f)];_0x459afc[_0x416f90(0x278)]&&console[_0x416f90(0x200)](_0x416f90(0x280)+_0x409f01);const _0x381884=await withSpinner('Resolving\x20folder\x20\x27'+_0x2446fa+_0x416f90(0x1e8),()=>_0x485647[_0x416f90(0x20c)][_0x416f90(0x232)](_0x409f01,_0x2446fa),{'verbose':_0x459afc[_0x416f90(0x278)]}),_0x429ed8=_0x381884['data'];_0x459afc[_0x416f90(0x278)]&&console[_0x416f90(0x200)]('Resolved\x20folder\x20ID:\x20'+_0x429ed8);const _0x3b5a8c=await withSpinner(_0x416f90(0x255)+_0x2446fa+_0x416f90(0x1e8),()=>_0x485647['segment'][_0x416f90(0x26c)](_0x429ed8),{'verbose':_0x459afc['verbose']});return await handleSDKOutput([_0x3b5a8c[_0x416f90(0x27f)]],_0x459afc),0x0;}catch(_0xc2f2ac){if(_0xc2f2ac instanceof SDKError)return console['error'](_0x416f90(0x238)+_0xc2f2ac[_0x416f90(0x1f0)]),_0xc2f2ac[_0x416f90(0x286)]&&console[_0x416f90(0x200)](_0x416f90(0x204)+_0xc2f2ac[_0x416f90(0x286)]),0x1;throw _0xc2f2ac;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x561433(0x271)]=a37_0x561433(0x27a);['description']=a37_0x561433(0x22c);async['execute'](_0x3bbf26){const _0xc86e7=a37_0x561433,{options:_0x21b098,args:_0x153c0a}=_0x3bbf26,_0x3eb32f=_0x21b098,_0xca191b=_0x3eb32f['path'],_0x3533b1=_0x153c0a[0x0];if(!_0x3533b1&&!_0xca191b)return console['error'](a37_0x3d36f4[_0xc86e7(0x1f6)](_0xc86e7(0x216))),console[_0xc86e7(0x200)](_0xc86e7(0x260)),console[_0xc86e7(0x200)](_0xc86e7(0x214)),console[_0xc86e7(0x200)](_0xc86e7(0x1e1)),console[_0xc86e7(0x200)]('Examples:'),console[_0xc86e7(0x200)](_0xc86e7(0x22e)),console[_0xc86e7(0x200)](_0xc86e7(0x1e9)),0x1;if(_0x3533b1&&_0xca191b)return console[_0xc86e7(0x200)](a37_0x3d36f4[_0xc86e7(0x1f6)]('Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both')),0x1;try{let _0x215b98;if(_0xca191b)_0x215b98=await this['getSQLFromYamlFile'](_0xca191b,_0x3bbf26);else{if(isYamlFilePath(_0x3533b1))return console[_0xc86e7(0x200)](a37_0x3d36f4[_0xc86e7(0x1f6)]('Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option')),console[_0xc86e7(0x200)](_0xc86e7(0x1ff)+_0x3533b1),0x1;else _0x215b98=await this[_0xc86e7(0x287)](_0x3533b1,_0x3bbf26);}return _0x21b098['format']===_0xc86e7(0x20d)||_0x21b098['format']==='jsonl'?await handleSDKOutput([{'sql':_0x215b98}],_0x21b098):console[_0xc86e7(0x1f3)](_0x215b98),0x0;}catch(_0xa3cc2d){if(_0xa3cc2d instanceof SDKError)return console['error'](_0xc86e7(0x238)+_0xa3cc2d[_0xc86e7(0x1f0)]),_0xa3cc2d[_0xc86e7(0x286)]&&console[_0xc86e7(0x200)]('\x20\x20Cause:\x20'+_0xa3cc2d[_0xc86e7(0x286)]),0x1;throw _0xa3cc2d;}}async[a37_0x561433(0x20e)](_0x32a82d,_0x4639b2){const _0x5ebe72=a37_0x561433,{options:_0x1335be,tdx:_0x42c26a}=_0x4639b2;let _0x1d41e9;try{_0x1d41e9=await resolveYamlFilePath(_0x32a82d);}catch(_0x35defb){throw new SDKError(ErrorCode[_0x5ebe72(0x261)],_0x5ebe72(0x25c)+_0x35defb[_0x5ebe72(0x1f0)]);}_0x1335be[_0x5ebe72(0x278)]&&console[_0x5ebe72(0x200)](_0x5ebe72(0x212)+_0x1d41e9[_0x5ebe72(0x230)]+'/'+_0x1d41e9[_0x5ebe72(0x284)]);const _0x8c6b56=await withSpinner(_0x5ebe72(0x24c),()=>_0x42c26a['segment']['getSegmentSQLFromYaml'](_0x1d41e9[_0x5ebe72(0x26e)],_0x1d41e9[_0x5ebe72(0x230)],_0x1d41e9[_0x5ebe72(0x284)]),{'verbose':_0x1335be[_0x5ebe72(0x278)]});return _0x8c6b56[_0x5ebe72(0x27f)];}async['getSQLFromServerSegment'](_0x543a08,_0x27bcab){const _0x3669aa=a37_0x561433,{options:_0x38ec7f,tdx:_0x2fcae7}=_0x27bcab,_0x4c21ec=_0x38ec7f['parentSegment'],_0x29164b=await resolveSegmentTarget(_0x543a08,_0x4c21ec,_0x38ec7f[_0x3669aa(0x278)]);_0x38ec7f['verbose']&&console[_0x3669aa(0x200)]('Target\x20path:\x20'+_0x29164b);const _0x5cecd5=await withSpinner(_0x3669aa(0x27c)+_0x543a08+'\x27...',()=>_0x2fcae7['segment'][_0x3669aa(0x1e3)](_0x29164b),{'verbose':_0x38ec7f[_0x3669aa(0x278)]}),_0x45ba73=_0x5cecd5[_0x3669aa(0x27f)];_0x38ec7f[_0x3669aa(0x278)]&&(console[_0x3669aa(0x200)](_0x3669aa(0x228)+_0x45ba73[_0x3669aa(0x234)]),console[_0x3669aa(0x200)](_0x3669aa(0x21e)+_0x45ba73[_0x3669aa(0x231)]));if(_0x45ba73[_0x3669aa(0x234)]===_0x3669aa(0x25b))throw new SDKError(ErrorCode[_0x3669aa(0x261)],'Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.');if(_0x45ba73[_0x3669aa(0x234)]===_0x3669aa(0x1fc))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x3669aa(0x21d));if(!_0x45ba73['segmentId'])throw new SDKError(ErrorCode[_0x3669aa(0x236)],_0x3669aa(0x1ed));const _0x3a7d2c=await withSpinner(_0x3669aa(0x1ef),()=>_0x2fcae7[_0x3669aa(0x20c)][_0x3669aa(0x23e)](_0x45ba73['parentId'],_0x45ba73[_0x3669aa(0x235)]),{'verbose':_0x38ec7f[_0x3669aa(0x278)]});return _0x3a7d2c[_0x3669aa(0x27f)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x561433(0x271)]=a37_0x561433(0x276);[a37_0x561433(0x25a)]=a37_0x561433(0x237);async[a37_0x561433(0x20a)](_0x1a0818){const _0x4a587b=a37_0x561433,{options:_0x3f9096,args:_0x4358c3,tdx:_0x10342d}=_0x1a0818,_0x18540b=_0x3f9096;if(_0x4358c3[_0x4a587b(0x263)]<0x2)return console['error'](_0x4a587b(0x265)),console['error'](_0x4a587b(0x229)),0x1;const _0x3caf6c=_0x4358c3[0x0],_0x53ec18=_0x4358c3[0x1];_0x18540b[_0x4a587b(0x278)]&&(console[_0x4a587b(0x200)](_0x4a587b(0x257)+_0x18540b[_0x4a587b(0x269)]),console['error'](_0x4a587b(0x218)+_0x3caf6c),console[_0x4a587b(0x200)](_0x4a587b(0x27d)+_0x53ec18));let _0x4b0282;if(_0x18540b[_0x4a587b(0x223)]){const _0x1b9e77=_0x18540b['parentFolder'],_0x54b72a=await withSpinner(_0x4a587b(0x221)+_0x3caf6c+_0x4a587b(0x1e8),()=>_0x10342d['segment'][_0x4a587b(0x1f7)](_0x3caf6c),{'verbose':_0x18540b['verbose']}),_0x56f177=_0x54b72a[_0x4a587b(0x27f)],_0x5e17ab=await withSpinner(_0x4a587b(0x22b)+_0x1b9e77+_0x4a587b(0x1e8),()=>_0x10342d[_0x4a587b(0x20c)][_0x4a587b(0x232)](_0x56f177,_0x1b9e77),{'verbose':_0x18540b[_0x4a587b(0x278)]});_0x4b0282=_0x5e17ab['data'],_0x18540b[_0x4a587b(0x278)]&&console[_0x4a587b(0x200)](_0x4a587b(0x243)+_0x4b0282);}const _0x36b0d3={'name':_0x53ec18,'description':_0x18540b['description'],'parentFolderId':_0x4b0282},_0x245858=await withSpinner(_0x4a587b(0x23d)+_0x53ec18+_0x4a587b(0x1e8),()=>_0x10342d['segment'][_0x4a587b(0x1f9)](_0x3caf6c,_0x36b0d3),{'verbose':_0x18540b[_0x4a587b(0x278)]}),_0x2055d3=_0x245858['data'];return console[_0x4a587b(0x200)]('✔\x20Created\x20folder\x20\x27'+_0x2055d3[_0x4a587b(0x271)]+_0x4a587b(0x1e2)+_0x2055d3['id']),await handleSDKOutput([_0x2055d3],_0x18540b),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a37_0x561433(0x25e);[a37_0x561433(0x25a)]='Show\x20folder\x20or\x20child\x20segment\x20details';async[a37_0x561433(0x20a)](_0x37227e){const _0x5551e6=a37_0x561433,{options:_0x12f4eb,args:_0x24e342,tdx:_0x4c3610}=_0x37227e,_0x3292af=_0x24e342[0x0];if(!_0x3292af)return console['error'](_0x5551e6(0x1e5)),console[_0x5551e6(0x200)](_0x5551e6(0x222)),console[_0x5551e6(0x200)](_0x5551e6(0x23f)),console['error'](_0x5551e6(0x239)),console[_0x5551e6(0x200)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console['error']('Examples:'),console['error'](_0x5551e6(0x270)),console[_0x5551e6(0x200)](_0x5551e6(0x21a)),console[_0x5551e6(0x200)](_0x5551e6(0x1f1)),console[_0x5551e6(0x200)](_0x5551e6(0x26d)),0x1;try{const _0x4439ec=_0x12f4eb['parentSegment'],_0x427109=await resolveSegmentTarget(_0x3292af,_0x4439ec,_0x12f4eb[_0x5551e6(0x278)]);_0x12f4eb[_0x5551e6(0x278)]&&console[_0x5551e6(0x200)](_0x5551e6(0x240)+_0x427109);const _0x2f7c86=await withSpinner('Resolving\x20\x27'+_0x3292af+_0x5551e6(0x1e8),()=>_0x4c3610[_0x5551e6(0x20c)][_0x5551e6(0x1e3)](_0x427109),{'verbose':_0x12f4eb[_0x5551e6(0x278)]}),_0x29cf9e=_0x2f7c86['data'];_0x12f4eb['verbose']&&(console[_0x5551e6(0x200)](_0x5551e6(0x228)+_0x29cf9e[_0x5551e6(0x234)]),console[_0x5551e6(0x200)](_0x5551e6(0x21e)+_0x29cf9e[_0x5551e6(0x231)]),_0x29cf9e[_0x5551e6(0x215)]&&console['error'](_0x5551e6(0x226)+_0x29cf9e['folderId']),_0x29cf9e[_0x5551e6(0x235)]&&console[_0x5551e6(0x200)](_0x5551e6(0x253)+_0x29cf9e[_0x5551e6(0x235)]));if(_0x12f4eb[_0x5551e6(0x202)]){if(_0x29cf9e['type']===_0x5551e6(0x25b))return console[_0x5551e6(0x200)](_0x5551e6(0x273)),0x1;if(_0x29cf9e[_0x5551e6(0x234)]===_0x5551e6(0x1fc))return console[_0x5551e6(0x200)](_0x5551e6(0x20b)),console['error'](_0x5551e6(0x272)),0x1;if(!_0x29cf9e[_0x5551e6(0x235)])throw new SDKError(ErrorCode[_0x5551e6(0x236)],_0x5551e6(0x1ed));const _0x3905e2=getConsoleNextUrl(_0x12f4eb['site'],_0x5551e6(0x254)+_0x29cf9e[_0x5551e6(0x231)]+_0x5551e6(0x250)+_0x29cf9e[_0x5551e6(0x235)]);return console[_0x5551e6(0x200)](a37_0x3d36f4[_0x5551e6(0x208)]('✔')+_0x5551e6(0x209)+a37_0x3d36f4[_0x5551e6(0x24d)](_0x3905e2)),openBrowser(_0x3905e2),0x0;}if(_0x29cf9e[_0x5551e6(0x234)]==='folder'){if(!_0x29cf9e['folderId'])throw new SDKError(ErrorCode[_0x5551e6(0x267)],_0x5551e6(0x1e6));const _0x1514cc=await withSpinner(_0x5551e6(0x277),()=>_0x4c3610['segment'][_0x5551e6(0x26c)](_0x29cf9e['folderId']),{'verbose':_0x12f4eb['verbose']});await handleSingleObjectOutput(_0x1514cc[_0x5551e6(0x27f)],_0x12f4eb);}else{if(_0x29cf9e[_0x5551e6(0x234)]===_0x5551e6(0x20c)){if(!_0x29cf9e[_0x5551e6(0x235)])throw new SDKError(ErrorCode[_0x5551e6(0x236)],_0x5551e6(0x1ed));const _0x21480e=await withSpinner(_0x5551e6(0x227),()=>_0x4c3610[_0x5551e6(0x20c)][_0x5551e6(0x266)](_0x29cf9e[_0x5551e6(0x231)],_0x29cf9e['segmentId']),{'verbose':_0x12f4eb['verbose']}),_0x2b63c8=getConsoleNextUrl(_0x12f4eb[_0x5551e6(0x269)],_0x5551e6(0x254)+_0x29cf9e[_0x5551e6(0x231)]+_0x5551e6(0x250)+_0x29cf9e['segmentId']),_0x47b009=_0x21480e[_0x5551e6(0x27f)];_0x47b009[_0x5551e6(0x23a)]=_0x2b63c8,await handleSingleObjectOutput(_0x47b009,_0x12f4eb);}else return console[_0x5551e6(0x200)](_0x5551e6(0x201)),console[_0x5551e6(0x200)](_0x5551e6(0x264)),0x1;}return 0x0;}catch(_0x1e7cc5){if(_0x1e7cc5 instanceof SDKError)return console[_0x5551e6(0x200)]('Error:\x20'+_0x1e7cc5['message']),_0x1e7cc5[_0x5551e6(0x286)]&&console[_0x5551e6(0x200)](_0x5551e6(0x204)+_0x1e7cc5[_0x5551e6(0x286)]),0x1;throw _0x1e7cc5;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']=a37_0x561433(0x1ea);[a37_0x561433(0x25a)]=a37_0x561433(0x1fd);async[a37_0x561433(0x20a)](_0x3ce029){const _0x77114d=a37_0x561433,{options:_0x5c118f,args:_0x4b85e5,tdx:_0xcf4827}=_0x3ce029,_0x2ffe70=_0x4b85e5[0x0];if(!_0x2ffe70)return console[_0x77114d(0x200)](_0x77114d(0x25d)),console['error'](_0x77114d(0x213)),console[_0x77114d(0x200)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console[_0x77114d(0x200)](_0x77114d(0x26f)),console[_0x77114d(0x200)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console['error']('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x47bc73=_0x5c118f['parentSegment'],_0x59039a=await resolveSegmentTarget(_0x2ffe70,_0x47bc73,_0x5c118f[_0x77114d(0x278)]);_0x5c118f[_0x77114d(0x278)]&&console['error'](_0x77114d(0x240)+_0x59039a);const _0x1baf1b=await withSpinner(_0x77114d(0x27c)+_0x2ffe70+_0x77114d(0x1e8),()=>_0xcf4827['segment'][_0x77114d(0x1e3)](_0x59039a),{'verbose':_0x5c118f['verbose']}),_0x5c7c74=_0x1baf1b[_0x77114d(0x27f)];_0x5c118f[_0x77114d(0x278)]&&(console[_0x77114d(0x200)](_0x77114d(0x228)+_0x5c7c74[_0x77114d(0x234)]),console[_0x77114d(0x200)](_0x77114d(0x21e)+_0x5c7c74[_0x77114d(0x231)]));if(_0x5c7c74[_0x77114d(0x234)]===_0x77114d(0x25b))return console[_0x77114d(0x200)]('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console[_0x77114d(0x200)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x5c7c74[_0x77114d(0x234)]===_0x77114d(0x1fc))return console[_0x77114d(0x200)](_0x77114d(0x23c)),console[_0x77114d(0x200)](_0x77114d(0x203)),0x1;if(!_0x5c7c74[_0x77114d(0x235)])throw new SDKError(ErrorCode[_0x77114d(0x236)],_0x77114d(0x1ed));const _0xd57d82=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0xcf4827[_0x77114d(0x20c)][_0x77114d(0x23e)](_0x5c7c74[_0x77114d(0x231)],_0x5c7c74[_0x77114d(0x235)]),{'verbose':_0x5c118f[_0x77114d(0x278)]}),_0x363f53=_0xd57d82[_0x77114d(0x27f)],_0x3135e7=await executeSchemaQuery(_0x363f53,_0xcf4827,_0x5c118f);return await handleQueryOutput(_0x3135e7,_0x5c118f),0x0;}catch(_0x22c7ba){if(_0x22c7ba instanceof SDKError)return console[_0x77114d(0x200)]('Error:\x20'+_0x22c7ba[_0x77114d(0x1f0)]),_0x22c7ba[_0x77114d(0x286)]&&console[_0x77114d(0x200)](_0x77114d(0x204)+_0x22c7ba[_0x77114d(0x286)]),0x1;throw _0x22c7ba;}}}
1
+ const a37_0x1ed3d6=a37_0x2fdb;(function(_0x431491,_0xc3536d){const _0x5b6e5b=a37_0x2fdb,_0x20f629=_0x431491();while(!![]){try{const _0x102d1e=-parseInt(_0x5b6e5b(0x1dd))/0x1+-parseInt(_0x5b6e5b(0x1ec))/0x2*(parseInt(_0x5b6e5b(0x188))/0x3)+-parseInt(_0x5b6e5b(0x1a4))/0x4*(-parseInt(_0x5b6e5b(0x1df))/0x5)+parseInt(_0x5b6e5b(0x1c0))/0x6+-parseInt(_0x5b6e5b(0x16e))/0x7+-parseInt(_0x5b6e5b(0x1bb))/0x8*(parseInt(_0x5b6e5b(0x1d4))/0x9)+parseInt(_0x5b6e5b(0x1a7))/0xa;if(_0x102d1e===_0xc3536d)break;else _0x20f629['push'](_0x20f629['shift']());}catch(_0x4589f4){_0x20f629['push'](_0x20f629['shift']());}}}(a37_0x34b2,0x95189));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_0x34b2(){const _0x479115=['segmentName','segment:show','Resolved:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','jobId','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','3824XVEQzU','Folder\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','15744180WpuuNR','Parent\x20ID:\x20','segment:describe','Create\x20segment\x20folder\x20for\x20organization','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Use:\x20tdx\x20ps\x20view','\x20\x20tdx\x20sg\x20sql\x20--path\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Fetching\x20folder\x20details...','format','Resolving\x20parent\x20segment\x20\x27','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','length','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Use:\x20tdx\x20ps\x20view\x20-w','error','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Resolved\x20type:\x20','cause','jsonl','456XEfDRK','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','(root)','type','Resolving\x20path\x20\x27','5929626stTQHF','resolvePathToResource','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','query','verbose','\x20\x20Cause:\x20','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','\x20[Job\x20ID:\x20','fullPath','test','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Use:\x20tdx\x20ps\x20desc','Fetching\x20segment\x20details...','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','segment:folder:list','/e/','Folder\x20name:\x20','\x20Opening\x20','Fetching\x20SQL\x20from\x20rule...','96777inbMCc','Executing\x20segment\x20query...','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','✔\x20Created\x20folder\x20\x27','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Usage:\x20tdx\x20sg\x20show\x20<name>','\x27\x20with\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','\x20\x20Segment\x20name:\x20','678774OnApqE','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','65evkDJe','Creating\x20folder\x20\x27','Site:\x20','red','includes','replace','web','getSegmentSQLFromYaml','parentId','Get\x20SQL\x20query\x20for\x20child\x20segment','\x20rows\x20','Fetching\x20SQL\x20for\x20segment...','\x27...','46ypgIoa','segment:view','Parent\x20segment:\x20','Usage:\x20tdx\x20sg\x20desc\x20<name>','getSQLFromServerSegment','folder','getSegmentSQL','getSQLFromYamlFile','message','Show\x20folder\x20or\x20child\x20segment\x20details','Segment\x20ID:\x20','segment:folder:show','\x20\x20Full\x20path:\x20','Resolved\x20folder\x20ID:\x20','log','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','stats','resolveParentId','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','cyan','Error:\x20','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','segmentPath','in\x20','\x20folder','Show\x20child\x20segment\x20schema\x20(column\x20types)','segmentId','Options:','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','getFolder','site','442092JiZWHa','limit','resolveFolderId','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Target\x20path:\x20','Parent\x20name:\x20','/app/ps/','Resolved\x20parent\x20folder\x20ID:\x20','trim','segment:sql','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','Usage:\x20tdx\x20segment\x20describe\x20<path>','INVALID_ARGUMENT','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','folderId','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','getParent','segment:folder:create','\x20\x20Parent\x20segment:\x20','json','segment','SEGMENT_FOLDER_NOT_FOUND','Resolving\x20\x27','Examples:','toLocaleString','Resolving\x20folder\x20\x27','79509sLyeJe','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','execute','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','data','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','SEGMENT_NOT_FOUND','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','✔\x20Query\x20completed:\x20Processed\x20','\x20\x20Folder\x20path:\x20','description','parentFolder','parentSegment','Error:\x20Parent\x20segment\x20name\x20is\x20required','parent','Resolved\x20parent\x20ID:\x20','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','createFolder','name'];a37_0x34b2=function(){return _0x479115;};return a37_0x34b2();}import{executeSchemaQuery}from'../sdk/segment/fields-display.js';function a37_0x2fdb(_0x3abafd,_0x4be6fb){_0x3abafd=_0x3abafd-0x165;const _0x34b228=a37_0x34b2();let _0x2fdb47=_0x34b228[_0x3abafd];return _0x2fdb47;}import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0x117312 from'chalk';async function resolveSegmentTarget(_0x49ab2e,_0x14be3b,_0xa7a6f){const _0x59a645=a37_0x2fdb;if(isYamlFilePath(_0x49ab2e))try{const _0x174488=await resolveYamlFilePath(_0x49ab2e);return _0xa7a6f&&(console[_0x59a645(0x1b6)]('Resolved\x20YAML\x20file:\x20'+_0x49ab2e),console['error'](_0x59a645(0x180)+_0x174488[_0x59a645(0x194)]),console[_0x59a645(0x1b6)](_0x59a645(0x1dc)+_0x174488[_0x59a645(0x19b)]),console[_0x59a645(0x1b6)](_0x59a645(0x191)+(_0x174488['folderPath']||_0x59a645(0x1bd))),console[_0x59a645(0x1b6)](_0x59a645(0x1f8)+_0x174488[_0x59a645(0x1c8)])),_0x174488[_0x59a645(0x1c8)];}catch(_0x3afb1b){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x59a645(0x1a2)+_0x3afb1b[_0x59a645(0x1f4)]);}if(!_0x14be3b)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x59a645(0x1ab));return _0x14be3b+'/'+_0x49ab2e;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x1ed3d6(0x19a)]=a37_0x1ed3d6(0x1a9);['description']='Show\x20segment\x20or\x20folder\x20details';async[a37_0x1ed3d6(0x18a)](_0x120d6c){const _0x53c291=a37_0x1ed3d6,{options:_0xdb638a,args:_0x5721ae,tdx:_0x120d81}=_0x120d6c,_0x42c0a6=_0x5721ae[0x0],_0x364b4b=!_0x42c0a6&&!!_0xdb638a[_0x53c291(0x194)],_0x8f736b=_0x42c0a6||_0xdb638a[_0x53c291(0x194)];if(!_0x8f736b)return console[_0x53c291(0x1b6)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console['error'](_0x53c291(0x179)),console[_0x53c291(0x1b6)](_0x53c291(0x185)),console['error'](_0x53c291(0x204)),console[_0x53c291(0x1b6)](_0x53c291(0x1b7)),console[_0x53c291(0x1b6)]('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console[_0x53c291(0x1b6)](_0x53c291(0x18b)),0x1;try{const _0x45938e=_0xdb638a[_0x53c291(0x165)];let _0x27b77e=_0x8f736b;!_0x364b4b&&_0x45938e&&!_0x8f736b[_0x53c291(0x1e3)]('/')&&(_0x27b77e=_0x45938e+'/'+_0x8f736b,_0xdb638a[_0x53c291(0x1c4)]&&console[_0x53c291(0x1b6)]('Resolved\x20relative\x20path\x20to:\x20'+_0x27b77e));const _0x3f0300=await withSpinner(_0x53c291(0x1bf)+_0x27b77e+_0x53c291(0x1eb),()=>_0x120d81['segment'][_0x53c291(0x1c1)](_0x27b77e),{'verbose':_0xdb638a[_0x53c291(0x1c4)]}),_0xbc1110=_0x3f0300[_0x53c291(0x18c)];_0xdb638a[_0x53c291(0x1c4)]&&(console[_0x53c291(0x1b6)](_0x53c291(0x1b8)+_0xbc1110['type']),console[_0x53c291(0x1b6)](_0x53c291(0x1a8)+_0xbc1110[_0x53c291(0x1e7)]),_0xbc1110[_0x53c291(0x17c)]&&console[_0x53c291(0x1b6)]('Folder\x20ID:\x20'+_0xbc1110[_0x53c291(0x17c)]),_0xbc1110[_0x53c291(0x169)]&&console[_0x53c291(0x1b6)]('Segment\x20ID:\x20'+_0xbc1110[_0x53c291(0x169)]));if(_0xbc1110['type']==='parent'){const _0x385eb6=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x120d81[_0x53c291(0x182)][_0x53c291(0x17e)](_0xbc1110[_0x53c291(0x1e7)]),{'verbose':_0xdb638a[_0x53c291(0x1c4)]});await handleSingleObjectOutput(_0x385eb6['data'],_0xdb638a);}else{if(_0xbc1110[_0x53c291(0x1be)]==='folder'){if(!_0xbc1110['folderId'])throw new SDKError(ErrorCode[_0x53c291(0x183)],_0x53c291(0x1a5));const _0x4d8e36=await withSpinner(_0x53c291(0x1af),()=>_0x120d81[_0x53c291(0x182)][_0x53c291(0x16c)](_0xbc1110['folderId']),{'verbose':_0xdb638a[_0x53c291(0x1c4)]});await handleSingleObjectOutput(_0x4d8e36[_0x53c291(0x18c)],_0xdb638a);}else{if(_0xbc1110[_0x53c291(0x1be)]===_0x53c291(0x182)){if(!_0xbc1110[_0x53c291(0x169)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x53c291(0x1d8));const _0x4c5e53=await withSpinner(_0x53c291(0x1cd),()=>_0x120d81[_0x53c291(0x182)]['getSegment'](_0xbc1110[_0x53c291(0x1e7)],_0xbc1110[_0x53c291(0x169)]),{'verbose':_0xdb638a[_0x53c291(0x1c4)]});await handleSingleObjectOutput(_0x4c5e53[_0x53c291(0x18c)],_0xdb638a);}}}return 0x0;}catch(_0x430a22){if(_0x430a22 instanceof SDKError)return console[_0x53c291(0x1b6)]('Error:\x20'+_0x430a22[_0x53c291(0x1f4)]),_0x430a22['cause']&&console[_0x53c291(0x1b6)](_0x53c291(0x1c5)+_0x430a22[_0x53c291(0x1b9)]),0x1;throw _0x430a22;}}}export class SegmentShowCommand extends BaseCommand{['name']=a37_0x1ed3d6(0x19c);[a37_0x1ed3d6(0x192)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a37_0x1ed3d6(0x18a)](_0x3115a0){const _0x33d1f8=a37_0x1ed3d6,{options:_0x4fcf61,args:_0x6db561,tdx:_0x48a11e}=_0x3115a0,_0x15bf50=_0x6db561[0x0];if(!_0x15bf50)return console[_0x33d1f8(0x1b6)](_0x33d1f8(0x17b)),console['error'](_0x33d1f8(0x1d9)),console[_0x33d1f8(0x1b6)](_0x33d1f8(0x1c2)),console[_0x33d1f8(0x1b6)](_0x33d1f8(0x185)),console[_0x33d1f8(0x1b6)](_0x33d1f8(0x1a6)),console[_0x33d1f8(0x1b6)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x4fb328=_0x4fcf61[_0x33d1f8(0x194)],_0x584417=await resolveSegmentTarget(_0x15bf50,_0x4fb328,_0x4fcf61[_0x33d1f8(0x1c4)]);_0x4fcf61[_0x33d1f8(0x1c4)]&&console['error'](_0x33d1f8(0x172)+_0x584417);const _0x201008=await withSpinner(_0x33d1f8(0x184)+_0x15bf50+_0x33d1f8(0x1eb),()=>_0x48a11e[_0x33d1f8(0x182)]['resolvePathToResource'](_0x584417),{'verbose':_0x4fcf61['verbose']}),_0x27d850=_0x201008[_0x33d1f8(0x18c)];_0x4fcf61[_0x33d1f8(0x1c4)]&&(console[_0x33d1f8(0x1b6)](_0x33d1f8(0x1b8)+_0x27d850[_0x33d1f8(0x1be)]),console[_0x33d1f8(0x1b6)](_0x33d1f8(0x1a8)+_0x27d850['parentId']));if(_0x27d850[_0x33d1f8(0x1be)]===_0x33d1f8(0x1f1))return console['error']('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0x33d1f8(0x1b6)](_0x33d1f8(0x1ca)),0x1;if(_0x27d850[_0x33d1f8(0x1be)]===_0x33d1f8(0x196))return console[_0x33d1f8(0x1b6)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x33d1f8(0x1b6)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x27d850[_0x33d1f8(0x169)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x33d1f8(0x1d8));const _0x5df642=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x48a11e[_0x33d1f8(0x182)][_0x33d1f8(0x1f2)](_0x27d850[_0x33d1f8(0x1e7)],_0x27d850[_0x33d1f8(0x169)]),{'verbose':_0x4fcf61['verbose']});let _0x2c811a=_0x5df642['data'];const _0x177a12=resolveLimit(_0x4fcf61[_0x33d1f8(0x16f)],DEFAULT_DISPLAY_LIMIT),_0x5a55f4=/\bLIMIT\s+\d+/i[_0x33d1f8(0x1c9)](_0x2c811a);!_0x5a55f4&&(_0x2c811a=_0x2c811a[_0x33d1f8(0x176)]()[_0x33d1f8(0x1e4)](/;+$/,''),_0x2c811a='SELECT\x20*\x20FROM\x20(\x0a'+_0x2c811a+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x177a12);_0x4fcf61[_0x33d1f8(0x1c4)]&&console[_0x33d1f8(0x1b6)]('SQL\x20query:\x0a'+_0x2c811a);const _0x2d09ef=await withProgressSpinner(_0x33d1f8(0x1d5),async _0x5bdbbd=>{const _0x51cf3f=_0x33d1f8,_0x5b6923=await _0x48a11e[_0x51cf3f(0x1c3)][_0x51cf3f(0x18a)](_0x2c811a,{'catalog':'td','schema':'information_schema','onJobId':_0x302150=>{_0x5bdbbd['setJobId'](_0x302150);}});return _0x5b6923;},{'verbose':_0x4fcf61[_0x33d1f8(0x1c4)]}),_0x2a16bb=_0x2d09ef[_0x33d1f8(0x18c)],_0x282366=_0x2a16bb[_0x33d1f8(0x19f)]?_0x33d1f8(0x1c7)+_0x2a16bb[_0x33d1f8(0x19f)]+']':'';return console[_0x33d1f8(0x1b6)](_0x33d1f8(0x190)+_0x2a16bb['stats']['processedRows'][_0x33d1f8(0x186)]()+_0x33d1f8(0x1e9)+(_0x33d1f8(0x166)+formatElapsed(_0x2a16bb[_0x33d1f8(0x1fc)]['elapsedTimeMillis'])+_0x282366)),await handleQueryOutput(_0x2a16bb,_0x4fcf61),0x0;}catch(_0x306c35){if(_0x306c35 instanceof SDKError)return console[_0x33d1f8(0x1b6)]('✖\x20Query\x20failed\x20['+_0x306c35['code']+']'),console[_0x33d1f8(0x1b6)]('\x0a'+_0x306c35['message']),0x1;throw _0x306c35;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x1ed3d6(0x19a)]=a37_0x1ed3d6(0x1cf);[a37_0x1ed3d6(0x192)]=a37_0x1ed3d6(0x1c6);async[a37_0x1ed3d6(0x18a)](_0x3d4fce){const _0x243ab3=a37_0x1ed3d6,{options:_0xe4b892,args:_0x2177fe,tdx:_0x58cc8a}=_0x3d4fce;if(_0x2177fe[_0x243ab3(0x1b3)]===0x0)return console[_0x243ab3(0x1b6)](_0x243ab3(0x195)),console['error'](_0x243ab3(0x17d)),0x1;const _0xe555ee=_0x2177fe[0x0];try{_0xe4b892[_0x243ab3(0x1c4)]&&(console[_0x243ab3(0x1b6)](_0x243ab3(0x1e1)+_0xe4b892[_0x243ab3(0x16d)]),console[_0x243ab3(0x1b6)](_0x243ab3(0x173)+_0xe555ee));const _0x19ebc6=await withSpinner(_0x243ab3(0x1b1)+_0xe555ee+_0x243ab3(0x1eb),()=>_0x58cc8a['segment'][_0x243ab3(0x1fd)](_0xe555ee),{'verbose':_0xe4b892['verbose']}),_0x1d43a5=_0x19ebc6[_0x243ab3(0x18c)];_0xe4b892[_0x243ab3(0x1c4)]&&console[_0x243ab3(0x1b6)](_0x243ab3(0x197)+_0x1d43a5);const _0xf8f0d1=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0xe555ee+_0x243ab3(0x1eb),()=>_0x58cc8a[_0x243ab3(0x182)]['listFolders'](_0x1d43a5),{'verbose':_0xe4b892[_0x243ab3(0x1c4)]}),_0x45abe4=_0xf8f0d1[_0x243ab3(0x18c)];return console[_0x243ab3(0x1b6)]('✔\x20Found\x20'+_0x45abe4[_0x243ab3(0x1b3)]+_0x243ab3(0x167)+(_0x45abe4[_0x243ab3(0x1b3)]!==0x1?'s':'')),await handleSDKOutput(_0x45abe4,_0xe4b892),0x0;}catch(_0x4128c1){if(_0x4128c1 instanceof SDKError)return console[_0x243ab3(0x1b6)](_0x243ab3(0x200)+_0x4128c1[_0x243ab3(0x1f4)]),_0x4128c1[_0x243ab3(0x1b9)]&&console[_0x243ab3(0x1b6)](_0x243ab3(0x1c5)+_0x4128c1[_0x243ab3(0x1b9)]),0x1;throw _0x4128c1;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a37_0x1ed3d6(0x1f7);[a37_0x1ed3d6(0x192)]='Show\x20segment\x20folder\x20details';async['execute'](_0x480362){const _0x491aae=a37_0x1ed3d6,{options:_0x2a7429,args:_0x2d4d78,tdx:_0x1d07ce}=_0x480362;if(_0x2d4d78[_0x491aae(0x1b3)]===0x0)return console[_0x491aae(0x1b6)]('Error:\x20Folder\x20reference\x20is\x20required'),console[_0x491aae(0x1b6)](_0x491aae(0x198)),0x1;try{const {parentId:_0x3aaa07,childId:_0x58bd05}=parseSegmentRef(_0x2d4d78[0x0]);_0x2a7429[_0x491aae(0x1c4)]&&(console[_0x491aae(0x1b6)](_0x491aae(0x1e1)+_0x2a7429[_0x491aae(0x16d)]),console[_0x491aae(0x1b6)](_0x491aae(0x173)+_0x3aaa07),_0x58bd05&&console[_0x491aae(0x1b6)]('Folder\x20name:\x20'+_0x58bd05));if(!_0x58bd05)return console[_0x491aae(0x1b6)](_0x491aae(0x16b)),0x1;const _0x13da36=await withSpinner(_0x491aae(0x1b1)+_0x3aaa07+_0x491aae(0x1eb),()=>_0x1d07ce[_0x491aae(0x182)][_0x491aae(0x1fd)](_0x3aaa07),{'verbose':_0x2a7429[_0x491aae(0x1c4)]}),_0x51f96e=_0x13da36[_0x491aae(0x18c)];_0x2a7429['verbose']&&console[_0x491aae(0x1b6)]('Resolved\x20parent\x20ID:\x20'+_0x51f96e);const _0x4a96de=await withSpinner(_0x491aae(0x187)+_0x58bd05+_0x491aae(0x1eb),()=>_0x1d07ce[_0x491aae(0x182)][_0x491aae(0x170)](_0x51f96e,_0x58bd05),{'verbose':_0x2a7429[_0x491aae(0x1c4)]}),_0x15b9ee=_0x4a96de['data'];_0x2a7429[_0x491aae(0x1c4)]&&console[_0x491aae(0x1b6)](_0x491aae(0x1f9)+_0x15b9ee);const _0x49efcc=await withSpinner('Fetching\x20folder\x20\x27'+_0x58bd05+_0x491aae(0x1eb),()=>_0x1d07ce[_0x491aae(0x182)][_0x491aae(0x16c)](_0x15b9ee),{'verbose':_0x2a7429[_0x491aae(0x1c4)]});return await handleSDKOutput([_0x49efcc[_0x491aae(0x18c)]],_0x2a7429),0x0;}catch(_0x254af6){if(_0x254af6 instanceof SDKError)return console['error'](_0x491aae(0x200)+_0x254af6[_0x491aae(0x1f4)]),_0x254af6[_0x491aae(0x1b9)]&&console['error'](_0x491aae(0x1c5)+_0x254af6['cause']),0x1;throw _0x254af6;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a37_0x1ed3d6(0x177);['description']=a37_0x1ed3d6(0x1e8);async[a37_0x1ed3d6(0x18a)](_0x308d0b){const _0x2887fa=a37_0x1ed3d6,{options:_0x40d99d,args:_0x597cdb}=_0x308d0b,_0x3b5b6b=_0x40d99d,_0xaf2828=_0x3b5b6b['path'],_0x5f2327=_0x597cdb[0x0];if(!_0x5f2327&&!_0xaf2828)return console[_0x2887fa(0x1b6)](a37_0x117312[_0x2887fa(0x1e2)](_0x2887fa(0x1ce))),console[_0x2887fa(0x1b6)]('Usage:'),console[_0x2887fa(0x1b6)](_0x2887fa(0x18f)),console[_0x2887fa(0x1b6)](_0x2887fa(0x1de)),console[_0x2887fa(0x1b6)](_0x2887fa(0x185)),console[_0x2887fa(0x1b6)](_0x2887fa(0x201)),console['error'](_0x2887fa(0x1b2)),0x1;if(_0x5f2327&&_0xaf2828)return console[_0x2887fa(0x1b6)](a37_0x117312[_0x2887fa(0x1e2)](_0x2887fa(0x1a0))),0x1;try{let _0x127250;if(_0xaf2828)_0x127250=await this[_0x2887fa(0x1f3)](_0xaf2828,_0x308d0b);else{if(isYamlFilePath(_0x5f2327))return console[_0x2887fa(0x1b6)](a37_0x117312[_0x2887fa(0x1e2)]('Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option')),console[_0x2887fa(0x1b6)](_0x2887fa(0x1ad)+_0x5f2327),0x1;else _0x127250=await this[_0x2887fa(0x1f0)](_0x5f2327,_0x308d0b);}return _0x40d99d[_0x2887fa(0x1b0)]===_0x2887fa(0x181)||_0x40d99d['format']===_0x2887fa(0x1ba)?await handleSDKOutput([{'sql':_0x127250}],_0x40d99d):console[_0x2887fa(0x1fa)](_0x127250),0x0;}catch(_0x4f05b2){if(_0x4f05b2 instanceof SDKError)return console[_0x2887fa(0x1b6)]('Error:\x20'+_0x4f05b2[_0x2887fa(0x1f4)]),_0x4f05b2[_0x2887fa(0x1b9)]&&console[_0x2887fa(0x1b6)](_0x2887fa(0x1c5)+_0x4f05b2[_0x2887fa(0x1b9)]),0x1;throw _0x4f05b2;}}async['getSQLFromYamlFile'](_0x52a216,_0x3c0df5){const _0x2062e1=a37_0x1ed3d6,{options:_0x72c434,tdx:_0x1214fd}=_0x3c0df5;let _0x4c115f;try{_0x4c115f=await resolveYamlFilePath(_0x52a216);}catch(_0x1c3b4b){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2062e1(0x1a2)+_0x1c3b4b[_0x2062e1(0x1f4)]);}_0x72c434[_0x2062e1(0x1c4)]&&console[_0x2062e1(0x1b6)](_0x2062e1(0x19d)+_0x4c115f['parentSegment']+'/'+_0x4c115f[_0x2062e1(0x19b)]);const _0x2d1a03=await withSpinner(_0x2062e1(0x1d3),()=>_0x1214fd[_0x2062e1(0x182)][_0x2062e1(0x1e6)](_0x4c115f['content'],_0x4c115f[_0x2062e1(0x194)],_0x4c115f[_0x2062e1(0x19b)]),{'verbose':_0x72c434[_0x2062e1(0x1c4)]});return _0x2d1a03[_0x2062e1(0x18c)];}async[a37_0x1ed3d6(0x1f0)](_0x546b61,_0x4bb10a){const _0x56705f=a37_0x1ed3d6,{options:_0xcf7ba4,tdx:_0x4e0c13}=_0x4bb10a,_0x4229ad=_0xcf7ba4[_0x56705f(0x194)],_0x295bf3=await resolveSegmentTarget(_0x546b61,_0x4229ad,_0xcf7ba4[_0x56705f(0x1c4)]);_0xcf7ba4[_0x56705f(0x1c4)]&&console['error'](_0x56705f(0x172)+_0x295bf3);const _0x539dfa=await withSpinner(_0x56705f(0x184)+_0x546b61+_0x56705f(0x1eb),()=>_0x4e0c13['segment'][_0x56705f(0x1c1)](_0x295bf3),{'verbose':_0xcf7ba4[_0x56705f(0x1c4)]}),_0xbf79f4=_0x539dfa['data'];_0xcf7ba4['verbose']&&(console[_0x56705f(0x1b6)](_0x56705f(0x1b8)+_0xbf79f4[_0x56705f(0x1be)]),console['error'](_0x56705f(0x1a8)+_0xbf79f4[_0x56705f(0x1e7)]));if(_0xbf79f4['type']===_0x56705f(0x1f1))throw new SDKError(ErrorCode[_0x56705f(0x17a)],'Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.');if(_0xbf79f4[_0x56705f(0x1be)]==='parent')throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x56705f(0x178));if(!_0xbf79f4['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x56705f(0x1d8));const _0x102446=await withSpinner(_0x56705f(0x1ea),()=>_0x4e0c13['segment'][_0x56705f(0x1f2)](_0xbf79f4[_0x56705f(0x1e7)],_0xbf79f4[_0x56705f(0x169)]),{'verbose':_0xcf7ba4[_0x56705f(0x1c4)]});return _0x102446[_0x56705f(0x18c)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x1ed3d6(0x19a)]=a37_0x1ed3d6(0x17f);[a37_0x1ed3d6(0x192)]=a37_0x1ed3d6(0x1aa);async[a37_0x1ed3d6(0x18a)](_0x54890c){const _0x2a49ed=a37_0x1ed3d6,{options:_0x4287be,args:_0x4a592d,tdx:_0x2d9a2c}=_0x54890c,_0x1c4154=_0x4287be;if(_0x4a592d[_0x2a49ed(0x1b3)]<0x2)return console[_0x2a49ed(0x1b6)](_0x2a49ed(0x18d)),console[_0x2a49ed(0x1b6)](_0x2a49ed(0x1fb)),0x1;const _0x38da50=_0x4a592d[0x0],_0x1852df=_0x4a592d[0x1];_0x1c4154[_0x2a49ed(0x1c4)]&&(console[_0x2a49ed(0x1b6)](_0x2a49ed(0x1e1)+_0x1c4154[_0x2a49ed(0x16d)]),console[_0x2a49ed(0x1b6)](_0x2a49ed(0x1ee)+_0x38da50),console[_0x2a49ed(0x1b6)](_0x2a49ed(0x1d1)+_0x1852df));let _0x25352a;if(_0x1c4154[_0x2a49ed(0x193)]){const _0x2ff4ac=_0x1c4154['parentFolder'],_0x20884c=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x38da50+_0x2a49ed(0x1eb),()=>_0x2d9a2c['segment'][_0x2a49ed(0x1fd)](_0x38da50),{'verbose':_0x1c4154[_0x2a49ed(0x1c4)]}),_0xb382c3=_0x20884c['data'],_0x22329f=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x2ff4ac+_0x2a49ed(0x1eb),()=>_0x2d9a2c['segment'][_0x2a49ed(0x170)](_0xb382c3,_0x2ff4ac),{'verbose':_0x1c4154[_0x2a49ed(0x1c4)]});_0x25352a=_0x22329f['data'],_0x1c4154[_0x2a49ed(0x1c4)]&&console[_0x2a49ed(0x1b6)](_0x2a49ed(0x175)+_0x25352a);}const _0x84d61d={'name':_0x1852df,'description':_0x1c4154[_0x2a49ed(0x192)],'parentFolderId':_0x25352a},_0x138d0b=await withSpinner(_0x2a49ed(0x1e0)+_0x1852df+_0x2a49ed(0x1eb),()=>_0x2d9a2c[_0x2a49ed(0x182)][_0x2a49ed(0x199)](_0x38da50,_0x84d61d),{'verbose':_0x1c4154[_0x2a49ed(0x1c4)]}),_0x3a0b1c=_0x138d0b[_0x2a49ed(0x18c)];return console[_0x2a49ed(0x1b6)](_0x2a49ed(0x1d7)+_0x3a0b1c[_0x2a49ed(0x19a)]+_0x2a49ed(0x1da)+_0x3a0b1c['id']),await handleSDKOutput([_0x3a0b1c],_0x1c4154),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x1ed3d6(0x19a)]=a37_0x1ed3d6(0x1ed);[a37_0x1ed3d6(0x192)]=a37_0x1ed3d6(0x1f5);async['execute'](_0x55adf3){const _0x4da2bc=a37_0x1ed3d6,{options:_0x172980,args:_0x44e3b8,tdx:_0x120280}=_0x55adf3,_0x2d1ebd=_0x44e3b8[0x0];if(!_0x2d1ebd)return console[_0x4da2bc(0x1b6)](_0x4da2bc(0x202)),console['error']('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console['error'](_0x4da2bc(0x1db)),console[_0x4da2bc(0x1b6)](_0x4da2bc(0x16a)),console['error']('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x4da2bc(0x1b6)](_0x4da2bc(0x185)),console[_0x4da2bc(0x1b6)](_0x4da2bc(0x1fe)),console[_0x4da2bc(0x1b6)](_0x4da2bc(0x171)),console[_0x4da2bc(0x1b6)](_0x4da2bc(0x19e)),console['error'](_0x4da2bc(0x1a1)),0x1;try{const _0x20dce3=_0x172980['parentSegment'],_0x4cb0c9=await resolveSegmentTarget(_0x2d1ebd,_0x20dce3,_0x172980[_0x4da2bc(0x1c4)]);_0x172980[_0x4da2bc(0x1c4)]&&console[_0x4da2bc(0x1b6)](_0x4da2bc(0x172)+_0x4cb0c9);const _0x34a2b9=await withSpinner(_0x4da2bc(0x184)+_0x2d1ebd+_0x4da2bc(0x1eb),()=>_0x120280['segment'][_0x4da2bc(0x1c1)](_0x4cb0c9),{'verbose':_0x172980[_0x4da2bc(0x1c4)]}),_0x2f8112=_0x34a2b9['data'];_0x172980[_0x4da2bc(0x1c4)]&&(console[_0x4da2bc(0x1b6)]('Resolved\x20type:\x20'+_0x2f8112['type']),console['error']('Parent\x20ID:\x20'+_0x2f8112[_0x4da2bc(0x1e7)]),_0x2f8112[_0x4da2bc(0x17c)]&&console[_0x4da2bc(0x1b6)]('Folder\x20ID:\x20'+_0x2f8112[_0x4da2bc(0x17c)]),_0x2f8112[_0x4da2bc(0x169)]&&console[_0x4da2bc(0x1b6)](_0x4da2bc(0x1f6)+_0x2f8112['segmentId']));if(_0x172980[_0x4da2bc(0x1e5)]){if(_0x2f8112['type']===_0x4da2bc(0x1f1))return console[_0x4da2bc(0x1b6)](_0x4da2bc(0x1bc)),0x1;if(_0x2f8112[_0x4da2bc(0x1be)]==='parent')return console[_0x4da2bc(0x1b6)](_0x4da2bc(0x1a3)),console['error'](_0x4da2bc(0x1b5)),0x1;if(!_0x2f8112['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x4da2bc(0x1d8));const _0x348378=getConsoleNextUrl(_0x172980[_0x4da2bc(0x16d)],_0x4da2bc(0x174)+_0x2f8112[_0x4da2bc(0x1e7)]+_0x4da2bc(0x1d0)+_0x2f8112['segmentId']);return console[_0x4da2bc(0x1b6)](a37_0x117312['green']('✔')+_0x4da2bc(0x1d2)+a37_0x117312[_0x4da2bc(0x1ff)](_0x348378)),openBrowser(_0x348378),0x0;}if(_0x2f8112[_0x4da2bc(0x1be)]==='folder'){if(!_0x2f8112['folderId'])throw new SDKError(ErrorCode[_0x4da2bc(0x183)],_0x4da2bc(0x1a5));const _0x22975c=await withSpinner('Fetching\x20folder\x20details...',()=>_0x120280[_0x4da2bc(0x182)][_0x4da2bc(0x16c)](_0x2f8112[_0x4da2bc(0x17c)]),{'verbose':_0x172980[_0x4da2bc(0x1c4)]});await handleSingleObjectOutput(_0x22975c[_0x4da2bc(0x18c)],_0x172980);}else{if(_0x2f8112[_0x4da2bc(0x1be)]==='segment'){if(!_0x2f8112[_0x4da2bc(0x169)])throw new SDKError(ErrorCode[_0x4da2bc(0x18e)],_0x4da2bc(0x1d8));const _0x2d78a3=await withSpinner('Fetching\x20segment\x20details...',()=>_0x120280[_0x4da2bc(0x182)]['getSegment'](_0x2f8112[_0x4da2bc(0x1e7)],_0x2f8112[_0x4da2bc(0x169)]),{'verbose':_0x172980[_0x4da2bc(0x1c4)]}),_0x3f43b4=getConsoleNextUrl(_0x172980[_0x4da2bc(0x16d)],_0x4da2bc(0x174)+_0x2f8112[_0x4da2bc(0x1e7)]+_0x4da2bc(0x1d0)+_0x2f8112[_0x4da2bc(0x169)]),_0x26d3d3=_0x2d78a3[_0x4da2bc(0x18c)];_0x26d3d3['url']=_0x3f43b4,await handleSingleObjectOutput(_0x26d3d3,_0x172980);}else return console[_0x4da2bc(0x1b6)](_0x4da2bc(0x1cb)),console[_0x4da2bc(0x1b6)](_0x4da2bc(0x1ac)),0x1;}return 0x0;}catch(_0x22c582){if(_0x22c582 instanceof SDKError)return console[_0x4da2bc(0x1b6)](_0x4da2bc(0x200)+_0x22c582[_0x4da2bc(0x1f4)]),_0x22c582[_0x4da2bc(0x1b9)]&&console['error'](_0x4da2bc(0x1c5)+_0x22c582[_0x4da2bc(0x1b9)]),0x1;throw _0x22c582;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x1ed3d6(0x19a)]='segment:desc';['description']=a37_0x1ed3d6(0x168);async['execute'](_0x39f948){const _0x3d59b4=a37_0x1ed3d6,{options:_0x2b98b2,args:_0x3639f9,tdx:_0x36f531}=_0x39f948,_0x2cd71a=_0x3639f9[0x0];if(!_0x2cd71a)return console[_0x3d59b4(0x1b6)](_0x3d59b4(0x17b)),console[_0x3d59b4(0x1b6)](_0x3d59b4(0x1ef)),console['error'](_0x3d59b4(0x1ae)),console['error']('Examples:'),console[_0x3d59b4(0x1b6)](_0x3d59b4(0x203)),console[_0x3d59b4(0x1b6)](_0x3d59b4(0x1d6)),0x1;try{const _0x49abfc=_0x2b98b2[_0x3d59b4(0x194)],_0x5520c4=await resolveSegmentTarget(_0x2cd71a,_0x49abfc,_0x2b98b2[_0x3d59b4(0x1c4)]);_0x2b98b2['verbose']&&console[_0x3d59b4(0x1b6)](_0x3d59b4(0x172)+_0x5520c4);const _0x5c5d38=await withSpinner('Resolving\x20\x27'+_0x2cd71a+_0x3d59b4(0x1eb),()=>_0x36f531['segment'][_0x3d59b4(0x1c1)](_0x5520c4),{'verbose':_0x2b98b2['verbose']}),_0x439a64=_0x5c5d38[_0x3d59b4(0x18c)];_0x2b98b2[_0x3d59b4(0x1c4)]&&(console[_0x3d59b4(0x1b6)](_0x3d59b4(0x1b8)+_0x439a64['type']),console[_0x3d59b4(0x1b6)]('Parent\x20ID:\x20'+_0x439a64[_0x3d59b4(0x1e7)]));if(_0x439a64[_0x3d59b4(0x1be)]===_0x3d59b4(0x1f1))return console[_0x3d59b4(0x1b6)](_0x3d59b4(0x189)),console['error'](_0x3d59b4(0x1b4)),0x1;if(_0x439a64['type']===_0x3d59b4(0x196))return console[_0x3d59b4(0x1b6)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x3d59b4(0x1b6)](_0x3d59b4(0x1cc)),0x1;if(!_0x439a64['segmentId'])throw new SDKError(ErrorCode[_0x3d59b4(0x18e)],_0x3d59b4(0x1d8));const _0x495e2e=await withSpinner(_0x3d59b4(0x1ea),()=>_0x36f531[_0x3d59b4(0x182)][_0x3d59b4(0x1f2)](_0x439a64[_0x3d59b4(0x1e7)],_0x439a64[_0x3d59b4(0x169)]),{'verbose':_0x2b98b2[_0x3d59b4(0x1c4)]}),_0x231d2c=_0x495e2e[_0x3d59b4(0x18c)],_0x39dc5e=await executeSchemaQuery(_0x231d2c,_0x36f531,_0x2b98b2);return await handleQueryOutput(_0x39dc5e,_0x2b98b2),0x0;}catch(_0xa635c9){if(_0xa635c9 instanceof SDKError)return console[_0x3d59b4(0x1b6)]('Error:\x20'+_0xa635c9['message']),_0xa635c9[_0x3d59b4(0x1b9)]&&console[_0x3d59b4(0x1b6)](_0x3d59b4(0x1c5)+_0xa635c9[_0x3d59b4(0x1b9)]),0x1;throw _0xa635c9;}}}
@@ -1 +1 @@
1
- const a38_0x1b496f=a38_0x3769;(function(_0x2c6d8d,_0x104286){const _0x466a42=a38_0x3769,_0x51de83=_0x2c6d8d();while(!![]){try{const _0x12afd3=parseInt(_0x466a42(0xe3))/0x1*(-parseInt(_0x466a42(0xd4))/0x2)+parseInt(_0x466a42(0xd1))/0x3*(-parseInt(_0x466a42(0xe4))/0x4)+-parseInt(_0x466a42(0xf4))/0x5+parseInt(_0x466a42(0xe8))/0x6*(parseInt(_0x466a42(0xf5))/0x7)+parseInt(_0x466a42(0xdc))/0x8+parseInt(_0x466a42(0xf6))/0x9+-parseInt(_0x466a42(0xfb))/0xa*(-parseInt(_0x466a42(0xe5))/0xb);if(_0x12afd3===_0x104286)break;else _0x51de83['push'](_0x51de83['shift']());}catch(_0x13537f){_0x51de83['push'](_0x51de83['shift']());}}}(a38_0x3cf2,0xb5f61));function a38_0x3769(_0x3e1416,_0x42a03a){_0x3e1416=_0x3e1416-0xcd;const _0x3cf208=a38_0x3cf2();let _0x3769cb=_0x3cf208[_0x3e1416];return _0x3769cb;}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a38_0x3cf2(){const _0x479906=['segment','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','2454bVHLJO','error','length','verbose','execute','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','kind','resolvePathToResource','parent','folderId','Parent\x20path:\x20','5614350xruQmh','23961bfjILa','6727446IezOtO','\x27\x20with\x20ID:\x20','name','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','Resolving\x20folder\x20path\x20\x27','4832510YHqlhP','resolveParentId','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','yellow','type','Create\x20child\x20segment\x20with\x20filtering\x20rules','noCountPopulation','segmentPath','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','folder','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','3PdpXSz','Target\x20path:\x20','data','14dMnKzT','✔\x20Created\x20segment\x20\x27','Site:\x20','segments','ruleFile','Creating\x20segment\x20\x27','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','site','8008352DZjlcF','Segment\x20name:\x20','\x20\x20\x20Path:\x20','includes','description','\x27...','invisible','129413dZRvJg','5363892YrQxtn','22UjnVXt'];a38_0x3cf2=function(){return _0x479906;};return a38_0x3cf2();}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_0x3aff1e from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']='segment:create';['description']=a38_0x1b496f(0x101);async[a38_0x1b496f(0xec)](_0x4e0ee3){const _0x5ddaeb=a38_0x1b496f;console[_0x5ddaeb(0xe9)](a38_0x3aff1e[_0x5ddaeb(0xff)](_0x5ddaeb(0xf9))),console['error'](a38_0x3aff1e['yellow'](_0x5ddaeb(0xfe)));const {options:_0x251c48,args:_0x176a09,tdx:_0x173928}=_0x4e0ee3,_0x4cfd10=_0x251c48;if(_0x176a09['length']===0x0)return console[_0x5ddaeb(0xe9)](_0x5ddaeb(0xda)),console[_0x5ddaeb(0xe9)](_0x5ddaeb(0xee)),console['error']('Examples:'),console[_0x5ddaeb(0xe9)](_0x5ddaeb(0xd0)),console['error'](_0x5ddaeb(0xe7)),console['error'](_0x5ddaeb(0xce)),0x1;const _0x1e83ec=_0x176a09[0x0],_0x45e7ec=_0x251c48[_0x5ddaeb(0xcd)];let _0x2607f1=_0x1e83ec;_0x45e7ec&&!_0x1e83ec[_0x5ddaeb(0xdf)]('/')&&(_0x2607f1=_0x45e7ec+'/'+_0x1e83ec,_0x4cfd10[_0x5ddaeb(0xeb)]&&console[_0x5ddaeb(0xe9)]('Resolved\x20relative\x20path\x20to:\x20'+_0x2607f1));const _0x453dd6=parsePath(_0x2607f1);if(_0x453dd6[_0x5ddaeb(0xd7)]['length']<0x2)return console[_0x5ddaeb(0xe9)]('Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'),console[_0x5ddaeb(0xe9)](_0x5ddaeb(0xfd)),0x1;const _0x4198e4=_0x453dd6['segments'][0x0],_0x3926ee=getBaseName(_0x2607f1),_0x1b9729=getParentPath(_0x2607f1);_0x4cfd10[_0x5ddaeb(0xeb)]&&(console[_0x5ddaeb(0xe9)](_0x5ddaeb(0xd6)+_0x4cfd10[_0x5ddaeb(0xdb)]),console[_0x5ddaeb(0xe9)](_0x5ddaeb(0xd2)+_0x2607f1),console[_0x5ddaeb(0xe9)]('Parent:\x20'+_0x4198e4),console['error'](_0x5ddaeb(0xdd)+_0x3926ee),console[_0x5ddaeb(0xe9)](_0x5ddaeb(0xf3)+_0x1b9729));const _0x311f7e=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x4198e4+_0x5ddaeb(0xe1),()=>_0x173928[_0x5ddaeb(0xe6)][_0x5ddaeb(0xfc)](_0x4198e4),{'verbose':_0x4cfd10['verbose']}),_0x3a8046=_0x311f7e['data'];let _0x1c4028;if(_0x453dd6[_0x5ddaeb(0xd7)][_0x5ddaeb(0xea)]>0x2){const _0x3b4e2e=await withSpinner(_0x5ddaeb(0xfa)+_0x1b9729+'\x27...',()=>_0x173928[_0x5ddaeb(0xe6)][_0x5ddaeb(0xf0)](_0x1b9729),{'verbose':_0x4cfd10['verbose']}),_0x5f26a7=_0x3b4e2e['data'];if(_0x5f26a7[_0x5ddaeb(0x100)]!=='folder'&&_0x5f26a7[_0x5ddaeb(0x100)]!==_0x5ddaeb(0xf1))return console[_0x5ddaeb(0xe9)](_0x5ddaeb(0xed)),0x1;_0x1c4028=_0x5f26a7[_0x5ddaeb(0xf2)];}else{if(_0x4cfd10[_0x5ddaeb(0xcf)]){const _0x4b4660=await withSpinner('Resolving\x20folder\x20\x27'+_0x4cfd10['folder']+_0x5ddaeb(0xe1),()=>_0x173928[_0x5ddaeb(0xe6)]['resolveFolderId'](_0x3a8046,_0x4cfd10['folder']),{'verbose':_0x4cfd10[_0x5ddaeb(0xeb)]});_0x1c4028=_0x4b4660[_0x5ddaeb(0xd3)];}}_0x4cfd10[_0x5ddaeb(0xeb)]&&_0x1c4028&&console[_0x5ddaeb(0xe9)]('Resolved\x20folder\x20ID:\x20'+_0x1c4028);const _0x488ca7=await loadJSONFromOptions(_0x4cfd10['rule'],_0x4cfd10[_0x5ddaeb(0xd8)]),_0x33ea3b={'name':_0x3926ee,'description':_0x4cfd10[_0x5ddaeb(0xe0)],'rule':_0x488ca7,'kind':_0x4cfd10[_0x5ddaeb(0xef)]!==undefined?parseInt(_0x4cfd10[_0x5ddaeb(0xef)],0xa):undefined,'isVisible':_0x4cfd10[_0x5ddaeb(0xe2)]?![]:undefined,'segmentFolderId':_0x1c4028,'countPopulation':_0x4cfd10[_0x5ddaeb(0x102)]?![]:undefined},_0x4d3644=await withSpinner(_0x5ddaeb(0xd9)+_0x3926ee+'\x27...',()=>_0x173928[_0x5ddaeb(0xe6)]['createSegment'](_0x3a8046,_0x33ea3b),{'verbose':_0x4cfd10[_0x5ddaeb(0xeb)]}),_0x45a2ce=_0x4d3644['data'];return console[_0x5ddaeb(0xe9)](_0x5ddaeb(0xd5)+_0x45a2ce[_0x5ddaeb(0xf8)]+_0x5ddaeb(0xf7)+_0x45a2ce['id']),_0x2607f1!==_0x1e83ec&&console[_0x5ddaeb(0xe9)](_0x5ddaeb(0xde)+_0x2607f1),await handleSDKOutput([_0x45a2ce],_0x4cfd10),0x0;}}
1
+ const a38_0x1a722f=a38_0x10cc;(function(_0x591d20,_0x3bc9df){const _0x6793fa=a38_0x10cc,_0x222447=_0x591d20();while(!![]){try{const _0x1e4f0d=-parseInt(_0x6793fa(0x1d7))/0x1*(parseInt(_0x6793fa(0x1f6))/0x2)+-parseInt(_0x6793fa(0x1eb))/0x3+parseInt(_0x6793fa(0x1bc))/0x4+parseInt(_0x6793fa(0x1d3))/0x5*(-parseInt(_0x6793fa(0x1dd))/0x6)+-parseInt(_0x6793fa(0x1f4))/0x7+-parseInt(_0x6793fa(0x1d2))/0x8*(parseInt(_0x6793fa(0x1ce))/0x9)+-parseInt(_0x6793fa(0x1cc))/0xa*(-parseInt(_0x6793fa(0x1e0))/0xb);if(_0x1e4f0d===_0x3bc9df)break;else _0x222447['push'](_0x222447['shift']());}catch(_0x1b9796){_0x222447['push'](_0x222447['shift']());}}}(a38_0x1aa1,0x21386));function a38_0x10cc(_0x32fdee,_0x8201cb){_0x32fdee=_0x32fdee-0x1bc;const _0x1aa158=a38_0x1aa1();let _0x10cc8f=_0x1aa158[_0x32fdee];return _0x10cc8f;}function a38_0x1aa1(){const _0x3c4c1c=['createSegment','Target\x20path:\x20','folderId','72138pPZzBR','Resolving\x20parent\x20segment\x20\x27','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','44CUiiUc','Examples:','error','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','name','kind','segment:create','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','resolveParentId','folder','\x20\x20\x20Path:\x20','737427DYgVmq','Segment\x20name:\x20','\x27...','segmentPath','resolvePathToResource','rule','Parent:\x20','Resolving\x20folder\x20\x27','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','651917DSSIqT','segment','80kEJjKA','1043716IXWGfU','Resolved\x20folder\x20ID:\x20','parent','noCountPopulation','invisible','length','description','type','✔\x20Created\x20segment\x20\x27','site','yellow','Resolved\x20relative\x20path\x20to:\x20','Resolving\x20folder\x20path\x20\x27','verbose','includes','ruleFile','1876210TiVViP','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','2390517NfXgBO','data','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','resolveFolderId','8XpPCXP','50yVLzsC','Create\x20child\x20segment\x20with\x20filtering\x20rules','execute','segments','3764scChbU','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','Site:\x20'];a38_0x1aa1=function(){return _0x3c4c1c;};return a38_0x1aa1();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x338f6a from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']=a38_0x1a722f(0x1e6);[a38_0x1a722f(0x1c2)]=a38_0x1a722f(0x1d4);async[a38_0x1a722f(0x1d5)](_0xc14f5a){const _0x13c6f7=a38_0x1a722f;console[_0x13c6f7(0x1e2)](a38_0x338f6a[_0x13c6f7(0x1c6)](_0x13c6f7(0x1df))),console[_0x13c6f7(0x1e2)](a38_0x338f6a[_0x13c6f7(0x1c6)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x31acc8,args:_0x10f9cb,tdx:_0x2b1003}=_0xc14f5a,_0x3a332d=_0x31acc8;if(_0x10f9cb[_0x13c6f7(0x1c1)]===0x0)return console[_0x13c6f7(0x1e2)](_0x13c6f7(0x1e3)),console[_0x13c6f7(0x1e2)](_0x13c6f7(0x1cd)),console[_0x13c6f7(0x1e2)](_0x13c6f7(0x1e1)),console[_0x13c6f7(0x1e2)](_0x13c6f7(0x1d0)),console[_0x13c6f7(0x1e2)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console[_0x13c6f7(0x1e2)](_0x13c6f7(0x1f3)),0x1;const _0x28def2=_0x10f9cb[0x0],_0x1d3ad2=_0x31acc8[_0x13c6f7(0x1ee)];let _0x154817=_0x28def2;_0x1d3ad2&&!_0x28def2[_0x13c6f7(0x1ca)]('/')&&(_0x154817=_0x1d3ad2+'/'+_0x28def2,_0x3a332d[_0x13c6f7(0x1c9)]&&console[_0x13c6f7(0x1e2)](_0x13c6f7(0x1c7)+_0x154817));const _0x1758f9=parsePath(_0x154817);if(_0x1758f9[_0x13c6f7(0x1d6)][_0x13c6f7(0x1c1)]<0x2)return console[_0x13c6f7(0x1e2)](_0x13c6f7(0x1e7)),console['error']('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0xaa5dd=_0x1758f9['segments'][0x0],_0x4871c3=getBaseName(_0x154817),_0x11e1d4=getParentPath(_0x154817);_0x3a332d[_0x13c6f7(0x1c9)]&&(console[_0x13c6f7(0x1e2)](_0x13c6f7(0x1d9)+_0x3a332d[_0x13c6f7(0x1c5)]),console[_0x13c6f7(0x1e2)](_0x13c6f7(0x1db)+_0x154817),console[_0x13c6f7(0x1e2)](_0x13c6f7(0x1f1)+_0xaa5dd),console['error'](_0x13c6f7(0x1ec)+_0x4871c3),console['error']('Parent\x20path:\x20'+_0x11e1d4));const _0x1b516a=await withSpinner(_0x13c6f7(0x1de)+_0xaa5dd+_0x13c6f7(0x1ed),()=>_0x2b1003[_0x13c6f7(0x1f5)][_0x13c6f7(0x1e8)](_0xaa5dd),{'verbose':_0x3a332d[_0x13c6f7(0x1c9)]}),_0x4db946=_0x1b516a[_0x13c6f7(0x1cf)];let _0x196683;if(_0x1758f9['segments']['length']>0x2){const _0x2b0fd7=await withSpinner(_0x13c6f7(0x1c8)+_0x11e1d4+_0x13c6f7(0x1ed),()=>_0x2b1003[_0x13c6f7(0x1f5)][_0x13c6f7(0x1ef)](_0x11e1d4),{'verbose':_0x3a332d[_0x13c6f7(0x1c9)]}),_0x660c1f=_0x2b0fd7[_0x13c6f7(0x1cf)];if(_0x660c1f[_0x13c6f7(0x1c3)]!==_0x13c6f7(0x1e9)&&_0x660c1f[_0x13c6f7(0x1c3)]!==_0x13c6f7(0x1be))return console[_0x13c6f7(0x1e2)](_0x13c6f7(0x1d8)),0x1;_0x196683=_0x660c1f[_0x13c6f7(0x1dc)];}else{if(_0x3a332d[_0x13c6f7(0x1e9)]){const _0x4f7f66=await withSpinner(_0x13c6f7(0x1f2)+_0x3a332d[_0x13c6f7(0x1e9)]+'\x27...',()=>_0x2b1003[_0x13c6f7(0x1f5)][_0x13c6f7(0x1d1)](_0x4db946,_0x3a332d[_0x13c6f7(0x1e9)]),{'verbose':_0x3a332d[_0x13c6f7(0x1c9)]});_0x196683=_0x4f7f66[_0x13c6f7(0x1cf)];}}_0x3a332d['verbose']&&_0x196683&&console[_0x13c6f7(0x1e2)](_0x13c6f7(0x1bd)+_0x196683);const _0x4453ef=await loadJSONFromOptions(_0x3a332d[_0x13c6f7(0x1f0)],_0x3a332d[_0x13c6f7(0x1cb)]),_0x23dcd5={'name':_0x4871c3,'description':_0x3a332d['description'],'rule':_0x4453ef,'kind':_0x3a332d[_0x13c6f7(0x1e5)]!==undefined?parseInt(_0x3a332d[_0x13c6f7(0x1e5)],0xa):undefined,'isVisible':_0x3a332d[_0x13c6f7(0x1c0)]?![]:undefined,'segmentFolderId':_0x196683,'countPopulation':_0x3a332d[_0x13c6f7(0x1bf)]?![]:undefined},_0x10bc57=await withSpinner('Creating\x20segment\x20\x27'+_0x4871c3+_0x13c6f7(0x1ed),()=>_0x2b1003['segment'][_0x13c6f7(0x1da)](_0x4db946,_0x23dcd5),{'verbose':_0x3a332d[_0x13c6f7(0x1c9)]}),_0x15d220=_0x10bc57[_0x13c6f7(0x1cf)];return console[_0x13c6f7(0x1e2)](_0x13c6f7(0x1c4)+_0x15d220[_0x13c6f7(0x1e4)]+'\x27\x20with\x20ID:\x20'+_0x15d220['id']),_0x154817!==_0x28def2&&console['error'](_0x13c6f7(0x1ea)+_0x154817),await handleSDKOutput([_0x15d220],_0x3a332d),0x0;}}
@@ -1 +1 @@
1
- const a39_0x1c95d5=a39_0x4149;function a39_0x235f(){const _0xd03d8c=['length','7rmzRNL','18imwANF','6099072VIpLiP','listFields','\x20field','json','2324320VZLoIt','verbose','name','segment','84povBGv','parentSegment','1315929vVdQcf','Error:\x20Parent\x20segment\x20name\x20is\x20required','2wpLjtB','1872957cXMNQj','Listing\x20fields\x20for\x20\x27','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','2127900oADKUw','Site:\x20','List\x20available\x20fields\x20for\x20segmentation','execute','error','✔\x20Found\x20','3648510QkCAxP','segment:fields','jsonl','Parent\x20segment:\x20','2269201MyRKzH','4aIiMoC','site'];a39_0x235f=function(){return _0xd03d8c;};return a39_0x235f();}(function(_0xe298fe,_0x177037){const _0x58ccdc=a39_0x4149,_0x531e7d=_0xe298fe();while(!![]){try{const _0x1356e5=parseInt(_0x58ccdc(0xe1))/0x1*(-parseInt(_0x58ccdc(0xe3))/0x2)+-parseInt(_0x58ccdc(0xe4))/0x3*(parseInt(_0x58ccdc(0xf2))/0x4)+-parseInt(_0x58ccdc(0xfb))/0x5+-parseInt(_0x58ccdc(0xe7))/0x6*(-parseInt(_0x58ccdc(0xf5))/0x7)+parseInt(_0x58ccdc(0xf7))/0x8+-parseInt(_0x58ccdc(0xf6))/0x9*(-parseInt(_0x58ccdc(0xed))/0xa)+parseInt(_0x58ccdc(0xf1))/0xb*(parseInt(_0x58ccdc(0xdf))/0xc);if(_0x1356e5===_0x177037)break;else _0x531e7d['push'](_0x531e7d['shift']());}catch(_0x1587a4){_0x531e7d['push'](_0x531e7d['shift']());}}}(a39_0x235f,0xd839d));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a39_0x4149(_0x299683,_0x4fd732){_0x299683=_0x299683-0xdf;const _0x235f27=a39_0x235f();let _0x4149b9=_0x235f27[_0x299683];return _0x4149b9;}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a39_0x1c95d5(0xfd)]=a39_0x1c95d5(0xee);['description']=a39_0x1c95d5(0xe9);async[a39_0x1c95d5(0xea)](_0x467f5a){const _0x5ca95e=a39_0x1c95d5,{options:_0x4c2b3d,args:_0x4ba79e,tdx:_0x4c462d}=_0x467f5a,_0x3768ed=_0x4ba79e[0x0]||_0x4c2b3d[_0x5ca95e(0xe0)];if(!_0x3768ed)return console[_0x5ca95e(0xeb)](_0x5ca95e(0xe2)),console['error']('Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'),console[_0x5ca95e(0xeb)](_0x5ca95e(0xe6)),0x1;_0x4c2b3d[_0x5ca95e(0xfc)]&&(console['error'](_0x5ca95e(0xe8)+_0x4c2b3d[_0x5ca95e(0xf3)]),console[_0x5ca95e(0xeb)](_0x5ca95e(0xf0)+_0x3768ed));const _0x2c420e=await withSpinner(_0x5ca95e(0xe5)+_0x3768ed+'\x27...',()=>_0x4c462d[_0x5ca95e(0xfe)][_0x5ca95e(0xf8)](_0x3768ed),{'verbose':_0x4c2b3d[_0x5ca95e(0xfc)]}),_0x39c755=_0x2c420e['data'];console[_0x5ca95e(0xeb)](_0x5ca95e(0xec)+_0x39c755[_0x5ca95e(0xf4)]+_0x5ca95e(0xf9)+(_0x39c755['length']!==0x1?'s':''));if(_0x4c2b3d[_0x5ca95e(0xfa)]||_0x4c2b3d[_0x5ca95e(0xef)])return await handleSDKOutput(_0x39c755,_0x4c2b3d),0x0;return displayFieldsHumanReadable(_0x39c755,_0x3768ed),0x0;}}
1
+ const a39_0x15b9c9=a39_0x5104;(function(_0x12530c,_0x425798){const _0x6fb6d6=a39_0x5104,_0x88c8a0=_0x12530c();while(!![]){try{const _0x480fb4=-parseInt(_0x6fb6d6(0x1f7))/0x1*(-parseInt(_0x6fb6d6(0x1fd))/0x2)+-parseInt(_0x6fb6d6(0x20d))/0x3+-parseInt(_0x6fb6d6(0x202))/0x4+-parseInt(_0x6fb6d6(0x204))/0x5+parseInt(_0x6fb6d6(0x20a))/0x6*(-parseInt(_0x6fb6d6(0x208))/0x7)+parseInt(_0x6fb6d6(0x200))/0x8+parseInt(_0x6fb6d6(0x1f8))/0x9;if(_0x480fb4===_0x425798)break;else _0x88c8a0['push'](_0x88c8a0['shift']());}catch(_0x80c6b4){_0x88c8a0['push'](_0x88c8a0['shift']());}}}(a39_0x2e57,0x777e7));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a39_0x2e57(){const _0x38253f=['Site:\x20','description','131oVXIiW','9100953xUXADW','error','json','verbose','site','10020RIgoTk','length','\x27...','5617792GgSvow','parentSegment','2382780VDNdQz','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','3395040wbssQC','List\x20available\x20fields\x20for\x20segmentation','segment','data','42iefFlw','name','363828LCXflz','\x20field','execute','725319nfqLXN','Parent\x20segment:\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required'];a39_0x2e57=function(){return _0x38253f;};return a39_0x2e57();}import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';function a39_0x5104(_0x1a8c1b,_0x264b5a){_0x1a8c1b=_0x1a8c1b-0x1f3;const _0x2e57cb=a39_0x2e57();let _0x51041d=_0x2e57cb[_0x1a8c1b];return _0x51041d;}export class SegmentFieldsCommand extends BaseCommand{[a39_0x15b9c9(0x209)]='segment:fields';[a39_0x15b9c9(0x1f6)]=a39_0x15b9c9(0x205);async[a39_0x15b9c9(0x20c)](_0x3912bc){const _0x66b77b=a39_0x15b9c9,{options:_0x53f9cd,args:_0x475440,tdx:_0x513601}=_0x3912bc,_0x53ecbd=_0x475440[0x0]||_0x53f9cd[_0x66b77b(0x201)];if(!_0x53ecbd)return console[_0x66b77b(0x1f9)](_0x66b77b(0x1f4)),console[_0x66b77b(0x1f9)](_0x66b77b(0x203)),console[_0x66b77b(0x1f9)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;_0x53f9cd[_0x66b77b(0x1fb)]&&(console[_0x66b77b(0x1f9)](_0x66b77b(0x1f5)+_0x53f9cd[_0x66b77b(0x1fc)]),console[_0x66b77b(0x1f9)](_0x66b77b(0x1f3)+_0x53ecbd));const _0x50d66e=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x53ecbd+_0x66b77b(0x1ff),()=>_0x513601[_0x66b77b(0x206)]['listFields'](_0x53ecbd),{'verbose':_0x53f9cd['verbose']}),_0x3d78b6=_0x50d66e[_0x66b77b(0x207)];console['error']('✔\x20Found\x20'+_0x3d78b6[_0x66b77b(0x1fe)]+_0x66b77b(0x20b)+(_0x3d78b6[_0x66b77b(0x1fe)]!==0x1?'s':''));if(_0x53f9cd[_0x66b77b(0x1fa)]||_0x53f9cd['jsonl'])return await handleSDKOutput(_0x3d78b6,_0x53f9cd),0x0;return displayFieldsHumanReadable(_0x3d78b6,_0x53ecbd),0x0;}}