@treasuredata/tdx 2026.4.7 → 2026.4.8

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 (220) 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.js +1 -1
  168. package/dist/sdk/user.js +1 -1
  169. package/dist/sdk/util/format-detector.js +1 -1
  170. package/dist/sdk/util/formatters.js +1 -1
  171. package/dist/sdk/util/index.js +1 -1
  172. package/dist/sdk/util/paginate.js +1 -1
  173. package/dist/sdk/util/tree-formatter.js +1 -1
  174. package/dist/sdk/workflow/archive-validation.js +1 -1
  175. package/dist/sdk/workflow/clone-workflow.js +1 -1
  176. package/dist/sdk/workflow/index.js +1 -1
  177. package/dist/sdk/workflow/pull-workflow.js +1 -1
  178. package/dist/sdk/workflow/push-workflow.js +1 -1
  179. package/dist/sdk/workflow/tdx-config.js +1 -1
  180. package/dist/sdk/workflow/workflow-utils.js +1 -1
  181. package/dist/sdk/workspace/access-tracker.js +1 -1
  182. package/dist/sdk/workspace/frontmatter.js +1 -1
  183. package/dist/sdk/workspace/git.js +1 -1
  184. package/dist/sdk/workspace/index.js +1 -1
  185. package/dist/sdk/workspace/templates.js +1 -1
  186. package/dist/sdk/workspace/weekly.js +1 -1
  187. package/dist/sdk/workspace/wikilinks.js +1 -1
  188. package/dist/test-utils/command-runner.js +1 -1
  189. package/dist/test-utils/factories.js +1 -1
  190. package/dist/test-utils/fixtures.js +1 -1
  191. package/dist/test-utils/http-mock.js +1 -1
  192. package/dist/test-utils/index.js +1 -1
  193. package/dist/utils/async.js +1 -1
  194. package/dist/utils/colors.js +1 -1
  195. package/dist/utils/diff.js +1 -1
  196. package/dist/utils/file-permissions.js +1 -1
  197. package/dist/utils/file-reader.js +1 -1
  198. package/dist/utils/github-releases.js +1 -1
  199. package/dist/utils/global-cache.js +1 -1
  200. package/dist/utils/json-loader.js +1 -1
  201. package/dist/utils/local-cache.js +1 -1
  202. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  203. package/dist/utils/logger/formatters/index.js +1 -1
  204. package/dist/utils/logger/handlers/console-handler.js +1 -1
  205. package/dist/utils/logger/handlers/file-handler.js +1 -1
  206. package/dist/utils/logger/handlers/index.js +1 -1
  207. package/dist/utils/logger/handlers/null-handler.js +1 -1
  208. package/dist/utils/logger/index.js +1 -1
  209. package/dist/utils/logger/logger.js +1 -1
  210. package/dist/utils/logger/types.js +1 -1
  211. package/dist/utils/option-validation.js +1 -1
  212. package/dist/utils/process.js +1 -1
  213. package/dist/utils/prompt.js +1 -1
  214. package/dist/utils/spinner.js +1 -1
  215. package/dist/utils/sse-parser.js +1 -1
  216. package/dist/utils/string-utils.js +1 -1
  217. package/dist/utils/table-ref-parser.js +1 -1
  218. package/dist/utils/tdx-logger.js +1 -1
  219. package/dist/utils/version-check.js +1 -1
  220. package/package.json +1 -1
