@treasuredata/tdx 2026.4.13 → 2026.4.15

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 (221) hide show
  1. package/README.md +1 -1
  2. package/dist/bin.js +1 -1
  3. package/dist/build-info.json +3 -3
  4. package/dist/cli-categories.js +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/commands/activations.js +1 -1
  7. package/dist/commands/agent-command.js +1 -1
  8. package/dist/commands/agent-test-command.js +1 -1
  9. package/dist/commands/api-command.js +1 -1
  10. package/dist/commands/auth-command.js +1 -1
  11. package/dist/commands/cas-command.js +1 -1
  12. package/dist/commands/cas-segment-command.js +1 -1
  13. package/dist/commands/chat-command.js +1 -1
  14. package/dist/commands/claude-command.js +1 -1
  15. package/dist/commands/claude-statusline-command.js +1 -1
  16. package/dist/commands/claude-usage-command.js +1 -1
  17. package/dist/commands/command.js +1 -1
  18. package/dist/commands/connection-command.js +1 -1
  19. package/dist/commands/databases.js +1 -1
  20. package/dist/commands/delivery-command.js +1 -1
  21. package/dist/commands/describe.js +1 -1
  22. package/dist/commands/engage-campaign-pull-command.js +1 -1
  23. package/dist/commands/engage-campaign-push-command.js +1 -1
  24. package/dist/commands/engage-campaign-validate-command.js +1 -1
  25. package/dist/commands/engage-command.js +1 -1
  26. package/dist/commands/engage-template-pull-command.js +1 -1
  27. package/dist/commands/engage-template-push-command.js +1 -1
  28. package/dist/commands/engage-template-validate-command.js +1 -1
  29. package/dist/commands/job-command.js +1 -1
  30. package/dist/commands/journey-command.js +1 -1
  31. package/dist/commands/journey-validate-command.js +1 -1
  32. package/dist/commands/llm-command.js +1 -1
  33. package/dist/commands/mcp-command.js +1 -1
  34. package/dist/commands/parent-segment-command.js +1 -1
  35. package/dist/commands/policy-command.js +1 -1
  36. package/dist/commands/profile-command.js +1 -1
  37. package/dist/commands/profiles-command.js +1 -1
  38. package/dist/commands/query-command.js +1 -1
  39. package/dist/commands/schedule-command.js +1 -1
  40. package/dist/commands/segment-command.js +1 -1
  41. package/dist/commands/segment-create-command.js +1 -1
  42. package/dist/commands/segment-fields-command.js +1 -1
  43. package/dist/commands/segment-pull-command.js +1 -1
  44. package/dist/commands/segment-push-command.js +1 -1
  45. package/dist/commands/segment-update-command.js +1 -1
  46. package/dist/commands/segment-use-command.js +1 -1
  47. package/dist/commands/segment-validate-command.js +1 -1
  48. package/dist/commands/segments.js +1 -1
  49. package/dist/commands/show.js +1 -1
  50. package/dist/commands/status-command.js +1 -1
  51. package/dist/commands/tables.js +1 -1
  52. package/dist/commands/unset-command.js +1 -1
  53. package/dist/commands/upgrade-command.js +1 -1
  54. package/dist/commands/use-command.js +1 -1
  55. package/dist/commands/user-command.js +1 -1
  56. package/dist/commands/work-command.js +1 -1
  57. package/dist/commands/workflow-command.js +1 -1
  58. package/dist/core/auth.js +1 -1
  59. package/dist/core/command-output.js +1 -1
  60. package/dist/core/config.js +1 -1
  61. package/dist/core/connection-cache.js +1 -1
  62. package/dist/core/constants.js +1 -1
  63. package/dist/core/credential-cache.js +1 -1
  64. package/dist/core/global-context.js +1 -1
  65. package/dist/core/keychain.js +1 -1
  66. package/dist/core/oauth-keychain.js +1 -1
  67. package/dist/core/oauth.js +1 -1
  68. package/dist/core/profile.js +1 -1
  69. package/dist/core/project-config.js +1 -1
  70. package/dist/core/session.js +1 -1
  71. package/dist/core/user-cache.js +1 -1
  72. package/dist/core/version.js +1 -1
  73. package/dist/index.js +1 -1
  74. package/dist/mcp/server.js +1 -1
  75. package/dist/mcp/tools/index.js +1 -1
  76. package/dist/mcp/tools/tdx-run.js +1 -1
  77. package/dist/mcp/tools/tdx-search.js +1 -1
  78. package/dist/mcp/tools/work-create-item.js +1 -1
  79. package/dist/mcp/utils.js +1 -1
  80. package/dist/proxy/claude-usage-tracker.js +1 -1
  81. package/dist/proxy/passthrough-server.js +1 -1
  82. package/dist/proxy/sse-usage-parser.js +1 -1
  83. package/dist/sdk/agent/agent-config.js +1 -1
  84. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  85. package/dist/sdk/agent/agent-yaml.js +1 -1
  86. package/dist/sdk/agent/test/evaluator.js +1 -1
  87. package/dist/sdk/agent/test/executor.js +1 -1
  88. package/dist/sdk/agent/test/index.js +1 -1
  89. package/dist/sdk/agent/test/output.js +1 -1
  90. package/dist/sdk/agent/test/parser.js +1 -1
  91. package/dist/sdk/agent/tool-target-registry.js +1 -1
  92. package/dist/sdk/api.js +1 -1
  93. package/dist/sdk/cas/cas-api-client.js +1 -1
  94. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  95. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  96. package/dist/sdk/cas/index.js +1 -1
  97. package/dist/sdk/cas/pull-workflow.js +1 -1
  98. package/dist/sdk/cas/push-workflow.js +1 -1
  99. package/dist/sdk/client/cdp-api-client.js +1 -1
  100. package/dist/sdk/client/delivery-api-client.js +1 -1
  101. package/dist/sdk/client/endpoints.js +1 -1
  102. package/dist/sdk/client/engage-api-client.js +1 -1
  103. package/dist/sdk/client/http-client.js +1 -1
  104. package/dist/sdk/client/llm-api-client.js +1 -1
  105. package/dist/sdk/client/oauth-refresh.js +1 -1
  106. package/dist/sdk/client/rate-limiter.js +1 -1
  107. package/dist/sdk/client/td-api-client.js +1 -1
  108. package/dist/sdk/client/trino-api-client.js +1 -1
  109. package/dist/sdk/client/workflow-client.js +1 -1
  110. package/dist/sdk/connection-validator.js +1 -1
  111. package/dist/sdk/connection.js +1 -1
  112. package/dist/sdk/delivery.js +1 -1
  113. package/dist/sdk/engage/campaign-pull.js +1 -1
  114. package/dist/sdk/engage/campaign-push.js +1 -1
  115. package/dist/sdk/engage/campaign-validator.js +1 -1
  116. package/dist/sdk/engage/campaign-yaml.js +1 -1
  117. package/dist/sdk/engage/template-pull.js +1 -1
  118. package/dist/sdk/engage/template-push.js +1 -1
  119. package/dist/sdk/engage/template-validator.js +1 -1
  120. package/dist/sdk/engage/template-yaml.js +1 -1
  121. package/dist/sdk/engage/types/campaign-def.js +1 -1
  122. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  123. package/dist/sdk/engage/types/template-schema.js +1 -1
  124. package/dist/sdk/engage.js +1 -1
  125. package/dist/sdk/errors.js +1 -1
  126. package/dist/sdk/index.js +1 -1
  127. package/dist/sdk/io/index.js +1 -1
  128. package/dist/sdk/io/node-filesystem.js +1 -1
  129. package/dist/sdk/job.js +1 -1
  130. package/dist/sdk/journey.js +1 -1
  131. package/dist/sdk/llm/chat-cache.js +1 -1
  132. package/dist/sdk/llm/index.js +1 -1
  133. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  134. package/dist/sdk/llm/model-factors.js +1 -1
  135. package/dist/sdk/personalization.js +1 -1
  136. package/dist/sdk/policy.js +1 -1
  137. package/dist/sdk/query/index.js +1 -1
  138. package/dist/sdk/query/sql-parser.js +1 -1
  139. package/dist/sdk/realtime.js +1 -1
  140. package/dist/sdk/schedule.js +1 -1
  141. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  142. package/dist/sdk/segment/fields-display.js +1 -1
  143. package/dist/sdk/segment/file-discovery.js +1 -1
  144. package/dist/sdk/segment/journey-utils.js +1 -1
  145. package/dist/sdk/segment/journey-validator.js +1 -1
  146. package/dist/sdk/segment/journey-yaml.js +1 -1
  147. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  148. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  149. package/dist/sdk/segment/pull-workflow.js +1 -1
  150. package/dist/sdk/segment/push-recovery.js +1 -1
  151. package/dist/sdk/segment/push-workflow.js +1 -1
  152. package/dist/sdk/segment/resolution-context.js +1 -1
  153. package/dist/sdk/segment/segment-path-parser.js +1 -1
  154. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  155. package/dist/sdk/segment/segment-validator.js +1 -1
  156. package/dist/sdk/segment/target-resolution.js +1 -1
  157. package/dist/sdk/segment/tdx-config.js +1 -1
  158. package/dist/sdk/segment/types/activation-schema.js +1 -1
  159. package/dist/sdk/segment/types/journey-def.js +1 -1
  160. package/dist/sdk/segment/types/journey-schema.js +1 -1
  161. package/dist/sdk/segment/types/segment-def.js +1 -1
  162. package/dist/sdk/segment/types/segment-schema.js +1 -1
  163. package/dist/sdk/segment/validate-files.js +1 -1
  164. package/dist/sdk/segment/yaml-validator.js +1 -1
  165. package/dist/sdk/segment.js +1 -1
  166. package/dist/sdk/types/index.js +1 -1
  167. package/dist/sdk/types/progress.js +1 -1
  168. package/dist/sdk/types/workspace.js +1 -1
  169. package/dist/sdk/user.js +1 -1
  170. package/dist/sdk/util/format-detector.js +1 -1
  171. package/dist/sdk/util/formatters.js +1 -1
  172. package/dist/sdk/util/index.js +1 -1
  173. package/dist/sdk/util/paginate.js +1 -1
  174. package/dist/sdk/util/tree-formatter.js +1 -1
  175. package/dist/sdk/workflow/archive-validation.js +1 -1
  176. package/dist/sdk/workflow/clone-workflow.js +1 -1
  177. package/dist/sdk/workflow/index.js +1 -1
  178. package/dist/sdk/workflow/pull-workflow.js +1 -1
  179. package/dist/sdk/workflow/push-workflow.js +1 -1
  180. package/dist/sdk/workflow/tdx-config.js +1 -1
  181. package/dist/sdk/workflow/workflow-utils.js +1 -1
  182. package/dist/sdk/workspace/access-tracker.js +1 -1
  183. package/dist/sdk/workspace/frontmatter.js +1 -1
  184. package/dist/sdk/workspace/git.js +1 -1
  185. package/dist/sdk/workspace/index.js +1 -1
  186. package/dist/sdk/workspace/templates.js +1 -1
  187. package/dist/sdk/workspace/weekly.js +1 -1
  188. package/dist/sdk/workspace/wikilinks.js +1 -1
  189. package/dist/test-utils/command-runner.js +1 -1
  190. package/dist/test-utils/factories.js +1 -1
  191. package/dist/test-utils/fixtures.js +1 -1
  192. package/dist/test-utils/http-mock.js +1 -1
  193. package/dist/test-utils/index.js +1 -1
  194. package/dist/utils/async.js +1 -1
  195. package/dist/utils/colors.js +1 -1
  196. package/dist/utils/diff.js +1 -1
  197. package/dist/utils/file-permissions.js +1 -1
  198. package/dist/utils/file-reader.js +1 -1
  199. package/dist/utils/github-releases.js +1 -1
  200. package/dist/utils/global-cache.js +1 -1
  201. package/dist/utils/json-loader.js +1 -1
  202. package/dist/utils/local-cache.js +1 -1
  203. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  204. package/dist/utils/logger/formatters/index.js +1 -1
  205. package/dist/utils/logger/handlers/console-handler.js +1 -1
  206. package/dist/utils/logger/handlers/file-handler.js +1 -1
  207. package/dist/utils/logger/handlers/index.js +1 -1
  208. package/dist/utils/logger/handlers/null-handler.js +1 -1
  209. package/dist/utils/logger/index.js +1 -1
  210. package/dist/utils/logger/logger.js +1 -1
  211. package/dist/utils/logger/types.js +1 -1
  212. package/dist/utils/option-validation.js +1 -1
  213. package/dist/utils/process.js +1 -1
  214. package/dist/utils/prompt.js +1 -1
  215. package/dist/utils/spinner.js +1 -1
  216. package/dist/utils/sse-parser.js +1 -1
  217. package/dist/utils/string-utils.js +1 -1
  218. package/dist/utils/table-ref-parser.js +1 -1
  219. package/dist/utils/tdx-logger.js +1 -1
  220. package/dist/utils/version-check.js +1 -1
  221. package/package.json +30 -12
