@treasuredata/tdx 2026.4.17 → 2026.4.19

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 (252) 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.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/cas-command.js +1 -1
  13. package/dist/commands/cas-segment-command.js +1 -1
  14. package/dist/commands/chat-command.js +1 -1
  15. package/dist/commands/claude-command.js +1 -1
  16. package/dist/commands/claude-statusline-command.js +1 -1
  17. package/dist/commands/claude-usage-command.js +1 -1
  18. package/dist/commands/command.js +1 -1
  19. package/dist/commands/connection-command.js +1 -1
  20. package/dist/commands/databases.js +1 -1
  21. package/dist/commands/delivery-command.js +1 -1
  22. package/dist/commands/describe.js +1 -1
  23. package/dist/commands/engage-campaign-pull-command.js +1 -1
  24. package/dist/commands/engage-campaign-push-command.js +1 -1
  25. package/dist/commands/engage-campaign-validate-command.js +1 -1
  26. package/dist/commands/engage-command.d.ts +38 -0
  27. package/dist/commands/engage-command.d.ts.map +1 -1
  28. package/dist/commands/engage-command.js +1 -1
  29. package/dist/commands/engage-command.js.map +1 -1
  30. package/dist/commands/engage-template-pull-command.js +1 -1
  31. package/dist/commands/engage-template-push-command.js +1 -1
  32. package/dist/commands/engage-template-validate-command.js +1 -1
  33. package/dist/commands/job-command.js +1 -1
  34. package/dist/commands/journey-command.js +1 -1
  35. package/dist/commands/journey-validate-command.js +1 -1
  36. package/dist/commands/llm-command.js +1 -1
  37. package/dist/commands/mcp-command.js +1 -1
  38. package/dist/commands/parent-segment-command.js +1 -1
  39. package/dist/commands/policy-command.js +1 -1
  40. package/dist/commands/profile-command.js +1 -1
  41. package/dist/commands/profiles-command.js +1 -1
  42. package/dist/commands/query-command.js +1 -1
  43. package/dist/commands/schedule-command.js +1 -1
  44. package/dist/commands/segment-command.js +1 -1
  45. package/dist/commands/segment-create-command.js +1 -1
  46. package/dist/commands/segment-fields-command.js +1 -1
  47. package/dist/commands/segment-pull-command.js +1 -1
  48. package/dist/commands/segment-push-command.js +1 -1
  49. package/dist/commands/segment-update-command.js +1 -1
  50. package/dist/commands/segment-use-command.js +1 -1
  51. package/dist/commands/segment-validate-command.js +1 -1
  52. package/dist/commands/segments.js +1 -1
  53. package/dist/commands/show.js +1 -1
  54. package/dist/commands/status-command.js +1 -1
  55. package/dist/commands/tables.js +1 -1
  56. package/dist/commands/unset-command.js +1 -1
  57. package/dist/commands/upgrade-command.js +1 -1
  58. package/dist/commands/use-command.js +1 -1
  59. package/dist/commands/user-command.js +1 -1
  60. package/dist/commands/work-command.js +1 -1
  61. package/dist/commands/workflow-command.js +1 -1
  62. package/dist/core/auth.js +1 -1
  63. package/dist/core/command-output.js +1 -1
  64. package/dist/core/config.js +1 -1
  65. package/dist/core/connection-cache.js +1 -1
  66. package/dist/core/constants.js +1 -1
  67. package/dist/core/credential-cache.js +1 -1
  68. package/dist/core/global-context.js +1 -1
  69. package/dist/core/keychain.js +1 -1
  70. package/dist/core/oauth-keychain.js +1 -1
  71. package/dist/core/oauth.js +1 -1
  72. package/dist/core/profile.js +1 -1
  73. package/dist/core/project-config.js +1 -1
  74. package/dist/core/session.js +1 -1
  75. package/dist/core/user-cache.js +1 -1
  76. package/dist/core/version.js +1 -1
  77. package/dist/index.js +1 -1
  78. package/dist/mcp/server.js +1 -1
  79. package/dist/mcp/tools/index.js +1 -1
  80. package/dist/mcp/tools/tdx-run.js +1 -1
  81. package/dist/mcp/tools/tdx-search.js +1 -1
  82. package/dist/mcp/tools/work-create-item.js +1 -1
  83. package/dist/mcp/utils.js +1 -1
  84. package/dist/proxy/claude-usage-tracker.js +1 -1
  85. package/dist/proxy/passthrough-server.js +1 -1
  86. package/dist/proxy/sse-usage-parser.js +1 -1
  87. package/dist/sdk/agent/agent-config.js +1 -1
  88. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  89. package/dist/sdk/agent/agent-yaml.js +1 -1
  90. package/dist/sdk/agent/test/evaluator.js +1 -1
  91. package/dist/sdk/agent/test/executor.js +1 -1
  92. package/dist/sdk/agent/test/index.js +1 -1
  93. package/dist/sdk/agent/test/output.js +1 -1
  94. package/dist/sdk/agent/test/parser.js +1 -1
  95. package/dist/sdk/agent/tool-target-registry.js +1 -1
  96. package/dist/sdk/api.js +1 -1
  97. package/dist/sdk/cas/cas-api-client.js +1 -1
  98. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  99. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  100. package/dist/sdk/cas/index.js +1 -1
  101. package/dist/sdk/cas/pull-workflow.js +1 -1
  102. package/dist/sdk/cas/push-workflow.js +1 -1
  103. package/dist/sdk/client/cdp-api-client.js +1 -1
  104. package/dist/sdk/client/delivery-api-client.js +1 -1
  105. package/dist/sdk/client/endpoints.js +1 -1
  106. package/dist/sdk/client/engage-api-client.d.ts +26 -1
  107. package/dist/sdk/client/engage-api-client.d.ts.map +1 -1
  108. package/dist/sdk/client/engage-api-client.js +1 -1
  109. package/dist/sdk/client/engage-api-client.js.map +1 -1
  110. package/dist/sdk/client/http-client.d.ts +1 -1
  111. package/dist/sdk/client/http-client.d.ts.map +1 -1
  112. package/dist/sdk/client/http-client.js +1 -1
  113. package/dist/sdk/client/http-client.js.map +1 -1
  114. package/dist/sdk/client/llm-api-client.js +1 -1
  115. package/dist/sdk/client/oauth-refresh.js +1 -1
  116. package/dist/sdk/client/rate-limiter.js +1 -1
  117. package/dist/sdk/client/td-api-client.js +1 -1
  118. package/dist/sdk/client/trino-api-client.js +1 -1
  119. package/dist/sdk/client/workflow-client.js +1 -1
  120. package/dist/sdk/connection-validator.js +1 -1
  121. package/dist/sdk/connection.js +1 -1
  122. package/dist/sdk/delivery.js +1 -1
  123. package/dist/sdk/engage/campaign-pull.js +1 -1
  124. package/dist/sdk/engage/campaign-push.js +1 -1
  125. package/dist/sdk/engage/campaign-validator.js +1 -1
  126. package/dist/sdk/engage/campaign-validator.js.map +1 -1
  127. package/dist/sdk/engage/campaign-yaml.d.ts +1 -1
  128. package/dist/sdk/engage/campaign-yaml.d.ts.map +1 -1
  129. package/dist/sdk/engage/campaign-yaml.js +1 -1
  130. package/dist/sdk/engage/campaign-yaml.js.map +1 -1
  131. package/dist/sdk/engage/template-pull.js +1 -1
  132. package/dist/sdk/engage/template-push.js +1 -1
  133. package/dist/sdk/engage/template-validator.js +1 -1
  134. package/dist/sdk/engage/template-yaml.js +1 -1
  135. package/dist/sdk/engage/types/campaign-def.d.ts +2 -2
  136. package/dist/sdk/engage/types/campaign-def.d.ts.map +1 -1
  137. package/dist/sdk/engage/types/campaign-def.js +1 -1
  138. package/dist/sdk/engage/types/campaign-def.js.map +1 -1
  139. package/dist/sdk/engage/types/campaign-schema.d.ts +256 -8
  140. package/dist/sdk/engage/types/campaign-schema.d.ts.map +1 -1
  141. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  142. package/dist/sdk/engage/types/campaign-schema.js.map +1 -1
  143. package/dist/sdk/engage/types/template-schema.js +1 -1
  144. package/dist/sdk/engage.d.ts +28 -1
  145. package/dist/sdk/engage.d.ts.map +1 -1
  146. package/dist/sdk/engage.js +1 -1
  147. package/dist/sdk/engage.js.map +1 -1
  148. package/dist/sdk/errors.js +1 -1
  149. package/dist/sdk/index.d.ts +1 -1
  150. package/dist/sdk/index.d.ts.map +1 -1
  151. package/dist/sdk/index.js +1 -1
  152. package/dist/sdk/index.js.map +1 -1
  153. package/dist/sdk/io/index.js +1 -1
  154. package/dist/sdk/io/node-filesystem.js +1 -1
  155. package/dist/sdk/job.js +1 -1
  156. package/dist/sdk/journey.js +1 -1
  157. package/dist/sdk/llm/chat-cache.js +1 -1
  158. package/dist/sdk/llm/index.js +1 -1
  159. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  160. package/dist/sdk/llm/model-factors.js +1 -1
  161. package/dist/sdk/personalization.js +1 -1
  162. package/dist/sdk/policy.js +1 -1
  163. package/dist/sdk/query/index.js +1 -1
  164. package/dist/sdk/query/sql-parser.js +1 -1
  165. package/dist/sdk/realtime.js +1 -1
  166. package/dist/sdk/schedule.js +1 -1
  167. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  168. package/dist/sdk/segment/fields-display.js +1 -1
  169. package/dist/sdk/segment/file-discovery.js +1 -1
  170. package/dist/sdk/segment/journey-utils.js +1 -1
  171. package/dist/sdk/segment/journey-validator.js +1 -1
  172. package/dist/sdk/segment/journey-yaml.js +1 -1
  173. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  174. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  175. package/dist/sdk/segment/pull-workflow.js +1 -1
  176. package/dist/sdk/segment/push-recovery.js +1 -1
  177. package/dist/sdk/segment/push-workflow.js +1 -1
  178. package/dist/sdk/segment/resolution-context.js +1 -1
  179. package/dist/sdk/segment/segment-path-parser.js +1 -1
  180. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  181. package/dist/sdk/segment/segment-validator.js +1 -1
  182. package/dist/sdk/segment/target-resolution.js +1 -1
  183. package/dist/sdk/segment/tdx-config.js +1 -1
  184. package/dist/sdk/segment/types/activation-schema.js +1 -1
  185. package/dist/sdk/segment/types/journey-def.js +1 -1
  186. package/dist/sdk/segment/types/journey-schema.js +1 -1
  187. package/dist/sdk/segment/types/segment-def.js +1 -1
  188. package/dist/sdk/segment/types/segment-schema.js +1 -1
  189. package/dist/sdk/segment/validate-files.js +1 -1
  190. package/dist/sdk/segment/yaml-validator.js +1 -1
  191. package/dist/sdk/segment.js +1 -1
  192. package/dist/sdk/types/engage.d.ts +125 -1
  193. package/dist/sdk/types/engage.d.ts.map +1 -1
  194. package/dist/sdk/types/index.d.ts +1 -1
  195. package/dist/sdk/types/index.d.ts.map +1 -1
  196. package/dist/sdk/types/index.js +1 -1
  197. package/dist/sdk/types/index.js.map +1 -1
  198. package/dist/sdk/types/progress.js +1 -1
  199. package/dist/sdk/types/workspace.js +1 -1
  200. package/dist/sdk/user.js +1 -1
  201. package/dist/sdk/util/format-detector.js +1 -1
  202. package/dist/sdk/util/formatters.js +1 -1
  203. package/dist/sdk/util/index.js +1 -1
  204. package/dist/sdk/util/paginate.js +1 -1
  205. package/dist/sdk/util/tree-formatter.js +1 -1
  206. package/dist/sdk/workflow/archive-validation.js +1 -1
  207. package/dist/sdk/workflow/clone-workflow.js +1 -1
  208. package/dist/sdk/workflow/index.js +1 -1
  209. package/dist/sdk/workflow/pull-workflow.js +1 -1
  210. package/dist/sdk/workflow/push-workflow.js +1 -1
  211. package/dist/sdk/workflow/tdx-config.js +1 -1
  212. package/dist/sdk/workflow/workflow-utils.js +1 -1
  213. package/dist/sdk/workspace/access-tracker.js +1 -1
  214. package/dist/sdk/workspace/frontmatter.js +1 -1
  215. package/dist/sdk/workspace/git.js +1 -1
  216. package/dist/sdk/workspace/index.js +1 -1
  217. package/dist/sdk/workspace/templates.js +1 -1
  218. package/dist/sdk/workspace/weekly.js +1 -1
  219. package/dist/sdk/workspace/wikilinks.js +1 -1
  220. package/dist/test-utils/command-runner.js +1 -1
  221. package/dist/test-utils/factories.js +1 -1
  222. package/dist/test-utils/fixtures.js +1 -1
  223. package/dist/test-utils/http-mock.js +1 -1
  224. package/dist/test-utils/index.js +1 -1
  225. package/dist/utils/async.js +1 -1
  226. package/dist/utils/colors.js +1 -1
  227. package/dist/utils/diff.js +1 -1
  228. package/dist/utils/file-permissions.js +1 -1
  229. package/dist/utils/file-reader.js +1 -1
  230. package/dist/utils/github-releases.js +1 -1
  231. package/dist/utils/global-cache.js +1 -1
  232. package/dist/utils/json-loader.js +1 -1
  233. package/dist/utils/local-cache.js +1 -1
  234. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  235. package/dist/utils/logger/formatters/index.js +1 -1
  236. package/dist/utils/logger/handlers/console-handler.js +1 -1
  237. package/dist/utils/logger/handlers/file-handler.js +1 -1
  238. package/dist/utils/logger/handlers/index.js +1 -1
  239. package/dist/utils/logger/handlers/null-handler.js +1 -1
  240. package/dist/utils/logger/index.js +1 -1
  241. package/dist/utils/logger/logger.js +1 -1
  242. package/dist/utils/logger/types.js +1 -1
  243. package/dist/utils/option-validation.js +1 -1
  244. package/dist/utils/process.js +1 -1
  245. package/dist/utils/prompt.js +1 -1
  246. package/dist/utils/spinner.js +1 -1
  247. package/dist/utils/sse-parser.js +1 -1
  248. package/dist/utils/string-utils.js +1 -1
  249. package/dist/utils/table-ref-parser.js +1 -1
  250. package/dist/utils/tdx-logger.js +1 -1
  251. package/dist/utils/version-check.js +1 -1
  252. package/package.json +17 -2
