@treasuredata/tdx 2026.3.39 → 2026.3.41

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 (224) 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.d.ts.map +1 -1
  141. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  142. package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
  143. package/dist/sdk/segment/fields-display.js +1 -1
  144. package/dist/sdk/segment/file-discovery.js +1 -1
  145. package/dist/sdk/segment/journey-utils.js +1 -1
  146. package/dist/sdk/segment/journey-validator.js +1 -1
  147. package/dist/sdk/segment/journey-yaml.js +1 -1
  148. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  149. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  150. package/dist/sdk/segment/pull-workflow.js +1 -1
  151. package/dist/sdk/segment/push-recovery.js +1 -1
  152. package/dist/sdk/segment/push-workflow.js +1 -1
  153. package/dist/sdk/segment/resolution-context.js +1 -1
  154. package/dist/sdk/segment/segment-path-parser.js +1 -1
  155. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  156. package/dist/sdk/segment/segment-validator.js +1 -1
  157. package/dist/sdk/segment/segment-validator.js.map +1 -1
  158. package/dist/sdk/segment/target-resolution.js +1 -1
  159. package/dist/sdk/segment/tdx-config.js +1 -1
  160. package/dist/sdk/segment/types/activation-schema.js +1 -1
  161. package/dist/sdk/segment/types/journey-def.js +1 -1
  162. package/dist/sdk/segment/types/journey-schema.js +1 -1
  163. package/dist/sdk/segment/types/segment-def.js +1 -1
  164. package/dist/sdk/segment/types/segment-schema.js +1 -1
  165. package/dist/sdk/segment/validate-files.js +1 -1
  166. package/dist/sdk/segment/yaml-validator.js +1 -1
  167. package/dist/sdk/segment.js +1 -1
  168. package/dist/sdk/types/cdp.d.ts +3 -0
  169. package/dist/sdk/types/cdp.d.ts.map +1 -1
  170. package/dist/sdk/types/index.js +1 -1
  171. package/dist/sdk/types/progress.js +1 -1
  172. package/dist/sdk/types/workspace.js +1 -1
  173. package/dist/sdk/user.js +1 -1
  174. package/dist/sdk/util/format-detector.js +1 -1
  175. package/dist/sdk/util/formatters.js +1 -1
  176. package/dist/sdk/util/index.js +1 -1
  177. package/dist/sdk/util/paginate.js +1 -1
  178. package/dist/sdk/util/tree-formatter.js +1 -1
  179. package/dist/sdk/workflow/archive-validation.js +1 -1
  180. package/dist/sdk/workflow/clone-workflow.js +1 -1
  181. package/dist/sdk/workflow/index.js +1 -1
  182. package/dist/sdk/workflow/pull-workflow.js +1 -1
  183. package/dist/sdk/workflow/push-workflow.js +1 -1
  184. package/dist/sdk/workflow/tdx-config.js +1 -1
  185. package/dist/sdk/workflow/workflow-utils.js +1 -1
  186. package/dist/sdk/workspace/frontmatter.js +1 -1
  187. package/dist/sdk/workspace/git.js +1 -1
  188. package/dist/sdk/workspace/index.js +1 -1
  189. package/dist/sdk/workspace/templates.js +1 -1
  190. package/dist/sdk/workspace/weekly.js +1 -1
  191. package/dist/sdk/workspace/wikilinks.js +1 -1
  192. package/dist/test-utils/command-runner.js +1 -1
  193. package/dist/test-utils/factories.js +1 -1
  194. package/dist/test-utils/fixtures.js +1 -1
  195. package/dist/test-utils/http-mock.js +1 -1
  196. package/dist/test-utils/index.js +1 -1
  197. package/dist/utils/async.js +1 -1
  198. package/dist/utils/colors.js +1 -1
  199. package/dist/utils/diff.js +1 -1
  200. package/dist/utils/file-permissions.js +1 -1
  201. package/dist/utils/file-reader.js +1 -1
  202. package/dist/utils/github-releases.js +1 -1
  203. package/dist/utils/global-cache.js +1 -1
  204. package/dist/utils/json-loader.js +1 -1
  205. package/dist/utils/local-cache.js +1 -1
  206. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  207. package/dist/utils/logger/formatters/index.js +1 -1
  208. package/dist/utils/logger/handlers/console-handler.js +1 -1
  209. package/dist/utils/logger/handlers/file-handler.js +1 -1
  210. package/dist/utils/logger/handlers/index.js +1 -1
  211. package/dist/utils/logger/handlers/null-handler.js +1 -1
  212. package/dist/utils/logger/index.js +1 -1
  213. package/dist/utils/logger/logger.js +1 -1
  214. package/dist/utils/logger/types.js +1 -1
  215. package/dist/utils/option-validation.js +1 -1
  216. package/dist/utils/process.js +1 -1
  217. package/dist/utils/prompt.js +1 -1
  218. package/dist/utils/spinner.js +1 -1
  219. package/dist/utils/sse-parser.js +1 -1
  220. package/dist/utils/string-utils.js +1 -1
  221. package/dist/utils/table-ref-parser.js +1 -1
  222. package/dist/utils/tdx-logger.js +1 -1
  223. package/dist/utils/version-check.js +1 -1
  224. package/package.json +1 -1
