@treasuredata/tdx 2026.4.14 → 2026.4.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/README.md +1 -1
  2. package/dist/bin.js +1 -1
  3. package/dist/build-info.json +3 -3
  4. package/dist/cli-categories.js +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/commands/activations.js +1 -1
  7. package/dist/commands/agent-command.js +1 -1
  8. package/dist/commands/agent-test-command.js +1 -1
  9. package/dist/commands/api-command.js +1 -1
  10. package/dist/commands/auth-command.js +1 -1
  11. package/dist/commands/cas-command.js +1 -1
  12. package/dist/commands/cas-segment-command.js +1 -1
  13. package/dist/commands/chat-command.js +1 -1
  14. package/dist/commands/claude-command.js +1 -1
  15. package/dist/commands/claude-statusline-command.js +1 -1
  16. package/dist/commands/claude-usage-command.js +1 -1
  17. package/dist/commands/command.js +1 -1
  18. package/dist/commands/connection-command.js +1 -1
  19. package/dist/commands/databases.js +1 -1
  20. package/dist/commands/delivery-command.js +1 -1
  21. package/dist/commands/describe.js +1 -1
  22. package/dist/commands/engage-campaign-pull-command.js +1 -1
  23. package/dist/commands/engage-campaign-push-command.js +1 -1
  24. package/dist/commands/engage-campaign-validate-command.js +1 -1
  25. package/dist/commands/engage-command.js +1 -1
  26. package/dist/commands/engage-template-pull-command.js +1 -1
  27. package/dist/commands/engage-template-push-command.js +1 -1
  28. package/dist/commands/engage-template-validate-command.js +1 -1
  29. package/dist/commands/job-command.js +1 -1
  30. package/dist/commands/journey-command.js +1 -1
  31. package/dist/commands/journey-validate-command.js +1 -1
  32. package/dist/commands/llm-command.js +1 -1
  33. package/dist/commands/mcp-command.js +1 -1
  34. package/dist/commands/parent-segment-command.js +1 -1
  35. package/dist/commands/policy-command.js +1 -1
  36. package/dist/commands/profile-command.js +1 -1
  37. package/dist/commands/profiles-command.js +1 -1
  38. package/dist/commands/query-command.js +1 -1
  39. package/dist/commands/schedule-command.js +1 -1
  40. package/dist/commands/segment-command.js +1 -1
  41. package/dist/commands/segment-create-command.js +1 -1
  42. package/dist/commands/segment-fields-command.js +1 -1
  43. package/dist/commands/segment-pull-command.js +1 -1
  44. package/dist/commands/segment-push-command.js +1 -1
  45. package/dist/commands/segment-update-command.js +1 -1
  46. package/dist/commands/segment-use-command.js +1 -1
  47. package/dist/commands/segment-validate-command.js +1 -1
  48. package/dist/commands/segments.js +1 -1
  49. package/dist/commands/show.js +1 -1
  50. package/dist/commands/status-command.js +1 -1
  51. package/dist/commands/tables.js +1 -1
  52. package/dist/commands/unset-command.js +1 -1
  53. package/dist/commands/upgrade-command.js +1 -1
  54. package/dist/commands/use-command.js +1 -1
  55. package/dist/commands/user-command.js +1 -1
  56. package/dist/commands/work-command.js +1 -1
  57. package/dist/commands/workflow-command.js +1 -1
  58. package/dist/core/auth.js +1 -1
  59. package/dist/core/command-output.js +1 -1
  60. package/dist/core/config.js +1 -1
  61. package/dist/core/connection-cache.js +1 -1
  62. package/dist/core/constants.js +1 -1
  63. package/dist/core/credential-cache.js +1 -1
  64. package/dist/core/global-context.js +1 -1
  65. package/dist/core/keychain.js +1 -1
  66. package/dist/core/oauth-keychain.js +1 -1
  67. package/dist/core/oauth.js +1 -1
  68. package/dist/core/profile.js +1 -1
  69. package/dist/core/project-config.js +1 -1
  70. package/dist/core/session.js +1 -1
  71. package/dist/core/user-cache.js +1 -1
  72. package/dist/core/version.js +1 -1
  73. package/dist/index.js +1 -1
  74. package/dist/mcp/server.js +1 -1
  75. package/dist/mcp/tools/index.js +1 -1
  76. package/dist/mcp/tools/tdx-run.js +1 -1
  77. package/dist/mcp/tools/tdx-search.js +1 -1
  78. package/dist/mcp/tools/work-create-item.js +1 -1
  79. package/dist/mcp/utils.js +1 -1
  80. package/dist/proxy/claude-usage-tracker.js +1 -1
  81. package/dist/proxy/passthrough-server.js +1 -1
  82. package/dist/proxy/sse-usage-parser.js +1 -1
  83. package/dist/sdk/agent/agent-config.js +1 -1
  84. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  85. package/dist/sdk/agent/agent-yaml.js +1 -1
  86. package/dist/sdk/agent/test/evaluator.js +1 -1
  87. package/dist/sdk/agent/test/executor.js +1 -1
  88. package/dist/sdk/agent/test/index.js +1 -1
  89. package/dist/sdk/agent/test/output.js +1 -1
  90. package/dist/sdk/agent/test/parser.js +1 -1
  91. package/dist/sdk/agent/tool-target-registry.js +1 -1
  92. package/dist/sdk/api.js +1 -1
  93. package/dist/sdk/cas/cas-api-client.js +1 -1
  94. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  95. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  96. package/dist/sdk/cas/index.js +1 -1
  97. package/dist/sdk/cas/pull-workflow.js +1 -1
  98. package/dist/sdk/cas/push-workflow.js +1 -1
  99. package/dist/sdk/client/cdp-api-client.js +1 -1
  100. package/dist/sdk/client/delivery-api-client.js +1 -1
  101. package/dist/sdk/client/endpoints.js +1 -1
  102. package/dist/sdk/client/engage-api-client.js +1 -1
  103. package/dist/sdk/client/http-client.js +1 -1
  104. package/dist/sdk/client/llm-api-client.js +1 -1
  105. package/dist/sdk/client/oauth-refresh.js +1 -1
  106. package/dist/sdk/client/rate-limiter.js +1 -1
  107. package/dist/sdk/client/td-api-client.js +1 -1
  108. package/dist/sdk/client/trino-api-client.js +1 -1
  109. package/dist/sdk/client/workflow-client.js +1 -1
  110. package/dist/sdk/connection-validator.js +1 -1
  111. package/dist/sdk/connection.js +1 -1
  112. package/dist/sdk/delivery.js +1 -1
  113. package/dist/sdk/engage/campaign-pull.js +1 -1
  114. package/dist/sdk/engage/campaign-push.js +1 -1
  115. package/dist/sdk/engage/campaign-validator.js +1 -1
  116. package/dist/sdk/engage/campaign-yaml.js +1 -1
  117. package/dist/sdk/engage/template-pull.js +1 -1
  118. package/dist/sdk/engage/template-push.js +1 -1
  119. package/dist/sdk/engage/template-validator.js +1 -1
  120. package/dist/sdk/engage/template-yaml.js +1 -1
  121. package/dist/sdk/engage/types/campaign-def.js +1 -1
  122. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  123. package/dist/sdk/engage/types/template-schema.js +1 -1
  124. package/dist/sdk/engage.js +1 -1
  125. package/dist/sdk/errors.js +1 -1
  126. package/dist/sdk/index.js +1 -1
  127. package/dist/sdk/io/index.js +1 -1
  128. package/dist/sdk/io/node-filesystem.js +1 -1
  129. package/dist/sdk/job.js +1 -1
  130. package/dist/sdk/journey.js +1 -1
  131. package/dist/sdk/llm/chat-cache.js +1 -1
  132. package/dist/sdk/llm/index.js +1 -1
  133. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  134. package/dist/sdk/llm/model-factors.js +1 -1
  135. package/dist/sdk/personalization.js +1 -1
  136. package/dist/sdk/policy.js +1 -1
  137. package/dist/sdk/query/index.js +1 -1
  138. package/dist/sdk/query/sql-parser.js +1 -1
  139. package/dist/sdk/realtime.js +1 -1
  140. package/dist/sdk/schedule.js +1 -1
  141. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  142. package/dist/sdk/segment/fields-display.js +1 -1
  143. package/dist/sdk/segment/file-discovery.js +1 -1
  144. package/dist/sdk/segment/journey-utils.js +1 -1
  145. package/dist/sdk/segment/journey-validator.js +1 -1
  146. package/dist/sdk/segment/journey-yaml.js +1 -1
  147. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  148. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  149. package/dist/sdk/segment/pull-workflow.js +1 -1
  150. package/dist/sdk/segment/push-recovery.js +1 -1
  151. package/dist/sdk/segment/push-workflow.js +1 -1
  152. package/dist/sdk/segment/resolution-context.js +1 -1
  153. package/dist/sdk/segment/segment-path-parser.js +1 -1
  154. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  155. package/dist/sdk/segment/segment-validator.js +1 -1
  156. package/dist/sdk/segment/target-resolution.js +1 -1
  157. package/dist/sdk/segment/tdx-config.js +1 -1
  158. package/dist/sdk/segment/types/activation-schema.js +1 -1
  159. package/dist/sdk/segment/types/journey-def.js +1 -1
  160. package/dist/sdk/segment/types/journey-schema.js +1 -1
  161. package/dist/sdk/segment/types/segment-def.js +1 -1
  162. package/dist/sdk/segment/types/segment-schema.js +1 -1
  163. package/dist/sdk/segment/validate-files.js +1 -1
  164. package/dist/sdk/segment/yaml-validator.js +1 -1
  165. package/dist/sdk/segment.js +1 -1
  166. package/dist/sdk/types/index.js +1 -1
  167. package/dist/sdk/types/progress.js +1 -1
  168. package/dist/sdk/types/workspace.js +1 -1
  169. package/dist/sdk/user.js +1 -1
  170. package/dist/sdk/util/format-detector.js +1 -1
  171. package/dist/sdk/util/formatters.js +1 -1
  172. package/dist/sdk/util/index.js +1 -1
  173. package/dist/sdk/util/paginate.js +1 -1
  174. package/dist/sdk/util/tree-formatter.js +1 -1
  175. package/dist/sdk/workflow/archive-validation.js +1 -1
  176. package/dist/sdk/workflow/clone-workflow.js +1 -1
  177. package/dist/sdk/workflow/index.js +1 -1
  178. package/dist/sdk/workflow/pull-workflow.js +1 -1
  179. package/dist/sdk/workflow/push-workflow.js +1 -1
  180. package/dist/sdk/workflow/tdx-config.js +1 -1
  181. package/dist/sdk/workflow/workflow-utils.js +1 -1
  182. package/dist/sdk/workspace/access-tracker.js +1 -1
  183. package/dist/sdk/workspace/frontmatter.js +1 -1
  184. package/dist/sdk/workspace/git.js +1 -1
  185. package/dist/sdk/workspace/index.js +1 -1
  186. package/dist/sdk/workspace/templates.js +1 -1
  187. package/dist/sdk/workspace/weekly.js +1 -1
  188. package/dist/sdk/workspace/wikilinks.js +1 -1
  189. package/dist/test-utils/command-runner.js +1 -1
  190. package/dist/test-utils/factories.js +1 -1
  191. package/dist/test-utils/fixtures.js +1 -1
  192. package/dist/test-utils/http-mock.js +1 -1
  193. package/dist/test-utils/index.js +1 -1
  194. package/dist/utils/async.js +1 -1
  195. package/dist/utils/colors.js +1 -1
  196. package/dist/utils/diff.js +1 -1
  197. package/dist/utils/file-permissions.js +1 -1
  198. package/dist/utils/file-reader.js +1 -1
  199. package/dist/utils/github-releases.js +1 -1
  200. package/dist/utils/global-cache.js +1 -1
  201. package/dist/utils/json-loader.js +1 -1
  202. package/dist/utils/local-cache.js +1 -1
  203. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  204. package/dist/utils/logger/formatters/index.js +1 -1
  205. package/dist/utils/logger/handlers/console-handler.js +1 -1
  206. package/dist/utils/logger/handlers/file-handler.js +1 -1
  207. package/dist/utils/logger/handlers/index.js +1 -1
  208. package/dist/utils/logger/handlers/null-handler.js +1 -1
  209. package/dist/utils/logger/index.js +1 -1
  210. package/dist/utils/logger/logger.js +1 -1
  211. package/dist/utils/logger/types.js +1 -1
  212. package/dist/utils/option-validation.js +1 -1
  213. package/dist/utils/process.js +1 -1
  214. package/dist/utils/prompt.js +1 -1
  215. package/dist/utils/spinner.js +1 -1
  216. package/dist/utils/sse-parser.js +1 -1
  217. package/dist/utils/string-utils.js +1 -1
  218. package/dist/utils/table-ref-parser.js +1 -1
  219. package/dist/utils/tdx-logger.js +1 -1
  220. package/dist/utils/version-check.js +1 -1
  221. package/package.json +30 -12
