@treasuredata/tdx 2026.4.6 → 2026.4.8

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 (220) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/cas-command.js +1 -1
  11. package/dist/commands/cas-segment-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/delivery-command.js +1 -1
  20. package/dist/commands/describe.js +1 -1
  21. package/dist/commands/engage-campaign-pull-command.js +1 -1
  22. package/dist/commands/engage-campaign-push-command.js +1 -1
  23. package/dist/commands/engage-campaign-validate-command.js +1 -1
  24. package/dist/commands/engage-command.js +1 -1
  25. package/dist/commands/engage-template-pull-command.js +1 -1
  26. package/dist/commands/engage-template-push-command.js +1 -1
  27. package/dist/commands/engage-template-validate-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/journey-command.js +1 -1
  30. package/dist/commands/journey-validate-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/mcp-command.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/policy-command.js +1 -1
  35. package/dist/commands/profile-command.js +1 -1
  36. package/dist/commands/profiles-command.js +1 -1
  37. package/dist/commands/query-command.js +1 -1
  38. package/dist/commands/schedule-command.js +1 -1
  39. package/dist/commands/segment-command.js +1 -1
  40. package/dist/commands/segment-create-command.js +1 -1
  41. package/dist/commands/segment-fields-command.js +1 -1
  42. package/dist/commands/segment-pull-command.js +1 -1
  43. package/dist/commands/segment-push-command.js +1 -1
  44. package/dist/commands/segment-update-command.js +1 -1
  45. package/dist/commands/segment-use-command.js +1 -1
  46. package/dist/commands/segment-validate-command.js +1 -1
  47. package/dist/commands/segments.js +1 -1
  48. package/dist/commands/show.js +1 -1
  49. package/dist/commands/status-command.js +1 -1
  50. package/dist/commands/tables.js +1 -1
  51. package/dist/commands/unset-command.js +1 -1
  52. package/dist/commands/upgrade-command.js +1 -1
  53. package/dist/commands/use-command.js +1 -1
  54. package/dist/commands/user-command.js +1 -1
  55. package/dist/commands/work-command.js +1 -1
  56. package/dist/commands/workflow-command.js +1 -1
  57. package/dist/core/auth.js +1 -1
  58. package/dist/core/command-output.js +1 -1
  59. package/dist/core/config.js +1 -1
  60. package/dist/core/connection-cache.js +1 -1
  61. package/dist/core/constants.js +1 -1
  62. package/dist/core/credential-cache.js +1 -1
  63. package/dist/core/global-context.js +1 -1
  64. package/dist/core/keychain.js +1 -1
  65. package/dist/core/oauth-keychain.js +1 -1
  66. package/dist/core/oauth.js +1 -1
  67. package/dist/core/profile.js +1 -1
  68. package/dist/core/project-config.js +1 -1
  69. package/dist/core/session.js +1 -1
  70. package/dist/core/user-cache.js +1 -1
  71. package/dist/core/version.js +1 -1
  72. package/dist/index.js +1 -1
  73. package/dist/mcp/server.js +1 -1
  74. package/dist/mcp/tools/index.js +1 -1
  75. package/dist/mcp/tools/tdx-run.js +1 -1
  76. package/dist/mcp/tools/tdx-search.js +1 -1
  77. package/dist/mcp/tools/work-create-item.js +1 -1
  78. package/dist/mcp/utils.js +1 -1
  79. package/dist/proxy/claude-usage-tracker.js +1 -1
  80. package/dist/proxy/passthrough-server.js +1 -1
  81. package/dist/proxy/sse-usage-parser.js +1 -1
  82. package/dist/sdk/agent/agent-config.js +1 -1
  83. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  84. package/dist/sdk/agent/agent-yaml.js +1 -1
  85. package/dist/sdk/agent/test/evaluator.js +1 -1
  86. package/dist/sdk/agent/test/executor.js +1 -1
  87. package/dist/sdk/agent/test/index.js +1 -1
  88. package/dist/sdk/agent/test/output.js +1 -1
  89. package/dist/sdk/agent/test/parser.js +1 -1
  90. package/dist/sdk/agent/tool-target-registry.js +1 -1
  91. package/dist/sdk/api.js +1 -1
  92. package/dist/sdk/cas/cas-api-client.js +1 -1
  93. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  94. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  95. package/dist/sdk/cas/index.js +1 -1
  96. package/dist/sdk/cas/pull-workflow.js +1 -1
  97. package/dist/sdk/cas/push-workflow.js +1 -1
  98. package/dist/sdk/client/cdp-api-client.js +1 -1
  99. package/dist/sdk/client/delivery-api-client.js +1 -1
  100. package/dist/sdk/client/endpoints.js +1 -1
  101. package/dist/sdk/client/engage-api-client.js +1 -1
  102. package/dist/sdk/client/http-client.js +1 -1
  103. package/dist/sdk/client/llm-api-client.js +1 -1
  104. package/dist/sdk/client/oauth-refresh.js +1 -1
  105. package/dist/sdk/client/rate-limiter.js +1 -1
  106. package/dist/sdk/client/td-api-client.js +1 -1
  107. package/dist/sdk/client/trino-api-client.js +1 -1
  108. package/dist/sdk/client/workflow-client.js +1 -1
  109. package/dist/sdk/connection-validator.js +1 -1
  110. package/dist/sdk/connection.js +1 -1
  111. package/dist/sdk/delivery.js +1 -1
  112. package/dist/sdk/engage/campaign-pull.js +1 -1
  113. package/dist/sdk/engage/campaign-push.js +1 -1
  114. package/dist/sdk/engage/campaign-validator.js +1 -1
  115. package/dist/sdk/engage/campaign-yaml.js +1 -1
  116. package/dist/sdk/engage/template-pull.js +1 -1
  117. package/dist/sdk/engage/template-push.js +1 -1
  118. package/dist/sdk/engage/template-validator.js +1 -1
  119. package/dist/sdk/engage/template-yaml.js +1 -1
  120. package/dist/sdk/engage/types/campaign-def.js +1 -1
  121. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  122. package/dist/sdk/engage/types/template-schema.js +1 -1
  123. package/dist/sdk/engage.js +1 -1
  124. package/dist/sdk/errors.js +1 -1
  125. package/dist/sdk/index.js +1 -1
  126. package/dist/sdk/io/index.js +1 -1
  127. package/dist/sdk/io/node-filesystem.js +1 -1
  128. package/dist/sdk/job.js +1 -1
  129. package/dist/sdk/journey.js +1 -1
  130. package/dist/sdk/llm/chat-cache.js +1 -1
  131. package/dist/sdk/llm/index.js +1 -1
  132. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  133. package/dist/sdk/llm/model-factors.js +1 -1
  134. package/dist/sdk/personalization.js +1 -1
  135. package/dist/sdk/policy.js +1 -1
  136. package/dist/sdk/query/index.js +1 -1
  137. package/dist/sdk/query/sql-parser.js +1 -1
  138. package/dist/sdk/realtime.js +1 -1
  139. package/dist/sdk/schedule.js +1 -1
  140. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  141. package/dist/sdk/segment/fields-display.js +1 -1
  142. package/dist/sdk/segment/file-discovery.js +1 -1
  143. package/dist/sdk/segment/journey-utils.js +1 -1
  144. package/dist/sdk/segment/journey-validator.js +1 -1
  145. package/dist/sdk/segment/journey-yaml.js +1 -1
  146. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  147. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  148. package/dist/sdk/segment/pull-workflow.js +1 -1
  149. package/dist/sdk/segment/push-recovery.js +1 -1
  150. package/dist/sdk/segment/push-workflow.js +1 -1
  151. package/dist/sdk/segment/resolution-context.js +1 -1
  152. package/dist/sdk/segment/segment-path-parser.js +1 -1
  153. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  154. package/dist/sdk/segment/segment-validator.js +1 -1
  155. package/dist/sdk/segment/target-resolution.js +1 -1
  156. package/dist/sdk/segment/tdx-config.js +1 -1
  157. package/dist/sdk/segment/types/activation-schema.js +1 -1
  158. package/dist/sdk/segment/types/journey-def.js +1 -1
  159. package/dist/sdk/segment/types/journey-schema.js +1 -1
  160. package/dist/sdk/segment/types/segment-def.js +1 -1
  161. package/dist/sdk/segment/types/segment-schema.js +1 -1
  162. package/dist/sdk/segment/validate-files.js +1 -1
  163. package/dist/sdk/segment/yaml-validator.js +1 -1
  164. package/dist/sdk/segment.js +1 -1
  165. package/dist/sdk/types/index.js +1 -1
  166. package/dist/sdk/types/progress.js +1 -1
  167. package/dist/sdk/types/workspace.js +1 -1
  168. package/dist/sdk/user.js +1 -1
  169. package/dist/sdk/util/format-detector.js +1 -1
  170. package/dist/sdk/util/formatters.js +1 -1
  171. package/dist/sdk/util/index.js +1 -1
  172. package/dist/sdk/util/paginate.js +1 -1
  173. package/dist/sdk/util/tree-formatter.js +1 -1
  174. package/dist/sdk/workflow/archive-validation.js +1 -1
  175. package/dist/sdk/workflow/clone-workflow.js +1 -1
  176. package/dist/sdk/workflow/index.js +1 -1
  177. package/dist/sdk/workflow/pull-workflow.js +1 -1
  178. package/dist/sdk/workflow/push-workflow.js +1 -1
  179. package/dist/sdk/workflow/tdx-config.js +1 -1
  180. package/dist/sdk/workflow/workflow-utils.js +1 -1
  181. package/dist/sdk/workspace/access-tracker.js +1 -1
  182. package/dist/sdk/workspace/frontmatter.js +1 -1
  183. package/dist/sdk/workspace/git.js +1 -1
  184. package/dist/sdk/workspace/index.js +1 -1
  185. package/dist/sdk/workspace/templates.js +1 -1
  186. package/dist/sdk/workspace/weekly.js +1 -1
  187. package/dist/sdk/workspace/wikilinks.js +1 -1
  188. package/dist/test-utils/command-runner.js +1 -1
  189. package/dist/test-utils/factories.js +1 -1
  190. package/dist/test-utils/fixtures.js +1 -1
  191. package/dist/test-utils/http-mock.js +1 -1
  192. package/dist/test-utils/index.js +1 -1
  193. package/dist/utils/async.js +1 -1
  194. package/dist/utils/colors.js +1 -1
  195. package/dist/utils/diff.js +1 -1
  196. package/dist/utils/file-permissions.js +1 -1
  197. package/dist/utils/file-reader.js +1 -1
  198. package/dist/utils/github-releases.js +1 -1
  199. package/dist/utils/global-cache.js +1 -1
  200. package/dist/utils/json-loader.js +1 -1
  201. package/dist/utils/local-cache.js +1 -1
  202. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  203. package/dist/utils/logger/formatters/index.js +1 -1
  204. package/dist/utils/logger/handlers/console-handler.js +1 -1
  205. package/dist/utils/logger/handlers/file-handler.js +1 -1
  206. package/dist/utils/logger/handlers/index.js +1 -1
  207. package/dist/utils/logger/handlers/null-handler.js +1 -1
  208. package/dist/utils/logger/index.js +1 -1
  209. package/dist/utils/logger/logger.js +1 -1
  210. package/dist/utils/logger/types.js +1 -1
  211. package/dist/utils/option-validation.js +1 -1
  212. package/dist/utils/process.js +1 -1
  213. package/dist/utils/prompt.js +1 -1
  214. package/dist/utils/spinner.js +1 -1
  215. package/dist/utils/sse-parser.js +1 -1
  216. package/dist/utils/string-utils.js +1 -1
  217. package/dist/utils/table-ref-parser.js +1 -1
  218. package/dist/utils/tdx-logger.js +1 -1
  219. package/dist/utils/version-check.js +1 -1
  220. package/package.json +1 -1
