@treasuredata/tdx 2026.3.35 → 2026.3.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/auth-login-command.js +1 -1
  11. package/dist/commands/cas-command.js +1 -1
  12. package/dist/commands/cas-segment-command.js +1 -1
  13. package/dist/commands/chat-command.js +1 -1
  14. package/dist/commands/claude-command.js +1 -1
  15. package/dist/commands/claude-statusline-command.js +1 -1
  16. package/dist/commands/claude-usage-command.js +1 -1
  17. package/dist/commands/command.js +1 -1
  18. package/dist/commands/connection-command.js +1 -1
  19. package/dist/commands/databases.js +1 -1
  20. package/dist/commands/delivery-command.js +1 -1
  21. package/dist/commands/describe.js +1 -1
  22. package/dist/commands/engage-campaign-pull-command.js +1 -1
  23. package/dist/commands/engage-campaign-push-command.js +1 -1
  24. package/dist/commands/engage-campaign-validate-command.js +1 -1
  25. package/dist/commands/engage-command.js +1 -1
  26. package/dist/commands/engage-template-pull-command.js +1 -1
  27. package/dist/commands/engage-template-push-command.js +1 -1
  28. package/dist/commands/engage-template-validate-command.js +1 -1
  29. package/dist/commands/job-command.js +1 -1
  30. package/dist/commands/journey-command.js +1 -1
  31. package/dist/commands/journey-validate-command.js +1 -1
  32. package/dist/commands/llm-command.js +1 -1
  33. package/dist/commands/mcp-command.js +1 -1
  34. package/dist/commands/parent-segment-command.js +1 -1
  35. package/dist/commands/policy-command.js +1 -1
  36. package/dist/commands/profile-command.js +1 -1
  37. package/dist/commands/profiles-command.js +1 -1
  38. package/dist/commands/query-command.js +1 -1
  39. package/dist/commands/schedule-command.js +1 -1
  40. package/dist/commands/segment-command.js +1 -1
  41. package/dist/commands/segment-create-command.js +1 -1
  42. package/dist/commands/segment-fields-command.js +1 -1
  43. package/dist/commands/segment-pull-command.js +1 -1
  44. package/dist/commands/segment-push-command.js +1 -1
  45. package/dist/commands/segment-update-command.js +1 -1
  46. package/dist/commands/segment-use-command.js +1 -1
  47. package/dist/commands/segment-validate-command.js +1 -1
  48. package/dist/commands/segments.js +1 -1
  49. package/dist/commands/show.js +1 -1
  50. package/dist/commands/status-command.js +1 -1
  51. package/dist/commands/tables.js +1 -1
  52. package/dist/commands/unset-command.js +1 -1
  53. package/dist/commands/upgrade-command.js +1 -1
  54. package/dist/commands/use-command.js +1 -1
  55. package/dist/commands/user-command.js +1 -1
  56. package/dist/commands/work-command.js +1 -1
  57. package/dist/commands/workflow-command.js +1 -1
  58. package/dist/core/auth.js +1 -1
  59. package/dist/core/command-output.js +1 -1
  60. package/dist/core/config.js +1 -1
  61. package/dist/core/connection-cache.js +1 -1
  62. package/dist/core/constants.js +1 -1
  63. package/dist/core/credential-cache.js +1 -1
  64. package/dist/core/global-context.js +1 -1
  65. package/dist/core/keychain.js +1 -1
  66. package/dist/core/oauth-keychain.js +1 -1
  67. package/dist/core/oauth.js +1 -1
  68. package/dist/core/profile.js +1 -1
  69. package/dist/core/project-config.js +1 -1
  70. package/dist/core/session.js +1 -1
  71. package/dist/core/user-cache.js +1 -1
  72. package/dist/core/version.js +1 -1
  73. package/dist/index.js +1 -1
  74. package/dist/mcp/server.js +1 -1
  75. package/dist/mcp/tools/index.js +1 -1
  76. package/dist/mcp/tools/tdx-run.js +1 -1
  77. package/dist/mcp/tools/tdx-search.js +1 -1
  78. package/dist/mcp/utils.js +1 -1
  79. package/dist/proxy/claude-usage-tracker.js +1 -1
  80. package/dist/proxy/passthrough-server.js +1 -1
  81. package/dist/proxy/sse-usage-parser.js +1 -1
  82. package/dist/sdk/agent/agent-config.js +1 -1
  83. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  84. package/dist/sdk/agent/agent-yaml.js +1 -1
  85. package/dist/sdk/agent/test/evaluator.js +1 -1
  86. package/dist/sdk/agent/test/executor.js +1 -1
  87. package/dist/sdk/agent/test/index.js +1 -1
  88. package/dist/sdk/agent/test/output.js +1 -1
  89. package/dist/sdk/agent/test/parser.js +1 -1
  90. package/dist/sdk/agent/tool-target-registry.js +1 -1
  91. package/dist/sdk/api.js +1 -1
  92. package/dist/sdk/cas/cas-api-client.js +1 -1
  93. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  94. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  95. package/dist/sdk/cas/index.js +1 -1
  96. package/dist/sdk/cas/pull-workflow.js +1 -1
  97. package/dist/sdk/cas/push-workflow.js +1 -1
  98. package/dist/sdk/client/cdp-api-client.js +1 -1
  99. package/dist/sdk/client/delivery-api-client.js +1 -1
  100. package/dist/sdk/client/endpoints.js +1 -1
  101. package/dist/sdk/client/engage-api-client.js +1 -1
  102. package/dist/sdk/client/http-client.js +1 -1
  103. package/dist/sdk/client/llm-api-client.js +1 -1
  104. package/dist/sdk/client/oauth-refresh.js +1 -1
  105. package/dist/sdk/client/rate-limiter.js +1 -1
  106. package/dist/sdk/client/td-api-client.js +1 -1
  107. package/dist/sdk/client/trino-api-client.js +1 -1
  108. package/dist/sdk/client/workflow-client.js +1 -1
  109. package/dist/sdk/connection-validator.js +1 -1
  110. package/dist/sdk/connection.js +1 -1
  111. package/dist/sdk/delivery.js +1 -1
  112. package/dist/sdk/engage/campaign-pull.js +1 -1
  113. package/dist/sdk/engage/campaign-push.js +1 -1
  114. package/dist/sdk/engage/campaign-validator.js +1 -1
  115. package/dist/sdk/engage/campaign-yaml.js +1 -1
  116. package/dist/sdk/engage/template-pull.js +1 -1
  117. package/dist/sdk/engage/template-push.js +1 -1
  118. package/dist/sdk/engage/template-validator.js +1 -1
  119. package/dist/sdk/engage/template-yaml.js +1 -1
  120. package/dist/sdk/engage/types/campaign-def.js +1 -1
  121. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  122. package/dist/sdk/engage/types/template-schema.js +1 -1
  123. package/dist/sdk/engage.js +1 -1
  124. package/dist/sdk/errors.js +1 -1
  125. package/dist/sdk/index.js +1 -1
  126. package/dist/sdk/io/index.js +1 -1
  127. package/dist/sdk/io/node-filesystem.js +1 -1
  128. package/dist/sdk/job.js +1 -1
  129. package/dist/sdk/journey.js +1 -1
  130. package/dist/sdk/llm/chat-cache.js +1 -1
  131. package/dist/sdk/llm/index.js +1 -1
  132. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  133. package/dist/sdk/llm/model-factors.js +1 -1
  134. package/dist/sdk/personalization.js +1 -1
  135. package/dist/sdk/policy.js +1 -1
  136. package/dist/sdk/query/index.js +1 -1
  137. package/dist/sdk/query/sql-parser.js +1 -1
  138. package/dist/sdk/realtime.js +1 -1
  139. package/dist/sdk/schedule.js +1 -1
  140. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  141. package/dist/sdk/segment/fields-display.js +1 -1
  142. package/dist/sdk/segment/file-discovery.js +1 -1
  143. package/dist/sdk/segment/journey-utils.js +1 -1
  144. package/dist/sdk/segment/journey-validator.js +1 -1
  145. package/dist/sdk/segment/journey-yaml.js +1 -1
  146. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  147. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  148. package/dist/sdk/segment/pull-workflow.js +1 -1
  149. package/dist/sdk/segment/push-recovery.js +1 -1
  150. package/dist/sdk/segment/push-workflow.js +1 -1
  151. package/dist/sdk/segment/resolution-context.js +1 -1
  152. package/dist/sdk/segment/segment-path-parser.js +1 -1
  153. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  154. package/dist/sdk/segment/segment-validator.js +1 -1
  155. package/dist/sdk/segment/target-resolution.js +1 -1
  156. package/dist/sdk/segment/tdx-config.js +1 -1
  157. package/dist/sdk/segment/types/activation-schema.js +1 -1
  158. package/dist/sdk/segment/types/journey-def.js +1 -1
  159. package/dist/sdk/segment/types/journey-schema.js +1 -1
  160. package/dist/sdk/segment/types/segment-def.js +1 -1
  161. package/dist/sdk/segment/types/segment-schema.js +1 -1
  162. package/dist/sdk/segment/validate-files.js +1 -1
  163. package/dist/sdk/segment/yaml-validator.js +1 -1
  164. package/dist/sdk/segment.js +1 -1
  165. package/dist/sdk/types/index.js +1 -1
  166. package/dist/sdk/types/progress.js +1 -1
  167. package/dist/sdk/types/workspace.js +1 -1
  168. package/dist/sdk/user.js +1 -1
  169. package/dist/sdk/util/format-detector.js +1 -1
  170. package/dist/sdk/util/formatters.js +1 -1
  171. package/dist/sdk/util/index.js +1 -1
  172. package/dist/sdk/util/paginate.js +1 -1
  173. package/dist/sdk/util/tree-formatter.js +1 -1
  174. package/dist/sdk/workflow/archive-validation.js +1 -1
  175. package/dist/sdk/workflow/clone-workflow.js +1 -1
  176. package/dist/sdk/workflow/index.js +1 -1
  177. package/dist/sdk/workflow/pull-workflow.js +1 -1
  178. package/dist/sdk/workflow/push-workflow.js +1 -1
  179. package/dist/sdk/workflow/tdx-config.js +1 -1
  180. package/dist/sdk/workflow/workflow-utils.js +1 -1
  181. package/dist/sdk/workspace/frontmatter.js +1 -1
  182. package/dist/sdk/workspace/git.js +1 -1
  183. package/dist/sdk/workspace/index.js +1 -1
  184. package/dist/sdk/workspace/templates.js +1 -1
  185. package/dist/sdk/workspace/weekly.js +1 -1
  186. package/dist/sdk/workspace/wikilinks.js +1 -1
  187. package/dist/test-utils/command-runner.js +1 -1
  188. package/dist/test-utils/factories.js +1 -1
  189. package/dist/test-utils/fixtures.js +1 -1
  190. package/dist/test-utils/http-mock.js +1 -1
  191. package/dist/test-utils/index.js +1 -1
  192. package/dist/utils/async.js +1 -1
  193. package/dist/utils/colors.js +1 -1
  194. package/dist/utils/diff.js +1 -1
  195. package/dist/utils/file-permissions.js +1 -1
  196. package/dist/utils/file-reader.js +1 -1
  197. package/dist/utils/github-releases.js +1 -1
  198. package/dist/utils/global-cache.js +1 -1
  199. package/dist/utils/json-loader.js +1 -1
  200. package/dist/utils/local-cache.js +1 -1
  201. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  202. package/dist/utils/logger/formatters/index.js +1 -1
  203. package/dist/utils/logger/handlers/console-handler.js +1 -1
  204. package/dist/utils/logger/handlers/file-handler.js +1 -1
  205. package/dist/utils/logger/handlers/index.js +1 -1
  206. package/dist/utils/logger/handlers/null-handler.js +1 -1
  207. package/dist/utils/logger/index.js +1 -1
  208. package/dist/utils/logger/logger.js +1 -1
  209. package/dist/utils/logger/types.js +1 -1
  210. package/dist/utils/option-validation.js +1 -1
  211. package/dist/utils/process.js +1 -1
  212. package/dist/utils/prompt.js +1 -1
  213. package/dist/utils/spinner.js +1 -1
  214. package/dist/utils/sse-parser.js +1 -1
  215. package/dist/utils/string-utils.js +1 -1
  216. package/dist/utils/table-ref-parser.js +1 -1
  217. package/dist/utils/tdx-logger.js +1 -1
  218. package/dist/utils/version-check.js +1 -1
  219. package/package.json +1 -1
