@treasuredata/tdx 2026.3.51 → 2026.3.53

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 (232) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/cas-command.js +1 -1
  11. package/dist/commands/cas-segment-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/delivery-command.js +1 -1
  20. package/dist/commands/describe.js +1 -1
  21. package/dist/commands/engage-campaign-pull-command.js +1 -1
  22. package/dist/commands/engage-campaign-push-command.js +1 -1
  23. package/dist/commands/engage-campaign-validate-command.js +1 -1
  24. package/dist/commands/engage-command.js +1 -1
  25. package/dist/commands/engage-template-pull-command.js +1 -1
  26. package/dist/commands/engage-template-push-command.js +1 -1
  27. package/dist/commands/engage-template-validate-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/journey-command.js +1 -1
  30. package/dist/commands/journey-validate-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/mcp-command.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/policy-command.js +1 -1
  35. package/dist/commands/profile-command.js +1 -1
  36. package/dist/commands/profiles-command.js +1 -1
  37. package/dist/commands/query-command.js +1 -1
  38. package/dist/commands/schedule-command.js +1 -1
  39. package/dist/commands/segment-command.js +1 -1
  40. package/dist/commands/segment-create-command.js +1 -1
  41. package/dist/commands/segment-fields-command.js +1 -1
  42. package/dist/commands/segment-pull-command.js +1 -1
  43. package/dist/commands/segment-push-command.js +1 -1
  44. package/dist/commands/segment-update-command.js +1 -1
  45. package/dist/commands/segment-use-command.js +1 -1
  46. package/dist/commands/segment-validate-command.js +1 -1
  47. package/dist/commands/segments.js +1 -1
  48. package/dist/commands/show.js +1 -1
  49. package/dist/commands/status-command.js +1 -1
  50. package/dist/commands/tables.js +1 -1
  51. package/dist/commands/unset-command.js +1 -1
  52. package/dist/commands/upgrade-command.js +1 -1
  53. package/dist/commands/use-command.js +1 -1
  54. package/dist/commands/user-command.js +1 -1
  55. package/dist/commands/work-command.js +1 -1
  56. package/dist/commands/workflow-command.js +1 -1
  57. package/dist/core/auth.js +1 -1
  58. package/dist/core/command-output.js +1 -1
  59. package/dist/core/config.js +1 -1
  60. package/dist/core/connection-cache.js +1 -1
  61. package/dist/core/constants.js +1 -1
  62. package/dist/core/credential-cache.js +1 -1
  63. package/dist/core/global-context.js +1 -1
  64. package/dist/core/keychain.js +1 -1
  65. package/dist/core/oauth-keychain.js +1 -1
  66. package/dist/core/oauth.js +1 -1
  67. package/dist/core/profile.js +1 -1
  68. package/dist/core/project-config.js +1 -1
  69. package/dist/core/session.js +1 -1
  70. package/dist/core/user-cache.js +1 -1
  71. package/dist/core/version.js +1 -1
  72. package/dist/index.js +1 -1
  73. package/dist/mcp/server.d.ts.map +1 -1
  74. package/dist/mcp/server.js +1 -1
  75. package/dist/mcp/server.js.map +1 -1
  76. package/dist/mcp/tools/index.d.ts +2 -0
  77. package/dist/mcp/tools/index.d.ts.map +1 -1
  78. package/dist/mcp/tools/index.js +1 -1
  79. package/dist/mcp/tools/index.js.map +1 -1
  80. package/dist/mcp/tools/tdx-run.js +1 -1
  81. package/dist/mcp/tools/tdx-search.js +1 -1
  82. package/dist/mcp/tools/work-create-item.d.ts +50 -0
  83. package/dist/mcp/tools/work-create-item.d.ts.map +1 -0
  84. package/dist/mcp/tools/work-create-item.js +1 -0
  85. package/dist/mcp/tools/work-create-item.js.map +1 -0
  86. package/dist/mcp/utils.js +1 -1
  87. package/dist/proxy/claude-usage-tracker.js +1 -1
  88. package/dist/proxy/passthrough-server.js +1 -1
  89. package/dist/proxy/sse-usage-parser.js +1 -1
  90. package/dist/sdk/agent/agent-config.js +1 -1
  91. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  92. package/dist/sdk/agent/agent-yaml.js +1 -1
  93. package/dist/sdk/agent/test/evaluator.js +1 -1
  94. package/dist/sdk/agent/test/executor.js +1 -1
  95. package/dist/sdk/agent/test/index.js +1 -1
  96. package/dist/sdk/agent/test/output.js +1 -1
  97. package/dist/sdk/agent/test/parser.js +1 -1
  98. package/dist/sdk/agent/tool-target-registry.js +1 -1
  99. package/dist/sdk/api.js +1 -1
  100. package/dist/sdk/cas/cas-api-client.js +1 -1
  101. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  102. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  103. package/dist/sdk/cas/index.js +1 -1
  104. package/dist/sdk/cas/pull-workflow.js +1 -1
  105. package/dist/sdk/cas/push-workflow.js +1 -1
  106. package/dist/sdk/client/cdp-api-client.js +1 -1
  107. package/dist/sdk/client/delivery-api-client.js +1 -1
  108. package/dist/sdk/client/endpoints.js +1 -1
  109. package/dist/sdk/client/engage-api-client.js +1 -1
  110. package/dist/sdk/client/http-client.js +1 -1
  111. package/dist/sdk/client/llm-api-client.js +1 -1
  112. package/dist/sdk/client/oauth-refresh.js +1 -1
  113. package/dist/sdk/client/rate-limiter.js +1 -1
  114. package/dist/sdk/client/td-api-client.js +1 -1
  115. package/dist/sdk/client/trino-api-client.js +1 -1
  116. package/dist/sdk/client/workflow-client.js +1 -1
  117. package/dist/sdk/connection-validator.js +1 -1
  118. package/dist/sdk/connection.js +1 -1
  119. package/dist/sdk/delivery.js +1 -1
  120. package/dist/sdk/engage/campaign-pull.js +1 -1
  121. package/dist/sdk/engage/campaign-push.js +1 -1
  122. package/dist/sdk/engage/campaign-validator.js +1 -1
  123. package/dist/sdk/engage/campaign-yaml.js +1 -1
  124. package/dist/sdk/engage/template-pull.js +1 -1
  125. package/dist/sdk/engage/template-push.js +1 -1
  126. package/dist/sdk/engage/template-validator.js +1 -1
  127. package/dist/sdk/engage/template-yaml.js +1 -1
  128. package/dist/sdk/engage/types/campaign-def.js +1 -1
  129. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  130. package/dist/sdk/engage/types/template-schema.js +1 -1
  131. package/dist/sdk/engage.js +1 -1
  132. package/dist/sdk/errors.js +1 -1
  133. package/dist/sdk/index.js +1 -1
  134. package/dist/sdk/io/index.js +1 -1
  135. package/dist/sdk/io/node-filesystem.js +1 -1
  136. package/dist/sdk/job.js +1 -1
  137. package/dist/sdk/journey.js +1 -1
  138. package/dist/sdk/llm/chat-cache.js +1 -1
  139. package/dist/sdk/llm/index.js +1 -1
  140. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  141. package/dist/sdk/llm/model-factors.js +1 -1
  142. package/dist/sdk/personalization.js +1 -1
  143. package/dist/sdk/policy.js +1 -1
  144. package/dist/sdk/query/index.js +1 -1
  145. package/dist/sdk/query/sql-parser.js +1 -1
  146. package/dist/sdk/realtime.js +1 -1
  147. package/dist/sdk/schedule.js +1 -1
  148. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  149. package/dist/sdk/segment/fields-display.js +1 -1
  150. package/dist/sdk/segment/file-discovery.js +1 -1
  151. package/dist/sdk/segment/journey-utils.js +1 -1
  152. package/dist/sdk/segment/journey-validator.js +1 -1
  153. package/dist/sdk/segment/journey-yaml.js +1 -1
  154. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  155. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  156. package/dist/sdk/segment/pull-workflow.js +1 -1
  157. package/dist/sdk/segment/push-recovery.js +1 -1
  158. package/dist/sdk/segment/push-workflow.js +1 -1
  159. package/dist/sdk/segment/resolution-context.js +1 -1
  160. package/dist/sdk/segment/segment-path-parser.js +1 -1
  161. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  162. package/dist/sdk/segment/segment-validator.js +1 -1
  163. package/dist/sdk/segment/target-resolution.js +1 -1
  164. package/dist/sdk/segment/tdx-config.js +1 -1
  165. package/dist/sdk/segment/types/activation-schema.js +1 -1
  166. package/dist/sdk/segment/types/journey-def.js +1 -1
  167. package/dist/sdk/segment/types/journey-schema.js +1 -1
  168. package/dist/sdk/segment/types/segment-def.js +1 -1
  169. package/dist/sdk/segment/types/segment-schema.js +1 -1
  170. package/dist/sdk/segment/validate-files.js +1 -1
  171. package/dist/sdk/segment/yaml-validator.js +1 -1
  172. package/dist/sdk/segment.js +1 -1
  173. package/dist/sdk/types/index.js +1 -1
  174. package/dist/sdk/types/progress.js +1 -1
  175. package/dist/sdk/types/workspace.d.ts +15 -0
  176. package/dist/sdk/types/workspace.d.ts.map +1 -1
  177. package/dist/sdk/types/workspace.js +1 -1
  178. package/dist/sdk/user.js +1 -1
  179. package/dist/sdk/util/format-detector.js +1 -1
  180. package/dist/sdk/util/formatters.js +1 -1
  181. package/dist/sdk/util/index.js +1 -1
  182. package/dist/sdk/util/paginate.js +1 -1
  183. package/dist/sdk/util/tree-formatter.js +1 -1
  184. package/dist/sdk/workflow/archive-validation.js +1 -1
  185. package/dist/sdk/workflow/clone-workflow.js +1 -1
  186. package/dist/sdk/workflow/index.js +1 -1
  187. package/dist/sdk/workflow/pull-workflow.js +1 -1
  188. package/dist/sdk/workflow/push-workflow.js +1 -1
  189. package/dist/sdk/workflow/tdx-config.js +1 -1
  190. package/dist/sdk/workflow/workflow-utils.js +1 -1
  191. package/dist/sdk/workspace/frontmatter.js +1 -1
  192. package/dist/sdk/workspace/git.js +1 -1
  193. package/dist/sdk/workspace/index.d.ts +14 -2
  194. package/dist/sdk/workspace/index.d.ts.map +1 -1
  195. package/dist/sdk/workspace/index.js +1 -1
  196. package/dist/sdk/workspace/index.js.map +1 -1
  197. package/dist/sdk/workspace/templates.js +1 -1
  198. package/dist/sdk/workspace/weekly.js +1 -1
  199. package/dist/sdk/workspace/wikilinks.js +1 -1
  200. package/dist/test-utils/command-runner.js +1 -1
  201. package/dist/test-utils/factories.js +1 -1
  202. package/dist/test-utils/fixtures.js +1 -1
  203. package/dist/test-utils/http-mock.js +1 -1
  204. package/dist/test-utils/index.js +1 -1
  205. package/dist/utils/async.js +1 -1
  206. package/dist/utils/colors.js +1 -1
  207. package/dist/utils/diff.js +1 -1
  208. package/dist/utils/file-permissions.js +1 -1
  209. package/dist/utils/file-reader.js +1 -1
  210. package/dist/utils/github-releases.js +1 -1
  211. package/dist/utils/global-cache.js +1 -1
  212. package/dist/utils/json-loader.js +1 -1
  213. package/dist/utils/local-cache.js +1 -1
  214. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  215. package/dist/utils/logger/formatters/index.js +1 -1
  216. package/dist/utils/logger/handlers/console-handler.js +1 -1
  217. package/dist/utils/logger/handlers/file-handler.js +1 -1
  218. package/dist/utils/logger/handlers/index.js +1 -1
  219. package/dist/utils/logger/handlers/null-handler.js +1 -1
  220. package/dist/utils/logger/index.js +1 -1
  221. package/dist/utils/logger/logger.js +1 -1
  222. package/dist/utils/logger/types.js +1 -1
  223. package/dist/utils/option-validation.js +1 -1
  224. package/dist/utils/process.js +1 -1
  225. package/dist/utils/prompt.js +1 -1
  226. package/dist/utils/spinner.js +1 -1
  227. package/dist/utils/sse-parser.js +1 -1
  228. package/dist/utils/string-utils.js +1 -1
  229. package/dist/utils/table-ref-parser.js +1 -1
  230. package/dist/utils/tdx-logger.js +1 -1
  231. package/dist/utils/version-check.js +1 -1
  232. package/package.json +1 -1