@@ -1 +1 @@
1
- const a32_0x413124=a32_0x2664;(function(_0xe3fdf9,_0x541117){const _0x175cd8=a32_0x2664,_0x550a1=_0xe3fdf9();while(!![]){try{const _0x18de5b=-parseInt(_0x175cd8(0xb2))/0x1+parseInt(_0x175cd8(0xb9))/0x2*(parseInt(_0x175cd8(0x94))/0x3)+-parseInt(_0x175cd8(0x9b))/0x4*(-parseInt(_0x175cd8(0xcd))/0x5)+parseInt(_0x175cd8(0x9e))/0x6*(parseInt(_0x175cd8(0xa0))/0x7)+-parseInt(_0x175cd8(0xbc))/0x8+-parseInt(_0x175cd8(0xaa))/0x9+-parseInt(_0x175cd8(0xab))/0xa*(-parseInt(_0x175cd8(0xba))/0xb);if(_0x18de5b===_0x541117)break;else _0x550a1['push'](_0x550a1['shift']());}catch(_0x33529c){_0x550a1['push'](_0x550a1['shift']());}}}(a32_0x129c,0x29f7c));function a32_0x2664(_0x1615aa,_0x3d4240){_0x1615aa=_0x1615aa-0x91;const _0x129cff=a32_0x129c();let _0x26646e=_0x129cff[_0x1615aa];return _0x26646e;}import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x36296f from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x413124(0xb0)]=a32_0x413124(0xa5);[a32_0x413124(0xb6)]='Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions';async[a32_0x413124(0xa3)](_0x4c15d6){const _0x49c449=a32_0x413124,{options:_0x53311f,tdx:_0x2e3f06}=_0x4c15d6,_0x4e1a80=await withSpinner(_0x49c449(0xc3),async()=>{const _0x20beea=_0x49c449,[_0x95c70b,_0x29e109]=await Promise[_0x20beea(0xbf)]([_0x2e3f06[_0x20beea(0xca)][_0x20beea(0xbb)](),_0x2e3f06[_0x20beea(0xa5)][_0x20beea(0xa4)]()]);return{'userInfo':_0x95c70b,'permissions':_0x29e109};},{'verbose':_0x53311f[_0x49c449(0xa1)]}),{userInfo:_0x6be649,permissions:_0x19980e}=_0x4e1a80[_0x49c449(0xc7)];if(isStructuredFormat(_0x53311f))return await handleSingleObjectOutput(_0x19980e,_0x53311f),0x0;const _0x1030f5=_0x6be649['account_owner']?_0x49c449(0xc4):_0x6be649[_0x49c449(0xbd)]?'Administrator':'Member';console['log']('\x0a'+a32_0x36296f[_0x49c449(0x91)]('👤')+'\x20'+a32_0x36296f[_0x49c449(0x91)](_0x6be649[_0x49c449(0xb0)])+'\x20'+a32_0x36296f[_0x49c449(0x9f)]('('+_0x6be649[_0x49c449(0x98)]+')')+_0x49c449(0xb8)+_0x1030f5),console[_0x49c449(0x9d)](a32_0x36296f[_0x49c449(0x9f)]('\x20\x20\x20'+_0x2e3f06[_0x49c449(0xaf)][_0x49c449(0xc0)]+':'+_0x6be649[_0x49c449(0xa8)]+_0x49c449(0xc8)+_0x6be649['id']));const _0x560a1e=_0x19980e[_0x49c449(0xb4)];console[_0x49c449(0x9d)]('\x0a'+a32_0x36296f[_0x49c449(0x91)](_0x49c449(0xcc))+'\x20('+_0x560a1e[_0x49c449(0x92)]+'):');if(_0x560a1e[_0x49c449(0x92)]===0x0)console[_0x49c449(0x9d)](a32_0x36296f['dim']('\x20\x20No\x20policies\x20assigned'));else for(const _0x2ad4fc of _0x560a1e){console[_0x49c449(0x9d)]('\x20\x20•\x20'+_0x2ad4fc[_0x49c449(0xb0)]);}return printPermissionsMap(_0x19980e['permissions']),console[_0x49c449(0x9d)](),0x0;}}export class PolicyListCommand extends BaseCommand{['name']=a32_0x413124(0xbe);[a32_0x413124(0xb6)]='List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)';async[a32_0x413124(0xa3)](_0x1091c6){const _0x4c81c2=a32_0x413124,{options:_0x41f828,tdx:_0x21ad1e}=_0x1091c6,_0x3bc488=await withSpinner('Listing\x20policies...',()=>_0x21ad1e[_0x4c81c2(0xa5)][_0x4c81c2(0xa6)](),{'verbose':_0x41f828[_0x4c81c2(0xa1)]}),_0x42f630=_0x3bc488[_0x4c81c2(0xc7)];console[_0x4c81c2(0xa7)](_0x4c81c2(0x9a)+_0x42f630[_0x4c81c2(0x92)]+_0x4c81c2(0xc5)+(_0x42f630[_0x4c81c2(0x92)]!==0x1?'ies':'y'));if(isStructuredFormat(_0x41f828))return await handleSDKOutput(_0x42f630,_0x41f828),0x0;if(_0x42f630['length']===0x0)console['log'](a32_0x36296f['dim'](_0x4c81c2(0xcb)));else for(const _0x57d0ae of _0x42f630){const _0x44e700=_0x57d0ae[_0x4c81c2(0xb6)]?a32_0x36296f[_0x4c81c2(0x9f)](_0x4c81c2(0xb8)+_0x57d0ae[_0x4c81c2(0xb6)]):'';console['log']('\x20\x20•\x20'+_0x57d0ae[_0x4c81c2(0xb0)]+_0x44e700);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x413124(0xb0)]=a32_0x413124(0x97);[a32_0x413124(0xb6)]=a32_0x413124(0xc2);['validate'](_0x57b6e2){const _0x531314=a32_0x413124;if(_0x57b6e2['args'][_0x531314(0x92)]===0x0)return'Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>';return undefined;}async[a32_0x413124(0xa3)](_0x4956f2){const _0x1b0c78=a32_0x413124,{options:_0x17add9,tdx:_0x46e812}=_0x4956f2,_0x41a051=_0x4956f2['args'][0x0],_0x1f840f=await withSpinner(_0x1b0c78(0xb5),async()=>{const _0x27b11f=_0x1b0c78,_0x4d338e=await _0x46e812[_0x27b11f(0xa5)][_0x27b11f(0xb7)](_0x41a051),[_0x48a391,_0x45b900]=await Promise[_0x27b11f(0xbf)]([_0x46e812['policy'][_0x27b11f(0xc9)](_0x4d338e['id']),_0x46e812[_0x27b11f(0xa5)][_0x27b11f(0xce)](_0x4d338e['id'])]);return{'policy':_0x4d338e,'perms':_0x48a391,'users':_0x45b900};},{'verbose':_0x17add9[_0x1b0c78(0xa1)]}),{policy:_0x23773c,perms:_0x2b1119,users:_0x5aba10}=_0x1f840f[_0x1b0c78(0xc7)];if(isStructuredFormat(_0x17add9))return await handleSingleObjectOutput({..._0x23773c,'permissions':_0x2b1119['permissions'],'users':_0x5aba10},_0x17add9),0x0;console['log']('\x0a'+a32_0x36296f[_0x1b0c78(0x91)]('📋')+'\x20'+a32_0x36296f[_0x1b0c78(0x91)](_0x23773c[_0x1b0c78(0xb0)])+'\x20'+a32_0x36296f[_0x1b0c78(0x9f)](_0x1b0c78(0xae)+_0x23773c['id']+')'));_0x23773c[_0x1b0c78(0xb6)]&&console[_0x1b0c78(0x9d)](_0x1b0c78(0xa2)+a32_0x36296f[_0x1b0c78(0x9f)](_0x23773c['description']));console['log']('\x20\x20\x20'+_0x5aba10[_0x1b0c78(0x92)]+'\x20user'+(_0x5aba10[_0x1b0c78(0x92)]!==0x1?'s':'')+_0x1b0c78(0xad)),printPermissionsMap(_0x2b1119[_0x1b0c78(0x9c)]);if(_0x5aba10[_0x1b0c78(0x92)]>0x0){console[_0x1b0c78(0x9d)]('\x0a'+a32_0x36296f[_0x1b0c78(0x91)](_0x1b0c78(0x96))+':');for(const _0x566e2b of _0x5aba10){const _0x40ee9e=_0x566e2b[_0x1b0c78(0x98)]&&_0x566e2b['email']!==_0x566e2b[_0x1b0c78(0xb0)]?a32_0x36296f['dim']('\x20<'+_0x566e2b[_0x1b0c78(0x98)]+'>'):'';console['log'](_0x1b0c78(0x99)+_0x566e2b[_0x1b0c78(0xb0)]+_0x40ee9e);}}return console[_0x1b0c78(0x9d)](),0x0;}}function printPermissionsMap(_0x45760c){const _0x263969=a32_0x413124,_0x1c8df9=Object[_0x263969(0xac)](_0x45760c);console[_0x263969(0x9d)]('\x0a'+a32_0x36296f[_0x263969(0x91)](_0x263969(0xa9))+':');if(_0x1c8df9[_0x263969(0x92)]===0x0){console[_0x263969(0x9d)](a32_0x36296f[_0x263969(0x9f)](_0x263969(0x95)));return;}const _0x3cba43=Math[_0x263969(0xb3)](..._0x1c8df9[_0x263969(0xc6)](([_0x452f7a])=>_0x452f7a['length']));for(const [_0x3b8bb4,_0x1b2398]of _0x1c8df9){const _0x27263e=formatOperations(_0x1b2398);console[_0x263969(0x9d)]('\x20\x20'+_0x3b8bb4[_0x263969(0xc1)](_0x3cba43+0x2)+_0x27263e);}}function a32_0x129c(){const _0x5a09a6=['(ID:\x20','context','name','join','11924SRxJYf','max','policies','Fetching\x20policy...','description','getPolicy','\x20—\x20','5582jKPNhp','99ihQwKQ','getCurrent','472888BoMxBd','administrator','policy\x20list','all','site','padEnd','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','Fetching\x20permissions...','Account\x20Owner','\x20polic','map','data',',\x20user_id:','getPolicyPermissions','user','No\x20policies\x20found','📋\x20Assigned\x20Policies','720QbWubV','getPolicyUsers','bold','length','operation','246Olwiwg','\x20\x20No\x20permissions','👥\x20Assigned\x20Users','policy\x20show','email','\x20\x20•\x20','✔\x20Found\x20','3948PFUZnq','permissions','log','12qraUeY','dim','495796VqGBPS','verbose','\x20\x20\x20','execute','getMyPermissions','policy','listPolicies','error','account_id','🔑\x20Effective\x20Permissions','2951145DHLaWe','64660mmcoZM','entries','\x20assigned'];a32_0x129c=function(){return _0x5a09a6;};return a32_0x129c();}function formatOperations(_0x1a69b3){const _0x345300=a32_0x413124,_0x3c644d=[...new Set(_0x1a69b3[_0x345300(0xc6)](_0x6eacd7=>_0x6eacd7[_0x345300(0x93)]))];return _0x3c644d[_0x345300(0xb1)](',\x20');}
1
+ function a32_0x1eb8(){const _0xda05ab=[',\x20user_id:','\x20user','24MFoTvR','\x20assigned','context','join','267255slzaKX','getCurrent','map','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','validate','execute','\x20\x20No\x20permissions','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','Member','\x20\x20No\x20policies\x20assigned','getMyPermissions','1199gFetzB','data','site','bold','policies','\x20\x20\x20','No\x20policies\x20found','216XflFbf','97140DqAIyq','6757020YXNiJV','Fetching\x20permissions...','(ID:\x20','account_owner','dim','✔\x20Found\x20','👥\x20Assigned\x20Users','name','getPolicyPermissions','policy','policy\x20show','listPolicies','email','verbose','176390SBjvfH','ies','getPolicyUsers','permissions','user','\x20—\x20','Administrator','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','length','description','Fetching\x20policy...','all','3466708sYoYws','\x20polic','\x20\x20•\x20','109643fpSgJc','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','args','7WbgCZA','administrator','5GXMXzu','2699697RSNwZi','account_id','log'];a32_0x1eb8=function(){return _0xda05ab;};return a32_0x1eb8();}function a32_0x4bfd(_0x4fd5ad,_0x3fa121){_0x4fd5ad=_0x4fd5ad-0x96;const _0x1eb8ad=a32_0x1eb8();let _0x4bfde8=_0x1eb8ad[_0x4fd5ad];return _0x4bfde8;}const a32_0x32b3cb=a32_0x4bfd;(function(_0x3fa904,_0x581d74){const _0x39db27=a32_0x4bfd,_0x3d153b=_0x3fa904();while(!![]){try{const _0xf6f72=-parseInt(_0x39db27(0xd4))/0x1*(-parseInt(_0x39db27(0x9f))/0x2)+-parseInt(_0x39db27(0x9a))/0x3+parseInt(_0x39db27(0xd1))/0x4*(parseInt(_0x39db27(0x99))/0x5)+parseInt(_0x39db27(0xb7))/0x6*(parseInt(_0x39db27(0x97))/0x7)+-parseInt(_0x39db27(0xb5))/0x8*(parseInt(_0x39db27(0xa3))/0x9)+parseInt(_0x39db27(0xc5))/0xa+-parseInt(_0x39db27(0xae))/0xb*(parseInt(_0x39db27(0xb6))/0xc);if(_0xf6f72===_0x581d74)break;else _0x3d153b['push'](_0x3d153b['shift']());}catch(_0x2dc927){_0x3d153b['push'](_0x3d153b['shift']());}}}(a32_0x1eb8,0xb5327));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x188f0e from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x32b3cb(0xbe)]=a32_0x32b3cb(0xc0);['description']=a32_0x32b3cb(0xaa);async[a32_0x32b3cb(0xa8)](_0x294912){const _0x43f71c=a32_0x32b3cb,{options:_0x2786cb,tdx:_0x5ea2c1}=_0x294912,_0x4ca05b=await withSpinner(_0x43f71c(0xb8),async()=>{const _0x365905=_0x43f71c,[_0x3d8387,_0xf80ccd]=await Promise[_0x365905(0xd0)]([_0x5ea2c1[_0x365905(0xc9)][_0x365905(0xa4)](),_0x5ea2c1[_0x365905(0xc0)][_0x365905(0xad)]()]);return{'userInfo':_0x3d8387,'permissions':_0xf80ccd};},{'verbose':_0x2786cb[_0x43f71c(0xc4)]}),{userInfo:_0x4fbbd2,permissions:_0x43832a}=_0x4ca05b[_0x43f71c(0xaf)];if(isStructuredFormat(_0x2786cb))return await handleSingleObjectOutput(_0x43832a,_0x2786cb),0x0;const _0x194e98=_0x4fbbd2[_0x43f71c(0xba)]?'Account\x20Owner':_0x4fbbd2[_0x43f71c(0x98)]?_0x43f71c(0xcb):_0x43f71c(0xab);console[_0x43f71c(0x9c)]('\x0a'+a32_0x188f0e[_0x43f71c(0xb1)]('👤')+'\x20'+a32_0x188f0e[_0x43f71c(0xb1)](_0x4fbbd2['name'])+'\x20'+a32_0x188f0e[_0x43f71c(0xbb)]('('+_0x4fbbd2['email']+')')+_0x43f71c(0xca)+_0x194e98),console[_0x43f71c(0x9c)](a32_0x188f0e[_0x43f71c(0xbb)](_0x43f71c(0xb3)+_0x5ea2c1[_0x43f71c(0xa1)][_0x43f71c(0xb0)]+':'+_0x4fbbd2[_0x43f71c(0x9b)]+_0x43f71c(0x9d)+_0x4fbbd2['id']));const _0x35300e=_0x43832a[_0x43f71c(0xb2)];console['log']('\x0a'+a32_0x188f0e[_0x43f71c(0xb1)]('📋\x20Assigned\x20Policies')+'\x20('+_0x35300e[_0x43f71c(0xcd)]+'):');if(_0x35300e[_0x43f71c(0xcd)]===0x0)console['log'](a32_0x188f0e[_0x43f71c(0xbb)](_0x43f71c(0xac)));else for(const _0x1c9f01 of _0x35300e){console[_0x43f71c(0x9c)](_0x43f71c(0xd3)+_0x1c9f01[_0x43f71c(0xbe)]);}return printPermissionsMap(_0x43832a['permissions']),console[_0x43f71c(0x9c)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x32b3cb(0xbe)]='policy\x20list';['description']=a32_0x32b3cb(0xd5);async['execute'](_0x2d0af2){const _0x2b5f08=a32_0x32b3cb,{options:_0x246cf4,tdx:_0x5166cb}=_0x2d0af2,_0x3cf047=await withSpinner('Listing\x20policies...',()=>_0x5166cb[_0x2b5f08(0xc0)][_0x2b5f08(0xc2)](),{'verbose':_0x246cf4[_0x2b5f08(0xc4)]}),_0x164edd=_0x3cf047['data'];console['error'](_0x2b5f08(0xbc)+_0x164edd[_0x2b5f08(0xcd)]+_0x2b5f08(0xd2)+(_0x164edd[_0x2b5f08(0xcd)]!==0x1?_0x2b5f08(0xc6):'y'));if(isStructuredFormat(_0x246cf4))return await handleSDKOutput(_0x164edd,_0x246cf4),0x0;if(_0x164edd[_0x2b5f08(0xcd)]===0x0)console[_0x2b5f08(0x9c)](a32_0x188f0e[_0x2b5f08(0xbb)](_0x2b5f08(0xb4)));else for(const _0x5ee632 of _0x164edd){const _0x3d0f44=_0x5ee632[_0x2b5f08(0xce)]?a32_0x188f0e[_0x2b5f08(0xbb)]('\x20—\x20'+_0x5ee632[_0x2b5f08(0xce)]):'';console[_0x2b5f08(0x9c)]('\x20\x20•\x20'+_0x5ee632[_0x2b5f08(0xbe)]+_0x3d0f44);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{['name']=a32_0x32b3cb(0xc1);[a32_0x32b3cb(0xce)]=a32_0x32b3cb(0xcc);[a32_0x32b3cb(0xa7)](_0x59f83c){const _0x45dcf6=a32_0x32b3cb;if(_0x59f83c[_0x45dcf6(0x96)][_0x45dcf6(0xcd)]===0x0)return _0x45dcf6(0xa6);return undefined;}async[a32_0x32b3cb(0xa8)](_0xc2294c){const _0x23d05a=a32_0x32b3cb,{options:_0x1c4a80,tdx:_0x10f006}=_0xc2294c,_0x2b722a=_0xc2294c[_0x23d05a(0x96)][0x0],_0x181602=await withSpinner(_0x23d05a(0xcf),async()=>{const _0x385ec3=_0x23d05a,_0x3f334f=await _0x10f006[_0x385ec3(0xc0)]['getPolicy'](_0x2b722a),[_0x52d929,_0x34fd87]=await Promise[_0x385ec3(0xd0)]([_0x10f006[_0x385ec3(0xc0)][_0x385ec3(0xbf)](_0x3f334f['id']),_0x10f006['policy'][_0x385ec3(0xc7)](_0x3f334f['id'])]);return{'policy':_0x3f334f,'perms':_0x52d929,'users':_0x34fd87};},{'verbose':_0x1c4a80[_0x23d05a(0xc4)]}),{policy:_0x5a6636,perms:_0x4fb0d1,users:_0x3d1275}=_0x181602['data'];if(isStructuredFormat(_0x1c4a80))return await handleSingleObjectOutput({..._0x5a6636,'permissions':_0x4fb0d1[_0x23d05a(0xc8)],'users':_0x3d1275},_0x1c4a80),0x0;console[_0x23d05a(0x9c)]('\x0a'+a32_0x188f0e['bold']('📋')+'\x20'+a32_0x188f0e['bold'](_0x5a6636['name'])+'\x20'+a32_0x188f0e['dim'](_0x23d05a(0xb9)+_0x5a6636['id']+')'));_0x5a6636[_0x23d05a(0xce)]&&console[_0x23d05a(0x9c)](_0x23d05a(0xb3)+a32_0x188f0e[_0x23d05a(0xbb)](_0x5a6636[_0x23d05a(0xce)]));console[_0x23d05a(0x9c)](_0x23d05a(0xb3)+_0x3d1275[_0x23d05a(0xcd)]+_0x23d05a(0x9e)+(_0x3d1275[_0x23d05a(0xcd)]!==0x1?'s':'')+_0x23d05a(0xa0)),printPermissionsMap(_0x4fb0d1[_0x23d05a(0xc8)]);if(_0x3d1275[_0x23d05a(0xcd)]>0x0){console[_0x23d05a(0x9c)]('\x0a'+a32_0x188f0e['bold'](_0x23d05a(0xbd))+':');for(const _0x4bb304 of _0x3d1275){const _0x5822ea=_0x4bb304['email']&&_0x4bb304[_0x23d05a(0xc3)]!==_0x4bb304[_0x23d05a(0xbe)]?a32_0x188f0e['dim']('\x20<'+_0x4bb304[_0x23d05a(0xc3)]+'>'):'';console[_0x23d05a(0x9c)](_0x23d05a(0xd3)+_0x4bb304[_0x23d05a(0xbe)]+_0x5822ea);}}return console['log'](),0x0;}}function printPermissionsMap(_0x38cb32){const _0x245127=a32_0x32b3cb,_0x972836=Object['entries'](_0x38cb32);console[_0x245127(0x9c)]('\x0a'+a32_0x188f0e['bold']('🔑\x20Effective\x20Permissions')+':');if(_0x972836['length']===0x0){console[_0x245127(0x9c)](a32_0x188f0e[_0x245127(0xbb)](_0x245127(0xa9)));return;}const _0x2fce70=Math['max'](..._0x972836[_0x245127(0xa5)](([_0x184a24])=>_0x184a24[_0x245127(0xcd)]));for(const [_0x4de9e,_0x27f28a]of _0x972836){const _0x55c43f=formatOperations(_0x27f28a);console[_0x245127(0x9c)]('\x20\x20'+_0x4de9e['padEnd'](_0x2fce70+0x2)+_0x55c43f);}}function formatOperations(_0x37f130){const _0xf4719=a32_0x32b3cb,_0x1187c2=[...new Set(_0x37f130['map'](_0x3b39b6=>_0x3b39b6['operation']))];return _0x1187c2[_0xf4719(0xa2)](',\x20');}
@@ -1 +1 @@
1
- const a33_0xf4ab4f=a33_0x1704;(function(_0x1584a7,_0x4404c9){const _0x43c210=a33_0x1704,_0x460cb3=_0x1584a7();while(!![]){try{const _0x13bb2e=-parseInt(_0x43c210(0x200))/0x1+-parseInt(_0x43c210(0x23f))/0x2+parseInt(_0x43c210(0x20a))/0x3+-parseInt(_0x43c210(0x221))/0x4+parseInt(_0x43c210(0x226))/0x5*(parseInt(_0x43c210(0x1ff))/0x6)+parseInt(_0x43c210(0x1f6))/0x7+parseInt(_0x43c210(0x229))/0x8;if(_0x13bb2e===_0x4404c9)break;else _0x460cb3['push'](_0x460cb3['shift']());}catch(_0x2e5edc){_0x460cb3['push'](_0x460cb3['shift']());}}}(a33_0x4acb,0x40320));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_0x481974 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_0x4c11d5 from'prompts';function a33_0x4acb(){const _0x273af9=['⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x27\x20does\x20not\x20exist.','Set\x20a\x20profile\x20configuration\x20value','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','VALID_KEYS','text','yellow','profile:use','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','tdx:\x20profile\x20create','profile:create','You\x20can\x20find\x20your\x20API\x20key\x20at:','profile:set','Profile\x20\x27','join','Validating\x20API\x20key...','\x27\x20deleted','\x27\x20updated:\x20','execute','length','Create\x20a\x20new\x20profile','/app/mp/ak','apiKey','Removed\x20existing\x20profile\x20\x27','trim','Operation\x20cancelled','red','(cleared)','Enter\x20profile\x20name:','skipExistsCheck','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','create','error','\x27.\x0a\x0aValid\x20keys:\x20','default','\x27\x20created','1722644IOaNcr','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','site','includes','status','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Profile\x20name\x20cannot\x20be\x20empty','Session\x20profile\x20set\x20to:\x20','287874xeRDhf','123614lsQUOH','all','\x20Profile\x20\x27','Removal\x20cancelled','tdx:\x20profile\x20set','Setup\x20cancelled','Changing\x20site\x20to\x20\x27','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','dim','tdx.json','5220aVJZsw','bold','API\x20key\x20cannot\x20be\x20empty','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','force','confirm','profile','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','\x20--default\x27\x20to\x20save\x20permanently','log','description','profile:delete','database','ERROR','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x0aOperation\x20cancelled','green','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','logLevel','profileName','\x0aSaved\x20to:\x20','(session:\x20','1951276emCErf','llm_agent','config','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','getUserInfo','30qQWzrB','\x0aAvailable\x20profiles:','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','4257152rmEJsz','Default\x20profile\x20set\x20to:\x20','session','Unknown\x20key\x20\x27','\x0aSetup\x20cancelled','email','llm_project','name','\x20\x20(no\x20profiles\x20found)','Enter\x20description\x20(optional):','tdx:\x20profile\x20delete','\x20\x20tdx\x20--profile\x20','✗\x20Validation\x20failed:\x20','\x27\x20does\x20not\x20exist.\x20Create\x20it?','message','Set\x20session\x20profile','validate','\x20\x20-\x20','Failed\x20to\x20delete\x20profile:\x20','Site\x20was\x20not\x20changed.','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','warn','386946JrulIW','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','password','\x27\x20requires\x20API\x20key\x20validation.'];a33_0x4acb=function(){return _0x273af9;};return a33_0x4acb();}import a33_0x4a73bb from'chalk';function a33_0x1704(_0x343244,_0x38505e){_0x343244=_0x343244-0x1ee;const _0x4acb90=a33_0x4acb();let _0x1704b5=_0x4acb90[_0x343244];return _0x1704b5;}function validateProfileName(_0x722abd,_0x456c45){const _0x44efaa=a33_0x1704;if(!_0x722abd||!_0x722abd[_0x44efaa(0x25b)]())return _0x44efaa(0x1fd);const _0x512b20=_0x722abd['trim']();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x512b20))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(!_0x456c45?.[_0x44efaa(0x1ef)]&&profileExists(_0x512b20))return _0x44efaa(0x250)+_0x512b20+_0x44efaa(0x207)+_0x512b20+_0x44efaa(0x224);return!![];}async function deleteProfileAndCredentials(_0x92c52d){const _0x1a4e6b=a33_0x1704;removeProfileFromUserConfig(_0x92c52d);const _0x1126e5=await isKeychainAvailable();_0x1126e5&&await Promise[_0x1a4e6b(0x201)]([deleteKeychainAPIKey(_0x92c52d),deleteOAuthTokens(_0x92c52d)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0xf4ab4f(0x230)]=a33_0xf4ab4f(0x24d);[a33_0xf4ab4f(0x215)]=a33_0xf4ab4f(0x257);async['execute'](_0x4d1a06){const _0xac12dc=a33_0xf4ab4f,{options:_0x56cc57,args:_0x2cfa87}=_0x4d1a06,_0x5b70ce=!!_0x56cc57[_0xac12dc(0x20e)];console[_0xac12dc(0x214)](a33_0x4a73bb['bold'](_0xac12dc(0x24c)));let _0x5f37ce;if(_0x2cfa87['length']>0x0&&_0x2cfa87[0x0]){const _0x3bf02a=_0x2cfa87[0x0][_0xac12dc(0x25b)]();_0x5b70ce&&profileExists(_0x3bf02a)&&(await deleteProfileAndCredentials(_0x3bf02a),console['log'](_0xac12dc(0x25a)+_0x3bf02a+'\x27'));const _0x1da2bc=validateProfileName(_0x3bf02a);if(_0x1da2bc!==!![])return console[_0xac12dc(0x1f2)](a33_0x4a73bb[_0xac12dc(0x25d)](_0x1da2bc)),0x1;_0x5f37ce=_0x3bf02a;}else{const _0x1bb023=await a33_0x4c11d5({'type':_0xac12dc(0x248),'name':_0xac12dc(0x21e),'message':_0xac12dc(0x1ee),'validate':_0x575ab=>validateProfileName(_0x575ab,{'skipExistsCheck':_0x5b70ce})});if(!_0x1bb023[_0xac12dc(0x21e)])return console[_0xac12dc(0x214)]('\x0aSetup\x20cancelled'),0x1;_0x5f37ce=_0x1bb023['profileName'][_0xac12dc(0x25b)](),_0x5b70ce&&profileExists(_0x5f37ce)&&(await deleteProfileAndCredentials(_0x5f37ce),console[_0xac12dc(0x214)]('Removed\x20existing\x20profile\x20\x27'+_0x5f37ce+'\x27'));}const _0x4d12f3=await a33_0x4c11d5({'type':_0xac12dc(0x248),'name':_0xac12dc(0x215),'message':_0xac12dc(0x232)}),_0x39ed05=_0x4d12f3['description']?.[_0xac12dc(0x25b)]()||undefined,_0x49cbc6=_0x56cc57[_0xac12dc(0x1f9)]||'us01',_0x27f284=await promptSiteSelection(_0x49cbc6,_0x5f37ce,_0xac12dc(0x205));if(!_0x27f284)return 0x1;const _0x333109=resolveSite(_0x27f284),_0x3f1585=await promptAuthMethod();if(!_0x3f1585)return console[_0xac12dc(0x214)](_0xac12dc(0x22d)),0x1;if(_0x3f1585==='oauth'){if(_0x39ed05){const _0x5056e0={'site':_0x333109,'description':_0x39ed05};saveProfileToUserConfig(_0x5f37ce,_0x5056e0);}const {accountName:_0x1e1f8f}=_0x56cc57;return await runOAuthLoginFlow(_0x333109,_0x5f37ce,_0x56cc57['logLevel']??LogLevel[_0xac12dc(0x218)],{'accountName':_0x1e1f8f}),0x0;}console[_0xac12dc(0x214)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x333109),console['log'](_0xac12dc(0x24e)),console['log']('\x20\x20'+getConsoleUrl(_0x333109,'/app/mp/ak'));const _0x52c39b=await a33_0x4c11d5({'type':_0xac12dc(0x241),'name':_0xac12dc(0x259),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x2c9031=>{const _0x2d8b21=_0xac12dc;if(!_0x2c9031||!_0x2c9031[_0x2d8b21(0x25b)]())return _0x2d8b21(0x20c);return!![];}});if(!_0x52c39b[_0xac12dc(0x259)])return console['log'](_0xac12dc(0x22d)),0x1;const _0x1336f6=_0x52c39b[_0xac12dc(0x259)];console[_0xac12dc(0x214)]('Validating\x20API\x20key...');try{const _0x510df6=TDX[_0xac12dc(0x1f1)]({'site':_0x333109,'apiKey':_0x1336f6[_0xac12dc(0x25b)](),'logLevel':_0x56cc57[_0xac12dc(0x21d)]??LogLevel['ERROR']}),_0xf7fb38=await _0x510df6['jobs'][_0xac12dc(0x225)]();console[_0xac12dc(0x214)](a33_0x4a73bb[_0xac12dc(0x21b)]('✓')+_0xac12dc(0x219)+_0xf7fb38['email']+')');const _0x29fb94=await isKeychainAvailable();_0x29fb94?(await saveAPIKeyAsync(_0x1336f6[_0xac12dc(0x25b)](),_0x333109,_0x5f37ce),console[_0xac12dc(0x214)](a33_0x4a73bb[_0xac12dc(0x21b)]('✓')+_0xac12dc(0x228)+_0x5f37ce+')')):(console[_0xac12dc(0x23e)](a33_0x4a73bb[_0xac12dc(0x249)](_0xac12dc(0x243))),console[_0xac12dc(0x23e)](a33_0x4a73bb[_0xac12dc(0x249)](_0xac12dc(0x21c))));const _0x5a6ec5={'site':_0x333109,..._0x39ed05&&{'description':_0x39ed05}};return saveProfileToUserConfig(_0x5f37ce,_0x5a6ec5),console[_0xac12dc(0x214)](a33_0x4a73bb['green']('✓')+_0xac12dc(0x202)+_0x5f37ce+_0xac12dc(0x1f5)),console[_0xac12dc(0x214)](),console[_0xac12dc(0x214)](_0xac12dc(0x23d)),console['log'](_0xac12dc(0x234)+_0x5f37ce+_0xac12dc(0x1f0)),console[_0xac12dc(0x214)](_0xac12dc(0x234)+_0x5f37ce+_0xac12dc(0x246)),0x0;}catch(_0xe7bda1){if(_0xe7bda1 instanceof HTTPClientError&&_0xe7bda1[_0xac12dc(0x1fb)]===0x191)return printAuthError(_0xe7bda1),0x1;return console[_0xac12dc(0x1f2)](a33_0x4a73bb['red'](_0xac12dc(0x235)+(_0xe7bda1 instanceof Error?_0xe7bda1[_0xac12dc(0x237)]:String(_0xe7bda1)))),console['error'](_0xac12dc(0x211)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{['name']=a33_0xf4ab4f(0x216);[a33_0xf4ab4f(0x215)]='Delete\x20a\x20profile';['validate'](_0x1d7a6f){const _0x240d4e=a33_0xf4ab4f,{args:_0x5523c4}=_0x1d7a6f;if(_0x5523c4[_0x240d4e(0x256)]===0x0)return _0x240d4e(0x24b);return undefined;}async['execute'](_0x3fc88d){const _0x323a97=a33_0xf4ab4f,{args:_0x46ef47}=_0x3fc88d,_0x302348=_0x46ef47[0x0];console[_0x323a97(0x214)](a33_0x4a73bb['bold'](_0x323a97(0x233)));if(!profileExists(_0x302348)){console[_0x323a97(0x1f2)](a33_0x4a73bb['red'](_0x323a97(0x250)+_0x302348+'\x27\x20does\x20not\x20exist.')),console['log'](_0x323a97(0x227));const _0x134981=listProfiles();if(_0x134981[_0x323a97(0x256)]===0x0)console['log'](_0x323a97(0x231));else for(const _0x193abe of _0x134981){console[_0x323a97(0x214)](_0x323a97(0x23a)+_0x193abe['name']);}return 0x1;}const _0x327a04=await a33_0x4c11d5({'type':'confirm','name':_0x323a97(0x20f),'message':_0x323a97(0x1f7)+_0x302348+'\x27?','initial':![]});if(!_0x327a04[_0x323a97(0x20f)])return console[_0x323a97(0x214)](_0x323a97(0x203)),0x0;try{await deleteProfileAndCredentials(_0x302348),console[_0x323a97(0x214)](a33_0x4a73bb[_0x323a97(0x21b)]('✓')+_0x323a97(0x202)+_0x302348+_0x323a97(0x253));}catch(_0x8909dd){return console['error'](a33_0x4a73bb[_0x323a97(0x25d)](_0x323a97(0x23b)+(_0x8909dd instanceof Error?_0x8909dd[_0x323a97(0x237)]:String(_0x8909dd)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0xf4ab4f(0x230)]=a33_0xf4ab4f(0x24f);[a33_0xf4ab4f(0x215)]=a33_0xf4ab4f(0x245);static [a33_0xf4ab4f(0x247)]=[a33_0xf4ab4f(0x1f9),a33_0xf4ab4f(0x217),'parent_segment',a33_0xf4ab4f(0x22f),a33_0xf4ab4f(0x222),'description'];['validate'](_0x460e9d){const _0x51fd91=a33_0xf4ab4f,{args:_0x40dd7d,options:_0x135c8b}=_0x460e9d,_0x15ce67=_0x135c8b[_0x51fd91(0x210)]||getActiveProfile();if(!_0x15ce67)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(_0x40dd7d[_0x51fd91(0x256)]===0x0)return _0x51fd91(0x240)+ProfileSetCommand[_0x51fd91(0x247)][_0x51fd91(0x251)](',\x20');const _0x32b46a=_0x40dd7d[0x0];if(!_0x32b46a[_0x51fd91(0x1fa)]('='))return _0x51fd91(0x20d)+ProfileSetCommand['VALID_KEYS'][_0x51fd91(0x251)](',\x20');const [_0x55cc5c]=_0x32b46a['split']('=',0x2);if(!ProfileSetCommand[_0x51fd91(0x247)][_0x51fd91(0x1fa)](_0x55cc5c))return _0x51fd91(0x22c)+_0x55cc5c+_0x51fd91(0x1f3)+ProfileSetCommand[_0x51fd91(0x247)][_0x51fd91(0x251)](',\x20');return undefined;}async[a33_0xf4ab4f(0x255)](_0x146a94){const _0x58c4c3=a33_0xf4ab4f,{args:_0x41c72a,options:_0x2f9501}=_0x146a94,_0x2b3c6e=_0x2f9501[_0x58c4c3(0x210)]||getActiveProfile(),[_0x2e2638,..._0x42314b]=_0x41c72a[0x0]['split']('='),_0x376c83=_0x42314b[_0x58c4c3(0x251)]('=');console[_0x58c4c3(0x214)](a33_0x4a73bb[_0x58c4c3(0x20b)](_0x58c4c3(0x204)));if(!profileExists(_0x2b3c6e)){const _0x508036=await a33_0x4c11d5({'type':'confirm','name':_0x58c4c3(0x1f1),'message':'Profile\x20\x27'+_0x2b3c6e+_0x58c4c3(0x236),'initial':!![]});if(!_0x508036[_0x58c4c3(0x1f1)])return console[_0x58c4c3(0x214)](_0x58c4c3(0x25c)),0x1;}const _0x4fbd09=loadProfile(_0x2b3c6e),_0x378baf=_0x4fbd09?.[_0x58c4c3(0x223)]||{};if(_0x2e2638==='site'){const _0x384c1c=resolveSite(_0x376c83);console['log'](_0x58c4c3(0x206)+_0x384c1c+_0x58c4c3(0x242)),console['log'](_0x58c4c3(0x212)),console[_0x58c4c3(0x214)]('\x20\x20'+getConsoleUrl(_0x384c1c,_0x58c4c3(0x258)));const _0x2a3474=await a33_0x4c11d5({'type':_0x58c4c3(0x241),'name':'apiKey','message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x3a2244=>{const _0x2a1916=_0x58c4c3;if(!_0x3a2244||!_0x3a2244[_0x2a1916(0x25b)]())return _0x2a1916(0x20c);return!![];}});if(!_0x2a3474[_0x58c4c3(0x259)])return console[_0x58c4c3(0x214)](_0x58c4c3(0x21a)),0x1;console[_0x58c4c3(0x214)](_0x58c4c3(0x252));try{const _0x31b2fd=TDX[_0x58c4c3(0x1f1)]({'site':_0x384c1c,'apiKey':_0x2a3474[_0x58c4c3(0x259)]['trim'](),'logLevel':_0x2f9501[_0x58c4c3(0x21d)]??LogLevel[_0x58c4c3(0x218)]}),_0x2dd397=await _0x31b2fd['jobs'][_0x58c4c3(0x225)]();console[_0x58c4c3(0x214)](a33_0x4a73bb[_0x58c4c3(0x21b)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x2dd397[_0x58c4c3(0x22e)]+')');const _0x25b7be=await isKeychainAvailable();_0x25b7be?(await saveAPIKeyAsync(_0x2a3474[_0x58c4c3(0x259)]['trim'](),_0x384c1c,_0x2b3c6e),console[_0x58c4c3(0x214)](a33_0x4a73bb[_0x58c4c3(0x21b)]('✓')+_0x58c4c3(0x1fc))):console[_0x58c4c3(0x23e)](a33_0x4a73bb['yellow'](_0x58c4c3(0x243))),_0x378baf[_0x58c4c3(0x1f9)]=_0x384c1c;}catch(_0x1ea2c2){if(_0x1ea2c2 instanceof HTTPClientError&&_0x1ea2c2['status']===0x191)return printAuthError(_0x1ea2c2),0x1;return console[_0x58c4c3(0x1f2)](a33_0x4a73bb[_0x58c4c3(0x25d)](_0x58c4c3(0x235)+(_0x1ea2c2 instanceof Error?_0x1ea2c2[_0x58c4c3(0x237)]:String(_0x1ea2c2)))),console['error'](_0x58c4c3(0x23c)),0x1;}}else _0x378baf[_0x2e2638]=_0x376c83||undefined;return saveProfileToUserConfig(_0x2b3c6e,_0x378baf),console[_0x58c4c3(0x214)](a33_0x4a73bb[_0x58c4c3(0x21b)]('✓')+_0x58c4c3(0x202)+_0x2b3c6e+_0x58c4c3(0x254)+_0x2e2638+'='+(_0x376c83||_0x58c4c3(0x25e))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0xf4ab4f(0x230)]=a33_0xf4ab4f(0x24a);[a33_0xf4ab4f(0x215)]=a33_0xf4ab4f(0x238);[a33_0xf4ab4f(0x239)](_0x46a395){const _0x139e42=a33_0xf4ab4f,{args:_0x3678be}=_0x46a395;if(_0x3678be[_0x139e42(0x256)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async['execute'](_0x17ee84){const _0x5e9bf4=a33_0xf4ab4f,{args:_0x4608f4,options:_0x4bf1f5}=_0x17ee84,_0x5f3bc0=_0x4608f4[0x0],_0x369ebb=_0x4bf1f5[_0x5e9bf4(0x1f4)];cleanExpiredSessions();if(!profileExists(_0x5f3bc0)){console[_0x5e9bf4(0x1f2)](a33_0x4a73bb[_0x5e9bf4(0x25d)](_0x5e9bf4(0x250)+_0x5f3bc0+_0x5e9bf4(0x244))),console[_0x5e9bf4(0x214)](_0x5e9bf4(0x227));const _0xc7711a=listProfiles();if(_0xc7711a[_0x5e9bf4(0x256)]===0x0)console[_0x5e9bf4(0x214)](_0x5e9bf4(0x231));else for(const _0x4e2912 of _0xc7711a){console[_0x5e9bf4(0x214)](_0x5e9bf4(0x23a)+_0x4e2912[_0x5e9bf4(0x230)]);}return 0x1;}if(_0x369ebb){const _0x3df3ef=a33_0x481974[_0x5e9bf4(0x251)](getConfigDir(),_0x5e9bf4(0x209));return saveActiveProfileToUserConfig(_0x5f3bc0),console[_0x5e9bf4(0x214)](_0x5e9bf4(0x22a)+a33_0x4a73bb[_0x5e9bf4(0x21b)](_0x5f3bc0)),console['log'](a33_0x4a73bb[_0x5e9bf4(0x208)](_0x5e9bf4(0x21f)+_0x3df3ef)),0x0;}const _0x1ee9a4=getSessionID(_0x4bf1f5['session']);return saveSessionContext({'profile':_0x5f3bc0},_0x4bf1f5[_0x5e9bf4(0x22b)]),console[_0x5e9bf4(0x214)](_0x5e9bf4(0x1fe)+a33_0x4a73bb[_0x5e9bf4(0x21b)](_0x5f3bc0)+'\x20'+a33_0x4a73bb[_0x5e9bf4(0x208)](_0x5e9bf4(0x220)+_0x1ee9a4+')')),console[_0x5e9bf4(0x214)](a33_0x4a73bb[_0x5e9bf4(0x208)](_0x5e9bf4(0x1f8)+_0x5f3bc0+_0x5e9bf4(0x213))),0x0;}}
1
+ function a33_0x347d(_0x54b87d,_0x4e94b8){_0x54b87d=_0x54b87d-0x1ba;const _0x1f6f96=a33_0x1f6f();let _0x347d95=_0x1f6f96[_0x54b87d];return _0x347d95;}const a33_0xaf0397=a33_0x347d;(function(_0x58c5eb,_0xef0972){const _0x532a91=a33_0x347d,_0xe01ef7=_0x58c5eb();while(!![]){try{const _0x3d4bbf=parseInt(_0x532a91(0x1d7))/0x1+-parseInt(_0x532a91(0x1d4))/0x2+-parseInt(_0x532a91(0x21d))/0x3*(-parseInt(_0x532a91(0x1e7))/0x4)+-parseInt(_0x532a91(0x1d9))/0x5+-parseInt(_0x532a91(0x1e4))/0x6+-parseInt(_0x532a91(0x1d2))/0x7*(-parseInt(_0x532a91(0x1ce))/0x8)+parseInt(_0x532a91(0x20a))/0x9*(-parseInt(_0x532a91(0x1d6))/0xa);if(_0x3d4bbf===_0xef0972)break;else _0xe01ef7['push'](_0xe01ef7['shift']());}catch(_0x20dd29){_0xe01ef7['push'](_0xe01ef7['shift']());}}}(a33_0x1f6f,0xdf413));function a33_0x1f6f(){const _0x3e6bc6=['profile:use','Set\x20a\x20profile\x20configuration\x20value','message','Create\x20a\x20new\x20profile','yellow','Enter\x20description\x20(optional):','\x27\x20deleted','confirm','Default\x20profile\x20set\x20to:\x20','getUserInfo','session','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','llm_agent','ERROR','test','\x0aAvailable\x20profiles:','profile','\x20\x20tdx\x20--profile\x20','all','Set\x20session\x20profile','✗\x20Validation\x20failed:\x20','/app/mp/ak','8bNxntk','\x27\x20created','split','\x20API\x20key\x20is\x20valid\x20(User:\x20','5012651XutpIj','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','1964770hjODgP','Failed\x20to\x20delete\x20profile:\x20','10zJxeuH','1540426xdTCbL','profile:delete','5959085qwNqcL','Validating\x20API\x20key...','Session\x20profile\x20set\x20to:\x20','green','default','includes','Profile\x20name\x20cannot\x20be\x20empty','name','red','Removed\x20existing\x20profile\x20\x27','\x0aSaved\x20to:\x20','1505490aNfUWY','tdx.json','API\x20key\x20cannot\x20be\x20empty','4dbwufb','force','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','bold','create','\x27.\x0a\x0aValid\x20keys:\x20','\x20Profile\x20\x27','\x0aOperation\x20cancelled','profile:set','tdx:\x20profile\x20set','log','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x20--default\x27\x20to\x20save\x20permanently','site','us01','oauth','description','tdx:\x20profile\x20delete','dim','\x20API\x20key\x20saved\x20to\x20system\x20keychain','trim','length','error','\x27\x20does\x20not\x20exist.','execute','\x27\x20updated:\x20','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','warn','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','status','logLevel','VALID_KEYS','\x27\x20requires\x20API\x20key\x20validation.','Enter\x20profile\x20name:','74583YUKSHo','\x0aSetup\x20cancelled','\x20\x20-\x20','join','(session:\x20','database','email','tdx:\x20profile\x20create','Operation\x20cancelled','profileName','apiKey','Profile\x20\x27','password','llm_project','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','jobs','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>','text','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','3274008Wikntb','validate','Enter\x20your\x20TD\x20API\x20key:','Unknown\x20key\x20\x27','Site\x20was\x20not\x20changed.'];a33_0x1f6f=function(){return _0x3e6bc6;};return a33_0x1f6f();}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_0x21128d 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_0x7bf2df from'prompts';import a33_0x1bf537 from'chalk';function validateProfileName(_0xb818fd,_0x2686e5){const _0x7f0131=a33_0x347d;if(!_0xb818fd||!_0xb818fd[_0x7f0131(0x1fb)]())return _0x7f0131(0x1df);const _0x5302c7=_0xb818fd[_0x7f0131(0x1fb)]();if(!/^[a-zA-Z0-9_-]+$/[_0x7f0131(0x1c6)](_0x5302c7))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(!_0x2686e5?.['skipExistsCheck']&&profileExists(_0x5302c7))return'Profile\x20\x27'+_0x5302c7+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20'+_0x5302c7+_0x7f0131(0x21c);return!![];}async function deleteProfileAndCredentials(_0x53ae1f){const _0x3a053a=a33_0x347d;removeProfileFromUserConfig(_0x53ae1f);const _0x527287=await isKeychainAvailable();_0x527287&&await Promise[_0x3a053a(0x1ca)]([deleteKeychainAPIKey(_0x53ae1f),deleteOAuthTokens(_0x53ae1f)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0xaf0397(0x1e0)]='profile:create';[a33_0xaf0397(0x1f7)]=a33_0xaf0397(0x1bb);async[a33_0xaf0397(0x1ff)](_0x1a133c){const _0x581619=a33_0xaf0397,{options:_0x1c6ef7,args:_0x31a213}=_0x1a133c,_0x20f75f=!!_0x1c6ef7[_0x581619(0x1e8)];console[_0x581619(0x1f1)](a33_0x1bf537[_0x581619(0x1ea)](_0x581619(0x211)));let _0x5e99b4;if(_0x31a213[_0x581619(0x1fc)]>0x0&&_0x31a213[0x0]){const _0x1cd777=_0x31a213[0x0][_0x581619(0x1fb)]();_0x20f75f&&profileExists(_0x1cd777)&&(await deleteProfileAndCredentials(_0x1cd777),console[_0x581619(0x1f1)]('Removed\x20existing\x20profile\x20\x27'+_0x1cd777+'\x27'));const _0x510dd9=validateProfileName(_0x1cd777);if(_0x510dd9!==!![])return console[_0x581619(0x1fd)](a33_0x1bf537[_0x581619(0x1e1)](_0x510dd9)),0x1;_0x5e99b4=_0x1cd777;}else{const _0x1dfd0d=await a33_0x7bf2df({'type':_0x581619(0x21b),'name':_0x581619(0x213),'message':_0x581619(0x209),'validate':_0x1ec974=>validateProfileName(_0x1ec974,{'skipExistsCheck':_0x20f75f})});if(!_0x1dfd0d[_0x581619(0x213)])return console[_0x581619(0x1f1)]('\x0aSetup\x20cancelled'),0x1;_0x5e99b4=_0x1dfd0d[_0x581619(0x213)]['trim'](),_0x20f75f&&profileExists(_0x5e99b4)&&(await deleteProfileAndCredentials(_0x5e99b4),console[_0x581619(0x1f1)](_0x581619(0x1e2)+_0x5e99b4+'\x27'));}const _0xb10178=await a33_0x7bf2df({'type':'text','name':_0x581619(0x1f7),'message':_0x581619(0x1bd)}),_0x2918f8=_0xb10178[_0x581619(0x1f7)]?.['trim']()||undefined,_0x3855e7=_0x1c6ef7['site']||_0x581619(0x1f5),_0x69ef24=await promptSiteSelection(_0x3855e7,_0x5e99b4,'Setup\x20cancelled');if(!_0x69ef24)return 0x1;const _0x26b76d=resolveSite(_0x69ef24),_0x2b6094=await promptAuthMethod();if(!_0x2b6094)return console['log'](_0x581619(0x20b)),0x1;if(_0x2b6094===_0x581619(0x1f6)){if(_0x2918f8){const _0x2403ce={'site':_0x26b76d,'description':_0x2918f8};saveProfileToUserConfig(_0x5e99b4,_0x2403ce);}const {accountName:_0x3730b1}=_0x1c6ef7;return await runOAuthLoginFlow(_0x26b76d,_0x5e99b4,_0x1c6ef7[_0x581619(0x206)]??LogLevel['ERROR'],{'accountName':_0x3730b1}),0x0;}console[_0x581619(0x1f1)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x26b76d),console['log']('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x581619(0x1f1)]('\x20\x20'+getConsoleUrl(_0x26b76d,_0x581619(0x1cd)));const _0xd3c1d1=await a33_0x7bf2df({'type':_0x581619(0x216),'name':_0x581619(0x214),'message':_0x581619(0x21f),'validate':_0x7dc241=>{const _0x1735ec=_0x581619;if(!_0x7dc241||!_0x7dc241['trim']())return _0x1735ec(0x1e6);return!![];}});if(!_0xd3c1d1['apiKey'])return console[_0x581619(0x1f1)]('\x0aSetup\x20cancelled'),0x1;const _0x2b1f20=_0xd3c1d1[_0x581619(0x214)];console[_0x581619(0x1f1)]('Validating\x20API\x20key...');try{const _0x5e5ca6=TDX[_0x581619(0x1eb)]({'site':_0x26b76d,'apiKey':_0x2b1f20[_0x581619(0x1fb)](),'logLevel':_0x1c6ef7['logLevel']??LogLevel[_0x581619(0x1c5)]}),_0x1113a4=await _0x5e5ca6[_0x581619(0x219)][_0x581619(0x1c1)]();console['log'](a33_0x1bf537[_0x581619(0x1dc)]('✓')+_0x581619(0x1d1)+_0x1113a4['email']+')');const _0x2a426f=await isKeychainAvailable();_0x2a426f?(await saveAPIKeyAsync(_0x2b1f20['trim'](),_0x26b76d,_0x5e99b4),console[_0x581619(0x1f1)](a33_0x1bf537[_0x581619(0x1dc)]('✓')+_0x581619(0x1d3)+_0x5e99b4+')')):(console['warn'](a33_0x1bf537[_0x581619(0x1bc)](_0x581619(0x204))),console['warn'](a33_0x1bf537[_0x581619(0x1bc)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x195080={'site':_0x26b76d,..._0x2918f8&&{'description':_0x2918f8}};return saveProfileToUserConfig(_0x5e99b4,_0x195080),console['log'](a33_0x1bf537[_0x581619(0x1dc)]('✓')+'\x20Profile\x20\x27'+_0x5e99b4+_0x581619(0x1cf)),console[_0x581619(0x1f1)](),console[_0x581619(0x1f1)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x581619(0x1f1)](_0x581619(0x1c9)+_0x5e99b4+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x581619(0x1f1)](_0x581619(0x1c9)+_0x5e99b4+_0x581619(0x201)),0x0;}catch(_0x48f9f8){if(_0x48f9f8 instanceof HTTPClientError&&_0x48f9f8[_0x581619(0x205)]===0x191)return printAuthError(_0x48f9f8),0x1;return console['error'](a33_0x1bf537[_0x581619(0x1e1)](_0x581619(0x1cc)+(_0x48f9f8 instanceof Error?_0x48f9f8[_0x581619(0x1ba)]:String(_0x48f9f8)))),console[_0x581619(0x1fd)](_0x581619(0x202)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0xaf0397(0x1e0)]=a33_0xaf0397(0x1d8);[a33_0xaf0397(0x1f7)]='Delete\x20a\x20profile';[a33_0xaf0397(0x21e)](_0x508a7d){const _0x2c0ca3=a33_0xaf0397,{args:_0x1a326c}=_0x508a7d;if(_0x1a326c[_0x2c0ca3(0x1fc)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>';return undefined;}async[a33_0xaf0397(0x1ff)](_0x30987d){const _0x5cae4f=a33_0xaf0397,{args:_0x5412ec}=_0x30987d,_0x30c4b3=_0x5412ec[0x0];console[_0x5cae4f(0x1f1)](a33_0x1bf537['bold'](_0x5cae4f(0x1f8)));if(!profileExists(_0x30c4b3)){console[_0x5cae4f(0x1fd)](a33_0x1bf537[_0x5cae4f(0x1e1)](_0x5cae4f(0x215)+_0x30c4b3+_0x5cae4f(0x1fe))),console[_0x5cae4f(0x1f1)](_0x5cae4f(0x1c7));const _0x4f884e=listProfiles();if(_0x4f884e[_0x5cae4f(0x1fc)]===0x0)console[_0x5cae4f(0x1f1)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x2ca8ee of _0x4f884e){console['log'](_0x5cae4f(0x20c)+_0x2ca8ee[_0x5cae4f(0x1e0)]);}return 0x1;}const _0x2048e2=await a33_0x7bf2df({'type':_0x5cae4f(0x1bf),'name':_0x5cae4f(0x1bf),'message':_0x5cae4f(0x1e9)+_0x30c4b3+'\x27?','initial':![]});if(!_0x2048e2[_0x5cae4f(0x1bf)])return console[_0x5cae4f(0x1f1)]('Removal\x20cancelled'),0x0;try{await deleteProfileAndCredentials(_0x30c4b3),console[_0x5cae4f(0x1f1)](a33_0x1bf537[_0x5cae4f(0x1dc)]('✓')+_0x5cae4f(0x1ed)+_0x30c4b3+_0x5cae4f(0x1be));}catch(_0x1aa962){return console[_0x5cae4f(0x1fd)](a33_0x1bf537[_0x5cae4f(0x1e1)](_0x5cae4f(0x1d5)+(_0x1aa962 instanceof Error?_0x1aa962['message']:String(_0x1aa962)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0xaf0397(0x1e0)]=a33_0xaf0397(0x1ef);['description']=a33_0xaf0397(0x223);static [a33_0xaf0397(0x207)]=['site',a33_0xaf0397(0x20f),'parent_segment',a33_0xaf0397(0x217),a33_0xaf0397(0x1c4),a33_0xaf0397(0x1f7)];[a33_0xaf0397(0x21e)](_0x1cc1e1){const _0x6735b=a33_0xaf0397,{args:_0x396ca5,options:_0x30bb36}=_0x1cc1e1,_0x1dd9c9=_0x30bb36[_0x6735b(0x1c8)]||getActiveProfile();if(!_0x1dd9c9)return _0x6735b(0x21a);if(_0x396ca5[_0x6735b(0x1fc)]===0x0)return _0x6735b(0x218)+ProfileSetCommand[_0x6735b(0x207)][_0x6735b(0x20d)](',\x20');const _0x2d7d6d=_0x396ca5[0x0];if(!_0x2d7d6d[_0x6735b(0x1de)]('='))return _0x6735b(0x1f2)+ProfileSetCommand[_0x6735b(0x207)][_0x6735b(0x20d)](',\x20');const [_0x13c9a6]=_0x2d7d6d[_0x6735b(0x1d0)]('=',0x2);if(!ProfileSetCommand[_0x6735b(0x207)]['includes'](_0x13c9a6))return _0x6735b(0x220)+_0x13c9a6+_0x6735b(0x1ec)+ProfileSetCommand[_0x6735b(0x207)][_0x6735b(0x20d)](',\x20');return undefined;}async[a33_0xaf0397(0x1ff)](_0x50fae9){const _0x10b0c1=a33_0xaf0397,{args:_0x526443,options:_0x365d41}=_0x50fae9,_0x1f309d=_0x365d41[_0x10b0c1(0x1c8)]||getActiveProfile(),[_0x168e60,..._0x127bb3]=_0x526443[0x0][_0x10b0c1(0x1d0)]('='),_0xb89c3b=_0x127bb3[_0x10b0c1(0x20d)]('=');console['log'](a33_0x1bf537[_0x10b0c1(0x1ea)](_0x10b0c1(0x1f0)));if(!profileExists(_0x1f309d)){const _0x514079=await a33_0x7bf2df({'type':_0x10b0c1(0x1bf),'name':'create','message':_0x10b0c1(0x215)+_0x1f309d+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x514079[_0x10b0c1(0x1eb)])return console[_0x10b0c1(0x1f1)](_0x10b0c1(0x212)),0x1;}const _0x48ec12=loadProfile(_0x1f309d),_0x24cd4f=_0x48ec12?.['config']||{};if(_0x168e60===_0x10b0c1(0x1f4)){const _0x1121c0=resolveSite(_0xb89c3b);console[_0x10b0c1(0x1f1)]('Changing\x20site\x20to\x20\x27'+_0x1121c0+_0x10b0c1(0x208)),console['log']('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x10b0c1(0x1f1)]('\x20\x20'+getConsoleUrl(_0x1121c0,_0x10b0c1(0x1cd)));const _0x349d69=await a33_0x7bf2df({'type':_0x10b0c1(0x216),'name':_0x10b0c1(0x214),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x5d3916=>{const _0x4a6f56=_0x10b0c1;if(!_0x5d3916||!_0x5d3916[_0x4a6f56(0x1fb)]())return _0x4a6f56(0x1e6);return!![];}});if(!_0x349d69[_0x10b0c1(0x214)])return console[_0x10b0c1(0x1f1)](_0x10b0c1(0x1ee)),0x1;console[_0x10b0c1(0x1f1)](_0x10b0c1(0x1da));try{const _0xdcd2bb=TDX[_0x10b0c1(0x1eb)]({'site':_0x1121c0,'apiKey':_0x349d69[_0x10b0c1(0x214)]['trim'](),'logLevel':_0x365d41['logLevel']??LogLevel[_0x10b0c1(0x1c5)]}),_0x5624b2=await _0xdcd2bb[_0x10b0c1(0x219)]['getUserInfo']();console[_0x10b0c1(0x1f1)](a33_0x1bf537['green']('✓')+_0x10b0c1(0x1d1)+_0x5624b2[_0x10b0c1(0x210)]+')');const _0x4a8628=await isKeychainAvailable();_0x4a8628?(await saveAPIKeyAsync(_0x349d69[_0x10b0c1(0x214)][_0x10b0c1(0x1fb)](),_0x1121c0,_0x1f309d),console['log'](a33_0x1bf537[_0x10b0c1(0x1dc)]('✓')+_0x10b0c1(0x1fa))):console[_0x10b0c1(0x203)](a33_0x1bf537[_0x10b0c1(0x1bc)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x24cd4f[_0x10b0c1(0x1f4)]=_0x1121c0;}catch(_0x42be44){if(_0x42be44 instanceof HTTPClientError&&_0x42be44['status']===0x191)return printAuthError(_0x42be44),0x1;return console[_0x10b0c1(0x1fd)](a33_0x1bf537[_0x10b0c1(0x1e1)](_0x10b0c1(0x1cc)+(_0x42be44 instanceof Error?_0x42be44[_0x10b0c1(0x1ba)]:String(_0x42be44)))),console['error'](_0x10b0c1(0x221)),0x1;}}else _0x24cd4f[_0x168e60]=_0xb89c3b||undefined;return saveProfileToUserConfig(_0x1f309d,_0x24cd4f),console[_0x10b0c1(0x1f1)](a33_0x1bf537[_0x10b0c1(0x1dc)]('✓')+_0x10b0c1(0x1ed)+_0x1f309d+_0x10b0c1(0x200)+_0x168e60+'='+(_0xb89c3b||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a33_0xaf0397(0x222);['description']=a33_0xaf0397(0x1cb);[a33_0xaf0397(0x21e)](_0xd0543f){const _0x220987=a33_0xaf0397,{args:_0x536f30}=_0xd0543f;if(_0x536f30[_0x220987(0x1fc)]===0x0)return _0x220987(0x1c3);return undefined;}async[a33_0xaf0397(0x1ff)](_0x467864){const _0x1c8102=a33_0xaf0397,{args:_0x36fd92,options:_0x2bdd28}=_0x467864,_0x41d604=_0x36fd92[0x0],_0x3e1233=_0x2bdd28[_0x1c8102(0x1dd)];cleanExpiredSessions();if(!profileExists(_0x41d604)){console[_0x1c8102(0x1fd)](a33_0x1bf537[_0x1c8102(0x1e1)]('Profile\x20\x27'+_0x41d604+'\x27\x20does\x20not\x20exist.')),console['log'](_0x1c8102(0x1c7));const _0x2f3889=listProfiles();if(_0x2f3889[_0x1c8102(0x1fc)]===0x0)console[_0x1c8102(0x1f1)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x1a8660 of _0x2f3889){console[_0x1c8102(0x1f1)]('\x20\x20-\x20'+_0x1a8660[_0x1c8102(0x1e0)]);}return 0x1;}if(_0x3e1233){const _0x4a2904=a33_0x21128d['join'](getConfigDir(),_0x1c8102(0x1e5));return saveActiveProfileToUserConfig(_0x41d604),console[_0x1c8102(0x1f1)](_0x1c8102(0x1c0)+a33_0x1bf537[_0x1c8102(0x1dc)](_0x41d604)),console['log'](a33_0x1bf537['dim'](_0x1c8102(0x1e3)+_0x4a2904)),0x0;}const _0x2b0a11=getSessionID(_0x2bdd28['session']);return saveSessionContext({'profile':_0x41d604},_0x2bdd28[_0x1c8102(0x1c2)]),console[_0x1c8102(0x1f1)](_0x1c8102(0x1db)+a33_0x1bf537[_0x1c8102(0x1dc)](_0x41d604)+'\x20'+a33_0x1bf537[_0x1c8102(0x1f9)](_0x1c8102(0x20e)+_0x2b0a11+')')),console[_0x1c8102(0x1f1)](a33_0x1bf537['dim']('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x41d604+_0x1c8102(0x1f3))),0x0;}}
@@ -1 +1 @@
1
- const a34_0x449b7e=a34_0x1efa;function a34_0x8896(){const _0x4655aa=['dim','green','message','config','192861ttACKv','profiles','description','78794jWCDrV','error','34758074DhEsQA','12WazuLl','4062160wuFeEK','22qrPuHE','map','18zmNNPR','Error:\x20','508755zpMRCV','length','execute','1906478SfmYkg','6CVHFmh','log','44dCjHRc','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','scope','👤\x20','120lFBIFO','name','2716216ftqVOb','\x20\x20Global:\x20~/.config/tdx/tdx.json'];a34_0x8896=function(){return _0x4655aa;};return a34_0x8896();}function a34_0x1efa(_0x37d965,_0x253254){_0x37d965=_0x37d965-0x10c;const _0x88965c=a34_0x8896();let _0x1efac2=_0x88965c[_0x37d965];return _0x1efac2;}(function(_0x3dfb00,_0x2e0637){const _0x300a71=a34_0x1efa,_0x4c9c8b=_0x3dfb00();while(!![]){try{const _0x14d6fc=-parseInt(_0x300a71(0x111))/0x1*(-parseInt(_0x300a71(0x10c))/0x2)+parseInt(_0x300a71(0x119))/0x3*(parseInt(_0x300a71(0x121))/0x4)+-parseInt(_0x300a71(0x115))/0x5*(-parseInt(_0x300a71(0x113))/0x6)+-parseInt(_0x300a71(0x118))/0x7+-parseInt(_0x300a71(0x11f))/0x8*(parseInt(_0x300a71(0x127))/0x9)+-parseInt(_0x300a71(0x110))/0xa*(-parseInt(_0x300a71(0x11b))/0xb)+parseInt(_0x300a71(0x10f))/0xc*(-parseInt(_0x300a71(0x10e))/0xd);if(_0x14d6fc===_0x2e0637)break;else _0x4c9c8b['push'](_0x4c9c8b['shift']());}catch(_0x550c50){_0x4c9c8b['push'](_0x4c9c8b['shift']());}}}(a34_0x8896,0xd8ab0));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x40c9ed from'chalk';export class ProfilesCommand extends BaseCommand{['name']=a34_0x449b7e(0x128);[a34_0x449b7e(0x129)]='List\x20all\x20available\x20profiles';async[a34_0x449b7e(0x117)](_0x4b7535){const _0x29d1ab=a34_0x449b7e,{options:_0xf00001}=_0x4b7535;try{const _0x2c72b2=listProfiles(),_0x362c7e=getActiveProfile();if(_0x2c72b2[_0x29d1ab(0x116)]===0x0)return console[_0x29d1ab(0x11a)](_0x29d1ab(0x11c)),console[_0x29d1ab(0x11a)]('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console[_0x29d1ab(0x11a)](_0x29d1ab(0x122)),0x0;const _0x33800c=_0x2c72b2[_0x29d1ab(0x112)](_0x5d0a0b=>{const _0x4e0242=_0x29d1ab,_0x3250be=_0x5d0a0b['name']===_0x362c7e,_0x2dc3ff=getProfileParams(_0x5d0a0b[_0x4e0242(0x126)]);return{'name':_0x5d0a0b[_0x4e0242(0x120)],'active':_0x3250be,'scope':_0x5d0a0b[_0x4e0242(0x11d)],'description':_0x5d0a0b[_0x4e0242(0x126)]['description']||'','params':_0x2dc3ff};});if(isStructuredFormat(_0xf00001))await handleSDKOutput(_0x33800c,_0xf00001);else for(const _0x3d1fb0 of _0x2c72b2){const _0x3343a4=_0x3d1fb0[_0x29d1ab(0x120)]===_0x362c7e?a34_0x40c9ed[_0x29d1ab(0x124)]('\x20✓'):'',_0x46229c=_0x3d1fb0[_0x29d1ab(0x126)]['site']?a34_0x40c9ed[_0x29d1ab(0x123)]('\x20'+_0x3d1fb0[_0x29d1ab(0x126)]['site']):'',_0x3a5493=_0x3d1fb0[_0x29d1ab(0x126)][_0x29d1ab(0x129)]?a34_0x40c9ed[_0x29d1ab(0x123)]('\x20\x20'+_0x3d1fb0['config'][_0x29d1ab(0x129)]):'';console[_0x29d1ab(0x11a)](_0x29d1ab(0x11e)+_0x3d1fb0[_0x29d1ab(0x120)]+_0x3343a4+_0x46229c+_0x3a5493);}return 0x0;}catch(_0x38718e){return _0x38718e instanceof Error&&console[_0x29d1ab(0x10d)](_0x29d1ab(0x114)+_0x38718e[_0x29d1ab(0x125)]),0x1;}}}
1
+ function a34_0xe1eb(){const _0x1270d5=['1348968RJiDAt','description','profiles','👤\x20','18335061lVNGEQ','70542AFtsuV','2823632yXwymO','4814dMNBGm','green','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','execute','log','7IeKVBi','scope','error','site','name','length','dim','430843OYOpIT','config','417SmDgMm','message','3681915AXnSwJ'];a34_0xe1eb=function(){return _0x1270d5;};return a34_0xe1eb();}const a34_0x2c7e34=a34_0x5b24;(function(_0x56d0c6,_0x531e6f){const _0x61e898=a34_0x5b24,_0x3815eb=_0x56d0c6();while(!![]){try{const _0x5341c2=parseInt(_0x61e898(0x9e))/0x1+-parseInt(_0x61e898(0x92))/0x2*(parseInt(_0x61e898(0xa0))/0x3)+-parseInt(_0x61e898(0x91))/0x4+-parseInt(_0x61e898(0xa2))/0x5+-parseInt(_0x61e898(0x90))/0x6+-parseInt(_0x61e898(0x97))/0x7*(parseInt(_0x61e898(0xa3))/0x8)+parseInt(_0x61e898(0x8f))/0x9;if(_0x5341c2===_0x531e6f)break;else _0x3815eb['push'](_0x3815eb['shift']());}catch(_0x3cdada){_0x3815eb['push'](_0x3815eb['shift']());}}}(a34_0xe1eb,0x7cb6e));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a34_0x5b24(_0x88696c,_0x4b69c4){_0x88696c=_0x88696c-0x8c;const _0xe1eb83=a34_0xe1eb();let _0x5b24c9=_0xe1eb83[_0x88696c];return _0x5b24c9;}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x1b2ac2 from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x2c7e34(0x9b)]=a34_0x2c7e34(0x8d);[a34_0x2c7e34(0x8c)]='List\x20all\x20available\x20profiles';async[a34_0x2c7e34(0x95)](_0xb859ad){const _0x30cd83=a34_0x2c7e34,{options:_0x30c898}=_0xb859ad;try{const _0x53dfc0=listProfiles(),_0x3535d1=getActiveProfile();if(_0x53dfc0[_0x30cd83(0x9c)]===0x0)return console[_0x30cd83(0x96)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console['log'](_0x30cd83(0x94)),console[_0x30cd83(0x96)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x11e51c=_0x53dfc0['map'](_0x1ec1e3=>{const _0x30874b=_0x30cd83,_0x56e680=_0x1ec1e3[_0x30874b(0x9b)]===_0x3535d1,_0x4d3714=getProfileParams(_0x1ec1e3['config']);return{'name':_0x1ec1e3[_0x30874b(0x9b)],'active':_0x56e680,'scope':_0x1ec1e3[_0x30874b(0x98)],'description':_0x1ec1e3['config'][_0x30874b(0x8c)]||'','params':_0x4d3714};});if(isStructuredFormat(_0x30c898))await handleSDKOutput(_0x11e51c,_0x30c898);else for(const _0x59e45c of _0x53dfc0){const _0xfe5f51=_0x59e45c['name']===_0x3535d1?a34_0x1b2ac2[_0x30cd83(0x93)]('\x20✓'):'',_0x1d63e1=_0x59e45c[_0x30cd83(0x9f)]['site']?a34_0x1b2ac2[_0x30cd83(0x9d)]('\x20'+_0x59e45c['config'][_0x30cd83(0x9a)]):'',_0x2d4547=_0x59e45c[_0x30cd83(0x9f)][_0x30cd83(0x8c)]?a34_0x1b2ac2[_0x30cd83(0x9d)]('\x20\x20'+_0x59e45c[_0x30cd83(0x9f)][_0x30cd83(0x8c)]):'';console[_0x30cd83(0x96)](_0x30cd83(0x8e)+_0x59e45c[_0x30cd83(0x9b)]+_0xfe5f51+_0x1d63e1+_0x2d4547);}return 0x0;}catch(_0x7a8961){return _0x7a8961 instanceof Error&&console[_0x30cd83(0x99)]('Error:\x20'+_0x7a8961[_0x30cd83(0xa1)]),0x1;}}}
@@ -1 +1 @@
1
- function a35_0x3e34(){const _0x2b897b=['1086699jqPQsx','...','setExtra','setJobId','\x20-\x20','Error:\x20','Site:\x20','8AzaRJl','setPhase','length','\x20[Job\x20ID:\x20','2OlllwE','3096012ppSzhl','output','Executing\x20statement\x20','Run\x20Trino\x20queries\x20(streaming)','\x20splits','497iLEvAv','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','query','execute','\x0aAll\x20results\x20saved\x20to\x20','args','catalog','options','totalSplits','push','No\x20SQL\x20provided','jobId','838908sAOGkg','error','name','Schema:\x20','completedSplits','117858OGtxYv','Catalog:\x20','SQL:\x20','file','Query\x20completed:\x20Processed\x20','4634559BfHXgM','5562720bEqTAC','description','verbose','information_schema','\x20rows\x20','stats','Statement\x20','41232580NVDgVl','validate','Executing\x20query...','database','site','join'];a35_0x3e34=function(){return _0x2b897b;};return a35_0x3e34();}const a35_0x20a463=a35_0x4996;(function(_0x196dba,_0x5a1d59){const _0x37ebf4=a35_0x4996,_0x609d0e=_0x196dba();while(!![]){try{const _0x3db929=parseInt(_0x37ebf4(0xf1))/0x1+parseInt(_0x37ebf4(0xc7))/0x2*(parseInt(_0x37ebf4(0xc8))/0x3)+-parseInt(_0x37ebf4(0xd9))/0x4+parseInt(_0x37ebf4(0xe4))/0x5+parseInt(_0x37ebf4(0xde))/0x6*(parseInt(_0x37ebf4(0xcd))/0x7)+-parseInt(_0x37ebf4(0xf8))/0x8*(-parseInt(_0x37ebf4(0xe3))/0x9)+-parseInt(_0x37ebf4(0xeb))/0xa;if(_0x3db929===_0x5a1d59)break;else _0x609d0e['push'](_0x609d0e['shift']());}catch(_0x23848c){_0x609d0e['push'](_0x609d0e['shift']());}}}(a35_0x3e34,0xc53ba));import{BaseCommand}from'./command.js';function a35_0x4996(_0x362231,_0x447663){_0x362231=_0x362231-0xc4;const _0x3e346f=a35_0x3e34();let _0x499614=_0x3e346f[_0x362231];return _0x499614;}import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a35_0x20a463(0xdb)]=a35_0x20a463(0xcf);[a35_0x20a463(0xe5)]=a35_0x20a463(0xcb);async['execute'](_0x2de108){const _0x1d12fa=a35_0x20a463,{options:_0x284f0a,args:_0x1989d2,tdx:_0x4506c4}=_0x2de108,_0x1c95e1={..._0x284f0a,'limitStructuredFormats':!![]},_0x5505b4=_0x1989d2[0x0],_0x2ed977=_0x284f0a['file'];let _0x14daea;try{if(_0x2ed977)_0x14daea=readSqlStatementsFromFile(_0x2ed977);else{if(_0x5505b4==='-')_0x14daea=await readSqlStatementsFromStdin();else{if(_0x5505b4&&isSqlFilePath(_0x5505b4))_0x14daea=readSqlStatementsFromFile(_0x5505b4);else{if(_0x5505b4)_0x14daea=splitSqlStatements(_0x5505b4);else throw new Error(_0x1d12fa(0xd7));}}}}catch(_0x3abc1f){return console['error'](_0x1d12fa(0xf6)+_0x3abc1f['message']),0x1;}const _0xbdb38c=_0x284f0a[_0x1d12fa(0xee)]||_0x1d12fa(0xe7),_0x5f54e9=_0x284f0a[_0x1d12fa(0xd3)];try{const _0x474994=[],_0x95256f=!!_0x284f0a[_0x1d12fa(0xc9)];for(let _0x243d4e=0x0;_0x243d4e<_0x14daea[_0x1d12fa(0xc5)];_0x243d4e++){const _0x49021f=_0x14daea[_0x243d4e],_0x4a22a5=_0x243d4e+0x1,_0x524dae=_0x14daea['length'],_0x52d301=_0x524dae>0x1;_0x284f0a[_0x1d12fa(0xe6)]&&(console[_0x1d12fa(0xda)]('\x0a'+(_0x52d301?_0x1d12fa(0xea)+_0x4a22a5+'/'+_0x524dae+':':'')),console[_0x1d12fa(0xda)](_0x1d12fa(0xf7)+_0x284f0a[_0x1d12fa(0xef)]),console[_0x1d12fa(0xda)](_0x1d12fa(0xdf)+(_0x5f54e9||'td')),console['error'](_0x1d12fa(0xdc)+_0xbdb38c),console[_0x1d12fa(0xda)](_0x1d12fa(0xe0)+_0x49021f));const _0x298213=_0x52d301?_0x1d12fa(0xca)+_0x4a22a5+'/'+_0x524dae+_0x1d12fa(0xf2):_0x1d12fa(0xed);try{const _0x1503dd=await withProgressSpinner(_0x298213,async _0x4375a2=>{const _0x5d731c=_0x1d12fa,_0x43dc55=await _0x4506c4[_0x5d731c(0xcf)][_0x5d731c(0xd0)](_0x49021f,{'catalog':_0x5f54e9,'schema':_0xbdb38c,'onJobId':_0x38a74e=>{const _0x323d06=_0x5d731c;_0x4375a2[_0x323d06(0xf4)](_0x38a74e);},'onProgress':_0x342b95=>{const _0x50819d=_0x5d731c;_0x4375a2[_0x50819d(0xc4)]('Executing\x20query\x20['+_0x342b95['state']+']'),_0x4375a2[_0x50819d(0xf3)](formatRows(_0x342b95['processedRows'])+_0x50819d(0xe8)+_0x342b95[_0x50819d(0xdd)]+'/'+_0x342b95[_0x50819d(0xd5)]+_0x50819d(0xcc));}});return _0x43dc55;},{'verbose':_0x284f0a[_0x1d12fa(0xe6)]}),_0x2b19dc=_0x1503dd['data'],_0xed3656=_0x2b19dc[_0x1d12fa(0xd8)]?_0x1d12fa(0xc6)+_0x2b19dc[_0x1d12fa(0xd8)]+']':'',_0x22d0d9=_0x52d301?_0x1d12fa(0xea)+_0x4a22a5+'/'+_0x524dae+_0x1d12fa(0xf5):'';console[_0x1d12fa(0xda)]('✔\x20'+_0x22d0d9+_0x1d12fa(0xe2)+formatRows(_0x2b19dc[_0x1d12fa(0xe9)]['processedRows'])+'\x20rows\x20'+('in\x20'+formatElapsed(_0x2b19dc[_0x1d12fa(0xe9)]['elapsedTimeMillis'])+_0xed3656));if(_0x52d301&&_0x95256f){const _0x18a01b=resolveOutputOptions(_0x1c95e1),_0x4741a6=await formatQueryOutput(_0x2b19dc,_0x18a01b);_0x474994[_0x1d12fa(0xd6)](_0x4741a6);}else await handleQueryOutput(_0x2b19dc,_0x1c95e1);}catch(_0x481cb3){const _0x4441ec=_0x52d301?'Statement\x20'+_0x4a22a5+'/'+_0x524dae+':\x0a':'',_0x159a3d=_0x481cb3 instanceof SDKError?_0x481cb3['originalMessage']:_0x481cb3['message'];return console[_0x1d12fa(0xda)](''+_0x4441ec+_0x159a3d),0x1;}}if(_0x14daea[_0x1d12fa(0xc5)]>0x1&&_0x95256f&&_0x474994[_0x1d12fa(0xc5)]>0x0){const _0x180b65=_0x474994[_0x1d12fa(0xf0)]('\x0a');writeFileSync(_0x284f0a[_0x1d12fa(0xc9)],_0x180b65),console[_0x1d12fa(0xda)](_0x1d12fa(0xd1)+_0x284f0a[_0x1d12fa(0xc9)]);}return 0x0;}catch(_0x5da1aa){throw _0x5da1aa;}}[a35_0x20a463(0xec)](_0xccc6c2){const _0x12dfaf=a35_0x20a463,_0x225322=_0xccc6c2[_0x12dfaf(0xd2)][0x0],_0x3e52d8=_0xccc6c2[_0x12dfaf(0xd4)][_0x12dfaf(0xe1)];if(!_0x225322&&!_0x3e52d8)return _0x12dfaf(0xce);if(_0x225322&&_0x3e52d8)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}
1
+ const a35_0x315343=a35_0x49cd;(function(_0x2fe816,_0x52a3f6){const _0x5642d3=a35_0x49cd,_0x5c7e94=_0x2fe816();while(!![]){try{const _0x20cb2e=parseInt(_0x5642d3(0x7f))/0x1+parseInt(_0x5642d3(0x77))/0x2+parseInt(_0x5642d3(0x8a))/0x3+-parseInt(_0x5642d3(0x7e))/0x4+parseInt(_0x5642d3(0x76))/0x5+-parseInt(_0x5642d3(0x7d))/0x6+parseInt(_0x5642d3(0x78))/0x7*(parseInt(_0x5642d3(0x9a))/0x8);if(_0x20cb2e===_0x52a3f6)break;else _0x5c7e94['push'](_0x5c7e94['shift']());}catch(_0xe364a5){_0x5c7e94['push'](_0x5c7e94['shift']());}}}(a35_0x3a70,0x8dff3));import{BaseCommand}from'./command.js';function a35_0x49cd(_0x2b3c52,_0xc64523){_0x2b3c52=_0x2b3c52-0x70;const _0x3a7027=a35_0x3a70();let _0x49cd51=_0x3a7027[_0x2b3c52];return _0x49cd51;}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_0x3a70(){const _0x3ac62a=['setPhase','information_schema','Run\x20Trino\x20queries\x20(streaming)','Executing\x20query...','site','file','\x0aAll\x20results\x20saved\x20to\x20','Site:\x20','...','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','Catalog:\x20','3157540whdezn','781326UhkbEE','87297FHcStY','setExtra','catalog','\x20[Job\x20ID:\x20','execute','6704886pMqOGF','1574544gdQNmy','708520KygnnK','args','length','Executing\x20statement\x20','setJobId','Schema:\x20','Executing\x20query\x20[','database','totalSplits','Query\x20completed:\x20Processed\x20','processedRows','337875vKbXaK','message','verbose','stats','\x20-\x20','\x20splits','description','Error:\x20','SQL:\x20','error','Statement\x20','No\x20SQL\x20provided','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','join','output','jobId','160syUlEB'];a35_0x3a70=function(){return _0x3ac62a;};return a35_0x3a70();}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']='query';[a35_0x315343(0x90)]=a35_0x315343(0x9d);async[a35_0x315343(0x7c)](_0x37cba1){const _0x3d0630=a35_0x315343,{options:_0x4b85c4,args:_0x465463,tdx:_0x1e88df}=_0x37cba1,_0x108cba={..._0x4b85c4,'limitStructuredFormats':!![]},_0x299b20=_0x465463[0x0],_0x5a21fe=_0x4b85c4[_0x3d0630(0x70)];let _0x23f0a5;try{if(_0x5a21fe)_0x23f0a5=readSqlStatementsFromFile(_0x5a21fe);else{if(_0x299b20==='-')_0x23f0a5=await readSqlStatementsFromStdin();else{if(_0x299b20&&isSqlFilePath(_0x299b20))_0x23f0a5=readSqlStatementsFromFile(_0x299b20);else{if(_0x299b20)_0x23f0a5=splitSqlStatements(_0x299b20);else throw new Error(_0x3d0630(0x95));}}}}catch(_0x46e34d){return console[_0x3d0630(0x93)](_0x3d0630(0x91)+_0x46e34d[_0x3d0630(0x8b)]),0x1;}const _0x1d983a=_0x4b85c4[_0x3d0630(0x86)]||_0x3d0630(0x9c),_0x36639c=_0x4b85c4[_0x3d0630(0x7a)];try{const _0x3f9f9d=[],_0x3b006d=!!_0x4b85c4['output'];for(let _0x9e464f=0x0;_0x9e464f<_0x23f0a5[_0x3d0630(0x81)];_0x9e464f++){const _0x2975ee=_0x23f0a5[_0x9e464f],_0xa7817=_0x9e464f+0x1,_0x430551=_0x23f0a5[_0x3d0630(0x81)],_0x5da2b3=_0x430551>0x1;_0x4b85c4[_0x3d0630(0x8c)]&&(console[_0x3d0630(0x93)]('\x0a'+(_0x5da2b3?'Statement\x20'+_0xa7817+'/'+_0x430551+':':'')),console[_0x3d0630(0x93)](_0x3d0630(0x72)+_0x4b85c4[_0x3d0630(0x9f)]),console[_0x3d0630(0x93)](_0x3d0630(0x75)+(_0x36639c||'td')),console[_0x3d0630(0x93)](_0x3d0630(0x84)+_0x1d983a),console[_0x3d0630(0x93)](_0x3d0630(0x92)+_0x2975ee));const _0xc07b66=_0x5da2b3?_0x3d0630(0x82)+_0xa7817+'/'+_0x430551+_0x3d0630(0x73):_0x3d0630(0x9e);try{const _0x258de6=await withProgressSpinner(_0xc07b66,async _0x10ef95=>{const _0x3d50b9=_0x3d0630,_0x3524e8=await _0x1e88df['query'][_0x3d50b9(0x7c)](_0x2975ee,{'catalog':_0x36639c,'schema':_0x1d983a,'onJobId':_0x45d09a=>{const _0xa6eed1=_0x3d50b9;_0x10ef95[_0xa6eed1(0x83)](_0x45d09a);},'onProgress':_0x162683=>{const _0x3b0c59=_0x3d50b9;_0x10ef95[_0x3b0c59(0x9b)](_0x3b0c59(0x85)+_0x162683['state']+']'),_0x10ef95[_0x3b0c59(0x79)](formatRows(_0x162683[_0x3b0c59(0x89)])+'\x20rows\x20'+_0x162683['completedSplits']+'/'+_0x162683[_0x3b0c59(0x87)]+_0x3b0c59(0x8f));}});return _0x3524e8;},{'verbose':_0x4b85c4['verbose']}),_0x5a6483=_0x258de6['data'],_0x474417=_0x5a6483[_0x3d0630(0x99)]?_0x3d0630(0x7b)+_0x5a6483[_0x3d0630(0x99)]+']':'',_0x4db39a=_0x5da2b3?_0x3d0630(0x94)+_0xa7817+'/'+_0x430551+_0x3d0630(0x8e):'';console[_0x3d0630(0x93)]('✔\x20'+_0x4db39a+_0x3d0630(0x88)+formatRows(_0x5a6483[_0x3d0630(0x8d)]['processedRows'])+'\x20rows\x20'+('in\x20'+formatElapsed(_0x5a6483['stats']['elapsedTimeMillis'])+_0x474417));if(_0x5da2b3&&_0x3b006d){const _0x291973=resolveOutputOptions(_0x108cba),_0x1cc75e=await formatQueryOutput(_0x5a6483,_0x291973);_0x3f9f9d['push'](_0x1cc75e);}else await handleQueryOutput(_0x5a6483,_0x108cba);}catch(_0x13a6e5){const _0x4c536d=_0x5da2b3?'Statement\x20'+_0xa7817+'/'+_0x430551+':\x0a':'',_0x5a522a=_0x13a6e5 instanceof SDKError?_0x13a6e5['originalMessage']:_0x13a6e5['message'];return console[_0x3d0630(0x93)](''+_0x4c536d+_0x5a522a),0x1;}}if(_0x23f0a5[_0x3d0630(0x81)]>0x1&&_0x3b006d&&_0x3f9f9d[_0x3d0630(0x81)]>0x0){const _0x4b8ee3=_0x3f9f9d[_0x3d0630(0x97)]('\x0a');writeFileSync(_0x4b85c4[_0x3d0630(0x98)],_0x4b8ee3),console['error'](_0x3d0630(0x71)+_0x4b85c4[_0x3d0630(0x98)]);}return 0x0;}catch(_0x3bfdfa){throw _0x3bfdfa;}}['validate'](_0x3e55fd){const _0x38a509=a35_0x315343,_0x100a57=_0x3e55fd[_0x38a509(0x80)][0x0],_0x4ff245=_0x3e55fd['options'][_0x38a509(0x70)];if(!_0x100a57&&!_0x4ff245)return _0x38a509(0x96);if(_0x100a57&&_0x4ff245)return _0x38a509(0x74);return undefined;}}
@@ -1 +1 @@
1
- const a36_0x4fd7fd=a36_0x3be2;(function(_0x4db397,_0x1a06ea){const _0x56c3a7=a36_0x3be2,_0x50cd2e=_0x4db397();while(!![]){try{const _0x412573=parseInt(_0x56c3a7(0x167))/0x1*(parseInt(_0x56c3a7(0x18f))/0x2)+parseInt(_0x56c3a7(0x1c9))/0x3+-parseInt(_0x56c3a7(0x19d))/0x4*(-parseInt(_0x56c3a7(0x168))/0x5)+-parseInt(_0x56c3a7(0x171))/0x6+-parseInt(_0x56c3a7(0x1a8))/0x7+parseInt(_0x56c3a7(0x1e8))/0x8+-parseInt(_0x56c3a7(0x163))/0x9;if(_0x412573===_0x1a06ea)break;else _0x50cd2e['push'](_0x50cd2e['shift']());}catch(_0x2415ac){_0x50cd2e['push'](_0x50cd2e['shift']());}}}(a36_0x2077,0x7daa7));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';function a36_0x3be2(_0x10e6bb,_0x5e4c68){_0x10e6bb=_0x10e6bb-0x15c;const _0x2077cc=a36_0x2077();let _0x3be2b2=_0x2077cc[_0x10e6bb];return _0x3be2b2;}import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';function a36_0x2077(){const _0x433fbf=['Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','\x20\x20Job\x20ID:\x20','listQueries','never','log','delete','11994318Lmofds','\x20scheduled\x20quer','\x20created','\x20\x20Type:\x20','74JKqpen','7365UoyLTl','retryLimit','num','\x20(use\x20--limit\x20to\x20see\x20more)','validate','file','\x20execution','result','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','717186OecnDv','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','Schedule\x20created:\x20','\x20\x20Cron:\x20','end_at','ended_at','success','INVALID_ARGUMENT','trino','engineVersion','jsonl','join','📅\x20','just\x20now','timezone','status','keys','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','schedule:delete','engine_version','options','m\x20ago','\x20\x20→\x20','limit','query','count','schedule:update','Found\x20','jobs','priority','11734ivVCiB','args','created_at','Schedule\x20run\x20submitted:\x20','/app/queries/editor?queryId=','cron','cyan','format','updated_at','queries','Showing\x20first\x20','substring','red','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','2516beazFG','toLocaleDateString','user','run','padEnd','d\x20ago','getTime','time_zone','type','in\x20','scheduled_at','3287088aJktlF','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','\x20\x20Time:\x20','\x22...','schedules','database','length','Getting\x20schedule\x20history...','max','execute','repeat','Update\x20a\x20scheduled\x20query','schedule:run','trim','pagination','yes','show','Deleting\x20schedule...','\x20\x20Database:\x20','\x20schedules','schedule:create','lastRun','error','table','tsv','next_run_at','Failed\x20to\x20read\x20file:\x20','utf-8','has_next_page','retry_limit','\x20(showing\x20','Schedule\x20deleted:\x20','user_name','359256DvPfUf','Creating\x20schedule:\x20','Updating\x20schedule:\x20','queryUrl','No\x20scheduled\x20queries\x20found','nextRun','verbose','update','round','executing_user_id','map','Running\x20schedule:\x20','create','...','data','schedule:history','\x20matching\x20\x22','Listing\x20scheduled\x20queries...','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','job_id','Delete\x20a\x20scheduled\x20query','\x20job','(unnamed)','\x20\x20Num:\x20','entries','delay','list','h\x20ago','soon','Running\x20schedule...','last_job','7648936mXcMvQ','description','history','name'];a36_0x2077=function(){return _0x433fbf;};return a36_0x2077();}import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a36_0x289f2d from'chalk';function formatRelativeTime(_0x50f43e){const _0x40f7ff=a36_0x3be2,_0x3519a5=new Date(_0x50f43e),_0x43cdd6=new Date(),_0x453f28=_0x3519a5[_0x40f7ff(0x1a3)]()-_0x43cdd6['getTime'](),_0x1cb233=Math['abs'](_0x453f28)/0x3e8,_0x193cde=_0x453f28<0x0;if(_0x1cb233<0x3c)return _0x193cde?_0x40f7ff(0x17e):_0x40f7ff(0x1e5);else{if(_0x1cb233<0xe10){const _0x3de751=Math[_0x40f7ff(0x1d1)](_0x1cb233/0x3c);return _0x193cde?_0x3de751+_0x40f7ff(0x186):_0x40f7ff(0x1a6)+_0x3de751+'m';}else{if(_0x1cb233<0x15180){const _0x533801=Math[_0x40f7ff(0x1d1)](_0x1cb233/0xe10);return _0x193cde?_0x533801+_0x40f7ff(0x1e4):_0x40f7ff(0x1a6)+_0x533801+'h';}else{if(_0x1cb233<0x93a80){const _0x17cdfa=Math[_0x40f7ff(0x1d1)](_0x1cb233/0x15180);return _0x193cde?_0x17cdfa+_0x40f7ff(0x1a2):_0x40f7ff(0x1a6)+_0x17cdfa+'d';}else return _0x3519a5[_0x40f7ff(0x19e)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x4fd7fd(0x15c)]='schedule:list';['description']='List\x20scheduled\x20queries';async[a36_0x4fd7fd(0x1b1)](_0xe20903){const _0x41528e=a36_0x4fd7fd,{options:_0x500f78,args:_0x5ef4d5,tdx:_0x5007be}=_0xe20903,_0x19e354=resolveLimit(_0x500f78[_0x41528e(0x188)],DEFAULT_DISPLAY_LIMIT),_0x1c8e9e=_0x5ef4d5[0x0],_0x14846c=_0x1c8e9e?'Searching\x20scheduled\x20queries\x20matching\x20\x22'+_0x1c8e9e+_0x41528e(0x1ab):_0x41528e(0x1da),_0x3d2f2e=await withSpinner(_0x14846c,()=>_0x5007be[_0x41528e(0x1ac)][_0x41528e(0x15f)]({'limit':_0x19e354,'scheduled':!![],'pattern':_0x1c8e9e}),{'verbose':_0x500f78[_0x41528e(0x1cf)]}),_0x36dfe9=_0x3d2f2e[_0x41528e(0x1d7)][_0x41528e(0x198)],_0x4f20fd=_0x3d2f2e[_0x41528e(0x1d7)][_0x41528e(0x1b6)][_0x41528e(0x1c4)],_0x5b1da7=_0x1c8e9e?_0x41528e(0x1d9)+_0x1c8e9e+'\x22':'';_0x4f20fd?console[_0x41528e(0x1be)](_0x41528e(0x199)+_0x36dfe9[_0x41528e(0x1ae)]+_0x41528e(0x1bb)+_0x5b1da7+_0x41528e(0x16b)):console[_0x41528e(0x1be)](_0x41528e(0x18c)+_0x36dfe9['length']+_0x41528e(0x164)+(_0x36dfe9[_0x41528e(0x1ae)]!==0x1?'ies':'y')+_0x5b1da7);if(_0x500f78[_0x41528e(0x196)]==='json'||_0x500f78[_0x41528e(0x196)]===_0x41528e(0x17b)||_0x500f78[_0x41528e(0x196)]===_0x41528e(0x1bf)||_0x500f78['format']===_0x41528e(0x1c0)){const _0xfc49d=_0x36dfe9[_0x41528e(0x1d3)](_0x464379=>({'id':_0x464379['id'],'name':_0x464379[_0x41528e(0x15c)],'cron':_0x464379[_0x41528e(0x194)],'database':_0x464379[_0x41528e(0x1ad)]?.[_0x41528e(0x15c)],'type':_0x464379[_0x41528e(0x1a5)],'timezone':_0x464379[_0x41528e(0x1a4)],'user_name':_0x464379[_0x41528e(0x19f)]?.[_0x41528e(0x15c)],'updated_at':_0x464379[_0x41528e(0x197)],'next_run_at':_0x464379['next_run_at'],'last_job_status':_0x464379[_0x41528e(0x1e7)]?.[_0x41528e(0x180)]}));await handleSDKOutput(_0xfc49d,_0x500f78);}else{if(_0x36dfe9[_0x41528e(0x1ae)]===0x0)console[_0x41528e(0x161)](_0x41528e(0x1cd));else{const _0x555360=_0x500f78['site'],_0x474ecb=_0x36dfe9[_0x41528e(0x1d3)](_0x340e8d=>{const _0x352b3b=_0x41528e,_0x4c3747=_0x340e8d[_0x352b3b(0x1e7)]?.[_0x352b3b(0x180)]?_0x340e8d[_0x352b3b(0x1e7)][_0x352b3b(0x180)]===_0x352b3b(0x177)?'✓':'✗':'-',_0x499ed5=_0x340e8d[_0x352b3b(0x1e7)]?.['ended_at']?formatRelativeTime(_0x340e8d[_0x352b3b(0x1e7)][_0x352b3b(0x176)]):_0x352b3b(0x160),_0xd041d6=_0x340e8d[_0x352b3b(0x1c1)]?formatRelativeTime(_0x340e8d[_0x352b3b(0x1c1)]):'-',_0x424f51=_0x340e8d[_0x352b3b(0x194)]||'',_0x3086fb=_0x340e8d[_0x352b3b(0x15c)]||_0x352b3b(0x1df),_0x348252=getConsoleUrl(_0x555360,_0x352b3b(0x193)+_0x340e8d['id']);return{'statusIcon':_0x4c3747,'lastRun':_0x499ed5,'nextRun':_0xd041d6,'cron':_0x424f51,'name':_0x3086fb,'queryUrl':_0x348252,'status':_0x340e8d[_0x352b3b(0x1e7)]?.[_0x352b3b(0x180)]};}),_0x5b582c=Math[_0x41528e(0x1b0)](..._0x474ecb['map'](_0x304b91=>_0x304b91['lastRun'][_0x41528e(0x1ae)])),_0x35721b=Math[_0x41528e(0x1b0)](..._0x474ecb[_0x41528e(0x1d3)](_0x4e32b9=>_0x4e32b9[_0x41528e(0x1ce)][_0x41528e(0x1ae)])),_0x5bd6d5=Math[_0x41528e(0x1b0)](..._0x474ecb[_0x41528e(0x1d3)](_0xc490cc=>_0xc490cc[_0x41528e(0x194)][_0x41528e(0x1ae)])),_0x402056=_0x474ecb['map'](_0xc9898c=>{const _0x4c742f=_0x41528e,_0x5195be=_0xc9898c[_0x4c742f(0x180)]===_0x4c742f(0x177)?a36_0x289f2d['green'](_0xc9898c['statusIcon']):_0xc9898c['status']===_0x4c742f(0x1be)?a36_0x289f2d[_0x4c742f(0x19b)](_0xc9898c['statusIcon']):a36_0x289f2d['dim'](_0xc9898c['statusIcon']),_0x5e42dd=_0xc9898c[_0x4c742f(0x1bd)][_0x4c742f(0x1a1)](_0x5b582c),_0x45db3d=_0xc9898c[_0x4c742f(0x1ce)][_0x4c742f(0x1a1)](_0x35721b),_0x3cb059=_0xc9898c[_0x4c742f(0x194)]?a36_0x289f2d[_0x4c742f(0x195)](_0xc9898c[_0x4c742f(0x194)][_0x4c742f(0x1a1)](_0x5bd6d5)):'\x20'[_0x4c742f(0x1b2)](_0x5bd6d5),_0x463cc5=hyperlink(_0xc9898c[_0x4c742f(0x15c)],_0xc9898c[_0x4c742f(0x1cc)]);return _0x4c742f(0x17d)+_0x5195be+'\x20'+_0x5e42dd+_0x4c742f(0x187)+_0x45db3d+'\x20\x20'+_0x3cb059+'\x20\x20'+_0x463cc5;});await writeOutput(_0x402056[_0x41528e(0x17c)]('\x0a'),_0x500f78['output'],_0x41528e(0x1e3));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x4fd7fd(0x15c)]='schedule:show';[a36_0x4fd7fd(0x1e9)]='Show\x20schedule\x20details';[a36_0x4fd7fd(0x16c)](_0x3c6d81){const _0x1d8da2=a36_0x4fd7fd,_0x5315e4=_0x3c6d81[_0x1d8da2(0x190)][0x0];if(!_0x5315e4)return _0x1d8da2(0x1db);return undefined;}async['execute'](_0x45abf6){const _0x29d886=a36_0x4fd7fd,{options:_0x2736ed,args:_0x15915f,tdx:_0x5198f4}=_0x45abf6,_0x2e3507=_0x15915f[0x0],_0x326a06=await withSpinner('Getting\x20schedule\x20details...',()=>_0x5198f4[_0x29d886(0x1ac)][_0x29d886(0x1b8)](_0x2e3507),{'verbose':_0x2736ed[_0x29d886(0x1cf)]}),_0x4f8603=_0x326a06[_0x29d886(0x1d7)],_0x19592e={'name':_0x4f8603['name'],'cron':_0x4f8603[_0x29d886(0x194)],'database':_0x4f8603[_0x29d886(0x1ad)],'type':_0x4f8603[_0x29d886(0x1a5)],'timezone':_0x4f8603[_0x29d886(0x17f)],'user_name':_0x4f8603[_0x29d886(0x1c8)],'created_at':_0x4f8603[_0x29d886(0x191)],'engine_version':_0x4f8603['engine_version'],'executing_user_id':_0x4f8603[_0x29d886(0x1d2)],'query':_0x4f8603[_0x29d886(0x189)],'delay':_0x4f8603['delay'],'priority':_0x4f8603[_0x29d886(0x18e)],'retry_limit':_0x4f8603[_0x29d886(0x1c5)],..._0x4f8603['result']&&{'result':_0x4f8603['result']}};return await handleSingleObjectOutput(_0x19592e,_0x2736ed),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x4fd7fd(0x15c)]=a36_0x4fd7fd(0x1bc);[a36_0x4fd7fd(0x1e9)]='Create\x20a\x20scheduled\x20query';[a36_0x4fd7fd(0x16c)](_0x1909b9){const _0x4fe0b3=a36_0x4fd7fd,_0x45d9d0=_0x1909b9[_0x4fe0b3(0x190)][0x0];if(!_0x45d9d0)return _0x4fe0b3(0x15d);const _0x53205f=_0x1909b9[_0x4fe0b3(0x185)];if(!_0x53205f[_0x4fe0b3(0x1ad)])return _0x4fe0b3(0x182);return undefined;}async[a36_0x4fd7fd(0x1b1)](_0x467831){const _0x4181ab=a36_0x4fd7fd,{options:_0x7bd201,args:_0x3744ab,tdx:_0x421ca7}=_0x467831,_0x55d6ae=_0x3744ab[0x0],_0x27674f=_0x7bd201,_0xfb99bd=_0x27674f[_0x4181ab(0x1ad)],_0x261c92=_0x27674f['file'],_0x15527b=_0x27674f['type']||_0x4181ab(0x179);let _0x5f47aa;try{_0x5f47aa=readFileSync(_0x261c92,_0x4181ab(0x1c3))[_0x4181ab(0x1b5)]();}catch(_0x5e6c13){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x4181ab(0x1c2)+_0x261c92,_0x5e6c13 instanceof Error?_0x5e6c13:undefined);}if(!_0x5f47aa)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Query\x20file\x20is\x20empty');const _0x5c0598={'database':_0xfb99bd,'query':_0x5f47aa,'type':_0x15527b};if(_0x27674f['cron'])_0x5c0598[_0x4181ab(0x194)]=_0x27674f['cron'];if(_0x27674f['timezone'])_0x5c0598[_0x4181ab(0x17f)]=_0x27674f[_0x4181ab(0x17f)];if(_0x27674f[_0x4181ab(0x1e2)]!==undefined)_0x5c0598[_0x4181ab(0x1e2)]=Number(_0x27674f['delay']);if(_0x27674f['priority']!==undefined)_0x5c0598['priority']=Number(_0x27674f[_0x4181ab(0x18e)]);if(_0x27674f['retryLimit']!==undefined)_0x5c0598[_0x4181ab(0x1c5)]=Number(_0x27674f[_0x4181ab(0x169)]);if(_0x27674f['engineVersion'])_0x5c0598['engine_version']=_0x27674f[_0x4181ab(0x17a)];if(_0x27674f['result'])_0x5c0598[_0x4181ab(0x16f)]=_0x27674f[_0x4181ab(0x16f)];if(_0x7bd201['verbose']){console[_0x4181ab(0x1be)](_0x4181ab(0x1ca)+_0x55d6ae),console[_0x4181ab(0x1be)](_0x4181ab(0x1ba)+_0xfb99bd),console['error'](_0x4181ab(0x166)+_0x15527b);if(_0x5c0598[_0x4181ab(0x194)])console['error'](_0x4181ab(0x174)+_0x5c0598['cron']);if(_0x5c0598[_0x4181ab(0x17f)])console['error']('\x20\x20Timezone:\x20'+_0x5c0598[_0x4181ab(0x17f)]);}const _0x2562bb=await withSpinner('Creating\x20schedule...',()=>_0x421ca7['schedules'][_0x4181ab(0x1d5)](_0x55d6ae,_0x5c0598),{'verbose':_0x7bd201['verbose']});return console[_0x4181ab(0x1be)](_0x4181ab(0x173)+_0x2562bb['data'][_0x4181ab(0x15c)]),await handleSingleObjectOutput(_0x2562bb[_0x4181ab(0x1d7)],_0x7bd201),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x4fd7fd(0x15c)]=a36_0x4fd7fd(0x18b);[a36_0x4fd7fd(0x1e9)]=a36_0x4fd7fd(0x1b3);[a36_0x4fd7fd(0x16c)](_0x3ed37c){const _0x31eaca=a36_0x4fd7fd,_0x2b4666=_0x3ed37c[_0x31eaca(0x190)][0x0];if(!_0x2b4666)return _0x31eaca(0x170);return undefined;}async[a36_0x4fd7fd(0x1b1)](_0xa149ef){const _0x218b08=a36_0x4fd7fd,{options:_0xa4dde5,args:_0x50702b,tdx:_0x4290c3}=_0xa149ef,_0x5883eb=_0x50702b[0x0],_0xc22b19=_0xa4dde5,_0x116eab={};if(_0xc22b19['database'])_0x116eab[_0x218b08(0x1ad)]=_0xc22b19[_0x218b08(0x1ad)];if(_0xc22b19[_0x218b08(0x1a5)])_0x116eab['type']=_0xc22b19[_0x218b08(0x1a5)];if(_0xc22b19['cron'])_0x116eab[_0x218b08(0x194)]=_0xc22b19['cron'];if(_0xc22b19['timezone'])_0x116eab['timezone']=_0xc22b19['timezone'];if(_0xc22b19[_0x218b08(0x1e2)]!==undefined)_0x116eab[_0x218b08(0x1e2)]=Number(_0xc22b19['delay']);if(_0xc22b19[_0x218b08(0x18e)]!==undefined)_0x116eab[_0x218b08(0x18e)]=Number(_0xc22b19['priority']);if(_0xc22b19[_0x218b08(0x169)]!==undefined)_0x116eab[_0x218b08(0x1c5)]=Number(_0xc22b19['retryLimit']);if(_0xc22b19[_0x218b08(0x17a)])_0x116eab[_0x218b08(0x184)]=_0xc22b19[_0x218b08(0x17a)];if(_0xc22b19[_0x218b08(0x16f)])_0x116eab[_0x218b08(0x16f)]=_0xc22b19[_0x218b08(0x16f)];if(_0xc22b19['file'])try{_0x116eab[_0x218b08(0x189)]=readFileSync(_0xc22b19[_0x218b08(0x16d)],_0x218b08(0x1c3))['trim']();}catch(_0x294a23){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x218b08(0x1c2)+_0xc22b19[_0x218b08(0x16d)],_0x294a23 instanceof Error?_0x294a23:undefined);}if(Object[_0x218b08(0x181)](_0x116eab)[_0x218b08(0x1ae)]===0x0)throw new SDKError(ErrorCode[_0x218b08(0x178)],'At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update');if(_0xa4dde5[_0x218b08(0x1cf)]){console[_0x218b08(0x1be)](_0x218b08(0x1cb)+_0x5883eb);for(const [_0x22e033,_0x217023]of Object[_0x218b08(0x1e1)](_0x116eab)){_0x22e033===_0x218b08(0x189)?console['error']('\x20\x20'+_0x22e033+':\x20'+_0x217023[_0x218b08(0x19a)](0x0,0x32)+_0x218b08(0x1d6)):console[_0x218b08(0x1be)]('\x20\x20'+_0x22e033+':\x20'+_0x217023);}}const _0x464533=await withSpinner('Updating\x20schedule...',()=>_0x4290c3[_0x218b08(0x1ac)][_0x218b08(0x1d0)](_0x5883eb,_0x116eab),{'verbose':_0xa4dde5[_0x218b08(0x1cf)]});return console[_0x218b08(0x1be)]('Schedule\x20updated:\x20'+_0x464533[_0x218b08(0x1d7)][_0x218b08(0x15c)]),await handleSingleObjectOutput(_0x464533[_0x218b08(0x1d7)],_0xa4dde5),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x4fd7fd(0x15c)]=a36_0x4fd7fd(0x183);[a36_0x4fd7fd(0x1e9)]=a36_0x4fd7fd(0x1dd);[a36_0x4fd7fd(0x16c)](_0x5a1c6){const _0x1d6171=a36_0x4fd7fd,_0x1d464c=_0x5a1c6[_0x1d6171(0x190)][0x0];if(!_0x1d464c)return _0x1d6171(0x19c);return undefined;}async[a36_0x4fd7fd(0x1b1)](_0x396a02){const _0x52a86c=a36_0x4fd7fd,{options:_0x22a272,args:_0x56b82b,tdx:_0xe21714}=_0x396a02,_0x348d6a=_0x56b82b[0x0];if(!_0x22a272[_0x52a86c(0x1b7)]){const _0xc8f223=await confirm(_0x52a86c(0x1a9)+_0x348d6a+'\x22?');if(!_0xc8f223)return console[_0x52a86c(0x1be)]('Cancelled'),0x0;}const _0x16a288=await withSpinner(_0x52a86c(0x1b9),()=>_0xe21714[_0x52a86c(0x1ac)][_0x52a86c(0x162)](_0x348d6a),{'verbose':_0x22a272['verbose']});return console[_0x52a86c(0x1be)](_0x52a86c(0x1c7)+_0x16a288[_0x52a86c(0x1d7)][_0x52a86c(0x15c)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x4fd7fd(0x15c)]=a36_0x4fd7fd(0x1b4);[a36_0x4fd7fd(0x1e9)]='Run\x20a\x20scheduled\x20query\x20immediately';[a36_0x4fd7fd(0x16c)](_0x481edf){const _0x465596=_0x481edf['args'][0x0];if(!_0x465596)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async['execute'](_0x48834c){const _0x2e9ccc=a36_0x4fd7fd,{options:_0x3608d0,args:_0x42148f,tdx:_0x2f39ce}=_0x48834c,_0x51d4d6=_0x42148f[0x0],_0x4cfce4=_0x3608d0,_0x3f63b4=_0x4cfce4['time'],_0x189fa5=_0x4cfce4[_0x2e9ccc(0x16a)]!==undefined?Number(_0x4cfce4[_0x2e9ccc(0x16a)]):undefined;if(_0x3608d0['verbose']){console['error'](_0x2e9ccc(0x1d4)+_0x51d4d6);if(_0x3f63b4)console[_0x2e9ccc(0x1be)](_0x2e9ccc(0x1aa)+_0x3f63b4);if(_0x189fa5)console[_0x2e9ccc(0x1be)](_0x2e9ccc(0x1e0)+_0x189fa5);}const _0x51512a=await withSpinner(_0x2e9ccc(0x1e6),()=>_0x2f39ce[_0x2e9ccc(0x1ac)][_0x2e9ccc(0x1a0)](_0x51d4d6,{'time':_0x3f63b4,'num':_0x189fa5}),{'verbose':_0x3608d0[_0x2e9ccc(0x1cf)]}),_0x1ca28=_0x51512a[_0x2e9ccc(0x1d7)][_0x2e9ccc(0x18d)];console[_0x2e9ccc(0x1be)](_0x2e9ccc(0x192)+_0x1ca28['length']+_0x2e9ccc(0x1de)+(_0x1ca28[_0x2e9ccc(0x1ae)]!==0x1?'s':'')+_0x2e9ccc(0x165));for(const _0x4c40f7 of _0x1ca28){console[_0x2e9ccc(0x1be)](_0x2e9ccc(0x15e)+_0x4c40f7[_0x2e9ccc(0x1dc)]);}return await handleSDKOutput(_0x1ca28,_0x3608d0),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{['name']=a36_0x4fd7fd(0x1d8);[a36_0x4fd7fd(0x1e9)]='Show\x20schedule\x20execution\x20history';[a36_0x4fd7fd(0x16c)](_0x4e7d5a){const _0xc066d6=a36_0x4fd7fd,_0x38c073=_0x4e7d5a[_0xc066d6(0x190)][0x0];if(!_0x38c073)return _0xc066d6(0x172);return undefined;}async[a36_0x4fd7fd(0x1b1)](_0x47b056){const _0xcc24ff=a36_0x4fd7fd,{options:_0x57ff89,args:_0xba024,tdx:_0x201c0f}=_0x47b056,_0x1bddb9=_0xba024[0x0],_0x197777=_0x57ff89,_0x3aeb72=_0x197777['from']!==undefined?Number(_0x197777['from']):undefined,_0x48c2ce=_0x197777['to']!==undefined?Number(_0x197777['to']):undefined,_0x5e5c7b=await withSpinner(_0xcc24ff(0x1af),()=>_0x201c0f[_0xcc24ff(0x1ac)][_0xcc24ff(0x1ea)](_0x1bddb9,{'from':_0x3aeb72,'to':_0x48c2ce}),{'verbose':_0x57ff89['verbose']}),_0x536ff5=_0x5e5c7b[_0xcc24ff(0x1d7)];console[_0xcc24ff(0x1be)](_0xcc24ff(0x18c)+_0x536ff5['count']+_0xcc24ff(0x16e)+(_0x536ff5[_0xcc24ff(0x18a)]!==0x1?'s':'')+_0xcc24ff(0x1c6)+_0x536ff5['from']+'-'+_0x536ff5['to']+')');const _0x3a20a3=_0x536ff5[_0xcc24ff(0x1ea)][_0xcc24ff(0x1d3)](_0x43b3c3=>({'job_id':_0x43b3c3['job_id'],'type':_0x43b3c3[_0xcc24ff(0x1a5)],'status':_0x43b3c3[_0xcc24ff(0x180)],'scheduled_at':_0x43b3c3[_0xcc24ff(0x1a7)],'created_at':_0x43b3c3['created_at'],'start_at':_0x43b3c3['start_at'],'end_at':_0x43b3c3[_0xcc24ff(0x175)]}));return await handleSDKOutput(_0x3a20a3,_0x57ff89),0x0;}}
1
+ const a36_0x45a24d=a36_0x14ee;(function(_0xfe5a3c,_0x189aed){const _0x23c835=a36_0x14ee,_0x41a00c=_0xfe5a3c();while(!![]){try{const _0x2fb4b1=parseInt(_0x23c835(0xf9))/0x1*(parseInt(_0x23c835(0xda))/0x2)+-parseInt(_0x23c835(0x103))/0x3*(parseInt(_0x23c835(0x115))/0x4)+parseInt(_0x23c835(0xf2))/0x5+parseInt(_0x23c835(0x10b))/0x6*(parseInt(_0x23c835(0x84))/0x7)+-parseInt(_0x23c835(0xa6))/0x8+-parseInt(_0x23c835(0x10f))/0x9*(-parseInt(_0x23c835(0xfa))/0xa)+-parseInt(_0x23c835(0xff))/0xb;if(_0x2fb4b1===_0x189aed)break;else _0x41a00c['push'](_0x41a00c['shift']());}catch(_0x94e613){_0x41a00c['push'](_0x41a00c['shift']());}}}(a36_0x1b09,0xf393d));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_0x1e95e1 from'chalk';function formatRelativeTime(_0x41a21c){const _0x5c4c56=a36_0x14ee,_0xb55674=new Date(_0x41a21c),_0x10ad2a=new Date(),_0x4816b3=_0xb55674[_0x5c4c56(0xbd)]()-_0x10ad2a[_0x5c4c56(0xbd)](),_0x2208d5=Math[_0x5c4c56(0xde)](_0x4816b3)/0x3e8,_0xef74ef=_0x4816b3<0x0;if(_0x2208d5<0x3c)return _0xef74ef?_0x5c4c56(0xfb):'soon';else{if(_0x2208d5<0xe10){const _0x4b58ec=Math[_0x5c4c56(0x10d)](_0x2208d5/0x3c);return _0xef74ef?_0x4b58ec+'m\x20ago':'in\x20'+_0x4b58ec+'m';}else{if(_0x2208d5<0x15180){const _0x1a9f8d=Math['round'](_0x2208d5/0xe10);return _0xef74ef?_0x1a9f8d+_0x5c4c56(0xe7):_0x5c4c56(0xb5)+_0x1a9f8d+'h';}else{if(_0x2208d5<0x93a80){const _0x2b02ce=Math[_0x5c4c56(0x10d)](_0x2208d5/0x15180);return _0xef74ef?_0x2b02ce+_0x5c4c56(0xb3):_0x5c4c56(0xb5)+_0x2b02ce+'d';}else return _0xb55674['toLocaleDateString']();}}}}export class ScheduleListCommand extends BaseCommand{['name']=a36_0x45a24d(0xc7);[a36_0x45a24d(0xe0)]=a36_0x45a24d(0xb7);async[a36_0x45a24d(0x113)](_0x20a255){const _0x32b404=a36_0x45a24d,{options:_0x2af460,args:_0x5728cc,tdx:_0x15ca5a}=_0x20a255,_0x31036f=resolveLimit(_0x2af460[_0x32b404(0xdf)],DEFAULT_DISPLAY_LIMIT),_0x2b3934=_0x5728cc[0x0],_0x3a6e6d=_0x2b3934?_0x32b404(0x109)+_0x2b3934+'\x22...':_0x32b404(0x8c),_0x3e9cc1=await withSpinner(_0x3a6e6d,()=>_0x15ca5a[_0x32b404(0xee)][_0x32b404(0xcc)]({'limit':_0x31036f,'scheduled':!![],'pattern':_0x2b3934}),{'verbose':_0x2af460[_0x32b404(0xc3)]}),_0x314bb9=_0x3e9cc1[_0x32b404(0xca)]['queries'],_0x1d2df9=_0x3e9cc1[_0x32b404(0xca)][_0x32b404(0xf8)][_0x32b404(0xa2)],_0x32c2aa=_0x2b3934?_0x32b404(0xf0)+_0x2b3934+'\x22':'';_0x1d2df9?console[_0x32b404(0x98)](_0x32b404(0xf7)+_0x314bb9[_0x32b404(0xa3)]+_0x32b404(0xaf)+_0x32c2aa+_0x32b404(0x9f)):console[_0x32b404(0x98)](_0x32b404(0x8e)+_0x314bb9[_0x32b404(0xa3)]+_0x32b404(0xd8)+(_0x314bb9[_0x32b404(0xa3)]!==0x1?_0x32b404(0xc5):'y')+_0x32c2aa);if(_0x2af460[_0x32b404(0x100)]===_0x32b404(0xb4)||_0x2af460['format']==='jsonl'||_0x2af460[_0x32b404(0x100)]==='table'||_0x2af460[_0x32b404(0x100)]===_0x32b404(0x110)){const _0x5edb43=_0x314bb9['map'](_0x559926=>({'id':_0x559926['id'],'name':_0x559926['name'],'cron':_0x559926[_0x32b404(0xb1)],'database':_0x559926[_0x32b404(0x104)]?.['name'],'type':_0x559926[_0x32b404(0xa0)],'timezone':_0x559926['time_zone'],'user_name':_0x559926[_0x32b404(0x114)]?.[_0x32b404(0xef)],'updated_at':_0x559926[_0x32b404(0xd7)],'next_run_at':_0x559926['next_run_at'],'last_job_status':_0x559926[_0x32b404(0x8f)]?.[_0x32b404(0x88)]}));await handleSDKOutput(_0x5edb43,_0x2af460);}else{if(_0x314bb9[_0x32b404(0xa3)]===0x0)console[_0x32b404(0xed)](_0x32b404(0xd3));else{const _0x17e251=_0x2af460[_0x32b404(0x106)],_0x40dc92=_0x314bb9[_0x32b404(0x101)](_0x23488d=>{const _0x5aad17=_0x32b404,_0x3412be=_0x23488d[_0x5aad17(0x8f)]?.['status']?_0x23488d['last_job'][_0x5aad17(0x88)]===_0x5aad17(0x10e)?'✓':'✗':'-',_0x12f673=_0x23488d[_0x5aad17(0x8f)]?.[_0x5aad17(0xab)]?formatRelativeTime(_0x23488d[_0x5aad17(0x8f)][_0x5aad17(0xab)]):_0x5aad17(0xc2),_0x14d1a2=_0x23488d[_0x5aad17(0x8a)]?formatRelativeTime(_0x23488d['next_run_at']):'-',_0x4c4dea=_0x23488d['cron']||'',_0x35952e=_0x23488d['name']||'(unnamed)',_0x442ebc=getConsoleUrl(_0x17e251,'/app/queries/editor?queryId='+_0x23488d['id']);return{'statusIcon':_0x3412be,'lastRun':_0x12f673,'nextRun':_0x14d1a2,'cron':_0x4c4dea,'name':_0x35952e,'queryUrl':_0x442ebc,'status':_0x23488d['last_job']?.[_0x5aad17(0x88)]};}),_0x34cfbf=Math['max'](..._0x40dc92[_0x32b404(0x101)](_0x2da09c=>_0x2da09c[_0x32b404(0xd5)][_0x32b404(0xa3)])),_0x1bd557=Math[_0x32b404(0x86)](..._0x40dc92[_0x32b404(0x101)](_0x2dfdbd=>_0x2dfdbd[_0x32b404(0x91)][_0x32b404(0xa3)])),_0x4cf88c=Math[_0x32b404(0x86)](..._0x40dc92[_0x32b404(0x101)](_0x5251e6=>_0x5251e6[_0x32b404(0xb1)][_0x32b404(0xa3)])),_0x367e44=_0x40dc92[_0x32b404(0x101)](_0x56f31f=>{const _0x4b43fd=_0x32b404,_0xe74878=_0x56f31f[_0x4b43fd(0x88)]==='success'?a36_0x1e95e1[_0x4b43fd(0xd4)](_0x56f31f['statusIcon']):_0x56f31f[_0x4b43fd(0x88)]===_0x4b43fd(0x98)?a36_0x1e95e1['red'](_0x56f31f['statusIcon']):a36_0x1e95e1[_0x4b43fd(0xe3)](_0x56f31f[_0x4b43fd(0xad)]),_0x324067=_0x56f31f[_0x4b43fd(0xd5)][_0x4b43fd(0xc1)](_0x34cfbf),_0x5c0f07=_0x56f31f[_0x4b43fd(0x91)][_0x4b43fd(0xc1)](_0x1bd557),_0x44d815=_0x56f31f[_0x4b43fd(0xb1)]?a36_0x1e95e1[_0x4b43fd(0x87)](_0x56f31f[_0x4b43fd(0xb1)]['padEnd'](_0x4cf88c)):'\x20'['repeat'](_0x4cf88c),_0x536350=hyperlink(_0x56f31f['name'],_0x56f31f[_0x4b43fd(0x9b)]);return _0x4b43fd(0xbb)+_0xe74878+'\x20'+_0x324067+_0x4b43fd(0xd1)+_0x5c0f07+'\x20\x20'+_0x44d815+'\x20\x20'+_0x536350;});await writeOutput(_0x367e44[_0x32b404(0xb8)]('\x0a'),_0x2af460[_0x32b404(0x9c)],_0x32b404(0x90));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x45a24d(0xef)]=a36_0x45a24d(0xea);['description']=a36_0x45a24d(0xc6);[a36_0x45a24d(0x10a)](_0x53031d){const _0x1c3793=a36_0x45a24d,_0xebc0f8=_0x53031d[_0x1c3793(0xbf)][0x0];if(!_0xebc0f8)return _0x1c3793(0x96);return undefined;}async[a36_0x45a24d(0x113)](_0x1e0c7b){const _0x2db8f2=a36_0x45a24d,{options:_0x20a6ff,args:_0xa425d7,tdx:_0x2aac83}=_0x1e0c7b,_0x86875a=_0xa425d7[0x0],_0x4ededa=await withSpinner('Getting\x20schedule\x20details...',()=>_0x2aac83[_0x2db8f2(0xee)][_0x2db8f2(0xc8)](_0x86875a),{'verbose':_0x20a6ff[_0x2db8f2(0xc3)]}),_0xe770d=_0x4ededa['data'],_0x2994bc={'name':_0xe770d[_0x2db8f2(0xef)],'cron':_0xe770d['cron'],'database':_0xe770d[_0x2db8f2(0x104)],'type':_0xe770d[_0x2db8f2(0xa0)],'timezone':_0xe770d[_0x2db8f2(0xe8)],'user_name':_0xe770d['user_name'],'created_at':_0xe770d['created_at'],'engine_version':_0xe770d[_0x2db8f2(0xeb)],'executing_user_id':_0xe770d[_0x2db8f2(0xe5)],'query':_0xe770d[_0x2db8f2(0x8d)],'delay':_0xe770d['delay'],'priority':_0xe770d['priority'],'retry_limit':_0xe770d['retry_limit'],..._0xe770d[_0x2db8f2(0xcd)]&&{'result':_0xe770d['result']}};return await handleSingleObjectOutput(_0x2994bc,_0x20a6ff),0x0;}}function a36_0x1b09(){const _0x25137a=['type','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','has_next_page','length','time','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','5328048bQyrxq','history','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','options','Schedule\x20run\x20submitted:\x20','ended_at','...','statusIcon','Deleting\x20schedule...','\x20schedules','retry_limit','cron','Creating\x20schedule:\x20','d\x20ago','json','in\x20','Show\x20schedule\x20execution\x20history','List\x20scheduled\x20queries','join','\x20job','yes','📅\x20','Failed\x20to\x20read\x20file:\x20','getTime','Schedule\x20created:\x20','args','file','padEnd','never','verbose','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','ies','Show\x20schedule\x20details','schedule:list','show','trim','data','jobs','listQueries','result','Schedule\x20deleted:\x20','run','priority','\x20\x20→\x20','engineVersion','No\x20scheduled\x20queries\x20found','green','lastRun','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','updated_at','\x20scheduled\x20quer','retryLimit','298VzbEdh','start_at','num','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','abs','limit','description','Delete\x20a\x20scheduled\x20query','update','dim','scheduled_at','executing_user_id','INVALID_ARGUMENT','h\x20ago','timezone','Updating\x20schedule:\x20','schedule:show','engine_version','schedule:create','log','schedules','name','\x20matching\x20\x22','\x20created','3753035eHPIuk','Running\x20schedule:\x20','\x20\x20Timezone:\x20','Query\x20file\x20is\x20empty','\x20\x20Job\x20ID:\x20','Showing\x20first\x20','pagination','8273HGlQhS','190TgNURf','just\x20now','schedule:run','Updating\x20schedule...','Getting\x20schedule\x20history...','14643882hiUFQM','format','map','\x20\x20Type:\x20','261jJGDtV','database','\x20\x20Num:\x20','site','entries','utf-8','Searching\x20scheduled\x20queries\x20matching\x20\x22','validate','3606yFdyFr','\x20execution','round','success','250695vTMzPn','tsv','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','from','execute','user','64004OsMVuJ','21833SKpZjx','\x20\x20Time:\x20','max','cyan','status','schedule:update','next_run_at','\x20\x20Cron:\x20','Listing\x20scheduled\x20queries...','query','Found\x20','last_job','list','nextRun','schedule:history','Schedule\x20updated:\x20','job_id','delay','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','Run\x20a\x20scheduled\x20query\x20immediately','error','trino','created_at','queryUrl','output','delete','substring','\x20(use\x20--limit\x20to\x20see\x20more)'];a36_0x1b09=function(){return _0x25137a;};return a36_0x1b09();}export class ScheduleCreateCommand extends BaseCommand{['name']=a36_0x45a24d(0xec);['description']='Create\x20a\x20scheduled\x20query';[a36_0x45a24d(0x10a)](_0x481f06){const _0x4155c1=a36_0x45a24d,_0x78135b=_0x481f06['args'][0x0];if(!_0x78135b)return _0x4155c1(0x111);const _0x58ec0a=_0x481f06[_0x4155c1(0xa9)];if(!_0x58ec0a[_0x4155c1(0x104)])return _0x4155c1(0xc4);return undefined;}async[a36_0x45a24d(0x113)](_0x3ff241){const _0x2d7ab7=a36_0x45a24d,{options:_0x11957f,args:_0x2d6e3f,tdx:_0x8e696f}=_0x3ff241,_0x537c04=_0x2d6e3f[0x0],_0x2e49ed=_0x11957f,_0x3e49ee=_0x2e49ed['database'],_0x214a18=_0x2e49ed['file'],_0x3cd271=_0x2e49ed[_0x2d7ab7(0xa0)]||_0x2d7ab7(0x99);let _0x24bb57;try{_0x24bb57=readFileSync(_0x214a18,_0x2d7ab7(0x108))[_0x2d7ab7(0xc9)]();}catch(_0x5be9b9){throw new SDKError(ErrorCode[_0x2d7ab7(0xe6)],_0x2d7ab7(0xbc)+_0x214a18,_0x5be9b9 instanceof Error?_0x5be9b9:undefined);}if(!_0x24bb57)throw new SDKError(ErrorCode[_0x2d7ab7(0xe6)],_0x2d7ab7(0xf5));const _0x231a18={'database':_0x3e49ee,'query':_0x24bb57,'type':_0x3cd271};if(_0x2e49ed[_0x2d7ab7(0xb1)])_0x231a18[_0x2d7ab7(0xb1)]=_0x2e49ed[_0x2d7ab7(0xb1)];if(_0x2e49ed[_0x2d7ab7(0xe8)])_0x231a18['timezone']=_0x2e49ed[_0x2d7ab7(0xe8)];if(_0x2e49ed[_0x2d7ab7(0x95)]!==undefined)_0x231a18[_0x2d7ab7(0x95)]=Number(_0x2e49ed['delay']);if(_0x2e49ed[_0x2d7ab7(0xd0)]!==undefined)_0x231a18['priority']=Number(_0x2e49ed['priority']);if(_0x2e49ed[_0x2d7ab7(0xd9)]!==undefined)_0x231a18['retry_limit']=Number(_0x2e49ed['retryLimit']);if(_0x2e49ed[_0x2d7ab7(0xd2)])_0x231a18[_0x2d7ab7(0xeb)]=_0x2e49ed[_0x2d7ab7(0xd2)];if(_0x2e49ed[_0x2d7ab7(0xcd)])_0x231a18[_0x2d7ab7(0xcd)]=_0x2e49ed[_0x2d7ab7(0xcd)];if(_0x11957f[_0x2d7ab7(0xc3)]){console[_0x2d7ab7(0x98)](_0x2d7ab7(0xb2)+_0x537c04),console[_0x2d7ab7(0x98)]('\x20\x20Database:\x20'+_0x3e49ee),console['error'](_0x2d7ab7(0x102)+_0x3cd271);if(_0x231a18[_0x2d7ab7(0xb1)])console[_0x2d7ab7(0x98)](_0x2d7ab7(0x8b)+_0x231a18[_0x2d7ab7(0xb1)]);if(_0x231a18[_0x2d7ab7(0xe8)])console[_0x2d7ab7(0x98)](_0x2d7ab7(0xf4)+_0x231a18[_0x2d7ab7(0xe8)]);}const _0x5069a4=await withSpinner('Creating\x20schedule...',()=>_0x8e696f[_0x2d7ab7(0xee)]['create'](_0x537c04,_0x231a18),{'verbose':_0x11957f[_0x2d7ab7(0xc3)]});return console['error'](_0x2d7ab7(0xbe)+_0x5069a4[_0x2d7ab7(0xca)][_0x2d7ab7(0xef)]),await handleSingleObjectOutput(_0x5069a4[_0x2d7ab7(0xca)],_0x11957f),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{['name']=a36_0x45a24d(0x89);[a36_0x45a24d(0xe0)]='Update\x20a\x20scheduled\x20query';[a36_0x45a24d(0x10a)](_0x170bdd){const _0xdd9565=a36_0x45a24d,_0x1f00f2=_0x170bdd[_0xdd9565(0xbf)][0x0];if(!_0x1f00f2)return _0xdd9565(0xa5);return undefined;}async[a36_0x45a24d(0x113)](_0x5200cc){const _0x55343f=a36_0x45a24d,{options:_0x34cca9,args:_0x1cdc2f,tdx:_0x5c8b42}=_0x5200cc,_0x360c59=_0x1cdc2f[0x0],_0x803f93=_0x34cca9,_0xc6f700={};if(_0x803f93[_0x55343f(0x104)])_0xc6f700[_0x55343f(0x104)]=_0x803f93[_0x55343f(0x104)];if(_0x803f93[_0x55343f(0xa0)])_0xc6f700['type']=_0x803f93[_0x55343f(0xa0)];if(_0x803f93[_0x55343f(0xb1)])_0xc6f700[_0x55343f(0xb1)]=_0x803f93['cron'];if(_0x803f93['timezone'])_0xc6f700[_0x55343f(0xe8)]=_0x803f93[_0x55343f(0xe8)];if(_0x803f93[_0x55343f(0x95)]!==undefined)_0xc6f700['delay']=Number(_0x803f93[_0x55343f(0x95)]);if(_0x803f93[_0x55343f(0xd0)]!==undefined)_0xc6f700[_0x55343f(0xd0)]=Number(_0x803f93[_0x55343f(0xd0)]);if(_0x803f93['retryLimit']!==undefined)_0xc6f700[_0x55343f(0xb0)]=Number(_0x803f93[_0x55343f(0xd9)]);if(_0x803f93[_0x55343f(0xd2)])_0xc6f700[_0x55343f(0xeb)]=_0x803f93[_0x55343f(0xd2)];if(_0x803f93[_0x55343f(0xcd)])_0xc6f700[_0x55343f(0xcd)]=_0x803f93[_0x55343f(0xcd)];if(_0x803f93[_0x55343f(0xc0)])try{_0xc6f700[_0x55343f(0x8d)]=readFileSync(_0x803f93[_0x55343f(0xc0)],'utf-8')[_0x55343f(0xc9)]();}catch(_0x33aed5){throw new SDKError(ErrorCode[_0x55343f(0xe6)],_0x55343f(0xbc)+_0x803f93[_0x55343f(0xc0)],_0x33aed5 instanceof Error?_0x33aed5:undefined);}if(Object['keys'](_0xc6f700)['length']===0x0)throw new SDKError(ErrorCode[_0x55343f(0xe6)],_0x55343f(0xa1));if(_0x34cca9[_0x55343f(0xc3)]){console[_0x55343f(0x98)](_0x55343f(0xe9)+_0x360c59);for(const [_0x479b05,_0x3c59a7]of Object[_0x55343f(0x107)](_0xc6f700)){_0x479b05===_0x55343f(0x8d)?console[_0x55343f(0x98)]('\x20\x20'+_0x479b05+':\x20'+_0x3c59a7[_0x55343f(0x9e)](0x0,0x32)+_0x55343f(0xac)):console[_0x55343f(0x98)]('\x20\x20'+_0x479b05+':\x20'+_0x3c59a7);}}const _0x2fe97a=await withSpinner(_0x55343f(0xfd),()=>_0x5c8b42[_0x55343f(0xee)][_0x55343f(0xe2)](_0x360c59,_0xc6f700),{'verbose':_0x34cca9['verbose']});return console[_0x55343f(0x98)](_0x55343f(0x93)+_0x2fe97a['data']['name']),await handleSingleObjectOutput(_0x2fe97a[_0x55343f(0xca)],_0x34cca9),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x45a24d(0xef)]='schedule:delete';[a36_0x45a24d(0xe0)]=a36_0x45a24d(0xe1);[a36_0x45a24d(0x10a)](_0xa700b4){const _0x31b8b9=a36_0x45a24d,_0x46a1eb=_0xa700b4[_0x31b8b9(0xbf)][0x0];if(!_0x46a1eb)return _0x31b8b9(0xa8);return undefined;}async[a36_0x45a24d(0x113)](_0x432a11){const _0x37ddc6=a36_0x45a24d,{options:_0x30cbd5,args:_0x2a7a61,tdx:_0x3260ad}=_0x432a11,_0x410461=_0x2a7a61[0x0];if(!_0x30cbd5[_0x37ddc6(0xba)]){const _0x506417=await confirm(_0x37ddc6(0xdd)+_0x410461+'\x22?');if(!_0x506417)return console[_0x37ddc6(0x98)]('Cancelled'),0x0;}const _0x5a1d03=await withSpinner(_0x37ddc6(0xae),()=>_0x3260ad['schedules'][_0x37ddc6(0x9d)](_0x410461),{'verbose':_0x30cbd5[_0x37ddc6(0xc3)]});return console[_0x37ddc6(0x98)](_0x37ddc6(0xce)+_0x5a1d03[_0x37ddc6(0xca)][_0x37ddc6(0xef)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x45a24d(0xef)]=a36_0x45a24d(0xfc);['description']=a36_0x45a24d(0x97);[a36_0x45a24d(0x10a)](_0x43b870){const _0x1292c8=a36_0x45a24d,_0x147a88=_0x43b870[_0x1292c8(0xbf)][0x0];if(!_0x147a88)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async[a36_0x45a24d(0x113)](_0x32e139){const _0x56188a=a36_0x45a24d,{options:_0x3bb0bd,args:_0x25159c,tdx:_0xa888ab}=_0x32e139,_0x3fd271=_0x25159c[0x0],_0x2b0c90=_0x3bb0bd,_0x2f88b1=_0x2b0c90[_0x56188a(0xa4)],_0x53bec2=_0x2b0c90[_0x56188a(0xdc)]!==undefined?Number(_0x2b0c90['num']):undefined;if(_0x3bb0bd[_0x56188a(0xc3)]){console[_0x56188a(0x98)](_0x56188a(0xf3)+_0x3fd271);if(_0x2f88b1)console['error'](_0x56188a(0x85)+_0x2f88b1);if(_0x53bec2)console['error'](_0x56188a(0x105)+_0x53bec2);}const _0x2defd7=await withSpinner('Running\x20schedule...',()=>_0xa888ab[_0x56188a(0xee)][_0x56188a(0xcf)](_0x3fd271,{'time':_0x2f88b1,'num':_0x53bec2}),{'verbose':_0x3bb0bd['verbose']}),_0x493aa7=_0x2defd7[_0x56188a(0xca)][_0x56188a(0xcb)];console[_0x56188a(0x98)](_0x56188a(0xaa)+_0x493aa7['length']+_0x56188a(0xb9)+(_0x493aa7[_0x56188a(0xa3)]!==0x1?'s':'')+_0x56188a(0xf1));for(const _0x2cb6c7 of _0x493aa7){console['error'](_0x56188a(0xf6)+_0x2cb6c7[_0x56188a(0x94)]);}return await handleSDKOutput(_0x493aa7,_0x3bb0bd),0x0;}}function a36_0x14ee(_0x30eadb,_0x36406e){_0x30eadb=_0x30eadb-0x84;const _0x1b0916=a36_0x1b09();let _0x14ee4c=_0x1b0916[_0x30eadb];return _0x14ee4c;}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x45a24d(0xef)]=a36_0x45a24d(0x92);[a36_0x45a24d(0xe0)]=a36_0x45a24d(0xb6);['validate'](_0x1d3624){const _0x1b558b=a36_0x45a24d,_0x17979e=_0x1d3624[_0x1b558b(0xbf)][0x0];if(!_0x17979e)return _0x1b558b(0xd6);return undefined;}async[a36_0x45a24d(0x113)](_0x3e3220){const _0x163178=a36_0x45a24d,{options:_0x5aa5ec,args:_0x468e36,tdx:_0x545923}=_0x3e3220,_0x3cbebc=_0x468e36[0x0],_0x5eb9bf=_0x5aa5ec,_0x16453b=_0x5eb9bf[_0x163178(0x112)]!==undefined?Number(_0x5eb9bf[_0x163178(0x112)]):undefined,_0x30f579=_0x5eb9bf['to']!==undefined?Number(_0x5eb9bf['to']):undefined,_0x2e421c=await withSpinner(_0x163178(0xfe),()=>_0x545923[_0x163178(0xee)]['history'](_0x3cbebc,{'from':_0x16453b,'to':_0x30f579}),{'verbose':_0x5aa5ec[_0x163178(0xc3)]}),_0x3d842b=_0x2e421c[_0x163178(0xca)];console[_0x163178(0x98)](_0x163178(0x8e)+_0x3d842b['count']+_0x163178(0x10c)+(_0x3d842b['count']!==0x1?'s':'')+'\x20(showing\x20'+_0x3d842b[_0x163178(0x112)]+'-'+_0x3d842b['to']+')');const _0x2a8a5d=_0x3d842b[_0x163178(0xa7)][_0x163178(0x101)](_0x3dcdf4=>({'job_id':_0x3dcdf4[_0x163178(0x94)],'type':_0x3dcdf4['type'],'status':_0x3dcdf4[_0x163178(0x88)],'scheduled_at':_0x3dcdf4[_0x163178(0xe4)],'created_at':_0x3dcdf4[_0x163178(0x9a)],'start_at':_0x3dcdf4[_0x163178(0xdb)],'end_at':_0x3dcdf4['end_at']}));return await handleSDKOutput(_0x2a8a5d,_0x5aa5ec),0x0;}}
@@ -1 +1 @@
1
- const a37_0x33916a=a37_0xbbba;(function(_0x365d50,_0x402b07){const _0x3a153e=a37_0xbbba,_0x18028c=_0x365d50();while(!![]){try{const _0x29006f=parseInt(_0x3a153e(0x186))/0x1+-parseInt(_0x3a153e(0x1f5))/0x2*(parseInt(_0x3a153e(0x1f6))/0x3)+-parseInt(_0x3a153e(0x1c8))/0x4+parseInt(_0x3a153e(0x1fb))/0x5+parseInt(_0x3a153e(0x1ac))/0x6*(-parseInt(_0x3a153e(0x179))/0x7)+-parseInt(_0x3a153e(0x200))/0x8*(parseInt(_0x3a153e(0x16c))/0x9)+-parseInt(_0x3a153e(0x190))/0xa*(-parseInt(_0x3a153e(0x1fd))/0xb);if(_0x29006f===_0x402b07)break;else _0x18028c['push'](_0x18028c['shift']());}catch(_0x579ebf){_0x18028c['push'](_0x18028c['shift']());}}}(a37_0x2887,0x2b04e));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';function a37_0x2887(){const _0x38d28a=['Usage:\x20tdx\x20sg\x20show\x20<name>','27JBrvcM','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Parent\x20ID:\x20','Fetching\x20folder\x20details...','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Resolved\x20relative\x20path\x20to:\x20','test','fullPath','\x20rows\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','segmentName','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','\x20\x20Parent\x20segment:\x20','7AeCthO','Resolving\x20folder\x20\x27','Folder\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','✔\x20Query\x20completed:\x20Processed\x20','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Error:\x20','Show\x20segment\x20folder\x20details','Examples:','resolvePathToResource','Usage:\x20tdx\x20sg\x20desc\x20<name>','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','/e/','172422Tfbqhn','type','Error:\x20Path\x20or\x20name\x20is\x20required','parentFolder','cyan','INVALID_ARGUMENT','segment:folder:show','getSegmentSQL','trim','getSegmentSQLFromYaml','10eGvtGB','resolveParentId','Usage:\x20tdx\x20segment\x20describe\x20<path>','content','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','folder','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Create\x20segment\x20folder\x20for\x20organization','name','segment:show','folderPath','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','includes','query','Resolved\x20folder\x20ID:\x20','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','site','parent','getSQLFromYamlFile','segment:sql','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','Fetching\x20SQL\x20from\x20rule...','\x27...','Use:\x20tdx\x20ps\x20view\x20-w','1153674xUBMfU','code','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Creating\x20folder\x20\x27','Resolving\x20parent\x20folder\x20\x27','processedRows','verbose','\x20[Job\x20ID:\x20','json','Listing\x20folders\x20for\x20parent\x20\x27','red','\x27\x20with\x20ID:\x20','SEGMENT_FOLDER_NOT_FOUND','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Fetching\x20parent\x20segment\x20details...','createFolder','✔\x20Created\x20folder\x20\x27','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','error','Target\x20path:\x20','Resolved\x20type:\x20','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','segment:folder:create','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Resolved\x20parent\x20folder\x20ID:\x20','format','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','994492EwiMgr','jobId','cause','listFolders','/app/ps/','Segment\x20ID\x20missing\x20from\x20resolved\x20path','✖\x20Query\x20failed\x20[','limit','replace','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','description','Resolving\x20path\x20\x27','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Resolving\x20\x27','segment:desc','segmentId','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Site:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Show\x20segment\x20or\x20folder\x20details','\x20Opening\x20','Parent\x20name:\x20','Show\x20child\x20segment\x20schema\x20(column\x20types)','Get\x20SQL\x20query\x20for\x20child\x20segment','path','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Use:\x20tdx\x20ps\x20desc','Fetching\x20SQL\x20for\x20segment...','Error:\x20Parent\x20segment\x20name\x20is\x20required','Folder\x20name:\x20','Executing\x20segment\x20query...','\x20\x20Full\x20path:\x20','data','folderId','execute','Fetching\x20segment\x20details...','green','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','url','getSegment','message','parentSegment','length','Resolved\x20YAML\x20file:\x20','62bvKjMu','8946IjXyVm','Use:\x20tdx\x20ps\x20view','in\x20','stats','Use:\x20tdx\x20ps\x20show','1501550YpOrzG','Resolved\x20parent\x20ID:\x20','4862627KHyUNR','getSQLFromServerSegment','parentId','547304DMUEvq','segment:folder:list','getFolder','information_schema','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','\x20\x20Cause:\x20','web','Parent\x20segment:\x20','elapsedTimeMillis','setJobId','resolveFolderId','segment','Resolved:\x20','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','SEGMENT_NOT_FOUND','Folder\x20ID:\x20','Segment\x20ID:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Resolving\x20parent\x20segment\x20\x27'];a37_0x2887=function(){return _0x38d28a;};return a37_0x2887();}import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';function a37_0xbbba(_0x1a923f,_0x2c061c){_0x1a923f=_0x1a923f-0x166;const _0x288719=a37_0x2887();let _0xbbba3d=_0x288719[_0x1a923f];return _0xbbba3d;}import{openBrowser}from'../utils/process.js';import a37_0x318299 from'chalk';async function resolveSegmentTarget(_0x4df62f,_0x2f8b0b,_0x2f760c){const _0x2fcdec=a37_0xbbba;if(isYamlFilePath(_0x4df62f))try{const _0x595e36=await resolveYamlFilePath(_0x4df62f);return _0x2f760c&&(console[_0x2fcdec(0x1be)](_0x2fcdec(0x1f4)+_0x4df62f),console['error'](_0x2fcdec(0x178)+_0x595e36['parentSegment']),console[_0x2fcdec(0x1be)]('\x20\x20Segment\x20name:\x20'+_0x595e36['segmentName']),console[_0x2fcdec(0x1be)]('\x20\x20Folder\x20path:\x20'+(_0x595e36[_0x2fcdec(0x19b)]||'(root)')),console[_0x2fcdec(0x1be)](_0x2fcdec(0x1e8)+_0x595e36['fullPath'])),_0x595e36[_0x2fcdec(0x173)];}catch(_0x42b7c7){throw new SDKError(ErrorCode[_0x2fcdec(0x18b)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x42b7c7[_0x2fcdec(0x1f1)]);}if(!_0x2f8b0b)throw new SDKError(ErrorCode[_0x2fcdec(0x18b)],_0x2fcdec(0x1a7));return _0x2f8b0b+'/'+_0x4df62f;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x33916a(0x199)]='segment:describe';['description']=a37_0x33916a(0x1dc);async[a37_0x33916a(0x1eb)](_0x417fcc){const _0x21ca77=a37_0x33916a,{options:_0x1ad2f6,args:_0x2183ae,tdx:_0x1e9f9f}=_0x417fcc,_0x270c97=_0x2183ae[0x0],_0x4cf7b4=!_0x270c97&&!!_0x1ad2f6[_0x21ca77(0x1f2)],_0x1ce348=_0x270c97||_0x1ad2f6[_0x21ca77(0x1f2)];if(!_0x1ce348)return console[_0x21ca77(0x1be)](_0x21ca77(0x188)),console[_0x21ca77(0x1be)](_0x21ca77(0x192)),console[_0x21ca77(0x1be)](_0x21ca77(0x181)),console[_0x21ca77(0x1be)](_0x21ca77(0x1db)),console['error'](_0x21ca77(0x169)),console[_0x21ca77(0x1be)](_0x21ca77(0x1da)),console[_0x21ca77(0x1be)](_0x21ca77(0x1bd)),0x1;try{const _0x5b14b0=_0x1ad2f6['segmentPath'];let _0x16aec3=_0x1ce348;!_0x4cf7b4&&_0x5b14b0&&!_0x1ce348[_0x21ca77(0x19d)]('/')&&(_0x16aec3=_0x5b14b0+'/'+_0x1ce348,_0x1ad2f6['verbose']&&console[_0x21ca77(0x1be)](_0x21ca77(0x171)+_0x16aec3));const _0x28d555=await withSpinner(_0x21ca77(0x1d3)+_0x16aec3+_0x21ca77(0x1aa),()=>_0x1e9f9f[_0x21ca77(0x20b)][_0x21ca77(0x182)](_0x16aec3),{'verbose':_0x1ad2f6[_0x21ca77(0x1b2)]}),_0x4150ee=_0x28d555[_0x21ca77(0x1e9)];_0x1ad2f6[_0x21ca77(0x1b2)]&&(console[_0x21ca77(0x1be)]('Resolved\x20type:\x20'+_0x4150ee[_0x21ca77(0x187)]),console[_0x21ca77(0x1be)](_0x21ca77(0x16e)+_0x4150ee['parentId']),_0x4150ee['folderId']&&console[_0x21ca77(0x1be)](_0x21ca77(0x167)+_0x4150ee['folderId']),_0x4150ee['segmentId']&&console[_0x21ca77(0x1be)](_0x21ca77(0x168)+_0x4150ee[_0x21ca77(0x1d7)]));if(_0x4150ee[_0x21ca77(0x187)]===_0x21ca77(0x1a4)){const _0x3bdef6=await withSpinner(_0x21ca77(0x1ba),()=>_0x1e9f9f[_0x21ca77(0x20b)]['getParent'](_0x4150ee[_0x21ca77(0x1ff)]),{'verbose':_0x1ad2f6[_0x21ca77(0x1b2)]});await handleSingleObjectOutput(_0x3bdef6[_0x21ca77(0x1e9)],_0x1ad2f6);}else{if(_0x4150ee['type']===_0x21ca77(0x196)){if(!_0x4150ee[_0x21ca77(0x1ea)])throw new SDKError(ErrorCode[_0x21ca77(0x1b8)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0xf383ae=await withSpinner(_0x21ca77(0x16f),()=>_0x1e9f9f[_0x21ca77(0x20b)][_0x21ca77(0x202)](_0x4150ee[_0x21ca77(0x1ea)]),{'verbose':_0x1ad2f6[_0x21ca77(0x1b2)]});await handleSingleObjectOutput(_0xf383ae[_0x21ca77(0x1e9)],_0x1ad2f6);}else{if(_0x4150ee[_0x21ca77(0x187)]===_0x21ca77(0x20b)){if(!_0x4150ee[_0x21ca77(0x1d7)])throw new SDKError(ErrorCode[_0x21ca77(0x166)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0xa59921=await withSpinner(_0x21ca77(0x1ec),()=>_0x1e9f9f[_0x21ca77(0x20b)][_0x21ca77(0x1f0)](_0x4150ee[_0x21ca77(0x1ff)],_0x4150ee['segmentId']),{'verbose':_0x1ad2f6[_0x21ca77(0x1b2)]});await handleSingleObjectOutput(_0xa59921['data'],_0x1ad2f6);}}}return 0x0;}catch(_0x43161c){if(_0x43161c instanceof SDKError)return console[_0x21ca77(0x1be)](_0x21ca77(0x17f)+_0x43161c[_0x21ca77(0x1f1)]),_0x43161c['cause']&&console[_0x21ca77(0x1be)](_0x21ca77(0x205)+_0x43161c[_0x21ca77(0x1ca)]),0x1;throw _0x43161c;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x33916a(0x199)]=a37_0x33916a(0x19a);[a37_0x33916a(0x1d2)]=a37_0x33916a(0x1ae);async[a37_0x33916a(0x1eb)](_0x4e18f3){const _0x3ab49e=a37_0x33916a,{options:_0x1f56ec,args:_0x552f0f,tdx:_0x34a254}=_0x4e18f3,_0x402740=_0x552f0f[0x0];if(!_0x402740)return console[_0x3ab49e(0x1be)](_0x3ab49e(0x175)),console[_0x3ab49e(0x1be)](_0x3ab49e(0x16b)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x3ab49e(0x1be)](_0x3ab49e(0x181)),console[_0x3ab49e(0x1be)](_0x3ab49e(0x20d)),console[_0x3ab49e(0x1be)](_0x3ab49e(0x1d4)),0x1;try{const _0x29fc31=_0x1f56ec[_0x3ab49e(0x1f2)],_0x2f42cf=await resolveSegmentTarget(_0x402740,_0x29fc31,_0x1f56ec[_0x3ab49e(0x1b2)]);_0x1f56ec[_0x3ab49e(0x1b2)]&&console[_0x3ab49e(0x1be)](_0x3ab49e(0x1bf)+_0x2f42cf);const _0x2a500e=await withSpinner(_0x3ab49e(0x1d5)+_0x402740+_0x3ab49e(0x1aa),()=>_0x34a254[_0x3ab49e(0x20b)][_0x3ab49e(0x182)](_0x2f42cf),{'verbose':_0x1f56ec[_0x3ab49e(0x1b2)]}),_0x5bb6e0=_0x2a500e['data'];_0x1f56ec[_0x3ab49e(0x1b2)]&&(console[_0x3ab49e(0x1be)](_0x3ab49e(0x1c0)+_0x5bb6e0[_0x3ab49e(0x187)]),console[_0x3ab49e(0x1be)](_0x3ab49e(0x16e)+_0x5bb6e0[_0x3ab49e(0x1ff)]));if(_0x5bb6e0[_0x3ab49e(0x187)]===_0x3ab49e(0x196))return console['error'](_0x3ab49e(0x1c1)),console[_0x3ab49e(0x1be)](_0x3ab49e(0x1a1)),0x1;if(_0x5bb6e0[_0x3ab49e(0x187)]==='parent')return console[_0x3ab49e(0x1be)](_0x3ab49e(0x195)),console[_0x3ab49e(0x1be)](_0x3ab49e(0x1fa)),0x1;if(!_0x5bb6e0['segmentId'])throw new SDKError(ErrorCode[_0x3ab49e(0x166)],_0x3ab49e(0x1cd));const _0x24708c=await withSpinner(_0x3ab49e(0x1e4),()=>_0x34a254['segment'][_0x3ab49e(0x18d)](_0x5bb6e0[_0x3ab49e(0x1ff)],_0x5bb6e0[_0x3ab49e(0x1d7)]),{'verbose':_0x1f56ec[_0x3ab49e(0x1b2)]});let _0x42de6f=_0x24708c[_0x3ab49e(0x1e9)];const _0x36e744=resolveLimit(_0x1f56ec[_0x3ab49e(0x1cf)],DEFAULT_DISPLAY_LIMIT),_0x5bce5f=/\bLIMIT\s+\d+/i[_0x3ab49e(0x172)](_0x42de6f);!_0x5bce5f&&(_0x42de6f=_0x42de6f[_0x3ab49e(0x18e)]()[_0x3ab49e(0x1d0)](/;+$/,''),_0x42de6f='SELECT\x20*\x20FROM\x20(\x0a'+_0x42de6f+_0x3ab49e(0x1a2)+_0x36e744);_0x1f56ec[_0x3ab49e(0x1b2)]&&console[_0x3ab49e(0x1be)]('SQL\x20query:\x0a'+_0x42de6f);const _0x2af2b3=await withProgressSpinner(_0x3ab49e(0x1e7),async _0x25094d=>{const _0x524497=_0x3ab49e,_0x2d541e=await _0x34a254[_0x524497(0x19e)][_0x524497(0x1eb)](_0x42de6f,{'catalog':'td','schema':_0x524497(0x203),'onJobId':_0x26d193=>{const _0x56bc07=_0x524497;_0x25094d[_0x56bc07(0x209)](_0x26d193);}});return _0x2d541e;},{'verbose':_0x1f56ec['verbose']}),_0xbbf29c=_0x2af2b3[_0x3ab49e(0x1e9)],_0x273f0e=_0xbbf29c[_0x3ab49e(0x1c9)]?_0x3ab49e(0x1b3)+_0xbbf29c[_0x3ab49e(0x1c9)]+']':'';return console[_0x3ab49e(0x1be)](_0x3ab49e(0x17d)+_0xbbf29c['stats'][_0x3ab49e(0x1b1)]['toLocaleString']()+_0x3ab49e(0x174)+(_0x3ab49e(0x1f8)+formatElapsed(_0xbbf29c[_0x3ab49e(0x1f9)][_0x3ab49e(0x208)])+_0x273f0e)),await handleQueryOutput(_0xbbf29c,_0x1f56ec),0x0;}catch(_0x290f4a){if(_0x290f4a instanceof SDKError)return console[_0x3ab49e(0x1be)](_0x3ab49e(0x1ce)+_0x290f4a[_0x3ab49e(0x1ad)]+']'),console[_0x3ab49e(0x1be)]('\x0a'+_0x290f4a[_0x3ab49e(0x1f1)]),0x1;throw _0x290f4a;}}}export class SegmentFolderListCommand extends BaseCommand{['name']=a37_0x33916a(0x201);[a37_0x33916a(0x1d2)]=a37_0x33916a(0x1b9);async[a37_0x33916a(0x1eb)](_0x406cb){const _0x1a46c3=a37_0x33916a,{options:_0x4b7156,args:_0x170ff9,tdx:_0x4cc830}=_0x406cb;if(_0x170ff9[_0x1a46c3(0x1f3)]===0x0)return console[_0x1a46c3(0x1be)](_0x1a46c3(0x1e5)),console[_0x1a46c3(0x1be)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x51f793=_0x170ff9[0x0];try{_0x4b7156[_0x1a46c3(0x1b2)]&&(console[_0x1a46c3(0x1be)](_0x1a46c3(0x1d9)+_0x4b7156[_0x1a46c3(0x1a3)]),console[_0x1a46c3(0x1be)](_0x1a46c3(0x1de)+_0x51f793));const _0x1ed368=await withSpinner(_0x1a46c3(0x16a)+_0x51f793+_0x1a46c3(0x1aa),()=>_0x4cc830[_0x1a46c3(0x20b)][_0x1a46c3(0x191)](_0x51f793),{'verbose':_0x4b7156['verbose']}),_0x58a976=_0x1ed368['data'];_0x4b7156[_0x1a46c3(0x1b2)]&&console[_0x1a46c3(0x1be)]('Resolved\x20parent\x20ID:\x20'+_0x58a976);const _0x11f72e=await withSpinner(_0x1a46c3(0x1b5)+_0x51f793+_0x1a46c3(0x1aa),()=>_0x4cc830[_0x1a46c3(0x20b)][_0x1a46c3(0x1cb)](_0x58a976),{'verbose':_0x4b7156[_0x1a46c3(0x1b2)]}),_0x3b0cdf=_0x11f72e[_0x1a46c3(0x1e9)];return console[_0x1a46c3(0x1be)]('✔\x20Found\x20'+_0x3b0cdf[_0x1a46c3(0x1f3)]+'\x20folder'+(_0x3b0cdf['length']!==0x1?'s':'')),await handleSDKOutput(_0x3b0cdf,_0x4b7156),0x0;}catch(_0x3170d2){if(_0x3170d2 instanceof SDKError)return console[_0x1a46c3(0x1be)]('Error:\x20'+_0x3170d2[_0x1a46c3(0x1f1)]),_0x3170d2[_0x1a46c3(0x1ca)]&&console[_0x1a46c3(0x1be)](_0x1a46c3(0x205)+_0x3170d2[_0x1a46c3(0x1ca)]),0x1;throw _0x3170d2;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x33916a(0x199)]=a37_0x33916a(0x18c);['description']=a37_0x33916a(0x180);async[a37_0x33916a(0x1eb)](_0x273702){const _0x110193=a37_0x33916a,{options:_0xfa6eda,args:_0x3b71ac,tdx:_0x38988c}=_0x273702;if(_0x3b71ac[_0x110193(0x1f3)]===0x0)return console[_0x110193(0x1be)]('Error:\x20Folder\x20reference\x20is\x20required'),console[_0x110193(0x1be)](_0x110193(0x1a0)),0x1;try{const {parentId:_0x4a8a46,childId:_0x9391ba}=parseSegmentRef(_0x3b71ac[0x0]);_0xfa6eda[_0x110193(0x1b2)]&&(console[_0x110193(0x1be)](_0x110193(0x1d9)+_0xfa6eda[_0x110193(0x1a3)]),console['error'](_0x110193(0x1de)+_0x4a8a46),_0x9391ba&&console[_0x110193(0x1be)](_0x110193(0x1e6)+_0x9391ba));if(!_0x9391ba)return console['error'](_0x110193(0x1e2)),0x1;const _0x2521a9=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x4a8a46+_0x110193(0x1aa),()=>_0x38988c['segment'][_0x110193(0x191)](_0x4a8a46),{'verbose':_0xfa6eda[_0x110193(0x1b2)]}),_0x26712f=_0x2521a9[_0x110193(0x1e9)];_0xfa6eda[_0x110193(0x1b2)]&&console[_0x110193(0x1be)](_0x110193(0x1fc)+_0x26712f);const _0x127cf4=await withSpinner(_0x110193(0x17a)+_0x9391ba+_0x110193(0x1aa),()=>_0x38988c[_0x110193(0x20b)][_0x110193(0x20a)](_0x26712f,_0x9391ba),{'verbose':_0xfa6eda[_0x110193(0x1b2)]}),_0x3659da=_0x127cf4['data'];_0xfa6eda[_0x110193(0x1b2)]&&console[_0x110193(0x1be)](_0x110193(0x19f)+_0x3659da);const _0x4d73de=await withSpinner('Fetching\x20folder\x20\x27'+_0x9391ba+_0x110193(0x1aa),()=>_0x38988c[_0x110193(0x20b)][_0x110193(0x202)](_0x3659da),{'verbose':_0xfa6eda[_0x110193(0x1b2)]});return await handleSDKOutput([_0x4d73de[_0x110193(0x1e9)]],_0xfa6eda),0x0;}catch(_0x1a30f7){if(_0x1a30f7 instanceof SDKError)return console[_0x110193(0x1be)]('Error:\x20'+_0x1a30f7[_0x110193(0x1f1)]),_0x1a30f7[_0x110193(0x1ca)]&&console[_0x110193(0x1be)](_0x110193(0x205)+_0x1a30f7[_0x110193(0x1ca)]),0x1;throw _0x1a30f7;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x33916a(0x199)]=a37_0x33916a(0x1a6);[a37_0x33916a(0x1d2)]=a37_0x33916a(0x1e0);async[a37_0x33916a(0x1eb)](_0x2339da){const _0x2c6500=a37_0x33916a,{options:_0x67afbe,args:_0x336c01}=_0x2339da,_0x9de2e6=_0x67afbe,_0x1f9221=_0x9de2e6[_0x2c6500(0x1e1)],_0x2a6e53=_0x336c01[0x0];if(!_0x2a6e53&&!_0x1f9221)return console['error'](a37_0x318299[_0x2c6500(0x1b6)](_0x2c6500(0x204))),console[_0x2c6500(0x1be)]('Usage:'),console['error'](_0x2c6500(0x1a8)),console[_0x2c6500(0x1be)]('\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>'),console[_0x2c6500(0x1be)]('Examples:'),console['error'](_0x2c6500(0x177)),console[_0x2c6500(0x1be)](_0x2c6500(0x17c)),0x1;if(_0x2a6e53&&_0x1f9221)return console[_0x2c6500(0x1be)](a37_0x318299['red']('Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both')),0x1;try{let _0x185b4b;if(_0x1f9221)_0x185b4b=await this[_0x2c6500(0x1a5)](_0x1f9221,_0x2339da);else{if(isYamlFilePath(_0x2a6e53))return console[_0x2c6500(0x1be)](a37_0x318299[_0x2c6500(0x1b6)]('Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option')),console[_0x2c6500(0x1be)](_0x2c6500(0x1c3)+_0x2a6e53),0x1;else _0x185b4b=await this[_0x2c6500(0x1fe)](_0x2a6e53,_0x2339da);}return _0x67afbe[_0x2c6500(0x1c5)]===_0x2c6500(0x1b4)||_0x67afbe[_0x2c6500(0x1c5)]==='jsonl'?await handleSDKOutput([{'sql':_0x185b4b}],_0x67afbe):console['log'](_0x185b4b),0x0;}catch(_0x17cc6d){if(_0x17cc6d instanceof SDKError)return console['error'](_0x2c6500(0x17f)+_0x17cc6d[_0x2c6500(0x1f1)]),_0x17cc6d[_0x2c6500(0x1ca)]&&console[_0x2c6500(0x1be)]('\x20\x20Cause:\x20'+_0x17cc6d[_0x2c6500(0x1ca)]),0x1;throw _0x17cc6d;}}async[a37_0x33916a(0x1a5)](_0x352c53,_0x5b8c48){const _0x38155e=a37_0x33916a,{options:_0x1f3f54,tdx:_0x187e97}=_0x5b8c48;let _0x333b0d;try{_0x333b0d=await resolveYamlFilePath(_0x352c53);}catch(_0x2e7450){throw new SDKError(ErrorCode[_0x38155e(0x18b)],_0x38155e(0x194)+_0x2e7450[_0x38155e(0x1f1)]);}_0x1f3f54[_0x38155e(0x1b2)]&&console['error'](_0x38155e(0x20c)+_0x333b0d[_0x38155e(0x1f2)]+'/'+_0x333b0d[_0x38155e(0x176)]);const _0x5ff135=await withSpinner(_0x38155e(0x1a9),()=>_0x187e97[_0x38155e(0x20b)][_0x38155e(0x18f)](_0x333b0d[_0x38155e(0x193)],_0x333b0d[_0x38155e(0x1f2)],_0x333b0d[_0x38155e(0x176)]),{'verbose':_0x1f3f54[_0x38155e(0x1b2)]});return _0x5ff135[_0x38155e(0x1e9)];}async[a37_0x33916a(0x1fe)](_0xbc25ec,_0x24bcc6){const _0x23f6ed=a37_0x33916a,{options:_0x3e8896,tdx:_0x72d86d}=_0x24bcc6,_0x485606=_0x3e8896[_0x23f6ed(0x1f2)],_0x1e2bfa=await resolveSegmentTarget(_0xbc25ec,_0x485606,_0x3e8896['verbose']);_0x3e8896[_0x23f6ed(0x1b2)]&&console[_0x23f6ed(0x1be)]('Target\x20path:\x20'+_0x1e2bfa);const _0x19a4c4=await withSpinner('Resolving\x20\x27'+_0xbc25ec+_0x23f6ed(0x1aa),()=>_0x72d86d[_0x23f6ed(0x20b)]['resolvePathToResource'](_0x1e2bfa),{'verbose':_0x3e8896[_0x23f6ed(0x1b2)]}),_0x4b3d8b=_0x19a4c4['data'];_0x3e8896[_0x23f6ed(0x1b2)]&&(console[_0x23f6ed(0x1be)]('Resolved\x20type:\x20'+_0x4b3d8b[_0x23f6ed(0x187)]),console[_0x23f6ed(0x1be)](_0x23f6ed(0x16e)+_0x4b3d8b[_0x23f6ed(0x1ff)]));if(_0x4b3d8b[_0x23f6ed(0x187)]===_0x23f6ed(0x196))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x23f6ed(0x17e));if(_0x4b3d8b[_0x23f6ed(0x187)]===_0x23f6ed(0x1a4))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x23f6ed(0x1ee));if(!_0x4b3d8b[_0x23f6ed(0x1d7)])throw new SDKError(ErrorCode[_0x23f6ed(0x166)],_0x23f6ed(0x1cd));const _0x53f09c=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x72d86d[_0x23f6ed(0x20b)]['getSegmentSQL'](_0x4b3d8b[_0x23f6ed(0x1ff)],_0x4b3d8b[_0x23f6ed(0x1d7)]),{'verbose':_0x3e8896[_0x23f6ed(0x1b2)]});return _0x53f09c['data'];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x33916a(0x199)]=a37_0x33916a(0x1c2);['description']=a37_0x33916a(0x198);async[a37_0x33916a(0x1eb)](_0x3c738c){const _0x10ba18=a37_0x33916a,{options:_0x97ef7f,args:_0x4b12d5,tdx:_0x26ee40}=_0x3c738c,_0x48c1e7=_0x97ef7f;if(_0x4b12d5[_0x10ba18(0x1f3)]<0x2)return console[_0x10ba18(0x1be)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console['error']('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x9b6376=_0x4b12d5[0x0],_0x447803=_0x4b12d5[0x1];_0x48c1e7[_0x10ba18(0x1b2)]&&(console[_0x10ba18(0x1be)](_0x10ba18(0x1d9)+_0x48c1e7[_0x10ba18(0x1a3)]),console['error'](_0x10ba18(0x207)+_0x9b6376),console[_0x10ba18(0x1be)](_0x10ba18(0x1e6)+_0x447803));let _0x532f3b;if(_0x48c1e7[_0x10ba18(0x189)]){const _0x3ac699=_0x48c1e7['parentFolder'],_0x552ccb=await withSpinner(_0x10ba18(0x16a)+_0x9b6376+_0x10ba18(0x1aa),()=>_0x26ee40[_0x10ba18(0x20b)][_0x10ba18(0x191)](_0x9b6376),{'verbose':_0x48c1e7['verbose']}),_0x32ec16=_0x552ccb[_0x10ba18(0x1e9)],_0x2ded2f=await withSpinner(_0x10ba18(0x1b0)+_0x3ac699+_0x10ba18(0x1aa),()=>_0x26ee40['segment']['resolveFolderId'](_0x32ec16,_0x3ac699),{'verbose':_0x48c1e7[_0x10ba18(0x1b2)]});_0x532f3b=_0x2ded2f['data'],_0x48c1e7['verbose']&&console[_0x10ba18(0x1be)](_0x10ba18(0x1c4)+_0x532f3b);}const _0x537258={'name':_0x447803,'description':_0x48c1e7[_0x10ba18(0x1d2)],'parentFolderId':_0x532f3b},_0x504a66=await withSpinner(_0x10ba18(0x1af)+_0x447803+_0x10ba18(0x1aa),()=>_0x26ee40[_0x10ba18(0x20b)][_0x10ba18(0x1bb)](_0x9b6376,_0x537258),{'verbose':_0x48c1e7[_0x10ba18(0x1b2)]}),_0x28137f=_0x504a66['data'];return console[_0x10ba18(0x1be)](_0x10ba18(0x1bc)+_0x28137f[_0x10ba18(0x199)]+_0x10ba18(0x1b7)+_0x28137f['id']),await handleSDKOutput([_0x28137f],_0x48c1e7),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']='segment:view';[a37_0x33916a(0x1d2)]='Show\x20folder\x20or\x20child\x20segment\x20details';async['execute'](_0x37278f){const _0x2a8e2b=a37_0x33916a,{options:_0x41d5d9,args:_0x27ac31,tdx:_0x1e87fe}=_0x37278f,_0x38ea73=_0x27ac31[0x0];if(!_0x38ea73)return console[_0x2a8e2b(0x1be)](_0x2a8e2b(0x19c)),console[_0x2a8e2b(0x1be)](_0x2a8e2b(0x1d8)),console[_0x2a8e2b(0x1be)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console[_0x2a8e2b(0x1be)]('Options:'),console['error'](_0x2a8e2b(0x197)),console[_0x2a8e2b(0x1be)](_0x2a8e2b(0x181)),console[_0x2a8e2b(0x1be)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x2a8e2b(0x1be)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x2a8e2b(0x1be)](_0x2a8e2b(0x184)),console[_0x2a8e2b(0x1be)](_0x2a8e2b(0x170)),0x1;try{const _0x42f94d=_0x41d5d9[_0x2a8e2b(0x1f2)],_0x228469=await resolveSegmentTarget(_0x38ea73,_0x42f94d,_0x41d5d9[_0x2a8e2b(0x1b2)]);_0x41d5d9[_0x2a8e2b(0x1b2)]&&console['error']('Target\x20path:\x20'+_0x228469);const _0x4a1ead=await withSpinner(_0x2a8e2b(0x1d5)+_0x38ea73+'\x27...',()=>_0x1e87fe[_0x2a8e2b(0x20b)][_0x2a8e2b(0x182)](_0x228469),{'verbose':_0x41d5d9[_0x2a8e2b(0x1b2)]}),_0x538cf0=_0x4a1ead[_0x2a8e2b(0x1e9)];_0x41d5d9[_0x2a8e2b(0x1b2)]&&(console[_0x2a8e2b(0x1be)](_0x2a8e2b(0x1c0)+_0x538cf0[_0x2a8e2b(0x187)]),console['error']('Parent\x20ID:\x20'+_0x538cf0[_0x2a8e2b(0x1ff)]),_0x538cf0[_0x2a8e2b(0x1ea)]&&console[_0x2a8e2b(0x1be)](_0x2a8e2b(0x167)+_0x538cf0[_0x2a8e2b(0x1ea)]),_0x538cf0[_0x2a8e2b(0x1d7)]&&console[_0x2a8e2b(0x1be)](_0x2a8e2b(0x168)+_0x538cf0['segmentId']));if(_0x41d5d9[_0x2a8e2b(0x206)]){if(_0x538cf0['type']===_0x2a8e2b(0x196))return console[_0x2a8e2b(0x1be)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x538cf0[_0x2a8e2b(0x187)]===_0x2a8e2b(0x1a4))return console[_0x2a8e2b(0x1be)](_0x2a8e2b(0x1c7)),console[_0x2a8e2b(0x1be)](_0x2a8e2b(0x1ab)),0x1;if(!_0x538cf0[_0x2a8e2b(0x1d7)])throw new SDKError(ErrorCode[_0x2a8e2b(0x166)],_0x2a8e2b(0x1cd));const _0xaff7b7=getConsoleNextUrl(_0x41d5d9[_0x2a8e2b(0x1a3)],_0x2a8e2b(0x1cc)+_0x538cf0[_0x2a8e2b(0x1ff)]+'/e/'+_0x538cf0[_0x2a8e2b(0x1d7)]);return console[_0x2a8e2b(0x1be)](a37_0x318299[_0x2a8e2b(0x1ed)]('✔')+_0x2a8e2b(0x1dd)+a37_0x318299[_0x2a8e2b(0x18a)](_0xaff7b7)),openBrowser(_0xaff7b7),0x0;}if(_0x538cf0['type']==='folder'){if(!_0x538cf0[_0x2a8e2b(0x1ea)])throw new SDKError(ErrorCode[_0x2a8e2b(0x1b8)],_0x2a8e2b(0x17b));const _0x20528d=await withSpinner(_0x2a8e2b(0x16f),()=>_0x1e87fe['segment']['getFolder'](_0x538cf0['folderId']),{'verbose':_0x41d5d9[_0x2a8e2b(0x1b2)]});await handleSingleObjectOutput(_0x20528d[_0x2a8e2b(0x1e9)],_0x41d5d9);}else{if(_0x538cf0['type']===_0x2a8e2b(0x20b)){if(!_0x538cf0[_0x2a8e2b(0x1d7)])throw new SDKError(ErrorCode[_0x2a8e2b(0x166)],_0x2a8e2b(0x1cd));const _0x50c815=await withSpinner('Fetching\x20segment\x20details...',()=>_0x1e87fe[_0x2a8e2b(0x20b)][_0x2a8e2b(0x1f0)](_0x538cf0['parentId'],_0x538cf0[_0x2a8e2b(0x1d7)]),{'verbose':_0x41d5d9[_0x2a8e2b(0x1b2)]}),_0x7f5165=getConsoleNextUrl(_0x41d5d9[_0x2a8e2b(0x1a3)],_0x2a8e2b(0x1cc)+_0x538cf0[_0x2a8e2b(0x1ff)]+_0x2a8e2b(0x185)+_0x538cf0[_0x2a8e2b(0x1d7)]),_0x460084=_0x50c815['data'];_0x460084[_0x2a8e2b(0x1ef)]=_0x7f5165,await handleSingleObjectOutput(_0x460084,_0x41d5d9);}else return console[_0x2a8e2b(0x1be)]('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console[_0x2a8e2b(0x1be)](_0x2a8e2b(0x1f7)),0x1;}return 0x0;}catch(_0x2e3ed8){if(_0x2e3ed8 instanceof SDKError)return console['error'](_0x2a8e2b(0x17f)+_0x2e3ed8[_0x2a8e2b(0x1f1)]),_0x2e3ed8['cause']&&console[_0x2a8e2b(0x1be)](_0x2a8e2b(0x205)+_0x2e3ed8[_0x2a8e2b(0x1ca)]),0x1;throw _0x2e3ed8;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x33916a(0x199)]=a37_0x33916a(0x1d6);[a37_0x33916a(0x1d2)]=a37_0x33916a(0x1df);async[a37_0x33916a(0x1eb)](_0x8b975f){const _0x3787bb=a37_0x33916a,{options:_0x46b0b1,args:_0x5a5945,tdx:_0x4ab5c2}=_0x8b975f,_0x19fe87=_0x5a5945[0x0];if(!_0x19fe87)return console[_0x3787bb(0x1be)](_0x3787bb(0x175)),console[_0x3787bb(0x1be)](_0x3787bb(0x183)),console[_0x3787bb(0x1be)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console[_0x3787bb(0x1be)](_0x3787bb(0x181)),console['error']('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x3787bb(0x1be)](_0x3787bb(0x1d1)),0x1;try{const _0x3791b0=_0x46b0b1[_0x3787bb(0x1f2)],_0x138532=await resolveSegmentTarget(_0x19fe87,_0x3791b0,_0x46b0b1['verbose']);_0x46b0b1['verbose']&&console[_0x3787bb(0x1be)]('Target\x20path:\x20'+_0x138532);const _0x330c28=await withSpinner('Resolving\x20\x27'+_0x19fe87+_0x3787bb(0x1aa),()=>_0x4ab5c2[_0x3787bb(0x20b)][_0x3787bb(0x182)](_0x138532),{'verbose':_0x46b0b1[_0x3787bb(0x1b2)]}),_0x46ef0d=_0x330c28['data'];_0x46b0b1['verbose']&&(console[_0x3787bb(0x1be)](_0x3787bb(0x1c0)+_0x46ef0d[_0x3787bb(0x187)]),console[_0x3787bb(0x1be)](_0x3787bb(0x16e)+_0x46ef0d[_0x3787bb(0x1ff)]));if(_0x46ef0d[_0x3787bb(0x187)]===_0x3787bb(0x196))return console[_0x3787bb(0x1be)]('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console[_0x3787bb(0x1be)](_0x3787bb(0x1c6)),0x1;if(_0x46ef0d['type']===_0x3787bb(0x1a4))return console['error'](_0x3787bb(0x16d)),console[_0x3787bb(0x1be)](_0x3787bb(0x1e3)),0x1;if(!_0x46ef0d[_0x3787bb(0x1d7)])throw new SDKError(ErrorCode[_0x3787bb(0x166)],_0x3787bb(0x1cd));const _0x277bc6=await withSpinner(_0x3787bb(0x1e4),()=>_0x4ab5c2[_0x3787bb(0x20b)]['getSegmentSQL'](_0x46ef0d[_0x3787bb(0x1ff)],_0x46ef0d['segmentId']),{'verbose':_0x46b0b1['verbose']}),_0x1db2fb=_0x277bc6[_0x3787bb(0x1e9)],_0x52395b=await executeSchemaQuery(_0x1db2fb,_0x4ab5c2,_0x46b0b1);return await handleQueryOutput(_0x52395b,_0x46b0b1),0x0;}catch(_0x540828){if(_0x540828 instanceof SDKError)return console[_0x3787bb(0x1be)]('Error:\x20'+_0x540828[_0x3787bb(0x1f1)]),_0x540828[_0x3787bb(0x1ca)]&&console[_0x3787bb(0x1be)](_0x3787bb(0x205)+_0x540828[_0x3787bb(0x1ca)]),0x1;throw _0x540828;}}}
1
+ const a37_0x2f5cd1=a37_0x32b7;(function(_0x4f90f8,_0x5227a7){const _0x152a41=a37_0x32b7,_0x5286a3=_0x4f90f8();while(!![]){try{const _0x543ef1=-parseInt(_0x152a41(0x152))/0x1+-parseInt(_0x152a41(0x138))/0x2*(-parseInt(_0x152a41(0x17e))/0x3)+parseInt(_0x152a41(0x180))/0x4+-parseInt(_0x152a41(0x101))/0x5*(parseInt(_0x152a41(0x108))/0x6)+parseInt(_0x152a41(0x15d))/0x7+parseInt(_0x152a41(0x18c))/0x8*(-parseInt(_0x152a41(0x110))/0x9)+parseInt(_0x152a41(0x106))/0xa;if(_0x543ef1===_0x5227a7)break;else _0x5286a3['push'](_0x5286a3['shift']());}catch(_0x26ec07){_0x5286a3['push'](_0x5286a3['shift']());}}}(a37_0x592c,0xba559));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';function a37_0x32b7(_0x56ee53,_0x3e5d1a){_0x56ee53=_0x56ee53-0xf3;const _0x592cf8=a37_0x592c();let _0x32b74b=_0x592cf8[_0x56ee53];return _0x32b74b;}import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0xf4558b from'chalk';async function resolveSegmentTarget(_0x2bd2d6,_0xaa5c22,_0x3a353a){const _0x39d7a7=a37_0x32b7;if(isYamlFilePath(_0x2bd2d6))try{const _0xc94fa2=await resolveYamlFilePath(_0x2bd2d6);return _0x3a353a&&(console[_0x39d7a7(0x144)]('Resolved\x20YAML\x20file:\x20'+_0x2bd2d6),console[_0x39d7a7(0x144)](_0x39d7a7(0xf5)+_0xc94fa2[_0x39d7a7(0x120)]),console[_0x39d7a7(0x144)](_0x39d7a7(0x15a)+_0xc94fa2[_0x39d7a7(0xfe)]),console[_0x39d7a7(0x144)](_0x39d7a7(0x11b)+(_0xc94fa2[_0x39d7a7(0x176)]||_0x39d7a7(0x13e))),console[_0x39d7a7(0x144)]('\x20\x20Full\x20path:\x20'+_0xc94fa2[_0x39d7a7(0x11c)])),_0xc94fa2[_0x39d7a7(0x11c)];}catch(_0x560894){throw new SDKError(ErrorCode[_0x39d7a7(0x12c)],_0x39d7a7(0x129)+_0x560894[_0x39d7a7(0x150)]);}if(!_0xaa5c22)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x39d7a7(0x190));return _0xaa5c22+'/'+_0x2bd2d6;}export class SegmentDescribeCommand extends BaseCommand{['name']=a37_0x2f5cd1(0xf4);[a37_0x2f5cd1(0x146)]=a37_0x2f5cd1(0x139);async[a37_0x2f5cd1(0x10b)](_0x2238d1){const _0xb93d66=a37_0x2f5cd1,{options:_0x407a4f,args:_0x3e3277,tdx:_0x16182b}=_0x2238d1,_0xfa31da=_0x3e3277[0x0],_0x591dd3=!_0xfa31da&&!!_0x407a4f[_0xb93d66(0x120)],_0x3a0559=_0xfa31da||_0x407a4f[_0xb93d66(0x120)];if(!_0x3a0559)return console[_0xb93d66(0x144)](_0xb93d66(0x184)),console['error'](_0xb93d66(0x151)),console[_0xb93d66(0x144)](_0xb93d66(0x14d)),console['error'](_0xb93d66(0x18f)),console[_0xb93d66(0x144)](_0xb93d66(0x142)),console[_0xb93d66(0x144)](_0xb93d66(0x105)),console[_0xb93d66(0x144)](_0xb93d66(0x11f)),0x1;try{const _0x580515=_0x407a4f[_0xb93d66(0x12b)];let _0x388371=_0x3a0559;!_0x591dd3&&_0x580515&&!_0x3a0559['includes']('/')&&(_0x388371=_0x580515+'/'+_0x3a0559,_0x407a4f[_0xb93d66(0x154)]&&console[_0xb93d66(0x144)](_0xb93d66(0x13c)+_0x388371));const _0x414a30=await withSpinner(_0xb93d66(0x123)+_0x388371+_0xb93d66(0x13a),()=>_0x16182b[_0xb93d66(0x188)][_0xb93d66(0x141)](_0x388371),{'verbose':_0x407a4f[_0xb93d66(0x154)]}),_0x5d5403=_0x414a30[_0xb93d66(0x11d)];_0x407a4f[_0xb93d66(0x154)]&&(console[_0xb93d66(0x144)](_0xb93d66(0x114)+_0x5d5403[_0xb93d66(0x163)]),console[_0xb93d66(0x144)](_0xb93d66(0x10f)+_0x5d5403[_0xb93d66(0x165)]),_0x5d5403[_0xb93d66(0x126)]&&console[_0xb93d66(0x144)](_0xb93d66(0x178)+_0x5d5403[_0xb93d66(0x126)]),_0x5d5403[_0xb93d66(0x18a)]&&console[_0xb93d66(0x144)](_0xb93d66(0x113)+_0x5d5403['segmentId']));if(_0x5d5403[_0xb93d66(0x163)]===_0xb93d66(0x15f)){const _0x5014bc=await withSpinner(_0xb93d66(0x14a),()=>_0x16182b[_0xb93d66(0x188)]['getParent'](_0x5d5403[_0xb93d66(0x165)]),{'verbose':_0x407a4f['verbose']});await handleSingleObjectOutput(_0x5014bc[_0xb93d66(0x11d)],_0x407a4f);}else{if(_0x5d5403[_0xb93d66(0x163)]===_0xb93d66(0x14e)){if(!_0x5d5403[_0xb93d66(0x126)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0xb93d66(0xfd));const _0x418f10=await withSpinner(_0xb93d66(0x132),()=>_0x16182b['segment'][_0xb93d66(0x16d)](_0x5d5403[_0xb93d66(0x126)]),{'verbose':_0x407a4f['verbose']});await handleSingleObjectOutput(_0x418f10['data'],_0x407a4f);}else{if(_0x5d5403['type']==='segment'){if(!_0x5d5403[_0xb93d66(0x18a)])throw new SDKError(ErrorCode[_0xb93d66(0x147)],_0xb93d66(0x193));const _0x28cadf=await withSpinner(_0xb93d66(0xf3),()=>_0x16182b['segment']['getSegment'](_0x5d5403[_0xb93d66(0x165)],_0x5d5403[_0xb93d66(0x18a)]),{'verbose':_0x407a4f['verbose']});await handleSingleObjectOutput(_0x28cadf[_0xb93d66(0x11d)],_0x407a4f);}}}return 0x0;}catch(_0x4cbe5f){if(_0x4cbe5f instanceof SDKError)return console[_0xb93d66(0x144)](_0xb93d66(0x14f)+_0x4cbe5f[_0xb93d66(0x150)]),_0x4cbe5f['cause']&&console[_0xb93d66(0x144)](_0xb93d66(0x199)+_0x4cbe5f['cause']),0x1;throw _0x4cbe5f;}}}export class SegmentShowCommand extends BaseCommand{['name']=a37_0x2f5cd1(0x169);['description']=a37_0x2f5cd1(0x153);async[a37_0x2f5cd1(0x10b)](_0x353112){const _0x7b9f6f=a37_0x2f5cd1,{options:_0x32c86f,args:_0x27ab85,tdx:_0x4bbd5e}=_0x353112,_0x5c1dcd=_0x27ab85[0x0];if(!_0x5c1dcd)return console[_0x7b9f6f(0x144)](_0x7b9f6f(0x19b)),console[_0x7b9f6f(0x144)](_0x7b9f6f(0x185)),console[_0x7b9f6f(0x144)](_0x7b9f6f(0x195)),console[_0x7b9f6f(0x144)](_0x7b9f6f(0x14d)),console[_0x7b9f6f(0x144)](_0x7b9f6f(0x18e)),console[_0x7b9f6f(0x144)](_0x7b9f6f(0xfb)),0x1;try{const _0x7ebbe2=_0x32c86f['parentSegment'],_0x37aad5=await resolveSegmentTarget(_0x5c1dcd,_0x7ebbe2,_0x32c86f[_0x7b9f6f(0x154)]);_0x32c86f[_0x7b9f6f(0x154)]&&console[_0x7b9f6f(0x144)](_0x7b9f6f(0x117)+_0x37aad5);const _0xed9b4=await withSpinner('Resolving\x20\x27'+_0x5c1dcd+_0x7b9f6f(0x13a),()=>_0x4bbd5e[_0x7b9f6f(0x188)][_0x7b9f6f(0x141)](_0x37aad5),{'verbose':_0x32c86f[_0x7b9f6f(0x154)]}),_0x18635b=_0xed9b4[_0x7b9f6f(0x11d)];_0x32c86f[_0x7b9f6f(0x154)]&&(console[_0x7b9f6f(0x144)](_0x7b9f6f(0x114)+_0x18635b[_0x7b9f6f(0x163)]),console[_0x7b9f6f(0x144)](_0x7b9f6f(0x10f)+_0x18635b[_0x7b9f6f(0x165)]));if(_0x18635b[_0x7b9f6f(0x163)]===_0x7b9f6f(0x14e))return console[_0x7b9f6f(0x144)](_0x7b9f6f(0x158)),console[_0x7b9f6f(0x144)]('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x18635b['type']===_0x7b9f6f(0x15f))return console['error'](_0x7b9f6f(0x191)),console[_0x7b9f6f(0x144)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x18635b['segmentId'])throw new SDKError(ErrorCode[_0x7b9f6f(0x147)],_0x7b9f6f(0x193));const _0x42fbbc=await withSpinner(_0x7b9f6f(0x15c),()=>_0x4bbd5e['segment']['getSegmentSQL'](_0x18635b[_0x7b9f6f(0x165)],_0x18635b['segmentId']),{'verbose':_0x32c86f['verbose']});let _0x5b6e9e=_0x42fbbc[_0x7b9f6f(0x11d)];const _0x2984ff=resolveLimit(_0x32c86f[_0x7b9f6f(0xf7)],DEFAULT_DISPLAY_LIMIT),_0x228e7b=/\bLIMIT\s+\d+/i[_0x7b9f6f(0x18b)](_0x5b6e9e);!_0x228e7b&&(_0x5b6e9e=_0x5b6e9e['trim']()[_0x7b9f6f(0x135)](/;+$/,''),_0x5b6e9e=_0x7b9f6f(0x11e)+_0x5b6e9e+_0x7b9f6f(0x197)+_0x2984ff);_0x32c86f[_0x7b9f6f(0x154)]&&console[_0x7b9f6f(0x144)](_0x7b9f6f(0x189)+_0x5b6e9e);const _0x508aa8=await withProgressSpinner(_0x7b9f6f(0x112),async _0x51a078=>{const _0x391b40=_0x7b9f6f,_0x1e43fe=await _0x4bbd5e[_0x391b40(0x13f)][_0x391b40(0x10b)](_0x5b6e9e,{'catalog':'td','schema':_0x391b40(0x145),'onJobId':_0x8ca050=>{_0x51a078['setJobId'](_0x8ca050);}});return _0x1e43fe;},{'verbose':_0x32c86f['verbose']}),_0x14a227=_0x508aa8[_0x7b9f6f(0x11d)],_0x93f5e1=_0x14a227[_0x7b9f6f(0x157)]?_0x7b9f6f(0x119)+_0x14a227[_0x7b9f6f(0x157)]+']':'';return console[_0x7b9f6f(0x144)](_0x7b9f6f(0x16a)+_0x14a227[_0x7b9f6f(0x149)][_0x7b9f6f(0x173)][_0x7b9f6f(0x17b)]()+_0x7b9f6f(0x171)+(_0x7b9f6f(0x143)+formatElapsed(_0x14a227[_0x7b9f6f(0x149)]['elapsedTimeMillis'])+_0x93f5e1)),await handleQueryOutput(_0x14a227,_0x32c86f),0x0;}catch(_0x287f55){if(_0x287f55 instanceof SDKError)return console[_0x7b9f6f(0x144)](_0x7b9f6f(0x103)+_0x287f55[_0x7b9f6f(0x159)]+']'),console['error']('\x0a'+_0x287f55[_0x7b9f6f(0x150)]),0x1;throw _0x287f55;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x2f5cd1(0x136)]=a37_0x2f5cd1(0x177);[a37_0x2f5cd1(0x146)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async['execute'](_0x5187a4){const _0xbd56bb=a37_0x2f5cd1,{options:_0x11c2b7,args:_0x3f255d,tdx:_0x12cf2a}=_0x5187a4;if(_0x3f255d[_0xbd56bb(0x127)]===0x0)return console[_0xbd56bb(0x144)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0xbd56bb(0x144)](_0xbd56bb(0x170)),0x1;const _0x19848d=_0x3f255d[0x0];try{_0x11c2b7[_0xbd56bb(0x154)]&&(console[_0xbd56bb(0x144)]('Site:\x20'+_0x11c2b7[_0xbd56bb(0x12a)]),console[_0xbd56bb(0x144)](_0xbd56bb(0x179)+_0x19848d));const _0x5a054f=await withSpinner(_0xbd56bb(0xf6)+_0x19848d+_0xbd56bb(0x13a),()=>_0x12cf2a[_0xbd56bb(0x188)]['resolveParentId'](_0x19848d),{'verbose':_0x11c2b7['verbose']}),_0x59e838=_0x5a054f[_0xbd56bb(0x11d)];_0x11c2b7[_0xbd56bb(0x154)]&&console['error'](_0xbd56bb(0x182)+_0x59e838);const _0x435077=await withSpinner(_0xbd56bb(0x17d)+_0x19848d+_0xbd56bb(0x13a),()=>_0x12cf2a[_0xbd56bb(0x188)][_0xbd56bb(0x17f)](_0x59e838),{'verbose':_0x11c2b7[_0xbd56bb(0x154)]}),_0x509aa2=_0x435077[_0xbd56bb(0x11d)];return console[_0xbd56bb(0x144)](_0xbd56bb(0x109)+_0x509aa2[_0xbd56bb(0x127)]+'\x20folder'+(_0x509aa2[_0xbd56bb(0x127)]!==0x1?'s':'')),await handleSDKOutput(_0x509aa2,_0x11c2b7),0x0;}catch(_0x3ed66c){if(_0x3ed66c instanceof SDKError)return console[_0xbd56bb(0x144)](_0xbd56bb(0x14f)+_0x3ed66c['message']),_0x3ed66c[_0xbd56bb(0xfc)]&&console['error'](_0xbd56bb(0x199)+_0x3ed66c['cause']),0x1;throw _0x3ed66c;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x2f5cd1(0x136)]='segment:folder:show';['description']=a37_0x2f5cd1(0x118);async[a37_0x2f5cd1(0x10b)](_0x5c2a60){const _0x308b10=a37_0x2f5cd1,{options:_0x573616,args:_0x56e513,tdx:_0x5a911b}=_0x5c2a60;if(_0x56e513[_0x308b10(0x127)]===0x0)return console['error']('Error:\x20Folder\x20reference\x20is\x20required'),console[_0x308b10(0x144)](_0x308b10(0xff)),0x1;try{const {parentId:_0xea3dc4,childId:_0x3a8c6e}=parseSegmentRef(_0x56e513[0x0]);_0x573616[_0x308b10(0x154)]&&(console[_0x308b10(0x144)](_0x308b10(0x12d)+_0x573616[_0x308b10(0x12a)]),console[_0x308b10(0x144)](_0x308b10(0x179)+_0xea3dc4),_0x3a8c6e&&console['error']('Folder\x20name:\x20'+_0x3a8c6e));if(!_0x3a8c6e)return console[_0x308b10(0x144)](_0x308b10(0x174)),0x1;const _0x3fca7b=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0xea3dc4+_0x308b10(0x13a),()=>_0x5a911b['segment']['resolveParentId'](_0xea3dc4),{'verbose':_0x573616['verbose']}),_0x17b6c9=_0x3fca7b[_0x308b10(0x11d)];_0x573616['verbose']&&console['error'](_0x308b10(0x182)+_0x17b6c9);const _0x49b2d5=await withSpinner(_0x308b10(0x196)+_0x3a8c6e+_0x308b10(0x13a),()=>_0x5a911b[_0x308b10(0x188)][_0x308b10(0x19a)](_0x17b6c9,_0x3a8c6e),{'verbose':_0x573616[_0x308b10(0x154)]}),_0x2b9ebf=_0x49b2d5[_0x308b10(0x11d)];_0x573616[_0x308b10(0x154)]&&console[_0x308b10(0x144)](_0x308b10(0x16c)+_0x2b9ebf);const _0x1e9e8b=await withSpinner('Fetching\x20folder\x20\x27'+_0x3a8c6e+_0x308b10(0x13a),()=>_0x5a911b[_0x308b10(0x188)][_0x308b10(0x16d)](_0x2b9ebf),{'verbose':_0x573616[_0x308b10(0x154)]});return await handleSDKOutput([_0x1e9e8b[_0x308b10(0x11d)]],_0x573616),0x0;}catch(_0x50b755){if(_0x50b755 instanceof SDKError)return console[_0x308b10(0x144)](_0x308b10(0x14f)+_0x50b755[_0x308b10(0x150)]),_0x50b755[_0x308b10(0xfc)]&&console[_0x308b10(0x144)](_0x308b10(0x199)+_0x50b755['cause']),0x1;throw _0x50b755;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a37_0x2f5cd1(0x198);[a37_0x2f5cd1(0x146)]='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a37_0x2f5cd1(0x10b)](_0x531060){const _0x755d9c=a37_0x2f5cd1,{options:_0x442e6d,args:_0x123a48}=_0x531060,_0x3643e0=_0x442e6d,_0x38e76b=_0x3643e0[_0x755d9c(0x155)],_0x252ba8=_0x123a48[0x0];if(!_0x252ba8&&!_0x38e76b)return console[_0x755d9c(0x144)](a37_0xf4558b[_0x755d9c(0x111)](_0x755d9c(0x17c))),console['error'](_0x755d9c(0x167)),console[_0x755d9c(0x144)](_0x755d9c(0x10e)),console[_0x755d9c(0x144)]('\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>'),console[_0x755d9c(0x144)](_0x755d9c(0x14d)),console['error'](_0x755d9c(0x10c)),console['error'](_0x755d9c(0x121)),0x1;if(_0x252ba8&&_0x38e76b)return console[_0x755d9c(0x144)](a37_0xf4558b[_0x755d9c(0x111)](_0x755d9c(0x164))),0x1;try{let _0x4c174a;if(_0x38e76b)_0x4c174a=await this['getSQLFromYamlFile'](_0x38e76b,_0x531060);else{if(isYamlFilePath(_0x252ba8))return console[_0x755d9c(0x144)](a37_0xf4558b[_0x755d9c(0x111)](_0x755d9c(0x156))),console['error'](_0x755d9c(0x14b)+_0x252ba8),0x1;else _0x4c174a=await this[_0x755d9c(0x125)](_0x252ba8,_0x531060);}return _0x442e6d[_0x755d9c(0x100)]===_0x755d9c(0x166)||_0x442e6d[_0x755d9c(0x100)]===_0x755d9c(0x13b)?await handleSDKOutput([{'sql':_0x4c174a}],_0x442e6d):console[_0x755d9c(0x115)](_0x4c174a),0x0;}catch(_0x21eb3a){if(_0x21eb3a instanceof SDKError)return console[_0x755d9c(0x144)](_0x755d9c(0x14f)+_0x21eb3a[_0x755d9c(0x150)]),_0x21eb3a[_0x755d9c(0xfc)]&&console[_0x755d9c(0x144)](_0x755d9c(0x199)+_0x21eb3a[_0x755d9c(0xfc)]),0x1;throw _0x21eb3a;}}async[a37_0x2f5cd1(0x16b)](_0x3085c4,_0x3901de){const _0x2fd519=a37_0x2f5cd1,{options:_0x59c124,tdx:_0x25dd3b}=_0x3901de;let _0x112783;try{_0x112783=await resolveYamlFilePath(_0x3085c4);}catch(_0x28019c){throw new SDKError(ErrorCode[_0x2fd519(0x12c)],_0x2fd519(0x129)+_0x28019c[_0x2fd519(0x150)]);}_0x59c124[_0x2fd519(0x154)]&&console[_0x2fd519(0x144)](_0x2fd519(0x17a)+_0x112783['parentSegment']+'/'+_0x112783[_0x2fd519(0xfe)]);const _0x2e3285=await withSpinner(_0x2fd519(0x16f),()=>_0x25dd3b[_0x2fd519(0x188)]['getSegmentSQLFromYaml'](_0x112783[_0x2fd519(0x12e)],_0x112783[_0x2fd519(0x120)],_0x112783[_0x2fd519(0xfe)]),{'verbose':_0x59c124[_0x2fd519(0x154)]});return _0x2e3285[_0x2fd519(0x11d)];}async[a37_0x2f5cd1(0x125)](_0x27d321,_0xd306ae){const _0x3377eb=a37_0x2f5cd1,{options:_0x2672aa,tdx:_0x4a9ea9}=_0xd306ae,_0x347be2=_0x2672aa[_0x3377eb(0x120)],_0x36d57c=await resolveSegmentTarget(_0x27d321,_0x347be2,_0x2672aa[_0x3377eb(0x154)]);_0x2672aa[_0x3377eb(0x154)]&&console[_0x3377eb(0x144)](_0x3377eb(0x117)+_0x36d57c);const _0x4146b4=await withSpinner(_0x3377eb(0x10d)+_0x27d321+_0x3377eb(0x13a),()=>_0x4a9ea9[_0x3377eb(0x188)][_0x3377eb(0x141)](_0x36d57c),{'verbose':_0x2672aa[_0x3377eb(0x154)]}),_0x69f897=_0x4146b4[_0x3377eb(0x11d)];_0x2672aa[_0x3377eb(0x154)]&&(console[_0x3377eb(0x144)]('Resolved\x20type:\x20'+_0x69f897[_0x3377eb(0x163)]),console[_0x3377eb(0x144)](_0x3377eb(0x10f)+_0x69f897['parentId']));if(_0x69f897['type']==='folder')throw new SDKError(ErrorCode[_0x3377eb(0x12c)],_0x3377eb(0xf9));if(_0x69f897[_0x3377eb(0x163)]===_0x3377eb(0x15f))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql');if(!_0x69f897[_0x3377eb(0x18a)])throw new SDKError(ErrorCode[_0x3377eb(0x147)],_0x3377eb(0x193));const _0x1dab68=await withSpinner(_0x3377eb(0x15c),()=>_0x4a9ea9[_0x3377eb(0x188)]['getSegmentSQL'](_0x69f897[_0x3377eb(0x165)],_0x69f897[_0x3377eb(0x18a)]),{'verbose':_0x2672aa[_0x3377eb(0x154)]});return _0x1dab68[_0x3377eb(0x11d)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x2f5cd1(0x136)]='segment:folder:create';[a37_0x2f5cd1(0x146)]=a37_0x2f5cd1(0x181);async[a37_0x2f5cd1(0x10b)](_0xe28e){const _0x6a7a3a=a37_0x2f5cd1,{options:_0x16219d,args:_0x3e45d5,tdx:_0x49d7f2}=_0xe28e,_0x345669=_0x16219d;if(_0x3e45d5[_0x6a7a3a(0x127)]<0x2)return console[_0x6a7a3a(0x144)](_0x6a7a3a(0x122)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x58a999=_0x3e45d5[0x0],_0x512de7=_0x3e45d5[0x1];_0x345669[_0x6a7a3a(0x154)]&&(console[_0x6a7a3a(0x144)]('Site:\x20'+_0x345669[_0x6a7a3a(0x12a)]),console[_0x6a7a3a(0x144)]('Parent\x20segment:\x20'+_0x58a999),console[_0x6a7a3a(0x144)]('Folder\x20name:\x20'+_0x512de7));let _0x383ff4;if(_0x345669[_0x6a7a3a(0xfa)]){const _0xbf6525=_0x345669[_0x6a7a3a(0xfa)],_0x40bb97=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x58a999+'\x27...',()=>_0x49d7f2[_0x6a7a3a(0x188)][_0x6a7a3a(0x130)](_0x58a999),{'verbose':_0x345669[_0x6a7a3a(0x154)]}),_0xc010c0=_0x40bb97['data'],_0x4dbf86=await withSpinner(_0x6a7a3a(0x104)+_0xbf6525+_0x6a7a3a(0x13a),()=>_0x49d7f2['segment'][_0x6a7a3a(0x19a)](_0xc010c0,_0xbf6525),{'verbose':_0x345669[_0x6a7a3a(0x154)]});_0x383ff4=_0x4dbf86[_0x6a7a3a(0x11d)],_0x345669[_0x6a7a3a(0x154)]&&console['error']('Resolved\x20parent\x20folder\x20ID:\x20'+_0x383ff4);}const _0x3c5f73={'name':_0x512de7,'description':_0x345669[_0x6a7a3a(0x146)],'parentFolderId':_0x383ff4},_0x68e2f=await withSpinner(_0x6a7a3a(0x10a)+_0x512de7+_0x6a7a3a(0x13a),()=>_0x49d7f2[_0x6a7a3a(0x188)]['createFolder'](_0x58a999,_0x3c5f73),{'verbose':_0x345669['verbose']}),_0x27cf75=_0x68e2f[_0x6a7a3a(0x11d)];return console['error'](_0x6a7a3a(0x14c)+_0x27cf75['name']+_0x6a7a3a(0x186)+_0x27cf75['id']),await handleSDKOutput([_0x27cf75],_0x345669),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a37_0x2f5cd1(0x12f);[a37_0x2f5cd1(0x146)]='Show\x20folder\x20or\x20child\x20segment\x20details';async[a37_0x2f5cd1(0x10b)](_0x16b0cb){const _0x3e34ec=a37_0x2f5cd1,{options:_0x366353,args:_0x296c15,tdx:_0x56a29b}=_0x16b0cb,_0xb0fb7d=_0x296c15[0x0];if(!_0xb0fb7d)return console[_0x3e34ec(0x144)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x3e34ec(0x144)]('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console[_0x3e34ec(0x144)](_0x3e34ec(0x187)),console['error'](_0x3e34ec(0x107)),console[_0x3e34ec(0x144)](_0x3e34ec(0x116)),console[_0x3e34ec(0x144)]('Examples:'),console['error'](_0x3e34ec(0x11a)),console[_0x3e34ec(0x144)](_0x3e34ec(0x131)),console[_0x3e34ec(0x144)](_0x3e34ec(0x194)),console[_0x3e34ec(0x144)](_0x3e34ec(0x175)),0x1;try{const _0x9b50c3=_0x366353[_0x3e34ec(0x120)],_0x5d4da1=await resolveSegmentTarget(_0xb0fb7d,_0x9b50c3,_0x366353['verbose']);_0x366353[_0x3e34ec(0x154)]&&console[_0x3e34ec(0x144)](_0x3e34ec(0x117)+_0x5d4da1);const _0x1aa2b7=await withSpinner('Resolving\x20\x27'+_0xb0fb7d+'\x27...',()=>_0x56a29b[_0x3e34ec(0x188)]['resolvePathToResource'](_0x5d4da1),{'verbose':_0x366353[_0x3e34ec(0x154)]}),_0x2271be=_0x1aa2b7['data'];_0x366353[_0x3e34ec(0x154)]&&(console[_0x3e34ec(0x144)](_0x3e34ec(0x114)+_0x2271be[_0x3e34ec(0x163)]),console[_0x3e34ec(0x144)]('Parent\x20ID:\x20'+_0x2271be[_0x3e34ec(0x165)]),_0x2271be['folderId']&&console[_0x3e34ec(0x144)](_0x3e34ec(0x178)+_0x2271be['folderId']),_0x2271be[_0x3e34ec(0x18a)]&&console[_0x3e34ec(0x144)]('Segment\x20ID:\x20'+_0x2271be[_0x3e34ec(0x18a)]));if(_0x366353[_0x3e34ec(0x140)]){if(_0x2271be['type']===_0x3e34ec(0x14e))return console['error'](_0x3e34ec(0x102)),0x1;if(_0x2271be[_0x3e34ec(0x163)]===_0x3e34ec(0x15f))return console['error'](_0x3e34ec(0x16e)),console[_0x3e34ec(0x144)]('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x2271be['segmentId'])throw new SDKError(ErrorCode[_0x3e34ec(0x147)],_0x3e34ec(0x193));const _0x6872bf=getConsoleNextUrl(_0x366353[_0x3e34ec(0x12a)],_0x3e34ec(0x18d)+_0x2271be[_0x3e34ec(0x165)]+_0x3e34ec(0x128)+_0x2271be[_0x3e34ec(0x18a)]);return console[_0x3e34ec(0x144)](a37_0xf4558b[_0x3e34ec(0x15b)]('✔')+_0x3e34ec(0x192)+a37_0xf4558b[_0x3e34ec(0xf8)](_0x6872bf)),openBrowser(_0x6872bf),0x0;}if(_0x2271be[_0x3e34ec(0x163)]===_0x3e34ec(0x14e)){if(!_0x2271be[_0x3e34ec(0x126)])throw new SDKError(ErrorCode[_0x3e34ec(0x172)],_0x3e34ec(0xfd));const _0x4284b7=await withSpinner(_0x3e34ec(0x132),()=>_0x56a29b[_0x3e34ec(0x188)][_0x3e34ec(0x16d)](_0x2271be[_0x3e34ec(0x126)]),{'verbose':_0x366353['verbose']});await handleSingleObjectOutput(_0x4284b7[_0x3e34ec(0x11d)],_0x366353);}else{if(_0x2271be[_0x3e34ec(0x163)]===_0x3e34ec(0x188)){if(!_0x2271be[_0x3e34ec(0x18a)])throw new SDKError(ErrorCode[_0x3e34ec(0x147)],_0x3e34ec(0x193));const _0xb57d2c=await withSpinner('Fetching\x20segment\x20details...',()=>_0x56a29b[_0x3e34ec(0x188)][_0x3e34ec(0x134)](_0x2271be[_0x3e34ec(0x165)],_0x2271be['segmentId']),{'verbose':_0x366353[_0x3e34ec(0x154)]}),_0x3fdfe6=getConsoleNextUrl(_0x366353[_0x3e34ec(0x12a)],'/app/ps/'+_0x2271be['parentId']+'/e/'+_0x2271be['segmentId']),_0x700b0a=_0xb57d2c[_0x3e34ec(0x11d)];_0x700b0a[_0x3e34ec(0x19c)]=_0x3fdfe6,await handleSingleObjectOutput(_0x700b0a,_0x366353);}else return console[_0x3e34ec(0x144)](_0x3e34ec(0x162)),console[_0x3e34ec(0x144)](_0x3e34ec(0x160)),0x1;}return 0x0;}catch(_0x29bc4a){if(_0x29bc4a instanceof SDKError)return console[_0x3e34ec(0x144)]('Error:\x20'+_0x29bc4a['message']),_0x29bc4a[_0x3e34ec(0xfc)]&&console[_0x3e34ec(0x144)]('\x20\x20Cause:\x20'+_0x29bc4a[_0x3e34ec(0xfc)]),0x1;throw _0x29bc4a;}}}export const SegmentInfoCommand=SegmentViewCommand;function a37_0x592c(){const _0x1468b7=['Fetching\x20SQL\x20from\x20rule...','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','\x20rows\x20','SEGMENT_FOLDER_NOT_FOUND','processedRows','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','folderPath','segment:folder:list','Folder\x20ID:\x20','Parent\x20name:\x20','Resolved:\x20','toLocaleString','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','Listing\x20folders\x20for\x20parent\x20\x27','6kDqiyW','listFolders','1369040bNfFoR','Create\x20segment\x20folder\x20for\x20organization','Resolved\x20parent\x20ID:\x20','Use:\x20tdx\x20ps\x20desc','Error:\x20Path\x20or\x20name\x20is\x20required','Usage:\x20tdx\x20sg\x20show\x20<name>','\x27\x20with\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','segment','SQL\x20query:\x0a','segmentId','test','48YtlSES','/app/ps/','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20Opening\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Resolving\x20folder\x20\x27','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','segment:sql','\x20\x20Cause:\x20','resolveFolderId','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','url','Fetching\x20segment\x20details...','segment:describe','\x20\x20Parent\x20segment:\x20','Resolving\x20parent\x20segment\x20\x27','limit','cyan','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','parentFolder','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','cause','Folder\x20ID\x20missing\x20from\x20resolved\x20path','segmentName','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','format','20mLOXuQ','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','✖\x20Query\x20failed\x20[','Resolving\x20parent\x20folder\x20\x27','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','5434710jganZd','Options:','1887792stsjzA','✔\x20Found\x20','Creating\x20folder\x20\x27','execute','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Resolving\x20\x27','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','Parent\x20ID:\x20','836343CxcBXM','red','Executing\x20segment\x20query...','Segment\x20ID:\x20','Resolved\x20type:\x20','log','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Target\x20path:\x20','Show\x20segment\x20folder\x20details','\x20[Job\x20ID:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','\x20\x20Folder\x20path:\x20','fullPath','data','SELECT\x20*\x20FROM\x20(\x0a','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','parentSegment','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Resolving\x20path\x20\x27','getSegmentSQL','getSQLFromServerSegment','folderId','length','/e/','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','site','segmentPath','INVALID_ARGUMENT','Site:\x20','content','segment:view','resolveParentId','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Fetching\x20folder\x20details...','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','getSegment','replace','name','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','624656yNAmiy','Show\x20segment\x20or\x20folder\x20details','\x27...','jsonl','Resolved\x20relative\x20path\x20to:\x20','segment:desc','(root)','query','web','resolvePathToResource','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','in\x20','error','information_schema','description','SEGMENT_NOT_FOUND','Usage:\x20tdx\x20sg\x20desc\x20<name>','stats','Fetching\x20parent\x20segment\x20details...','\x20\x20tdx\x20sg\x20sql\x20--path\x20','✔\x20Created\x20folder\x20\x27','Examples:','folder','Error:\x20','message','Usage:\x20tdx\x20segment\x20describe\x20<path>','304236clnDDe','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','verbose','path','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','jobId','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','code','\x20\x20Segment\x20name:\x20','green','Fetching\x20SQL\x20for\x20segment...','9612148yTmmou','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','parent','Use:\x20tdx\x20ps\x20view','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','type','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','parentId','json','Usage:','Show\x20child\x20segment\x20schema\x20(column\x20types)','segment:show','✔\x20Query\x20completed:\x20Processed\x20','getSQLFromYamlFile','Resolved\x20folder\x20ID:\x20','getFolder','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'];a37_0x592c=function(){return _0x1468b7;};return a37_0x592c();}export class SegmentDescCommand extends BaseCommand{[a37_0x2f5cd1(0x136)]=a37_0x2f5cd1(0x13d);[a37_0x2f5cd1(0x146)]=a37_0x2f5cd1(0x168);async[a37_0x2f5cd1(0x10b)](_0x84b96){const _0xeafdd7=a37_0x2f5cd1,{options:_0x14e08d,args:_0x4c47b9,tdx:_0xc0cee4}=_0x84b96,_0x36d791=_0x4c47b9[0x0];if(!_0x36d791)return console[_0xeafdd7(0x144)](_0xeafdd7(0x19b)),console[_0xeafdd7(0x144)](_0xeafdd7(0x148)),console['error'](_0xeafdd7(0x15e)),console[_0xeafdd7(0x144)]('Examples:'),console[_0xeafdd7(0x144)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0xeafdd7(0x144)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x29cdb8=_0x14e08d['parentSegment'],_0x5668bb=await resolveSegmentTarget(_0x36d791,_0x29cdb8,_0x14e08d['verbose']);_0x14e08d['verbose']&&console[_0xeafdd7(0x144)](_0xeafdd7(0x117)+_0x5668bb);const _0x4ad7e1=await withSpinner(_0xeafdd7(0x10d)+_0x36d791+'\x27...',()=>_0xc0cee4[_0xeafdd7(0x188)]['resolvePathToResource'](_0x5668bb),{'verbose':_0x14e08d[_0xeafdd7(0x154)]}),_0x331cf0=_0x4ad7e1[_0xeafdd7(0x11d)];_0x14e08d[_0xeafdd7(0x154)]&&(console[_0xeafdd7(0x144)](_0xeafdd7(0x114)+_0x331cf0['type']),console[_0xeafdd7(0x144)](_0xeafdd7(0x10f)+_0x331cf0[_0xeafdd7(0x165)]));if(_0x331cf0[_0xeafdd7(0x163)]===_0xeafdd7(0x14e))return console[_0xeafdd7(0x144)](_0xeafdd7(0x161)),console[_0xeafdd7(0x144)](_0xeafdd7(0x133)),0x1;if(_0x331cf0[_0xeafdd7(0x163)]===_0xeafdd7(0x15f))return console[_0xeafdd7(0x144)](_0xeafdd7(0x137)),console['error'](_0xeafdd7(0x183)),0x1;if(!_0x331cf0[_0xeafdd7(0x18a)])throw new SDKError(ErrorCode[_0xeafdd7(0x147)],_0xeafdd7(0x193));const _0x18571a=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0xc0cee4['segment'][_0xeafdd7(0x124)](_0x331cf0[_0xeafdd7(0x165)],_0x331cf0[_0xeafdd7(0x18a)]),{'verbose':_0x14e08d[_0xeafdd7(0x154)]}),_0x82671=_0x18571a[_0xeafdd7(0x11d)],_0x8877b3=await executeSchemaQuery(_0x82671,_0xc0cee4,_0x14e08d);return await handleQueryOutput(_0x8877b3,_0x14e08d),0x0;}catch(_0x356862){if(_0x356862 instanceof SDKError)return console[_0xeafdd7(0x144)](_0xeafdd7(0x14f)+_0x356862[_0xeafdd7(0x150)]),_0x356862['cause']&&console[_0xeafdd7(0x144)](_0xeafdd7(0x199)+_0x356862['cause']),0x1;throw _0x356862;}}}
@@ -1 +1 @@
1
- const a38_0x1b05e5=a38_0x48ee;(function(_0x4a3cac,_0x5674ad){const _0x4b79a5=a38_0x48ee,_0x3bf4b3=_0x4a3cac();while(!![]){try{const _0x3ae958=-parseInt(_0x4b79a5(0xec))/0x1+parseInt(_0x4b79a5(0xe0))/0x2+parseInt(_0x4b79a5(0xda))/0x3+-parseInt(_0x4b79a5(0xc0))/0x4*(-parseInt(_0x4b79a5(0xc1))/0x5)+-parseInt(_0x4b79a5(0xc6))/0x6*(parseInt(_0x4b79a5(0xb9))/0x7)+-parseInt(_0x4b79a5(0xdb))/0x8+parseInt(_0x4b79a5(0xd7))/0x9;if(_0x3ae958===_0x5674ad)break;else _0x3bf4b3['push'](_0x3bf4b3['shift']());}catch(_0x5b0a90){_0x3bf4b3['push'](_0x3bf4b3['shift']());}}}(a38_0x1c10,0xd302b));function a38_0x48ee(_0x51bc56,_0x259160){_0x51bc56=_0x51bc56-0xb9;const _0x1c1058=a38_0x1c10();let _0x48ee10=_0x1c1058[_0x51bc56];return _0x48ee10;}function a38_0x1c10(){const _0x430964=['5144466gzjxoX','7979376ehCjLc','Create\x20child\x20segment\x20with\x20filtering\x20rules','length','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','segmentPath','2351596VMmPEm','ruleFile','resolvePathToResource','description','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','data','resolveParentId','noCountPopulation','segment','Resolved\x20folder\x20ID:\x20','Resolving\x20parent\x20segment\x20\x27','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','877288vGHybo','segments','folder','execute','7klXvYl','invisible','segment:create','Resolved\x20relative\x20path\x20to:\x20','includes','site','\x20\x20\x20Path:\x20','8bItFcW','2614145CsfNaH','type','Resolving\x20folder\x20path\x20\x27','createSegment','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','9508836PuZXqm','rule','Creating\x20segment\x20\x27','Target\x20path:\x20','yellow','kind','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','error','parent','Segment\x20name:\x20','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','Site:\x20','Parent:\x20','Examples:','\x27...','\x27\x20with\x20ID:\x20','name','3487833IHPIbJ','resolveFolderId','verbose'];a38_0x1c10=function(){return _0x430964;};return a38_0x1c10();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x23ad9a from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x1b05e5(0xd6)]=a38_0x1b05e5(0xbb);[a38_0x1b05e5(0xe3)]=a38_0x1b05e5(0xdc);async[a38_0x1b05e5(0xef)](_0x5c3a3d){const _0x46d518=a38_0x1b05e5;console['error'](a38_0x23ad9a[_0x46d518(0xca)]('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console['error'](a38_0x23ad9a[_0x46d518(0xca)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x3b3143,args:_0x27c7fb,tdx:_0x43c1c2}=_0x5c3a3d,_0x3ac4ec=_0x3b3143;if(_0x27c7fb[_0x46d518(0xdd)]===0x0)return console[_0x46d518(0xcd)](_0x46d518(0xe4)),console[_0x46d518(0xcd)]('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console[_0x46d518(0xcd)](_0x46d518(0xd3)),console[_0x46d518(0xcd)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console['error'](_0x46d518(0xc5)),console[_0x46d518(0xcd)](_0x46d518(0xde)),0x1;const _0x82ba55=_0x27c7fb[0x0],_0x5720b7=_0x3b3143[_0x46d518(0xdf)];let _0x1c09d7=_0x82ba55;_0x5720b7&&!_0x82ba55[_0x46d518(0xbd)]('/')&&(_0x1c09d7=_0x5720b7+'/'+_0x82ba55,_0x3ac4ec[_0x46d518(0xd9)]&&console[_0x46d518(0xcd)](_0x46d518(0xbc)+_0x1c09d7));const _0x2965d6=parsePath(_0x1c09d7);if(_0x2965d6[_0x46d518(0xed)]['length']<0x2)return console['error'](_0x46d518(0xcc)),console[_0x46d518(0xcd)](_0x46d518(0xd0)),0x1;const _0x19bd89=_0x2965d6[_0x46d518(0xed)][0x0],_0x392b7c=getBaseName(_0x1c09d7),_0x291b66=getParentPath(_0x1c09d7);_0x3ac4ec[_0x46d518(0xd9)]&&(console[_0x46d518(0xcd)](_0x46d518(0xd1)+_0x3ac4ec[_0x46d518(0xbe)]),console[_0x46d518(0xcd)](_0x46d518(0xc9)+_0x1c09d7),console[_0x46d518(0xcd)](_0x46d518(0xd2)+_0x19bd89),console[_0x46d518(0xcd)](_0x46d518(0xcf)+_0x392b7c),console[_0x46d518(0xcd)]('Parent\x20path:\x20'+_0x291b66));const _0x174bc6=await withSpinner(_0x46d518(0xea)+_0x19bd89+_0x46d518(0xd4),()=>_0x43c1c2[_0x46d518(0xe8)][_0x46d518(0xe6)](_0x19bd89),{'verbose':_0x3ac4ec['verbose']}),_0x4acf5d=_0x174bc6[_0x46d518(0xe5)];let _0x465483;if(_0x2965d6['segments'][_0x46d518(0xdd)]>0x2){const _0x38d59b=await withSpinner(_0x46d518(0xc3)+_0x291b66+_0x46d518(0xd4),()=>_0x43c1c2[_0x46d518(0xe8)][_0x46d518(0xe2)](_0x291b66),{'verbose':_0x3ac4ec[_0x46d518(0xd9)]}),_0x40d0e2=_0x38d59b[_0x46d518(0xe5)];if(_0x40d0e2[_0x46d518(0xc2)]!==_0x46d518(0xee)&&_0x40d0e2['type']!==_0x46d518(0xce))return console['error'](_0x46d518(0xeb)),0x1;_0x465483=_0x40d0e2['folderId'];}else{if(_0x3ac4ec[_0x46d518(0xee)]){const _0x54ad79=await withSpinner('Resolving\x20folder\x20\x27'+_0x3ac4ec[_0x46d518(0xee)]+_0x46d518(0xd4),()=>_0x43c1c2[_0x46d518(0xe8)][_0x46d518(0xd8)](_0x4acf5d,_0x3ac4ec['folder']),{'verbose':_0x3ac4ec[_0x46d518(0xd9)]});_0x465483=_0x54ad79['data'];}}_0x3ac4ec[_0x46d518(0xd9)]&&_0x465483&&console[_0x46d518(0xcd)](_0x46d518(0xe9)+_0x465483);const _0x3e2c26=await loadJSONFromOptions(_0x3ac4ec[_0x46d518(0xc7)],_0x3ac4ec[_0x46d518(0xe1)]),_0x11ed4d={'name':_0x392b7c,'description':_0x3ac4ec['description'],'rule':_0x3e2c26,'kind':_0x3ac4ec[_0x46d518(0xcb)]!==undefined?parseInt(_0x3ac4ec[_0x46d518(0xcb)],0xa):undefined,'isVisible':_0x3ac4ec[_0x46d518(0xba)]?![]:undefined,'segmentFolderId':_0x465483,'countPopulation':_0x3ac4ec[_0x46d518(0xe7)]?![]:undefined},_0x2b9e7b=await withSpinner(_0x46d518(0xc8)+_0x392b7c+_0x46d518(0xd4),()=>_0x43c1c2[_0x46d518(0xe8)][_0x46d518(0xc4)](_0x4acf5d,_0x11ed4d),{'verbose':_0x3ac4ec[_0x46d518(0xd9)]}),_0x3b5d73=_0x2b9e7b[_0x46d518(0xe5)];return console[_0x46d518(0xcd)]('✔\x20Created\x20segment\x20\x27'+_0x3b5d73[_0x46d518(0xd6)]+_0x46d518(0xd5)+_0x3b5d73['id']),_0x1c09d7!==_0x82ba55&&console['error'](_0x46d518(0xbf)+_0x1c09d7),await handleSDKOutput([_0x3b5d73],_0x3ac4ec),0x0;}}
1
+ const a38_0x55a448=a38_0x2932;function a38_0x3f54(){const _0x49c237=['1112szpmUt','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','139401SBXRfv','Segment\x20name:\x20','parent','3220588pFLWXk','yellow','segment:create','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','folder','\x20\x20\x20Path:\x20','kind','resolveFolderId','Resolving\x20folder\x20\x27','620452RgOSlV','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','createSegment','Resolved\x20folder\x20ID:\x20','858300esxqvp','segments','type','length','ruleFile','includes','name','2961048UpQaAe','Parent:\x20','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','verbose','Target\x20path:\x20','Parent\x20path:\x20','invisible','Resolved\x20relative\x20path\x20to:\x20','error','segment','segmentPath','\x27...','2023586bwbDhb','5BwONem','328352vTuhNp','data','noCountPopulation','✔\x20Created\x20segment\x20\x27','resolveParentId','Creating\x20segment\x20\x27','Examples:','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','Create\x20child\x20segment\x20with\x20filtering\x20rules','description','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','\x27\x20with\x20ID:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'];a38_0x3f54=function(){return _0x49c237;};return a38_0x3f54();}(function(_0x165fb8,_0x27bef6){const _0x25df17=a38_0x2932,_0x3499b9=_0x165fb8();while(!![]){try{const _0x575916=parseInt(_0x25df17(0x14d))/0x1+-parseInt(_0x25df17(0x164))/0x2+-parseInt(_0x25df17(0x158))/0x3+parseInt(_0x25df17(0x166))/0x4*(parseInt(_0x25df17(0x165))/0x5)+parseInt(_0x25df17(0x151))/0x6+-parseInt(_0x25df17(0x179))/0x7+parseInt(_0x25df17(0x174))/0x8*(parseInt(_0x25df17(0x176))/0x9);if(_0x575916===_0x27bef6)break;else _0x3499b9['push'](_0x3499b9['shift']());}catch(_0x56f272){_0x3499b9['push'](_0x3499b9['shift']());}}}(a38_0x3f54,0x83c14));import{BaseCommand}from'./command.js';function a38_0x2932(_0x191a7e,_0x54e807){_0x191a7e=_0x191a7e-0x14b;const _0x3f54d0=a38_0x3f54();let _0x2932c5=_0x3f54d0[_0x191a7e];return _0x2932c5;}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x1a3760 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x55a448(0x157)]=a38_0x55a448(0x17b);[a38_0x55a448(0x16f)]=a38_0x55a448(0x16e);async['execute'](_0x1639e9){const _0x4006e8=a38_0x55a448;console[_0x4006e8(0x160)](a38_0x1a3760[_0x4006e8(0x17a)](_0x4006e8(0x170))),console['error'](a38_0x1a3760['yellow'](_0x4006e8(0x17c)));const {options:_0x3df9c7,args:_0x8fcf83,tdx:_0x5108a6}=_0x1639e9,_0x548b5e=_0x3df9c7;if(_0x8fcf83[_0x4006e8(0x154)]===0x0)return console[_0x4006e8(0x160)](_0x4006e8(0x173)),console['error'](_0x4006e8(0x15a)),console[_0x4006e8(0x160)](_0x4006e8(0x16c)),console[_0x4006e8(0x160)](_0x4006e8(0x172)),console[_0x4006e8(0x160)](_0x4006e8(0x14e)),console[_0x4006e8(0x160)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x4ce8ac=_0x8fcf83[0x0],_0x28d4b7=_0x3df9c7[_0x4006e8(0x162)];let _0x40afea=_0x4ce8ac;_0x28d4b7&&!_0x4ce8ac[_0x4006e8(0x156)]('/')&&(_0x40afea=_0x28d4b7+'/'+_0x4ce8ac,_0x548b5e[_0x4006e8(0x15b)]&&console[_0x4006e8(0x160)](_0x4006e8(0x15f)+_0x40afea));const _0x3860ac=parsePath(_0x40afea);if(_0x3860ac['segments']['length']<0x2)return console[_0x4006e8(0x160)](_0x4006e8(0x16d)),console[_0x4006e8(0x160)](_0x4006e8(0x175)),0x1;const _0x1283fe=_0x3860ac[_0x4006e8(0x152)][0x0],_0x18cc00=getBaseName(_0x40afea),_0x37562b=getParentPath(_0x40afea);_0x548b5e['verbose']&&(console[_0x4006e8(0x160)]('Site:\x20'+_0x548b5e['site']),console[_0x4006e8(0x160)](_0x4006e8(0x15c)+_0x40afea),console[_0x4006e8(0x160)](_0x4006e8(0x159)+_0x1283fe),console[_0x4006e8(0x160)](_0x4006e8(0x177)+_0x18cc00),console[_0x4006e8(0x160)](_0x4006e8(0x15d)+_0x37562b));const _0x4b5cb0=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x1283fe+'\x27...',()=>_0x5108a6[_0x4006e8(0x161)][_0x4006e8(0x16a)](_0x1283fe),{'verbose':_0x548b5e[_0x4006e8(0x15b)]}),_0x25ac39=_0x4b5cb0[_0x4006e8(0x167)];let _0x4012df;if(_0x3860ac[_0x4006e8(0x152)][_0x4006e8(0x154)]>0x2){const _0x18bbbd=await withSpinner('Resolving\x20folder\x20path\x20\x27'+_0x37562b+_0x4006e8(0x163),()=>_0x5108a6[_0x4006e8(0x161)]['resolvePathToResource'](_0x37562b),{'verbose':_0x548b5e[_0x4006e8(0x15b)]}),_0x6f6dc1=_0x18bbbd[_0x4006e8(0x167)];if(_0x6f6dc1['type']!=='folder'&&_0x6f6dc1[_0x4006e8(0x153)]!==_0x4006e8(0x178))return console[_0x4006e8(0x160)]('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x4012df=_0x6f6dc1['folderId'];}else{if(_0x548b5e['folder']){const _0x1f79e7=await withSpinner(_0x4006e8(0x14c)+_0x548b5e[_0x4006e8(0x17d)]+_0x4006e8(0x163),()=>_0x5108a6['segment'][_0x4006e8(0x14b)](_0x25ac39,_0x548b5e[_0x4006e8(0x17d)]),{'verbose':_0x548b5e[_0x4006e8(0x15b)]});_0x4012df=_0x1f79e7['data'];}}_0x548b5e[_0x4006e8(0x15b)]&&_0x4012df&&console[_0x4006e8(0x160)](_0x4006e8(0x150)+_0x4012df);const _0x2550e7=await loadJSONFromOptions(_0x548b5e['rule'],_0x548b5e[_0x4006e8(0x155)]),_0xe35cfd={'name':_0x18cc00,'description':_0x548b5e[_0x4006e8(0x16f)],'rule':_0x2550e7,'kind':_0x548b5e['kind']!==undefined?parseInt(_0x548b5e[_0x4006e8(0x17f)],0xa):undefined,'isVisible':_0x548b5e[_0x4006e8(0x15e)]?![]:undefined,'segmentFolderId':_0x4012df,'countPopulation':_0x548b5e[_0x4006e8(0x168)]?![]:undefined},_0x442c64=await withSpinner(_0x4006e8(0x16b)+_0x18cc00+_0x4006e8(0x163),()=>_0x5108a6['segment'][_0x4006e8(0x14f)](_0x25ac39,_0xe35cfd),{'verbose':_0x548b5e[_0x4006e8(0x15b)]}),_0xc36448=_0x442c64[_0x4006e8(0x167)];return console[_0x4006e8(0x160)](_0x4006e8(0x169)+_0xc36448[_0x4006e8(0x157)]+_0x4006e8(0x171)+_0xc36448['id']),_0x40afea!==_0x4ce8ac&&console['error'](_0x4006e8(0x17e)+_0x40afea),await handleSDKOutput([_0xc36448],_0x548b5e),0x0;}}
@@ -1 +1 @@
1
- function a39_0x5088(_0x3d64c1,_0x8914ce){_0x3d64c1=_0x3d64c1-0x123;const _0x487509=a39_0x4875();let _0x508846=_0x487509[_0x3d64c1];return _0x508846;}const a39_0x33cdfc=a39_0x5088;(function(_0x172ce1,_0x4cbf93){const _0x5d33a1=a39_0x5088,_0x4f1a9d=_0x172ce1();while(!![]){try{const _0x381f71=-parseInt(_0x5d33a1(0x138))/0x1*(-parseInt(_0x5d33a1(0x13e))/0x2)+parseInt(_0x5d33a1(0x12b))/0x3*(parseInt(_0x5d33a1(0x126))/0x4)+-parseInt(_0x5d33a1(0x124))/0x5+-parseInt(_0x5d33a1(0x132))/0x6*(-parseInt(_0x5d33a1(0x12c))/0x7)+parseInt(_0x5d33a1(0x139))/0x8+parseInt(_0x5d33a1(0x127))/0x9*(parseInt(_0x5d33a1(0x133))/0xa)+-parseInt(_0x5d33a1(0x136))/0xb;if(_0x381f71===_0x4cbf93)break;else _0x4f1a9d['push'](_0x4f1a9d['shift']());}catch(_0x3e50ce){_0x4f1a9d['push'](_0x4f1a9d['shift']());}}}(a39_0x4875,0x24096));function a39_0x4875(){const _0x11dd85=['\x20field','segment','708YdROqJ','573867yZkkvc','listFields','Listing\x20fields\x20for\x20\x27','verbose','segment:fields','List\x20available\x20fields\x20for\x20segmentation','18dXvOMT','31000gyCzAq','name','Site:\x20','7677637uIfEyM','error','8367LVeXjk','2112320LMbAUa','jsonl','description','execute','length','2diagTl','parentSegment','✔\x20Found\x20','1137125SilKIS','Parent\x20segment:\x20','4672TGvTHX','810TlhAmi','site'];a39_0x4875=function(){return _0x11dd85;};return a39_0x4875();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a39_0x33cdfc(0x134)]=a39_0x33cdfc(0x130);[a39_0x33cdfc(0x13b)]=a39_0x33cdfc(0x131);async[a39_0x33cdfc(0x13c)](_0x3b7d9a){const _0xd98a46=a39_0x33cdfc,{options:_0x1e3a2f,args:_0x47e0b,tdx:_0x1e7511}=_0x3b7d9a,_0x427db8=_0x47e0b[0x0]||_0x1e3a2f[_0xd98a46(0x13f)];if(!_0x427db8)return console[_0xd98a46(0x137)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0xd98a46(0x137)]('Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'),console[_0xd98a46(0x137)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;_0x1e3a2f[_0xd98a46(0x12f)]&&(console[_0xd98a46(0x137)](_0xd98a46(0x135)+_0x1e3a2f[_0xd98a46(0x128)]),console[_0xd98a46(0x137)](_0xd98a46(0x125)+_0x427db8));const _0x2bf785=await withSpinner(_0xd98a46(0x12e)+_0x427db8+'\x27...',()=>_0x1e7511[_0xd98a46(0x12a)][_0xd98a46(0x12d)](_0x427db8),{'verbose':_0x1e3a2f['verbose']}),_0x176f10=_0x2bf785['data'];console['error'](_0xd98a46(0x123)+_0x176f10['length']+_0xd98a46(0x129)+(_0x176f10[_0xd98a46(0x13d)]!==0x1?'s':''));if(_0x1e3a2f['json']||_0x1e3a2f[_0xd98a46(0x13a)])return await handleSDKOutput(_0x176f10,_0x1e3a2f),0x0;return displayFieldsHumanReadable(_0x176f10,_0x427db8),0x0;}}
1
+ function a39_0x34fa(_0x279dcd,_0x2ca04a){_0x279dcd=_0x279dcd-0xa5;const _0x32f557=a39_0x32f5();let _0x34fad4=_0x32f557[_0x279dcd];return _0x34fad4;}const a39_0x2aca55=a39_0x34fa;(function(_0x4b0970,_0x220d16){const _0x27f369=a39_0x34fa,_0x48cd23=_0x4b0970();while(!![]){try{const _0x51f550=parseInt(_0x27f369(0xb4))/0x1*(-parseInt(_0x27f369(0xb7))/0x2)+-parseInt(_0x27f369(0xa6))/0x3*(-parseInt(_0x27f369(0xba))/0x4)+-parseInt(_0x27f369(0xb1))/0x5+-parseInt(_0x27f369(0xc0))/0x6*(-parseInt(_0x27f369(0xab))/0x7)+parseInt(_0x27f369(0xb5))/0x8*(parseInt(_0x27f369(0xb0))/0x9)+parseInt(_0x27f369(0xac))/0xa+parseInt(_0x27f369(0xb2))/0xb;if(_0x51f550===_0x220d16)break;else _0x48cd23['push'](_0x48cd23['shift']());}catch(_0x153b5f){_0x48cd23['push'](_0x48cd23['shift']());}}}(a39_0x32f5,0x2ccb9));import{BaseCommand}from'./command.js';function a39_0x32f5(){const _0x548af9=['description','verbose','261583NMPAAF','622310lxVMyu','Listing\x20fields\x20for\x20\x27','Site:\x20','✔\x20Found\x20','108OsDQYX','1820695CKTgaH','1068595owmdsZ','Parent\x20segment:\x20','1ZZahAx','116576mdzeUl','name','370134tLpHjV','\x27...','\x20field','4BhfsqZ','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Error:\x20Parent\x20segment\x20name\x20is\x20required','length','parentSegment','execute','30rHAgkd','List\x20available\x20fields\x20for\x20segmentation','segment:fields','segment','site','listFields','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','634806uBDwfe','error','jsonl'];a39_0x32f5=function(){return _0x548af9;};return a39_0x32f5();}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a39_0x2aca55(0xb6)]=a39_0x2aca55(0xc2);[a39_0x2aca55(0xa9)]=a39_0x2aca55(0xc1);async[a39_0x2aca55(0xbf)](_0xc20041){const _0xcb3e5d=a39_0x2aca55,{options:_0x397870,args:_0x1573fb,tdx:_0x32dfda}=_0xc20041,_0x91cf2e=_0x1573fb[0x0]||_0x397870[_0xcb3e5d(0xbe)];if(!_0x91cf2e)return console[_0xcb3e5d(0xa7)](_0xcb3e5d(0xbc)),console[_0xcb3e5d(0xa7)](_0xcb3e5d(0xa5)),console[_0xcb3e5d(0xa7)](_0xcb3e5d(0xbb)),0x1;_0x397870[_0xcb3e5d(0xaa)]&&(console['error'](_0xcb3e5d(0xae)+_0x397870[_0xcb3e5d(0xc4)]),console['error'](_0xcb3e5d(0xb3)+_0x91cf2e));const _0x4bedc3=await withSpinner(_0xcb3e5d(0xad)+_0x91cf2e+_0xcb3e5d(0xb8),()=>_0x32dfda[_0xcb3e5d(0xc3)][_0xcb3e5d(0xc5)](_0x91cf2e),{'verbose':_0x397870[_0xcb3e5d(0xaa)]}),_0xcc2ed1=_0x4bedc3['data'];console[_0xcb3e5d(0xa7)](_0xcb3e5d(0xaf)+_0xcc2ed1['length']+_0xcb3e5d(0xb9)+(_0xcc2ed1[_0xcb3e5d(0xbd)]!==0x1?'s':''));if(_0x397870['json']||_0x397870[_0xcb3e5d(0xa8)])return await handleSDKOutput(_0xcc2ed1,_0x397870),0x0;return displayFieldsHumanReadable(_0xcc2ed1,_0x91cf2e),0x0;}}