@@ -1 +1 @@
1
- const a33_0x29d97f=a33_0x3ce1;(function(_0x2b0fe8,_0x46ee96){const _0x39c40c=a33_0x3ce1,_0x33ac4f=_0x2b0fe8();while(!![]){try{const _0x4d634d=parseInt(_0x39c40c(0x8d))/0x1+-parseInt(_0x39c40c(0x95))/0x2+-parseInt(_0x39c40c(0xc2))/0x3+-parseInt(_0x39c40c(0x90))/0x4*(parseInt(_0x39c40c(0xad))/0x5)+parseInt(_0x39c40c(0x97))/0x6*(parseInt(_0x39c40c(0xb3))/0x7)+-parseInt(_0x39c40c(0xb4))/0x8*(parseInt(_0x39c40c(0xc0))/0x9)+parseInt(_0x39c40c(0xb2))/0xa;if(_0x4d634d===_0x46ee96)break;else _0x33ac4f['push'](_0x33ac4f['shift']());}catch(_0x4b2bb8){_0x33ac4f['push'](_0x33ac4f['shift']());}}}(a33_0x2a5b,0xe49c7));function a33_0x2a5b(){const _0x1cfbd1=['account_id','dim','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','email','27603bIjBSa','\x20\x20\x20','828906lpILkT','log','length',',\x20user_id:','verbose','join','policies','\x20—\x20','bold','\x20polic','policy\x20list','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','221014WitKYm','description','✔\x20Found\x20','24nTaJYA','getPolicyPermissions','administrator','args','No\x20policies\x20found','3060882OhmvNc','\x20\x20No\x20policies\x20assigned','11676CTlPVm','getCurrent','padEnd','data','operation','Account\x20Owner','name','policy','validate','ies','🔑\x20Effective\x20Permissions','Fetching\x20policy...','account_owner','\x20user','getPolicyUsers','📋\x20Assigned\x20Policies','Listing\x20policies...','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','all','Administrator','map','\x20\x20•\x20','1325965OQTocD','policy\x20show','execute','(ID:\x20','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','43310980ZugLrg','77dZvcrH','624FzTyqM','\x20assigned','user','entries','permissions','\x20\x20No\x20permissions','max','listPolicies'];a33_0x2a5b=function(){return _0x1cfbd1;};return a33_0x2a5b();}import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a33_0x342d9d from'chalk';function a33_0x3ce1(_0x2af1d6,_0x1272da){_0x2af1d6=_0x2af1d6-0x8a;const _0x2a5b7b=a33_0x2a5b();let _0x3ce1ea=_0x2a5b7b[_0x2af1d6];return _0x3ce1ea;}export class PolicyCommand extends BaseCommand{['name']=a33_0x29d97f(0x9e);[a33_0x29d97f(0x8e)]=a33_0x29d97f(0x8c);async[a33_0x29d97f(0xaf)](_0x4eae7d){const _0x47e655=a33_0x29d97f,{options:_0x51dfed,tdx:_0x50781e}=_0x4eae7d,_0x1eff62=await withSpinner('Fetching\x20permissions...',async()=>{const _0x500482=a33_0x3ce1,[_0x1104e0,_0x5af7d6]=await Promise[_0x500482(0xa9)]([_0x50781e[_0x500482(0xb6)][_0x500482(0x98)](),_0x50781e[_0x500482(0x9e)]['getMyPermissions']()]);return{'userInfo':_0x1104e0,'permissions':_0x5af7d6};},{'verbose':_0x51dfed['verbose']}),{userInfo:_0x3e0f16,permissions:_0x2ee024}=_0x1eff62['data'];if(isStructuredFormat(_0x51dfed))return await handleSingleObjectOutput(_0x2ee024,_0x51dfed),0x0;const _0x5db527=_0x3e0f16[_0x47e655(0xa3)]?_0x47e655(0x9c):_0x3e0f16[_0x47e655(0x92)]?_0x47e655(0xaa):'Member';console['log']('\x0a'+a33_0x342d9d['bold']('👤')+'\x20'+a33_0x342d9d[_0x47e655(0xca)](_0x3e0f16[_0x47e655(0x9d)])+'\x20'+a33_0x342d9d['dim']('('+_0x3e0f16[_0x47e655(0xbf)]+')')+'\x20—\x20'+_0x5db527),console[_0x47e655(0xc3)](a33_0x342d9d[_0x47e655(0xbd)]('\x20\x20\x20'+_0x50781e['context']['site']+':'+_0x3e0f16[_0x47e655(0xbc)]+_0x47e655(0xc5)+_0x3e0f16['id']));const _0x50cffa=_0x2ee024[_0x47e655(0xc8)];console[_0x47e655(0xc3)]('\x0a'+a33_0x342d9d[_0x47e655(0xca)](_0x47e655(0xa6))+'\x20('+_0x50cffa[_0x47e655(0xc4)]+'):');if(_0x50cffa['length']===0x0)console['log'](a33_0x342d9d[_0x47e655(0xbd)](_0x47e655(0x96)));else for(const _0x263bd5 of _0x50cffa){console[_0x47e655(0xc3)](_0x47e655(0xac)+_0x263bd5[_0x47e655(0x9d)]);}return printPermissionsMap(_0x2ee024[_0x47e655(0xb8)]),console[_0x47e655(0xc3)](),0x0;}}export class PolicyListCommand extends BaseCommand{['name']=a33_0x29d97f(0x8b);[a33_0x29d97f(0x8e)]=a33_0x29d97f(0xb1);async['execute'](_0x2822fb){const _0x19723c=a33_0x29d97f,{options:_0x4f282f,tdx:_0x3dc5e5}=_0x2822fb,_0x1c99a0=await withSpinner(_0x19723c(0xa7),()=>_0x3dc5e5['policy'][_0x19723c(0xbb)](),{'verbose':_0x4f282f[_0x19723c(0xc6)]}),_0x556200=_0x1c99a0[_0x19723c(0x9a)];console['error'](_0x19723c(0x8f)+_0x556200[_0x19723c(0xc4)]+_0x19723c(0x8a)+(_0x556200[_0x19723c(0xc4)]!==0x1?_0x19723c(0xa0):'y'));if(isStructuredFormat(_0x4f282f))return await handleSDKOutput(_0x556200,_0x4f282f),0x0;if(_0x556200[_0x19723c(0xc4)]===0x0)console[_0x19723c(0xc3)](a33_0x342d9d[_0x19723c(0xbd)](_0x19723c(0x94)));else for(const _0x48aae7 of _0x556200){const _0x2480a4=_0x48aae7[_0x19723c(0x8e)]?a33_0x342d9d[_0x19723c(0xbd)](_0x19723c(0xc9)+_0x48aae7[_0x19723c(0x8e)]):'';console['log'](_0x19723c(0xac)+_0x48aae7['name']+_0x2480a4);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a33_0x29d97f(0x9d)]=a33_0x29d97f(0xae);[a33_0x29d97f(0x8e)]=a33_0x29d97f(0xbe);[a33_0x29d97f(0x9f)](_0x174361){const _0x59ee52=a33_0x29d97f;if(_0x174361[_0x59ee52(0x93)][_0x59ee52(0xc4)]===0x0)return _0x59ee52(0xa8);return undefined;}async[a33_0x29d97f(0xaf)](_0x438dfb){const _0x2ad1b3=a33_0x29d97f,{options:_0x4a8bfe,tdx:_0x374172}=_0x438dfb,_0xed6d60=_0x438dfb['args'][0x0],_0x333240=await withSpinner(_0x2ad1b3(0xa2),async()=>{const _0x5b4d99=_0x2ad1b3,_0x26c1df=await _0x374172[_0x5b4d99(0x9e)]['getPolicy'](_0xed6d60),[_0x5e02e9,_0xbfa4c0]=await Promise['all']([_0x374172[_0x5b4d99(0x9e)][_0x5b4d99(0x91)](_0x26c1df['id']),_0x374172[_0x5b4d99(0x9e)][_0x5b4d99(0xa5)](_0x26c1df['id'])]);return{'policy':_0x26c1df,'perms':_0x5e02e9,'users':_0xbfa4c0};},{'verbose':_0x4a8bfe['verbose']}),{policy:_0x39f357,perms:_0x181e3b,users:_0x25280b}=_0x333240[_0x2ad1b3(0x9a)];if(isStructuredFormat(_0x4a8bfe))return await handleSingleObjectOutput({..._0x39f357,'permissions':_0x181e3b['permissions'],'users':_0x25280b},_0x4a8bfe),0x0;console[_0x2ad1b3(0xc3)]('\x0a'+a33_0x342d9d[_0x2ad1b3(0xca)]('📋')+'\x20'+a33_0x342d9d[_0x2ad1b3(0xca)](_0x39f357[_0x2ad1b3(0x9d)])+'\x20'+a33_0x342d9d['dim'](_0x2ad1b3(0xb0)+_0x39f357['id']+')'));_0x39f357[_0x2ad1b3(0x8e)]&&console[_0x2ad1b3(0xc3)]('\x20\x20\x20'+a33_0x342d9d[_0x2ad1b3(0xbd)](_0x39f357['description']));console[_0x2ad1b3(0xc3)](_0x2ad1b3(0xc1)+_0x25280b[_0x2ad1b3(0xc4)]+_0x2ad1b3(0xa4)+(_0x25280b[_0x2ad1b3(0xc4)]!==0x1?'s':'')+_0x2ad1b3(0xb5)),printPermissionsMap(_0x181e3b['permissions']);if(_0x25280b['length']>0x0){console[_0x2ad1b3(0xc3)]('\x0a'+a33_0x342d9d[_0x2ad1b3(0xca)]('👥\x20Assigned\x20Users')+':');for(const _0x3d2322 of _0x25280b){const _0x589739=_0x3d2322['email']&&_0x3d2322['email']!==_0x3d2322[_0x2ad1b3(0x9d)]?a33_0x342d9d[_0x2ad1b3(0xbd)]('\x20<'+_0x3d2322[_0x2ad1b3(0xbf)]+'>'):'';console[_0x2ad1b3(0xc3)](_0x2ad1b3(0xac)+_0x3d2322[_0x2ad1b3(0x9d)]+_0x589739);}}return console[_0x2ad1b3(0xc3)](),0x0;}}function printPermissionsMap(_0xb3e2e8){const _0x3145b0=a33_0x29d97f,_0x2ec371=Object[_0x3145b0(0xb7)](_0xb3e2e8);console[_0x3145b0(0xc3)]('\x0a'+a33_0x342d9d['bold'](_0x3145b0(0xa1))+':');if(_0x2ec371[_0x3145b0(0xc4)]===0x0){console[_0x3145b0(0xc3)](a33_0x342d9d[_0x3145b0(0xbd)](_0x3145b0(0xb9)));return;}const _0x1d238b=Math[_0x3145b0(0xba)](..._0x2ec371[_0x3145b0(0xab)](([_0x31870f])=>_0x31870f[_0x3145b0(0xc4)]));for(const [_0x5e7c0d,_0x230ccf]of _0x2ec371){const _0x1763e0=formatOperations(_0x230ccf);console[_0x3145b0(0xc3)]('\x20\x20'+_0x5e7c0d[_0x3145b0(0x99)](_0x1d238b+0x2)+_0x1763e0);}}function formatOperations(_0x424417){const _0x25badc=a33_0x29d97f,_0x2aaa28=[...new Set(_0x424417[_0x25badc(0xab)](_0xd0550=>_0xd0550[_0x25badc(0x9b)]))];return _0x2aaa28[_0x25badc(0xc7)](',\x20');}
1
+ const a33_0x510ed8=a33_0x3c91;function a33_0x3c91(_0x22e274,_0x3ebf0b){_0x22e274=_0x22e274-0x1ab;const _0x236d83=a33_0x236d();let _0x3c917d=_0x236d83[_0x22e274];return _0x3c917d;}(function(_0x4d37a4,_0x8f72dd){const _0x46a531=a33_0x3c91,_0xd000ac=_0x4d37a4();while(!![]){try{const _0x24a75e=-parseInt(_0x46a531(0x1db))/0x1*(parseInt(_0x46a531(0x1e7))/0x2)+-parseInt(_0x46a531(0x1d0))/0x3+parseInt(_0x46a531(0x1b9))/0x4*(-parseInt(_0x46a531(0x1dd))/0x5)+-parseInt(_0x46a531(0x1bb))/0x6*(-parseInt(_0x46a531(0x1e6))/0x7)+parseInt(_0x46a531(0x1c7))/0x8*(parseInt(_0x46a531(0x1ca))/0x9)+parseInt(_0x46a531(0x1c3))/0xa+parseInt(_0x46a531(0x1ba))/0xb;if(_0x24a75e===_0x8f72dd)break;else _0xd000ac['push'](_0xd000ac['shift']());}catch(_0x3bdf09){_0xd000ac['push'](_0xd000ac['shift']());}}}(a33_0x236d,0x2060d));function a33_0x236d(){const _0x1bcdd1=['log','verbose','getCurrent','email','\x20user','1WDnnwD','join','146090qYXWeI','policy\x20show','\x20assigned','📋\x20Assigned\x20Policies','context','bold','name','\x20\x20No\x20permissions','\x20polic','79303tRhgkj','448702Wqtngw','🔑\x20Effective\x20Permissions','listPolicies','getPolicyPermissions','Administrator','ies','👥\x20Assigned\x20Users','permissions','policy','\x20—\x20','description','user','policies','getPolicy','\x20\x20•\x20','16JnjHKk','4663659RVbvNm','6kpdsfo','Fetching\x20permissions...','account_owner','getPolicyUsers','operation','length','padEnd','args','1170140NMyWUP','getMyPermissions','map','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','4728ozKGoQ','site','No\x20policies\x20found','45BBMOsP','data','dim','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','Account\x20Owner','validate','244269dFZjyH','execute','max','\x20\x20No\x20policies\x20assigned','all','\x20\x20\x20'];a33_0x236d=function(){return _0x1bcdd1;};return a33_0x236d();}import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a33_0x47c433 from'chalk';export class PolicyCommand extends BaseCommand{['name']=a33_0x510ed8(0x1b2);[a33_0x510ed8(0x1b4)]='Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions';async['execute'](_0x51abcc){const _0x460c21=a33_0x510ed8,{options:_0x3967ae,tdx:_0x47fbcd}=_0x51abcc,_0x5b1d8c=await withSpinner(_0x460c21(0x1bc),async()=>{const _0x342836=_0x460c21,[_0x1ec697,_0xc1925]=await Promise[_0x342836(0x1d4)]([_0x47fbcd[_0x342836(0x1b5)][_0x342836(0x1d8)](),_0x47fbcd[_0x342836(0x1b2)][_0x342836(0x1c4)]()]);return{'userInfo':_0x1ec697,'permissions':_0xc1925};},{'verbose':_0x3967ae[_0x460c21(0x1d7)]}),{userInfo:_0x52c375,permissions:_0x4cd19e}=_0x5b1d8c['data'];if(isStructuredFormat(_0x3967ae))return await handleSingleObjectOutput(_0x4cd19e,_0x3967ae),0x0;const _0x5c9dc9=_0x52c375[_0x460c21(0x1bd)]?_0x460c21(0x1ce):_0x52c375['administrator']?_0x460c21(0x1ae):'Member';console[_0x460c21(0x1d6)]('\x0a'+a33_0x47c433[_0x460c21(0x1e2)]('👤')+'\x20'+a33_0x47c433[_0x460c21(0x1e2)](_0x52c375[_0x460c21(0x1e3)])+'\x20'+a33_0x47c433[_0x460c21(0x1cc)]('('+_0x52c375[_0x460c21(0x1d9)]+')')+'\x20—\x20'+_0x5c9dc9),console[_0x460c21(0x1d6)](a33_0x47c433[_0x460c21(0x1cc)](_0x460c21(0x1d5)+_0x47fbcd[_0x460c21(0x1e1)][_0x460c21(0x1c8)]+':'+_0x52c375['account_id']+',\x20user_id:'+_0x52c375['id']));const _0x126a88=_0x4cd19e[_0x460c21(0x1b6)];console[_0x460c21(0x1d6)]('\x0a'+a33_0x47c433['bold'](_0x460c21(0x1e0))+'\x20('+_0x126a88[_0x460c21(0x1c0)]+'):');if(_0x126a88[_0x460c21(0x1c0)]===0x0)console[_0x460c21(0x1d6)](a33_0x47c433[_0x460c21(0x1cc)](_0x460c21(0x1d3)));else for(const _0x57aaf6 of _0x126a88){console[_0x460c21(0x1d6)](_0x460c21(0x1b8)+_0x57aaf6[_0x460c21(0x1e3)]);}return printPermissionsMap(_0x4cd19e[_0x460c21(0x1b1)]),console['log'](),0x0;}}export class PolicyListCommand extends BaseCommand{['name']='policy\x20list';[a33_0x510ed8(0x1b4)]=a33_0x510ed8(0x1cd);async['execute'](_0x47532a){const _0x178a0b=a33_0x510ed8,{options:_0x1ffc4b,tdx:_0x523cad}=_0x47532a,_0x14b5b0=await withSpinner('Listing\x20policies...',()=>_0x523cad['policy'][_0x178a0b(0x1ac)](),{'verbose':_0x1ffc4b['verbose']}),_0x5548f2=_0x14b5b0[_0x178a0b(0x1cb)];console['error']('✔\x20Found\x20'+_0x5548f2[_0x178a0b(0x1c0)]+_0x178a0b(0x1e5)+(_0x5548f2[_0x178a0b(0x1c0)]!==0x1?_0x178a0b(0x1af):'y'));if(isStructuredFormat(_0x1ffc4b))return await handleSDKOutput(_0x5548f2,_0x1ffc4b),0x0;if(_0x5548f2['length']===0x0)console[_0x178a0b(0x1d6)](a33_0x47c433[_0x178a0b(0x1cc)](_0x178a0b(0x1c9)));else for(const _0x2bb354 of _0x5548f2){const _0x35c14b=_0x2bb354['description']?a33_0x47c433[_0x178a0b(0x1cc)](_0x178a0b(0x1b3)+_0x2bb354[_0x178a0b(0x1b4)]):'';console['log']('\x20\x20•\x20'+_0x2bb354['name']+_0x35c14b);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a33_0x510ed8(0x1e3)]=a33_0x510ed8(0x1de);[a33_0x510ed8(0x1b4)]='Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)';[a33_0x510ed8(0x1cf)](_0x53b463){const _0x4e16c2=a33_0x510ed8;if(_0x53b463[_0x4e16c2(0x1c2)]['length']===0x0)return _0x4e16c2(0x1c6);return undefined;}async[a33_0x510ed8(0x1d1)](_0x1afa9f){const _0x3d3fe4=a33_0x510ed8,{options:_0x342e26,tdx:_0x59787c}=_0x1afa9f,_0x1b85c2=_0x1afa9f[_0x3d3fe4(0x1c2)][0x0],_0xf36c50=await withSpinner('Fetching\x20policy...',async()=>{const _0x11df8d=_0x3d3fe4,_0x32f8d8=await _0x59787c[_0x11df8d(0x1b2)][_0x11df8d(0x1b7)](_0x1b85c2),[_0x554ed6,_0x242746]=await Promise[_0x11df8d(0x1d4)]([_0x59787c[_0x11df8d(0x1b2)][_0x11df8d(0x1ad)](_0x32f8d8['id']),_0x59787c[_0x11df8d(0x1b2)][_0x11df8d(0x1be)](_0x32f8d8['id'])]);return{'policy':_0x32f8d8,'perms':_0x554ed6,'users':_0x242746};},{'verbose':_0x342e26[_0x3d3fe4(0x1d7)]}),{policy:_0xe71aa2,perms:_0x23c931,users:_0x1df4aa}=_0xf36c50['data'];if(isStructuredFormat(_0x342e26))return await handleSingleObjectOutput({..._0xe71aa2,'permissions':_0x23c931[_0x3d3fe4(0x1b1)],'users':_0x1df4aa},_0x342e26),0x0;console[_0x3d3fe4(0x1d6)]('\x0a'+a33_0x47c433[_0x3d3fe4(0x1e2)]('📋')+'\x20'+a33_0x47c433['bold'](_0xe71aa2[_0x3d3fe4(0x1e3)])+'\x20'+a33_0x47c433['dim']('(ID:\x20'+_0xe71aa2['id']+')'));_0xe71aa2[_0x3d3fe4(0x1b4)]&&console[_0x3d3fe4(0x1d6)]('\x20\x20\x20'+a33_0x47c433[_0x3d3fe4(0x1cc)](_0xe71aa2['description']));console[_0x3d3fe4(0x1d6)](_0x3d3fe4(0x1d5)+_0x1df4aa[_0x3d3fe4(0x1c0)]+_0x3d3fe4(0x1da)+(_0x1df4aa['length']!==0x1?'s':'')+_0x3d3fe4(0x1df)),printPermissionsMap(_0x23c931['permissions']);if(_0x1df4aa[_0x3d3fe4(0x1c0)]>0x0){console['log']('\x0a'+a33_0x47c433[_0x3d3fe4(0x1e2)](_0x3d3fe4(0x1b0))+':');for(const _0x2a7b80 of _0x1df4aa){const _0x112ebf=_0x2a7b80[_0x3d3fe4(0x1d9)]&&_0x2a7b80[_0x3d3fe4(0x1d9)]!==_0x2a7b80[_0x3d3fe4(0x1e3)]?a33_0x47c433['dim']('\x20<'+_0x2a7b80[_0x3d3fe4(0x1d9)]+'>'):'';console[_0x3d3fe4(0x1d6)]('\x20\x20•\x20'+_0x2a7b80[_0x3d3fe4(0x1e3)]+_0x112ebf);}}return console['log'](),0x0;}}function printPermissionsMap(_0x5816c4){const _0x308b32=a33_0x510ed8,_0x30a826=Object['entries'](_0x5816c4);console[_0x308b32(0x1d6)]('\x0a'+a33_0x47c433['bold'](_0x308b32(0x1ab))+':');if(_0x30a826['length']===0x0){console['log'](a33_0x47c433[_0x308b32(0x1cc)](_0x308b32(0x1e4)));return;}const _0x1a100d=Math[_0x308b32(0x1d2)](..._0x30a826['map'](([_0x9f845f])=>_0x9f845f[_0x308b32(0x1c0)]));for(const [_0x37f25e,_0x21e9c0]of _0x30a826){const _0x3d114d=formatOperations(_0x21e9c0);console[_0x308b32(0x1d6)]('\x20\x20'+_0x37f25e[_0x308b32(0x1c1)](_0x1a100d+0x2)+_0x3d114d);}}function formatOperations(_0x42456d){const _0x2d1c98=a33_0x510ed8,_0x1292e1=[...new Set(_0x42456d[_0x2d1c98(0x1c5)](_0x20e04e=>_0x20e04e[_0x2d1c98(0x1bf)]))];return _0x1292e1[_0x2d1c98(0x1dc)](',\x20');}
@@ -1 +1 @@
1
- const a34_0x2ac38b=a34_0x455f;(function(_0x430467,_0x39a427){const _0x2e021c=a34_0x455f,_0x1c4750=_0x430467();while(!![]){try{const _0x1b52e3=parseInt(_0x2e021c(0x128))/0x1*(-parseInt(_0x2e021c(0x118))/0x2)+parseInt(_0x2e021c(0x129))/0x3*(parseInt(_0x2e021c(0x125))/0x4)+-parseInt(_0x2e021c(0x12d))/0x5+-parseInt(_0x2e021c(0x139))/0x6+-parseInt(_0x2e021c(0x109))/0x7*(-parseInt(_0x2e021c(0x121))/0x8)+-parseInt(_0x2e021c(0x161))/0x9+parseInt(_0x2e021c(0x162))/0xa;if(_0x1b52e3===_0x39a427)break;else _0x1c4750['push'](_0x1c4750['shift']());}catch(_0x45e183){_0x1c4750['push'](_0x1c4750['shift']());}}}(a34_0x4f32,0xf10ff));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a34_0x283eef from'node:path';function a34_0x455f(_0x3d306c,_0x1e53bb){_0x3d306c=_0x3d306c-0x108;const _0x4f3214=a34_0x4f32();let _0x455f50=_0x4f3214[_0x3d306c];return _0x455f50;}import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{runOAuthLoginFlow}from'./auth-login-command.js';import{isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';function a34_0x4f32(){const _0x35e484=['\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','session','15862VdVibX','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','error','Operation\x20cancelled','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','Profile\x20name\x20cannot\x20be\x20empty','execute','Unknown\x20key\x20\x27','Remove\x20a\x20profile','\x20\x20tdx\x20--profile\x20','API\x20key\x20cannot\x20be\x20empty','config','password','validate','Session\x20profile\x20set\x20to:\x20','16UrnMsH','\x27.\x0a\x0aValid\x20keys:\x20','\x27\x20removed\x20from\x20configuration','tdx:\x20profile\x20remove','\x27\x20created','parent_segment','/app/mp/ak','log','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','5912gBhovE','Setup\x20cancelled','status','trim','143984szmCTT','\x0aSaved\x20to:\x20','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','13757ajhUPo','72uBfkAv','profile:use','includes','dim','1261680ZgAqzL','profile','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x27\x20requires\x20API\x20key\x20validation.','Failed\x20to\x20remove\x20profile:\x20','join','jobs','split','tdx:\x20profile\x20create','\x27\x20does\x20not\x20exist.\x20Create\x20it?','description','\x0aOperation\x20cancelled','11568606cWdMQT','red','profileName','profile:create','site','\x20API\x20key\x20is\x20valid\x20(User:\x20','bold','getUserInfo','\x0aSetup\x20cancelled','\x27\x20does\x20not\x20exist.','warn','database','apiKey','Enter\x20your\x20TD\x20API\x20key:','\x20\x20(no\x20profiles\x20found)','method','API\x20Key','message','ERROR','tdx.json','test','logLevel','green','\x0aAvailable\x20profiles:','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x27\x20updated:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','length','\x20\x20-\x20','profile:set','✗\x20Validation\x20failed:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','tdx:\x20profile\x20set','Site\x20was\x20not\x20changed.','llm_project','llm_agent','VALID_KEYS','name','\x20Profile\x20\x27','14595624pSJOXC','23611420Ikeglr','text','Choose\x20authentication\x20method:','confirm','select','apikey','Profile\x20\x27','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Create\x20a\x20new\x20profile','yellow','Default\x20profile\x20set\x20to:\x20','email','create','Enter\x20description\x20(optional):','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>'];a34_0x4f32=function(){return _0x35e484;};return a34_0x4f32();}import a34_0x56a30e from'prompts';import a34_0x3535c5 from'chalk';function validateProfileName(_0x2e91a4){const _0x40ea19=a34_0x455f;if(!_0x2e91a4||!_0x2e91a4['trim']())return _0x40ea19(0x10e);const _0x54804d=_0x2e91a4[_0x40ea19(0x124)]();if(!/^[a-zA-Z0-9_-]+$/[_0x40ea19(0x14d)](_0x54804d))return _0x40ea19(0x172);if(profileExists(_0x54804d))return'Profile\x20\x27'+_0x54804d+_0x40ea19(0x10d);return!![];}export class ProfileCreateCommand extends BaseCommand{[a34_0x2ac38b(0x15f)]=a34_0x2ac38b(0x13c);[a34_0x2ac38b(0x137)]=a34_0x2ac38b(0x16a);async[a34_0x2ac38b(0x10f)](_0x434306){const _0xc14fdc=a34_0x2ac38b,{options:_0x532bb7,args:_0x17d3e7}=_0x434306;console[_0xc14fdc(0x11f)](a34_0x3535c5[_0xc14fdc(0x13f)](_0xc14fdc(0x135)));let _0x4e967f;if(_0x17d3e7['length']>0x0&&_0x17d3e7[0x0]){const _0xb5ed0a=_0x17d3e7[0x0]['trim'](),_0x59c32f=validateProfileName(_0xb5ed0a);if(_0x59c32f!==!![])return console[_0xc14fdc(0x10b)](a34_0x3535c5['red'](_0x59c32f)),0x1;_0x4e967f=_0xb5ed0a;}else{const _0x1ec393=await a34_0x56a30e({'type':_0xc14fdc(0x163),'name':_0xc14fdc(0x13b),'message':'Enter\x20profile\x20name:','validate':validateProfileName});if(!_0x1ec393[_0xc14fdc(0x13b)])return console[_0xc14fdc(0x11f)](_0xc14fdc(0x141)),0x1;_0x4e967f=_0x1ec393[_0xc14fdc(0x13b)][_0xc14fdc(0x124)]();}const _0x3703c7=await a34_0x56a30e({'type':_0xc14fdc(0x163),'name':_0xc14fdc(0x137),'message':_0xc14fdc(0x16f)}),_0x4e7d6f=_0x3703c7[_0xc14fdc(0x137)]?.[_0xc14fdc(0x124)]()||undefined,_0x1e1e4d=_0x532bb7[_0xc14fdc(0x13d)]||'us01',_0x5f3d7b=await promptSiteSelection(_0x1e1e4d,_0x4e967f,_0xc14fdc(0x122));if(!_0x5f3d7b)return 0x1;const _0x3cfb44=resolveSite(_0x5f3d7b);if(isOAuthSupported(_0x3cfb44)){const _0x498100=await a34_0x56a30e({'type':_0xc14fdc(0x166),'name':'method','message':_0xc14fdc(0x164),'choices':[{'title':'OAuth\x20(browser\x20login)','value':'oauth'},{'title':_0xc14fdc(0x149),'value':_0xc14fdc(0x167)}]});if(!_0x498100[_0xc14fdc(0x148)])return console[_0xc14fdc(0x11f)](_0xc14fdc(0x141)),0x1;if(_0x498100[_0xc14fdc(0x148)]==='oauth'){if(_0x4e7d6f){const _0x343c1e={'site':_0x3cfb44,'description':_0x4e7d6f};saveProfileToUserConfig(_0x4e967f,_0x343c1e);}return await runOAuthLoginFlow(_0x3cfb44,_0x4e967f,_0x532bb7[_0xc14fdc(0x14e)]??LogLevel[_0xc14fdc(0x14b)]),0x0;}}console[_0xc14fdc(0x11f)](_0xc14fdc(0x171)+_0x3cfb44),console[_0xc14fdc(0x11f)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console['log']('\x20\x20'+getConsoleUrl(_0x3cfb44,_0xc14fdc(0x11e)));const _0x7e527c=await a34_0x56a30e({'type':_0xc14fdc(0x115),'name':_0xc14fdc(0x145),'message':_0xc14fdc(0x146),'validate':_0x1d842b=>{const _0x55f2f6=_0xc14fdc;if(!_0x1d842b||!_0x1d842b[_0x55f2f6(0x124)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x7e527c[_0xc14fdc(0x145)])return console[_0xc14fdc(0x11f)](_0xc14fdc(0x141)),0x1;const _0x33949d=_0x7e527c[_0xc14fdc(0x145)];console[_0xc14fdc(0x11f)]('Validating\x20API\x20key...');try{const _0x4cdf81=TDX['create']({'site':_0x3cfb44,'apiKey':_0x33949d[_0xc14fdc(0x124)](),'logLevel':_0x532bb7[_0xc14fdc(0x14e)]??LogLevel[_0xc14fdc(0x14b)]}),_0x27bbdf=await _0x4cdf81[_0xc14fdc(0x133)][_0xc14fdc(0x140)]();console[_0xc14fdc(0x11f)](a34_0x3535c5[_0xc14fdc(0x14f)]('✓')+_0xc14fdc(0x13e)+_0x27bbdf[_0xc14fdc(0x16d)]+')');const _0x5bbd99=await isKeychainAvailable();_0x5bbd99?(await saveAPIKeyAsync(_0x33949d[_0xc14fdc(0x124)](),_0x3cfb44,_0x4e967f),console[_0xc14fdc(0x11f)](a34_0x3535c5[_0xc14fdc(0x14f)]('✓')+_0xc14fdc(0x154)+_0x4e967f+')')):(console['warn'](a34_0x3535c5['yellow']('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0xc14fdc(0x143)](a34_0x3535c5[_0xc14fdc(0x16b)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x3ae6f2={'site':_0x3cfb44,..._0x4e7d6f&&{'description':_0x4e7d6f}};return saveProfileToUserConfig(_0x4e967f,_0x3ae6f2),console['log'](a34_0x3535c5[_0xc14fdc(0x14f)]('✓')+_0xc14fdc(0x160)+_0x4e967f+_0xc14fdc(0x11c)),console['log'](),console[_0xc14fdc(0x11f)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0xc14fdc(0x11f)](_0xc14fdc(0x112)+_0x4e967f+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0xc14fdc(0x11f)](_0xc14fdc(0x112)+_0x4e967f+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x11f327){if(_0x11f327 instanceof HTTPClientError&&_0x11f327['status']===0x191)return printAuthError(_0x11f327),0x1;return console['error'](a34_0x3535c5['red'](_0xc14fdc(0x158)+(_0x11f327 instanceof Error?_0x11f327[_0xc14fdc(0x14a)]:String(_0x11f327)))),console['error'](_0xc14fdc(0x169)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']='profile:remove';[a34_0x2ac38b(0x137)]=a34_0x2ac38b(0x111);[a34_0x2ac38b(0x116)](_0x7d445){const _0xc8bcb4=a34_0x2ac38b,{args:_0x2d066a}=_0x7d445;if(_0x2d066a[_0xc8bcb4(0x155)]===0x0)return _0xc8bcb4(0x159);return undefined;}async[a34_0x2ac38b(0x10f)](_0x8b916a){const _0x16fe37=a34_0x2ac38b,{args:_0x438849}=_0x8b916a,_0x2f622e=_0x438849[0x0];console[_0x16fe37(0x11f)](a34_0x3535c5[_0x16fe37(0x13f)](_0x16fe37(0x11b)));if(!profileExists(_0x2f622e)){console[_0x16fe37(0x10b)](a34_0x3535c5[_0x16fe37(0x13a)](_0x16fe37(0x168)+_0x2f622e+_0x16fe37(0x142))),console[_0x16fe37(0x11f)](_0x16fe37(0x150));const _0x50ff27=listProfiles();if(_0x50ff27[_0x16fe37(0x155)]===0x0)console[_0x16fe37(0x11f)](_0x16fe37(0x147));else for(const _0x10fa6e of _0x50ff27){console[_0x16fe37(0x11f)](_0x16fe37(0x156)+_0x10fa6e[_0x16fe37(0x15f)]);}return 0x1;}const _0x574dcc=await a34_0x56a30e({'type':_0x16fe37(0x165),'name':'confirm','message':_0x16fe37(0x153)+_0x2f622e+'\x27?','initial':![]});if(!_0x574dcc[_0x16fe37(0x165)])return console['log']('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x2f622e),console[_0x16fe37(0x11f)](a34_0x3535c5[_0x16fe37(0x14f)]('✓')+_0x16fe37(0x160)+_0x2f622e+_0x16fe37(0x11a));}catch(_0x1fc0ec){return console[_0x16fe37(0x10b)](a34_0x3535c5[_0x16fe37(0x13a)](_0x16fe37(0x131)+(_0x1fc0ec instanceof Error?_0x1fc0ec['message']:String(_0x1fc0ec)))),0x1;}const _0x32fd2e=await isKeychainAvailable();if(_0x32fd2e){const _0xdf89f2=await deleteKeychainAPIKey(_0x2f622e);_0xdf89f2&&console[_0x16fe37(0x11f)](a34_0x3535c5[_0x16fe37(0x14f)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a34_0x2ac38b(0x157);[a34_0x2ac38b(0x137)]='Set\x20a\x20profile\x20configuration\x20value';static ['VALID_KEYS']=[a34_0x2ac38b(0x13d),a34_0x2ac38b(0x144),a34_0x2ac38b(0x11d),a34_0x2ac38b(0x15c),a34_0x2ac38b(0x15d),a34_0x2ac38b(0x137)];['validate'](_0x3aa30a){const _0x5b0da3=a34_0x2ac38b,{args:_0x258da6,options:_0x24d898}=_0x3aa30a,_0x29be71=_0x24d898[_0x5b0da3(0x12e)]||getActiveProfile();if(!_0x29be71)return _0x5b0da3(0x170);if(_0x258da6[_0x5b0da3(0x155)]===0x0)return _0x5b0da3(0x10a)+ProfileSetCommand[_0x5b0da3(0x15e)][_0x5b0da3(0x132)](',\x20');const _0x22c240=_0x258da6[0x0];if(!_0x22c240[_0x5b0da3(0x12b)]('='))return _0x5b0da3(0x151)+ProfileSetCommand[_0x5b0da3(0x15e)]['join'](',\x20');const [_0x59f2fe]=_0x22c240['split']('=',0x2);if(!ProfileSetCommand[_0x5b0da3(0x15e)][_0x5b0da3(0x12b)](_0x59f2fe))return _0x5b0da3(0x110)+_0x59f2fe+_0x5b0da3(0x119)+ProfileSetCommand[_0x5b0da3(0x15e)][_0x5b0da3(0x132)](',\x20');return undefined;}async[a34_0x2ac38b(0x10f)](_0x2ace78){const _0x2c93fd=a34_0x2ac38b,{args:_0x5615b4,options:_0x15a5e2}=_0x2ace78,_0x46c09e=_0x15a5e2[_0x2c93fd(0x12e)]||getActiveProfile(),[_0x256fba,..._0x444b8d]=_0x5615b4[0x0][_0x2c93fd(0x134)]('='),_0x1f0a07=_0x444b8d[_0x2c93fd(0x132)]('=');console[_0x2c93fd(0x11f)](a34_0x3535c5[_0x2c93fd(0x13f)](_0x2c93fd(0x15a)));if(!profileExists(_0x46c09e)){const _0x4c2903=await a34_0x56a30e({'type':_0x2c93fd(0x165),'name':_0x2c93fd(0x16e),'message':'Profile\x20\x27'+_0x46c09e+_0x2c93fd(0x136),'initial':!![]});if(!_0x4c2903[_0x2c93fd(0x16e)])return console['log'](_0x2c93fd(0x10c)),0x1;}const _0x74ca99=loadProfile(_0x46c09e),_0x1b0fe2=_0x74ca99?.[_0x2c93fd(0x114)]||{};if(_0x256fba===_0x2c93fd(0x13d)){const _0x3ad58f=resolveSite(_0x1f0a07);console[_0x2c93fd(0x11f)]('Changing\x20site\x20to\x20\x27'+_0x3ad58f+_0x2c93fd(0x130)),console[_0x2c93fd(0x11f)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x2c93fd(0x11f)]('\x20\x20'+getConsoleUrl(_0x3ad58f,_0x2c93fd(0x11e)));const _0x14d551=await a34_0x56a30e({'type':_0x2c93fd(0x115),'name':_0x2c93fd(0x145),'message':_0x2c93fd(0x127),'validate':_0x4db131=>{const _0x5ebf53=_0x2c93fd;if(!_0x4db131||!_0x4db131[_0x5ebf53(0x124)]())return _0x5ebf53(0x113);return!![];}});if(!_0x14d551['apiKey'])return console[_0x2c93fd(0x11f)](_0x2c93fd(0x138)),0x1;console[_0x2c93fd(0x11f)]('Validating\x20API\x20key...');try{const _0x16cab1=TDX['create']({'site':_0x3ad58f,'apiKey':_0x14d551['apiKey']['trim'](),'logLevel':_0x15a5e2[_0x2c93fd(0x14e)]??LogLevel[_0x2c93fd(0x14b)]}),_0x3cf62a=await _0x16cab1[_0x2c93fd(0x133)][_0x2c93fd(0x140)]();console[_0x2c93fd(0x11f)](a34_0x3535c5[_0x2c93fd(0x14f)]('✓')+_0x2c93fd(0x13e)+_0x3cf62a[_0x2c93fd(0x16d)]+')');const _0x5a669d=await isKeychainAvailable();_0x5a669d?(await saveAPIKeyAsync(_0x14d551[_0x2c93fd(0x145)][_0x2c93fd(0x124)](),_0x3ad58f,_0x46c09e),console['log'](a34_0x3535c5[_0x2c93fd(0x14f)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x2c93fd(0x143)](a34_0x3535c5[_0x2c93fd(0x16b)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x1b0fe2[_0x2c93fd(0x13d)]=_0x3ad58f;}catch(_0x4b26ce){if(_0x4b26ce instanceof HTTPClientError&&_0x4b26ce[_0x2c93fd(0x123)]===0x191)return printAuthError(_0x4b26ce),0x1;return console['error'](a34_0x3535c5[_0x2c93fd(0x13a)](_0x2c93fd(0x158)+(_0x4b26ce instanceof Error?_0x4b26ce[_0x2c93fd(0x14a)]:String(_0x4b26ce)))),console['error'](_0x2c93fd(0x15b)),0x1;}}else _0x1b0fe2[_0x256fba]=_0x1f0a07||undefined;return saveProfileToUserConfig(_0x46c09e,_0x1b0fe2),console[_0x2c93fd(0x11f)](a34_0x3535c5[_0x2c93fd(0x14f)]('✓')+_0x2c93fd(0x160)+_0x46c09e+_0x2c93fd(0x152)+_0x256fba+'='+(_0x1f0a07||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{[a34_0x2ac38b(0x15f)]=a34_0x2ac38b(0x12a);['description']='Set\x20session\x20profile';[a34_0x2ac38b(0x116)](_0x49bb55){const _0x1c2478=a34_0x2ac38b,{args:_0x59d7d6}=_0x49bb55;if(_0x59d7d6[_0x1c2478(0x155)]===0x0)return _0x1c2478(0x120);return undefined;}async[a34_0x2ac38b(0x10f)](_0x480d80){const _0x8ad395=a34_0x2ac38b,{args:_0x59ac44,options:_0x4758c8}=_0x480d80,_0x11a032=_0x59ac44[0x0],_0x327466=_0x4758c8['default'];cleanExpiredSessions();if(!profileExists(_0x11a032)){console[_0x8ad395(0x10b)](a34_0x3535c5[_0x8ad395(0x13a)](_0x8ad395(0x168)+_0x11a032+'\x27\x20does\x20not\x20exist.')),console[_0x8ad395(0x11f)]('\x0aAvailable\x20profiles:');const _0x3135ac=listProfiles();if(_0x3135ac[_0x8ad395(0x155)]===0x0)console[_0x8ad395(0x11f)](_0x8ad395(0x147));else for(const _0x5d32ea of _0x3135ac){console[_0x8ad395(0x11f)](_0x8ad395(0x156)+_0x5d32ea[_0x8ad395(0x15f)]);}return 0x1;}if(_0x327466){const _0x29d0fc=a34_0x283eef['join'](getConfigDir(),_0x8ad395(0x14c));return saveActiveProfileToUserConfig(_0x11a032),console[_0x8ad395(0x11f)](_0x8ad395(0x16c)+a34_0x3535c5[_0x8ad395(0x14f)](_0x11a032)),console[_0x8ad395(0x11f)](a34_0x3535c5[_0x8ad395(0x12c)](_0x8ad395(0x126)+_0x29d0fc)),0x0;}const _0x2639b7=getSessionID(_0x4758c8[_0x8ad395(0x108)]);return saveSessionContext({'profile':_0x11a032},_0x4758c8['session']),console[_0x8ad395(0x11f)](_0x8ad395(0x117)+a34_0x3535c5[_0x8ad395(0x14f)](_0x11a032)+'\x20'+a34_0x3535c5[_0x8ad395(0x12c)]('(session:\x20'+_0x2639b7+')')),console[_0x8ad395(0x11f)](a34_0x3535c5[_0x8ad395(0x12c)](_0x8ad395(0x12f)+_0x11a032+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
1
+ const a34_0x3fe3d6=a34_0x430b;(function(_0x4e3956,_0x3432a9){const _0x4f820b=a34_0x430b,_0x4d52f1=_0x4e3956();while(!![]){try{const _0x46121f=parseInt(_0x4f820b(0xea))/0x1*(-parseInt(_0x4f820b(0x113))/0x2)+-parseInt(_0x4f820b(0x13a))/0x3+-parseInt(_0x4f820b(0xe4))/0x4+-parseInt(_0x4f820b(0x10b))/0x5*(-parseInt(_0x4f820b(0xee))/0x6)+-parseInt(_0x4f820b(0x123))/0x7+parseInt(_0x4f820b(0x109))/0x8*(parseInt(_0x4f820b(0x11a))/0x9)+-parseInt(_0x4f820b(0x13b))/0xa*(-parseInt(_0x4f820b(0xf5))/0xb);if(_0x46121f===_0x3432a9)break;else _0x4d52f1['push'](_0x4d52f1['shift']());}catch(_0x2857b3){_0x4d52f1['push'](_0x4d52f1['shift']());}}}(a34_0x121a,0x35c25));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a34_0x1f33db from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{runOAuthLoginFlow}from'./auth-login-command.js';import{isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a34_0xe1212d from'prompts';import a34_0x55a197 from'chalk';function validateProfileName(_0xc053c){const _0xbb551f=a34_0x430b;if(!_0xc053c||!_0xc053c[_0xbb551f(0x101)]())return _0xbb551f(0xdf);const _0x466339=_0xc053c['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0xbb551f(0x134)](_0x466339))return _0xbb551f(0xec);if(profileExists(_0x466339))return'Profile\x20\x27'+_0x466339+_0xbb551f(0x12e);return!![];}export class ProfileCreateCommand extends BaseCommand{['name']='profile:create';['description']=a34_0x3fe3d6(0x136);async[a34_0x3fe3d6(0x138)](_0xe198e0){const _0x27091e=a34_0x3fe3d6,{options:_0xeed09c,args:_0x2659c2}=_0xe198e0;console['log'](a34_0x55a197[_0x27091e(0xfd)](_0x27091e(0xd8)));let _0x4e7f45;if(_0x2659c2[_0x27091e(0x111)]>0x0&&_0x2659c2[0x0]){const _0x323d02=_0x2659c2[0x0]['trim'](),_0x58cb95=validateProfileName(_0x323d02);if(_0x58cb95!==!![])return console[_0x27091e(0xd5)](a34_0x55a197['red'](_0x58cb95)),0x1;_0x4e7f45=_0x323d02;}else{const _0x45999=await a34_0xe1212d({'type':_0x27091e(0xfe),'name':_0x27091e(0xe2),'message':'Enter\x20profile\x20name:','validate':validateProfileName});if(!_0x45999[_0x27091e(0xe2)])return console[_0x27091e(0xf6)](_0x27091e(0x128)),0x1;_0x4e7f45=_0x45999['profileName'][_0x27091e(0x101)]();}const _0x51a2f1=await a34_0xe1212d({'type':'text','name':_0x27091e(0x130),'message':_0x27091e(0x11d)}),_0xf176b=_0x51a2f1[_0x27091e(0x130)]?.[_0x27091e(0x101)]()||undefined,_0x5b7783=_0xeed09c[_0x27091e(0xe5)]||_0x27091e(0x132),_0x282269=await promptSiteSelection(_0x5b7783,_0x4e7f45,_0x27091e(0x118));if(!_0x282269)return 0x1;const _0xc39ca7=resolveSite(_0x282269);if(isOAuthSupported(_0xc39ca7)){const _0x28892e=await a34_0xe1212d({'type':_0x27091e(0xe7),'name':_0x27091e(0x139),'message':_0x27091e(0x121),'choices':[{'title':'OAuth\x20(browser\x20login)','value':'oauth'},{'title':'API\x20Key','value':'apikey'}]});if(!_0x28892e[_0x27091e(0x139)])return console['log'](_0x27091e(0x128)),0x1;if(_0x28892e[_0x27091e(0x139)]==='oauth'){if(_0xf176b){const _0x2782ed={'site':_0xc39ca7,'description':_0xf176b};saveProfileToUserConfig(_0x4e7f45,_0x2782ed);}return await runOAuthLoginFlow(_0xc39ca7,_0x4e7f45,_0xeed09c['logLevel']??LogLevel['ERROR']),0x0;}}console[_0x27091e(0xf6)](_0x27091e(0x115)+_0xc39ca7),console['log']('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console['log']('\x20\x20'+getConsoleUrl(_0xc39ca7,_0x27091e(0x10e)));const _0x32199d=await a34_0xe1212d({'type':'password','name':_0x27091e(0x131),'message':_0x27091e(0x10f),'validate':_0x211ee9=>{if(!_0x211ee9||!_0x211ee9['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x32199d[_0x27091e(0x131)])return console[_0x27091e(0xf6)](_0x27091e(0x128)),0x1;const _0x6b4096=_0x32199d[_0x27091e(0x131)];console[_0x27091e(0xf6)]('Validating\x20API\x20key...');try{const _0x22b6a9=TDX[_0x27091e(0xe0)]({'site':_0xc39ca7,'apiKey':_0x6b4096[_0x27091e(0x101)](),'logLevel':_0xeed09c[_0x27091e(0x105)]??LogLevel[_0x27091e(0xf4)]}),_0x7e4f5f=await _0x22b6a9[_0x27091e(0x125)]['getUserInfo']();console[_0x27091e(0xf6)](a34_0x55a197[_0x27091e(0xfc)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x7e4f5f[_0x27091e(0x133)]+')');const _0xf89231=await isKeychainAvailable();_0xf89231?(await saveAPIKeyAsync(_0x6b4096[_0x27091e(0x101)](),_0xc39ca7,_0x4e7f45),console[_0x27091e(0xf6)](a34_0x55a197[_0x27091e(0xfc)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x4e7f45+')')):(console[_0x27091e(0x11b)](a34_0x55a197[_0x27091e(0x114)](_0x27091e(0xd3))),console[_0x27091e(0x11b)](a34_0x55a197[_0x27091e(0x114)](_0x27091e(0x10a))));const _0x48a2d0={'site':_0xc39ca7,..._0xf176b&&{'description':_0xf176b}};return saveProfileToUserConfig(_0x4e7f45,_0x48a2d0),console[_0x27091e(0xf6)](a34_0x55a197[_0x27091e(0xfc)]('✓')+_0x27091e(0x11e)+_0x4e7f45+'\x27\x20created'),console[_0x27091e(0xf6)](),console[_0x27091e(0xf6)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x27091e(0xf6)](_0x27091e(0xeb)+_0x4e7f45+_0x27091e(0x10d)),console['log'](_0x27091e(0xeb)+_0x4e7f45+_0x27091e(0xef)),0x0;}catch(_0x24d252){if(_0x24d252 instanceof HTTPClientError&&_0x24d252[_0x27091e(0xdb)]===0x191)return printAuthError(_0x24d252),0x1;return console['error'](a34_0x55a197['red'](_0x27091e(0x120)+(_0x24d252 instanceof Error?_0x24d252[_0x27091e(0x117)]:String(_0x24d252)))),console[_0x27091e(0xd5)](_0x27091e(0xf7)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a34_0x3fe3d6(0x13d)]=a34_0x3fe3d6(0xd4);[a34_0x3fe3d6(0x130)]=a34_0x3fe3d6(0x100);[a34_0x3fe3d6(0xf9)](_0x396c27){const _0x163029=a34_0x3fe3d6,{args:_0x24339e}=_0x396c27;if(_0x24339e[_0x163029(0x111)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async[a34_0x3fe3d6(0x138)](_0x4d0743){const _0x1aa977=a34_0x3fe3d6,{args:_0x2f7385}=_0x4d0743,_0x1d11de=_0x2f7385[0x0];console['log'](a34_0x55a197[_0x1aa977(0xfd)]('tdx:\x20profile\x20remove'));if(!profileExists(_0x1d11de)){console[_0x1aa977(0xd5)](a34_0x55a197[_0x1aa977(0x108)](_0x1aa977(0x11c)+_0x1d11de+_0x1aa977(0xd9))),console[_0x1aa977(0xf6)](_0x1aa977(0x124));const _0x2e7d0b=listProfiles();if(_0x2e7d0b[_0x1aa977(0x111)]===0x0)console[_0x1aa977(0xf6)](_0x1aa977(0x137));else for(const _0x242d17 of _0x2e7d0b){console[_0x1aa977(0xf6)](_0x1aa977(0x126)+_0x242d17[_0x1aa977(0x13d)]);}return 0x1;}const _0x1493b6=await a34_0xe1212d({'type':'confirm','name':'confirm','message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x1d11de+'\x27?','initial':![]});if(!_0x1493b6[_0x1aa977(0xf2)])return console[_0x1aa977(0xf6)]('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x1d11de),console[_0x1aa977(0xf6)](a34_0x55a197['green']('✓')+'\x20Profile\x20\x27'+_0x1d11de+_0x1aa977(0x104));}catch(_0x520db3){return console[_0x1aa977(0xd5)](a34_0x55a197[_0x1aa977(0x108)](_0x1aa977(0x103)+(_0x520db3 instanceof Error?_0x520db3[_0x1aa977(0x117)]:String(_0x520db3)))),0x1;}const _0x628a39=await isKeychainAvailable();if(_0x628a39){const _0x5756cd=await deleteKeychainAPIKey(_0x1d11de);_0x5756cd&&console[_0x1aa977(0xf6)](a34_0x55a197[_0x1aa977(0xfc)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']='profile:set';[a34_0x3fe3d6(0x130)]=a34_0x3fe3d6(0x127);static [a34_0x3fe3d6(0x12a)]=[a34_0x3fe3d6(0xe5),a34_0x3fe3d6(0xf8),'parent_segment',a34_0x3fe3d6(0xe3),a34_0x3fe3d6(0xdd),a34_0x3fe3d6(0x130)];[a34_0x3fe3d6(0xf9)](_0x49b9e1){const _0x1658d8=a34_0x3fe3d6,{args:_0x20073e,options:_0xb193a5}=_0x49b9e1,_0x29a87d=_0xb193a5[_0x1658d8(0xed)]||getActiveProfile();if(!_0x29a87d)return _0x1658d8(0x12c);if(_0x20073e['length']===0x0)return _0x1658d8(0x107)+ProfileSetCommand[_0x1658d8(0x12a)]['join'](',\x20');const _0x9a38af=_0x20073e[0x0];if(!_0x9a38af['includes']('='))return _0x1658d8(0xe8)+ProfileSetCommand[_0x1658d8(0x12a)][_0x1658d8(0x13c)](',\x20');const [_0x6e95fc]=_0x9a38af[_0x1658d8(0x102)]('=',0x2);if(!ProfileSetCommand[_0x1658d8(0x12a)][_0x1658d8(0x119)](_0x6e95fc))return'Unknown\x20key\x20\x27'+_0x6e95fc+_0x1658d8(0xe6)+ProfileSetCommand['VALID_KEYS'][_0x1658d8(0x13c)](',\x20');return undefined;}async['execute'](_0x548f7c){const _0x231f3a=a34_0x3fe3d6,{args:_0x2b4821,options:_0x3d75ae}=_0x548f7c,_0x44a2d0=_0x3d75ae[_0x231f3a(0xed)]||getActiveProfile(),[_0x39edde,..._0x4cec11]=_0x2b4821[0x0]['split']('='),_0x2552c6=_0x4cec11[_0x231f3a(0x13c)]('=');console[_0x231f3a(0xf6)](a34_0x55a197[_0x231f3a(0xfd)]('tdx:\x20profile\x20set'));if(!profileExists(_0x44a2d0)){const _0x3b42fd=await a34_0xe1212d({'type':_0x231f3a(0xf2),'name':_0x231f3a(0xe0),'message':_0x231f3a(0x11c)+_0x44a2d0+_0x231f3a(0xf1),'initial':!![]});if(!_0x3b42fd[_0x231f3a(0xe0)])return console[_0x231f3a(0xf6)](_0x231f3a(0xdc)),0x1;}const _0x591f70=loadProfile(_0x44a2d0),_0x259e20=_0x591f70?.[_0x231f3a(0xe9)]||{};if(_0x39edde===_0x231f3a(0xe5)){const _0x32fc4a=resolveSite(_0x2552c6);console['log'](_0x231f3a(0x12f)+_0x32fc4a+_0x231f3a(0xda)),console['log'](_0x231f3a(0x122)),console['log']('\x20\x20'+getConsoleUrl(_0x32fc4a,_0x231f3a(0x10e)));const _0x437fe6=await a34_0xe1212d({'type':_0x231f3a(0xff),'name':_0x231f3a(0x131),'message':_0x231f3a(0x110),'validate':_0x2b14b4=>{const _0x50aeee=_0x231f3a;if(!_0x2b14b4||!_0x2b14b4[_0x50aeee(0x101)]())return _0x50aeee(0x11f);return!![];}});if(!_0x437fe6[_0x231f3a(0x131)])return console[_0x231f3a(0xf6)](_0x231f3a(0x116)),0x1;console[_0x231f3a(0xf6)](_0x231f3a(0x10c));try{const _0x42ce36=TDX[_0x231f3a(0xe0)]({'site':_0x32fc4a,'apiKey':_0x437fe6[_0x231f3a(0x131)]['trim'](),'logLevel':_0x3d75ae[_0x231f3a(0x105)]??LogLevel[_0x231f3a(0xf4)]}),_0x4f4558=await _0x42ce36['jobs']['getUserInfo']();console[_0x231f3a(0xf6)](a34_0x55a197[_0x231f3a(0xfc)]('✓')+_0x231f3a(0xfa)+_0x4f4558['email']+')');const _0x12f6e6=await isKeychainAvailable();_0x12f6e6?(await saveAPIKeyAsync(_0x437fe6[_0x231f3a(0x131)][_0x231f3a(0x101)](),_0x32fc4a,_0x44a2d0),console[_0x231f3a(0xf6)](a34_0x55a197[_0x231f3a(0xfc)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x231f3a(0x11b)](a34_0x55a197[_0x231f3a(0x114)](_0x231f3a(0xd3))),_0x259e20[_0x231f3a(0xe5)]=_0x32fc4a;}catch(_0x2e9d76){if(_0x2e9d76 instanceof HTTPClientError&&_0x2e9d76[_0x231f3a(0xdb)]===0x191)return printAuthError(_0x2e9d76),0x1;return console[_0x231f3a(0xd5)](a34_0x55a197[_0x231f3a(0x108)]('✗\x20Validation\x20failed:\x20'+(_0x2e9d76 instanceof Error?_0x2e9d76[_0x231f3a(0x117)]:String(_0x2e9d76)))),console[_0x231f3a(0xd5)](_0x231f3a(0x135)),0x1;}}else _0x259e20[_0x39edde]=_0x2552c6||undefined;return saveProfileToUserConfig(_0x44a2d0,_0x259e20),console[_0x231f3a(0xf6)](a34_0x55a197[_0x231f3a(0xfc)]('✓')+_0x231f3a(0x11e)+_0x44a2d0+_0x231f3a(0xde)+_0x39edde+'='+(_0x2552c6||_0x231f3a(0xd6))),0x0;}}function a34_0x430b(_0x8e0f2e,_0x3e35d7){_0x8e0f2e=_0x8e0f2e-0xd3;const _0x121a7e=a34_0x121a();let _0x430b06=_0x121a7e[_0x8e0f2e];return _0x430b06;}export class ProfileUseCommand extends BaseCommand{[a34_0x3fe3d6(0x13d)]=a34_0x3fe3d6(0xf0);['description']='Set\x20session\x20profile';[a34_0x3fe3d6(0xf9)](_0x5e3734){const _0x3b9025=a34_0x3fe3d6,{args:_0x536af8}=_0x5e3734;if(_0x536af8[_0x3b9025(0x111)]===0x0)return _0x3b9025(0xd7);return undefined;}async[a34_0x3fe3d6(0x138)](_0x508f9a){const _0x25c573=a34_0x3fe3d6,{args:_0x3ddafb,options:_0x35b7d4}=_0x508f9a,_0x44c669=_0x3ddafb[0x0],_0xd838=_0x35b7d4[_0x25c573(0xf3)];cleanExpiredSessions();if(!profileExists(_0x44c669)){console[_0x25c573(0xd5)](a34_0x55a197[_0x25c573(0x108)](_0x25c573(0x11c)+_0x44c669+'\x27\x20does\x20not\x20exist.')),console['log'](_0x25c573(0x124));const _0x46f10e=listProfiles();if(_0x46f10e[_0x25c573(0x111)]===0x0)console[_0x25c573(0xf6)](_0x25c573(0x137));else for(const _0xb77790 of _0x46f10e){console['log'](_0x25c573(0x126)+_0xb77790['name']);}return 0x1;}if(_0xd838){const _0x747dec=a34_0x1f33db['join'](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x44c669),console['log']('Default\x20profile\x20set\x20to:\x20'+a34_0x55a197[_0x25c573(0xfc)](_0x44c669)),console[_0x25c573(0xf6)](a34_0x55a197['dim'](_0x25c573(0xfb)+_0x747dec)),0x0;}const _0x3c2485=getSessionID(_0x35b7d4[_0x25c573(0x106)]);return saveSessionContext({'profile':_0x44c669},_0x35b7d4[_0x25c573(0x106)]),console['log'](_0x25c573(0x112)+a34_0x55a197[_0x25c573(0xfc)](_0x44c669)+'\x20'+a34_0x55a197['dim'](_0x25c573(0x12d)+_0x3c2485+')')),console[_0x25c573(0xf6)](a34_0x55a197[_0x25c573(0x12b)](_0x25c573(0xe1)+_0x44c669+_0x25c573(0x129))),0x0;}}function a34_0x121a(){const _0x38bf36=['\x20API\x20key\x20is\x20valid\x20(User:\x20','\x0aSaved\x20to:\x20','green','bold','text','password','Remove\x20a\x20profile','trim','split','Failed\x20to\x20remove\x20profile:\x20','\x27\x20removed\x20from\x20configuration','logLevel','session','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','red','40mFljHT','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','1165700SfmQlA','Validating\x20API\x20key...','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','/app/mp/ak','Enter\x20your\x20TD\x20API\x20key:','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','length','Session\x20profile\x20set\x20to:\x20','11762TEytzW','yellow','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','\x0aOperation\x20cancelled','message','Setup\x20cancelled','includes','593703hWfaMz','warn','Profile\x20\x27','Enter\x20description\x20(optional):','\x20Profile\x20\x27','API\x20key\x20cannot\x20be\x20empty','✗\x20Validation\x20failed:\x20','Choose\x20authentication\x20method:','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','2223690JwUgwK','\x0aAvailable\x20profiles:','jobs','\x20\x20-\x20','Set\x20a\x20profile\x20configuration\x20value','\x0aSetup\x20cancelled','\x20--default\x27\x20to\x20save\x20permanently','VALID_KEYS','dim','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>','(session:\x20','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','Changing\x20site\x20to\x20\x27','description','apiKey','us01','email','test','Site\x20was\x20not\x20changed.','Create\x20a\x20new\x20profile','\x20\x20(no\x20profiles\x20found)','execute','method','543762dpJtYk','34100HroaeI','join','name','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','profile:remove','error','(cleared)','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','tdx:\x20profile\x20create','\x27\x20does\x20not\x20exist.','\x27\x20requires\x20API\x20key\x20validation.','status','Operation\x20cancelled','llm_agent','\x27\x20updated:\x20','Profile\x20name\x20cannot\x20be\x20empty','create','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','profileName','llm_project','1006484VuxzOl','site','\x27.\x0a\x0aValid\x20keys:\x20','select','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','config','13sMioMU','\x20\x20tdx\x20--profile\x20','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','profile','6UlCvfw','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','profile:use','\x27\x20does\x20not\x20exist.\x20Create\x20it?','confirm','default','ERROR','1562SHKgjM','log','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','database','validate'];a34_0x121a=function(){return _0x38bf36;};return a34_0x121a();}
@@ -1 +1 @@
1
- const a35_0x402504=a35_0x590a;(function(_0x85cf6d,_0x2c6240){const _0x2dcc3e=a35_0x590a,_0x55d020=_0x85cf6d();while(!![]){try{const _0x438a8b=-parseInt(_0x2dcc3e(0x88))/0x1*(parseInt(_0x2dcc3e(0x7f))/0x2)+parseInt(_0x2dcc3e(0x78))/0x3*(parseInt(_0x2dcc3e(0x7d))/0x4)+-parseInt(_0x2dcc3e(0x7b))/0x5+parseInt(_0x2dcc3e(0x8f))/0x6+-parseInt(_0x2dcc3e(0x8e))/0x7+parseInt(_0x2dcc3e(0x8d))/0x8*(-parseInt(_0x2dcc3e(0x8a))/0x9)+-parseInt(_0x2dcc3e(0x8c))/0xa*(-parseInt(_0x2dcc3e(0x80))/0xb);if(_0x438a8b===_0x2c6240)break;else _0x55d020['push'](_0x55d020['shift']());}catch(_0x233589){_0x55d020['push'](_0x55d020['shift']());}}}(a35_0x5aa8,0x6ccef));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a35_0x5aa8(){const _0x13f68f=['message','16pjWAAo','\x20\x20Global:\x20~/.config/tdx/tdx.json','282awYsqV','2398aSayXo','length','config','error','dim','List\x20all\x20available\x20profiles','site','log','2721uzRPXB','Error:\x20','51201aysjkm','map','55770UQJjye','296KIvTuK','1718486bawhab','4081392RjjpbH','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','green','scope','description','31143aWMnkm','name','👤\x20','3261055YrEjjB'];a35_0x5aa8=function(){return _0x13f68f;};return a35_0x5aa8();}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';function a35_0x590a(_0x2ebcae,_0x498d9a){_0x2ebcae=_0x2ebcae-0x76;const _0x5aa8c3=a35_0x5aa8();let _0x590a2f=_0x5aa8c3[_0x2ebcae];return _0x590a2f;}import a35_0x8e6730 from'chalk';export class ProfilesCommand extends BaseCommand{['name']='profiles';[a35_0x402504(0x77)]=a35_0x402504(0x85);async['execute'](_0x10149e){const _0xf55be2=a35_0x402504,{options:_0x298087}=_0x10149e;try{const _0x10510e=listProfiles(),_0x2baa1d=getActiveProfile();if(_0x10510e[_0xf55be2(0x81)]===0x0)return console['log']('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console[_0xf55be2(0x87)](_0xf55be2(0x90)),console[_0xf55be2(0x87)](_0xf55be2(0x7e)),0x0;const _0x46016b=_0x10510e[_0xf55be2(0x8b)](_0x37625d=>{const _0x5f14ad=_0xf55be2,_0x19f509=_0x37625d[_0x5f14ad(0x79)]===_0x2baa1d,_0x40df40=getProfileParams(_0x37625d['config']);return{'name':_0x37625d[_0x5f14ad(0x79)],'active':_0x19f509,'scope':_0x37625d[_0x5f14ad(0x76)],'description':_0x37625d[_0x5f14ad(0x82)][_0x5f14ad(0x77)]||'','params':_0x40df40};});if(isStructuredFormat(_0x298087))await handleSDKOutput(_0x46016b,_0x298087);else for(const _0x3a2821 of _0x10510e){const _0x3b9d15=_0x3a2821[_0xf55be2(0x79)]===_0x2baa1d?a35_0x8e6730[_0xf55be2(0x91)]('\x20✓'):'',_0x2ff571=_0x3a2821[_0xf55be2(0x82)][_0xf55be2(0x86)]?a35_0x8e6730[_0xf55be2(0x84)]('\x20'+_0x3a2821['config'][_0xf55be2(0x86)]):'',_0x273990=_0x3a2821[_0xf55be2(0x82)]['description']?a35_0x8e6730[_0xf55be2(0x84)]('\x20\x20'+_0x3a2821[_0xf55be2(0x82)][_0xf55be2(0x77)]):'';console['log'](_0xf55be2(0x7a)+_0x3a2821['name']+_0x3b9d15+_0x2ff571+_0x273990);}return 0x0;}catch(_0x1d87e0){return _0x1d87e0 instanceof Error&&console[_0xf55be2(0x83)](_0xf55be2(0x89)+_0x1d87e0[_0xf55be2(0x7c)]),0x1;}}}
1
+ function a35_0x1990(_0x311f07,_0x57f6a9){_0x311f07=_0x311f07-0x1e7;const _0x52fc67=a35_0x52fc();let _0x1990c7=_0x52fc67[_0x311f07];return _0x1990c7;}const a35_0x2afa1a=a35_0x1990;(function(_0x59de76,_0x474069){const _0x872dcf=a35_0x1990,_0xc63036=_0x59de76();while(!![]){try{const _0x244d24=parseInt(_0x872dcf(0x1f6))/0x1*(parseInt(_0x872dcf(0x1f3))/0x2)+-parseInt(_0x872dcf(0x1f5))/0x3*(-parseInt(_0x872dcf(0x1e7))/0x4)+-parseInt(_0x872dcf(0x1ea))/0x5+parseInt(_0x872dcf(0x202))/0x6*(parseInt(_0x872dcf(0x1fa))/0x7)+parseInt(_0x872dcf(0x1f9))/0x8+parseInt(_0x872dcf(0x1e9))/0x9*(parseInt(_0x872dcf(0x1fe))/0xa)+-parseInt(_0x872dcf(0x203))/0xb*(parseInt(_0x872dcf(0x1f8))/0xc);if(_0x244d24===_0x474069)break;else _0xc63036['push'](_0xc63036['shift']());}catch(_0x6663ba){_0xc63036['push'](_0xc63036['shift']());}}}(a35_0x52fc,0x67ec5));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a35_0x52fc(){const _0x2b1f0d=['12dPOzvC','2175040TEcaeX','410207rzUYKu','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','description','273970pkERbL','name','execute','scope','6JfcaLq','14453274LYUNZd','3141796BUQrdK','👤\x20','153hwBBFI','1526555FihXoE','Error:\x20','List\x20all\x20available\x20profiles','green','site','map','length','message','\x20\x20Global:\x20~/.config/tdx/tdx.json','2TlUpFc','config','3clHWnY','463235XvLZmW','log'];a35_0x52fc=function(){return _0x2b1f0d;};return a35_0x52fc();}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a35_0x355e69 from'chalk';export class ProfilesCommand extends BaseCommand{[a35_0x2afa1a(0x1ff)]='profiles';[a35_0x2afa1a(0x1fd)]=a35_0x2afa1a(0x1ec);async[a35_0x2afa1a(0x200)](_0x657859){const _0x30dcbf=a35_0x2afa1a,{options:_0x31fcb1}=_0x657859;try{const _0x44a2a0=listProfiles(),_0xa7b880=getActiveProfile();if(_0x44a2a0[_0x30dcbf(0x1f0)]===0x0)return console[_0x30dcbf(0x1f7)](_0x30dcbf(0x1fc)),console['log'](_0x30dcbf(0x1fb)),console['log'](_0x30dcbf(0x1f2)),0x0;const _0x1a1e65=_0x44a2a0[_0x30dcbf(0x1ef)](_0xf2c6aa=>{const _0x59cd78=_0x30dcbf,_0xbac1b3=_0xf2c6aa[_0x59cd78(0x1ff)]===_0xa7b880,_0xe41a8e=getProfileParams(_0xf2c6aa[_0x59cd78(0x1f4)]);return{'name':_0xf2c6aa[_0x59cd78(0x1ff)],'active':_0xbac1b3,'scope':_0xf2c6aa[_0x59cd78(0x201)],'description':_0xf2c6aa[_0x59cd78(0x1f4)][_0x59cd78(0x1fd)]||'','params':_0xe41a8e};});if(isStructuredFormat(_0x31fcb1))await handleSDKOutput(_0x1a1e65,_0x31fcb1);else for(const _0x1c211d of _0x44a2a0){const _0x502a4f=_0x1c211d[_0x30dcbf(0x1ff)]===_0xa7b880?a35_0x355e69[_0x30dcbf(0x1ed)]('\x20✓'):'',_0x2431bc=_0x1c211d[_0x30dcbf(0x1f4)]['site']?a35_0x355e69['dim']('\x20'+_0x1c211d[_0x30dcbf(0x1f4)][_0x30dcbf(0x1ee)]):'',_0x5f0452=_0x1c211d['config'][_0x30dcbf(0x1fd)]?a35_0x355e69['dim']('\x20\x20'+_0x1c211d[_0x30dcbf(0x1f4)][_0x30dcbf(0x1fd)]):'';console[_0x30dcbf(0x1f7)](_0x30dcbf(0x1e8)+_0x1c211d[_0x30dcbf(0x1ff)]+_0x502a4f+_0x2431bc+_0x5f0452);}return 0x0;}catch(_0x15f06e){return _0x15f06e instanceof Error&&console['error'](_0x30dcbf(0x1eb)+_0x15f06e[_0x30dcbf(0x1f1)]),0x1;}}}
@@ -1 +1 @@
1
- const a36_0x2cf192=a36_0x2fa9;(function(_0x318084,_0x2203c9){const _0x510a08=a36_0x2fa9,_0x5a2334=_0x318084();while(!![]){try{const _0x4b50d4=-parseInt(_0x510a08(0x187))/0x1+-parseInt(_0x510a08(0x170))/0x2*(-parseInt(_0x510a08(0x179))/0x3)+parseInt(_0x510a08(0x167))/0x4*(-parseInt(_0x510a08(0x18d))/0x5)+parseInt(_0x510a08(0x190))/0x6+-parseInt(_0x510a08(0x16f))/0x7+parseInt(_0x510a08(0x186))/0x8*(parseInt(_0x510a08(0x197))/0x9)+parseInt(_0x510a08(0x188))/0xa;if(_0x4b50d4===_0x2203c9)break;else _0x5a2334['push'](_0x5a2334['shift']());}catch(_0x5bd7b4){_0x5a2334['push'](_0x5a2334['shift']());}}}(a36_0x108f,0xd1de4));import{BaseCommand}from'./command.js';function a36_0x108f(){const _0x4e9314=['description','Executing\x20statement\x20','execute','1251795EjbOrm','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','options','7766424aSSmqB','totalSplits','Error:\x20','validate','query','push','catalog','9UDapsh','\x20rows\x20','in\x20','20kUuBWT','No\x20SQL\x20provided','data','message','output','verbose','Schema:\x20','information_schema','6197499KIpWTY','1966eWlGxy','Catalog:\x20','completedSplits','processedRows','setExtra','file','\x20splits','stats','Site:\x20','2343BOtpNC','length','\x20[Job\x20ID:\x20','Executing\x20query\x20[','\x0aAll\x20results\x20saved\x20to\x20','Executing\x20query...','originalMessage','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','Run\x20Trino\x20queries\x20(streaming)','database','Query\x20completed:\x20Processed\x20','Statement\x20','error','2278472QzIIyX','1312416saAXAs','19622520KUgDTg','site'];a36_0x108f=function(){return _0x4e9314;};return a36_0x108f();}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 a36_0x2fa9(_0x44659f,_0x17e778){_0x44659f=_0x44659f-0x165;const _0x108f1b=a36_0x108f();let _0x2fa9fc=_0x108f1b[_0x44659f];return _0x2fa9fc;}export class QueryCommand extends BaseCommand{['name']=a36_0x2cf192(0x194);[a36_0x2cf192(0x18a)]=a36_0x2cf192(0x181);async[a36_0x2cf192(0x18c)](_0x543236){const _0x41d086=a36_0x2cf192,{options:_0x4cb100,args:_0x207ce4,tdx:_0x1364b4}=_0x543236,_0x511c35={..._0x4cb100,'limitStructuredFormats':!![]},_0x1b0678=_0x207ce4[0x0],_0x1c6b41=_0x4cb100[_0x41d086(0x175)];let _0x4bb1c3;try{if(_0x1c6b41)_0x4bb1c3=readSqlStatementsFromFile(_0x1c6b41);else{if(_0x1b0678==='-')_0x4bb1c3=await readSqlStatementsFromStdin();else{if(_0x1b0678&&isSqlFilePath(_0x1b0678))_0x4bb1c3=readSqlStatementsFromFile(_0x1b0678);else{if(_0x1b0678)_0x4bb1c3=splitSqlStatements(_0x1b0678);else throw new Error(_0x41d086(0x168));}}}}catch(_0x31a1ce){return console['error'](_0x41d086(0x192)+_0x31a1ce[_0x41d086(0x16a)]),0x1;}const _0x5ec131=_0x4cb100[_0x41d086(0x182)]||_0x41d086(0x16e),_0x39eac1=_0x4cb100[_0x41d086(0x196)];try{const _0x321b78=[],_0x53f911=!!_0x4cb100['output'];for(let _0x847968=0x0;_0x847968<_0x4bb1c3[_0x41d086(0x17a)];_0x847968++){const _0x70f719=_0x4bb1c3[_0x847968],_0x1784a9=_0x847968+0x1,_0xae187f=_0x4bb1c3[_0x41d086(0x17a)],_0x5176d2=_0xae187f>0x1;_0x4cb100['verbose']&&(console[_0x41d086(0x185)]('\x0a'+(_0x5176d2?'Statement\x20'+_0x1784a9+'/'+_0xae187f+':':'')),console[_0x41d086(0x185)](_0x41d086(0x178)+_0x4cb100[_0x41d086(0x189)]),console['error'](_0x41d086(0x171)+(_0x39eac1||'td')),console[_0x41d086(0x185)](_0x41d086(0x16d)+_0x5ec131),console[_0x41d086(0x185)]('SQL:\x20'+_0x70f719));const _0x494fd7=_0x5176d2?_0x41d086(0x18b)+_0x1784a9+'/'+_0xae187f+'...':_0x41d086(0x17e);try{const _0x486e1d=await withProgressSpinner(_0x494fd7,async _0x2700dd=>{const _0x3777d4=_0x41d086,_0x2b8558=await _0x1364b4['query'][_0x3777d4(0x18c)](_0x70f719,{'catalog':_0x39eac1,'schema':_0x5ec131,'onJobId':_0x4ecf6c=>{_0x2700dd['setJobId'](_0x4ecf6c);},'onProgress':_0x34d6bf=>{const _0x1ceb8b=_0x3777d4;_0x2700dd['setPhase'](_0x1ceb8b(0x17c)+_0x34d6bf['state']+']'),_0x2700dd[_0x1ceb8b(0x174)](formatRows(_0x34d6bf[_0x1ceb8b(0x173)])+_0x1ceb8b(0x165)+_0x34d6bf[_0x1ceb8b(0x172)]+'/'+_0x34d6bf[_0x1ceb8b(0x191)]+_0x1ceb8b(0x176));}});return _0x2b8558;},{'verbose':_0x4cb100[_0x41d086(0x16c)]}),_0x214fa7=_0x486e1d[_0x41d086(0x169)],_0x33feda=_0x214fa7['jobId']?_0x41d086(0x17b)+_0x214fa7['jobId']+']':'',_0x2e3ea2=_0x5176d2?_0x41d086(0x184)+_0x1784a9+'/'+_0xae187f+'\x20-\x20':'';console[_0x41d086(0x185)]('✔\x20'+_0x2e3ea2+_0x41d086(0x183)+formatRows(_0x214fa7['stats'][_0x41d086(0x173)])+_0x41d086(0x165)+(_0x41d086(0x166)+formatElapsed(_0x214fa7[_0x41d086(0x177)]['elapsedTimeMillis'])+_0x33feda));if(_0x5176d2&&_0x53f911){const _0x42913d=resolveOutputOptions(_0x511c35),_0x5e658a=await formatQueryOutput(_0x214fa7,_0x42913d);_0x321b78[_0x41d086(0x195)](_0x5e658a);}else await handleQueryOutput(_0x214fa7,_0x511c35);}catch(_0x21e7b0){const _0x5b60e8=_0x5176d2?_0x41d086(0x184)+_0x1784a9+'/'+_0xae187f+':\x0a':'',_0x3bff6d=_0x21e7b0 instanceof SDKError?_0x21e7b0[_0x41d086(0x17f)]:_0x21e7b0[_0x41d086(0x16a)];return console['error'](''+_0x5b60e8+_0x3bff6d),0x1;}}if(_0x4bb1c3[_0x41d086(0x17a)]>0x1&&_0x53f911&&_0x321b78['length']>0x0){const _0x752935=_0x321b78['join']('\x0a');writeFileSync(_0x4cb100[_0x41d086(0x16b)],_0x752935),console[_0x41d086(0x185)](_0x41d086(0x17d)+_0x4cb100[_0x41d086(0x16b)]);}return 0x0;}catch(_0x224f43){throw _0x224f43;}}[a36_0x2cf192(0x193)](_0x5075b4){const _0x4e15c3=a36_0x2cf192,_0x416e4f=_0x5075b4['args'][0x0],_0x546066=_0x5075b4[_0x4e15c3(0x18f)][_0x4e15c3(0x175)];if(!_0x416e4f&&!_0x546066)return _0x4e15c3(0x18e);if(_0x416e4f&&_0x546066)return _0x4e15c3(0x180);return undefined;}}
1
+ const a36_0xb9b665=a36_0x5d87;(function(_0x354eb4,_0x289ee7){const _0x55fb6c=a36_0x5d87,_0x1fa1cc=_0x354eb4();while(!![]){try{const _0x3f3eb7=parseInt(_0x55fb6c(0xea))/0x1+parseInt(_0x55fb6c(0xbf))/0x2*(parseInt(_0x55fb6c(0xe9))/0x3)+parseInt(_0x55fb6c(0xe4))/0x4*(-parseInt(_0x55fb6c(0xcb))/0x5)+-parseInt(_0x55fb6c(0xdf))/0x6*(parseInt(_0x55fb6c(0xcc))/0x7)+-parseInt(_0x55fb6c(0xbb))/0x8*(-parseInt(_0x55fb6c(0xca))/0x9)+-parseInt(_0x55fb6c(0xd0))/0xa+parseInt(_0x55fb6c(0xee))/0xb*(parseInt(_0x55fb6c(0xed))/0xc);if(_0x3f3eb7===_0x289ee7)break;else _0x1fa1cc['push'](_0x1fa1cc['shift']());}catch(_0x47ef3a){_0x1fa1cc['push'](_0x1fa1cc['shift']());}}}(a36_0x36cd,0xd50ea));function a36_0x36cd(){const _0x5552d8=['args','execute','message','options','push','Executing\x20statement\x20','54diPQoz','95JSpFkH','7HpsQgO','originalMessage','length','processedRows','16649540fgKwPY','catalog','\x20[Job\x20ID:\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','verbose','Executing\x20query\x20[','completedSplits','Site:\x20','file','totalSplits','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','SQL:\x20','data','Error:\x20','...','8072490giNxmL','database','information_schema','Statement\x20','error','34308siPegd','stats','query','site','No\x20SQL\x20provided','9YaYtIc','268881vdAwVa','description','join','62796BcMrNh','3014vnfGzR','output','\x20splits','Schema:\x20','2326328ZmvaYh','validate','Executing\x20query...','state','399030tNlVmH','Query\x20completed:\x20Processed\x20','Catalog:\x20','jobId','\x20rows\x20'];a36_0x36cd=function(){return _0x5552d8;};return a36_0x36cd();}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a36_0x5d87(_0x1b264d,_0x42a973){_0x1b264d=_0x1b264d-0xbb;const _0x36cd4e=a36_0x36cd();let _0x5d8747=_0x36cd4e[_0x1b264d];return _0x5d8747;}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{['name']=a36_0xb9b665(0xe6);[a36_0xb9b665(0xeb)]='Run\x20Trino\x20queries\x20(streaming)';async['execute'](_0x503b84){const _0x49b111=a36_0xb9b665,{options:_0x4d3f15,args:_0x33a2ac,tdx:_0x1d5a33}=_0x503b84,_0x9f33ae={..._0x4d3f15,'limitStructuredFormats':!![]},_0x3423c4=_0x33a2ac[0x0],_0x5acad2=_0x4d3f15['file'];let _0x1508af;try{if(_0x5acad2)_0x1508af=readSqlStatementsFromFile(_0x5acad2);else{if(_0x3423c4==='-')_0x1508af=await readSqlStatementsFromStdin();else{if(_0x3423c4&&isSqlFilePath(_0x3423c4))_0x1508af=readSqlStatementsFromFile(_0x3423c4);else{if(_0x3423c4)_0x1508af=splitSqlStatements(_0x3423c4);else throw new Error(_0x49b111(0xe8));}}}}catch(_0x55ff05){return console['error'](_0x49b111(0xdd)+_0x55ff05[_0x49b111(0xc6)]),0x1;}const _0x41d392=_0x4d3f15[_0x49b111(0xe0)]||_0x49b111(0xe1),_0x3c1a26=_0x4d3f15[_0x49b111(0xd1)];try{const _0x53adad=[],_0x1a32fe=!!_0x4d3f15[_0x49b111(0xef)];for(let _0x3fcaec=0x0;_0x3fcaec<_0x1508af[_0x49b111(0xce)];_0x3fcaec++){const _0x14e7a5=_0x1508af[_0x3fcaec],_0x152620=_0x3fcaec+0x1,_0x4c8899=_0x1508af[_0x49b111(0xce)],_0x29c2ee=_0x4c8899>0x1;_0x4d3f15[_0x49b111(0xd4)]&&(console[_0x49b111(0xe3)]('\x0a'+(_0x29c2ee?_0x49b111(0xe2)+_0x152620+'/'+_0x4c8899+':':'')),console[_0x49b111(0xe3)](_0x49b111(0xd7)+_0x4d3f15[_0x49b111(0xe7)]),console[_0x49b111(0xe3)](_0x49b111(0xc1)+(_0x3c1a26||'td')),console[_0x49b111(0xe3)](_0x49b111(0xf1)+_0x41d392),console[_0x49b111(0xe3)](_0x49b111(0xdb)+_0x14e7a5));const _0x15d118=_0x29c2ee?_0x49b111(0xc9)+_0x152620+'/'+_0x4c8899+_0x49b111(0xde):_0x49b111(0xbd);try{const _0x5059c0=await withProgressSpinner(_0x15d118,async _0x40c576=>{const _0x2bbdff=_0x49b111,_0x46fc76=await _0x1d5a33['query'][_0x2bbdff(0xc5)](_0x14e7a5,{'catalog':_0x3c1a26,'schema':_0x41d392,'onJobId':_0x4abdf0=>{_0x40c576['setJobId'](_0x4abdf0);},'onProgress':_0x1bee87=>{const _0x481206=_0x2bbdff;_0x40c576['setPhase'](_0x481206(0xd5)+_0x1bee87[_0x481206(0xbe)]+']'),_0x40c576['setExtra'](formatRows(_0x1bee87[_0x481206(0xcf)])+'\x20rows\x20'+_0x1bee87[_0x481206(0xd6)]+'/'+_0x1bee87[_0x481206(0xd9)]+_0x481206(0xf0));}});return _0x46fc76;},{'verbose':_0x4d3f15[_0x49b111(0xd4)]}),_0x30b776=_0x5059c0[_0x49b111(0xdc)],_0x123f70=_0x30b776['jobId']?_0x49b111(0xd2)+_0x30b776[_0x49b111(0xc2)]+']':'',_0x545865=_0x29c2ee?'Statement\x20'+_0x152620+'/'+_0x4c8899+'\x20-\x20':'';console[_0x49b111(0xe3)]('✔\x20'+_0x545865+_0x49b111(0xc0)+formatRows(_0x30b776[_0x49b111(0xe5)][_0x49b111(0xcf)])+_0x49b111(0xc3)+('in\x20'+formatElapsed(_0x30b776[_0x49b111(0xe5)]['elapsedTimeMillis'])+_0x123f70));if(_0x29c2ee&&_0x1a32fe){const _0x49826d=resolveOutputOptions(_0x9f33ae),_0x3a2e66=await formatQueryOutput(_0x30b776,_0x49826d);_0x53adad[_0x49b111(0xc8)](_0x3a2e66);}else await handleQueryOutput(_0x30b776,_0x9f33ae);}catch(_0x58faae){const _0xbe2352=_0x29c2ee?_0x49b111(0xe2)+_0x152620+'/'+_0x4c8899+':\x0a':'',_0x5d16ce=_0x58faae instanceof SDKError?_0x58faae[_0x49b111(0xcd)]:_0x58faae['message'];return console[_0x49b111(0xe3)](''+_0xbe2352+_0x5d16ce),0x1;}}if(_0x1508af['length']>0x1&&_0x1a32fe&&_0x53adad[_0x49b111(0xce)]>0x0){const _0x222ccb=_0x53adad[_0x49b111(0xec)]('\x0a');writeFileSync(_0x4d3f15['output'],_0x222ccb),console[_0x49b111(0xe3)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x4d3f15[_0x49b111(0xef)]);}return 0x0;}catch(_0x5442d8){throw _0x5442d8;}}[a36_0xb9b665(0xbc)](_0x1ed04b){const _0x5527b9=a36_0xb9b665,_0x360f93=_0x1ed04b[_0x5527b9(0xc4)][0x0],_0x3e7b58=_0x1ed04b[_0x5527b9(0xc7)][_0x5527b9(0xd8)];if(!_0x360f93&&!_0x3e7b58)return _0x5527b9(0xda);if(_0x360f93&&_0x3e7b58)return _0x5527b9(0xd3);return undefined;}}
@@ -1 +1 @@
1
- const a37_0xcb1009=a37_0x1001;(function(_0x5f138d,_0x2f71c1){const _0x503cd1=a37_0x1001,_0x4c6aac=_0x5f138d();while(!![]){try{const _0x29f010=-parseInt(_0x503cd1(0x143))/0x1+parseInt(_0x503cd1(0xb7))/0x2*(parseInt(_0x503cd1(0x11f))/0x3)+parseInt(_0x503cd1(0xdd))/0x4+parseInt(_0x503cd1(0xc4))/0x5*(parseInt(_0x503cd1(0xe1))/0x6)+-parseInt(_0x503cd1(0xd9))/0x7+-parseInt(_0x503cd1(0xbb))/0x8*(parseInt(_0x503cd1(0x10a))/0x9)+parseInt(_0x503cd1(0xf0))/0xa;if(_0x29f010===_0x2f71c1)break;else _0x4c6aac['push'](_0x4c6aac['shift']());}catch(_0x21aed0){_0x4c6aac['push'](_0x4c6aac['shift']());}}}(a37_0x541b,0x3cf0a));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a37_0x38395d from'chalk';function formatRelativeTime(_0xa26682){const _0x111276=a37_0x1001,_0x91e161=new Date(_0xa26682),_0x36ca47=new Date(),_0x17da90=_0x91e161[_0x111276(0xc3)]()-_0x36ca47[_0x111276(0xc3)](),_0x659b4=Math['abs'](_0x17da90)/0x3e8,_0x369035=_0x17da90<0x0;if(_0x659b4<0x3c)return _0x369035?'just\x20now':_0x111276(0xdc);else{if(_0x659b4<0xe10){const _0x389883=Math['round'](_0x659b4/0x3c);return _0x369035?_0x389883+_0x111276(0xc0):'in\x20'+_0x389883+'m';}else{if(_0x659b4<0x15180){const _0x21fb52=Math[_0x111276(0xfd)](_0x659b4/0xe10);return _0x369035?_0x21fb52+_0x111276(0xde):_0x111276(0x125)+_0x21fb52+'h';}else{if(_0x659b4<0x93a80){const _0x49e04c=Math['round'](_0x659b4/0x15180);return _0x369035?_0x49e04c+_0x111276(0x124):_0x111276(0x125)+_0x49e04c+'d';}else return _0x91e161['toLocaleDateString']();}}}}export class ScheduleListCommand extends BaseCommand{['name']='schedule:list';[a37_0xcb1009(0x118)]=a37_0xcb1009(0xf7);async[a37_0xcb1009(0xe9)](_0x1dea77){const _0x4ec433=a37_0xcb1009,{options:_0x56cb87,args:_0x482c39,tdx:_0x28dbc8}=_0x1dea77,_0x5cebff=resolveLimit(_0x56cb87[_0x4ec433(0xd0)],DEFAULT_DISPLAY_LIMIT),_0x574f35=_0x482c39[0x0],_0x1f8aeb=_0x574f35?'Searching\x20scheduled\x20queries\x20matching\x20\x22'+_0x574f35+_0x4ec433(0x138):_0x4ec433(0x13f),_0x29edf3=await withSpinner(_0x1f8aeb,()=>_0x28dbc8['schedules'][_0x4ec433(0xe7)]({'limit':_0x5cebff,'scheduled':!![],'pattern':_0x574f35}),{'verbose':_0x56cb87[_0x4ec433(0x13e)]}),_0x530d34=_0x29edf3[_0x4ec433(0x149)][_0x4ec433(0xf6)],_0x50aef4=_0x29edf3['data'][_0x4ec433(0x105)][_0x4ec433(0xc5)],_0x1910c4=_0x574f35?_0x4ec433(0xfc)+_0x574f35+'\x22':'';_0x50aef4?console[_0x4ec433(0xff)](_0x4ec433(0x112)+_0x530d34[_0x4ec433(0x11e)]+_0x4ec433(0x10d)+_0x1910c4+'\x20(use\x20--limit\x20to\x20see\x20more)'):console[_0x4ec433(0xff)](_0x4ec433(0x146)+_0x530d34[_0x4ec433(0x11e)]+_0x4ec433(0x139)+(_0x530d34[_0x4ec433(0x11e)]!==0x1?_0x4ec433(0x131):'y')+_0x1910c4);if(_0x56cb87[_0x4ec433(0x134)]===_0x4ec433(0xec)||_0x56cb87[_0x4ec433(0x134)]===_0x4ec433(0xc1)||_0x56cb87[_0x4ec433(0x134)]===_0x4ec433(0x13a)||_0x56cb87[_0x4ec433(0x134)]===_0x4ec433(0xe3)){const _0x2a7fd9=_0x530d34[_0x4ec433(0xed)](_0x397707=>({'id':_0x397707['id'],'name':_0x397707[_0x4ec433(0xba)],'cron':_0x397707[_0x4ec433(0xd8)],'database':_0x397707['database']?.[_0x4ec433(0xba)],'type':_0x397707[_0x4ec433(0xbf)],'timezone':_0x397707[_0x4ec433(0xe4)],'user_name':_0x397707['user']?.[_0x4ec433(0xba)],'updated_at':_0x397707['updated_at'],'next_run_at':_0x397707[_0x4ec433(0xcd)],'last_job_status':_0x397707['last_job']?.[_0x4ec433(0xe0)]}));await handleSDKOutput(_0x2a7fd9,_0x56cb87);}else{if(_0x530d34[_0x4ec433(0x11e)]===0x0)console[_0x4ec433(0x116)](_0x4ec433(0x109));else{const _0x23c039=_0x56cb87[_0x4ec433(0xd7)],_0x43da20=_0x530d34[_0x4ec433(0xed)](_0x40f22c=>{const _0x23ff6d=_0x4ec433,_0x32edf8=_0x40f22c['last_job']?.[_0x23ff6d(0xe0)]?_0x40f22c[_0x23ff6d(0xf8)][_0x23ff6d(0xe0)]===_0x23ff6d(0xf2)?'✓':'✗':'-',_0x503b0c=_0x40f22c[_0x23ff6d(0xf8)]?.[_0x23ff6d(0x128)]?formatRelativeTime(_0x40f22c[_0x23ff6d(0xf8)][_0x23ff6d(0x128)]):_0x23ff6d(0x115),_0x56b5ba=_0x40f22c[_0x23ff6d(0xcd)]?formatRelativeTime(_0x40f22c[_0x23ff6d(0xcd)]):'-',_0x15c6a5=_0x40f22c[_0x23ff6d(0xd8)]||'',_0x4700eb=_0x40f22c[_0x23ff6d(0xba)]||'(unnamed)',_0x2c4305=getConsoleUrl(_0x23c039,_0x23ff6d(0xd4)+_0x40f22c['id']);return{'statusIcon':_0x32edf8,'lastRun':_0x503b0c,'nextRun':_0x56b5ba,'cron':_0x15c6a5,'name':_0x4700eb,'queryUrl':_0x2c4305,'status':_0x40f22c[_0x23ff6d(0xf8)]?.[_0x23ff6d(0xe0)]};}),_0x3c48d1=Math['max'](..._0x43da20[_0x4ec433(0xed)](_0x1d7733=>_0x1d7733[_0x4ec433(0xfb)][_0x4ec433(0x11e)])),_0x3b0615=Math[_0x4ec433(0x100)](..._0x43da20[_0x4ec433(0xed)](_0x11deee=>_0x11deee['nextRun'][_0x4ec433(0x11e)])),_0xef3987=Math[_0x4ec433(0x100)](..._0x43da20['map'](_0x48e28a=>_0x48e28a[_0x4ec433(0xd8)][_0x4ec433(0x11e)])),_0x4a239e=_0x43da20[_0x4ec433(0xed)](_0x49e073=>{const _0x5c7d2d=_0x4ec433,_0x135eca=_0x49e073['status']===_0x5c7d2d(0xf2)?a37_0x38395d[_0x5c7d2d(0x101)](_0x49e073[_0x5c7d2d(0xf4)]):_0x49e073[_0x5c7d2d(0xe0)]===_0x5c7d2d(0xff)?a37_0x38395d[_0x5c7d2d(0x12e)](_0x49e073[_0x5c7d2d(0xf4)]):a37_0x38395d['dim'](_0x49e073[_0x5c7d2d(0xf4)]),_0x523f76=_0x49e073[_0x5c7d2d(0xfb)]['padEnd'](_0x3c48d1),_0x31e489=_0x49e073[_0x5c7d2d(0xef)][_0x5c7d2d(0x11a)](_0x3b0615),_0x309528=_0x49e073['cron']?a37_0x38395d[_0x5c7d2d(0xe2)](_0x49e073[_0x5c7d2d(0xd8)][_0x5c7d2d(0x11a)](_0xef3987)):'\x20'[_0x5c7d2d(0x114)](_0xef3987),_0x2c19ad=hyperlink(_0x49e073[_0x5c7d2d(0xba)],_0x49e073[_0x5c7d2d(0x10c)]);return _0x5c7d2d(0xc7)+_0x135eca+'\x20'+_0x523f76+_0x5c7d2d(0xdb)+_0x31e489+'\x20\x20'+_0x309528+'\x20\x20'+_0x2c19ad;});await writeOutput(_0x4a239e[_0x4ec433(0x12f)]('\x0a'),_0x56cb87[_0x4ec433(0x137)],_0x4ec433(0xcc));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a37_0xcb1009(0xba)]='schedule:show';[a37_0xcb1009(0x118)]=a37_0xcb1009(0xb8);['validate'](_0x42f0bd){const _0x1126c9=a37_0xcb1009,_0x4bc0c9=_0x42f0bd[_0x1126c9(0xce)][0x0];if(!_0x4bc0c9)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async['execute'](_0x577c65){const _0x1fe66f=a37_0xcb1009,{options:_0x31a3b4,args:_0x5ebc4c,tdx:_0x2a7c76}=_0x577c65,_0x110842=_0x5ebc4c[0x0],_0x1e9fd4=await withSpinner(_0x1fe66f(0xc2),()=>_0x2a7c76[_0x1fe66f(0xd3)][_0x1fe66f(0x123)](_0x110842),{'verbose':_0x31a3b4['verbose']}),_0x14c269=_0x1e9fd4['data'],_0xb83830={'name':_0x14c269['name'],'cron':_0x14c269[_0x1fe66f(0xd8)],'database':_0x14c269['database'],'type':_0x14c269[_0x1fe66f(0xbf)],'timezone':_0x14c269['timezone'],'user_name':_0x14c269[_0x1fe66f(0xd6)],'created_at':_0x14c269[_0x1fe66f(0x127)],'engine_version':_0x14c269[_0x1fe66f(0x12d)],'executing_user_id':_0x14c269['executing_user_id'],'query':_0x14c269[_0x1fe66f(0x102)],'delay':_0x14c269[_0x1fe66f(0x130)],'priority':_0x14c269[_0x1fe66f(0x126)],'retry_limit':_0x14c269['retry_limit'],..._0x14c269[_0x1fe66f(0xbc)]&&{'result':_0x14c269[_0x1fe66f(0xbc)]}};return await handleSingleObjectOutput(_0xb83830,_0x31a3b4),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']=a37_0xcb1009(0x122);[a37_0xcb1009(0x118)]=a37_0xcb1009(0x135);[a37_0xcb1009(0xeb)](_0x3f1b02){const _0x2510d3=a37_0xcb1009,_0x2ec588=_0x3f1b02[_0x2510d3(0xce)][0x0];if(!_0x2ec588)return _0x2510d3(0xca);const _0x28839f=_0x3f1b02[_0x2510d3(0x107)];if(!_0x28839f['database'])return'Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';return undefined;}async[a37_0xcb1009(0xe9)](_0x107402){const _0x4399b4=a37_0xcb1009,{options:_0x165b4,args:_0x1033cb,tdx:_0x38c35a}=_0x107402,_0x32b205=_0x1033cb[0x0],_0x12dc43=_0x165b4,_0x410b19=_0x12dc43['database'],_0x137885=_0x12dc43[_0x4399b4(0x11b)],_0x169c48=_0x12dc43[_0x4399b4(0xbf)]||_0x4399b4(0x13c);let _0x97660e;try{_0x97660e=readFileSync(_0x137885,_0x4399b4(0x10e))[_0x4399b4(0xbe)]();}catch(_0x4b132c){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x4399b4(0x121)+_0x137885,_0x4b132c instanceof Error?_0x4b132c:undefined);}if(!_0x97660e)throw new SDKError(ErrorCode[_0x4399b4(0xb9)],_0x4399b4(0xbd));const _0x483db5={'database':_0x410b19,'query':_0x97660e,'type':_0x169c48};if(_0x12dc43[_0x4399b4(0xd8)])_0x483db5[_0x4399b4(0xd8)]=_0x12dc43[_0x4399b4(0xd8)];if(_0x12dc43['timezone'])_0x483db5[_0x4399b4(0xcf)]=_0x12dc43['timezone'];if(_0x12dc43[_0x4399b4(0x130)]!==undefined)_0x483db5['delay']=Number(_0x12dc43['delay']);if(_0x12dc43[_0x4399b4(0x126)]!==undefined)_0x483db5[_0x4399b4(0x126)]=Number(_0x12dc43[_0x4399b4(0x126)]);if(_0x12dc43['retryLimit']!==undefined)_0x483db5[_0x4399b4(0x106)]=Number(_0x12dc43[_0x4399b4(0xd5)]);if(_0x12dc43[_0x4399b4(0x108)])_0x483db5['engine_version']=_0x12dc43[_0x4399b4(0x108)];if(_0x12dc43[_0x4399b4(0xbc)])_0x483db5['result']=_0x12dc43[_0x4399b4(0xbc)];if(_0x165b4['verbose']){console[_0x4399b4(0xff)](_0x4399b4(0xf3)+_0x32b205),console[_0x4399b4(0xff)]('\x20\x20Database:\x20'+_0x410b19),console[_0x4399b4(0xff)]('\x20\x20Type:\x20'+_0x169c48);if(_0x483db5[_0x4399b4(0xd8)])console['error'](_0x4399b4(0x145)+_0x483db5[_0x4399b4(0xd8)]);if(_0x483db5['timezone'])console['error'](_0x4399b4(0xfe)+_0x483db5[_0x4399b4(0xcf)]);}const _0x1347cb=await withSpinner(_0x4399b4(0xda),()=>_0x38c35a['schedules'][_0x4399b4(0xe8)](_0x32b205,_0x483db5),{'verbose':_0x165b4[_0x4399b4(0x13e)]});return console['error'](_0x4399b4(0x10f)+_0x1347cb[_0x4399b4(0x149)][_0x4399b4(0xba)]),await handleSingleObjectOutput(_0x1347cb[_0x4399b4(0x149)],_0x165b4),0x0;}}function a37_0x541b(){const _0x17ae09=['cyan','tsv','time_zone','history','delete','listQueries','create','execute','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','validate','json','map','\x20execution','nextRun','1338910TURGpq','Running\x20schedule:\x20','success','Creating\x20schedule:\x20','statusIcon','\x20job','queries','List\x20scheduled\x20queries','last_job','entries','Show\x20schedule\x20execution\x20history','lastRun','\x20matching\x20\x22','round','\x20\x20Timezone:\x20','error','max','green','query','Getting\x20schedule\x20history...','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','pagination','retry_limit','options','engineVersion','No\x20scheduled\x20queries\x20found','9kEmdMa','Updating\x20schedule...','queryUrl','\x20schedules','utf-8','Schedule\x20created:\x20','update','\x20\x20Time:\x20','Showing\x20first\x20','from','repeat','never','log','\x20\x20Num:\x20','description','end_at','padEnd','file','\x20created','database','length','585NWjEnR','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','Failed\x20to\x20read\x20file:\x20','schedule:create','show','d\x20ago','in\x20','priority','created_at','ended_at','Delete\x20a\x20scheduled\x20query','keys','Update\x20a\x20scheduled\x20query','Updating\x20schedule:\x20','engine_version','red','join','delay','ies','substring','num','format','Create\x20a\x20scheduled\x20query','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','output','\x22...','\x20scheduled\x20quer','table','Schedule\x20run\x20submitted:\x20','trino','...','verbose','Listing\x20scheduled\x20queries...','schedule:run','Running\x20schedule...','time','111645YbgTCC','\x20\x20Job\x20ID:\x20','\x20\x20Cron:\x20','Found\x20','job_id','scheduled_at','data','2182HRdUQv','Show\x20schedule\x20details','INVALID_ARGUMENT','name','3584200pbqWPw','result','Query\x20file\x20is\x20empty','trim','type','m\x20ago','jsonl','Getting\x20schedule\x20details...','getTime','281655BjaITq','has_next_page','\x20(showing\x20','📅\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','Cancelled','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','run','list','next_run_at','args','timezone','limit','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','Schedule\x20deleted:\x20','schedules','/app/queries/editor?queryId=','retryLimit','user_name','site','cron','1201774DHDQZm','Creating\x20schedule...','\x20\x20→\x20','soon','960036BhBpvt','h\x20ago','start_at','status','42NWdZRr'];a37_0x541b=function(){return _0x17ae09;};return a37_0x541b();}export class ScheduleUpdateCommand extends BaseCommand{['name']='schedule:update';[a37_0xcb1009(0x118)]=a37_0xcb1009(0x12b);[a37_0xcb1009(0xeb)](_0x49c010){const _0x25bfbd=a37_0xcb1009,_0xc9875f=_0x49c010[_0x25bfbd(0xce)][0x0];if(!_0xc9875f)return _0x25bfbd(0xea);return undefined;}async['execute'](_0x318089){const _0x598f50=a37_0xcb1009,{options:_0x4d6f8a,args:_0x4019ad,tdx:_0x1fd32c}=_0x318089,_0x23da8c=_0x4019ad[0x0],_0x646385=_0x4d6f8a,_0x200dc8={};if(_0x646385[_0x598f50(0x11d)])_0x200dc8[_0x598f50(0x11d)]=_0x646385['database'];if(_0x646385[_0x598f50(0xbf)])_0x200dc8[_0x598f50(0xbf)]=_0x646385[_0x598f50(0xbf)];if(_0x646385['cron'])_0x200dc8[_0x598f50(0xd8)]=_0x646385[_0x598f50(0xd8)];if(_0x646385[_0x598f50(0xcf)])_0x200dc8[_0x598f50(0xcf)]=_0x646385['timezone'];if(_0x646385['delay']!==undefined)_0x200dc8['delay']=Number(_0x646385[_0x598f50(0x130)]);if(_0x646385[_0x598f50(0x126)]!==undefined)_0x200dc8[_0x598f50(0x126)]=Number(_0x646385['priority']);if(_0x646385[_0x598f50(0xd5)]!==undefined)_0x200dc8[_0x598f50(0x106)]=Number(_0x646385[_0x598f50(0xd5)]);if(_0x646385[_0x598f50(0x108)])_0x200dc8[_0x598f50(0x12d)]=_0x646385[_0x598f50(0x108)];if(_0x646385[_0x598f50(0xbc)])_0x200dc8[_0x598f50(0xbc)]=_0x646385['result'];if(_0x646385['file'])try{_0x200dc8['query']=readFileSync(_0x646385['file'],'utf-8')[_0x598f50(0xbe)]();}catch(_0x5ea651){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x598f50(0x121)+_0x646385[_0x598f50(0x11b)],_0x5ea651 instanceof Error?_0x5ea651:undefined);}if(Object[_0x598f50(0x12a)](_0x200dc8)[_0x598f50(0x11e)]===0x0)throw new SDKError(ErrorCode[_0x598f50(0xb9)],_0x598f50(0xd1));if(_0x4d6f8a[_0x598f50(0x13e)]){console[_0x598f50(0xff)](_0x598f50(0x12c)+_0x23da8c);for(const [_0x209de3,_0x50b9f5]of Object[_0x598f50(0xf9)](_0x200dc8)){_0x209de3===_0x598f50(0x102)?console[_0x598f50(0xff)]('\x20\x20'+_0x209de3+':\x20'+_0x50b9f5[_0x598f50(0x132)](0x0,0x32)+_0x598f50(0x13d)):console[_0x598f50(0xff)]('\x20\x20'+_0x209de3+':\x20'+_0x50b9f5);}}const _0x8ba52c=await withSpinner(_0x598f50(0x10b),()=>_0x1fd32c['schedules'][_0x598f50(0x110)](_0x23da8c,_0x200dc8),{'verbose':_0x4d6f8a['verbose']});return console[_0x598f50(0xff)]('Schedule\x20updated:\x20'+_0x8ba52c[_0x598f50(0x149)][_0x598f50(0xba)]),await handleSingleObjectOutput(_0x8ba52c[_0x598f50(0x149)],_0x4d6f8a),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{['name']='schedule:delete';['description']=a37_0xcb1009(0x129);[a37_0xcb1009(0xeb)](_0x232b66){const _0x197fc2=a37_0xcb1009,_0x240676=_0x232b66['args'][0x0];if(!_0x240676)return _0x197fc2(0xc8);return undefined;}async[a37_0xcb1009(0xe9)](_0x51718f){const _0x2b9af3=a37_0xcb1009,{options:_0x9a06bf,args:_0x130404,tdx:_0x3867bc}=_0x51718f,_0x15bcf5=_0x130404[0x0];if(!_0x9a06bf['yes']){const _0x24ecb6=await confirm(_0x2b9af3(0x104)+_0x15bcf5+'\x22?');if(!_0x24ecb6)return console[_0x2b9af3(0xff)](_0x2b9af3(0xc9)),0x0;}const _0x23d194=await withSpinner('Deleting\x20schedule...',()=>_0x3867bc[_0x2b9af3(0xd3)][_0x2b9af3(0xe6)](_0x15bcf5),{'verbose':_0x9a06bf[_0x2b9af3(0x13e)]});return console[_0x2b9af3(0xff)](_0x2b9af3(0xd2)+_0x23d194['data'][_0x2b9af3(0xba)]),0x0;}}function a37_0x1001(_0x5286a3,_0x3f7e93){_0x5286a3=_0x5286a3-0xb7;const _0x541ba7=a37_0x541b();let _0x10010b=_0x541ba7[_0x5286a3];return _0x10010b;}export class ScheduleRunCommand extends BaseCommand{[a37_0xcb1009(0xba)]=a37_0xcb1009(0x140);['description']='Run\x20a\x20scheduled\x20query\x20immediately';[a37_0xcb1009(0xeb)](_0x1feb77){const _0x4e8d68=a37_0xcb1009,_0x255b05=_0x1feb77['args'][0x0];if(!_0x255b05)return _0x4e8d68(0x136);return undefined;}async[a37_0xcb1009(0xe9)](_0x4f454d){const _0x4a5974=a37_0xcb1009,{options:_0xb7ad88,args:_0x25089e,tdx:_0x132215}=_0x4f454d,_0x2b6fb7=_0x25089e[0x0],_0x49a134=_0xb7ad88,_0x5c030e=_0x49a134[_0x4a5974(0x142)],_0x3d146c=_0x49a134[_0x4a5974(0x133)]!==undefined?Number(_0x49a134['num']):undefined;if(_0xb7ad88[_0x4a5974(0x13e)]){console[_0x4a5974(0xff)](_0x4a5974(0xf1)+_0x2b6fb7);if(_0x5c030e)console[_0x4a5974(0xff)](_0x4a5974(0x111)+_0x5c030e);if(_0x3d146c)console['error'](_0x4a5974(0x117)+_0x3d146c);}const _0x2ed1ef=await withSpinner(_0x4a5974(0x141),()=>_0x132215[_0x4a5974(0xd3)][_0x4a5974(0xcb)](_0x2b6fb7,{'time':_0x5c030e,'num':_0x3d146c}),{'verbose':_0xb7ad88[_0x4a5974(0x13e)]}),_0x3d3b0c=_0x2ed1ef[_0x4a5974(0x149)]['jobs'];console[_0x4a5974(0xff)](_0x4a5974(0x13b)+_0x3d3b0c[_0x4a5974(0x11e)]+_0x4a5974(0xf5)+(_0x3d3b0c[_0x4a5974(0x11e)]!==0x1?'s':'')+_0x4a5974(0x11c));for(const _0x40ea18 of _0x3d3b0c){console[_0x4a5974(0xff)](_0x4a5974(0x144)+_0x40ea18[_0x4a5974(0x147)]);}return await handleSDKOutput(_0x3d3b0c,_0xb7ad88),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a37_0xcb1009(0xba)]='schedule:history';[a37_0xcb1009(0x118)]=a37_0xcb1009(0xfa);['validate'](_0x1f2599){const _0x2e1517=a37_0xcb1009,_0x467f07=_0x1f2599[_0x2e1517(0xce)][0x0];if(!_0x467f07)return _0x2e1517(0x120);return undefined;}async[a37_0xcb1009(0xe9)](_0x1e7825){const _0x2e843d=a37_0xcb1009,{options:_0x35d081,args:_0x3be624,tdx:_0x2a27ce}=_0x1e7825,_0x355052=_0x3be624[0x0],_0x1064af=_0x35d081,_0x213485=_0x1064af[_0x2e843d(0x113)]!==undefined?Number(_0x1064af[_0x2e843d(0x113)]):undefined,_0x471d15=_0x1064af['to']!==undefined?Number(_0x1064af['to']):undefined,_0x3ad48e=await withSpinner(_0x2e843d(0x103),()=>_0x2a27ce['schedules'][_0x2e843d(0xe5)](_0x355052,{'from':_0x213485,'to':_0x471d15}),{'verbose':_0x35d081[_0x2e843d(0x13e)]}),_0x228148=_0x3ad48e[_0x2e843d(0x149)];console['error']('Found\x20'+_0x228148['count']+_0x2e843d(0xee)+(_0x228148['count']!==0x1?'s':'')+_0x2e843d(0xc6)+_0x228148[_0x2e843d(0x113)]+'-'+_0x228148['to']+')');const _0x1ba725=_0x228148[_0x2e843d(0xe5)][_0x2e843d(0xed)](_0xaad94=>({'job_id':_0xaad94[_0x2e843d(0x147)],'type':_0xaad94[_0x2e843d(0xbf)],'status':_0xaad94[_0x2e843d(0xe0)],'scheduled_at':_0xaad94[_0x2e843d(0x148)],'created_at':_0xaad94['created_at'],'start_at':_0xaad94[_0x2e843d(0xdf)],'end_at':_0xaad94[_0x2e843d(0x119)]}));return await handleSDKOutput(_0x1ba725,_0x35d081),0x0;}}
1
+ const a37_0x3d455f=a37_0x458b;(function(_0x31f42a,_0x420fd7){const _0x555374=a37_0x458b,_0x15c929=_0x31f42a();while(!![]){try{const _0xf6ac1a=-parseInt(_0x555374(0x1e3))/0x1*(-parseInt(_0x555374(0x1fb))/0x2)+-parseInt(_0x555374(0x1c2))/0x3+parseInt(_0x555374(0x1cc))/0x4*(parseInt(_0x555374(0x1f3))/0x5)+-parseInt(_0x555374(0x1f0))/0x6+-parseInt(_0x555374(0x20b))/0x7+-parseInt(_0x555374(0x205))/0x8*(-parseInt(_0x555374(0x1c1))/0x9)+parseInt(_0x555374(0x234))/0xa*(parseInt(_0x555374(0x217))/0xb);if(_0xf6ac1a===_0x420fd7)break;else _0x15c929['push'](_0x15c929['shift']());}catch(_0x49ce2b){_0x15c929['push'](_0x15c929['shift']());}}}(a37_0x42a4,0x9b1ec));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';function a37_0x42a4(){const _0x273b3b=['site','Run\x20a\x20scheduled\x20query\x20immediately','schedules','priority','round','Running\x20schedule...','engineVersion','soon','Creating\x20schedule...','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','Showing\x20first\x20','Create\x20a\x20scheduled\x20query','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','length','map','9RuIofJ','2818089WXhtFU','dim','\x20(showing\x20','timezone','\x20job','lastRun','job_id','result','d\x20ago','Cancelled','762548AIAFvt','cyan','list','description','jsonl','Running\x20schedule:\x20','\x20\x20Time:\x20','query','Creating\x20schedule:\x20','start_at','output','\x20\x20Timezone:\x20','nextRun','table','end_at','...','\x20(use\x20--limit\x20to\x20see\x20more)','file','retryLimit','cron','has_next_page','schedule:update','execute','28BMhYOk','\x20schedules','No\x20scheduled\x20queries\x20found','in\x20','validate','\x20created','abs','substring','ended_at','database','h\x20ago','from','delay','6457830MZYPiu','\x22...','Update\x20a\x20scheduled\x20query','30IBSrJh','time','Show\x20schedule\x20details','delete','engine_version','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','Schedule\x20updated:\x20','89696YtPhPI','\x20\x20Cron:\x20','scheduled_at','show','Schedule\x20created:\x20','ies','Getting\x20schedule\x20history...','created_at','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','Found\x20','2095176DeJHSg','log','pagination','\x20\x20Num:\x20','Schedule\x20run\x20submitted:\x20','max','8580712GhwcgN','status','data','m\x20ago','join','yes','INVALID_ARGUMENT','format','Query\x20file\x20is\x20empty','num','name','green','4456441ZrgQzu','/app/queries/editor?queryId=','📅\x20','Delete\x20a\x20scheduled\x20query','options','\x20matching\x20\x22','args','entries','schedule:create','limit','verbose','utf-8','last_job','red','padEnd','user_name','repeat','history','Show\x20schedule\x20execution\x20history','toLocaleDateString','error','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','jobs','json','retry_limit','next_run_at','listQueries','count','user','30YQircZ','Failed\x20to\x20read\x20file:\x20','statusIcon','schedule:run','schedule:delete','type','just\x20now','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','create','getTime','keys'];a37_0x42a4=function(){return _0x273b3b;};return a37_0x42a4();}import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a37_0x1a5b14 from'chalk';function formatRelativeTime(_0x133b00){const _0x559945=a37_0x458b,_0x5162a4=new Date(_0x133b00),_0xba8a03=new Date(),_0x3d8e67=_0x5162a4[_0x559945(0x23d)]()-_0xba8a03[_0x559945(0x23d)](),_0x59204a=Math[_0x559945(0x1e9)](_0x3d8e67)/0x3e8,_0x55bdac=_0x3d8e67<0x0;if(_0x59204a<0x3c)return _0x55bdac?_0x559945(0x23a):_0x559945(0x1b9);else{if(_0x59204a<0xe10){const _0x5268fb=Math[_0x559945(0x1b6)](_0x59204a/0x3c);return _0x55bdac?_0x5268fb+_0x559945(0x20e):_0x559945(0x1e6)+_0x5268fb+'m';}else{if(_0x59204a<0x15180){const _0x5b50ef=Math[_0x559945(0x1b6)](_0x59204a/0xe10);return _0x55bdac?_0x5b50ef+_0x559945(0x1ed):_0x559945(0x1e6)+_0x5b50ef+'h';}else{if(_0x59204a<0x93a80){const _0x4fc654=Math['round'](_0x59204a/0x15180);return _0x55bdac?_0x4fc654+_0x559945(0x1ca):_0x559945(0x1e6)+_0x4fc654+'d';}else return _0x5162a4[_0x559945(0x22a)]();}}}}export class ScheduleListCommand extends BaseCommand{[a37_0x3d455f(0x215)]='schedule:list';[a37_0x3d455f(0x1cf)]='List\x20scheduled\x20queries';async[a37_0x3d455f(0x1e2)](_0x292932){const _0x5541da=a37_0x3d455f,{options:_0x207890,args:_0x4870d6,tdx:_0x1d797}=_0x292932,_0x45232f=resolveLimit(_0x207890[_0x5541da(0x220)],DEFAULT_DISPLAY_LIMIT),_0xf22bac=_0x4870d6[0x0],_0x345c20=_0xf22bac?'Searching\x20scheduled\x20queries\x20matching\x20\x22'+_0xf22bac+_0x5541da(0x1f1):'Listing\x20scheduled\x20queries...',_0x1e83ea=await withSpinner(_0x345c20,()=>_0x1d797[_0x5541da(0x241)][_0x5541da(0x231)]({'limit':_0x45232f,'scheduled':!![],'pattern':_0xf22bac}),{'verbose':_0x207890[_0x5541da(0x221)]}),_0x25f17e=_0x1e83ea[_0x5541da(0x20d)]['queries'],_0x11fda4=_0x1e83ea[_0x5541da(0x20d)][_0x5541da(0x207)][_0x5541da(0x1e0)],_0x36f53a=_0xf22bac?_0x5541da(0x21c)+_0xf22bac+'\x22':'';_0x11fda4?console[_0x5541da(0x22b)](_0x5541da(0x1bc)+_0x25f17e[_0x5541da(0x1bf)]+_0x5541da(0x1e4)+_0x36f53a+_0x5541da(0x1dc)):console[_0x5541da(0x22b)](_0x5541da(0x204)+_0x25f17e[_0x5541da(0x1bf)]+'\x20scheduled\x20quer'+(_0x25f17e['length']!==0x1?_0x5541da(0x200):'y')+_0x36f53a);if(_0x207890[_0x5541da(0x212)]===_0x5541da(0x22e)||_0x207890[_0x5541da(0x212)]===_0x5541da(0x1d0)||_0x207890['format']===_0x5541da(0x1d9)||_0x207890[_0x5541da(0x212)]==='tsv'){const _0x4c1454=_0x25f17e[_0x5541da(0x1c0)](_0x3e0d17=>({'id':_0x3e0d17['id'],'name':_0x3e0d17[_0x5541da(0x215)],'cron':_0x3e0d17[_0x5541da(0x1df)],'database':_0x3e0d17['database']?.['name'],'type':_0x3e0d17[_0x5541da(0x239)],'timezone':_0x3e0d17['time_zone'],'user_name':_0x3e0d17[_0x5541da(0x233)]?.[_0x5541da(0x215)],'updated_at':_0x3e0d17['updated_at'],'next_run_at':_0x3e0d17[_0x5541da(0x230)],'last_job_status':_0x3e0d17['last_job']?.[_0x5541da(0x20c)]}));await handleSDKOutput(_0x4c1454,_0x207890);}else{if(_0x25f17e[_0x5541da(0x1bf)]===0x0)console[_0x5541da(0x206)](_0x5541da(0x1e5));else{const _0x52c545=_0x207890[_0x5541da(0x23f)],_0x3c4474=_0x25f17e[_0x5541da(0x1c0)](_0x3b0ae6=>{const _0x170e41=_0x5541da,_0xf2e357=_0x3b0ae6[_0x170e41(0x223)]?.[_0x170e41(0x20c)]?_0x3b0ae6[_0x170e41(0x223)][_0x170e41(0x20c)]==='success'?'✓':'✗':'-',_0x13880f=_0x3b0ae6[_0x170e41(0x223)]?.[_0x170e41(0x1eb)]?formatRelativeTime(_0x3b0ae6[_0x170e41(0x223)][_0x170e41(0x1eb)]):'never',_0x1d55ab=_0x3b0ae6['next_run_at']?formatRelativeTime(_0x3b0ae6['next_run_at']):'-',_0x3b65d6=_0x3b0ae6[_0x170e41(0x1df)]||'',_0x4f5528=_0x3b0ae6[_0x170e41(0x215)]||'(unnamed)',_0x3b0a5c=getConsoleUrl(_0x52c545,_0x170e41(0x218)+_0x3b0ae6['id']);return{'statusIcon':_0xf2e357,'lastRun':_0x13880f,'nextRun':_0x1d55ab,'cron':_0x3b65d6,'name':_0x4f5528,'queryUrl':_0x3b0a5c,'status':_0x3b0ae6[_0x170e41(0x223)]?.[_0x170e41(0x20c)]};}),_0x267c8b=Math[_0x5541da(0x20a)](..._0x3c4474['map'](_0x5bad7f=>_0x5bad7f[_0x5541da(0x1c7)][_0x5541da(0x1bf)])),_0x3d1f77=Math[_0x5541da(0x20a)](..._0x3c4474[_0x5541da(0x1c0)](_0x479f97=>_0x479f97[_0x5541da(0x1d8)]['length'])),_0x2006f4=Math[_0x5541da(0x20a)](..._0x3c4474[_0x5541da(0x1c0)](_0x3035e6=>_0x3035e6[_0x5541da(0x1df)][_0x5541da(0x1bf)])),_0x406989=_0x3c4474[_0x5541da(0x1c0)](_0x55daf3=>{const _0x4a8d93=_0x5541da,_0x18abaf=_0x55daf3[_0x4a8d93(0x20c)]==='success'?a37_0x1a5b14[_0x4a8d93(0x216)](_0x55daf3[_0x4a8d93(0x236)]):_0x55daf3['status']==='error'?a37_0x1a5b14[_0x4a8d93(0x224)](_0x55daf3[_0x4a8d93(0x236)]):a37_0x1a5b14[_0x4a8d93(0x1c3)](_0x55daf3[_0x4a8d93(0x236)]),_0x5f0c8b=_0x55daf3[_0x4a8d93(0x1c7)][_0x4a8d93(0x225)](_0x267c8b),_0x2a644f=_0x55daf3[_0x4a8d93(0x1d8)][_0x4a8d93(0x225)](_0x3d1f77),_0xab2fd5=_0x55daf3['cron']?a37_0x1a5b14[_0x4a8d93(0x1cd)](_0x55daf3['cron']['padEnd'](_0x2006f4)):'\x20'[_0x4a8d93(0x227)](_0x2006f4),_0x33c1bc=hyperlink(_0x55daf3[_0x4a8d93(0x215)],_0x55daf3['queryUrl']);return _0x4a8d93(0x219)+_0x18abaf+'\x20'+_0x5f0c8b+'\x20\x20→\x20'+_0x2a644f+'\x20\x20'+_0xab2fd5+'\x20\x20'+_0x33c1bc;});await writeOutput(_0x406989[_0x5541da(0x20f)]('\x0a'),_0x207890[_0x5541da(0x1d6)],_0x5541da(0x1ce));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{['name']='schedule:show';['description']=a37_0x3d455f(0x1f5);['validate'](_0x53e31d){const _0x48310a=a37_0x3d455f,_0x19abb1=_0x53e31d[_0x48310a(0x21d)][0x0];if(!_0x19abb1)return _0x48310a(0x23b);return undefined;}async[a37_0x3d455f(0x1e2)](_0x37ccb7){const _0x2bd0d8=a37_0x3d455f,{options:_0xfcc131,args:_0x27d370,tdx:_0x54bb80}=_0x37ccb7,_0x5abb44=_0x27d370[0x0],_0x21138f=await withSpinner('Getting\x20schedule\x20details...',()=>_0x54bb80[_0x2bd0d8(0x241)][_0x2bd0d8(0x1fe)](_0x5abb44),{'verbose':_0xfcc131[_0x2bd0d8(0x221)]}),_0x11cf58=_0x21138f['data'],_0x42e26a={'name':_0x11cf58[_0x2bd0d8(0x215)],'cron':_0x11cf58[_0x2bd0d8(0x1df)],'database':_0x11cf58[_0x2bd0d8(0x1ec)],'type':_0x11cf58[_0x2bd0d8(0x239)],'timezone':_0x11cf58[_0x2bd0d8(0x1c5)],'user_name':_0x11cf58[_0x2bd0d8(0x226)],'created_at':_0x11cf58[_0x2bd0d8(0x202)],'engine_version':_0x11cf58['engine_version'],'executing_user_id':_0x11cf58['executing_user_id'],'query':_0x11cf58[_0x2bd0d8(0x1d3)],'delay':_0x11cf58[_0x2bd0d8(0x1ef)],'priority':_0x11cf58['priority'],'retry_limit':_0x11cf58[_0x2bd0d8(0x22f)],..._0x11cf58['result']&&{'result':_0x11cf58[_0x2bd0d8(0x1c9)]}};return await handleSingleObjectOutput(_0x42e26a,_0xfcc131),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a37_0x3d455f(0x215)]=a37_0x3d455f(0x21f);[a37_0x3d455f(0x1cf)]=a37_0x3d455f(0x1bd);['validate'](_0xf6868e){const _0x93d92e=a37_0x3d455f,_0x3567bc=_0xf6868e[_0x93d92e(0x21d)][0x0];if(!_0x3567bc)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';const _0x12a111=_0xf6868e[_0x93d92e(0x21b)];if(!_0x12a111[_0x93d92e(0x1ec)])return'Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';return undefined;}async['execute'](_0xd2b623){const _0x319e6b=a37_0x3d455f,{options:_0x3ec2e1,args:_0x25eb22,tdx:_0x366eb4}=_0xd2b623,_0xb8c017=_0x25eb22[0x0],_0x36d661=_0x3ec2e1,_0x20ce22=_0x36d661[_0x319e6b(0x1ec)],_0x26c5c0=_0x36d661[_0x319e6b(0x1dd)],_0x2fff46=_0x36d661[_0x319e6b(0x239)]||'trino';let _0x28f380;try{_0x28f380=readFileSync(_0x26c5c0,_0x319e6b(0x222))['trim']();}catch(_0x1567e5){throw new SDKError(ErrorCode[_0x319e6b(0x211)],'Failed\x20to\x20read\x20file:\x20'+_0x26c5c0,_0x1567e5 instanceof Error?_0x1567e5:undefined);}if(!_0x28f380)throw new SDKError(ErrorCode[_0x319e6b(0x211)],_0x319e6b(0x213));const _0x2dabe0={'database':_0x20ce22,'query':_0x28f380,'type':_0x2fff46};if(_0x36d661['cron'])_0x2dabe0[_0x319e6b(0x1df)]=_0x36d661[_0x319e6b(0x1df)];if(_0x36d661['timezone'])_0x2dabe0[_0x319e6b(0x1c5)]=_0x36d661[_0x319e6b(0x1c5)];if(_0x36d661[_0x319e6b(0x1ef)]!==undefined)_0x2dabe0[_0x319e6b(0x1ef)]=Number(_0x36d661[_0x319e6b(0x1ef)]);if(_0x36d661[_0x319e6b(0x242)]!==undefined)_0x2dabe0[_0x319e6b(0x242)]=Number(_0x36d661[_0x319e6b(0x242)]);if(_0x36d661[_0x319e6b(0x1de)]!==undefined)_0x2dabe0[_0x319e6b(0x22f)]=Number(_0x36d661['retryLimit']);if(_0x36d661[_0x319e6b(0x1b8)])_0x2dabe0['engine_version']=_0x36d661['engineVersion'];if(_0x36d661[_0x319e6b(0x1c9)])_0x2dabe0[_0x319e6b(0x1c9)]=_0x36d661[_0x319e6b(0x1c9)];if(_0x3ec2e1[_0x319e6b(0x221)]){console[_0x319e6b(0x22b)](_0x319e6b(0x1d4)+_0xb8c017),console[_0x319e6b(0x22b)]('\x20\x20Database:\x20'+_0x20ce22),console['error']('\x20\x20Type:\x20'+_0x2fff46);if(_0x2dabe0[_0x319e6b(0x1df)])console[_0x319e6b(0x22b)](_0x319e6b(0x1fc)+_0x2dabe0['cron']);if(_0x2dabe0[_0x319e6b(0x1c5)])console[_0x319e6b(0x22b)](_0x319e6b(0x1d7)+_0x2dabe0[_0x319e6b(0x1c5)]);}const _0x46c3c3=await withSpinner(_0x319e6b(0x1ba),()=>_0x366eb4[_0x319e6b(0x241)][_0x319e6b(0x23c)](_0xb8c017,_0x2dabe0),{'verbose':_0x3ec2e1[_0x319e6b(0x221)]});return console['error'](_0x319e6b(0x1ff)+_0x46c3c3[_0x319e6b(0x20d)][_0x319e6b(0x215)]),await handleSingleObjectOutput(_0x46c3c3['data'],_0x3ec2e1),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{['name']=a37_0x3d455f(0x1e1);[a37_0x3d455f(0x1cf)]=a37_0x3d455f(0x1f2);[a37_0x3d455f(0x1e7)](_0x271408){const _0x10b78e=a37_0x3d455f,_0x41f980=_0x271408[_0x10b78e(0x21d)][0x0];if(!_0x41f980)return _0x10b78e(0x22c);return undefined;}async[a37_0x3d455f(0x1e2)](_0x3d8ba5){const _0x3f31d3=a37_0x3d455f,{options:_0x5e3e93,args:_0x3add2c,tdx:_0x191be1}=_0x3d8ba5,_0x2a165b=_0x3add2c[0x0],_0x4a56ac=_0x5e3e93,_0x50d5aa={};if(_0x4a56ac[_0x3f31d3(0x1ec)])_0x50d5aa['database']=_0x4a56ac['database'];if(_0x4a56ac[_0x3f31d3(0x239)])_0x50d5aa['type']=_0x4a56ac[_0x3f31d3(0x239)];if(_0x4a56ac[_0x3f31d3(0x1df)])_0x50d5aa[_0x3f31d3(0x1df)]=_0x4a56ac[_0x3f31d3(0x1df)];if(_0x4a56ac['timezone'])_0x50d5aa['timezone']=_0x4a56ac['timezone'];if(_0x4a56ac[_0x3f31d3(0x1ef)]!==undefined)_0x50d5aa[_0x3f31d3(0x1ef)]=Number(_0x4a56ac[_0x3f31d3(0x1ef)]);if(_0x4a56ac['priority']!==undefined)_0x50d5aa[_0x3f31d3(0x242)]=Number(_0x4a56ac[_0x3f31d3(0x242)]);if(_0x4a56ac['retryLimit']!==undefined)_0x50d5aa[_0x3f31d3(0x22f)]=Number(_0x4a56ac[_0x3f31d3(0x1de)]);if(_0x4a56ac[_0x3f31d3(0x1b8)])_0x50d5aa[_0x3f31d3(0x1f7)]=_0x4a56ac['engineVersion'];if(_0x4a56ac[_0x3f31d3(0x1c9)])_0x50d5aa['result']=_0x4a56ac[_0x3f31d3(0x1c9)];if(_0x4a56ac[_0x3f31d3(0x1dd)])try{_0x50d5aa['query']=readFileSync(_0x4a56ac[_0x3f31d3(0x1dd)],_0x3f31d3(0x222))['trim']();}catch(_0x2be426){throw new SDKError(ErrorCode[_0x3f31d3(0x211)],_0x3f31d3(0x235)+_0x4a56ac[_0x3f31d3(0x1dd)],_0x2be426 instanceof Error?_0x2be426:undefined);}if(Object[_0x3f31d3(0x23e)](_0x50d5aa)[_0x3f31d3(0x1bf)]===0x0)throw new SDKError(ErrorCode[_0x3f31d3(0x211)],_0x3f31d3(0x203));if(_0x5e3e93[_0x3f31d3(0x221)]){console[_0x3f31d3(0x22b)]('Updating\x20schedule:\x20'+_0x2a165b);for(const [_0x282ba4,_0x3a9ef7]of Object[_0x3f31d3(0x21e)](_0x50d5aa)){_0x282ba4===_0x3f31d3(0x1d3)?console[_0x3f31d3(0x22b)]('\x20\x20'+_0x282ba4+':\x20'+_0x3a9ef7[_0x3f31d3(0x1ea)](0x0,0x32)+_0x3f31d3(0x1db)):console[_0x3f31d3(0x22b)]('\x20\x20'+_0x282ba4+':\x20'+_0x3a9ef7);}}const _0x395da9=await withSpinner('Updating\x20schedule...',()=>_0x191be1[_0x3f31d3(0x241)]['update'](_0x2a165b,_0x50d5aa),{'verbose':_0x5e3e93['verbose']});return console[_0x3f31d3(0x22b)](_0x3f31d3(0x1fa)+_0x395da9[_0x3f31d3(0x20d)][_0x3f31d3(0x215)]),await handleSingleObjectOutput(_0x395da9[_0x3f31d3(0x20d)],_0x5e3e93),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{['name']=a37_0x3d455f(0x238);[a37_0x3d455f(0x1cf)]=a37_0x3d455f(0x21a);['validate'](_0x3a90df){const _0x4a9509=a37_0x3d455f,_0x59fc62=_0x3a90df[_0x4a9509(0x21d)][0x0];if(!_0x59fc62)return _0x4a9509(0x1be);return undefined;}async[a37_0x3d455f(0x1e2)](_0x445454){const _0x469c64=a37_0x3d455f,{options:_0x7ff74f,args:_0xf00f12,tdx:_0x5daa3f}=_0x445454,_0x2d5978=_0xf00f12[0x0];if(!_0x7ff74f[_0x469c64(0x210)]){const _0x263747=await confirm(_0x469c64(0x1bb)+_0x2d5978+'\x22?');if(!_0x263747)return console['error'](_0x469c64(0x1cb)),0x0;}const _0x265f6c=await withSpinner('Deleting\x20schedule...',()=>_0x5daa3f['schedules'][_0x469c64(0x1f6)](_0x2d5978),{'verbose':_0x7ff74f[_0x469c64(0x221)]});return console[_0x469c64(0x22b)]('Schedule\x20deleted:\x20'+_0x265f6c[_0x469c64(0x20d)][_0x469c64(0x215)]),0x0;}}function a37_0x458b(_0x2ac2d9,_0x5eb938){_0x2ac2d9=_0x2ac2d9-0x1b6;const _0x42a4d=a37_0x42a4();let _0x458b3f=_0x42a4d[_0x2ac2d9];return _0x458b3f;}export class ScheduleRunCommand extends BaseCommand{[a37_0x3d455f(0x215)]=a37_0x3d455f(0x237);['description']=a37_0x3d455f(0x240);['validate'](_0x17ca83){const _0x5ce5bf=a37_0x3d455f,_0x341212=_0x17ca83[_0x5ce5bf(0x21d)][0x0];if(!_0x341212)return _0x5ce5bf(0x1f8);return undefined;}async[a37_0x3d455f(0x1e2)](_0x3b40a6){const _0x16b504=a37_0x3d455f,{options:_0x188df6,args:_0x1bf4a8,tdx:_0x4a2db7}=_0x3b40a6,_0x2cdf7f=_0x1bf4a8[0x0],_0x9980c=_0x188df6,_0x387d40=_0x9980c[_0x16b504(0x1f4)],_0x68e332=_0x9980c[_0x16b504(0x214)]!==undefined?Number(_0x9980c[_0x16b504(0x214)]):undefined;if(_0x188df6[_0x16b504(0x221)]){console[_0x16b504(0x22b)](_0x16b504(0x1d1)+_0x2cdf7f);if(_0x387d40)console['error'](_0x16b504(0x1d2)+_0x387d40);if(_0x68e332)console[_0x16b504(0x22b)](_0x16b504(0x208)+_0x68e332);}const _0x4856dc=await withSpinner(_0x16b504(0x1b7),()=>_0x4a2db7[_0x16b504(0x241)]['run'](_0x2cdf7f,{'time':_0x387d40,'num':_0x68e332}),{'verbose':_0x188df6[_0x16b504(0x221)]}),_0x5db00f=_0x4856dc[_0x16b504(0x20d)][_0x16b504(0x22d)];console[_0x16b504(0x22b)](_0x16b504(0x209)+_0x5db00f['length']+_0x16b504(0x1c6)+(_0x5db00f[_0x16b504(0x1bf)]!==0x1?'s':'')+_0x16b504(0x1e8));for(const _0x415c95 of _0x5db00f){console[_0x16b504(0x22b)]('\x20\x20Job\x20ID:\x20'+_0x415c95[_0x16b504(0x1c8)]);}return await handleSDKOutput(_0x5db00f,_0x188df6),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a37_0x3d455f(0x215)]='schedule:history';[a37_0x3d455f(0x1cf)]=a37_0x3d455f(0x229);[a37_0x3d455f(0x1e7)](_0x55abee){const _0x2f206f=a37_0x3d455f,_0x219a58=_0x55abee['args'][0x0];if(!_0x219a58)return _0x2f206f(0x1f9);return undefined;}async[a37_0x3d455f(0x1e2)](_0x34ed28){const _0x5b1485=a37_0x3d455f,{options:_0x591455,args:_0x2fbd8d,tdx:_0x1d6704}=_0x34ed28,_0x3d480a=_0x2fbd8d[0x0],_0x4ff4f3=_0x591455,_0x3ea83c=_0x4ff4f3[_0x5b1485(0x1ee)]!==undefined?Number(_0x4ff4f3['from']):undefined,_0x4967cd=_0x4ff4f3['to']!==undefined?Number(_0x4ff4f3['to']):undefined,_0x27aed8=await withSpinner(_0x5b1485(0x201),()=>_0x1d6704[_0x5b1485(0x241)][_0x5b1485(0x228)](_0x3d480a,{'from':_0x3ea83c,'to':_0x4967cd}),{'verbose':_0x591455[_0x5b1485(0x221)]}),_0x5112e3=_0x27aed8['data'];console[_0x5b1485(0x22b)](_0x5b1485(0x204)+_0x5112e3[_0x5b1485(0x232)]+'\x20execution'+(_0x5112e3['count']!==0x1?'s':'')+_0x5b1485(0x1c4)+_0x5112e3[_0x5b1485(0x1ee)]+'-'+_0x5112e3['to']+')');const _0x464407=_0x5112e3['history'][_0x5b1485(0x1c0)](_0x445588=>({'job_id':_0x445588[_0x5b1485(0x1c8)],'type':_0x445588[_0x5b1485(0x239)],'status':_0x445588['status'],'scheduled_at':_0x445588[_0x5b1485(0x1fd)],'created_at':_0x445588[_0x5b1485(0x202)],'start_at':_0x445588[_0x5b1485(0x1d5)],'end_at':_0x445588[_0x5b1485(0x1da)]}));return await handleSDKOutput(_0x464407,_0x591455),0x0;}}
@@ -1 +1 @@
1
- function a38_0x4999(_0x2b393a,_0x3c629d){_0x2b393a=_0x2b393a-0x1e8;const _0x4729cd=a38_0x4729();let _0x49991f=_0x4729cd[_0x2b393a];return _0x49991f;}const a38_0x359782=a38_0x4999;(function(_0x345128,_0x32c28a){const _0xd85f62=a38_0x4999,_0x391d5a=_0x345128();while(!![]){try{const _0x43ab61=parseInt(_0xd85f62(0x203))/0x1*(-parseInt(_0xd85f62(0x280))/0x2)+-parseInt(_0xd85f62(0x1e8))/0x3+-parseInt(_0xd85f62(0x243))/0x4*(-parseInt(_0xd85f62(0x236))/0x5)+parseInt(_0xd85f62(0x271))/0x6*(parseInt(_0xd85f62(0x208))/0x7)+parseInt(_0xd85f62(0x270))/0x8+parseInt(_0xd85f62(0x26d))/0x9+-parseInt(_0xd85f62(0x238))/0xa*(parseInt(_0xd85f62(0x228))/0xb);if(_0x43ab61===_0x32c28a)break;else _0x391d5a['push'](_0x391d5a['shift']());}catch(_0x5e299e){_0x391d5a['push'](_0x391d5a['shift']());}}}(a38_0x4729,0xb696f));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';function a38_0x4729(){const _0xf8dd46=['SQL\x20query:\x0a','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','format','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','folder','Show\x20folder\x20or\x20child\x20segment\x20details','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','getSQLFromYamlFile','processedRows','Usage:','resolveParentId','SEGMENT_FOLDER_NOT_FOUND','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','message','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Examples:','Resolved\x20relative\x20path\x20to:\x20','Show\x20segment\x20or\x20folder\x20details','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','segment:sql','\x20\x20Parent\x20segment:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','listFolders','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','3949WpWuWP','Folder\x20ID:\x20','site','Use:\x20tdx\x20ps\x20view','INVALID_ARGUMENT','159635PIazJH','jobId','Show\x20child\x20segment\x20schema\x20(column\x20types)','Usage:\x20tdx\x20sg\x20desc\x20<name>','SELECT\x20*\x20FROM\x20(\x0a','jsonl','Options:','Use:\x20tdx\x20ps\x20desc','/e/','parentFolder','\x20rows\x20','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Parent\x20name:\x20','Fetching\x20segment\x20details...','Segment\x20ID:\x20','query','Error:\x20','\x27...','segment','length','toLocaleString','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Site:\x20','description','data','Resolved\x20type:\x20','trim','Folder\x20ID\x20missing\x20from\x20resolved\x20path','segmentId','Use:\x20tdx\x20ps\x20show','Use:\x20tdx\x20ps\x20view\x20-w','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','6094NmiZna','Creating\x20folder\x20\x27','✖\x20Query\x20failed\x20[','\x20\x20Segment\x20name:\x20','SEGMENT_NOT_FOUND','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','getParent','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','code','(root)','folderId','resolvePathToResource','5MdZBMj','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','3430oKkwqI','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Parent\x20ID:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','stats','Fetching\x20folder\x20\x27','parentSegment','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','segment:folder:show','\x20\x20Cause:\x20','1085380lwEXra','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','content','Usage:\x20tdx\x20sg\x20show\x20<name>','Resolving\x20parent\x20segment\x20\x27','Parent\x20segment:\x20','Target\x20path:\x20','Resolved:\x20','Resolving\x20\x27','\x20\x20Full\x20path:\x20','segment:folder:list','Resolved\x20parent\x20folder\x20ID:\x20','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','replace','Fetching\x20parent\x20segment\x20details...','green','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','verbose','Resolving\x20folder\x20\x27','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Folder\x20name:\x20','Resolving\x20path\x20\x27','error','Fetching\x20SQL\x20for\x20segment...','execute','name','\x20[Job\x20ID:\x20','path','elapsedTimeMillis','\x27\x20with\x20ID:\x20','getSQLFromServerSegment','url','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','folderPath','type','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','cause','parentId','segment:describe','6434316AnXuzl','\x20\x20tdx\x20sg\x20sql\x20--path\x20','getSegmentSQL','7238984AuZfLw','270dmijqH','cyan','getSegment','setJobId','Resolved\x20YAML\x20file:\x20','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','segment:desc','Show\x20segment\x20folder\x20details','segmentName','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Usage:\x20tdx\x20segment\x20describe\x20<path>','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','parent','✔\x20Created\x20folder\x20\x27','resolveFolderId','688cEmOIB','fullPath','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','✔\x20Query\x20completed:\x20Processed\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','getFolder','test','/app/ps/','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','red','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','1863006lIkVVI'];a38_0x4729=function(){return _0xf8dd46;};return a38_0x4729();}import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a38_0x3a705a from'chalk';async function resolveSegmentTarget(_0x3c5aab,_0xf9a7c3,_0x5b7fc0){const _0x4b2ff9=a38_0x4999;if(isYamlFilePath(_0x3c5aab))try{const _0x55474a=await resolveYamlFilePath(_0x3c5aab);return _0x5b7fc0&&(console[_0x4b2ff9(0x25b)](_0x4b2ff9(0x275)+_0x3c5aab),console['error'](_0x4b2ff9(0x1fe)+_0x55474a[_0x4b2ff9(0x23f)]),console[_0x4b2ff9(0x25b)](_0x4b2ff9(0x22b)+_0x55474a[_0x4b2ff9(0x279)]),console[_0x4b2ff9(0x25b)]('\x20\x20Folder\x20path:\x20'+(_0x55474a[_0x4b2ff9(0x267)]||_0x4b2ff9(0x233))),console['error'](_0x4b2ff9(0x24d)+_0x55474a[_0x4b2ff9(0x281)])),_0x55474a['fullPath'];}catch(_0x25d004){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x25d004[_0x4b2ff9(0x1f6)]);}if(!_0xf9a7c3)throw new SDKError(ErrorCode[_0x4b2ff9(0x207)],_0x4b2ff9(0x244));return _0xf9a7c3+'/'+_0x3c5aab;}export class SegmentDescribeCommand extends BaseCommand{[a38_0x359782(0x25e)]=a38_0x359782(0x26c);[a38_0x359782(0x21f)]=a38_0x359782(0x1fa);async[a38_0x359782(0x25d)](_0x2a7fd8){const _0x2f2b5c=a38_0x359782,{options:_0x1ee347,args:_0x1e8a00,tdx:_0x55d51e}=_0x2a7fd8,_0x2139d9=_0x1e8a00[0x0],_0x26849a=!_0x2139d9&&!!_0x1ee347[_0x2f2b5c(0x23f)],_0x1abbbf=_0x2139d9||_0x1ee347[_0x2f2b5c(0x23f)];if(!_0x1abbbf)return console['error']('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x2f2b5c(0x25b)](_0x2f2b5c(0x27b)),console['error'](_0x2f2b5c(0x1f8)),console[_0x2f2b5c(0x25b)](_0x2f2b5c(0x21d)),console[_0x2f2b5c(0x25b)](_0x2f2b5c(0x284)),console['error'](_0x2f2b5c(0x282)),console[_0x2f2b5c(0x25b)](_0x2f2b5c(0x1f7)),0x1;try{const _0x34386f=_0x1ee347['segmentPath'];let _0x5e9b65=_0x1abbbf;!_0x26849a&&_0x34386f&&!_0x1abbbf['includes']('/')&&(_0x5e9b65=_0x34386f+'/'+_0x1abbbf,_0x1ee347[_0x2f2b5c(0x256)]&&console[_0x2f2b5c(0x25b)](_0x2f2b5c(0x1f9)+_0x5e9b65));const _0xa13fc4=await withSpinner(_0x2f2b5c(0x25a)+_0x5e9b65+_0x2f2b5c(0x219),()=>_0x55d51e[_0x2f2b5c(0x21a)][_0x2f2b5c(0x235)](_0x5e9b65),{'verbose':_0x1ee347['verbose']}),_0x2c8523=_0xa13fc4[_0x2f2b5c(0x220)];_0x1ee347[_0x2f2b5c(0x256)]&&(console['error'](_0x2f2b5c(0x221)+_0x2c8523[_0x2f2b5c(0x268)]),console[_0x2f2b5c(0x25b)](_0x2f2b5c(0x23a)+_0x2c8523['parentId']),_0x2c8523[_0x2f2b5c(0x234)]&&console['error'](_0x2f2b5c(0x204)+_0x2c8523[_0x2f2b5c(0x234)]),_0x2c8523[_0x2f2b5c(0x224)]&&console['error'](_0x2f2b5c(0x216)+_0x2c8523[_0x2f2b5c(0x224)]));if(_0x2c8523[_0x2f2b5c(0x268)]===_0x2f2b5c(0x27d)){const _0x309f0a=await withSpinner(_0x2f2b5c(0x252),()=>_0x55d51e[_0x2f2b5c(0x21a)][_0x2f2b5c(0x22f)](_0x2c8523[_0x2f2b5c(0x26b)]),{'verbose':_0x1ee347[_0x2f2b5c(0x256)]});await handleSingleObjectOutput(_0x309f0a[_0x2f2b5c(0x220)],_0x1ee347);}else{if(_0x2c8523[_0x2f2b5c(0x268)]==='folder'){if(!_0x2c8523['folderId'])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x148c8a=await withSpinner('Fetching\x20folder\x20details...',()=>_0x55d51e[_0x2f2b5c(0x21a)][_0x2f2b5c(0x285)](_0x2c8523['folderId']),{'verbose':_0x1ee347[_0x2f2b5c(0x256)]});await handleSingleObjectOutput(_0x148c8a[_0x2f2b5c(0x220)],_0x1ee347);}else{if(_0x2c8523['type']===_0x2f2b5c(0x21a)){if(!_0x2c8523['segmentId'])throw new SDKError(ErrorCode[_0x2f2b5c(0x22c)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x5f50bd=await withSpinner(_0x2f2b5c(0x215),()=>_0x55d51e[_0x2f2b5c(0x21a)]['getSegment'](_0x2c8523[_0x2f2b5c(0x26b)],_0x2c8523[_0x2f2b5c(0x224)]),{'verbose':_0x1ee347['verbose']});await handleSingleObjectOutput(_0x5f50bd[_0x2f2b5c(0x220)],_0x1ee347);}}}return 0x0;}catch(_0x5721d8){if(_0x5721d8 instanceof SDKError)return console[_0x2f2b5c(0x25b)](_0x2f2b5c(0x218)+_0x5721d8[_0x2f2b5c(0x1f6)]),_0x5721d8['cause']&&console[_0x2f2b5c(0x25b)]('\x20\x20Cause:\x20'+_0x5721d8[_0x2f2b5c(0x26a)]),0x1;throw _0x5721d8;}}}export class SegmentShowCommand extends BaseCommand{['name']='segment:show';[a38_0x359782(0x21f)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async['execute'](_0x4554e3){const _0x1d7306=a38_0x359782,{options:_0x159a0b,args:_0x20c7b4,tdx:_0x30dda0}=_0x4554e3,_0x139dad=_0x20c7b4[0x0];if(!_0x139dad)return console['error'](_0x1d7306(0x27a)),console[_0x1d7306(0x25b)](_0x1d7306(0x247)),console[_0x1d7306(0x25b)](_0x1d7306(0x22d)),console[_0x1d7306(0x25b)](_0x1d7306(0x1f8)),console[_0x1d7306(0x25b)](_0x1d7306(0x213)),console['error'](_0x1d7306(0x240)),0x1;try{const _0x31883f=_0x159a0b[_0x1d7306(0x23f)],_0x3e1177=await resolveSegmentTarget(_0x139dad,_0x31883f,_0x159a0b[_0x1d7306(0x256)]);_0x159a0b[_0x1d7306(0x256)]&&console[_0x1d7306(0x25b)](_0x1d7306(0x24a)+_0x3e1177);const _0x52eba=await withSpinner(_0x1d7306(0x24c)+_0x139dad+'\x27...',()=>_0x30dda0[_0x1d7306(0x21a)]['resolvePathToResource'](_0x3e1177),{'verbose':_0x159a0b[_0x1d7306(0x256)]}),_0x5eabd1=_0x52eba['data'];_0x159a0b['verbose']&&(console[_0x1d7306(0x25b)](_0x1d7306(0x221)+_0x5eabd1[_0x1d7306(0x268)]),console[_0x1d7306(0x25b)]('Parent\x20ID:\x20'+_0x5eabd1[_0x1d7306(0x26b)]));if(_0x5eabd1[_0x1d7306(0x268)]===_0x1d7306(0x1ed))return console[_0x1d7306(0x25b)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0x1d7306(0x25b)](_0x1d7306(0x265)),0x1;if(_0x5eabd1[_0x1d7306(0x268)]===_0x1d7306(0x27d))return console['error'](_0x1d7306(0x227)),console[_0x1d7306(0x25b)](_0x1d7306(0x225)),0x1;if(!_0x5eabd1[_0x1d7306(0x224)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x580a8c=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x30dda0['segment'][_0x1d7306(0x26f)](_0x5eabd1[_0x1d7306(0x26b)],_0x5eabd1['segmentId']),{'verbose':_0x159a0b['verbose']});let _0x586ec8=_0x580a8c['data'];const _0xcd6505=resolveLimit(_0x159a0b['limit'],DEFAULT_DISPLAY_LIMIT),_0x239e47=/\bLIMIT\s+\d+/i[_0x1d7306(0x286)](_0x586ec8);!_0x239e47&&(_0x586ec8=_0x586ec8[_0x1d7306(0x222)]()[_0x1d7306(0x251)](/;+$/,''),_0x586ec8=_0x1d7306(0x20c)+_0x586ec8+_0x1d7306(0x1ec)+_0xcd6505);_0x159a0b['verbose']&&console[_0x1d7306(0x25b)](_0x1d7306(0x1e9)+_0x586ec8);const _0x81abf9=await withProgressSpinner('Executing\x20segment\x20query...',async _0x43150d=>{const _0x123321=_0x1d7306,_0x416c8c=await _0x30dda0[_0x123321(0x217)]['execute'](_0x586ec8,{'catalog':'td','schema':'information_schema','onJobId':_0x471a2e=>{const _0x5e5e8f=_0x123321;_0x43150d[_0x5e5e8f(0x274)](_0x471a2e);}});return _0x416c8c;},{'verbose':_0x159a0b[_0x1d7306(0x256)]}),_0x4fb713=_0x81abf9[_0x1d7306(0x220)],_0x5cb3fc=_0x4fb713[_0x1d7306(0x209)]?_0x1d7306(0x25f)+_0x4fb713[_0x1d7306(0x209)]+']':'';return console[_0x1d7306(0x25b)](_0x1d7306(0x283)+_0x4fb713[_0x1d7306(0x23d)][_0x1d7306(0x1f1)][_0x1d7306(0x21c)]()+_0x1d7306(0x212)+('in\x20'+formatElapsed(_0x4fb713[_0x1d7306(0x23d)][_0x1d7306(0x261)])+_0x5cb3fc)),await handleQueryOutput(_0x4fb713,_0x159a0b),0x0;}catch(_0x3eb104){if(_0x3eb104 instanceof SDKError)return console[_0x1d7306(0x25b)](_0x1d7306(0x22a)+_0x3eb104[_0x1d7306(0x232)]+']'),console[_0x1d7306(0x25b)]('\x0a'+_0x3eb104[_0x1d7306(0x1f6)]),0x1;throw _0x3eb104;}}}export class SegmentFolderListCommand extends BaseCommand{[a38_0x359782(0x25e)]=a38_0x359782(0x24e);[a38_0x359782(0x21f)]=a38_0x359782(0x28a);async[a38_0x359782(0x25d)](_0x468641){const _0x32b9cc=a38_0x359782,{options:_0xd4f89e,args:_0x10d17e,tdx:_0x55c45b}=_0x468641;if(_0x10d17e[_0x32b9cc(0x21b)]===0x0)return console[_0x32b9cc(0x25b)](_0x32b9cc(0x254)),console[_0x32b9cc(0x25b)](_0x32b9cc(0x266)),0x1;const _0x17db4c=_0x10d17e[0x0];try{_0xd4f89e[_0x32b9cc(0x256)]&&(console[_0x32b9cc(0x25b)](_0x32b9cc(0x21e)+_0xd4f89e[_0x32b9cc(0x205)]),console[_0x32b9cc(0x25b)](_0x32b9cc(0x214)+_0x17db4c));const _0x50cef6=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x17db4c+_0x32b9cc(0x219),()=>_0x55c45b['segment'][_0x32b9cc(0x1f3)](_0x17db4c),{'verbose':_0xd4f89e[_0x32b9cc(0x256)]}),_0x2ddc0d=_0x50cef6[_0x32b9cc(0x220)];_0xd4f89e['verbose']&&console[_0x32b9cc(0x25b)]('Resolved\x20parent\x20ID:\x20'+_0x2ddc0d);const _0x18614c=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x17db4c+_0x32b9cc(0x219),()=>_0x55c45b[_0x32b9cc(0x21a)][_0x32b9cc(0x201)](_0x2ddc0d),{'verbose':_0xd4f89e[_0x32b9cc(0x256)]}),_0x3174b6=_0x18614c[_0x32b9cc(0x220)];return console[_0x32b9cc(0x25b)]('✔\x20Found\x20'+_0x3174b6[_0x32b9cc(0x21b)]+'\x20folder'+(_0x3174b6[_0x32b9cc(0x21b)]!==0x1?'s':'')),await handleSDKOutput(_0x3174b6,_0xd4f89e),0x0;}catch(_0x3072ef){if(_0x3072ef instanceof SDKError)return console[_0x32b9cc(0x25b)](_0x32b9cc(0x218)+_0x3072ef['message']),_0x3072ef[_0x32b9cc(0x26a)]&&console['error']('\x20\x20Cause:\x20'+_0x3072ef[_0x32b9cc(0x26a)]),0x1;throw _0x3072ef;}}}export class SegmentFolderShowCommand extends BaseCommand{[a38_0x359782(0x25e)]=a38_0x359782(0x241);[a38_0x359782(0x21f)]=a38_0x359782(0x278);async['execute'](_0x177bb5){const _0x1e19c0=a38_0x359782,{options:_0x2a7cb2,args:_0x2f8bf8,tdx:_0x544f42}=_0x177bb5;if(_0x2f8bf8['length']===0x0)return console[_0x1e19c0(0x25b)]('Error:\x20Folder\x20reference\x20is\x20required'),console[_0x1e19c0(0x25b)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x277287,childId:_0x36f4ed}=parseSegmentRef(_0x2f8bf8[0x0]);_0x2a7cb2['verbose']&&(console[_0x1e19c0(0x25b)](_0x1e19c0(0x21e)+_0x2a7cb2[_0x1e19c0(0x205)]),console[_0x1e19c0(0x25b)](_0x1e19c0(0x214)+_0x277287),_0x36f4ed&&console[_0x1e19c0(0x25b)](_0x1e19c0(0x259)+_0x36f4ed));if(!_0x36f4ed)return console[_0x1e19c0(0x25b)](_0x1e19c0(0x288)),0x1;const _0x2bbc28=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x277287+'\x27...',()=>_0x544f42[_0x1e19c0(0x21a)][_0x1e19c0(0x1f3)](_0x277287),{'verbose':_0x2a7cb2[_0x1e19c0(0x256)]}),_0x50b87e=_0x2bbc28['data'];_0x2a7cb2['verbose']&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x50b87e);const _0x2fd337=await withSpinner(_0x1e19c0(0x257)+_0x36f4ed+_0x1e19c0(0x219),()=>_0x544f42[_0x1e19c0(0x21a)][_0x1e19c0(0x27f)](_0x50b87e,_0x36f4ed),{'verbose':_0x2a7cb2[_0x1e19c0(0x256)]}),_0x5a1aba=_0x2fd337[_0x1e19c0(0x220)];_0x2a7cb2[_0x1e19c0(0x256)]&&console[_0x1e19c0(0x25b)]('Resolved\x20folder\x20ID:\x20'+_0x5a1aba);const _0x2307c3=await withSpinner(_0x1e19c0(0x23e)+_0x36f4ed+_0x1e19c0(0x219),()=>_0x544f42[_0x1e19c0(0x21a)][_0x1e19c0(0x285)](_0x5a1aba),{'verbose':_0x2a7cb2[_0x1e19c0(0x256)]});return await handleSDKOutput([_0x2307c3[_0x1e19c0(0x220)]],_0x2a7cb2),0x0;}catch(_0x53d9bb){if(_0x53d9bb instanceof SDKError)return console[_0x1e19c0(0x25b)](_0x1e19c0(0x218)+_0x53d9bb[_0x1e19c0(0x1f6)]),_0x53d9bb['cause']&&console[_0x1e19c0(0x25b)](_0x1e19c0(0x242)+_0x53d9bb[_0x1e19c0(0x26a)]),0x1;throw _0x53d9bb;}}}export class SegmentSQLCommand extends BaseCommand{[a38_0x359782(0x25e)]=a38_0x359782(0x1fd);['description']='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a38_0x359782(0x25d)](_0x12da08){const _0x443524=a38_0x359782,{options:_0x160e41,args:_0x31cf17}=_0x12da08,_0x5d220e=_0x160e41,_0x1ab16b=_0x5d220e[_0x443524(0x260)],_0x536241=_0x31cf17[0x0];if(!_0x536241&&!_0x1ab16b)return console[_0x443524(0x25b)](a38_0x3a705a['red'](_0x443524(0x1ef))),console[_0x443524(0x25b)](_0x443524(0x1f2)),console[_0x443524(0x25b)]('\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>'),console[_0x443524(0x25b)](_0x443524(0x255)),console['error']('Examples:'),console[_0x443524(0x25b)](_0x443524(0x230)),console[_0x443524(0x25b)](_0x443524(0x23c)),0x1;if(_0x536241&&_0x1ab16b)return console['error'](a38_0x3a705a['red']('Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both')),0x1;try{let _0x3f652c;if(_0x1ab16b)_0x3f652c=await this[_0x443524(0x1f0)](_0x1ab16b,_0x12da08);else{if(isYamlFilePath(_0x536241))return console[_0x443524(0x25b)](a38_0x3a705a[_0x443524(0x289)](_0x443524(0x202))),console[_0x443524(0x25b)](_0x443524(0x26e)+_0x536241),0x1;else _0x3f652c=await this[_0x443524(0x263)](_0x536241,_0x12da08);}return _0x160e41[_0x443524(0x1eb)]==='json'||_0x160e41[_0x443524(0x1eb)]===_0x443524(0x20d)?await handleSDKOutput([{'sql':_0x3f652c}],_0x160e41):console['log'](_0x3f652c),0x0;}catch(_0x1f7ba6){if(_0x1f7ba6 instanceof SDKError)return console[_0x443524(0x25b)]('Error:\x20'+_0x1f7ba6[_0x443524(0x1f6)]),_0x1f7ba6[_0x443524(0x26a)]&&console[_0x443524(0x25b)](_0x443524(0x242)+_0x1f7ba6[_0x443524(0x26a)]),0x1;throw _0x1f7ba6;}}async['getSQLFromYamlFile'](_0x4ad7b2,_0x4ce1d8){const _0x348266=a38_0x359782,{options:_0x4b70f5,tdx:_0x5ce15f}=_0x4ce1d8;let _0x4dcac8;try{_0x4dcac8=await resolveYamlFilePath(_0x4ad7b2);}catch(_0x29d002){throw new SDKError(ErrorCode[_0x348266(0x207)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x29d002['message']);}_0x4b70f5[_0x348266(0x256)]&&console[_0x348266(0x25b)](_0x348266(0x24b)+_0x4dcac8[_0x348266(0x23f)]+'/'+_0x4dcac8[_0x348266(0x279)]);const _0x319178=await withSpinner('Fetching\x20SQL\x20from\x20rule...',()=>_0x5ce15f[_0x348266(0x21a)]['getSegmentSQLFromYaml'](_0x4dcac8[_0x348266(0x246)],_0x4dcac8[_0x348266(0x23f)],_0x4dcac8[_0x348266(0x279)]),{'verbose':_0x4b70f5[_0x348266(0x256)]});return _0x319178['data'];}async[a38_0x359782(0x263)](_0x467819,_0x4ef122){const _0x1bcc14=a38_0x359782,{options:_0x5a8f9c,tdx:_0x43dcc0}=_0x4ef122,_0x150a65=_0x5a8f9c['parentSegment'],_0x4bf5d5=await resolveSegmentTarget(_0x467819,_0x150a65,_0x5a8f9c[_0x1bcc14(0x256)]);_0x5a8f9c[_0x1bcc14(0x256)]&&console[_0x1bcc14(0x25b)]('Target\x20path:\x20'+_0x4bf5d5);const _0x5c489b=await withSpinner('Resolving\x20\x27'+_0x467819+_0x1bcc14(0x219),()=>_0x43dcc0[_0x1bcc14(0x21a)][_0x1bcc14(0x235)](_0x4bf5d5),{'verbose':_0x5a8f9c[_0x1bcc14(0x256)]}),_0x26201e=_0x5c489b[_0x1bcc14(0x220)];_0x5a8f9c['verbose']&&(console[_0x1bcc14(0x25b)](_0x1bcc14(0x221)+_0x26201e[_0x1bcc14(0x268)]),console[_0x1bcc14(0x25b)](_0x1bcc14(0x23a)+_0x26201e[_0x1bcc14(0x26b)]));if(_0x26201e[_0x1bcc14(0x268)]===_0x1bcc14(0x1ed))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.');if(_0x26201e[_0x1bcc14(0x268)]===_0x1bcc14(0x27d))throw new SDKError(ErrorCode[_0x1bcc14(0x207)],_0x1bcc14(0x1fb));if(!_0x26201e[_0x1bcc14(0x224)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x1bcc14(0x258));const _0x4eb5a5=await withSpinner(_0x1bcc14(0x25c),()=>_0x43dcc0[_0x1bcc14(0x21a)][_0x1bcc14(0x26f)](_0x26201e['parentId'],_0x26201e[_0x1bcc14(0x224)]),{'verbose':_0x5a8f9c[_0x1bcc14(0x256)]});return _0x4eb5a5[_0x1bcc14(0x220)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a38_0x359782(0x25e)]='segment:folder:create';[a38_0x359782(0x21f)]='Create\x20segment\x20folder\x20for\x20organization';async[a38_0x359782(0x25d)](_0x34f591){const _0x570947=a38_0x359782,{options:_0x118437,args:_0x4b9a16,tdx:_0x3375cf}=_0x34f591,_0xba5b13=_0x118437;if(_0x4b9a16[_0x570947(0x21b)]<0x2)return console[_0x570947(0x25b)](_0x570947(0x200)),console['error'](_0x570947(0x27c)),0x1;const _0x4a1cfb=_0x4b9a16[0x0],_0x57f10c=_0x4b9a16[0x1];_0xba5b13[_0x570947(0x256)]&&(console[_0x570947(0x25b)](_0x570947(0x21e)+_0xba5b13[_0x570947(0x205)]),console['error'](_0x570947(0x249)+_0x4a1cfb),console['error'](_0x570947(0x259)+_0x57f10c));let _0x1f4841;if(_0xba5b13[_0x570947(0x211)]){const _0x1d7e42=_0xba5b13[_0x570947(0x211)],_0x2fc784=await withSpinner(_0x570947(0x248)+_0x4a1cfb+_0x570947(0x219),()=>_0x3375cf['segment'][_0x570947(0x1f3)](_0x4a1cfb),{'verbose':_0xba5b13[_0x570947(0x256)]}),_0x2123e9=_0x2fc784[_0x570947(0x220)],_0x114087=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x1d7e42+'\x27...',()=>_0x3375cf[_0x570947(0x21a)][_0x570947(0x27f)](_0x2123e9,_0x1d7e42),{'verbose':_0xba5b13[_0x570947(0x256)]});_0x1f4841=_0x114087[_0x570947(0x220)],_0xba5b13[_0x570947(0x256)]&&console['error'](_0x570947(0x24f)+_0x1f4841);}const _0x4b1727={'name':_0x57f10c,'description':_0xba5b13[_0x570947(0x21f)],'parentFolderId':_0x1f4841},_0x5a793e=await withSpinner(_0x570947(0x229)+_0x57f10c+_0x570947(0x219),()=>_0x3375cf[_0x570947(0x21a)]['createFolder'](_0x4a1cfb,_0x4b1727),{'verbose':_0xba5b13[_0x570947(0x256)]}),_0x1734ab=_0x5a793e['data'];return console[_0x570947(0x25b)](_0x570947(0x27e)+_0x1734ab[_0x570947(0x25e)]+_0x570947(0x262)+_0x1734ab['id']),await handleSDKOutput([_0x1734ab],_0xba5b13),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']='segment:view';[a38_0x359782(0x21f)]=a38_0x359782(0x1ee);async[a38_0x359782(0x25d)](_0x5cafbd){const _0x4e416a=a38_0x359782,{options:_0x18e35d,args:_0x3c50cf,tdx:_0x1a467e}=_0x5cafbd,_0x23baa2=_0x3c50cf[0x0];if(!_0x23baa2)return console[_0x4e416a(0x25b)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error'](_0x4e416a(0x276)),console['error'](_0x4e416a(0x1ff)),console[_0x4e416a(0x25b)](_0x4e416a(0x20e)),console[_0x4e416a(0x25b)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console['error'](_0x4e416a(0x1f8)),console['error'](_0x4e416a(0x1fc)),console[_0x4e416a(0x25b)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x4e416a(0x25b)](_0x4e416a(0x22e)),console['error'](_0x4e416a(0x231)),0x1;try{const _0x2571cd=_0x18e35d[_0x4e416a(0x23f)],_0x4e20b7=await resolveSegmentTarget(_0x23baa2,_0x2571cd,_0x18e35d[_0x4e416a(0x256)]);_0x18e35d[_0x4e416a(0x256)]&&console[_0x4e416a(0x25b)]('Target\x20path:\x20'+_0x4e20b7);const _0xc6e158=await withSpinner('Resolving\x20\x27'+_0x23baa2+'\x27...',()=>_0x1a467e[_0x4e416a(0x21a)][_0x4e416a(0x235)](_0x4e20b7),{'verbose':_0x18e35d[_0x4e416a(0x256)]}),_0x58d199=_0xc6e158[_0x4e416a(0x220)];_0x18e35d[_0x4e416a(0x256)]&&(console[_0x4e416a(0x25b)](_0x4e416a(0x221)+_0x58d199[_0x4e416a(0x268)]),console['error'](_0x4e416a(0x23a)+_0x58d199[_0x4e416a(0x26b)]),_0x58d199[_0x4e416a(0x234)]&&console[_0x4e416a(0x25b)](_0x4e416a(0x204)+_0x58d199['folderId']),_0x58d199[_0x4e416a(0x224)]&&console[_0x4e416a(0x25b)](_0x4e416a(0x216)+_0x58d199['segmentId']));if(_0x18e35d['web']){if(_0x58d199[_0x4e416a(0x268)]===_0x4e416a(0x1ed))return console[_0x4e416a(0x25b)](_0x4e416a(0x237)),0x1;if(_0x58d199['type']===_0x4e416a(0x27d))return console[_0x4e416a(0x25b)](_0x4e416a(0x269)),console[_0x4e416a(0x25b)](_0x4e416a(0x226)),0x1;if(!_0x58d199['segmentId'])throw new SDKError(ErrorCode[_0x4e416a(0x22c)],_0x4e416a(0x258));const _0x727664=getConsoleNextUrl(_0x18e35d[_0x4e416a(0x205)],_0x4e416a(0x287)+_0x58d199['parentId']+_0x4e416a(0x210)+_0x58d199[_0x4e416a(0x224)]);return console['error'](a38_0x3a705a[_0x4e416a(0x253)]('✔')+'\x20Opening\x20'+a38_0x3a705a[_0x4e416a(0x272)](_0x727664)),openBrowser(_0x727664),0x0;}if(_0x58d199[_0x4e416a(0x268)]===_0x4e416a(0x1ed)){if(!_0x58d199[_0x4e416a(0x234)])throw new SDKError(ErrorCode[_0x4e416a(0x1f4)],_0x4e416a(0x223));const _0x4683a8=await withSpinner('Fetching\x20folder\x20details...',()=>_0x1a467e[_0x4e416a(0x21a)]['getFolder'](_0x58d199[_0x4e416a(0x234)]),{'verbose':_0x18e35d['verbose']});await handleSingleObjectOutput(_0x4683a8[_0x4e416a(0x220)],_0x18e35d);}else{if(_0x58d199[_0x4e416a(0x268)]===_0x4e416a(0x21a)){if(!_0x58d199[_0x4e416a(0x224)])throw new SDKError(ErrorCode[_0x4e416a(0x22c)],_0x4e416a(0x258));const _0x21d26a=await withSpinner(_0x4e416a(0x215),()=>_0x1a467e['segment'][_0x4e416a(0x273)](_0x58d199['parentId'],_0x58d199['segmentId']),{'verbose':_0x18e35d[_0x4e416a(0x256)]}),_0x15d770=getConsoleNextUrl(_0x18e35d[_0x4e416a(0x205)],_0x4e416a(0x287)+_0x58d199[_0x4e416a(0x26b)]+_0x4e416a(0x210)+_0x58d199['segmentId']),_0x513ee8=_0x21d26a[_0x4e416a(0x220)];_0x513ee8[_0x4e416a(0x264)]=_0x15d770,await handleSingleObjectOutput(_0x513ee8,_0x18e35d);}else return console[_0x4e416a(0x25b)](_0x4e416a(0x245)),console[_0x4e416a(0x25b)](_0x4e416a(0x206)),0x1;}return 0x0;}catch(_0x59440d){if(_0x59440d instanceof SDKError)return console[_0x4e416a(0x25b)](_0x4e416a(0x218)+_0x59440d[_0x4e416a(0x1f6)]),_0x59440d[_0x4e416a(0x26a)]&&console[_0x4e416a(0x25b)](_0x4e416a(0x242)+_0x59440d[_0x4e416a(0x26a)]),0x1;throw _0x59440d;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a38_0x359782(0x25e)]=a38_0x359782(0x277);[a38_0x359782(0x21f)]=a38_0x359782(0x20a);async[a38_0x359782(0x25d)](_0x3923c7){const _0x2aee5e=a38_0x359782,{options:_0x44b0b9,args:_0x5b7161,tdx:_0x5acebd}=_0x3923c7,_0x38d2f5=_0x5b7161[0x0];if(!_0x38d2f5)return console[_0x2aee5e(0x25b)](_0x2aee5e(0x27a)),console[_0x2aee5e(0x25b)](_0x2aee5e(0x20b)),console[_0x2aee5e(0x25b)](_0x2aee5e(0x239)),console['error'](_0x2aee5e(0x1f8)),console[_0x2aee5e(0x25b)](_0x2aee5e(0x1ea)),console[_0x2aee5e(0x25b)](_0x2aee5e(0x250)),0x1;try{const _0x222fc8=_0x44b0b9[_0x2aee5e(0x23f)],_0x3e9822=await resolveSegmentTarget(_0x38d2f5,_0x222fc8,_0x44b0b9[_0x2aee5e(0x256)]);_0x44b0b9[_0x2aee5e(0x256)]&&console[_0x2aee5e(0x25b)]('Target\x20path:\x20'+_0x3e9822);const _0x4e7f3b=await withSpinner(_0x2aee5e(0x24c)+_0x38d2f5+'\x27...',()=>_0x5acebd[_0x2aee5e(0x21a)]['resolvePathToResource'](_0x3e9822),{'verbose':_0x44b0b9[_0x2aee5e(0x256)]}),_0x1f1987=_0x4e7f3b[_0x2aee5e(0x220)];_0x44b0b9[_0x2aee5e(0x256)]&&(console['error'](_0x2aee5e(0x221)+_0x1f1987[_0x2aee5e(0x268)]),console[_0x2aee5e(0x25b)](_0x2aee5e(0x23a)+_0x1f1987['parentId']));if(_0x1f1987[_0x2aee5e(0x268)]===_0x2aee5e(0x1ed))return console[_0x2aee5e(0x25b)](_0x2aee5e(0x1f5)),console[_0x2aee5e(0x25b)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x1f1987[_0x2aee5e(0x268)]===_0x2aee5e(0x27d))return console[_0x2aee5e(0x25b)](_0x2aee5e(0x23b)),console[_0x2aee5e(0x25b)](_0x2aee5e(0x20f)),0x1;if(!_0x1f1987[_0x2aee5e(0x224)])throw new SDKError(ErrorCode[_0x2aee5e(0x22c)],_0x2aee5e(0x258));const _0x2a1fc5=await withSpinner(_0x2aee5e(0x25c),()=>_0x5acebd['segment']['getSegmentSQL'](_0x1f1987['parentId'],_0x1f1987[_0x2aee5e(0x224)]),{'verbose':_0x44b0b9[_0x2aee5e(0x256)]}),_0x44f3d5=_0x2a1fc5['data'],_0x5dc2f6=await executeSchemaQuery(_0x44f3d5,_0x5acebd,_0x44b0b9);return await handleQueryOutput(_0x5dc2f6,_0x44b0b9),0x0;}catch(_0x4ea668){if(_0x4ea668 instanceof SDKError)return console[_0x2aee5e(0x25b)]('Error:\x20'+_0x4ea668['message']),_0x4ea668[_0x2aee5e(0x26a)]&&console['error'](_0x2aee5e(0x242)+_0x4ea668['cause']),0x1;throw _0x4ea668;}}}
1
+ const a38_0x1ea22c=a38_0x26b0;(function(_0x3820d7,_0x21a106){const _0x2574a5=a38_0x26b0,_0xe0cf1a=_0x3820d7();while(!![]){try{const _0x5315c2=-parseInt(_0x2574a5(0x15b))/0x1+parseInt(_0x2574a5(0x12d))/0x2+parseInt(_0x2574a5(0x199))/0x3*(parseInt(_0x2574a5(0x147))/0x4)+-parseInt(_0x2574a5(0x1b5))/0x5*(parseInt(_0x2574a5(0x15a))/0x6)+parseInt(_0x2574a5(0x17b))/0x7*(-parseInt(_0x2574a5(0x11c))/0x8)+parseInt(_0x2574a5(0x126))/0x9+-parseInt(_0x2574a5(0x172))/0xa;if(_0x5315c2===_0x21a106)break;else _0xe0cf1a['push'](_0xe0cf1a['shift']());}catch(_0x11d2e7){_0xe0cf1a['push'](_0xe0cf1a['shift']());}}}(a38_0x79f3,0x2b112));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 a38_0x26b0(_0x12913c,_0x482d26){_0x12913c=_0x12913c-0x119;const _0x79f30e=a38_0x79f3();let _0x26b032=_0x79f30e[_0x12913c];return _0x26b032;}import a38_0x4a4cce from'chalk';async function resolveSegmentTarget(_0x37f912,_0x2bbf85,_0xc8204c){const _0x6670bb=a38_0x26b0;if(isYamlFilePath(_0x37f912))try{const _0x4ca321=await resolveYamlFilePath(_0x37f912);return _0xc8204c&&(console[_0x6670bb(0x18d)](_0x6670bb(0x19f)+_0x37f912),console[_0x6670bb(0x18d)](_0x6670bb(0x142)+_0x4ca321['parentSegment']),console['error'](_0x6670bb(0x1a1)+_0x4ca321[_0x6670bb(0x12f)]),console['error'](_0x6670bb(0x19c)+(_0x4ca321[_0x6670bb(0x162)]||_0x6670bb(0x12e))),console[_0x6670bb(0x18d)]('\x20\x20Full\x20path:\x20'+_0x4ca321[_0x6670bb(0x136)])),_0x4ca321[_0x6670bb(0x136)];}catch(_0x4c8207){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x6670bb(0x12a)+_0x4c8207[_0x6670bb(0x1bb)]);}if(!_0x2bbf85)throw new SDKError(ErrorCode[_0x6670bb(0x13f)],_0x6670bb(0x158));return _0x2bbf85+'/'+_0x37f912;}export class SegmentDescribeCommand extends BaseCommand{[a38_0x1ea22c(0x12c)]=a38_0x1ea22c(0x160);[a38_0x1ea22c(0x13b)]='Show\x20segment\x20or\x20folder\x20details';async['execute'](_0x6fde4f){const _0x3db083=a38_0x1ea22c,{options:_0x1ad86d,args:_0x55004e,tdx:_0x50d924}=_0x6fde4f,_0x6db683=_0x55004e[0x0],_0x2df3de=!_0x6db683&&!!_0x1ad86d[_0x3db083(0x11e)],_0x4552f2=_0x6db683||_0x1ad86d[_0x3db083(0x11e)];if(!_0x4552f2)return console[_0x3db083(0x18d)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x3db083(0x18d)](_0x3db083(0x18e)),console['error'](_0x3db083(0x190)),console[_0x3db083(0x18d)](_0x3db083(0x149)),console['error'](_0x3db083(0x18f)),console['error'](_0x3db083(0x17d)),console[_0x3db083(0x18d)](_0x3db083(0x122)),0x1;try{const _0x627337=_0x1ad86d['segmentPath'];let _0x355dd3=_0x4552f2;!_0x2df3de&&_0x627337&&!_0x4552f2[_0x3db083(0x175)]('/')&&(_0x355dd3=_0x627337+'/'+_0x4552f2,_0x1ad86d[_0x3db083(0x170)]&&console[_0x3db083(0x18d)](_0x3db083(0x187)+_0x355dd3));const _0x2f4e69=await withSpinner('Resolving\x20path\x20\x27'+_0x355dd3+_0x3db083(0x19b),()=>_0x50d924[_0x3db083(0x11b)][_0x3db083(0x1be)](_0x355dd3),{'verbose':_0x1ad86d[_0x3db083(0x170)]}),_0x4db4eb=_0x2f4e69[_0x3db083(0x11d)];_0x1ad86d[_0x3db083(0x170)]&&(console[_0x3db083(0x18d)](_0x3db083(0x1b8)+_0x4db4eb['type']),console[_0x3db083(0x18d)](_0x3db083(0x125)+_0x4db4eb['parentId']),_0x4db4eb[_0x3db083(0x15c)]&&console['error'](_0x3db083(0x13c)+_0x4db4eb['folderId']),_0x4db4eb[_0x3db083(0x198)]&&console[_0x3db083(0x18d)]('Segment\x20ID:\x20'+_0x4db4eb[_0x3db083(0x198)]));if(_0x4db4eb['type']===_0x3db083(0x137)){const _0x5e78ab=await withSpinner(_0x3db083(0x17c),()=>_0x50d924['segment'][_0x3db083(0x19e)](_0x4db4eb['parentId']),{'verbose':_0x1ad86d[_0x3db083(0x170)]});await handleSingleObjectOutput(_0x5e78ab['data'],_0x1ad86d);}else{if(_0x4db4eb[_0x3db083(0x135)]===_0x3db083(0x165)){if(!_0x4db4eb[_0x3db083(0x15c)])throw new SDKError(ErrorCode[_0x3db083(0x17f)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x5336cd=await withSpinner('Fetching\x20folder\x20details...',()=>_0x50d924[_0x3db083(0x11b)]['getFolder'](_0x4db4eb[_0x3db083(0x15c)]),{'verbose':_0x1ad86d['verbose']});await handleSingleObjectOutput(_0x5336cd[_0x3db083(0x11d)],_0x1ad86d);}else{if(_0x4db4eb[_0x3db083(0x135)]===_0x3db083(0x11b)){if(!_0x4db4eb['segmentId'])throw new SDKError(ErrorCode[_0x3db083(0x176)],_0x3db083(0x1b3));const _0x4ec0c8=await withSpinner('Fetching\x20segment\x20details...',()=>_0x50d924[_0x3db083(0x11b)][_0x3db083(0x12b)](_0x4db4eb[_0x3db083(0x145)],_0x4db4eb[_0x3db083(0x198)]),{'verbose':_0x1ad86d[_0x3db083(0x170)]});await handleSingleObjectOutput(_0x4ec0c8['data'],_0x1ad86d);}}}return 0x0;}catch(_0x50a546){if(_0x50a546 instanceof SDKError)return console['error'](_0x3db083(0x193)+_0x50a546[_0x3db083(0x1bb)]),_0x50a546['cause']&&console[_0x3db083(0x18d)](_0x3db083(0x171)+_0x50a546['cause']),0x1;throw _0x50a546;}}}export class SegmentShowCommand extends BaseCommand{[a38_0x1ea22c(0x12c)]=a38_0x1ea22c(0x192);[a38_0x1ea22c(0x13b)]=a38_0x1ea22c(0x184);async[a38_0x1ea22c(0x14a)](_0x56692b){const _0x3ad3d7=a38_0x1ea22c,{options:_0x1ee30e,args:_0x143720,tdx:_0xf34428}=_0x56692b,_0x58ae21=_0x143720[0x0];if(!_0x58ae21)return console[_0x3ad3d7(0x18d)](_0x3ad3d7(0x124)),console[_0x3ad3d7(0x18d)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console[_0x3ad3d7(0x18d)](_0x3ad3d7(0x169)),console[_0x3ad3d7(0x18d)](_0x3ad3d7(0x190)),console[_0x3ad3d7(0x18d)](_0x3ad3d7(0x182)),console[_0x3ad3d7(0x18d)](_0x3ad3d7(0x148)),0x1;try{const _0x1598c9=_0x1ee30e[_0x3ad3d7(0x11e)],_0x3123a9=await resolveSegmentTarget(_0x58ae21,_0x1598c9,_0x1ee30e[_0x3ad3d7(0x170)]);_0x1ee30e[_0x3ad3d7(0x170)]&&console[_0x3ad3d7(0x18d)]('Target\x20path:\x20'+_0x3123a9);const _0xeec2f3=await withSpinner('Resolving\x20\x27'+_0x58ae21+_0x3ad3d7(0x19b),()=>_0xf34428['segment']['resolvePathToResource'](_0x3123a9),{'verbose':_0x1ee30e['verbose']}),_0x5362e9=_0xeec2f3['data'];_0x1ee30e['verbose']&&(console['error'](_0x3ad3d7(0x1b8)+_0x5362e9['type']),console['error'](_0x3ad3d7(0x125)+_0x5362e9[_0x3ad3d7(0x145)]));if(_0x5362e9[_0x3ad3d7(0x135)]===_0x3ad3d7(0x165))return console[_0x3ad3d7(0x18d)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0x3ad3d7(0x18d)](_0x3ad3d7(0x1a4)),0x1;if(_0x5362e9[_0x3ad3d7(0x135)]===_0x3ad3d7(0x137))return console[_0x3ad3d7(0x18d)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console['error'](_0x3ad3d7(0x1bc)),0x1;if(!_0x5362e9[_0x3ad3d7(0x198)])throw new SDKError(ErrorCode[_0x3ad3d7(0x176)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x175539=await withSpinner(_0x3ad3d7(0x1ba),()=>_0xf34428[_0x3ad3d7(0x11b)][_0x3ad3d7(0x16d)](_0x5362e9['parentId'],_0x5362e9[_0x3ad3d7(0x198)]),{'verbose':_0x1ee30e[_0x3ad3d7(0x170)]});let _0x3b2748=_0x175539[_0x3ad3d7(0x11d)];const _0xd7dfde=resolveLimit(_0x1ee30e[_0x3ad3d7(0x174)],DEFAULT_DISPLAY_LIMIT),_0x183101=/\bLIMIT\s+\d+/i[_0x3ad3d7(0x1b6)](_0x3b2748);!_0x183101&&(_0x3b2748=_0x3b2748[_0x3ad3d7(0x123)]()[_0x3ad3d7(0x19a)](/;+$/,''),_0x3b2748=_0x3ad3d7(0x16b)+_0x3b2748+_0x3ad3d7(0x180)+_0xd7dfde);_0x1ee30e['verbose']&&console['error'](_0x3ad3d7(0x133)+_0x3b2748);const _0x3cdcc3=await withProgressSpinner(_0x3ad3d7(0x19d),async _0x3804a5=>{const _0x188ef1=_0x3ad3d7,_0x1755cf=await _0xf34428['query'][_0x188ef1(0x14a)](_0x3b2748,{'catalog':'td','schema':_0x188ef1(0x157),'onJobId':_0x1fd89b=>{const _0x52660a=_0x188ef1;_0x3804a5[_0x52660a(0x1b9)](_0x1fd89b);}});return _0x1755cf;},{'verbose':_0x1ee30e[_0x3ad3d7(0x170)]}),_0x2353dc=_0x3cdcc3['data'],_0x2d470a=_0x2353dc['jobId']?_0x3ad3d7(0x143)+_0x2353dc[_0x3ad3d7(0x14e)]+']':'';return console[_0x3ad3d7(0x18d)](_0x3ad3d7(0x120)+_0x2353dc[_0x3ad3d7(0x195)][_0x3ad3d7(0x197)][_0x3ad3d7(0x16e)]()+'\x20rows\x20'+(_0x3ad3d7(0x138)+formatElapsed(_0x2353dc[_0x3ad3d7(0x195)][_0x3ad3d7(0x129)])+_0x2d470a)),await handleQueryOutput(_0x2353dc,_0x1ee30e),0x0;}catch(_0x314a66){if(_0x314a66 instanceof SDKError)return console[_0x3ad3d7(0x18d)](_0x3ad3d7(0x188)+_0x314a66[_0x3ad3d7(0x161)]+']'),console[_0x3ad3d7(0x18d)]('\x0a'+_0x314a66[_0x3ad3d7(0x1bb)]),0x1;throw _0x314a66;}}}export class SegmentFolderListCommand extends BaseCommand{['name']=a38_0x1ea22c(0x1a5);[a38_0x1ea22c(0x13b)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async['execute'](_0x4a72a6){const _0x7117f9=a38_0x1ea22c,{options:_0x2e36ba,args:_0x2812c5,tdx:_0x1fcf55}=_0x4a72a6;if(_0x2812c5[_0x7117f9(0x1c1)]===0x0)return console['error'](_0x7117f9(0x159)),console[_0x7117f9(0x18d)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x4d3052=_0x2812c5[0x0];try{_0x2e36ba['verbose']&&(console['error']('Site:\x20'+_0x2e36ba[_0x7117f9(0x14f)]),console[_0x7117f9(0x18d)](_0x7117f9(0x1aa)+_0x4d3052));const _0x520877=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x4d3052+_0x7117f9(0x19b),()=>_0x1fcf55['segment'][_0x7117f9(0x132)](_0x4d3052),{'verbose':_0x2e36ba[_0x7117f9(0x170)]}),_0xc3d781=_0x520877['data'];_0x2e36ba[_0x7117f9(0x170)]&&console[_0x7117f9(0x18d)]('Resolved\x20parent\x20ID:\x20'+_0xc3d781);const _0x1bdbf2=await withSpinner(_0x7117f9(0x18c)+_0x4d3052+_0x7117f9(0x19b),()=>_0x1fcf55['segment'][_0x7117f9(0x16c)](_0xc3d781),{'verbose':_0x2e36ba['verbose']}),_0x49f827=_0x1bdbf2['data'];return console['error'](_0x7117f9(0x14c)+_0x49f827[_0x7117f9(0x1c1)]+_0x7117f9(0x1b1)+(_0x49f827['length']!==0x1?'s':'')),await handleSDKOutput(_0x49f827,_0x2e36ba),0x0;}catch(_0x427119){if(_0x427119 instanceof SDKError)return console[_0x7117f9(0x18d)](_0x7117f9(0x193)+_0x427119[_0x7117f9(0x1bb)]),_0x427119[_0x7117f9(0x164)]&&console[_0x7117f9(0x18d)]('\x20\x20Cause:\x20'+_0x427119[_0x7117f9(0x164)]),0x1;throw _0x427119;}}}export class SegmentFolderShowCommand extends BaseCommand{[a38_0x1ea22c(0x12c)]=a38_0x1ea22c(0x121);[a38_0x1ea22c(0x13b)]=a38_0x1ea22c(0x14d);async[a38_0x1ea22c(0x14a)](_0xe509f1){const _0x1136bb=a38_0x1ea22c,{options:_0x596a99,args:_0x326d27,tdx:_0x59cdc0}=_0xe509f1;if(_0x326d27[_0x1136bb(0x1c1)]===0x0)return console[_0x1136bb(0x18d)]('Error:\x20Folder\x20reference\x20is\x20required'),console[_0x1136bb(0x18d)](_0x1136bb(0x130)),0x1;try{const {parentId:_0x5690f6,childId:_0x317f4a}=parseSegmentRef(_0x326d27[0x0]);_0x596a99[_0x1136bb(0x170)]&&(console[_0x1136bb(0x18d)](_0x1136bb(0x1a9)+_0x596a99[_0x1136bb(0x14f)]),console[_0x1136bb(0x18d)](_0x1136bb(0x1aa)+_0x5690f6),_0x317f4a&&console['error']('Folder\x20name:\x20'+_0x317f4a));if(!_0x317f4a)return console[_0x1136bb(0x18d)](_0x1136bb(0x1a3)),0x1;const _0x4482a5=await withSpinner(_0x1136bb(0x1a7)+_0x5690f6+_0x1136bb(0x19b),()=>_0x59cdc0[_0x1136bb(0x11b)]['resolveParentId'](_0x5690f6),{'verbose':_0x596a99[_0x1136bb(0x170)]}),_0x311036=_0x4482a5[_0x1136bb(0x11d)];_0x596a99['verbose']&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x311036);const _0x1f3fad=await withSpinner(_0x1136bb(0x14b)+_0x317f4a+_0x1136bb(0x19b),()=>_0x59cdc0[_0x1136bb(0x11b)][_0x1136bb(0x1c0)](_0x311036,_0x317f4a),{'verbose':_0x596a99[_0x1136bb(0x170)]}),_0x5e209f=_0x1f3fad[_0x1136bb(0x11d)];_0x596a99[_0x1136bb(0x170)]&&console[_0x1136bb(0x18d)]('Resolved\x20folder\x20ID:\x20'+_0x5e209f);const _0x147dca=await withSpinner(_0x1136bb(0x1ad)+_0x317f4a+_0x1136bb(0x19b),()=>_0x59cdc0[_0x1136bb(0x11b)][_0x1136bb(0x1b0)](_0x5e209f),{'verbose':_0x596a99[_0x1136bb(0x170)]});return await handleSDKOutput([_0x147dca[_0x1136bb(0x11d)]],_0x596a99),0x0;}catch(_0x27701c){if(_0x27701c instanceof SDKError)return console[_0x1136bb(0x18d)](_0x1136bb(0x193)+_0x27701c[_0x1136bb(0x1bb)]),_0x27701c['cause']&&console[_0x1136bb(0x18d)]('\x20\x20Cause:\x20'+_0x27701c[_0x1136bb(0x164)]),0x1;throw _0x27701c;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a38_0x1ea22c(0x177);[a38_0x1ea22c(0x13b)]=a38_0x1ea22c(0x11a);async[a38_0x1ea22c(0x14a)](_0x1df333){const _0x4a1bfe=a38_0x1ea22c,{options:_0x500ae1,args:_0x5a6151}=_0x1df333,_0x274e75=_0x500ae1,_0x41fbd9=_0x274e75[_0x4a1bfe(0x18b)],_0x47afd2=_0x5a6151[0x0];if(!_0x47afd2&&!_0x41fbd9)return console[_0x4a1bfe(0x18d)](a38_0x4a4cce[_0x4a1bfe(0x1b4)](_0x4a1bfe(0x1ac))),console[_0x4a1bfe(0x18d)]('Usage:'),console[_0x4a1bfe(0x18d)](_0x4a1bfe(0x1b2)),console['error'](_0x4a1bfe(0x139)),console['error'](_0x4a1bfe(0x190)),console[_0x4a1bfe(0x18d)]('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x4a1bfe(0x18d)](_0x4a1bfe(0x178)),0x1;if(_0x47afd2&&_0x41fbd9)return console['error'](a38_0x4a4cce[_0x4a1bfe(0x1b4)](_0x4a1bfe(0x1a0))),0x1;try{let _0x40e9c5;if(_0x41fbd9)_0x40e9c5=await this[_0x4a1bfe(0x15f)](_0x41fbd9,_0x1df333);else{if(isYamlFilePath(_0x47afd2))return console[_0x4a1bfe(0x18d)](a38_0x4a4cce['red'](_0x4a1bfe(0x119))),console[_0x4a1bfe(0x18d)](_0x4a1bfe(0x11f)+_0x47afd2),0x1;else _0x40e9c5=await this['getSQLFromServerSegment'](_0x47afd2,_0x1df333);}return _0x500ae1[_0x4a1bfe(0x15d)]==='json'||_0x500ae1[_0x4a1bfe(0x15d)]==='jsonl'?await handleSDKOutput([{'sql':_0x40e9c5}],_0x500ae1):console[_0x4a1bfe(0x134)](_0x40e9c5),0x0;}catch(_0x341cc1){if(_0x341cc1 instanceof SDKError)return console[_0x4a1bfe(0x18d)](_0x4a1bfe(0x193)+_0x341cc1[_0x4a1bfe(0x1bb)]),_0x341cc1[_0x4a1bfe(0x164)]&&console[_0x4a1bfe(0x18d)](_0x4a1bfe(0x171)+_0x341cc1[_0x4a1bfe(0x164)]),0x1;throw _0x341cc1;}}async['getSQLFromYamlFile'](_0x113660,_0x36a2ca){const _0x24c3f3=a38_0x1ea22c,{options:_0x49b0ea,tdx:_0x31e5a6}=_0x36a2ca;let _0x38bd49;try{_0x38bd49=await resolveYamlFilePath(_0x113660);}catch(_0x356bc2){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x356bc2[_0x24c3f3(0x1bb)]);}_0x49b0ea[_0x24c3f3(0x170)]&&console[_0x24c3f3(0x18d)](_0x24c3f3(0x185)+_0x38bd49[_0x24c3f3(0x11e)]+'/'+_0x38bd49[_0x24c3f3(0x12f)]);const _0x4eb264=await withSpinner(_0x24c3f3(0x186),()=>_0x31e5a6[_0x24c3f3(0x11b)][_0x24c3f3(0x150)](_0x38bd49[_0x24c3f3(0x127)],_0x38bd49[_0x24c3f3(0x11e)],_0x38bd49[_0x24c3f3(0x12f)]),{'verbose':_0x49b0ea[_0x24c3f3(0x170)]});return _0x4eb264['data'];}async[a38_0x1ea22c(0x189)](_0x37d91f,_0x3fb8b4){const _0x41154e=a38_0x1ea22c,{options:_0x4322a0,tdx:_0x374eda}=_0x3fb8b4,_0x5854fc=_0x4322a0[_0x41154e(0x11e)],_0x2b43f7=await resolveSegmentTarget(_0x37d91f,_0x5854fc,_0x4322a0[_0x41154e(0x170)]);_0x4322a0[_0x41154e(0x170)]&&console[_0x41154e(0x18d)](_0x41154e(0x166)+_0x2b43f7);const _0x40f20e=await withSpinner('Resolving\x20\x27'+_0x37d91f+_0x41154e(0x19b),()=>_0x374eda[_0x41154e(0x11b)]['resolvePathToResource'](_0x2b43f7),{'verbose':_0x4322a0[_0x41154e(0x170)]}),_0x2bec9e=_0x40f20e[_0x41154e(0x11d)];_0x4322a0[_0x41154e(0x170)]&&(console[_0x41154e(0x18d)]('Resolved\x20type:\x20'+_0x2bec9e[_0x41154e(0x135)]),console[_0x41154e(0x18d)]('Parent\x20ID:\x20'+_0x2bec9e[_0x41154e(0x145)]));if(_0x2bec9e[_0x41154e(0x135)]==='folder')throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x41154e(0x1a6));if(_0x2bec9e[_0x41154e(0x135)]===_0x41154e(0x137))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x41154e(0x131));if(!_0x2bec9e[_0x41154e(0x198)])throw new SDKError(ErrorCode[_0x41154e(0x176)],_0x41154e(0x1b3));const _0x343681=await withSpinner(_0x41154e(0x1ba),()=>_0x374eda['segment'][_0x41154e(0x16d)](_0x2bec9e['parentId'],_0x2bec9e['segmentId']),{'verbose':_0x4322a0[_0x41154e(0x170)]});return _0x343681[_0x41154e(0x11d)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a38_0x1ea22c(0x12c)]=a38_0x1ea22c(0x181);[a38_0x1ea22c(0x13b)]=a38_0x1ea22c(0x13a);async['execute'](_0x2c76f3){const _0x1efa08=a38_0x1ea22c,{options:_0x111806,args:_0x5f02e2,tdx:_0x1f7a5d}=_0x2c76f3,_0x25fcd7=_0x111806;if(_0x5f02e2['length']<0x2)return console[_0x1efa08(0x18d)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console[_0x1efa08(0x18d)](_0x1efa08(0x146)),0x1;const _0x436718=_0x5f02e2[0x0],_0x3af616=_0x5f02e2[0x1];_0x25fcd7[_0x1efa08(0x170)]&&(console[_0x1efa08(0x18d)](_0x1efa08(0x1a9)+_0x25fcd7['site']),console[_0x1efa08(0x18d)](_0x1efa08(0x15e)+_0x436718),console[_0x1efa08(0x18d)](_0x1efa08(0x163)+_0x3af616));let _0x4a80ad;if(_0x25fcd7[_0x1efa08(0x1bf)]){const _0x5ab24e=_0x25fcd7[_0x1efa08(0x1bf)],_0x115d93=await withSpinner(_0x1efa08(0x1a7)+_0x436718+_0x1efa08(0x19b),()=>_0x1f7a5d[_0x1efa08(0x11b)][_0x1efa08(0x132)](_0x436718),{'verbose':_0x25fcd7[_0x1efa08(0x170)]}),_0x128a0a=_0x115d93['data'],_0x249ae5=await withSpinner(_0x1efa08(0x16a)+_0x5ab24e+_0x1efa08(0x19b),()=>_0x1f7a5d['segment']['resolveFolderId'](_0x128a0a,_0x5ab24e),{'verbose':_0x25fcd7[_0x1efa08(0x170)]});_0x4a80ad=_0x249ae5[_0x1efa08(0x11d)],_0x25fcd7[_0x1efa08(0x170)]&&console['error'](_0x1efa08(0x152)+_0x4a80ad);}const _0x234e52={'name':_0x3af616,'description':_0x25fcd7['description'],'parentFolderId':_0x4a80ad},_0x34bd88=await withSpinner('Creating\x20folder\x20\x27'+_0x3af616+_0x1efa08(0x19b),()=>_0x1f7a5d['segment'][_0x1efa08(0x183)](_0x436718,_0x234e52),{'verbose':_0x25fcd7['verbose']}),_0x29e2b6=_0x34bd88[_0x1efa08(0x11d)];return console[_0x1efa08(0x18d)](_0x1efa08(0x196)+_0x29e2b6[_0x1efa08(0x12c)]+_0x1efa08(0x151)+_0x29e2b6['id']),await handleSDKOutput([_0x29e2b6],_0x25fcd7),0x0;}}export class SegmentViewCommand extends BaseCommand{[a38_0x1ea22c(0x12c)]='segment:view';[a38_0x1ea22c(0x13b)]=a38_0x1ea22c(0x173);async[a38_0x1ea22c(0x14a)](_0x228bf3){const _0x573881=a38_0x1ea22c,{options:_0x4f188b,args:_0xa946e5,tdx:_0x415668}=_0x228bf3,_0xc24afe=_0xa946e5[0x0];if(!_0xc24afe)return console[_0x573881(0x18d)](_0x573881(0x1a8)),console[_0x573881(0x18d)](_0x573881(0x1ab)),console[_0x573881(0x18d)](_0x573881(0x17e)),console[_0x573881(0x18d)](_0x573881(0x1a2)),console[_0x573881(0x18d)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console['error']('Examples:'),console[_0x573881(0x18d)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x573881(0x18d)](_0x573881(0x156)),console['error'](_0x573881(0x155)),console[_0x573881(0x18d)](_0x573881(0x1bd)),0x1;try{const _0x38debd=_0x4f188b[_0x573881(0x11e)],_0x97d88=await resolveSegmentTarget(_0xc24afe,_0x38debd,_0x4f188b['verbose']);_0x4f188b['verbose']&&console[_0x573881(0x18d)]('Target\x20path:\x20'+_0x97d88);const _0x45e5ba=await withSpinner(_0x573881(0x16f)+_0xc24afe+_0x573881(0x19b),()=>_0x415668[_0x573881(0x11b)]['resolvePathToResource'](_0x97d88),{'verbose':_0x4f188b[_0x573881(0x170)]}),_0xc4d45c=_0x45e5ba[_0x573881(0x11d)];_0x4f188b[_0x573881(0x170)]&&(console[_0x573881(0x18d)](_0x573881(0x1b8)+_0xc4d45c[_0x573881(0x135)]),console[_0x573881(0x18d)]('Parent\x20ID:\x20'+_0xc4d45c[_0x573881(0x145)]),_0xc4d45c[_0x573881(0x15c)]&&console[_0x573881(0x18d)](_0x573881(0x13c)+_0xc4d45c[_0x573881(0x15c)]),_0xc4d45c[_0x573881(0x198)]&&console['error'](_0x573881(0x13d)+_0xc4d45c[_0x573881(0x198)]));if(_0x4f188b[_0x573881(0x18a)]){if(_0xc4d45c['type']===_0x573881(0x165))return console[_0x573881(0x18d)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0xc4d45c[_0x573881(0x135)]===_0x573881(0x137))return console['error'](_0x573881(0x141)),console[_0x573881(0x18d)](_0x573881(0x1af)),0x1;if(!_0xc4d45c['segmentId'])throw new SDKError(ErrorCode[_0x573881(0x176)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x486b77=getConsoleNextUrl(_0x4f188b[_0x573881(0x14f)],_0x573881(0x1b7)+_0xc4d45c[_0x573881(0x145)]+_0x573881(0x154)+_0xc4d45c[_0x573881(0x198)]);return console[_0x573881(0x18d)](a38_0x4a4cce[_0x573881(0x17a)]('✔')+_0x573881(0x167)+a38_0x4a4cce['cyan'](_0x486b77)),openBrowser(_0x486b77),0x0;}if(_0xc4d45c[_0x573881(0x135)]===_0x573881(0x165)){if(!_0xc4d45c[_0x573881(0x15c)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x573881(0x194));const _0x290f54=await withSpinner(_0x573881(0x1c2),()=>_0x415668[_0x573881(0x11b)][_0x573881(0x1b0)](_0xc4d45c['folderId']),{'verbose':_0x4f188b['verbose']});await handleSingleObjectOutput(_0x290f54[_0x573881(0x11d)],_0x4f188b);}else{if(_0xc4d45c[_0x573881(0x135)]===_0x573881(0x11b)){if(!_0xc4d45c[_0x573881(0x198)])throw new SDKError(ErrorCode[_0x573881(0x176)],_0x573881(0x1b3));const _0x16e4bb=await withSpinner(_0x573881(0x179),()=>_0x415668[_0x573881(0x11b)]['getSegment'](_0xc4d45c[_0x573881(0x145)],_0xc4d45c['segmentId']),{'verbose':_0x4f188b['verbose']}),_0x172073=getConsoleNextUrl(_0x4f188b['site'],_0x573881(0x1b7)+_0xc4d45c[_0x573881(0x145)]+_0x573881(0x154)+_0xc4d45c[_0x573881(0x198)]),_0x4e505c=_0x16e4bb[_0x573881(0x11d)];_0x4e505c['url']=_0x172073,await handleSingleObjectOutput(_0x4e505c,_0x4f188b);}else return console[_0x573881(0x18d)](_0x573881(0x13e)),console[_0x573881(0x18d)](_0x573881(0x128)),0x1;}return 0x0;}catch(_0x4cc92a){if(_0x4cc92a instanceof SDKError)return console[_0x573881(0x18d)](_0x573881(0x193)+_0x4cc92a[_0x573881(0x1bb)]),_0x4cc92a[_0x573881(0x164)]&&console[_0x573881(0x18d)](_0x573881(0x171)+_0x4cc92a[_0x573881(0x164)]),0x1;throw _0x4cc92a;}}}export const SegmentInfoCommand=SegmentViewCommand;function a38_0x79f3(){const _0x4f5d12=['✔\x20Query\x20completed:\x20Processed\x20','segment:folder:show','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','trim','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Parent\x20ID:\x20','2444409YHJckg','content','Use:\x20tdx\x20ps\x20view','elapsedTimeMillis','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','getSegment','name','696704CoAbMu','(root)','segmentName','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','resolveParentId','SQL\x20query:\x0a','log','type','fullPath','parent','in\x20','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','Create\x20segment\x20folder\x20for\x20organization','description','Folder\x20ID:\x20','Segment\x20ID:\x20','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','INVALID_ARGUMENT','Use:\x20tdx\x20ps\x20desc','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20Parent\x20segment:\x20','\x20[Job\x20ID:\x20','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','parentId','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','631916IyckHq','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','execute','Resolving\x20folder\x20\x27','✔\x20Found\x20','Show\x20segment\x20folder\x20details','jobId','site','getSegmentSQLFromYaml','\x27\x20with\x20ID:\x20','Resolved\x20parent\x20folder\x20ID:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','/e/','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','information_schema','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Error:\x20Parent\x20segment\x20name\x20is\x20required','18HWjzfx','154077eDBFRg','folderId','format','Parent\x20segment:\x20','getSQLFromYamlFile','segment:describe','code','folderPath','Folder\x20name:\x20','cause','folder','Target\x20path:\x20','\x20Opening\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Resolving\x20parent\x20folder\x20\x27','SELECT\x20*\x20FROM\x20(\x0a','listFolders','getSegmentSQL','toLocaleString','Resolving\x20\x27','verbose','\x20\x20Cause:\x20','918250desQhi','Show\x20folder\x20or\x20child\x20segment\x20details','limit','includes','SEGMENT_NOT_FOUND','segment:sql','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Fetching\x20segment\x20details...','green','169925GqsZYE','Fetching\x20parent\x20segment\x20details...','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','SEGMENT_FOLDER_NOT_FOUND','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','segment:folder:create','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','createFolder','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Resolved:\x20','Fetching\x20SQL\x20from\x20rule...','Resolved\x20relative\x20path\x20to:\x20','✖\x20Query\x20failed\x20[','getSQLFromServerSegment','web','path','Listing\x20folders\x20for\x20parent\x20\x27','error','Usage:\x20tdx\x20segment\x20describe\x20<path>','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Examples:','Usage:\x20tdx\x20sg\x20desc\x20<name>','segment:show','Error:\x20','Folder\x20ID\x20missing\x20from\x20resolved\x20path','stats','✔\x20Created\x20folder\x20\x27','processedRows','segmentId','6ygAjVN','replace','\x27...','\x20\x20Folder\x20path:\x20','Executing\x20segment\x20query...','getParent','Resolved\x20YAML\x20file:\x20','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','\x20\x20Segment\x20name:\x20','Options:','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','segment:folder:list','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Resolving\x20parent\x20segment\x20\x27','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Site:\x20','Parent\x20name:\x20','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','Fetching\x20folder\x20\x27','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Use:\x20tdx\x20ps\x20view\x20-w','getFolder','\x20folder','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','Segment\x20ID\x20missing\x20from\x20resolved\x20path','red','532345VEkvdN','test','/app/ps/','Resolved\x20type:\x20','setJobId','Fetching\x20SQL\x20for\x20segment...','message','Use:\x20tdx\x20ps\x20show','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','resolvePathToResource','parentFolder','resolveFolderId','length','Fetching\x20folder\x20details...','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','Get\x20SQL\x20query\x20for\x20child\x20segment','segment','64VOQjjd','data','parentSegment','\x20\x20tdx\x20sg\x20sql\x20--path\x20'];a38_0x79f3=function(){return _0x4f5d12;};return a38_0x79f3();}export class SegmentDescCommand extends BaseCommand{['name']='segment:desc';[a38_0x1ea22c(0x13b)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async['execute'](_0x1b67c0){const _0x451ea5=a38_0x1ea22c,{options:_0x1ebe7c,args:_0x3cf231,tdx:_0x2c5401}=_0x1b67c0,_0x4f37c3=_0x3cf231[0x0];if(!_0x4f37c3)return console[_0x451ea5(0x18d)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x451ea5(0x18d)](_0x451ea5(0x191)),console['error'](_0x451ea5(0x168)),console['error'](_0x451ea5(0x190)),console[_0x451ea5(0x18d)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x451ea5(0x18d)](_0x451ea5(0x144)),0x1;try{const _0x12c17a=_0x1ebe7c[_0x451ea5(0x11e)],_0x54ddbe=await resolveSegmentTarget(_0x4f37c3,_0x12c17a,_0x1ebe7c['verbose']);_0x1ebe7c['verbose']&&console[_0x451ea5(0x18d)](_0x451ea5(0x166)+_0x54ddbe);const _0x3778d3=await withSpinner('Resolving\x20\x27'+_0x4f37c3+'\x27...',()=>_0x2c5401['segment'][_0x451ea5(0x1be)](_0x54ddbe),{'verbose':_0x1ebe7c[_0x451ea5(0x170)]}),_0x123b00=_0x3778d3[_0x451ea5(0x11d)];_0x1ebe7c[_0x451ea5(0x170)]&&(console[_0x451ea5(0x18d)](_0x451ea5(0x1b8)+_0x123b00[_0x451ea5(0x135)]),console[_0x451ea5(0x18d)]('Parent\x20ID:\x20'+_0x123b00[_0x451ea5(0x145)]));if(_0x123b00['type']==='folder')return console[_0x451ea5(0x18d)](_0x451ea5(0x153)),console[_0x451ea5(0x18d)](_0x451ea5(0x1ae)),0x1;if(_0x123b00[_0x451ea5(0x135)]===_0x451ea5(0x137))return console[_0x451ea5(0x18d)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x451ea5(0x18d)](_0x451ea5(0x140)),0x1;if(!_0x123b00['segmentId'])throw new SDKError(ErrorCode[_0x451ea5(0x176)],_0x451ea5(0x1b3));const _0x12cc76=await withSpinner(_0x451ea5(0x1ba),()=>_0x2c5401[_0x451ea5(0x11b)][_0x451ea5(0x16d)](_0x123b00['parentId'],_0x123b00[_0x451ea5(0x198)]),{'verbose':_0x1ebe7c[_0x451ea5(0x170)]}),_0x328024=_0x12cc76['data'],_0x4858b5=await executeSchemaQuery(_0x328024,_0x2c5401,_0x1ebe7c);return await handleQueryOutput(_0x4858b5,_0x1ebe7c),0x0;}catch(_0x4cccc9){if(_0x4cccc9 instanceof SDKError)return console[_0x451ea5(0x18d)]('Error:\x20'+_0x4cccc9[_0x451ea5(0x1bb)]),_0x4cccc9['cause']&&console[_0x451ea5(0x18d)]('\x20\x20Cause:\x20'+_0x4cccc9['cause']),0x1;throw _0x4cccc9;}}}
@@ -1 +1 @@
1
- const a39_0x29f973=a39_0x221b;(function(_0x3795f2,_0x4fe440){const _0x41544d=a39_0x221b,_0x56db08=_0x3795f2();while(!![]){try{const _0x1ea82d=-parseInt(_0x41544d(0xfc))/0x1+-parseInt(_0x41544d(0xf3))/0x2*(parseInt(_0x41544d(0xdc))/0x3)+parseInt(_0x41544d(0xff))/0x4+-parseInt(_0x41544d(0xef))/0x5*(parseInt(_0x41544d(0x10b))/0x6)+-parseInt(_0x41544d(0x103))/0x7+-parseInt(_0x41544d(0xec))/0x8*(parseInt(_0x41544d(0xea))/0x9)+parseInt(_0x41544d(0xf7))/0xa;if(_0x1ea82d===_0x4fe440)break;else _0x56db08['push'](_0x56db08['shift']());}catch(_0xe979b){_0x56db08['push'](_0x56db08['shift']());}}}(a39_0x3b2d,0x3c646));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';function a39_0x221b(_0xb59788,_0x59ab6f){_0xb59788=_0xb59788-0xd5;const _0x3b2d08=a39_0x3b2d();let _0x221b76=_0x3b2d08[_0xb59788];return _0x221b76;}import a39_0x1bf031 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a39_0x29f973(0x100)]=a39_0x29f973(0xd7);['description']=a39_0x29f973(0xf9);async[a39_0x29f973(0xfe)](_0x2ef543){const _0x28fd23=a39_0x29f973;console[_0x28fd23(0xd5)](a39_0x1bf031[_0x28fd23(0xf0)]('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console['error'](a39_0x1bf031[_0x28fd23(0xf0)](_0x28fd23(0xed)));const {options:_0x1b67b5,args:_0x4debe2,tdx:_0x34d3b1}=_0x2ef543,_0x40066c=_0x1b67b5;if(_0x4debe2[_0x28fd23(0xda)]===0x0)return console[_0x28fd23(0xd5)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console['error'](_0x28fd23(0xe7)),console[_0x28fd23(0xd5)](_0x28fd23(0xfa)),console[_0x28fd23(0xd5)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console[_0x28fd23(0xd5)](_0x28fd23(0xe3)),console[_0x28fd23(0xd5)](_0x28fd23(0xf6)),0x1;const _0x21234c=_0x4debe2[0x0],_0x5985c4=_0x1b67b5[_0x28fd23(0x105)];let _0x22887f=_0x21234c;_0x5985c4&&!_0x21234c['includes']('/')&&(_0x22887f=_0x5985c4+'/'+_0x21234c,_0x40066c[_0x28fd23(0xd6)]&&console['error'](_0x28fd23(0xe2)+_0x22887f));const _0x20585a=parsePath(_0x22887f);if(_0x20585a[_0x28fd23(0xfb)][_0x28fd23(0xda)]<0x2)return console[_0x28fd23(0xd5)](_0x28fd23(0xee)),console['error'](_0x28fd23(0xe0)),0x1;const _0x36e6b8=_0x20585a[_0x28fd23(0xfb)][0x0],_0x4eba68=getBaseName(_0x22887f),_0xc65197=getParentPath(_0x22887f);_0x40066c[_0x28fd23(0xd6)]&&(console[_0x28fd23(0xd5)]('Site:\x20'+_0x40066c[_0x28fd23(0xf4)]),console['error']('Target\x20path:\x20'+_0x22887f),console[_0x28fd23(0xd5)](_0x28fd23(0xdb)+_0x36e6b8),console[_0x28fd23(0xd5)](_0x28fd23(0xd8)+_0x4eba68),console[_0x28fd23(0xd5)](_0x28fd23(0xe1)+_0xc65197));const _0x59c5cb=await withSpinner(_0x28fd23(0xdd)+_0x36e6b8+_0x28fd23(0xe5),()=>_0x34d3b1[_0x28fd23(0xf5)][_0x28fd23(0x102)](_0x36e6b8),{'verbose':_0x40066c[_0x28fd23(0xd6)]}),_0x446015=_0x59c5cb[_0x28fd23(0x108)];let _0x583139;if(_0x20585a[_0x28fd23(0xfb)][_0x28fd23(0xda)]>0x2){const _0x9a5ebd=await withSpinner(_0x28fd23(0x101)+_0xc65197+_0x28fd23(0xe5),()=>_0x34d3b1[_0x28fd23(0xf5)]['resolvePathToResource'](_0xc65197),{'verbose':_0x40066c[_0x28fd23(0xd6)]}),_0x224e3b=_0x9a5ebd[_0x28fd23(0x108)];if(_0x224e3b[_0x28fd23(0xf1)]!==_0x28fd23(0xd9)&&_0x224e3b[_0x28fd23(0xf1)]!==_0x28fd23(0x106))return console[_0x28fd23(0xd5)](_0x28fd23(0x10a)),0x1;_0x583139=_0x224e3b[_0x28fd23(0x109)];}else{if(_0x40066c[_0x28fd23(0xd9)]){const _0x33414b=await withSpinner(_0x28fd23(0x104)+_0x40066c[_0x28fd23(0xd9)]+_0x28fd23(0xe5),()=>_0x34d3b1[_0x28fd23(0xf5)][_0x28fd23(0xe8)](_0x446015,_0x40066c[_0x28fd23(0xd9)]),{'verbose':_0x40066c[_0x28fd23(0xd6)]});_0x583139=_0x33414b[_0x28fd23(0x108)];}}_0x40066c[_0x28fd23(0xd6)]&&_0x583139&&console['error'](_0x28fd23(0xe4)+_0x583139);const _0x4f822a=await loadJSONFromOptions(_0x40066c[_0x28fd23(0xde)],_0x40066c[_0x28fd23(0xdf)]),_0x122507={'name':_0x4eba68,'description':_0x40066c[_0x28fd23(0x107)],'rule':_0x4f822a,'kind':_0x40066c[_0x28fd23(0xe9)]!==undefined?parseInt(_0x40066c[_0x28fd23(0xe9)],0xa):undefined,'isVisible':_0x40066c[_0x28fd23(0xeb)]?![]:undefined,'segmentFolderId':_0x583139,'countPopulation':_0x40066c[_0x28fd23(0xf2)]?![]:undefined},_0x17a8c2=await withSpinner(_0x28fd23(0xf8)+_0x4eba68+'\x27...',()=>_0x34d3b1[_0x28fd23(0xf5)]['createSegment'](_0x446015,_0x122507),{'verbose':_0x40066c[_0x28fd23(0xd6)]}),_0x55e5a9=_0x17a8c2[_0x28fd23(0x108)];return console[_0x28fd23(0xd5)](_0x28fd23(0xfd)+_0x55e5a9[_0x28fd23(0x100)]+'\x27\x20with\x20ID:\x20'+_0x55e5a9['id']),_0x22887f!==_0x21234c&&console[_0x28fd23(0xd5)](_0x28fd23(0xe6)+_0x22887f),await handleSDKOutput([_0x55e5a9],_0x40066c),0x0;}}function a39_0x3b2d(){const _0x4b057e=['3evtPtA','Resolving\x20parent\x20segment\x20\x27','rule','ruleFile','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','Parent\x20path:\x20','Resolved\x20relative\x20path\x20to:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','Resolved\x20folder\x20ID:\x20','\x27...','\x20\x20\x20Path:\x20','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','resolveFolderId','kind','4743rhlFkB','invisible','3880pXRFKl','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','895670aPXNGr','yellow','type','noCountPopulation','249514syARve','site','segment','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','9631760UnzyjH','Creating\x20segment\x20\x27','Create\x20child\x20segment\x20with\x20filtering\x20rules','Examples:','segments','306449xzpxDb','✔\x20Created\x20segment\x20\x27','execute','1388472dKEXun','name','Resolving\x20folder\x20path\x20\x27','resolveParentId','1378951ipeunS','Resolving\x20folder\x20\x27','segmentPath','parent','description','data','folderId','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','6HJqzJU','error','verbose','segment:create','Segment\x20name:\x20','folder','length','Parent:\x20'];a39_0x3b2d=function(){return _0x4b057e;};return a39_0x3b2d();}
1
+ const a39_0x4d67c5=a39_0xddc5;(function(_0x4b1b19,_0x4f68c7){const _0x152ffb=a39_0xddc5,_0x85f3e9=_0x4b1b19();while(!![]){try{const _0x14e6ae=parseInt(_0x152ffb(0x146))/0x1*(parseInt(_0x152ffb(0x15c))/0x2)+-parseInt(_0x152ffb(0x175))/0x3*(-parseInt(_0x152ffb(0x154))/0x4)+-parseInt(_0x152ffb(0x178))/0x5*(parseInt(_0x152ffb(0x159))/0x6)+parseInt(_0x152ffb(0x14b))/0x7*(parseInt(_0x152ffb(0x14c))/0x8)+parseInt(_0x152ffb(0x15b))/0x9+parseInt(_0x152ffb(0x14a))/0xa+parseInt(_0x152ffb(0x163))/0xb*(-parseInt(_0x152ffb(0x147))/0xc);if(_0x14e6ae===_0x4f68c7)break;else _0x85f3e9['push'](_0x85f3e9['shift']());}catch(_0x1c9386){_0x85f3e9['push'](_0x85f3e9['shift']());}}}(a39_0x44b4,0x81545));import{BaseCommand}from'./command.js';function a39_0xddc5(_0x21189d,_0x437a48){_0x21189d=_0x21189d-0x143;const _0x44b49f=a39_0x44b4();let _0xddc55d=_0x44b49f[_0x21189d];return _0xddc55d;}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';function a39_0x44b4(){const _0xf7f76a=['site','✔\x20Created\x20segment\x20\x27','data','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','3220868ixKcfn','segment','resolveParentId','\x27...','\x27\x20with\x20ID:\x20','46608XClNgD','Resolved\x20folder\x20ID:\x20','4509945eQvPhA','2078SLxhWn','invisible','folderId','yellow','createSegment','description','segments','7590fEoxQV','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','Target\x20path:\x20','execute','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','Parent\x20path:\x20','Resolving\x20folder\x20path\x20\x27','length','\x20\x20\x20Path:\x20','verbose','Resolving\x20parent\x20segment\x20\x27','Creating\x20segment\x20\x27','kind','name','segment:create','parent','error','resolvePathToResource','3uNgIte','includes','segmentPath','5FmFVWS','noCountPopulation','Create\x20child\x20segment\x20with\x20filtering\x20rules','ruleFile','type','Resolving\x20folder\x20\x27','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','rule','resolveFolderId','775LdbldG','40764SaYMXn','Examples:','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','5581750kAhkSk','7OvAVUv','1693672LByQYS','Site:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'];a39_0x44b4=function(){return _0xf7f76a;};return a39_0x44b4();}import a39_0x19e4ce from'chalk';export class SegmentCreateCommand extends BaseCommand{[a39_0x4d67c5(0x170)]=a39_0x4d67c5(0x171);['description']=a39_0x4d67c5(0x17a);async[a39_0x4d67c5(0x166)](_0x26cebf){const _0x38fb90=a39_0x4d67c5;console[_0x38fb90(0x173)](a39_0x19e4ce[_0x38fb90(0x15f)](_0x38fb90(0x164))),console['error'](a39_0x19e4ce[_0x38fb90(0x15f)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x293cb3,args:_0x119d5a,tdx:_0x970dac}=_0x26cebf,_0x3fd4d2=_0x293cb3;if(_0x119d5a[_0x38fb90(0x16a)]===0x0)return console[_0x38fb90(0x173)](_0x38fb90(0x143)),console[_0x38fb90(0x173)]('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console[_0x38fb90(0x173)](_0x38fb90(0x148)),console[_0x38fb90(0x173)](_0x38fb90(0x149)),console[_0x38fb90(0x173)](_0x38fb90(0x14e)),console[_0x38fb90(0x173)](_0x38fb90(0x152)),0x1;const _0x35eadb=_0x119d5a[0x0],_0x22323a=_0x293cb3[_0x38fb90(0x177)];let _0x3bf180=_0x35eadb;_0x22323a&&!_0x35eadb[_0x38fb90(0x176)]('/')&&(_0x3bf180=_0x22323a+'/'+_0x35eadb,_0x3fd4d2[_0x38fb90(0x16c)]&&console[_0x38fb90(0x173)]('Resolved\x20relative\x20path\x20to:\x20'+_0x3bf180));const _0x3d7349=parsePath(_0x3bf180);if(_0x3d7349[_0x38fb90(0x162)][_0x38fb90(0x16a)]<0x2)return console[_0x38fb90(0x173)](_0x38fb90(0x167)),console[_0x38fb90(0x173)]('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x319bb1=_0x3d7349[_0x38fb90(0x162)][0x0],_0xb7ea50=getBaseName(_0x3bf180),_0x2827e6=getParentPath(_0x3bf180);_0x3fd4d2[_0x38fb90(0x16c)]&&(console[_0x38fb90(0x173)](_0x38fb90(0x14d)+_0x3fd4d2[_0x38fb90(0x14f)]),console['error'](_0x38fb90(0x165)+_0x3bf180),console['error']('Parent:\x20'+_0x319bb1),console[_0x38fb90(0x173)]('Segment\x20name:\x20'+_0xb7ea50),console[_0x38fb90(0x173)](_0x38fb90(0x168)+_0x2827e6));const _0x3fe3c2=await withSpinner(_0x38fb90(0x16d)+_0x319bb1+_0x38fb90(0x157),()=>_0x970dac['segment'][_0x38fb90(0x156)](_0x319bb1),{'verbose':_0x3fd4d2[_0x38fb90(0x16c)]}),_0xae7ed7=_0x3fe3c2[_0x38fb90(0x151)];let _0x5abb8f;if(_0x3d7349['segments'][_0x38fb90(0x16a)]>0x2){const _0x12fb81=await withSpinner(_0x38fb90(0x169)+_0x2827e6+_0x38fb90(0x157),()=>_0x970dac['segment'][_0x38fb90(0x174)](_0x2827e6),{'verbose':_0x3fd4d2[_0x38fb90(0x16c)]}),_0xf44a93=_0x12fb81[_0x38fb90(0x151)];if(_0xf44a93[_0x38fb90(0x17c)]!=='folder'&&_0xf44a93[_0x38fb90(0x17c)]!==_0x38fb90(0x172))return console['error'](_0x38fb90(0x153)),0x1;_0x5abb8f=_0xf44a93[_0x38fb90(0x15e)];}else{if(_0x3fd4d2['folder']){const _0x21813d=await withSpinner(_0x38fb90(0x17d)+_0x3fd4d2['folder']+'\x27...',()=>_0x970dac[_0x38fb90(0x155)][_0x38fb90(0x145)](_0xae7ed7,_0x3fd4d2['folder']),{'verbose':_0x3fd4d2['verbose']});_0x5abb8f=_0x21813d[_0x38fb90(0x151)];}}_0x3fd4d2[_0x38fb90(0x16c)]&&_0x5abb8f&&console[_0x38fb90(0x173)](_0x38fb90(0x15a)+_0x5abb8f);const _0x320a85=await loadJSONFromOptions(_0x3fd4d2[_0x38fb90(0x144)],_0x3fd4d2[_0x38fb90(0x17b)]),_0x83b6={'name':_0xb7ea50,'description':_0x3fd4d2[_0x38fb90(0x161)],'rule':_0x320a85,'kind':_0x3fd4d2[_0x38fb90(0x16f)]!==undefined?parseInt(_0x3fd4d2[_0x38fb90(0x16f)],0xa):undefined,'isVisible':_0x3fd4d2[_0x38fb90(0x15d)]?![]:undefined,'segmentFolderId':_0x5abb8f,'countPopulation':_0x3fd4d2[_0x38fb90(0x179)]?![]:undefined},_0x49307a=await withSpinner(_0x38fb90(0x16e)+_0xb7ea50+_0x38fb90(0x157),()=>_0x970dac['segment'][_0x38fb90(0x160)](_0xae7ed7,_0x83b6),{'verbose':_0x3fd4d2['verbose']}),_0x500590=_0x49307a['data'];return console['error'](_0x38fb90(0x150)+_0x500590['name']+_0x38fb90(0x158)+_0x500590['id']),_0x3bf180!==_0x35eadb&&console['error'](_0x38fb90(0x16b)+_0x3bf180),await handleSDKOutput([_0x500590],_0x3fd4d2),0x0;}}
@@ -1 +1 @@
1
- const a40_0x902c3d=a40_0x40a4;(function(_0x54340e,_0x4c3e83){const _0x1d01f4=a40_0x40a4,_0x57da8f=_0x54340e();while(!![]){try{const _0x5626e4=-parseInt(_0x1d01f4(0x197))/0x1+parseInt(_0x1d01f4(0x195))/0x2+-parseInt(_0x1d01f4(0x19d))/0x3+-parseInt(_0x1d01f4(0x196))/0x4*(-parseInt(_0x1d01f4(0x194))/0x5)+-parseInt(_0x1d01f4(0x1ab))/0x6+-parseInt(_0x1d01f4(0x1aa))/0x7+parseInt(_0x1d01f4(0x19a))/0x8;if(_0x5626e4===_0x4c3e83)break;else _0x57da8f['push'](_0x57da8f['shift']());}catch(_0x2c02b6){_0x57da8f['push'](_0x57da8f['shift']());}}}(a40_0x37c5,0xb8959));import{BaseCommand}from'./command.js';function a40_0x37c5(){const _0x3e238e=['\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','\x20field','481852RuIBzu','3398424sZaAex','listFields','parentSegment','15XXJNgM','2822792hEfKBd','508708RrUdzW','887607vPHnkO','site','segment:fields','5906216DPnjMU','name','description','756900cSoTwx','segment','verbose','\x27...','Error:\x20Parent\x20segment\x20name\x20is\x20required','length','error','jsonl','✔\x20Found\x20','List\x20available\x20fields\x20for\x20segmentation','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'];a40_0x37c5=function(){return _0x3e238e;};return a40_0x37c5();}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a40_0x40a4(_0x5a6bdc,_0x2b7fda){_0x5a6bdc=_0x5a6bdc-0x192;const _0x37c585=a40_0x37c5();let _0x40a473=_0x37c585[_0x5a6bdc];return _0x40a473;}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a40_0x902c3d(0x19b)]=a40_0x902c3d(0x199);[a40_0x902c3d(0x19c)]=a40_0x902c3d(0x1a6);async['execute'](_0x36187e){const _0xf47d33=a40_0x902c3d,{options:_0x1abeb4,args:_0x15c7d9,tdx:_0x4d98c4}=_0x36187e,_0x2206cf=_0x15c7d9[0x0]||_0x1abeb4[_0xf47d33(0x193)];if(!_0x2206cf)return console['error'](_0xf47d33(0x1a1)),console[_0xf47d33(0x1a3)](_0xf47d33(0x1a7)),console[_0xf47d33(0x1a3)](_0xf47d33(0x1a8)),0x1;_0x1abeb4[_0xf47d33(0x19f)]&&(console[_0xf47d33(0x1a3)]('Site:\x20'+_0x1abeb4[_0xf47d33(0x198)]),console[_0xf47d33(0x1a3)]('Parent\x20segment:\x20'+_0x2206cf));const _0x34406d=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x2206cf+_0xf47d33(0x1a0),()=>_0x4d98c4[_0xf47d33(0x19e)][_0xf47d33(0x192)](_0x2206cf),{'verbose':_0x1abeb4[_0xf47d33(0x19f)]}),_0x328cc5=_0x34406d['data'];console[_0xf47d33(0x1a3)](_0xf47d33(0x1a5)+_0x328cc5[_0xf47d33(0x1a2)]+_0xf47d33(0x1a9)+(_0x328cc5['length']!==0x1?'s':''));if(_0x1abeb4['json']||_0x1abeb4[_0xf47d33(0x1a4)])return await handleSDKOutput(_0x328cc5,_0x1abeb4),0x0;return displayFieldsHumanReadable(_0x328cc5,_0x2206cf),0x0;}}
1
+ const a40_0x131c05=a40_0x1c85;(function(_0x4ff796,_0x3b9b81){const _0x16bef0=a40_0x1c85,_0x3db28a=_0x4ff796();while(!![]){try{const _0x5ca517=-parseInt(_0x16bef0(0x1b0))/0x1+-parseInt(_0x16bef0(0x1b3))/0x2+-parseInt(_0x16bef0(0x1b9))/0x3+-parseInt(_0x16bef0(0x1bf))/0x4*(parseInt(_0x16bef0(0x1ae))/0x5)+-parseInt(_0x16bef0(0x1b5))/0x6*(-parseInt(_0x16bef0(0x1b8))/0x7)+-parseInt(_0x16bef0(0x1c1))/0x8+parseInt(_0x16bef0(0x1af))/0x9;if(_0x5ca517===_0x3b9b81)break;else _0x3db28a['push'](_0x3db28a['shift']());}catch(_0x31c389){_0x3db28a['push'](_0x3db28a['shift']());}}}(a40_0x5d48,0x75023));function a40_0x5d48(){const _0x57151a=['description','6510984BEcctb','Parent\x20segment:\x20','parentSegment','Listing\x20fields\x20for\x20\x27','listFields','\x20field','jsonl','segment','length','10ihlkCh','22235850VaSDcw','198160JHmibE','segment:fields','Site:\x20','749510tmZWfl','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','3432RsfXUB','name','data','10269wlFlBV','1839357bbyHZx','verbose','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','✔\x20Found\x20','error','json','1661200owFGtZ'];a40_0x5d48=function(){return _0x57151a;};return a40_0x5d48();}function a40_0x1c85(_0x2e9c79,_0x6c7391){_0x2e9c79=_0x2e9c79-0x1ab;const _0x5d489e=a40_0x5d48();let _0x1c85f8=_0x5d489e[_0x2e9c79];return _0x1c85f8;}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a40_0x131c05(0x1b6)]=a40_0x131c05(0x1b1);[a40_0x131c05(0x1c0)]='List\x20available\x20fields\x20for\x20segmentation';async['execute'](_0x4fc354){const _0x379c06=a40_0x131c05,{options:_0x1628fb,args:_0x1b9da6,tdx:_0xc2600f}=_0x4fc354,_0x3026f9=_0x1b9da6[0x0]||_0x1628fb[_0x379c06(0x1c3)];if(!_0x3026f9)return console[_0x379c06(0x1bd)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x379c06(0x1bd)](_0x379c06(0x1bb)),console['error'](_0x379c06(0x1b4)),0x1;_0x1628fb[_0x379c06(0x1ba)]&&(console[_0x379c06(0x1bd)](_0x379c06(0x1b2)+_0x1628fb['site']),console[_0x379c06(0x1bd)](_0x379c06(0x1c2)+_0x3026f9));const _0x202b63=await withSpinner(_0x379c06(0x1c4)+_0x3026f9+'\x27...',()=>_0xc2600f[_0x379c06(0x1ac)][_0x379c06(0x1c5)](_0x3026f9),{'verbose':_0x1628fb['verbose']}),_0x4e8853=_0x202b63[_0x379c06(0x1b7)];console[_0x379c06(0x1bd)](_0x379c06(0x1bc)+_0x4e8853['length']+_0x379c06(0x1c6)+(_0x4e8853[_0x379c06(0x1ad)]!==0x1?'s':''));if(_0x1628fb[_0x379c06(0x1be)]||_0x1628fb[_0x379c06(0x1ab)])return await handleSDKOutput(_0x4e8853,_0x1628fb),0x0;return displayFieldsHumanReadable(_0x4e8853,_0x3026f9),0x0;}}