@treasuredata/tdx 2026.4.5 → 2026.4.6

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 (231) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/cas-command.js +1 -1
  11. package/dist/commands/cas-segment-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/delivery-command.js +1 -1
  20. package/dist/commands/describe.js +1 -1
  21. package/dist/commands/engage-campaign-pull-command.js +1 -1
  22. package/dist/commands/engage-campaign-push-command.js +1 -1
  23. package/dist/commands/engage-campaign-validate-command.js +1 -1
  24. package/dist/commands/engage-command.js +1 -1
  25. package/dist/commands/engage-template-pull-command.js +1 -1
  26. package/dist/commands/engage-template-push-command.js +1 -1
  27. package/dist/commands/engage-template-validate-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/journey-command.js +1 -1
  30. package/dist/commands/journey-validate-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/mcp-command.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/policy-command.js +1 -1
  35. package/dist/commands/profile-command.js +1 -1
  36. package/dist/commands/profiles-command.js +1 -1
  37. package/dist/commands/query-command.js +1 -1
  38. package/dist/commands/schedule-command.js +1 -1
  39. package/dist/commands/segment-command.js +1 -1
  40. package/dist/commands/segment-create-command.js +1 -1
  41. package/dist/commands/segment-fields-command.js +1 -1
  42. package/dist/commands/segment-pull-command.js +1 -1
  43. package/dist/commands/segment-push-command.js +1 -1
  44. package/dist/commands/segment-update-command.js +1 -1
  45. package/dist/commands/segment-use-command.js +1 -1
  46. package/dist/commands/segment-validate-command.js +1 -1
  47. package/dist/commands/segments.js +1 -1
  48. package/dist/commands/show.js +1 -1
  49. package/dist/commands/status-command.js +1 -1
  50. package/dist/commands/tables.js +1 -1
  51. package/dist/commands/unset-command.js +1 -1
  52. package/dist/commands/upgrade-command.js +1 -1
  53. package/dist/commands/use-command.js +1 -1
  54. package/dist/commands/user-command.js +1 -1
  55. package/dist/commands/work-command.js +1 -1
  56. package/dist/commands/workflow-command.js +1 -1
  57. package/dist/core/auth.js +1 -1
  58. package/dist/core/command-output.js +1 -1
  59. package/dist/core/config.js +1 -1
  60. package/dist/core/connection-cache.js +1 -1
  61. package/dist/core/constants.js +1 -1
  62. package/dist/core/credential-cache.js +1 -1
  63. package/dist/core/global-context.js +1 -1
  64. package/dist/core/keychain.js +1 -1
  65. package/dist/core/oauth-keychain.js +1 -1
  66. package/dist/core/oauth.js +1 -1
  67. package/dist/core/profile.js +1 -1
  68. package/dist/core/project-config.js +1 -1
  69. package/dist/core/session.js +1 -1
  70. package/dist/core/user-cache.js +1 -1
  71. package/dist/core/version.js +1 -1
  72. package/dist/index.js +1 -1
  73. package/dist/mcp/server.js +1 -1
  74. package/dist/mcp/tools/index.js +1 -1
  75. package/dist/mcp/tools/tdx-run.js +1 -1
  76. package/dist/mcp/tools/tdx-search.js +1 -1
  77. package/dist/mcp/tools/work-create-item.js +1 -1
  78. package/dist/mcp/utils.js +1 -1
  79. package/dist/proxy/claude-usage-tracker.js +1 -1
  80. package/dist/proxy/passthrough-server.js +1 -1
  81. package/dist/proxy/sse-usage-parser.js +1 -1
  82. package/dist/sdk/agent/agent-config.js +1 -1
  83. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  84. package/dist/sdk/agent/agent-yaml.js +1 -1
  85. package/dist/sdk/agent/test/evaluator.js +1 -1
  86. package/dist/sdk/agent/test/executor.js +1 -1
  87. package/dist/sdk/agent/test/index.js +1 -1
  88. package/dist/sdk/agent/test/output.js +1 -1
  89. package/dist/sdk/agent/test/parser.js +1 -1
  90. package/dist/sdk/agent/tool-target-registry.js +1 -1
  91. package/dist/sdk/api.js +1 -1
  92. package/dist/sdk/cas/cas-api-client.js +1 -1
  93. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  94. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  95. package/dist/sdk/cas/index.js +1 -1
  96. package/dist/sdk/cas/pull-workflow.js +1 -1
  97. package/dist/sdk/cas/push-workflow.js +1 -1
  98. package/dist/sdk/client/cdp-api-client.js +1 -1
  99. package/dist/sdk/client/delivery-api-client.js +1 -1
  100. package/dist/sdk/client/endpoints.js +1 -1
  101. package/dist/sdk/client/engage-api-client.js +1 -1
  102. package/dist/sdk/client/http-client.js +1 -1
  103. package/dist/sdk/client/llm-api-client.js +1 -1
  104. package/dist/sdk/client/oauth-refresh.js +1 -1
  105. package/dist/sdk/client/rate-limiter.js +1 -1
  106. package/dist/sdk/client/td-api-client.js +1 -1
  107. package/dist/sdk/client/trino-api-client.js +1 -1
  108. package/dist/sdk/client/workflow-client.js +1 -1
  109. package/dist/sdk/connection-validator.js +1 -1
  110. package/dist/sdk/connection.js +1 -1
  111. package/dist/sdk/delivery.js +1 -1
  112. package/dist/sdk/engage/campaign-pull.js +1 -1
  113. package/dist/sdk/engage/campaign-push.js +1 -1
  114. package/dist/sdk/engage/campaign-validator.js +1 -1
  115. package/dist/sdk/engage/campaign-yaml.js +1 -1
  116. package/dist/sdk/engage/template-pull.js +1 -1
  117. package/dist/sdk/engage/template-push.js +1 -1
  118. package/dist/sdk/engage/template-validator.js +1 -1
  119. package/dist/sdk/engage/template-yaml.js +1 -1
  120. package/dist/sdk/engage/types/campaign-def.js +1 -1
  121. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  122. package/dist/sdk/engage/types/template-schema.js +1 -1
  123. package/dist/sdk/engage.js +1 -1
  124. package/dist/sdk/errors.js +1 -1
  125. package/dist/sdk/index.js +1 -1
  126. package/dist/sdk/io/index.js +1 -1
  127. package/dist/sdk/io/node-filesystem.js +1 -1
  128. package/dist/sdk/job.js +1 -1
  129. package/dist/sdk/journey.js +1 -1
  130. package/dist/sdk/llm/chat-cache.js +1 -1
  131. package/dist/sdk/llm/index.js +1 -1
  132. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  133. package/dist/sdk/llm/model-factors.js +1 -1
  134. package/dist/sdk/personalization.js +1 -1
  135. package/dist/sdk/policy.js +1 -1
  136. package/dist/sdk/query/index.js +1 -1
  137. package/dist/sdk/query/sql-parser.js +1 -1
  138. package/dist/sdk/realtime.js +1 -1
  139. package/dist/sdk/schedule.js +1 -1
  140. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  141. package/dist/sdk/segment/fields-display.js +1 -1
  142. package/dist/sdk/segment/file-discovery.js +1 -1
  143. package/dist/sdk/segment/journey-utils.js +1 -1
  144. package/dist/sdk/segment/journey-validator.js +1 -1
  145. package/dist/sdk/segment/journey-yaml.js +1 -1
  146. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  147. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  148. package/dist/sdk/segment/pull-workflow.js +1 -1
  149. package/dist/sdk/segment/push-recovery.js +1 -1
  150. package/dist/sdk/segment/push-workflow.js +1 -1
  151. package/dist/sdk/segment/resolution-context.js +1 -1
  152. package/dist/sdk/segment/segment-path-parser.js +1 -1
  153. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  154. package/dist/sdk/segment/segment-validator.js +1 -1
  155. package/dist/sdk/segment/target-resolution.js +1 -1
  156. package/dist/sdk/segment/tdx-config.js +1 -1
  157. package/dist/sdk/segment/types/activation-schema.js +1 -1
  158. package/dist/sdk/segment/types/journey-def.js +1 -1
  159. package/dist/sdk/segment/types/journey-schema.js +1 -1
  160. package/dist/sdk/segment/types/segment-def.js +1 -1
  161. package/dist/sdk/segment/types/segment-schema.js +1 -1
  162. package/dist/sdk/segment/validate-files.js +1 -1
  163. package/dist/sdk/segment/yaml-validator.js +1 -1
  164. package/dist/sdk/segment.js +1 -1
  165. package/dist/sdk/types/index.js +1 -1
  166. package/dist/sdk/types/progress.js +1 -1
  167. package/dist/sdk/types/workspace.d.ts +3 -0
  168. package/dist/sdk/types/workspace.d.ts.map +1 -1
  169. package/dist/sdk/types/workspace.js +1 -1
  170. package/dist/sdk/types/workspace.js.map +1 -1
  171. package/dist/sdk/user.js +1 -1
  172. package/dist/sdk/util/format-detector.js +1 -1
  173. package/dist/sdk/util/formatters.js +1 -1
  174. package/dist/sdk/util/index.js +1 -1
  175. package/dist/sdk/util/paginate.js +1 -1
  176. package/dist/sdk/util/tree-formatter.js +1 -1
  177. package/dist/sdk/workflow/archive-validation.js +1 -1
  178. package/dist/sdk/workflow/clone-workflow.js +1 -1
  179. package/dist/sdk/workflow/index.js +1 -1
  180. package/dist/sdk/workflow/pull-workflow.js +1 -1
  181. package/dist/sdk/workflow/push-workflow.js +1 -1
  182. package/dist/sdk/workflow/tdx-config.js +1 -1
  183. package/dist/sdk/workflow/workflow-utils.js +1 -1
  184. package/dist/sdk/workspace/access-tracker.d.ts.map +1 -1
  185. package/dist/sdk/workspace/access-tracker.js +1 -1
  186. package/dist/sdk/workspace/access-tracker.js.map +1 -1
  187. package/dist/sdk/workspace/frontmatter.js +1 -1
  188. package/dist/sdk/workspace/git.js +1 -1
  189. package/dist/sdk/workspace/index.d.ts +1 -1
  190. package/dist/sdk/workspace/index.d.ts.map +1 -1
  191. package/dist/sdk/workspace/index.js +1 -1
  192. package/dist/sdk/workspace/index.js.map +1 -1
  193. package/dist/sdk/workspace/templates.js +1 -1
  194. package/dist/sdk/workspace/weekly.js +1 -1
  195. package/dist/sdk/workspace/wikilinks.d.ts +2 -0
  196. package/dist/sdk/workspace/wikilinks.d.ts.map +1 -1
  197. package/dist/sdk/workspace/wikilinks.js +1 -1
  198. package/dist/sdk/workspace/wikilinks.js.map +1 -1
  199. package/dist/test-utils/command-runner.js +1 -1
  200. package/dist/test-utils/factories.js +1 -1
  201. package/dist/test-utils/fixtures.js +1 -1
  202. package/dist/test-utils/http-mock.js +1 -1
  203. package/dist/test-utils/index.js +1 -1
  204. package/dist/utils/async.js +1 -1
  205. package/dist/utils/colors.js +1 -1
  206. package/dist/utils/diff.js +1 -1
  207. package/dist/utils/file-permissions.js +1 -1
  208. package/dist/utils/file-reader.js +1 -1
  209. package/dist/utils/github-releases.js +1 -1
  210. package/dist/utils/global-cache.js +1 -1
  211. package/dist/utils/json-loader.js +1 -1
  212. package/dist/utils/local-cache.js +1 -1
  213. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  214. package/dist/utils/logger/formatters/index.js +1 -1
  215. package/dist/utils/logger/handlers/console-handler.js +1 -1
  216. package/dist/utils/logger/handlers/file-handler.js +1 -1
  217. package/dist/utils/logger/handlers/index.js +1 -1
  218. package/dist/utils/logger/handlers/null-handler.js +1 -1
  219. package/dist/utils/logger/index.js +1 -1
  220. package/dist/utils/logger/logger.js +1 -1
  221. package/dist/utils/logger/types.js +1 -1
  222. package/dist/utils/option-validation.js +1 -1
  223. package/dist/utils/process.js +1 -1
  224. package/dist/utils/prompt.js +1 -1
  225. package/dist/utils/spinner.js +1 -1
  226. package/dist/utils/sse-parser.js +1 -1
  227. package/dist/utils/string-utils.js +1 -1
  228. package/dist/utils/table-ref-parser.js +1 -1
  229. package/dist/utils/tdx-logger.js +1 -1
  230. package/dist/utils/version-check.js +1 -1
  231. package/package.json +1 -1
