@treasuredata/tdx 2026.3.35 → 2026.3.36

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_0x219c4c=a33_0xa9f3;(function(_0x908386,_0xef90b1){const _0x3985cb=a33_0xa9f3,_0x322b16=_0x908386();while(!![]){try{const _0xff6df=-parseInt(_0x3985cb(0xfd))/0x1+parseInt(_0x3985cb(0xdc))/0x2*(parseInt(_0x3985cb(0xe5))/0x3)+-parseInt(_0x3985cb(0xee))/0x4+-parseInt(_0x3985cb(0xe9))/0x5+parseInt(_0x3985cb(0x109))/0x6+-parseInt(_0x3985cb(0xfe))/0x7*(parseInt(_0x3985cb(0x111))/0x8)+-parseInt(_0x3985cb(0x106))/0x9*(-parseInt(_0x3985cb(0xfa))/0xa);if(_0xff6df===_0xef90b1)break;else _0x322b16['push'](_0x322b16['shift']());}catch(_0x55a21f){_0x322b16['push'](_0x322b16['shift']());}}}(a33_0x5cf5,0x28758));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';function a33_0x5cf5(){const _0x10ee3a=['account_id','bold','11864iOAnzX','\x20assigned',',\x20user_id:','\x20—\x20','permissions','🔑\x20Effective\x20Permissions','account_owner','padEnd','dim','30duQPzp','verbose','data','ies','1566050UxJnUY','max','Fetching\x20permissions...','policies','length','1077048hROILR','administrator','getMyPermissions','join','args','log','getCurrent','all','policy\x20show','getPolicyUsers','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','map','1730BNiWFx','\x20\x20No\x20permissions','email','190706FmThwg','21dvrbwK','👥\x20Assigned\x20Users','No\x20policies\x20found','policy','listPolicies','policy\x20list','validate','entries','44001edqqXE','\x20\x20•\x20','execute','1571280PlWPMT','name','Member','site','\x20polic','\x20\x20No\x20policies\x20assigned','📋\x20Assigned\x20Policies','\x20\x20\x20','608264KjTXVD','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','Fetching\x20policy...','Listing\x20policies...','context','description','✔\x20Found\x20'];a33_0x5cf5=function(){return _0x10ee3a;};return a33_0x5cf5();}import{withSpinner}from'../utils/spinner.js';import a33_0x28e23e from'chalk';export class PolicyCommand extends BaseCommand{['name']=a33_0x219c4c(0x101);[a33_0x219c4c(0xd8)]='Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions';async[a33_0x219c4c(0x108)](_0x5ca503){const _0x16f95a=a33_0x219c4c,{options:_0xccd901,tdx:_0x27b5d8}=_0x5ca503,_0x4dce0f=await withSpinner(_0x16f95a(0xeb),async()=>{const _0x59115e=_0x16f95a,[_0x4ccc2d,_0x1d77a3]=await Promise[_0x59115e(0xf5)]([_0x27b5d8['user'][_0x59115e(0xf4)](),_0x27b5d8[_0x59115e(0x101)][_0x59115e(0xf0)]()]);return{'userInfo':_0x4ccc2d,'permissions':_0x1d77a3};},{'verbose':_0xccd901['verbose']}),{userInfo:_0x5f54bc,permissions:_0x3f321c}=_0x4dce0f[_0x16f95a(0xe7)];if(isStructuredFormat(_0xccd901))return await handleSingleObjectOutput(_0x3f321c,_0xccd901),0x0;const _0x7f24d4=_0x5f54bc[_0x16f95a(0xe2)]?'Account\x20Owner':_0x5f54bc[_0x16f95a(0xef)]?'Administrator':_0x16f95a(0x10b);console[_0x16f95a(0xf3)]('\x0a'+a33_0x28e23e['bold']('👤')+'\x20'+a33_0x28e23e[_0x16f95a(0xdb)](_0x5f54bc[_0x16f95a(0x10a)])+'\x20'+a33_0x28e23e[_0x16f95a(0xe4)]('('+_0x5f54bc[_0x16f95a(0xfc)]+')')+_0x16f95a(0xdf)+_0x7f24d4),console['log'](a33_0x28e23e['dim'](_0x16f95a(0x110)+_0x27b5d8[_0x16f95a(0xd7)][_0x16f95a(0x10c)]+':'+_0x5f54bc[_0x16f95a(0xda)]+_0x16f95a(0xde)+_0x5f54bc['id']));const _0x3e24c4=_0x3f321c[_0x16f95a(0xec)];console['log']('\x0a'+a33_0x28e23e[_0x16f95a(0xdb)](_0x16f95a(0x10f))+'\x20('+_0x3e24c4[_0x16f95a(0xed)]+'):');if(_0x3e24c4[_0x16f95a(0xed)]===0x0)console['log'](a33_0x28e23e[_0x16f95a(0xe4)](_0x16f95a(0x10e)));else for(const _0x551d16 of _0x3e24c4){console[_0x16f95a(0xf3)](_0x16f95a(0x107)+_0x551d16[_0x16f95a(0x10a)]);}return printPermissionsMap(_0x3f321c['permissions']),console[_0x16f95a(0xf3)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a33_0x219c4c(0x10a)]=a33_0x219c4c(0x103);['description']='List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)';async[a33_0x219c4c(0x108)](_0x2e0bec){const _0x860ef9=a33_0x219c4c,{options:_0x226e92,tdx:_0xee615}=_0x2e0bec,_0x2bf571=await withSpinner(_0x860ef9(0x114),()=>_0xee615[_0x860ef9(0x101)][_0x860ef9(0x102)](),{'verbose':_0x226e92[_0x860ef9(0xe6)]}),_0xe9635d=_0x2bf571[_0x860ef9(0xe7)];console['error'](_0x860ef9(0xd9)+_0xe9635d['length']+_0x860ef9(0x10d)+(_0xe9635d[_0x860ef9(0xed)]!==0x1?_0x860ef9(0xe8):'y'));if(isStructuredFormat(_0x226e92))return await handleSDKOutput(_0xe9635d,_0x226e92),0x0;if(_0xe9635d[_0x860ef9(0xed)]===0x0)console[_0x860ef9(0xf3)](a33_0x28e23e[_0x860ef9(0xe4)](_0x860ef9(0x100)));else for(const _0x206f05 of _0xe9635d){const _0x5c28c0=_0x206f05[_0x860ef9(0xd8)]?a33_0x28e23e[_0x860ef9(0xe4)](_0x860ef9(0xdf)+_0x206f05[_0x860ef9(0xd8)]):'';console[_0x860ef9(0xf3)](_0x860ef9(0x107)+_0x206f05[_0x860ef9(0x10a)]+_0x5c28c0);}return 0x0;}}function a33_0xa9f3(_0x58e628,_0x3986e2){_0x58e628=_0x58e628-0xd7;const _0x5cf520=a33_0x5cf5();let _0xa9f33f=_0x5cf520[_0x58e628];return _0xa9f33f;}export class PolicyShowCommand extends BaseCommand{[a33_0x219c4c(0x10a)]=a33_0x219c4c(0xf6);[a33_0x219c4c(0xd8)]=a33_0x219c4c(0x112);[a33_0x219c4c(0x104)](_0x301db6){const _0x17349d=a33_0x219c4c;if(_0x301db6[_0x17349d(0xf2)][_0x17349d(0xed)]===0x0)return _0x17349d(0xf8);return undefined;}async[a33_0x219c4c(0x108)](_0x3a1edc){const _0x52c5e9=a33_0x219c4c,{options:_0x5b0941,tdx:_0x4a2a58}=_0x3a1edc,_0x37daed=_0x3a1edc[_0x52c5e9(0xf2)][0x0],_0x4b8993=await withSpinner(_0x52c5e9(0x113),async()=>{const _0x428a29=_0x52c5e9,_0x1e4166=await _0x4a2a58[_0x428a29(0x101)]['getPolicy'](_0x37daed),[_0xc72a0d,_0x6547f1]=await Promise[_0x428a29(0xf5)]([_0x4a2a58[_0x428a29(0x101)]['getPolicyPermissions'](_0x1e4166['id']),_0x4a2a58[_0x428a29(0x101)][_0x428a29(0xf7)](_0x1e4166['id'])]);return{'policy':_0x1e4166,'perms':_0xc72a0d,'users':_0x6547f1};},{'verbose':_0x5b0941['verbose']}),{policy:_0x4a62ef,perms:_0x274e19,users:_0x3e1534}=_0x4b8993[_0x52c5e9(0xe7)];if(isStructuredFormat(_0x5b0941))return await handleSingleObjectOutput({..._0x4a62ef,'permissions':_0x274e19[_0x52c5e9(0xe0)],'users':_0x3e1534},_0x5b0941),0x0;console[_0x52c5e9(0xf3)]('\x0a'+a33_0x28e23e[_0x52c5e9(0xdb)]('📋')+'\x20'+a33_0x28e23e[_0x52c5e9(0xdb)](_0x4a62ef['name'])+'\x20'+a33_0x28e23e[_0x52c5e9(0xe4)]('(ID:\x20'+_0x4a62ef['id']+')'));_0x4a62ef[_0x52c5e9(0xd8)]&&console[_0x52c5e9(0xf3)]('\x20\x20\x20'+a33_0x28e23e[_0x52c5e9(0xe4)](_0x4a62ef[_0x52c5e9(0xd8)]));console[_0x52c5e9(0xf3)](_0x52c5e9(0x110)+_0x3e1534[_0x52c5e9(0xed)]+'\x20user'+(_0x3e1534['length']!==0x1?'s':'')+_0x52c5e9(0xdd)),printPermissionsMap(_0x274e19[_0x52c5e9(0xe0)]);if(_0x3e1534[_0x52c5e9(0xed)]>0x0){console[_0x52c5e9(0xf3)]('\x0a'+a33_0x28e23e[_0x52c5e9(0xdb)](_0x52c5e9(0xff))+':');for(const _0x3e6a77 of _0x3e1534){const _0x2842fa=_0x3e6a77[_0x52c5e9(0xfc)]&&_0x3e6a77[_0x52c5e9(0xfc)]!==_0x3e6a77[_0x52c5e9(0x10a)]?a33_0x28e23e[_0x52c5e9(0xe4)]('\x20<'+_0x3e6a77[_0x52c5e9(0xfc)]+'>'):'';console[_0x52c5e9(0xf3)]('\x20\x20•\x20'+_0x3e6a77['name']+_0x2842fa);}}return console['log'](),0x0;}}function printPermissionsMap(_0x4b2dc6){const _0x476dab=a33_0x219c4c,_0x416d4d=Object[_0x476dab(0x105)](_0x4b2dc6);console[_0x476dab(0xf3)]('\x0a'+a33_0x28e23e['bold'](_0x476dab(0xe1))+':');if(_0x416d4d[_0x476dab(0xed)]===0x0){console[_0x476dab(0xf3)](a33_0x28e23e['dim'](_0x476dab(0xfb)));return;}const _0x4beab9=Math[_0x476dab(0xea)](..._0x416d4d[_0x476dab(0xf9)](([_0xd81f97])=>_0xd81f97[_0x476dab(0xed)]));for(const [_0x4d0c8d,_0x7cea]of _0x416d4d){const _0x45ca3=formatOperations(_0x7cea);console[_0x476dab(0xf3)]('\x20\x20'+_0x4d0c8d[_0x476dab(0xe3)](_0x4beab9+0x2)+_0x45ca3);}}function formatOperations(_0xc18264){const _0x25b755=a33_0x219c4c,_0x2045a5=[...new Set(_0xc18264[_0x25b755(0xf9)](_0x50f8a1=>_0x50f8a1['operation']))];return _0x2045a5[_0x25b755(0xf1)](',\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_0x33374f=a34_0x1c9d;(function(_0x1aedef,_0x2ebc6a){const _0x37b660=a34_0x1c9d,_0xa46b7d=_0x1aedef();while(!![]){try{const _0x50731d=parseInt(_0x37b660(0x13b))/0x1*(-parseInt(_0x37b660(0x118))/0x2)+-parseInt(_0x37b660(0x143))/0x3*(parseInt(_0x37b660(0x16f))/0x4)+-parseInt(_0x37b660(0x122))/0x5*(parseInt(_0x37b660(0x131))/0x6)+parseInt(_0x37b660(0x150))/0x7*(-parseInt(_0x37b660(0x171))/0x8)+-parseInt(_0x37b660(0x121))/0x9+-parseInt(_0x37b660(0x130))/0xa+-parseInt(_0x37b660(0x167))/0xb*(-parseInt(_0x37b660(0x120))/0xc);if(_0x50731d===_0x2ebc6a)break;else _0xa46b7d['push'](_0xa46b7d['shift']());}catch(_0x490761){_0xa46b7d['push'](_0xa46b7d['shift']());}}}(a34_0x2a4b,0x34009));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_0x26287e 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';function a34_0x2a4b(){const _0x454268=['method','\x20Profile\x20\x27','password','\x20--default\x27\x20to\x20save\x20permanently','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','11280ccyken','1189647fICGyL','5BaJana','oauth','profile:create','red','\x20API\x20key\x20is\x20valid\x20(User:\x20','(session:\x20','config','profile:remove','API\x20key\x20cannot\x20be\x20empty','llm_agent','Default\x20profile\x20set\x20to:\x20','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','apiKey','Enter\x20description\x20(optional):','141150qoDQqB','238338WkSLhT','warn','profile','join','Removal\x20cancelled','Session\x20profile\x20set\x20to:\x20','profileName','\x20\x20(no\x20profiles\x20found)','/app/mp/ak','\x0aSaved\x20to:\x20','62981snWnmp','split','\x20\x20tdx\x20--profile\x20','✗\x20Validation\x20failed:\x20','database','Enter\x20your\x20TD\x20API\x20key:','create','error','3qVciFF','length','log','status','tdx:\x20profile\x20set','Profile\x20name\x20cannot\x20be\x20empty','tdx:\x20profile\x20create','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','green','Set\x20a\x20profile\x20configuration\x20value','execute','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','Set\x20session\x20profile','721jZZLwT','name','\x0aSetup\x20cancelled','\x27\x20does\x20not\x20exist.','Choose\x20authentication\x20method:','Changing\x20site\x20to\x20\x27','tdx:\x20profile\x20remove','tdx.json','includes','apikey','\x27\x20created','You\x20can\x20find\x20your\x20API\x20key\x20at:','dim','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','confirm','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','llm_project','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Remove\x20a\x20profile','Profile\x20\x27','(cleared)','\x27.\x0a\x0aValid\x20keys:\x20','ERROR','13013TJYaUU','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Failed\x20to\x20remove\x20profile:\x20','validate','logLevel','text','API\x20Key','site','1348824JOfFVk','\x27\x20updated:\x20','24296GvSgkM','\x27\x20requires\x20API\x20key\x20validation.','message','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','description','\x0aOperation\x20cancelled','email','VALID_KEYS','profile:set','OAuth\x20(browser\x20login)','trim','default','yellow','Site\x20was\x20not\x20changed.','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','jobs','\x0aAvailable\x20profiles:','session','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','bold','getUserInfo','Create\x20a\x20new\x20profile','profile:use','2PNhVeK','us01'];a34_0x2a4b=function(){return _0x454268;};return a34_0x2a4b();}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_0x59281d from'prompts';import a34_0x2bee81 from'chalk';function validateProfileName(_0x50f2b4){const _0x2b366e=a34_0x1c9d;if(!_0x50f2b4||!_0x50f2b4[_0x2b366e(0x17b)]())return _0x2b366e(0x148);const _0x17d554=_0x50f2b4['trim']();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x17d554))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x17d554))return _0x2b366e(0x163)+_0x17d554+_0x2b366e(0x113);return!![];}export class ProfileCreateCommand extends BaseCommand{[a34_0x33374f(0x151)]=a34_0x33374f(0x124);['description']=a34_0x33374f(0x116);async[a34_0x33374f(0x14d)](_0x40d347){const _0x394c18=a34_0x33374f,{options:_0x483e28,args:_0xc030a1}=_0x40d347;console[_0x394c18(0x145)](a34_0x2bee81[_0x394c18(0x114)](_0x394c18(0x149)));let _0x1abaae;if(_0xc030a1[_0x394c18(0x144)]>0x0&&_0xc030a1[0x0]){const _0x805968=_0xc030a1[0x0][_0x394c18(0x17b)](),_0x3e276e=validateProfileName(_0x805968);if(_0x3e276e!==!![])return console['error'](a34_0x2bee81[_0x394c18(0x125)](_0x3e276e)),0x1;_0x1abaae=_0x805968;}else{const _0xc4a95e=await a34_0x59281d({'type':_0x394c18(0x16c),'name':_0x394c18(0x137),'message':'Enter\x20profile\x20name:','validate':validateProfileName});if(!_0xc4a95e[_0x394c18(0x137)])return console['log']('\x0aSetup\x20cancelled'),0x1;_0x1abaae=_0xc4a95e[_0x394c18(0x137)][_0x394c18(0x17b)]();}const _0x415b5b=await a34_0x59281d({'type':_0x394c18(0x16c),'name':_0x394c18(0x175),'message':_0x394c18(0x12f)}),_0x16b948=_0x415b5b[_0x394c18(0x175)]?.[_0x394c18(0x17b)]()||undefined,_0x24cb17=_0x483e28['site']||_0x394c18(0x119),_0x48b2ef=await promptSiteSelection(_0x24cb17,_0x1abaae,'Setup\x20cancelled');if(!_0x48b2ef)return 0x1;const _0x49cfa8=resolveSite(_0x48b2ef);if(isOAuthSupported(_0x49cfa8)){const _0x24f5b3=await a34_0x59281d({'type':'select','name':_0x394c18(0x11a),'message':_0x394c18(0x154),'choices':[{'title':_0x394c18(0x17a),'value':_0x394c18(0x123)},{'title':_0x394c18(0x16d),'value':_0x394c18(0x159)}]});if(!_0x24f5b3[_0x394c18(0x11a)])return console[_0x394c18(0x145)](_0x394c18(0x152)),0x1;if(_0x24f5b3[_0x394c18(0x11a)]===_0x394c18(0x123)){if(_0x16b948){const _0x4e726e={'site':_0x49cfa8,'description':_0x16b948};saveProfileToUserConfig(_0x1abaae,_0x4e726e);}return await runOAuthLoginFlow(_0x49cfa8,_0x1abaae,_0x483e28['logLevel']??LogLevel[_0x394c18(0x166)]),0x0;}}console['log'](_0x394c18(0x168)+_0x49cfa8),console[_0x394c18(0x145)](_0x394c18(0x15b)),console['log']('\x20\x20'+getConsoleUrl(_0x49cfa8,_0x394c18(0x139)));const _0x159fdc=await a34_0x59281d({'type':_0x394c18(0x11c),'name':_0x394c18(0x12e),'message':_0x394c18(0x140),'validate':_0x7d73d9=>{if(!_0x7d73d9||!_0x7d73d9['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x159fdc['apiKey'])return console['log'](_0x394c18(0x152)),0x1;const _0x658711=_0x159fdc['apiKey'];console[_0x394c18(0x145)]('Validating\x20API\x20key...');try{const _0xc95711=TDX['create']({'site':_0x49cfa8,'apiKey':_0x658711[_0x394c18(0x17b)](),'logLevel':_0x483e28[_0x394c18(0x16b)]??LogLevel['ERROR']}),_0x226d60=await _0xc95711[_0x394c18(0x110)]['getUserInfo']();console[_0x394c18(0x145)](a34_0x2bee81[_0x394c18(0x14b)]('✓')+_0x394c18(0x126)+_0x226d60[_0x394c18(0x177)]+')');const _0x5129e4=await isKeychainAvailable();_0x5129e4?(await saveAPIKeyAsync(_0x658711['trim'](),_0x49cfa8,_0x1abaae),console[_0x394c18(0x145)](a34_0x2bee81[_0x394c18(0x14b)]('✓')+_0x394c18(0x14a)+_0x1abaae+')')):(console[_0x394c18(0x132)](a34_0x2bee81[_0x394c18(0x17d)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x394c18(0x132)](a34_0x2bee81[_0x394c18(0x17d)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x6f7aa2={'site':_0x49cfa8,..._0x16b948&&{'description':_0x16b948}};return saveProfileToUserConfig(_0x1abaae,_0x6f7aa2),console['log'](a34_0x2bee81[_0x394c18(0x14b)]('✓')+_0x394c18(0x11b)+_0x1abaae+_0x394c18(0x15a)),console['log'](),console[_0x394c18(0x145)](_0x394c18(0x14e)),console['log'](_0x394c18(0x13d)+_0x1abaae+_0x394c18(0x180)),console['log'](_0x394c18(0x13d)+_0x1abaae+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x583d37){if(_0x583d37 instanceof HTTPClientError&&_0x583d37[_0x394c18(0x146)]===0x191)return printAuthError(_0x583d37),0x1;return console['error'](a34_0x2bee81[_0x394c18(0x125)](_0x394c18(0x13e)+(_0x583d37 instanceof Error?_0x583d37[_0x394c18(0x173)]:String(_0x583d37)))),console['error'](_0x394c18(0x15d)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a34_0x33374f(0x151)]=a34_0x33374f(0x129);[a34_0x33374f(0x175)]=a34_0x33374f(0x162);['validate'](_0x493957){const _0x47f199=a34_0x33374f,{args:_0x1af47e}=_0x493957;if(_0x1af47e[_0x47f199(0x144)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async['execute'](_0x38f590){const _0x1cf1d4=a34_0x33374f,{args:_0xef68f8}=_0x38f590,_0x35fffb=_0xef68f8[0x0];console[_0x1cf1d4(0x145)](a34_0x2bee81['bold'](_0x1cf1d4(0x156)));if(!profileExists(_0x35fffb)){console[_0x1cf1d4(0x142)](a34_0x2bee81[_0x1cf1d4(0x125)]('Profile\x20\x27'+_0x35fffb+_0x1cf1d4(0x153))),console[_0x1cf1d4(0x145)](_0x1cf1d4(0x111));const _0x35d38c=listProfiles();if(_0x35d38c[_0x1cf1d4(0x144)]===0x0)console[_0x1cf1d4(0x145)](_0x1cf1d4(0x138));else for(const _0x3196f9 of _0x35d38c){console[_0x1cf1d4(0x145)]('\x20\x20-\x20'+_0x3196f9[_0x1cf1d4(0x151)]);}return 0x1;}const _0x4dcb6b=await a34_0x59281d({'type':_0x1cf1d4(0x15e),'name':_0x1cf1d4(0x15e),'message':_0x1cf1d4(0x174)+_0x35fffb+'\x27?','initial':![]});if(!_0x4dcb6b['confirm'])return console[_0x1cf1d4(0x145)](_0x1cf1d4(0x135)),0x0;try{removeProfileFromUserConfig(_0x35fffb),console[_0x1cf1d4(0x145)](a34_0x2bee81[_0x1cf1d4(0x14b)]('✓')+_0x1cf1d4(0x11b)+_0x35fffb+'\x27\x20removed\x20from\x20configuration');}catch(_0x59320d){return console[_0x1cf1d4(0x142)](a34_0x2bee81[_0x1cf1d4(0x125)](_0x1cf1d4(0x169)+(_0x59320d instanceof Error?_0x59320d['message']:String(_0x59320d)))),0x1;}const _0x55fb5b=await isKeychainAvailable();if(_0x55fb5b){const _0x5dbd6e=await deleteKeychainAPIKey(_0x35fffb);_0x5dbd6e&&console[_0x1cf1d4(0x145)](a34_0x2bee81[_0x1cf1d4(0x14b)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a34_0x33374f(0x179);[a34_0x33374f(0x175)]=a34_0x33374f(0x14c);static [a34_0x33374f(0x178)]=[a34_0x33374f(0x16e),a34_0x33374f(0x13f),'parent_segment',a34_0x33374f(0x160),a34_0x33374f(0x12b),a34_0x33374f(0x175)];[a34_0x33374f(0x16a)](_0x3567a6){const _0x8f1922=a34_0x33374f,{args:_0x29ab9a,options:_0x532ea8}=_0x3567a6,_0x3fdd86=_0x532ea8[_0x8f1922(0x133)]||getActiveProfile();if(!_0x3fdd86)return'No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>';if(_0x29ab9a[_0x8f1922(0x144)]===0x0)return _0x8f1922(0x11e)+ProfileSetCommand[_0x8f1922(0x178)]['join'](',\x20');const _0x268805=_0x29ab9a[0x0];if(!_0x268805['includes']('='))return _0x8f1922(0x12d)+ProfileSetCommand[_0x8f1922(0x178)]['join'](',\x20');const [_0xf86247]=_0x268805[_0x8f1922(0x13c)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x8f1922(0x158)](_0xf86247))return'Unknown\x20key\x20\x27'+_0xf86247+_0x8f1922(0x165)+ProfileSetCommand['VALID_KEYS']['join'](',\x20');return undefined;}async['execute'](_0x4d1da9){const _0x57d411=a34_0x33374f,{args:_0x4f16d7,options:_0x4c2f1d}=_0x4d1da9,_0x13e9b3=_0x4c2f1d[_0x57d411(0x133)]||getActiveProfile(),[_0xbfca42,..._0xf9e5ce]=_0x4f16d7[0x0][_0x57d411(0x13c)]('='),_0x8f0395=_0xf9e5ce[_0x57d411(0x134)]('=');console[_0x57d411(0x145)](a34_0x2bee81[_0x57d411(0x114)](_0x57d411(0x147)));if(!profileExists(_0x13e9b3)){const _0x58c8fe=await a34_0x59281d({'type':_0x57d411(0x15e),'name':_0x57d411(0x141),'message':_0x57d411(0x163)+_0x13e9b3+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x58c8fe[_0x57d411(0x141)])return console[_0x57d411(0x145)]('Operation\x20cancelled'),0x1;}const _0x743483=loadProfile(_0x13e9b3),_0x8c403a=_0x743483?.[_0x57d411(0x128)]||{};if(_0xbfca42===_0x57d411(0x16e)){const _0x430f4d=resolveSite(_0x8f0395);console['log'](_0x57d411(0x155)+_0x430f4d+_0x57d411(0x172)),console[_0x57d411(0x145)](_0x57d411(0x11f)),console[_0x57d411(0x145)]('\x20\x20'+getConsoleUrl(_0x430f4d,_0x57d411(0x139)));const _0x51ec9d=await a34_0x59281d({'type':_0x57d411(0x11c),'name':_0x57d411(0x12e),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0xda84c6=>{const _0x17a3fa=_0x57d411;if(!_0xda84c6||!_0xda84c6['trim']())return _0x17a3fa(0x12a);return!![];}});if(!_0x51ec9d[_0x57d411(0x12e)])return console['log'](_0x57d411(0x176)),0x1;console['log']('Validating\x20API\x20key...');try{const _0x5148a8=TDX[_0x57d411(0x141)]({'site':_0x430f4d,'apiKey':_0x51ec9d['apiKey'][_0x57d411(0x17b)](),'logLevel':_0x4c2f1d[_0x57d411(0x16b)]??LogLevel[_0x57d411(0x166)]}),_0x2f3c56=await _0x5148a8[_0x57d411(0x110)][_0x57d411(0x115)]();console[_0x57d411(0x145)](a34_0x2bee81[_0x57d411(0x14b)]('✓')+_0x57d411(0x126)+_0x2f3c56[_0x57d411(0x177)]+')');const _0x287ca4=await isKeychainAvailable();_0x287ca4?(await saveAPIKeyAsync(_0x51ec9d[_0x57d411(0x12e)][_0x57d411(0x17b)](),_0x430f4d,_0x13e9b3),console[_0x57d411(0x145)](a34_0x2bee81[_0x57d411(0x14b)]('✓')+_0x57d411(0x161))):console[_0x57d411(0x132)](a34_0x2bee81[_0x57d411(0x17d)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x8c403a[_0x57d411(0x16e)]=_0x430f4d;}catch(_0x266f35){if(_0x266f35 instanceof HTTPClientError&&_0x266f35['status']===0x191)return printAuthError(_0x266f35),0x1;return console[_0x57d411(0x142)](a34_0x2bee81[_0x57d411(0x125)](_0x57d411(0x13e)+(_0x266f35 instanceof Error?_0x266f35[_0x57d411(0x173)]:String(_0x266f35)))),console['error'](_0x57d411(0x17e)),0x1;}}else _0x8c403a[_0xbfca42]=_0x8f0395||undefined;return saveProfileToUserConfig(_0x13e9b3,_0x8c403a),console[_0x57d411(0x145)](a34_0x2bee81[_0x57d411(0x14b)]('✓')+_0x57d411(0x11b)+_0x13e9b3+_0x57d411(0x170)+_0xbfca42+'='+(_0x8f0395||_0x57d411(0x164))),0x0;}}function a34_0x1c9d(_0x1c0a2a,_0x4fe3d5){_0x1c0a2a=_0x1c0a2a-0x110;const _0x2a4b43=a34_0x2a4b();let _0x1c9d6f=_0x2a4b43[_0x1c0a2a];return _0x1c9d6f;}export class ProfileUseCommand extends BaseCommand{[a34_0x33374f(0x151)]=a34_0x33374f(0x117);['description']=a34_0x33374f(0x14f);[a34_0x33374f(0x16a)](_0x195c3c){const _0x425750=a34_0x33374f,{args:_0x274ad6}=_0x195c3c;if(_0x274ad6[_0x425750(0x144)]===0x0)return _0x425750(0x17f);return undefined;}async['execute'](_0x25314e){const _0xb861f0=a34_0x33374f,{args:_0x579fe1,options:_0x4633b2}=_0x25314e,_0x34d2f0=_0x579fe1[0x0],_0x4dad68=_0x4633b2[_0xb861f0(0x17c)];cleanExpiredSessions();if(!profileExists(_0x34d2f0)){console[_0xb861f0(0x142)](a34_0x2bee81['red'](_0xb861f0(0x163)+_0x34d2f0+_0xb861f0(0x153))),console[_0xb861f0(0x145)](_0xb861f0(0x111));const _0x1505e1=listProfiles();if(_0x1505e1[_0xb861f0(0x144)]===0x0)console[_0xb861f0(0x145)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x10a03d of _0x1505e1){console['log']('\x20\x20-\x20'+_0x10a03d[_0xb861f0(0x151)]);}return 0x1;}if(_0x4dad68){const _0x59fe71=a34_0x26287e[_0xb861f0(0x134)](getConfigDir(),_0xb861f0(0x157));return saveActiveProfileToUserConfig(_0x34d2f0),console[_0xb861f0(0x145)](_0xb861f0(0x12c)+a34_0x2bee81[_0xb861f0(0x14b)](_0x34d2f0)),console[_0xb861f0(0x145)](a34_0x2bee81[_0xb861f0(0x15c)](_0xb861f0(0x13a)+_0x59fe71)),0x0;}const _0x5ebf25=getSessionID(_0x4633b2['session']);return saveSessionContext({'profile':_0x34d2f0},_0x4633b2[_0xb861f0(0x112)]),console[_0xb861f0(0x145)](_0xb861f0(0x136)+a34_0x2bee81[_0xb861f0(0x14b)](_0x34d2f0)+'\x20'+a34_0x2bee81[_0xb861f0(0x15c)](_0xb861f0(0x127)+_0x5ebf25+')')),console['log'](a34_0x2bee81[_0xb861f0(0x15c)](_0xb861f0(0x15f)+_0x34d2f0+_0xb861f0(0x11d))),0x0;}}
@@ -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
+ const a35_0x5535fa=a35_0x58da;function a35_0x30e9(){const _0x335d0b=['👤\x20','map','description','151tWHULP','81738MZXGCd','config','log','execute','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','147VtEoOz','279830SwyrsR','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','Error:\x20','21rTAZMl','site','message','46LgiceS','2476hceZkU','List\x20all\x20available\x20profiles','length','11NkWsGS','dim','1040040yAgPGl','\x20\x20Global:\x20~/.config/tdx/tdx.json','179912kaQtYh','name','584310CQBKob'];a35_0x30e9=function(){return _0x335d0b;};return a35_0x30e9();}(function(_0x2224d7,_0x297f0c){const _0x55e0c0=a35_0x58da,_0x18d5a8=_0x2224d7();while(!![]){try{const _0xc7e81a=parseInt(_0x55e0c0(0x147))/0x1*(parseInt(_0x55e0c0(0x154))/0x2)+-parseInt(_0x55e0c0(0x14d))/0x3*(parseInt(_0x55e0c0(0x155))/0x4)+parseInt(_0x55e0c0(0x13f))/0x5+-parseInt(_0x55e0c0(0x143))/0x6+parseInt(_0x55e0c0(0x151))/0x7*(parseInt(_0x55e0c0(0x141))/0x8)+-parseInt(_0x55e0c0(0x148))/0x9+-parseInt(_0x55e0c0(0x14e))/0xa*(parseInt(_0x55e0c0(0x158))/0xb);if(_0xc7e81a===_0x297f0c)break;else _0x18d5a8['push'](_0x18d5a8['shift']());}catch(_0x2bf676){_0x18d5a8['push'](_0x18d5a8['shift']());}}}(a35_0x30e9,0x1bdf7));import{BaseCommand}from'./command.js';function a35_0x58da(_0x5cfde1,_0x2c3402){_0x5cfde1=_0x5cfde1-0x13e;const _0x30e92b=a35_0x30e9();let _0x58da7c=_0x30e92b[_0x5cfde1];return _0x58da7c;}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a35_0x1e9583 from'chalk';export class ProfilesCommand extends BaseCommand{[a35_0x5535fa(0x142)]='profiles';[a35_0x5535fa(0x146)]=a35_0x5535fa(0x156);async[a35_0x5535fa(0x14b)](_0x369578){const _0x82f478=a35_0x5535fa,{options:_0x36e9d8}=_0x369578;try{const _0x4fd63c=listProfiles(),_0x282a3c=getActiveProfile();if(_0x4fd63c[_0x82f478(0x157)]===0x0)return console[_0x82f478(0x14a)](_0x82f478(0x14c)),console['log'](_0x82f478(0x14f)),console[_0x82f478(0x14a)](_0x82f478(0x140)),0x0;const _0xbf25e5=_0x4fd63c[_0x82f478(0x145)](_0x1cf2a8=>{const _0x2c143a=_0x82f478,_0x2a22b2=_0x1cf2a8[_0x2c143a(0x142)]===_0x282a3c,_0x33e2c8=getProfileParams(_0x1cf2a8[_0x2c143a(0x149)]);return{'name':_0x1cf2a8[_0x2c143a(0x142)],'active':_0x2a22b2,'scope':_0x1cf2a8['scope'],'description':_0x1cf2a8[_0x2c143a(0x149)][_0x2c143a(0x146)]||'','params':_0x33e2c8};});if(isStructuredFormat(_0x36e9d8))await handleSDKOutput(_0xbf25e5,_0x36e9d8);else for(const _0x48e69b of _0x4fd63c){const _0x4bde66=_0x48e69b[_0x82f478(0x142)]===_0x282a3c?a35_0x1e9583['green']('\x20✓'):'',_0x27a2d8=_0x48e69b[_0x82f478(0x149)][_0x82f478(0x152)]?a35_0x1e9583[_0x82f478(0x13e)]('\x20'+_0x48e69b['config'][_0x82f478(0x152)]):'',_0x17fe73=_0x48e69b['config'][_0x82f478(0x146)]?a35_0x1e9583[_0x82f478(0x13e)]('\x20\x20'+_0x48e69b['config'][_0x82f478(0x146)]):'';console[_0x82f478(0x14a)](_0x82f478(0x144)+_0x48e69b[_0x82f478(0x142)]+_0x4bde66+_0x27a2d8+_0x17fe73);}return 0x0;}catch(_0x5c8de0){return _0x5c8de0 instanceof Error&&console['error'](_0x82f478(0x150)+_0x5c8de0[_0x82f478(0x153)]),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_0xb7ccf4=a36_0x540c;(function(_0x1fbc0b,_0x542c73){const _0x3e817e=a36_0x540c,_0x31b16e=_0x1fbc0b();while(!![]){try{const _0x17c0ff=parseInt(_0x3e817e(0x197))/0x1+-parseInt(_0x3e817e(0x1c2))/0x2*(-parseInt(_0x3e817e(0x1a0))/0x3)+-parseInt(_0x3e817e(0x19f))/0x4+parseInt(_0x3e817e(0x1bf))/0x5*(-parseInt(_0x3e817e(0x1a4))/0x6)+-parseInt(_0x3e817e(0x18c))/0x7*(-parseInt(_0x3e817e(0x199))/0x8)+parseInt(_0x3e817e(0x18f))/0x9*(parseInt(_0x3e817e(0x1b8))/0xa)+-parseInt(_0x3e817e(0x1ac))/0xb*(parseInt(_0x3e817e(0x19a))/0xc);if(_0x17c0ff===_0x542c73)break;else _0x31b16e['push'](_0x31b16e['shift']());}catch(_0x2ddb09){_0x31b16e['push'](_0x31b16e['shift']());}}}(a36_0x4b4f,0x23f60));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a36_0x540c(_0xf9c66c,_0x3bc99c){_0xf9c66c=_0xf9c66c-0x184;const _0x4b4fa3=a36_0x4b4f();let _0x540c56=_0x4b4fa3[_0xf9c66c];return _0x540c56;}import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a36_0xb7ccf4(0x1af)]=a36_0xb7ccf4(0x192);[a36_0xb7ccf4(0x187)]=a36_0xb7ccf4(0x18a);async[a36_0xb7ccf4(0x18e)](_0x53af74){const _0x3f3554=a36_0xb7ccf4,{options:_0x373973,args:_0x9ddcd1,tdx:_0x21ff50}=_0x53af74,_0x396ab3={..._0x373973,'limitStructuredFormats':!![]},_0x1ca2e4=_0x9ddcd1[0x0],_0x21f6d7=_0x373973[_0x3f3554(0x1a2)];let _0x10c9cf;try{if(_0x21f6d7)_0x10c9cf=readSqlStatementsFromFile(_0x21f6d7);else{if(_0x1ca2e4==='-')_0x10c9cf=await readSqlStatementsFromStdin();else{if(_0x1ca2e4&&isSqlFilePath(_0x1ca2e4))_0x10c9cf=readSqlStatementsFromFile(_0x1ca2e4);else{if(_0x1ca2e4)_0x10c9cf=splitSqlStatements(_0x1ca2e4);else throw new Error(_0x3f3554(0x1a8));}}}}catch(_0xe312c7){return console[_0x3f3554(0x1bb)](_0x3f3554(0x1a6)+_0xe312c7[_0x3f3554(0x186)]),0x1;}const _0x539d44=_0x373973[_0x3f3554(0x196)]||_0x3f3554(0x18d),_0x2e7848=_0x373973[_0x3f3554(0x193)];try{const _0x30e293=[],_0x5a0fcc=!!_0x373973[_0x3f3554(0x1aa)];for(let _0x404183=0x0;_0x404183<_0x10c9cf['length'];_0x404183++){const _0x21673a=_0x10c9cf[_0x404183],_0x23f1e0=_0x404183+0x1,_0x82c5a8=_0x10c9cf[_0x3f3554(0x1b7)],_0x461c4c=_0x82c5a8>0x1;_0x373973[_0x3f3554(0x18b)]&&(console[_0x3f3554(0x1bb)]('\x0a'+(_0x461c4c?'Statement\x20'+_0x23f1e0+'/'+_0x82c5a8+':':'')),console[_0x3f3554(0x1bb)](_0x3f3554(0x185)+_0x373973[_0x3f3554(0x1a1)]),console['error'](_0x3f3554(0x194)+(_0x2e7848||'td')),console[_0x3f3554(0x1bb)](_0x3f3554(0x1bc)+_0x539d44),console[_0x3f3554(0x1bb)](_0x3f3554(0x1b9)+_0x21673a));const _0x532ea2=_0x461c4c?_0x3f3554(0x1a5)+_0x23f1e0+'/'+_0x82c5a8+_0x3f3554(0x1b0):_0x3f3554(0x190);try{const _0x400b7d=await withProgressSpinner(_0x532ea2,async _0x5e887f=>{const _0x517ac0=_0x3f3554,_0x51705c=await _0x21ff50[_0x517ac0(0x192)][_0x517ac0(0x18e)](_0x21673a,{'catalog':_0x2e7848,'schema':_0x539d44,'onJobId':_0x593c28=>{const _0x272154=_0x517ac0;_0x5e887f[_0x272154(0x1b1)](_0x593c28);},'onProgress':_0x355d5c=>{const _0x3df753=_0x517ac0;_0x5e887f[_0x3df753(0x1b4)](_0x3df753(0x1a7)+_0x355d5c[_0x3df753(0x19e)]+']'),_0x5e887f[_0x3df753(0x198)](formatRows(_0x355d5c[_0x3df753(0x19c)])+_0x3df753(0x184)+_0x355d5c[_0x3df753(0x1ab)]+'/'+_0x355d5c[_0x3df753(0x1a9)]+_0x3df753(0x1bd));}});return _0x51705c;},{'verbose':_0x373973['verbose']}),_0x2089a7=_0x400b7d[_0x3f3554(0x188)],_0x4e778a=_0x2089a7[_0x3f3554(0x1ba)]?_0x3f3554(0x19b)+_0x2089a7[_0x3f3554(0x1ba)]+']':'',_0x25c2c2=_0x461c4c?_0x3f3554(0x195)+_0x23f1e0+'/'+_0x82c5a8+_0x3f3554(0x1be):'';console['error']('✔\x20'+_0x25c2c2+_0x3f3554(0x19d)+formatRows(_0x2089a7[_0x3f3554(0x1a3)][_0x3f3554(0x19c)])+_0x3f3554(0x184)+(_0x3f3554(0x1b6)+formatElapsed(_0x2089a7[_0x3f3554(0x1a3)][_0x3f3554(0x1ad)])+_0x4e778a));if(_0x461c4c&&_0x5a0fcc){const _0x3c5b07=resolveOutputOptions(_0x396ab3),_0x4652fa=await formatQueryOutput(_0x2089a7,_0x3c5b07);_0x30e293[_0x3f3554(0x1b2)](_0x4652fa);}else await handleQueryOutput(_0x2089a7,_0x396ab3);}catch(_0x44d0c6){const _0x1493eb=_0x461c4c?_0x3f3554(0x195)+_0x23f1e0+'/'+_0x82c5a8+':\x0a':'',_0xa391cd=_0x44d0c6 instanceof SDKError?_0x44d0c6[_0x3f3554(0x1ae)]:_0x44d0c6['message'];return console[_0x3f3554(0x1bb)](''+_0x1493eb+_0xa391cd),0x1;}}if(_0x10c9cf[_0x3f3554(0x1b7)]>0x1&&_0x5a0fcc&&_0x30e293[_0x3f3554(0x1b7)]>0x0){const _0x1709ab=_0x30e293[_0x3f3554(0x1c1)]('\x0a');writeFileSync(_0x373973[_0x3f3554(0x1aa)],_0x1709ab),console[_0x3f3554(0x1bb)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x373973[_0x3f3554(0x1aa)]);}return 0x0;}catch(_0x47afe2){throw _0x47afe2;}}[a36_0xb7ccf4(0x1b3)](_0x512a97){const _0x1167c6=a36_0xb7ccf4,_0x255d58=_0x512a97[_0x1167c6(0x191)][0x0],_0x343e73=_0x512a97[_0x1167c6(0x1b5)][_0x1167c6(0x1a2)];if(!_0x255d58&&!_0x343e73)return _0x1167c6(0x189);if(_0x255d58&&_0x343e73)return _0x1167c6(0x1c0);return undefined;}}function a36_0x4b4f(){const _0x565cc4=['Query\x20completed:\x20Processed\x20','state','542592atbmdP','108AbKIvm','site','file','stats','281538ruGVjp','Executing\x20statement\x20','Error:\x20','Executing\x20query\x20[','No\x20SQL\x20provided','totalSplits','output','completedSplits','31526trTJfa','elapsedTimeMillis','originalMessage','name','...','setJobId','push','validate','setPhase','options','in\x20','length','10KZFLzu','SQL:\x20','jobId','error','Schema:\x20','\x20splits','\x20-\x20','25xaGeKW','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','join','9544Ksgzar','\x20rows\x20','Site:\x20','message','description','data','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','Run\x20Trino\x20queries\x20(streaming)','verbose','7HiRyRw','information_schema','execute','1804095ohBzAd','Executing\x20query...','args','query','catalog','Catalog:\x20','Statement\x20','database','185083MKFoqr','setExtra','1378504yqSoCu','888WBGxfL','\x20[Job\x20ID:\x20','processedRows'];a36_0x4b4f=function(){return _0x565cc4;};return a36_0x4b4f();}
@@ -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_0x1dba0e=a37_0x39bd;(function(_0x253756,_0x5c85aa){const _0x543937=a37_0x39bd,_0x4cd11d=_0x253756();while(!![]){try{const _0x14f1b0=-parseInt(_0x543937(0x17e))/0x1*(-parseInt(_0x543937(0x1a4))/0x2)+-parseInt(_0x543937(0x1ab))/0x3*(parseInt(_0x543937(0x1a1))/0x4)+-parseInt(_0x543937(0x18e))/0x5*(-parseInt(_0x543937(0x197))/0x6)+-parseInt(_0x543937(0x164))/0x7+parseInt(_0x543937(0x1ea))/0x8*(-parseInt(_0x543937(0x17d))/0x9)+parseInt(_0x543937(0x1e1))/0xa+parseInt(_0x543937(0x1eb))/0xb;if(_0x14f1b0===_0x5c85aa)break;else _0x4cd11d['push'](_0x4cd11d['shift']());}catch(_0x14c469){_0x4cd11d['push'](_0x4cd11d['shift']());}}}(a37_0x4b48,0x46dcb));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a37_0x4b48(){const _0x59820f=['substring','user','/app/queries/editor?queryId=','Creating\x20schedule...','just\x20now','tsv','lastRun','cyan','4VhWUKu','validate','has_next_page','7014VrnQEf','\x20(showing\x20','updated_at','limit','Schedule\x20created:\x20','\x20execution','success','840363PrMpkI','Searching\x20scheduled\x20queries\x20matching\x20\x22','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','result','Getting\x20schedule\x20history...','start_at','round','INVALID_ARGUMENT','end_at','job_id','Update\x20a\x20scheduled\x20query','\x20matching\x20\x22','trim','\x20(use\x20--limit\x20to\x20see\x20more)','time','last_job','update','keys','user_name','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','green','entries','Failed\x20to\x20read\x20file:\x20','soon','engine_version','from','name','delay','trino','schedule:update','join','engineVersion','toLocaleDateString','Cancelled','schedules','padEnd','data','Deleting\x20schedule...','statusIcon','type','max','log','\x20\x20Timezone:\x20','create','\x20\x20Job\x20ID:\x20','getTime','schedule:history','status','ies','next_run_at','schedule:create','listQueries','length','jsonl','4922210SwhMJB','Query\x20file\x20is\x20empty','map','args','Schedule\x20updated:\x20','show','description','schedule:list','\x20\x20→\x20','5752GAmbdd','2593756CGjMtC','\x20schedules','retry_limit','cron','execute','Create\x20a\x20scheduled\x20query','in\x20','1442294STykhc','pagination','query','\x20\x20Type:\x20','error','red','count','h\x20ago','scheduled_at','\x20\x20Database:\x20','Found\x20','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','Listing\x20scheduled\x20queries...','history','📅\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','abs','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','queryUrl','Getting\x20schedule\x20details...','verbose','Showing\x20first\x20','output','options','priority','5013waFUaS','6IbbmjJ','yes','format','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','num','schedule:run','nextRun','Show\x20schedule\x20execution\x20history','executing_user_id','retryLimit','database','ended_at','jobs','timezone','(unnamed)','file','2139190dTSSVP','schedule:delete','queries','run','\x20\x20Num:\x20','Delete\x20a\x20scheduled\x20query','Updating\x20schedule:\x20','site','Running\x20schedule:\x20','6KXKSDC','Updating\x20schedule...'];a37_0x4b48=function(){return _0x59820f;};return a37_0x4b48();}function a37_0x39bd(_0x4ed289,_0x58dd67){_0x4ed289=_0x4ed289-0x160;const _0x4b489e=a37_0x4b48();let _0x39bdcd=_0x4b489e[_0x4ed289];return _0x39bdcd;}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_0x36f3e3 from'chalk';function formatRelativeTime(_0x1c8007){const _0x264474=a37_0x39bd,_0xa73d76=new Date(_0x1c8007),_0x129b90=new Date(),_0x419475=_0xa73d76['getTime']()-_0x129b90[_0x264474(0x1d8)](),_0x447d71=Math[_0x264474(0x174)](_0x419475)/0x3e8,_0x5354b3=_0x419475<0x0;if(_0x447d71<0x3c)return _0x5354b3?_0x264474(0x19d):_0x264474(0x1c2);else{if(_0x447d71<0xe10){const _0x4176e6=Math[_0x264474(0x1b1)](_0x447d71/0x3c);return _0x5354b3?_0x4176e6+'m\x20ago':_0x264474(0x163)+_0x4176e6+'m';}else{if(_0x447d71<0x15180){const _0x6ac09c=Math[_0x264474(0x1b1)](_0x447d71/0xe10);return _0x5354b3?_0x6ac09c+_0x264474(0x16b):_0x264474(0x163)+_0x6ac09c+'h';}else{if(_0x447d71<0x93a80){const _0x436024=Math[_0x264474(0x1b1)](_0x447d71/0x15180);return _0x5354b3?_0x436024+'d\x20ago':_0x264474(0x163)+_0x436024+'d';}else return _0xa73d76[_0x264474(0x1cb)]();}}}}export class ScheduleListCommand extends BaseCommand{['name']=a37_0x1dba0e(0x1e8);[a37_0x1dba0e(0x1e7)]='List\x20scheduled\x20queries';async['execute'](_0x417283){const _0xd04cd8=a37_0x1dba0e,{options:_0x2e03f,args:_0x218df7,tdx:_0xd9992f}=_0x417283,_0x61bd7d=resolveLimit(_0x2e03f[_0xd04cd8(0x1a7)],DEFAULT_DISPLAY_LIMIT),_0x1e7615=_0x218df7[0x0],_0x24ec00=_0x1e7615?_0xd04cd8(0x1ac)+_0x1e7615+'\x22...':_0xd04cd8(0x170),_0x90eaf=await withSpinner(_0x24ec00,()=>_0xd9992f[_0xd04cd8(0x1cd)][_0xd04cd8(0x1de)]({'limit':_0x61bd7d,'scheduled':!![],'pattern':_0x1e7615}),{'verbose':_0x2e03f['verbose']}),_0x43ea21=_0x90eaf[_0xd04cd8(0x1cf)][_0xd04cd8(0x190)],_0x208101=_0x90eaf[_0xd04cd8(0x1cf)][_0xd04cd8(0x165)][_0xd04cd8(0x1a3)],_0xfbcef6=_0x1e7615?_0xd04cd8(0x1b6)+_0x1e7615+'\x22':'';_0x208101?console[_0xd04cd8(0x168)](_0xd04cd8(0x179)+_0x43ea21[_0xd04cd8(0x1df)]+_0xd04cd8(0x1ec)+_0xfbcef6+_0xd04cd8(0x1b8)):console['error']('Found\x20'+_0x43ea21[_0xd04cd8(0x1df)]+'\x20scheduled\x20quer'+(_0x43ea21['length']!==0x1?_0xd04cd8(0x1db):'y')+_0xfbcef6);if(_0x2e03f['format']==='json'||_0x2e03f[_0xd04cd8(0x180)]===_0xd04cd8(0x1e0)||_0x2e03f['format']==='table'||_0x2e03f[_0xd04cd8(0x180)]===_0xd04cd8(0x19e)){const _0x593fc2=_0x43ea21[_0xd04cd8(0x1e3)](_0x523951=>({'id':_0x523951['id'],'name':_0x523951['name'],'cron':_0x523951[_0xd04cd8(0x160)],'database':_0x523951[_0xd04cd8(0x188)]?.['name'],'type':_0x523951[_0xd04cd8(0x1d2)],'timezone':_0x523951['time_zone'],'user_name':_0x523951[_0xd04cd8(0x19a)]?.[_0xd04cd8(0x1c5)],'updated_at':_0x523951[_0xd04cd8(0x1a6)],'next_run_at':_0x523951[_0xd04cd8(0x1dc)],'last_job_status':_0x523951[_0xd04cd8(0x1ba)]?.['status']}));await handleSDKOutput(_0x593fc2,_0x2e03f);}else{if(_0x43ea21[_0xd04cd8(0x1df)]===0x0)console[_0xd04cd8(0x1d4)]('No\x20scheduled\x20queries\x20found');else{const _0x1d2c96=_0x2e03f[_0xd04cd8(0x195)],_0x5690b1=_0x43ea21[_0xd04cd8(0x1e3)](_0xc7ca82=>{const _0xc01cfd=_0xd04cd8,_0x3f17d9=_0xc7ca82['last_job']?.[_0xc01cfd(0x1da)]?_0xc7ca82['last_job'][_0xc01cfd(0x1da)]===_0xc01cfd(0x1aa)?'✓':'✗':'-',_0x2ddc54=_0xc7ca82[_0xc01cfd(0x1ba)]?.[_0xc01cfd(0x189)]?formatRelativeTime(_0xc7ca82[_0xc01cfd(0x1ba)][_0xc01cfd(0x189)]):'never',_0x3aacef=_0xc7ca82[_0xc01cfd(0x1dc)]?formatRelativeTime(_0xc7ca82[_0xc01cfd(0x1dc)]):'-',_0x4c51d1=_0xc7ca82[_0xc01cfd(0x160)]||'',_0x38d0fe=_0xc7ca82[_0xc01cfd(0x1c5)]||_0xc01cfd(0x18c),_0x3cf889=getConsoleUrl(_0x1d2c96,_0xc01cfd(0x19b)+_0xc7ca82['id']);return{'statusIcon':_0x3f17d9,'lastRun':_0x2ddc54,'nextRun':_0x3aacef,'cron':_0x4c51d1,'name':_0x38d0fe,'queryUrl':_0x3cf889,'status':_0xc7ca82['last_job']?.[_0xc01cfd(0x1da)]};}),_0x38bc97=Math['max'](..._0x5690b1[_0xd04cd8(0x1e3)](_0x1f09c1=>_0x1f09c1[_0xd04cd8(0x19f)][_0xd04cd8(0x1df)])),_0x56c9c5=Math[_0xd04cd8(0x1d3)](..._0x5690b1[_0xd04cd8(0x1e3)](_0x3759fd=>_0x3759fd['nextRun'][_0xd04cd8(0x1df)])),_0x53e807=Math[_0xd04cd8(0x1d3)](..._0x5690b1[_0xd04cd8(0x1e3)](_0x1ed5f8=>_0x1ed5f8[_0xd04cd8(0x160)]['length'])),_0x2b69fc=_0x5690b1['map'](_0x3e6157=>{const _0x5dde8a=_0xd04cd8,_0x44aee0=_0x3e6157[_0x5dde8a(0x1da)]===_0x5dde8a(0x1aa)?a37_0x36f3e3[_0x5dde8a(0x1bf)](_0x3e6157[_0x5dde8a(0x1d1)]):_0x3e6157[_0x5dde8a(0x1da)]===_0x5dde8a(0x168)?a37_0x36f3e3[_0x5dde8a(0x169)](_0x3e6157[_0x5dde8a(0x1d1)]):a37_0x36f3e3['dim'](_0x3e6157[_0x5dde8a(0x1d1)]),_0x4854ac=_0x3e6157[_0x5dde8a(0x19f)][_0x5dde8a(0x1ce)](_0x38bc97),_0x121205=_0x3e6157[_0x5dde8a(0x184)][_0x5dde8a(0x1ce)](_0x56c9c5),_0x291925=_0x3e6157[_0x5dde8a(0x160)]?a37_0x36f3e3[_0x5dde8a(0x1a0)](_0x3e6157[_0x5dde8a(0x160)][_0x5dde8a(0x1ce)](_0x53e807)):'\x20'['repeat'](_0x53e807),_0x3b17c1=hyperlink(_0x3e6157[_0x5dde8a(0x1c5)],_0x3e6157[_0x5dde8a(0x176)]);return _0x5dde8a(0x172)+_0x44aee0+'\x20'+_0x4854ac+_0x5dde8a(0x1e9)+_0x121205+'\x20\x20'+_0x291925+'\x20\x20'+_0x3b17c1;});await writeOutput(_0x2b69fc[_0xd04cd8(0x1c9)]('\x0a'),_0x2e03f[_0xd04cd8(0x17a)],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a37_0x1dba0e(0x1c5)]='schedule:show';[a37_0x1dba0e(0x1e7)]='Show\x20schedule\x20details';[a37_0x1dba0e(0x1a2)](_0x224104){const _0xd80b3f=a37_0x1dba0e,_0x753f16=_0x224104[_0xd80b3f(0x1e4)][0x0];if(!_0x753f16)return _0xd80b3f(0x1be);return undefined;}async[a37_0x1dba0e(0x161)](_0x188091){const _0x1bdc75=a37_0x1dba0e,{options:_0x5c2b96,args:_0xac2a62,tdx:_0x1f1fa2}=_0x188091,_0x2360a2=_0xac2a62[0x0],_0x7f4316=await withSpinner(_0x1bdc75(0x177),()=>_0x1f1fa2[_0x1bdc75(0x1cd)][_0x1bdc75(0x1e6)](_0x2360a2),{'verbose':_0x5c2b96[_0x1bdc75(0x178)]}),_0x4d78e5=_0x7f4316[_0x1bdc75(0x1cf)],_0x100db9={'name':_0x4d78e5['name'],'cron':_0x4d78e5[_0x1bdc75(0x160)],'database':_0x4d78e5[_0x1bdc75(0x188)],'type':_0x4d78e5[_0x1bdc75(0x1d2)],'timezone':_0x4d78e5[_0x1bdc75(0x18b)],'user_name':_0x4d78e5[_0x1bdc75(0x1bd)],'created_at':_0x4d78e5['created_at'],'engine_version':_0x4d78e5[_0x1bdc75(0x1c3)],'executing_user_id':_0x4d78e5[_0x1bdc75(0x186)],'query':_0x4d78e5[_0x1bdc75(0x166)],'delay':_0x4d78e5[_0x1bdc75(0x1c6)],'priority':_0x4d78e5[_0x1bdc75(0x17c)],'retry_limit':_0x4d78e5['retry_limit'],..._0x4d78e5[_0x1bdc75(0x1ae)]&&{'result':_0x4d78e5['result']}};return await handleSingleObjectOutput(_0x100db9,_0x5c2b96),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a37_0x1dba0e(0x1c5)]=a37_0x1dba0e(0x1dd);[a37_0x1dba0e(0x1e7)]=a37_0x1dba0e(0x162);[a37_0x1dba0e(0x1a2)](_0x2c0995){const _0x481bcf=a37_0x1dba0e,_0x4272f2=_0x2c0995[_0x481bcf(0x1e4)][0x0];if(!_0x4272f2)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';const _0x1ba61b=_0x2c0995[_0x481bcf(0x17b)];if(!_0x1ba61b[_0x481bcf(0x188)])return _0x481bcf(0x175);return undefined;}async['execute'](_0x3c5f6a){const _0x3505dd=a37_0x1dba0e,{options:_0x25dec1,args:_0x2c999d,tdx:_0x51caf2}=_0x3c5f6a,_0x3c786d=_0x2c999d[0x0],_0xe27114=_0x25dec1,_0x219913=_0xe27114[_0x3505dd(0x188)],_0x597844=_0xe27114[_0x3505dd(0x18d)],_0xe55e0a=_0xe27114['type']||_0x3505dd(0x1c7);let _0x49a19a;try{_0x49a19a=readFileSync(_0x597844,'utf-8')[_0x3505dd(0x1b7)]();}catch(_0x50b2b1){throw new SDKError(ErrorCode[_0x3505dd(0x1b2)],_0x3505dd(0x1c1)+_0x597844,_0x50b2b1 instanceof Error?_0x50b2b1:undefined);}if(!_0x49a19a)throw new SDKError(ErrorCode[_0x3505dd(0x1b2)],_0x3505dd(0x1e2));const _0xae3eaf={'database':_0x219913,'query':_0x49a19a,'type':_0xe55e0a};if(_0xe27114[_0x3505dd(0x160)])_0xae3eaf[_0x3505dd(0x160)]=_0xe27114[_0x3505dd(0x160)];if(_0xe27114[_0x3505dd(0x18b)])_0xae3eaf[_0x3505dd(0x18b)]=_0xe27114[_0x3505dd(0x18b)];if(_0xe27114[_0x3505dd(0x1c6)]!==undefined)_0xae3eaf[_0x3505dd(0x1c6)]=Number(_0xe27114[_0x3505dd(0x1c6)]);if(_0xe27114['priority']!==undefined)_0xae3eaf[_0x3505dd(0x17c)]=Number(_0xe27114['priority']);if(_0xe27114[_0x3505dd(0x187)]!==undefined)_0xae3eaf[_0x3505dd(0x1ed)]=Number(_0xe27114[_0x3505dd(0x187)]);if(_0xe27114[_0x3505dd(0x1ca)])_0xae3eaf[_0x3505dd(0x1c3)]=_0xe27114[_0x3505dd(0x1ca)];if(_0xe27114['result'])_0xae3eaf['result']=_0xe27114['result'];if(_0x25dec1[_0x3505dd(0x178)]){console[_0x3505dd(0x168)]('Creating\x20schedule:\x20'+_0x3c786d),console[_0x3505dd(0x168)](_0x3505dd(0x16d)+_0x219913),console[_0x3505dd(0x168)](_0x3505dd(0x167)+_0xe55e0a);if(_0xae3eaf[_0x3505dd(0x160)])console[_0x3505dd(0x168)]('\x20\x20Cron:\x20'+_0xae3eaf[_0x3505dd(0x160)]);if(_0xae3eaf[_0x3505dd(0x18b)])console[_0x3505dd(0x168)](_0x3505dd(0x1d5)+_0xae3eaf[_0x3505dd(0x18b)]);}const _0x4393e7=await withSpinner(_0x3505dd(0x19c),()=>_0x51caf2[_0x3505dd(0x1cd)][_0x3505dd(0x1d6)](_0x3c786d,_0xae3eaf),{'verbose':_0x25dec1[_0x3505dd(0x178)]});return console[_0x3505dd(0x168)](_0x3505dd(0x1a8)+_0x4393e7[_0x3505dd(0x1cf)][_0x3505dd(0x1c5)]),await handleSingleObjectOutput(_0x4393e7['data'],_0x25dec1),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a37_0x1dba0e(0x1c5)]=a37_0x1dba0e(0x1c8);[a37_0x1dba0e(0x1e7)]=a37_0x1dba0e(0x1b5);[a37_0x1dba0e(0x1a2)](_0x342de6){const _0x1fb859=_0x342de6['args'][0x0];if(!_0x1fb859)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]';return undefined;}async[a37_0x1dba0e(0x161)](_0x560c0c){const _0x51b233=a37_0x1dba0e,{options:_0x1a0313,args:_0x498f94,tdx:_0x8d4597}=_0x560c0c,_0x7de5ca=_0x498f94[0x0],_0xc84693=_0x1a0313,_0x68983={};if(_0xc84693[_0x51b233(0x188)])_0x68983[_0x51b233(0x188)]=_0xc84693['database'];if(_0xc84693[_0x51b233(0x1d2)])_0x68983[_0x51b233(0x1d2)]=_0xc84693['type'];if(_0xc84693['cron'])_0x68983[_0x51b233(0x160)]=_0xc84693[_0x51b233(0x160)];if(_0xc84693[_0x51b233(0x18b)])_0x68983[_0x51b233(0x18b)]=_0xc84693[_0x51b233(0x18b)];if(_0xc84693['delay']!==undefined)_0x68983[_0x51b233(0x1c6)]=Number(_0xc84693[_0x51b233(0x1c6)]);if(_0xc84693[_0x51b233(0x17c)]!==undefined)_0x68983[_0x51b233(0x17c)]=Number(_0xc84693[_0x51b233(0x17c)]);if(_0xc84693['retryLimit']!==undefined)_0x68983[_0x51b233(0x1ed)]=Number(_0xc84693[_0x51b233(0x187)]);if(_0xc84693[_0x51b233(0x1ca)])_0x68983[_0x51b233(0x1c3)]=_0xc84693['engineVersion'];if(_0xc84693[_0x51b233(0x1ae)])_0x68983[_0x51b233(0x1ae)]=_0xc84693['result'];if(_0xc84693[_0x51b233(0x18d)])try{_0x68983[_0x51b233(0x166)]=readFileSync(_0xc84693[_0x51b233(0x18d)],'utf-8')['trim']();}catch(_0x4ce4a5){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20read\x20file:\x20'+_0xc84693[_0x51b233(0x18d)],_0x4ce4a5 instanceof Error?_0x4ce4a5:undefined);}if(Object[_0x51b233(0x1bc)](_0x68983)[_0x51b233(0x1df)]===0x0)throw new SDKError(ErrorCode[_0x51b233(0x1b2)],_0x51b233(0x16f));if(_0x1a0313['verbose']){console[_0x51b233(0x168)](_0x51b233(0x194)+_0x7de5ca);for(const [_0x142703,_0x3a6c8d]of Object[_0x51b233(0x1c0)](_0x68983)){_0x142703===_0x51b233(0x166)?console[_0x51b233(0x168)]('\x20\x20'+_0x142703+':\x20'+_0x3a6c8d[_0x51b233(0x199)](0x0,0x32)+'...'):console[_0x51b233(0x168)]('\x20\x20'+_0x142703+':\x20'+_0x3a6c8d);}}const _0x350030=await withSpinner(_0x51b233(0x198),()=>_0x8d4597[_0x51b233(0x1cd)][_0x51b233(0x1bb)](_0x7de5ca,_0x68983),{'verbose':_0x1a0313[_0x51b233(0x178)]});return console['error'](_0x51b233(0x1e5)+_0x350030['data'][_0x51b233(0x1c5)]),await handleSingleObjectOutput(_0x350030[_0x51b233(0x1cf)],_0x1a0313),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a37_0x1dba0e(0x1c5)]=a37_0x1dba0e(0x18f);[a37_0x1dba0e(0x1e7)]=a37_0x1dba0e(0x193);[a37_0x1dba0e(0x1a2)](_0x3fce44){const _0x57e35e=a37_0x1dba0e,_0x2877b0=_0x3fce44[_0x57e35e(0x1e4)][0x0];if(!_0x2877b0)return _0x57e35e(0x1ad);return undefined;}async[a37_0x1dba0e(0x161)](_0x4e56ac){const _0x51a190=a37_0x1dba0e,{options:_0x565139,args:_0x3ee620,tdx:_0x56cc17}=_0x4e56ac,_0xc4fb6=_0x3ee620[0x0];if(!_0x565139[_0x51a190(0x17f)]){const _0x43b962=await confirm(_0x51a190(0x181)+_0xc4fb6+'\x22?');if(!_0x43b962)return console[_0x51a190(0x168)](_0x51a190(0x1cc)),0x0;}const _0x170d0a=await withSpinner(_0x51a190(0x1d0),()=>_0x56cc17['schedules']['delete'](_0xc4fb6),{'verbose':_0x565139[_0x51a190(0x178)]});return console['error']('Schedule\x20deleted:\x20'+_0x170d0a['data'][_0x51a190(0x1c5)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{['name']=a37_0x1dba0e(0x183);[a37_0x1dba0e(0x1e7)]='Run\x20a\x20scheduled\x20query\x20immediately';[a37_0x1dba0e(0x1a2)](_0x5caaed){const _0x4809ba=a37_0x1dba0e,_0x19329c=_0x5caaed[_0x4809ba(0x1e4)][0x0];if(!_0x19329c)return _0x4809ba(0x173);return undefined;}async[a37_0x1dba0e(0x161)](_0x6e3730){const _0xb65e95=a37_0x1dba0e,{options:_0x174673,args:_0x24d147,tdx:_0x1a910f}=_0x6e3730,_0x506307=_0x24d147[0x0],_0x1a26dd=_0x174673,_0x305f30=_0x1a26dd[_0xb65e95(0x1b9)],_0x5af0b5=_0x1a26dd[_0xb65e95(0x182)]!==undefined?Number(_0x1a26dd['num']):undefined;if(_0x174673[_0xb65e95(0x178)]){console[_0xb65e95(0x168)](_0xb65e95(0x196)+_0x506307);if(_0x305f30)console[_0xb65e95(0x168)]('\x20\x20Time:\x20'+_0x305f30);if(_0x5af0b5)console[_0xb65e95(0x168)](_0xb65e95(0x192)+_0x5af0b5);}const _0x3ff788=await withSpinner('Running\x20schedule...',()=>_0x1a910f[_0xb65e95(0x1cd)][_0xb65e95(0x191)](_0x506307,{'time':_0x305f30,'num':_0x5af0b5}),{'verbose':_0x174673[_0xb65e95(0x178)]}),_0x3ad477=_0x3ff788[_0xb65e95(0x1cf)][_0xb65e95(0x18a)];console[_0xb65e95(0x168)]('Schedule\x20run\x20submitted:\x20'+_0x3ad477[_0xb65e95(0x1df)]+'\x20job'+(_0x3ad477[_0xb65e95(0x1df)]!==0x1?'s':'')+'\x20created');for(const _0x438b43 of _0x3ad477){console[_0xb65e95(0x168)](_0xb65e95(0x1d7)+_0x438b43['job_id']);}return await handleSDKOutput(_0x3ad477,_0x174673),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a37_0x1dba0e(0x1c5)]=a37_0x1dba0e(0x1d9);['description']=a37_0x1dba0e(0x185);[a37_0x1dba0e(0x1a2)](_0xe26647){const _0x2d3a89=a37_0x1dba0e,_0x217462=_0xe26647[_0x2d3a89(0x1e4)][0x0];if(!_0x217462)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async[a37_0x1dba0e(0x161)](_0x37c363){const _0xd70a73=a37_0x1dba0e,{options:_0x40ded9,args:_0x53bcc0,tdx:_0x5c8245}=_0x37c363,_0x260737=_0x53bcc0[0x0],_0x26cc4d=_0x40ded9,_0x273b5a=_0x26cc4d[_0xd70a73(0x1c4)]!==undefined?Number(_0x26cc4d[_0xd70a73(0x1c4)]):undefined,_0x5ea657=_0x26cc4d['to']!==undefined?Number(_0x26cc4d['to']):undefined,_0x41c79c=await withSpinner(_0xd70a73(0x1af),()=>_0x5c8245[_0xd70a73(0x1cd)][_0xd70a73(0x171)](_0x260737,{'from':_0x273b5a,'to':_0x5ea657}),{'verbose':_0x40ded9['verbose']}),_0x5d10b0=_0x41c79c[_0xd70a73(0x1cf)];console[_0xd70a73(0x168)](_0xd70a73(0x16e)+_0x5d10b0[_0xd70a73(0x16a)]+_0xd70a73(0x1a9)+(_0x5d10b0[_0xd70a73(0x16a)]!==0x1?'s':'')+_0xd70a73(0x1a5)+_0x5d10b0[_0xd70a73(0x1c4)]+'-'+_0x5d10b0['to']+')');const _0x142a39=_0x5d10b0[_0xd70a73(0x171)][_0xd70a73(0x1e3)](_0x20de84=>({'job_id':_0x20de84[_0xd70a73(0x1b4)],'type':_0x20de84['type'],'status':_0x20de84[_0xd70a73(0x1da)],'scheduled_at':_0x20de84[_0xd70a73(0x16c)],'created_at':_0x20de84['created_at'],'start_at':_0x20de84[_0xd70a73(0x1b0)],'end_at':_0x20de84[_0xd70a73(0x1b3)]}));return await handleSDKOutput(_0x142a39,_0x40ded9),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_0x177130=a38_0x2f0f;function a38_0x1e04(){const _0x23a1c6=['SELECT\x20*\x20FROM\x20(\x0a','Error:\x20Path\x20or\x20name\x20is\x20required','error','Usage:\x20tdx\x20sg\x20show\x20<name>','Folder\x20name:\x20','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','(root)','410068EokNqw','Use:\x20tdx\x20ps\x20show','content','information_schema','✔\x20Found\x20','\x27\x20with\x20ID:\x20','Show\x20folder\x20or\x20child\x20segment\x20details','Show\x20child\x20segment\x20schema\x20(column\x20types)','url','Error:\x20','2509VGEjbp','getSegmentSQLFromYaml','Resolved\x20YAML\x20file:\x20','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','\x20\x20Cause:\x20','getSegment','segment:folder:show','INVALID_ARGUMENT','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','format','Parent\x20ID:\x20','createFolder','site','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','cause','Segment\x20ID:\x20','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Resolving\x20path\x20\x27','message','Resolved\x20relative\x20path\x20to:\x20','segmentId','7534555stPodV','Error:\x20Parent\x20segment\x20name\x20is\x20required','Fetching\x20SQL\x20for\x20segment...','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Target\x20path:\x20','/e/','stats','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','getParent','segmentPath','\x20\x20Full\x20path:\x20','Executing\x20segment\x20query...','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','parentId','segment:describe','\x20\x20Folder\x20path:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Create\x20segment\x20folder\x20for\x20organization','Fetching\x20folder\x20details...','SQL\x20query:\x0a','execute','limit','listFolders','resolvePathToResource','resolveParentId','Fetching\x20folder\x20\x27','Site:\x20','parentSegment','\x27...','9HoQIMM','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Fetching\x20segment\x20details...','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','toLocaleString','Folder\x20ID:\x20','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Resolved\x20type:\x20','elapsedTimeMillis','4qxfTln','11833723UAPJJf','data','Resolving\x20folder\x20\x27','Usage:\x20tdx\x20segment\x20describe\x20<path>','segment:folder:create','Resolved\x20parent\x20folder\x20ID:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','red','parent','Usage:','Options:','name','SEGMENT_FOLDER_NOT_FOUND','SEGMENT_NOT_FOUND','replace','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','6383875Kjuoxh','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','Fetching\x20SQL\x20from\x20rule...','fullPath','segment','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','web','verbose','Show\x20segment\x20folder\x20details','Parent\x20segment:\x20','✔\x20Created\x20folder\x20\x27','Show\x20segment\x20or\x20folder\x20details','Resolved:\x20','\x20folder','getSQLFromServerSegment','green','trim','segmentName','770898nsjekD','✔\x20Query\x20completed:\x20Processed\x20','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Use:\x20tdx\x20ps\x20view','query','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Resolved\x20parent\x20ID:\x20','description','Use:\x20tdx\x20ps\x20desc','\x20[Job\x20ID:\x20','segment:sql','Resolving\x20\x27','folderPath','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','folderId','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','length','getSQLFromYamlFile','cyan','getSegmentSQL','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Error:\x20Folder\x20reference\x20is\x20required','234084xbpzgh','json','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Segment\x20ID\x20missing\x20from\x20resolved\x20path','\x20rows\x20','jsonl','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','jobId','12499370FihehM','\x20\x20Parent\x20segment:\x20','getFolder','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','/app/ps/','segment:desc','Examples:','Parent\x20name:\x20','parentFolder','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','type','6guNibs','✖\x20Query\x20failed\x20[','includes','4aXqvvn','Resolving\x20parent\x20segment\x20\x27','folder','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','8jKKMvZ','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results'];a38_0x1e04=function(){return _0x23a1c6;};return a38_0x1e04();}(function(_0x49a41c,_0x28c378){const _0x19397b=a38_0x2f0f,_0x2580b1=_0x49a41c();while(!![]){try{const _0x2d4d3f=parseInt(_0x19397b(0x1ab))/0x1*(-parseInt(_0x19397b(0x19e))/0x2)+parseInt(_0x19397b(0x172))/0x3*(parseInt(_0x19397b(0x14f))/0x4)+-parseInt(_0x19397b(0x160))/0x5*(parseInt(_0x19397b(0x19b))/0x6)+parseInt(_0x19397b(0x126))/0x7*(parseInt(_0x19397b(0x1a2))/0x8)+-parseInt(_0x19397b(0x144))/0x9*(parseInt(_0x19397b(0x190))/0xa)+-parseInt(_0x19397b(0x150))/0xb+-parseInt(_0x19397b(0x188))/0xc*(-parseInt(_0x19397b(0x111))/0xd);if(_0x2d4d3f===_0x28c378)break;else _0x2580b1['push'](_0x2580b1['shift']());}catch(_0x3c8165){_0x2580b1['push'](_0x2580b1['shift']());}}}(a38_0x1e04,0xa4ed5));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a38_0x1ccef1 from'chalk';async function resolveSegmentTarget(_0x110688,_0x2f9088,_0x4dffab){const _0x23818a=a38_0x2f0f;if(isYamlFilePath(_0x110688))try{const _0x50d443=await resolveYamlFilePath(_0x110688);return _0x4dffab&&(console[_0x23818a(0x1a6)](_0x23818a(0x113)+_0x110688),console['error'](_0x23818a(0x191)+_0x50d443[_0x23818a(0x142)]),console[_0x23818a(0x1a6)]('\x20\x20Segment\x20name:\x20'+_0x50d443[_0x23818a(0x171)]),console[_0x23818a(0x1a6)](_0x23818a(0x135)+(_0x50d443[_0x23818a(0x17e)]||_0x23818a(0x1aa))),console[_0x23818a(0x1a6)](_0x23818a(0x130)+_0x50d443[_0x23818a(0x163)])),_0x50d443[_0x23818a(0x163)];}catch(_0x553e9c){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x23818a(0x17f)+_0x553e9c[_0x23818a(0x123)]);}if(!_0x2f9088)throw new SDKError(ErrorCode[_0x23818a(0x118)],_0x23818a(0x186));return _0x2f9088+'/'+_0x110688;}export class SegmentDescribeCommand extends BaseCommand{['name']=a38_0x177130(0x134);[a38_0x177130(0x179)]=a38_0x177130(0x16b);async[a38_0x177130(0x13b)](_0x487a77){const _0x1ee81c=a38_0x177130,{options:_0x3f1ec7,args:_0x5c9388,tdx:_0x47b651}=_0x487a77,_0x522340=_0x5c9388[0x0],_0x397943=!_0x522340&&!!_0x3f1ec7[_0x1ee81c(0x142)],_0x2a0623=_0x522340||_0x3f1ec7[_0x1ee81c(0x142)];if(!_0x2a0623)return console[_0x1ee81c(0x1a6)](_0x1ee81c(0x1a5)),console[_0x1ee81c(0x1a6)](_0x1ee81c(0x153)),console[_0x1ee81c(0x1a6)](_0x1ee81c(0x196)),console[_0x1ee81c(0x1a6)](_0x1ee81c(0x129)),console[_0x1ee81c(0x1a6)](_0x1ee81c(0x156)),console[_0x1ee81c(0x1a6)]('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console[_0x1ee81c(0x1a6)](_0x1ee81c(0x119)),0x1;try{const _0x335da5=_0x3f1ec7[_0x1ee81c(0x12f)];let _0x4e1d9e=_0x2a0623;!_0x397943&&_0x335da5&&!_0x2a0623[_0x1ee81c(0x19d)]('/')&&(_0x4e1d9e=_0x335da5+'/'+_0x2a0623,_0x3f1ec7[_0x1ee81c(0x167)]&&console[_0x1ee81c(0x1a6)](_0x1ee81c(0x124)+_0x4e1d9e));const _0x511a37=await withSpinner(_0x1ee81c(0x122)+_0x4e1d9e+_0x1ee81c(0x143),()=>_0x47b651['segment'][_0x1ee81c(0x13e)](_0x4e1d9e),{'verbose':_0x3f1ec7[_0x1ee81c(0x167)]}),_0x26400c=_0x511a37[_0x1ee81c(0x151)];_0x3f1ec7[_0x1ee81c(0x167)]&&(console[_0x1ee81c(0x1a6)](_0x1ee81c(0x14d)+_0x26400c[_0x1ee81c(0x19a)]),console[_0x1ee81c(0x1a6)](_0x1ee81c(0x11b)+_0x26400c['parentId']),_0x26400c[_0x1ee81c(0x180)]&&console['error'](_0x1ee81c(0x14b)+_0x26400c['folderId']),_0x26400c[_0x1ee81c(0x125)]&&console['error'](_0x1ee81c(0x120)+_0x26400c['segmentId']));if(_0x26400c[_0x1ee81c(0x19a)]==='parent'){const _0x23ff92=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x47b651[_0x1ee81c(0x164)][_0x1ee81c(0x12e)](_0x26400c[_0x1ee81c(0x133)]),{'verbose':_0x3f1ec7['verbose']});await handleSingleObjectOutput(_0x23ff92[_0x1ee81c(0x151)],_0x3f1ec7);}else{if(_0x26400c[_0x1ee81c(0x19a)]===_0x1ee81c(0x1a0)){if(!_0x26400c[_0x1ee81c(0x180)])throw new SDKError(ErrorCode[_0x1ee81c(0x15c)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x590ae7=await withSpinner(_0x1ee81c(0x139),()=>_0x47b651[_0x1ee81c(0x164)][_0x1ee81c(0x192)](_0x26400c[_0x1ee81c(0x180)]),{'verbose':_0x3f1ec7[_0x1ee81c(0x167)]});await handleSingleObjectOutput(_0x590ae7[_0x1ee81c(0x151)],_0x3f1ec7);}else{if(_0x26400c['type']===_0x1ee81c(0x164)){if(!_0x26400c['segmentId'])throw new SDKError(ErrorCode[_0x1ee81c(0x15d)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x46a9e4=await withSpinner(_0x1ee81c(0x146),()=>_0x47b651[_0x1ee81c(0x164)][_0x1ee81c(0x116)](_0x26400c['parentId'],_0x26400c[_0x1ee81c(0x125)]),{'verbose':_0x3f1ec7[_0x1ee81c(0x167)]});await handleSingleObjectOutput(_0x46a9e4[_0x1ee81c(0x151)],_0x3f1ec7);}}}return 0x0;}catch(_0x2f8859){if(_0x2f8859 instanceof SDKError)return console[_0x1ee81c(0x1a6)](_0x1ee81c(0x110)+_0x2f8859[_0x1ee81c(0x123)]),_0x2f8859['cause']&&console[_0x1ee81c(0x1a6)](_0x1ee81c(0x115)+_0x2f8859[_0x1ee81c(0x11f)]),0x1;throw _0x2f8859;}}}export class SegmentShowCommand extends BaseCommand{[a38_0x177130(0x15b)]='segment:show';[a38_0x177130(0x179)]=a38_0x177130(0x1a3);async[a38_0x177130(0x13b)](_0x1ba36e){const _0x1cedb7=a38_0x177130,{options:_0x5be990,args:_0x5263b9,tdx:_0x12c377}=_0x1ba36e,_0x43a798=_0x5263b9[0x0];if(!_0x43a798)return console[_0x1cedb7(0x1a6)](_0x1cedb7(0x11e)),console[_0x1cedb7(0x1a6)](_0x1cedb7(0x1a7)),console[_0x1cedb7(0x1a6)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x1cedb7(0x1a6)]('Examples:'),console['error'](_0x1cedb7(0x137)),console[_0x1cedb7(0x1a6)](_0x1cedb7(0x15f)),0x1;try{const _0x85c1e=_0x5be990[_0x1cedb7(0x142)],_0x4d60f8=await resolveSegmentTarget(_0x43a798,_0x85c1e,_0x5be990[_0x1cedb7(0x167)]);_0x5be990[_0x1cedb7(0x167)]&&console[_0x1cedb7(0x1a6)](_0x1cedb7(0x12a)+_0x4d60f8);const _0x15e8ea=await withSpinner(_0x1cedb7(0x17d)+_0x43a798+_0x1cedb7(0x143),()=>_0x12c377[_0x1cedb7(0x164)]['resolvePathToResource'](_0x4d60f8),{'verbose':_0x5be990['verbose']}),_0x5e43be=_0x15e8ea[_0x1cedb7(0x151)];_0x5be990[_0x1cedb7(0x167)]&&(console['error']('Resolved\x20type:\x20'+_0x5e43be[_0x1cedb7(0x19a)]),console[_0x1cedb7(0x1a6)](_0x1cedb7(0x11b)+_0x5e43be[_0x1cedb7(0x133)]));if(_0x5e43be['type']===_0x1cedb7(0x1a0))return console[_0x1cedb7(0x1a6)](_0x1cedb7(0x147)),console['error'](_0x1cedb7(0x181)),0x1;if(_0x5e43be[_0x1cedb7(0x19a)]===_0x1cedb7(0x158))return console[_0x1cedb7(0x1a6)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x1cedb7(0x1a6)](_0x1cedb7(0x108)),0x1;if(!_0x5e43be[_0x1cedb7(0x125)])throw new SDKError(ErrorCode[_0x1cedb7(0x15d)],_0x1cedb7(0x18b));const _0x498c3d=await withSpinner(_0x1cedb7(0x128),()=>_0x12c377[_0x1cedb7(0x164)][_0x1cedb7(0x185)](_0x5e43be[_0x1cedb7(0x133)],_0x5e43be[_0x1cedb7(0x125)]),{'verbose':_0x5be990['verbose']});let _0x510132=_0x498c3d[_0x1cedb7(0x151)];const _0x4b2027=resolveLimit(_0x5be990[_0x1cedb7(0x13c)],DEFAULT_DISPLAY_LIMIT),_0x33c2dc=/\bLIMIT\s+\d+/i['test'](_0x510132);!_0x33c2dc&&(_0x510132=_0x510132[_0x1cedb7(0x170)]()[_0x1cedb7(0x15e)](/;+$/,''),_0x510132=_0x1cedb7(0x1a4)+_0x510132+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x4b2027);_0x5be990[_0x1cedb7(0x167)]&&console[_0x1cedb7(0x1a6)](_0x1cedb7(0x13a)+_0x510132);const _0x8e7753=await withProgressSpinner(_0x1cedb7(0x131),async _0xca711c=>{const _0x150c9b=_0x1cedb7,_0x280b14=await _0x12c377[_0x150c9b(0x176)][_0x150c9b(0x13b)](_0x510132,{'catalog':'td','schema':_0x150c9b(0x10a),'onJobId':_0x17c935=>{_0xca711c['setJobId'](_0x17c935);}});return _0x280b14;},{'verbose':_0x5be990['verbose']}),_0x2d4086=_0x8e7753[_0x1cedb7(0x151)],_0x36a4f2=_0x2d4086[_0x1cedb7(0x18f)]?_0x1cedb7(0x17b)+_0x2d4086[_0x1cedb7(0x18f)]+']':'';return console['error'](_0x1cedb7(0x173)+_0x2d4086[_0x1cedb7(0x12c)]['processedRows'][_0x1cedb7(0x14a)]()+_0x1cedb7(0x18c)+('in\x20'+formatElapsed(_0x2d4086[_0x1cedb7(0x12c)][_0x1cedb7(0x14e)])+_0x36a4f2)),await handleQueryOutput(_0x2d4086,_0x5be990),0x0;}catch(_0x257300){if(_0x257300 instanceof SDKError)return console[_0x1cedb7(0x1a6)](_0x1cedb7(0x19c)+_0x257300['code']+']'),console[_0x1cedb7(0x1a6)]('\x0a'+_0x257300[_0x1cedb7(0x123)]),0x1;throw _0x257300;}}}export class SegmentFolderListCommand extends BaseCommand{[a38_0x177130(0x15b)]='segment:folder:list';[a38_0x177130(0x179)]=a38_0x177130(0x114);async['execute'](_0x39ff3d){const _0x3422b0=a38_0x177130,{options:_0x20fd2a,args:_0x252df9,tdx:_0x454c54}=_0x39ff3d;if(_0x252df9[_0x3422b0(0x182)]===0x0)return console[_0x3422b0(0x1a6)](_0x3422b0(0x127)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x33a1a7=_0x252df9[0x0];try{_0x20fd2a[_0x3422b0(0x167)]&&(console['error'](_0x3422b0(0x141)+_0x20fd2a[_0x3422b0(0x11d)]),console[_0x3422b0(0x1a6)]('Parent\x20name:\x20'+_0x33a1a7));const _0x285dd4=await withSpinner(_0x3422b0(0x19f)+_0x33a1a7+'\x27...',()=>_0x454c54[_0x3422b0(0x164)]['resolveParentId'](_0x33a1a7),{'verbose':_0x20fd2a[_0x3422b0(0x167)]}),_0xb84bea=_0x285dd4[_0x3422b0(0x151)];_0x20fd2a['verbose']&&console[_0x3422b0(0x1a6)](_0x3422b0(0x178)+_0xb84bea);const _0xdb7419=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x33a1a7+'\x27...',()=>_0x454c54[_0x3422b0(0x164)][_0x3422b0(0x13d)](_0xb84bea),{'verbose':_0x20fd2a['verbose']}),_0x1135c9=_0xdb7419[_0x3422b0(0x151)];return console['error'](_0x3422b0(0x10b)+_0x1135c9[_0x3422b0(0x182)]+_0x3422b0(0x16d)+(_0x1135c9[_0x3422b0(0x182)]!==0x1?'s':'')),await handleSDKOutput(_0x1135c9,_0x20fd2a),0x0;}catch(_0x25a49e){if(_0x25a49e instanceof SDKError)return console['error'](_0x3422b0(0x110)+_0x25a49e['message']),_0x25a49e['cause']&&console[_0x3422b0(0x1a6)]('\x20\x20Cause:\x20'+_0x25a49e[_0x3422b0(0x11f)]),0x1;throw _0x25a49e;}}}export class SegmentFolderShowCommand extends BaseCommand{[a38_0x177130(0x15b)]=a38_0x177130(0x117);[a38_0x177130(0x179)]=a38_0x177130(0x168);async['execute'](_0x15d688){const _0x21e406=a38_0x177130,{options:_0x407aa3,args:_0x453185,tdx:_0x482500}=_0x15d688;if(_0x453185[_0x21e406(0x182)]===0x0)return console[_0x21e406(0x1a6)](_0x21e406(0x187)),console[_0x21e406(0x1a6)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x2394e6,childId:_0x3e296}=parseSegmentRef(_0x453185[0x0]);_0x407aa3[_0x21e406(0x167)]&&(console[_0x21e406(0x1a6)](_0x21e406(0x141)+_0x407aa3[_0x21e406(0x11d)]),console[_0x21e406(0x1a6)](_0x21e406(0x197)+_0x2394e6),_0x3e296&&console[_0x21e406(0x1a6)](_0x21e406(0x1a8)+_0x3e296));if(!_0x3e296)return console[_0x21e406(0x1a6)](_0x21e406(0x145)),0x1;const _0x4b2346=await withSpinner(_0x21e406(0x19f)+_0x2394e6+_0x21e406(0x143),()=>_0x482500[_0x21e406(0x164)][_0x21e406(0x13f)](_0x2394e6),{'verbose':_0x407aa3[_0x21e406(0x167)]}),_0x38b4ad=_0x4b2346[_0x21e406(0x151)];_0x407aa3[_0x21e406(0x167)]&&console['error'](_0x21e406(0x178)+_0x38b4ad);const _0x4b690b=await withSpinner(_0x21e406(0x152)+_0x3e296+_0x21e406(0x143),()=>_0x482500[_0x21e406(0x164)]['resolveFolderId'](_0x38b4ad,_0x3e296),{'verbose':_0x407aa3['verbose']}),_0x51e808=_0x4b690b[_0x21e406(0x151)];_0x407aa3['verbose']&&console[_0x21e406(0x1a6)]('Resolved\x20folder\x20ID:\x20'+_0x51e808);const _0x22f7e1=await withSpinner(_0x21e406(0x140)+_0x3e296+_0x21e406(0x143),()=>_0x482500['segment'][_0x21e406(0x192)](_0x51e808),{'verbose':_0x407aa3[_0x21e406(0x167)]});return await handleSDKOutput([_0x22f7e1[_0x21e406(0x151)]],_0x407aa3),0x0;}catch(_0x2f749a){if(_0x2f749a instanceof SDKError)return console[_0x21e406(0x1a6)](_0x21e406(0x110)+_0x2f749a[_0x21e406(0x123)]),_0x2f749a['cause']&&console['error'](_0x21e406(0x115)+_0x2f749a[_0x21e406(0x11f)]),0x1;throw _0x2f749a;}}}export class SegmentSQLCommand extends BaseCommand{[a38_0x177130(0x15b)]=a38_0x177130(0x17c);[a38_0x177130(0x179)]='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a38_0x177130(0x13b)](_0xf515eb){const _0x32f49a=a38_0x177130,{options:_0x3bd515,args:_0x903fc2}=_0xf515eb,_0x2640d7=_0x3bd515,_0x2cdeb5=_0x2640d7['path'],_0x59fe72=_0x903fc2[0x0];if(!_0x59fe72&&!_0x2cdeb5)return console[_0x32f49a(0x1a6)](a38_0x1ccef1[_0x32f49a(0x157)](_0x32f49a(0x199))),console[_0x32f49a(0x1a6)](_0x32f49a(0x159)),console[_0x32f49a(0x1a6)](_0x32f49a(0x148)),console[_0x32f49a(0x1a6)](_0x32f49a(0x1a9)),console['error']('Examples:'),console[_0x32f49a(0x1a6)](_0x32f49a(0x12d)),console[_0x32f49a(0x1a6)](_0x32f49a(0x14c)),0x1;if(_0x59fe72&&_0x2cdeb5)return console[_0x32f49a(0x1a6)](a38_0x1ccef1['red'](_0x32f49a(0x193))),0x1;try{let _0x315114;if(_0x2cdeb5)_0x315114=await this[_0x32f49a(0x183)](_0x2cdeb5,_0xf515eb);else{if(isYamlFilePath(_0x59fe72))return console['error'](a38_0x1ccef1['red']('Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option')),console[_0x32f49a(0x1a6)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20'+_0x59fe72),0x1;else _0x315114=await this['getSQLFromServerSegment'](_0x59fe72,_0xf515eb);}return _0x3bd515[_0x32f49a(0x11a)]===_0x32f49a(0x189)||_0x3bd515[_0x32f49a(0x11a)]===_0x32f49a(0x18d)?await handleSDKOutput([{'sql':_0x315114}],_0x3bd515):console['log'](_0x315114),0x0;}catch(_0x351b5c){if(_0x351b5c instanceof SDKError)return console[_0x32f49a(0x1a6)](_0x32f49a(0x110)+_0x351b5c['message']),_0x351b5c[_0x32f49a(0x11f)]&&console[_0x32f49a(0x1a6)]('\x20\x20Cause:\x20'+_0x351b5c[_0x32f49a(0x11f)]),0x1;throw _0x351b5c;}}async[a38_0x177130(0x183)](_0x5d86ea,_0x91bd2a){const _0x1454ef=a38_0x177130,{options:_0x2bc9c2,tdx:_0x209d0b}=_0x91bd2a;let _0x271563;try{_0x271563=await resolveYamlFilePath(_0x5d86ea);}catch(_0x92efd7){throw new SDKError(ErrorCode[_0x1454ef(0x118)],_0x1454ef(0x17f)+_0x92efd7['message']);}_0x2bc9c2[_0x1454ef(0x167)]&&console['error'](_0x1454ef(0x16c)+_0x271563[_0x1454ef(0x142)]+'/'+_0x271563[_0x1454ef(0x171)]);const _0x2da7ea=await withSpinner(_0x1454ef(0x162),()=>_0x209d0b[_0x1454ef(0x164)][_0x1454ef(0x112)](_0x271563[_0x1454ef(0x109)],_0x271563['parentSegment'],_0x271563[_0x1454ef(0x171)]),{'verbose':_0x2bc9c2[_0x1454ef(0x167)]});return _0x2da7ea['data'];}async[a38_0x177130(0x16e)](_0x3b93bc,_0x384d75){const _0x3ccefa=a38_0x177130,{options:_0x3e4831,tdx:_0x200a1a}=_0x384d75,_0x260e58=_0x3e4831[_0x3ccefa(0x142)],_0x13ecbd=await resolveSegmentTarget(_0x3b93bc,_0x260e58,_0x3e4831['verbose']);_0x3e4831[_0x3ccefa(0x167)]&&console[_0x3ccefa(0x1a6)]('Target\x20path:\x20'+_0x13ecbd);const _0x3e65ff=await withSpinner(_0x3ccefa(0x17d)+_0x3b93bc+'\x27...',()=>_0x200a1a[_0x3ccefa(0x164)][_0x3ccefa(0x13e)](_0x13ecbd),{'verbose':_0x3e4831[_0x3ccefa(0x167)]}),_0x4c6123=_0x3e65ff[_0x3ccefa(0x151)];_0x3e4831['verbose']&&(console[_0x3ccefa(0x1a6)](_0x3ccefa(0x14d)+_0x4c6123[_0x3ccefa(0x19a)]),console[_0x3ccefa(0x1a6)](_0x3ccefa(0x11b)+_0x4c6123[_0x3ccefa(0x133)]));if(_0x4c6123['type']===_0x3ccefa(0x1a0))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x3ccefa(0x174));if(_0x4c6123[_0x3ccefa(0x19a)]===_0x3ccefa(0x158))throw new SDKError(ErrorCode[_0x3ccefa(0x118)],_0x3ccefa(0x161));if(!_0x4c6123[_0x3ccefa(0x125)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x3ccefa(0x18b));const _0x94be49=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x200a1a['segment'][_0x3ccefa(0x185)](_0x4c6123[_0x3ccefa(0x133)],_0x4c6123[_0x3ccefa(0x125)]),{'verbose':_0x3e4831[_0x3ccefa(0x167)]});return _0x94be49[_0x3ccefa(0x151)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a38_0x177130(0x15b)]=a38_0x177130(0x154);[a38_0x177130(0x179)]=a38_0x177130(0x138);async['execute'](_0x2a078e){const _0x5ae9f0=a38_0x177130,{options:_0x2fe54f,args:_0xa89815,tdx:_0x10b240}=_0x2a078e,_0x2e9b6d=_0x2fe54f;if(_0xa89815[_0x5ae9f0(0x182)]<0x2)return console[_0x5ae9f0(0x1a6)](_0x5ae9f0(0x121)),console[_0x5ae9f0(0x1a6)]('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x423426=_0xa89815[0x0],_0x5630c9=_0xa89815[0x1];_0x2e9b6d['verbose']&&(console[_0x5ae9f0(0x1a6)](_0x5ae9f0(0x141)+_0x2e9b6d[_0x5ae9f0(0x11d)]),console[_0x5ae9f0(0x1a6)](_0x5ae9f0(0x169)+_0x423426),console['error'](_0x5ae9f0(0x1a8)+_0x5630c9));let _0x2aa646;if(_0x2e9b6d[_0x5ae9f0(0x198)]){const _0x51f808=_0x2e9b6d[_0x5ae9f0(0x198)],_0x11fc19=await withSpinner(_0x5ae9f0(0x19f)+_0x423426+_0x5ae9f0(0x143),()=>_0x10b240[_0x5ae9f0(0x164)][_0x5ae9f0(0x13f)](_0x423426),{'verbose':_0x2e9b6d['verbose']}),_0x44efd9=_0x11fc19['data'],_0x58bf45=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x51f808+_0x5ae9f0(0x143),()=>_0x10b240[_0x5ae9f0(0x164)]['resolveFolderId'](_0x44efd9,_0x51f808),{'verbose':_0x2e9b6d[_0x5ae9f0(0x167)]});_0x2aa646=_0x58bf45['data'],_0x2e9b6d[_0x5ae9f0(0x167)]&&console[_0x5ae9f0(0x1a6)](_0x5ae9f0(0x155)+_0x2aa646);}const _0x1f40b2={'name':_0x5630c9,'description':_0x2e9b6d[_0x5ae9f0(0x179)],'parentFolderId':_0x2aa646},_0x4f423a=await withSpinner('Creating\x20folder\x20\x27'+_0x5630c9+_0x5ae9f0(0x143),()=>_0x10b240[_0x5ae9f0(0x164)][_0x5ae9f0(0x11c)](_0x423426,_0x1f40b2),{'verbose':_0x2e9b6d[_0x5ae9f0(0x167)]}),_0x41e44b=_0x4f423a['data'];return console[_0x5ae9f0(0x1a6)](_0x5ae9f0(0x16a)+_0x41e44b[_0x5ae9f0(0x15b)]+_0x5ae9f0(0x10c)+_0x41e44b['id']),await handleSDKOutput([_0x41e44b],_0x2e9b6d),0x0;}}function a38_0x2f0f(_0xb21746,_0x212625){_0xb21746=_0xb21746-0x108;const _0x1e046b=a38_0x1e04();let _0x2f0f28=_0x1e046b[_0xb21746];return _0x2f0f28;}export class SegmentViewCommand extends BaseCommand{['name']='segment:view';[a38_0x177130(0x179)]=a38_0x177130(0x10d);async[a38_0x177130(0x13b)](_0xada8e8){const _0x20ed97=a38_0x177130,{options:_0x415a14,args:_0x36ac94,tdx:_0x923dd4}=_0xada8e8,_0x44db29=_0x36ac94[0x0];if(!_0x44db29)return console[_0x20ed97(0x1a6)](_0x20ed97(0x177)),console[_0x20ed97(0x1a6)]('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console[_0x20ed97(0x1a6)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console[_0x20ed97(0x1a6)](_0x20ed97(0x15a)),console['error']('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x20ed97(0x1a6)]('Examples:'),console[_0x20ed97(0x1a6)](_0x20ed97(0x149)),console[_0x20ed97(0x1a6)](_0x20ed97(0x18e)),console[_0x20ed97(0x1a6)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x20ed97(0x1a6)]('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x2bd52a=_0x415a14[_0x20ed97(0x142)],_0x5a2ca2=await resolveSegmentTarget(_0x44db29,_0x2bd52a,_0x415a14['verbose']);_0x415a14[_0x20ed97(0x167)]&&console[_0x20ed97(0x1a6)](_0x20ed97(0x12a)+_0x5a2ca2);const _0x569883=await withSpinner('Resolving\x20\x27'+_0x44db29+'\x27...',()=>_0x923dd4[_0x20ed97(0x164)][_0x20ed97(0x13e)](_0x5a2ca2),{'verbose':_0x415a14[_0x20ed97(0x167)]}),_0x5571a7=_0x569883[_0x20ed97(0x151)];_0x415a14[_0x20ed97(0x167)]&&(console[_0x20ed97(0x1a6)](_0x20ed97(0x14d)+_0x5571a7[_0x20ed97(0x19a)]),console[_0x20ed97(0x1a6)](_0x20ed97(0x11b)+_0x5571a7['parentId']),_0x5571a7[_0x20ed97(0x180)]&&console[_0x20ed97(0x1a6)](_0x20ed97(0x14b)+_0x5571a7[_0x20ed97(0x180)]),_0x5571a7[_0x20ed97(0x125)]&&console[_0x20ed97(0x1a6)](_0x20ed97(0x120)+_0x5571a7[_0x20ed97(0x125)]));if(_0x415a14[_0x20ed97(0x166)]){if(_0x5571a7[_0x20ed97(0x19a)]===_0x20ed97(0x1a0))return console['error'](_0x20ed97(0x165)),0x1;if(_0x5571a7[_0x20ed97(0x19a)]===_0x20ed97(0x158))return console[_0x20ed97(0x1a6)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x20ed97(0x1a6)]('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x5571a7[_0x20ed97(0x125)])throw new SDKError(ErrorCode[_0x20ed97(0x15d)],_0x20ed97(0x18b));const _0x460217=getConsoleNextUrl(_0x415a14[_0x20ed97(0x11d)],_0x20ed97(0x194)+_0x5571a7[_0x20ed97(0x133)]+_0x20ed97(0x12b)+_0x5571a7[_0x20ed97(0x125)]);return console[_0x20ed97(0x1a6)](a38_0x1ccef1[_0x20ed97(0x16f)]('✔')+'\x20Opening\x20'+a38_0x1ccef1[_0x20ed97(0x184)](_0x460217)),openBrowser(_0x460217),0x0;}if(_0x5571a7['type']==='folder'){if(!_0x5571a7[_0x20ed97(0x180)])throw new SDKError(ErrorCode[_0x20ed97(0x15c)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x4646f5=await withSpinner(_0x20ed97(0x139),()=>_0x923dd4['segment'][_0x20ed97(0x192)](_0x5571a7[_0x20ed97(0x180)]),{'verbose':_0x415a14[_0x20ed97(0x167)]});await handleSingleObjectOutput(_0x4646f5['data'],_0x415a14);}else{if(_0x5571a7['type']==='segment'){if(!_0x5571a7['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x20ed97(0x18b));const _0x52cfb8=await withSpinner('Fetching\x20segment\x20details...',()=>_0x923dd4[_0x20ed97(0x164)][_0x20ed97(0x116)](_0x5571a7['parentId'],_0x5571a7[_0x20ed97(0x125)]),{'verbose':_0x415a14[_0x20ed97(0x167)]}),_0x49f332=getConsoleNextUrl(_0x415a14[_0x20ed97(0x11d)],_0x20ed97(0x194)+_0x5571a7[_0x20ed97(0x133)]+_0x20ed97(0x12b)+_0x5571a7[_0x20ed97(0x125)]),_0x5c07f7=_0x52cfb8['data'];_0x5c07f7[_0x20ed97(0x10f)]=_0x49f332,await handleSingleObjectOutput(_0x5c07f7,_0x415a14);}else return console[_0x20ed97(0x1a6)](_0x20ed97(0x1a1)),console[_0x20ed97(0x1a6)](_0x20ed97(0x175)),0x1;}return 0x0;}catch(_0x3a66d8){if(_0x3a66d8 instanceof SDKError)return console[_0x20ed97(0x1a6)]('Error:\x20'+_0x3a66d8[_0x20ed97(0x123)]),_0x3a66d8[_0x20ed97(0x11f)]&&console['error']('\x20\x20Cause:\x20'+_0x3a66d8[_0x20ed97(0x11f)]),0x1;throw _0x3a66d8;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a38_0x177130(0x15b)]=a38_0x177130(0x195);[a38_0x177130(0x179)]=a38_0x177130(0x10e);async[a38_0x177130(0x13b)](_0x1c8158){const _0xcb9f54=a38_0x177130,{options:_0x3f855f,args:_0x26114e,tdx:_0x64de77}=_0x1c8158,_0x1a2e1c=_0x26114e[0x0];if(!_0x1a2e1c)return console[_0xcb9f54(0x1a6)](_0xcb9f54(0x11e)),console[_0xcb9f54(0x1a6)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0xcb9f54(0x1a6)](_0xcb9f54(0x18a)),console['error'](_0xcb9f54(0x196)),console[_0xcb9f54(0x1a6)](_0xcb9f54(0x132)),console[_0xcb9f54(0x1a6)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x4230c2=_0x3f855f[_0xcb9f54(0x142)],_0x469491=await resolveSegmentTarget(_0x1a2e1c,_0x4230c2,_0x3f855f['verbose']);_0x3f855f[_0xcb9f54(0x167)]&&console['error'](_0xcb9f54(0x12a)+_0x469491);const _0x2df0da=await withSpinner('Resolving\x20\x27'+_0x1a2e1c+'\x27...',()=>_0x64de77[_0xcb9f54(0x164)][_0xcb9f54(0x13e)](_0x469491),{'verbose':_0x3f855f[_0xcb9f54(0x167)]}),_0x2f048c=_0x2df0da[_0xcb9f54(0x151)];_0x3f855f[_0xcb9f54(0x167)]&&(console[_0xcb9f54(0x1a6)](_0xcb9f54(0x14d)+_0x2f048c[_0xcb9f54(0x19a)]),console[_0xcb9f54(0x1a6)](_0xcb9f54(0x11b)+_0x2f048c[_0xcb9f54(0x133)]));if(_0x2f048c[_0xcb9f54(0x19a)]===_0xcb9f54(0x1a0))return console[_0xcb9f54(0x1a6)]('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console[_0xcb9f54(0x1a6)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x2f048c[_0xcb9f54(0x19a)]===_0xcb9f54(0x158))return console[_0xcb9f54(0x1a6)](_0xcb9f54(0x136)),console['error'](_0xcb9f54(0x17a)),0x1;if(!_0x2f048c[_0xcb9f54(0x125)])throw new SDKError(ErrorCode[_0xcb9f54(0x15d)],_0xcb9f54(0x18b));const _0xa2950a=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x64de77[_0xcb9f54(0x164)]['getSegmentSQL'](_0x2f048c[_0xcb9f54(0x133)],_0x2f048c[_0xcb9f54(0x125)]),{'verbose':_0x3f855f[_0xcb9f54(0x167)]}),_0x19be69=_0xa2950a[_0xcb9f54(0x151)],_0x5fdd38=await executeSchemaQuery(_0x19be69,_0x64de77,_0x3f855f);return await handleQueryOutput(_0x5fdd38,_0x3f855f),0x0;}catch(_0x39aabc){if(_0x39aabc instanceof SDKError)return console[_0xcb9f54(0x1a6)](_0xcb9f54(0x110)+_0x39aabc['message']),_0x39aabc[_0xcb9f54(0x11f)]&&console[_0xcb9f54(0x1a6)](_0xcb9f54(0x115)+_0x39aabc[_0xcb9f54(0x11f)]),0x1;throw _0x39aabc;}}}
@@ -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_0x536b9b=a39_0x3778;(function(_0x577d2f,_0x147b65){const _0x4d0334=a39_0x3778,_0x592843=_0x577d2f();while(!![]){try{const _0x265d6d=-parseInt(_0x4d0334(0x13a))/0x1*(parseInt(_0x4d0334(0x116))/0x2)+-parseInt(_0x4d0334(0x11b))/0x3*(-parseInt(_0x4d0334(0x11d))/0x4)+parseInt(_0x4d0334(0x124))/0x5+parseInt(_0x4d0334(0x139))/0x6+parseInt(_0x4d0334(0x12d))/0x7+-parseInt(_0x4d0334(0x136))/0x8+parseInt(_0x4d0334(0x10d))/0x9*(-parseInt(_0x4d0334(0x133))/0xa);if(_0x265d6d===_0x147b65)break;else _0x592843['push'](_0x592843['shift']());}catch(_0x218ed2){_0x592843['push'](_0x592843['shift']());}}}(a39_0x4acf,0xbb69a));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';function a39_0x4acf(){const _0x4a6a5f=['Site:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','154206kFbwlU','yellow','Segment\x20name:\x20','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','length','invisible','Parent\x20path:\x20','includes','4238RkKMcu','Resolving\x20folder\x20path\x20\x27','execute','noCountPopulation','segments','3qTBdUS','\x27\x20with\x20ID:\x20','3552756cEOFoz','type','segment:create','segment','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','kind','Resolving\x20folder\x20\x27','1440285AbYvwR','Target\x20path:\x20','resolvePathToResource','resolveParentId','verbose','folder','name','Resolved\x20folder\x20ID:\x20','data','3492986RNqDMK','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','description','segmentPath','rule','Parent:\x20','250ORdWhW','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','6707536lRQnAB','error','Resolved\x20relative\x20path\x20to:\x20','4011384RiHCvJ','146tQgSUF','\x27...','parent'];a39_0x4acf=function(){return _0x4a6a5f;};return a39_0x4acf();}function a39_0x3778(_0x5c392d,_0x3ad8f9){_0x5c392d=_0x5c392d-0x10a;const _0x4acfa8=a39_0x4acf();let _0x37780d=_0x4acfa8[_0x5c392d];return _0x37780d;}import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a39_0x5b15eb from'chalk';export class SegmentCreateCommand extends BaseCommand{[a39_0x536b9b(0x12a)]=a39_0x536b9b(0x11f);[a39_0x536b9b(0x12f)]='Create\x20child\x20segment\x20with\x20filtering\x20rules';async[a39_0x536b9b(0x118)](_0x4d2a1c){const _0x3a0d8c=a39_0x536b9b;console['error'](a39_0x5b15eb[_0x3a0d8c(0x10e)](_0x3a0d8c(0x111))),console[_0x3a0d8c(0x137)](a39_0x5b15eb[_0x3a0d8c(0x10e)](_0x3a0d8c(0x135)));const {options:_0xb9e046,args:_0x4ab29a,tdx:_0x1e89c4}=_0x4d2a1c,_0x4ff3d6=_0xb9e046;if(_0x4ab29a[_0x3a0d8c(0x112)]===0x0)return console['error'](_0x3a0d8c(0x12e)),console['error']('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console[_0x3a0d8c(0x137)]('Examples:'),console[_0x3a0d8c(0x137)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console['error'](_0x3a0d8c(0x10c)),console[_0x3a0d8c(0x137)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x389999=_0x4ab29a[0x0],_0xae808d=_0xb9e046[_0x3a0d8c(0x130)];let _0x4a043a=_0x389999;_0xae808d&&!_0x389999[_0x3a0d8c(0x115)]('/')&&(_0x4a043a=_0xae808d+'/'+_0x389999,_0x4ff3d6[_0x3a0d8c(0x128)]&&console[_0x3a0d8c(0x137)](_0x3a0d8c(0x138)+_0x4a043a));const _0x39a7e1=parsePath(_0x4a043a);if(_0x39a7e1[_0x3a0d8c(0x11a)]['length']<0x2)return console[_0x3a0d8c(0x137)](_0x3a0d8c(0x121)),console[_0x3a0d8c(0x137)](_0x3a0d8c(0x134)),0x1;const _0x297efc=_0x39a7e1[_0x3a0d8c(0x11a)][0x0],_0x228573=getBaseName(_0x4a043a),_0x910807=getParentPath(_0x4a043a);_0x4ff3d6[_0x3a0d8c(0x128)]&&(console[_0x3a0d8c(0x137)](_0x3a0d8c(0x10b)+_0x4ff3d6['site']),console[_0x3a0d8c(0x137)](_0x3a0d8c(0x125)+_0x4a043a),console['error'](_0x3a0d8c(0x132)+_0x297efc),console[_0x3a0d8c(0x137)](_0x3a0d8c(0x10f)+_0x228573),console['error'](_0x3a0d8c(0x114)+_0x910807));const _0x2fcefb=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x297efc+_0x3a0d8c(0x13b),()=>_0x1e89c4[_0x3a0d8c(0x120)][_0x3a0d8c(0x127)](_0x297efc),{'verbose':_0x4ff3d6[_0x3a0d8c(0x128)]}),_0x25f841=_0x2fcefb[_0x3a0d8c(0x12c)];let _0x54065e;if(_0x39a7e1[_0x3a0d8c(0x11a)][_0x3a0d8c(0x112)]>0x2){const _0xeeb807=await withSpinner(_0x3a0d8c(0x117)+_0x910807+_0x3a0d8c(0x13b),()=>_0x1e89c4[_0x3a0d8c(0x120)][_0x3a0d8c(0x126)](_0x910807),{'verbose':_0x4ff3d6[_0x3a0d8c(0x128)]}),_0x1a4155=_0xeeb807[_0x3a0d8c(0x12c)];if(_0x1a4155[_0x3a0d8c(0x11e)]!==_0x3a0d8c(0x129)&&_0x1a4155[_0x3a0d8c(0x11e)]!==_0x3a0d8c(0x10a))return console[_0x3a0d8c(0x137)](_0x3a0d8c(0x110)),0x1;_0x54065e=_0x1a4155['folderId'];}else{if(_0x4ff3d6[_0x3a0d8c(0x129)]){const _0x551084=await withSpinner(_0x3a0d8c(0x123)+_0x4ff3d6[_0x3a0d8c(0x129)]+_0x3a0d8c(0x13b),()=>_0x1e89c4[_0x3a0d8c(0x120)]['resolveFolderId'](_0x25f841,_0x4ff3d6[_0x3a0d8c(0x129)]),{'verbose':_0x4ff3d6[_0x3a0d8c(0x128)]});_0x54065e=_0x551084['data'];}}_0x4ff3d6[_0x3a0d8c(0x128)]&&_0x54065e&&console['error'](_0x3a0d8c(0x12b)+_0x54065e);const _0x40c54e=await loadJSONFromOptions(_0x4ff3d6[_0x3a0d8c(0x131)],_0x4ff3d6['ruleFile']),_0x7d4bda={'name':_0x228573,'description':_0x4ff3d6[_0x3a0d8c(0x12f)],'rule':_0x40c54e,'kind':_0x4ff3d6[_0x3a0d8c(0x122)]!==undefined?parseInt(_0x4ff3d6[_0x3a0d8c(0x122)],0xa):undefined,'isVisible':_0x4ff3d6[_0x3a0d8c(0x113)]?![]:undefined,'segmentFolderId':_0x54065e,'countPopulation':_0x4ff3d6[_0x3a0d8c(0x119)]?![]:undefined},_0x19100b=await withSpinner('Creating\x20segment\x20\x27'+_0x228573+_0x3a0d8c(0x13b),()=>_0x1e89c4[_0x3a0d8c(0x120)]['createSegment'](_0x25f841,_0x7d4bda),{'verbose':_0x4ff3d6['verbose']}),_0x4b0fc7=_0x19100b['data'];return console['error']('✔\x20Created\x20segment\x20\x27'+_0x4b0fc7[_0x3a0d8c(0x12a)]+_0x3a0d8c(0x11c)+_0x4b0fc7['id']),_0x4a043a!==_0x389999&&console[_0x3a0d8c(0x137)]('\x20\x20\x20Path:\x20'+_0x4a043a),await handleSDKOutput([_0x4b0fc7],_0x4ff3d6),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_0x42dd43=a40_0x12d5;(function(_0x1b1c71,_0x16ee1d){const _0x9915ca=a40_0x12d5,_0x22d714=_0x1b1c71();while(!![]){try{const _0x4d9329=-parseInt(_0x9915ca(0x9c))/0x1+parseInt(_0x9915ca(0x97))/0x2*(-parseInt(_0x9915ca(0x86))/0x3)+-parseInt(_0x9915ca(0x8f))/0x4*(-parseInt(_0x9915ca(0x95))/0x5)+-parseInt(_0x9915ca(0x85))/0x6*(-parseInt(_0x9915ca(0x99))/0x7)+-parseInt(_0x9915ca(0xa0))/0x8+-parseInt(_0x9915ca(0x91))/0x9+parseInt(_0x9915ca(0x8d))/0xa;if(_0x4d9329===_0x16ee1d)break;else _0x22d714['push'](_0x22d714['shift']());}catch(_0x58163b){_0x22d714['push'](_0x22d714['shift']());}}}(a40_0xb295,0xb9463));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a40_0xb295(){const _0x597dc6=['listFields','data','\x27...','310255LwqJUc','Error:\x20Parent\x20segment\x20name\x20is\x20required','1808UZuQRc','error','6136424hIEdhq','name','parentSegment','599971sbebAq','verbose','Site:\x20','segment:fields','6052664Ecntmc','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','6iyJnhn','1932NsXxHe','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','length','jsonl','segment','json','site','13942970oJudOV','description','56vMReqj','\x20field','3978270aqeSmz'];a40_0xb295=function(){return _0x597dc6;};return a40_0xb295();}import{withSpinner}from'../utils/spinner.js';function a40_0x12d5(_0x449e74,_0x58a0c6){_0x449e74=_0x449e74-0x84;const _0xb2956a=a40_0xb295();let _0x12d5f3=_0xb2956a[_0x449e74];return _0x12d5f3;}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a40_0x42dd43(0x9a)]=a40_0x42dd43(0x9f);[a40_0x42dd43(0x8e)]='List\x20available\x20fields\x20for\x20segmentation';async['execute'](_0x58c4bb){const _0xe22f46=a40_0x42dd43,{options:_0x8dbf51,args:_0x9ebcb2,tdx:_0x6d65b0}=_0x58c4bb,_0x3fd57f=_0x9ebcb2[0x0]||_0x8dbf51[_0xe22f46(0x9b)];if(!_0x3fd57f)return console[_0xe22f46(0x98)](_0xe22f46(0x96)),console[_0xe22f46(0x98)](_0xe22f46(0x84)),console[_0xe22f46(0x98)](_0xe22f46(0x87)),0x1;_0x8dbf51[_0xe22f46(0x9d)]&&(console['error'](_0xe22f46(0x9e)+_0x8dbf51[_0xe22f46(0x8c)]),console[_0xe22f46(0x98)]('Parent\x20segment:\x20'+_0x3fd57f));const _0x4b48aa=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x3fd57f+_0xe22f46(0x94),()=>_0x6d65b0[_0xe22f46(0x8a)][_0xe22f46(0x92)](_0x3fd57f),{'verbose':_0x8dbf51['verbose']}),_0x16d901=_0x4b48aa[_0xe22f46(0x93)];console[_0xe22f46(0x98)]('✔\x20Found\x20'+_0x16d901[_0xe22f46(0x88)]+_0xe22f46(0x90)+(_0x16d901[_0xe22f46(0x88)]!==0x1?'s':''));if(_0x8dbf51[_0xe22f46(0x8b)]||_0x8dbf51[_0xe22f46(0x89)])return await handleSDKOutput(_0x16d901,_0x8dbf51),0x0;return displayFieldsHumanReadable(_0x16d901,_0x3fd57f),0x0;}}