@@ -1 +1 @@
1
- const a32_0x541acb=a32_0x1363;(function(_0x1f5d50,_0x2e4f96){const _0x1f923c=a32_0x1363,_0x459567=_0x1f5d50();while(!![]){try{const _0x28a236=parseInt(_0x1f923c(0x1b1))/0x1+parseInt(_0x1f923c(0x1a3))/0x2+parseInt(_0x1f923c(0x18a))/0x3+parseInt(_0x1f923c(0x189))/0x4*(parseInt(_0x1f923c(0x1b7))/0x5)+-parseInt(_0x1f923c(0x190))/0x6*(-parseInt(_0x1f923c(0x197))/0x7)+parseInt(_0x1f923c(0x191))/0x8*(-parseInt(_0x1f923c(0x185))/0x9)+-parseInt(_0x1f923c(0x19f))/0xa;if(_0x28a236===_0x2e4f96)break;else _0x459567['push'](_0x459567['shift']());}catch(_0x1695c8){_0x459567['push'](_0x459567['shift']());}}}(a32_0x538a,0xce9e6));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x422702 from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x541acb(0x1a9)]='policy';[a32_0x541acb(0x19b)]='Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions';async[a32_0x541acb(0x19d)](_0x34de54){const _0x2276a2=a32_0x541acb,{options:_0x44f7a8,tdx:_0x5ce73c}=_0x34de54,_0x58892d=await withSpinner(_0x2276a2(0x1b0),async()=>{const _0x3c98dc=_0x2276a2,[_0x95fb23,_0x6f12c]=await Promise[_0x3c98dc(0x1a2)]([_0x5ce73c['user'][_0x3c98dc(0x1a0)](),_0x5ce73c[_0x3c98dc(0x1ac)][_0x3c98dc(0x183)]()]);return{'userInfo':_0x95fb23,'permissions':_0x6f12c};},{'verbose':_0x44f7a8['verbose']}),{userInfo:_0x478212,permissions:_0x579c60}=_0x58892d['data'];if(isStructuredFormat(_0x44f7a8))return await handleSingleObjectOutput(_0x579c60,_0x44f7a8),0x0;const _0x17dfe7=_0x478212[_0x2276a2(0x194)]?_0x2276a2(0x18b):_0x478212[_0x2276a2(0x188)]?_0x2276a2(0x18d):_0x2276a2(0x1b6);console[_0x2276a2(0x1ba)]('\x0a'+a32_0x422702['bold']('👤')+'\x20'+a32_0x422702[_0x2276a2(0x19c)](_0x478212[_0x2276a2(0x1a9)])+'\x20'+a32_0x422702[_0x2276a2(0x1a4)]('('+_0x478212[_0x2276a2(0x184)]+')')+_0x2276a2(0x1b9)+_0x17dfe7),console[_0x2276a2(0x1ba)](a32_0x422702[_0x2276a2(0x1a4)]('\x20\x20\x20'+_0x5ce73c[_0x2276a2(0x18c)][_0x2276a2(0x193)]+':'+_0x478212[_0x2276a2(0x19e)]+_0x2276a2(0x1a6)+_0x478212['id']));const _0x400829=_0x579c60['policies'];console[_0x2276a2(0x1ba)]('\x0a'+a32_0x422702[_0x2276a2(0x19c)](_0x2276a2(0x1b2))+'\x20('+_0x400829[_0x2276a2(0x1ae)]+'):');if(_0x400829[_0x2276a2(0x1ae)]===0x0)console[_0x2276a2(0x1ba)](a32_0x422702[_0x2276a2(0x1a4)]('\x20\x20No\x20policies\x20assigned'));else for(const _0x3590d8 of _0x400829){console[_0x2276a2(0x1ba)](_0x2276a2(0x1af)+_0x3590d8[_0x2276a2(0x1a9)]);}return printPermissionsMap(_0x579c60['permissions']),console[_0x2276a2(0x1ba)](),0x0;}}function a32_0x1363(_0x4d67c2,_0x1c41ce){_0x4d67c2=_0x4d67c2-0x182;const _0x538a21=a32_0x538a();let _0x1363dc=_0x538a21[_0x4d67c2];return _0x1363dc;}function a32_0x538a(){const _0x2a4f97=['Member','215xRpjXQ','🔑\x20Effective\x20Permissions','\x20—\x20','log','verbose','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','getMyPermissions','email','2898OAIzoR','\x20\x20\x20','Fetching\x20policy...','administrator','97676plimxC','3151080ojgwJm','Account\x20Owner','context','Administrator','permissions','✔\x20Found\x20','4866izMPPJ','22288qumUjG','map','site','account_owner','entries','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','12166ebcyLF','args','error','join','description','bold','execute','account_id','42481180JQQsGB','getCurrent','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','all','1772742fPxNJr','dim','\x20user',',\x20user_id:','padEnd','ies','name','max','data','policy','operation','length','\x20\x20•\x20','Fetching\x20permissions...','1595254cbrSVf','📋\x20Assigned\x20Policies','getPolicy','👥\x20Assigned\x20Users','\x20\x20No\x20permissions'];a32_0x538a=function(){return _0x2a4f97;};return a32_0x538a();}export class PolicyListCommand extends BaseCommand{[a32_0x541acb(0x1a9)]='policy\x20list';['description']=a32_0x541acb(0x182);async[a32_0x541acb(0x19d)](_0x2068df){const _0xf4994d=a32_0x541acb,{options:_0x13dd36,tdx:_0x258d1c}=_0x2068df,_0x1170ce=await withSpinner('Listing\x20policies...',()=>_0x258d1c[_0xf4994d(0x1ac)]['listPolicies'](),{'verbose':_0x13dd36[_0xf4994d(0x1bb)]}),_0x31908d=_0x1170ce[_0xf4994d(0x1ab)];console[_0xf4994d(0x199)](_0xf4994d(0x18f)+_0x31908d['length']+'\x20polic'+(_0x31908d[_0xf4994d(0x1ae)]!==0x1?_0xf4994d(0x1a8):'y'));if(isStructuredFormat(_0x13dd36))return await handleSDKOutput(_0x31908d,_0x13dd36),0x0;if(_0x31908d['length']===0x0)console[_0xf4994d(0x1ba)](a32_0x422702[_0xf4994d(0x1a4)]('No\x20policies\x20found'));else for(const _0x7e8a2e of _0x31908d){const _0x59ab7b=_0x7e8a2e[_0xf4994d(0x19b)]?a32_0x422702[_0xf4994d(0x1a4)](_0xf4994d(0x1b9)+_0x7e8a2e['description']):'';console[_0xf4994d(0x1ba)](_0xf4994d(0x1af)+_0x7e8a2e[_0xf4994d(0x1a9)]+_0x59ab7b);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{['name']='policy\x20show';['description']=a32_0x541acb(0x196);['validate'](_0x5a0341){const _0x1b4720=a32_0x541acb;if(_0x5a0341[_0x1b4720(0x198)][_0x1b4720(0x1ae)]===0x0)return _0x1b4720(0x1a1);return undefined;}async[a32_0x541acb(0x19d)](_0x91f031){const _0x1f00ae=a32_0x541acb,{options:_0x2e17fd,tdx:_0x73d253}=_0x91f031,_0x42317c=_0x91f031[_0x1f00ae(0x198)][0x0],_0x562663=await withSpinner(_0x1f00ae(0x187),async()=>{const _0x9221f2=_0x1f00ae,_0x1d2c70=await _0x73d253['policy'][_0x9221f2(0x1b3)](_0x42317c),[_0x2ff317,_0x23fe1a]=await Promise[_0x9221f2(0x1a2)]([_0x73d253[_0x9221f2(0x1ac)]['getPolicyPermissions'](_0x1d2c70['id']),_0x73d253[_0x9221f2(0x1ac)]['getPolicyUsers'](_0x1d2c70['id'])]);return{'policy':_0x1d2c70,'perms':_0x2ff317,'users':_0x23fe1a};},{'verbose':_0x2e17fd[_0x1f00ae(0x1bb)]}),{policy:_0x2b7f2a,perms:_0x12b4cc,users:_0x391931}=_0x562663['data'];if(isStructuredFormat(_0x2e17fd))return await handleSingleObjectOutput({..._0x2b7f2a,'permissions':_0x12b4cc[_0x1f00ae(0x18e)],'users':_0x391931},_0x2e17fd),0x0;console[_0x1f00ae(0x1ba)]('\x0a'+a32_0x422702[_0x1f00ae(0x19c)]('📋')+'\x20'+a32_0x422702['bold'](_0x2b7f2a[_0x1f00ae(0x1a9)])+'\x20'+a32_0x422702[_0x1f00ae(0x1a4)]('(ID:\x20'+_0x2b7f2a['id']+')'));_0x2b7f2a[_0x1f00ae(0x19b)]&&console['log'](_0x1f00ae(0x186)+a32_0x422702['dim'](_0x2b7f2a[_0x1f00ae(0x19b)]));console['log']('\x20\x20\x20'+_0x391931[_0x1f00ae(0x1ae)]+_0x1f00ae(0x1a5)+(_0x391931[_0x1f00ae(0x1ae)]!==0x1?'s':'')+'\x20assigned'),printPermissionsMap(_0x12b4cc['permissions']);if(_0x391931['length']>0x0){console[_0x1f00ae(0x1ba)]('\x0a'+a32_0x422702['bold'](_0x1f00ae(0x1b4))+':');for(const _0x36445c of _0x391931){const _0x50691b=_0x36445c[_0x1f00ae(0x184)]&&_0x36445c[_0x1f00ae(0x184)]!==_0x36445c[_0x1f00ae(0x1a9)]?a32_0x422702[_0x1f00ae(0x1a4)]('\x20<'+_0x36445c[_0x1f00ae(0x184)]+'>'):'';console[_0x1f00ae(0x1ba)]('\x20\x20•\x20'+_0x36445c[_0x1f00ae(0x1a9)]+_0x50691b);}}return console[_0x1f00ae(0x1ba)](),0x0;}}function printPermissionsMap(_0x4e56a8){const _0x19ffa6=a32_0x541acb,_0x3295d8=Object[_0x19ffa6(0x195)](_0x4e56a8);console[_0x19ffa6(0x1ba)]('\x0a'+a32_0x422702[_0x19ffa6(0x19c)](_0x19ffa6(0x1b8))+':');if(_0x3295d8[_0x19ffa6(0x1ae)]===0x0){console['log'](a32_0x422702[_0x19ffa6(0x1a4)](_0x19ffa6(0x1b5)));return;}const _0x1e3972=Math[_0x19ffa6(0x1aa)](..._0x3295d8[_0x19ffa6(0x192)](([_0x9193d])=>_0x9193d[_0x19ffa6(0x1ae)]));for(const [_0x23bd01,_0x5c9d3f]of _0x3295d8){const _0x80828=formatOperations(_0x5c9d3f);console[_0x19ffa6(0x1ba)]('\x20\x20'+_0x23bd01[_0x19ffa6(0x1a7)](_0x1e3972+0x2)+_0x80828);}}function formatOperations(_0x3d7630){const _0x388bb0=a32_0x541acb,_0x25fa57=[...new Set(_0x3d7630[_0x388bb0(0x192)](_0x43de4b=>_0x43de4b[_0x388bb0(0x1ad)]))];return _0x25fa57[_0x388bb0(0x19a)](',\x20');}
1
+ const a32_0x1be438=a32_0x48f5;(function(_0x226105,_0x4bb0bc){const _0x4dcae6=a32_0x48f5,_0x386f6e=_0x226105();while(!![]){try{const _0x246f08=parseInt(_0x4dcae6(0xf3))/0x1*(parseInt(_0x4dcae6(0xe7))/0x2)+parseInt(_0x4dcae6(0x113))/0x3*(-parseInt(_0x4dcae6(0xff))/0x4)+-parseInt(_0x4dcae6(0xd9))/0x5*(-parseInt(_0x4dcae6(0x107))/0x6)+-parseInt(_0x4dcae6(0xf5))/0x7+-parseInt(_0x4dcae6(0xe2))/0x8+-parseInt(_0x4dcae6(0xe4))/0x9*(parseInt(_0x4dcae6(0x10d))/0xa)+parseInt(_0x4dcae6(0xda))/0xb*(parseInt(_0x4dcae6(0x109))/0xc);if(_0x246f08===_0x4bb0bc)break;else _0x386f6e['push'](_0x386f6e['shift']());}catch(_0x434014){_0x386f6e['push'](_0x386f6e['shift']());}}}(a32_0x5f6d,0x8f52a));import{BaseCommand}from'./command.js';function a32_0x48f5(_0x330487,_0xf9683d){_0x330487=_0x330487-0xd7;const _0x5f6db0=a32_0x5f6d();let _0x48f5f6=_0x5f6db0[_0x330487];return _0x48f5f6;}import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x486ef3 from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x1be438(0xfe)]=a32_0x1be438(0xfa);['description']=a32_0x1be438(0xed);async[a32_0x1be438(0xe6)](_0x3c6f70){const _0x4de9f0=a32_0x1be438,{options:_0x3bf6f5,tdx:_0x1e877f}=_0x3c6f70,_0xe03d37=await withSpinner(_0x4de9f0(0xe1),async()=>{const _0x555d15=_0x4de9f0,[_0x29af04,_0x2dcab1]=await Promise[_0x555d15(0x103)]([_0x1e877f[_0x555d15(0xec)][_0x555d15(0x10a)](),_0x1e877f[_0x555d15(0xfa)]['getMyPermissions']()]);return{'userInfo':_0x29af04,'permissions':_0x2dcab1};},{'verbose':_0x3bf6f5['verbose']}),{userInfo:_0xe12987,permissions:_0x3d180d}=_0xe03d37['data'];if(isStructuredFormat(_0x3bf6f5))return await handleSingleObjectOutput(_0x3d180d,_0x3bf6f5),0x0;const _0x4e41de=_0xe12987[_0x4de9f0(0xee)]?_0x4de9f0(0x100):_0xe12987['administrator']?'Administrator':_0x4de9f0(0xe9);console[_0x4de9f0(0xea)]('\x0a'+a32_0x486ef3['bold']('👤')+'\x20'+a32_0x486ef3[_0x4de9f0(0xf4)](_0xe12987['name'])+'\x20'+a32_0x486ef3['dim']('('+_0xe12987['email']+')')+_0x4de9f0(0x108)+_0x4e41de),console[_0x4de9f0(0xea)](a32_0x486ef3[_0x4de9f0(0xdd)](_0x4de9f0(0xdc)+_0x1e877f['context']['site']+':'+_0xe12987[_0x4de9f0(0xfb)]+',\x20user_id:'+_0xe12987['id']));const _0x438ad4=_0x3d180d['policies'];console[_0x4de9f0(0xea)]('\x0a'+a32_0x486ef3[_0x4de9f0(0xf4)](_0x4de9f0(0xfc))+'\x20('+_0x438ad4[_0x4de9f0(0xfd)]+'):');if(_0x438ad4[_0x4de9f0(0xfd)]===0x0)console['log'](a32_0x486ef3[_0x4de9f0(0xdd)](_0x4de9f0(0xde)));else for(const _0x310a0c of _0x438ad4){console[_0x4de9f0(0xea)](_0x4de9f0(0x10f)+_0x310a0c[_0x4de9f0(0xfe)]);}return printPermissionsMap(_0x3d180d[_0x4de9f0(0xf0)]),console[_0x4de9f0(0xea)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x1be438(0xfe)]=a32_0x1be438(0x10c);[a32_0x1be438(0x104)]=a32_0x1be438(0xe0);async[a32_0x1be438(0xe6)](_0x462a13){const _0x5f3cbf=a32_0x1be438,{options:_0x406b74,tdx:_0x5119bd}=_0x462a13,_0x134924=await withSpinner(_0x5f3cbf(0x105),()=>_0x5119bd[_0x5f3cbf(0xfa)][_0x5f3cbf(0x101)](),{'verbose':_0x406b74[_0x5f3cbf(0xe3)]}),_0x54e5b8=_0x134924[_0x5f3cbf(0xd7)];console[_0x5f3cbf(0xe5)](_0x5f3cbf(0xe8)+_0x54e5b8[_0x5f3cbf(0xfd)]+_0x5f3cbf(0xf2)+(_0x54e5b8['length']!==0x1?_0x5f3cbf(0xdb):'y'));if(isStructuredFormat(_0x406b74))return await handleSDKOutput(_0x54e5b8,_0x406b74),0x0;if(_0x54e5b8[_0x5f3cbf(0xfd)]===0x0)console[_0x5f3cbf(0xea)](a32_0x486ef3[_0x5f3cbf(0xdd)](_0x5f3cbf(0x10e)));else for(const _0x5ea608 of _0x54e5b8){const _0x567a50=_0x5ea608[_0x5f3cbf(0x104)]?a32_0x486ef3['dim'](_0x5f3cbf(0x108)+_0x5ea608[_0x5f3cbf(0x104)]):'';console[_0x5f3cbf(0xea)]('\x20\x20•\x20'+_0x5ea608[_0x5f3cbf(0xfe)]+_0x567a50);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{['name']=a32_0x1be438(0x102);[a32_0x1be438(0x104)]=a32_0x1be438(0xeb);[a32_0x1be438(0x110)](_0x1025ee){const _0x140fc3=a32_0x1be438;if(_0x1025ee['args'][_0x140fc3(0xfd)]===0x0)return _0x140fc3(0xf7);return undefined;}async['execute'](_0x2b44cb){const _0x198688=a32_0x1be438,{options:_0x4f6183,tdx:_0x23b4e5}=_0x2b44cb,_0xf2c439=_0x2b44cb[_0x198688(0x112)][0x0],_0x204d1f=await withSpinner(_0x198688(0x114),async()=>{const _0x30c2d7=_0x198688,_0x55daf6=await _0x23b4e5[_0x30c2d7(0xfa)][_0x30c2d7(0xf8)](_0xf2c439),[_0x817241,_0x4b6fe3]=await Promise[_0x30c2d7(0x103)]([_0x23b4e5[_0x30c2d7(0xfa)][_0x30c2d7(0xdf)](_0x55daf6['id']),_0x23b4e5['policy'][_0x30c2d7(0x10b)](_0x55daf6['id'])]);return{'policy':_0x55daf6,'perms':_0x817241,'users':_0x4b6fe3};},{'verbose':_0x4f6183[_0x198688(0xe3)]}),{policy:_0x2198ec,perms:_0x37ff80,users:_0x4df0b5}=_0x204d1f[_0x198688(0xd7)];if(isStructuredFormat(_0x4f6183))return await handleSingleObjectOutput({..._0x2198ec,'permissions':_0x37ff80[_0x198688(0xf0)],'users':_0x4df0b5},_0x4f6183),0x0;console['log']('\x0a'+a32_0x486ef3[_0x198688(0xf4)]('📋')+'\x20'+a32_0x486ef3[_0x198688(0xf4)](_0x2198ec[_0x198688(0xfe)])+'\x20'+a32_0x486ef3[_0x198688(0xdd)]('(ID:\x20'+_0x2198ec['id']+')'));_0x2198ec[_0x198688(0x104)]&&console[_0x198688(0xea)](_0x198688(0xdc)+a32_0x486ef3[_0x198688(0xdd)](_0x2198ec[_0x198688(0x104)]));console[_0x198688(0xea)](_0x198688(0xdc)+_0x4df0b5['length']+_0x198688(0x111)+(_0x4df0b5[_0x198688(0xfd)]!==0x1?'s':'')+'\x20assigned'),printPermissionsMap(_0x37ff80[_0x198688(0xf0)]);if(_0x4df0b5[_0x198688(0xfd)]>0x0){console[_0x198688(0xea)]('\x0a'+a32_0x486ef3[_0x198688(0xf4)]('👥\x20Assigned\x20Users')+':');for(const _0x892e52 of _0x4df0b5){const _0x3f9030=_0x892e52[_0x198688(0xef)]&&_0x892e52[_0x198688(0xef)]!==_0x892e52[_0x198688(0xfe)]?a32_0x486ef3[_0x198688(0xdd)]('\x20<'+_0x892e52['email']+'>'):'';console[_0x198688(0xea)](_0x198688(0x10f)+_0x892e52[_0x198688(0xfe)]+_0x3f9030);}}return console['log'](),0x0;}}function printPermissionsMap(_0x29e9e7){const _0xc99f26=a32_0x1be438,_0x4aa74c=Object[_0xc99f26(0xd8)](_0x29e9e7);console[_0xc99f26(0xea)]('\x0a'+a32_0x486ef3['bold']('🔑\x20Effective\x20Permissions')+':');if(_0x4aa74c[_0xc99f26(0xfd)]===0x0){console[_0xc99f26(0xea)](a32_0x486ef3['dim'](_0xc99f26(0x106)));return;}const _0x1e0ba5=Math[_0xc99f26(0xf6)](..._0x4aa74c[_0xc99f26(0xf9)](([_0xe76f87])=>_0xe76f87[_0xc99f26(0xfd)]));for(const [_0xff262,_0x23c8d5]of _0x4aa74c){const _0x23fec8=formatOperations(_0x23c8d5);console[_0xc99f26(0xea)]('\x20\x20'+_0xff262[_0xc99f26(0xf1)](_0x1e0ba5+0x2)+_0x23fec8);}}function formatOperations(_0xca9172){const _0x1b957e=[...new Set(_0xca9172['map'](_0x84f71e=>_0x84f71e['operation']))];return _0x1b957e['join'](',\x20');}function a32_0x5f6d(){const _0x54faf4=['2951838gMmJlR','\x20—\x20','8977056mRgsUH','getCurrent','getPolicyUsers','policy\x20list','79150FpbKWO','No\x20policies\x20found','\x20\x20•\x20','validate','\x20user','args','786999gfbDKo','Fetching\x20policy...','data','entries','5nQUbQo','11McsaAU','ies','\x20\x20\x20','dim','\x20\x20No\x20policies\x20assigned','getPolicyPermissions','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','Fetching\x20permissions...','1188856YbPjQB','verbose','36wvqvrX','error','execute','19212JbqatZ','✔\x20Found\x20','Member','log','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','user','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','account_owner','email','permissions','padEnd','\x20polic','69IrvuAC','bold','2439913FsNkpN','max','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','getPolicy','map','policy','account_id','📋\x20Assigned\x20Policies','length','name','12YAzPku','Account\x20Owner','listPolicies','policy\x20show','all','description','Listing\x20policies...','\x20\x20No\x20permissions'];a32_0x5f6d=function(){return _0x54faf4;};return a32_0x5f6d();}
@@ -1 +1 @@
1
- const a33_0x56c90b=a33_0x1ac2;(function(_0x231cf5,_0xf15064){const _0x2fea40=a33_0x1ac2,_0x596710=_0x231cf5();while(!![]){try{const _0x3fec33=parseInt(_0x2fea40(0xf7))/0x1+parseInt(_0x2fea40(0xad))/0x2*(parseInt(_0x2fea40(0xe7))/0x3)+-parseInt(_0x2fea40(0xd8))/0x4*(parseInt(_0x2fea40(0xed))/0x5)+parseInt(_0x2fea40(0xd3))/0x6+-parseInt(_0x2fea40(0xe5))/0x7*(parseInt(_0x2fea40(0xe8))/0x8)+-parseInt(_0x2fea40(0xfa))/0x9*(-parseInt(_0x2fea40(0xba))/0xa)+-parseInt(_0x2fea40(0xac))/0xb;if(_0x3fec33===_0xf15064)break;else _0x596710['push'](_0x596710['shift']());}catch(_0x31866b){_0x596710['push'](_0x596710['shift']());}}}(a33_0x4317,0x7b326));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_0x349287 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';function a33_0x4317(){const _0x26e5cd=['profile:use','profile:create','logLevel','apiKey','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','message','Removed\x20existing\x20profile\x20\x27','✗\x20Validation\x20failed:\x20','red','getUserInfo','tdx:\x20profile\x20delete','ERROR','\x0aAvailable\x20profiles:','profile:delete','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>','API\x20key\x20cannot\x20be\x20empty','dim','profile:set','Delete\x20a\x20profile','Unknown\x20key\x20\x27','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','error','Removal\x20cancelled','Session\x20profile\x20set\x20to:\x20','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','site','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','\x27\x20deleted','13002341ysneHx','22UJScgL','email','\x0aSaved\x20to:\x20','password','tdx.json','status','test','\x20Profile\x20\x27','Enter\x20profile\x20name:','skipExistsCheck','\x0aOperation\x20cancelled','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','\x20API\x20key\x20is\x20valid\x20(User:\x20','1050YucKAY','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','join','includes','\x27\x20does\x20not\x20exist.\x20Create\x20it?','Operation\x20cancelled','execute','validate','name','Set\x20session\x20profile','split','profileName','warn','text','confirm','Set\x20a\x20profile\x20configuration\x20value','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','tdx:\x20profile\x20create','Enter\x20your\x20TD\x20API\x20key:','\x27\x20requires\x20API\x20key\x20validation.','VALID_KEYS','\x27\x20does\x20not\x20exist.','\x0aSetup\x20cancelled','\x20API\x20key\x20saved\x20to\x20system\x20keychain','database','5666844YTGjDZ','description','\x20\x20(no\x20profiles\x20found)','Failed\x20to\x20delete\x20profile:\x20','\x20\x20-\x20','1487288sCCkpM','/app/mp/ak','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Create\x20a\x20new\x20profile','bold','trim','session','Profile\x20name\x20cannot\x20be\x20empty','\x27.\x0a\x0aValid\x20keys:\x20','length','Profile\x20\x27','2681NsbDZB','llm_agent','136659rlrKcO','6568HAkBJF','Changing\x20site\x20to\x20\x27','Validating\x20API\x20key...','config','llm_project','10QmFjjD','force','log','profile','(cleared)','You\x20can\x20find\x20your\x20API\x20key\x20at:','jobs','default','\x20\x20tdx\x20--profile\x20','\x27\x20updated:\x20','952780XQpfvF','create','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','29691QvqpeY','(session:\x20','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','green','tdx:\x20profile\x20set','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:'];a33_0x4317=function(){return _0x26e5cd;};return a33_0x4317();}import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a33_0x1a53f5 from'prompts';import a33_0x403773 from'chalk';function validateProfileName(_0x4ace68,_0x4304ef){const _0x505834=a33_0x1ac2;if(!_0x4ace68||!_0x4ace68[_0x505834(0xdf)]())return _0x505834(0xe1);const _0x460b81=_0x4ace68[_0x505834(0xdf)]();if(!/^[a-zA-Z0-9_-]+$/[_0x505834(0xb3)](_0x460b81))return _0x505834(0xaa);if(!_0x4304ef?.[_0x505834(0xb6)]&&profileExists(_0x460b81))return _0x505834(0xe4)+_0x460b81+_0x505834(0xca)+_0x460b81+'\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.';return!![];}async function deleteProfileAndCredentials(_0xe11630){removeProfileFromUserConfig(_0xe11630);const _0x4fd7bf=await isKeychainAvailable();_0x4fd7bf&&await Promise['all']([deleteKeychainAPIKey(_0xe11630),deleteOAuthTokens(_0xe11630)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x56c90b(0xc2)]=a33_0x56c90b(0x101);[a33_0x56c90b(0xd4)]=a33_0x56c90b(0xdd);async['execute'](_0x56721f){const _0x18bc2d=a33_0x56c90b,{options:_0x216ba6,args:_0x19f9bd}=_0x56721f,_0x31a428=!!_0x216ba6[_0x18bc2d(0xee)];console['log'](a33_0x403773[_0x18bc2d(0xde)](_0x18bc2d(0xcb)));let _0x306540;if(_0x19f9bd[_0x18bc2d(0xe3)]>0x0&&_0x19f9bd[0x0]){const _0x123b1c=_0x19f9bd[0x0][_0x18bc2d(0xdf)]();_0x31a428&&profileExists(_0x123b1c)&&(await deleteProfileAndCredentials(_0x123b1c),console[_0x18bc2d(0xef)](_0x18bc2d(0x106)+_0x123b1c+'\x27'));const _0x567128=validateProfileName(_0x123b1c);if(_0x567128!==!![])return console['error'](a33_0x403773['red'](_0x567128)),0x1;_0x306540=_0x123b1c;}else{const _0x2b6a35=await a33_0x1a53f5({'type':_0x18bc2d(0xc7),'name':_0x18bc2d(0xc5),'message':_0x18bc2d(0xb5),'validate':_0x53e74d=>validateProfileName(_0x53e74d,{'skipExistsCheck':_0x31a428})});if(!_0x2b6a35[_0x18bc2d(0xc5)])return console[_0x18bc2d(0xef)](_0x18bc2d(0xd0)),0x1;_0x306540=_0x2b6a35[_0x18bc2d(0xc5)][_0x18bc2d(0xdf)](),_0x31a428&&profileExists(_0x306540)&&(await deleteProfileAndCredentials(_0x306540),console[_0x18bc2d(0xef)](_0x18bc2d(0x106)+_0x306540+'\x27'));}const _0x1390ae=await a33_0x1a53f5({'type':'text','name':_0x18bc2d(0xd4),'message':'Enter\x20description\x20(optional):'}),_0x32be3d=_0x1390ae['description']?.[_0x18bc2d(0xdf)]()||undefined,_0x52bc71=_0x216ba6[_0x18bc2d(0xa9)]||'us01',_0x265744=await promptSiteSelection(_0x52bc71,_0x306540,'Setup\x20cancelled');if(!_0x265744)return 0x1;const _0x425fef=resolveSite(_0x265744),_0x4f65ce=await promptAuthMethod();if(!_0x4f65ce)return console[_0x18bc2d(0xef)](_0x18bc2d(0xd0)),0x1;if(_0x4f65ce==='oauth'){if(_0x32be3d){const _0xfcb3c2={'site':_0x425fef,'description':_0x32be3d};saveProfileToUserConfig(_0x306540,_0xfcb3c2);}const {accountName:_0x4e8c31}=_0x216ba6;return await runOAuthLoginFlow(_0x425fef,_0x306540,_0x216ba6[_0x18bc2d(0x102)]??LogLevel[_0x18bc2d(0x10b)],{'accountName':_0x4e8c31}),0x0;}console[_0x18bc2d(0xef)](_0x18bc2d(0xdb)+_0x425fef),console[_0x18bc2d(0xef)](_0x18bc2d(0xf2)),console[_0x18bc2d(0xef)]('\x20\x20'+getConsoleUrl(_0x425fef,_0x18bc2d(0xd9)));const _0x51c263=await a33_0x1a53f5({'type':_0x18bc2d(0xb0),'name':_0x18bc2d(0x103),'message':_0x18bc2d(0xcc),'validate':_0x3f7a9b=>{const _0x28be57=_0x18bc2d;if(!_0x3f7a9b||!_0x3f7a9b[_0x28be57(0xdf)]())return _0x28be57(0x10f);return!![];}});if(!_0x51c263[_0x18bc2d(0x103)])return console[_0x18bc2d(0xef)]('\x0aSetup\x20cancelled'),0x1;const _0xe85470=_0x51c263[_0x18bc2d(0x103)];console['log'](_0x18bc2d(0xea));try{const _0x513e4d=TDX[_0x18bc2d(0xf8)]({'site':_0x425fef,'apiKey':_0xe85470['trim'](),'logLevel':_0x216ba6[_0x18bc2d(0x102)]??LogLevel[_0x18bc2d(0x10b)]}),_0x5de907=await _0x513e4d[_0x18bc2d(0xf3)][_0x18bc2d(0x109)]();console[_0x18bc2d(0xef)](a33_0x403773['green']('✓')+_0x18bc2d(0xb9)+_0x5de907['email']+')');const _0x481c3f=await isKeychainAvailable();_0x481c3f?(await saveAPIKeyAsync(_0xe85470['trim'](),_0x425fef,_0x306540),console['log'](a33_0x403773['green']('✓')+_0x18bc2d(0xb8)+_0x306540+')')):(console['warn'](a33_0x403773['yellow'](_0x18bc2d(0x114))),console[_0x18bc2d(0xc6)](a33_0x403773['yellow']('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0xe4008={'site':_0x425fef,..._0x32be3d&&{'description':_0x32be3d}};return saveProfileToUserConfig(_0x306540,_0xe4008),console['log'](a33_0x403773[_0x18bc2d(0xfd)]('✓')+_0x18bc2d(0xb4)+_0x306540+'\x27\x20created'),console[_0x18bc2d(0xef)](),console[_0x18bc2d(0xef)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x18bc2d(0xef)](_0x18bc2d(0xf5)+_0x306540+_0x18bc2d(0x118)),console['log'](_0x18bc2d(0xf5)+_0x306540+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x5bcd50){if(_0x5bcd50 instanceof HTTPClientError&&_0x5bcd50['status']===0x191)return printAuthError(_0x5bcd50),0x1;return console[_0x18bc2d(0x115)](a33_0x403773[_0x18bc2d(0x108)](_0x18bc2d(0x107)+(_0x5bcd50 instanceof Error?_0x5bcd50['message']:String(_0x5bcd50)))),console[_0x18bc2d(0x115)](_0x18bc2d(0xdc)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x56c90b(0xc2)]=a33_0x56c90b(0x10d);['description']=a33_0x56c90b(0x112);[a33_0x56c90b(0xc1)](_0x43c56e){const _0x19ce7e=a33_0x56c90b,{args:_0x369ce9}=_0x43c56e;if(_0x369ce9['length']===0x0)return _0x19ce7e(0xf9);return undefined;}async[a33_0x56c90b(0xc0)](_0xaf10e7){const _0x1e401f=a33_0x56c90b,{args:_0x175ba4}=_0xaf10e7,_0x89ce94=_0x175ba4[0x0];console[_0x1e401f(0xef)](a33_0x403773[_0x1e401f(0xde)](_0x1e401f(0x10a)));if(!profileExists(_0x89ce94)){console[_0x1e401f(0x115)](a33_0x403773['red'](_0x1e401f(0xe4)+_0x89ce94+_0x1e401f(0xcf))),console[_0x1e401f(0xef)](_0x1e401f(0x10c));const _0x2fb0d1=listProfiles();if(_0x2fb0d1['length']===0x0)console[_0x1e401f(0xef)]('\x20\x20(no\x20profiles\x20found)');else for(const _0xc8b3a9 of _0x2fb0d1){console[_0x1e401f(0xef)](_0x1e401f(0xd7)+_0xc8b3a9[_0x1e401f(0xc2)]);}return 0x1;}const _0x55cf33=await a33_0x1a53f5({'type':_0x1e401f(0xc8),'name':_0x1e401f(0xc8),'message':_0x1e401f(0xbb)+_0x89ce94+'\x27?','initial':![]});if(!_0x55cf33[_0x1e401f(0xc8)])return console['log'](_0x1e401f(0x116)),0x0;try{await deleteProfileAndCredentials(_0x89ce94),console[_0x1e401f(0xef)](a33_0x403773[_0x1e401f(0xfd)]('✓')+_0x1e401f(0xb4)+_0x89ce94+_0x1e401f(0xab));}catch(_0x4577b6){return console['error'](a33_0x403773[_0x1e401f(0x108)](_0x1e401f(0xd6)+(_0x4577b6 instanceof Error?_0x4577b6[_0x1e401f(0x105)]:String(_0x4577b6)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0x56c90b(0xc2)]=a33_0x56c90b(0x111);['description']=a33_0x56c90b(0xc9);static [a33_0x56c90b(0xce)]=['site',a33_0x56c90b(0xd2),'parent_segment',a33_0x56c90b(0xec),a33_0x56c90b(0xe6),a33_0x56c90b(0xd4)];[a33_0x56c90b(0xc1)](_0x1c74a6){const _0x33672b=a33_0x56c90b,{args:_0x4ce139,options:_0x4c01d0}=_0x1c74a6,_0x595cf5=_0x4c01d0['profile']||getActiveProfile();if(!_0x595cf5)return _0x33672b(0x10e);if(_0x4ce139[_0x33672b(0xe3)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x33672b(0xce)]['join'](',\x20');const _0x33e232=_0x4ce139[0x0];if(!_0x33e232[_0x33672b(0xbd)]('='))return _0x33672b(0xda)+ProfileSetCommand['VALID_KEYS'][_0x33672b(0xbc)](',\x20');const [_0x19c078]=_0x33e232[_0x33672b(0xc4)]('=',0x2);if(!ProfileSetCommand[_0x33672b(0xce)]['includes'](_0x19c078))return _0x33672b(0x113)+_0x19c078+_0x33672b(0xe2)+ProfileSetCommand[_0x33672b(0xce)][_0x33672b(0xbc)](',\x20');return undefined;}async[a33_0x56c90b(0xc0)](_0x236ee4){const _0x2a704f=a33_0x56c90b,{args:_0x281689,options:_0x48c77c}=_0x236ee4,_0x1e0477=_0x48c77c[_0x2a704f(0xf0)]||getActiveProfile(),[_0x29a5c6,..._0x1cf110]=_0x281689[0x0][_0x2a704f(0xc4)]('='),_0x350ded=_0x1cf110['join']('=');console[_0x2a704f(0xef)](a33_0x403773[_0x2a704f(0xde)](_0x2a704f(0xfe)));if(!profileExists(_0x1e0477)){const _0x4f5bb2=await a33_0x1a53f5({'type':_0x2a704f(0xc8),'name':_0x2a704f(0xf8),'message':_0x2a704f(0xe4)+_0x1e0477+_0x2a704f(0xbe),'initial':!![]});if(!_0x4f5bb2['create'])return console[_0x2a704f(0xef)](_0x2a704f(0xbf)),0x1;}const _0x5864d4=loadProfile(_0x1e0477),_0x577f32=_0x5864d4?.[_0x2a704f(0xeb)]||{};if(_0x29a5c6===_0x2a704f(0xa9)){const _0x1cbe87=resolveSite(_0x350ded);console[_0x2a704f(0xef)](_0x2a704f(0xe9)+_0x1cbe87+_0x2a704f(0xcd)),console[_0x2a704f(0xef)](_0x2a704f(0xfc)),console[_0x2a704f(0xef)]('\x20\x20'+getConsoleUrl(_0x1cbe87,_0x2a704f(0xd9)));const _0x17d4f0=await a33_0x1a53f5({'type':_0x2a704f(0xb0),'name':'apiKey','message':_0x2a704f(0xff),'validate':_0x1114c4=>{const _0x4c7ae1=_0x2a704f;if(!_0x1114c4||!_0x1114c4[_0x4c7ae1(0xdf)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x17d4f0[_0x2a704f(0x103)])return console[_0x2a704f(0xef)](_0x2a704f(0xb7)),0x1;console[_0x2a704f(0xef)]('Validating\x20API\x20key...');try{const _0x382b77=TDX[_0x2a704f(0xf8)]({'site':_0x1cbe87,'apiKey':_0x17d4f0[_0x2a704f(0x103)][_0x2a704f(0xdf)](),'logLevel':_0x48c77c[_0x2a704f(0x102)]??LogLevel[_0x2a704f(0x10b)]}),_0x38128c=await _0x382b77[_0x2a704f(0xf3)][_0x2a704f(0x109)]();console[_0x2a704f(0xef)](a33_0x403773[_0x2a704f(0xfd)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x38128c[_0x2a704f(0xae)]+')');const _0x10f7dc=await isKeychainAvailable();_0x10f7dc?(await saveAPIKeyAsync(_0x17d4f0[_0x2a704f(0x103)][_0x2a704f(0xdf)](),_0x1cbe87,_0x1e0477),console[_0x2a704f(0xef)](a33_0x403773['green']('✓')+_0x2a704f(0xd1))):console['warn'](a33_0x403773['yellow'](_0x2a704f(0x114))),_0x577f32['site']=_0x1cbe87;}catch(_0x20aada){if(_0x20aada instanceof HTTPClientError&&_0x20aada[_0x2a704f(0xb2)]===0x191)return printAuthError(_0x20aada),0x1;return console[_0x2a704f(0x115)](a33_0x403773[_0x2a704f(0x108)]('✗\x20Validation\x20failed:\x20'+(_0x20aada instanceof Error?_0x20aada[_0x2a704f(0x105)]:String(_0x20aada)))),console['error']('Site\x20was\x20not\x20changed.'),0x1;}}else _0x577f32[_0x29a5c6]=_0x350ded||undefined;return saveProfileToUserConfig(_0x1e0477,_0x577f32),console[_0x2a704f(0xef)](a33_0x403773[_0x2a704f(0xfd)]('✓')+_0x2a704f(0xb4)+_0x1e0477+_0x2a704f(0xf6)+_0x29a5c6+'='+(_0x350ded||_0x2a704f(0xf1))),0x0;}}function a33_0x1ac2(_0x3dc957,_0x178f67){_0x3dc957=_0x3dc957-0xa9;const _0x43176d=a33_0x4317();let _0x1ac268=_0x43176d[_0x3dc957];return _0x1ac268;}export class ProfileUseCommand extends BaseCommand{[a33_0x56c90b(0xc2)]=a33_0x56c90b(0x100);[a33_0x56c90b(0xd4)]=a33_0x56c90b(0xc3);[a33_0x56c90b(0xc1)](_0x25a927){const _0x20ecc6=a33_0x56c90b,{args:_0x547461}=_0x25a927;if(_0x547461[_0x20ecc6(0xe3)]===0x0)return _0x20ecc6(0x104);return undefined;}async[a33_0x56c90b(0xc0)](_0x8c3964){const _0x1e0e7d=a33_0x56c90b,{args:_0x5c0a74,options:_0x18ee32}=_0x8c3964,_0x2c0331=_0x5c0a74[0x0],_0x1abab9=_0x18ee32[_0x1e0e7d(0xf4)];cleanExpiredSessions();if(!profileExists(_0x2c0331)){console[_0x1e0e7d(0x115)](a33_0x403773['red'](_0x1e0e7d(0xe4)+_0x2c0331+_0x1e0e7d(0xcf))),console['log'](_0x1e0e7d(0x10c));const _0x4da24b=listProfiles();if(_0x4da24b[_0x1e0e7d(0xe3)]===0x0)console[_0x1e0e7d(0xef)](_0x1e0e7d(0xd5));else for(const _0x25851c of _0x4da24b){console[_0x1e0e7d(0xef)](_0x1e0e7d(0xd7)+_0x25851c[_0x1e0e7d(0xc2)]);}return 0x1;}if(_0x1abab9){const _0x36431e=a33_0x349287['join'](getConfigDir(),_0x1e0e7d(0xb1));return saveActiveProfileToUserConfig(_0x2c0331),console[_0x1e0e7d(0xef)]('Default\x20profile\x20set\x20to:\x20'+a33_0x403773[_0x1e0e7d(0xfd)](_0x2c0331)),console[_0x1e0e7d(0xef)](a33_0x403773[_0x1e0e7d(0x110)](_0x1e0e7d(0xaf)+_0x36431e)),0x0;}const _0xd67fa1=getSessionID(_0x18ee32[_0x1e0e7d(0xe0)]);return saveSessionContext({'profile':_0x2c0331},_0x18ee32[_0x1e0e7d(0xe0)]),console[_0x1e0e7d(0xef)](_0x1e0e7d(0x117)+a33_0x403773['green'](_0x2c0331)+'\x20'+a33_0x403773[_0x1e0e7d(0x110)](_0x1e0e7d(0xfb)+_0xd67fa1+')')),console[_0x1e0e7d(0xef)](a33_0x403773[_0x1e0e7d(0x110)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x2c0331+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
1
+ const a33_0x4e75ca=a33_0x5f5a;(function(_0x16b764,_0x23a040){const _0x509014=a33_0x5f5a,_0x5a729a=_0x16b764();while(!![]){try{const _0x71c59d=parseInt(_0x509014(0x17c))/0x1*(-parseInt(_0x509014(0x196))/0x2)+-parseInt(_0x509014(0x172))/0x3+-parseInt(_0x509014(0x15a))/0x4*(-parseInt(_0x509014(0x16b))/0x5)+-parseInt(_0x509014(0x1a0))/0x6*(parseInt(_0x509014(0x14e))/0x7)+-parseInt(_0x509014(0x150))/0x8*(-parseInt(_0x509014(0x18e))/0x9)+-parseInt(_0x509014(0x18d))/0xa+parseInt(_0x509014(0x1ad))/0xb;if(_0x71c59d===_0x23a040)break;else _0x5a729a['push'](_0x5a729a['shift']());}catch(_0x1f9d21){_0x5a729a['push'](_0x5a729a['shift']());}}}(a33_0x4bfd,0x86742));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_0x17aa31 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';function a33_0x5f5a(_0x2cdde0,_0x48996e){_0x2cdde0=_0x2cdde0-0x14b;const _0x4bfdd1=a33_0x4bfd();let _0x5f5a3c=_0x4bfdd1[_0x2cdde0];return _0x5f5a3c;}import{LogLevel}from'../utils/tdx-logger.js';import a33_0x23f807 from'prompts';import a33_0x9312c7 from'chalk';function a33_0x4bfd(){const _0x4417e5=['oauth','\x27\x20does\x20not\x20exist.\x20Create\x20it?','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','all','green','(cleared)','Default\x20profile\x20set\x20to:\x20','split','llm_project','jobs','\x27.\x0a\x0aValid\x20keys:\x20','apiKey','Set\x20session\x20profile','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','\x20API\x20key\x20is\x20valid\x20(User:\x20','4873190MJNbMd','1155780WIitoU','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','dim','profile:create','\x0aOperation\x20cancelled','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','warn','red','6KZfwnB','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','Enter\x20profile\x20name:','includes','Operation\x20cancelled','/app/mp/ak','profileName','\x27\x20deleted','validate','4493226dlvlVJ','\x0aAvailable\x20profiles:','bold','\x20Profile\x20\x27','email','profile:delete','site','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','profile:set','Changing\x20site\x20to\x20\x27','tdx:\x20profile\x20delete','skipExistsCheck','34408462eYHNhh','trim','text','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','profile:use','default','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','message','logLevel','force','getUserInfo','yellow','7ScKJzj','llm_agent','8tyknIV','\x20\x20-\x20','join','Setup\x20cancelled','length','Profile\x20\x27','tdx.json','ERROR','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','Site\x20was\x20not\x20changed.','4IDAiSS','\x0aSaved\x20to:\x20','Enter\x20description\x20(optional):','\x0aSetup\x20cancelled','\x20\x20(no\x20profiles\x20found)','\x20--default\x27\x20to\x20save\x20permanently','status','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>','name','✗\x20Validation\x20failed:\x20','create','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','error','\x27\x20updated:\x20','\x27\x20does\x20not\x20exist.','API\x20key\x20cannot\x20be\x20empty','Validating\x20API\x20key...','697505JFcyUh','description','Create\x20a\x20new\x20profile','confirm','tdx:\x20profile\x20set','\x20\x20tdx\x20--profile\x20','profile','2853660oyyXhp','VALID_KEYS','Set\x20a\x20profile\x20configuration\x20value','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','Session\x20profile\x20set\x20to:\x20','config','Removed\x20existing\x20profile\x20\x27','execute','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','log','219277OhvRnq','(session:\x20'];a33_0x4bfd=function(){return _0x4417e5;};return a33_0x4bfd();}function validateProfileName(_0xe1b7f1,_0x260515){const _0x53035d=a33_0x5f5a;if(!_0xe1b7f1||!_0xe1b7f1[_0x53035d(0x1ae)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x4bbb5f=_0xe1b7f1[_0x53035d(0x1ae)]();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x4bbb5f))return _0x53035d(0x198);if(!_0x260515?.[_0x53035d(0x1ac)]&&profileExists(_0x4bbb5f))return _0x53035d(0x155)+_0x4bbb5f+_0x53035d(0x197)+_0x4bbb5f+_0x53035d(0x18b);return!![];}async function deleteProfileAndCredentials(_0x24f553){const _0x1a2964=a33_0x5f5a;removeProfileFromUserConfig(_0x24f553);const _0x3bf940=await isKeychainAvailable();_0x3bf940&&await Promise[_0x1a2964(0x181)]([deleteKeychainAPIKey(_0x24f553),deleteOAuthTokens(_0x24f553)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x4e75ca(0x162)]=a33_0x4e75ca(0x191);[a33_0x4e75ca(0x16c)]=a33_0x4e75ca(0x16d);async[a33_0x4e75ca(0x179)](_0x259b7f){const _0xd36324=a33_0x4e75ca,{options:_0x1cfdeb,args:_0x1d9dba}=_0x259b7f,_0x4dd031=!!_0x1cfdeb[_0xd36324(0x14b)];console[_0xd36324(0x17b)](a33_0x9312c7[_0xd36324(0x1a2)]('tdx:\x20profile\x20create'));let _0x3571a5;if(_0x1d9dba[_0xd36324(0x154)]>0x0&&_0x1d9dba[0x0]){const _0x5949c5=_0x1d9dba[0x0]['trim']();_0x4dd031&&profileExists(_0x5949c5)&&(await deleteProfileAndCredentials(_0x5949c5),console[_0xd36324(0x17b)](_0xd36324(0x178)+_0x5949c5+'\x27'));const _0x4f26c4=validateProfileName(_0x5949c5);if(_0x4f26c4!==!![])return console[_0xd36324(0x166)](a33_0x9312c7['red'](_0x4f26c4)),0x1;_0x3571a5=_0x5949c5;}else{const _0x119510=await a33_0x23f807({'type':_0xd36324(0x1af),'name':_0xd36324(0x19d),'message':_0xd36324(0x199),'validate':_0xb8428f=>validateProfileName(_0xb8428f,{'skipExistsCheck':_0x4dd031})});if(!_0x119510[_0xd36324(0x19d)])return console[_0xd36324(0x17b)](_0xd36324(0x15d)),0x1;_0x3571a5=_0x119510[_0xd36324(0x19d)][_0xd36324(0x1ae)](),_0x4dd031&&profileExists(_0x3571a5)&&(await deleteProfileAndCredentials(_0x3571a5),console[_0xd36324(0x17b)](_0xd36324(0x178)+_0x3571a5+'\x27'));}const _0x1d5ddb=await a33_0x23f807({'type':_0xd36324(0x1af),'name':_0xd36324(0x16c),'message':_0xd36324(0x15c)}),_0xe84237=_0x1d5ddb[_0xd36324(0x16c)]?.[_0xd36324(0x1ae)]()||undefined,_0x57764a=_0x1cfdeb[_0xd36324(0x1a6)]||'us01',_0x3ebabb=await promptSiteSelection(_0x57764a,_0x3571a5,_0xd36324(0x153));if(!_0x3ebabb)return 0x1;const _0x584a1a=resolveSite(_0x3ebabb),_0x43865f=await promptAuthMethod();if(!_0x43865f)return console[_0xd36324(0x17b)](_0xd36324(0x15d)),0x1;if(_0x43865f===_0xd36324(0x17e)){if(_0xe84237){const _0x37e9df={'site':_0x584a1a,'description':_0xe84237};saveProfileToUserConfig(_0x3571a5,_0x37e9df);}const {accountName:_0x269048}=_0x1cfdeb;return await runOAuthLoginFlow(_0x584a1a,_0x3571a5,_0x1cfdeb['logLevel']??LogLevel[_0xd36324(0x157)],{'accountName':_0x269048}),0x0;}console[_0xd36324(0x17b)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x584a1a),console[_0xd36324(0x17b)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0xd36324(0x17b)]('\x20\x20'+getConsoleUrl(_0x584a1a,_0xd36324(0x19c)));const _0xd8f762=await a33_0x23f807({'type':'password','name':_0xd36324(0x189),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x5b7ec2=>{const _0xfb87a6=_0xd36324;if(!_0x5b7ec2||!_0x5b7ec2['trim']())return _0xfb87a6(0x169);return!![];}});if(!_0xd8f762[_0xd36324(0x189)])return console[_0xd36324(0x17b)]('\x0aSetup\x20cancelled'),0x1;const _0x1804a2=_0xd8f762[_0xd36324(0x189)];console[_0xd36324(0x17b)](_0xd36324(0x16a));try{const _0x149c8c=TDX[_0xd36324(0x164)]({'site':_0x584a1a,'apiKey':_0x1804a2[_0xd36324(0x1ae)](),'logLevel':_0x1cfdeb[_0xd36324(0x1b5)]??LogLevel[_0xd36324(0x157)]}),_0x53e02d=await _0x149c8c[_0xd36324(0x187)][_0xd36324(0x14c)]();console[_0xd36324(0x17b)](a33_0x9312c7['green']('✓')+_0xd36324(0x18c)+_0x53e02d[_0xd36324(0x1a4)]+')');const _0x1383ed=await isKeychainAvailable();_0x1383ed?(await saveAPIKeyAsync(_0x1804a2[_0xd36324(0x1ae)](),_0x584a1a,_0x3571a5),console[_0xd36324(0x17b)](a33_0x9312c7[_0xd36324(0x182)]('✓')+_0xd36324(0x193)+_0x3571a5+')')):(console['warn'](a33_0x9312c7[_0xd36324(0x14d)](_0xd36324(0x1a7))),console[_0xd36324(0x194)](a33_0x9312c7[_0xd36324(0x14d)](_0xd36324(0x158))));const _0x11d610={'site':_0x584a1a,..._0xe84237&&{'description':_0xe84237}};return saveProfileToUserConfig(_0x3571a5,_0x11d610),console[_0xd36324(0x17b)](a33_0x9312c7[_0xd36324(0x182)]('✓')+_0xd36324(0x1a3)+_0x3571a5+'\x27\x20created'),console['log'](),console['log'](_0xd36324(0x1b0)),console[_0xd36324(0x17b)](_0xd36324(0x170)+_0x3571a5+_0xd36324(0x17a)),console[_0xd36324(0x17b)](_0xd36324(0x170)+_0x3571a5+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x5efbf8){if(_0x5efbf8 instanceof HTTPClientError&&_0x5efbf8['status']===0x191)return printAuthError(_0x5efbf8),0x1;return console[_0xd36324(0x166)](a33_0x9312c7[_0xd36324(0x195)]('✗\x20Validation\x20failed:\x20'+(_0x5efbf8 instanceof Error?_0x5efbf8[_0xd36324(0x1b4)]:String(_0x5efbf8)))),console[_0xd36324(0x166)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{['name']=a33_0x4e75ca(0x1a5);[a33_0x4e75ca(0x16c)]='Delete\x20a\x20profile';[a33_0x4e75ca(0x19f)](_0x4941b2){const _0x3142c6=a33_0x4e75ca,{args:_0x3cfa17}=_0x4941b2;if(_0x3cfa17[_0x3142c6(0x154)]===0x0)return _0x3142c6(0x165);return undefined;}async[a33_0x4e75ca(0x179)](_0x391e05){const _0x5b408f=a33_0x4e75ca,{args:_0x4aef61}=_0x391e05,_0x8c0901=_0x4aef61[0x0];console[_0x5b408f(0x17b)](a33_0x9312c7[_0x5b408f(0x1a2)](_0x5b408f(0x1ab)));if(!profileExists(_0x8c0901)){console[_0x5b408f(0x166)](a33_0x9312c7[_0x5b408f(0x195)](_0x5b408f(0x155)+_0x8c0901+_0x5b408f(0x168))),console[_0x5b408f(0x17b)]('\x0aAvailable\x20profiles:');const _0x491861=listProfiles();if(_0x491861[_0x5b408f(0x154)]===0x0)console[_0x5b408f(0x17b)]('\x20\x20(no\x20profiles\x20found)');else for(const _0xfd0547 of _0x491861){console[_0x5b408f(0x17b)](_0x5b408f(0x151)+_0xfd0547[_0x5b408f(0x162)]);}return 0x1;}const _0x59183b=await a33_0x23f807({'type':'confirm','name':_0x5b408f(0x16e),'message':_0x5b408f(0x175)+_0x8c0901+'\x27?','initial':![]});if(!_0x59183b['confirm'])return console[_0x5b408f(0x17b)]('Removal\x20cancelled'),0x0;try{await deleteProfileAndCredentials(_0x8c0901),console[_0x5b408f(0x17b)](a33_0x9312c7['green']('✓')+'\x20Profile\x20\x27'+_0x8c0901+_0x5b408f(0x19e));}catch(_0x188878){return console[_0x5b408f(0x166)](a33_0x9312c7[_0x5b408f(0x195)]('Failed\x20to\x20delete\x20profile:\x20'+(_0x188878 instanceof Error?_0x188878['message']:String(_0x188878)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0x4e75ca(0x162)]=a33_0x4e75ca(0x1a9);[a33_0x4e75ca(0x16c)]=a33_0x4e75ca(0x174);static [a33_0x4e75ca(0x173)]=[a33_0x4e75ca(0x1a6),'database','parent_segment',a33_0x4e75ca(0x186),a33_0x4e75ca(0x14f),a33_0x4e75ca(0x16c)];['validate'](_0x51ceec){const _0x324b4e=a33_0x4e75ca,{args:_0x282e4c,options:_0x1aea3e}=_0x51ceec,_0x5b77bb=_0x1aea3e[_0x324b4e(0x171)]||getActiveProfile();if(!_0x5b77bb)return _0x324b4e(0x161);if(_0x282e4c[_0x324b4e(0x154)]===0x0)return _0x324b4e(0x1b3)+ProfileSetCommand[_0x324b4e(0x173)]['join'](',\x20');const _0x51c037=_0x282e4c[0x0];if(!_0x51c037[_0x324b4e(0x19a)]('='))return _0x324b4e(0x18f)+ProfileSetCommand[_0x324b4e(0x173)][_0x324b4e(0x152)](',\x20');const [_0x321dbb]=_0x51c037[_0x324b4e(0x185)]('=',0x2);if(!ProfileSetCommand[_0x324b4e(0x173)][_0x324b4e(0x19a)](_0x321dbb))return'Unknown\x20key\x20\x27'+_0x321dbb+_0x324b4e(0x188)+ProfileSetCommand[_0x324b4e(0x173)]['join'](',\x20');return undefined;}async[a33_0x4e75ca(0x179)](_0x12572f){const _0x59a67c=a33_0x4e75ca,{args:_0x424fe9,options:_0x2a049f}=_0x12572f,_0x1ebc75=_0x2a049f[_0x59a67c(0x171)]||getActiveProfile(),[_0xa59440,..._0x10fc23]=_0x424fe9[0x0][_0x59a67c(0x185)]('='),_0x43518d=_0x10fc23[_0x59a67c(0x152)]('=');console[_0x59a67c(0x17b)](a33_0x9312c7[_0x59a67c(0x1a2)](_0x59a67c(0x16f)));if(!profileExists(_0x1ebc75)){const _0x86c98a=await a33_0x23f807({'type':'confirm','name':'create','message':_0x59a67c(0x155)+_0x1ebc75+_0x59a67c(0x17f),'initial':!![]});if(!_0x86c98a['create'])return console[_0x59a67c(0x17b)](_0x59a67c(0x19b)),0x1;}const _0x404bba=loadProfile(_0x1ebc75),_0x137562=_0x404bba?.[_0x59a67c(0x177)]||{};if(_0xa59440===_0x59a67c(0x1a6)){const _0x221f45=resolveSite(_0x43518d);console[_0x59a67c(0x17b)](_0x59a67c(0x1aa)+_0x221f45+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x59a67c(0x17b)](_0x59a67c(0x1a8)),console[_0x59a67c(0x17b)]('\x20\x20'+getConsoleUrl(_0x221f45,_0x59a67c(0x19c)));const _0x3d6267=await a33_0x23f807({'type':'password','name':_0x59a67c(0x189),'message':_0x59a67c(0x180),'validate':_0x13d565=>{const _0x3b7f73=_0x59a67c;if(!_0x13d565||!_0x13d565[_0x3b7f73(0x1ae)]())return _0x3b7f73(0x169);return!![];}});if(!_0x3d6267[_0x59a67c(0x189)])return console['log'](_0x59a67c(0x192)),0x1;console['log'](_0x59a67c(0x16a));try{const _0x38cbd3=TDX[_0x59a67c(0x164)]({'site':_0x221f45,'apiKey':_0x3d6267[_0x59a67c(0x189)][_0x59a67c(0x1ae)](),'logLevel':_0x2a049f[_0x59a67c(0x1b5)]??LogLevel['ERROR']}),_0x5a3c99=await _0x38cbd3['jobs'][_0x59a67c(0x14c)]();console[_0x59a67c(0x17b)](a33_0x9312c7[_0x59a67c(0x182)]('✓')+_0x59a67c(0x18c)+_0x5a3c99['email']+')');const _0x34f6bb=await isKeychainAvailable();_0x34f6bb?(await saveAPIKeyAsync(_0x3d6267['apiKey'][_0x59a67c(0x1ae)](),_0x221f45,_0x1ebc75),console[_0x59a67c(0x17b)](a33_0x9312c7[_0x59a67c(0x182)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x59a67c(0x194)](a33_0x9312c7['yellow'](_0x59a67c(0x1a7))),_0x137562[_0x59a67c(0x1a6)]=_0x221f45;}catch(_0x42a159){if(_0x42a159 instanceof HTTPClientError&&_0x42a159[_0x59a67c(0x160)]===0x191)return printAuthError(_0x42a159),0x1;return console[_0x59a67c(0x166)](a33_0x9312c7[_0x59a67c(0x195)](_0x59a67c(0x163)+(_0x42a159 instanceof Error?_0x42a159['message']:String(_0x42a159)))),console[_0x59a67c(0x166)](_0x59a67c(0x159)),0x1;}}else _0x137562[_0xa59440]=_0x43518d||undefined;return saveProfileToUserConfig(_0x1ebc75,_0x137562),console[_0x59a67c(0x17b)](a33_0x9312c7[_0x59a67c(0x182)]('✓')+_0x59a67c(0x1a3)+_0x1ebc75+_0x59a67c(0x167)+_0xa59440+'='+(_0x43518d||_0x59a67c(0x183))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x4e75ca(0x162)]=a33_0x4e75ca(0x1b1);['description']=a33_0x4e75ca(0x18a);[a33_0x4e75ca(0x19f)](_0x48f73e){const {args:_0x48cd41}=_0x48f73e;if(_0x48cd41['length']===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a33_0x4e75ca(0x179)](_0x3aec0d){const _0x117cb9=a33_0x4e75ca,{args:_0x322c90,options:_0x544923}=_0x3aec0d,_0x16aa36=_0x322c90[0x0],_0x4082dd=_0x544923[_0x117cb9(0x1b2)];cleanExpiredSessions();if(!profileExists(_0x16aa36)){console[_0x117cb9(0x166)](a33_0x9312c7[_0x117cb9(0x195)](_0x117cb9(0x155)+_0x16aa36+'\x27\x20does\x20not\x20exist.')),console[_0x117cb9(0x17b)](_0x117cb9(0x1a1));const _0x4cdb28=listProfiles();if(_0x4cdb28[_0x117cb9(0x154)]===0x0)console['log'](_0x117cb9(0x15e));else for(const _0x2de0b9 of _0x4cdb28){console['log'](_0x117cb9(0x151)+_0x2de0b9[_0x117cb9(0x162)]);}return 0x1;}if(_0x4082dd){const _0x56461b=a33_0x17aa31[_0x117cb9(0x152)](getConfigDir(),_0x117cb9(0x156));return saveActiveProfileToUserConfig(_0x16aa36),console['log'](_0x117cb9(0x184)+a33_0x9312c7[_0x117cb9(0x182)](_0x16aa36)),console['log'](a33_0x9312c7[_0x117cb9(0x190)](_0x117cb9(0x15b)+_0x56461b)),0x0;}const _0x282cba=getSessionID(_0x544923['session']);return saveSessionContext({'profile':_0x16aa36},_0x544923['session']),console['log'](_0x117cb9(0x176)+a33_0x9312c7[_0x117cb9(0x182)](_0x16aa36)+'\x20'+a33_0x9312c7[_0x117cb9(0x190)](_0x117cb9(0x17d)+_0x282cba+')')),console[_0x117cb9(0x17b)](a33_0x9312c7[_0x117cb9(0x190)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x16aa36+_0x117cb9(0x15f))),0x0;}}
@@ -1 +1 @@
1
- const a34_0x3000da=a34_0x533f;function a34_0x533f(_0x18a832,_0x9b9afa){_0x18a832=_0x18a832-0xb6;const _0x5aaaf9=a34_0x5aaa();let _0x533fda=_0x5aaaf9[_0x18a832];return _0x533fda;}(function(_0x1a4ff8,_0x2a9ebd){const _0x2e130e=a34_0x533f,_0x185ff3=_0x1a4ff8();while(!![]){try{const _0x3938b3=parseInt(_0x2e130e(0xc9))/0x1*(-parseInt(_0x2e130e(0xbf))/0x2)+parseInt(_0x2e130e(0xc8))/0x3*(-parseInt(_0x2e130e(0xc0))/0x4)+-parseInt(_0x2e130e(0xc6))/0x5+parseInt(_0x2e130e(0xbc))/0x6+parseInt(_0x2e130e(0xbb))/0x7+parseInt(_0x2e130e(0xcf))/0x8*(parseInt(_0x2e130e(0xbd))/0x9)+parseInt(_0x2e130e(0xba))/0xa;if(_0x3938b3===_0x2a9ebd)break;else _0x185ff3['push'](_0x185ff3['shift']());}catch(_0x48d117){_0x185ff3['push'](_0x185ff3['shift']());}}}(a34_0x5aaa,0xd8e85));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x2644a8 from'chalk';export class ProfilesCommand extends BaseCommand{['name']='profiles';['description']=a34_0x3000da(0xcd);async[a34_0x3000da(0xb9)](_0x150fb8){const _0x556a13=a34_0x3000da,{options:_0x1f189b}=_0x150fb8;try{const _0x17a10b=listProfiles(),_0x1c4c16=getActiveProfile();if(_0x17a10b[_0x556a13(0xb6)]===0x0)return console[_0x556a13(0xcb)](_0x556a13(0xb8)),console[_0x556a13(0xcb)](_0x556a13(0xca)),console[_0x556a13(0xcb)](_0x556a13(0xb7)),0x0;const _0x35a29e=_0x17a10b['map'](_0x5ded4f=>{const _0x5a0b66=_0x556a13,_0x5bc25a=_0x5ded4f['name']===_0x1c4c16,_0x13467a=getProfileParams(_0x5ded4f[_0x5a0b66(0xd0)]);return{'name':_0x5ded4f['name'],'active':_0x5bc25a,'scope':_0x5ded4f[_0x5a0b66(0xc2)],'description':_0x5ded4f[_0x5a0b66(0xd0)][_0x5a0b66(0xbe)]||'','params':_0x13467a};});if(isStructuredFormat(_0x1f189b))await handleSDKOutput(_0x35a29e,_0x1f189b);else for(const _0x507a8f of _0x17a10b){const _0x1469a1=_0x507a8f[_0x556a13(0xc1)]===_0x1c4c16?a34_0x2644a8['green']('\x20✓'):'',_0x75dcdd=_0x507a8f[_0x556a13(0xd0)][_0x556a13(0xce)]?a34_0x2644a8[_0x556a13(0xc7)]('\x20'+_0x507a8f[_0x556a13(0xd0)][_0x556a13(0xce)]):'',_0x22bc8f=_0x507a8f['config'][_0x556a13(0xbe)]?a34_0x2644a8[_0x556a13(0xc7)]('\x20\x20'+_0x507a8f[_0x556a13(0xd0)][_0x556a13(0xbe)]):'';console[_0x556a13(0xcb)](_0x556a13(0xc5)+_0x507a8f['name']+_0x1469a1+_0x75dcdd+_0x22bc8f);}return 0x0;}catch(_0x38b5f3){return _0x38b5f3 instanceof Error&&console[_0x556a13(0xcc)](_0x556a13(0xc3)+_0x38b5f3[_0x556a13(0xc4)]),0x1;}}}function a34_0x5aaa(){const _0x44bf9=['\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','log','error','List\x20all\x20available\x20profiles','site','8148664krUkqM','config','length','\x20\x20Global:\x20~/.config/tdx/tdx.json','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','execute','3571710MFEXIh','7451899gqFiNk','2298228kwmuDT','9hNloxZ','description','47914QUqhVD','364AMHcNs','name','scope','Error:\x20','message','👤\x20','6356595DeVIZu','dim','18717oGjuPA','4nORdQl'];a34_0x5aaa=function(){return _0x44bf9;};return a34_0x5aaa();}
1
+ const a34_0x2a5681=a34_0x5c87;(function(_0x1256f6,_0x149e13){const _0x3aab0f=a34_0x5c87,_0x18397a=_0x1256f6();while(!![]){try{const _0x5a012e=parseInt(_0x3aab0f(0x141))/0x1+parseInt(_0x3aab0f(0x132))/0x2+parseInt(_0x3aab0f(0x143))/0x3*(parseInt(_0x3aab0f(0x140))/0x4)+-parseInt(_0x3aab0f(0x144))/0x5+-parseInt(_0x3aab0f(0x137))/0x6+parseInt(_0x3aab0f(0x13a))/0x7*(parseInt(_0x3aab0f(0x138))/0x8)+parseInt(_0x3aab0f(0x149))/0x9*(-parseInt(_0x3aab0f(0x14a))/0xa);if(_0x5a012e===_0x149e13)break;else _0x18397a['push'](_0x18397a['shift']());}catch(_0x56f0b0){_0x18397a['push'](_0x18397a['shift']());}}}(a34_0xe55f,0xe2431));function a34_0xe55f(){const _0x52f5cd=['profiles','51LWFusd','874055WqDwRP','description','execute','config','length','10953693mOdPXQ','20RUKuHd','👤\x20','scope','error','216660qAKPYK','map','message','green','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','3702708abfARX','120gFDHXn','site','400421pvPiXA','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','log','dim','List\x20all\x20available\x20profiles','name','338084tROYmb','1749620nYLunD'];a34_0xe55f=function(){return _0x52f5cd;};return a34_0xe55f();}import{BaseCommand}from'./command.js';function a34_0x5c87(_0x472cec,_0x1608ce){_0x472cec=_0x472cec-0x12f;const _0xe55f38=a34_0xe55f();let _0x5c8732=_0xe55f38[_0x472cec];return _0x5c8732;}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x4b009d from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x2a5681(0x13f)]=a34_0x2a5681(0x142);[a34_0x2a5681(0x145)]=a34_0x2a5681(0x13e);async[a34_0x2a5681(0x146)](_0x176ff0){const _0x427af3=a34_0x2a5681,{options:_0x13c674}=_0x176ff0;try{const _0x2decf2=listProfiles(),_0x1016fd=getActiveProfile();if(_0x2decf2[_0x427af3(0x148)]===0x0)return console[_0x427af3(0x13c)](_0x427af3(0x13b)),console[_0x427af3(0x13c)](_0x427af3(0x136)),console[_0x427af3(0x13c)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x54e50e=_0x2decf2[_0x427af3(0x133)](_0x2de4a0=>{const _0x1e3920=_0x427af3,_0x1a6e7a=_0x2de4a0['name']===_0x1016fd,_0x46852e=getProfileParams(_0x2de4a0['config']);return{'name':_0x2de4a0[_0x1e3920(0x13f)],'active':_0x1a6e7a,'scope':_0x2de4a0[_0x1e3920(0x130)],'description':_0x2de4a0['config'][_0x1e3920(0x145)]||'','params':_0x46852e};});if(isStructuredFormat(_0x13c674))await handleSDKOutput(_0x54e50e,_0x13c674);else for(const _0x2607a8 of _0x2decf2){const _0x4deae0=_0x2607a8[_0x427af3(0x13f)]===_0x1016fd?a34_0x4b009d[_0x427af3(0x135)]('\x20✓'):'',_0xc810ce=_0x2607a8[_0x427af3(0x147)][_0x427af3(0x139)]?a34_0x4b009d[_0x427af3(0x13d)]('\x20'+_0x2607a8[_0x427af3(0x147)][_0x427af3(0x139)]):'',_0x14cf7d=_0x2607a8['config'][_0x427af3(0x145)]?a34_0x4b009d[_0x427af3(0x13d)]('\x20\x20'+_0x2607a8[_0x427af3(0x147)][_0x427af3(0x145)]):'';console[_0x427af3(0x13c)](_0x427af3(0x12f)+_0x2607a8['name']+_0x4deae0+_0xc810ce+_0x14cf7d);}return 0x0;}catch(_0x1341e9){return _0x1341e9 instanceof Error&&console[_0x427af3(0x131)]('Error:\x20'+_0x1341e9[_0x427af3(0x134)]),0x1;}}}
@@ -1 +1 @@
1
- function a35_0x23c8(_0x291c72,_0x4e17a7){_0x291c72=_0x291c72-0x1c2;const _0xd8faa6=a35_0xd8fa();let _0x23c8cb=_0xd8faa6[_0x291c72];return _0x23c8cb;}const a35_0x426416=a35_0x23c8;(function(_0x42b5cb,_0x2c551a){const _0x358493=a35_0x23c8,_0x4f0c90=_0x42b5cb();while(!![]){try{const _0x1c0941=parseInt(_0x358493(0x1d4))/0x1+-parseInt(_0x358493(0x1dc))/0x2+parseInt(_0x358493(0x1ca))/0x3*(-parseInt(_0x358493(0x1e2))/0x4)+-parseInt(_0x358493(0x1d2))/0x5+-parseInt(_0x358493(0x1d3))/0x6*(parseInt(_0x358493(0x1d9))/0x7)+-parseInt(_0x358493(0x1d1))/0x8+parseInt(_0x358493(0x1ed))/0x9;if(_0x1c0941===_0x2c551a)break;else _0x4f0c90['push'](_0x4f0c90['shift']());}catch(_0x208275){_0x4f0c90['push'](_0x4f0c90['shift']());}}}(a35_0xd8fa,0x2dd50));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a35_0x426416(0x1de);[a35_0x426416(0x1ee)]='Run\x20Trino\x20queries\x20(streaming)';async['execute'](_0x1e16ed){const _0x3841dc=a35_0x426416,{options:_0x10cdf9,args:_0x1c91ad,tdx:_0x3fa43f}=_0x1e16ed,_0x9d52ba={..._0x10cdf9,'limitStructuredFormats':!![]},_0x40686f=_0x1c91ad[0x0],_0x2b4fde=_0x10cdf9['file'];let _0x480aab;try{if(_0x2b4fde)_0x480aab=readSqlStatementsFromFile(_0x2b4fde);else{if(_0x40686f==='-')_0x480aab=await readSqlStatementsFromStdin();else{if(_0x40686f&&isSqlFilePath(_0x40686f))_0x480aab=readSqlStatementsFromFile(_0x40686f);else{if(_0x40686f)_0x480aab=splitSqlStatements(_0x40686f);else throw new Error(_0x3841dc(0x1c3));}}}}catch(_0x49692f){return console[_0x3841dc(0x1d5)](_0x3841dc(0x1ef)+_0x49692f[_0x3841dc(0x1ea)]),0x1;}const _0x3bfc72=_0x10cdf9[_0x3841dc(0x1c6)]||'information_schema',_0x53c7e8=_0x10cdf9['catalog'];try{const _0xdfbe94=[],_0x308486=!!_0x10cdf9[_0x3841dc(0x1eb)];for(let _0x4cbbbf=0x0;_0x4cbbbf<_0x480aab[_0x3841dc(0x1e4)];_0x4cbbbf++){const _0x2d862e=_0x480aab[_0x4cbbbf],_0x2e1ed7=_0x4cbbbf+0x1,_0x3fb458=_0x480aab[_0x3841dc(0x1e4)],_0x8b12c0=_0x3fb458>0x1;_0x10cdf9['verbose']&&(console[_0x3841dc(0x1d5)]('\x0a'+(_0x8b12c0?_0x3841dc(0x1cd)+_0x2e1ed7+'/'+_0x3fb458+':':'')),console['error'](_0x3841dc(0x1c5)+_0x10cdf9['site']),console['error'](_0x3841dc(0x1c9)+(_0x53c7e8||'td')),console[_0x3841dc(0x1d5)]('Schema:\x20'+_0x3bfc72),console[_0x3841dc(0x1d5)](_0x3841dc(0x1e0)+_0x2d862e));const _0x19bc56=_0x8b12c0?_0x3841dc(0x1cb)+_0x2e1ed7+'/'+_0x3fb458+'...':_0x3841dc(0x1f2);try{const _0x10f3d3=await withProgressSpinner(_0x19bc56,async _0x2a4a27=>{const _0x53b677=await _0x3fa43f['query']['execute'](_0x2d862e,{'catalog':_0x53c7e8,'schema':_0x3bfc72,'onJobId':_0xc974c=>{const _0x4f6af4=a35_0x23c8;_0x2a4a27[_0x4f6af4(0x1c7)](_0xc974c);},'onProgress':_0x535411=>{const _0x1afac4=a35_0x23c8;_0x2a4a27[_0x1afac4(0x1d6)](_0x1afac4(0x1e1)+_0x535411[_0x1afac4(0x1f1)]+']'),_0x2a4a27[_0x1afac4(0x1e9)](formatRows(_0x535411[_0x1afac4(0x1df)])+_0x1afac4(0x1cc)+_0x535411[_0x1afac4(0x1e7)]+'/'+_0x535411[_0x1afac4(0x1ce)]+_0x1afac4(0x1e6));}});return _0x53b677;},{'verbose':_0x10cdf9[_0x3841dc(0x1c4)]}),_0x54bb8e=_0x10f3d3[_0x3841dc(0x1e3)],_0x3a38c1=_0x54bb8e[_0x3841dc(0x1f0)]?_0x3841dc(0x1d0)+_0x54bb8e[_0x3841dc(0x1f0)]+']':'',_0x27ad5e=_0x8b12c0?_0x3841dc(0x1cd)+_0x2e1ed7+'/'+_0x3fb458+_0x3841dc(0x1e5):'';console[_0x3841dc(0x1d5)]('✔\x20'+_0x27ad5e+_0x3841dc(0x1cf)+formatRows(_0x54bb8e[_0x3841dc(0x1dd)][_0x3841dc(0x1df)])+'\x20rows\x20'+(_0x3841dc(0x1c8)+formatElapsed(_0x54bb8e[_0x3841dc(0x1dd)][_0x3841dc(0x1ec)])+_0x3a38c1));if(_0x8b12c0&&_0x308486){const _0x27c980=resolveOutputOptions(_0x9d52ba),_0x48e85b=await formatQueryOutput(_0x54bb8e,_0x27c980);_0xdfbe94['push'](_0x48e85b);}else await handleQueryOutput(_0x54bb8e,_0x9d52ba);}catch(_0x5c1ecb){const _0x4c9cb5=_0x8b12c0?_0x3841dc(0x1cd)+_0x2e1ed7+'/'+_0x3fb458+':\x0a':'',_0x4a3e13=_0x5c1ecb instanceof SDKError?_0x5c1ecb[_0x3841dc(0x1d8)]:_0x5c1ecb[_0x3841dc(0x1ea)];return console[_0x3841dc(0x1d5)](''+_0x4c9cb5+_0x4a3e13),0x1;}}if(_0x480aab['length']>0x1&&_0x308486&&_0xdfbe94[_0x3841dc(0x1e4)]>0x0){const _0x55ae7f=_0xdfbe94[_0x3841dc(0x1da)]('\x0a');writeFileSync(_0x10cdf9['output'],_0x55ae7f),console[_0x3841dc(0x1d5)](_0x3841dc(0x1d7)+_0x10cdf9[_0x3841dc(0x1eb)]);}return 0x0;}catch(_0x557f6e){throw _0x557f6e;}}['validate'](_0x5ce32d){const _0x13e18=a35_0x426416,_0x8e04cf=_0x5ce32d[_0x13e18(0x1db)][0x0],_0x4ae5e7=_0x5ce32d[_0x13e18(0x1e8)]['file'];if(!_0x8e04cf&&!_0x4ae5e7)return _0x13e18(0x1c2);if(_0x8e04cf&&_0x4ae5e7)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}function a35_0xd8fa(){const _0xee1be8=['error','setPhase','\x0aAll\x20results\x20saved\x20to\x20','originalMessage','2317NAKGVs','join','args','703102RHkCYH','stats','query','processedRows','SQL:\x20','Executing\x20query\x20[','2708YxuTNw','data','length','\x20-\x20','\x20splits','completedSplits','options','setExtra','message','output','elapsedTimeMillis','9281349wxAPQV','description','Error:\x20','jobId','state','Executing\x20query...','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','No\x20SQL\x20provided','verbose','Site:\x20','database','setJobId','in\x20','Catalog:\x20','477DASBwX','Executing\x20statement\x20','\x20rows\x20','Statement\x20','totalSplits','Query\x20completed:\x20Processed\x20','\x20[Job\x20ID:\x20','1462512UBvJNH','122505zGFFVy','5826rhMSIk','144377DdHjPS'];a35_0xd8fa=function(){return _0xee1be8;};return a35_0xd8fa();}
1
+ const a35_0x31cd9d=a35_0x2047;function a35_0x2047(_0x536c96,_0x299886){_0x536c96=_0x536c96-0xfb;const _0x37c851=a35_0x37c8();let _0x20478f=_0x37c851[_0x536c96];return _0x20478f;}(function(_0x29def1,_0x47dccd){const _0x3bac4b=a35_0x2047,_0x4498d0=_0x29def1();while(!![]){try{const _0x12a60a=parseInt(_0x3bac4b(0x10f))/0x1+-parseInt(_0x3bac4b(0x100))/0x2*(-parseInt(_0x3bac4b(0x10c))/0x3)+-parseInt(_0x3bac4b(0x119))/0x4*(-parseInt(_0x3bac4b(0x129))/0x5)+-parseInt(_0x3bac4b(0x11b))/0x6+parseInt(_0x3bac4b(0x105))/0x7+-parseInt(_0x3bac4b(0x121))/0x8*(-parseInt(_0x3bac4b(0x10d))/0x9)+parseInt(_0x3bac4b(0x12b))/0xa*(-parseInt(_0x3bac4b(0xfc))/0xb);if(_0x12a60a===_0x47dccd)break;else _0x4498d0['push'](_0x4498d0['shift']());}catch(_0x532184){_0x4498d0['push'](_0x4498d0['shift']());}}}(a35_0x37c8,0x7aec7));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';function a35_0x37c8(){const _0x16f0ad=['validate','4723080ahuoLh','options','site','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','message','catalog','16rteeQj','stats','join','file','data','length','description','Executing\x20query...','1787890icIVJs','\x20splits','87390kagdvA','Run\x20Trino\x20queries\x20(streaming)','error','...','2101zhPsES','in\x20','\x20[Job\x20ID:\x20','totalSplits','59896YMEtco','No\x20SQL\x20provided','database','Site:\x20','originalMessage','6680975zjMBzk','setPhase','state','execute','SQL:\x20','name','Error:\x20','24xzREwC','2852613QYbJfJ','output','774323LZCEoK','Query\x20completed:\x20Processed\x20','\x0aAll\x20results\x20saved\x20to\x20','Executing\x20query\x20[','Statement\x20','jobId','processedRows','query','Catalog:\x20','\x20-\x20','4NDtaHR'];a35_0x37c8=function(){return _0x16f0ad;};return a35_0x37c8();}export class QueryCommand extends BaseCommand{[a35_0x31cd9d(0x10a)]='query';[a35_0x31cd9d(0x127)]=a35_0x31cd9d(0x12c);async[a35_0x31cd9d(0x108)](_0x1283a0){const _0x14fdf4=a35_0x31cd9d,{options:_0x452ee5,args:_0x21476f,tdx:_0x15d54c}=_0x1283a0,_0xf32743={..._0x452ee5,'limitStructuredFormats':!![]},_0x5df4b0=_0x21476f[0x0],_0x2dd305=_0x452ee5[_0x14fdf4(0x124)];let _0x5e8573;try{if(_0x2dd305)_0x5e8573=readSqlStatementsFromFile(_0x2dd305);else{if(_0x5df4b0==='-')_0x5e8573=await readSqlStatementsFromStdin();else{if(_0x5df4b0&&isSqlFilePath(_0x5df4b0))_0x5e8573=readSqlStatementsFromFile(_0x5df4b0);else{if(_0x5df4b0)_0x5e8573=splitSqlStatements(_0x5df4b0);else throw new Error(_0x14fdf4(0x101));}}}}catch(_0x1d02b4){return console[_0x14fdf4(0x12d)](_0x14fdf4(0x10b)+_0x1d02b4['message']),0x1;}const _0x224199=_0x452ee5[_0x14fdf4(0x102)]||'information_schema',_0x4ab4c8=_0x452ee5[_0x14fdf4(0x120)];try{const _0xf32b7a=[],_0xf979a6=!!_0x452ee5[_0x14fdf4(0x10e)];for(let _0x48a1f4=0x0;_0x48a1f4<_0x5e8573[_0x14fdf4(0x126)];_0x48a1f4++){const _0x4f9834=_0x5e8573[_0x48a1f4],_0x1e664a=_0x48a1f4+0x1,_0x4cb6f7=_0x5e8573['length'],_0x3a2127=_0x4cb6f7>0x1;_0x452ee5['verbose']&&(console[_0x14fdf4(0x12d)]('\x0a'+(_0x3a2127?_0x14fdf4(0x113)+_0x1e664a+'/'+_0x4cb6f7+':':'')),console['error'](_0x14fdf4(0x103)+_0x452ee5[_0x14fdf4(0x11d)]),console[_0x14fdf4(0x12d)](_0x14fdf4(0x117)+(_0x4ab4c8||'td')),console[_0x14fdf4(0x12d)]('Schema:\x20'+_0x224199),console[_0x14fdf4(0x12d)](_0x14fdf4(0x109)+_0x4f9834));const _0x4e6f6b=_0x3a2127?'Executing\x20statement\x20'+_0x1e664a+'/'+_0x4cb6f7+_0x14fdf4(0xfb):_0x14fdf4(0x128);try{const _0x35aced=await withProgressSpinner(_0x4e6f6b,async _0x18b3fd=>{const _0x4a3a4b=_0x14fdf4,_0xd3c5b2=await _0x15d54c[_0x4a3a4b(0x116)][_0x4a3a4b(0x108)](_0x4f9834,{'catalog':_0x4ab4c8,'schema':_0x224199,'onJobId':_0x29ec8c=>{_0x18b3fd['setJobId'](_0x29ec8c);},'onProgress':_0x20b2c6=>{const _0x157e56=_0x4a3a4b;_0x18b3fd[_0x157e56(0x106)](_0x157e56(0x112)+_0x20b2c6[_0x157e56(0x107)]+']'),_0x18b3fd['setExtra'](formatRows(_0x20b2c6[_0x157e56(0x115)])+'\x20rows\x20'+_0x20b2c6['completedSplits']+'/'+_0x20b2c6[_0x157e56(0xff)]+_0x157e56(0x12a));}});return _0xd3c5b2;},{'verbose':_0x452ee5['verbose']}),_0x54bb41=_0x35aced[_0x14fdf4(0x125)],_0x2188f4=_0x54bb41['jobId']?_0x14fdf4(0xfe)+_0x54bb41[_0x14fdf4(0x114)]+']':'',_0x21d175=_0x3a2127?'Statement\x20'+_0x1e664a+'/'+_0x4cb6f7+_0x14fdf4(0x118):'';console[_0x14fdf4(0x12d)]('✔\x20'+_0x21d175+_0x14fdf4(0x110)+formatRows(_0x54bb41[_0x14fdf4(0x122)]['processedRows'])+'\x20rows\x20'+(_0x14fdf4(0xfd)+formatElapsed(_0x54bb41['stats']['elapsedTimeMillis'])+_0x2188f4));if(_0x3a2127&&_0xf979a6){const _0x1c00d9=resolveOutputOptions(_0xf32743),_0x438abd=await formatQueryOutput(_0x54bb41,_0x1c00d9);_0xf32b7a['push'](_0x438abd);}else await handleQueryOutput(_0x54bb41,_0xf32743);}catch(_0x4569e6){const _0x49f4fb=_0x3a2127?'Statement\x20'+_0x1e664a+'/'+_0x4cb6f7+':\x0a':'',_0x48ccef=_0x4569e6 instanceof SDKError?_0x4569e6[_0x14fdf4(0x104)]:_0x4569e6[_0x14fdf4(0x11f)];return console['error'](''+_0x49f4fb+_0x48ccef),0x1;}}if(_0x5e8573[_0x14fdf4(0x126)]>0x1&&_0xf979a6&&_0xf32b7a[_0x14fdf4(0x126)]>0x0){const _0x53e395=_0xf32b7a[_0x14fdf4(0x123)]('\x0a');writeFileSync(_0x452ee5[_0x14fdf4(0x10e)],_0x53e395),console[_0x14fdf4(0x12d)](_0x14fdf4(0x111)+_0x452ee5[_0x14fdf4(0x10e)]);}return 0x0;}catch(_0x2e3c74){throw _0x2e3c74;}}[a35_0x31cd9d(0x11a)](_0xb1a5b4){const _0x35311d=a35_0x31cd9d,_0xf72e92=_0xb1a5b4['args'][0x0],_0x564585=_0xb1a5b4[_0x35311d(0x11c)][_0x35311d(0x124)];if(!_0xf72e92&&!_0x564585)return _0x35311d(0x11e);if(_0xf72e92&&_0x564585)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}
@@ -1 +1 @@
1
- const a36_0x1e2b7f=a36_0x2a91;(function(_0x1ed559,_0x104c95){const _0x108786=a36_0x2a91,_0x51176f=_0x1ed559();while(!![]){try{const _0x27a168=parseInt(_0x108786(0x1c8))/0x1*(-parseInt(_0x108786(0x220))/0x2)+parseInt(_0x108786(0x1a5))/0x3+-parseInt(_0x108786(0x1b1))/0x4*(-parseInt(_0x108786(0x1de))/0x5)+parseInt(_0x108786(0x203))/0x6*(-parseInt(_0x108786(0x1cd))/0x7)+-parseInt(_0x108786(0x1c1))/0x8+parseInt(_0x108786(0x1e6))/0x9*(parseInt(_0x108786(0x1e7))/0xa)+parseInt(_0x108786(0x1aa))/0xb;if(_0x27a168===_0x104c95)break;else _0x51176f['push'](_0x51176f['shift']());}catch(_0x492b1f){_0x51176f['push'](_0x51176f['shift']());}}}(a36_0x1ccd,0xe17a3));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a36_0x4d3ba2 from'chalk';function formatRelativeTime(_0x2d3e33){const _0x3d296b=a36_0x2a91,_0x2666f7=new Date(_0x2d3e33),_0x232e49=new Date(),_0x3b17da=_0x2666f7[_0x3d296b(0x1ed)]()-_0x232e49[_0x3d296b(0x1ed)](),_0x2b7612=Math[_0x3d296b(0x1d9)](_0x3b17da)/0x3e8,_0x3e676d=_0x3b17da<0x0;if(_0x2b7612<0x3c)return _0x3e676d?'just\x20now':'soon';else{if(_0x2b7612<0xe10){const _0x247757=Math[_0x3d296b(0x1ce)](_0x2b7612/0x3c);return _0x3e676d?_0x247757+_0x3d296b(0x1dd):'in\x20'+_0x247757+'m';}else{if(_0x2b7612<0x15180){const _0x3292ad=Math[_0x3d296b(0x1ce)](_0x2b7612/0xe10);return _0x3e676d?_0x3292ad+'h\x20ago':_0x3d296b(0x227)+_0x3292ad+'h';}else{if(_0x2b7612<0x93a80){const _0x306082=Math[_0x3d296b(0x1ce)](_0x2b7612/0x15180);return _0x3e676d?_0x306082+_0x3d296b(0x1f7):_0x3d296b(0x227)+_0x306082+'d';}else return _0x2666f7['toLocaleDateString']();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x1e2b7f(0x1f4)]=a36_0x1e2b7f(0x1cb);[a36_0x1e2b7f(0x1c0)]='List\x20scheduled\x20queries';async['execute'](_0x5d823e){const _0x5e1e71=a36_0x1e2b7f,{options:_0x78c15e,args:_0x5e9316,tdx:_0x35dc87}=_0x5d823e,_0x22363c=resolveLimit(_0x78c15e[_0x5e1e71(0x1da)],DEFAULT_DISPLAY_LIMIT),_0x17d428=_0x5e9316[0x0],_0x3d2729=_0x17d428?_0x5e1e71(0x21c)+_0x17d428+_0x5e1e71(0x1ab):_0x5e1e71(0x1cc),_0x5b5b3f=await withSpinner(_0x3d2729,()=>_0x35dc87[_0x5e1e71(0x221)]['listQueries']({'limit':_0x22363c,'scheduled':!![],'pattern':_0x17d428}),{'verbose':_0x78c15e[_0x5e1e71(0x207)]}),_0x43f7c0=_0x5b5b3f[_0x5e1e71(0x1e3)][_0x5e1e71(0x1ef)],_0x376875=_0x5b5b3f[_0x5e1e71(0x1e3)][_0x5e1e71(0x1eb)][_0x5e1e71(0x1e8)],_0x29d67d=_0x17d428?'\x20matching\x20\x22'+_0x17d428+'\x22':'';_0x376875?console[_0x5e1e71(0x1b2)](_0x5e1e71(0x204)+_0x43f7c0[_0x5e1e71(0x1ca)]+_0x5e1e71(0x1f5)+_0x29d67d+_0x5e1e71(0x1bf)):console['error']('Found\x20'+_0x43f7c0[_0x5e1e71(0x1ca)]+_0x5e1e71(0x201)+(_0x43f7c0[_0x5e1e71(0x1ca)]!==0x1?'ies':'y')+_0x29d67d);if(_0x78c15e[_0x5e1e71(0x1a0)]===_0x5e1e71(0x20f)||_0x78c15e[_0x5e1e71(0x1a0)]===_0x5e1e71(0x225)||_0x78c15e['format']===_0x5e1e71(0x1ea)||_0x78c15e[_0x5e1e71(0x1a0)]==='tsv'){const _0x585fbe=_0x43f7c0[_0x5e1e71(0x1b7)](_0x1ff509=>({'id':_0x1ff509['id'],'name':_0x1ff509[_0x5e1e71(0x1f4)],'cron':_0x1ff509[_0x5e1e71(0x21b)],'database':_0x1ff509[_0x5e1e71(0x1c6)]?.['name'],'type':_0x1ff509[_0x5e1e71(0x206)],'timezone':_0x1ff509['time_zone'],'user_name':_0x1ff509[_0x5e1e71(0x224)]?.[_0x5e1e71(0x1f4)],'updated_at':_0x1ff509['updated_at'],'next_run_at':_0x1ff509[_0x5e1e71(0x19d)],'last_job_status':_0x1ff509[_0x5e1e71(0x1b5)]?.[_0x5e1e71(0x1e5)]}));await handleSDKOutput(_0x585fbe,_0x78c15e);}else{if(_0x43f7c0['length']===0x0)console['log']('No\x20scheduled\x20queries\x20found');else{const _0x5f44ad=_0x78c15e['site'],_0x421202=_0x43f7c0[_0x5e1e71(0x1b7)](_0x5caa3f=>{const _0x2da169=_0x5e1e71,_0x30bad6=_0x5caa3f[_0x2da169(0x1b5)]?.[_0x2da169(0x1e5)]?_0x5caa3f[_0x2da169(0x1b5)][_0x2da169(0x1e5)]===_0x2da169(0x22a)?'✓':'✗':'-',_0x69f69b=_0x5caa3f['last_job']?.[_0x2da169(0x1f9)]?formatRelativeTime(_0x5caa3f[_0x2da169(0x1b5)][_0x2da169(0x1f9)]):_0x2da169(0x1b4),_0x175f1b=_0x5caa3f['next_run_at']?formatRelativeTime(_0x5caa3f[_0x2da169(0x19d)]):'-',_0x50ad32=_0x5caa3f[_0x2da169(0x21b)]||'',_0x3e7493=_0x5caa3f[_0x2da169(0x1f4)]||_0x2da169(0x216),_0x3a64e8=getConsoleUrl(_0x5f44ad,'/app/queries/editor?queryId='+_0x5caa3f['id']);return{'statusIcon':_0x30bad6,'lastRun':_0x69f69b,'nextRun':_0x175f1b,'cron':_0x50ad32,'name':_0x3e7493,'queryUrl':_0x3a64e8,'status':_0x5caa3f[_0x2da169(0x1b5)]?.[_0x2da169(0x1e5)]};}),_0x1bff00=Math['max'](..._0x421202[_0x5e1e71(0x1b7)](_0x8c5657=>_0x8c5657[_0x5e1e71(0x1f8)]['length'])),_0x22ee66=Math['max'](..._0x421202[_0x5e1e71(0x1b7)](_0xa231e9=>_0xa231e9['nextRun'][_0x5e1e71(0x1ca)])),_0x368a3c=Math['max'](..._0x421202[_0x5e1e71(0x1b7)](_0x626af=>_0x626af[_0x5e1e71(0x21b)]['length'])),_0x3e1e67=_0x421202['map'](_0x330da1=>{const _0x352e5d=_0x5e1e71,_0x558120=_0x330da1[_0x352e5d(0x1e5)]===_0x352e5d(0x22a)?a36_0x4d3ba2[_0x352e5d(0x226)](_0x330da1[_0x352e5d(0x1be)]):_0x330da1[_0x352e5d(0x1e5)]==='error'?a36_0x4d3ba2[_0x352e5d(0x1a8)](_0x330da1[_0x352e5d(0x1be)]):a36_0x4d3ba2[_0x352e5d(0x1b3)](_0x330da1[_0x352e5d(0x1be)]),_0x4b9efe=_0x330da1[_0x352e5d(0x1f8)][_0x352e5d(0x213)](_0x1bff00),_0x47fca1=_0x330da1[_0x352e5d(0x1e1)][_0x352e5d(0x213)](_0x22ee66),_0x4d7e7f=_0x330da1[_0x352e5d(0x21b)]?a36_0x4d3ba2[_0x352e5d(0x1d6)](_0x330da1[_0x352e5d(0x21b)][_0x352e5d(0x213)](_0x368a3c)):'\x20'[_0x352e5d(0x1c4)](_0x368a3c),_0x97684f=hyperlink(_0x330da1[_0x352e5d(0x1f4)],_0x330da1[_0x352e5d(0x202)]);return _0x352e5d(0x1bc)+_0x558120+'\x20'+_0x4b9efe+_0x352e5d(0x1cf)+_0x47fca1+'\x20\x20'+_0x4d7e7f+'\x20\x20'+_0x97684f;});await writeOutput(_0x3e1e67[_0x5e1e71(0x209)]('\x0a'),_0x78c15e['output'],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x1e2b7f(0x1f4)]=a36_0x1e2b7f(0x1a6);[a36_0x1e2b7f(0x1c0)]=a36_0x1e2b7f(0x1a9);['validate'](_0x255cbf){const _0x124ad3=_0x255cbf['args'][0x0];if(!_0x124ad3)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async[a36_0x1e2b7f(0x1d7)](_0x892318){const _0x26b0b8=a36_0x1e2b7f,{options:_0x41150d,args:_0x429057,tdx:_0xb72e81}=_0x892318,_0x2f4be9=_0x429057[0x0],_0x3f87f0=await withSpinner(_0x26b0b8(0x1e0),()=>_0xb72e81['schedules']['show'](_0x2f4be9),{'verbose':_0x41150d[_0x26b0b8(0x207)]}),_0x12fbcd=_0x3f87f0[_0x26b0b8(0x1e3)],_0x5ece9f={'name':_0x12fbcd[_0x26b0b8(0x1f4)],'cron':_0x12fbcd[_0x26b0b8(0x21b)],'database':_0x12fbcd[_0x26b0b8(0x1c6)],'type':_0x12fbcd[_0x26b0b8(0x206)],'timezone':_0x12fbcd[_0x26b0b8(0x1b8)],'user_name':_0x12fbcd[_0x26b0b8(0x214)],'created_at':_0x12fbcd[_0x26b0b8(0x1bd)],'engine_version':_0x12fbcd[_0x26b0b8(0x19f)],'executing_user_id':_0x12fbcd[_0x26b0b8(0x1f6)],'query':_0x12fbcd[_0x26b0b8(0x212)],'delay':_0x12fbcd['delay'],'priority':_0x12fbcd[_0x26b0b8(0x1fb)],'retry_limit':_0x12fbcd[_0x26b0b8(0x1fe)],..._0x12fbcd[_0x26b0b8(0x223)]&&{'result':_0x12fbcd['result']}};return await handleSingleObjectOutput(_0x5ece9f,_0x41150d),0x0;}}function a36_0x2a91(_0x2df367,_0x568ab1){_0x2df367=_0x2df367-0x19d;const _0x1ccd5a=a36_0x1ccd();let _0x2a9107=_0x1ccd5a[_0x2df367];return _0x2a9107;}function a36_0x1ccd(){const _0x56baec=['validate','priority','\x20\x20Database:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','retry_limit','start_at','options','\x20scheduled\x20quer','queryUrl','283836rOkiZJ','Showing\x20first\x20','trim','type','verbose','Creating\x20schedule:\x20','join','trino','keys','args','job_id','schedule:create','json','file','num','query','padEnd','user_name','delete','(unnamed)','\x20\x20Timezone:\x20','\x20\x20Job\x20ID:\x20','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','Running\x20schedule...','cron','Searching\x20scheduled\x20queries\x20matching\x20\x22','\x20\x20Time:\x20','run','Schedule\x20created:\x20','5526tvthXU','schedules','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','result','user','jsonl','green','in\x20','delay','Query\x20file\x20is\x20empty','success','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','Cancelled','next_run_at','utf-8','engine_version','format','entries','...','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','substring','2344410NuCTNs','schedule:show','count','red','Show\x20schedule\x20details','43137743dABFsO','\x22...','Update\x20a\x20scheduled\x20query','end_at','from','engineVersion','retryLimit','40huoXvu','error','dim','never','last_job','Create\x20a\x20scheduled\x20query','map','timezone','\x20job','history','Schedule\x20run\x20submitted:\x20','📅\x20','created_at','statusIcon','\x20(use\x20--limit\x20to\x20see\x20more)','description','14002808EYyFXM','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','Run\x20a\x20scheduled\x20query\x20immediately','repeat','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','database','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','599vsxPzk','\x20\x20Cron:\x20','length','schedule:list','Listing\x20scheduled\x20queries...','224OhIlwj','round','\x20\x20→\x20','Creating\x20schedule...','schedule:update','Found\x20','Schedule\x20updated:\x20','Delete\x20a\x20scheduled\x20query','time','cyan','execute','Getting\x20schedule\x20history...','abs','limit','INVALID_ARGUMENT','\x20execution','m\x20ago','367585HqGYXR','schedule:delete','Getting\x20schedule\x20details...','nextRun','Deleting\x20schedule...','data','Failed\x20to\x20read\x20file:\x20','status','77454ftchpY','470NDmYSa','has_next_page','Show\x20schedule\x20execution\x20history','table','pagination','create','getTime','schedule:run','queries','\x20(showing\x20','\x20created','\x20\x20Num:\x20','schedule:history','name','\x20schedules','executing_user_id','d\x20ago','lastRun','ended_at'];a36_0x1ccd=function(){return _0x56baec;};return a36_0x1ccd();}export class ScheduleCreateCommand extends BaseCommand{[a36_0x1e2b7f(0x1f4)]=a36_0x1e2b7f(0x20e);[a36_0x1e2b7f(0x1c0)]=a36_0x1e2b7f(0x1b6);[a36_0x1e2b7f(0x1fa)](_0x5a4c1d){const _0x15254f=a36_0x1e2b7f,_0x4e4250=_0x5a4c1d[_0x15254f(0x20c)][0x0];if(!_0x4e4250)return _0x15254f(0x1c7);const _0x30ed67=_0x5a4c1d[_0x15254f(0x200)];if(!_0x30ed67[_0x15254f(0x1c6)])return _0x15254f(0x1c5);return undefined;}async[a36_0x1e2b7f(0x1d7)](_0x54584e){const _0x5e3e77=a36_0x1e2b7f,{options:_0x410170,args:_0x39ea5a,tdx:_0x6b792f}=_0x54584e,_0x26ffad=_0x39ea5a[0x0],_0x577140=_0x410170,_0x2ed62f=_0x577140['database'],_0x5a9a0c=_0x577140['file'],_0x4a09cc=_0x577140['type']||_0x5e3e77(0x20a);let _0x1d7a2b;try{_0x1d7a2b=readFileSync(_0x5a9a0c,_0x5e3e77(0x19e))[_0x5e3e77(0x205)]();}catch(_0x206395){throw new SDKError(ErrorCode[_0x5e3e77(0x1db)],_0x5e3e77(0x1e4)+_0x5a9a0c,_0x206395 instanceof Error?_0x206395:undefined);}if(!_0x1d7a2b)throw new SDKError(ErrorCode[_0x5e3e77(0x1db)],_0x5e3e77(0x229));const _0xcd37a9={'database':_0x2ed62f,'query':_0x1d7a2b,'type':_0x4a09cc};if(_0x577140['cron'])_0xcd37a9[_0x5e3e77(0x21b)]=_0x577140['cron'];if(_0x577140[_0x5e3e77(0x1b8)])_0xcd37a9[_0x5e3e77(0x1b8)]=_0x577140[_0x5e3e77(0x1b8)];if(_0x577140[_0x5e3e77(0x228)]!==undefined)_0xcd37a9[_0x5e3e77(0x228)]=Number(_0x577140[_0x5e3e77(0x228)]);if(_0x577140[_0x5e3e77(0x1fb)]!==undefined)_0xcd37a9[_0x5e3e77(0x1fb)]=Number(_0x577140[_0x5e3e77(0x1fb)]);if(_0x577140[_0x5e3e77(0x1b0)]!==undefined)_0xcd37a9[_0x5e3e77(0x1fe)]=Number(_0x577140[_0x5e3e77(0x1b0)]);if(_0x577140[_0x5e3e77(0x1af)])_0xcd37a9[_0x5e3e77(0x19f)]=_0x577140[_0x5e3e77(0x1af)];if(_0x577140[_0x5e3e77(0x223)])_0xcd37a9[_0x5e3e77(0x223)]=_0x577140[_0x5e3e77(0x223)];if(_0x410170['verbose']){console[_0x5e3e77(0x1b2)](_0x5e3e77(0x208)+_0x26ffad),console['error'](_0x5e3e77(0x1fc)+_0x2ed62f),console[_0x5e3e77(0x1b2)]('\x20\x20Type:\x20'+_0x4a09cc);if(_0xcd37a9[_0x5e3e77(0x21b)])console[_0x5e3e77(0x1b2)](_0x5e3e77(0x1c9)+_0xcd37a9[_0x5e3e77(0x21b)]);if(_0xcd37a9['timezone'])console[_0x5e3e77(0x1b2)](_0x5e3e77(0x217)+_0xcd37a9[_0x5e3e77(0x1b8)]);}const _0xfda548=await withSpinner(_0x5e3e77(0x1d0),()=>_0x6b792f[_0x5e3e77(0x221)][_0x5e3e77(0x1ec)](_0x26ffad,_0xcd37a9),{'verbose':_0x410170[_0x5e3e77(0x207)]});return console['error'](_0x5e3e77(0x21f)+_0xfda548[_0x5e3e77(0x1e3)]['name']),await handleSingleObjectOutput(_0xfda548[_0x5e3e77(0x1e3)],_0x410170),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x1e2b7f(0x1f4)]=a36_0x1e2b7f(0x1d1);[a36_0x1e2b7f(0x1c0)]=a36_0x1e2b7f(0x1ac);[a36_0x1e2b7f(0x1fa)](_0x584080){const _0x379274=a36_0x1e2b7f,_0x387627=_0x584080[_0x379274(0x20c)][0x0];if(!_0x387627)return _0x379274(0x1a3);return undefined;}async[a36_0x1e2b7f(0x1d7)](_0x14e3ee){const _0x56c646=a36_0x1e2b7f,{options:_0x479b64,args:_0x5210df,tdx:_0x1526a6}=_0x14e3ee,_0x16b7a8=_0x5210df[0x0],_0x49eb8b=_0x479b64,_0x3cfb50={};if(_0x49eb8b[_0x56c646(0x1c6)])_0x3cfb50[_0x56c646(0x1c6)]=_0x49eb8b[_0x56c646(0x1c6)];if(_0x49eb8b[_0x56c646(0x206)])_0x3cfb50[_0x56c646(0x206)]=_0x49eb8b[_0x56c646(0x206)];if(_0x49eb8b[_0x56c646(0x21b)])_0x3cfb50[_0x56c646(0x21b)]=_0x49eb8b[_0x56c646(0x21b)];if(_0x49eb8b[_0x56c646(0x1b8)])_0x3cfb50[_0x56c646(0x1b8)]=_0x49eb8b[_0x56c646(0x1b8)];if(_0x49eb8b[_0x56c646(0x228)]!==undefined)_0x3cfb50['delay']=Number(_0x49eb8b[_0x56c646(0x228)]);if(_0x49eb8b[_0x56c646(0x1fb)]!==undefined)_0x3cfb50[_0x56c646(0x1fb)]=Number(_0x49eb8b[_0x56c646(0x1fb)]);if(_0x49eb8b[_0x56c646(0x1b0)]!==undefined)_0x3cfb50['retry_limit']=Number(_0x49eb8b[_0x56c646(0x1b0)]);if(_0x49eb8b[_0x56c646(0x1af)])_0x3cfb50[_0x56c646(0x19f)]=_0x49eb8b[_0x56c646(0x1af)];if(_0x49eb8b[_0x56c646(0x223)])_0x3cfb50[_0x56c646(0x223)]=_0x49eb8b[_0x56c646(0x223)];if(_0x49eb8b[_0x56c646(0x210)])try{_0x3cfb50['query']=readFileSync(_0x49eb8b[_0x56c646(0x210)],_0x56c646(0x19e))[_0x56c646(0x205)]();}catch(_0x1e7289){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x56c646(0x1e4)+_0x49eb8b[_0x56c646(0x210)],_0x1e7289 instanceof Error?_0x1e7289:undefined);}if(Object[_0x56c646(0x20b)](_0x3cfb50)['length']===0x0)throw new SDKError(ErrorCode[_0x56c646(0x1db)],_0x56c646(0x219));if(_0x479b64[_0x56c646(0x207)]){console['error']('Updating\x20schedule:\x20'+_0x16b7a8);for(const [_0x1410f9,_0x4701b4]of Object[_0x56c646(0x1a1)](_0x3cfb50)){_0x1410f9===_0x56c646(0x212)?console[_0x56c646(0x1b2)]('\x20\x20'+_0x1410f9+':\x20'+_0x4701b4[_0x56c646(0x1a4)](0x0,0x32)+_0x56c646(0x1a2)):console[_0x56c646(0x1b2)]('\x20\x20'+_0x1410f9+':\x20'+_0x4701b4);}}const _0x375f6f=await withSpinner('Updating\x20schedule...',()=>_0x1526a6[_0x56c646(0x221)]['update'](_0x16b7a8,_0x3cfb50),{'verbose':_0x479b64['verbose']});return console[_0x56c646(0x1b2)](_0x56c646(0x1d3)+_0x375f6f[_0x56c646(0x1e3)][_0x56c646(0x1f4)]),await handleSingleObjectOutput(_0x375f6f[_0x56c646(0x1e3)],_0x479b64),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x1e2b7f(0x1f4)]=a36_0x1e2b7f(0x1df);['description']=a36_0x1e2b7f(0x1d4);[a36_0x1e2b7f(0x1fa)](_0x11f628){const _0x38ea0a=a36_0x1e2b7f,_0x39becc=_0x11f628[_0x38ea0a(0x20c)][0x0];if(!_0x39becc)return _0x38ea0a(0x222);return undefined;}async[a36_0x1e2b7f(0x1d7)](_0x1ed5df){const _0x185aa5=a36_0x1e2b7f,{options:_0x33b2a9,args:_0x146aa6,tdx:_0x4f4805}=_0x1ed5df,_0x4ca3de=_0x146aa6[0x0];if(!_0x33b2a9['yes']){const _0x1a52c4=await confirm(_0x185aa5(0x1c2)+_0x4ca3de+'\x22?');if(!_0x1a52c4)return console[_0x185aa5(0x1b2)](_0x185aa5(0x22c)),0x0;}const _0x524f87=await withSpinner(_0x185aa5(0x1e2),()=>_0x4f4805[_0x185aa5(0x221)][_0x185aa5(0x215)](_0x4ca3de),{'verbose':_0x33b2a9[_0x185aa5(0x207)]});return console['error']('Schedule\x20deleted:\x20'+_0x524f87['data']['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{['name']=a36_0x1e2b7f(0x1ee);[a36_0x1e2b7f(0x1c0)]=a36_0x1e2b7f(0x1c3);['validate'](_0x3c7eba){const _0x344565=a36_0x1e2b7f,_0x3a19e2=_0x3c7eba[_0x344565(0x20c)][0x0];if(!_0x3a19e2)return _0x344565(0x1fd);return undefined;}async[a36_0x1e2b7f(0x1d7)](_0x476af0){const _0x16b85d=a36_0x1e2b7f,{options:_0x5e2765,args:_0x3968c6,tdx:_0x865ffa}=_0x476af0,_0x1ca184=_0x3968c6[0x0],_0x16d689=_0x5e2765,_0x355dc0=_0x16d689[_0x16b85d(0x1d5)],_0x2b574f=_0x16d689['num']!==undefined?Number(_0x16d689[_0x16b85d(0x211)]):undefined;if(_0x5e2765['verbose']){console[_0x16b85d(0x1b2)]('Running\x20schedule:\x20'+_0x1ca184);if(_0x355dc0)console[_0x16b85d(0x1b2)](_0x16b85d(0x21d)+_0x355dc0);if(_0x2b574f)console['error'](_0x16b85d(0x1f2)+_0x2b574f);}const _0x4f2014=await withSpinner(_0x16b85d(0x21a),()=>_0x865ffa[_0x16b85d(0x221)][_0x16b85d(0x21e)](_0x1ca184,{'time':_0x355dc0,'num':_0x2b574f}),{'verbose':_0x5e2765[_0x16b85d(0x207)]}),_0x45cc1e=_0x4f2014['data']['jobs'];console[_0x16b85d(0x1b2)](_0x16b85d(0x1bb)+_0x45cc1e[_0x16b85d(0x1ca)]+_0x16b85d(0x1b9)+(_0x45cc1e['length']!==0x1?'s':'')+_0x16b85d(0x1f1));for(const _0x4abcc3 of _0x45cc1e){console[_0x16b85d(0x1b2)](_0x16b85d(0x218)+_0x4abcc3['job_id']);}return await handleSDKOutput(_0x45cc1e,_0x5e2765),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x1e2b7f(0x1f4)]=a36_0x1e2b7f(0x1f3);[a36_0x1e2b7f(0x1c0)]=a36_0x1e2b7f(0x1e9);['validate'](_0x11ce49){const _0x15a6d4=a36_0x1e2b7f,_0x17d081=_0x11ce49['args'][0x0];if(!_0x17d081)return _0x15a6d4(0x22b);return undefined;}async['execute'](_0x4fb3b2){const _0x4f8584=a36_0x1e2b7f,{options:_0x19189a,args:_0x5e06bc,tdx:_0x12727d}=_0x4fb3b2,_0x1a6387=_0x5e06bc[0x0],_0x1109c6=_0x19189a,_0x58afa7=_0x1109c6[_0x4f8584(0x1ae)]!==undefined?Number(_0x1109c6[_0x4f8584(0x1ae)]):undefined,_0x388ad1=_0x1109c6['to']!==undefined?Number(_0x1109c6['to']):undefined,_0x39538e=await withSpinner(_0x4f8584(0x1d8),()=>_0x12727d['schedules'][_0x4f8584(0x1ba)](_0x1a6387,{'from':_0x58afa7,'to':_0x388ad1}),{'verbose':_0x19189a['verbose']}),_0x51c373=_0x39538e[_0x4f8584(0x1e3)];console[_0x4f8584(0x1b2)](_0x4f8584(0x1d2)+_0x51c373['count']+_0x4f8584(0x1dc)+(_0x51c373[_0x4f8584(0x1a7)]!==0x1?'s':'')+_0x4f8584(0x1f0)+_0x51c373['from']+'-'+_0x51c373['to']+')');const _0x16c9c4=_0x51c373['history'][_0x4f8584(0x1b7)](_0x857b7c=>({'job_id':_0x857b7c[_0x4f8584(0x20d)],'type':_0x857b7c[_0x4f8584(0x206)],'status':_0x857b7c[_0x4f8584(0x1e5)],'scheduled_at':_0x857b7c['scheduled_at'],'created_at':_0x857b7c[_0x4f8584(0x1bd)],'start_at':_0x857b7c[_0x4f8584(0x1ff)],'end_at':_0x857b7c[_0x4f8584(0x1ad)]}));return await handleSDKOutput(_0x16c9c4,_0x19189a),0x0;}}
1
+ const a36_0x2ca1eb=a36_0x2dfe;(function(_0x41dcd5,_0xeade8b){const _0x1534a8=a36_0x2dfe,_0xbd321e=_0x41dcd5();while(!![]){try{const _0x3320dd=-parseInt(_0x1534a8(0x1bd))/0x1*(parseInt(_0x1534a8(0x142))/0x2)+parseInt(_0x1534a8(0x16d))/0x3+-parseInt(_0x1534a8(0x157))/0x4+-parseInt(_0x1534a8(0x1b1))/0x5+-parseInt(_0x1534a8(0x152))/0x6+-parseInt(_0x1534a8(0x148))/0x7*(parseInt(_0x1534a8(0x191))/0x8)+parseInt(_0x1534a8(0x194))/0x9;if(_0x3320dd===_0xeade8b)break;else _0xbd321e['push'](_0xbd321e['shift']());}catch(_0x540ab4){_0xbd321e['push'](_0xbd321e['shift']());}}}(a36_0x41f8,0xe4a28));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';function a36_0x2dfe(_0x5b4d32,_0x29bb6e){_0x5b4d32=_0x5b4d32-0x140;const _0x41f83=a36_0x41f8();let _0x2dfe1d=_0x41f83[_0x5b4d32];return _0x2dfe1d;}function a36_0x41f8(){const _0x566ecc=['INVALID_ARGUMENT','trino','getTime','Schedule\x20run\x20submitted:\x20','max','Showing\x20first\x20','\x20(showing\x20','show','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','jobs','Show\x20schedule\x20details','Updating\x20schedule...','utf-8','substring','schedule:list','Searching\x20scheduled\x20queries\x20matching\x20\x22','options','user','status','List\x20scheduled\x20queries','last_job','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','Schedule\x20deleted:\x20','green','time','has_next_page','job_id','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','\x20scheduled\x20quer','Delete\x20a\x20scheduled\x20query','93064gjwmLG','type','padEnd','45216279xjHGDQ','nextRun','schedule:show','\x20\x20Timezone:\x20','list','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','red','Update\x20a\x20scheduled\x20query','Running\x20schedule:\x20','schedule:history','lastRun','executing_user_id','execute','cyan','toLocaleDateString','engineVersion','yes','history','Found\x20','Creating\x20schedule...','schedule:delete','validate','\x20\x20Num:\x20','num','scheduled_at','statusIcon','\x22...','queryUrl','\x20\x20Database:\x20','1942135XVINQJ','format','\x20\x20→\x20','priority','dim','ended_at','output','cron','created_at','h\x20ago','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','935523vTRvML','result','Run\x20a\x20scheduled\x20query\x20immediately','data','\x20\x20Type:\x20','trim','pagination','query','\x20\x20Cron:\x20','run','Getting\x20schedule\x20details...','\x20execution','schedule:create','No\x20scheduled\x20queries\x20found','join','m\x20ago','time_zone','listQueries','Cancelled','log','round','schedules','d\x20ago','database','(unnamed)','soon','Query\x20file\x20is\x20empty','2HpegAw','create','retryLimit','delete','\x20schedules','verbose','1085mohmOY','limit','map','...','success','retry_limit','\x20(use\x20--limit\x20to\x20see\x20more)','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','Schedule\x20created:\x20','schedule:run','8574618VvCsft','Failed\x20to\x20read\x20file:\x20','args','json','count','4630336iUaNxM','\x20\x20Time:\x20','tsv','timezone','file','end_at','error','\x20\x20Job\x20ID:\x20','Getting\x20schedule\x20history...','keys','Creating\x20schedule:\x20','name','engine_version','\x20created','next_run_at','ies','in\x20','Deleting\x20schedule...','from','Updating\x20schedule:\x20','site','delay','4878627QPHHkt','description','abs','Create\x20a\x20scheduled\x20query','length','Running\x20schedule...'];a36_0x41f8=function(){return _0x566ecc;};return a36_0x41f8();}import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a36_0x4e9be7 from'chalk';function formatRelativeTime(_0x52e01b){const _0x331a8b=a36_0x2dfe,_0x28d95e=new Date(_0x52e01b),_0x4fca65=new Date(),_0x556617=_0x28d95e[_0x331a8b(0x175)]()-_0x4fca65[_0x331a8b(0x175)](),_0x181bd6=Math[_0x331a8b(0x16f)](_0x556617)/0x3e8,_0x88dd57=_0x556617<0x0;if(_0x181bd6<0x3c)return _0x88dd57?'just\x20now':_0x331a8b(0x140);else{if(_0x181bd6<0xe10){const _0x3f077c=Math[_0x331a8b(0x1d1)](_0x181bd6/0x3c);return _0x88dd57?_0x3f077c+_0x331a8b(0x1cc):_0x331a8b(0x167)+_0x3f077c+'m';}else{if(_0x181bd6<0x15180){const _0x10665b=Math['round'](_0x181bd6/0xe10);return _0x88dd57?_0x10665b+_0x331a8b(0x1ba):_0x331a8b(0x167)+_0x10665b+'h';}else{if(_0x181bd6<0x93a80){const _0xfbefcb=Math[_0x331a8b(0x1d1)](_0x181bd6/0x15180);return _0x88dd57?_0xfbefcb+_0x331a8b(0x1d3):'in\x20'+_0xfbefcb+'d';}else return _0x28d95e[_0x331a8b(0x1a2)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x2ca1eb(0x162)]=a36_0x2ca1eb(0x181);['description']=a36_0x2ca1eb(0x186);async[a36_0x2ca1eb(0x1a0)](_0x5638e1){const _0x16e1a5=a36_0x2ca1eb,{options:_0x51b69e,args:_0x2f6a94,tdx:_0xa3dcf1}=_0x5638e1,_0x43a6c2=resolveLimit(_0x51b69e[_0x16e1a5(0x149)],DEFAULT_DISPLAY_LIMIT),_0x28ab49=_0x2f6a94[0x0],_0x4d46ad=_0x28ab49?_0x16e1a5(0x182)+_0x28ab49+_0x16e1a5(0x1ae):'Listing\x20scheduled\x20queries...',_0x165991=await withSpinner(_0x4d46ad,()=>_0xa3dcf1[_0x16e1a5(0x1d2)][_0x16e1a5(0x1ce)]({'limit':_0x43a6c2,'scheduled':!![],'pattern':_0x28ab49}),{'verbose':_0x51b69e[_0x16e1a5(0x147)]}),_0xf2ac06=_0x165991['data']['queries'],_0x420522=_0x165991[_0x16e1a5(0x1c0)][_0x16e1a5(0x1c3)][_0x16e1a5(0x18c)],_0x47134b=_0x28ab49?'\x20matching\x20\x22'+_0x28ab49+'\x22':'';_0x420522?console[_0x16e1a5(0x15d)](_0x16e1a5(0x178)+_0xf2ac06[_0x16e1a5(0x171)]+_0x16e1a5(0x146)+_0x47134b+_0x16e1a5(0x14e)):console['error'](_0x16e1a5(0x1a6)+_0xf2ac06[_0x16e1a5(0x171)]+_0x16e1a5(0x18f)+(_0xf2ac06[_0x16e1a5(0x171)]!==0x1?_0x16e1a5(0x166):'y')+_0x47134b);if(_0x51b69e['format']===_0x16e1a5(0x155)||_0x51b69e[_0x16e1a5(0x1b2)]==='jsonl'||_0x51b69e[_0x16e1a5(0x1b2)]==='table'||_0x51b69e[_0x16e1a5(0x1b2)]===_0x16e1a5(0x159)){const _0x4a22eb=_0xf2ac06[_0x16e1a5(0x14a)](_0x4f468b=>({'id':_0x4f468b['id'],'name':_0x4f468b[_0x16e1a5(0x162)],'cron':_0x4f468b['cron'],'database':_0x4f468b[_0x16e1a5(0x1d4)]?.[_0x16e1a5(0x162)],'type':_0x4f468b['type'],'timezone':_0x4f468b[_0x16e1a5(0x1cd)],'user_name':_0x4f468b[_0x16e1a5(0x184)]?.['name'],'updated_at':_0x4f468b['updated_at'],'next_run_at':_0x4f468b[_0x16e1a5(0x165)],'last_job_status':_0x4f468b[_0x16e1a5(0x187)]?.[_0x16e1a5(0x185)]}));await handleSDKOutput(_0x4a22eb,_0x51b69e);}else{if(_0xf2ac06[_0x16e1a5(0x171)]===0x0)console[_0x16e1a5(0x1d0)](_0x16e1a5(0x1ca));else{const _0xaf7300=_0x51b69e[_0x16e1a5(0x16b)],_0x2273e5=_0xf2ac06[_0x16e1a5(0x14a)](_0x4754e9=>{const _0x2397f1=_0x16e1a5,_0x11eaf9=_0x4754e9[_0x2397f1(0x187)]?.['status']?_0x4754e9[_0x2397f1(0x187)][_0x2397f1(0x185)]===_0x2397f1(0x14c)?'✓':'✗':'-',_0x1a45c9=_0x4754e9[_0x2397f1(0x187)]?.[_0x2397f1(0x1b6)]?formatRelativeTime(_0x4754e9[_0x2397f1(0x187)]['ended_at']):'never',_0x51e983=_0x4754e9['next_run_at']?formatRelativeTime(_0x4754e9[_0x2397f1(0x165)]):'-',_0x186d23=_0x4754e9[_0x2397f1(0x1b8)]||'',_0x2003f1=_0x4754e9['name']||_0x2397f1(0x1d5),_0xbf624b=getConsoleUrl(_0xaf7300,'/app/queries/editor?queryId='+_0x4754e9['id']);return{'statusIcon':_0x11eaf9,'lastRun':_0x1a45c9,'nextRun':_0x51e983,'cron':_0x186d23,'name':_0x2003f1,'queryUrl':_0xbf624b,'status':_0x4754e9['last_job']?.['status']};}),_0x7d43dd=Math['max'](..._0x2273e5[_0x16e1a5(0x14a)](_0xe8f3fb=>_0xe8f3fb[_0x16e1a5(0x19e)][_0x16e1a5(0x171)])),_0x46c7cc=Math[_0x16e1a5(0x177)](..._0x2273e5[_0x16e1a5(0x14a)](_0xb7c928=>_0xb7c928['nextRun'][_0x16e1a5(0x171)])),_0x4b32e1=Math[_0x16e1a5(0x177)](..._0x2273e5[_0x16e1a5(0x14a)](_0x29ac24=>_0x29ac24['cron']['length'])),_0x553136=_0x2273e5['map'](_0x1a7609=>{const _0xc2f35d=_0x16e1a5,_0x49bfef=_0x1a7609[_0xc2f35d(0x185)]===_0xc2f35d(0x14c)?a36_0x4e9be7[_0xc2f35d(0x18a)](_0x1a7609['statusIcon']):_0x1a7609[_0xc2f35d(0x185)]===_0xc2f35d(0x15d)?a36_0x4e9be7[_0xc2f35d(0x19a)](_0x1a7609[_0xc2f35d(0x1ad)]):a36_0x4e9be7[_0xc2f35d(0x1b5)](_0x1a7609['statusIcon']),_0x53a69e=_0x1a7609[_0xc2f35d(0x19e)]['padEnd'](_0x7d43dd),_0x5cf0dc=_0x1a7609[_0xc2f35d(0x195)][_0xc2f35d(0x193)](_0x46c7cc),_0x26b260=_0x1a7609[_0xc2f35d(0x1b8)]?a36_0x4e9be7[_0xc2f35d(0x1a1)](_0x1a7609[_0xc2f35d(0x1b8)]['padEnd'](_0x4b32e1)):'\x20'['repeat'](_0x4b32e1),_0x380ac7=hyperlink(_0x1a7609[_0xc2f35d(0x162)],_0x1a7609[_0xc2f35d(0x1af)]);return'📅\x20'+_0x49bfef+'\x20'+_0x53a69e+_0xc2f35d(0x1b3)+_0x5cf0dc+'\x20\x20'+_0x26b260+'\x20\x20'+_0x380ac7;});await writeOutput(_0x553136[_0x16e1a5(0x1cb)]('\x0a'),_0x51b69e[_0x16e1a5(0x1b7)],_0x16e1a5(0x198));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x2ca1eb(0x162)]=a36_0x2ca1eb(0x196);['description']=a36_0x2ca1eb(0x17d);['validate'](_0x3007c1){const _0xa7473c=a36_0x2ca1eb,_0x506b24=_0x3007c1[_0xa7473c(0x154)][0x0];if(!_0x506b24)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async[a36_0x2ca1eb(0x1a0)](_0x5634a2){const _0x2a4cbc=a36_0x2ca1eb,{options:_0x2d6344,args:_0x2e555f,tdx:_0x2c04af}=_0x5634a2,_0x43481f=_0x2e555f[0x0],_0x54a2ff=await withSpinner(_0x2a4cbc(0x1c7),()=>_0x2c04af[_0x2a4cbc(0x1d2)][_0x2a4cbc(0x17a)](_0x43481f),{'verbose':_0x2d6344[_0x2a4cbc(0x147)]}),_0x4097cd=_0x54a2ff[_0x2a4cbc(0x1c0)],_0x12ea2b={'name':_0x4097cd[_0x2a4cbc(0x162)],'cron':_0x4097cd[_0x2a4cbc(0x1b8)],'database':_0x4097cd[_0x2a4cbc(0x1d4)],'type':_0x4097cd['type'],'timezone':_0x4097cd[_0x2a4cbc(0x15a)],'user_name':_0x4097cd['user_name'],'created_at':_0x4097cd[_0x2a4cbc(0x1b9)],'engine_version':_0x4097cd[_0x2a4cbc(0x163)],'executing_user_id':_0x4097cd[_0x2a4cbc(0x19f)],'query':_0x4097cd['query'],'delay':_0x4097cd[_0x2a4cbc(0x16c)],'priority':_0x4097cd[_0x2a4cbc(0x1b4)],'retry_limit':_0x4097cd['retry_limit'],..._0x4097cd[_0x2a4cbc(0x1be)]&&{'result':_0x4097cd[_0x2a4cbc(0x1be)]}};return await handleSingleObjectOutput(_0x12ea2b,_0x2d6344),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x2ca1eb(0x162)]=a36_0x2ca1eb(0x1c9);[a36_0x2ca1eb(0x16e)]=a36_0x2ca1eb(0x170);[a36_0x2ca1eb(0x1a9)](_0x2bcd9d){const _0x419eeb=a36_0x2ca1eb,_0x104c2b=_0x2bcd9d['args'][0x0];if(!_0x104c2b)return _0x419eeb(0x188);const _0x30da9b=_0x2bcd9d[_0x419eeb(0x183)];if(!_0x30da9b[_0x419eeb(0x1d4)])return _0x419eeb(0x199);return undefined;}async[a36_0x2ca1eb(0x1a0)](_0x3a0e1e){const _0x4c1121=a36_0x2ca1eb,{options:_0x267cdb,args:_0x575a20,tdx:_0x2ba4ee}=_0x3a0e1e,_0x1a3483=_0x575a20[0x0],_0x43490a=_0x267cdb,_0x46d4fd=_0x43490a[_0x4c1121(0x1d4)],_0x3125c9=_0x43490a['file'],_0x9ec594=_0x43490a[_0x4c1121(0x192)]||_0x4c1121(0x174);let _0x3e3159;try{_0x3e3159=readFileSync(_0x3125c9,_0x4c1121(0x17f))[_0x4c1121(0x1c2)]();}catch(_0x107bc2){throw new SDKError(ErrorCode[_0x4c1121(0x173)],_0x4c1121(0x153)+_0x3125c9,_0x107bc2 instanceof Error?_0x107bc2:undefined);}if(!_0x3e3159)throw new SDKError(ErrorCode[_0x4c1121(0x173)],_0x4c1121(0x141));const _0x81b0db={'database':_0x46d4fd,'query':_0x3e3159,'type':_0x9ec594};if(_0x43490a[_0x4c1121(0x1b8)])_0x81b0db[_0x4c1121(0x1b8)]=_0x43490a[_0x4c1121(0x1b8)];if(_0x43490a[_0x4c1121(0x15a)])_0x81b0db[_0x4c1121(0x15a)]=_0x43490a[_0x4c1121(0x15a)];if(_0x43490a[_0x4c1121(0x16c)]!==undefined)_0x81b0db[_0x4c1121(0x16c)]=Number(_0x43490a[_0x4c1121(0x16c)]);if(_0x43490a[_0x4c1121(0x1b4)]!==undefined)_0x81b0db[_0x4c1121(0x1b4)]=Number(_0x43490a['priority']);if(_0x43490a[_0x4c1121(0x144)]!==undefined)_0x81b0db['retry_limit']=Number(_0x43490a[_0x4c1121(0x144)]);if(_0x43490a['engineVersion'])_0x81b0db[_0x4c1121(0x163)]=_0x43490a[_0x4c1121(0x1a3)];if(_0x43490a[_0x4c1121(0x1be)])_0x81b0db[_0x4c1121(0x1be)]=_0x43490a[_0x4c1121(0x1be)];if(_0x267cdb[_0x4c1121(0x147)]){console[_0x4c1121(0x15d)](_0x4c1121(0x161)+_0x1a3483),console[_0x4c1121(0x15d)](_0x4c1121(0x1b0)+_0x46d4fd),console['error'](_0x4c1121(0x1c1)+_0x9ec594);if(_0x81b0db[_0x4c1121(0x1b8)])console[_0x4c1121(0x15d)](_0x4c1121(0x1c5)+_0x81b0db[_0x4c1121(0x1b8)]);if(_0x81b0db['timezone'])console[_0x4c1121(0x15d)](_0x4c1121(0x197)+_0x81b0db[_0x4c1121(0x15a)]);}const _0x2e73ea=await withSpinner(_0x4c1121(0x1a7),()=>_0x2ba4ee[_0x4c1121(0x1d2)][_0x4c1121(0x143)](_0x1a3483,_0x81b0db),{'verbose':_0x267cdb[_0x4c1121(0x147)]});return console[_0x4c1121(0x15d)](_0x4c1121(0x150)+_0x2e73ea[_0x4c1121(0x1c0)][_0x4c1121(0x162)]),await handleSingleObjectOutput(_0x2e73ea[_0x4c1121(0x1c0)],_0x267cdb),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x2ca1eb(0x162)]='schedule:update';[a36_0x2ca1eb(0x16e)]=a36_0x2ca1eb(0x19b);[a36_0x2ca1eb(0x1a9)](_0x4376bc){const _0x1c4abf=a36_0x2ca1eb,_0x3292b4=_0x4376bc[_0x1c4abf(0x154)][0x0];if(!_0x3292b4)return _0x1c4abf(0x17b);return undefined;}async['execute'](_0x4da469){const _0x125122=a36_0x2ca1eb,{options:_0xc2b4b4,args:_0x17dec3,tdx:_0x5893f6}=_0x4da469,_0x12e871=_0x17dec3[0x0],_0x183789=_0xc2b4b4,_0x2f5107={};if(_0x183789[_0x125122(0x1d4)])_0x2f5107[_0x125122(0x1d4)]=_0x183789[_0x125122(0x1d4)];if(_0x183789[_0x125122(0x192)])_0x2f5107[_0x125122(0x192)]=_0x183789[_0x125122(0x192)];if(_0x183789[_0x125122(0x1b8)])_0x2f5107['cron']=_0x183789['cron'];if(_0x183789[_0x125122(0x15a)])_0x2f5107['timezone']=_0x183789[_0x125122(0x15a)];if(_0x183789[_0x125122(0x16c)]!==undefined)_0x2f5107[_0x125122(0x16c)]=Number(_0x183789[_0x125122(0x16c)]);if(_0x183789['priority']!==undefined)_0x2f5107[_0x125122(0x1b4)]=Number(_0x183789[_0x125122(0x1b4)]);if(_0x183789['retryLimit']!==undefined)_0x2f5107[_0x125122(0x14d)]=Number(_0x183789[_0x125122(0x144)]);if(_0x183789[_0x125122(0x1a3)])_0x2f5107[_0x125122(0x163)]=_0x183789[_0x125122(0x1a3)];if(_0x183789[_0x125122(0x1be)])_0x2f5107[_0x125122(0x1be)]=_0x183789[_0x125122(0x1be)];if(_0x183789[_0x125122(0x15b)])try{_0x2f5107['query']=readFileSync(_0x183789[_0x125122(0x15b)],_0x125122(0x17f))['trim']();}catch(_0x24bed2){throw new SDKError(ErrorCode[_0x125122(0x173)],_0x125122(0x153)+_0x183789['file'],_0x24bed2 instanceof Error?_0x24bed2:undefined);}if(Object[_0x125122(0x160)](_0x2f5107)[_0x125122(0x171)]===0x0)throw new SDKError(ErrorCode[_0x125122(0x173)],_0x125122(0x1bc));if(_0xc2b4b4[_0x125122(0x147)]){console['error'](_0x125122(0x16a)+_0x12e871);for(const [_0x2bc07f,_0x49cd2f]of Object['entries'](_0x2f5107)){_0x2bc07f===_0x125122(0x1c4)?console[_0x125122(0x15d)]('\x20\x20'+_0x2bc07f+':\x20'+_0x49cd2f[_0x125122(0x180)](0x0,0x32)+_0x125122(0x14b)):console[_0x125122(0x15d)]('\x20\x20'+_0x2bc07f+':\x20'+_0x49cd2f);}}const _0x49666b=await withSpinner(_0x125122(0x17e),()=>_0x5893f6[_0x125122(0x1d2)]['update'](_0x12e871,_0x2f5107),{'verbose':_0xc2b4b4[_0x125122(0x147)]});return console[_0x125122(0x15d)]('Schedule\x20updated:\x20'+_0x49666b[_0x125122(0x1c0)][_0x125122(0x162)]),await handleSingleObjectOutput(_0x49666b['data'],_0xc2b4b4),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x2ca1eb(0x162)]=a36_0x2ca1eb(0x1a8);[a36_0x2ca1eb(0x16e)]=a36_0x2ca1eb(0x190);['validate'](_0x563797){const _0x4fffb2=a36_0x2ca1eb,_0x495650=_0x563797[_0x4fffb2(0x154)][0x0];if(!_0x495650)return _0x4fffb2(0x14f);return undefined;}async[a36_0x2ca1eb(0x1a0)](_0x2ae98){const _0x5d2ba5=a36_0x2ca1eb,{options:_0x24d812,args:_0x4a42a1,tdx:_0x419dfb}=_0x2ae98,_0x39d62b=_0x4a42a1[0x0];if(!_0x24d812[_0x5d2ba5(0x1a4)]){const _0x24176f=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22'+_0x39d62b+'\x22?');if(!_0x24176f)return console[_0x5d2ba5(0x15d)](_0x5d2ba5(0x1cf)),0x0;}const _0x559da1=await withSpinner(_0x5d2ba5(0x168),()=>_0x419dfb[_0x5d2ba5(0x1d2)][_0x5d2ba5(0x145)](_0x39d62b),{'verbose':_0x24d812[_0x5d2ba5(0x147)]});return console[_0x5d2ba5(0x15d)](_0x5d2ba5(0x189)+_0x559da1[_0x5d2ba5(0x1c0)][_0x5d2ba5(0x162)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x2ca1eb(0x162)]=a36_0x2ca1eb(0x151);[a36_0x2ca1eb(0x16e)]=a36_0x2ca1eb(0x1bf);[a36_0x2ca1eb(0x1a9)](_0x4a7c0d){const _0x247ba3=a36_0x2ca1eb,_0x431e75=_0x4a7c0d[_0x247ba3(0x154)][0x0];if(!_0x431e75)return _0x247ba3(0x1bb);return undefined;}async[a36_0x2ca1eb(0x1a0)](_0x3d9d65){const _0x4bde7b=a36_0x2ca1eb,{options:_0x381d41,args:_0xb27385,tdx:_0x2c667a}=_0x3d9d65,_0xdb1a39=_0xb27385[0x0],_0x3e78dc=_0x381d41,_0x24cab1=_0x3e78dc[_0x4bde7b(0x18b)],_0x5c6c83=_0x3e78dc[_0x4bde7b(0x1ab)]!==undefined?Number(_0x3e78dc[_0x4bde7b(0x1ab)]):undefined;if(_0x381d41[_0x4bde7b(0x147)]){console[_0x4bde7b(0x15d)](_0x4bde7b(0x19c)+_0xdb1a39);if(_0x24cab1)console['error'](_0x4bde7b(0x158)+_0x24cab1);if(_0x5c6c83)console['error'](_0x4bde7b(0x1aa)+_0x5c6c83);}const _0xd67737=await withSpinner(_0x4bde7b(0x172),()=>_0x2c667a['schedules'][_0x4bde7b(0x1c6)](_0xdb1a39,{'time':_0x24cab1,'num':_0x5c6c83}),{'verbose':_0x381d41[_0x4bde7b(0x147)]}),_0x1ab302=_0xd67737[_0x4bde7b(0x1c0)][_0x4bde7b(0x17c)];console[_0x4bde7b(0x15d)](_0x4bde7b(0x176)+_0x1ab302['length']+'\x20job'+(_0x1ab302[_0x4bde7b(0x171)]!==0x1?'s':'')+_0x4bde7b(0x164));for(const _0x39f5e5 of _0x1ab302){console[_0x4bde7b(0x15d)](_0x4bde7b(0x15e)+_0x39f5e5[_0x4bde7b(0x18d)]);}return await handleSDKOutput(_0x1ab302,_0x381d41),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x2ca1eb(0x162)]=a36_0x2ca1eb(0x19d);[a36_0x2ca1eb(0x16e)]='Show\x20schedule\x20execution\x20history';[a36_0x2ca1eb(0x1a9)](_0x29a979){const _0x13e0b2=a36_0x2ca1eb,_0x3872e7=_0x29a979[_0x13e0b2(0x154)][0x0];if(!_0x3872e7)return _0x13e0b2(0x18e);return undefined;}async[a36_0x2ca1eb(0x1a0)](_0x32a5d3){const _0x276b14=a36_0x2ca1eb,{options:_0x172975,args:_0x1427a0,tdx:_0x4b2200}=_0x32a5d3,_0x5c105b=_0x1427a0[0x0],_0x59db0a=_0x172975,_0x5df5bd=_0x59db0a[_0x276b14(0x169)]!==undefined?Number(_0x59db0a['from']):undefined,_0x2d4a56=_0x59db0a['to']!==undefined?Number(_0x59db0a['to']):undefined,_0xe8be97=await withSpinner(_0x276b14(0x15f),()=>_0x4b2200[_0x276b14(0x1d2)]['history'](_0x5c105b,{'from':_0x5df5bd,'to':_0x2d4a56}),{'verbose':_0x172975[_0x276b14(0x147)]}),_0x4d6fd5=_0xe8be97[_0x276b14(0x1c0)];console[_0x276b14(0x15d)](_0x276b14(0x1a6)+_0x4d6fd5['count']+_0x276b14(0x1c8)+(_0x4d6fd5[_0x276b14(0x156)]!==0x1?'s':'')+_0x276b14(0x179)+_0x4d6fd5[_0x276b14(0x169)]+'-'+_0x4d6fd5['to']+')');const _0x46c8da=_0x4d6fd5[_0x276b14(0x1a5)][_0x276b14(0x14a)](_0x4e18de=>({'job_id':_0x4e18de[_0x276b14(0x18d)],'type':_0x4e18de[_0x276b14(0x192)],'status':_0x4e18de[_0x276b14(0x185)],'scheduled_at':_0x4e18de[_0x276b14(0x1ac)],'created_at':_0x4e18de[_0x276b14(0x1b9)],'start_at':_0x4e18de['start_at'],'end_at':_0x4e18de[_0x276b14(0x15c)]}));return await handleSDKOutput(_0x46c8da,_0x172975),0x0;}}
@@ -1 +1 @@
1
- const a37_0x44be62=a37_0x4c9d;(function(_0x379947,_0x9a38e4){const _0x41ba6c=a37_0x4c9d,_0x4a0907=_0x379947();while(!![]){try{const _0x44e551=-parseInt(_0x41ba6c(0x1fe))/0x1+-parseInt(_0x41ba6c(0x1f6))/0x2*(parseInt(_0x41ba6c(0x205))/0x3)+-parseInt(_0x41ba6c(0x1cb))/0x4+parseInt(_0x41ba6c(0x1f0))/0x5*(-parseInt(_0x41ba6c(0x1d3))/0x6)+-parseInt(_0x41ba6c(0x241))/0x7*(-parseInt(_0x41ba6c(0x218))/0x8)+-parseInt(_0x41ba6c(0x1d8))/0x9+parseInt(_0x41ba6c(0x1f1))/0xa;if(_0x44e551===_0x9a38e4)break;else _0x4a0907['push'](_0x4a0907['shift']());}catch(_0x105c84){_0x4a0907['push'](_0x4a0907['shift']());}}}(a37_0x245b,0xe2a08));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';function a37_0x4c9d(_0x3041f2,_0x42eba5){_0x3041f2=_0x3041f2-0x1bb;const _0x245bba=a37_0x245b();let _0x4c9d04=_0x245bba[_0x3041f2];return _0x4c9d04;}import{openBrowser}from'../utils/process.js';import a37_0x335953 from'chalk';async function resolveSegmentTarget(_0x3a16ee,_0x39d490,_0x405d9a){const _0x2ab00a=a37_0x4c9d;if(isYamlFilePath(_0x3a16ee))try{const _0x3a3363=await resolveYamlFilePath(_0x3a16ee);return _0x405d9a&&(console[_0x2ab00a(0x200)](_0x2ab00a(0x21b)+_0x3a16ee),console[_0x2ab00a(0x200)]('\x20\x20Parent\x20segment:\x20'+_0x3a3363[_0x2ab00a(0x1cd)]),console[_0x2ab00a(0x200)](_0x2ab00a(0x23f)+_0x3a3363[_0x2ab00a(0x224)]),console[_0x2ab00a(0x200)](_0x2ab00a(0x23b)+(_0x3a3363[_0x2ab00a(0x232)]||_0x2ab00a(0x1c0))),console['error'](_0x2ab00a(0x1f9)+_0x3a3363[_0x2ab00a(0x1bd)])),_0x3a3363[_0x2ab00a(0x1bd)];}catch(_0x3cc691){throw new SDKError(ErrorCode[_0x2ab00a(0x219)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x3cc691[_0x2ab00a(0x201)]);}if(!_0x39d490)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2ab00a(0x1d0));return _0x39d490+'/'+_0x3a16ee;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x44be62(0x251)]=a37_0x44be62(0x23e);[a37_0x44be62(0x207)]=a37_0x44be62(0x225);async[a37_0x44be62(0x236)](_0x3a2417){const _0x903743=a37_0x44be62,{options:_0x181a6e,args:_0x55c881,tdx:_0x222afd}=_0x3a2417,_0x16db21=_0x55c881[0x0],_0x35c9e3=!_0x16db21&&!!_0x181a6e[_0x903743(0x1cd)],_0x14790c=_0x16db21||_0x181a6e[_0x903743(0x1cd)];if(!_0x14790c)return console[_0x903743(0x200)](_0x903743(0x212)),console[_0x903743(0x200)](_0x903743(0x249)),console['error']('Examples:'),console[_0x903743(0x200)](_0x903743(0x1ec)),console['error']('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console[_0x903743(0x200)](_0x903743(0x24d)),console['error'](_0x903743(0x20d)),0x1;try{const _0x2aea7a=_0x181a6e[_0x903743(0x244)];let _0x39690c=_0x14790c;!_0x35c9e3&&_0x2aea7a&&!_0x14790c['includes']('/')&&(_0x39690c=_0x2aea7a+'/'+_0x14790c,_0x181a6e[_0x903743(0x253)]&&console[_0x903743(0x200)]('Resolved\x20relative\x20path\x20to:\x20'+_0x39690c));const _0x312060=await withSpinner(_0x903743(0x1bb)+_0x39690c+_0x903743(0x1e6),()=>_0x222afd['segment'][_0x903743(0x233)](_0x39690c),{'verbose':_0x181a6e[_0x903743(0x253)]}),_0x474765=_0x312060['data'];_0x181a6e[_0x903743(0x253)]&&(console['error'](_0x903743(0x1e2)+_0x474765[_0x903743(0x1c3)]),console[_0x903743(0x200)](_0x903743(0x248)+_0x474765[_0x903743(0x1ee)]),_0x474765[_0x903743(0x1fd)]&&console[_0x903743(0x200)](_0x903743(0x1e8)+_0x474765[_0x903743(0x1fd)]),_0x474765[_0x903743(0x254)]&&console[_0x903743(0x200)](_0x903743(0x238)+_0x474765[_0x903743(0x254)]));if(_0x474765[_0x903743(0x1c3)]==='parent'){const _0x256334=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x222afd[_0x903743(0x239)]['getParent'](_0x474765[_0x903743(0x1ee)]),{'verbose':_0x181a6e[_0x903743(0x253)]});await handleSingleObjectOutput(_0x256334[_0x903743(0x257)],_0x181a6e);}else{if(_0x474765[_0x903743(0x1c3)]===_0x903743(0x231)){if(!_0x474765[_0x903743(0x1fd)])throw new SDKError(ErrorCode[_0x903743(0x229)],_0x903743(0x22d));const _0x544c8e=await withSpinner(_0x903743(0x22e),()=>_0x222afd[_0x903743(0x239)]['getFolder'](_0x474765['folderId']),{'verbose':_0x181a6e['verbose']});await handleSingleObjectOutput(_0x544c8e['data'],_0x181a6e);}else{if(_0x474765[_0x903743(0x1c3)]===_0x903743(0x239)){if(!_0x474765[_0x903743(0x254)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x903743(0x227));const _0x39bd4c=await withSpinner(_0x903743(0x1ff),()=>_0x222afd[_0x903743(0x239)]['getSegment'](_0x474765['parentId'],_0x474765[_0x903743(0x254)]),{'verbose':_0x181a6e[_0x903743(0x253)]});await handleSingleObjectOutput(_0x39bd4c['data'],_0x181a6e);}}}return 0x0;}catch(_0x3bec85){if(_0x3bec85 instanceof SDKError)return console[_0x903743(0x200)](_0x903743(0x24f)+_0x3bec85[_0x903743(0x201)]),_0x3bec85[_0x903743(0x246)]&&console[_0x903743(0x200)]('\x20\x20Cause:\x20'+_0x3bec85[_0x903743(0x246)]),0x1;throw _0x3bec85;}}}function a37_0x245b(){const _0x327bcd=['Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Use:\x20tdx\x20ps\x20view\x20-w','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','Resolving\x20path\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','fullPath','Parent\x20segment:\x20','site','(root)','query','SELECT\x20*\x20FROM\x20(\x0a','type','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','✔\x20Created\x20folder\x20\x27','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','test','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','6647908CKAbML','Resolved:\x20','parentSegment','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Options:','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','content','192ZyGdiW','resolveFolderId','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Resolved\x20parent\x20folder\x20ID:\x20','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','621153FzWJhX','limit','segment:folder:list','jobId','✔\x20Found\x20','getFolder','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Examples:','path','Site:\x20','Resolved\x20type:\x20','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Show\x20folder\x20or\x20child\x20segment\x20details','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x27...','Resolving\x20parent\x20segment\x20\x27','Folder\x20ID:\x20','SEGMENT_NOT_FOUND','Usage:','segment:view','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','parentId','segment:folder:create','175580ZAezjW','61979650GCiMhi','parent','\x20[Job\x20ID:\x20','resolveParentId','/e/','14132mcwyRc','\x20Opening\x20','Resolved\x20folder\x20ID:\x20','\x20\x20Full\x20path:\x20','Create\x20segment\x20folder\x20for\x20organization','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Fetching\x20folder\x20\x27','folderId','808841RdLsxm','Fetching\x20segment\x20details...','error','message','Fetching\x20SQL\x20from\x20rule...','cyan','stats','735drNGMz','Resolving\x20folder\x20\x27','description','Listing\x20folders\x20for\x20parent\x20\x27','processedRows','/app/ps/','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','getSQLFromYamlFile','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Fetching\x20SQL\x20for\x20segment...','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Use:\x20tdx\x20ps\x20view','listFolders','Error:\x20Path\x20or\x20name\x20is\x20required','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Creating\x20folder\x20\x27','Folder\x20name:\x20','createFolder','Target\x20path:\x20','24SEOYmI','INVALID_ARGUMENT','trim','Resolved\x20YAML\x20file:\x20','web','segment:sql','format','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Resolving\x20\x27','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','length','segmentName','Show\x20segment\x20or\x20folder\x20details','\x20\x20Cause:\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','getSegmentSQLFromYaml','SEGMENT_FOLDER_NOT_FOUND','in\x20','Resolved\x20parent\x20ID:\x20','Show\x20segment\x20folder\x20details','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Fetching\x20folder\x20details...','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','elapsedTimeMillis','folder','folderPath','resolvePathToResource','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','execute','\x20folder','Segment\x20ID:\x20','segment','getSegmentSQL','\x20\x20Folder\x20path:\x20','toLocaleString','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','segment:describe','\x20\x20Segment\x20name:\x20','setJobId','291704EwVciG','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','segmentPath','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','cause','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Parent\x20ID:\x20','Usage:\x20tdx\x20segment\x20describe\x20<path>','Parent\x20name:\x20','Executing\x20segment\x20query...','✔\x20Query\x20completed:\x20Processed\x20','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Error:\x20Parent\x20segment\x20name\x20is\x20required','Error:\x20','Error:\x20Folder\x20reference\x20is\x20required','name','getSegment','verbose','segmentId','red','parentFolder','data','Usage:\x20tdx\x20sg\x20desc\x20<name>','Get\x20SQL\x20query\x20for\x20child\x20segment','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','getSQLFromServerSegment','✖\x20Query\x20failed\x20['];a37_0x245b=function(){return _0x327bcd;};return a37_0x245b();}export class SegmentShowCommand extends BaseCommand{[a37_0x44be62(0x251)]='segment:show';[a37_0x44be62(0x207)]=a37_0x44be62(0x1c5);async[a37_0x44be62(0x236)](_0x4e8ecc){const _0x38653a=a37_0x44be62,{options:_0x4ec81a,args:_0x421b3a,tdx:_0x5cce71}=_0x4e8ecc,_0x2d0508=_0x421b3a[0x0];if(!_0x2d0508)return console['error']('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error']('Usage:\x20tdx\x20sg\x20show\x20<name>'),console[_0x38653a(0x200)](_0x38653a(0x23d)),console[_0x38653a(0x200)]('Examples:'),console[_0x38653a(0x200)](_0x38653a(0x247)),console[_0x38653a(0x200)](_0x38653a(0x245)),0x1;try{const _0x16f9a1=_0x4ec81a[_0x38653a(0x1cd)],_0x3f92bd=await resolveSegmentTarget(_0x2d0508,_0x16f9a1,_0x4ec81a[_0x38653a(0x253)]);_0x4ec81a[_0x38653a(0x253)]&&console[_0x38653a(0x200)](_0x38653a(0x217)+_0x3f92bd);const _0x24f898=await withSpinner(_0x38653a(0x220)+_0x2d0508+_0x38653a(0x1e6),()=>_0x5cce71[_0x38653a(0x239)][_0x38653a(0x233)](_0x3f92bd),{'verbose':_0x4ec81a[_0x38653a(0x253)]}),_0x216aa7=_0x24f898['data'];_0x4ec81a['verbose']&&(console[_0x38653a(0x200)](_0x38653a(0x1e2)+_0x216aa7[_0x38653a(0x1c3)]),console['error'](_0x38653a(0x248)+_0x216aa7[_0x38653a(0x1ee)]));if(_0x216aa7[_0x38653a(0x1c3)]===_0x38653a(0x231))return console[_0x38653a(0x200)](_0x38653a(0x25a)),console[_0x38653a(0x200)](_0x38653a(0x243)),0x1;if(_0x216aa7[_0x38653a(0x1c3)]==='parent')return console[_0x38653a(0x200)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x38653a(0x200)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x216aa7[_0x38653a(0x254)])throw new SDKError(ErrorCode[_0x38653a(0x1e9)],_0x38653a(0x227));const _0x2ed5ca=await withSpinner(_0x38653a(0x20e),()=>_0x5cce71[_0x38653a(0x239)][_0x38653a(0x23a)](_0x216aa7[_0x38653a(0x1ee)],_0x216aa7['segmentId']),{'verbose':_0x4ec81a[_0x38653a(0x253)]});let _0x13cc97=_0x2ed5ca[_0x38653a(0x257)];const _0x1bd7c8=resolveLimit(_0x4ec81a[_0x38653a(0x1d9)],DEFAULT_DISPLAY_LIMIT),_0x3e01bd=/\bLIMIT\s+\d+/i[_0x38653a(0x1c9)](_0x13cc97);!_0x3e01bd&&(_0x13cc97=_0x13cc97[_0x38653a(0x21a)]()['replace'](/;+$/,''),_0x13cc97=_0x38653a(0x1c2)+_0x13cc97+_0x38653a(0x1e5)+_0x1bd7c8);_0x4ec81a['verbose']&&console[_0x38653a(0x200)]('SQL\x20query:\x0a'+_0x13cc97);const _0x2edd20=await withProgressSpinner(_0x38653a(0x24b),async _0x5913d4=>{const _0x2a2bbd=_0x38653a,_0x5c9182=await _0x5cce71[_0x2a2bbd(0x1c1)]['execute'](_0x13cc97,{'catalog':'td','schema':'information_schema','onJobId':_0x3eaec8=>{const _0x4bd660=_0x2a2bbd;_0x5913d4[_0x4bd660(0x240)](_0x3eaec8);}});return _0x5c9182;},{'verbose':_0x4ec81a[_0x38653a(0x253)]}),_0x72e592=_0x2edd20[_0x38653a(0x257)],_0x20899b=_0x72e592[_0x38653a(0x1db)]?_0x38653a(0x1f3)+_0x72e592[_0x38653a(0x1db)]+']':'';return console[_0x38653a(0x200)](_0x38653a(0x24c)+_0x72e592['stats'][_0x38653a(0x209)][_0x38653a(0x23c)]()+'\x20rows\x20'+(_0x38653a(0x22a)+formatElapsed(_0x72e592[_0x38653a(0x204)][_0x38653a(0x230)])+_0x20899b)),await handleQueryOutput(_0x72e592,_0x4ec81a),0x0;}catch(_0x87eec2){if(_0x87eec2 instanceof SDKError)return console['error'](_0x38653a(0x25c)+_0x87eec2['code']+']'),console[_0x38653a(0x200)]('\x0a'+_0x87eec2[_0x38653a(0x201)]),0x1;throw _0x87eec2;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x44be62(0x251)]=a37_0x44be62(0x1da);[a37_0x44be62(0x207)]=a37_0x44be62(0x1d7);async['execute'](_0x14290b){const _0x37206f=a37_0x44be62,{options:_0x11d0b3,args:_0x26d5dd,tdx:_0x780b51}=_0x14290b;if(_0x26d5dd['length']===0x0)return console[_0x37206f(0x200)](_0x37206f(0x24e)),console[_0x37206f(0x200)](_0x37206f(0x242)),0x1;const _0x1aa565=_0x26d5dd[0x0];try{_0x11d0b3[_0x37206f(0x253)]&&(console[_0x37206f(0x200)](_0x37206f(0x1e1)+_0x11d0b3[_0x37206f(0x1bf)]),console['error'](_0x37206f(0x24a)+_0x1aa565));const _0x381290=await withSpinner(_0x37206f(0x1e7)+_0x1aa565+_0x37206f(0x1e6),()=>_0x780b51[_0x37206f(0x239)][_0x37206f(0x1f4)](_0x1aa565),{'verbose':_0x11d0b3[_0x37206f(0x253)]}),_0x32377d=_0x381290[_0x37206f(0x257)];_0x11d0b3[_0x37206f(0x253)]&&console[_0x37206f(0x200)](_0x37206f(0x22b)+_0x32377d);const _0x35aac0=await withSpinner(_0x37206f(0x208)+_0x1aa565+'\x27...',()=>_0x780b51[_0x37206f(0x239)][_0x37206f(0x211)](_0x32377d),{'verbose':_0x11d0b3[_0x37206f(0x253)]}),_0x1b02f0=_0x35aac0[_0x37206f(0x257)];return console[_0x37206f(0x200)](_0x37206f(0x1dc)+_0x1b02f0[_0x37206f(0x223)]+_0x37206f(0x237)+(_0x1b02f0[_0x37206f(0x223)]!==0x1?'s':'')),await handleSDKOutput(_0x1b02f0,_0x11d0b3),0x0;}catch(_0x31701c){if(_0x31701c instanceof SDKError)return console['error']('Error:\x20'+_0x31701c[_0x37206f(0x201)]),_0x31701c[_0x37206f(0x246)]&&console['error'](_0x37206f(0x226)+_0x31701c[_0x37206f(0x246)]),0x1;throw _0x31701c;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x44be62(0x251)]='segment:folder:show';[a37_0x44be62(0x207)]=a37_0x44be62(0x22c);async[a37_0x44be62(0x236)](_0x3f2933){const _0x52fdb3=a37_0x44be62,{options:_0x3c9c62,args:_0x1a3ff1,tdx:_0x3ba2d8}=_0x3f2933;if(_0x1a3ff1[_0x52fdb3(0x223)]===0x0)return console[_0x52fdb3(0x200)](_0x52fdb3(0x250)),console[_0x52fdb3(0x200)](_0x52fdb3(0x1c7)),0x1;try{const {parentId:_0x1ead68,childId:_0x4131e9}=parseSegmentRef(_0x1a3ff1[0x0]);_0x3c9c62[_0x52fdb3(0x253)]&&(console['error'](_0x52fdb3(0x1e1)+_0x3c9c62['site']),console[_0x52fdb3(0x200)](_0x52fdb3(0x24a)+_0x1ead68),_0x4131e9&&console[_0x52fdb3(0x200)](_0x52fdb3(0x215)+_0x4131e9));if(!_0x4131e9)return console['error'](_0x52fdb3(0x1d1)),0x1;const _0x509fd9=await withSpinner(_0x52fdb3(0x1e7)+_0x1ead68+_0x52fdb3(0x1e6),()=>_0x3ba2d8[_0x52fdb3(0x239)][_0x52fdb3(0x1f4)](_0x1ead68),{'verbose':_0x3c9c62['verbose']}),_0x4459eb=_0x509fd9[_0x52fdb3(0x257)];_0x3c9c62['verbose']&&console[_0x52fdb3(0x200)](_0x52fdb3(0x22b)+_0x4459eb);const _0x12f239=await withSpinner(_0x52fdb3(0x206)+_0x4131e9+_0x52fdb3(0x1e6),()=>_0x3ba2d8[_0x52fdb3(0x239)][_0x52fdb3(0x1d4)](_0x4459eb,_0x4131e9),{'verbose':_0x3c9c62[_0x52fdb3(0x253)]}),_0x1cc2c1=_0x12f239[_0x52fdb3(0x257)];_0x3c9c62['verbose']&&console[_0x52fdb3(0x200)](_0x52fdb3(0x1f8)+_0x1cc2c1);const _0x1b20df=await withSpinner(_0x52fdb3(0x1fc)+_0x4131e9+'\x27...',()=>_0x3ba2d8[_0x52fdb3(0x239)][_0x52fdb3(0x1dd)](_0x1cc2c1),{'verbose':_0x3c9c62[_0x52fdb3(0x253)]});return await handleSDKOutput([_0x1b20df[_0x52fdb3(0x257)]],_0x3c9c62),0x0;}catch(_0x234960){if(_0x234960 instanceof SDKError)return console[_0x52fdb3(0x200)](_0x52fdb3(0x24f)+_0x234960[_0x52fdb3(0x201)]),_0x234960[_0x52fdb3(0x246)]&&console[_0x52fdb3(0x200)](_0x52fdb3(0x226)+_0x234960[_0x52fdb3(0x246)]),0x1;throw _0x234960;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a37_0x44be62(0x21d);[a37_0x44be62(0x207)]=a37_0x44be62(0x259);async[a37_0x44be62(0x236)](_0x241ef1){const _0x12a9d2=a37_0x44be62,{options:_0x786ed9,args:_0x442e29}=_0x241ef1,_0x90dea7=_0x786ed9,_0x4e5a64=_0x90dea7[_0x12a9d2(0x1e0)],_0x3d8d3b=_0x442e29[0x0];if(!_0x3d8d3b&&!_0x4e5a64)return console[_0x12a9d2(0x200)](a37_0x335953[_0x12a9d2(0x255)](_0x12a9d2(0x1ed))),console[_0x12a9d2(0x200)](_0x12a9d2(0x1ea)),console[_0x12a9d2(0x200)]('\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>'),console['error'](_0x12a9d2(0x221)),console[_0x12a9d2(0x200)](_0x12a9d2(0x1df)),console['error']('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x12a9d2(0x200)](_0x12a9d2(0x20b)),0x1;if(_0x3d8d3b&&_0x4e5a64)return console[_0x12a9d2(0x200)](a37_0x335953[_0x12a9d2(0x255)](_0x12a9d2(0x234))),0x1;try{let _0x13f794;if(_0x4e5a64)_0x13f794=await this[_0x12a9d2(0x20c)](_0x4e5a64,_0x241ef1);else{if(isYamlFilePath(_0x3d8d3b))return console[_0x12a9d2(0x200)](a37_0x335953[_0x12a9d2(0x255)](_0x12a9d2(0x22f))),console[_0x12a9d2(0x200)](_0x12a9d2(0x1de)+_0x3d8d3b),0x1;else _0x13f794=await this[_0x12a9d2(0x25b)](_0x3d8d3b,_0x241ef1);}return _0x786ed9[_0x12a9d2(0x21e)]==='json'||_0x786ed9['format']==='jsonl'?await handleSDKOutput([{'sql':_0x13f794}],_0x786ed9):console['log'](_0x13f794),0x0;}catch(_0x38e5ee){if(_0x38e5ee instanceof SDKError)return console[_0x12a9d2(0x200)](_0x12a9d2(0x24f)+_0x38e5ee[_0x12a9d2(0x201)]),_0x38e5ee[_0x12a9d2(0x246)]&&console[_0x12a9d2(0x200)](_0x12a9d2(0x226)+_0x38e5ee['cause']),0x1;throw _0x38e5ee;}}async['getSQLFromYamlFile'](_0x200fba,_0x1f3b86){const _0x4c9442=a37_0x44be62,{options:_0x4adaff,tdx:_0x3a65c4}=_0x1f3b86;let _0x3dd9be;try{_0x3dd9be=await resolveYamlFilePath(_0x200fba);}catch(_0xb8cf00){throw new SDKError(ErrorCode[_0x4c9442(0x219)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0xb8cf00[_0x4c9442(0x201)]);}_0x4adaff['verbose']&&console[_0x4c9442(0x200)](_0x4c9442(0x1cc)+_0x3dd9be[_0x4c9442(0x1cd)]+'/'+_0x3dd9be[_0x4c9442(0x224)]);const _0x2e869a=await withSpinner(_0x4c9442(0x202),()=>_0x3a65c4[_0x4c9442(0x239)][_0x4c9442(0x228)](_0x3dd9be[_0x4c9442(0x1d2)],_0x3dd9be['parentSegment'],_0x3dd9be['segmentName']),{'verbose':_0x4adaff[_0x4c9442(0x253)]});return _0x2e869a[_0x4c9442(0x257)];}async['getSQLFromServerSegment'](_0x1c14df,_0x425547){const _0x58954f=a37_0x44be62,{options:_0x5afd27,tdx:_0x503152}=_0x425547,_0x2a1e57=_0x5afd27['parentSegment'],_0x41727d=await resolveSegmentTarget(_0x1c14df,_0x2a1e57,_0x5afd27['verbose']);_0x5afd27[_0x58954f(0x253)]&&console[_0x58954f(0x200)](_0x58954f(0x217)+_0x41727d);const _0x1ad81c=await withSpinner(_0x58954f(0x220)+_0x1c14df+_0x58954f(0x1e6),()=>_0x503152['segment'][_0x58954f(0x233)](_0x41727d),{'verbose':_0x5afd27['verbose']}),_0x19826c=_0x1ad81c[_0x58954f(0x257)];_0x5afd27[_0x58954f(0x253)]&&(console['error'](_0x58954f(0x1e2)+_0x19826c[_0x58954f(0x1c3)]),console[_0x58954f(0x200)]('Parent\x20ID:\x20'+_0x19826c['parentId']));if(_0x19826c[_0x58954f(0x1c3)]==='folder')throw new SDKError(ErrorCode[_0x58954f(0x219)],'Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.');if(_0x19826c['type']===_0x58954f(0x1f2))throw new SDKError(ErrorCode[_0x58954f(0x219)],_0x58954f(0x25f));if(!_0x19826c[_0x58954f(0x254)])throw new SDKError(ErrorCode[_0x58954f(0x1e9)],_0x58954f(0x227));const _0x42b6e8=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x503152[_0x58954f(0x239)][_0x58954f(0x23a)](_0x19826c[_0x58954f(0x1ee)],_0x19826c[_0x58954f(0x254)]),{'verbose':_0x5afd27[_0x58954f(0x253)]});return _0x42b6e8['data'];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x44be62(0x251)]=a37_0x44be62(0x1ef);[a37_0x44be62(0x207)]=a37_0x44be62(0x1fa);async['execute'](_0x370de1){const _0x1a4ceb=a37_0x44be62,{options:_0x423295,args:_0x5f2ded,tdx:_0x227314}=_0x370de1,_0x556ad9=_0x423295;if(_0x5f2ded[_0x1a4ceb(0x223)]<0x2)return console[_0x1a4ceb(0x200)](_0x1a4ceb(0x1e3)),console[_0x1a4ceb(0x200)](_0x1a4ceb(0x20f)),0x1;const _0x27c6d5=_0x5f2ded[0x0],_0x373468=_0x5f2ded[0x1];_0x556ad9[_0x1a4ceb(0x253)]&&(console['error'](_0x1a4ceb(0x1e1)+_0x556ad9[_0x1a4ceb(0x1bf)]),console['error'](_0x1a4ceb(0x1be)+_0x27c6d5),console[_0x1a4ceb(0x200)]('Folder\x20name:\x20'+_0x373468));let _0xf9b8d6;if(_0x556ad9[_0x1a4ceb(0x256)]){const _0x60f33b=_0x556ad9[_0x1a4ceb(0x256)],_0x45d21c=await withSpinner(_0x1a4ceb(0x1e7)+_0x27c6d5+'\x27...',()=>_0x227314[_0x1a4ceb(0x239)][_0x1a4ceb(0x1f4)](_0x27c6d5),{'verbose':_0x556ad9[_0x1a4ceb(0x253)]}),_0x3be972=_0x45d21c[_0x1a4ceb(0x257)],_0x24f0ff=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x60f33b+_0x1a4ceb(0x1e6),()=>_0x227314[_0x1a4ceb(0x239)][_0x1a4ceb(0x1d4)](_0x3be972,_0x60f33b),{'verbose':_0x556ad9[_0x1a4ceb(0x253)]});_0xf9b8d6=_0x24f0ff[_0x1a4ceb(0x257)],_0x556ad9[_0x1a4ceb(0x253)]&&console['error'](_0x1a4ceb(0x1d6)+_0xf9b8d6);}const _0x66de67={'name':_0x373468,'description':_0x556ad9[_0x1a4ceb(0x207)],'parentFolderId':_0xf9b8d6},_0x1685b2=await withSpinner(_0x1a4ceb(0x214)+_0x373468+'\x27...',()=>_0x227314[_0x1a4ceb(0x239)][_0x1a4ceb(0x216)](_0x27c6d5,_0x66de67),{'verbose':_0x556ad9[_0x1a4ceb(0x253)]}),_0x6fd7e2=_0x1685b2[_0x1a4ceb(0x257)];return console[_0x1a4ceb(0x200)](_0x1a4ceb(0x1c6)+_0x6fd7e2[_0x1a4ceb(0x251)]+'\x27\x20with\x20ID:\x20'+_0x6fd7e2['id']),await handleSDKOutput([_0x6fd7e2],_0x556ad9),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a37_0x44be62(0x1eb);[a37_0x44be62(0x207)]=a37_0x44be62(0x1e4);async[a37_0x44be62(0x236)](_0x2bb235){const _0x183258=a37_0x44be62,{options:_0x23dd4a,args:_0x4fc5b0,tdx:_0x43ed02}=_0x2bb235,_0x4edce2=_0x4fc5b0[0x0];if(!_0x4edce2)return console['error']('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x183258(0x200)](_0x183258(0x1ca)),console[_0x183258(0x200)](_0x183258(0x1fb)),console['error'](_0x183258(0x1cf)),console[_0x183258(0x200)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x183258(0x200)](_0x183258(0x1df)),console['error'](_0x183258(0x1d5)),console[_0x183258(0x200)](_0x183258(0x222)),console[_0x183258(0x200)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console['error']('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x5a05e4=_0x23dd4a[_0x183258(0x1cd)],_0x436b55=await resolveSegmentTarget(_0x4edce2,_0x5a05e4,_0x23dd4a[_0x183258(0x253)]);_0x23dd4a[_0x183258(0x253)]&&console[_0x183258(0x200)](_0x183258(0x217)+_0x436b55);const _0x38934d=await withSpinner(_0x183258(0x220)+_0x4edce2+_0x183258(0x1e6),()=>_0x43ed02[_0x183258(0x239)][_0x183258(0x233)](_0x436b55),{'verbose':_0x23dd4a[_0x183258(0x253)]}),_0x142d6f=_0x38934d['data'];_0x23dd4a[_0x183258(0x253)]&&(console[_0x183258(0x200)](_0x183258(0x1e2)+_0x142d6f[_0x183258(0x1c3)]),console[_0x183258(0x200)](_0x183258(0x248)+_0x142d6f[_0x183258(0x1ee)]),_0x142d6f[_0x183258(0x1fd)]&&console[_0x183258(0x200)](_0x183258(0x1e8)+_0x142d6f['folderId']),_0x142d6f[_0x183258(0x254)]&&console[_0x183258(0x200)](_0x183258(0x238)+_0x142d6f[_0x183258(0x254)]));if(_0x23dd4a[_0x183258(0x21c)]){if(_0x142d6f[_0x183258(0x1c3)]==='folder')return console['error'](_0x183258(0x1c4)),0x1;if(_0x142d6f[_0x183258(0x1c3)]===_0x183258(0x1f2))return console[_0x183258(0x200)](_0x183258(0x1ce)),console[_0x183258(0x200)](_0x183258(0x25e)),0x1;if(!_0x142d6f[_0x183258(0x254)])throw new SDKError(ErrorCode[_0x183258(0x1e9)],_0x183258(0x227));const _0x4cca97=getConsoleNextUrl(_0x23dd4a[_0x183258(0x1bf)],_0x183258(0x20a)+_0x142d6f[_0x183258(0x1ee)]+_0x183258(0x1f5)+_0x142d6f[_0x183258(0x254)]);return console[_0x183258(0x200)](a37_0x335953['green']('✔')+_0x183258(0x1f7)+a37_0x335953[_0x183258(0x203)](_0x4cca97)),openBrowser(_0x4cca97),0x0;}if(_0x142d6f[_0x183258(0x1c3)]==='folder'){if(!_0x142d6f['folderId'])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x183258(0x22d));const _0x12a6b5=await withSpinner(_0x183258(0x22e),()=>_0x43ed02[_0x183258(0x239)][_0x183258(0x1dd)](_0x142d6f[_0x183258(0x1fd)]),{'verbose':_0x23dd4a[_0x183258(0x253)]});await handleSingleObjectOutput(_0x12a6b5['data'],_0x23dd4a);}else{if(_0x142d6f[_0x183258(0x1c3)]===_0x183258(0x239)){if(!_0x142d6f['segmentId'])throw new SDKError(ErrorCode[_0x183258(0x1e9)],_0x183258(0x227));const _0x538e4d=await withSpinner(_0x183258(0x1ff),()=>_0x43ed02[_0x183258(0x239)][_0x183258(0x252)](_0x142d6f[_0x183258(0x1ee)],_0x142d6f['segmentId']),{'verbose':_0x23dd4a[_0x183258(0x253)]}),_0x15bbc9=getConsoleNextUrl(_0x23dd4a[_0x183258(0x1bf)],_0x183258(0x20a)+_0x142d6f['parentId']+_0x183258(0x1f5)+_0x142d6f[_0x183258(0x254)]),_0x53fc8b=_0x538e4d[_0x183258(0x257)];_0x53fc8b['url']=_0x15bbc9,await handleSingleObjectOutput(_0x53fc8b,_0x23dd4a);}else return console[_0x183258(0x200)](_0x183258(0x235)),console[_0x183258(0x200)](_0x183258(0x210)),0x1;}return 0x0;}catch(_0x235d53){if(_0x235d53 instanceof SDKError)return console[_0x183258(0x200)]('Error:\x20'+_0x235d53[_0x183258(0x201)]),_0x235d53[_0x183258(0x246)]&&console[_0x183258(0x200)](_0x183258(0x226)+_0x235d53[_0x183258(0x246)]),0x1;throw _0x235d53;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']='segment:desc';['description']='Show\x20child\x20segment\x20schema\x20(column\x20types)';async[a37_0x44be62(0x236)](_0x5e99d4){const _0x3aaba3=a37_0x44be62,{options:_0x197f3a,args:_0x23a5b0,tdx:_0x3931b9}=_0x5e99d4,_0x481282=_0x23a5b0[0x0];if(!_0x481282)return console[_0x3aaba3(0x200)](_0x3aaba3(0x25d)),console[_0x3aaba3(0x200)](_0x3aaba3(0x258)),console[_0x3aaba3(0x200)](_0x3aaba3(0x1bc)),console[_0x3aaba3(0x200)](_0x3aaba3(0x1df)),console['error']('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x3aaba3(0x200)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x55cfe3=_0x197f3a[_0x3aaba3(0x1cd)],_0x659bd3=await resolveSegmentTarget(_0x481282,_0x55cfe3,_0x197f3a[_0x3aaba3(0x253)]);_0x197f3a['verbose']&&console[_0x3aaba3(0x200)](_0x3aaba3(0x217)+_0x659bd3);const _0x2397b1=await withSpinner(_0x3aaba3(0x220)+_0x481282+'\x27...',()=>_0x3931b9['segment']['resolvePathToResource'](_0x659bd3),{'verbose':_0x197f3a[_0x3aaba3(0x253)]}),_0x4eae8e=_0x2397b1['data'];_0x197f3a[_0x3aaba3(0x253)]&&(console[_0x3aaba3(0x200)](_0x3aaba3(0x1e2)+_0x4eae8e[_0x3aaba3(0x1c3)]),console['error'](_0x3aaba3(0x248)+_0x4eae8e[_0x3aaba3(0x1ee)]));if(_0x4eae8e['type']==='folder')return console[_0x3aaba3(0x200)](_0x3aaba3(0x21f)),console[_0x3aaba3(0x200)](_0x3aaba3(0x1c8)),0x1;if(_0x4eae8e[_0x3aaba3(0x1c3)]==='parent')return console['error'](_0x3aaba3(0x213)),console['error']('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x4eae8e[_0x3aaba3(0x254)])throw new SDKError(ErrorCode[_0x3aaba3(0x1e9)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x2b7025=await withSpinner(_0x3aaba3(0x20e),()=>_0x3931b9[_0x3aaba3(0x239)][_0x3aaba3(0x23a)](_0x4eae8e[_0x3aaba3(0x1ee)],_0x4eae8e[_0x3aaba3(0x254)]),{'verbose':_0x197f3a[_0x3aaba3(0x253)]}),_0x41e39b=_0x2b7025[_0x3aaba3(0x257)],_0x37d112=await executeSchemaQuery(_0x41e39b,_0x3931b9,_0x197f3a);return await handleQueryOutput(_0x37d112,_0x197f3a),0x0;}catch(_0x11c12d){if(_0x11c12d instanceof SDKError)return console['error'](_0x3aaba3(0x24f)+_0x11c12d['message']),_0x11c12d[_0x3aaba3(0x246)]&&console[_0x3aaba3(0x200)](_0x3aaba3(0x226)+_0x11c12d[_0x3aaba3(0x246)]),0x1;throw _0x11c12d;}}}
1
+ const a37_0x2e99ba=a37_0x5a9c;(function(_0x3db68c,_0x881ee0){const _0x5143a2=a37_0x5a9c,_0x365a9a=_0x3db68c();while(!![]){try{const _0x3643ae=-parseInt(_0x5143a2(0x22e))/0x1+-parseInt(_0x5143a2(0x1b3))/0x2+parseInt(_0x5143a2(0x1b1))/0x3*(-parseInt(_0x5143a2(0x1b8))/0x4)+-parseInt(_0x5143a2(0x1fd))/0x5+-parseInt(_0x5143a2(0x19d))/0x6*(parseInt(_0x5143a2(0x20d))/0x7)+parseInt(_0x5143a2(0x1d7))/0x8+parseInt(_0x5143a2(0x196))/0x9;if(_0x3643ae===_0x881ee0)break;else _0x365a9a['push'](_0x365a9a['shift']());}catch(_0x4d91a0){_0x365a9a['push'](_0x365a9a['shift']());}}}(a37_0x1c4a,0x49c1c));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';function a37_0x5a9c(_0x18ccd7,_0x27ce83){_0x18ccd7=_0x18ccd7-0x18e;const _0x1c4ab2=a37_0x1c4a();let _0x5a9c13=_0x1c4ab2[_0x18ccd7];return _0x5a9c13;}import a37_0x3d167e from'chalk';function a37_0x1c4a(){const _0x39e434=['Fetching\x20SQL\x20for\x20segment...','description','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','url','resolvePathToResource','jsonl','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Usage:\x20tdx\x20sg\x20show\x20<name>','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','segment:desc','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Fetching\x20segment\x20details...','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','217722nrEwIg','code','log','Parent\x20ID:\x20','Resolved\x20parent\x20ID:\x20','Folder\x20name:\x20','✖\x20Query\x20failed\x20[','processedRows','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','toLocaleString','segment','\x20rows\x20','\x20[Job\x20ID:\x20','10597248BmLrbg','error','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','segment:folder:list','Resolved\x20parent\x20folder\x20ID:\x20','getSQLFromYamlFile','includes','609036yaTivC','\x20\x20Cause:\x20','Creating\x20folder\x20\x27','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Parent\x20name:\x20','Executing\x20segment\x20query...','Site:\x20','folder','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Target\x20path:\x20','Usage:\x20tdx\x20sg\x20desc\x20<name>','information_schema','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Listing\x20folders\x20for\x20parent\x20\x27','Fetching\x20folder\x20\x27','message','parent','Resolving\x20path\x20\x27','3zIBHyk','Folder\x20ID\x20missing\x20from\x20resolved\x20path','427000cqoAcT','execute','getParent','\x20\x20Full\x20path:\x20','segmentId','654932zOLbRz','Error:\x20','green','length','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Resolved\x20relative\x20path\x20to:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','name','SEGMENT_NOT_FOUND','Get\x20SQL\x20query\x20for\x20child\x20segment','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','\x20\x20Segment\x20name:\x20','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Options:','\x20folder','segment:folder:show','in\x20','Show\x20folder\x20or\x20child\x20segment\x20details','Resolved\x20folder\x20ID:\x20','Resolved\x20type:\x20','✔\x20Query\x20completed:\x20Processed\x20','folderId','jobId','getSegmentSQL','elapsedTimeMillis','Use:\x20tdx\x20ps\x20show','format','Folder\x20ID:\x20','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','3056064jIwsdU','listFolders','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','fullPath','Show\x20child\x20segment\x20schema\x20(column\x20types)','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','parentFolder','site','\x27\x20with\x20ID:\x20','Resolved\x20YAML\x20file:\x20','getSegmentSQLFromYaml','✔\x20Found\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','getFolder','resolveFolderId','red','Use:\x20tdx\x20ps\x20view\x20-w','Resolving\x20folder\x20\x27','web','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Error:\x20Path\x20or\x20name\x20is\x20required','trim','✔\x20Created\x20folder\x20\x27','Error:\x20Parent\x20segment\x20name\x20is\x20required','Use:\x20tdx\x20ps\x20desc','parentId','verbose','replace','resolveParentId','setJobId','json','getSQLFromServerSegment','Segment\x20ID\x20missing\x20from\x20resolved\x20path','createFolder','content','getSegment','\x27...','2804555AXKmEZ','Resolving\x20parent\x20segment\x20\x27','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','INVALID_ARGUMENT','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','Use:\x20tdx\x20ps\x20view','SQL\x20query:\x0a','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','segmentPath','Resolving\x20\x27','Fetching\x20folder\x20details...','\x20\x20tdx\x20sg\x20sql\x20--path\x20','segment:folder:create','data','limit','Create\x20segment\x20folder\x20for\x20organization','7YwnkFc','Parent\x20segment:\x20','parentSegment','Examples:','SELECT\x20*\x20FROM\x20(\x0a','segmentName','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','/app/ps/','type','cause','query','SEGMENT_FOLDER_NOT_FOUND','\x20\x20Parent\x20segment:\x20','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','test','stats','/e/','Fetching\x20SQL\x20from\x20rule...','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment'];a37_0x1c4a=function(){return _0x39e434;};return a37_0x1c4a();}async function resolveSegmentTarget(_0x102c58,_0x1dfa8d,_0x4d4664){const _0x4ac725=a37_0x5a9c;if(isYamlFilePath(_0x102c58))try{const _0x19d00f=await resolveYamlFilePath(_0x102c58);return _0x4d4664&&(console[_0x4ac725(0x197)](_0x4ac725(0x1e0)+_0x102c58),console['error'](_0x4ac725(0x21a)+_0x19d00f[_0x4ac725(0x20f)]),console['error'](_0x4ac725(0x1c3)+_0x19d00f[_0x4ac725(0x212)]),console['error']('\x20\x20Folder\x20path:\x20'+(_0x19d00f['folderPath']||'(root)')),console[_0x4ac725(0x197)](_0x4ac725(0x1b6)+_0x19d00f[_0x4ac725(0x1da)])),_0x19d00f[_0x4ac725(0x1da)];}catch(_0x15b768){throw new SDKError(ErrorCode[_0x4ac725(0x200)],_0x4ac725(0x204)+_0x15b768['message']);}if(!_0x1dfa8d)throw new SDKError(ErrorCode[_0x4ac725(0x200)],_0x4ac725(0x1ff));return _0x1dfa8d+'/'+_0x102c58;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x2e99ba(0x1bf)]='segment:describe';['description']='Show\x20segment\x20or\x20folder\x20details';async[a37_0x2e99ba(0x1b4)](_0x491d72){const _0x1353b3=a37_0x2e99ba,{options:_0x187057,args:_0x5cdb61,tdx:_0x2a46ca}=_0x491d72,_0x24fe1a=_0x5cdb61[0x0],_0x583b17=!_0x24fe1a&&!!_0x187057[_0x1353b3(0x20f)],_0x7588ec=_0x24fe1a||_0x187057[_0x1353b3(0x20f)];if(!_0x7588ec)return console[_0x1353b3(0x197)](_0x1353b3(0x1ec)),console[_0x1353b3(0x197)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console['error'](_0x1353b3(0x210)),console[_0x1353b3(0x197)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console[_0x1353b3(0x197)](_0x1353b3(0x1dc)),console['error'](_0x1353b3(0x1c5)),console[_0x1353b3(0x197)](_0x1353b3(0x1c4)),0x1;try{const _0x28d0c7=_0x187057[_0x1353b3(0x205)];let _0xdf7bae=_0x7588ec;!_0x583b17&&_0x28d0c7&&!_0x7588ec[_0x1353b3(0x19c)]('/')&&(_0xdf7bae=_0x28d0c7+'/'+_0x7588ec,_0x187057[_0x1353b3(0x1f2)]&&console[_0x1353b3(0x197)](_0x1353b3(0x1bd)+_0xdf7bae));const _0x4142b9=await withSpinner(_0x1353b3(0x1b0)+_0xdf7bae+_0x1353b3(0x1fc),()=>_0x2a46ca[_0x1353b3(0x193)][_0x1353b3(0x225)](_0xdf7bae),{'verbose':_0x187057[_0x1353b3(0x1f2)]}),_0x5b0dac=_0x4142b9[_0x1353b3(0x20a)];_0x187057[_0x1353b3(0x1f2)]&&(console[_0x1353b3(0x197)]('Resolved\x20type:\x20'+_0x5b0dac[_0x1353b3(0x216)]),console[_0x1353b3(0x197)](_0x1353b3(0x231)+_0x5b0dac[_0x1353b3(0x1f1)]),_0x5b0dac[_0x1353b3(0x1cf)]&&console['error']('Folder\x20ID:\x20'+_0x5b0dac[_0x1353b3(0x1cf)]),_0x5b0dac[_0x1353b3(0x1b7)]&&console[_0x1353b3(0x197)]('Segment\x20ID:\x20'+_0x5b0dac[_0x1353b3(0x1b7)]));if(_0x5b0dac[_0x1353b3(0x216)]==='parent'){const _0x29707f=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x2a46ca[_0x1353b3(0x193)][_0x1353b3(0x1b5)](_0x5b0dac['parentId']),{'verbose':_0x187057[_0x1353b3(0x1f2)]});await handleSingleObjectOutput(_0x29707f[_0x1353b3(0x20a)],_0x187057);}else{if(_0x5b0dac[_0x1353b3(0x216)]===_0x1353b3(0x1a5)){if(!_0x5b0dac[_0x1353b3(0x1cf)])throw new SDKError(ErrorCode[_0x1353b3(0x219)],_0x1353b3(0x1b2));const _0x9a21a9=await withSpinner(_0x1353b3(0x207),()=>_0x2a46ca['segment']['getFolder'](_0x5b0dac[_0x1353b3(0x1cf)]),{'verbose':_0x187057[_0x1353b3(0x1f2)]});await handleSingleObjectOutput(_0x9a21a9['data'],_0x187057);}else{if(_0x5b0dac['type']===_0x1353b3(0x193)){if(!_0x5b0dac['segmentId'])throw new SDKError(ErrorCode[_0x1353b3(0x1c0)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x219c7d=await withSpinner(_0x1353b3(0x22c),()=>_0x2a46ca['segment'][_0x1353b3(0x1fb)](_0x5b0dac[_0x1353b3(0x1f1)],_0x5b0dac[_0x1353b3(0x1b7)]),{'verbose':_0x187057[_0x1353b3(0x1f2)]});await handleSingleObjectOutput(_0x219c7d[_0x1353b3(0x20a)],_0x187057);}}}return 0x0;}catch(_0x42bdc9){if(_0x42bdc9 instanceof SDKError)return console[_0x1353b3(0x197)](_0x1353b3(0x1b9)+_0x42bdc9['message']),_0x42bdc9[_0x1353b3(0x217)]&&console[_0x1353b3(0x197)]('\x20\x20Cause:\x20'+_0x42bdc9[_0x1353b3(0x217)]),0x1;throw _0x42bdc9;}}}export class SegmentShowCommand extends BaseCommand{['name']='segment:show';[a37_0x2e99ba(0x222)]=a37_0x2e99ba(0x1a6);async['execute'](_0x56aeec){const _0x4e0d6a=a37_0x2e99ba,{options:_0x1d83dd,args:_0x40a998,tdx:_0x113b25}=_0x56aeec,_0x49bf89=_0x40a998[0x0];if(!_0x49bf89)return console[_0x4e0d6a(0x197)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x4e0d6a(0x197)](_0x4e0d6a(0x228)),console[_0x4e0d6a(0x197)](_0x4e0d6a(0x22b)),console[_0x4e0d6a(0x197)](_0x4e0d6a(0x210)),console[_0x4e0d6a(0x197)](_0x4e0d6a(0x1a7)),console['error']('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x2c0da0=_0x1d83dd['parentSegment'],_0x3c32ed=await resolveSegmentTarget(_0x49bf89,_0x2c0da0,_0x1d83dd[_0x4e0d6a(0x1f2)]);_0x1d83dd[_0x4e0d6a(0x1f2)]&&console['error'](_0x4e0d6a(0x1a8)+_0x3c32ed);const _0x262a8a=await withSpinner(_0x4e0d6a(0x206)+_0x49bf89+_0x4e0d6a(0x1fc),()=>_0x113b25[_0x4e0d6a(0x193)][_0x4e0d6a(0x225)](_0x3c32ed),{'verbose':_0x1d83dd[_0x4e0d6a(0x1f2)]}),_0x70831e=_0x262a8a['data'];_0x1d83dd[_0x4e0d6a(0x1f2)]&&(console[_0x4e0d6a(0x197)]('Resolved\x20type:\x20'+_0x70831e['type']),console[_0x4e0d6a(0x197)](_0x4e0d6a(0x231)+_0x70831e[_0x4e0d6a(0x1f1)]));if(_0x70831e[_0x4e0d6a(0x216)]===_0x4e0d6a(0x1a5))return console[_0x4e0d6a(0x197)](_0x4e0d6a(0x1d6)),console[_0x4e0d6a(0x197)]('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x70831e[_0x4e0d6a(0x216)]===_0x4e0d6a(0x1af))return console[_0x4e0d6a(0x197)](_0x4e0d6a(0x198)),console[_0x4e0d6a(0x197)](_0x4e0d6a(0x1d3)),0x1;if(!_0x70831e[_0x4e0d6a(0x1b7)])throw new SDKError(ErrorCode[_0x4e0d6a(0x1c0)],_0x4e0d6a(0x1f8));const _0x28c55f=await withSpinner(_0x4e0d6a(0x221),()=>_0x113b25['segment'][_0x4e0d6a(0x1d1)](_0x70831e['parentId'],_0x70831e[_0x4e0d6a(0x1b7)]),{'verbose':_0x1d83dd[_0x4e0d6a(0x1f2)]});let _0x51f109=_0x28c55f['data'];const _0x258e9c=resolveLimit(_0x1d83dd[_0x4e0d6a(0x20b)],DEFAULT_DISPLAY_LIMIT),_0x1ba5ee=/\bLIMIT\s+\d+/i[_0x4e0d6a(0x21c)](_0x51f109);!_0x1ba5ee&&(_0x51f109=_0x51f109[_0x4e0d6a(0x1ed)]()[_0x4e0d6a(0x1f3)](/;+$/,''),_0x51f109=_0x4e0d6a(0x211)+_0x51f109+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x258e9c);_0x1d83dd[_0x4e0d6a(0x1f2)]&&console[_0x4e0d6a(0x197)](_0x4e0d6a(0x203)+_0x51f109);const _0x53af19=await withProgressSpinner(_0x4e0d6a(0x1a3),async _0x51cea5=>{const _0x1be9da=_0x4e0d6a,_0x46bb9b=await _0x113b25[_0x1be9da(0x218)][_0x1be9da(0x1b4)](_0x51f109,{'catalog':'td','schema':_0x1be9da(0x1aa),'onJobId':_0x4e6493=>{const _0x1c777c=_0x1be9da;_0x51cea5[_0x1c777c(0x1f5)](_0x4e6493);}});return _0x46bb9b;},{'verbose':_0x1d83dd['verbose']}),_0x7261c4=_0x53af19[_0x4e0d6a(0x20a)],_0x20bd50=_0x7261c4[_0x4e0d6a(0x1d0)]?_0x4e0d6a(0x195)+_0x7261c4[_0x4e0d6a(0x1d0)]+']':'';return console['error'](_0x4e0d6a(0x1ce)+_0x7261c4[_0x4e0d6a(0x21d)][_0x4e0d6a(0x190)][_0x4e0d6a(0x192)]()+_0x4e0d6a(0x194)+(_0x4e0d6a(0x1ca)+formatElapsed(_0x7261c4['stats'][_0x4e0d6a(0x1d2)])+_0x20bd50)),await handleQueryOutput(_0x7261c4,_0x1d83dd),0x0;}catch(_0x85e3f3){if(_0x85e3f3 instanceof SDKError)return console['error'](_0x4e0d6a(0x18f)+_0x85e3f3[_0x4e0d6a(0x22f)]+']'),console[_0x4e0d6a(0x197)]('\x0a'+_0x85e3f3[_0x4e0d6a(0x1ae)]),0x1;throw _0x85e3f3;}}}export class SegmentFolderListCommand extends BaseCommand{['name']=a37_0x2e99ba(0x199);[a37_0x2e99ba(0x222)]=a37_0x2e99ba(0x220);async['execute'](_0x6bd8d0){const _0x52de05=a37_0x2e99ba,{options:_0xa3d331,args:_0x51b8d0,tdx:_0x46942c}=_0x6bd8d0;if(_0x51b8d0[_0x52de05(0x1bb)]===0x0)return console[_0x52de05(0x197)](_0x52de05(0x1ef)),console[_0x52de05(0x197)](_0x52de05(0x1eb)),0x1;const _0x30b2c5=_0x51b8d0[0x0];try{_0xa3d331['verbose']&&(console[_0x52de05(0x197)]('Site:\x20'+_0xa3d331['site']),console['error'](_0x52de05(0x1a2)+_0x30b2c5));const _0x3aa053=await withSpinner(_0x52de05(0x1fe)+_0x30b2c5+'\x27...',()=>_0x46942c[_0x52de05(0x193)][_0x52de05(0x1f4)](_0x30b2c5),{'verbose':_0xa3d331[_0x52de05(0x1f2)]}),_0x19b7c4=_0x3aa053[_0x52de05(0x20a)];_0xa3d331['verbose']&&console[_0x52de05(0x197)](_0x52de05(0x232)+_0x19b7c4);const _0x4db7d6=await withSpinner(_0x52de05(0x1ac)+_0x30b2c5+'\x27...',()=>_0x46942c['segment'][_0x52de05(0x1d8)](_0x19b7c4),{'verbose':_0xa3d331['verbose']}),_0x549d83=_0x4db7d6[_0x52de05(0x20a)];return console[_0x52de05(0x197)](_0x52de05(0x1e2)+_0x549d83[_0x52de05(0x1bb)]+_0x52de05(0x1c8)+(_0x549d83[_0x52de05(0x1bb)]!==0x1?'s':'')),await handleSDKOutput(_0x549d83,_0xa3d331),0x0;}catch(_0x4933a2){if(_0x4933a2 instanceof SDKError)return console[_0x52de05(0x197)](_0x52de05(0x1b9)+_0x4933a2[_0x52de05(0x1ae)]),_0x4933a2[_0x52de05(0x217)]&&console['error']('\x20\x20Cause:\x20'+_0x4933a2['cause']),0x1;throw _0x4933a2;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x2e99ba(0x1bf)]=a37_0x2e99ba(0x1c9);[a37_0x2e99ba(0x222)]='Show\x20segment\x20folder\x20details';async[a37_0x2e99ba(0x1b4)](_0x1c52e7){const _0x2d6d18=a37_0x2e99ba,{options:_0x42f8d7,args:_0x3f6b54,tdx:_0xf18b38}=_0x1c52e7;if(_0x3f6b54['length']===0x0)return console[_0x2d6d18(0x197)]('Error:\x20Folder\x20reference\x20is\x20required'),console[_0x2d6d18(0x197)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x36b233,childId:_0x432b2d}=parseSegmentRef(_0x3f6b54[0x0]);_0x42f8d7[_0x2d6d18(0x1f2)]&&(console['error']('Site:\x20'+_0x42f8d7['site']),console[_0x2d6d18(0x197)](_0x2d6d18(0x1a2)+_0x36b233),_0x432b2d&&console[_0x2d6d18(0x197)](_0x2d6d18(0x18e)+_0x432b2d));if(!_0x432b2d)return console[_0x2d6d18(0x197)](_0x2d6d18(0x22d)),0x1;const _0x1bc3fc=await withSpinner(_0x2d6d18(0x1fe)+_0x36b233+_0x2d6d18(0x1fc),()=>_0xf18b38['segment'][_0x2d6d18(0x1f4)](_0x36b233),{'verbose':_0x42f8d7['verbose']}),_0x548520=_0x1bc3fc[_0x2d6d18(0x20a)];_0x42f8d7['verbose']&&console[_0x2d6d18(0x197)](_0x2d6d18(0x232)+_0x548520);const _0x5a23e6=await withSpinner(_0x2d6d18(0x1e9)+_0x432b2d+_0x2d6d18(0x1fc),()=>_0xf18b38[_0x2d6d18(0x193)][_0x2d6d18(0x1e6)](_0x548520,_0x432b2d),{'verbose':_0x42f8d7[_0x2d6d18(0x1f2)]}),_0x31b347=_0x5a23e6[_0x2d6d18(0x20a)];_0x42f8d7['verbose']&&console[_0x2d6d18(0x197)](_0x2d6d18(0x1cc)+_0x31b347);const _0x13740d=await withSpinner(_0x2d6d18(0x1ad)+_0x432b2d+_0x2d6d18(0x1fc),()=>_0xf18b38['segment'][_0x2d6d18(0x1e5)](_0x31b347),{'verbose':_0x42f8d7[_0x2d6d18(0x1f2)]});return await handleSDKOutput([_0x13740d[_0x2d6d18(0x20a)]],_0x42f8d7),0x0;}catch(_0x27850e){if(_0x27850e instanceof SDKError)return console[_0x2d6d18(0x197)](_0x2d6d18(0x1b9)+_0x27850e['message']),_0x27850e[_0x2d6d18(0x217)]&&console[_0x2d6d18(0x197)](_0x2d6d18(0x19e)+_0x27850e[_0x2d6d18(0x217)]),0x1;throw _0x27850e;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x2e99ba(0x1bf)]='segment:sql';[a37_0x2e99ba(0x222)]=a37_0x2e99ba(0x1c1);async['execute'](_0x39d1b1){const _0x627ca4=a37_0x2e99ba,{options:_0x1281a3,args:_0x2b6ded}=_0x39d1b1,_0x100855=_0x1281a3,_0x250e80=_0x100855['path'],_0x4bd1b4=_0x2b6ded[0x0];if(!_0x4bd1b4&&!_0x250e80)return console['error'](a37_0x3d167e[_0x627ca4(0x1e7)]('Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required')),console[_0x627ca4(0x197)]('Usage:'),console[_0x627ca4(0x197)](_0x627ca4(0x21b)),console['error']('\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>'),console[_0x627ca4(0x197)]('Examples:'),console[_0x627ca4(0x197)]('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x627ca4(0x197)](_0x627ca4(0x1c6)),0x1;if(_0x4bd1b4&&_0x250e80)return console[_0x627ca4(0x197)](a37_0x3d167e[_0x627ca4(0x1e7)](_0x627ca4(0x201))),0x1;try{let _0x70d59f;if(_0x250e80)_0x70d59f=await this[_0x627ca4(0x19b)](_0x250e80,_0x39d1b1);else{if(isYamlFilePath(_0x4bd1b4))return console[_0x627ca4(0x197)](a37_0x3d167e['red'](_0x627ca4(0x213))),console[_0x627ca4(0x197)](_0x627ca4(0x208)+_0x4bd1b4),0x1;else _0x70d59f=await this[_0x627ca4(0x1f7)](_0x4bd1b4,_0x39d1b1);}return _0x1281a3['format']===_0x627ca4(0x1f6)||_0x1281a3[_0x627ca4(0x1d4)]===_0x627ca4(0x226)?await handleSDKOutput([{'sql':_0x70d59f}],_0x1281a3):console[_0x627ca4(0x230)](_0x70d59f),0x0;}catch(_0x2106db){if(_0x2106db instanceof SDKError)return console[_0x627ca4(0x197)](_0x627ca4(0x1b9)+_0x2106db[_0x627ca4(0x1ae)]),_0x2106db[_0x627ca4(0x217)]&&console[_0x627ca4(0x197)](_0x627ca4(0x19e)+_0x2106db[_0x627ca4(0x217)]),0x1;throw _0x2106db;}}async['getSQLFromYamlFile'](_0x5a3ca8,_0x345688){const _0x10ffc6=a37_0x2e99ba,{options:_0x1352f8,tdx:_0x469dfe}=_0x345688;let _0x51f444;try{_0x51f444=await resolveYamlFilePath(_0x5a3ca8);}catch(_0x1112b4){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x10ffc6(0x204)+_0x1112b4[_0x10ffc6(0x1ae)]);}_0x1352f8[_0x10ffc6(0x1f2)]&&console[_0x10ffc6(0x197)]('Resolved:\x20'+_0x51f444[_0x10ffc6(0x20f)]+'/'+_0x51f444[_0x10ffc6(0x212)]);const _0x355fcf=await withSpinner(_0x10ffc6(0x21f),()=>_0x469dfe[_0x10ffc6(0x193)][_0x10ffc6(0x1e1)](_0x51f444[_0x10ffc6(0x1fa)],_0x51f444[_0x10ffc6(0x20f)],_0x51f444[_0x10ffc6(0x212)]),{'verbose':_0x1352f8[_0x10ffc6(0x1f2)]});return _0x355fcf[_0x10ffc6(0x20a)];}async['getSQLFromServerSegment'](_0x5ee498,_0x3aa193){const _0x35b83b=a37_0x2e99ba,{options:_0xd2711d,tdx:_0x198428}=_0x3aa193,_0x1a315d=_0xd2711d[_0x35b83b(0x20f)],_0x2c612a=await resolveSegmentTarget(_0x5ee498,_0x1a315d,_0xd2711d['verbose']);_0xd2711d[_0x35b83b(0x1f2)]&&console['error'](_0x35b83b(0x1a8)+_0x2c612a);const _0xd85aaf=await withSpinner(_0x35b83b(0x206)+_0x5ee498+_0x35b83b(0x1fc),()=>_0x198428[_0x35b83b(0x193)][_0x35b83b(0x225)](_0x2c612a),{'verbose':_0xd2711d[_0x35b83b(0x1f2)]}),_0x491966=_0xd85aaf[_0x35b83b(0x20a)];_0xd2711d['verbose']&&(console[_0x35b83b(0x197)](_0x35b83b(0x1cd)+_0x491966['type']),console[_0x35b83b(0x197)](_0x35b83b(0x231)+_0x491966[_0x35b83b(0x1f1)]));if(_0x491966[_0x35b83b(0x216)]===_0x35b83b(0x1a5))throw new SDKError(ErrorCode[_0x35b83b(0x200)],'Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.');if(_0x491966[_0x35b83b(0x216)]===_0x35b83b(0x1af))throw new SDKError(ErrorCode[_0x35b83b(0x200)],_0x35b83b(0x214));if(!_0x491966[_0x35b83b(0x1b7)])throw new SDKError(ErrorCode[_0x35b83b(0x1c0)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x55fe13=await withSpinner(_0x35b83b(0x221),()=>_0x198428[_0x35b83b(0x193)][_0x35b83b(0x1d1)](_0x491966['parentId'],_0x491966[_0x35b83b(0x1b7)]),{'verbose':_0xd2711d[_0x35b83b(0x1f2)]});return _0x55fe13[_0x35b83b(0x20a)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x2e99ba(0x1bf)]=a37_0x2e99ba(0x209);[a37_0x2e99ba(0x222)]=a37_0x2e99ba(0x20c);async['execute'](_0x11b421){const _0x433b9a=a37_0x2e99ba,{options:_0x41c001,args:_0x5b12ef,tdx:_0x38f1f3}=_0x11b421,_0x3988d2=_0x41c001;if(_0x5b12ef[_0x433b9a(0x1bb)]<0x2)return console['error'](_0x433b9a(0x1ab)),console[_0x433b9a(0x197)]('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x54a061=_0x5b12ef[0x0],_0xe2d061=_0x5b12ef[0x1];_0x3988d2[_0x433b9a(0x1f2)]&&(console[_0x433b9a(0x197)](_0x433b9a(0x1a4)+_0x3988d2[_0x433b9a(0x1de)]),console[_0x433b9a(0x197)](_0x433b9a(0x20e)+_0x54a061),console[_0x433b9a(0x197)]('Folder\x20name:\x20'+_0xe2d061));let _0x4937e9;if(_0x3988d2['parentFolder']){const _0x1162e8=_0x3988d2[_0x433b9a(0x1dd)],_0x41775c=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x54a061+_0x433b9a(0x1fc),()=>_0x38f1f3['segment']['resolveParentId'](_0x54a061),{'verbose':_0x3988d2['verbose']}),_0x4f4732=_0x41775c[_0x433b9a(0x20a)],_0x2f0d38=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x1162e8+'\x27...',()=>_0x38f1f3[_0x433b9a(0x193)][_0x433b9a(0x1e6)](_0x4f4732,_0x1162e8),{'verbose':_0x3988d2[_0x433b9a(0x1f2)]});_0x4937e9=_0x2f0d38['data'],_0x3988d2['verbose']&&console[_0x433b9a(0x197)](_0x433b9a(0x19a)+_0x4937e9);}const _0x387a0b={'name':_0xe2d061,'description':_0x3988d2[_0x433b9a(0x222)],'parentFolderId':_0x4937e9},_0x2074b1=await withSpinner(_0x433b9a(0x19f)+_0xe2d061+_0x433b9a(0x1fc),()=>_0x38f1f3[_0x433b9a(0x193)][_0x433b9a(0x1f9)](_0x54a061,_0x387a0b),{'verbose':_0x3988d2['verbose']}),_0x1072ad=_0x2074b1['data'];return console[_0x433b9a(0x197)](_0x433b9a(0x1ee)+_0x1072ad[_0x433b9a(0x1bf)]+_0x433b9a(0x1df)+_0x1072ad['id']),await handleSDKOutput([_0x1072ad],_0x3988d2),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']='segment:view';[a37_0x2e99ba(0x222)]=a37_0x2e99ba(0x1cb);async['execute'](_0x228cc7){const _0x4271a9=a37_0x2e99ba,{options:_0x40051b,args:_0x5616a4,tdx:_0x14c32a}=_0x228cc7,_0x256660=_0x5616a4[0x0];if(!_0x256660)return console[_0x4271a9(0x197)](_0x4271a9(0x1a1)),console['error'](_0x4271a9(0x1bc)),console['error'](_0x4271a9(0x1e3)),console[_0x4271a9(0x197)](_0x4271a9(0x1c7)),console[_0x4271a9(0x197)](_0x4271a9(0x227)),console['error'](_0x4271a9(0x210)),console['error'](_0x4271a9(0x1be)),console[_0x4271a9(0x197)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x4271a9(0x197)](_0x4271a9(0x229)),console[_0x4271a9(0x197)]('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x3452ad=_0x40051b[_0x4271a9(0x20f)],_0x2312cc=await resolveSegmentTarget(_0x256660,_0x3452ad,_0x40051b[_0x4271a9(0x1f2)]);_0x40051b[_0x4271a9(0x1f2)]&&console[_0x4271a9(0x197)](_0x4271a9(0x1a8)+_0x2312cc);const _0x2f9cbc=await withSpinner('Resolving\x20\x27'+_0x256660+_0x4271a9(0x1fc),()=>_0x14c32a['segment'][_0x4271a9(0x225)](_0x2312cc),{'verbose':_0x40051b[_0x4271a9(0x1f2)]}),_0x30fbbf=_0x2f9cbc['data'];_0x40051b[_0x4271a9(0x1f2)]&&(console[_0x4271a9(0x197)](_0x4271a9(0x1cd)+_0x30fbbf[_0x4271a9(0x216)]),console[_0x4271a9(0x197)](_0x4271a9(0x231)+_0x30fbbf[_0x4271a9(0x1f1)]),_0x30fbbf[_0x4271a9(0x1cf)]&&console[_0x4271a9(0x197)](_0x4271a9(0x1d5)+_0x30fbbf[_0x4271a9(0x1cf)]),_0x30fbbf[_0x4271a9(0x1b7)]&&console['error']('Segment\x20ID:\x20'+_0x30fbbf['segmentId']));if(_0x40051b[_0x4271a9(0x1ea)]){if(_0x30fbbf[_0x4271a9(0x216)]===_0x4271a9(0x1a5))return console[_0x4271a9(0x197)](_0x4271a9(0x1c2)),0x1;if(_0x30fbbf[_0x4271a9(0x216)]===_0x4271a9(0x1af))return console[_0x4271a9(0x197)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x4271a9(0x197)](_0x4271a9(0x1e8)),0x1;if(!_0x30fbbf[_0x4271a9(0x1b7)])throw new SDKError(ErrorCode[_0x4271a9(0x1c0)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x32c2e5=getConsoleNextUrl(_0x40051b[_0x4271a9(0x1de)],'/app/ps/'+_0x30fbbf[_0x4271a9(0x1f1)]+_0x4271a9(0x21e)+_0x30fbbf[_0x4271a9(0x1b7)]);return console[_0x4271a9(0x197)](a37_0x3d167e[_0x4271a9(0x1ba)]('✔')+'\x20Opening\x20'+a37_0x3d167e['cyan'](_0x32c2e5)),openBrowser(_0x32c2e5),0x0;}if(_0x30fbbf[_0x4271a9(0x216)]===_0x4271a9(0x1a5)){if(!_0x30fbbf[_0x4271a9(0x1cf)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x4271a9(0x1b2));const _0x42c350=await withSpinner(_0x4271a9(0x207),()=>_0x14c32a[_0x4271a9(0x193)]['getFolder'](_0x30fbbf[_0x4271a9(0x1cf)]),{'verbose':_0x40051b['verbose']});await handleSingleObjectOutput(_0x42c350[_0x4271a9(0x20a)],_0x40051b);}else{if(_0x30fbbf[_0x4271a9(0x216)]===_0x4271a9(0x193)){if(!_0x30fbbf[_0x4271a9(0x1b7)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x4271a9(0x1f8));const _0x42f388=await withSpinner('Fetching\x20segment\x20details...',()=>_0x14c32a[_0x4271a9(0x193)][_0x4271a9(0x1fb)](_0x30fbbf['parentId'],_0x30fbbf['segmentId']),{'verbose':_0x40051b[_0x4271a9(0x1f2)]}),_0x21fef9=getConsoleNextUrl(_0x40051b[_0x4271a9(0x1de)],_0x4271a9(0x215)+_0x30fbbf[_0x4271a9(0x1f1)]+'/e/'+_0x30fbbf[_0x4271a9(0x1b7)]),_0x2edf5b=_0x42f388[_0x4271a9(0x20a)];_0x2edf5b[_0x4271a9(0x224)]=_0x21fef9,await handleSingleObjectOutput(_0x2edf5b,_0x40051b);}else return console[_0x4271a9(0x197)](_0x4271a9(0x1a0)),console[_0x4271a9(0x197)](_0x4271a9(0x202)),0x1;}return 0x0;}catch(_0x8ce7be){if(_0x8ce7be instanceof SDKError)return console[_0x4271a9(0x197)](_0x4271a9(0x1b9)+_0x8ce7be[_0x4271a9(0x1ae)]),_0x8ce7be[_0x4271a9(0x217)]&&console['error'](_0x4271a9(0x19e)+_0x8ce7be[_0x4271a9(0x217)]),0x1;throw _0x8ce7be;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x2e99ba(0x1bf)]=a37_0x2e99ba(0x22a);[a37_0x2e99ba(0x222)]=a37_0x2e99ba(0x1db);async[a37_0x2e99ba(0x1b4)](_0x395c05){const _0x1983a6=a37_0x2e99ba,{options:_0x2f740d,args:_0x359c6e,tdx:_0x3b0808}=_0x395c05,_0x3451bf=_0x359c6e[0x0];if(!_0x3451bf)return console[_0x1983a6(0x197)](_0x1983a6(0x191)),console[_0x1983a6(0x197)](_0x1983a6(0x1a9)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console[_0x1983a6(0x197)](_0x1983a6(0x210)),console[_0x1983a6(0x197)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x1983a6(0x197)](_0x1983a6(0x1e4)),0x1;try{const _0x3f2719=_0x2f740d[_0x1983a6(0x20f)],_0x25d93=await resolveSegmentTarget(_0x3451bf,_0x3f2719,_0x2f740d['verbose']);_0x2f740d[_0x1983a6(0x1f2)]&&console[_0x1983a6(0x197)](_0x1983a6(0x1a8)+_0x25d93);const _0x4ae489=await withSpinner('Resolving\x20\x27'+_0x3451bf+_0x1983a6(0x1fc),()=>_0x3b0808[_0x1983a6(0x193)][_0x1983a6(0x225)](_0x25d93),{'verbose':_0x2f740d[_0x1983a6(0x1f2)]}),_0x322462=_0x4ae489[_0x1983a6(0x20a)];_0x2f740d['verbose']&&(console['error'](_0x1983a6(0x1cd)+_0x322462['type']),console['error'](_0x1983a6(0x231)+_0x322462[_0x1983a6(0x1f1)]));if(_0x322462[_0x1983a6(0x216)]===_0x1983a6(0x1a5))return console[_0x1983a6(0x197)]('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console[_0x1983a6(0x197)](_0x1983a6(0x1d9)),0x1;if(_0x322462[_0x1983a6(0x216)]===_0x1983a6(0x1af))return console['error'](_0x1983a6(0x223)),console[_0x1983a6(0x197)](_0x1983a6(0x1f0)),0x1;if(!_0x322462['segmentId'])throw new SDKError(ErrorCode[_0x1983a6(0x1c0)],_0x1983a6(0x1f8));const _0x4b84fc=await withSpinner(_0x1983a6(0x221),()=>_0x3b0808[_0x1983a6(0x193)][_0x1983a6(0x1d1)](_0x322462[_0x1983a6(0x1f1)],_0x322462[_0x1983a6(0x1b7)]),{'verbose':_0x2f740d[_0x1983a6(0x1f2)]}),_0x296657=_0x4b84fc[_0x1983a6(0x20a)],_0x1a41bc=await executeSchemaQuery(_0x296657,_0x3b0808,_0x2f740d);return await handleQueryOutput(_0x1a41bc,_0x2f740d),0x0;}catch(_0x1cc4a8){if(_0x1cc4a8 instanceof SDKError)return console[_0x1983a6(0x197)](_0x1983a6(0x1b9)+_0x1cc4a8['message']),_0x1cc4a8[_0x1983a6(0x217)]&&console['error']('\x20\x20Cause:\x20'+_0x1cc4a8['cause']),0x1;throw _0x1cc4a8;}}}
@@ -1 +1 @@
1
- const a38_0x3529e3=a38_0x1152;function a38_0x2fa7(){const _0x1f567a=['Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','rule','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','site','invisible','length','createSegment','error','segmentPath','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','Parent\x20path:\x20','\x20\x20\x20Path:\x20','Examples:','folderId','resolveParentId','6443690EtCTlb','segments','Resolving\x20folder\x20\x27','Create\x20child\x20segment\x20with\x20filtering\x20rules','name','Resolved\x20relative\x20path\x20to:\x20','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','647076PfxFhf','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','Site:\x20','data','855536ExQDHh','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','segment','Parent:\x20','\x27...','kind','yellow','Resolved\x20folder\x20ID:\x20','verbose','description','416547NPzGPN','segment:create','10GXhmdN','type','resolveFolderId','Resolving\x20folder\x20path\x20\x27','ruleFile','parent','includes','Resolving\x20parent\x20segment\x20\x27','Creating\x20segment\x20\x27','6kaNDMW','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','2773036ZuNJbK','✔\x20Created\x20segment\x20\x27','noCountPopulation','execute','folder','513NLePyu','Segment\x20name:\x20','44598EAOnnM','2776ErFdnP'];a38_0x2fa7=function(){return _0x1f567a;};return a38_0x2fa7();}function a38_0x1152(_0x4b3915,_0x32148d){_0x4b3915=_0x4b3915-0x146;const _0x2fa7cb=a38_0x2fa7();let _0x115211=_0x2fa7cb[_0x4b3915];return _0x115211;}(function(_0x133922,_0x483bf4){const _0x445699=a38_0x1152,_0x287c08=_0x133922();while(!![]){try{const _0x3a0087=parseInt(_0x445699(0x16f))/0x1+parseInt(_0x445699(0x166))/0x2*(parseInt(_0x445699(0x15b))/0x3)+parseInt(_0x445699(0x151))/0x4+-parseInt(_0x445699(0x15d))/0x5*(parseInt(_0x445699(0x14d))/0x6)+parseInt(_0x445699(0x168))/0x7+parseInt(_0x445699(0x170))/0x8*(parseInt(_0x445699(0x16d))/0x9)+-parseInt(_0x445699(0x146))/0xa;if(_0x3a0087===_0x483bf4)break;else _0x287c08['push'](_0x287c08['shift']());}catch(_0x32c32f){_0x287c08['push'](_0x287c08['shift']());}}}(a38_0x2fa7,0x385ef));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';import a38_0x58f68a from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x3529e3(0x14a)]=a38_0x3529e3(0x15c);[a38_0x3529e3(0x15a)]=a38_0x3529e3(0x149);async[a38_0x3529e3(0x16b)](_0x3b9ab1){const _0x4ed137=a38_0x3529e3;console['error'](a38_0x58f68a[_0x4ed137(0x157)](_0x4ed137(0x17c))),console[_0x4ed137(0x179)](a38_0x58f68a['yellow'](_0x4ed137(0x167)));const {options:_0x5174e1,args:_0x3941d7,tdx:_0xb38720}=_0x3b9ab1,_0x2d63f9=_0x5174e1;if(_0x3941d7[_0x4ed137(0x177)]===0x0)return console['error'](_0x4ed137(0x171)),console['error'](_0x4ed137(0x174)),console[_0x4ed137(0x179)](_0x4ed137(0x17f)),console[_0x4ed137(0x179)](_0x4ed137(0x14e)),console[_0x4ed137(0x179)](_0x4ed137(0x17b)),console['error'](_0x4ed137(0x14c)),0x1;const _0x1cb838=_0x3941d7[0x0],_0x5cf30c=_0x5174e1[_0x4ed137(0x17a)];let _0xa06c8e=_0x1cb838;_0x5cf30c&&!_0x1cb838[_0x4ed137(0x163)]('/')&&(_0xa06c8e=_0x5cf30c+'/'+_0x1cb838,_0x2d63f9[_0x4ed137(0x159)]&&console[_0x4ed137(0x179)](_0x4ed137(0x14b)+_0xa06c8e));const _0x17d915=parsePath(_0xa06c8e);if(_0x17d915[_0x4ed137(0x147)][_0x4ed137(0x177)]<0x2)return console[_0x4ed137(0x179)](_0x4ed137(0x152)),console[_0x4ed137(0x179)](_0x4ed137(0x173)),0x1;const _0x172bcd=_0x17d915[_0x4ed137(0x147)][0x0],_0x46288f=getBaseName(_0xa06c8e),_0x312991=getParentPath(_0xa06c8e);_0x2d63f9['verbose']&&(console[_0x4ed137(0x179)](_0x4ed137(0x14f)+_0x2d63f9[_0x4ed137(0x175)]),console['error']('Target\x20path:\x20'+_0xa06c8e),console[_0x4ed137(0x179)](_0x4ed137(0x154)+_0x172bcd),console[_0x4ed137(0x179)](_0x4ed137(0x16e)+_0x46288f),console[_0x4ed137(0x179)](_0x4ed137(0x17d)+_0x312991));const _0x2e94bf=await withSpinner(_0x4ed137(0x164)+_0x172bcd+_0x4ed137(0x155),()=>_0xb38720[_0x4ed137(0x153)][_0x4ed137(0x181)](_0x172bcd),{'verbose':_0x2d63f9[_0x4ed137(0x159)]}),_0x3bdc61=_0x2e94bf[_0x4ed137(0x150)];let _0x46b843;if(_0x17d915[_0x4ed137(0x147)][_0x4ed137(0x177)]>0x2){const _0x728d0e=await withSpinner(_0x4ed137(0x160)+_0x312991+_0x4ed137(0x155),()=>_0xb38720[_0x4ed137(0x153)]['resolvePathToResource'](_0x312991),{'verbose':_0x2d63f9[_0x4ed137(0x159)]}),_0x6176a=_0x728d0e[_0x4ed137(0x150)];if(_0x6176a[_0x4ed137(0x15e)]!==_0x4ed137(0x16c)&&_0x6176a[_0x4ed137(0x15e)]!==_0x4ed137(0x162))return console[_0x4ed137(0x179)]('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x46b843=_0x6176a[_0x4ed137(0x180)];}else{if(_0x2d63f9[_0x4ed137(0x16c)]){const _0x30e3e4=await withSpinner(_0x4ed137(0x148)+_0x2d63f9[_0x4ed137(0x16c)]+_0x4ed137(0x155),()=>_0xb38720[_0x4ed137(0x153)][_0x4ed137(0x15f)](_0x3bdc61,_0x2d63f9[_0x4ed137(0x16c)]),{'verbose':_0x2d63f9['verbose']});_0x46b843=_0x30e3e4[_0x4ed137(0x150)];}}_0x2d63f9[_0x4ed137(0x159)]&&_0x46b843&&console[_0x4ed137(0x179)](_0x4ed137(0x158)+_0x46b843);const _0x1750a5=await loadJSONFromOptions(_0x2d63f9[_0x4ed137(0x172)],_0x2d63f9[_0x4ed137(0x161)]),_0x15b6b0={'name':_0x46288f,'description':_0x2d63f9['description'],'rule':_0x1750a5,'kind':_0x2d63f9[_0x4ed137(0x156)]!==undefined?parseInt(_0x2d63f9[_0x4ed137(0x156)],0xa):undefined,'isVisible':_0x2d63f9[_0x4ed137(0x176)]?![]:undefined,'segmentFolderId':_0x46b843,'countPopulation':_0x2d63f9[_0x4ed137(0x16a)]?![]:undefined},_0x3bb1f5=await withSpinner(_0x4ed137(0x165)+_0x46288f+'\x27...',()=>_0xb38720[_0x4ed137(0x153)][_0x4ed137(0x178)](_0x3bdc61,_0x15b6b0),{'verbose':_0x2d63f9[_0x4ed137(0x159)]}),_0x348ec6=_0x3bb1f5[_0x4ed137(0x150)];return console[_0x4ed137(0x179)](_0x4ed137(0x169)+_0x348ec6[_0x4ed137(0x14a)]+'\x27\x20with\x20ID:\x20'+_0x348ec6['id']),_0xa06c8e!==_0x1cb838&&console[_0x4ed137(0x179)](_0x4ed137(0x17e)+_0xa06c8e),await handleSDKOutput([_0x348ec6],_0x2d63f9),0x0;}}
1
+ const a38_0x31e824=a38_0x8abb;function a38_0x4d7e(){const _0x484fd8=['error','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','Site:\x20','kind','9weYPbf','69924JkMmbZ','3107008ygBhwN','260upNUID','resolveFolderId','rule','segments','segmentPath','Resolving\x20folder\x20\x27','33710dVRVQy','invisible','ruleFile','\x27\x20with\x20ID:\x20','site','77qqNTbx','execute','segment:create','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','Create\x20child\x20segment\x20with\x20filtering\x20rules','1tIQmRW','folderId','Resolving\x20parent\x20segment\x20\x27','Parent\x20path:\x20','data','resolvePathToResource','4859916OnXvgM','Segment\x20name:\x20','Creating\x20segment\x20\x27','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','Parent:\x20','length','Resolving\x20folder\x20path\x20\x27','verbose','1882372GUVcEQ','type','\x20\x20\x20Path:\x20','8250310FwcXlB','name','19254WbwaJI','Resolved\x20folder\x20ID:\x20','1169yMREEO','segment','\x27...','createSegment','✔\x20Created\x20segment\x20\x27','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','yellow','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','description','folder'];a38_0x4d7e=function(){return _0x484fd8;};return a38_0x4d7e();}function a38_0x8abb(_0x4ab3d0,_0x1449a4){_0x4ab3d0=_0x4ab3d0-0x99;const _0x4d7e3f=a38_0x4d7e();let _0x8abbb1=_0x4d7e3f[_0x4ab3d0];return _0x8abbb1;}(function(_0x2dd982,_0x2115b5){const _0x23352f=a38_0x8abb,_0x219d12=_0x2dd982();while(!![]){try{const _0x38af2c=-parseInt(_0x23352f(0xa6))/0x1*(parseInt(_0x23352f(0xb4))/0x2)+-parseInt(_0x23352f(0xca))/0x3+parseInt(_0x23352f(0xcc))/0x4*(parseInt(_0x23352f(0x9c))/0x5)+parseInt(_0x23352f(0xb9))/0x6*(-parseInt(_0x23352f(0xbb))/0x7)+-parseInt(_0x23352f(0xcb))/0x8+parseInt(_0x23352f(0xc9))/0x9*(-parseInt(_0x23352f(0xb7))/0xa)+parseInt(_0x23352f(0xa1))/0xb*(parseInt(_0x23352f(0xac))/0xc);if(_0x38af2c===_0x2115b5)break;else _0x219d12['push'](_0x219d12['shift']());}catch(_0x416587){_0x219d12['push'](_0x219d12['shift']());}}}(a38_0x4d7e,0x88911));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';import a38_0xb6b533 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x31e824(0xb8)]=a38_0x31e824(0xa3);[a38_0x31e824(0xc3)]=a38_0x31e824(0xa5);async[a38_0x31e824(0xa2)](_0x331dec){const _0x548315=a38_0x31e824;console['error'](a38_0xb6b533['yellow'](_0x548315(0xaf))),console['error'](a38_0xb6b533[_0x548315(0xc1)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x138ae3,args:_0x46fa7c,tdx:_0x275cc7}=_0x331dec,_0x3cf062=_0x138ae3;if(_0x46fa7c['length']===0x0)return console[_0x548315(0xc5)](_0x548315(0xc2)),console['error']('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console['error']('Examples:'),console[_0x548315(0xc5)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console[_0x548315(0xc5)](_0x548315(0xc6)),console[_0x548315(0xc5)](_0x548315(0xc0)),0x1;const _0x51018b=_0x46fa7c[0x0],_0x1979ef=_0x138ae3[_0x548315(0x9a)];let _0xf053fb=_0x51018b;_0x1979ef&&!_0x51018b['includes']('/')&&(_0xf053fb=_0x1979ef+'/'+_0x51018b,_0x3cf062[_0x548315(0xb3)]&&console[_0x548315(0xc5)]('Resolved\x20relative\x20path\x20to:\x20'+_0xf053fb));const _0x24003f=parsePath(_0xf053fb);if(_0x24003f[_0x548315(0x99)]['length']<0x2)return console[_0x548315(0xc5)]('Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'),console['error']('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x9e245e=_0x24003f['segments'][0x0],_0x45b992=getBaseName(_0xf053fb),_0x1de320=getParentPath(_0xf053fb);_0x3cf062['verbose']&&(console[_0x548315(0xc5)](_0x548315(0xc7)+_0x3cf062[_0x548315(0xa0)]),console['error']('Target\x20path:\x20'+_0xf053fb),console['error'](_0x548315(0xb0)+_0x9e245e),console[_0x548315(0xc5)](_0x548315(0xad)+_0x45b992),console['error'](_0x548315(0xa9)+_0x1de320));const _0x38c06c=await withSpinner(_0x548315(0xa8)+_0x9e245e+_0x548315(0xbd),()=>_0x275cc7['segment']['resolveParentId'](_0x9e245e),{'verbose':_0x3cf062[_0x548315(0xb3)]}),_0x296ed6=_0x38c06c[_0x548315(0xaa)];let _0x186e0b;if(_0x24003f[_0x548315(0x99)][_0x548315(0xb1)]>0x2){const _0x41a72b=await withSpinner(_0x548315(0xb2)+_0x1de320+_0x548315(0xbd),()=>_0x275cc7[_0x548315(0xbc)][_0x548315(0xab)](_0x1de320),{'verbose':_0x3cf062[_0x548315(0xb3)]}),_0x438553=_0x41a72b[_0x548315(0xaa)];if(_0x438553[_0x548315(0xb5)]!==_0x548315(0xc4)&&_0x438553[_0x548315(0xb5)]!=='parent')return console[_0x548315(0xc5)](_0x548315(0xa4)),0x1;_0x186e0b=_0x438553[_0x548315(0xa7)];}else{if(_0x3cf062[_0x548315(0xc4)]){const _0x501208=await withSpinner(_0x548315(0x9b)+_0x3cf062[_0x548315(0xc4)]+'\x27...',()=>_0x275cc7[_0x548315(0xbc)][_0x548315(0xcd)](_0x296ed6,_0x3cf062[_0x548315(0xc4)]),{'verbose':_0x3cf062[_0x548315(0xb3)]});_0x186e0b=_0x501208[_0x548315(0xaa)];}}_0x3cf062[_0x548315(0xb3)]&&_0x186e0b&&console[_0x548315(0xc5)](_0x548315(0xba)+_0x186e0b);const _0x234c26=await loadJSONFromOptions(_0x3cf062[_0x548315(0xce)],_0x3cf062[_0x548315(0x9e)]),_0x37876a={'name':_0x45b992,'description':_0x3cf062[_0x548315(0xc3)],'rule':_0x234c26,'kind':_0x3cf062[_0x548315(0xc8)]!==undefined?parseInt(_0x3cf062['kind'],0xa):undefined,'isVisible':_0x3cf062[_0x548315(0x9d)]?![]:undefined,'segmentFolderId':_0x186e0b,'countPopulation':_0x3cf062['noCountPopulation']?![]:undefined},_0x5d7b8f=await withSpinner(_0x548315(0xae)+_0x45b992+_0x548315(0xbd),()=>_0x275cc7[_0x548315(0xbc)][_0x548315(0xbe)](_0x296ed6,_0x37876a),{'verbose':_0x3cf062[_0x548315(0xb3)]}),_0x3d4c0c=_0x5d7b8f[_0x548315(0xaa)];return console['error'](_0x548315(0xbf)+_0x3d4c0c['name']+_0x548315(0x9f)+_0x3d4c0c['id']),_0xf053fb!==_0x51018b&&console[_0x548315(0xc5)](_0x548315(0xb6)+_0xf053fb),await handleSDKOutput([_0x3d4c0c],_0x3cf062),0x0;}}
@@ -1 +1 @@
1
- function a39_0x14f7(){const _0x4b9e7b=['14gNcJrS','33431673jdOJhb','Listing\x20fields\x20for\x20\x27','segment:fields','10826820iwQWjz','segment','14849984mwLZpn','30322JFpTOj','data','json','\x20field','40xfGQzq','170nrkChq','jsonl','2038884dQopMb','10FvGULF','Parent\x20segment:\x20','\x27...','execute','length','✔\x20Found\x20','name','listFields','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','21556agcocr','error','173244qCGFha','description','parentSegment'];a39_0x14f7=function(){return _0x4b9e7b;};return a39_0x14f7();}const a39_0x498c98=a39_0x2436;(function(_0x1c926f,_0x14f73b){const _0x5d68a7=a39_0x2436,_0x1463c9=_0x1c926f();while(!![]){try{const _0x381d74=parseInt(_0x5d68a7(0x18d))/0x1*(-parseInt(_0x5d68a7(0x189))/0x2)+parseInt(_0x5d68a7(0x17f))/0x3+parseInt(_0x5d68a7(0x17d))/0x4*(-parseInt(_0x5d68a7(0x18e))/0x5)+parseInt(_0x5d68a7(0x190))/0x6*(-parseInt(_0x5d68a7(0x182))/0x7)+-parseInt(_0x5d68a7(0x188))/0x8+parseInt(_0x5d68a7(0x186))/0x9+parseInt(_0x5d68a7(0x191))/0xa*(parseInt(_0x5d68a7(0x183))/0xb);if(_0x381d74===_0x14f73b)break;else _0x1463c9['push'](_0x1463c9['shift']());}catch(_0x4da956){_0x1463c9['push'](_0x1463c9['shift']());}}}(a39_0x14f7,0xede5d));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';function a39_0x2436(_0xa347e,_0x505c62){_0xa347e=_0xa347e-0x179;const _0x14f728=a39_0x14f7();let _0x243685=_0x14f728[_0xa347e];return _0x243685;}export class SegmentFieldsCommand extends BaseCommand{[a39_0x498c98(0x17a)]=a39_0x498c98(0x185);[a39_0x498c98(0x180)]='List\x20available\x20fields\x20for\x20segmentation';async[a39_0x498c98(0x194)](_0x4491cb){const _0x3625a9=a39_0x498c98,{options:_0x3f3a0c,args:_0x3f7e12,tdx:_0xdec542}=_0x4491cb,_0x5be07b=_0x3f7e12[0x0]||_0x3f3a0c[_0x3625a9(0x181)];if(!_0x5be07b)return console['error']('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x3625a9(0x17e)](_0x3625a9(0x17c)),console[_0x3625a9(0x17e)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;_0x3f3a0c['verbose']&&(console['error']('Site:\x20'+_0x3f3a0c['site']),console['error'](_0x3625a9(0x192)+_0x5be07b));const _0x7db8fd=await withSpinner(_0x3625a9(0x184)+_0x5be07b+_0x3625a9(0x193),()=>_0xdec542[_0x3625a9(0x187)][_0x3625a9(0x17b)](_0x5be07b),{'verbose':_0x3f3a0c['verbose']}),_0x1a956c=_0x7db8fd[_0x3625a9(0x18a)];console['error'](_0x3625a9(0x179)+_0x1a956c[_0x3625a9(0x195)]+_0x3625a9(0x18c)+(_0x1a956c[_0x3625a9(0x195)]!==0x1?'s':''));if(_0x3f3a0c[_0x3625a9(0x18b)]||_0x3f3a0c[_0x3625a9(0x18f)])return await handleSDKOutput(_0x1a956c,_0x3f3a0c),0x0;return displayFieldsHumanReadable(_0x1a956c,_0x5be07b),0x0;}}
1
+ const a39_0x24491a=a39_0x3b23;(function(_0x4ee828,_0x3eadd3){const _0x9b13b7=a39_0x3b23,_0x45fafc=_0x4ee828();while(!![]){try{const _0x592de6=parseInt(_0x9b13b7(0xeb))/0x1*(-parseInt(_0x9b13b7(0xf4))/0x2)+parseInt(_0x9b13b7(0xdf))/0x3*(-parseInt(_0x9b13b7(0xe7))/0x4)+parseInt(_0x9b13b7(0xed))/0x5*(-parseInt(_0x9b13b7(0xec))/0x6)+-parseInt(_0x9b13b7(0xe9))/0x7*(-parseInt(_0x9b13b7(0xf1))/0x8)+parseInt(_0x9b13b7(0xee))/0x9+parseInt(_0x9b13b7(0xf6))/0xa+-parseInt(_0x9b13b7(0xe2))/0xb*(-parseInt(_0x9b13b7(0xe5))/0xc);if(_0x592de6===_0x3eadd3)break;else _0x45fafc['push'](_0x45fafc['shift']());}catch(_0x20c337){_0x45fafc['push'](_0x45fafc['shift']());}}}(a39_0x11bb,0xbc3f8));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a39_0x11bb(){const _0x1c1f70=['2918156MLyEko','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','35NQVKYU','parentSegment','276SyMMcv','301014MjbJVE','95dmAANL','4862385dofWZq','length','✔\x20Found\x20','462832xxCuBb','\x20field','description','3522FBhZbp','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','8685090JUjNsi','data','3hADGEH','segment','json','1397GCoDcA','execute','Error:\x20Parent\x20segment\x20name\x20is\x20required','117336CHoWhB','error'];a39_0x11bb=function(){return _0x1c1f70;};return a39_0x11bb();}function a39_0x3b23(_0x1b4ecf,_0x2c9641){_0x1b4ecf=_0x1b4ecf-0xdf;const _0x11bb4f=a39_0x11bb();let _0x3b234a=_0x11bb4f[_0x1b4ecf];return _0x3b234a;}import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{['name']='segment:fields';[a39_0x24491a(0xf3)]='List\x20available\x20fields\x20for\x20segmentation';async[a39_0x24491a(0xe3)](_0x13203a){const _0x5e6972=a39_0x24491a,{options:_0x52a665,args:_0x2955f4,tdx:_0x1ab5d9}=_0x13203a,_0xb49015=_0x2955f4[0x0]||_0x52a665[_0x5e6972(0xea)];if(!_0xb49015)return console[_0x5e6972(0xe6)](_0x5e6972(0xe4)),console[_0x5e6972(0xe6)](_0x5e6972(0xf5)),console['error'](_0x5e6972(0xe8)),0x1;_0x52a665['verbose']&&(console[_0x5e6972(0xe6)]('Site:\x20'+_0x52a665['site']),console[_0x5e6972(0xe6)]('Parent\x20segment:\x20'+_0xb49015));const _0x8fa8c4=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0xb49015+'\x27...',()=>_0x1ab5d9[_0x5e6972(0xe0)]['listFields'](_0xb49015),{'verbose':_0x52a665['verbose']}),_0x31ab74=_0x8fa8c4[_0x5e6972(0xf7)];console[_0x5e6972(0xe6)](_0x5e6972(0xf0)+_0x31ab74[_0x5e6972(0xef)]+_0x5e6972(0xf2)+(_0x31ab74[_0x5e6972(0xef)]!==0x1?'s':''));if(_0x52a665[_0x5e6972(0xe1)]||_0x52a665['jsonl'])return await handleSDKOutput(_0x31ab74,_0x52a665),0x0;return displayFieldsHumanReadable(_0x31ab74,_0xb49015),0x0;}}