@treasuredata/tdx 2026.6.0 → 2026.6.2

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 (248) 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.js +1 -1
  27. package/dist/commands/engage-template-pull-command.js +1 -1
  28. package/dist/commands/engage-template-push-command.js +1 -1
  29. package/dist/commands/engage-template-validate-command.js +1 -1
  30. package/dist/commands/job-command.js +1 -1
  31. package/dist/commands/journey-command.js +1 -1
  32. package/dist/commands/journey-validate-command.js +1 -1
  33. package/dist/commands/llm-command.js +1 -1
  34. package/dist/commands/mcp-command.js +1 -1
  35. package/dist/commands/parent-segment-command.js +1 -1
  36. package/dist/commands/policy-command.js +1 -1
  37. package/dist/commands/profile-command.js +1 -1
  38. package/dist/commands/profiles-command.js +1 -1
  39. package/dist/commands/query-command.js +1 -1
  40. package/dist/commands/schedule-command.js +1 -1
  41. package/dist/commands/segment-command.js +1 -1
  42. package/dist/commands/segment-create-command.js +1 -1
  43. package/dist/commands/segment-fields-command.js +1 -1
  44. package/dist/commands/segment-pull-command.js +1 -1
  45. package/dist/commands/segment-push-command.js +1 -1
  46. package/dist/commands/segment-update-command.js +1 -1
  47. package/dist/commands/segment-use-command.js +1 -1
  48. package/dist/commands/segment-validate-command.js +1 -1
  49. package/dist/commands/segments.js +1 -1
  50. package/dist/commands/show.js +1 -1
  51. package/dist/commands/status-command.js +1 -1
  52. package/dist/commands/table-deleted.js +1 -1
  53. package/dist/commands/tables.js +1 -1
  54. package/dist/commands/unset-command.js +1 -1
  55. package/dist/commands/upgrade-command.js +1 -1
  56. package/dist/commands/use-command.js +1 -1
  57. package/dist/commands/user-command.js +1 -1
  58. package/dist/commands/work-command.js +1 -1
  59. package/dist/commands/workflow-command.d.ts +2 -2
  60. package/dist/commands/workflow-command.d.ts.map +1 -1
  61. package/dist/commands/workflow-command.js +1 -1
  62. package/dist/commands/workflow-command.js.map +1 -1
  63. package/dist/core/auth.js +1 -1
  64. package/dist/core/command-output.js +1 -1
  65. package/dist/core/config.js +1 -1
  66. package/dist/core/connection-cache.js +1 -1
  67. package/dist/core/constants.js +1 -1
  68. package/dist/core/credential-cache.js +1 -1
  69. package/dist/core/global-context.js +1 -1
  70. package/dist/core/keychain.js +1 -1
  71. package/dist/core/oauth-keychain.js +1 -1
  72. package/dist/core/oauth.js +1 -1
  73. package/dist/core/profile.js +1 -1
  74. package/dist/core/project-config.js +1 -1
  75. package/dist/core/session.js +1 -1
  76. package/dist/core/user-cache.js +1 -1
  77. package/dist/core/version.js +1 -1
  78. package/dist/index.js +1 -1
  79. package/dist/mcp/server.js +1 -1
  80. package/dist/mcp/tools/index.js +1 -1
  81. package/dist/mcp/tools/tdx-run.js +1 -1
  82. package/dist/mcp/tools/tdx-search.js +1 -1
  83. package/dist/mcp/tools/work-create-item.js +1 -1
  84. package/dist/mcp/utils.js +1 -1
  85. package/dist/proxy/claude-usage-tracker.js +1 -1
  86. package/dist/proxy/passthrough-server.js +1 -1
  87. package/dist/proxy/sse-usage-parser.js +1 -1
  88. package/dist/sdk/agent/agent-config.js +1 -1
  89. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  90. package/dist/sdk/agent/agent-yaml.js +1 -1
  91. package/dist/sdk/agent/test/evaluator.js +1 -1
  92. package/dist/sdk/agent/test/executor.js +1 -1
  93. package/dist/sdk/agent/test/index.js +1 -1
  94. package/dist/sdk/agent/test/output.js +1 -1
  95. package/dist/sdk/agent/test/parser.js +1 -1
  96. package/dist/sdk/agent/tool-target-registry.js +1 -1
  97. package/dist/sdk/api.js +1 -1
  98. package/dist/sdk/cas/cas-api-client.js +1 -1
  99. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  100. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  101. package/dist/sdk/cas/index.js +1 -1
  102. package/dist/sdk/cas/pull-workflow.js +1 -1
  103. package/dist/sdk/cas/push-workflow.js +1 -1
  104. package/dist/sdk/client/cdp-api-client.js +1 -1
  105. package/dist/sdk/client/cdp-api-client.js.map +1 -1
  106. package/dist/sdk/client/delivery-api-client.js +1 -1
  107. package/dist/sdk/client/endpoints.js +1 -1
  108. package/dist/sdk/client/engage-api-client.js +1 -1
  109. package/dist/sdk/client/http-client.js +1 -1
  110. package/dist/sdk/client/llm-api-client.js +1 -1
  111. package/dist/sdk/client/oauth-refresh.js +1 -1
  112. package/dist/sdk/client/rate-limiter.js +1 -1
  113. package/dist/sdk/client/td-api-client.js +1 -1
  114. package/dist/sdk/client/trino-api-client.js +1 -1
  115. package/dist/sdk/client/workflow-client.d.ts +23 -1
  116. package/dist/sdk/client/workflow-client.d.ts.map +1 -1
  117. package/dist/sdk/client/workflow-client.js +1 -1
  118. package/dist/sdk/client/workflow-client.js.map +1 -1
  119. package/dist/sdk/connection-validator.js +1 -1
  120. package/dist/sdk/connection.js +1 -1
  121. package/dist/sdk/delivery.js +1 -1
  122. package/dist/sdk/engage/campaign-pull.js +1 -1
  123. package/dist/sdk/engage/campaign-push.js +1 -1
  124. package/dist/sdk/engage/campaign-validator.js +1 -1
  125. package/dist/sdk/engage/campaign-yaml.js +1 -1
  126. package/dist/sdk/engage/template-pull.js +1 -1
  127. package/dist/sdk/engage/template-push.js +1 -1
  128. package/dist/sdk/engage/template-validator.js +1 -1
  129. package/dist/sdk/engage/template-yaml.js +1 -1
  130. package/dist/sdk/engage/types/campaign-def.js +1 -1
  131. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  132. package/dist/sdk/engage/types/template-schema.js +1 -1
  133. package/dist/sdk/engage.js +1 -1
  134. package/dist/sdk/errors.js +1 -1
  135. package/dist/sdk/index.js +1 -1
  136. package/dist/sdk/io/index.js +1 -1
  137. package/dist/sdk/io/node-filesystem.js +1 -1
  138. package/dist/sdk/job.js +1 -1
  139. package/dist/sdk/journey.js +1 -1
  140. package/dist/sdk/llm/chat-cache.js +1 -1
  141. package/dist/sdk/llm/index.js +1 -1
  142. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  143. package/dist/sdk/llm/model-factors.d.ts +8 -4
  144. package/dist/sdk/llm/model-factors.d.ts.map +1 -1
  145. package/dist/sdk/llm/model-factors.js +1 -1
  146. package/dist/sdk/llm/model-factors.js.map +1 -1
  147. package/dist/sdk/llm/user-settings.js +1 -1
  148. package/dist/sdk/personalization.js +1 -1
  149. package/dist/sdk/policy.js +1 -1
  150. package/dist/sdk/query/deleted-table-validation.js +1 -1
  151. package/dist/sdk/query/index.js +1 -1
  152. package/dist/sdk/query/sql-parser.js +1 -1
  153. package/dist/sdk/realtime.js +1 -1
  154. package/dist/sdk/schedule.js +1 -1
  155. package/dist/sdk/segment/child-segment-yaml.d.ts.map +1 -1
  156. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  157. package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
  158. package/dist/sdk/segment/fields-display.js +1 -1
  159. package/dist/sdk/segment/file-discovery.js +1 -1
  160. package/dist/sdk/segment/journey-utils.js +1 -1
  161. package/dist/sdk/segment/journey-validator.js +1 -1
  162. package/dist/sdk/segment/journey-yaml.js +1 -1
  163. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  164. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  165. package/dist/sdk/segment/pull-workflow.js +1 -1
  166. package/dist/sdk/segment/push-recovery.js +1 -1
  167. package/dist/sdk/segment/push-workflow.js +1 -1
  168. package/dist/sdk/segment/resolution-context.js +1 -1
  169. package/dist/sdk/segment/segment-path-parser.js +1 -1
  170. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  171. package/dist/sdk/segment/segment-validator.js +1 -1
  172. package/dist/sdk/segment/target-resolution.js +1 -1
  173. package/dist/sdk/segment/tdx-config.js +1 -1
  174. package/dist/sdk/segment/types/activation-schema.js +1 -1
  175. package/dist/sdk/segment/types/journey-def.js +1 -1
  176. package/dist/sdk/segment/types/journey-schema.js +1 -1
  177. package/dist/sdk/segment/types/segment-def.js +1 -1
  178. package/dist/sdk/segment/types/segment-schema.js +1 -1
  179. package/dist/sdk/segment/validate-files.js +1 -1
  180. package/dist/sdk/segment/yaml-validator.js +1 -1
  181. package/dist/sdk/segment.js +1 -1
  182. package/dist/sdk/types/cdp.d.ts +4 -3
  183. package/dist/sdk/types/cdp.d.ts.map +1 -1
  184. package/dist/sdk/types/index.js +1 -1
  185. package/dist/sdk/types/progress.js +1 -1
  186. package/dist/sdk/types/workflow.d.ts +1 -1
  187. package/dist/sdk/types/workflow.d.ts.map +1 -1
  188. package/dist/sdk/types/workspace.js +1 -1
  189. package/dist/sdk/user.js +1 -1
  190. package/dist/sdk/util/format-detector.js +1 -1
  191. package/dist/sdk/util/formatters.js +1 -1
  192. package/dist/sdk/util/index.js +1 -1
  193. package/dist/sdk/util/paginate.js +1 -1
  194. package/dist/sdk/util/tree-formatter.js +1 -1
  195. package/dist/sdk/workflow/archive-validation.js +1 -1
  196. package/dist/sdk/workflow/clone-workflow.js +1 -1
  197. package/dist/sdk/workflow/index.d.ts +23 -2
  198. package/dist/sdk/workflow/index.d.ts.map +1 -1
  199. package/dist/sdk/workflow/index.js +1 -1
  200. package/dist/sdk/workflow/index.js.map +1 -1
  201. package/dist/sdk/workflow/pull-workflow.js +1 -1
  202. package/dist/sdk/workflow/push-workflow.d.ts +4 -0
  203. package/dist/sdk/workflow/push-workflow.d.ts.map +1 -1
  204. package/dist/sdk/workflow/push-workflow.js +1 -1
  205. package/dist/sdk/workflow/push-workflow.js.map +1 -1
  206. package/dist/sdk/workflow/task-graph.js +1 -1
  207. package/dist/sdk/workflow/tdx-config.js +1 -1
  208. package/dist/sdk/workflow/workflow-utils.js +1 -1
  209. package/dist/sdk/workspace/access-tracker.js +1 -1
  210. package/dist/sdk/workspace/frontmatter.js +1 -1
  211. package/dist/sdk/workspace/git.js +1 -1
  212. package/dist/sdk/workspace/index.js +1 -1
  213. package/dist/sdk/workspace/templates.js +1 -1
  214. package/dist/sdk/workspace/weekly.js +1 -1
  215. package/dist/sdk/workspace/wikilinks.js +1 -1
  216. package/dist/test-utils/command-runner.js +1 -1
  217. package/dist/test-utils/factories.js +1 -1
  218. package/dist/test-utils/fixtures.js +1 -1
  219. package/dist/test-utils/http-mock.js +1 -1
  220. package/dist/test-utils/index.js +1 -1
  221. package/dist/utils/async.js +1 -1
  222. package/dist/utils/colors.js +1 -1
  223. package/dist/utils/diff.js +1 -1
  224. package/dist/utils/file-permissions.js +1 -1
  225. package/dist/utils/file-reader.js +1 -1
  226. package/dist/utils/github-releases.js +1 -1
  227. package/dist/utils/global-cache.js +1 -1
  228. package/dist/utils/json-loader.js +1 -1
  229. package/dist/utils/local-cache.js +1 -1
  230. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  231. package/dist/utils/logger/formatters/index.js +1 -1
  232. package/dist/utils/logger/handlers/console-handler.js +1 -1
  233. package/dist/utils/logger/handlers/file-handler.js +1 -1
  234. package/dist/utils/logger/handlers/index.js +1 -1
  235. package/dist/utils/logger/handlers/null-handler.js +1 -1
  236. package/dist/utils/logger/index.js +1 -1
  237. package/dist/utils/logger/logger.js +1 -1
  238. package/dist/utils/logger/types.js +1 -1
  239. package/dist/utils/option-validation.js +1 -1
  240. package/dist/utils/process.js +1 -1
  241. package/dist/utils/prompt.js +1 -1
  242. package/dist/utils/spinner.js +1 -1
  243. package/dist/utils/sse-parser.js +1 -1
  244. package/dist/utils/string-utils.js +1 -1
  245. package/dist/utils/table-ref-parser.js +1 -1
  246. package/dist/utils/tdx-logger.js +1 -1
  247. package/dist/utils/version-check.js +1 -1
  248. package/package.json +1 -1