@@ -1 +1 @@
1
- const a32_0x94f4c2=a32_0x44a9;function a32_0x44a9(_0x1c32f4,_0x2c3f86){_0x1c32f4=_0x1c32f4-0x156;const _0x32e071=a32_0x32e0();let _0x44a97b=_0x32e071[_0x1c32f4];return _0x44a97b;}(function(_0xeb78e1,_0x2ea927){const _0x531de7=a32_0x44a9,_0x339abe=_0xeb78e1();while(!![]){try{const _0x2f747b=-parseInt(_0x531de7(0x176))/0x1+parseInt(_0x531de7(0x156))/0x2*(parseInt(_0x531de7(0x181))/0x3)+-parseInt(_0x531de7(0x18d))/0x4+-parseInt(_0x531de7(0x17c))/0x5+parseInt(_0x531de7(0x192))/0x6*(-parseInt(_0x531de7(0x191))/0x7)+parseInt(_0x531de7(0x18a))/0x8*(-parseInt(_0x531de7(0x171))/0x9)+parseInt(_0x531de7(0x160))/0xa*(parseInt(_0x531de7(0x166))/0xb);if(_0x2f747b===_0x2ea927)break;else _0x339abe['push'](_0x339abe['shift']());}catch(_0x2ecd54){_0x339abe['push'](_0x339abe['shift']());}}}(a32_0x32e0,0x9b0cf));function a32_0x32e0(){const _0x16d8ba=['\x20user','policies','data','Fetching\x20policy...','114334BIbpZy','Fetching\x20permissions...','policy','getMyPermissions','✔\x20Found\x20','account_id','5623945vhNKwe','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','\x20\x20•\x20','📋\x20Assigned\x20Policies','getPolicyPermissions','2542905EbgQUK','dim','permissions','listPolicies','\x20\x20No\x20policies\x20assigned','Member','name','getPolicy','(ID:\x20','8404280LwoXHL','administrator','args','913896Swibts','\x20polic','\x20assigned','padEnd','7861ZrhhVJ','4098cSuJHW','ies','2KJNxcT','getCurrent','length','👥\x20Assigned\x20Users','map','email','🔑\x20Effective\x20Permissions','description','policy\x20show','context','298310YPhcCb','No\x20policies\x20found','Account\x20Owner','user','operation','Listing\x20policies...','1133WwxkUT','site','bold','log','error','\x20—\x20','execute','\x20\x20\x20','all','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','verbose','9fOLjKD'];a32_0x32e0=function(){return _0x16d8ba;};return a32_0x32e0();}import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x5de950 from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x94f4c2(0x187)]=a32_0x94f4c2(0x178);[a32_0x94f4c2(0x15d)]='Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions';async[a32_0x94f4c2(0x16c)](_0x34e52c){const _0x1cd113=a32_0x94f4c2,{options:_0x539146,tdx:_0x19a834}=_0x34e52c,_0x31b93e=await withSpinner(_0x1cd113(0x177),async()=>{const _0x518d47=_0x1cd113,[_0x44b814,_0x16ebe5]=await Promise[_0x518d47(0x16e)]([_0x19a834[_0x518d47(0x163)][_0x518d47(0x157)](),_0x19a834[_0x518d47(0x178)][_0x518d47(0x179)]()]);return{'userInfo':_0x44b814,'permissions':_0x16ebe5};},{'verbose':_0x539146[_0x1cd113(0x170)]}),{userInfo:_0x535a36,permissions:_0x5ba1a3}=_0x31b93e['data'];if(isStructuredFormat(_0x539146))return await handleSingleObjectOutput(_0x5ba1a3,_0x539146),0x0;const _0x5b9271=_0x535a36['account_owner']?_0x1cd113(0x162):_0x535a36[_0x1cd113(0x18b)]?'Administrator':_0x1cd113(0x186);console[_0x1cd113(0x169)]('\x0a'+a32_0x5de950[_0x1cd113(0x168)]('👤')+'\x20'+a32_0x5de950[_0x1cd113(0x168)](_0x535a36['name'])+'\x20'+a32_0x5de950[_0x1cd113(0x182)]('('+_0x535a36[_0x1cd113(0x15b)]+')')+_0x1cd113(0x16b)+_0x5b9271),console['log'](a32_0x5de950[_0x1cd113(0x182)](_0x1cd113(0x16d)+_0x19a834[_0x1cd113(0x15f)][_0x1cd113(0x167)]+':'+_0x535a36[_0x1cd113(0x17b)]+',\x20user_id:'+_0x535a36['id']));const _0x2f4f46=_0x5ba1a3[_0x1cd113(0x173)];console[_0x1cd113(0x169)]('\x0a'+a32_0x5de950[_0x1cd113(0x168)](_0x1cd113(0x17f))+'\x20('+_0x2f4f46[_0x1cd113(0x158)]+'):');if(_0x2f4f46[_0x1cd113(0x158)]===0x0)console[_0x1cd113(0x169)](a32_0x5de950['dim'](_0x1cd113(0x185)));else for(const _0x239e26 of _0x2f4f46){console['log'](_0x1cd113(0x17e)+_0x239e26['name']);}return printPermissionsMap(_0x5ba1a3[_0x1cd113(0x183)]),console[_0x1cd113(0x169)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x94f4c2(0x187)]='policy\x20list';[a32_0x94f4c2(0x15d)]='List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)';async[a32_0x94f4c2(0x16c)](_0x135f1d){const _0x5912da=a32_0x94f4c2,{options:_0x31d2e4,tdx:_0x238468}=_0x135f1d,_0x439e25=await withSpinner(_0x5912da(0x165),()=>_0x238468['policy'][_0x5912da(0x184)](),{'verbose':_0x31d2e4[_0x5912da(0x170)]}),_0x4642ba=_0x439e25[_0x5912da(0x174)];console[_0x5912da(0x16a)](_0x5912da(0x17a)+_0x4642ba['length']+_0x5912da(0x18e)+(_0x4642ba['length']!==0x1?_0x5912da(0x193):'y'));if(isStructuredFormat(_0x31d2e4))return await handleSDKOutput(_0x4642ba,_0x31d2e4),0x0;if(_0x4642ba[_0x5912da(0x158)]===0x0)console[_0x5912da(0x169)](a32_0x5de950[_0x5912da(0x182)](_0x5912da(0x161)));else for(const _0x2e1595 of _0x4642ba){const _0x2e855b=_0x2e1595[_0x5912da(0x15d)]?a32_0x5de950[_0x5912da(0x182)](_0x5912da(0x16b)+_0x2e1595[_0x5912da(0x15d)]):'';console['log'](_0x5912da(0x17e)+_0x2e1595[_0x5912da(0x187)]+_0x2e855b);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x94f4c2(0x187)]=a32_0x94f4c2(0x15e);[a32_0x94f4c2(0x15d)]=a32_0x94f4c2(0x16f);['validate'](_0x5793dd){const _0x47135b=a32_0x94f4c2;if(_0x5793dd['args'][_0x47135b(0x158)]===0x0)return _0x47135b(0x17d);return undefined;}async['execute'](_0x10d8b1){const _0x4cd0ed=a32_0x94f4c2,{options:_0xa84f1,tdx:_0x1c6047}=_0x10d8b1,_0x2a295d=_0x10d8b1[_0x4cd0ed(0x18c)][0x0],_0x5113e3=await withSpinner(_0x4cd0ed(0x175),async()=>{const _0x548c8e=_0x4cd0ed,_0x5a2620=await _0x1c6047['policy'][_0x548c8e(0x188)](_0x2a295d),[_0x145717,_0x589164]=await Promise[_0x548c8e(0x16e)]([_0x1c6047[_0x548c8e(0x178)][_0x548c8e(0x180)](_0x5a2620['id']),_0x1c6047['policy']['getPolicyUsers'](_0x5a2620['id'])]);return{'policy':_0x5a2620,'perms':_0x145717,'users':_0x589164};},{'verbose':_0xa84f1[_0x4cd0ed(0x170)]}),{policy:_0x5e0eca,perms:_0x3d608d,users:_0x3bd85a}=_0x5113e3[_0x4cd0ed(0x174)];if(isStructuredFormat(_0xa84f1))return await handleSingleObjectOutput({..._0x5e0eca,'permissions':_0x3d608d[_0x4cd0ed(0x183)],'users':_0x3bd85a},_0xa84f1),0x0;console[_0x4cd0ed(0x169)]('\x0a'+a32_0x5de950[_0x4cd0ed(0x168)]('📋')+'\x20'+a32_0x5de950[_0x4cd0ed(0x168)](_0x5e0eca[_0x4cd0ed(0x187)])+'\x20'+a32_0x5de950[_0x4cd0ed(0x182)](_0x4cd0ed(0x189)+_0x5e0eca['id']+')'));_0x5e0eca['description']&&console[_0x4cd0ed(0x169)](_0x4cd0ed(0x16d)+a32_0x5de950[_0x4cd0ed(0x182)](_0x5e0eca[_0x4cd0ed(0x15d)]));console[_0x4cd0ed(0x169)](_0x4cd0ed(0x16d)+_0x3bd85a[_0x4cd0ed(0x158)]+_0x4cd0ed(0x172)+(_0x3bd85a[_0x4cd0ed(0x158)]!==0x1?'s':'')+_0x4cd0ed(0x18f)),printPermissionsMap(_0x3d608d[_0x4cd0ed(0x183)]);if(_0x3bd85a[_0x4cd0ed(0x158)]>0x0){console[_0x4cd0ed(0x169)]('\x0a'+a32_0x5de950['bold'](_0x4cd0ed(0x159))+':');for(const _0x486946 of _0x3bd85a){const _0x2e6d14=_0x486946['email']&&_0x486946[_0x4cd0ed(0x15b)]!==_0x486946[_0x4cd0ed(0x187)]?a32_0x5de950[_0x4cd0ed(0x182)]('\x20<'+_0x486946[_0x4cd0ed(0x15b)]+'>'):'';console[_0x4cd0ed(0x169)](_0x4cd0ed(0x17e)+_0x486946['name']+_0x2e6d14);}}return console[_0x4cd0ed(0x169)](),0x0;}}function printPermissionsMap(_0x4fd94c){const _0xc93b0b=a32_0x94f4c2,_0x21c3a5=Object['entries'](_0x4fd94c);console[_0xc93b0b(0x169)]('\x0a'+a32_0x5de950[_0xc93b0b(0x168)](_0xc93b0b(0x15c))+':');if(_0x21c3a5[_0xc93b0b(0x158)]===0x0){console[_0xc93b0b(0x169)](a32_0x5de950[_0xc93b0b(0x182)]('\x20\x20No\x20permissions'));return;}const _0x24ea3b=Math['max'](..._0x21c3a5[_0xc93b0b(0x15a)](([_0x2b5b63])=>_0x2b5b63[_0xc93b0b(0x158)]));for(const [_0x271a59,_0x184924]of _0x21c3a5){const _0x2cbbfb=formatOperations(_0x184924);console[_0xc93b0b(0x169)]('\x20\x20'+_0x271a59[_0xc93b0b(0x190)](_0x24ea3b+0x2)+_0x2cbbfb);}}function formatOperations(_0x22f64e){const _0x4578e1=a32_0x94f4c2,_0xf1b6c8=[...new Set(_0x22f64e['map'](_0x5beb0e=>_0x5beb0e[_0x4578e1(0x164)]))];return _0xf1b6c8['join'](',\x20');}
1
+ const a32_0x25a045=a32_0x26e9;(function(_0x2e039b,_0x52f9fc){const _0x34686e=a32_0x26e9,_0x13e92b=_0x2e039b();while(!![]){try{const _0x4c342b=-parseInt(_0x34686e(0xd5))/0x1*(-parseInt(_0x34686e(0xcb))/0x2)+-parseInt(_0x34686e(0xfb))/0x3*(-parseInt(_0x34686e(0xf8))/0x4)+-parseInt(_0x34686e(0xec))/0x5*(parseInt(_0x34686e(0xea))/0x6)+parseInt(_0x34686e(0xfc))/0x7+-parseInt(_0x34686e(0xd9))/0x8+-parseInt(_0x34686e(0xdb))/0x9*(parseInt(_0x34686e(0xd7))/0xa)+parseInt(_0x34686e(0xda))/0xb*(-parseInt(_0x34686e(0xce))/0xc);if(_0x4c342b===_0x52f9fc)break;else _0x13e92b['push'](_0x13e92b['shift']());}catch(_0x25101a){_0x13e92b['push'](_0x13e92b['shift']());}}}(a32_0x589b,0xe73bb));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x6a2561 from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x25a045(0x104)]=a32_0x25a045(0xe2);[a32_0x25a045(0xe1)]=a32_0x25a045(0xd2);async[a32_0x25a045(0xd3)](_0x546c00){const _0x2bd2f9=a32_0x25a045,{options:_0x1cbadd,tdx:_0x555e28}=_0x546c00,_0x37269c=await withSpinner('Fetching\x20permissions...',async()=>{const _0x7afee6=a32_0x26e9,[_0x7c76ef,_0x508f01]=await Promise['all']([_0x555e28[_0x7afee6(0xe8)][_0x7afee6(0xdf)](),_0x555e28[_0x7afee6(0xe2)][_0x7afee6(0xe3)]()]);return{'userInfo':_0x7c76ef,'permissions':_0x508f01};},{'verbose':_0x1cbadd[_0x2bd2f9(0xc5)]}),{userInfo:_0x5831de,permissions:_0xe3a54a}=_0x37269c[_0x2bd2f9(0x103)];if(isStructuredFormat(_0x1cbadd))return await handleSingleObjectOutput(_0xe3a54a,_0x1cbadd),0x0;const _0x222a12=_0x5831de[_0x2bd2f9(0xe5)]?_0x2bd2f9(0xf0):_0x5831de[_0x2bd2f9(0xdd)]?'Administrator':_0x2bd2f9(0xfe);console[_0x2bd2f9(0xf1)]('\x0a'+a32_0x6a2561[_0x2bd2f9(0xee)]('👤')+'\x20'+a32_0x6a2561['bold'](_0x5831de[_0x2bd2f9(0x104)])+'\x20'+a32_0x6a2561[_0x2bd2f9(0xf6)]('('+_0x5831de[_0x2bd2f9(0xed)]+')')+_0x2bd2f9(0xc9)+_0x222a12),console['log'](a32_0x6a2561[_0x2bd2f9(0xf6)](_0x2bd2f9(0xf4)+_0x555e28[_0x2bd2f9(0xcd)][_0x2bd2f9(0xe7)]+':'+_0x5831de[_0x2bd2f9(0xff)]+',\x20user_id:'+_0x5831de['id']));const _0x4e2e55=_0xe3a54a[_0x2bd2f9(0x102)];console[_0x2bd2f9(0xf1)]('\x0a'+a32_0x6a2561[_0x2bd2f9(0xee)](_0x2bd2f9(0x100))+'\x20('+_0x4e2e55[_0x2bd2f9(0xfa)]+'):');if(_0x4e2e55[_0x2bd2f9(0xfa)]===0x0)console[_0x2bd2f9(0xf1)](a32_0x6a2561[_0x2bd2f9(0xf6)](_0x2bd2f9(0xd8)));else for(const _0x2daa0d of _0x4e2e55){console[_0x2bd2f9(0xf1)](_0x2bd2f9(0xc7)+_0x2daa0d[_0x2bd2f9(0x104)]);}return printPermissionsMap(_0xe3a54a[_0x2bd2f9(0xcc)]),console[_0x2bd2f9(0xf1)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x25a045(0x104)]='policy\x20list';[a32_0x25a045(0xe1)]=a32_0x25a045(0xd6);async[a32_0x25a045(0xd3)](_0x40ba37){const _0x48363c=a32_0x25a045,{options:_0x44d846,tdx:_0x1b1fd2}=_0x40ba37,_0x352885=await withSpinner(_0x48363c(0xef),()=>_0x1b1fd2[_0x48363c(0xe2)][_0x48363c(0xca)](),{'verbose':_0x44d846['verbose']}),_0x14e90e=_0x352885['data'];console[_0x48363c(0xde)](_0x48363c(0xd0)+_0x14e90e['length']+_0x48363c(0xf5)+(_0x14e90e['length']!==0x1?_0x48363c(0xe4):'y'));if(isStructuredFormat(_0x44d846))return await handleSDKOutput(_0x14e90e,_0x44d846),0x0;if(_0x14e90e[_0x48363c(0xfa)]===0x0)console[_0x48363c(0xf1)](a32_0x6a2561[_0x48363c(0xf6)]('No\x20policies\x20found'));else for(const _0xd51659 of _0x14e90e){const _0x383dfc=_0xd51659[_0x48363c(0xe1)]?a32_0x6a2561['dim'](_0x48363c(0xc9)+_0xd51659[_0x48363c(0xe1)]):'';console[_0x48363c(0xf1)](_0x48363c(0xc7)+_0xd51659[_0x48363c(0x104)]+_0x383dfc);}return 0x0;}}function a32_0x26e9(_0xb2c187,_0x51f545){_0xb2c187=_0xb2c187-0xc5;const _0x589b35=a32_0x589b();let _0x26e9d0=_0x589b35[_0xb2c187];return _0x26e9d0;}export class PolicyShowCommand extends BaseCommand{[a32_0x25a045(0x104)]=a32_0x25a045(0xf9);['description']=a32_0x25a045(0xdc);[a32_0x25a045(0xe0)](_0x266155){const _0x3133ed=a32_0x25a045;if(_0x266155[_0x3133ed(0xeb)][_0x3133ed(0xfa)]===0x0)return _0x3133ed(0xf2);return undefined;}async[a32_0x25a045(0xd3)](_0x4df003){const _0x3d7d3e=a32_0x25a045,{options:_0x1fe82a,tdx:_0x36e37e}=_0x4df003,_0x45f373=_0x4df003['args'][0x0],_0x5b0eee=await withSpinner('Fetching\x20policy...',async()=>{const _0x42eae7=a32_0x26e9,_0x407d93=await _0x36e37e['policy'][_0x42eae7(0xfd)](_0x45f373),[_0x3de9fe,_0x4ce7ff]=await Promise[_0x42eae7(0xcf)]([_0x36e37e[_0x42eae7(0xe2)]['getPolicyPermissions'](_0x407d93['id']),_0x36e37e['policy']['getPolicyUsers'](_0x407d93['id'])]);return{'policy':_0x407d93,'perms':_0x3de9fe,'users':_0x4ce7ff};},{'verbose':_0x1fe82a[_0x3d7d3e(0xc5)]}),{policy:_0x940d78,perms:_0x58bb66,users:_0x1db3df}=_0x5b0eee[_0x3d7d3e(0x103)];if(isStructuredFormat(_0x1fe82a))return await handleSingleObjectOutput({..._0x940d78,'permissions':_0x58bb66[_0x3d7d3e(0xcc)],'users':_0x1db3df},_0x1fe82a),0x0;console['log']('\x0a'+a32_0x6a2561['bold']('📋')+'\x20'+a32_0x6a2561[_0x3d7d3e(0xee)](_0x940d78['name'])+'\x20'+a32_0x6a2561[_0x3d7d3e(0xf6)]('(ID:\x20'+_0x940d78['id']+')'));_0x940d78['description']&&console['log'](_0x3d7d3e(0xf4)+a32_0x6a2561[_0x3d7d3e(0xf6)](_0x940d78[_0x3d7d3e(0xe1)]));console['log']('\x20\x20\x20'+_0x1db3df[_0x3d7d3e(0xfa)]+_0x3d7d3e(0xc6)+(_0x1db3df[_0x3d7d3e(0xfa)]!==0x1?'s':'')+'\x20assigned'),printPermissionsMap(_0x58bb66[_0x3d7d3e(0xcc)]);if(_0x1db3df[_0x3d7d3e(0xfa)]>0x0){console[_0x3d7d3e(0xf1)]('\x0a'+a32_0x6a2561['bold'](_0x3d7d3e(0xd1))+':');for(const _0x3feda1 of _0x1db3df){const _0x36dac9=_0x3feda1['email']&&_0x3feda1[_0x3d7d3e(0xed)]!==_0x3feda1[_0x3d7d3e(0x104)]?a32_0x6a2561['dim']('\x20<'+_0x3feda1[_0x3d7d3e(0xed)]+'>'):'';console[_0x3d7d3e(0xf1)](_0x3d7d3e(0xc7)+_0x3feda1[_0x3d7d3e(0x104)]+_0x36dac9);}}return console[_0x3d7d3e(0xf1)](),0x0;}}function printPermissionsMap(_0x11496c){const _0x3339a7=a32_0x25a045,_0x472b76=Object[_0x3339a7(0x101)](_0x11496c);console[_0x3339a7(0xf1)]('\x0a'+a32_0x6a2561[_0x3339a7(0xee)](_0x3339a7(0xc8))+':');if(_0x472b76['length']===0x0){console[_0x3339a7(0xf1)](a32_0x6a2561[_0x3339a7(0xf6)](_0x3339a7(0xf7)));return;}const _0xa1a76f=Math[_0x3339a7(0xe9)](..._0x472b76[_0x3339a7(0xd4)](([_0x45ca19])=>_0x45ca19['length']));for(const [_0x46197d,_0x25042f]of _0x472b76){const _0x4da75f=formatOperations(_0x25042f);console['log']('\x20\x20'+_0x46197d[_0x3339a7(0xf3)](_0xa1a76f+0x2)+_0x4da75f);}}function a32_0x589b(){const _0x38a64d=['5406436gmJWmb','getPolicy','Member','account_id','📋\x20Assigned\x20Policies','entries','policies','data','name','verbose','\x20user','\x20\x20•\x20','🔑\x20Effective\x20Permissions','\x20—\x20','listPolicies','20uQCmct','permissions','context','2892jjuwgX','all','✔\x20Found\x20','👥\x20Assigned\x20Users','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','execute','map','95713tIyoqa','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','370CWRIWO','\x20\x20No\x20policies\x20assigned','3866568eyOotW','62282MMSDDa','27666XWnhRV','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','administrator','error','getCurrent','validate','description','policy','getMyPermissions','ies','account_owner','join','site','user','max','85710LjTAcm','args','230OvhJIJ','email','bold','Listing\x20policies...','Account\x20Owner','log','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','padEnd','\x20\x20\x20','\x20polic','dim','\x20\x20No\x20permissions','8EnkdFc','policy\x20show','length','2754546fFsqpw'];a32_0x589b=function(){return _0x38a64d;};return a32_0x589b();}function formatOperations(_0x5a8b83){const _0x42cb31=a32_0x25a045,_0x2e8eb1=[...new Set(_0x5a8b83['map'](_0x39e1d4=>_0x39e1d4['operation']))];return _0x2e8eb1[_0x42cb31(0xe6)](',\x20');}
@@ -1 +1 @@
1
- const a33_0x1f0f47=a33_0x4166;(function(_0x411e3e,_0x39aa3c){const _0x2590db=a33_0x4166,_0x1073b3=_0x411e3e();while(!![]){try{const _0x2ab6da=parseInt(_0x2590db(0x19a))/0x1*(-parseInt(_0x2590db(0x1bf))/0x2)+-parseInt(_0x2590db(0x1ba))/0x3*(-parseInt(_0x2590db(0x18a))/0x4)+-parseInt(_0x2590db(0x161))/0x5+-parseInt(_0x2590db(0x163))/0x6+parseInt(_0x2590db(0x19b))/0x7+-parseInt(_0x2590db(0x1a1))/0x8*(parseInt(_0x2590db(0x1a6))/0x9)+parseInt(_0x2590db(0x1c1))/0xa;if(_0x2ab6da===_0x39aa3c)break;else _0x1073b3['push'](_0x1073b3['shift']());}catch(_0x50f2f5){_0x1073b3['push'](_0x1073b3['shift']());}}}(a33_0x5f57,0x3e178));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a33_0x42b56b from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';function a33_0x4166(_0x34e25f,_0x572401){_0x34e25f=_0x34e25f-0x15f;const _0x5f57ee=a33_0x5f57();let _0x4166a7=_0x5f57ee[_0x34e25f];return _0x4166a7;}import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}from'../core/constants.js';function a33_0x5f57(){const _0x44f679=['jobs','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x20API\x20key\x20saved\x20to\x20system\x20keychain','test','Unknown\x20key\x20\x27','Enter\x20description\x20(optional):','error','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','Delete\x20a\x20profile','Changing\x20site\x20to\x20\x27','\x0aOperation\x20cancelled','Enter\x20your\x20TD\x20API\x20key:','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>','Site\x20was\x20not\x20changed.','Create\x20a\x20new\x20profile','tdx.json','length','dim','\x27\x20updated:\x20','(cleared)','logLevel','API\x20key\x20cannot\x20be\x20empty','status','\x27\x20created','session','green','tdx:\x20profile\x20set','profileName','create','\x0aSetup\x20cancelled','\x27.\x0a\x0aValid\x20keys:\x20','bold','skipExistsCheck','(session:\x20','includes','join','\x20\x20tdx\x20--profile\x20','1552568OUAazP','red','text','Profile\x20\x27','confirm','Session\x20profile\x20set\x20to:\x20','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','trim','\x27\x20deleted','Enter\x20profile\x20name:','config','tdx:\x20profile\x20create','ERROR','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','force','llm_agent','11047wGdLbY','2448964gUZofq','apiKey','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Validating\x20API\x20key...','\x20Profile\x20\x27','getUserInfo','656EvjYoh','Failed\x20to\x20delete\x20profile:\x20','parent_segment','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','13347QYfjOj','split','VALID_KEYS','\x20API\x20key\x20is\x20valid\x20(User:\x20','Default\x20profile\x20set\x20to:\x20','execute','✗\x20Validation\x20failed:\x20','\x0aSaved\x20to:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','Profile\x20name\x20cannot\x20be\x20empty','log','description','\x20\x20(no\x20profiles\x20found)','Removed\x20existing\x20profile\x20\x27','message','us01','Set\x20session\x20profile','yellow','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','email','3BRpHVN','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','\x0aAvailable\x20profiles:','profile','validate','50vuyNKe','/app/mp/ak','8094740VfvrDC','\x20\x20-\x20','\x27\x20does\x20not\x20exist.','all','site','profile:use','Setup\x20cancelled','Operation\x20cancelled','profile:set','password','\x27\x20does\x20not\x20exist.\x20Create\x20it?','name','Removal\x20cancelled','database','2186690HxlMJg','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','2748126STjxhp','tdx:\x20profile\x20delete'];a33_0x5f57=function(){return _0x44f679;};return a33_0x5f57();}import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a33_0x123a5f from'prompts';import a33_0x58e680 from'chalk';function validateProfileName(_0x13c731,_0x511345){const _0x1d3da2=a33_0x4166;if(!_0x13c731||!_0x13c731[_0x1d3da2(0x191)]())return _0x1d3da2(0x1af);const _0x1499fd=_0x13c731[_0x1d3da2(0x191)]();if(!/^[a-zA-Z0-9_-]+$/[_0x1d3da2(0x168)](_0x1499fd))return _0x1d3da2(0x1a5);if(!_0x511345?.[_0x1d3da2(0x185)]&&profileExists(_0x1499fd))return _0x1d3da2(0x18d)+_0x1499fd+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20'+_0x1499fd+'\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.';return!![];}async function deleteProfileAndCredentials(_0x253613){const _0x1d6d37=a33_0x4166;removeProfileFromUserConfig(_0x253613);const _0x103005=await isKeychainAvailable();_0x103005&&await Promise[_0x1d6d37(0x1c4)]([deleteKeychainAPIKey(_0x253613),deleteOAuthTokens(_0x253613)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x1f0f47(0x1cc)]='profile:create';['description']=a33_0x1f0f47(0x173);async[a33_0x1f0f47(0x1ab)](_0x3686ef){const _0x205a15=a33_0x1f0f47,{options:_0x5a1e31,args:_0x1f1f07}=_0x3686ef,_0x130c23=!!_0x5a1e31[_0x205a15(0x198)];console[_0x205a15(0x1b0)](a33_0x58e680[_0x205a15(0x184)](_0x205a15(0x195)));let _0x1feb56;if(_0x1f1f07['length']>0x0&&_0x1f1f07[0x0]){const _0x299102=_0x1f1f07[0x0]['trim']();_0x130c23&&profileExists(_0x299102)&&(await deleteProfileAndCredentials(_0x299102),console[_0x205a15(0x1b0)](_0x205a15(0x1b3)+_0x299102+'\x27'));const _0x53f628=validateProfileName(_0x299102);if(_0x53f628!==!![])return console['error'](a33_0x58e680[_0x205a15(0x18b)](_0x53f628)),0x1;_0x1feb56=_0x299102;}else{const _0x2d9fa1=await a33_0x123a5f({'type':_0x205a15(0x18c),'name':_0x205a15(0x180),'message':_0x205a15(0x193),'validate':_0x4bde71=>validateProfileName(_0x4bde71,{'skipExistsCheck':_0x130c23})});if(!_0x2d9fa1[_0x205a15(0x180)])return console[_0x205a15(0x1b0)]('\x0aSetup\x20cancelled'),0x1;_0x1feb56=_0x2d9fa1[_0x205a15(0x180)][_0x205a15(0x191)](),_0x130c23&&profileExists(_0x1feb56)&&(await deleteProfileAndCredentials(_0x1feb56),console[_0x205a15(0x1b0)]('Removed\x20existing\x20profile\x20\x27'+_0x1feb56+'\x27'));}const _0x23ba17=await a33_0x123a5f({'type':_0x205a15(0x18c),'name':_0x205a15(0x1b1),'message':_0x205a15(0x16a)}),_0x3c9a9b=_0x23ba17['description']?.[_0x205a15(0x191)]()||undefined,_0x55be6f=_0x5a1e31['site']||_0x205a15(0x1b5),_0xef2b43=await promptSiteSelection(_0x55be6f,_0x1feb56,_0x205a15(0x1c7));if(!_0xef2b43)return 0x1;const _0x5adf68=resolveSite(_0xef2b43),_0x536005=await promptAuthMethod();if(!_0x536005)return console[_0x205a15(0x1b0)](_0x205a15(0x182)),0x1;if(_0x536005==='oauth'){if(_0x3c9a9b){const _0x26141b={'site':_0x5adf68,'description':_0x3c9a9b};saveProfileToUserConfig(_0x1feb56,_0x26141b);}const {accountName:_0x43f53e}=_0x5a1e31;return await runOAuthLoginFlow(_0x5adf68,_0x1feb56,_0x5a1e31['logLevel']??LogLevel['ERROR'],{'accountName':_0x43f53e}),0x0;}console[_0x205a15(0x1b0)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x5adf68),console['log']('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x205a15(0x1b0)]('\x20\x20'+getConsoleUrl(_0x5adf68,_0x205a15(0x1c0)));const _0x18e4db=await a33_0x123a5f({'type':_0x205a15(0x1ca),'name':'apiKey','message':_0x205a15(0x170),'validate':_0x396734=>{const _0x513c6d=_0x205a15;if(!_0x396734||!_0x396734['trim']())return _0x513c6d(0x17a);return!![];}});if(!_0x18e4db[_0x205a15(0x19c)])return console[_0x205a15(0x1b0)](_0x205a15(0x182)),0x1;const _0x2ced7e=_0x18e4db[_0x205a15(0x19c)];console[_0x205a15(0x1b0)](_0x205a15(0x19e));try{const _0xe8cef5=TDX[_0x205a15(0x181)]({'site':_0x5adf68,'apiKey':_0x2ced7e[_0x205a15(0x191)](),'logLevel':_0x5a1e31[_0x205a15(0x179)]??LogLevel['ERROR']}),_0x38ee2f=await _0xe8cef5[_0x205a15(0x165)][_0x205a15(0x1a0)]();console[_0x205a15(0x1b0)](a33_0x58e680[_0x205a15(0x17e)]('✓')+_0x205a15(0x1a9)+_0x38ee2f[_0x205a15(0x1b9)]+')');const _0x85c60d=await isKeychainAvailable();_0x85c60d?(await saveAPIKeyAsync(_0x2ced7e[_0x205a15(0x191)](),_0x5adf68,_0x1feb56),console['log'](a33_0x58e680[_0x205a15(0x17e)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x1feb56+')')):(console['warn'](a33_0x58e680[_0x205a15(0x1b7)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console['warn'](a33_0x58e680[_0x205a15(0x1b7)](_0x205a15(0x190))));const _0x1501f0={'site':_0x5adf68,..._0x3c9a9b&&{'description':_0x3c9a9b}};return saveProfileToUserConfig(_0x1feb56,_0x1501f0),console[_0x205a15(0x1b0)](a33_0x58e680[_0x205a15(0x17e)]('✓')+_0x205a15(0x19f)+_0x1feb56+_0x205a15(0x17c)),console['log'](),console[_0x205a15(0x1b0)](_0x205a15(0x1b8)),console[_0x205a15(0x1b0)](_0x205a15(0x189)+_0x1feb56+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x205a15(0x1b0)]('\x20\x20tdx\x20--profile\x20'+_0x1feb56+_0x205a15(0x1a4)),0x0;}catch(_0x39722e){if(_0x39722e instanceof HTTPClientError&&_0x39722e[_0x205a15(0x17b)]===0x191)return printAuthError(_0x39722e),0x1;return console['error'](a33_0x58e680[_0x205a15(0x18b)]('✗\x20Validation\x20failed:\x20'+(_0x39722e instanceof Error?_0x39722e[_0x205a15(0x1b4)]:String(_0x39722e)))),console[_0x205a15(0x16b)](_0x205a15(0x19d)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{['name']='profile:delete';['description']=a33_0x1f0f47(0x16d);[a33_0x1f0f47(0x1be)](_0x5477e4){const _0x507c8d=a33_0x1f0f47,{args:_0x2798ed}=_0x5477e4;if(_0x2798ed[_0x507c8d(0x175)]===0x0)return _0x507c8d(0x1bb);return undefined;}async[a33_0x1f0f47(0x1ab)](_0x256f68){const _0x46a574=a33_0x1f0f47,{args:_0x4c37f2}=_0x256f68,_0x2756f2=_0x4c37f2[0x0];console[_0x46a574(0x1b0)](a33_0x58e680[_0x46a574(0x184)](_0x46a574(0x164)));if(!profileExists(_0x2756f2)){console['error'](a33_0x58e680[_0x46a574(0x18b)](_0x46a574(0x18d)+_0x2756f2+_0x46a574(0x1c3))),console[_0x46a574(0x1b0)](_0x46a574(0x1bc));const _0x11c655=listProfiles();if(_0x11c655[_0x46a574(0x175)]===0x0)console[_0x46a574(0x1b0)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x1f200e of _0x11c655){console[_0x46a574(0x1b0)](_0x46a574(0x1c2)+_0x1f200e['name']);}return 0x1;}const _0x5ef1fc=await a33_0x123a5f({'type':_0x46a574(0x18e),'name':_0x46a574(0x18e),'message':_0x46a574(0x162)+_0x2756f2+'\x27?','initial':![]});if(!_0x5ef1fc[_0x46a574(0x18e)])return console[_0x46a574(0x1b0)](_0x46a574(0x15f)),0x0;try{await deleteProfileAndCredentials(_0x2756f2),console[_0x46a574(0x1b0)](a33_0x58e680['green']('✓')+_0x46a574(0x19f)+_0x2756f2+_0x46a574(0x192));}catch(_0x51e7ab){return console[_0x46a574(0x16b)](a33_0x58e680[_0x46a574(0x18b)](_0x46a574(0x1a2)+(_0x51e7ab instanceof Error?_0x51e7ab[_0x46a574(0x1b4)]:String(_0x51e7ab)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a33_0x1f0f47(0x1c9);[a33_0x1f0f47(0x1b1)]='Set\x20a\x20profile\x20configuration\x20value';static [a33_0x1f0f47(0x1a8)]=['site',a33_0x1f0f47(0x160),a33_0x1f0f47(0x1a3),'llm_project',a33_0x1f0f47(0x199),a33_0x1f0f47(0x1b1)];['validate'](_0x2ce23e){const _0x506b1b=a33_0x1f0f47,{args:_0xe197b7,options:_0x169201}=_0x2ce23e,_0x43ecdf=_0x169201[_0x506b1b(0x1bd)]||getActiveProfile();if(!_0x43ecdf)return _0x506b1b(0x171);if(_0xe197b7[_0x506b1b(0x175)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS'][_0x506b1b(0x188)](',\x20');const _0x3816cb=_0xe197b7[0x0];if(!_0x3816cb[_0x506b1b(0x187)]('='))return _0x506b1b(0x197)+ProfileSetCommand[_0x506b1b(0x1a8)][_0x506b1b(0x188)](',\x20');const [_0x19902e]=_0x3816cb[_0x506b1b(0x1a7)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x506b1b(0x187)](_0x19902e))return _0x506b1b(0x169)+_0x19902e+_0x506b1b(0x183)+ProfileSetCommand['VALID_KEYS'][_0x506b1b(0x188)](',\x20');return undefined;}async[a33_0x1f0f47(0x1ab)](_0x44da12){const _0x62e1a8=a33_0x1f0f47,{args:_0x511e2a,options:_0x257ef1}=_0x44da12,_0x5b8118=_0x257ef1['profile']||getActiveProfile(),[_0x38cfe2,..._0x4ab0b8]=_0x511e2a[0x0][_0x62e1a8(0x1a7)]('='),_0x117cd5=_0x4ab0b8[_0x62e1a8(0x188)]('=');console['log'](a33_0x58e680[_0x62e1a8(0x184)](_0x62e1a8(0x17f)));if(!profileExists(_0x5b8118)){const _0x460efc=await a33_0x123a5f({'type':_0x62e1a8(0x18e),'name':_0x62e1a8(0x181),'message':'Profile\x20\x27'+_0x5b8118+_0x62e1a8(0x1cb),'initial':!![]});if(!_0x460efc[_0x62e1a8(0x181)])return console[_0x62e1a8(0x1b0)](_0x62e1a8(0x1c8)),0x1;}const _0xaf81b=loadProfile(_0x5b8118),_0x204b2c=_0xaf81b?.[_0x62e1a8(0x194)]||{};if(_0x38cfe2==='site'){const _0x12a7cc=resolveSite(_0x117cd5);console['log'](_0x62e1a8(0x16e)+_0x12a7cc+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x62e1a8(0x1b0)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x62e1a8(0x1b0)]('\x20\x20'+getConsoleUrl(_0x12a7cc,_0x62e1a8(0x1c0)));const _0x5b9c3e=await a33_0x123a5f({'type':'password','name':_0x62e1a8(0x19c),'message':_0x62e1a8(0x16c),'validate':_0x4aaaac=>{const _0x9032a=_0x62e1a8;if(!_0x4aaaac||!_0x4aaaac[_0x9032a(0x191)]())return _0x9032a(0x17a);return!![];}});if(!_0x5b9c3e[_0x62e1a8(0x19c)])return console[_0x62e1a8(0x1b0)](_0x62e1a8(0x16f)),0x1;console[_0x62e1a8(0x1b0)](_0x62e1a8(0x19e));try{const _0x3c057c=TDX['create']({'site':_0x12a7cc,'apiKey':_0x5b9c3e[_0x62e1a8(0x19c)]['trim'](),'logLevel':_0x257ef1[_0x62e1a8(0x179)]??LogLevel[_0x62e1a8(0x196)]}),_0x36d920=await _0x3c057c['jobs']['getUserInfo']();console[_0x62e1a8(0x1b0)](a33_0x58e680[_0x62e1a8(0x17e)]('✓')+_0x62e1a8(0x1a9)+_0x36d920[_0x62e1a8(0x1b9)]+')');const _0x21008a=await isKeychainAvailable();_0x21008a?(await saveAPIKeyAsync(_0x5b9c3e[_0x62e1a8(0x19c)][_0x62e1a8(0x191)](),_0x12a7cc,_0x5b8118),console['log'](a33_0x58e680[_0x62e1a8(0x17e)]('✓')+_0x62e1a8(0x167))):console['warn'](a33_0x58e680['yellow'](_0x62e1a8(0x166))),_0x204b2c[_0x62e1a8(0x1c5)]=_0x12a7cc;}catch(_0x3ac358){if(_0x3ac358 instanceof HTTPClientError&&_0x3ac358['status']===0x191)return printAuthError(_0x3ac358),0x1;return console[_0x62e1a8(0x16b)](a33_0x58e680[_0x62e1a8(0x18b)](_0x62e1a8(0x1ac)+(_0x3ac358 instanceof Error?_0x3ac358[_0x62e1a8(0x1b4)]:String(_0x3ac358)))),console[_0x62e1a8(0x16b)](_0x62e1a8(0x172)),0x1;}}else _0x204b2c[_0x38cfe2]=_0x117cd5||undefined;return saveProfileToUserConfig(_0x5b8118,_0x204b2c),console[_0x62e1a8(0x1b0)](a33_0x58e680['green']('✓')+_0x62e1a8(0x19f)+_0x5b8118+_0x62e1a8(0x177)+_0x38cfe2+'='+(_0x117cd5||_0x62e1a8(0x178))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x1f0f47(0x1cc)]=a33_0x1f0f47(0x1c6);[a33_0x1f0f47(0x1b1)]=a33_0x1f0f47(0x1b6);[a33_0x1f0f47(0x1be)](_0x9db0d4){const _0x4287a8=a33_0x1f0f47,{args:_0x1fb81e}=_0x9db0d4;if(_0x1fb81e['length']===0x0)return _0x4287a8(0x1ae);return undefined;}async[a33_0x1f0f47(0x1ab)](_0x33cda4){const _0x48ba76=a33_0x1f0f47,{args:_0x131b70,options:_0x31b823}=_0x33cda4,_0x2bf807=_0x131b70[0x0],_0xd1451f=_0x31b823['default'];cleanExpiredSessions();if(!profileExists(_0x2bf807)){console[_0x48ba76(0x16b)](a33_0x58e680[_0x48ba76(0x18b)]('Profile\x20\x27'+_0x2bf807+_0x48ba76(0x1c3))),console[_0x48ba76(0x1b0)](_0x48ba76(0x1bc));const _0x270b5e=listProfiles();if(_0x270b5e[_0x48ba76(0x175)]===0x0)console['log'](_0x48ba76(0x1b2));else for(const _0x4b45c0 of _0x270b5e){console[_0x48ba76(0x1b0)](_0x48ba76(0x1c2)+_0x4b45c0[_0x48ba76(0x1cc)]);}return 0x1;}if(_0xd1451f){const _0x3fc544=a33_0x42b56b[_0x48ba76(0x188)](getConfigDir(),_0x48ba76(0x174));return saveActiveProfileToUserConfig(_0x2bf807),console[_0x48ba76(0x1b0)](_0x48ba76(0x1aa)+a33_0x58e680[_0x48ba76(0x17e)](_0x2bf807)),console[_0x48ba76(0x1b0)](a33_0x58e680[_0x48ba76(0x176)](_0x48ba76(0x1ad)+_0x3fc544)),0x0;}const _0x278f42=getSessionID(_0x31b823['session']);return saveSessionContext({'profile':_0x2bf807},_0x31b823[_0x48ba76(0x17d)]),console['log'](_0x48ba76(0x18f)+a33_0x58e680['green'](_0x2bf807)+'\x20'+a33_0x58e680[_0x48ba76(0x176)](_0x48ba76(0x186)+_0x278f42+')')),console[_0x48ba76(0x1b0)](a33_0x58e680[_0x48ba76(0x176)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x2bf807+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
1
+ const a33_0xf53dec=a33_0x1157;(function(_0x2c0c89,_0x2e80d1){const _0x3a93e6=a33_0x1157,_0x124b52=_0x2c0c89();while(!![]){try{const _0x5bf8e3=-parseInt(_0x3a93e6(0x108))/0x1*(-parseInt(_0x3a93e6(0xf0))/0x2)+parseInt(_0x3a93e6(0x11c))/0x3*(parseInt(_0x3a93e6(0xcd))/0x4)+-parseInt(_0x3a93e6(0xd1))/0x5*(-parseInt(_0x3a93e6(0xd8))/0x6)+-parseInt(_0x3a93e6(0x116))/0x7+-parseInt(_0x3a93e6(0x118))/0x8*(-parseInt(_0x3a93e6(0xfb))/0x9)+parseInt(_0x3a93e6(0x104))/0xa+parseInt(_0x3a93e6(0x100))/0xb*(-parseInt(_0x3a93e6(0xe6))/0xc);if(_0x5bf8e3===_0x2e80d1)break;else _0x124b52['push'](_0x124b52['shift']());}catch(_0xf8a618){_0x124b52['push'](_0x124b52['shift']());}}}(a33_0x241d,0x33adc));function a33_0x241d(){const _0x28530a=['\x0aSetup\x20cancelled','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Delete\x20a\x20profile','You\x20can\x20find\x20your\x20API\x20key\x20at:','\x20\x20tdx\x20--profile\x20','warn','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','119763EkWqVP','join','profile','\x27\x20does\x20not\x20exist.','profile:create','2134TnbHzQ','Validating\x20API\x20key...','\x27.\x0a\x0aValid\x20keys:\x20','\x20Profile\x20\x27','4063610zCKrkU','profile:delete','\x20\x20(no\x20profiles\x20found)','Session\x20profile\x20set\x20to:\x20','89ctnHfd','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','profile:use','description','oauth','Enter\x20profile\x20name:','config','Enter\x20your\x20TD\x20API\x20key:','status','\x27\x20updated:\x20','Failed\x20to\x20delete\x20profile:\x20','tdx.json','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','2376325uGqjXt','Create\x20a\x20new\x20profile','104wiJhFl','Removal\x20cancelled','\x27\x20deleted','split','8508gUjuhW','parent_segment','/app/mp/ak','log','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','force','tdx:\x20profile\x20delete','jobs','site','✗\x20Validation\x20failed:\x20','Set\x20a\x20profile\x20configuration\x20value','llm_agent','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','logLevel','Operation\x20cancelled','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Changing\x20site\x20to\x20\x27','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Set\x20session\x20profile','validate','\x27\x20created','green','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','bold','\x20\x20-\x20','create','284LUPNBU','profile:set','Profile\x20name\x20cannot\x20be\x20empty','test','5340vFaAuA','us01','confirm','apiKey','VALID_KEYS','length','\x0aAvailable\x20profiles:','1812YKMRha','Enter\x20description\x20(optional):','ERROR','trim','password','includes','\x0aSaved\x20to:\x20','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','profileName','execute','error','session','Profile\x20\x27','text','47412BWnEFk','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','red','message','name','dim','\x20--default\x27\x20to\x20save\x20permanently','yellow','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','Setup\x20cancelled','4818dmdVZD','API\x20key\x20cannot\x20be\x20empty','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','skipExistsCheck'];a33_0x241d=function(){return _0x28530a;};return a33_0x241d();}import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a33_0x3b3c4d 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{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a33_0x22d1e7 from'prompts';import a33_0x44911d from'chalk';function validateProfileName(_0x3a16bc,_0x2ecbbe){const _0xe748da=a33_0x1157;if(!_0x3a16bc||!_0x3a16bc[_0xe748da(0xdb)]())return _0xe748da(0xcf);const _0x1b1946=_0x3a16bc[_0xe748da(0xdb)]();if(!/^[a-zA-Z0-9_-]+$/[_0xe748da(0xd0)](_0x1b1946))return _0xe748da(0xbf);if(!_0x2ecbbe?.[_0xe748da(0xf3)]&&profileExists(_0x1b1946))return'Profile\x20\x27'+_0x1b1946+_0xe748da(0xe7)+_0x1b1946+_0xe748da(0xc9);return!![];}async function deleteProfileAndCredentials(_0x31caa0){removeProfileFromUserConfig(_0x31caa0);const _0x324c6a=await isKeychainAvailable();_0x324c6a&&await Promise['all']([deleteKeychainAPIKey(_0x31caa0),deleteOAuthTokens(_0x31caa0)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0xf53dec(0xea)]=a33_0xf53dec(0xff);[a33_0xf53dec(0x10c)]=a33_0xf53dec(0x117);async['execute'](_0xd98ff9){const _0x480646=a33_0xf53dec,{options:_0x2043f2,args:_0x30db00}=_0xd98ff9,_0x1b6889=!!_0x2043f2[_0x480646(0x122)];console[_0x480646(0x11f)](a33_0x44911d['bold']('tdx:\x20profile\x20create'));let _0x593a43;if(_0x30db00['length']>0x0&&_0x30db00[0x0]){const _0xe140ff=_0x30db00[0x0][_0x480646(0xdb)]();_0x1b6889&&profileExists(_0xe140ff)&&(await deleteProfileAndCredentials(_0xe140ff),console['log']('Removed\x20existing\x20profile\x20\x27'+_0xe140ff+'\x27'));const _0x5a37cd=validateProfileName(_0xe140ff);if(_0x5a37cd!==!![])return console[_0x480646(0xe2)](a33_0x44911d[_0x480646(0xe8)](_0x5a37cd)),0x1;_0x593a43=_0xe140ff;}else{const _0x157cb8=await a33_0x22d1e7({'type':_0x480646(0xe5),'name':'profileName','message':_0x480646(0x10e),'validate':_0x1b78ca=>validateProfileName(_0x1b78ca,{'skipExistsCheck':_0x1b6889})});if(!_0x157cb8[_0x480646(0xe0)])return console[_0x480646(0x11f)]('\x0aSetup\x20cancelled'),0x1;_0x593a43=_0x157cb8[_0x480646(0xe0)][_0x480646(0xdb)](),_0x1b6889&&profileExists(_0x593a43)&&(await deleteProfileAndCredentials(_0x593a43),console['log']('Removed\x20existing\x20profile\x20\x27'+_0x593a43+'\x27'));}const _0x28cab6=await a33_0x22d1e7({'type':_0x480646(0xe5),'name':_0x480646(0x10c),'message':_0x480646(0xd9)}),_0x261a3f=_0x28cab6[_0x480646(0x10c)]?.['trim']()||undefined,_0xc3d7f0=_0x2043f2[_0x480646(0x125)]||_0x480646(0xd2),_0x55bd17=await promptSiteSelection(_0xc3d7f0,_0x593a43,_0x480646(0xef));if(!_0x55bd17)return 0x1;const _0x155931=resolveSite(_0x55bd17),_0x482408=await promptAuthMethod();if(!_0x482408)return console[_0x480646(0x11f)](_0x480646(0xf4)),0x1;if(_0x482408===_0x480646(0x10d)){if(_0x261a3f){const _0x20be68={'site':_0x155931,'description':_0x261a3f};saveProfileToUserConfig(_0x593a43,_0x20be68);}const {accountName:_0xb32125}=_0x2043f2;return await runOAuthLoginFlow(_0x155931,_0x593a43,_0x2043f2['logLevel']??LogLevel['ERROR'],{'accountName':_0xb32125}),0x0;}console[_0x480646(0x11f)](_0x480646(0x121)+_0x155931),console['log'](_0x480646(0xf7)),console[_0x480646(0x11f)]('\x20\x20'+getConsoleUrl(_0x155931,_0x480646(0x11e)));const _0x53cb39=await a33_0x22d1e7({'type':_0x480646(0xdc),'name':_0x480646(0xd4),'message':_0x480646(0x110),'validate':_0x3280b4=>{const _0x1ffb63=_0x480646;if(!_0x3280b4||!_0x3280b4[_0x1ffb63(0xdb)]())return _0x1ffb63(0xf1);return!![];}});if(!_0x53cb39[_0x480646(0xd4)])return console[_0x480646(0x11f)](_0x480646(0xf4)),0x1;const _0x335fcd=_0x53cb39['apiKey'];console[_0x480646(0x11f)](_0x480646(0x101));try{const _0x31522a=TDX[_0x480646(0xcc)]({'site':_0x155931,'apiKey':_0x335fcd[_0x480646(0xdb)](),'logLevel':_0x2043f2['logLevel']??LogLevel[_0x480646(0xda)]}),_0x297b84=await _0x31522a[_0x480646(0x124)]['getUserInfo']();console[_0x480646(0x11f)](a33_0x44911d[_0x480646(0xc8)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x297b84['email']+')');const _0x53cc05=await isKeychainAvailable();_0x53cc05?(await saveAPIKeyAsync(_0x335fcd[_0x480646(0xdb)](),_0x155931,_0x593a43),console['log'](a33_0x44911d['green']('✓')+_0x480646(0xf5)+_0x593a43+')')):(console[_0x480646(0xf9)](a33_0x44911d[_0x480646(0xed)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x480646(0xf9)](a33_0x44911d[_0x480646(0xed)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x4bff5a={'site':_0x155931,..._0x261a3f&&{'description':_0x261a3f}};return saveProfileToUserConfig(_0x593a43,_0x4bff5a),console[_0x480646(0x11f)](a33_0x44911d[_0x480646(0xc8)]('✓')+_0x480646(0x103)+_0x593a43+_0x480646(0xc7)),console[_0x480646(0x11f)](),console[_0x480646(0x11f)](_0x480646(0xdf)),console[_0x480646(0x11f)](_0x480646(0xf8)+_0x593a43+_0x480646(0xf2)),console[_0x480646(0x11f)](_0x480646(0xf8)+_0x593a43+_0x480646(0x10a)),0x0;}catch(_0x50ce2d){if(_0x50ce2d instanceof HTTPClientError&&_0x50ce2d[_0x480646(0x111)]===0x191)return printAuthError(_0x50ce2d),0x1;return console[_0x480646(0xe2)](a33_0x44911d[_0x480646(0xe8)](_0x480646(0x126)+(_0x50ce2d instanceof Error?_0x50ce2d[_0x480646(0xe9)]:String(_0x50ce2d)))),console[_0x480646(0xe2)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}function a33_0x1157(_0x519d50,_0x369f1c){_0x519d50=_0x519d50-0xbd;const _0x241d3d=a33_0x241d();let _0x115749=_0x241d3d[_0x519d50];return _0x115749;}export class ProfileDeleteCommand extends BaseCommand{['name']=a33_0xf53dec(0x105);[a33_0xf53dec(0x10c)]=a33_0xf53dec(0xf6);['validate'](_0x1b7126){const _0x11f307=a33_0xf53dec,{args:_0x23cf90}=_0x1b7126;if(_0x23cf90[_0x11f307(0xd6)]===0x0)return _0x11f307(0x115);return undefined;}async['execute'](_0x31ae6c){const _0xc407ec=a33_0xf53dec,{args:_0x23a42e}=_0x31ae6c,_0xcae587=_0x23a42e[0x0];console[_0xc407ec(0x11f)](a33_0x44911d['bold'](_0xc407ec(0x123)));if(!profileExists(_0xcae587)){console[_0xc407ec(0xe2)](a33_0x44911d[_0xc407ec(0xe8)](_0xc407ec(0xe4)+_0xcae587+_0xc407ec(0xfe))),console['log'](_0xc407ec(0xd7));const _0x70059b=listProfiles();if(_0x70059b['length']===0x0)console[_0xc407ec(0x11f)](_0xc407ec(0x106));else for(const _0x276539 of _0x70059b){console[_0xc407ec(0x11f)]('\x20\x20-\x20'+_0x276539[_0xc407ec(0xea)]);}return 0x1;}const _0x2d7503=await a33_0x22d1e7({'type':_0xc407ec(0xd3),'name':_0xc407ec(0xd3),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0xcae587+'\x27?','initial':![]});if(!_0x2d7503[_0xc407ec(0xd3)])return console[_0xc407ec(0x11f)](_0xc407ec(0x119)),0x0;try{await deleteProfileAndCredentials(_0xcae587),console[_0xc407ec(0x11f)](a33_0x44911d['green']('✓')+_0xc407ec(0x103)+_0xcae587+_0xc407ec(0x11a));}catch(_0x3e4f2b){return console['error'](a33_0x44911d[_0xc407ec(0xe8)](_0xc407ec(0x113)+(_0x3e4f2b instanceof Error?_0x3e4f2b['message']:String(_0x3e4f2b)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0xf53dec(0xea)]=a33_0xf53dec(0xce);[a33_0xf53dec(0x10c)]=a33_0xf53dec(0xbd);static [a33_0xf53dec(0xd5)]=['site','database',a33_0xf53dec(0x11d),'llm_project',a33_0xf53dec(0xbe),a33_0xf53dec(0x10c)];['validate'](_0x30c9e8){const _0x35fb6e=a33_0xf53dec,{args:_0x23d561,options:_0x266059}=_0x30c9e8,_0x3d0f0d=_0x266059[_0x35fb6e(0xfd)]||getActiveProfile();if(!_0x3d0f0d)return'No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>';if(_0x23d561[_0x35fb6e(0xd6)]===0x0)return _0x35fb6e(0xc4)+ProfileSetCommand['VALID_KEYS'][_0x35fb6e(0xfc)](',\x20');const _0x5ea3a4=_0x23d561[0x0];if(!_0x5ea3a4[_0x35fb6e(0xdd)]('='))return _0x35fb6e(0x120)+ProfileSetCommand[_0x35fb6e(0xd5)][_0x35fb6e(0xfc)](',\x20');const [_0x56020c]=_0x5ea3a4[_0x35fb6e(0x11b)]('=',0x2);if(!ProfileSetCommand[_0x35fb6e(0xd5)]['includes'](_0x56020c))return'Unknown\x20key\x20\x27'+_0x56020c+_0x35fb6e(0x102)+ProfileSetCommand[_0x35fb6e(0xd5)][_0x35fb6e(0xfc)](',\x20');return undefined;}async[a33_0xf53dec(0xe1)](_0xc826b4){const _0x26d89f=a33_0xf53dec,{args:_0x143f4b,options:_0x4673ab}=_0xc826b4,_0x460a23=_0x4673ab[_0x26d89f(0xfd)]||getActiveProfile(),[_0x5dad1c,..._0x47473f]=_0x143f4b[0x0][_0x26d89f(0x11b)]('='),_0x3e0fde=_0x47473f[_0x26d89f(0xfc)]('=');console['log'](a33_0x44911d[_0x26d89f(0xca)]('tdx:\x20profile\x20set'));if(!profileExists(_0x460a23)){const _0x3686f9=await a33_0x22d1e7({'type':_0x26d89f(0xd3),'name':_0x26d89f(0xcc),'message':'Profile\x20\x27'+_0x460a23+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x3686f9['create'])return console['log'](_0x26d89f(0xc1)),0x1;}const _0x4630b3=loadProfile(_0x460a23),_0x3507e9=_0x4630b3?.[_0x26d89f(0x10f)]||{};if(_0x5dad1c===_0x26d89f(0x125)){const _0xcad09=resolveSite(_0x3e0fde);console[_0x26d89f(0x11f)](_0x26d89f(0xc3)+_0xcad09+'\x27\x20requires\x20API\x20key\x20validation.'),console['log'](_0x26d89f(0x109)),console[_0x26d89f(0x11f)]('\x20\x20'+getConsoleUrl(_0xcad09,_0x26d89f(0x11e)));const _0x171fce=await a33_0x22d1e7({'type':_0x26d89f(0xdc),'name':'apiKey','message':_0x26d89f(0xee),'validate':_0x3e25a1=>{const _0x29fa0e=_0x26d89f;if(!_0x3e25a1||!_0x3e25a1['trim']())return _0x29fa0e(0xf1);return!![];}});if(!_0x171fce[_0x26d89f(0xd4)])return console[_0x26d89f(0x11f)]('\x0aOperation\x20cancelled'),0x1;console[_0x26d89f(0x11f)](_0x26d89f(0x101));try{const _0x4753c8=TDX[_0x26d89f(0xcc)]({'site':_0xcad09,'apiKey':_0x171fce['apiKey'][_0x26d89f(0xdb)](),'logLevel':_0x4673ab[_0x26d89f(0xc0)]??LogLevel[_0x26d89f(0xda)]}),_0x4bab04=await _0x4753c8[_0x26d89f(0x124)]['getUserInfo']();console[_0x26d89f(0x11f)](a33_0x44911d[_0x26d89f(0xc8)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x4bab04['email']+')');const _0x3ea342=await isKeychainAvailable();_0x3ea342?(await saveAPIKeyAsync(_0x171fce[_0x26d89f(0xd4)]['trim'](),_0xcad09,_0x460a23),console['log'](a33_0x44911d[_0x26d89f(0xc8)]('✓')+_0x26d89f(0xc2))):console['warn'](a33_0x44911d[_0x26d89f(0xed)](_0x26d89f(0xfa))),_0x3507e9[_0x26d89f(0x125)]=_0xcad09;}catch(_0x609eda){if(_0x609eda instanceof HTTPClientError&&_0x609eda[_0x26d89f(0x111)]===0x191)return printAuthError(_0x609eda),0x1;return console[_0x26d89f(0xe2)](a33_0x44911d[_0x26d89f(0xe8)]('✗\x20Validation\x20failed:\x20'+(_0x609eda instanceof Error?_0x609eda[_0x26d89f(0xe9)]:String(_0x609eda)))),console[_0x26d89f(0xe2)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x3507e9[_0x5dad1c]=_0x3e0fde||undefined;return saveProfileToUserConfig(_0x460a23,_0x3507e9),console[_0x26d89f(0x11f)](a33_0x44911d['green']('✓')+'\x20Profile\x20\x27'+_0x460a23+_0x26d89f(0x112)+_0x5dad1c+'='+(_0x3e0fde||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0xf53dec(0xea)]=a33_0xf53dec(0x10b);[a33_0xf53dec(0x10c)]=a33_0xf53dec(0xc5);[a33_0xf53dec(0xc6)](_0x2bf9c8){const _0x1b549c=a33_0xf53dec,{args:_0x35828a}=_0x2bf9c8;if(_0x35828a[_0x1b549c(0xd6)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a33_0xf53dec(0xe1)](_0x11cc59){const _0x6a9f4d=a33_0xf53dec,{args:_0xb70d43,options:_0x2e399c}=_0x11cc59,_0x518225=_0xb70d43[0x0],_0x1e18d8=_0x2e399c['default'];cleanExpiredSessions();if(!profileExists(_0x518225)){console['error'](a33_0x44911d['red']('Profile\x20\x27'+_0x518225+_0x6a9f4d(0xfe))),console['log'](_0x6a9f4d(0xd7));const _0x1d9838=listProfiles();if(_0x1d9838[_0x6a9f4d(0xd6)]===0x0)console['log'](_0x6a9f4d(0x106));else for(const _0x38b79e of _0x1d9838){console[_0x6a9f4d(0x11f)](_0x6a9f4d(0xcb)+_0x38b79e[_0x6a9f4d(0xea)]);}return 0x1;}if(_0x1e18d8){const _0x3152c6=a33_0x3b3c4d['join'](getConfigDir(),_0x6a9f4d(0x114));return saveActiveProfileToUserConfig(_0x518225),console[_0x6a9f4d(0x11f)]('Default\x20profile\x20set\x20to:\x20'+a33_0x44911d[_0x6a9f4d(0xc8)](_0x518225)),console[_0x6a9f4d(0x11f)](a33_0x44911d[_0x6a9f4d(0xeb)](_0x6a9f4d(0xde)+_0x3152c6)),0x0;}const _0x43aec5=getSessionID(_0x2e399c[_0x6a9f4d(0xe3)]);return saveSessionContext({'profile':_0x518225},_0x2e399c[_0x6a9f4d(0xe3)]),console[_0x6a9f4d(0x11f)](_0x6a9f4d(0x107)+a33_0x44911d[_0x6a9f4d(0xc8)](_0x518225)+'\x20'+a33_0x44911d[_0x6a9f4d(0xeb)]('(session:\x20'+_0x43aec5+')')),console[_0x6a9f4d(0x11f)](a33_0x44911d[_0x6a9f4d(0xeb)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x518225+_0x6a9f4d(0xec))),0x0;}}
@@ -1 +1 @@
1
- const a34_0x412436=a34_0x553d;(function(_0x53a71c,_0x3f42ab){const _0x2d87ea=a34_0x553d,_0xde4c65=_0x53a71c();while(!![]){try{const _0x5645d1=parseInt(_0x2d87ea(0x110))/0x1+parseInt(_0x2d87ea(0x107))/0x2*(parseInt(_0x2d87ea(0x10e))/0x3)+-parseInt(_0x2d87ea(0x11b))/0x4+parseInt(_0x2d87ea(0x11f))/0x5+-parseInt(_0x2d87ea(0x117))/0x6*(-parseInt(_0x2d87ea(0x106))/0x7)+-parseInt(_0x2d87ea(0x105))/0x8*(-parseInt(_0x2d87ea(0x11a))/0x9)+-parseInt(_0x2d87ea(0x109))/0xa;if(_0x5645d1===_0x3f42ab)break;else _0xde4c65['push'](_0xde4c65['shift']());}catch(_0x3b9c05){_0xde4c65['push'](_0xde4c65['shift']());}}}(a34_0x238e,0xdfe4d));function a34_0x553d(_0x3e5f6a,_0x4b0012){_0x3e5f6a=_0x3e5f6a-0x104;const _0x238edc=a34_0x238e();let _0x553d1a=_0x238edc[_0x3e5f6a];return _0x553d1a;}import{BaseCommand}from'./command.js';function a34_0x238e(){const _0x3aa0cd=['description','config','name','\x20\x20Global:\x20~/.config/tdx/tdx.json','execute','18VzIjsR','map','scope','4574322iXJUPX','1069200MOGRCY','profiles','error','List\x20all\x20available\x20profiles','1226310oCmIKE','Error:\x20','16DhmVIV','3725918ekpCvI','263782zaeyAu','log','20457230XEECWQ','👤\x20','site','green','dim','3FnHdUW','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','239601pPZmXB','message'];a34_0x238e=function(){return _0x3aa0cd;};return a34_0x238e();}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x53bd53 from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x412436(0x114)]=a34_0x412436(0x11c);[a34_0x412436(0x112)]=a34_0x412436(0x11e);async[a34_0x412436(0x116)](_0x49a7ef){const _0x109763=a34_0x412436,{options:_0x5a7243}=_0x49a7ef;try{const _0x234eb3=listProfiles(),_0x5a548e=getActiveProfile();if(_0x234eb3['length']===0x0)return console[_0x109763(0x108)](_0x109763(0x10f)),console[_0x109763(0x108)]('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console[_0x109763(0x108)](_0x109763(0x115)),0x0;const _0x1b158f=_0x234eb3[_0x109763(0x118)](_0xbfa3de=>{const _0x507019=_0x109763,_0x19281e=_0xbfa3de['name']===_0x5a548e,_0x157372=getProfileParams(_0xbfa3de[_0x507019(0x113)]);return{'name':_0xbfa3de['name'],'active':_0x19281e,'scope':_0xbfa3de[_0x507019(0x119)],'description':_0xbfa3de[_0x507019(0x113)]['description']||'','params':_0x157372};});if(isStructuredFormat(_0x5a7243))await handleSDKOutput(_0x1b158f,_0x5a7243);else for(const _0x16dece of _0x234eb3){const _0x15f5c2=_0x16dece['name']===_0x5a548e?a34_0x53bd53[_0x109763(0x10c)]('\x20✓'):'',_0x4ffda6=_0x16dece[_0x109763(0x113)][_0x109763(0x10b)]?a34_0x53bd53['dim']('\x20'+_0x16dece[_0x109763(0x113)][_0x109763(0x10b)]):'',_0x5dd5e5=_0x16dece[_0x109763(0x113)][_0x109763(0x112)]?a34_0x53bd53[_0x109763(0x10d)]('\x20\x20'+_0x16dece['config'][_0x109763(0x112)]):'';console[_0x109763(0x108)](_0x109763(0x10a)+_0x16dece[_0x109763(0x114)]+_0x15f5c2+_0x4ffda6+_0x5dd5e5);}return 0x0;}catch(_0x592626){return _0x592626 instanceof Error&&console[_0x109763(0x11d)](_0x109763(0x104)+_0x592626[_0x109763(0x111)]),0x1;}}}
1
+ function a34_0x250c(){const _0x519fbf=['3340UYBuep','config','scope','12432owvgFP','profiles','site','1645590CkktOT','5RpbHvv','6258MLcYdT','map','2390480YlpuXI','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','description','👤\x20','List\x20all\x20available\x20profiles','green','dim','1176603BszEHL','log','592432LYgNNr','message','length','1BFAHdr','error','11076912hSjuSC','17215mresmW','name'];a34_0x250c=function(){return _0x519fbf;};return a34_0x250c();}const a34_0x2889ba=a34_0x17f8;(function(_0x2cef32,_0x3306d9){const _0x5a884f=a34_0x17f8,_0x1e108b=_0x2cef32();while(!![]){try{const _0x40b28b=-parseInt(_0x5a884f(0xad))/0x1*(-parseInt(_0x5a884f(0xaa))/0x2)+parseInt(_0x5a884f(0xc4))/0x3+parseInt(_0x5a884f(0xbc))/0x4*(-parseInt(_0x5a884f(0xb9))/0x5)+parseInt(_0x5a884f(0xb8))/0x6+-parseInt(_0x5a884f(0xba))/0x7*(parseInt(_0x5a884f(0xb5))/0x8)+parseInt(_0x5a884f(0xaf))/0x9+parseInt(_0x5a884f(0xb2))/0xa*(parseInt(_0x5a884f(0xb0))/0xb);if(_0x40b28b===_0x3306d9)break;else _0x1e108b['push'](_0x1e108b['shift']());}catch(_0x2424b7){_0x1e108b['push'](_0x1e108b['shift']());}}}(a34_0x250c,0xb20b0));import{BaseCommand}from'./command.js';function a34_0x17f8(_0x329f59,_0xe5c30){_0x329f59=_0x329f59-0xaa;const _0x250c29=a34_0x250c();let _0x17f810=_0x250c29[_0x329f59];return _0x17f810;}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x127032 from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x2889ba(0xb1)]=a34_0x2889ba(0xb6);[a34_0x2889ba(0xbf)]=a34_0x2889ba(0xc1);async['execute'](_0xbb95a3){const _0x42e4de=a34_0x2889ba,{options:_0x5d677f}=_0xbb95a3;try{const _0x584b93=listProfiles(),_0x17270a=getActiveProfile();if(_0x584b93[_0x42e4de(0xac)]===0x0)return console[_0x42e4de(0xc5)](_0x42e4de(0xbe)),console['log'](_0x42e4de(0xbd)),console[_0x42e4de(0xc5)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x2e0ffd=_0x584b93[_0x42e4de(0xbb)](_0x38aa29=>{const _0x5a3a12=_0x42e4de,_0x16e70d=_0x38aa29[_0x5a3a12(0xb1)]===_0x17270a,_0xe9c980=getProfileParams(_0x38aa29[_0x5a3a12(0xb3)]);return{'name':_0x38aa29[_0x5a3a12(0xb1)],'active':_0x16e70d,'scope':_0x38aa29[_0x5a3a12(0xb4)],'description':_0x38aa29['config'][_0x5a3a12(0xbf)]||'','params':_0xe9c980};});if(isStructuredFormat(_0x5d677f))await handleSDKOutput(_0x2e0ffd,_0x5d677f);else for(const _0x46ae5a of _0x584b93){const _0x47bb7b=_0x46ae5a['name']===_0x17270a?a34_0x127032[_0x42e4de(0xc2)]('\x20✓'):'',_0xcce5c1=_0x46ae5a[_0x42e4de(0xb3)][_0x42e4de(0xb7)]?a34_0x127032[_0x42e4de(0xc3)]('\x20'+_0x46ae5a[_0x42e4de(0xb3)][_0x42e4de(0xb7)]):'',_0x591a60=_0x46ae5a[_0x42e4de(0xb3)][_0x42e4de(0xbf)]?a34_0x127032['dim']('\x20\x20'+_0x46ae5a[_0x42e4de(0xb3)][_0x42e4de(0xbf)]):'';console[_0x42e4de(0xc5)](_0x42e4de(0xc0)+_0x46ae5a[_0x42e4de(0xb1)]+_0x47bb7b+_0xcce5c1+_0x591a60);}return 0x0;}catch(_0x31e514){return _0x31e514 instanceof Error&&console[_0x42e4de(0xae)]('Error:\x20'+_0x31e514[_0x42e4de(0xab)]),0x1;}}}
@@ -1 +1 @@
1
- const a35_0x261a5b=a35_0x1dd4;(function(_0x44ba0f,_0x12226d){const _0x43a604=a35_0x1dd4,_0x361c50=_0x44ba0f();while(!![]){try{const _0x2dbca5=parseInt(_0x43a604(0x130))/0x1+-parseInt(_0x43a604(0x12b))/0x2*(-parseInt(_0x43a604(0x146))/0x3)+-parseInt(_0x43a604(0x147))/0x4*(-parseInt(_0x43a604(0x13a))/0x5)+-parseInt(_0x43a604(0x132))/0x6*(-parseInt(_0x43a604(0x143))/0x7)+-parseInt(_0x43a604(0x138))/0x8*(parseInt(_0x43a604(0x12a))/0x9)+-parseInt(_0x43a604(0x128))/0xa*(-parseInt(_0x43a604(0x141))/0xb)+-parseInt(_0x43a604(0x13e))/0xc;if(_0x2dbca5===_0x12226d)break;else _0x361c50['push'](_0x361c50['shift']());}catch(_0x2eca79){_0x361c50['push'](_0x361c50['shift']());}}}(a35_0x6bc3,0xe37fc));import{BaseCommand}from'./command.js';function a35_0x1dd4(_0x58f77e,_0x47abfc){_0x58f77e=_0x58f77e-0x119;const _0x6bc35d=a35_0x6bc3();let _0x1dd4c1=_0x6bc35d[_0x58f77e];return _0x1dd4c1;}import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';function a35_0x6bc3(){const _0x32b16b=['Statement\x20','\x20splits','Run\x20Trino\x20queries\x20(streaming)','...','name','verbose','Error:\x20','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','join','catalog','\x20[Job\x20ID:\x20','SQL:\x20','file','Executing\x20query...','error','setJobId','site','Executing\x20query\x20[','330zmTNQW','setExtra','30042RlzMrI','240246PtYrBl','stats','processedRows','query','message','1581900VRfquU','args','1782564rbGuLH','\x20-\x20','execute','\x0aAll\x20results\x20saved\x20to\x20','Query\x20completed:\x20Processed\x20','No\x20SQL\x20provided','1104zTAebn','originalMessage','4346380AdWOTE','length','elapsedTimeMillis','\x20rows\x20','37716012XSGsiT','output','push','138479DOtaTI','Site:\x20','28fDgFGn','setPhase','completedSplits','12pGTixQ','4cATdrP','data','Executing\x20statement\x20'];a35_0x6bc3=function(){return _0x32b16b;};return a35_0x6bc3();}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a35_0x261a5b(0x11a)]=a35_0x261a5b(0x12e);['description']=a35_0x261a5b(0x14c);async[a35_0x261a5b(0x134)](_0x27042f){const _0x50b166=a35_0x261a5b,{options:_0x650e84,args:_0x5181dd,tdx:_0x337b64}=_0x27042f,_0xdc4e9a={..._0x650e84,'limitStructuredFormats':!![]},_0x5116d7=_0x5181dd[0x0],_0x4beab5=_0x650e84[_0x50b166(0x122)];let _0x3ccd97;try{if(_0x4beab5)_0x3ccd97=readSqlStatementsFromFile(_0x4beab5);else{if(_0x5116d7==='-')_0x3ccd97=await readSqlStatementsFromStdin();else{if(_0x5116d7&&isSqlFilePath(_0x5116d7))_0x3ccd97=readSqlStatementsFromFile(_0x5116d7);else{if(_0x5116d7)_0x3ccd97=splitSqlStatements(_0x5116d7);else throw new Error(_0x50b166(0x137));}}}}catch(_0x350e55){return console[_0x50b166(0x124)](_0x50b166(0x11c)+_0x350e55[_0x50b166(0x12f)]),0x1;}const _0x139093=_0x650e84['database']||'information_schema',_0x59b56d=_0x650e84[_0x50b166(0x11f)];try{const _0x1984ad=[],_0x46081d=!!_0x650e84[_0x50b166(0x13f)];for(let _0x242b4f=0x0;_0x242b4f<_0x3ccd97['length'];_0x242b4f++){const _0x58c44c=_0x3ccd97[_0x242b4f],_0x22ce16=_0x242b4f+0x1,_0x46b6fd=_0x3ccd97[_0x50b166(0x13b)],_0x1a593a=_0x46b6fd>0x1;_0x650e84['verbose']&&(console['error']('\x0a'+(_0x1a593a?'Statement\x20'+_0x22ce16+'/'+_0x46b6fd+':':'')),console[_0x50b166(0x124)](_0x50b166(0x142)+_0x650e84[_0x50b166(0x126)]),console[_0x50b166(0x124)]('Catalog:\x20'+(_0x59b56d||'td')),console[_0x50b166(0x124)]('Schema:\x20'+_0x139093),console[_0x50b166(0x124)](_0x50b166(0x121)+_0x58c44c));const _0x459643=_0x1a593a?_0x50b166(0x149)+_0x22ce16+'/'+_0x46b6fd+_0x50b166(0x119):_0x50b166(0x123);try{const _0x40505e=await withProgressSpinner(_0x459643,async _0x2c87c2=>{const _0x3be803=_0x50b166,_0x3e6145=await _0x337b64[_0x3be803(0x12e)][_0x3be803(0x134)](_0x58c44c,{'catalog':_0x59b56d,'schema':_0x139093,'onJobId':_0x5d4497=>{const _0xbbe232=_0x3be803;_0x2c87c2[_0xbbe232(0x125)](_0x5d4497);},'onProgress':_0x1c23c0=>{const _0x29096f=_0x3be803;_0x2c87c2[_0x29096f(0x144)](_0x29096f(0x127)+_0x1c23c0['state']+']'),_0x2c87c2[_0x29096f(0x129)](formatRows(_0x1c23c0[_0x29096f(0x12d)])+_0x29096f(0x13d)+_0x1c23c0[_0x29096f(0x145)]+'/'+_0x1c23c0['totalSplits']+_0x29096f(0x14b));}});return _0x3e6145;},{'verbose':_0x650e84[_0x50b166(0x11b)]}),_0x3e6dd9=_0x40505e[_0x50b166(0x148)],_0x8c2865=_0x3e6dd9['jobId']?_0x50b166(0x120)+_0x3e6dd9['jobId']+']':'',_0x437b93=_0x1a593a?_0x50b166(0x14a)+_0x22ce16+'/'+_0x46b6fd+_0x50b166(0x133):'';console['error']('✔\x20'+_0x437b93+_0x50b166(0x136)+formatRows(_0x3e6dd9[_0x50b166(0x12c)]['processedRows'])+_0x50b166(0x13d)+('in\x20'+formatElapsed(_0x3e6dd9[_0x50b166(0x12c)][_0x50b166(0x13c)])+_0x8c2865));if(_0x1a593a&&_0x46081d){const _0x34f016=resolveOutputOptions(_0xdc4e9a),_0x457951=await formatQueryOutput(_0x3e6dd9,_0x34f016);_0x1984ad[_0x50b166(0x140)](_0x457951);}else await handleQueryOutput(_0x3e6dd9,_0xdc4e9a);}catch(_0x56148e){const _0x3faeaa=_0x1a593a?'Statement\x20'+_0x22ce16+'/'+_0x46b6fd+':\x0a':'',_0x241011=_0x56148e instanceof SDKError?_0x56148e[_0x50b166(0x139)]:_0x56148e['message'];return console[_0x50b166(0x124)](''+_0x3faeaa+_0x241011),0x1;}}if(_0x3ccd97[_0x50b166(0x13b)]>0x1&&_0x46081d&&_0x1984ad[_0x50b166(0x13b)]>0x0){const _0x178bd4=_0x1984ad[_0x50b166(0x11e)]('\x0a');writeFileSync(_0x650e84[_0x50b166(0x13f)],_0x178bd4),console['error'](_0x50b166(0x135)+_0x650e84[_0x50b166(0x13f)]);}return 0x0;}catch(_0x335112){throw _0x335112;}}['validate'](_0x46af2e){const _0x40ba2a=a35_0x261a5b,_0x4d579c=_0x46af2e[_0x40ba2a(0x131)][0x0],_0x23a6eb=_0x46af2e['options'][_0x40ba2a(0x122)];if(!_0x4d579c&&!_0x23a6eb)return _0x40ba2a(0x11d);if(_0x4d579c&&_0x23a6eb)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}
1
+ const a35_0x4eb79a=a35_0x57c7;(function(_0x468e29,_0x346cb6){const _0x4539d1=a35_0x57c7,_0x5c4982=_0x468e29();while(!![]){try{const _0x23a149=parseInt(_0x4539d1(0x117))/0x1+parseInt(_0x4539d1(0x141))/0x2*(parseInt(_0x4539d1(0x11d))/0x3)+-parseInt(_0x4539d1(0x138))/0x4*(-parseInt(_0x4539d1(0x121))/0x5)+parseInt(_0x4539d1(0x127))/0x6*(-parseInt(_0x4539d1(0x114))/0x7)+parseInt(_0x4539d1(0x125))/0x8+-parseInt(_0x4539d1(0x139))/0x9+-parseInt(_0x4539d1(0x11f))/0xa;if(_0x23a149===_0x346cb6)break;else _0x5c4982['push'](_0x5c4982['shift']());}catch(_0x27f80f){_0x5c4982['push'](_0x5c4982['shift']());}}}(a35_0x5420,0xa2819));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a35_0x57c7(_0x364b33,_0x31f024){_0x364b33=_0x364b33-0x113;const _0x542050=a35_0x5420();let _0x57c75e=_0x542050[_0x364b33];return _0x57c75e;}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';function a35_0x5420(){const _0x36ef36=['Query\x20completed:\x20Processed\x20','verbose','elapsedTimeMillis','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','length','args','Executing\x20query...','Executing\x20query\x20[','Run\x20Trino\x20queries\x20(streaming)','...','setExtra','output','\x20rows\x20','push','24dNQSkP','10598805yjpLMh','Error:\x20','setPhase','execute','completedSplits','setJobId','catalog','error','526tQfHvT','site','\x20splits','371EBuYpA','query','Statement\x20','1276206MXGgly','jobId','No\x20SQL\x20provided','stats','Catalog:\x20','message','2022ERUzPT','options','1719420KXpHbT','\x20-\x20','640540cCsMHN','processedRows','Executing\x20statement\x20','originalMessage','6185800GaCXtd','description','110958gRdGwL','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','in\x20'];a35_0x5420=function(){return _0x36ef36;};return a35_0x5420();}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a35_0x4eb79a(0x115);[a35_0x4eb79a(0x126)]=a35_0x4eb79a(0x132);async[a35_0x4eb79a(0x13c)](_0x4b6574){const _0x595bc3=a35_0x4eb79a,{options:_0x58f63b,args:_0x39d41f,tdx:_0x3a928e}=_0x4b6574,_0x98e0ad={..._0x58f63b,'limitStructuredFormats':!![]},_0x15e96b=_0x39d41f[0x0],_0x437442=_0x58f63b['file'];let _0x292230;try{if(_0x437442)_0x292230=readSqlStatementsFromFile(_0x437442);else{if(_0x15e96b==='-')_0x292230=await readSqlStatementsFromStdin();else{if(_0x15e96b&&isSqlFilePath(_0x15e96b))_0x292230=readSqlStatementsFromFile(_0x15e96b);else{if(_0x15e96b)_0x292230=splitSqlStatements(_0x15e96b);else throw new Error(_0x595bc3(0x119));}}}}catch(_0x2c40b5){return console[_0x595bc3(0x140)](_0x595bc3(0x13a)+_0x2c40b5[_0x595bc3(0x11c)]),0x1;}const _0x4f125a=_0x58f63b['database']||'information_schema',_0x53d11a=_0x58f63b[_0x595bc3(0x13f)];try{const _0x2e35ef=[],_0x4b141f=!!_0x58f63b[_0x595bc3(0x135)];for(let _0x12b751=0x0;_0x12b751<_0x292230[_0x595bc3(0x12e)];_0x12b751++){const _0x246b50=_0x292230[_0x12b751],_0xe696fa=_0x12b751+0x1,_0x1d5f74=_0x292230[_0x595bc3(0x12e)],_0x4c6600=_0x1d5f74>0x1;_0x58f63b['verbose']&&(console[_0x595bc3(0x140)]('\x0a'+(_0x4c6600?_0x595bc3(0x116)+_0xe696fa+'/'+_0x1d5f74+':':'')),console[_0x595bc3(0x140)]('Site:\x20'+_0x58f63b[_0x595bc3(0x142)]),console['error'](_0x595bc3(0x11b)+(_0x53d11a||'td')),console[_0x595bc3(0x140)]('Schema:\x20'+_0x4f125a),console[_0x595bc3(0x140)]('SQL:\x20'+_0x246b50));const _0x40b04c=_0x4c6600?_0x595bc3(0x123)+_0xe696fa+'/'+_0x1d5f74+_0x595bc3(0x133):_0x595bc3(0x130);try{const _0x1a0e89=await withProgressSpinner(_0x40b04c,async _0x420eee=>{const _0xa47e44=_0x595bc3,_0x291485=await _0x3a928e[_0xa47e44(0x115)]['execute'](_0x246b50,{'catalog':_0x53d11a,'schema':_0x4f125a,'onJobId':_0x1fdc83=>{const _0x1e38cb=_0xa47e44;_0x420eee[_0x1e38cb(0x13e)](_0x1fdc83);},'onProgress':_0x3e8fd4=>{const _0x488ecb=_0xa47e44;_0x420eee[_0x488ecb(0x13b)](_0x488ecb(0x131)+_0x3e8fd4['state']+']'),_0x420eee[_0x488ecb(0x134)](formatRows(_0x3e8fd4[_0x488ecb(0x122)])+'\x20rows\x20'+_0x3e8fd4[_0x488ecb(0x13d)]+'/'+_0x3e8fd4['totalSplits']+_0x488ecb(0x113));}});return _0x291485;},{'verbose':_0x58f63b[_0x595bc3(0x12b)]}),_0x12d1a4=_0x1a0e89['data'],_0x2c9bad=_0x12d1a4['jobId']?'\x20[Job\x20ID:\x20'+_0x12d1a4[_0x595bc3(0x118)]+']':'',_0x395e33=_0x4c6600?'Statement\x20'+_0xe696fa+'/'+_0x1d5f74+_0x595bc3(0x120):'';console[_0x595bc3(0x140)]('✔\x20'+_0x395e33+_0x595bc3(0x12a)+formatRows(_0x12d1a4[_0x595bc3(0x11a)]['processedRows'])+_0x595bc3(0x136)+(_0x595bc3(0x129)+formatElapsed(_0x12d1a4[_0x595bc3(0x11a)][_0x595bc3(0x12c)])+_0x2c9bad));if(_0x4c6600&&_0x4b141f){const _0x29a66b=resolveOutputOptions(_0x98e0ad),_0x159d25=await formatQueryOutput(_0x12d1a4,_0x29a66b);_0x2e35ef[_0x595bc3(0x137)](_0x159d25);}else await handleQueryOutput(_0x12d1a4,_0x98e0ad);}catch(_0x2ebbb5){const _0x4f01e5=_0x4c6600?_0x595bc3(0x116)+_0xe696fa+'/'+_0x1d5f74+':\x0a':'',_0x4d0dfe=_0x2ebbb5 instanceof SDKError?_0x2ebbb5[_0x595bc3(0x124)]:_0x2ebbb5[_0x595bc3(0x11c)];return console[_0x595bc3(0x140)](''+_0x4f01e5+_0x4d0dfe),0x1;}}if(_0x292230[_0x595bc3(0x12e)]>0x1&&_0x4b141f&&_0x2e35ef[_0x595bc3(0x12e)]>0x0){const _0x46d879=_0x2e35ef['join']('\x0a');writeFileSync(_0x58f63b[_0x595bc3(0x135)],_0x46d879),console[_0x595bc3(0x140)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x58f63b[_0x595bc3(0x135)]);}return 0x0;}catch(_0x3bf6a1){throw _0x3bf6a1;}}['validate'](_0x1ecd04){const _0x4938fd=a35_0x4eb79a,_0x445e70=_0x1ecd04[_0x4938fd(0x12f)][0x0],_0x56ec4b=_0x1ecd04[_0x4938fd(0x11e)]['file'];if(!_0x445e70&&!_0x56ec4b)return _0x4938fd(0x12d);if(_0x445e70&&_0x56ec4b)return _0x4938fd(0x128);return undefined;}}
@@ -1 +1 @@
1
- const a36_0x180c5e=a36_0xf564;(function(_0x342385,_0x2d8a67){const _0x9674ed=a36_0xf564,_0x8731b4=_0x342385();while(!![]){try{const _0x495538=-parseInt(_0x9674ed(0x1ac))/0x1+parseInt(_0x9674ed(0x18c))/0x2*(-parseInt(_0x9674ed(0x1dd))/0x3)+-parseInt(_0x9674ed(0x17e))/0x4+parseInt(_0x9674ed(0x16c))/0x5*(-parseInt(_0x9674ed(0x1d9))/0x6)+-parseInt(_0x9674ed(0x1c0))/0x7+parseInt(_0x9674ed(0x1de))/0x8+-parseInt(_0x9674ed(0x196))/0x9*(-parseInt(_0x9674ed(0x191))/0xa);if(_0x495538===_0x2d8a67)break;else _0x8731b4['push'](_0x8731b4['shift']());}catch(_0x2a83f4){_0x8731b4['push'](_0x8731b4['shift']());}}}(a36_0xde65,0xcd37d));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';function a36_0xf564(_0x393b54,_0x3c2fe4){_0x393b54=_0x393b54-0x150;const _0xde651b=a36_0xde65();let _0xf5647c=_0xde651b[_0x393b54];return _0xf5647c;}import a36_0x26f0cb from'chalk';function formatRelativeTime(_0xb9a860){const _0x538bc7=a36_0xf564,_0x492644=new Date(_0xb9a860),_0x21a6e9=new Date(),_0x113ac5=_0x492644[_0x538bc7(0x18a)]()-_0x21a6e9[_0x538bc7(0x18a)](),_0x350f11=Math[_0x538bc7(0x195)](_0x113ac5)/0x3e8,_0x582ef4=_0x113ac5<0x0;if(_0x350f11<0x3c)return _0x582ef4?_0x538bc7(0x153):_0x538bc7(0x15d);else{if(_0x350f11<0xe10){const _0x2e4bc2=Math[_0x538bc7(0x1dc)](_0x350f11/0x3c);return _0x582ef4?_0x2e4bc2+_0x538bc7(0x1d7):_0x538bc7(0x1df)+_0x2e4bc2+'m';}else{if(_0x350f11<0x15180){const _0x77dc54=Math['round'](_0x350f11/0xe10);return _0x582ef4?_0x77dc54+_0x538bc7(0x1ca):_0x538bc7(0x1df)+_0x77dc54+'h';}else{if(_0x350f11<0x93a80){const _0x1cbe70=Math[_0x538bc7(0x1dc)](_0x350f11/0x15180);return _0x582ef4?_0x1cbe70+_0x538bc7(0x1c5):_0x538bc7(0x1df)+_0x1cbe70+'d';}else return _0x492644[_0x538bc7(0x172)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x180c5e(0x1e0)]=a36_0x180c5e(0x1a6);[a36_0x180c5e(0x1a8)]=a36_0x180c5e(0x1a3);async[a36_0x180c5e(0x17d)](_0x1416b8){const _0x11f52c=a36_0x180c5e,{options:_0x498dab,args:_0x529b0f,tdx:_0x4d9d0f}=_0x1416b8,_0x32f93e=resolveLimit(_0x498dab['limit'],DEFAULT_DISPLAY_LIMIT),_0xa8cfca=_0x529b0f[0x0],_0x593e68=_0xa8cfca?_0x11f52c(0x157)+_0xa8cfca+'\x22...':_0x11f52c(0x1c4),_0x3628af=await withSpinner(_0x593e68,()=>_0x4d9d0f['schedules'][_0x11f52c(0x1c7)]({'limit':_0x32f93e,'scheduled':!![],'pattern':_0xa8cfca}),{'verbose':_0x498dab[_0x11f52c(0x1bd)]}),_0x13902d=_0x3628af['data'][_0x11f52c(0x1e2)],_0x1e322a=_0x3628af[_0x11f52c(0x169)][_0x11f52c(0x177)][_0x11f52c(0x155)],_0xd96c24=_0xa8cfca?_0x11f52c(0x184)+_0xa8cfca+'\x22':'';_0x1e322a?console['error'](_0x11f52c(0x1c6)+_0x13902d[_0x11f52c(0x1b3)]+_0x11f52c(0x1ce)+_0xd96c24+'\x20(use\x20--limit\x20to\x20see\x20more)'):console['error'](_0x11f52c(0x167)+_0x13902d['length']+_0x11f52c(0x159)+(_0x13902d[_0x11f52c(0x1b3)]!==0x1?_0x11f52c(0x1b2):'y')+_0xd96c24);if(_0x498dab[_0x11f52c(0x1d5)]==='json'||_0x498dab[_0x11f52c(0x1d5)]===_0x11f52c(0x166)||_0x498dab[_0x11f52c(0x1d5)]===_0x11f52c(0x160)||_0x498dab['format']===_0x11f52c(0x19d)){const _0x5f16f6=_0x13902d[_0x11f52c(0x175)](_0x100f21=>({'id':_0x100f21['id'],'name':_0x100f21[_0x11f52c(0x1e0)],'cron':_0x100f21['cron'],'database':_0x100f21[_0x11f52c(0x17b)]?.[_0x11f52c(0x1e0)],'type':_0x100f21[_0x11f52c(0x1c8)],'timezone':_0x100f21[_0x11f52c(0x162)],'user_name':_0x100f21['user']?.['name'],'updated_at':_0x100f21[_0x11f52c(0x185)],'next_run_at':_0x100f21[_0x11f52c(0x1bc)],'last_job_status':_0x100f21[_0x11f52c(0x161)]?.[_0x11f52c(0x18f)]}));await handleSDKOutput(_0x5f16f6,_0x498dab);}else{if(_0x13902d[_0x11f52c(0x1b3)]===0x0)console['log'](_0x11f52c(0x1c3));else{const _0x329bbd=_0x498dab[_0x11f52c(0x1cd)],_0x150e43=_0x13902d['map'](_0x53d843=>{const _0x410dd7=_0x11f52c,_0x16286d=_0x53d843['last_job']?.[_0x410dd7(0x18f)]?_0x53d843[_0x410dd7(0x161)]['status']===_0x410dd7(0x1b5)?'✓':'✗':'-',_0x4e4930=_0x53d843[_0x410dd7(0x161)]?.[_0x410dd7(0x1d1)]?formatRelativeTime(_0x53d843[_0x410dd7(0x161)]['ended_at']):_0x410dd7(0x174),_0x112e7c=_0x53d843[_0x410dd7(0x1bc)]?formatRelativeTime(_0x53d843[_0x410dd7(0x1bc)]):'-',_0x517f05=_0x53d843[_0x410dd7(0x1ba)]||'',_0x1c9dd6=_0x53d843['name']||'(unnamed)',_0x1f6a79=getConsoleUrl(_0x329bbd,_0x410dd7(0x1b9)+_0x53d843['id']);return{'statusIcon':_0x16286d,'lastRun':_0x4e4930,'nextRun':_0x112e7c,'cron':_0x517f05,'name':_0x1c9dd6,'queryUrl':_0x1f6a79,'status':_0x53d843[_0x410dd7(0x161)]?.[_0x410dd7(0x18f)]};}),_0x5c2aee=Math[_0x11f52c(0x1a2)](..._0x150e43[_0x11f52c(0x175)](_0x3e1bc2=>_0x3e1bc2[_0x11f52c(0x1ab)]['length'])),_0x2e4316=Math['max'](..._0x150e43[_0x11f52c(0x175)](_0x426e3f=>_0x426e3f[_0x11f52c(0x1a7)][_0x11f52c(0x1b3)])),_0x409977=Math[_0x11f52c(0x1a2)](..._0x150e43[_0x11f52c(0x175)](_0x1a3fb1=>_0x1a3fb1[_0x11f52c(0x1ba)]['length'])),_0x1ffcdf=_0x150e43[_0x11f52c(0x175)](_0x52a420=>{const _0x1b0a81=_0x11f52c,_0x53cc03=_0x52a420['status']===_0x1b0a81(0x1b5)?a36_0x26f0cb[_0x1b0a81(0x1a1)](_0x52a420[_0x1b0a81(0x151)]):_0x52a420['status']===_0x1b0a81(0x1d3)?a36_0x26f0cb[_0x1b0a81(0x199)](_0x52a420[_0x1b0a81(0x151)]):a36_0x26f0cb[_0x1b0a81(0x1c1)](_0x52a420[_0x1b0a81(0x151)]),_0x317126=_0x52a420[_0x1b0a81(0x1ab)][_0x1b0a81(0x158)](_0x5c2aee),_0x243a72=_0x52a420['nextRun'][_0x1b0a81(0x158)](_0x2e4316),_0x56b471=_0x52a420['cron']?a36_0x26f0cb[_0x1b0a81(0x15b)](_0x52a420['cron'][_0x1b0a81(0x158)](_0x409977)):'\x20'[_0x1b0a81(0x197)](_0x409977),_0xbbd2be=hyperlink(_0x52a420[_0x1b0a81(0x1e0)],_0x52a420[_0x1b0a81(0x1a9)]);return _0x1b0a81(0x1b6)+_0x53cc03+'\x20'+_0x317126+_0x1b0a81(0x193)+_0x243a72+'\x20\x20'+_0x56b471+'\x20\x20'+_0xbbd2be;});await writeOutput(_0x1ffcdf[_0x11f52c(0x1ae)]('\x0a'),_0x498dab[_0x11f52c(0x180)],_0x11f52c(0x170));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x180c5e(0x1e0)]=a36_0x180c5e(0x187);[a36_0x180c5e(0x1a8)]=a36_0x180c5e(0x1b8);[a36_0x180c5e(0x1d0)](_0x319f88){const _0x5142cc=a36_0x180c5e,_0x51dbef=_0x319f88[_0x5142cc(0x15c)][0x0];if(!_0x51dbef)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async[a36_0x180c5e(0x17d)](_0x2cdca3){const _0x3b822f=a36_0x180c5e,{options:_0x56e082,args:_0x10b005,tdx:_0x2b0427}=_0x2cdca3,_0x468b8b=_0x10b005[0x0],_0x1cef5c=await withSpinner(_0x3b822f(0x17c),()=>_0x2b0427[_0x3b822f(0x16f)]['show'](_0x468b8b),{'verbose':_0x56e082[_0x3b822f(0x1bd)]}),_0x3b551d=_0x1cef5c[_0x3b822f(0x169)],_0x374fe1={'name':_0x3b551d[_0x3b822f(0x1e0)],'cron':_0x3b551d[_0x3b822f(0x1ba)],'database':_0x3b551d[_0x3b822f(0x17b)],'type':_0x3b551d[_0x3b822f(0x1c8)],'timezone':_0x3b551d['timezone'],'user_name':_0x3b551d['user_name'],'created_at':_0x3b551d['created_at'],'engine_version':_0x3b551d[_0x3b822f(0x1d4)],'executing_user_id':_0x3b551d[_0x3b822f(0x18e)],'query':_0x3b551d['query'],'delay':_0x3b551d[_0x3b822f(0x164)],'priority':_0x3b551d['priority'],'retry_limit':_0x3b551d[_0x3b822f(0x194)],..._0x3b551d[_0x3b822f(0x198)]&&{'result':_0x3b551d['result']}};return await handleSingleObjectOutput(_0x374fe1,_0x56e082),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']='schedule:create';['description']='Create\x20a\x20scheduled\x20query';[a36_0x180c5e(0x1d0)](_0x3fd4e3){const _0x1138cf=a36_0x180c5e,_0x1b2ca5=_0x3fd4e3['args'][0x0];if(!_0x1b2ca5)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';const _0x55a5ac=_0x3fd4e3[_0x1138cf(0x19c)];if(!_0x55a5ac[_0x1138cf(0x17b)])return _0x1138cf(0x15a);return undefined;}async['execute'](_0x4d0009){const _0x2fd7df=a36_0x180c5e,{options:_0x1b1e3d,args:_0x3879cf,tdx:_0x544be2}=_0x4d0009,_0x900a38=_0x3879cf[0x0],_0x39a4b7=_0x1b1e3d,_0x125ec8=_0x39a4b7[_0x2fd7df(0x17b)],_0x3bef2c=_0x39a4b7[_0x2fd7df(0x1a5)],_0x5223a3=_0x39a4b7['type']||_0x2fd7df(0x18b);let _0x48e9ea;try{_0x48e9ea=readFileSync(_0x3bef2c,_0x2fd7df(0x1d2))[_0x2fd7df(0x1ad)]();}catch(_0x4c5e94){throw new SDKError(ErrorCode[_0x2fd7df(0x19f)],_0x2fd7df(0x168)+_0x3bef2c,_0x4c5e94 instanceof Error?_0x4c5e94:undefined);}if(!_0x48e9ea)throw new SDKError(ErrorCode[_0x2fd7df(0x19f)],_0x2fd7df(0x156));const _0x2664bb={'database':_0x125ec8,'query':_0x48e9ea,'type':_0x5223a3};if(_0x39a4b7['cron'])_0x2664bb[_0x2fd7df(0x1ba)]=_0x39a4b7[_0x2fd7df(0x1ba)];if(_0x39a4b7[_0x2fd7df(0x1b1)])_0x2664bb[_0x2fd7df(0x1b1)]=_0x39a4b7[_0x2fd7df(0x1b1)];if(_0x39a4b7[_0x2fd7df(0x164)]!==undefined)_0x2664bb[_0x2fd7df(0x164)]=Number(_0x39a4b7['delay']);if(_0x39a4b7[_0x2fd7df(0x182)]!==undefined)_0x2664bb[_0x2fd7df(0x182)]=Number(_0x39a4b7[_0x2fd7df(0x182)]);if(_0x39a4b7[_0x2fd7df(0x1aa)]!==undefined)_0x2664bb['retry_limit']=Number(_0x39a4b7[_0x2fd7df(0x1aa)]);if(_0x39a4b7['engineVersion'])_0x2664bb[_0x2fd7df(0x1d4)]=_0x39a4b7[_0x2fd7df(0x192)];if(_0x39a4b7[_0x2fd7df(0x198)])_0x2664bb[_0x2fd7df(0x198)]=_0x39a4b7[_0x2fd7df(0x198)];if(_0x1b1e3d[_0x2fd7df(0x1bd)]){console[_0x2fd7df(0x1d3)](_0x2fd7df(0x16d)+_0x900a38),console[_0x2fd7df(0x1d3)](_0x2fd7df(0x16a)+_0x125ec8),console[_0x2fd7df(0x1d3)](_0x2fd7df(0x16b)+_0x5223a3);if(_0x2664bb['cron'])console[_0x2fd7df(0x1d3)]('\x20\x20Cron:\x20'+_0x2664bb[_0x2fd7df(0x1ba)]);if(_0x2664bb[_0x2fd7df(0x1b1)])console[_0x2fd7df(0x1d3)](_0x2fd7df(0x176)+_0x2664bb['timezone']);}const _0x12d370=await withSpinner(_0x2fd7df(0x15f),()=>_0x544be2[_0x2fd7df(0x16f)]['create'](_0x900a38,_0x2664bb),{'verbose':_0x1b1e3d[_0x2fd7df(0x1bd)]});return console['error']('Schedule\x20created:\x20'+_0x12d370['data']['name']),await handleSingleObjectOutput(_0x12d370[_0x2fd7df(0x169)],_0x1b1e3d),0x0;}}function a36_0xde65(){const _0xe72823=['6604497QmTDul','repeat','result','red','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','\x20\x20Num:\x20','options','tsv','Run\x20a\x20scheduled\x20query\x20immediately','INVALID_ARGUMENT','from','green','max','List\x20scheduled\x20queries','Deleting\x20schedule...','file','schedule:list','nextRun','description','queryUrl','retryLimit','lastRun','530492ERuYnH','trim','join','query','\x20\x20Job\x20ID:\x20','timezone','ies','length','run','success','📅\x20','Delete\x20a\x20scheduled\x20query','Show\x20schedule\x20details','/app/queries/editor?queryId=','cron','Running\x20schedule:\x20','next_run_at','verbose','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','10385655DDBNdz','dim','created_at','No\x20scheduled\x20queries\x20found','Listing\x20scheduled\x20queries...','d\x20ago','Showing\x20first\x20','listQueries','type','scheduled_at','h\x20ago','\x20execution','Show\x20schedule\x20execution\x20history','site','\x20schedules','Schedule\x20run\x20submitted:\x20','validate','ended_at','utf-8','error','engine_version','format','num','m\x20ago','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','918GHChpa','jobs','schedule:history','round','22779SKmmJS','3247160rSndsh','in\x20','name','delete','queries','time','statusIcon','Running\x20schedule...','just\x20now','substring','has_next_page','Query\x20file\x20is\x20empty','Searching\x20scheduled\x20queries\x20matching\x20\x22','padEnd','\x20scheduled\x20quer','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','cyan','args','soon','Getting\x20schedule\x20history...','Creating\x20schedule...','table','last_job','time_zone','\x20(showing\x20','delay','job_id','jsonl','Found\x20','Failed\x20to\x20read\x20file:\x20','data','\x20\x20Database:\x20','\x20\x20Type:\x20','5650xlKtku','Creating\x20schedule:\x20','history','schedules','list','...','toLocaleDateString','start_at','never','map','\x20\x20Timezone:\x20','pagination','Updating\x20schedule:\x20','Cancelled','\x20job','database','Getting\x20schedule\x20details...','execute','4300496kGwbRS','Updating\x20schedule...','output','Schedule\x20updated:\x20','priority','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','\x20matching\x20\x22','updated_at','Schedule\x20deleted:\x20','schedule:show','keys','update','getTime','trino','186zfVrZJ','\x20created','executing_user_id','status','\x20\x20Time:\x20','60gaSthp','engineVersion','\x20\x20→\x20','retry_limit','abs'];a36_0xde65=function(){return _0xe72823;};return a36_0xde65();}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x180c5e(0x1e0)]='schedule:update';[a36_0x180c5e(0x1a8)]='Update\x20a\x20scheduled\x20query';[a36_0x180c5e(0x1d0)](_0x50d9db){const _0x4db4d7=a36_0x180c5e,_0x16cdc3=_0x50d9db[_0x4db4d7(0x15c)][0x0];if(!_0x16cdc3)return _0x4db4d7(0x183);return undefined;}async['execute'](_0x32a97){const _0x5d8883=a36_0x180c5e,{options:_0x4d1cf9,args:_0x12c503,tdx:_0x4c4016}=_0x32a97,_0x1018f5=_0x12c503[0x0],_0x56e6c2=_0x4d1cf9,_0x2b64d8={};if(_0x56e6c2[_0x5d8883(0x17b)])_0x2b64d8['database']=_0x56e6c2[_0x5d8883(0x17b)];if(_0x56e6c2[_0x5d8883(0x1c8)])_0x2b64d8[_0x5d8883(0x1c8)]=_0x56e6c2['type'];if(_0x56e6c2[_0x5d8883(0x1ba)])_0x2b64d8['cron']=_0x56e6c2[_0x5d8883(0x1ba)];if(_0x56e6c2[_0x5d8883(0x1b1)])_0x2b64d8[_0x5d8883(0x1b1)]=_0x56e6c2[_0x5d8883(0x1b1)];if(_0x56e6c2[_0x5d8883(0x164)]!==undefined)_0x2b64d8[_0x5d8883(0x164)]=Number(_0x56e6c2[_0x5d8883(0x164)]);if(_0x56e6c2[_0x5d8883(0x182)]!==undefined)_0x2b64d8[_0x5d8883(0x182)]=Number(_0x56e6c2[_0x5d8883(0x182)]);if(_0x56e6c2[_0x5d8883(0x1aa)]!==undefined)_0x2b64d8[_0x5d8883(0x194)]=Number(_0x56e6c2['retryLimit']);if(_0x56e6c2[_0x5d8883(0x192)])_0x2b64d8[_0x5d8883(0x1d4)]=_0x56e6c2[_0x5d8883(0x192)];if(_0x56e6c2[_0x5d8883(0x198)])_0x2b64d8[_0x5d8883(0x198)]=_0x56e6c2[_0x5d8883(0x198)];if(_0x56e6c2[_0x5d8883(0x1a5)])try{_0x2b64d8['query']=readFileSync(_0x56e6c2[_0x5d8883(0x1a5)],_0x5d8883(0x1d2))[_0x5d8883(0x1ad)]();}catch(_0x160f0a){throw new SDKError(ErrorCode[_0x5d8883(0x19f)],_0x5d8883(0x168)+_0x56e6c2[_0x5d8883(0x1a5)],_0x160f0a instanceof Error?_0x160f0a:undefined);}if(Object[_0x5d8883(0x188)](_0x2b64d8)[_0x5d8883(0x1b3)]===0x0)throw new SDKError(ErrorCode[_0x5d8883(0x19f)],_0x5d8883(0x19a));if(_0x4d1cf9['verbose']){console[_0x5d8883(0x1d3)](_0x5d8883(0x178)+_0x1018f5);for(const [_0x57a422,_0x5ab4bf]of Object['entries'](_0x2b64d8)){_0x57a422===_0x5d8883(0x1af)?console['error']('\x20\x20'+_0x57a422+':\x20'+_0x5ab4bf[_0x5d8883(0x154)](0x0,0x32)+_0x5d8883(0x171)):console[_0x5d8883(0x1d3)]('\x20\x20'+_0x57a422+':\x20'+_0x5ab4bf);}}const _0x185fe3=await withSpinner(_0x5d8883(0x17f),()=>_0x4c4016['schedules'][_0x5d8883(0x189)](_0x1018f5,_0x2b64d8),{'verbose':_0x4d1cf9[_0x5d8883(0x1bd)]});return console[_0x5d8883(0x1d3)](_0x5d8883(0x181)+_0x185fe3[_0x5d8883(0x169)][_0x5d8883(0x1e0)]),await handleSingleObjectOutput(_0x185fe3[_0x5d8883(0x169)],_0x4d1cf9),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x180c5e(0x1e0)]='schedule:delete';[a36_0x180c5e(0x1a8)]=a36_0x180c5e(0x1b7);[a36_0x180c5e(0x1d0)](_0x55f38b){const _0x1da819=a36_0x180c5e,_0x3caf7f=_0x55f38b[_0x1da819(0x15c)][0x0];if(!_0x3caf7f)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async[a36_0x180c5e(0x17d)](_0x1f2ea5){const _0xbf01ed=a36_0x180c5e,{options:_0x5bea33,args:_0x4e60e7,tdx:_0x536d7e}=_0x1f2ea5,_0x44032c=_0x4e60e7[0x0];if(!_0x5bea33['yes']){const _0x361c0a=await confirm(_0xbf01ed(0x1bf)+_0x44032c+'\x22?');if(!_0x361c0a)return console[_0xbf01ed(0x1d3)](_0xbf01ed(0x179)),0x0;}const _0xf53e07=await withSpinner(_0xbf01ed(0x1a4),()=>_0x536d7e[_0xbf01ed(0x16f)][_0xbf01ed(0x1e1)](_0x44032c),{'verbose':_0x5bea33[_0xbf01ed(0x1bd)]});return console[_0xbf01ed(0x1d3)](_0xbf01ed(0x186)+_0xf53e07[_0xbf01ed(0x169)][_0xbf01ed(0x1e0)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{['name']='schedule:run';[a36_0x180c5e(0x1a8)]=a36_0x180c5e(0x19e);['validate'](_0x575629){const _0x58a289=a36_0x180c5e,_0x4a27fb=_0x575629[_0x58a289(0x15c)][0x0];if(!_0x4a27fb)return _0x58a289(0x1be);return undefined;}async[a36_0x180c5e(0x17d)](_0x4d9656){const _0x4919c3=a36_0x180c5e,{options:_0x98a6b8,args:_0x277a5b,tdx:_0x158b71}=_0x4d9656,_0x40c2f2=_0x277a5b[0x0],_0x283bc0=_0x98a6b8,_0x509c3e=_0x283bc0[_0x4919c3(0x150)],_0x11dc88=_0x283bc0[_0x4919c3(0x1d6)]!==undefined?Number(_0x283bc0[_0x4919c3(0x1d6)]):undefined;if(_0x98a6b8[_0x4919c3(0x1bd)]){console[_0x4919c3(0x1d3)](_0x4919c3(0x1bb)+_0x40c2f2);if(_0x509c3e)console[_0x4919c3(0x1d3)](_0x4919c3(0x190)+_0x509c3e);if(_0x11dc88)console[_0x4919c3(0x1d3)](_0x4919c3(0x19b)+_0x11dc88);}const _0x1758f6=await withSpinner(_0x4919c3(0x152),()=>_0x158b71[_0x4919c3(0x16f)][_0x4919c3(0x1b4)](_0x40c2f2,{'time':_0x509c3e,'num':_0x11dc88}),{'verbose':_0x98a6b8[_0x4919c3(0x1bd)]}),_0xe1979a=_0x1758f6[_0x4919c3(0x169)][_0x4919c3(0x1da)];console['error'](_0x4919c3(0x1cf)+_0xe1979a[_0x4919c3(0x1b3)]+_0x4919c3(0x17a)+(_0xe1979a[_0x4919c3(0x1b3)]!==0x1?'s':'')+_0x4919c3(0x18d));for(const _0xb86a02 of _0xe1979a){console[_0x4919c3(0x1d3)](_0x4919c3(0x1b0)+_0xb86a02[_0x4919c3(0x165)]);}return await handleSDKOutput(_0xe1979a,_0x98a6b8),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{['name']=a36_0x180c5e(0x1db);[a36_0x180c5e(0x1a8)]=a36_0x180c5e(0x1cc);[a36_0x180c5e(0x1d0)](_0x16b06c){const _0x405476=a36_0x180c5e,_0x461105=_0x16b06c['args'][0x0];if(!_0x461105)return _0x405476(0x1d8);return undefined;}async[a36_0x180c5e(0x17d)](_0x24c369){const _0x438762=a36_0x180c5e,{options:_0x492d68,args:_0x156308,tdx:_0x4c6215}=_0x24c369,_0x2ba2b1=_0x156308[0x0],_0x3acabb=_0x492d68,_0x5696a9=_0x3acabb['from']!==undefined?Number(_0x3acabb[_0x438762(0x1a0)]):undefined,_0x4c46b2=_0x3acabb['to']!==undefined?Number(_0x3acabb['to']):undefined,_0x37992e=await withSpinner(_0x438762(0x15e),()=>_0x4c6215[_0x438762(0x16f)][_0x438762(0x16e)](_0x2ba2b1,{'from':_0x5696a9,'to':_0x4c46b2}),{'verbose':_0x492d68[_0x438762(0x1bd)]}),_0x6a32df=_0x37992e['data'];console[_0x438762(0x1d3)]('Found\x20'+_0x6a32df['count']+_0x438762(0x1cb)+(_0x6a32df['count']!==0x1?'s':'')+_0x438762(0x163)+_0x6a32df[_0x438762(0x1a0)]+'-'+_0x6a32df['to']+')');const _0x3d988c=_0x6a32df[_0x438762(0x16e)][_0x438762(0x175)](_0x359e8d=>({'job_id':_0x359e8d[_0x438762(0x165)],'type':_0x359e8d[_0x438762(0x1c8)],'status':_0x359e8d[_0x438762(0x18f)],'scheduled_at':_0x359e8d[_0x438762(0x1c9)],'created_at':_0x359e8d[_0x438762(0x1c2)],'start_at':_0x359e8d[_0x438762(0x173)],'end_at':_0x359e8d['end_at']}));return await handleSDKOutput(_0x3d988c,_0x492d68),0x0;}}
1
+ const a36_0x106265=a36_0x3a6a;(function(_0x30b661,_0x32ffc9){const _0x231eef=a36_0x3a6a,_0x2f9da2=_0x30b661();while(!![]){try{const _0x1f2c84=-parseInt(_0x231eef(0x199))/0x1*(-parseInt(_0x231eef(0x1b0))/0x2)+parseInt(_0x231eef(0x187))/0x3+parseInt(_0x231eef(0x1f9))/0x4+parseInt(_0x231eef(0x193))/0x5*(-parseInt(_0x231eef(0x19c))/0x6)+-parseInt(_0x231eef(0x196))/0x7*(parseInt(_0x231eef(0x1fe))/0x8)+-parseInt(_0x231eef(0x1dd))/0x9+parseInt(_0x231eef(0x1c9))/0xa;if(_0x1f2c84===_0x32ffc9)break;else _0x2f9da2['push'](_0x2f9da2['shift']());}catch(_0x3e7554){_0x2f9da2['push'](_0x2f9da2['shift']());}}}(a36_0x333f,0x91b16));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';function a36_0x3a6a(_0x4079ad,_0x4abc72){_0x4079ad=_0x4079ad-0x17d;const _0x333feb=a36_0x333f();let _0x3a6a98=_0x333feb[_0x4079ad];return _0x3a6a98;}import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a36_0x1652ea from'chalk';function formatRelativeTime(_0x4d4dcb){const _0x3d87d2=a36_0x3a6a,_0x36ff01=new Date(_0x4d4dcb),_0x5aa186=new Date(),_0x50d872=_0x36ff01[_0x3d87d2(0x1b1)]()-_0x5aa186[_0x3d87d2(0x1b1)](),_0x49c181=Math[_0x3d87d2(0x1ff)](_0x50d872)/0x3e8,_0x2c7f7d=_0x50d872<0x0;if(_0x49c181<0x3c)return _0x2c7f7d?_0x3d87d2(0x1d4):_0x3d87d2(0x1b3);else{if(_0x49c181<0xe10){const _0xce5754=Math['round'](_0x49c181/0x3c);return _0x2c7f7d?_0xce5754+'m\x20ago':'in\x20'+_0xce5754+'m';}else{if(_0x49c181<0x15180){const _0x451c98=Math[_0x3d87d2(0x1a3)](_0x49c181/0xe10);return _0x2c7f7d?_0x451c98+'h\x20ago':_0x3d87d2(0x1b6)+_0x451c98+'h';}else{if(_0x49c181<0x93a80){const _0x1d0dad=Math[_0x3d87d2(0x1a3)](_0x49c181/0x15180);return _0x2c7f7d?_0x1d0dad+_0x3d87d2(0x1d9):_0x3d87d2(0x1b6)+_0x1d0dad+'d';}else return _0x36ff01[_0x3d87d2(0x1d7)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x106265(0x1a8)]=a36_0x106265(0x1af);[a36_0x106265(0x1ae)]=a36_0x106265(0x1f2);async['execute'](_0x19bdfa){const _0x319ddb=a36_0x106265,{options:_0x31bddf,args:_0x54bd2d,tdx:_0x119494}=_0x19bdfa,_0x4259a5=resolveLimit(_0x31bddf[_0x319ddb(0x1da)],DEFAULT_DISPLAY_LIMIT),_0x5cdaa8=_0x54bd2d[0x0],_0x937875=_0x5cdaa8?'Searching\x20scheduled\x20queries\x20matching\x20\x22'+_0x5cdaa8+_0x319ddb(0x1bb):_0x319ddb(0x1e2),_0x215459=await withSpinner(_0x937875,()=>_0x119494[_0x319ddb(0x1c0)][_0x319ddb(0x1bc)]({'limit':_0x4259a5,'scheduled':!![],'pattern':_0x5cdaa8}),{'verbose':_0x31bddf[_0x319ddb(0x1b4)]}),_0xfc7870=_0x215459[_0x319ddb(0x1be)][_0x319ddb(0x1a0)],_0x5b3262=_0x215459['data'][_0x319ddb(0x208)]['has_next_page'],_0x47bbcf=_0x5cdaa8?'\x20matching\x20\x22'+_0x5cdaa8+'\x22':'';_0x5b3262?console[_0x319ddb(0x1f8)](_0x319ddb(0x1c2)+_0xfc7870[_0x319ddb(0x1e6)]+_0x319ddb(0x1b9)+_0x47bbcf+_0x319ddb(0x1fb)):console[_0x319ddb(0x1f8)](_0x319ddb(0x1dc)+_0xfc7870[_0x319ddb(0x1e6)]+_0x319ddb(0x1a9)+(_0xfc7870[_0x319ddb(0x1e6)]!==0x1?_0x319ddb(0x17e):'y')+_0x47bbcf);if(_0x31bddf[_0x319ddb(0x1b5)]===_0x319ddb(0x1ef)||_0x31bddf[_0x319ddb(0x1b5)]===_0x319ddb(0x19e)||_0x31bddf[_0x319ddb(0x1b5)]===_0x319ddb(0x186)||_0x31bddf[_0x319ddb(0x1b5)]==='tsv'){const _0x25f49d=_0xfc7870[_0x319ddb(0x201)](_0x54945c=>({'id':_0x54945c['id'],'name':_0x54945c['name'],'cron':_0x54945c[_0x319ddb(0x205)],'database':_0x54945c['database']?.[_0x319ddb(0x1a8)],'type':_0x54945c[_0x319ddb(0x1ee)],'timezone':_0x54945c['time_zone'],'user_name':_0x54945c[_0x319ddb(0x1cf)]?.[_0x319ddb(0x1a8)],'updated_at':_0x54945c[_0x319ddb(0x1fd)],'next_run_at':_0x54945c[_0x319ddb(0x1e5)],'last_job_status':_0x54945c[_0x319ddb(0x1c3)]?.['status']}));await handleSDKOutput(_0x25f49d,_0x31bddf);}else{if(_0xfc7870[_0x319ddb(0x1e6)]===0x0)console['log'](_0x319ddb(0x19d));else{const _0x4d6b8a=_0x31bddf[_0x319ddb(0x18c)],_0x4c9ea8=_0xfc7870[_0x319ddb(0x201)](_0x2a79a0=>{const _0x2d3703=_0x319ddb,_0x51cf64=_0x2a79a0[_0x2d3703(0x1c3)]?.[_0x2d3703(0x1b2)]?_0x2a79a0['last_job'][_0x2d3703(0x1b2)]===_0x2d3703(0x1e4)?'✓':'✗':'-',_0x203785=_0x2a79a0['last_job']?.['ended_at']?formatRelativeTime(_0x2a79a0['last_job'][_0x2d3703(0x1fa)]):_0x2d3703(0x1eb),_0x49c077=_0x2a79a0[_0x2d3703(0x1e5)]?formatRelativeTime(_0x2a79a0[_0x2d3703(0x1e5)]):'-',_0x26ea06=_0x2a79a0[_0x2d3703(0x205)]||'',_0xc3300c=_0x2a79a0[_0x2d3703(0x1a8)]||_0x2d3703(0x1f4),_0x1bbdda=getConsoleUrl(_0x4d6b8a,_0x2d3703(0x182)+_0x2a79a0['id']);return{'statusIcon':_0x51cf64,'lastRun':_0x203785,'nextRun':_0x49c077,'cron':_0x26ea06,'name':_0xc3300c,'queryUrl':_0x1bbdda,'status':_0x2a79a0[_0x2d3703(0x1c3)]?.[_0x2d3703(0x1b2)]};}),_0x14e5ef=Math[_0x319ddb(0x1ce)](..._0x4c9ea8[_0x319ddb(0x201)](_0x50c6ee=>_0x50c6ee[_0x319ddb(0x18f)][_0x319ddb(0x1e6)])),_0x2f3415=Math[_0x319ddb(0x1ce)](..._0x4c9ea8['map'](_0x3a6afa=>_0x3a6afa[_0x319ddb(0x1c1)][_0x319ddb(0x1e6)])),_0x5165ae=Math[_0x319ddb(0x1ce)](..._0x4c9ea8[_0x319ddb(0x201)](_0x2b727a=>_0x2b727a[_0x319ddb(0x205)][_0x319ddb(0x1e6)])),_0x433c18=_0x4c9ea8[_0x319ddb(0x201)](_0x3049f1=>{const _0x392278=_0x319ddb,_0x480fc3=_0x3049f1[_0x392278(0x1b2)]===_0x392278(0x1e4)?a36_0x1652ea[_0x392278(0x209)](_0x3049f1['statusIcon']):_0x3049f1[_0x392278(0x1b2)]==='error'?a36_0x1652ea[_0x392278(0x1b8)](_0x3049f1[_0x392278(0x1c8)]):a36_0x1652ea[_0x392278(0x19b)](_0x3049f1[_0x392278(0x1c8)]),_0x1983fb=_0x3049f1[_0x392278(0x18f)]['padEnd'](_0x14e5ef),_0x496186=_0x3049f1[_0x392278(0x1c1)][_0x392278(0x1e0)](_0x2f3415),_0xb39eb8=_0x3049f1['cron']?a36_0x1652ea['cyan'](_0x3049f1[_0x392278(0x205)][_0x392278(0x1e0)](_0x5165ae)):'\x20'[_0x392278(0x1d0)](_0x5165ae),_0x4859f7=hyperlink(_0x3049f1[_0x392278(0x1a8)],_0x3049f1[_0x392278(0x1f5)]);return _0x392278(0x1f3)+_0x480fc3+'\x20'+_0x1983fb+'\x20\x20→\x20'+_0x496186+'\x20\x20'+_0xb39eb8+'\x20\x20'+_0x4859f7;});await writeOutput(_0x433c18[_0x319ddb(0x195)]('\x0a'),_0x31bddf[_0x319ddb(0x1bf)],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{['name']=a36_0x106265(0x18a);['description']=a36_0x106265(0x1e1);[a36_0x106265(0x19a)](_0x19004b){const _0x427e3e=_0x19004b['args'][0x0];if(!_0x427e3e)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async[a36_0x106265(0x1c6)](_0x2084e3){const _0x1d62d1=a36_0x106265,{options:_0x3f5da4,args:_0x2baef4,tdx:_0x5ac897}=_0x2084e3,_0x78777=_0x2baef4[0x0],_0x4df72a=await withSpinner(_0x1d62d1(0x1ba),()=>_0x5ac897['schedules'][_0x1d62d1(0x17d)](_0x78777),{'verbose':_0x3f5da4[_0x1d62d1(0x1b4)]}),_0x135b4c=_0x4df72a[_0x1d62d1(0x1be)],_0x3df103={'name':_0x135b4c[_0x1d62d1(0x1a8)],'cron':_0x135b4c['cron'],'database':_0x135b4c[_0x1d62d1(0x1d6)],'type':_0x135b4c[_0x1d62d1(0x1ee)],'timezone':_0x135b4c[_0x1d62d1(0x1cc)],'user_name':_0x135b4c[_0x1d62d1(0x1d3)],'created_at':_0x135b4c[_0x1d62d1(0x1bd)],'engine_version':_0x135b4c[_0x1d62d1(0x1b7)],'executing_user_id':_0x135b4c[_0x1d62d1(0x192)],'query':_0x135b4c[_0x1d62d1(0x1df)],'delay':_0x135b4c[_0x1d62d1(0x1ab)],'priority':_0x135b4c[_0x1d62d1(0x1ca)],'retry_limit':_0x135b4c[_0x1d62d1(0x185)],..._0x135b4c['result']&&{'result':_0x135b4c[_0x1d62d1(0x20c)]}};return await handleSingleObjectOutput(_0x3df103,_0x3f5da4),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']='schedule:create';['description']=a36_0x106265(0x181);['validate'](_0x56b1b5){const _0x328987=a36_0x106265,_0x3f9c77=_0x56b1b5[_0x328987(0x207)][0x0];if(!_0x3f9c77)return _0x328987(0x1e9);const _0x511072=_0x56b1b5[_0x328987(0x1a5)];if(!_0x511072[_0x328987(0x1d6)])return _0x328987(0x191);return undefined;}async[a36_0x106265(0x1c6)](_0x42c2be){const _0x5841a9=a36_0x106265,{options:_0x1bea09,args:_0x35d19,tdx:_0x2c009d}=_0x42c2be,_0x6576f0=_0x35d19[0x0],_0x2f95e2=_0x1bea09,_0x4416db=_0x2f95e2[_0x5841a9(0x1d6)],_0x2e0450=_0x2f95e2['file'],_0x52819c=_0x2f95e2[_0x5841a9(0x1ee)]||_0x5841a9(0x180);let _0x4a4a5b;try{_0x4a4a5b=readFileSync(_0x2e0450,_0x5841a9(0x1d1))[_0x5841a9(0x1e8)]();}catch(_0x4a2469){throw new SDKError(ErrorCode[_0x5841a9(0x19f)],'Failed\x20to\x20read\x20file:\x20'+_0x2e0450,_0x4a2469 instanceof Error?_0x4a2469:undefined);}if(!_0x4a4a5b)throw new SDKError(ErrorCode[_0x5841a9(0x19f)],_0x5841a9(0x1f7));const _0x4e34a0={'database':_0x4416db,'query':_0x4a4a5b,'type':_0x52819c};if(_0x2f95e2[_0x5841a9(0x205)])_0x4e34a0[_0x5841a9(0x205)]=_0x2f95e2[_0x5841a9(0x205)];if(_0x2f95e2['timezone'])_0x4e34a0[_0x5841a9(0x1cc)]=_0x2f95e2[_0x5841a9(0x1cc)];if(_0x2f95e2[_0x5841a9(0x1ab)]!==undefined)_0x4e34a0[_0x5841a9(0x1ab)]=Number(_0x2f95e2[_0x5841a9(0x1ab)]);if(_0x2f95e2[_0x5841a9(0x1ca)]!==undefined)_0x4e34a0['priority']=Number(_0x2f95e2['priority']);if(_0x2f95e2[_0x5841a9(0x183)]!==undefined)_0x4e34a0[_0x5841a9(0x185)]=Number(_0x2f95e2[_0x5841a9(0x183)]);if(_0x2f95e2['engineVersion'])_0x4e34a0['engine_version']=_0x2f95e2[_0x5841a9(0x1cd)];if(_0x2f95e2['result'])_0x4e34a0[_0x5841a9(0x20c)]=_0x2f95e2[_0x5841a9(0x20c)];if(_0x1bea09[_0x5841a9(0x1b4)]){console[_0x5841a9(0x1f8)]('Creating\x20schedule:\x20'+_0x6576f0),console[_0x5841a9(0x1f8)](_0x5841a9(0x1cb)+_0x4416db),console[_0x5841a9(0x1f8)](_0x5841a9(0x204)+_0x52819c);if(_0x4e34a0['cron'])console[_0x5841a9(0x1f8)](_0x5841a9(0x1a1)+_0x4e34a0[_0x5841a9(0x205)]);if(_0x4e34a0[_0x5841a9(0x1cc)])console[_0x5841a9(0x1f8)](_0x5841a9(0x1c7)+_0x4e34a0['timezone']);}const _0xc761a8=await withSpinner('Creating\x20schedule...',()=>_0x2c009d['schedules'][_0x5841a9(0x1fc)](_0x6576f0,_0x4e34a0),{'verbose':_0x1bea09[_0x5841a9(0x1b4)]});return console[_0x5841a9(0x1f8)](_0x5841a9(0x1ad)+_0xc761a8[_0x5841a9(0x1be)][_0x5841a9(0x1a8)]),await handleSingleObjectOutput(_0xc761a8[_0x5841a9(0x1be)],_0x1bea09),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x106265(0x1a8)]=a36_0x106265(0x1ed);[a36_0x106265(0x1ae)]=a36_0x106265(0x198);[a36_0x106265(0x19a)](_0x4ac4c5){const _0x5c259f=a36_0x106265,_0x48b93b=_0x4ac4c5['args'][0x0];if(!_0x48b93b)return _0x5c259f(0x1db);return undefined;}async[a36_0x106265(0x1c6)](_0x30b144){const _0x28b3a7=a36_0x106265,{options:_0x1c65b0,args:_0x16b714,tdx:_0x119f7c}=_0x30b144,_0x438225=_0x16b714[0x0],_0x44631f=_0x1c65b0,_0x21f7f5={};if(_0x44631f[_0x28b3a7(0x1d6)])_0x21f7f5[_0x28b3a7(0x1d6)]=_0x44631f[_0x28b3a7(0x1d6)];if(_0x44631f[_0x28b3a7(0x1ee)])_0x21f7f5[_0x28b3a7(0x1ee)]=_0x44631f[_0x28b3a7(0x1ee)];if(_0x44631f[_0x28b3a7(0x205)])_0x21f7f5[_0x28b3a7(0x205)]=_0x44631f[_0x28b3a7(0x205)];if(_0x44631f[_0x28b3a7(0x1cc)])_0x21f7f5['timezone']=_0x44631f[_0x28b3a7(0x1cc)];if(_0x44631f[_0x28b3a7(0x1ab)]!==undefined)_0x21f7f5[_0x28b3a7(0x1ab)]=Number(_0x44631f[_0x28b3a7(0x1ab)]);if(_0x44631f[_0x28b3a7(0x1ca)]!==undefined)_0x21f7f5['priority']=Number(_0x44631f[_0x28b3a7(0x1ca)]);if(_0x44631f['retryLimit']!==undefined)_0x21f7f5[_0x28b3a7(0x185)]=Number(_0x44631f['retryLimit']);if(_0x44631f['engineVersion'])_0x21f7f5[_0x28b3a7(0x1b7)]=_0x44631f[_0x28b3a7(0x1cd)];if(_0x44631f['result'])_0x21f7f5[_0x28b3a7(0x20c)]=_0x44631f[_0x28b3a7(0x20c)];if(_0x44631f[_0x28b3a7(0x188)])try{_0x21f7f5[_0x28b3a7(0x1df)]=readFileSync(_0x44631f[_0x28b3a7(0x188)],'utf-8')[_0x28b3a7(0x1e8)]();}catch(_0x439997){throw new SDKError(ErrorCode[_0x28b3a7(0x19f)],'Failed\x20to\x20read\x20file:\x20'+_0x44631f[_0x28b3a7(0x188)],_0x439997 instanceof Error?_0x439997:undefined);}if(Object['keys'](_0x21f7f5)[_0x28b3a7(0x1e6)]===0x0)throw new SDKError(ErrorCode[_0x28b3a7(0x19f)],_0x28b3a7(0x1ea));if(_0x1c65b0[_0x28b3a7(0x1b4)]){console[_0x28b3a7(0x1f8)](_0x28b3a7(0x1de)+_0x438225);for(const [_0x2a3fc6,_0x5ac9d5]of Object[_0x28b3a7(0x1f6)](_0x21f7f5)){_0x2a3fc6==='query'?console[_0x28b3a7(0x1f8)]('\x20\x20'+_0x2a3fc6+':\x20'+_0x5ac9d5[_0x28b3a7(0x1d8)](0x0,0x32)+_0x28b3a7(0x189)):console['error']('\x20\x20'+_0x2a3fc6+':\x20'+_0x5ac9d5);}}const _0x2759c8=await withSpinner(_0x28b3a7(0x197),()=>_0x119f7c[_0x28b3a7(0x1c0)][_0x28b3a7(0x20b)](_0x438225,_0x21f7f5),{'verbose':_0x1c65b0[_0x28b3a7(0x1b4)]});return console[_0x28b3a7(0x1f8)]('Schedule\x20updated:\x20'+_0x2759c8['data'][_0x28b3a7(0x1a8)]),await handleSingleObjectOutput(_0x2759c8[_0x28b3a7(0x1be)],_0x1c65b0),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{['name']='schedule:delete';[a36_0x106265(0x1ae)]=a36_0x106265(0x184);[a36_0x106265(0x19a)](_0x2f1765){const _0x3fd6a4=a36_0x106265,_0x35ec4a=_0x2f1765[_0x3fd6a4(0x207)][0x0];if(!_0x35ec4a)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async['execute'](_0x19688e){const _0x3d1e5e=a36_0x106265,{options:_0x1d2eb4,args:_0x1ad47c,tdx:_0x41c54d}=_0x19688e,_0x3ae335=_0x1ad47c[0x0];if(!_0x1d2eb4[_0x3d1e5e(0x1c4)]){const _0x18b371=await confirm(_0x3d1e5e(0x1f0)+_0x3ae335+'\x22?');if(!_0x18b371)return console['error'](_0x3d1e5e(0x1d5)),0x0;}const _0x5bb167=await withSpinner(_0x3d1e5e(0x1ec),()=>_0x41c54d[_0x3d1e5e(0x1c0)][_0x3d1e5e(0x1d2)](_0x3ae335),{'verbose':_0x1d2eb4[_0x3d1e5e(0x1b4)]});return console['error']('Schedule\x20deleted:\x20'+_0x5bb167[_0x3d1e5e(0x1be)][_0x3d1e5e(0x1a8)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x106265(0x1a8)]=a36_0x106265(0x1ac);['description']=a36_0x106265(0x200);[a36_0x106265(0x19a)](_0xa9afcb){const _0x9dd1be=a36_0x106265,_0xacc39c=_0xa9afcb[_0x9dd1be(0x207)][0x0];if(!_0xacc39c)return _0x9dd1be(0x1a6);return undefined;}async[a36_0x106265(0x1c6)](_0x5732b6){const _0x3a02d4=a36_0x106265,{options:_0x50a06b,args:_0x45f51b,tdx:_0x575296}=_0x5732b6,_0x21b551=_0x45f51b[0x0],_0x4b84ca=_0x50a06b,_0xaab950=_0x4b84ca['time'],_0x54b61f=_0x4b84ca[_0x3a02d4(0x1a4)]!==undefined?Number(_0x4b84ca['num']):undefined;if(_0x50a06b['verbose']){console[_0x3a02d4(0x1f8)](_0x3a02d4(0x20a)+_0x21b551);if(_0xaab950)console[_0x3a02d4(0x1f8)](_0x3a02d4(0x1e7)+_0xaab950);if(_0x54b61f)console[_0x3a02d4(0x1f8)]('\x20\x20Num:\x20'+_0x54b61f);}const _0x5634df=await withSpinner(_0x3a02d4(0x18d),()=>_0x575296[_0x3a02d4(0x1c0)][_0x3a02d4(0x1e3)](_0x21b551,{'time':_0xaab950,'num':_0x54b61f}),{'verbose':_0x50a06b[_0x3a02d4(0x1b4)]}),_0x4ab85a=_0x5634df[_0x3a02d4(0x1be)][_0x3a02d4(0x17f)];console[_0x3a02d4(0x1f8)](_0x3a02d4(0x18b)+_0x4ab85a[_0x3a02d4(0x1e6)]+_0x3a02d4(0x18e)+(_0x4ab85a[_0x3a02d4(0x1e6)]!==0x1?'s':'')+'\x20created');for(const _0x42f603 of _0x4ab85a){console[_0x3a02d4(0x1f8)](_0x3a02d4(0x206)+_0x42f603[_0x3a02d4(0x1f1)]);}return await handleSDKOutput(_0x4ab85a,_0x50a06b),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{['name']=a36_0x106265(0x1c5);['description']='Show\x20schedule\x20execution\x20history';[a36_0x106265(0x19a)](_0x20e2a7){const _0x1cfc51=a36_0x106265,_0x3c437b=_0x20e2a7[_0x1cfc51(0x207)][0x0];if(!_0x3c437b)return _0x1cfc51(0x1a2);return undefined;}async[a36_0x106265(0x1c6)](_0x5bb2d5){const _0x388320=a36_0x106265,{options:_0x5cb0d5,args:_0x17dab6,tdx:_0x2d0a37}=_0x5bb2d5,_0x534aed=_0x17dab6[0x0],_0x26ba8f=_0x5cb0d5,_0x56d192=_0x26ba8f[_0x388320(0x202)]!==undefined?Number(_0x26ba8f[_0x388320(0x202)]):undefined,_0x3e218b=_0x26ba8f['to']!==undefined?Number(_0x26ba8f['to']):undefined,_0x341edd=await withSpinner('Getting\x20schedule\x20history...',()=>_0x2d0a37[_0x388320(0x1c0)][_0x388320(0x1aa)](_0x534aed,{'from':_0x56d192,'to':_0x3e218b}),{'verbose':_0x5cb0d5[_0x388320(0x1b4)]}),_0x174847=_0x341edd[_0x388320(0x1be)];console[_0x388320(0x1f8)]('Found\x20'+_0x174847[_0x388320(0x194)]+_0x388320(0x1a7)+(_0x174847[_0x388320(0x194)]!==0x1?'s':'')+_0x388320(0x203)+_0x174847[_0x388320(0x202)]+'-'+_0x174847['to']+')');const _0x4a4459=_0x174847[_0x388320(0x1aa)][_0x388320(0x201)](_0x411b6b=>({'job_id':_0x411b6b[_0x388320(0x1f1)],'type':_0x411b6b[_0x388320(0x1ee)],'status':_0x411b6b['status'],'scheduled_at':_0x411b6b['scheduled_at'],'created_at':_0x411b6b[_0x388320(0x1bd)],'start_at':_0x411b6b['start_at'],'end_at':_0x411b6b[_0x388320(0x190)]}));return await handleSDKOutput(_0x4a4459,_0x5cb0d5),0x0;}}function a36_0x333f(){const _0x30d7e0=['history','delay','schedule:run','Schedule\x20created:\x20','description','schedule:list','6QwGkGQ','getTime','status','soon','verbose','format','in\x20','engine_version','red','\x20schedules','Getting\x20schedule\x20details...','\x22...','listQueries','created_at','data','output','schedules','nextRun','Showing\x20first\x20','last_job','yes','schedule:history','execute','\x20\x20Timezone:\x20','statusIcon','9715030iLZZsP','priority','\x20\x20Database:\x20','timezone','engineVersion','max','user','repeat','utf-8','delete','user_name','just\x20now','Cancelled','database','toLocaleDateString','substring','d\x20ago','limit','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','Found\x20','4346703OWkqio','Updating\x20schedule:\x20','query','padEnd','Show\x20schedule\x20details','Listing\x20scheduled\x20queries...','run','success','next_run_at','length','\x20\x20Time:\x20','trim','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','never','Deleting\x20schedule...','schedule:update','type','json','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','job_id','List\x20scheduled\x20queries','📅\x20','(unnamed)','queryUrl','entries','Query\x20file\x20is\x20empty','error','4272408bPepMz','ended_at','\x20(use\x20--limit\x20to\x20see\x20more)','create','updated_at','15544tiwwzA','abs','Run\x20a\x20scheduled\x20query\x20immediately','map','from','\x20(showing\x20','\x20\x20Type:\x20','cron','\x20\x20Job\x20ID:\x20','args','pagination','green','Running\x20schedule:\x20','update','result','show','ies','jobs','trino','Create\x20a\x20scheduled\x20query','/app/queries/editor?queryId=','retryLimit','Delete\x20a\x20scheduled\x20query','retry_limit','table','694593rYdBGW','file','...','schedule:show','Schedule\x20run\x20submitted:\x20','site','Running\x20schedule...','\x20job','lastRun','end_at','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','executing_user_id','10075EpOJXz','count','join','1841NVFtnb','Updating\x20schedule...','Update\x20a\x20scheduled\x20query','156721XFaWXs','validate','dim','3426CfoBUa','No\x20scheduled\x20queries\x20found','jsonl','INVALID_ARGUMENT','queries','\x20\x20Cron:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','round','num','options','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','\x20execution','name','\x20scheduled\x20quer'];a36_0x333f=function(){return _0x30d7e0;};return a36_0x333f();}
@@ -1 +1 @@
1
- const a37_0xf60fab=a37_0x436c;(function(_0x5c186c,_0x581d59){const _0x468a04=a37_0x436c,_0x3081b7=_0x5c186c();while(!![]){try{const _0x4e1879=-parseInt(_0x468a04(0x141))/0x1+parseInt(_0x468a04(0x181))/0x2+-parseInt(_0x468a04(0x1ab))/0x3+-parseInt(_0x468a04(0x169))/0x4+parseInt(_0x468a04(0x156))/0x5*(parseInt(_0x468a04(0x1b5))/0x6)+-parseInt(_0x468a04(0x1a8))/0x7+-parseInt(_0x468a04(0x1bc))/0x8*(-parseInt(_0x468a04(0x161))/0x9);if(_0x4e1879===_0x581d59)break;else _0x3081b7['push'](_0x3081b7['shift']());}catch(_0x2097bd){_0x3081b7['push'](_0x3081b7['shift']());}}}(a37_0x3fc6,0x379b7));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';function a37_0x436c(_0x3280c1,_0x481705){_0x3280c1=_0x3280c1-0x126;const _0x3fc69d=a37_0x3fc6();let _0x436c0f=_0x3fc69d[_0x3280c1];return _0x436c0f;}function a37_0x3fc6(){const _0x486022=['getSegment','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Parent\x20segment:\x20','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','SELECT\x20*\x20FROM\x20(\x0a','Resolved\x20folder\x20ID:\x20','Listing\x20folders\x20for\x20parent\x20\x27','\x27...','segmentId','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Segment\x20ID:\x20','segment:view','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','\x20rows\x20','parentId','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Site:\x20','code','stats','Error:\x20','Resolved\x20type:\x20','verbose','getFolder','Target\x20path:\x20','Fetching\x20folder\x20\x27','site','Fetching\x20SQL\x20for\x20segment...','Usage:','143907wSyIEX','Resolved\x20parent\x20ID:\x20','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','json','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','data','Error:\x20Parent\x20segment\x20name\x20is\x20required','information_schema','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','parentSegment','Resolved\x20relative\x20path\x20to:\x20','name','limit','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','/app/ps/','\x27\x20with\x20ID:\x20','✔\x20Created\x20folder\x20\x27','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','5seprwB','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Resolving\x20parent\x20folder\x20\x27','green','getSQLFromYamlFile','setJobId','getSegmentSQLFromYaml','segment:folder:show','segment','fullPath','Use:\x20tdx\x20ps\x20show','4392234dqvgKM','folderId','Usage:\x20tdx\x20sg\x20desc\x20<name>','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','(root)','query','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','\x20\x20Cause:\x20','298920pkySEQ','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','Parent\x20ID:\x20','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','execute','log','✖\x20Query\x20failed\x20[','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','parent','/e/','jobId','test','Show\x20child\x20segment\x20schema\x20(column\x20types)','✔\x20Query\x20completed:\x20Processed\x20','Fetching\x20segment\x20details...','Show\x20segment\x20folder\x20details','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Use:\x20tdx\x20ps\x20view\x20-w','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','length','resolvePathToResource','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Show\x20folder\x20or\x20child\x20segment\x20details','372244KoJhdM','segmentName','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','content','url','Folder\x20ID\x20missing\x20from\x20resolved\x20path','in\x20','toLocaleString','listFolders','type','Create\x20segment\x20folder\x20for\x20organization','elapsedTimeMillis','Use:\x20tdx\x20ps\x20view','parentFolder','segment:desc','Usage:\x20tdx\x20segment\x20describe\x20<path>','\x20[Job\x20ID:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','red','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Get\x20SQL\x20query\x20for\x20child\x20segment','segment:describe','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Parent\x20name:\x20','INVALID_ARGUMENT','Fetching\x20parent\x20segment\x20details...','getParent','Resolving\x20parent\x20segment\x20\x27','Fetching\x20SQL\x20from\x20rule...','createFolder','cause','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','SEGMENT_NOT_FOUND','jsonl','resolveFolderId','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','error','message','segment:folder:create','2418325GHnkHU','\x20\x20Folder\x20path:\x20','Folder\x20ID:\x20','442062hEgYGv','Use:\x20tdx\x20ps\x20desc','Examples:','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Fetching\x20folder\x20details...','segment:sql','Executing\x20segment\x20query...','Resolving\x20\x27','resolveParentId','format','1590510IVjvAQ','path','\x20\x20Parent\x20segment:\x20','replace','Error:\x20Folder\x20reference\x20is\x20required','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Creating\x20folder\x20\x27','8JRQtIX','Resolved\x20YAML\x20file:\x20','folderPath','includes','\x20Opening\x20','\x20\x20Full\x20path:\x20','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','folder','SEGMENT_FOLDER_NOT_FOUND','getSegmentSQL','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','\x20\x20Segment\x20name:\x20','description','Folder\x20name:\x20'];a37_0x3fc6=function(){return _0x486022;};return a37_0x3fc6();}import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0x455980 from'chalk';async function resolveSegmentTarget(_0x3f09de,_0x3f4d4e,_0x1de1c1){const _0x2950e5=a37_0x436c;if(isYamlFilePath(_0x3f09de))try{const _0x5ca85b=await resolveYamlFilePath(_0x3f09de);return _0x1de1c1&&(console[_0x2950e5(0x1a5)](_0x2950e5(0x1bd)+_0x3f09de),console[_0x2950e5(0x1a5)](_0x2950e5(0x1b7)+_0x5ca85b[_0x2950e5(0x14d)]),console[_0x2950e5(0x1a5)](_0x2950e5(0x1c7)+_0x5ca85b['segmentName']),console[_0x2950e5(0x1a5)](_0x2950e5(0x1a9)+(_0x5ca85b[_0x2950e5(0x1be)]||_0x2950e5(0x165))),console[_0x2950e5(0x1a5)](_0x2950e5(0x1c1)+_0x5ca85b[_0x2950e5(0x15f)])),_0x5ca85b[_0x2950e5(0x15f)];}catch(_0x54b38e){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2950e5(0x16c)+_0x54b38e['message']);}if(!_0x3f4d4e)throw new SDKError(ErrorCode[_0x2950e5(0x199)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x3f4d4e+'/'+_0x3f09de;}export class SegmentDescribeCommand extends BaseCommand{[a37_0xf60fab(0x14f)]=a37_0xf60fab(0x196);[a37_0xf60fab(0x1c8)]='Show\x20segment\x20or\x20folder\x20details';async['execute'](_0x3f1c44){const _0x1dfc00=a37_0xf60fab,{options:_0x18f2e1,args:_0x17037d,tdx:_0x35fefc}=_0x3f1c44,_0x47e68b=_0x17037d[0x0],_0x22bdad=!_0x47e68b&&!!_0x18f2e1[_0x1dfc00(0x14d)],_0x155ca7=_0x47e68b||_0x18f2e1['parentSegment'];if(!_0x155ca7)return console[_0x1dfc00(0x1a5)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console['error'](_0x1dfc00(0x190)),console[_0x1dfc00(0x1a5)](_0x1dfc00(0x1ad)),console[_0x1dfc00(0x1a5)](_0x1dfc00(0x164)),console[_0x1dfc00(0x1a5)](_0x1dfc00(0x1ae)),console[_0x1dfc00(0x1a5)](_0x1dfc00(0x151)),console[_0x1dfc00(0x1a5)](_0x1dfc00(0x146)),0x1;try{const _0x156bb1=_0x18f2e1['segmentPath'];let _0x55aa91=_0x155ca7;!_0x22bdad&&_0x156bb1&&!_0x155ca7[_0x1dfc00(0x1bf)]('/')&&(_0x55aa91=_0x156bb1+'/'+_0x155ca7,_0x18f2e1[_0x1dfc00(0x13a)]&&console['error'](_0x1dfc00(0x14e)+_0x55aa91));const _0xa174a4=await withSpinner('Resolving\x20path\x20\x27'+_0x55aa91+'\x27...',()=>_0x35fefc['segment'][_0x1dfc00(0x17e)](_0x55aa91),{'verbose':_0x18f2e1[_0x1dfc00(0x13a)]}),_0x4b23e7=_0xa174a4[_0x1dfc00(0x148)];_0x18f2e1['verbose']&&(console['error'](_0x1dfc00(0x139)+_0x4b23e7['type']),console[_0x1dfc00(0x1a5)]('Parent\x20ID:\x20'+_0x4b23e7[_0x1dfc00(0x133)]),_0x4b23e7[_0x1dfc00(0x162)]&&console['error']('Folder\x20ID:\x20'+_0x4b23e7[_0x1dfc00(0x162)]),_0x4b23e7['segmentId']&&console[_0x1dfc00(0x1a5)](_0x1dfc00(0x12f)+_0x4b23e7[_0x1dfc00(0x12d)]));if(_0x4b23e7[_0x1dfc00(0x18a)]===_0x1dfc00(0x171)){const _0x3f9f7c=await withSpinner(_0x1dfc00(0x19a),()=>_0x35fefc[_0x1dfc00(0x15e)][_0x1dfc00(0x19b)](_0x4b23e7[_0x1dfc00(0x133)]),{'verbose':_0x18f2e1['verbose']});await handleSingleObjectOutput(_0x3f9f7c[_0x1dfc00(0x148)],_0x18f2e1);}else{if(_0x4b23e7[_0x1dfc00(0x18a)]===_0x1dfc00(0x1c3)){if(!_0x4b23e7[_0x1dfc00(0x162)])throw new SDKError(ErrorCode[_0x1dfc00(0x1c4)],_0x1dfc00(0x186));const _0x4f8c12=await withSpinner('Fetching\x20folder\x20details...',()=>_0x35fefc[_0x1dfc00(0x15e)][_0x1dfc00(0x13b)](_0x4b23e7['folderId']),{'verbose':_0x18f2e1['verbose']});await handleSingleObjectOutput(_0x4f8c12['data'],_0x18f2e1);}else{if(_0x4b23e7['type']===_0x1dfc00(0x15e)){if(!_0x4b23e7[_0x1dfc00(0x12d)])throw new SDKError(ErrorCode[_0x1dfc00(0x1a1)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x58f21e=await withSpinner(_0x1dfc00(0x177),()=>_0x35fefc[_0x1dfc00(0x15e)][_0x1dfc00(0x1ca)](_0x4b23e7[_0x1dfc00(0x133)],_0x4b23e7[_0x1dfc00(0x12d)]),{'verbose':_0x18f2e1[_0x1dfc00(0x13a)]});await handleSingleObjectOutput(_0x58f21e['data'],_0x18f2e1);}}}return 0x0;}catch(_0x277420){if(_0x277420 instanceof SDKError)return console['error']('Error:\x20'+_0x277420['message']),_0x277420[_0x1dfc00(0x19f)]&&console[_0x1dfc00(0x1a5)](_0x1dfc00(0x168)+_0x277420['cause']),0x1;throw _0x277420;}}}export class SegmentShowCommand extends BaseCommand{[a37_0xf60fab(0x14f)]='segment:show';['description']='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a37_0xf60fab(0x16d)](_0x2d62a2){const _0x410280=a37_0xf60fab,{options:_0x3dad99,args:_0x10a967,tdx:_0x2d6c1e}=_0x2d62a2,_0xba5b0f=_0x10a967[0x0];if(!_0xba5b0f)return console[_0x410280(0x1a5)](_0x410280(0x17c)),console[_0x410280(0x1a5)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x410280(0x1a5)](_0x410280(0x1ad)),console[_0x410280(0x1a5)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console['error'](_0x410280(0x167)),0x1;try{const _0x354b4d=_0x3dad99[_0x410280(0x14d)],_0x2e354d=await resolveSegmentTarget(_0xba5b0f,_0x354b4d,_0x3dad99[_0x410280(0x13a)]);_0x3dad99[_0x410280(0x13a)]&&console[_0x410280(0x1a5)](_0x410280(0x13c)+_0x2e354d);const _0xdc7089=await withSpinner(_0x410280(0x1b2)+_0xba5b0f+_0x410280(0x12c),()=>_0x2d6c1e[_0x410280(0x15e)][_0x410280(0x17e)](_0x2e354d),{'verbose':_0x3dad99[_0x410280(0x13a)]}),_0x52d402=_0xdc7089[_0x410280(0x148)];_0x3dad99[_0x410280(0x13a)]&&(console[_0x410280(0x1a5)](_0x410280(0x139)+_0x52d402['type']),console['error'](_0x410280(0x16b)+_0x52d402[_0x410280(0x133)]));if(_0x52d402[_0x410280(0x18a)]===_0x410280(0x1c3))return console[_0x410280(0x1a5)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0x410280(0x1a5)]('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x52d402[_0x410280(0x18a)]===_0x410280(0x171))return console['error'](_0x410280(0x1c2)),console[_0x410280(0x1a5)](_0x410280(0x160)),0x1;if(!_0x52d402[_0x410280(0x12d)])throw new SDKError(ErrorCode[_0x410280(0x1a1)],_0x410280(0x197));const _0x1f2e23=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x2d6c1e['segment'][_0x410280(0x1c5)](_0x52d402[_0x410280(0x133)],_0x52d402[_0x410280(0x12d)]),{'verbose':_0x3dad99[_0x410280(0x13a)]});let _0x34f122=_0x1f2e23[_0x410280(0x148)];const _0x111a03=resolveLimit(_0x3dad99[_0x410280(0x150)],DEFAULT_DISPLAY_LIMIT),_0x148508=/\bLIMIT\s+\d+/i[_0x410280(0x174)](_0x34f122);!_0x148508&&(_0x34f122=_0x34f122['trim']()[_0x410280(0x1b8)](/;+$/,''),_0x34f122=_0x410280(0x129)+_0x34f122+_0x410280(0x1ba)+_0x111a03);_0x3dad99['verbose']&&console[_0x410280(0x1a5)]('SQL\x20query:\x0a'+_0x34f122);const _0x1a78c0=await withProgressSpinner(_0x410280(0x1b1),async _0x3b7152=>{const _0x19da67=_0x410280,_0x52c54=await _0x2d6c1e[_0x19da67(0x166)][_0x19da67(0x16d)](_0x34f122,{'catalog':'td','schema':_0x19da67(0x14a),'onJobId':_0x3df410=>{const _0x404ebd=_0x19da67;_0x3b7152[_0x404ebd(0x15b)](_0x3df410);}});return _0x52c54;},{'verbose':_0x3dad99[_0x410280(0x13a)]}),_0x3d8454=_0x1a78c0[_0x410280(0x148)],_0x2bae80=_0x3d8454[_0x410280(0x173)]?_0x410280(0x191)+_0x3d8454['jobId']+']':'';return console['error'](_0x410280(0x176)+_0x3d8454['stats']['processedRows'][_0x410280(0x188)]()+_0x410280(0x132)+(_0x410280(0x187)+formatElapsed(_0x3d8454[_0x410280(0x137)][_0x410280(0x18c)])+_0x2bae80)),await handleQueryOutput(_0x3d8454,_0x3dad99),0x0;}catch(_0xbfc8d2){if(_0xbfc8d2 instanceof SDKError)return console['error'](_0x410280(0x16f)+_0xbfc8d2[_0x410280(0x136)]+']'),console[_0x410280(0x1a5)]('\x0a'+_0xbfc8d2[_0x410280(0x1a6)]),0x1;throw _0xbfc8d2;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0xf60fab(0x14f)]='segment:folder:list';[a37_0xf60fab(0x1c8)]=a37_0xf60fab(0x155);async['execute'](_0x3ffafc){const _0x380446=a37_0xf60fab,{options:_0xe28029,args:_0x371387,tdx:_0x2afc40}=_0x3ffafc;if(_0x371387[_0x380446(0x17d)]===0x0)return console[_0x380446(0x1a5)](_0x380446(0x149)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x44e475=_0x371387[0x0];try{_0xe28029[_0x380446(0x13a)]&&(console[_0x380446(0x1a5)]('Site:\x20'+_0xe28029[_0x380446(0x13e)]),console[_0x380446(0x1a5)](_0x380446(0x198)+_0x44e475));const _0x3ec6c6=await withSpinner(_0x380446(0x19c)+_0x44e475+_0x380446(0x12c),()=>_0x2afc40[_0x380446(0x15e)][_0x380446(0x1b3)](_0x44e475),{'verbose':_0xe28029[_0x380446(0x13a)]}),_0x486bda=_0x3ec6c6[_0x380446(0x148)];_0xe28029[_0x380446(0x13a)]&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x486bda);const _0x12a9ad=await withSpinner(_0x380446(0x12b)+_0x44e475+'\x27...',()=>_0x2afc40[_0x380446(0x15e)][_0x380446(0x189)](_0x486bda),{'verbose':_0xe28029[_0x380446(0x13a)]}),_0x336854=_0x12a9ad[_0x380446(0x148)];return console[_0x380446(0x1a5)]('✔\x20Found\x20'+_0x336854['length']+'\x20folder'+(_0x336854[_0x380446(0x17d)]!==0x1?'s':'')),await handleSDKOutput(_0x336854,_0xe28029),0x0;}catch(_0x25752f){if(_0x25752f instanceof SDKError)return console[_0x380446(0x1a5)](_0x380446(0x138)+_0x25752f[_0x380446(0x1a6)]),_0x25752f[_0x380446(0x19f)]&&console[_0x380446(0x1a5)](_0x380446(0x168)+_0x25752f[_0x380446(0x19f)]),0x1;throw _0x25752f;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a37_0xf60fab(0x15d);[a37_0xf60fab(0x1c8)]=a37_0xf60fab(0x178);async[a37_0xf60fab(0x16d)](_0x1f376d){const _0x1db050=a37_0xf60fab,{options:_0x51f37f,args:_0x78c38f,tdx:_0xed0701}=_0x1f376d;if(_0x78c38f[_0x1db050(0x17d)]===0x0)return console[_0x1db050(0x1a5)](_0x1db050(0x1b9)),console[_0x1db050(0x1a5)](_0x1db050(0x14b)),0x1;try{const {parentId:_0x1de322,childId:_0x107bf2}=parseSegmentRef(_0x78c38f[0x0]);_0x51f37f[_0x1db050(0x13a)]&&(console[_0x1db050(0x1a5)](_0x1db050(0x135)+_0x51f37f['site']),console[_0x1db050(0x1a5)](_0x1db050(0x198)+_0x1de322),_0x107bf2&&console[_0x1db050(0x1a5)](_0x1db050(0x1c9)+_0x107bf2));if(!_0x107bf2)return console[_0x1db050(0x1a5)](_0x1db050(0x1a0)),0x1;const _0x518b0d=await withSpinner(_0x1db050(0x19c)+_0x1de322+'\x27...',()=>_0xed0701['segment'][_0x1db050(0x1b3)](_0x1de322),{'verbose':_0x51f37f[_0x1db050(0x13a)]}),_0x112da9=_0x518b0d[_0x1db050(0x148)];_0x51f37f['verbose']&&console[_0x1db050(0x1a5)](_0x1db050(0x142)+_0x112da9);const _0x286233=await withSpinner('Resolving\x20folder\x20\x27'+_0x107bf2+_0x1db050(0x12c),()=>_0xed0701['segment'][_0x1db050(0x1a3)](_0x112da9,_0x107bf2),{'verbose':_0x51f37f[_0x1db050(0x13a)]}),_0x244553=_0x286233['data'];_0x51f37f[_0x1db050(0x13a)]&&console['error'](_0x1db050(0x12a)+_0x244553);const _0x15c2ad=await withSpinner(_0x1db050(0x13d)+_0x107bf2+'\x27...',()=>_0xed0701[_0x1db050(0x15e)][_0x1db050(0x13b)](_0x244553),{'verbose':_0x51f37f[_0x1db050(0x13a)]});return await handleSDKOutput([_0x15c2ad[_0x1db050(0x148)]],_0x51f37f),0x0;}catch(_0x101f05){if(_0x101f05 instanceof SDKError)return console[_0x1db050(0x1a5)](_0x1db050(0x138)+_0x101f05[_0x1db050(0x1a6)]),_0x101f05[_0x1db050(0x19f)]&&console[_0x1db050(0x1a5)]('\x20\x20Cause:\x20'+_0x101f05[_0x1db050(0x19f)]),0x1;throw _0x101f05;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0xf60fab(0x14f)]=a37_0xf60fab(0x1b0);[a37_0xf60fab(0x1c8)]=a37_0xf60fab(0x195);async[a37_0xf60fab(0x16d)](_0x45b906){const _0x13a923=a37_0xf60fab,{options:_0x17e34b,args:_0x2bc5f7}=_0x45b906,_0x49b0a4=_0x17e34b,_0x322e59=_0x49b0a4[_0x13a923(0x1b6)],_0x2705cf=_0x2bc5f7[0x0];if(!_0x2705cf&&!_0x322e59)return console[_0x13a923(0x1a5)](a37_0x455980[_0x13a923(0x193)]('Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required')),console['error'](_0x13a923(0x140)),console[_0x13a923(0x1a5)]('\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>'),console['error']('\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>'),console['error'](_0x13a923(0x1ad)),console['error']('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x13a923(0x1a5)](_0x13a923(0x12e)),0x1;if(_0x2705cf&&_0x322e59)return console[_0x13a923(0x1a5)](a37_0x455980['red'](_0x13a923(0x16a))),0x1;try{let _0x29d187;if(_0x322e59)_0x29d187=await this[_0x13a923(0x15a)](_0x322e59,_0x45b906);else{if(isYamlFilePath(_0x2705cf))return console[_0x13a923(0x1a5)](a37_0x455980[_0x13a923(0x193)](_0x13a923(0x14c))),console['error'](_0x13a923(0x157)+_0x2705cf),0x1;else _0x29d187=await this['getSQLFromServerSegment'](_0x2705cf,_0x45b906);}return _0x17e34b[_0x13a923(0x1b4)]===_0x13a923(0x144)||_0x17e34b[_0x13a923(0x1b4)]===_0x13a923(0x1a2)?await handleSDKOutput([{'sql':_0x29d187}],_0x17e34b):console[_0x13a923(0x16e)](_0x29d187),0x0;}catch(_0x37b7af){if(_0x37b7af instanceof SDKError)return console['error']('Error:\x20'+_0x37b7af[_0x13a923(0x1a6)]),_0x37b7af[_0x13a923(0x19f)]&&console[_0x13a923(0x1a5)](_0x13a923(0x168)+_0x37b7af[_0x13a923(0x19f)]),0x1;throw _0x37b7af;}}async[a37_0xf60fab(0x15a)](_0xf9667a,_0x2b7007){const _0x3644a6=a37_0xf60fab,{options:_0x288c63,tdx:_0x47c1c3}=_0x2b7007;let _0x2444a5;try{_0x2444a5=await resolveYamlFilePath(_0xf9667a);}catch(_0x505e0c){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x505e0c[_0x3644a6(0x1a6)]);}_0x288c63['verbose']&&console[_0x3644a6(0x1a5)]('Resolved:\x20'+_0x2444a5['parentSegment']+'/'+_0x2444a5[_0x3644a6(0x182)]);const _0x3f4ad9=await withSpinner(_0x3644a6(0x19d),()=>_0x47c1c3[_0x3644a6(0x15e)][_0x3644a6(0x15c)](_0x2444a5[_0x3644a6(0x184)],_0x2444a5[_0x3644a6(0x14d)],_0x2444a5[_0x3644a6(0x182)]),{'verbose':_0x288c63[_0x3644a6(0x13a)]});return _0x3f4ad9[_0x3644a6(0x148)];}async['getSQLFromServerSegment'](_0x25383d,_0x248f27){const _0x2a50b0=a37_0xf60fab,{options:_0x224e0f,tdx:_0x46eb60}=_0x248f27,_0x3c7607=_0x224e0f[_0x2a50b0(0x14d)],_0x5ce004=await resolveSegmentTarget(_0x25383d,_0x3c7607,_0x224e0f['verbose']);_0x224e0f[_0x2a50b0(0x13a)]&&console[_0x2a50b0(0x1a5)](_0x2a50b0(0x13c)+_0x5ce004);const _0xf54607=await withSpinner(_0x2a50b0(0x1b2)+_0x25383d+_0x2a50b0(0x12c),()=>_0x46eb60['segment'][_0x2a50b0(0x17e)](_0x5ce004),{'verbose':_0x224e0f['verbose']}),_0x2f0244=_0xf54607['data'];_0x224e0f[_0x2a50b0(0x13a)]&&(console[_0x2a50b0(0x1a5)](_0x2a50b0(0x139)+_0x2f0244[_0x2a50b0(0x18a)]),console['error']('Parent\x20ID:\x20'+_0x2f0244[_0x2a50b0(0x133)]));if(_0x2f0244[_0x2a50b0(0x18a)]===_0x2a50b0(0x1c3))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2a50b0(0x143));if(_0x2f0244[_0x2a50b0(0x18a)]===_0x2a50b0(0x171))throw new SDKError(ErrorCode[_0x2a50b0(0x199)],_0x2a50b0(0x1a4));if(!_0x2f0244[_0x2a50b0(0x12d)])throw new SDKError(ErrorCode[_0x2a50b0(0x1a1)],_0x2a50b0(0x197));const _0x493fc9=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x46eb60[_0x2a50b0(0x15e)][_0x2a50b0(0x1c5)](_0x2f0244[_0x2a50b0(0x133)],_0x2f0244[_0x2a50b0(0x12d)]),{'verbose':_0x224e0f[_0x2a50b0(0x13a)]});return _0x493fc9[_0x2a50b0(0x148)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0xf60fab(0x14f)]=a37_0xf60fab(0x1a7);[a37_0xf60fab(0x1c8)]=a37_0xf60fab(0x18b);async[a37_0xf60fab(0x16d)](_0x38e94d){const _0x20d41d=a37_0xf60fab,{options:_0x215a1f,args:_0x403ac6,tdx:_0x3c5d30}=_0x38e94d,_0x472f78=_0x215a1f;if(_0x403ac6['length']<0x2)return console[_0x20d41d(0x1a5)](_0x20d41d(0x147)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x2c0f8b=_0x403ac6[0x0],_0x1ba439=_0x403ac6[0x1];_0x472f78['verbose']&&(console[_0x20d41d(0x1a5)](_0x20d41d(0x135)+_0x472f78[_0x20d41d(0x13e)]),console[_0x20d41d(0x1a5)](_0x20d41d(0x127)+_0x2c0f8b),console['error'](_0x20d41d(0x1c9)+_0x1ba439));let _0x30e080;if(_0x472f78[_0x20d41d(0x18e)]){const _0x1eea51=_0x472f78[_0x20d41d(0x18e)],_0x5a47bb=await withSpinner(_0x20d41d(0x19c)+_0x2c0f8b+_0x20d41d(0x12c),()=>_0x3c5d30[_0x20d41d(0x15e)][_0x20d41d(0x1b3)](_0x2c0f8b),{'verbose':_0x472f78[_0x20d41d(0x13a)]}),_0x1d07cf=_0x5a47bb[_0x20d41d(0x148)],_0x4c18b2=await withSpinner(_0x20d41d(0x158)+_0x1eea51+_0x20d41d(0x12c),()=>_0x3c5d30[_0x20d41d(0x15e)][_0x20d41d(0x1a3)](_0x1d07cf,_0x1eea51),{'verbose':_0x472f78[_0x20d41d(0x13a)]});_0x30e080=_0x4c18b2[_0x20d41d(0x148)],_0x472f78['verbose']&&console[_0x20d41d(0x1a5)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x30e080);}const _0x375786={'name':_0x1ba439,'description':_0x472f78['description'],'parentFolderId':_0x30e080},_0xafec6a=await withSpinner(_0x20d41d(0x1bb)+_0x1ba439+_0x20d41d(0x12c),()=>_0x3c5d30[_0x20d41d(0x15e)][_0x20d41d(0x19e)](_0x2c0f8b,_0x375786),{'verbose':_0x472f78[_0x20d41d(0x13a)]}),_0x3e62db=_0xafec6a[_0x20d41d(0x148)];return console['error'](_0x20d41d(0x154)+_0x3e62db[_0x20d41d(0x14f)]+_0x20d41d(0x153)+_0x3e62db['id']),await handleSDKOutput([_0x3e62db],_0x472f78),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a37_0xf60fab(0x130);[a37_0xf60fab(0x1c8)]=a37_0xf60fab(0x180);async[a37_0xf60fab(0x16d)](_0x3ffa28){const _0x53fe78=a37_0xf60fab,{options:_0x3abd77,args:_0x507292,tdx:_0x1fccd4}=_0x3ffa28,_0x5c55aa=_0x507292[0x0];if(!_0x5c55aa)return console[_0x53fe78(0x1a5)](_0x53fe78(0x128)),console['error']('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console[_0x53fe78(0x1a5)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console[_0x53fe78(0x1a5)]('Options:'),console[_0x53fe78(0x1a5)](_0x53fe78(0x183)),console[_0x53fe78(0x1a5)](_0x53fe78(0x1ad)),console['error'](_0x53fe78(0x145)),console['error'](_0x53fe78(0x17f)),console[_0x53fe78(0x1a5)](_0x53fe78(0x170)),console[_0x53fe78(0x1a5)]('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x5b5b02=_0x3abd77[_0x53fe78(0x14d)],_0x2dbe33=await resolveSegmentTarget(_0x5c55aa,_0x5b5b02,_0x3abd77[_0x53fe78(0x13a)]);_0x3abd77[_0x53fe78(0x13a)]&&console[_0x53fe78(0x1a5)](_0x53fe78(0x13c)+_0x2dbe33);const _0x40cdfb=await withSpinner(_0x53fe78(0x1b2)+_0x5c55aa+'\x27...',()=>_0x1fccd4[_0x53fe78(0x15e)][_0x53fe78(0x17e)](_0x2dbe33),{'verbose':_0x3abd77[_0x53fe78(0x13a)]}),_0x47bc8e=_0x40cdfb[_0x53fe78(0x148)];_0x3abd77[_0x53fe78(0x13a)]&&(console[_0x53fe78(0x1a5)](_0x53fe78(0x139)+_0x47bc8e[_0x53fe78(0x18a)]),console[_0x53fe78(0x1a5)]('Parent\x20ID:\x20'+_0x47bc8e[_0x53fe78(0x133)]),_0x47bc8e[_0x53fe78(0x162)]&&console[_0x53fe78(0x1a5)](_0x53fe78(0x1aa)+_0x47bc8e[_0x53fe78(0x162)]),_0x47bc8e['segmentId']&&console['error'](_0x53fe78(0x12f)+_0x47bc8e[_0x53fe78(0x12d)]));if(_0x3abd77['web']){if(_0x47bc8e[_0x53fe78(0x18a)]==='folder')return console[_0x53fe78(0x1a5)](_0x53fe78(0x126)),0x1;if(_0x47bc8e[_0x53fe78(0x18a)]===_0x53fe78(0x171))return console[_0x53fe78(0x1a5)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x53fe78(0x1a5)](_0x53fe78(0x17b)),0x1;if(!_0x47bc8e[_0x53fe78(0x12d)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x53fe78(0x197));const _0x15588e=getConsoleNextUrl(_0x3abd77['site'],_0x53fe78(0x152)+_0x47bc8e['parentId']+_0x53fe78(0x172)+_0x47bc8e['segmentId']);return console[_0x53fe78(0x1a5)](a37_0x455980[_0x53fe78(0x159)]('✔')+_0x53fe78(0x1c0)+a37_0x455980['cyan'](_0x15588e)),openBrowser(_0x15588e),0x0;}if(_0x47bc8e['type']==='folder'){if(!_0x47bc8e[_0x53fe78(0x162)])throw new SDKError(ErrorCode[_0x53fe78(0x1c4)],_0x53fe78(0x186));const _0x1a8ebe=await withSpinner(_0x53fe78(0x1af),()=>_0x1fccd4[_0x53fe78(0x15e)][_0x53fe78(0x13b)](_0x47bc8e[_0x53fe78(0x162)]),{'verbose':_0x3abd77['verbose']});await handleSingleObjectOutput(_0x1a8ebe[_0x53fe78(0x148)],_0x3abd77);}else{if(_0x47bc8e[_0x53fe78(0x18a)]===_0x53fe78(0x15e)){if(!_0x47bc8e['segmentId'])throw new SDKError(ErrorCode[_0x53fe78(0x1a1)],_0x53fe78(0x197));const _0x38a2b0=await withSpinner(_0x53fe78(0x177),()=>_0x1fccd4[_0x53fe78(0x15e)][_0x53fe78(0x1ca)](_0x47bc8e[_0x53fe78(0x133)],_0x47bc8e['segmentId']),{'verbose':_0x3abd77[_0x53fe78(0x13a)]}),_0x2874ce=getConsoleNextUrl(_0x3abd77[_0x53fe78(0x13e)],_0x53fe78(0x152)+_0x47bc8e[_0x53fe78(0x133)]+_0x53fe78(0x172)+_0x47bc8e['segmentId']),_0x270efc=_0x38a2b0['data'];_0x270efc[_0x53fe78(0x185)]=_0x2874ce,await handleSingleObjectOutput(_0x270efc,_0x3abd77);}else return console['error'](_0x53fe78(0x179)),console[_0x53fe78(0x1a5)](_0x53fe78(0x18d)),0x1;}return 0x0;}catch(_0x3e396e){if(_0x3e396e instanceof SDKError)return console['error']('Error:\x20'+_0x3e396e[_0x53fe78(0x1a6)]),_0x3e396e['cause']&&console[_0x53fe78(0x1a5)](_0x53fe78(0x168)+_0x3e396e['cause']),0x1;throw _0x3e396e;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']=a37_0xf60fab(0x18f);[a37_0xf60fab(0x1c8)]=a37_0xf60fab(0x175);async['execute'](_0x291526){const _0x5be196=a37_0xf60fab,{options:_0x27773b,args:_0x53f233,tdx:_0x3f33c3}=_0x291526,_0x54beab=_0x53f233[0x0];if(!_0x54beab)return console[_0x5be196(0x1a5)](_0x5be196(0x17c)),console['error'](_0x5be196(0x163)),console[_0x5be196(0x1a5)](_0x5be196(0x17a)),console['error'](_0x5be196(0x1ad)),console[_0x5be196(0x1a5)](_0x5be196(0x134)),console[_0x5be196(0x1a5)](_0x5be196(0x1c6)),0x1;try{const _0xe7bc07=_0x27773b[_0x5be196(0x14d)],_0x16adb5=await resolveSegmentTarget(_0x54beab,_0xe7bc07,_0x27773b[_0x5be196(0x13a)]);_0x27773b[_0x5be196(0x13a)]&&console[_0x5be196(0x1a5)]('Target\x20path:\x20'+_0x16adb5);const _0x5d803b=await withSpinner(_0x5be196(0x1b2)+_0x54beab+_0x5be196(0x12c),()=>_0x3f33c3['segment'][_0x5be196(0x17e)](_0x16adb5),{'verbose':_0x27773b['verbose']}),_0x33f3f7=_0x5d803b[_0x5be196(0x148)];_0x27773b[_0x5be196(0x13a)]&&(console[_0x5be196(0x1a5)](_0x5be196(0x139)+_0x33f3f7['type']),console['error'](_0x5be196(0x16b)+_0x33f3f7['parentId']));if(_0x33f3f7[_0x5be196(0x18a)]===_0x5be196(0x1c3))return console['error'](_0x5be196(0x194)),console[_0x5be196(0x1a5)](_0x5be196(0x131)),0x1;if(_0x33f3f7[_0x5be196(0x18a)]===_0x5be196(0x171))return console[_0x5be196(0x1a5)](_0x5be196(0x192)),console[_0x5be196(0x1a5)](_0x5be196(0x1ac)),0x1;if(!_0x33f3f7[_0x5be196(0x12d)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x5be196(0x197));const _0x3bf220=await withSpinner(_0x5be196(0x13f),()=>_0x3f33c3[_0x5be196(0x15e)][_0x5be196(0x1c5)](_0x33f3f7[_0x5be196(0x133)],_0x33f3f7[_0x5be196(0x12d)]),{'verbose':_0x27773b[_0x5be196(0x13a)]}),_0x414899=_0x3bf220['data'],_0x3d995a=await executeSchemaQuery(_0x414899,_0x3f33c3,_0x27773b);return await handleQueryOutput(_0x3d995a,_0x27773b),0x0;}catch(_0x2120a5){if(_0x2120a5 instanceof SDKError)return console[_0x5be196(0x1a5)](_0x5be196(0x138)+_0x2120a5[_0x5be196(0x1a6)]),_0x2120a5[_0x5be196(0x19f)]&&console[_0x5be196(0x1a5)](_0x5be196(0x168)+_0x2120a5['cause']),0x1;throw _0x2120a5;}}}
1
+ const a37_0x867ae0=a37_0x5984;(function(_0x380ff6,_0x5a2026){const _0x2e699b=a37_0x5984,_0x1a7c2e=_0x380ff6();while(!![]){try{const _0x3ec96f=parseInt(_0x2e699b(0x25c))/0x1+parseInt(_0x2e699b(0x28a))/0x2*(-parseInt(_0x2e699b(0x20b))/0x3)+-parseInt(_0x2e699b(0x21d))/0x4+-parseInt(_0x2e699b(0x204))/0x5*(-parseInt(_0x2e699b(0x288))/0x6)+-parseInt(_0x2e699b(0x1f3))/0x7*(parseInt(_0x2e699b(0x24e))/0x8)+-parseInt(_0x2e699b(0x274))/0x9*(-parseInt(_0x2e699b(0x1fc))/0xa)+parseInt(_0x2e699b(0x21a))/0xb;if(_0x3ec96f===_0x5a2026)break;else _0x1a7c2e['push'](_0x1a7c2e['shift']());}catch(_0x10b9c2){_0x1a7c2e['push'](_0x1a7c2e['shift']());}}}(a37_0x2e8b,0x52b45));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a37_0x5984(_0x1117fc,_0x46c4f7){_0x1117fc=_0x1117fc-0x1ef;const _0x2e8bf5=a37_0x2e8b();let _0x5984cb=_0x2e8bf5[_0x1117fc];return _0x5984cb;}import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0x306a45 from'chalk';async function resolveSegmentTarget(_0x316d4b,_0x447ce0,_0x32ec1f){const _0x344db2=a37_0x5984;if(isYamlFilePath(_0x316d4b))try{const _0x1f6193=await resolveYamlFilePath(_0x316d4b);return _0x32ec1f&&(console[_0x344db2(0x281)]('Resolved\x20YAML\x20file:\x20'+_0x316d4b),console['error'](_0x344db2(0x258)+_0x1f6193[_0x344db2(0x265)]),console['error'](_0x344db2(0x205)+_0x1f6193[_0x344db2(0x273)]),console[_0x344db2(0x281)](_0x344db2(0x27f)+(_0x1f6193[_0x344db2(0x25e)]||'(root)')),console['error'](_0x344db2(0x254)+_0x1f6193[_0x344db2(0x284)])),_0x1f6193[_0x344db2(0x284)];}catch(_0x55a05e){throw new SDKError(ErrorCode[_0x344db2(0x225)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x55a05e[_0x344db2(0x235)]);}if(!_0x447ce0)throw new SDKError(ErrorCode[_0x344db2(0x225)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x447ce0+'/'+_0x316d4b;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x867ae0(0x245)]=a37_0x867ae0(0x21c);[a37_0x867ae0(0x263)]=a37_0x867ae0(0x24d);async[a37_0x867ae0(0x22f)](_0x547743){const _0x3f077c=a37_0x867ae0,{options:_0x5d8823,args:_0x5220cc,tdx:_0x51ab73}=_0x547743,_0x3d95d1=_0x5220cc[0x0],_0x428c4f=!_0x3d95d1&&!!_0x5d8823[_0x3f077c(0x265)],_0x15c9e8=_0x3d95d1||_0x5d8823[_0x3f077c(0x265)];if(!_0x15c9e8)return console['error'](_0x3f077c(0x21b)),console[_0x3f077c(0x281)](_0x3f077c(0x26c)),console[_0x3f077c(0x281)](_0x3f077c(0x275)),console[_0x3f077c(0x281)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console['error']('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console[_0x3f077c(0x281)]('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console[_0x3f077c(0x281)](_0x3f077c(0x203)),0x1;try{const _0xe7ea48=_0x5d8823[_0x3f077c(0x224)];let _0x5f284a=_0x15c9e8;!_0x428c4f&&_0xe7ea48&&!_0x15c9e8[_0x3f077c(0x226)]('/')&&(_0x5f284a=_0xe7ea48+'/'+_0x15c9e8,_0x5d8823[_0x3f077c(0x290)]&&console['error'](_0x3f077c(0x202)+_0x5f284a));const _0x500bc0=await withSpinner(_0x3f077c(0x286)+_0x5f284a+_0x3f077c(0x21f),()=>_0x51ab73['segment'][_0x3f077c(0x220)](_0x5f284a),{'verbose':_0x5d8823[_0x3f077c(0x290)]}),_0x213fdb=_0x500bc0[_0x3f077c(0x1ef)];_0x5d8823[_0x3f077c(0x290)]&&(console[_0x3f077c(0x281)](_0x3f077c(0x285)+_0x213fdb['type']),console[_0x3f077c(0x281)](_0x3f077c(0x255)+_0x213fdb[_0x3f077c(0x27c)]),_0x213fdb[_0x3f077c(0x217)]&&console['error']('Folder\x20ID:\x20'+_0x213fdb[_0x3f077c(0x217)]),_0x213fdb[_0x3f077c(0x234)]&&console[_0x3f077c(0x281)](_0x3f077c(0x241)+_0x213fdb[_0x3f077c(0x234)]));if(_0x213fdb[_0x3f077c(0x1f4)]===_0x3f077c(0x28f)){const _0xfd0ff5=await withSpinner(_0x3f077c(0x244),()=>_0x51ab73[_0x3f077c(0x26e)][_0x3f077c(0x210)](_0x213fdb[_0x3f077c(0x27c)]),{'verbose':_0x5d8823['verbose']});await handleSingleObjectOutput(_0xfd0ff5[_0x3f077c(0x1ef)],_0x5d8823);}else{if(_0x213fdb[_0x3f077c(0x1f4)]==='folder'){if(!_0x213fdb[_0x3f077c(0x217)])throw new SDKError(ErrorCode[_0x3f077c(0x28e)],_0x3f077c(0x247));const _0x5755b1=await withSpinner(_0x3f077c(0x243),()=>_0x51ab73[_0x3f077c(0x26e)][_0x3f077c(0x201)](_0x213fdb[_0x3f077c(0x217)]),{'verbose':_0x5d8823[_0x3f077c(0x290)]});await handleSingleObjectOutput(_0x5755b1[_0x3f077c(0x1ef)],_0x5d8823);}else{if(_0x213fdb[_0x3f077c(0x1f4)]==='segment'){if(!_0x213fdb['segmentId'])throw new SDKError(ErrorCode[_0x3f077c(0x1fb)],_0x3f077c(0x246));const _0x10acbb=await withSpinner('Fetching\x20segment\x20details...',()=>_0x51ab73[_0x3f077c(0x26e)][_0x3f077c(0x209)](_0x213fdb[_0x3f077c(0x27c)],_0x213fdb[_0x3f077c(0x234)]),{'verbose':_0x5d8823['verbose']});await handleSingleObjectOutput(_0x10acbb[_0x3f077c(0x1ef)],_0x5d8823);}}}return 0x0;}catch(_0x1f2895){if(_0x1f2895 instanceof SDKError)return console['error']('Error:\x20'+_0x1f2895['message']),_0x1f2895[_0x3f077c(0x28c)]&&console[_0x3f077c(0x281)](_0x3f077c(0x236)+_0x1f2895[_0x3f077c(0x28c)]),0x1;throw _0x1f2895;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x867ae0(0x245)]='segment:show';[a37_0x867ae0(0x263)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async['execute'](_0x70f232){const _0x364f60=a37_0x867ae0,{options:_0x2c492e,args:_0x2866ec,tdx:_0x2974a0}=_0x70f232,_0x50bedc=_0x2866ec[0x0];if(!_0x50bedc)return console[_0x364f60(0x281)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x364f60(0x281)](_0x364f60(0x20f)),console[_0x364f60(0x281)](_0x364f60(0x232)),console[_0x364f60(0x281)](_0x364f60(0x275)),console[_0x364f60(0x281)](_0x364f60(0x266)),console[_0x364f60(0x281)](_0x364f60(0x272)),0x1;try{const _0x359cfb=_0x2c492e[_0x364f60(0x265)],_0x288d54=await resolveSegmentTarget(_0x50bedc,_0x359cfb,_0x2c492e[_0x364f60(0x290)]);_0x2c492e['verbose']&&console[_0x364f60(0x281)]('Target\x20path:\x20'+_0x288d54);const _0x1f8b25=await withSpinner(_0x364f60(0x26a)+_0x50bedc+_0x364f60(0x21f),()=>_0x2974a0[_0x364f60(0x26e)][_0x364f60(0x220)](_0x288d54),{'verbose':_0x2c492e['verbose']}),_0x10c5ac=_0x1f8b25[_0x364f60(0x1ef)];_0x2c492e[_0x364f60(0x290)]&&(console[_0x364f60(0x281)](_0x364f60(0x285)+_0x10c5ac[_0x364f60(0x1f4)]),console[_0x364f60(0x281)](_0x364f60(0x255)+_0x10c5ac[_0x364f60(0x27c)]));if(_0x10c5ac[_0x364f60(0x1f4)]===_0x364f60(0x23b))return console[_0x364f60(0x281)](_0x364f60(0x20c)),console['error'](_0x364f60(0x1ff)),0x1;if(_0x10c5ac[_0x364f60(0x1f4)]==='parent')return console[_0x364f60(0x281)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x364f60(0x281)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x10c5ac[_0x364f60(0x234)])throw new SDKError(ErrorCode[_0x364f60(0x1fb)],_0x364f60(0x246));const _0x18c99b=await withSpinner(_0x364f60(0x212),()=>_0x2974a0[_0x364f60(0x26e)][_0x364f60(0x22a)](_0x10c5ac[_0x364f60(0x27c)],_0x10c5ac[_0x364f60(0x234)]),{'verbose':_0x2c492e[_0x364f60(0x290)]});let _0x1c1206=_0x18c99b[_0x364f60(0x1ef)];const _0x4b4a05=resolveLimit(_0x2c492e[_0x364f60(0x27e)],DEFAULT_DISPLAY_LIMIT),_0x337937=/\bLIMIT\s+\d+/i['test'](_0x1c1206);!_0x337937&&(_0x1c1206=_0x1c1206[_0x364f60(0x27d)]()[_0x364f60(0x248)](/;+$/,''),_0x1c1206=_0x364f60(0x259)+_0x1c1206+_0x364f60(0x21e)+_0x4b4a05);_0x2c492e[_0x364f60(0x290)]&&console['error'](_0x364f60(0x23a)+_0x1c1206);const _0x1b9ca0=await withProgressSpinner(_0x364f60(0x213),async _0x2cc951=>{const _0x44c7c6=_0x364f60,_0x17833f=await _0x2974a0[_0x44c7c6(0x23e)]['execute'](_0x1c1206,{'catalog':'td','schema':_0x44c7c6(0x261),'onJobId':_0x394547=>{const _0x4f4c33=_0x44c7c6;_0x2cc951[_0x4f4c33(0x287)](_0x394547);}});return _0x17833f;},{'verbose':_0x2c492e['verbose']}),_0x32f252=_0x1b9ca0[_0x364f60(0x1ef)],_0x367573=_0x32f252[_0x364f60(0x215)]?_0x364f60(0x27a)+_0x32f252[_0x364f60(0x215)]+']':'';return console[_0x364f60(0x281)](_0x364f60(0x26b)+_0x32f252[_0x364f60(0x270)]['processedRows'][_0x364f60(0x1fa)]()+_0x364f60(0x228)+('in\x20'+formatElapsed(_0x32f252[_0x364f60(0x270)][_0x364f60(0x291)])+_0x367573)),await handleQueryOutput(_0x32f252,_0x2c492e),0x0;}catch(_0x329456){if(_0x329456 instanceof SDKError)return console[_0x364f60(0x281)]('✖\x20Query\x20failed\x20['+_0x329456['code']+']'),console[_0x364f60(0x281)]('\x0a'+_0x329456['message']),0x1;throw _0x329456;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x867ae0(0x245)]=a37_0x867ae0(0x230);[a37_0x867ae0(0x263)]=a37_0x867ae0(0x1f7);async[a37_0x867ae0(0x22f)](_0x279f4a){const _0x2d7470=a37_0x867ae0,{options:_0x24e895,args:_0x58d0ca,tdx:_0x118cd4}=_0x279f4a;if(_0x58d0ca[_0x2d7470(0x28b)]===0x0)return console[_0x2d7470(0x281)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x2d7470(0x281)](_0x2d7470(0x24b)),0x1;const _0x1e4c43=_0x58d0ca[0x0];try{_0x24e895[_0x2d7470(0x290)]&&(console[_0x2d7470(0x281)](_0x2d7470(0x250)+_0x24e895[_0x2d7470(0x249)]),console[_0x2d7470(0x281)](_0x2d7470(0x237)+_0x1e4c43));const _0x29ad10=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x1e4c43+_0x2d7470(0x21f),()=>_0x118cd4[_0x2d7470(0x26e)][_0x2d7470(0x22e)](_0x1e4c43),{'verbose':_0x24e895[_0x2d7470(0x290)]}),_0x24776f=_0x29ad10[_0x2d7470(0x1ef)];_0x24e895['verbose']&&console[_0x2d7470(0x281)](_0x2d7470(0x278)+_0x24776f);const _0x356bef=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x1e4c43+_0x2d7470(0x21f),()=>_0x118cd4[_0x2d7470(0x26e)][_0x2d7470(0x23c)](_0x24776f),{'verbose':_0x24e895['verbose']}),_0x335e6a=_0x356bef[_0x2d7470(0x1ef)];return console['error']('✔\x20Found\x20'+_0x335e6a[_0x2d7470(0x28b)]+_0x2d7470(0x218)+(_0x335e6a[_0x2d7470(0x28b)]!==0x1?'s':'')),await handleSDKOutput(_0x335e6a,_0x24e895),0x0;}catch(_0x2ed67b){if(_0x2ed67b instanceof SDKError)return console[_0x2d7470(0x281)](_0x2d7470(0x280)+_0x2ed67b[_0x2d7470(0x235)]),_0x2ed67b['cause']&&console['error'](_0x2d7470(0x236)+_0x2ed67b[_0x2d7470(0x28c)]),0x1;throw _0x2ed67b;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x867ae0(0x245)]=a37_0x867ae0(0x1f2);['description']='Show\x20segment\x20folder\x20details';async['execute'](_0x16e471){const _0x402dab=a37_0x867ae0,{options:_0x1f68d1,args:_0x944082,tdx:_0x396fee}=_0x16e471;if(_0x944082['length']===0x0)return console['error'](_0x402dab(0x268)),console[_0x402dab(0x281)](_0x402dab(0x276)),0x1;try{const {parentId:_0x28446e,childId:_0x3d775a}=parseSegmentRef(_0x944082[0x0]);_0x1f68d1[_0x402dab(0x290)]&&(console['error'](_0x402dab(0x250)+_0x1f68d1[_0x402dab(0x249)]),console['error'](_0x402dab(0x237)+_0x28446e),_0x3d775a&&console[_0x402dab(0x281)](_0x402dab(0x24c)+_0x3d775a));if(!_0x3d775a)return console[_0x402dab(0x281)](_0x402dab(0x22d)),0x1;const _0x401a82=await withSpinner(_0x402dab(0x25b)+_0x28446e+_0x402dab(0x21f),()=>_0x396fee['segment'][_0x402dab(0x22e)](_0x28446e),{'verbose':_0x1f68d1['verbose']}),_0x2382c8=_0x401a82[_0x402dab(0x1ef)];_0x1f68d1[_0x402dab(0x290)]&&console[_0x402dab(0x281)]('Resolved\x20parent\x20ID:\x20'+_0x2382c8);const _0x2d564b=await withSpinner('Resolving\x20folder\x20\x27'+_0x3d775a+_0x402dab(0x21f),()=>_0x396fee[_0x402dab(0x26e)]['resolveFolderId'](_0x2382c8,_0x3d775a),{'verbose':_0x1f68d1[_0x402dab(0x290)]}),_0x30bfe6=_0x2d564b[_0x402dab(0x1ef)];_0x1f68d1['verbose']&&console[_0x402dab(0x281)]('Resolved\x20folder\x20ID:\x20'+_0x30bfe6);const _0x29b993=await withSpinner(_0x402dab(0x206)+_0x3d775a+_0x402dab(0x21f),()=>_0x396fee[_0x402dab(0x26e)][_0x402dab(0x201)](_0x30bfe6),{'verbose':_0x1f68d1['verbose']});return await handleSDKOutput([_0x29b993['data']],_0x1f68d1),0x0;}catch(_0x2b43b6){if(_0x2b43b6 instanceof SDKError)return console[_0x402dab(0x281)]('Error:\x20'+_0x2b43b6['message']),_0x2b43b6[_0x402dab(0x28c)]&&console[_0x402dab(0x281)](_0x402dab(0x236)+_0x2b43b6['cause']),0x1;throw _0x2b43b6;}}}function a37_0x2e8b(){const _0x48a369=['\x27...','resolvePathToResource','/app/ps/','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','segmentPath','INVALID_ARGUMENT','includes','red','\x20rows\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','getSegmentSQL','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','resolveParentId','execute','segment:folder:list','segment:sql','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','segmentId','message','\x20\x20Cause:\x20','Parent\x20name:\x20','log','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','SQL\x20query:\x0a','folder','listFolders','json','query','Get\x20SQL\x20query\x20for\x20child\x20segment','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Segment\x20ID:\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Fetching\x20folder\x20details...','Fetching\x20parent\x20segment\x20details...','name','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Folder\x20ID\x20missing\x20from\x20resolved\x20path','replace','site','Use:\x20tdx\x20ps\x20desc','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Folder\x20name:\x20','Show\x20segment\x20or\x20folder\x20details','8WKsmTf','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Site:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','\x20\x20Full\x20path:\x20','Parent\x20ID:\x20','segment:folder:create','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','\x20\x20Parent\x20segment:\x20','SELECT\x20*\x20FROM\x20(\x0a','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Resolving\x20parent\x20segment\x20\x27','286569uELKht','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','folderPath','Target\x20path:\x20','getSQLFromYamlFile','information_schema','parentFolder','description','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','parentSegment','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Resolved\x20parent\x20folder\x20ID:\x20','Error:\x20Folder\x20reference\x20is\x20required','Usage:','Resolving\x20\x27','✔\x20Query\x20completed:\x20Processed\x20','Usage:\x20tdx\x20segment\x20describe\x20<path>','resolveFolderId','segment','green','stats','Creating\x20folder\x20\x27','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','segmentName','171pMEwKH','Examples:','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Resolving\x20parent\x20folder\x20\x27','Resolved\x20parent\x20ID:\x20','Use:\x20tdx\x20ps\x20view','\x20[Job\x20ID:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','parentId','trim','limit','\x20\x20Folder\x20path:\x20','Error:\x20','error','Fetching\x20segment\x20details...','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','fullPath','Resolved\x20type:\x20','Resolving\x20path\x20\x27','setJobId','318OaTqcy','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','10ZdqFiA','length','cause','format','SEGMENT_FOLDER_NOT_FOUND','parent','verbose','elapsedTimeMillis','data','\x20Opening\x20','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','segment:folder:show','3868851KaPdsu','type','getSegmentSQLFromYaml','getSQLFromServerSegment','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Options:','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','toLocaleString','SEGMENT_NOT_FOUND','130330skJTYZ','Folder\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Show\x20folder\x20or\x20child\x20segment\x20details','getFolder','Resolved\x20relative\x20path\x20to:\x20','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','37055PqrRaz','\x20\x20Segment\x20name:\x20','Fetching\x20folder\x20\x27','✔\x20Created\x20folder\x20\x27','\x27\x20with\x20ID:\x20','getSegment','Create\x20segment\x20folder\x20for\x20organization','400227ckuOFH','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','jsonl','Usage:\x20tdx\x20sg\x20show\x20<name>','getParent','Show\x20child\x20segment\x20schema\x20(column\x20types)','Fetching\x20SQL\x20for\x20segment...','Executing\x20segment\x20query...','content','jobId','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','folderId','\x20folder','web','11416768KFyzkX','Error:\x20Path\x20or\x20name\x20is\x20required','segment:describe','1625488xaSmTx','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'];a37_0x2e8b=function(){return _0x48a369;};return a37_0x2e8b();}export class SegmentSQLCommand extends BaseCommand{[a37_0x867ae0(0x245)]=a37_0x867ae0(0x231);[a37_0x867ae0(0x263)]=a37_0x867ae0(0x23f);async['execute'](_0x348071){const _0x5e66a7=a37_0x867ae0,{options:_0x188346,args:_0x43e5a0}=_0x348071,_0x524683=_0x188346,_0x5cf41a=_0x524683['path'],_0x4255c0=_0x43e5a0[0x0];if(!_0x4255c0&&!_0x5cf41a)return console[_0x5e66a7(0x281)](a37_0x306a45[_0x5e66a7(0x227)]('Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required')),console[_0x5e66a7(0x281)](_0x5e66a7(0x269)),console['error'](_0x5e66a7(0x22c)),console[_0x5e66a7(0x281)](_0x5e66a7(0x22b)),console[_0x5e66a7(0x281)](_0x5e66a7(0x275)),console[_0x5e66a7(0x281)](_0x5e66a7(0x289)),console[_0x5e66a7(0x281)](_0x5e66a7(0x223)),0x1;if(_0x4255c0&&_0x5cf41a)return console[_0x5e66a7(0x281)](a37_0x306a45[_0x5e66a7(0x227)](_0x5e66a7(0x233))),0x1;try{let _0x46f77c;if(_0x5cf41a)_0x46f77c=await this[_0x5e66a7(0x260)](_0x5cf41a,_0x348071);else{if(isYamlFilePath(_0x4255c0))return console['error'](a37_0x306a45[_0x5e66a7(0x227)](_0x5e66a7(0x253))),console[_0x5e66a7(0x281)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20'+_0x4255c0),0x1;else _0x46f77c=await this[_0x5e66a7(0x1f6)](_0x4255c0,_0x348071);}return _0x188346[_0x5e66a7(0x28d)]===_0x5e66a7(0x23d)||_0x188346[_0x5e66a7(0x28d)]===_0x5e66a7(0x20e)?await handleSDKOutput([{'sql':_0x46f77c}],_0x188346):console[_0x5e66a7(0x238)](_0x46f77c),0x0;}catch(_0x5a83af){if(_0x5a83af instanceof SDKError)return console['error'](_0x5e66a7(0x280)+_0x5a83af[_0x5e66a7(0x235)]),_0x5a83af[_0x5e66a7(0x28c)]&&console[_0x5e66a7(0x281)](_0x5e66a7(0x236)+_0x5a83af[_0x5e66a7(0x28c)]),0x1;throw _0x5a83af;}}async[a37_0x867ae0(0x260)](_0x64228d,_0x54563b){const _0x26e551=a37_0x867ae0,{options:_0x5e709a,tdx:_0x2ca70e}=_0x54563b;let _0x1d3140;try{_0x1d3140=await resolveYamlFilePath(_0x64228d);}catch(_0x4e75f6){throw new SDKError(ErrorCode[_0x26e551(0x225)],_0x26e551(0x20d)+_0x4e75f6[_0x26e551(0x235)]);}_0x5e709a['verbose']&&console[_0x26e551(0x281)]('Resolved:\x20'+_0x1d3140[_0x26e551(0x265)]+'/'+_0x1d3140[_0x26e551(0x273)]);const _0x42b019=await withSpinner('Fetching\x20SQL\x20from\x20rule...',()=>_0x2ca70e[_0x26e551(0x26e)][_0x26e551(0x1f5)](_0x1d3140[_0x26e551(0x214)],_0x1d3140[_0x26e551(0x265)],_0x1d3140[_0x26e551(0x273)]),{'verbose':_0x5e709a[_0x26e551(0x290)]});return _0x42b019[_0x26e551(0x1ef)];}async[a37_0x867ae0(0x1f6)](_0x319d1d,_0x592202){const _0x1ee7fc=a37_0x867ae0,{options:_0x30c945,tdx:_0x47899a}=_0x592202,_0x4b52a2=_0x30c945[_0x1ee7fc(0x265)],_0x5dd2ac=await resolveSegmentTarget(_0x319d1d,_0x4b52a2,_0x30c945[_0x1ee7fc(0x290)]);_0x30c945['verbose']&&console[_0x1ee7fc(0x281)](_0x1ee7fc(0x25f)+_0x5dd2ac);const _0xd9dc26=await withSpinner(_0x1ee7fc(0x26a)+_0x319d1d+_0x1ee7fc(0x21f),()=>_0x47899a[_0x1ee7fc(0x26e)][_0x1ee7fc(0x220)](_0x5dd2ac),{'verbose':_0x30c945[_0x1ee7fc(0x290)]}),_0x39c87a=_0xd9dc26[_0x1ee7fc(0x1ef)];_0x30c945[_0x1ee7fc(0x290)]&&(console[_0x1ee7fc(0x281)](_0x1ee7fc(0x285)+_0x39c87a['type']),console[_0x1ee7fc(0x281)](_0x1ee7fc(0x255)+_0x39c87a[_0x1ee7fc(0x27c)]));if(_0x39c87a['type']===_0x1ee7fc(0x23b))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1ee7fc(0x216));if(_0x39c87a['type']==='parent')throw new SDKError(ErrorCode[_0x1ee7fc(0x225)],'Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql');if(!_0x39c87a[_0x1ee7fc(0x234)])throw new SDKError(ErrorCode[_0x1ee7fc(0x1fb)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x2c973a=await withSpinner(_0x1ee7fc(0x212),()=>_0x47899a[_0x1ee7fc(0x26e)][_0x1ee7fc(0x22a)](_0x39c87a[_0x1ee7fc(0x27c)],_0x39c87a['segmentId']),{'verbose':_0x30c945[_0x1ee7fc(0x290)]});return _0x2c973a[_0x1ee7fc(0x1ef)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x867ae0(0x245)]=a37_0x867ae0(0x256);[a37_0x867ae0(0x263)]=a37_0x867ae0(0x20a);async[a37_0x867ae0(0x22f)](_0x49b26d){const _0x3e3166=a37_0x867ae0,{options:_0x47b694,args:_0x567008,tdx:_0x5e528d}=_0x49b26d,_0x2dff9d=_0x47b694;if(_0x567008[_0x3e3166(0x28b)]<0x2)return console[_0x3e3166(0x281)](_0x3e3166(0x252)),console[_0x3e3166(0x281)](_0x3e3166(0x24f)),0x1;const _0x130183=_0x567008[0x0],_0xb5a0b1=_0x567008[0x1];_0x2dff9d[_0x3e3166(0x290)]&&(console[_0x3e3166(0x281)](_0x3e3166(0x250)+_0x2dff9d[_0x3e3166(0x249)]),console['error']('Parent\x20segment:\x20'+_0x130183),console['error'](_0x3e3166(0x24c)+_0xb5a0b1));let _0xb794bf;if(_0x2dff9d['parentFolder']){const _0x22ed88=_0x2dff9d[_0x3e3166(0x262)],_0x44c5e3=await withSpinner(_0x3e3166(0x25b)+_0x130183+_0x3e3166(0x21f),()=>_0x5e528d[_0x3e3166(0x26e)][_0x3e3166(0x22e)](_0x130183),{'verbose':_0x2dff9d['verbose']}),_0x757c5c=_0x44c5e3['data'],_0x4614bc=await withSpinner(_0x3e3166(0x277)+_0x22ed88+_0x3e3166(0x21f),()=>_0x5e528d[_0x3e3166(0x26e)][_0x3e3166(0x26d)](_0x757c5c,_0x22ed88),{'verbose':_0x2dff9d[_0x3e3166(0x290)]});_0xb794bf=_0x4614bc['data'],_0x2dff9d[_0x3e3166(0x290)]&&console[_0x3e3166(0x281)](_0x3e3166(0x267)+_0xb794bf);}const _0x1994e4={'name':_0xb5a0b1,'description':_0x2dff9d[_0x3e3166(0x263)],'parentFolderId':_0xb794bf},_0x58d7f1=await withSpinner(_0x3e3166(0x271)+_0xb5a0b1+_0x3e3166(0x21f),()=>_0x5e528d['segment']['createFolder'](_0x130183,_0x1994e4),{'verbose':_0x2dff9d[_0x3e3166(0x290)]}),_0x5b6e31=_0x58d7f1[_0x3e3166(0x1ef)];return console[_0x3e3166(0x281)](_0x3e3166(0x207)+_0x5b6e31[_0x3e3166(0x245)]+_0x3e3166(0x208)+_0x5b6e31['id']),await handleSDKOutput([_0x5b6e31],_0x2dff9d),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x867ae0(0x245)]='segment:view';[a37_0x867ae0(0x263)]=a37_0x867ae0(0x200);async[a37_0x867ae0(0x22f)](_0x3ddb5c){const _0x54a649=a37_0x867ae0,{options:_0x1ba757,args:_0x57f97c,tdx:_0xb2b6d0}=_0x3ddb5c,_0x491445=_0x57f97c[0x0];if(!_0x491445)return console[_0x54a649(0x281)](_0x54a649(0x1f9)),console[_0x54a649(0x281)](_0x54a649(0x239)),console[_0x54a649(0x281)](_0x54a649(0x1fe)),console[_0x54a649(0x281)](_0x54a649(0x1f8)),console[_0x54a649(0x281)](_0x54a649(0x1f1)),console['error'](_0x54a649(0x275)),console[_0x54a649(0x281)](_0x54a649(0x257)),console['error'](_0x54a649(0x240)),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console['error'](_0x54a649(0x222)),0x1;try{const _0x5ac86d=_0x1ba757['parentSegment'],_0x26237e=await resolveSegmentTarget(_0x491445,_0x5ac86d,_0x1ba757['verbose']);_0x1ba757['verbose']&&console['error'](_0x54a649(0x25f)+_0x26237e);const _0x4fdb29=await withSpinner(_0x54a649(0x26a)+_0x491445+_0x54a649(0x21f),()=>_0xb2b6d0[_0x54a649(0x26e)][_0x54a649(0x220)](_0x26237e),{'verbose':_0x1ba757['verbose']}),_0xbcaa33=_0x4fdb29[_0x54a649(0x1ef)];_0x1ba757[_0x54a649(0x290)]&&(console[_0x54a649(0x281)]('Resolved\x20type:\x20'+_0xbcaa33[_0x54a649(0x1f4)]),console[_0x54a649(0x281)]('Parent\x20ID:\x20'+_0xbcaa33['parentId']),_0xbcaa33[_0x54a649(0x217)]&&console[_0x54a649(0x281)](_0x54a649(0x1fd)+_0xbcaa33[_0x54a649(0x217)]),_0xbcaa33[_0x54a649(0x234)]&&console[_0x54a649(0x281)](_0x54a649(0x241)+_0xbcaa33[_0x54a649(0x234)]));if(_0x1ba757[_0x54a649(0x219)]){if(_0xbcaa33[_0x54a649(0x1f4)]===_0x54a649(0x23b))return console[_0x54a649(0x281)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0xbcaa33[_0x54a649(0x1f4)]===_0x54a649(0x28f))return console['error'](_0x54a649(0x242)),console[_0x54a649(0x281)]('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0xbcaa33[_0x54a649(0x234)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x54a649(0x246));const _0x3b9749=getConsoleNextUrl(_0x1ba757[_0x54a649(0x249)],_0x54a649(0x221)+_0xbcaa33[_0x54a649(0x27c)]+'/e/'+_0xbcaa33[_0x54a649(0x234)]);return console[_0x54a649(0x281)](a37_0x306a45[_0x54a649(0x26f)]('✔')+_0x54a649(0x1f0)+a37_0x306a45['cyan'](_0x3b9749)),openBrowser(_0x3b9749),0x0;}if(_0xbcaa33[_0x54a649(0x1f4)]===_0x54a649(0x23b)){if(!_0xbcaa33[_0x54a649(0x217)])throw new SDKError(ErrorCode[_0x54a649(0x28e)],_0x54a649(0x247));const _0x331c04=await withSpinner(_0x54a649(0x243),()=>_0xb2b6d0[_0x54a649(0x26e)][_0x54a649(0x201)](_0xbcaa33[_0x54a649(0x217)]),{'verbose':_0x1ba757['verbose']});await handleSingleObjectOutput(_0x331c04['data'],_0x1ba757);}else{if(_0xbcaa33[_0x54a649(0x1f4)]===_0x54a649(0x26e)){if(!_0xbcaa33[_0x54a649(0x234)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x54a649(0x246));const _0x50f8a5=await withSpinner(_0x54a649(0x282),()=>_0xb2b6d0[_0x54a649(0x26e)]['getSegment'](_0xbcaa33[_0x54a649(0x27c)],_0xbcaa33[_0x54a649(0x234)]),{'verbose':_0x1ba757['verbose']}),_0x5bda3a=getConsoleNextUrl(_0x1ba757['site'],_0x54a649(0x221)+_0xbcaa33['parentId']+'/e/'+_0xbcaa33[_0x54a649(0x234)]),_0x369338=_0x50f8a5[_0x54a649(0x1ef)];_0x369338['url']=_0x5bda3a,await handleSingleObjectOutput(_0x369338,_0x1ba757);}else return console['error']('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console[_0x54a649(0x281)](_0x54a649(0x279)),0x1;}return 0x0;}catch(_0x474475){if(_0x474475 instanceof SDKError)return console[_0x54a649(0x281)](_0x54a649(0x280)+_0x474475['message']),_0x474475[_0x54a649(0x28c)]&&console[_0x54a649(0x281)](_0x54a649(0x236)+_0x474475[_0x54a649(0x28c)]),0x1;throw _0x474475;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x867ae0(0x245)]='segment:desc';[a37_0x867ae0(0x263)]=a37_0x867ae0(0x211);async[a37_0x867ae0(0x22f)](_0x2fa761){const _0x145e27=a37_0x867ae0,{options:_0x231219,args:_0xb6733d,tdx:_0x2380a6}=_0x2fa761,_0x1b0638=_0xb6733d[0x0];if(!_0x1b0638)return console[_0x145e27(0x281)](_0x145e27(0x229)),console[_0x145e27(0x281)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x145e27(0x281)](_0x145e27(0x25d)),console[_0x145e27(0x281)](_0x145e27(0x275)),console['error'](_0x145e27(0x25a)),console[_0x145e27(0x281)](_0x145e27(0x283)),0x1;try{const _0x41d7b5=_0x231219['parentSegment'],_0x23ca18=await resolveSegmentTarget(_0x1b0638,_0x41d7b5,_0x231219[_0x145e27(0x290)]);_0x231219[_0x145e27(0x290)]&&console[_0x145e27(0x281)]('Target\x20path:\x20'+_0x23ca18);const _0x1b8c58=await withSpinner('Resolving\x20\x27'+_0x1b0638+_0x145e27(0x21f),()=>_0x2380a6[_0x145e27(0x26e)][_0x145e27(0x220)](_0x23ca18),{'verbose':_0x231219[_0x145e27(0x290)]}),_0x356498=_0x1b8c58[_0x145e27(0x1ef)];_0x231219[_0x145e27(0x290)]&&(console[_0x145e27(0x281)](_0x145e27(0x285)+_0x356498[_0x145e27(0x1f4)]),console[_0x145e27(0x281)](_0x145e27(0x255)+_0x356498[_0x145e27(0x27c)]));if(_0x356498[_0x145e27(0x1f4)]===_0x145e27(0x23b))return console[_0x145e27(0x281)](_0x145e27(0x27b)),console[_0x145e27(0x281)](_0x145e27(0x264)),0x1;if(_0x356498['type']===_0x145e27(0x28f))return console[_0x145e27(0x281)](_0x145e27(0x251)),console[_0x145e27(0x281)](_0x145e27(0x24a)),0x1;if(!_0x356498[_0x145e27(0x234)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x145e27(0x246));const _0x4cbd9f=await withSpinner(_0x145e27(0x212),()=>_0x2380a6[_0x145e27(0x26e)][_0x145e27(0x22a)](_0x356498[_0x145e27(0x27c)],_0x356498[_0x145e27(0x234)]),{'verbose':_0x231219[_0x145e27(0x290)]}),_0x13f9a0=_0x4cbd9f[_0x145e27(0x1ef)],_0x16c0f2=await executeSchemaQuery(_0x13f9a0,_0x2380a6,_0x231219);return await handleQueryOutput(_0x16c0f2,_0x231219),0x0;}catch(_0x4a0da8){if(_0x4a0da8 instanceof SDKError)return console[_0x145e27(0x281)](_0x145e27(0x280)+_0x4a0da8[_0x145e27(0x235)]),_0x4a0da8[_0x145e27(0x28c)]&&console[_0x145e27(0x281)](_0x145e27(0x236)+_0x4a0da8[_0x145e27(0x28c)]),0x1;throw _0x4a0da8;}}}
@@ -1 +1 @@
1
- const a38_0x5932b7=a38_0x2b7c;(function(_0x3991f5,_0x12159e){const _0x626c35=a38_0x2b7c,_0x1c8ee7=_0x3991f5();while(!![]){try{const _0x15d897=parseInt(_0x626c35(0x7e))/0x1*(-parseInt(_0x626c35(0x8d))/0x2)+parseInt(_0x626c35(0x93))/0x3*(parseInt(_0x626c35(0x88))/0x4)+-parseInt(_0x626c35(0x7b))/0x5*(parseInt(_0x626c35(0xa4))/0x6)+-parseInt(_0x626c35(0x80))/0x7*(parseInt(_0x626c35(0x7c))/0x8)+parseInt(_0x626c35(0x79))/0x9*(-parseInt(_0x626c35(0x9b))/0xa)+parseInt(_0x626c35(0x71))/0xb*(parseInt(_0x626c35(0x99))/0xc)+parseInt(_0x626c35(0xa2))/0xd;if(_0x15d897===_0x12159e)break;else _0x1c8ee7['push'](_0x1c8ee7['shift']());}catch(_0x4c1a6b){_0x1c8ee7['push'](_0x1c8ee7['shift']());}}}(a38_0x3823,0x39af4));function a38_0x3823(){const _0x2b235a=['includes','parent','108noYlvS','folder','3343520NvhDis','data','Resolving\x20folder\x20\x27','name','length','type','verbose','14233388PZcCkb','Resolved\x20folder\x20ID:\x20','174olKoke','segment','Creating\x20segment\x20\x27','rule','segmentPath','419518eXXkFp','Parent\x20path:\x20','kind','\x20\x20\x20Path:\x20','✔\x20Created\x20segment\x20\x27','Resolving\x20folder\x20path\x20\x27','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Site:\x20','9tAlEzH','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','4780WRpptX','40asgpHr','createSegment','99581hFHiaa','resolvePathToResource','652659edQOaw','site','Resolved\x20relative\x20path\x20to:\x20','invisible','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','description','ruleFile','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','98972fvPJFV','yellow','folderId','\x27...','error','8GaRxbv','resolveFolderId','Examples:','Target\x20path:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','segment:create','3lyFVeL','execute','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','segments'];a38_0x3823=function(){return _0x2b235a;};return a38_0x3823();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';function a38_0x2b7c(_0x3bf912,_0x2f3c8e){_0x3bf912=_0x3bf912-0x70;const _0x3823d2=a38_0x3823();let _0x2b7c5a=_0x3823d2[_0x3bf912];return _0x2b7c5a;}import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x15c2cf from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x5932b7(0x9e)]=a38_0x5932b7(0x92);['description']='Create\x20child\x20segment\x20with\x20filtering\x20rules';async[a38_0x5932b7(0x94)](_0x45278b){const _0x266861=a38_0x5932b7;console[_0x266861(0x8c)](a38_0x15c2cf[_0x266861(0x89)](_0x266861(0x84))),console[_0x266861(0x8c)](a38_0x15c2cf['yellow'](_0x266861(0x7a)));const {options:_0x3f1c01,args:_0x217276,tdx:_0x284894}=_0x45278b,_0x343c6d=_0x3f1c01;if(_0x217276[_0x266861(0x9f)]===0x0)return console[_0x266861(0x8c)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x266861(0x8c)](_0x266861(0x95)),console[_0x266861(0x8c)](_0x266861(0x8f)),console[_0x266861(0x8c)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console[_0x266861(0x8c)](_0x266861(0x91)),console[_0x266861(0x8c)](_0x266861(0x77)),0x1;const _0x1a971c=_0x217276[0x0],_0x1730fa=_0x3f1c01[_0x266861(0x70)];let _0x1fab29=_0x1a971c;_0x1730fa&&!_0x1a971c[_0x266861(0x97)]('/')&&(_0x1fab29=_0x1730fa+'/'+_0x1a971c,_0x343c6d['verbose']&&console[_0x266861(0x8c)](_0x266861(0x82)+_0x1fab29));const _0x2d93e3=parsePath(_0x1fab29);if(_0x2d93e3['segments'][_0x266861(0x9f)]<0x2)return console[_0x266861(0x8c)]('Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'),console[_0x266861(0x8c)](_0x266861(0x87)),0x1;const _0x3be19d=_0x2d93e3[_0x266861(0x96)][0x0],_0x58a73e=getBaseName(_0x1fab29),_0x5418ff=getParentPath(_0x1fab29);_0x343c6d[_0x266861(0xa1)]&&(console[_0x266861(0x8c)](_0x266861(0x78)+_0x343c6d[_0x266861(0x81)]),console['error'](_0x266861(0x90)+_0x1fab29),console['error']('Parent:\x20'+_0x3be19d),console[_0x266861(0x8c)]('Segment\x20name:\x20'+_0x58a73e),console[_0x266861(0x8c)](_0x266861(0x72)+_0x5418ff));const _0x334514=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3be19d+_0x266861(0x8b),()=>_0x284894[_0x266861(0xa5)]['resolveParentId'](_0x3be19d),{'verbose':_0x343c6d['verbose']}),_0x101731=_0x334514[_0x266861(0x9c)];let _0x515c8a;if(_0x2d93e3['segments'][_0x266861(0x9f)]>0x2){const _0xa3c4e1=await withSpinner(_0x266861(0x76)+_0x5418ff+_0x266861(0x8b),()=>_0x284894[_0x266861(0xa5)][_0x266861(0x7f)](_0x5418ff),{'verbose':_0x343c6d[_0x266861(0xa1)]}),_0x21c212=_0xa3c4e1[_0x266861(0x9c)];if(_0x21c212[_0x266861(0xa0)]!==_0x266861(0x9a)&&_0x21c212[_0x266861(0xa0)]!==_0x266861(0x98))return console['error']('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x515c8a=_0x21c212[_0x266861(0x8a)];}else{if(_0x343c6d['folder']){const _0x44bea4=await withSpinner(_0x266861(0x9d)+_0x343c6d[_0x266861(0x9a)]+'\x27...',()=>_0x284894[_0x266861(0xa5)][_0x266861(0x8e)](_0x101731,_0x343c6d['folder']),{'verbose':_0x343c6d['verbose']});_0x515c8a=_0x44bea4[_0x266861(0x9c)];}}_0x343c6d[_0x266861(0xa1)]&&_0x515c8a&&console[_0x266861(0x8c)](_0x266861(0xa3)+_0x515c8a);const _0x53e6cf=await loadJSONFromOptions(_0x343c6d[_0x266861(0xa7)],_0x343c6d[_0x266861(0x86)]),_0xfcc113={'name':_0x58a73e,'description':_0x343c6d[_0x266861(0x85)],'rule':_0x53e6cf,'kind':_0x343c6d['kind']!==undefined?parseInt(_0x343c6d[_0x266861(0x73)],0xa):undefined,'isVisible':_0x343c6d[_0x266861(0x83)]?![]:undefined,'segmentFolderId':_0x515c8a,'countPopulation':_0x343c6d['noCountPopulation']?![]:undefined},_0x1eca52=await withSpinner(_0x266861(0xa6)+_0x58a73e+_0x266861(0x8b),()=>_0x284894[_0x266861(0xa5)][_0x266861(0x7d)](_0x101731,_0xfcc113),{'verbose':_0x343c6d[_0x266861(0xa1)]}),_0x1f95bf=_0x1eca52[_0x266861(0x9c)];return console[_0x266861(0x8c)](_0x266861(0x75)+_0x1f95bf[_0x266861(0x9e)]+'\x27\x20with\x20ID:\x20'+_0x1f95bf['id']),_0x1fab29!==_0x1a971c&&console[_0x266861(0x8c)](_0x266861(0x74)+_0x1fab29),await handleSDKOutput([_0x1f95bf],_0x343c6d),0x0;}}
1
+ const a38_0x233339=a38_0x5112;(function(_0x411e0e,_0x3e865f){const _0x4414de=a38_0x5112,_0x3af513=_0x411e0e();while(!![]){try{const _0x2d73f3=parseInt(_0x4414de(0x150))/0x1*(-parseInt(_0x4414de(0x15f))/0x2)+-parseInt(_0x4414de(0x163))/0x3+parseInt(_0x4414de(0x17e))/0x4+-parseInt(_0x4414de(0x17c))/0x5*(parseInt(_0x4414de(0x16c))/0x6)+-parseInt(_0x4414de(0x16a))/0x7+parseInt(_0x4414de(0x166))/0x8*(-parseInt(_0x4414de(0x178))/0x9)+parseInt(_0x4414de(0x151))/0xa;if(_0x2d73f3===_0x3e865f)break;else _0x3af513['push'](_0x3af513['shift']());}catch(_0x4f7b1f){_0x3af513['push'](_0x3af513['shift']());}}}(a38_0x4368,0xe3b82));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';function a38_0x4368(){const _0x2bb1ca=['noCountPopulation','\x27\x20with\x20ID:\x20','5031837sMsYXu','segment','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','271496muhlMG','folder','error','ruleFile','6361047zTPspY','type','5169378wJfcli','invisible','✔\x20Created\x20segment\x20\x27','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','resolvePathToResource','yellow','Resolved\x20folder\x20ID:\x20','Resolving\x20folder\x20\x27','segment:create','rule','Resolving\x20folder\x20path\x20\x27','segmentPath','360xncsBf','\x27...','Examples:','kind','5QTJlYY','Resolving\x20parent\x20segment\x20\x27','6659800AExeXZ','segments','resolveFolderId','Parent:\x20','resolveParentId','1083BERPic','45569320mgmlpD','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','Parent\x20path:\x20','data','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','name','\x20\x20\x20Path:\x20','length','Target\x20path:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','Creating\x20segment\x20\x27','description','verbose','894kmpzsU','createSegment'];a38_0x4368=function(){return _0x2bb1ca;};return a38_0x4368();}function a38_0x5112(_0x247cb3,_0x5f4942){_0x247cb3=_0x247cb3-0x14f;const _0x43687a=a38_0x4368();let _0x511270=_0x43687a[_0x247cb3];return _0x511270;}import a38_0x109228 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x233339(0x157)]=a38_0x233339(0x174);['description']='Create\x20child\x20segment\x20with\x20filtering\x20rules';async['execute'](_0xc5a655){const _0x3e6e06=a38_0x233339;console[_0x3e6e06(0x168)](a38_0x109228[_0x3e6e06(0x171)](_0x3e6e06(0x153))),console['error'](a38_0x109228[_0x3e6e06(0x171)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x50e608,args:_0x1b6e5,tdx:_0x3e01a4}=_0xc5a655,_0x36a324=_0x50e608;if(_0x1b6e5['length']===0x0)return console[_0x3e6e06(0x168)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x3e6e06(0x168)]('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console[_0x3e6e06(0x168)](_0x3e6e06(0x17a)),console[_0x3e6e06(0x168)](_0x3e6e06(0x15b)),console[_0x3e6e06(0x168)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console[_0x3e6e06(0x168)](_0x3e6e06(0x156)),0x1;const _0x1702c2=_0x1b6e5[0x0],_0xbaa52e=_0x50e608[_0x3e6e06(0x177)];let _0x32ad56=_0x1702c2;_0xbaa52e&&!_0x1702c2['includes']('/')&&(_0x32ad56=_0xbaa52e+'/'+_0x1702c2,_0x36a324[_0x3e6e06(0x15e)]&&console[_0x3e6e06(0x168)]('Resolved\x20relative\x20path\x20to:\x20'+_0x32ad56));const _0xd31291=parsePath(_0x32ad56);if(_0xd31291[_0x3e6e06(0x17f)]['length']<0x2)return console[_0x3e6e06(0x168)](_0x3e6e06(0x152)),console[_0x3e6e06(0x168)](_0x3e6e06(0x165)),0x1;const _0x2bfe13=_0xd31291[_0x3e6e06(0x17f)][0x0],_0xe4ad26=getBaseName(_0x32ad56),_0x170f99=getParentPath(_0x32ad56);_0x36a324[_0x3e6e06(0x15e)]&&(console[_0x3e6e06(0x168)]('Site:\x20'+_0x36a324['site']),console[_0x3e6e06(0x168)](_0x3e6e06(0x15a)+_0x32ad56),console[_0x3e6e06(0x168)](_0x3e6e06(0x181)+_0x2bfe13),console[_0x3e6e06(0x168)]('Segment\x20name:\x20'+_0xe4ad26),console[_0x3e6e06(0x168)](_0x3e6e06(0x154)+_0x170f99));const _0x17f9f0=await withSpinner(_0x3e6e06(0x17d)+_0x2bfe13+_0x3e6e06(0x179),()=>_0x3e01a4['segment'][_0x3e6e06(0x14f)](_0x2bfe13),{'verbose':_0x36a324[_0x3e6e06(0x15e)]}),_0x3cf6af=_0x17f9f0[_0x3e6e06(0x155)];let _0x3e6759;if(_0xd31291[_0x3e6e06(0x17f)][_0x3e6e06(0x159)]>0x2){const _0x293b47=await withSpinner(_0x3e6e06(0x176)+_0x170f99+_0x3e6e06(0x179),()=>_0x3e01a4['segment'][_0x3e6e06(0x170)](_0x170f99),{'verbose':_0x36a324[_0x3e6e06(0x15e)]}),_0x15eb08=_0x293b47[_0x3e6e06(0x155)];if(_0x15eb08[_0x3e6e06(0x16b)]!=='folder'&&_0x15eb08[_0x3e6e06(0x16b)]!=='parent')return console['error'](_0x3e6e06(0x16f)),0x1;_0x3e6759=_0x15eb08['folderId'];}else{if(_0x36a324[_0x3e6e06(0x167)]){const _0x2abf99=await withSpinner(_0x3e6e06(0x173)+_0x36a324[_0x3e6e06(0x167)]+'\x27...',()=>_0x3e01a4[_0x3e6e06(0x164)][_0x3e6e06(0x180)](_0x3cf6af,_0x36a324[_0x3e6e06(0x167)]),{'verbose':_0x36a324['verbose']});_0x3e6759=_0x2abf99[_0x3e6e06(0x155)];}}_0x36a324[_0x3e6e06(0x15e)]&&_0x3e6759&&console[_0x3e6e06(0x168)](_0x3e6e06(0x172)+_0x3e6759);const _0xa9de32=await loadJSONFromOptions(_0x36a324[_0x3e6e06(0x175)],_0x36a324[_0x3e6e06(0x169)]),_0xf9dd25={'name':_0xe4ad26,'description':_0x36a324[_0x3e6e06(0x15d)],'rule':_0xa9de32,'kind':_0x36a324['kind']!==undefined?parseInt(_0x36a324[_0x3e6e06(0x17b)],0xa):undefined,'isVisible':_0x36a324[_0x3e6e06(0x16d)]?![]:undefined,'segmentFolderId':_0x3e6759,'countPopulation':_0x36a324[_0x3e6e06(0x161)]?![]:undefined},_0x44e5d8=await withSpinner(_0x3e6e06(0x15c)+_0xe4ad26+'\x27...',()=>_0x3e01a4['segment'][_0x3e6e06(0x160)](_0x3cf6af,_0xf9dd25),{'verbose':_0x36a324[_0x3e6e06(0x15e)]}),_0xac2e07=_0x44e5d8['data'];return console[_0x3e6e06(0x168)](_0x3e6e06(0x16e)+_0xac2e07['name']+_0x3e6e06(0x162)+_0xac2e07['id']),_0x32ad56!==_0x1702c2&&console[_0x3e6e06(0x168)](_0x3e6e06(0x158)+_0x32ad56),await handleSDKOutput([_0xac2e07],_0x36a324),0x0;}}
@@ -1 +1 @@
1
- function a39_0x4075(){const _0x3cdc7d=['29590NczXhN','9740gMHxBX','✔\x20Found\x20','length','1434552HLlgVO','2636OdeeYy','715zmRise','data','1899772IEUCNo','Parent\x20segment:\x20','description','Site:\x20','320491PkoaRA','Error:\x20Parent\x20segment\x20name\x20is\x20required','parentSegment','495xXstxU','name','1194UBqRfn','json','1365672VCOlst','List\x20available\x20fields\x20for\x20segmentation','verbose','error','listFields','\x20field','jsonl','Listing\x20fields\x20for\x20\x27','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'];a39_0x4075=function(){return _0x3cdc7d;};return a39_0x4075();}const a39_0x58bbf0=a39_0x2afd;(function(_0x4b171c,_0x481aa9){const _0x37bf05=a39_0x2afd,_0x365280=_0x4b171c();while(!![]){try{const _0x44ec1a=parseInt(_0x37bf05(0xdc))/0x1+parseInt(_0x37bf05(0xd5))/0x2*(parseInt(_0x37bf05(0xe1))/0x3)+parseInt(_0x37bf05(0xd1))/0x4*(parseInt(_0x37bf05(0xd6))/0x5)+-parseInt(_0x37bf05(0xd4))/0x6+-parseInt(_0x37bf05(0xd8))/0x7+-parseInt(_0x37bf05(0xc7))/0x8+-parseInt(_0x37bf05(0xdf))/0x9*(parseInt(_0x37bf05(0xd0))/0xa);if(_0x44ec1a===_0x481aa9)break;else _0x365280['push'](_0x365280['shift']());}catch(_0xb52e93){_0x365280['push'](_0x365280['shift']());}}}(a39_0x4075,0x55486));function a39_0x2afd(_0x190fc3,_0x40e92f){_0x190fc3=_0x190fc3-0xc7;const _0x4075e4=a39_0x4075();let _0x2afdbf=_0x4075e4[_0x190fc3];return _0x2afdbf;}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{[a39_0x58bbf0(0xe0)]='segment:fields';[a39_0x58bbf0(0xda)]=a39_0x58bbf0(0xc8);async['execute'](_0x2df1cb){const _0x7b0015=a39_0x58bbf0,{options:_0x59c584,args:_0x574585,tdx:_0x13d818}=_0x2df1cb,_0x58a6a7=_0x574585[0x0]||_0x59c584[_0x7b0015(0xde)];if(!_0x58a6a7)return console['error'](_0x7b0015(0xdd)),console[_0x7b0015(0xca)](_0x7b0015(0xcf)),console[_0x7b0015(0xca)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;_0x59c584[_0x7b0015(0xc9)]&&(console[_0x7b0015(0xca)](_0x7b0015(0xdb)+_0x59c584['site']),console[_0x7b0015(0xca)](_0x7b0015(0xd9)+_0x58a6a7));const _0x239b04=await withSpinner(_0x7b0015(0xce)+_0x58a6a7+'\x27...',()=>_0x13d818['segment'][_0x7b0015(0xcb)](_0x58a6a7),{'verbose':_0x59c584['verbose']}),_0xeb041f=_0x239b04[_0x7b0015(0xd7)];console[_0x7b0015(0xca)](_0x7b0015(0xd2)+_0xeb041f[_0x7b0015(0xd3)]+_0x7b0015(0xcc)+(_0xeb041f[_0x7b0015(0xd3)]!==0x1?'s':''));if(_0x59c584[_0x7b0015(0xe2)]||_0x59c584[_0x7b0015(0xcd)])return await handleSDKOutput(_0xeb041f,_0x59c584),0x0;return displayFieldsHumanReadable(_0xeb041f,_0x58a6a7),0x0;}}
1
+ const a39_0x5734ed=a39_0xb4a0;(function(_0x181aa2,_0x48b7e6){const _0x42d0b6=a39_0xb4a0,_0x3a2f8d=_0x181aa2();while(!![]){try{const _0x4f3883=-parseInt(_0x42d0b6(0x108))/0x1+-parseInt(_0x42d0b6(0xfa))/0x2*(parseInt(_0x42d0b6(0x100))/0x3)+parseInt(_0x42d0b6(0x107))/0x4*(-parseInt(_0x42d0b6(0xf2))/0x5)+-parseInt(_0x42d0b6(0xfe))/0x6*(parseInt(_0x42d0b6(0xfd))/0x7)+parseInt(_0x42d0b6(0xf7))/0x8+parseInt(_0x42d0b6(0xf6))/0x9*(parseInt(_0x42d0b6(0x109))/0xa)+parseInt(_0x42d0b6(0xef))/0xb;if(_0x4f3883===_0x48b7e6)break;else _0x3a2f8d['push'](_0x3a2f8d['shift']());}catch(_0x2edf42){_0x3a2f8d['push'](_0x3a2f8d['shift']());}}}(a39_0x2f84,0x82634));function a39_0xb4a0(_0x19c528,_0x4e234e){_0x19c528=_0x19c528-0xee;const _0x2f840a=a39_0x2f84();let _0xb4a06d=_0x2f840a[_0x19c528];return _0xb4a06d;}function a39_0x2f84(){const _0x30c795=['data','\x27...','440584rixLVh','424222uFBhBU','10tHbngX','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','listFields','description','Listing\x20fields\x20for\x20\x27','parentSegment','7516113ZJBygq','✔\x20Found\x20','site','25XxaJWm','Error:\x20Parent\x20segment\x20name\x20is\x20required','verbose','List\x20available\x20fields\x20for\x20segmentation','6166548nfPzwi','7910296cJbTsM','name','length','12ctwaus','segment:fields','\x20field','4889528BJfxrZ','6OSPlld','segment','74859fxqVXd','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','error','json','Parent\x20segment:\x20'];a39_0x2f84=function(){return _0x30c795;};return a39_0x2f84();}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{[a39_0x5734ed(0xf8)]=a39_0x5734ed(0xfb);[a39_0x5734ed(0x10c)]=a39_0x5734ed(0xf5);async['execute'](_0x4ef708){const _0x217d15=a39_0x5734ed,{options:_0x32e986,args:_0x18959b,tdx:_0x5307ef}=_0x4ef708,_0x22aa1c=_0x18959b[0x0]||_0x32e986[_0x217d15(0xee)];if(!_0x22aa1c)return console['error'](_0x217d15(0xf3)),console[_0x217d15(0x102)](_0x217d15(0x10a)),console['error'](_0x217d15(0x101)),0x1;_0x32e986[_0x217d15(0xf4)]&&(console[_0x217d15(0x102)]('Site:\x20'+_0x32e986[_0x217d15(0xf1)]),console['error'](_0x217d15(0x104)+_0x22aa1c));const _0x4b95c5=await withSpinner(_0x217d15(0x10d)+_0x22aa1c+_0x217d15(0x106),()=>_0x5307ef[_0x217d15(0xff)][_0x217d15(0x10b)](_0x22aa1c),{'verbose':_0x32e986[_0x217d15(0xf4)]}),_0x1b6bfb=_0x4b95c5[_0x217d15(0x105)];console[_0x217d15(0x102)](_0x217d15(0xf0)+_0x1b6bfb['length']+_0x217d15(0xfc)+(_0x1b6bfb[_0x217d15(0xf9)]!==0x1?'s':''));if(_0x32e986[_0x217d15(0x103)]||_0x32e986['jsonl'])return await handleSDKOutput(_0x1b6bfb,_0x32e986),0x0;return displayFieldsHumanReadable(_0x1b6bfb,_0x22aa1c),0x0;}}