@@ -1 +1 @@
1
- const a33_0x1e4360=a33_0x43cb;(function(_0x24ecca,_0x35241d){const _0x220691=a33_0x43cb,_0x4ace8f=_0x24ecca();while(!![]){try{const _0x23276b=-parseInt(_0x220691(0x140))/0x1+parseInt(_0x220691(0x15a))/0x2*(-parseInt(_0x220691(0x170))/0x3)+-parseInt(_0x220691(0x156))/0x4*(-parseInt(_0x220691(0x13f))/0x5)+-parseInt(_0x220691(0x164))/0x6*(-parseInt(_0x220691(0x14c))/0x7)+parseInt(_0x220691(0x147))/0x8*(-parseInt(_0x220691(0x14d))/0x9)+parseInt(_0x220691(0x150))/0xa+parseInt(_0x220691(0x13e))/0xb*(parseInt(_0x220691(0x14e))/0xc);if(_0x23276b===_0x35241d)break;else _0x4ace8f['push'](_0x4ace8f['shift']());}catch(_0x448f5b){_0x4ace8f['push'](_0x4ace8f['shift']());}}}(a33_0x2f73,0x7b592));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';function a33_0x2f73(){const _0x179e9e=['map',',\x20user_id:','323561hXhdsB','9tBcPqB','2754084ziSoVw','execute','1152020cQCTjb','all','\x20—\x20','administrator','data','✔\x20Found\x20','333464JYxeQP','getPolicyPermissions','ies','policy','1088rFwXhc','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','name','bold','account_owner','site','permissions','error','email','\x20\x20No\x20policies\x20assigned','6QWoscE','\x20polic','Member','log','operation','🔑\x20Effective\x20Permissions','account_id','validate','verbose','context','\x20user','length','3153llkyZu','Account\x20Owner','description','\x20\x20•\x20','max','dim','policy\x20list','Administrator','Listing\x20policies...','77rawJFy','35AtRAxr','331449tEanzc','args','user','getMyPermissions','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','policies','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','7544872jsXYmZ','listPolicies','policy\x20show'];a33_0x2f73=function(){return _0x179e9e;};return a33_0x2f73();}function a33_0x43cb(_0x1448b8,_0x2dc270){_0x1448b8=_0x1448b8-0x13b;const _0x2f737c=a33_0x2f73();let _0x43cb4c=_0x2f737c[_0x1448b8];return _0x43cb4c;}import{withSpinner}from'../utils/spinner.js';import a33_0x352fa4 from'chalk';export class PolicyCommand extends BaseCommand{[a33_0x1e4360(0x15c)]=a33_0x1e4360(0x159);[a33_0x1e4360(0x172)]=a33_0x1e4360(0x144);async['execute'](_0x2d1cef){const _0x30369a=a33_0x1e4360,{options:_0x1d24e6,tdx:_0x1db3d1}=_0x2d1cef,_0x29b80c=await withSpinner('Fetching\x20permissions...',async()=>{const _0x5adaa4=a33_0x43cb,[_0x659a8e,_0x5dccdd]=await Promise['all']([_0x1db3d1[_0x5adaa4(0x142)]['getCurrent'](),_0x1db3d1[_0x5adaa4(0x159)][_0x5adaa4(0x143)]()]);return{'userInfo':_0x659a8e,'permissions':_0x5dccdd};},{'verbose':_0x1d24e6[_0x30369a(0x16c)]}),{userInfo:_0x1088a3,permissions:_0xf561cd}=_0x29b80c['data'];if(isStructuredFormat(_0x1d24e6))return await handleSingleObjectOutput(_0xf561cd,_0x1d24e6),0x0;const _0x4e7f6b=_0x1088a3[_0x30369a(0x15e)]?_0x30369a(0x171):_0x1088a3[_0x30369a(0x153)]?_0x30369a(0x13c):_0x30369a(0x166);console['log']('\x0a'+a33_0x352fa4[_0x30369a(0x15d)]('👤')+'\x20'+a33_0x352fa4['bold'](_0x1088a3[_0x30369a(0x15c)])+'\x20'+a33_0x352fa4['dim']('('+_0x1088a3['email']+')')+_0x30369a(0x152)+_0x4e7f6b),console[_0x30369a(0x167)](a33_0x352fa4[_0x30369a(0x175)]('\x20\x20\x20'+_0x1db3d1[_0x30369a(0x16d)][_0x30369a(0x15f)]+':'+_0x1088a3[_0x30369a(0x16a)]+_0x30369a(0x14b)+_0x1088a3['id']));const _0x808188=_0xf561cd[_0x30369a(0x145)];console['log']('\x0a'+a33_0x352fa4[_0x30369a(0x15d)]('📋\x20Assigned\x20Policies')+'\x20('+_0x808188[_0x30369a(0x16f)]+'):');if(_0x808188[_0x30369a(0x16f)]===0x0)console[_0x30369a(0x167)](a33_0x352fa4[_0x30369a(0x175)](_0x30369a(0x163)));else for(const _0x553144 of _0x808188){console[_0x30369a(0x167)](_0x30369a(0x173)+_0x553144[_0x30369a(0x15c)]);}return printPermissionsMap(_0xf561cd[_0x30369a(0x160)]),console[_0x30369a(0x167)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a33_0x1e4360(0x15c)]=a33_0x1e4360(0x13b);['description']=a33_0x1e4360(0x146);async[a33_0x1e4360(0x14f)](_0x84fdc2){const _0x23aa2b=a33_0x1e4360,{options:_0x228814,tdx:_0x52deec}=_0x84fdc2,_0x56723f=await withSpinner(_0x23aa2b(0x13d),()=>_0x52deec[_0x23aa2b(0x159)][_0x23aa2b(0x148)](),{'verbose':_0x228814[_0x23aa2b(0x16c)]}),_0x549055=_0x56723f[_0x23aa2b(0x154)];console[_0x23aa2b(0x161)](_0x23aa2b(0x155)+_0x549055[_0x23aa2b(0x16f)]+_0x23aa2b(0x165)+(_0x549055[_0x23aa2b(0x16f)]!==0x1?_0x23aa2b(0x158):'y'));if(isStructuredFormat(_0x228814))return await handleSDKOutput(_0x549055,_0x228814),0x0;if(_0x549055[_0x23aa2b(0x16f)]===0x0)console[_0x23aa2b(0x167)](a33_0x352fa4[_0x23aa2b(0x175)]('No\x20policies\x20found'));else for(const _0x571bc0 of _0x549055){const _0x5345cf=_0x571bc0[_0x23aa2b(0x172)]?a33_0x352fa4['dim']('\x20—\x20'+_0x571bc0[_0x23aa2b(0x172)]):'';console[_0x23aa2b(0x167)](_0x23aa2b(0x173)+_0x571bc0[_0x23aa2b(0x15c)]+_0x5345cf);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a33_0x1e4360(0x15c)]=a33_0x1e4360(0x149);['description']='Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)';[a33_0x1e4360(0x16b)](_0x2ef468){const _0xdefc02=a33_0x1e4360;if(_0x2ef468[_0xdefc02(0x141)][_0xdefc02(0x16f)]===0x0)return _0xdefc02(0x15b);return undefined;}async[a33_0x1e4360(0x14f)](_0x3ddd65){const _0x2abf13=a33_0x1e4360,{options:_0x6d41b4,tdx:_0x35b7db}=_0x3ddd65,_0xc6d49f=_0x3ddd65[_0x2abf13(0x141)][0x0],_0x48739f=await withSpinner('Fetching\x20policy...',async()=>{const _0x100c16=_0x2abf13,_0x33a0c8=await _0x35b7db[_0x100c16(0x159)]['getPolicy'](_0xc6d49f),[_0x28cb26,_0x124a8b]=await Promise[_0x100c16(0x151)]([_0x35b7db[_0x100c16(0x159)][_0x100c16(0x157)](_0x33a0c8['id']),_0x35b7db['policy']['getPolicyUsers'](_0x33a0c8['id'])]);return{'policy':_0x33a0c8,'perms':_0x28cb26,'users':_0x124a8b};},{'verbose':_0x6d41b4[_0x2abf13(0x16c)]}),{policy:_0x108418,perms:_0x2cae16,users:_0x498160}=_0x48739f[_0x2abf13(0x154)];if(isStructuredFormat(_0x6d41b4))return await handleSingleObjectOutput({..._0x108418,'permissions':_0x2cae16[_0x2abf13(0x160)],'users':_0x498160},_0x6d41b4),0x0;console[_0x2abf13(0x167)]('\x0a'+a33_0x352fa4[_0x2abf13(0x15d)]('📋')+'\x20'+a33_0x352fa4[_0x2abf13(0x15d)](_0x108418[_0x2abf13(0x15c)])+'\x20'+a33_0x352fa4[_0x2abf13(0x175)]('(ID:\x20'+_0x108418['id']+')'));_0x108418[_0x2abf13(0x172)]&&console[_0x2abf13(0x167)]('\x20\x20\x20'+a33_0x352fa4[_0x2abf13(0x175)](_0x108418[_0x2abf13(0x172)]));console[_0x2abf13(0x167)]('\x20\x20\x20'+_0x498160['length']+_0x2abf13(0x16e)+(_0x498160[_0x2abf13(0x16f)]!==0x1?'s':'')+'\x20assigned'),printPermissionsMap(_0x2cae16[_0x2abf13(0x160)]);if(_0x498160[_0x2abf13(0x16f)]>0x0){console[_0x2abf13(0x167)]('\x0a'+a33_0x352fa4[_0x2abf13(0x15d)]('👥\x20Assigned\x20Users')+':');for(const _0x5c8640 of _0x498160){const _0x293558=_0x5c8640[_0x2abf13(0x162)]&&_0x5c8640[_0x2abf13(0x162)]!==_0x5c8640['name']?a33_0x352fa4['dim']('\x20<'+_0x5c8640[_0x2abf13(0x162)]+'>'):'';console[_0x2abf13(0x167)]('\x20\x20•\x20'+_0x5c8640[_0x2abf13(0x15c)]+_0x293558);}}return console[_0x2abf13(0x167)](),0x0;}}function printPermissionsMap(_0x19fc5f){const _0x3220f7=a33_0x1e4360,_0xf26965=Object['entries'](_0x19fc5f);console[_0x3220f7(0x167)]('\x0a'+a33_0x352fa4['bold'](_0x3220f7(0x169))+':');if(_0xf26965[_0x3220f7(0x16f)]===0x0){console['log'](a33_0x352fa4['dim']('\x20\x20No\x20permissions'));return;}const _0x488b52=Math[_0x3220f7(0x174)](..._0xf26965[_0x3220f7(0x14a)](([_0x534e36])=>_0x534e36[_0x3220f7(0x16f)]));for(const [_0x4d1b91,_0xa16ff8]of _0xf26965){const _0x5af795=formatOperations(_0xa16ff8);console[_0x3220f7(0x167)]('\x20\x20'+_0x4d1b91['padEnd'](_0x488b52+0x2)+_0x5af795);}}function formatOperations(_0x5f0984){const _0x2002bf=a33_0x1e4360,_0x3027b1=[...new Set(_0x5f0984['map'](_0x30ff43=>_0x30ff43[_0x2002bf(0x168)]))];return _0x3027b1['join'](',\x20');}
1
+ const a33_0x3eaa88=a33_0x1116;(function(_0x97f26e,_0x158a6e){const _0x4de7f4=a33_0x1116,_0x480b48=_0x97f26e();while(!![]){try{const _0x20de19=-parseInt(_0x4de7f4(0x1c9))/0x1+-parseInt(_0x4de7f4(0x1e6))/0x2*(-parseInt(_0x4de7f4(0x1df))/0x3)+parseInt(_0x4de7f4(0x1c5))/0x4*(parseInt(_0x4de7f4(0x1d6))/0x5)+-parseInt(_0x4de7f4(0x1e1))/0x6*(parseInt(_0x4de7f4(0x1d3))/0x7)+-parseInt(_0x4de7f4(0x1d1))/0x8*(parseInt(_0x4de7f4(0x1cc))/0x9)+-parseInt(_0x4de7f4(0x1cd))/0xa*(-parseInt(_0x4de7f4(0x1f1))/0xb)+-parseInt(_0x4de7f4(0x1ca))/0xc;if(_0x20de19===_0x158a6e)break;else _0x480b48['push'](_0x480b48['shift']());}catch(_0x322c55){_0x480b48['push'](_0x480b48['shift']());}}}(a33_0x53db,0x54da3));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a33_0x264c84 from'chalk';export class PolicyCommand extends BaseCommand{[a33_0x3eaa88(0x1d2)]=a33_0x3eaa88(0x1ed);['description']=a33_0x3eaa88(0x1e7);async[a33_0x3eaa88(0x1f2)](_0x3873b1){const _0x366d9a=a33_0x3eaa88,{options:_0x3fb917,tdx:_0x18f726}=_0x3873b1,_0x2ceac6=await withSpinner(_0x366d9a(0x1cb),async()=>{const _0x243ed4=_0x366d9a,[_0x1d0cb4,_0xea823f]=await Promise[_0x243ed4(0x1d5)]([_0x18f726[_0x243ed4(0x1ce)][_0x243ed4(0x1d8)](),_0x18f726[_0x243ed4(0x1ed)][_0x243ed4(0x1f6)]()]);return{'userInfo':_0x1d0cb4,'permissions':_0xea823f};},{'verbose':_0x3fb917[_0x366d9a(0x1c8)]}),{userInfo:_0x5bbbb0,permissions:_0x172b8f}=_0x2ceac6[_0x366d9a(0x1ea)];if(isStructuredFormat(_0x3fb917))return await handleSingleObjectOutput(_0x172b8f,_0x3fb917),0x0;const _0x197766=_0x5bbbb0[_0x366d9a(0x1ef)]?_0x366d9a(0x1e0):_0x5bbbb0[_0x366d9a(0x1db)]?_0x366d9a(0x1c3):'Member';console['log']('\x0a'+a33_0x264c84[_0x366d9a(0x1dd)]('👤')+'\x20'+a33_0x264c84['bold'](_0x5bbbb0[_0x366d9a(0x1d2)])+'\x20'+a33_0x264c84[_0x366d9a(0x1f5)]('('+_0x5bbbb0['email']+')')+'\x20—\x20'+_0x197766),console[_0x366d9a(0x1c2)](a33_0x264c84['dim'](_0x366d9a(0x1e3)+_0x18f726['context']['site']+':'+_0x5bbbb0['account_id']+',\x20user_id:'+_0x5bbbb0['id']));const _0x43dd23=_0x172b8f[_0x366d9a(0x1bf)];console['log']('\x0a'+a33_0x264c84[_0x366d9a(0x1dd)](_0x366d9a(0x1e9))+'\x20('+_0x43dd23['length']+'):');if(_0x43dd23[_0x366d9a(0x1cf)]===0x0)console['log'](a33_0x264c84[_0x366d9a(0x1f5)](_0x366d9a(0x1c4)));else for(const _0x408da8 of _0x43dd23){console[_0x366d9a(0x1c2)](_0x366d9a(0x1c0)+_0x408da8[_0x366d9a(0x1d2)]);}return printPermissionsMap(_0x172b8f[_0x366d9a(0x1e8)]),console['log'](),0x0;}}function a33_0x1116(_0x42fdc3,_0x405894){_0x42fdc3=_0x42fdc3-0x1bb;const _0x53dbe6=a33_0x53db();let _0x11164=_0x53dbe6[_0x42fdc3];return _0x11164;}export class PolicyListCommand extends BaseCommand{['name']=a33_0x3eaa88(0x1e2);[a33_0x3eaa88(0x1bc)]='List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)';async[a33_0x3eaa88(0x1f2)](_0x40704d){const _0xde234f=a33_0x3eaa88,{options:_0x2fbb75,tdx:_0x36ae2b}=_0x40704d,_0x290c03=await withSpinner('Listing\x20policies...',()=>_0x36ae2b[_0xde234f(0x1ed)][_0xde234f(0x1c6)](),{'verbose':_0x2fbb75[_0xde234f(0x1c8)]}),_0x4456ec=_0x290c03['data'];console[_0xde234f(0x1d4)]('✔\x20Found\x20'+_0x4456ec[_0xde234f(0x1cf)]+_0xde234f(0x1ee)+(_0x4456ec[_0xde234f(0x1cf)]!==0x1?_0xde234f(0x1d0):'y'));if(isStructuredFormat(_0x2fbb75))return await handleSDKOutput(_0x4456ec,_0x2fbb75),0x0;if(_0x4456ec[_0xde234f(0x1cf)]===0x0)console[_0xde234f(0x1c2)](a33_0x264c84[_0xde234f(0x1f5)]('No\x20policies\x20found'));else for(const _0x21197d of _0x4456ec){const _0x32f046=_0x21197d['description']?a33_0x264c84[_0xde234f(0x1f5)](_0xde234f(0x1d7)+_0x21197d[_0xde234f(0x1bc)]):'';console[_0xde234f(0x1c2)]('\x20\x20•\x20'+_0x21197d[_0xde234f(0x1d2)]+_0x32f046);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a33_0x3eaa88(0x1d2)]=a33_0x3eaa88(0x1dc);[a33_0x3eaa88(0x1bc)]=a33_0x3eaa88(0x1e4);[a33_0x3eaa88(0x1e5)](_0xb3159c){const _0x1d7aa0=a33_0x3eaa88;if(_0xb3159c[_0x1d7aa0(0x1c7)][_0x1d7aa0(0x1cf)]===0x0)return _0x1d7aa0(0x1bd);return undefined;}async[a33_0x3eaa88(0x1f2)](_0xba7bb8){const _0x3800bd=a33_0x3eaa88,{options:_0x40d6d0,tdx:_0x530606}=_0xba7bb8,_0x474aaa=_0xba7bb8['args'][0x0],_0x2c2a3e=await withSpinner('Fetching\x20policy...',async()=>{const _0x21f655=a33_0x1116,_0x1348c0=await _0x530606[_0x21f655(0x1ed)][_0x21f655(0x1bb)](_0x474aaa),[_0x1136c4,_0x4eb96c]=await Promise[_0x21f655(0x1d5)]([_0x530606[_0x21f655(0x1ed)][_0x21f655(0x1de)](_0x1348c0['id']),_0x530606['policy'][_0x21f655(0x1da)](_0x1348c0['id'])]);return{'policy':_0x1348c0,'perms':_0x1136c4,'users':_0x4eb96c};},{'verbose':_0x40d6d0['verbose']}),{policy:_0x3e0230,perms:_0x203495,users:_0xb6b562}=_0x2c2a3e['data'];if(isStructuredFormat(_0x40d6d0))return await handleSingleObjectOutput({..._0x3e0230,'permissions':_0x203495['permissions'],'users':_0xb6b562},_0x40d6d0),0x0;console[_0x3800bd(0x1c2)]('\x0a'+a33_0x264c84[_0x3800bd(0x1dd)]('📋')+'\x20'+a33_0x264c84[_0x3800bd(0x1dd)](_0x3e0230[_0x3800bd(0x1d2)])+'\x20'+a33_0x264c84[_0x3800bd(0x1f5)](_0x3800bd(0x1c1)+_0x3e0230['id']+')'));_0x3e0230[_0x3800bd(0x1bc)]&&console[_0x3800bd(0x1c2)](_0x3800bd(0x1e3)+a33_0x264c84['dim'](_0x3e0230[_0x3800bd(0x1bc)]));console[_0x3800bd(0x1c2)](_0x3800bd(0x1e3)+_0xb6b562[_0x3800bd(0x1cf)]+_0x3800bd(0x1d9)+(_0xb6b562[_0x3800bd(0x1cf)]!==0x1?'s':'')+'\x20assigned'),printPermissionsMap(_0x203495[_0x3800bd(0x1e8)]);if(_0xb6b562[_0x3800bd(0x1cf)]>0x0){console[_0x3800bd(0x1c2)]('\x0a'+a33_0x264c84[_0x3800bd(0x1dd)](_0x3800bd(0x1f3))+':');for(const _0x2107c6 of _0xb6b562){const _0x25f342=_0x2107c6[_0x3800bd(0x1eb)]&&_0x2107c6['email']!==_0x2107c6[_0x3800bd(0x1d2)]?a33_0x264c84[_0x3800bd(0x1f5)]('\x20<'+_0x2107c6[_0x3800bd(0x1eb)]+'>'):'';console['log'](_0x3800bd(0x1c0)+_0x2107c6[_0x3800bd(0x1d2)]+_0x25f342);}}return console[_0x3800bd(0x1c2)](),0x0;}}function a33_0x53db(){const _0x2ea2c3=['length','ies','8basuLj','name','406126YxwoDg','error','all','3235fvzdQr','\x20—\x20','getCurrent','\x20user','getPolicyUsers','administrator','policy\x20show','bold','getPolicyPermissions','51FdrUUn','Account\x20Owner','42ICXfGP','policy\x20list','\x20\x20\x20','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','validate','66812dhJjdg','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','permissions','📋\x20Assigned\x20Policies','data','email','padEnd','policy','\x20polic','account_owner','map','121gVyIQC','execute','👥\x20Assigned\x20Users','\x20\x20No\x20permissions','dim','getMyPermissions','getPolicy','description','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','entries','policies','\x20\x20•\x20','(ID:\x20','log','Administrator','\x20\x20No\x20policies\x20assigned','3812zsKDOz','listPolicies','args','verbose','466555dKzAqS','703488JrFSno','Fetching\x20permissions...','1834983kYEsUY','271140qTYZho','user'];a33_0x53db=function(){return _0x2ea2c3;};return a33_0x53db();}function printPermissionsMap(_0x2c4fdd){const _0x77c60e=a33_0x3eaa88,_0x55b9c4=Object[_0x77c60e(0x1be)](_0x2c4fdd);console['log']('\x0a'+a33_0x264c84[_0x77c60e(0x1dd)]('🔑\x20Effective\x20Permissions')+':');if(_0x55b9c4[_0x77c60e(0x1cf)]===0x0){console['log'](a33_0x264c84[_0x77c60e(0x1f5)](_0x77c60e(0x1f4)));return;}const _0x4adcbd=Math['max'](..._0x55b9c4['map'](([_0x51a2f0])=>_0x51a2f0[_0x77c60e(0x1cf)]));for(const [_0x457995,_0x13b3c5]of _0x55b9c4){const _0x59ed15=formatOperations(_0x13b3c5);console[_0x77c60e(0x1c2)]('\x20\x20'+_0x457995[_0x77c60e(0x1ec)](_0x4adcbd+0x2)+_0x59ed15);}}function formatOperations(_0x55471c){const _0x36ca68=a33_0x3eaa88,_0xa6b1ca=[...new Set(_0x55471c[_0x36ca68(0x1f0)](_0x194acf=>_0x194acf['operation']))];return _0xa6b1ca['join'](',\x20');}
@@ -1 +1 @@
1
- const a34_0x3b5dc0=a34_0x2893;(function(_0x3c6842,_0x259490){const _0x35f6be=a34_0x2893,_0x2d3174=_0x3c6842();while(!![]){try{const _0x3bf9f8=-parseInt(_0x35f6be(0x13d))/0x1*(-parseInt(_0x35f6be(0x10d))/0x2)+-parseInt(_0x35f6be(0x13f))/0x3+parseInt(_0x35f6be(0x117))/0x4*(parseInt(_0x35f6be(0x127))/0x5)+parseInt(_0x35f6be(0x12b))/0x6*(parseInt(_0x35f6be(0x132))/0x7)+-parseInt(_0x35f6be(0x128))/0x8*(-parseInt(_0x35f6be(0x11f))/0x9)+parseInt(_0x35f6be(0x103))/0xa+-parseInt(_0x35f6be(0x125))/0xb;if(_0x3bf9f8===_0x259490)break;else _0x2d3174['push'](_0x2d3174['shift']());}catch(_0x330c11){_0x2d3174['push'](_0x2d3174['shift']());}}}(a34_0x8c23,0xf37c9));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_0x5133ad from'node:path';function a34_0x8c23(){const _0x486e0b=['\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','profile:create','getUserInfo','name','OAuth\x20(browser\x20login)','\x0aSaved\x20to:\x20','\x27\x20updated:\x20','94GvMEQa','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','site','ERROR','Failed\x20to\x20remove\x20profile:\x20','green','llm_project','Profile\x20name\x20cannot\x20be\x20empty','Set\x20a\x20profile\x20configuration\x20value','\x27\x20does\x20not\x20exist.','164108nThUfZ','log','profileName','confirm','Enter\x20description\x20(optional):','password','\x27.\x0a\x0aValid\x20keys:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','27UrVXkP','split','Enter\x20profile\x20name:','description','Removal\x20cancelled','execute','41385850JTDpzZ','\x20API\x20key\x20is\x20valid\x20(User:\x20','70dsYNHl','4815688ppSbLD','apiKey','text','2561358HHYkef','profile','tdx:\x20profile\x20create','tdx:\x20profile\x20set','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','bold','Profile\x20\x27','14qThBPN','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Site\x20was\x20not\x20changed.','includes','\x20\x20tdx\x20--profile\x20','profile:set','jobs','message','Remove\x20a\x20profile','Setup\x20cancelled','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','18355somcEk','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','1396044TORhUb','Set\x20session\x20profile','API\x20key\x20cannot\x20be\x20empty','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','API\x20Key','VALID_KEYS','Operation\x20cancelled','status','\x27\x20requires\x20API\x20key\x20validation.','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','red','yellow','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','\x27\x20removed\x20from\x20configuration','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','error','validate','\x20Profile\x20\x27','length','llm_agent','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','trim','tdx.json','config','\x20\x20-\x20','tdx:\x20profile\x20remove','(session:\x20','Default\x20profile\x20set\x20to:\x20','Validating\x20API\x20key...','\x20API\x20key\x20removed\x20from\x20system\x20keychain','Create\x20a\x20new\x20profile','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Changing\x20site\x20to\x20\x27','\x0aOperation\x20cancelled','default','Enter\x20your\x20TD\x20API\x20key:','/app/mp/ak','create','oauth','\x20\x20(no\x20profiles\x20found)','dim','email','Choose\x20authentication\x20method:','method','\x27\x20created','logLevel','apikey','warn','join','\x0aAvailable\x20profiles:','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>','11282870kkMUwq','\x0aSetup\x20cancelled','session'];a34_0x8c23=function(){return _0x486e0b;};return a34_0x8c23();}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';function a34_0x2893(_0x45dfcc,_0x14bc76){_0x45dfcc=_0x45dfcc-0xe7;const _0x8c2341=a34_0x8c23();let _0x289358=_0x8c2341[_0x45dfcc];return _0x289358;}import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a34_0xcf102a from'prompts';import a34_0x30648a from'chalk';function validateProfileName(_0x11d6e8){const _0x523d1b=a34_0x2893;if(!_0x11d6e8||!_0x11d6e8[_0x523d1b(0x156)]())return _0x523d1b(0x114);const _0x4b70df=_0x11d6e8['trim']();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x4b70df))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x4b70df))return'Profile\x20\x27'+_0x4b70df+_0x523d1b(0x142);return!![];}export class ProfileCreateCommand extends BaseCommand{[a34_0x3b5dc0(0x109)]=a34_0x3b5dc0(0x107);[a34_0x3b5dc0(0x122)]=a34_0x3b5dc0(0xee);async['execute'](_0x59c4a5){const _0x4bb292=a34_0x3b5dc0,{options:_0x1edf76,args:_0x34f465}=_0x59c4a5;console[_0x4bb292(0x118)](a34_0x30648a['bold'](_0x4bb292(0x12d)));let _0x2f843f;if(_0x34f465['length']>0x0&&_0x34f465[0x0]){const _0x3a1981=_0x34f465[0x0][_0x4bb292(0x156)](),_0x1522fe=validateProfileName(_0x3a1981);if(_0x1522fe!==!![])return console[_0x4bb292(0x150)](a34_0x30648a[_0x4bb292(0x14a)](_0x1522fe)),0x1;_0x2f843f=_0x3a1981;}else{const _0x1c08f8=await a34_0xcf102a({'type':_0x4bb292(0x12a),'name':_0x4bb292(0x119),'message':_0x4bb292(0x121),'validate':validateProfileName});if(!_0x1c08f8[_0x4bb292(0x119)])return console['log'](_0x4bb292(0x104)),0x1;_0x2f843f=_0x1c08f8[_0x4bb292(0x119)][_0x4bb292(0x156)]();}const _0x488844=await a34_0xcf102a({'type':_0x4bb292(0x12a),'name':_0x4bb292(0x122),'message':_0x4bb292(0x11b)}),_0x4fbd24=_0x488844[_0x4bb292(0x122)]?.[_0x4bb292(0x156)]()||undefined,_0x1e8e5c=_0x1edf76['site']||'us01',_0x268e65=await promptSiteSelection(_0x1e8e5c,_0x2f843f,_0x4bb292(0x13b));if(!_0x268e65)return 0x1;const _0x5eb446=resolveSite(_0x268e65);if(isOAuthSupported(_0x5eb446)){const _0x3f4320=await a34_0xcf102a({'type':'select','name':_0x4bb292(0xfb),'message':_0x4bb292(0xfa),'choices':[{'title':_0x4bb292(0x10a),'value':_0x4bb292(0xf6)},{'title':_0x4bb292(0x144),'value':_0x4bb292(0xfe)}]});if(!_0x3f4320[_0x4bb292(0xfb)])return console['log'](_0x4bb292(0x104)),0x1;if(_0x3f4320[_0x4bb292(0xfb)]===_0x4bb292(0xf6)){if(_0x4fbd24){const _0xe57ad6={'site':_0x5eb446,'description':_0x4fbd24};saveProfileToUserConfig(_0x2f843f,_0xe57ad6);}return await runOAuthLoginFlow(_0x5eb446,_0x2f843f,_0x1edf76[_0x4bb292(0xfd)]??LogLevel[_0x4bb292(0x110)]),0x0;}}console[_0x4bb292(0x118)](_0x4bb292(0x14c)+_0x5eb446),console['log']('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x4bb292(0x118)]('\x20\x20'+getConsoleUrl(_0x5eb446,'/app/mp/ak'));const _0x166ba6=await a34_0xcf102a({'type':'password','name':'apiKey','message':_0x4bb292(0xf3),'validate':_0xc01616=>{const _0x275fb3=_0x4bb292;if(!_0xc01616||!_0xc01616[_0x275fb3(0x156)]())return _0x275fb3(0x141);return!![];}});if(!_0x166ba6[_0x4bb292(0x129)])return console[_0x4bb292(0x118)]('\x0aSetup\x20cancelled'),0x1;const _0x9f14a6=_0x166ba6[_0x4bb292(0x129)];console[_0x4bb292(0x118)]('Validating\x20API\x20key...');try{const _0x411f23=TDX[_0x4bb292(0xf5)]({'site':_0x5eb446,'apiKey':_0x9f14a6[_0x4bb292(0x156)](),'logLevel':_0x1edf76['logLevel']??LogLevel[_0x4bb292(0x110)]}),_0x1c10c9=await _0x411f23['jobs'][_0x4bb292(0x108)]();console[_0x4bb292(0x118)](a34_0x30648a[_0x4bb292(0x112)]('✓')+_0x4bb292(0x126)+_0x1c10c9[_0x4bb292(0xf9)]+')');const _0x4460dc=await isKeychainAvailable();_0x4460dc?(await saveAPIKeyAsync(_0x9f14a6[_0x4bb292(0x156)](),_0x5eb446,_0x2f843f),console['log'](a34_0x30648a['green']('✓')+_0x4bb292(0x14d)+_0x2f843f+')')):(console[_0x4bb292(0xff)](a34_0x30648a[_0x4bb292(0x14b)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x4bb292(0xff)](a34_0x30648a[_0x4bb292(0x14b)](_0x4bb292(0x13c))));const _0x372947={'site':_0x5eb446,..._0x4fbd24&&{'description':_0x4fbd24}};return saveProfileToUserConfig(_0x2f843f,_0x372947),console[_0x4bb292(0x118)](a34_0x30648a[_0x4bb292(0x112)]('✓')+_0x4bb292(0x152)+_0x2f843f+_0x4bb292(0xfc)),console[_0x4bb292(0x118)](),console['log'](_0x4bb292(0x14f)),console[_0x4bb292(0x118)](_0x4bb292(0x136)+_0x2f843f+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x4bb292(0x118)](_0x4bb292(0x136)+_0x2f843f+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x4ed600){if(_0x4ed600 instanceof HTTPClientError&&_0x4ed600[_0x4bb292(0x147)]===0x191)return printAuthError(_0x4ed600),0x1;return console[_0x4bb292(0x150)](a34_0x30648a[_0x4bb292(0x14a)]('✗\x20Validation\x20failed:\x20'+(_0x4ed600 instanceof Error?_0x4ed600[_0x4bb292(0x139)]:String(_0x4ed600)))),console[_0x4bb292(0x150)](_0x4bb292(0x149)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a34_0x3b5dc0(0x109)]='profile:remove';[a34_0x3b5dc0(0x122)]=a34_0x3b5dc0(0x13a);['validate'](_0x415571){const _0x2e0584=a34_0x3b5dc0,{args:_0x2f3757}=_0x415571;if(_0x2f3757[_0x2e0584(0x153)]===0x0)return _0x2e0584(0x11e);return undefined;}async['execute'](_0x551239){const _0x4b3447=a34_0x3b5dc0,{args:_0x47f297}=_0x551239,_0x471d42=_0x47f297[0x0];console[_0x4b3447(0x118)](a34_0x30648a['bold'](_0x4b3447(0xe9)));if(!profileExists(_0x471d42)){console[_0x4b3447(0x150)](a34_0x30648a[_0x4b3447(0x14a)](_0x4b3447(0x131)+_0x471d42+'\x27\x20does\x20not\x20exist.')),console['log'](_0x4b3447(0x101));const _0x20b38a=listProfiles();if(_0x20b38a[_0x4b3447(0x153)]===0x0)console[_0x4b3447(0x118)](_0x4b3447(0xf7));else for(const _0x2453ba of _0x20b38a){console['log'](_0x4b3447(0xe8)+_0x2453ba[_0x4b3447(0x109)]);}return 0x1;}const _0xab7cdc=await a34_0xcf102a({'type':'confirm','name':_0x4b3447(0x11a),'message':_0x4b3447(0x12f)+_0x471d42+'\x27?','initial':![]});if(!_0xab7cdc[_0x4b3447(0x11a)])return console[_0x4b3447(0x118)](_0x4b3447(0x123)),0x0;try{removeProfileFromUserConfig(_0x471d42),console[_0x4b3447(0x118)](a34_0x30648a[_0x4b3447(0x112)]('✓')+'\x20Profile\x20\x27'+_0x471d42+_0x4b3447(0x14e));}catch(_0x1e6d7a){return console[_0x4b3447(0x150)](a34_0x30648a['red'](_0x4b3447(0x111)+(_0x1e6d7a instanceof Error?_0x1e6d7a[_0x4b3447(0x139)]:String(_0x1e6d7a)))),0x1;}const _0x47ceda=await isKeychainAvailable();if(_0x47ceda){const _0x3c32e5=await deleteKeychainAPIKey(_0x471d42);_0x3c32e5&&console[_0x4b3447(0x118)](a34_0x30648a[_0x4b3447(0x112)]('✓')+_0x4b3447(0xed));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a34_0x3b5dc0(0x137);['description']=a34_0x3b5dc0(0x115);static ['VALID_KEYS']=[a34_0x3b5dc0(0x10f),'database','parent_segment',a34_0x3b5dc0(0x113),a34_0x3b5dc0(0x154),a34_0x3b5dc0(0x122)];[a34_0x3b5dc0(0x151)](_0x500ecb){const _0x1598be=a34_0x3b5dc0,{args:_0x2c1a91,options:_0x4565bb}=_0x500ecb,_0x2c2b2d=_0x4565bb['profile']||getActiveProfile();if(!_0x2c2b2d)return _0x1598be(0x102);if(_0x2c1a91['length']===0x0)return _0x1598be(0x133)+ProfileSetCommand[_0x1598be(0x145)][_0x1598be(0x100)](',\x20');const _0xb3a601=_0x2c1a91[0x0];if(!_0xb3a601[_0x1598be(0x135)]('='))return _0x1598be(0x13e)+ProfileSetCommand['VALID_KEYS'][_0x1598be(0x100)](',\x20');const [_0x439b7e]=_0xb3a601[_0x1598be(0x120)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS']['includes'](_0x439b7e))return'Unknown\x20key\x20\x27'+_0x439b7e+_0x1598be(0x11d)+ProfileSetCommand['VALID_KEYS'][_0x1598be(0x100)](',\x20');return undefined;}async[a34_0x3b5dc0(0x124)](_0x285fbc){const _0x2cb0a3=a34_0x3b5dc0,{args:_0x34fc9d,options:_0x19fa00}=_0x285fbc,_0x2f2820=_0x19fa00[_0x2cb0a3(0x12c)]||getActiveProfile(),[_0x245a9e,..._0x199472]=_0x34fc9d[0x0][_0x2cb0a3(0x120)]('='),_0x57e499=_0x199472['join']('=');console['log'](a34_0x30648a[_0x2cb0a3(0x130)](_0x2cb0a3(0x12e)));if(!profileExists(_0x2f2820)){const _0x327d93=await a34_0xcf102a({'type':_0x2cb0a3(0x11a),'name':_0x2cb0a3(0xf5),'message':_0x2cb0a3(0x131)+_0x2f2820+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x327d93[_0x2cb0a3(0xf5)])return console['log'](_0x2cb0a3(0x146)),0x1;}const _0x3276b2=loadProfile(_0x2f2820),_0x46e662=_0x3276b2?.[_0x2cb0a3(0xe7)]||{};if(_0x245a9e==='site'){const _0x167642=resolveSite(_0x57e499);console[_0x2cb0a3(0x118)](_0x2cb0a3(0xf0)+_0x167642+_0x2cb0a3(0x148)),console[_0x2cb0a3(0x118)](_0x2cb0a3(0xef)),console['log']('\x20\x20'+getConsoleUrl(_0x167642,_0x2cb0a3(0xf4)));const _0x30ec2f=await a34_0xcf102a({'type':_0x2cb0a3(0x11c),'name':_0x2cb0a3(0x129),'message':_0x2cb0a3(0x155),'validate':_0x383b69=>{const _0x10b00b=_0x2cb0a3;if(!_0x383b69||!_0x383b69[_0x10b00b(0x156)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x30ec2f[_0x2cb0a3(0x129)])return console['log'](_0x2cb0a3(0xf1)),0x1;console['log'](_0x2cb0a3(0xec));try{const _0x1e6e17=TDX[_0x2cb0a3(0xf5)]({'site':_0x167642,'apiKey':_0x30ec2f[_0x2cb0a3(0x129)][_0x2cb0a3(0x156)](),'logLevel':_0x19fa00[_0x2cb0a3(0xfd)]??LogLevel['ERROR']}),_0x9904cb=await _0x1e6e17[_0x2cb0a3(0x138)][_0x2cb0a3(0x108)]();console[_0x2cb0a3(0x118)](a34_0x30648a[_0x2cb0a3(0x112)]('✓')+_0x2cb0a3(0x126)+_0x9904cb[_0x2cb0a3(0xf9)]+')');const _0x694735=await isKeychainAvailable();_0x694735?(await saveAPIKeyAsync(_0x30ec2f['apiKey'][_0x2cb0a3(0x156)](),_0x167642,_0x2f2820),console[_0x2cb0a3(0x118)](a34_0x30648a['green']('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x2cb0a3(0xff)](a34_0x30648a[_0x2cb0a3(0x14b)](_0x2cb0a3(0x143))),_0x46e662[_0x2cb0a3(0x10f)]=_0x167642;}catch(_0x86363c){if(_0x86363c instanceof HTTPClientError&&_0x86363c[_0x2cb0a3(0x147)]===0x191)return printAuthError(_0x86363c),0x1;return console[_0x2cb0a3(0x150)](a34_0x30648a[_0x2cb0a3(0x14a)]('✗\x20Validation\x20failed:\x20'+(_0x86363c instanceof Error?_0x86363c['message']:String(_0x86363c)))),console[_0x2cb0a3(0x150)](_0x2cb0a3(0x134)),0x1;}}else _0x46e662[_0x245a9e]=_0x57e499||undefined;return saveProfileToUserConfig(_0x2f2820,_0x46e662),console['log'](a34_0x30648a[_0x2cb0a3(0x112)]('✓')+_0x2cb0a3(0x152)+_0x2f2820+_0x2cb0a3(0x10c)+_0x245a9e+'='+(_0x57e499||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{[a34_0x3b5dc0(0x109)]='profile:use';['description']=a34_0x3b5dc0(0x140);['validate'](_0x182f7a){const _0x2fad6f=a34_0x3b5dc0,{args:_0x305257}=_0x182f7a;if(_0x305257['length']===0x0)return _0x2fad6f(0x10e);return undefined;}async[a34_0x3b5dc0(0x124)](_0x15993c){const _0x39972a=a34_0x3b5dc0,{args:_0x28d591,options:_0x1500cb}=_0x15993c,_0x19a7f7=_0x28d591[0x0],_0x327723=_0x1500cb[_0x39972a(0xf2)];cleanExpiredSessions();if(!profileExists(_0x19a7f7)){console['error'](a34_0x30648a['red'](_0x39972a(0x131)+_0x19a7f7+_0x39972a(0x116))),console[_0x39972a(0x118)](_0x39972a(0x101));const _0x164ac5=listProfiles();if(_0x164ac5[_0x39972a(0x153)]===0x0)console['log'](_0x39972a(0xf7));else for(const _0x1eb120 of _0x164ac5){console['log'](_0x39972a(0xe8)+_0x1eb120[_0x39972a(0x109)]);}return 0x1;}if(_0x327723){const _0x44c77e=a34_0x5133ad[_0x39972a(0x100)](getConfigDir(),_0x39972a(0x157));return saveActiveProfileToUserConfig(_0x19a7f7),console[_0x39972a(0x118)](_0x39972a(0xeb)+a34_0x30648a[_0x39972a(0x112)](_0x19a7f7)),console[_0x39972a(0x118)](a34_0x30648a[_0x39972a(0xf8)](_0x39972a(0x10b)+_0x44c77e)),0x0;}const _0x1351e0=getSessionID(_0x1500cb[_0x39972a(0x105)]);return saveSessionContext({'profile':_0x19a7f7},_0x1500cb['session']),console[_0x39972a(0x118)]('Session\x20profile\x20set\x20to:\x20'+a34_0x30648a[_0x39972a(0x112)](_0x19a7f7)+'\x20'+a34_0x30648a['dim'](_0x39972a(0xea)+_0x1351e0+')')),console[_0x39972a(0x118)](a34_0x30648a['dim'](_0x39972a(0x106)+_0x19a7f7+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
1
+ const a34_0x5590b2=a34_0x54ed;(function(_0x4c9cbc,_0xa598){const _0x1d0c5a=a34_0x54ed,_0x342ec7=_0x4c9cbc();while(!![]){try{const _0x11c4d2=-parseInt(_0x1d0c5a(0x117))/0x1*(parseInt(_0x1d0c5a(0x10c))/0x2)+parseInt(_0x1d0c5a(0x134))/0x3+-parseInt(_0x1d0c5a(0xf1))/0x4+parseInt(_0x1d0c5a(0x147))/0x5+parseInt(_0x1d0c5a(0x113))/0x6*(-parseInt(_0x1d0c5a(0x12f))/0x7)+-parseInt(_0x1d0c5a(0x140))/0x8+-parseInt(_0x1d0c5a(0xf0))/0x9*(-parseInt(_0x1d0c5a(0xe5))/0xa);if(_0x11c4d2===_0xa598)break;else _0x342ec7['push'](_0x342ec7['shift']());}catch(_0x30c4dd){_0x342ec7['push'](_0x342ec7['shift']());}}}(a34_0x5c35,0x8efa0));import{BaseCommand,printAuthError}from'./command.js';function a34_0x54ed(_0x286bbc,_0x3550f2){_0x286bbc=_0x286bbc-0xd3;const _0x5c3588=a34_0x5c35();let _0x54eddf=_0x5c3588[_0x286bbc];return _0x54eddf;}import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a34_0x5c3015 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{runOAuthLoginFlow}from'./auth-login-command.js';import{isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a34_0x30006e from'prompts';import a34_0x1929e1 from'chalk';function validateProfileName(_0x5b8d23){const _0x349396=a34_0x54ed;if(!_0x5b8d23||!_0x5b8d23[_0x349396(0x100)]())return _0x349396(0x115);const _0x5cbc36=_0x5b8d23[_0x349396(0x100)]();if(!/^[a-zA-Z0-9_-]+$/[_0x349396(0x10e)](_0x5cbc36))return _0x349396(0xd4);if(profileExists(_0x5cbc36))return _0x349396(0x122)+_0x5cbc36+_0x349396(0xf5);return!![];}export class ProfileCreateCommand extends BaseCommand{['name']=a34_0x5590b2(0x108);[a34_0x5590b2(0x135)]=a34_0x5590b2(0x10a);async[a34_0x5590b2(0x120)](_0x404707){const _0x16d7c2=a34_0x5590b2,{options:_0x355c9e,args:_0x5b6f83}=_0x404707;console[_0x16d7c2(0x148)](a34_0x1929e1[_0x16d7c2(0x138)](_0x16d7c2(0xef)));let _0x2340da;if(_0x5b6f83[_0x16d7c2(0x10b)]>0x0&&_0x5b6f83[0x0]){const _0x34963f=_0x5b6f83[0x0][_0x16d7c2(0x100)](),_0x2ebaad=validateProfileName(_0x34963f);if(_0x2ebaad!==!![])return console[_0x16d7c2(0xdf)](a34_0x1929e1['red'](_0x2ebaad)),0x1;_0x2340da=_0x34963f;}else{const _0x20a8fb=await a34_0x30006e({'type':_0x16d7c2(0xf4),'name':_0x16d7c2(0xf6),'message':_0x16d7c2(0x121),'validate':validateProfileName});if(!_0x20a8fb[_0x16d7c2(0xf6)])return console[_0x16d7c2(0x148)](_0x16d7c2(0x101)),0x1;_0x2340da=_0x20a8fb[_0x16d7c2(0xf6)][_0x16d7c2(0x100)]();}const _0x1866ef=await a34_0x30006e({'type':'text','name':_0x16d7c2(0x135),'message':_0x16d7c2(0x12b)}),_0xb207e8=_0x1866ef[_0x16d7c2(0x135)]?.[_0x16d7c2(0x100)]()||undefined,_0x4094f8=_0x355c9e[_0x16d7c2(0x144)]||_0x16d7c2(0x118),_0x3e7b76=await promptSiteSelection(_0x4094f8,_0x2340da,'Setup\x20cancelled');if(!_0x3e7b76)return 0x1;const _0x2b5958=resolveSite(_0x3e7b76);if(isOAuthSupported(_0x2b5958)){const _0xf150c4=await a34_0x30006e({'type':_0x16d7c2(0xfa),'name':_0x16d7c2(0x114),'message':_0x16d7c2(0xe1),'choices':[{'title':_0x16d7c2(0x13b),'value':'oauth'},{'title':_0x16d7c2(0x104),'value':_0x16d7c2(0x137)}]});if(!_0xf150c4[_0x16d7c2(0x114)])return console[_0x16d7c2(0x148)](_0x16d7c2(0x101)),0x1;if(_0xf150c4[_0x16d7c2(0x114)]===_0x16d7c2(0xea)){if(_0xb207e8){const _0x5f5ba3={'site':_0x2b5958,'description':_0xb207e8};saveProfileToUserConfig(_0x2340da,_0x5f5ba3);}return await runOAuthLoginFlow(_0x2b5958,_0x2340da,_0x355c9e['logLevel']??LogLevel[_0x16d7c2(0x10d)]),0x0;}}console[_0x16d7c2(0x148)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x2b5958),console[_0x16d7c2(0x148)](_0x16d7c2(0xd5)),console[_0x16d7c2(0x148)]('\x20\x20'+getConsoleUrl(_0x2b5958,_0x16d7c2(0x141)));const _0x5f0421=await a34_0x30006e({'type':_0x16d7c2(0xd6),'name':_0x16d7c2(0xf8),'message':_0x16d7c2(0xe2),'validate':_0x346850=>{const _0x51a1bb=_0x16d7c2;if(!_0x346850||!_0x346850['trim']())return _0x51a1bb(0xf9);return!![];}});if(!_0x5f0421[_0x16d7c2(0xf8)])return console['log'](_0x16d7c2(0x101)),0x1;const _0xbbd3d2=_0x5f0421[_0x16d7c2(0xf8)];console[_0x16d7c2(0x148)](_0x16d7c2(0x11a));try{const _0xac09a1=TDX[_0x16d7c2(0x146)]({'site':_0x2b5958,'apiKey':_0xbbd3d2['trim'](),'logLevel':_0x355c9e[_0x16d7c2(0x106)]??LogLevel[_0x16d7c2(0x10d)]}),_0x24cedb=await _0xac09a1[_0x16d7c2(0xe4)][_0x16d7c2(0x107)]();console[_0x16d7c2(0x148)](a34_0x1929e1[_0x16d7c2(0x13f)]('✓')+_0x16d7c2(0x110)+_0x24cedb[_0x16d7c2(0x11d)]+')');const _0x266592=await isKeychainAvailable();_0x266592?(await saveAPIKeyAsync(_0xbbd3d2['trim'](),_0x2b5958,_0x2340da),console[_0x16d7c2(0x148)](a34_0x1929e1[_0x16d7c2(0x13f)]('✓')+_0x16d7c2(0x132)+_0x2340da+')')):(console[_0x16d7c2(0x102)](a34_0x1929e1[_0x16d7c2(0x13d)](_0x16d7c2(0xec))),console[_0x16d7c2(0x102)](a34_0x1929e1[_0x16d7c2(0x13d)](_0x16d7c2(0xf7))));const _0xa2d6b2={'site':_0x2b5958,..._0xb207e8&&{'description':_0xb207e8}};return saveProfileToUserConfig(_0x2340da,_0xa2d6b2),console['log'](a34_0x1929e1[_0x16d7c2(0x13f)]('✓')+_0x16d7c2(0xdc)+_0x2340da+_0x16d7c2(0xe0)),console[_0x16d7c2(0x148)](),console[_0x16d7c2(0x148)](_0x16d7c2(0x12c)),console[_0x16d7c2(0x148)]('\x20\x20tdx\x20--profile\x20'+_0x2340da+_0x16d7c2(0xff)),console[_0x16d7c2(0x148)](_0x16d7c2(0xee)+_0x2340da+_0x16d7c2(0xde)),0x0;}catch(_0x4c7918){if(_0x4c7918 instanceof HTTPClientError&&_0x4c7918[_0x16d7c2(0xfc)]===0x191)return printAuthError(_0x4c7918),0x1;return console['error'](a34_0x1929e1[_0x16d7c2(0x139)](_0x16d7c2(0xfb)+(_0x4c7918 instanceof Error?_0x4c7918[_0x16d7c2(0xe9)]:String(_0x4c7918)))),console['error'](_0x16d7c2(0x105)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a34_0x5590b2(0x111)]=a34_0x5590b2(0x12a);['description']='Remove\x20a\x20profile';[a34_0x5590b2(0xf2)](_0x4546f1){const {args:_0xc41f6c}=_0x4546f1;if(_0xc41f6c['length']===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async[a34_0x5590b2(0x120)](_0x5e7dd3){const _0x129c9a=a34_0x5590b2,{args:_0x845679}=_0x5e7dd3,_0x306b4c=_0x845679[0x0];console[_0x129c9a(0x148)](a34_0x1929e1[_0x129c9a(0x138)](_0x129c9a(0x130)));if(!profileExists(_0x306b4c)){console[_0x129c9a(0xdf)](a34_0x1929e1[_0x129c9a(0x139)](_0x129c9a(0x122)+_0x306b4c+'\x27\x20does\x20not\x20exist.')),console['log'](_0x129c9a(0xdb));const _0x4f7206=listProfiles();if(_0x4f7206['length']===0x0)console[_0x129c9a(0x148)](_0x129c9a(0x11b));else for(const _0xccb2ac of _0x4f7206){console[_0x129c9a(0x148)](_0x129c9a(0x11c)+_0xccb2ac[_0x129c9a(0x111)]);}return 0x1;}const _0x4cd627=await a34_0x30006e({'type':_0x129c9a(0xd9),'name':_0x129c9a(0xd9),'message':_0x129c9a(0x142)+_0x306b4c+'\x27?','initial':![]});if(!_0x4cd627[_0x129c9a(0xd9)])return console[_0x129c9a(0x148)](_0x129c9a(0x10f)),0x0;try{removeProfileFromUserConfig(_0x306b4c),console[_0x129c9a(0x148)](a34_0x1929e1['green']('✓')+_0x129c9a(0xdc)+_0x306b4c+_0x129c9a(0x126));}catch(_0x43c2e5){return console[_0x129c9a(0xdf)](a34_0x1929e1[_0x129c9a(0x139)](_0x129c9a(0x13c)+(_0x43c2e5 instanceof Error?_0x43c2e5[_0x129c9a(0xe9)]:String(_0x43c2e5)))),0x1;}const _0x3e6ea2=await isKeychainAvailable();if(_0x3e6ea2){const _0x822bb=await deleteKeychainAPIKey(_0x306b4c);_0x822bb&&console[_0x129c9a(0x148)](a34_0x1929e1[_0x129c9a(0x13f)]('✓')+_0x129c9a(0x13e));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a34_0x5590b2(0x111)]=a34_0x5590b2(0x11f);[a34_0x5590b2(0x135)]='Set\x20a\x20profile\x20configuration\x20value';static [a34_0x5590b2(0xe7)]=[a34_0x5590b2(0x144),'database',a34_0x5590b2(0xd7),a34_0x5590b2(0x125),'llm_agent',a34_0x5590b2(0x135)];[a34_0x5590b2(0xf2)](_0x27d08f){const _0x4c93f0=a34_0x5590b2,{args:_0xef271b,options:_0x3c03b1}=_0x27d08f,_0x4e575e=_0x3c03b1[_0x4c93f0(0x145)]||getActiveProfile();if(!_0x4e575e)return _0x4c93f0(0xed);if(_0xef271b[_0x4c93f0(0x10b)]===0x0)return _0x4c93f0(0x12e)+ProfileSetCommand[_0x4c93f0(0xe7)][_0x4c93f0(0x13a)](',\x20');const _0x3b95b0=_0xef271b[0x0];if(!_0x3b95b0['includes']('='))return _0x4c93f0(0x12d)+ProfileSetCommand['VALID_KEYS'][_0x4c93f0(0x13a)](',\x20');const [_0x53c66b]=_0x3b95b0['split']('=',0x2);if(!ProfileSetCommand[_0x4c93f0(0xe7)][_0x4c93f0(0x129)](_0x53c66b))return _0x4c93f0(0x11e)+_0x53c66b+_0x4c93f0(0x127)+ProfileSetCommand[_0x4c93f0(0xe7)][_0x4c93f0(0x13a)](',\x20');return undefined;}async[a34_0x5590b2(0x120)](_0x1c9580){const _0x2c2573=a34_0x5590b2,{args:_0x11dc01,options:_0x2d69eb}=_0x1c9580,_0xc1ccd4=_0x2d69eb['profile']||getActiveProfile(),[_0x880850,..._0x1dea69]=_0x11dc01[0x0][_0x2c2573(0xd8)]('='),_0x1e4fd8=_0x1dea69[_0x2c2573(0x13a)]('=');console[_0x2c2573(0x148)](a34_0x1929e1['bold'](_0x2c2573(0xd3)));if(!profileExists(_0xc1ccd4)){const _0x9740c1=await a34_0x30006e({'type':'confirm','name':_0x2c2573(0x146),'message':_0x2c2573(0x122)+_0xc1ccd4+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x9740c1[_0x2c2573(0x146)])return console['log'](_0x2c2573(0x133)),0x1;}const _0x34e841=loadProfile(_0xc1ccd4),_0x53258f=_0x34e841?.[_0x2c2573(0x109)]||{};if(_0x880850==='site'){const _0x288eb6=resolveSite(_0x1e4fd8);console[_0x2c2573(0x148)](_0x2c2573(0x116)+_0x288eb6+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x2c2573(0x148)](_0x2c2573(0xf3)),console[_0x2c2573(0x148)]('\x20\x20'+getConsoleUrl(_0x288eb6,'/app/mp/ak'));const _0x4024a6=await a34_0x30006e({'type':_0x2c2573(0xd6),'name':_0x2c2573(0xf8),'message':_0x2c2573(0x136),'validate':_0x4f9c66=>{const _0xa62b72=_0x2c2573;if(!_0x4f9c66||!_0x4f9c66[_0xa62b72(0x100)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x4024a6['apiKey'])return console[_0x2c2573(0x148)](_0x2c2573(0xeb)),0x1;console[_0x2c2573(0x148)](_0x2c2573(0x11a));try{const _0x249f49=TDX[_0x2c2573(0x146)]({'site':_0x288eb6,'apiKey':_0x4024a6[_0x2c2573(0xf8)]['trim'](),'logLevel':_0x2d69eb['logLevel']??LogLevel[_0x2c2573(0x10d)]}),_0x2628a9=await _0x249f49[_0x2c2573(0xe4)][_0x2c2573(0x107)]();console[_0x2c2573(0x148)](a34_0x1929e1[_0x2c2573(0x13f)]('✓')+_0x2c2573(0x110)+_0x2628a9[_0x2c2573(0x11d)]+')');const _0x4af992=await isKeychainAvailable();_0x4af992?(await saveAPIKeyAsync(_0x4024a6[_0x2c2573(0xf8)][_0x2c2573(0x100)](),_0x288eb6,_0xc1ccd4),console[_0x2c2573(0x148)](a34_0x1929e1[_0x2c2573(0x13f)]('✓')+_0x2c2573(0x131))):console['warn'](a34_0x1929e1[_0x2c2573(0x13d)](_0x2c2573(0xec))),_0x53258f[_0x2c2573(0x144)]=_0x288eb6;}catch(_0x2e7e12){if(_0x2e7e12 instanceof HTTPClientError&&_0x2e7e12[_0x2c2573(0xfc)]===0x191)return printAuthError(_0x2e7e12),0x1;return console['error'](a34_0x1929e1[_0x2c2573(0x139)]('✗\x20Validation\x20failed:\x20'+(_0x2e7e12 instanceof Error?_0x2e7e12[_0x2c2573(0xe9)]:String(_0x2e7e12)))),console[_0x2c2573(0xdf)](_0x2c2573(0xfd)),0x1;}}else _0x53258f[_0x880850]=_0x1e4fd8||undefined;return saveProfileToUserConfig(_0xc1ccd4,_0x53258f),console[_0x2c2573(0x148)](a34_0x1929e1['green']('✓')+'\x20Profile\x20\x27'+_0xc1ccd4+_0x2c2573(0x143)+_0x880850+'='+(_0x1e4fd8||_0x2c2573(0x123))),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']='profile:use';[a34_0x5590b2(0x135)]='Set\x20session\x20profile';['validate'](_0x731f40){const _0x25999a=a34_0x5590b2,{args:_0x2e67ac}=_0x731f40;if(_0x2e67ac[_0x25999a(0x10b)]===0x0)return _0x25999a(0x128);return undefined;}async[a34_0x5590b2(0x120)](_0x33ad74){const _0x353567=a34_0x5590b2,{args:_0x479fd6,options:_0x562c86}=_0x33ad74,_0x233987=_0x479fd6[0x0],_0x14aca6=_0x562c86[_0x353567(0xdd)];cleanExpiredSessions();if(!profileExists(_0x233987)){console[_0x353567(0xdf)](a34_0x1929e1[_0x353567(0x139)](_0x353567(0x122)+_0x233987+_0x353567(0xda))),console['log'](_0x353567(0xdb));const _0xce8901=listProfiles();if(_0xce8901['length']===0x0)console[_0x353567(0x148)]('\x20\x20(no\x20profiles\x20found)');else for(const _0xf17740 of _0xce8901){console['log'](_0x353567(0x11c)+_0xf17740[_0x353567(0x111)]);}return 0x1;}if(_0x14aca6){const _0xd320e2=a34_0x5c3015[_0x353567(0x13a)](getConfigDir(),_0x353567(0xe3));return saveActiveProfileToUserConfig(_0x233987),console[_0x353567(0x148)](_0x353567(0xe8)+a34_0x1929e1[_0x353567(0x13f)](_0x233987)),console['log'](a34_0x1929e1[_0x353567(0x119)](_0x353567(0x112)+_0xd320e2)),0x0;}const _0x12342a=getSessionID(_0x562c86[_0x353567(0x103)]);return saveSessionContext({'profile':_0x233987},_0x562c86[_0x353567(0x103)]),console['log'](_0x353567(0xe6)+a34_0x1929e1[_0x353567(0x13f)](_0x233987)+'\x20'+a34_0x1929e1[_0x353567(0x119)]('(session:\x20'+_0x12342a+')')),console['log'](a34_0x1929e1[_0x353567(0x119)](_0x353567(0xfe)+_0x233987+_0x353567(0x124))),0x0;}}function a34_0x5c35(){const _0x278883=['\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Operation\x20cancelled','1108638ZCbuae','description','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','apikey','bold','red','join','OAuth\x20(browser\x20login)','Failed\x20to\x20remove\x20profile:\x20','yellow','\x20API\x20key\x20removed\x20from\x20system\x20keychain','green','8563792MSZKlc','/app/mp/ak','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x27\x20updated:\x20','site','profile','create','2018970IDqbZq','log','tdx:\x20profile\x20set','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','You\x20can\x20find\x20your\x20API\x20key\x20at:','password','parent_segment','split','confirm','\x27\x20does\x20not\x20exist.','\x0aAvailable\x20profiles:','\x20Profile\x20\x27','default','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','error','\x27\x20created','Choose\x20authentication\x20method:','Enter\x20your\x20TD\x20API\x20key:','tdx.json','jobs','262660EYXrnS','Session\x20profile\x20set\x20to:\x20','VALID_KEYS','Default\x20profile\x20set\x20to:\x20','message','oauth','\x0aOperation\x20cancelled','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','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>','\x20\x20tdx\x20--profile\x20','tdx:\x20profile\x20create','675CpEQtQ','982400uSEUWt','validate','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','text','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','profileName','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','apiKey','API\x20key\x20cannot\x20be\x20empty','select','✗\x20Validation\x20failed:\x20','status','Site\x20was\x20not\x20changed.','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','trim','\x0aSetup\x20cancelled','warn','session','API\x20Key','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','logLevel','getUserInfo','profile:create','config','Create\x20a\x20new\x20profile','length','6PtvslL','ERROR','test','Removal\x20cancelled','\x20API\x20key\x20is\x20valid\x20(User:\x20','name','\x0aSaved\x20to:\x20','108LBEWjc','method','Profile\x20name\x20cannot\x20be\x20empty','Changing\x20site\x20to\x20\x27','192226xNKGBm','us01','dim','Validating\x20API\x20key...','\x20\x20(no\x20profiles\x20found)','\x20\x20-\x20','email','Unknown\x20key\x20\x27','profile:set','execute','Enter\x20profile\x20name:','Profile\x20\x27','(cleared)','\x20--default\x27\x20to\x20save\x20permanently','llm_project','\x27\x20removed\x20from\x20configuration','\x27.\x0a\x0aValid\x20keys:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','includes','profile:remove','Enter\x20description\x20(optional):','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','103019ebkdAu','tdx:\x20profile\x20remove','\x20API\x20key\x20saved\x20to\x20system\x20keychain'];a34_0x5c35=function(){return _0x278883;};return a34_0x5c35();}
@@ -1 +1 @@
1
- const a35_0x3a6536=a35_0x50ee;(function(_0x22ee1e,_0x3544f5){const _0x18e3cc=a35_0x50ee,_0x1f2066=_0x22ee1e();while(!![]){try{const _0x2d13ea=parseInt(_0x18e3cc(0x1ba))/0x1+-parseInt(_0x18e3cc(0x1b0))/0x2+-parseInt(_0x18e3cc(0x1be))/0x3+-parseInt(_0x18e3cc(0x1aa))/0x4*(parseInt(_0x18e3cc(0x1af))/0x5)+parseInt(_0x18e3cc(0x1a9))/0x6+-parseInt(_0x18e3cc(0x1ad))/0x7*(parseInt(_0x18e3cc(0x1ae))/0x8)+-parseInt(_0x18e3cc(0x1bb))/0x9*(-parseInt(_0x18e3cc(0x1b9))/0xa);if(_0x2d13ea===_0x3544f5)break;else _0x1f2066['push'](_0x1f2066['shift']());}catch(_0x1ed75b){_0x1f2066['push'](_0x1f2066['shift']());}}}(a35_0xd97a,0x58741));import{BaseCommand}from'./command.js';function a35_0x50ee(_0x470d93,_0x516a9c){_0x470d93=_0x470d93-0x1a6;const _0xd97a80=a35_0xd97a();let _0x50eef7=_0xd97a80[_0x470d93];return _0x50eef7;}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a35_0xd97a(){const _0x5a554d=['name','List\x20all\x20available\x20profiles','dim','450870xIGeKf','5284UxFEYn','config','green','21TUNKvP','668136VZndUT','85IJMwpg','46062rwXXNT','map','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','profiles','site','message','error','log','👤\x20','30wQssop','298651rEAYeF','1602963fubjFO','\x20\x20Global:\x20~/.config/tdx/tdx.json','execute','749319aYpvEC','description','length'];a35_0xd97a=function(){return _0x5a554d;};return a35_0xd97a();}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a35_0x1b7af0 from'chalk';export class ProfilesCommand extends BaseCommand{[a35_0x3a6536(0x1a6)]=a35_0x3a6536(0x1b3);[a35_0x3a6536(0x1bf)]=a35_0x3a6536(0x1a7);async[a35_0x3a6536(0x1bd)](_0x25a4e9){const _0x20fb68=a35_0x3a6536,{options:_0x1095a4}=_0x25a4e9;try{const _0x367993=listProfiles(),_0x39dd3e=getActiveProfile();if(_0x367993[_0x20fb68(0x1c0)]===0x0)return console[_0x20fb68(0x1b7)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console[_0x20fb68(0x1b7)](_0x20fb68(0x1b2)),console[_0x20fb68(0x1b7)](_0x20fb68(0x1bc)),0x0;const _0x49731e=_0x367993[_0x20fb68(0x1b1)](_0x14d578=>{const _0x140f3e=_0x20fb68,_0x3cf3cd=_0x14d578['name']===_0x39dd3e,_0x745e51=getProfileParams(_0x14d578['config']);return{'name':_0x14d578[_0x140f3e(0x1a6)],'active':_0x3cf3cd,'scope':_0x14d578['scope'],'description':_0x14d578[_0x140f3e(0x1ab)]['description']||'','params':_0x745e51};});if(isStructuredFormat(_0x1095a4))await handleSDKOutput(_0x49731e,_0x1095a4);else for(const _0x42c09e of _0x367993){const _0x31c41=_0x42c09e[_0x20fb68(0x1a6)]===_0x39dd3e?a35_0x1b7af0[_0x20fb68(0x1ac)]('\x20✓'):'',_0x4fd40a=_0x42c09e[_0x20fb68(0x1ab)][_0x20fb68(0x1b4)]?a35_0x1b7af0[_0x20fb68(0x1a8)]('\x20'+_0x42c09e[_0x20fb68(0x1ab)][_0x20fb68(0x1b4)]):'',_0x593ab3=_0x42c09e['config']['description']?a35_0x1b7af0[_0x20fb68(0x1a8)]('\x20\x20'+_0x42c09e['config'][_0x20fb68(0x1bf)]):'';console['log'](_0x20fb68(0x1b8)+_0x42c09e[_0x20fb68(0x1a6)]+_0x31c41+_0x4fd40a+_0x593ab3);}return 0x0;}catch(_0x4eaff3){return _0x4eaff3 instanceof Error&&console[_0x20fb68(0x1b6)]('Error:\x20'+_0x4eaff3[_0x20fb68(0x1b5)]),0x1;}}}
1
+ const a35_0x1d20fb=a35_0x5afb;function a35_0x5afb(_0x668ce3,_0x552a44){_0x668ce3=_0x668ce3-0x1cf;const _0x2ea188=a35_0x2ea1();let _0x5afb27=_0x2ea188[_0x668ce3];return _0x5afb27;}(function(_0x48d2f0,_0x23ffc3){const _0x49d125=a35_0x5afb,_0x58fd97=_0x48d2f0();while(!![]){try{const _0x5b804d=parseInt(_0x49d125(0x1df))/0x1+-parseInt(_0x49d125(0x1d6))/0x2*(-parseInt(_0x49d125(0x1e0))/0x3)+-parseInt(_0x49d125(0x1d1))/0x4+-parseInt(_0x49d125(0x1eb))/0x5*(-parseInt(_0x49d125(0x1e6))/0x6)+parseInt(_0x49d125(0x1e8))/0x7+parseInt(_0x49d125(0x1d9))/0x8*(-parseInt(_0x49d125(0x1e7))/0x9)+parseInt(_0x49d125(0x1db))/0xa*(-parseInt(_0x49d125(0x1d3))/0xb);if(_0x5b804d===_0x23ffc3)break;else _0x58fd97['push'](_0x58fd97['shift']());}catch(_0x357cdd){_0x58fd97['push'](_0x58fd97['shift']());}}}(a35_0x2ea1,0xd0853));import{BaseCommand}from'./command.js';function a35_0x2ea1(){const _0x3bfbaa=['\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','1688546ozKdHU','3YVVxLD','profiles','log','error','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','👤\x20','1668YNbDVP','279rwkEkn','154112pKSawb','Error:\x20','length','28360jssLBx','map','name','6625428vcEqBM','config','2428646kGaYUP','List\x20all\x20available\x20profiles','message','2931044GYvJwl','execute','scope','179856zXAraE','description','70GdjKvu','dim','\x20\x20Global:\x20~/.config/tdx/tdx.json'];a35_0x2ea1=function(){return _0x3bfbaa;};return a35_0x2ea1();}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a35_0x4fa582 from'chalk';export class ProfilesCommand extends BaseCommand{[a35_0x1d20fb(0x1d0)]=a35_0x1d20fb(0x1e1);[a35_0x1d20fb(0x1da)]=a35_0x1d20fb(0x1d4);async[a35_0x1d20fb(0x1d7)](_0x3a2571){const _0x550bf4=a35_0x1d20fb,{options:_0xc4a2c5}=_0x3a2571;try{const _0x49c513=listProfiles(),_0x1f55a6=getActiveProfile();if(_0x49c513[_0x550bf4(0x1ea)]===0x0)return console[_0x550bf4(0x1e2)](_0x550bf4(0x1e4)),console[_0x550bf4(0x1e2)](_0x550bf4(0x1de)),console[_0x550bf4(0x1e2)](_0x550bf4(0x1dd)),0x0;const _0x463eff=_0x49c513[_0x550bf4(0x1cf)](_0x41b51f=>{const _0x507f94=_0x550bf4,_0x5078b1=_0x41b51f[_0x507f94(0x1d0)]===_0x1f55a6,_0x76a82a=getProfileParams(_0x41b51f[_0x507f94(0x1d2)]);return{'name':_0x41b51f[_0x507f94(0x1d0)],'active':_0x5078b1,'scope':_0x41b51f[_0x507f94(0x1d8)],'description':_0x41b51f[_0x507f94(0x1d2)][_0x507f94(0x1da)]||'','params':_0x76a82a};});if(isStructuredFormat(_0xc4a2c5))await handleSDKOutput(_0x463eff,_0xc4a2c5);else for(const _0x2f0c97 of _0x49c513){const _0x317533=_0x2f0c97[_0x550bf4(0x1d0)]===_0x1f55a6?a35_0x4fa582['green']('\x20✓'):'',_0x3d2759=_0x2f0c97[_0x550bf4(0x1d2)]['site']?a35_0x4fa582[_0x550bf4(0x1dc)]('\x20'+_0x2f0c97[_0x550bf4(0x1d2)]['site']):'',_0x1ec64c=_0x2f0c97[_0x550bf4(0x1d2)][_0x550bf4(0x1da)]?a35_0x4fa582[_0x550bf4(0x1dc)]('\x20\x20'+_0x2f0c97[_0x550bf4(0x1d2)][_0x550bf4(0x1da)]):'';console['log'](_0x550bf4(0x1e5)+_0x2f0c97[_0x550bf4(0x1d0)]+_0x317533+_0x3d2759+_0x1ec64c);}return 0x0;}catch(_0x3cb723){return _0x3cb723 instanceof Error&&console[_0x550bf4(0x1e3)](_0x550bf4(0x1e9)+_0x3cb723[_0x550bf4(0x1d5)]),0x1;}}}
@@ -1 +1 @@
1
- const a36_0x529acc=a36_0x263c;(function(_0x53ecc6,_0x252d6c){const _0x2b682f=a36_0x263c,_0x583b66=_0x53ecc6();while(!![]){try{const _0x56e1cb=parseInt(_0x2b682f(0x9b))/0x1+-parseInt(_0x2b682f(0x9d))/0x2*(-parseInt(_0x2b682f(0x9a))/0x3)+parseInt(_0x2b682f(0xae))/0x4*(parseInt(_0x2b682f(0xab))/0x5)+-parseInt(_0x2b682f(0x97))/0x6*(-parseInt(_0x2b682f(0xbe))/0x7)+-parseInt(_0x2b682f(0x92))/0x8+parseInt(_0x2b682f(0x95))/0x9*(-parseInt(_0x2b682f(0xb8))/0xa)+-parseInt(_0x2b682f(0xc1))/0xb;if(_0x56e1cb===_0x252d6c)break;else _0x583b66['push'](_0x583b66['shift']());}catch(_0x1d98d6){_0x583b66['push'](_0x583b66['shift']());}}}(a36_0x1279,0x68444));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a36_0x263c(_0x55ff5f,_0x375689){_0x55ff5f=_0x55ff5f-0x91;const _0x127986=a36_0x1279();let _0x263c80=_0x127986[_0x55ff5f];return _0x263c80;}import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';function a36_0x1279(){const _0x3da597=['SQL:\x20','306GFeIEQ','621894NNZEJv','stats','7024atQwpb','setPhase','validate','...','message','\x20splits','name','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','Query\x20completed:\x20Processed\x20','catalog','processedRows','execute','state','options','447815sosBHm','\x0aAll\x20results\x20saved\x20to\x20','output','4EGolQT','\x20[Job\x20ID:\x20','verbose','setJobId','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','error','elapsedTimeMillis','jobId','push','Executing\x20query...','6700izxGJE','totalSplits','length','\x20rows\x20','file','Executing\x20query\x20[','1931699Qqyjyz','Schema:\x20','data','28039prNDUR','No\x20SQL\x20provided','Run\x20Trino\x20queries\x20(streaming)','Statement\x20','query','\x20-\x20','in\x20','Catalog:\x20','6459784aXpqiG','Site:\x20','database','1458KmPpeA','args','6nSdvWp','site'];a36_0x1279=function(){return _0x3da597;};return a36_0x1279();}import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a36_0x529acc(0xa3)]=a36_0x529acc(0xc5);['description']=a36_0x529acc(0xc3);async[a36_0x529acc(0xa8)](_0x575650){const _0xd2392c=a36_0x529acc,{options:_0x5c450a,args:_0x82cf98,tdx:_0x25c28e}=_0x575650,_0x200101={..._0x5c450a,'limitStructuredFormats':!![]},_0x5805aa=_0x82cf98[0x0],_0x599b8b=_0x5c450a['file'];let _0x3384cc;try{if(_0x599b8b)_0x3384cc=readSqlStatementsFromFile(_0x599b8b);else{if(_0x5805aa==='-')_0x3384cc=await readSqlStatementsFromStdin();else{if(_0x5805aa&&isSqlFilePath(_0x5805aa))_0x3384cc=readSqlStatementsFromFile(_0x5805aa);else{if(_0x5805aa)_0x3384cc=splitSqlStatements(_0x5805aa);else throw new Error(_0xd2392c(0xc2));}}}}catch(_0x57722a){return console['error']('Error:\x20'+_0x57722a[_0xd2392c(0xa1)]),0x1;}const _0x11abd5=_0x5c450a[_0xd2392c(0x94)]||'information_schema',_0x144ad2=_0x5c450a[_0xd2392c(0xa6)];try{const _0x282220=[],_0x170e41=!!_0x5c450a['output'];for(let _0x419e70=0x0;_0x419e70<_0x3384cc['length'];_0x419e70++){const _0x2d8ed1=_0x3384cc[_0x419e70],_0x29b8cd=_0x419e70+0x1,_0x136c84=_0x3384cc['length'],_0x448f5e=_0x136c84>0x1;_0x5c450a[_0xd2392c(0xb0)]&&(console[_0xd2392c(0xb3)]('\x0a'+(_0x448f5e?'Statement\x20'+_0x29b8cd+'/'+_0x136c84+':':'')),console[_0xd2392c(0xb3)](_0xd2392c(0x93)+_0x5c450a[_0xd2392c(0x98)]),console['error'](_0xd2392c(0x91)+(_0x144ad2||'td')),console['error'](_0xd2392c(0xbf)+_0x11abd5),console[_0xd2392c(0xb3)](_0xd2392c(0x99)+_0x2d8ed1));const _0x36b3c5=_0x448f5e?'Executing\x20statement\x20'+_0x29b8cd+'/'+_0x136c84+_0xd2392c(0xa0):_0xd2392c(0xb7);try{const _0xe0d286=await withProgressSpinner(_0x36b3c5,async _0x270af1=>{const _0x18b37e=await _0x25c28e['query']['execute'](_0x2d8ed1,{'catalog':_0x144ad2,'schema':_0x11abd5,'onJobId':_0x34563b=>{const _0x4d81fe=a36_0x263c;_0x270af1[_0x4d81fe(0xb1)](_0x34563b);},'onProgress':_0x55cbbb=>{const _0x3aa0fe=a36_0x263c;_0x270af1[_0x3aa0fe(0x9e)](_0x3aa0fe(0xbd)+_0x55cbbb[_0x3aa0fe(0xa9)]+']'),_0x270af1['setExtra'](formatRows(_0x55cbbb[_0x3aa0fe(0xa7)])+'\x20rows\x20'+_0x55cbbb['completedSplits']+'/'+_0x55cbbb[_0x3aa0fe(0xb9)]+_0x3aa0fe(0xa2));}});return _0x18b37e;},{'verbose':_0x5c450a[_0xd2392c(0xb0)]}),_0x17aa63=_0xe0d286[_0xd2392c(0xc0)],_0x169371=_0x17aa63['jobId']?_0xd2392c(0xaf)+_0x17aa63[_0xd2392c(0xb5)]+']':'',_0x1abe79=_0x448f5e?_0xd2392c(0xc4)+_0x29b8cd+'/'+_0x136c84+_0xd2392c(0xc6):'';console[_0xd2392c(0xb3)]('✔\x20'+_0x1abe79+_0xd2392c(0xa5)+formatRows(_0x17aa63[_0xd2392c(0x9c)][_0xd2392c(0xa7)])+_0xd2392c(0xbb)+(_0xd2392c(0xc7)+formatElapsed(_0x17aa63[_0xd2392c(0x9c)][_0xd2392c(0xb4)])+_0x169371));if(_0x448f5e&&_0x170e41){const _0x38cf42=resolveOutputOptions(_0x200101),_0x380d19=await formatQueryOutput(_0x17aa63,_0x38cf42);_0x282220[_0xd2392c(0xb6)](_0x380d19);}else await handleQueryOutput(_0x17aa63,_0x200101);}catch(_0x2f90de){const _0x1eaa59=_0x448f5e?_0xd2392c(0xc4)+_0x29b8cd+'/'+_0x136c84+':\x0a':'',_0x27aae4=_0x2f90de instanceof SDKError?_0x2f90de['originalMessage']:_0x2f90de['message'];return console['error'](''+_0x1eaa59+_0x27aae4),0x1;}}if(_0x3384cc[_0xd2392c(0xba)]>0x1&&_0x170e41&&_0x282220[_0xd2392c(0xba)]>0x0){const _0x37db6b=_0x282220['join']('\x0a');writeFileSync(_0x5c450a[_0xd2392c(0xad)],_0x37db6b),console[_0xd2392c(0xb3)](_0xd2392c(0xac)+_0x5c450a[_0xd2392c(0xad)]);}return 0x0;}catch(_0x313d37){throw _0x313d37;}}[a36_0x529acc(0x9f)](_0x58d266){const _0x257611=a36_0x529acc,_0x410f71=_0x58d266[_0x257611(0x96)][0x0],_0x3c8bd2=_0x58d266[_0x257611(0xaa)][_0x257611(0xbc)];if(!_0x410f71&&!_0x3c8bd2)return _0x257611(0xb2);if(_0x410f71&&_0x3c8bd2)return _0x257611(0xa4);return undefined;}}
1
+ function a36_0x6cb0(_0x1689bc,_0x53c112){_0x1689bc=_0x1689bc-0x15f;const _0x186f37=a36_0x186f();let _0x6cb01c=_0x186f37[_0x1689bc];return _0x6cb01c;}const a36_0x5930ae=a36_0x6cb0;(function(_0x37022d,_0x32ea2d){const _0x2f8587=a36_0x6cb0,_0x167e0d=_0x37022d();while(!![]){try{const _0x268f4a=parseInt(_0x2f8587(0x16c))/0x1+-parseInt(_0x2f8587(0x172))/0x2*(parseInt(_0x2f8587(0x191))/0x3)+-parseInt(_0x2f8587(0x16f))/0x4*(parseInt(_0x2f8587(0x166))/0x5)+parseInt(_0x2f8587(0x163))/0x6+parseInt(_0x2f8587(0x164))/0x7*(-parseInt(_0x2f8587(0x16d))/0x8)+parseInt(_0x2f8587(0x17b))/0x9*(parseInt(_0x2f8587(0x16b))/0xa)+-parseInt(_0x2f8587(0x17e))/0xb;if(_0x268f4a===_0x32ea2d)break;else _0x167e0d['push'](_0x167e0d['shift']());}catch(_0x532d58){_0x167e0d['push'](_0x167e0d['shift']());}}}(a36_0x186f,0x56deb));function a36_0x186f(){const _0xa44d83=['site','\x0aAll\x20results\x20saved\x20to\x20','Run\x20Trino\x20queries\x20(streaming)','Executing\x20statement\x20','message','...','database','error','data','validate','Executing\x20query...','3yKBoOF','output','Catalog:\x20','state','Schema:\x20','description','execute','originalMessage','3694566psXumN','7XcGlvd','catalog','55CEQOBb','setPhase','name','verbose','options','8660xfZKus','572104cSagii','2270176PxFxMk','push','113992vYEatm','stats','query','188628eUMnNY','No\x20SQL\x20provided','elapsedTimeMillis','\x20[Job\x20ID:\x20','processedRows','\x20splits','Statement\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','\x20rows\x20','5355SqSSPz','\x20-\x20','Site:\x20','7213272mzwxia','file','length','jobId','completedSplits','args','setJobId','totalSplits'];a36_0x186f=function(){return _0xa44d83;};return a36_0x186f();}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a36_0x5930ae(0x168)]=a36_0x5930ae(0x171);[a36_0x5930ae(0x160)]=a36_0x5930ae(0x188);async[a36_0x5930ae(0x161)](_0x511aaf){const _0x87359b=a36_0x5930ae,{options:_0x53f137,args:_0x6df0c1,tdx:_0x1b1b78}=_0x511aaf,_0x1144e4={..._0x53f137,'limitStructuredFormats':!![]},_0x1fc23c=_0x6df0c1[0x0],_0x3f9bf9=_0x53f137[_0x87359b(0x17f)];let _0x1a096e;try{if(_0x3f9bf9)_0x1a096e=readSqlStatementsFromFile(_0x3f9bf9);else{if(_0x1fc23c==='-')_0x1a096e=await readSqlStatementsFromStdin();else{if(_0x1fc23c&&isSqlFilePath(_0x1fc23c))_0x1a096e=readSqlStatementsFromFile(_0x1fc23c);else{if(_0x1fc23c)_0x1a096e=splitSqlStatements(_0x1fc23c);else throw new Error(_0x87359b(0x173));}}}}catch(_0x53f243){return console[_0x87359b(0x18d)]('Error:\x20'+_0x53f243[_0x87359b(0x18a)]),0x1;}const _0x13275f=_0x53f137[_0x87359b(0x18c)]||'information_schema',_0x1ac792=_0x53f137[_0x87359b(0x165)];try{const _0x54d04e=[],_0x4a584c=!!_0x53f137[_0x87359b(0x192)];for(let _0x19d494=0x0;_0x19d494<_0x1a096e[_0x87359b(0x180)];_0x19d494++){const _0x134829=_0x1a096e[_0x19d494],_0x28b926=_0x19d494+0x1,_0x22487e=_0x1a096e[_0x87359b(0x180)],_0x40178e=_0x22487e>0x1;_0x53f137[_0x87359b(0x169)]&&(console['error']('\x0a'+(_0x40178e?'Statement\x20'+_0x28b926+'/'+_0x22487e+':':'')),console[_0x87359b(0x18d)](_0x87359b(0x17d)+_0x53f137[_0x87359b(0x186)]),console[_0x87359b(0x18d)](_0x87359b(0x193)+(_0x1ac792||'td')),console['error'](_0x87359b(0x15f)+_0x13275f),console[_0x87359b(0x18d)]('SQL:\x20'+_0x134829));const _0x4277e5=_0x40178e?_0x87359b(0x189)+_0x28b926+'/'+_0x22487e+_0x87359b(0x18b):_0x87359b(0x190);try{const _0x17662f=await withProgressSpinner(_0x4277e5,async _0x25b549=>{const _0x42e6b0=_0x87359b,_0x5f0914=await _0x1b1b78[_0x42e6b0(0x171)][_0x42e6b0(0x161)](_0x134829,{'catalog':_0x1ac792,'schema':_0x13275f,'onJobId':_0x3690e3=>{const _0x1b3607=_0x42e6b0;_0x25b549[_0x1b3607(0x184)](_0x3690e3);},'onProgress':_0x59d8a7=>{const _0x51a4cc=_0x42e6b0;_0x25b549[_0x51a4cc(0x167)]('Executing\x20query\x20['+_0x59d8a7[_0x51a4cc(0x194)]+']'),_0x25b549['setExtra'](formatRows(_0x59d8a7[_0x51a4cc(0x176)])+_0x51a4cc(0x17a)+_0x59d8a7[_0x51a4cc(0x182)]+'/'+_0x59d8a7[_0x51a4cc(0x185)]+_0x51a4cc(0x177));}});return _0x5f0914;},{'verbose':_0x53f137['verbose']}),_0x275872=_0x17662f[_0x87359b(0x18e)],_0x492cd0=_0x275872[_0x87359b(0x181)]?_0x87359b(0x175)+_0x275872[_0x87359b(0x181)]+']':'',_0x3c2809=_0x40178e?_0x87359b(0x178)+_0x28b926+'/'+_0x22487e+_0x87359b(0x17c):'';console['error']('✔\x20'+_0x3c2809+'Query\x20completed:\x20Processed\x20'+formatRows(_0x275872[_0x87359b(0x170)][_0x87359b(0x176)])+'\x20rows\x20'+('in\x20'+formatElapsed(_0x275872[_0x87359b(0x170)][_0x87359b(0x174)])+_0x492cd0));if(_0x40178e&&_0x4a584c){const _0x325da5=resolveOutputOptions(_0x1144e4),_0x2eb243=await formatQueryOutput(_0x275872,_0x325da5);_0x54d04e[_0x87359b(0x16e)](_0x2eb243);}else await handleQueryOutput(_0x275872,_0x1144e4);}catch(_0x134c39){const _0x22e8dd=_0x40178e?'Statement\x20'+_0x28b926+'/'+_0x22487e+':\x0a':'',_0x1d2865=_0x134c39 instanceof SDKError?_0x134c39[_0x87359b(0x162)]:_0x134c39[_0x87359b(0x18a)];return console[_0x87359b(0x18d)](''+_0x22e8dd+_0x1d2865),0x1;}}if(_0x1a096e['length']>0x1&&_0x4a584c&&_0x54d04e[_0x87359b(0x180)]>0x0){const _0x77cd01=_0x54d04e['join']('\x0a');writeFileSync(_0x53f137[_0x87359b(0x192)],_0x77cd01),console['error'](_0x87359b(0x187)+_0x53f137['output']);}return 0x0;}catch(_0x5f3fd5){throw _0x5f3fd5;}}[a36_0x5930ae(0x18f)](_0x41ce36){const _0x11392f=a36_0x5930ae,_0x219f1f=_0x41ce36[_0x11392f(0x183)][0x0],_0x2650f0=_0x41ce36[_0x11392f(0x16a)]['file'];if(!_0x219f1f&&!_0x2650f0)return'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';if(_0x219f1f&&_0x2650f0)return _0x11392f(0x179);return undefined;}}
@@ -1 +1 @@
1
- function a37_0x3673(_0xdb0ec9,_0x277d6f){_0xdb0ec9=_0xdb0ec9-0x6e;const _0x502ce9=a37_0x502c();let _0x367308=_0x502ce9[_0xdb0ec9];return _0x367308;}const a37_0x5d6834=a37_0x3673;(function(_0x3e6e82,_0xebaea2){const _0x4b0aaa=a37_0x3673,_0x570b2f=_0x3e6e82();while(!![]){try{const _0x33a1da=-parseInt(_0x4b0aaa(0x98))/0x1+-parseInt(_0x4b0aaa(0x71))/0x2*(-parseInt(_0x4b0aaa(0xe7))/0x3)+-parseInt(_0x4b0aaa(0xd9))/0x4*(-parseInt(_0x4b0aaa(0x86))/0x5)+parseInt(_0x4b0aaa(0xd7))/0x6+parseInt(_0x4b0aaa(0xdb))/0x7+-parseInt(_0x4b0aaa(0xd3))/0x8+-parseInt(_0x4b0aaa(0x8e))/0x9*(-parseInt(_0x4b0aaa(0x88))/0xa);if(_0x33a1da===_0xebaea2)break;else _0x570b2f['push'](_0x570b2f['shift']());}catch(_0x4cb962){_0x570b2f['push'](_0x570b2f['shift']());}}}(a37_0x502c,0x58b1f));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_0x34a420 from'chalk';function formatRelativeTime(_0x48a569){const _0x9d824d=a37_0x3673,_0x3c414a=new Date(_0x48a569),_0x5c16fa=new Date(),_0x21c4c6=_0x3c414a[_0x9d824d(0xc7)]()-_0x5c16fa['getTime'](),_0x4c0015=Math[_0x9d824d(0x92)](_0x21c4c6)/0x3e8,_0x5211fa=_0x21c4c6<0x0;if(_0x4c0015<0x3c)return _0x5211fa?_0x9d824d(0xbb):'soon';else{if(_0x4c0015<0xe10){const _0x4279b3=Math[_0x9d824d(0xb9)](_0x4c0015/0x3c);return _0x5211fa?_0x4279b3+'m\x20ago':_0x9d824d(0xa4)+_0x4279b3+'m';}else{if(_0x4c0015<0x15180){const _0x1b750b=Math[_0x9d824d(0xb9)](_0x4c0015/0xe10);return _0x5211fa?_0x1b750b+'h\x20ago':_0x9d824d(0xa4)+_0x1b750b+'h';}else{if(_0x4c0015<0x93a80){const _0x62b3a9=Math[_0x9d824d(0xb9)](_0x4c0015/0x15180);return _0x5211fa?_0x62b3a9+_0x9d824d(0xeb):_0x9d824d(0xa4)+_0x62b3a9+'d';}else return _0x3c414a[_0x9d824d(0xf0)]();}}}}function a37_0x502c(){const _0x10ebbf=['type','Found\x20','utf-8','d\x20ago','Delete\x20a\x20scheduled\x20query','schedule:run','execute','name','toLocaleDateString','user_name','priority','Schedule\x20run\x20submitted:\x20','\x20\x20Num:\x20','830sYFcza','success','Getting\x20schedule\x20details...','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','Updating\x20schedule...','schedule:show','Schedule\x20updated:\x20','updated_at','INVALID_ARGUMENT','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','json','start_at','Failed\x20to\x20read\x20file:\x20','lastRun','verbose','delay','Show\x20schedule\x20execution\x20history','queryUrl','\x20\x20Time:\x20','engine_version','database','344455RJsart','Cancelled','1028860PTkUqn','Getting\x20schedule\x20history...','retryLimit','num','data','\x20(showing\x20','18zBoudl','next_run_at','error','trim','abs','end_at','queries','\x20created','listQueries','List\x20scheduled\x20queries','480187yukooA','user','/app/queries/editor?queryId=','\x20execution','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','retry_limit','run','\x20\x20Job\x20ID:\x20','Creating\x20schedule:\x20','result','format','Create\x20a\x20scheduled\x20query','in\x20','\x22...','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','executing_user_id','schedules','create','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','Schedule\x20created:\x20','file','cron','Listing\x20scheduled\x20queries...','status','max','schedule:create','\x20matching\x20\x22','padEnd','ended_at','(unnamed)','Update\x20a\x20scheduled\x20query','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','output','round','trino','just\x20now','limit','Running\x20schedule...','pagination','schedule:list','validate','site','time','Query\x20file\x20is\x20empty','schedule:delete','map','args','getTime','statusIcon','scheduled_at','last_job','entries','...','engineVersion','job_id','yes','\x20\x20Cron:\x20','\x20\x20Timezone:\x20','count','3606704ajneth','show','history','\x20\x20Type:\x20','2446260MVxQGe','description','12mKMUax','created_at','1259510mpmBGE','dim','never','\x20scheduled\x20quer','Searching\x20scheduled\x20queries\x20matching\x20\x22','No\x20scheduled\x20queries\x20found','schedule:history','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','Running\x20schedule:\x20','query','length','timezone','2127tfCIjg'];a37_0x502c=function(){return _0x10ebbf;};return a37_0x502c();}export class ScheduleListCommand extends BaseCommand{[a37_0x5d6834(0xef)]=a37_0x5d6834(0xbf);['description']=a37_0x5d6834(0x97);async[a37_0x5d6834(0xee)](_0xfcaac3){const _0x3c2b42=a37_0x5d6834,{options:_0x2444c2,args:_0x26a25,tdx:_0x2fe373}=_0xfcaac3,_0x45b00a=resolveLimit(_0x2444c2[_0x3c2b42(0xbc)],DEFAULT_DISPLAY_LIMIT),_0x405fbd=_0x26a25[0x0],_0x45f56d=_0x405fbd?_0x3c2b42(0xdf)+_0x405fbd+_0x3c2b42(0xa5):_0x3c2b42(0xae),_0x179a53=await withSpinner(_0x45f56d,()=>_0x2fe373[_0x3c2b42(0xa8)][_0x3c2b42(0x96)]({'limit':_0x45b00a,'scheduled':!![],'pattern':_0x405fbd}),{'verbose':_0x2444c2[_0x3c2b42(0x7f)]}),_0xc11c23=_0x179a53[_0x3c2b42(0x8c)][_0x3c2b42(0x94)],_0x594fc4=_0x179a53[_0x3c2b42(0x8c)][_0x3c2b42(0xbe)]['has_next_page'],_0x146163=_0x405fbd?_0x3c2b42(0xb2)+_0x405fbd+'\x22':'';_0x594fc4?console[_0x3c2b42(0x90)]('Showing\x20first\x20'+_0xc11c23[_0x3c2b42(0xe5)]+'\x20schedules'+_0x146163+'\x20(use\x20--limit\x20to\x20see\x20more)'):console[_0x3c2b42(0x90)](_0x3c2b42(0xe9)+_0xc11c23[_0x3c2b42(0xe5)]+_0x3c2b42(0xde)+(_0xc11c23[_0x3c2b42(0xe5)]!==0x1?'ies':'y')+_0x146163);if(_0x2444c2['format']===_0x3c2b42(0x7b)||_0x2444c2[_0x3c2b42(0xa2)]==='jsonl'||_0x2444c2[_0x3c2b42(0xa2)]==='table'||_0x2444c2[_0x3c2b42(0xa2)]==='tsv'){const _0x494d7e=_0xc11c23[_0x3c2b42(0xc5)](_0x23ae76=>({'id':_0x23ae76['id'],'name':_0x23ae76[_0x3c2b42(0xef)],'cron':_0x23ae76['cron'],'database':_0x23ae76[_0x3c2b42(0x85)]?.[_0x3c2b42(0xef)],'type':_0x23ae76[_0x3c2b42(0xe8)],'timezone':_0x23ae76['time_zone'],'user_name':_0x23ae76[_0x3c2b42(0x99)]?.[_0x3c2b42(0xef)],'updated_at':_0x23ae76[_0x3c2b42(0x78)],'next_run_at':_0x23ae76[_0x3c2b42(0x8f)],'last_job_status':_0x23ae76[_0x3c2b42(0xca)]?.[_0x3c2b42(0xaf)]}));await handleSDKOutput(_0x494d7e,_0x2444c2);}else{if(_0xc11c23['length']===0x0)console['log'](_0x3c2b42(0xe0));else{const _0x31764b=_0x2444c2[_0x3c2b42(0xc1)],_0x5d8e1d=_0xc11c23['map'](_0x3b7799=>{const _0x2e851e=_0x3c2b42,_0x18f209=_0x3b7799['last_job']?.[_0x2e851e(0xaf)]?_0x3b7799[_0x2e851e(0xca)][_0x2e851e(0xaf)]==='success'?'✓':'✗':'-',_0x52148b=_0x3b7799[_0x2e851e(0xca)]?.['ended_at']?formatRelativeTime(_0x3b7799[_0x2e851e(0xca)][_0x2e851e(0xb4)]):_0x2e851e(0xdd),_0x20f30b=_0x3b7799[_0x2e851e(0x8f)]?formatRelativeTime(_0x3b7799['next_run_at']):'-',_0xed4b44=_0x3b7799['cron']||'',_0x92a491=_0x3b7799[_0x2e851e(0xef)]||_0x2e851e(0xb5),_0x2c7c24=getConsoleUrl(_0x31764b,_0x2e851e(0x9a)+_0x3b7799['id']);return{'statusIcon':_0x18f209,'lastRun':_0x52148b,'nextRun':_0x20f30b,'cron':_0xed4b44,'name':_0x92a491,'queryUrl':_0x2c7c24,'status':_0x3b7799['last_job']?.[_0x2e851e(0xaf)]};}),_0x770c14=Math[_0x3c2b42(0xb0)](..._0x5d8e1d['map'](_0x329974=>_0x329974[_0x3c2b42(0x7e)][_0x3c2b42(0xe5)])),_0x12cd98=Math[_0x3c2b42(0xb0)](..._0x5d8e1d[_0x3c2b42(0xc5)](_0x3d83e9=>_0x3d83e9['nextRun'][_0x3c2b42(0xe5)])),_0x54da5f=Math[_0x3c2b42(0xb0)](..._0x5d8e1d[_0x3c2b42(0xc5)](_0xe3c2ef=>_0xe3c2ef[_0x3c2b42(0xad)]['length'])),_0x3aaa53=_0x5d8e1d[_0x3c2b42(0xc5)](_0x3eb235=>{const _0x537003=_0x3c2b42,_0xec8599=_0x3eb235[_0x537003(0xaf)]===_0x537003(0x72)?a37_0x34a420['green'](_0x3eb235[_0x537003(0xc8)]):_0x3eb235[_0x537003(0xaf)]===_0x537003(0x90)?a37_0x34a420['red'](_0x3eb235[_0x537003(0xc8)]):a37_0x34a420[_0x537003(0xdc)](_0x3eb235[_0x537003(0xc8)]),_0x317761=_0x3eb235[_0x537003(0x7e)][_0x537003(0xb3)](_0x770c14),_0x179a59=_0x3eb235['nextRun'][_0x537003(0xb3)](_0x12cd98),_0x5564b0=_0x3eb235[_0x537003(0xad)]?a37_0x34a420['cyan'](_0x3eb235[_0x537003(0xad)]['padEnd'](_0x54da5f)):'\x20'['repeat'](_0x54da5f),_0xb66bd3=hyperlink(_0x3eb235[_0x537003(0xef)],_0x3eb235[_0x537003(0x82)]);return'📅\x20'+_0xec8599+'\x20'+_0x317761+'\x20\x20→\x20'+_0x179a59+'\x20\x20'+_0x5564b0+'\x20\x20'+_0xb66bd3;});await writeOutput(_0x3aaa53['join']('\x0a'),_0x2444c2[_0x3c2b42(0xb8)],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a37_0x5d6834(0xef)]=a37_0x5d6834(0x76);['description']='Show\x20schedule\x20details';[a37_0x5d6834(0xc0)](_0x27e5ba){const _0x3bc025=a37_0x5d6834,_0x3ae44e=_0x27e5ba['args'][0x0];if(!_0x3ae44e)return _0x3bc025(0x74);return undefined;}async[a37_0x5d6834(0xee)](_0x226d07){const _0x535844=a37_0x5d6834,{options:_0x30fd1e,args:_0xd60ec9,tdx:_0x491a00}=_0x226d07,_0x3526fa=_0xd60ec9[0x0],_0x11e06f=await withSpinner(_0x535844(0x73),()=>_0x491a00[_0x535844(0xa8)][_0x535844(0xd4)](_0x3526fa),{'verbose':_0x30fd1e[_0x535844(0x7f)]}),_0x156c24=_0x11e06f[_0x535844(0x8c)],_0x4af1b8={'name':_0x156c24[_0x535844(0xef)],'cron':_0x156c24['cron'],'database':_0x156c24[_0x535844(0x85)],'type':_0x156c24['type'],'timezone':_0x156c24[_0x535844(0xe6)],'user_name':_0x156c24[_0x535844(0xf1)],'created_at':_0x156c24[_0x535844(0xda)],'engine_version':_0x156c24[_0x535844(0x84)],'executing_user_id':_0x156c24[_0x535844(0xa7)],'query':_0x156c24[_0x535844(0xe4)],'delay':_0x156c24[_0x535844(0x80)],'priority':_0x156c24[_0x535844(0x6e)],'retry_limit':_0x156c24[_0x535844(0x9d)],..._0x156c24[_0x535844(0xa1)]&&{'result':_0x156c24[_0x535844(0xa1)]}};return await handleSingleObjectOutput(_0x4af1b8,_0x30fd1e),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a37_0x5d6834(0xef)]=a37_0x5d6834(0xb1);[a37_0x5d6834(0xd8)]=a37_0x5d6834(0xa3);[a37_0x5d6834(0xc0)](_0x35db0b){const _0x548005=a37_0x5d6834,_0x42cdbf=_0x35db0b[_0x548005(0xc6)][0x0];if(!_0x42cdbf)return _0x548005(0xa6);const _0x51d00d=_0x35db0b['options'];if(!_0x51d00d[_0x548005(0x85)])return'Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';return undefined;}async[a37_0x5d6834(0xee)](_0x5ae5fd){const _0x163cf0=a37_0x5d6834,{options:_0x270879,args:_0x272406,tdx:_0x132643}=_0x5ae5fd,_0x31eaa5=_0x272406[0x0],_0x267e96=_0x270879,_0x4b2ac4=_0x267e96[_0x163cf0(0x85)],_0x31cc16=_0x267e96[_0x163cf0(0xac)],_0x582b11=_0x267e96[_0x163cf0(0xe8)]||_0x163cf0(0xba);let _0xd1e07d;try{_0xd1e07d=readFileSync(_0x31cc16,_0x163cf0(0xea))['trim']();}catch(_0x1aea1d){throw new SDKError(ErrorCode[_0x163cf0(0x79)],'Failed\x20to\x20read\x20file:\x20'+_0x31cc16,_0x1aea1d instanceof Error?_0x1aea1d:undefined);}if(!_0xd1e07d)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x163cf0(0xc3));const _0x542a13={'database':_0x4b2ac4,'query':_0xd1e07d,'type':_0x582b11};if(_0x267e96[_0x163cf0(0xad)])_0x542a13[_0x163cf0(0xad)]=_0x267e96[_0x163cf0(0xad)];if(_0x267e96['timezone'])_0x542a13['timezone']=_0x267e96[_0x163cf0(0xe6)];if(_0x267e96['delay']!==undefined)_0x542a13['delay']=Number(_0x267e96[_0x163cf0(0x80)]);if(_0x267e96['priority']!==undefined)_0x542a13['priority']=Number(_0x267e96['priority']);if(_0x267e96[_0x163cf0(0x8a)]!==undefined)_0x542a13[_0x163cf0(0x9d)]=Number(_0x267e96['retryLimit']);if(_0x267e96[_0x163cf0(0xcd)])_0x542a13[_0x163cf0(0x84)]=_0x267e96[_0x163cf0(0xcd)];if(_0x267e96['result'])_0x542a13['result']=_0x267e96[_0x163cf0(0xa1)];if(_0x270879[_0x163cf0(0x7f)]){console[_0x163cf0(0x90)](_0x163cf0(0xa0)+_0x31eaa5),console[_0x163cf0(0x90)]('\x20\x20Database:\x20'+_0x4b2ac4),console['error'](_0x163cf0(0xd6)+_0x582b11);if(_0x542a13[_0x163cf0(0xad)])console[_0x163cf0(0x90)](_0x163cf0(0xd0)+_0x542a13['cron']);if(_0x542a13['timezone'])console[_0x163cf0(0x90)](_0x163cf0(0xd1)+_0x542a13['timezone']);}const _0x4891b9=await withSpinner('Creating\x20schedule...',()=>_0x132643[_0x163cf0(0xa8)][_0x163cf0(0xa9)](_0x31eaa5,_0x542a13),{'verbose':_0x270879['verbose']});return console[_0x163cf0(0x90)](_0x163cf0(0xab)+_0x4891b9[_0x163cf0(0x8c)][_0x163cf0(0xef)]),await handleSingleObjectOutput(_0x4891b9[_0x163cf0(0x8c)],_0x270879),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a37_0x5d6834(0xef)]='schedule:update';[a37_0x5d6834(0xd8)]=a37_0x5d6834(0xb6);[a37_0x5d6834(0xc0)](_0x14489f){const _0x34cc8a=a37_0x5d6834,_0x480583=_0x14489f[_0x34cc8a(0xc6)][0x0];if(!_0x480583)return _0x34cc8a(0xe2);return undefined;}async[a37_0x5d6834(0xee)](_0x32ab6a){const _0x495e7e=a37_0x5d6834,{options:_0x1157ea,args:_0xab9e23,tdx:_0x540412}=_0x32ab6a,_0x1fee79=_0xab9e23[0x0],_0x2c5f83=_0x1157ea,_0x1b7b6e={};if(_0x2c5f83[_0x495e7e(0x85)])_0x1b7b6e[_0x495e7e(0x85)]=_0x2c5f83[_0x495e7e(0x85)];if(_0x2c5f83['type'])_0x1b7b6e[_0x495e7e(0xe8)]=_0x2c5f83[_0x495e7e(0xe8)];if(_0x2c5f83[_0x495e7e(0xad)])_0x1b7b6e[_0x495e7e(0xad)]=_0x2c5f83[_0x495e7e(0xad)];if(_0x2c5f83['timezone'])_0x1b7b6e[_0x495e7e(0xe6)]=_0x2c5f83['timezone'];if(_0x2c5f83[_0x495e7e(0x80)]!==undefined)_0x1b7b6e[_0x495e7e(0x80)]=Number(_0x2c5f83[_0x495e7e(0x80)]);if(_0x2c5f83[_0x495e7e(0x6e)]!==undefined)_0x1b7b6e[_0x495e7e(0x6e)]=Number(_0x2c5f83[_0x495e7e(0x6e)]);if(_0x2c5f83['retryLimit']!==undefined)_0x1b7b6e['retry_limit']=Number(_0x2c5f83['retryLimit']);if(_0x2c5f83[_0x495e7e(0xcd)])_0x1b7b6e['engine_version']=_0x2c5f83[_0x495e7e(0xcd)];if(_0x2c5f83['result'])_0x1b7b6e[_0x495e7e(0xa1)]=_0x2c5f83[_0x495e7e(0xa1)];if(_0x2c5f83[_0x495e7e(0xac)])try{_0x1b7b6e[_0x495e7e(0xe4)]=readFileSync(_0x2c5f83[_0x495e7e(0xac)],_0x495e7e(0xea))[_0x495e7e(0x91)]();}catch(_0x43ccfe){throw new SDKError(ErrorCode[_0x495e7e(0x79)],_0x495e7e(0x7d)+_0x2c5f83[_0x495e7e(0xac)],_0x43ccfe instanceof Error?_0x43ccfe:undefined);}if(Object['keys'](_0x1b7b6e)[_0x495e7e(0xe5)]===0x0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update');if(_0x1157ea[_0x495e7e(0x7f)]){console[_0x495e7e(0x90)]('Updating\x20schedule:\x20'+_0x1fee79);for(const [_0x1ff959,_0x1977af]of Object[_0x495e7e(0xcb)](_0x1b7b6e)){_0x1ff959===_0x495e7e(0xe4)?console[_0x495e7e(0x90)]('\x20\x20'+_0x1ff959+':\x20'+_0x1977af['substring'](0x0,0x32)+_0x495e7e(0xcc)):console[_0x495e7e(0x90)]('\x20\x20'+_0x1ff959+':\x20'+_0x1977af);}}const _0xf7647a=await withSpinner(_0x495e7e(0x75),()=>_0x540412[_0x495e7e(0xa8)]['update'](_0x1fee79,_0x1b7b6e),{'verbose':_0x1157ea[_0x495e7e(0x7f)]});return console[_0x495e7e(0x90)](_0x495e7e(0x77)+_0xf7647a[_0x495e7e(0x8c)]['name']),await handleSingleObjectOutput(_0xf7647a[_0x495e7e(0x8c)],_0x1157ea),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{['name']=a37_0x5d6834(0xc4);['description']=a37_0x5d6834(0xec);[a37_0x5d6834(0xc0)](_0x502cb8){const _0x471a0b=a37_0x5d6834,_0x55833b=_0x502cb8[_0x471a0b(0xc6)][0x0];if(!_0x55833b)return _0x471a0b(0x7a);return undefined;}async[a37_0x5d6834(0xee)](_0x39d2f5){const _0x4afeae=a37_0x5d6834,{options:_0xb23771,args:_0x4b783d,tdx:_0x3f9032}=_0x39d2f5,_0x87bf14=_0x4b783d[0x0];if(!_0xb23771[_0x4afeae(0xcf)]){const _0xd15444=await confirm(_0x4afeae(0x9c)+_0x87bf14+'\x22?');if(!_0xd15444)return console['error'](_0x4afeae(0x87)),0x0;}const _0x5bc2d7=await withSpinner('Deleting\x20schedule...',()=>_0x3f9032['schedules']['delete'](_0x87bf14),{'verbose':_0xb23771[_0x4afeae(0x7f)]});return console['error']('Schedule\x20deleted:\x20'+_0x5bc2d7['data'][_0x4afeae(0xef)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a37_0x5d6834(0xef)]=a37_0x5d6834(0xed);[a37_0x5d6834(0xd8)]='Run\x20a\x20scheduled\x20query\x20immediately';[a37_0x5d6834(0xc0)](_0x1567a7){const _0x1317e6=a37_0x5d6834,_0x36b0aa=_0x1567a7['args'][0x0];if(!_0x36b0aa)return _0x1317e6(0xb7);return undefined;}async[a37_0x5d6834(0xee)](_0x245b98){const _0x1b9c63=a37_0x5d6834,{options:_0x1e4b0d,args:_0x4dda38,tdx:_0x1baa63}=_0x245b98,_0x53b53d=_0x4dda38[0x0],_0x12dfac=_0x1e4b0d,_0x47ab6b=_0x12dfac[_0x1b9c63(0xc2)],_0x345bc4=_0x12dfac[_0x1b9c63(0x8b)]!==undefined?Number(_0x12dfac[_0x1b9c63(0x8b)]):undefined;if(_0x1e4b0d[_0x1b9c63(0x7f)]){console[_0x1b9c63(0x90)](_0x1b9c63(0xe3)+_0x53b53d);if(_0x47ab6b)console[_0x1b9c63(0x90)](_0x1b9c63(0x83)+_0x47ab6b);if(_0x345bc4)console[_0x1b9c63(0x90)](_0x1b9c63(0x70)+_0x345bc4);}const _0x279a28=await withSpinner(_0x1b9c63(0xbd),()=>_0x1baa63[_0x1b9c63(0xa8)][_0x1b9c63(0x9e)](_0x53b53d,{'time':_0x47ab6b,'num':_0x345bc4}),{'verbose':_0x1e4b0d[_0x1b9c63(0x7f)]}),_0x5dc45e=_0x279a28['data']['jobs'];console['error'](_0x1b9c63(0x6f)+_0x5dc45e['length']+'\x20job'+(_0x5dc45e[_0x1b9c63(0xe5)]!==0x1?'s':'')+_0x1b9c63(0x95));for(const _0xb1a778 of _0x5dc45e){console['error'](_0x1b9c63(0x9f)+_0xb1a778[_0x1b9c63(0xce)]);}return await handleSDKOutput(_0x5dc45e,_0x1e4b0d),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a37_0x5d6834(0xef)]=a37_0x5d6834(0xe1);[a37_0x5d6834(0xd8)]=a37_0x5d6834(0x81);[a37_0x5d6834(0xc0)](_0x4ea5cc){const _0xef47a0=a37_0x5d6834,_0x4088c8=_0x4ea5cc[_0xef47a0(0xc6)][0x0];if(!_0x4088c8)return _0xef47a0(0xaa);return undefined;}async['execute'](_0x502fc5){const _0x321636=a37_0x5d6834,{options:_0x3fd31d,args:_0x52101d,tdx:_0x1734c2}=_0x502fc5,_0x3a8015=_0x52101d[0x0],_0x262714=_0x3fd31d,_0x28608e=_0x262714['from']!==undefined?Number(_0x262714['from']):undefined,_0x1d8566=_0x262714['to']!==undefined?Number(_0x262714['to']):undefined,_0x4b49bd=await withSpinner(_0x321636(0x89),()=>_0x1734c2[_0x321636(0xa8)][_0x321636(0xd5)](_0x3a8015,{'from':_0x28608e,'to':_0x1d8566}),{'verbose':_0x3fd31d[_0x321636(0x7f)]}),_0x3214b8=_0x4b49bd[_0x321636(0x8c)];console[_0x321636(0x90)]('Found\x20'+_0x3214b8[_0x321636(0xd2)]+_0x321636(0x9b)+(_0x3214b8['count']!==0x1?'s':'')+_0x321636(0x8d)+_0x3214b8['from']+'-'+_0x3214b8['to']+')');const _0x4fad22=_0x3214b8[_0x321636(0xd5)][_0x321636(0xc5)](_0x37ceee=>({'job_id':_0x37ceee[_0x321636(0xce)],'type':_0x37ceee[_0x321636(0xe8)],'status':_0x37ceee[_0x321636(0xaf)],'scheduled_at':_0x37ceee[_0x321636(0xc9)],'created_at':_0x37ceee[_0x321636(0xda)],'start_at':_0x37ceee[_0x321636(0x7c)],'end_at':_0x37ceee[_0x321636(0x93)]}));return await handleSDKOutput(_0x4fad22,_0x3fd31d),0x0;}}
1
+ const a37_0x36ff3a=a37_0x5a0a;(function(_0x1ab134,_0x599199){const _0x50f823=a37_0x5a0a,_0x1c602c=_0x1ab134();while(!![]){try{const _0x2a5e52=parseInt(_0x50f823(0x1fd))/0x1*(-parseInt(_0x50f823(0x18e))/0x2)+parseInt(_0x50f823(0x1e9))/0x3*(-parseInt(_0x50f823(0x1b9))/0x4)+parseInt(_0x50f823(0x196))/0x5*(parseInt(_0x50f823(0x1f6))/0x6)+-parseInt(_0x50f823(0x210))/0x7*(parseInt(_0x50f823(0x18d))/0x8)+parseInt(_0x50f823(0x1d5))/0x9*(parseInt(_0x50f823(0x193))/0xa)+parseInt(_0x50f823(0x209))/0xb*(-parseInt(_0x50f823(0x1fe))/0xc)+parseInt(_0x50f823(0x20c))/0xd;if(_0x2a5e52===_0x599199)break;else _0x1c602c['push'](_0x1c602c['shift']());}catch(_0x3572a9){_0x1c602c['push'](_0x1c602c['shift']());}}}(a37_0x286f,0xe4e59));import{BaseCommand}from'./command.js';function a37_0x286f(){const _0x504c9b=['execute','count','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','\x20scheduled\x20quer','validate','Schedule\x20updated:\x20','job_id','scheduled_at','1311356oqBujS','\x20\x20Timezone:\x20','json','Listing\x20scheduled\x20queries...','type','limit','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','schedule:run','Getting\x20schedule\x20history...','repeat','Update\x20a\x20scheduled\x20query','database','last_job','...','tsv','Updating\x20schedule...','\x20\x20Database:\x20','nextRun','📅\x20','cyan','Running\x20schedule...','trino','create','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','/app/queries/editor?queryId=','engineVersion','getTime','success','57789WJYqnX','\x20created','Getting\x20schedule\x20details...','name','data','never','description','INVALID_ARGUMENT','h\x20ago','retryLimit','Schedule\x20created:\x20','Cancelled','\x20(showing\x20','error','round','Schedule\x20run\x20submitted:\x20','abs','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','\x20\x20Time:\x20','query','15bxiWho','run','schedule:delete','from','toLocaleDateString','schedule:update','m\x20ago','history','jsonl','table','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','Show\x20schedule\x20execution\x20history','log','1537962hqnHrp','schedules','map','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','next_run_at','entries','padEnd','7SYspsh','1054836mUGoPg','Found\x20','Delete\x20a\x20scheduled\x20query','ended_at','time','Failed\x20to\x20read\x20file:\x20','created_at','jobs','Creating\x20schedule...','dim','length','55eGSgyj','Creating\x20schedule:\x20','priority','58113718rlmxoh','status','\x20execution','max','858004zwiLif','file','Running\x20schedule:\x20','cron','delete','time_zone','show','result','args','red','56XiDrJk','527444jqoXAJ','user','executing_user_id','Deleting\x20schedule...','ies','350mafibi','Run\x20a\x20scheduled\x20query\x20immediately','timezone','20VfSfBp','Searching\x20scheduled\x20queries\x20matching\x20\x22','Show\x20schedule\x20details','in\x20','trim','Schedule\x20deleted:\x20','\x20\x20Type:\x20','has_next_page','\x20\x20→\x20','delay','lastRun','retry_limit','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','format','output','join','listQueries','\x20job','Query\x20file\x20is\x20empty','schedule:create','verbose','end_at','schedule:list','statusIcon','num','engine_version'];a37_0x286f=function(){return _0x504c9b;};return a37_0x286f();}import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';function a37_0x5a0a(_0x43988c,_0x564ae5){_0x43988c=_0x43988c-0x18a;const _0x286fd2=a37_0x286f();let _0x5a0a48=_0x286fd2[_0x43988c];return _0x5a0a48;}import a37_0x119687 from'chalk';function formatRelativeTime(_0x24de78){const _0x252dd7=a37_0x5a0a,_0xc39f00=new Date(_0x24de78),_0x4399fb=new Date(),_0x21c72c=_0xc39f00[_0x252dd7(0x1d3)]()-_0x4399fb[_0x252dd7(0x1d3)](),_0x1dad57=Math[_0x252dd7(0x1e5)](_0x21c72c)/0x3e8,_0x5895cc=_0x21c72c<0x0;if(_0x1dad57<0x3c)return _0x5895cc?'just\x20now':'soon';else{if(_0x1dad57<0xe10){const _0x48ad40=Math['round'](_0x1dad57/0x3c);return _0x5895cc?_0x48ad40+_0x252dd7(0x1ef):_0x252dd7(0x199)+_0x48ad40+'m';}else{if(_0x1dad57<0x15180){const _0x51370a=Math[_0x252dd7(0x1e3)](_0x1dad57/0xe10);return _0x5895cc?_0x51370a+_0x252dd7(0x1dd):'in\x20'+_0x51370a+'h';}else{if(_0x1dad57<0x93a80){const _0x534374=Math['round'](_0x1dad57/0x15180);return _0x5895cc?_0x534374+'d\x20ago':_0x252dd7(0x199)+_0x534374+'d';}else return _0xc39f00[_0x252dd7(0x1ed)]();}}}}export class ScheduleListCommand extends BaseCommand{[a37_0x36ff3a(0x1d8)]=a37_0x36ff3a(0x1ac);['description']='List\x20scheduled\x20queries';async['execute'](_0x890fde){const _0x2c2f2a=a37_0x36ff3a,{options:_0x30432e,args:_0x34e9c2,tdx:_0x500ba3}=_0x890fde,_0x7257b8=resolveLimit(_0x30432e[_0x2c2f2a(0x1be)],DEFAULT_DISPLAY_LIMIT),_0x59d5ed=_0x34e9c2[0x0],_0xbb31d9=_0x59d5ed?_0x2c2f2a(0x197)+_0x59d5ed+'\x22...':_0x2c2f2a(0x1bc),_0x2187e8=await withSpinner(_0xbb31d9,()=>_0x500ba3[_0x2c2f2a(0x1f7)][_0x2c2f2a(0x1a6)]({'limit':_0x7257b8,'scheduled':!![],'pattern':_0x59d5ed}),{'verbose':_0x30432e[_0x2c2f2a(0x1aa)]}),_0x36a80c=_0x2187e8[_0x2c2f2a(0x1d9)]['queries'],_0x590689=_0x2187e8[_0x2c2f2a(0x1d9)]['pagination'][_0x2c2f2a(0x19d)],_0x25efd8=_0x59d5ed?'\x20matching\x20\x22'+_0x59d5ed+'\x22':'';_0x590689?console[_0x2c2f2a(0x1e2)]('Showing\x20first\x20'+_0x36a80c[_0x2c2f2a(0x208)]+'\x20schedules'+_0x25efd8+'\x20(use\x20--limit\x20to\x20see\x20more)'):console['error'](_0x2c2f2a(0x1ff)+_0x36a80c[_0x2c2f2a(0x208)]+_0x2c2f2a(0x1b4)+(_0x36a80c['length']!==0x1?_0x2c2f2a(0x192):'y')+_0x25efd8);if(_0x30432e[_0x2c2f2a(0x1a3)]===_0x2c2f2a(0x1bb)||_0x30432e[_0x2c2f2a(0x1a3)]===_0x2c2f2a(0x1f1)||_0x30432e[_0x2c2f2a(0x1a3)]===_0x2c2f2a(0x1f2)||_0x30432e[_0x2c2f2a(0x1a3)]===_0x2c2f2a(0x1c7)){const _0x4b4856=_0x36a80c['map'](_0x17be98=>({'id':_0x17be98['id'],'name':_0x17be98[_0x2c2f2a(0x1d8)],'cron':_0x17be98[_0x2c2f2a(0x213)],'database':_0x17be98['database']?.[_0x2c2f2a(0x1d8)],'type':_0x17be98[_0x2c2f2a(0x1bd)],'timezone':_0x17be98[_0x2c2f2a(0x215)],'user_name':_0x17be98[_0x2c2f2a(0x18f)]?.[_0x2c2f2a(0x1d8)],'updated_at':_0x17be98['updated_at'],'next_run_at':_0x17be98[_0x2c2f2a(0x1fa)],'last_job_status':_0x17be98[_0x2c2f2a(0x1c5)]?.[_0x2c2f2a(0x20d)]}));await handleSDKOutput(_0x4b4856,_0x30432e);}else{if(_0x36a80c[_0x2c2f2a(0x208)]===0x0)console[_0x2c2f2a(0x1f5)]('No\x20scheduled\x20queries\x20found');else{const _0x31611c=_0x30432e['site'],_0x4346a6=_0x36a80c[_0x2c2f2a(0x1f8)](_0x54c01d=>{const _0x415b7a=_0x2c2f2a,_0x48dbd7=_0x54c01d['last_job']?.[_0x415b7a(0x20d)]?_0x54c01d['last_job'][_0x415b7a(0x20d)]===_0x415b7a(0x1d4)?'✓':'✗':'-',_0x38129b=_0x54c01d[_0x415b7a(0x1c5)]?.[_0x415b7a(0x201)]?formatRelativeTime(_0x54c01d[_0x415b7a(0x1c5)][_0x415b7a(0x201)]):_0x415b7a(0x1da),_0x378cd0=_0x54c01d['next_run_at']?formatRelativeTime(_0x54c01d[_0x415b7a(0x1fa)]):'-',_0x7ddb13=_0x54c01d[_0x415b7a(0x213)]||'',_0x4be43c=_0x54c01d[_0x415b7a(0x1d8)]||'(unnamed)',_0x188074=getConsoleUrl(_0x31611c,_0x415b7a(0x1d1)+_0x54c01d['id']);return{'statusIcon':_0x48dbd7,'lastRun':_0x38129b,'nextRun':_0x378cd0,'cron':_0x7ddb13,'name':_0x4be43c,'queryUrl':_0x188074,'status':_0x54c01d[_0x415b7a(0x1c5)]?.[_0x415b7a(0x20d)]};}),_0x241239=Math[_0x2c2f2a(0x20f)](..._0x4346a6['map'](_0x3badd4=>_0x3badd4[_0x2c2f2a(0x1a0)][_0x2c2f2a(0x208)])),_0x172da7=Math[_0x2c2f2a(0x20f)](..._0x4346a6[_0x2c2f2a(0x1f8)](_0x4edeb9=>_0x4edeb9['nextRun'][_0x2c2f2a(0x208)])),_0x24325a=Math[_0x2c2f2a(0x20f)](..._0x4346a6['map'](_0x47b8aa=>_0x47b8aa[_0x2c2f2a(0x213)]['length'])),_0x372f50=_0x4346a6[_0x2c2f2a(0x1f8)](_0x20f0a6=>{const _0x4c0d1e=_0x2c2f2a,_0x123059=_0x20f0a6['status']==='success'?a37_0x119687['green'](_0x20f0a6['statusIcon']):_0x20f0a6[_0x4c0d1e(0x20d)]===_0x4c0d1e(0x1e2)?a37_0x119687[_0x4c0d1e(0x18c)](_0x20f0a6[_0x4c0d1e(0x1ad)]):a37_0x119687[_0x4c0d1e(0x207)](_0x20f0a6[_0x4c0d1e(0x1ad)]),_0xe5c61d=_0x20f0a6[_0x4c0d1e(0x1a0)][_0x4c0d1e(0x1fc)](_0x241239),_0x246cdf=_0x20f0a6[_0x4c0d1e(0x1ca)]['padEnd'](_0x172da7),_0x14cf19=_0x20f0a6[_0x4c0d1e(0x213)]?a37_0x119687[_0x4c0d1e(0x1cc)](_0x20f0a6['cron'][_0x4c0d1e(0x1fc)](_0x24325a)):'\x20'[_0x4c0d1e(0x1c2)](_0x24325a),_0x3841e1=hyperlink(_0x20f0a6[_0x4c0d1e(0x1d8)],_0x20f0a6['queryUrl']);return _0x4c0d1e(0x1cb)+_0x123059+'\x20'+_0xe5c61d+_0x4c0d1e(0x19e)+_0x246cdf+'\x20\x20'+_0x14cf19+'\x20\x20'+_0x3841e1;});await writeOutput(_0x372f50[_0x2c2f2a(0x1a5)]('\x0a'),_0x30432e[_0x2c2f2a(0x1a4)],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a37_0x36ff3a(0x1d8)]='schedule:show';[a37_0x36ff3a(0x1db)]=a37_0x36ff3a(0x198);[a37_0x36ff3a(0x1b5)](_0x305669){const _0x4b4d00=a37_0x36ff3a,_0x5badaf=_0x305669[_0x4b4d00(0x18b)][0x0];if(!_0x5badaf)return _0x4b4d00(0x1b2);return undefined;}async[a37_0x36ff3a(0x1b0)](_0xc94bd6){const _0x33eced=a37_0x36ff3a,{options:_0x33e268,args:_0x4d82ac,tdx:_0x4eaf71}=_0xc94bd6,_0x52c8ba=_0x4d82ac[0x0],_0xcc10e8=await withSpinner(_0x33eced(0x1d7),()=>_0x4eaf71[_0x33eced(0x1f7)][_0x33eced(0x216)](_0x52c8ba),{'verbose':_0x33e268[_0x33eced(0x1aa)]}),_0x1977f1=_0xcc10e8[_0x33eced(0x1d9)],_0x38d27d={'name':_0x1977f1[_0x33eced(0x1d8)],'cron':_0x1977f1['cron'],'database':_0x1977f1['database'],'type':_0x1977f1[_0x33eced(0x1bd)],'timezone':_0x1977f1[_0x33eced(0x195)],'user_name':_0x1977f1['user_name'],'created_at':_0x1977f1[_0x33eced(0x204)],'engine_version':_0x1977f1[_0x33eced(0x1af)],'executing_user_id':_0x1977f1[_0x33eced(0x190)],'query':_0x1977f1[_0x33eced(0x1e8)],'delay':_0x1977f1[_0x33eced(0x19f)],'priority':_0x1977f1[_0x33eced(0x20b)],'retry_limit':_0x1977f1['retry_limit'],..._0x1977f1[_0x33eced(0x18a)]&&{'result':_0x1977f1[_0x33eced(0x18a)]}};return await handleSingleObjectOutput(_0x38d27d,_0x33e268),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a37_0x36ff3a(0x1d8)]=a37_0x36ff3a(0x1a9);[a37_0x36ff3a(0x1db)]='Create\x20a\x20scheduled\x20query';['validate'](_0x144285){const _0x37342d=a37_0x36ff3a,_0x8c0676=_0x144285[_0x37342d(0x18b)][0x0];if(!_0x8c0676)return _0x37342d(0x1bf);const _0xa1cbfe=_0x144285['options'];if(!_0xa1cbfe[_0x37342d(0x1c4)])return _0x37342d(0x1d0);return undefined;}async[a37_0x36ff3a(0x1b0)](_0x592ee1){const _0x286e8d=a37_0x36ff3a,{options:_0x3e9668,args:_0x409799,tdx:_0x88174d}=_0x592ee1,_0xac6ea3=_0x409799[0x0],_0x38ee08=_0x3e9668,_0x454f4e=_0x38ee08[_0x286e8d(0x1c4)],_0x3075a0=_0x38ee08[_0x286e8d(0x211)],_0x11d993=_0x38ee08[_0x286e8d(0x1bd)]||_0x286e8d(0x1ce);let _0x3daa6d;try{_0x3daa6d=readFileSync(_0x3075a0,'utf-8')[_0x286e8d(0x19a)]();}catch(_0x2d57e3){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x286e8d(0x203)+_0x3075a0,_0x2d57e3 instanceof Error?_0x2d57e3:undefined);}if(!_0x3daa6d)throw new SDKError(ErrorCode[_0x286e8d(0x1dc)],_0x286e8d(0x1a8));const _0x523325={'database':_0x454f4e,'query':_0x3daa6d,'type':_0x11d993};if(_0x38ee08['cron'])_0x523325[_0x286e8d(0x213)]=_0x38ee08['cron'];if(_0x38ee08[_0x286e8d(0x195)])_0x523325['timezone']=_0x38ee08[_0x286e8d(0x195)];if(_0x38ee08[_0x286e8d(0x19f)]!==undefined)_0x523325['delay']=Number(_0x38ee08[_0x286e8d(0x19f)]);if(_0x38ee08['priority']!==undefined)_0x523325[_0x286e8d(0x20b)]=Number(_0x38ee08['priority']);if(_0x38ee08[_0x286e8d(0x1de)]!==undefined)_0x523325[_0x286e8d(0x1a1)]=Number(_0x38ee08[_0x286e8d(0x1de)]);if(_0x38ee08['engineVersion'])_0x523325[_0x286e8d(0x1af)]=_0x38ee08[_0x286e8d(0x1d2)];if(_0x38ee08[_0x286e8d(0x18a)])_0x523325[_0x286e8d(0x18a)]=_0x38ee08[_0x286e8d(0x18a)];if(_0x3e9668[_0x286e8d(0x1aa)]){console['error'](_0x286e8d(0x20a)+_0xac6ea3),console[_0x286e8d(0x1e2)](_0x286e8d(0x1c9)+_0x454f4e),console[_0x286e8d(0x1e2)](_0x286e8d(0x19c)+_0x11d993);if(_0x523325[_0x286e8d(0x213)])console['error']('\x20\x20Cron:\x20'+_0x523325[_0x286e8d(0x213)]);if(_0x523325['timezone'])console[_0x286e8d(0x1e2)](_0x286e8d(0x1ba)+_0x523325[_0x286e8d(0x195)]);}const _0x20b6fc=await withSpinner(_0x286e8d(0x206),()=>_0x88174d['schedules'][_0x286e8d(0x1cf)](_0xac6ea3,_0x523325),{'verbose':_0x3e9668[_0x286e8d(0x1aa)]});return console[_0x286e8d(0x1e2)](_0x286e8d(0x1df)+_0x20b6fc[_0x286e8d(0x1d9)][_0x286e8d(0x1d8)]),await handleSingleObjectOutput(_0x20b6fc[_0x286e8d(0x1d9)],_0x3e9668),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{['name']=a37_0x36ff3a(0x1ee);[a37_0x36ff3a(0x1db)]=a37_0x36ff3a(0x1c3);[a37_0x36ff3a(0x1b5)](_0x45f0b7){const _0x364b5c=a37_0x36ff3a,_0xf386ea=_0x45f0b7[_0x364b5c(0x18b)][0x0];if(!_0xf386ea)return _0x364b5c(0x1e6);return undefined;}async[a37_0x36ff3a(0x1b0)](_0xb8271a){const _0x439e89=a37_0x36ff3a,{options:_0x391895,args:_0xc41ad4,tdx:_0x499075}=_0xb8271a,_0x535d90=_0xc41ad4[0x0],_0x19b78b=_0x391895,_0x4a8014={};if(_0x19b78b['database'])_0x4a8014[_0x439e89(0x1c4)]=_0x19b78b[_0x439e89(0x1c4)];if(_0x19b78b[_0x439e89(0x1bd)])_0x4a8014[_0x439e89(0x1bd)]=_0x19b78b[_0x439e89(0x1bd)];if(_0x19b78b[_0x439e89(0x213)])_0x4a8014[_0x439e89(0x213)]=_0x19b78b[_0x439e89(0x213)];if(_0x19b78b[_0x439e89(0x195)])_0x4a8014[_0x439e89(0x195)]=_0x19b78b[_0x439e89(0x195)];if(_0x19b78b[_0x439e89(0x19f)]!==undefined)_0x4a8014['delay']=Number(_0x19b78b[_0x439e89(0x19f)]);if(_0x19b78b[_0x439e89(0x20b)]!==undefined)_0x4a8014[_0x439e89(0x20b)]=Number(_0x19b78b[_0x439e89(0x20b)]);if(_0x19b78b['retryLimit']!==undefined)_0x4a8014[_0x439e89(0x1a1)]=Number(_0x19b78b['retryLimit']);if(_0x19b78b[_0x439e89(0x1d2)])_0x4a8014[_0x439e89(0x1af)]=_0x19b78b[_0x439e89(0x1d2)];if(_0x19b78b[_0x439e89(0x18a)])_0x4a8014['result']=_0x19b78b[_0x439e89(0x18a)];if(_0x19b78b[_0x439e89(0x211)])try{_0x4a8014[_0x439e89(0x1e8)]=readFileSync(_0x19b78b['file'],'utf-8')[_0x439e89(0x19a)]();}catch(_0x358d94){throw new SDKError(ErrorCode[_0x439e89(0x1dc)],_0x439e89(0x203)+_0x19b78b[_0x439e89(0x211)],_0x358d94 instanceof Error?_0x358d94:undefined);}if(Object['keys'](_0x4a8014)[_0x439e89(0x208)]===0x0)throw new SDKError(ErrorCode[_0x439e89(0x1dc)],_0x439e89(0x1b3));if(_0x391895['verbose']){console[_0x439e89(0x1e2)]('Updating\x20schedule:\x20'+_0x535d90);for(const [_0x10ee11,_0x1a79ad]of Object[_0x439e89(0x1fb)](_0x4a8014)){_0x10ee11===_0x439e89(0x1e8)?console[_0x439e89(0x1e2)]('\x20\x20'+_0x10ee11+':\x20'+_0x1a79ad['substring'](0x0,0x32)+_0x439e89(0x1c6)):console[_0x439e89(0x1e2)]('\x20\x20'+_0x10ee11+':\x20'+_0x1a79ad);}}const _0x212811=await withSpinner(_0x439e89(0x1c8),()=>_0x499075[_0x439e89(0x1f7)]['update'](_0x535d90,_0x4a8014),{'verbose':_0x391895[_0x439e89(0x1aa)]});return console[_0x439e89(0x1e2)](_0x439e89(0x1b6)+_0x212811[_0x439e89(0x1d9)]['name']),await handleSingleObjectOutput(_0x212811[_0x439e89(0x1d9)],_0x391895),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a37_0x36ff3a(0x1d8)]=a37_0x36ff3a(0x1eb);[a37_0x36ff3a(0x1db)]=a37_0x36ff3a(0x200);[a37_0x36ff3a(0x1b5)](_0x4d8116){const _0x4bcff6=a37_0x36ff3a,_0x465ca9=_0x4d8116[_0x4bcff6(0x18b)][0x0];if(!_0x465ca9)return _0x4bcff6(0x1a2);return undefined;}async['execute'](_0x433464){const _0x4825a0=a37_0x36ff3a,{options:_0x563564,args:_0x4fb928,tdx:_0x1a7271}=_0x433464,_0x289e85=_0x4fb928[0x0];if(!_0x563564['yes']){const _0x565a4e=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22'+_0x289e85+'\x22?');if(!_0x565a4e)return console[_0x4825a0(0x1e2)](_0x4825a0(0x1e0)),0x0;}const _0x222c66=await withSpinner(_0x4825a0(0x191),()=>_0x1a7271['schedules'][_0x4825a0(0x214)](_0x289e85),{'verbose':_0x563564[_0x4825a0(0x1aa)]});return console[_0x4825a0(0x1e2)](_0x4825a0(0x19b)+_0x222c66['data'][_0x4825a0(0x1d8)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a37_0x36ff3a(0x1d8)]=a37_0x36ff3a(0x1c0);[a37_0x36ff3a(0x1db)]=a37_0x36ff3a(0x194);['validate'](_0x1b23ab){const _0x406f20=a37_0x36ff3a,_0x2be2b0=_0x1b23ab[_0x406f20(0x18b)][0x0];if(!_0x2be2b0)return _0x406f20(0x1f3);return undefined;}async['execute'](_0x1fdd6f){const _0x1e59db=a37_0x36ff3a,{options:_0x1b8675,args:_0x2c7d20,tdx:_0x1804e7}=_0x1fdd6f,_0x41c5b6=_0x2c7d20[0x0],_0x41cd2a=_0x1b8675,_0x5deb72=_0x41cd2a[_0x1e59db(0x202)],_0x2dbf44=_0x41cd2a['num']!==undefined?Number(_0x41cd2a[_0x1e59db(0x1ae)]):undefined;if(_0x1b8675[_0x1e59db(0x1aa)]){console[_0x1e59db(0x1e2)](_0x1e59db(0x212)+_0x41c5b6);if(_0x5deb72)console[_0x1e59db(0x1e2)](_0x1e59db(0x1e7)+_0x5deb72);if(_0x2dbf44)console['error']('\x20\x20Num:\x20'+_0x2dbf44);}const _0x1e5849=await withSpinner(_0x1e59db(0x1cd),()=>_0x1804e7[_0x1e59db(0x1f7)][_0x1e59db(0x1ea)](_0x41c5b6,{'time':_0x5deb72,'num':_0x2dbf44}),{'verbose':_0x1b8675[_0x1e59db(0x1aa)]}),_0x49ba53=_0x1e5849[_0x1e59db(0x1d9)][_0x1e59db(0x205)];console[_0x1e59db(0x1e2)](_0x1e59db(0x1e4)+_0x49ba53[_0x1e59db(0x208)]+_0x1e59db(0x1a7)+(_0x49ba53[_0x1e59db(0x208)]!==0x1?'s':'')+_0x1e59db(0x1d6));for(const _0x58bd65 of _0x49ba53){console['error']('\x20\x20Job\x20ID:\x20'+_0x58bd65[_0x1e59db(0x1b7)]);}return await handleSDKOutput(_0x49ba53,_0x1b8675),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a37_0x36ff3a(0x1d8)]='schedule:history';['description']=a37_0x36ff3a(0x1f4);['validate'](_0x3b9cab){const _0x528c2c=a37_0x36ff3a,_0x3b3b60=_0x3b9cab['args'][0x0];if(!_0x3b3b60)return _0x528c2c(0x1f9);return undefined;}async['execute'](_0x4420df){const _0x5b286a=a37_0x36ff3a,{options:_0x16d4ef,args:_0x33c747,tdx:_0x73865f}=_0x4420df,_0x3397ed=_0x33c747[0x0],_0x4a1a61=_0x16d4ef,_0x293f6c=_0x4a1a61[_0x5b286a(0x1ec)]!==undefined?Number(_0x4a1a61[_0x5b286a(0x1ec)]):undefined,_0x1788df=_0x4a1a61['to']!==undefined?Number(_0x4a1a61['to']):undefined,_0x1239a9=await withSpinner(_0x5b286a(0x1c1),()=>_0x73865f[_0x5b286a(0x1f7)][_0x5b286a(0x1f0)](_0x3397ed,{'from':_0x293f6c,'to':_0x1788df}),{'verbose':_0x16d4ef[_0x5b286a(0x1aa)]}),_0x926870=_0x1239a9[_0x5b286a(0x1d9)];console[_0x5b286a(0x1e2)]('Found\x20'+_0x926870[_0x5b286a(0x1b1)]+_0x5b286a(0x20e)+(_0x926870[_0x5b286a(0x1b1)]!==0x1?'s':'')+_0x5b286a(0x1e1)+_0x926870[_0x5b286a(0x1ec)]+'-'+_0x926870['to']+')');const _0x4ca3d5=_0x926870[_0x5b286a(0x1f0)][_0x5b286a(0x1f8)](_0x1d52b5=>({'job_id':_0x1d52b5[_0x5b286a(0x1b7)],'type':_0x1d52b5[_0x5b286a(0x1bd)],'status':_0x1d52b5[_0x5b286a(0x20d)],'scheduled_at':_0x1d52b5[_0x5b286a(0x1b8)],'created_at':_0x1d52b5[_0x5b286a(0x204)],'start_at':_0x1d52b5['start_at'],'end_at':_0x1d52b5[_0x5b286a(0x1ab)]}));return await handleSDKOutput(_0x4ca3d5,_0x16d4ef),0x0;}}
@@ -1 +1 @@
1
- const a38_0x223978=a38_0x2b53;(function(_0x37d470,_0x3aede3){const _0x35dc22=a38_0x2b53,_0x46010e=_0x37d470();while(!![]){try{const _0x4bbc41=parseInt(_0x35dc22(0x1fc))/0x1*(-parseInt(_0x35dc22(0x1ba))/0x2)+parseInt(_0x35dc22(0x19b))/0x3+parseInt(_0x35dc22(0x1cd))/0x4*(-parseInt(_0x35dc22(0x190))/0x5)+parseInt(_0x35dc22(0x1e0))/0x6*(parseInt(_0x35dc22(0x1a0))/0x7)+-parseInt(_0x35dc22(0x1f3))/0x8*(-parseInt(_0x35dc22(0x193))/0x9)+parseInt(_0x35dc22(0x20b))/0xa+-parseInt(_0x35dc22(0x1bb))/0xb;if(_0x4bbc41===_0x3aede3)break;else _0x46010e['push'](_0x46010e['shift']());}catch(_0x257ff0){_0x46010e['push'](_0x46010e['shift']());}}}(a38_0xe748,0xaadae));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_0x2a976e from'chalk';async function resolveSegmentTarget(_0x1d9aa5,_0x422928,_0x9ab5d9){const _0x151e15=a38_0x2b53;if(isYamlFilePath(_0x1d9aa5))try{const _0x3256bc=await resolveYamlFilePath(_0x1d9aa5);return _0x9ab5d9&&(console[_0x151e15(0x1bc)](_0x151e15(0x198)+_0x1d9aa5),console['error'](_0x151e15(0x1db)+_0x3256bc[_0x151e15(0x20f)]),console[_0x151e15(0x1bc)]('\x20\x20Segment\x20name:\x20'+_0x3256bc[_0x151e15(0x1f1)]),console[_0x151e15(0x1bc)](_0x151e15(0x192)+(_0x3256bc[_0x151e15(0x1a2)]||_0x151e15(0x233))),console[_0x151e15(0x1bc)]('\x20\x20Full\x20path:\x20'+_0x3256bc[_0x151e15(0x1b2)])),_0x3256bc[_0x151e15(0x1b2)];}catch(_0x398011){throw new SDKError(ErrorCode[_0x151e15(0x1c7)],_0x151e15(0x21e)+_0x398011[_0x151e15(0x1ca)]);}if(!_0x422928)throw new SDKError(ErrorCode[_0x151e15(0x1c7)],_0x151e15(0x217));return _0x422928+'/'+_0x1d9aa5;}function a38_0x2b53(_0x24b666,_0x432502){_0x24b666=_0x24b666-0x190;const _0xe74890=a38_0xe748();let _0x2b5393=_0xe74890[_0x24b666];return _0x2b5393;}export class SegmentDescribeCommand extends BaseCommand{[a38_0x223978(0x1ad)]=a38_0x223978(0x1ff);[a38_0x223978(0x195)]='Show\x20segment\x20or\x20folder\x20details';async[a38_0x223978(0x1cf)](_0x4943f3){const _0x309054=a38_0x223978,{options:_0x6319d4,args:_0x111484,tdx:_0x550247}=_0x4943f3,_0x5c8e90=_0x111484[0x0],_0x3dd782=!_0x5c8e90&&!!_0x6319d4[_0x309054(0x20f)],_0xcaad4c=_0x5c8e90||_0x6319d4[_0x309054(0x20f)];if(!_0xcaad4c)return console[_0x309054(0x1bc)](_0x309054(0x203)),console[_0x309054(0x1bc)](_0x309054(0x22e)),console[_0x309054(0x1bc)](_0x309054(0x1fd)),console['error'](_0x309054(0x1b8)),console[_0x309054(0x1bc)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console[_0x309054(0x1bc)](_0x309054(0x21c)),console[_0x309054(0x1bc)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0x5b2f2f=_0x6319d4[_0x309054(0x1da)];let _0x59cfda=_0xcaad4c;!_0x3dd782&&_0x5b2f2f&&!_0xcaad4c[_0x309054(0x1b9)]('/')&&(_0x59cfda=_0x5b2f2f+'/'+_0xcaad4c,_0x6319d4[_0x309054(0x1c9)]&&console['error']('Resolved\x20relative\x20path\x20to:\x20'+_0x59cfda));const _0xc51b9d=await withSpinner(_0x309054(0x1dd)+_0x59cfda+_0x309054(0x1be),()=>_0x550247['segment'][_0x309054(0x1bd)](_0x59cfda),{'verbose':_0x6319d4[_0x309054(0x1c9)]}),_0x5ec205=_0xc51b9d[_0x309054(0x1f4)];_0x6319d4[_0x309054(0x1c9)]&&(console[_0x309054(0x1bc)](_0x309054(0x1fa)+_0x5ec205[_0x309054(0x1e3)]),console['error'](_0x309054(0x1f2)+_0x5ec205[_0x309054(0x1f7)]),_0x5ec205['folderId']&&console[_0x309054(0x1bc)]('Folder\x20ID:\x20'+_0x5ec205[_0x309054(0x1d1)]),_0x5ec205['segmentId']&&console['error']('Segment\x20ID:\x20'+_0x5ec205[_0x309054(0x22c)]));if(_0x5ec205['type']===_0x309054(0x232)){const _0x361f35=await withSpinner(_0x309054(0x1aa),()=>_0x550247[_0x309054(0x1a5)][_0x309054(0x1d3)](_0x5ec205[_0x309054(0x1f7)]),{'verbose':_0x6319d4[_0x309054(0x1c9)]});await handleSingleObjectOutput(_0x361f35[_0x309054(0x1f4)],_0x6319d4);}else{if(_0x5ec205[_0x309054(0x1e3)]===_0x309054(0x22b)){if(!_0x5ec205[_0x309054(0x1d1)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x309054(0x1f9));const _0x37f03d=await withSpinner(_0x309054(0x1f8),()=>_0x550247[_0x309054(0x1a5)][_0x309054(0x237)](_0x5ec205[_0x309054(0x1d1)]),{'verbose':_0x6319d4[_0x309054(0x1c9)]});await handleSingleObjectOutput(_0x37f03d[_0x309054(0x1f4)],_0x6319d4);}else{if(_0x5ec205[_0x309054(0x1e3)]===_0x309054(0x1a5)){if(!_0x5ec205['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1cfe9b=await withSpinner(_0x309054(0x215),()=>_0x550247['segment'][_0x309054(0x202)](_0x5ec205[_0x309054(0x1f7)],_0x5ec205[_0x309054(0x22c)]),{'verbose':_0x6319d4[_0x309054(0x1c9)]});await handleSingleObjectOutput(_0x1cfe9b['data'],_0x6319d4);}}}return 0x0;}catch(_0x295195){if(_0x295195 instanceof SDKError)return console['error']('Error:\x20'+_0x295195['message']),_0x295195[_0x309054(0x1af)]&&console[_0x309054(0x1bc)](_0x309054(0x222)+_0x295195[_0x309054(0x1af)]),0x1;throw _0x295195;}}}export class SegmentShowCommand extends BaseCommand{['name']=a38_0x223978(0x1d7);[a38_0x223978(0x195)]=a38_0x223978(0x1fe);async[a38_0x223978(0x1cf)](_0x4c8601){const _0x2722f6=a38_0x223978,{options:_0x43b2b4,args:_0x2743fc,tdx:_0x44df71}=_0x4c8601,_0x4bffa2=_0x2743fc[0x0];if(!_0x4bffa2)return console['error'](_0x2722f6(0x1a1)),console[_0x2722f6(0x1bc)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console[_0x2722f6(0x1bc)](_0x2722f6(0x227)),console[_0x2722f6(0x1bc)](_0x2722f6(0x1fd)),console[_0x2722f6(0x1bc)](_0x2722f6(0x21d)),console[_0x2722f6(0x1bc)](_0x2722f6(0x212)),0x1;try{const _0x5a7b47=_0x43b2b4[_0x2722f6(0x20f)],_0x1b130b=await resolveSegmentTarget(_0x4bffa2,_0x5a7b47,_0x43b2b4[_0x2722f6(0x1c9)]);_0x43b2b4['verbose']&&console[_0x2722f6(0x1bc)](_0x2722f6(0x1e5)+_0x1b130b);const _0x17c0ba=await withSpinner(_0x2722f6(0x1e6)+_0x4bffa2+_0x2722f6(0x1be),()=>_0x44df71[_0x2722f6(0x1a5)][_0x2722f6(0x1bd)](_0x1b130b),{'verbose':_0x43b2b4[_0x2722f6(0x1c9)]}),_0x3b70bc=_0x17c0ba[_0x2722f6(0x1f4)];_0x43b2b4[_0x2722f6(0x1c9)]&&(console[_0x2722f6(0x1bc)]('Resolved\x20type:\x20'+_0x3b70bc[_0x2722f6(0x1e3)]),console['error'](_0x2722f6(0x1f2)+_0x3b70bc[_0x2722f6(0x1f7)]));if(_0x3b70bc[_0x2722f6(0x1e3)]===_0x2722f6(0x22b))return console[_0x2722f6(0x1bc)](_0x2722f6(0x199)),console['error'](_0x2722f6(0x1c0)),0x1;if(_0x3b70bc[_0x2722f6(0x1e3)]===_0x2722f6(0x232))return console[_0x2722f6(0x1bc)](_0x2722f6(0x22a)),console[_0x2722f6(0x1bc)](_0x2722f6(0x1b1)),0x1;if(!_0x3b70bc[_0x2722f6(0x22c)])throw new SDKError(ErrorCode[_0x2722f6(0x1a4)],_0x2722f6(0x1b7));const _0x1f9733=await withSpinner(_0x2722f6(0x214),()=>_0x44df71[_0x2722f6(0x1a5)][_0x2722f6(0x1c6)](_0x3b70bc['parentId'],_0x3b70bc['segmentId']),{'verbose':_0x43b2b4['verbose']});let _0x524d7a=_0x1f9733[_0x2722f6(0x1f4)];const _0x4257f4=resolveLimit(_0x43b2b4[_0x2722f6(0x1d8)],DEFAULT_DISPLAY_LIMIT),_0x7da067=/\bLIMIT\s+\d+/i[_0x2722f6(0x1f5)](_0x524d7a);!_0x7da067&&(_0x524d7a=_0x524d7a['trim']()[_0x2722f6(0x230)](/;+$/,''),_0x524d7a=_0x2722f6(0x1d4)+_0x524d7a+_0x2722f6(0x1e9)+_0x4257f4);_0x43b2b4['verbose']&&console[_0x2722f6(0x1bc)](_0x2722f6(0x200)+_0x524d7a);const _0xeb5a84=await withProgressSpinner('Executing\x20segment\x20query...',async _0x5daa7e=>{const _0x5ce3e3=_0x2722f6,_0x2332a2=await _0x44df71[_0x5ce3e3(0x1ef)][_0x5ce3e3(0x1cf)](_0x524d7a,{'catalog':'td','schema':_0x5ce3e3(0x22d),'onJobId':_0x4dbc5b=>{const _0x45ec01=_0x5ce3e3;_0x5daa7e[_0x45ec01(0x205)](_0x4dbc5b);}});return _0x2332a2;},{'verbose':_0x43b2b4[_0x2722f6(0x1c9)]}),_0x1cdef1=_0xeb5a84[_0x2722f6(0x1f4)],_0x3e3922=_0x1cdef1[_0x2722f6(0x223)]?_0x2722f6(0x216)+_0x1cdef1[_0x2722f6(0x223)]+']':'';return console[_0x2722f6(0x1bc)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x1cdef1['stats'][_0x2722f6(0x210)][_0x2722f6(0x20a)]()+'\x20rows\x20'+(_0x2722f6(0x1e2)+formatElapsed(_0x1cdef1['stats'][_0x2722f6(0x234)])+_0x3e3922)),await handleQueryOutput(_0x1cdef1,_0x43b2b4),0x0;}catch(_0x368d6e){if(_0x368d6e instanceof SDKError)return console[_0x2722f6(0x1bc)](_0x2722f6(0x1a9)+_0x368d6e[_0x2722f6(0x22f)]+']'),console[_0x2722f6(0x1bc)]('\x0a'+_0x368d6e[_0x2722f6(0x1ca)]),0x1;throw _0x368d6e;}}}export class SegmentFolderListCommand extends BaseCommand{[a38_0x223978(0x1ad)]=a38_0x223978(0x207);[a38_0x223978(0x195)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a38_0x223978(0x1cf)](_0x494927){const _0x54ec22=a38_0x223978,{options:_0x39c657,args:_0x4438e5,tdx:_0x1e1f9a}=_0x494927;if(_0x4438e5['length']===0x0)return console[_0x54ec22(0x1bc)](_0x54ec22(0x197)),console[_0x54ec22(0x1bc)](_0x54ec22(0x1cc)),0x1;const _0x2c4426=_0x4438e5[0x0];try{_0x39c657[_0x54ec22(0x1c9)]&&(console[_0x54ec22(0x1bc)](_0x54ec22(0x1c1)+_0x39c657[_0x54ec22(0x1d2)]),console['error']('Parent\x20name:\x20'+_0x2c4426));const _0x2ddd28=await withSpinner(_0x54ec22(0x1b5)+_0x2c4426+_0x54ec22(0x1be),()=>_0x1e1f9a['segment'][_0x54ec22(0x239)](_0x2c4426),{'verbose':_0x39c657['verbose']}),_0x184184=_0x2ddd28[_0x54ec22(0x1f4)];_0x39c657[_0x54ec22(0x1c9)]&&console[_0x54ec22(0x1bc)]('Resolved\x20parent\x20ID:\x20'+_0x184184);const _0x17628f=await withSpinner(_0x54ec22(0x231)+_0x2c4426+_0x54ec22(0x1be),()=>_0x1e1f9a['segment'][_0x54ec22(0x1c5)](_0x184184),{'verbose':_0x39c657[_0x54ec22(0x1c9)]}),_0x554afd=_0x17628f[_0x54ec22(0x1f4)];return console['error'](_0x54ec22(0x1a3)+_0x554afd[_0x54ec22(0x1fb)]+_0x54ec22(0x1c8)+(_0x554afd[_0x54ec22(0x1fb)]!==0x1?'s':'')),await handleSDKOutput(_0x554afd,_0x39c657),0x0;}catch(_0x583fae){if(_0x583fae instanceof SDKError)return console[_0x54ec22(0x1bc)](_0x54ec22(0x194)+_0x583fae[_0x54ec22(0x1ca)]),_0x583fae['cause']&&console[_0x54ec22(0x1bc)](_0x54ec22(0x222)+_0x583fae[_0x54ec22(0x1af)]),0x1;throw _0x583fae;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']='segment:folder:show';[a38_0x223978(0x195)]=a38_0x223978(0x1b4);async[a38_0x223978(0x1cf)](_0x48f710){const _0x5f2a90=a38_0x223978,{options:_0x59ce71,args:_0x21d8e9,tdx:_0x2d43b9}=_0x48f710;if(_0x21d8e9[_0x5f2a90(0x1fb)]===0x0)return console[_0x5f2a90(0x1bc)](_0x5f2a90(0x1d5)),console[_0x5f2a90(0x1bc)](_0x5f2a90(0x1c2)),0x1;try{const {parentId:_0x2d493d,childId:_0x347522}=parseSegmentRef(_0x21d8e9[0x0]);_0x59ce71['verbose']&&(console[_0x5f2a90(0x1bc)](_0x5f2a90(0x1c1)+_0x59ce71[_0x5f2a90(0x1d2)]),console[_0x5f2a90(0x1bc)]('Parent\x20name:\x20'+_0x2d493d),_0x347522&&console[_0x5f2a90(0x1bc)](_0x5f2a90(0x1ae)+_0x347522));if(!_0x347522)return console[_0x5f2a90(0x1bc)](_0x5f2a90(0x19c)),0x1;const _0x3057ba=await withSpinner(_0x5f2a90(0x1b5)+_0x2d493d+_0x5f2a90(0x1be),()=>_0x2d43b9[_0x5f2a90(0x1a5)][_0x5f2a90(0x239)](_0x2d493d),{'verbose':_0x59ce71[_0x5f2a90(0x1c9)]}),_0xff56d2=_0x3057ba[_0x5f2a90(0x1f4)];_0x59ce71[_0x5f2a90(0x1c9)]&&console['error'](_0x5f2a90(0x1ac)+_0xff56d2);const _0x17f4dd=await withSpinner(_0x5f2a90(0x1e8)+_0x347522+_0x5f2a90(0x1be),()=>_0x2d43b9[_0x5f2a90(0x1a5)][_0x5f2a90(0x1de)](_0xff56d2,_0x347522),{'verbose':_0x59ce71[_0x5f2a90(0x1c9)]}),_0x5c0360=_0x17f4dd[_0x5f2a90(0x1f4)];_0x59ce71[_0x5f2a90(0x1c9)]&&console[_0x5f2a90(0x1bc)](_0x5f2a90(0x1a8)+_0x5c0360);const _0x3a6baa=await withSpinner(_0x5f2a90(0x220)+_0x347522+_0x5f2a90(0x1be),()=>_0x2d43b9[_0x5f2a90(0x1a5)][_0x5f2a90(0x237)](_0x5c0360),{'verbose':_0x59ce71['verbose']});return await handleSDKOutput([_0x3a6baa[_0x5f2a90(0x1f4)]],_0x59ce71),0x0;}catch(_0x395e89){if(_0x395e89 instanceof SDKError)return console[_0x5f2a90(0x1bc)](_0x5f2a90(0x194)+_0x395e89[_0x5f2a90(0x1ca)]),_0x395e89[_0x5f2a90(0x1af)]&&console[_0x5f2a90(0x1bc)](_0x5f2a90(0x222)+_0x395e89[_0x5f2a90(0x1af)]),0x1;throw _0x395e89;}}}export class SegmentSQLCommand extends BaseCommand{[a38_0x223978(0x1ad)]=a38_0x223978(0x201);[a38_0x223978(0x195)]='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a38_0x223978(0x1cf)](_0x36ed64){const _0x50b414=a38_0x223978,{options:_0x811e20,args:_0x2665ae}=_0x36ed64,_0x30a134=_0x811e20,_0x315267=_0x30a134[_0x50b414(0x204)],_0x566530=_0x2665ae[0x0];if(!_0x566530&&!_0x315267)return console[_0x50b414(0x1bc)](a38_0x2a976e[_0x50b414(0x1bf)](_0x50b414(0x21b))),console['error'](_0x50b414(0x1d6)),console['error']('\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>'),console[_0x50b414(0x1bc)]('\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>'),console[_0x50b414(0x1bc)]('Examples:'),console[_0x50b414(0x1bc)](_0x50b414(0x1ee)),console[_0x50b414(0x1bc)](_0x50b414(0x1eb)),0x1;if(_0x566530&&_0x315267)return console['error'](a38_0x2a976e[_0x50b414(0x1bf)]('Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both')),0x1;try{let _0x24d534;if(_0x315267)_0x24d534=await this[_0x50b414(0x196)](_0x315267,_0x36ed64);else{if(isYamlFilePath(_0x566530))return console[_0x50b414(0x1bc)](a38_0x2a976e[_0x50b414(0x1bf)](_0x50b414(0x1dc))),console['error'](_0x50b414(0x229)+_0x566530),0x1;else _0x24d534=await this[_0x50b414(0x191)](_0x566530,_0x36ed64);}return _0x811e20[_0x50b414(0x213)]===_0x50b414(0x1a6)||_0x811e20[_0x50b414(0x213)]==='jsonl'?await handleSDKOutput([{'sql':_0x24d534}],_0x811e20):console['log'](_0x24d534),0x0;}catch(_0x24a0e6){if(_0x24a0e6 instanceof SDKError)return console['error'](_0x50b414(0x194)+_0x24a0e6['message']),_0x24a0e6[_0x50b414(0x1af)]&&console['error'](_0x50b414(0x222)+_0x24a0e6['cause']),0x1;throw _0x24a0e6;}}async[a38_0x223978(0x196)](_0x5048b4,_0x557e37){const _0x3b99ee=a38_0x223978,{options:_0x539dda,tdx:_0x504dea}=_0x557e37;let _0x34a25c;try{_0x34a25c=await resolveYamlFilePath(_0x5048b4);}catch(_0x122a2d){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x3b99ee(0x21e)+_0x122a2d[_0x3b99ee(0x1ca)]);}_0x539dda['verbose']&&console[_0x3b99ee(0x1bc)](_0x3b99ee(0x1e7)+_0x34a25c[_0x3b99ee(0x20f)]+'/'+_0x34a25c['segmentName']);const _0x21ac1e=await withSpinner(_0x3b99ee(0x1a7),()=>_0x504dea['segment'][_0x3b99ee(0x1f0)](_0x34a25c[_0x3b99ee(0x218)],_0x34a25c[_0x3b99ee(0x20f)],_0x34a25c[_0x3b99ee(0x1f1)]),{'verbose':_0x539dda[_0x3b99ee(0x1c9)]});return _0x21ac1e[_0x3b99ee(0x1f4)];}async[a38_0x223978(0x191)](_0x22d51d,_0x385e53){const _0x880fda=a38_0x223978,{options:_0x4befe9,tdx:_0x3d5db7}=_0x385e53,_0x2a14f=_0x4befe9[_0x880fda(0x20f)],_0x58e955=await resolveSegmentTarget(_0x22d51d,_0x2a14f,_0x4befe9['verbose']);_0x4befe9[_0x880fda(0x1c9)]&&console[_0x880fda(0x1bc)](_0x880fda(0x1e5)+_0x58e955);const _0xa18094=await withSpinner(_0x880fda(0x1e6)+_0x22d51d+_0x880fda(0x1be),()=>_0x3d5db7[_0x880fda(0x1a5)][_0x880fda(0x1bd)](_0x58e955),{'verbose':_0x4befe9[_0x880fda(0x1c9)]}),_0x3f1a87=_0xa18094[_0x880fda(0x1f4)];_0x4befe9[_0x880fda(0x1c9)]&&(console[_0x880fda(0x1bc)](_0x880fda(0x1fa)+_0x3f1a87['type']),console['error'](_0x880fda(0x1f2)+_0x3f1a87[_0x880fda(0x1f7)]));if(_0x3f1a87[_0x880fda(0x1e3)]===_0x880fda(0x22b))throw new SDKError(ErrorCode[_0x880fda(0x1c7)],'Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.');if(_0x3f1a87[_0x880fda(0x1e3)]==='parent')throw new SDKError(ErrorCode[_0x880fda(0x1c7)],_0x880fda(0x19a));if(!_0x3f1a87[_0x880fda(0x22c)])throw new SDKError(ErrorCode[_0x880fda(0x1a4)],_0x880fda(0x1b7));const _0x33afe3=await withSpinner(_0x880fda(0x214),()=>_0x3d5db7[_0x880fda(0x1a5)]['getSegmentSQL'](_0x3f1a87[_0x880fda(0x1f7)],_0x3f1a87[_0x880fda(0x22c)]),{'verbose':_0x4befe9[_0x880fda(0x1c9)]});return _0x33afe3[_0x880fda(0x1f4)];}}function a38_0xe748(){const _0x20c253=['Fetching\x20folder\x20\x27','/app/ps/','\x20\x20Cause:\x20','jobId','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','\x20Opening\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Show\x20folder\x20or\x20child\x20segment\x20details','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','folder','segmentId','information_schema','Usage:\x20tdx\x20segment\x20describe\x20<path>','code','replace','Listing\x20folders\x20for\x20parent\x20\x27','parent','(root)','elapsedTimeMillis','url','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','getFolder','createFolder','resolveParentId','94735YCDCZb','getSQLFromServerSegment','\x20\x20Folder\x20path:\x20','9401697YrkZnw','Error:\x20','description','getSQLFromYamlFile','Error:\x20Parent\x20segment\x20name\x20is\x20required','Resolved\x20YAML\x20file:\x20','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','819378XFIjqV','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','green','Resolved\x20parent\x20folder\x20ID:\x20','1521583VrchNu','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','folderPath','✔\x20Found\x20','SEGMENT_NOT_FOUND','segment','json','Fetching\x20SQL\x20from\x20rule...','Resolved\x20folder\x20ID:\x20','✖\x20Query\x20failed\x20[','Fetching\x20parent\x20segment\x20details...','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Resolved\x20parent\x20ID:\x20','name','Folder\x20name:\x20','cause','cyan','Use:\x20tdx\x20ps\x20show','fullPath','Creating\x20folder\x20\x27','Show\x20segment\x20folder\x20details','Resolving\x20parent\x20segment\x20\x27','Segment\x20ID:\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','includes','28770hSztmb','8004942mwsyQC','error','resolvePathToResource','\x27...','red','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Site:\x20','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Show\x20child\x20segment\x20schema\x20(column\x20types)','listFolders','getSegmentSQL','INVALID_ARGUMENT','\x20folder','verbose','message','/e/','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','40gPjiRU','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','execute','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','folderId','site','getParent','SELECT\x20*\x20FROM\x20(\x0a','Error:\x20Folder\x20reference\x20is\x20required','Usage:','segment:show','limit','Use:\x20tdx\x20ps\x20desc','segmentPath','\x20\x20Parent\x20segment:\x20','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','Resolving\x20path\x20\x27','resolveFolderId','Use:\x20tdx\x20ps\x20view','6BalcNt','Use:\x20tdx\x20ps\x20view\x20-w','in\x20','type','SEGMENT_FOLDER_NOT_FOUND','Target\x20path:\x20','Resolving\x20\x27','Resolved:\x20','Resolving\x20folder\x20\x27','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Create\x20segment\x20folder\x20for\x20organization','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','query','getSegmentSQLFromYaml','segmentName','Parent\x20ID:\x20','8wyqkpj','data','test','✔\x20Created\x20folder\x20\x27','parentId','Fetching\x20folder\x20details...','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Resolved\x20type:\x20','length','23PstSfk','Examples:','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','segment:describe','SQL\x20query:\x0a','segment:sql','getSegment','Error:\x20Path\x20or\x20name\x20is\x20required','path','setJobId','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','segment:folder:list','Options:','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','toLocaleString','4127410EqtrqO','\x27\x20with\x20ID:\x20','Usage:\x20tdx\x20sg\x20desc\x20<name>','Resolving\x20parent\x20folder\x20\x27','parentSegment','processedRows','Parent\x20segment:\x20','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','format','Fetching\x20SQL\x20for\x20segment...','Fetching\x20segment\x20details...','\x20[Job\x20ID:\x20','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','content','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','parentFolder','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'];a38_0xe748=function(){return _0x20c253;};return a38_0xe748();}export class SegmentFolderCreateCommand extends BaseCommand{[a38_0x223978(0x1ad)]='segment:folder:create';[a38_0x223978(0x195)]=a38_0x223978(0x1ec);async['execute'](_0x11b2de){const _0x4d51cc=a38_0x223978,{options:_0x17f785,args:_0x764346,tdx:_0x5ebac4}=_0x11b2de,_0x3d03c1=_0x17f785;if(_0x764346[_0x4d51cc(0x1fb)]<0x2)return console[_0x4d51cc(0x1bc)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console[_0x4d51cc(0x1bc)](_0x4d51cc(0x225)),0x1;const _0x548375=_0x764346[0x0],_0x1a2835=_0x764346[0x1];_0x3d03c1[_0x4d51cc(0x1c9)]&&(console[_0x4d51cc(0x1bc)](_0x4d51cc(0x1c1)+_0x3d03c1[_0x4d51cc(0x1d2)]),console['error'](_0x4d51cc(0x211)+_0x548375),console[_0x4d51cc(0x1bc)]('Folder\x20name:\x20'+_0x1a2835));let _0x2b4fac;if(_0x3d03c1[_0x4d51cc(0x21a)]){const _0x5c9333=_0x3d03c1[_0x4d51cc(0x21a)],_0x3b68d1=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x548375+_0x4d51cc(0x1be),()=>_0x5ebac4[_0x4d51cc(0x1a5)]['resolveParentId'](_0x548375),{'verbose':_0x3d03c1['verbose']}),_0xbf6e3f=_0x3b68d1[_0x4d51cc(0x1f4)],_0x15b348=await withSpinner(_0x4d51cc(0x20e)+_0x5c9333+_0x4d51cc(0x1be),()=>_0x5ebac4['segment'][_0x4d51cc(0x1de)](_0xbf6e3f,_0x5c9333),{'verbose':_0x3d03c1[_0x4d51cc(0x1c9)]});_0x2b4fac=_0x15b348[_0x4d51cc(0x1f4)],_0x3d03c1[_0x4d51cc(0x1c9)]&&console[_0x4d51cc(0x1bc)](_0x4d51cc(0x19f)+_0x2b4fac);}const _0x54bffa={'name':_0x1a2835,'description':_0x3d03c1[_0x4d51cc(0x195)],'parentFolderId':_0x2b4fac},_0x3b1d9f=await withSpinner(_0x4d51cc(0x1b3)+_0x1a2835+'\x27...',()=>_0x5ebac4[_0x4d51cc(0x1a5)][_0x4d51cc(0x238)](_0x548375,_0x54bffa),{'verbose':_0x3d03c1[_0x4d51cc(0x1c9)]}),_0x39c841=_0x3b1d9f[_0x4d51cc(0x1f4)];return console[_0x4d51cc(0x1bc)](_0x4d51cc(0x1f6)+_0x39c841[_0x4d51cc(0x1ad)]+_0x4d51cc(0x20c)+_0x39c841['id']),await handleSDKOutput([_0x39c841],_0x3d03c1),0x0;}}export class SegmentViewCommand extends BaseCommand{[a38_0x223978(0x1ad)]='segment:view';[a38_0x223978(0x195)]=a38_0x223978(0x228);async[a38_0x223978(0x1cf)](_0xbfb7d3){const _0x74e937=a38_0x223978,{options:_0x380ba7,args:_0xaa17a6,tdx:_0xf29343}=_0xbfb7d3,_0x1e247b=_0xaa17a6[0x0];if(!_0x1e247b)return console[_0x74e937(0x1bc)](_0x74e937(0x224)),console[_0x74e937(0x1bc)]('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console[_0x74e937(0x1bc)](_0x74e937(0x1ab)),console[_0x74e937(0x1bc)](_0x74e937(0x208)),console[_0x74e937(0x1bc)](_0x74e937(0x209)),console[_0x74e937(0x1bc)](_0x74e937(0x1fd)),console[_0x74e937(0x1bc)](_0x74e937(0x1ea)),console[_0x74e937(0x1bc)](_0x74e937(0x1ed)),console['error'](_0x74e937(0x219)),console[_0x74e937(0x1bc)](_0x74e937(0x21f)),0x1;try{const _0x3b8b7d=_0x380ba7[_0x74e937(0x20f)],_0x48f414=await resolveSegmentTarget(_0x1e247b,_0x3b8b7d,_0x380ba7[_0x74e937(0x1c9)]);_0x380ba7[_0x74e937(0x1c9)]&&console[_0x74e937(0x1bc)]('Target\x20path:\x20'+_0x48f414);const _0x5c3402=await withSpinner(_0x74e937(0x1e6)+_0x1e247b+_0x74e937(0x1be),()=>_0xf29343[_0x74e937(0x1a5)][_0x74e937(0x1bd)](_0x48f414),{'verbose':_0x380ba7[_0x74e937(0x1c9)]}),_0x596a88=_0x5c3402[_0x74e937(0x1f4)];_0x380ba7[_0x74e937(0x1c9)]&&(console['error'](_0x74e937(0x1fa)+_0x596a88[_0x74e937(0x1e3)]),console[_0x74e937(0x1bc)]('Parent\x20ID:\x20'+_0x596a88[_0x74e937(0x1f7)]),_0x596a88[_0x74e937(0x1d1)]&&console[_0x74e937(0x1bc)]('Folder\x20ID:\x20'+_0x596a88['folderId']),_0x596a88[_0x74e937(0x22c)]&&console[_0x74e937(0x1bc)](_0x74e937(0x1b6)+_0x596a88['segmentId']));if(_0x380ba7['web']){if(_0x596a88[_0x74e937(0x1e3)]==='folder')return console[_0x74e937(0x1bc)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x596a88[_0x74e937(0x1e3)]===_0x74e937(0x232))return console[_0x74e937(0x1bc)](_0x74e937(0x236)),console[_0x74e937(0x1bc)](_0x74e937(0x1e1)),0x1;if(!_0x596a88[_0x74e937(0x22c)])throw new SDKError(ErrorCode[_0x74e937(0x1a4)],_0x74e937(0x1b7));const _0x21b877=getConsoleNextUrl(_0x380ba7[_0x74e937(0x1d2)],_0x74e937(0x221)+_0x596a88[_0x74e937(0x1f7)]+_0x74e937(0x1cb)+_0x596a88[_0x74e937(0x22c)]);return console['error'](a38_0x2a976e[_0x74e937(0x19e)]('✔')+_0x74e937(0x226)+a38_0x2a976e[_0x74e937(0x1b0)](_0x21b877)),openBrowser(_0x21b877),0x0;}if(_0x596a88[_0x74e937(0x1e3)]===_0x74e937(0x22b)){if(!_0x596a88[_0x74e937(0x1d1)])throw new SDKError(ErrorCode[_0x74e937(0x1e4)],_0x74e937(0x1f9));const _0x5b3af9=await withSpinner(_0x74e937(0x1f8),()=>_0xf29343[_0x74e937(0x1a5)][_0x74e937(0x237)](_0x596a88[_0x74e937(0x1d1)]),{'verbose':_0x380ba7['verbose']});await handleSingleObjectOutput(_0x5b3af9[_0x74e937(0x1f4)],_0x380ba7);}else{if(_0x596a88[_0x74e937(0x1e3)]===_0x74e937(0x1a5)){if(!_0x596a88[_0x74e937(0x22c)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x549183=await withSpinner(_0x74e937(0x215),()=>_0xf29343[_0x74e937(0x1a5)][_0x74e937(0x202)](_0x596a88[_0x74e937(0x1f7)],_0x596a88[_0x74e937(0x22c)]),{'verbose':_0x380ba7['verbose']}),_0x4890d1=getConsoleNextUrl(_0x380ba7[_0x74e937(0x1d2)],'/app/ps/'+_0x596a88[_0x74e937(0x1f7)]+_0x74e937(0x1cb)+_0x596a88['segmentId']),_0x91fd06=_0x549183[_0x74e937(0x1f4)];_0x91fd06[_0x74e937(0x235)]=_0x4890d1,await handleSingleObjectOutput(_0x91fd06,_0x380ba7);}else return console[_0x74e937(0x1bc)](_0x74e937(0x1ce)),console['error'](_0x74e937(0x1df)),0x1;}return 0x0;}catch(_0x467c9d){if(_0x467c9d instanceof SDKError)return console[_0x74e937(0x1bc)](_0x74e937(0x194)+_0x467c9d['message']),_0x467c9d[_0x74e937(0x1af)]&&console[_0x74e937(0x1bc)](_0x74e937(0x222)+_0x467c9d[_0x74e937(0x1af)]),0x1;throw _0x467c9d;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a38_0x223978(0x1ad)]='segment:desc';['description']=a38_0x223978(0x1c4);async[a38_0x223978(0x1cf)](_0x22dfd1){const _0x2203bd=a38_0x223978,{options:_0x46ea30,args:_0x1225c5,tdx:_0x40c765}=_0x22dfd1,_0x1ed632=_0x1225c5[0x0];if(!_0x1ed632)return console[_0x2203bd(0x1bc)](_0x2203bd(0x1a1)),console[_0x2203bd(0x1bc)](_0x2203bd(0x20d)),console[_0x2203bd(0x1bc)](_0x2203bd(0x206)),console[_0x2203bd(0x1bc)]('Examples:'),console[_0x2203bd(0x1bc)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console['error']('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x49d6f5=_0x46ea30[_0x2203bd(0x20f)],_0x58554a=await resolveSegmentTarget(_0x1ed632,_0x49d6f5,_0x46ea30['verbose']);_0x46ea30[_0x2203bd(0x1c9)]&&console[_0x2203bd(0x1bc)]('Target\x20path:\x20'+_0x58554a);const _0x4ff23c=await withSpinner(_0x2203bd(0x1e6)+_0x1ed632+_0x2203bd(0x1be),()=>_0x40c765[_0x2203bd(0x1a5)][_0x2203bd(0x1bd)](_0x58554a),{'verbose':_0x46ea30[_0x2203bd(0x1c9)]}),_0x12eb7c=_0x4ff23c[_0x2203bd(0x1f4)];_0x46ea30[_0x2203bd(0x1c9)]&&(console['error']('Resolved\x20type:\x20'+_0x12eb7c[_0x2203bd(0x1e3)]),console['error'](_0x2203bd(0x1f2)+_0x12eb7c[_0x2203bd(0x1f7)]));if(_0x12eb7c[_0x2203bd(0x1e3)]==='folder')return console['error'](_0x2203bd(0x1c3)),console['error'](_0x2203bd(0x1d0)),0x1;if(_0x12eb7c[_0x2203bd(0x1e3)]===_0x2203bd(0x232))return console[_0x2203bd(0x1bc)](_0x2203bd(0x19d)),console[_0x2203bd(0x1bc)](_0x2203bd(0x1d9)),0x1;if(!_0x12eb7c['segmentId'])throw new SDKError(ErrorCode[_0x2203bd(0x1a4)],_0x2203bd(0x1b7));const _0x1c3faa=await withSpinner(_0x2203bd(0x214),()=>_0x40c765['segment'][_0x2203bd(0x1c6)](_0x12eb7c['parentId'],_0x12eb7c[_0x2203bd(0x22c)]),{'verbose':_0x46ea30[_0x2203bd(0x1c9)]}),_0x43a280=_0x1c3faa[_0x2203bd(0x1f4)],_0x541c12=await executeSchemaQuery(_0x43a280,_0x40c765,_0x46ea30);return await handleQueryOutput(_0x541c12,_0x46ea30),0x0;}catch(_0x3fe437){if(_0x3fe437 instanceof SDKError)return console[_0x2203bd(0x1bc)](_0x2203bd(0x194)+_0x3fe437['message']),_0x3fe437[_0x2203bd(0x1af)]&&console[_0x2203bd(0x1bc)](_0x2203bd(0x222)+_0x3fe437[_0x2203bd(0x1af)]),0x1;throw _0x3fe437;}}}
1
+ const a38_0x9ee07d=a38_0x1416;(function(_0x4c86b8,_0x3d8a9f){const _0x593893=a38_0x1416,_0x326b0f=_0x4c86b8();while(!![]){try{const _0x53220b=-parseInt(_0x593893(0x22d))/0x1+parseInt(_0x593893(0x1dd))/0x2*(parseInt(_0x593893(0x208))/0x3)+parseInt(_0x593893(0x1f2))/0x4+-parseInt(_0x593893(0x21b))/0x5*(parseInt(_0x593893(0x214))/0x6)+parseInt(_0x593893(0x207))/0x7+-parseInt(_0x593893(0x1d2))/0x8+-parseInt(_0x593893(0x23c))/0x9;if(_0x53220b===_0x3d8a9f)break;else _0x326b0f['push'](_0x326b0f['shift']());}catch(_0x2441c1){_0x326b0f['push'](_0x326b0f['shift']());}}}(a38_0xc163,0x8e8ac));import{BaseCommand}from'./command.js';function a38_0xc163(){const _0x57f70d=['segment','\x27...','Creating\x20folder\x20\x27','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Target\x20path:\x20','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','length','\x20\x20Full\x20path:\x20','parentFolder','\x20\x20Segment\x20name:\x20','635108IEXGHv','query','segmentPath','getFolder','getSegmentSQLFromYaml','listFolders','resolveFolderId','Resolving\x20folder\x20\x27','\x20[Job\x20ID:\x20','INVALID_ARGUMENT','segment:folder:create','Folder\x20ID:\x20','Resolved:\x20','Resolved\x20relative\x20path\x20to:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Folder\x20ID\x20missing\x20from\x20resolved\x20path','error','format','6050149jtoBnB','2686587WvJyyY','execute','Show\x20folder\x20or\x20child\x20segment\x20details','Examples:','Use:\x20tdx\x20ps\x20view','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','cause','\x20\x20Cause:\x20','getSegment','processedRows','Usage:','\x20rows\x20','3054dNBjxA','Listing\x20folders\x20for\x20parent\x20\x27','resolveParentId','message','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','limit','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','2065WeaPsT','SEGMENT_NOT_FOUND','getSQLFromYamlFile','description','Error:\x20Parent\x20segment\x20name\x20is\x20required','getSegmentSQL','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','SELECT\x20*\x20FROM\x20(\x0a','Resolved\x20parent\x20ID:\x20','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Resolving\x20parent\x20folder\x20\x27','Site:\x20','segment:folder:list','information_schema','Parent\x20ID:\x20','Parent\x20segment:\x20','in\x20','segmentId','453896pADcVd','Get\x20SQL\x20query\x20for\x20child\x20segment','Show\x20segment\x20folder\x20details','stats','Options:','\x20Opening\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Fetching\x20SQL\x20from\x20rule...','Resolving\x20path\x20\x27','data','setJobId','resolvePathToResource','\x20\x20Folder\x20path:\x20','test','segment:folder:show','1737855OQhOJO','SQL\x20query:\x0a','json','folderId','parentId','/app/ps/','fullPath','verbose','Executing\x20segment\x20query...','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','✖\x20Query\x20failed\x20[','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','SEGMENT_FOLDER_NOT_FOUND','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','parentSegment','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Resolved\x20YAML\x20file:\x20','segment:view','\x27\x20with\x20ID:\x20','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','getSQLFromServerSegment','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Segment\x20ID:\x20','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','✔\x20Created\x20folder\x20\x27','red','segment:desc','(root)','\x20\x20Parent\x20segment:\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Use:\x20tdx\x20ps\x20view\x20-w','Create\x20segment\x20folder\x20for\x20organization','Resolved\x20type:\x20','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Fetching\x20segment\x20details...','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','name','/e/','Use:\x20tdx\x20ps\x20desc','Fetching\x20SQL\x20for\x20segment...','Fetching\x20folder\x20details...','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','web','url','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','cyan','Resolving\x20\x27','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Resolved\x20parent\x20folder\x20ID:\x20','jobId','Resolved\x20folder\x20ID:\x20','Resolving\x20parent\x20segment\x20\x27','includes','segment:describe','Parent\x20name:\x20','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','3820424iXFtnP','Error:\x20Folder\x20reference\x20is\x20required','parent','log','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','folder','trim','Usage:\x20tdx\x20sg\x20desc\x20<name>','Show\x20segment\x20or\x20folder\x20details','Fetching\x20parent\x20segment\x20details...','type','2tUfUMh','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','✔\x20Found\x20','segment:show','path','toLocaleString','Error:\x20','site','Folder\x20name:\x20','segment:sql'];a38_0xc163=function(){return _0x57f70d;};return a38_0xc163();}function a38_0x1416(_0x3e6791,_0xc23bf2){_0x3e6791=_0x3e6791-0x1be;const _0xc163f=a38_0xc163();let _0x141687=_0xc163f[_0x3e6791];return _0x141687;}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_0x38b1b6 from'chalk';async function resolveSegmentTarget(_0x120171,_0x42128d,_0x4ade69){const _0x1a5e38=a38_0x1416;if(isYamlFilePath(_0x120171))try{const _0xd0cd29=await resolveYamlFilePath(_0x120171);return _0x4ade69&&(console['error'](_0x1a5e38(0x24e)+_0x120171),console['error'](_0x1a5e38(0x25b)+_0xd0cd29[_0x1a5e38(0x24b)]),console['error'](_0x1a5e38(0x1f1)+_0xd0cd29['segmentName']),console[_0x1a5e38(0x205)](_0x1a5e38(0x239)+(_0xd0cd29['folderPath']||_0x1a5e38(0x25a))),console[_0x1a5e38(0x205)](_0x1a5e38(0x1ef)+_0xd0cd29[_0x1a5e38(0x242)])),_0xd0cd29[_0x1a5e38(0x242)];}catch(_0x5c006c){throw new SDKError(ErrorCode[_0x1a5e38(0x1fb)],_0x1a5e38(0x1c0)+_0x5c006c[_0x1a5e38(0x217)]);}if(!_0x42128d)throw new SDKError(ErrorCode[_0x1a5e38(0x1fb)],_0x1a5e38(0x1de));return _0x42128d+'/'+_0x120171;}export class SegmentDescribeCommand extends BaseCommand{['name']=a38_0x9ee07d(0x1cc);[a38_0x9ee07d(0x21e)]=a38_0x9ee07d(0x1da);async[a38_0x9ee07d(0x209)](_0x2cdb7f){const _0x20d0b0=a38_0x9ee07d,{options:_0x13c7fc,args:_0x4f2f8f,tdx:_0xb348f9}=_0x2cdb7f,_0x55173f=_0x4f2f8f[0x0],_0x43e3a6=!_0x55173f&&!!_0x13c7fc[_0x20d0b0(0x24b)],_0x57bfac=_0x55173f||_0x13c7fc[_0x20d0b0(0x24b)];if(!_0x57bfac)return console[_0x20d0b0(0x205)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x20d0b0(0x205)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x20d0b0(0x205)](_0x20d0b0(0x20b)),console[_0x20d0b0(0x205)](_0x20d0b0(0x233)),console[_0x20d0b0(0x205)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console[_0x20d0b0(0x205)](_0x20d0b0(0x1c3)),console[_0x20d0b0(0x205)](_0x20d0b0(0x221)),0x1;try{const _0x145b1f=_0x13c7fc[_0x20d0b0(0x1f4)];let _0x3d7872=_0x57bfac;!_0x43e3a6&&_0x145b1f&&!_0x57bfac[_0x20d0b0(0x1cb)]('/')&&(_0x3d7872=_0x145b1f+'/'+_0x57bfac,_0x13c7fc[_0x20d0b0(0x243)]&&console[_0x20d0b0(0x205)](_0x20d0b0(0x1ff)+_0x3d7872));const _0x5c58ad=await withSpinner(_0x20d0b0(0x235)+_0x3d7872+_0x20d0b0(0x1e8),()=>_0xb348f9[_0x20d0b0(0x1e7)]['resolvePathToResource'](_0x3d7872),{'verbose':_0x13c7fc[_0x20d0b0(0x243)]}),_0x241861=_0x5c58ad[_0x20d0b0(0x236)];_0x13c7fc[_0x20d0b0(0x243)]&&(console['error'](_0x20d0b0(0x260)+_0x241861[_0x20d0b0(0x1dc)]),console['error'](_0x20d0b0(0x229)+_0x241861['parentId']),_0x241861[_0x20d0b0(0x23f)]&&console[_0x20d0b0(0x205)](_0x20d0b0(0x1fd)+_0x241861['folderId']),_0x241861[_0x20d0b0(0x22c)]&&console[_0x20d0b0(0x205)](_0x20d0b0(0x255)+_0x241861['segmentId']));if(_0x241861['type']===_0x20d0b0(0x1d4)){const _0x4b457e=await withSpinner(_0x20d0b0(0x1db),()=>_0xb348f9[_0x20d0b0(0x1e7)]['getParent'](_0x241861[_0x20d0b0(0x240)]),{'verbose':_0x13c7fc[_0x20d0b0(0x243)]});await handleSingleObjectOutput(_0x4b457e[_0x20d0b0(0x236)],_0x13c7fc);}else{if(_0x241861[_0x20d0b0(0x1dc)]===_0x20d0b0(0x1d7)){if(!_0x241861[_0x20d0b0(0x23f)])throw new SDKError(ErrorCode[_0x20d0b0(0x249)],_0x20d0b0(0x204));const _0x102869=await withSpinner(_0x20d0b0(0x1bf),()=>_0xb348f9[_0x20d0b0(0x1e7)][_0x20d0b0(0x1f5)](_0x241861['folderId']),{'verbose':_0x13c7fc['verbose']});await handleSingleObjectOutput(_0x102869[_0x20d0b0(0x236)],_0x13c7fc);}else{if(_0x241861[_0x20d0b0(0x1dc)]===_0x20d0b0(0x1e7)){if(!_0x241861['segmentId'])throw new SDKError(ErrorCode[_0x20d0b0(0x21c)],_0x20d0b0(0x254));const _0x1a57fa=await withSpinner(_0x20d0b0(0x262),()=>_0xb348f9[_0x20d0b0(0x1e7)]['getSegment'](_0x241861[_0x20d0b0(0x240)],_0x241861[_0x20d0b0(0x22c)]),{'verbose':_0x13c7fc[_0x20d0b0(0x243)]});await handleSingleObjectOutput(_0x1a57fa[_0x20d0b0(0x236)],_0x13c7fc);}}}return 0x0;}catch(_0x47ecb1){if(_0x47ecb1 instanceof SDKError)return console[_0x20d0b0(0x205)](_0x20d0b0(0x1e3)+_0x47ecb1[_0x20d0b0(0x217)]),_0x47ecb1[_0x20d0b0(0x20e)]&&console[_0x20d0b0(0x205)](_0x20d0b0(0x20f)+_0x47ecb1[_0x20d0b0(0x20e)]),0x1;throw _0x47ecb1;}}}export class SegmentShowCommand extends BaseCommand{[a38_0x9ee07d(0x266)]=a38_0x9ee07d(0x1e0);[a38_0x9ee07d(0x21e)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a38_0x9ee07d(0x209)](_0x1d7bb4){const _0x44ed0a=a38_0x9ee07d,{options:_0x304cd0,args:_0x2846e8,tdx:_0x397b85}=_0x1d7bb4,_0x32a616=_0x2846e8[0x0];if(!_0x32a616)return console[_0x44ed0a(0x205)](_0x44ed0a(0x25c)),console['error']('Usage:\x20tdx\x20sg\x20show\x20<name>'),console[_0x44ed0a(0x205)](_0x44ed0a(0x252)),console['error'](_0x44ed0a(0x20b)),console['error'](_0x44ed0a(0x202)),console[_0x44ed0a(0x205)](_0x44ed0a(0x1d1)),0x1;try{const _0x755ab6=_0x304cd0[_0x44ed0a(0x24b)],_0x5886a2=await resolveSegmentTarget(_0x32a616,_0x755ab6,_0x304cd0['verbose']);_0x304cd0[_0x44ed0a(0x243)]&&console['error'](_0x44ed0a(0x1ec)+_0x5886a2);const _0x18be51=await withSpinner('Resolving\x20\x27'+_0x32a616+_0x44ed0a(0x1e8),()=>_0x397b85[_0x44ed0a(0x1e7)][_0x44ed0a(0x238)](_0x5886a2),{'verbose':_0x304cd0[_0x44ed0a(0x243)]}),_0x108e9d=_0x18be51[_0x44ed0a(0x236)];_0x304cd0[_0x44ed0a(0x243)]&&(console['error'](_0x44ed0a(0x260)+_0x108e9d['type']),console['error'](_0x44ed0a(0x229)+_0x108e9d['parentId']));if(_0x108e9d[_0x44ed0a(0x1dc)]==='folder')return console[_0x44ed0a(0x205)](_0x44ed0a(0x256)),console[_0x44ed0a(0x205)](_0x44ed0a(0x1d6)),0x1;if(_0x108e9d[_0x44ed0a(0x1dc)]===_0x44ed0a(0x1d4))return console[_0x44ed0a(0x205)](_0x44ed0a(0x263)),console[_0x44ed0a(0x205)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x108e9d[_0x44ed0a(0x22c)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x44ed0a(0x254));const _0xf948b=await withSpinner(_0x44ed0a(0x1be),()=>_0x397b85[_0x44ed0a(0x1e7)][_0x44ed0a(0x220)](_0x108e9d['parentId'],_0x108e9d['segmentId']),{'verbose':_0x304cd0[_0x44ed0a(0x243)]});let _0x3d0956=_0xf948b[_0x44ed0a(0x236)];const _0x40071f=resolveLimit(_0x304cd0[_0x44ed0a(0x219)],DEFAULT_DISPLAY_LIMIT),_0x3ac17b=/\bLIMIT\s+\d+/i[_0x44ed0a(0x23a)](_0x3d0956);!_0x3ac17b&&(_0x3d0956=_0x3d0956[_0x44ed0a(0x1d8)]()['replace'](/;+$/,''),_0x3d0956=_0x44ed0a(0x222)+_0x3d0956+_0x44ed0a(0x20d)+_0x40071f);_0x304cd0[_0x44ed0a(0x243)]&&console[_0x44ed0a(0x205)](_0x44ed0a(0x23d)+_0x3d0956);const _0x51057b=await withProgressSpinner(_0x44ed0a(0x244),async _0x3c94b6=>{const _0x5d89e9=_0x44ed0a,_0x126573=await _0x397b85[_0x5d89e9(0x1f3)][_0x5d89e9(0x209)](_0x3d0956,{'catalog':'td','schema':_0x5d89e9(0x228),'onJobId':_0x1ff11b=>{const _0x42766a=_0x5d89e9;_0x3c94b6[_0x42766a(0x237)](_0x1ff11b);}});return _0x126573;},{'verbose':_0x304cd0[_0x44ed0a(0x243)]}),_0x35d488=_0x51057b[_0x44ed0a(0x236)],_0x558220=_0x35d488[_0x44ed0a(0x1c8)]?_0x44ed0a(0x1fa)+_0x35d488[_0x44ed0a(0x1c8)]+']':'';return console['error']('✔\x20Query\x20completed:\x20Processed\x20'+_0x35d488[_0x44ed0a(0x230)][_0x44ed0a(0x211)][_0x44ed0a(0x1e2)]()+_0x44ed0a(0x213)+(_0x44ed0a(0x22b)+formatElapsed(_0x35d488[_0x44ed0a(0x230)]['elapsedTimeMillis'])+_0x558220)),await handleQueryOutput(_0x35d488,_0x304cd0),0x0;}catch(_0x4889bc){if(_0x4889bc instanceof SDKError)return console[_0x44ed0a(0x205)](_0x44ed0a(0x247)+_0x4889bc['code']+']'),console[_0x44ed0a(0x205)]('\x0a'+_0x4889bc[_0x44ed0a(0x217)]),0x1;throw _0x4889bc;}}}export class SegmentFolderListCommand extends BaseCommand{['name']=a38_0x9ee07d(0x227);['description']=a38_0x9ee07d(0x1ea);async['execute'](_0xc098d7){const _0x337b21=a38_0x9ee07d,{options:_0xbf328a,args:_0x529964,tdx:_0x5d66e0}=_0xc098d7;if(_0x529964[_0x337b21(0x1ee)]===0x0)return console[_0x337b21(0x205)](_0x337b21(0x21f)),console[_0x337b21(0x205)](_0x337b21(0x24c)),0x1;const _0x28271=_0x529964[0x0];try{_0xbf328a['verbose']&&(console[_0x337b21(0x205)](_0x337b21(0x226)+_0xbf328a[_0x337b21(0x1e4)]),console[_0x337b21(0x205)](_0x337b21(0x1cd)+_0x28271));const _0x115c4a=await withSpinner(_0x337b21(0x1ca)+_0x28271+_0x337b21(0x1e8),()=>_0x5d66e0[_0x337b21(0x1e7)]['resolveParentId'](_0x28271),{'verbose':_0xbf328a[_0x337b21(0x243)]}),_0xecd3=_0x115c4a['data'];_0xbf328a[_0x337b21(0x243)]&&console['error'](_0x337b21(0x223)+_0xecd3);const _0x27dad9=await withSpinner(_0x337b21(0x215)+_0x28271+'\x27...',()=>_0x5d66e0[_0x337b21(0x1e7)][_0x337b21(0x1f7)](_0xecd3),{'verbose':_0xbf328a['verbose']}),_0x58307b=_0x27dad9[_0x337b21(0x236)];return console[_0x337b21(0x205)](_0x337b21(0x1df)+_0x58307b[_0x337b21(0x1ee)]+'\x20folder'+(_0x58307b[_0x337b21(0x1ee)]!==0x1?'s':'')),await handleSDKOutput(_0x58307b,_0xbf328a),0x0;}catch(_0x4d2de7){if(_0x4d2de7 instanceof SDKError)return console[_0x337b21(0x205)](_0x337b21(0x1e3)+_0x4d2de7['message']),_0x4d2de7[_0x337b21(0x20e)]&&console[_0x337b21(0x205)](_0x337b21(0x20f)+_0x4d2de7['cause']),0x1;throw _0x4d2de7;}}}export class SegmentFolderShowCommand extends BaseCommand{[a38_0x9ee07d(0x266)]=a38_0x9ee07d(0x23b);[a38_0x9ee07d(0x21e)]=a38_0x9ee07d(0x22f);async[a38_0x9ee07d(0x209)](_0x82fc5e){const _0x15de1a=a38_0x9ee07d,{options:_0x2fd0bc,args:_0x594eab,tdx:_0x4907bf}=_0x82fc5e;if(_0x594eab[_0x15de1a(0x1ee)]===0x0)return console[_0x15de1a(0x205)](_0x15de1a(0x1d3)),console[_0x15de1a(0x205)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x58a260,childId:_0x539a87}=parseSegmentRef(_0x594eab[0x0]);_0x2fd0bc[_0x15de1a(0x243)]&&(console[_0x15de1a(0x205)](_0x15de1a(0x226)+_0x2fd0bc[_0x15de1a(0x1e4)]),console[_0x15de1a(0x205)](_0x15de1a(0x1cd)+_0x58a260),_0x539a87&&console[_0x15de1a(0x205)]('Folder\x20name:\x20'+_0x539a87));if(!_0x539a87)return console[_0x15de1a(0x205)](_0x15de1a(0x24d)),0x1;const _0x186d69=await withSpinner(_0x15de1a(0x1ca)+_0x58a260+_0x15de1a(0x1e8),()=>_0x4907bf['segment'][_0x15de1a(0x216)](_0x58a260),{'verbose':_0x2fd0bc[_0x15de1a(0x243)]}),_0x593ece=_0x186d69[_0x15de1a(0x236)];_0x2fd0bc[_0x15de1a(0x243)]&&console[_0x15de1a(0x205)](_0x15de1a(0x223)+_0x593ece);const _0x554d3c=await withSpinner(_0x15de1a(0x1f9)+_0x539a87+_0x15de1a(0x1e8),()=>_0x4907bf[_0x15de1a(0x1e7)][_0x15de1a(0x1f8)](_0x593ece,_0x539a87),{'verbose':_0x2fd0bc[_0x15de1a(0x243)]}),_0x11fa44=_0x554d3c['data'];_0x2fd0bc[_0x15de1a(0x243)]&&console['error'](_0x15de1a(0x1c9)+_0x11fa44);const _0x3608d8=await withSpinner('Fetching\x20folder\x20\x27'+_0x539a87+_0x15de1a(0x1e8),()=>_0x4907bf['segment'][_0x15de1a(0x1f5)](_0x11fa44),{'verbose':_0x2fd0bc[_0x15de1a(0x243)]});return await handleSDKOutput([_0x3608d8['data']],_0x2fd0bc),0x0;}catch(_0x119453){if(_0x119453 instanceof SDKError)return console[_0x15de1a(0x205)](_0x15de1a(0x1e3)+_0x119453[_0x15de1a(0x217)]),_0x119453[_0x15de1a(0x20e)]&&console[_0x15de1a(0x205)](_0x15de1a(0x20f)+_0x119453[_0x15de1a(0x20e)]),0x1;throw _0x119453;}}}export class SegmentSQLCommand extends BaseCommand{[a38_0x9ee07d(0x266)]=a38_0x9ee07d(0x1e6);[a38_0x9ee07d(0x21e)]=a38_0x9ee07d(0x22e);async[a38_0x9ee07d(0x209)](_0x257238){const _0x47d7f6=a38_0x9ee07d,{options:_0x58e7b9,args:_0xcf78b0}=_0x257238,_0x2d899d=_0x58e7b9,_0x5d2473=_0x2d899d[_0x47d7f6(0x1e1)],_0x37af8b=_0xcf78b0[0x0];if(!_0x37af8b&&!_0x5d2473)return console[_0x47d7f6(0x205)](a38_0x38b1b6['red'](_0x47d7f6(0x264))),console[_0x47d7f6(0x205)](_0x47d7f6(0x212)),console['error'](_0x47d7f6(0x218)),console[_0x47d7f6(0x205)](_0x47d7f6(0x1d0)),console[_0x47d7f6(0x205)](_0x47d7f6(0x20b)),console[_0x47d7f6(0x205)]('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x47d7f6(0x205)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml'),0x1;if(_0x37af8b&&_0x5d2473)return console[_0x47d7f6(0x205)](a38_0x38b1b6[_0x47d7f6(0x258)]('Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both')),0x1;try{let _0x6fcb5a;if(_0x5d2473)_0x6fcb5a=await this[_0x47d7f6(0x21d)](_0x5d2473,_0x257238);else{if(isYamlFilePath(_0x37af8b))return console[_0x47d7f6(0x205)](a38_0x38b1b6[_0x47d7f6(0x258)](_0x47d7f6(0x251))),console[_0x47d7f6(0x205)](_0x47d7f6(0x25d)+_0x37af8b),0x1;else _0x6fcb5a=await this[_0x47d7f6(0x253)](_0x37af8b,_0x257238);}return _0x58e7b9['format']===_0x47d7f6(0x23e)||_0x58e7b9[_0x47d7f6(0x206)]==='jsonl'?await handleSDKOutput([{'sql':_0x6fcb5a}],_0x58e7b9):console[_0x47d7f6(0x1d5)](_0x6fcb5a),0x0;}catch(_0x2779e3){if(_0x2779e3 instanceof SDKError)return console[_0x47d7f6(0x205)](_0x47d7f6(0x1e3)+_0x2779e3['message']),_0x2779e3[_0x47d7f6(0x20e)]&&console[_0x47d7f6(0x205)](_0x47d7f6(0x20f)+_0x2779e3[_0x47d7f6(0x20e)]),0x1;throw _0x2779e3;}}async[a38_0x9ee07d(0x21d)](_0x21ab12,_0x5b9c20){const _0x2088ba=a38_0x9ee07d,{options:_0xf52ce9,tdx:_0x4acaa4}=_0x5b9c20;let _0x2010c2;try{_0x2010c2=await resolveYamlFilePath(_0x21ab12);}catch(_0x5b1954){throw new SDKError(ErrorCode[_0x2088ba(0x1fb)],_0x2088ba(0x1c0)+_0x5b1954[_0x2088ba(0x217)]);}_0xf52ce9[_0x2088ba(0x243)]&&console[_0x2088ba(0x205)](_0x2088ba(0x1fe)+_0x2010c2[_0x2088ba(0x24b)]+'/'+_0x2010c2['segmentName']);const _0x1c849b=await withSpinner(_0x2088ba(0x234),()=>_0x4acaa4['segment'][_0x2088ba(0x1f6)](_0x2010c2['content'],_0x2010c2['parentSegment'],_0x2010c2['segmentName']),{'verbose':_0xf52ce9[_0x2088ba(0x243)]});return _0x1c849b[_0x2088ba(0x236)];}async[a38_0x9ee07d(0x253)](_0x14d0ab,_0x282a89){const _0x5e5ea8=a38_0x9ee07d,{options:_0xca6699,tdx:_0x5b0cb7}=_0x282a89,_0xdcadb=_0xca6699['parentSegment'],_0x4917a2=await resolveSegmentTarget(_0x14d0ab,_0xdcadb,_0xca6699[_0x5e5ea8(0x243)]);_0xca6699[_0x5e5ea8(0x243)]&&console[_0x5e5ea8(0x205)]('Target\x20path:\x20'+_0x4917a2);const _0x47573b=await withSpinner(_0x5e5ea8(0x1c5)+_0x14d0ab+_0x5e5ea8(0x1e8),()=>_0x5b0cb7['segment'][_0x5e5ea8(0x238)](_0x4917a2),{'verbose':_0xca6699['verbose']}),_0x35374c=_0x47573b[_0x5e5ea8(0x236)];_0xca6699[_0x5e5ea8(0x243)]&&(console['error'](_0x5e5ea8(0x260)+_0x35374c[_0x5e5ea8(0x1dc)]),console[_0x5e5ea8(0x205)](_0x5e5ea8(0x229)+_0x35374c[_0x5e5ea8(0x240)]));if(_0x35374c[_0x5e5ea8(0x1dc)]===_0x5e5ea8(0x1d7))throw new SDKError(ErrorCode[_0x5e5ea8(0x1fb)],_0x5e5ea8(0x201));if(_0x35374c[_0x5e5ea8(0x1dc)]==='parent')throw new SDKError(ErrorCode[_0x5e5ea8(0x1fb)],_0x5e5ea8(0x245));if(!_0x35374c[_0x5e5ea8(0x22c)])throw new SDKError(ErrorCode[_0x5e5ea8(0x21c)],_0x5e5ea8(0x254));const _0x152430=await withSpinner(_0x5e5ea8(0x1be),()=>_0x5b0cb7[_0x5e5ea8(0x1e7)][_0x5e5ea8(0x220)](_0x35374c[_0x5e5ea8(0x240)],_0x35374c[_0x5e5ea8(0x22c)]),{'verbose':_0xca6699[_0x5e5ea8(0x243)]});return _0x152430[_0x5e5ea8(0x236)];}}export class SegmentFolderCreateCommand extends BaseCommand{['name']=a38_0x9ee07d(0x1fc);[a38_0x9ee07d(0x21e)]=a38_0x9ee07d(0x25f);async['execute'](_0x331c58){const _0x317d16=a38_0x9ee07d,{options:_0x4e5936,args:_0x3416a0,tdx:_0x3c0d97}=_0x331c58,_0x3be43d=_0x4e5936;if(_0x3416a0[_0x317d16(0x1ee)]<0x2)return console[_0x317d16(0x205)](_0x317d16(0x224)),console['error'](_0x317d16(0x1ed)),0x1;const _0x40c603=_0x3416a0[0x0],_0xa898ef=_0x3416a0[0x1];_0x3be43d['verbose']&&(console[_0x317d16(0x205)]('Site:\x20'+_0x3be43d[_0x317d16(0x1e4)]),console[_0x317d16(0x205)](_0x317d16(0x22a)+_0x40c603),console[_0x317d16(0x205)](_0x317d16(0x1e5)+_0xa898ef));let _0x4a529f;if(_0x3be43d[_0x317d16(0x1f0)]){const _0x53c8c9=_0x3be43d['parentFolder'],_0x42a78e=await withSpinner(_0x317d16(0x1ca)+_0x40c603+'\x27...',()=>_0x3c0d97[_0x317d16(0x1e7)][_0x317d16(0x216)](_0x40c603),{'verbose':_0x3be43d['verbose']}),_0x3ab782=_0x42a78e[_0x317d16(0x236)],_0x9ecf06=await withSpinner(_0x317d16(0x225)+_0x53c8c9+'\x27...',()=>_0x3c0d97[_0x317d16(0x1e7)]['resolveFolderId'](_0x3ab782,_0x53c8c9),{'verbose':_0x3be43d['verbose']});_0x4a529f=_0x9ecf06[_0x317d16(0x236)],_0x3be43d[_0x317d16(0x243)]&&console['error'](_0x317d16(0x1c7)+_0x4a529f);}const _0x46913c={'name':_0xa898ef,'description':_0x3be43d[_0x317d16(0x21e)],'parentFolderId':_0x4a529f},_0x392506=await withSpinner(_0x317d16(0x1e9)+_0xa898ef+_0x317d16(0x1e8),()=>_0x3c0d97[_0x317d16(0x1e7)]['createFolder'](_0x40c603,_0x46913c),{'verbose':_0x3be43d['verbose']}),_0x34d518=_0x392506[_0x317d16(0x236)];return console[_0x317d16(0x205)](_0x317d16(0x257)+_0x34d518[_0x317d16(0x266)]+_0x317d16(0x250)+_0x34d518['id']),await handleSDKOutput([_0x34d518],_0x3be43d),0x0;}}export class SegmentViewCommand extends BaseCommand{[a38_0x9ee07d(0x266)]=a38_0x9ee07d(0x24f);[a38_0x9ee07d(0x21e)]=a38_0x9ee07d(0x20a);async[a38_0x9ee07d(0x209)](_0x2e286c){const _0x1411de=a38_0x9ee07d,{options:_0x27b93c,args:_0x1f226c,tdx:_0x34d2b6}=_0x2e286c,_0x391714=_0x1f226c[0x0];if(!_0x391714)return console[_0x1411de(0x205)](_0x1411de(0x1ce)),console[_0x1411de(0x205)](_0x1411de(0x246)),console[_0x1411de(0x205)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console['error'](_0x1411de(0x231)),console[_0x1411de(0x205)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x1411de(0x205)](_0x1411de(0x20b)),console[_0x1411de(0x205)](_0x1411de(0x21a)),console[_0x1411de(0x205)](_0x1411de(0x1cf)),console[_0x1411de(0x205)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console['error'](_0x1411de(0x261)),0x1;try{const _0x54bf02=_0x27b93c['parentSegment'],_0x41e268=await resolveSegmentTarget(_0x391714,_0x54bf02,_0x27b93c[_0x1411de(0x243)]);_0x27b93c[_0x1411de(0x243)]&&console[_0x1411de(0x205)](_0x1411de(0x1ec)+_0x41e268);const _0x3ab544=await withSpinner(_0x1411de(0x1c5)+_0x391714+'\x27...',()=>_0x34d2b6[_0x1411de(0x1e7)]['resolvePathToResource'](_0x41e268),{'verbose':_0x27b93c['verbose']}),_0x5013f8=_0x3ab544[_0x1411de(0x236)];_0x27b93c[_0x1411de(0x243)]&&(console['error'](_0x1411de(0x260)+_0x5013f8[_0x1411de(0x1dc)]),console[_0x1411de(0x205)]('Parent\x20ID:\x20'+_0x5013f8[_0x1411de(0x240)]),_0x5013f8[_0x1411de(0x23f)]&&console[_0x1411de(0x205)](_0x1411de(0x1fd)+_0x5013f8[_0x1411de(0x23f)]),_0x5013f8[_0x1411de(0x22c)]&&console[_0x1411de(0x205)]('Segment\x20ID:\x20'+_0x5013f8['segmentId']));if(_0x27b93c[_0x1411de(0x1c1)]){if(_0x5013f8['type']===_0x1411de(0x1d7))return console[_0x1411de(0x205)](_0x1411de(0x203)),0x1;if(_0x5013f8[_0x1411de(0x1dc)]==='parent')return console[_0x1411de(0x205)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x1411de(0x205)](_0x1411de(0x25e)),0x1;if(!_0x5013f8[_0x1411de(0x22c)])throw new SDKError(ErrorCode[_0x1411de(0x21c)],_0x1411de(0x254));const _0x432cf1=getConsoleNextUrl(_0x27b93c['site'],_0x1411de(0x241)+_0x5013f8[_0x1411de(0x240)]+_0x1411de(0x267)+_0x5013f8[_0x1411de(0x22c)]);return console[_0x1411de(0x205)](a38_0x38b1b6['green']('✔')+_0x1411de(0x232)+a38_0x38b1b6[_0x1411de(0x1c4)](_0x432cf1)),openBrowser(_0x432cf1),0x0;}if(_0x5013f8['type']==='folder'){if(!_0x5013f8['folderId'])throw new SDKError(ErrorCode[_0x1411de(0x249)],_0x1411de(0x204));const _0x116d89=await withSpinner(_0x1411de(0x1bf),()=>_0x34d2b6['segment'][_0x1411de(0x1f5)](_0x5013f8['folderId']),{'verbose':_0x27b93c['verbose']});await handleSingleObjectOutput(_0x116d89[_0x1411de(0x236)],_0x27b93c);}else{if(_0x5013f8[_0x1411de(0x1dc)]===_0x1411de(0x1e7)){if(!_0x5013f8['segmentId'])throw new SDKError(ErrorCode[_0x1411de(0x21c)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x43a70f=await withSpinner(_0x1411de(0x262),()=>_0x34d2b6[_0x1411de(0x1e7)][_0x1411de(0x210)](_0x5013f8[_0x1411de(0x240)],_0x5013f8[_0x1411de(0x22c)]),{'verbose':_0x27b93c[_0x1411de(0x243)]}),_0x76466b=getConsoleNextUrl(_0x27b93c[_0x1411de(0x1e4)],_0x1411de(0x241)+_0x5013f8[_0x1411de(0x240)]+_0x1411de(0x267)+_0x5013f8[_0x1411de(0x22c)]),_0x50caa3=_0x43a70f[_0x1411de(0x236)];_0x50caa3[_0x1411de(0x1c2)]=_0x76466b,await handleSingleObjectOutput(_0x50caa3,_0x27b93c);}else return console[_0x1411de(0x205)](_0x1411de(0x1eb)),console[_0x1411de(0x205)](_0x1411de(0x20c)),0x1;}return 0x0;}catch(_0x364264){if(_0x364264 instanceof SDKError)return console[_0x1411de(0x205)](_0x1411de(0x1e3)+_0x364264[_0x1411de(0x217)]),_0x364264[_0x1411de(0x20e)]&&console[_0x1411de(0x205)](_0x1411de(0x20f)+_0x364264['cause']),0x1;throw _0x364264;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a38_0x9ee07d(0x266)]=a38_0x9ee07d(0x259);[a38_0x9ee07d(0x21e)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async[a38_0x9ee07d(0x209)](_0x311722){const _0xd6b813=a38_0x9ee07d,{options:_0x5ccce4,args:_0x1dccc9,tdx:_0x134492}=_0x311722,_0x36678e=_0x1dccc9[0x0];if(!_0x36678e)return console[_0xd6b813(0x205)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error'](_0xd6b813(0x1d9)),console[_0xd6b813(0x205)](_0xd6b813(0x265)),console[_0xd6b813(0x205)]('Examples:'),console[_0xd6b813(0x205)](_0xd6b813(0x248)),console[_0xd6b813(0x205)](_0xd6b813(0x1c6)),0x1;try{const _0xd266d5=_0x5ccce4[_0xd6b813(0x24b)],_0x1c0180=await resolveSegmentTarget(_0x36678e,_0xd266d5,_0x5ccce4['verbose']);_0x5ccce4[_0xd6b813(0x243)]&&console[_0xd6b813(0x205)](_0xd6b813(0x1ec)+_0x1c0180);const _0x3d75c0=await withSpinner(_0xd6b813(0x1c5)+_0x36678e+_0xd6b813(0x1e8),()=>_0x134492[_0xd6b813(0x1e7)][_0xd6b813(0x238)](_0x1c0180),{'verbose':_0x5ccce4[_0xd6b813(0x243)]}),_0x53d665=_0x3d75c0[_0xd6b813(0x236)];_0x5ccce4[_0xd6b813(0x243)]&&(console[_0xd6b813(0x205)](_0xd6b813(0x260)+_0x53d665['type']),console[_0xd6b813(0x205)](_0xd6b813(0x229)+_0x53d665[_0xd6b813(0x240)]));if(_0x53d665[_0xd6b813(0x1dc)]==='folder')return console['error'](_0xd6b813(0x24a)),console[_0xd6b813(0x205)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x53d665[_0xd6b813(0x1dc)]==='parent')return console[_0xd6b813(0x205)](_0xd6b813(0x200)),console[_0xd6b813(0x205)](_0xd6b813(0x268)),0x1;if(!_0x53d665[_0xd6b813(0x22c)])throw new SDKError(ErrorCode[_0xd6b813(0x21c)],_0xd6b813(0x254));const _0x4ddfba=await withSpinner(_0xd6b813(0x1be),()=>_0x134492[_0xd6b813(0x1e7)][_0xd6b813(0x220)](_0x53d665[_0xd6b813(0x240)],_0x53d665['segmentId']),{'verbose':_0x5ccce4['verbose']}),_0xc42318=_0x4ddfba[_0xd6b813(0x236)],_0x376e03=await executeSchemaQuery(_0xc42318,_0x134492,_0x5ccce4);return await handleQueryOutput(_0x376e03,_0x5ccce4),0x0;}catch(_0x1e8fad){if(_0x1e8fad instanceof SDKError)return console[_0xd6b813(0x205)](_0xd6b813(0x1e3)+_0x1e8fad[_0xd6b813(0x217)]),_0x1e8fad[_0xd6b813(0x20e)]&&console[_0xd6b813(0x205)](_0xd6b813(0x20f)+_0x1e8fad[_0xd6b813(0x20e)]),0x1;throw _0x1e8fad;}}}
@@ -1 +1 @@
1
- const a39_0x3ddb78=a39_0x2c51;(function(_0x149936,_0x1756a0){const _0x429990=a39_0x2c51,_0x55d988=_0x149936();while(!![]){try{const _0x2930a9=-parseInt(_0x429990(0xd6))/0x1*(-parseInt(_0x429990(0xf0))/0x2)+parseInt(_0x429990(0xdf))/0x3*(-parseInt(_0x429990(0xd1))/0x4)+-parseInt(_0x429990(0xe2))/0x5+-parseInt(_0x429990(0xc5))/0x6+-parseInt(_0x429990(0xe5))/0x7*(parseInt(_0x429990(0xca))/0x8)+parseInt(_0x429990(0xc4))/0x9+parseInt(_0x429990(0xdb))/0xa;if(_0x2930a9===_0x1756a0)break;else _0x55d988['push'](_0x55d988['shift']());}catch(_0x23e541){_0x55d988['push'](_0x55d988['shift']());}}}(a39_0x4fd7,0x26bbb));import{BaseCommand}from'./command.js';function a39_0x2c51(_0x5396a4,_0xa2046){_0x5396a4=_0x5396a4-0xc0;const _0x4fd79b=a39_0x4fd7();let _0x2c51c4=_0x4fd79b[_0x5396a4];return _0x2c51c4;}function a39_0x4fd7(){const _0x15abc2=['\x27...','segment','Target\x20path:\x20','Create\x20child\x20segment\x20with\x20filtering\x20rules','verbose','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Resolving\x20folder\x20path\x20\x27','2xfvjCA','invisible','Segment\x20name:\x20','Parent:\x20','resolveFolderId','ruleFile','Parent\x20path:\x20','folder','1187514WarOZa','273222pCUKYx','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','length','resolveParentId','37976HCIYkx','Resolving\x20parent\x20segment\x20\x27','segments','Site:\x20','✔\x20Created\x20segment\x20\x27','Creating\x20segment\x20\x27','kind','45132mTfaiZ','rule','data','Examples:','noCountPopulation','115202sqQvBL','createSegment','\x27\x20with\x20ID:\x20','execute','type','6167850nnBJOD','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','description','39MDrULg','segment:create','site','1520990btfVUl','resolvePathToResource','error','308pgztgD','folderId'];a39_0x4fd7=function(){return _0x15abc2;};return a39_0x4fd7();}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a39_0xd68a65 from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']=a39_0x3ddb78(0xe0);['description']=a39_0x3ddb78(0xea);async[a39_0x3ddb78(0xd9)](_0x1c3fff){const _0x4405e8=a39_0x3ddb78;console[_0x4405e8(0xe4)](a39_0xd68a65['yellow'](_0x4405e8(0xed))),console[_0x4405e8(0xe4)](a39_0xd68a65['yellow'](_0x4405e8(0xec)));const {options:_0x514223,args:_0x5a4db1,tdx:_0x59fea9}=_0x1c3fff,_0x4e9ecc=_0x514223;if(_0x5a4db1[_0x4405e8(0xc8)]===0x0)return console[_0x4405e8(0xe4)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console['error'](_0x4405e8(0xc7)),console[_0x4405e8(0xe4)](_0x4405e8(0xd4)),console[_0x4405e8(0xe4)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console[_0x4405e8(0xe4)](_0x4405e8(0xdc)),console[_0x4405e8(0xe4)](_0x4405e8(0xee)),0x1;const _0x3fe26b=_0x5a4db1[0x0],_0x27ec0f=_0x514223['segmentPath'];let _0xbca997=_0x3fe26b;_0x27ec0f&&!_0x3fe26b['includes']('/')&&(_0xbca997=_0x27ec0f+'/'+_0x3fe26b,_0x4e9ecc[_0x4405e8(0xeb)]&&console[_0x4405e8(0xe4)]('Resolved\x20relative\x20path\x20to:\x20'+_0xbca997));const _0x153c1e=parsePath(_0xbca997);if(_0x153c1e[_0x4405e8(0xcc)][_0x4405e8(0xc8)]<0x2)return console[_0x4405e8(0xe4)](_0x4405e8(0xc6)),console[_0x4405e8(0xe4)](_0x4405e8(0xdd)),0x1;const _0x2d407e=_0x153c1e['segments'][0x0],_0x59e8d1=getBaseName(_0xbca997),_0x1e6c37=getParentPath(_0xbca997);_0x4e9ecc[_0x4405e8(0xeb)]&&(console[_0x4405e8(0xe4)](_0x4405e8(0xcd)+_0x4e9ecc[_0x4405e8(0xe1)]),console[_0x4405e8(0xe4)](_0x4405e8(0xe9)+_0xbca997),console[_0x4405e8(0xe4)](_0x4405e8(0xf3)+_0x2d407e),console[_0x4405e8(0xe4)](_0x4405e8(0xf2)+_0x59e8d1),console[_0x4405e8(0xe4)](_0x4405e8(0xc2)+_0x1e6c37));const _0x569339=await withSpinner(_0x4405e8(0xcb)+_0x2d407e+_0x4405e8(0xe7),()=>_0x59fea9[_0x4405e8(0xe8)][_0x4405e8(0xc9)](_0x2d407e),{'verbose':_0x4e9ecc['verbose']}),_0x3dd83a=_0x569339[_0x4405e8(0xd3)];let _0x2578e1;if(_0x153c1e[_0x4405e8(0xcc)][_0x4405e8(0xc8)]>0x2){const _0x11ea9b=await withSpinner(_0x4405e8(0xef)+_0x1e6c37+_0x4405e8(0xe7),()=>_0x59fea9[_0x4405e8(0xe8)][_0x4405e8(0xe3)](_0x1e6c37),{'verbose':_0x4e9ecc[_0x4405e8(0xeb)]}),_0x4ca6bb=_0x11ea9b['data'];if(_0x4ca6bb[_0x4405e8(0xda)]!==_0x4405e8(0xc3)&&_0x4ca6bb[_0x4405e8(0xda)]!=='parent')return console[_0x4405e8(0xe4)]('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x2578e1=_0x4ca6bb[_0x4405e8(0xe6)];}else{if(_0x4e9ecc[_0x4405e8(0xc3)]){const _0x10744f=await withSpinner('Resolving\x20folder\x20\x27'+_0x4e9ecc[_0x4405e8(0xc3)]+_0x4405e8(0xe7),()=>_0x59fea9[_0x4405e8(0xe8)][_0x4405e8(0xc0)](_0x3dd83a,_0x4e9ecc['folder']),{'verbose':_0x4e9ecc['verbose']});_0x2578e1=_0x10744f[_0x4405e8(0xd3)];}}_0x4e9ecc[_0x4405e8(0xeb)]&&_0x2578e1&&console[_0x4405e8(0xe4)]('Resolved\x20folder\x20ID:\x20'+_0x2578e1);const _0x330745=await loadJSONFromOptions(_0x4e9ecc[_0x4405e8(0xd2)],_0x4e9ecc[_0x4405e8(0xc1)]),_0xe03f00={'name':_0x59e8d1,'description':_0x4e9ecc[_0x4405e8(0xde)],'rule':_0x330745,'kind':_0x4e9ecc[_0x4405e8(0xd0)]!==undefined?parseInt(_0x4e9ecc[_0x4405e8(0xd0)],0xa):undefined,'isVisible':_0x4e9ecc[_0x4405e8(0xf1)]?![]:undefined,'segmentFolderId':_0x2578e1,'countPopulation':_0x4e9ecc[_0x4405e8(0xd5)]?![]:undefined},_0x3b04c5=await withSpinner(_0x4405e8(0xcf)+_0x59e8d1+_0x4405e8(0xe7),()=>_0x59fea9[_0x4405e8(0xe8)][_0x4405e8(0xd7)](_0x3dd83a,_0xe03f00),{'verbose':_0x4e9ecc[_0x4405e8(0xeb)]}),_0x23df9b=_0x3b04c5['data'];return console[_0x4405e8(0xe4)](_0x4405e8(0xce)+_0x23df9b['name']+_0x4405e8(0xd8)+_0x23df9b['id']),_0xbca997!==_0x3fe26b&&console[_0x4405e8(0xe4)]('\x20\x20\x20Path:\x20'+_0xbca997),await handleSDKOutput([_0x23df9b],_0x4e9ecc),0x0;}}
1
+ const a39_0x503928=a39_0x4497;(function(_0x4dc495,_0xde8bf0){const _0x5bb0b7=a39_0x4497,_0x196575=_0x4dc495();while(!![]){try{const _0xad3c8a=-parseInt(_0x5bb0b7(0x16d))/0x1*(-parseInt(_0x5bb0b7(0x143))/0x2)+parseInt(_0x5bb0b7(0x149))/0x3*(-parseInt(_0x5bb0b7(0x142))/0x4)+parseInt(_0x5bb0b7(0x144))/0x5+-parseInt(_0x5bb0b7(0x151))/0x6*(-parseInt(_0x5bb0b7(0x155))/0x7)+parseInt(_0x5bb0b7(0x150))/0x8*(-parseInt(_0x5bb0b7(0x14f))/0x9)+-parseInt(_0x5bb0b7(0x16a))/0xa+-parseInt(_0x5bb0b7(0x15e))/0xb*(-parseInt(_0x5bb0b7(0x16c))/0xc);if(_0xad3c8a===_0xde8bf0)break;else _0x196575['push'](_0x196575['shift']());}catch(_0xa0861){_0x196575['push'](_0x196575['shift']());}}}(a39_0x1381,0x919ed));import{BaseCommand}from'./command.js';function a39_0x1381(){const _0x5db62d=['Resolved\x20folder\x20ID:\x20','Site:\x20','Resolving\x20folder\x20path\x20\x27','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','\x20\x20\x20Path:\x20','createSegment','Creating\x20segment\x20\x27','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Resolved\x20relative\x20path\x20to:\x20','verbose','4gthhOn','14jgyzfP','5939230OqyrkA','rule','name','\x27...','description','3316593zQMPcy','Parent:\x20','Parent\x20path:\x20','length','Target\x20path:\x20','ruleFile','20529kxOGwo','4016IfNvwJ','13062FOergm','folderId','resolvePathToResource','execute','49WuKoEf','error','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','type','resolveFolderId','invisible','yellow','segments','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','99dYFpqZ','parent','data','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','kind','Resolving\x20folder\x20\x27','✔\x20Created\x20segment\x20\x27','Segment\x20name:\x20','includes','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','segment','5916970iPoYMa','folder','2373204lxVaCn','65109MVtrDu','segmentPath','noCountPopulation','Examples:','Resolving\x20parent\x20segment\x20\x27'];a39_0x1381=function(){return _0x5db62d;};return a39_0x1381();}import{handleSDKOutput}from'../core/command-output.js';function a39_0x4497(_0x45c96a,_0x4679e1){_0x45c96a=_0x45c96a-0x13b;const _0x1381d5=a39_0x1381();let _0x449765=_0x1381d5[_0x45c96a];return _0x449765;}import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a39_0x599641 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a39_0x503928(0x146)]='segment:create';[a39_0x503928(0x148)]='Create\x20child\x20segment\x20with\x20filtering\x20rules';async[a39_0x503928(0x154)](_0x4deda5){const _0x4eb7fb=a39_0x503928;console[_0x4eb7fb(0x156)](a39_0x599641[_0x4eb7fb(0x15b)]('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x4eb7fb(0x156)](a39_0x599641[_0x4eb7fb(0x15b)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x49c45a,args:_0x50c351,tdx:_0x447bb3}=_0x4deda5,_0x404fb5=_0x49c45a;if(_0x50c351[_0x4eb7fb(0x14c)]===0x0)return console[_0x4eb7fb(0x156)](_0x4eb7fb(0x13f)),console[_0x4eb7fb(0x156)](_0x4eb7fb(0x168)),console[_0x4eb7fb(0x156)](_0x4eb7fb(0x170)),console[_0x4eb7fb(0x156)](_0x4eb7fb(0x13b)),console[_0x4eb7fb(0x156)](_0x4eb7fb(0x15d)),console['error']('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x2413cf=_0x50c351[0x0],_0x3b3b38=_0x49c45a[_0x4eb7fb(0x16e)];let _0x348356=_0x2413cf;_0x3b3b38&&!_0x2413cf[_0x4eb7fb(0x167)]('/')&&(_0x348356=_0x3b3b38+'/'+_0x2413cf,_0x404fb5[_0x4eb7fb(0x141)]&&console['error'](_0x4eb7fb(0x140)+_0x348356));const _0x460540=parsePath(_0x348356);if(_0x460540[_0x4eb7fb(0x15c)][_0x4eb7fb(0x14c)]<0x2)return console[_0x4eb7fb(0x156)](_0x4eb7fb(0x161)),console[_0x4eb7fb(0x156)](_0x4eb7fb(0x157)),0x1;const _0x38f50b=_0x460540[_0x4eb7fb(0x15c)][0x0],_0x3efa22=getBaseName(_0x348356),_0x531f77=getParentPath(_0x348356);_0x404fb5['verbose']&&(console[_0x4eb7fb(0x156)](_0x4eb7fb(0x173)+_0x404fb5['site']),console['error'](_0x4eb7fb(0x14d)+_0x348356),console['error'](_0x4eb7fb(0x14a)+_0x38f50b),console[_0x4eb7fb(0x156)](_0x4eb7fb(0x166)+_0x3efa22),console[_0x4eb7fb(0x156)](_0x4eb7fb(0x14b)+_0x531f77));const _0x33fc81=await withSpinner(_0x4eb7fb(0x171)+_0x38f50b+_0x4eb7fb(0x147),()=>_0x447bb3['segment']['resolveParentId'](_0x38f50b),{'verbose':_0x404fb5[_0x4eb7fb(0x141)]}),_0x282729=_0x33fc81[_0x4eb7fb(0x160)];let _0x263706;if(_0x460540['segments'][_0x4eb7fb(0x14c)]>0x2){const _0x172c04=await withSpinner(_0x4eb7fb(0x174)+_0x531f77+'\x27...',()=>_0x447bb3[_0x4eb7fb(0x169)][_0x4eb7fb(0x153)](_0x531f77),{'verbose':_0x404fb5['verbose']}),_0x9702eb=_0x172c04[_0x4eb7fb(0x160)];if(_0x9702eb[_0x4eb7fb(0x158)]!==_0x4eb7fb(0x16b)&&_0x9702eb[_0x4eb7fb(0x158)]!==_0x4eb7fb(0x15f))return console[_0x4eb7fb(0x156)](_0x4eb7fb(0x162)),0x1;_0x263706=_0x9702eb[_0x4eb7fb(0x152)];}else{if(_0x404fb5[_0x4eb7fb(0x16b)]){const _0x176f86=await withSpinner(_0x4eb7fb(0x164)+_0x404fb5[_0x4eb7fb(0x16b)]+'\x27...',()=>_0x447bb3[_0x4eb7fb(0x169)][_0x4eb7fb(0x159)](_0x282729,_0x404fb5['folder']),{'verbose':_0x404fb5[_0x4eb7fb(0x141)]});_0x263706=_0x176f86[_0x4eb7fb(0x160)];}}_0x404fb5[_0x4eb7fb(0x141)]&&_0x263706&&console[_0x4eb7fb(0x156)](_0x4eb7fb(0x172)+_0x263706);const _0x339b8d=await loadJSONFromOptions(_0x404fb5[_0x4eb7fb(0x145)],_0x404fb5[_0x4eb7fb(0x14e)]),_0x561929={'name':_0x3efa22,'description':_0x404fb5[_0x4eb7fb(0x148)],'rule':_0x339b8d,'kind':_0x404fb5[_0x4eb7fb(0x163)]!==undefined?parseInt(_0x404fb5[_0x4eb7fb(0x163)],0xa):undefined,'isVisible':_0x404fb5[_0x4eb7fb(0x15a)]?![]:undefined,'segmentFolderId':_0x263706,'countPopulation':_0x404fb5[_0x4eb7fb(0x16f)]?![]:undefined},_0x2df458=await withSpinner(_0x4eb7fb(0x13e)+_0x3efa22+_0x4eb7fb(0x147),()=>_0x447bb3[_0x4eb7fb(0x169)][_0x4eb7fb(0x13d)](_0x282729,_0x561929),{'verbose':_0x404fb5[_0x4eb7fb(0x141)]}),_0x16c247=_0x2df458[_0x4eb7fb(0x160)];return console[_0x4eb7fb(0x156)](_0x4eb7fb(0x165)+_0x16c247[_0x4eb7fb(0x146)]+'\x27\x20with\x20ID:\x20'+_0x16c247['id']),_0x348356!==_0x2413cf&&console[_0x4eb7fb(0x156)](_0x4eb7fb(0x13c)+_0x348356),await handleSDKOutput([_0x16c247],_0x404fb5),0x0;}}
@@ -1 +1 @@
1
- const a40_0x3fe488=a40_0x2b5a;function a40_0x244f(){const _0x7d4a91=['json','6157744ESbfny','3245540FUEsXU','651526jUTbTK','segment:fields','Error:\x20Parent\x20segment\x20name\x20is\x20required','parentSegment','Parent\x20segment:\x20','length','segment','name','27882gBSjcK','verbose','listFields','error','18467632lCWFHO','execute','✔\x20Found\x20','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','4627464SCJbwC','1117131ftoaNO','1981FPCCUa','List\x20available\x20fields\x20for\x20segmentation'];a40_0x244f=function(){return _0x7d4a91;};return a40_0x244f();}(function(_0x54c22b,_0x10c0f7){const _0x4ff5d1=a40_0x2b5a,_0x13c033=_0x54c22b();while(!![]){try{const _0xbc1582=-parseInt(_0x4ff5d1(0xbd))/0x1+parseInt(_0x4ff5d1(0xc3))/0x2+parseInt(_0x4ff5d1(0xbc))/0x3+-parseInt(_0x4ff5d1(0xc1))/0x4+parseInt(_0x4ff5d1(0xc2))/0x5+parseInt(_0x4ff5d1(0xb4))/0x6*(-parseInt(_0x4ff5d1(0xbe))/0x7)+parseInt(_0x4ff5d1(0xb8))/0x8;if(_0xbc1582===_0x10c0f7)break;else _0x13c033['push'](_0x13c033['shift']());}catch(_0x286509){_0x13c033['push'](_0x13c033['shift']());}}}(a40_0x244f,0xd0881));import{BaseCommand}from'./command.js';function a40_0x2b5a(_0x19bdfe,_0x486784){_0x19bdfe=_0x19bdfe-0xaf;const _0x244f60=a40_0x244f();let _0x2b5a75=_0x244f60[_0x19bdfe];return _0x2b5a75;}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a40_0x3fe488(0xb3)]=a40_0x3fe488(0xc4);['description']=a40_0x3fe488(0xbf);async[a40_0x3fe488(0xb9)](_0x504330){const _0x44be67=a40_0x3fe488,{options:_0x1e6a6f,args:_0x3656c9,tdx:_0x4bbd92}=_0x504330,_0x4095e8=_0x3656c9[0x0]||_0x1e6a6f[_0x44be67(0xaf)];if(!_0x4095e8)return console[_0x44be67(0xb7)](_0x44be67(0xc5)),console['error']('Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'),console['error'](_0x44be67(0xbb)),0x1;_0x1e6a6f[_0x44be67(0xb5)]&&(console[_0x44be67(0xb7)]('Site:\x20'+_0x1e6a6f['site']),console[_0x44be67(0xb7)](_0x44be67(0xb0)+_0x4095e8));const _0x50d120=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x4095e8+'\x27...',()=>_0x4bbd92[_0x44be67(0xb2)][_0x44be67(0xb6)](_0x4095e8),{'verbose':_0x1e6a6f[_0x44be67(0xb5)]}),_0x56812a=_0x50d120['data'];console[_0x44be67(0xb7)](_0x44be67(0xba)+_0x56812a[_0x44be67(0xb1)]+'\x20field'+(_0x56812a[_0x44be67(0xb1)]!==0x1?'s':''));if(_0x1e6a6f[_0x44be67(0xc0)]||_0x1e6a6f['jsonl'])return await handleSDKOutput(_0x56812a,_0x1e6a6f),0x0;return displayFieldsHumanReadable(_0x56812a,_0x4095e8),0x0;}}
1
+ function a40_0x112c(){const _0x1d7fba=['108oplwNA','jsonl','parentSegment','length','List\x20available\x20fields\x20for\x20segmentation','listFields','3691060IzMWKm','Parent\x20segment:\x20','segment:fields','json','3314466QkmmIn','1120tNvKEh','description','3804970BSHQMZ','9002kyjwlu','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','verbose','\x27...','Error:\x20Parent\x20segment\x20name\x20is\x20required','error','30535YUhZkS','1467871uqQdSM','data','name','117KuPrgj','Site:\x20','Listing\x20fields\x20for\x20\x27','4388970OqLAIi'];a40_0x112c=function(){return _0x1d7fba;};return a40_0x112c();}const a40_0x355842=a40_0x1b5d;(function(_0x3405b3,_0x3fe2ef){const _0x189d9d=a40_0x1b5d,_0x6cffbb=_0x3405b3();while(!![]){try{const _0x586d96=parseInt(_0x189d9d(0x1b0))/0x1+parseInt(_0x189d9d(0x1a5))/0x2+parseInt(_0x189d9d(0x1b6))/0x3+parseInt(_0x189d9d(0x1a1))/0x4+parseInt(_0x189d9d(0x1af))/0x5*(parseInt(_0x189d9d(0x1b7))/0x6)+parseInt(_0x189d9d(0x1a9))/0x7*(parseInt(_0x189d9d(0x1a6))/0x8)+parseInt(_0x189d9d(0x1b3))/0x9*(-parseInt(_0x189d9d(0x1a8))/0xa);if(_0x586d96===_0x3fe2ef)break;else _0x6cffbb['push'](_0x6cffbb['shift']());}catch(_0x3c114d){_0x6cffbb['push'](_0x6cffbb['shift']());}}}(a40_0x112c,0xd095c));function a40_0x1b5d(_0x20ac7b,_0x444c47){_0x20ac7b=_0x20ac7b-0x1a0;const _0x112c2b=a40_0x112c();let _0x1b5de6=_0x112c2b[_0x20ac7b];return _0x1b5de6;}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a40_0x355842(0x1b2)]=a40_0x355842(0x1a3);[a40_0x355842(0x1a7)]=a40_0x355842(0x1bb);async['execute'](_0x2a0765){const _0xd2e43=a40_0x355842,{options:_0x3b227a,args:_0x51005d,tdx:_0x2dda25}=_0x2a0765,_0x3394f0=_0x51005d[0x0]||_0x3b227a[_0xd2e43(0x1b9)];if(!_0x3394f0)return console[_0xd2e43(0x1ae)](_0xd2e43(0x1ad)),console[_0xd2e43(0x1ae)]('Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'),console['error'](_0xd2e43(0x1aa)),0x1;_0x3b227a[_0xd2e43(0x1ab)]&&(console[_0xd2e43(0x1ae)](_0xd2e43(0x1b4)+_0x3b227a['site']),console['error'](_0xd2e43(0x1a2)+_0x3394f0));const _0x293bfb=await withSpinner(_0xd2e43(0x1b5)+_0x3394f0+_0xd2e43(0x1ac),()=>_0x2dda25['segment'][_0xd2e43(0x1a0)](_0x3394f0),{'verbose':_0x3b227a[_0xd2e43(0x1ab)]}),_0x1c47ac=_0x293bfb[_0xd2e43(0x1b1)];console[_0xd2e43(0x1ae)]('✔\x20Found\x20'+_0x1c47ac[_0xd2e43(0x1ba)]+'\x20field'+(_0x1c47ac[_0xd2e43(0x1ba)]!==0x1?'s':''));if(_0x3b227a[_0xd2e43(0x1a4)]||_0x3b227a[_0xd2e43(0x1b8)])return await handleSDKOutput(_0x1c47ac,_0x3b227a),0x0;return displayFieldsHumanReadable(_0x1c47ac,_0x3394f0),0x0;}}