@@ -1 +1 @@
1
- const a32_0x43a0ef=a32_0x5134;function a32_0x1d61(){const _0x54ed16=['✔\x20Found\x20','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','execute','\x20user','\x20—\x20','validate','log','\x20polic','account_id','👥\x20Assigned\x20Users','user','20604ceUlGS','permissions','12BdHIzL','dim','account_owner','Fetching\x20permissions...','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','5465470cvHvfj','📋\x20Assigned\x20Policies','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','getPolicyPermissions','administrator','472518xyFqsg','491948pAcubo','policy\x20list','Fetching\x20policy...','data','1144oWXwEh','\x20\x20•\x20','all','length','2800830mLYTRu','getPolicy','padEnd','description','Account\x20Owner','\x20assigned','verbose','policy','email','\x20\x20No\x20permissions','error','map','listPolicies','22LUhwfW','136rWdrcC','Administrator','🔑\x20Effective\x20Permissions','bold','No\x20policies\x20found','\x20\x20\x20','132yUZYmY','policies','max','entries','\x20\x20No\x20policies\x20assigned','287916PXDlOf','2025352ahrVlf','policy\x20show','2YiltRk','ies','name','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','getCurrent'];a32_0x1d61=function(){return _0x54ed16;};return a32_0x1d61();}(function(_0x5e21c0,_0x2c39eb){const _0x13c510=a32_0x5134,_0x29570c=_0x5e21c0();while(!![]){try{const _0x2defa4=parseInt(_0x13c510(0x140))/0x1*(parseInt(_0x13c510(0x11c))/0x2)+-parseInt(_0x13c510(0x150))/0x3*(-parseInt(_0x13c510(0x138))/0x4)+parseInt(_0x13c510(0x157))/0x5+-parseInt(_0x13c510(0x152))/0x6*(parseInt(_0x13c510(0x13e))/0x7)+-parseInt(_0x13c510(0x132))/0x8*(-parseInt(_0x13c510(0x11b))/0x9)+parseInt(_0x13c510(0x124))/0xa*(parseInt(_0x13c510(0x131))/0xb)+parseInt(_0x13c510(0x13d))/0xc*(-parseInt(_0x13c510(0x120))/0xd);if(_0x2defa4===_0x2c39eb)break;else _0x29570c['push'](_0x29570c['shift']());}catch(_0x58fa2d){_0x29570c['push'](_0x29570c['shift']());}}}(a32_0x1d61,0x8c37a));function a32_0x5134(_0x110530,_0x20afef){_0x110530=_0x110530-0x118;const _0x1d61a1=a32_0x1d61();let _0x513413=_0x1d61a1[_0x110530];return _0x513413;}import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x565718 from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x43a0ef(0x142)]=a32_0x43a0ef(0x12b);['description']=a32_0x43a0ef(0x143);async[a32_0x43a0ef(0x147)](_0x1731ef){const _0x5ee81f=a32_0x43a0ef,{options:_0x416ab1,tdx:_0x48faa6}=_0x1731ef,_0x29a977=await withSpinner(_0x5ee81f(0x155),async()=>{const _0x42e488=_0x5ee81f,[_0x36251e,_0xf9df47]=await Promise[_0x42e488(0x122)]([_0x48faa6[_0x42e488(0x14f)][_0x42e488(0x144)](),_0x48faa6[_0x42e488(0x12b)]['getMyPermissions']()]);return{'userInfo':_0x36251e,'permissions':_0xf9df47};},{'verbose':_0x416ab1[_0x5ee81f(0x12a)]}),{userInfo:_0x4077af,permissions:_0x2cd528}=_0x29a977['data'];if(isStructuredFormat(_0x416ab1))return await handleSingleObjectOutput(_0x2cd528,_0x416ab1),0x0;const _0x5d0f67=_0x4077af[_0x5ee81f(0x154)]?_0x5ee81f(0x128):_0x4077af[_0x5ee81f(0x11a)]?_0x5ee81f(0x133):'Member';console[_0x5ee81f(0x14b)]('\x0a'+a32_0x565718[_0x5ee81f(0x135)]('👤')+'\x20'+a32_0x565718[_0x5ee81f(0x135)](_0x4077af[_0x5ee81f(0x142)])+'\x20'+a32_0x565718[_0x5ee81f(0x153)]('('+_0x4077af[_0x5ee81f(0x12c)]+')')+_0x5ee81f(0x149)+_0x5d0f67),console[_0x5ee81f(0x14b)](a32_0x565718[_0x5ee81f(0x153)](_0x5ee81f(0x137)+_0x48faa6['context']['site']+':'+_0x4077af[_0x5ee81f(0x14d)]+',\x20user_id:'+_0x4077af['id']));const _0x19dc63=_0x2cd528[_0x5ee81f(0x139)];console['log']('\x0a'+a32_0x565718[_0x5ee81f(0x135)](_0x5ee81f(0x158))+'\x20('+_0x19dc63[_0x5ee81f(0x123)]+'):');if(_0x19dc63['length']===0x0)console[_0x5ee81f(0x14b)](a32_0x565718['dim'](_0x5ee81f(0x13c)));else for(const _0x27a3b3 of _0x19dc63){console[_0x5ee81f(0x14b)](_0x5ee81f(0x121)+_0x27a3b3['name']);}return printPermissionsMap(_0x2cd528[_0x5ee81f(0x151)]),console[_0x5ee81f(0x14b)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x43a0ef(0x142)]=a32_0x43a0ef(0x11d);[a32_0x43a0ef(0x127)]=a32_0x43a0ef(0x156);async['execute'](_0x78328c){const _0xe6dd2c=a32_0x43a0ef,{options:_0x2c06df,tdx:_0x4773aa}=_0x78328c,_0x1546a2=await withSpinner('Listing\x20policies...',()=>_0x4773aa[_0xe6dd2c(0x12b)][_0xe6dd2c(0x130)](),{'verbose':_0x2c06df[_0xe6dd2c(0x12a)]}),_0x17cbde=_0x1546a2[_0xe6dd2c(0x11f)];console[_0xe6dd2c(0x12e)](_0xe6dd2c(0x145)+_0x17cbde[_0xe6dd2c(0x123)]+_0xe6dd2c(0x14c)+(_0x17cbde[_0xe6dd2c(0x123)]!==0x1?_0xe6dd2c(0x141):'y'));if(isStructuredFormat(_0x2c06df))return await handleSDKOutput(_0x17cbde,_0x2c06df),0x0;if(_0x17cbde[_0xe6dd2c(0x123)]===0x0)console['log'](a32_0x565718[_0xe6dd2c(0x153)](_0xe6dd2c(0x136)));else for(const _0x175e1f of _0x17cbde){const _0x2c7ab1=_0x175e1f['description']?a32_0x565718[_0xe6dd2c(0x153)](_0xe6dd2c(0x149)+_0x175e1f[_0xe6dd2c(0x127)]):'';console[_0xe6dd2c(0x14b)](_0xe6dd2c(0x121)+_0x175e1f[_0xe6dd2c(0x142)]+_0x2c7ab1);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x43a0ef(0x142)]=a32_0x43a0ef(0x13f);[a32_0x43a0ef(0x127)]=a32_0x43a0ef(0x146);[a32_0x43a0ef(0x14a)](_0x75c45c){const _0x5d71bc=a32_0x43a0ef;if(_0x75c45c['args']['length']===0x0)return _0x5d71bc(0x118);return undefined;}async[a32_0x43a0ef(0x147)](_0xf97070){const _0x108b12=a32_0x43a0ef,{options:_0x4e6a0f,tdx:_0x27b17c}=_0xf97070,_0x53c48f=_0xf97070['args'][0x0],_0x298809=await withSpinner(_0x108b12(0x11e),async()=>{const _0x49e2fc=_0x108b12,_0xa96049=await _0x27b17c[_0x49e2fc(0x12b)][_0x49e2fc(0x125)](_0x53c48f),[_0x177a64,_0x200853]=await Promise[_0x49e2fc(0x122)]([_0x27b17c[_0x49e2fc(0x12b)][_0x49e2fc(0x119)](_0xa96049['id']),_0x27b17c['policy']['getPolicyUsers'](_0xa96049['id'])]);return{'policy':_0xa96049,'perms':_0x177a64,'users':_0x200853};},{'verbose':_0x4e6a0f['verbose']}),{policy:_0x31d4ea,perms:_0x5d8c70,users:_0x3f6bce}=_0x298809[_0x108b12(0x11f)];if(isStructuredFormat(_0x4e6a0f))return await handleSingleObjectOutput({..._0x31d4ea,'permissions':_0x5d8c70[_0x108b12(0x151)],'users':_0x3f6bce},_0x4e6a0f),0x0;console['log']('\x0a'+a32_0x565718[_0x108b12(0x135)]('📋')+'\x20'+a32_0x565718[_0x108b12(0x135)](_0x31d4ea['name'])+'\x20'+a32_0x565718[_0x108b12(0x153)]('(ID:\x20'+_0x31d4ea['id']+')'));_0x31d4ea[_0x108b12(0x127)]&&console['log'](_0x108b12(0x137)+a32_0x565718[_0x108b12(0x153)](_0x31d4ea[_0x108b12(0x127)]));console['log'](_0x108b12(0x137)+_0x3f6bce[_0x108b12(0x123)]+_0x108b12(0x148)+(_0x3f6bce['length']!==0x1?'s':'')+_0x108b12(0x129)),printPermissionsMap(_0x5d8c70[_0x108b12(0x151)]);if(_0x3f6bce[_0x108b12(0x123)]>0x0){console[_0x108b12(0x14b)]('\x0a'+a32_0x565718[_0x108b12(0x135)](_0x108b12(0x14e))+':');for(const _0x5bbc38 of _0x3f6bce){const _0x17cbc5=_0x5bbc38['email']&&_0x5bbc38[_0x108b12(0x12c)]!==_0x5bbc38[_0x108b12(0x142)]?a32_0x565718[_0x108b12(0x153)]('\x20<'+_0x5bbc38[_0x108b12(0x12c)]+'>'):'';console['log'](_0x108b12(0x121)+_0x5bbc38['name']+_0x17cbc5);}}return console[_0x108b12(0x14b)](),0x0;}}function printPermissionsMap(_0x131a1f){const _0x4de801=a32_0x43a0ef,_0xafbe02=Object[_0x4de801(0x13b)](_0x131a1f);console['log']('\x0a'+a32_0x565718[_0x4de801(0x135)](_0x4de801(0x134))+':');if(_0xafbe02[_0x4de801(0x123)]===0x0){console[_0x4de801(0x14b)](a32_0x565718[_0x4de801(0x153)](_0x4de801(0x12d)));return;}const _0x413dda=Math[_0x4de801(0x13a)](..._0xafbe02[_0x4de801(0x12f)](([_0x189ded])=>_0x189ded['length']));for(const [_0x32a8bc,_0x473528]of _0xafbe02){const _0x2d114a=formatOperations(_0x473528);console[_0x4de801(0x14b)]('\x20\x20'+_0x32a8bc[_0x4de801(0x126)](_0x413dda+0x2)+_0x2d114a);}}function formatOperations(_0x263847){const _0x2026ce=[...new Set(_0x263847['map'](_0xbc5fbc=>_0xbc5fbc['operation']))];return _0x2026ce['join'](',\x20');}
1
+ const a32_0x44f75c=a32_0xcfda;(function(_0x56c12f,_0x1ff6fb){const _0x232484=a32_0xcfda,_0x4b81a1=_0x56c12f();while(!![]){try{const _0x40f3b8=parseInt(_0x232484(0x1c7))/0x1+parseInt(_0x232484(0x1b1))/0x2*(parseInt(_0x232484(0x1b5))/0x3)+-parseInt(_0x232484(0x1a2))/0x4+parseInt(_0x232484(0x1cf))/0x5*(parseInt(_0x232484(0x1dc))/0x6)+-parseInt(_0x232484(0x1aa))/0x7+-parseInt(_0x232484(0x1d1))/0x8*(parseInt(_0x232484(0x1d9))/0x9)+-parseInt(_0x232484(0x1d2))/0xa*(parseInt(_0x232484(0x1d6))/0xb);if(_0x40f3b8===_0x1ff6fb)break;else _0x4b81a1['push'](_0x4b81a1['shift']());}catch(_0x12db1b){_0x4b81a1['push'](_0x4b81a1['shift']());}}}(a32_0x3afc,0x48ac1));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x22a455 from'chalk';export class PolicyCommand extends BaseCommand{['name']=a32_0x44f75c(0x1d7);[a32_0x44f75c(0x1d5)]='Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions';async[a32_0x44f75c(0x1bc)](_0x339a18){const _0x29a47f=a32_0x44f75c,{options:_0x18ad0b,tdx:_0x3f7652}=_0x339a18,_0x3bbb30=await withSpinner(_0x29a47f(0x1a4),async()=>{const _0x4557d8=_0x29a47f,[_0x4d764b,_0x4761b4]=await Promise[_0x4557d8(0x1cc)]([_0x3f7652[_0x4557d8(0x1b7)][_0x4557d8(0x1c9)](),_0x3f7652['policy'][_0x4557d8(0x1c4)]()]);return{'userInfo':_0x4d764b,'permissions':_0x4761b4};},{'verbose':_0x18ad0b[_0x29a47f(0x1de)]}),{userInfo:_0x207473,permissions:_0x439fc2}=_0x3bbb30['data'];if(isStructuredFormat(_0x18ad0b))return await handleSingleObjectOutput(_0x439fc2,_0x18ad0b),0x0;const _0x681cb2=_0x207473['account_owner']?_0x29a47f(0x1d0):_0x207473[_0x29a47f(0x1df)]?_0x29a47f(0x1a5):_0x29a47f(0x1c6);console[_0x29a47f(0x1c2)]('\x0a'+a32_0x22a455[_0x29a47f(0x1ba)]('👤')+'\x20'+a32_0x22a455[_0x29a47f(0x1ba)](_0x207473[_0x29a47f(0x1a6)])+'\x20'+a32_0x22a455[_0x29a47f(0x1d8)]('('+_0x207473['email']+')')+_0x29a47f(0x1dd)+_0x681cb2),console['log'](a32_0x22a455[_0x29a47f(0x1d8)](_0x29a47f(0x1be)+_0x3f7652[_0x29a47f(0x1d3)]['site']+':'+_0x207473[_0x29a47f(0x1cb)]+_0x29a47f(0x1c1)+_0x207473['id']));const _0x4c7e71=_0x439fc2[_0x29a47f(0x1af)];console[_0x29a47f(0x1c2)]('\x0a'+a32_0x22a455[_0x29a47f(0x1ba)](_0x29a47f(0x1c8))+'\x20('+_0x4c7e71['length']+'):');if(_0x4c7e71['length']===0x0)console[_0x29a47f(0x1c2)](a32_0x22a455[_0x29a47f(0x1d8)](_0x29a47f(0x1a9)));else for(const _0x174567 of _0x4c7e71){console['log'](_0x29a47f(0x1db)+_0x174567[_0x29a47f(0x1a6)]);}return printPermissionsMap(_0x439fc2[_0x29a47f(0x1bf)]),console[_0x29a47f(0x1c2)](),0x0;}}function a32_0xcfda(_0x5ea5f8,_0x536bf8){_0x5ea5f8=_0x5ea5f8-0x1a1;const _0x3afcf5=a32_0x3afc();let _0xcfdafe=_0x3afcf5[_0x5ea5f8];return _0xcfdafe;}export class PolicyListCommand extends BaseCommand{['name']=a32_0x44f75c(0x1ad);[a32_0x44f75c(0x1d5)]=a32_0x44f75c(0x1d4);async['execute'](_0x33da1c){const _0x35f83a=a32_0x44f75c,{options:_0xad5338,tdx:_0x4ce262}=_0x33da1c,_0x26f06c=await withSpinner(_0x35f83a(0x1b2),()=>_0x4ce262['policy'][_0x35f83a(0x1a7)](),{'verbose':_0xad5338[_0x35f83a(0x1de)]}),_0x442bfd=_0x26f06c['data'];console[_0x35f83a(0x1a8)](_0x35f83a(0x1e0)+_0x442bfd['length']+_0x35f83a(0x1c3)+(_0x442bfd[_0x35f83a(0x1ae)]!==0x1?'ies':'y'));if(isStructuredFormat(_0xad5338))return await handleSDKOutput(_0x442bfd,_0xad5338),0x0;if(_0x442bfd[_0x35f83a(0x1ae)]===0x0)console[_0x35f83a(0x1c2)](a32_0x22a455[_0x35f83a(0x1d8)](_0x35f83a(0x1c0)));else for(const _0x2e912f of _0x442bfd){const _0x475604=_0x2e912f[_0x35f83a(0x1d5)]?a32_0x22a455['dim'](_0x35f83a(0x1dd)+_0x2e912f[_0x35f83a(0x1d5)]):'';console[_0x35f83a(0x1c2)]('\x20\x20•\x20'+_0x2e912f[_0x35f83a(0x1a6)]+_0x475604);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{['name']=a32_0x44f75c(0x1b4);[a32_0x44f75c(0x1d5)]=a32_0x44f75c(0x1bd);[a32_0x44f75c(0x1b6)](_0x208131){const _0x40d7f0=a32_0x44f75c;if(_0x208131[_0x40d7f0(0x1b0)]['length']===0x0)return _0x40d7f0(0x1bb);return undefined;}async[a32_0x44f75c(0x1bc)](_0x38d004){const _0x41fc55=a32_0x44f75c,{options:_0x5db834,tdx:_0x496cad}=_0x38d004,_0x2b1325=_0x38d004[_0x41fc55(0x1b0)][0x0],_0x2b8f78=await withSpinner(_0x41fc55(0x1a1),async()=>{const _0x582cac=_0x41fc55,_0x3ba349=await _0x496cad[_0x582cac(0x1d7)][_0x582cac(0x1ac)](_0x2b1325),[_0x5852b8,_0x1e5f86]=await Promise[_0x582cac(0x1cc)]([_0x496cad[_0x582cac(0x1d7)]['getPolicyPermissions'](_0x3ba349['id']),_0x496cad[_0x582cac(0x1d7)]['getPolicyUsers'](_0x3ba349['id'])]);return{'policy':_0x3ba349,'perms':_0x5852b8,'users':_0x1e5f86};},{'verbose':_0x5db834['verbose']}),{policy:_0x181294,perms:_0x496421,users:_0x5f107a}=_0x2b8f78[_0x41fc55(0x1c5)];if(isStructuredFormat(_0x5db834))return await handleSingleObjectOutput({..._0x181294,'permissions':_0x496421[_0x41fc55(0x1bf)],'users':_0x5f107a},_0x5db834),0x0;console['log']('\x0a'+a32_0x22a455['bold']('📋')+'\x20'+a32_0x22a455[_0x41fc55(0x1ba)](_0x181294[_0x41fc55(0x1a6)])+'\x20'+a32_0x22a455[_0x41fc55(0x1d8)](_0x41fc55(0x1ab)+_0x181294['id']+')'));_0x181294['description']&&console[_0x41fc55(0x1c2)](_0x41fc55(0x1be)+a32_0x22a455[_0x41fc55(0x1d8)](_0x181294['description']));console[_0x41fc55(0x1c2)](_0x41fc55(0x1be)+_0x5f107a[_0x41fc55(0x1ae)]+'\x20user'+(_0x5f107a['length']!==0x1?'s':'')+_0x41fc55(0x1ce)),printPermissionsMap(_0x496421['permissions']);if(_0x5f107a[_0x41fc55(0x1ae)]>0x0){console[_0x41fc55(0x1c2)]('\x0a'+a32_0x22a455[_0x41fc55(0x1ba)]('👥\x20Assigned\x20Users')+':');for(const _0x4e6055 of _0x5f107a){const _0x5e887e=_0x4e6055['email']&&_0x4e6055[_0x41fc55(0x1b3)]!==_0x4e6055[_0x41fc55(0x1a6)]?a32_0x22a455[_0x41fc55(0x1d8)]('\x20<'+_0x4e6055['email']+'>'):'';console[_0x41fc55(0x1c2)](_0x41fc55(0x1db)+_0x4e6055[_0x41fc55(0x1a6)]+_0x5e887e);}}return console[_0x41fc55(0x1c2)](),0x0;}}function printPermissionsMap(_0x5d3571){const _0x573362=a32_0x44f75c,_0x35628d=Object[_0x573362(0x1a3)](_0x5d3571);console[_0x573362(0x1c2)]('\x0a'+a32_0x22a455[_0x573362(0x1ba)](_0x573362(0x1ca))+':');if(_0x35628d['length']===0x0){console[_0x573362(0x1c2)](a32_0x22a455[_0x573362(0x1d8)](_0x573362(0x1b8)));return;}const _0x1c093b=Math[_0x573362(0x1b9)](..._0x35628d['map'](([_0x37b0b8])=>_0x37b0b8[_0x573362(0x1ae)]));for(const [_0x5a2860,_0x90ff42]of _0x35628d){const _0x39b105=formatOperations(_0x90ff42);console[_0x573362(0x1c2)]('\x20\x20'+_0x5a2860[_0x573362(0x1cd)](_0x1c093b+0x2)+_0x39b105);}}function a32_0x3afc(){const _0x5e995e=['context','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','description','286WDTAyx','policy','dim','321921zXPQsj','map','\x20\x20•\x20','1199310yTQLvx','\x20—\x20','verbose','administrator','✔\x20Found\x20','Fetching\x20policy...','141716cQcdzx','entries','Fetching\x20permissions...','Administrator','name','listPolicies','error','\x20\x20No\x20policies\x20assigned','1860047udAEPL','(ID:\x20','getPolicy','policy\x20list','length','policies','args','30tZzQtB','Listing\x20policies...','email','policy\x20show','111765RVDIfP','validate','user','\x20\x20No\x20permissions','max','bold','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','execute','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','\x20\x20\x20','permissions','No\x20policies\x20found',',\x20user_id:','log','\x20polic','getMyPermissions','data','Member','490845DyshDr','📋\x20Assigned\x20Policies','getCurrent','🔑\x20Effective\x20Permissions','account_id','all','padEnd','\x20assigned','5zIEMYt','Account\x20Owner','16Mxebki','222770HSRQeE'];a32_0x3afc=function(){return _0x5e995e;};return a32_0x3afc();}function formatOperations(_0x2a0d64){const _0x201963=a32_0x44f75c,_0x1a0a07=[...new Set(_0x2a0d64[_0x201963(0x1da)](_0x5c4ec4=>_0x5c4ec4['operation']))];return _0x1a0a07['join'](',\x20');}
@@ -1 +1 @@
1
- const a33_0x52cc0c=a33_0x11b8;(function(_0x1b567b,_0xcc7f77){const _0x3ca738=a33_0x11b8,_0x2a1947=_0x1b567b();while(!![]){try{const _0x30077f=parseInt(_0x3ca738(0x108))/0x1+parseInt(_0x3ca738(0xd9))/0x2*(parseInt(_0x3ca738(0xee))/0x3)+-parseInt(_0x3ca738(0xf4))/0x4+-parseInt(_0x3ca738(0xf9))/0x5*(parseInt(_0x3ca738(0xe0))/0x6)+parseInt(_0x3ca738(0x10a))/0x7+-parseInt(_0x3ca738(0xec))/0x8*(-parseInt(_0x3ca738(0x111))/0x9)+-parseInt(_0x3ca738(0xd0))/0xa*(parseInt(_0x3ca738(0x102))/0xb);if(_0x30077f===_0xcc7f77)break;else _0x2a1947['push'](_0x2a1947['shift']());}catch(_0x1c83f5){_0x2a1947['push'](_0x2a1947['shift']());}}}(a33_0x4e71,0x7c96e));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_0x41eced from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';function a33_0x11b8(_0x504de4,_0x563b36){_0x504de4=_0x504de4-0xcf;const _0x4e718e=a33_0x4e71();let _0x11b854=_0x4e718e[_0x504de4];return _0x11b854;}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_0x4eb977 from'prompts';import a33_0x59ff05 from'chalk';function validateProfileName(_0x240ceb,_0x51efde){const _0xb98ab7=a33_0x11b8;if(!_0x240ceb||!_0x240ceb[_0xb98ab7(0xfc)]())return _0xb98ab7(0x125);const _0x7963a6=_0x240ceb[_0xb98ab7(0xfc)]();if(!/^[a-zA-Z0-9_-]+$/[_0xb98ab7(0x123)](_0x7963a6))return _0xb98ab7(0x11f);if(!_0x51efde?.[_0xb98ab7(0x112)]&&profileExists(_0x7963a6))return _0xb98ab7(0x10b)+_0x7963a6+_0xb98ab7(0xe1)+_0x7963a6+_0xb98ab7(0x107);return!![];}async function deleteProfileAndCredentials(_0x36c52a){removeProfileFromUserConfig(_0x36c52a);const _0x54409b=await isKeychainAvailable();_0x54409b&&await Promise['all']([deleteKeychainAPIKey(_0x36c52a),deleteOAuthTokens(_0x36c52a)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x52cc0c(0x136)]=a33_0x52cc0c(0xd8);[a33_0x52cc0c(0xf7)]=a33_0x52cc0c(0x11b);async['execute'](_0x4c722d){const _0x59dc51=a33_0x52cc0c,{options:_0x48b561,args:_0x262e57}=_0x4c722d,_0x59c8c7=!!_0x48b561[_0x59dc51(0x13b)];console[_0x59dc51(0xfa)](a33_0x59ff05[_0x59dc51(0x135)](_0x59dc51(0x13a)));let _0x3aca13;if(_0x262e57[_0x59dc51(0xfb)]>0x0&&_0x262e57[0x0]){const _0x1b3e22=_0x262e57[0x0][_0x59dc51(0xfc)]();_0x59c8c7&&profileExists(_0x1b3e22)&&(await deleteProfileAndCredentials(_0x1b3e22),console[_0x59dc51(0xfa)](_0x59dc51(0x114)+_0x1b3e22+'\x27'));const _0x4909ac=validateProfileName(_0x1b3e22);if(_0x4909ac!==!![])return console[_0x59dc51(0xdd)](a33_0x59ff05['red'](_0x4909ac)),0x1;_0x3aca13=_0x1b3e22;}else{const _0x288440=await a33_0x4eb977({'type':_0x59dc51(0xd4),'name':_0x59dc51(0x105),'message':'Enter\x20profile\x20name:','validate':_0x483130=>validateProfileName(_0x483130,{'skipExistsCheck':_0x59c8c7})});if(!_0x288440['profileName'])return console[_0x59dc51(0xfa)](_0x59dc51(0x137)),0x1;_0x3aca13=_0x288440[_0x59dc51(0x105)]['trim'](),_0x59c8c7&&profileExists(_0x3aca13)&&(await deleteProfileAndCredentials(_0x3aca13),console[_0x59dc51(0xfa)](_0x59dc51(0x114)+_0x3aca13+'\x27'));}const _0x2f8754=await a33_0x4eb977({'type':_0x59dc51(0xd4),'name':'description','message':_0x59dc51(0x13c)}),_0xa3115b=_0x2f8754[_0x59dc51(0xf7)]?.[_0x59dc51(0xfc)]()||undefined,_0x62f1ee=_0x48b561[_0x59dc51(0x120)]||_0x59dc51(0x128),_0x4363d7=await promptSiteSelection(_0x62f1ee,_0x3aca13,_0x59dc51(0x116));if(!_0x4363d7)return 0x1;const _0x2cc752=resolveSite(_0x4363d7),_0x491bac=await promptAuthMethod();if(!_0x491bac)return console[_0x59dc51(0xfa)](_0x59dc51(0x137)),0x1;if(_0x491bac===_0x59dc51(0xfe)){if(_0xa3115b){const _0x385a08={'site':_0x2cc752,'description':_0xa3115b};saveProfileToUserConfig(_0x3aca13,_0x385a08);}const {accountName:_0x2d40fc}=_0x48b561;return await runOAuthLoginFlow(_0x2cc752,_0x3aca13,_0x48b561[_0x59dc51(0xf3)]??LogLevel[_0x59dc51(0xde)],{'accountName':_0x2d40fc}),0x0;}console['log'](_0x59dc51(0x10c)+_0x2cc752),console[_0x59dc51(0xfa)](_0x59dc51(0xf0)),console[_0x59dc51(0xfa)]('\x20\x20'+getConsoleUrl(_0x2cc752,'/app/mp/ak'));const _0x2a0a27=await a33_0x4eb977({'type':'password','name':'apiKey','message':_0x59dc51(0xff),'validate':_0x21c435=>{const _0x13783f=_0x59dc51;if(!_0x21c435||!_0x21c435[_0x13783f(0xfc)]())return _0x13783f(0x12b);return!![];}});if(!_0x2a0a27[_0x59dc51(0xdc)])return console['log'](_0x59dc51(0x137)),0x1;const _0x51203a=_0x2a0a27['apiKey'];console[_0x59dc51(0xfa)]('Validating\x20API\x20key...');try{const _0x41d1ea=TDX[_0x59dc51(0xe5)]({'site':_0x2cc752,'apiKey':_0x51203a[_0x59dc51(0xfc)](),'logLevel':_0x48b561[_0x59dc51(0xf3)]??LogLevel[_0x59dc51(0xde)]}),_0x4da764=await _0x41d1ea[_0x59dc51(0xd6)][_0x59dc51(0xe3)]();console['log'](a33_0x59ff05['green']('✓')+_0x59dc51(0x117)+_0x4da764[_0x59dc51(0x119)]+')');const _0x28ae15=await isKeychainAvailable();_0x28ae15?(await saveAPIKeyAsync(_0x51203a[_0x59dc51(0xfc)](),_0x2cc752,_0x3aca13),console[_0x59dc51(0xfa)](a33_0x59ff05[_0x59dc51(0xd7)]('✓')+_0x59dc51(0x139)+_0x3aca13+')')):(console['warn'](a33_0x59ff05[_0x59dc51(0x132)](_0x59dc51(0x101))),console['warn'](a33_0x59ff05[_0x59dc51(0x132)](_0x59dc51(0x131))));const _0x3c6988={'site':_0x2cc752,..._0xa3115b&&{'description':_0xa3115b}};return saveProfileToUserConfig(_0x3aca13,_0x3c6988),console[_0x59dc51(0xfa)](a33_0x59ff05[_0x59dc51(0xd7)]('✓')+_0x59dc51(0xef)+_0x3aca13+_0x59dc51(0xda)),console[_0x59dc51(0xfa)](),console['log']('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console['log'](_0x59dc51(0xd5)+_0x3aca13+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x59dc51(0xfa)](_0x59dc51(0xd5)+_0x3aca13+_0x59dc51(0x115)),0x0;}catch(_0x1e812d){if(_0x1e812d instanceof HTTPClientError&&_0x1e812d[_0x59dc51(0xdb)]===0x191)return printAuthError(_0x1e812d),0x1;return console[_0x59dc51(0xdd)](a33_0x59ff05[_0x59dc51(0x122)](_0x59dc51(0xdf)+(_0x1e812d instanceof Error?_0x1e812d[_0x59dc51(0x113)]:String(_0x1e812d)))),console['error'](_0x59dc51(0x12a)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{['name']='profile:delete';[a33_0x52cc0c(0xf7)]='Delete\x20a\x20profile';[a33_0x52cc0c(0x138)](_0x17cf38){const _0x427916=a33_0x52cc0c,{args:_0x7a9f0c}=_0x17cf38;if(_0x7a9f0c[_0x427916(0xfb)]===0x0)return _0x427916(0x118);return undefined;}async['execute'](_0x4e706a){const _0x30d3e7=a33_0x52cc0c,{args:_0x2d7910}=_0x4e706a,_0x15a3ba=_0x2d7910[0x0];console[_0x30d3e7(0xfa)](a33_0x59ff05['bold']('tdx:\x20profile\x20delete'));if(!profileExists(_0x15a3ba)){console[_0x30d3e7(0xdd)](a33_0x59ff05[_0x30d3e7(0x122)]('Profile\x20\x27'+_0x15a3ba+_0x30d3e7(0xf2))),console[_0x30d3e7(0xfa)](_0x30d3e7(0xe4));const _0xf836c0=listProfiles();if(_0xf836c0[_0x30d3e7(0xfb)]===0x0)console[_0x30d3e7(0xfa)](_0x30d3e7(0x124));else for(const _0x83254f of _0xf836c0){console[_0x30d3e7(0xfa)]('\x20\x20-\x20'+_0x83254f['name']);}return 0x1;}const _0x56435f=await a33_0x4eb977({'type':_0x30d3e7(0x133),'name':_0x30d3e7(0x133),'message':_0x30d3e7(0x12c)+_0x15a3ba+'\x27?','initial':![]});if(!_0x56435f['confirm'])return console[_0x30d3e7(0xfa)](_0x30d3e7(0x127)),0x0;try{await deleteProfileAndCredentials(_0x15a3ba),console['log'](a33_0x59ff05[_0x30d3e7(0xd7)]('✓')+'\x20Profile\x20\x27'+_0x15a3ba+_0x30d3e7(0x11e));}catch(_0x2f8222){return console['error'](a33_0x59ff05[_0x30d3e7(0x122)]('Failed\x20to\x20delete\x20profile:\x20'+(_0x2f8222 instanceof Error?_0x2f8222[_0x30d3e7(0x113)]:String(_0x2f8222)))),0x1;}return 0x0;}}function a33_0x4e71(){const _0x24f019=['1978RYwUdx','\x27\x20created','status','apiKey','error','ERROR','✗\x20Validation\x20failed:\x20','435624XfpeSj','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','getUserInfo','\x0aAvailable\x20profiles:','create','Validating\x20API\x20key...','profile:use','join','\x27\x20updated:\x20','\x20API\x20key\x20saved\x20to\x20system\x20keychain','\x27\x20requires\x20API\x20key\x20validation.','8SVDImp','profile','351UcAcNE','\x20Profile\x20\x27','You\x20can\x20find\x20your\x20API\x20key\x20at:','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x27\x20does\x20not\x20exist.','logLevel','2206192OGKiVu','warn','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','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','5gffhVD','log','length','trim','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','oauth','Enter\x20your\x20TD\x20API\x20key:','llm_project','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','847TGOCXK','llm_agent','dim','profileName','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','416551vbaUZj','Default\x20profile\x20set\x20to:\x20','3344852XlKpla','Profile\x20\x27','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','\x0aOperation\x20cancelled','Set\x20a\x20profile\x20configuration\x20value','/app/mp/ak','execute','1591263nilbsz','skipExistsCheck','message','Removed\x20existing\x20profile\x20\x27','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Setup\x20cancelled','\x20API\x20key\x20is\x20valid\x20(User:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','email','\x20\x20-\x20','Create\x20a\x20new\x20profile','(cleared)','password','\x27\x20deleted','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','site','Unknown\x20key\x20\x27','red','test','\x20\x20(no\x20profiles\x20found)','Profile\x20name\x20cannot\x20be\x20empty','includes','Removal\x20cancelled','us01','tdx.json','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','API\x20key\x20cannot\x20be\x20empty','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','VALID_KEYS','config','Site\x20was\x20not\x20changed.','\x27.\x0a\x0aValid\x20keys:\x20','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','yellow','confirm','session','bold','name','\x0aSetup\x20cancelled','validate','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','tdx:\x20profile\x20create','force','Enter\x20description\x20(optional):','tdx:\x20profile\x20set','(session:\x20','Set\x20session\x20profile','6810eETedV','split','\x20--default\x27\x20to\x20save\x20permanently','\x0aSaved\x20to:\x20','text','\x20\x20tdx\x20--profile\x20','jobs','green','profile:create'];a33_0x4e71=function(){return _0x24f019;};return a33_0x4e71();}export class ProfileSetCommand extends BaseCommand{['name']='profile:set';[a33_0x52cc0c(0xf7)]=a33_0x52cc0c(0x10e);static ['VALID_KEYS']=['site','database','parent_segment',a33_0x52cc0c(0x100),a33_0x52cc0c(0x103),'description'];[a33_0x52cc0c(0x138)](_0x6c641f){const _0xb6c21f=a33_0x52cc0c,{args:_0xfaab14,options:_0x5b39b4}=_0x6c641f,_0x89613a=_0x5b39b4[_0xb6c21f(0xed)]||getActiveProfile();if(!_0x89613a)return _0xb6c21f(0xf6);if(_0xfaab14[_0xb6c21f(0xfb)]===0x0)return _0xb6c21f(0x106)+ProfileSetCommand[_0xb6c21f(0x12d)][_0xb6c21f(0xe8)](',\x20');const _0x14aad4=_0xfaab14[0x0];if(!_0x14aad4[_0xb6c21f(0x126)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0xb6c21f(0x12d)][_0xb6c21f(0xe8)](',\x20');const [_0x5acbe3]=_0x14aad4[_0xb6c21f(0xd1)]('=',0x2);if(!ProfileSetCommand[_0xb6c21f(0x12d)][_0xb6c21f(0x126)](_0x5acbe3))return _0xb6c21f(0x121)+_0x5acbe3+_0xb6c21f(0x130)+ProfileSetCommand['VALID_KEYS']['join'](',\x20');return undefined;}async[a33_0x52cc0c(0x110)](_0xe14e2e){const _0x18da43=a33_0x52cc0c,{args:_0x2b5fe1,options:_0x41d1db}=_0xe14e2e,_0x331ada=_0x41d1db['profile']||getActiveProfile(),[_0x3e9ccf,..._0x60b5fb]=_0x2b5fe1[0x0][_0x18da43(0xd1)]('='),_0x3014b8=_0x60b5fb[_0x18da43(0xe8)]('=');console[_0x18da43(0xfa)](a33_0x59ff05[_0x18da43(0x135)](_0x18da43(0x13d)));if(!profileExists(_0x331ada)){const _0xe08e1e=await a33_0x4eb977({'type':_0x18da43(0x133),'name':'create','message':_0x18da43(0x10b)+_0x331ada+_0x18da43(0xf1),'initial':!![]});if(!_0xe08e1e[_0x18da43(0xe5)])return console[_0x18da43(0xfa)]('Operation\x20cancelled'),0x1;}const _0x53cf86=loadProfile(_0x331ada),_0x2d4cc4=_0x53cf86?.[_0x18da43(0x12e)]||{};if(_0x3e9ccf===_0x18da43(0x120)){const _0x394589=resolveSite(_0x3014b8);console['log']('Changing\x20site\x20to\x20\x27'+_0x394589+_0x18da43(0xeb)),console[_0x18da43(0xfa)](_0x18da43(0xe2)),console[_0x18da43(0xfa)]('\x20\x20'+getConsoleUrl(_0x394589,_0x18da43(0x10f)));const _0x170cd1=await a33_0x4eb977({'type':_0x18da43(0x11d),'name':'apiKey','message':_0x18da43(0xfd),'validate':_0x5da881=>{const _0x5eb15a=_0x18da43;if(!_0x5da881||!_0x5da881[_0x5eb15a(0xfc)]())return _0x5eb15a(0x12b);return!![];}});if(!_0x170cd1[_0x18da43(0xdc)])return console['log'](_0x18da43(0x10d)),0x1;console[_0x18da43(0xfa)](_0x18da43(0xe6));try{const _0x4dcd5b=TDX[_0x18da43(0xe5)]({'site':_0x394589,'apiKey':_0x170cd1[_0x18da43(0xdc)][_0x18da43(0xfc)](),'logLevel':_0x41d1db[_0x18da43(0xf3)]??LogLevel[_0x18da43(0xde)]}),_0x5c6c23=await _0x4dcd5b[_0x18da43(0xd6)][_0x18da43(0xe3)]();console['log'](a33_0x59ff05[_0x18da43(0xd7)]('✓')+_0x18da43(0x117)+_0x5c6c23[_0x18da43(0x119)]+')');const _0x4c72d0=await isKeychainAvailable();_0x4c72d0?(await saveAPIKeyAsync(_0x170cd1['apiKey']['trim'](),_0x394589,_0x331ada),console[_0x18da43(0xfa)](a33_0x59ff05[_0x18da43(0xd7)]('✓')+_0x18da43(0xea))):console[_0x18da43(0xf5)](a33_0x59ff05['yellow'](_0x18da43(0x101))),_0x2d4cc4[_0x18da43(0x120)]=_0x394589;}catch(_0x435664){if(_0x435664 instanceof HTTPClientError&&_0x435664[_0x18da43(0xdb)]===0x191)return printAuthError(_0x435664),0x1;return console[_0x18da43(0xdd)](a33_0x59ff05[_0x18da43(0x122)](_0x18da43(0xdf)+(_0x435664 instanceof Error?_0x435664['message']:String(_0x435664)))),console[_0x18da43(0xdd)](_0x18da43(0x12f)),0x1;}}else _0x2d4cc4[_0x3e9ccf]=_0x3014b8||undefined;return saveProfileToUserConfig(_0x331ada,_0x2d4cc4),console[_0x18da43(0xfa)](a33_0x59ff05[_0x18da43(0xd7)]('✓')+'\x20Profile\x20\x27'+_0x331ada+_0x18da43(0xe9)+_0x3e9ccf+'='+(_0x3014b8||_0x18da43(0x11c))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x52cc0c(0x136)]=a33_0x52cc0c(0xe7);[a33_0x52cc0c(0xf7)]=a33_0x52cc0c(0xcf);[a33_0x52cc0c(0x138)](_0x222ecf){const {args:_0x5d0b65}=_0x222ecf;if(_0x5d0b65['length']===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async['execute'](_0x4b3f00){const _0x161833=a33_0x52cc0c,{args:_0x384e23,options:_0x55f499}=_0x4b3f00,_0x37d806=_0x384e23[0x0],_0xfe4ba9=_0x55f499['default'];cleanExpiredSessions();if(!profileExists(_0x37d806)){console[_0x161833(0xdd)](a33_0x59ff05['red'](_0x161833(0x10b)+_0x37d806+_0x161833(0xf2))),console[_0x161833(0xfa)](_0x161833(0xe4));const _0x3c5161=listProfiles();if(_0x3c5161[_0x161833(0xfb)]===0x0)console[_0x161833(0xfa)](_0x161833(0x124));else for(const _0xc12f30 of _0x3c5161){console['log'](_0x161833(0x11a)+_0xc12f30['name']);}return 0x1;}if(_0xfe4ba9){const _0x39bdd8=a33_0x41eced[_0x161833(0xe8)](getConfigDir(),_0x161833(0x129));return saveActiveProfileToUserConfig(_0x37d806),console[_0x161833(0xfa)](_0x161833(0x109)+a33_0x59ff05['green'](_0x37d806)),console[_0x161833(0xfa)](a33_0x59ff05[_0x161833(0x104)](_0x161833(0xd3)+_0x39bdd8)),0x0;}const _0x3c18ee=getSessionID(_0x55f499[_0x161833(0x134)]);return saveSessionContext({'profile':_0x37d806},_0x55f499['session']),console['log']('Session\x20profile\x20set\x20to:\x20'+a33_0x59ff05[_0x161833(0xd7)](_0x37d806)+'\x20'+a33_0x59ff05['dim'](_0x161833(0x13e)+_0x3c18ee+')')),console[_0x161833(0xfa)](a33_0x59ff05['dim'](_0x161833(0xf8)+_0x37d806+_0x161833(0xd2))),0x0;}}
1
+ function a33_0x4a79(_0x5961c3,_0x5a887b){_0x5961c3=_0x5961c3-0xf8;const _0x42ec31=a33_0x42ec();let _0x4a79d6=_0x42ec31[_0x5961c3];return _0x4a79d6;}const a33_0x36aa88=a33_0x4a79;(function(_0x1002ce,_0x1e4fa3){const _0x26f814=a33_0x4a79,_0x5b4ad9=_0x1002ce();while(!![]){try{const _0x47edb1=-parseInt(_0x26f814(0xfd))/0x1+parseInt(_0x26f814(0x12d))/0x2+-parseInt(_0x26f814(0x127))/0x3+-parseInt(_0x26f814(0x118))/0x4*(parseInt(_0x26f814(0x11f))/0x5)+-parseInt(_0x26f814(0x15e))/0x6+-parseInt(_0x26f814(0x109))/0x7+parseInt(_0x26f814(0x10d))/0x8;if(_0x47edb1===_0x1e4fa3)break;else _0x5b4ad9['push'](_0x5b4ad9['shift']());}catch(_0x516a01){_0x5b4ad9['push'](_0x5b4ad9['shift']());}}}(a33_0x42ec,0xe8708));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a33_0x408218 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';function a33_0x42ec(){const _0x3cfc02=['Changing\x20site\x20to\x20\x27','(cleared)','parent_segment','profile:create','force','execute','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x20\x20(no\x20profiles\x20found)','Unknown\x20key\x20\x27','status','red','create','includes','Removed\x20existing\x20profile\x20\x27','\x20\x20tdx\x20--profile\x20','\x27\x20deleted','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','oauth','apiKey','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','message','confirm','\x20API\x20key\x20is\x20valid\x20(User:\x20','tdx.json','default','site','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','session','/app/mp/ak','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Set\x20a\x20profile\x20configuration\x20value','Profile\x20\x27','llm_project','✗\x20Validation\x20failed:\x20','\x20Profile\x20\x27','Enter\x20description\x20(optional):','8561430tKfyxJ','\x27\x20does\x20not\x20exist.','\x27\x20updated:\x20','jobs','VALID_KEYS','config','us01','Default\x20profile\x20set\x20to:\x20','\x0aSetup\x20cancelled','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','tdx:\x20profile\x20delete','954789cXBxSp','Delete\x20a\x20profile','Set\x20session\x20profile','Create\x20a\x20new\x20profile','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','tdx:\x20profile\x20create','profile','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','all','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','join','yellow','4111723Xbovpk','Session\x20profile\x20set\x20to:\x20','profile:delete','length','32929608ZeLhXd','trim','split','Operation\x20cancelled','description','green','bold','database','validate','API\x20key\x20cannot\x20be\x20empty','name','4TkTHcG','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','\x0aAvailable\x20profiles:','email','ERROR','profile:set','\x20API\x20key\x20saved\x20to\x20system\x20keychain','890665tHpbfc','log','error','getUserInfo','text','profile:use','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','\x20--default\x27\x20to\x20save\x20permanently','568662onzFBa','Validating\x20API\x20key...','(session:\x20','llm_agent','password','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','345282kbmZoW','profileName','logLevel','dim','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','\x27\x20requires\x20API\x20key\x20validation.','Enter\x20your\x20TD\x20API\x20key:','\x27.\x0a\x0aValid\x20keys:\x20','warn','Profile\x20name\x20cannot\x20be\x20empty'];a33_0x42ec=function(){return _0x3cfc02;};return a33_0x42ec();}import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a33_0xa63d20 from'prompts';import a33_0x2ddaba from'chalk';function validateProfileName(_0x31d064,_0x19869b){const _0x51490b=a33_0x4a79;if(!_0x31d064||!_0x31d064[_0x51490b(0x10e)]())return _0x51490b(0x136);const _0x10a244=_0x31d064[_0x51490b(0x10e)]();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x10a244))return _0x51490b(0x101);if(!_0x19869b?.['skipExistsCheck']&&profileExists(_0x10a244))return'Profile\x20\x27'+_0x10a244+_0x51490b(0x147)+_0x10a244+'\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.';return!![];}async function deleteProfileAndCredentials(_0x256d66){const _0x473c53=a33_0x4a79;removeProfileFromUserConfig(_0x256d66);const _0x23399e=await isKeychainAvailable();_0x23399e&&await Promise[_0x473c53(0x105)]([deleteKeychainAPIKey(_0x256d66),deleteOAuthTokens(_0x256d66)]);}export class ProfileCreateCommand extends BaseCommand{['name']=a33_0x36aa88(0x13a);[a33_0x36aa88(0x111)]=a33_0x36aa88(0x100);async['execute'](_0x2672c1){const _0x450580=a33_0x36aa88,{options:_0x2cfaee,args:_0x4c6eba}=_0x2672c1,_0x49775=!!_0x2cfaee[_0x450580(0x13b)];console[_0x450580(0x120)](a33_0x2ddaba[_0x450580(0x113)](_0x450580(0x102)));let _0x4dcd67;if(_0x4c6eba[_0x450580(0x10c)]>0x0&&_0x4c6eba[0x0]){const _0x1a8127=_0x4c6eba[0x0]['trim']();_0x49775&&profileExists(_0x1a8127)&&(await deleteProfileAndCredentials(_0x1a8127),console[_0x450580(0x120)](_0x450580(0x144)+_0x1a8127+'\x27'));const _0x47045f=validateProfileName(_0x1a8127);if(_0x47045f!==!![])return console[_0x450580(0x121)](a33_0x2ddaba[_0x450580(0x141)](_0x47045f)),0x1;_0x4dcd67=_0x1a8127;}else{const _0xe86dde=await a33_0xa63d20({'type':_0x450580(0x123),'name':_0x450580(0x12e),'message':'Enter\x20profile\x20name:','validate':_0x384286=>validateProfileName(_0x384286,{'skipExistsCheck':_0x49775})});if(!_0xe86dde[_0x450580(0x12e)])return console[_0x450580(0x120)]('\x0aSetup\x20cancelled'),0x1;_0x4dcd67=_0xe86dde[_0x450580(0x12e)]['trim'](),_0x49775&&profileExists(_0x4dcd67)&&(await deleteProfileAndCredentials(_0x4dcd67),console[_0x450580(0x120)](_0x450580(0x144)+_0x4dcd67+'\x27'));}const _0x8e3af1=await a33_0xa63d20({'type':_0x450580(0x123),'name':_0x450580(0x111),'message':_0x450580(0x15d)}),_0x281932=_0x8e3af1['description']?.[_0x450580(0x10e)]()||undefined,_0x4fd741=_0x2cfaee[_0x450580(0x152)]||_0x450580(0xf8),_0x3ff392=await promptSiteSelection(_0x4fd741,_0x4dcd67,'Setup\x20cancelled');if(!_0x3ff392)return 0x1;const _0x4f2475=resolveSite(_0x3ff392),_0x403451=await promptAuthMethod();if(!_0x403451)return console[_0x450580(0x120)](_0x450580(0xfa)),0x1;if(_0x403451===_0x450580(0x149)){if(_0x281932){const _0x29097d={'site':_0x4f2475,'description':_0x281932};saveProfileToUserConfig(_0x4dcd67,_0x29097d);}const {accountName:_0x5bff95}=_0x2cfaee;return await runOAuthLoginFlow(_0x4f2475,_0x4dcd67,_0x2cfaee['logLevel']??LogLevel[_0x450580(0x11c)],{'accountName':_0x5bff95}),0x0;}console['log'](_0x450580(0x14c)+_0x4f2475),console[_0x450580(0x120)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x450580(0x120)]('\x20\x20'+getConsoleUrl(_0x4f2475,_0x450580(0x156)));const _0x1c9cae=await a33_0xa63d20({'type':_0x450580(0x12b),'name':'apiKey','message':_0x450580(0x133),'validate':_0x40a436=>{const _0x11fdd0=_0x450580;if(!_0x40a436||!_0x40a436['trim']())return _0x11fdd0(0x116);return!![];}});if(!_0x1c9cae[_0x450580(0x14a)])return console['log'](_0x450580(0xfa)),0x1;const _0x2d6d29=_0x1c9cae[_0x450580(0x14a)];console[_0x450580(0x120)](_0x450580(0x128));try{const _0x5391ec=TDX[_0x450580(0x142)]({'site':_0x4f2475,'apiKey':_0x2d6d29['trim'](),'logLevel':_0x2cfaee['logLevel']??LogLevel[_0x450580(0x11c)]}),_0x318d70=await _0x5391ec[_0x450580(0x161)][_0x450580(0x122)]();console['log'](a33_0x2ddaba[_0x450580(0x112)]('✓')+_0x450580(0x14f)+_0x318d70['email']+')');const _0x532c21=await isKeychainAvailable();_0x532c21?(await saveAPIKeyAsync(_0x2d6d29[_0x450580(0x10e)](),_0x4f2475,_0x4dcd67),console[_0x450580(0x120)](a33_0x2ddaba[_0x450580(0x112)]('✓')+_0x450580(0x119)+_0x4dcd67+')')):(console[_0x450580(0x135)](a33_0x2ddaba[_0x450580(0x108)](_0x450580(0x157))),console['warn'](a33_0x2ddaba['yellow'](_0x450580(0x131))));const _0x373b3e={'site':_0x4f2475,..._0x281932&&{'description':_0x281932}};return saveProfileToUserConfig(_0x4dcd67,_0x373b3e),console[_0x450580(0x120)](a33_0x2ddaba[_0x450580(0x112)]('✓')+_0x450580(0x15c)+_0x4dcd67+'\x27\x20created'),console[_0x450580(0x120)](),console['log'](_0x450580(0x106)),console[_0x450580(0x120)](_0x450580(0x145)+_0x4dcd67+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console['log'](_0x450580(0x145)+_0x4dcd67+_0x450580(0x12c)),0x0;}catch(_0x2d5ef6){if(_0x2d5ef6 instanceof HTTPClientError&&_0x2d5ef6[_0x450580(0x140)]===0x191)return printAuthError(_0x2d5ef6),0x1;return console[_0x450580(0x121)](a33_0x2ddaba[_0x450580(0x141)](_0x450580(0x15b)+(_0x2d5ef6 instanceof Error?_0x2d5ef6[_0x450580(0x14d)]:String(_0x2d5ef6)))),console[_0x450580(0x121)](_0x450580(0x125)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x36aa88(0x117)]=a33_0x36aa88(0x10b);[a33_0x36aa88(0x111)]=a33_0x36aa88(0xfe);['validate'](_0x5d5667){const _0x4976be=a33_0x36aa88,{args:_0x144007}=_0x5d5667;if(_0x144007[_0x4976be(0x10c)]===0x0)return _0x4976be(0x154);return undefined;}async[a33_0x36aa88(0x13c)](_0x2d3bc4){const _0xf1ac1e=a33_0x36aa88,{args:_0x131296}=_0x2d3bc4,_0x234b5b=_0x131296[0x0];console[_0xf1ac1e(0x120)](a33_0x2ddaba[_0xf1ac1e(0x113)](_0xf1ac1e(0xfc)));if(!profileExists(_0x234b5b)){console[_0xf1ac1e(0x121)](a33_0x2ddaba[_0xf1ac1e(0x141)](_0xf1ac1e(0x159)+_0x234b5b+_0xf1ac1e(0x15f))),console[_0xf1ac1e(0x120)]('\x0aAvailable\x20profiles:');const _0x71f669=listProfiles();if(_0x71f669['length']===0x0)console[_0xf1ac1e(0x120)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x5e772a of _0x71f669){console[_0xf1ac1e(0x120)]('\x20\x20-\x20'+_0x5e772a[_0xf1ac1e(0x117)]);}return 0x1;}const _0x5b3e7f=await a33_0xa63d20({'type':_0xf1ac1e(0x14e),'name':'confirm','message':_0xf1ac1e(0x104)+_0x234b5b+'\x27?','initial':![]});if(!_0x5b3e7f[_0xf1ac1e(0x14e)])return console[_0xf1ac1e(0x120)]('Removal\x20cancelled'),0x0;try{await deleteProfileAndCredentials(_0x234b5b),console[_0xf1ac1e(0x120)](a33_0x2ddaba['green']('✓')+_0xf1ac1e(0x15c)+_0x234b5b+_0xf1ac1e(0x146));}catch(_0x2e56f1){return console[_0xf1ac1e(0x121)](a33_0x2ddaba[_0xf1ac1e(0x141)]('Failed\x20to\x20delete\x20profile:\x20'+(_0x2e56f1 instanceof Error?_0x2e56f1[_0xf1ac1e(0x14d)]:String(_0x2e56f1)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a33_0x36aa88(0x11d);[a33_0x36aa88(0x111)]=a33_0x36aa88(0x158);static [a33_0x36aa88(0x162)]=[a33_0x36aa88(0x152),a33_0x36aa88(0x114),a33_0x36aa88(0x139),a33_0x36aa88(0x15a),a33_0x36aa88(0x12a),'description'];[a33_0x36aa88(0x115)](_0x46304d){const _0x1a6c41=a33_0x36aa88,{args:_0x2193f7,options:_0x44ef5c}=_0x46304d,_0x5af316=_0x44ef5c[_0x1a6c41(0x103)]||getActiveProfile();if(!_0x5af316)return'No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>';if(_0x2193f7[_0x1a6c41(0x10c)]===0x0)return _0x1a6c41(0x148)+ProfileSetCommand[_0x1a6c41(0x162)][_0x1a6c41(0x107)](',\x20');const _0x8e4c9d=_0x2193f7[0x0];if(!_0x8e4c9d[_0x1a6c41(0x143)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x1a6c41(0x162)]['join'](',\x20');const [_0x4c9712]=_0x8e4c9d[_0x1a6c41(0x10f)]('=',0x2);if(!ProfileSetCommand[_0x1a6c41(0x162)][_0x1a6c41(0x143)](_0x4c9712))return _0x1a6c41(0x13f)+_0x4c9712+_0x1a6c41(0x134)+ProfileSetCommand[_0x1a6c41(0x162)][_0x1a6c41(0x107)](',\x20');return undefined;}async[a33_0x36aa88(0x13c)](_0x255078){const _0x5c00e7=a33_0x36aa88,{args:_0x22b923,options:_0xfec72a}=_0x255078,_0x171b12=_0xfec72a[_0x5c00e7(0x103)]||getActiveProfile(),[_0x53f7bd,..._0x338a3c]=_0x22b923[0x0][_0x5c00e7(0x10f)]('='),_0x3c47b7=_0x338a3c[_0x5c00e7(0x107)]('=');console[_0x5c00e7(0x120)](a33_0x2ddaba[_0x5c00e7(0x113)]('tdx:\x20profile\x20set'));if(!profileExists(_0x171b12)){const _0x58b61a=await a33_0xa63d20({'type':_0x5c00e7(0x14e),'name':'create','message':_0x5c00e7(0x159)+_0x171b12+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x58b61a[_0x5c00e7(0x142)])return console[_0x5c00e7(0x120)](_0x5c00e7(0x110)),0x1;}const _0x3f2e19=loadProfile(_0x171b12),_0x60245b=_0x3f2e19?.[_0x5c00e7(0x163)]||{};if(_0x53f7bd===_0x5c00e7(0x152)){const _0x1721e6=resolveSite(_0x3c47b7);console[_0x5c00e7(0x120)](_0x5c00e7(0x137)+_0x1721e6+_0x5c00e7(0x132)),console[_0x5c00e7(0x120)](_0x5c00e7(0x153)),console[_0x5c00e7(0x120)]('\x20\x20'+getConsoleUrl(_0x1721e6,'/app/mp/ak'));const _0x41f077=await a33_0xa63d20({'type':'password','name':_0x5c00e7(0x14a),'message':_0x5c00e7(0x13d),'validate':_0x26eee8=>{if(!_0x26eee8||!_0x26eee8['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x41f077['apiKey'])return console[_0x5c00e7(0x120)]('\x0aOperation\x20cancelled'),0x1;console['log'](_0x5c00e7(0x128));try{const _0xf1fce7=TDX[_0x5c00e7(0x142)]({'site':_0x1721e6,'apiKey':_0x41f077[_0x5c00e7(0x14a)]['trim'](),'logLevel':_0xfec72a[_0x5c00e7(0x12f)]??LogLevel[_0x5c00e7(0x11c)]}),_0x52187f=await _0xf1fce7[_0x5c00e7(0x161)][_0x5c00e7(0x122)]();console[_0x5c00e7(0x120)](a33_0x2ddaba[_0x5c00e7(0x112)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x52187f[_0x5c00e7(0x11b)]+')');const _0x5e9ad7=await isKeychainAvailable();_0x5e9ad7?(await saveAPIKeyAsync(_0x41f077['apiKey'][_0x5c00e7(0x10e)](),_0x1721e6,_0x171b12),console[_0x5c00e7(0x120)](a33_0x2ddaba[_0x5c00e7(0x112)]('✓')+_0x5c00e7(0x11e))):console[_0x5c00e7(0x135)](a33_0x2ddaba[_0x5c00e7(0x108)](_0x5c00e7(0x157))),_0x60245b['site']=_0x1721e6;}catch(_0xf00909){if(_0xf00909 instanceof HTTPClientError&&_0xf00909[_0x5c00e7(0x140)]===0x191)return printAuthError(_0xf00909),0x1;return console[_0x5c00e7(0x121)](a33_0x2ddaba[_0x5c00e7(0x141)]('✗\x20Validation\x20failed:\x20'+(_0xf00909 instanceof Error?_0xf00909[_0x5c00e7(0x14d)]:String(_0xf00909)))),console[_0x5c00e7(0x121)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x60245b[_0x53f7bd]=_0x3c47b7||undefined;return saveProfileToUserConfig(_0x171b12,_0x60245b),console['log'](a33_0x2ddaba['green']('✓')+_0x5c00e7(0x15c)+_0x171b12+_0x5c00e7(0x160)+_0x53f7bd+'='+(_0x3c47b7||_0x5c00e7(0x138))),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a33_0x36aa88(0x124);['description']=a33_0x36aa88(0xff);[a33_0x36aa88(0x115)](_0x30c34b){const _0x4f55c8=a33_0x36aa88,{args:_0x72ad81}=_0x30c34b;if(_0x72ad81[_0x4f55c8(0x10c)]===0x0)return _0x4f55c8(0x14b);return undefined;}async[a33_0x36aa88(0x13c)](_0x4ab256){const _0x4307ea=a33_0x36aa88,{args:_0x4f298c,options:_0x1ac797}=_0x4ab256,_0x41a9e=_0x4f298c[0x0],_0x360ea7=_0x1ac797[_0x4307ea(0x151)];cleanExpiredSessions();if(!profileExists(_0x41a9e)){console[_0x4307ea(0x121)](a33_0x2ddaba['red']('Profile\x20\x27'+_0x41a9e+'\x27\x20does\x20not\x20exist.')),console[_0x4307ea(0x120)](_0x4307ea(0x11a));const _0x27a1b4=listProfiles();if(_0x27a1b4[_0x4307ea(0x10c)]===0x0)console[_0x4307ea(0x120)](_0x4307ea(0x13e));else for(const _0x31c547 of _0x27a1b4){console['log']('\x20\x20-\x20'+_0x31c547[_0x4307ea(0x117)]);}return 0x1;}if(_0x360ea7){const _0x1cea0f=a33_0x408218[_0x4307ea(0x107)](getConfigDir(),_0x4307ea(0x150));return saveActiveProfileToUserConfig(_0x41a9e),console[_0x4307ea(0x120)](_0x4307ea(0xf9)+a33_0x2ddaba[_0x4307ea(0x112)](_0x41a9e)),console[_0x4307ea(0x120)](a33_0x2ddaba['dim']('\x0aSaved\x20to:\x20'+_0x1cea0f)),0x0;}const _0x5d4629=getSessionID(_0x1ac797[_0x4307ea(0x155)]);return saveSessionContext({'profile':_0x41a9e},_0x1ac797[_0x4307ea(0x155)]),console[_0x4307ea(0x120)](_0x4307ea(0x10a)+a33_0x2ddaba[_0x4307ea(0x112)](_0x41a9e)+'\x20'+a33_0x2ddaba[_0x4307ea(0x130)](_0x4307ea(0x129)+_0x5d4629+')')),console[_0x4307ea(0x120)](a33_0x2ddaba[_0x4307ea(0x130)](_0x4307ea(0xfb)+_0x41a9e+_0x4307ea(0x126))),0x0;}}
@@ -1 +1 @@
1
- const a34_0x2ff6f9=a34_0x5193;function a34_0x5193(_0x45155a,_0x5ae570){_0x45155a=_0x45155a-0xd3;const _0x4190a8=a34_0x4190();let _0x519377=_0x4190a8[_0x45155a];return _0x519377;}(function(_0x7c6f34,_0x3873ce){const _0x3e3947=a34_0x5193,_0xdeb511=_0x7c6f34();while(!![]){try{const _0x20ca7b=-parseInt(_0x3e3947(0xe8))/0x1*(-parseInt(_0x3e3947(0xe5))/0x2)+-parseInt(_0x3e3947(0xd9))/0x3*(-parseInt(_0x3e3947(0xd3))/0x4)+parseInt(_0x3e3947(0xef))/0x5+-parseInt(_0x3e3947(0xe3))/0x6+parseInt(_0x3e3947(0xe9))/0x7+-parseInt(_0x3e3947(0xe1))/0x8+-parseInt(_0x3e3947(0xe7))/0x9*(parseInt(_0x3e3947(0xed))/0xa);if(_0x20ca7b===_0x3873ce)break;else _0xdeb511['push'](_0xdeb511['shift']());}catch(_0x2825ea){_0xdeb511['push'](_0xdeb511['shift']());}}}(a34_0x4190,0x481e3));function a34_0x4190(){const _0x214c23=['\x20\x20Global:\x20~/.config/tdx/tdx.json','execute','message','👤\x20','33789wIHYcy','log','config','scope','green','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','length','List\x20all\x20available\x20profiles','2708656wxxTzm','description','13896iFwBow','dim','194226VduGkx','name','9QSVEmA','2AkbjRu','58912UhgyHA','site','profiles','Error:\x20','3365770yamTud','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','2443265ebGswG','100nqbBfZ','error'];a34_0x4190=function(){return _0x214c23;};return a34_0x4190();}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0xcf4112 from'chalk';export class ProfilesCommand extends BaseCommand{['name']=a34_0x2ff6f9(0xeb);[a34_0x2ff6f9(0xe2)]=a34_0x2ff6f9(0xe0);async[a34_0x2ff6f9(0xd6)](_0x44b6fa){const _0x9e940c=a34_0x2ff6f9,{options:_0x5af30d}=_0x44b6fa;try{const _0x549463=listProfiles(),_0x5bd1c1=getActiveProfile();if(_0x549463[_0x9e940c(0xdf)]===0x0)return console[_0x9e940c(0xda)](_0x9e940c(0xde)),console['log'](_0x9e940c(0xee)),console[_0x9e940c(0xda)](_0x9e940c(0xd5)),0x0;const _0x194f62=_0x549463['map'](_0x5efb53=>{const _0x119d09=_0x9e940c,_0x1ce35b=_0x5efb53[_0x119d09(0xe6)]===_0x5bd1c1,_0x695975=getProfileParams(_0x5efb53[_0x119d09(0xdb)]);return{'name':_0x5efb53[_0x119d09(0xe6)],'active':_0x1ce35b,'scope':_0x5efb53[_0x119d09(0xdc)],'description':_0x5efb53['config'][_0x119d09(0xe2)]||'','params':_0x695975};});if(isStructuredFormat(_0x5af30d))await handleSDKOutput(_0x194f62,_0x5af30d);else for(const _0x23f4a5 of _0x549463){const _0x5ede8c=_0x23f4a5[_0x9e940c(0xe6)]===_0x5bd1c1?a34_0xcf4112[_0x9e940c(0xdd)]('\x20✓'):'',_0x26b0da=_0x23f4a5[_0x9e940c(0xdb)][_0x9e940c(0xea)]?a34_0xcf4112[_0x9e940c(0xe4)]('\x20'+_0x23f4a5[_0x9e940c(0xdb)][_0x9e940c(0xea)]):'',_0x4e1290=_0x23f4a5[_0x9e940c(0xdb)][_0x9e940c(0xe2)]?a34_0xcf4112['dim']('\x20\x20'+_0x23f4a5[_0x9e940c(0xdb)]['description']):'';console[_0x9e940c(0xda)](_0x9e940c(0xd8)+_0x23f4a5[_0x9e940c(0xe6)]+_0x5ede8c+_0x26b0da+_0x4e1290);}return 0x0;}catch(_0x26dd2c){return _0x26dd2c instanceof Error&&console[_0x9e940c(0xd4)](_0x9e940c(0xec)+_0x26dd2c[_0x9e940c(0xd7)]),0x1;}}}
1
+ const a34_0x4a5e6e=a34_0x1e87;(function(_0x3de506,_0x4b10fa){const _0x393774=a34_0x1e87,_0x617e25=_0x3de506();while(!![]){try{const _0x7519bf=parseInt(_0x393774(0x6d))/0x1*(-parseInt(_0x393774(0x80))/0x2)+-parseInt(_0x393774(0x79))/0x3+parseInt(_0x393774(0x70))/0x4*(-parseInt(_0x393774(0x7b))/0x5)+-parseInt(_0x393774(0x71))/0x6+-parseInt(_0x393774(0x77))/0x7*(parseInt(_0x393774(0x82))/0x8)+parseInt(_0x393774(0x6c))/0x9*(parseInt(_0x393774(0x84))/0xa)+parseInt(_0x393774(0x81))/0xb;if(_0x7519bf===_0x4b10fa)break;else _0x617e25['push'](_0x617e25['shift']());}catch(_0x531228){_0x617e25['push'](_0x617e25['shift']());}}}(a34_0x18e8,0x4d065));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a34_0x1e87(_0x55065e,_0x18b9f7){_0x55065e=_0x55065e-0x6a;const _0x18e815=a34_0x18e8();let _0x1e8700=_0x18e815[_0x55065e];return _0x1e8700;}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x34a8fa from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x4a5e6e(0x75)]=a34_0x4a5e6e(0x74);['description']=a34_0x4a5e6e(0x7c);async[a34_0x4a5e6e(0x83)](_0x26e474){const _0x4a7d0a=a34_0x4a5e6e,{options:_0x5c171b}=_0x26e474;try{const _0x13a15e=listProfiles(),_0x377885=getActiveProfile();if(_0x13a15e[_0x4a7d0a(0x7d)]===0x0)return console[_0x4a7d0a(0x7a)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console['log']('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console['log'](_0x4a7d0a(0x78)),0x0;const _0x38ace6=_0x13a15e[_0x4a7d0a(0x76)](_0x222ad6=>{const _0x129c59=_0x4a7d0a,_0x5b31ea=_0x222ad6['name']===_0x377885,_0x24c7df=getProfileParams(_0x222ad6['config']);return{'name':_0x222ad6['name'],'active':_0x5b31ea,'scope':_0x222ad6[_0x129c59(0x73)],'description':_0x222ad6[_0x129c59(0x72)][_0x129c59(0x6b)]||'','params':_0x24c7df};});if(isStructuredFormat(_0x5c171b))await handleSDKOutput(_0x38ace6,_0x5c171b);else for(const _0x3468f5 of _0x13a15e){const _0x571e10=_0x3468f5[_0x4a7d0a(0x75)]===_0x377885?a34_0x34a8fa['green']('\x20✓'):'',_0x6035d4=_0x3468f5[_0x4a7d0a(0x72)][_0x4a7d0a(0x6f)]?a34_0x34a8fa[_0x4a7d0a(0x7f)]('\x20'+_0x3468f5['config'][_0x4a7d0a(0x6f)]):'',_0x7a64ea=_0x3468f5[_0x4a7d0a(0x72)][_0x4a7d0a(0x6b)]?a34_0x34a8fa[_0x4a7d0a(0x7f)]('\x20\x20'+_0x3468f5[_0x4a7d0a(0x72)][_0x4a7d0a(0x6b)]):'';console['log'](_0x4a7d0a(0x6a)+_0x3468f5[_0x4a7d0a(0x75)]+_0x571e10+_0x6035d4+_0x7a64ea);}return 0x0;}catch(_0x3c1186){return _0x3c1186 instanceof Error&&console['error'](_0x4a7d0a(0x7e)+_0x3c1186[_0x4a7d0a(0x6e)]),0x1;}}}function a34_0x18e8(){const _0x2d56ab=['258ecvHvz','17565317SzZCpk','40izZoUk','execute','10XuIcAN','👤\x20','description','5629473qefvmo','4243pFQNEh','message','site','12ODhYkA','760506NQMxqq','config','scope','profiles','name','map','646128rGouKx','\x20\x20Global:\x20~/.config/tdx/tdx.json','1005108fEMQav','log','726995ruAroV','List\x20all\x20available\x20profiles','length','Error:\x20','dim'];a34_0x18e8=function(){return _0x2d56ab;};return a34_0x18e8();}
@@ -1 +1 @@
1
- function a35_0x46b0(){const _0x2483d1=['395502BChBUy','...','3955655SOVpDM','Schema:\x20','\x20[Job\x20ID:\x20','description','\x20rows\x20','error','234NRALCz','51317trWrid','Executing\x20query\x20[','catalog','setJobId','completedSplits','name','Catalog:\x20','output','296JuYTsa','Statement\x20','stats','1372408SkPynw','processedRows','database','\x20splits','3rhqyqF','jobId','setExtra','4716408HNXgRX','execute','elapsedTimeMillis','site','Executing\x20statement\x20','options','913706hZxqkw','in\x20','SQL:\x20','setPhase','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','Run\x20Trino\x20queries\x20(streaming)','query','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','message','length','join','408490voqpMn','\x20-\x20','Error:\x20','state','Site:\x20','information_schema'];a35_0x46b0=function(){return _0x2483d1;};return a35_0x46b0();}const a35_0x395a46=a35_0x2738;(function(_0x26d0a1,_0x4cc168){const _0x137c24=a35_0x2738,_0x110c0c=_0x26d0a1();while(!![]){try{const _0x590c68=-parseInt(_0x137c24(0x1f6))/0x1+parseInt(_0x137c24(0x217))/0x2+-parseInt(_0x137c24(0x20e))/0x3*(parseInt(_0x137c24(0x20a))/0x4)+parseInt(_0x137c24(0x1f8))/0x5+parseInt(_0x137c24(0x211))/0x6+-parseInt(_0x137c24(0x1ff))/0x7*(-parseInt(_0x137c24(0x207))/0x8)+parseInt(_0x137c24(0x1fe))/0x9*(-parseInt(_0x137c24(0x1f0))/0xa);if(_0x590c68===_0x4cc168)break;else _0x110c0c['push'](_0x110c0c['shift']());}catch(_0x39df5e){_0x110c0c['push'](_0x110c0c['shift']());}}}(a35_0x46b0,0x7b32d));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';function a35_0x2738(_0x571aa5,_0x5d3e12){_0x571aa5=_0x571aa5-0x1e7;const _0x46b024=a35_0x46b0();let _0x2738a5=_0x46b024[_0x571aa5];return _0x2738a5;}export class QueryCommand extends BaseCommand{[a35_0x395a46(0x204)]='query';[a35_0x395a46(0x1fb)]=a35_0x395a46(0x1ea);async[a35_0x395a46(0x212)](_0x1b5e0d){const _0x49f7ef=a35_0x395a46,{options:_0x36e217,args:_0x27ccd8,tdx:_0xb514c8}=_0x1b5e0d,_0xfc9662={..._0x36e217,'limitStructuredFormats':!![]},_0x5260d0=_0x27ccd8[0x0],_0x3a4ccd=_0x36e217['file'];let _0x331ffd;try{if(_0x3a4ccd)_0x331ffd=readSqlStatementsFromFile(_0x3a4ccd);else{if(_0x5260d0==='-')_0x331ffd=await readSqlStatementsFromStdin();else{if(_0x5260d0&&isSqlFilePath(_0x5260d0))_0x331ffd=readSqlStatementsFromFile(_0x5260d0);else{if(_0x5260d0)_0x331ffd=splitSqlStatements(_0x5260d0);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x319d20){return console[_0x49f7ef(0x1fd)](_0x49f7ef(0x1f2)+_0x319d20[_0x49f7ef(0x1ed)]),0x1;}const _0x5dd6be=_0x36e217[_0x49f7ef(0x20c)]||_0x49f7ef(0x1f5),_0x1b5417=_0x36e217[_0x49f7ef(0x201)];try{const _0x3b995f=[],_0x407fea=!!_0x36e217[_0x49f7ef(0x206)];for(let _0x21e443=0x0;_0x21e443<_0x331ffd['length'];_0x21e443++){const _0x2ff8a4=_0x331ffd[_0x21e443],_0x409f77=_0x21e443+0x1,_0x730001=_0x331ffd[_0x49f7ef(0x1ee)],_0x5d3248=_0x730001>0x1;_0x36e217['verbose']&&(console[_0x49f7ef(0x1fd)]('\x0a'+(_0x5d3248?'Statement\x20'+_0x409f77+'/'+_0x730001+':':'')),console[_0x49f7ef(0x1fd)](_0x49f7ef(0x1f4)+_0x36e217[_0x49f7ef(0x214)]),console[_0x49f7ef(0x1fd)](_0x49f7ef(0x205)+(_0x1b5417||'td')),console[_0x49f7ef(0x1fd)](_0x49f7ef(0x1f9)+_0x5dd6be),console[_0x49f7ef(0x1fd)](_0x49f7ef(0x1e7)+_0x2ff8a4));const _0xcd3eff=_0x5d3248?_0x49f7ef(0x215)+_0x409f77+'/'+_0x730001+_0x49f7ef(0x1f7):'Executing\x20query...';try{const _0x2c4ad1=await withProgressSpinner(_0xcd3eff,async _0x175200=>{const _0x4a49ba=_0x49f7ef,_0x5740f8=await _0xb514c8[_0x4a49ba(0x1eb)][_0x4a49ba(0x212)](_0x2ff8a4,{'catalog':_0x1b5417,'schema':_0x5dd6be,'onJobId':_0x2f299a=>{const _0x1d10f1=_0x4a49ba;_0x175200[_0x1d10f1(0x202)](_0x2f299a);},'onProgress':_0x5ac861=>{const _0x251262=_0x4a49ba;_0x175200[_0x251262(0x1e8)](_0x251262(0x200)+_0x5ac861[_0x251262(0x1f3)]+']'),_0x175200[_0x251262(0x210)](formatRows(_0x5ac861[_0x251262(0x20b)])+_0x251262(0x1fc)+_0x5ac861[_0x251262(0x203)]+'/'+_0x5ac861['totalSplits']+_0x251262(0x20d));}});return _0x5740f8;},{'verbose':_0x36e217['verbose']}),_0x6706f7=_0x2c4ad1['data'],_0x303737=_0x6706f7[_0x49f7ef(0x20f)]?_0x49f7ef(0x1fa)+_0x6706f7[_0x49f7ef(0x20f)]+']':'',_0x24f04c=_0x5d3248?_0x49f7ef(0x208)+_0x409f77+'/'+_0x730001+_0x49f7ef(0x1f1):'';console[_0x49f7ef(0x1fd)]('✔\x20'+_0x24f04c+'Query\x20completed:\x20Processed\x20'+formatRows(_0x6706f7[_0x49f7ef(0x209)][_0x49f7ef(0x20b)])+_0x49f7ef(0x1fc)+(_0x49f7ef(0x218)+formatElapsed(_0x6706f7[_0x49f7ef(0x209)][_0x49f7ef(0x213)])+_0x303737));if(_0x5d3248&&_0x407fea){const _0x5c2ea5=resolveOutputOptions(_0xfc9662),_0x22d036=await formatQueryOutput(_0x6706f7,_0x5c2ea5);_0x3b995f['push'](_0x22d036);}else await handleQueryOutput(_0x6706f7,_0xfc9662);}catch(_0x563111){const _0x19ca8d=_0x5d3248?_0x49f7ef(0x208)+_0x409f77+'/'+_0x730001+':\x0a':'',_0x20b01e=_0x563111 instanceof SDKError?_0x563111['originalMessage']:_0x563111[_0x49f7ef(0x1ed)];return console[_0x49f7ef(0x1fd)](''+_0x19ca8d+_0x20b01e),0x1;}}if(_0x331ffd['length']>0x1&&_0x407fea&&_0x3b995f[_0x49f7ef(0x1ee)]>0x0){const _0x34cff4=_0x3b995f[_0x49f7ef(0x1ef)]('\x0a');writeFileSync(_0x36e217['output'],_0x34cff4),console[_0x49f7ef(0x1fd)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x36e217[_0x49f7ef(0x206)]);}return 0x0;}catch(_0x226c80){throw _0x226c80;}}['validate'](_0x1d96bb){const _0xd7d1af=a35_0x395a46,_0xc6e277=_0x1d96bb['args'][0x0],_0x1ed0f9=_0x1d96bb[_0xd7d1af(0x216)]['file'];if(!_0xc6e277&&!_0x1ed0f9)return _0xd7d1af(0x1e9);if(_0xc6e277&&_0x1ed0f9)return _0xd7d1af(0x1ec);return undefined;}}
1
+ const a35_0x1b7c43=a35_0x3018;(function(_0x36107a,_0x4d75c1){const _0xc74fdf=a35_0x3018,_0x414d25=_0x36107a();while(!![]){try{const _0x590c55=parseInt(_0xc74fdf(0x91))/0x1*(parseInt(_0xc74fdf(0x96))/0x2)+parseInt(_0xc74fdf(0x73))/0x3+-parseInt(_0xc74fdf(0xa0))/0x4+parseInt(_0xc74fdf(0x77))/0x5*(-parseInt(_0xc74fdf(0x9f))/0x6)+parseInt(_0xc74fdf(0x90))/0x7+-parseInt(_0xc74fdf(0x97))/0x8*(parseInt(_0xc74fdf(0x86))/0x9)+parseInt(_0xc74fdf(0x83))/0xa*(parseInt(_0xc74fdf(0x87))/0xb);if(_0x590c55===_0x4d75c1)break;else _0x414d25['push'](_0x414d25['shift']());}catch(_0x18aa7c){_0x414d25['push'](_0x414d25['shift']());}}}(a35_0x3e31,0x72525));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a35_0x3e31(){const _0x3fdd2b=['output','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','completedSplits','push','information_schema','options','Statement\x20','50nroRaQ','name','\x20-\x20','28413xXjPSN','1627450fkqlis','Site:\x20','database','Run\x20Trino\x20queries\x20(streaming)','Executing\x20query...','No\x20SQL\x20provided','elapsedTimeMillis','setJobId','verbose','3067575mlAxBW','80263Ftjogr','description','catalog','args','...','10FqOyJz','1352xipWcl','validate','length','jobId','\x20[Job\x20ID:\x20','data','totalSplits','message','3532854eIByig','649220izoxeA','originalMessage','\x20splits','\x20rows\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','query','state','error','execute','Executing\x20statement\x20','setExtra','520854XitKMZ','Executing\x20query\x20[','\x0aAll\x20results\x20saved\x20to\x20','processedRows','5PbiNUP','in\x20','Schema:\x20','stats','file'];a35_0x3e31=function(){return _0x3fdd2b;};return a35_0x3e31();}function a35_0x3018(_0x11fef7,_0x36c53a){_0x11fef7=_0x11fef7-0x71;const _0x3e31ca=a35_0x3e31();let _0x301835=_0x3e31ca[_0x11fef7];return _0x301835;}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a35_0x1b7c43(0x84)]=a35_0x1b7c43(0xa5);[a35_0x1b7c43(0x92)]=a35_0x1b7c43(0x8a);async[a35_0x1b7c43(0xa8)](_0x149ffd){const _0x47a91f=a35_0x1b7c43,{options:_0x15eee5,args:_0x56a1b5,tdx:_0x2a7334}=_0x149ffd,_0x58f3e7={..._0x15eee5,'limitStructuredFormats':!![]},_0x1d5136=_0x56a1b5[0x0],_0x3edc5a=_0x15eee5[_0x47a91f(0x7b)];let _0x394e08;try{if(_0x3edc5a)_0x394e08=readSqlStatementsFromFile(_0x3edc5a);else{if(_0x1d5136==='-')_0x394e08=await readSqlStatementsFromStdin();else{if(_0x1d5136&&isSqlFilePath(_0x1d5136))_0x394e08=readSqlStatementsFromFile(_0x1d5136);else{if(_0x1d5136)_0x394e08=splitSqlStatements(_0x1d5136);else throw new Error(_0x47a91f(0x8c));}}}}catch(_0x3c22c2){return console[_0x47a91f(0xa7)]('Error:\x20'+_0x3c22c2[_0x47a91f(0x9e)]),0x1;}const _0x3d8878=_0x15eee5[_0x47a91f(0x89)]||_0x47a91f(0x80),_0x13f28d=_0x15eee5[_0x47a91f(0x93)];try{const _0x444681=[],_0x1bd5ba=!!_0x15eee5[_0x47a91f(0x7c)];for(let _0x17b10f=0x0;_0x17b10f<_0x394e08['length'];_0x17b10f++){const _0xcbab4f=_0x394e08[_0x17b10f],_0x44aa56=_0x17b10f+0x1,_0x57ba7e=_0x394e08['length'],_0x32b12f=_0x57ba7e>0x1;_0x15eee5['verbose']&&(console[_0x47a91f(0xa7)]('\x0a'+(_0x32b12f?_0x47a91f(0x82)+_0x44aa56+'/'+_0x57ba7e+':':'')),console[_0x47a91f(0xa7)](_0x47a91f(0x88)+_0x15eee5['site']),console['error']('Catalog:\x20'+(_0x13f28d||'td')),console['error'](_0x47a91f(0x79)+_0x3d8878),console['error']('SQL:\x20'+_0xcbab4f));const _0x14fe5f=_0x32b12f?_0x47a91f(0x71)+_0x44aa56+'/'+_0x57ba7e+_0x47a91f(0x95):_0x47a91f(0x8b);try{const _0x1ec253=await withProgressSpinner(_0x14fe5f,async _0x40b849=>{const _0x740b31=_0x47a91f,_0x343ca4=await _0x2a7334[_0x740b31(0xa5)][_0x740b31(0xa8)](_0xcbab4f,{'catalog':_0x13f28d,'schema':_0x3d8878,'onJobId':_0x5bcef2=>{const _0xf4b22d=_0x740b31;_0x40b849[_0xf4b22d(0x8e)](_0x5bcef2);},'onProgress':_0x474bf1=>{const _0xd1d9db=_0x740b31;_0x40b849['setPhase'](_0xd1d9db(0x74)+_0x474bf1[_0xd1d9db(0xa6)]+']'),_0x40b849[_0xd1d9db(0x72)](formatRows(_0x474bf1[_0xd1d9db(0x76)])+_0xd1d9db(0xa3)+_0x474bf1[_0xd1d9db(0x7e)]+'/'+_0x474bf1[_0xd1d9db(0x9d)]+_0xd1d9db(0xa2));}});return _0x343ca4;},{'verbose':_0x15eee5[_0x47a91f(0x8f)]}),_0x384d72=_0x1ec253[_0x47a91f(0x9c)],_0x11c8cf=_0x384d72[_0x47a91f(0x9a)]?_0x47a91f(0x9b)+_0x384d72[_0x47a91f(0x9a)]+']':'',_0x9a893e=_0x32b12f?_0x47a91f(0x82)+_0x44aa56+'/'+_0x57ba7e+_0x47a91f(0x85):'';console[_0x47a91f(0xa7)]('✔\x20'+_0x9a893e+'Query\x20completed:\x20Processed\x20'+formatRows(_0x384d72['stats'][_0x47a91f(0x76)])+_0x47a91f(0xa3)+(_0x47a91f(0x78)+formatElapsed(_0x384d72[_0x47a91f(0x7a)][_0x47a91f(0x8d)])+_0x11c8cf));if(_0x32b12f&&_0x1bd5ba){const _0x150c2b=resolveOutputOptions(_0x58f3e7),_0x1ff7dd=await formatQueryOutput(_0x384d72,_0x150c2b);_0x444681[_0x47a91f(0x7f)](_0x1ff7dd);}else await handleQueryOutput(_0x384d72,_0x58f3e7);}catch(_0x29b9c0){const _0x3c7a76=_0x32b12f?_0x47a91f(0x82)+_0x44aa56+'/'+_0x57ba7e+':\x0a':'',_0x2817a1=_0x29b9c0 instanceof SDKError?_0x29b9c0[_0x47a91f(0xa1)]:_0x29b9c0[_0x47a91f(0x9e)];return console[_0x47a91f(0xa7)](''+_0x3c7a76+_0x2817a1),0x1;}}if(_0x394e08[_0x47a91f(0x99)]>0x1&&_0x1bd5ba&&_0x444681[_0x47a91f(0x99)]>0x0){const _0x50a6e7=_0x444681['join']('\x0a');writeFileSync(_0x15eee5[_0x47a91f(0x7c)],_0x50a6e7),console['error'](_0x47a91f(0x75)+_0x15eee5[_0x47a91f(0x7c)]);}return 0x0;}catch(_0x454575){throw _0x454575;}}[a35_0x1b7c43(0x98)](_0x552363){const _0x48cf3a=a35_0x1b7c43,_0x132c62=_0x552363[_0x48cf3a(0x94)][0x0],_0x4e2135=_0x552363[_0x48cf3a(0x81)][_0x48cf3a(0x7b)];if(!_0x132c62&&!_0x4e2135)return _0x48cf3a(0x7d);if(_0x132c62&&_0x4e2135)return _0x48cf3a(0xa4);return undefined;}}
@@ -1 +1 @@
1
- const a36_0x14d3b3=a36_0x47c0;(function(_0x12fc3c,_0x5eb535){const _0x35e0e6=a36_0x47c0,_0x2a0ab0=_0x12fc3c();while(!![]){try{const _0x215f63=-parseInt(_0x35e0e6(0xd6))/0x1+-parseInt(_0x35e0e6(0xff))/0x2+-parseInt(_0x35e0e6(0xd8))/0x3*(parseInt(_0x35e0e6(0xd3))/0x4)+-parseInt(_0x35e0e6(0x115))/0x5*(-parseInt(_0x35e0e6(0xa4))/0x6)+-parseInt(_0x35e0e6(0x101))/0x7+-parseInt(_0x35e0e6(0xc2))/0x8*(parseInt(_0x35e0e6(0x10e))/0x9)+parseInt(_0x35e0e6(0xd9))/0xa*(parseInt(_0x35e0e6(0xca))/0xb);if(_0x215f63===_0x5eb535)break;else _0x2a0ab0['push'](_0x2a0ab0['shift']());}catch(_0x1f0375){_0x2a0ab0['push'](_0x2a0ab0['shift']());}}}(a36_0x4ccb,0xc969b));import{BaseCommand}from'./command.js';function a36_0x4ccb(){const _0x38f6c1=['nextRun','engine_version','name','next_run_at','error','590035OOFXWm','ended_at','abs','time_zone','schedule:list','limit','\x20(use\x20--limit\x20to\x20see\x20more)','lastRun','retry_limit','retryLimit','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','max','output','has_next_page','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','type','num','utf-8','padEnd','end_at','\x20\x20Cron:\x20','Deleting\x20schedule...','file','engineVersion','list','48NUoKAU','jsonl','dim','Updating\x20schedule...','Failed\x20to\x20read\x20file:\x20','success','format','\x20\x20Type:\x20','\x20(showing\x20','user','INVALID_ARGUMENT','\x20scheduled\x20quer','Cancelled','trim','result','status','Schedule\x20created:\x20','\x22...','scheduled_at','length','count','schedules','join','listQueries','json','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','validate','Updating\x20schedule:\x20','\x20\x20Timezone:\x20','history','1192RRxlby','schedule:create','query','args','m\x20ago','just\x20now','show','toLocaleDateString','33NLgzgK','update','job_id','Create\x20a\x20scheduled\x20query','schedule:update','schedule:history','\x20\x20→\x20','data','run','3736364RRluZB','Listing\x20scheduled\x20queries...','execute','1301572QLNUGs','yes','3YQLtgh','16907590WvKHFE','\x20\x20Job\x20ID:\x20','\x20\x20Time:\x20','green','\x20matching\x20\x22','getTime','verbose','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','create','...','Creating\x20schedule:\x20','statusIcon','Run\x20a\x20scheduled\x20query\x20immediately','Show\x20schedule\x20details','substring','keys','updated_at','timezone','map','List\x20scheduled\x20queries','tsv','Query\x20file\x20is\x20empty','site','Schedule\x20updated:\x20','priority','red','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','time','\x20\x20Database:\x20','never','repeat','delete','Schedule\x20run\x20submitted:\x20','cron','soon','round','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','Getting\x20schedule\x20history...','1030290olEKRf','created_at','6020665slcMki','last_job','pagination','description','database','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','\x20execution','from','\x20created','Update\x20a\x20scheduled\x20query','delay','(unnamed)','schedule:delete','95463QtVrKs','Getting\x20schedule\x20details...'];a36_0x4ccb=function(){return _0x38f6c1;};return a36_0x4ccb();}import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a36_0x5e5acd from'chalk';function formatRelativeTime(_0x105e2a){const _0x3400f6=a36_0x47c0,_0x61239f=new Date(_0x105e2a),_0x48d790=new Date(),_0x1432a5=_0x61239f[_0x3400f6(0xde)]()-_0x48d790[_0x3400f6(0xde)](),_0x316ca9=Math[_0x3400f6(0x117)](_0x1432a5)/0x3e8,_0x11b7ec=_0x1432a5<0x0;if(_0x316ca9<0x3c)return _0x11b7ec?_0x3400f6(0xc7):_0x3400f6(0xfb);else{if(_0x316ca9<0xe10){const _0x2a09ca=Math[_0x3400f6(0xfc)](_0x316ca9/0x3c);return _0x11b7ec?_0x2a09ca+_0x3400f6(0xc6):'in\x20'+_0x2a09ca+'m';}else{if(_0x316ca9<0x15180){const _0x1ac931=Math[_0x3400f6(0xfc)](_0x316ca9/0xe10);return _0x11b7ec?_0x1ac931+'h\x20ago':'in\x20'+_0x1ac931+'h';}else{if(_0x316ca9<0x93a80){const _0x5562b5=Math[_0x3400f6(0xfc)](_0x316ca9/0x15180);return _0x11b7ec?_0x5562b5+'d\x20ago':'in\x20'+_0x5562b5+'d';}else return _0x61239f[_0x3400f6(0xc9)]();}}}}export class ScheduleListCommand extends BaseCommand{['name']=a36_0x14d3b3(0x119);['description']=a36_0x14d3b3(0xec);async[a36_0x14d3b3(0xd5)](_0x53a805){const _0x3ef412=a36_0x14d3b3,{options:_0x1d512a,args:_0x5bb948,tdx:_0x8fa3e3}=_0x53a805,_0x46b4a0=resolveLimit(_0x1d512a[_0x3ef412(0x11a)],DEFAULT_DISPLAY_LIMIT),_0x21732e=_0x5bb948[0x0],_0x2d96e0=_0x21732e?'Searching\x20scheduled\x20queries\x20matching\x20\x22'+_0x21732e+_0x3ef412(0xb5):_0x3ef412(0xd4),_0x3e5e5a=await withSpinner(_0x2d96e0,()=>_0x8fa3e3[_0x3ef412(0xb9)][_0x3ef412(0xbb)]({'limit':_0x46b4a0,'scheduled':!![],'pattern':_0x21732e}),{'verbose':_0x1d512a['verbose']}),_0x329e25=_0x3e5e5a['data']['queries'],_0x2e93ef=_0x3e5e5a[_0x3ef412(0xd1)][_0x3ef412(0x103)][_0x3ef412(0x98)],_0x2c702c=_0x21732e?_0x3ef412(0xdd)+_0x21732e+'\x22':'';_0x2e93ef?console[_0x3ef412(0x114)]('Showing\x20first\x20'+_0x329e25['length']+'\x20schedules'+_0x2c702c+_0x3ef412(0x11b)):console[_0x3ef412(0x114)]('Found\x20'+_0x329e25[_0x3ef412(0xb7)]+_0x3ef412(0xaf)+(_0x329e25[_0x3ef412(0xb7)]!==0x1?'ies':'y')+_0x2c702c);if(_0x1d512a[_0x3ef412(0xaa)]===_0x3ef412(0xbc)||_0x1d512a[_0x3ef412(0xaa)]===_0x3ef412(0xa5)||_0x1d512a[_0x3ef412(0xaa)]==='table'||_0x1d512a[_0x3ef412(0xaa)]===_0x3ef412(0xed)){const _0x59d329=_0x329e25[_0x3ef412(0xeb)](_0x5e1871=>({'id':_0x5e1871['id'],'name':_0x5e1871[_0x3ef412(0x112)],'cron':_0x5e1871[_0x3ef412(0xfa)],'database':_0x5e1871[_0x3ef412(0x105)]?.['name'],'type':_0x5e1871['type'],'timezone':_0x5e1871[_0x3ef412(0x118)],'user_name':_0x5e1871[_0x3ef412(0xad)]?.[_0x3ef412(0x112)],'updated_at':_0x5e1871[_0x3ef412(0xe9)],'next_run_at':_0x5e1871[_0x3ef412(0x113)],'last_job_status':_0x5e1871['last_job']?.[_0x3ef412(0xb3)]}));await handleSDKOutput(_0x59d329,_0x1d512a);}else{if(_0x329e25[_0x3ef412(0xb7)]===0x0)console['log']('No\x20scheduled\x20queries\x20found');else{const _0x5a61c1=_0x1d512a[_0x3ef412(0xef)],_0x39bedf=_0x329e25['map'](_0x148a51=>{const _0x5e9a62=_0x3ef412,_0x4a6cc0=_0x148a51['last_job']?.[_0x5e9a62(0xb3)]?_0x148a51[_0x5e9a62(0x102)][_0x5e9a62(0xb3)]==='success'?'✓':'✗':'-',_0x148810=_0x148a51[_0x5e9a62(0x102)]?.[_0x5e9a62(0x116)]?formatRelativeTime(_0x148a51[_0x5e9a62(0x102)][_0x5e9a62(0x116)]):_0x5e9a62(0xf6),_0x272eb3=_0x148a51[_0x5e9a62(0x113)]?formatRelativeTime(_0x148a51[_0x5e9a62(0x113)]):'-',_0xa36656=_0x148a51[_0x5e9a62(0xfa)]||'',_0x310ef4=_0x148a51['name']||_0x5e9a62(0x10c),_0x4ed749=getConsoleUrl(_0x5a61c1,'/app/queries/editor?queryId='+_0x148a51['id']);return{'statusIcon':_0x4a6cc0,'lastRun':_0x148810,'nextRun':_0x272eb3,'cron':_0xa36656,'name':_0x310ef4,'queryUrl':_0x4ed749,'status':_0x148a51[_0x5e9a62(0x102)]?.[_0x5e9a62(0xb3)]};}),_0x2ac088=Math[_0x3ef412(0x120)](..._0x39bedf['map'](_0xb3e34=>_0xb3e34[_0x3ef412(0x11c)][_0x3ef412(0xb7)])),_0x407036=Math[_0x3ef412(0x120)](..._0x39bedf[_0x3ef412(0xeb)](_0x53e69c=>_0x53e69c['nextRun']['length'])),_0x2c4364=Math[_0x3ef412(0x120)](..._0x39bedf[_0x3ef412(0xeb)](_0x474caf=>_0x474caf[_0x3ef412(0xfa)]['length'])),_0x3e6145=_0x39bedf[_0x3ef412(0xeb)](_0x3f498c=>{const _0x2f99ef=_0x3ef412,_0x2ca915=_0x3f498c[_0x2f99ef(0xb3)]===_0x2f99ef(0xa9)?a36_0x5e5acd[_0x2f99ef(0xdc)](_0x3f498c[_0x2f99ef(0xe4)]):_0x3f498c[_0x2f99ef(0xb3)]===_0x2f99ef(0x114)?a36_0x5e5acd[_0x2f99ef(0xf2)](_0x3f498c[_0x2f99ef(0xe4)]):a36_0x5e5acd[_0x2f99ef(0xa6)](_0x3f498c[_0x2f99ef(0xe4)]),_0x519b96=_0x3f498c[_0x2f99ef(0x11c)][_0x2f99ef(0x9d)](_0x2ac088),_0xef8c84=_0x3f498c[_0x2f99ef(0x110)]['padEnd'](_0x407036),_0x1f79ff=_0x3f498c['cron']?a36_0x5e5acd['cyan'](_0x3f498c[_0x2f99ef(0xfa)]['padEnd'](_0x2c4364)):'\x20'[_0x2f99ef(0xf7)](_0x2c4364),_0x3fa5aa=hyperlink(_0x3f498c[_0x2f99ef(0x112)],_0x3f498c['queryUrl']);return'📅\x20'+_0x2ca915+'\x20'+_0x519b96+_0x2f99ef(0xd0)+_0xef8c84+'\x20\x20'+_0x1f79ff+'\x20\x20'+_0x3fa5aa;});await writeOutput(_0x3e6145[_0x3ef412(0xba)]('\x0a'),_0x1d512a[_0x3ef412(0x97)],_0x3ef412(0xa3));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x14d3b3(0x112)]='schedule:show';[a36_0x14d3b3(0x104)]=a36_0x14d3b3(0xe6);[a36_0x14d3b3(0xbe)](_0x86953c){const _0x2379d3=a36_0x14d3b3,_0x31fb0c=_0x86953c[_0x2379d3(0xc5)][0x0];if(!_0x31fb0c)return _0x2379d3(0xbd);return undefined;}async[a36_0x14d3b3(0xd5)](_0x1f4efb){const _0xa82d39=a36_0x14d3b3,{options:_0x3a4c6d,args:_0x4796f0,tdx:_0x3a33d2}=_0x1f4efb,_0x301688=_0x4796f0[0x0],_0x2473f7=await withSpinner(_0xa82d39(0x10f),()=>_0x3a33d2[_0xa82d39(0xb9)][_0xa82d39(0xc8)](_0x301688),{'verbose':_0x3a4c6d[_0xa82d39(0xdf)]}),_0x58a3ab=_0x2473f7['data'],_0x14593e={'name':_0x58a3ab[_0xa82d39(0x112)],'cron':_0x58a3ab[_0xa82d39(0xfa)],'database':_0x58a3ab[_0xa82d39(0x105)],'type':_0x58a3ab[_0xa82d39(0x9a)],'timezone':_0x58a3ab[_0xa82d39(0xea)],'user_name':_0x58a3ab['user_name'],'created_at':_0x58a3ab['created_at'],'engine_version':_0x58a3ab['engine_version'],'executing_user_id':_0x58a3ab['executing_user_id'],'query':_0x58a3ab[_0xa82d39(0xc4)],'delay':_0x58a3ab[_0xa82d39(0x10b)],'priority':_0x58a3ab[_0xa82d39(0xf1)],'retry_limit':_0x58a3ab[_0xa82d39(0x11d)],..._0x58a3ab[_0xa82d39(0xb2)]&&{'result':_0x58a3ab[_0xa82d39(0xb2)]}};return await handleSingleObjectOutput(_0x14593e,_0x3a4c6d),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x14d3b3(0x112)]=a36_0x14d3b3(0xc3);[a36_0x14d3b3(0x104)]=a36_0x14d3b3(0xcd);[a36_0x14d3b3(0xbe)](_0x138172){const _0x78de08=a36_0x14d3b3,_0x2ef952=_0x138172[_0x78de08(0xc5)][0x0];if(!_0x2ef952)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';const _0x539b26=_0x138172['options'];if(!_0x539b26[_0x78de08(0x105)])return _0x78de08(0xf3);return undefined;}async[a36_0x14d3b3(0xd5)](_0x2b592d){const _0x1f6321=a36_0x14d3b3,{options:_0x703838,args:_0x1216ab,tdx:_0x5c9071}=_0x2b592d,_0x32924c=_0x1216ab[0x0],_0x445523=_0x703838,_0x5f5009=_0x445523[_0x1f6321(0x105)],_0xd36bb7=_0x445523['file'],_0x3e69eb=_0x445523[_0x1f6321(0x9a)]||'trino';let _0x15897f;try{_0x15897f=readFileSync(_0xd36bb7,_0x1f6321(0x9c))[_0x1f6321(0xb1)]();}catch(_0x22c64a){throw new SDKError(ErrorCode[_0x1f6321(0xae)],_0x1f6321(0xa8)+_0xd36bb7,_0x22c64a instanceof Error?_0x22c64a:undefined);}if(!_0x15897f)throw new SDKError(ErrorCode[_0x1f6321(0xae)],_0x1f6321(0xee));const _0x37cf5e={'database':_0x5f5009,'query':_0x15897f,'type':_0x3e69eb};if(_0x445523[_0x1f6321(0xfa)])_0x37cf5e[_0x1f6321(0xfa)]=_0x445523[_0x1f6321(0xfa)];if(_0x445523['timezone'])_0x37cf5e[_0x1f6321(0xea)]=_0x445523[_0x1f6321(0xea)];if(_0x445523['delay']!==undefined)_0x37cf5e['delay']=Number(_0x445523[_0x1f6321(0x10b)]);if(_0x445523[_0x1f6321(0xf1)]!==undefined)_0x37cf5e['priority']=Number(_0x445523[_0x1f6321(0xf1)]);if(_0x445523[_0x1f6321(0x11e)]!==undefined)_0x37cf5e['retry_limit']=Number(_0x445523['retryLimit']);if(_0x445523[_0x1f6321(0xa2)])_0x37cf5e['engine_version']=_0x445523[_0x1f6321(0xa2)];if(_0x445523[_0x1f6321(0xb2)])_0x37cf5e['result']=_0x445523[_0x1f6321(0xb2)];if(_0x703838['verbose']){console[_0x1f6321(0x114)](_0x1f6321(0xe3)+_0x32924c),console['error'](_0x1f6321(0xf5)+_0x5f5009),console[_0x1f6321(0x114)](_0x1f6321(0xab)+_0x3e69eb);if(_0x37cf5e[_0x1f6321(0xfa)])console[_0x1f6321(0x114)](_0x1f6321(0x9f)+_0x37cf5e[_0x1f6321(0xfa)]);if(_0x37cf5e['timezone'])console['error'](_0x1f6321(0xc0)+_0x37cf5e[_0x1f6321(0xea)]);}const _0x20c458=await withSpinner('Creating\x20schedule...',()=>_0x5c9071[_0x1f6321(0xb9)][_0x1f6321(0xe1)](_0x32924c,_0x37cf5e),{'verbose':_0x703838[_0x1f6321(0xdf)]});return console[_0x1f6321(0x114)](_0x1f6321(0xb4)+_0x20c458['data'][_0x1f6321(0x112)]),await handleSingleObjectOutput(_0x20c458['data'],_0x703838),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x14d3b3(0x112)]=a36_0x14d3b3(0xce);[a36_0x14d3b3(0x104)]=a36_0x14d3b3(0x10a);[a36_0x14d3b3(0xbe)](_0x2c17bf){const _0x4916be=a36_0x14d3b3,_0x5bbf90=_0x2c17bf[_0x4916be(0xc5)][0x0];if(!_0x5bbf90)return _0x4916be(0xe0);return undefined;}async[a36_0x14d3b3(0xd5)](_0x5dd1d2){const _0x329af2=a36_0x14d3b3,{options:_0x17387e,args:_0x46deb0,tdx:_0x309186}=_0x5dd1d2,_0x311fe8=_0x46deb0[0x0],_0x36d8b1=_0x17387e,_0x4cd967={};if(_0x36d8b1['database'])_0x4cd967['database']=_0x36d8b1[_0x329af2(0x105)];if(_0x36d8b1[_0x329af2(0x9a)])_0x4cd967[_0x329af2(0x9a)]=_0x36d8b1[_0x329af2(0x9a)];if(_0x36d8b1['cron'])_0x4cd967[_0x329af2(0xfa)]=_0x36d8b1[_0x329af2(0xfa)];if(_0x36d8b1[_0x329af2(0xea)])_0x4cd967['timezone']=_0x36d8b1[_0x329af2(0xea)];if(_0x36d8b1['delay']!==undefined)_0x4cd967['delay']=Number(_0x36d8b1[_0x329af2(0x10b)]);if(_0x36d8b1['priority']!==undefined)_0x4cd967['priority']=Number(_0x36d8b1[_0x329af2(0xf1)]);if(_0x36d8b1[_0x329af2(0x11e)]!==undefined)_0x4cd967[_0x329af2(0x11d)]=Number(_0x36d8b1[_0x329af2(0x11e)]);if(_0x36d8b1[_0x329af2(0xa2)])_0x4cd967[_0x329af2(0x111)]=_0x36d8b1[_0x329af2(0xa2)];if(_0x36d8b1[_0x329af2(0xb2)])_0x4cd967[_0x329af2(0xb2)]=_0x36d8b1[_0x329af2(0xb2)];if(_0x36d8b1['file'])try{_0x4cd967[_0x329af2(0xc4)]=readFileSync(_0x36d8b1[_0x329af2(0xa1)],_0x329af2(0x9c))[_0x329af2(0xb1)]();}catch(_0x1d935d){throw new SDKError(ErrorCode[_0x329af2(0xae)],_0x329af2(0xa8)+_0x36d8b1[_0x329af2(0xa1)],_0x1d935d instanceof Error?_0x1d935d:undefined);}if(Object[_0x329af2(0xe8)](_0x4cd967)[_0x329af2(0xb7)]===0x0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update');if(_0x17387e[_0x329af2(0xdf)]){console[_0x329af2(0x114)](_0x329af2(0xbf)+_0x311fe8);for(const [_0x774632,_0x291d8b]of Object['entries'](_0x4cd967)){_0x774632==='query'?console['error']('\x20\x20'+_0x774632+':\x20'+_0x291d8b[_0x329af2(0xe7)](0x0,0x32)+_0x329af2(0xe2)):console[_0x329af2(0x114)]('\x20\x20'+_0x774632+':\x20'+_0x291d8b);}}const _0x1d2a73=await withSpinner(_0x329af2(0xa7),()=>_0x309186['schedules'][_0x329af2(0xcb)](_0x311fe8,_0x4cd967),{'verbose':_0x17387e['verbose']});return console[_0x329af2(0x114)](_0x329af2(0xf0)+_0x1d2a73[_0x329af2(0xd1)][_0x329af2(0x112)]),await handleSingleObjectOutput(_0x1d2a73[_0x329af2(0xd1)],_0x17387e),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x14d3b3(0x112)]=a36_0x14d3b3(0x10d);['description']='Delete\x20a\x20scheduled\x20query';['validate'](_0x3e87a2){const _0x4a7c0d=a36_0x14d3b3,_0x332ed9=_0x3e87a2['args'][0x0];if(!_0x332ed9)return _0x4a7c0d(0x106);return undefined;}async['execute'](_0x52f6eb){const _0x9dd13a=a36_0x14d3b3,{options:_0x2ae00f,args:_0x2ac869,tdx:_0x1443b4}=_0x52f6eb,_0x2778e1=_0x2ac869[0x0];if(!_0x2ae00f[_0x9dd13a(0xd7)]){const _0x56051e=await confirm(_0x9dd13a(0x11f)+_0x2778e1+'\x22?');if(!_0x56051e)return console['error'](_0x9dd13a(0xb0)),0x0;}const _0x383b3c=await withSpinner(_0x9dd13a(0xa0),()=>_0x1443b4[_0x9dd13a(0xb9)][_0x9dd13a(0xf8)](_0x2778e1),{'verbose':_0x2ae00f[_0x9dd13a(0xdf)]});return console[_0x9dd13a(0x114)]('Schedule\x20deleted:\x20'+_0x383b3c[_0x9dd13a(0xd1)][_0x9dd13a(0x112)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{['name']='schedule:run';[a36_0x14d3b3(0x104)]=a36_0x14d3b3(0xe5);[a36_0x14d3b3(0xbe)](_0x4e4b20){const _0x116895=a36_0x14d3b3,_0x539883=_0x4e4b20['args'][0x0];if(!_0x539883)return _0x116895(0x99);return undefined;}async[a36_0x14d3b3(0xd5)](_0x39bf01){const _0x113a8a=a36_0x14d3b3,{options:_0x5db5ce,args:_0x43af43,tdx:_0x1be50a}=_0x39bf01,_0xc9110c=_0x43af43[0x0],_0x138940=_0x5db5ce,_0x3158bf=_0x138940[_0x113a8a(0xf4)],_0x20528e=_0x138940['num']!==undefined?Number(_0x138940[_0x113a8a(0x9b)]):undefined;if(_0x5db5ce[_0x113a8a(0xdf)]){console[_0x113a8a(0x114)]('Running\x20schedule:\x20'+_0xc9110c);if(_0x3158bf)console[_0x113a8a(0x114)](_0x113a8a(0xdb)+_0x3158bf);if(_0x20528e)console['error']('\x20\x20Num:\x20'+_0x20528e);}const _0x12c7b5=await withSpinner('Running\x20schedule...',()=>_0x1be50a['schedules'][_0x113a8a(0xd2)](_0xc9110c,{'time':_0x3158bf,'num':_0x20528e}),{'verbose':_0x5db5ce[_0x113a8a(0xdf)]}),_0x136e65=_0x12c7b5[_0x113a8a(0xd1)]['jobs'];console[_0x113a8a(0x114)](_0x113a8a(0xf9)+_0x136e65[_0x113a8a(0xb7)]+'\x20job'+(_0x136e65['length']!==0x1?'s':'')+_0x113a8a(0x109));for(const _0x1194b7 of _0x136e65){console[_0x113a8a(0x114)](_0x113a8a(0xda)+_0x1194b7['job_id']);}return await handleSDKOutput(_0x136e65,_0x5db5ce),0x0;}}function a36_0x47c0(_0x377661,_0x106368){_0x377661=_0x377661-0x97;const _0x4ccb62=a36_0x4ccb();let _0x47c0cc=_0x4ccb62[_0x377661];return _0x47c0cc;}export class ScheduleHistoryCommand extends BaseCommand{['name']=a36_0x14d3b3(0xcf);['description']='Show\x20schedule\x20execution\x20history';[a36_0x14d3b3(0xbe)](_0x41bbcf){const _0x22f0a2=a36_0x14d3b3,_0x2938af=_0x41bbcf[_0x22f0a2(0xc5)][0x0];if(!_0x2938af)return _0x22f0a2(0xfd);return undefined;}async[a36_0x14d3b3(0xd5)](_0x204803){const _0x401546=a36_0x14d3b3,{options:_0x183628,args:_0x399b53,tdx:_0x416f42}=_0x204803,_0x587b56=_0x399b53[0x0],_0xcaca0a=_0x183628,_0x2f69f8=_0xcaca0a['from']!==undefined?Number(_0xcaca0a[_0x401546(0x108)]):undefined,_0x43ef23=_0xcaca0a['to']!==undefined?Number(_0xcaca0a['to']):undefined,_0x3c3804=await withSpinner(_0x401546(0xfe),()=>_0x416f42[_0x401546(0xb9)][_0x401546(0xc1)](_0x587b56,{'from':_0x2f69f8,'to':_0x43ef23}),{'verbose':_0x183628[_0x401546(0xdf)]}),_0x5a6dee=_0x3c3804['data'];console[_0x401546(0x114)]('Found\x20'+_0x5a6dee[_0x401546(0xb8)]+_0x401546(0x107)+(_0x5a6dee[_0x401546(0xb8)]!==0x1?'s':'')+_0x401546(0xac)+_0x5a6dee[_0x401546(0x108)]+'-'+_0x5a6dee['to']+')');const _0x146df4=_0x5a6dee[_0x401546(0xc1)][_0x401546(0xeb)](_0x2ab571=>({'job_id':_0x2ab571[_0x401546(0xcc)],'type':_0x2ab571[_0x401546(0x9a)],'status':_0x2ab571[_0x401546(0xb3)],'scheduled_at':_0x2ab571[_0x401546(0xb6)],'created_at':_0x2ab571[_0x401546(0x100)],'start_at':_0x2ab571['start_at'],'end_at':_0x2ab571[_0x401546(0x9e)]}));return await handleSDKOutput(_0x146df4,_0x183628),0x0;}}
1
+ const a36_0x165db1=a36_0x541e;(function(_0x278b58,_0x33dc69){const _0x3377fc=a36_0x541e,_0x20e6bd=_0x278b58();while(!![]){try{const _0x3eedf2=-parseInt(_0x3377fc(0x17e))/0x1*(-parseInt(_0x3377fc(0x166))/0x2)+parseInt(_0x3377fc(0x139))/0x3+parseInt(_0x3377fc(0x19e))/0x4+-parseInt(_0x3377fc(0x177))/0x5+-parseInt(_0x3377fc(0x197))/0x6*(-parseInt(_0x3377fc(0x11a))/0x7)+parseInt(_0x3377fc(0x184))/0x8*(parseInt(_0x3377fc(0x13f))/0x9)+parseInt(_0x3377fc(0x171))/0xa*(-parseInt(_0x3377fc(0x196))/0xb);if(_0x3eedf2===_0x33dc69)break;else _0x20e6bd['push'](_0x20e6bd['shift']());}catch(_0x104a4f){_0x20e6bd['push'](_0x20e6bd['shift']());}}}(a36_0x217e,0x2617e));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a36_0x1b765b from'chalk';function formatRelativeTime(_0x154286){const _0x2574d2=a36_0x541e,_0x57d852=new Date(_0x154286),_0x177a26=new Date(),_0x49165b=_0x57d852[_0x2574d2(0x128)]()-_0x177a26[_0x2574d2(0x128)](),_0x1ee755=Math[_0x2574d2(0x186)](_0x49165b)/0x3e8,_0x432c5f=_0x49165b<0x0;if(_0x1ee755<0x3c)return _0x432c5f?_0x2574d2(0x19d):_0x2574d2(0x19f);else{if(_0x1ee755<0xe10){const _0x31e348=Math[_0x2574d2(0x160)](_0x1ee755/0x3c);return _0x432c5f?_0x31e348+'m\x20ago':'in\x20'+_0x31e348+'m';}else{if(_0x1ee755<0x15180){const _0x97aef5=Math[_0x2574d2(0x160)](_0x1ee755/0xe10);return _0x432c5f?_0x97aef5+_0x2574d2(0x15d):_0x2574d2(0x15c)+_0x97aef5+'h';}else{if(_0x1ee755<0x93a80){const _0x140a80=Math[_0x2574d2(0x160)](_0x1ee755/0x15180);return _0x432c5f?_0x140a80+'d\x20ago':_0x2574d2(0x15c)+_0x140a80+'d';}else return _0x57d852[_0x2574d2(0x162)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x165db1(0x182)]=a36_0x165db1(0x19b);[a36_0x165db1(0x11b)]=a36_0x165db1(0x156);async[a36_0x165db1(0x13d)](_0x5df2d2){const _0x1dbc89=a36_0x165db1,{options:_0x5ef5ec,args:_0x9f2c73,tdx:_0x188bfc}=_0x5df2d2,_0x3fe472=resolveLimit(_0x5ef5ec['limit'],DEFAULT_DISPLAY_LIMIT),_0x3c8165=_0x9f2c73[0x0],_0x12a50d=_0x3c8165?_0x1dbc89(0x12e)+_0x3c8165+_0x1dbc89(0x15b):_0x1dbc89(0x131),_0x11409f=await withSpinner(_0x12a50d,()=>_0x188bfc['schedules'][_0x1dbc89(0x1a1)]({'limit':_0x3fe472,'scheduled':!![],'pattern':_0x3c8165}),{'verbose':_0x5ef5ec[_0x1dbc89(0x15a)]}),_0x1e4c8a=_0x11409f['data'][_0x1dbc89(0x17c)],_0x5c1078=_0x11409f[_0x1dbc89(0x143)][_0x1dbc89(0x133)][_0x1dbc89(0x138)],_0x42db92=_0x3c8165?'\x20matching\x20\x22'+_0x3c8165+'\x22':'';_0x5c1078?console[_0x1dbc89(0x19c)](_0x1dbc89(0x12f)+_0x1e4c8a[_0x1dbc89(0x123)]+'\x20schedules'+_0x42db92+_0x1dbc89(0x16b)):console[_0x1dbc89(0x19c)](_0x1dbc89(0x14f)+_0x1e4c8a[_0x1dbc89(0x123)]+_0x1dbc89(0x14c)+(_0x1e4c8a[_0x1dbc89(0x123)]!==0x1?_0x1dbc89(0x194):'y')+_0x42db92);if(_0x5ef5ec['format']===_0x1dbc89(0x130)||_0x5ef5ec[_0x1dbc89(0x152)]===_0x1dbc89(0x17f)||_0x5ef5ec[_0x1dbc89(0x152)]===_0x1dbc89(0x163)||_0x5ef5ec[_0x1dbc89(0x152)]===_0x1dbc89(0x18e)){const _0x1dcf9a=_0x1e4c8a[_0x1dbc89(0x199)](_0x342d65=>({'id':_0x342d65['id'],'name':_0x342d65['name'],'cron':_0x342d65[_0x1dbc89(0x14e)],'database':_0x342d65[_0x1dbc89(0x176)]?.[_0x1dbc89(0x182)],'type':_0x342d65['type'],'timezone':_0x342d65['time_zone'],'user_name':_0x342d65[_0x1dbc89(0x14a)]?.[_0x1dbc89(0x182)],'updated_at':_0x342d65[_0x1dbc89(0x175)],'next_run_at':_0x342d65[_0x1dbc89(0x165)],'last_job_status':_0x342d65[_0x1dbc89(0x13b)]?.['status']}));await handleSDKOutput(_0x1dcf9a,_0x5ef5ec);}else{if(_0x1e4c8a['length']===0x0)console['log'](_0x1dbc89(0x134));else{const _0x17a03f=_0x5ef5ec[_0x1dbc89(0x198)],_0x41226b=_0x1e4c8a[_0x1dbc89(0x199)](_0x1769ca=>{const _0x8dbb0d=_0x1dbc89,_0x47c2f6=_0x1769ca[_0x8dbb0d(0x13b)]?.[_0x8dbb0d(0x159)]?_0x1769ca[_0x8dbb0d(0x13b)]['status']===_0x8dbb0d(0x1a0)?'✓':'✗':'-',_0x1dab0b=_0x1769ca[_0x8dbb0d(0x13b)]?.[_0x8dbb0d(0x18b)]?formatRelativeTime(_0x1769ca[_0x8dbb0d(0x13b)]['ended_at']):_0x8dbb0d(0x16e),_0x15da91=_0x1769ca[_0x8dbb0d(0x165)]?formatRelativeTime(_0x1769ca[_0x8dbb0d(0x165)]):'-',_0x30f6de=_0x1769ca[_0x8dbb0d(0x14e)]||'',_0x46803d=_0x1769ca[_0x8dbb0d(0x182)]||_0x8dbb0d(0x141),_0x5288ce=getConsoleUrl(_0x17a03f,_0x8dbb0d(0x1a4)+_0x1769ca['id']);return{'statusIcon':_0x47c2f6,'lastRun':_0x1dab0b,'nextRun':_0x15da91,'cron':_0x30f6de,'name':_0x46803d,'queryUrl':_0x5288ce,'status':_0x1769ca[_0x8dbb0d(0x13b)]?.['status']};}),_0x3136d7=Math['max'](..._0x41226b[_0x1dbc89(0x199)](_0x44428c=>_0x44428c[_0x1dbc89(0x191)][_0x1dbc89(0x123)])),_0xd235b1=Math[_0x1dbc89(0x174)](..._0x41226b[_0x1dbc89(0x199)](_0x30374c=>_0x30374c[_0x1dbc89(0x125)]['length'])),_0xd6bc5=Math[_0x1dbc89(0x174)](..._0x41226b[_0x1dbc89(0x199)](_0x57dde9=>_0x57dde9['cron'][_0x1dbc89(0x123)])),_0x61aa9c=_0x41226b[_0x1dbc89(0x199)](_0x4a4883=>{const _0x15af92=_0x1dbc89,_0x324153=_0x4a4883[_0x15af92(0x159)]==='success'?a36_0x1b765b[_0x15af92(0x173)](_0x4a4883['statusIcon']):_0x4a4883[_0x15af92(0x159)]==='error'?a36_0x1b765b[_0x15af92(0x19a)](_0x4a4883['statusIcon']):a36_0x1b765b[_0x15af92(0x137)](_0x4a4883[_0x15af92(0x18f)]),_0x37635a=_0x4a4883[_0x15af92(0x191)]['padEnd'](_0x3136d7),_0x2018fa=_0x4a4883['nextRun']['padEnd'](_0xd235b1),_0x266be5=_0x4a4883[_0x15af92(0x14e)]?a36_0x1b765b[_0x15af92(0x187)](_0x4a4883[_0x15af92(0x14e)]['padEnd'](_0xd6bc5)):'\x20'['repeat'](_0xd6bc5),_0x65f2cd=hyperlink(_0x4a4883['name'],_0x4a4883['queryUrl']);return _0x15af92(0x1a5)+_0x324153+'\x20'+_0x37635a+_0x15af92(0x140)+_0x2018fa+'\x20\x20'+_0x266be5+'\x20\x20'+_0x65f2cd;});await writeOutput(_0x61aa9c[_0x1dbc89(0x179)]('\x0a'),_0x5ef5ec[_0x1dbc89(0x122)],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x165db1(0x182)]=a36_0x165db1(0x149);[a36_0x165db1(0x11b)]=a36_0x165db1(0x17d);[a36_0x165db1(0x13a)](_0x2fdfb5){const _0x474806=a36_0x165db1,_0x190efe=_0x2fdfb5[_0x474806(0x142)][0x0];if(!_0x190efe)return _0x474806(0x168);return undefined;}async[a36_0x165db1(0x13d)](_0x6fb533){const _0x462782=a36_0x165db1,{options:_0xb43eb1,args:_0x132c4,tdx:_0x23005b}=_0x6fb533,_0xdaa1c7=_0x132c4[0x0],_0x809349=await withSpinner('Getting\x20schedule\x20details...',()=>_0x23005b['schedules'][_0x462782(0x129)](_0xdaa1c7),{'verbose':_0xb43eb1[_0x462782(0x15a)]}),_0x4f2526=_0x809349[_0x462782(0x143)],_0xeb5534={'name':_0x4f2526[_0x462782(0x182)],'cron':_0x4f2526[_0x462782(0x14e)],'database':_0x4f2526[_0x462782(0x176)],'type':_0x4f2526[_0x462782(0x17a)],'timezone':_0x4f2526[_0x462782(0x190)],'user_name':_0x4f2526[_0x462782(0x1a3)],'created_at':_0x4f2526[_0x462782(0x121)],'engine_version':_0x4f2526[_0x462782(0x172)],'executing_user_id':_0x4f2526[_0x462782(0x195)],'query':_0x4f2526['query'],'delay':_0x4f2526['delay'],'priority':_0x4f2526[_0x462782(0x18c)],'retry_limit':_0x4f2526['retry_limit'],..._0x4f2526[_0x462782(0x11c)]&&{'result':_0x4f2526[_0x462782(0x11c)]}};return await handleSingleObjectOutput(_0xeb5534,_0xb43eb1),0x0;}}function a36_0x541e(_0x21a7ca,_0x1a4251){_0x21a7ca=_0x21a7ca-0x119;const _0x217e9a=a36_0x217e();let _0x541ef8=_0x217e9a[_0x21a7ca];return _0x541ef8;}export class ScheduleCreateCommand extends BaseCommand{[a36_0x165db1(0x182)]='schedule:create';['description']=a36_0x165db1(0x192);['validate'](_0x42e782){const _0x2d1705=a36_0x165db1,_0x4e453c=_0x42e782['args'][0x0];if(!_0x4e453c)return _0x2d1705(0x120);const _0x1012ef=_0x42e782[_0x2d1705(0x16d)];if(!_0x1012ef[_0x2d1705(0x176)])return _0x2d1705(0x124);return undefined;}async[a36_0x165db1(0x13d)](_0x45b04f){const _0x25e8c=a36_0x165db1,{options:_0x23bee7,args:_0x585922,tdx:_0xb0871d}=_0x45b04f,_0x47688d=_0x585922[0x0],_0x2692ee=_0x23bee7,_0x47d4af=_0x2692ee['database'],_0x5b4c89=_0x2692ee[_0x25e8c(0x180)],_0x3618eb=_0x2692ee['type']||'trino';let _0x22f8a0;try{_0x22f8a0=readFileSync(_0x5b4c89,'utf-8')[_0x25e8c(0x16c)]();}catch(_0x23ff55){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x25e8c(0x13c)+_0x5b4c89,_0x23ff55 instanceof Error?_0x23ff55:undefined);}if(!_0x22f8a0)throw new SDKError(ErrorCode[_0x25e8c(0x11f)],_0x25e8c(0x13e));const _0x4166f8={'database':_0x47d4af,'query':_0x22f8a0,'type':_0x3618eb};if(_0x2692ee[_0x25e8c(0x14e)])_0x4166f8['cron']=_0x2692ee['cron'];if(_0x2692ee[_0x25e8c(0x190)])_0x4166f8['timezone']=_0x2692ee[_0x25e8c(0x190)];if(_0x2692ee['delay']!==undefined)_0x4166f8[_0x25e8c(0x148)]=Number(_0x2692ee[_0x25e8c(0x148)]);if(_0x2692ee['priority']!==undefined)_0x4166f8[_0x25e8c(0x18c)]=Number(_0x2692ee['priority']);if(_0x2692ee[_0x25e8c(0x155)]!==undefined)_0x4166f8[_0x25e8c(0x181)]=Number(_0x2692ee[_0x25e8c(0x155)]);if(_0x2692ee[_0x25e8c(0x12a)])_0x4166f8[_0x25e8c(0x172)]=_0x2692ee[_0x25e8c(0x12a)];if(_0x2692ee[_0x25e8c(0x11c)])_0x4166f8[_0x25e8c(0x11c)]=_0x2692ee[_0x25e8c(0x11c)];if(_0x23bee7[_0x25e8c(0x15a)]){console[_0x25e8c(0x19c)](_0x25e8c(0x167)+_0x47688d),console['error']('\x20\x20Database:\x20'+_0x47d4af),console[_0x25e8c(0x19c)](_0x25e8c(0x136)+_0x3618eb);if(_0x4166f8[_0x25e8c(0x14e)])console[_0x25e8c(0x19c)]('\x20\x20Cron:\x20'+_0x4166f8[_0x25e8c(0x14e)]);if(_0x4166f8[_0x25e8c(0x190)])console[_0x25e8c(0x19c)](_0x25e8c(0x188)+_0x4166f8['timezone']);}const _0x3fde9d=await withSpinner(_0x25e8c(0x1a2),()=>_0xb0871d['schedules'][_0x25e8c(0x12b)](_0x47688d,_0x4166f8),{'verbose':_0x23bee7[_0x25e8c(0x15a)]});return console[_0x25e8c(0x19c)](_0x25e8c(0x169)+_0x3fde9d[_0x25e8c(0x143)][_0x25e8c(0x182)]),await handleSingleObjectOutput(_0x3fde9d['data'],_0x23bee7),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{['name']=a36_0x165db1(0x15f);[a36_0x165db1(0x11b)]=a36_0x165db1(0x150);['validate'](_0x598790){const _0x2d7741=a36_0x165db1,_0x3a545e=_0x598790['args'][0x0];if(!_0x3a545e)return _0x2d7741(0x18d);return undefined;}async[a36_0x165db1(0x13d)](_0xf561ac){const _0x2bf146=a36_0x165db1,{options:_0x279a88,args:_0x2fd939,tdx:_0x1425bd}=_0xf561ac,_0x4be804=_0x2fd939[0x0],_0xebef0e=_0x279a88,_0x360691={};if(_0xebef0e[_0x2bf146(0x176)])_0x360691[_0x2bf146(0x176)]=_0xebef0e['database'];if(_0xebef0e[_0x2bf146(0x17a)])_0x360691[_0x2bf146(0x17a)]=_0xebef0e['type'];if(_0xebef0e[_0x2bf146(0x14e)])_0x360691[_0x2bf146(0x14e)]=_0xebef0e['cron'];if(_0xebef0e[_0x2bf146(0x190)])_0x360691[_0x2bf146(0x190)]=_0xebef0e[_0x2bf146(0x190)];if(_0xebef0e[_0x2bf146(0x148)]!==undefined)_0x360691['delay']=Number(_0xebef0e[_0x2bf146(0x148)]);if(_0xebef0e[_0x2bf146(0x18c)]!==undefined)_0x360691[_0x2bf146(0x18c)]=Number(_0xebef0e[_0x2bf146(0x18c)]);if(_0xebef0e['retryLimit']!==undefined)_0x360691['retry_limit']=Number(_0xebef0e[_0x2bf146(0x155)]);if(_0xebef0e[_0x2bf146(0x12a)])_0x360691[_0x2bf146(0x172)]=_0xebef0e[_0x2bf146(0x12a)];if(_0xebef0e[_0x2bf146(0x11c)])_0x360691[_0x2bf146(0x11c)]=_0xebef0e[_0x2bf146(0x11c)];if(_0xebef0e[_0x2bf146(0x180)])try{_0x360691['query']=readFileSync(_0xebef0e['file'],_0x2bf146(0x119))['trim']();}catch(_0x1cc92d){throw new SDKError(ErrorCode[_0x2bf146(0x11f)],'Failed\x20to\x20read\x20file:\x20'+_0xebef0e[_0x2bf146(0x180)],_0x1cc92d instanceof Error?_0x1cc92d:undefined);}if(Object[_0x2bf146(0x12d)](_0x360691)[_0x2bf146(0x123)]===0x0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update');if(_0x279a88[_0x2bf146(0x15a)]){console['error'](_0x2bf146(0x11e)+_0x4be804);for(const [_0x35eb78,_0x5df665]of Object[_0x2bf146(0x164)](_0x360691)){_0x35eb78===_0x2bf146(0x14d)?console[_0x2bf146(0x19c)]('\x20\x20'+_0x35eb78+':\x20'+_0x5df665['substring'](0x0,0x32)+_0x2bf146(0x16f)):console[_0x2bf146(0x19c)]('\x20\x20'+_0x35eb78+':\x20'+_0x5df665);}}const _0x58f26c=await withSpinner(_0x2bf146(0x157),()=>_0x1425bd[_0x2bf146(0x154)][_0x2bf146(0x170)](_0x4be804,_0x360691),{'verbose':_0x279a88[_0x2bf146(0x15a)]});return console[_0x2bf146(0x19c)]('Schedule\x20updated:\x20'+_0x58f26c['data'][_0x2bf146(0x182)]),await handleSingleObjectOutput(_0x58f26c[_0x2bf146(0x143)],_0x279a88),0x0;}}function a36_0x217e(){const _0x171ecb=['6673giIRDm','jsonl','file','retry_limit','name','from','1829752nHOMsI','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','abs','cyan','\x20\x20Timezone:\x20','Running\x20schedule:\x20','run','ended_at','priority','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','tsv','statusIcon','timezone','lastRun','Create\x20a\x20scheduled\x20query','\x20created','ies','executing_user_id','4241578PyrvvG','24VgQSsZ','site','map','red','schedule:list','error','just\x20now','91384lgnIRW','soon','success','listQueries','Creating\x20schedule...','user_name','/app/queries/editor?queryId=','📅\x20','utf-8','411376fupwsN','description','result','\x20job','Updating\x20schedule:\x20','INVALID_ARGUMENT','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','created_at','output','length','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','nextRun','history','\x20\x20Time:\x20','getTime','show','engineVersion','create','scheduled_at','keys','Searching\x20scheduled\x20queries\x20matching\x20\x22','Showing\x20first\x20','json','Listing\x20scheduled\x20queries...','schedule:run','pagination','No\x20scheduled\x20queries\x20found','count','\x20\x20Type:\x20','dim','has_next_page','217260SyNbeg','validate','last_job','Failed\x20to\x20read\x20file:\x20','execute','Query\x20file\x20is\x20empty','9nESCtC','\x20\x20→\x20','(unnamed)','args','data','Cancelled','\x20(showing\x20','job_id','Schedule\x20run\x20submitted:\x20','delay','schedule:show','user','Running\x20schedule...','\x20scheduled\x20quer','query','cron','Found\x20','Update\x20a\x20scheduled\x20query','start_at','format','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','schedules','retryLimit','List\x20scheduled\x20queries','Updating\x20schedule...','Schedule\x20deleted:\x20','status','verbose','\x22...','in\x20','h\x20ago','Show\x20schedule\x20execution\x20history','schedule:update','round','\x20\x20Num:\x20','toLocaleDateString','table','entries','next_run_at','2rnaSVs','Creating\x20schedule:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','Schedule\x20created:\x20','num','\x20(use\x20--limit\x20to\x20see\x20more)','trim','options','never','...','update','10MdowhG','engine_version','green','max','updated_at','database','120510zQuQcC','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','join','type','schedule:delete','queries','Show\x20schedule\x20details'];a36_0x217e=function(){return _0x171ecb;};return a36_0x217e();}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x165db1(0x182)]=a36_0x165db1(0x17b);[a36_0x165db1(0x11b)]='Delete\x20a\x20scheduled\x20query';[a36_0x165db1(0x13a)](_0x2c3e08){const _0x3618ae=a36_0x165db1,_0x30adc9=_0x2c3e08[_0x3618ae(0x142)][0x0];if(!_0x30adc9)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async[a36_0x165db1(0x13d)](_0x1fe796){const _0x467500=a36_0x165db1,{options:_0x580794,args:_0x4f2461,tdx:_0x102911}=_0x1fe796,_0x511de0=_0x4f2461[0x0];if(!_0x580794['yes']){const _0x29124c=await confirm(_0x467500(0x153)+_0x511de0+'\x22?');if(!_0x29124c)return console[_0x467500(0x19c)](_0x467500(0x144)),0x0;}const _0x1f5b95=await withSpinner('Deleting\x20schedule...',()=>_0x102911[_0x467500(0x154)]['delete'](_0x511de0),{'verbose':_0x580794[_0x467500(0x15a)]});return console[_0x467500(0x19c)](_0x467500(0x158)+_0x1f5b95[_0x467500(0x143)][_0x467500(0x182)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x165db1(0x182)]=a36_0x165db1(0x132);[a36_0x165db1(0x11b)]='Run\x20a\x20scheduled\x20query\x20immediately';[a36_0x165db1(0x13a)](_0x342263){const _0x39fed7=a36_0x165db1,_0x1a5006=_0x342263[_0x39fed7(0x142)][0x0];if(!_0x1a5006)return _0x39fed7(0x178);return undefined;}async[a36_0x165db1(0x13d)](_0x5d0b40){const _0x1611ec=a36_0x165db1,{options:_0x3a99e0,args:_0x4e2ef2,tdx:_0x445a2e}=_0x5d0b40,_0x4fc44d=_0x4e2ef2[0x0],_0x14900e=_0x3a99e0,_0xf3f003=_0x14900e['time'],_0x146a98=_0x14900e[_0x1611ec(0x16a)]!==undefined?Number(_0x14900e['num']):undefined;if(_0x3a99e0[_0x1611ec(0x15a)]){console[_0x1611ec(0x19c)](_0x1611ec(0x189)+_0x4fc44d);if(_0xf3f003)console['error'](_0x1611ec(0x127)+_0xf3f003);if(_0x146a98)console[_0x1611ec(0x19c)](_0x1611ec(0x161)+_0x146a98);}const _0x52d073=await withSpinner(_0x1611ec(0x14b),()=>_0x445a2e['schedules'][_0x1611ec(0x18a)](_0x4fc44d,{'time':_0xf3f003,'num':_0x146a98}),{'verbose':_0x3a99e0[_0x1611ec(0x15a)]}),_0x3e9b4e=_0x52d073[_0x1611ec(0x143)]['jobs'];console['error'](_0x1611ec(0x147)+_0x3e9b4e[_0x1611ec(0x123)]+_0x1611ec(0x11d)+(_0x3e9b4e[_0x1611ec(0x123)]!==0x1?'s':'')+_0x1611ec(0x193));for(const _0x3043cb of _0x3e9b4e){console['error']('\x20\x20Job\x20ID:\x20'+_0x3043cb[_0x1611ec(0x146)]);}return await handleSDKOutput(_0x3e9b4e,_0x3a99e0),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x165db1(0x182)]='schedule:history';['description']=a36_0x165db1(0x15e);[a36_0x165db1(0x13a)](_0x18c334){const _0x2cd05b=a36_0x165db1,_0x830269=_0x18c334[_0x2cd05b(0x142)][0x0];if(!_0x830269)return _0x2cd05b(0x185);return undefined;}async[a36_0x165db1(0x13d)](_0x2cdc6a){const _0x24dee6=a36_0x165db1,{options:_0x3a1e01,args:_0x599a8d,tdx:_0x457ce6}=_0x2cdc6a,_0x3def5e=_0x599a8d[0x0],_0xd12ef3=_0x3a1e01,_0x141d5e=_0xd12ef3[_0x24dee6(0x183)]!==undefined?Number(_0xd12ef3[_0x24dee6(0x183)]):undefined,_0x32095a=_0xd12ef3['to']!==undefined?Number(_0xd12ef3['to']):undefined,_0x1eff8a=await withSpinner('Getting\x20schedule\x20history...',()=>_0x457ce6['schedules']['history'](_0x3def5e,{'from':_0x141d5e,'to':_0x32095a}),{'verbose':_0x3a1e01[_0x24dee6(0x15a)]}),_0xe61f8e=_0x1eff8a['data'];console[_0x24dee6(0x19c)](_0x24dee6(0x14f)+_0xe61f8e[_0x24dee6(0x135)]+'\x20execution'+(_0xe61f8e['count']!==0x1?'s':'')+_0x24dee6(0x145)+_0xe61f8e[_0x24dee6(0x183)]+'-'+_0xe61f8e['to']+')');const _0x18fd58=_0xe61f8e[_0x24dee6(0x126)][_0x24dee6(0x199)](_0x1db098=>({'job_id':_0x1db098[_0x24dee6(0x146)],'type':_0x1db098['type'],'status':_0x1db098['status'],'scheduled_at':_0x1db098[_0x24dee6(0x12c)],'created_at':_0x1db098[_0x24dee6(0x121)],'start_at':_0x1db098[_0x24dee6(0x151)],'end_at':_0x1db098['end_at']}));return await handleSDKOutput(_0x18fd58,_0x3a1e01),0x0;}}
@@ -1 +1 @@
1
- const a37_0x449ac3=a37_0x4ecc;(function(_0x26d9be,_0x602976){const _0xc10164=a37_0x4ecc,_0x1e0a3a=_0x26d9be();while(!![]){try{const _0x6364fb=-parseInt(_0xc10164(0xa3))/0x1+parseInt(_0xc10164(0xa7))/0x2+-parseInt(_0xc10164(0xd5))/0x3*(parseInt(_0xc10164(0x99))/0x4)+parseInt(_0xc10164(0xbf))/0x5*(parseInt(_0xc10164(0xde))/0x6)+parseInt(_0xc10164(0xce))/0x7*(parseInt(_0xc10164(0x11c))/0x8)+parseInt(_0xc10164(0xb3))/0x9*(parseInt(_0xc10164(0x126))/0xa)+parseInt(_0xc10164(0xb5))/0xb;if(_0x6364fb===_0x602976)break;else _0x1e0a3a['push'](_0x1e0a3a['shift']());}catch(_0x2dba64){_0x1e0a3a['push'](_0x1e0a3a['shift']());}}}(a37_0x176f,0x3d239));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';function a37_0x4ecc(_0x45a58d,_0x42c35f){_0x45a58d=_0x45a58d-0x93;const _0x176fc8=a37_0x176f();let _0x4ecc39=_0x176fc8[_0x45a58d];return _0x4ecc39;}import a37_0x3e06ed from'chalk';async function resolveSegmentTarget(_0x4d5bca,_0x4daa4c,_0x552278){const _0x21fc48=a37_0x4ecc;if(isYamlFilePath(_0x4d5bca))try{const _0x16ddec=await resolveYamlFilePath(_0x4d5bca);return _0x552278&&(console[_0x21fc48(0x125)](_0x21fc48(0xad)+_0x4d5bca),console[_0x21fc48(0x125)](_0x21fc48(0x137)+_0x16ddec[_0x21fc48(0x12b)]),console[_0x21fc48(0x125)](_0x21fc48(0xa2)+_0x16ddec[_0x21fc48(0xdf)]),console['error'](_0x21fc48(0x103)+(_0x16ddec['folderPath']||'(root)')),console['error']('\x20\x20Full\x20path:\x20'+_0x16ddec['fullPath'])),_0x16ddec[_0x21fc48(0x11b)];}catch(_0x536e44){throw new SDKError(ErrorCode[_0x21fc48(0x106)],_0x21fc48(0xe4)+_0x536e44[_0x21fc48(0xa1)]);}if(!_0x4daa4c)throw new SDKError(ErrorCode[_0x21fc48(0x106)],_0x21fc48(0x95));return _0x4daa4c+'/'+_0x4d5bca;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x449ac3(0xfe)]=a37_0x449ac3(0x10e);[a37_0x449ac3(0x117)]=a37_0x449ac3(0xf7);async['execute'](_0x3788dc){const _0x2d65ed=a37_0x449ac3,{options:_0x14823b,args:_0x434531,tdx:_0x3d8a93}=_0x3788dc,_0x5d01c7=_0x434531[0x0],_0x4c35c4=!_0x5d01c7&&!!_0x14823b[_0x2d65ed(0x12b)],_0x1d0a97=_0x5d01c7||_0x14823b[_0x2d65ed(0x12b)];if(!_0x1d0a97)return console[_0x2d65ed(0x125)](_0x2d65ed(0x108)),console[_0x2d65ed(0x125)](_0x2d65ed(0xe3)),console['error'](_0x2d65ed(0x111)),console[_0x2d65ed(0x125)](_0x2d65ed(0xf8)),console[_0x2d65ed(0x125)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console[_0x2d65ed(0x125)](_0x2d65ed(0xbd)),console[_0x2d65ed(0x125)](_0x2d65ed(0x11e)),0x1;try{const _0x1e0f32=_0x14823b[_0x2d65ed(0xd0)];let _0x36ddce=_0x1d0a97;!_0x4c35c4&&_0x1e0f32&&!_0x1d0a97[_0x2d65ed(0x11f)]('/')&&(_0x36ddce=_0x1e0f32+'/'+_0x1d0a97,_0x14823b['verbose']&&console[_0x2d65ed(0x125)](_0x2d65ed(0xe7)+_0x36ddce));const _0x3adc3e=await withSpinner(_0x2d65ed(0xc7)+_0x36ddce+'\x27...',()=>_0x3d8a93[_0x2d65ed(0x107)][_0x2d65ed(0xc2)](_0x36ddce),{'verbose':_0x14823b[_0x2d65ed(0xeb)]}),_0x35c5c6=_0x3adc3e[_0x2d65ed(0xb8)];_0x14823b[_0x2d65ed(0xeb)]&&(console[_0x2d65ed(0x125)]('Resolved\x20type:\x20'+_0x35c5c6[_0x2d65ed(0xca)]),console[_0x2d65ed(0x125)](_0x2d65ed(0xb1)+_0x35c5c6[_0x2d65ed(0xd1)]),_0x35c5c6[_0x2d65ed(0xd7)]&&console['error'](_0x2d65ed(0x130)+_0x35c5c6[_0x2d65ed(0xd7)]),_0x35c5c6[_0x2d65ed(0x10b)]&&console['error']('Segment\x20ID:\x20'+_0x35c5c6[_0x2d65ed(0x10b)]));if(_0x35c5c6[_0x2d65ed(0xca)]===_0x2d65ed(0x116)){const _0x3aa4e3=await withSpinner(_0x2d65ed(0xc9),()=>_0x3d8a93[_0x2d65ed(0x107)][_0x2d65ed(0x129)](_0x35c5c6[_0x2d65ed(0xd1)]),{'verbose':_0x14823b[_0x2d65ed(0xeb)]});await handleSingleObjectOutput(_0x3aa4e3[_0x2d65ed(0xb8)],_0x14823b);}else{if(_0x35c5c6[_0x2d65ed(0xca)]==='folder'){if(!_0x35c5c6[_0x2d65ed(0xd7)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x2d65ed(0xcd));const _0x26e7cc=await withSpinner('Fetching\x20folder\x20details...',()=>_0x3d8a93['segment'][_0x2d65ed(0x119)](_0x35c5c6[_0x2d65ed(0xd7)]),{'verbose':_0x14823b['verbose']});await handleSingleObjectOutput(_0x26e7cc[_0x2d65ed(0xb8)],_0x14823b);}else{if(_0x35c5c6[_0x2d65ed(0xca)]==='segment'){if(!_0x35c5c6[_0x2d65ed(0x10b)])throw new SDKError(ErrorCode[_0x2d65ed(0x109)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x28f5ee=await withSpinner(_0x2d65ed(0xf9),()=>_0x3d8a93[_0x2d65ed(0x107)][_0x2d65ed(0x112)](_0x35c5c6['parentId'],_0x35c5c6[_0x2d65ed(0x10b)]),{'verbose':_0x14823b[_0x2d65ed(0xeb)]});await handleSingleObjectOutput(_0x28f5ee['data'],_0x14823b);}}}return 0x0;}catch(_0xe3328e){if(_0xe3328e instanceof SDKError)return console['error']('Error:\x20'+_0xe3328e[_0x2d65ed(0xa1)]),_0xe3328e[_0x2d65ed(0x102)]&&console[_0x2d65ed(0x125)](_0x2d65ed(0x138)+_0xe3328e['cause']),0x1;throw _0xe3328e;}}}export class SegmentShowCommand extends BaseCommand{['name']='segment:show';[a37_0x449ac3(0x117)]=a37_0x449ac3(0x10c);async['execute'](_0x4b7ae6){const _0x53cba1=a37_0x449ac3,{options:_0x5d0237,args:_0x115769,tdx:_0x1bcfbc}=_0x4b7ae6,_0x4de5ba=_0x115769[0x0];if(!_0x4de5ba)return console['error'](_0x53cba1(0x128)),console[_0x53cba1(0x125)](_0x53cba1(0x10a)),console[_0x53cba1(0x125)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x53cba1(0x125)](_0x53cba1(0x111)),console['error'](_0x53cba1(0xa4)),console['error']('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x62654f=_0x5d0237['parentSegment'],_0x31b0c3=await resolveSegmentTarget(_0x4de5ba,_0x62654f,_0x5d0237['verbose']);_0x5d0237[_0x53cba1(0xeb)]&&console[_0x53cba1(0x125)](_0x53cba1(0x101)+_0x31b0c3);const _0x6f9db0=await withSpinner(_0x53cba1(0xf1)+_0x4de5ba+_0x53cba1(0xc6),()=>_0x1bcfbc[_0x53cba1(0x107)][_0x53cba1(0xc2)](_0x31b0c3),{'verbose':_0x5d0237[_0x53cba1(0xeb)]}),_0x8354f7=_0x6f9db0[_0x53cba1(0xb8)];_0x5d0237[_0x53cba1(0xeb)]&&(console['error'](_0x53cba1(0xf5)+_0x8354f7[_0x53cba1(0xca)]),console[_0x53cba1(0x125)]('Parent\x20ID:\x20'+_0x8354f7['parentId']));if(_0x8354f7[_0x53cba1(0xca)]==='folder')return console[_0x53cba1(0x125)](_0x53cba1(0xea)),console[_0x53cba1(0x125)]('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x8354f7[_0x53cba1(0xca)]===_0x53cba1(0x116))return console[_0x53cba1(0x125)](_0x53cba1(0xd4)),console[_0x53cba1(0x125)](_0x53cba1(0xaa)),0x1;if(!_0x8354f7[_0x53cba1(0x10b)])throw new SDKError(ErrorCode[_0x53cba1(0x109)],_0x53cba1(0x9c));const _0x54bd20=await withSpinner(_0x53cba1(0xf0),()=>_0x1bcfbc[_0x53cba1(0x107)][_0x53cba1(0x9a)](_0x8354f7[_0x53cba1(0xd1)],_0x8354f7[_0x53cba1(0x10b)]),{'verbose':_0x5d0237[_0x53cba1(0xeb)]});let _0x1c6a51=_0x54bd20[_0x53cba1(0xb8)];const _0x5566b2=resolveLimit(_0x5d0237[_0x53cba1(0x9b)],DEFAULT_DISPLAY_LIMIT),_0x8df3de=/\bLIMIT\s+\d+/i['test'](_0x1c6a51);!_0x8df3de&&(_0x1c6a51=_0x1c6a51[_0x53cba1(0xda)]()[_0x53cba1(0x118)](/;+$/,''),_0x1c6a51='SELECT\x20*\x20FROM\x20(\x0a'+_0x1c6a51+_0x53cba1(0x100)+_0x5566b2);_0x5d0237[_0x53cba1(0xeb)]&&console['error'](_0x53cba1(0xb7)+_0x1c6a51);const _0x21a26d=await withProgressSpinner('Executing\x20segment\x20query...',async _0x35af5a=>{const _0x3f452c=_0x53cba1,_0x5e0e40=await _0x1bcfbc[_0x3f452c(0x96)]['execute'](_0x1c6a51,{'catalog':'td','schema':_0x3f452c(0x134),'onJobId':_0xd03e62=>{const _0x1e4715=_0x3f452c;_0x35af5a[_0x1e4715(0xc3)](_0xd03e62);}});return _0x5e0e40;},{'verbose':_0x5d0237['verbose']}),_0x36e481=_0x21a26d[_0x53cba1(0xb8)],_0x23ced2=_0x36e481[_0x53cba1(0xf6)]?'\x20[Job\x20ID:\x20'+_0x36e481[_0x53cba1(0xf6)]+']':'';return console[_0x53cba1(0x125)](_0x53cba1(0xdb)+_0x36e481[_0x53cba1(0xec)]['processedRows']['toLocaleString']()+_0x53cba1(0xfc)+(_0x53cba1(0x122)+formatElapsed(_0x36e481[_0x53cba1(0xec)][_0x53cba1(0xbb)])+_0x23ced2)),await handleQueryOutput(_0x36e481,_0x5d0237),0x0;}catch(_0x31d04b){if(_0x31d04b instanceof SDKError)return console[_0x53cba1(0x125)](_0x53cba1(0xa6)+_0x31d04b[_0x53cba1(0x131)]+']'),console[_0x53cba1(0x125)]('\x0a'+_0x31d04b[_0x53cba1(0xa1)]),0x1;throw _0x31d04b;}}}function a37_0x176f(){const _0x4a6ede=['Fetching\x20segment\x20details...','Resolving\x20folder\x20\x27','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','\x20rows\x20','getSQLFromYamlFile','name','format','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Target\x20path:\x20','cause','\x20\x20Folder\x20path:\x20','Resolved\x20folder\x20ID:\x20','Resolved:\x20','INVALID_ARGUMENT','segment','Error:\x20Path\x20or\x20name\x20is\x20required','SEGMENT_NOT_FOUND','Usage:\x20tdx\x20sg\x20show\x20<name>','segmentId','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Site:\x20','segment:describe','\x27\x20with\x20ID:\x20','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Examples:','getSegment','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','✔\x20Found\x20','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','parent','description','replace','getFolder','web','fullPath','584wzcQmg','Resolved\x20parent\x20ID:\x20','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','includes','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','url','in\x20','createFolder','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','error','30830FdrQia','segment:folder:show','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','getParent','Error:\x20','parentSegment','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','getSegmentSQLFromYaml','Resolved\x20parent\x20folder\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Folder\x20ID:\x20','code','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','getSQLFromServerSegment','information_schema','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','\x20\x20Parent\x20segment:\x20','\x20\x20Cause:\x20','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','query','Use:\x20tdx\x20ps\x20desc','/app/ps/','380104KKZugn','getSegmentSQL','limit','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Get\x20SQL\x20query\x20for\x20child\x20segment','listFolders','cyan','\x20\x20tdx\x20sg\x20sql\x20--path\x20','message','\x20\x20Segment\x20name:\x20','273918DiQNgj','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Usage:','✖\x20Query\x20failed\x20[','459606GROZEy','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Use:\x20tdx\x20ps\x20show','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Parent\x20name:\x20','Resolved\x20YAML\x20file:\x20','Options:','path','Fetching\x20SQL\x20from\x20rule...','Parent\x20ID:\x20','green','801kgeniu','resolveParentId','2560426GDALRY','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','SQL\x20query:\x0a','data','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','Creating\x20folder\x20\x27','elapsedTimeMillis','Show\x20child\x20segment\x20schema\x20(column\x20types)','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Segment\x20ID:\x20','5sMsSEV','/e/','execute','resolvePathToResource','setJobId','Folder\x20name:\x20','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','\x27...','Resolving\x20path\x20\x27','segment:sql','Fetching\x20parent\x20segment\x20details...','type','\x20Opening\x20','Use:\x20tdx\x20ps\x20view','Folder\x20ID\x20missing\x20from\x20resolved\x20path','5971JiWPHR','segment:folder:create','segmentPath','parentId','log','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','9NyWynG','Use:\x20tdx\x20ps\x20view\x20-w','folderId','parentFolder','resolveFolderId','trim','✔\x20Query\x20completed:\x20Processed\x20','site','Parent\x20segment:\x20','61176GpXXtg','segmentName','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Usage:\x20tdx\x20segment\x20describe\x20<path>','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','segment:folder:list','folder','Resolved\x20relative\x20path\x20to:\x20','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','length','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','verbose','stats','Resolving\x20parent\x20segment\x20\x27','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','Show\x20segment\x20folder\x20details','Fetching\x20SQL\x20for\x20segment...','Resolving\x20\x27','SEGMENT_FOLDER_NOT_FOUND','red','content','Resolved\x20type:\x20','jobId','Show\x20segment\x20or\x20folder\x20details','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'];a37_0x176f=function(){return _0x4a6ede;};return a37_0x176f();}export class SegmentFolderListCommand extends BaseCommand{[a37_0x449ac3(0xfe)]=a37_0x449ac3(0xe5);[a37_0x449ac3(0x117)]=a37_0x449ac3(0x113);async[a37_0x449ac3(0xc1)](_0x455c28){const _0x2f0916=a37_0x449ac3,{options:_0x529820,args:_0x399d2c,tdx:_0x478b34}=_0x455c28;if(_0x399d2c['length']===0x0)return console[_0x2f0916(0x125)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x2f0916(0x125)](_0x2f0916(0x120)),0x1;const _0x4f62e3=_0x399d2c[0x0];try{_0x529820['verbose']&&(console[_0x2f0916(0x125)]('Site:\x20'+_0x529820['site']),console[_0x2f0916(0x125)](_0x2f0916(0xac)+_0x4f62e3));const _0x4a1755=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x4f62e3+_0x2f0916(0xc6),()=>_0x478b34[_0x2f0916(0x107)][_0x2f0916(0xb4)](_0x4f62e3),{'verbose':_0x529820[_0x2f0916(0xeb)]}),_0x22adb3=_0x4a1755[_0x2f0916(0xb8)];_0x529820[_0x2f0916(0xeb)]&&console[_0x2f0916(0x125)]('Resolved\x20parent\x20ID:\x20'+_0x22adb3);const _0x15009c=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x4f62e3+_0x2f0916(0xc6),()=>_0x478b34[_0x2f0916(0x107)][_0x2f0916(0x9e)](_0x22adb3),{'verbose':_0x529820[_0x2f0916(0xeb)]}),_0x5a0347=_0x15009c[_0x2f0916(0xb8)];return console['error'](_0x2f0916(0x114)+_0x5a0347['length']+'\x20folder'+(_0x5a0347['length']!==0x1?'s':'')),await handleSDKOutput(_0x5a0347,_0x529820),0x0;}catch(_0x3cff33){if(_0x3cff33 instanceof SDKError)return console[_0x2f0916(0x125)](_0x2f0916(0x12a)+_0x3cff33[_0x2f0916(0xa1)]),_0x3cff33[_0x2f0916(0x102)]&&console[_0x2f0916(0x125)](_0x2f0916(0x138)+_0x3cff33[_0x2f0916(0x102)]),0x1;throw _0x3cff33;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a37_0x449ac3(0x127);['description']=a37_0x449ac3(0xef);async[a37_0x449ac3(0xc1)](_0x1d6327){const _0x21a831=a37_0x449ac3,{options:_0x2c29ce,args:_0x4d3fa9,tdx:_0x5ae38e}=_0x1d6327;if(_0x4d3fa9['length']===0x0)return console['error']('Error:\x20Folder\x20reference\x20is\x20required'),console[_0x21a831(0x125)](_0x21a831(0xc5)),0x1;try{const {parentId:_0x2db8a0,childId:_0x18a739}=parseSegmentRef(_0x4d3fa9[0x0]);_0x2c29ce['verbose']&&(console['error'](_0x21a831(0x10d)+_0x2c29ce[_0x21a831(0xdc)]),console['error']('Parent\x20name:\x20'+_0x2db8a0),_0x18a739&&console['error'](_0x21a831(0xc4)+_0x18a739));if(!_0x18a739)return console[_0x21a831(0x125)](_0x21a831(0xa9)),0x1;const _0x5b17a9=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2db8a0+_0x21a831(0xc6),()=>_0x5ae38e['segment'][_0x21a831(0xb4)](_0x2db8a0),{'verbose':_0x2c29ce[_0x21a831(0xeb)]}),_0x1f66e0=_0x5b17a9[_0x21a831(0xb8)];_0x2c29ce[_0x21a831(0xeb)]&&console['error'](_0x21a831(0x11d)+_0x1f66e0);const _0x78c078=await withSpinner(_0x21a831(0xfa)+_0x18a739+'\x27...',()=>_0x5ae38e[_0x21a831(0x107)][_0x21a831(0xd9)](_0x1f66e0,_0x18a739),{'verbose':_0x2c29ce[_0x21a831(0xeb)]}),_0x12a7d6=_0x78c078[_0x21a831(0xb8)];_0x2c29ce[_0x21a831(0xeb)]&&console['error'](_0x21a831(0x104)+_0x12a7d6);const _0x4c8ec7=await withSpinner('Fetching\x20folder\x20\x27'+_0x18a739+_0x21a831(0xc6),()=>_0x5ae38e[_0x21a831(0x107)][_0x21a831(0x119)](_0x12a7d6),{'verbose':_0x2c29ce[_0x21a831(0xeb)]});return await handleSDKOutput([_0x4c8ec7[_0x21a831(0xb8)]],_0x2c29ce),0x0;}catch(_0x49e9a4){if(_0x49e9a4 instanceof SDKError)return console[_0x21a831(0x125)](_0x21a831(0x12a)+_0x49e9a4[_0x21a831(0xa1)]),_0x49e9a4['cause']&&console[_0x21a831(0x125)](_0x21a831(0x138)+_0x49e9a4[_0x21a831(0x102)]),0x1;throw _0x49e9a4;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x449ac3(0xfe)]=a37_0x449ac3(0xc8);[a37_0x449ac3(0x117)]=a37_0x449ac3(0x9d);async[a37_0x449ac3(0xc1)](_0x16b388){const _0x50f294=a37_0x449ac3,{options:_0x1b6d7f,args:_0x4d44c1}=_0x16b388,_0x23f492=_0x1b6d7f,_0x193d14=_0x23f492[_0x50f294(0xaf)],_0x22b264=_0x4d44c1[0x0];if(!_0x22b264&&!_0x193d14)return console[_0x50f294(0x125)](a37_0x3e06ed[_0x50f294(0xf3)](_0x50f294(0x93))),console[_0x50f294(0x125)](_0x50f294(0xa5)),console[_0x50f294(0x125)](_0x50f294(0xe8)),console['error'](_0x50f294(0xb9)),console['error'](_0x50f294(0x111)),console[_0x50f294(0x125)](_0x50f294(0xfb)),console[_0x50f294(0x125)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml'),0x1;if(_0x22b264&&_0x193d14)return console[_0x50f294(0x125)](a37_0x3e06ed[_0x50f294(0xf3)](_0x50f294(0x136))),0x1;try{let _0x37f6f6;if(_0x193d14)_0x37f6f6=await this[_0x50f294(0xfd)](_0x193d14,_0x16b388);else{if(isYamlFilePath(_0x22b264))return console[_0x50f294(0x125)](a37_0x3e06ed[_0x50f294(0xf3)](_0x50f294(0xee))),console[_0x50f294(0x125)](_0x50f294(0xa0)+_0x22b264),0x1;else _0x37f6f6=await this['getSQLFromServerSegment'](_0x22b264,_0x16b388);}return _0x1b6d7f[_0x50f294(0xff)]==='json'||_0x1b6d7f['format']==='jsonl'?await handleSDKOutput([{'sql':_0x37f6f6}],_0x1b6d7f):console[_0x50f294(0xd2)](_0x37f6f6),0x0;}catch(_0x23357){if(_0x23357 instanceof SDKError)return console['error'](_0x50f294(0x12a)+_0x23357[_0x50f294(0xa1)]),_0x23357[_0x50f294(0x102)]&&console['error'](_0x50f294(0x138)+_0x23357['cause']),0x1;throw _0x23357;}}async['getSQLFromYamlFile'](_0x47e6b8,_0x46b149){const _0x415c27=a37_0x449ac3,{options:_0x1dff13,tdx:_0x2727f0}=_0x46b149;let _0x4c344f;try{_0x4c344f=await resolveYamlFilePath(_0x47e6b8);}catch(_0x531066){throw new SDKError(ErrorCode[_0x415c27(0x106)],_0x415c27(0xe4)+_0x531066['message']);}_0x1dff13['verbose']&&console['error'](_0x415c27(0x105)+_0x4c344f[_0x415c27(0x12b)]+'/'+_0x4c344f[_0x415c27(0xdf)]);const _0x44f26c=await withSpinner(_0x415c27(0xb0),()=>_0x2727f0[_0x415c27(0x107)][_0x415c27(0x12d)](_0x4c344f[_0x415c27(0xf4)],_0x4c344f['parentSegment'],_0x4c344f[_0x415c27(0xdf)]),{'verbose':_0x1dff13['verbose']});return _0x44f26c[_0x415c27(0xb8)];}async[a37_0x449ac3(0x133)](_0x2df8e1,_0xf23d6c){const _0x176d99=a37_0x449ac3,{options:_0x564927,tdx:_0x30ab07}=_0xf23d6c,_0x3218db=_0x564927[_0x176d99(0x12b)],_0x5e8352=await resolveSegmentTarget(_0x2df8e1,_0x3218db,_0x564927[_0x176d99(0xeb)]);_0x564927[_0x176d99(0xeb)]&&console['error'](_0x176d99(0x101)+_0x5e8352);const _0x4edc3b=await withSpinner('Resolving\x20\x27'+_0x2df8e1+_0x176d99(0xc6),()=>_0x30ab07[_0x176d99(0x107)]['resolvePathToResource'](_0x5e8352),{'verbose':_0x564927['verbose']}),_0x4a2cb1=_0x4edc3b[_0x176d99(0xb8)];_0x564927[_0x176d99(0xeb)]&&(console['error'](_0x176d99(0xf5)+_0x4a2cb1['type']),console[_0x176d99(0x125)](_0x176d99(0xb1)+_0x4a2cb1[_0x176d99(0xd1)]));if(_0x4a2cb1[_0x176d99(0xca)]===_0x176d99(0xe6))throw new SDKError(ErrorCode[_0x176d99(0x106)],_0x176d99(0x110));if(_0x4a2cb1[_0x176d99(0xca)]==='parent')throw new SDKError(ErrorCode[_0x176d99(0x106)],_0x176d99(0xb6));if(!_0x4a2cb1['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x176d99(0x9c));const _0x2b586d=await withSpinner(_0x176d99(0xf0),()=>_0x30ab07[_0x176d99(0x107)][_0x176d99(0x9a)](_0x4a2cb1['parentId'],_0x4a2cb1[_0x176d99(0x10b)]),{'verbose':_0x564927[_0x176d99(0xeb)]});return _0x2b586d[_0x176d99(0xb8)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x449ac3(0xfe)]=a37_0x449ac3(0xcf);[a37_0x449ac3(0x117)]='Create\x20segment\x20folder\x20for\x20organization';async['execute'](_0x45b2d9){const _0x76bf4=a37_0x449ac3,{options:_0x1bf1d6,args:_0xd0f8a3,tdx:_0x33d54c}=_0x45b2d9,_0x1a4bc4=_0x1bf1d6;if(_0xd0f8a3[_0x76bf4(0xe9)]<0x2)return console['error'](_0x76bf4(0xa8)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x3a6c4a=_0xd0f8a3[0x0],_0x2e8131=_0xd0f8a3[0x1];_0x1a4bc4[_0x76bf4(0xeb)]&&(console[_0x76bf4(0x125)](_0x76bf4(0x10d)+_0x1a4bc4[_0x76bf4(0xdc)]),console[_0x76bf4(0x125)](_0x76bf4(0xdd)+_0x3a6c4a),console[_0x76bf4(0x125)](_0x76bf4(0xc4)+_0x2e8131));let _0x13aaea;if(_0x1a4bc4[_0x76bf4(0xd8)]){const _0x416a28=_0x1a4bc4[_0x76bf4(0xd8)],_0xe270dd=await withSpinner(_0x76bf4(0xed)+_0x3a6c4a+_0x76bf4(0xc6),()=>_0x33d54c[_0x76bf4(0x107)][_0x76bf4(0xb4)](_0x3a6c4a),{'verbose':_0x1a4bc4['verbose']}),_0x26fb8b=_0xe270dd['data'],_0x558fef=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x416a28+_0x76bf4(0xc6),()=>_0x33d54c['segment']['resolveFolderId'](_0x26fb8b,_0x416a28),{'verbose':_0x1a4bc4[_0x76bf4(0xeb)]});_0x13aaea=_0x558fef[_0x76bf4(0xb8)],_0x1a4bc4['verbose']&&console['error'](_0x76bf4(0x12e)+_0x13aaea);}const _0x14407d={'name':_0x2e8131,'description':_0x1a4bc4['description'],'parentFolderId':_0x13aaea},_0x2723fd=await withSpinner(_0x76bf4(0xba)+_0x2e8131+_0x76bf4(0xc6),()=>_0x33d54c[_0x76bf4(0x107)][_0x76bf4(0x123)](_0x3a6c4a,_0x14407d),{'verbose':_0x1a4bc4['verbose']}),_0x2f22e0=_0x2723fd['data'];return console[_0x76bf4(0x125)]('✔\x20Created\x20folder\x20\x27'+_0x2f22e0['name']+_0x76bf4(0x10f)+_0x2f22e0['id']),await handleSDKOutput([_0x2f22e0],_0x1a4bc4),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x449ac3(0xfe)]='segment:view';[a37_0x449ac3(0x117)]='Show\x20folder\x20or\x20child\x20segment\x20details';async[a37_0x449ac3(0xc1)](_0x1446e7){const _0x24e71e=a37_0x449ac3,{options:_0x51392d,args:_0x3b5825,tdx:_0x43acf9}=_0x1446e7,_0x59493c=_0x3b5825[0x0];if(!_0x59493c)return console[_0x24e71e(0x125)](_0x24e71e(0xd3)),console[_0x24e71e(0x125)]('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console[_0x24e71e(0x125)](_0x24e71e(0x12f)),console[_0x24e71e(0x125)](_0x24e71e(0xae)),console[_0x24e71e(0x125)](_0x24e71e(0x115)),console[_0x24e71e(0x125)](_0x24e71e(0x111)),console[_0x24e71e(0x125)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x24e71e(0x125)](_0x24e71e(0x94)),console['error'](_0x24e71e(0xe1)),console[_0x24e71e(0x125)](_0x24e71e(0x135)),0x1;try{const _0x2854e5=_0x51392d[_0x24e71e(0x12b)],_0x12e0b8=await resolveSegmentTarget(_0x59493c,_0x2854e5,_0x51392d['verbose']);_0x51392d['verbose']&&console[_0x24e71e(0x125)](_0x24e71e(0x101)+_0x12e0b8);const _0x4abecd=await withSpinner(_0x24e71e(0xf1)+_0x59493c+_0x24e71e(0xc6),()=>_0x43acf9[_0x24e71e(0x107)]['resolvePathToResource'](_0x12e0b8),{'verbose':_0x51392d[_0x24e71e(0xeb)]}),_0x5b210a=_0x4abecd[_0x24e71e(0xb8)];_0x51392d[_0x24e71e(0xeb)]&&(console[_0x24e71e(0x125)]('Resolved\x20type:\x20'+_0x5b210a[_0x24e71e(0xca)]),console[_0x24e71e(0x125)](_0x24e71e(0xb1)+_0x5b210a[_0x24e71e(0xd1)]),_0x5b210a[_0x24e71e(0xd7)]&&console[_0x24e71e(0x125)](_0x24e71e(0x130)+_0x5b210a[_0x24e71e(0xd7)]),_0x5b210a[_0x24e71e(0x10b)]&&console['error'](_0x24e71e(0xbe)+_0x5b210a['segmentId']));if(_0x51392d[_0x24e71e(0x11a)]){if(_0x5b210a[_0x24e71e(0xca)]===_0x24e71e(0xe6))return console[_0x24e71e(0x125)](_0x24e71e(0x124)),0x1;if(_0x5b210a['type']===_0x24e71e(0x116))return console['error'](_0x24e71e(0xe0)),console['error'](_0x24e71e(0xd6)),0x1;if(!_0x5b210a[_0x24e71e(0x10b)])throw new SDKError(ErrorCode[_0x24e71e(0x109)],_0x24e71e(0x9c));const _0x4d3ff3=getConsoleNextUrl(_0x51392d[_0x24e71e(0xdc)],_0x24e71e(0x98)+_0x5b210a[_0x24e71e(0xd1)]+_0x24e71e(0xc0)+_0x5b210a['segmentId']);return console['error'](a37_0x3e06ed[_0x24e71e(0xb2)]('✔')+_0x24e71e(0xcb)+a37_0x3e06ed[_0x24e71e(0x9f)](_0x4d3ff3)),openBrowser(_0x4d3ff3),0x0;}if(_0x5b210a['type']===_0x24e71e(0xe6)){if(!_0x5b210a['folderId'])throw new SDKError(ErrorCode[_0x24e71e(0xf2)],_0x24e71e(0xcd));const _0x107e55=await withSpinner('Fetching\x20folder\x20details...',()=>_0x43acf9[_0x24e71e(0x107)][_0x24e71e(0x119)](_0x5b210a[_0x24e71e(0xd7)]),{'verbose':_0x51392d[_0x24e71e(0xeb)]});await handleSingleObjectOutput(_0x107e55[_0x24e71e(0xb8)],_0x51392d);}else{if(_0x5b210a['type']===_0x24e71e(0x107)){if(!_0x5b210a[_0x24e71e(0x10b)])throw new SDKError(ErrorCode[_0x24e71e(0x109)],_0x24e71e(0x9c));const _0x176294=await withSpinner('Fetching\x20segment\x20details...',()=>_0x43acf9[_0x24e71e(0x107)][_0x24e71e(0x112)](_0x5b210a[_0x24e71e(0xd1)],_0x5b210a[_0x24e71e(0x10b)]),{'verbose':_0x51392d[_0x24e71e(0xeb)]}),_0x4f1174=getConsoleNextUrl(_0x51392d['site'],_0x24e71e(0x98)+_0x5b210a[_0x24e71e(0xd1)]+_0x24e71e(0xc0)+_0x5b210a['segmentId']),_0x3eaf8e=_0x176294['data'];_0x3eaf8e[_0x24e71e(0x121)]=_0x4f1174,await handleSingleObjectOutput(_0x3eaf8e,_0x51392d);}else return console[_0x24e71e(0x125)]('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console[_0x24e71e(0x125)](_0x24e71e(0xcc)),0x1;}return 0x0;}catch(_0x4c89e6){if(_0x4c89e6 instanceof SDKError)return console[_0x24e71e(0x125)]('Error:\x20'+_0x4c89e6[_0x24e71e(0xa1)]),_0x4c89e6[_0x24e71e(0x102)]&&console[_0x24e71e(0x125)](_0x24e71e(0x138)+_0x4c89e6[_0x24e71e(0x102)]),0x1;throw _0x4c89e6;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x449ac3(0xfe)]='segment:desc';[a37_0x449ac3(0x117)]=a37_0x449ac3(0xbc);async[a37_0x449ac3(0xc1)](_0x2f3d3b){const _0x3695a9=a37_0x449ac3,{options:_0x1aa899,args:_0x1db483,tdx:_0xe02f92}=_0x2f3d3b,_0x61ee0=_0x1db483[0x0];if(!_0x61ee0)return console[_0x3695a9(0x125)](_0x3695a9(0x128)),console[_0x3695a9(0x125)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x3695a9(0x125)](_0x3695a9(0x132)),console[_0x3695a9(0x125)](_0x3695a9(0x111)),console['error']('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x3695a9(0x125)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x1becce=_0x1aa899[_0x3695a9(0x12b)],_0x53aa16=await resolveSegmentTarget(_0x61ee0,_0x1becce,_0x1aa899['verbose']);_0x1aa899[_0x3695a9(0xeb)]&&console[_0x3695a9(0x125)](_0x3695a9(0x101)+_0x53aa16);const _0x12f7d5=await withSpinner('Resolving\x20\x27'+_0x61ee0+_0x3695a9(0xc6),()=>_0xe02f92['segment'][_0x3695a9(0xc2)](_0x53aa16),{'verbose':_0x1aa899[_0x3695a9(0xeb)]}),_0x1dcbea=_0x12f7d5[_0x3695a9(0xb8)];_0x1aa899['verbose']&&(console['error'](_0x3695a9(0xf5)+_0x1dcbea[_0x3695a9(0xca)]),console[_0x3695a9(0x125)](_0x3695a9(0xb1)+_0x1dcbea[_0x3695a9(0xd1)]));if(_0x1dcbea['type']===_0x3695a9(0xe6))return console[_0x3695a9(0x125)](_0x3695a9(0xe2)),console[_0x3695a9(0x125)](_0x3695a9(0xab)),0x1;if(_0x1dcbea[_0x3695a9(0xca)]===_0x3695a9(0x116))return console['error'](_0x3695a9(0x12c)),console[_0x3695a9(0x125)](_0x3695a9(0x97)),0x1;if(!_0x1dcbea[_0x3695a9(0x10b)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x3695a9(0x9c));const _0x3ee841=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0xe02f92[_0x3695a9(0x107)][_0x3695a9(0x9a)](_0x1dcbea[_0x3695a9(0xd1)],_0x1dcbea[_0x3695a9(0x10b)]),{'verbose':_0x1aa899['verbose']}),_0x3f3daa=_0x3ee841['data'],_0x4bdd9b=await executeSchemaQuery(_0x3f3daa,_0xe02f92,_0x1aa899);return await handleQueryOutput(_0x4bdd9b,_0x1aa899),0x0;}catch(_0x39dd97){if(_0x39dd97 instanceof SDKError)return console['error']('Error:\x20'+_0x39dd97[_0x3695a9(0xa1)]),_0x39dd97['cause']&&console[_0x3695a9(0x125)](_0x3695a9(0x138)+_0x39dd97['cause']),0x1;throw _0x39dd97;}}}
1
+ const a37_0x3d08b7=a37_0x5f39;(function(_0x446d44,_0x33f469){const _0x3a2efa=a37_0x5f39,_0x34b899=_0x446d44();while(!![]){try{const _0xedba6c=-parseInt(_0x3a2efa(0x1b1))/0x1*(-parseInt(_0x3a2efa(0x1bf))/0x2)+parseInt(_0x3a2efa(0x24f))/0x3*(parseInt(_0x3a2efa(0x1cc))/0x4)+parseInt(_0x3a2efa(0x1c2))/0x5+-parseInt(_0x3a2efa(0x223))/0x6*(-parseInt(_0x3a2efa(0x209))/0x7)+parseInt(_0x3a2efa(0x227))/0x8+-parseInt(_0x3a2efa(0x21f))/0x9*(-parseInt(_0x3a2efa(0x1d3))/0xa)+-parseInt(_0x3a2efa(0x203))/0xb;if(_0xedba6c===_0x33f469)break;else _0x34b899['push'](_0x34b899['shift']());}catch(_0x507cfd){_0x34b899['push'](_0x34b899['shift']());}}}(a37_0x24b5,0x49fbd));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';function a37_0x5f39(_0x24c602,_0x28383d){_0x24c602=_0x24c602-0x1b0;const _0x24b5a2=a37_0x24b5();let _0x5f3960=_0x24b5a2[_0x24c602];return _0x5f3960;}import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';function a37_0x24b5(){const _0x46ac79=['log','Show\x20folder\x20or\x20child\x20segment\x20details','✔\x20Found\x20','parent','getFolder','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Target\x20path:\x20','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Resolved:\x20','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','12106plAyfX','\x20rows\x20','parentSegment','1953940hoFPJG','stats','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Use:\x20tdx\x20ps\x20desc','query','site','segment:folder:list','includes','getParent','52aNnsXY','trim','Fetching\x20folder\x20\x27','Show\x20segment\x20folder\x20details','Resolving\x20path\x20\x27','segment:folder:show','data','2010axxHvg','segmentPath','segment:sql','Options:','segment:view','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','parentId','processedRows','segmentName','red','Executing\x20segment\x20query...','getSQLFromYamlFile','web','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','folderId','cause','Show\x20child\x20segment\x20schema\x20(column\x20types)','/e/','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','parentFolder','getSegmentSQL','replace','resolvePathToResource','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Resolved\x20parent\x20folder\x20ID:\x20','\x20Opening\x20','✔\x20Query\x20completed:\x20Processed\x20','segment','Resolved\x20parent\x20ID:\x20','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','Parent\x20name:\x20','verbose','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Resolving\x20folder\x20\x27','Fetching\x20segment\x20details...','execute','Folder\x20name:\x20','\x20\x20Cause:\x20','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','Site:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Resolving\x20\x27','Usage:','toLocaleString','SELECT\x20*\x20FROM\x20(\x0a','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Resolving\x20parent\x20segment\x20\x27','14169947spYxEQ','(root)','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Use:\x20tdx\x20ps\x20view','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','35hcAETC','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Fetching\x20SQL\x20for\x20segment...','elapsedTimeMillis','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','✔\x20Created\x20folder\x20\x27','Segment\x20ID:\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','INVALID_ARGUMENT','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Folder\x20ID\x20missing\x20from\x20resolved\x20path','\x20folder','segmentId','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Resolved\x20relative\x20path\x20to:\x20','url','/app/ps/','\x27\x20with\x20ID:\x20','SEGMENT_FOLDER_NOT_FOUND','8487yrZugw','Resolving\x20parent\x20folder\x20\x27','setJobId','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','222930sCBKFz','Use:\x20tdx\x20ps\x20view\x20-w','type','Show\x20segment\x20or\x20folder\x20details','1816376nKqYSz','resolveParentId','green','segment:describe','\x20\x20Parent\x20segment:\x20','name','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','message','error','jobId','Error:\x20','length','getSegment','limit','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Examples:','format','test','Parent\x20segment:\x20','Parent\x20ID:\x20','description','Fetching\x20parent\x20segment\x20details...','Get\x20SQL\x20query\x20for\x20child\x20segment','Usage:\x20tdx\x20sg\x20desc\x20<name>','Folder\x20ID:\x20','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','Listing\x20folders\x20for\x20parent\x20\x27','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Fetching\x20folder\x20details...','\x27...','\x20\x20Full\x20path:\x20','content','segment:desc','✖\x20Query\x20failed\x20[','folder','in\x20','resolveFolderId','75156hafmsi','Creating\x20folder\x20\x27','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Error:\x20Parent\x20segment\x20name\x20is\x20required','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','code','SEGMENT_NOT_FOUND','\x20\x20Folder\x20path:\x20','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Usage:\x20tdx\x20sg\x20show\x20<name>','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','jsonl','\x20[Job\x20ID:\x20','Resolved\x20type:\x20','fullPath','45bGmojH','getSQLFromServerSegment','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'];a37_0x24b5=function(){return _0x46ac79;};return a37_0x24b5();}import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0x4e311e from'chalk';async function resolveSegmentTarget(_0x3b9c6d,_0x4f3249,_0xf090ea){const _0x2f8830=a37_0x5f39;if(isYamlFilePath(_0x3b9c6d))try{const _0x44243b=await resolveYamlFilePath(_0x3b9c6d);return _0xf090ea&&(console[_0x2f8830(0x230)]('Resolved\x20YAML\x20file:\x20'+_0x3b9c6d),console[_0x2f8830(0x230)](_0x2f8830(0x22b)+_0x44243b[_0x2f8830(0x1c1)]),console[_0x2f8830(0x230)]('\x20\x20Segment\x20name:\x20'+_0x44243b['segmentName']),console['error'](_0x2f8830(0x256)+(_0x44243b['folderPath']||_0x2f8830(0x204))),console[_0x2f8830(0x230)](_0x2f8830(0x248)+_0x44243b[_0x2f8830(0x1b0)])),_0x44243b[_0x2f8830(0x1b0)];}catch(_0x214ec){throw new SDKError(ErrorCode[_0x2f8830(0x211)],_0x2f8830(0x25b)+_0x214ec[_0x2f8830(0x22f)]);}if(!_0x4f3249)throw new SDKError(ErrorCode[_0x2f8830(0x211)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x4f3249+'/'+_0x3b9c6d;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x3d08b7(0x22c)]=a37_0x3d08b7(0x22a);['description']=a37_0x3d08b7(0x226);async[a37_0x3d08b7(0x1f6)](_0x1d6501){const _0x59bbac=a37_0x3d08b7,{options:_0x2eddd3,args:_0x1586d2,tdx:_0x16302f}=_0x1d6501,_0x44736=_0x1586d2[0x0],_0x3f9785=!_0x44736&&!!_0x2eddd3['parentSegment'],_0x1609c3=_0x44736||_0x2eddd3[_0x59bbac(0x1c1)];if(!_0x1609c3)return console[_0x59bbac(0x230)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x59bbac(0x230)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x59bbac(0x230)]('Examples:'),console[_0x59bbac(0x230)](_0x59bbac(0x1fc)),console[_0x59bbac(0x230)](_0x59bbac(0x212)),console[_0x59bbac(0x230)](_0x59bbac(0x1b3)),console[_0x59bbac(0x230)](_0x59bbac(0x1bb)),0x1;try{const _0x4fdad6=_0x2eddd3[_0x59bbac(0x1d4)];let _0x15190d=_0x1609c3;!_0x3f9785&&_0x4fdad6&&!_0x1609c3[_0x59bbac(0x1ca)]('/')&&(_0x15190d=_0x4fdad6+'/'+_0x1609c3,_0x2eddd3[_0x59bbac(0x1f2)]&&console[_0x59bbac(0x230)](_0x59bbac(0x21a)+_0x15190d));const _0x2fd296=await withSpinner(_0x59bbac(0x1d0)+_0x15190d+_0x59bbac(0x247),()=>_0x16302f[_0x59bbac(0x1ee)][_0x59bbac(0x1e9)](_0x15190d),{'verbose':_0x2eddd3['verbose']}),_0x548659=_0x2fd296[_0x59bbac(0x1d2)];_0x2eddd3[_0x59bbac(0x1f2)]&&(console[_0x59bbac(0x230)](_0x59bbac(0x25e)+_0x548659[_0x59bbac(0x225)]),console[_0x59bbac(0x230)](_0x59bbac(0x23c)+_0x548659['parentId']),_0x548659[_0x59bbac(0x1e1)]&&console[_0x59bbac(0x230)](_0x59bbac(0x241)+_0x548659[_0x59bbac(0x1e1)]),_0x548659[_0x59bbac(0x217)]&&console[_0x59bbac(0x230)]('Segment\x20ID:\x20'+_0x548659['segmentId']));if(_0x548659[_0x59bbac(0x225)]===_0x59bbac(0x1b7)){const _0x458f00=await withSpinner(_0x59bbac(0x23e),()=>_0x16302f[_0x59bbac(0x1ee)][_0x59bbac(0x1cb)](_0x548659['parentId']),{'verbose':_0x2eddd3[_0x59bbac(0x1f2)]});await handleSingleObjectOutput(_0x458f00['data'],_0x2eddd3);}else{if(_0x548659[_0x59bbac(0x225)]===_0x59bbac(0x24c)){if(!_0x548659[_0x59bbac(0x1e1)])throw new SDKError(ErrorCode[_0x59bbac(0x21e)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x188679=await withSpinner('Fetching\x20folder\x20details...',()=>_0x16302f[_0x59bbac(0x1ee)][_0x59bbac(0x1b8)](_0x548659[_0x59bbac(0x1e1)]),{'verbose':_0x2eddd3[_0x59bbac(0x1f2)]});await handleSingleObjectOutput(_0x188679[_0x59bbac(0x1d2)],_0x2eddd3);}else{if(_0x548659[_0x59bbac(0x225)]===_0x59bbac(0x1ee)){if(!_0x548659['segmentId'])throw new SDKError(ErrorCode[_0x59bbac(0x255)],_0x59bbac(0x210));const _0x3c8c2e=await withSpinner(_0x59bbac(0x1f5),()=>_0x16302f['segment'][_0x59bbac(0x234)](_0x548659['parentId'],_0x548659['segmentId']),{'verbose':_0x2eddd3['verbose']});await handleSingleObjectOutput(_0x3c8c2e[_0x59bbac(0x1d2)],_0x2eddd3);}}}return 0x0;}catch(_0x26ff9d){if(_0x26ff9d instanceof SDKError)return console['error'](_0x59bbac(0x232)+_0x26ff9d[_0x59bbac(0x22f)]),_0x26ff9d[_0x59bbac(0x1e2)]&&console[_0x59bbac(0x230)](_0x59bbac(0x1f8)+_0x26ff9d[_0x59bbac(0x1e2)]),0x1;throw _0x26ff9d;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x3d08b7(0x22c)]='segment:show';[a37_0x3d08b7(0x23d)]=a37_0x3d08b7(0x22d);async[a37_0x3d08b7(0x1f6)](_0x5dd0d5){const _0x34a8ff=a37_0x3d08b7,{options:_0x13ed94,args:_0x5eba20,tdx:_0x4c9a75}=_0x5dd0d5,_0x339662=_0x5eba20[0x0];if(!_0x339662)return console[_0x34a8ff(0x230)](_0x34a8ff(0x1ea)),console[_0x34a8ff(0x230)](_0x34a8ff(0x258)),console['error'](_0x34a8ff(0x25a)),console[_0x34a8ff(0x230)](_0x34a8ff(0x238)),console[_0x34a8ff(0x230)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x34a8ff(0x230)](_0x34a8ff(0x222)),0x1;try{const _0x3ccbca=_0x13ed94[_0x34a8ff(0x1c1)],_0x44f317=await resolveSegmentTarget(_0x339662,_0x3ccbca,_0x13ed94['verbose']);_0x13ed94[_0x34a8ff(0x1f2)]&&console[_0x34a8ff(0x230)](_0x34a8ff(0x1ba)+_0x44f317);const _0x31fb94=await withSpinner(_0x34a8ff(0x1fd)+_0x339662+_0x34a8ff(0x247),()=>_0x4c9a75[_0x34a8ff(0x1ee)][_0x34a8ff(0x1e9)](_0x44f317),{'verbose':_0x13ed94['verbose']}),_0x35162a=_0x31fb94[_0x34a8ff(0x1d2)];_0x13ed94['verbose']&&(console[_0x34a8ff(0x230)]('Resolved\x20type:\x20'+_0x35162a[_0x34a8ff(0x225)]),console[_0x34a8ff(0x230)](_0x34a8ff(0x23c)+_0x35162a['parentId']));if(_0x35162a['type']===_0x34a8ff(0x24c))return console[_0x34a8ff(0x230)](_0x34a8ff(0x207)),console[_0x34a8ff(0x230)](_0x34a8ff(0x1e5)),0x1;if(_0x35162a[_0x34a8ff(0x225)]==='parent')return console['error'](_0x34a8ff(0x22e)),console[_0x34a8ff(0x230)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x35162a[_0x34a8ff(0x217)])throw new SDKError(ErrorCode[_0x34a8ff(0x255)],_0x34a8ff(0x210));const _0x19476a=await withSpinner(_0x34a8ff(0x20b),()=>_0x4c9a75['segment'][_0x34a8ff(0x1e7)](_0x35162a[_0x34a8ff(0x1d9)],_0x35162a[_0x34a8ff(0x217)]),{'verbose':_0x13ed94[_0x34a8ff(0x1f2)]});let _0x35466=_0x19476a['data'];const _0x1d2802=resolveLimit(_0x13ed94[_0x34a8ff(0x235)],DEFAULT_DISPLAY_LIMIT),_0x27478d=/\bLIMIT\s+\d+/i[_0x34a8ff(0x23a)](_0x35466);!_0x27478d&&(_0x35466=_0x35466[_0x34a8ff(0x1cd)]()[_0x34a8ff(0x1e8)](/;+$/,''),_0x35466=_0x34a8ff(0x200)+_0x35466+_0x34a8ff(0x1c4)+_0x1d2802);_0x13ed94[_0x34a8ff(0x1f2)]&&console[_0x34a8ff(0x230)]('SQL\x20query:\x0a'+_0x35466);const _0x77a5c3=await withProgressSpinner(_0x34a8ff(0x1dd),async _0x36856d=>{const _0x2883e0=_0x34a8ff,_0x4e6ebf=await _0x4c9a75[_0x2883e0(0x1c7)]['execute'](_0x35466,{'catalog':'td','schema':'information_schema','onJobId':_0x3bd369=>{const _0x502b0a=_0x2883e0;_0x36856d[_0x502b0a(0x221)](_0x3bd369);}});return _0x4e6ebf;},{'verbose':_0x13ed94[_0x34a8ff(0x1f2)]}),_0x418622=_0x77a5c3['data'],_0x2513f5=_0x418622[_0x34a8ff(0x231)]?_0x34a8ff(0x25d)+_0x418622[_0x34a8ff(0x231)]+']':'';return console['error'](_0x34a8ff(0x1ed)+_0x418622[_0x34a8ff(0x1c3)][_0x34a8ff(0x1da)][_0x34a8ff(0x1ff)]()+_0x34a8ff(0x1c0)+(_0x34a8ff(0x24d)+formatElapsed(_0x418622[_0x34a8ff(0x1c3)][_0x34a8ff(0x20c)])+_0x2513f5)),await handleQueryOutput(_0x418622,_0x13ed94),0x0;}catch(_0x334f7f){if(_0x334f7f instanceof SDKError)return console['error'](_0x34a8ff(0x24b)+_0x334f7f[_0x34a8ff(0x254)]+']'),console['error']('\x0a'+_0x334f7f[_0x34a8ff(0x22f)]),0x1;throw _0x334f7f;}}}export class SegmentFolderListCommand extends BaseCommand{['name']=a37_0x3d08b7(0x1c9);[a37_0x3d08b7(0x23d)]=a37_0x3d08b7(0x218);async[a37_0x3d08b7(0x1f6)](_0x4f7438){const _0x11f895=a37_0x3d08b7,{options:_0x1528d9,args:_0x4eaaf1,tdx:_0x31d60c}=_0x4f7438;if(_0x4eaaf1[_0x11f895(0x233)]===0x0)return console[_0x11f895(0x230)](_0x11f895(0x252)),console[_0x11f895(0x230)](_0x11f895(0x1e0)),0x1;const _0x1f2ff1=_0x4eaaf1[0x0];try{_0x1528d9[_0x11f895(0x1f2)]&&(console[_0x11f895(0x230)](_0x11f895(0x1fb)+_0x1528d9[_0x11f895(0x1c8)]),console['error'](_0x11f895(0x1f1)+_0x1f2ff1));const _0x4e49f8=await withSpinner(_0x11f895(0x202)+_0x1f2ff1+_0x11f895(0x247),()=>_0x31d60c[_0x11f895(0x1ee)][_0x11f895(0x228)](_0x1f2ff1),{'verbose':_0x1528d9[_0x11f895(0x1f2)]}),_0x4370e3=_0x4e49f8[_0x11f895(0x1d2)];_0x1528d9['verbose']&&console[_0x11f895(0x230)](_0x11f895(0x1ef)+_0x4370e3);const _0x221c17=await withSpinner(_0x11f895(0x244)+_0x1f2ff1+'\x27...',()=>_0x31d60c[_0x11f895(0x1ee)]['listFolders'](_0x4370e3),{'verbose':_0x1528d9['verbose']}),_0x49a31f=_0x221c17['data'];return console[_0x11f895(0x230)](_0x11f895(0x1b6)+_0x49a31f[_0x11f895(0x233)]+_0x11f895(0x216)+(_0x49a31f['length']!==0x1?'s':'')),await handleSDKOutput(_0x49a31f,_0x1528d9),0x0;}catch(_0x35931f){if(_0x35931f instanceof SDKError)return console['error'](_0x11f895(0x232)+_0x35931f[_0x11f895(0x22f)]),_0x35931f[_0x11f895(0x1e2)]&&console[_0x11f895(0x230)](_0x11f895(0x1f8)+_0x35931f[_0x11f895(0x1e2)]),0x1;throw _0x35931f;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x3d08b7(0x22c)]=a37_0x3d08b7(0x1d1);[a37_0x3d08b7(0x23d)]=a37_0x3d08b7(0x1cf);async[a37_0x3d08b7(0x1f6)](_0x1f170c){const _0xe644e1=a37_0x3d08b7,{options:_0x5862cf,args:_0x40dbc4,tdx:_0x5aab27}=_0x1f170c;if(_0x40dbc4['length']===0x0)return console[_0xe644e1(0x230)]('Error:\x20Folder\x20reference\x20is\x20required'),console['error'](_0xe644e1(0x214)),0x1;try{const {parentId:_0x3fbf61,childId:_0x49ec2d}=parseSegmentRef(_0x40dbc4[0x0]);_0x5862cf[_0xe644e1(0x1f2)]&&(console[_0xe644e1(0x230)](_0xe644e1(0x1fb)+_0x5862cf[_0xe644e1(0x1c8)]),console['error']('Parent\x20name:\x20'+_0x3fbf61),_0x49ec2d&&console[_0xe644e1(0x230)](_0xe644e1(0x1f7)+_0x49ec2d));if(!_0x49ec2d)return console['error'](_0xe644e1(0x205)),0x1;const _0xb3e9b5=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3fbf61+_0xe644e1(0x247),()=>_0x5aab27[_0xe644e1(0x1ee)][_0xe644e1(0x228)](_0x3fbf61),{'verbose':_0x5862cf['verbose']}),_0x2d67e2=_0xb3e9b5['data'];_0x5862cf['verbose']&&console[_0xe644e1(0x230)](_0xe644e1(0x1ef)+_0x2d67e2);const _0x2877ed=await withSpinner(_0xe644e1(0x1f4)+_0x49ec2d+'\x27...',()=>_0x5aab27[_0xe644e1(0x1ee)][_0xe644e1(0x24e)](_0x2d67e2,_0x49ec2d),{'verbose':_0x5862cf[_0xe644e1(0x1f2)]}),_0x1ae9f9=_0x2877ed[_0xe644e1(0x1d2)];_0x5862cf[_0xe644e1(0x1f2)]&&console[_0xe644e1(0x230)]('Resolved\x20folder\x20ID:\x20'+_0x1ae9f9);const _0x638320=await withSpinner(_0xe644e1(0x1ce)+_0x49ec2d+'\x27...',()=>_0x5aab27[_0xe644e1(0x1ee)][_0xe644e1(0x1b8)](_0x1ae9f9),{'verbose':_0x5862cf[_0xe644e1(0x1f2)]});return await handleSDKOutput([_0x638320['data']],_0x5862cf),0x0;}catch(_0x51d95d){if(_0x51d95d instanceof SDKError)return console[_0xe644e1(0x230)](_0xe644e1(0x232)+_0x51d95d[_0xe644e1(0x22f)]),_0x51d95d['cause']&&console[_0xe644e1(0x230)](_0xe644e1(0x1f8)+_0x51d95d[_0xe644e1(0x1e2)]),0x1;throw _0x51d95d;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x3d08b7(0x22c)]=a37_0x3d08b7(0x1d5);[a37_0x3d08b7(0x23d)]=a37_0x3d08b7(0x23f);async[a37_0x3d08b7(0x1f6)](_0x4d897d){const _0x5985ea=a37_0x3d08b7,{options:_0x39a45d,args:_0x38cb7d}=_0x4d897d,_0x33835c=_0x39a45d,_0x10663a=_0x33835c['path'],_0x490d9e=_0x38cb7d[0x0];if(!_0x490d9e&&!_0x10663a)return console[_0x5985ea(0x230)](a37_0x4e311e[_0x5985ea(0x1dc)]('Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required')),console[_0x5985ea(0x230)](_0x5985ea(0x1fe)),console[_0x5985ea(0x230)](_0x5985ea(0x259)),console['error'](_0x5985ea(0x243)),console['error'](_0x5985ea(0x238)),console[_0x5985ea(0x230)]('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x5985ea(0x230)](_0x5985ea(0x1bc)),0x1;if(_0x490d9e&&_0x10663a)return console[_0x5985ea(0x230)](a37_0x4e311e[_0x5985ea(0x1dc)](_0x5985ea(0x242))),0x1;try{let _0x279e4b;if(_0x10663a)_0x279e4b=await this['getSQLFromYamlFile'](_0x10663a,_0x4d897d);else{if(isYamlFilePath(_0x490d9e))return console['error'](a37_0x4e311e[_0x5985ea(0x1dc)](_0x5985ea(0x1fa))),console[_0x5985ea(0x230)](_0x5985ea(0x237)+_0x490d9e),0x1;else _0x279e4b=await this[_0x5985ea(0x1b2)](_0x490d9e,_0x4d897d);}return _0x39a45d[_0x5985ea(0x239)]==='json'||_0x39a45d[_0x5985ea(0x239)]===_0x5985ea(0x25c)?await handleSDKOutput([{'sql':_0x279e4b}],_0x39a45d):console[_0x5985ea(0x1b4)](_0x279e4b),0x0;}catch(_0x1dfccb){if(_0x1dfccb instanceof SDKError)return console[_0x5985ea(0x230)](_0x5985ea(0x232)+_0x1dfccb[_0x5985ea(0x22f)]),_0x1dfccb['cause']&&console['error'](_0x5985ea(0x1f8)+_0x1dfccb[_0x5985ea(0x1e2)]),0x1;throw _0x1dfccb;}}async[a37_0x3d08b7(0x1de)](_0xe67e60,_0x4bad38){const _0x3e42ef=a37_0x3d08b7,{options:_0x52c0cd,tdx:_0x1e4796}=_0x4bad38;let _0x31102e;try{_0x31102e=await resolveYamlFilePath(_0xe67e60);}catch(_0x1e4ff3){throw new SDKError(ErrorCode[_0x3e42ef(0x211)],_0x3e42ef(0x25b)+_0x1e4ff3[_0x3e42ef(0x22f)]);}_0x52c0cd[_0x3e42ef(0x1f2)]&&console[_0x3e42ef(0x230)](_0x3e42ef(0x1bd)+_0x31102e[_0x3e42ef(0x1c1)]+'/'+_0x31102e[_0x3e42ef(0x1db)]);const _0x4280c8=await withSpinner('Fetching\x20SQL\x20from\x20rule...',()=>_0x1e4796[_0x3e42ef(0x1ee)]['getSegmentSQLFromYaml'](_0x31102e[_0x3e42ef(0x249)],_0x31102e[_0x3e42ef(0x1c1)],_0x31102e[_0x3e42ef(0x1db)]),{'verbose':_0x52c0cd[_0x3e42ef(0x1f2)]});return _0x4280c8[_0x3e42ef(0x1d2)];}async[a37_0x3d08b7(0x1b2)](_0x5cc109,_0xaad7af){const _0x3731ec=a37_0x3d08b7,{options:_0x2a33d9,tdx:_0x1d2025}=_0xaad7af,_0x57a27e=_0x2a33d9[_0x3731ec(0x1c1)],_0x26bc56=await resolveSegmentTarget(_0x5cc109,_0x57a27e,_0x2a33d9[_0x3731ec(0x1f2)]);_0x2a33d9[_0x3731ec(0x1f2)]&&console['error'](_0x3731ec(0x1ba)+_0x26bc56);const _0x4892f7=await withSpinner(_0x3731ec(0x1fd)+_0x5cc109+_0x3731ec(0x247),()=>_0x1d2025['segment'][_0x3731ec(0x1e9)](_0x26bc56),{'verbose':_0x2a33d9[_0x3731ec(0x1f2)]}),_0x24d0d2=_0x4892f7[_0x3731ec(0x1d2)];_0x2a33d9[_0x3731ec(0x1f2)]&&(console[_0x3731ec(0x230)]('Resolved\x20type:\x20'+_0x24d0d2['type']),console[_0x3731ec(0x230)]('Parent\x20ID:\x20'+_0x24d0d2[_0x3731ec(0x1d9)]));if(_0x24d0d2[_0x3731ec(0x225)]===_0x3731ec(0x24c))throw new SDKError(ErrorCode[_0x3731ec(0x211)],'Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.');if(_0x24d0d2[_0x3731ec(0x225)]===_0x3731ec(0x1b7))throw new SDKError(ErrorCode[_0x3731ec(0x211)],_0x3731ec(0x1f0));if(!_0x24d0d2[_0x3731ec(0x217)])throw new SDKError(ErrorCode[_0x3731ec(0x255)],_0x3731ec(0x210));const _0x4d84e6=await withSpinner(_0x3731ec(0x20b),()=>_0x1d2025['segment'][_0x3731ec(0x1e7)](_0x24d0d2[_0x3731ec(0x1d9)],_0x24d0d2[_0x3731ec(0x217)]),{'verbose':_0x2a33d9['verbose']});return _0x4d84e6[_0x3731ec(0x1d2)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x3d08b7(0x22c)]='segment:folder:create';[a37_0x3d08b7(0x23d)]='Create\x20segment\x20folder\x20for\x20organization';async[a37_0x3d08b7(0x1f6)](_0x217a99){const _0x14295b=a37_0x3d08b7,{options:_0x3e792d,args:_0x358188,tdx:_0x1fd415}=_0x217a99,_0x33b540=_0x3e792d;if(_0x358188['length']<0x2)return console[_0x14295b(0x230)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console[_0x14295b(0x230)](_0x14295b(0x1be)),0x1;const _0xd6b81d=_0x358188[0x0],_0xab93ef=_0x358188[0x1];_0x33b540[_0x14295b(0x1f2)]&&(console['error']('Site:\x20'+_0x33b540['site']),console[_0x14295b(0x230)](_0x14295b(0x23b)+_0xd6b81d),console['error'](_0x14295b(0x1f7)+_0xab93ef));let _0x4b9c71;if(_0x33b540[_0x14295b(0x1e6)]){const _0x10f7b5=_0x33b540[_0x14295b(0x1e6)],_0x566f5b=await withSpinner(_0x14295b(0x202)+_0xd6b81d+_0x14295b(0x247),()=>_0x1fd415[_0x14295b(0x1ee)][_0x14295b(0x228)](_0xd6b81d),{'verbose':_0x33b540[_0x14295b(0x1f2)]}),_0x28f9df=_0x566f5b[_0x14295b(0x1d2)],_0x29fa83=await withSpinner(_0x14295b(0x220)+_0x10f7b5+'\x27...',()=>_0x1fd415[_0x14295b(0x1ee)][_0x14295b(0x24e)](_0x28f9df,_0x10f7b5),{'verbose':_0x33b540[_0x14295b(0x1f2)]});_0x4b9c71=_0x29fa83['data'],_0x33b540[_0x14295b(0x1f2)]&&console[_0x14295b(0x230)](_0x14295b(0x1eb)+_0x4b9c71);}const _0x3e0c4f={'name':_0xab93ef,'description':_0x33b540['description'],'parentFolderId':_0x4b9c71},_0x41c60b=await withSpinner(_0x14295b(0x250)+_0xab93ef+_0x14295b(0x247),()=>_0x1fd415[_0x14295b(0x1ee)]['createFolder'](_0xd6b81d,_0x3e0c4f),{'verbose':_0x33b540['verbose']}),_0x2f7ef5=_0x41c60b[_0x14295b(0x1d2)];return console[_0x14295b(0x230)](_0x14295b(0x20e)+_0x2f7ef5[_0x14295b(0x22c)]+_0x14295b(0x21d)+_0x2f7ef5['id']),await handleSDKOutput([_0x2f7ef5],_0x33b540),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x3d08b7(0x22c)]=a37_0x3d08b7(0x1d7);[a37_0x3d08b7(0x23d)]=a37_0x3d08b7(0x1b5);async[a37_0x3d08b7(0x1f6)](_0x5775be){const _0x4897b1=a37_0x3d08b7,{options:_0x3a10bf,args:_0x474be9,tdx:_0xd45989}=_0x5775be,_0x2e66fc=_0x474be9[0x0];if(!_0x2e66fc)return console['error'](_0x4897b1(0x251)),console[_0x4897b1(0x230)](_0x4897b1(0x1f3)),console[_0x4897b1(0x230)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console[_0x4897b1(0x230)](_0x4897b1(0x1d6)),console['error'](_0x4897b1(0x1f9)),console['error'](_0x4897b1(0x238)),console[_0x4897b1(0x230)](_0x4897b1(0x1b9)),console[_0x4897b1(0x230)](_0x4897b1(0x20a)),console[_0x4897b1(0x230)](_0x4897b1(0x236)),console[_0x4897b1(0x230)](_0x4897b1(0x1c5)),0x1;try{const _0x46128f=_0x3a10bf[_0x4897b1(0x1c1)],_0x452e4e=await resolveSegmentTarget(_0x2e66fc,_0x46128f,_0x3a10bf[_0x4897b1(0x1f2)]);_0x3a10bf[_0x4897b1(0x1f2)]&&console[_0x4897b1(0x230)](_0x4897b1(0x1ba)+_0x452e4e);const _0x48821c=await withSpinner(_0x4897b1(0x1fd)+_0x2e66fc+_0x4897b1(0x247),()=>_0xd45989['segment'][_0x4897b1(0x1e9)](_0x452e4e),{'verbose':_0x3a10bf[_0x4897b1(0x1f2)]}),_0x8b145a=_0x48821c[_0x4897b1(0x1d2)];_0x3a10bf[_0x4897b1(0x1f2)]&&(console['error'](_0x4897b1(0x25e)+_0x8b145a[_0x4897b1(0x225)]),console[_0x4897b1(0x230)](_0x4897b1(0x23c)+_0x8b145a[_0x4897b1(0x1d9)]),_0x8b145a[_0x4897b1(0x1e1)]&&console[_0x4897b1(0x230)](_0x4897b1(0x241)+_0x8b145a[_0x4897b1(0x1e1)]),_0x8b145a['segmentId']&&console[_0x4897b1(0x230)](_0x4897b1(0x20f)+_0x8b145a[_0x4897b1(0x217)]));if(_0x3a10bf[_0x4897b1(0x1df)]){if(_0x8b145a[_0x4897b1(0x225)]===_0x4897b1(0x24c))return console[_0x4897b1(0x230)](_0x4897b1(0x245)),0x1;if(_0x8b145a[_0x4897b1(0x225)]==='parent')return console['error'](_0x4897b1(0x219)),console[_0x4897b1(0x230)](_0x4897b1(0x224)),0x1;if(!_0x8b145a[_0x4897b1(0x217)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x4897b1(0x210));const _0x284344=getConsoleNextUrl(_0x3a10bf[_0x4897b1(0x1c8)],_0x4897b1(0x21c)+_0x8b145a['parentId']+'/e/'+_0x8b145a['segmentId']);return console[_0x4897b1(0x230)](a37_0x4e311e[_0x4897b1(0x229)]('✔')+_0x4897b1(0x1ec)+a37_0x4e311e['cyan'](_0x284344)),openBrowser(_0x284344),0x0;}if(_0x8b145a[_0x4897b1(0x225)]==='folder'){if(!_0x8b145a['folderId'])throw new SDKError(ErrorCode[_0x4897b1(0x21e)],_0x4897b1(0x215));const _0x1ccd1e=await withSpinner(_0x4897b1(0x246),()=>_0xd45989[_0x4897b1(0x1ee)][_0x4897b1(0x1b8)](_0x8b145a[_0x4897b1(0x1e1)]),{'verbose':_0x3a10bf[_0x4897b1(0x1f2)]});await handleSingleObjectOutput(_0x1ccd1e[_0x4897b1(0x1d2)],_0x3a10bf);}else{if(_0x8b145a['type']==='segment'){if(!_0x8b145a[_0x4897b1(0x217)])throw new SDKError(ErrorCode[_0x4897b1(0x255)],_0x4897b1(0x210));const _0x52216d=await withSpinner(_0x4897b1(0x1f5),()=>_0xd45989[_0x4897b1(0x1ee)][_0x4897b1(0x234)](_0x8b145a[_0x4897b1(0x1d9)],_0x8b145a[_0x4897b1(0x217)]),{'verbose':_0x3a10bf[_0x4897b1(0x1f2)]}),_0x1a1a64=getConsoleNextUrl(_0x3a10bf[_0x4897b1(0x1c8)],_0x4897b1(0x21c)+_0x8b145a[_0x4897b1(0x1d9)]+_0x4897b1(0x1e4)+_0x8b145a[_0x4897b1(0x217)]),_0x457bf1=_0x52216d[_0x4897b1(0x1d2)];_0x457bf1[_0x4897b1(0x21b)]=_0x1a1a64,await handleSingleObjectOutput(_0x457bf1,_0x3a10bf);}else return console[_0x4897b1(0x230)](_0x4897b1(0x201)),console[_0x4897b1(0x230)](_0x4897b1(0x206)),0x1;}return 0x0;}catch(_0x57d093){if(_0x57d093 instanceof SDKError)return console['error']('Error:\x20'+_0x57d093[_0x4897b1(0x22f)]),_0x57d093[_0x4897b1(0x1e2)]&&console['error'](_0x4897b1(0x1f8)+_0x57d093[_0x4897b1(0x1e2)]),0x1;throw _0x57d093;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x3d08b7(0x22c)]=a37_0x3d08b7(0x24a);[a37_0x3d08b7(0x23d)]=a37_0x3d08b7(0x1e3);async[a37_0x3d08b7(0x1f6)](_0x18b61b){const _0x213a35=a37_0x3d08b7,{options:_0x203b46,args:_0x365066,tdx:_0x1f5d1c}=_0x18b61b,_0x559ff6=_0x365066[0x0];if(!_0x559ff6)return console[_0x213a35(0x230)](_0x213a35(0x1ea)),console[_0x213a35(0x230)](_0x213a35(0x240)),console['error'](_0x213a35(0x20d)),console[_0x213a35(0x230)]('Examples:'),console[_0x213a35(0x230)](_0x213a35(0x213)),console[_0x213a35(0x230)](_0x213a35(0x257)),0x1;try{const _0x35e9b5=_0x203b46[_0x213a35(0x1c1)],_0x3b47ef=await resolveSegmentTarget(_0x559ff6,_0x35e9b5,_0x203b46['verbose']);_0x203b46[_0x213a35(0x1f2)]&&console['error']('Target\x20path:\x20'+_0x3b47ef);const _0x5aec9c=await withSpinner(_0x213a35(0x1fd)+_0x559ff6+_0x213a35(0x247),()=>_0x1f5d1c[_0x213a35(0x1ee)]['resolvePathToResource'](_0x3b47ef),{'verbose':_0x203b46[_0x213a35(0x1f2)]}),_0x3d6f90=_0x5aec9c[_0x213a35(0x1d2)];_0x203b46[_0x213a35(0x1f2)]&&(console[_0x213a35(0x230)](_0x213a35(0x25e)+_0x3d6f90[_0x213a35(0x225)]),console[_0x213a35(0x230)](_0x213a35(0x23c)+_0x3d6f90[_0x213a35(0x1d9)]));if(_0x3d6f90[_0x213a35(0x225)]===_0x213a35(0x24c))return console[_0x213a35(0x230)](_0x213a35(0x1d8)),console[_0x213a35(0x230)](_0x213a35(0x253)),0x1;if(_0x3d6f90[_0x213a35(0x225)]==='parent')return console['error'](_0x213a35(0x208)),console[_0x213a35(0x230)](_0x213a35(0x1c6)),0x1;if(!_0x3d6f90[_0x213a35(0x217)])throw new SDKError(ErrorCode[_0x213a35(0x255)],_0x213a35(0x210));const _0x213525=await withSpinner(_0x213a35(0x20b),()=>_0x1f5d1c[_0x213a35(0x1ee)]['getSegmentSQL'](_0x3d6f90[_0x213a35(0x1d9)],_0x3d6f90[_0x213a35(0x217)]),{'verbose':_0x203b46[_0x213a35(0x1f2)]}),_0x1fb22f=_0x213525[_0x213a35(0x1d2)],_0x3d6a08=await executeSchemaQuery(_0x1fb22f,_0x1f5d1c,_0x203b46);return await handleQueryOutput(_0x3d6a08,_0x203b46),0x0;}catch(_0x1ec9b5){if(_0x1ec9b5 instanceof SDKError)return console['error']('Error:\x20'+_0x1ec9b5['message']),_0x1ec9b5['cause']&&console[_0x213a35(0x230)](_0x213a35(0x1f8)+_0x1ec9b5[_0x213a35(0x1e2)]),0x1;throw _0x1ec9b5;}}}
@@ -1 +1 @@
1
- const a38_0x4a51c9=a38_0x1921;function a38_0x1921(_0x48f0b1,_0x121c3a){_0x48f0b1=_0x48f0b1-0x141;const _0x3a0c4e=a38_0x3a0c();let _0x1921a2=_0x3a0c4e[_0x48f0b1];return _0x1921a2;}(function(_0x2441db,_0x1836e5){const _0x262620=a38_0x1921,_0x122156=_0x2441db();while(!![]){try{const _0x2d257d=-parseInt(_0x262620(0x14b))/0x1*(-parseInt(_0x262620(0x14f))/0x2)+parseInt(_0x262620(0x173))/0x3+-parseInt(_0x262620(0x15b))/0x4+parseInt(_0x262620(0x149))/0x5*(parseInt(_0x262620(0x171))/0x6)+-parseInt(_0x262620(0x167))/0x7*(-parseInt(_0x262620(0x161))/0x8)+-parseInt(_0x262620(0x174))/0x9+parseInt(_0x262620(0x148))/0xa;if(_0x2d257d===_0x1836e5)break;else _0x122156['push'](_0x122156['shift']());}catch(_0x30fca7){_0x122156['push'](_0x122156['shift']());}}}(a38_0x3a0c,0x2bfd3));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a38_0x3a0c(){const _0x1b3c36=['6uogVZA','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','98742xilkea','1177164dDPBNC','error','Resolving\x20folder\x20\x27','Creating\x20segment\x20\x27','description','Parent\x20path:\x20','segments','Resolving\x20parent\x20segment\x20\x27','noCountPopulation','segment','3516150WjzBvI','332435DCZBUQ','resolveFolderId','1DKGXAJ','\x27...','ruleFile','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','119582PPazXE','kind','Target\x20path:\x20','execute','Resolving\x20folder\x20path\x20\x27','folder','name','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','parent','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','invisible','\x27\x20with\x20ID:\x20','1123960ziCYqQ','length','Resolved\x20folder\x20ID:\x20','site','verbose','includes','88scgnvT','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','segmentPath','Parent:\x20','folderId','type','51646zPtQnt','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','createSegment','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Examples:','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','data','yellow','Create\x20child\x20segment\x20with\x20filtering\x20rules'];a38_0x3a0c=function(){return _0x1b3c36;};return a38_0x3a0c();}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_0x4ee626 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x4a51c9(0x155)]='segment:create';[a38_0x4a51c9(0x142)]=a38_0x4a51c9(0x170);async[a38_0x4a51c9(0x152)](_0xdabf6c){const _0x155b57=a38_0x4a51c9;console[_0x155b57(0x175)](a38_0x4ee626[_0x155b57(0x16f)](_0x155b57(0x16d))),console[_0x155b57(0x175)](a38_0x4ee626[_0x155b57(0x16f)](_0x155b57(0x16b)));const {options:_0x12ce21,args:_0x485dd8,tdx:_0x1ea655}=_0xdabf6c,_0x3fe571=_0x12ce21;if(_0x485dd8['length']===0x0)return console[_0x155b57(0x175)](_0x155b57(0x162)),console[_0x155b57(0x175)](_0x155b57(0x169)),console[_0x155b57(0x175)](_0x155b57(0x16c)),console['error']('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console[_0x155b57(0x175)](_0x155b57(0x158)),console['error'](_0x155b57(0x168)),0x1;const _0x238ff0=_0x485dd8[0x0],_0x566f32=_0x12ce21[_0x155b57(0x163)];let _0x278422=_0x238ff0;_0x566f32&&!_0x238ff0[_0x155b57(0x160)]('/')&&(_0x278422=_0x566f32+'/'+_0x238ff0,_0x3fe571[_0x155b57(0x15f)]&&console[_0x155b57(0x175)]('Resolved\x20relative\x20path\x20to:\x20'+_0x278422));const _0x1ab035=parsePath(_0x278422);if(_0x1ab035[_0x155b57(0x144)][_0x155b57(0x15c)]<0x2)return console[_0x155b57(0x175)](_0x155b57(0x156)),console['error'](_0x155b57(0x14e)),0x1;const _0x24d245=_0x1ab035[_0x155b57(0x144)][0x0],_0x3f3135=getBaseName(_0x278422),_0x5ea523=getParentPath(_0x278422);_0x3fe571[_0x155b57(0x15f)]&&(console['error']('Site:\x20'+_0x3fe571[_0x155b57(0x15e)]),console[_0x155b57(0x175)](_0x155b57(0x151)+_0x278422),console[_0x155b57(0x175)](_0x155b57(0x164)+_0x24d245),console[_0x155b57(0x175)]('Segment\x20name:\x20'+_0x3f3135),console[_0x155b57(0x175)](_0x155b57(0x143)+_0x5ea523));const _0x28f0c2=await withSpinner(_0x155b57(0x145)+_0x24d245+'\x27...',()=>_0x1ea655[_0x155b57(0x147)]['resolveParentId'](_0x24d245),{'verbose':_0x3fe571[_0x155b57(0x15f)]}),_0x246860=_0x28f0c2[_0x155b57(0x16e)];let _0xc30f3b;if(_0x1ab035[_0x155b57(0x144)][_0x155b57(0x15c)]>0x2){const _0xc260cc=await withSpinner(_0x155b57(0x153)+_0x5ea523+'\x27...',()=>_0x1ea655[_0x155b57(0x147)]['resolvePathToResource'](_0x5ea523),{'verbose':_0x3fe571['verbose']}),_0x1f1dc6=_0xc260cc['data'];if(_0x1f1dc6['type']!==_0x155b57(0x154)&&_0x1f1dc6[_0x155b57(0x166)]!==_0x155b57(0x157))return console[_0x155b57(0x175)](_0x155b57(0x172)),0x1;_0xc30f3b=_0x1f1dc6[_0x155b57(0x165)];}else{if(_0x3fe571[_0x155b57(0x154)]){const _0x3cacb9=await withSpinner(_0x155b57(0x176)+_0x3fe571[_0x155b57(0x154)]+_0x155b57(0x14c),()=>_0x1ea655[_0x155b57(0x147)][_0x155b57(0x14a)](_0x246860,_0x3fe571[_0x155b57(0x154)]),{'verbose':_0x3fe571[_0x155b57(0x15f)]});_0xc30f3b=_0x3cacb9['data'];}}_0x3fe571[_0x155b57(0x15f)]&&_0xc30f3b&&console['error'](_0x155b57(0x15d)+_0xc30f3b);const _0x334a17=await loadJSONFromOptions(_0x3fe571['rule'],_0x3fe571[_0x155b57(0x14d)]),_0x375b53={'name':_0x3f3135,'description':_0x3fe571[_0x155b57(0x142)],'rule':_0x334a17,'kind':_0x3fe571[_0x155b57(0x150)]!==undefined?parseInt(_0x3fe571[_0x155b57(0x150)],0xa):undefined,'isVisible':_0x3fe571[_0x155b57(0x159)]?![]:undefined,'segmentFolderId':_0xc30f3b,'countPopulation':_0x3fe571[_0x155b57(0x146)]?![]:undefined},_0x4ad447=await withSpinner(_0x155b57(0x141)+_0x3f3135+_0x155b57(0x14c),()=>_0x1ea655[_0x155b57(0x147)][_0x155b57(0x16a)](_0x246860,_0x375b53),{'verbose':_0x3fe571[_0x155b57(0x15f)]}),_0x24943a=_0x4ad447[_0x155b57(0x16e)];return console[_0x155b57(0x175)]('✔\x20Created\x20segment\x20\x27'+_0x24943a[_0x155b57(0x155)]+_0x155b57(0x15a)+_0x24943a['id']),_0x278422!==_0x238ff0&&console[_0x155b57(0x175)]('\x20\x20\x20Path:\x20'+_0x278422),await handleSDKOutput([_0x24943a],_0x3fe571),0x0;}}
1
+ const a38_0x1d60e2=a38_0x57f2;(function(_0x298f91,_0x278b5d){const _0x162dbe=a38_0x57f2,_0x15f28d=_0x298f91();while(!![]){try{const _0x54526b=-parseInt(_0x162dbe(0x94))/0x1+-parseInt(_0x162dbe(0x95))/0x2+-parseInt(_0x162dbe(0x69))/0x3+parseInt(_0x162dbe(0x90))/0x4*(-parseInt(_0x162dbe(0x75))/0x5)+-parseInt(_0x162dbe(0x8a))/0x6+parseInt(_0x162dbe(0x82))/0x7+-parseInt(_0x162dbe(0x6e))/0x8*(-parseInt(_0x162dbe(0x96))/0x9);if(_0x54526b===_0x278b5d)break;else _0x15f28d['push'](_0x15f28d['shift']());}catch(_0x43f21b){_0x15f28d['push'](_0x15f28d['shift']());}}}(a38_0x6e70,0xa0dd3));import{BaseCommand}from'./command.js';function a38_0x57f2(_0x5e0f97,_0x55d4c6){_0x5e0f97=_0x5e0f97-0x65;const _0x6e7016=a38_0x6e70();let _0x57f266=_0x6e7016[_0x5e0f97];return _0x57f266;}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a38_0x6e70(){const _0x3fab99=['5337647CXYKYv','resolveParentId','Resolving\x20folder\x20\x27','\x27\x20with\x20ID:\x20','invisible','description','segmentPath','yellow','6735234sxstZJ','kind','\x27...','resolvePathToResource','Examples:','execute','1144DZEHJH','segment','length','ruleFile','770771IheATi','2558060rIbEQV','9qayYeH','createSegment','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','folderId','Resolving\x20parent\x20segment\x20\x27','Site:\x20','includes','3346695GeDZFx','Resolving\x20folder\x20path\x20\x27','verbose','✔\x20Created\x20segment\x20\x27','folder','35510584XKdlRi','Parent\x20path:\x20','segments','name','noCountPopulation','segment:create','Creating\x20segment\x20\x27','4450PTJaOB','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','error','Target\x20path:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','\x20\x20\x20Path:\x20','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','data','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','type','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'];a38_0x6e70=function(){return _0x3fab99;};return a38_0x6e70();}import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x1f2b25 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x1d60e2(0x71)]=a38_0x1d60e2(0x73);[a38_0x1d60e2(0x87)]='Create\x20child\x20segment\x20with\x20filtering\x20rules';async[a38_0x1d60e2(0x8f)](_0x235e22){const _0x3ae920=a38_0x1d60e2;console[_0x3ae920(0x77)](a38_0x1f2b25[_0x3ae920(0x89)]('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x3ae920(0x77)](a38_0x1f2b25[_0x3ae920(0x89)](_0x3ae920(0x7e)));const {options:_0x3e2bb1,args:_0x5e6978,tdx:_0xf88765}=_0x235e22,_0x3cf40d=_0x3e2bb1;if(_0x5e6978[_0x3ae920(0x92)]===0x0)return console['error'](_0x3ae920(0x7b)),console[_0x3ae920(0x77)](_0x3ae920(0x7c)),console[_0x3ae920(0x77)](_0x3ae920(0x8e)),console[_0x3ae920(0x77)](_0x3ae920(0x79)),console[_0x3ae920(0x77)](_0x3ae920(0x80)),console[_0x3ae920(0x77)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x2ffb4a=_0x5e6978[0x0],_0xc4907e=_0x3e2bb1[_0x3ae920(0x88)];let _0x3cfe3c=_0x2ffb4a;_0xc4907e&&!_0x2ffb4a[_0x3ae920(0x68)]('/')&&(_0x3cfe3c=_0xc4907e+'/'+_0x2ffb4a,_0x3cf40d[_0x3ae920(0x6b)]&&console['error']('Resolved\x20relative\x20path\x20to:\x20'+_0x3cfe3c));const _0x27b273=parsePath(_0x3cfe3c);if(_0x27b273[_0x3ae920(0x70)]['length']<0x2)return console['error'](_0x3ae920(0x81)),console['error'](_0x3ae920(0x98)),0x1;const _0x20e685=_0x27b273[_0x3ae920(0x70)][0x0],_0x516eab=getBaseName(_0x3cfe3c),_0x5ce9c9=getParentPath(_0x3cfe3c);_0x3cf40d['verbose']&&(console['error'](_0x3ae920(0x67)+_0x3cf40d['site']),console[_0x3ae920(0x77)](_0x3ae920(0x78)+_0x3cfe3c),console['error']('Parent:\x20'+_0x20e685),console[_0x3ae920(0x77)]('Segment\x20name:\x20'+_0x516eab),console[_0x3ae920(0x77)](_0x3ae920(0x6f)+_0x5ce9c9));const _0x5cc61a=await withSpinner(_0x3ae920(0x66)+_0x20e685+_0x3ae920(0x8c),()=>_0xf88765[_0x3ae920(0x91)][_0x3ae920(0x83)](_0x20e685),{'verbose':_0x3cf40d[_0x3ae920(0x6b)]}),_0x7b4bc5=_0x5cc61a[_0x3ae920(0x7d)];let _0x27d7bd;if(_0x27b273[_0x3ae920(0x70)]['length']>0x2){const _0x5cff31=await withSpinner(_0x3ae920(0x6a)+_0x5ce9c9+_0x3ae920(0x8c),()=>_0xf88765['segment'][_0x3ae920(0x8d)](_0x5ce9c9),{'verbose':_0x3cf40d['verbose']}),_0x46c152=_0x5cff31[_0x3ae920(0x7d)];if(_0x46c152[_0x3ae920(0x7f)]!=='folder'&&_0x46c152[_0x3ae920(0x7f)]!=='parent')return console[_0x3ae920(0x77)](_0x3ae920(0x76)),0x1;_0x27d7bd=_0x46c152[_0x3ae920(0x65)];}else{if(_0x3cf40d[_0x3ae920(0x6d)]){const _0x4dfc6f=await withSpinner(_0x3ae920(0x84)+_0x3cf40d['folder']+'\x27...',()=>_0xf88765[_0x3ae920(0x91)]['resolveFolderId'](_0x7b4bc5,_0x3cf40d['folder']),{'verbose':_0x3cf40d[_0x3ae920(0x6b)]});_0x27d7bd=_0x4dfc6f[_0x3ae920(0x7d)];}}_0x3cf40d[_0x3ae920(0x6b)]&&_0x27d7bd&&console[_0x3ae920(0x77)]('Resolved\x20folder\x20ID:\x20'+_0x27d7bd);const _0x48b280=await loadJSONFromOptions(_0x3cf40d['rule'],_0x3cf40d[_0x3ae920(0x93)]),_0x1dfb9a={'name':_0x516eab,'description':_0x3cf40d[_0x3ae920(0x87)],'rule':_0x48b280,'kind':_0x3cf40d[_0x3ae920(0x8b)]!==undefined?parseInt(_0x3cf40d[_0x3ae920(0x8b)],0xa):undefined,'isVisible':_0x3cf40d[_0x3ae920(0x86)]?![]:undefined,'segmentFolderId':_0x27d7bd,'countPopulation':_0x3cf40d[_0x3ae920(0x72)]?![]:undefined},_0x4f3a2e=await withSpinner(_0x3ae920(0x74)+_0x516eab+_0x3ae920(0x8c),()=>_0xf88765[_0x3ae920(0x91)][_0x3ae920(0x97)](_0x7b4bc5,_0x1dfb9a),{'verbose':_0x3cf40d[_0x3ae920(0x6b)]}),_0x4e9a0e=_0x4f3a2e[_0x3ae920(0x7d)];return console[_0x3ae920(0x77)](_0x3ae920(0x6c)+_0x4e9a0e[_0x3ae920(0x71)]+_0x3ae920(0x85)+_0x4e9a0e['id']),_0x3cfe3c!==_0x2ffb4a&&console['error'](_0x3ae920(0x7a)+_0x3cfe3c),await handleSDKOutput([_0x4e9a0e],_0x3cf40d),0x0;}}
@@ -1 +1 @@
1
- const a39_0x369261=a39_0x395b;(function(_0x37f198,_0x4515b0){const _0x1c8a61=a39_0x395b,_0x2bc3f1=_0x37f198();while(!![]){try{const _0x266167=-parseInt(_0x1c8a61(0x6d))/0x1+parseInt(_0x1c8a61(0x7b))/0x2*(-parseInt(_0x1c8a61(0x6a))/0x3)+-parseInt(_0x1c8a61(0x78))/0x4*(parseInt(_0x1c8a61(0x6e))/0x5)+parseInt(_0x1c8a61(0x79))/0x6+parseInt(_0x1c8a61(0x71))/0x7+parseInt(_0x1c8a61(0x84))/0x8+-parseInt(_0x1c8a61(0x7e))/0x9*(-parseInt(_0x1c8a61(0x80))/0xa);if(_0x266167===_0x4515b0)break;else _0x2bc3f1['push'](_0x2bc3f1['shift']());}catch(_0x3e8b9e){_0x2bc3f1['push'](_0x2bc3f1['shift']());}}}(a39_0x5640,0x51016));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a39_0x395b(_0x48e2ff,_0x489dea){_0x48e2ff=_0x48e2ff-0x6a;const _0x564092=a39_0x5640();let _0x395b8d=_0x564092[_0x48e2ff];return _0x395b8d;}import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a39_0x369261(0x75)]=a39_0x369261(0x7c);['description']='List\x20available\x20fields\x20for\x20segmentation';async['execute'](_0x38ced6){const _0x130812=a39_0x369261,{options:_0x52942f,args:_0x4d909e,tdx:_0x1c0a65}=_0x38ced6,_0x5360f7=_0x4d909e[0x0]||_0x52942f[_0x130812(0x7f)];if(!_0x5360f7)return console[_0x130812(0x76)](_0x130812(0x82)),console[_0x130812(0x76)](_0x130812(0x81)),console[_0x130812(0x76)](_0x130812(0x70)),0x1;_0x52942f[_0x130812(0x83)]&&(console['error']('Site:\x20'+_0x52942f['site']),console[_0x130812(0x76)]('Parent\x20segment:\x20'+_0x5360f7));const _0x2b7c2c=await withSpinner(_0x130812(0x73)+_0x5360f7+'\x27...',()=>_0x1c0a65[_0x130812(0x77)][_0x130812(0x72)](_0x5360f7),{'verbose':_0x52942f[_0x130812(0x83)]}),_0x15dce5=_0x2b7c2c[_0x130812(0x6c)];console[_0x130812(0x76)](_0x130812(0x74)+_0x15dce5['length']+_0x130812(0x7d)+(_0x15dce5[_0x130812(0x6f)]!==0x1?'s':''));if(_0x52942f[_0x130812(0x6b)]||_0x52942f[_0x130812(0x7a)])return await handleSDKOutput(_0x15dce5,_0x52942f),0x0;return displayFieldsHumanReadable(_0x15dce5,_0x5360f7),0x0;}}function a39_0x5640(){const _0x158a15=['2044712SHslfx','3AETjQG','json','data','613326cFfJQz','5WpstGv','length','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','1296932vgMMwP','listFields','Listing\x20fields\x20for\x20\x27','✔\x20Found\x20','name','error','segment','1489188DWhhGK','705858BUwBlU','jsonl','96998cvMyHi','segment:fields','\x20field','2556iKjWFK','parentSegment','28430wWOhEK','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','Error:\x20Parent\x20segment\x20name\x20is\x20required','verbose'];a39_0x5640=function(){return _0x158a15;};return a39_0x5640();}
1
+ const a39_0x23bc44=a39_0x3777;(function(_0x35ff3c,_0x923cc0){const _0x1c8e61=a39_0x3777,_0x21e9c8=_0x35ff3c();while(!![]){try{const _0x4da851=parseInt(_0x1c8e61(0x1b1))/0x1+-parseInt(_0x1c8e61(0x1b3))/0x2+parseInt(_0x1c8e61(0x1b8))/0x3+parseInt(_0x1c8e61(0x1ac))/0x4+parseInt(_0x1c8e61(0x1b2))/0x5*(-parseInt(_0x1c8e61(0x1ba))/0x6)+parseInt(_0x1c8e61(0x1b9))/0x7+-parseInt(_0x1c8e61(0x1c1))/0x8;if(_0x4da851===_0x923cc0)break;else _0x21e9c8['push'](_0x21e9c8['shift']());}catch(_0x2bdbcd){_0x21e9c8['push'](_0x21e9c8['shift']());}}}(a39_0x625e,0x35440));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a39_0x3777(_0x4b16bd,_0x5aa20c){_0x4b16bd=_0x4b16bd-0x1ac;const _0x625ede=a39_0x625e();let _0x37774b=_0x625ede[_0x4b16bd];return _0x37774b;}function a39_0x625e(){const _0x2834e3=['verbose','length','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','Site:\x20','549696BsdawO','644175GPsJlI','3318CjWnnh','site','error','listFields','name','✔\x20Found\x20','List\x20available\x20fields\x20for\x20segmentation','3887208OezIrj','jsonl','segment','674460TXOtFd','description','\x20field','data','Listing\x20fields\x20for\x20\x27','292462IbjGRT','165TeIljn','28016dvLzQt'];a39_0x625e=function(){return _0x2834e3;};return a39_0x625e();}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a39_0x23bc44(0x1be)]='segment:fields';[a39_0x23bc44(0x1ad)]=a39_0x23bc44(0x1c0);async['execute'](_0x427bdd){const _0x31ccd9=a39_0x23bc44,{options:_0x3f63cf,args:_0x2509ad,tdx:_0x4ac4c4}=_0x427bdd,_0x576c63=_0x2509ad[0x0]||_0x3f63cf['parentSegment'];if(!_0x576c63)return console[_0x31ccd9(0x1bc)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console['error'](_0x31ccd9(0x1b6)),console['error']('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;_0x3f63cf[_0x31ccd9(0x1b4)]&&(console[_0x31ccd9(0x1bc)](_0x31ccd9(0x1b7)+_0x3f63cf[_0x31ccd9(0x1bb)]),console['error']('Parent\x20segment:\x20'+_0x576c63));const _0xc84cb6=await withSpinner(_0x31ccd9(0x1b0)+_0x576c63+'\x27...',()=>_0x4ac4c4[_0x31ccd9(0x1c3)][_0x31ccd9(0x1bd)](_0x576c63),{'verbose':_0x3f63cf[_0x31ccd9(0x1b4)]}),_0x61baf7=_0xc84cb6[_0x31ccd9(0x1af)];console[_0x31ccd9(0x1bc)](_0x31ccd9(0x1bf)+_0x61baf7[_0x31ccd9(0x1b5)]+_0x31ccd9(0x1ae)+(_0x61baf7[_0x31ccd9(0x1b5)]!==0x1?'s':''));if(_0x3f63cf['json']||_0x3f63cf[_0x31ccd9(0x1c2)])return await handleSDKOutput(_0x61baf7,_0x3f63cf),0x0;return displayFieldsHumanReadable(_0x61baf7,_0x576c63),0x0;}}