@@ -1 +1 @@
1
- const a32_0x99d6cb=a32_0x2d73;function a32_0x49b5(){const _0x465051=['email','\x20\x20•\x20','all','10aMLybG','858612rXcIkV','getPolicyUsers','validate','\x20user','data','👥\x20Assigned\x20Users','17757179cGtENA','28357EhwbCd','getMyPermissions','args','ies','Account\x20Owner','✔\x20Found\x20','entries','117748lLmEDn','\x20\x20No\x20permissions','1538091JbMysI','12JstdMX','bold','policies','dim','account_id','permissions','verbose','description','\x20—\x20','231188hfbkTH','padEnd','39PkSuJJ','No\x20policies\x20found','map','join','(ID:\x20','policy','policy\x20list','getCurrent','length','Fetching\x20permissions...','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','error','Member','execute','listPolicies','\x20polic','administrator','1518ZHdUTQ','getPolicyPermissions','📋\x20Assigned\x20Policies','\x20\x20\x20','user','log','name','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','account_owner','95AagKAC','11492056TMKdFM','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','Administrator','getPolicy'];a32_0x49b5=function(){return _0x465051;};return a32_0x49b5();}(function(_0x4f7164,_0x573a58){const _0x446302=a32_0x2d73,_0x13a0ee=_0x4f7164();while(!![]){try{const _0x103d39=parseInt(_0x446302(0xb2))/0x1+parseInt(_0x446302(0x8d))/0x2*(parseInt(_0x446302(0x8f))/0x3)+-parseInt(_0x446302(0x81))/0x4*(parseInt(_0x446302(0xa9))/0x5)+-parseInt(_0x446302(0xa0))/0x6*(parseInt(_0x446302(0x7a))/0x7)+-parseInt(_0x446302(0xaa))/0x8+-parseInt(_0x446302(0x83))/0x9*(parseInt(_0x446302(0xb1))/0xa)+-parseInt(_0x446302(0x79))/0xb*(-parseInt(_0x446302(0x84))/0xc);if(_0x103d39===_0x573a58)break;else _0x13a0ee['push'](_0x13a0ee['shift']());}catch(_0x45af3f){_0x13a0ee['push'](_0x13a0ee['shift']());}}}(a32_0x49b5,0xbf68b));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';function a32_0x2d73(_0x3a7050,_0x5ea815){_0x3a7050=_0x3a7050-0x75;const _0x49b5cf=a32_0x49b5();let _0x2d735c=_0x49b5cf[_0x3a7050];return _0x2d735c;}import{withSpinner}from'../utils/spinner.js';import a32_0x24d4c3 from'chalk';export class PolicyCommand extends BaseCommand{['name']=a32_0x99d6cb(0x94);[a32_0x99d6cb(0x8b)]=a32_0x99d6cb(0xa7);async[a32_0x99d6cb(0x9c)](_0x42bce1){const _0x2ecf6c=a32_0x99d6cb,{options:_0x2e02b6,tdx:_0x332519}=_0x42bce1,_0x118f9e=await withSpinner(_0x2ecf6c(0x98),async()=>{const _0x4e7457=_0x2ecf6c,[_0x35fd94,_0x189ceb]=await Promise[_0x4e7457(0xb0)]([_0x332519[_0x4e7457(0xa4)][_0x4e7457(0x96)](),_0x332519['policy'][_0x4e7457(0x7b)]()]);return{'userInfo':_0x35fd94,'permissions':_0x189ceb};},{'verbose':_0x2e02b6[_0x2ecf6c(0x8a)]}),{userInfo:_0x1c0f74,permissions:_0x113a78}=_0x118f9e[_0x2ecf6c(0x77)];if(isStructuredFormat(_0x2e02b6))return await handleSingleObjectOutput(_0x113a78,_0x2e02b6),0x0;const _0x1dcb26=_0x1c0f74[_0x2ecf6c(0xa8)]?_0x2ecf6c(0x7e):_0x1c0f74[_0x2ecf6c(0x9f)]?_0x2ecf6c(0xac):_0x2ecf6c(0x9b);console['log']('\x0a'+a32_0x24d4c3[_0x2ecf6c(0x85)]('👤')+'\x20'+a32_0x24d4c3['bold'](_0x1c0f74[_0x2ecf6c(0xa6)])+'\x20'+a32_0x24d4c3[_0x2ecf6c(0x87)]('('+_0x1c0f74['email']+')')+_0x2ecf6c(0x8c)+_0x1dcb26),console[_0x2ecf6c(0xa5)](a32_0x24d4c3[_0x2ecf6c(0x87)](_0x2ecf6c(0xa3)+_0x332519['context']['site']+':'+_0x1c0f74[_0x2ecf6c(0x88)]+',\x20user_id:'+_0x1c0f74['id']));const _0x43940c=_0x113a78[_0x2ecf6c(0x86)];console['log']('\x0a'+a32_0x24d4c3[_0x2ecf6c(0x85)](_0x2ecf6c(0xa2))+'\x20('+_0x43940c[_0x2ecf6c(0x97)]+'):');if(_0x43940c[_0x2ecf6c(0x97)]===0x0)console['log'](a32_0x24d4c3[_0x2ecf6c(0x87)]('\x20\x20No\x20policies\x20assigned'));else for(const _0x7f7cae of _0x43940c){console['log']('\x20\x20•\x20'+_0x7f7cae[_0x2ecf6c(0xa6)]);}return printPermissionsMap(_0x113a78[_0x2ecf6c(0x89)]),console[_0x2ecf6c(0xa5)](),0x0;}}export class PolicyListCommand extends BaseCommand{['name']=a32_0x99d6cb(0x95);['description']=a32_0x99d6cb(0xab);async['execute'](_0x25f24e){const _0xaf4f64=a32_0x99d6cb,{options:_0x33b7ff,tdx:_0x18c030}=_0x25f24e,_0x1bb496=await withSpinner('Listing\x20policies...',()=>_0x18c030[_0xaf4f64(0x94)][_0xaf4f64(0x9d)](),{'verbose':_0x33b7ff['verbose']}),_0x12867a=_0x1bb496['data'];console[_0xaf4f64(0x9a)](_0xaf4f64(0x7f)+_0x12867a[_0xaf4f64(0x97)]+_0xaf4f64(0x9e)+(_0x12867a[_0xaf4f64(0x97)]!==0x1?_0xaf4f64(0x7d):'y'));if(isStructuredFormat(_0x33b7ff))return await handleSDKOutput(_0x12867a,_0x33b7ff),0x0;if(_0x12867a[_0xaf4f64(0x97)]===0x0)console[_0xaf4f64(0xa5)](a32_0x24d4c3[_0xaf4f64(0x87)](_0xaf4f64(0x90)));else for(const _0x3b8fea of _0x12867a){const _0x1cdab3=_0x3b8fea['description']?a32_0x24d4c3[_0xaf4f64(0x87)](_0xaf4f64(0x8c)+_0x3b8fea['description']):'';console[_0xaf4f64(0xa5)]('\x20\x20•\x20'+_0x3b8fea[_0xaf4f64(0xa6)]+_0x1cdab3);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x99d6cb(0xa6)]='policy\x20show';[a32_0x99d6cb(0x8b)]=a32_0x99d6cb(0x99);[a32_0x99d6cb(0x75)](_0x490828){const _0x3642a9=a32_0x99d6cb;if(_0x490828[_0x3642a9(0x7c)][_0x3642a9(0x97)]===0x0)return'Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>';return undefined;}async['execute'](_0x14da51){const _0x40c894=a32_0x99d6cb,{options:_0x4dd576,tdx:_0x5eacca}=_0x14da51,_0x5a4681=_0x14da51[_0x40c894(0x7c)][0x0],_0x3555b7=await withSpinner('Fetching\x20policy...',async()=>{const _0x2de20f=_0x40c894,_0xfae755=await _0x5eacca['policy'][_0x2de20f(0xad)](_0x5a4681),[_0x1b8712,_0x352d71]=await Promise[_0x2de20f(0xb0)]([_0x5eacca['policy'][_0x2de20f(0xa1)](_0xfae755['id']),_0x5eacca['policy'][_0x2de20f(0xb3)](_0xfae755['id'])]);return{'policy':_0xfae755,'perms':_0x1b8712,'users':_0x352d71};},{'verbose':_0x4dd576['verbose']}),{policy:_0x4df196,perms:_0x16e480,users:_0x864ba7}=_0x3555b7['data'];if(isStructuredFormat(_0x4dd576))return await handleSingleObjectOutput({..._0x4df196,'permissions':_0x16e480['permissions'],'users':_0x864ba7},_0x4dd576),0x0;console[_0x40c894(0xa5)]('\x0a'+a32_0x24d4c3[_0x40c894(0x85)]('📋')+'\x20'+a32_0x24d4c3['bold'](_0x4df196[_0x40c894(0xa6)])+'\x20'+a32_0x24d4c3['dim'](_0x40c894(0x93)+_0x4df196['id']+')'));_0x4df196['description']&&console['log'](_0x40c894(0xa3)+a32_0x24d4c3[_0x40c894(0x87)](_0x4df196[_0x40c894(0x8b)]));console[_0x40c894(0xa5)]('\x20\x20\x20'+_0x864ba7[_0x40c894(0x97)]+_0x40c894(0x76)+(_0x864ba7[_0x40c894(0x97)]!==0x1?'s':'')+'\x20assigned'),printPermissionsMap(_0x16e480[_0x40c894(0x89)]);if(_0x864ba7['length']>0x0){console['log']('\x0a'+a32_0x24d4c3['bold'](_0x40c894(0x78))+':');for(const _0x44764e of _0x864ba7){const _0x536eb4=_0x44764e['email']&&_0x44764e[_0x40c894(0xae)]!==_0x44764e['name']?a32_0x24d4c3[_0x40c894(0x87)]('\x20<'+_0x44764e[_0x40c894(0xae)]+'>'):'';console[_0x40c894(0xa5)](_0x40c894(0xaf)+_0x44764e[_0x40c894(0xa6)]+_0x536eb4);}}return console[_0x40c894(0xa5)](),0x0;}}function printPermissionsMap(_0x54bd0c){const _0x2a653a=a32_0x99d6cb,_0x37f81e=Object[_0x2a653a(0x80)](_0x54bd0c);console[_0x2a653a(0xa5)]('\x0a'+a32_0x24d4c3[_0x2a653a(0x85)]('🔑\x20Effective\x20Permissions')+':');if(_0x37f81e[_0x2a653a(0x97)]===0x0){console['log'](a32_0x24d4c3[_0x2a653a(0x87)](_0x2a653a(0x82)));return;}const _0x20349f=Math['max'](..._0x37f81e[_0x2a653a(0x91)](([_0x57f7cc])=>_0x57f7cc['length']));for(const [_0x4c3c1e,_0x359369]of _0x37f81e){const _0x54b072=formatOperations(_0x359369);console[_0x2a653a(0xa5)]('\x20\x20'+_0x4c3c1e[_0x2a653a(0x8e)](_0x20349f+0x2)+_0x54b072);}}function formatOperations(_0x478d97){const _0x3ef1b6=a32_0x99d6cb,_0x58ea07=[...new Set(_0x478d97[_0x3ef1b6(0x91)](_0xd9254=>_0xd9254['operation']))];return _0x58ea07[_0x3ef1b6(0x92)](',\x20');}
1
+ const a32_0x570f1e=a32_0x3cd1;(function(_0x111d94,_0x2cfc91){const _0x125aa8=a32_0x3cd1,_0x222187=_0x111d94();while(!![]){try{const _0x26eb4f=-parseInt(_0x125aa8(0x179))/0x1*(parseInt(_0x125aa8(0x18d))/0x2)+-parseInt(_0x125aa8(0x199))/0x3+-parseInt(_0x125aa8(0x170))/0x4+parseInt(_0x125aa8(0x17e))/0x5*(-parseInt(_0x125aa8(0x16d))/0x6)+-parseInt(_0x125aa8(0x17b))/0x7+parseInt(_0x125aa8(0x1a0))/0x8+parseInt(_0x125aa8(0x16e))/0x9;if(_0x26eb4f===_0x2cfc91)break;else _0x222187['push'](_0x222187['shift']());}catch(_0x34356e){_0x222187['push'](_0x222187['shift']());}}}(a32_0x2591,0xe2589));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x593a6d from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x570f1e(0x18f)]='policy';[a32_0x570f1e(0x18a)]=a32_0x570f1e(0x19c);async[a32_0x570f1e(0x193)](_0x4ee044){const _0x133c9d=a32_0x570f1e,{options:_0x4ff939,tdx:_0xdcb2b8}=_0x4ee044,_0x35fca1=await withSpinner('Fetching\x20permissions...',async()=>{const _0x432292=a32_0x3cd1,[_0x431948,_0x279cdf]=await Promise[_0x432292(0x166)]([_0xdcb2b8[_0x432292(0x190)][_0x432292(0x17c)](),_0xdcb2b8[_0x432292(0x182)][_0x432292(0x16c)]()]);return{'userInfo':_0x431948,'permissions':_0x279cdf};},{'verbose':_0x4ff939[_0x133c9d(0x177)]}),{userInfo:_0x2b8977,permissions:_0x427202}=_0x35fca1[_0x133c9d(0x19b)];if(isStructuredFormat(_0x4ff939))return await handleSingleObjectOutput(_0x427202,_0x4ff939),0x0;const _0x20ceb8=_0x2b8977[_0x133c9d(0x192)]?_0x133c9d(0x180):_0x2b8977[_0x133c9d(0x16a)]?_0x133c9d(0x195):_0x133c9d(0x187);console[_0x133c9d(0x188)]('\x0a'+a32_0x593a6d[_0x133c9d(0x181)]('👤')+'\x20'+a32_0x593a6d[_0x133c9d(0x181)](_0x2b8977[_0x133c9d(0x18f)])+'\x20'+a32_0x593a6d[_0x133c9d(0x18e)]('('+_0x2b8977[_0x133c9d(0x19d)]+')')+_0x133c9d(0x185)+_0x20ceb8),console[_0x133c9d(0x188)](a32_0x593a6d[_0x133c9d(0x18e)](_0x133c9d(0x178)+_0xdcb2b8[_0x133c9d(0x19f)][_0x133c9d(0x16f)]+':'+_0x2b8977[_0x133c9d(0x18c)]+_0x133c9d(0x16b)+_0x2b8977['id']));const _0x43e8eb=_0x427202[_0x133c9d(0x171)];console[_0x133c9d(0x188)]('\x0a'+a32_0x593a6d[_0x133c9d(0x181)](_0x133c9d(0x197))+'\x20('+_0x43e8eb[_0x133c9d(0x19a)]+'):');if(_0x43e8eb[_0x133c9d(0x19a)]===0x0)console[_0x133c9d(0x188)](a32_0x593a6d['dim'](_0x133c9d(0x173)));else for(const _0x25777c of _0x43e8eb){console[_0x133c9d(0x188)](_0x133c9d(0x165)+_0x25777c[_0x133c9d(0x18f)]);}return printPermissionsMap(_0x427202[_0x133c9d(0x172)]),console[_0x133c9d(0x188)](),0x0;}}function a32_0x3cd1(_0x3f1a81,_0x7970a){_0x3f1a81=_0x3f1a81-0x164;const _0x259133=a32_0x2591();let _0x3cd1a6=_0x259133[_0x3f1a81];return _0x3cd1a6;}export class PolicyListCommand extends BaseCommand{['name']=a32_0x570f1e(0x17f);[a32_0x570f1e(0x18a)]=a32_0x570f1e(0x168);async[a32_0x570f1e(0x193)](_0x48baba){const _0xff95ea=a32_0x570f1e,{options:_0x599131,tdx:_0x407f00}=_0x48baba,_0x25d5f1=await withSpinner('Listing\x20policies...',()=>_0x407f00[_0xff95ea(0x182)]['listPolicies'](),{'verbose':_0x599131[_0xff95ea(0x177)]}),_0x3c2274=_0x25d5f1[_0xff95ea(0x19b)];console[_0xff95ea(0x17d)]('✔\x20Found\x20'+_0x3c2274[_0xff95ea(0x19a)]+_0xff95ea(0x175)+(_0x3c2274[_0xff95ea(0x19a)]!==0x1?'ies':'y'));if(isStructuredFormat(_0x599131))return await handleSDKOutput(_0x3c2274,_0x599131),0x0;if(_0x3c2274[_0xff95ea(0x19a)]===0x0)console[_0xff95ea(0x188)](a32_0x593a6d[_0xff95ea(0x18e)](_0xff95ea(0x169)));else for(const _0x16b6d5 of _0x3c2274){const _0x3e8284=_0x16b6d5[_0xff95ea(0x18a)]?a32_0x593a6d[_0xff95ea(0x18e)]('\x20—\x20'+_0x16b6d5[_0xff95ea(0x18a)]):'';console['log']('\x20\x20•\x20'+_0x16b6d5[_0xff95ea(0x18f)]+_0x3e8284);}return 0x0;}}function a32_0x2591(){const _0x551fe8=['log','\x20user','description','args','account_id','334272IPWdMw','dim','name','user','policy\x20show','account_owner','execute','max','Administrator','(ID:\x20','📋\x20Assigned\x20Policies','map','1883778vvxlod','length','data','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','email','validate','context','5509584HunIAh','getPolicyUsers','operation','\x20\x20•\x20','all','join','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','No\x20policies\x20found','administrator',',\x20user_id:','getMyPermissions','474YBOOfI','35992017bkkDmz','site','1160776jwQUJn','policies','permissions','\x20\x20No\x20policies\x20assigned','padEnd','\x20polic','\x20assigned','verbose','\x20\x20\x20','5uXFnGM','getPolicy','12820073dDrqJV','getCurrent','error','11105yOqrLN','policy\x20list','Account\x20Owner','bold','policy','entries','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','\x20—\x20','\x20\x20No\x20permissions','Member'];a32_0x2591=function(){return _0x551fe8;};return a32_0x2591();}export class PolicyShowCommand extends BaseCommand{['name']=a32_0x570f1e(0x191);['description']='Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)';[a32_0x570f1e(0x19e)](_0x3dee8a){const _0x4168b9=a32_0x570f1e;if(_0x3dee8a[_0x4168b9(0x18b)][_0x4168b9(0x19a)]===0x0)return _0x4168b9(0x184);return undefined;}async[a32_0x570f1e(0x193)](_0x379fda){const _0x51e1ae=a32_0x570f1e,{options:_0x498b12,tdx:_0x1eeecd}=_0x379fda,_0x1f8da1=_0x379fda[_0x51e1ae(0x18b)][0x0],_0x46aa1c=await withSpinner('Fetching\x20policy...',async()=>{const _0x21ba82=_0x51e1ae,_0x5222ab=await _0x1eeecd[_0x21ba82(0x182)][_0x21ba82(0x17a)](_0x1f8da1),[_0x2490b0,_0x4a52cb]=await Promise[_0x21ba82(0x166)]([_0x1eeecd[_0x21ba82(0x182)]['getPolicyPermissions'](_0x5222ab['id']),_0x1eeecd['policy'][_0x21ba82(0x1a1)](_0x5222ab['id'])]);return{'policy':_0x5222ab,'perms':_0x2490b0,'users':_0x4a52cb};},{'verbose':_0x498b12['verbose']}),{policy:_0x3715ac,perms:_0x52bc4c,users:_0x4de5ec}=_0x46aa1c[_0x51e1ae(0x19b)];if(isStructuredFormat(_0x498b12))return await handleSingleObjectOutput({..._0x3715ac,'permissions':_0x52bc4c['permissions'],'users':_0x4de5ec},_0x498b12),0x0;console[_0x51e1ae(0x188)]('\x0a'+a32_0x593a6d[_0x51e1ae(0x181)]('📋')+'\x20'+a32_0x593a6d[_0x51e1ae(0x181)](_0x3715ac[_0x51e1ae(0x18f)])+'\x20'+a32_0x593a6d['dim'](_0x51e1ae(0x196)+_0x3715ac['id']+')'));_0x3715ac['description']&&console[_0x51e1ae(0x188)](_0x51e1ae(0x178)+a32_0x593a6d['dim'](_0x3715ac['description']));console[_0x51e1ae(0x188)](_0x51e1ae(0x178)+_0x4de5ec[_0x51e1ae(0x19a)]+_0x51e1ae(0x189)+(_0x4de5ec['length']!==0x1?'s':'')+_0x51e1ae(0x176)),printPermissionsMap(_0x52bc4c[_0x51e1ae(0x172)]);if(_0x4de5ec['length']>0x0){console[_0x51e1ae(0x188)]('\x0a'+a32_0x593a6d[_0x51e1ae(0x181)]('👥\x20Assigned\x20Users')+':');for(const _0x4d37a1 of _0x4de5ec){const _0x4cefb7=_0x4d37a1[_0x51e1ae(0x19d)]&&_0x4d37a1[_0x51e1ae(0x19d)]!==_0x4d37a1[_0x51e1ae(0x18f)]?a32_0x593a6d[_0x51e1ae(0x18e)]('\x20<'+_0x4d37a1[_0x51e1ae(0x19d)]+'>'):'';console[_0x51e1ae(0x188)]('\x20\x20•\x20'+_0x4d37a1[_0x51e1ae(0x18f)]+_0x4cefb7);}}return console[_0x51e1ae(0x188)](),0x0;}}function printPermissionsMap(_0x19c871){const _0x5ef7ae=a32_0x570f1e,_0x134e0d=Object[_0x5ef7ae(0x183)](_0x19c871);console[_0x5ef7ae(0x188)]('\x0a'+a32_0x593a6d[_0x5ef7ae(0x181)]('🔑\x20Effective\x20Permissions')+':');if(_0x134e0d[_0x5ef7ae(0x19a)]===0x0){console['log'](a32_0x593a6d[_0x5ef7ae(0x18e)](_0x5ef7ae(0x186)));return;}const _0x240b1a=Math[_0x5ef7ae(0x194)](..._0x134e0d[_0x5ef7ae(0x198)](([_0x419a97])=>_0x419a97[_0x5ef7ae(0x19a)]));for(const [_0x409871,_0x284da1]of _0x134e0d){const _0x37e920=formatOperations(_0x284da1);console['log']('\x20\x20'+_0x409871[_0x5ef7ae(0x174)](_0x240b1a+0x2)+_0x37e920);}}function formatOperations(_0x548f16){const _0xab44b7=a32_0x570f1e,_0x81efba=[...new Set(_0x548f16[_0xab44b7(0x198)](_0xe2e1bf=>_0xe2e1bf[_0xab44b7(0x164)]))];return _0x81efba[_0xab44b7(0x167)](',\x20');}
@@ -1 +1 @@
1
- const a33_0x202982=a33_0x25ee;(function(_0x22e431,_0x254b89){const _0x5ce549=a33_0x25ee,_0x292c8b=_0x22e431();while(!![]){try{const _0x141980=-parseInt(_0x5ce549(0xe3))/0x1*(parseInt(_0x5ce549(0xdb))/0x2)+parseInt(_0x5ce549(0xdf))/0x3*(-parseInt(_0x5ce549(0xa1))/0x4)+parseInt(_0x5ce549(0xad))/0x5+parseInt(_0x5ce549(0x94))/0x6+-parseInt(_0x5ce549(0xaa))/0x7*(-parseInt(_0x5ce549(0xaf))/0x8)+-parseInt(_0x5ce549(0xa5))/0x9+parseInt(_0x5ce549(0xc1))/0xa;if(_0x141980===_0x254b89)break;else _0x292c8b['push'](_0x292c8b['shift']());}catch(_0x4390bd){_0x292c8b['push'](_0x292c8b['shift']());}}}(a33_0x2168,0x58c44));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_0x30adf3 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';function a33_0x2168(){const _0x3eca3c=['32puFfuB','Validating\x20API\x20key...','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','test','length','description','\x20--default\x27\x20to\x20save\x20permanently','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','validate','includes','\x20\x20tdx\x20--profile\x20','skipExistsCheck','API\x20key\x20cannot\x20be\x20empty','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','confirm','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>','us01','error','2226430eRBdAD','Profile\x20name\x20cannot\x20be\x20empty','ERROR','database','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','dim','trim','status','\x20\x20-\x20','all','Removed\x20existing\x20profile\x20\x27','red','logLevel','✗\x20Validation\x20failed:\x20','Site\x20was\x20not\x20changed.','\x27\x20deleted','yellow','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','split','Setup\x20cancelled','Enter\x20your\x20TD\x20API\x20key:','\x20Profile\x20\x27','Delete\x20a\x20profile','\x27\x20created','/app/mp/ak','getUserInfo','19260lUIHAI','\x27\x20does\x20not\x20exist.','execute','Set\x20session\x20profile','3MXvWpe','profile:set','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','profile','48BRKnAw','profile:use','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','Unknown\x20key\x20\x27','Enter\x20description\x20(optional):','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','\x0aSetup\x20cancelled','VALID_KEYS','\x20API\x20key\x20is\x20valid\x20(User:\x20','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','apiKey','tdx.json','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','\x0aOperation\x20cancelled','name','email','bold','profile:delete','config','\x27\x20requires\x20API\x20key\x20validation.','\x20API\x20key\x20saved\x20to\x20system\x20keychain','profileName','message','log','2949648QEfxAz','Profile\x20\x27','\x0aAvailable\x20profiles:','tdx:\x20profile\x20create','\x20\x20(no\x20profiles\x20found)','\x27\x20updated:\x20','password','site','(session:\x20','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','You\x20can\x20find\x20your\x20API\x20key\x20at:','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','create','1647196KQhrrg','warn','default','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','2054007Aibmxg','llm_agent','session','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','join','153286uvhhXw','Removal\x20cancelled','green','3320035IXYaDh','jobs'];a33_0x2168=function(){return _0x3eca3c;};return a33_0x2168();}import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';function a33_0x25ee(_0x30d26a,_0x3c8d46){_0x30d26a=_0x30d26a-0x89;const _0x21682b=a33_0x2168();let _0x25ee0b=_0x21682b[_0x30d26a];return _0x25ee0b;}import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a33_0x4e0524 from'prompts';import a33_0x226709 from'chalk';function validateProfileName(_0x60b061,_0x230f4d){const _0x4c4c8b=a33_0x25ee;if(!_0x60b061||!_0x60b061[_0x4c4c8b(0xc7)]())return _0x4c4c8b(0xc2);const _0x326e57=_0x60b061['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x4c4c8b(0xb2)](_0x326e57))return _0x4c4c8b(0xec);if(!_0x230f4d?.[_0x4c4c8b(0xba)]&&profileExists(_0x326e57))return _0x4c4c8b(0x95)+_0x326e57+_0x4c4c8b(0xe5)+_0x326e57+'\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.';return!![];}async function deleteProfileAndCredentials(_0x29d3e7){const _0x13ea95=a33_0x25ee;removeProfileFromUserConfig(_0x29d3e7);const _0x45cf4d=await isKeychainAvailable();_0x45cf4d&&await Promise[_0x13ea95(0xca)]([deleteKeychainAPIKey(_0x29d3e7),deleteOAuthTokens(_0x29d3e7)]);}export class ProfileCreateCommand extends BaseCommand{['name']='profile:create';[a33_0x202982(0xb4)]='Create\x20a\x20new\x20profile';async[a33_0x202982(0xdd)](_0xafc7ac){const _0x14f6e3=a33_0x202982,{options:_0x50efd8,args:_0x47f063}=_0xafc7ac,_0x5a8270=!!_0x50efd8['force'];console[_0x14f6e3(0x93)](a33_0x226709[_0x14f6e3(0x8c)](_0x14f6e3(0x97)));let _0x264fe4;if(_0x47f063[_0x14f6e3(0xb3)]>0x0&&_0x47f063[0x0]){const _0x16fdc6=_0x47f063[0x0][_0x14f6e3(0xc7)]();_0x5a8270&&profileExists(_0x16fdc6)&&(await deleteProfileAndCredentials(_0x16fdc6),console[_0x14f6e3(0x93)](_0x14f6e3(0xcb)+_0x16fdc6+'\x27'));const _0x2efcdd=validateProfileName(_0x16fdc6);if(_0x2efcdd!==!![])return console['error'](a33_0x226709[_0x14f6e3(0xcc)](_0x2efcdd)),0x1;_0x264fe4=_0x16fdc6;}else{const _0xd4134a=await a33_0x4e0524({'type':'text','name':'profileName','message':'Enter\x20profile\x20name:','validate':_0x4f2fd4=>validateProfileName(_0x4f2fd4,{'skipExistsCheck':_0x5a8270})});if(!_0xd4134a[_0x14f6e3(0x91)])return console['log'](_0x14f6e3(0xe9)),0x1;_0x264fe4=_0xd4134a[_0x14f6e3(0x91)][_0x14f6e3(0xc7)](),_0x5a8270&&profileExists(_0x264fe4)&&(await deleteProfileAndCredentials(_0x264fe4),console[_0x14f6e3(0x93)](_0x14f6e3(0xcb)+_0x264fe4+'\x27'));}const _0x4fd3c0=await a33_0x4e0524({'type':'text','name':_0x14f6e3(0xb4),'message':_0x14f6e3(0xe7)}),_0x2b1ce1=_0x4fd3c0['description']?.[_0x14f6e3(0xc7)]()||undefined,_0x59d3db=_0x50efd8[_0x14f6e3(0x9b)]||_0x14f6e3(0xbf),_0x55c8a8=await promptSiteSelection(_0x59d3db,_0x264fe4,_0x14f6e3(0xd4));if(!_0x55c8a8)return 0x1;const _0x2f3f10=resolveSite(_0x55c8a8),_0xd308e1=await promptAuthMethod();if(!_0xd308e1)return console['log'](_0x14f6e3(0xe9)),0x1;if(_0xd308e1==='oauth'){if(_0x2b1ce1){const _0x300438={'site':_0x2f3f10,'description':_0x2b1ce1};saveProfileToUserConfig(_0x264fe4,_0x300438);}const {accountName:_0x181b0d}=_0x50efd8;return await runOAuthLoginFlow(_0x2f3f10,_0x264fe4,_0x50efd8['logLevel']??LogLevel[_0x14f6e3(0xc3)],{'accountName':_0x181b0d}),0x0;}console[_0x14f6e3(0x93)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x2f3f10),console[_0x14f6e3(0x93)](_0x14f6e3(0x9e)),console[_0x14f6e3(0x93)]('\x20\x20'+getConsoleUrl(_0x2f3f10,_0x14f6e3(0xd9)));const _0x1a4b6c=await a33_0x4e0524({'type':'password','name':_0x14f6e3(0xee),'message':_0x14f6e3(0xd5),'validate':_0x37e3cf=>{const _0x46b2b7=_0x14f6e3;if(!_0x37e3cf||!_0x37e3cf['trim']())return _0x46b2b7(0xbb);return!![];}});if(!_0x1a4b6c[_0x14f6e3(0xee)])return console[_0x14f6e3(0x93)](_0x14f6e3(0xe9)),0x1;const _0x5131b5=_0x1a4b6c[_0x14f6e3(0xee)];console['log'](_0x14f6e3(0xb0));try{const _0x47fbe8=TDX['create']({'site':_0x2f3f10,'apiKey':_0x5131b5['trim'](),'logLevel':_0x50efd8[_0x14f6e3(0xcd)]??LogLevel['ERROR']}),_0x572011=await _0x47fbe8[_0x14f6e3(0xae)][_0x14f6e3(0xda)]();console[_0x14f6e3(0x93)](a33_0x226709[_0x14f6e3(0xac)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x572011[_0x14f6e3(0x8b)]+')');const _0x2edee1=await isKeychainAvailable();_0x2edee1?(await saveAPIKeyAsync(_0x5131b5['trim'](),_0x2f3f10,_0x264fe4),console['log'](a33_0x226709['green']('✓')+_0x14f6e3(0xed)+_0x264fe4+')')):(console['warn'](a33_0x226709[_0x14f6e3(0xd1)](_0x14f6e3(0xa4))),console[_0x14f6e3(0xa2)](a33_0x226709[_0x14f6e3(0xd1)](_0x14f6e3(0xe8))));const _0x2400b5={'site':_0x2f3f10,..._0x2b1ce1&&{'description':_0x2b1ce1}};return saveProfileToUserConfig(_0x264fe4,_0x2400b5),console[_0x14f6e3(0x93)](a33_0x226709[_0x14f6e3(0xac)]('✓')+'\x20Profile\x20\x27'+_0x264fe4+_0x14f6e3(0xd8)),console['log'](),console['log']('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x14f6e3(0x93)](_0x14f6e3(0xb9)+_0x264fe4+_0x14f6e3(0xe1)),console[_0x14f6e3(0x93)]('\x20\x20tdx\x20--profile\x20'+_0x264fe4+_0x14f6e3(0xf0)),0x0;}catch(_0x520f69){if(_0x520f69 instanceof HTTPClientError&&_0x520f69[_0x14f6e3(0xc8)]===0x191)return printAuthError(_0x520f69),0x1;return console[_0x14f6e3(0xc0)](a33_0x226709[_0x14f6e3(0xcc)](_0x14f6e3(0xce)+(_0x520f69 instanceof Error?_0x520f69[_0x14f6e3(0x92)]:String(_0x520f69)))),console[_0x14f6e3(0xc0)](_0x14f6e3(0xbc)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x202982(0x8a)]=a33_0x202982(0x8d);[a33_0x202982(0xb4)]=a33_0x202982(0xd7);['validate'](_0x4406ec){const _0x501cb5=a33_0x202982,{args:_0x498f44}=_0x4406ec;if(_0x498f44[_0x501cb5(0xb3)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>';return undefined;}async[a33_0x202982(0xdd)](_0x509b20){const _0x2216d1=a33_0x202982,{args:_0x29e41a}=_0x509b20,_0x32f960=_0x29e41a[0x0];console['log'](a33_0x226709[_0x2216d1(0x8c)]('tdx:\x20profile\x20delete'));if(!profileExists(_0x32f960)){console[_0x2216d1(0xc0)](a33_0x226709[_0x2216d1(0xcc)](_0x2216d1(0x95)+_0x32f960+'\x27\x20does\x20not\x20exist.')),console['log'](_0x2216d1(0x96));const _0xdaabb6=listProfiles();if(_0xdaabb6[_0x2216d1(0xb3)]===0x0)console[_0x2216d1(0x93)](_0x2216d1(0x98));else for(const _0x473843 of _0xdaabb6){console['log'](_0x2216d1(0xc9)+_0x473843['name']);}return 0x1;}const _0x139dc2=await a33_0x4e0524({'type':_0x2216d1(0xbd),'name':_0x2216d1(0xbd),'message':_0x2216d1(0xb6)+_0x32f960+'\x27?','initial':![]});if(!_0x139dc2[_0x2216d1(0xbd)])return console['log'](_0x2216d1(0xab)),0x0;try{await deleteProfileAndCredentials(_0x32f960),console['log'](a33_0x226709['green']('✓')+_0x2216d1(0xd6)+_0x32f960+_0x2216d1(0xd0));}catch(_0x4ef795){return console[_0x2216d1(0xc0)](a33_0x226709[_0x2216d1(0xcc)]('Failed\x20to\x20delete\x20profile:\x20'+(_0x4ef795 instanceof Error?_0x4ef795[_0x2216d1(0x92)]:String(_0x4ef795)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0x202982(0x8a)]=a33_0x202982(0xe0);[a33_0x202982(0xb4)]='Set\x20a\x20profile\x20configuration\x20value';static [a33_0x202982(0xea)]=[a33_0x202982(0x9b),a33_0x202982(0xc4),'parent_segment','llm_project',a33_0x202982(0xa6),a33_0x202982(0xb4)];[a33_0x202982(0xb7)](_0x7ed72c){const _0x4ce011=a33_0x202982,{args:_0x39172,options:_0x485c76}=_0x7ed72c,_0x3e745e=_0x485c76[_0x4ce011(0xe2)]||getActiveProfile();if(!_0x3e745e)return _0x4ce011(0xbe);if(_0x39172['length']===0x0)return _0x4ce011(0xd2)+ProfileSetCommand['VALID_KEYS'][_0x4ce011(0xa9)](',\x20');const _0x22eaaf=_0x39172[0x0];if(!_0x22eaaf['includes']('='))return _0x4ce011(0xb1)+ProfileSetCommand[_0x4ce011(0xea)][_0x4ce011(0xa9)](',\x20');const [_0x902b24]=_0x22eaaf[_0x4ce011(0xd3)]('=',0x2);if(!ProfileSetCommand[_0x4ce011(0xea)][_0x4ce011(0xb8)](_0x902b24))return _0x4ce011(0xe6)+_0x902b24+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x4ce011(0xea)]['join'](',\x20');return undefined;}async[a33_0x202982(0xdd)](_0x2a1605){const _0x5d476e=a33_0x202982,{args:_0x4daca1,options:_0x198a4b}=_0x2a1605,_0x44cba6=_0x198a4b[_0x5d476e(0xe2)]||getActiveProfile(),[_0xb51b24,..._0x5138b4]=_0x4daca1[0x0][_0x5d476e(0xd3)]('='),_0x4d7fe8=_0x5138b4['join']('=');console[_0x5d476e(0x93)](a33_0x226709[_0x5d476e(0x8c)]('tdx:\x20profile\x20set'));if(!profileExists(_0x44cba6)){const _0x23057d=await a33_0x4e0524({'type':'confirm','name':_0x5d476e(0xa0),'message':_0x5d476e(0x95)+_0x44cba6+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x23057d[_0x5d476e(0xa0)])return console[_0x5d476e(0x93)]('Operation\x20cancelled'),0x1;}const _0x5f34a1=loadProfile(_0x44cba6),_0x354381=_0x5f34a1?.[_0x5d476e(0x8e)]||{};if(_0xb51b24===_0x5d476e(0x9b)){const _0x1104cd=resolveSite(_0x4d7fe8);console[_0x5d476e(0x93)]('Changing\x20site\x20to\x20\x27'+_0x1104cd+_0x5d476e(0x8f)),console[_0x5d476e(0x93)](_0x5d476e(0x9f)),console[_0x5d476e(0x93)]('\x20\x20'+getConsoleUrl(_0x1104cd,_0x5d476e(0xd9)));const _0x33bd20=await a33_0x4e0524({'type':_0x5d476e(0x9a),'name':'apiKey','message':_0x5d476e(0xa8),'validate':_0x215430=>{const _0x739a7e=_0x5d476e;if(!_0x215430||!_0x215430[_0x739a7e(0xc7)]())return _0x739a7e(0xbb);return!![];}});if(!_0x33bd20[_0x5d476e(0xee)])return console['log'](_0x5d476e(0x89)),0x1;console['log']('Validating\x20API\x20key...');try{const _0x21d872=TDX[_0x5d476e(0xa0)]({'site':_0x1104cd,'apiKey':_0x33bd20[_0x5d476e(0xee)][_0x5d476e(0xc7)](),'logLevel':_0x198a4b[_0x5d476e(0xcd)]??LogLevel[_0x5d476e(0xc3)]}),_0x12d126=await _0x21d872['jobs'][_0x5d476e(0xda)]();console[_0x5d476e(0x93)](a33_0x226709['green']('✓')+_0x5d476e(0xeb)+_0x12d126[_0x5d476e(0x8b)]+')');const _0x575680=await isKeychainAvailable();_0x575680?(await saveAPIKeyAsync(_0x33bd20['apiKey'][_0x5d476e(0xc7)](),_0x1104cd,_0x44cba6),console[_0x5d476e(0x93)](a33_0x226709['green']('✓')+_0x5d476e(0x90))):console['warn'](a33_0x226709[_0x5d476e(0xd1)](_0x5d476e(0xa4))),_0x354381[_0x5d476e(0x9b)]=_0x1104cd;}catch(_0x4a6f68){if(_0x4a6f68 instanceof HTTPClientError&&_0x4a6f68[_0x5d476e(0xc8)]===0x191)return printAuthError(_0x4a6f68),0x1;return console['error'](a33_0x226709[_0x5d476e(0xcc)](_0x5d476e(0xce)+(_0x4a6f68 instanceof Error?_0x4a6f68['message']:String(_0x4a6f68)))),console['error'](_0x5d476e(0xcf)),0x1;}}else _0x354381[_0xb51b24]=_0x4d7fe8||undefined;return saveProfileToUserConfig(_0x44cba6,_0x354381),console[_0x5d476e(0x93)](a33_0x226709[_0x5d476e(0xac)]('✓')+'\x20Profile\x20\x27'+_0x44cba6+_0x5d476e(0x99)+_0xb51b24+'='+(_0x4d7fe8||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a33_0x202982(0xe4);[a33_0x202982(0xb4)]=a33_0x202982(0xde);[a33_0x202982(0xb7)](_0x2d9919){const _0x2ae584=a33_0x202982,{args:_0xee7734}=_0x2d9919;if(_0xee7734['length']===0x0)return _0x2ae584(0xc5);return undefined;}async[a33_0x202982(0xdd)](_0x449b72){const _0x354190=a33_0x202982,{args:_0x51dd6a,options:_0x5d3464}=_0x449b72,_0xcb8905=_0x51dd6a[0x0],_0x3be44c=_0x5d3464[_0x354190(0xa3)];cleanExpiredSessions();if(!profileExists(_0xcb8905)){console[_0x354190(0xc0)](a33_0x226709[_0x354190(0xcc)](_0x354190(0x95)+_0xcb8905+_0x354190(0xdc))),console[_0x354190(0x93)](_0x354190(0x96));const _0x181fc4=listProfiles();if(_0x181fc4[_0x354190(0xb3)]===0x0)console[_0x354190(0x93)](_0x354190(0x98));else for(const _0x3e2e9a of _0x181fc4){console[_0x354190(0x93)](_0x354190(0xc9)+_0x3e2e9a[_0x354190(0x8a)]);}return 0x1;}if(_0x3be44c){const _0x6e21aa=a33_0x30adf3[_0x354190(0xa9)](getConfigDir(),_0x354190(0xef));return saveActiveProfileToUserConfig(_0xcb8905),console[_0x354190(0x93)]('Default\x20profile\x20set\x20to:\x20'+a33_0x226709[_0x354190(0xac)](_0xcb8905)),console['log'](a33_0x226709[_0x354190(0xc6)]('\x0aSaved\x20to:\x20'+_0x6e21aa)),0x0;}const _0x9bafa8=getSessionID(_0x5d3464['session']);return saveSessionContext({'profile':_0xcb8905},_0x5d3464[_0x354190(0xa7)]),console[_0x354190(0x93)]('Session\x20profile\x20set\x20to:\x20'+a33_0x226709['green'](_0xcb8905)+'\x20'+a33_0x226709[_0x354190(0xc6)](_0x354190(0x9c)+_0x9bafa8+')')),console['log'](a33_0x226709[_0x354190(0xc6)](_0x354190(0x9d)+_0xcb8905+_0x354190(0xb5))),0x0;}}
1
+ const a33_0xc08a76=a33_0x1734;(function(_0x1d971e,_0x5988eb){const _0x31832b=a33_0x1734,_0x43ff8c=_0x1d971e();while(!![]){try{const _0x28e17a=parseInt(_0x31832b(0x22b))/0x1*(-parseInt(_0x31832b(0x210))/0x2)+parseInt(_0x31832b(0x251))/0x3+-parseInt(_0x31832b(0x225))/0x4*(parseInt(_0x31832b(0x20c))/0x5)+parseInt(_0x31832b(0x245))/0x6+parseInt(_0x31832b(0x23f))/0x7+-parseInt(_0x31832b(0x234))/0x8+-parseInt(_0x31832b(0x239))/0x9*(-parseInt(_0x31832b(0x222))/0xa);if(_0x28e17a===_0x5988eb)break;else _0x43ff8c['push'](_0x43ff8c['shift']());}catch(_0x5c9ca7){_0x43ff8c['push'](_0x43ff8c['shift']());}}}(a33_0x17a1,0xc3ec4));function a33_0x1734(_0x1502fb,_0x50ffdf){_0x1502fb=_0x1502fb-0x1ea;const _0x17a1c8=a33_0x17a1();let _0x173450=_0x17a1c8[_0x1502fb];return _0x173450;}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_0x4e89af from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a33_0x91a64b from'prompts';import a33_0x2ae7c0 from'chalk';function validateProfileName(_0x382002,_0x48a28f){const _0x6cee01=a33_0x1734;if(!_0x382002||!_0x382002['trim']())return _0x6cee01(0x253);const _0x28d830=_0x382002[_0x6cee01(0x1fe)]();if(!/^[a-zA-Z0-9_-]+$/[_0x6cee01(0x207)](_0x28d830))return _0x6cee01(0x20b);if(!_0x48a28f?.[_0x6cee01(0x25c)]&&profileExists(_0x28d830))return _0x6cee01(0x21d)+_0x28d830+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20'+_0x28d830+_0x6cee01(0x1f7);return!![];}async function deleteProfileAndCredentials(_0x1647fc){const _0x359ada=a33_0x1734;removeProfileFromUserConfig(_0x1647fc);const _0x1783ad=await isKeychainAvailable();_0x1783ad&&await Promise[_0x359ada(0x203)]([deleteKeychainAPIKey(_0x1647fc),deleteOAuthTokens(_0x1647fc)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0xc08a76(0x244)]=a33_0xc08a76(0x1ea);['description']=a33_0xc08a76(0x22c);async['execute'](_0x2f1b76){const _0x453c79=a33_0xc08a76,{options:_0x2c0382,args:_0xfb0f75}=_0x2f1b76,_0x2c9bb7=!!_0x2c0382[_0x453c79(0x1f1)];console['log'](a33_0x2ae7c0[_0x453c79(0x201)](_0x453c79(0x259)));let _0x1b05a6;if(_0xfb0f75[_0x453c79(0x20a)]>0x0&&_0xfb0f75[0x0]){const _0x533dcd=_0xfb0f75[0x0][_0x453c79(0x1fe)]();_0x2c9bb7&&profileExists(_0x533dcd)&&(await deleteProfileAndCredentials(_0x533dcd),console[_0x453c79(0x22d)](_0x453c79(0x1f0)+_0x533dcd+'\x27'));const _0x4858de=validateProfileName(_0x533dcd);if(_0x4858de!==!![])return console[_0x453c79(0x1ed)](a33_0x2ae7c0[_0x453c79(0x249)](_0x4858de)),0x1;_0x1b05a6=_0x533dcd;}else{const _0x448c0f=await a33_0x91a64b({'type':_0x453c79(0x24d),'name':_0x453c79(0x227),'message':_0x453c79(0x1fd),'validate':_0x4644a0=>validateProfileName(_0x4644a0,{'skipExistsCheck':_0x2c9bb7})});if(!_0x448c0f[_0x453c79(0x227)])return console[_0x453c79(0x22d)](_0x453c79(0x243)),0x1;_0x1b05a6=_0x448c0f[_0x453c79(0x227)]['trim'](),_0x2c9bb7&&profileExists(_0x1b05a6)&&(await deleteProfileAndCredentials(_0x1b05a6),console[_0x453c79(0x22d)](_0x453c79(0x1f0)+_0x1b05a6+'\x27'));}const _0x4bbc76=await a33_0x91a64b({'type':_0x453c79(0x24d),'name':'description','message':_0x453c79(0x236)}),_0x53ef2b=_0x4bbc76['description']?.[_0x453c79(0x1fe)]()||undefined,_0x5dc197=_0x2c0382[_0x453c79(0x1ee)]||'us01',_0x5d329a=await promptSiteSelection(_0x5dc197,_0x1b05a6,'Setup\x20cancelled');if(!_0x5d329a)return 0x1;const _0x2cb091=resolveSite(_0x5d329a),_0x315819=await promptAuthMethod();if(!_0x315819)return console['log'](_0x453c79(0x243)),0x1;if(_0x315819===_0x453c79(0x1ff)){if(_0x53ef2b){const _0x38d457={'site':_0x2cb091,'description':_0x53ef2b};saveProfileToUserConfig(_0x1b05a6,_0x38d457);}const {accountName:_0x50fea7}=_0x2c0382;return await runOAuthLoginFlow(_0x2cb091,_0x1b05a6,_0x2c0382['logLevel']??LogLevel[_0x453c79(0x256)],{'accountName':_0x50fea7}),0x0;}console[_0x453c79(0x22d)](_0x453c79(0x229)+_0x2cb091),console[_0x453c79(0x22d)](_0x453c79(0x22a)),console['log']('\x20\x20'+getConsoleUrl(_0x2cb091,_0x453c79(0x211)));const _0x55e7a0=await a33_0x91a64b({'type':_0x453c79(0x221),'name':'apiKey','message':_0x453c79(0x206),'validate':_0x2073b9=>{const _0x5c88dd=_0x453c79;if(!_0x2073b9||!_0x2073b9[_0x5c88dd(0x1fe)]())return _0x5c88dd(0x23b);return!![];}});if(!_0x55e7a0['apiKey'])return console[_0x453c79(0x22d)](_0x453c79(0x243)),0x1;const _0x343674=_0x55e7a0[_0x453c79(0x202)];console[_0x453c79(0x22d)](_0x453c79(0x252));try{const _0x2bc1ba=TDX[_0x453c79(0x242)]({'site':_0x2cb091,'apiKey':_0x343674[_0x453c79(0x1fe)](),'logLevel':_0x2c0382['logLevel']??LogLevel[_0x453c79(0x256)]}),_0x3d0521=await _0x2bc1ba['jobs'][_0x453c79(0x24c)]();console['log'](a33_0x2ae7c0[_0x453c79(0x204)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x3d0521[_0x453c79(0x1ef)]+')');const _0x4c06c8=await isKeychainAvailable();_0x4c06c8?(await saveAPIKeyAsync(_0x343674[_0x453c79(0x1fe)](),_0x2cb091,_0x1b05a6),console[_0x453c79(0x22d)](a33_0x2ae7c0[_0x453c79(0x204)]('✓')+_0x453c79(0x226)+_0x1b05a6+')')):(console[_0x453c79(0x233)](a33_0x2ae7c0[_0x453c79(0x21e)](_0x453c79(0x218))),console[_0x453c79(0x233)](a33_0x2ae7c0[_0x453c79(0x21e)](_0x453c79(0x250))));const _0x49985b={'site':_0x2cb091,..._0x53ef2b&&{'description':_0x53ef2b}};return saveProfileToUserConfig(_0x1b05a6,_0x49985b),console['log'](a33_0x2ae7c0['green']('✓')+_0x453c79(0x237)+_0x1b05a6+_0x453c79(0x254)),console['log'](),console['log'](_0x453c79(0x238)),console['log'](_0x453c79(0x248)+_0x1b05a6+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x453c79(0x22d)]('\x20\x20tdx\x20--profile\x20'+_0x1b05a6+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x2aa3c6){if(_0x2aa3c6 instanceof HTTPClientError&&_0x2aa3c6[_0x453c79(0x241)]===0x191)return printAuthError(_0x2aa3c6),0x1;return console[_0x453c79(0x1ed)](a33_0x2ae7c0[_0x453c79(0x249)](_0x453c79(0x219)+(_0x2aa3c6 instanceof Error?_0x2aa3c6[_0x453c79(0x230)]:String(_0x2aa3c6)))),console[_0x453c79(0x1ed)](_0x453c79(0x1f6)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0xc08a76(0x244)]=a33_0xc08a76(0x23c);[a33_0xc08a76(0x22e)]=a33_0xc08a76(0x214);['validate'](_0x52c089){const {args:_0x4f8863}=_0x52c089;if(_0x4f8863['length']===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>';return undefined;}async['execute'](_0x231960){const _0x15bb09=a33_0xc08a76,{args:_0x513fc5}=_0x231960,_0x37864a=_0x513fc5[0x0];console[_0x15bb09(0x22d)](a33_0x2ae7c0['bold'](_0x15bb09(0x24f)));if(!profileExists(_0x37864a)){console[_0x15bb09(0x1ed)](a33_0x2ae7c0[_0x15bb09(0x249)]('Profile\x20\x27'+_0x37864a+_0x15bb09(0x24a))),console[_0x15bb09(0x22d)](_0x15bb09(0x224));const _0x2a6179=listProfiles();if(_0x2a6179[_0x15bb09(0x20a)]===0x0)console[_0x15bb09(0x22d)](_0x15bb09(0x25b));else for(const _0x158458 of _0x2a6179){console[_0x15bb09(0x22d)](_0x15bb09(0x1fa)+_0x158458[_0x15bb09(0x244)]);}return 0x1;}const _0x364b69=await a33_0x91a64b({'type':_0x15bb09(0x21a),'name':_0x15bb09(0x21a),'message':_0x15bb09(0x213)+_0x37864a+'\x27?','initial':![]});if(!_0x364b69[_0x15bb09(0x21a)])return console['log'](_0x15bb09(0x200)),0x0;try{await deleteProfileAndCredentials(_0x37864a),console[_0x15bb09(0x22d)](a33_0x2ae7c0[_0x15bb09(0x204)]('✓')+_0x15bb09(0x237)+_0x37864a+_0x15bb09(0x223));}catch(_0x34a68c){return console[_0x15bb09(0x1ed)](a33_0x2ae7c0[_0x15bb09(0x249)](_0x15bb09(0x209)+(_0x34a68c instanceof Error?_0x34a68c[_0x15bb09(0x230)]:String(_0x34a68c)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0xc08a76(0x244)]='profile:set';[a33_0xc08a76(0x22e)]=a33_0xc08a76(0x228);static [a33_0xc08a76(0x1f2)]=[a33_0xc08a76(0x1ee),a33_0xc08a76(0x1f8),'parent_segment',a33_0xc08a76(0x25a),a33_0xc08a76(0x1fb),a33_0xc08a76(0x22e)];[a33_0xc08a76(0x21f)](_0x3dffc3){const _0x216956=a33_0xc08a76,{args:_0x230bd2,options:_0x350dad}=_0x3dffc3,_0x19d137=_0x350dad[_0x216956(0x220)]||getActiveProfile();if(!_0x19d137)return'No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>';if(_0x230bd2[_0x216956(0x20a)]===0x0)return _0x216956(0x246)+ProfileSetCommand[_0x216956(0x1f2)]['join'](',\x20');const _0x6b7109=_0x230bd2[0x0];if(!_0x6b7109[_0x216956(0x23a)]('='))return _0x216956(0x232)+ProfileSetCommand['VALID_KEYS'][_0x216956(0x23e)](',\x20');const [_0x1624fa]=_0x6b7109['split']('=',0x2);if(!ProfileSetCommand[_0x216956(0x1f2)][_0x216956(0x23a)](_0x1624fa))return _0x216956(0x205)+_0x1624fa+_0x216956(0x20d)+ProfileSetCommand[_0x216956(0x1f2)]['join'](',\x20');return undefined;}async['execute'](_0x407f2a){const _0x2275cf=a33_0xc08a76,{args:_0x468a54,options:_0x3309e0}=_0x407f2a,_0x197c57=_0x3309e0[_0x2275cf(0x220)]||getActiveProfile(),[_0x2fe5e3,..._0x35e26e]=_0x468a54[0x0]['split']('='),_0x4cee16=_0x35e26e['join']('=');console[_0x2275cf(0x22d)](a33_0x2ae7c0[_0x2275cf(0x201)](_0x2275cf(0x1f5)));if(!profileExists(_0x197c57)){const _0x596611=await a33_0x91a64b({'type':_0x2275cf(0x21a),'name':_0x2275cf(0x242),'message':_0x2275cf(0x21d)+_0x197c57+_0x2275cf(0x255),'initial':!![]});if(!_0x596611[_0x2275cf(0x242)])return console[_0x2275cf(0x22d)]('Operation\x20cancelled'),0x1;}const _0x4b9f97=loadProfile(_0x197c57),_0x306e46=_0x4b9f97?.[_0x2275cf(0x1ec)]||{};if(_0x2fe5e3==='site'){const _0x57a7be=resolveSite(_0x4cee16);console[_0x2275cf(0x22d)](_0x2275cf(0x1f4)+_0x57a7be+_0x2275cf(0x231)),console['log'](_0x2275cf(0x24e)),console['log']('\x20\x20'+getConsoleUrl(_0x57a7be,_0x2275cf(0x211)));const _0x8b4bcc=await a33_0x91a64b({'type':'password','name':_0x2275cf(0x202),'message':_0x2275cf(0x22f),'validate':_0x4f30be=>{const _0x294319=_0x2275cf;if(!_0x4f30be||!_0x4f30be[_0x294319(0x1fe)]())return _0x294319(0x23b);return!![];}});if(!_0x8b4bcc['apiKey'])return console[_0x2275cf(0x22d)](_0x2275cf(0x20f)),0x1;console[_0x2275cf(0x22d)]('Validating\x20API\x20key...');try{const _0x3c38b9=TDX[_0x2275cf(0x242)]({'site':_0x57a7be,'apiKey':_0x8b4bcc['apiKey']['trim'](),'logLevel':_0x3309e0[_0x2275cf(0x20e)]??LogLevel['ERROR']}),_0x229a3c=await _0x3c38b9[_0x2275cf(0x21b)][_0x2275cf(0x24c)]();console[_0x2275cf(0x22d)](a33_0x2ae7c0['green']('✓')+_0x2275cf(0x216)+_0x229a3c[_0x2275cf(0x1ef)]+')');const _0x184d27=await isKeychainAvailable();_0x184d27?(await saveAPIKeyAsync(_0x8b4bcc[_0x2275cf(0x202)][_0x2275cf(0x1fe)](),_0x57a7be,_0x197c57),console[_0x2275cf(0x22d)](a33_0x2ae7c0['green']('✓')+_0x2275cf(0x1fc))):console[_0x2275cf(0x233)](a33_0x2ae7c0['yellow'](_0x2275cf(0x218))),_0x306e46[_0x2275cf(0x1ee)]=_0x57a7be;}catch(_0x32662f){if(_0x32662f instanceof HTTPClientError&&_0x32662f[_0x2275cf(0x241)]===0x191)return printAuthError(_0x32662f),0x1;return console[_0x2275cf(0x1ed)](a33_0x2ae7c0[_0x2275cf(0x249)]('✗\x20Validation\x20failed:\x20'+(_0x32662f instanceof Error?_0x32662f[_0x2275cf(0x230)]:String(_0x32662f)))),console[_0x2275cf(0x1ed)](_0x2275cf(0x247)),0x1;}}else _0x306e46[_0x2fe5e3]=_0x4cee16||undefined;return saveProfileToUserConfig(_0x197c57,_0x306e46),console['log'](a33_0x2ae7c0[_0x2275cf(0x204)]('✓')+_0x2275cf(0x237)+_0x197c57+_0x2275cf(0x217)+_0x2fe5e3+'='+(_0x4cee16||_0x2275cf(0x208))),0x0;}}function a33_0x17a1(){const _0x32ffd8=['llm_agent','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Enter\x20profile\x20name:','trim','oauth','Removal\x20cancelled','bold','apiKey','all','green','Unknown\x20key\x20\x27','Enter\x20your\x20TD\x20API\x20key:','test','(cleared)','Failed\x20to\x20delete\x20profile:\x20','length','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','2035kvkjVl','\x27.\x0a\x0aValid\x20keys:\x20','logLevel','\x0aOperation\x20cancelled','3764fPnInJ','/app/mp/ak','\x0aSaved\x20to:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','Delete\x20a\x20profile','tdx.json','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x27\x20updated:\x20','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','✗\x20Validation\x20failed:\x20','confirm','jobs','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','Profile\x20\x27','yellow','validate','profile','password','559010UKpcJl','\x27\x20deleted','\x0aAvailable\x20profiles:','476wHdGcE','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','profileName','Set\x20a\x20profile\x20configuration\x20value','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','You\x20can\x20find\x20your\x20API\x20key\x20at:','761kFwDcv','Create\x20a\x20new\x20profile','log','description','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','message','\x27\x20requires\x20API\x20key\x20validation.','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','warn','10747144uwIlZl','Set\x20session\x20profile','Enter\x20description\x20(optional):','\x20Profile\x20\x27','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','54KZcdnH','includes','API\x20key\x20cannot\x20be\x20empty','profile:delete','default','join','7964922knLsfe','\x20--default\x27\x20to\x20save\x20permanently','status','create','\x0aSetup\x20cancelled','name','6409284LXlmCi','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Site\x20was\x20not\x20changed.','\x20\x20tdx\x20--profile\x20','red','\x27\x20does\x20not\x20exist.','dim','getUserInfo','text','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','tdx:\x20profile\x20delete','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','3255186oogXvV','Validating\x20API\x20key...','Profile\x20name\x20cannot\x20be\x20empty','\x27\x20created','\x27\x20does\x20not\x20exist.\x20Create\x20it?','ERROR','(session:\x20','session','tdx:\x20profile\x20create','llm_project','\x20\x20(no\x20profiles\x20found)','skipExistsCheck','profile:create','profile:use','config','error','site','email','Removed\x20existing\x20profile\x20\x27','force','VALID_KEYS','execute','Changing\x20site\x20to\x20\x27','tdx:\x20profile\x20set','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','database','Session\x20profile\x20set\x20to:\x20','\x20\x20-\x20'];a33_0x17a1=function(){return _0x32ffd8;};return a33_0x17a1();}export class ProfileUseCommand extends BaseCommand{['name']=a33_0xc08a76(0x1eb);[a33_0xc08a76(0x22e)]=a33_0xc08a76(0x235);[a33_0xc08a76(0x21f)](_0x35fd12){const _0x24ffbc=a33_0xc08a76,{args:_0x3a05ea}=_0x35fd12;if(_0x3a05ea[_0x24ffbc(0x20a)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a33_0xc08a76(0x1f3)](_0x2a7cd6){const _0x3d9f8b=a33_0xc08a76,{args:_0x2a7259,options:_0x46d7d3}=_0x2a7cd6,_0x2fbc09=_0x2a7259[0x0],_0x2965d7=_0x46d7d3[_0x3d9f8b(0x23d)];cleanExpiredSessions();if(!profileExists(_0x2fbc09)){console['error'](a33_0x2ae7c0['red'](_0x3d9f8b(0x21d)+_0x2fbc09+_0x3d9f8b(0x24a))),console[_0x3d9f8b(0x22d)]('\x0aAvailable\x20profiles:');const _0x9c387b=listProfiles();if(_0x9c387b['length']===0x0)console[_0x3d9f8b(0x22d)](_0x3d9f8b(0x25b));else for(const _0x3fe1a7 of _0x9c387b){console[_0x3d9f8b(0x22d)](_0x3d9f8b(0x1fa)+_0x3fe1a7[_0x3d9f8b(0x244)]);}return 0x1;}if(_0x2965d7){const _0x5440b6=a33_0x4e89af[_0x3d9f8b(0x23e)](getConfigDir(),_0x3d9f8b(0x215));return saveActiveProfileToUserConfig(_0x2fbc09),console[_0x3d9f8b(0x22d)]('Default\x20profile\x20set\x20to:\x20'+a33_0x2ae7c0[_0x3d9f8b(0x204)](_0x2fbc09)),console[_0x3d9f8b(0x22d)](a33_0x2ae7c0[_0x3d9f8b(0x24b)](_0x3d9f8b(0x212)+_0x5440b6)),0x0;}const _0x4f90ee=getSessionID(_0x46d7d3['session']);return saveSessionContext({'profile':_0x2fbc09},_0x46d7d3[_0x3d9f8b(0x258)]),console[_0x3d9f8b(0x22d)](_0x3d9f8b(0x1f9)+a33_0x2ae7c0[_0x3d9f8b(0x204)](_0x2fbc09)+'\x20'+a33_0x2ae7c0[_0x3d9f8b(0x24b)](_0x3d9f8b(0x257)+_0x4f90ee+')')),console[_0x3d9f8b(0x22d)](a33_0x2ae7c0[_0x3d9f8b(0x24b)](_0x3d9f8b(0x21c)+_0x2fbc09+_0x3d9f8b(0x240))),0x0;}}
@@ -1 +1 @@
1
- const a34_0x548bec=a34_0x1297;(function(_0x4a645f,_0x509bec){const _0x2c5f8c=a34_0x1297,_0x4e875f=_0x4a645f();while(!![]){try{const _0x32fd71=-parseInt(_0x2c5f8c(0xf4))/0x1*(parseInt(_0x2c5f8c(0xfb))/0x2)+-parseInt(_0x2c5f8c(0xfc))/0x3+parseInt(_0x2c5f8c(0xfa))/0x4*(parseInt(_0x2c5f8c(0xeb))/0x5)+-parseInt(_0x2c5f8c(0xf8))/0x6+parseInt(_0x2c5f8c(0xf6))/0x7+parseInt(_0x2c5f8c(0xea))/0x8+parseInt(_0x2c5f8c(0xf0))/0x9;if(_0x32fd71===_0x509bec)break;else _0x4e875f['push'](_0x4e875f['shift']());}catch(_0x575a1c){_0x4e875f['push'](_0x4e875f['shift']());}}}(a34_0x1b74,0xc14fa));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';function a34_0x1297(_0x52b49f,_0x14f8c7){_0x52b49f=_0x52b49f-0xe6;const _0x1b744b=a34_0x1b74();let _0x12972c=_0x1b744b[_0x52b49f];return _0x12972c;}import a34_0x43a0c9 from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x548bec(0x100)]=a34_0x548bec(0xe9);[a34_0x548bec(0xf3)]=a34_0x548bec(0xee);async[a34_0x548bec(0xe6)](_0x20a8f4){const _0x395ae0=a34_0x548bec,{options:_0x303d7d}=_0x20a8f4;try{const _0x195006=listProfiles(),_0x45d248=getActiveProfile();if(_0x195006[_0x395ae0(0x101)]===0x0)return console[_0x395ae0(0xe7)](_0x395ae0(0xf7)),console['log'](_0x395ae0(0xef)),console[_0x395ae0(0xe7)](_0x395ae0(0xf9)),0x0;const _0x4776a9=_0x195006[_0x395ae0(0xed)](_0xc9c75d=>{const _0xc8d4a7=_0x395ae0,_0xa837f2=_0xc9c75d['name']===_0x45d248,_0x2e68c0=getProfileParams(_0xc9c75d[_0xc8d4a7(0xe8)]);return{'name':_0xc9c75d[_0xc8d4a7(0x100)],'active':_0xa837f2,'scope':_0xc9c75d[_0xc8d4a7(0xf5)],'description':_0xc9c75d[_0xc8d4a7(0xe8)][_0xc8d4a7(0xf3)]||'','params':_0x2e68c0};});if(isStructuredFormat(_0x303d7d))await handleSDKOutput(_0x4776a9,_0x303d7d);else for(const _0x1ab07d of _0x195006){const _0x42f108=_0x1ab07d[_0x395ae0(0x100)]===_0x45d248?a34_0x43a0c9['green']('\x20✓'):'',_0x2d97b3=_0x1ab07d[_0x395ae0(0xe8)][_0x395ae0(0xfe)]?a34_0x43a0c9[_0x395ae0(0xf1)]('\x20'+_0x1ab07d[_0x395ae0(0xe8)][_0x395ae0(0xfe)]):'',_0xc5b1fb=_0x1ab07d['config'][_0x395ae0(0xf3)]?a34_0x43a0c9['dim']('\x20\x20'+_0x1ab07d[_0x395ae0(0xe8)][_0x395ae0(0xf3)]):'';console[_0x395ae0(0xe7)](_0x395ae0(0xf2)+_0x1ab07d['name']+_0x42f108+_0x2d97b3+_0xc5b1fb);}return 0x0;}catch(_0x9f621f){return _0x9f621f instanceof Error&&console[_0x395ae0(0xec)](_0x395ae0(0xfd)+_0x9f621f[_0x395ae0(0xff)]),0x1;}}}function a34_0x1b74(){const _0x4e9982=['6980322setDPh','\x20\x20Global:\x20~/.config/tdx/tdx.json','5180DlBxVB','3117454UeTBkl','510240KEMtQL','Error:\x20','site','message','name','length','execute','log','config','profiles','6287616MgHSAO','3145mLgVpr','error','map','List\x20all\x20available\x20profiles','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','18507177LlfmdE','dim','👤\x20','description','1DCDbja','scope','189952mEfwTy','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'];a34_0x1b74=function(){return _0x4e9982;};return a34_0x1b74();}
1
+ function a34_0xbbbb(){const _0x54b35d=['2082848dNDdJO','description','config','84335vycADF','map','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','639426GydEDa','name','site','error','Error:\x20','message','dim','green','profiles','2334DtbUTF','970124HXynln','1733922nHClqc','1219547GDwzel','scope','3815gCPIPZ','log'];a34_0xbbbb=function(){return _0x54b35d;};return a34_0xbbbb();}const a34_0x2589dc=a34_0x2f20;(function(_0x364d78,_0x54937f){const _0x12ec98=a34_0x2f20,_0x49ca4d=_0x364d78();while(!![]){try{const _0x15cda1=parseInt(_0x12ec98(0x15c))/0x1+parseInt(_0x12ec98(0x160))/0x2+-parseInt(_0x12ec98(0x16b))/0x3+-parseInt(_0x12ec98(0x16a))/0x4+-parseInt(_0x12ec98(0x157))/0x5*(-parseInt(_0x12ec98(0x169))/0x6)+parseInt(_0x12ec98(0x155))/0x7+parseInt(_0x12ec98(0x159))/0x8;if(_0x15cda1===_0x54937f)break;else _0x49ca4d['push'](_0x49ca4d['shift']());}catch(_0x10e366){_0x49ca4d['push'](_0x49ca4d['shift']());}}}(a34_0xbbbb,0x4ce2f));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a34_0x2f20(_0x598d56,_0x29ef5f){_0x598d56=_0x598d56-0x155;const _0xbbbbec=a34_0xbbbb();let _0x2f20a1=_0xbbbbec[_0x598d56];return _0x2f20a1;}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x2447d4 from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x2589dc(0x161)]=a34_0x2589dc(0x168);[a34_0x2589dc(0x15a)]='List\x20all\x20available\x20profiles';async['execute'](_0x134af6){const _0x124c6b=a34_0x2589dc,{options:_0x345a98}=_0x134af6;try{const _0x14c86e=listProfiles(),_0x29343c=getActiveProfile();if(_0x14c86e['length']===0x0)return console['log'](_0x124c6b(0x15f)),console[_0x124c6b(0x158)](_0x124c6b(0x15e)),console[_0x124c6b(0x158)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x16d945=_0x14c86e[_0x124c6b(0x15d)](_0x5da4ae=>{const _0x2729b7=_0x124c6b,_0x5bd2e2=_0x5da4ae[_0x2729b7(0x161)]===_0x29343c,_0xb686d3=getProfileParams(_0x5da4ae[_0x2729b7(0x15b)]);return{'name':_0x5da4ae['name'],'active':_0x5bd2e2,'scope':_0x5da4ae[_0x2729b7(0x156)],'description':_0x5da4ae[_0x2729b7(0x15b)]['description']||'','params':_0xb686d3};});if(isStructuredFormat(_0x345a98))await handleSDKOutput(_0x16d945,_0x345a98);else for(const _0x25a283 of _0x14c86e){const _0x2455b6=_0x25a283[_0x124c6b(0x161)]===_0x29343c?a34_0x2447d4[_0x124c6b(0x167)]('\x20✓'):'',_0x4c172a=_0x25a283[_0x124c6b(0x15b)][_0x124c6b(0x162)]?a34_0x2447d4['dim']('\x20'+_0x25a283[_0x124c6b(0x15b)][_0x124c6b(0x162)]):'',_0x666bbe=_0x25a283[_0x124c6b(0x15b)]['description']?a34_0x2447d4[_0x124c6b(0x166)]('\x20\x20'+_0x25a283[_0x124c6b(0x15b)][_0x124c6b(0x15a)]):'';console[_0x124c6b(0x158)]('👤\x20'+_0x25a283[_0x124c6b(0x161)]+_0x2455b6+_0x4c172a+_0x666bbe);}return 0x0;}catch(_0x250eac){return _0x250eac instanceof Error&&console[_0x124c6b(0x163)](_0x124c6b(0x164)+_0x250eac[_0x124c6b(0x165)]),0x1;}}}
@@ -1 +1 @@
1
- const a35_0x2c84a7=a35_0x1a27;(function(_0x14fc15,_0x480016){const _0x3d295e=a35_0x1a27,_0x406f54=_0x14fc15();while(!![]){try{const _0x4cd62d=parseInt(_0x3d295e(0x19a))/0x1+parseInt(_0x3d295e(0x1c7))/0x2+-parseInt(_0x3d295e(0x1c0))/0x3*(-parseInt(_0x3d295e(0x1b4))/0x4)+-parseInt(_0x3d295e(0x1bb))/0x5*(-parseInt(_0x3d295e(0x1c3))/0x6)+-parseInt(_0x3d295e(0x1a5))/0x7+-parseInt(_0x3d295e(0x1ca))/0x8*(parseInt(_0x3d295e(0x1ba))/0x9)+-parseInt(_0x3d295e(0x1a7))/0xa;if(_0x4cd62d===_0x480016)break;else _0x406f54['push'](_0x406f54['shift']());}catch(_0x27dd20){_0x406f54['push'](_0x406f54['shift']());}}}(a35_0x4e85,0x1b2fd));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a35_0x4e85(){const _0x3793c0=['elapsedTimeMillis','SQL:\x20','No\x20SQL\x20provided','1128085IvYunz','setJobId','2122970qWPdcz','database','Error:\x20','Executing\x20statement\x20','in\x20','information_schema','Catalog:\x20','error','totalSplits','file','message','jobId','Schema:\x20','161872kAIMkl','execute','Executing\x20query\x20[','join','Site:\x20','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','380178DLEiro','9750NJzSzs','name','stats','description','site','6ZToZYV','completedSplits','length','684iQNNCL','query','output','push','418488ejbqVk','Run\x20Trino\x20queries\x20(streaming)','data','40coGCcn','Query\x20completed:\x20Processed\x20','\x20[Job\x20ID:\x20','verbose','183539qfqTUw','\x20rows\x20','setExtra','catalog','validate','args','Statement\x20','\x20-\x20'];a35_0x4e85=function(){return _0x3793c0;};return a35_0x4e85();}import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';function a35_0x1a27(_0x3ba253,_0x5bd6a4){_0x3ba253=_0x3ba253-0x19a;const _0x4e85b6=a35_0x4e85();let _0x1a27ec=_0x4e85b6[_0x3ba253];return _0x1a27ec;}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a35_0x2c84a7(0x1bc)]='query';[a35_0x2c84a7(0x1be)]=a35_0x2c84a7(0x1c8);async['execute'](_0x135e09){const _0x3d6b46=a35_0x2c84a7,{options:_0x59e2e9,args:_0x3e3091,tdx:_0x4b944d}=_0x135e09,_0x910413={..._0x59e2e9,'limitStructuredFormats':!![]},_0xb7f679=_0x3e3091[0x0],_0xe184d4=_0x59e2e9[_0x3d6b46(0x1b0)];let _0x2953ee;try{if(_0xe184d4)_0x2953ee=readSqlStatementsFromFile(_0xe184d4);else{if(_0xb7f679==='-')_0x2953ee=await readSqlStatementsFromStdin();else{if(_0xb7f679&&isSqlFilePath(_0xb7f679))_0x2953ee=readSqlStatementsFromFile(_0xb7f679);else{if(_0xb7f679)_0x2953ee=splitSqlStatements(_0xb7f679);else throw new Error(_0x3d6b46(0x1a4));}}}}catch(_0x4f4e5f){return console[_0x3d6b46(0x1ae)](_0x3d6b46(0x1a9)+_0x4f4e5f[_0x3d6b46(0x1b1)]),0x1;}const _0x4abb56=_0x59e2e9[_0x3d6b46(0x1a8)]||_0x3d6b46(0x1ac),_0x48eba4=_0x59e2e9[_0x3d6b46(0x19d)];try{const _0x472717=[],_0x1ef1ae=!!_0x59e2e9['output'];for(let _0x596f5b=0x0;_0x596f5b<_0x2953ee[_0x3d6b46(0x1c2)];_0x596f5b++){const _0x567517=_0x2953ee[_0x596f5b],_0x45ba34=_0x596f5b+0x1,_0x4cf3cf=_0x2953ee[_0x3d6b46(0x1c2)],_0x1bc59f=_0x4cf3cf>0x1;_0x59e2e9[_0x3d6b46(0x1cd)]&&(console[_0x3d6b46(0x1ae)]('\x0a'+(_0x1bc59f?_0x3d6b46(0x1a0)+_0x45ba34+'/'+_0x4cf3cf+':':'')),console[_0x3d6b46(0x1ae)](_0x3d6b46(0x1b8)+_0x59e2e9[_0x3d6b46(0x1bf)]),console['error'](_0x3d6b46(0x1ad)+(_0x48eba4||'td')),console[_0x3d6b46(0x1ae)](_0x3d6b46(0x1b3)+_0x4abb56),console['error'](_0x3d6b46(0x1a3)+_0x567517));const _0x663d53=_0x1bc59f?_0x3d6b46(0x1aa)+_0x45ba34+'/'+_0x4cf3cf+'...':'Executing\x20query...';try{const _0x348783=await withProgressSpinner(_0x663d53,async _0x27c696=>{const _0x3cb79a=_0x3d6b46,_0x35ff9a=await _0x4b944d[_0x3cb79a(0x1c4)][_0x3cb79a(0x1b5)](_0x567517,{'catalog':_0x48eba4,'schema':_0x4abb56,'onJobId':_0x1d5e42=>{const _0x168754=_0x3cb79a;_0x27c696[_0x168754(0x1a6)](_0x1d5e42);},'onProgress':_0x1f442b=>{const _0x30e816=_0x3cb79a;_0x27c696['setPhase'](_0x30e816(0x1b6)+_0x1f442b['state']+']'),_0x27c696[_0x30e816(0x19c)](formatRows(_0x1f442b['processedRows'])+'\x20rows\x20'+_0x1f442b[_0x30e816(0x1c1)]+'/'+_0x1f442b[_0x30e816(0x1af)]+'\x20splits');}});return _0x35ff9a;},{'verbose':_0x59e2e9[_0x3d6b46(0x1cd)]}),_0x41777d=_0x348783[_0x3d6b46(0x1c9)],_0x599614=_0x41777d[_0x3d6b46(0x1b2)]?_0x3d6b46(0x1cc)+_0x41777d[_0x3d6b46(0x1b2)]+']':'',_0x769c3d=_0x1bc59f?_0x3d6b46(0x1a0)+_0x45ba34+'/'+_0x4cf3cf+_0x3d6b46(0x1a1):'';console[_0x3d6b46(0x1ae)]('✔\x20'+_0x769c3d+_0x3d6b46(0x1cb)+formatRows(_0x41777d['stats']['processedRows'])+_0x3d6b46(0x19b)+(_0x3d6b46(0x1ab)+formatElapsed(_0x41777d[_0x3d6b46(0x1bd)][_0x3d6b46(0x1a2)])+_0x599614));if(_0x1bc59f&&_0x1ef1ae){const _0x2644c4=resolveOutputOptions(_0x910413),_0x3b5d78=await formatQueryOutput(_0x41777d,_0x2644c4);_0x472717[_0x3d6b46(0x1c6)](_0x3b5d78);}else await handleQueryOutput(_0x41777d,_0x910413);}catch(_0x1521c3){const _0x3e51c6=_0x1bc59f?_0x3d6b46(0x1a0)+_0x45ba34+'/'+_0x4cf3cf+':\x0a':'',_0x2f98f5=_0x1521c3 instanceof SDKError?_0x1521c3['originalMessage']:_0x1521c3[_0x3d6b46(0x1b1)];return console[_0x3d6b46(0x1ae)](''+_0x3e51c6+_0x2f98f5),0x1;}}if(_0x2953ee[_0x3d6b46(0x1c2)]>0x1&&_0x1ef1ae&&_0x472717[_0x3d6b46(0x1c2)]>0x0){const _0x3a780f=_0x472717[_0x3d6b46(0x1b7)]('\x0a');writeFileSync(_0x59e2e9[_0x3d6b46(0x1c5)],_0x3a780f),console['error']('\x0aAll\x20results\x20saved\x20to\x20'+_0x59e2e9[_0x3d6b46(0x1c5)]);}return 0x0;}catch(_0x424b25){throw _0x424b25;}}[a35_0x2c84a7(0x19e)](_0x29dccf){const _0x540355=a35_0x2c84a7,_0x1c5524=_0x29dccf[_0x540355(0x19f)][0x0],_0x225094=_0x29dccf['options'][_0x540355(0x1b0)];if(!_0x1c5524&&!_0x225094)return _0x540355(0x1b9);if(_0x1c5524&&_0x225094)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}
1
+ const a35_0x156d67=a35_0x14d7;(function(_0x540e8e,_0x36cb53){const _0x5b5685=a35_0x14d7,_0x177986=_0x540e8e();while(!![]){try{const _0x7a32e3=-parseInt(_0x5b5685(0x102))/0x1*(parseInt(_0x5b5685(0xf2))/0x2)+parseInt(_0x5b5685(0x117))/0x3*(parseInt(_0x5b5685(0x104))/0x4)+-parseInt(_0x5b5685(0x11f))/0x5+parseInt(_0x5b5685(0xee))/0x6+-parseInt(_0x5b5685(0x105))/0x7+parseInt(_0x5b5685(0xfb))/0x8*(parseInt(_0x5b5685(0x100))/0x9)+-parseInt(_0x5b5685(0x11c))/0xa*(parseInt(_0x5b5685(0xfe))/0xb);if(_0x7a32e3===_0x36cb53)break;else _0x177986['push'](_0x177986['shift']());}catch(_0x274f12){_0x177986['push'](_0x177986['shift']());}}}(a35_0x3881,0x9e5f9));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a35_0x14d7(_0x194741,_0x41ca70){_0x194741=_0x194741-0xed;const _0x3881e4=a35_0x3881();let _0x14d7fe=_0x3881e4[_0x194741];return _0x14d7fe;}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_0x3881(){const _0x3a1fc8=['setExtra','length','args','SQL:\x20','Run\x20Trino\x20queries\x20(streaming)','674768yWMwWj','\x20rows\x20','Schema:\x20','11jBDPDK','execute','99kTvAtC','Executing\x20query...','1244RAQuQK','database','2540ifLcwu','787990tSwAUO','completedSplits','join','message','\x20-\x20','processedRows','output','setJobId','name','stats','Query\x20completed:\x20Processed\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','\x20[Job\x20ID:\x20','description','No\x20SQL\x20provided','verbose','Executing\x20statement\x20','data','3627BZbDKL','error','site','Statement\x20','file','9971790FDfRmp','Site:\x20','query','93345zprwRU','totalSplits','3213924HFTYIH','Executing\x20query\x20[','\x0aAll\x20results\x20saved\x20to\x20','\x20splits','730zaRwEY','setPhase','validate','state'];a35_0x3881=function(){return _0x3a1fc8;};return a35_0x3881();}export class QueryCommand extends BaseCommand{[a35_0x156d67(0x10d)]='query';[a35_0x156d67(0x112)]=a35_0x156d67(0xfa);async['execute'](_0x247f2e){const _0xefaec0=a35_0x156d67,{options:_0x334d1e,args:_0x49296e,tdx:_0x4557e2}=_0x247f2e,_0xf7e342={..._0x334d1e,'limitStructuredFormats':!![]},_0x174afd=_0x49296e[0x0],_0x3c3873=_0x334d1e[_0xefaec0(0x11b)];let _0x5769db;try{if(_0x3c3873)_0x5769db=readSqlStatementsFromFile(_0x3c3873);else{if(_0x174afd==='-')_0x5769db=await readSqlStatementsFromStdin();else{if(_0x174afd&&isSqlFilePath(_0x174afd))_0x5769db=readSqlStatementsFromFile(_0x174afd);else{if(_0x174afd)_0x5769db=splitSqlStatements(_0x174afd);else throw new Error(_0xefaec0(0x113));}}}}catch(_0xc9280f){return console['error']('Error:\x20'+_0xc9280f[_0xefaec0(0x108)]),0x1;}const _0x1c870d=_0x334d1e[_0xefaec0(0x103)]||'information_schema',_0x54193b=_0x334d1e['catalog'];try{const _0x4becc2=[],_0x1fafc2=!!_0x334d1e[_0xefaec0(0x10b)];for(let _0x10f472=0x0;_0x10f472<_0x5769db[_0xefaec0(0xf7)];_0x10f472++){const _0x183fb5=_0x5769db[_0x10f472],_0x5eabd3=_0x10f472+0x1,_0x4b1665=_0x5769db[_0xefaec0(0xf7)],_0x5c2e96=_0x4b1665>0x1;_0x334d1e[_0xefaec0(0x114)]&&(console[_0xefaec0(0x118)]('\x0a'+(_0x5c2e96?_0xefaec0(0x11a)+_0x5eabd3+'/'+_0x4b1665+':':'')),console[_0xefaec0(0x118)](_0xefaec0(0x11d)+_0x334d1e[_0xefaec0(0x119)]),console['error']('Catalog:\x20'+(_0x54193b||'td')),console[_0xefaec0(0x118)](_0xefaec0(0xfd)+_0x1c870d),console[_0xefaec0(0x118)](_0xefaec0(0xf9)+_0x183fb5));const _0x2a4713=_0x5c2e96?_0xefaec0(0x115)+_0x5eabd3+'/'+_0x4b1665+'...':_0xefaec0(0x101);try{const _0x1d5154=await withProgressSpinner(_0x2a4713,async _0x545cef=>{const _0x57cdbd=_0xefaec0,_0x4dafee=await _0x4557e2[_0x57cdbd(0x11e)][_0x57cdbd(0xff)](_0x183fb5,{'catalog':_0x54193b,'schema':_0x1c870d,'onJobId':_0xa40c28=>{const _0x3871e6=_0x57cdbd;_0x545cef[_0x3871e6(0x10c)](_0xa40c28);},'onProgress':_0x244921=>{const _0x356cca=_0x57cdbd;_0x545cef[_0x356cca(0xf3)](_0x356cca(0xef)+_0x244921[_0x356cca(0xf5)]+']'),_0x545cef[_0x356cca(0xf6)](formatRows(_0x244921[_0x356cca(0x10a)])+_0x356cca(0xfc)+_0x244921[_0x356cca(0x106)]+'/'+_0x244921[_0x356cca(0xed)]+_0x356cca(0xf1));}});return _0x4dafee;},{'verbose':_0x334d1e[_0xefaec0(0x114)]}),_0x539480=_0x1d5154[_0xefaec0(0x116)],_0x2226ed=_0x539480['jobId']?_0xefaec0(0x111)+_0x539480['jobId']+']':'',_0x59a9a1=_0x5c2e96?_0xefaec0(0x11a)+_0x5eabd3+'/'+_0x4b1665+_0xefaec0(0x109):'';console['error']('✔\x20'+_0x59a9a1+_0xefaec0(0x10f)+formatRows(_0x539480['stats'][_0xefaec0(0x10a)])+_0xefaec0(0xfc)+('in\x20'+formatElapsed(_0x539480[_0xefaec0(0x10e)]['elapsedTimeMillis'])+_0x2226ed));if(_0x5c2e96&&_0x1fafc2){const _0x32a504=resolveOutputOptions(_0xf7e342),_0x1f38a3=await formatQueryOutput(_0x539480,_0x32a504);_0x4becc2['push'](_0x1f38a3);}else await handleQueryOutput(_0x539480,_0xf7e342);}catch(_0x5d691b){const _0x23f42a=_0x5c2e96?_0xefaec0(0x11a)+_0x5eabd3+'/'+_0x4b1665+':\x0a':'',_0x124e33=_0x5d691b instanceof SDKError?_0x5d691b['originalMessage']:_0x5d691b['message'];return console[_0xefaec0(0x118)](''+_0x23f42a+_0x124e33),0x1;}}if(_0x5769db['length']>0x1&&_0x1fafc2&&_0x4becc2[_0xefaec0(0xf7)]>0x0){const _0x532481=_0x4becc2[_0xefaec0(0x107)]('\x0a');writeFileSync(_0x334d1e[_0xefaec0(0x10b)],_0x532481),console[_0xefaec0(0x118)](_0xefaec0(0xf0)+_0x334d1e[_0xefaec0(0x10b)]);}return 0x0;}catch(_0x25711b){throw _0x25711b;}}[a35_0x156d67(0xf4)](_0x559d22){const _0x27d6e8=a35_0x156d67,_0x433e90=_0x559d22[_0x27d6e8(0xf8)][0x0],_0x5a3f45=_0x559d22['options'][_0x27d6e8(0x11b)];if(!_0x433e90&&!_0x5a3f45)return'Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options';if(_0x433e90&&_0x5a3f45)return _0x27d6e8(0x110);return undefined;}}
@@ -1 +1 @@
1
- const a36_0x53c5c3=a36_0x5f28;(function(_0x1bf337,_0x12e70d){const _0x1b3366=a36_0x5f28,_0x1f673c=_0x1bf337();while(!![]){try{const _0x19ed1a=-parseInt(_0x1b3366(0x227))/0x1+-parseInt(_0x1b3366(0x267))/0x2+parseInt(_0x1b3366(0x25a))/0x3+parseInt(_0x1b3366(0x1fb))/0x4+-parseInt(_0x1b3366(0x277))/0x5*(parseInt(_0x1b3366(0x1fd))/0x6)+-parseInt(_0x1b3366(0x1f4))/0x7+-parseInt(_0x1b3366(0x268))/0x8*(-parseInt(_0x1b3366(0x22b))/0x9);if(_0x19ed1a===_0x12e70d)break;else _0x1f673c['push'](_0x1f673c['shift']());}catch(_0x45bfda){_0x1f673c['push'](_0x1f673c['shift']());}}}(a36_0x5f81,0xacc4a));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_0x3ff574 from'chalk';function formatRelativeTime(_0x59c38e){const _0x401105=a36_0x5f28,_0x42332c=new Date(_0x59c38e),_0x323cc0=new Date(),_0x1872da=_0x42332c[_0x401105(0x26b)]()-_0x323cc0[_0x401105(0x26b)](),_0x98e607=Math['abs'](_0x1872da)/0x3e8,_0xf34568=_0x1872da<0x0;if(_0x98e607<0x3c)return _0xf34568?'just\x20now':_0x401105(0x223);else{if(_0x98e607<0xe10){const _0x4bba9e=Math['round'](_0x98e607/0x3c);return _0xf34568?_0x4bba9e+_0x401105(0x26c):_0x401105(0x272)+_0x4bba9e+'m';}else{if(_0x98e607<0x15180){const _0xb745ff=Math[_0x401105(0x22e)](_0x98e607/0xe10);return _0xf34568?_0xb745ff+_0x401105(0x23d):'in\x20'+_0xb745ff+'h';}else{if(_0x98e607<0x93a80){const _0x193a02=Math['round'](_0x98e607/0x15180);return _0xf34568?_0x193a02+'d\x20ago':_0x401105(0x272)+_0x193a02+'d';}else return _0x42332c[_0x401105(0x256)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x53c5c3(0x24d)]='schedule:list';[a36_0x53c5c3(0x257)]='List\x20scheduled\x20queries';async[a36_0x53c5c3(0x23b)](_0xe6be81){const _0x13c6a4=a36_0x53c5c3,{options:_0x4ea6a3,args:_0x2bf09e,tdx:_0x5b6d0c}=_0xe6be81,_0x49f7f6=resolveLimit(_0x4ea6a3[_0x13c6a4(0x266)],DEFAULT_DISPLAY_LIMIT),_0x1ef2e0=_0x2bf09e[0x0],_0x483938=_0x1ef2e0?_0x13c6a4(0x26a)+_0x1ef2e0+'\x22...':_0x13c6a4(0x248),_0x31c15d=await withSpinner(_0x483938,()=>_0x5b6d0c[_0x13c6a4(0x228)][_0x13c6a4(0x254)]({'limit':_0x49f7f6,'scheduled':!![],'pattern':_0x1ef2e0}),{'verbose':_0x4ea6a3[_0x13c6a4(0x261)]}),_0x3cc1ee=_0x31c15d[_0x13c6a4(0x244)]['queries'],_0x5c6881=_0x31c15d[_0x13c6a4(0x244)][_0x13c6a4(0x1f1)][_0x13c6a4(0x26d)],_0x9db7d2=_0x1ef2e0?_0x13c6a4(0x25c)+_0x1ef2e0+'\x22':'';_0x5c6881?console[_0x13c6a4(0x23a)](_0x13c6a4(0x25f)+_0x3cc1ee[_0x13c6a4(0x25d)]+_0x13c6a4(0x258)+_0x9db7d2+_0x13c6a4(0x263)):console[_0x13c6a4(0x23a)](_0x13c6a4(0x249)+_0x3cc1ee[_0x13c6a4(0x25d)]+_0x13c6a4(0x213)+(_0x3cc1ee['length']!==0x1?'ies':'y')+_0x9db7d2);if(_0x4ea6a3[_0x13c6a4(0x276)]===_0x13c6a4(0x22d)||_0x4ea6a3['format']==='jsonl'||_0x4ea6a3[_0x13c6a4(0x276)]===_0x13c6a4(0x238)||_0x4ea6a3['format']==='tsv'){const _0x466fbc=_0x3cc1ee[_0x13c6a4(0x24e)](_0x15f277=>({'id':_0x15f277['id'],'name':_0x15f277['name'],'cron':_0x15f277['cron'],'database':_0x15f277[_0x13c6a4(0x201)]?.[_0x13c6a4(0x24d)],'type':_0x15f277[_0x13c6a4(0x21a)],'timezone':_0x15f277[_0x13c6a4(0x242)],'user_name':_0x15f277[_0x13c6a4(0x229)]?.[_0x13c6a4(0x24d)],'updated_at':_0x15f277[_0x13c6a4(0x1f9)],'next_run_at':_0x15f277['next_run_at'],'last_job_status':_0x15f277[_0x13c6a4(0x1f7)]?.[_0x13c6a4(0x224)]}));await handleSDKOutput(_0x466fbc,_0x4ea6a3);}else{if(_0x3cc1ee['length']===0x0)console['log']('No\x20scheduled\x20queries\x20found');else{const _0x2aad12=_0x4ea6a3['site'],_0x4ee831=_0x3cc1ee[_0x13c6a4(0x24e)](_0x178dcd=>{const _0x253bc6=_0x13c6a4,_0x5e462a=_0x178dcd[_0x253bc6(0x1f7)]?.['status']?_0x178dcd[_0x253bc6(0x1f7)][_0x253bc6(0x224)]===_0x253bc6(0x260)?'✓':'✗':'-',_0x4ddac8=_0x178dcd[_0x253bc6(0x1f7)]?.[_0x253bc6(0x1fa)]?formatRelativeTime(_0x178dcd['last_job'][_0x253bc6(0x1fa)]):'never',_0x5406d1=_0x178dcd[_0x253bc6(0x21f)]?formatRelativeTime(_0x178dcd[_0x253bc6(0x21f)]):'-',_0x24c3d6=_0x178dcd[_0x253bc6(0x222)]||'',_0x5cb670=_0x178dcd['name']||_0x253bc6(0x217),_0x2637c2=getConsoleUrl(_0x2aad12,_0x253bc6(0x221)+_0x178dcd['id']);return{'statusIcon':_0x5e462a,'lastRun':_0x4ddac8,'nextRun':_0x5406d1,'cron':_0x24c3d6,'name':_0x5cb670,'queryUrl':_0x2637c2,'status':_0x178dcd[_0x253bc6(0x1f7)]?.['status']};}),_0x153ad8=Math[_0x13c6a4(0x251)](..._0x4ee831[_0x13c6a4(0x24e)](_0x58f263=>_0x58f263[_0x13c6a4(0x1f5)][_0x13c6a4(0x25d)])),_0x56718c=Math[_0x13c6a4(0x251)](..._0x4ee831[_0x13c6a4(0x24e)](_0x33ae36=>_0x33ae36['nextRun'][_0x13c6a4(0x25d)])),_0x156add=Math['max'](..._0x4ee831['map'](_0x1e8db0=>_0x1e8db0[_0x13c6a4(0x222)][_0x13c6a4(0x25d)])),_0x100548=_0x4ee831[_0x13c6a4(0x24e)](_0xce30d8=>{const _0x4a5410=_0x13c6a4,_0x1d17f7=_0xce30d8[_0x4a5410(0x224)]===_0x4a5410(0x260)?a36_0x3ff574[_0x4a5410(0x245)](_0xce30d8[_0x4a5410(0x208)]):_0xce30d8[_0x4a5410(0x224)]===_0x4a5410(0x23a)?a36_0x3ff574[_0x4a5410(0x20a)](_0xce30d8[_0x4a5410(0x208)]):a36_0x3ff574[_0x4a5410(0x210)](_0xce30d8[_0x4a5410(0x208)]),_0x576367=_0xce30d8[_0x4a5410(0x1f5)]['padEnd'](_0x153ad8),_0xdb847d=_0xce30d8[_0x4a5410(0x204)]['padEnd'](_0x56718c),_0x5765de=_0xce30d8['cron']?a36_0x3ff574['cyan'](_0xce30d8['cron'][_0x4a5410(0x26f)](_0x156add)):'\x20'[_0x4a5410(0x255)](_0x156add),_0x3fdf1d=hyperlink(_0xce30d8[_0x4a5410(0x24d)],_0xce30d8[_0x4a5410(0x226)]);return'📅\x20'+_0x1d17f7+'\x20'+_0x576367+_0x4a5410(0x20f)+_0xdb847d+'\x20\x20'+_0x5765de+'\x20\x20'+_0x3fdf1d;});await writeOutput(_0x100548[_0x13c6a4(0x278)]('\x0a'),_0x4ea6a3[_0x13c6a4(0x218)],_0x13c6a4(0x225));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x53c5c3(0x24d)]=a36_0x53c5c3(0x22c);['description']=a36_0x53c5c3(0x27c);[a36_0x53c5c3(0x247)](_0x3ef3ae){const _0x3f1674=a36_0x53c5c3,_0xf581fe=_0x3ef3ae[_0x3f1674(0x240)][0x0];if(!_0xf581fe)return _0x3f1674(0x24b);return undefined;}async['execute'](_0x94127f){const _0x4f6810=a36_0x53c5c3,{options:_0xba7e3d,args:_0x317eb8,tdx:_0x16b139}=_0x94127f,_0x20d8ed=_0x317eb8[0x0],_0x1ade6a=await withSpinner(_0x4f6810(0x27a),()=>_0x16b139[_0x4f6810(0x228)]['show'](_0x20d8ed),{'verbose':_0xba7e3d['verbose']}),_0x5444d7=_0x1ade6a[_0x4f6810(0x244)],_0xe34b39={'name':_0x5444d7['name'],'cron':_0x5444d7[_0x4f6810(0x222)],'database':_0x5444d7['database'],'type':_0x5444d7[_0x4f6810(0x21a)],'timezone':_0x5444d7[_0x4f6810(0x250)],'user_name':_0x5444d7[_0x4f6810(0x20b)],'created_at':_0x5444d7['created_at'],'engine_version':_0x5444d7[_0x4f6810(0x234)],'executing_user_id':_0x5444d7[_0x4f6810(0x1f8)],'query':_0x5444d7[_0x4f6810(0x239)],'delay':_0x5444d7[_0x4f6810(0x1f0)],'priority':_0x5444d7[_0x4f6810(0x231)],'retry_limit':_0x5444d7['retry_limit'],..._0x5444d7[_0x4f6810(0x236)]&&{'result':_0x5444d7[_0x4f6810(0x236)]}};return await handleSingleObjectOutput(_0xe34b39,_0xba7e3d),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x53c5c3(0x24d)]=a36_0x53c5c3(0x270);[a36_0x53c5c3(0x257)]=a36_0x53c5c3(0x230);[a36_0x53c5c3(0x247)](_0x3b4c38){const _0x4a52de=a36_0x53c5c3,_0x719638=_0x3b4c38[_0x4a52de(0x240)][0x0];if(!_0x719638)return _0x4a52de(0x1ff);const _0x503c86=_0x3b4c38[_0x4a52de(0x252)];if(!_0x503c86['database'])return _0x4a52de(0x21b);return undefined;}async['execute'](_0x340a4f){const _0x420b86=a36_0x53c5c3,{options:_0x2f1181,args:_0x55bc5a,tdx:_0x26dde3}=_0x340a4f,_0x4de008=_0x55bc5a[0x0],_0x3061e0=_0x2f1181,_0x5548c9=_0x3061e0[_0x420b86(0x201)],_0x504fdb=_0x3061e0['file'],_0x380e42=_0x3061e0[_0x420b86(0x21a)]||_0x420b86(0x216);let _0x1ca45a;try{_0x1ca45a=readFileSync(_0x504fdb,_0x420b86(0x215))[_0x420b86(0x23c)]();}catch(_0x26af49){throw new SDKError(ErrorCode[_0x420b86(0x23f)],_0x420b86(0x273)+_0x504fdb,_0x26af49 instanceof Error?_0x26af49:undefined);}if(!_0x1ca45a)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x420b86(0x265));const _0x256b57={'database':_0x5548c9,'query':_0x1ca45a,'type':_0x380e42};if(_0x3061e0['cron'])_0x256b57[_0x420b86(0x222)]=_0x3061e0[_0x420b86(0x222)];if(_0x3061e0[_0x420b86(0x250)])_0x256b57[_0x420b86(0x250)]=_0x3061e0['timezone'];if(_0x3061e0[_0x420b86(0x1f0)]!==undefined)_0x256b57[_0x420b86(0x1f0)]=Number(_0x3061e0[_0x420b86(0x1f0)]);if(_0x3061e0[_0x420b86(0x231)]!==undefined)_0x256b57['priority']=Number(_0x3061e0[_0x420b86(0x231)]);if(_0x3061e0[_0x420b86(0x259)]!==undefined)_0x256b57[_0x420b86(0x235)]=Number(_0x3061e0['retryLimit']);if(_0x3061e0[_0x420b86(0x22a)])_0x256b57[_0x420b86(0x234)]=_0x3061e0[_0x420b86(0x22a)];if(_0x3061e0[_0x420b86(0x236)])_0x256b57['result']=_0x3061e0[_0x420b86(0x236)];if(_0x2f1181['verbose']){console[_0x420b86(0x23a)](_0x420b86(0x22f)+_0x4de008),console[_0x420b86(0x23a)](_0x420b86(0x1f6)+_0x5548c9),console['error'](_0x420b86(0x24f)+_0x380e42);if(_0x256b57['cron'])console[_0x420b86(0x23a)]('\x20\x20Cron:\x20'+_0x256b57[_0x420b86(0x222)]);if(_0x256b57[_0x420b86(0x250)])console[_0x420b86(0x23a)](_0x420b86(0x27b)+_0x256b57[_0x420b86(0x250)]);}const _0x4fa485=await withSpinner(_0x420b86(0x1f3),()=>_0x26dde3[_0x420b86(0x228)][_0x420b86(0x219)](_0x4de008,_0x256b57),{'verbose':_0x2f1181[_0x420b86(0x261)]});return console[_0x420b86(0x23a)](_0x420b86(0x214)+_0x4fa485[_0x420b86(0x244)][_0x420b86(0x24d)]),await handleSingleObjectOutput(_0x4fa485['data'],_0x2f1181),0x0;}}function a36_0x5f81(){const _0x4af951=['run','time_zone','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','data','green','schedule:history','validate','Listing\x20scheduled\x20queries...','Found\x20','num','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','\x20\x20Num:\x20','name','map','\x20\x20Type:\x20','timezone','max','options','Update\x20a\x20scheduled\x20query','listQueries','repeat','toLocaleDateString','description','\x20schedules','retryLimit','486351CEwPYU','Schedule\x20updated:\x20','\x20matching\x20\x22','length','...','Showing\x20first\x20','success','verbose','schedule:update','\x20(use\x20--limit\x20to\x20see\x20more)','file','Query\x20file\x20is\x20empty','limit','830216YvjBdB','184wSpAHW','from','Searching\x20scheduled\x20queries\x20matching\x20\x22','getTime','m\x20ago','has_next_page','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','padEnd','schedule:create','count','in\x20','Failed\x20to\x20read\x20file:\x20','start_at','scheduled_at','format','5IfSqBm','join','\x20execution','Getting\x20schedule\x20details...','\x20\x20Timezone:\x20','Show\x20schedule\x20details','delay','pagination','created_at','Creating\x20schedule...','7599508PJnskk','lastRun','\x20\x20Database:\x20','last_job','executing_user_id','updated_at','ended_at','3167608ZoNLBB','Schedule\x20run\x20submitted:\x20','3390402xwOBli','Updating\x20schedule...','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','jobs','database','Getting\x20schedule\x20history...','Updating\x20schedule:\x20','nextRun','job_id','Run\x20a\x20scheduled\x20query\x20immediately','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','statusIcon','Schedule\x20deleted:\x20','red','user_name','\x20\x20Time:\x20','history','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','\x20\x20→\x20','dim','\x20job','Running\x20schedule:\x20','\x20scheduled\x20quer','Schedule\x20created:\x20','utf-8','trino','(unnamed)','output','create','type','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','schedule:run','Deleting\x20schedule...','delete','next_run_at','yes','/app/queries/editor?queryId=','cron','soon','status','list','queryUrl','777610ZFskKG','schedules','user','engineVersion','1016244ZVlmzK','schedule:show','json','round','Creating\x20schedule:\x20','Create\x20a\x20scheduled\x20query','priority','schedule:delete','keys','engine_version','retry_limit','result','entries','table','query','error','execute','trim','h\x20ago','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','INVALID_ARGUMENT','args'];a36_0x5f81=function(){return _0x4af951;};return a36_0x5f81();}export class ScheduleUpdateCommand extends BaseCommand{['name']=a36_0x53c5c3(0x262);[a36_0x53c5c3(0x257)]=a36_0x53c5c3(0x253);[a36_0x53c5c3(0x247)](_0xc4282e){const _0x31e6ed=a36_0x53c5c3,_0x3a483d=_0xc4282e[_0x31e6ed(0x240)][0x0];if(!_0x3a483d)return _0x31e6ed(0x23e);return undefined;}async['execute'](_0x346e02){const _0x5b006b=a36_0x53c5c3,{options:_0x1bb114,args:_0x1f8fe3,tdx:_0x2d5686}=_0x346e02,_0x4335a2=_0x1f8fe3[0x0],_0x635f60=_0x1bb114,_0x5532dd={};if(_0x635f60[_0x5b006b(0x201)])_0x5532dd[_0x5b006b(0x201)]=_0x635f60[_0x5b006b(0x201)];if(_0x635f60[_0x5b006b(0x21a)])_0x5532dd[_0x5b006b(0x21a)]=_0x635f60[_0x5b006b(0x21a)];if(_0x635f60[_0x5b006b(0x222)])_0x5532dd[_0x5b006b(0x222)]=_0x635f60['cron'];if(_0x635f60['timezone'])_0x5532dd[_0x5b006b(0x250)]=_0x635f60['timezone'];if(_0x635f60['delay']!==undefined)_0x5532dd[_0x5b006b(0x1f0)]=Number(_0x635f60[_0x5b006b(0x1f0)]);if(_0x635f60['priority']!==undefined)_0x5532dd[_0x5b006b(0x231)]=Number(_0x635f60[_0x5b006b(0x231)]);if(_0x635f60[_0x5b006b(0x259)]!==undefined)_0x5532dd[_0x5b006b(0x235)]=Number(_0x635f60[_0x5b006b(0x259)]);if(_0x635f60['engineVersion'])_0x5532dd[_0x5b006b(0x234)]=_0x635f60['engineVersion'];if(_0x635f60[_0x5b006b(0x236)])_0x5532dd[_0x5b006b(0x236)]=_0x635f60['result'];if(_0x635f60[_0x5b006b(0x264)])try{_0x5532dd[_0x5b006b(0x239)]=readFileSync(_0x635f60['file'],'utf-8')[_0x5b006b(0x23c)]();}catch(_0x5f3ec5){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20read\x20file:\x20'+_0x635f60[_0x5b006b(0x264)],_0x5f3ec5 instanceof Error?_0x5f3ec5:undefined);}if(Object[_0x5b006b(0x233)](_0x5532dd)['length']===0x0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x5b006b(0x207));if(_0x1bb114[_0x5b006b(0x261)]){console[_0x5b006b(0x23a)](_0x5b006b(0x203)+_0x4335a2);for(const [_0x421ab8,_0x17267b]of Object[_0x5b006b(0x237)](_0x5532dd)){_0x421ab8===_0x5b006b(0x239)?console[_0x5b006b(0x23a)]('\x20\x20'+_0x421ab8+':\x20'+_0x17267b['substring'](0x0,0x32)+_0x5b006b(0x25e)):console[_0x5b006b(0x23a)]('\x20\x20'+_0x421ab8+':\x20'+_0x17267b);}}const _0x5b1bae=await withSpinner(_0x5b006b(0x1fe),()=>_0x2d5686['schedules']['update'](_0x4335a2,_0x5532dd),{'verbose':_0x1bb114[_0x5b006b(0x261)]});return console[_0x5b006b(0x23a)](_0x5b006b(0x25b)+_0x5b1bae['data']['name']),await handleSingleObjectOutput(_0x5b1bae[_0x5b006b(0x244)],_0x1bb114),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x53c5c3(0x24d)]=a36_0x53c5c3(0x232);[a36_0x53c5c3(0x257)]='Delete\x20a\x20scheduled\x20query';[a36_0x53c5c3(0x247)](_0x1abbba){const _0x57b757=a36_0x53c5c3,_0x52169b=_0x1abbba[_0x57b757(0x240)][0x0];if(!_0x52169b)return _0x57b757(0x20e);return undefined;}async[a36_0x53c5c3(0x23b)](_0x13d4a5){const _0x57cfc1=a36_0x53c5c3,{options:_0x5d7e3c,args:_0x222951,tdx:_0xbfcf7b}=_0x13d4a5,_0x3fdff0=_0x222951[0x0];if(!_0x5d7e3c[_0x57cfc1(0x220)]){const _0x2d8fca=await confirm(_0x57cfc1(0x243)+_0x3fdff0+'\x22?');if(!_0x2d8fca)return console[_0x57cfc1(0x23a)]('Cancelled'),0x0;}const _0x72bcd1=await withSpinner(_0x57cfc1(0x21d),()=>_0xbfcf7b[_0x57cfc1(0x228)][_0x57cfc1(0x21e)](_0x3fdff0),{'verbose':_0x5d7e3c['verbose']});return console['error'](_0x57cfc1(0x209)+_0x72bcd1[_0x57cfc1(0x244)][_0x57cfc1(0x24d)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{['name']=a36_0x53c5c3(0x21c);[a36_0x53c5c3(0x257)]=a36_0x53c5c3(0x206);[a36_0x53c5c3(0x247)](_0x424252){const _0x163330=a36_0x53c5c3,_0x2e9835=_0x424252[_0x163330(0x240)][0x0];if(!_0x2e9835)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async[a36_0x53c5c3(0x23b)](_0x545080){const _0xa59f9a=a36_0x53c5c3,{options:_0x2f8b2b,args:_0x31f498,tdx:_0x34a891}=_0x545080,_0x3b913e=_0x31f498[0x0],_0x4846f7=_0x2f8b2b,_0x56c2b2=_0x4846f7['time'],_0x150a92=_0x4846f7[_0xa59f9a(0x24a)]!==undefined?Number(_0x4846f7[_0xa59f9a(0x24a)]):undefined;if(_0x2f8b2b[_0xa59f9a(0x261)]){console[_0xa59f9a(0x23a)](_0xa59f9a(0x212)+_0x3b913e);if(_0x56c2b2)console[_0xa59f9a(0x23a)](_0xa59f9a(0x20c)+_0x56c2b2);if(_0x150a92)console[_0xa59f9a(0x23a)](_0xa59f9a(0x24c)+_0x150a92);}const _0x5a7367=await withSpinner('Running\x20schedule...',()=>_0x34a891[_0xa59f9a(0x228)][_0xa59f9a(0x241)](_0x3b913e,{'time':_0x56c2b2,'num':_0x150a92}),{'verbose':_0x2f8b2b['verbose']}),_0x31d060=_0x5a7367[_0xa59f9a(0x244)][_0xa59f9a(0x200)];console[_0xa59f9a(0x23a)](_0xa59f9a(0x1fc)+_0x31d060[_0xa59f9a(0x25d)]+_0xa59f9a(0x211)+(_0x31d060['length']!==0x1?'s':'')+'\x20created');for(const _0x1bcd0c of _0x31d060){console['error']('\x20\x20Job\x20ID:\x20'+_0x1bcd0c['job_id']);}return await handleSDKOutput(_0x31d060,_0x2f8b2b),0x0;}}function a36_0x5f28(_0x4cd87f,_0x5c584f){_0x4cd87f=_0x4cd87f-0x1f0;const _0x5f81b5=a36_0x5f81();let _0x5f280a=_0x5f81b5[_0x4cd87f];return _0x5f280a;}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x53c5c3(0x24d)]=a36_0x53c5c3(0x246);[a36_0x53c5c3(0x257)]='Show\x20schedule\x20execution\x20history';['validate'](_0x95c448){const _0x4678d7=a36_0x53c5c3,_0x3ce8dc=_0x95c448['args'][0x0];if(!_0x3ce8dc)return _0x4678d7(0x26e);return undefined;}async['execute'](_0x5a3dcc){const _0x55465b=a36_0x53c5c3,{options:_0x411ad7,args:_0x1826dc,tdx:_0x47d9bc}=_0x5a3dcc,_0x1d488d=_0x1826dc[0x0],_0x2606ab=_0x411ad7,_0x4af3d0=_0x2606ab['from']!==undefined?Number(_0x2606ab[_0x55465b(0x269)]):undefined,_0x3c72eb=_0x2606ab['to']!==undefined?Number(_0x2606ab['to']):undefined,_0x18803=await withSpinner(_0x55465b(0x202),()=>_0x47d9bc['schedules'][_0x55465b(0x20d)](_0x1d488d,{'from':_0x4af3d0,'to':_0x3c72eb}),{'verbose':_0x411ad7[_0x55465b(0x261)]}),_0x2ac770=_0x18803[_0x55465b(0x244)];console[_0x55465b(0x23a)](_0x55465b(0x249)+_0x2ac770[_0x55465b(0x271)]+_0x55465b(0x279)+(_0x2ac770[_0x55465b(0x271)]!==0x1?'s':'')+'\x20(showing\x20'+_0x2ac770[_0x55465b(0x269)]+'-'+_0x2ac770['to']+')');const _0x332b84=_0x2ac770[_0x55465b(0x20d)][_0x55465b(0x24e)](_0x4473e3=>({'job_id':_0x4473e3[_0x55465b(0x205)],'type':_0x4473e3[_0x55465b(0x21a)],'status':_0x4473e3[_0x55465b(0x224)],'scheduled_at':_0x4473e3[_0x55465b(0x275)],'created_at':_0x4473e3[_0x55465b(0x1f2)],'start_at':_0x4473e3[_0x55465b(0x274)],'end_at':_0x4473e3['end_at']}));return await handleSDKOutput(_0x332b84,_0x411ad7),0x0;}}
1
+ const a36_0x204e57=a36_0x5c85;(function(_0xc42b46,_0x269c9e){const _0x125d41=a36_0x5c85,_0x3b93cc=_0xc42b46();while(!![]){try{const _0x48d008=parseInt(_0x125d41(0x13d))/0x1*(parseInt(_0x125d41(0x135))/0x2)+parseInt(_0x125d41(0x12b))/0x3+parseInt(_0x125d41(0x14a))/0x4+parseInt(_0x125d41(0x13e))/0x5*(-parseInt(_0x125d41(0xf1))/0x6)+parseInt(_0x125d41(0x10c))/0x7+-parseInt(_0x125d41(0x15d))/0x8+parseInt(_0x125d41(0xfa))/0x9*(-parseInt(_0x125d41(0x186))/0xa);if(_0x48d008===_0x269c9e)break;else _0x3b93cc['push'](_0x3b93cc['shift']());}catch(_0x122520){_0x3b93cc['push'](_0x3b93cc['shift']());}}}(a36_0x1f4b,0xaa61e));function a36_0x1f4b(){const _0x307aca=['Deleting\x20schedule...','Run\x20a\x20scheduled\x20query\x20immediately','trino','count','execute','output','2817528ejtnrS','toLocaleDateString','list','schedules','Schedule\x20updated:\x20','timezone','delay','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','listQueries','create','40134tFqksD','validate','INVALID_ARGUMENT','cyan','start_at','data','updated_at','\x20\x20→\x20','12YFpMML','2274205CYclih','yes','Delete\x20a\x20scheduled\x20query','soon','args','pagination','Schedule\x20run\x20submitted:\x20','\x20\x20Type:\x20','List\x20scheduled\x20queries','delete','schedule:list','num','2234188VFToKh','m\x20ago','\x20\x20Cron:\x20','jsonl','round','result','\x20execution','never','Create\x20a\x20scheduled\x20query','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','\x20\x20Time:\x20','Creating\x20schedule...','keys','time_zone','dim','Updating\x20schedule:\x20','created_at','\x20scheduled\x20quer','in\x20','3703728VyeaxV','substring','Creating\x20schedule:\x20','/app/queries/editor?queryId=','limit','verbose','description','database','history','\x20schedules','Getting\x20schedule\x20details...','next_run_at','utf-8','retryLimit','Running\x20schedule:\x20','job_id','repeat','\x20\x20Num:\x20','show','schedule:show','max','green','lastRun','last_job','length','map','name','retry_limit','schedule:run','executing_user_id','log','schedule:create','...','has_next_page','\x20\x20Timezone:\x20','json','No\x20scheduled\x20queries\x20found','(unnamed)','success','red','Failed\x20to\x20read\x20file:\x20','11560kyUBVR','Running\x20schedule...','Found\x20','update','6jhyflm','format','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','Cancelled','join','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','statusIcon','queryUrl','padEnd','8559hWBgoE','Schedule\x20created:\x20','user','from','ended_at','\x20(use\x20--limit\x20to\x20see\x20more)','end_at','schedule:history','priority','type','\x20job','schedule:update','\x20(showing\x20','Show\x20schedule\x20details','ies','abs','cron','trim','6835654SHoswR','Getting\x20schedule\x20history...','\x20\x20Job\x20ID:\x20','getTime','scheduled_at','Update\x20a\x20scheduled\x20query','schedule:delete','status','d\x20ago','\x22...','engineVersion','📅\x20','error','Show\x20schedule\x20execution\x20history','queries','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','nextRun','jobs','Query\x20file\x20is\x20empty','query','file','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','h\x20ago','run','options'];a36_0x1f4b=function(){return _0x307aca;};return a36_0x1f4b();}import{BaseCommand}from'./command.js';function a36_0x5c85(_0xf3a8ad,_0xbe2f3d){_0xf3a8ad=_0xf3a8ad-0xf0;const _0x1f4bcf=a36_0x1f4b();let _0x5c85d3=_0x1f4bcf[_0xf3a8ad];return _0x5c85d3;}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_0x2b8a06 from'chalk';function formatRelativeTime(_0x34ffb6){const _0x273e11=a36_0x5c85,_0x2e278b=new Date(_0x34ffb6),_0x2cae81=new Date(),_0x1a2cca=_0x2e278b[_0x273e11(0x10f)]()-_0x2cae81[_0x273e11(0x10f)](),_0x5dd999=Math[_0x273e11(0x109)](_0x1a2cca)/0x3e8,_0x4f0116=_0x1a2cca<0x0;if(_0x5dd999<0x3c)return _0x4f0116?'just\x20now':_0x273e11(0x141);else{if(_0x5dd999<0xe10){const _0x276718=Math[_0x273e11(0x14e)](_0x5dd999/0x3c);return _0x4f0116?_0x276718+_0x273e11(0x14b):_0x273e11(0x15c)+_0x276718+'m';}else{if(_0x5dd999<0x15180){const _0xd0f931=Math['round'](_0x5dd999/0xe10);return _0x4f0116?_0xd0f931+_0x273e11(0x122):_0x273e11(0x15c)+_0xd0f931+'h';}else{if(_0x5dd999<0x93a80){const _0x8fe721=Math[_0x273e11(0x14e)](_0x5dd999/0x15180);return _0x4f0116?_0x8fe721+_0x273e11(0x114):_0x273e11(0x15c)+_0x8fe721+'d';}else return _0x2e278b[_0x273e11(0x12c)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x204e57(0x177)]=a36_0x204e57(0x148);[a36_0x204e57(0x163)]=a36_0x204e57(0x146);async[a36_0x204e57(0x129)](_0x59673){const _0x43cb88=a36_0x204e57,{options:_0xcaa9b0,args:_0x12735f,tdx:_0x598d56}=_0x59673,_0x12b9b3=resolveLimit(_0xcaa9b0[_0x43cb88(0x161)],DEFAULT_DISPLAY_LIMIT),_0x3243cb=_0x12735f[0x0],_0x37c595=_0x3243cb?'Searching\x20scheduled\x20queries\x20matching\x20\x22'+_0x3243cb+_0x43cb88(0x115):'Listing\x20scheduled\x20queries...',_0x277c0a=await withSpinner(_0x37c595,()=>_0x598d56[_0x43cb88(0x12e)][_0x43cb88(0x133)]({'limit':_0x12b9b3,'scheduled':!![],'pattern':_0x3243cb}),{'verbose':_0xcaa9b0['verbose']}),_0x5937e2=_0x277c0a['data'][_0x43cb88(0x11a)],_0x327655=_0x277c0a[_0x43cb88(0x13a)][_0x43cb88(0x143)][_0x43cb88(0x17e)],_0x3e1ea8=_0x3243cb?'\x20matching\x20\x22'+_0x3243cb+'\x22':'';_0x327655?console[_0x43cb88(0x118)]('Showing\x20first\x20'+_0x5937e2[_0x43cb88(0x175)]+_0x43cb88(0x166)+_0x3e1ea8+_0x43cb88(0xff)):console[_0x43cb88(0x118)](_0x43cb88(0x188)+_0x5937e2[_0x43cb88(0x175)]+_0x43cb88(0x15b)+(_0x5937e2[_0x43cb88(0x175)]!==0x1?_0x43cb88(0x108):'y')+_0x3e1ea8);if(_0xcaa9b0[_0x43cb88(0xf2)]===_0x43cb88(0x180)||_0xcaa9b0[_0x43cb88(0xf2)]===_0x43cb88(0x14d)||_0xcaa9b0[_0x43cb88(0xf2)]==='table'||_0xcaa9b0['format']==='tsv'){const _0x2cc44c=_0x5937e2[_0x43cb88(0x176)](_0x3c2bec=>({'id':_0x3c2bec['id'],'name':_0x3c2bec[_0x43cb88(0x177)],'cron':_0x3c2bec[_0x43cb88(0x10a)],'database':_0x3c2bec[_0x43cb88(0x164)]?.[_0x43cb88(0x177)],'type':_0x3c2bec['type'],'timezone':_0x3c2bec[_0x43cb88(0x157)],'user_name':_0x3c2bec[_0x43cb88(0xfc)]?.['name'],'updated_at':_0x3c2bec[_0x43cb88(0x13b)],'next_run_at':_0x3c2bec[_0x43cb88(0x168)],'last_job_status':_0x3c2bec['last_job']?.[_0x43cb88(0x113)]}));await handleSDKOutput(_0x2cc44c,_0xcaa9b0);}else{if(_0x5937e2['length']===0x0)console[_0x43cb88(0x17b)](_0x43cb88(0x181));else{const _0x4531db=_0xcaa9b0['site'],_0x35713c=_0x5937e2['map'](_0x2c6901=>{const _0x23e39b=_0x43cb88,_0x1609dc=_0x2c6901[_0x23e39b(0x174)]?.[_0x23e39b(0x113)]?_0x2c6901[_0x23e39b(0x174)]['status']===_0x23e39b(0x183)?'✓':'✗':'-',_0x126018=_0x2c6901[_0x23e39b(0x174)]?.[_0x23e39b(0xfe)]?formatRelativeTime(_0x2c6901[_0x23e39b(0x174)]['ended_at']):_0x23e39b(0x151),_0x2d31e7=_0x2c6901['next_run_at']?formatRelativeTime(_0x2c6901[_0x23e39b(0x168)]):'-',_0x5ca915=_0x2c6901['cron']||'',_0x4380ff=_0x2c6901[_0x23e39b(0x177)]||_0x23e39b(0x182),_0x247b26=getConsoleUrl(_0x4531db,_0x23e39b(0x160)+_0x2c6901['id']);return{'statusIcon':_0x1609dc,'lastRun':_0x126018,'nextRun':_0x2d31e7,'cron':_0x5ca915,'name':_0x4380ff,'queryUrl':_0x247b26,'status':_0x2c6901['last_job']?.[_0x23e39b(0x113)]};}),_0x6079b6=Math[_0x43cb88(0x171)](..._0x35713c[_0x43cb88(0x176)](_0x35b2e6=>_0x35b2e6[_0x43cb88(0x173)][_0x43cb88(0x175)])),_0x3788d4=Math[_0x43cb88(0x171)](..._0x35713c[_0x43cb88(0x176)](_0x155b03=>_0x155b03[_0x43cb88(0x11c)][_0x43cb88(0x175)])),_0x1698bb=Math[_0x43cb88(0x171)](..._0x35713c[_0x43cb88(0x176)](_0x4dc343=>_0x4dc343['cron'][_0x43cb88(0x175)])),_0x44ebd2=_0x35713c[_0x43cb88(0x176)](_0x44742b=>{const _0x222e72=_0x43cb88,_0x2f69dc=_0x44742b[_0x222e72(0x113)]==='success'?a36_0x2b8a06[_0x222e72(0x172)](_0x44742b['statusIcon']):_0x44742b['status']===_0x222e72(0x118)?a36_0x2b8a06[_0x222e72(0x184)](_0x44742b[_0x222e72(0xf7)]):a36_0x2b8a06[_0x222e72(0x158)](_0x44742b[_0x222e72(0xf7)]),_0x496a54=_0x44742b[_0x222e72(0x173)][_0x222e72(0xf9)](_0x6079b6),_0x40dadf=_0x44742b[_0x222e72(0x11c)]['padEnd'](_0x3788d4),_0x509e1f=_0x44742b[_0x222e72(0x10a)]?a36_0x2b8a06[_0x222e72(0x138)](_0x44742b['cron'][_0x222e72(0xf9)](_0x1698bb)):'\x20'[_0x222e72(0x16d)](_0x1698bb),_0x3a43f7=hyperlink(_0x44742b['name'],_0x44742b[_0x222e72(0xf8)]);return _0x222e72(0x117)+_0x2f69dc+'\x20'+_0x496a54+_0x222e72(0x13c)+_0x40dadf+'\x20\x20'+_0x509e1f+'\x20\x20'+_0x3a43f7;});await writeOutput(_0x44ebd2[_0x43cb88(0xf5)]('\x0a'),_0xcaa9b0[_0x43cb88(0x12a)],_0x43cb88(0x12d));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x204e57(0x177)]=a36_0x204e57(0x170);[a36_0x204e57(0x163)]=a36_0x204e57(0x107);[a36_0x204e57(0x136)](_0x9bb6b3){const _0x290980=a36_0x204e57,_0x31c729=_0x9bb6b3[_0x290980(0x142)][0x0];if(!_0x31c729)return _0x290980(0x121);return undefined;}async['execute'](_0x3c744b){const _0x35fe66=a36_0x204e57,{options:_0x4b1fb5,args:_0x3a4c30,tdx:_0x1040a7}=_0x3c744b,_0x462e4c=_0x3a4c30[0x0],_0x4b429b=await withSpinner(_0x35fe66(0x167),()=>_0x1040a7['schedules'][_0x35fe66(0x16f)](_0x462e4c),{'verbose':_0x4b1fb5[_0x35fe66(0x162)]}),_0x170279=_0x4b429b['data'],_0x12b888={'name':_0x170279[_0x35fe66(0x177)],'cron':_0x170279['cron'],'database':_0x170279[_0x35fe66(0x164)],'type':_0x170279[_0x35fe66(0x103)],'timezone':_0x170279[_0x35fe66(0x130)],'user_name':_0x170279['user_name'],'created_at':_0x170279[_0x35fe66(0x15a)],'engine_version':_0x170279['engine_version'],'executing_user_id':_0x170279[_0x35fe66(0x17a)],'query':_0x170279['query'],'delay':_0x170279['delay'],'priority':_0x170279[_0x35fe66(0x102)],'retry_limit':_0x170279[_0x35fe66(0x178)],..._0x170279[_0x35fe66(0x14f)]&&{'result':_0x170279['result']}};return await handleSingleObjectOutput(_0x12b888,_0x4b1fb5),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x204e57(0x177)]=a36_0x204e57(0x17c);[a36_0x204e57(0x163)]=a36_0x204e57(0x152);[a36_0x204e57(0x136)](_0x2a33d7){const _0x2a5144=a36_0x204e57,_0x15726e=_0x2a33d7[_0x2a5144(0x142)][0x0];if(!_0x15726e)return _0x2a5144(0x11b);const _0x3be726=_0x2a33d7[_0x2a5144(0x124)];if(!_0x3be726['database'])return _0x2a5144(0x132);return undefined;}async['execute'](_0x107c96){const _0x1cdf98=a36_0x204e57,{options:_0x530eff,args:_0x2e756c,tdx:_0x16a0c7}=_0x107c96,_0x23a8b0=_0x2e756c[0x0],_0x15f031=_0x530eff,_0xc1ec18=_0x15f031[_0x1cdf98(0x164)],_0x582d67=_0x15f031[_0x1cdf98(0x120)],_0x37d86a=_0x15f031[_0x1cdf98(0x103)]||_0x1cdf98(0x127);let _0x436703;try{_0x436703=readFileSync(_0x582d67,_0x1cdf98(0x169))[_0x1cdf98(0x10b)]();}catch(_0x36dc13){throw new SDKError(ErrorCode[_0x1cdf98(0x137)],'Failed\x20to\x20read\x20file:\x20'+_0x582d67,_0x36dc13 instanceof Error?_0x36dc13:undefined);}if(!_0x436703)throw new SDKError(ErrorCode[_0x1cdf98(0x137)],_0x1cdf98(0x11e));const _0x2049d6={'database':_0xc1ec18,'query':_0x436703,'type':_0x37d86a};if(_0x15f031['cron'])_0x2049d6[_0x1cdf98(0x10a)]=_0x15f031[_0x1cdf98(0x10a)];if(_0x15f031[_0x1cdf98(0x130)])_0x2049d6[_0x1cdf98(0x130)]=_0x15f031[_0x1cdf98(0x130)];if(_0x15f031[_0x1cdf98(0x131)]!==undefined)_0x2049d6[_0x1cdf98(0x131)]=Number(_0x15f031[_0x1cdf98(0x131)]);if(_0x15f031['priority']!==undefined)_0x2049d6[_0x1cdf98(0x102)]=Number(_0x15f031[_0x1cdf98(0x102)]);if(_0x15f031[_0x1cdf98(0x16a)]!==undefined)_0x2049d6['retry_limit']=Number(_0x15f031[_0x1cdf98(0x16a)]);if(_0x15f031[_0x1cdf98(0x116)])_0x2049d6['engine_version']=_0x15f031[_0x1cdf98(0x116)];if(_0x15f031['result'])_0x2049d6[_0x1cdf98(0x14f)]=_0x15f031[_0x1cdf98(0x14f)];if(_0x530eff[_0x1cdf98(0x162)]){console['error'](_0x1cdf98(0x15f)+_0x23a8b0),console['error']('\x20\x20Database:\x20'+_0xc1ec18),console[_0x1cdf98(0x118)](_0x1cdf98(0x145)+_0x37d86a);if(_0x2049d6[_0x1cdf98(0x10a)])console[_0x1cdf98(0x118)](_0x1cdf98(0x14c)+_0x2049d6[_0x1cdf98(0x10a)]);if(_0x2049d6[_0x1cdf98(0x130)])console['error'](_0x1cdf98(0x17f)+_0x2049d6[_0x1cdf98(0x130)]);}const _0x128b17=await withSpinner(_0x1cdf98(0x155),()=>_0x16a0c7[_0x1cdf98(0x12e)][_0x1cdf98(0x134)](_0x23a8b0,_0x2049d6),{'verbose':_0x530eff[_0x1cdf98(0x162)]});return console[_0x1cdf98(0x118)](_0x1cdf98(0xfb)+_0x128b17[_0x1cdf98(0x13a)][_0x1cdf98(0x177)]),await handleSingleObjectOutput(_0x128b17[_0x1cdf98(0x13a)],_0x530eff),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x204e57(0x177)]=a36_0x204e57(0x105);[a36_0x204e57(0x163)]=a36_0x204e57(0x111);[a36_0x204e57(0x136)](_0x99c95e){const _0x5920a7=a36_0x204e57,_0x255acf=_0x99c95e[_0x5920a7(0x142)][0x0];if(!_0x255acf)return _0x5920a7(0xf6);return undefined;}async[a36_0x204e57(0x129)](_0x30eb87){const _0x48ad08=a36_0x204e57,{options:_0x205cf9,args:_0x363281,tdx:_0xece36e}=_0x30eb87,_0x2904f5=_0x363281[0x0],_0x528cf3=_0x205cf9,_0x2c01e9={};if(_0x528cf3['database'])_0x2c01e9[_0x48ad08(0x164)]=_0x528cf3[_0x48ad08(0x164)];if(_0x528cf3[_0x48ad08(0x103)])_0x2c01e9[_0x48ad08(0x103)]=_0x528cf3[_0x48ad08(0x103)];if(_0x528cf3['cron'])_0x2c01e9['cron']=_0x528cf3[_0x48ad08(0x10a)];if(_0x528cf3['timezone'])_0x2c01e9[_0x48ad08(0x130)]=_0x528cf3[_0x48ad08(0x130)];if(_0x528cf3[_0x48ad08(0x131)]!==undefined)_0x2c01e9['delay']=Number(_0x528cf3[_0x48ad08(0x131)]);if(_0x528cf3[_0x48ad08(0x102)]!==undefined)_0x2c01e9['priority']=Number(_0x528cf3[_0x48ad08(0x102)]);if(_0x528cf3[_0x48ad08(0x16a)]!==undefined)_0x2c01e9[_0x48ad08(0x178)]=Number(_0x528cf3[_0x48ad08(0x16a)]);if(_0x528cf3[_0x48ad08(0x116)])_0x2c01e9['engine_version']=_0x528cf3[_0x48ad08(0x116)];if(_0x528cf3[_0x48ad08(0x14f)])_0x2c01e9[_0x48ad08(0x14f)]=_0x528cf3[_0x48ad08(0x14f)];if(_0x528cf3[_0x48ad08(0x120)])try{_0x2c01e9[_0x48ad08(0x11f)]=readFileSync(_0x528cf3[_0x48ad08(0x120)],_0x48ad08(0x169))['trim']();}catch(_0xcbd2a9){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x48ad08(0x185)+_0x528cf3[_0x48ad08(0x120)],_0xcbd2a9 instanceof Error?_0xcbd2a9:undefined);}if(Object[_0x48ad08(0x156)](_0x2c01e9)[_0x48ad08(0x175)]===0x0)throw new SDKError(ErrorCode[_0x48ad08(0x137)],'At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update');if(_0x205cf9['verbose']){console[_0x48ad08(0x118)](_0x48ad08(0x159)+_0x2904f5);for(const [_0x342f50,_0x2917dc]of Object['entries'](_0x2c01e9)){_0x342f50===_0x48ad08(0x11f)?console['error']('\x20\x20'+_0x342f50+':\x20'+_0x2917dc[_0x48ad08(0x15e)](0x0,0x32)+_0x48ad08(0x17d)):console['error']('\x20\x20'+_0x342f50+':\x20'+_0x2917dc);}}const _0x161d11=await withSpinner('Updating\x20schedule...',()=>_0xece36e[_0x48ad08(0x12e)][_0x48ad08(0xf0)](_0x2904f5,_0x2c01e9),{'verbose':_0x205cf9[_0x48ad08(0x162)]});return console[_0x48ad08(0x118)](_0x48ad08(0x12f)+_0x161d11[_0x48ad08(0x13a)][_0x48ad08(0x177)]),await handleSingleObjectOutput(_0x161d11[_0x48ad08(0x13a)],_0x205cf9),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x204e57(0x177)]=a36_0x204e57(0x112);[a36_0x204e57(0x163)]=a36_0x204e57(0x140);[a36_0x204e57(0x136)](_0x7a57e5){const _0x31b20f=a36_0x204e57,_0x43195c=_0x7a57e5[_0x31b20f(0x142)][0x0];if(!_0x43195c)return _0x31b20f(0x153);return undefined;}async[a36_0x204e57(0x129)](_0x438844){const _0x2c80a9=a36_0x204e57,{options:_0x1cff69,args:_0x2794b1,tdx:_0x2c19c6}=_0x438844,_0x3a286a=_0x2794b1[0x0];if(!_0x1cff69[_0x2c80a9(0x13f)]){const _0x4b7345=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22'+_0x3a286a+'\x22?');if(!_0x4b7345)return console[_0x2c80a9(0x118)](_0x2c80a9(0xf4)),0x0;}const _0x3717c1=await withSpinner(_0x2c80a9(0x125),()=>_0x2c19c6['schedules'][_0x2c80a9(0x147)](_0x3a286a),{'verbose':_0x1cff69[_0x2c80a9(0x162)]});return console[_0x2c80a9(0x118)]('Schedule\x20deleted:\x20'+_0x3717c1[_0x2c80a9(0x13a)]['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x204e57(0x177)]=a36_0x204e57(0x179);[a36_0x204e57(0x163)]=a36_0x204e57(0x126);[a36_0x204e57(0x136)](_0x401f8a){const _0x2ed1fc=a36_0x204e57,_0x2ebe7c=_0x401f8a[_0x2ed1fc(0x142)][0x0];if(!_0x2ebe7c)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async[a36_0x204e57(0x129)](_0x3b75b0){const _0x40d60b=a36_0x204e57,{options:_0x45146c,args:_0x10576d,tdx:_0x2109d3}=_0x3b75b0,_0xec9d8c=_0x10576d[0x0],_0x44776e=_0x45146c,_0x2af9b0=_0x44776e['time'],_0x53e416=_0x44776e['num']!==undefined?Number(_0x44776e[_0x40d60b(0x149)]):undefined;if(_0x45146c[_0x40d60b(0x162)]){console[_0x40d60b(0x118)](_0x40d60b(0x16b)+_0xec9d8c);if(_0x2af9b0)console[_0x40d60b(0x118)](_0x40d60b(0x154)+_0x2af9b0);if(_0x53e416)console[_0x40d60b(0x118)](_0x40d60b(0x16e)+_0x53e416);}const _0x57c5a5=await withSpinner(_0x40d60b(0x187),()=>_0x2109d3[_0x40d60b(0x12e)][_0x40d60b(0x123)](_0xec9d8c,{'time':_0x2af9b0,'num':_0x53e416}),{'verbose':_0x45146c[_0x40d60b(0x162)]}),_0x207a44=_0x57c5a5[_0x40d60b(0x13a)][_0x40d60b(0x11d)];console[_0x40d60b(0x118)](_0x40d60b(0x144)+_0x207a44['length']+_0x40d60b(0x104)+(_0x207a44['length']!==0x1?'s':'')+'\x20created');for(const _0x3a3310 of _0x207a44){console['error'](_0x40d60b(0x10e)+_0x3a3310[_0x40d60b(0x16c)]);}return await handleSDKOutput(_0x207a44,_0x45146c),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{['name']=a36_0x204e57(0x101);[a36_0x204e57(0x163)]=a36_0x204e57(0x119);[a36_0x204e57(0x136)](_0x1de85c){const _0x45ea42=a36_0x204e57,_0x1c19b3=_0x1de85c[_0x45ea42(0x142)][0x0];if(!_0x1c19b3)return _0x45ea42(0xf3);return undefined;}async['execute'](_0x365b90){const _0x1c9abf=a36_0x204e57,{options:_0x5aa314,args:_0x1d12b2,tdx:_0x2124d0}=_0x365b90,_0x33597d=_0x1d12b2[0x0],_0x1a2f9f=_0x5aa314,_0x4f5744=_0x1a2f9f[_0x1c9abf(0xfd)]!==undefined?Number(_0x1a2f9f[_0x1c9abf(0xfd)]):undefined,_0x18d6da=_0x1a2f9f['to']!==undefined?Number(_0x1a2f9f['to']):undefined,_0x349e00=await withSpinner(_0x1c9abf(0x10d),()=>_0x2124d0[_0x1c9abf(0x12e)][_0x1c9abf(0x165)](_0x33597d,{'from':_0x4f5744,'to':_0x18d6da}),{'verbose':_0x5aa314['verbose']}),_0x1f1129=_0x349e00[_0x1c9abf(0x13a)];console[_0x1c9abf(0x118)](_0x1c9abf(0x188)+_0x1f1129[_0x1c9abf(0x128)]+_0x1c9abf(0x150)+(_0x1f1129['count']!==0x1?'s':'')+_0x1c9abf(0x106)+_0x1f1129[_0x1c9abf(0xfd)]+'-'+_0x1f1129['to']+')');const _0xd8eb47=_0x1f1129['history'][_0x1c9abf(0x176)](_0x5a9a7a=>({'job_id':_0x5a9a7a[_0x1c9abf(0x16c)],'type':_0x5a9a7a[_0x1c9abf(0x103)],'status':_0x5a9a7a[_0x1c9abf(0x113)],'scheduled_at':_0x5a9a7a[_0x1c9abf(0x110)],'created_at':_0x5a9a7a['created_at'],'start_at':_0x5a9a7a[_0x1c9abf(0x139)],'end_at':_0x5a9a7a[_0x1c9abf(0x100)]}));return await handleSDKOutput(_0xd8eb47,_0x5aa314),0x0;}}
@@ -1 +1 @@
1
- const a37_0x24a788=a37_0x1fe9;(function(_0x2df11e,_0x325110){const _0x2f82e2=a37_0x1fe9,_0x29c81e=_0x2df11e();while(!![]){try{const _0x5c03f3=parseInt(_0x2f82e2(0x1a5))/0x1*(-parseInt(_0x2f82e2(0x137))/0x2)+parseInt(_0x2f82e2(0x120))/0x3*(parseInt(_0x2f82e2(0x18d))/0x4)+parseInt(_0x2f82e2(0x170))/0x5*(-parseInt(_0x2f82e2(0x130))/0x6)+-parseInt(_0x2f82e2(0x145))/0x7*(-parseInt(_0x2f82e2(0x18f))/0x8)+parseInt(_0x2f82e2(0x192))/0x9*(-parseInt(_0x2f82e2(0x133))/0xa)+parseInt(_0x2f82e2(0x162))/0xb+-parseInt(_0x2f82e2(0x19c))/0xc*(parseInt(_0x2f82e2(0x115))/0xd);if(_0x5c03f3===_0x325110)break;else _0x29c81e['push'](_0x29c81e['shift']());}catch(_0x63a42c){_0x29c81e['push'](_0x29c81e['shift']());}}}(a37_0x126a,0xa2cfd));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';function a37_0x1fe9(_0x2ad7d8,_0x4b28a6){_0x2ad7d8=_0x2ad7d8-0x105;const _0x126a79=a37_0x126a();let _0x1fe909=_0x126a79[_0x2ad7d8];return _0x1fe909;}import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0xc3947b from'chalk';async function resolveSegmentTarget(_0x536d2e,_0x72297,_0x4c9a4c){const _0x8a9daa=a37_0x1fe9;if(isYamlFilePath(_0x536d2e))try{const _0x53c5ba=await resolveYamlFilePath(_0x536d2e);return _0x4c9a4c&&(console[_0x8a9daa(0x106)](_0x8a9daa(0x121)+_0x536d2e),console['error'](_0x8a9daa(0x178)+_0x53c5ba[_0x8a9daa(0x190)]),console[_0x8a9daa(0x106)](_0x8a9daa(0x18c)+_0x53c5ba[_0x8a9daa(0x116)]),console['error'](_0x8a9daa(0x141)+(_0x53c5ba[_0x8a9daa(0x195)]||_0x8a9daa(0x150))),console[_0x8a9daa(0x106)]('\x20\x20Full\x20path:\x20'+_0x53c5ba[_0x8a9daa(0x16a)])),_0x53c5ba[_0x8a9daa(0x16a)];}catch(_0x5a80c8){throw new SDKError(ErrorCode[_0x8a9daa(0x10b)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x5a80c8[_0x8a9daa(0x169)]);}if(!_0x72297)throw new SDKError(ErrorCode[_0x8a9daa(0x10b)],_0x8a9daa(0x119));return _0x72297+'/'+_0x536d2e;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x24a788(0x189)]=a37_0x24a788(0x165);[a37_0x24a788(0x140)]='Show\x20segment\x20or\x20folder\x20details';async[a37_0x24a788(0x1a9)](_0x7961b7){const _0x3a8825=a37_0x24a788,{options:_0x333936,args:_0x13f97a,tdx:_0x120511}=_0x7961b7,_0x2d95f3=_0x13f97a[0x0],_0x37f683=!_0x2d95f3&&!!_0x333936[_0x3a8825(0x190)],_0x1fd6eb=_0x2d95f3||_0x333936[_0x3a8825(0x190)];if(!_0x1fd6eb)return console[_0x3a8825(0x106)](_0x3a8825(0x1a4)),console['error'](_0x3a8825(0x108)),console['error']('Examples:'),console['error'](_0x3a8825(0x11f)),console[_0x3a8825(0x106)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console[_0x3a8825(0x106)](_0x3a8825(0x15a)),console[_0x3a8825(0x106)](_0x3a8825(0x15b)),0x1;try{const _0x2eb465=_0x333936[_0x3a8825(0x1a0)];let _0x2c4874=_0x1fd6eb;!_0x37f683&&_0x2eb465&&!_0x1fd6eb['includes']('/')&&(_0x2c4874=_0x2eb465+'/'+_0x1fd6eb,_0x333936[_0x3a8825(0x187)]&&console[_0x3a8825(0x106)](_0x3a8825(0x14d)+_0x2c4874));const _0x510a23=await withSpinner(_0x3a8825(0x134)+_0x2c4874+_0x3a8825(0x167),()=>_0x120511['segment']['resolvePathToResource'](_0x2c4874),{'verbose':_0x333936[_0x3a8825(0x187)]}),_0x8dec7c=_0x510a23[_0x3a8825(0x19b)];_0x333936[_0x3a8825(0x187)]&&(console['error'](_0x3a8825(0x179)+_0x8dec7c[_0x3a8825(0x125)]),console['error'](_0x3a8825(0x12e)+_0x8dec7c['parentId']),_0x8dec7c[_0x3a8825(0x168)]&&console[_0x3a8825(0x106)](_0x3a8825(0x184)+_0x8dec7c['folderId']),_0x8dec7c[_0x3a8825(0x14e)]&&console[_0x3a8825(0x106)]('Segment\x20ID:\x20'+_0x8dec7c[_0x3a8825(0x14e)]));if(_0x8dec7c[_0x3a8825(0x125)]===_0x3a8825(0x173)){const _0x151a91=await withSpinner(_0x3a8825(0x196),()=>_0x120511[_0x3a8825(0x10f)][_0x3a8825(0x126)](_0x8dec7c[_0x3a8825(0x13d)]),{'verbose':_0x333936['verbose']});await handleSingleObjectOutput(_0x151a91['data'],_0x333936);}else{if(_0x8dec7c['type']===_0x3a8825(0x12c)){if(!_0x8dec7c[_0x3a8825(0x168)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x3a8825(0x12b));const _0x3283d0=await withSpinner(_0x3a8825(0x155),()=>_0x120511[_0x3a8825(0x10f)][_0x3a8825(0x182)](_0x8dec7c['folderId']),{'verbose':_0x333936[_0x3a8825(0x187)]});await handleSingleObjectOutput(_0x3283d0[_0x3a8825(0x19b)],_0x333936);}else{if(_0x8dec7c['type']===_0x3a8825(0x10f)){if(!_0x8dec7c[_0x3a8825(0x14e)])throw new SDKError(ErrorCode[_0x3a8825(0x11d)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1236f0=await withSpinner(_0x3a8825(0x15c),()=>_0x120511[_0x3a8825(0x10f)][_0x3a8825(0x157)](_0x8dec7c[_0x3a8825(0x13d)],_0x8dec7c[_0x3a8825(0x14e)]),{'verbose':_0x333936['verbose']});await handleSingleObjectOutput(_0x1236f0[_0x3a8825(0x19b)],_0x333936);}}}return 0x0;}catch(_0x39ffdd){if(_0x39ffdd instanceof SDKError)return console[_0x3a8825(0x106)]('Error:\x20'+_0x39ffdd[_0x3a8825(0x169)]),_0x39ffdd['cause']&&console[_0x3a8825(0x106)](_0x3a8825(0x11c)+_0x39ffdd[_0x3a8825(0x14a)]),0x1;throw _0x39ffdd;}}}export class SegmentShowCommand extends BaseCommand{['name']=a37_0x24a788(0x117);[a37_0x24a788(0x140)]=a37_0x24a788(0x16f);async[a37_0x24a788(0x1a9)](_0x421819){const _0x461aff=a37_0x24a788,{options:_0x18490d,args:_0x52fb61,tdx:_0x74dd8e}=_0x421819,_0x1d8a47=_0x52fb61[0x0];if(!_0x1d8a47)return console[_0x461aff(0x106)](_0x461aff(0x1ac)),console[_0x461aff(0x106)](_0x461aff(0x129)),console[_0x461aff(0x106)](_0x461aff(0x15e)),console['error'](_0x461aff(0x118)),console['error'](_0x461aff(0x1a3)),console['error'](_0x461aff(0x1a8)),0x1;try{const _0x5a7127=_0x18490d['parentSegment'],_0x265041=await resolveSegmentTarget(_0x1d8a47,_0x5a7127,_0x18490d['verbose']);_0x18490d[_0x461aff(0x187)]&&console['error'](_0x461aff(0x147)+_0x265041);const _0x29f5ed=await withSpinner(_0x461aff(0x146)+_0x1d8a47+_0x461aff(0x167),()=>_0x74dd8e['segment'][_0x461aff(0x174)](_0x265041),{'verbose':_0x18490d[_0x461aff(0x187)]}),_0x46fa41=_0x29f5ed['data'];_0x18490d[_0x461aff(0x187)]&&(console[_0x461aff(0x106)](_0x461aff(0x179)+_0x46fa41[_0x461aff(0x125)]),console[_0x461aff(0x106)](_0x461aff(0x12e)+_0x46fa41['parentId']));if(_0x46fa41[_0x461aff(0x125)]==='folder')return console[_0x461aff(0x106)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console['error'](_0x461aff(0x185)),0x1;if(_0x46fa41[_0x461aff(0x125)]==='parent')return console['error']('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x461aff(0x106)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x46fa41[_0x461aff(0x14e)])throw new SDKError(ErrorCode[_0x461aff(0x11d)],_0x461aff(0x199));const _0x50ebc5=await withSpinner(_0x461aff(0x175),()=>_0x74dd8e[_0x461aff(0x10f)][_0x461aff(0x144)](_0x46fa41['parentId'],_0x46fa41[_0x461aff(0x14e)]),{'verbose':_0x18490d[_0x461aff(0x187)]});let _0x2c63d6=_0x50ebc5[_0x461aff(0x19b)];const _0x4b59c1=resolveLimit(_0x18490d['limit'],DEFAULT_DISPLAY_LIMIT),_0x3b85e4=/\bLIMIT\s+\d+/i[_0x461aff(0x181)](_0x2c63d6);!_0x3b85e4&&(_0x2c63d6=_0x2c63d6[_0x461aff(0x18a)]()['replace'](/;+$/,''),_0x2c63d6=_0x461aff(0x1a7)+_0x2c63d6+_0x461aff(0x1a1)+_0x4b59c1);_0x18490d['verbose']&&console[_0x461aff(0x106)](_0x461aff(0x154)+_0x2c63d6);const _0x1d420c=await withProgressSpinner(_0x461aff(0x148),async _0x48bf13=>{const _0x5443ad=_0x461aff,_0xaf74b5=await _0x74dd8e[_0x5443ad(0x1ab)]['execute'](_0x2c63d6,{'catalog':'td','schema':_0x5443ad(0x15f),'onJobId':_0x575ef4=>{const _0x3b102a=_0x5443ad;_0x48bf13[_0x3b102a(0x158)](_0x575ef4);}});return _0xaf74b5;},{'verbose':_0x18490d[_0x461aff(0x187)]}),_0x105cc8=_0x1d420c[_0x461aff(0x19b)],_0x30677a=_0x105cc8[_0x461aff(0x163)]?'\x20[Job\x20ID:\x20'+_0x105cc8[_0x461aff(0x163)]+']':'';return console['error'](_0x461aff(0x176)+_0x105cc8[_0x461aff(0x19a)][_0x461aff(0x11e)][_0x461aff(0x17c)]()+_0x461aff(0x13b)+(_0x461aff(0x186)+formatElapsed(_0x105cc8[_0x461aff(0x19a)][_0x461aff(0x18b)])+_0x30677a)),await handleQueryOutput(_0x105cc8,_0x18490d),0x0;}catch(_0x4387f9){if(_0x4387f9 instanceof SDKError)return console[_0x461aff(0x106)]('✖\x20Query\x20failed\x20['+_0x4387f9[_0x461aff(0x19d)]+']'),console['error']('\x0a'+_0x4387f9[_0x461aff(0x169)]),0x1;throw _0x4387f9;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x24a788(0x189)]='segment:folder:list';['description']='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a37_0x24a788(0x1a9)](_0x4c6014){const _0x1024c0=a37_0x24a788,{options:_0x7a90f9,args:_0x11f731,tdx:_0x587618}=_0x4c6014;if(_0x11f731[_0x1024c0(0x107)]===0x0)return console[_0x1024c0(0x106)](_0x1024c0(0x131)),console['error'](_0x1024c0(0x136)),0x1;const _0x24efd4=_0x11f731[0x0];try{_0x7a90f9[_0x1024c0(0x187)]&&(console['error'](_0x1024c0(0x128)+_0x7a90f9['site']),console['error'](_0x1024c0(0x12a)+_0x24efd4));const _0x4ab083=await withSpinner(_0x1024c0(0x1a2)+_0x24efd4+'\x27...',()=>_0x587618[_0x1024c0(0x10f)][_0x1024c0(0x13a)](_0x24efd4),{'verbose':_0x7a90f9['verbose']}),_0x22baa0=_0x4ab083[_0x1024c0(0x19b)];_0x7a90f9[_0x1024c0(0x187)]&&console[_0x1024c0(0x106)](_0x1024c0(0x13f)+_0x22baa0);const _0x46ad17=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x24efd4+_0x1024c0(0x167),()=>_0x587618[_0x1024c0(0x10f)]['listFolders'](_0x22baa0),{'verbose':_0x7a90f9[_0x1024c0(0x187)]}),_0x5410a1=_0x46ad17[_0x1024c0(0x19b)];return console[_0x1024c0(0x106)](_0x1024c0(0x11b)+_0x5410a1['length']+_0x1024c0(0x16c)+(_0x5410a1['length']!==0x1?'s':'')),await handleSDKOutput(_0x5410a1,_0x7a90f9),0x0;}catch(_0x425547){if(_0x425547 instanceof SDKError)return console['error'](_0x1024c0(0x17a)+_0x425547[_0x1024c0(0x169)]),_0x425547[_0x1024c0(0x14a)]&&console['error'](_0x1024c0(0x11c)+_0x425547[_0x1024c0(0x14a)]),0x1;throw _0x425547;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a37_0x24a788(0x191);[a37_0x24a788(0x140)]=a37_0x24a788(0x197);async[a37_0x24a788(0x1a9)](_0x1bb7ad){const _0x2a148a=a37_0x24a788,{options:_0x21c709,args:_0x21434a,tdx:_0x312d05}=_0x1bb7ad;if(_0x21434a[_0x2a148a(0x107)]===0x0)return console[_0x2a148a(0x106)](_0x2a148a(0x1a6)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x17b866,childId:_0x6e36ac}=parseSegmentRef(_0x21434a[0x0]);_0x21c709['verbose']&&(console[_0x2a148a(0x106)](_0x2a148a(0x128)+_0x21c709['site']),console['error'](_0x2a148a(0x12a)+_0x17b866),_0x6e36ac&&console[_0x2a148a(0x106)](_0x2a148a(0x13c)+_0x6e36ac));if(!_0x6e36ac)return console[_0x2a148a(0x106)]('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x2421b3=await withSpinner(_0x2a148a(0x1a2)+_0x17b866+'\x27...',()=>_0x312d05[_0x2a148a(0x10f)][_0x2a148a(0x13a)](_0x17b866),{'verbose':_0x21c709[_0x2a148a(0x187)]}),_0x3ee475=_0x2421b3[_0x2a148a(0x19b)];_0x21c709['verbose']&&console['error'](_0x2a148a(0x13f)+_0x3ee475);const _0x3a0182=await withSpinner(_0x2a148a(0x161)+_0x6e36ac+_0x2a148a(0x167),()=>_0x312d05[_0x2a148a(0x10f)][_0x2a148a(0x122)](_0x3ee475,_0x6e36ac),{'verbose':_0x21c709[_0x2a148a(0x187)]}),_0x4e9c37=_0x3a0182[_0x2a148a(0x19b)];_0x21c709[_0x2a148a(0x187)]&&console['error'](_0x2a148a(0x193)+_0x4e9c37);const _0x5e6b99=await withSpinner(_0x2a148a(0x17e)+_0x6e36ac+_0x2a148a(0x167),()=>_0x312d05[_0x2a148a(0x10f)]['getFolder'](_0x4e9c37),{'verbose':_0x21c709['verbose']});return await handleSDKOutput([_0x5e6b99[_0x2a148a(0x19b)]],_0x21c709),0x0;}catch(_0x11f9e4){if(_0x11f9e4 instanceof SDKError)return console[_0x2a148a(0x106)](_0x2a148a(0x17a)+_0x11f9e4[_0x2a148a(0x169)]),_0x11f9e4['cause']&&console[_0x2a148a(0x106)](_0x2a148a(0x11c)+_0x11f9e4[_0x2a148a(0x14a)]),0x1;throw _0x11f9e4;}}}export class SegmentSQLCommand extends BaseCommand{['name']='segment:sql';['description']=a37_0x24a788(0x123);async[a37_0x24a788(0x1a9)](_0x3625a5){const _0x13030c=a37_0x24a788,{options:_0x255252,args:_0x312b16}=_0x3625a5,_0x331cc0=_0x255252,_0x1a838=_0x331cc0[_0x13030c(0x10c)],_0x2872db=_0x312b16[0x0];if(!_0x2872db&&!_0x1a838)return console[_0x13030c(0x106)](a37_0xc3947b[_0x13030c(0x11a)](_0x13030c(0x135))),console[_0x13030c(0x106)]('Usage:'),console['error'](_0x13030c(0x177)),console['error'](_0x13030c(0x16d)),console[_0x13030c(0x106)]('Examples:'),console['error']('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x13030c(0x106)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml'),0x1;if(_0x2872db&&_0x1a838)return console[_0x13030c(0x106)](a37_0xc3947b[_0x13030c(0x11a)](_0x13030c(0x139))),0x1;try{let _0x50fbf3;if(_0x1a838)_0x50fbf3=await this[_0x13030c(0x172)](_0x1a838,_0x3625a5);else{if(isYamlFilePath(_0x2872db))return console['error'](a37_0xc3947b[_0x13030c(0x11a)](_0x13030c(0x14f))),console['error'](_0x13030c(0x17d)+_0x2872db),0x1;else _0x50fbf3=await this[_0x13030c(0x1aa)](_0x2872db,_0x3625a5);}return _0x255252[_0x13030c(0x138)]===_0x13030c(0x183)||_0x255252[_0x13030c(0x138)]===_0x13030c(0x143)?await handleSDKOutput([{'sql':_0x50fbf3}],_0x255252):console['log'](_0x50fbf3),0x0;}catch(_0x26bc5a){if(_0x26bc5a instanceof SDKError)return console[_0x13030c(0x106)](_0x13030c(0x17a)+_0x26bc5a[_0x13030c(0x169)]),_0x26bc5a[_0x13030c(0x14a)]&&console[_0x13030c(0x106)](_0x13030c(0x11c)+_0x26bc5a[_0x13030c(0x14a)]),0x1;throw _0x26bc5a;}}async[a37_0x24a788(0x172)](_0x2fe2d6,_0x4f2683){const _0x1fdc21=a37_0x24a788,{options:_0x56579c,tdx:_0x35a7d3}=_0x4f2683;let _0x5ece15;try{_0x5ece15=await resolveYamlFilePath(_0x2fe2d6);}catch(_0x1373ca){throw new SDKError(ErrorCode[_0x1fdc21(0x10b)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x1373ca[_0x1fdc21(0x169)]);}_0x56579c['verbose']&&console['error']('Resolved:\x20'+_0x5ece15[_0x1fdc21(0x190)]+'/'+_0x5ece15[_0x1fdc21(0x116)]);const _0x22d9b5=await withSpinner(_0x1fdc21(0x180),()=>_0x35a7d3[_0x1fdc21(0x10f)][_0x1fdc21(0x166)](_0x5ece15['content'],_0x5ece15['parentSegment'],_0x5ece15[_0x1fdc21(0x116)]),{'verbose':_0x56579c[_0x1fdc21(0x187)]});return _0x22d9b5[_0x1fdc21(0x19b)];}async[a37_0x24a788(0x1aa)](_0x568e19,_0x1789ce){const _0xacc634=a37_0x24a788,{options:_0x22a8de,tdx:_0x4b5ca2}=_0x1789ce,_0x5a4761=_0x22a8de[_0xacc634(0x190)],_0x33bca8=await resolveSegmentTarget(_0x568e19,_0x5a4761,_0x22a8de['verbose']);_0x22a8de[_0xacc634(0x187)]&&console[_0xacc634(0x106)](_0xacc634(0x147)+_0x33bca8);const _0x248f7e=await withSpinner(_0xacc634(0x146)+_0x568e19+_0xacc634(0x167),()=>_0x4b5ca2[_0xacc634(0x10f)][_0xacc634(0x174)](_0x33bca8),{'verbose':_0x22a8de[_0xacc634(0x187)]}),_0xeafdb2=_0x248f7e[_0xacc634(0x19b)];_0x22a8de[_0xacc634(0x187)]&&(console[_0xacc634(0x106)](_0xacc634(0x179)+_0xeafdb2['type']),console[_0xacc634(0x106)](_0xacc634(0x12e)+_0xeafdb2[_0xacc634(0x13d)]));if(_0xeafdb2[_0xacc634(0x125)]===_0xacc634(0x12c))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0xacc634(0x18e));if(_0xeafdb2[_0xacc634(0x125)]===_0xacc634(0x173))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql');if(!_0xeafdb2[_0xacc634(0x14e)])throw new SDKError(ErrorCode[_0xacc634(0x11d)],_0xacc634(0x199));const _0x298afc=await withSpinner(_0xacc634(0x175),()=>_0x4b5ca2['segment'][_0xacc634(0x144)](_0xeafdb2[_0xacc634(0x13d)],_0xeafdb2[_0xacc634(0x14e)]),{'verbose':_0x22a8de[_0xacc634(0x187)]});return _0x298afc[_0xacc634(0x19b)];}}function a37_0x126a(){const _0x5a53bb=['Use:\x20tdx\x20ps\x20desc','segment','Resolving\x20parent\x20folder\x20\x27','Resolved\x20parent\x20folder\x20ID:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','url','26vouIyl','segmentName','segment:show','Examples:','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','red','✔\x20Found\x20','\x20\x20Cause:\x20','SEGMENT_NOT_FOUND','processedRows','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','42972gqQUcL','Resolved\x20YAML\x20file:\x20','resolveFolderId','Get\x20SQL\x20query\x20for\x20child\x20segment','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','type','getParent','Use:\x20tdx\x20ps\x20view','Site:\x20','Usage:\x20tdx\x20sg\x20show\x20<name>','Parent\x20name:\x20','Folder\x20ID\x20missing\x20from\x20resolved\x20path','folder','\x20Opening\x20','Parent\x20ID:\x20','parentFolder','192Jnpcof','Error:\x20Parent\x20segment\x20name\x20is\x20required','Create\x20segment\x20folder\x20for\x20organization','50birNDS','Resolving\x20path\x20\x27','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','2HxGveN','format','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','resolveParentId','\x20rows\x20','Folder\x20name:\x20','parentId','\x27\x20with\x20ID:\x20','Resolved\x20parent\x20ID:\x20','description','\x20\x20Folder\x20path:\x20','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','jsonl','getSegmentSQL','268947DBAkUF','Resolving\x20\x27','Target\x20path:\x20','Executing\x20segment\x20query...','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','cause','SEGMENT_FOLDER_NOT_FOUND','segment:desc','Resolved\x20relative\x20path\x20to:\x20','segmentId','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','(root)','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','segment:view','/e/','SQL\x20query:\x0a','Fetching\x20folder\x20details...','/app/ps/','getSegment','setJobId','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Fetching\x20segment\x20details...','Use:\x20tdx\x20ps\x20view\x20-w','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','information_schema','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Resolving\x20folder\x20\x27','11024178RYPurP','jobId','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','segment:describe','getSegmentSQLFromYaml','\x27...','folderId','message','fullPath','site','\x20folder','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','Show\x20child\x20segment\x20schema\x20(column\x20types)','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','52990bqjrVU','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','getSQLFromYamlFile','parent','resolvePathToResource','Fetching\x20SQL\x20for\x20segment...','✔\x20Query\x20completed:\x20Processed\x20','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','\x20\x20Parent\x20segment:\x20','Resolved\x20type:\x20','Error:\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','toLocaleString','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Fetching\x20folder\x20\x27','✔\x20Created\x20folder\x20\x27','Fetching\x20SQL\x20from\x20rule...','test','getFolder','json','Folder\x20ID:\x20','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','in\x20','verbose','Segment\x20ID:\x20','name','trim','elapsedTimeMillis','\x20\x20Segment\x20name:\x20','264gkuwuN','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','272XKMNdD','parentSegment','segment:folder:show','470358xvGZtz','Resolved\x20folder\x20ID:\x20','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','folderPath','Fetching\x20parent\x20segment\x20details...','Show\x20segment\x20folder\x20details','segment:folder:create','Segment\x20ID\x20missing\x20from\x20resolved\x20path','stats','data','6032892TIgshW','code','Options:','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','segmentPath','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Resolving\x20parent\x20segment\x20\x27','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Error:\x20Path\x20or\x20name\x20is\x20required','981091GXDTQl','Error:\x20Folder\x20reference\x20is\x20required','SELECT\x20*\x20FROM\x20(\x0a','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','execute','getSQLFromServerSegment','query','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Usage:\x20tdx\x20sg\x20desc\x20<name>','error','length','Usage:\x20tdx\x20segment\x20describe\x20<path>','createFolder','web','INVALID_ARGUMENT','path','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'];a37_0x126a=function(){return _0x5a53bb;};return a37_0x126a();}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x24a788(0x189)]=a37_0x24a788(0x198);[a37_0x24a788(0x140)]=a37_0x24a788(0x132);async[a37_0x24a788(0x1a9)](_0x529413){const _0x4236ba=a37_0x24a788,{options:_0x4bcc6a,args:_0x3f5670,tdx:_0x3c55d0}=_0x529413,_0xd99c44=_0x4bcc6a;if(_0x3f5670[_0x4236ba(0x107)]<0x2)return console[_0x4236ba(0x106)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console[_0x4236ba(0x106)](_0x4236ba(0x160)),0x1;const _0x4a7c2f=_0x3f5670[0x0],_0x55de17=_0x3f5670[0x1];_0xd99c44[_0x4236ba(0x187)]&&(console[_0x4236ba(0x106)](_0x4236ba(0x128)+_0xd99c44[_0x4236ba(0x16b)]),console[_0x4236ba(0x106)]('Parent\x20segment:\x20'+_0x4a7c2f),console[_0x4236ba(0x106)](_0x4236ba(0x13c)+_0x55de17));let _0x528caf;if(_0xd99c44[_0x4236ba(0x12f)]){const _0x25b5d6=_0xd99c44[_0x4236ba(0x12f)],_0xf8e93a=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x4a7c2f+'\x27...',()=>_0x3c55d0[_0x4236ba(0x10f)][_0x4236ba(0x13a)](_0x4a7c2f),{'verbose':_0xd99c44[_0x4236ba(0x187)]}),_0x9d29f9=_0xf8e93a[_0x4236ba(0x19b)],_0x20f4d5=await withSpinner(_0x4236ba(0x110)+_0x25b5d6+_0x4236ba(0x167),()=>_0x3c55d0[_0x4236ba(0x10f)][_0x4236ba(0x122)](_0x9d29f9,_0x25b5d6),{'verbose':_0xd99c44[_0x4236ba(0x187)]});_0x528caf=_0x20f4d5['data'],_0xd99c44[_0x4236ba(0x187)]&&console['error'](_0x4236ba(0x111)+_0x528caf);}const _0x497431={'name':_0x55de17,'description':_0xd99c44['description'],'parentFolderId':_0x528caf},_0x2d5e77=await withSpinner('Creating\x20folder\x20\x27'+_0x55de17+_0x4236ba(0x167),()=>_0x3c55d0['segment'][_0x4236ba(0x109)](_0x4a7c2f,_0x497431),{'verbose':_0xd99c44[_0x4236ba(0x187)]}),_0x48d61d=_0x2d5e77[_0x4236ba(0x19b)];return console[_0x4236ba(0x106)](_0x4236ba(0x17f)+_0x48d61d['name']+_0x4236ba(0x13e)+_0x48d61d['id']),await handleSDKOutput([_0x48d61d],_0xd99c44),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x24a788(0x189)]=a37_0x24a788(0x152);['description']='Show\x20folder\x20or\x20child\x20segment\x20details';async['execute'](_0x29ab9c){const _0x554f29=a37_0x24a788,{options:_0xbe3f24,args:_0x31c39b,tdx:_0x254e8e}=_0x29ab9c,_0x55bd2a=_0x31c39b[0x0];if(!_0x55bd2a)return console[_0x554f29(0x106)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x554f29(0x106)]('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console[_0x554f29(0x106)](_0x554f29(0x151)),console[_0x554f29(0x106)](_0x554f29(0x19e)),console[_0x554f29(0x106)](_0x554f29(0x19f)),console[_0x554f29(0x106)](_0x554f29(0x118)),console[_0x554f29(0x106)](_0x554f29(0x112)),console['error'](_0x554f29(0x164)),console[_0x554f29(0x106)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console['error'](_0x554f29(0x113)),0x1;try{const _0x55add4=_0xbe3f24[_0x554f29(0x190)],_0x1b5a73=await resolveSegmentTarget(_0x55bd2a,_0x55add4,_0xbe3f24[_0x554f29(0x187)]);_0xbe3f24[_0x554f29(0x187)]&&console[_0x554f29(0x106)](_0x554f29(0x147)+_0x1b5a73);const _0x115d06=await withSpinner(_0x554f29(0x146)+_0x55bd2a+_0x554f29(0x167),()=>_0x254e8e[_0x554f29(0x10f)][_0x554f29(0x174)](_0x1b5a73),{'verbose':_0xbe3f24[_0x554f29(0x187)]}),_0xf5a058=_0x115d06[_0x554f29(0x19b)];_0xbe3f24[_0x554f29(0x187)]&&(console['error'](_0x554f29(0x179)+_0xf5a058[_0x554f29(0x125)]),console[_0x554f29(0x106)](_0x554f29(0x12e)+_0xf5a058[_0x554f29(0x13d)]),_0xf5a058[_0x554f29(0x168)]&&console['error'](_0x554f29(0x184)+_0xf5a058[_0x554f29(0x168)]),_0xf5a058['segmentId']&&console[_0x554f29(0x106)](_0x554f29(0x188)+_0xf5a058[_0x554f29(0x14e)]));if(_0xbe3f24[_0x554f29(0x10a)]){if(_0xf5a058[_0x554f29(0x125)]==='folder')return console[_0x554f29(0x106)](_0x554f29(0x142)),0x1;if(_0xf5a058[_0x554f29(0x125)]===_0x554f29(0x173))return console['error'](_0x554f29(0x17b)),console[_0x554f29(0x106)](_0x554f29(0x15d)),0x1;if(!_0xf5a058[_0x554f29(0x14e)])throw new SDKError(ErrorCode[_0x554f29(0x11d)],_0x554f29(0x199));const _0x2b9f7f=getConsoleNextUrl(_0xbe3f24[_0x554f29(0x16b)],'/app/ps/'+_0xf5a058[_0x554f29(0x13d)]+_0x554f29(0x153)+_0xf5a058[_0x554f29(0x14e)]);return console['error'](a37_0xc3947b['green']('✔')+_0x554f29(0x12d)+a37_0xc3947b['cyan'](_0x2b9f7f)),openBrowser(_0x2b9f7f),0x0;}if(_0xf5a058['type']==='folder'){if(!_0xf5a058['folderId'])throw new SDKError(ErrorCode[_0x554f29(0x14b)],_0x554f29(0x12b));const _0x3e63c8=await withSpinner(_0x554f29(0x155),()=>_0x254e8e[_0x554f29(0x10f)]['getFolder'](_0xf5a058[_0x554f29(0x168)]),{'verbose':_0xbe3f24[_0x554f29(0x187)]});await handleSingleObjectOutput(_0x3e63c8[_0x554f29(0x19b)],_0xbe3f24);}else{if(_0xf5a058[_0x554f29(0x125)]==='segment'){if(!_0xf5a058[_0x554f29(0x14e)])throw new SDKError(ErrorCode[_0x554f29(0x11d)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x3930af=await withSpinner(_0x554f29(0x15c),()=>_0x254e8e['segment'][_0x554f29(0x157)](_0xf5a058[_0x554f29(0x13d)],_0xf5a058[_0x554f29(0x14e)]),{'verbose':_0xbe3f24['verbose']}),_0x12f0df=getConsoleNextUrl(_0xbe3f24[_0x554f29(0x16b)],_0x554f29(0x156)+_0xf5a058[_0x554f29(0x13d)]+_0x554f29(0x153)+_0xf5a058[_0x554f29(0x14e)]),_0x9c51a5=_0x3930af[_0x554f29(0x19b)];_0x9c51a5[_0x554f29(0x114)]=_0x12f0df,await handleSingleObjectOutput(_0x9c51a5,_0xbe3f24);}else return console[_0x554f29(0x106)](_0x554f29(0x124)),console[_0x554f29(0x106)](_0x554f29(0x127)),0x1;}return 0x0;}catch(_0x4c23a6){if(_0x4c23a6 instanceof SDKError)return console[_0x554f29(0x106)](_0x554f29(0x17a)+_0x4c23a6[_0x554f29(0x169)]),_0x4c23a6[_0x554f29(0x14a)]&&console[_0x554f29(0x106)](_0x554f29(0x11c)+_0x4c23a6[_0x554f29(0x14a)]),0x1;throw _0x4c23a6;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x24a788(0x189)]=a37_0x24a788(0x14c);['description']=a37_0x24a788(0x16e);async[a37_0x24a788(0x1a9)](_0x2d7fde){const _0x20710e=a37_0x24a788,{options:_0x5f3d4e,args:_0x388368,tdx:_0x501b6b}=_0x2d7fde,_0x45b216=_0x388368[0x0];if(!_0x45b216)return console[_0x20710e(0x106)](_0x20710e(0x1ac)),console['error'](_0x20710e(0x105)),console[_0x20710e(0x106)](_0x20710e(0x171)),console[_0x20710e(0x106)]('Examples:'),console['error'](_0x20710e(0x149)),console[_0x20710e(0x106)](_0x20710e(0x194)),0x1;try{const _0x33769=_0x5f3d4e['parentSegment'],_0x4d3c5c=await resolveSegmentTarget(_0x45b216,_0x33769,_0x5f3d4e[_0x20710e(0x187)]);_0x5f3d4e['verbose']&&console[_0x20710e(0x106)](_0x20710e(0x147)+_0x4d3c5c);const _0x2f5c98=await withSpinner('Resolving\x20\x27'+_0x45b216+_0x20710e(0x167),()=>_0x501b6b[_0x20710e(0x10f)][_0x20710e(0x174)](_0x4d3c5c),{'verbose':_0x5f3d4e[_0x20710e(0x187)]}),_0x1e3fb7=_0x2f5c98[_0x20710e(0x19b)];_0x5f3d4e[_0x20710e(0x187)]&&(console[_0x20710e(0x106)](_0x20710e(0x179)+_0x1e3fb7['type']),console[_0x20710e(0x106)]('Parent\x20ID:\x20'+_0x1e3fb7[_0x20710e(0x13d)]));if(_0x1e3fb7[_0x20710e(0x125)]==='folder')return console[_0x20710e(0x106)](_0x20710e(0x159)),console[_0x20710e(0x106)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x1e3fb7['type']===_0x20710e(0x173))return console[_0x20710e(0x106)](_0x20710e(0x10d)),console[_0x20710e(0x106)](_0x20710e(0x10e)),0x1;if(!_0x1e3fb7['segmentId'])throw new SDKError(ErrorCode[_0x20710e(0x11d)],_0x20710e(0x199));const _0x49014a=await withSpinner(_0x20710e(0x175),()=>_0x501b6b[_0x20710e(0x10f)][_0x20710e(0x144)](_0x1e3fb7['parentId'],_0x1e3fb7[_0x20710e(0x14e)]),{'verbose':_0x5f3d4e['verbose']}),_0x16f34d=_0x49014a['data'],_0xf21bc8=await executeSchemaQuery(_0x16f34d,_0x501b6b,_0x5f3d4e);return await handleQueryOutput(_0xf21bc8,_0x5f3d4e),0x0;}catch(_0x2bb9d2){if(_0x2bb9d2 instanceof SDKError)return console[_0x20710e(0x106)](_0x20710e(0x17a)+_0x2bb9d2[_0x20710e(0x169)]),_0x2bb9d2[_0x20710e(0x14a)]&&console[_0x20710e(0x106)]('\x20\x20Cause:\x20'+_0x2bb9d2[_0x20710e(0x14a)]),0x1;throw _0x2bb9d2;}}}
1
+ const a37_0x398bb6=a37_0x4582;(function(_0x422703,_0x3a8a03){const _0xa0a86a=a37_0x4582,_0x112817=_0x422703();while(!![]){try{const _0x5e38e7=parseInt(_0xa0a86a(0x180))/0x1+parseInt(_0xa0a86a(0x152))/0x2+-parseInt(_0xa0a86a(0x160))/0x3*(-parseInt(_0xa0a86a(0x1a3))/0x4)+-parseInt(_0xa0a86a(0x158))/0x5+-parseInt(_0xa0a86a(0x168))/0x6*(-parseInt(_0xa0a86a(0x1ca))/0x7)+-parseInt(_0xa0a86a(0x1d6))/0x8*(parseInt(_0xa0a86a(0x1d9))/0x9)+-parseInt(_0xa0a86a(0x165))/0xa*(parseInt(_0xa0a86a(0x172))/0xb);if(_0x5e38e7===_0x3a8a03)break;else _0x112817['push'](_0x112817['shift']());}catch(_0x4647e6){_0x112817['push'](_0x112817['shift']());}}}(a37_0x12bc,0xc267b));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';function a37_0x4582(_0x133519,_0x440e8c){_0x133519=_0x133519-0x148;const _0x12bcce=a37_0x12bc();let _0x458216=_0x12bcce[_0x133519];return _0x458216;}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_0x12bc(){const _0x2cdb5e=['SQL\x20query:\x0a','\x27\x20with\x20ID:\x20','42DwRjyc','Segment\x20ID:\x20','parentSegment','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','segment:describe','Folder\x20ID:\x20','getSegment','fullPath','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','Fetching\x20SQL\x20from\x20rule...','getFolder','segment','3895232AuVbek','/app/ps/','\x27...','18QYMRrl','verbose','Resolved\x20parent\x20ID:\x20','data','✔\x20Query\x20completed:\x20Processed\x20','information_schema','folderId','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','\x20\x20Cause:\x20','stats','Fetching\x20folder\x20details...','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','\x20\x20Full\x20path:\x20','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','Resolved\x20YAML\x20file:\x20','message','SEGMENT_NOT_FOUND','jobId','\x20folder','path','SELECT\x20*\x20FROM\x20(\x0a','Error:\x20Parent\x20segment\x20name\x20is\x20required','execute','Resolved\x20folder\x20ID:\x20','Create\x20segment\x20folder\x20for\x20organization','processedRows','segmentPath','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Show\x20child\x20segment\x20schema\x20(column\x20types)','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','2013292deFwTe','Resolving\x20folder\x20\x27','Examples:','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','parentFolder','Fetching\x20segment\x20details...','5564765djUDnn','Resolving\x20path\x20\x27','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Error:\x20','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Error:\x20Folder\x20reference\x20is\x20required','Use:\x20tdx\x20ps\x20show','segment:folder:create','834AnfGNb','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x20Opening\x20','\x20\x20tdx\x20sg\x20sql\x20--path\x20','format','143050dIjCnF','url','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','1570698ySwZvA','Options:','Usage:\x20tdx\x20sg\x20desc\x20<name>','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Executing\x20segment\x20query...','segment:show','resolveParentId','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','name','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','583ZvlHPy','folder','site','\x20\x20Folder\x20path:\x20','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','resolvePathToResource','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','segment:sql','Show\x20folder\x20or\x20child\x20segment\x20details','parent','INVALID_ARGUMENT','/e/','limit','getSegmentSQLFromYaml','339397WKAnjI','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','Site:\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Use:\x20tdx\x20ps\x20view\x20-w','query','segmentId','red','Resolving\x20\x27','includes','test','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Folder\x20ID\x20missing\x20from\x20resolved\x20path','getParent','✖\x20Query\x20failed\x20[','Parent\x20ID:\x20','web','toLocaleString','error','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','cause','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','segmentName','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Resolved\x20relative\x20path\x20to:\x20','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Resolved\x20type:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Folder\x20name:\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','parentId','segment:folder:list','\x20\x20Segment\x20name:\x20','type','10424fqlGoj','length','Fetching\x20SQL\x20for\x20segment...','Resolving\x20parent\x20segment\x20\x27','log','SEGMENT_FOLDER_NOT_FOUND','Resolved:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','description','getSQLFromYamlFile','getSegmentSQL','Target\x20path:\x20','Parent\x20name:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Parent\x20segment:\x20','✔\x20Found\x20','Fetching\x20parent\x20segment\x20details...','Usage:\x20tdx\x20sg\x20show\x20<name>','segment:view','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','trim','segment:desc','\x20[Job\x20ID:\x20','listFolders','Listing\x20folders\x20for\x20parent\x20\x27','jsonl','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','segment:folder:show','Creating\x20folder\x20\x27','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','code','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','setJobId','(root)'];a37_0x12bc=function(){return _0x2cdb5e;};return a37_0x12bc();}import{openBrowser}from'../utils/process.js';import a37_0x184753 from'chalk';async function resolveSegmentTarget(_0x1cf306,_0x425844,_0x318c2f){const _0x4015d8=a37_0x4582;if(isYamlFilePath(_0x1cf306))try{const _0x143f41=await resolveYamlFilePath(_0x1cf306);return _0x318c2f&&(console[_0x4015d8(0x192)](_0x4015d8(0x1e7)+_0x1cf306),console['error']('\x20\x20Parent\x20segment:\x20'+_0x143f41[_0x4015d8(0x1cc)]),console[_0x4015d8(0x192)](_0x4015d8(0x1a1)+_0x143f41[_0x4015d8(0x196)]),console[_0x4015d8(0x192)](_0x4015d8(0x175)+(_0x143f41['folderPath']||_0x4015d8(0x1c7))),console[_0x4015d8(0x192)](_0x4015d8(0x1e5)+_0x143f41[_0x4015d8(0x1d1)])),_0x143f41['fullPath'];}catch(_0x50ffdc){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x4015d8(0x1c5)+_0x50ffdc[_0x4015d8(0x1e8)]);}if(!_0x425844)throw new SDKError(ErrorCode[_0x4015d8(0x17c)],_0x4015d8(0x197));return _0x425844+'/'+_0x1cf306;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x398bb6(0x170)]=a37_0x398bb6(0x1ce);[a37_0x398bb6(0x1ab)]='Show\x20segment\x20or\x20folder\x20details';async[a37_0x398bb6(0x14a)](_0xfec8c4){const _0x5e09c0=a37_0x398bb6,{options:_0x57d8b7,args:_0x547b3b,tdx:_0x399297}=_0xfec8c4,_0x7bb6b3=_0x547b3b[0x0],_0x386be0=!_0x7bb6b3&&!!_0x57d8b7[_0x5e09c0(0x1cc)],_0x16014d=_0x7bb6b3||_0x57d8b7[_0x5e09c0(0x1cc)];if(!_0x16014d)return console[_0x5e09c0(0x192)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x5e09c0(0x192)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console['error'](_0x5e09c0(0x154)),console[_0x5e09c0(0x192)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console['error']('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console['error']('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console[_0x5e09c0(0x192)](_0x5e09c0(0x193)),0x1;try{const _0x1d38a2=_0x57d8b7[_0x5e09c0(0x14e)];let _0x49efa7=_0x16014d;!_0x386be0&&_0x1d38a2&&!_0x16014d[_0x5e09c0(0x189)]('/')&&(_0x49efa7=_0x1d38a2+'/'+_0x16014d,_0x57d8b7[_0x5e09c0(0x1da)]&&console[_0x5e09c0(0x192)](_0x5e09c0(0x198)+_0x49efa7));const _0xd4ca6b=await withSpinner(_0x5e09c0(0x159)+_0x49efa7+_0x5e09c0(0x1d8),()=>_0x399297['segment'][_0x5e09c0(0x177)](_0x49efa7),{'verbose':_0x57d8b7['verbose']}),_0x3f65cc=_0xd4ca6b['data'];_0x57d8b7['verbose']&&(console['error'](_0x5e09c0(0x19b)+_0x3f65cc[_0x5e09c0(0x1a2)]),console[_0x5e09c0(0x192)](_0x5e09c0(0x18f)+_0x3f65cc['parentId']),_0x3f65cc[_0x5e09c0(0x1df)]&&console[_0x5e09c0(0x192)]('Folder\x20ID:\x20'+_0x3f65cc['folderId']),_0x3f65cc[_0x5e09c0(0x186)]&&console['error'](_0x5e09c0(0x1cb)+_0x3f65cc[_0x5e09c0(0x186)]));if(_0x3f65cc[_0x5e09c0(0x1a2)]==='parent'){const _0x504802=await withSpinner(_0x5e09c0(0x1b3),()=>_0x399297[_0x5e09c0(0x1d5)][_0x5e09c0(0x18d)](_0x3f65cc[_0x5e09c0(0x19f)]),{'verbose':_0x57d8b7[_0x5e09c0(0x1da)]});await handleSingleObjectOutput(_0x504802['data'],_0x57d8b7);}else{if(_0x3f65cc[_0x5e09c0(0x1a2)]===_0x5e09c0(0x173)){if(!_0x3f65cc['folderId'])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x5e09c0(0x18c));const _0x534ce5=await withSpinner(_0x5e09c0(0x1e3),()=>_0x399297['segment'][_0x5e09c0(0x1d4)](_0x3f65cc[_0x5e09c0(0x1df)]),{'verbose':_0x57d8b7[_0x5e09c0(0x1da)]});await handleSingleObjectOutput(_0x534ce5['data'],_0x57d8b7);}else{if(_0x3f65cc[_0x5e09c0(0x1a2)]===_0x5e09c0(0x1d5)){if(!_0x3f65cc[_0x5e09c0(0x186)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x5e09c0(0x19e));const _0x3a94bb=await withSpinner(_0x5e09c0(0x157),()=>_0x399297[_0x5e09c0(0x1d5)]['getSegment'](_0x3f65cc[_0x5e09c0(0x19f)],_0x3f65cc[_0x5e09c0(0x186)]),{'verbose':_0x57d8b7[_0x5e09c0(0x1da)]});await handleSingleObjectOutput(_0x3a94bb['data'],_0x57d8b7);}}}return 0x0;}catch(_0x32d2ba){if(_0x32d2ba instanceof SDKError)return console[_0x5e09c0(0x192)]('Error:\x20'+_0x32d2ba['message']),_0x32d2ba['cause']&&console['error'](_0x5e09c0(0x1e1)+_0x32d2ba[_0x5e09c0(0x194)]),0x1;throw _0x32d2ba;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x398bb6(0x170)]=a37_0x398bb6(0x16d);[a37_0x398bb6(0x1ab)]=a37_0x398bb6(0x161);async['execute'](_0x460e83){const _0x5a5c72=a37_0x398bb6,{options:_0x2dbd51,args:_0x59ff3e,tdx:_0x4b7d5a}=_0x460e83,_0x1043b0=_0x59ff3e[0x0];if(!_0x1043b0)return console[_0x5a5c72(0x192)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x5a5c72(0x192)](_0x5a5c72(0x1b4)),console['error'](_0x5a5c72(0x1aa)),console[_0x5a5c72(0x192)](_0x5a5c72(0x154)),console[_0x5a5c72(0x192)](_0x5a5c72(0x199)),console[_0x5a5c72(0x192)](_0x5a5c72(0x15c)),0x1;try{const _0x47ac29=_0x2dbd51[_0x5a5c72(0x1cc)],_0x237ac2=await resolveSegmentTarget(_0x1043b0,_0x47ac29,_0x2dbd51[_0x5a5c72(0x1da)]);_0x2dbd51['verbose']&&console['error'](_0x5a5c72(0x1ae)+_0x237ac2);const _0x3b9a3c=await withSpinner('Resolving\x20\x27'+_0x1043b0+_0x5a5c72(0x1d8),()=>_0x4b7d5a['segment']['resolvePathToResource'](_0x237ac2),{'verbose':_0x2dbd51[_0x5a5c72(0x1da)]}),_0x4cd0e7=_0x3b9a3c[_0x5a5c72(0x1dc)];_0x2dbd51[_0x5a5c72(0x1da)]&&(console[_0x5a5c72(0x192)](_0x5a5c72(0x19b)+_0x4cd0e7[_0x5a5c72(0x1a2)]),console[_0x5a5c72(0x192)](_0x5a5c72(0x18f)+_0x4cd0e7[_0x5a5c72(0x19f)]));if(_0x4cd0e7['type']===_0x5a5c72(0x173))return console[_0x5a5c72(0x192)](_0x5a5c72(0x1b6)),console[_0x5a5c72(0x192)](_0x5a5c72(0x176)),0x1;if(_0x4cd0e7[_0x5a5c72(0x1a2)]===_0x5a5c72(0x17b))return console[_0x5a5c72(0x192)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x5a5c72(0x192)](_0x5a5c72(0x15e)),0x1;if(!_0x4cd0e7[_0x5a5c72(0x186)])throw new SDKError(ErrorCode[_0x5a5c72(0x1e9)],_0x5a5c72(0x19e));const _0x4b62dd=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x4b7d5a[_0x5a5c72(0x1d5)][_0x5a5c72(0x1ad)](_0x4cd0e7[_0x5a5c72(0x19f)],_0x4cd0e7[_0x5a5c72(0x186)]),{'verbose':_0x2dbd51[_0x5a5c72(0x1da)]});let _0x3e47fe=_0x4b62dd[_0x5a5c72(0x1dc)];const _0x1d0b15=resolveLimit(_0x2dbd51[_0x5a5c72(0x17e)],DEFAULT_DISPLAY_LIMIT),_0x515d00=/\bLIMIT\s+\d+/i[_0x5a5c72(0x18a)](_0x3e47fe);!_0x515d00&&(_0x3e47fe=_0x3e47fe[_0x5a5c72(0x1b7)]()['replace'](/;+$/,''),_0x3e47fe=_0x5a5c72(0x148)+_0x3e47fe+_0x5a5c72(0x1bd)+_0x1d0b15);_0x2dbd51[_0x5a5c72(0x1da)]&&console[_0x5a5c72(0x192)](_0x5a5c72(0x1c8)+_0x3e47fe);const _0x53630b=await withProgressSpinner(_0x5a5c72(0x16c),async _0x38ed12=>{const _0x3d27d9=_0x5a5c72,_0x5ea4f7=await _0x4b7d5a[_0x3d27d9(0x185)][_0x3d27d9(0x14a)](_0x3e47fe,{'catalog':'td','schema':_0x3d27d9(0x1de),'onJobId':_0x23654d=>{const _0x40b967=_0x3d27d9;_0x38ed12[_0x40b967(0x1c6)](_0x23654d);}});return _0x5ea4f7;},{'verbose':_0x2dbd51[_0x5a5c72(0x1da)]}),_0x138411=_0x53630b['data'],_0x3e11d9=_0x138411[_0x5a5c72(0x1ea)]?_0x5a5c72(0x1b9)+_0x138411['jobId']+']':'';return console[_0x5a5c72(0x192)](_0x5a5c72(0x1dd)+_0x138411[_0x5a5c72(0x1e2)][_0x5a5c72(0x14d)][_0x5a5c72(0x191)]()+'\x20rows\x20'+('in\x20'+formatElapsed(_0x138411[_0x5a5c72(0x1e2)]['elapsedTimeMillis'])+_0x3e11d9)),await handleQueryOutput(_0x138411,_0x2dbd51),0x0;}catch(_0x20aed3){if(_0x20aed3 instanceof SDKError)return console[_0x5a5c72(0x192)](_0x5a5c72(0x18e)+_0x20aed3[_0x5a5c72(0x1c2)]+']'),console[_0x5a5c72(0x192)]('\x0a'+_0x20aed3[_0x5a5c72(0x1e8)]),0x1;throw _0x20aed3;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x398bb6(0x170)]=a37_0x398bb6(0x1a0);[a37_0x398bb6(0x1ab)]=a37_0x398bb6(0x1c4);async[a37_0x398bb6(0x14a)](_0x54e069){const _0xf7d3c8=a37_0x398bb6,{options:_0x784d9d,args:_0x3d05b9,tdx:_0x4fd86d}=_0x54e069;if(_0x3d05b9['length']===0x0)return console[_0xf7d3c8(0x192)](_0xf7d3c8(0x149)),console[_0xf7d3c8(0x192)](_0xf7d3c8(0x14f)),0x1;const _0x216624=_0x3d05b9[0x0];try{_0x784d9d[_0xf7d3c8(0x1da)]&&(console[_0xf7d3c8(0x192)](_0xf7d3c8(0x182)+_0x784d9d['site']),console['error'](_0xf7d3c8(0x1af)+_0x216624));const _0x72f8fb=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x216624+_0xf7d3c8(0x1d8),()=>_0x4fd86d['segment'][_0xf7d3c8(0x16e)](_0x216624),{'verbose':_0x784d9d[_0xf7d3c8(0x1da)]}),_0x3a9665=_0x72f8fb[_0xf7d3c8(0x1dc)];_0x784d9d[_0xf7d3c8(0x1da)]&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x3a9665);const _0x10022a=await withSpinner(_0xf7d3c8(0x1bb)+_0x216624+'\x27...',()=>_0x4fd86d[_0xf7d3c8(0x1d5)][_0xf7d3c8(0x1ba)](_0x3a9665),{'verbose':_0x784d9d[_0xf7d3c8(0x1da)]}),_0x30923e=_0x10022a['data'];return console['error'](_0xf7d3c8(0x1b2)+_0x30923e['length']+_0xf7d3c8(0x1eb)+(_0x30923e[_0xf7d3c8(0x1a4)]!==0x1?'s':'')),await handleSDKOutput(_0x30923e,_0x784d9d),0x0;}catch(_0x419bad){if(_0x419bad instanceof SDKError)return console[_0xf7d3c8(0x192)](_0xf7d3c8(0x15b)+_0x419bad[_0xf7d3c8(0x1e8)]),_0x419bad[_0xf7d3c8(0x194)]&&console[_0xf7d3c8(0x192)]('\x20\x20Cause:\x20'+_0x419bad[_0xf7d3c8(0x194)]),0x1;throw _0x419bad;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a37_0x398bb6(0x1be);[a37_0x398bb6(0x1ab)]='Show\x20segment\x20folder\x20details';async[a37_0x398bb6(0x14a)](_0x166c7a){const _0x4d97fd=a37_0x398bb6,{options:_0x51a8d9,args:_0x69efad,tdx:_0x338b26}=_0x166c7a;if(_0x69efad[_0x4d97fd(0x1a4)]===0x0)return console[_0x4d97fd(0x192)](_0x4d97fd(0x15d)),console[_0x4d97fd(0x192)](_0x4d97fd(0x16f)),0x1;try{const {parentId:_0x14ab8d,childId:_0x245ce3}=parseSegmentRef(_0x69efad[0x0]);_0x51a8d9[_0x4d97fd(0x1da)]&&(console['error']('Site:\x20'+_0x51a8d9[_0x4d97fd(0x174)]),console['error']('Parent\x20name:\x20'+_0x14ab8d),_0x245ce3&&console['error'](_0x4d97fd(0x19d)+_0x245ce3));if(!_0x245ce3)return console[_0x4d97fd(0x192)](_0x4d97fd(0x1c3)),0x1;const _0x1584cd=await withSpinner(_0x4d97fd(0x1a6)+_0x14ab8d+_0x4d97fd(0x1d8),()=>_0x338b26[_0x4d97fd(0x1d5)][_0x4d97fd(0x16e)](_0x14ab8d),{'verbose':_0x51a8d9[_0x4d97fd(0x1da)]}),_0x9610b=_0x1584cd['data'];_0x51a8d9['verbose']&&console['error'](_0x4d97fd(0x1db)+_0x9610b);const _0x4c9681=await withSpinner(_0x4d97fd(0x153)+_0x245ce3+_0x4d97fd(0x1d8),()=>_0x338b26[_0x4d97fd(0x1d5)]['resolveFolderId'](_0x9610b,_0x245ce3),{'verbose':_0x51a8d9[_0x4d97fd(0x1da)]}),_0x1ca970=_0x4c9681[_0x4d97fd(0x1dc)];_0x51a8d9[_0x4d97fd(0x1da)]&&console['error'](_0x4d97fd(0x14b)+_0x1ca970);const _0x43bd18=await withSpinner('Fetching\x20folder\x20\x27'+_0x245ce3+_0x4d97fd(0x1d8),()=>_0x338b26[_0x4d97fd(0x1d5)][_0x4d97fd(0x1d4)](_0x1ca970),{'verbose':_0x51a8d9[_0x4d97fd(0x1da)]});return await handleSDKOutput([_0x43bd18['data']],_0x51a8d9),0x0;}catch(_0x10956b){if(_0x10956b instanceof SDKError)return console[_0x4d97fd(0x192)](_0x4d97fd(0x15b)+_0x10956b[_0x4d97fd(0x1e8)]),_0x10956b[_0x4d97fd(0x194)]&&console[_0x4d97fd(0x192)]('\x20\x20Cause:\x20'+_0x10956b[_0x4d97fd(0x194)]),0x1;throw _0x10956b;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x398bb6(0x170)]=a37_0x398bb6(0x179);['description']='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a37_0x398bb6(0x14a)](_0x1f389c){const _0x27f79f=a37_0x398bb6,{options:_0x1fe281,args:_0x2ac653}=_0x1f389c,_0x179090=_0x1fe281,_0x3c6c33=_0x179090[_0x27f79f(0x1ec)],_0x359bf6=_0x2ac653[0x0];if(!_0x359bf6&&!_0x3c6c33)return console[_0x27f79f(0x192)](a37_0x184753[_0x27f79f(0x187)](_0x27f79f(0x181))),console[_0x27f79f(0x192)]('Usage:'),console[_0x27f79f(0x192)](_0x27f79f(0x1e6)),console[_0x27f79f(0x192)](_0x27f79f(0x151)),console[_0x27f79f(0x192)](_0x27f79f(0x154)),console[_0x27f79f(0x192)](_0x27f79f(0x1cd)),console[_0x27f79f(0x192)](_0x27f79f(0x18b)),0x1;if(_0x359bf6&&_0x3c6c33)return console[_0x27f79f(0x192)](a37_0x184753[_0x27f79f(0x187)](_0x27f79f(0x1e4))),0x1;try{let _0x569be4;if(_0x3c6c33)_0x569be4=await this[_0x27f79f(0x1ac)](_0x3c6c33,_0x1f389c);else{if(isYamlFilePath(_0x359bf6))return console[_0x27f79f(0x192)](a37_0x184753['red'](_0x27f79f(0x1d2))),console[_0x27f79f(0x192)](_0x27f79f(0x163)+_0x359bf6),0x1;else _0x569be4=await this['getSQLFromServerSegment'](_0x359bf6,_0x1f389c);}return _0x1fe281[_0x27f79f(0x164)]==='json'||_0x1fe281['format']===_0x27f79f(0x1bc)?await handleSDKOutput([{'sql':_0x569be4}],_0x1fe281):console[_0x27f79f(0x1a7)](_0x569be4),0x0;}catch(_0x5ec35d){if(_0x5ec35d instanceof SDKError)return console[_0x27f79f(0x192)]('Error:\x20'+_0x5ec35d['message']),_0x5ec35d[_0x27f79f(0x194)]&&console[_0x27f79f(0x192)](_0x27f79f(0x1e1)+_0x5ec35d[_0x27f79f(0x194)]),0x1;throw _0x5ec35d;}}async[a37_0x398bb6(0x1ac)](_0x1dd5fb,_0x51ff8c){const _0x5e577a=a37_0x398bb6,{options:_0x51dee4,tdx:_0x4390b2}=_0x51ff8c;let _0x36ce85;try{_0x36ce85=await resolveYamlFilePath(_0x1dd5fb);}catch(_0x557a35){throw new SDKError(ErrorCode[_0x5e577a(0x17c)],_0x5e577a(0x1c5)+_0x557a35[_0x5e577a(0x1e8)]);}_0x51dee4[_0x5e577a(0x1da)]&&console[_0x5e577a(0x192)](_0x5e577a(0x1a9)+_0x36ce85[_0x5e577a(0x1cc)]+'/'+_0x36ce85[_0x5e577a(0x196)]);const _0x4b30f2=await withSpinner(_0x5e577a(0x1d3),()=>_0x4390b2[_0x5e577a(0x1d5)][_0x5e577a(0x17f)](_0x36ce85['content'],_0x36ce85[_0x5e577a(0x1cc)],_0x36ce85['segmentName']),{'verbose':_0x51dee4[_0x5e577a(0x1da)]});return _0x4b30f2[_0x5e577a(0x1dc)];}async['getSQLFromServerSegment'](_0x139725,_0x5b25e8){const _0x5c43c2=a37_0x398bb6,{options:_0x442719,tdx:_0x10d81f}=_0x5b25e8,_0x718442=_0x442719[_0x5c43c2(0x1cc)],_0xff87dc=await resolveSegmentTarget(_0x139725,_0x718442,_0x442719[_0x5c43c2(0x1da)]);_0x442719[_0x5c43c2(0x1da)]&&console[_0x5c43c2(0x192)](_0x5c43c2(0x1ae)+_0xff87dc);const _0x6dc06f=await withSpinner(_0x5c43c2(0x188)+_0x139725+_0x5c43c2(0x1d8),()=>_0x10d81f[_0x5c43c2(0x1d5)]['resolvePathToResource'](_0xff87dc),{'verbose':_0x442719['verbose']}),_0x355881=_0x6dc06f[_0x5c43c2(0x1dc)];_0x442719[_0x5c43c2(0x1da)]&&(console[_0x5c43c2(0x192)]('Resolved\x20type:\x20'+_0x355881[_0x5c43c2(0x1a2)]),console[_0x5c43c2(0x192)]('Parent\x20ID:\x20'+_0x355881[_0x5c43c2(0x19f)]));if(_0x355881[_0x5c43c2(0x1a2)]===_0x5c43c2(0x173))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.');if(_0x355881[_0x5c43c2(0x1a2)]==='parent')throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql');if(!_0x355881['segmentId'])throw new SDKError(ErrorCode[_0x5c43c2(0x1e9)],_0x5c43c2(0x19e));const _0x3285a7=await withSpinner(_0x5c43c2(0x1a5),()=>_0x10d81f[_0x5c43c2(0x1d5)]['getSegmentSQL'](_0x355881['parentId'],_0x355881[_0x5c43c2(0x186)]),{'verbose':_0x442719[_0x5c43c2(0x1da)]});return _0x3285a7[_0x5c43c2(0x1dc)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x398bb6(0x170)]=a37_0x398bb6(0x15f);[a37_0x398bb6(0x1ab)]=a37_0x398bb6(0x14c);async[a37_0x398bb6(0x14a)](_0x43c664){const _0x404996=a37_0x398bb6,{options:_0xc0239f,args:_0x24310c,tdx:_0x57e28d}=_0x43c664,_0x3cd45c=_0xc0239f;if(_0x24310c[_0x404996(0x1a4)]<0x2)return console[_0x404996(0x192)](_0x404996(0x167)),console[_0x404996(0x192)](_0x404996(0x155)),0x1;const _0x269a98=_0x24310c[0x0],_0x32ffd4=_0x24310c[0x1];_0x3cd45c[_0x404996(0x1da)]&&(console[_0x404996(0x192)](_0x404996(0x182)+_0x3cd45c[_0x404996(0x174)]),console[_0x404996(0x192)](_0x404996(0x1b1)+_0x269a98),console[_0x404996(0x192)]('Folder\x20name:\x20'+_0x32ffd4));let _0x417d54;if(_0x3cd45c['parentFolder']){const _0xbc22ff=_0x3cd45c[_0x404996(0x156)],_0x478e23=await withSpinner(_0x404996(0x1a6)+_0x269a98+_0x404996(0x1d8),()=>_0x57e28d[_0x404996(0x1d5)]['resolveParentId'](_0x269a98),{'verbose':_0x3cd45c[_0x404996(0x1da)]}),_0x16309b=_0x478e23[_0x404996(0x1dc)],_0x5ea43d=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0xbc22ff+'\x27...',()=>_0x57e28d[_0x404996(0x1d5)]['resolveFolderId'](_0x16309b,_0xbc22ff),{'verbose':_0x3cd45c[_0x404996(0x1da)]});_0x417d54=_0x5ea43d[_0x404996(0x1dc)],_0x3cd45c[_0x404996(0x1da)]&&console[_0x404996(0x192)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x417d54);}const _0xbff17f={'name':_0x32ffd4,'description':_0x3cd45c[_0x404996(0x1ab)],'parentFolderId':_0x417d54},_0x47c2a6=await withSpinner(_0x404996(0x1bf)+_0x32ffd4+'\x27...',()=>_0x57e28d[_0x404996(0x1d5)]['createFolder'](_0x269a98,_0xbff17f),{'verbose':_0x3cd45c['verbose']}),_0x29886c=_0x47c2a6[_0x404996(0x1dc)];return console['error']('✔\x20Created\x20folder\x20\x27'+_0x29886c[_0x404996(0x170)]+_0x404996(0x1c9)+_0x29886c['id']),await handleSDKOutput([_0x29886c],_0x3cd45c),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x398bb6(0x170)]=a37_0x398bb6(0x1b5);[a37_0x398bb6(0x1ab)]=a37_0x398bb6(0x17a);async[a37_0x398bb6(0x14a)](_0x3a699b){const _0x5369fb=a37_0x398bb6,{options:_0x3c9049,args:_0x4a5beb,tdx:_0x227793}=_0x3a699b,_0x473307=_0x4a5beb[0x0];if(!_0x473307)return console[_0x5369fb(0x192)](_0x5369fb(0x1c1)),console[_0x5369fb(0x192)]('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console['error'](_0x5369fb(0x1e0)),console[_0x5369fb(0x192)](_0x5369fb(0x169)),console[_0x5369fb(0x192)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x5369fb(0x192)](_0x5369fb(0x154)),console[_0x5369fb(0x192)](_0x5369fb(0x178)),console['error'](_0x5369fb(0x171)),console[_0x5369fb(0x192)](_0x5369fb(0x19c)),console[_0x5369fb(0x192)](_0x5369fb(0x15a)),0x1;try{const _0x26b2db=_0x3c9049['parentSegment'],_0x869f3d=await resolveSegmentTarget(_0x473307,_0x26b2db,_0x3c9049['verbose']);_0x3c9049['verbose']&&console[_0x5369fb(0x192)](_0x5369fb(0x1ae)+_0x869f3d);const _0x13b9c7=await withSpinner(_0x5369fb(0x188)+_0x473307+_0x5369fb(0x1d8),()=>_0x227793[_0x5369fb(0x1d5)][_0x5369fb(0x177)](_0x869f3d),{'verbose':_0x3c9049[_0x5369fb(0x1da)]}),_0x28bf70=_0x13b9c7['data'];_0x3c9049[_0x5369fb(0x1da)]&&(console[_0x5369fb(0x192)]('Resolved\x20type:\x20'+_0x28bf70['type']),console[_0x5369fb(0x192)](_0x5369fb(0x18f)+_0x28bf70[_0x5369fb(0x19f)]),_0x28bf70[_0x5369fb(0x1df)]&&console[_0x5369fb(0x192)](_0x5369fb(0x1cf)+_0x28bf70[_0x5369fb(0x1df)]),_0x28bf70[_0x5369fb(0x186)]&&console[_0x5369fb(0x192)]('Segment\x20ID:\x20'+_0x28bf70[_0x5369fb(0x186)]));if(_0x3c9049[_0x5369fb(0x190)]){if(_0x28bf70[_0x5369fb(0x1a2)]===_0x5369fb(0x173))return console[_0x5369fb(0x192)](_0x5369fb(0x195)),0x1;if(_0x28bf70[_0x5369fb(0x1a2)]===_0x5369fb(0x17b))return console['error']('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x5369fb(0x192)](_0x5369fb(0x184)),0x1;if(!_0x28bf70[_0x5369fb(0x186)])throw new SDKError(ErrorCode[_0x5369fb(0x1e9)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1a27a7=getConsoleNextUrl(_0x3c9049['site'],_0x5369fb(0x1d7)+_0x28bf70['parentId']+_0x5369fb(0x17d)+_0x28bf70[_0x5369fb(0x186)]);return console[_0x5369fb(0x192)](a37_0x184753['green']('✔')+_0x5369fb(0x162)+a37_0x184753['cyan'](_0x1a27a7)),openBrowser(_0x1a27a7),0x0;}if(_0x28bf70['type']===_0x5369fb(0x173)){if(!_0x28bf70[_0x5369fb(0x1df)])throw new SDKError(ErrorCode[_0x5369fb(0x1a8)],_0x5369fb(0x18c));const _0x41b7d6=await withSpinner(_0x5369fb(0x1e3),()=>_0x227793['segment'][_0x5369fb(0x1d4)](_0x28bf70['folderId']),{'verbose':_0x3c9049['verbose']});await handleSingleObjectOutput(_0x41b7d6['data'],_0x3c9049);}else{if(_0x28bf70[_0x5369fb(0x1a2)]===_0x5369fb(0x1d5)){if(!_0x28bf70[_0x5369fb(0x186)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x5369fb(0x19e));const _0x220c0a=await withSpinner('Fetching\x20segment\x20details...',()=>_0x227793[_0x5369fb(0x1d5)][_0x5369fb(0x1d0)](_0x28bf70[_0x5369fb(0x19f)],_0x28bf70[_0x5369fb(0x186)]),{'verbose':_0x3c9049[_0x5369fb(0x1da)]}),_0x5df5ba=getConsoleNextUrl(_0x3c9049[_0x5369fb(0x174)],'/app/ps/'+_0x28bf70['parentId']+'/e/'+_0x28bf70['segmentId']),_0x4e248a=_0x220c0a[_0x5369fb(0x1dc)];_0x4e248a[_0x5369fb(0x166)]=_0x5df5ba,await handleSingleObjectOutput(_0x4e248a,_0x3c9049);}else return console[_0x5369fb(0x192)](_0x5369fb(0x16b)),console[_0x5369fb(0x192)]('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0x43bebb){if(_0x43bebb instanceof SDKError)return console[_0x5369fb(0x192)]('Error:\x20'+_0x43bebb[_0x5369fb(0x1e8)]),_0x43bebb[_0x5369fb(0x194)]&&console[_0x5369fb(0x192)](_0x5369fb(0x1e1)+_0x43bebb[_0x5369fb(0x194)]),0x1;throw _0x43bebb;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x398bb6(0x170)]=a37_0x398bb6(0x1b8);[a37_0x398bb6(0x1ab)]=a37_0x398bb6(0x150);async[a37_0x398bb6(0x14a)](_0x1f92f0){const _0x584b92=a37_0x398bb6,{options:_0x311855,args:_0x21fc1b,tdx:_0x3486e7}=_0x1f92f0,_0x4b8c8b=_0x21fc1b[0x0];if(!_0x4b8c8b)return console[_0x584b92(0x192)](_0x584b92(0x183)),console[_0x584b92(0x192)](_0x584b92(0x16a)),console[_0x584b92(0x192)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console[_0x584b92(0x192)](_0x584b92(0x154)),console['error']('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x584b92(0x192)](_0x584b92(0x19a)),0x1;try{const _0x1b2a73=_0x311855['parentSegment'],_0x38b0c3=await resolveSegmentTarget(_0x4b8c8b,_0x1b2a73,_0x311855[_0x584b92(0x1da)]);_0x311855[_0x584b92(0x1da)]&&console[_0x584b92(0x192)]('Target\x20path:\x20'+_0x38b0c3);const _0x422f58=await withSpinner(_0x584b92(0x188)+_0x4b8c8b+'\x27...',()=>_0x3486e7[_0x584b92(0x1d5)][_0x584b92(0x177)](_0x38b0c3),{'verbose':_0x311855[_0x584b92(0x1da)]}),_0x710261=_0x422f58['data'];_0x311855['verbose']&&(console['error'](_0x584b92(0x19b)+_0x710261['type']),console[_0x584b92(0x192)](_0x584b92(0x18f)+_0x710261[_0x584b92(0x19f)]));if(_0x710261['type']===_0x584b92(0x173))return console[_0x584b92(0x192)](_0x584b92(0x1c0)),console[_0x584b92(0x192)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x710261[_0x584b92(0x1a2)]===_0x584b92(0x17b))return console['error'](_0x584b92(0x1b0)),console[_0x584b92(0x192)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x710261[_0x584b92(0x186)])throw new SDKError(ErrorCode[_0x584b92(0x1e9)],_0x584b92(0x19e));const _0x44ab84=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x3486e7[_0x584b92(0x1d5)][_0x584b92(0x1ad)](_0x710261[_0x584b92(0x19f)],_0x710261[_0x584b92(0x186)]),{'verbose':_0x311855[_0x584b92(0x1da)]}),_0x191908=_0x44ab84[_0x584b92(0x1dc)],_0x53efb4=await executeSchemaQuery(_0x191908,_0x3486e7,_0x311855);return await handleQueryOutput(_0x53efb4,_0x311855),0x0;}catch(_0x140b54){if(_0x140b54 instanceof SDKError)return console[_0x584b92(0x192)](_0x584b92(0x15b)+_0x140b54[_0x584b92(0x1e8)]),_0x140b54[_0x584b92(0x194)]&&console[_0x584b92(0x192)](_0x584b92(0x1e1)+_0x140b54[_0x584b92(0x194)]),0x1;throw _0x140b54;}}}
@@ -1 +1 @@
1
- const a38_0x3e7c15=a38_0x28bd;(function(_0xf6c14b,_0x160b1d){const _0x3ad42a=a38_0x28bd,_0xef2f9b=_0xf6c14b();while(!![]){try{const _0x2a5ff1=-parseInt(_0x3ad42a(0x19c))/0x1*(parseInt(_0x3ad42a(0x1c2))/0x2)+-parseInt(_0x3ad42a(0x1a2))/0x3+parseInt(_0x3ad42a(0x1c5))/0x4*(parseInt(_0x3ad42a(0x1a1))/0x5)+-parseInt(_0x3ad42a(0x1bf))/0x6+-parseInt(_0x3ad42a(0x1a5))/0x7*(parseInt(_0x3ad42a(0x1ad))/0x8)+-parseInt(_0x3ad42a(0x1a6))/0x9*(-parseInt(_0x3ad42a(0x1aa))/0xa)+parseInt(_0x3ad42a(0x1bd))/0xb;if(_0x2a5ff1===_0x160b1d)break;else _0xef2f9b['push'](_0xef2f9b['shift']());}catch(_0xf70da0){_0xef2f9b['push'](_0xef2f9b['shift']());}}}(a38_0x1e19,0x48ccb));function a38_0x28bd(_0x8a9b49,_0x5bf9b1){_0x8a9b49=_0x8a9b49-0x196;const _0x1e1900=a38_0x1e19();let _0x28bd37=_0x1e1900[_0x8a9b49];return _0x28bd37;}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_0xf4f6e7 from'chalk';function a38_0x1e19(){const _0x3761cf=['160xhnHbI','data','description','site','segments','kind','Resolving\x20folder\x20\x27','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','Parent\x20path:\x20','Resolved\x20relative\x20path\x20to:\x20','type','\x27...','length','ruleFile','segment','17338233ViUWAH','noCountPopulation','1407822KsmqNA','Parent:\x20','folderId','4PjivFa','includes','resolveFolderId','4HLEhoc','Creating\x20segment\x20\x27','Examples:','Site:\x20','Resolved\x20folder\x20ID:\x20','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','createSegment','143947rXMsRN','invisible','Resolving\x20folder\x20path\x20\x27','✔\x20Created\x20segment\x20\x27','resolvePathToResource','1175215fxumCV','1586352xZgWBp','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','name','163590kCVwMQ','63oloKrw','yellow','folder','error','8080CMfXCT','verbose','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'];a38_0x1e19=function(){return _0x3761cf;};return a38_0x1e19();}export class SegmentCreateCommand extends BaseCommand{[a38_0x3e7c15(0x1a4)]='segment:create';[a38_0x3e7c15(0x1af)]='Create\x20child\x20segment\x20with\x20filtering\x20rules';async['execute'](_0x5418bc){const _0x5ea74b=a38_0x3e7c15;console[_0x5ea74b(0x1a9)](a38_0xf4f6e7['yellow']('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x5ea74b(0x1a9)](a38_0xf4f6e7[_0x5ea74b(0x1a7)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x24bd5c,args:_0x4137ca,tdx:_0x1a3a6f}=_0x5418bc,_0x3bdeb9=_0x24bd5c;if(_0x4137ca[_0x5ea74b(0x1ba)]===0x0)return console[_0x5ea74b(0x1a9)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x5ea74b(0x1a9)]('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console[_0x5ea74b(0x1a9)](_0x5ea74b(0x197)),console[_0x5ea74b(0x1a9)](_0x5ea74b(0x1b5)),console[_0x5ea74b(0x1a9)](_0x5ea74b(0x1b4)),console[_0x5ea74b(0x1a9)](_0x5ea74b(0x1a3)),0x1;const _0x2dc8c6=_0x4137ca[0x0],_0x3aac4b=_0x24bd5c['segmentPath'];let _0x5d1922=_0x2dc8c6;_0x3aac4b&&!_0x2dc8c6[_0x5ea74b(0x1c3)]('/')&&(_0x5d1922=_0x3aac4b+'/'+_0x2dc8c6,_0x3bdeb9[_0x5ea74b(0x1ab)]&&console['error'](_0x5ea74b(0x1b7)+_0x5d1922));const _0x580f64=parsePath(_0x5d1922);if(_0x580f64[_0x5ea74b(0x1b1)][_0x5ea74b(0x1ba)]<0x2)return console[_0x5ea74b(0x1a9)](_0x5ea74b(0x1ac)),console['error']('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x43a6a0=_0x580f64['segments'][0x0],_0xd3a371=getBaseName(_0x5d1922),_0x451702=getParentPath(_0x5d1922);_0x3bdeb9[_0x5ea74b(0x1ab)]&&(console['error'](_0x5ea74b(0x198)+_0x3bdeb9[_0x5ea74b(0x1b0)]),console[_0x5ea74b(0x1a9)]('Target\x20path:\x20'+_0x5d1922),console[_0x5ea74b(0x1a9)](_0x5ea74b(0x1c0)+_0x43a6a0),console[_0x5ea74b(0x1a9)]('Segment\x20name:\x20'+_0xd3a371),console[_0x5ea74b(0x1a9)](_0x5ea74b(0x1b6)+_0x451702));const _0x1a413d=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x43a6a0+'\x27...',()=>_0x1a3a6f[_0x5ea74b(0x1bc)]['resolveParentId'](_0x43a6a0),{'verbose':_0x3bdeb9['verbose']}),_0x114672=_0x1a413d['data'];let _0x5d3baa;if(_0x580f64[_0x5ea74b(0x1b1)][_0x5ea74b(0x1ba)]>0x2){const _0x2538f5=await withSpinner(_0x5ea74b(0x19e)+_0x451702+_0x5ea74b(0x1b9),()=>_0x1a3a6f['segment'][_0x5ea74b(0x1a0)](_0x451702),{'verbose':_0x3bdeb9[_0x5ea74b(0x1ab)]}),_0x741b48=_0x2538f5[_0x5ea74b(0x1ae)];if(_0x741b48[_0x5ea74b(0x1b8)]!==_0x5ea74b(0x1a8)&&_0x741b48[_0x5ea74b(0x1b8)]!=='parent')return console[_0x5ea74b(0x1a9)](_0x5ea74b(0x19a)),0x1;_0x5d3baa=_0x741b48[_0x5ea74b(0x1c1)];}else{if(_0x3bdeb9[_0x5ea74b(0x1a8)]){const _0x2427ee=await withSpinner(_0x5ea74b(0x1b3)+_0x3bdeb9[_0x5ea74b(0x1a8)]+'\x27...',()=>_0x1a3a6f[_0x5ea74b(0x1bc)][_0x5ea74b(0x1c4)](_0x114672,_0x3bdeb9[_0x5ea74b(0x1a8)]),{'verbose':_0x3bdeb9[_0x5ea74b(0x1ab)]});_0x5d3baa=_0x2427ee[_0x5ea74b(0x1ae)];}}_0x3bdeb9[_0x5ea74b(0x1ab)]&&_0x5d3baa&&console[_0x5ea74b(0x1a9)](_0x5ea74b(0x199)+_0x5d3baa);const _0xa34e8f=await loadJSONFromOptions(_0x3bdeb9['rule'],_0x3bdeb9[_0x5ea74b(0x1bb)]),_0x22ceee={'name':_0xd3a371,'description':_0x3bdeb9[_0x5ea74b(0x1af)],'rule':_0xa34e8f,'kind':_0x3bdeb9['kind']!==undefined?parseInt(_0x3bdeb9[_0x5ea74b(0x1b2)],0xa):undefined,'isVisible':_0x3bdeb9[_0x5ea74b(0x19d)]?![]:undefined,'segmentFolderId':_0x5d3baa,'countPopulation':_0x3bdeb9[_0x5ea74b(0x1be)]?![]:undefined},_0x4f86bf=await withSpinner(_0x5ea74b(0x196)+_0xd3a371+_0x5ea74b(0x1b9),()=>_0x1a3a6f[_0x5ea74b(0x1bc)][_0x5ea74b(0x19b)](_0x114672,_0x22ceee),{'verbose':_0x3bdeb9[_0x5ea74b(0x1ab)]}),_0x2dab2c=_0x4f86bf[_0x5ea74b(0x1ae)];return console[_0x5ea74b(0x1a9)](_0x5ea74b(0x19f)+_0x2dab2c[_0x5ea74b(0x1a4)]+'\x27\x20with\x20ID:\x20'+_0x2dab2c['id']),_0x5d1922!==_0x2dc8c6&&console[_0x5ea74b(0x1a9)]('\x20\x20\x20Path:\x20'+_0x5d1922),await handleSDKOutput([_0x2dab2c],_0x3bdeb9),0x0;}}
1
+ function a38_0x6ead(_0x6f6bf1,_0x389a19){_0x6f6bf1=_0x6f6bf1-0x129;const _0x17fd1f=a38_0x17fd();let _0x6ead6e=_0x17fd1f[_0x6f6bf1];return _0x6ead6e;}const a38_0x2a35c7=a38_0x6ead;(function(_0xe7c4ae,_0x5a29f4){const _0x2d47b7=a38_0x6ead,_0x71cff9=_0xe7c4ae();while(!![]){try{const _0x1a946c=-parseInt(_0x2d47b7(0x14d))/0x1*(parseInt(_0x2d47b7(0x13f))/0x2)+-parseInt(_0x2d47b7(0x132))/0x3*(-parseInt(_0x2d47b7(0x12e))/0x4)+parseInt(_0x2d47b7(0x148))/0x5*(-parseInt(_0x2d47b7(0x140))/0x6)+parseInt(_0x2d47b7(0x12d))/0x7*(parseInt(_0x2d47b7(0x131))/0x8)+-parseInt(_0x2d47b7(0x13d))/0x9*(parseInt(_0x2d47b7(0x15a))/0xa)+parseInt(_0x2d47b7(0x14f))/0xb*(parseInt(_0x2d47b7(0x151))/0xc)+parseInt(_0x2d47b7(0x14b))/0xd;if(_0x1a946c===_0x5a29f4)break;else _0x71cff9['push'](_0x71cff9['shift']());}catch(_0x6f47d8){_0x71cff9['push'](_0x71cff9['shift']());}}}(a38_0x17fd,0xceac7));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a38_0x17fd(){const _0x3eaea2=['folderId','Parent:\x20','resolveFolderId','5evWkhy','Target\x20path:\x20','Resolving\x20folder\x20\x27','22819706pLNzGC','Examples:','69sUinFd','length','6219741roJiwG','rule','12HsGtwb','segments','Site:\x20','type','resolvePathToResource','Resolved\x20relative\x20path\x20to:\x20','folder','resolveParentId','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','11179700GmjfsT','segmentPath','description','yellow','verbose','includes','\x27...','name','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','\x20\x20\x20Path:\x20','35cKAmKz','1484mTmmpd','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','Resolving\x20folder\x20path\x20\x27','590664HuXgci','1713ZyodxO','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','parent','Parent\x20path:\x20','Resolved\x20folder\x20ID:\x20','invisible','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','site','segment','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','✔\x20Created\x20segment\x20\x27','9lxfeSQ','data','11126fVEAzn','3320682WKEdSf','kind','error','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','Create\x20child\x20segment\x20with\x20filtering\x20rules'];a38_0x17fd=function(){return _0x3eaea2;};return a38_0x17fd();}import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x19f464 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x2a35c7(0x12a)]='segment:create';[a38_0x2a35c7(0x15c)]=a38_0x2a35c7(0x144);async['execute'](_0x105499){const _0x58b63b=a38_0x2a35c7;console[_0x58b63b(0x142)](a38_0x19f464[_0x58b63b(0x15d)](_0x58b63b(0x12b))),console['error'](a38_0x19f464['yellow'](_0x58b63b(0x138)));const {options:_0x2d0b8e,args:_0x5522f8,tdx:_0x196c9b}=_0x105499,_0x53bd8=_0x2d0b8e;if(_0x5522f8[_0x58b63b(0x14e)]===0x0)return console[_0x58b63b(0x142)](_0x58b63b(0x133)),console[_0x58b63b(0x142)](_0x58b63b(0x12f)),console[_0x58b63b(0x142)](_0x58b63b(0x14c)),console[_0x58b63b(0x142)](_0x58b63b(0x143)),console[_0x58b63b(0x142)](_0x58b63b(0x159)),console['error']('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x2f146e=_0x5522f8[0x0],_0x261445=_0x2d0b8e[_0x58b63b(0x15b)];let _0x296e97=_0x2f146e;_0x261445&&!_0x2f146e[_0x58b63b(0x15f)]('/')&&(_0x296e97=_0x261445+'/'+_0x2f146e,_0x53bd8[_0x58b63b(0x15e)]&&console[_0x58b63b(0x142)](_0x58b63b(0x156)+_0x296e97));const _0x3488ef=parsePath(_0x296e97);if(_0x3488ef['segments'][_0x58b63b(0x14e)]<0x2)return console['error']('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 _0x428382=_0x3488ef[_0x58b63b(0x152)][0x0],_0x4bb821=getBaseName(_0x296e97),_0x54996e=getParentPath(_0x296e97);_0x53bd8[_0x58b63b(0x15e)]&&(console['error'](_0x58b63b(0x153)+_0x53bd8[_0x58b63b(0x139)]),console[_0x58b63b(0x142)](_0x58b63b(0x149)+_0x296e97),console['error'](_0x58b63b(0x146)+_0x428382),console[_0x58b63b(0x142)]('Segment\x20name:\x20'+_0x4bb821),console[_0x58b63b(0x142)](_0x58b63b(0x135)+_0x54996e));const _0x53da6c=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x428382+_0x58b63b(0x129),()=>_0x196c9b['segment'][_0x58b63b(0x158)](_0x428382),{'verbose':_0x53bd8['verbose']}),_0x333e99=_0x53da6c[_0x58b63b(0x13e)];let _0x462da5;if(_0x3488ef[_0x58b63b(0x152)][_0x58b63b(0x14e)]>0x2){const _0x207db4=await withSpinner(_0x58b63b(0x130)+_0x54996e+_0x58b63b(0x129),()=>_0x196c9b['segment'][_0x58b63b(0x155)](_0x54996e),{'verbose':_0x53bd8[_0x58b63b(0x15e)]}),_0x5e3d34=_0x207db4['data'];if(_0x5e3d34[_0x58b63b(0x154)]!==_0x58b63b(0x157)&&_0x5e3d34[_0x58b63b(0x154)]!==_0x58b63b(0x134))return console[_0x58b63b(0x142)](_0x58b63b(0x13b)),0x1;_0x462da5=_0x5e3d34[_0x58b63b(0x145)];}else{if(_0x53bd8[_0x58b63b(0x157)]){const _0x58ff8c=await withSpinner(_0x58b63b(0x14a)+_0x53bd8['folder']+'\x27...',()=>_0x196c9b['segment'][_0x58b63b(0x147)](_0x333e99,_0x53bd8[_0x58b63b(0x157)]),{'verbose':_0x53bd8[_0x58b63b(0x15e)]});_0x462da5=_0x58ff8c['data'];}}_0x53bd8[_0x58b63b(0x15e)]&&_0x462da5&&console[_0x58b63b(0x142)](_0x58b63b(0x136)+_0x462da5);const _0x1b1392=await loadJSONFromOptions(_0x53bd8[_0x58b63b(0x150)],_0x53bd8['ruleFile']),_0x126c3f={'name':_0x4bb821,'description':_0x53bd8['description'],'rule':_0x1b1392,'kind':_0x53bd8[_0x58b63b(0x141)]!==undefined?parseInt(_0x53bd8['kind'],0xa):undefined,'isVisible':_0x53bd8[_0x58b63b(0x137)]?![]:undefined,'segmentFolderId':_0x462da5,'countPopulation':_0x53bd8['noCountPopulation']?![]:undefined},_0x321753=await withSpinner('Creating\x20segment\x20\x27'+_0x4bb821+_0x58b63b(0x129),()=>_0x196c9b[_0x58b63b(0x13a)]['createSegment'](_0x333e99,_0x126c3f),{'verbose':_0x53bd8[_0x58b63b(0x15e)]}),_0x241889=_0x321753['data'];return console['error'](_0x58b63b(0x13c)+_0x241889[_0x58b63b(0x12a)]+'\x27\x20with\x20ID:\x20'+_0x241889['id']),_0x296e97!==_0x2f146e&&console[_0x58b63b(0x142)](_0x58b63b(0x12c)+_0x296e97),await handleSDKOutput([_0x241889],_0x53bd8),0x0;}}
@@ -1 +1 @@
1
- const a39_0x27f7dc=a39_0x58ce;function a39_0x58ce(_0x3ae8f4,_0x40f939){_0x3ae8f4=_0x3ae8f4-0x185;const _0x57e743=a39_0x57e7();let _0x58ce35=_0x57e743[_0x3ae8f4];return _0x58ce35;}(function(_0x2298d1,_0x2eb4cb){const _0x5a7057=a39_0x58ce,_0x1b8c78=_0x2298d1();while(!![]){try{const _0x2d283a=-parseInt(_0x5a7057(0x199))/0x1+-parseInt(_0x5a7057(0x18f))/0x2+parseInt(_0x5a7057(0x18d))/0x3*(-parseInt(_0x5a7057(0x185))/0x4)+-parseInt(_0x5a7057(0x18c))/0x5*(parseInt(_0x5a7057(0x196))/0x6)+parseInt(_0x5a7057(0x188))/0x7*(parseInt(_0x5a7057(0x195))/0x8)+parseInt(_0x5a7057(0x19b))/0x9*(-parseInt(_0x5a7057(0x1a3))/0xa)+parseInt(_0x5a7057(0x19f))/0xb*(parseInt(_0x5a7057(0x190))/0xc);if(_0x2d283a===_0x2eb4cb)break;else _0x1b8c78['push'](_0x1b8c78['shift']());}catch(_0xcbc0a){_0x1b8c78['push'](_0x1b8c78['shift']());}}}(a39_0x57e7,0x7b5c7));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a39_0x57e7(){const _0x40ea00=['1911694TXIQkG','24OfSMfR','Parent\x20segment:\x20','segment:fields','List\x20available\x20fields\x20for\x20segmentation','Site:\x20','696448ocLomT','42cEDSoj','error','name','967002PJufDn','Error:\x20Parent\x20segment\x20name\x20is\x20required','10962IMGOza','\x27...','data','verbose','21348019oimreq','length','listFields','✔\x20Found\x20','4480yaLjoP','Listing\x20fields\x20for\x20\x27','execute','38388iekuTj','segment','\x20field','7EnXCab','jsonl','json','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','333485yVSOwz','165gfzXYl','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'];a39_0x57e7=function(){return _0x40ea00;};return a39_0x57e7();}import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a39_0x27f7dc(0x198)]=a39_0x27f7dc(0x192);['description']=a39_0x27f7dc(0x193);async[a39_0x27f7dc(0x1a5)](_0x223b22){const _0x31a2f9=a39_0x27f7dc,{options:_0x2d52ed,args:_0x5b8422,tdx:_0x3c4379}=_0x223b22,_0x227551=_0x5b8422[0x0]||_0x2d52ed['parentSegment'];if(!_0x227551)return console[_0x31a2f9(0x197)](_0x31a2f9(0x19a)),console[_0x31a2f9(0x197)](_0x31a2f9(0x18b)),console['error'](_0x31a2f9(0x18e)),0x1;_0x2d52ed[_0x31a2f9(0x19e)]&&(console[_0x31a2f9(0x197)](_0x31a2f9(0x194)+_0x2d52ed['site']),console[_0x31a2f9(0x197)](_0x31a2f9(0x191)+_0x227551));const _0x4a7d3a=await withSpinner(_0x31a2f9(0x1a4)+_0x227551+_0x31a2f9(0x19c),()=>_0x3c4379[_0x31a2f9(0x186)][_0x31a2f9(0x1a1)](_0x227551),{'verbose':_0x2d52ed[_0x31a2f9(0x19e)]}),_0xf7b6e8=_0x4a7d3a[_0x31a2f9(0x19d)];console[_0x31a2f9(0x197)](_0x31a2f9(0x1a2)+_0xf7b6e8[_0x31a2f9(0x1a0)]+_0x31a2f9(0x187)+(_0xf7b6e8[_0x31a2f9(0x1a0)]!==0x1?'s':''));if(_0x2d52ed[_0x31a2f9(0x18a)]||_0x2d52ed[_0x31a2f9(0x189)])return await handleSDKOutput(_0xf7b6e8,_0x2d52ed),0x0;return displayFieldsHumanReadable(_0xf7b6e8,_0x227551),0x0;}}
1
+ const a39_0xbfa57=a39_0x4e5e;(function(_0x112024,_0x7c11c){const _0x9482b9=a39_0x4e5e,_0x569f8e=_0x112024();while(!![]){try{const _0x2f0d47=-parseInt(_0x9482b9(0xcf))/0x1+parseInt(_0x9482b9(0xde))/0x2+parseInt(_0x9482b9(0xce))/0x3*(parseInt(_0x9482b9(0xd3))/0x4)+parseInt(_0x9482b9(0xd9))/0x5*(parseInt(_0x9482b9(0xcb))/0x6)+parseInt(_0x9482b9(0xc7))/0x7+-parseInt(_0x9482b9(0xdb))/0x8+-parseInt(_0x9482b9(0xd0))/0x9;if(_0x2f0d47===_0x7c11c)break;else _0x569f8e['push'](_0x569f8e['shift']());}catch(_0x14ca80){_0x569f8e['push'](_0x569f8e['shift']());}}}(a39_0x4f81,0xb32eb));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a39_0x4e5e(_0x4f59c3,_0x1c39f1){_0x4f59c3=_0x4f59c3-0xc4;const _0x4f8140=a39_0x4f81();let _0x4e5ec7=_0x4f8140[_0x4f59c3];return _0x4e5ec7;}function a39_0x4f81(){const _0x4318b5=['length','5722235VdSOru','Site:\x20','2810304FareNt','List\x20available\x20fields\x20for\x20segmentation','verbose','1138268hFOvuc','name','description','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x27...','3469214CgnkAZ','\x20field','json','execute','6ryDtpY','✔\x20Found\x20','parentSegment','6YoczGu','1304911nxWsoA','644571kWvYQk','segment:fields','site','505132fBGkIw','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','listFields','jsonl','error'];a39_0x4f81=function(){return _0x4318b5;};return a39_0x4f81();}import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a39_0xbfa57(0xdf)]=a39_0xbfa57(0xd1);[a39_0xbfa57(0xc4)]=a39_0xbfa57(0xdc);async[a39_0xbfa57(0xca)](_0x267b48){const _0x209515=a39_0xbfa57,{options:_0x37ae8c,args:_0x2c49e2,tdx:_0xe47094}=_0x267b48,_0x5a1cb5=_0x2c49e2[0x0]||_0x37ae8c[_0x209515(0xcd)];if(!_0x5a1cb5)return console['error'](_0x209515(0xc5)),console[_0x209515(0xd7)]('Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'),console[_0x209515(0xd7)](_0x209515(0xd4)),0x1;_0x37ae8c[_0x209515(0xdd)]&&(console[_0x209515(0xd7)](_0x209515(0xda)+_0x37ae8c[_0x209515(0xd2)]),console['error']('Parent\x20segment:\x20'+_0x5a1cb5));const _0x2b9d8f=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x5a1cb5+_0x209515(0xc6),()=>_0xe47094['segment'][_0x209515(0xd5)](_0x5a1cb5),{'verbose':_0x37ae8c['verbose']}),_0x165499=_0x2b9d8f['data'];console[_0x209515(0xd7)](_0x209515(0xcc)+_0x165499[_0x209515(0xd8)]+_0x209515(0xc8)+(_0x165499[_0x209515(0xd8)]!==0x1?'s':''));if(_0x37ae8c[_0x209515(0xc9)]||_0x37ae8c[_0x209515(0xd6)])return await handleSDKOutput(_0x165499,_0x37ae8c),0x0;return displayFieldsHumanReadable(_0x165499,_0x5a1cb5),0x0;}}