@@ -1 +1 @@
1
- const a32_0x29589c=a32_0xb2e3;(function(_0x10af77,_0x5b66d2){const _0x9d075c=a32_0xb2e3,_0x5ab9a3=_0x10af77();while(!![]){try{const _0x4277a2=parseInt(_0x9d075c(0xca))/0x1+-parseInt(_0x9d075c(0xd0))/0x2*(parseInt(_0x9d075c(0xc0))/0x3)+-parseInt(_0x9d075c(0xd2))/0x4*(-parseInt(_0x9d075c(0xd3))/0x5)+parseInt(_0x9d075c(0xdc))/0x6+-parseInt(_0x9d075c(0xd7))/0x7*(-parseInt(_0x9d075c(0xd1))/0x8)+parseInt(_0x9d075c(0xe4))/0x9+-parseInt(_0x9d075c(0xc5))/0xa;if(_0x4277a2===_0x5b66d2)break;else _0x5ab9a3['push'](_0x5ab9a3['shift']());}catch(_0x45e98b){_0x5ab9a3['push'](_0x5ab9a3['shift']());}}}(a32_0x44c6,0xb2123));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x496f08 from'chalk';function a32_0xb2e3(_0x177a82,_0x402b29){_0x177a82=_0x177a82-0xb2;const _0x44c611=a32_0x44c6();let _0xb2e3c7=_0x44c611[_0x177a82];return _0xb2e3c7;}export class PolicyCommand extends BaseCommand{[a32_0x29589c(0xcc)]=a32_0x29589c(0xe2);['description']='Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions';async[a32_0x29589c(0xdb)](_0x1e2bcf){const _0x1c82b9=a32_0x29589c,{options:_0x2fe33e,tdx:_0x4fe3a6}=_0x1e2bcf,_0x48c2a0=await withSpinner(_0x1c82b9(0xed),async()=>{const _0x24abf6=_0x1c82b9,[_0x1090b5,_0x1f7854]=await Promise[_0x24abf6(0xc2)]([_0x4fe3a6[_0x24abf6(0xbc)][_0x24abf6(0xe5)](),_0x4fe3a6[_0x24abf6(0xe2)][_0x24abf6(0xb3)]()]);return{'userInfo':_0x1090b5,'permissions':_0x1f7854};},{'verbose':_0x2fe33e[_0x1c82b9(0xe0)]}),{userInfo:_0xb46241,permissions:_0x49d9d6}=_0x48c2a0['data'];if(isStructuredFormat(_0x2fe33e))return await handleSingleObjectOutput(_0x49d9d6,_0x2fe33e),0x0;const _0xf33b90=_0xb46241[_0x1c82b9(0xb4)]?_0x1c82b9(0xe1):_0xb46241[_0x1c82b9(0xba)]?_0x1c82b9(0xde):_0x1c82b9(0xc7);console[_0x1c82b9(0xb2)]('\x0a'+a32_0x496f08[_0x1c82b9(0xe6)]('👤')+'\x20'+a32_0x496f08[_0x1c82b9(0xe6)](_0xb46241[_0x1c82b9(0xcc)])+'\x20'+a32_0x496f08['dim']('('+_0xb46241[_0x1c82b9(0xd8)]+')')+_0x1c82b9(0xd5)+_0xf33b90),console[_0x1c82b9(0xb2)](a32_0x496f08['dim']('\x20\x20\x20'+_0x4fe3a6['context'][_0x1c82b9(0xcf)]+':'+_0xb46241[_0x1c82b9(0xc4)]+_0x1c82b9(0xcb)+_0xb46241['id']));const _0x3ceea8=_0x49d9d6[_0x1c82b9(0xbb)];console[_0x1c82b9(0xb2)]('\x0a'+a32_0x496f08['bold']('📋\x20Assigned\x20Policies')+'\x20('+_0x3ceea8['length']+'):');if(_0x3ceea8[_0x1c82b9(0xd4)]===0x0)console[_0x1c82b9(0xb2)](a32_0x496f08['dim'](_0x1c82b9(0xea)));else for(const _0x12e68d of _0x3ceea8){console['log'](_0x1c82b9(0xbf)+_0x12e68d[_0x1c82b9(0xcc)]);}return printPermissionsMap(_0x49d9d6['permissions']),console[_0x1c82b9(0xb2)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x29589c(0xcc)]='policy\x20list';['description']=a32_0x29589c(0xb7);async[a32_0x29589c(0xdb)](_0x165f84){const _0x4fe195=a32_0x29589c,{options:_0x2ce489,tdx:_0x36159e}=_0x165f84,_0x74dde1=await withSpinner(_0x4fe195(0xc3),()=>_0x36159e[_0x4fe195(0xe2)]['listPolicies'](),{'verbose':_0x2ce489[_0x4fe195(0xe0)]}),_0x5b910a=_0x74dde1['data'];console[_0x4fe195(0xb5)](_0x4fe195(0xdf)+_0x5b910a[_0x4fe195(0xd4)]+'\x20polic'+(_0x5b910a['length']!==0x1?_0x4fe195(0xdd):'y'));if(isStructuredFormat(_0x2ce489))return await handleSDKOutput(_0x5b910a,_0x2ce489),0x0;if(_0x5b910a[_0x4fe195(0xd4)]===0x0)console['log'](a32_0x496f08['dim']('No\x20policies\x20found'));else for(const _0x22c22f of _0x5b910a){const _0x38519b=_0x22c22f[_0x4fe195(0xc1)]?a32_0x496f08[_0x4fe195(0xc9)]('\x20—\x20'+_0x22c22f[_0x4fe195(0xc1)]):'';console[_0x4fe195(0xb2)](_0x4fe195(0xbf)+_0x22c22f[_0x4fe195(0xcc)]+_0x38519b);}return 0x0;}}function a32_0x44c6(){const _0x18fc1e=['description','all','Listing\x20policies...','account_id','19076320AhYghP','getPolicyUsers','Member','data','dim','353515DIlCsp',',\x20user_id:','name','validate','operation','site','11138vFYoMJ','752trkkmP','2116828cdaboJ','5qinKnm','length','\x20—\x20','getPolicy','98721pDBGgT','email','👥\x20Assigned\x20Users','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','execute','2161782IIisna','ies','Administrator','✔\x20Found\x20','verbose','Account\x20Owner','policy','args','7581609xvwIsx','getCurrent','bold','policy\x20show','max','permissions','\x20\x20No\x20policies\x20assigned','map','\x20\x20No\x20permissions','Fetching\x20permissions...','log','getMyPermissions','account_owner','error','getPolicyPermissions','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','\x20user','🔑\x20Effective\x20Permissions','administrator','policies','user','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','\x20\x20\x20','\x20\x20•\x20','417czIsMR'];a32_0x44c6=function(){return _0x18fc1e;};return a32_0x44c6();}export class PolicyShowCommand extends BaseCommand{[a32_0x29589c(0xcc)]=a32_0x29589c(0xe7);['description']=a32_0x29589c(0xda);[a32_0x29589c(0xcd)](_0x4afe28){const _0x3298dc=a32_0x29589c;if(_0x4afe28[_0x3298dc(0xe3)][_0x3298dc(0xd4)]===0x0)return _0x3298dc(0xbd);return undefined;}async[a32_0x29589c(0xdb)](_0x1ad425){const _0x45d369=a32_0x29589c,{options:_0x1efca2,tdx:_0xfa177d}=_0x1ad425,_0xbfab6d=_0x1ad425[_0x45d369(0xe3)][0x0],_0x46966b=await withSpinner('Fetching\x20policy...',async()=>{const _0x440744=_0x45d369,_0x331eba=await _0xfa177d['policy'][_0x440744(0xd6)](_0xbfab6d),[_0x3cd999,_0x28a66d]=await Promise[_0x440744(0xc2)]([_0xfa177d[_0x440744(0xe2)][_0x440744(0xb6)](_0x331eba['id']),_0xfa177d[_0x440744(0xe2)][_0x440744(0xc6)](_0x331eba['id'])]);return{'policy':_0x331eba,'perms':_0x3cd999,'users':_0x28a66d};},{'verbose':_0x1efca2[_0x45d369(0xe0)]}),{policy:_0x5ed095,perms:_0xb77d42,users:_0x4ec34d}=_0x46966b[_0x45d369(0xc8)];if(isStructuredFormat(_0x1efca2))return await handleSingleObjectOutput({..._0x5ed095,'permissions':_0xb77d42['permissions'],'users':_0x4ec34d},_0x1efca2),0x0;console[_0x45d369(0xb2)]('\x0a'+a32_0x496f08[_0x45d369(0xe6)]('📋')+'\x20'+a32_0x496f08[_0x45d369(0xe6)](_0x5ed095[_0x45d369(0xcc)])+'\x20'+a32_0x496f08[_0x45d369(0xc9)]('(ID:\x20'+_0x5ed095['id']+')'));_0x5ed095[_0x45d369(0xc1)]&&console[_0x45d369(0xb2)](_0x45d369(0xbe)+a32_0x496f08[_0x45d369(0xc9)](_0x5ed095['description']));console['log'](_0x45d369(0xbe)+_0x4ec34d['length']+_0x45d369(0xb8)+(_0x4ec34d[_0x45d369(0xd4)]!==0x1?'s':'')+'\x20assigned'),printPermissionsMap(_0xb77d42[_0x45d369(0xe9)]);if(_0x4ec34d[_0x45d369(0xd4)]>0x0){console[_0x45d369(0xb2)]('\x0a'+a32_0x496f08[_0x45d369(0xe6)](_0x45d369(0xd9))+':');for(const _0x15ed21 of _0x4ec34d){const _0x62e281=_0x15ed21[_0x45d369(0xd8)]&&_0x15ed21[_0x45d369(0xd8)]!==_0x15ed21[_0x45d369(0xcc)]?a32_0x496f08[_0x45d369(0xc9)]('\x20<'+_0x15ed21['email']+'>'):'';console[_0x45d369(0xb2)]('\x20\x20•\x20'+_0x15ed21[_0x45d369(0xcc)]+_0x62e281);}}return console[_0x45d369(0xb2)](),0x0;}}function printPermissionsMap(_0x376c55){const _0x14ccba=a32_0x29589c,_0x7292cb=Object['entries'](_0x376c55);console[_0x14ccba(0xb2)]('\x0a'+a32_0x496f08['bold'](_0x14ccba(0xb9))+':');if(_0x7292cb[_0x14ccba(0xd4)]===0x0){console[_0x14ccba(0xb2)](a32_0x496f08[_0x14ccba(0xc9)](_0x14ccba(0xec)));return;}const _0xf74840=Math[_0x14ccba(0xe8)](..._0x7292cb[_0x14ccba(0xeb)](([_0x4aa462])=>_0x4aa462['length']));for(const [_0x3bb596,_0x534d5f]of _0x7292cb){const _0x509eff=formatOperations(_0x534d5f);console[_0x14ccba(0xb2)]('\x20\x20'+_0x3bb596['padEnd'](_0xf74840+0x2)+_0x509eff);}}function formatOperations(_0x38a34e){const _0x47d2ce=a32_0x29589c,_0x540598=[...new Set(_0x38a34e[_0x47d2ce(0xeb)](_0x14e8b4=>_0x14e8b4[_0x47d2ce(0xce)]))];return _0x540598['join'](',\x20');}
1
+ const a32_0x25a045=a32_0x26e9;(function(_0x2e039b,_0x52f9fc){const _0x34686e=a32_0x26e9,_0x13e92b=_0x2e039b();while(!![]){try{const _0x4c342b=-parseInt(_0x34686e(0xd5))/0x1*(-parseInt(_0x34686e(0xcb))/0x2)+-parseInt(_0x34686e(0xfb))/0x3*(-parseInt(_0x34686e(0xf8))/0x4)+-parseInt(_0x34686e(0xec))/0x5*(parseInt(_0x34686e(0xea))/0x6)+parseInt(_0x34686e(0xfc))/0x7+-parseInt(_0x34686e(0xd9))/0x8+-parseInt(_0x34686e(0xdb))/0x9*(parseInt(_0x34686e(0xd7))/0xa)+parseInt(_0x34686e(0xda))/0xb*(-parseInt(_0x34686e(0xce))/0xc);if(_0x4c342b===_0x52f9fc)break;else _0x13e92b['push'](_0x13e92b['shift']());}catch(_0x25101a){_0x13e92b['push'](_0x13e92b['shift']());}}}(a32_0x589b,0xe73bb));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x6a2561 from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x25a045(0x104)]=a32_0x25a045(0xe2);[a32_0x25a045(0xe1)]=a32_0x25a045(0xd2);async[a32_0x25a045(0xd3)](_0x546c00){const _0x2bd2f9=a32_0x25a045,{options:_0x1cbadd,tdx:_0x555e28}=_0x546c00,_0x37269c=await withSpinner('Fetching\x20permissions...',async()=>{const _0x7afee6=a32_0x26e9,[_0x7c76ef,_0x508f01]=await Promise['all']([_0x555e28[_0x7afee6(0xe8)][_0x7afee6(0xdf)](),_0x555e28[_0x7afee6(0xe2)][_0x7afee6(0xe3)]()]);return{'userInfo':_0x7c76ef,'permissions':_0x508f01};},{'verbose':_0x1cbadd[_0x2bd2f9(0xc5)]}),{userInfo:_0x5831de,permissions:_0xe3a54a}=_0x37269c[_0x2bd2f9(0x103)];if(isStructuredFormat(_0x1cbadd))return await handleSingleObjectOutput(_0xe3a54a,_0x1cbadd),0x0;const _0x222a12=_0x5831de[_0x2bd2f9(0xe5)]?_0x2bd2f9(0xf0):_0x5831de[_0x2bd2f9(0xdd)]?'Administrator':_0x2bd2f9(0xfe);console[_0x2bd2f9(0xf1)]('\x0a'+a32_0x6a2561[_0x2bd2f9(0xee)]('👤')+'\x20'+a32_0x6a2561['bold'](_0x5831de[_0x2bd2f9(0x104)])+'\x20'+a32_0x6a2561[_0x2bd2f9(0xf6)]('('+_0x5831de[_0x2bd2f9(0xed)]+')')+_0x2bd2f9(0xc9)+_0x222a12),console['log'](a32_0x6a2561[_0x2bd2f9(0xf6)](_0x2bd2f9(0xf4)+_0x555e28[_0x2bd2f9(0xcd)][_0x2bd2f9(0xe7)]+':'+_0x5831de[_0x2bd2f9(0xff)]+',\x20user_id:'+_0x5831de['id']));const _0x4e2e55=_0xe3a54a[_0x2bd2f9(0x102)];console[_0x2bd2f9(0xf1)]('\x0a'+a32_0x6a2561[_0x2bd2f9(0xee)](_0x2bd2f9(0x100))+'\x20('+_0x4e2e55[_0x2bd2f9(0xfa)]+'):');if(_0x4e2e55[_0x2bd2f9(0xfa)]===0x0)console[_0x2bd2f9(0xf1)](a32_0x6a2561[_0x2bd2f9(0xf6)](_0x2bd2f9(0xd8)));else for(const _0x2daa0d of _0x4e2e55){console[_0x2bd2f9(0xf1)](_0x2bd2f9(0xc7)+_0x2daa0d[_0x2bd2f9(0x104)]);}return printPermissionsMap(_0xe3a54a[_0x2bd2f9(0xcc)]),console[_0x2bd2f9(0xf1)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x25a045(0x104)]='policy\x20list';[a32_0x25a045(0xe1)]=a32_0x25a045(0xd6);async[a32_0x25a045(0xd3)](_0x40ba37){const _0x48363c=a32_0x25a045,{options:_0x44d846,tdx:_0x1b1fd2}=_0x40ba37,_0x352885=await withSpinner(_0x48363c(0xef),()=>_0x1b1fd2[_0x48363c(0xe2)][_0x48363c(0xca)](),{'verbose':_0x44d846['verbose']}),_0x14e90e=_0x352885['data'];console[_0x48363c(0xde)](_0x48363c(0xd0)+_0x14e90e['length']+_0x48363c(0xf5)+(_0x14e90e['length']!==0x1?_0x48363c(0xe4):'y'));if(isStructuredFormat(_0x44d846))return await handleSDKOutput(_0x14e90e,_0x44d846),0x0;if(_0x14e90e[_0x48363c(0xfa)]===0x0)console[_0x48363c(0xf1)](a32_0x6a2561[_0x48363c(0xf6)]('No\x20policies\x20found'));else for(const _0xd51659 of _0x14e90e){const _0x383dfc=_0xd51659[_0x48363c(0xe1)]?a32_0x6a2561['dim'](_0x48363c(0xc9)+_0xd51659[_0x48363c(0xe1)]):'';console[_0x48363c(0xf1)](_0x48363c(0xc7)+_0xd51659[_0x48363c(0x104)]+_0x383dfc);}return 0x0;}}function a32_0x26e9(_0xb2c187,_0x51f545){_0xb2c187=_0xb2c187-0xc5;const _0x589b35=a32_0x589b();let _0x26e9d0=_0x589b35[_0xb2c187];return _0x26e9d0;}export class PolicyShowCommand extends BaseCommand{[a32_0x25a045(0x104)]=a32_0x25a045(0xf9);['description']=a32_0x25a045(0xdc);[a32_0x25a045(0xe0)](_0x266155){const _0x3133ed=a32_0x25a045;if(_0x266155[_0x3133ed(0xeb)][_0x3133ed(0xfa)]===0x0)return _0x3133ed(0xf2);return undefined;}async[a32_0x25a045(0xd3)](_0x4df003){const _0x3d7d3e=a32_0x25a045,{options:_0x1fe82a,tdx:_0x36e37e}=_0x4df003,_0x45f373=_0x4df003['args'][0x0],_0x5b0eee=await withSpinner('Fetching\x20policy...',async()=>{const _0x42eae7=a32_0x26e9,_0x407d93=await _0x36e37e['policy'][_0x42eae7(0xfd)](_0x45f373),[_0x3de9fe,_0x4ce7ff]=await Promise[_0x42eae7(0xcf)]([_0x36e37e[_0x42eae7(0xe2)]['getPolicyPermissions'](_0x407d93['id']),_0x36e37e['policy']['getPolicyUsers'](_0x407d93['id'])]);return{'policy':_0x407d93,'perms':_0x3de9fe,'users':_0x4ce7ff};},{'verbose':_0x1fe82a[_0x3d7d3e(0xc5)]}),{policy:_0x940d78,perms:_0x58bb66,users:_0x1db3df}=_0x5b0eee[_0x3d7d3e(0x103)];if(isStructuredFormat(_0x1fe82a))return await handleSingleObjectOutput({..._0x940d78,'permissions':_0x58bb66[_0x3d7d3e(0xcc)],'users':_0x1db3df},_0x1fe82a),0x0;console['log']('\x0a'+a32_0x6a2561['bold']('📋')+'\x20'+a32_0x6a2561[_0x3d7d3e(0xee)](_0x940d78['name'])+'\x20'+a32_0x6a2561[_0x3d7d3e(0xf6)]('(ID:\x20'+_0x940d78['id']+')'));_0x940d78['description']&&console['log'](_0x3d7d3e(0xf4)+a32_0x6a2561[_0x3d7d3e(0xf6)](_0x940d78[_0x3d7d3e(0xe1)]));console['log']('\x20\x20\x20'+_0x1db3df[_0x3d7d3e(0xfa)]+_0x3d7d3e(0xc6)+(_0x1db3df[_0x3d7d3e(0xfa)]!==0x1?'s':'')+'\x20assigned'),printPermissionsMap(_0x58bb66[_0x3d7d3e(0xcc)]);if(_0x1db3df[_0x3d7d3e(0xfa)]>0x0){console[_0x3d7d3e(0xf1)]('\x0a'+a32_0x6a2561['bold'](_0x3d7d3e(0xd1))+':');for(const _0x3feda1 of _0x1db3df){const _0x36dac9=_0x3feda1['email']&&_0x3feda1[_0x3d7d3e(0xed)]!==_0x3feda1[_0x3d7d3e(0x104)]?a32_0x6a2561['dim']('\x20<'+_0x3feda1[_0x3d7d3e(0xed)]+'>'):'';console[_0x3d7d3e(0xf1)](_0x3d7d3e(0xc7)+_0x3feda1[_0x3d7d3e(0x104)]+_0x36dac9);}}return console[_0x3d7d3e(0xf1)](),0x0;}}function printPermissionsMap(_0x11496c){const _0x3339a7=a32_0x25a045,_0x472b76=Object[_0x3339a7(0x101)](_0x11496c);console[_0x3339a7(0xf1)]('\x0a'+a32_0x6a2561[_0x3339a7(0xee)](_0x3339a7(0xc8))+':');if(_0x472b76['length']===0x0){console[_0x3339a7(0xf1)](a32_0x6a2561[_0x3339a7(0xf6)](_0x3339a7(0xf7)));return;}const _0xa1a76f=Math[_0x3339a7(0xe9)](..._0x472b76[_0x3339a7(0xd4)](([_0x45ca19])=>_0x45ca19['length']));for(const [_0x46197d,_0x25042f]of _0x472b76){const _0x4da75f=formatOperations(_0x25042f);console['log']('\x20\x20'+_0x46197d[_0x3339a7(0xf3)](_0xa1a76f+0x2)+_0x4da75f);}}function a32_0x589b(){const _0x38a64d=['5406436gmJWmb','getPolicy','Member','account_id','📋\x20Assigned\x20Policies','entries','policies','data','name','verbose','\x20user','\x20\x20•\x20','🔑\x20Effective\x20Permissions','\x20—\x20','listPolicies','20uQCmct','permissions','context','2892jjuwgX','all','✔\x20Found\x20','👥\x20Assigned\x20Users','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','execute','map','95713tIyoqa','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','370CWRIWO','\x20\x20No\x20policies\x20assigned','3866568eyOotW','62282MMSDDa','27666XWnhRV','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','administrator','error','getCurrent','validate','description','policy','getMyPermissions','ies','account_owner','join','site','user','max','85710LjTAcm','args','230OvhJIJ','email','bold','Listing\x20policies...','Account\x20Owner','log','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','padEnd','\x20\x20\x20','\x20polic','dim','\x20\x20No\x20permissions','8EnkdFc','policy\x20show','length','2754546fFsqpw'];a32_0x589b=function(){return _0x38a64d;};return a32_0x589b();}function formatOperations(_0x5a8b83){const _0x42cb31=a32_0x25a045,_0x2e8eb1=[...new Set(_0x5a8b83['map'](_0x39e1d4=>_0x39e1d4['operation']))];return _0x2e8eb1[_0x42cb31(0xe6)](',\x20');}
@@ -1 +1 @@
1
- const a33_0x4cac49=a33_0x476c;(function(_0xd71750,_0x445135){const _0x59b8c7=a33_0x476c,_0x4b2e35=_0xd71750();while(!![]){try{const _0x2efd58=parseInt(_0x59b8c7(0xd6))/0x1*(-parseInt(_0x59b8c7(0x6a))/0x2)+-parseInt(_0x59b8c7(0x9a))/0x3+-parseInt(_0x59b8c7(0xb8))/0x4+parseInt(_0x59b8c7(0x9e))/0x5+-parseInt(_0x59b8c7(0x9d))/0x6*(parseInt(_0x59b8c7(0xce))/0x7)+-parseInt(_0x59b8c7(0x85))/0x8*(-parseInt(_0x59b8c7(0xb9))/0x9)+parseInt(_0x59b8c7(0xcc))/0xa*(parseInt(_0x59b8c7(0xa8))/0xb);if(_0x2efd58===_0x445135)break;else _0x4b2e35['push'](_0x4b2e35['shift']());}catch(_0x51f4fb){_0x4b2e35['push'](_0x4b2e35['shift']());}}}(a33_0x4886,0x4f445));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_0x1d6ee6 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';function a33_0x4886(){const _0x3d6247=['create','28dViCkw','all','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','tdx:\x20profile\x20delete','Enter\x20profile\x20name:','red','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','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>','124810qwztsd','confirm','(session:\x20','4SLYeAr','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x27\x20created','status','password','Profile\x20\x27','/app/mp/ak','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','✗\x20Validation\x20failed:\x20','\x20API\x20key\x20is\x20valid\x20(User:\x20','Set\x20a\x20profile\x20configuration\x20value','\x0aOperation\x20cancelled','\x27\x20requires\x20API\x20key\x20validation.','message','split','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Failed\x20to\x20delete\x20profile:\x20','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','profileName','\x20\x20(no\x20profiles\x20found)','dim','email','Unknown\x20key\x20\x27','Changing\x20site\x20to\x20\x27','Removal\x20cancelled','log','warn','24QFJqTY','\x20--default\x27\x20to\x20save\x20permanently','llm_agent','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','validate','\x20\x20tdx\x20--profile\x20','getUserInfo','(cleared)','join','\x0aAvailable\x20profiles:','tdx:\x20profile\x20create','trim','length','VALID_KEYS','Enter\x20your\x20TD\x20API\x20key:','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x20\x20-\x20','tdx:\x20profile\x20set','database','text','API\x20key\x20cannot\x20be\x20empty','239166KzyrtV','error','apiKey','718206AVAwBW','1350680fsoGom','You\x20can\x20find\x20your\x20API\x20key\x20at:','profile:create','Setup\x20cancelled','includes','\x0aSaved\x20to:\x20','\x27\x20updated:\x20','\x27\x20does\x20not\x20exist.','session','logLevel','11ZhqMjA','profile','Validating\x20API\x20key...','jobs','Session\x20profile\x20set\x20to:\x20','force','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Default\x20profile\x20set\x20to:\x20','Enter\x20description\x20(optional):','skipExistsCheck','bold','\x20Profile\x20\x27','\x0aSetup\x20cancelled','\x20API\x20key\x20saved\x20to\x20system\x20keychain','profile:delete','ERROR','2187168UkejhV','1037871pnZMtv','site','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','llm_project','config','green','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Removed\x20existing\x20profile\x20\x27','description','name','Create\x20a\x20new\x20profile','execute','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','\x27.\x0a\x0aValid\x20keys:\x20','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','Delete\x20a\x20profile','yellow','10635220qsJbWf'];a33_0x4886=function(){return _0x3d6247;};return a33_0x4886();}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_0x1edb46 from'prompts';import a33_0x560f4b from'chalk';function validateProfileName(_0x208ca8,_0x486684){const _0x55d08f=a33_0x476c;if(!_0x208ca8||!_0x208ca8[_0x55d08f(0x90)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x421767=_0x208ca8[_0x55d08f(0x90)]();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x421767))return _0x55d08f(0xd0);if(!_0x486684?.[_0x55d08f(0xb1)]&&profileExists(_0x421767))return _0x55d08f(0x6f)+_0x421767+_0x55d08f(0x7b)+_0x421767+_0x55d08f(0x88);return!![];}function a33_0x476c(_0x400c50,_0x235c62){_0x400c50=_0x400c50-0x68;const _0x48869e=a33_0x4886();let _0x476cdf=_0x48869e[_0x400c50];return _0x476cdf;}async function deleteProfileAndCredentials(_0x384b60){const _0x3edbe2=a33_0x476c;removeProfileFromUserConfig(_0x384b60);const _0x2b2418=await isKeychainAvailable();_0x2b2418&&await Promise[_0x3edbe2(0xcf)]([deleteKeychainAPIKey(_0x384b60),deleteOAuthTokens(_0x384b60)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x4cac49(0xc3)]=a33_0x4cac49(0xa0);[a33_0x4cac49(0xc2)]=a33_0x4cac49(0xc4);async[a33_0x4cac49(0xc5)](_0x4a17f1){const _0x396665=a33_0x4cac49,{options:_0x3857f4,args:_0x157b23}=_0x4a17f1,_0xb8cb34=!!_0x3857f4[_0x396665(0xad)];console[_0x396665(0x83)](a33_0x560f4b['bold'](_0x396665(0x8f)));let _0x3f2090;if(_0x157b23[_0x396665(0x91)]>0x0&&_0x157b23[0x0]){const _0x759a3c=_0x157b23[0x0]['trim']();_0xb8cb34&&profileExists(_0x759a3c)&&(await deleteProfileAndCredentials(_0x759a3c),console[_0x396665(0x83)]('Removed\x20existing\x20profile\x20\x27'+_0x759a3c+'\x27'));const _0x1f396a=validateProfileName(_0x759a3c);if(_0x1f396a!==!![])return console[_0x396665(0x9b)](a33_0x560f4b[_0x396665(0xd3)](_0x1f396a)),0x1;_0x3f2090=_0x759a3c;}else{const _0x75496e=await a33_0x1edb46({'type':_0x396665(0x98),'name':_0x396665(0x7c),'message':_0x396665(0xd2),'validate':_0x3f6cc1=>validateProfileName(_0x3f6cc1,{'skipExistsCheck':_0xb8cb34})});if(!_0x75496e[_0x396665(0x7c)])return console[_0x396665(0x83)](_0x396665(0xb4)),0x1;_0x3f2090=_0x75496e['profileName'][_0x396665(0x90)](),_0xb8cb34&&profileExists(_0x3f2090)&&(await deleteProfileAndCredentials(_0x3f2090),console[_0x396665(0x83)](_0x396665(0xc1)+_0x3f2090+'\x27'));}const _0x3d5bae=await a33_0x1edb46({'type':'text','name':_0x396665(0xc2),'message':_0x396665(0xb0)}),_0x4798a9=_0x3d5bae['description']?.['trim']()||undefined,_0x1046a3=_0x3857f4[_0x396665(0xba)]||'us01',_0x1c89f6=await promptSiteSelection(_0x1046a3,_0x3f2090,_0x396665(0xa1));if(!_0x1c89f6)return 0x1;const _0xe80ce1=resolveSite(_0x1c89f6),_0xa9069e=await promptAuthMethod();if(!_0xa9069e)return console[_0x396665(0x83)](_0x396665(0xb4)),0x1;if(_0xa9069e==='oauth'){if(_0x4798a9){const _0xa9efd2={'site':_0xe80ce1,'description':_0x4798a9};saveProfileToUserConfig(_0x3f2090,_0xa9efd2);}const {accountName:_0x3260bf}=_0x3857f4;return await runOAuthLoginFlow(_0xe80ce1,_0x3f2090,_0x3857f4['logLevel']??LogLevel[_0x396665(0xb7)],{'accountName':_0x3260bf}),0x0;}console[_0x396665(0x83)](_0x396665(0xc6)+_0xe80ce1),console[_0x396665(0x83)](_0x396665(0x9f)),console[_0x396665(0x83)]('\x20\x20'+getConsoleUrl(_0xe80ce1,'/app/mp/ak'));const _0x4c8000=await a33_0x1edb46({'type':_0x396665(0x6e),'name':_0x396665(0x9c),'message':_0x396665(0x93),'validate':_0x294bd2=>{const _0x3968ef=_0x396665;if(!_0x294bd2||!_0x294bd2[_0x3968ef(0x90)]())return _0x3968ef(0x99);return!![];}});if(!_0x4c8000[_0x396665(0x9c)])return console[_0x396665(0x83)](_0x396665(0xb4)),0x1;const _0x227b0e=_0x4c8000[_0x396665(0x9c)];console[_0x396665(0x83)](_0x396665(0xaa));try{const _0xfdd7f7=TDX['create']({'site':_0xe80ce1,'apiKey':_0x227b0e[_0x396665(0x90)](),'logLevel':_0x3857f4[_0x396665(0xa7)]??LogLevel['ERROR']}),_0x4f41d7=await _0xfdd7f7[_0x396665(0xab)][_0x396665(0x8b)]();console['log'](a33_0x560f4b[_0x396665(0xbf)]('✓')+_0x396665(0x73)+_0x4f41d7['email']+')');const _0x317ee1=await isKeychainAvailable();_0x317ee1?(await saveAPIKeyAsync(_0x227b0e[_0x396665(0x90)](),_0xe80ce1,_0x3f2090),console[_0x396665(0x83)](a33_0x560f4b[_0x396665(0xbf)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x3f2090+')')):(console['warn'](a33_0x560f4b[_0x396665(0xcb)](_0x396665(0x71))),console[_0x396665(0x84)](a33_0x560f4b['yellow'](_0x396665(0xbc))));const _0x5f35fa={'site':_0xe80ce1,..._0x4798a9&&{'description':_0x4798a9}};return saveProfileToUserConfig(_0x3f2090,_0x5f35fa),console[_0x396665(0x83)](a33_0x560f4b['green']('✓')+_0x396665(0xb3)+_0x3f2090+_0x396665(0x6c)),console[_0x396665(0x83)](),console[_0x396665(0x83)](_0x396665(0xc9)),console[_0x396665(0x83)](_0x396665(0x8a)+_0x3f2090+_0x396665(0xae)),console[_0x396665(0x83)](_0x396665(0x8a)+_0x3f2090+_0x396665(0xc0)),0x0;}catch(_0x2e3c0d){if(_0x2e3c0d instanceof HTTPClientError&&_0x2e3c0d[_0x396665(0x6d)]===0x191)return printAuthError(_0x2e3c0d),0x1;return console[_0x396665(0x9b)](a33_0x560f4b[_0x396665(0xd3)](_0x396665(0x72)+(_0x2e3c0d instanceof Error?_0x2e3c0d[_0x396665(0x77)]:String(_0x2e3c0d)))),console['error'](_0x396665(0x79)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x4cac49(0xc3)]=a33_0x4cac49(0xb6);[a33_0x4cac49(0xc2)]=a33_0x4cac49(0xca);['validate'](_0x1a5486){const _0x2046eb=a33_0x4cac49,{args:_0x37654b}=_0x1a5486;if(_0x37654b[_0x2046eb(0x91)]===0x0)return _0x2046eb(0xd4);return undefined;}async[a33_0x4cac49(0xc5)](_0x97604e){const _0x1b3d99=a33_0x4cac49,{args:_0x80a663}=_0x97604e,_0x365c27=_0x80a663[0x0];console['log'](a33_0x560f4b[_0x1b3d99(0xb2)](_0x1b3d99(0xd1)));if(!profileExists(_0x365c27)){console[_0x1b3d99(0x9b)](a33_0x560f4b[_0x1b3d99(0xd3)](_0x1b3d99(0x6f)+_0x365c27+_0x1b3d99(0xa5))),console['log'](_0x1b3d99(0x8e));const _0x1245ca=listProfiles();if(_0x1245ca[_0x1b3d99(0x91)]===0x0)console[_0x1b3d99(0x83)](_0x1b3d99(0x7d));else for(const _0x373d44 of _0x1245ca){console['log'](_0x1b3d99(0x95)+_0x373d44[_0x1b3d99(0xc3)]);}return 0x1;}const _0x5f3a56=await a33_0x1edb46({'type':'confirm','name':_0x1b3d99(0x68),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x365c27+'\x27?','initial':![]});if(!_0x5f3a56[_0x1b3d99(0x68)])return console[_0x1b3d99(0x83)](_0x1b3d99(0x82)),0x0;try{await deleteProfileAndCredentials(_0x365c27),console['log'](a33_0x560f4b[_0x1b3d99(0xbf)]('✓')+_0x1b3d99(0xb3)+_0x365c27+'\x27\x20deleted');}catch(_0x577572){return console['error'](a33_0x560f4b['red'](_0x1b3d99(0x7a)+(_0x577572 instanceof Error?_0x577572[_0x1b3d99(0x77)]:String(_0x577572)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0x4cac49(0xc3)]='profile:set';['description']=a33_0x4cac49(0x74);static ['VALID_KEYS']=[a33_0x4cac49(0xba),a33_0x4cac49(0x97),'parent_segment',a33_0x4cac49(0xbd),a33_0x4cac49(0x87),'description'];[a33_0x4cac49(0x89)](_0x323e7c){const _0x5081bc=a33_0x4cac49,{args:_0xfcc4f8,options:_0x391409}=_0x323e7c,_0x5158f8=_0x391409[_0x5081bc(0xa9)]||getActiveProfile();if(!_0x5158f8)return _0x5081bc(0xd5);if(_0xfcc4f8['length']===0x0)return _0x5081bc(0xc8)+ProfileSetCommand[_0x5081bc(0x92)][_0x5081bc(0x8d)](',\x20');const _0x39afdd=_0xfcc4f8[0x0];if(!_0x39afdd[_0x5081bc(0xa2)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x5081bc(0x92)][_0x5081bc(0x8d)](',\x20');const [_0x452cb9]=_0x39afdd[_0x5081bc(0x78)]('=',0x2);if(!ProfileSetCommand[_0x5081bc(0x92)][_0x5081bc(0xa2)](_0x452cb9))return _0x5081bc(0x80)+_0x452cb9+_0x5081bc(0xc7)+ProfileSetCommand[_0x5081bc(0x92)][_0x5081bc(0x8d)](',\x20');return undefined;}async[a33_0x4cac49(0xc5)](_0x918f8c){const _0x32083e=a33_0x4cac49,{args:_0x4e79a9,options:_0x55a617}=_0x918f8c,_0x2dc2ba=_0x55a617[_0x32083e(0xa9)]||getActiveProfile(),[_0xe13788,..._0x110e0d]=_0x4e79a9[0x0][_0x32083e(0x78)]('='),_0x4029e8=_0x110e0d[_0x32083e(0x8d)]('=');console[_0x32083e(0x83)](a33_0x560f4b[_0x32083e(0xb2)](_0x32083e(0x96)));if(!profileExists(_0x2dc2ba)){const _0x267ee6=await a33_0x1edb46({'type':'confirm','name':_0x32083e(0xcd),'message':_0x32083e(0x6f)+_0x2dc2ba+_0x32083e(0xbb),'initial':!![]});if(!_0x267ee6[_0x32083e(0xcd)])return console[_0x32083e(0x83)]('Operation\x20cancelled'),0x1;}const _0x43a14f=loadProfile(_0x2dc2ba),_0x15e881=_0x43a14f?.[_0x32083e(0xbe)]||{};if(_0xe13788===_0x32083e(0xba)){const _0x3f1cfb=resolveSite(_0x4029e8);console['log'](_0x32083e(0x81)+_0x3f1cfb+_0x32083e(0x76)),console[_0x32083e(0x83)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x32083e(0x83)]('\x20\x20'+getConsoleUrl(_0x3f1cfb,_0x32083e(0x70)));const _0x3e89c8=await a33_0x1edb46({'type':_0x32083e(0x6e),'name':'apiKey','message':_0x32083e(0x94),'validate':_0x33c64a=>{const _0x1de9f9=_0x32083e;if(!_0x33c64a||!_0x33c64a['trim']())return _0x1de9f9(0x99);return!![];}});if(!_0x3e89c8['apiKey'])return console[_0x32083e(0x83)](_0x32083e(0x75)),0x1;console[_0x32083e(0x83)]('Validating\x20API\x20key...');try{const _0x3b1eb7=TDX[_0x32083e(0xcd)]({'site':_0x3f1cfb,'apiKey':_0x3e89c8[_0x32083e(0x9c)]['trim'](),'logLevel':_0x55a617['logLevel']??LogLevel[_0x32083e(0xb7)]}),_0x10c900=await _0x3b1eb7[_0x32083e(0xab)][_0x32083e(0x8b)]();console['log'](a33_0x560f4b[_0x32083e(0xbf)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x10c900[_0x32083e(0x7f)]+')');const _0x2c09db=await isKeychainAvailable();_0x2c09db?(await saveAPIKeyAsync(_0x3e89c8[_0x32083e(0x9c)][_0x32083e(0x90)](),_0x3f1cfb,_0x2dc2ba),console['log'](a33_0x560f4b[_0x32083e(0xbf)]('✓')+_0x32083e(0xb5))):console[_0x32083e(0x84)](a33_0x560f4b['yellow'](_0x32083e(0x71))),_0x15e881[_0x32083e(0xba)]=_0x3f1cfb;}catch(_0x11fda5){if(_0x11fda5 instanceof HTTPClientError&&_0x11fda5[_0x32083e(0x6d)]===0x191)return printAuthError(_0x11fda5),0x1;return console[_0x32083e(0x9b)](a33_0x560f4b[_0x32083e(0xd3)](_0x32083e(0x72)+(_0x11fda5 instanceof Error?_0x11fda5[_0x32083e(0x77)]:String(_0x11fda5)))),console['error']('Site\x20was\x20not\x20changed.'),0x1;}}else _0x15e881[_0xe13788]=_0x4029e8||undefined;return saveProfileToUserConfig(_0x2dc2ba,_0x15e881),console[_0x32083e(0x83)](a33_0x560f4b[_0x32083e(0xbf)]('✓')+_0x32083e(0xb3)+_0x2dc2ba+_0x32083e(0xa4)+_0xe13788+'='+(_0x4029e8||_0x32083e(0x8c))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x4cac49(0xc3)]='profile:use';[a33_0x4cac49(0xc2)]='Set\x20session\x20profile';[a33_0x4cac49(0x89)](_0x289dd9){const _0xbc40c3=a33_0x4cac49,{args:_0xcb4ac1}=_0x289dd9;if(_0xcb4ac1[_0xbc40c3(0x91)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async['execute'](_0x4f265b){const _0x31c4bd=a33_0x4cac49,{args:_0x2653d7,options:_0x3bd54f}=_0x4f265b,_0x192744=_0x2653d7[0x0],_0xba0987=_0x3bd54f['default'];cleanExpiredSessions();if(!profileExists(_0x192744)){console[_0x31c4bd(0x9b)](a33_0x560f4b[_0x31c4bd(0xd3)]('Profile\x20\x27'+_0x192744+'\x27\x20does\x20not\x20exist.')),console[_0x31c4bd(0x83)](_0x31c4bd(0x8e));const _0x44ced6=listProfiles();if(_0x44ced6[_0x31c4bd(0x91)]===0x0)console[_0x31c4bd(0x83)](_0x31c4bd(0x7d));else for(const _0x9cfc65 of _0x44ced6){console[_0x31c4bd(0x83)](_0x31c4bd(0x95)+_0x9cfc65['name']);}return 0x1;}if(_0xba0987){const _0x6579cc=a33_0x1d6ee6[_0x31c4bd(0x8d)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x192744),console[_0x31c4bd(0x83)](_0x31c4bd(0xaf)+a33_0x560f4b[_0x31c4bd(0xbf)](_0x192744)),console[_0x31c4bd(0x83)](a33_0x560f4b['dim'](_0x31c4bd(0xa3)+_0x6579cc)),0x0;}const _0x4b257f=getSessionID(_0x3bd54f[_0x31c4bd(0xa6)]);return saveSessionContext({'profile':_0x192744},_0x3bd54f[_0x31c4bd(0xa6)]),console['log'](_0x31c4bd(0xac)+a33_0x560f4b[_0x31c4bd(0xbf)](_0x192744)+'\x20'+a33_0x560f4b['dim'](_0x31c4bd(0x69)+_0x4b257f+')')),console[_0x31c4bd(0x83)](a33_0x560f4b[_0x31c4bd(0x7e)](_0x31c4bd(0x6b)+_0x192744+_0x31c4bd(0x86))),0x0;}}
1
+ const a33_0xf53dec=a33_0x1157;(function(_0x2c0c89,_0x2e80d1){const _0x3a93e6=a33_0x1157,_0x124b52=_0x2c0c89();while(!![]){try{const _0x5bf8e3=-parseInt(_0x3a93e6(0x108))/0x1*(-parseInt(_0x3a93e6(0xf0))/0x2)+parseInt(_0x3a93e6(0x11c))/0x3*(parseInt(_0x3a93e6(0xcd))/0x4)+-parseInt(_0x3a93e6(0xd1))/0x5*(-parseInt(_0x3a93e6(0xd8))/0x6)+-parseInt(_0x3a93e6(0x116))/0x7+-parseInt(_0x3a93e6(0x118))/0x8*(-parseInt(_0x3a93e6(0xfb))/0x9)+parseInt(_0x3a93e6(0x104))/0xa+parseInt(_0x3a93e6(0x100))/0xb*(-parseInt(_0x3a93e6(0xe6))/0xc);if(_0x5bf8e3===_0x2e80d1)break;else _0x124b52['push'](_0x124b52['shift']());}catch(_0xf8a618){_0x124b52['push'](_0x124b52['shift']());}}}(a33_0x241d,0x33adc));function a33_0x241d(){const _0x28530a=['\x0aSetup\x20cancelled','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Delete\x20a\x20profile','You\x20can\x20find\x20your\x20API\x20key\x20at:','\x20\x20tdx\x20--profile\x20','warn','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','119763EkWqVP','join','profile','\x27\x20does\x20not\x20exist.','profile:create','2134TnbHzQ','Validating\x20API\x20key...','\x27.\x0a\x0aValid\x20keys:\x20','\x20Profile\x20\x27','4063610zCKrkU','profile:delete','\x20\x20(no\x20profiles\x20found)','Session\x20profile\x20set\x20to:\x20','89ctnHfd','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','profile:use','description','oauth','Enter\x20profile\x20name:','config','Enter\x20your\x20TD\x20API\x20key:','status','\x27\x20updated:\x20','Failed\x20to\x20delete\x20profile:\x20','tdx.json','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','2376325uGqjXt','Create\x20a\x20new\x20profile','104wiJhFl','Removal\x20cancelled','\x27\x20deleted','split','8508gUjuhW','parent_segment','/app/mp/ak','log','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','force','tdx:\x20profile\x20delete','jobs','site','✗\x20Validation\x20failed:\x20','Set\x20a\x20profile\x20configuration\x20value','llm_agent','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','logLevel','Operation\x20cancelled','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Changing\x20site\x20to\x20\x27','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Set\x20session\x20profile','validate','\x27\x20created','green','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','bold','\x20\x20-\x20','create','284LUPNBU','profile:set','Profile\x20name\x20cannot\x20be\x20empty','test','5340vFaAuA','us01','confirm','apiKey','VALID_KEYS','length','\x0aAvailable\x20profiles:','1812YKMRha','Enter\x20description\x20(optional):','ERROR','trim','password','includes','\x0aSaved\x20to:\x20','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','profileName','execute','error','session','Profile\x20\x27','text','47412BWnEFk','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','red','message','name','dim','\x20--default\x27\x20to\x20save\x20permanently','yellow','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','Setup\x20cancelled','4818dmdVZD','API\x20key\x20cannot\x20be\x20empty','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','skipExistsCheck'];a33_0x241d=function(){return _0x28530a;};return a33_0x241d();}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_0x3b3c4d 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_0x22d1e7 from'prompts';import a33_0x44911d from'chalk';function validateProfileName(_0x3a16bc,_0x2ecbbe){const _0xe748da=a33_0x1157;if(!_0x3a16bc||!_0x3a16bc[_0xe748da(0xdb)]())return _0xe748da(0xcf);const _0x1b1946=_0x3a16bc[_0xe748da(0xdb)]();if(!/^[a-zA-Z0-9_-]+$/[_0xe748da(0xd0)](_0x1b1946))return _0xe748da(0xbf);if(!_0x2ecbbe?.[_0xe748da(0xf3)]&&profileExists(_0x1b1946))return'Profile\x20\x27'+_0x1b1946+_0xe748da(0xe7)+_0x1b1946+_0xe748da(0xc9);return!![];}async function deleteProfileAndCredentials(_0x31caa0){removeProfileFromUserConfig(_0x31caa0);const _0x324c6a=await isKeychainAvailable();_0x324c6a&&await Promise['all']([deleteKeychainAPIKey(_0x31caa0),deleteOAuthTokens(_0x31caa0)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0xf53dec(0xea)]=a33_0xf53dec(0xff);[a33_0xf53dec(0x10c)]=a33_0xf53dec(0x117);async['execute'](_0xd98ff9){const _0x480646=a33_0xf53dec,{options:_0x2043f2,args:_0x30db00}=_0xd98ff9,_0x1b6889=!!_0x2043f2[_0x480646(0x122)];console[_0x480646(0x11f)](a33_0x44911d['bold']('tdx:\x20profile\x20create'));let _0x593a43;if(_0x30db00['length']>0x0&&_0x30db00[0x0]){const _0xe140ff=_0x30db00[0x0][_0x480646(0xdb)]();_0x1b6889&&profileExists(_0xe140ff)&&(await deleteProfileAndCredentials(_0xe140ff),console['log']('Removed\x20existing\x20profile\x20\x27'+_0xe140ff+'\x27'));const _0x5a37cd=validateProfileName(_0xe140ff);if(_0x5a37cd!==!![])return console[_0x480646(0xe2)](a33_0x44911d[_0x480646(0xe8)](_0x5a37cd)),0x1;_0x593a43=_0xe140ff;}else{const _0x157cb8=await a33_0x22d1e7({'type':_0x480646(0xe5),'name':'profileName','message':_0x480646(0x10e),'validate':_0x1b78ca=>validateProfileName(_0x1b78ca,{'skipExistsCheck':_0x1b6889})});if(!_0x157cb8[_0x480646(0xe0)])return console[_0x480646(0x11f)]('\x0aSetup\x20cancelled'),0x1;_0x593a43=_0x157cb8[_0x480646(0xe0)][_0x480646(0xdb)](),_0x1b6889&&profileExists(_0x593a43)&&(await deleteProfileAndCredentials(_0x593a43),console['log']('Removed\x20existing\x20profile\x20\x27'+_0x593a43+'\x27'));}const _0x28cab6=await a33_0x22d1e7({'type':_0x480646(0xe5),'name':_0x480646(0x10c),'message':_0x480646(0xd9)}),_0x261a3f=_0x28cab6[_0x480646(0x10c)]?.['trim']()||undefined,_0xc3d7f0=_0x2043f2[_0x480646(0x125)]||_0x480646(0xd2),_0x55bd17=await promptSiteSelection(_0xc3d7f0,_0x593a43,_0x480646(0xef));if(!_0x55bd17)return 0x1;const _0x155931=resolveSite(_0x55bd17),_0x482408=await promptAuthMethod();if(!_0x482408)return console[_0x480646(0x11f)](_0x480646(0xf4)),0x1;if(_0x482408===_0x480646(0x10d)){if(_0x261a3f){const _0x20be68={'site':_0x155931,'description':_0x261a3f};saveProfileToUserConfig(_0x593a43,_0x20be68);}const {accountName:_0xb32125}=_0x2043f2;return await runOAuthLoginFlow(_0x155931,_0x593a43,_0x2043f2['logLevel']??LogLevel['ERROR'],{'accountName':_0xb32125}),0x0;}console[_0x480646(0x11f)](_0x480646(0x121)+_0x155931),console['log'](_0x480646(0xf7)),console[_0x480646(0x11f)]('\x20\x20'+getConsoleUrl(_0x155931,_0x480646(0x11e)));const _0x53cb39=await a33_0x22d1e7({'type':_0x480646(0xdc),'name':_0x480646(0xd4),'message':_0x480646(0x110),'validate':_0x3280b4=>{const _0x1ffb63=_0x480646;if(!_0x3280b4||!_0x3280b4[_0x1ffb63(0xdb)]())return _0x1ffb63(0xf1);return!![];}});if(!_0x53cb39[_0x480646(0xd4)])return console[_0x480646(0x11f)](_0x480646(0xf4)),0x1;const _0x335fcd=_0x53cb39['apiKey'];console[_0x480646(0x11f)](_0x480646(0x101));try{const _0x31522a=TDX[_0x480646(0xcc)]({'site':_0x155931,'apiKey':_0x335fcd[_0x480646(0xdb)](),'logLevel':_0x2043f2['logLevel']??LogLevel[_0x480646(0xda)]}),_0x297b84=await _0x31522a[_0x480646(0x124)]['getUserInfo']();console[_0x480646(0x11f)](a33_0x44911d[_0x480646(0xc8)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x297b84['email']+')');const _0x53cc05=await isKeychainAvailable();_0x53cc05?(await saveAPIKeyAsync(_0x335fcd[_0x480646(0xdb)](),_0x155931,_0x593a43),console['log'](a33_0x44911d['green']('✓')+_0x480646(0xf5)+_0x593a43+')')):(console[_0x480646(0xf9)](a33_0x44911d[_0x480646(0xed)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x480646(0xf9)](a33_0x44911d[_0x480646(0xed)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x4bff5a={'site':_0x155931,..._0x261a3f&&{'description':_0x261a3f}};return saveProfileToUserConfig(_0x593a43,_0x4bff5a),console[_0x480646(0x11f)](a33_0x44911d[_0x480646(0xc8)]('✓')+_0x480646(0x103)+_0x593a43+_0x480646(0xc7)),console[_0x480646(0x11f)](),console[_0x480646(0x11f)](_0x480646(0xdf)),console[_0x480646(0x11f)](_0x480646(0xf8)+_0x593a43+_0x480646(0xf2)),console[_0x480646(0x11f)](_0x480646(0xf8)+_0x593a43+_0x480646(0x10a)),0x0;}catch(_0x50ce2d){if(_0x50ce2d instanceof HTTPClientError&&_0x50ce2d[_0x480646(0x111)]===0x191)return printAuthError(_0x50ce2d),0x1;return console[_0x480646(0xe2)](a33_0x44911d[_0x480646(0xe8)](_0x480646(0x126)+(_0x50ce2d instanceof Error?_0x50ce2d[_0x480646(0xe9)]:String(_0x50ce2d)))),console[_0x480646(0xe2)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}function a33_0x1157(_0x519d50,_0x369f1c){_0x519d50=_0x519d50-0xbd;const _0x241d3d=a33_0x241d();let _0x115749=_0x241d3d[_0x519d50];return _0x115749;}export class ProfileDeleteCommand extends BaseCommand{['name']=a33_0xf53dec(0x105);[a33_0xf53dec(0x10c)]=a33_0xf53dec(0xf6);['validate'](_0x1b7126){const _0x11f307=a33_0xf53dec,{args:_0x23cf90}=_0x1b7126;if(_0x23cf90[_0x11f307(0xd6)]===0x0)return _0x11f307(0x115);return undefined;}async['execute'](_0x31ae6c){const _0xc407ec=a33_0xf53dec,{args:_0x23a42e}=_0x31ae6c,_0xcae587=_0x23a42e[0x0];console[_0xc407ec(0x11f)](a33_0x44911d['bold'](_0xc407ec(0x123)));if(!profileExists(_0xcae587)){console[_0xc407ec(0xe2)](a33_0x44911d[_0xc407ec(0xe8)](_0xc407ec(0xe4)+_0xcae587+_0xc407ec(0xfe))),console['log'](_0xc407ec(0xd7));const _0x70059b=listProfiles();if(_0x70059b['length']===0x0)console[_0xc407ec(0x11f)](_0xc407ec(0x106));else for(const _0x276539 of _0x70059b){console[_0xc407ec(0x11f)]('\x20\x20-\x20'+_0x276539[_0xc407ec(0xea)]);}return 0x1;}const _0x2d7503=await a33_0x22d1e7({'type':_0xc407ec(0xd3),'name':_0xc407ec(0xd3),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0xcae587+'\x27?','initial':![]});if(!_0x2d7503[_0xc407ec(0xd3)])return console[_0xc407ec(0x11f)](_0xc407ec(0x119)),0x0;try{await deleteProfileAndCredentials(_0xcae587),console[_0xc407ec(0x11f)](a33_0x44911d['green']('✓')+_0xc407ec(0x103)+_0xcae587+_0xc407ec(0x11a));}catch(_0x3e4f2b){return console['error'](a33_0x44911d[_0xc407ec(0xe8)](_0xc407ec(0x113)+(_0x3e4f2b instanceof Error?_0x3e4f2b['message']:String(_0x3e4f2b)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0xf53dec(0xea)]=a33_0xf53dec(0xce);[a33_0xf53dec(0x10c)]=a33_0xf53dec(0xbd);static [a33_0xf53dec(0xd5)]=['site','database',a33_0xf53dec(0x11d),'llm_project',a33_0xf53dec(0xbe),a33_0xf53dec(0x10c)];['validate'](_0x30c9e8){const _0x35fb6e=a33_0xf53dec,{args:_0x23d561,options:_0x266059}=_0x30c9e8,_0x3d0f0d=_0x266059[_0x35fb6e(0xfd)]||getActiveProfile();if(!_0x3d0f0d)return'No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>';if(_0x23d561[_0x35fb6e(0xd6)]===0x0)return _0x35fb6e(0xc4)+ProfileSetCommand['VALID_KEYS'][_0x35fb6e(0xfc)](',\x20');const _0x5ea3a4=_0x23d561[0x0];if(!_0x5ea3a4[_0x35fb6e(0xdd)]('='))return _0x35fb6e(0x120)+ProfileSetCommand[_0x35fb6e(0xd5)][_0x35fb6e(0xfc)](',\x20');const [_0x56020c]=_0x5ea3a4[_0x35fb6e(0x11b)]('=',0x2);if(!ProfileSetCommand[_0x35fb6e(0xd5)]['includes'](_0x56020c))return'Unknown\x20key\x20\x27'+_0x56020c+_0x35fb6e(0x102)+ProfileSetCommand[_0x35fb6e(0xd5)][_0x35fb6e(0xfc)](',\x20');return undefined;}async[a33_0xf53dec(0xe1)](_0xc826b4){const _0x26d89f=a33_0xf53dec,{args:_0x143f4b,options:_0x4673ab}=_0xc826b4,_0x460a23=_0x4673ab[_0x26d89f(0xfd)]||getActiveProfile(),[_0x5dad1c,..._0x47473f]=_0x143f4b[0x0][_0x26d89f(0x11b)]('='),_0x3e0fde=_0x47473f[_0x26d89f(0xfc)]('=');console['log'](a33_0x44911d[_0x26d89f(0xca)]('tdx:\x20profile\x20set'));if(!profileExists(_0x460a23)){const _0x3686f9=await a33_0x22d1e7({'type':_0x26d89f(0xd3),'name':_0x26d89f(0xcc),'message':'Profile\x20\x27'+_0x460a23+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x3686f9['create'])return console['log'](_0x26d89f(0xc1)),0x1;}const _0x4630b3=loadProfile(_0x460a23),_0x3507e9=_0x4630b3?.[_0x26d89f(0x10f)]||{};if(_0x5dad1c===_0x26d89f(0x125)){const _0xcad09=resolveSite(_0x3e0fde);console[_0x26d89f(0x11f)](_0x26d89f(0xc3)+_0xcad09+'\x27\x20requires\x20API\x20key\x20validation.'),console['log'](_0x26d89f(0x109)),console[_0x26d89f(0x11f)]('\x20\x20'+getConsoleUrl(_0xcad09,_0x26d89f(0x11e)));const _0x171fce=await a33_0x22d1e7({'type':_0x26d89f(0xdc),'name':'apiKey','message':_0x26d89f(0xee),'validate':_0x3e25a1=>{const _0x29fa0e=_0x26d89f;if(!_0x3e25a1||!_0x3e25a1['trim']())return _0x29fa0e(0xf1);return!![];}});if(!_0x171fce[_0x26d89f(0xd4)])return console[_0x26d89f(0x11f)]('\x0aOperation\x20cancelled'),0x1;console[_0x26d89f(0x11f)](_0x26d89f(0x101));try{const _0x4753c8=TDX[_0x26d89f(0xcc)]({'site':_0xcad09,'apiKey':_0x171fce['apiKey'][_0x26d89f(0xdb)](),'logLevel':_0x4673ab[_0x26d89f(0xc0)]??LogLevel[_0x26d89f(0xda)]}),_0x4bab04=await _0x4753c8[_0x26d89f(0x124)]['getUserInfo']();console[_0x26d89f(0x11f)](a33_0x44911d[_0x26d89f(0xc8)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x4bab04['email']+')');const _0x3ea342=await isKeychainAvailable();_0x3ea342?(await saveAPIKeyAsync(_0x171fce[_0x26d89f(0xd4)]['trim'](),_0xcad09,_0x460a23),console['log'](a33_0x44911d[_0x26d89f(0xc8)]('✓')+_0x26d89f(0xc2))):console['warn'](a33_0x44911d[_0x26d89f(0xed)](_0x26d89f(0xfa))),_0x3507e9[_0x26d89f(0x125)]=_0xcad09;}catch(_0x609eda){if(_0x609eda instanceof HTTPClientError&&_0x609eda[_0x26d89f(0x111)]===0x191)return printAuthError(_0x609eda),0x1;return console[_0x26d89f(0xe2)](a33_0x44911d[_0x26d89f(0xe8)]('✗\x20Validation\x20failed:\x20'+(_0x609eda instanceof Error?_0x609eda[_0x26d89f(0xe9)]:String(_0x609eda)))),console[_0x26d89f(0xe2)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x3507e9[_0x5dad1c]=_0x3e0fde||undefined;return saveProfileToUserConfig(_0x460a23,_0x3507e9),console[_0x26d89f(0x11f)](a33_0x44911d['green']('✓')+'\x20Profile\x20\x27'+_0x460a23+_0x26d89f(0x112)+_0x5dad1c+'='+(_0x3e0fde||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0xf53dec(0xea)]=a33_0xf53dec(0x10b);[a33_0xf53dec(0x10c)]=a33_0xf53dec(0xc5);[a33_0xf53dec(0xc6)](_0x2bf9c8){const _0x1b549c=a33_0xf53dec,{args:_0x35828a}=_0x2bf9c8;if(_0x35828a[_0x1b549c(0xd6)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a33_0xf53dec(0xe1)](_0x11cc59){const _0x6a9f4d=a33_0xf53dec,{args:_0xb70d43,options:_0x2e399c}=_0x11cc59,_0x518225=_0xb70d43[0x0],_0x1e18d8=_0x2e399c['default'];cleanExpiredSessions();if(!profileExists(_0x518225)){console['error'](a33_0x44911d['red']('Profile\x20\x27'+_0x518225+_0x6a9f4d(0xfe))),console['log'](_0x6a9f4d(0xd7));const _0x1d9838=listProfiles();if(_0x1d9838[_0x6a9f4d(0xd6)]===0x0)console['log'](_0x6a9f4d(0x106));else for(const _0x38b79e of _0x1d9838){console[_0x6a9f4d(0x11f)](_0x6a9f4d(0xcb)+_0x38b79e[_0x6a9f4d(0xea)]);}return 0x1;}if(_0x1e18d8){const _0x3152c6=a33_0x3b3c4d['join'](getConfigDir(),_0x6a9f4d(0x114));return saveActiveProfileToUserConfig(_0x518225),console[_0x6a9f4d(0x11f)]('Default\x20profile\x20set\x20to:\x20'+a33_0x44911d[_0x6a9f4d(0xc8)](_0x518225)),console[_0x6a9f4d(0x11f)](a33_0x44911d[_0x6a9f4d(0xeb)](_0x6a9f4d(0xde)+_0x3152c6)),0x0;}const _0x43aec5=getSessionID(_0x2e399c[_0x6a9f4d(0xe3)]);return saveSessionContext({'profile':_0x518225},_0x2e399c[_0x6a9f4d(0xe3)]),console[_0x6a9f4d(0x11f)](_0x6a9f4d(0x107)+a33_0x44911d[_0x6a9f4d(0xc8)](_0x518225)+'\x20'+a33_0x44911d[_0x6a9f4d(0xeb)]('(session:\x20'+_0x43aec5+')')),console[_0x6a9f4d(0x11f)](a33_0x44911d[_0x6a9f4d(0xeb)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x518225+_0x6a9f4d(0xec))),0x0;}}
@@ -1 +1 @@
1
- const a34_0x5f543c=a34_0x590c;function a34_0x4f22(){const _0x45a519=['scope','name','message','40DcfhnV','config','👤\x20','100268mPZapg','description','7520526klkvOb','705436hdCbUv','Error:\x20','profiles','826965zYMnGl','error','site','log','7208FRMLhJ','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','2492375yFZZsp','4hHyfeT','length','dim','execute','\x20\x20Global:\x20~/.config/tdx/tdx.json','6755EIQUdc','66198MXYLEf'];a34_0x4f22=function(){return _0x45a519;};return a34_0x4f22();}(function(_0x5485d2,_0x2ba51c){const _0x58ceaf=a34_0x590c,_0x4a7d5b=_0x5485d2();while(!![]){try{const _0x12d5a4=-parseInt(_0x58ceaf(0xfa))/0x1*(-parseInt(_0x58ceaf(0xed))/0x2)+parseInt(_0x58ceaf(0xf3))/0x3+parseInt(_0x58ceaf(0xfd))/0x4+-parseInt(_0x58ceaf(0xec))/0x5+parseInt(_0x58ceaf(0xfc))/0x6+-parseInt(_0x58ceaf(0xf2))/0x7*(parseInt(_0x58ceaf(0xe9))/0x8)+-parseInt(_0x58ceaf(0xe5))/0x9*(-parseInt(_0x58ceaf(0xf7))/0xa);if(_0x12d5a4===_0x2ba51c)break;else _0x4a7d5b['push'](_0x4a7d5b['shift']());}catch(_0x4bcee1){_0x4a7d5b['push'](_0x4a7d5b['shift']());}}}(a34_0x4f22,0x9f2ce));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a34_0x590c(_0x27021a,_0x53d49f){_0x27021a=_0x27021a-0xe4;const _0x4f2256=a34_0x4f22();let _0x590c85=_0x4f2256[_0x27021a];return _0x590c85;}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x2699b7 from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x5f543c(0xf5)]=a34_0x5f543c(0xe4);[a34_0x5f543c(0xfb)]='List\x20all\x20available\x20profiles';async[a34_0x5f543c(0xf0)](_0x450f22){const _0x48a99c=a34_0x5f543c,{options:_0x1e81b}=_0x450f22;try{const _0x138336=listProfiles(),_0x12ca62=getActiveProfile();if(_0x138336[_0x48a99c(0xee)]===0x0)return console[_0x48a99c(0xe8)](_0x48a99c(0xea)),console[_0x48a99c(0xe8)](_0x48a99c(0xeb)),console['log'](_0x48a99c(0xf1)),0x0;const _0x3ea397=_0x138336['map'](_0x79a17a=>{const _0x4b7c78=_0x48a99c,_0x2b7699=_0x79a17a[_0x4b7c78(0xf5)]===_0x12ca62,_0x29d9c0=getProfileParams(_0x79a17a[_0x4b7c78(0xf8)]);return{'name':_0x79a17a['name'],'active':_0x2b7699,'scope':_0x79a17a[_0x4b7c78(0xf4)],'description':_0x79a17a[_0x4b7c78(0xf8)]['description']||'','params':_0x29d9c0};});if(isStructuredFormat(_0x1e81b))await handleSDKOutput(_0x3ea397,_0x1e81b);else for(const _0x46065b of _0x138336){const _0x24d7c1=_0x46065b[_0x48a99c(0xf5)]===_0x12ca62?a34_0x2699b7['green']('\x20✓'):'',_0x4e7add=_0x46065b[_0x48a99c(0xf8)][_0x48a99c(0xe7)]?a34_0x2699b7[_0x48a99c(0xef)]('\x20'+_0x46065b[_0x48a99c(0xf8)]['site']):'',_0x10a631=_0x46065b['config'][_0x48a99c(0xfb)]?a34_0x2699b7[_0x48a99c(0xef)]('\x20\x20'+_0x46065b['config'][_0x48a99c(0xfb)]):'';console[_0x48a99c(0xe8)](_0x48a99c(0xf9)+_0x46065b[_0x48a99c(0xf5)]+_0x24d7c1+_0x4e7add+_0x10a631);}return 0x0;}catch(_0x1a0278){return _0x1a0278 instanceof Error&&console[_0x48a99c(0xe6)](_0x48a99c(0xfe)+_0x1a0278[_0x48a99c(0xf6)]),0x1;}}}
1
+ function a34_0x250c(){const _0x519fbf=['3340UYBuep','config','scope','12432owvgFP','profiles','site','1645590CkktOT','5RpbHvv','6258MLcYdT','map','2390480YlpuXI','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','description','👤\x20','List\x20all\x20available\x20profiles','green','dim','1176603BszEHL','log','592432LYgNNr','message','length','1BFAHdr','error','11076912hSjuSC','17215mresmW','name'];a34_0x250c=function(){return _0x519fbf;};return a34_0x250c();}const a34_0x2889ba=a34_0x17f8;(function(_0x2cef32,_0x3306d9){const _0x5a884f=a34_0x17f8,_0x1e108b=_0x2cef32();while(!![]){try{const _0x40b28b=-parseInt(_0x5a884f(0xad))/0x1*(-parseInt(_0x5a884f(0xaa))/0x2)+parseInt(_0x5a884f(0xc4))/0x3+parseInt(_0x5a884f(0xbc))/0x4*(-parseInt(_0x5a884f(0xb9))/0x5)+parseInt(_0x5a884f(0xb8))/0x6+-parseInt(_0x5a884f(0xba))/0x7*(parseInt(_0x5a884f(0xb5))/0x8)+parseInt(_0x5a884f(0xaf))/0x9+parseInt(_0x5a884f(0xb2))/0xa*(parseInt(_0x5a884f(0xb0))/0xb);if(_0x40b28b===_0x3306d9)break;else _0x1e108b['push'](_0x1e108b['shift']());}catch(_0x2424b7){_0x1e108b['push'](_0x1e108b['shift']());}}}(a34_0x250c,0xb20b0));import{BaseCommand}from'./command.js';function a34_0x17f8(_0x329f59,_0xe5c30){_0x329f59=_0x329f59-0xaa;const _0x250c29=a34_0x250c();let _0x17f810=_0x250c29[_0x329f59];return _0x17f810;}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x127032 from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x2889ba(0xb1)]=a34_0x2889ba(0xb6);[a34_0x2889ba(0xbf)]=a34_0x2889ba(0xc1);async['execute'](_0xbb95a3){const _0x42e4de=a34_0x2889ba,{options:_0x5d677f}=_0xbb95a3;try{const _0x584b93=listProfiles(),_0x17270a=getActiveProfile();if(_0x584b93[_0x42e4de(0xac)]===0x0)return console[_0x42e4de(0xc5)](_0x42e4de(0xbe)),console['log'](_0x42e4de(0xbd)),console[_0x42e4de(0xc5)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x2e0ffd=_0x584b93[_0x42e4de(0xbb)](_0x38aa29=>{const _0x5a3a12=_0x42e4de,_0x16e70d=_0x38aa29[_0x5a3a12(0xb1)]===_0x17270a,_0xe9c980=getProfileParams(_0x38aa29[_0x5a3a12(0xb3)]);return{'name':_0x38aa29[_0x5a3a12(0xb1)],'active':_0x16e70d,'scope':_0x38aa29[_0x5a3a12(0xb4)],'description':_0x38aa29['config'][_0x5a3a12(0xbf)]||'','params':_0xe9c980};});if(isStructuredFormat(_0x5d677f))await handleSDKOutput(_0x2e0ffd,_0x5d677f);else for(const _0x46ae5a of _0x584b93){const _0x47bb7b=_0x46ae5a['name']===_0x17270a?a34_0x127032[_0x42e4de(0xc2)]('\x20✓'):'',_0xcce5c1=_0x46ae5a[_0x42e4de(0xb3)][_0x42e4de(0xb7)]?a34_0x127032[_0x42e4de(0xc3)]('\x20'+_0x46ae5a[_0x42e4de(0xb3)][_0x42e4de(0xb7)]):'',_0x591a60=_0x46ae5a[_0x42e4de(0xb3)][_0x42e4de(0xbf)]?a34_0x127032['dim']('\x20\x20'+_0x46ae5a[_0x42e4de(0xb3)][_0x42e4de(0xbf)]):'';console[_0x42e4de(0xc5)](_0x42e4de(0xc0)+_0x46ae5a[_0x42e4de(0xb1)]+_0x47bb7b+_0xcce5c1+_0x591a60);}return 0x0;}catch(_0x31e514){return _0x31e514 instanceof Error&&console[_0x42e4de(0xae)]('Error:\x20'+_0x31e514[_0x42e4de(0xab)]),0x1;}}}
@@ -1 +1 @@
1
- function a35_0x3c7b(_0x595aab,_0x42390e){_0x595aab=_0x595aab-0x162;const _0x30fb6b=a35_0x30fb();let _0x3c7b0a=_0x30fb6b[_0x595aab];return _0x3c7b0a;}const a35_0x4fdc17=a35_0x3c7b;(function(_0xa4a36d,_0x190293){const _0x3e1a61=a35_0x3c7b,_0x2604c5=_0xa4a36d();while(!![]){try{const _0x86236e=-parseInt(_0x3e1a61(0x186))/0x1*(parseInt(_0x3e1a61(0x190))/0x2)+-parseInt(_0x3e1a61(0x177))/0x3+parseInt(_0x3e1a61(0x168))/0x4*(-parseInt(_0x3e1a61(0x175))/0x5)+parseInt(_0x3e1a61(0x162))/0x6+parseInt(_0x3e1a61(0x187))/0x7+-parseInt(_0x3e1a61(0x180))/0x8*(parseInt(_0x3e1a61(0x16f))/0x9)+parseInt(_0x3e1a61(0x171))/0xa;if(_0x86236e===_0x190293)break;else _0x2604c5['push'](_0x2604c5['shift']());}catch(_0x1cdc69){_0x2604c5['push'](_0x2604c5['shift']());}}}(a35_0x30fb,0xc3eff));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a35_0x30fb(){const _0x41f7ce=['634vUknfr','7171654EWyuaj','Query\x20completed:\x20Processed\x20','...','\x20[Job\x20ID:\x20','push','file','processedRows','setExtra','\x0aAll\x20results\x20saved\x20to\x20','4746pFUVHP','data','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','name','args','validate','totalSplits','Site:\x20','completedSplits','stats','7303152eJEIBO','error','Error:\x20','originalMessage','information_schema','\x20-\x20','860740OiCTyI','elapsedTimeMillis','in\x20','state','SQL:\x20','setPhase','database','855ucExeJ','output','3881060VevlfW','execute','Executing\x20query\x20[','message','5RSmebK','query','247827PHiAYc','Executing\x20statement\x20','\x20rows\x20','length','Schema:\x20','Catalog:\x20','Statement\x20','site','options','2104QOeMTz','join','jobId','description','verbose','Executing\x20query...'];a35_0x30fb=function(){return _0x41f7ce;};return a35_0x30fb();}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_0x4fdc17(0x193)]=a35_0x4fdc17(0x176);[a35_0x4fdc17(0x183)]='Run\x20Trino\x20queries\x20(streaming)';async[a35_0x4fdc17(0x172)](_0x11fe2f){const _0x50dcbf=a35_0x4fdc17,{options:_0x1eb60d,args:_0x2812a3,tdx:_0x4ec4d5}=_0x11fe2f,_0x58e79e={..._0x1eb60d,'limitStructuredFormats':!![]},_0x5ddbbb=_0x2812a3[0x0],_0x5b3c28=_0x1eb60d[_0x50dcbf(0x18c)];let _0x4559eb;try{if(_0x5b3c28)_0x4559eb=readSqlStatementsFromFile(_0x5b3c28);else{if(_0x5ddbbb==='-')_0x4559eb=await readSqlStatementsFromStdin();else{if(_0x5ddbbb&&isSqlFilePath(_0x5ddbbb))_0x4559eb=readSqlStatementsFromFile(_0x5ddbbb);else{if(_0x5ddbbb)_0x4559eb=splitSqlStatements(_0x5ddbbb);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x227293){return console[_0x50dcbf(0x163)](_0x50dcbf(0x164)+_0x227293[_0x50dcbf(0x174)]),0x1;}const _0xb47b57=_0x1eb60d[_0x50dcbf(0x16e)]||_0x50dcbf(0x166),_0x308285=_0x1eb60d['catalog'];try{const _0x438dd7=[],_0x387991=!!_0x1eb60d[_0x50dcbf(0x170)];for(let _0x1ec32a=0x0;_0x1ec32a<_0x4559eb['length'];_0x1ec32a++){const _0x4a55fb=_0x4559eb[_0x1ec32a],_0x3ee72c=_0x1ec32a+0x1,_0x1d65de=_0x4559eb[_0x50dcbf(0x17a)],_0x4e2e32=_0x1d65de>0x1;_0x1eb60d[_0x50dcbf(0x184)]&&(console[_0x50dcbf(0x163)]('\x0a'+(_0x4e2e32?_0x50dcbf(0x17d)+_0x3ee72c+'/'+_0x1d65de+':':'')),console[_0x50dcbf(0x163)](_0x50dcbf(0x197)+_0x1eb60d[_0x50dcbf(0x17e)]),console[_0x50dcbf(0x163)](_0x50dcbf(0x17c)+(_0x308285||'td')),console[_0x50dcbf(0x163)](_0x50dcbf(0x17b)+_0xb47b57),console[_0x50dcbf(0x163)](_0x50dcbf(0x16c)+_0x4a55fb));const _0x4539c9=_0x4e2e32?_0x50dcbf(0x178)+_0x3ee72c+'/'+_0x1d65de+_0x50dcbf(0x189):_0x50dcbf(0x185);try{const _0x41ad41=await withProgressSpinner(_0x4539c9,async _0x56abf3=>{const _0x36a03d=_0x50dcbf,_0x3c7f6f=await _0x4ec4d5[_0x36a03d(0x176)][_0x36a03d(0x172)](_0x4a55fb,{'catalog':_0x308285,'schema':_0xb47b57,'onJobId':_0x2eb7b0=>{_0x56abf3['setJobId'](_0x2eb7b0);},'onProgress':_0x8f7927=>{const _0x4d88ab=_0x36a03d;_0x56abf3[_0x4d88ab(0x16d)](_0x4d88ab(0x173)+_0x8f7927[_0x4d88ab(0x16b)]+']'),_0x56abf3[_0x4d88ab(0x18e)](formatRows(_0x8f7927[_0x4d88ab(0x18d)])+_0x4d88ab(0x179)+_0x8f7927[_0x4d88ab(0x198)]+'/'+_0x8f7927[_0x4d88ab(0x196)]+'\x20splits');}});return _0x3c7f6f;},{'verbose':_0x1eb60d[_0x50dcbf(0x184)]}),_0x2107c2=_0x41ad41[_0x50dcbf(0x191)],_0x440bba=_0x2107c2[_0x50dcbf(0x182)]?_0x50dcbf(0x18a)+_0x2107c2[_0x50dcbf(0x182)]+']':'',_0x28c119=_0x4e2e32?'Statement\x20'+_0x3ee72c+'/'+_0x1d65de+_0x50dcbf(0x167):'';console[_0x50dcbf(0x163)]('✔\x20'+_0x28c119+_0x50dcbf(0x188)+formatRows(_0x2107c2[_0x50dcbf(0x199)][_0x50dcbf(0x18d)])+_0x50dcbf(0x179)+(_0x50dcbf(0x16a)+formatElapsed(_0x2107c2['stats'][_0x50dcbf(0x169)])+_0x440bba));if(_0x4e2e32&&_0x387991){const _0xd969dd=resolveOutputOptions(_0x58e79e),_0x5bdb19=await formatQueryOutput(_0x2107c2,_0xd969dd);_0x438dd7[_0x50dcbf(0x18b)](_0x5bdb19);}else await handleQueryOutput(_0x2107c2,_0x58e79e);}catch(_0x19c445){const _0x28e8a9=_0x4e2e32?'Statement\x20'+_0x3ee72c+'/'+_0x1d65de+':\x0a':'',_0xe76eb4=_0x19c445 instanceof SDKError?_0x19c445[_0x50dcbf(0x165)]:_0x19c445[_0x50dcbf(0x174)];return console[_0x50dcbf(0x163)](''+_0x28e8a9+_0xe76eb4),0x1;}}if(_0x4559eb[_0x50dcbf(0x17a)]>0x1&&_0x387991&&_0x438dd7['length']>0x0){const _0x3e7263=_0x438dd7[_0x50dcbf(0x181)]('\x0a');writeFileSync(_0x1eb60d[_0x50dcbf(0x170)],_0x3e7263),console[_0x50dcbf(0x163)](_0x50dcbf(0x18f)+_0x1eb60d[_0x50dcbf(0x170)]);}return 0x0;}catch(_0x3be2f9){throw _0x3be2f9;}}[a35_0x4fdc17(0x195)](_0x51f832){const _0x3f613c=a35_0x4fdc17,_0x56b58c=_0x51f832[_0x3f613c(0x194)][0x0],_0xe06416=_0x51f832[_0x3f613c(0x17f)][_0x3f613c(0x18c)];if(!_0x56b58c&&!_0xe06416)return _0x3f613c(0x192);if(_0x56b58c&&_0xe06416)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}
1
+ const a35_0x4eb79a=a35_0x57c7;(function(_0x468e29,_0x346cb6){const _0x4539d1=a35_0x57c7,_0x5c4982=_0x468e29();while(!![]){try{const _0x23a149=parseInt(_0x4539d1(0x117))/0x1+parseInt(_0x4539d1(0x141))/0x2*(parseInt(_0x4539d1(0x11d))/0x3)+-parseInt(_0x4539d1(0x138))/0x4*(-parseInt(_0x4539d1(0x121))/0x5)+parseInt(_0x4539d1(0x127))/0x6*(-parseInt(_0x4539d1(0x114))/0x7)+parseInt(_0x4539d1(0x125))/0x8+-parseInt(_0x4539d1(0x139))/0x9+-parseInt(_0x4539d1(0x11f))/0xa;if(_0x23a149===_0x346cb6)break;else _0x5c4982['push'](_0x5c4982['shift']());}catch(_0x27f80f){_0x5c4982['push'](_0x5c4982['shift']());}}}(a35_0x5420,0xa2819));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a35_0x57c7(_0x364b33,_0x31f024){_0x364b33=_0x364b33-0x113;const _0x542050=a35_0x5420();let _0x57c75e=_0x542050[_0x364b33];return _0x57c75e;}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_0x5420(){const _0x36ef36=['Query\x20completed:\x20Processed\x20','verbose','elapsedTimeMillis','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','length','args','Executing\x20query...','Executing\x20query\x20[','Run\x20Trino\x20queries\x20(streaming)','...','setExtra','output','\x20rows\x20','push','24dNQSkP','10598805yjpLMh','Error:\x20','setPhase','execute','completedSplits','setJobId','catalog','error','526tQfHvT','site','\x20splits','371EBuYpA','query','Statement\x20','1276206MXGgly','jobId','No\x20SQL\x20provided','stats','Catalog:\x20','message','2022ERUzPT','options','1719420KXpHbT','\x20-\x20','640540cCsMHN','processedRows','Executing\x20statement\x20','originalMessage','6185800GaCXtd','description','110958gRdGwL','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','in\x20'];a35_0x5420=function(){return _0x36ef36;};return a35_0x5420();}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a35_0x4eb79a(0x115);[a35_0x4eb79a(0x126)]=a35_0x4eb79a(0x132);async[a35_0x4eb79a(0x13c)](_0x4b6574){const _0x595bc3=a35_0x4eb79a,{options:_0x58f63b,args:_0x39d41f,tdx:_0x3a928e}=_0x4b6574,_0x98e0ad={..._0x58f63b,'limitStructuredFormats':!![]},_0x15e96b=_0x39d41f[0x0],_0x437442=_0x58f63b['file'];let _0x292230;try{if(_0x437442)_0x292230=readSqlStatementsFromFile(_0x437442);else{if(_0x15e96b==='-')_0x292230=await readSqlStatementsFromStdin();else{if(_0x15e96b&&isSqlFilePath(_0x15e96b))_0x292230=readSqlStatementsFromFile(_0x15e96b);else{if(_0x15e96b)_0x292230=splitSqlStatements(_0x15e96b);else throw new Error(_0x595bc3(0x119));}}}}catch(_0x2c40b5){return console[_0x595bc3(0x140)](_0x595bc3(0x13a)+_0x2c40b5[_0x595bc3(0x11c)]),0x1;}const _0x4f125a=_0x58f63b['database']||'information_schema',_0x53d11a=_0x58f63b[_0x595bc3(0x13f)];try{const _0x2e35ef=[],_0x4b141f=!!_0x58f63b[_0x595bc3(0x135)];for(let _0x12b751=0x0;_0x12b751<_0x292230[_0x595bc3(0x12e)];_0x12b751++){const _0x246b50=_0x292230[_0x12b751],_0xe696fa=_0x12b751+0x1,_0x1d5f74=_0x292230[_0x595bc3(0x12e)],_0x4c6600=_0x1d5f74>0x1;_0x58f63b['verbose']&&(console[_0x595bc3(0x140)]('\x0a'+(_0x4c6600?_0x595bc3(0x116)+_0xe696fa+'/'+_0x1d5f74+':':'')),console[_0x595bc3(0x140)]('Site:\x20'+_0x58f63b[_0x595bc3(0x142)]),console['error'](_0x595bc3(0x11b)+(_0x53d11a||'td')),console[_0x595bc3(0x140)]('Schema:\x20'+_0x4f125a),console[_0x595bc3(0x140)]('SQL:\x20'+_0x246b50));const _0x40b04c=_0x4c6600?_0x595bc3(0x123)+_0xe696fa+'/'+_0x1d5f74+_0x595bc3(0x133):_0x595bc3(0x130);try{const _0x1a0e89=await withProgressSpinner(_0x40b04c,async _0x420eee=>{const _0xa47e44=_0x595bc3,_0x291485=await _0x3a928e[_0xa47e44(0x115)]['execute'](_0x246b50,{'catalog':_0x53d11a,'schema':_0x4f125a,'onJobId':_0x1fdc83=>{const _0x1e38cb=_0xa47e44;_0x420eee[_0x1e38cb(0x13e)](_0x1fdc83);},'onProgress':_0x3e8fd4=>{const _0x488ecb=_0xa47e44;_0x420eee[_0x488ecb(0x13b)](_0x488ecb(0x131)+_0x3e8fd4['state']+']'),_0x420eee[_0x488ecb(0x134)](formatRows(_0x3e8fd4[_0x488ecb(0x122)])+'\x20rows\x20'+_0x3e8fd4[_0x488ecb(0x13d)]+'/'+_0x3e8fd4['totalSplits']+_0x488ecb(0x113));}});return _0x291485;},{'verbose':_0x58f63b[_0x595bc3(0x12b)]}),_0x12d1a4=_0x1a0e89['data'],_0x2c9bad=_0x12d1a4['jobId']?'\x20[Job\x20ID:\x20'+_0x12d1a4[_0x595bc3(0x118)]+']':'',_0x395e33=_0x4c6600?'Statement\x20'+_0xe696fa+'/'+_0x1d5f74+_0x595bc3(0x120):'';console[_0x595bc3(0x140)]('✔\x20'+_0x395e33+_0x595bc3(0x12a)+formatRows(_0x12d1a4[_0x595bc3(0x11a)]['processedRows'])+_0x595bc3(0x136)+(_0x595bc3(0x129)+formatElapsed(_0x12d1a4[_0x595bc3(0x11a)][_0x595bc3(0x12c)])+_0x2c9bad));if(_0x4c6600&&_0x4b141f){const _0x29a66b=resolveOutputOptions(_0x98e0ad),_0x159d25=await formatQueryOutput(_0x12d1a4,_0x29a66b);_0x2e35ef[_0x595bc3(0x137)](_0x159d25);}else await handleQueryOutput(_0x12d1a4,_0x98e0ad);}catch(_0x2ebbb5){const _0x4f01e5=_0x4c6600?_0x595bc3(0x116)+_0xe696fa+'/'+_0x1d5f74+':\x0a':'',_0x4d0dfe=_0x2ebbb5 instanceof SDKError?_0x2ebbb5[_0x595bc3(0x124)]:_0x2ebbb5[_0x595bc3(0x11c)];return console[_0x595bc3(0x140)](''+_0x4f01e5+_0x4d0dfe),0x1;}}if(_0x292230[_0x595bc3(0x12e)]>0x1&&_0x4b141f&&_0x2e35ef[_0x595bc3(0x12e)]>0x0){const _0x46d879=_0x2e35ef['join']('\x0a');writeFileSync(_0x58f63b[_0x595bc3(0x135)],_0x46d879),console[_0x595bc3(0x140)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x58f63b[_0x595bc3(0x135)]);}return 0x0;}catch(_0x3bf6a1){throw _0x3bf6a1;}}['validate'](_0x1ecd04){const _0x4938fd=a35_0x4eb79a,_0x445e70=_0x1ecd04[_0x4938fd(0x12f)][0x0],_0x56ec4b=_0x1ecd04[_0x4938fd(0x11e)]['file'];if(!_0x445e70&&!_0x56ec4b)return _0x4938fd(0x12d);if(_0x445e70&&_0x56ec4b)return _0x4938fd(0x128);return undefined;}}
@@ -1 +1 @@
1
- const a36_0x418847=a36_0x20c7;(function(_0x5522c7,_0x374abc){const _0x48573=a36_0x20c7,_0x4b03cb=_0x5522c7();while(!![]){try{const _0x417a02=-parseInt(_0x48573(0x24f))/0x1*(parseInt(_0x48573(0x251))/0x2)+parseInt(_0x48573(0x21c))/0x3*(-parseInt(_0x48573(0x207))/0x4)+-parseInt(_0x48573(0x22a))/0x5+parseInt(_0x48573(0x259))/0x6+-parseInt(_0x48573(0x274))/0x7+parseInt(_0x48573(0x26f))/0x8+parseInt(_0x48573(0x1f0))/0x9;if(_0x417a02===_0x374abc)break;else _0x4b03cb['push'](_0x4b03cb['shift']());}catch(_0x2d54ce){_0x4b03cb['push'](_0x4b03cb['shift']());}}}(a36_0x25bb,0x6a1a8));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a36_0x25bd82 from'chalk';function a36_0x25bb(){const _0x1d49c8=['success','schedule:history','Updating\x20schedule:\x20','m\x20ago','schedules','pagination','file','552408ggAVEl','priority','Creating\x20schedule:\x20','max','list','trim','Creating\x20schedule...','Update\x20a\x20scheduled\x20query','\x20\x20Database:\x20','📅\x20','just\x20now','\x20\x20→\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','create','count','Query\x20file\x20is\x20empty','job_id','schedule:delete','validate','in\x20','verbose','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','6309720RLKAtx','\x20(showing\x20','error','query','queryUrl','4698953ehnWMn','database','Updating\x20schedule...','scheduled_at','padEnd','\x20\x20Cron:\x20','next_run_at','13933314HIFjFl','soon','engine_version','toLocaleDateString','data','Delete\x20a\x20scheduled\x20query','args','map','created_at','never','execute','green','user','round','substring','schedule:create','delay','Listing\x20scheduled\x20queries...','INVALID_ARGUMENT','time_zone','type','List\x20scheduled\x20queries','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','8MiJAMG','/app/queries/editor?queryId=','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','keys','queries','timezone','Running\x20schedule...','has_next_page','Schedule\x20run\x20submitted:\x20','nextRun','Found\x20','run','name','d\x20ago','ended_at','\x20\x20Timezone:\x20','log','Failed\x20to\x20read\x20file:\x20','listQueries','Cancelled','start_at','1193922KHRafE','yes','lastRun','Getting\x20schedule\x20history...','abs','\x20job','json','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','Running\x20schedule:\x20','length','Showing\x20first\x20','schedule:run','\x20created','last_job','1759130wEhnwJ','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','show','dim','status','No\x20scheduled\x20queries\x20found','history','output','...','repeat','engineVersion','format','jsonl','utf-8','num','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','description','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','\x20\x20Num:\x20','join','Schedule\x20created:\x20','Show\x20schedule\x20details','Getting\x20schedule\x20details...','retryLimit','red','\x20\x20Type:\x20','update','retry_limit','result','Schedule\x20deleted:\x20','\x20scheduled\x20quer','trino','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','Run\x20a\x20scheduled\x20query\x20immediately','statusIcon','cron','user_name','43819kkRPwo','table','8CXrJyo'];a36_0x25bb=function(){return _0x1d49c8;};return a36_0x25bb();}function formatRelativeTime(_0x37d463){const _0x47c7e5=a36_0x20c7,_0x4fe51d=new Date(_0x37d463),_0x5c9509=new Date(),_0x1afa5e=_0x4fe51d['getTime']()-_0x5c9509['getTime'](),_0x4ae70d=Math[_0x47c7e5(0x220)](_0x1afa5e)/0x3e8,_0x7308ce=_0x1afa5e<0x0;if(_0x4ae70d<0x3c)return _0x7308ce?_0x47c7e5(0x263):_0x47c7e5(0x1f1);else{if(_0x4ae70d<0xe10){const _0x1e87e3=Math[_0x47c7e5(0x1fd)](_0x4ae70d/0x3c);return _0x7308ce?_0x1e87e3+_0x47c7e5(0x255):_0x47c7e5(0x26c)+_0x1e87e3+'m';}else{if(_0x4ae70d<0x15180){const _0xaf6b4a=Math[_0x47c7e5(0x1fd)](_0x4ae70d/0xe10);return _0x7308ce?_0xaf6b4a+'h\x20ago':'in\x20'+_0xaf6b4a+'h';}else{if(_0x4ae70d<0x93a80){const _0x3f95ef=Math['round'](_0x4ae70d/0x15180);return _0x7308ce?_0x3f95ef+_0x47c7e5(0x214):'in\x20'+_0x3f95ef+'d';}else return _0x4fe51d[_0x47c7e5(0x1f3)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x418847(0x213)]='schedule:list';[a36_0x418847(0x23a)]=a36_0x418847(0x205);async[a36_0x418847(0x1fa)](_0x18f68e){const _0x2dd43a=a36_0x418847,{options:_0x5cc302,args:_0x4beffe,tdx:_0x490721}=_0x18f68e,_0x5beec2=resolveLimit(_0x5cc302['limit'],DEFAULT_DISPLAY_LIMIT),_0x2393ba=_0x4beffe[0x0],_0x58568f=_0x2393ba?'Searching\x20scheduled\x20queries\x20matching\x20\x22'+_0x2393ba+'\x22...':_0x2dd43a(0x201),_0x220d37=await withSpinner(_0x58568f,()=>_0x490721[_0x2dd43a(0x256)][_0x2dd43a(0x219)]({'limit':_0x5beec2,'scheduled':!![],'pattern':_0x2393ba}),{'verbose':_0x5cc302[_0x2dd43a(0x26d)]}),_0x3d4c4c=_0x220d37[_0x2dd43a(0x1f4)][_0x2dd43a(0x20b)],_0xee1747=_0x220d37[_0x2dd43a(0x1f4)][_0x2dd43a(0x257)][_0x2dd43a(0x20e)],_0x2d3821=_0x2393ba?'\x20matching\x20\x22'+_0x2393ba+'\x22':'';_0xee1747?console['error'](_0x2dd43a(0x226)+_0x3d4c4c[_0x2dd43a(0x225)]+'\x20schedules'+_0x2d3821+'\x20(use\x20--limit\x20to\x20see\x20more)'):console[_0x2dd43a(0x271)](_0x2dd43a(0x211)+_0x3d4c4c[_0x2dd43a(0x225)]+_0x2dd43a(0x248)+(_0x3d4c4c['length']!==0x1?'ies':'y')+_0x2d3821);if(_0x5cc302['format']===_0x2dd43a(0x222)||_0x5cc302['format']===_0x2dd43a(0x236)||_0x5cc302[_0x2dd43a(0x235)]===_0x2dd43a(0x250)||_0x5cc302['format']==='tsv'){const _0x2a2e0d=_0x3d4c4c[_0x2dd43a(0x1f7)](_0xd43633=>({'id':_0xd43633['id'],'name':_0xd43633[_0x2dd43a(0x213)],'cron':_0xd43633[_0x2dd43a(0x24d)],'database':_0xd43633[_0x2dd43a(0x275)]?.[_0x2dd43a(0x213)],'type':_0xd43633['type'],'timezone':_0xd43633[_0x2dd43a(0x203)],'user_name':_0xd43633[_0x2dd43a(0x1fc)]?.[_0x2dd43a(0x213)],'updated_at':_0xd43633['updated_at'],'next_run_at':_0xd43633[_0x2dd43a(0x1ef)],'last_job_status':_0xd43633['last_job']?.['status']}));await handleSDKOutput(_0x2a2e0d,_0x5cc302);}else{if(_0x3d4c4c[_0x2dd43a(0x225)]===0x0)console[_0x2dd43a(0x217)](_0x2dd43a(0x22f));else{const _0x472561=_0x5cc302['site'],_0x83c381=_0x3d4c4c['map'](_0x17d606=>{const _0x5931ae=_0x2dd43a,_0x31e569=_0x17d606[_0x5931ae(0x229)]?.[_0x5931ae(0x22e)]?_0x17d606['last_job'][_0x5931ae(0x22e)]===_0x5931ae(0x252)?'✓':'✗':'-',_0x2b3301=_0x17d606[_0x5931ae(0x229)]?.[_0x5931ae(0x215)]?formatRelativeTime(_0x17d606[_0x5931ae(0x229)][_0x5931ae(0x215)]):_0x5931ae(0x1f9),_0x25fad0=_0x17d606[_0x5931ae(0x1ef)]?formatRelativeTime(_0x17d606[_0x5931ae(0x1ef)]):'-',_0x2ec905=_0x17d606[_0x5931ae(0x24d)]||'',_0x5e1bf4=_0x17d606['name']||'(unnamed)',_0x2b11df=getConsoleUrl(_0x472561,_0x5931ae(0x208)+_0x17d606['id']);return{'statusIcon':_0x31e569,'lastRun':_0x2b3301,'nextRun':_0x25fad0,'cron':_0x2ec905,'name':_0x5e1bf4,'queryUrl':_0x2b11df,'status':_0x17d606[_0x5931ae(0x229)]?.[_0x5931ae(0x22e)]};}),_0x181097=Math[_0x2dd43a(0x25c)](..._0x83c381[_0x2dd43a(0x1f7)](_0x3fca9c=>_0x3fca9c[_0x2dd43a(0x21e)]['length'])),_0x3ff842=Math[_0x2dd43a(0x25c)](..._0x83c381[_0x2dd43a(0x1f7)](_0xaca8e5=>_0xaca8e5[_0x2dd43a(0x210)][_0x2dd43a(0x225)])),_0x2c9532=Math['max'](..._0x83c381[_0x2dd43a(0x1f7)](_0x2e75e7=>_0x2e75e7['cron'][_0x2dd43a(0x225)])),_0x3cddd3=_0x83c381[_0x2dd43a(0x1f7)](_0x44d38f=>{const _0x551e69=_0x2dd43a,_0x10ea5c=_0x44d38f[_0x551e69(0x22e)]==='success'?a36_0x25bd82[_0x551e69(0x1fb)](_0x44d38f[_0x551e69(0x24c)]):_0x44d38f['status']===_0x551e69(0x271)?a36_0x25bd82[_0x551e69(0x242)](_0x44d38f[_0x551e69(0x24c)]):a36_0x25bd82[_0x551e69(0x22d)](_0x44d38f['statusIcon']),_0x3a450a=_0x44d38f[_0x551e69(0x21e)][_0x551e69(0x1ed)](_0x181097),_0x14e7ac=_0x44d38f[_0x551e69(0x210)][_0x551e69(0x1ed)](_0x3ff842),_0x3d2749=_0x44d38f['cron']?a36_0x25bd82['cyan'](_0x44d38f[_0x551e69(0x24d)][_0x551e69(0x1ed)](_0x2c9532)):'\x20'[_0x551e69(0x233)](_0x2c9532),_0x290fec=hyperlink(_0x44d38f[_0x551e69(0x213)],_0x44d38f[_0x551e69(0x273)]);return _0x551e69(0x262)+_0x10ea5c+'\x20'+_0x3a450a+_0x551e69(0x264)+_0x14e7ac+'\x20\x20'+_0x3d2749+'\x20\x20'+_0x290fec;});await writeOutput(_0x3cddd3[_0x2dd43a(0x23d)]('\x0a'),_0x5cc302[_0x2dd43a(0x231)],_0x2dd43a(0x25d));}}return 0x0;}}function a36_0x20c7(_0x4cbde,_0x22adf4){_0x4cbde=_0x4cbde-0x1eb;const _0x25bb72=a36_0x25bb();let _0x20c77d=_0x25bb72[_0x4cbde];return _0x20c77d;}export class ScheduleShowCommand extends BaseCommand{['name']='schedule:show';[a36_0x418847(0x23a)]=a36_0x418847(0x23f);[a36_0x418847(0x26b)](_0x42497c){const _0x4e1d38=a36_0x418847,_0x5cc144=_0x42497c[_0x4e1d38(0x1f6)][0x0];if(!_0x5cc144)return _0x4e1d38(0x22b);return undefined;}async[a36_0x418847(0x1fa)](_0x23d648){const _0x38543b=a36_0x418847,{options:_0x3b57bd,args:_0x260401,tdx:_0xf0cd36}=_0x23d648,_0x31afea=_0x260401[0x0],_0x584b0a=await withSpinner(_0x38543b(0x240),()=>_0xf0cd36['schedules'][_0x38543b(0x22c)](_0x31afea),{'verbose':_0x3b57bd[_0x38543b(0x26d)]}),_0x556a8d=_0x584b0a['data'],_0x43b900={'name':_0x556a8d[_0x38543b(0x213)],'cron':_0x556a8d[_0x38543b(0x24d)],'database':_0x556a8d[_0x38543b(0x275)],'type':_0x556a8d[_0x38543b(0x204)],'timezone':_0x556a8d[_0x38543b(0x20c)],'user_name':_0x556a8d[_0x38543b(0x24e)],'created_at':_0x556a8d[_0x38543b(0x1f8)],'engine_version':_0x556a8d[_0x38543b(0x1f2)],'executing_user_id':_0x556a8d['executing_user_id'],'query':_0x556a8d[_0x38543b(0x272)],'delay':_0x556a8d['delay'],'priority':_0x556a8d[_0x38543b(0x25a)],'retry_limit':_0x556a8d[_0x38543b(0x245)],..._0x556a8d[_0x38543b(0x246)]&&{'result':_0x556a8d[_0x38543b(0x246)]}};return await handleSingleObjectOutput(_0x43b900,_0x3b57bd),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x418847(0x213)]=a36_0x418847(0x1ff);['description']='Create\x20a\x20scheduled\x20query';[a36_0x418847(0x26b)](_0x4db869){const _0x59f2b8=a36_0x418847,_0x5f3c63=_0x4db869[_0x59f2b8(0x1f6)][0x0];if(!_0x5f3c63)return _0x59f2b8(0x223);const _0x53dc10=_0x4db869['options'];if(!_0x53dc10['database'])return _0x59f2b8(0x239);return undefined;}async[a36_0x418847(0x1fa)](_0x30fac5){const _0x1f763c=a36_0x418847,{options:_0x3a2b63,args:_0x136969,tdx:_0xc9cc7c}=_0x30fac5,_0x459c94=_0x136969[0x0],_0x58a5d0=_0x3a2b63,_0x351367=_0x58a5d0[_0x1f763c(0x275)],_0x160f98=_0x58a5d0[_0x1f763c(0x258)],_0xfc241d=_0x58a5d0[_0x1f763c(0x204)]||_0x1f763c(0x249);let _0x8540e9;try{_0x8540e9=readFileSync(_0x160f98,_0x1f763c(0x237))[_0x1f763c(0x25e)]();}catch(_0x4531df){throw new SDKError(ErrorCode[_0x1f763c(0x202)],_0x1f763c(0x218)+_0x160f98,_0x4531df instanceof Error?_0x4531df:undefined);}if(!_0x8540e9)throw new SDKError(ErrorCode[_0x1f763c(0x202)],_0x1f763c(0x268));const _0x555d77={'database':_0x351367,'query':_0x8540e9,'type':_0xfc241d};if(_0x58a5d0[_0x1f763c(0x24d)])_0x555d77[_0x1f763c(0x24d)]=_0x58a5d0[_0x1f763c(0x24d)];if(_0x58a5d0[_0x1f763c(0x20c)])_0x555d77[_0x1f763c(0x20c)]=_0x58a5d0['timezone'];if(_0x58a5d0[_0x1f763c(0x200)]!==undefined)_0x555d77[_0x1f763c(0x200)]=Number(_0x58a5d0[_0x1f763c(0x200)]);if(_0x58a5d0['priority']!==undefined)_0x555d77[_0x1f763c(0x25a)]=Number(_0x58a5d0[_0x1f763c(0x25a)]);if(_0x58a5d0[_0x1f763c(0x241)]!==undefined)_0x555d77['retry_limit']=Number(_0x58a5d0[_0x1f763c(0x241)]);if(_0x58a5d0[_0x1f763c(0x234)])_0x555d77[_0x1f763c(0x1f2)]=_0x58a5d0[_0x1f763c(0x234)];if(_0x58a5d0[_0x1f763c(0x246)])_0x555d77[_0x1f763c(0x246)]=_0x58a5d0[_0x1f763c(0x246)];if(_0x3a2b63[_0x1f763c(0x26d)]){console[_0x1f763c(0x271)](_0x1f763c(0x25b)+_0x459c94),console[_0x1f763c(0x271)](_0x1f763c(0x261)+_0x351367),console[_0x1f763c(0x271)](_0x1f763c(0x243)+_0xfc241d);if(_0x555d77[_0x1f763c(0x24d)])console[_0x1f763c(0x271)](_0x1f763c(0x1ee)+_0x555d77['cron']);if(_0x555d77['timezone'])console['error'](_0x1f763c(0x216)+_0x555d77[_0x1f763c(0x20c)]);}const _0x57102d=await withSpinner(_0x1f763c(0x25f),()=>_0xc9cc7c['schedules'][_0x1f763c(0x266)](_0x459c94,_0x555d77),{'verbose':_0x3a2b63[_0x1f763c(0x26d)]});return console[_0x1f763c(0x271)](_0x1f763c(0x23e)+_0x57102d[_0x1f763c(0x1f4)][_0x1f763c(0x213)]),await handleSingleObjectOutput(_0x57102d[_0x1f763c(0x1f4)],_0x3a2b63),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x418847(0x213)]='schedule:update';[a36_0x418847(0x23a)]=a36_0x418847(0x260);['validate'](_0x324562){const _0x565c38=a36_0x418847,_0x4d489e=_0x324562[_0x565c38(0x1f6)][0x0];if(!_0x4d489e)return _0x565c38(0x23b);return undefined;}async[a36_0x418847(0x1fa)](_0x58111f){const _0x5a0c4e=a36_0x418847,{options:_0x4ea755,args:_0x3025cb,tdx:_0x4dc110}=_0x58111f,_0x6ee3bb=_0x3025cb[0x0],_0x2ee134=_0x4ea755,_0x34ff09={};if(_0x2ee134[_0x5a0c4e(0x275)])_0x34ff09[_0x5a0c4e(0x275)]=_0x2ee134['database'];if(_0x2ee134['type'])_0x34ff09[_0x5a0c4e(0x204)]=_0x2ee134[_0x5a0c4e(0x204)];if(_0x2ee134[_0x5a0c4e(0x24d)])_0x34ff09[_0x5a0c4e(0x24d)]=_0x2ee134[_0x5a0c4e(0x24d)];if(_0x2ee134[_0x5a0c4e(0x20c)])_0x34ff09[_0x5a0c4e(0x20c)]=_0x2ee134['timezone'];if(_0x2ee134[_0x5a0c4e(0x200)]!==undefined)_0x34ff09['delay']=Number(_0x2ee134['delay']);if(_0x2ee134[_0x5a0c4e(0x25a)]!==undefined)_0x34ff09[_0x5a0c4e(0x25a)]=Number(_0x2ee134[_0x5a0c4e(0x25a)]);if(_0x2ee134['retryLimit']!==undefined)_0x34ff09[_0x5a0c4e(0x245)]=Number(_0x2ee134[_0x5a0c4e(0x241)]);if(_0x2ee134['engineVersion'])_0x34ff09['engine_version']=_0x2ee134[_0x5a0c4e(0x234)];if(_0x2ee134['result'])_0x34ff09[_0x5a0c4e(0x246)]=_0x2ee134[_0x5a0c4e(0x246)];if(_0x2ee134[_0x5a0c4e(0x258)])try{_0x34ff09[_0x5a0c4e(0x272)]=readFileSync(_0x2ee134[_0x5a0c4e(0x258)],_0x5a0c4e(0x237))[_0x5a0c4e(0x25e)]();}catch(_0x1a0b58){throw new SDKError(ErrorCode[_0x5a0c4e(0x202)],_0x5a0c4e(0x218)+_0x2ee134[_0x5a0c4e(0x258)],_0x1a0b58 instanceof Error?_0x1a0b58:undefined);}if(Object[_0x5a0c4e(0x20a)](_0x34ff09)[_0x5a0c4e(0x225)]===0x0)throw new SDKError(ErrorCode[_0x5a0c4e(0x202)],_0x5a0c4e(0x206));if(_0x4ea755[_0x5a0c4e(0x26d)]){console[_0x5a0c4e(0x271)](_0x5a0c4e(0x254)+_0x6ee3bb);for(const [_0x5609a1,_0x5712c2]of Object['entries'](_0x34ff09)){_0x5609a1===_0x5a0c4e(0x272)?console['error']('\x20\x20'+_0x5609a1+':\x20'+_0x5712c2[_0x5a0c4e(0x1fe)](0x0,0x32)+_0x5a0c4e(0x232)):console[_0x5a0c4e(0x271)]('\x20\x20'+_0x5609a1+':\x20'+_0x5712c2);}}const _0x34fdf=await withSpinner(_0x5a0c4e(0x1eb),()=>_0x4dc110[_0x5a0c4e(0x256)][_0x5a0c4e(0x244)](_0x6ee3bb,_0x34ff09),{'verbose':_0x4ea755[_0x5a0c4e(0x26d)]});return console[_0x5a0c4e(0x271)]('Schedule\x20updated:\x20'+_0x34fdf[_0x5a0c4e(0x1f4)][_0x5a0c4e(0x213)]),await handleSingleObjectOutput(_0x34fdf[_0x5a0c4e(0x1f4)],_0x4ea755),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x418847(0x213)]=a36_0x418847(0x26a);[a36_0x418847(0x23a)]=a36_0x418847(0x1f5);[a36_0x418847(0x26b)](_0x3939fd){const _0xd86261=a36_0x418847,_0x19d019=_0x3939fd[_0xd86261(0x1f6)][0x0];if(!_0x19d019)return _0xd86261(0x265);return undefined;}async[a36_0x418847(0x1fa)](_0x39fd07){const _0x368f0a=a36_0x418847,{options:_0x5d03ae,args:_0x44d204,tdx:_0x316f6f}=_0x39fd07,_0x253406=_0x44d204[0x0];if(!_0x5d03ae[_0x368f0a(0x21d)]){const _0x34eade=await confirm(_0x368f0a(0x26e)+_0x253406+'\x22?');if(!_0x34eade)return console[_0x368f0a(0x271)](_0x368f0a(0x21a)),0x0;}const _0x3e5d0f=await withSpinner('Deleting\x20schedule...',()=>_0x316f6f[_0x368f0a(0x256)]['delete'](_0x253406),{'verbose':_0x5d03ae['verbose']});return console[_0x368f0a(0x271)](_0x368f0a(0x247)+_0x3e5d0f[_0x368f0a(0x1f4)]['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x418847(0x213)]=a36_0x418847(0x227);[a36_0x418847(0x23a)]=a36_0x418847(0x24b);[a36_0x418847(0x26b)](_0x9ad5aa){const _0x635aeb=a36_0x418847,_0x38ed85=_0x9ad5aa[_0x635aeb(0x1f6)][0x0];if(!_0x38ed85)return _0x635aeb(0x24a);return undefined;}async[a36_0x418847(0x1fa)](_0x50fdd4){const _0x2c335a=a36_0x418847,{options:_0x1f9bb2,args:_0xd1fcc1,tdx:_0x102ae2}=_0x50fdd4,_0x41af14=_0xd1fcc1[0x0],_0x19aa91=_0x1f9bb2,_0x2a46c8=_0x19aa91['time'],_0x3a373d=_0x19aa91[_0x2c335a(0x238)]!==undefined?Number(_0x19aa91[_0x2c335a(0x238)]):undefined;if(_0x1f9bb2['verbose']){console[_0x2c335a(0x271)](_0x2c335a(0x224)+_0x41af14);if(_0x2a46c8)console[_0x2c335a(0x271)]('\x20\x20Time:\x20'+_0x2a46c8);if(_0x3a373d)console[_0x2c335a(0x271)](_0x2c335a(0x23c)+_0x3a373d);}const _0x3f783c=await withSpinner(_0x2c335a(0x20d),()=>_0x102ae2[_0x2c335a(0x256)][_0x2c335a(0x212)](_0x41af14,{'time':_0x2a46c8,'num':_0x3a373d}),{'verbose':_0x1f9bb2['verbose']}),_0x4587e5=_0x3f783c[_0x2c335a(0x1f4)]['jobs'];console[_0x2c335a(0x271)](_0x2c335a(0x20f)+_0x4587e5[_0x2c335a(0x225)]+_0x2c335a(0x221)+(_0x4587e5[_0x2c335a(0x225)]!==0x1?'s':'')+_0x2c335a(0x228));for(const _0x340ac8 of _0x4587e5){console['error']('\x20\x20Job\x20ID:\x20'+_0x340ac8[_0x2c335a(0x269)]);}return await handleSDKOutput(_0x4587e5,_0x1f9bb2),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{['name']=a36_0x418847(0x253);['description']='Show\x20schedule\x20execution\x20history';[a36_0x418847(0x26b)](_0x8473de){const _0x59b5b3=a36_0x418847,_0x35ca05=_0x8473de[_0x59b5b3(0x1f6)][0x0];if(!_0x35ca05)return _0x59b5b3(0x209);return undefined;}async['execute'](_0x412957){const _0x548210=a36_0x418847,{options:_0x53f7c8,args:_0x46311f,tdx:_0xd9424c}=_0x412957,_0x359e01=_0x46311f[0x0],_0x328e5c=_0x53f7c8,_0x5d93a0=_0x328e5c['from']!==undefined?Number(_0x328e5c['from']):undefined,_0x4483a5=_0x328e5c['to']!==undefined?Number(_0x328e5c['to']):undefined,_0x12de43=await withSpinner(_0x548210(0x21f),()=>_0xd9424c[_0x548210(0x256)][_0x548210(0x230)](_0x359e01,{'from':_0x5d93a0,'to':_0x4483a5}),{'verbose':_0x53f7c8['verbose']}),_0x11ad19=_0x12de43[_0x548210(0x1f4)];console['error'](_0x548210(0x211)+_0x11ad19['count']+'\x20execution'+(_0x11ad19[_0x548210(0x267)]!==0x1?'s':'')+_0x548210(0x270)+_0x11ad19['from']+'-'+_0x11ad19['to']+')');const _0x56303c=_0x11ad19['history'][_0x548210(0x1f7)](_0x3c4056=>({'job_id':_0x3c4056[_0x548210(0x269)],'type':_0x3c4056[_0x548210(0x204)],'status':_0x3c4056[_0x548210(0x22e)],'scheduled_at':_0x3c4056[_0x548210(0x1ec)],'created_at':_0x3c4056[_0x548210(0x1f8)],'start_at':_0x3c4056[_0x548210(0x21b)],'end_at':_0x3c4056['end_at']}));return await handleSDKOutput(_0x56303c,_0x53f7c8),0x0;}}
1
+ const a36_0x106265=a36_0x3a6a;(function(_0x30b661,_0x32ffc9){const _0x231eef=a36_0x3a6a,_0x2f9da2=_0x30b661();while(!![]){try{const _0x1f2c84=-parseInt(_0x231eef(0x199))/0x1*(-parseInt(_0x231eef(0x1b0))/0x2)+parseInt(_0x231eef(0x187))/0x3+parseInt(_0x231eef(0x1f9))/0x4+parseInt(_0x231eef(0x193))/0x5*(-parseInt(_0x231eef(0x19c))/0x6)+-parseInt(_0x231eef(0x196))/0x7*(parseInt(_0x231eef(0x1fe))/0x8)+-parseInt(_0x231eef(0x1dd))/0x9+parseInt(_0x231eef(0x1c9))/0xa;if(_0x1f2c84===_0x32ffc9)break;else _0x2f9da2['push'](_0x2f9da2['shift']());}catch(_0x3e7554){_0x2f9da2['push'](_0x2f9da2['shift']());}}}(a36_0x333f,0x91b16));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';function a36_0x3a6a(_0x4079ad,_0x4abc72){_0x4079ad=_0x4079ad-0x17d;const _0x333feb=a36_0x333f();let _0x3a6a98=_0x333feb[_0x4079ad];return _0x3a6a98;}import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a36_0x1652ea from'chalk';function formatRelativeTime(_0x4d4dcb){const _0x3d87d2=a36_0x3a6a,_0x36ff01=new Date(_0x4d4dcb),_0x5aa186=new Date(),_0x50d872=_0x36ff01[_0x3d87d2(0x1b1)]()-_0x5aa186[_0x3d87d2(0x1b1)](),_0x49c181=Math[_0x3d87d2(0x1ff)](_0x50d872)/0x3e8,_0x2c7f7d=_0x50d872<0x0;if(_0x49c181<0x3c)return _0x2c7f7d?_0x3d87d2(0x1d4):_0x3d87d2(0x1b3);else{if(_0x49c181<0xe10){const _0xce5754=Math['round'](_0x49c181/0x3c);return _0x2c7f7d?_0xce5754+'m\x20ago':'in\x20'+_0xce5754+'m';}else{if(_0x49c181<0x15180){const _0x451c98=Math[_0x3d87d2(0x1a3)](_0x49c181/0xe10);return _0x2c7f7d?_0x451c98+'h\x20ago':_0x3d87d2(0x1b6)+_0x451c98+'h';}else{if(_0x49c181<0x93a80){const _0x1d0dad=Math[_0x3d87d2(0x1a3)](_0x49c181/0x15180);return _0x2c7f7d?_0x1d0dad+_0x3d87d2(0x1d9):_0x3d87d2(0x1b6)+_0x1d0dad+'d';}else return _0x36ff01[_0x3d87d2(0x1d7)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x106265(0x1a8)]=a36_0x106265(0x1af);[a36_0x106265(0x1ae)]=a36_0x106265(0x1f2);async['execute'](_0x19bdfa){const _0x319ddb=a36_0x106265,{options:_0x31bddf,args:_0x54bd2d,tdx:_0x119494}=_0x19bdfa,_0x4259a5=resolveLimit(_0x31bddf[_0x319ddb(0x1da)],DEFAULT_DISPLAY_LIMIT),_0x5cdaa8=_0x54bd2d[0x0],_0x937875=_0x5cdaa8?'Searching\x20scheduled\x20queries\x20matching\x20\x22'+_0x5cdaa8+_0x319ddb(0x1bb):_0x319ddb(0x1e2),_0x215459=await withSpinner(_0x937875,()=>_0x119494[_0x319ddb(0x1c0)][_0x319ddb(0x1bc)]({'limit':_0x4259a5,'scheduled':!![],'pattern':_0x5cdaa8}),{'verbose':_0x31bddf[_0x319ddb(0x1b4)]}),_0xfc7870=_0x215459[_0x319ddb(0x1be)][_0x319ddb(0x1a0)],_0x5b3262=_0x215459['data'][_0x319ddb(0x208)]['has_next_page'],_0x47bbcf=_0x5cdaa8?'\x20matching\x20\x22'+_0x5cdaa8+'\x22':'';_0x5b3262?console[_0x319ddb(0x1f8)](_0x319ddb(0x1c2)+_0xfc7870[_0x319ddb(0x1e6)]+_0x319ddb(0x1b9)+_0x47bbcf+_0x319ddb(0x1fb)):console[_0x319ddb(0x1f8)](_0x319ddb(0x1dc)+_0xfc7870[_0x319ddb(0x1e6)]+_0x319ddb(0x1a9)+(_0xfc7870[_0x319ddb(0x1e6)]!==0x1?_0x319ddb(0x17e):'y')+_0x47bbcf);if(_0x31bddf[_0x319ddb(0x1b5)]===_0x319ddb(0x1ef)||_0x31bddf[_0x319ddb(0x1b5)]===_0x319ddb(0x19e)||_0x31bddf[_0x319ddb(0x1b5)]===_0x319ddb(0x186)||_0x31bddf[_0x319ddb(0x1b5)]==='tsv'){const _0x25f49d=_0xfc7870[_0x319ddb(0x201)](_0x54945c=>({'id':_0x54945c['id'],'name':_0x54945c['name'],'cron':_0x54945c[_0x319ddb(0x205)],'database':_0x54945c['database']?.[_0x319ddb(0x1a8)],'type':_0x54945c[_0x319ddb(0x1ee)],'timezone':_0x54945c['time_zone'],'user_name':_0x54945c[_0x319ddb(0x1cf)]?.[_0x319ddb(0x1a8)],'updated_at':_0x54945c[_0x319ddb(0x1fd)],'next_run_at':_0x54945c[_0x319ddb(0x1e5)],'last_job_status':_0x54945c[_0x319ddb(0x1c3)]?.['status']}));await handleSDKOutput(_0x25f49d,_0x31bddf);}else{if(_0xfc7870[_0x319ddb(0x1e6)]===0x0)console['log'](_0x319ddb(0x19d));else{const _0x4d6b8a=_0x31bddf[_0x319ddb(0x18c)],_0x4c9ea8=_0xfc7870[_0x319ddb(0x201)](_0x2a79a0=>{const _0x2d3703=_0x319ddb,_0x51cf64=_0x2a79a0[_0x2d3703(0x1c3)]?.[_0x2d3703(0x1b2)]?_0x2a79a0['last_job'][_0x2d3703(0x1b2)]===_0x2d3703(0x1e4)?'✓':'✗':'-',_0x203785=_0x2a79a0['last_job']?.['ended_at']?formatRelativeTime(_0x2a79a0['last_job'][_0x2d3703(0x1fa)]):_0x2d3703(0x1eb),_0x49c077=_0x2a79a0[_0x2d3703(0x1e5)]?formatRelativeTime(_0x2a79a0[_0x2d3703(0x1e5)]):'-',_0x26ea06=_0x2a79a0[_0x2d3703(0x205)]||'',_0xc3300c=_0x2a79a0[_0x2d3703(0x1a8)]||_0x2d3703(0x1f4),_0x1bbdda=getConsoleUrl(_0x4d6b8a,_0x2d3703(0x182)+_0x2a79a0['id']);return{'statusIcon':_0x51cf64,'lastRun':_0x203785,'nextRun':_0x49c077,'cron':_0x26ea06,'name':_0xc3300c,'queryUrl':_0x1bbdda,'status':_0x2a79a0[_0x2d3703(0x1c3)]?.[_0x2d3703(0x1b2)]};}),_0x14e5ef=Math[_0x319ddb(0x1ce)](..._0x4c9ea8[_0x319ddb(0x201)](_0x50c6ee=>_0x50c6ee[_0x319ddb(0x18f)][_0x319ddb(0x1e6)])),_0x2f3415=Math[_0x319ddb(0x1ce)](..._0x4c9ea8['map'](_0x3a6afa=>_0x3a6afa[_0x319ddb(0x1c1)][_0x319ddb(0x1e6)])),_0x5165ae=Math[_0x319ddb(0x1ce)](..._0x4c9ea8[_0x319ddb(0x201)](_0x2b727a=>_0x2b727a[_0x319ddb(0x205)][_0x319ddb(0x1e6)])),_0x433c18=_0x4c9ea8[_0x319ddb(0x201)](_0x3049f1=>{const _0x392278=_0x319ddb,_0x480fc3=_0x3049f1[_0x392278(0x1b2)]===_0x392278(0x1e4)?a36_0x1652ea[_0x392278(0x209)](_0x3049f1['statusIcon']):_0x3049f1[_0x392278(0x1b2)]==='error'?a36_0x1652ea[_0x392278(0x1b8)](_0x3049f1[_0x392278(0x1c8)]):a36_0x1652ea[_0x392278(0x19b)](_0x3049f1[_0x392278(0x1c8)]),_0x1983fb=_0x3049f1[_0x392278(0x18f)]['padEnd'](_0x14e5ef),_0x496186=_0x3049f1[_0x392278(0x1c1)][_0x392278(0x1e0)](_0x2f3415),_0xb39eb8=_0x3049f1['cron']?a36_0x1652ea['cyan'](_0x3049f1[_0x392278(0x205)][_0x392278(0x1e0)](_0x5165ae)):'\x20'[_0x392278(0x1d0)](_0x5165ae),_0x4859f7=hyperlink(_0x3049f1[_0x392278(0x1a8)],_0x3049f1[_0x392278(0x1f5)]);return _0x392278(0x1f3)+_0x480fc3+'\x20'+_0x1983fb+'\x20\x20→\x20'+_0x496186+'\x20\x20'+_0xb39eb8+'\x20\x20'+_0x4859f7;});await writeOutput(_0x433c18[_0x319ddb(0x195)]('\x0a'),_0x31bddf[_0x319ddb(0x1bf)],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{['name']=a36_0x106265(0x18a);['description']=a36_0x106265(0x1e1);[a36_0x106265(0x19a)](_0x19004b){const _0x427e3e=_0x19004b['args'][0x0];if(!_0x427e3e)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async[a36_0x106265(0x1c6)](_0x2084e3){const _0x1d62d1=a36_0x106265,{options:_0x3f5da4,args:_0x2baef4,tdx:_0x5ac897}=_0x2084e3,_0x78777=_0x2baef4[0x0],_0x4df72a=await withSpinner(_0x1d62d1(0x1ba),()=>_0x5ac897['schedules'][_0x1d62d1(0x17d)](_0x78777),{'verbose':_0x3f5da4[_0x1d62d1(0x1b4)]}),_0x135b4c=_0x4df72a[_0x1d62d1(0x1be)],_0x3df103={'name':_0x135b4c[_0x1d62d1(0x1a8)],'cron':_0x135b4c['cron'],'database':_0x135b4c[_0x1d62d1(0x1d6)],'type':_0x135b4c[_0x1d62d1(0x1ee)],'timezone':_0x135b4c[_0x1d62d1(0x1cc)],'user_name':_0x135b4c[_0x1d62d1(0x1d3)],'created_at':_0x135b4c[_0x1d62d1(0x1bd)],'engine_version':_0x135b4c[_0x1d62d1(0x1b7)],'executing_user_id':_0x135b4c[_0x1d62d1(0x192)],'query':_0x135b4c[_0x1d62d1(0x1df)],'delay':_0x135b4c[_0x1d62d1(0x1ab)],'priority':_0x135b4c[_0x1d62d1(0x1ca)],'retry_limit':_0x135b4c[_0x1d62d1(0x185)],..._0x135b4c['result']&&{'result':_0x135b4c[_0x1d62d1(0x20c)]}};return await handleSingleObjectOutput(_0x3df103,_0x3f5da4),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']='schedule:create';['description']=a36_0x106265(0x181);['validate'](_0x56b1b5){const _0x328987=a36_0x106265,_0x3f9c77=_0x56b1b5[_0x328987(0x207)][0x0];if(!_0x3f9c77)return _0x328987(0x1e9);const _0x511072=_0x56b1b5[_0x328987(0x1a5)];if(!_0x511072[_0x328987(0x1d6)])return _0x328987(0x191);return undefined;}async[a36_0x106265(0x1c6)](_0x42c2be){const _0x5841a9=a36_0x106265,{options:_0x1bea09,args:_0x35d19,tdx:_0x2c009d}=_0x42c2be,_0x6576f0=_0x35d19[0x0],_0x2f95e2=_0x1bea09,_0x4416db=_0x2f95e2[_0x5841a9(0x1d6)],_0x2e0450=_0x2f95e2['file'],_0x52819c=_0x2f95e2[_0x5841a9(0x1ee)]||_0x5841a9(0x180);let _0x4a4a5b;try{_0x4a4a5b=readFileSync(_0x2e0450,_0x5841a9(0x1d1))[_0x5841a9(0x1e8)]();}catch(_0x4a2469){throw new SDKError(ErrorCode[_0x5841a9(0x19f)],'Failed\x20to\x20read\x20file:\x20'+_0x2e0450,_0x4a2469 instanceof Error?_0x4a2469:undefined);}if(!_0x4a4a5b)throw new SDKError(ErrorCode[_0x5841a9(0x19f)],_0x5841a9(0x1f7));const _0x4e34a0={'database':_0x4416db,'query':_0x4a4a5b,'type':_0x52819c};if(_0x2f95e2[_0x5841a9(0x205)])_0x4e34a0[_0x5841a9(0x205)]=_0x2f95e2[_0x5841a9(0x205)];if(_0x2f95e2['timezone'])_0x4e34a0[_0x5841a9(0x1cc)]=_0x2f95e2[_0x5841a9(0x1cc)];if(_0x2f95e2[_0x5841a9(0x1ab)]!==undefined)_0x4e34a0[_0x5841a9(0x1ab)]=Number(_0x2f95e2[_0x5841a9(0x1ab)]);if(_0x2f95e2[_0x5841a9(0x1ca)]!==undefined)_0x4e34a0['priority']=Number(_0x2f95e2['priority']);if(_0x2f95e2[_0x5841a9(0x183)]!==undefined)_0x4e34a0[_0x5841a9(0x185)]=Number(_0x2f95e2[_0x5841a9(0x183)]);if(_0x2f95e2['engineVersion'])_0x4e34a0['engine_version']=_0x2f95e2[_0x5841a9(0x1cd)];if(_0x2f95e2['result'])_0x4e34a0[_0x5841a9(0x20c)]=_0x2f95e2[_0x5841a9(0x20c)];if(_0x1bea09[_0x5841a9(0x1b4)]){console[_0x5841a9(0x1f8)]('Creating\x20schedule:\x20'+_0x6576f0),console[_0x5841a9(0x1f8)](_0x5841a9(0x1cb)+_0x4416db),console[_0x5841a9(0x1f8)](_0x5841a9(0x204)+_0x52819c);if(_0x4e34a0['cron'])console[_0x5841a9(0x1f8)](_0x5841a9(0x1a1)+_0x4e34a0[_0x5841a9(0x205)]);if(_0x4e34a0[_0x5841a9(0x1cc)])console[_0x5841a9(0x1f8)](_0x5841a9(0x1c7)+_0x4e34a0['timezone']);}const _0xc761a8=await withSpinner('Creating\x20schedule...',()=>_0x2c009d['schedules'][_0x5841a9(0x1fc)](_0x6576f0,_0x4e34a0),{'verbose':_0x1bea09[_0x5841a9(0x1b4)]});return console[_0x5841a9(0x1f8)](_0x5841a9(0x1ad)+_0xc761a8[_0x5841a9(0x1be)][_0x5841a9(0x1a8)]),await handleSingleObjectOutput(_0xc761a8[_0x5841a9(0x1be)],_0x1bea09),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x106265(0x1a8)]=a36_0x106265(0x1ed);[a36_0x106265(0x1ae)]=a36_0x106265(0x198);[a36_0x106265(0x19a)](_0x4ac4c5){const _0x5c259f=a36_0x106265,_0x48b93b=_0x4ac4c5['args'][0x0];if(!_0x48b93b)return _0x5c259f(0x1db);return undefined;}async[a36_0x106265(0x1c6)](_0x30b144){const _0x28b3a7=a36_0x106265,{options:_0x1c65b0,args:_0x16b714,tdx:_0x119f7c}=_0x30b144,_0x438225=_0x16b714[0x0],_0x44631f=_0x1c65b0,_0x21f7f5={};if(_0x44631f[_0x28b3a7(0x1d6)])_0x21f7f5[_0x28b3a7(0x1d6)]=_0x44631f[_0x28b3a7(0x1d6)];if(_0x44631f[_0x28b3a7(0x1ee)])_0x21f7f5[_0x28b3a7(0x1ee)]=_0x44631f[_0x28b3a7(0x1ee)];if(_0x44631f[_0x28b3a7(0x205)])_0x21f7f5[_0x28b3a7(0x205)]=_0x44631f[_0x28b3a7(0x205)];if(_0x44631f[_0x28b3a7(0x1cc)])_0x21f7f5['timezone']=_0x44631f[_0x28b3a7(0x1cc)];if(_0x44631f[_0x28b3a7(0x1ab)]!==undefined)_0x21f7f5[_0x28b3a7(0x1ab)]=Number(_0x44631f[_0x28b3a7(0x1ab)]);if(_0x44631f[_0x28b3a7(0x1ca)]!==undefined)_0x21f7f5['priority']=Number(_0x44631f[_0x28b3a7(0x1ca)]);if(_0x44631f['retryLimit']!==undefined)_0x21f7f5[_0x28b3a7(0x185)]=Number(_0x44631f['retryLimit']);if(_0x44631f['engineVersion'])_0x21f7f5[_0x28b3a7(0x1b7)]=_0x44631f[_0x28b3a7(0x1cd)];if(_0x44631f['result'])_0x21f7f5[_0x28b3a7(0x20c)]=_0x44631f[_0x28b3a7(0x20c)];if(_0x44631f[_0x28b3a7(0x188)])try{_0x21f7f5[_0x28b3a7(0x1df)]=readFileSync(_0x44631f[_0x28b3a7(0x188)],'utf-8')[_0x28b3a7(0x1e8)]();}catch(_0x439997){throw new SDKError(ErrorCode[_0x28b3a7(0x19f)],'Failed\x20to\x20read\x20file:\x20'+_0x44631f[_0x28b3a7(0x188)],_0x439997 instanceof Error?_0x439997:undefined);}if(Object['keys'](_0x21f7f5)[_0x28b3a7(0x1e6)]===0x0)throw new SDKError(ErrorCode[_0x28b3a7(0x19f)],_0x28b3a7(0x1ea));if(_0x1c65b0[_0x28b3a7(0x1b4)]){console[_0x28b3a7(0x1f8)](_0x28b3a7(0x1de)+_0x438225);for(const [_0x2a3fc6,_0x5ac9d5]of Object[_0x28b3a7(0x1f6)](_0x21f7f5)){_0x2a3fc6==='query'?console[_0x28b3a7(0x1f8)]('\x20\x20'+_0x2a3fc6+':\x20'+_0x5ac9d5[_0x28b3a7(0x1d8)](0x0,0x32)+_0x28b3a7(0x189)):console['error']('\x20\x20'+_0x2a3fc6+':\x20'+_0x5ac9d5);}}const _0x2759c8=await withSpinner(_0x28b3a7(0x197),()=>_0x119f7c[_0x28b3a7(0x1c0)][_0x28b3a7(0x20b)](_0x438225,_0x21f7f5),{'verbose':_0x1c65b0[_0x28b3a7(0x1b4)]});return console[_0x28b3a7(0x1f8)]('Schedule\x20updated:\x20'+_0x2759c8['data'][_0x28b3a7(0x1a8)]),await handleSingleObjectOutput(_0x2759c8[_0x28b3a7(0x1be)],_0x1c65b0),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{['name']='schedule:delete';[a36_0x106265(0x1ae)]=a36_0x106265(0x184);[a36_0x106265(0x19a)](_0x2f1765){const _0x3fd6a4=a36_0x106265,_0x35ec4a=_0x2f1765[_0x3fd6a4(0x207)][0x0];if(!_0x35ec4a)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async['execute'](_0x19688e){const _0x3d1e5e=a36_0x106265,{options:_0x1d2eb4,args:_0x1ad47c,tdx:_0x41c54d}=_0x19688e,_0x3ae335=_0x1ad47c[0x0];if(!_0x1d2eb4[_0x3d1e5e(0x1c4)]){const _0x18b371=await confirm(_0x3d1e5e(0x1f0)+_0x3ae335+'\x22?');if(!_0x18b371)return console['error'](_0x3d1e5e(0x1d5)),0x0;}const _0x5bb167=await withSpinner(_0x3d1e5e(0x1ec),()=>_0x41c54d[_0x3d1e5e(0x1c0)][_0x3d1e5e(0x1d2)](_0x3ae335),{'verbose':_0x1d2eb4[_0x3d1e5e(0x1b4)]});return console['error']('Schedule\x20deleted:\x20'+_0x5bb167[_0x3d1e5e(0x1be)][_0x3d1e5e(0x1a8)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x106265(0x1a8)]=a36_0x106265(0x1ac);['description']=a36_0x106265(0x200);[a36_0x106265(0x19a)](_0xa9afcb){const _0x9dd1be=a36_0x106265,_0xacc39c=_0xa9afcb[_0x9dd1be(0x207)][0x0];if(!_0xacc39c)return _0x9dd1be(0x1a6);return undefined;}async[a36_0x106265(0x1c6)](_0x5732b6){const _0x3a02d4=a36_0x106265,{options:_0x50a06b,args:_0x45f51b,tdx:_0x575296}=_0x5732b6,_0x21b551=_0x45f51b[0x0],_0x4b84ca=_0x50a06b,_0xaab950=_0x4b84ca['time'],_0x54b61f=_0x4b84ca[_0x3a02d4(0x1a4)]!==undefined?Number(_0x4b84ca['num']):undefined;if(_0x50a06b['verbose']){console[_0x3a02d4(0x1f8)](_0x3a02d4(0x20a)+_0x21b551);if(_0xaab950)console[_0x3a02d4(0x1f8)](_0x3a02d4(0x1e7)+_0xaab950);if(_0x54b61f)console[_0x3a02d4(0x1f8)]('\x20\x20Num:\x20'+_0x54b61f);}const _0x5634df=await withSpinner(_0x3a02d4(0x18d),()=>_0x575296[_0x3a02d4(0x1c0)][_0x3a02d4(0x1e3)](_0x21b551,{'time':_0xaab950,'num':_0x54b61f}),{'verbose':_0x50a06b[_0x3a02d4(0x1b4)]}),_0x4ab85a=_0x5634df[_0x3a02d4(0x1be)][_0x3a02d4(0x17f)];console[_0x3a02d4(0x1f8)](_0x3a02d4(0x18b)+_0x4ab85a[_0x3a02d4(0x1e6)]+_0x3a02d4(0x18e)+(_0x4ab85a[_0x3a02d4(0x1e6)]!==0x1?'s':'')+'\x20created');for(const _0x42f603 of _0x4ab85a){console[_0x3a02d4(0x1f8)](_0x3a02d4(0x206)+_0x42f603[_0x3a02d4(0x1f1)]);}return await handleSDKOutput(_0x4ab85a,_0x50a06b),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{['name']=a36_0x106265(0x1c5);['description']='Show\x20schedule\x20execution\x20history';[a36_0x106265(0x19a)](_0x20e2a7){const _0x1cfc51=a36_0x106265,_0x3c437b=_0x20e2a7[_0x1cfc51(0x207)][0x0];if(!_0x3c437b)return _0x1cfc51(0x1a2);return undefined;}async[a36_0x106265(0x1c6)](_0x5bb2d5){const _0x388320=a36_0x106265,{options:_0x5cb0d5,args:_0x17dab6,tdx:_0x2d0a37}=_0x5bb2d5,_0x534aed=_0x17dab6[0x0],_0x26ba8f=_0x5cb0d5,_0x56d192=_0x26ba8f[_0x388320(0x202)]!==undefined?Number(_0x26ba8f[_0x388320(0x202)]):undefined,_0x3e218b=_0x26ba8f['to']!==undefined?Number(_0x26ba8f['to']):undefined,_0x341edd=await withSpinner('Getting\x20schedule\x20history...',()=>_0x2d0a37[_0x388320(0x1c0)][_0x388320(0x1aa)](_0x534aed,{'from':_0x56d192,'to':_0x3e218b}),{'verbose':_0x5cb0d5[_0x388320(0x1b4)]}),_0x174847=_0x341edd[_0x388320(0x1be)];console[_0x388320(0x1f8)]('Found\x20'+_0x174847[_0x388320(0x194)]+_0x388320(0x1a7)+(_0x174847[_0x388320(0x194)]!==0x1?'s':'')+_0x388320(0x203)+_0x174847[_0x388320(0x202)]+'-'+_0x174847['to']+')');const _0x4a4459=_0x174847[_0x388320(0x1aa)][_0x388320(0x201)](_0x411b6b=>({'job_id':_0x411b6b[_0x388320(0x1f1)],'type':_0x411b6b[_0x388320(0x1ee)],'status':_0x411b6b['status'],'scheduled_at':_0x411b6b['scheduled_at'],'created_at':_0x411b6b[_0x388320(0x1bd)],'start_at':_0x411b6b['start_at'],'end_at':_0x411b6b[_0x388320(0x190)]}));return await handleSDKOutput(_0x4a4459,_0x5cb0d5),0x0;}}function a36_0x333f(){const _0x30d7e0=['history','delay','schedule:run','Schedule\x20created:\x20','description','schedule:list','6QwGkGQ','getTime','status','soon','verbose','format','in\x20','engine_version','red','\x20schedules','Getting\x20schedule\x20details...','\x22...','listQueries','created_at','data','output','schedules','nextRun','Showing\x20first\x20','last_job','yes','schedule:history','execute','\x20\x20Timezone:\x20','statusIcon','9715030iLZZsP','priority','\x20\x20Database:\x20','timezone','engineVersion','max','user','repeat','utf-8','delete','user_name','just\x20now','Cancelled','database','toLocaleDateString','substring','d\x20ago','limit','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','Found\x20','4346703OWkqio','Updating\x20schedule:\x20','query','padEnd','Show\x20schedule\x20details','Listing\x20scheduled\x20queries...','run','success','next_run_at','length','\x20\x20Time:\x20','trim','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','never','Deleting\x20schedule...','schedule:update','type','json','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','job_id','List\x20scheduled\x20queries','📅\x20','(unnamed)','queryUrl','entries','Query\x20file\x20is\x20empty','error','4272408bPepMz','ended_at','\x20(use\x20--limit\x20to\x20see\x20more)','create','updated_at','15544tiwwzA','abs','Run\x20a\x20scheduled\x20query\x20immediately','map','from','\x20(showing\x20','\x20\x20Type:\x20','cron','\x20\x20Job\x20ID:\x20','args','pagination','green','Running\x20schedule:\x20','update','result','show','ies','jobs','trino','Create\x20a\x20scheduled\x20query','/app/queries/editor?queryId=','retryLimit','Delete\x20a\x20scheduled\x20query','retry_limit','table','694593rYdBGW','file','...','schedule:show','Schedule\x20run\x20submitted:\x20','site','Running\x20schedule...','\x20job','lastRun','end_at','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','executing_user_id','10075EpOJXz','count','join','1841NVFtnb','Updating\x20schedule...','Update\x20a\x20scheduled\x20query','156721XFaWXs','validate','dim','3426CfoBUa','No\x20scheduled\x20queries\x20found','jsonl','INVALID_ARGUMENT','queries','\x20\x20Cron:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','round','num','options','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','\x20execution','name','\x20scheduled\x20quer'];a36_0x333f=function(){return _0x30d7e0;};return a36_0x333f();}
@@ -1 +1 @@
1
- const a37_0x10bc6e=a37_0x13f5;(function(_0x169f34,_0x4f6254){const _0x1a3027=a37_0x13f5,_0x359247=_0x169f34();while(!![]){try{const _0x5dbbd2=-parseInt(_0x1a3027(0x13a))/0x1+parseInt(_0x1a3027(0x138))/0x2*(parseInt(_0x1a3027(0xc2))/0x3)+parseInt(_0x1a3027(0x12b))/0x4*(parseInt(_0x1a3027(0x8f))/0x5)+parseInt(_0x1a3027(0xb4))/0x6+parseInt(_0x1a3027(0x11a))/0x7*(parseInt(_0x1a3027(0x120))/0x8)+-parseInt(_0x1a3027(0xbb))/0x9*(parseInt(_0x1a3027(0xa1))/0xa)+-parseInt(_0x1a3027(0xfa))/0xb;if(_0x5dbbd2===_0x4f6254)break;else _0x359247['push'](_0x359247['shift']());}catch(_0x3a52bc){_0x359247['push'](_0x359247['shift']());}}}(a37_0x5f30,0x75409));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0x3da86c from'chalk';async function resolveSegmentTarget(_0x255ec9,_0x115601,_0x398eb1){const _0x303e13=a37_0x13f5;if(isYamlFilePath(_0x255ec9))try{const _0x2c12fc=await resolveYamlFilePath(_0x255ec9);return _0x398eb1&&(console['error'](_0x303e13(0xb1)+_0x255ec9),console[_0x303e13(0x9e)](_0x303e13(0x127)+_0x2c12fc[_0x303e13(0xb8)]),console[_0x303e13(0x9e)](_0x303e13(0x126)+_0x2c12fc[_0x303e13(0xbe)]),console[_0x303e13(0x9e)](_0x303e13(0xb2)+(_0x2c12fc[_0x303e13(0x128)]||'(root)')),console[_0x303e13(0x9e)](_0x303e13(0x10e)+_0x2c12fc[_0x303e13(0x124)])),_0x2c12fc['fullPath'];}catch(_0x26a739){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x303e13(0x11c)+_0x26a739[_0x303e13(0xfb)]);}if(!_0x115601)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x303e13(0x135));return _0x115601+'/'+_0x255ec9;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x10bc6e(0xb3)]=a37_0x10bc6e(0x118);[a37_0x10bc6e(0xd3)]='Show\x20segment\x20or\x20folder\x20details';async[a37_0x10bc6e(0xe3)](_0x4ce325){const _0x26e9d7=a37_0x10bc6e,{options:_0x3b4e53,args:_0x170e4f,tdx:_0x3933a5}=_0x4ce325,_0x450334=_0x170e4f[0x0],_0x316839=!_0x450334&&!!_0x3b4e53[_0x26e9d7(0xb8)],_0x54dc7e=_0x450334||_0x3b4e53[_0x26e9d7(0xb8)];if(!_0x54dc7e)return console[_0x26e9d7(0x9e)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console['error']('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console['error'](_0x26e9d7(0x9b)),console['error'](_0x26e9d7(0x139)),console[_0x26e9d7(0x9e)](_0x26e9d7(0xac)),console['error'](_0x26e9d7(0x100)),console['error'](_0x26e9d7(0xcc)),0x1;try{const _0x4e6213=_0x3b4e53[_0x26e9d7(0x98)];let _0x34064e=_0x54dc7e;!_0x316839&&_0x4e6213&&!_0x54dc7e[_0x26e9d7(0xea)]('/')&&(_0x34064e=_0x4e6213+'/'+_0x54dc7e,_0x3b4e53['verbose']&&console['error'](_0x26e9d7(0x136)+_0x34064e));const _0x2c9602=await withSpinner(_0x26e9d7(0xdd)+_0x34064e+_0x26e9d7(0xd1),()=>_0x3933a5[_0x26e9d7(0xdb)][_0x26e9d7(0xef)](_0x34064e),{'verbose':_0x3b4e53['verbose']}),_0x498f9d=_0x2c9602[_0x26e9d7(0x131)];_0x3b4e53[_0x26e9d7(0x129)]&&(console[_0x26e9d7(0x9e)](_0x26e9d7(0x102)+_0x498f9d[_0x26e9d7(0x11e)]),console[_0x26e9d7(0x9e)]('Parent\x20ID:\x20'+_0x498f9d['parentId']),_0x498f9d['folderId']&&console[_0x26e9d7(0x9e)](_0x26e9d7(0x10f)+_0x498f9d[_0x26e9d7(0xcb)]),_0x498f9d[_0x26e9d7(0xb7)]&&console['error'](_0x26e9d7(0x109)+_0x498f9d[_0x26e9d7(0xb7)]));if(_0x498f9d['type']===_0x26e9d7(0xd5)){const _0x3ec927=await withSpinner(_0x26e9d7(0xf0),()=>_0x3933a5[_0x26e9d7(0xdb)]['getParent'](_0x498f9d[_0x26e9d7(0xb0)]),{'verbose':_0x3b4e53[_0x26e9d7(0x129)]});await handleSingleObjectOutput(_0x3ec927[_0x26e9d7(0x131)],_0x3b4e53);}else{if(_0x498f9d['type']===_0x26e9d7(0xec)){if(!_0x498f9d[_0x26e9d7(0xcb)])throw new SDKError(ErrorCode[_0x26e9d7(0x9a)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x2df4c2=await withSpinner(_0x26e9d7(0x137),()=>_0x3933a5['segment'][_0x26e9d7(0xaa)](_0x498f9d[_0x26e9d7(0xcb)]),{'verbose':_0x3b4e53['verbose']});await handleSingleObjectOutput(_0x2df4c2[_0x26e9d7(0x131)],_0x3b4e53);}else{if(_0x498f9d[_0x26e9d7(0x11e)]===_0x26e9d7(0xdb)){if(!_0x498f9d[_0x26e9d7(0xb7)])throw new SDKError(ErrorCode[_0x26e9d7(0x8e)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x28ba42=await withSpinner(_0x26e9d7(0xb9),()=>_0x3933a5['segment'][_0x26e9d7(0xd8)](_0x498f9d[_0x26e9d7(0xb0)],_0x498f9d[_0x26e9d7(0xb7)]),{'verbose':_0x3b4e53[_0x26e9d7(0x129)]});await handleSingleObjectOutput(_0x28ba42[_0x26e9d7(0x131)],_0x3b4e53);}}}return 0x0;}catch(_0x559cdc){if(_0x559cdc instanceof SDKError)return console[_0x26e9d7(0x9e)](_0x26e9d7(0x97)+_0x559cdc[_0x26e9d7(0xfb)]),_0x559cdc['cause']&&console[_0x26e9d7(0x9e)](_0x26e9d7(0xa8)+_0x559cdc[_0x26e9d7(0xf7)]),0x1;throw _0x559cdc;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x10bc6e(0xb3)]=a37_0x10bc6e(0xf4);[a37_0x10bc6e(0xd3)]=a37_0x10bc6e(0x92);async[a37_0x10bc6e(0xe3)](_0x378068){const _0x456229=a37_0x10bc6e,{options:_0x3f8154,args:_0x302f61,tdx:_0x540479}=_0x378068,_0x565184=_0x302f61[0x0];if(!_0x565184)return console['error'](_0x456229(0x122)),console[_0x456229(0x9e)](_0x456229(0xd7)),console['error'](_0x456229(0xf9)),console[_0x456229(0x9e)](_0x456229(0x9b)),console['error'](_0x456229(0xed)),console['error'](_0x456229(0xa5)),0x1;try{const _0x1f6998=_0x3f8154[_0x456229(0xb8)],_0x3c041b=await resolveSegmentTarget(_0x565184,_0x1f6998,_0x3f8154[_0x456229(0x129)]);_0x3f8154[_0x456229(0x129)]&&console[_0x456229(0x9e)](_0x456229(0x117)+_0x3c041b);const _0x4e2476=await withSpinner(_0x456229(0x93)+_0x565184+'\x27...',()=>_0x540479[_0x456229(0xdb)][_0x456229(0xef)](_0x3c041b),{'verbose':_0x3f8154['verbose']}),_0x50b2b4=_0x4e2476[_0x456229(0x131)];_0x3f8154[_0x456229(0x129)]&&(console[_0x456229(0x9e)]('Resolved\x20type:\x20'+_0x50b2b4[_0x456229(0x11e)]),console['error'](_0x456229(0xc7)+_0x50b2b4[_0x456229(0xb0)]));if(_0x50b2b4['type']===_0x456229(0xec))return console[_0x456229(0x9e)](_0x456229(0xe4)),console['error'](_0x456229(0xcd)),0x1;if(_0x50b2b4[_0x456229(0x11e)]===_0x456229(0xd5))return console['error'](_0x456229(0x115)),console[_0x456229(0x9e)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x50b2b4[_0x456229(0xb7)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x456229(0xe0));const _0x168dbf=await withSpinner(_0x456229(0xe5),()=>_0x540479['segment'][_0x456229(0xba)](_0x50b2b4[_0x456229(0xb0)],_0x50b2b4['segmentId']),{'verbose':_0x3f8154[_0x456229(0x129)]});let _0x4aa4cf=_0x168dbf['data'];const _0x3c751d=resolveLimit(_0x3f8154[_0x456229(0xe8)],DEFAULT_DISPLAY_LIMIT),_0x299935=/\bLIMIT\s+\d+/i[_0x456229(0x91)](_0x4aa4cf);!_0x299935&&(_0x4aa4cf=_0x4aa4cf[_0x456229(0xc6)]()[_0x456229(0xc0)](/;+$/,''),_0x4aa4cf=_0x456229(0x10d)+_0x4aa4cf+_0x456229(0x130)+_0x3c751d);_0x3f8154[_0x456229(0x129)]&&console['error']('SQL\x20query:\x0a'+_0x4aa4cf);const _0x4e7ef2=await withProgressSpinner(_0x456229(0x8d),async _0x29dc9d=>{const _0x1845f8=_0x456229,_0x13b31d=await _0x540479[_0x1845f8(0xce)][_0x1845f8(0xe3)](_0x4aa4cf,{'catalog':'td','schema':'information_schema','onJobId':_0xe96c40=>{const _0xafd6a7=_0x1845f8;_0x29dc9d[_0xafd6a7(0xb6)](_0xe96c40);}});return _0x13b31d;},{'verbose':_0x3f8154['verbose']}),_0x715b28=_0x4e7ef2['data'],_0x27089a=_0x715b28['jobId']?_0x456229(0x104)+_0x715b28[_0x456229(0x10c)]+']':'';return console[_0x456229(0x9e)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x715b28[_0x456229(0x133)][_0x456229(0x105)][_0x456229(0xf8)]()+_0x456229(0xab)+('in\x20'+formatElapsed(_0x715b28[_0x456229(0x133)][_0x456229(0xca)])+_0x27089a)),await handleQueryOutput(_0x715b28,_0x3f8154),0x0;}catch(_0x1219bc){if(_0x1219bc instanceof SDKError)return console[_0x456229(0x9e)](_0x456229(0xe2)+_0x1219bc[_0x456229(0xd9)]+']'),console[_0x456229(0x9e)]('\x0a'+_0x1219bc[_0x456229(0xfb)]),0x1;throw _0x1219bc;}}}function a37_0x5f30(){const _0x2e9789=['includes','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','folder','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','resolvePathToResource','Fetching\x20parent\x20segment\x20details...','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','green','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','segment:show','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','segment:folder:show','cause','toLocaleString','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','3925537WGKqBy','message','Fetching\x20folder\x20\x27','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Resolving\x20parent\x20folder\x20\x27','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Resolved\x20type:\x20','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','\x20[Job\x20ID:\x20','processedRows','segment:desc','Folder\x20name:\x20','red','Segment\x20ID:\x20','Use:\x20tdx\x20ps\x20desc','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','jobId','SELECT\x20*\x20FROM\x20(\x0a','\x20\x20Full\x20path:\x20','Folder\x20ID:\x20','Resolved\x20parent\x20folder\x20ID:\x20','✔\x20Found\x20','parentFolder','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','segment:view','Target\x20path:\x20','segment:describe','Listing\x20folders\x20for\x20parent\x20\x27','749djrBkU','getSegmentSQLFromYaml','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Fetching\x20SQL\x20from\x20rule...','type','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','44568wrDicR','Resolved\x20parent\x20ID:\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','fullPath','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','\x20\x20Segment\x20name:\x20','\x20\x20Parent\x20segment:\x20','folderPath','verbose','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','1877360XnwIRG','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','content','✔\x20Created\x20folder\x20\x27','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','data','/e/','stats','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Resolved\x20relative\x20path\x20to:\x20','Fetching\x20folder\x20details...','1978Ipyvja','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','768526RppEoU','format','Executing\x20segment\x20query...','SEGMENT_NOT_FOUND','5pVbCle','INVALID_ARGUMENT','test','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Resolving\x20\x27','Options:','\x20folder','/app/ps/','Error:\x20','segmentPath','Usage:\x20tdx\x20sg\x20desc\x20<name>','SEGMENT_FOLDER_NOT_FOUND','Examples:','length','log','error','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','json','10SxCKQV','Error:\x20Parent\x20segment\x20name\x20is\x20required','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','segment:folder:create','Resolving\x20parent\x20segment\x20\x27','\x20\x20Cause:\x20','jsonl','getFolder','\x20rows\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Show\x20child\x20segment\x20schema\x20(column\x20types)','Resolved:\x20','parentId','Resolved\x20YAML\x20file:\x20','\x20\x20Folder\x20path:\x20','name','2020302HIYttS','url','setJobId','segmentId','parentSegment','Fetching\x20segment\x20details...','getSegmentSQL','5796621vqecit','resolveFolderId','Parent\x20segment:\x20','segmentName','Site:\x20','replace','resolveParentId','2571xWUpVT','listFolders','web','\x27\x20with\x20ID:\x20','trim','Parent\x20ID:\x20','Parent\x20name:\x20','Get\x20SQL\x20query\x20for\x20child\x20segment','elapsedTimeMillis','folderId','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','query','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','\x27...','Folder\x20ID\x20missing\x20from\x20resolved\x20path','description','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','parent','cyan','Usage:\x20tdx\x20sg\x20show\x20<name>','getSegment','code','site','segment','getSQLFromYamlFile','Resolving\x20path\x20\x27','getSQLFromServerSegment','segment:folder:list','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','✖\x20Query\x20failed\x20[','execute','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Fetching\x20SQL\x20for\x20segment...','Usage:','Creating\x20folder\x20\x27','limit','createFolder'];a37_0x5f30=function(){return _0x2e9789;};return a37_0x5f30();}export class SegmentFolderListCommand extends BaseCommand{[a37_0x10bc6e(0xb3)]=a37_0x10bc6e(0xdf);[a37_0x10bc6e(0xd3)]=a37_0x10bc6e(0x103);async[a37_0x10bc6e(0xe3)](_0x5634e0){const _0x5270f3=a37_0x10bc6e,{options:_0x291c2b,args:_0x3645c9,tdx:_0x50dc42}=_0x5634e0;if(_0x3645c9[_0x5270f3(0x9c)]===0x0)return console[_0x5270f3(0x9e)](_0x5270f3(0xa2)),console['error'](_0x5270f3(0xa3)),0x1;const _0x1c5f1e=_0x3645c9[0x0];try{_0x291c2b[_0x5270f3(0x129)]&&(console[_0x5270f3(0x9e)](_0x5270f3(0xbf)+_0x291c2b[_0x5270f3(0xda)]),console[_0x5270f3(0x9e)](_0x5270f3(0xc8)+_0x1c5f1e));const _0x75c29f=await withSpinner(_0x5270f3(0xa7)+_0x1c5f1e+'\x27...',()=>_0x50dc42[_0x5270f3(0xdb)][_0x5270f3(0xc1)](_0x1c5f1e),{'verbose':_0x291c2b[_0x5270f3(0x129)]}),_0x80b2b7=_0x75c29f[_0x5270f3(0x131)];_0x291c2b['verbose']&&console[_0x5270f3(0x9e)](_0x5270f3(0x121)+_0x80b2b7);const _0x13d093=await withSpinner(_0x5270f3(0x119)+_0x1c5f1e+'\x27...',()=>_0x50dc42[_0x5270f3(0xdb)][_0x5270f3(0xc3)](_0x80b2b7),{'verbose':_0x291c2b[_0x5270f3(0x129)]}),_0x19878f=_0x13d093['data'];return console[_0x5270f3(0x9e)](_0x5270f3(0x111)+_0x19878f[_0x5270f3(0x9c)]+_0x5270f3(0x95)+(_0x19878f['length']!==0x1?'s':'')),await handleSDKOutput(_0x19878f,_0x291c2b),0x0;}catch(_0x8f4a81){if(_0x8f4a81 instanceof SDKError)return console[_0x5270f3(0x9e)](_0x5270f3(0x97)+_0x8f4a81[_0x5270f3(0xfb)]),_0x8f4a81['cause']&&console[_0x5270f3(0x9e)](_0x5270f3(0xa8)+_0x8f4a81[_0x5270f3(0xf7)]),0x1;throw _0x8f4a81;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x10bc6e(0xb3)]=a37_0x10bc6e(0xf6);[a37_0x10bc6e(0xd3)]='Show\x20segment\x20folder\x20details';async[a37_0x10bc6e(0xe3)](_0x5168ab){const _0x473c2a=a37_0x10bc6e,{options:_0x43180a,args:_0xcf06c0,tdx:_0x10674c}=_0x5168ab;if(_0xcf06c0[_0x473c2a(0x9c)]===0x0)return console[_0x473c2a(0x9e)]('Error:\x20Folder\x20reference\x20is\x20required'),console[_0x473c2a(0x9e)](_0x473c2a(0x12c)),0x1;try{const {parentId:_0x307668,childId:_0x1d006d}=parseSegmentRef(_0xcf06c0[0x0]);_0x43180a['verbose']&&(console[_0x473c2a(0x9e)]('Site:\x20'+_0x43180a[_0x473c2a(0xda)]),console[_0x473c2a(0x9e)](_0x473c2a(0xc8)+_0x307668),_0x1d006d&&console[_0x473c2a(0x9e)](_0x473c2a(0x107)+_0x1d006d));if(!_0x1d006d)return console['error']('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x561727=await withSpinner(_0x473c2a(0xa7)+_0x307668+_0x473c2a(0xd1),()=>_0x10674c['segment']['resolveParentId'](_0x307668),{'verbose':_0x43180a[_0x473c2a(0x129)]}),_0x5183f5=_0x561727['data'];_0x43180a[_0x473c2a(0x129)]&&console['error'](_0x473c2a(0x121)+_0x5183f5);const _0x20f371=await withSpinner('Resolving\x20folder\x20\x27'+_0x1d006d+_0x473c2a(0xd1),()=>_0x10674c[_0x473c2a(0xdb)][_0x473c2a(0xbc)](_0x5183f5,_0x1d006d),{'verbose':_0x43180a['verbose']}),_0xb9ca08=_0x20f371[_0x473c2a(0x131)];_0x43180a[_0x473c2a(0x129)]&&console[_0x473c2a(0x9e)]('Resolved\x20folder\x20ID:\x20'+_0xb9ca08);const _0x10ee88=await withSpinner(_0x473c2a(0xfc)+_0x1d006d+_0x473c2a(0xd1),()=>_0x10674c[_0x473c2a(0xdb)]['getFolder'](_0xb9ca08),{'verbose':_0x43180a[_0x473c2a(0x129)]});return await handleSDKOutput([_0x10ee88[_0x473c2a(0x131)]],_0x43180a),0x0;}catch(_0x590278){if(_0x590278 instanceof SDKError)return console[_0x473c2a(0x9e)](_0x473c2a(0x97)+_0x590278['message']),_0x590278['cause']&&console['error'](_0x473c2a(0xa8)+_0x590278[_0x473c2a(0xf7)]),0x1;throw _0x590278;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x10bc6e(0xb3)]='segment:sql';['description']=a37_0x10bc6e(0xc9);async[a37_0x10bc6e(0xe3)](_0x484ce6){const _0xddeae0=a37_0x10bc6e,{options:_0x8b58f9,args:_0xa205b1}=_0x484ce6,_0x48d0bf=_0x8b58f9,_0x596429=_0x48d0bf['path'],_0x36adb8=_0xa205b1[0x0];if(!_0x36adb8&&!_0x596429)return console[_0xddeae0(0x9e)](a37_0x3da86c[_0xddeae0(0x108)](_0xddeae0(0x125))),console[_0xddeae0(0x9e)](_0xddeae0(0xe6)),console['error']('\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>'),console[_0xddeae0(0x9e)](_0xddeae0(0xff)),console[_0xddeae0(0x9e)](_0xddeae0(0x9b)),console[_0xddeae0(0x9e)](_0xddeae0(0xf5)),console[_0xddeae0(0x9e)](_0xddeae0(0x123)),0x1;if(_0x36adb8&&_0x596429)return console['error'](a37_0x3da86c[_0xddeae0(0x108)](_0xddeae0(0xa4))),0x1;try{let _0x110770;if(_0x596429)_0x110770=await this['getSQLFromYamlFile'](_0x596429,_0x484ce6);else{if(isYamlFilePath(_0x36adb8))return console[_0xddeae0(0x9e)](a37_0x3da86c['red'](_0xddeae0(0xd4))),console[_0xddeae0(0x9e)](_0xddeae0(0x113)+_0x36adb8),0x1;else _0x110770=await this[_0xddeae0(0xde)](_0x36adb8,_0x484ce6);}return _0x8b58f9[_0xddeae0(0x8c)]===_0xddeae0(0xa0)||_0x8b58f9[_0xddeae0(0x8c)]===_0xddeae0(0xa9)?await handleSDKOutput([{'sql':_0x110770}],_0x8b58f9):console[_0xddeae0(0x9d)](_0x110770),0x0;}catch(_0xcd7cfa){if(_0xcd7cfa instanceof SDKError)return console[_0xddeae0(0x9e)]('Error:\x20'+_0xcd7cfa[_0xddeae0(0xfb)]),_0xcd7cfa[_0xddeae0(0xf7)]&&console[_0xddeae0(0x9e)](_0xddeae0(0xa8)+_0xcd7cfa[_0xddeae0(0xf7)]),0x1;throw _0xcd7cfa;}}async[a37_0x10bc6e(0xdc)](_0x376839,_0x48f15d){const _0x3ed8d3=a37_0x10bc6e,{options:_0x399c88,tdx:_0x1e8871}=_0x48f15d;let _0x1501f2;try{_0x1501f2=await resolveYamlFilePath(_0x376839);}catch(_0x3376ce){throw new SDKError(ErrorCode[_0x3ed8d3(0x90)],_0x3ed8d3(0x11c)+_0x3376ce[_0x3ed8d3(0xfb)]);}_0x399c88[_0x3ed8d3(0x129)]&&console[_0x3ed8d3(0x9e)](_0x3ed8d3(0xaf)+_0x1501f2[_0x3ed8d3(0xb8)]+'/'+_0x1501f2[_0x3ed8d3(0xbe)]);const _0x26014f=await withSpinner(_0x3ed8d3(0x11d),()=>_0x1e8871[_0x3ed8d3(0xdb)][_0x3ed8d3(0x11b)](_0x1501f2[_0x3ed8d3(0x12e)],_0x1501f2['parentSegment'],_0x1501f2[_0x3ed8d3(0xbe)]),{'verbose':_0x399c88[_0x3ed8d3(0x129)]});return _0x26014f[_0x3ed8d3(0x131)];}async[a37_0x10bc6e(0xde)](_0xe38725,_0x392df7){const _0x20553b=a37_0x10bc6e,{options:_0x3c0476,tdx:_0x2fb472}=_0x392df7,_0x29207f=_0x3c0476[_0x20553b(0xb8)],_0x38f898=await resolveSegmentTarget(_0xe38725,_0x29207f,_0x3c0476[_0x20553b(0x129)]);_0x3c0476[_0x20553b(0x129)]&&console[_0x20553b(0x9e)](_0x20553b(0x117)+_0x38f898);const _0xdd5cd0=await withSpinner('Resolving\x20\x27'+_0xe38725+_0x20553b(0xd1),()=>_0x2fb472[_0x20553b(0xdb)][_0x20553b(0xef)](_0x38f898),{'verbose':_0x3c0476[_0x20553b(0x129)]}),_0x21c4cc=_0xdd5cd0[_0x20553b(0x131)];_0x3c0476[_0x20553b(0x129)]&&(console[_0x20553b(0x9e)](_0x20553b(0x102)+_0x21c4cc[_0x20553b(0x11e)]),console[_0x20553b(0x9e)](_0x20553b(0xc7)+_0x21c4cc['parentId']));if(_0x21c4cc[_0x20553b(0x11e)]===_0x20553b(0xec))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x20553b(0xeb));if(_0x21c4cc['type']===_0x20553b(0xd5))throw new SDKError(ErrorCode[_0x20553b(0x90)],_0x20553b(0x134));if(!_0x21c4cc[_0x20553b(0xb7)])throw new SDKError(ErrorCode[_0x20553b(0x8e)],_0x20553b(0xe0));const _0x19aa4b=await withSpinner(_0x20553b(0xe5),()=>_0x2fb472[_0x20553b(0xdb)]['getSegmentSQL'](_0x21c4cc['parentId'],_0x21c4cc[_0x20553b(0xb7)]),{'verbose':_0x3c0476[_0x20553b(0x129)]});return _0x19aa4b['data'];}}export class SegmentFolderCreateCommand extends BaseCommand{['name']=a37_0x10bc6e(0xa6);[a37_0x10bc6e(0xd3)]='Create\x20segment\x20folder\x20for\x20organization';async['execute'](_0x1e0fbd){const _0x268439=a37_0x10bc6e,{options:_0x1a66ae,args:_0x535f99,tdx:_0x1e798e}=_0x1e0fbd,_0x247f4a=_0x1a66ae;if(_0x535f99[_0x268439(0x9c)]<0x2)return console['error'](_0x268439(0x11f)),console[_0x268439(0x9e)](_0x268439(0xfd)),0x1;const _0x811d2c=_0x535f99[0x0],_0x58e99f=_0x535f99[0x1];_0x247f4a[_0x268439(0x129)]&&(console[_0x268439(0x9e)]('Site:\x20'+_0x247f4a[_0x268439(0xda)]),console[_0x268439(0x9e)](_0x268439(0xbd)+_0x811d2c),console[_0x268439(0x9e)]('Folder\x20name:\x20'+_0x58e99f));let _0x302e72;if(_0x247f4a[_0x268439(0x112)]){const _0x5dd702=_0x247f4a['parentFolder'],_0x414487=await withSpinner(_0x268439(0xa7)+_0x811d2c+'\x27...',()=>_0x1e798e[_0x268439(0xdb)][_0x268439(0xc1)](_0x811d2c),{'verbose':_0x247f4a[_0x268439(0x129)]}),_0x3554d0=_0x414487[_0x268439(0x131)],_0x4cf07a=await withSpinner(_0x268439(0xfe)+_0x5dd702+'\x27...',()=>_0x1e798e[_0x268439(0xdb)][_0x268439(0xbc)](_0x3554d0,_0x5dd702),{'verbose':_0x247f4a[_0x268439(0x129)]});_0x302e72=_0x4cf07a[_0x268439(0x131)],_0x247f4a[_0x268439(0x129)]&&console[_0x268439(0x9e)](_0x268439(0x110)+_0x302e72);}const _0xb5c13a={'name':_0x58e99f,'description':_0x247f4a[_0x268439(0xd3)],'parentFolderId':_0x302e72},_0x1ad5b5=await withSpinner(_0x268439(0xe7)+_0x58e99f+_0x268439(0xd1),()=>_0x1e798e[_0x268439(0xdb)][_0x268439(0xe9)](_0x811d2c,_0xb5c13a),{'verbose':_0x247f4a[_0x268439(0x129)]}),_0x19e18d=_0x1ad5b5[_0x268439(0x131)];return console[_0x268439(0x9e)](_0x268439(0x12f)+_0x19e18d[_0x268439(0xb3)]+_0x268439(0xc5)+_0x19e18d['id']),await handleSDKOutput([_0x19e18d],_0x247f4a),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x10bc6e(0xb3)]=a37_0x10bc6e(0x116);['description']='Show\x20folder\x20or\x20child\x20segment\x20details';async['execute'](_0x46096d){const _0x179e9c=a37_0x10bc6e,{options:_0x30fec4,args:_0x4a005a,tdx:_0x9b7749}=_0x46096d,_0x5e30ff=_0x4a005a[0x0];if(!_0x5e30ff)return console[_0x179e9c(0x9e)](_0x179e9c(0xd0)),console[_0x179e9c(0x9e)](_0x179e9c(0x12d)),console[_0x179e9c(0x9e)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console[_0x179e9c(0x9e)](_0x179e9c(0x94)),console['error'](_0x179e9c(0xf3)),console[_0x179e9c(0x9e)](_0x179e9c(0x9b)),console[_0x179e9c(0x9e)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x179e9c(0x9e)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console['error'](_0x179e9c(0x9f)),console['error'](_0x179e9c(0xcf)),0x1;try{const _0x4d15a4=_0x30fec4['parentSegment'],_0x395926=await resolveSegmentTarget(_0x5e30ff,_0x4d15a4,_0x30fec4[_0x179e9c(0x129)]);_0x30fec4[_0x179e9c(0x129)]&&console[_0x179e9c(0x9e)](_0x179e9c(0x117)+_0x395926);const _0x52384c=await withSpinner(_0x179e9c(0x93)+_0x5e30ff+'\x27...',()=>_0x9b7749[_0x179e9c(0xdb)]['resolvePathToResource'](_0x395926),{'verbose':_0x30fec4[_0x179e9c(0x129)]}),_0x429667=_0x52384c[_0x179e9c(0x131)];_0x30fec4[_0x179e9c(0x129)]&&(console['error'](_0x179e9c(0x102)+_0x429667['type']),console[_0x179e9c(0x9e)]('Parent\x20ID:\x20'+_0x429667[_0x179e9c(0xb0)]),_0x429667[_0x179e9c(0xcb)]&&console['error']('Folder\x20ID:\x20'+_0x429667[_0x179e9c(0xcb)]),_0x429667[_0x179e9c(0xb7)]&&console[_0x179e9c(0x9e)]('Segment\x20ID:\x20'+_0x429667[_0x179e9c(0xb7)]));if(_0x30fec4[_0x179e9c(0xc4)]){if(_0x429667[_0x179e9c(0x11e)]===_0x179e9c(0xec))return console['error'](_0x179e9c(0x12a)),0x1;if(_0x429667['type']===_0x179e9c(0xd5))return console['error'](_0x179e9c(0xe1)),console[_0x179e9c(0x9e)]('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x429667[_0x179e9c(0xb7)])throw new SDKError(ErrorCode[_0x179e9c(0x8e)],_0x179e9c(0xe0));const _0x1d681f=getConsoleNextUrl(_0x30fec4['site'],_0x179e9c(0x96)+_0x429667['parentId']+_0x179e9c(0x132)+_0x429667[_0x179e9c(0xb7)]);return console[_0x179e9c(0x9e)](a37_0x3da86c[_0x179e9c(0xf2)]('✔')+'\x20Opening\x20'+a37_0x3da86c[_0x179e9c(0xd6)](_0x1d681f)),openBrowser(_0x1d681f),0x0;}if(_0x429667[_0x179e9c(0x11e)]===_0x179e9c(0xec)){if(!_0x429667['folderId'])throw new SDKError(ErrorCode[_0x179e9c(0x9a)],_0x179e9c(0xd2));const _0x133a01=await withSpinner(_0x179e9c(0x137),()=>_0x9b7749[_0x179e9c(0xdb)][_0x179e9c(0xaa)](_0x429667[_0x179e9c(0xcb)]),{'verbose':_0x30fec4[_0x179e9c(0x129)]});await handleSingleObjectOutput(_0x133a01[_0x179e9c(0x131)],_0x30fec4);}else{if(_0x429667['type']===_0x179e9c(0xdb)){if(!_0x429667['segmentId'])throw new SDKError(ErrorCode[_0x179e9c(0x8e)],_0x179e9c(0xe0));const _0x539e8a=await withSpinner(_0x179e9c(0xb9),()=>_0x9b7749[_0x179e9c(0xdb)][_0x179e9c(0xd8)](_0x429667[_0x179e9c(0xb0)],_0x429667[_0x179e9c(0xb7)]),{'verbose':_0x30fec4[_0x179e9c(0x129)]}),_0x175084=getConsoleNextUrl(_0x30fec4[_0x179e9c(0xda)],'/app/ps/'+_0x429667['parentId']+_0x179e9c(0x132)+_0x429667['segmentId']),_0x30f4f2=_0x539e8a['data'];_0x30f4f2[_0x179e9c(0xb5)]=_0x175084,await handleSingleObjectOutput(_0x30f4f2,_0x30fec4);}else return console[_0x179e9c(0x9e)](_0x179e9c(0xad)),console[_0x179e9c(0x9e)]('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0x27600f){if(_0x27600f instanceof SDKError)return console[_0x179e9c(0x9e)](_0x179e9c(0x97)+_0x27600f[_0x179e9c(0xfb)]),_0x27600f[_0x179e9c(0xf7)]&&console[_0x179e9c(0x9e)](_0x179e9c(0xa8)+_0x27600f[_0x179e9c(0xf7)]),0x1;throw _0x27600f;}}}function a37_0x13f5(_0x5cf567,_0x586701){_0x5cf567=_0x5cf567-0x8c;const _0x5f303c=a37_0x5f30();let _0x13f55a=_0x5f303c[_0x5cf567];return _0x13f55a;}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x10bc6e(0xb3)]=a37_0x10bc6e(0x106);[a37_0x10bc6e(0xd3)]=a37_0x10bc6e(0xae);async[a37_0x10bc6e(0xe3)](_0x2cc39b){const _0x20c490=a37_0x10bc6e,{options:_0x190292,args:_0x54be4d,tdx:_0x435dab}=_0x2cc39b,_0x1c6f40=_0x54be4d[0x0];if(!_0x1c6f40)return console[_0x20c490(0x9e)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x20c490(0x9e)](_0x20c490(0x99)),console[_0x20c490(0x9e)](_0x20c490(0xee)),console[_0x20c490(0x9e)]('Examples:'),console[_0x20c490(0x9e)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console['error'](_0x20c490(0x10b)),0x1;try{const _0x5a7219=_0x190292['parentSegment'],_0x5722d6=await resolveSegmentTarget(_0x1c6f40,_0x5a7219,_0x190292[_0x20c490(0x129)]);_0x190292[_0x20c490(0x129)]&&console[_0x20c490(0x9e)](_0x20c490(0x117)+_0x5722d6);const _0xd93723=await withSpinner(_0x20c490(0x93)+_0x1c6f40+_0x20c490(0xd1),()=>_0x435dab[_0x20c490(0xdb)]['resolvePathToResource'](_0x5722d6),{'verbose':_0x190292[_0x20c490(0x129)]}),_0x6d0e0c=_0xd93723['data'];_0x190292[_0x20c490(0x129)]&&(console['error'](_0x20c490(0x102)+_0x6d0e0c[_0x20c490(0x11e)]),console[_0x20c490(0x9e)](_0x20c490(0xc7)+_0x6d0e0c[_0x20c490(0xb0)]));if(_0x6d0e0c['type']===_0x20c490(0xec))return console[_0x20c490(0x9e)](_0x20c490(0xf1)),console['error'](_0x20c490(0x101)),0x1;if(_0x6d0e0c[_0x20c490(0x11e)]===_0x20c490(0xd5))return console[_0x20c490(0x9e)](_0x20c490(0x114)),console[_0x20c490(0x9e)](_0x20c490(0x10a)),0x1;if(!_0x6d0e0c[_0x20c490(0xb7)])throw new SDKError(ErrorCode[_0x20c490(0x8e)],_0x20c490(0xe0));const _0x5c0526=await withSpinner(_0x20c490(0xe5),()=>_0x435dab[_0x20c490(0xdb)][_0x20c490(0xba)](_0x6d0e0c['parentId'],_0x6d0e0c[_0x20c490(0xb7)]),{'verbose':_0x190292[_0x20c490(0x129)]}),_0x493fdc=_0x5c0526[_0x20c490(0x131)],_0x389e21=await executeSchemaQuery(_0x493fdc,_0x435dab,_0x190292);return await handleQueryOutput(_0x389e21,_0x190292),0x0;}catch(_0x49d97f){if(_0x49d97f instanceof SDKError)return console[_0x20c490(0x9e)](_0x20c490(0x97)+_0x49d97f[_0x20c490(0xfb)]),_0x49d97f[_0x20c490(0xf7)]&&console[_0x20c490(0x9e)](_0x20c490(0xa8)+_0x49d97f[_0x20c490(0xf7)]),0x1;throw _0x49d97f;}}}
1
+ const a37_0x867ae0=a37_0x5984;(function(_0x380ff6,_0x5a2026){const _0x2e699b=a37_0x5984,_0x1a7c2e=_0x380ff6();while(!![]){try{const _0x3ec96f=parseInt(_0x2e699b(0x25c))/0x1+parseInt(_0x2e699b(0x28a))/0x2*(-parseInt(_0x2e699b(0x20b))/0x3)+-parseInt(_0x2e699b(0x21d))/0x4+-parseInt(_0x2e699b(0x204))/0x5*(-parseInt(_0x2e699b(0x288))/0x6)+-parseInt(_0x2e699b(0x1f3))/0x7*(parseInt(_0x2e699b(0x24e))/0x8)+-parseInt(_0x2e699b(0x274))/0x9*(-parseInt(_0x2e699b(0x1fc))/0xa)+parseInt(_0x2e699b(0x21a))/0xb;if(_0x3ec96f===_0x5a2026)break;else _0x1a7c2e['push'](_0x1a7c2e['shift']());}catch(_0x10b9c2){_0x1a7c2e['push'](_0x1a7c2e['shift']());}}}(a37_0x2e8b,0x52b45));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a37_0x5984(_0x1117fc,_0x46c4f7){_0x1117fc=_0x1117fc-0x1ef;const _0x2e8bf5=a37_0x2e8b();let _0x5984cb=_0x2e8bf5[_0x1117fc];return _0x5984cb;}import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0x306a45 from'chalk';async function resolveSegmentTarget(_0x316d4b,_0x447ce0,_0x32ec1f){const _0x344db2=a37_0x5984;if(isYamlFilePath(_0x316d4b))try{const _0x1f6193=await resolveYamlFilePath(_0x316d4b);return _0x32ec1f&&(console[_0x344db2(0x281)]('Resolved\x20YAML\x20file:\x20'+_0x316d4b),console['error'](_0x344db2(0x258)+_0x1f6193[_0x344db2(0x265)]),console['error'](_0x344db2(0x205)+_0x1f6193[_0x344db2(0x273)]),console[_0x344db2(0x281)](_0x344db2(0x27f)+(_0x1f6193[_0x344db2(0x25e)]||'(root)')),console['error'](_0x344db2(0x254)+_0x1f6193[_0x344db2(0x284)])),_0x1f6193[_0x344db2(0x284)];}catch(_0x55a05e){throw new SDKError(ErrorCode[_0x344db2(0x225)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x55a05e[_0x344db2(0x235)]);}if(!_0x447ce0)throw new SDKError(ErrorCode[_0x344db2(0x225)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x447ce0+'/'+_0x316d4b;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x867ae0(0x245)]=a37_0x867ae0(0x21c);[a37_0x867ae0(0x263)]=a37_0x867ae0(0x24d);async[a37_0x867ae0(0x22f)](_0x547743){const _0x3f077c=a37_0x867ae0,{options:_0x5d8823,args:_0x5220cc,tdx:_0x51ab73}=_0x547743,_0x3d95d1=_0x5220cc[0x0],_0x428c4f=!_0x3d95d1&&!!_0x5d8823[_0x3f077c(0x265)],_0x15c9e8=_0x3d95d1||_0x5d8823[_0x3f077c(0x265)];if(!_0x15c9e8)return console['error'](_0x3f077c(0x21b)),console[_0x3f077c(0x281)](_0x3f077c(0x26c)),console[_0x3f077c(0x281)](_0x3f077c(0x275)),console[_0x3f077c(0x281)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console['error']('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console[_0x3f077c(0x281)]('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console[_0x3f077c(0x281)](_0x3f077c(0x203)),0x1;try{const _0xe7ea48=_0x5d8823[_0x3f077c(0x224)];let _0x5f284a=_0x15c9e8;!_0x428c4f&&_0xe7ea48&&!_0x15c9e8[_0x3f077c(0x226)]('/')&&(_0x5f284a=_0xe7ea48+'/'+_0x15c9e8,_0x5d8823[_0x3f077c(0x290)]&&console['error'](_0x3f077c(0x202)+_0x5f284a));const _0x500bc0=await withSpinner(_0x3f077c(0x286)+_0x5f284a+_0x3f077c(0x21f),()=>_0x51ab73['segment'][_0x3f077c(0x220)](_0x5f284a),{'verbose':_0x5d8823[_0x3f077c(0x290)]}),_0x213fdb=_0x500bc0[_0x3f077c(0x1ef)];_0x5d8823[_0x3f077c(0x290)]&&(console[_0x3f077c(0x281)](_0x3f077c(0x285)+_0x213fdb['type']),console[_0x3f077c(0x281)](_0x3f077c(0x255)+_0x213fdb[_0x3f077c(0x27c)]),_0x213fdb[_0x3f077c(0x217)]&&console['error']('Folder\x20ID:\x20'+_0x213fdb[_0x3f077c(0x217)]),_0x213fdb[_0x3f077c(0x234)]&&console[_0x3f077c(0x281)](_0x3f077c(0x241)+_0x213fdb[_0x3f077c(0x234)]));if(_0x213fdb[_0x3f077c(0x1f4)]===_0x3f077c(0x28f)){const _0xfd0ff5=await withSpinner(_0x3f077c(0x244),()=>_0x51ab73[_0x3f077c(0x26e)][_0x3f077c(0x210)](_0x213fdb[_0x3f077c(0x27c)]),{'verbose':_0x5d8823['verbose']});await handleSingleObjectOutput(_0xfd0ff5[_0x3f077c(0x1ef)],_0x5d8823);}else{if(_0x213fdb[_0x3f077c(0x1f4)]==='folder'){if(!_0x213fdb[_0x3f077c(0x217)])throw new SDKError(ErrorCode[_0x3f077c(0x28e)],_0x3f077c(0x247));const _0x5755b1=await withSpinner(_0x3f077c(0x243),()=>_0x51ab73[_0x3f077c(0x26e)][_0x3f077c(0x201)](_0x213fdb[_0x3f077c(0x217)]),{'verbose':_0x5d8823[_0x3f077c(0x290)]});await handleSingleObjectOutput(_0x5755b1[_0x3f077c(0x1ef)],_0x5d8823);}else{if(_0x213fdb[_0x3f077c(0x1f4)]==='segment'){if(!_0x213fdb['segmentId'])throw new SDKError(ErrorCode[_0x3f077c(0x1fb)],_0x3f077c(0x246));const _0x10acbb=await withSpinner('Fetching\x20segment\x20details...',()=>_0x51ab73[_0x3f077c(0x26e)][_0x3f077c(0x209)](_0x213fdb[_0x3f077c(0x27c)],_0x213fdb[_0x3f077c(0x234)]),{'verbose':_0x5d8823['verbose']});await handleSingleObjectOutput(_0x10acbb[_0x3f077c(0x1ef)],_0x5d8823);}}}return 0x0;}catch(_0x1f2895){if(_0x1f2895 instanceof SDKError)return console['error']('Error:\x20'+_0x1f2895['message']),_0x1f2895[_0x3f077c(0x28c)]&&console[_0x3f077c(0x281)](_0x3f077c(0x236)+_0x1f2895[_0x3f077c(0x28c)]),0x1;throw _0x1f2895;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x867ae0(0x245)]='segment:show';[a37_0x867ae0(0x263)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async['execute'](_0x70f232){const _0x364f60=a37_0x867ae0,{options:_0x2c492e,args:_0x2866ec,tdx:_0x2974a0}=_0x70f232,_0x50bedc=_0x2866ec[0x0];if(!_0x50bedc)return console[_0x364f60(0x281)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x364f60(0x281)](_0x364f60(0x20f)),console[_0x364f60(0x281)](_0x364f60(0x232)),console[_0x364f60(0x281)](_0x364f60(0x275)),console[_0x364f60(0x281)](_0x364f60(0x266)),console[_0x364f60(0x281)](_0x364f60(0x272)),0x1;try{const _0x359cfb=_0x2c492e[_0x364f60(0x265)],_0x288d54=await resolveSegmentTarget(_0x50bedc,_0x359cfb,_0x2c492e[_0x364f60(0x290)]);_0x2c492e['verbose']&&console[_0x364f60(0x281)]('Target\x20path:\x20'+_0x288d54);const _0x1f8b25=await withSpinner(_0x364f60(0x26a)+_0x50bedc+_0x364f60(0x21f),()=>_0x2974a0[_0x364f60(0x26e)][_0x364f60(0x220)](_0x288d54),{'verbose':_0x2c492e['verbose']}),_0x10c5ac=_0x1f8b25[_0x364f60(0x1ef)];_0x2c492e[_0x364f60(0x290)]&&(console[_0x364f60(0x281)](_0x364f60(0x285)+_0x10c5ac[_0x364f60(0x1f4)]),console[_0x364f60(0x281)](_0x364f60(0x255)+_0x10c5ac[_0x364f60(0x27c)]));if(_0x10c5ac[_0x364f60(0x1f4)]===_0x364f60(0x23b))return console[_0x364f60(0x281)](_0x364f60(0x20c)),console['error'](_0x364f60(0x1ff)),0x1;if(_0x10c5ac[_0x364f60(0x1f4)]==='parent')return console[_0x364f60(0x281)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x364f60(0x281)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x10c5ac[_0x364f60(0x234)])throw new SDKError(ErrorCode[_0x364f60(0x1fb)],_0x364f60(0x246));const _0x18c99b=await withSpinner(_0x364f60(0x212),()=>_0x2974a0[_0x364f60(0x26e)][_0x364f60(0x22a)](_0x10c5ac[_0x364f60(0x27c)],_0x10c5ac[_0x364f60(0x234)]),{'verbose':_0x2c492e[_0x364f60(0x290)]});let _0x1c1206=_0x18c99b[_0x364f60(0x1ef)];const _0x4b4a05=resolveLimit(_0x2c492e[_0x364f60(0x27e)],DEFAULT_DISPLAY_LIMIT),_0x337937=/\bLIMIT\s+\d+/i['test'](_0x1c1206);!_0x337937&&(_0x1c1206=_0x1c1206[_0x364f60(0x27d)]()[_0x364f60(0x248)](/;+$/,''),_0x1c1206=_0x364f60(0x259)+_0x1c1206+_0x364f60(0x21e)+_0x4b4a05);_0x2c492e[_0x364f60(0x290)]&&console['error'](_0x364f60(0x23a)+_0x1c1206);const _0x1b9ca0=await withProgressSpinner(_0x364f60(0x213),async _0x2cc951=>{const _0x44c7c6=_0x364f60,_0x17833f=await _0x2974a0[_0x44c7c6(0x23e)]['execute'](_0x1c1206,{'catalog':'td','schema':_0x44c7c6(0x261),'onJobId':_0x394547=>{const _0x4f4c33=_0x44c7c6;_0x2cc951[_0x4f4c33(0x287)](_0x394547);}});return _0x17833f;},{'verbose':_0x2c492e['verbose']}),_0x32f252=_0x1b9ca0[_0x364f60(0x1ef)],_0x367573=_0x32f252[_0x364f60(0x215)]?_0x364f60(0x27a)+_0x32f252[_0x364f60(0x215)]+']':'';return console[_0x364f60(0x281)](_0x364f60(0x26b)+_0x32f252[_0x364f60(0x270)]['processedRows'][_0x364f60(0x1fa)]()+_0x364f60(0x228)+('in\x20'+formatElapsed(_0x32f252[_0x364f60(0x270)][_0x364f60(0x291)])+_0x367573)),await handleQueryOutput(_0x32f252,_0x2c492e),0x0;}catch(_0x329456){if(_0x329456 instanceof SDKError)return console[_0x364f60(0x281)]('✖\x20Query\x20failed\x20['+_0x329456['code']+']'),console[_0x364f60(0x281)]('\x0a'+_0x329456['message']),0x1;throw _0x329456;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x867ae0(0x245)]=a37_0x867ae0(0x230);[a37_0x867ae0(0x263)]=a37_0x867ae0(0x1f7);async[a37_0x867ae0(0x22f)](_0x279f4a){const _0x2d7470=a37_0x867ae0,{options:_0x24e895,args:_0x58d0ca,tdx:_0x118cd4}=_0x279f4a;if(_0x58d0ca[_0x2d7470(0x28b)]===0x0)return console[_0x2d7470(0x281)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x2d7470(0x281)](_0x2d7470(0x24b)),0x1;const _0x1e4c43=_0x58d0ca[0x0];try{_0x24e895[_0x2d7470(0x290)]&&(console[_0x2d7470(0x281)](_0x2d7470(0x250)+_0x24e895[_0x2d7470(0x249)]),console[_0x2d7470(0x281)](_0x2d7470(0x237)+_0x1e4c43));const _0x29ad10=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x1e4c43+_0x2d7470(0x21f),()=>_0x118cd4[_0x2d7470(0x26e)][_0x2d7470(0x22e)](_0x1e4c43),{'verbose':_0x24e895[_0x2d7470(0x290)]}),_0x24776f=_0x29ad10[_0x2d7470(0x1ef)];_0x24e895['verbose']&&console[_0x2d7470(0x281)](_0x2d7470(0x278)+_0x24776f);const _0x356bef=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x1e4c43+_0x2d7470(0x21f),()=>_0x118cd4[_0x2d7470(0x26e)][_0x2d7470(0x23c)](_0x24776f),{'verbose':_0x24e895['verbose']}),_0x335e6a=_0x356bef[_0x2d7470(0x1ef)];return console['error']('✔\x20Found\x20'+_0x335e6a[_0x2d7470(0x28b)]+_0x2d7470(0x218)+(_0x335e6a[_0x2d7470(0x28b)]!==0x1?'s':'')),await handleSDKOutput(_0x335e6a,_0x24e895),0x0;}catch(_0x2ed67b){if(_0x2ed67b instanceof SDKError)return console[_0x2d7470(0x281)](_0x2d7470(0x280)+_0x2ed67b[_0x2d7470(0x235)]),_0x2ed67b['cause']&&console['error'](_0x2d7470(0x236)+_0x2ed67b[_0x2d7470(0x28c)]),0x1;throw _0x2ed67b;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x867ae0(0x245)]=a37_0x867ae0(0x1f2);['description']='Show\x20segment\x20folder\x20details';async['execute'](_0x16e471){const _0x402dab=a37_0x867ae0,{options:_0x1f68d1,args:_0x944082,tdx:_0x396fee}=_0x16e471;if(_0x944082['length']===0x0)return console['error'](_0x402dab(0x268)),console[_0x402dab(0x281)](_0x402dab(0x276)),0x1;try{const {parentId:_0x28446e,childId:_0x3d775a}=parseSegmentRef(_0x944082[0x0]);_0x1f68d1[_0x402dab(0x290)]&&(console['error'](_0x402dab(0x250)+_0x1f68d1[_0x402dab(0x249)]),console['error'](_0x402dab(0x237)+_0x28446e),_0x3d775a&&console[_0x402dab(0x281)](_0x402dab(0x24c)+_0x3d775a));if(!_0x3d775a)return console[_0x402dab(0x281)](_0x402dab(0x22d)),0x1;const _0x401a82=await withSpinner(_0x402dab(0x25b)+_0x28446e+_0x402dab(0x21f),()=>_0x396fee['segment'][_0x402dab(0x22e)](_0x28446e),{'verbose':_0x1f68d1['verbose']}),_0x2382c8=_0x401a82[_0x402dab(0x1ef)];_0x1f68d1[_0x402dab(0x290)]&&console[_0x402dab(0x281)]('Resolved\x20parent\x20ID:\x20'+_0x2382c8);const _0x2d564b=await withSpinner('Resolving\x20folder\x20\x27'+_0x3d775a+_0x402dab(0x21f),()=>_0x396fee[_0x402dab(0x26e)]['resolveFolderId'](_0x2382c8,_0x3d775a),{'verbose':_0x1f68d1[_0x402dab(0x290)]}),_0x30bfe6=_0x2d564b[_0x402dab(0x1ef)];_0x1f68d1['verbose']&&console[_0x402dab(0x281)]('Resolved\x20folder\x20ID:\x20'+_0x30bfe6);const _0x29b993=await withSpinner(_0x402dab(0x206)+_0x3d775a+_0x402dab(0x21f),()=>_0x396fee[_0x402dab(0x26e)][_0x402dab(0x201)](_0x30bfe6),{'verbose':_0x1f68d1['verbose']});return await handleSDKOutput([_0x29b993['data']],_0x1f68d1),0x0;}catch(_0x2b43b6){if(_0x2b43b6 instanceof SDKError)return console[_0x402dab(0x281)]('Error:\x20'+_0x2b43b6['message']),_0x2b43b6[_0x402dab(0x28c)]&&console[_0x402dab(0x281)](_0x402dab(0x236)+_0x2b43b6['cause']),0x1;throw _0x2b43b6;}}}function a37_0x2e8b(){const _0x48a369=['\x27...','resolvePathToResource','/app/ps/','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','segmentPath','INVALID_ARGUMENT','includes','red','\x20rows\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','getSegmentSQL','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','resolveParentId','execute','segment:folder:list','segment:sql','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','segmentId','message','\x20\x20Cause:\x20','Parent\x20name:\x20','log','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','SQL\x20query:\x0a','folder','listFolders','json','query','Get\x20SQL\x20query\x20for\x20child\x20segment','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Segment\x20ID:\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Fetching\x20folder\x20details...','Fetching\x20parent\x20segment\x20details...','name','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Folder\x20ID\x20missing\x20from\x20resolved\x20path','replace','site','Use:\x20tdx\x20ps\x20desc','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Folder\x20name:\x20','Show\x20segment\x20or\x20folder\x20details','8WKsmTf','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Site:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','\x20\x20Full\x20path:\x20','Parent\x20ID:\x20','segment:folder:create','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','\x20\x20Parent\x20segment:\x20','SELECT\x20*\x20FROM\x20(\x0a','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Resolving\x20parent\x20segment\x20\x27','286569uELKht','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','folderPath','Target\x20path:\x20','getSQLFromYamlFile','information_schema','parentFolder','description','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','parentSegment','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Resolved\x20parent\x20folder\x20ID:\x20','Error:\x20Folder\x20reference\x20is\x20required','Usage:','Resolving\x20\x27','✔\x20Query\x20completed:\x20Processed\x20','Usage:\x20tdx\x20segment\x20describe\x20<path>','resolveFolderId','segment','green','stats','Creating\x20folder\x20\x27','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','segmentName','171pMEwKH','Examples:','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Resolving\x20parent\x20folder\x20\x27','Resolved\x20parent\x20ID:\x20','Use:\x20tdx\x20ps\x20view','\x20[Job\x20ID:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','parentId','trim','limit','\x20\x20Folder\x20path:\x20','Error:\x20','error','Fetching\x20segment\x20details...','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','fullPath','Resolved\x20type:\x20','Resolving\x20path\x20\x27','setJobId','318OaTqcy','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','10ZdqFiA','length','cause','format','SEGMENT_FOLDER_NOT_FOUND','parent','verbose','elapsedTimeMillis','data','\x20Opening\x20','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','segment:folder:show','3868851KaPdsu','type','getSegmentSQLFromYaml','getSQLFromServerSegment','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Options:','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','toLocaleString','SEGMENT_NOT_FOUND','130330skJTYZ','Folder\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Show\x20folder\x20or\x20child\x20segment\x20details','getFolder','Resolved\x20relative\x20path\x20to:\x20','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','37055PqrRaz','\x20\x20Segment\x20name:\x20','Fetching\x20folder\x20\x27','✔\x20Created\x20folder\x20\x27','\x27\x20with\x20ID:\x20','getSegment','Create\x20segment\x20folder\x20for\x20organization','400227ckuOFH','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','jsonl','Usage:\x20tdx\x20sg\x20show\x20<name>','getParent','Show\x20child\x20segment\x20schema\x20(column\x20types)','Fetching\x20SQL\x20for\x20segment...','Executing\x20segment\x20query...','content','jobId','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','folderId','\x20folder','web','11416768KFyzkX','Error:\x20Path\x20or\x20name\x20is\x20required','segment:describe','1625488xaSmTx','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'];a37_0x2e8b=function(){return _0x48a369;};return a37_0x2e8b();}export class SegmentSQLCommand extends BaseCommand{[a37_0x867ae0(0x245)]=a37_0x867ae0(0x231);[a37_0x867ae0(0x263)]=a37_0x867ae0(0x23f);async['execute'](_0x348071){const _0x5e66a7=a37_0x867ae0,{options:_0x188346,args:_0x43e5a0}=_0x348071,_0x524683=_0x188346,_0x5cf41a=_0x524683['path'],_0x4255c0=_0x43e5a0[0x0];if(!_0x4255c0&&!_0x5cf41a)return console[_0x5e66a7(0x281)](a37_0x306a45[_0x5e66a7(0x227)]('Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required')),console[_0x5e66a7(0x281)](_0x5e66a7(0x269)),console['error'](_0x5e66a7(0x22c)),console[_0x5e66a7(0x281)](_0x5e66a7(0x22b)),console[_0x5e66a7(0x281)](_0x5e66a7(0x275)),console[_0x5e66a7(0x281)](_0x5e66a7(0x289)),console[_0x5e66a7(0x281)](_0x5e66a7(0x223)),0x1;if(_0x4255c0&&_0x5cf41a)return console[_0x5e66a7(0x281)](a37_0x306a45[_0x5e66a7(0x227)](_0x5e66a7(0x233))),0x1;try{let _0x46f77c;if(_0x5cf41a)_0x46f77c=await this[_0x5e66a7(0x260)](_0x5cf41a,_0x348071);else{if(isYamlFilePath(_0x4255c0))return console['error'](a37_0x306a45[_0x5e66a7(0x227)](_0x5e66a7(0x253))),console[_0x5e66a7(0x281)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20'+_0x4255c0),0x1;else _0x46f77c=await this[_0x5e66a7(0x1f6)](_0x4255c0,_0x348071);}return _0x188346[_0x5e66a7(0x28d)]===_0x5e66a7(0x23d)||_0x188346[_0x5e66a7(0x28d)]===_0x5e66a7(0x20e)?await handleSDKOutput([{'sql':_0x46f77c}],_0x188346):console[_0x5e66a7(0x238)](_0x46f77c),0x0;}catch(_0x5a83af){if(_0x5a83af instanceof SDKError)return console['error'](_0x5e66a7(0x280)+_0x5a83af[_0x5e66a7(0x235)]),_0x5a83af[_0x5e66a7(0x28c)]&&console[_0x5e66a7(0x281)](_0x5e66a7(0x236)+_0x5a83af[_0x5e66a7(0x28c)]),0x1;throw _0x5a83af;}}async[a37_0x867ae0(0x260)](_0x64228d,_0x54563b){const _0x26e551=a37_0x867ae0,{options:_0x5e709a,tdx:_0x2ca70e}=_0x54563b;let _0x1d3140;try{_0x1d3140=await resolveYamlFilePath(_0x64228d);}catch(_0x4e75f6){throw new SDKError(ErrorCode[_0x26e551(0x225)],_0x26e551(0x20d)+_0x4e75f6[_0x26e551(0x235)]);}_0x5e709a['verbose']&&console[_0x26e551(0x281)]('Resolved:\x20'+_0x1d3140[_0x26e551(0x265)]+'/'+_0x1d3140[_0x26e551(0x273)]);const _0x42b019=await withSpinner('Fetching\x20SQL\x20from\x20rule...',()=>_0x2ca70e[_0x26e551(0x26e)][_0x26e551(0x1f5)](_0x1d3140[_0x26e551(0x214)],_0x1d3140[_0x26e551(0x265)],_0x1d3140[_0x26e551(0x273)]),{'verbose':_0x5e709a[_0x26e551(0x290)]});return _0x42b019[_0x26e551(0x1ef)];}async[a37_0x867ae0(0x1f6)](_0x319d1d,_0x592202){const _0x1ee7fc=a37_0x867ae0,{options:_0x30c945,tdx:_0x47899a}=_0x592202,_0x4b52a2=_0x30c945[_0x1ee7fc(0x265)],_0x5dd2ac=await resolveSegmentTarget(_0x319d1d,_0x4b52a2,_0x30c945[_0x1ee7fc(0x290)]);_0x30c945['verbose']&&console[_0x1ee7fc(0x281)](_0x1ee7fc(0x25f)+_0x5dd2ac);const _0xd9dc26=await withSpinner(_0x1ee7fc(0x26a)+_0x319d1d+_0x1ee7fc(0x21f),()=>_0x47899a[_0x1ee7fc(0x26e)][_0x1ee7fc(0x220)](_0x5dd2ac),{'verbose':_0x30c945[_0x1ee7fc(0x290)]}),_0x39c87a=_0xd9dc26[_0x1ee7fc(0x1ef)];_0x30c945[_0x1ee7fc(0x290)]&&(console[_0x1ee7fc(0x281)](_0x1ee7fc(0x285)+_0x39c87a['type']),console[_0x1ee7fc(0x281)](_0x1ee7fc(0x255)+_0x39c87a[_0x1ee7fc(0x27c)]));if(_0x39c87a['type']===_0x1ee7fc(0x23b))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1ee7fc(0x216));if(_0x39c87a['type']==='parent')throw new SDKError(ErrorCode[_0x1ee7fc(0x225)],'Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql');if(!_0x39c87a[_0x1ee7fc(0x234)])throw new SDKError(ErrorCode[_0x1ee7fc(0x1fb)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x2c973a=await withSpinner(_0x1ee7fc(0x212),()=>_0x47899a[_0x1ee7fc(0x26e)][_0x1ee7fc(0x22a)](_0x39c87a[_0x1ee7fc(0x27c)],_0x39c87a['segmentId']),{'verbose':_0x30c945[_0x1ee7fc(0x290)]});return _0x2c973a[_0x1ee7fc(0x1ef)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x867ae0(0x245)]=a37_0x867ae0(0x256);[a37_0x867ae0(0x263)]=a37_0x867ae0(0x20a);async[a37_0x867ae0(0x22f)](_0x49b26d){const _0x3e3166=a37_0x867ae0,{options:_0x47b694,args:_0x567008,tdx:_0x5e528d}=_0x49b26d,_0x2dff9d=_0x47b694;if(_0x567008[_0x3e3166(0x28b)]<0x2)return console[_0x3e3166(0x281)](_0x3e3166(0x252)),console[_0x3e3166(0x281)](_0x3e3166(0x24f)),0x1;const _0x130183=_0x567008[0x0],_0xb5a0b1=_0x567008[0x1];_0x2dff9d[_0x3e3166(0x290)]&&(console[_0x3e3166(0x281)](_0x3e3166(0x250)+_0x2dff9d[_0x3e3166(0x249)]),console['error']('Parent\x20segment:\x20'+_0x130183),console['error'](_0x3e3166(0x24c)+_0xb5a0b1));let _0xb794bf;if(_0x2dff9d['parentFolder']){const _0x22ed88=_0x2dff9d[_0x3e3166(0x262)],_0x44c5e3=await withSpinner(_0x3e3166(0x25b)+_0x130183+_0x3e3166(0x21f),()=>_0x5e528d[_0x3e3166(0x26e)][_0x3e3166(0x22e)](_0x130183),{'verbose':_0x2dff9d['verbose']}),_0x757c5c=_0x44c5e3['data'],_0x4614bc=await withSpinner(_0x3e3166(0x277)+_0x22ed88+_0x3e3166(0x21f),()=>_0x5e528d[_0x3e3166(0x26e)][_0x3e3166(0x26d)](_0x757c5c,_0x22ed88),{'verbose':_0x2dff9d[_0x3e3166(0x290)]});_0xb794bf=_0x4614bc['data'],_0x2dff9d[_0x3e3166(0x290)]&&console[_0x3e3166(0x281)](_0x3e3166(0x267)+_0xb794bf);}const _0x1994e4={'name':_0xb5a0b1,'description':_0x2dff9d[_0x3e3166(0x263)],'parentFolderId':_0xb794bf},_0x58d7f1=await withSpinner(_0x3e3166(0x271)+_0xb5a0b1+_0x3e3166(0x21f),()=>_0x5e528d['segment']['createFolder'](_0x130183,_0x1994e4),{'verbose':_0x2dff9d[_0x3e3166(0x290)]}),_0x5b6e31=_0x58d7f1[_0x3e3166(0x1ef)];return console[_0x3e3166(0x281)](_0x3e3166(0x207)+_0x5b6e31[_0x3e3166(0x245)]+_0x3e3166(0x208)+_0x5b6e31['id']),await handleSDKOutput([_0x5b6e31],_0x2dff9d),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x867ae0(0x245)]='segment:view';[a37_0x867ae0(0x263)]=a37_0x867ae0(0x200);async[a37_0x867ae0(0x22f)](_0x3ddb5c){const _0x54a649=a37_0x867ae0,{options:_0x1ba757,args:_0x57f97c,tdx:_0xb2b6d0}=_0x3ddb5c,_0x491445=_0x57f97c[0x0];if(!_0x491445)return console[_0x54a649(0x281)](_0x54a649(0x1f9)),console[_0x54a649(0x281)](_0x54a649(0x239)),console[_0x54a649(0x281)](_0x54a649(0x1fe)),console[_0x54a649(0x281)](_0x54a649(0x1f8)),console[_0x54a649(0x281)](_0x54a649(0x1f1)),console['error'](_0x54a649(0x275)),console[_0x54a649(0x281)](_0x54a649(0x257)),console['error'](_0x54a649(0x240)),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console['error'](_0x54a649(0x222)),0x1;try{const _0x5ac86d=_0x1ba757['parentSegment'],_0x26237e=await resolveSegmentTarget(_0x491445,_0x5ac86d,_0x1ba757['verbose']);_0x1ba757['verbose']&&console['error'](_0x54a649(0x25f)+_0x26237e);const _0x4fdb29=await withSpinner(_0x54a649(0x26a)+_0x491445+_0x54a649(0x21f),()=>_0xb2b6d0[_0x54a649(0x26e)][_0x54a649(0x220)](_0x26237e),{'verbose':_0x1ba757['verbose']}),_0xbcaa33=_0x4fdb29[_0x54a649(0x1ef)];_0x1ba757[_0x54a649(0x290)]&&(console[_0x54a649(0x281)]('Resolved\x20type:\x20'+_0xbcaa33[_0x54a649(0x1f4)]),console[_0x54a649(0x281)]('Parent\x20ID:\x20'+_0xbcaa33['parentId']),_0xbcaa33[_0x54a649(0x217)]&&console[_0x54a649(0x281)](_0x54a649(0x1fd)+_0xbcaa33[_0x54a649(0x217)]),_0xbcaa33[_0x54a649(0x234)]&&console[_0x54a649(0x281)](_0x54a649(0x241)+_0xbcaa33[_0x54a649(0x234)]));if(_0x1ba757[_0x54a649(0x219)]){if(_0xbcaa33[_0x54a649(0x1f4)]===_0x54a649(0x23b))return console[_0x54a649(0x281)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0xbcaa33[_0x54a649(0x1f4)]===_0x54a649(0x28f))return console['error'](_0x54a649(0x242)),console[_0x54a649(0x281)]('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0xbcaa33[_0x54a649(0x234)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x54a649(0x246));const _0x3b9749=getConsoleNextUrl(_0x1ba757[_0x54a649(0x249)],_0x54a649(0x221)+_0xbcaa33[_0x54a649(0x27c)]+'/e/'+_0xbcaa33[_0x54a649(0x234)]);return console[_0x54a649(0x281)](a37_0x306a45[_0x54a649(0x26f)]('✔')+_0x54a649(0x1f0)+a37_0x306a45['cyan'](_0x3b9749)),openBrowser(_0x3b9749),0x0;}if(_0xbcaa33[_0x54a649(0x1f4)]===_0x54a649(0x23b)){if(!_0xbcaa33[_0x54a649(0x217)])throw new SDKError(ErrorCode[_0x54a649(0x28e)],_0x54a649(0x247));const _0x331c04=await withSpinner(_0x54a649(0x243),()=>_0xb2b6d0[_0x54a649(0x26e)][_0x54a649(0x201)](_0xbcaa33[_0x54a649(0x217)]),{'verbose':_0x1ba757['verbose']});await handleSingleObjectOutput(_0x331c04['data'],_0x1ba757);}else{if(_0xbcaa33[_0x54a649(0x1f4)]===_0x54a649(0x26e)){if(!_0xbcaa33[_0x54a649(0x234)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x54a649(0x246));const _0x50f8a5=await withSpinner(_0x54a649(0x282),()=>_0xb2b6d0[_0x54a649(0x26e)]['getSegment'](_0xbcaa33[_0x54a649(0x27c)],_0xbcaa33[_0x54a649(0x234)]),{'verbose':_0x1ba757['verbose']}),_0x5bda3a=getConsoleNextUrl(_0x1ba757['site'],_0x54a649(0x221)+_0xbcaa33['parentId']+'/e/'+_0xbcaa33[_0x54a649(0x234)]),_0x369338=_0x50f8a5[_0x54a649(0x1ef)];_0x369338['url']=_0x5bda3a,await handleSingleObjectOutput(_0x369338,_0x1ba757);}else return console['error']('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console[_0x54a649(0x281)](_0x54a649(0x279)),0x1;}return 0x0;}catch(_0x474475){if(_0x474475 instanceof SDKError)return console[_0x54a649(0x281)](_0x54a649(0x280)+_0x474475['message']),_0x474475[_0x54a649(0x28c)]&&console[_0x54a649(0x281)](_0x54a649(0x236)+_0x474475[_0x54a649(0x28c)]),0x1;throw _0x474475;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x867ae0(0x245)]='segment:desc';[a37_0x867ae0(0x263)]=a37_0x867ae0(0x211);async[a37_0x867ae0(0x22f)](_0x2fa761){const _0x145e27=a37_0x867ae0,{options:_0x231219,args:_0xb6733d,tdx:_0x2380a6}=_0x2fa761,_0x1b0638=_0xb6733d[0x0];if(!_0x1b0638)return console[_0x145e27(0x281)](_0x145e27(0x229)),console[_0x145e27(0x281)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x145e27(0x281)](_0x145e27(0x25d)),console[_0x145e27(0x281)](_0x145e27(0x275)),console['error'](_0x145e27(0x25a)),console[_0x145e27(0x281)](_0x145e27(0x283)),0x1;try{const _0x41d7b5=_0x231219['parentSegment'],_0x23ca18=await resolveSegmentTarget(_0x1b0638,_0x41d7b5,_0x231219[_0x145e27(0x290)]);_0x231219[_0x145e27(0x290)]&&console[_0x145e27(0x281)]('Target\x20path:\x20'+_0x23ca18);const _0x1b8c58=await withSpinner('Resolving\x20\x27'+_0x1b0638+_0x145e27(0x21f),()=>_0x2380a6[_0x145e27(0x26e)][_0x145e27(0x220)](_0x23ca18),{'verbose':_0x231219[_0x145e27(0x290)]}),_0x356498=_0x1b8c58[_0x145e27(0x1ef)];_0x231219[_0x145e27(0x290)]&&(console[_0x145e27(0x281)](_0x145e27(0x285)+_0x356498[_0x145e27(0x1f4)]),console[_0x145e27(0x281)](_0x145e27(0x255)+_0x356498[_0x145e27(0x27c)]));if(_0x356498[_0x145e27(0x1f4)]===_0x145e27(0x23b))return console[_0x145e27(0x281)](_0x145e27(0x27b)),console[_0x145e27(0x281)](_0x145e27(0x264)),0x1;if(_0x356498['type']===_0x145e27(0x28f))return console[_0x145e27(0x281)](_0x145e27(0x251)),console[_0x145e27(0x281)](_0x145e27(0x24a)),0x1;if(!_0x356498[_0x145e27(0x234)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x145e27(0x246));const _0x4cbd9f=await withSpinner(_0x145e27(0x212),()=>_0x2380a6[_0x145e27(0x26e)][_0x145e27(0x22a)](_0x356498[_0x145e27(0x27c)],_0x356498[_0x145e27(0x234)]),{'verbose':_0x231219[_0x145e27(0x290)]}),_0x13f9a0=_0x4cbd9f[_0x145e27(0x1ef)],_0x16c0f2=await executeSchemaQuery(_0x13f9a0,_0x2380a6,_0x231219);return await handleQueryOutput(_0x16c0f2,_0x231219),0x0;}catch(_0x4a0da8){if(_0x4a0da8 instanceof SDKError)return console[_0x145e27(0x281)](_0x145e27(0x280)+_0x4a0da8[_0x145e27(0x235)]),_0x4a0da8[_0x145e27(0x28c)]&&console[_0x145e27(0x281)](_0x145e27(0x236)+_0x4a0da8[_0x145e27(0x28c)]),0x1;throw _0x4a0da8;}}}
@@ -1 +1 @@
1
- function a38_0x1dea(){const _0x32db4f=['Segment\x20name:\x20','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','1038Chntjk','18190cYyWee','Creating\x20segment\x20\x27','kind','resolveFolderId','noCountPopulation','resolveParentId','yellow','parent','Resolving\x20parent\x20segment\x20\x27','2842968ZdkGBh','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','Parent:\x20','segmentPath','name','folderId','segments','\x20\x20\x20Path:\x20','1064kwpLDD','data','segment:create','includes','folder','Resolved\x20folder\x20ID:\x20','50351XdrLAh','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','27825050RHeNEe','\x27\x20with\x20ID:\x20','664718Uwsvgk','length','11564487vRNXua','10cdgACf','Target\x20path:\x20','\x27...','error','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Resolved\x20relative\x20path\x20to:\x20','verbose','2863808TKMBme','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','Examples:','resolvePathToResource','Create\x20child\x20segment\x20with\x20filtering\x20rules','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','Site:\x20','segment','Parent\x20path:\x20','type','2nhRoWt','✔\x20Created\x20segment\x20\x27','execute'];a38_0x1dea=function(){return _0x32db4f;};return a38_0x1dea();}const a38_0x570250=a38_0x27c8;(function(_0x2e6c2d,_0x5aa80c){const _0x47ada2=a38_0x27c8,_0x48793b=_0x2e6c2d();while(!![]){try{const _0x54066f=-parseInt(_0x47ada2(0xa7))/0x1*(parseInt(_0x47ada2(0xbc))/0x2)+parseInt(_0x47ada2(0xcc))/0x3+parseInt(_0x47ada2(0xb2))/0x4+-parseInt(_0x47ada2(0xc3))/0x5*(parseInt(_0x47ada2(0xc2))/0x6)+-parseInt(_0x47ada2(0xa3))/0x7*(parseInt(_0x47ada2(0xd4))/0x8)+-parseInt(_0x47ada2(0xa9))/0x9+parseInt(_0x47ada2(0xaa))/0xa*(parseInt(_0x47ada2(0xa5))/0xb);if(_0x54066f===_0x5aa80c)break;else _0x48793b['push'](_0x48793b['shift']());}catch(_0x3869c5){_0x48793b['push'](_0x48793b['shift']());}}}(a38_0x1dea,0xa082e));import{BaseCommand}from'./command.js';function a38_0x27c8(_0x1d870d,_0x2ac3fb){_0x1d870d=_0x1d870d-0x9e;const _0x1dea50=a38_0x1dea();let _0x27c8bc=_0x1dea50[_0x1d870d];return _0x27c8bc;}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x385835 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x570250(0xd0)]=a38_0x570250(0x9f);['description']=a38_0x570250(0xb6);async[a38_0x570250(0xbe)](_0x5a917b){const _0x58230b=a38_0x570250;console[_0x58230b(0xad)](a38_0x385835[_0x58230b(0xc9)](_0x58230b(0xa4))),console[_0x58230b(0xad)](a38_0x385835[_0x58230b(0xc9)](_0x58230b(0xae)));const {options:_0xd81a4,args:_0x3dbc29,tdx:_0x3d5543}=_0x5a917b,_0x4af4a0=_0xd81a4;if(_0x3dbc29['length']===0x0)return console[_0x58230b(0xad)](_0x58230b(0xaf)),console[_0x58230b(0xad)](_0x58230b(0xb3)),console[_0x58230b(0xad)](_0x58230b(0xb4)),console[_0x58230b(0xad)](_0x58230b(0xcd)),console[_0x58230b(0xad)](_0x58230b(0xc1)),console[_0x58230b(0xad)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x1f5e8c=_0x3dbc29[0x0],_0x26881d=_0xd81a4[_0x58230b(0xcf)];let _0x1f6873=_0x1f5e8c;_0x26881d&&!_0x1f5e8c[_0x58230b(0xa0)]('/')&&(_0x1f6873=_0x26881d+'/'+_0x1f5e8c,_0x4af4a0[_0x58230b(0xb1)]&&console['error'](_0x58230b(0xb0)+_0x1f6873));const _0x3c1edd=parsePath(_0x1f6873);if(_0x3c1edd['segments'][_0x58230b(0xa8)]<0x2)return console['error'](_0x58230b(0xc0)),console[_0x58230b(0xad)](_0x58230b(0xb7)),0x1;const _0x2a4f1c=_0x3c1edd[_0x58230b(0xd2)][0x0],_0x589246=getBaseName(_0x1f6873),_0x5d057f=getParentPath(_0x1f6873);_0x4af4a0[_0x58230b(0xb1)]&&(console[_0x58230b(0xad)](_0x58230b(0xb8)+_0x4af4a0['site']),console[_0x58230b(0xad)](_0x58230b(0xab)+_0x1f6873),console['error'](_0x58230b(0xce)+_0x2a4f1c),console[_0x58230b(0xad)](_0x58230b(0xbf)+_0x589246),console['error'](_0x58230b(0xba)+_0x5d057f));const _0x5513b7=await withSpinner(_0x58230b(0xcb)+_0x2a4f1c+_0x58230b(0xac),()=>_0x3d5543[_0x58230b(0xb9)][_0x58230b(0xc8)](_0x2a4f1c),{'verbose':_0x4af4a0['verbose']}),_0x3d2fde=_0x5513b7[_0x58230b(0x9e)];let _0x48e34a;if(_0x3c1edd['segments'][_0x58230b(0xa8)]>0x2){const _0x2d7e24=await withSpinner('Resolving\x20folder\x20path\x20\x27'+_0x5d057f+_0x58230b(0xac),()=>_0x3d5543[_0x58230b(0xb9)][_0x58230b(0xb5)](_0x5d057f),{'verbose':_0x4af4a0[_0x58230b(0xb1)]}),_0x3a9f7e=_0x2d7e24['data'];if(_0x3a9f7e[_0x58230b(0xbb)]!==_0x58230b(0xa1)&&_0x3a9f7e[_0x58230b(0xbb)]!==_0x58230b(0xca))return console['error']('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x48e34a=_0x3a9f7e[_0x58230b(0xd1)];}else{if(_0x4af4a0[_0x58230b(0xa1)]){const _0x3f29ee=await withSpinner('Resolving\x20folder\x20\x27'+_0x4af4a0['folder']+'\x27...',()=>_0x3d5543[_0x58230b(0xb9)][_0x58230b(0xc6)](_0x3d2fde,_0x4af4a0[_0x58230b(0xa1)]),{'verbose':_0x4af4a0[_0x58230b(0xb1)]});_0x48e34a=_0x3f29ee['data'];}}_0x4af4a0[_0x58230b(0xb1)]&&_0x48e34a&&console[_0x58230b(0xad)](_0x58230b(0xa2)+_0x48e34a);const _0x1a0f26=await loadJSONFromOptions(_0x4af4a0['rule'],_0x4af4a0['ruleFile']),_0x39d794={'name':_0x589246,'description':_0x4af4a0['description'],'rule':_0x1a0f26,'kind':_0x4af4a0[_0x58230b(0xc5)]!==undefined?parseInt(_0x4af4a0[_0x58230b(0xc5)],0xa):undefined,'isVisible':_0x4af4a0['invisible']?![]:undefined,'segmentFolderId':_0x48e34a,'countPopulation':_0x4af4a0[_0x58230b(0xc7)]?![]:undefined},_0x2a72b2=await withSpinner(_0x58230b(0xc4)+_0x589246+'\x27...',()=>_0x3d5543[_0x58230b(0xb9)]['createSegment'](_0x3d2fde,_0x39d794),{'verbose':_0x4af4a0[_0x58230b(0xb1)]}),_0x1aa958=_0x2a72b2[_0x58230b(0x9e)];return console[_0x58230b(0xad)](_0x58230b(0xbd)+_0x1aa958[_0x58230b(0xd0)]+_0x58230b(0xa6)+_0x1aa958['id']),_0x1f6873!==_0x1f5e8c&&console[_0x58230b(0xad)](_0x58230b(0xd3)+_0x1f6873),await handleSDKOutput([_0x1aa958],_0x4af4a0),0x0;}}
1
+ const a38_0x233339=a38_0x5112;(function(_0x411e0e,_0x3e865f){const _0x4414de=a38_0x5112,_0x3af513=_0x411e0e();while(!![]){try{const _0x2d73f3=parseInt(_0x4414de(0x150))/0x1*(-parseInt(_0x4414de(0x15f))/0x2)+-parseInt(_0x4414de(0x163))/0x3+parseInt(_0x4414de(0x17e))/0x4+-parseInt(_0x4414de(0x17c))/0x5*(parseInt(_0x4414de(0x16c))/0x6)+-parseInt(_0x4414de(0x16a))/0x7+parseInt(_0x4414de(0x166))/0x8*(-parseInt(_0x4414de(0x178))/0x9)+parseInt(_0x4414de(0x151))/0xa;if(_0x2d73f3===_0x3e865f)break;else _0x3af513['push'](_0x3af513['shift']());}catch(_0x4f7b1f){_0x3af513['push'](_0x3af513['shift']());}}}(a38_0x4368,0xe3b82));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';function a38_0x4368(){const _0x2bb1ca=['noCountPopulation','\x27\x20with\x20ID:\x20','5031837sMsYXu','segment','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','271496muhlMG','folder','error','ruleFile','6361047zTPspY','type','5169378wJfcli','invisible','✔\x20Created\x20segment\x20\x27','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','resolvePathToResource','yellow','Resolved\x20folder\x20ID:\x20','Resolving\x20folder\x20\x27','segment:create','rule','Resolving\x20folder\x20path\x20\x27','segmentPath','360xncsBf','\x27...','Examples:','kind','5QTJlYY','Resolving\x20parent\x20segment\x20\x27','6659800AExeXZ','segments','resolveFolderId','Parent:\x20','resolveParentId','1083BERPic','45569320mgmlpD','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','Parent\x20path:\x20','data','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','name','\x20\x20\x20Path:\x20','length','Target\x20path:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','Creating\x20segment\x20\x27','description','verbose','894kmpzsU','createSegment'];a38_0x4368=function(){return _0x2bb1ca;};return a38_0x4368();}function a38_0x5112(_0x247cb3,_0x5f4942){_0x247cb3=_0x247cb3-0x14f;const _0x43687a=a38_0x4368();let _0x511270=_0x43687a[_0x247cb3];return _0x511270;}import a38_0x109228 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x233339(0x157)]=a38_0x233339(0x174);['description']='Create\x20child\x20segment\x20with\x20filtering\x20rules';async['execute'](_0xc5a655){const _0x3e6e06=a38_0x233339;console[_0x3e6e06(0x168)](a38_0x109228[_0x3e6e06(0x171)](_0x3e6e06(0x153))),console['error'](a38_0x109228[_0x3e6e06(0x171)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x50e608,args:_0x1b6e5,tdx:_0x3e01a4}=_0xc5a655,_0x36a324=_0x50e608;if(_0x1b6e5['length']===0x0)return console[_0x3e6e06(0x168)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x3e6e06(0x168)]('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console[_0x3e6e06(0x168)](_0x3e6e06(0x17a)),console[_0x3e6e06(0x168)](_0x3e6e06(0x15b)),console[_0x3e6e06(0x168)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console[_0x3e6e06(0x168)](_0x3e6e06(0x156)),0x1;const _0x1702c2=_0x1b6e5[0x0],_0xbaa52e=_0x50e608[_0x3e6e06(0x177)];let _0x32ad56=_0x1702c2;_0xbaa52e&&!_0x1702c2['includes']('/')&&(_0x32ad56=_0xbaa52e+'/'+_0x1702c2,_0x36a324[_0x3e6e06(0x15e)]&&console[_0x3e6e06(0x168)]('Resolved\x20relative\x20path\x20to:\x20'+_0x32ad56));const _0xd31291=parsePath(_0x32ad56);if(_0xd31291[_0x3e6e06(0x17f)]['length']<0x2)return console[_0x3e6e06(0x168)](_0x3e6e06(0x152)),console[_0x3e6e06(0x168)](_0x3e6e06(0x165)),0x1;const _0x2bfe13=_0xd31291[_0x3e6e06(0x17f)][0x0],_0xe4ad26=getBaseName(_0x32ad56),_0x170f99=getParentPath(_0x32ad56);_0x36a324[_0x3e6e06(0x15e)]&&(console[_0x3e6e06(0x168)]('Site:\x20'+_0x36a324['site']),console[_0x3e6e06(0x168)](_0x3e6e06(0x15a)+_0x32ad56),console[_0x3e6e06(0x168)](_0x3e6e06(0x181)+_0x2bfe13),console[_0x3e6e06(0x168)]('Segment\x20name:\x20'+_0xe4ad26),console[_0x3e6e06(0x168)](_0x3e6e06(0x154)+_0x170f99));const _0x17f9f0=await withSpinner(_0x3e6e06(0x17d)+_0x2bfe13+_0x3e6e06(0x179),()=>_0x3e01a4['segment'][_0x3e6e06(0x14f)](_0x2bfe13),{'verbose':_0x36a324[_0x3e6e06(0x15e)]}),_0x3cf6af=_0x17f9f0[_0x3e6e06(0x155)];let _0x3e6759;if(_0xd31291[_0x3e6e06(0x17f)][_0x3e6e06(0x159)]>0x2){const _0x293b47=await withSpinner(_0x3e6e06(0x176)+_0x170f99+_0x3e6e06(0x179),()=>_0x3e01a4['segment'][_0x3e6e06(0x170)](_0x170f99),{'verbose':_0x36a324[_0x3e6e06(0x15e)]}),_0x15eb08=_0x293b47[_0x3e6e06(0x155)];if(_0x15eb08[_0x3e6e06(0x16b)]!=='folder'&&_0x15eb08[_0x3e6e06(0x16b)]!=='parent')return console['error'](_0x3e6e06(0x16f)),0x1;_0x3e6759=_0x15eb08['folderId'];}else{if(_0x36a324[_0x3e6e06(0x167)]){const _0x2abf99=await withSpinner(_0x3e6e06(0x173)+_0x36a324[_0x3e6e06(0x167)]+'\x27...',()=>_0x3e01a4[_0x3e6e06(0x164)][_0x3e6e06(0x180)](_0x3cf6af,_0x36a324[_0x3e6e06(0x167)]),{'verbose':_0x36a324['verbose']});_0x3e6759=_0x2abf99[_0x3e6e06(0x155)];}}_0x36a324[_0x3e6e06(0x15e)]&&_0x3e6759&&console[_0x3e6e06(0x168)](_0x3e6e06(0x172)+_0x3e6759);const _0xa9de32=await loadJSONFromOptions(_0x36a324[_0x3e6e06(0x175)],_0x36a324[_0x3e6e06(0x169)]),_0xf9dd25={'name':_0xe4ad26,'description':_0x36a324[_0x3e6e06(0x15d)],'rule':_0xa9de32,'kind':_0x36a324['kind']!==undefined?parseInt(_0x36a324[_0x3e6e06(0x17b)],0xa):undefined,'isVisible':_0x36a324[_0x3e6e06(0x16d)]?![]:undefined,'segmentFolderId':_0x3e6759,'countPopulation':_0x36a324[_0x3e6e06(0x161)]?![]:undefined},_0x44e5d8=await withSpinner(_0x3e6e06(0x15c)+_0xe4ad26+'\x27...',()=>_0x3e01a4['segment'][_0x3e6e06(0x160)](_0x3cf6af,_0xf9dd25),{'verbose':_0x36a324[_0x3e6e06(0x15e)]}),_0xac2e07=_0x44e5d8['data'];return console[_0x3e6e06(0x168)](_0x3e6e06(0x16e)+_0xac2e07['name']+_0x3e6e06(0x162)+_0xac2e07['id']),_0x32ad56!==_0x1702c2&&console[_0x3e6e06(0x168)](_0x3e6e06(0x158)+_0x32ad56),await handleSDKOutput([_0xac2e07],_0x36a324),0x0;}}
@@ -1 +1 @@
1
- const a39_0x4c601c=a39_0x2789;(function(_0x4dc2d9,_0x4754bf){const _0x5e9313=a39_0x2789,_0x8a10c7=_0x4dc2d9();while(!![]){try{const _0x2d85be=-parseInt(_0x5e9313(0x7e))/0x1*(parseInt(_0x5e9313(0x94))/0x2)+parseInt(_0x5e9313(0x92))/0x3*(parseInt(_0x5e9313(0x93))/0x4)+-parseInt(_0x5e9313(0x85))/0x5*(-parseInt(_0x5e9313(0x7a))/0x6)+parseInt(_0x5e9313(0x97))/0x7*(-parseInt(_0x5e9313(0x87))/0x8)+-parseInt(_0x5e9313(0x81))/0x9*(-parseInt(_0x5e9313(0x95))/0xa)+parseInt(_0x5e9313(0x8f))/0xb+parseInt(_0x5e9313(0x96))/0xc*(-parseInt(_0x5e9313(0x8c))/0xd);if(_0x2d85be===_0x4754bf)break;else _0x8a10c7['push'](_0x8a10c7['shift']());}catch(_0x3ee241){_0x8a10c7['push'](_0x8a10c7['shift']());}}}(a39_0xab6a,0xa426c));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a39_0x2789(_0x3a6e3e,_0x39d230){_0x3a6e3e=_0x3a6e3e-0x79;const _0xab6a0d=a39_0xab6a();let _0x27897f=_0xab6a0d[_0x3a6e3e];return _0x27897f;}function a39_0xab6a(){const _0x514036=['length','4479519nEchmG','Parent\x20segment:\x20','\x20field','2210133OUeHSA','4XCBMWl','122518tvUGLf','501190KzjeJV','4296PEwFso','7smtQdT','site','verbose','2358NbBews','segment','✔\x20Found\x20','parentSegment','14gXTLBD','Site:\x20','Listing\x20fields\x20for\x20\x27','45JAIxJZ','json','segment:fields','execute','9930YOnGLY','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','5137432EBmOFR','listFields','description','error','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','104XXvbUh','data'];a39_0xab6a=function(){return _0x514036;};return a39_0xab6a();}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{['name']=a39_0x4c601c(0x83);[a39_0x4c601c(0x89)]='List\x20available\x20fields\x20for\x20segmentation';async[a39_0x4c601c(0x84)](_0xcdb77d){const _0x331f31=a39_0x4c601c,{options:_0x47c556,args:_0x1adc5a,tdx:_0x185127}=_0xcdb77d,_0x40b190=_0x1adc5a[0x0]||_0x47c556[_0x331f31(0x7d)];if(!_0x40b190)return console['error']('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console['error'](_0x331f31(0x86)),console[_0x331f31(0x8a)](_0x331f31(0x8b)),0x1;_0x47c556[_0x331f31(0x79)]&&(console[_0x331f31(0x8a)](_0x331f31(0x7f)+_0x47c556[_0x331f31(0x98)]),console['error'](_0x331f31(0x90)+_0x40b190));const _0x554493=await withSpinner(_0x331f31(0x80)+_0x40b190+'\x27...',()=>_0x185127[_0x331f31(0x7b)][_0x331f31(0x88)](_0x40b190),{'verbose':_0x47c556[_0x331f31(0x79)]}),_0x4b792c=_0x554493[_0x331f31(0x8d)];console[_0x331f31(0x8a)](_0x331f31(0x7c)+_0x4b792c[_0x331f31(0x8e)]+_0x331f31(0x91)+(_0x4b792c[_0x331f31(0x8e)]!==0x1?'s':''));if(_0x47c556[_0x331f31(0x82)]||_0x47c556['jsonl'])return await handleSDKOutput(_0x4b792c,_0x47c556),0x0;return displayFieldsHumanReadable(_0x4b792c,_0x40b190),0x0;}}
1
+ const a39_0x5734ed=a39_0xb4a0;(function(_0x181aa2,_0x48b7e6){const _0x42d0b6=a39_0xb4a0,_0x3a2f8d=_0x181aa2();while(!![]){try{const _0x4f3883=-parseInt(_0x42d0b6(0x108))/0x1+-parseInt(_0x42d0b6(0xfa))/0x2*(parseInt(_0x42d0b6(0x100))/0x3)+parseInt(_0x42d0b6(0x107))/0x4*(-parseInt(_0x42d0b6(0xf2))/0x5)+-parseInt(_0x42d0b6(0xfe))/0x6*(parseInt(_0x42d0b6(0xfd))/0x7)+parseInt(_0x42d0b6(0xf7))/0x8+parseInt(_0x42d0b6(0xf6))/0x9*(parseInt(_0x42d0b6(0x109))/0xa)+parseInt(_0x42d0b6(0xef))/0xb;if(_0x4f3883===_0x48b7e6)break;else _0x3a2f8d['push'](_0x3a2f8d['shift']());}catch(_0x2edf42){_0x3a2f8d['push'](_0x3a2f8d['shift']());}}}(a39_0x2f84,0x82634));function a39_0xb4a0(_0x19c528,_0x4e234e){_0x19c528=_0x19c528-0xee;const _0x2f840a=a39_0x2f84();let _0xb4a06d=_0x2f840a[_0x19c528];return _0xb4a06d;}function a39_0x2f84(){const _0x30c795=['data','\x27...','440584rixLVh','424222uFBhBU','10tHbngX','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','listFields','description','Listing\x20fields\x20for\x20\x27','parentSegment','7516113ZJBygq','✔\x20Found\x20','site','25XxaJWm','Error:\x20Parent\x20segment\x20name\x20is\x20required','verbose','List\x20available\x20fields\x20for\x20segmentation','6166548nfPzwi','7910296cJbTsM','name','length','12ctwaus','segment:fields','\x20field','4889528BJfxrZ','6OSPlld','segment','74859fxqVXd','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','error','json','Parent\x20segment:\x20'];a39_0x2f84=function(){return _0x30c795;};return a39_0x2f84();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a39_0x5734ed(0xf8)]=a39_0x5734ed(0xfb);[a39_0x5734ed(0x10c)]=a39_0x5734ed(0xf5);async['execute'](_0x4ef708){const _0x217d15=a39_0x5734ed,{options:_0x32e986,args:_0x18959b,tdx:_0x5307ef}=_0x4ef708,_0x22aa1c=_0x18959b[0x0]||_0x32e986[_0x217d15(0xee)];if(!_0x22aa1c)return console['error'](_0x217d15(0xf3)),console[_0x217d15(0x102)](_0x217d15(0x10a)),console['error'](_0x217d15(0x101)),0x1;_0x32e986[_0x217d15(0xf4)]&&(console[_0x217d15(0x102)]('Site:\x20'+_0x32e986[_0x217d15(0xf1)]),console['error'](_0x217d15(0x104)+_0x22aa1c));const _0x4b95c5=await withSpinner(_0x217d15(0x10d)+_0x22aa1c+_0x217d15(0x106),()=>_0x5307ef[_0x217d15(0xff)][_0x217d15(0x10b)](_0x22aa1c),{'verbose':_0x32e986[_0x217d15(0xf4)]}),_0x1b6bfb=_0x4b95c5[_0x217d15(0x105)];console[_0x217d15(0x102)](_0x217d15(0xf0)+_0x1b6bfb['length']+_0x217d15(0xfc)+(_0x1b6bfb[_0x217d15(0xf9)]!==0x1?'s':''));if(_0x32e986[_0x217d15(0x103)]||_0x32e986['jsonl'])return await handleSDKOutput(_0x1b6bfb,_0x32e986),0x0;return displayFieldsHumanReadable(_0x1b6bfb,_0x22aa1c),0x0;}}