@@ -1 +1 @@
1
- const a32_0xdc3244=a32_0x4864;(function(_0x5e801a,_0x43482b){const _0x118258=a32_0x4864,_0x30301f=_0x5e801a();while(!![]){try{const _0x239b9a=-parseInt(_0x118258(0x9d))/0x1+-parseInt(_0x118258(0xb7))/0x2*(-parseInt(_0x118258(0xb6))/0x3)+-parseInt(_0x118258(0x9c))/0x4*(parseInt(_0x118258(0x8d))/0x5)+parseInt(_0x118258(0x91))/0x6*(-parseInt(_0x118258(0xc0))/0x7)+parseInt(_0x118258(0xb1))/0x8+parseInt(_0x118258(0xab))/0x9*(-parseInt(_0x118258(0xba))/0xa)+parseInt(_0x118258(0xa6))/0xb*(parseInt(_0x118258(0x98))/0xc);if(_0x239b9a===_0x43482b)break;else _0x30301f['push'](_0x30301f['shift']());}catch(_0x3df3f3){_0x30301f['push'](_0x30301f['shift']());}}}(a32_0x2435,0xb0721));import{BaseCommand}from'./command.js';function a32_0x4864(_0x45e9df,_0x3b3553){_0x45e9df=_0x45e9df-0x85;const _0x2435f0=a32_0x2435();let _0x48643e=_0x2435f0[_0x45e9df];return _0x48643e;}function a32_0x2435(){const _0x3a58c3=['max','ies','No\x20policies\x20found','\x20\x20No\x20permissions','Fetching\x20policy...','Member','84LoBbOZ','verbose','dim','description','56AybtJI','362206NBAHzk','🔑\x20Effective\x20Permissions','permissions','validate','policy\x20list','entries','log','execute','account_owner','555929AJYzHh','getPolicyUsers','policies','policy\x20show','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','23571DRrLpe','administrator','\x20\x20\x20','all','map','args','9861784VpOPgH','name','\x20assigned','\x20\x20No\x20policies\x20assigned','operation','2829hIzcRT','2546OFjZuS','email','\x20user','2160qAnNBb','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','Administrator','\x20\x20•\x20','\x20—\x20','Fetching\x20permissions...','6041JyEBsD','bold','getCurrent','site','user','getPolicy','policy','Account\x20Owner','data','getMyPermissions','✔\x20Found\x20','59390AgFMPn','(ID:\x20','error','length','6744RwDPht'];a32_0x2435=function(){return _0x3a58c3;};return a32_0x2435();}import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x396132 from'chalk';export class PolicyCommand extends BaseCommand{[a32_0xdc3244(0xb2)]=a32_0xdc3244(0x88);[a32_0xdc3244(0x9b)]=a32_0xdc3244(0xbb);async[a32_0xdc3244(0xa4)](_0x13a31a){const _0x25cae4=a32_0xdc3244,{options:_0x4de805,tdx:_0x2afa4f}=_0x13a31a,_0x315bd0=await withSpinner(_0x25cae4(0xbf),async()=>{const _0x4c4205=_0x25cae4,[_0x51ebfe,_0x1fa0bc]=await Promise[_0x4c4205(0xae)]([_0x2afa4f[_0x4c4205(0x86)][_0x4c4205(0xc2)](),_0x2afa4f[_0x4c4205(0x88)][_0x4c4205(0x8b)]()]);return{'userInfo':_0x51ebfe,'permissions':_0x1fa0bc};},{'verbose':_0x4de805[_0x25cae4(0x99)]}),{userInfo:_0x42013e,permissions:_0x588826}=_0x315bd0[_0x25cae4(0x8a)];if(isStructuredFormat(_0x4de805))return await handleSingleObjectOutput(_0x588826,_0x4de805),0x0;const _0x38824d=_0x42013e[_0x25cae4(0xa5)]?_0x25cae4(0x89):_0x42013e[_0x25cae4(0xac)]?_0x25cae4(0xbc):_0x25cae4(0x97);console[_0x25cae4(0xa3)]('\x0a'+a32_0x396132[_0x25cae4(0xc1)]('👤')+'\x20'+a32_0x396132['bold'](_0x42013e[_0x25cae4(0xb2)])+'\x20'+a32_0x396132['dim']('('+_0x42013e[_0x25cae4(0xb8)]+')')+_0x25cae4(0xbe)+_0x38824d),console[_0x25cae4(0xa3)](a32_0x396132[_0x25cae4(0x9a)]('\x20\x20\x20'+_0x2afa4f['context'][_0x25cae4(0x85)]+':'+_0x42013e['account_id']+',\x20user_id:'+_0x42013e['id']));const _0x17f5cc=_0x588826[_0x25cae4(0xa8)];console['log']('\x0a'+a32_0x396132[_0x25cae4(0xc1)]('📋\x20Assigned\x20Policies')+'\x20('+_0x17f5cc[_0x25cae4(0x90)]+'):');if(_0x17f5cc[_0x25cae4(0x90)]===0x0)console[_0x25cae4(0xa3)](a32_0x396132[_0x25cae4(0x9a)](_0x25cae4(0xb4)));else for(const _0x3b1968 of _0x17f5cc){console[_0x25cae4(0xa3)](_0x25cae4(0xbd)+_0x3b1968[_0x25cae4(0xb2)]);}return printPermissionsMap(_0x588826['permissions']),console['log'](),0x0;}}export class PolicyListCommand extends BaseCommand{['name']=a32_0xdc3244(0xa1);[a32_0xdc3244(0x9b)]='List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)';async[a32_0xdc3244(0xa4)](_0x3ff23b){const _0x5b47ca=a32_0xdc3244,{options:_0x25ac38,tdx:_0x46848b}=_0x3ff23b,_0x1fd894=await withSpinner('Listing\x20policies...',()=>_0x46848b[_0x5b47ca(0x88)]['listPolicies'](),{'verbose':_0x25ac38[_0x5b47ca(0x99)]}),_0x1bdff8=_0x1fd894['data'];console[_0x5b47ca(0x8f)](_0x5b47ca(0x8c)+_0x1bdff8[_0x5b47ca(0x90)]+'\x20polic'+(_0x1bdff8['length']!==0x1?_0x5b47ca(0x93):'y'));if(isStructuredFormat(_0x25ac38))return await handleSDKOutput(_0x1bdff8,_0x25ac38),0x0;if(_0x1bdff8[_0x5b47ca(0x90)]===0x0)console[_0x5b47ca(0xa3)](a32_0x396132[_0x5b47ca(0x9a)](_0x5b47ca(0x94)));else for(const _0xfdc54 of _0x1bdff8){const _0x5cc107=_0xfdc54[_0x5b47ca(0x9b)]?a32_0x396132['dim'](_0x5b47ca(0xbe)+_0xfdc54[_0x5b47ca(0x9b)]):'';console[_0x5b47ca(0xa3)](_0x5b47ca(0xbd)+_0xfdc54[_0x5b47ca(0xb2)]+_0x5cc107);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{['name']=a32_0xdc3244(0xa9);['description']=a32_0xdc3244(0xaa);[a32_0xdc3244(0xa0)](_0x3d1fb4){const _0x32c06d=a32_0xdc3244;if(_0x3d1fb4[_0x32c06d(0xb0)][_0x32c06d(0x90)]===0x0)return'Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>';return undefined;}async[a32_0xdc3244(0xa4)](_0x27633c){const _0x25d228=a32_0xdc3244,{options:_0x4e3f71,tdx:_0x1e2454}=_0x27633c,_0x336058=_0x27633c[_0x25d228(0xb0)][0x0],_0x569803=await withSpinner(_0x25d228(0x96),async()=>{const _0x128193=_0x25d228,_0x463fd6=await _0x1e2454[_0x128193(0x88)][_0x128193(0x87)](_0x336058),[_0x524aea,_0x166059]=await Promise[_0x128193(0xae)]([_0x1e2454[_0x128193(0x88)]['getPolicyPermissions'](_0x463fd6['id']),_0x1e2454[_0x128193(0x88)][_0x128193(0xa7)](_0x463fd6['id'])]);return{'policy':_0x463fd6,'perms':_0x524aea,'users':_0x166059};},{'verbose':_0x4e3f71[_0x25d228(0x99)]}),{policy:_0x42395c,perms:_0x4332ea,users:_0x22a5ac}=_0x569803[_0x25d228(0x8a)];if(isStructuredFormat(_0x4e3f71))return await handleSingleObjectOutput({..._0x42395c,'permissions':_0x4332ea['permissions'],'users':_0x22a5ac},_0x4e3f71),0x0;console[_0x25d228(0xa3)]('\x0a'+a32_0x396132[_0x25d228(0xc1)]('📋')+'\x20'+a32_0x396132[_0x25d228(0xc1)](_0x42395c['name'])+'\x20'+a32_0x396132[_0x25d228(0x9a)](_0x25d228(0x8e)+_0x42395c['id']+')'));_0x42395c[_0x25d228(0x9b)]&&console['log']('\x20\x20\x20'+a32_0x396132[_0x25d228(0x9a)](_0x42395c[_0x25d228(0x9b)]));console['log'](_0x25d228(0xad)+_0x22a5ac[_0x25d228(0x90)]+_0x25d228(0xb9)+(_0x22a5ac[_0x25d228(0x90)]!==0x1?'s':'')+_0x25d228(0xb3)),printPermissionsMap(_0x4332ea[_0x25d228(0x9f)]);if(_0x22a5ac[_0x25d228(0x90)]>0x0){console['log']('\x0a'+a32_0x396132[_0x25d228(0xc1)]('👥\x20Assigned\x20Users')+':');for(const _0x1edc20 of _0x22a5ac){const _0x521fdb=_0x1edc20['email']&&_0x1edc20[_0x25d228(0xb8)]!==_0x1edc20[_0x25d228(0xb2)]?a32_0x396132[_0x25d228(0x9a)]('\x20<'+_0x1edc20[_0x25d228(0xb8)]+'>'):'';console['log'](_0x25d228(0xbd)+_0x1edc20[_0x25d228(0xb2)]+_0x521fdb);}}return console[_0x25d228(0xa3)](),0x0;}}function printPermissionsMap(_0x596c98){const _0x3905de=a32_0xdc3244,_0x82b49e=Object[_0x3905de(0xa2)](_0x596c98);console['log']('\x0a'+a32_0x396132[_0x3905de(0xc1)](_0x3905de(0x9e))+':');if(_0x82b49e[_0x3905de(0x90)]===0x0){console['log'](a32_0x396132['dim'](_0x3905de(0x95)));return;}const _0x27195e=Math[_0x3905de(0x92)](..._0x82b49e[_0x3905de(0xaf)](([_0x2ee3cc])=>_0x2ee3cc[_0x3905de(0x90)]));for(const [_0x43973d,_0x2f23cc]of _0x82b49e){const _0x772474=formatOperations(_0x2f23cc);console['log']('\x20\x20'+_0x43973d['padEnd'](_0x27195e+0x2)+_0x772474);}}function formatOperations(_0x1743f5){const _0x1e92a4=a32_0xdc3244,_0x7b7954=[...new Set(_0x1743f5['map'](_0x3634b3=>_0x3634b3[_0x1e92a4(0xb5)]))];return _0x7b7954['join'](',\x20');}
1
+ const a32_0x94f4c2=a32_0x44a9;function a32_0x44a9(_0x1c32f4,_0x2c3f86){_0x1c32f4=_0x1c32f4-0x156;const _0x32e071=a32_0x32e0();let _0x44a97b=_0x32e071[_0x1c32f4];return _0x44a97b;}(function(_0xeb78e1,_0x2ea927){const _0x531de7=a32_0x44a9,_0x339abe=_0xeb78e1();while(!![]){try{const _0x2f747b=-parseInt(_0x531de7(0x176))/0x1+parseInt(_0x531de7(0x156))/0x2*(parseInt(_0x531de7(0x181))/0x3)+-parseInt(_0x531de7(0x18d))/0x4+-parseInt(_0x531de7(0x17c))/0x5+parseInt(_0x531de7(0x192))/0x6*(-parseInt(_0x531de7(0x191))/0x7)+parseInt(_0x531de7(0x18a))/0x8*(-parseInt(_0x531de7(0x171))/0x9)+parseInt(_0x531de7(0x160))/0xa*(parseInt(_0x531de7(0x166))/0xb);if(_0x2f747b===_0x2ea927)break;else _0x339abe['push'](_0x339abe['shift']());}catch(_0x2ecd54){_0x339abe['push'](_0x339abe['shift']());}}}(a32_0x32e0,0x9b0cf));function a32_0x32e0(){const _0x16d8ba=['\x20user','policies','data','Fetching\x20policy...','114334BIbpZy','Fetching\x20permissions...','policy','getMyPermissions','✔\x20Found\x20','account_id','5623945vhNKwe','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','\x20\x20•\x20','📋\x20Assigned\x20Policies','getPolicyPermissions','2542905EbgQUK','dim','permissions','listPolicies','\x20\x20No\x20policies\x20assigned','Member','name','getPolicy','(ID:\x20','8404280LwoXHL','administrator','args','913896Swibts','\x20polic','\x20assigned','padEnd','7861ZrhhVJ','4098cSuJHW','ies','2KJNxcT','getCurrent','length','👥\x20Assigned\x20Users','map','email','🔑\x20Effective\x20Permissions','description','policy\x20show','context','298310YPhcCb','No\x20policies\x20found','Account\x20Owner','user','operation','Listing\x20policies...','1133WwxkUT','site','bold','log','error','\x20—\x20','execute','\x20\x20\x20','all','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','verbose','9fOLjKD'];a32_0x32e0=function(){return _0x16d8ba;};return a32_0x32e0();}import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x5de950 from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x94f4c2(0x187)]=a32_0x94f4c2(0x178);[a32_0x94f4c2(0x15d)]='Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions';async[a32_0x94f4c2(0x16c)](_0x34e52c){const _0x1cd113=a32_0x94f4c2,{options:_0x539146,tdx:_0x19a834}=_0x34e52c,_0x31b93e=await withSpinner(_0x1cd113(0x177),async()=>{const _0x518d47=_0x1cd113,[_0x44b814,_0x16ebe5]=await Promise[_0x518d47(0x16e)]([_0x19a834[_0x518d47(0x163)][_0x518d47(0x157)](),_0x19a834[_0x518d47(0x178)][_0x518d47(0x179)]()]);return{'userInfo':_0x44b814,'permissions':_0x16ebe5};},{'verbose':_0x539146[_0x1cd113(0x170)]}),{userInfo:_0x535a36,permissions:_0x5ba1a3}=_0x31b93e['data'];if(isStructuredFormat(_0x539146))return await handleSingleObjectOutput(_0x5ba1a3,_0x539146),0x0;const _0x5b9271=_0x535a36['account_owner']?_0x1cd113(0x162):_0x535a36[_0x1cd113(0x18b)]?'Administrator':_0x1cd113(0x186);console[_0x1cd113(0x169)]('\x0a'+a32_0x5de950[_0x1cd113(0x168)]('👤')+'\x20'+a32_0x5de950[_0x1cd113(0x168)](_0x535a36['name'])+'\x20'+a32_0x5de950[_0x1cd113(0x182)]('('+_0x535a36[_0x1cd113(0x15b)]+')')+_0x1cd113(0x16b)+_0x5b9271),console['log'](a32_0x5de950[_0x1cd113(0x182)](_0x1cd113(0x16d)+_0x19a834[_0x1cd113(0x15f)][_0x1cd113(0x167)]+':'+_0x535a36[_0x1cd113(0x17b)]+',\x20user_id:'+_0x535a36['id']));const _0x2f4f46=_0x5ba1a3[_0x1cd113(0x173)];console[_0x1cd113(0x169)]('\x0a'+a32_0x5de950[_0x1cd113(0x168)](_0x1cd113(0x17f))+'\x20('+_0x2f4f46[_0x1cd113(0x158)]+'):');if(_0x2f4f46[_0x1cd113(0x158)]===0x0)console[_0x1cd113(0x169)](a32_0x5de950['dim'](_0x1cd113(0x185)));else for(const _0x239e26 of _0x2f4f46){console['log'](_0x1cd113(0x17e)+_0x239e26['name']);}return printPermissionsMap(_0x5ba1a3[_0x1cd113(0x183)]),console[_0x1cd113(0x169)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x94f4c2(0x187)]='policy\x20list';[a32_0x94f4c2(0x15d)]='List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)';async[a32_0x94f4c2(0x16c)](_0x135f1d){const _0x5912da=a32_0x94f4c2,{options:_0x31d2e4,tdx:_0x238468}=_0x135f1d,_0x439e25=await withSpinner(_0x5912da(0x165),()=>_0x238468['policy'][_0x5912da(0x184)](),{'verbose':_0x31d2e4[_0x5912da(0x170)]}),_0x4642ba=_0x439e25[_0x5912da(0x174)];console[_0x5912da(0x16a)](_0x5912da(0x17a)+_0x4642ba['length']+_0x5912da(0x18e)+(_0x4642ba['length']!==0x1?_0x5912da(0x193):'y'));if(isStructuredFormat(_0x31d2e4))return await handleSDKOutput(_0x4642ba,_0x31d2e4),0x0;if(_0x4642ba[_0x5912da(0x158)]===0x0)console[_0x5912da(0x169)](a32_0x5de950[_0x5912da(0x182)](_0x5912da(0x161)));else for(const _0x2e1595 of _0x4642ba){const _0x2e855b=_0x2e1595[_0x5912da(0x15d)]?a32_0x5de950[_0x5912da(0x182)](_0x5912da(0x16b)+_0x2e1595[_0x5912da(0x15d)]):'';console['log'](_0x5912da(0x17e)+_0x2e1595[_0x5912da(0x187)]+_0x2e855b);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x94f4c2(0x187)]=a32_0x94f4c2(0x15e);[a32_0x94f4c2(0x15d)]=a32_0x94f4c2(0x16f);['validate'](_0x5793dd){const _0x47135b=a32_0x94f4c2;if(_0x5793dd['args'][_0x47135b(0x158)]===0x0)return _0x47135b(0x17d);return undefined;}async['execute'](_0x10d8b1){const _0x4cd0ed=a32_0x94f4c2,{options:_0xa84f1,tdx:_0x1c6047}=_0x10d8b1,_0x2a295d=_0x10d8b1[_0x4cd0ed(0x18c)][0x0],_0x5113e3=await withSpinner(_0x4cd0ed(0x175),async()=>{const _0x548c8e=_0x4cd0ed,_0x5a2620=await _0x1c6047['policy'][_0x548c8e(0x188)](_0x2a295d),[_0x145717,_0x589164]=await Promise[_0x548c8e(0x16e)]([_0x1c6047[_0x548c8e(0x178)][_0x548c8e(0x180)](_0x5a2620['id']),_0x1c6047['policy']['getPolicyUsers'](_0x5a2620['id'])]);return{'policy':_0x5a2620,'perms':_0x145717,'users':_0x589164};},{'verbose':_0xa84f1[_0x4cd0ed(0x170)]}),{policy:_0x5e0eca,perms:_0x3d608d,users:_0x3bd85a}=_0x5113e3[_0x4cd0ed(0x174)];if(isStructuredFormat(_0xa84f1))return await handleSingleObjectOutput({..._0x5e0eca,'permissions':_0x3d608d[_0x4cd0ed(0x183)],'users':_0x3bd85a},_0xa84f1),0x0;console[_0x4cd0ed(0x169)]('\x0a'+a32_0x5de950[_0x4cd0ed(0x168)]('📋')+'\x20'+a32_0x5de950[_0x4cd0ed(0x168)](_0x5e0eca[_0x4cd0ed(0x187)])+'\x20'+a32_0x5de950[_0x4cd0ed(0x182)](_0x4cd0ed(0x189)+_0x5e0eca['id']+')'));_0x5e0eca['description']&&console[_0x4cd0ed(0x169)](_0x4cd0ed(0x16d)+a32_0x5de950[_0x4cd0ed(0x182)](_0x5e0eca[_0x4cd0ed(0x15d)]));console[_0x4cd0ed(0x169)](_0x4cd0ed(0x16d)+_0x3bd85a[_0x4cd0ed(0x158)]+_0x4cd0ed(0x172)+(_0x3bd85a[_0x4cd0ed(0x158)]!==0x1?'s':'')+_0x4cd0ed(0x18f)),printPermissionsMap(_0x3d608d[_0x4cd0ed(0x183)]);if(_0x3bd85a[_0x4cd0ed(0x158)]>0x0){console[_0x4cd0ed(0x169)]('\x0a'+a32_0x5de950['bold'](_0x4cd0ed(0x159))+':');for(const _0x486946 of _0x3bd85a){const _0x2e6d14=_0x486946['email']&&_0x486946[_0x4cd0ed(0x15b)]!==_0x486946[_0x4cd0ed(0x187)]?a32_0x5de950[_0x4cd0ed(0x182)]('\x20<'+_0x486946[_0x4cd0ed(0x15b)]+'>'):'';console[_0x4cd0ed(0x169)](_0x4cd0ed(0x17e)+_0x486946['name']+_0x2e6d14);}}return console[_0x4cd0ed(0x169)](),0x0;}}function printPermissionsMap(_0x4fd94c){const _0xc93b0b=a32_0x94f4c2,_0x21c3a5=Object['entries'](_0x4fd94c);console[_0xc93b0b(0x169)]('\x0a'+a32_0x5de950[_0xc93b0b(0x168)](_0xc93b0b(0x15c))+':');if(_0x21c3a5[_0xc93b0b(0x158)]===0x0){console[_0xc93b0b(0x169)](a32_0x5de950[_0xc93b0b(0x182)]('\x20\x20No\x20permissions'));return;}const _0x24ea3b=Math['max'](..._0x21c3a5[_0xc93b0b(0x15a)](([_0x2b5b63])=>_0x2b5b63[_0xc93b0b(0x158)]));for(const [_0x271a59,_0x184924]of _0x21c3a5){const _0x2cbbfb=formatOperations(_0x184924);console[_0xc93b0b(0x169)]('\x20\x20'+_0x271a59[_0xc93b0b(0x190)](_0x24ea3b+0x2)+_0x2cbbfb);}}function formatOperations(_0x22f64e){const _0x4578e1=a32_0x94f4c2,_0xf1b6c8=[...new Set(_0x22f64e['map'](_0x5beb0e=>_0x5beb0e[_0x4578e1(0x164)]))];return _0xf1b6c8['join'](',\x20');}
@@ -1 +1 @@
1
- const a33_0x3cbd72=a33_0x4c07;(function(_0x59efc4,_0x5cd1e4){const _0x188e15=a33_0x4c07,_0x1a9c9a=_0x59efc4();while(!![]){try{const _0x45edc5=parseInt(_0x188e15(0x137))/0x1*(parseInt(_0x188e15(0xf6))/0x2)+parseInt(_0x188e15(0x119))/0x3*(-parseInt(_0x188e15(0x128))/0x4)+parseInt(_0x188e15(0x101))/0x5+parseInt(_0x188e15(0x13a))/0x6*(-parseInt(_0x188e15(0x123))/0x7)+-parseInt(_0x188e15(0x145))/0x8*(parseInt(_0x188e15(0xe2))/0x9)+-parseInt(_0x188e15(0x139))/0xa*(-parseInt(_0x188e15(0x115))/0xb)+parseInt(_0x188e15(0x112))/0xc*(-parseInt(_0x188e15(0xd8))/0xd);if(_0x45edc5===_0x5cd1e4)break;else _0x1a9c9a['push'](_0x1a9c9a['shift']());}catch(_0x39dd4b){_0x1a9c9a['push'](_0x1a9c9a['shift']());}}}(a33_0x1248,0xb225e));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_0x13e30c 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_0x41c73a from'prompts';function a33_0x4c07(_0x124c02,_0x3f2c8b){_0x124c02=_0x124c02-0xd7;const _0x12484f=a33_0x1248();let _0x4c07f1=_0x12484f[_0x124c02];return _0x4c07f1;}import a33_0x421c5f from'chalk';function validateProfileName(_0x303481,_0xf6f802){const _0x591930=a33_0x4c07;if(!_0x303481||!_0x303481[_0x591930(0xf5)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x196b99=_0x303481['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x591930(0x131)](_0x196b99))return _0x591930(0x136);if(!_0xf6f802?.[_0x591930(0xde)]&&profileExists(_0x196b99))return'Profile\x20\x27'+_0x196b99+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20'+_0x196b99+'\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.';return!![];}async function deleteProfileAndCredentials(_0x133695){const _0xda51af=a33_0x4c07;removeProfileFromUserConfig(_0x133695);const _0x2d9dfe=await isKeychainAvailable();_0x2d9dfe&&await Promise[_0xda51af(0x133)]([deleteKeychainAPIKey(_0x133695),deleteOAuthTokens(_0x133695)]);}function a33_0x1248(){const _0x10c9d4=['green','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','Changing\x20site\x20to\x20\x27','✗\x20Validation\x20failed:\x20','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>','warn','bold','profile:delete','/app/mp/ak','8SnQEVX','session','26txQAYJ','profileName','\x20\x20-\x20','error','profile','\x20\x20tdx\x20--profile\x20','skipExistsCheck','You\x20can\x20find\x20your\x20API\x20key\x20at:','Set\x20a\x20profile\x20configuration\x20value','length','483705RznNJA','name','getUserInfo','\x20API\x20key\x20saved\x20to\x20system\x20keychain','tdx.json','\x0aSetup\x20cancelled','red','Enter\x20description\x20(optional):','Site\x20was\x20not\x20changed.','\x27\x20does\x20not\x20exist.','Removal\x20cancelled','\x0aAvailable\x20profiles:','\x0aOperation\x20cancelled','ERROR','llm_agent','config','\x27\x20deleted','split','message','trim','2197746ffPErc','password','\x27\x20requires\x20API\x20key\x20validation.','tdx:\x20profile\x20delete','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','dim','\x27.\x0a\x0aValid\x20keys:\x20','status','parent_segment','confirm','validate','2839410dAAqTi','default','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','database','execute','Enter\x20your\x20TD\x20API\x20key:','text','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','\x20\x20(no\x20profiles\x20found)','llm_project','includes','Profile\x20\x27','Validating\x20API\x20key...','Default\x20profile\x20set\x20to:\x20','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Delete\x20a\x20profile','369312OhZpar','apiKey','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','11xFIBkB','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Create\x20a\x20new\x20profile','description','285AmHnfd','yellow','\x20--default\x27\x20to\x20save\x20permanently','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Setup\x20cancelled','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x27\x20created','jobs','profile:set','force','7784938kDgcqI','\x20API\x20key\x20is\x20valid\x20(User:\x20','Unknown\x20key\x20\x27','tdx:\x20profile\x20create','API\x20key\x20cannot\x20be\x20empty','24916KZTxoJ','Enter\x20profile\x20name:','site','\x20Profile\x20\x27','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','oauth','profile:create','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','VALID_KEYS','test','log','all','(cleared)','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','1NVzEuc','create','8821250WnqJZq','6JPTxTS','join'];a33_0x1248=function(){return _0x10c9d4;};return a33_0x1248();}export class ProfileCreateCommand extends BaseCommand{[a33_0x3cbd72(0xe3)]=a33_0x3cbd72(0x12e);[a33_0x3cbd72(0x118)]=a33_0x3cbd72(0x117);async[a33_0x3cbd72(0x106)](_0x53ccb3){const _0x5ae08f=a33_0x3cbd72,{options:_0x40b007,args:_0x2eb88d}=_0x53ccb3,_0x312400=!!_0x40b007[_0x5ae08f(0x122)];console[_0x5ae08f(0x132)](a33_0x421c5f[_0x5ae08f(0x142)](_0x5ae08f(0x126)));let _0x22d8d3;if(_0x2eb88d['length']>0x0&&_0x2eb88d[0x0]){const _0x1c4b04=_0x2eb88d[0x0]['trim']();_0x312400&&profileExists(_0x1c4b04)&&(await deleteProfileAndCredentials(_0x1c4b04),console['log']('Removed\x20existing\x20profile\x20\x27'+_0x1c4b04+'\x27'));const _0x3dfa53=validateProfileName(_0x1c4b04);if(_0x3dfa53!==!![])return console[_0x5ae08f(0xdb)](a33_0x421c5f[_0x5ae08f(0xe8)](_0x3dfa53)),0x1;_0x22d8d3=_0x1c4b04;}else{const _0x360f24=await a33_0x41c73a({'type':_0x5ae08f(0x108),'name':'profileName','message':_0x5ae08f(0x129),'validate':_0x591ac1=>validateProfileName(_0x591ac1,{'skipExistsCheck':_0x312400})});if(!_0x360f24[_0x5ae08f(0xd9)])return console[_0x5ae08f(0x132)]('\x0aSetup\x20cancelled'),0x1;_0x22d8d3=_0x360f24[_0x5ae08f(0xd9)][_0x5ae08f(0xf5)](),_0x312400&&profileExists(_0x22d8d3)&&(await deleteProfileAndCredentials(_0x22d8d3),console[_0x5ae08f(0x132)]('Removed\x20existing\x20profile\x20\x27'+_0x22d8d3+'\x27'));}const _0x18d044=await a33_0x41c73a({'type':'text','name':_0x5ae08f(0x118),'message':_0x5ae08f(0xe9)}),_0x5eb6aa=_0x18d044[_0x5ae08f(0x118)]?.[_0x5ae08f(0xf5)]()||undefined,_0x1c82b4=_0x40b007['site']||'us01',_0xf8faa5=await promptSiteSelection(_0x1c82b4,_0x22d8d3,_0x5ae08f(0x11d));if(!_0xf8faa5)return 0x1;const _0x374d11=resolveSite(_0xf8faa5),_0x480f5b=await promptAuthMethod();if(!_0x480f5b)return console['log'](_0x5ae08f(0xe7)),0x1;if(_0x480f5b===_0x5ae08f(0x12d)){if(_0x5eb6aa){const _0x32a576={'site':_0x374d11,'description':_0x5eb6aa};saveProfileToUserConfig(_0x22d8d3,_0x32a576);}const {accountName:_0x54fc1e}=_0x40b007;return await runOAuthLoginFlow(_0x374d11,_0x22d8d3,_0x40b007['logLevel']??LogLevel[_0x5ae08f(0xef)],{'accountName':_0x54fc1e}),0x0;}console[_0x5ae08f(0x132)](_0x5ae08f(0xfa)+_0x374d11),console[_0x5ae08f(0x132)](_0x5ae08f(0xdf)),console[_0x5ae08f(0x132)]('\x20\x20'+getConsoleUrl(_0x374d11,'/app/mp/ak'));const _0x225f02=await a33_0x41c73a({'type':_0x5ae08f(0xf7),'name':_0x5ae08f(0x113),'message':_0x5ae08f(0x107),'validate':_0x55b0e4=>{const _0x434d89=_0x5ae08f;if(!_0x55b0e4||!_0x55b0e4[_0x434d89(0xf5)]())return _0x434d89(0x127);return!![];}});if(!_0x225f02['apiKey'])return console[_0x5ae08f(0x132)](_0x5ae08f(0xe7)),0x1;const _0x4b8dc8=_0x225f02['apiKey'];console[_0x5ae08f(0x132)](_0x5ae08f(0x10e));try{const _0x2c2d49=TDX[_0x5ae08f(0x138)]({'site':_0x374d11,'apiKey':_0x4b8dc8[_0x5ae08f(0xf5)](),'logLevel':_0x40b007['logLevel']??LogLevel['ERROR']}),_0x5a2e79=await _0x2c2d49['jobs'][_0x5ae08f(0xe4)]();console[_0x5ae08f(0x132)](a33_0x421c5f[_0x5ae08f(0x13c)]('✓')+_0x5ae08f(0x124)+_0x5a2e79['email']+')');const _0x5b8d9c=await isKeychainAvailable();_0x5b8d9c?(await saveAPIKeyAsync(_0x4b8dc8[_0x5ae08f(0xf5)](),_0x374d11,_0x22d8d3),console['log'](a33_0x421c5f[_0x5ae08f(0x13c)]('✓')+_0x5ae08f(0x110)+_0x22d8d3+')')):(console[_0x5ae08f(0x141)](a33_0x421c5f[_0x5ae08f(0x11a)](_0x5ae08f(0x11e))),console[_0x5ae08f(0x141)](a33_0x421c5f[_0x5ae08f(0x11a)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x2f5b5e={'site':_0x374d11,..._0x5eb6aa&&{'description':_0x5eb6aa}};return saveProfileToUserConfig(_0x22d8d3,_0x2f5b5e),console[_0x5ae08f(0x132)](a33_0x421c5f['green']('✓')+_0x5ae08f(0x12b)+_0x22d8d3+_0x5ae08f(0x11f)),console[_0x5ae08f(0x132)](),console[_0x5ae08f(0x132)](_0x5ae08f(0x13d)),console[_0x5ae08f(0x132)](_0x5ae08f(0xdd)+_0x22d8d3+_0x5ae08f(0x116)),console[_0x5ae08f(0x132)](_0x5ae08f(0xdd)+_0x22d8d3+_0x5ae08f(0x104)),0x0;}catch(_0x1717b3){if(_0x1717b3 instanceof HTTPClientError&&_0x1717b3[_0x5ae08f(0xfd)]===0x191)return printAuthError(_0x1717b3),0x1;return console[_0x5ae08f(0xdb)](a33_0x421c5f[_0x5ae08f(0xe8)](_0x5ae08f(0x13f)+(_0x1717b3 instanceof Error?_0x1717b3[_0x5ae08f(0xf4)]:String(_0x1717b3)))),console[_0x5ae08f(0xdb)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x3cbd72(0xe3)]=a33_0x3cbd72(0x143);[a33_0x3cbd72(0x118)]=a33_0x3cbd72(0x111);[a33_0x3cbd72(0x100)](_0x43c60d){const _0x3c8bf3=a33_0x3cbd72,{args:_0x3744ae}=_0x43c60d;if(_0x3744ae['length']===0x0)return _0x3c8bf3(0x109);return undefined;}async[a33_0x3cbd72(0x106)](_0x1ebc49){const _0x2a90e8=a33_0x3cbd72,{args:_0x867774}=_0x1ebc49,_0x1b0e56=_0x867774[0x0];console['log'](a33_0x421c5f[_0x2a90e8(0x142)](_0x2a90e8(0xf9)));if(!profileExists(_0x1b0e56)){console['error'](a33_0x421c5f[_0x2a90e8(0xe8)]('Profile\x20\x27'+_0x1b0e56+_0x2a90e8(0xeb))),console[_0x2a90e8(0x132)](_0x2a90e8(0xed));const _0x32397c=listProfiles();if(_0x32397c['length']===0x0)console['log'](_0x2a90e8(0x10a));else for(const _0x18ad4c of _0x32397c){console['log']('\x20\x20-\x20'+_0x18ad4c[_0x2a90e8(0xe3)]);}return 0x1;}const _0x300b86=await a33_0x41c73a({'type':'confirm','name':_0x2a90e8(0xff),'message':_0x2a90e8(0x12c)+_0x1b0e56+'\x27?','initial':![]});if(!_0x300b86[_0x2a90e8(0xff)])return console[_0x2a90e8(0x132)](_0x2a90e8(0xec)),0x0;try{await deleteProfileAndCredentials(_0x1b0e56),console['log'](a33_0x421c5f['green']('✓')+_0x2a90e8(0x12b)+_0x1b0e56+_0x2a90e8(0xf2));}catch(_0x11270f){return console[_0x2a90e8(0xdb)](a33_0x421c5f[_0x2a90e8(0xe8)]('Failed\x20to\x20delete\x20profile:\x20'+(_0x11270f instanceof Error?_0x11270f[_0x2a90e8(0xf4)]:String(_0x11270f)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a33_0x3cbd72(0x121);[a33_0x3cbd72(0x118)]=a33_0x3cbd72(0xe0);static [a33_0x3cbd72(0x130)]=['site',a33_0x3cbd72(0x105),a33_0x3cbd72(0xfe),a33_0x3cbd72(0x10b),a33_0x3cbd72(0xf0),a33_0x3cbd72(0x118)];['validate'](_0x3574ac){const _0x562ea2=a33_0x3cbd72,{args:_0x39d188,options:_0x1b1ade}=_0x3574ac,_0x361cf0=_0x1b1ade[_0x562ea2(0xdc)]||getActiveProfile();if(!_0x361cf0)return _0x562ea2(0x140);if(_0x39d188[_0x562ea2(0xe1)]===0x0)return _0x562ea2(0x12f)+ProfileSetCommand[_0x562ea2(0x130)][_0x562ea2(0x13b)](',\x20');const _0x7e207b=_0x39d188[0x0];if(!_0x7e207b[_0x562ea2(0x10c)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x562ea2(0x130)][_0x562ea2(0x13b)](',\x20');const [_0x3d45d7]=_0x7e207b['split']('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x562ea2(0x10c)](_0x3d45d7))return _0x562ea2(0x125)+_0x3d45d7+_0x562ea2(0xfc)+ProfileSetCommand['VALID_KEYS'][_0x562ea2(0x13b)](',\x20');return undefined;}async[a33_0x3cbd72(0x106)](_0x28dc5d){const _0x47de81=a33_0x3cbd72,{args:_0x477d53,options:_0x468747}=_0x28dc5d,_0x23e6fa=_0x468747[_0x47de81(0xdc)]||getActiveProfile(),[_0x38f676,..._0x1f804a]=_0x477d53[0x0][_0x47de81(0xf3)]('='),_0x53f8d7=_0x1f804a['join']('=');console[_0x47de81(0x132)](a33_0x421c5f[_0x47de81(0x142)]('tdx:\x20profile\x20set'));if(!profileExists(_0x23e6fa)){const _0xec8507=await a33_0x41c73a({'type':'confirm','name':_0x47de81(0x138),'message':_0x47de81(0x10d)+_0x23e6fa+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0xec8507['create'])return console[_0x47de81(0x132)]('Operation\x20cancelled'),0x1;}const _0x2d8da3=loadProfile(_0x23e6fa),_0x54ea5d=_0x2d8da3?.[_0x47de81(0xf1)]||{};if(_0x38f676===_0x47de81(0x12a)){const _0x1d7ad2=resolveSite(_0x53f8d7);console['log'](_0x47de81(0x13e)+_0x1d7ad2+_0x47de81(0xf8)),console[_0x47de81(0x132)](_0x47de81(0x11c)),console[_0x47de81(0x132)]('\x20\x20'+getConsoleUrl(_0x1d7ad2,_0x47de81(0x144)));const _0x251d61=await a33_0x41c73a({'type':_0x47de81(0xf7),'name':'apiKey','message':_0x47de81(0x103),'validate':_0x32f0bd=>{const _0x7d1841=_0x47de81;if(!_0x32f0bd||!_0x32f0bd[_0x7d1841(0xf5)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x251d61[_0x47de81(0x113)])return console['log'](_0x47de81(0xee)),0x1;console[_0x47de81(0x132)](_0x47de81(0x10e));try{const _0xb22d3=TDX[_0x47de81(0x138)]({'site':_0x1d7ad2,'apiKey':_0x251d61[_0x47de81(0x113)]['trim'](),'logLevel':_0x468747['logLevel']??LogLevel[_0x47de81(0xef)]}),_0x2b230b=await _0xb22d3[_0x47de81(0x120)]['getUserInfo']();console[_0x47de81(0x132)](a33_0x421c5f[_0x47de81(0x13c)]('✓')+_0x47de81(0x124)+_0x2b230b['email']+')');const _0x56631b=await isKeychainAvailable();_0x56631b?(await saveAPIKeyAsync(_0x251d61[_0x47de81(0x113)][_0x47de81(0xf5)](),_0x1d7ad2,_0x23e6fa),console[_0x47de81(0x132)](a33_0x421c5f[_0x47de81(0x13c)]('✓')+_0x47de81(0xe5))):console[_0x47de81(0x141)](a33_0x421c5f[_0x47de81(0x11a)](_0x47de81(0x11e))),_0x54ea5d[_0x47de81(0x12a)]=_0x1d7ad2;}catch(_0x3eb02d){if(_0x3eb02d instanceof HTTPClientError&&_0x3eb02d['status']===0x191)return printAuthError(_0x3eb02d),0x1;return console['error'](a33_0x421c5f['red'](_0x47de81(0x13f)+(_0x3eb02d instanceof Error?_0x3eb02d['message']:String(_0x3eb02d)))),console[_0x47de81(0xdb)](_0x47de81(0xea)),0x1;}}else _0x54ea5d[_0x38f676]=_0x53f8d7||undefined;return saveProfileToUserConfig(_0x23e6fa,_0x54ea5d),console[_0x47de81(0x132)](a33_0x421c5f['green']('✓')+_0x47de81(0x12b)+_0x23e6fa+'\x27\x20updated:\x20'+_0x38f676+'='+(_0x53f8d7||_0x47de81(0x134))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x3cbd72(0xe3)]='profile:use';[a33_0x3cbd72(0x118)]='Set\x20session\x20profile';[a33_0x3cbd72(0x100)](_0x17a07e){const _0x575d17=a33_0x3cbd72,{args:_0x2003cb}=_0x17a07e;if(_0x2003cb[_0x575d17(0xe1)]===0x0)return _0x575d17(0x114);return undefined;}async[a33_0x3cbd72(0x106)](_0x29ce37){const _0x14d53d=a33_0x3cbd72,{args:_0x5b33ed,options:_0x10ce0e}=_0x29ce37,_0x5ad9c2=_0x5b33ed[0x0],_0x371bb0=_0x10ce0e[_0x14d53d(0x102)];cleanExpiredSessions();if(!profileExists(_0x5ad9c2)){console[_0x14d53d(0xdb)](a33_0x421c5f[_0x14d53d(0xe8)](_0x14d53d(0x10d)+_0x5ad9c2+_0x14d53d(0xeb))),console[_0x14d53d(0x132)](_0x14d53d(0xed));const _0x36dddd=listProfiles();if(_0x36dddd[_0x14d53d(0xe1)]===0x0)console[_0x14d53d(0x132)]('\x20\x20(no\x20profiles\x20found)');else for(const _0xc9b8c4 of _0x36dddd){console[_0x14d53d(0x132)](_0x14d53d(0xda)+_0xc9b8c4[_0x14d53d(0xe3)]);}return 0x1;}if(_0x371bb0){const _0x19d04c=a33_0x13e30c[_0x14d53d(0x13b)](getConfigDir(),_0x14d53d(0xe6));return saveActiveProfileToUserConfig(_0x5ad9c2),console[_0x14d53d(0x132)](_0x14d53d(0x10f)+a33_0x421c5f[_0x14d53d(0x13c)](_0x5ad9c2)),console[_0x14d53d(0x132)](a33_0x421c5f[_0x14d53d(0xfb)]('\x0aSaved\x20to:\x20'+_0x19d04c)),0x0;}const _0x399db7=getSessionID(_0x10ce0e[_0x14d53d(0xd7)]);return saveSessionContext({'profile':_0x5ad9c2},_0x10ce0e['session']),console['log']('Session\x20profile\x20set\x20to:\x20'+a33_0x421c5f[_0x14d53d(0x13c)](_0x5ad9c2)+'\x20'+a33_0x421c5f[_0x14d53d(0xfb)]('(session:\x20'+_0x399db7+')')),console[_0x14d53d(0x132)](a33_0x421c5f[_0x14d53d(0xfb)](_0x14d53d(0x135)+_0x5ad9c2+_0x14d53d(0x11b))),0x0;}}
1
+ const a33_0x1f0f47=a33_0x4166;(function(_0x411e3e,_0x39aa3c){const _0x2590db=a33_0x4166,_0x1073b3=_0x411e3e();while(!![]){try{const _0x2ab6da=parseInt(_0x2590db(0x19a))/0x1*(-parseInt(_0x2590db(0x1bf))/0x2)+-parseInt(_0x2590db(0x1ba))/0x3*(-parseInt(_0x2590db(0x18a))/0x4)+-parseInt(_0x2590db(0x161))/0x5+-parseInt(_0x2590db(0x163))/0x6+parseInt(_0x2590db(0x19b))/0x7+-parseInt(_0x2590db(0x1a1))/0x8*(parseInt(_0x2590db(0x1a6))/0x9)+parseInt(_0x2590db(0x1c1))/0xa;if(_0x2ab6da===_0x39aa3c)break;else _0x1073b3['push'](_0x1073b3['shift']());}catch(_0x50f2f5){_0x1073b3['push'](_0x1073b3['shift']());}}}(a33_0x5f57,0x3e178));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a33_0x42b56b from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';function a33_0x4166(_0x34e25f,_0x572401){_0x34e25f=_0x34e25f-0x15f;const _0x5f57ee=a33_0x5f57();let _0x4166a7=_0x5f57ee[_0x34e25f];return _0x4166a7;}import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}from'../core/constants.js';function a33_0x5f57(){const _0x44f679=['jobs','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x20API\x20key\x20saved\x20to\x20system\x20keychain','test','Unknown\x20key\x20\x27','Enter\x20description\x20(optional):','error','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','Delete\x20a\x20profile','Changing\x20site\x20to\x20\x27','\x0aOperation\x20cancelled','Enter\x20your\x20TD\x20API\x20key:','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','Site\x20was\x20not\x20changed.','Create\x20a\x20new\x20profile','tdx.json','length','dim','\x27\x20updated:\x20','(cleared)','logLevel','API\x20key\x20cannot\x20be\x20empty','status','\x27\x20created','session','green','tdx:\x20profile\x20set','profileName','create','\x0aSetup\x20cancelled','\x27.\x0a\x0aValid\x20keys:\x20','bold','skipExistsCheck','(session:\x20','includes','join','\x20\x20tdx\x20--profile\x20','1552568OUAazP','red','text','Profile\x20\x27','confirm','Session\x20profile\x20set\x20to:\x20','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','trim','\x27\x20deleted','Enter\x20profile\x20name:','config','tdx:\x20profile\x20create','ERROR','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','force','llm_agent','11047wGdLbY','2448964gUZofq','apiKey','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Validating\x20API\x20key...','\x20Profile\x20\x27','getUserInfo','656EvjYoh','Failed\x20to\x20delete\x20profile:\x20','parent_segment','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','13347QYfjOj','split','VALID_KEYS','\x20API\x20key\x20is\x20valid\x20(User:\x20','Default\x20profile\x20set\x20to:\x20','execute','✗\x20Validation\x20failed:\x20','\x0aSaved\x20to:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','Profile\x20name\x20cannot\x20be\x20empty','log','description','\x20\x20(no\x20profiles\x20found)','Removed\x20existing\x20profile\x20\x27','message','us01','Set\x20session\x20profile','yellow','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','email','3BRpHVN','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','\x0aAvailable\x20profiles:','profile','validate','50vuyNKe','/app/mp/ak','8094740VfvrDC','\x20\x20-\x20','\x27\x20does\x20not\x20exist.','all','site','profile:use','Setup\x20cancelled','Operation\x20cancelled','profile:set','password','\x27\x20does\x20not\x20exist.\x20Create\x20it?','name','Removal\x20cancelled','database','2186690HxlMJg','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','2748126STjxhp','tdx:\x20profile\x20delete'];a33_0x5f57=function(){return _0x44f679;};return a33_0x5f57();}import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a33_0x123a5f from'prompts';import a33_0x58e680 from'chalk';function validateProfileName(_0x13c731,_0x511345){const _0x1d3da2=a33_0x4166;if(!_0x13c731||!_0x13c731[_0x1d3da2(0x191)]())return _0x1d3da2(0x1af);const _0x1499fd=_0x13c731[_0x1d3da2(0x191)]();if(!/^[a-zA-Z0-9_-]+$/[_0x1d3da2(0x168)](_0x1499fd))return _0x1d3da2(0x1a5);if(!_0x511345?.[_0x1d3da2(0x185)]&&profileExists(_0x1499fd))return _0x1d3da2(0x18d)+_0x1499fd+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20'+_0x1499fd+'\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.';return!![];}async function deleteProfileAndCredentials(_0x253613){const _0x1d6d37=a33_0x4166;removeProfileFromUserConfig(_0x253613);const _0x103005=await isKeychainAvailable();_0x103005&&await Promise[_0x1d6d37(0x1c4)]([deleteKeychainAPIKey(_0x253613),deleteOAuthTokens(_0x253613)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x1f0f47(0x1cc)]='profile:create';['description']=a33_0x1f0f47(0x173);async[a33_0x1f0f47(0x1ab)](_0x3686ef){const _0x205a15=a33_0x1f0f47,{options:_0x5a1e31,args:_0x1f1f07}=_0x3686ef,_0x130c23=!!_0x5a1e31[_0x205a15(0x198)];console[_0x205a15(0x1b0)](a33_0x58e680[_0x205a15(0x184)](_0x205a15(0x195)));let _0x1feb56;if(_0x1f1f07['length']>0x0&&_0x1f1f07[0x0]){const _0x299102=_0x1f1f07[0x0]['trim']();_0x130c23&&profileExists(_0x299102)&&(await deleteProfileAndCredentials(_0x299102),console[_0x205a15(0x1b0)](_0x205a15(0x1b3)+_0x299102+'\x27'));const _0x53f628=validateProfileName(_0x299102);if(_0x53f628!==!![])return console['error'](a33_0x58e680[_0x205a15(0x18b)](_0x53f628)),0x1;_0x1feb56=_0x299102;}else{const _0x2d9fa1=await a33_0x123a5f({'type':_0x205a15(0x18c),'name':_0x205a15(0x180),'message':_0x205a15(0x193),'validate':_0x4bde71=>validateProfileName(_0x4bde71,{'skipExistsCheck':_0x130c23})});if(!_0x2d9fa1[_0x205a15(0x180)])return console[_0x205a15(0x1b0)]('\x0aSetup\x20cancelled'),0x1;_0x1feb56=_0x2d9fa1[_0x205a15(0x180)][_0x205a15(0x191)](),_0x130c23&&profileExists(_0x1feb56)&&(await deleteProfileAndCredentials(_0x1feb56),console[_0x205a15(0x1b0)]('Removed\x20existing\x20profile\x20\x27'+_0x1feb56+'\x27'));}const _0x23ba17=await a33_0x123a5f({'type':_0x205a15(0x18c),'name':_0x205a15(0x1b1),'message':_0x205a15(0x16a)}),_0x3c9a9b=_0x23ba17['description']?.[_0x205a15(0x191)]()||undefined,_0x55be6f=_0x5a1e31['site']||_0x205a15(0x1b5),_0xef2b43=await promptSiteSelection(_0x55be6f,_0x1feb56,_0x205a15(0x1c7));if(!_0xef2b43)return 0x1;const _0x5adf68=resolveSite(_0xef2b43),_0x536005=await promptAuthMethod();if(!_0x536005)return console[_0x205a15(0x1b0)](_0x205a15(0x182)),0x1;if(_0x536005==='oauth'){if(_0x3c9a9b){const _0x26141b={'site':_0x5adf68,'description':_0x3c9a9b};saveProfileToUserConfig(_0x1feb56,_0x26141b);}const {accountName:_0x43f53e}=_0x5a1e31;return await runOAuthLoginFlow(_0x5adf68,_0x1feb56,_0x5a1e31['logLevel']??LogLevel['ERROR'],{'accountName':_0x43f53e}),0x0;}console[_0x205a15(0x1b0)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x5adf68),console['log']('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x205a15(0x1b0)]('\x20\x20'+getConsoleUrl(_0x5adf68,_0x205a15(0x1c0)));const _0x18e4db=await a33_0x123a5f({'type':_0x205a15(0x1ca),'name':'apiKey','message':_0x205a15(0x170),'validate':_0x396734=>{const _0x513c6d=_0x205a15;if(!_0x396734||!_0x396734['trim']())return _0x513c6d(0x17a);return!![];}});if(!_0x18e4db[_0x205a15(0x19c)])return console[_0x205a15(0x1b0)](_0x205a15(0x182)),0x1;const _0x2ced7e=_0x18e4db[_0x205a15(0x19c)];console[_0x205a15(0x1b0)](_0x205a15(0x19e));try{const _0xe8cef5=TDX[_0x205a15(0x181)]({'site':_0x5adf68,'apiKey':_0x2ced7e[_0x205a15(0x191)](),'logLevel':_0x5a1e31[_0x205a15(0x179)]??LogLevel['ERROR']}),_0x38ee2f=await _0xe8cef5[_0x205a15(0x165)][_0x205a15(0x1a0)]();console[_0x205a15(0x1b0)](a33_0x58e680[_0x205a15(0x17e)]('✓')+_0x205a15(0x1a9)+_0x38ee2f[_0x205a15(0x1b9)]+')');const _0x85c60d=await isKeychainAvailable();_0x85c60d?(await saveAPIKeyAsync(_0x2ced7e[_0x205a15(0x191)](),_0x5adf68,_0x1feb56),console['log'](a33_0x58e680[_0x205a15(0x17e)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x1feb56+')')):(console['warn'](a33_0x58e680[_0x205a15(0x1b7)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console['warn'](a33_0x58e680[_0x205a15(0x1b7)](_0x205a15(0x190))));const _0x1501f0={'site':_0x5adf68,..._0x3c9a9b&&{'description':_0x3c9a9b}};return saveProfileToUserConfig(_0x1feb56,_0x1501f0),console[_0x205a15(0x1b0)](a33_0x58e680[_0x205a15(0x17e)]('✓')+_0x205a15(0x19f)+_0x1feb56+_0x205a15(0x17c)),console['log'](),console[_0x205a15(0x1b0)](_0x205a15(0x1b8)),console[_0x205a15(0x1b0)](_0x205a15(0x189)+_0x1feb56+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x205a15(0x1b0)]('\x20\x20tdx\x20--profile\x20'+_0x1feb56+_0x205a15(0x1a4)),0x0;}catch(_0x39722e){if(_0x39722e instanceof HTTPClientError&&_0x39722e[_0x205a15(0x17b)]===0x191)return printAuthError(_0x39722e),0x1;return console['error'](a33_0x58e680[_0x205a15(0x18b)]('✗\x20Validation\x20failed:\x20'+(_0x39722e instanceof Error?_0x39722e[_0x205a15(0x1b4)]:String(_0x39722e)))),console[_0x205a15(0x16b)](_0x205a15(0x19d)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{['name']='profile:delete';['description']=a33_0x1f0f47(0x16d);[a33_0x1f0f47(0x1be)](_0x5477e4){const _0x507c8d=a33_0x1f0f47,{args:_0x2798ed}=_0x5477e4;if(_0x2798ed[_0x507c8d(0x175)]===0x0)return _0x507c8d(0x1bb);return undefined;}async[a33_0x1f0f47(0x1ab)](_0x256f68){const _0x46a574=a33_0x1f0f47,{args:_0x4c37f2}=_0x256f68,_0x2756f2=_0x4c37f2[0x0];console[_0x46a574(0x1b0)](a33_0x58e680[_0x46a574(0x184)](_0x46a574(0x164)));if(!profileExists(_0x2756f2)){console['error'](a33_0x58e680[_0x46a574(0x18b)](_0x46a574(0x18d)+_0x2756f2+_0x46a574(0x1c3))),console[_0x46a574(0x1b0)](_0x46a574(0x1bc));const _0x11c655=listProfiles();if(_0x11c655[_0x46a574(0x175)]===0x0)console[_0x46a574(0x1b0)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x1f200e of _0x11c655){console[_0x46a574(0x1b0)](_0x46a574(0x1c2)+_0x1f200e['name']);}return 0x1;}const _0x5ef1fc=await a33_0x123a5f({'type':_0x46a574(0x18e),'name':_0x46a574(0x18e),'message':_0x46a574(0x162)+_0x2756f2+'\x27?','initial':![]});if(!_0x5ef1fc[_0x46a574(0x18e)])return console[_0x46a574(0x1b0)](_0x46a574(0x15f)),0x0;try{await deleteProfileAndCredentials(_0x2756f2),console[_0x46a574(0x1b0)](a33_0x58e680['green']('✓')+_0x46a574(0x19f)+_0x2756f2+_0x46a574(0x192));}catch(_0x51e7ab){return console[_0x46a574(0x16b)](a33_0x58e680[_0x46a574(0x18b)](_0x46a574(0x1a2)+(_0x51e7ab instanceof Error?_0x51e7ab[_0x46a574(0x1b4)]:String(_0x51e7ab)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a33_0x1f0f47(0x1c9);[a33_0x1f0f47(0x1b1)]='Set\x20a\x20profile\x20configuration\x20value';static [a33_0x1f0f47(0x1a8)]=['site',a33_0x1f0f47(0x160),a33_0x1f0f47(0x1a3),'llm_project',a33_0x1f0f47(0x199),a33_0x1f0f47(0x1b1)];['validate'](_0x2ce23e){const _0x506b1b=a33_0x1f0f47,{args:_0xe197b7,options:_0x169201}=_0x2ce23e,_0x43ecdf=_0x169201[_0x506b1b(0x1bd)]||getActiveProfile();if(!_0x43ecdf)return _0x506b1b(0x171);if(_0xe197b7[_0x506b1b(0x175)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS'][_0x506b1b(0x188)](',\x20');const _0x3816cb=_0xe197b7[0x0];if(!_0x3816cb[_0x506b1b(0x187)]('='))return _0x506b1b(0x197)+ProfileSetCommand[_0x506b1b(0x1a8)][_0x506b1b(0x188)](',\x20');const [_0x19902e]=_0x3816cb[_0x506b1b(0x1a7)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x506b1b(0x187)](_0x19902e))return _0x506b1b(0x169)+_0x19902e+_0x506b1b(0x183)+ProfileSetCommand['VALID_KEYS'][_0x506b1b(0x188)](',\x20');return undefined;}async[a33_0x1f0f47(0x1ab)](_0x44da12){const _0x62e1a8=a33_0x1f0f47,{args:_0x511e2a,options:_0x257ef1}=_0x44da12,_0x5b8118=_0x257ef1['profile']||getActiveProfile(),[_0x38cfe2,..._0x4ab0b8]=_0x511e2a[0x0][_0x62e1a8(0x1a7)]('='),_0x117cd5=_0x4ab0b8[_0x62e1a8(0x188)]('=');console['log'](a33_0x58e680[_0x62e1a8(0x184)](_0x62e1a8(0x17f)));if(!profileExists(_0x5b8118)){const _0x460efc=await a33_0x123a5f({'type':_0x62e1a8(0x18e),'name':_0x62e1a8(0x181),'message':'Profile\x20\x27'+_0x5b8118+_0x62e1a8(0x1cb),'initial':!![]});if(!_0x460efc[_0x62e1a8(0x181)])return console[_0x62e1a8(0x1b0)](_0x62e1a8(0x1c8)),0x1;}const _0xaf81b=loadProfile(_0x5b8118),_0x204b2c=_0xaf81b?.[_0x62e1a8(0x194)]||{};if(_0x38cfe2==='site'){const _0x12a7cc=resolveSite(_0x117cd5);console['log'](_0x62e1a8(0x16e)+_0x12a7cc+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x62e1a8(0x1b0)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x62e1a8(0x1b0)]('\x20\x20'+getConsoleUrl(_0x12a7cc,_0x62e1a8(0x1c0)));const _0x5b9c3e=await a33_0x123a5f({'type':'password','name':_0x62e1a8(0x19c),'message':_0x62e1a8(0x16c),'validate':_0x4aaaac=>{const _0x9032a=_0x62e1a8;if(!_0x4aaaac||!_0x4aaaac[_0x9032a(0x191)]())return _0x9032a(0x17a);return!![];}});if(!_0x5b9c3e[_0x62e1a8(0x19c)])return console[_0x62e1a8(0x1b0)](_0x62e1a8(0x16f)),0x1;console[_0x62e1a8(0x1b0)](_0x62e1a8(0x19e));try{const _0x3c057c=TDX['create']({'site':_0x12a7cc,'apiKey':_0x5b9c3e[_0x62e1a8(0x19c)]['trim'](),'logLevel':_0x257ef1[_0x62e1a8(0x179)]??LogLevel[_0x62e1a8(0x196)]}),_0x36d920=await _0x3c057c['jobs']['getUserInfo']();console[_0x62e1a8(0x1b0)](a33_0x58e680[_0x62e1a8(0x17e)]('✓')+_0x62e1a8(0x1a9)+_0x36d920[_0x62e1a8(0x1b9)]+')');const _0x21008a=await isKeychainAvailable();_0x21008a?(await saveAPIKeyAsync(_0x5b9c3e[_0x62e1a8(0x19c)][_0x62e1a8(0x191)](),_0x12a7cc,_0x5b8118),console['log'](a33_0x58e680[_0x62e1a8(0x17e)]('✓')+_0x62e1a8(0x167))):console['warn'](a33_0x58e680['yellow'](_0x62e1a8(0x166))),_0x204b2c[_0x62e1a8(0x1c5)]=_0x12a7cc;}catch(_0x3ac358){if(_0x3ac358 instanceof HTTPClientError&&_0x3ac358['status']===0x191)return printAuthError(_0x3ac358),0x1;return console[_0x62e1a8(0x16b)](a33_0x58e680[_0x62e1a8(0x18b)](_0x62e1a8(0x1ac)+(_0x3ac358 instanceof Error?_0x3ac358[_0x62e1a8(0x1b4)]:String(_0x3ac358)))),console[_0x62e1a8(0x16b)](_0x62e1a8(0x172)),0x1;}}else _0x204b2c[_0x38cfe2]=_0x117cd5||undefined;return saveProfileToUserConfig(_0x5b8118,_0x204b2c),console[_0x62e1a8(0x1b0)](a33_0x58e680['green']('✓')+_0x62e1a8(0x19f)+_0x5b8118+_0x62e1a8(0x177)+_0x38cfe2+'='+(_0x117cd5||_0x62e1a8(0x178))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x1f0f47(0x1cc)]=a33_0x1f0f47(0x1c6);[a33_0x1f0f47(0x1b1)]=a33_0x1f0f47(0x1b6);[a33_0x1f0f47(0x1be)](_0x9db0d4){const _0x4287a8=a33_0x1f0f47,{args:_0x1fb81e}=_0x9db0d4;if(_0x1fb81e['length']===0x0)return _0x4287a8(0x1ae);return undefined;}async[a33_0x1f0f47(0x1ab)](_0x33cda4){const _0x48ba76=a33_0x1f0f47,{args:_0x131b70,options:_0x31b823}=_0x33cda4,_0x2bf807=_0x131b70[0x0],_0xd1451f=_0x31b823['default'];cleanExpiredSessions();if(!profileExists(_0x2bf807)){console[_0x48ba76(0x16b)](a33_0x58e680[_0x48ba76(0x18b)]('Profile\x20\x27'+_0x2bf807+_0x48ba76(0x1c3))),console[_0x48ba76(0x1b0)](_0x48ba76(0x1bc));const _0x270b5e=listProfiles();if(_0x270b5e[_0x48ba76(0x175)]===0x0)console['log'](_0x48ba76(0x1b2));else for(const _0x4b45c0 of _0x270b5e){console[_0x48ba76(0x1b0)](_0x48ba76(0x1c2)+_0x4b45c0[_0x48ba76(0x1cc)]);}return 0x1;}if(_0xd1451f){const _0x3fc544=a33_0x42b56b[_0x48ba76(0x188)](getConfigDir(),_0x48ba76(0x174));return saveActiveProfileToUserConfig(_0x2bf807),console[_0x48ba76(0x1b0)](_0x48ba76(0x1aa)+a33_0x58e680[_0x48ba76(0x17e)](_0x2bf807)),console[_0x48ba76(0x1b0)](a33_0x58e680[_0x48ba76(0x176)](_0x48ba76(0x1ad)+_0x3fc544)),0x0;}const _0x278f42=getSessionID(_0x31b823['session']);return saveSessionContext({'profile':_0x2bf807},_0x31b823[_0x48ba76(0x17d)]),console['log'](_0x48ba76(0x18f)+a33_0x58e680['green'](_0x2bf807)+'\x20'+a33_0x58e680[_0x48ba76(0x176)](_0x48ba76(0x186)+_0x278f42+')')),console[_0x48ba76(0x1b0)](a33_0x58e680[_0x48ba76(0x176)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x2bf807+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
@@ -1 +1 @@
1
- function a34_0x1c9c(_0x191245,_0x213dd8){_0x191245=_0x191245-0xc2;const _0x4cd2ee=a34_0x4cd2();let _0x1c9c06=_0x4cd2ee[_0x191245];return _0x1c9c06;}function a34_0x4cd2(){const _0x475f7a=['\x20\x20Global:\x20~/.config/tdx/tdx.json','length','7453017bwgkky','687760pfEpkb','log','name','28eKqkSg','config','4168424QxQLpk','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','27222350vyefNi','👤\x20','message','dim','51484NBMQPF','error','1136729BVQttR','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','description','site','List\x20all\x20available\x20profiles','green','scope','12Lageih','profiles','626805RquLIJ','111PvNSoM'];a34_0x4cd2=function(){return _0x475f7a;};return a34_0x4cd2();}const a34_0x3a1acc=a34_0x1c9c;(function(_0x4cfd94,_0x14725d){const _0x3c8121=a34_0x1c9c,_0x1785e9=_0x4cfd94();while(!![]){try{const _0x3a8f94=parseInt(_0x3c8121(0xc5))/0x1+parseInt(_0x3c8121(0xc3))/0x2*(parseInt(_0x3c8121(0xcf))/0x3)+parseInt(_0x3c8121(0xd8))/0x4+parseInt(_0x3c8121(0xce))/0x5*(-parseInt(_0x3c8121(0xcc))/0x6)+-parseInt(_0x3c8121(0xd6))/0x7*(parseInt(_0x3c8121(0xd3))/0x8)+parseInt(_0x3c8121(0xd2))/0x9+-parseInt(_0x3c8121(0xda))/0xa;if(_0x3a8f94===_0x14725d)break;else _0x1785e9['push'](_0x1785e9['shift']());}catch(_0x3d196d){_0x1785e9['push'](_0x1785e9['shift']());}}}(a34_0x4cd2,0x9ce05));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x1d629c from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x3a1acc(0xd5)]=a34_0x3a1acc(0xcd);[a34_0x3a1acc(0xc7)]=a34_0x3a1acc(0xc9);async['execute'](_0x4d9fdf){const _0x49edda=a34_0x3a1acc,{options:_0x348a19}=_0x4d9fdf;try{const _0x36f3cd=listProfiles(),_0xffa0d7=getActiveProfile();if(_0x36f3cd[_0x49edda(0xd1)]===0x0)return console[_0x49edda(0xd4)](_0x49edda(0xc6)),console[_0x49edda(0xd4)](_0x49edda(0xd9)),console[_0x49edda(0xd4)](_0x49edda(0xd0)),0x0;const _0x3b3a76=_0x36f3cd['map'](_0x5ec2fa=>{const _0x4e0698=_0x49edda,_0x1d8a0b=_0x5ec2fa['name']===_0xffa0d7,_0x24d94b=getProfileParams(_0x5ec2fa[_0x4e0698(0xd7)]);return{'name':_0x5ec2fa['name'],'active':_0x1d8a0b,'scope':_0x5ec2fa[_0x4e0698(0xcb)],'description':_0x5ec2fa[_0x4e0698(0xd7)]['description']||'','params':_0x24d94b};});if(isStructuredFormat(_0x348a19))await handleSDKOutput(_0x3b3a76,_0x348a19);else for(const _0x394255 of _0x36f3cd){const _0x1556b2=_0x394255[_0x49edda(0xd5)]===_0xffa0d7?a34_0x1d629c[_0x49edda(0xca)]('\x20✓'):'',_0x69fb97=_0x394255[_0x49edda(0xd7)][_0x49edda(0xc8)]?a34_0x1d629c[_0x49edda(0xc2)]('\x20'+_0x394255['config'][_0x49edda(0xc8)]):'',_0x4b8b7c=_0x394255['config']['description']?a34_0x1d629c[_0x49edda(0xc2)]('\x20\x20'+_0x394255[_0x49edda(0xd7)][_0x49edda(0xc7)]):'';console[_0x49edda(0xd4)](_0x49edda(0xdb)+_0x394255[_0x49edda(0xd5)]+_0x1556b2+_0x69fb97+_0x4b8b7c);}return 0x0;}catch(_0x1942e7){return _0x1942e7 instanceof Error&&console[_0x49edda(0xc4)]('Error:\x20'+_0x1942e7[_0x49edda(0xdc)]),0x1;}}}
1
+ const a34_0x412436=a34_0x553d;(function(_0x53a71c,_0x3f42ab){const _0x2d87ea=a34_0x553d,_0xde4c65=_0x53a71c();while(!![]){try{const _0x5645d1=parseInt(_0x2d87ea(0x110))/0x1+parseInt(_0x2d87ea(0x107))/0x2*(parseInt(_0x2d87ea(0x10e))/0x3)+-parseInt(_0x2d87ea(0x11b))/0x4+parseInt(_0x2d87ea(0x11f))/0x5+-parseInt(_0x2d87ea(0x117))/0x6*(-parseInt(_0x2d87ea(0x106))/0x7)+-parseInt(_0x2d87ea(0x105))/0x8*(-parseInt(_0x2d87ea(0x11a))/0x9)+-parseInt(_0x2d87ea(0x109))/0xa;if(_0x5645d1===_0x3f42ab)break;else _0xde4c65['push'](_0xde4c65['shift']());}catch(_0x3b9c05){_0xde4c65['push'](_0xde4c65['shift']());}}}(a34_0x238e,0xdfe4d));function a34_0x553d(_0x3e5f6a,_0x4b0012){_0x3e5f6a=_0x3e5f6a-0x104;const _0x238edc=a34_0x238e();let _0x553d1a=_0x238edc[_0x3e5f6a];return _0x553d1a;}import{BaseCommand}from'./command.js';function a34_0x238e(){const _0x3aa0cd=['description','config','name','\x20\x20Global:\x20~/.config/tdx/tdx.json','execute','18VzIjsR','map','scope','4574322iXJUPX','1069200MOGRCY','profiles','error','List\x20all\x20available\x20profiles','1226310oCmIKE','Error:\x20','16DhmVIV','3725918ekpCvI','263782zaeyAu','log','20457230XEECWQ','👤\x20','site','green','dim','3FnHdUW','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','239601pPZmXB','message'];a34_0x238e=function(){return _0x3aa0cd;};return a34_0x238e();}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x53bd53 from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x412436(0x114)]=a34_0x412436(0x11c);[a34_0x412436(0x112)]=a34_0x412436(0x11e);async[a34_0x412436(0x116)](_0x49a7ef){const _0x109763=a34_0x412436,{options:_0x5a7243}=_0x49a7ef;try{const _0x234eb3=listProfiles(),_0x5a548e=getActiveProfile();if(_0x234eb3['length']===0x0)return console[_0x109763(0x108)](_0x109763(0x10f)),console[_0x109763(0x108)]('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console[_0x109763(0x108)](_0x109763(0x115)),0x0;const _0x1b158f=_0x234eb3[_0x109763(0x118)](_0xbfa3de=>{const _0x507019=_0x109763,_0x19281e=_0xbfa3de['name']===_0x5a548e,_0x157372=getProfileParams(_0xbfa3de[_0x507019(0x113)]);return{'name':_0xbfa3de['name'],'active':_0x19281e,'scope':_0xbfa3de[_0x507019(0x119)],'description':_0xbfa3de[_0x507019(0x113)]['description']||'','params':_0x157372};});if(isStructuredFormat(_0x5a7243))await handleSDKOutput(_0x1b158f,_0x5a7243);else for(const _0x16dece of _0x234eb3){const _0x15f5c2=_0x16dece['name']===_0x5a548e?a34_0x53bd53[_0x109763(0x10c)]('\x20✓'):'',_0x4ffda6=_0x16dece[_0x109763(0x113)][_0x109763(0x10b)]?a34_0x53bd53['dim']('\x20'+_0x16dece[_0x109763(0x113)][_0x109763(0x10b)]):'',_0x5dd5e5=_0x16dece[_0x109763(0x113)][_0x109763(0x112)]?a34_0x53bd53[_0x109763(0x10d)]('\x20\x20'+_0x16dece['config'][_0x109763(0x112)]):'';console[_0x109763(0x108)](_0x109763(0x10a)+_0x16dece[_0x109763(0x114)]+_0x15f5c2+_0x4ffda6+_0x5dd5e5);}return 0x0;}catch(_0x592626){return _0x592626 instanceof Error&&console[_0x109763(0x11d)](_0x109763(0x104)+_0x592626[_0x109763(0x111)]),0x1;}}}
@@ -1 +1 @@
1
- const a35_0x228d2d=a35_0x3bb7;(function(_0x4f9eb9,_0x362fa0){const _0x85424b=a35_0x3bb7,_0x5aa0a1=_0x4f9eb9();while(!![]){try{const _0x1aa041=-parseInt(_0x85424b(0x1f5))/0x1+parseInt(_0x85424b(0x202))/0x2*(-parseInt(_0x85424b(0x1e6))/0x3)+parseInt(_0x85424b(0x211))/0x4+parseInt(_0x85424b(0x1f3))/0x5+-parseInt(_0x85424b(0x212))/0x6*(parseInt(_0x85424b(0x1f9))/0x7)+parseInt(_0x85424b(0x1e8))/0x8*(parseInt(_0x85424b(0x203))/0x9)+parseInt(_0x85424b(0x209))/0xa*(parseInt(_0x85424b(0x20d))/0xb);if(_0x1aa041===_0x362fa0)break;else _0x5aa0a1['push'](_0x5aa0a1['shift']());}catch(_0x364317){_0x5aa0a1['push'](_0x5aa0a1['shift']());}}}(a35_0x2baa,0x1f36b));import{BaseCommand}from'./command.js';function a35_0x3bb7(_0x31b321,_0x12ea74){_0x31b321=_0x31b321-0x1dd;const _0x2baa39=a35_0x2baa();let _0x3bb74e=_0x2baa39[_0x31b321];return _0x3bb74e;}function a35_0x2baa(){const _0x577365=['options','output','Catalog:\x20','1058710PGfZfr','description','catalog','Executing\x20query...','22pUQqRT','Query\x20completed:\x20Processed\x20','name','file','911000PDVjBs','36204ltKCct','totalSplits','originalMessage','database','Site:\x20','stats','length','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','completedSplits','Error:\x20','17961OqSDLT','data','504fRBJVw','SQL:\x20','state','processedRows','Executing\x20query\x20[','query','setJobId','message','push','Executing\x20statement\x20','validate','1214070XfIcUD','Run\x20Trino\x20queries\x20(streaming)','188651ncyhco','Statement\x20','jobId','...','217rhmaEM','setExtra','execute','\x0aAll\x20results\x20saved\x20to\x20','\x20splits','\x20-\x20','error','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','setPhase','82mcJspj','9531oUjZML','\x20rows\x20','verbose'];a35_0x2baa=function(){return _0x577365;};return a35_0x2baa();}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_0x228d2d(0x20f)]=a35_0x228d2d(0x1ed);[a35_0x228d2d(0x20a)]=a35_0x228d2d(0x1f4);async[a35_0x228d2d(0x1fb)](_0x3fcbab){const _0x141b52=a35_0x228d2d,{options:_0xf7eccf,args:_0x4cbf87,tdx:_0x4eea29}=_0x3fcbab,_0x20a998={..._0xf7eccf,'limitStructuredFormats':!![]},_0x4f8ced=_0x4cbf87[0x0],_0x46aa69=_0xf7eccf[_0x141b52(0x210)];let _0x1e95a0;try{if(_0x46aa69)_0x1e95a0=readSqlStatementsFromFile(_0x46aa69);else{if(_0x4f8ced==='-')_0x1e95a0=await readSqlStatementsFromStdin();else{if(_0x4f8ced&&isSqlFilePath(_0x4f8ced))_0x1e95a0=readSqlStatementsFromFile(_0x4f8ced);else{if(_0x4f8ced)_0x1e95a0=splitSqlStatements(_0x4f8ced);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x563d6e){return console[_0x141b52(0x1ff)](_0x141b52(0x1e5)+_0x563d6e[_0x141b52(0x1ef)]),0x1;}const _0x518453=_0xf7eccf[_0x141b52(0x1df)]||'information_schema',_0x62a94=_0xf7eccf[_0x141b52(0x20b)];try{const _0x2dc840=[],_0x158226=!!_0xf7eccf[_0x141b52(0x207)];for(let _0x1b7d43=0x0;_0x1b7d43<_0x1e95a0['length'];_0x1b7d43++){const _0x2399f1=_0x1e95a0[_0x1b7d43],_0x5bbe4f=_0x1b7d43+0x1,_0x9e84d1=_0x1e95a0['length'],_0x1eee0a=_0x9e84d1>0x1;_0xf7eccf[_0x141b52(0x205)]&&(console[_0x141b52(0x1ff)]('\x0a'+(_0x1eee0a?'Statement\x20'+_0x5bbe4f+'/'+_0x9e84d1+':':'')),console['error'](_0x141b52(0x1e0)+_0xf7eccf['site']),console[_0x141b52(0x1ff)](_0x141b52(0x208)+(_0x62a94||'td')),console[_0x141b52(0x1ff)]('Schema:\x20'+_0x518453),console['error'](_0x141b52(0x1e9)+_0x2399f1));const _0x4e4e3c=_0x1eee0a?_0x141b52(0x1f1)+_0x5bbe4f+'/'+_0x9e84d1+_0x141b52(0x1f8):_0x141b52(0x20c);try{const _0x5a416f=await withProgressSpinner(_0x4e4e3c,async _0x1cf08b=>{const _0x4aaf28=_0x141b52,_0x37c4db=await _0x4eea29[_0x4aaf28(0x1ed)][_0x4aaf28(0x1fb)](_0x2399f1,{'catalog':_0x62a94,'schema':_0x518453,'onJobId':_0x4c2568=>{const _0x3e472d=_0x4aaf28;_0x1cf08b[_0x3e472d(0x1ee)](_0x4c2568);},'onProgress':_0x49f0ca=>{const _0x8b9bdb=_0x4aaf28;_0x1cf08b[_0x8b9bdb(0x201)](_0x8b9bdb(0x1ec)+_0x49f0ca[_0x8b9bdb(0x1ea)]+']'),_0x1cf08b[_0x8b9bdb(0x1fa)](formatRows(_0x49f0ca['processedRows'])+_0x8b9bdb(0x204)+_0x49f0ca[_0x8b9bdb(0x1e4)]+'/'+_0x49f0ca[_0x8b9bdb(0x1dd)]+_0x8b9bdb(0x1fd));}});return _0x37c4db;},{'verbose':_0xf7eccf['verbose']}),_0x5a6ee1=_0x5a416f[_0x141b52(0x1e7)],_0x273cde=_0x5a6ee1[_0x141b52(0x1f7)]?'\x20[Job\x20ID:\x20'+_0x5a6ee1[_0x141b52(0x1f7)]+']':'',_0x753cdc=_0x1eee0a?'Statement\x20'+_0x5bbe4f+'/'+_0x9e84d1+_0x141b52(0x1fe):'';console[_0x141b52(0x1ff)]('✔\x20'+_0x753cdc+_0x141b52(0x20e)+formatRows(_0x5a6ee1[_0x141b52(0x1e1)][_0x141b52(0x1eb)])+_0x141b52(0x204)+('in\x20'+formatElapsed(_0x5a6ee1[_0x141b52(0x1e1)]['elapsedTimeMillis'])+_0x273cde));if(_0x1eee0a&&_0x158226){const _0x30f462=resolveOutputOptions(_0x20a998),_0x25c527=await formatQueryOutput(_0x5a6ee1,_0x30f462);_0x2dc840[_0x141b52(0x1f0)](_0x25c527);}else await handleQueryOutput(_0x5a6ee1,_0x20a998);}catch(_0x15b785){const _0x5980e9=_0x1eee0a?_0x141b52(0x1f6)+_0x5bbe4f+'/'+_0x9e84d1+':\x0a':'',_0x29737f=_0x15b785 instanceof SDKError?_0x15b785[_0x141b52(0x1de)]:_0x15b785['message'];return console['error'](''+_0x5980e9+_0x29737f),0x1;}}if(_0x1e95a0[_0x141b52(0x1e2)]>0x1&&_0x158226&&_0x2dc840[_0x141b52(0x1e2)]>0x0){const _0xbf2d16=_0x2dc840['join']('\x0a');writeFileSync(_0xf7eccf['output'],_0xbf2d16),console['error'](_0x141b52(0x1fc)+_0xf7eccf[_0x141b52(0x207)]);}return 0x0;}catch(_0x431ffa){throw _0x431ffa;}}[a35_0x228d2d(0x1f2)](_0x43c8de){const _0x46206b=a35_0x228d2d,_0x29c47c=_0x43c8de['args'][0x0],_0x3b6331=_0x43c8de[_0x46206b(0x206)][_0x46206b(0x210)];if(!_0x29c47c&&!_0x3b6331)return _0x46206b(0x1e3);if(_0x29c47c&&_0x3b6331)return _0x46206b(0x200);return undefined;}}
1
+ const a35_0x261a5b=a35_0x1dd4;(function(_0x44ba0f,_0x12226d){const _0x43a604=a35_0x1dd4,_0x361c50=_0x44ba0f();while(!![]){try{const _0x2dbca5=parseInt(_0x43a604(0x130))/0x1+-parseInt(_0x43a604(0x12b))/0x2*(-parseInt(_0x43a604(0x146))/0x3)+-parseInt(_0x43a604(0x147))/0x4*(-parseInt(_0x43a604(0x13a))/0x5)+-parseInt(_0x43a604(0x132))/0x6*(-parseInt(_0x43a604(0x143))/0x7)+-parseInt(_0x43a604(0x138))/0x8*(parseInt(_0x43a604(0x12a))/0x9)+-parseInt(_0x43a604(0x128))/0xa*(-parseInt(_0x43a604(0x141))/0xb)+-parseInt(_0x43a604(0x13e))/0xc;if(_0x2dbca5===_0x12226d)break;else _0x361c50['push'](_0x361c50['shift']());}catch(_0x2eca79){_0x361c50['push'](_0x361c50['shift']());}}}(a35_0x6bc3,0xe37fc));import{BaseCommand}from'./command.js';function a35_0x1dd4(_0x58f77e,_0x47abfc){_0x58f77e=_0x58f77e-0x119;const _0x6bc35d=a35_0x6bc3();let _0x1dd4c1=_0x6bc35d[_0x58f77e];return _0x1dd4c1;}import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';function a35_0x6bc3(){const _0x32b16b=['Statement\x20','\x20splits','Run\x20Trino\x20queries\x20(streaming)','...','name','verbose','Error:\x20','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','join','catalog','\x20[Job\x20ID:\x20','SQL:\x20','file','Executing\x20query...','error','setJobId','site','Executing\x20query\x20[','330zmTNQW','setExtra','30042RlzMrI','240246PtYrBl','stats','processedRows','query','message','1581900VRfquU','args','1782564rbGuLH','\x20-\x20','execute','\x0aAll\x20results\x20saved\x20to\x20','Query\x20completed:\x20Processed\x20','No\x20SQL\x20provided','1104zTAebn','originalMessage','4346380AdWOTE','length','elapsedTimeMillis','\x20rows\x20','37716012XSGsiT','output','push','138479DOtaTI','Site:\x20','28fDgFGn','setPhase','completedSplits','12pGTixQ','4cATdrP','data','Executing\x20statement\x20'];a35_0x6bc3=function(){return _0x32b16b;};return a35_0x6bc3();}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a35_0x261a5b(0x11a)]=a35_0x261a5b(0x12e);['description']=a35_0x261a5b(0x14c);async[a35_0x261a5b(0x134)](_0x27042f){const _0x50b166=a35_0x261a5b,{options:_0x650e84,args:_0x5181dd,tdx:_0x337b64}=_0x27042f,_0xdc4e9a={..._0x650e84,'limitStructuredFormats':!![]},_0x5116d7=_0x5181dd[0x0],_0x4beab5=_0x650e84[_0x50b166(0x122)];let _0x3ccd97;try{if(_0x4beab5)_0x3ccd97=readSqlStatementsFromFile(_0x4beab5);else{if(_0x5116d7==='-')_0x3ccd97=await readSqlStatementsFromStdin();else{if(_0x5116d7&&isSqlFilePath(_0x5116d7))_0x3ccd97=readSqlStatementsFromFile(_0x5116d7);else{if(_0x5116d7)_0x3ccd97=splitSqlStatements(_0x5116d7);else throw new Error(_0x50b166(0x137));}}}}catch(_0x350e55){return console[_0x50b166(0x124)](_0x50b166(0x11c)+_0x350e55[_0x50b166(0x12f)]),0x1;}const _0x139093=_0x650e84['database']||'information_schema',_0x59b56d=_0x650e84[_0x50b166(0x11f)];try{const _0x1984ad=[],_0x46081d=!!_0x650e84[_0x50b166(0x13f)];for(let _0x242b4f=0x0;_0x242b4f<_0x3ccd97['length'];_0x242b4f++){const _0x58c44c=_0x3ccd97[_0x242b4f],_0x22ce16=_0x242b4f+0x1,_0x46b6fd=_0x3ccd97[_0x50b166(0x13b)],_0x1a593a=_0x46b6fd>0x1;_0x650e84['verbose']&&(console['error']('\x0a'+(_0x1a593a?'Statement\x20'+_0x22ce16+'/'+_0x46b6fd+':':'')),console[_0x50b166(0x124)](_0x50b166(0x142)+_0x650e84[_0x50b166(0x126)]),console[_0x50b166(0x124)]('Catalog:\x20'+(_0x59b56d||'td')),console[_0x50b166(0x124)]('Schema:\x20'+_0x139093),console[_0x50b166(0x124)](_0x50b166(0x121)+_0x58c44c));const _0x459643=_0x1a593a?_0x50b166(0x149)+_0x22ce16+'/'+_0x46b6fd+_0x50b166(0x119):_0x50b166(0x123);try{const _0x40505e=await withProgressSpinner(_0x459643,async _0x2c87c2=>{const _0x3be803=_0x50b166,_0x3e6145=await _0x337b64[_0x3be803(0x12e)][_0x3be803(0x134)](_0x58c44c,{'catalog':_0x59b56d,'schema':_0x139093,'onJobId':_0x5d4497=>{const _0xbbe232=_0x3be803;_0x2c87c2[_0xbbe232(0x125)](_0x5d4497);},'onProgress':_0x1c23c0=>{const _0x29096f=_0x3be803;_0x2c87c2[_0x29096f(0x144)](_0x29096f(0x127)+_0x1c23c0['state']+']'),_0x2c87c2[_0x29096f(0x129)](formatRows(_0x1c23c0[_0x29096f(0x12d)])+_0x29096f(0x13d)+_0x1c23c0[_0x29096f(0x145)]+'/'+_0x1c23c0['totalSplits']+_0x29096f(0x14b));}});return _0x3e6145;},{'verbose':_0x650e84[_0x50b166(0x11b)]}),_0x3e6dd9=_0x40505e[_0x50b166(0x148)],_0x8c2865=_0x3e6dd9['jobId']?_0x50b166(0x120)+_0x3e6dd9['jobId']+']':'',_0x437b93=_0x1a593a?_0x50b166(0x14a)+_0x22ce16+'/'+_0x46b6fd+_0x50b166(0x133):'';console['error']('✔\x20'+_0x437b93+_0x50b166(0x136)+formatRows(_0x3e6dd9[_0x50b166(0x12c)]['processedRows'])+_0x50b166(0x13d)+('in\x20'+formatElapsed(_0x3e6dd9[_0x50b166(0x12c)][_0x50b166(0x13c)])+_0x8c2865));if(_0x1a593a&&_0x46081d){const _0x34f016=resolveOutputOptions(_0xdc4e9a),_0x457951=await formatQueryOutput(_0x3e6dd9,_0x34f016);_0x1984ad[_0x50b166(0x140)](_0x457951);}else await handleQueryOutput(_0x3e6dd9,_0xdc4e9a);}catch(_0x56148e){const _0x3faeaa=_0x1a593a?'Statement\x20'+_0x22ce16+'/'+_0x46b6fd+':\x0a':'',_0x241011=_0x56148e instanceof SDKError?_0x56148e[_0x50b166(0x139)]:_0x56148e['message'];return console[_0x50b166(0x124)](''+_0x3faeaa+_0x241011),0x1;}}if(_0x3ccd97[_0x50b166(0x13b)]>0x1&&_0x46081d&&_0x1984ad[_0x50b166(0x13b)]>0x0){const _0x178bd4=_0x1984ad[_0x50b166(0x11e)]('\x0a');writeFileSync(_0x650e84[_0x50b166(0x13f)],_0x178bd4),console['error'](_0x50b166(0x135)+_0x650e84[_0x50b166(0x13f)]);}return 0x0;}catch(_0x335112){throw _0x335112;}}['validate'](_0x46af2e){const _0x40ba2a=a35_0x261a5b,_0x4d579c=_0x46af2e[_0x40ba2a(0x131)][0x0],_0x23a6eb=_0x46af2e['options'][_0x40ba2a(0x122)];if(!_0x4d579c&&!_0x23a6eb)return _0x40ba2a(0x11d);if(_0x4d579c&&_0x23a6eb)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}
@@ -1 +1 @@
1
- const a36_0x22f77b=a36_0x39be;(function(_0x3a3a41,_0x2b2552){const _0x1817ef=a36_0x39be,_0x42b25b=_0x3a3a41();while(!![]){try{const _0x14a096=parseInt(_0x1817ef(0x21f))/0x1*(parseInt(_0x1817ef(0x207))/0x2)+parseInt(_0x1817ef(0x220))/0x3*(-parseInt(_0x1817ef(0x1da))/0x4)+parseInt(_0x1817ef(0x206))/0x5*(-parseInt(_0x1817ef(0x1bb))/0x6)+parseInt(_0x1817ef(0x1ef))/0x7+-parseInt(_0x1817ef(0x227))/0x8+-parseInt(_0x1817ef(0x22e))/0x9+parseInt(_0x1817ef(0x241))/0xa;if(_0x14a096===_0x2b2552)break;else _0x42b25b['push'](_0x42b25b['shift']());}catch(_0x404e3f){_0x42b25b['push'](_0x42b25b['shift']());}}}(a36_0x24ed,0x713e8));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';function a36_0x39be(_0x157f71,_0x1a49f7){_0x157f71=_0x157f71-0x1b2;const _0x24ed61=a36_0x24ed();let _0x39be35=_0x24ed61[_0x157f71];return _0x39be35;}import a36_0x540daf from'chalk';function a36_0x24ed(){const _0x28873b=['\x20\x20Database:\x20','green','listQueries','Cancelled','Show\x20schedule\x20details','Searching\x20scheduled\x20queries\x20matching\x20\x22','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','length','type','padEnd','verbose','entries','round','retry_limit','Found\x20','\x20job','start_at','(unnamed)','104lvobHD','abs','Listing\x20scheduled\x20queries...','time','file','\x20execution','lastRun','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','format','run','...','red','data','priority','Failed\x20to\x20read\x20file:\x20','schedule:create','output','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','options','substring','\x20(showing\x20','5387494SqkZXy','keys','tsv','history','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','toLocaleDateString','\x20schedules','has_next_page','Schedule\x20run\x20submitted:\x20','args','statusIcon','Creating\x20schedule...','end_at','created_at','description','result','queries','jobs','Showing\x20first\x20','name','\x20created','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','610iUchUt','938138IIAOjF','\x20\x20Job\x20ID:\x20','Running\x20schedule:\x20','utf-8','show','repeat','\x20\x20Cron:\x20','\x22...','m\x20ago','trino','cyan','ies','trim','query','\x20\x20Type:\x20','cron','engine_version','\x20(use\x20--limit\x20to\x20see\x20more)','Query\x20file\x20is\x20empty','log','Run\x20a\x20scheduled\x20query\x20immediately','List\x20scheduled\x20queries','getTime','delay','1JNJHke','50397QAGQbx','schedule:update','schedule:delete','count','h\x20ago','json','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','6157648uMnlVx','in\x20','next_run_at','site','map','yes','schedule:show','3128787cOireW','execute','validate','schedule:history','Create\x20a\x20scheduled\x20query','ended_at','\x20scheduled\x20quer','retryLimit','database','queryUrl','user_name','engineVersion','Schedule\x20updated:\x20','📅\x20','pagination','Getting\x20schedule\x20details...','Schedule\x20created:\x20','timezone','from','7815780QzVazl','No\x20scheduled\x20queries\x20found','max','delete','last_job','Schedule\x20deleted:\x20','success','update','scheduled_at','error','Creating\x20schedule:\x20','INVALID_ARGUMENT','nextRun','schedules','114nuOCwL','Delete\x20a\x20scheduled\x20query','status','updated_at','limit','num','Updating\x20schedule:\x20','\x20matching\x20\x22','list','\x20\x20Num:\x20','never','job_id','time_zone'];a36_0x24ed=function(){return _0x28873b;};return a36_0x24ed();}function formatRelativeTime(_0x276745){const _0x29de7f=a36_0x39be,_0x440252=new Date(_0x276745),_0x2bc959=new Date(),_0x4726b2=_0x440252[_0x29de7f(0x21d)]()-_0x2bc959['getTime'](),_0x28a2b5=Math[_0x29de7f(0x1db)](_0x4726b2)/0x3e8,_0x187417=_0x4726b2<0x0;if(_0x28a2b5<0x3c)return _0x187417?'just\x20now':'soon';else{if(_0x28a2b5<0xe10){const _0x409f17=Math[_0x29de7f(0x1d4)](_0x28a2b5/0x3c);return _0x187417?_0x409f17+_0x29de7f(0x20f):_0x29de7f(0x228)+_0x409f17+'m';}else{if(_0x28a2b5<0x15180){const _0x389157=Math[_0x29de7f(0x1d4)](_0x28a2b5/0xe10);return _0x187417?_0x389157+_0x29de7f(0x224):_0x29de7f(0x228)+_0x389157+'h';}else{if(_0x28a2b5<0x93a80){const _0x49b028=Math['round'](_0x28a2b5/0x15180);return _0x187417?_0x49b028+'d\x20ago':_0x29de7f(0x228)+_0x49b028+'d';}else return _0x440252[_0x29de7f(0x1f4)]();}}}}export class ScheduleListCommand extends BaseCommand{['name']='schedule:list';['description']=a36_0x22f77b(0x21c);async[a36_0x22f77b(0x22f)](_0x539faf){const _0xb3602=a36_0x22f77b,{options:_0x5152ba,args:_0x1b2631,tdx:_0x48bf38}=_0x539faf,_0x525f0d=resolveLimit(_0x5152ba[_0xb3602(0x1bf)],DEFAULT_DISPLAY_LIMIT),_0x9364be=_0x1b2631[0x0],_0x2716ad=_0x9364be?_0xb3602(0x1cd)+_0x9364be+_0xb3602(0x20e):_0xb3602(0x1dc),_0x57e372=await withSpinner(_0x2716ad,()=>_0x48bf38['schedules'][_0xb3602(0x1ca)]({'limit':_0x525f0d,'scheduled':!![],'pattern':_0x9364be}),{'verbose':_0x5152ba['verbose']}),_0x778984=_0x57e372['data'][_0xb3602(0x1ff)],_0x3512e=_0x57e372[_0xb3602(0x1e6)][_0xb3602(0x23c)][_0xb3602(0x1f6)],_0x4fad6f=_0x9364be?_0xb3602(0x1c2)+_0x9364be+'\x22':'';_0x3512e?console['error'](_0xb3602(0x201)+_0x778984[_0xb3602(0x1cf)]+_0xb3602(0x1f5)+_0x4fad6f+_0xb3602(0x218)):console[_0xb3602(0x1b6)]('Found\x20'+_0x778984[_0xb3602(0x1cf)]+_0xb3602(0x234)+(_0x778984[_0xb3602(0x1cf)]!==0x1?_0xb3602(0x212):'y')+_0x4fad6f);if(_0x5152ba[_0xb3602(0x1e2)]===_0xb3602(0x225)||_0x5152ba['format']==='jsonl'||_0x5152ba[_0xb3602(0x1e2)]==='table'||_0x5152ba[_0xb3602(0x1e2)]===_0xb3602(0x1f1)){const _0xc9f805=_0x778984['map'](_0x586a36=>({'id':_0x586a36['id'],'name':_0x586a36[_0xb3602(0x202)],'cron':_0x586a36[_0xb3602(0x216)],'database':_0x586a36['database']?.[_0xb3602(0x202)],'type':_0x586a36[_0xb3602(0x1d0)],'timezone':_0x586a36[_0xb3602(0x1c7)],'user_name':_0x586a36['user']?.[_0xb3602(0x202)],'updated_at':_0x586a36[_0xb3602(0x1be)],'next_run_at':_0x586a36[_0xb3602(0x229)],'last_job_status':_0x586a36[_0xb3602(0x245)]?.[_0xb3602(0x1bd)]}));await handleSDKOutput(_0xc9f805,_0x5152ba);}else{if(_0x778984['length']===0x0)console[_0xb3602(0x21a)](_0xb3602(0x242));else{const _0x18bc4d=_0x5152ba[_0xb3602(0x22a)],_0x33bfb1=_0x778984[_0xb3602(0x22b)](_0x46d1f0=>{const _0x124247=_0xb3602,_0x4f96ff=_0x46d1f0[_0x124247(0x245)]?.[_0x124247(0x1bd)]?_0x46d1f0[_0x124247(0x245)][_0x124247(0x1bd)]==='success'?'✓':'✗':'-',_0x311f4e=_0x46d1f0[_0x124247(0x245)]?.['ended_at']?formatRelativeTime(_0x46d1f0[_0x124247(0x245)][_0x124247(0x233)]):_0x124247(0x1c5),_0x2014bf=_0x46d1f0['next_run_at']?formatRelativeTime(_0x46d1f0['next_run_at']):'-',_0x50a436=_0x46d1f0['cron']||'',_0x2b7a5e=_0x46d1f0[_0x124247(0x202)]||_0x124247(0x1d9),_0x226b2d=getConsoleUrl(_0x18bc4d,'/app/queries/editor?queryId='+_0x46d1f0['id']);return{'statusIcon':_0x4f96ff,'lastRun':_0x311f4e,'nextRun':_0x2014bf,'cron':_0x50a436,'name':_0x2b7a5e,'queryUrl':_0x226b2d,'status':_0x46d1f0[_0x124247(0x245)]?.[_0x124247(0x1bd)]};}),_0x1d70b7=Math[_0xb3602(0x243)](..._0x33bfb1[_0xb3602(0x22b)](_0x455934=>_0x455934[_0xb3602(0x1e0)][_0xb3602(0x1cf)])),_0x42fb0e=Math[_0xb3602(0x243)](..._0x33bfb1[_0xb3602(0x22b)](_0x5685aa=>_0x5685aa['nextRun'][_0xb3602(0x1cf)])),_0x4a2297=Math['max'](..._0x33bfb1[_0xb3602(0x22b)](_0x26eae0=>_0x26eae0['cron'][_0xb3602(0x1cf)])),_0x4778de=_0x33bfb1[_0xb3602(0x22b)](_0x239217=>{const _0x414f48=_0xb3602,_0x21063f=_0x239217[_0x414f48(0x1bd)]===_0x414f48(0x1b3)?a36_0x540daf[_0x414f48(0x1c9)](_0x239217[_0x414f48(0x1f9)]):_0x239217[_0x414f48(0x1bd)]==='error'?a36_0x540daf[_0x414f48(0x1e5)](_0x239217[_0x414f48(0x1f9)]):a36_0x540daf['dim'](_0x239217[_0x414f48(0x1f9)]),_0x53f9dc=_0x239217[_0x414f48(0x1e0)][_0x414f48(0x1d1)](_0x1d70b7),_0x126297=_0x239217[_0x414f48(0x1b9)]['padEnd'](_0x42fb0e),_0x386dad=_0x239217[_0x414f48(0x216)]?a36_0x540daf[_0x414f48(0x211)](_0x239217[_0x414f48(0x216)][_0x414f48(0x1d1)](_0x4a2297)):'\x20'[_0x414f48(0x20c)](_0x4a2297),_0x334b7f=hyperlink(_0x239217[_0x414f48(0x202)],_0x239217[_0x414f48(0x237)]);return _0x414f48(0x23b)+_0x21063f+'\x20'+_0x53f9dc+'\x20\x20→\x20'+_0x126297+'\x20\x20'+_0x386dad+'\x20\x20'+_0x334b7f;});await writeOutput(_0x4778de['join']('\x0a'),_0x5152ba[_0xb3602(0x1ea)],_0xb3602(0x1c3));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x22f77b(0x202)]=a36_0x22f77b(0x22d);['description']=a36_0x22f77b(0x1cc);[a36_0x22f77b(0x230)](_0x3e22dc){const _0x4ba036=a36_0x22f77b,_0xaee0cb=_0x3e22dc[_0x4ba036(0x1f8)][0x0];if(!_0xaee0cb)return _0x4ba036(0x1f3);return undefined;}async[a36_0x22f77b(0x22f)](_0x32af1b){const _0xc4d406=a36_0x22f77b,{options:_0x2a7fd6,args:_0x12f80b,tdx:_0x332d9e}=_0x32af1b,_0x477090=_0x12f80b[0x0],_0x41d109=await withSpinner(_0xc4d406(0x23d),()=>_0x332d9e[_0xc4d406(0x1ba)][_0xc4d406(0x20b)](_0x477090),{'verbose':_0x2a7fd6[_0xc4d406(0x1d2)]}),_0x163994=_0x41d109[_0xc4d406(0x1e6)],_0x429d68={'name':_0x163994[_0xc4d406(0x202)],'cron':_0x163994[_0xc4d406(0x216)],'database':_0x163994[_0xc4d406(0x236)],'type':_0x163994[_0xc4d406(0x1d0)],'timezone':_0x163994['timezone'],'user_name':_0x163994[_0xc4d406(0x238)],'created_at':_0x163994[_0xc4d406(0x1fc)],'engine_version':_0x163994[_0xc4d406(0x217)],'executing_user_id':_0x163994['executing_user_id'],'query':_0x163994['query'],'delay':_0x163994[_0xc4d406(0x21e)],'priority':_0x163994[_0xc4d406(0x1e7)],'retry_limit':_0x163994['retry_limit'],..._0x163994['result']&&{'result':_0x163994[_0xc4d406(0x1fe)]}};return await handleSingleObjectOutput(_0x429d68,_0x2a7fd6),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']=a36_0x22f77b(0x1e9);[a36_0x22f77b(0x1fd)]=a36_0x22f77b(0x232);[a36_0x22f77b(0x230)](_0x50093c){const _0x54eab8=a36_0x22f77b,_0x3b2bb0=_0x50093c[_0x54eab8(0x1f8)][0x0];if(!_0x3b2bb0)return _0x54eab8(0x1ce);const _0x1367dc=_0x50093c[_0x54eab8(0x1ec)];if(!_0x1367dc['database'])return'Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';return undefined;}async[a36_0x22f77b(0x22f)](_0xc03b9e){const _0x6e6e4e=a36_0x22f77b,{options:_0x458f90,args:_0x5e236c,tdx:_0x302754}=_0xc03b9e,_0x44c82c=_0x5e236c[0x0],_0x399bc0=_0x458f90,_0x36e3c0=_0x399bc0['database'],_0x3d1dad=_0x399bc0[_0x6e6e4e(0x1de)],_0x3400d3=_0x399bc0['type']||_0x6e6e4e(0x210);let _0x1c6409;try{_0x1c6409=readFileSync(_0x3d1dad,_0x6e6e4e(0x20a))[_0x6e6e4e(0x213)]();}catch(_0x1d511b){throw new SDKError(ErrorCode[_0x6e6e4e(0x1b8)],_0x6e6e4e(0x1e8)+_0x3d1dad,_0x1d511b instanceof Error?_0x1d511b:undefined);}if(!_0x1c6409)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x6e6e4e(0x219));const _0x4ba451={'database':_0x36e3c0,'query':_0x1c6409,'type':_0x3400d3};if(_0x399bc0[_0x6e6e4e(0x216)])_0x4ba451[_0x6e6e4e(0x216)]=_0x399bc0['cron'];if(_0x399bc0['timezone'])_0x4ba451[_0x6e6e4e(0x23f)]=_0x399bc0[_0x6e6e4e(0x23f)];if(_0x399bc0[_0x6e6e4e(0x21e)]!==undefined)_0x4ba451[_0x6e6e4e(0x21e)]=Number(_0x399bc0[_0x6e6e4e(0x21e)]);if(_0x399bc0[_0x6e6e4e(0x1e7)]!==undefined)_0x4ba451[_0x6e6e4e(0x1e7)]=Number(_0x399bc0['priority']);if(_0x399bc0['retryLimit']!==undefined)_0x4ba451[_0x6e6e4e(0x1d5)]=Number(_0x399bc0[_0x6e6e4e(0x235)]);if(_0x399bc0['engineVersion'])_0x4ba451[_0x6e6e4e(0x217)]=_0x399bc0[_0x6e6e4e(0x239)];if(_0x399bc0[_0x6e6e4e(0x1fe)])_0x4ba451[_0x6e6e4e(0x1fe)]=_0x399bc0[_0x6e6e4e(0x1fe)];if(_0x458f90[_0x6e6e4e(0x1d2)]){console['error'](_0x6e6e4e(0x1b7)+_0x44c82c),console['error'](_0x6e6e4e(0x1c8)+_0x36e3c0),console['error'](_0x6e6e4e(0x215)+_0x3400d3);if(_0x4ba451[_0x6e6e4e(0x216)])console['error'](_0x6e6e4e(0x20d)+_0x4ba451[_0x6e6e4e(0x216)]);if(_0x4ba451[_0x6e6e4e(0x23f)])console[_0x6e6e4e(0x1b6)]('\x20\x20Timezone:\x20'+_0x4ba451[_0x6e6e4e(0x23f)]);}const _0x427970=await withSpinner(_0x6e6e4e(0x1fa),()=>_0x302754[_0x6e6e4e(0x1ba)]['create'](_0x44c82c,_0x4ba451),{'verbose':_0x458f90['verbose']});return console[_0x6e6e4e(0x1b6)](_0x6e6e4e(0x23e)+_0x427970[_0x6e6e4e(0x1e6)][_0x6e6e4e(0x202)]),await handleSingleObjectOutput(_0x427970['data'],_0x458f90),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x22f77b(0x202)]=a36_0x22f77b(0x221);[a36_0x22f77b(0x1fd)]='Update\x20a\x20scheduled\x20query';[a36_0x22f77b(0x230)](_0x191580){const _0x2f4a55=a36_0x22f77b,_0xf46cd8=_0x191580[_0x2f4a55(0x1f8)][0x0];if(!_0xf46cd8)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]';return undefined;}async[a36_0x22f77b(0x22f)](_0x4b70bd){const _0x4b95b0=a36_0x22f77b,{options:_0x50d026,args:_0x33b209,tdx:_0x4293ce}=_0x4b70bd,_0x5051fb=_0x33b209[0x0],_0x284c1c=_0x50d026,_0x43dd27={};if(_0x284c1c[_0x4b95b0(0x236)])_0x43dd27[_0x4b95b0(0x236)]=_0x284c1c['database'];if(_0x284c1c[_0x4b95b0(0x1d0)])_0x43dd27[_0x4b95b0(0x1d0)]=_0x284c1c[_0x4b95b0(0x1d0)];if(_0x284c1c[_0x4b95b0(0x216)])_0x43dd27[_0x4b95b0(0x216)]=_0x284c1c[_0x4b95b0(0x216)];if(_0x284c1c[_0x4b95b0(0x23f)])_0x43dd27['timezone']=_0x284c1c[_0x4b95b0(0x23f)];if(_0x284c1c[_0x4b95b0(0x21e)]!==undefined)_0x43dd27[_0x4b95b0(0x21e)]=Number(_0x284c1c[_0x4b95b0(0x21e)]);if(_0x284c1c[_0x4b95b0(0x1e7)]!==undefined)_0x43dd27[_0x4b95b0(0x1e7)]=Number(_0x284c1c['priority']);if(_0x284c1c[_0x4b95b0(0x235)]!==undefined)_0x43dd27[_0x4b95b0(0x1d5)]=Number(_0x284c1c[_0x4b95b0(0x235)]);if(_0x284c1c[_0x4b95b0(0x239)])_0x43dd27[_0x4b95b0(0x217)]=_0x284c1c[_0x4b95b0(0x239)];if(_0x284c1c[_0x4b95b0(0x1fe)])_0x43dd27[_0x4b95b0(0x1fe)]=_0x284c1c[_0x4b95b0(0x1fe)];if(_0x284c1c[_0x4b95b0(0x1de)])try{_0x43dd27['query']=readFileSync(_0x284c1c['file'],'utf-8')[_0x4b95b0(0x213)]();}catch(_0x359914){throw new SDKError(ErrorCode[_0x4b95b0(0x1b8)],_0x4b95b0(0x1e8)+_0x284c1c['file'],_0x359914 instanceof Error?_0x359914:undefined);}if(Object[_0x4b95b0(0x1f0)](_0x43dd27)[_0x4b95b0(0x1cf)]===0x0)throw new SDKError(ErrorCode[_0x4b95b0(0x1b8)],_0x4b95b0(0x1e1));if(_0x50d026[_0x4b95b0(0x1d2)]){console[_0x4b95b0(0x1b6)](_0x4b95b0(0x1c1)+_0x5051fb);for(const [_0x690378,_0x1e992f]of Object[_0x4b95b0(0x1d3)](_0x43dd27)){_0x690378===_0x4b95b0(0x214)?console[_0x4b95b0(0x1b6)]('\x20\x20'+_0x690378+':\x20'+_0x1e992f[_0x4b95b0(0x1ed)](0x0,0x32)+_0x4b95b0(0x1e4)):console[_0x4b95b0(0x1b6)]('\x20\x20'+_0x690378+':\x20'+_0x1e992f);}}const _0x5e742f=await withSpinner('Updating\x20schedule...',()=>_0x4293ce[_0x4b95b0(0x1ba)][_0x4b95b0(0x1b4)](_0x5051fb,_0x43dd27),{'verbose':_0x50d026[_0x4b95b0(0x1d2)]});return console[_0x4b95b0(0x1b6)](_0x4b95b0(0x23a)+_0x5e742f[_0x4b95b0(0x1e6)]['name']),await handleSingleObjectOutput(_0x5e742f['data'],_0x50d026),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x22f77b(0x202)]=a36_0x22f77b(0x222);['description']=a36_0x22f77b(0x1bc);[a36_0x22f77b(0x230)](_0x35b36b){const _0x1308a0=a36_0x22f77b,_0xb1d12f=_0x35b36b[_0x1308a0(0x1f8)][0x0];if(!_0xb1d12f)return _0x1308a0(0x226);return undefined;}async[a36_0x22f77b(0x22f)](_0x2ebac1){const _0x17a4c8=a36_0x22f77b,{options:_0x120b5c,args:_0x5d25e1,tdx:_0x5106c3}=_0x2ebac1,_0x1a8ad7=_0x5d25e1[0x0];if(!_0x120b5c[_0x17a4c8(0x22c)]){const _0x2647f9=await confirm(_0x17a4c8(0x205)+_0x1a8ad7+'\x22?');if(!_0x2647f9)return console['error'](_0x17a4c8(0x1cb)),0x0;}const _0x1bf25e=await withSpinner('Deleting\x20schedule...',()=>_0x5106c3[_0x17a4c8(0x1ba)][_0x17a4c8(0x244)](_0x1a8ad7),{'verbose':_0x120b5c[_0x17a4c8(0x1d2)]});return console['error'](_0x17a4c8(0x1b2)+_0x1bf25e['data']['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x22f77b(0x202)]='schedule:run';[a36_0x22f77b(0x1fd)]=a36_0x22f77b(0x21b);[a36_0x22f77b(0x230)](_0x57a816){const _0x32fd2e=a36_0x22f77b,_0x209be9=_0x57a816[_0x32fd2e(0x1f8)][0x0];if(!_0x209be9)return _0x32fd2e(0x1eb);return undefined;}async['execute'](_0x42f8c2){const _0x528440=a36_0x22f77b,{options:_0x4ef7af,args:_0x1ab653,tdx:_0x2356cc}=_0x42f8c2,_0x37eed2=_0x1ab653[0x0],_0x1d499a=_0x4ef7af,_0x58ada8=_0x1d499a[_0x528440(0x1dd)],_0x2e4f45=_0x1d499a[_0x528440(0x1c0)]!==undefined?Number(_0x1d499a['num']):undefined;if(_0x4ef7af[_0x528440(0x1d2)]){console[_0x528440(0x1b6)](_0x528440(0x209)+_0x37eed2);if(_0x58ada8)console[_0x528440(0x1b6)]('\x20\x20Time:\x20'+_0x58ada8);if(_0x2e4f45)console[_0x528440(0x1b6)](_0x528440(0x1c4)+_0x2e4f45);}const _0x52bcb5=await withSpinner('Running\x20schedule...',()=>_0x2356cc['schedules'][_0x528440(0x1e3)](_0x37eed2,{'time':_0x58ada8,'num':_0x2e4f45}),{'verbose':_0x4ef7af['verbose']}),_0x22aae7=_0x52bcb5[_0x528440(0x1e6)][_0x528440(0x200)];console['error'](_0x528440(0x1f7)+_0x22aae7[_0x528440(0x1cf)]+_0x528440(0x1d7)+(_0x22aae7[_0x528440(0x1cf)]!==0x1?'s':'')+_0x528440(0x203));for(const _0x589de2 of _0x22aae7){console['error'](_0x528440(0x208)+_0x589de2['job_id']);}return await handleSDKOutput(_0x22aae7,_0x4ef7af),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{['name']=a36_0x22f77b(0x231);[a36_0x22f77b(0x1fd)]='Show\x20schedule\x20execution\x20history';[a36_0x22f77b(0x230)](_0x3f71df){const _0x12c013=a36_0x22f77b,_0x472a37=_0x3f71df[_0x12c013(0x1f8)][0x0];if(!_0x472a37)return _0x12c013(0x204);return undefined;}async['execute'](_0x2f7cf3){const _0x2ff74c=a36_0x22f77b,{options:_0x340791,args:_0x3d8ae8,tdx:_0x22c6fa}=_0x2f7cf3,_0x4597f3=_0x3d8ae8[0x0],_0x5924ad=_0x340791,_0x2cf749=_0x5924ad[_0x2ff74c(0x240)]!==undefined?Number(_0x5924ad[_0x2ff74c(0x240)]):undefined,_0x447802=_0x5924ad['to']!==undefined?Number(_0x5924ad['to']):undefined,_0x2f8210=await withSpinner('Getting\x20schedule\x20history...',()=>_0x22c6fa[_0x2ff74c(0x1ba)][_0x2ff74c(0x1f2)](_0x4597f3,{'from':_0x2cf749,'to':_0x447802}),{'verbose':_0x340791[_0x2ff74c(0x1d2)]}),_0x5d1b08=_0x2f8210[_0x2ff74c(0x1e6)];console[_0x2ff74c(0x1b6)](_0x2ff74c(0x1d6)+_0x5d1b08[_0x2ff74c(0x223)]+_0x2ff74c(0x1df)+(_0x5d1b08[_0x2ff74c(0x223)]!==0x1?'s':'')+_0x2ff74c(0x1ee)+_0x5d1b08[_0x2ff74c(0x240)]+'-'+_0x5d1b08['to']+')');const _0x783a29=_0x5d1b08[_0x2ff74c(0x1f2)][_0x2ff74c(0x22b)](_0x1e1d6f=>({'job_id':_0x1e1d6f[_0x2ff74c(0x1c6)],'type':_0x1e1d6f[_0x2ff74c(0x1d0)],'status':_0x1e1d6f[_0x2ff74c(0x1bd)],'scheduled_at':_0x1e1d6f[_0x2ff74c(0x1b5)],'created_at':_0x1e1d6f['created_at'],'start_at':_0x1e1d6f[_0x2ff74c(0x1d8)],'end_at':_0x1e1d6f[_0x2ff74c(0x1fb)]}));return await handleSDKOutput(_0x783a29,_0x340791),0x0;}}
1
+ const a36_0x180c5e=a36_0xf564;(function(_0x342385,_0x2d8a67){const _0x9674ed=a36_0xf564,_0x8731b4=_0x342385();while(!![]){try{const _0x495538=-parseInt(_0x9674ed(0x1ac))/0x1+parseInt(_0x9674ed(0x18c))/0x2*(-parseInt(_0x9674ed(0x1dd))/0x3)+-parseInt(_0x9674ed(0x17e))/0x4+parseInt(_0x9674ed(0x16c))/0x5*(-parseInt(_0x9674ed(0x1d9))/0x6)+-parseInt(_0x9674ed(0x1c0))/0x7+parseInt(_0x9674ed(0x1de))/0x8+-parseInt(_0x9674ed(0x196))/0x9*(-parseInt(_0x9674ed(0x191))/0xa);if(_0x495538===_0x2d8a67)break;else _0x8731b4['push'](_0x8731b4['shift']());}catch(_0x2a83f4){_0x8731b4['push'](_0x8731b4['shift']());}}}(a36_0xde65,0xcd37d));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';function a36_0xf564(_0x393b54,_0x3c2fe4){_0x393b54=_0x393b54-0x150;const _0xde651b=a36_0xde65();let _0xf5647c=_0xde651b[_0x393b54];return _0xf5647c;}import a36_0x26f0cb from'chalk';function formatRelativeTime(_0xb9a860){const _0x538bc7=a36_0xf564,_0x492644=new Date(_0xb9a860),_0x21a6e9=new Date(),_0x113ac5=_0x492644[_0x538bc7(0x18a)]()-_0x21a6e9[_0x538bc7(0x18a)](),_0x350f11=Math[_0x538bc7(0x195)](_0x113ac5)/0x3e8,_0x582ef4=_0x113ac5<0x0;if(_0x350f11<0x3c)return _0x582ef4?_0x538bc7(0x153):_0x538bc7(0x15d);else{if(_0x350f11<0xe10){const _0x2e4bc2=Math[_0x538bc7(0x1dc)](_0x350f11/0x3c);return _0x582ef4?_0x2e4bc2+_0x538bc7(0x1d7):_0x538bc7(0x1df)+_0x2e4bc2+'m';}else{if(_0x350f11<0x15180){const _0x77dc54=Math['round'](_0x350f11/0xe10);return _0x582ef4?_0x77dc54+_0x538bc7(0x1ca):_0x538bc7(0x1df)+_0x77dc54+'h';}else{if(_0x350f11<0x93a80){const _0x1cbe70=Math[_0x538bc7(0x1dc)](_0x350f11/0x15180);return _0x582ef4?_0x1cbe70+_0x538bc7(0x1c5):_0x538bc7(0x1df)+_0x1cbe70+'d';}else return _0x492644[_0x538bc7(0x172)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x180c5e(0x1e0)]=a36_0x180c5e(0x1a6);[a36_0x180c5e(0x1a8)]=a36_0x180c5e(0x1a3);async[a36_0x180c5e(0x17d)](_0x1416b8){const _0x11f52c=a36_0x180c5e,{options:_0x498dab,args:_0x529b0f,tdx:_0x4d9d0f}=_0x1416b8,_0x32f93e=resolveLimit(_0x498dab['limit'],DEFAULT_DISPLAY_LIMIT),_0xa8cfca=_0x529b0f[0x0],_0x593e68=_0xa8cfca?_0x11f52c(0x157)+_0xa8cfca+'\x22...':_0x11f52c(0x1c4),_0x3628af=await withSpinner(_0x593e68,()=>_0x4d9d0f['schedules'][_0x11f52c(0x1c7)]({'limit':_0x32f93e,'scheduled':!![],'pattern':_0xa8cfca}),{'verbose':_0x498dab[_0x11f52c(0x1bd)]}),_0x13902d=_0x3628af['data'][_0x11f52c(0x1e2)],_0x1e322a=_0x3628af[_0x11f52c(0x169)][_0x11f52c(0x177)][_0x11f52c(0x155)],_0xd96c24=_0xa8cfca?_0x11f52c(0x184)+_0xa8cfca+'\x22':'';_0x1e322a?console['error'](_0x11f52c(0x1c6)+_0x13902d[_0x11f52c(0x1b3)]+_0x11f52c(0x1ce)+_0xd96c24+'\x20(use\x20--limit\x20to\x20see\x20more)'):console['error'](_0x11f52c(0x167)+_0x13902d['length']+_0x11f52c(0x159)+(_0x13902d[_0x11f52c(0x1b3)]!==0x1?_0x11f52c(0x1b2):'y')+_0xd96c24);if(_0x498dab[_0x11f52c(0x1d5)]==='json'||_0x498dab[_0x11f52c(0x1d5)]===_0x11f52c(0x166)||_0x498dab[_0x11f52c(0x1d5)]===_0x11f52c(0x160)||_0x498dab['format']===_0x11f52c(0x19d)){const _0x5f16f6=_0x13902d[_0x11f52c(0x175)](_0x100f21=>({'id':_0x100f21['id'],'name':_0x100f21[_0x11f52c(0x1e0)],'cron':_0x100f21['cron'],'database':_0x100f21[_0x11f52c(0x17b)]?.[_0x11f52c(0x1e0)],'type':_0x100f21[_0x11f52c(0x1c8)],'timezone':_0x100f21[_0x11f52c(0x162)],'user_name':_0x100f21['user']?.['name'],'updated_at':_0x100f21[_0x11f52c(0x185)],'next_run_at':_0x100f21[_0x11f52c(0x1bc)],'last_job_status':_0x100f21[_0x11f52c(0x161)]?.[_0x11f52c(0x18f)]}));await handleSDKOutput(_0x5f16f6,_0x498dab);}else{if(_0x13902d[_0x11f52c(0x1b3)]===0x0)console['log'](_0x11f52c(0x1c3));else{const _0x329bbd=_0x498dab[_0x11f52c(0x1cd)],_0x150e43=_0x13902d['map'](_0x53d843=>{const _0x410dd7=_0x11f52c,_0x16286d=_0x53d843['last_job']?.[_0x410dd7(0x18f)]?_0x53d843[_0x410dd7(0x161)]['status']===_0x410dd7(0x1b5)?'✓':'✗':'-',_0x4e4930=_0x53d843[_0x410dd7(0x161)]?.[_0x410dd7(0x1d1)]?formatRelativeTime(_0x53d843[_0x410dd7(0x161)]['ended_at']):_0x410dd7(0x174),_0x112e7c=_0x53d843[_0x410dd7(0x1bc)]?formatRelativeTime(_0x53d843[_0x410dd7(0x1bc)]):'-',_0x517f05=_0x53d843[_0x410dd7(0x1ba)]||'',_0x1c9dd6=_0x53d843['name']||'(unnamed)',_0x1f6a79=getConsoleUrl(_0x329bbd,_0x410dd7(0x1b9)+_0x53d843['id']);return{'statusIcon':_0x16286d,'lastRun':_0x4e4930,'nextRun':_0x112e7c,'cron':_0x517f05,'name':_0x1c9dd6,'queryUrl':_0x1f6a79,'status':_0x53d843[_0x410dd7(0x161)]?.[_0x410dd7(0x18f)]};}),_0x5c2aee=Math[_0x11f52c(0x1a2)](..._0x150e43[_0x11f52c(0x175)](_0x3e1bc2=>_0x3e1bc2[_0x11f52c(0x1ab)]['length'])),_0x2e4316=Math['max'](..._0x150e43[_0x11f52c(0x175)](_0x426e3f=>_0x426e3f[_0x11f52c(0x1a7)][_0x11f52c(0x1b3)])),_0x409977=Math[_0x11f52c(0x1a2)](..._0x150e43[_0x11f52c(0x175)](_0x1a3fb1=>_0x1a3fb1[_0x11f52c(0x1ba)]['length'])),_0x1ffcdf=_0x150e43[_0x11f52c(0x175)](_0x52a420=>{const _0x1b0a81=_0x11f52c,_0x53cc03=_0x52a420['status']===_0x1b0a81(0x1b5)?a36_0x26f0cb[_0x1b0a81(0x1a1)](_0x52a420[_0x1b0a81(0x151)]):_0x52a420['status']===_0x1b0a81(0x1d3)?a36_0x26f0cb[_0x1b0a81(0x199)](_0x52a420[_0x1b0a81(0x151)]):a36_0x26f0cb[_0x1b0a81(0x1c1)](_0x52a420[_0x1b0a81(0x151)]),_0x317126=_0x52a420[_0x1b0a81(0x1ab)][_0x1b0a81(0x158)](_0x5c2aee),_0x243a72=_0x52a420['nextRun'][_0x1b0a81(0x158)](_0x2e4316),_0x56b471=_0x52a420['cron']?a36_0x26f0cb[_0x1b0a81(0x15b)](_0x52a420['cron'][_0x1b0a81(0x158)](_0x409977)):'\x20'[_0x1b0a81(0x197)](_0x409977),_0xbbd2be=hyperlink(_0x52a420[_0x1b0a81(0x1e0)],_0x52a420[_0x1b0a81(0x1a9)]);return _0x1b0a81(0x1b6)+_0x53cc03+'\x20'+_0x317126+_0x1b0a81(0x193)+_0x243a72+'\x20\x20'+_0x56b471+'\x20\x20'+_0xbbd2be;});await writeOutput(_0x1ffcdf[_0x11f52c(0x1ae)]('\x0a'),_0x498dab[_0x11f52c(0x180)],_0x11f52c(0x170));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x180c5e(0x1e0)]=a36_0x180c5e(0x187);[a36_0x180c5e(0x1a8)]=a36_0x180c5e(0x1b8);[a36_0x180c5e(0x1d0)](_0x319f88){const _0x5142cc=a36_0x180c5e,_0x51dbef=_0x319f88[_0x5142cc(0x15c)][0x0];if(!_0x51dbef)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async[a36_0x180c5e(0x17d)](_0x2cdca3){const _0x3b822f=a36_0x180c5e,{options:_0x56e082,args:_0x10b005,tdx:_0x2b0427}=_0x2cdca3,_0x468b8b=_0x10b005[0x0],_0x1cef5c=await withSpinner(_0x3b822f(0x17c),()=>_0x2b0427[_0x3b822f(0x16f)]['show'](_0x468b8b),{'verbose':_0x56e082[_0x3b822f(0x1bd)]}),_0x3b551d=_0x1cef5c[_0x3b822f(0x169)],_0x374fe1={'name':_0x3b551d[_0x3b822f(0x1e0)],'cron':_0x3b551d[_0x3b822f(0x1ba)],'database':_0x3b551d[_0x3b822f(0x17b)],'type':_0x3b551d[_0x3b822f(0x1c8)],'timezone':_0x3b551d['timezone'],'user_name':_0x3b551d['user_name'],'created_at':_0x3b551d['created_at'],'engine_version':_0x3b551d[_0x3b822f(0x1d4)],'executing_user_id':_0x3b551d[_0x3b822f(0x18e)],'query':_0x3b551d['query'],'delay':_0x3b551d[_0x3b822f(0x164)],'priority':_0x3b551d['priority'],'retry_limit':_0x3b551d[_0x3b822f(0x194)],..._0x3b551d[_0x3b822f(0x198)]&&{'result':_0x3b551d['result']}};return await handleSingleObjectOutput(_0x374fe1,_0x56e082),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']='schedule:create';['description']='Create\x20a\x20scheduled\x20query';[a36_0x180c5e(0x1d0)](_0x3fd4e3){const _0x1138cf=a36_0x180c5e,_0x1b2ca5=_0x3fd4e3['args'][0x0];if(!_0x1b2ca5)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';const _0x55a5ac=_0x3fd4e3[_0x1138cf(0x19c)];if(!_0x55a5ac[_0x1138cf(0x17b)])return _0x1138cf(0x15a);return undefined;}async['execute'](_0x4d0009){const _0x2fd7df=a36_0x180c5e,{options:_0x1b1e3d,args:_0x3879cf,tdx:_0x544be2}=_0x4d0009,_0x900a38=_0x3879cf[0x0],_0x39a4b7=_0x1b1e3d,_0x125ec8=_0x39a4b7[_0x2fd7df(0x17b)],_0x3bef2c=_0x39a4b7[_0x2fd7df(0x1a5)],_0x5223a3=_0x39a4b7['type']||_0x2fd7df(0x18b);let _0x48e9ea;try{_0x48e9ea=readFileSync(_0x3bef2c,_0x2fd7df(0x1d2))[_0x2fd7df(0x1ad)]();}catch(_0x4c5e94){throw new SDKError(ErrorCode[_0x2fd7df(0x19f)],_0x2fd7df(0x168)+_0x3bef2c,_0x4c5e94 instanceof Error?_0x4c5e94:undefined);}if(!_0x48e9ea)throw new SDKError(ErrorCode[_0x2fd7df(0x19f)],_0x2fd7df(0x156));const _0x2664bb={'database':_0x125ec8,'query':_0x48e9ea,'type':_0x5223a3};if(_0x39a4b7['cron'])_0x2664bb[_0x2fd7df(0x1ba)]=_0x39a4b7[_0x2fd7df(0x1ba)];if(_0x39a4b7[_0x2fd7df(0x1b1)])_0x2664bb[_0x2fd7df(0x1b1)]=_0x39a4b7[_0x2fd7df(0x1b1)];if(_0x39a4b7[_0x2fd7df(0x164)]!==undefined)_0x2664bb[_0x2fd7df(0x164)]=Number(_0x39a4b7['delay']);if(_0x39a4b7[_0x2fd7df(0x182)]!==undefined)_0x2664bb[_0x2fd7df(0x182)]=Number(_0x39a4b7[_0x2fd7df(0x182)]);if(_0x39a4b7[_0x2fd7df(0x1aa)]!==undefined)_0x2664bb['retry_limit']=Number(_0x39a4b7[_0x2fd7df(0x1aa)]);if(_0x39a4b7['engineVersion'])_0x2664bb[_0x2fd7df(0x1d4)]=_0x39a4b7[_0x2fd7df(0x192)];if(_0x39a4b7[_0x2fd7df(0x198)])_0x2664bb[_0x2fd7df(0x198)]=_0x39a4b7[_0x2fd7df(0x198)];if(_0x1b1e3d[_0x2fd7df(0x1bd)]){console[_0x2fd7df(0x1d3)](_0x2fd7df(0x16d)+_0x900a38),console[_0x2fd7df(0x1d3)](_0x2fd7df(0x16a)+_0x125ec8),console[_0x2fd7df(0x1d3)](_0x2fd7df(0x16b)+_0x5223a3);if(_0x2664bb['cron'])console[_0x2fd7df(0x1d3)]('\x20\x20Cron:\x20'+_0x2664bb[_0x2fd7df(0x1ba)]);if(_0x2664bb[_0x2fd7df(0x1b1)])console[_0x2fd7df(0x1d3)](_0x2fd7df(0x176)+_0x2664bb['timezone']);}const _0x12d370=await withSpinner(_0x2fd7df(0x15f),()=>_0x544be2[_0x2fd7df(0x16f)]['create'](_0x900a38,_0x2664bb),{'verbose':_0x1b1e3d[_0x2fd7df(0x1bd)]});return console['error']('Schedule\x20created:\x20'+_0x12d370['data']['name']),await handleSingleObjectOutput(_0x12d370[_0x2fd7df(0x169)],_0x1b1e3d),0x0;}}function a36_0xde65(){const _0xe72823=['6604497QmTDul','repeat','result','red','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','\x20\x20Num:\x20','options','tsv','Run\x20a\x20scheduled\x20query\x20immediately','INVALID_ARGUMENT','from','green','max','List\x20scheduled\x20queries','Deleting\x20schedule...','file','schedule:list','nextRun','description','queryUrl','retryLimit','lastRun','530492ERuYnH','trim','join','query','\x20\x20Job\x20ID:\x20','timezone','ies','length','run','success','📅\x20','Delete\x20a\x20scheduled\x20query','Show\x20schedule\x20details','/app/queries/editor?queryId=','cron','Running\x20schedule:\x20','next_run_at','verbose','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','10385655DDBNdz','dim','created_at','No\x20scheduled\x20queries\x20found','Listing\x20scheduled\x20queries...','d\x20ago','Showing\x20first\x20','listQueries','type','scheduled_at','h\x20ago','\x20execution','Show\x20schedule\x20execution\x20history','site','\x20schedules','Schedule\x20run\x20submitted:\x20','validate','ended_at','utf-8','error','engine_version','format','num','m\x20ago','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','918GHChpa','jobs','schedule:history','round','22779SKmmJS','3247160rSndsh','in\x20','name','delete','queries','time','statusIcon','Running\x20schedule...','just\x20now','substring','has_next_page','Query\x20file\x20is\x20empty','Searching\x20scheduled\x20queries\x20matching\x20\x22','padEnd','\x20scheduled\x20quer','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','cyan','args','soon','Getting\x20schedule\x20history...','Creating\x20schedule...','table','last_job','time_zone','\x20(showing\x20','delay','job_id','jsonl','Found\x20','Failed\x20to\x20read\x20file:\x20','data','\x20\x20Database:\x20','\x20\x20Type:\x20','5650xlKtku','Creating\x20schedule:\x20','history','schedules','list','...','toLocaleDateString','start_at','never','map','\x20\x20Timezone:\x20','pagination','Updating\x20schedule:\x20','Cancelled','\x20job','database','Getting\x20schedule\x20details...','execute','4300496kGwbRS','Updating\x20schedule...','output','Schedule\x20updated:\x20','priority','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','\x20matching\x20\x22','updated_at','Schedule\x20deleted:\x20','schedule:show','keys','update','getTime','trino','186zfVrZJ','\x20created','executing_user_id','status','\x20\x20Time:\x20','60gaSthp','engineVersion','\x20\x20→\x20','retry_limit','abs'];a36_0xde65=function(){return _0xe72823;};return a36_0xde65();}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x180c5e(0x1e0)]='schedule:update';[a36_0x180c5e(0x1a8)]='Update\x20a\x20scheduled\x20query';[a36_0x180c5e(0x1d0)](_0x50d9db){const _0x4db4d7=a36_0x180c5e,_0x16cdc3=_0x50d9db[_0x4db4d7(0x15c)][0x0];if(!_0x16cdc3)return _0x4db4d7(0x183);return undefined;}async['execute'](_0x32a97){const _0x5d8883=a36_0x180c5e,{options:_0x4d1cf9,args:_0x12c503,tdx:_0x4c4016}=_0x32a97,_0x1018f5=_0x12c503[0x0],_0x56e6c2=_0x4d1cf9,_0x2b64d8={};if(_0x56e6c2[_0x5d8883(0x17b)])_0x2b64d8['database']=_0x56e6c2[_0x5d8883(0x17b)];if(_0x56e6c2[_0x5d8883(0x1c8)])_0x2b64d8[_0x5d8883(0x1c8)]=_0x56e6c2['type'];if(_0x56e6c2[_0x5d8883(0x1ba)])_0x2b64d8['cron']=_0x56e6c2[_0x5d8883(0x1ba)];if(_0x56e6c2[_0x5d8883(0x1b1)])_0x2b64d8[_0x5d8883(0x1b1)]=_0x56e6c2[_0x5d8883(0x1b1)];if(_0x56e6c2[_0x5d8883(0x164)]!==undefined)_0x2b64d8[_0x5d8883(0x164)]=Number(_0x56e6c2[_0x5d8883(0x164)]);if(_0x56e6c2[_0x5d8883(0x182)]!==undefined)_0x2b64d8[_0x5d8883(0x182)]=Number(_0x56e6c2[_0x5d8883(0x182)]);if(_0x56e6c2[_0x5d8883(0x1aa)]!==undefined)_0x2b64d8[_0x5d8883(0x194)]=Number(_0x56e6c2['retryLimit']);if(_0x56e6c2[_0x5d8883(0x192)])_0x2b64d8[_0x5d8883(0x1d4)]=_0x56e6c2[_0x5d8883(0x192)];if(_0x56e6c2[_0x5d8883(0x198)])_0x2b64d8[_0x5d8883(0x198)]=_0x56e6c2[_0x5d8883(0x198)];if(_0x56e6c2[_0x5d8883(0x1a5)])try{_0x2b64d8['query']=readFileSync(_0x56e6c2[_0x5d8883(0x1a5)],_0x5d8883(0x1d2))[_0x5d8883(0x1ad)]();}catch(_0x160f0a){throw new SDKError(ErrorCode[_0x5d8883(0x19f)],_0x5d8883(0x168)+_0x56e6c2[_0x5d8883(0x1a5)],_0x160f0a instanceof Error?_0x160f0a:undefined);}if(Object[_0x5d8883(0x188)](_0x2b64d8)[_0x5d8883(0x1b3)]===0x0)throw new SDKError(ErrorCode[_0x5d8883(0x19f)],_0x5d8883(0x19a));if(_0x4d1cf9['verbose']){console[_0x5d8883(0x1d3)](_0x5d8883(0x178)+_0x1018f5);for(const [_0x57a422,_0x5ab4bf]of Object['entries'](_0x2b64d8)){_0x57a422===_0x5d8883(0x1af)?console['error']('\x20\x20'+_0x57a422+':\x20'+_0x5ab4bf[_0x5d8883(0x154)](0x0,0x32)+_0x5d8883(0x171)):console[_0x5d8883(0x1d3)]('\x20\x20'+_0x57a422+':\x20'+_0x5ab4bf);}}const _0x185fe3=await withSpinner(_0x5d8883(0x17f),()=>_0x4c4016['schedules'][_0x5d8883(0x189)](_0x1018f5,_0x2b64d8),{'verbose':_0x4d1cf9[_0x5d8883(0x1bd)]});return console[_0x5d8883(0x1d3)](_0x5d8883(0x181)+_0x185fe3[_0x5d8883(0x169)][_0x5d8883(0x1e0)]),await handleSingleObjectOutput(_0x185fe3[_0x5d8883(0x169)],_0x4d1cf9),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x180c5e(0x1e0)]='schedule:delete';[a36_0x180c5e(0x1a8)]=a36_0x180c5e(0x1b7);[a36_0x180c5e(0x1d0)](_0x55f38b){const _0x1da819=a36_0x180c5e,_0x3caf7f=_0x55f38b[_0x1da819(0x15c)][0x0];if(!_0x3caf7f)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async[a36_0x180c5e(0x17d)](_0x1f2ea5){const _0xbf01ed=a36_0x180c5e,{options:_0x5bea33,args:_0x4e60e7,tdx:_0x536d7e}=_0x1f2ea5,_0x44032c=_0x4e60e7[0x0];if(!_0x5bea33['yes']){const _0x361c0a=await confirm(_0xbf01ed(0x1bf)+_0x44032c+'\x22?');if(!_0x361c0a)return console[_0xbf01ed(0x1d3)](_0xbf01ed(0x179)),0x0;}const _0xf53e07=await withSpinner(_0xbf01ed(0x1a4),()=>_0x536d7e[_0xbf01ed(0x16f)][_0xbf01ed(0x1e1)](_0x44032c),{'verbose':_0x5bea33[_0xbf01ed(0x1bd)]});return console[_0xbf01ed(0x1d3)](_0xbf01ed(0x186)+_0xf53e07[_0xbf01ed(0x169)][_0xbf01ed(0x1e0)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{['name']='schedule:run';[a36_0x180c5e(0x1a8)]=a36_0x180c5e(0x19e);['validate'](_0x575629){const _0x58a289=a36_0x180c5e,_0x4a27fb=_0x575629[_0x58a289(0x15c)][0x0];if(!_0x4a27fb)return _0x58a289(0x1be);return undefined;}async[a36_0x180c5e(0x17d)](_0x4d9656){const _0x4919c3=a36_0x180c5e,{options:_0x98a6b8,args:_0x277a5b,tdx:_0x158b71}=_0x4d9656,_0x40c2f2=_0x277a5b[0x0],_0x283bc0=_0x98a6b8,_0x509c3e=_0x283bc0[_0x4919c3(0x150)],_0x11dc88=_0x283bc0[_0x4919c3(0x1d6)]!==undefined?Number(_0x283bc0[_0x4919c3(0x1d6)]):undefined;if(_0x98a6b8[_0x4919c3(0x1bd)]){console[_0x4919c3(0x1d3)](_0x4919c3(0x1bb)+_0x40c2f2);if(_0x509c3e)console[_0x4919c3(0x1d3)](_0x4919c3(0x190)+_0x509c3e);if(_0x11dc88)console[_0x4919c3(0x1d3)](_0x4919c3(0x19b)+_0x11dc88);}const _0x1758f6=await withSpinner(_0x4919c3(0x152),()=>_0x158b71[_0x4919c3(0x16f)][_0x4919c3(0x1b4)](_0x40c2f2,{'time':_0x509c3e,'num':_0x11dc88}),{'verbose':_0x98a6b8[_0x4919c3(0x1bd)]}),_0xe1979a=_0x1758f6[_0x4919c3(0x169)][_0x4919c3(0x1da)];console['error'](_0x4919c3(0x1cf)+_0xe1979a[_0x4919c3(0x1b3)]+_0x4919c3(0x17a)+(_0xe1979a[_0x4919c3(0x1b3)]!==0x1?'s':'')+_0x4919c3(0x18d));for(const _0xb86a02 of _0xe1979a){console[_0x4919c3(0x1d3)](_0x4919c3(0x1b0)+_0xb86a02[_0x4919c3(0x165)]);}return await handleSDKOutput(_0xe1979a,_0x98a6b8),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{['name']=a36_0x180c5e(0x1db);[a36_0x180c5e(0x1a8)]=a36_0x180c5e(0x1cc);[a36_0x180c5e(0x1d0)](_0x16b06c){const _0x405476=a36_0x180c5e,_0x461105=_0x16b06c['args'][0x0];if(!_0x461105)return _0x405476(0x1d8);return undefined;}async[a36_0x180c5e(0x17d)](_0x24c369){const _0x438762=a36_0x180c5e,{options:_0x492d68,args:_0x156308,tdx:_0x4c6215}=_0x24c369,_0x2ba2b1=_0x156308[0x0],_0x3acabb=_0x492d68,_0x5696a9=_0x3acabb['from']!==undefined?Number(_0x3acabb[_0x438762(0x1a0)]):undefined,_0x4c46b2=_0x3acabb['to']!==undefined?Number(_0x3acabb['to']):undefined,_0x37992e=await withSpinner(_0x438762(0x15e),()=>_0x4c6215[_0x438762(0x16f)][_0x438762(0x16e)](_0x2ba2b1,{'from':_0x5696a9,'to':_0x4c46b2}),{'verbose':_0x492d68[_0x438762(0x1bd)]}),_0x6a32df=_0x37992e['data'];console[_0x438762(0x1d3)]('Found\x20'+_0x6a32df['count']+_0x438762(0x1cb)+(_0x6a32df['count']!==0x1?'s':'')+_0x438762(0x163)+_0x6a32df[_0x438762(0x1a0)]+'-'+_0x6a32df['to']+')');const _0x3d988c=_0x6a32df[_0x438762(0x16e)][_0x438762(0x175)](_0x359e8d=>({'job_id':_0x359e8d[_0x438762(0x165)],'type':_0x359e8d[_0x438762(0x1c8)],'status':_0x359e8d[_0x438762(0x18f)],'scheduled_at':_0x359e8d[_0x438762(0x1c9)],'created_at':_0x359e8d[_0x438762(0x1c2)],'start_at':_0x359e8d[_0x438762(0x173)],'end_at':_0x359e8d['end_at']}));return await handleSDKOutput(_0x3d988c,_0x492d68),0x0;}}
@@ -1 +1 @@
1
- const a37_0x5b5658=a37_0x288a;(function(_0x17b883,_0xa3fd29){const _0x46365c=a37_0x288a,_0x3b62f7=_0x17b883();while(!![]){try{const _0x288630=-parseInt(_0x46365c(0x1f4))/0x1+-parseInt(_0x46365c(0x22f))/0x2+parseInt(_0x46365c(0x259))/0x3+parseInt(_0x46365c(0x1d8))/0x4+-parseInt(_0x46365c(0x256))/0x5*(parseInt(_0x46365c(0x23d))/0x6)+parseInt(_0x46365c(0x1e4))/0x7*(parseInt(_0x46365c(0x1cd))/0x8)+-parseInt(_0x46365c(0x24f))/0x9*(-parseInt(_0x46365c(0x22e))/0xa);if(_0x288630===_0xa3fd29)break;else _0x3b62f7['push'](_0x3b62f7['shift']());}catch(_0x310b57){_0x3b62f7['push'](_0x3b62f7['shift']());}}}(a37_0x5888,0x30f40));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';function a37_0x288a(_0xe4fc60,_0x55acc0){_0xe4fc60=_0xe4fc60-0x1b3;const _0x588892=a37_0x5888();let _0x288ae4=_0x588892[_0xe4fc60];return _0x288ae4;}import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';function a37_0x5888(){const _0x6e565e=['trim','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','getSegmentSQLFromYaml','✔\x20Query\x20completed:\x20Processed\x20','processedRows','setJobId','48ucPMmI','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','in\x20','✔\x20Found\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','parentSegment','SEGMENT_NOT_FOUND','Fetching\x20folder\x20details...','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','1536892RYWkbc','Show\x20child\x20segment\x20schema\x20(column\x20types)','Resolved\x20parent\x20folder\x20ID:\x20','getSQLFromServerSegment','\x20\x20Cause:\x20','data','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','\x20folder','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','description','85421kEOUYY','\x20\x20Segment\x20name:\x20','Folder\x20ID:\x20','elapsedTimeMillis','length','getSegment','\x20rows\x20','parent','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Fetching\x20folder\x20\x27','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Parent\x20ID:\x20','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','segment:desc','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','212534IHAutU','Fetching\x20SQL\x20from\x20rule...','Creating\x20folder\x20\x27','segment:sql','Error:\x20Parent\x20segment\x20name\x20is\x20required','Options:','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Show\x20segment\x20folder\x20details','jsonl','SQL\x20query:\x0a','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','toLocaleString','Resolved\x20parent\x20ID:\x20','parentFolder','Error:\x20','Executing\x20segment\x20query...','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','name','resolveParentId','SEGMENT_FOLDER_NOT_FOUND','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','\x20[Job\x20ID:\x20','Folder\x20name:\x20','segment','cause','INVALID_ARGUMENT','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Usage:\x20tdx\x20sg\x20show\x20<name>','\x27...','Site:\x20','stats','Use:\x20tdx\x20ps\x20view','site','query','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Examples:','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','execute','Resolving\x20parent\x20segment\x20\x27','segment:view','Fetching\x20SQL\x20for\x20segment...','segment:describe','json','fullPath','✔\x20Created\x20folder\x20\x27','url','red','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Segment\x20ID\x20missing\x20from\x20resolved\x20path','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Listing\x20folders\x20for\x20parent\x20\x27','Resolving\x20\x27','\x20\x20Parent\x20segment:\x20','\x20\x20Full\x20path:\x20','segmentName','100EuoCOR','282004MMfLgP','folderId','/app/ps/','Target\x20path:\x20','Segment\x20ID:\x20','\x27\x20with\x20ID:\x20','/e/','folder','code','cyan','resolveFolderId','Show\x20folder\x20or\x20child\x20segment\x20details','type','Resolved\x20YAML\x20file:\x20','330xGBAEJ','createFolder','segment:show','Fetching\x20parent\x20segment\x20details...','segment:folder:list','getFolder','folderPath','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','parentId','log','Parent\x20segment:\x20','Use:\x20tdx\x20ps\x20desc','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Use:\x20tdx\x20ps\x20view\x20-w','SELECT\x20*\x20FROM\x20(\x0a','jobId','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','176967zSAPSe','resolvePathToResource','message','information_schema','getSQLFromYamlFile','format','error','14990jWqaGr','verbose','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','194601IMpzhD','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','(root)','Resolved\x20type:\x20','Usage:\x20tdx\x20segment\x20describe\x20<path>','test','getSegmentSQL','web','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Parent\x20name:\x20','Error:\x20Folder\x20reference\x20is\x20required','replace','Resolved\x20relative\x20path\x20to:\x20','Show\x20segment\x20or\x20folder\x20details','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Resolved\x20folder\x20ID:\x20','segment:folder:create','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Resolving\x20parent\x20folder\x20\x27','segmentId'];a37_0x5888=function(){return _0x6e565e;};return a37_0x5888();}import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0x3644b4 from'chalk';async function resolveSegmentTarget(_0x5f11ac,_0x412664,_0x2d2f9a){const _0x1b741c=a37_0x288a;if(isYamlFilePath(_0x5f11ac))try{const _0x2714ea=await resolveYamlFilePath(_0x5f11ac);return _0x2d2f9a&&(console['error'](_0x1b741c(0x23c)+_0x5f11ac),console[_0x1b741c(0x255)](_0x1b741c(0x22b)+_0x2714ea['parentSegment']),console[_0x1b741c(0x255)](_0x1b741c(0x1e5)+_0x2714ea[_0x1b741c(0x22d)]),console[_0x1b741c(0x255)]('\x20\x20Folder\x20path:\x20'+(_0x2714ea[_0x1b741c(0x243)]||_0x1b741c(0x1b4))),console[_0x1b741c(0x255)](_0x1b741c(0x22c)+_0x2714ea[_0x1b741c(0x221)])),_0x2714ea[_0x1b741c(0x221)];}catch(_0xde821b){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1b741c(0x1f3)+_0xde821b['message']);}if(!_0x412664)throw new SDKError(ErrorCode[_0x1b741c(0x20e)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x412664+'/'+_0x5f11ac;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x5b5658(0x206)]=a37_0x5b5658(0x21f);[a37_0x5b5658(0x1e3)]=a37_0x5b5658(0x1bf);async[a37_0x5b5658(0x21b)](_0x397768){const _0x486eaa=a37_0x5b5658,{options:_0x3eaa8f,args:_0x3efd4e,tdx:_0x15c888}=_0x397768,_0x3729a5=_0x3efd4e[0x0],_0x40372c=!_0x3729a5&&!!_0x3eaa8f[_0x486eaa(0x1d2)],_0x56eb83=_0x3729a5||_0x3eaa8f[_0x486eaa(0x1d2)];if(!_0x56eb83)return console[_0x486eaa(0x255)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x486eaa(0x255)](_0x486eaa(0x1b6)),console['error'](_0x486eaa(0x219)),console['error'](_0x486eaa(0x21a)),console[_0x486eaa(0x255)](_0x486eaa(0x1fe)),console['error']('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console[_0x486eaa(0x255)](_0x486eaa(0x1d6)),0x1;try{const _0x211f61=_0x3eaa8f['segmentPath'];let _0x14e868=_0x56eb83;!_0x40372c&&_0x211f61&&!_0x56eb83['includes']('/')&&(_0x14e868=_0x211f61+'/'+_0x56eb83,_0x3eaa8f[_0x486eaa(0x257)]&&console['error'](_0x486eaa(0x1be)+_0x14e868));const _0x40dc71=await withSpinner('Resolving\x20path\x20\x27'+_0x14e868+'\x27...',()=>_0x15c888[_0x486eaa(0x20c)][_0x486eaa(0x250)](_0x14e868),{'verbose':_0x3eaa8f[_0x486eaa(0x257)]}),_0x5ad708=_0x40dc71[_0x486eaa(0x1dd)];_0x3eaa8f[_0x486eaa(0x257)]&&(console[_0x486eaa(0x255)](_0x486eaa(0x1b5)+_0x5ad708[_0x486eaa(0x23b)]),console[_0x486eaa(0x255)](_0x486eaa(0x1f0)+_0x5ad708[_0x486eaa(0x246)]),_0x5ad708[_0x486eaa(0x230)]&&console[_0x486eaa(0x255)](_0x486eaa(0x1e6)+_0x5ad708[_0x486eaa(0x230)]),_0x5ad708[_0x486eaa(0x1c6)]&&console[_0x486eaa(0x255)]('Segment\x20ID:\x20'+_0x5ad708[_0x486eaa(0x1c6)]));if(_0x5ad708[_0x486eaa(0x23b)]===_0x486eaa(0x1eb)){const _0x1cf2c3=await withSpinner(_0x486eaa(0x240),()=>_0x15c888[_0x486eaa(0x20c)]['getParent'](_0x5ad708['parentId']),{'verbose':_0x3eaa8f[_0x486eaa(0x257)]});await handleSingleObjectOutput(_0x1cf2c3[_0x486eaa(0x1dd)],_0x3eaa8f);}else{if(_0x5ad708['type']===_0x486eaa(0x236)){if(!_0x5ad708[_0x486eaa(0x230)])throw new SDKError(ErrorCode[_0x486eaa(0x208)],_0x486eaa(0x244));const _0x5835ba=await withSpinner(_0x486eaa(0x1d4),()=>_0x15c888[_0x486eaa(0x20c)][_0x486eaa(0x242)](_0x5ad708[_0x486eaa(0x230)]),{'verbose':_0x3eaa8f[_0x486eaa(0x257)]});await handleSingleObjectOutput(_0x5835ba[_0x486eaa(0x1dd)],_0x3eaa8f);}else{if(_0x5ad708[_0x486eaa(0x23b)]===_0x486eaa(0x20c)){if(!_0x5ad708[_0x486eaa(0x1c6)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x5be303=await withSpinner('Fetching\x20segment\x20details...',()=>_0x15c888[_0x486eaa(0x20c)][_0x486eaa(0x1e9)](_0x5ad708[_0x486eaa(0x246)],_0x5ad708[_0x486eaa(0x1c6)]),{'verbose':_0x3eaa8f[_0x486eaa(0x257)]});await handleSingleObjectOutput(_0x5be303[_0x486eaa(0x1dd)],_0x3eaa8f);}}}return 0x0;}catch(_0x15a60d){if(_0x15a60d instanceof SDKError)return console['error'](_0x486eaa(0x203)+_0x15a60d[_0x486eaa(0x251)]),_0x15a60d[_0x486eaa(0x20d)]&&console[_0x486eaa(0x255)](_0x486eaa(0x1dc)+_0x15a60d['cause']),0x1;throw _0x15a60d;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x5b5658(0x206)]=a37_0x5b5658(0x23f);['description']=a37_0x5b5658(0x1fa);async[a37_0x5b5658(0x21b)](_0x16f9a7){const _0x5f110a=a37_0x5b5658,{options:_0xc6931d,args:_0x1ea3ed,tdx:_0x4f28fa}=_0x16f9a7,_0x289aa5=_0x1ea3ed[0x0];if(!_0x289aa5)return console[_0x5f110a(0x255)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x5f110a(0x255)](_0x5f110a(0x211)),console[_0x5f110a(0x255)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x5f110a(0x255)]('Examples:'),console[_0x5f110a(0x255)](_0x5f110a(0x1d5)),console[_0x5f110a(0x255)](_0x5f110a(0x1df)),0x1;try{const _0x1af114=_0xc6931d['parentSegment'],_0x362650=await resolveSegmentTarget(_0x289aa5,_0x1af114,_0xc6931d[_0x5f110a(0x257)]);_0xc6931d[_0x5f110a(0x257)]&&console['error'](_0x5f110a(0x232)+_0x362650);const _0x3efa9d=await withSpinner(_0x5f110a(0x22a)+_0x289aa5+_0x5f110a(0x212),()=>_0x4f28fa[_0x5f110a(0x20c)][_0x5f110a(0x250)](_0x362650),{'verbose':_0xc6931d[_0x5f110a(0x257)]}),_0x23305f=_0x3efa9d['data'];_0xc6931d[_0x5f110a(0x257)]&&(console[_0x5f110a(0x255)]('Resolved\x20type:\x20'+_0x23305f[_0x5f110a(0x23b)]),console['error'](_0x5f110a(0x1f0)+_0x23305f[_0x5f110a(0x246)]));if(_0x23305f[_0x5f110a(0x23b)]===_0x5f110a(0x236))return console['error'](_0x5f110a(0x258)),console['error'](_0x5f110a(0x1de)),0x1;if(_0x23305f[_0x5f110a(0x23b)]===_0x5f110a(0x1eb))return console['error'](_0x5f110a(0x225)),console[_0x5f110a(0x255)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x23305f[_0x5f110a(0x1c6)])throw new SDKError(ErrorCode[_0x5f110a(0x1d3)],_0x5f110a(0x226));const _0x1f2d9d=await withSpinner(_0x5f110a(0x21e),()=>_0x4f28fa[_0x5f110a(0x20c)][_0x5f110a(0x1b8)](_0x23305f[_0x5f110a(0x246)],_0x23305f[_0x5f110a(0x1c6)]),{'verbose':_0xc6931d[_0x5f110a(0x257)]});let _0x73a2f=_0x1f2d9d[_0x5f110a(0x1dd)];const _0x1c8fad=resolveLimit(_0xc6931d['limit'],DEFAULT_DISPLAY_LIMIT),_0x5f4bb6=/\bLIMIT\s+\d+/i[_0x5f110a(0x1b7)](_0x73a2f);!_0x5f4bb6&&(_0x73a2f=_0x73a2f[_0x5f110a(0x1c7)]()[_0x5f110a(0x1bd)](/;+$/,''),_0x73a2f=_0x5f110a(0x24c)+_0x73a2f+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x1c8fad);_0xc6931d[_0x5f110a(0x257)]&&console[_0x5f110a(0x255)](_0x5f110a(0x1fd)+_0x73a2f);const _0x26964c=await withProgressSpinner(_0x5f110a(0x204),async _0x483cc3=>{const _0x3959e9=_0x5f110a,_0x2063d5=await _0x4f28fa[_0x3959e9(0x217)]['execute'](_0x73a2f,{'catalog':'td','schema':_0x3959e9(0x252),'onJobId':_0xc347e0=>{const _0x57e66c=_0x3959e9;_0x483cc3[_0x57e66c(0x1cc)](_0xc347e0);}});return _0x2063d5;},{'verbose':_0xc6931d[_0x5f110a(0x257)]}),_0x4f1684=_0x26964c[_0x5f110a(0x1dd)],_0xa97d52=_0x4f1684[_0x5f110a(0x24d)]?_0x5f110a(0x20a)+_0x4f1684[_0x5f110a(0x24d)]+']':'';return console[_0x5f110a(0x255)](_0x5f110a(0x1ca)+_0x4f1684[_0x5f110a(0x214)][_0x5f110a(0x1cb)][_0x5f110a(0x200)]()+_0x5f110a(0x1ea)+(_0x5f110a(0x1cf)+formatElapsed(_0x4f1684[_0x5f110a(0x214)][_0x5f110a(0x1e7)])+_0xa97d52)),await handleQueryOutput(_0x4f1684,_0xc6931d),0x0;}catch(_0x5673ba){if(_0x5673ba instanceof SDKError)return console[_0x5f110a(0x255)]('✖\x20Query\x20failed\x20['+_0x5673ba[_0x5f110a(0x237)]+']'),console['error']('\x0a'+_0x5673ba[_0x5f110a(0x251)]),0x1;throw _0x5673ba;}}}export class SegmentFolderListCommand extends BaseCommand{['name']=a37_0x5b5658(0x241);[a37_0x5b5658(0x1e3)]=a37_0x5b5658(0x227);async['execute'](_0x314f5b){const _0xbffa76=a37_0x5b5658,{options:_0x194ba7,args:_0x3180a1,tdx:_0x5bb813}=_0x314f5b;if(_0x3180a1['length']===0x0)return console[_0xbffa76(0x255)](_0xbffa76(0x1f8)),console['error'](_0xbffa76(0x228)),0x1;const _0x20ed6f=_0x3180a1[0x0];try{_0x194ba7['verbose']&&(console[_0xbffa76(0x255)](_0xbffa76(0x213)+_0x194ba7[_0xbffa76(0x216)]),console['error'](_0xbffa76(0x1bb)+_0x20ed6f));const _0x1dfddb=await withSpinner(_0xbffa76(0x21c)+_0x20ed6f+'\x27...',()=>_0x5bb813['segment'][_0xbffa76(0x207)](_0x20ed6f),{'verbose':_0x194ba7['verbose']}),_0x1b78ef=_0x1dfddb[_0xbffa76(0x1dd)];_0x194ba7[_0xbffa76(0x257)]&&console[_0xbffa76(0x255)](_0xbffa76(0x201)+_0x1b78ef);const _0x23dd91=await withSpinner(_0xbffa76(0x229)+_0x20ed6f+_0xbffa76(0x212),()=>_0x5bb813[_0xbffa76(0x20c)]['listFolders'](_0x1b78ef),{'verbose':_0x194ba7['verbose']}),_0x7d97c8=_0x23dd91[_0xbffa76(0x1dd)];return console[_0xbffa76(0x255)](_0xbffa76(0x1d0)+_0x7d97c8[_0xbffa76(0x1e8)]+_0xbffa76(0x1e1)+(_0x7d97c8[_0xbffa76(0x1e8)]!==0x1?'s':'')),await handleSDKOutput(_0x7d97c8,_0x194ba7),0x0;}catch(_0x5613c7){if(_0x5613c7 instanceof SDKError)return console[_0xbffa76(0x255)](_0xbffa76(0x203)+_0x5613c7['message']),_0x5613c7[_0xbffa76(0x20d)]&&console[_0xbffa76(0x255)]('\x20\x20Cause:\x20'+_0x5613c7['cause']),0x1;throw _0x5613c7;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']='segment:folder:show';[a37_0x5b5658(0x1e3)]=a37_0x5b5658(0x1fb);async[a37_0x5b5658(0x21b)](_0x2f6ca9){const _0x3237fd=a37_0x5b5658,{options:_0x24ca53,args:_0xb9f212,tdx:_0x5cf016}=_0x2f6ca9;if(_0xb9f212[_0x3237fd(0x1e8)]===0x0)return console['error'](_0x3237fd(0x1bc)),console[_0x3237fd(0x255)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x2156cf,childId:_0x568aaf}=parseSegmentRef(_0xb9f212[0x0]);_0x24ca53[_0x3237fd(0x257)]&&(console[_0x3237fd(0x255)](_0x3237fd(0x213)+_0x24ca53[_0x3237fd(0x216)]),console['error'](_0x3237fd(0x1bb)+_0x2156cf),_0x568aaf&&console['error'](_0x3237fd(0x20b)+_0x568aaf));if(!_0x568aaf)return console[_0x3237fd(0x255)](_0x3237fd(0x1e2)),0x1;const _0x2924e6=await withSpinner(_0x3237fd(0x21c)+_0x2156cf+_0x3237fd(0x212),()=>_0x5cf016[_0x3237fd(0x20c)][_0x3237fd(0x207)](_0x2156cf),{'verbose':_0x24ca53['verbose']}),_0x2b1399=_0x2924e6[_0x3237fd(0x1dd)];_0x24ca53[_0x3237fd(0x257)]&&console[_0x3237fd(0x255)](_0x3237fd(0x201)+_0x2b1399);const _0x1ca71c=await withSpinner('Resolving\x20folder\x20\x27'+_0x568aaf+_0x3237fd(0x212),()=>_0x5cf016[_0x3237fd(0x20c)][_0x3237fd(0x239)](_0x2b1399,_0x568aaf),{'verbose':_0x24ca53[_0x3237fd(0x257)]}),_0x40c320=_0x1ca71c[_0x3237fd(0x1dd)];_0x24ca53[_0x3237fd(0x257)]&&console[_0x3237fd(0x255)](_0x3237fd(0x1c1)+_0x40c320);const _0xe934e3=await withSpinner(_0x3237fd(0x1ee)+_0x568aaf+'\x27...',()=>_0x5cf016[_0x3237fd(0x20c)][_0x3237fd(0x242)](_0x40c320),{'verbose':_0x24ca53[_0x3237fd(0x257)]});return await handleSDKOutput([_0xe934e3[_0x3237fd(0x1dd)]],_0x24ca53),0x0;}catch(_0x1ba47a){if(_0x1ba47a instanceof SDKError)return console[_0x3237fd(0x255)](_0x3237fd(0x203)+_0x1ba47a['message']),_0x1ba47a['cause']&&console[_0x3237fd(0x255)](_0x3237fd(0x1dc)+_0x1ba47a['cause']),0x1;throw _0x1ba47a;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x5b5658(0x206)]=a37_0x5b5658(0x1f7);[a37_0x5b5658(0x1e3)]='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a37_0x5b5658(0x21b)](_0x4dcb5e){const _0x5e4e05=a37_0x5b5658,{options:_0xed380d,args:_0x11e956}=_0x4dcb5e,_0x1dc9ea=_0xed380d,_0x973d26=_0x1dc9ea['path'],_0x1d33fa=_0x11e956[0x0];if(!_0x1d33fa&&!_0x973d26)return console[_0x5e4e05(0x255)](a37_0x3644b4['red'](_0x5e4e05(0x205))),console['error']('Usage:'),console[_0x5e4e05(0x255)](_0x5e4e05(0x1ff)),console['error'](_0x5e4e05(0x1b3)),console[_0x5e4e05(0x255)](_0x5e4e05(0x219)),console[_0x5e4e05(0x255)](_0x5e4e05(0x1d7)),console[_0x5e4e05(0x255)](_0x5e4e05(0x1ed)),0x1;if(_0x1d33fa&&_0x973d26)return console['error'](a37_0x3644b4[_0x5e4e05(0x224)]('Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both')),0x1;try{let _0x216169;if(_0x973d26)_0x216169=await this[_0x5e4e05(0x253)](_0x973d26,_0x4dcb5e);else{if(isYamlFilePath(_0x1d33fa))return console[_0x5e4e05(0x255)](a37_0x3644b4[_0x5e4e05(0x224)]('Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option')),console[_0x5e4e05(0x255)](_0x5e4e05(0x1c3)+_0x1d33fa),0x1;else _0x216169=await this[_0x5e4e05(0x1db)](_0x1d33fa,_0x4dcb5e);}return _0xed380d['format']===_0x5e4e05(0x220)||_0xed380d[_0x5e4e05(0x254)]===_0x5e4e05(0x1fc)?await handleSDKOutput([{'sql':_0x216169}],_0xed380d):console[_0x5e4e05(0x247)](_0x216169),0x0;}catch(_0x238426){if(_0x238426 instanceof SDKError)return console['error'](_0x5e4e05(0x203)+_0x238426[_0x5e4e05(0x251)]),_0x238426[_0x5e4e05(0x20d)]&&console[_0x5e4e05(0x255)](_0x5e4e05(0x1dc)+_0x238426[_0x5e4e05(0x20d)]),0x1;throw _0x238426;}}async['getSQLFromYamlFile'](_0x32366b,_0x582c74){const _0x3718bd=a37_0x5b5658,{options:_0x4983e8,tdx:_0x349db8}=_0x582c74;let _0x4a05e6;try{_0x4a05e6=await resolveYamlFilePath(_0x32366b);}catch(_0x361a44){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x361a44[_0x3718bd(0x251)]);}_0x4983e8['verbose']&&console[_0x3718bd(0x255)]('Resolved:\x20'+_0x4a05e6[_0x3718bd(0x1d2)]+'/'+_0x4a05e6[_0x3718bd(0x22d)]);const _0x3d98f4=await withSpinner(_0x3718bd(0x1f5),()=>_0x349db8[_0x3718bd(0x20c)][_0x3718bd(0x1c9)](_0x4a05e6['content'],_0x4a05e6[_0x3718bd(0x1d2)],_0x4a05e6[_0x3718bd(0x22d)]),{'verbose':_0x4983e8['verbose']});return _0x3d98f4[_0x3718bd(0x1dd)];}async[a37_0x5b5658(0x1db)](_0x463218,_0x4f96e5){const _0x5c3faa=a37_0x5b5658,{options:_0x302eed,tdx:_0x3a5261}=_0x4f96e5,_0x224346=_0x302eed[_0x5c3faa(0x1d2)],_0x47121f=await resolveSegmentTarget(_0x463218,_0x224346,_0x302eed[_0x5c3faa(0x257)]);_0x302eed[_0x5c3faa(0x257)]&&console['error'](_0x5c3faa(0x232)+_0x47121f);const _0x441210=await withSpinner(_0x5c3faa(0x22a)+_0x463218+_0x5c3faa(0x212),()=>_0x3a5261[_0x5c3faa(0x20c)][_0x5c3faa(0x250)](_0x47121f),{'verbose':_0x302eed[_0x5c3faa(0x257)]}),_0x5a23e4=_0x441210[_0x5c3faa(0x1dd)];_0x302eed[_0x5c3faa(0x257)]&&(console[_0x5c3faa(0x255)](_0x5c3faa(0x1b5)+_0x5a23e4[_0x5c3faa(0x23b)]),console['error']('Parent\x20ID:\x20'+_0x5a23e4[_0x5c3faa(0x246)]));if(_0x5a23e4['type']===_0x5c3faa(0x236))throw new SDKError(ErrorCode[_0x5c3faa(0x20e)],_0x5c3faa(0x24e));if(_0x5a23e4['type']===_0x5c3faa(0x1eb))throw new SDKError(ErrorCode[_0x5c3faa(0x20e)],_0x5c3faa(0x1e0));if(!_0x5a23e4['segmentId'])throw new SDKError(ErrorCode[_0x5c3faa(0x1d3)],_0x5c3faa(0x226));const _0x2cef8a=await withSpinner(_0x5c3faa(0x21e),()=>_0x3a5261[_0x5c3faa(0x20c)][_0x5c3faa(0x1b8)](_0x5a23e4['parentId'],_0x5a23e4[_0x5c3faa(0x1c6)]),{'verbose':_0x302eed['verbose']});return _0x2cef8a[_0x5c3faa(0x1dd)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x5b5658(0x206)]=a37_0x5b5658(0x1c2);[a37_0x5b5658(0x1e3)]='Create\x20segment\x20folder\x20for\x20organization';async[a37_0x5b5658(0x21b)](_0x393515){const _0x142bdf=a37_0x5b5658,{options:_0x95aa2c,args:_0x1edc6d,tdx:_0x33bda6}=_0x393515,_0x93fe57=_0x95aa2c;if(_0x1edc6d['length']<0x2)return console['error'](_0x142bdf(0x1f1)),console[_0x142bdf(0x255)](_0x142bdf(0x245)),0x1;const _0x2002c2=_0x1edc6d[0x0],_0x106158=_0x1edc6d[0x1];_0x93fe57[_0x142bdf(0x257)]&&(console[_0x142bdf(0x255)](_0x142bdf(0x213)+_0x93fe57[_0x142bdf(0x216)]),console[_0x142bdf(0x255)](_0x142bdf(0x248)+_0x2002c2),console[_0x142bdf(0x255)](_0x142bdf(0x20b)+_0x106158));let _0x4ef781;if(_0x93fe57[_0x142bdf(0x202)]){const _0x5aa90a=_0x93fe57[_0x142bdf(0x202)],_0x103beb=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2002c2+_0x142bdf(0x212),()=>_0x33bda6[_0x142bdf(0x20c)][_0x142bdf(0x207)](_0x2002c2),{'verbose':_0x93fe57['verbose']}),_0x494bec=_0x103beb[_0x142bdf(0x1dd)],_0x3f015c=await withSpinner(_0x142bdf(0x1c5)+_0x5aa90a+_0x142bdf(0x212),()=>_0x33bda6[_0x142bdf(0x20c)][_0x142bdf(0x239)](_0x494bec,_0x5aa90a),{'verbose':_0x93fe57[_0x142bdf(0x257)]});_0x4ef781=_0x3f015c[_0x142bdf(0x1dd)],_0x93fe57[_0x142bdf(0x257)]&&console[_0x142bdf(0x255)](_0x142bdf(0x1da)+_0x4ef781);}const _0x1964ec={'name':_0x106158,'description':_0x93fe57[_0x142bdf(0x1e3)],'parentFolderId':_0x4ef781},_0x2edc66=await withSpinner(_0x142bdf(0x1f6)+_0x106158+'\x27...',()=>_0x33bda6[_0x142bdf(0x20c)][_0x142bdf(0x23e)](_0x2002c2,_0x1964ec),{'verbose':_0x93fe57['verbose']}),_0x2152f6=_0x2edc66[_0x142bdf(0x1dd)];return console[_0x142bdf(0x255)](_0x142bdf(0x222)+_0x2152f6[_0x142bdf(0x206)]+_0x142bdf(0x234)+_0x2152f6['id']),await handleSDKOutput([_0x2152f6],_0x93fe57),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x5b5658(0x206)]=a37_0x5b5658(0x21d);['description']=a37_0x5b5658(0x23a);async[a37_0x5b5658(0x21b)](_0x3a4880){const _0x1d56ad=a37_0x5b5658,{options:_0x1655ec,args:_0x5d174c,tdx:_0x3ec11e}=_0x3a4880,_0x11df34=_0x5d174c[0x0];if(!_0x11df34)return console['error']('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x1d56ad(0x255)](_0x1d56ad(0x1ef)),console[_0x1d56ad(0x255)](_0x1d56ad(0x1c8)),console[_0x1d56ad(0x255)](_0x1d56ad(0x1f9)),console[_0x1d56ad(0x255)](_0x1d56ad(0x218)),console[_0x1d56ad(0x255)]('Examples:'),console[_0x1d56ad(0x255)](_0x1d56ad(0x210)),console[_0x1d56ad(0x255)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x1d56ad(0x255)](_0x1d56ad(0x1ec)),console[_0x1d56ad(0x255)](_0x1d56ad(0x20f)),0x1;try{const _0xc26001=_0x1655ec[_0x1d56ad(0x1d2)],_0x1bd12a=await resolveSegmentTarget(_0x11df34,_0xc26001,_0x1655ec[_0x1d56ad(0x257)]);_0x1655ec['verbose']&&console['error']('Target\x20path:\x20'+_0x1bd12a);const _0x45d121=await withSpinner(_0x1d56ad(0x22a)+_0x11df34+_0x1d56ad(0x212),()=>_0x3ec11e[_0x1d56ad(0x20c)][_0x1d56ad(0x250)](_0x1bd12a),{'verbose':_0x1655ec[_0x1d56ad(0x257)]}),_0x4bd291=_0x45d121['data'];_0x1655ec[_0x1d56ad(0x257)]&&(console[_0x1d56ad(0x255)]('Resolved\x20type:\x20'+_0x4bd291[_0x1d56ad(0x23b)]),console[_0x1d56ad(0x255)](_0x1d56ad(0x1f0)+_0x4bd291[_0x1d56ad(0x246)]),_0x4bd291['folderId']&&console['error']('Folder\x20ID:\x20'+_0x4bd291[_0x1d56ad(0x230)]),_0x4bd291[_0x1d56ad(0x1c6)]&&console[_0x1d56ad(0x255)](_0x1d56ad(0x233)+_0x4bd291[_0x1d56ad(0x1c6)]));if(_0x1655ec[_0x1d56ad(0x1b9)]){if(_0x4bd291[_0x1d56ad(0x23b)]===_0x1d56ad(0x236))return console[_0x1d56ad(0x255)](_0x1d56ad(0x1ce)),0x1;if(_0x4bd291[_0x1d56ad(0x23b)]==='parent')return console[_0x1d56ad(0x255)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x1d56ad(0x255)](_0x1d56ad(0x24b)),0x1;if(!_0x4bd291[_0x1d56ad(0x1c6)])throw new SDKError(ErrorCode[_0x1d56ad(0x1d3)],_0x1d56ad(0x226));const _0x293317=getConsoleNextUrl(_0x1655ec['site'],_0x1d56ad(0x231)+_0x4bd291[_0x1d56ad(0x246)]+_0x1d56ad(0x235)+_0x4bd291[_0x1d56ad(0x1c6)]);return console[_0x1d56ad(0x255)](a37_0x3644b4['green']('✔')+'\x20Opening\x20'+a37_0x3644b4[_0x1d56ad(0x238)](_0x293317)),openBrowser(_0x293317),0x0;}if(_0x4bd291[_0x1d56ad(0x23b)]===_0x1d56ad(0x236)){if(!_0x4bd291[_0x1d56ad(0x230)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x1d56ad(0x244));const _0x13166b=await withSpinner(_0x1d56ad(0x1d4),()=>_0x3ec11e[_0x1d56ad(0x20c)][_0x1d56ad(0x242)](_0x4bd291['folderId']),{'verbose':_0x1655ec[_0x1d56ad(0x257)]});await handleSingleObjectOutput(_0x13166b[_0x1d56ad(0x1dd)],_0x1655ec);}else{if(_0x4bd291[_0x1d56ad(0x23b)]===_0x1d56ad(0x20c)){if(!_0x4bd291[_0x1d56ad(0x1c6)])throw new SDKError(ErrorCode[_0x1d56ad(0x1d3)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x367816=await withSpinner('Fetching\x20segment\x20details...',()=>_0x3ec11e[_0x1d56ad(0x20c)][_0x1d56ad(0x1e9)](_0x4bd291['parentId'],_0x4bd291[_0x1d56ad(0x1c6)]),{'verbose':_0x1655ec[_0x1d56ad(0x257)]}),_0x11ca55=getConsoleNextUrl(_0x1655ec[_0x1d56ad(0x216)],_0x1d56ad(0x231)+_0x4bd291['parentId']+_0x1d56ad(0x235)+_0x4bd291[_0x1d56ad(0x1c6)]),_0x10f658=_0x367816[_0x1d56ad(0x1dd)];_0x10f658[_0x1d56ad(0x223)]=_0x11ca55,await handleSingleObjectOutput(_0x10f658,_0x1655ec);}else return console['error'](_0x1d56ad(0x1c4)),console[_0x1d56ad(0x255)](_0x1d56ad(0x215)),0x1;}return 0x0;}catch(_0x405ed9){if(_0x405ed9 instanceof SDKError)return console[_0x1d56ad(0x255)]('Error:\x20'+_0x405ed9[_0x1d56ad(0x251)]),_0x405ed9[_0x1d56ad(0x20d)]&&console[_0x1d56ad(0x255)](_0x1d56ad(0x1dc)+_0x405ed9[_0x1d56ad(0x20d)]),0x1;throw _0x405ed9;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x5b5658(0x206)]=a37_0x5b5658(0x1f2);[a37_0x5b5658(0x1e3)]=a37_0x5b5658(0x1d9);async[a37_0x5b5658(0x21b)](_0x465b85){const _0x565a43=a37_0x5b5658,{options:_0x37b62e,args:_0x2bfe87,tdx:_0x3035e7}=_0x465b85,_0x450b7a=_0x2bfe87[0x0];if(!_0x450b7a)return console['error']('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x565a43(0x255)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x565a43(0x255)](_0x565a43(0x1ba)),console[_0x565a43(0x255)](_0x565a43(0x219)),console[_0x565a43(0x255)](_0x565a43(0x1c0)),console[_0x565a43(0x255)](_0x565a43(0x209)),0x1;try{const _0x3c64ae=_0x37b62e[_0x565a43(0x1d2)],_0xd20933=await resolveSegmentTarget(_0x450b7a,_0x3c64ae,_0x37b62e['verbose']);_0x37b62e[_0x565a43(0x257)]&&console['error'](_0x565a43(0x232)+_0xd20933);const _0x1e6f6b=await withSpinner(_0x565a43(0x22a)+_0x450b7a+_0x565a43(0x212),()=>_0x3035e7[_0x565a43(0x20c)][_0x565a43(0x250)](_0xd20933),{'verbose':_0x37b62e[_0x565a43(0x257)]}),_0x15e81e=_0x1e6f6b[_0x565a43(0x1dd)];_0x37b62e['verbose']&&(console['error'](_0x565a43(0x1b5)+_0x15e81e['type']),console[_0x565a43(0x255)](_0x565a43(0x1f0)+_0x15e81e[_0x565a43(0x246)]));if(_0x15e81e[_0x565a43(0x23b)]===_0x565a43(0x236))return console[_0x565a43(0x255)](_0x565a43(0x24a)),console[_0x565a43(0x255)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x15e81e[_0x565a43(0x23b)]===_0x565a43(0x1eb))return console[_0x565a43(0x255)](_0x565a43(0x1d1)),console[_0x565a43(0x255)](_0x565a43(0x249)),0x1;if(!_0x15e81e[_0x565a43(0x1c6)])throw new SDKError(ErrorCode[_0x565a43(0x1d3)],_0x565a43(0x226));const _0x221863=await withSpinner(_0x565a43(0x21e),()=>_0x3035e7['segment'][_0x565a43(0x1b8)](_0x15e81e[_0x565a43(0x246)],_0x15e81e[_0x565a43(0x1c6)]),{'verbose':_0x37b62e[_0x565a43(0x257)]}),_0x30b98c=_0x221863[_0x565a43(0x1dd)],_0x461c68=await executeSchemaQuery(_0x30b98c,_0x3035e7,_0x37b62e);return await handleQueryOutput(_0x461c68,_0x37b62e),0x0;}catch(_0x255d1b){if(_0x255d1b instanceof SDKError)return console[_0x565a43(0x255)]('Error:\x20'+_0x255d1b[_0x565a43(0x251)]),_0x255d1b[_0x565a43(0x20d)]&&console[_0x565a43(0x255)](_0x565a43(0x1dc)+_0x255d1b[_0x565a43(0x20d)]),0x1;throw _0x255d1b;}}}
1
+ const a37_0xf60fab=a37_0x436c;(function(_0x5c186c,_0x581d59){const _0x468a04=a37_0x436c,_0x3081b7=_0x5c186c();while(!![]){try{const _0x4e1879=-parseInt(_0x468a04(0x141))/0x1+parseInt(_0x468a04(0x181))/0x2+-parseInt(_0x468a04(0x1ab))/0x3+-parseInt(_0x468a04(0x169))/0x4+parseInt(_0x468a04(0x156))/0x5*(parseInt(_0x468a04(0x1b5))/0x6)+-parseInt(_0x468a04(0x1a8))/0x7+-parseInt(_0x468a04(0x1bc))/0x8*(-parseInt(_0x468a04(0x161))/0x9);if(_0x4e1879===_0x581d59)break;else _0x3081b7['push'](_0x3081b7['shift']());}catch(_0x2097bd){_0x3081b7['push'](_0x3081b7['shift']());}}}(a37_0x3fc6,0x379b7));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';function a37_0x436c(_0x3280c1,_0x481705){_0x3280c1=_0x3280c1-0x126;const _0x3fc69d=a37_0x3fc6();let _0x436c0f=_0x3fc69d[_0x3280c1];return _0x436c0f;}function a37_0x3fc6(){const _0x486022=['getSegment','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Parent\x20segment:\x20','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','SELECT\x20*\x20FROM\x20(\x0a','Resolved\x20folder\x20ID:\x20','Listing\x20folders\x20for\x20parent\x20\x27','\x27...','segmentId','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Segment\x20ID:\x20','segment:view','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','\x20rows\x20','parentId','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Site:\x20','code','stats','Error:\x20','Resolved\x20type:\x20','verbose','getFolder','Target\x20path:\x20','Fetching\x20folder\x20\x27','site','Fetching\x20SQL\x20for\x20segment...','Usage:','143907wSyIEX','Resolved\x20parent\x20ID:\x20','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','json','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','data','Error:\x20Parent\x20segment\x20name\x20is\x20required','information_schema','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','parentSegment','Resolved\x20relative\x20path\x20to:\x20','name','limit','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','/app/ps/','\x27\x20with\x20ID:\x20','✔\x20Created\x20folder\x20\x27','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','5seprwB','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Resolving\x20parent\x20folder\x20\x27','green','getSQLFromYamlFile','setJobId','getSegmentSQLFromYaml','segment:folder:show','segment','fullPath','Use:\x20tdx\x20ps\x20show','4392234dqvgKM','folderId','Usage:\x20tdx\x20sg\x20desc\x20<name>','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','(root)','query','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','\x20\x20Cause:\x20','298920pkySEQ','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','Parent\x20ID:\x20','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','execute','log','✖\x20Query\x20failed\x20[','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','parent','/e/','jobId','test','Show\x20child\x20segment\x20schema\x20(column\x20types)','✔\x20Query\x20completed:\x20Processed\x20','Fetching\x20segment\x20details...','Show\x20segment\x20folder\x20details','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Use:\x20tdx\x20ps\x20view\x20-w','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','length','resolvePathToResource','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Show\x20folder\x20or\x20child\x20segment\x20details','372244KoJhdM','segmentName','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','content','url','Folder\x20ID\x20missing\x20from\x20resolved\x20path','in\x20','toLocaleString','listFolders','type','Create\x20segment\x20folder\x20for\x20organization','elapsedTimeMillis','Use:\x20tdx\x20ps\x20view','parentFolder','segment:desc','Usage:\x20tdx\x20segment\x20describe\x20<path>','\x20[Job\x20ID:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','red','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Get\x20SQL\x20query\x20for\x20child\x20segment','segment:describe','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Parent\x20name:\x20','INVALID_ARGUMENT','Fetching\x20parent\x20segment\x20details...','getParent','Resolving\x20parent\x20segment\x20\x27','Fetching\x20SQL\x20from\x20rule...','createFolder','cause','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','SEGMENT_NOT_FOUND','jsonl','resolveFolderId','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','error','message','segment:folder:create','2418325GHnkHU','\x20\x20Folder\x20path:\x20','Folder\x20ID:\x20','442062hEgYGv','Use:\x20tdx\x20ps\x20desc','Examples:','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Fetching\x20folder\x20details...','segment:sql','Executing\x20segment\x20query...','Resolving\x20\x27','resolveParentId','format','1590510IVjvAQ','path','\x20\x20Parent\x20segment:\x20','replace','Error:\x20Folder\x20reference\x20is\x20required','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Creating\x20folder\x20\x27','8JRQtIX','Resolved\x20YAML\x20file:\x20','folderPath','includes','\x20Opening\x20','\x20\x20Full\x20path:\x20','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','folder','SEGMENT_FOLDER_NOT_FOUND','getSegmentSQL','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','\x20\x20Segment\x20name:\x20','description','Folder\x20name:\x20'];a37_0x3fc6=function(){return _0x486022;};return a37_0x3fc6();}import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0x455980 from'chalk';async function resolveSegmentTarget(_0x3f09de,_0x3f4d4e,_0x1de1c1){const _0x2950e5=a37_0x436c;if(isYamlFilePath(_0x3f09de))try{const _0x5ca85b=await resolveYamlFilePath(_0x3f09de);return _0x1de1c1&&(console[_0x2950e5(0x1a5)](_0x2950e5(0x1bd)+_0x3f09de),console[_0x2950e5(0x1a5)](_0x2950e5(0x1b7)+_0x5ca85b[_0x2950e5(0x14d)]),console[_0x2950e5(0x1a5)](_0x2950e5(0x1c7)+_0x5ca85b['segmentName']),console[_0x2950e5(0x1a5)](_0x2950e5(0x1a9)+(_0x5ca85b[_0x2950e5(0x1be)]||_0x2950e5(0x165))),console[_0x2950e5(0x1a5)](_0x2950e5(0x1c1)+_0x5ca85b[_0x2950e5(0x15f)])),_0x5ca85b[_0x2950e5(0x15f)];}catch(_0x54b38e){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2950e5(0x16c)+_0x54b38e['message']);}if(!_0x3f4d4e)throw new SDKError(ErrorCode[_0x2950e5(0x199)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x3f4d4e+'/'+_0x3f09de;}export class SegmentDescribeCommand extends BaseCommand{[a37_0xf60fab(0x14f)]=a37_0xf60fab(0x196);[a37_0xf60fab(0x1c8)]='Show\x20segment\x20or\x20folder\x20details';async['execute'](_0x3f1c44){const _0x1dfc00=a37_0xf60fab,{options:_0x18f2e1,args:_0x17037d,tdx:_0x35fefc}=_0x3f1c44,_0x47e68b=_0x17037d[0x0],_0x22bdad=!_0x47e68b&&!!_0x18f2e1[_0x1dfc00(0x14d)],_0x155ca7=_0x47e68b||_0x18f2e1['parentSegment'];if(!_0x155ca7)return console[_0x1dfc00(0x1a5)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console['error'](_0x1dfc00(0x190)),console[_0x1dfc00(0x1a5)](_0x1dfc00(0x1ad)),console[_0x1dfc00(0x1a5)](_0x1dfc00(0x164)),console[_0x1dfc00(0x1a5)](_0x1dfc00(0x1ae)),console[_0x1dfc00(0x1a5)](_0x1dfc00(0x151)),console[_0x1dfc00(0x1a5)](_0x1dfc00(0x146)),0x1;try{const _0x156bb1=_0x18f2e1['segmentPath'];let _0x55aa91=_0x155ca7;!_0x22bdad&&_0x156bb1&&!_0x155ca7[_0x1dfc00(0x1bf)]('/')&&(_0x55aa91=_0x156bb1+'/'+_0x155ca7,_0x18f2e1[_0x1dfc00(0x13a)]&&console['error'](_0x1dfc00(0x14e)+_0x55aa91));const _0xa174a4=await withSpinner('Resolving\x20path\x20\x27'+_0x55aa91+'\x27...',()=>_0x35fefc['segment'][_0x1dfc00(0x17e)](_0x55aa91),{'verbose':_0x18f2e1[_0x1dfc00(0x13a)]}),_0x4b23e7=_0xa174a4[_0x1dfc00(0x148)];_0x18f2e1['verbose']&&(console['error'](_0x1dfc00(0x139)+_0x4b23e7['type']),console[_0x1dfc00(0x1a5)]('Parent\x20ID:\x20'+_0x4b23e7[_0x1dfc00(0x133)]),_0x4b23e7[_0x1dfc00(0x162)]&&console['error']('Folder\x20ID:\x20'+_0x4b23e7[_0x1dfc00(0x162)]),_0x4b23e7['segmentId']&&console[_0x1dfc00(0x1a5)](_0x1dfc00(0x12f)+_0x4b23e7[_0x1dfc00(0x12d)]));if(_0x4b23e7[_0x1dfc00(0x18a)]===_0x1dfc00(0x171)){const _0x3f9f7c=await withSpinner(_0x1dfc00(0x19a),()=>_0x35fefc[_0x1dfc00(0x15e)][_0x1dfc00(0x19b)](_0x4b23e7[_0x1dfc00(0x133)]),{'verbose':_0x18f2e1['verbose']});await handleSingleObjectOutput(_0x3f9f7c[_0x1dfc00(0x148)],_0x18f2e1);}else{if(_0x4b23e7[_0x1dfc00(0x18a)]===_0x1dfc00(0x1c3)){if(!_0x4b23e7[_0x1dfc00(0x162)])throw new SDKError(ErrorCode[_0x1dfc00(0x1c4)],_0x1dfc00(0x186));const _0x4f8c12=await withSpinner('Fetching\x20folder\x20details...',()=>_0x35fefc[_0x1dfc00(0x15e)][_0x1dfc00(0x13b)](_0x4b23e7['folderId']),{'verbose':_0x18f2e1['verbose']});await handleSingleObjectOutput(_0x4f8c12['data'],_0x18f2e1);}else{if(_0x4b23e7['type']===_0x1dfc00(0x15e)){if(!_0x4b23e7[_0x1dfc00(0x12d)])throw new SDKError(ErrorCode[_0x1dfc00(0x1a1)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x58f21e=await withSpinner(_0x1dfc00(0x177),()=>_0x35fefc[_0x1dfc00(0x15e)][_0x1dfc00(0x1ca)](_0x4b23e7[_0x1dfc00(0x133)],_0x4b23e7[_0x1dfc00(0x12d)]),{'verbose':_0x18f2e1[_0x1dfc00(0x13a)]});await handleSingleObjectOutput(_0x58f21e['data'],_0x18f2e1);}}}return 0x0;}catch(_0x277420){if(_0x277420 instanceof SDKError)return console['error']('Error:\x20'+_0x277420['message']),_0x277420[_0x1dfc00(0x19f)]&&console[_0x1dfc00(0x1a5)](_0x1dfc00(0x168)+_0x277420['cause']),0x1;throw _0x277420;}}}export class SegmentShowCommand extends BaseCommand{[a37_0xf60fab(0x14f)]='segment:show';['description']='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a37_0xf60fab(0x16d)](_0x2d62a2){const _0x410280=a37_0xf60fab,{options:_0x3dad99,args:_0x10a967,tdx:_0x2d6c1e}=_0x2d62a2,_0xba5b0f=_0x10a967[0x0];if(!_0xba5b0f)return console[_0x410280(0x1a5)](_0x410280(0x17c)),console[_0x410280(0x1a5)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x410280(0x1a5)](_0x410280(0x1ad)),console[_0x410280(0x1a5)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console['error'](_0x410280(0x167)),0x1;try{const _0x354b4d=_0x3dad99[_0x410280(0x14d)],_0x2e354d=await resolveSegmentTarget(_0xba5b0f,_0x354b4d,_0x3dad99[_0x410280(0x13a)]);_0x3dad99[_0x410280(0x13a)]&&console[_0x410280(0x1a5)](_0x410280(0x13c)+_0x2e354d);const _0xdc7089=await withSpinner(_0x410280(0x1b2)+_0xba5b0f+_0x410280(0x12c),()=>_0x2d6c1e[_0x410280(0x15e)][_0x410280(0x17e)](_0x2e354d),{'verbose':_0x3dad99[_0x410280(0x13a)]}),_0x52d402=_0xdc7089[_0x410280(0x148)];_0x3dad99[_0x410280(0x13a)]&&(console[_0x410280(0x1a5)](_0x410280(0x139)+_0x52d402['type']),console['error'](_0x410280(0x16b)+_0x52d402[_0x410280(0x133)]));if(_0x52d402[_0x410280(0x18a)]===_0x410280(0x1c3))return console[_0x410280(0x1a5)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0x410280(0x1a5)]('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x52d402[_0x410280(0x18a)]===_0x410280(0x171))return console['error'](_0x410280(0x1c2)),console[_0x410280(0x1a5)](_0x410280(0x160)),0x1;if(!_0x52d402[_0x410280(0x12d)])throw new SDKError(ErrorCode[_0x410280(0x1a1)],_0x410280(0x197));const _0x1f2e23=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x2d6c1e['segment'][_0x410280(0x1c5)](_0x52d402[_0x410280(0x133)],_0x52d402[_0x410280(0x12d)]),{'verbose':_0x3dad99[_0x410280(0x13a)]});let _0x34f122=_0x1f2e23[_0x410280(0x148)];const _0x111a03=resolveLimit(_0x3dad99[_0x410280(0x150)],DEFAULT_DISPLAY_LIMIT),_0x148508=/\bLIMIT\s+\d+/i[_0x410280(0x174)](_0x34f122);!_0x148508&&(_0x34f122=_0x34f122['trim']()[_0x410280(0x1b8)](/;+$/,''),_0x34f122=_0x410280(0x129)+_0x34f122+_0x410280(0x1ba)+_0x111a03);_0x3dad99['verbose']&&console[_0x410280(0x1a5)]('SQL\x20query:\x0a'+_0x34f122);const _0x1a78c0=await withProgressSpinner(_0x410280(0x1b1),async _0x3b7152=>{const _0x19da67=_0x410280,_0x52c54=await _0x2d6c1e[_0x19da67(0x166)][_0x19da67(0x16d)](_0x34f122,{'catalog':'td','schema':_0x19da67(0x14a),'onJobId':_0x3df410=>{const _0x404ebd=_0x19da67;_0x3b7152[_0x404ebd(0x15b)](_0x3df410);}});return _0x52c54;},{'verbose':_0x3dad99[_0x410280(0x13a)]}),_0x3d8454=_0x1a78c0[_0x410280(0x148)],_0x2bae80=_0x3d8454[_0x410280(0x173)]?_0x410280(0x191)+_0x3d8454['jobId']+']':'';return console['error'](_0x410280(0x176)+_0x3d8454['stats']['processedRows'][_0x410280(0x188)]()+_0x410280(0x132)+(_0x410280(0x187)+formatElapsed(_0x3d8454[_0x410280(0x137)][_0x410280(0x18c)])+_0x2bae80)),await handleQueryOutput(_0x3d8454,_0x3dad99),0x0;}catch(_0xbfc8d2){if(_0xbfc8d2 instanceof SDKError)return console['error'](_0x410280(0x16f)+_0xbfc8d2[_0x410280(0x136)]+']'),console[_0x410280(0x1a5)]('\x0a'+_0xbfc8d2[_0x410280(0x1a6)]),0x1;throw _0xbfc8d2;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0xf60fab(0x14f)]='segment:folder:list';[a37_0xf60fab(0x1c8)]=a37_0xf60fab(0x155);async['execute'](_0x3ffafc){const _0x380446=a37_0xf60fab,{options:_0xe28029,args:_0x371387,tdx:_0x2afc40}=_0x3ffafc;if(_0x371387[_0x380446(0x17d)]===0x0)return console[_0x380446(0x1a5)](_0x380446(0x149)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x44e475=_0x371387[0x0];try{_0xe28029[_0x380446(0x13a)]&&(console[_0x380446(0x1a5)]('Site:\x20'+_0xe28029[_0x380446(0x13e)]),console[_0x380446(0x1a5)](_0x380446(0x198)+_0x44e475));const _0x3ec6c6=await withSpinner(_0x380446(0x19c)+_0x44e475+_0x380446(0x12c),()=>_0x2afc40[_0x380446(0x15e)][_0x380446(0x1b3)](_0x44e475),{'verbose':_0xe28029[_0x380446(0x13a)]}),_0x486bda=_0x3ec6c6[_0x380446(0x148)];_0xe28029[_0x380446(0x13a)]&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x486bda);const _0x12a9ad=await withSpinner(_0x380446(0x12b)+_0x44e475+'\x27...',()=>_0x2afc40[_0x380446(0x15e)][_0x380446(0x189)](_0x486bda),{'verbose':_0xe28029[_0x380446(0x13a)]}),_0x336854=_0x12a9ad[_0x380446(0x148)];return console[_0x380446(0x1a5)]('✔\x20Found\x20'+_0x336854['length']+'\x20folder'+(_0x336854[_0x380446(0x17d)]!==0x1?'s':'')),await handleSDKOutput(_0x336854,_0xe28029),0x0;}catch(_0x25752f){if(_0x25752f instanceof SDKError)return console[_0x380446(0x1a5)](_0x380446(0x138)+_0x25752f[_0x380446(0x1a6)]),_0x25752f[_0x380446(0x19f)]&&console[_0x380446(0x1a5)](_0x380446(0x168)+_0x25752f[_0x380446(0x19f)]),0x1;throw _0x25752f;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a37_0xf60fab(0x15d);[a37_0xf60fab(0x1c8)]=a37_0xf60fab(0x178);async[a37_0xf60fab(0x16d)](_0x1f376d){const _0x1db050=a37_0xf60fab,{options:_0x51f37f,args:_0x78c38f,tdx:_0xed0701}=_0x1f376d;if(_0x78c38f[_0x1db050(0x17d)]===0x0)return console[_0x1db050(0x1a5)](_0x1db050(0x1b9)),console[_0x1db050(0x1a5)](_0x1db050(0x14b)),0x1;try{const {parentId:_0x1de322,childId:_0x107bf2}=parseSegmentRef(_0x78c38f[0x0]);_0x51f37f[_0x1db050(0x13a)]&&(console[_0x1db050(0x1a5)](_0x1db050(0x135)+_0x51f37f['site']),console[_0x1db050(0x1a5)](_0x1db050(0x198)+_0x1de322),_0x107bf2&&console[_0x1db050(0x1a5)](_0x1db050(0x1c9)+_0x107bf2));if(!_0x107bf2)return console[_0x1db050(0x1a5)](_0x1db050(0x1a0)),0x1;const _0x518b0d=await withSpinner(_0x1db050(0x19c)+_0x1de322+'\x27...',()=>_0xed0701['segment'][_0x1db050(0x1b3)](_0x1de322),{'verbose':_0x51f37f[_0x1db050(0x13a)]}),_0x112da9=_0x518b0d[_0x1db050(0x148)];_0x51f37f['verbose']&&console[_0x1db050(0x1a5)](_0x1db050(0x142)+_0x112da9);const _0x286233=await withSpinner('Resolving\x20folder\x20\x27'+_0x107bf2+_0x1db050(0x12c),()=>_0xed0701['segment'][_0x1db050(0x1a3)](_0x112da9,_0x107bf2),{'verbose':_0x51f37f[_0x1db050(0x13a)]}),_0x244553=_0x286233['data'];_0x51f37f[_0x1db050(0x13a)]&&console['error'](_0x1db050(0x12a)+_0x244553);const _0x15c2ad=await withSpinner(_0x1db050(0x13d)+_0x107bf2+'\x27...',()=>_0xed0701[_0x1db050(0x15e)][_0x1db050(0x13b)](_0x244553),{'verbose':_0x51f37f[_0x1db050(0x13a)]});return await handleSDKOutput([_0x15c2ad[_0x1db050(0x148)]],_0x51f37f),0x0;}catch(_0x101f05){if(_0x101f05 instanceof SDKError)return console[_0x1db050(0x1a5)](_0x1db050(0x138)+_0x101f05[_0x1db050(0x1a6)]),_0x101f05[_0x1db050(0x19f)]&&console[_0x1db050(0x1a5)]('\x20\x20Cause:\x20'+_0x101f05[_0x1db050(0x19f)]),0x1;throw _0x101f05;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0xf60fab(0x14f)]=a37_0xf60fab(0x1b0);[a37_0xf60fab(0x1c8)]=a37_0xf60fab(0x195);async[a37_0xf60fab(0x16d)](_0x45b906){const _0x13a923=a37_0xf60fab,{options:_0x17e34b,args:_0x2bc5f7}=_0x45b906,_0x49b0a4=_0x17e34b,_0x322e59=_0x49b0a4[_0x13a923(0x1b6)],_0x2705cf=_0x2bc5f7[0x0];if(!_0x2705cf&&!_0x322e59)return console[_0x13a923(0x1a5)](a37_0x455980[_0x13a923(0x193)]('Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required')),console['error'](_0x13a923(0x140)),console[_0x13a923(0x1a5)]('\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>'),console['error']('\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>'),console['error'](_0x13a923(0x1ad)),console['error']('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x13a923(0x1a5)](_0x13a923(0x12e)),0x1;if(_0x2705cf&&_0x322e59)return console[_0x13a923(0x1a5)](a37_0x455980['red'](_0x13a923(0x16a))),0x1;try{let _0x29d187;if(_0x322e59)_0x29d187=await this[_0x13a923(0x15a)](_0x322e59,_0x45b906);else{if(isYamlFilePath(_0x2705cf))return console[_0x13a923(0x1a5)](a37_0x455980[_0x13a923(0x193)](_0x13a923(0x14c))),console['error'](_0x13a923(0x157)+_0x2705cf),0x1;else _0x29d187=await this['getSQLFromServerSegment'](_0x2705cf,_0x45b906);}return _0x17e34b[_0x13a923(0x1b4)]===_0x13a923(0x144)||_0x17e34b[_0x13a923(0x1b4)]===_0x13a923(0x1a2)?await handleSDKOutput([{'sql':_0x29d187}],_0x17e34b):console[_0x13a923(0x16e)](_0x29d187),0x0;}catch(_0x37b7af){if(_0x37b7af instanceof SDKError)return console['error']('Error:\x20'+_0x37b7af[_0x13a923(0x1a6)]),_0x37b7af[_0x13a923(0x19f)]&&console[_0x13a923(0x1a5)](_0x13a923(0x168)+_0x37b7af[_0x13a923(0x19f)]),0x1;throw _0x37b7af;}}async[a37_0xf60fab(0x15a)](_0xf9667a,_0x2b7007){const _0x3644a6=a37_0xf60fab,{options:_0x288c63,tdx:_0x47c1c3}=_0x2b7007;let _0x2444a5;try{_0x2444a5=await resolveYamlFilePath(_0xf9667a);}catch(_0x505e0c){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x505e0c[_0x3644a6(0x1a6)]);}_0x288c63['verbose']&&console[_0x3644a6(0x1a5)]('Resolved:\x20'+_0x2444a5['parentSegment']+'/'+_0x2444a5[_0x3644a6(0x182)]);const _0x3f4ad9=await withSpinner(_0x3644a6(0x19d),()=>_0x47c1c3[_0x3644a6(0x15e)][_0x3644a6(0x15c)](_0x2444a5[_0x3644a6(0x184)],_0x2444a5[_0x3644a6(0x14d)],_0x2444a5[_0x3644a6(0x182)]),{'verbose':_0x288c63[_0x3644a6(0x13a)]});return _0x3f4ad9[_0x3644a6(0x148)];}async['getSQLFromServerSegment'](_0x25383d,_0x248f27){const _0x2a50b0=a37_0xf60fab,{options:_0x224e0f,tdx:_0x46eb60}=_0x248f27,_0x3c7607=_0x224e0f[_0x2a50b0(0x14d)],_0x5ce004=await resolveSegmentTarget(_0x25383d,_0x3c7607,_0x224e0f['verbose']);_0x224e0f[_0x2a50b0(0x13a)]&&console[_0x2a50b0(0x1a5)](_0x2a50b0(0x13c)+_0x5ce004);const _0xf54607=await withSpinner(_0x2a50b0(0x1b2)+_0x25383d+_0x2a50b0(0x12c),()=>_0x46eb60['segment'][_0x2a50b0(0x17e)](_0x5ce004),{'verbose':_0x224e0f['verbose']}),_0x2f0244=_0xf54607['data'];_0x224e0f[_0x2a50b0(0x13a)]&&(console[_0x2a50b0(0x1a5)](_0x2a50b0(0x139)+_0x2f0244[_0x2a50b0(0x18a)]),console['error']('Parent\x20ID:\x20'+_0x2f0244[_0x2a50b0(0x133)]));if(_0x2f0244[_0x2a50b0(0x18a)]===_0x2a50b0(0x1c3))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2a50b0(0x143));if(_0x2f0244[_0x2a50b0(0x18a)]===_0x2a50b0(0x171))throw new SDKError(ErrorCode[_0x2a50b0(0x199)],_0x2a50b0(0x1a4));if(!_0x2f0244[_0x2a50b0(0x12d)])throw new SDKError(ErrorCode[_0x2a50b0(0x1a1)],_0x2a50b0(0x197));const _0x493fc9=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x46eb60[_0x2a50b0(0x15e)][_0x2a50b0(0x1c5)](_0x2f0244[_0x2a50b0(0x133)],_0x2f0244[_0x2a50b0(0x12d)]),{'verbose':_0x224e0f[_0x2a50b0(0x13a)]});return _0x493fc9[_0x2a50b0(0x148)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0xf60fab(0x14f)]=a37_0xf60fab(0x1a7);[a37_0xf60fab(0x1c8)]=a37_0xf60fab(0x18b);async[a37_0xf60fab(0x16d)](_0x38e94d){const _0x20d41d=a37_0xf60fab,{options:_0x215a1f,args:_0x403ac6,tdx:_0x3c5d30}=_0x38e94d,_0x472f78=_0x215a1f;if(_0x403ac6['length']<0x2)return console[_0x20d41d(0x1a5)](_0x20d41d(0x147)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x2c0f8b=_0x403ac6[0x0],_0x1ba439=_0x403ac6[0x1];_0x472f78['verbose']&&(console[_0x20d41d(0x1a5)](_0x20d41d(0x135)+_0x472f78[_0x20d41d(0x13e)]),console[_0x20d41d(0x1a5)](_0x20d41d(0x127)+_0x2c0f8b),console['error'](_0x20d41d(0x1c9)+_0x1ba439));let _0x30e080;if(_0x472f78[_0x20d41d(0x18e)]){const _0x1eea51=_0x472f78[_0x20d41d(0x18e)],_0x5a47bb=await withSpinner(_0x20d41d(0x19c)+_0x2c0f8b+_0x20d41d(0x12c),()=>_0x3c5d30[_0x20d41d(0x15e)][_0x20d41d(0x1b3)](_0x2c0f8b),{'verbose':_0x472f78[_0x20d41d(0x13a)]}),_0x1d07cf=_0x5a47bb[_0x20d41d(0x148)],_0x4c18b2=await withSpinner(_0x20d41d(0x158)+_0x1eea51+_0x20d41d(0x12c),()=>_0x3c5d30[_0x20d41d(0x15e)][_0x20d41d(0x1a3)](_0x1d07cf,_0x1eea51),{'verbose':_0x472f78[_0x20d41d(0x13a)]});_0x30e080=_0x4c18b2[_0x20d41d(0x148)],_0x472f78['verbose']&&console[_0x20d41d(0x1a5)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x30e080);}const _0x375786={'name':_0x1ba439,'description':_0x472f78['description'],'parentFolderId':_0x30e080},_0xafec6a=await withSpinner(_0x20d41d(0x1bb)+_0x1ba439+_0x20d41d(0x12c),()=>_0x3c5d30[_0x20d41d(0x15e)][_0x20d41d(0x19e)](_0x2c0f8b,_0x375786),{'verbose':_0x472f78[_0x20d41d(0x13a)]}),_0x3e62db=_0xafec6a[_0x20d41d(0x148)];return console['error'](_0x20d41d(0x154)+_0x3e62db[_0x20d41d(0x14f)]+_0x20d41d(0x153)+_0x3e62db['id']),await handleSDKOutput([_0x3e62db],_0x472f78),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a37_0xf60fab(0x130);[a37_0xf60fab(0x1c8)]=a37_0xf60fab(0x180);async[a37_0xf60fab(0x16d)](_0x3ffa28){const _0x53fe78=a37_0xf60fab,{options:_0x3abd77,args:_0x507292,tdx:_0x1fccd4}=_0x3ffa28,_0x5c55aa=_0x507292[0x0];if(!_0x5c55aa)return console[_0x53fe78(0x1a5)](_0x53fe78(0x128)),console['error']('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console[_0x53fe78(0x1a5)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console[_0x53fe78(0x1a5)]('Options:'),console[_0x53fe78(0x1a5)](_0x53fe78(0x183)),console[_0x53fe78(0x1a5)](_0x53fe78(0x1ad)),console['error'](_0x53fe78(0x145)),console['error'](_0x53fe78(0x17f)),console[_0x53fe78(0x1a5)](_0x53fe78(0x170)),console[_0x53fe78(0x1a5)]('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x5b5b02=_0x3abd77[_0x53fe78(0x14d)],_0x2dbe33=await resolveSegmentTarget(_0x5c55aa,_0x5b5b02,_0x3abd77[_0x53fe78(0x13a)]);_0x3abd77[_0x53fe78(0x13a)]&&console[_0x53fe78(0x1a5)](_0x53fe78(0x13c)+_0x2dbe33);const _0x40cdfb=await withSpinner(_0x53fe78(0x1b2)+_0x5c55aa+'\x27...',()=>_0x1fccd4[_0x53fe78(0x15e)][_0x53fe78(0x17e)](_0x2dbe33),{'verbose':_0x3abd77[_0x53fe78(0x13a)]}),_0x47bc8e=_0x40cdfb[_0x53fe78(0x148)];_0x3abd77[_0x53fe78(0x13a)]&&(console[_0x53fe78(0x1a5)](_0x53fe78(0x139)+_0x47bc8e[_0x53fe78(0x18a)]),console[_0x53fe78(0x1a5)]('Parent\x20ID:\x20'+_0x47bc8e[_0x53fe78(0x133)]),_0x47bc8e[_0x53fe78(0x162)]&&console[_0x53fe78(0x1a5)](_0x53fe78(0x1aa)+_0x47bc8e[_0x53fe78(0x162)]),_0x47bc8e['segmentId']&&console['error'](_0x53fe78(0x12f)+_0x47bc8e[_0x53fe78(0x12d)]));if(_0x3abd77['web']){if(_0x47bc8e[_0x53fe78(0x18a)]==='folder')return console[_0x53fe78(0x1a5)](_0x53fe78(0x126)),0x1;if(_0x47bc8e[_0x53fe78(0x18a)]===_0x53fe78(0x171))return console[_0x53fe78(0x1a5)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x53fe78(0x1a5)](_0x53fe78(0x17b)),0x1;if(!_0x47bc8e[_0x53fe78(0x12d)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x53fe78(0x197));const _0x15588e=getConsoleNextUrl(_0x3abd77['site'],_0x53fe78(0x152)+_0x47bc8e['parentId']+_0x53fe78(0x172)+_0x47bc8e['segmentId']);return console[_0x53fe78(0x1a5)](a37_0x455980[_0x53fe78(0x159)]('✔')+_0x53fe78(0x1c0)+a37_0x455980['cyan'](_0x15588e)),openBrowser(_0x15588e),0x0;}if(_0x47bc8e['type']==='folder'){if(!_0x47bc8e[_0x53fe78(0x162)])throw new SDKError(ErrorCode[_0x53fe78(0x1c4)],_0x53fe78(0x186));const _0x1a8ebe=await withSpinner(_0x53fe78(0x1af),()=>_0x1fccd4[_0x53fe78(0x15e)][_0x53fe78(0x13b)](_0x47bc8e[_0x53fe78(0x162)]),{'verbose':_0x3abd77['verbose']});await handleSingleObjectOutput(_0x1a8ebe[_0x53fe78(0x148)],_0x3abd77);}else{if(_0x47bc8e[_0x53fe78(0x18a)]===_0x53fe78(0x15e)){if(!_0x47bc8e['segmentId'])throw new SDKError(ErrorCode[_0x53fe78(0x1a1)],_0x53fe78(0x197));const _0x38a2b0=await withSpinner(_0x53fe78(0x177),()=>_0x1fccd4[_0x53fe78(0x15e)][_0x53fe78(0x1ca)](_0x47bc8e[_0x53fe78(0x133)],_0x47bc8e['segmentId']),{'verbose':_0x3abd77[_0x53fe78(0x13a)]}),_0x2874ce=getConsoleNextUrl(_0x3abd77[_0x53fe78(0x13e)],_0x53fe78(0x152)+_0x47bc8e[_0x53fe78(0x133)]+_0x53fe78(0x172)+_0x47bc8e['segmentId']),_0x270efc=_0x38a2b0['data'];_0x270efc[_0x53fe78(0x185)]=_0x2874ce,await handleSingleObjectOutput(_0x270efc,_0x3abd77);}else return console['error'](_0x53fe78(0x179)),console[_0x53fe78(0x1a5)](_0x53fe78(0x18d)),0x1;}return 0x0;}catch(_0x3e396e){if(_0x3e396e instanceof SDKError)return console['error']('Error:\x20'+_0x3e396e[_0x53fe78(0x1a6)]),_0x3e396e['cause']&&console[_0x53fe78(0x1a5)](_0x53fe78(0x168)+_0x3e396e['cause']),0x1;throw _0x3e396e;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']=a37_0xf60fab(0x18f);[a37_0xf60fab(0x1c8)]=a37_0xf60fab(0x175);async['execute'](_0x291526){const _0x5be196=a37_0xf60fab,{options:_0x27773b,args:_0x53f233,tdx:_0x3f33c3}=_0x291526,_0x54beab=_0x53f233[0x0];if(!_0x54beab)return console[_0x5be196(0x1a5)](_0x5be196(0x17c)),console['error'](_0x5be196(0x163)),console[_0x5be196(0x1a5)](_0x5be196(0x17a)),console['error'](_0x5be196(0x1ad)),console[_0x5be196(0x1a5)](_0x5be196(0x134)),console[_0x5be196(0x1a5)](_0x5be196(0x1c6)),0x1;try{const _0xe7bc07=_0x27773b[_0x5be196(0x14d)],_0x16adb5=await resolveSegmentTarget(_0x54beab,_0xe7bc07,_0x27773b[_0x5be196(0x13a)]);_0x27773b[_0x5be196(0x13a)]&&console[_0x5be196(0x1a5)]('Target\x20path:\x20'+_0x16adb5);const _0x5d803b=await withSpinner(_0x5be196(0x1b2)+_0x54beab+_0x5be196(0x12c),()=>_0x3f33c3['segment'][_0x5be196(0x17e)](_0x16adb5),{'verbose':_0x27773b['verbose']}),_0x33f3f7=_0x5d803b[_0x5be196(0x148)];_0x27773b[_0x5be196(0x13a)]&&(console[_0x5be196(0x1a5)](_0x5be196(0x139)+_0x33f3f7['type']),console['error'](_0x5be196(0x16b)+_0x33f3f7['parentId']));if(_0x33f3f7[_0x5be196(0x18a)]===_0x5be196(0x1c3))return console['error'](_0x5be196(0x194)),console[_0x5be196(0x1a5)](_0x5be196(0x131)),0x1;if(_0x33f3f7[_0x5be196(0x18a)]===_0x5be196(0x171))return console[_0x5be196(0x1a5)](_0x5be196(0x192)),console[_0x5be196(0x1a5)](_0x5be196(0x1ac)),0x1;if(!_0x33f3f7[_0x5be196(0x12d)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x5be196(0x197));const _0x3bf220=await withSpinner(_0x5be196(0x13f),()=>_0x3f33c3[_0x5be196(0x15e)][_0x5be196(0x1c5)](_0x33f3f7[_0x5be196(0x133)],_0x33f3f7[_0x5be196(0x12d)]),{'verbose':_0x27773b[_0x5be196(0x13a)]}),_0x414899=_0x3bf220['data'],_0x3d995a=await executeSchemaQuery(_0x414899,_0x3f33c3,_0x27773b);return await handleQueryOutput(_0x3d995a,_0x27773b),0x0;}catch(_0x2120a5){if(_0x2120a5 instanceof SDKError)return console[_0x5be196(0x1a5)](_0x5be196(0x138)+_0x2120a5[_0x5be196(0x1a6)]),_0x2120a5[_0x5be196(0x19f)]&&console[_0x5be196(0x1a5)](_0x5be196(0x168)+_0x2120a5['cause']),0x1;throw _0x2120a5;}}}
@@ -1 +1 @@
1
- const a38_0x487c37=a38_0x5b83;(function(_0xa10563,_0x4fa52d){const _0x11227f=a38_0x5b83,_0x47e1c1=_0xa10563();while(!![]){try{const _0x5b0c51=-parseInt(_0x11227f(0xda))/0x1*(parseInt(_0x11227f(0xc5))/0x2)+parseInt(_0x11227f(0xfa))/0x3*(parseInt(_0x11227f(0xd5))/0x4)+parseInt(_0x11227f(0xdb))/0x5*(parseInt(_0x11227f(0xef))/0x6)+-parseInt(_0x11227f(0xd1))/0x7*(parseInt(_0x11227f(0xf2))/0x8)+parseInt(_0x11227f(0xf0))/0x9*(-parseInt(_0x11227f(0xc9))/0xa)+-parseInt(_0x11227f(0xe7))/0xb+parseInt(_0x11227f(0xd6))/0xc*(parseInt(_0x11227f(0xe4))/0xd);if(_0x5b0c51===_0x4fa52d)break;else _0x47e1c1['push'](_0x47e1c1['shift']());}catch(_0x5d72d0){_0x47e1c1['push'](_0x47e1c1['shift']());}}}(a38_0x27f7,0x1a784));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a38_0x5b83(_0x1eaed4,_0x2a417d){_0x1eaed4=_0x1eaed4-0xc1;const _0x27f7e4=a38_0x27f7();let _0x5b83f1=_0x27f7e4[_0x1eaed4];return _0x5b83f1;}import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';function a38_0x27f7(){const _0x3dd28b=['Resolved\x20relative\x20path\x20to:\x20','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','1941410JwilhT','Create\x20child\x20segment\x20with\x20filtering\x20rules','\x20\x20\x20Path:\x20','resolvePathToResource','includes','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','Segment\x20name:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','7eVVLHT','data','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','\x27\x20with\x20ID:\x20','227600GwcWBB','180uRcDAc','Resolved\x20folder\x20ID:\x20','segmentPath','segment','26FnVXio','3375OzXLDV','Parent:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','folder','\x27...','yellow','parent','resolveParentId','verbose','332371GTqwyt','invisible','Site:\x20','2342912rQpjTf','folderId','Parent\x20path:\x20','noCountPopulation','Creating\x20segment\x20\x27','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','length','Examples:','1608wGPtBt','9ycuIjp','Target\x20path:\x20','1107984fsIyOE','error','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','createSegment','resolveFolderId','type','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','6zuWvNe','site','execute','segment:create','segments','ruleFile','1858ashTcn','name'];a38_0x27f7=function(){return _0x3dd28b;};return a38_0x27f7();}import a38_0x21d07f from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x487c37(0xc6)]=a38_0x487c37(0xc2);['description']=a38_0x487c37(0xca);async[a38_0x487c37(0xc1)](_0x34b463){const _0x1fef3f=a38_0x487c37;console[_0x1fef3f(0xf3)](a38_0x21d07f[_0x1fef3f(0xe0)](_0x1fef3f(0xc8))),console[_0x1fef3f(0xf3)](a38_0x21d07f[_0x1fef3f(0xe0)](_0x1fef3f(0xf9)));const {options:_0xb5bd26,args:_0xc32375,tdx:_0x17951e}=_0x34b463,_0x4409e0=_0xb5bd26;if(_0xc32375[_0x1fef3f(0xed)]===0x0)return console[_0x1fef3f(0xf3)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x1fef3f(0xf3)](_0x1fef3f(0xf5)),console[_0x1fef3f(0xf3)](_0x1fef3f(0xee)),console['error'](_0x1fef3f(0xdd)),console[_0x1fef3f(0xf3)](_0x1fef3f(0xd0)),console[_0x1fef3f(0xf3)](_0x1fef3f(0xf4)),0x1;const _0x5c978c=_0xc32375[0x0],_0x4ee1b6=_0xb5bd26[_0x1fef3f(0xd8)];let _0x291d73=_0x5c978c;_0x4ee1b6&&!_0x5c978c[_0x1fef3f(0xcd)]('/')&&(_0x291d73=_0x4ee1b6+'/'+_0x5c978c,_0x4409e0[_0x1fef3f(0xe3)]&&console['error'](_0x1fef3f(0xc7)+_0x291d73));const _0x1df499=parsePath(_0x291d73);if(_0x1df499[_0x1fef3f(0xc3)][_0x1fef3f(0xed)]<0x2)return console[_0x1fef3f(0xf3)](_0x1fef3f(0xec)),console[_0x1fef3f(0xf3)](_0x1fef3f(0xd3)),0x1;const _0x36e332=_0x1df499[_0x1fef3f(0xc3)][0x0],_0x474f0c=getBaseName(_0x291d73),_0x4fcd4c=getParentPath(_0x291d73);_0x4409e0[_0x1fef3f(0xe3)]&&(console[_0x1fef3f(0xf3)](_0x1fef3f(0xe6)+_0x4409e0[_0x1fef3f(0xfb)]),console[_0x1fef3f(0xf3)](_0x1fef3f(0xf1)+_0x291d73),console[_0x1fef3f(0xf3)](_0x1fef3f(0xdc)+_0x36e332),console[_0x1fef3f(0xf3)](_0x1fef3f(0xcf)+_0x474f0c),console[_0x1fef3f(0xf3)](_0x1fef3f(0xe9)+_0x4fcd4c));const _0xd9a8cb=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x36e332+_0x1fef3f(0xdf),()=>_0x17951e[_0x1fef3f(0xd9)][_0x1fef3f(0xe2)](_0x36e332),{'verbose':_0x4409e0[_0x1fef3f(0xe3)]}),_0x416abe=_0xd9a8cb['data'];let _0x15124b;if(_0x1df499[_0x1fef3f(0xc3)][_0x1fef3f(0xed)]>0x2){const _0x1acbc9=await withSpinner('Resolving\x20folder\x20path\x20\x27'+_0x4fcd4c+'\x27...',()=>_0x17951e[_0x1fef3f(0xd9)][_0x1fef3f(0xcc)](_0x4fcd4c),{'verbose':_0x4409e0[_0x1fef3f(0xe3)]}),_0x88f1a9=_0x1acbc9['data'];if(_0x88f1a9[_0x1fef3f(0xf8)]!==_0x1fef3f(0xde)&&_0x88f1a9['type']!==_0x1fef3f(0xe1))return console['error'](_0x1fef3f(0xce)),0x1;_0x15124b=_0x88f1a9[_0x1fef3f(0xe8)];}else{if(_0x4409e0['folder']){const _0x1caaeb=await withSpinner('Resolving\x20folder\x20\x27'+_0x4409e0[_0x1fef3f(0xde)]+'\x27...',()=>_0x17951e[_0x1fef3f(0xd9)][_0x1fef3f(0xf7)](_0x416abe,_0x4409e0[_0x1fef3f(0xde)]),{'verbose':_0x4409e0[_0x1fef3f(0xe3)]});_0x15124b=_0x1caaeb[_0x1fef3f(0xd2)];}}_0x4409e0[_0x1fef3f(0xe3)]&&_0x15124b&&console[_0x1fef3f(0xf3)](_0x1fef3f(0xd7)+_0x15124b);const _0x5941b0=await loadJSONFromOptions(_0x4409e0['rule'],_0x4409e0[_0x1fef3f(0xc4)]),_0x2acff5={'name':_0x474f0c,'description':_0x4409e0['description'],'rule':_0x5941b0,'kind':_0x4409e0['kind']!==undefined?parseInt(_0x4409e0['kind'],0xa):undefined,'isVisible':_0x4409e0[_0x1fef3f(0xe5)]?![]:undefined,'segmentFolderId':_0x15124b,'countPopulation':_0x4409e0[_0x1fef3f(0xea)]?![]:undefined},_0x268f54=await withSpinner(_0x1fef3f(0xeb)+_0x474f0c+_0x1fef3f(0xdf),()=>_0x17951e[_0x1fef3f(0xd9)][_0x1fef3f(0xf6)](_0x416abe,_0x2acff5),{'verbose':_0x4409e0[_0x1fef3f(0xe3)]}),_0x36747f=_0x268f54[_0x1fef3f(0xd2)];return console[_0x1fef3f(0xf3)]('✔\x20Created\x20segment\x20\x27'+_0x36747f[_0x1fef3f(0xc6)]+_0x1fef3f(0xd4)+_0x36747f['id']),_0x291d73!==_0x5c978c&&console[_0x1fef3f(0xf3)](_0x1fef3f(0xcb)+_0x291d73),await handleSDKOutput([_0x36747f],_0x4409e0),0x0;}}
1
+ const a38_0x5932b7=a38_0x2b7c;(function(_0x3991f5,_0x12159e){const _0x626c35=a38_0x2b7c,_0x1c8ee7=_0x3991f5();while(!![]){try{const _0x15d897=parseInt(_0x626c35(0x7e))/0x1*(-parseInt(_0x626c35(0x8d))/0x2)+parseInt(_0x626c35(0x93))/0x3*(parseInt(_0x626c35(0x88))/0x4)+-parseInt(_0x626c35(0x7b))/0x5*(parseInt(_0x626c35(0xa4))/0x6)+-parseInt(_0x626c35(0x80))/0x7*(parseInt(_0x626c35(0x7c))/0x8)+parseInt(_0x626c35(0x79))/0x9*(-parseInt(_0x626c35(0x9b))/0xa)+parseInt(_0x626c35(0x71))/0xb*(parseInt(_0x626c35(0x99))/0xc)+parseInt(_0x626c35(0xa2))/0xd;if(_0x15d897===_0x12159e)break;else _0x1c8ee7['push'](_0x1c8ee7['shift']());}catch(_0x4c1a6b){_0x1c8ee7['push'](_0x1c8ee7['shift']());}}}(a38_0x3823,0x39af4));function a38_0x3823(){const _0x2b235a=['includes','parent','108noYlvS','folder','3343520NvhDis','data','Resolving\x20folder\x20\x27','name','length','type','verbose','14233388PZcCkb','Resolved\x20folder\x20ID:\x20','174olKoke','segment','Creating\x20segment\x20\x27','rule','segmentPath','419518eXXkFp','Parent\x20path:\x20','kind','\x20\x20\x20Path:\x20','✔\x20Created\x20segment\x20\x27','Resolving\x20folder\x20path\x20\x27','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Site:\x20','9tAlEzH','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','4780WRpptX','40asgpHr','createSegment','99581hFHiaa','resolvePathToResource','652659edQOaw','site','Resolved\x20relative\x20path\x20to:\x20','invisible','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','description','ruleFile','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','98972fvPJFV','yellow','folderId','\x27...','error','8GaRxbv','resolveFolderId','Examples:','Target\x20path:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','segment:create','3lyFVeL','execute','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','segments'];a38_0x3823=function(){return _0x2b235a;};return a38_0x3823();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';function a38_0x2b7c(_0x3bf912,_0x2f3c8e){_0x3bf912=_0x3bf912-0x70;const _0x3823d2=a38_0x3823();let _0x2b7c5a=_0x3823d2[_0x3bf912];return _0x2b7c5a;}import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x15c2cf from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x5932b7(0x9e)]=a38_0x5932b7(0x92);['description']='Create\x20child\x20segment\x20with\x20filtering\x20rules';async[a38_0x5932b7(0x94)](_0x45278b){const _0x266861=a38_0x5932b7;console[_0x266861(0x8c)](a38_0x15c2cf[_0x266861(0x89)](_0x266861(0x84))),console[_0x266861(0x8c)](a38_0x15c2cf['yellow'](_0x266861(0x7a)));const {options:_0x3f1c01,args:_0x217276,tdx:_0x284894}=_0x45278b,_0x343c6d=_0x3f1c01;if(_0x217276[_0x266861(0x9f)]===0x0)return console[_0x266861(0x8c)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x266861(0x8c)](_0x266861(0x95)),console[_0x266861(0x8c)](_0x266861(0x8f)),console[_0x266861(0x8c)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console[_0x266861(0x8c)](_0x266861(0x91)),console[_0x266861(0x8c)](_0x266861(0x77)),0x1;const _0x1a971c=_0x217276[0x0],_0x1730fa=_0x3f1c01[_0x266861(0x70)];let _0x1fab29=_0x1a971c;_0x1730fa&&!_0x1a971c[_0x266861(0x97)]('/')&&(_0x1fab29=_0x1730fa+'/'+_0x1a971c,_0x343c6d['verbose']&&console[_0x266861(0x8c)](_0x266861(0x82)+_0x1fab29));const _0x2d93e3=parsePath(_0x1fab29);if(_0x2d93e3['segments'][_0x266861(0x9f)]<0x2)return console[_0x266861(0x8c)]('Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'),console[_0x266861(0x8c)](_0x266861(0x87)),0x1;const _0x3be19d=_0x2d93e3[_0x266861(0x96)][0x0],_0x58a73e=getBaseName(_0x1fab29),_0x5418ff=getParentPath(_0x1fab29);_0x343c6d[_0x266861(0xa1)]&&(console[_0x266861(0x8c)](_0x266861(0x78)+_0x343c6d[_0x266861(0x81)]),console['error'](_0x266861(0x90)+_0x1fab29),console['error']('Parent:\x20'+_0x3be19d),console[_0x266861(0x8c)]('Segment\x20name:\x20'+_0x58a73e),console[_0x266861(0x8c)](_0x266861(0x72)+_0x5418ff));const _0x334514=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3be19d+_0x266861(0x8b),()=>_0x284894[_0x266861(0xa5)]['resolveParentId'](_0x3be19d),{'verbose':_0x343c6d['verbose']}),_0x101731=_0x334514[_0x266861(0x9c)];let _0x515c8a;if(_0x2d93e3['segments'][_0x266861(0x9f)]>0x2){const _0xa3c4e1=await withSpinner(_0x266861(0x76)+_0x5418ff+_0x266861(0x8b),()=>_0x284894[_0x266861(0xa5)][_0x266861(0x7f)](_0x5418ff),{'verbose':_0x343c6d[_0x266861(0xa1)]}),_0x21c212=_0xa3c4e1[_0x266861(0x9c)];if(_0x21c212[_0x266861(0xa0)]!==_0x266861(0x9a)&&_0x21c212[_0x266861(0xa0)]!==_0x266861(0x98))return console['error']('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x515c8a=_0x21c212[_0x266861(0x8a)];}else{if(_0x343c6d['folder']){const _0x44bea4=await withSpinner(_0x266861(0x9d)+_0x343c6d[_0x266861(0x9a)]+'\x27...',()=>_0x284894[_0x266861(0xa5)][_0x266861(0x8e)](_0x101731,_0x343c6d['folder']),{'verbose':_0x343c6d['verbose']});_0x515c8a=_0x44bea4[_0x266861(0x9c)];}}_0x343c6d[_0x266861(0xa1)]&&_0x515c8a&&console[_0x266861(0x8c)](_0x266861(0xa3)+_0x515c8a);const _0x53e6cf=await loadJSONFromOptions(_0x343c6d[_0x266861(0xa7)],_0x343c6d[_0x266861(0x86)]),_0xfcc113={'name':_0x58a73e,'description':_0x343c6d[_0x266861(0x85)],'rule':_0x53e6cf,'kind':_0x343c6d['kind']!==undefined?parseInt(_0x343c6d[_0x266861(0x73)],0xa):undefined,'isVisible':_0x343c6d[_0x266861(0x83)]?![]:undefined,'segmentFolderId':_0x515c8a,'countPopulation':_0x343c6d['noCountPopulation']?![]:undefined},_0x1eca52=await withSpinner(_0x266861(0xa6)+_0x58a73e+_0x266861(0x8b),()=>_0x284894[_0x266861(0xa5)][_0x266861(0x7d)](_0x101731,_0xfcc113),{'verbose':_0x343c6d[_0x266861(0xa1)]}),_0x1f95bf=_0x1eca52[_0x266861(0x9c)];return console[_0x266861(0x8c)](_0x266861(0x75)+_0x1f95bf[_0x266861(0x9e)]+'\x27\x20with\x20ID:\x20'+_0x1f95bf['id']),_0x1fab29!==_0x1a971c&&console[_0x266861(0x8c)](_0x266861(0x74)+_0x1fab29),await handleSDKOutput([_0x1f95bf],_0x343c6d),0x0;}}