@@ -1 +1 @@
1
- const a32_0xfb112d=a32_0x4a85;(function(_0x5ac181,_0x2b49f3){const _0x8dc780=a32_0x4a85,_0x4a9846=_0x5ac181();while(!![]){try{const _0x2a3a2c=-parseInt(_0x8dc780(0xf3))/0x1+parseInt(_0x8dc780(0xf0))/0x2*(-parseInt(_0x8dc780(0xef))/0x3)+-parseInt(_0x8dc780(0x117))/0x4*(parseInt(_0x8dc780(0x114))/0x5)+-parseInt(_0x8dc780(0x10e))/0x6+parseInt(_0x8dc780(0xed))/0x7+-parseInt(_0x8dc780(0xfe))/0x8+parseInt(_0x8dc780(0x100))/0x9;if(_0x2a3a2c===_0x2b49f3)break;else _0x4a9846['push'](_0x4a9846['shift']());}catch(_0x1ad5b7){_0x4a9846['push'](_0x4a9846['shift']());}}}(a32_0x77f6,0xb6d8a));function a32_0x77f6(){const _0x5e7783=['dim','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','Administrator','Account\x20Owner','data','1480864raIenP','error','29583360gxQBLg','\x20\x20•\x20','Listing\x20policies...','entries','join','verbose','(ID:\x20','listPolicies','administrator','all','ies','bold','policy','getPolicyUsers','1386852nePvmD','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','permissions','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','Fetching\x20permissions...','getCurrent','30beNLas','\x20user','args','498972KTCzEu','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','Fetching\x20policy...','email','context','👥\x20Assigned\x20Users','execute','\x20\x20\x20','getPolicy','📋\x20Assigned\x20Policies','name','description',',\x20user_id:','validate','operation','✔\x20Found\x20','8940085FCfOor','length','879JliwUF','8404vxjoIw','\x20—\x20','getMyPermissions','1419363ErAlNc','\x20\x20No\x20permissions','site','log','map','\x20assigned'];a32_0x77f6=function(){return _0x5e7783;};return a32_0x77f6();}import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x294e9f from'chalk';export class PolicyCommand extends BaseCommand{[a32_0xfb112d(0x121)]=a32_0xfb112d(0x10c);['description']=a32_0xfb112d(0x111);async[a32_0xfb112d(0x11d)](_0x28b5be){const _0x271ebb=a32_0xfb112d,{options:_0x3c13f5,tdx:_0x213300}=_0x28b5be,_0x1b953b=await withSpinner(_0x271ebb(0x112),async()=>{const _0x5210df=_0x271ebb,[_0x10b9ab,_0x46a029]=await Promise[_0x5210df(0x109)]([_0x213300['user'][_0x5210df(0x113)](),_0x213300['policy'][_0x5210df(0xf2)]()]);return{'userInfo':_0x10b9ab,'permissions':_0x46a029};},{'verbose':_0x3c13f5[_0x271ebb(0x105)]}),{userInfo:_0x48fefd,permissions:_0x5ef867}=_0x1b953b[_0x271ebb(0xfd)];if(isStructuredFormat(_0x3c13f5))return await handleSingleObjectOutput(_0x5ef867,_0x3c13f5),0x0;const _0x56bf18=_0x48fefd['account_owner']?_0x271ebb(0xfc):_0x48fefd[_0x271ebb(0x108)]?_0x271ebb(0xfb):'Member';console[_0x271ebb(0xf6)]('\x0a'+a32_0x294e9f[_0x271ebb(0x10b)]('👤')+'\x20'+a32_0x294e9f[_0x271ebb(0x10b)](_0x48fefd['name'])+'\x20'+a32_0x294e9f[_0x271ebb(0xf9)]('('+_0x48fefd[_0x271ebb(0x11a)]+')')+'\x20—\x20'+_0x56bf18),console[_0x271ebb(0xf6)](a32_0x294e9f[_0x271ebb(0xf9)](_0x271ebb(0x11e)+_0x213300[_0x271ebb(0x11b)][_0x271ebb(0xf5)]+':'+_0x48fefd['account_id']+_0x271ebb(0xe9)+_0x48fefd['id']));const _0x4a142d=_0x5ef867['policies'];console[_0x271ebb(0xf6)]('\x0a'+a32_0x294e9f[_0x271ebb(0x10b)](_0x271ebb(0x120))+'\x20('+_0x4a142d['length']+'):');if(_0x4a142d[_0x271ebb(0xee)]===0x0)console[_0x271ebb(0xf6)](a32_0x294e9f['dim']('\x20\x20No\x20policies\x20assigned'));else for(const _0x1f69d9 of _0x4a142d){console[_0x271ebb(0xf6)]('\x20\x20•\x20'+_0x1f69d9[_0x271ebb(0x121)]);}return printPermissionsMap(_0x5ef867[_0x271ebb(0x110)]),console[_0x271ebb(0xf6)](),0x0;}}function a32_0x4a85(_0x46ad37,_0x25711c){_0x46ad37=_0x46ad37-0xe9;const _0x77f617=a32_0x77f6();let _0x4a8581=_0x77f617[_0x46ad37];return _0x4a8581;}export class PolicyListCommand extends BaseCommand{[a32_0xfb112d(0x121)]='policy\x20list';[a32_0xfb112d(0x122)]=a32_0xfb112d(0x10f);async[a32_0xfb112d(0x11d)](_0x515058){const _0x25eb8c=a32_0xfb112d,{options:_0x4a58fe,tdx:_0x35fe07}=_0x515058,_0xdec5f=await withSpinner(_0x25eb8c(0x102),()=>_0x35fe07[_0x25eb8c(0x10c)][_0x25eb8c(0x107)](),{'verbose':_0x4a58fe[_0x25eb8c(0x105)]}),_0xb948b4=_0xdec5f[_0x25eb8c(0xfd)];console[_0x25eb8c(0xff)](_0x25eb8c(0xec)+_0xb948b4['length']+'\x20polic'+(_0xb948b4[_0x25eb8c(0xee)]!==0x1?_0x25eb8c(0x10a):'y'));if(isStructuredFormat(_0x4a58fe))return await handleSDKOutput(_0xb948b4,_0x4a58fe),0x0;if(_0xb948b4[_0x25eb8c(0xee)]===0x0)console[_0x25eb8c(0xf6)](a32_0x294e9f[_0x25eb8c(0xf9)]('No\x20policies\x20found'));else for(const _0x189d2d of _0xb948b4){const _0x28c3cb=_0x189d2d['description']?a32_0x294e9f['dim'](_0x25eb8c(0xf1)+_0x189d2d['description']):'';console['log'](_0x25eb8c(0x101)+_0x189d2d['name']+_0x28c3cb);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0xfb112d(0x121)]='policy\x20show';[a32_0xfb112d(0x122)]=a32_0xfb112d(0x118);[a32_0xfb112d(0xea)](_0x633bab){const _0xcaaf98=a32_0xfb112d;if(_0x633bab[_0xcaaf98(0x116)][_0xcaaf98(0xee)]===0x0)return _0xcaaf98(0xfa);return undefined;}async[a32_0xfb112d(0x11d)](_0x4c5792){const _0x241088=a32_0xfb112d,{options:_0x23e4cb,tdx:_0xb954a0}=_0x4c5792,_0x25483b=_0x4c5792['args'][0x0],_0xd0e1f1=await withSpinner(_0x241088(0x119),async()=>{const _0x308c78=_0x241088,_0x482bd1=await _0xb954a0[_0x308c78(0x10c)][_0x308c78(0x11f)](_0x25483b),[_0x5a351d,_0x207d45]=await Promise['all']([_0xb954a0['policy']['getPolicyPermissions'](_0x482bd1['id']),_0xb954a0[_0x308c78(0x10c)][_0x308c78(0x10d)](_0x482bd1['id'])]);return{'policy':_0x482bd1,'perms':_0x5a351d,'users':_0x207d45};},{'verbose':_0x23e4cb['verbose']}),{policy:_0x132287,perms:_0x23e7f4,users:_0x3da12b}=_0xd0e1f1[_0x241088(0xfd)];if(isStructuredFormat(_0x23e4cb))return await handleSingleObjectOutput({..._0x132287,'permissions':_0x23e7f4['permissions'],'users':_0x3da12b},_0x23e4cb),0x0;console[_0x241088(0xf6)]('\x0a'+a32_0x294e9f['bold']('📋')+'\x20'+a32_0x294e9f[_0x241088(0x10b)](_0x132287[_0x241088(0x121)])+'\x20'+a32_0x294e9f['dim'](_0x241088(0x106)+_0x132287['id']+')'));_0x132287[_0x241088(0x122)]&&console[_0x241088(0xf6)]('\x20\x20\x20'+a32_0x294e9f[_0x241088(0xf9)](_0x132287[_0x241088(0x122)]));console['log']('\x20\x20\x20'+_0x3da12b['length']+_0x241088(0x115)+(_0x3da12b[_0x241088(0xee)]!==0x1?'s':'')+_0x241088(0xf8)),printPermissionsMap(_0x23e7f4[_0x241088(0x110)]);if(_0x3da12b['length']>0x0){console[_0x241088(0xf6)]('\x0a'+a32_0x294e9f[_0x241088(0x10b)](_0x241088(0x11c))+':');for(const _0x38b9d6 of _0x3da12b){const _0x2442b1=_0x38b9d6['email']&&_0x38b9d6[_0x241088(0x11a)]!==_0x38b9d6['name']?a32_0x294e9f[_0x241088(0xf9)]('\x20<'+_0x38b9d6[_0x241088(0x11a)]+'>'):'';console[_0x241088(0xf6)]('\x20\x20•\x20'+_0x38b9d6[_0x241088(0x121)]+_0x2442b1);}}return console[_0x241088(0xf6)](),0x0;}}function printPermissionsMap(_0x149625){const _0xefc60=a32_0xfb112d,_0x43a77a=Object[_0xefc60(0x103)](_0x149625);console[_0xefc60(0xf6)]('\x0a'+a32_0x294e9f['bold']('🔑\x20Effective\x20Permissions')+':');if(_0x43a77a[_0xefc60(0xee)]===0x0){console[_0xefc60(0xf6)](a32_0x294e9f[_0xefc60(0xf9)](_0xefc60(0xf4)));return;}const _0x16f2d6=Math['max'](..._0x43a77a[_0xefc60(0xf7)](([_0x5bba3b])=>_0x5bba3b[_0xefc60(0xee)]));for(const [_0x5383b5,_0x3acd7f]of _0x43a77a){const _0x3c1793=formatOperations(_0x3acd7f);console[_0xefc60(0xf6)]('\x20\x20'+_0x5383b5['padEnd'](_0x16f2d6+0x2)+_0x3c1793);}}function formatOperations(_0x4448c1){const _0x3d30d1=a32_0xfb112d,_0x36f293=[...new Set(_0x4448c1['map'](_0x222b04=>_0x222b04[_0x3d30d1(0xeb)]))];return _0x36f293[_0x3d30d1(0x104)](',\x20');}
1
+ const a32_0x374517=a32_0x3ce6;(function(_0x2d0c2a,_0x1f0656){const _0xcf2703=a32_0x3ce6,_0x37af45=_0x2d0c2a();while(!![]){try{const _0x36a40c=-parseInt(_0xcf2703(0x1f1))/0x1*(-parseInt(_0xcf2703(0x215))/0x2)+-parseInt(_0xcf2703(0x1ee))/0x3+-parseInt(_0xcf2703(0x1f4))/0x4*(-parseInt(_0xcf2703(0x1f5))/0x5)+-parseInt(_0xcf2703(0x1eb))/0x6*(-parseInt(_0xcf2703(0x208))/0x7)+-parseInt(_0xcf2703(0x201))/0x8*(-parseInt(_0xcf2703(0x202))/0x9)+parseInt(_0xcf2703(0x203))/0xa*(parseInt(_0xcf2703(0x1ec))/0xb)+-parseInt(_0xcf2703(0x209))/0xc;if(_0x36a40c===_0x1f0656)break;else _0x37af45['push'](_0x37af45['shift']());}catch(_0x299fde){_0x37af45['push'](_0x37af45['shift']());}}}(a32_0x13eb,0x57d95));function a32_0x3ce6(_0x437550,_0xa0a9f5){_0x437550=_0x437550-0x1dc;const _0x13eb25=a32_0x13eb();let _0x3ce66a=_0x13eb25[_0x437550];return _0x3ce66a;}import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x2cb720 from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x374517(0x216)]=a32_0x374517(0x1ef);[a32_0x374517(0x1fc)]=a32_0x374517(0x21a);async[a32_0x374517(0x1dd)](_0x10f10d){const _0x54e1b3=a32_0x374517,{options:_0x511821,tdx:_0x4e870e}=_0x10f10d,_0x12f20e=await withSpinner(_0x54e1b3(0x1ea),async()=>{const _0x188597=_0x54e1b3,[_0x247a4e,_0x50d62f]=await Promise[_0x188597(0x1f2)]([_0x4e870e[_0x188597(0x217)][_0x188597(0x1f9)](),_0x4e870e['policy'][_0x188597(0x204)]()]);return{'userInfo':_0x247a4e,'permissions':_0x50d62f};},{'verbose':_0x511821[_0x54e1b3(0x1e8)]}),{userInfo:_0x57d89f,permissions:_0x409ea5}=_0x12f20e['data'];if(isStructuredFormat(_0x511821))return await handleSingleObjectOutput(_0x409ea5,_0x511821),0x0;const _0x4620bd=_0x57d89f[_0x54e1b3(0x1fa)]?'Account\x20Owner':_0x57d89f[_0x54e1b3(0x1fe)]?_0x54e1b3(0x1e2):'Member';console[_0x54e1b3(0x1de)]('\x0a'+a32_0x2cb720[_0x54e1b3(0x1e9)]('👤')+'\x20'+a32_0x2cb720[_0x54e1b3(0x1e9)](_0x57d89f[_0x54e1b3(0x216)])+'\x20'+a32_0x2cb720[_0x54e1b3(0x219)]('('+_0x57d89f[_0x54e1b3(0x20f)]+')')+_0x54e1b3(0x21b)+_0x4620bd),console[_0x54e1b3(0x1de)](a32_0x2cb720[_0x54e1b3(0x219)](_0x54e1b3(0x1df)+_0x4e870e[_0x54e1b3(0x1f6)]['site']+':'+_0x57d89f[_0x54e1b3(0x1ff)]+_0x54e1b3(0x1e0)+_0x57d89f['id']));const _0x3d6259=_0x409ea5[_0x54e1b3(0x1f3)];console[_0x54e1b3(0x1de)]('\x0a'+a32_0x2cb720['bold']('📋\x20Assigned\x20Policies')+'\x20('+_0x3d6259[_0x54e1b3(0x1e5)]+'):');if(_0x3d6259[_0x54e1b3(0x1e5)]===0x0)console[_0x54e1b3(0x1de)](a32_0x2cb720[_0x54e1b3(0x219)](_0x54e1b3(0x1fd)));else for(const _0x52cde5 of _0x3d6259){console[_0x54e1b3(0x1de)](_0x54e1b3(0x1e3)+_0x52cde5['name']);}return printPermissionsMap(_0x409ea5[_0x54e1b3(0x200)]),console[_0x54e1b3(0x1de)](),0x0;}}export class PolicyListCommand extends BaseCommand{['name']=a32_0x374517(0x207);[a32_0x374517(0x1fc)]='List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)';async['execute'](_0x50a043){const _0x55a35b=a32_0x374517,{options:_0x5599f2,tdx:_0x7273c0}=_0x50a043,_0x3fa8f6=await withSpinner('Listing\x20policies...',()=>_0x7273c0[_0x55a35b(0x1ef)][_0x55a35b(0x212)](),{'verbose':_0x5599f2[_0x55a35b(0x1e8)]}),_0x12c0fa=_0x3fa8f6[_0x55a35b(0x218)];console[_0x55a35b(0x20b)]('✔\x20Found\x20'+_0x12c0fa['length']+_0x55a35b(0x1f8)+(_0x12c0fa[_0x55a35b(0x1e5)]!==0x1?_0x55a35b(0x1e4):'y'));if(isStructuredFormat(_0x5599f2))return await handleSDKOutput(_0x12c0fa,_0x5599f2),0x0;if(_0x12c0fa[_0x55a35b(0x1e5)]===0x0)console[_0x55a35b(0x1de)](a32_0x2cb720[_0x55a35b(0x219)](_0x55a35b(0x1e1)));else for(const _0x46e8ed of _0x12c0fa){const _0x58fdf6=_0x46e8ed['description']?a32_0x2cb720[_0x55a35b(0x219)](_0x55a35b(0x21b)+_0x46e8ed[_0x55a35b(0x1fc)]):'';console[_0x55a35b(0x1de)]('\x20\x20•\x20'+_0x46e8ed[_0x55a35b(0x216)]+_0x58fdf6);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x374517(0x216)]=a32_0x374517(0x20c);[a32_0x374517(0x1fc)]=a32_0x374517(0x1e6);[a32_0x374517(0x20a)](_0xb6bd3b){const _0x1517de=a32_0x374517;if(_0xb6bd3b[_0x1517de(0x1f0)]['length']===0x0)return _0x1517de(0x206);return undefined;}async[a32_0x374517(0x1dd)](_0xd0a040){const _0x591ddd=a32_0x374517,{options:_0x1f4e89,tdx:_0x160fb4}=_0xd0a040,_0x40b78d=_0xd0a040[_0x591ddd(0x1f0)][0x0],_0x33e238=await withSpinner(_0x591ddd(0x1e7),async()=>{const _0x45366f=_0x591ddd,_0x482fb8=await _0x160fb4['policy'][_0x45366f(0x205)](_0x40b78d),[_0x1c5cb1,_0xc0de59]=await Promise[_0x45366f(0x1f2)]([_0x160fb4['policy'][_0x45366f(0x1ed)](_0x482fb8['id']),_0x160fb4[_0x45366f(0x1ef)]['getPolicyUsers'](_0x482fb8['id'])]);return{'policy':_0x482fb8,'perms':_0x1c5cb1,'users':_0xc0de59};},{'verbose':_0x1f4e89['verbose']}),{policy:_0x2fc3cc,perms:_0xc9214d,users:_0x4971a3}=_0x33e238[_0x591ddd(0x218)];if(isStructuredFormat(_0x1f4e89))return await handleSingleObjectOutput({..._0x2fc3cc,'permissions':_0xc9214d[_0x591ddd(0x200)],'users':_0x4971a3},_0x1f4e89),0x0;console[_0x591ddd(0x1de)]('\x0a'+a32_0x2cb720[_0x591ddd(0x1e9)]('📋')+'\x20'+a32_0x2cb720[_0x591ddd(0x1e9)](_0x2fc3cc[_0x591ddd(0x216)])+'\x20'+a32_0x2cb720[_0x591ddd(0x219)](_0x591ddd(0x20e)+_0x2fc3cc['id']+')'));_0x2fc3cc['description']&&console['log'](_0x591ddd(0x1df)+a32_0x2cb720[_0x591ddd(0x219)](_0x2fc3cc[_0x591ddd(0x1fc)]));console[_0x591ddd(0x1de)](_0x591ddd(0x1df)+_0x4971a3[_0x591ddd(0x1e5)]+_0x591ddd(0x1fb)+(_0x4971a3[_0x591ddd(0x1e5)]!==0x1?'s':'')+_0x591ddd(0x210)),printPermissionsMap(_0xc9214d['permissions']);if(_0x4971a3[_0x591ddd(0x1e5)]>0x0){console[_0x591ddd(0x1de)]('\x0a'+a32_0x2cb720['bold'](_0x591ddd(0x1dc))+':');for(const _0x2216cc of _0x4971a3){const _0x5ba833=_0x2216cc['email']&&_0x2216cc[_0x591ddd(0x20f)]!==_0x2216cc[_0x591ddd(0x216)]?a32_0x2cb720[_0x591ddd(0x219)]('\x20<'+_0x2216cc['email']+'>'):'';console[_0x591ddd(0x1de)]('\x20\x20•\x20'+_0x2216cc[_0x591ddd(0x216)]+_0x5ba833);}}return console[_0x591ddd(0x1de)](),0x0;}}function printPermissionsMap(_0x4dfd29){const _0x8cf4b6=a32_0x374517,_0x5d64c3=Object[_0x8cf4b6(0x214)](_0x4dfd29);console[_0x8cf4b6(0x1de)]('\x0a'+a32_0x2cb720[_0x8cf4b6(0x1e9)](_0x8cf4b6(0x1f7))+':');if(_0x5d64c3[_0x8cf4b6(0x1e5)]===0x0){console['log'](a32_0x2cb720[_0x8cf4b6(0x219)](_0x8cf4b6(0x213)));return;}const _0x1f1ef9=Math['max'](..._0x5d64c3[_0x8cf4b6(0x20d)](([_0x3d4c13])=>_0x3d4c13[_0x8cf4b6(0x1e5)]));for(const [_0x3a3e1d,_0x428e2a]of _0x5d64c3){const _0x2bca8c=formatOperations(_0x428e2a);console[_0x8cf4b6(0x1de)]('\x20\x20'+_0x3a3e1d[_0x8cf4b6(0x211)](_0x1f1ef9+0x2)+_0x2bca8c);}}function formatOperations(_0x593abb){const _0x3516af=[...new Set(_0x593abb['map'](_0x30a12a=>_0x30a12a['operation']))];return _0x3516af['join'](',\x20');}function a32_0x13eb(){const _0x288b68=['policy\x20show','map','(ID:\x20','email','\x20assigned','padEnd','listPolicies','\x20\x20No\x20permissions','entries','95918anWkMN','name','user','data','dim','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','\x20—\x20','👥\x20Assigned\x20Users','execute','log','\x20\x20\x20',',\x20user_id:','No\x20policies\x20found','Administrator','\x20\x20•\x20','ies','length','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','Fetching\x20policy...','verbose','bold','Fetching\x20permissions...','186132jwoSpb','4966830NMnsWS','getPolicyPermissions','1369290YpgppC','policy','args','5jMTJwP','all','policies','4EMyMeX','2043595XeiGtx','context','🔑\x20Effective\x20Permissions','\x20polic','getCurrent','account_owner','\x20user','description','\x20\x20No\x20policies\x20assigned','administrator','account_id','permissions','6464QVUePX','3204KzChdR','10iBVFER','getMyPermissions','getPolicy','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','policy\x20list','161HjOUKQ','15419268JQBdbb','validate','error'];a32_0x13eb=function(){return _0x288b68;};return a32_0x13eb();}
@@ -1 +1 @@
1
- const a33_0x49df6b=a33_0x543e;(function(_0x3774de,_0x473539){const _0x4367a1=a33_0x543e,_0x164e55=_0x3774de();while(!![]){try{const _0xc7d011=parseInt(_0x4367a1(0x1de))/0x1*(-parseInt(_0x4367a1(0x1ef))/0x2)+-parseInt(_0x4367a1(0x1b5))/0x3*(parseInt(_0x4367a1(0x1d2))/0x4)+parseInt(_0x4367a1(0x1d7))/0x5+parseInt(_0x4367a1(0x1e8))/0x6+-parseInt(_0x4367a1(0x1dd))/0x7*(parseInt(_0x4367a1(0x1bd))/0x8)+parseInt(_0x4367a1(0x1eb))/0x9*(parseInt(_0x4367a1(0x1d3))/0xa)+-parseInt(_0x4367a1(0x1b1))/0xb;if(_0xc7d011===_0x473539)break;else _0x164e55['push'](_0x164e55['shift']());}catch(_0x3baa6c){_0x164e55['push'](_0x164e55['shift']());}}}(a33_0x604e,0x19281));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_0x49908d from'node:path';function a33_0x604e(){const _0x433e9c=['apiKey','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','llm_project','Removal\x20cancelled','Unknown\x20key\x20\x27','/app/mp/ak','yellow','tdx.json','Enter\x20your\x20TD\x20API\x20key:','VALID_KEYS','Site\x20was\x20not\x20changed.','name','Removed\x20existing\x20profile\x20\x27','Setup\x20cancelled','Profile\x20\x27','414645KjunkA','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Profile\x20name\x20cannot\x20be\x20empty','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','483021RnjaTw','warn','profile:set','(session:\x20','database','Changing\x20site\x20to\x20\x27','\x20Profile\x20\x27','parent_segment','8jDjIyT','validate','tdx:\x20profile\x20create','\x20\x20(no\x20profiles\x20found)','includes','site','Validating\x20API\x20key...','session','You\x20can\x20find\x20your\x20API\x20key\x20at:','error','ERROR','jobs','✗\x20Validation\x20failed:\x20','bold','create','profile','Set\x20session\x20profile','status','red','\x0aSetup\x20cancelled','\x20--default\x27\x20to\x20save\x20permanently','4FkSVef','1605670zFMbGd','\x20API\x20key\x20is\x20valid\x20(User:\x20','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','getUserInfo','626110PBsSWl','us01','dim','\x20API\x20key\x20saved\x20to\x20system\x20keychain','log','password','347739YzyAfA','76889wIRkvy','\x0aAvailable\x20profiles:','profile:create','Delete\x20a\x20profile','profile:delete','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','green','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','logLevel','execute','855120kZXpSd','\x27\x20created','(cleared)','9hGKpDq','split','description','config','2NJLfQE','profileName','confirm','email','\x27\x20deleted','\x20\x20-\x20','message','test','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Failed\x20to\x20delete\x20profile:\x20','\x27.\x0a\x0aValid\x20keys:\x20','\x27\x20does\x20not\x20exist.\x20Create\x20it?','Enter\x20profile\x20name:','\x0aOperation\x20cancelled','length','trim','llm_agent','\x27\x20requires\x20API\x20key\x20validation.','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','\x20\x20tdx\x20--profile\x20','join','Operation\x20cancelled','API\x20key\x20cannot\x20be\x20empty','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','default','Set\x20a\x20profile\x20configuration\x20value','skipExistsCheck'];a33_0x604e=function(){return _0x433e9c;};return a33_0x604e();}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_0x1b514e from'prompts';import a33_0x5d2c3c from'chalk';function validateProfileName(_0x333fd6,_0x1c6235){const _0x3cbbe4=a33_0x543e;if(!_0x333fd6||!_0x333fd6['trim']())return _0x3cbbe4(0x1b3);const _0x45edb4=_0x333fd6[_0x3cbbe4(0x1fe)]();if(!/^[a-zA-Z0-9_-]+$/[_0x3cbbe4(0x1f6)](_0x45edb4))return _0x3cbbe4(0x1d5);if(!_0x1c6235?.[_0x3cbbe4(0x1a1)]&&profileExists(_0x45edb4))return _0x3cbbe4(0x1b0)+_0x45edb4+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20'+_0x45edb4+_0x3cbbe4(0x1e3);return!![];}async function deleteProfileAndCredentials(_0x3e4880){removeProfileFromUserConfig(_0x3e4880);const _0x54cddc=await isKeychainAvailable();_0x54cddc&&await Promise['all']([deleteKeychainAPIKey(_0x3e4880),deleteOAuthTokens(_0x3e4880)]);}export class ProfileCreateCommand extends BaseCommand{['name']=a33_0x49df6b(0x1e0);['description']='Create\x20a\x20new\x20profile';async[a33_0x49df6b(0x1e7)](_0x29ef0e){const _0xacc9f9=a33_0x49df6b,{options:_0xd2184d,args:_0x2f28d4}=_0x29ef0e,_0x31b863=!!_0xd2184d['force'];console['log'](a33_0x5d2c3c[_0xacc9f9(0x1ca)](_0xacc9f9(0x1bf)));let _0x2adae0;if(_0x2f28d4[_0xacc9f9(0x1fd)]>0x0&&_0x2f28d4[0x0]){const _0x51d721=_0x2f28d4[0x0]['trim']();_0x31b863&&profileExists(_0x51d721)&&(await deleteProfileAndCredentials(_0x51d721),console[_0xacc9f9(0x1db)](_0xacc9f9(0x1ae)+_0x51d721+'\x27'));const _0x3a8d1e=validateProfileName(_0x51d721);if(_0x3a8d1e!==!![])return console[_0xacc9f9(0x1c6)](a33_0x5d2c3c[_0xacc9f9(0x1cf)](_0x3a8d1e)),0x1;_0x2adae0=_0x51d721;}else{const _0x2bb1ab=await a33_0x1b514e({'type':'text','name':_0xacc9f9(0x1f0),'message':_0xacc9f9(0x1fb),'validate':_0x2d0f9d=>validateProfileName(_0x2d0f9d,{'skipExistsCheck':_0x31b863})});if(!_0x2bb1ab[_0xacc9f9(0x1f0)])return console[_0xacc9f9(0x1db)]('\x0aSetup\x20cancelled'),0x1;_0x2adae0=_0x2bb1ab[_0xacc9f9(0x1f0)]['trim'](),_0x31b863&&profileExists(_0x2adae0)&&(await deleteProfileAndCredentials(_0x2adae0),console['log'](_0xacc9f9(0x1ae)+_0x2adae0+'\x27'));}const _0x2cf222=await a33_0x1b514e({'type':'text','name':_0xacc9f9(0x1ed),'message':'Enter\x20description\x20(optional):'}),_0x3642ea=_0x2cf222[_0xacc9f9(0x1ed)]?.[_0xacc9f9(0x1fe)]()||undefined,_0x22d1e4=_0xd2184d[_0xacc9f9(0x1c2)]||_0xacc9f9(0x1d8),_0x23ef16=await promptSiteSelection(_0x22d1e4,_0x2adae0,_0xacc9f9(0x1af));if(!_0x23ef16)return 0x1;const _0x119ef9=resolveSite(_0x23ef16),_0x46f2aa=await promptAuthMethod();if(!_0x46f2aa)return console['log'](_0xacc9f9(0x1d0)),0x1;if(_0x46f2aa==='oauth'){if(_0x3642ea){const _0x3dac6a={'site':_0x119ef9,'description':_0x3642ea};saveProfileToUserConfig(_0x2adae0,_0x3dac6a);}const {accountName:_0x5d8c35}=_0xd2184d;return await runOAuthLoginFlow(_0x119ef9,_0x2adae0,_0xd2184d[_0xacc9f9(0x1e6)]??LogLevel[_0xacc9f9(0x1c7)],{'accountName':_0x5d8c35}),0x0;}console[_0xacc9f9(0x1db)](_0xacc9f9(0x1f7)+_0x119ef9),console[_0xacc9f9(0x1db)](_0xacc9f9(0x1c5)),console[_0xacc9f9(0x1db)]('\x20\x20'+getConsoleUrl(_0x119ef9,_0xacc9f9(0x1a7)));const _0xbe6a5a=await a33_0x1b514e({'type':_0xacc9f9(0x1dc),'name':_0xacc9f9(0x1a2),'message':_0xacc9f9(0x1aa),'validate':_0x561327=>{const _0x1a74f3=_0xacc9f9;if(!_0x561327||!_0x561327[_0x1a74f3(0x1fe)]())return _0x1a74f3(0x19d);return!![];}});if(!_0xbe6a5a[_0xacc9f9(0x1a2)])return console[_0xacc9f9(0x1db)](_0xacc9f9(0x1d0)),0x1;const _0x130c6e=_0xbe6a5a[_0xacc9f9(0x1a2)];console[_0xacc9f9(0x1db)]('Validating\x20API\x20key...');try{const _0x2688ad=TDX['create']({'site':_0x119ef9,'apiKey':_0x130c6e[_0xacc9f9(0x1fe)](),'logLevel':_0xd2184d[_0xacc9f9(0x1e6)]??LogLevel[_0xacc9f9(0x1c7)]}),_0x28d8c2=await _0x2688ad[_0xacc9f9(0x1c8)][_0xacc9f9(0x1d6)]();console[_0xacc9f9(0x1db)](a33_0x5d2c3c[_0xacc9f9(0x1e4)]('✓')+_0xacc9f9(0x1d4)+_0x28d8c2[_0xacc9f9(0x1f2)]+')');const _0x5104d2=await isKeychainAvailable();_0x5104d2?(await saveAPIKeyAsync(_0x130c6e[_0xacc9f9(0x1fe)](),_0x119ef9,_0x2adae0),console[_0xacc9f9(0x1db)](a33_0x5d2c3c[_0xacc9f9(0x1e4)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x2adae0+')')):(console['warn'](a33_0x5d2c3c[_0xacc9f9(0x1a8)](_0xacc9f9(0x1b2))),console[_0xacc9f9(0x1b6)](a33_0x5d2c3c['yellow']('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0xbc1e={'site':_0x119ef9,..._0x3642ea&&{'description':_0x3642ea}};return saveProfileToUserConfig(_0x2adae0,_0xbc1e),console[_0xacc9f9(0x1db)](a33_0x5d2c3c[_0xacc9f9(0x1e4)]('✓')+_0xacc9f9(0x1bb)+_0x2adae0+_0xacc9f9(0x1e9)),console[_0xacc9f9(0x1db)](),console[_0xacc9f9(0x1db)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console['log'](_0xacc9f9(0x203)+_0x2adae0+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0xacc9f9(0x1db)]('\x20\x20tdx\x20--profile\x20'+_0x2adae0+_0xacc9f9(0x1e5)),0x0;}catch(_0x5d8750){if(_0x5d8750 instanceof HTTPClientError&&_0x5d8750['status']===0x191)return printAuthError(_0x5d8750),0x1;return console[_0xacc9f9(0x1c6)](a33_0x5d2c3c[_0xacc9f9(0x1cf)]('✗\x20Validation\x20failed:\x20'+(_0x5d8750 instanceof Error?_0x5d8750[_0xacc9f9(0x1f5)]:String(_0x5d8750)))),console[_0xacc9f9(0x1c6)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}function a33_0x543e(_0x2d03ec,_0x3254f3){_0x2d03ec=_0x2d03ec-0x19d;const _0x604e5d=a33_0x604e();let _0x543e5f=_0x604e5d[_0x2d03ec];return _0x543e5f;}export class ProfileDeleteCommand extends BaseCommand{[a33_0x49df6b(0x1ad)]=a33_0x49df6b(0x1e2);[a33_0x49df6b(0x1ed)]=a33_0x49df6b(0x1e1);[a33_0x49df6b(0x1be)](_0x11bf82){const _0x274b92=a33_0x49df6b,{args:_0x4173be}=_0x11bf82;if(_0x4173be[_0x274b92(0x1fd)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>';return undefined;}async[a33_0x49df6b(0x1e7)](_0x10c5dc){const _0x594c4c=a33_0x49df6b,{args:_0x2594be}=_0x10c5dc,_0x5420f5=_0x2594be[0x0];console[_0x594c4c(0x1db)](a33_0x5d2c3c['bold']('tdx:\x20profile\x20delete'));if(!profileExists(_0x5420f5)){console[_0x594c4c(0x1c6)](a33_0x5d2c3c[_0x594c4c(0x1cf)]('Profile\x20\x27'+_0x5420f5+'\x27\x20does\x20not\x20exist.')),console[_0x594c4c(0x1db)]('\x0aAvailable\x20profiles:');const _0x1fbcbf=listProfiles();if(_0x1fbcbf[_0x594c4c(0x1fd)]===0x0)console[_0x594c4c(0x1db)](_0x594c4c(0x1c0));else for(const _0x2e61ec of _0x1fbcbf){console['log'](_0x594c4c(0x1f4)+_0x2e61ec['name']);}return 0x1;}const _0x1ecea2=await a33_0x1b514e({'type':'confirm','name':_0x594c4c(0x1f1),'message':_0x594c4c(0x19e)+_0x5420f5+'\x27?','initial':![]});if(!_0x1ecea2[_0x594c4c(0x1f1)])return console[_0x594c4c(0x1db)](_0x594c4c(0x1a5)),0x0;try{await deleteProfileAndCredentials(_0x5420f5),console[_0x594c4c(0x1db)](a33_0x5d2c3c[_0x594c4c(0x1e4)]('✓')+_0x594c4c(0x1bb)+_0x5420f5+_0x594c4c(0x1f3));}catch(_0x4ad5e5){return console[_0x594c4c(0x1c6)](a33_0x5d2c3c['red'](_0x594c4c(0x1f8)+(_0x4ad5e5 instanceof Error?_0x4ad5e5[_0x594c4c(0x1f5)]:String(_0x4ad5e5)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0x49df6b(0x1ad)]=a33_0x49df6b(0x1b7);[a33_0x49df6b(0x1ed)]=a33_0x49df6b(0x1a0);static [a33_0x49df6b(0x1ab)]=[a33_0x49df6b(0x1c2),a33_0x49df6b(0x1b9),a33_0x49df6b(0x1bc),a33_0x49df6b(0x1a4),a33_0x49df6b(0x1ff),a33_0x49df6b(0x1ed)];[a33_0x49df6b(0x1be)](_0x46bf9f){const _0x41ef33=a33_0x49df6b,{args:_0x2e046f,options:_0x8ab80a}=_0x46bf9f,_0x109282=_0x8ab80a['profile']||getActiveProfile();if(!_0x109282)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(_0x2e046f['length']===0x0)return _0x41ef33(0x1a3)+ProfileSetCommand['VALID_KEYS'][_0x41ef33(0x204)](',\x20');const _0x69af0d=_0x2e046f[0x0];if(!_0x69af0d[_0x41ef33(0x1c1)]('='))return _0x41ef33(0x1b4)+ProfileSetCommand[_0x41ef33(0x1ab)][_0x41ef33(0x204)](',\x20');const [_0x5de66d]=_0x69af0d[_0x41ef33(0x1ec)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x41ef33(0x1c1)](_0x5de66d))return _0x41ef33(0x1a6)+_0x5de66d+_0x41ef33(0x1f9)+ProfileSetCommand[_0x41ef33(0x1ab)][_0x41ef33(0x204)](',\x20');return undefined;}async['execute'](_0x59f96f){const _0x35c0fd=a33_0x49df6b,{args:_0x2ce5b3,options:_0x50ca72}=_0x59f96f,_0x48f393=_0x50ca72[_0x35c0fd(0x1cc)]||getActiveProfile(),[_0x16bb69,..._0x306420]=_0x2ce5b3[0x0][_0x35c0fd(0x1ec)]('='),_0x2e44e3=_0x306420[_0x35c0fd(0x204)]('=');console[_0x35c0fd(0x1db)](a33_0x5d2c3c['bold']('tdx:\x20profile\x20set'));if(!profileExists(_0x48f393)){const _0x134c09=await a33_0x1b514e({'type':'confirm','name':_0x35c0fd(0x1cb),'message':_0x35c0fd(0x1b0)+_0x48f393+_0x35c0fd(0x1fa),'initial':!![]});if(!_0x134c09['create'])return console[_0x35c0fd(0x1db)](_0x35c0fd(0x205)),0x1;}const _0x54b984=loadProfile(_0x48f393),_0x5affe3=_0x54b984?.[_0x35c0fd(0x1ee)]||{};if(_0x16bb69===_0x35c0fd(0x1c2)){const _0x24b994=resolveSite(_0x2e44e3);console[_0x35c0fd(0x1db)](_0x35c0fd(0x1ba)+_0x24b994+_0x35c0fd(0x200)),console[_0x35c0fd(0x1db)](_0x35c0fd(0x202)),console[_0x35c0fd(0x1db)]('\x20\x20'+getConsoleUrl(_0x24b994,_0x35c0fd(0x1a7)));const _0xedb120=await a33_0x1b514e({'type':_0x35c0fd(0x1dc),'name':_0x35c0fd(0x1a2),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x2a2ccb=>{const _0x12ee87=_0x35c0fd;if(!_0x2a2ccb||!_0x2a2ccb['trim']())return _0x12ee87(0x19d);return!![];}});if(!_0xedb120['apiKey'])return console[_0x35c0fd(0x1db)](_0x35c0fd(0x1fc)),0x1;console[_0x35c0fd(0x1db)](_0x35c0fd(0x1c3));try{const _0x5d686c=TDX['create']({'site':_0x24b994,'apiKey':_0xedb120[_0x35c0fd(0x1a2)][_0x35c0fd(0x1fe)](),'logLevel':_0x50ca72[_0x35c0fd(0x1e6)]??LogLevel[_0x35c0fd(0x1c7)]}),_0x4dd1b4=await _0x5d686c[_0x35c0fd(0x1c8)][_0x35c0fd(0x1d6)]();console[_0x35c0fd(0x1db)](a33_0x5d2c3c[_0x35c0fd(0x1e4)]('✓')+_0x35c0fd(0x1d4)+_0x4dd1b4[_0x35c0fd(0x1f2)]+')');const _0x5d0f93=await isKeychainAvailable();_0x5d0f93?(await saveAPIKeyAsync(_0xedb120['apiKey'][_0x35c0fd(0x1fe)](),_0x24b994,_0x48f393),console[_0x35c0fd(0x1db)](a33_0x5d2c3c[_0x35c0fd(0x1e4)]('✓')+_0x35c0fd(0x1da))):console[_0x35c0fd(0x1b6)](a33_0x5d2c3c[_0x35c0fd(0x1a8)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x5affe3['site']=_0x24b994;}catch(_0x217698){if(_0x217698 instanceof HTTPClientError&&_0x217698[_0x35c0fd(0x1ce)]===0x191)return printAuthError(_0x217698),0x1;return console[_0x35c0fd(0x1c6)](a33_0x5d2c3c['red'](_0x35c0fd(0x1c9)+(_0x217698 instanceof Error?_0x217698[_0x35c0fd(0x1f5)]:String(_0x217698)))),console['error'](_0x35c0fd(0x1ac)),0x1;}}else _0x5affe3[_0x16bb69]=_0x2e44e3||undefined;return saveProfileToUserConfig(_0x48f393,_0x5affe3),console[_0x35c0fd(0x1db)](a33_0x5d2c3c[_0x35c0fd(0x1e4)]('✓')+'\x20Profile\x20\x27'+_0x48f393+'\x27\x20updated:\x20'+_0x16bb69+'='+(_0x2e44e3||_0x35c0fd(0x1ea))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x49df6b(0x1ad)]='profile:use';[a33_0x49df6b(0x1ed)]=a33_0x49df6b(0x1cd);[a33_0x49df6b(0x1be)](_0x2d90f4){const _0x3aa99f=a33_0x49df6b,{args:_0x536682}=_0x2d90f4;if(_0x536682[_0x3aa99f(0x1fd)]===0x0)return _0x3aa99f(0x201);return undefined;}async['execute'](_0x34977d){const _0xc4cf74=a33_0x49df6b,{args:_0x241738,options:_0x26b4f6}=_0x34977d,_0x410d68=_0x241738[0x0],_0xdc69ad=_0x26b4f6[_0xc4cf74(0x19f)];cleanExpiredSessions();if(!profileExists(_0x410d68)){console['error'](a33_0x5d2c3c[_0xc4cf74(0x1cf)]('Profile\x20\x27'+_0x410d68+'\x27\x20does\x20not\x20exist.')),console[_0xc4cf74(0x1db)](_0xc4cf74(0x1df));const _0x353e29=listProfiles();if(_0x353e29['length']===0x0)console[_0xc4cf74(0x1db)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x15f4ea of _0x353e29){console['log'](_0xc4cf74(0x1f4)+_0x15f4ea[_0xc4cf74(0x1ad)]);}return 0x1;}if(_0xdc69ad){const _0x329062=a33_0x49908d['join'](getConfigDir(),_0xc4cf74(0x1a9));return saveActiveProfileToUserConfig(_0x410d68),console[_0xc4cf74(0x1db)]('Default\x20profile\x20set\x20to:\x20'+a33_0x5d2c3c[_0xc4cf74(0x1e4)](_0x410d68)),console['log'](a33_0x5d2c3c[_0xc4cf74(0x1d9)]('\x0aSaved\x20to:\x20'+_0x329062)),0x0;}const _0x31bb0b=getSessionID(_0x26b4f6[_0xc4cf74(0x1c4)]);return saveSessionContext({'profile':_0x410d68},_0x26b4f6[_0xc4cf74(0x1c4)]),console['log']('Session\x20profile\x20set\x20to:\x20'+a33_0x5d2c3c[_0xc4cf74(0x1e4)](_0x410d68)+'\x20'+a33_0x5d2c3c['dim'](_0xc4cf74(0x1b8)+_0x31bb0b+')')),console[_0xc4cf74(0x1db)](a33_0x5d2c3c[_0xc4cf74(0x1d9)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x410d68+_0xc4cf74(0x1d1))),0x0;}}
1
+ const a33_0x28a6c7=a33_0x5aa5;function a33_0x5aa5(_0x5dae64,_0x6df216){_0x5dae64=_0x5dae64-0xa4;const _0x133d34=a33_0x133d();let _0x5aa579=_0x133d34[_0x5dae64];return _0x5aa579;}(function(_0x30183f,_0xd48b1e){const _0x120779=a33_0x5aa5,_0x3af650=_0x30183f();while(!![]){try{const _0x5c79a7=-parseInt(_0x120779(0xd4))/0x1+parseInt(_0x120779(0xff))/0x2*(parseInt(_0x120779(0xfe))/0x3)+parseInt(_0x120779(0xf3))/0x4*(parseInt(_0x120779(0xd3))/0x5)+-parseInt(_0x120779(0xb4))/0x6*(parseInt(_0x120779(0xb8))/0x7)+parseInt(_0x120779(0xd0))/0x8*(-parseInt(_0x120779(0xac))/0x9)+parseInt(_0x120779(0xf1))/0xa+-parseInt(_0x120779(0xdf))/0xb*(-parseInt(_0x120779(0xeb))/0xc);if(_0x5c79a7===_0xd48b1e)break;else _0x3af650['push'](_0x3af650['shift']());}catch(_0x2a6f16){_0x3af650['push'](_0x3af650['shift']());}}}(a33_0x133d,0x97646));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_0x6fd7f 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_0x25d473 from'prompts';import a33_0x5afa2b from'chalk';function validateProfileName(_0x210627,_0x52aa7a){const _0x4c163f=a33_0x5aa5;if(!_0x210627||!_0x210627[_0x4c163f(0xed)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x2fe813=_0x210627[_0x4c163f(0xed)]();if(!/^[a-zA-Z0-9_-]+$/[_0x4c163f(0xb5)](_0x2fe813))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(!_0x52aa7a?.[_0x4c163f(0xb0)]&&profileExists(_0x2fe813))return _0x4c163f(0xef)+_0x2fe813+_0x4c163f(0x100)+_0x2fe813+_0x4c163f(0xf0);return!![];}async function deleteProfileAndCredentials(_0x4a09f7){const _0x3635c6=a33_0x5aa5;removeProfileFromUserConfig(_0x4a09f7);const _0xe0fe1d=await isKeychainAvailable();_0xe0fe1d&&await Promise[_0x3635c6(0xc6)]([deleteKeychainAPIKey(_0x4a09f7),deleteOAuthTokens(_0x4a09f7)]);}function a33_0x133d(){const _0x374f2f=['\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','4692630IciyzB','\x27\x20updated:\x20','996NVAyRT','Enter\x20your\x20TD\x20API\x20key:','execute','password','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','text','Validating\x20API\x20key...','green','Operation\x20cancelled','tdx.json','Session\x20profile\x20set\x20to:\x20','2697EhKSpX','2118PMWMWJ','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','split','email','Removal\x20cancelled','length','(session:\x20','site','parent_segment','Default\x20profile\x20set\x20to:\x20','confirm','Enter\x20description\x20(optional):','Set\x20session\x20profile','Create\x20a\x20new\x20profile','\x20\x20tdx\x20--profile\x20','Removed\x20existing\x20profile\x20\x27','You\x20can\x20find\x20your\x20API\x20key\x20at:','includes','Set\x20a\x20profile\x20configuration\x20value','\x0aOperation\x20cancelled','name','✗\x20Validation\x20failed:\x20','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Site\x20was\x20not\x20changed.','warn','apiKey','yellow','ERROR','red','9TkTAje','llm_project','profileName','VALID_KEYS','skipExistsCheck','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','message','error','24YvgilA','test','\x0aSetup\x20cancelled','dim','1826027yojmyP','llm_agent','\x20\x20(no\x20profiles\x20found)','\x20--default\x27\x20to\x20save\x20permanently','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','bold','logLevel','(cleared)','status','log','\x27\x20created','profile:delete','Enter\x20profile\x20name:','profile','all','join','validate','\x27.\x0a\x0aValid\x20keys:\x20','profile:use','database','tdx:\x20profile\x20delete','getUserInfo','jobs','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','3578280JgDRMs','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','tdx:\x20profile\x20set','15485xUeMZz','1194524ccrLSS','\x27\x20requires\x20API\x20key\x20validation.','config','\x20\x20-\x20','\x0aAvailable\x20profiles:','default','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','Failed\x20to\x20delete\x20profile:\x20','create','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','API\x20key\x20cannot\x20be\x20empty','6120939bmNhAq','session','Changing\x20site\x20to\x20\x27','description','profile:set','\x20Profile\x20\x27','us01','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x0aSaved\x20to:\x20','Unknown\x20key\x20\x27','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','\x27\x20does\x20not\x20exist.\x20Create\x20it?','24XGKBOb','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','trim','\x20API\x20key\x20is\x20valid\x20(User:\x20','Profile\x20\x27'];a33_0x133d=function(){return _0x374f2f;};return a33_0x133d();}export class ProfileCreateCommand extends BaseCommand{[a33_0x28a6c7(0x115)]='profile:create';['description']=a33_0x28a6c7(0x10e);async[a33_0x28a6c7(0xf5)](_0x3fec3c){const _0x476d9b=a33_0x28a6c7,{options:_0x57ba9c,args:_0xb1fcec}=_0x3fec3c,_0x3a69c6=!!_0x57ba9c['force'];console[_0x476d9b(0xc1)](a33_0x5afa2b[_0x476d9b(0xbd)]('tdx:\x20profile\x20create'));let _0x47b4d7;if(_0xb1fcec[_0x476d9b(0x106)]>0x0&&_0xb1fcec[0x0]){const _0x25151c=_0xb1fcec[0x0][_0x476d9b(0xed)]();_0x3a69c6&&profileExists(_0x25151c)&&(await deleteProfileAndCredentials(_0x25151c),console[_0x476d9b(0xc1)](_0x476d9b(0x110)+_0x25151c+'\x27'));const _0x4257c3=validateProfileName(_0x25151c);if(_0x4257c3!==!![])return console[_0x476d9b(0xb3)](a33_0x5afa2b[_0x476d9b(0xab)](_0x4257c3)),0x1;_0x47b4d7=_0x25151c;}else{const _0x1957c7=await a33_0x25d473({'type':'text','name':_0x476d9b(0xae),'message':_0x476d9b(0xc4),'validate':_0x17dff3=>validateProfileName(_0x17dff3,{'skipExistsCheck':_0x3a69c6})});if(!_0x1957c7[_0x476d9b(0xae)])return console['log'](_0x476d9b(0xb6)),0x1;_0x47b4d7=_0x1957c7['profileName'][_0x476d9b(0xed)](),_0x3a69c6&&profileExists(_0x47b4d7)&&(await deleteProfileAndCredentials(_0x47b4d7),console['log']('Removed\x20existing\x20profile\x20\x27'+_0x47b4d7+'\x27'));}const _0x1c5585=await a33_0x25d473({'type':_0x476d9b(0xf8),'name':'description','message':_0x476d9b(0x10c)}),_0x3551da=_0x1c5585['description']?.['trim']()||undefined,_0x1dc40a=_0x57ba9c[_0x476d9b(0x108)]||_0x476d9b(0xe5),_0x2515b2=await promptSiteSelection(_0x1dc40a,_0x47b4d7,'Setup\x20cancelled');if(!_0x2515b2)return 0x1;const _0x366831=resolveSite(_0x2515b2),_0x4527fb=await promptAuthMethod();if(!_0x4527fb)return console[_0x476d9b(0xc1)]('\x0aSetup\x20cancelled'),0x1;if(_0x4527fb==='oauth'){if(_0x3551da){const _0x4de27f={'site':_0x366831,'description':_0x3551da};saveProfileToUserConfig(_0x47b4d7,_0x4de27f);}const {accountName:_0xb488ae}=_0x57ba9c;return await runOAuthLoginFlow(_0x366831,_0x47b4d7,_0x57ba9c['logLevel']??LogLevel[_0x476d9b(0xaa)],{'accountName':_0xb488ae}),0x0;}console[_0x476d9b(0xc1)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x366831),console['log'](_0x476d9b(0x111)),console['log']('\x20\x20'+getConsoleUrl(_0x366831,'/app/mp/ak'));const _0x49ab42=await a33_0x25d473({'type':_0x476d9b(0xf6),'name':_0x476d9b(0xa8),'message':_0x476d9b(0xf4),'validate':_0x410346=>{const _0x3a6a3e=_0x476d9b;if(!_0x410346||!_0x410346[_0x3a6a3e(0xed)]())return _0x3a6a3e(0xde);return!![];}});if(!_0x49ab42[_0x476d9b(0xa8)])return console[_0x476d9b(0xc1)](_0x476d9b(0xb6)),0x1;const _0x3ab4af=_0x49ab42[_0x476d9b(0xa8)];console[_0x476d9b(0xc1)](_0x476d9b(0xf9));try{const _0x3f9639=TDX[_0x476d9b(0xdc)]({'site':_0x366831,'apiKey':_0x3ab4af[_0x476d9b(0xed)](),'logLevel':_0x57ba9c[_0x476d9b(0xbe)]??LogLevel[_0x476d9b(0xaa)]}),_0x403c59=await _0x3f9639[_0x476d9b(0xce)][_0x476d9b(0xcd)]();console[_0x476d9b(0xc1)](a33_0x5afa2b[_0x476d9b(0xfa)]('✓')+_0x476d9b(0xee)+_0x403c59[_0x476d9b(0x104)]+')');const _0x296b7c=await isKeychainAvailable();_0x296b7c?(await saveAPIKeyAsync(_0x3ab4af[_0x476d9b(0xed)](),_0x366831,_0x47b4d7),console[_0x476d9b(0xc1)](a33_0x5afa2b[_0x476d9b(0xfa)]('✓')+_0x476d9b(0xa5)+_0x47b4d7+')')):(console['warn'](a33_0x5afa2b[_0x476d9b(0xa9)](_0x476d9b(0xcf))),console['warn'](a33_0x5afa2b[_0x476d9b(0xa9)](_0x476d9b(0xbc))));const _0x57b6d0={'site':_0x366831,..._0x3551da&&{'description':_0x3551da}};return saveProfileToUserConfig(_0x47b4d7,_0x57b6d0),console[_0x476d9b(0xc1)](a33_0x5afa2b[_0x476d9b(0xfa)]('✓')+_0x476d9b(0xe4)+_0x47b4d7+_0x476d9b(0xc2)),console[_0x476d9b(0xc1)](),console[_0x476d9b(0xc1)](_0x476d9b(0x102)),console[_0x476d9b(0xc1)](_0x476d9b(0x10f)+_0x47b4d7+_0x476d9b(0xec)),console['log']('\x20\x20tdx\x20--profile\x20'+_0x47b4d7+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x47eb73){if(_0x47eb73 instanceof HTTPClientError&&_0x47eb73[_0x476d9b(0xc0)]===0x191)return printAuthError(_0x47eb73),0x1;return console[_0x476d9b(0xb3)](a33_0x5afa2b['red'](_0x476d9b(0xa4)+(_0x47eb73 instanceof Error?_0x47eb73[_0x476d9b(0xb2)]:String(_0x47eb73)))),console[_0x476d9b(0xb3)](_0x476d9b(0xe9)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x28a6c7(0x115)]=a33_0x28a6c7(0xc3);[a33_0x28a6c7(0xe2)]='Delete\x20a\x20profile';[a33_0x28a6c7(0xc8)](_0x52938b){const _0x345836=a33_0x28a6c7,{args:_0x2ffb13}=_0x52938b;if(_0x2ffb13[_0x345836(0x106)]===0x0)return _0x345836(0xda);return undefined;}async[a33_0x28a6c7(0xf5)](_0x3b261){const _0x204663=a33_0x28a6c7,{args:_0x7ad95f}=_0x3b261,_0x309052=_0x7ad95f[0x0];console[_0x204663(0xc1)](a33_0x5afa2b[_0x204663(0xbd)](_0x204663(0xcc)));if(!profileExists(_0x309052)){console[_0x204663(0xb3)](a33_0x5afa2b['red'](_0x204663(0xef)+_0x309052+'\x27\x20does\x20not\x20exist.')),console[_0x204663(0xc1)](_0x204663(0xd8));const _0xb035ef=listProfiles();if(_0xb035ef[_0x204663(0x106)]===0x0)console[_0x204663(0xc1)](_0x204663(0xba));else for(const _0x11d61a of _0xb035ef){console[_0x204663(0xc1)](_0x204663(0xd7)+_0x11d61a[_0x204663(0x115)]);}return 0x1;}const _0x353322=await a33_0x25d473({'type':'confirm','name':_0x204663(0x10b),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x309052+'\x27?','initial':![]});if(!_0x353322[_0x204663(0x10b)])return console[_0x204663(0xc1)](_0x204663(0x105)),0x0;try{await deleteProfileAndCredentials(_0x309052),console['log'](a33_0x5afa2b[_0x204663(0xfa)]('✓')+_0x204663(0xe4)+_0x309052+'\x27\x20deleted');}catch(_0x2ebff6){return console[_0x204663(0xb3)](a33_0x5afa2b[_0x204663(0xab)](_0x204663(0xdb)+(_0x2ebff6 instanceof Error?_0x2ebff6[_0x204663(0xb2)]:String(_0x2ebff6)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a33_0x28a6c7(0xe3);[a33_0x28a6c7(0xe2)]=a33_0x28a6c7(0x113);static [a33_0x28a6c7(0xaf)]=['site',a33_0x28a6c7(0xcb),a33_0x28a6c7(0x109),a33_0x28a6c7(0xad),a33_0x28a6c7(0xb9),a33_0x28a6c7(0xe2)];[a33_0x28a6c7(0xc8)](_0x39ad25){const _0x55c4c2=a33_0x28a6c7,{args:_0x26331b,options:_0x22b2ed}=_0x39ad25,_0x5452d2=_0x22b2ed[_0x55c4c2(0xc5)]||getActiveProfile();if(!_0x5452d2)return _0x55c4c2(0xdd);if(_0x26331b[_0x55c4c2(0x106)]===0x0)return _0x55c4c2(0xb1)+ProfileSetCommand[_0x55c4c2(0xaf)][_0x55c4c2(0xc7)](',\x20');const _0x4d6a9f=_0x26331b[0x0];if(!_0x4d6a9f['includes']('='))return _0x55c4c2(0x101)+ProfileSetCommand[_0x55c4c2(0xaf)][_0x55c4c2(0xc7)](',\x20');const [_0x47638d]=_0x4d6a9f[_0x55c4c2(0x103)]('=',0x2);if(!ProfileSetCommand[_0x55c4c2(0xaf)][_0x55c4c2(0x112)](_0x47638d))return _0x55c4c2(0xe8)+_0x47638d+_0x55c4c2(0xc9)+ProfileSetCommand[_0x55c4c2(0xaf)][_0x55c4c2(0xc7)](',\x20');return undefined;}async[a33_0x28a6c7(0xf5)](_0x25185f){const _0x21d999=a33_0x28a6c7,{args:_0x5816dd,options:_0x1092fd}=_0x25185f,_0x197707=_0x1092fd['profile']||getActiveProfile(),[_0x59edad,..._0x49a2e3]=_0x5816dd[0x0][_0x21d999(0x103)]('='),_0x14fc5e=_0x49a2e3['join']('=');console[_0x21d999(0xc1)](a33_0x5afa2b[_0x21d999(0xbd)](_0x21d999(0xd2)));if(!profileExists(_0x197707)){const _0x474986=await a33_0x25d473({'type':_0x21d999(0x10b),'name':_0x21d999(0xdc),'message':_0x21d999(0xef)+_0x197707+_0x21d999(0xea),'initial':!![]});if(!_0x474986['create'])return console[_0x21d999(0xc1)](_0x21d999(0xfb)),0x1;}const _0x270d63=loadProfile(_0x197707),_0x37e0d5=_0x270d63?.[_0x21d999(0xd6)]||{};if(_0x59edad==='site'){const _0xf18f66=resolveSite(_0x14fc5e);console[_0x21d999(0xc1)](_0x21d999(0xe1)+_0xf18f66+_0x21d999(0xd5)),console[_0x21d999(0xc1)](_0x21d999(0xd1)),console[_0x21d999(0xc1)]('\x20\x20'+getConsoleUrl(_0xf18f66,'/app/mp/ak'));const _0x1f8a06=await a33_0x25d473({'type':'password','name':_0x21d999(0xa8),'message':_0x21d999(0xe6),'validate':_0x55e308=>{const _0x329477=_0x21d999;if(!_0x55e308||!_0x55e308[_0x329477(0xed)]())return _0x329477(0xde);return!![];}});if(!_0x1f8a06[_0x21d999(0xa8)])return console['log'](_0x21d999(0x114)),0x1;console[_0x21d999(0xc1)](_0x21d999(0xf9));try{const _0x34590e=TDX[_0x21d999(0xdc)]({'site':_0xf18f66,'apiKey':_0x1f8a06[_0x21d999(0xa8)][_0x21d999(0xed)](),'logLevel':_0x1092fd['logLevel']??LogLevel['ERROR']}),_0x2ff047=await _0x34590e[_0x21d999(0xce)][_0x21d999(0xcd)]();console[_0x21d999(0xc1)](a33_0x5afa2b['green']('✓')+_0x21d999(0xee)+_0x2ff047[_0x21d999(0x104)]+')');const _0x298728=await isKeychainAvailable();_0x298728?(await saveAPIKeyAsync(_0x1f8a06[_0x21d999(0xa8)][_0x21d999(0xed)](),_0xf18f66,_0x197707),console[_0x21d999(0xc1)](a33_0x5afa2b['green']('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x21d999(0xa7)](a33_0x5afa2b[_0x21d999(0xa9)](_0x21d999(0xcf))),_0x37e0d5[_0x21d999(0x108)]=_0xf18f66;}catch(_0x44ec65){if(_0x44ec65 instanceof HTTPClientError&&_0x44ec65[_0x21d999(0xc0)]===0x191)return printAuthError(_0x44ec65),0x1;return console['error'](a33_0x5afa2b[_0x21d999(0xab)](_0x21d999(0xa4)+(_0x44ec65 instanceof Error?_0x44ec65['message']:String(_0x44ec65)))),console['error'](_0x21d999(0xa6)),0x1;}}else _0x37e0d5[_0x59edad]=_0x14fc5e||undefined;return saveProfileToUserConfig(_0x197707,_0x37e0d5),console[_0x21d999(0xc1)](a33_0x5afa2b[_0x21d999(0xfa)]('✓')+_0x21d999(0xe4)+_0x197707+_0x21d999(0xf2)+_0x59edad+'='+(_0x14fc5e||_0x21d999(0xbf))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x28a6c7(0x115)]=a33_0x28a6c7(0xca);['description']=a33_0x28a6c7(0x10d);[a33_0x28a6c7(0xc8)](_0x41b18b){const _0x1dad96=a33_0x28a6c7,{args:_0x432214}=_0x41b18b;if(_0x432214['length']===0x0)return _0x1dad96(0xf7);return undefined;}async[a33_0x28a6c7(0xf5)](_0x2c4a80){const _0x190b6a=a33_0x28a6c7,{args:_0x2a1b29,options:_0x399b15}=_0x2c4a80,_0xf0f5c8=_0x2a1b29[0x0],_0x13f6dd=_0x399b15[_0x190b6a(0xd9)];cleanExpiredSessions();if(!profileExists(_0xf0f5c8)){console['error'](a33_0x5afa2b['red']('Profile\x20\x27'+_0xf0f5c8+'\x27\x20does\x20not\x20exist.')),console[_0x190b6a(0xc1)](_0x190b6a(0xd8));const _0x40ef45=listProfiles();if(_0x40ef45[_0x190b6a(0x106)]===0x0)console[_0x190b6a(0xc1)](_0x190b6a(0xba));else for(const _0x115fe7 of _0x40ef45){console[_0x190b6a(0xc1)]('\x20\x20-\x20'+_0x115fe7['name']);}return 0x1;}if(_0x13f6dd){const _0x3643b1=a33_0x6fd7f['join'](getConfigDir(),_0x190b6a(0xfc));return saveActiveProfileToUserConfig(_0xf0f5c8),console[_0x190b6a(0xc1)](_0x190b6a(0x10a)+a33_0x5afa2b[_0x190b6a(0xfa)](_0xf0f5c8)),console['log'](a33_0x5afa2b[_0x190b6a(0xb7)](_0x190b6a(0xe7)+_0x3643b1)),0x0;}const _0x36e759=getSessionID(_0x399b15[_0x190b6a(0xe0)]);return saveSessionContext({'profile':_0xf0f5c8},_0x399b15['session']),console[_0x190b6a(0xc1)](_0x190b6a(0xfd)+a33_0x5afa2b['green'](_0xf0f5c8)+'\x20'+a33_0x5afa2b['dim'](_0x190b6a(0x107)+_0x36e759+')')),console[_0x190b6a(0xc1)](a33_0x5afa2b[_0x190b6a(0xb7)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0xf0f5c8+_0x190b6a(0xbb))),0x0;}}
@@ -1 +1 @@
1
- const a34_0x102f89=a34_0x2ab8;(function(_0x380640,_0x5bfb08){const _0x1d0b2b=a34_0x2ab8,_0x5b55c3=_0x380640();while(!![]){try{const _0x2845c5=parseInt(_0x1d0b2b(0x99))/0x1*(-parseInt(_0x1d0b2b(0x9e))/0x2)+parseInt(_0x1d0b2b(0xaf))/0x3+-parseInt(_0x1d0b2b(0xa5))/0x4+-parseInt(_0x1d0b2b(0xad))/0x5+parseInt(_0x1d0b2b(0x9b))/0x6*(parseInt(_0x1d0b2b(0x9a))/0x7)+parseInt(_0x1d0b2b(0xa0))/0x8+parseInt(_0x1d0b2b(0xa4))/0x9;if(_0x2845c5===_0x5bfb08)break;else _0x5b55c3['push'](_0x5b55c3['shift']());}catch(_0x1efa40){_0x5b55c3['push'](_0x5b55c3['shift']());}}}(a34_0x2277,0x280b0));import{BaseCommand}from'./command.js';function a34_0x2ab8(_0x39a861,_0x26b23f){_0x39a861=_0x39a861-0x98;const _0x2277ca=a34_0x2277();let _0x2ab846=_0x2277ca[_0x39a861];return _0x2ab846;}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a34_0x2277(){const _0x278ec8=['Error:\x20','message','log','5376096kIskcd','1081128qkCCZs','List\x20all\x20available\x20profiles','name','length','profiles','dim','site','\x20\x20Global:\x20~/.config/tdx/tdx.json','1623385bDYNJx','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','282585ZceMHZ','config','1sDLuqv','7483DKeLMM','684AxJgxh','description','👤\x20','654496rCOJQn','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','2182544hdCVtf'];a34_0x2277=function(){return _0x278ec8;};return a34_0x2277();}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0xf16d07 from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x102f89(0xa7)]=a34_0x102f89(0xa9);[a34_0x102f89(0x9c)]=a34_0x102f89(0xa6);async['execute'](_0x1b6ee9){const _0x3f13ad=a34_0x102f89,{options:_0x494a90}=_0x1b6ee9;try{const _0x7de633=listProfiles(),_0x1cece9=getActiveProfile();if(_0x7de633[_0x3f13ad(0xa8)]===0x0)return console[_0x3f13ad(0xa3)](_0x3f13ad(0xae)),console[_0x3f13ad(0xa3)](_0x3f13ad(0x9f)),console['log'](_0x3f13ad(0xac)),0x0;const _0x3e51e7=_0x7de633['map'](_0x5402a6=>{const _0x4642e6=_0x3f13ad,_0x4a5cbc=_0x5402a6[_0x4642e6(0xa7)]===_0x1cece9,_0x50b179=getProfileParams(_0x5402a6[_0x4642e6(0x98)]);return{'name':_0x5402a6['name'],'active':_0x4a5cbc,'scope':_0x5402a6['scope'],'description':_0x5402a6['config'][_0x4642e6(0x9c)]||'','params':_0x50b179};});if(isStructuredFormat(_0x494a90))await handleSDKOutput(_0x3e51e7,_0x494a90);else for(const _0x2d3060 of _0x7de633){const _0x15664d=_0x2d3060[_0x3f13ad(0xa7)]===_0x1cece9?a34_0xf16d07['green']('\x20✓'):'',_0x5d268d=_0x2d3060[_0x3f13ad(0x98)][_0x3f13ad(0xab)]?a34_0xf16d07[_0x3f13ad(0xaa)]('\x20'+_0x2d3060['config'][_0x3f13ad(0xab)]):'',_0x5bd673=_0x2d3060[_0x3f13ad(0x98)][_0x3f13ad(0x9c)]?a34_0xf16d07[_0x3f13ad(0xaa)]('\x20\x20'+_0x2d3060[_0x3f13ad(0x98)][_0x3f13ad(0x9c)]):'';console[_0x3f13ad(0xa3)](_0x3f13ad(0x9d)+_0x2d3060[_0x3f13ad(0xa7)]+_0x15664d+_0x5d268d+_0x5bd673);}return 0x0;}catch(_0x468b5e){return _0x468b5e instanceof Error&&console['error'](_0x3f13ad(0xa1)+_0x468b5e[_0x3f13ad(0xa2)]),0x1;}}}
1
+ const a34_0x15280c=a34_0x4560;(function(_0x18c87b,_0x30ec4a){const _0x493bfe=a34_0x4560,_0x711136=_0x18c87b();while(!![]){try{const _0x5f12b3=-parseInt(_0x493bfe(0x125))/0x1+parseInt(_0x493bfe(0x116))/0x2*(parseInt(_0x493bfe(0x122))/0x3)+-parseInt(_0x493bfe(0x109))/0x4*(parseInt(_0x493bfe(0x115))/0x5)+-parseInt(_0x493bfe(0x10f))/0x6+-parseInt(_0x493bfe(0x123))/0x7*(parseInt(_0x493bfe(0x127))/0x8)+parseInt(_0x493bfe(0x111))/0x9*(parseInt(_0x493bfe(0x11e))/0xa)+-parseInt(_0x493bfe(0x117))/0xb;if(_0x5f12b3===_0x30ec4a)break;else _0x711136['push'](_0x711136['shift']());}catch(_0xbe43d9){_0x711136['push'](_0x711136['shift']());}}}(a34_0x28e5,0x37efc));import{BaseCommand}from'./command.js';function a34_0x4560(_0x4573ad,_0x155567){_0x4573ad=_0x4573ad-0x109;const _0x28e583=a34_0x28e5();let _0x456027=_0x28e583[_0x4573ad];return _0x456027;}function a34_0x28e5(){const _0x4e7a21=['error','10GLiifF','name','Error:\x20','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','39zTMZjw','86485mByBtp','log','67203beVbwA','map','32biRioT','1250468SybXnd','List\x20all\x20available\x20profiles','profiles','message','\x20\x20Global:\x20~/.config/tdx/tdx.json','description','69330OBBRdL','length','4075128ONYUsJ','green','scope','site','5TNfxkX','42314yjjYav','637142cduvDZ','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','execute','config','dim','👤\x20'];a34_0x28e5=function(){return _0x4e7a21;};return a34_0x28e5();}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x237c07 from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x15280c(0x11f)]=a34_0x15280c(0x10b);[a34_0x15280c(0x10e)]=a34_0x15280c(0x10a);async[a34_0x15280c(0x119)](_0xb666d0){const _0x481b45=a34_0x15280c,{options:_0x21a2df}=_0xb666d0;try{const _0x526877=listProfiles(),_0x50dfbf=getActiveProfile();if(_0x526877[_0x481b45(0x110)]===0x0)return console['log'](_0x481b45(0x118)),console[_0x481b45(0x124)](_0x481b45(0x121)),console[_0x481b45(0x124)](_0x481b45(0x10d)),0x0;const _0x224b19=_0x526877[_0x481b45(0x126)](_0x383d6f=>{const _0x14f7a4=_0x481b45,_0x5370f1=_0x383d6f['name']===_0x50dfbf,_0x285010=getProfileParams(_0x383d6f[_0x14f7a4(0x11a)]);return{'name':_0x383d6f[_0x14f7a4(0x11f)],'active':_0x5370f1,'scope':_0x383d6f[_0x14f7a4(0x113)],'description':_0x383d6f['config'][_0x14f7a4(0x10e)]||'','params':_0x285010};});if(isStructuredFormat(_0x21a2df))await handleSDKOutput(_0x224b19,_0x21a2df);else for(const _0x26b6f2 of _0x526877){const _0x3b004e=_0x26b6f2[_0x481b45(0x11f)]===_0x50dfbf?a34_0x237c07[_0x481b45(0x112)]('\x20✓'):'',_0x5607d9=_0x26b6f2[_0x481b45(0x11a)][_0x481b45(0x114)]?a34_0x237c07['dim']('\x20'+_0x26b6f2[_0x481b45(0x11a)][_0x481b45(0x114)]):'',_0x39531c=_0x26b6f2[_0x481b45(0x11a)][_0x481b45(0x10e)]?a34_0x237c07[_0x481b45(0x11b)]('\x20\x20'+_0x26b6f2[_0x481b45(0x11a)][_0x481b45(0x10e)]):'';console[_0x481b45(0x124)](_0x481b45(0x11c)+_0x26b6f2[_0x481b45(0x11f)]+_0x3b004e+_0x5607d9+_0x39531c);}return 0x0;}catch(_0x54eb13){return _0x54eb13 instanceof Error&&console[_0x481b45(0x11d)](_0x481b45(0x120)+_0x54eb13[_0x481b45(0x10c)]),0x1;}}}
@@ -1 +1 @@
1
- const a35_0x1509df=a35_0x49ef;(function(_0x2e678b,_0x986a62){const _0x5171ab=a35_0x49ef,_0x491702=_0x2e678b();while(!![]){try{const _0x9458f2=parseInt(_0x5171ab(0x13f))/0x1*(-parseInt(_0x5171ab(0x12e))/0x2)+parseInt(_0x5171ab(0x148))/0x3*(-parseInt(_0x5171ab(0x140))/0x4)+parseInt(_0x5171ab(0x13b))/0x5+parseInt(_0x5171ab(0x14c))/0x6+-parseInt(_0x5171ab(0x151))/0x7+parseInt(_0x5171ab(0x14d))/0x8*(-parseInt(_0x5171ab(0x131))/0x9)+parseInt(_0x5171ab(0x123))/0xa*(parseInt(_0x5171ab(0x13d))/0xb);if(_0x9458f2===_0x986a62)break;else _0x491702['push'](_0x491702['shift']());}catch(_0x257622){_0x491702['push'](_0x491702['shift']());}}}(a35_0x1185,0xd03d8));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a35_0x49ef(_0x367d7a,_0x3aad96){_0x367d7a=_0x367d7a-0x11f;const _0x1185c2=a35_0x1185();let _0x49efb1=_0x1185c2[_0x367d7a];return _0x49efb1;}import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a35_0x1509df(0x14a)]='query';[a35_0x1509df(0x134)]=a35_0x1509df(0x14f);async[a35_0x1509df(0x126)](_0x3eca3c){const _0x4c9b1e=a35_0x1509df,{options:_0xfe087d,args:_0x118d76,tdx:_0x226471}=_0x3eca3c,_0x555dd8={..._0xfe087d,'limitStructuredFormats':!![]},_0x477b1f=_0x118d76[0x0],_0x299de0=_0xfe087d['file'];let _0x5760fa;try{if(_0x299de0)_0x5760fa=readSqlStatementsFromFile(_0x299de0);else{if(_0x477b1f==='-')_0x5760fa=await readSqlStatementsFromStdin();else{if(_0x477b1f&&isSqlFilePath(_0x477b1f))_0x5760fa=readSqlStatementsFromFile(_0x477b1f);else{if(_0x477b1f)_0x5760fa=splitSqlStatements(_0x477b1f);else throw new Error(_0x4c9b1e(0x13c));}}}}catch(_0x12cca6){return console[_0x4c9b1e(0x137)](_0x4c9b1e(0x146)+_0x12cca6[_0x4c9b1e(0x141)]),0x1;}const _0x451bf0=_0xfe087d[_0x4c9b1e(0x129)]||'information_schema',_0x58d15b=_0xfe087d['catalog'];try{const _0x4c0ba1=[],_0x42bd01=!!_0xfe087d['output'];for(let _0x52ca99=0x0;_0x52ca99<_0x5760fa['length'];_0x52ca99++){const _0x2bb10d=_0x5760fa[_0x52ca99],_0x54fff4=_0x52ca99+0x1,_0x3114da=_0x5760fa[_0x4c9b1e(0x136)],_0x4b3925=_0x3114da>0x1;_0xfe087d[_0x4c9b1e(0x143)]&&(console[_0x4c9b1e(0x137)]('\x0a'+(_0x4b3925?_0x4c9b1e(0x13a)+_0x54fff4+'/'+_0x3114da+':':'')),console[_0x4c9b1e(0x137)](_0x4c9b1e(0x133)+_0xfe087d[_0x4c9b1e(0x138)]),console[_0x4c9b1e(0x137)]('Catalog:\x20'+(_0x58d15b||'td')),console[_0x4c9b1e(0x137)]('Schema:\x20'+_0x451bf0),console[_0x4c9b1e(0x137)](_0x4c9b1e(0x12a)+_0x2bb10d));const _0x53a04a=_0x4b3925?_0x4c9b1e(0x121)+_0x54fff4+'/'+_0x3114da+_0x4c9b1e(0x12f):_0x4c9b1e(0x149);try{const _0x436114=await withProgressSpinner(_0x53a04a,async _0x2bdac6=>{const _0x333cfd=_0x4c9b1e,_0x24002a=await _0x226471['query'][_0x333cfd(0x126)](_0x2bb10d,{'catalog':_0x58d15b,'schema':_0x451bf0,'onJobId':_0x236a2d=>{const _0x1b6300=_0x333cfd;_0x2bdac6[_0x1b6300(0x145)](_0x236a2d);},'onProgress':_0xd559a0=>{const _0x48eb7b=_0x333cfd;_0x2bdac6['setPhase'](_0x48eb7b(0x12c)+_0xd559a0[_0x48eb7b(0x12b)]+']'),_0x2bdac6[_0x48eb7b(0x14b)](formatRows(_0xd559a0[_0x48eb7b(0x14e)])+'\x20rows\x20'+_0xd559a0[_0x48eb7b(0x150)]+'/'+_0xd559a0['totalSplits']+_0x48eb7b(0x120));}});return _0x24002a;},{'verbose':_0xfe087d[_0x4c9b1e(0x143)]}),_0x1df6af=_0x436114['data'],_0x171126=_0x1df6af[_0x4c9b1e(0x128)]?_0x4c9b1e(0x124)+_0x1df6af[_0x4c9b1e(0x128)]+']':'',_0xc34f9b=_0x4b3925?_0x4c9b1e(0x13a)+_0x54fff4+'/'+_0x3114da+'\x20-\x20':'';console['error']('✔\x20'+_0xc34f9b+_0x4c9b1e(0x13e)+formatRows(_0x1df6af[_0x4c9b1e(0x122)]['processedRows'])+_0x4c9b1e(0x125)+(_0x4c9b1e(0x132)+formatElapsed(_0x1df6af[_0x4c9b1e(0x122)][_0x4c9b1e(0x11f)])+_0x171126));if(_0x4b3925&&_0x42bd01){const _0x478e8f=resolveOutputOptions(_0x555dd8),_0x27d2f7=await formatQueryOutput(_0x1df6af,_0x478e8f);_0x4c0ba1[_0x4c9b1e(0x127)](_0x27d2f7);}else await handleQueryOutput(_0x1df6af,_0x555dd8);}catch(_0x43f85b){const _0x5dea3d=_0x4b3925?'Statement\x20'+_0x54fff4+'/'+_0x3114da+':\x0a':'',_0x50a43e=_0x43f85b instanceof SDKError?_0x43f85b[_0x4c9b1e(0x144)]:_0x43f85b[_0x4c9b1e(0x141)];return console[_0x4c9b1e(0x137)](''+_0x5dea3d+_0x50a43e),0x1;}}if(_0x5760fa[_0x4c9b1e(0x136)]>0x1&&_0x42bd01&&_0x4c0ba1['length']>0x0){const _0x1b6134=_0x4c0ba1[_0x4c9b1e(0x12d)]('\x0a');writeFileSync(_0xfe087d[_0x4c9b1e(0x139)],_0x1b6134),console['error'](_0x4c9b1e(0x147)+_0xfe087d[_0x4c9b1e(0x139)]);}return 0x0;}catch(_0x36ba27){throw _0x36ba27;}}[a35_0x1509df(0x142)](_0x3c5ccd){const _0x1c50ab=a35_0x1509df,_0x42fbd8=_0x3c5ccd['args'][0x0],_0x4029a7=_0x3c5ccd[_0x1c50ab(0x130)][_0x1c50ab(0x135)];if(!_0x42fbd8&&!_0x4029a7)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(_0x42fbd8&&_0x4029a7)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}function a35_0x1185(){const _0x5b281b=['length','error','site','output','Statement\x20','2291055iSFzhy','No\x20SQL\x20provided','6017gFZNzi','Query\x20completed:\x20Processed\x20','17927FgYNil','4088VxJEXF','message','validate','verbose','originalMessage','setJobId','Error:\x20','\x0aAll\x20results\x20saved\x20to\x20','1383cbckhW','Executing\x20query...','name','setExtra','1566210iqyGDh','424nHTTvr','processedRows','Run\x20Trino\x20queries\x20(streaming)','completedSplits','10467576FFuLrk','elapsedTimeMillis','\x20splits','Executing\x20statement\x20','stats','50870PjpGHt','\x20[Job\x20ID:\x20','\x20rows\x20','execute','push','jobId','database','SQL:\x20','state','Executing\x20query\x20[','join','16zwGpFl','...','options','91521uFCRuh','in\x20','Site:\x20','description','file'];a35_0x1185=function(){return _0x5b281b;};return a35_0x1185();}
1
+ function a35_0x8561(){const _0x38227b=['12994210coDcqc','totalSplits','3157YvYYXa','Statement\x20','query','jobId','308uHjOwZ','state','56hkLBzk','push','4380rDvzgl','8549640clShGP','Run\x20Trino\x20queries\x20(streaming)','length','Error:\x20','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','execute','No\x20SQL\x20provided','4XuKZHJ','Schema:\x20','in\x20','join','completedSplits','Query\x20completed:\x20Processed\x20','2760666UbUtSz','description','\x0aAll\x20results\x20saved\x20to\x20','Executing\x20statement\x20','Executing\x20query...','Site:\x20','file','name','validate','originalMessage','error','verbose','site','output','information_schema','\x20rows\x20','setExtra','catalog','1668183TjInON','...','stats','1921221sBFAUI','message','setPhase','database','options','elapsedTimeMillis','1492WoGtGx','processedRows','args','Catalog:\x20'];a35_0x8561=function(){return _0x38227b;};return a35_0x8561();}const a35_0x1dead6=a35_0x235f;(function(_0xccb094,_0x50cf7f){const _0xb48d49=a35_0x235f,_0x2e6bbf=_0xccb094();while(!![]){try{const _0x151f22=parseInt(_0xb48d49(0x1b7))/0x1*(parseInt(_0xb48d49(0x1ad))/0x2)+-parseInt(_0xb48d49(0x192))/0x3*(parseInt(_0xb48d49(0x18c))/0x4)+-parseInt(_0xb48d49(0x185))/0x5+-parseInt(_0xb48d49(0x184))/0x6*(-parseInt(_0xb48d49(0x1b3))/0x7)+parseInt(_0xb48d49(0x182))/0x8*(parseInt(_0xb48d49(0x1a7))/0x9)+parseInt(_0xb48d49(0x1b1))/0xa+parseInt(_0xb48d49(0x1a4))/0xb;if(_0x151f22===_0x50cf7f)break;else _0x2e6bbf['push'](_0x2e6bbf['shift']());}catch(_0x147313){_0x2e6bbf['push'](_0x2e6bbf['shift']());}}}(a35_0x8561,0xd56dd));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';function a35_0x235f(_0xcb725c,_0x28ded){_0xcb725c=_0xcb725c-0x182;const _0x8561d9=a35_0x8561();let _0x235f1c=_0x8561d9[_0xcb725c];return _0x235f1c;}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a35_0x1dead6(0x199)]='query';[a35_0x1dead6(0x193)]=a35_0x1dead6(0x186);async[a35_0x1dead6(0x18a)](_0x32cb98){const _0x3e3f75=a35_0x1dead6,{options:_0x12f2a4,args:_0x2eb5e9,tdx:_0xd7dcc4}=_0x32cb98,_0x4eb028={..._0x12f2a4,'limitStructuredFormats':!![]},_0x265510=_0x2eb5e9[0x0],_0x2f2a7f=_0x12f2a4['file'];let _0x32b99d;try{if(_0x2f2a7f)_0x32b99d=readSqlStatementsFromFile(_0x2f2a7f);else{if(_0x265510==='-')_0x32b99d=await readSqlStatementsFromStdin();else{if(_0x265510&&isSqlFilePath(_0x265510))_0x32b99d=readSqlStatementsFromFile(_0x265510);else{if(_0x265510)_0x32b99d=splitSqlStatements(_0x265510);else throw new Error(_0x3e3f75(0x18b));}}}}catch(_0x54a266){return console['error'](_0x3e3f75(0x188)+_0x54a266[_0x3e3f75(0x1a8)]),0x1;}const _0x4f884a=_0x12f2a4[_0x3e3f75(0x1aa)]||_0x3e3f75(0x1a0),_0x581363=_0x12f2a4[_0x3e3f75(0x1a3)];try{const _0x4da066=[],_0x2c6a2a=!!_0x12f2a4[_0x3e3f75(0x19f)];for(let _0x3f27c4=0x0;_0x3f27c4<_0x32b99d['length'];_0x3f27c4++){const _0x17c4ca=_0x32b99d[_0x3f27c4],_0x403d67=_0x3f27c4+0x1,_0x365d83=_0x32b99d['length'],_0x5a65b5=_0x365d83>0x1;_0x12f2a4[_0x3e3f75(0x19d)]&&(console['error']('\x0a'+(_0x5a65b5?_0x3e3f75(0x1b4)+_0x403d67+'/'+_0x365d83+':':'')),console[_0x3e3f75(0x19c)](_0x3e3f75(0x197)+_0x12f2a4[_0x3e3f75(0x19e)]),console[_0x3e3f75(0x19c)](_0x3e3f75(0x1b0)+(_0x581363||'td')),console['error'](_0x3e3f75(0x18d)+_0x4f884a),console[_0x3e3f75(0x19c)]('SQL:\x20'+_0x17c4ca));const _0x24dbb3=_0x5a65b5?_0x3e3f75(0x195)+_0x403d67+'/'+_0x365d83+_0x3e3f75(0x1a5):_0x3e3f75(0x196);try{const _0x35320f=await withProgressSpinner(_0x24dbb3,async _0x573fe8=>{const _0x2d565b=_0x3e3f75,_0x5575e1=await _0xd7dcc4[_0x2d565b(0x1b5)]['execute'](_0x17c4ca,{'catalog':_0x581363,'schema':_0x4f884a,'onJobId':_0x814651=>{_0x573fe8['setJobId'](_0x814651);},'onProgress':_0x486bb0=>{const _0x2044d0=_0x2d565b;_0x573fe8[_0x2044d0(0x1a9)]('Executing\x20query\x20['+_0x486bb0[_0x2044d0(0x1b8)]+']'),_0x573fe8[_0x2044d0(0x1a2)](formatRows(_0x486bb0[_0x2044d0(0x1ae)])+'\x20rows\x20'+_0x486bb0[_0x2044d0(0x190)]+'/'+_0x486bb0[_0x2044d0(0x1b2)]+'\x20splits');}});return _0x5575e1;},{'verbose':_0x12f2a4[_0x3e3f75(0x19d)]}),_0x41a386=_0x35320f['data'],_0x4c48aa=_0x41a386[_0x3e3f75(0x1b6)]?'\x20[Job\x20ID:\x20'+_0x41a386[_0x3e3f75(0x1b6)]+']':'',_0x173bc2=_0x5a65b5?_0x3e3f75(0x1b4)+_0x403d67+'/'+_0x365d83+'\x20-\x20':'';console[_0x3e3f75(0x19c)]('✔\x20'+_0x173bc2+_0x3e3f75(0x191)+formatRows(_0x41a386[_0x3e3f75(0x1a6)][_0x3e3f75(0x1ae)])+_0x3e3f75(0x1a1)+(_0x3e3f75(0x18e)+formatElapsed(_0x41a386[_0x3e3f75(0x1a6)][_0x3e3f75(0x1ac)])+_0x4c48aa));if(_0x5a65b5&&_0x2c6a2a){const _0x50c448=resolveOutputOptions(_0x4eb028),_0x5ba6b7=await formatQueryOutput(_0x41a386,_0x50c448);_0x4da066[_0x3e3f75(0x183)](_0x5ba6b7);}else await handleQueryOutput(_0x41a386,_0x4eb028);}catch(_0x15a863){const _0x53f340=_0x5a65b5?_0x3e3f75(0x1b4)+_0x403d67+'/'+_0x365d83+':\x0a':'',_0x25c182=_0x15a863 instanceof SDKError?_0x15a863[_0x3e3f75(0x19b)]:_0x15a863[_0x3e3f75(0x1a8)];return console[_0x3e3f75(0x19c)](''+_0x53f340+_0x25c182),0x1;}}if(_0x32b99d['length']>0x1&&_0x2c6a2a&&_0x4da066[_0x3e3f75(0x187)]>0x0){const _0x1e9be4=_0x4da066[_0x3e3f75(0x18f)]('\x0a');writeFileSync(_0x12f2a4[_0x3e3f75(0x19f)],_0x1e9be4),console['error'](_0x3e3f75(0x194)+_0x12f2a4[_0x3e3f75(0x19f)]);}return 0x0;}catch(_0x5443d1){throw _0x5443d1;}}[a35_0x1dead6(0x19a)](_0x545e4b){const _0x2bdcc8=a35_0x1dead6,_0x2a85e2=_0x545e4b[_0x2bdcc8(0x1af)][0x0],_0x5799a1=_0x545e4b[_0x2bdcc8(0x1ab)][_0x2bdcc8(0x198)];if(!_0x2a85e2&&!_0x5799a1)return _0x2bdcc8(0x189);if(_0x2a85e2&&_0x5799a1)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}
@@ -1 +1 @@
1
- const a36_0x4c0eaa=a36_0x394e;(function(_0xe1d235,_0x1d28a5){const _0x520788=a36_0x394e,_0x448afc=_0xe1d235();while(!![]){try{const _0x53f19d=-parseInt(_0x520788(0xf5))/0x1*(-parseInt(_0x520788(0x104))/0x2)+parseInt(_0x520788(0x9d))/0x3+-parseInt(_0x520788(0xfa))/0x4+parseInt(_0x520788(0xe7))/0x5+parseInt(_0x520788(0xa7))/0x6*(parseInt(_0x520788(0xd9))/0x7)+-parseInt(_0x520788(0xf7))/0x8*(parseInt(_0x520788(0xba))/0x9)+parseInt(_0x520788(0xa1))/0xa*(-parseInt(_0x520788(0xd1))/0xb);if(_0x53f19d===_0x1d28a5)break;else _0x448afc['push'](_0x448afc['shift']());}catch(_0x1c76b8){_0x448afc['push'](_0x448afc['shift']());}}}(a36_0x2a0d,0x2e366));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_0x1afb02 from'chalk';function a36_0x2a0d(){const _0xba9108=['pagination','keys','from','/app/queries/editor?queryId=','retryLimit','\x20\x20Job\x20ID:\x20','engineVersion','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','h\x20ago','join','INVALID_ARGUMENT','result','cron','Query\x20file\x20is\x20empty','cyan','Delete\x20a\x20scheduled\x20query','schedule:run','execute','Show\x20schedule\x20execution\x20history','args','m\x20ago','Failed\x20to\x20read\x20file:\x20','user','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','lastRun','list','jsonl','num','Found\x20','\x20schedules','repeat','statusIcon','count','validate','Running\x20schedule...','format','\x20job','schedule:delete','443052JkXRyW','name','(unnamed)','substring','7430cTWlpn','start_at','update','schedule:history','data','error','18JdSUqe','Listing\x20scheduled\x20queries...','scheduled_at','Getting\x20schedule\x20history...','status','end_at','d\x20ago','\x20(use\x20--limit\x20to\x20see\x20more)','limit','Schedule\x20created:\x20','ies','file','\x20\x20Database:\x20','delay','\x20\x20Num:\x20','\x20execution','verbose','history','Showing\x20first\x20','18RCYDSz','table','Show\x20schedule\x20details','schedule:update','schedule:show','Schedule\x20updated:\x20','max','show','executing_user_id','Schedule\x20deleted:\x20','in\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','Getting\x20schedule\x20details...','description','abs','\x20\x20→\x20','map','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','database','queryUrl','padEnd','log','\x20\x20Cron:\x20','2981AKXnUF','Searching\x20scheduled\x20queries\x20matching\x20\x22','priority','job_id','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','never','query','Run\x20a\x20scheduled\x20query\x20immediately','166033gtVZCT','green','Create\x20a\x20scheduled\x20query','tsv','json','time_zone','trim','timezone','success','📅\x20','yes','getTime','round','Updating\x20schedule...','1467415zujAAJ','dim','\x22...','...','ended_at','type','user_name','listQueries','schedules','toLocaleDateString','Creating\x20schedule...','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','last_job','schedule:list','32077IUJTcW','time','55400EANPyP','engine_version','options','687956CEQWTm','Creating\x20schedule:\x20','run','utf-8','delete','nextRun','retry_limit','Updating\x20schedule:\x20','\x20\x20Timezone:\x20','length','4rZnhmG','Running\x20schedule:\x20'];a36_0x2a0d=function(){return _0xba9108;};return a36_0x2a0d();}function formatRelativeTime(_0x122f16){const _0xfd520c=a36_0x394e,_0x200ba0=new Date(_0x122f16),_0x42f2eb=new Date(),_0x5b9304=_0x200ba0[_0xfd520c(0xe4)]()-_0x42f2eb[_0xfd520c(0xe4)](),_0x2dadbe=Math[_0xfd520c(0xc8)](_0x5b9304)/0x3e8,_0x42d76a=_0x5b9304<0x0;if(_0x2dadbe<0x3c)return _0x42d76a?'just\x20now':'soon';else{if(_0x2dadbe<0xe10){const _0x2e2119=Math[_0xfd520c(0xe5)](_0x2dadbe/0x3c);return _0x42d76a?_0x2e2119+_0xfd520c(0x8b):_0xfd520c(0xc4)+_0x2e2119+'m';}else{if(_0x2dadbe<0x15180){const _0x404e2c=Math['round'](_0x2dadbe/0xe10);return _0x42d76a?_0x404e2c+_0xfd520c(0x7f):_0xfd520c(0xc4)+_0x404e2c+'h';}else{if(_0x2dadbe<0x93a80){const _0x5cb020=Math['round'](_0x2dadbe/0x15180);return _0x42d76a?_0x5cb020+_0xfd520c(0xad):_0xfd520c(0xc4)+_0x5cb020+'d';}else return _0x200ba0[_0xfd520c(0xf0)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x4c0eaa(0x9e)]=a36_0x4c0eaa(0xf4);[a36_0x4c0eaa(0xc7)]='List\x20scheduled\x20queries';async[a36_0x4c0eaa(0x88)](_0x246772){const _0x57833a=a36_0x4c0eaa,{options:_0x8c59bb,args:_0x4ee55c,tdx:_0x3d7c3a}=_0x246772,_0x10121d=resolveLimit(_0x8c59bb[_0x57833a(0xaf)],DEFAULT_DISPLAY_LIMIT),_0x2f497a=_0x4ee55c[0x0],_0x462812=_0x2f497a?_0x57833a(0xd2)+_0x2f497a+_0x57833a(0xe9):_0x57833a(0xa8),_0x46fb1b=await withSpinner(_0x462812,()=>_0x3d7c3a[_0x57833a(0xef)][_0x57833a(0xee)]({'limit':_0x10121d,'scheduled':!![],'pattern':_0x2f497a}),{'verbose':_0x8c59bb[_0x57833a(0xb7)]}),_0xe2318e=_0x46fb1b[_0x57833a(0xa5)]['queries'],_0x579d42=_0x46fb1b['data'][_0x57833a(0x106)]['has_next_page'],_0xaee835=_0x2f497a?'\x20matching\x20\x22'+_0x2f497a+'\x22':'';_0x579d42?console['error'](_0x57833a(0xb9)+_0xe2318e[_0x57833a(0x103)]+_0x57833a(0x94)+_0xaee835+_0x57833a(0xae)):console['error'](_0x57833a(0x93)+_0xe2318e[_0x57833a(0x103)]+'\x20scheduled\x20quer'+(_0xe2318e['length']!==0x1?_0x57833a(0xb1):'y')+_0xaee835);if(_0x8c59bb[_0x57833a(0x9a)]===_0x57833a(0xdd)||_0x8c59bb[_0x57833a(0x9a)]===_0x57833a(0x91)||_0x8c59bb[_0x57833a(0x9a)]===_0x57833a(0xbb)||_0x8c59bb[_0x57833a(0x9a)]===_0x57833a(0xdc)){const _0x4ccb32=_0xe2318e[_0x57833a(0xca)](_0x3f1989=>({'id':_0x3f1989['id'],'name':_0x3f1989[_0x57833a(0x9e)],'cron':_0x3f1989['cron'],'database':_0x3f1989[_0x57833a(0xcc)]?.[_0x57833a(0x9e)],'type':_0x3f1989[_0x57833a(0xec)],'timezone':_0x3f1989[_0x57833a(0xde)],'user_name':_0x3f1989[_0x57833a(0x8d)]?.[_0x57833a(0x9e)],'updated_at':_0x3f1989['updated_at'],'next_run_at':_0x3f1989['next_run_at'],'last_job_status':_0x3f1989[_0x57833a(0xf3)]?.[_0x57833a(0xab)]}));await handleSDKOutput(_0x4ccb32,_0x8c59bb);}else{if(_0xe2318e['length']===0x0)console[_0x57833a(0xcf)]('No\x20scheduled\x20queries\x20found');else{const _0x210e3b=_0x8c59bb['site'],_0x105823=_0xe2318e[_0x57833a(0xca)](_0x31504b=>{const _0x5dd128=_0x57833a,_0x33f677=_0x31504b[_0x5dd128(0xf3)]?.[_0x5dd128(0xab)]?_0x31504b[_0x5dd128(0xf3)]['status']===_0x5dd128(0xe1)?'✓':'✗':'-',_0x41849d=_0x31504b[_0x5dd128(0xf3)]?.['ended_at']?formatRelativeTime(_0x31504b[_0x5dd128(0xf3)][_0x5dd128(0xeb)]):_0x5dd128(0xd6),_0x27f941=_0x31504b['next_run_at']?formatRelativeTime(_0x31504b['next_run_at']):'-',_0x545ade=_0x31504b[_0x5dd128(0x83)]||'',_0xd3fd58=_0x31504b[_0x5dd128(0x9e)]||_0x5dd128(0x9f),_0x201b9d=getConsoleUrl(_0x210e3b,_0x5dd128(0x109)+_0x31504b['id']);return{'statusIcon':_0x33f677,'lastRun':_0x41849d,'nextRun':_0x27f941,'cron':_0x545ade,'name':_0xd3fd58,'queryUrl':_0x201b9d,'status':_0x31504b['last_job']?.[_0x5dd128(0xab)]};}),_0x43ea53=Math[_0x57833a(0xc0)](..._0x105823['map'](_0x9ed8d6=>_0x9ed8d6[_0x57833a(0x8f)]['length'])),_0x4dbb84=Math[_0x57833a(0xc0)](..._0x105823[_0x57833a(0xca)](_0x46d084=>_0x46d084[_0x57833a(0xff)]['length'])),_0x7704c7=Math[_0x57833a(0xc0)](..._0x105823[_0x57833a(0xca)](_0x5c6e22=>_0x5c6e22[_0x57833a(0x83)]['length'])),_0x8dae04=_0x105823[_0x57833a(0xca)](_0x53eb44=>{const _0x522aec=_0x57833a,_0x48684f=_0x53eb44[_0x522aec(0xab)]===_0x522aec(0xe1)?a36_0x1afb02[_0x522aec(0xda)](_0x53eb44[_0x522aec(0x96)]):_0x53eb44[_0x522aec(0xab)]===_0x522aec(0xa6)?a36_0x1afb02['red'](_0x53eb44[_0x522aec(0x96)]):a36_0x1afb02[_0x522aec(0xe8)](_0x53eb44[_0x522aec(0x96)]),_0x3a2524=_0x53eb44[_0x522aec(0x8f)]['padEnd'](_0x43ea53),_0x3758d3=_0x53eb44['nextRun']['padEnd'](_0x4dbb84),_0x427331=_0x53eb44[_0x522aec(0x83)]?a36_0x1afb02[_0x522aec(0x85)](_0x53eb44[_0x522aec(0x83)][_0x522aec(0xce)](_0x7704c7)):'\x20'[_0x522aec(0x95)](_0x7704c7),_0x5a279d=hyperlink(_0x53eb44[_0x522aec(0x9e)],_0x53eb44[_0x522aec(0xcd)]);return _0x522aec(0xe2)+_0x48684f+'\x20'+_0x3a2524+_0x522aec(0xc9)+_0x3758d3+'\x20\x20'+_0x427331+'\x20\x20'+_0x5a279d;});await writeOutput(_0x8dae04[_0x57833a(0x80)]('\x0a'),_0x8c59bb['output'],_0x57833a(0x90));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{['name']=a36_0x4c0eaa(0xbe);[a36_0x4c0eaa(0xc7)]=a36_0x4c0eaa(0xbc);[a36_0x4c0eaa(0x98)](_0x4158ef){const _0x336018=a36_0x4c0eaa,_0x6ed448=_0x4158ef['args'][0x0];if(!_0x6ed448)return _0x336018(0x8e);return undefined;}async[a36_0x4c0eaa(0x88)](_0x467b26){const _0x436651=a36_0x4c0eaa,{options:_0xaf7670,args:_0x286432,tdx:_0x4ba0aa}=_0x467b26,_0x211d6d=_0x286432[0x0],_0x3d6eaa=await withSpinner(_0x436651(0xc6),()=>_0x4ba0aa[_0x436651(0xef)][_0x436651(0xc1)](_0x211d6d),{'verbose':_0xaf7670[_0x436651(0xb7)]}),_0x125b53=_0x3d6eaa['data'],_0x192e5d={'name':_0x125b53[_0x436651(0x9e)],'cron':_0x125b53[_0x436651(0x83)],'database':_0x125b53[_0x436651(0xcc)],'type':_0x125b53['type'],'timezone':_0x125b53[_0x436651(0xe0)],'user_name':_0x125b53[_0x436651(0xed)],'created_at':_0x125b53['created_at'],'engine_version':_0x125b53[_0x436651(0xf8)],'executing_user_id':_0x125b53[_0x436651(0xc2)],'query':_0x125b53[_0x436651(0xd7)],'delay':_0x125b53[_0x436651(0xb4)],'priority':_0x125b53[_0x436651(0xd3)],'retry_limit':_0x125b53[_0x436651(0x100)],..._0x125b53[_0x436651(0x82)]&&{'result':_0x125b53['result']}};return await handleSingleObjectOutput(_0x192e5d,_0xaf7670),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x4c0eaa(0x9e)]='schedule:create';[a36_0x4c0eaa(0xc7)]=a36_0x4c0eaa(0xdb);[a36_0x4c0eaa(0x98)](_0x3eea2c){const _0x58e582=a36_0x4c0eaa,_0x24e1dc=_0x3eea2c[_0x58e582(0x8a)][0x0];if(!_0x24e1dc)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';const _0x1e10f5=_0x3eea2c[_0x58e582(0xf9)];if(!_0x1e10f5[_0x58e582(0xcc)])return _0x58e582(0xd5);return undefined;}async['execute'](_0x389343){const _0x45d85a=a36_0x4c0eaa,{options:_0x5595c0,args:_0x36a77d,tdx:_0x52c625}=_0x389343,_0x405049=_0x36a77d[0x0],_0x14f0bc=_0x5595c0,_0x55c2ae=_0x14f0bc['database'],_0x4a5037=_0x14f0bc['file'],_0x3496f4=_0x14f0bc[_0x45d85a(0xec)]||'trino';let _0x55cba8;try{_0x55cba8=readFileSync(_0x4a5037,'utf-8')[_0x45d85a(0xdf)]();}catch(_0x4b8308){throw new SDKError(ErrorCode[_0x45d85a(0x81)],_0x45d85a(0x8c)+_0x4a5037,_0x4b8308 instanceof Error?_0x4b8308:undefined);}if(!_0x55cba8)throw new SDKError(ErrorCode[_0x45d85a(0x81)],_0x45d85a(0x84));const _0x3cc138={'database':_0x55c2ae,'query':_0x55cba8,'type':_0x3496f4};if(_0x14f0bc[_0x45d85a(0x83)])_0x3cc138['cron']=_0x14f0bc['cron'];if(_0x14f0bc[_0x45d85a(0xe0)])_0x3cc138[_0x45d85a(0xe0)]=_0x14f0bc[_0x45d85a(0xe0)];if(_0x14f0bc[_0x45d85a(0xb4)]!==undefined)_0x3cc138[_0x45d85a(0xb4)]=Number(_0x14f0bc['delay']);if(_0x14f0bc[_0x45d85a(0xd3)]!==undefined)_0x3cc138[_0x45d85a(0xd3)]=Number(_0x14f0bc[_0x45d85a(0xd3)]);if(_0x14f0bc[_0x45d85a(0x10a)]!==undefined)_0x3cc138['retry_limit']=Number(_0x14f0bc[_0x45d85a(0x10a)]);if(_0x14f0bc['engineVersion'])_0x3cc138[_0x45d85a(0xf8)]=_0x14f0bc['engineVersion'];if(_0x14f0bc[_0x45d85a(0x82)])_0x3cc138[_0x45d85a(0x82)]=_0x14f0bc[_0x45d85a(0x82)];if(_0x5595c0['verbose']){console['error'](_0x45d85a(0xfb)+_0x405049),console[_0x45d85a(0xa6)](_0x45d85a(0xb3)+_0x55c2ae),console[_0x45d85a(0xa6)]('\x20\x20Type:\x20'+_0x3496f4);if(_0x3cc138[_0x45d85a(0x83)])console[_0x45d85a(0xa6)](_0x45d85a(0xd0)+_0x3cc138['cron']);if(_0x3cc138['timezone'])console[_0x45d85a(0xa6)](_0x45d85a(0x102)+_0x3cc138['timezone']);}const _0x290bdd=await withSpinner(_0x45d85a(0xf1),()=>_0x52c625[_0x45d85a(0xef)]['create'](_0x405049,_0x3cc138),{'verbose':_0x5595c0[_0x45d85a(0xb7)]});return console['error'](_0x45d85a(0xb0)+_0x290bdd[_0x45d85a(0xa5)][_0x45d85a(0x9e)]),await handleSingleObjectOutput(_0x290bdd[_0x45d85a(0xa5)],_0x5595c0),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x4c0eaa(0x9e)]=a36_0x4c0eaa(0xbd);[a36_0x4c0eaa(0xc7)]='Update\x20a\x20scheduled\x20query';[a36_0x4c0eaa(0x98)](_0x2b8478){const _0x592cf2=a36_0x4c0eaa,_0x27cc0a=_0x2b8478[_0x592cf2(0x8a)][0x0];if(!_0x27cc0a)return _0x592cf2(0xf2);return undefined;}async['execute'](_0x33aa93){const _0x35c022=a36_0x4c0eaa,{options:_0x433ad6,args:_0x5bd373,tdx:_0x563b46}=_0x33aa93,_0x5beaa1=_0x5bd373[0x0],_0x5c3a8d=_0x433ad6,_0xe7e5a8={};if(_0x5c3a8d[_0x35c022(0xcc)])_0xe7e5a8[_0x35c022(0xcc)]=_0x5c3a8d[_0x35c022(0xcc)];if(_0x5c3a8d[_0x35c022(0xec)])_0xe7e5a8[_0x35c022(0xec)]=_0x5c3a8d[_0x35c022(0xec)];if(_0x5c3a8d[_0x35c022(0x83)])_0xe7e5a8[_0x35c022(0x83)]=_0x5c3a8d[_0x35c022(0x83)];if(_0x5c3a8d[_0x35c022(0xe0)])_0xe7e5a8[_0x35c022(0xe0)]=_0x5c3a8d['timezone'];if(_0x5c3a8d[_0x35c022(0xb4)]!==undefined)_0xe7e5a8[_0x35c022(0xb4)]=Number(_0x5c3a8d[_0x35c022(0xb4)]);if(_0x5c3a8d[_0x35c022(0xd3)]!==undefined)_0xe7e5a8[_0x35c022(0xd3)]=Number(_0x5c3a8d[_0x35c022(0xd3)]);if(_0x5c3a8d[_0x35c022(0x10a)]!==undefined)_0xe7e5a8[_0x35c022(0x100)]=Number(_0x5c3a8d[_0x35c022(0x10a)]);if(_0x5c3a8d[_0x35c022(0x7d)])_0xe7e5a8[_0x35c022(0xf8)]=_0x5c3a8d[_0x35c022(0x7d)];if(_0x5c3a8d['result'])_0xe7e5a8[_0x35c022(0x82)]=_0x5c3a8d[_0x35c022(0x82)];if(_0x5c3a8d['file'])try{_0xe7e5a8[_0x35c022(0xd7)]=readFileSync(_0x5c3a8d[_0x35c022(0xb2)],_0x35c022(0xfd))[_0x35c022(0xdf)]();}catch(_0x3d3e81){throw new SDKError(ErrorCode[_0x35c022(0x81)],_0x35c022(0x8c)+_0x5c3a8d['file'],_0x3d3e81 instanceof Error?_0x3d3e81:undefined);}if(Object[_0x35c022(0x107)](_0xe7e5a8)['length']===0x0)throw new SDKError(ErrorCode[_0x35c022(0x81)],'At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update');if(_0x433ad6[_0x35c022(0xb7)]){console[_0x35c022(0xa6)](_0x35c022(0x101)+_0x5beaa1);for(const [_0x3b4bbd,_0x1857ef]of Object['entries'](_0xe7e5a8)){_0x3b4bbd===_0x35c022(0xd7)?console[_0x35c022(0xa6)]('\x20\x20'+_0x3b4bbd+':\x20'+_0x1857ef[_0x35c022(0xa0)](0x0,0x32)+_0x35c022(0xea)):console[_0x35c022(0xa6)]('\x20\x20'+_0x3b4bbd+':\x20'+_0x1857ef);}}const _0x181990=await withSpinner(_0x35c022(0xe6),()=>_0x563b46[_0x35c022(0xef)][_0x35c022(0xa3)](_0x5beaa1,_0xe7e5a8),{'verbose':_0x433ad6['verbose']});return console['error'](_0x35c022(0xbf)+_0x181990['data'][_0x35c022(0x9e)]),await handleSingleObjectOutput(_0x181990['data'],_0x433ad6),0x0;}}function a36_0x394e(_0x2b96f3,_0x1f9e87){_0x2b96f3=_0x2b96f3-0x7d;const _0x2a0d5f=a36_0x2a0d();let _0x394ebf=_0x2a0d5f[_0x2b96f3];return _0x394ebf;}export class ScheduleDeleteCommand extends BaseCommand{['name']=a36_0x4c0eaa(0x9c);[a36_0x4c0eaa(0xc7)]=a36_0x4c0eaa(0x86);[a36_0x4c0eaa(0x98)](_0x511b86){const _0x5c021a=a36_0x4c0eaa,_0x10cb31=_0x511b86[_0x5c021a(0x8a)][0x0];if(!_0x10cb31)return _0x5c021a(0xc5);return undefined;}async[a36_0x4c0eaa(0x88)](_0x56878b){const _0x4e87fa=a36_0x4c0eaa,{options:_0x218907,args:_0x42a623,tdx:_0x1dda51}=_0x56878b,_0x22f150=_0x42a623[0x0];if(!_0x218907[_0x4e87fa(0xe3)]){const _0x6b4dcf=await confirm(_0x4e87fa(0x7e)+_0x22f150+'\x22?');if(!_0x6b4dcf)return console[_0x4e87fa(0xa6)]('Cancelled'),0x0;}const _0x4c2af8=await withSpinner('Deleting\x20schedule...',()=>_0x1dda51[_0x4e87fa(0xef)][_0x4e87fa(0xfe)](_0x22f150),{'verbose':_0x218907[_0x4e87fa(0xb7)]});return console[_0x4e87fa(0xa6)](_0x4e87fa(0xc3)+_0x4c2af8['data'][_0x4e87fa(0x9e)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x4c0eaa(0x9e)]=a36_0x4c0eaa(0x87);[a36_0x4c0eaa(0xc7)]=a36_0x4c0eaa(0xd8);[a36_0x4c0eaa(0x98)](_0x18737c){const _0x1ec081=a36_0x4c0eaa,_0x3dddcd=_0x18737c[_0x1ec081(0x8a)][0x0];if(!_0x3dddcd)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async['execute'](_0x4fc1a3){const _0x27a8dd=a36_0x4c0eaa,{options:_0x27835f,args:_0x237b60,tdx:_0xb2c5c9}=_0x4fc1a3,_0x26949a=_0x237b60[0x0],_0x428386=_0x27835f,_0x5c68b6=_0x428386[_0x27a8dd(0xf6)],_0x405c3b=_0x428386[_0x27a8dd(0x92)]!==undefined?Number(_0x428386[_0x27a8dd(0x92)]):undefined;if(_0x27835f[_0x27a8dd(0xb7)]){console[_0x27a8dd(0xa6)](_0x27a8dd(0x105)+_0x26949a);if(_0x5c68b6)console[_0x27a8dd(0xa6)]('\x20\x20Time:\x20'+_0x5c68b6);if(_0x405c3b)console[_0x27a8dd(0xa6)](_0x27a8dd(0xb5)+_0x405c3b);}const _0xd45592=await withSpinner(_0x27a8dd(0x99),()=>_0xb2c5c9[_0x27a8dd(0xef)][_0x27a8dd(0xfc)](_0x26949a,{'time':_0x5c68b6,'num':_0x405c3b}),{'verbose':_0x27835f['verbose']}),_0x1456c5=_0xd45592[_0x27a8dd(0xa5)]['jobs'];console[_0x27a8dd(0xa6)]('Schedule\x20run\x20submitted:\x20'+_0x1456c5[_0x27a8dd(0x103)]+_0x27a8dd(0x9b)+(_0x1456c5[_0x27a8dd(0x103)]!==0x1?'s':'')+'\x20created');for(const _0x29ebbd of _0x1456c5){console[_0x27a8dd(0xa6)](_0x27a8dd(0x10b)+_0x29ebbd[_0x27a8dd(0xd4)]);}return await handleSDKOutput(_0x1456c5,_0x27835f),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x4c0eaa(0x9e)]=a36_0x4c0eaa(0xa4);[a36_0x4c0eaa(0xc7)]=a36_0x4c0eaa(0x89);[a36_0x4c0eaa(0x98)](_0x261155){const _0x4690b2=a36_0x4c0eaa,_0x39e152=_0x261155[_0x4690b2(0x8a)][0x0];if(!_0x39e152)return _0x4690b2(0xcb);return undefined;}async['execute'](_0x2940ab){const _0x1d6d33=a36_0x4c0eaa,{options:_0x1f0920,args:_0x95d364,tdx:_0x518687}=_0x2940ab,_0x4bede2=_0x95d364[0x0],_0x2350b1=_0x1f0920,_0x390e05=_0x2350b1[_0x1d6d33(0x108)]!==undefined?Number(_0x2350b1[_0x1d6d33(0x108)]):undefined,_0x290c0e=_0x2350b1['to']!==undefined?Number(_0x2350b1['to']):undefined,_0x157586=await withSpinner(_0x1d6d33(0xaa),()=>_0x518687[_0x1d6d33(0xef)][_0x1d6d33(0xb8)](_0x4bede2,{'from':_0x390e05,'to':_0x290c0e}),{'verbose':_0x1f0920[_0x1d6d33(0xb7)]}),_0x9643d1=_0x157586[_0x1d6d33(0xa5)];console['error'](_0x1d6d33(0x93)+_0x9643d1[_0x1d6d33(0x97)]+_0x1d6d33(0xb6)+(_0x9643d1[_0x1d6d33(0x97)]!==0x1?'s':'')+'\x20(showing\x20'+_0x9643d1[_0x1d6d33(0x108)]+'-'+_0x9643d1['to']+')');const _0x46d4dd=_0x9643d1[_0x1d6d33(0xb8)][_0x1d6d33(0xca)](_0x4c0706=>({'job_id':_0x4c0706[_0x1d6d33(0xd4)],'type':_0x4c0706['type'],'status':_0x4c0706['status'],'scheduled_at':_0x4c0706[_0x1d6d33(0xa9)],'created_at':_0x4c0706['created_at'],'start_at':_0x4c0706[_0x1d6d33(0xa2)],'end_at':_0x4c0706[_0x1d6d33(0xac)]}));return await handleSDKOutput(_0x46d4dd,_0x1f0920),0x0;}}
1
+ const a36_0x9dec09=a36_0x2faa;(function(_0x295454,_0xb48167){const _0x1ef8f5=a36_0x2faa,_0x5c3ba3=_0x295454();while(!![]){try{const _0x327cc6=-parseInt(_0x1ef8f5(0x1cb))/0x1*(parseInt(_0x1ef8f5(0x1d3))/0x2)+-parseInt(_0x1ef8f5(0x172))/0x3*(-parseInt(_0x1ef8f5(0x1d5))/0x4)+parseInt(_0x1ef8f5(0x1bf))/0x5*(-parseInt(_0x1ef8f5(0x1c8))/0x6)+-parseInt(_0x1ef8f5(0x177))/0x7*(parseInt(_0x1ef8f5(0x196))/0x8)+parseInt(_0x1ef8f5(0x192))/0x9*(parseInt(_0x1ef8f5(0x1a8))/0xa)+-parseInt(_0x1ef8f5(0x1b5))/0xb+parseInt(_0x1ef8f5(0x1b4))/0xc;if(_0x327cc6===_0xb48167)break;else _0x5c3ba3['push'](_0x5c3ba3['shift']());}catch(_0x1428bd){_0x5c3ba3['push'](_0x5c3ba3['shift']());}}}(a36_0x6de1,0x81bbd));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_0x4ac5f0 from'chalk';function a36_0x6de1(){const _0x4d3f0c=['queries','Searching\x20scheduled\x20queries\x20matching\x20\x22','repeat','database','Schedule\x20deleted:\x20','jsonl','jobs','format','Query\x20file\x20is\x20empty','9021aIhIwU','trino','(unnamed)','\x20\x20Type:\x20','Creating\x20schedule:\x20','1757pnxPMe','statusIcon','execute','retryLimit','Show\x20schedule\x20execution\x20history','delete','length','round','/app/queries/editor?queryId=','limit','engine_version','output','start_at','engineVersion','schedule:delete','status','has_next_page','name','\x20schedules','user','args','validate','red','utf-8','time_zone','ended_at','schedule:create','9UPaguy','join','...','Running\x20schedule:\x20','7624isgWVU','INVALID_ARGUMENT','List\x20scheduled\x20queries','listQueries','\x20created','Found\x20','ies','Updating\x20schedule...','Getting\x20schedule\x20details...','\x20\x20Time:\x20','substring','entries','yes','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','\x20scheduled\x20quer','schedule:list','cyan','cron','560550juPNoX','options','schedules','created_at','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','Schedule\x20updated:\x20','lastRun','json','No\x20scheduled\x20queries\x20found','Run\x20a\x20scheduled\x20query\x20immediately','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','24009288vszbCf','4384919ZdgujU','last_job','timezone','Update\x20a\x20scheduled\x20query','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','next_run_at','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','from','Cancelled','executing_user_id','5ZwQuMg','site','job_id','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','m\x20ago','delay','count','\x20job','file','4426518ySupcN','table','never','16iGyfdH','max','description','toLocaleDateString','\x20(showing\x20','priority','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','data','108566wFVIfD','end_at','956XgcsWf','Running\x20schedule...','\x20\x20Cron:\x20','schedule:update','📅\x20','trim','verbose','scheduled_at','updated_at','Failed\x20to\x20read\x20file:\x20','create','type','result','just\x20now','nextRun','history','schedule:history','list','success','Deleting\x20schedule...','query','tsv','queryUrl','Schedule\x20created:\x20','abs','retry_limit','soon','in\x20','padEnd','getTime','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','\x20\x20Job\x20ID:\x20','error','dim','\x20\x20Database:\x20','h\x20ago','time','map','\x20\x20Timezone:\x20'];a36_0x6de1=function(){return _0x4d3f0c;};return a36_0x6de1();}function formatRelativeTime(_0x7ee3c7){const _0x3e77a4=a36_0x2faa,_0x594210=new Date(_0x7ee3c7),_0x378b5b=new Date(),_0x30e0f8=_0x594210[_0x3e77a4(0x15f)]()-_0x378b5b[_0x3e77a4(0x15f)](),_0xb38ab3=Math[_0x3e77a4(0x15a)](_0x30e0f8)/0x3e8,_0x840fdb=_0x30e0f8<0x0;if(_0xb38ab3<0x3c)return _0x840fdb?_0x3e77a4(0x14f):_0x3e77a4(0x15c);else{if(_0xb38ab3<0xe10){const _0x1f40ef=Math[_0x3e77a4(0x17e)](_0xb38ab3/0x3c);return _0x840fdb?_0x1f40ef+_0x3e77a4(0x1c3):_0x3e77a4(0x15d)+_0x1f40ef+'m';}else{if(_0xb38ab3<0x15180){const _0x943128=Math[_0x3e77a4(0x17e)](_0xb38ab3/0xe10);return _0x840fdb?_0x943128+_0x3e77a4(0x165):'in\x20'+_0x943128+'h';}else{if(_0xb38ab3<0x93a80){const _0x2d522c=Math[_0x3e77a4(0x17e)](_0xb38ab3/0x15180);return _0x840fdb?_0x2d522c+'d\x20ago':'in\x20'+_0x2d522c+'d';}else return _0x594210[_0x3e77a4(0x1ce)]();}}}}function a36_0x2faa(_0x1a213f,_0xfd68d1){_0x1a213f=_0x1a213f-0x14c;const _0x6de17=a36_0x6de1();let _0x2faae5=_0x6de17[_0x1a213f];return _0x2faae5;}export class ScheduleListCommand extends BaseCommand{['name']=a36_0x9dec09(0x1a5);[a36_0x9dec09(0x1cd)]=a36_0x9dec09(0x198);async['execute'](_0x106375){const _0x301814=a36_0x9dec09,{options:_0x53b7e9,args:_0x36e72c,tdx:_0x15c8bd}=_0x106375,_0x45e537=resolveLimit(_0x53b7e9[_0x301814(0x180)],DEFAULT_DISPLAY_LIMIT),_0x5892fe=_0x36e72c[0x0],_0x5e4ce0=_0x5892fe?_0x301814(0x16a)+_0x5892fe+'\x22...':'Listing\x20scheduled\x20queries...',_0x324c68=await withSpinner(_0x5e4ce0,()=>_0x15c8bd[_0x301814(0x1aa)][_0x301814(0x199)]({'limit':_0x45e537,'scheduled':!![],'pattern':_0x5892fe}),{'verbose':_0x53b7e9[_0x301814(0x1db)]}),_0x47defd=_0x324c68[_0x301814(0x1d2)][_0x301814(0x169)],_0x2e8b29=_0x324c68[_0x301814(0x1d2)]['pagination'][_0x301814(0x187)],_0x5e545d=_0x5892fe?'\x20matching\x20\x22'+_0x5892fe+'\x22':'';_0x2e8b29?console[_0x301814(0x162)]('Showing\x20first\x20'+_0x47defd[_0x301814(0x17d)]+_0x301814(0x189)+_0x5e545d+'\x20(use\x20--limit\x20to\x20see\x20more)'):console[_0x301814(0x162)](_0x301814(0x19b)+_0x47defd['length']+_0x301814(0x1a4)+(_0x47defd['length']!==0x1?_0x301814(0x19c):'y')+_0x5e545d);if(_0x53b7e9[_0x301814(0x170)]===_0x301814(0x1b0)||_0x53b7e9[_0x301814(0x170)]===_0x301814(0x16e)||_0x53b7e9[_0x301814(0x170)]===_0x301814(0x1c9)||_0x53b7e9[_0x301814(0x170)]===_0x301814(0x157)){const _0x5508f8=_0x47defd['map'](_0x290a16=>({'id':_0x290a16['id'],'name':_0x290a16[_0x301814(0x188)],'cron':_0x290a16[_0x301814(0x1a7)],'database':_0x290a16['database']?.[_0x301814(0x188)],'type':_0x290a16[_0x301814(0x14d)],'timezone':_0x290a16[_0x301814(0x18f)],'user_name':_0x290a16[_0x301814(0x18a)]?.[_0x301814(0x188)],'updated_at':_0x290a16[_0x301814(0x1dd)],'next_run_at':_0x290a16[_0x301814(0x1ba)],'last_job_status':_0x290a16['last_job']?.['status']}));await handleSDKOutput(_0x5508f8,_0x53b7e9);}else{if(_0x47defd[_0x301814(0x17d)]===0x0)console['log'](_0x301814(0x1b1));else{const _0x5a2370=_0x53b7e9[_0x301814(0x1c0)],_0xb3e80=_0x47defd[_0x301814(0x167)](_0x31aca7=>{const _0x30e050=_0x301814,_0x43e63b=_0x31aca7['last_job']?.['status']?_0x31aca7[_0x30e050(0x1b6)][_0x30e050(0x186)]===_0x30e050(0x154)?'✓':'✗':'-',_0x4b9eb0=_0x31aca7[_0x30e050(0x1b6)]?.[_0x30e050(0x190)]?formatRelativeTime(_0x31aca7[_0x30e050(0x1b6)][_0x30e050(0x190)]):_0x30e050(0x1ca),_0xe5d622=_0x31aca7['next_run_at']?formatRelativeTime(_0x31aca7[_0x30e050(0x1ba)]):'-',_0x303e52=_0x31aca7[_0x30e050(0x1a7)]||'',_0xcacfeb=_0x31aca7[_0x30e050(0x188)]||_0x30e050(0x174),_0x5b4687=getConsoleUrl(_0x5a2370,_0x30e050(0x17f)+_0x31aca7['id']);return{'statusIcon':_0x43e63b,'lastRun':_0x4b9eb0,'nextRun':_0xe5d622,'cron':_0x303e52,'name':_0xcacfeb,'queryUrl':_0x5b4687,'status':_0x31aca7[_0x30e050(0x1b6)]?.[_0x30e050(0x186)]};}),_0x30b0e4=Math['max'](..._0xb3e80[_0x301814(0x167)](_0x443edf=>_0x443edf[_0x301814(0x1af)][_0x301814(0x17d)])),_0x54115d=Math[_0x301814(0x1cc)](..._0xb3e80[_0x301814(0x167)](_0x4854f7=>_0x4854f7[_0x301814(0x150)]['length'])),_0x20d483=Math[_0x301814(0x1cc)](..._0xb3e80[_0x301814(0x167)](_0x1ac5e9=>_0x1ac5e9['cron'][_0x301814(0x17d)])),_0x3a3593=_0xb3e80[_0x301814(0x167)](_0x38a3de=>{const _0x1cb3d9=_0x301814,_0x4969d9=_0x38a3de[_0x1cb3d9(0x186)]===_0x1cb3d9(0x154)?a36_0x4ac5f0['green'](_0x38a3de[_0x1cb3d9(0x178)]):_0x38a3de[_0x1cb3d9(0x186)]==='error'?a36_0x4ac5f0[_0x1cb3d9(0x18d)](_0x38a3de[_0x1cb3d9(0x178)]):a36_0x4ac5f0[_0x1cb3d9(0x163)](_0x38a3de['statusIcon']),_0x4c5f7f=_0x38a3de[_0x1cb3d9(0x1af)][_0x1cb3d9(0x15e)](_0x30b0e4),_0x2573ae=_0x38a3de[_0x1cb3d9(0x150)][_0x1cb3d9(0x15e)](_0x54115d),_0x4ed74b=_0x38a3de[_0x1cb3d9(0x1a7)]?a36_0x4ac5f0[_0x1cb3d9(0x1a6)](_0x38a3de[_0x1cb3d9(0x1a7)]['padEnd'](_0x20d483)):'\x20'[_0x1cb3d9(0x16b)](_0x20d483),_0x133ed0=hyperlink(_0x38a3de['name'],_0x38a3de[_0x1cb3d9(0x158)]);return _0x1cb3d9(0x1d9)+_0x4969d9+'\x20'+_0x4c5f7f+'\x20\x20→\x20'+_0x2573ae+'\x20\x20'+_0x4ed74b+'\x20\x20'+_0x133ed0;});await writeOutput(_0x3a3593[_0x301814(0x193)]('\x0a'),_0x53b7e9[_0x301814(0x182)],_0x301814(0x153));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x9dec09(0x188)]='schedule:show';[a36_0x9dec09(0x1cd)]='Show\x20schedule\x20details';['validate'](_0x3192a1){const _0x4603f0=a36_0x9dec09,_0x1f907b=_0x3192a1[_0x4603f0(0x18b)][0x0];if(!_0x1f907b)return _0x4603f0(0x1ad);return undefined;}async[a36_0x9dec09(0x179)](_0x2d27d5){const _0x55d25e=a36_0x9dec09,{options:_0x2d7d8a,args:_0x6ae91,tdx:_0x1ecc00}=_0x2d27d5,_0x47a011=_0x6ae91[0x0],_0x355d20=await withSpinner(_0x55d25e(0x19e),()=>_0x1ecc00[_0x55d25e(0x1aa)]['show'](_0x47a011),{'verbose':_0x2d7d8a[_0x55d25e(0x1db)]}),_0x24a98c=_0x355d20[_0x55d25e(0x1d2)],_0x56c1ab={'name':_0x24a98c[_0x55d25e(0x188)],'cron':_0x24a98c[_0x55d25e(0x1a7)],'database':_0x24a98c['database'],'type':_0x24a98c['type'],'timezone':_0x24a98c[_0x55d25e(0x1b7)],'user_name':_0x24a98c['user_name'],'created_at':_0x24a98c[_0x55d25e(0x1ab)],'engine_version':_0x24a98c[_0x55d25e(0x181)],'executing_user_id':_0x24a98c[_0x55d25e(0x1be)],'query':_0x24a98c['query'],'delay':_0x24a98c['delay'],'priority':_0x24a98c[_0x55d25e(0x1d0)],'retry_limit':_0x24a98c[_0x55d25e(0x15b)],..._0x24a98c[_0x55d25e(0x14e)]&&{'result':_0x24a98c[_0x55d25e(0x14e)]}};return await handleSingleObjectOutput(_0x56c1ab,_0x2d7d8a),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x9dec09(0x188)]=a36_0x9dec09(0x191);[a36_0x9dec09(0x1cd)]='Create\x20a\x20scheduled\x20query';[a36_0x9dec09(0x18c)](_0x5f11ac){const _0x100fc8=a36_0x9dec09,_0x2090f7=_0x5f11ac[_0x100fc8(0x18b)][0x0];if(!_0x2090f7)return _0x100fc8(0x1b3);const _0x18c002=_0x5f11ac[_0x100fc8(0x1a9)];if(!_0x18c002[_0x100fc8(0x16c)])return _0x100fc8(0x1c2);return undefined;}async[a36_0x9dec09(0x179)](_0x217dee){const _0x3d4109=a36_0x9dec09,{options:_0x1c9e65,args:_0x53ff29,tdx:_0x10a171}=_0x217dee,_0x5609f9=_0x53ff29[0x0],_0xf1ac64=_0x1c9e65,_0x3a50f4=_0xf1ac64[_0x3d4109(0x16c)],_0x446004=_0xf1ac64[_0x3d4109(0x1c7)],_0x29abb3=_0xf1ac64[_0x3d4109(0x14d)]||_0x3d4109(0x173);let _0x1782d9;try{_0x1782d9=readFileSync(_0x446004,'utf-8')[_0x3d4109(0x1da)]();}catch(_0x3b9184){throw new SDKError(ErrorCode[_0x3d4109(0x197)],_0x3d4109(0x1de)+_0x446004,_0x3b9184 instanceof Error?_0x3b9184:undefined);}if(!_0x1782d9)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x3d4109(0x171));const _0x309aa9={'database':_0x3a50f4,'query':_0x1782d9,'type':_0x29abb3};if(_0xf1ac64[_0x3d4109(0x1a7)])_0x309aa9[_0x3d4109(0x1a7)]=_0xf1ac64[_0x3d4109(0x1a7)];if(_0xf1ac64['timezone'])_0x309aa9[_0x3d4109(0x1b7)]=_0xf1ac64['timezone'];if(_0xf1ac64[_0x3d4109(0x1c4)]!==undefined)_0x309aa9[_0x3d4109(0x1c4)]=Number(_0xf1ac64[_0x3d4109(0x1c4)]);if(_0xf1ac64[_0x3d4109(0x1d0)]!==undefined)_0x309aa9['priority']=Number(_0xf1ac64[_0x3d4109(0x1d0)]);if(_0xf1ac64[_0x3d4109(0x17a)]!==undefined)_0x309aa9[_0x3d4109(0x15b)]=Number(_0xf1ac64[_0x3d4109(0x17a)]);if(_0xf1ac64[_0x3d4109(0x184)])_0x309aa9[_0x3d4109(0x181)]=_0xf1ac64[_0x3d4109(0x184)];if(_0xf1ac64[_0x3d4109(0x14e)])_0x309aa9['result']=_0xf1ac64[_0x3d4109(0x14e)];if(_0x1c9e65['verbose']){console[_0x3d4109(0x162)](_0x3d4109(0x176)+_0x5609f9),console['error'](_0x3d4109(0x164)+_0x3a50f4),console[_0x3d4109(0x162)](_0x3d4109(0x175)+_0x29abb3);if(_0x309aa9[_0x3d4109(0x1a7)])console[_0x3d4109(0x162)](_0x3d4109(0x1d7)+_0x309aa9[_0x3d4109(0x1a7)]);if(_0x309aa9[_0x3d4109(0x1b7)])console[_0x3d4109(0x162)](_0x3d4109(0x168)+_0x309aa9['timezone']);}const _0x2a55df=await withSpinner('Creating\x20schedule...',()=>_0x10a171[_0x3d4109(0x1aa)][_0x3d4109(0x14c)](_0x5609f9,_0x309aa9),{'verbose':_0x1c9e65[_0x3d4109(0x1db)]});return console[_0x3d4109(0x162)](_0x3d4109(0x159)+_0x2a55df[_0x3d4109(0x1d2)][_0x3d4109(0x188)]),await handleSingleObjectOutput(_0x2a55df[_0x3d4109(0x1d2)],_0x1c9e65),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x9dec09(0x188)]=a36_0x9dec09(0x1d8);[a36_0x9dec09(0x1cd)]=a36_0x9dec09(0x1b8);[a36_0x9dec09(0x18c)](_0x372a59){const _0x5cd629=a36_0x9dec09,_0x173b3e=_0x372a59[_0x5cd629(0x18b)][0x0];if(!_0x173b3e)return _0x5cd629(0x1ac);return undefined;}async[a36_0x9dec09(0x179)](_0x3844a9){const _0x341787=a36_0x9dec09,{options:_0x21764e,args:_0x99d601,tdx:_0x22c5d0}=_0x3844a9,_0x91bd04=_0x99d601[0x0],_0x1386b7=_0x21764e,_0x2384f0={};if(_0x1386b7[_0x341787(0x16c)])_0x2384f0['database']=_0x1386b7[_0x341787(0x16c)];if(_0x1386b7['type'])_0x2384f0['type']=_0x1386b7['type'];if(_0x1386b7[_0x341787(0x1a7)])_0x2384f0[_0x341787(0x1a7)]=_0x1386b7[_0x341787(0x1a7)];if(_0x1386b7[_0x341787(0x1b7)])_0x2384f0[_0x341787(0x1b7)]=_0x1386b7[_0x341787(0x1b7)];if(_0x1386b7['delay']!==undefined)_0x2384f0[_0x341787(0x1c4)]=Number(_0x1386b7[_0x341787(0x1c4)]);if(_0x1386b7[_0x341787(0x1d0)]!==undefined)_0x2384f0[_0x341787(0x1d0)]=Number(_0x1386b7[_0x341787(0x1d0)]);if(_0x1386b7[_0x341787(0x17a)]!==undefined)_0x2384f0[_0x341787(0x15b)]=Number(_0x1386b7['retryLimit']);if(_0x1386b7[_0x341787(0x184)])_0x2384f0[_0x341787(0x181)]=_0x1386b7['engineVersion'];if(_0x1386b7[_0x341787(0x14e)])_0x2384f0['result']=_0x1386b7['result'];if(_0x1386b7[_0x341787(0x1c7)])try{_0x2384f0['query']=readFileSync(_0x1386b7[_0x341787(0x1c7)],_0x341787(0x18e))['trim']();}catch(_0x2e5895){throw new SDKError(ErrorCode[_0x341787(0x197)],_0x341787(0x1de)+_0x1386b7[_0x341787(0x1c7)],_0x2e5895 instanceof Error?_0x2e5895:undefined);}if(Object['keys'](_0x2384f0)[_0x341787(0x17d)]===0x0)throw new SDKError(ErrorCode[_0x341787(0x197)],_0x341787(0x1bb));if(_0x21764e[_0x341787(0x1db)]){console[_0x341787(0x162)]('Updating\x20schedule:\x20'+_0x91bd04);for(const [_0x300c07,_0x55cd83]of Object[_0x341787(0x1a1)](_0x2384f0)){_0x300c07===_0x341787(0x156)?console[_0x341787(0x162)]('\x20\x20'+_0x300c07+':\x20'+_0x55cd83[_0x341787(0x1a0)](0x0,0x32)+_0x341787(0x194)):console[_0x341787(0x162)]('\x20\x20'+_0x300c07+':\x20'+_0x55cd83);}}const _0x4099be=await withSpinner(_0x341787(0x19d),()=>_0x22c5d0[_0x341787(0x1aa)]['update'](_0x91bd04,_0x2384f0),{'verbose':_0x21764e[_0x341787(0x1db)]});return console['error'](_0x341787(0x1ae)+_0x4099be['data']['name']),await handleSingleObjectOutput(_0x4099be[_0x341787(0x1d2)],_0x21764e),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x9dec09(0x188)]=a36_0x9dec09(0x185);[a36_0x9dec09(0x1cd)]='Delete\x20a\x20scheduled\x20query';[a36_0x9dec09(0x18c)](_0x201ad1){const _0x287beb=a36_0x9dec09,_0x3b6ae5=_0x201ad1['args'][0x0];if(!_0x3b6ae5)return _0x287beb(0x1b9);return undefined;}async[a36_0x9dec09(0x179)](_0x2eac13){const _0xa2abda=a36_0x9dec09,{options:_0x9c022f,args:_0x955d5a,tdx:_0x413c72}=_0x2eac13,_0x39a8ad=_0x955d5a[0x0];if(!_0x9c022f[_0xa2abda(0x1a2)]){const _0x1b62fa=await confirm(_0xa2abda(0x160)+_0x39a8ad+'\x22?');if(!_0x1b62fa)return console[_0xa2abda(0x162)](_0xa2abda(0x1bd)),0x0;}const _0x28461b=await withSpinner(_0xa2abda(0x155),()=>_0x413c72['schedules'][_0xa2abda(0x17c)](_0x39a8ad),{'verbose':_0x9c022f[_0xa2abda(0x1db)]});return console[_0xa2abda(0x162)](_0xa2abda(0x16d)+_0x28461b[_0xa2abda(0x1d2)][_0xa2abda(0x188)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x9dec09(0x188)]='schedule:run';[a36_0x9dec09(0x1cd)]=a36_0x9dec09(0x1b2);[a36_0x9dec09(0x18c)](_0x510b44){const _0x11ac5b=a36_0x9dec09,_0x3b2368=_0x510b44['args'][0x0];if(!_0x3b2368)return _0x11ac5b(0x1d1);return undefined;}async[a36_0x9dec09(0x179)](_0x2744ef){const _0x25316e=a36_0x9dec09,{options:_0x3eec58,args:_0x2e0f47,tdx:_0x718d44}=_0x2744ef,_0x589420=_0x2e0f47[0x0],_0x27b721=_0x3eec58,_0x19f077=_0x27b721[_0x25316e(0x166)],_0x47dc59=_0x27b721['num']!==undefined?Number(_0x27b721['num']):undefined;if(_0x3eec58[_0x25316e(0x1db)]){console[_0x25316e(0x162)](_0x25316e(0x195)+_0x589420);if(_0x19f077)console[_0x25316e(0x162)](_0x25316e(0x19f)+_0x19f077);if(_0x47dc59)console[_0x25316e(0x162)]('\x20\x20Num:\x20'+_0x47dc59);}const _0x528bdb=await withSpinner(_0x25316e(0x1d6),()=>_0x718d44[_0x25316e(0x1aa)]['run'](_0x589420,{'time':_0x19f077,'num':_0x47dc59}),{'verbose':_0x3eec58[_0x25316e(0x1db)]}),_0x59e1ee=_0x528bdb[_0x25316e(0x1d2)][_0x25316e(0x16f)];console[_0x25316e(0x162)]('Schedule\x20run\x20submitted:\x20'+_0x59e1ee['length']+_0x25316e(0x1c6)+(_0x59e1ee['length']!==0x1?'s':'')+_0x25316e(0x19a));for(const _0x191b88 of _0x59e1ee){console['error'](_0x25316e(0x161)+_0x191b88[_0x25316e(0x1c1)]);}return await handleSDKOutput(_0x59e1ee,_0x3eec58),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x9dec09(0x188)]=a36_0x9dec09(0x152);[a36_0x9dec09(0x1cd)]=a36_0x9dec09(0x17b);[a36_0x9dec09(0x18c)](_0x399083){const _0x3a3ed5=a36_0x9dec09,_0x335c37=_0x399083[_0x3a3ed5(0x18b)][0x0];if(!_0x335c37)return _0x3a3ed5(0x1a3);return undefined;}async[a36_0x9dec09(0x179)](_0x504580){const _0x14d164=a36_0x9dec09,{options:_0x494b2a,args:_0x425b5d,tdx:_0x1e3dde}=_0x504580,_0x1b6e30=_0x425b5d[0x0],_0x38cc04=_0x494b2a,_0x152014=_0x38cc04['from']!==undefined?Number(_0x38cc04[_0x14d164(0x1bc)]):undefined,_0x52ea86=_0x38cc04['to']!==undefined?Number(_0x38cc04['to']):undefined,_0xaeb47c=await withSpinner('Getting\x20schedule\x20history...',()=>_0x1e3dde['schedules']['history'](_0x1b6e30,{'from':_0x152014,'to':_0x52ea86}),{'verbose':_0x494b2a['verbose']}),_0x57f678=_0xaeb47c[_0x14d164(0x1d2)];console[_0x14d164(0x162)]('Found\x20'+_0x57f678[_0x14d164(0x1c5)]+'\x20execution'+(_0x57f678[_0x14d164(0x1c5)]!==0x1?'s':'')+_0x14d164(0x1cf)+_0x57f678[_0x14d164(0x1bc)]+'-'+_0x57f678['to']+')');const _0x2f2fd0=_0x57f678[_0x14d164(0x151)][_0x14d164(0x167)](_0x4336c3=>({'job_id':_0x4336c3['job_id'],'type':_0x4336c3['type'],'status':_0x4336c3['status'],'scheduled_at':_0x4336c3[_0x14d164(0x1dc)],'created_at':_0x4336c3[_0x14d164(0x1ab)],'start_at':_0x4336c3[_0x14d164(0x183)],'end_at':_0x4336c3[_0x14d164(0x1d4)]}));return await handleSDKOutput(_0x2f2fd0,_0x494b2a),0x0;}}
@@ -1 +1 @@
1
- const a37_0x1b5047=a37_0x5184;(function(_0x1a75d2,_0x56f07d){const _0x59af54=a37_0x5184,_0x25859f=_0x1a75d2();while(!![]){try{const _0x413a7c=-parseInt(_0x59af54(0x1d1))/0x1+-parseInt(_0x59af54(0x1d3))/0x2*(-parseInt(_0x59af54(0x1f7))/0x3)+-parseInt(_0x59af54(0x1d9))/0x4+-parseInt(_0x59af54(0x1cb))/0x5+-parseInt(_0x59af54(0x207))/0x6*(-parseInt(_0x59af54(0x17f))/0x7)+parseInt(_0x59af54(0x1d2))/0x8+parseInt(_0x59af54(0x17d))/0x9*(parseInt(_0x59af54(0x16e))/0xa);if(_0x413a7c===_0x56f07d)break;else _0x25859f['push'](_0x25859f['shift']());}catch(_0x524e77){_0x25859f['push'](_0x25859f['shift']());}}}(a37_0x4dab,0x8dd25));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';function a37_0x4dab(){const _0x5a93f2=['resolveParentId','Resolved\x20parent\x20ID:\x20','\x20\x20tdx\x20sg\x20sql\x20--path\x20','getSegmentSQLFromYaml','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','\x20\x20Parent\x20segment:\x20','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','\x27...','verbose','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Resolving\x20path\x20\x27','test','SEGMENT_NOT_FOUND','Resolved\x20YAML\x20file:\x20','Site:\x20','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','parentSegment','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Fetching\x20folder\x20\x27','/app/ps/','segment:sql','processedRows','SEGMENT_FOLDER_NOT_FOUND','trim','Resolving\x20folder\x20\x27','cyan','\x20[Job\x20ID:\x20','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','5082685gJbpHV','Resolving\x20parent\x20folder\x20\x27','/e/','description','Fetching\x20SQL\x20from\x20rule...','segment:show','88375pnlFFG','3433568GFrjAE','534278JLrsJY','segmentName','message','Parent\x20name:\x20','Resolving\x20\x27','query','3925024yQxMdC','resolveFolderId','segmentId','parentId','getSegment','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','type','(root)','fullPath','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Use:\x20tdx\x20ps\x20view','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','red','Error:\x20Folder\x20reference\x20is\x20required','Error:\x20Parent\x20segment\x20name\x20is\x20required','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','limit','format','Show\x20child\x20segment\x20schema\x20(column\x20types)','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','error','name','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Error:\x20','segmentPath','Resolved\x20type:\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Parent\x20segment:\x20','Show\x20folder\x20or\x20child\x20segment\x20details','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','6wHEUuD','Creating\x20folder\x20\x27','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','✖\x20Query\x20failed\x20[','information_schema','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Parent\x20ID:\x20','\x20\x20Folder\x20path:\x20','Listing\x20folders\x20for\x20parent\x20\x27','Usage:\x20tdx\x20sg\x20show\x20<name>','elapsedTimeMillis','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','segment:desc','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','execute','Segment\x20ID:\x20','12uCDEVx','toLocaleString','INVALID_ARGUMENT','getFolder','segment:folder:list','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Resolving\x20parent\x20segment\x20\x27','Use:\x20tdx\x20ps\x20show','web','Use:\x20tdx\x20ps\x20view\x20-w','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','\x27\x20with\x20ID:\x20','Target\x20path:\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Folder\x20ID:\x20','resolvePathToResource','Error:\x20Path\x20or\x20name\x20is\x20required','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Fetching\x20segment\x20details...','90zbOUht','Resolved\x20folder\x20ID:\x20','folderId','Get\x20SQL\x20query\x20for\x20child\x20segment','Fetching\x20folder\x20details...','data','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','segment','Fetching\x20SQL\x20for\x20segment...','segment:folder:show','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Folder\x20name:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','1147437EWqSii','✔\x20Found\x20','1946553hZeZnz','jsonl','✔\x20Query\x20completed:\x20Processed\x20','SELECT\x20*\x20FROM\x20(\x0a','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20Opening\x20','Resolved\x20relative\x20path\x20to:\x20','Examples:','cause','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Resolved:\x20','parent','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','jobId','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Use:\x20tdx\x20ps\x20desc','\x20\x20Cause:\x20','folder','setJobId','path','createFolder','\x20\x20Segment\x20name:\x20','code','includes','getSegmentSQL','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','\x20\x20Full\x20path:\x20','url','\x20folder','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','Executing\x20segment\x20query...','getSQLFromYamlFile','segment:folder:create','segment:describe','stats','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','listFolders','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','Show\x20segment\x20or\x20folder\x20details','parentFolder','length','Options:','site','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','log'];a37_0x4dab=function(){return _0x5a93f2;};return a37_0x4dab();}import a37_0x16ec09 from'chalk';async function resolveSegmentTarget(_0x1e2953,_0x2d3ba5,_0x549d61){const _0x596ea9=a37_0x5184;if(isYamlFilePath(_0x1e2953))try{const _0x95790=await resolveYamlFilePath(_0x1e2953);return _0x549d61&&(console[_0x596ea9(0x1ed)](_0x596ea9(0x1bb)+_0x1e2953),console[_0x596ea9(0x1ed)](_0x596ea9(0x1b2)+_0x95790[_0x596ea9(0x1be)]),console[_0x596ea9(0x1ed)](_0x596ea9(0x195)+_0x95790[_0x596ea9(0x1d4)]),console[_0x596ea9(0x1ed)](_0x596ea9(0x1fe)+(_0x95790['folderPath']||_0x596ea9(0x1e0))),console[_0x596ea9(0x1ed)](_0x596ea9(0x19a)+_0x95790['fullPath'])),_0x95790[_0x596ea9(0x1e1)];}catch(_0x3b89c1){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x596ea9(0x1ef)+_0x3b89c1['message']);}if(!_0x2d3ba5)throw new SDKError(ErrorCode[_0x596ea9(0x209)],_0x596ea9(0x1bf));return _0x2d3ba5+'/'+_0x1e2953;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x1b5047(0x1ee)]=a37_0x1b5047(0x1a1);['description']=a37_0x1b5047(0x1a6);async['execute'](_0xce5bad){const _0x518585=a37_0x1b5047,{options:_0x31b95e,args:_0x5d4665,tdx:_0x767d6a}=_0xce5bad,_0x180106=_0x5d4665[0x0],_0x58d3fc=!_0x180106&&!!_0x31b95e[_0x518585(0x1be)],_0x4746b9=_0x180106||_0x31b95e[_0x518585(0x1be)];if(!_0x4746b9)return console[_0x518585(0x1ed)](_0x518585(0x16b)),console[_0x518585(0x1ed)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x518585(0x1ed)]('Examples:'),console[_0x518585(0x1ed)](_0x518585(0x17c)),console[_0x518585(0x1ed)](_0x518585(0x1e4)),console['error']('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console[_0x518585(0x1ed)](_0x518585(0x1e2)),0x1;try{const _0x556ff4=_0x31b95e[_0x518585(0x1f1)];let _0x4fb2ea=_0x4746b9;!_0x58d3fc&&_0x556ff4&&!_0x4746b9[_0x518585(0x197)]('/')&&(_0x4fb2ea=_0x556ff4+'/'+_0x4746b9,_0x31b95e[_0x518585(0x1b6)]&&console[_0x518585(0x1ed)](_0x518585(0x185)+_0x4fb2ea));const _0x3048b2=await withSpinner(_0x518585(0x1b8)+_0x4fb2ea+_0x518585(0x1b5),()=>_0x767d6a[_0x518585(0x175)][_0x518585(0x16a)](_0x4fb2ea),{'verbose':_0x31b95e[_0x518585(0x1b6)]}),_0xdb0917=_0x3048b2[_0x518585(0x173)];_0x31b95e[_0x518585(0x1b6)]&&(console[_0x518585(0x1ed)](_0x518585(0x1f2)+_0xdb0917['type']),console[_0x518585(0x1ed)](_0x518585(0x1fd)+_0xdb0917[_0x518585(0x1dc)]),_0xdb0917[_0x518585(0x170)]&&console['error'](_0x518585(0x169)+_0xdb0917[_0x518585(0x170)]),_0xdb0917[_0x518585(0x1db)]&&console[_0x518585(0x1ed)](_0x518585(0x206)+_0xdb0917['segmentId']));if(_0xdb0917[_0x518585(0x1df)]===_0x518585(0x18a)){const _0x542af6=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x767d6a[_0x518585(0x175)]['getParent'](_0xdb0917[_0x518585(0x1dc)]),{'verbose':_0x31b95e['verbose']});await handleSingleObjectOutput(_0x542af6[_0x518585(0x173)],_0x31b95e);}else{if(_0xdb0917[_0x518585(0x1df)]===_0x518585(0x191)){if(!_0xdb0917[_0x518585(0x170)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x518585(0x178));const _0x2725e4=await withSpinner('Fetching\x20folder\x20details...',()=>_0x767d6a[_0x518585(0x175)][_0x518585(0x20a)](_0xdb0917['folderId']),{'verbose':_0x31b95e['verbose']});await handleSingleObjectOutput(_0x2725e4[_0x518585(0x173)],_0x31b95e);}else{if(_0xdb0917[_0x518585(0x1df)]===_0x518585(0x175)){if(!_0xdb0917[_0x518585(0x1db)])throw new SDKError(ErrorCode[_0x518585(0x1ba)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0xb9c1c0=await withSpinner(_0x518585(0x16d),()=>_0x767d6a[_0x518585(0x175)][_0x518585(0x1dd)](_0xdb0917[_0x518585(0x1dc)],_0xdb0917[_0x518585(0x1db)]),{'verbose':_0x31b95e[_0x518585(0x1b6)]});await handleSingleObjectOutput(_0xb9c1c0[_0x518585(0x173)],_0x31b95e);}}}return 0x0;}catch(_0x5d4ac6){if(_0x5d4ac6 instanceof SDKError)return console[_0x518585(0x1ed)](_0x518585(0x1f0)+_0x5d4ac6['message']),_0x5d4ac6[_0x518585(0x187)]&&console['error'](_0x518585(0x190)+_0x5d4ac6[_0x518585(0x187)]),0x1;throw _0x5d4ac6;}}}export class SegmentShowCommand extends BaseCommand{['name']=a37_0x1b5047(0x1d0);[a37_0x1b5047(0x1ce)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a37_0x1b5047(0x205)](_0x508a07){const _0x35aea8=a37_0x1b5047,{options:_0x886faf,args:_0x2a75ff,tdx:_0x54e25c}=_0x508a07,_0x4a639f=_0x2a75ff[0x0];if(!_0x4a639f)return console['error']('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error'](_0x35aea8(0x200)),console[_0x35aea8(0x1ed)](_0x35aea8(0x1c0)),console[_0x35aea8(0x1ed)](_0x35aea8(0x186)),console['error']('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console['error'](_0x35aea8(0x1ec)),0x1;try{const _0x5b1448=_0x886faf[_0x35aea8(0x1be)],_0x688a9=await resolveSegmentTarget(_0x4a639f,_0x5b1448,_0x886faf[_0x35aea8(0x1b6)]);_0x886faf[_0x35aea8(0x1b6)]&&console[_0x35aea8(0x1ed)](_0x35aea8(0x167)+_0x688a9);const _0x22ee28=await withSpinner('Resolving\x20\x27'+_0x4a639f+'\x27...',()=>_0x54e25c[_0x35aea8(0x175)]['resolvePathToResource'](_0x688a9),{'verbose':_0x886faf[_0x35aea8(0x1b6)]}),_0x372087=_0x22ee28[_0x35aea8(0x173)];_0x886faf[_0x35aea8(0x1b6)]&&(console[_0x35aea8(0x1ed)](_0x35aea8(0x1f2)+_0x372087[_0x35aea8(0x1df)]),console[_0x35aea8(0x1ed)](_0x35aea8(0x1fd)+_0x372087[_0x35aea8(0x1dc)]));if(_0x372087['type']===_0x35aea8(0x191))return console[_0x35aea8(0x1ed)](_0x35aea8(0x1ab)),console[_0x35aea8(0x1ed)](_0x35aea8(0x199)),0x1;if(_0x372087['type']===_0x35aea8(0x18a))return console[_0x35aea8(0x1ed)](_0x35aea8(0x18e)),console[_0x35aea8(0x1ed)](_0x35aea8(0x162)),0x1;if(!_0x372087[_0x35aea8(0x1db)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x35aea8(0x1f3));const _0x3c3e34=await withSpinner(_0x35aea8(0x176),()=>_0x54e25c['segment'][_0x35aea8(0x198)](_0x372087[_0x35aea8(0x1dc)],_0x372087[_0x35aea8(0x1db)]),{'verbose':_0x886faf[_0x35aea8(0x1b6)]});let _0x313d13=_0x3c3e34[_0x35aea8(0x173)];const _0x14c9a7=resolveLimit(_0x886faf[_0x35aea8(0x1e9)],DEFAULT_DISPLAY_LIMIT),_0x4f7453=/\bLIMIT\s+\d+/i[_0x35aea8(0x1b9)](_0x313d13);!_0x4f7453&&(_0x313d13=_0x313d13[_0x35aea8(0x1c6)]()['replace'](/;+$/,''),_0x313d13=_0x35aea8(0x182)+_0x313d13+_0x35aea8(0x188)+_0x14c9a7);_0x886faf[_0x35aea8(0x1b6)]&&console[_0x35aea8(0x1ed)]('SQL\x20query:\x0a'+_0x313d13);const _0xf9e07a=await withProgressSpinner(_0x35aea8(0x19e),async _0x2f68b3=>{const _0x20fd21=_0x35aea8,_0x671226=await _0x54e25c[_0x20fd21(0x1d8)][_0x20fd21(0x205)](_0x313d13,{'catalog':'td','schema':_0x20fd21(0x1fb),'onJobId':_0x2d3df4=>{const _0xddc2d7=_0x20fd21;_0x2f68b3[_0xddc2d7(0x192)](_0x2d3df4);}});return _0x671226;},{'verbose':_0x886faf['verbose']}),_0x1562fa=_0xf9e07a['data'],_0x45dd0b=_0x1562fa['jobId']?_0x35aea8(0x1c9)+_0x1562fa[_0x35aea8(0x18d)]+']':'';return console['error'](_0x35aea8(0x181)+_0x1562fa[_0x35aea8(0x1a2)][_0x35aea8(0x1c4)][_0x35aea8(0x208)]()+'\x20rows\x20'+('in\x20'+formatElapsed(_0x1562fa['stats'][_0x35aea8(0x201)])+_0x45dd0b)),await handleQueryOutput(_0x1562fa,_0x886faf),0x0;}catch(_0x3782c0){if(_0x3782c0 instanceof SDKError)return console[_0x35aea8(0x1ed)](_0x35aea8(0x1fa)+_0x3782c0[_0x35aea8(0x196)]+']'),console['error']('\x0a'+_0x3782c0['message']),0x1;throw _0x3782c0;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x1b5047(0x1ee)]=a37_0x1b5047(0x20b);[a37_0x1b5047(0x1ce)]=a37_0x1b5047(0x1fc);async[a37_0x1b5047(0x205)](_0x8dc2d3){const _0x3fe86f=a37_0x1b5047,{options:_0x1d0134,args:_0x334f63,tdx:_0x281f27}=_0x8dc2d3;if(_0x334f63[_0x3fe86f(0x1a8)]===0x0)return console['error'](_0x3fe86f(0x1e7)),console[_0x3fe86f(0x1ed)](_0x3fe86f(0x1f9)),0x1;const _0x1b8052=_0x334f63[0x0];try{_0x1d0134[_0x3fe86f(0x1b6)]&&(console['error'](_0x3fe86f(0x1bc)+_0x1d0134[_0x3fe86f(0x1aa)]),console[_0x3fe86f(0x1ed)](_0x3fe86f(0x1d6)+_0x1b8052));const _0x4be698=await withSpinner(_0x3fe86f(0x161)+_0x1b8052+_0x3fe86f(0x1b5),()=>_0x281f27[_0x3fe86f(0x175)][_0x3fe86f(0x1ad)](_0x1b8052),{'verbose':_0x1d0134['verbose']}),_0x493597=_0x4be698[_0x3fe86f(0x173)];_0x1d0134[_0x3fe86f(0x1b6)]&&console[_0x3fe86f(0x1ed)](_0x3fe86f(0x1ae)+_0x493597);const _0x2c709e=await withSpinner(_0x3fe86f(0x1ff)+_0x1b8052+_0x3fe86f(0x1b5),()=>_0x281f27[_0x3fe86f(0x175)][_0x3fe86f(0x1a4)](_0x493597),{'verbose':_0x1d0134['verbose']}),_0x199586=_0x2c709e[_0x3fe86f(0x173)];return console['error'](_0x3fe86f(0x17e)+_0x199586['length']+_0x3fe86f(0x19c)+(_0x199586[_0x3fe86f(0x1a8)]!==0x1?'s':'')),await handleSDKOutput(_0x199586,_0x1d0134),0x0;}catch(_0x206b35){if(_0x206b35 instanceof SDKError)return console[_0x3fe86f(0x1ed)](_0x3fe86f(0x1f0)+_0x206b35[_0x3fe86f(0x1d5)]),_0x206b35[_0x3fe86f(0x187)]&&console['error'](_0x3fe86f(0x190)+_0x206b35['cause']),0x1;throw _0x206b35;}}}function a37_0x5184(_0x2d643b,_0x95fa64){_0x2d643b=_0x2d643b-0x160;const _0x4dabfb=a37_0x4dab();let _0x518424=_0x4dabfb[_0x2d643b];return _0x518424;}export class SegmentFolderShowCommand extends BaseCommand{['name']=a37_0x1b5047(0x177);[a37_0x1b5047(0x1ce)]='Show\x20segment\x20folder\x20details';async[a37_0x1b5047(0x205)](_0x1b098d){const _0x1b7be0=a37_0x1b5047,{options:_0x25d8cf,args:_0x582e76,tdx:_0x15556e}=_0x1b098d;if(_0x582e76[_0x1b7be0(0x1a8)]===0x0)return console[_0x1b7be0(0x1ed)](_0x1b7be0(0x1e6)),console[_0x1b7be0(0x1ed)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x58c91d,childId:_0x3fef5d}=parseSegmentRef(_0x582e76[0x0]);_0x25d8cf[_0x1b7be0(0x1b6)]&&(console[_0x1b7be0(0x1ed)](_0x1b7be0(0x1bc)+_0x25d8cf['site']),console[_0x1b7be0(0x1ed)](_0x1b7be0(0x1d6)+_0x58c91d),_0x3fef5d&&console['error'](_0x1b7be0(0x17b)+_0x3fef5d));if(!_0x3fef5d)return console[_0x1b7be0(0x1ed)](_0x1b7be0(0x1e8)),0x1;const _0x237545=await withSpinner(_0x1b7be0(0x161)+_0x58c91d+_0x1b7be0(0x1b5),()=>_0x15556e[_0x1b7be0(0x175)][_0x1b7be0(0x1ad)](_0x58c91d),{'verbose':_0x25d8cf[_0x1b7be0(0x1b6)]}),_0x3ae7b0=_0x237545[_0x1b7be0(0x173)];_0x25d8cf[_0x1b7be0(0x1b6)]&&console[_0x1b7be0(0x1ed)](_0x1b7be0(0x1ae)+_0x3ae7b0);const _0x434de5=await withSpinner(_0x1b7be0(0x1c7)+_0x3fef5d+_0x1b7be0(0x1b5),()=>_0x15556e[_0x1b7be0(0x175)]['resolveFolderId'](_0x3ae7b0,_0x3fef5d),{'verbose':_0x25d8cf[_0x1b7be0(0x1b6)]}),_0x46c0e4=_0x434de5['data'];_0x25d8cf[_0x1b7be0(0x1b6)]&&console[_0x1b7be0(0x1ed)](_0x1b7be0(0x16f)+_0x46c0e4);const _0x225f97=await withSpinner(_0x1b7be0(0x1c1)+_0x3fef5d+_0x1b7be0(0x1b5),()=>_0x15556e[_0x1b7be0(0x175)]['getFolder'](_0x46c0e4),{'verbose':_0x25d8cf[_0x1b7be0(0x1b6)]});return await handleSDKOutput([_0x225f97[_0x1b7be0(0x173)]],_0x25d8cf),0x0;}catch(_0x5007bd){if(_0x5007bd instanceof SDKError)return console[_0x1b7be0(0x1ed)](_0x1b7be0(0x1f0)+_0x5007bd[_0x1b7be0(0x1d5)]),_0x5007bd[_0x1b7be0(0x187)]&&console[_0x1b7be0(0x1ed)](_0x1b7be0(0x190)+_0x5007bd['cause']),0x1;throw _0x5007bd;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x1b5047(0x1ee)]=a37_0x1b5047(0x1c3);['description']=a37_0x1b5047(0x171);async[a37_0x1b5047(0x205)](_0x885402){const _0x35b3b9=a37_0x1b5047,{options:_0xc86802,args:_0x48af8c}=_0x885402,_0x6c062e=_0xc86802,_0x4a4972=_0x6c062e[_0x35b3b9(0x193)],_0x58e1dd=_0x48af8c[0x0];if(!_0x58e1dd&&!_0x4a4972)return console[_0x35b3b9(0x1ed)](a37_0x16ec09[_0x35b3b9(0x1e5)](_0x35b3b9(0x19d))),console[_0x35b3b9(0x1ed)]('Usage:'),console['error'](_0x35b3b9(0x1a5)),console[_0x35b3b9(0x1ed)](_0x35b3b9(0x1a3)),console[_0x35b3b9(0x1ed)](_0x35b3b9(0x186)),console['error'](_0x35b3b9(0x1b3)),console[_0x35b3b9(0x1ed)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml'),0x1;if(_0x58e1dd&&_0x4a4972)return console[_0x35b3b9(0x1ed)](a37_0x16ec09[_0x35b3b9(0x1e5)](_0x35b3b9(0x165))),0x1;try{let _0x515b13;if(_0x4a4972)_0x515b13=await this['getSQLFromYamlFile'](_0x4a4972,_0x885402);else{if(isYamlFilePath(_0x58e1dd))return console[_0x35b3b9(0x1ed)](a37_0x16ec09[_0x35b3b9(0x1e5)](_0x35b3b9(0x1bd))),console[_0x35b3b9(0x1ed)](_0x35b3b9(0x1af)+_0x58e1dd),0x1;else _0x515b13=await this['getSQLFromServerSegment'](_0x58e1dd,_0x885402);}return _0xc86802['format']==='json'||_0xc86802[_0x35b3b9(0x1ea)]===_0x35b3b9(0x180)?await handleSDKOutput([{'sql':_0x515b13}],_0xc86802):console[_0x35b3b9(0x1ac)](_0x515b13),0x0;}catch(_0x2890ab){if(_0x2890ab instanceof SDKError)return console[_0x35b3b9(0x1ed)](_0x35b3b9(0x1f0)+_0x2890ab[_0x35b3b9(0x1d5)]),_0x2890ab[_0x35b3b9(0x187)]&&console['error'](_0x35b3b9(0x190)+_0x2890ab[_0x35b3b9(0x187)]),0x1;throw _0x2890ab;}}async[a37_0x1b5047(0x19f)](_0x415032,_0x115058){const _0x54ce95=a37_0x1b5047,{options:_0x5e12e7,tdx:_0x3a22e0}=_0x115058;let _0xd37ca1;try{_0xd37ca1=await resolveYamlFilePath(_0x415032);}catch(_0x418e18){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x418e18[_0x54ce95(0x1d5)]);}_0x5e12e7[_0x54ce95(0x1b6)]&&console[_0x54ce95(0x1ed)](_0x54ce95(0x189)+_0xd37ca1[_0x54ce95(0x1be)]+'/'+_0xd37ca1[_0x54ce95(0x1d4)]);const _0x525054=await withSpinner(_0x54ce95(0x1cf),()=>_0x3a22e0[_0x54ce95(0x175)][_0x54ce95(0x1b0)](_0xd37ca1['content'],_0xd37ca1[_0x54ce95(0x1be)],_0xd37ca1[_0x54ce95(0x1d4)]),{'verbose':_0x5e12e7[_0x54ce95(0x1b6)]});return _0x525054[_0x54ce95(0x173)];}async['getSQLFromServerSegment'](_0x245d5f,_0x14e201){const _0x5bc2f0=a37_0x1b5047,{options:_0x2e3188,tdx:_0x514dc0}=_0x14e201,_0x1bc52d=_0x2e3188[_0x5bc2f0(0x1be)],_0x3a71c2=await resolveSegmentTarget(_0x245d5f,_0x1bc52d,_0x2e3188[_0x5bc2f0(0x1b6)]);_0x2e3188['verbose']&&console[_0x5bc2f0(0x1ed)](_0x5bc2f0(0x167)+_0x3a71c2);const _0x22cfa8=await withSpinner(_0x5bc2f0(0x1d7)+_0x245d5f+_0x5bc2f0(0x1b5),()=>_0x514dc0['segment']['resolvePathToResource'](_0x3a71c2),{'verbose':_0x2e3188[_0x5bc2f0(0x1b6)]}),_0x5114d2=_0x22cfa8[_0x5bc2f0(0x173)];_0x2e3188[_0x5bc2f0(0x1b6)]&&(console['error']('Resolved\x20type:\x20'+_0x5114d2[_0x5bc2f0(0x1df)]),console[_0x5bc2f0(0x1ed)]('Parent\x20ID:\x20'+_0x5114d2[_0x5bc2f0(0x1dc)]));if(_0x5114d2['type']===_0x5bc2f0(0x191))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x5bc2f0(0x1b7));if(_0x5114d2[_0x5bc2f0(0x1df)]===_0x5bc2f0(0x18a))throw new SDKError(ErrorCode[_0x5bc2f0(0x209)],_0x5bc2f0(0x204));if(!_0x5114d2['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x5bc2f0(0x1f3));const _0x2afe99=await withSpinner(_0x5bc2f0(0x176),()=>_0x514dc0[_0x5bc2f0(0x175)][_0x5bc2f0(0x198)](_0x5114d2[_0x5bc2f0(0x1dc)],_0x5114d2['segmentId']),{'verbose':_0x2e3188[_0x5bc2f0(0x1b6)]});return _0x2afe99[_0x5bc2f0(0x173)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x1b5047(0x1ee)]=a37_0x1b5047(0x1a0);[a37_0x1b5047(0x1ce)]='Create\x20segment\x20folder\x20for\x20organization';async[a37_0x1b5047(0x205)](_0x240da2){const _0x563507=a37_0x1b5047,{options:_0x377a88,args:_0x46d2b7,tdx:_0x35cea2}=_0x240da2,_0x1f8da0=_0x377a88;if(_0x46d2b7[_0x563507(0x1a8)]<0x2)return console[_0x563507(0x1ed)](_0x563507(0x17a)),console['error'](_0x563507(0x1b1)),0x1;const _0x3c7c48=_0x46d2b7[0x0],_0x2b891b=_0x46d2b7[0x1];_0x1f8da0[_0x563507(0x1b6)]&&(console['error']('Site:\x20'+_0x1f8da0[_0x563507(0x1aa)]),console['error'](_0x563507(0x1f4)+_0x3c7c48),console[_0x563507(0x1ed)](_0x563507(0x17b)+_0x2b891b));let _0x182e5a;if(_0x1f8da0[_0x563507(0x1a7)]){const _0x4b99cc=_0x1f8da0[_0x563507(0x1a7)],_0x5902d7=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3c7c48+_0x563507(0x1b5),()=>_0x35cea2[_0x563507(0x175)][_0x563507(0x1ad)](_0x3c7c48),{'verbose':_0x1f8da0['verbose']}),_0x310bc2=_0x5902d7['data'],_0x453ec2=await withSpinner(_0x563507(0x1cc)+_0x4b99cc+_0x563507(0x1b5),()=>_0x35cea2[_0x563507(0x175)][_0x563507(0x1da)](_0x310bc2,_0x4b99cc),{'verbose':_0x1f8da0[_0x563507(0x1b6)]});_0x182e5a=_0x453ec2[_0x563507(0x173)],_0x1f8da0[_0x563507(0x1b6)]&&console[_0x563507(0x1ed)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x182e5a);}const _0x2e2d87={'name':_0x2b891b,'description':_0x1f8da0[_0x563507(0x1ce)],'parentFolderId':_0x182e5a},_0x49edd2=await withSpinner(_0x563507(0x1f8)+_0x2b891b+_0x563507(0x1b5),()=>_0x35cea2[_0x563507(0x175)][_0x563507(0x194)](_0x3c7c48,_0x2e2d87),{'verbose':_0x1f8da0['verbose']}),_0x68f04e=_0x49edd2[_0x563507(0x173)];return console[_0x563507(0x1ed)]('✔\x20Created\x20folder\x20\x27'+_0x68f04e[_0x563507(0x1ee)]+_0x563507(0x166)+_0x68f04e['id']),await handleSDKOutput([_0x68f04e],_0x1f8da0),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x1b5047(0x1ee)]='segment:view';[a37_0x1b5047(0x1ce)]=a37_0x1b5047(0x1f5);async[a37_0x1b5047(0x205)](_0x520850){const _0x7cdf3f=a37_0x1b5047,{options:_0x663d48,args:_0x4e431,tdx:_0xbeac4f}=_0x520850,_0x1b0a12=_0x4e431[0x0];if(!_0x1b0a12)return console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x202)),console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x174)),console[_0x7cdf3f(0x1ed)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console['error'](_0x7cdf3f(0x1a9)),console[_0x7cdf3f(0x1ed)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console['error'](_0x7cdf3f(0x186)),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x1de)),console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x18c)),console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x16c)),0x1;try{const _0xd544a8=_0x663d48['parentSegment'],_0x2c5646=await resolveSegmentTarget(_0x1b0a12,_0xd544a8,_0x663d48[_0x7cdf3f(0x1b6)]);_0x663d48[_0x7cdf3f(0x1b6)]&&console['error'](_0x7cdf3f(0x167)+_0x2c5646);const _0x207ff0=await withSpinner(_0x7cdf3f(0x1d7)+_0x1b0a12+_0x7cdf3f(0x1b5),()=>_0xbeac4f['segment'][_0x7cdf3f(0x16a)](_0x2c5646),{'verbose':_0x663d48['verbose']}),_0x9af4e7=_0x207ff0[_0x7cdf3f(0x173)];_0x663d48['verbose']&&(console['error']('Resolved\x20type:\x20'+_0x9af4e7[_0x7cdf3f(0x1df)]),console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x1fd)+_0x9af4e7['parentId']),_0x9af4e7['folderId']&&console[_0x7cdf3f(0x1ed)]('Folder\x20ID:\x20'+_0x9af4e7[_0x7cdf3f(0x170)]),_0x9af4e7[_0x7cdf3f(0x1db)]&&console[_0x7cdf3f(0x1ed)]('Segment\x20ID:\x20'+_0x9af4e7[_0x7cdf3f(0x1db)]));if(_0x663d48[_0x7cdf3f(0x163)]){if(_0x9af4e7['type']===_0x7cdf3f(0x191))return console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x1b4)),0x1;if(_0x9af4e7['type']===_0x7cdf3f(0x18a))return console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x168)),console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x164)),0x1;if(!_0x9af4e7[_0x7cdf3f(0x1db)])throw new SDKError(ErrorCode[_0x7cdf3f(0x1ba)],_0x7cdf3f(0x1f3));const _0x4323b9=getConsoleNextUrl(_0x663d48[_0x7cdf3f(0x1aa)],_0x7cdf3f(0x1c2)+_0x9af4e7[_0x7cdf3f(0x1dc)]+_0x7cdf3f(0x1cd)+_0x9af4e7[_0x7cdf3f(0x1db)]);return console['error'](a37_0x16ec09['green']('✔')+_0x7cdf3f(0x184)+a37_0x16ec09[_0x7cdf3f(0x1c8)](_0x4323b9)),openBrowser(_0x4323b9),0x0;}if(_0x9af4e7[_0x7cdf3f(0x1df)]==='folder'){if(!_0x9af4e7[_0x7cdf3f(0x170)])throw new SDKError(ErrorCode[_0x7cdf3f(0x1c5)],_0x7cdf3f(0x178));const _0x575898=await withSpinner(_0x7cdf3f(0x172),()=>_0xbeac4f[_0x7cdf3f(0x175)][_0x7cdf3f(0x20a)](_0x9af4e7[_0x7cdf3f(0x170)]),{'verbose':_0x663d48[_0x7cdf3f(0x1b6)]});await handleSingleObjectOutput(_0x575898[_0x7cdf3f(0x173)],_0x663d48);}else{if(_0x9af4e7['type']===_0x7cdf3f(0x175)){if(!_0x9af4e7['segmentId'])throw new SDKError(ErrorCode[_0x7cdf3f(0x1ba)],_0x7cdf3f(0x1f3));const _0x57cc5f=await withSpinner(_0x7cdf3f(0x16d),()=>_0xbeac4f[_0x7cdf3f(0x175)][_0x7cdf3f(0x1dd)](_0x9af4e7[_0x7cdf3f(0x1dc)],_0x9af4e7[_0x7cdf3f(0x1db)]),{'verbose':_0x663d48['verbose']}),_0x566672=getConsoleNextUrl(_0x663d48[_0x7cdf3f(0x1aa)],_0x7cdf3f(0x1c2)+_0x9af4e7[_0x7cdf3f(0x1dc)]+'/e/'+_0x9af4e7[_0x7cdf3f(0x1db)]),_0xf1197a=_0x57cc5f[_0x7cdf3f(0x173)];_0xf1197a[_0x7cdf3f(0x19b)]=_0x566672,await handleSingleObjectOutput(_0xf1197a,_0x663d48);}else return console['error'](_0x7cdf3f(0x179)),console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x1e3)),0x1;}return 0x0;}catch(_0xc5542e){if(_0xc5542e instanceof SDKError)return console[_0x7cdf3f(0x1ed)](_0x7cdf3f(0x1f0)+_0xc5542e[_0x7cdf3f(0x1d5)]),_0xc5542e['cause']&&console[_0x7cdf3f(0x1ed)]('\x20\x20Cause:\x20'+_0xc5542e['cause']),0x1;throw _0xc5542e;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x1b5047(0x1ee)]=a37_0x1b5047(0x203);[a37_0x1b5047(0x1ce)]=a37_0x1b5047(0x1eb);async[a37_0x1b5047(0x205)](_0x546eb2){const _0x4cf6f0=a37_0x1b5047,{options:_0x9c4ed2,args:_0x4264d1,tdx:_0x5e0fec}=_0x546eb2,_0x246475=_0x4264d1[0x0];if(!_0x246475)return console[_0x4cf6f0(0x1ed)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x4cf6f0(0x1ed)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x4cf6f0(0x1ed)](_0x4cf6f0(0x1f6)),console[_0x4cf6f0(0x1ed)](_0x4cf6f0(0x186)),console[_0x4cf6f0(0x1ed)](_0x4cf6f0(0x18b)),console[_0x4cf6f0(0x1ed)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x3c2c84=_0x9c4ed2[_0x4cf6f0(0x1be)],_0x11ef49=await resolveSegmentTarget(_0x246475,_0x3c2c84,_0x9c4ed2[_0x4cf6f0(0x1b6)]);_0x9c4ed2['verbose']&&console['error'](_0x4cf6f0(0x167)+_0x11ef49);const _0x2c671d=await withSpinner(_0x4cf6f0(0x1d7)+_0x246475+'\x27...',()=>_0x5e0fec[_0x4cf6f0(0x175)][_0x4cf6f0(0x16a)](_0x11ef49),{'verbose':_0x9c4ed2[_0x4cf6f0(0x1b6)]}),_0x393ce5=_0x2c671d[_0x4cf6f0(0x173)];_0x9c4ed2['verbose']&&(console['error'](_0x4cf6f0(0x1f2)+_0x393ce5[_0x4cf6f0(0x1df)]),console['error']('Parent\x20ID:\x20'+_0x393ce5['parentId']));if(_0x393ce5['type']==='folder')return console[_0x4cf6f0(0x1ed)](_0x4cf6f0(0x160)),console[_0x4cf6f0(0x1ed)](_0x4cf6f0(0x1ca)),0x1;if(_0x393ce5[_0x4cf6f0(0x1df)]==='parent')return console[_0x4cf6f0(0x1ed)](_0x4cf6f0(0x183)),console[_0x4cf6f0(0x1ed)](_0x4cf6f0(0x18f)),0x1;if(!_0x393ce5['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x4cf6f0(0x1f3));const _0x2fb47a=await withSpinner(_0x4cf6f0(0x176),()=>_0x5e0fec[_0x4cf6f0(0x175)]['getSegmentSQL'](_0x393ce5[_0x4cf6f0(0x1dc)],_0x393ce5[_0x4cf6f0(0x1db)]),{'verbose':_0x9c4ed2['verbose']}),_0x2097dd=_0x2fb47a[_0x4cf6f0(0x173)],_0x5e1093=await executeSchemaQuery(_0x2097dd,_0x5e0fec,_0x9c4ed2);return await handleQueryOutput(_0x5e1093,_0x9c4ed2),0x0;}catch(_0x32c5ee){if(_0x32c5ee instanceof SDKError)return console[_0x4cf6f0(0x1ed)](_0x4cf6f0(0x1f0)+_0x32c5ee[_0x4cf6f0(0x1d5)]),_0x32c5ee[_0x4cf6f0(0x187)]&&console[_0x4cf6f0(0x1ed)](_0x4cf6f0(0x190)+_0x32c5ee['cause']),0x1;throw _0x32c5ee;}}}
1
+ const a37_0x54e21e=a37_0x4589;(function(_0x10f7fe,_0x3268b5){const _0x13961f=a37_0x4589,_0x5e8f30=_0x10f7fe();while(!![]){try{const _0x5f44ca=-parseInt(_0x13961f(0x1ba))/0x1+-parseInt(_0x13961f(0x1e9))/0x2*(parseInt(_0x13961f(0x1dc))/0x3)+parseInt(_0x13961f(0x196))/0x4+-parseInt(_0x13961f(0x205))/0x5+parseInt(_0x13961f(0x1da))/0x6+-parseInt(_0x13961f(0x1f0))/0x7+parseInt(_0x13961f(0x1d8))/0x8*(-parseInt(_0x13961f(0x228))/0x9);if(_0x5f44ca===_0x3268b5)break;else _0x5e8f30['push'](_0x5e8f30['shift']());}catch(_0x113453){_0x5e8f30['push'](_0x5e8f30['shift']());}}}(a37_0xbe90,0x8e73e));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0x4ccd79 from'chalk';async function resolveSegmentTarget(_0x164e16,_0x43b863,_0x46c204){const _0x1ebbd2=a37_0x4589;if(isYamlFilePath(_0x164e16))try{const _0x545dcf=await resolveYamlFilePath(_0x164e16);return _0x46c204&&(console[_0x1ebbd2(0x21e)](_0x1ebbd2(0x1e1)+_0x164e16),console[_0x1ebbd2(0x21e)]('\x20\x20Parent\x20segment:\x20'+_0x545dcf[_0x1ebbd2(0x1c2)]),console[_0x1ebbd2(0x21e)](_0x1ebbd2(0x213)+_0x545dcf[_0x1ebbd2(0x1a9)]),console['error']('\x20\x20Folder\x20path:\x20'+(_0x545dcf['folderPath']||_0x1ebbd2(0x1fe))),console['error'](_0x1ebbd2(0x1a7)+_0x545dcf[_0x1ebbd2(0x231)])),_0x545dcf[_0x1ebbd2(0x231)];}catch(_0x205f4d){throw new SDKError(ErrorCode[_0x1ebbd2(0x1d5)],_0x1ebbd2(0x1c8)+_0x205f4d[_0x1ebbd2(0x192)]);}if(!_0x43b863)throw new SDKError(ErrorCode[_0x1ebbd2(0x1d5)],_0x1ebbd2(0x20c));return _0x43b863+'/'+_0x164e16;}function a37_0x4589(_0x4aec56,_0x34c367){_0x4aec56=_0x4aec56-0x190;const _0xbe907d=a37_0xbe90();let _0x45892b=_0xbe907d[_0x4aec56];return _0x45892b;}export class SegmentDescribeCommand extends BaseCommand{['name']=a37_0x54e21e(0x1cb);['description']=a37_0x54e21e(0x1d9);async[a37_0x54e21e(0x1c6)](_0x56c4b2){const _0x805b87=a37_0x54e21e,{options:_0x155b09,args:_0x41fcfc,tdx:_0x427d04}=_0x56c4b2,_0x3dba22=_0x41fcfc[0x0],_0x5cb621=!_0x3dba22&&!!_0x155b09[_0x805b87(0x1c2)],_0xed66d=_0x3dba22||_0x155b09[_0x805b87(0x1c2)];if(!_0xed66d)return console['error'](_0x805b87(0x19f)),console[_0x805b87(0x21e)](_0x805b87(0x1f5)),console[_0x805b87(0x21e)]('Examples:'),console[_0x805b87(0x21e)](_0x805b87(0x1f3)),console[_0x805b87(0x21e)](_0x805b87(0x197)),console[_0x805b87(0x21e)]('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console[_0x805b87(0x21e)](_0x805b87(0x1b0)),0x1;try{const _0x20086f=_0x155b09[_0x805b87(0x21b)];let _0x441c75=_0xed66d;!_0x5cb621&&_0x20086f&&!_0xed66d[_0x805b87(0x201)]('/')&&(_0x441c75=_0x20086f+'/'+_0xed66d,_0x155b09[_0x805b87(0x20b)]&&console[_0x805b87(0x21e)](_0x805b87(0x225)+_0x441c75));const _0x2b5de6=await withSpinner(_0x805b87(0x1df)+_0x441c75+_0x805b87(0x22d),()=>_0x427d04['segment'][_0x805b87(0x22c)](_0x441c75),{'verbose':_0x155b09[_0x805b87(0x20b)]}),_0x2a9b49=_0x2b5de6[_0x805b87(0x1ed)];_0x155b09[_0x805b87(0x20b)]&&(console[_0x805b87(0x21e)](_0x805b87(0x1b4)+_0x2a9b49['type']),console[_0x805b87(0x21e)](_0x805b87(0x206)+_0x2a9b49[_0x805b87(0x22f)]),_0x2a9b49[_0x805b87(0x1ef)]&&console['error'](_0x805b87(0x20a)+_0x2a9b49[_0x805b87(0x1ef)]),_0x2a9b49[_0x805b87(0x1ad)]&&console[_0x805b87(0x21e)](_0x805b87(0x21f)+_0x2a9b49[_0x805b87(0x1ad)]));if(_0x2a9b49[_0x805b87(0x204)]===_0x805b87(0x19b)){const _0x238006=await withSpinner(_0x805b87(0x1ae),()=>_0x427d04['segment'][_0x805b87(0x1db)](_0x2a9b49[_0x805b87(0x22f)]),{'verbose':_0x155b09[_0x805b87(0x20b)]});await handleSingleObjectOutput(_0x238006[_0x805b87(0x1ed)],_0x155b09);}else{if(_0x2a9b49[_0x805b87(0x204)]===_0x805b87(0x1ee)){if(!_0x2a9b49['folderId'])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x4094d2=await withSpinner(_0x805b87(0x211),()=>_0x427d04['segment'][_0x805b87(0x1f4)](_0x2a9b49['folderId']),{'verbose':_0x155b09[_0x805b87(0x20b)]});await handleSingleObjectOutput(_0x4094d2['data'],_0x155b09);}else{if(_0x2a9b49[_0x805b87(0x204)]===_0x805b87(0x1b3)){if(!_0x2a9b49['segmentId'])throw new SDKError(ErrorCode[_0x805b87(0x1bf)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x44a397=await withSpinner('Fetching\x20segment\x20details...',()=>_0x427d04['segment']['getSegment'](_0x2a9b49[_0x805b87(0x22f)],_0x2a9b49[_0x805b87(0x1ad)]),{'verbose':_0x155b09[_0x805b87(0x20b)]});await handleSingleObjectOutput(_0x44a397[_0x805b87(0x1ed)],_0x155b09);}}}return 0x0;}catch(_0x25ec77){if(_0x25ec77 instanceof SDKError)return console[_0x805b87(0x21e)](_0x805b87(0x214)+_0x25ec77[_0x805b87(0x192)]),_0x25ec77[_0x805b87(0x1b5)]&&console[_0x805b87(0x21e)](_0x805b87(0x1d2)+_0x25ec77[_0x805b87(0x1b5)]),0x1;throw _0x25ec77;}}}function a37_0xbe90(){const _0x5ad3ab=['segment:folder:list','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','getFolder','Usage:\x20tdx\x20segment\x20describe\x20<path>','resolveParentId','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Parent\x20segment:\x20','Usage:\x20tdx\x20sg\x20show\x20<name>','Fetching\x20SQL\x20for\x20segment...','description','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','replace','(root)','length','toLocaleString','includes','✔\x20Query\x20completed:\x20Processed\x20','segment:folder:show','type','601820Hsudya','Parent\x20ID:\x20','code','createFolder','✔\x20Created\x20folder\x20\x27','Folder\x20ID:\x20','verbose','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Use:\x20tdx\x20ps\x20view','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Fetching\x20folder\x20details...','segment:show','\x20\x20Segment\x20name:\x20','Error:\x20','Use:\x20tdx\x20ps\x20desc','getSegmentSQL','Use:\x20tdx\x20ps\x20show','Examples:','Show\x20folder\x20or\x20child\x20segment\x20details','Resolving\x20parent\x20folder\x20\x27','segmentPath','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','SQL\x20query:\x0a','error','Segment\x20ID:\x20','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Target\x20path:\x20','jobId','Resolved\x20relative\x20path\x20to:\x20','jsonl','Usage:','766638MGmXGj','Options:','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','resolvePathToResource','\x27...','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','parentId','resolveFolderId','fullPath','red','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','message','segment:folder:create','stats','Executing\x20segment\x20query...','4264668xhQgDS','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','format','/app/ps/','segment:sql','parent','name','SEGMENT_FOLDER_NOT_FOUND','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Error:\x20Path\x20or\x20name\x20is\x20required','getSegment','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','\x20folder','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','getSQLFromYamlFile','Resolved\x20parent\x20ID:\x20','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20Full\x20path:\x20','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','segmentName','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','\x27\x20with\x20ID:\x20','Resolved:\x20','segmentId','Fetching\x20parent\x20segment\x20details...','SELECT\x20*\x20FROM\x20(\x0a','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','\x20[Job\x20ID:\x20','/e/','segment','Resolved\x20type:\x20','cause','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','cyan','segment:desc','listFolders','781071FTEfiB','\x20Opening\x20','Creating\x20folder\x20\x27','green','path','SEGMENT_NOT_FOUND','site','✖\x20Query\x20failed\x20[','parentSegment','in\x20','url','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','execute','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','json','getSQLFromServerSegment','segment:describe','Create\x20segment\x20folder\x20for\x20organization','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Usage:\x20tdx\x20sg\x20desc\x20<name>','Resolving\x20\x27','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','\x20\x20Cause:\x20','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','✔\x20Found\x20','INVALID_ARGUMENT','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','8VaPLYi','Show\x20segment\x20or\x20folder\x20details','6796764nrLaOV','getParent','16665IJrWlF','getSegmentSQLFromYaml','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Resolving\x20path\x20\x27','elapsedTimeMillis','Resolved\x20YAML\x20file:\x20','Fetching\x20segment\x20details...','Resolving\x20folder\x20\x27','Show\x20segment\x20folder\x20details','Fetching\x20SQL\x20from\x20rule...','Folder\x20name:\x20','trim','Parent\x20name:\x20','214wGWJYU','Site:\x20','parentFolder','Resolving\x20parent\x20segment\x20\x27','data','folder','folderId','241311YfHZim','processedRows'];a37_0xbe90=function(){return _0x5ad3ab;};return a37_0xbe90();}export class SegmentShowCommand extends BaseCommand{[a37_0x54e21e(0x19c)]=a37_0x54e21e(0x212);['description']=a37_0x54e21e(0x1fc);async['execute'](_0x4be63a){const _0x315393=a37_0x54e21e,{options:_0x5558c3,args:_0x233c8f,tdx:_0x2830f8}=_0x4be63a,_0x151093=_0x233c8f[0x0];if(!_0x151093)return console['error'](_0x315393(0x221)),console[_0x315393(0x21e)](_0x315393(0x1f9)),console[_0x315393(0x21e)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x315393(0x21e)](_0x315393(0x218)),console[_0x315393(0x21e)](_0x315393(0x20e)),console['error'](_0x315393(0x21c)),0x1;try{const _0x578995=_0x5558c3[_0x315393(0x1c2)],_0x45cc44=await resolveSegmentTarget(_0x151093,_0x578995,_0x5558c3['verbose']);_0x5558c3[_0x315393(0x20b)]&&console['error'](_0x315393(0x223)+_0x45cc44);const _0x3507b4=await withSpinner(_0x315393(0x1d0)+_0x151093+_0x315393(0x22d),()=>_0x2830f8[_0x315393(0x1b3)][_0x315393(0x22c)](_0x45cc44),{'verbose':_0x5558c3[_0x315393(0x20b)]}),_0x8fa0c0=_0x3507b4[_0x315393(0x1ed)];_0x5558c3[_0x315393(0x20b)]&&(console['error']('Resolved\x20type:\x20'+_0x8fa0c0[_0x315393(0x204)]),console[_0x315393(0x21e)](_0x315393(0x206)+_0x8fa0c0[_0x315393(0x22f)]));if(_0x8fa0c0['type']===_0x315393(0x1ee))return console[_0x315393(0x21e)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0x315393(0x21e)](_0x315393(0x1d7)),0x1;if(_0x8fa0c0[_0x315393(0x204)]===_0x315393(0x19b))return console[_0x315393(0x21e)](_0x315393(0x1a6)),console['error'](_0x315393(0x217)),0x1;if(!_0x8fa0c0[_0x315393(0x1ad)])throw new SDKError(ErrorCode[_0x315393(0x1bf)],_0x315393(0x222));const _0x28a0fe=await withSpinner(_0x315393(0x1fa),()=>_0x2830f8[_0x315393(0x1b3)][_0x315393(0x216)](_0x8fa0c0[_0x315393(0x22f)],_0x8fa0c0[_0x315393(0x1ad)]),{'verbose':_0x5558c3[_0x315393(0x20b)]});let _0x369cb9=_0x28a0fe[_0x315393(0x1ed)];const _0x3992ed=resolveLimit(_0x5558c3['limit'],DEFAULT_DISPLAY_LIMIT),_0x401e28=/\bLIMIT\s+\d+/i['test'](_0x369cb9);!_0x401e28&&(_0x369cb9=_0x369cb9[_0x315393(0x1e7)]()[_0x315393(0x1fd)](/;+$/,''),_0x369cb9=_0x315393(0x1af)+_0x369cb9+_0x315393(0x22e)+_0x3992ed);_0x5558c3[_0x315393(0x20b)]&&console[_0x315393(0x21e)](_0x315393(0x21d)+_0x369cb9);const _0x44ca92=await withProgressSpinner(_0x315393(0x195),async _0x6403a2=>{const _0x410248=_0x315393,_0x51e2d2=await _0x2830f8['query'][_0x410248(0x1c6)](_0x369cb9,{'catalog':'td','schema':'information_schema','onJobId':_0x1fc2f2=>{_0x6403a2['setJobId'](_0x1fc2f2);}});return _0x51e2d2;},{'verbose':_0x5558c3[_0x315393(0x20b)]}),_0x38eb09=_0x44ca92[_0x315393(0x1ed)],_0xc9dd42=_0x38eb09[_0x315393(0x224)]?_0x315393(0x1b1)+_0x38eb09['jobId']+']':'';return console[_0x315393(0x21e)](_0x315393(0x202)+_0x38eb09[_0x315393(0x194)][_0x315393(0x1f1)][_0x315393(0x200)]()+'\x20rows\x20'+(_0x315393(0x1c3)+formatElapsed(_0x38eb09[_0x315393(0x194)][_0x315393(0x1e0)])+_0xc9dd42)),await handleQueryOutput(_0x38eb09,_0x5558c3),0x0;}catch(_0x223363){if(_0x223363 instanceof SDKError)return console[_0x315393(0x21e)](_0x315393(0x1c1)+_0x223363[_0x315393(0x207)]+']'),console[_0x315393(0x21e)]('\x0a'+_0x223363[_0x315393(0x192)]),0x1;throw _0x223363;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x54e21e(0x19c)]=a37_0x54e21e(0x1f2);[a37_0x54e21e(0x1fb)]=a37_0x54e21e(0x1d6);async['execute'](_0xa1858f){const _0x18b1d7=a37_0x54e21e,{options:_0x1dd47b,args:_0x4900b5,tdx:_0x3754cf}=_0xa1858f;if(_0x4900b5['length']===0x0)return console['error']('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x18b1d7(0x21e)](_0x18b1d7(0x1d3)),0x1;const _0x150d59=_0x4900b5[0x0];try{_0x1dd47b[_0x18b1d7(0x20b)]&&(console[_0x18b1d7(0x21e)](_0x18b1d7(0x1ea)+_0x1dd47b[_0x18b1d7(0x1c0)]),console[_0x18b1d7(0x21e)](_0x18b1d7(0x1e8)+_0x150d59));const _0x100bea=await withSpinner(_0x18b1d7(0x1ec)+_0x150d59+_0x18b1d7(0x22d),()=>_0x3754cf[_0x18b1d7(0x1b3)]['resolveParentId'](_0x150d59),{'verbose':_0x1dd47b[_0x18b1d7(0x20b)]}),_0x1c11cd=_0x100bea[_0x18b1d7(0x1ed)];_0x1dd47b['verbose']&&console[_0x18b1d7(0x21e)]('Resolved\x20parent\x20ID:\x20'+_0x1c11cd);const _0x35e03e=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x150d59+_0x18b1d7(0x22d),()=>_0x3754cf[_0x18b1d7(0x1b3)][_0x18b1d7(0x1b9)](_0x1c11cd),{'verbose':_0x1dd47b[_0x18b1d7(0x20b)]}),_0x575ab0=_0x35e03e[_0x18b1d7(0x1ed)];return console[_0x18b1d7(0x21e)](_0x18b1d7(0x1d4)+_0x575ab0[_0x18b1d7(0x1ff)]+_0x18b1d7(0x1a2)+(_0x575ab0[_0x18b1d7(0x1ff)]!==0x1?'s':'')),await handleSDKOutput(_0x575ab0,_0x1dd47b),0x0;}catch(_0x1b9547){if(_0x1b9547 instanceof SDKError)return console[_0x18b1d7(0x21e)](_0x18b1d7(0x214)+_0x1b9547['message']),_0x1b9547[_0x18b1d7(0x1b5)]&&console[_0x18b1d7(0x21e)]('\x20\x20Cause:\x20'+_0x1b9547[_0x18b1d7(0x1b5)]),0x1;throw _0x1b9547;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x54e21e(0x19c)]=a37_0x54e21e(0x203);[a37_0x54e21e(0x1fb)]=a37_0x54e21e(0x1e4);async[a37_0x54e21e(0x1c6)](_0x106f5b){const _0x51e21f=a37_0x54e21e,{options:_0x101c98,args:_0x5315be,tdx:_0x38293e}=_0x106f5b;if(_0x5315be[_0x51e21f(0x1ff)]===0x0)return console[_0x51e21f(0x21e)]('Error:\x20Folder\x20reference\x20is\x20required'),console['error']('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x7a71c1,childId:_0x2f29a2}=parseSegmentRef(_0x5315be[0x0]);_0x101c98[_0x51e21f(0x20b)]&&(console[_0x51e21f(0x21e)](_0x51e21f(0x1ea)+_0x101c98[_0x51e21f(0x1c0)]),console[_0x51e21f(0x21e)](_0x51e21f(0x1e8)+_0x7a71c1),_0x2f29a2&&console[_0x51e21f(0x21e)](_0x51e21f(0x1e6)+_0x2f29a2));if(!_0x2f29a2)return console['error'](_0x51e21f(0x1a8)),0x1;const _0x43ea3a=await withSpinner(_0x51e21f(0x1ec)+_0x7a71c1+_0x51e21f(0x22d),()=>_0x38293e['segment'][_0x51e21f(0x1f6)](_0x7a71c1),{'verbose':_0x101c98[_0x51e21f(0x20b)]}),_0x4e7a9e=_0x43ea3a[_0x51e21f(0x1ed)];_0x101c98[_0x51e21f(0x20b)]&&console[_0x51e21f(0x21e)](_0x51e21f(0x1a5)+_0x4e7a9e);const _0xa1dbf0=await withSpinner(_0x51e21f(0x1e3)+_0x2f29a2+_0x51e21f(0x22d),()=>_0x38293e[_0x51e21f(0x1b3)][_0x51e21f(0x230)](_0x4e7a9e,_0x2f29a2),{'verbose':_0x101c98[_0x51e21f(0x20b)]}),_0x170dc7=_0xa1dbf0[_0x51e21f(0x1ed)];_0x101c98['verbose']&&console[_0x51e21f(0x21e)]('Resolved\x20folder\x20ID:\x20'+_0x170dc7);const _0x156781=await withSpinner('Fetching\x20folder\x20\x27'+_0x2f29a2+_0x51e21f(0x22d),()=>_0x38293e[_0x51e21f(0x1b3)][_0x51e21f(0x1f4)](_0x170dc7),{'verbose':_0x101c98[_0x51e21f(0x20b)]});return await handleSDKOutput([_0x156781['data']],_0x101c98),0x0;}catch(_0x5f20f5){if(_0x5f20f5 instanceof SDKError)return console[_0x51e21f(0x21e)]('Error:\x20'+_0x5f20f5[_0x51e21f(0x192)]),_0x5f20f5[_0x51e21f(0x1b5)]&&console[_0x51e21f(0x21e)](_0x51e21f(0x1d2)+_0x5f20f5[_0x51e21f(0x1b5)]),0x1;throw _0x5f20f5;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x54e21e(0x19c)]=a37_0x54e21e(0x19a);[a37_0x54e21e(0x1fb)]='Get\x20SQL\x20query\x20for\x20child\x20segment';async['execute'](_0x1ee938){const _0x1b8773=a37_0x54e21e,{options:_0x597ec6,args:_0x32f4d2}=_0x1ee938,_0x5ec8fd=_0x597ec6,_0x24d20c=_0x5ec8fd[_0x1b8773(0x1be)],_0x2f7cf3=_0x32f4d2[0x0];if(!_0x2f7cf3&&!_0x24d20c)return console['error'](a37_0x4ccd79[_0x1b8773(0x232)]('Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required')),console[_0x1b8773(0x21e)](_0x1b8773(0x227)),console[_0x1b8773(0x21e)](_0x1b8773(0x190)),console[_0x1b8773(0x21e)](_0x1b8773(0x191)),console[_0x1b8773(0x21e)]('Examples:'),console[_0x1b8773(0x21e)](_0x1b8773(0x1ce)),console['error'](_0x1b8773(0x20d)),0x1;if(_0x2f7cf3&&_0x24d20c)return console[_0x1b8773(0x21e)](a37_0x4ccd79[_0x1b8773(0x232)]('Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both')),0x1;try{let _0x3c5315;if(_0x24d20c)_0x3c5315=await this['getSQLFromYamlFile'](_0x24d20c,_0x1ee938);else{if(isYamlFilePath(_0x2f7cf3))return console[_0x1b8773(0x21e)](a37_0x4ccd79[_0x1b8773(0x232)]('Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option')),console[_0x1b8773(0x21e)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20'+_0x2f7cf3),0x1;else _0x3c5315=await this[_0x1b8773(0x1ca)](_0x2f7cf3,_0x1ee938);}return _0x597ec6[_0x1b8773(0x198)]===_0x1b8773(0x1c9)||_0x597ec6[_0x1b8773(0x198)]===_0x1b8773(0x226)?await handleSDKOutput([{'sql':_0x3c5315}],_0x597ec6):console['log'](_0x3c5315),0x0;}catch(_0xba936d){if(_0xba936d instanceof SDKError)return console[_0x1b8773(0x21e)]('Error:\x20'+_0xba936d[_0x1b8773(0x192)]),_0xba936d[_0x1b8773(0x1b5)]&&console[_0x1b8773(0x21e)](_0x1b8773(0x1d2)+_0xba936d[_0x1b8773(0x1b5)]),0x1;throw _0xba936d;}}async[a37_0x54e21e(0x1a4)](_0x452c39,_0x50ee70){const _0x3762f1=a37_0x54e21e,{options:_0x569fa5,tdx:_0x3581d1}=_0x50ee70;let _0x50a56b;try{_0x50a56b=await resolveYamlFilePath(_0x452c39);}catch(_0x5a92b3){throw new SDKError(ErrorCode[_0x3762f1(0x1d5)],_0x3762f1(0x1c8)+_0x5a92b3['message']);}_0x569fa5['verbose']&&console[_0x3762f1(0x21e)](_0x3762f1(0x1ac)+_0x50a56b['parentSegment']+'/'+_0x50a56b[_0x3762f1(0x1a9)]);const _0x58cb35=await withSpinner(_0x3762f1(0x1e5),()=>_0x3581d1[_0x3762f1(0x1b3)][_0x3762f1(0x1dd)](_0x50a56b['content'],_0x50a56b['parentSegment'],_0x50a56b['segmentName']),{'verbose':_0x569fa5['verbose']});return _0x58cb35[_0x3762f1(0x1ed)];}async[a37_0x54e21e(0x1ca)](_0x4da972,_0x17d999){const _0x4ba9cf=a37_0x54e21e,{options:_0x379e92,tdx:_0x4336ac}=_0x17d999,_0x2ec20e=_0x379e92[_0x4ba9cf(0x1c2)],_0x2adda8=await resolveSegmentTarget(_0x4da972,_0x2ec20e,_0x379e92[_0x4ba9cf(0x20b)]);_0x379e92[_0x4ba9cf(0x20b)]&&console[_0x4ba9cf(0x21e)]('Target\x20path:\x20'+_0x2adda8);const _0x241edd=await withSpinner(_0x4ba9cf(0x1d0)+_0x4da972+_0x4ba9cf(0x22d),()=>_0x4336ac[_0x4ba9cf(0x1b3)][_0x4ba9cf(0x22c)](_0x2adda8),{'verbose':_0x379e92['verbose']}),_0x4a12ef=_0x241edd['data'];_0x379e92[_0x4ba9cf(0x20b)]&&(console[_0x4ba9cf(0x21e)]('Resolved\x20type:\x20'+_0x4a12ef['type']),console[_0x4ba9cf(0x21e)](_0x4ba9cf(0x206)+_0x4a12ef[_0x4ba9cf(0x22f)]));if(_0x4a12ef['type']==='folder')throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x4ba9cf(0x1aa));if(_0x4a12ef[_0x4ba9cf(0x204)]===_0x4ba9cf(0x19b))throw new SDKError(ErrorCode[_0x4ba9cf(0x1d5)],_0x4ba9cf(0x1a3));if(!_0x4a12ef[_0x4ba9cf(0x1ad)])throw new SDKError(ErrorCode[_0x4ba9cf(0x1bf)],_0x4ba9cf(0x222));const _0xddf36f=await withSpinner(_0x4ba9cf(0x1fa),()=>_0x4336ac[_0x4ba9cf(0x1b3)][_0x4ba9cf(0x216)](_0x4a12ef[_0x4ba9cf(0x22f)],_0x4a12ef[_0x4ba9cf(0x1ad)]),{'verbose':_0x379e92['verbose']});return _0xddf36f[_0x4ba9cf(0x1ed)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x54e21e(0x19c)]=a37_0x54e21e(0x193);[a37_0x54e21e(0x1fb)]=a37_0x54e21e(0x1cc);async['execute'](_0x299e76){const _0xbb8677=a37_0x54e21e,{options:_0x4b8e21,args:_0x249092,tdx:_0x463bb0}=_0x299e76,_0x43b602=_0x4b8e21;if(_0x249092[_0xbb8677(0x1ff)]<0x2)return console[_0xbb8677(0x21e)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console[_0xbb8677(0x21e)](_0xbb8677(0x210)),0x1;const _0x1026d0=_0x249092[0x0],_0x1a25d7=_0x249092[0x1];_0x43b602[_0xbb8677(0x20b)]&&(console[_0xbb8677(0x21e)](_0xbb8677(0x1ea)+_0x43b602[_0xbb8677(0x1c0)]),console[_0xbb8677(0x21e)](_0xbb8677(0x1f8)+_0x1026d0),console[_0xbb8677(0x21e)](_0xbb8677(0x1e6)+_0x1a25d7));let _0x2db419;if(_0x43b602[_0xbb8677(0x1eb)]){const _0x50c2e3=_0x43b602[_0xbb8677(0x1eb)],_0x594a23=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x1026d0+_0xbb8677(0x22d),()=>_0x463bb0[_0xbb8677(0x1b3)][_0xbb8677(0x1f6)](_0x1026d0),{'verbose':_0x43b602['verbose']}),_0x49a8ff=_0x594a23[_0xbb8677(0x1ed)],_0x4a8da4=await withSpinner(_0xbb8677(0x21a)+_0x50c2e3+'\x27...',()=>_0x463bb0[_0xbb8677(0x1b3)][_0xbb8677(0x230)](_0x49a8ff,_0x50c2e3),{'verbose':_0x43b602[_0xbb8677(0x20b)]});_0x2db419=_0x4a8da4[_0xbb8677(0x1ed)],_0x43b602['verbose']&&console[_0xbb8677(0x21e)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x2db419);}const _0x49b748={'name':_0x1a25d7,'description':_0x43b602[_0xbb8677(0x1fb)],'parentFolderId':_0x2db419},_0x5ace9b=await withSpinner(_0xbb8677(0x1bc)+_0x1a25d7+_0xbb8677(0x22d),()=>_0x463bb0[_0xbb8677(0x1b3)][_0xbb8677(0x208)](_0x1026d0,_0x49b748),{'verbose':_0x43b602[_0xbb8677(0x20b)]}),_0x539823=_0x5ace9b['data'];return console[_0xbb8677(0x21e)](_0xbb8677(0x209)+_0x539823[_0xbb8677(0x19c)]+_0xbb8677(0x1ab)+_0x539823['id']),await handleSDKOutput([_0x539823],_0x43b602),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x54e21e(0x19c)]='segment:view';[a37_0x54e21e(0x1fb)]=a37_0x54e21e(0x219);async[a37_0x54e21e(0x1c6)](_0x24c075){const _0x171453=a37_0x54e21e,{options:_0x175ce3,args:_0x7b63b6,tdx:_0x4b1169}=_0x24c075,_0x39f307=_0x7b63b6[0x0];if(!_0x39f307)return console[_0x171453(0x21e)](_0x171453(0x1b6)),console[_0x171453(0x21e)](_0x171453(0x1f7)),console['error'](_0x171453(0x1a1)),console[_0x171453(0x21e)](_0x171453(0x229)),console['error'](_0x171453(0x220)),console['error'](_0x171453(0x218)),console[_0x171453(0x21e)](_0x171453(0x1cd)),console[_0x171453(0x21e)](_0x171453(0x1c5)),console[_0x171453(0x21e)](_0x171453(0x22a)),console[_0x171453(0x21e)](_0x171453(0x22b)),0x1;try{const _0x4f78d1=_0x175ce3[_0x171453(0x1c2)],_0x5661d4=await resolveSegmentTarget(_0x39f307,_0x4f78d1,_0x175ce3[_0x171453(0x20b)]);_0x175ce3[_0x171453(0x20b)]&&console[_0x171453(0x21e)]('Target\x20path:\x20'+_0x5661d4);const _0x2fc82c=await withSpinner('Resolving\x20\x27'+_0x39f307+_0x171453(0x22d),()=>_0x4b1169[_0x171453(0x1b3)][_0x171453(0x22c)](_0x5661d4),{'verbose':_0x175ce3[_0x171453(0x20b)]}),_0xf1ea5e=_0x2fc82c[_0x171453(0x1ed)];_0x175ce3[_0x171453(0x20b)]&&(console[_0x171453(0x21e)]('Resolved\x20type:\x20'+_0xf1ea5e[_0x171453(0x204)]),console[_0x171453(0x21e)](_0x171453(0x206)+_0xf1ea5e['parentId']),_0xf1ea5e[_0x171453(0x1ef)]&&console[_0x171453(0x21e)]('Folder\x20ID:\x20'+_0xf1ea5e[_0x171453(0x1ef)]),_0xf1ea5e[_0x171453(0x1ad)]&&console[_0x171453(0x21e)]('Segment\x20ID:\x20'+_0xf1ea5e['segmentId']));if(_0x175ce3['web']){if(_0xf1ea5e[_0x171453(0x204)]===_0x171453(0x1ee))return console['error']('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0xf1ea5e[_0x171453(0x204)]===_0x171453(0x19b))return console[_0x171453(0x21e)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x171453(0x21e)]('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0xf1ea5e[_0x171453(0x1ad)])throw new SDKError(ErrorCode[_0x171453(0x1bf)],_0x171453(0x222));const _0x1cffa1=getConsoleNextUrl(_0x175ce3[_0x171453(0x1c0)],_0x171453(0x199)+_0xf1ea5e[_0x171453(0x22f)]+_0x171453(0x1b2)+_0xf1ea5e[_0x171453(0x1ad)]);return console[_0x171453(0x21e)](a37_0x4ccd79[_0x171453(0x1bd)]('✔')+_0x171453(0x1bb)+a37_0x4ccd79[_0x171453(0x1b7)](_0x1cffa1)),openBrowser(_0x1cffa1),0x0;}if(_0xf1ea5e['type']==='folder'){if(!_0xf1ea5e[_0x171453(0x1ef)])throw new SDKError(ErrorCode[_0x171453(0x19d)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x42481e=await withSpinner(_0x171453(0x211),()=>_0x4b1169[_0x171453(0x1b3)][_0x171453(0x1f4)](_0xf1ea5e[_0x171453(0x1ef)]),{'verbose':_0x175ce3[_0x171453(0x20b)]});await handleSingleObjectOutput(_0x42481e[_0x171453(0x1ed)],_0x175ce3);}else{if(_0xf1ea5e[_0x171453(0x204)]===_0x171453(0x1b3)){if(!_0xf1ea5e['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x171453(0x222));const _0x1c4582=await withSpinner(_0x171453(0x1e2),()=>_0x4b1169[_0x171453(0x1b3)][_0x171453(0x1a0)](_0xf1ea5e[_0x171453(0x22f)],_0xf1ea5e[_0x171453(0x1ad)]),{'verbose':_0x175ce3[_0x171453(0x20b)]}),_0xa337e5=getConsoleNextUrl(_0x175ce3[_0x171453(0x1c0)],_0x171453(0x199)+_0xf1ea5e[_0x171453(0x22f)]+'/e/'+_0xf1ea5e[_0x171453(0x1ad)]),_0x27a830=_0x1c4582[_0x171453(0x1ed)];_0x27a830[_0x171453(0x1c4)]=_0xa337e5,await handleSingleObjectOutput(_0x27a830,_0x175ce3);}else return console[_0x171453(0x21e)]('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console[_0x171453(0x21e)](_0x171453(0x20f)),0x1;}return 0x0;}catch(_0x413a8f){if(_0x413a8f instanceof SDKError)return console[_0x171453(0x21e)]('Error:\x20'+_0x413a8f[_0x171453(0x192)]),_0x413a8f[_0x171453(0x1b5)]&&console[_0x171453(0x21e)]('\x20\x20Cause:\x20'+_0x413a8f[_0x171453(0x1b5)]),0x1;throw _0x413a8f;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x54e21e(0x19c)]=a37_0x54e21e(0x1b8);['description']='Show\x20child\x20segment\x20schema\x20(column\x20types)';async[a37_0x54e21e(0x1c6)](_0x481065){const _0x2f3283=a37_0x54e21e,{options:_0x26b276,args:_0x198390,tdx:_0x4afedd}=_0x481065,_0x18b110=_0x198390[0x0];if(!_0x18b110)return console[_0x2f3283(0x21e)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x2f3283(0x21e)](_0x2f3283(0x1cf)),console[_0x2f3283(0x21e)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console[_0x2f3283(0x21e)](_0x2f3283(0x218)),console['error'](_0x2f3283(0x19e)),console[_0x2f3283(0x21e)](_0x2f3283(0x1de)),0x1;try{const _0x37c012=_0x26b276['parentSegment'],_0x1afd98=await resolveSegmentTarget(_0x18b110,_0x37c012,_0x26b276['verbose']);_0x26b276[_0x2f3283(0x20b)]&&console[_0x2f3283(0x21e)]('Target\x20path:\x20'+_0x1afd98);const _0x3a925b=await withSpinner(_0x2f3283(0x1d0)+_0x18b110+'\x27...',()=>_0x4afedd[_0x2f3283(0x1b3)][_0x2f3283(0x22c)](_0x1afd98),{'verbose':_0x26b276[_0x2f3283(0x20b)]}),_0x1c9368=_0x3a925b[_0x2f3283(0x1ed)];_0x26b276[_0x2f3283(0x20b)]&&(console[_0x2f3283(0x21e)](_0x2f3283(0x1b4)+_0x1c9368[_0x2f3283(0x204)]),console[_0x2f3283(0x21e)](_0x2f3283(0x206)+_0x1c9368[_0x2f3283(0x22f)]));if(_0x1c9368[_0x2f3283(0x204)]===_0x2f3283(0x1ee))return console[_0x2f3283(0x21e)](_0x2f3283(0x1d1)),console[_0x2f3283(0x21e)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x1c9368[_0x2f3283(0x204)]===_0x2f3283(0x19b))return console[_0x2f3283(0x21e)](_0x2f3283(0x1c7)),console[_0x2f3283(0x21e)](_0x2f3283(0x215)),0x1;if(!_0x1c9368['segmentId'])throw new SDKError(ErrorCode[_0x2f3283(0x1bf)],_0x2f3283(0x222));const _0x59da5d=await withSpinner(_0x2f3283(0x1fa),()=>_0x4afedd['segment']['getSegmentSQL'](_0x1c9368[_0x2f3283(0x22f)],_0x1c9368[_0x2f3283(0x1ad)]),{'verbose':_0x26b276[_0x2f3283(0x20b)]}),_0x4a6c66=_0x59da5d[_0x2f3283(0x1ed)],_0x2411c7=await executeSchemaQuery(_0x4a6c66,_0x4afedd,_0x26b276);return await handleQueryOutput(_0x2411c7,_0x26b276),0x0;}catch(_0x51e8df){if(_0x51e8df instanceof SDKError)return console[_0x2f3283(0x21e)]('Error:\x20'+_0x51e8df[_0x2f3283(0x192)]),_0x51e8df['cause']&&console[_0x2f3283(0x21e)](_0x2f3283(0x1d2)+_0x51e8df[_0x2f3283(0x1b5)]),0x1;throw _0x51e8df;}}}
@@ -1 +1 @@
1
- const a38_0x1260f2=a38_0x5e15;(function(_0x4c10f5,_0x4a5895){const _0x442132=a38_0x5e15,_0xb6b530=_0x4c10f5();while(!![]){try{const _0x42fbe5=parseInt(_0x442132(0x16c))/0x1+parseInt(_0x442132(0x15a))/0x2+parseInt(_0x442132(0x177))/0x3+-parseInt(_0x442132(0x181))/0x4+parseInt(_0x442132(0x174))/0x5+parseInt(_0x442132(0x166))/0x6*(parseInt(_0x442132(0x180))/0x7)+parseInt(_0x442132(0x16a))/0x8*(-parseInt(_0x442132(0x182))/0x9);if(_0x42fbe5===_0x4a5895)break;else _0xb6b530['push'](_0xb6b530['shift']());}catch(_0x3d02b3){_0xb6b530['push'](_0xb6b530['shift']());}}}(a38_0x4627,0xd6348));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a38_0x5e15(_0x196d1b,_0x50753f){_0x196d1b=_0x196d1b-0x150;const _0x462753=a38_0x4627();let _0x5e154=_0x462753[_0x196d1b];return _0x5e154;}import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x3d33dc from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']=a38_0x1260f2(0x159);[a38_0x1260f2(0x168)]=a38_0x1260f2(0x17b);async[a38_0x1260f2(0x16b)](_0x4561e8){const _0x446d8a=a38_0x1260f2;console[_0x446d8a(0x151)](a38_0x3d33dc[_0x446d8a(0x155)](_0x446d8a(0x150))),console[_0x446d8a(0x151)](a38_0x3d33dc['yellow'](_0x446d8a(0x164)));const {options:_0x263033,args:_0x262546,tdx:_0x2303c5}=_0x4561e8,_0x1275cb=_0x263033;if(_0x262546['length']===0x0)return console[_0x446d8a(0x151)](_0x446d8a(0x16e)),console[_0x446d8a(0x151)](_0x446d8a(0x156)),console['error'](_0x446d8a(0x184)),console['error']('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console[_0x446d8a(0x151)](_0x446d8a(0x183)),console['error'](_0x446d8a(0x162)),0x1;const _0xa9a1db=_0x262546[0x0],_0x5e7d5c=_0x263033[_0x446d8a(0x17c)];let _0x5e6f28=_0xa9a1db;_0x5e7d5c&&!_0xa9a1db[_0x446d8a(0x152)]('/')&&(_0x5e6f28=_0x5e7d5c+'/'+_0xa9a1db,_0x1275cb['verbose']&&console[_0x446d8a(0x151)](_0x446d8a(0x171)+_0x5e6f28));const _0x12add6=parsePath(_0x5e6f28);if(_0x12add6[_0x446d8a(0x153)][_0x446d8a(0x178)]<0x2)return console[_0x446d8a(0x151)]('Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'),console['error'](_0x446d8a(0x173)),0x1;const _0x149daa=_0x12add6[_0x446d8a(0x153)][0x0],_0x1942fd=getBaseName(_0x5e6f28),_0x3a9eae=getParentPath(_0x5e6f28);_0x1275cb[_0x446d8a(0x176)]&&(console[_0x446d8a(0x151)]('Site:\x20'+_0x1275cb[_0x446d8a(0x17a)]),console[_0x446d8a(0x151)](_0x446d8a(0x170)+_0x5e6f28),console[_0x446d8a(0x151)](_0x446d8a(0x158)+_0x149daa),console[_0x446d8a(0x151)](_0x446d8a(0x179)+_0x1942fd),console[_0x446d8a(0x151)](_0x446d8a(0x160)+_0x3a9eae));const _0x491ed5=await withSpinner(_0x446d8a(0x165)+_0x149daa+_0x446d8a(0x17d),()=>_0x2303c5[_0x446d8a(0x169)][_0x446d8a(0x16d)](_0x149daa),{'verbose':_0x1275cb[_0x446d8a(0x176)]}),_0x2a863d=_0x491ed5['data'];let _0x41bf2f;if(_0x12add6[_0x446d8a(0x153)]['length']>0x2){const _0x3ede04=await withSpinner('Resolving\x20folder\x20path\x20\x27'+_0x3a9eae+_0x446d8a(0x17d),()=>_0x2303c5[_0x446d8a(0x169)]['resolvePathToResource'](_0x3a9eae),{'verbose':_0x1275cb[_0x446d8a(0x176)]}),_0xc612d=_0x3ede04['data'];if(_0xc612d['type']!==_0x446d8a(0x161)&&_0xc612d['type']!==_0x446d8a(0x172))return console['error']('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x41bf2f=_0xc612d[_0x446d8a(0x163)];}else{if(_0x1275cb[_0x446d8a(0x161)]){const _0x516614=await withSpinner(_0x446d8a(0x157)+_0x1275cb[_0x446d8a(0x161)]+_0x446d8a(0x17d),()=>_0x2303c5['segment'][_0x446d8a(0x17f)](_0x2a863d,_0x1275cb[_0x446d8a(0x161)]),{'verbose':_0x1275cb[_0x446d8a(0x176)]});_0x41bf2f=_0x516614[_0x446d8a(0x15d)];}}_0x1275cb[_0x446d8a(0x176)]&&_0x41bf2f&&console[_0x446d8a(0x151)](_0x446d8a(0x16f)+_0x41bf2f);const _0x2c900b=await loadJSONFromOptions(_0x1275cb[_0x446d8a(0x15f)],_0x1275cb[_0x446d8a(0x15c)]),_0x4dacc3={'name':_0x1942fd,'description':_0x1275cb[_0x446d8a(0x168)],'rule':_0x2c900b,'kind':_0x1275cb[_0x446d8a(0x17e)]!==undefined?parseInt(_0x1275cb[_0x446d8a(0x17e)],0xa):undefined,'isVisible':_0x1275cb['invisible']?![]:undefined,'segmentFolderId':_0x41bf2f,'countPopulation':_0x1275cb['noCountPopulation']?![]:undefined},_0x249e6b=await withSpinner('Creating\x20segment\x20\x27'+_0x1942fd+_0x446d8a(0x17d),()=>_0x2303c5[_0x446d8a(0x169)][_0x446d8a(0x15b)](_0x2a863d,_0x4dacc3),{'verbose':_0x1275cb[_0x446d8a(0x176)]}),_0x247eb2=_0x249e6b[_0x446d8a(0x15d)];return console['error'](_0x446d8a(0x175)+_0x247eb2[_0x446d8a(0x15e)]+_0x446d8a(0x154)+_0x247eb2['id']),_0x5e6f28!==_0xa9a1db&&console[_0x446d8a(0x151)](_0x446d8a(0x167)+_0x5e6f28),await handleSDKOutput([_0x247eb2],_0x1275cb),0x0;}}function a38_0x4627(){const _0x2117f0=['Segment\x20name:\x20','site','Create\x20child\x20segment\x20with\x20filtering\x20rules','segmentPath','\x27...','kind','resolveFolderId','3451623EXfKIY','6125552THvqbl','15129LHEhbn','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','Examples:','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','error','includes','segments','\x27\x20with\x20ID:\x20','yellow','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','Resolving\x20folder\x20\x27','Parent:\x20','segment:create','3445010NIYOeL','createSegment','ruleFile','data','name','rule','Parent\x20path:\x20','folder','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','folderId','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Resolving\x20parent\x20segment\x20\x27','6SDyHnU','\x20\x20\x20Path:\x20','description','segment','16928foRhiu','execute','973399kyKZDd','resolveParentId','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Resolved\x20folder\x20ID:\x20','Target\x20path:\x20','Resolved\x20relative\x20path\x20to:\x20','parent','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','6613990pCIfXI','✔\x20Created\x20segment\x20\x27','verbose','4361931WGAIRg','length'];a38_0x4627=function(){return _0x2117f0;};return a38_0x4627();}
1
+ const a38_0x4aa604=a38_0x4b71;(function(_0x1d004a,_0x12f06f){const _0x4ca8ca=a38_0x4b71,_0x5f3495=_0x1d004a();while(!![]){try{const _0x1a346c=parseInt(_0x4ca8ca(0x184))/0x1*(parseInt(_0x4ca8ca(0x19e))/0x2)+-parseInt(_0x4ca8ca(0x19a))/0x3+-parseInt(_0x4ca8ca(0x188))/0x4+-parseInt(_0x4ca8ca(0x1b5))/0x5+-parseInt(_0x4ca8ca(0x1a7))/0x6*(parseInt(_0x4ca8ca(0x197))/0x7)+parseInt(_0x4ca8ca(0x1ac))/0x8+parseInt(_0x4ca8ca(0x195))/0x9;if(_0x1a346c===_0x12f06f)break;else _0x5f3495['push'](_0x5f3495['shift']());}catch(_0x24e53b){_0x5f3495['push'](_0x5f3495['shift']());}}}(a38_0x2ddc,0x82941));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';function a38_0x4b71(_0x2a1f4e,_0x11961e){_0x2a1f4e=_0x2a1f4e-0x181;const _0x2ddcb0=a38_0x2ddc();let _0x4b715f=_0x2ddcb0[_0x2a1f4e];return _0x4b715f;}import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';function a38_0x2ddc(){const _0x56c522=['1367448nrZAIe','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','resolveParentId','folderId','parent','segmentPath','Parent\x20path:\x20','Target\x20path:\x20','\x27\x20with\x20ID:\x20','1315305ADtrcI','Resolved\x20folder\x20ID:\x20','\x27...','ruleFile','Resolving\x20parent\x20segment\x20\x27','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','14jkTPDW','includes','segment','invisible','3387124rWMOZK','folder','Create\x20child\x20segment\x20with\x20filtering\x20rules','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Segment\x20name:\x20','segments','data','resolveFolderId','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Examples:','description','yellow','error','19380366ISlGpc','name','574924vgcpQS','type','Parent:\x20','2715270uyvMiE','segment:create','noCountPopulation','createSegment','43944VmIdtq','site','execute','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','kind','rule','✔\x20Created\x20segment\x20\x27','resolvePathToResource','length','6pBDete','Resolving\x20folder\x20path\x20\x27','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','verbose'];a38_0x2ddc=function(){return _0x56c522;};return a38_0x2ddc();}import a38_0x1712e0 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x4aa604(0x196)]=a38_0x4aa604(0x19b);[a38_0x4aa604(0x192)]=a38_0x4aa604(0x18a);async[a38_0x4aa604(0x1a0)](_0x5dca1f){const _0x29d82a=a38_0x4aa604;console['error'](a38_0x1712e0[_0x29d82a(0x193)](_0x29d82a(0x1ad))),console[_0x29d82a(0x194)](a38_0x1712e0[_0x29d82a(0x193)](_0x29d82a(0x18b)));const {options:_0x3d38e9,args:_0x41e5d2,tdx:_0x5e2a65}=_0x5dca1f,_0x5c953f=_0x3d38e9;if(_0x41e5d2['length']===0x0)return console[_0x29d82a(0x194)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console['error']('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console[_0x29d82a(0x194)](_0x29d82a(0x191)),console[_0x29d82a(0x194)](_0x29d82a(0x182)),console['error'](_0x29d82a(0x183)),console[_0x29d82a(0x194)](_0x29d82a(0x190)),0x1;const _0x216682=_0x41e5d2[0x0],_0x1dec51=_0x3d38e9[_0x29d82a(0x1b1)];let _0x4f41b3=_0x216682;_0x1dec51&&!_0x216682[_0x29d82a(0x185)]('/')&&(_0x4f41b3=_0x1dec51+'/'+_0x216682,_0x5c953f[_0x29d82a(0x1ab)]&&console[_0x29d82a(0x194)]('Resolved\x20relative\x20path\x20to:\x20'+_0x4f41b3));const _0x3feaf5=parsePath(_0x4f41b3);if(_0x3feaf5[_0x29d82a(0x18d)][_0x29d82a(0x1a6)]<0x2)return console[_0x29d82a(0x194)](_0x29d82a(0x1a1)),console[_0x29d82a(0x194)](_0x29d82a(0x1aa)),0x1;const _0x561ccb=_0x3feaf5[_0x29d82a(0x18d)][0x0],_0x39a451=getBaseName(_0x4f41b3),_0x1bd236=getParentPath(_0x4f41b3);_0x5c953f[_0x29d82a(0x1ab)]&&(console[_0x29d82a(0x194)]('Site:\x20'+_0x5c953f[_0x29d82a(0x19f)]),console[_0x29d82a(0x194)](_0x29d82a(0x1b3)+_0x4f41b3),console[_0x29d82a(0x194)](_0x29d82a(0x199)+_0x561ccb),console[_0x29d82a(0x194)](_0x29d82a(0x18c)+_0x39a451),console[_0x29d82a(0x194)](_0x29d82a(0x1b2)+_0x1bd236));const _0xceb50e=await withSpinner(_0x29d82a(0x181)+_0x561ccb+_0x29d82a(0x1b7),()=>_0x5e2a65[_0x29d82a(0x186)][_0x29d82a(0x1ae)](_0x561ccb),{'verbose':_0x5c953f[_0x29d82a(0x1ab)]}),_0x4ff944=_0xceb50e[_0x29d82a(0x18e)];let _0xae9a8d;if(_0x3feaf5[_0x29d82a(0x18d)]['length']>0x2){const _0x5f2faa=await withSpinner(_0x29d82a(0x1a8)+_0x1bd236+_0x29d82a(0x1b7),()=>_0x5e2a65['segment'][_0x29d82a(0x1a5)](_0x1bd236),{'verbose':_0x5c953f[_0x29d82a(0x1ab)]}),_0xeabba2=_0x5f2faa['data'];if(_0xeabba2[_0x29d82a(0x198)]!==_0x29d82a(0x189)&&_0xeabba2[_0x29d82a(0x198)]!==_0x29d82a(0x1b0))return console[_0x29d82a(0x194)](_0x29d82a(0x1a9)),0x1;_0xae9a8d=_0xeabba2[_0x29d82a(0x1af)];}else{if(_0x5c953f[_0x29d82a(0x189)]){const _0x5ee40b=await withSpinner('Resolving\x20folder\x20\x27'+_0x5c953f[_0x29d82a(0x189)]+'\x27...',()=>_0x5e2a65[_0x29d82a(0x186)][_0x29d82a(0x18f)](_0x4ff944,_0x5c953f[_0x29d82a(0x189)]),{'verbose':_0x5c953f['verbose']});_0xae9a8d=_0x5ee40b[_0x29d82a(0x18e)];}}_0x5c953f['verbose']&&_0xae9a8d&&console[_0x29d82a(0x194)](_0x29d82a(0x1b6)+_0xae9a8d);const _0xc028e1=await loadJSONFromOptions(_0x5c953f[_0x29d82a(0x1a3)],_0x5c953f[_0x29d82a(0x1b8)]),_0x2efdec={'name':_0x39a451,'description':_0x5c953f['description'],'rule':_0xc028e1,'kind':_0x5c953f['kind']!==undefined?parseInt(_0x5c953f[_0x29d82a(0x1a2)],0xa):undefined,'isVisible':_0x5c953f[_0x29d82a(0x187)]?![]:undefined,'segmentFolderId':_0xae9a8d,'countPopulation':_0x5c953f[_0x29d82a(0x19c)]?![]:undefined},_0x5afba5=await withSpinner('Creating\x20segment\x20\x27'+_0x39a451+_0x29d82a(0x1b7),()=>_0x5e2a65[_0x29d82a(0x186)][_0x29d82a(0x19d)](_0x4ff944,_0x2efdec),{'verbose':_0x5c953f['verbose']}),_0xea913=_0x5afba5[_0x29d82a(0x18e)];return console[_0x29d82a(0x194)](_0x29d82a(0x1a4)+_0xea913[_0x29d82a(0x196)]+_0x29d82a(0x1b4)+_0xea913['id']),_0x4f41b3!==_0x216682&&console[_0x29d82a(0x194)]('\x20\x20\x20Path:\x20'+_0x4f41b3),await handleSDKOutput([_0xea913],_0x5c953f),0x0;}}
@@ -1 +1 @@
1
- function a39_0x5454(_0x22a6c6,_0x55d739){_0x22a6c6=_0x22a6c6-0x122;const _0x411dcc=a39_0x411d();let _0x545414=_0x411dcc[_0x22a6c6];return _0x545414;}const a39_0x5c75d2=a39_0x5454;(function(_0x30bb6b,_0xe3ba82){const _0x10b6c1=a39_0x5454,_0x2c3373=_0x30bb6b();while(!![]){try{const _0x11fd5d=parseInt(_0x10b6c1(0x130))/0x1*(-parseInt(_0x10b6c1(0x128))/0x2)+parseInt(_0x10b6c1(0x136))/0x3*(parseInt(_0x10b6c1(0x124))/0x4)+-parseInt(_0x10b6c1(0x12c))/0x5+-parseInt(_0x10b6c1(0x133))/0x6+parseInt(_0x10b6c1(0x127))/0x7+parseInt(_0x10b6c1(0x122))/0x8+parseInt(_0x10b6c1(0x132))/0x9;if(_0x11fd5d===_0xe3ba82)break;else _0x2c3373['push'](_0x2c3373['shift']());}catch(_0x3f6273){_0x2c3373['push'](_0x2c3373['shift']());}}}(a39_0x411d,0x9069c));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';function a39_0x411d(){const _0x196bc1=['name','listFields','6229352TubleE','Error:\x20Parent\x20segment\x20name\x20is\x20required','4OcTZFQ','List\x20available\x20fields\x20for\x20segmentation','parentSegment','6662215haKcFx','393652Ergseb','\x20field','Site:\x20','error','3877470gPYxFW','\x27...','jsonl','site','1DVhTLJ','verbose','6576786yQpqzM','6560820VGzKLV','segment','data','588414Fcysex','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','description','length'];a39_0x411d=function(){return _0x196bc1;};return a39_0x411d();}export class SegmentFieldsCommand extends BaseCommand{[a39_0x5c75d2(0x13b)]='segment:fields';[a39_0x5c75d2(0x139)]=a39_0x5c75d2(0x125);async['execute'](_0x1ae150){const _0x4f5e27=a39_0x5c75d2,{options:_0x2d0fb7,args:_0x2879b4,tdx:_0x318af8}=_0x1ae150,_0x311443=_0x2879b4[0x0]||_0x2d0fb7[_0x4f5e27(0x126)];if(!_0x311443)return console['error'](_0x4f5e27(0x123)),console['error'](_0x4f5e27(0x138)),console['error'](_0x4f5e27(0x137)),0x1;_0x2d0fb7[_0x4f5e27(0x131)]&&(console[_0x4f5e27(0x12b)](_0x4f5e27(0x12a)+_0x2d0fb7[_0x4f5e27(0x12f)]),console[_0x4f5e27(0x12b)]('Parent\x20segment:\x20'+_0x311443));const _0x4ffc5a=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x311443+_0x4f5e27(0x12d),()=>_0x318af8[_0x4f5e27(0x134)][_0x4f5e27(0x13c)](_0x311443),{'verbose':_0x2d0fb7[_0x4f5e27(0x131)]}),_0x4aff69=_0x4ffc5a[_0x4f5e27(0x135)];console[_0x4f5e27(0x12b)]('✔\x20Found\x20'+_0x4aff69['length']+_0x4f5e27(0x129)+(_0x4aff69[_0x4f5e27(0x13a)]!==0x1?'s':''));if(_0x2d0fb7['json']||_0x2d0fb7[_0x4f5e27(0x12e)])return await handleSDKOutput(_0x4aff69,_0x2d0fb7),0x0;return displayFieldsHumanReadable(_0x4aff69,_0x311443),0x0;}}
1
+ const a39_0x349d6f=a39_0x318d;(function(_0x17d036,_0x442ba2){const _0x4215ad=a39_0x318d,_0x57bcd2=_0x17d036();while(!![]){try{const _0x2a7606=parseInt(_0x4215ad(0x1d6))/0x1+-parseInt(_0x4215ad(0x1dd))/0x2+-parseInt(_0x4215ad(0x1d5))/0x3*(-parseInt(_0x4215ad(0x1d3))/0x4)+-parseInt(_0x4215ad(0x1de))/0x5*(parseInt(_0x4215ad(0x1e3))/0x6)+parseInt(_0x4215ad(0x1d8))/0x7+-parseInt(_0x4215ad(0x1cc))/0x8+-parseInt(_0x4215ad(0x1db))/0x9*(-parseInt(_0x4215ad(0x1d9))/0xa);if(_0x2a7606===_0x442ba2)break;else _0x57bcd2['push'](_0x57bcd2['shift']());}catch(_0x14699a){_0x57bcd2['push'](_0x57bcd2['shift']());}}}(a39_0xdd9a,0x45adb));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';function a39_0xdd9a(){const _0x2083b2=['\x27...','segment:fields','✔\x20Found\x20','verbose','listFields','574712LNrapZ','jsonl','\x20field','Site:\x20','error','length','description','8768niRmoc','Parent\x20segment:\x20','228gVNbZL','510703iliauc','json','759115dZQEgp','3107710iaKPLR','Error:\x20Parent\x20segment\x20name\x20is\x20required','9YhmwtZ','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','1037890iMFohN','4940Pwthyl','Listing\x20fields\x20for\x20\x27','parentSegment','segment','site','1338RURmXc'];a39_0xdd9a=function(){return _0x2083b2;};return a39_0xdd9a();}function a39_0x318d(_0x21cc49,_0x58af63){_0x21cc49=_0x21cc49-0x1c7;const _0xdd9a20=a39_0xdd9a();let _0x318d2b=_0xdd9a20[_0x21cc49];return _0x318d2b;}export class SegmentFieldsCommand extends BaseCommand{['name']=a39_0x349d6f(0x1c8);[a39_0x349d6f(0x1d2)]='List\x20available\x20fields\x20for\x20segmentation';async['execute'](_0x29f6c5){const _0x5bfa57=a39_0x349d6f,{options:_0xa7fe7e,args:_0x10f886,tdx:_0x4c230d}=_0x29f6c5,_0x17578e=_0x10f886[0x0]||_0xa7fe7e[_0x5bfa57(0x1e0)];if(!_0x17578e)return console[_0x5bfa57(0x1d0)](_0x5bfa57(0x1da)),console[_0x5bfa57(0x1d0)](_0x5bfa57(0x1dc)),console[_0x5bfa57(0x1d0)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;_0xa7fe7e[_0x5bfa57(0x1ca)]&&(console[_0x5bfa57(0x1d0)](_0x5bfa57(0x1cf)+_0xa7fe7e[_0x5bfa57(0x1e2)]),console[_0x5bfa57(0x1d0)](_0x5bfa57(0x1d4)+_0x17578e));const _0x4ee85d=await withSpinner(_0x5bfa57(0x1df)+_0x17578e+_0x5bfa57(0x1c7),()=>_0x4c230d[_0x5bfa57(0x1e1)][_0x5bfa57(0x1cb)](_0x17578e),{'verbose':_0xa7fe7e['verbose']}),_0xe7b18=_0x4ee85d['data'];console[_0x5bfa57(0x1d0)](_0x5bfa57(0x1c9)+_0xe7b18['length']+_0x5bfa57(0x1ce)+(_0xe7b18[_0x5bfa57(0x1d1)]!==0x1?'s':''));if(_0xa7fe7e[_0x5bfa57(0x1d7)]||_0xa7fe7e[_0x5bfa57(0x1cd)])return await handleSDKOutput(_0xe7b18,_0xa7fe7e),0x0;return displayFieldsHumanReadable(_0xe7b18,_0x17578e),0x0;}}