@treasuredata/tdx 2026.4.21 → 2026.4.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/cas-command.js +1 -1
  11. package/dist/commands/cas-segment-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.d.ts.map +1 -1
  14. package/dist/commands/claude-command.js +1 -1
  15. package/dist/commands/claude-command.js.map +1 -1
  16. package/dist/commands/claude-statusline-command.js +1 -1
  17. package/dist/commands/claude-usage-command.js +1 -1
  18. package/dist/commands/command.js +1 -1
  19. package/dist/commands/connection-command.js +1 -1
  20. package/dist/commands/databases.js +1 -1
  21. package/dist/commands/delivery-command.js +1 -1
  22. package/dist/commands/describe.js +1 -1
  23. package/dist/commands/engage-campaign-pull-command.js +1 -1
  24. package/dist/commands/engage-campaign-push-command.js +1 -1
  25. package/dist/commands/engage-campaign-validate-command.js +1 -1
  26. package/dist/commands/engage-command.js +1 -1
  27. package/dist/commands/engage-template-pull-command.js +1 -1
  28. package/dist/commands/engage-template-push-command.js +1 -1
  29. package/dist/commands/engage-template-validate-command.js +1 -1
  30. package/dist/commands/job-command.js +1 -1
  31. package/dist/commands/journey-command.js +1 -1
  32. package/dist/commands/journey-validate-command.js +1 -1
  33. package/dist/commands/llm-command.js +1 -1
  34. package/dist/commands/mcp-command.js +1 -1
  35. package/dist/commands/parent-segment-command.js +1 -1
  36. package/dist/commands/policy-command.js +1 -1
  37. package/dist/commands/profile-command.js +1 -1
  38. package/dist/commands/profiles-command.js +1 -1
  39. package/dist/commands/query-command.js +1 -1
  40. package/dist/commands/schedule-command.js +1 -1
  41. package/dist/commands/segment-command.js +1 -1
  42. package/dist/commands/segment-create-command.js +1 -1
  43. package/dist/commands/segment-fields-command.js +1 -1
  44. package/dist/commands/segment-pull-command.js +1 -1
  45. package/dist/commands/segment-push-command.js +1 -1
  46. package/dist/commands/segment-update-command.js +1 -1
  47. package/dist/commands/segment-use-command.js +1 -1
  48. package/dist/commands/segment-validate-command.js +1 -1
  49. package/dist/commands/segments.js +1 -1
  50. package/dist/commands/show.js +1 -1
  51. package/dist/commands/status-command.js +1 -1
  52. package/dist/commands/tables.js +1 -1
  53. package/dist/commands/unset-command.js +1 -1
  54. package/dist/commands/upgrade-command.js +1 -1
  55. package/dist/commands/use-command.js +1 -1
  56. package/dist/commands/user-command.js +1 -1
  57. package/dist/commands/work-command.js +1 -1
  58. package/dist/commands/workflow-command.js +1 -1
  59. package/dist/core/auth.js +1 -1
  60. package/dist/core/command-output.js +1 -1
  61. package/dist/core/config.js +1 -1
  62. package/dist/core/connection-cache.js +1 -1
  63. package/dist/core/constants.js +1 -1
  64. package/dist/core/credential-cache.js +1 -1
  65. package/dist/core/global-context.js +1 -1
  66. package/dist/core/keychain.js +1 -1
  67. package/dist/core/oauth-keychain.js +1 -1
  68. package/dist/core/oauth.js +1 -1
  69. package/dist/core/profile.js +1 -1
  70. package/dist/core/project-config.js +1 -1
  71. package/dist/core/session.js +1 -1
  72. package/dist/core/user-cache.js +1 -1
  73. package/dist/core/version.js +1 -1
  74. package/dist/index.js +1 -1
  75. package/dist/mcp/server.js +1 -1
  76. package/dist/mcp/tools/index.js +1 -1
  77. package/dist/mcp/tools/tdx-run.js +1 -1
  78. package/dist/mcp/tools/tdx-search.js +1 -1
  79. package/dist/mcp/tools/work-create-item.js +1 -1
  80. package/dist/mcp/utils.js +1 -1
  81. package/dist/proxy/claude-usage-tracker.d.ts.map +1 -1
  82. package/dist/proxy/claude-usage-tracker.js +1 -1
  83. package/dist/proxy/claude-usage-tracker.js.map +1 -1
  84. package/dist/proxy/passthrough-server.d.ts +10 -0
  85. package/dist/proxy/passthrough-server.d.ts.map +1 -1
  86. package/dist/proxy/passthrough-server.js +1 -1
  87. package/dist/proxy/passthrough-server.js.map +1 -1
  88. package/dist/proxy/sse-usage-parser.js +1 -1
  89. package/dist/sdk/agent/agent-config.js +1 -1
  90. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  91. package/dist/sdk/agent/agent-yaml.js +1 -1
  92. package/dist/sdk/agent/test/evaluator.js +1 -1
  93. package/dist/sdk/agent/test/executor.js +1 -1
  94. package/dist/sdk/agent/test/index.js +1 -1
  95. package/dist/sdk/agent/test/output.js +1 -1
  96. package/dist/sdk/agent/test/parser.js +1 -1
  97. package/dist/sdk/agent/tool-target-registry.js +1 -1
  98. package/dist/sdk/api.js +1 -1
  99. package/dist/sdk/cas/cas-api-client.js +1 -1
  100. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  101. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  102. package/dist/sdk/cas/index.js +1 -1
  103. package/dist/sdk/cas/pull-workflow.js +1 -1
  104. package/dist/sdk/cas/push-workflow.js +1 -1
  105. package/dist/sdk/client/cdp-api-client.js +1 -1
  106. package/dist/sdk/client/delivery-api-client.js +1 -1
  107. package/dist/sdk/client/endpoints.js +1 -1
  108. package/dist/sdk/client/engage-api-client.js +1 -1
  109. package/dist/sdk/client/http-client.js +1 -1
  110. package/dist/sdk/client/llm-api-client.js +1 -1
  111. package/dist/sdk/client/oauth-refresh.js +1 -1
  112. package/dist/sdk/client/rate-limiter.js +1 -1
  113. package/dist/sdk/client/td-api-client.js +1 -1
  114. package/dist/sdk/client/trino-api-client.js +1 -1
  115. package/dist/sdk/client/workflow-client.js +1 -1
  116. package/dist/sdk/connection-validator.js +1 -1
  117. package/dist/sdk/connection.js +1 -1
  118. package/dist/sdk/delivery.js +1 -1
  119. package/dist/sdk/engage/campaign-pull.js +1 -1
  120. package/dist/sdk/engage/campaign-push.js +1 -1
  121. package/dist/sdk/engage/campaign-validator.js +1 -1
  122. package/dist/sdk/engage/campaign-yaml.js +1 -1
  123. package/dist/sdk/engage/template-pull.js +1 -1
  124. package/dist/sdk/engage/template-push.js +1 -1
  125. package/dist/sdk/engage/template-validator.js +1 -1
  126. package/dist/sdk/engage/template-yaml.js +1 -1
  127. package/dist/sdk/engage/types/campaign-def.js +1 -1
  128. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  129. package/dist/sdk/engage/types/template-schema.js +1 -1
  130. package/dist/sdk/engage.js +1 -1
  131. package/dist/sdk/errors.js +1 -1
  132. package/dist/sdk/index.js +1 -1
  133. package/dist/sdk/io/index.js +1 -1
  134. package/dist/sdk/io/node-filesystem.js +1 -1
  135. package/dist/sdk/job.js +1 -1
  136. package/dist/sdk/journey.js +1 -1
  137. package/dist/sdk/llm/chat-cache.js +1 -1
  138. package/dist/sdk/llm/index.js +1 -1
  139. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  140. package/dist/sdk/llm/model-factors.d.ts +33 -9
  141. package/dist/sdk/llm/model-factors.d.ts.map +1 -1
  142. package/dist/sdk/llm/model-factors.js +1 -1
  143. package/dist/sdk/llm/model-factors.js.map +1 -1
  144. package/dist/sdk/personalization.js +1 -1
  145. package/dist/sdk/policy.js +1 -1
  146. package/dist/sdk/query/index.js +1 -1
  147. package/dist/sdk/query/sql-parser.js +1 -1
  148. package/dist/sdk/realtime.js +1 -1
  149. package/dist/sdk/schedule.js +1 -1
  150. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  151. package/dist/sdk/segment/fields-display.js +1 -1
  152. package/dist/sdk/segment/file-discovery.js +1 -1
  153. package/dist/sdk/segment/journey-utils.js +1 -1
  154. package/dist/sdk/segment/journey-validator.js +1 -1
  155. package/dist/sdk/segment/journey-yaml.js +1 -1
  156. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  157. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  158. package/dist/sdk/segment/pull-workflow.js +1 -1
  159. package/dist/sdk/segment/push-recovery.js +1 -1
  160. package/dist/sdk/segment/push-workflow.js +1 -1
  161. package/dist/sdk/segment/resolution-context.js +1 -1
  162. package/dist/sdk/segment/segment-path-parser.js +1 -1
  163. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  164. package/dist/sdk/segment/segment-validator.js +1 -1
  165. package/dist/sdk/segment/target-resolution.js +1 -1
  166. package/dist/sdk/segment/tdx-config.js +1 -1
  167. package/dist/sdk/segment/types/activation-schema.js +1 -1
  168. package/dist/sdk/segment/types/journey-def.js +1 -1
  169. package/dist/sdk/segment/types/journey-schema.js +1 -1
  170. package/dist/sdk/segment/types/segment-def.js +1 -1
  171. package/dist/sdk/segment/types/segment-schema.js +1 -1
  172. package/dist/sdk/segment/validate-files.js +1 -1
  173. package/dist/sdk/segment/yaml-validator.js +1 -1
  174. package/dist/sdk/segment.js +1 -1
  175. package/dist/sdk/types/index.js +1 -1
  176. package/dist/sdk/types/progress.js +1 -1
  177. package/dist/sdk/types/workspace.js +1 -1
  178. package/dist/sdk/user.js +1 -1
  179. package/dist/sdk/util/format-detector.js +1 -1
  180. package/dist/sdk/util/formatters.js +1 -1
  181. package/dist/sdk/util/index.js +1 -1
  182. package/dist/sdk/util/paginate.js +1 -1
  183. package/dist/sdk/util/tree-formatter.js +1 -1
  184. package/dist/sdk/workflow/archive-validation.js +1 -1
  185. package/dist/sdk/workflow/clone-workflow.js +1 -1
  186. package/dist/sdk/workflow/index.js +1 -1
  187. package/dist/sdk/workflow/pull-workflow.js +1 -1
  188. package/dist/sdk/workflow/push-workflow.js +1 -1
  189. package/dist/sdk/workflow/task-graph.js +1 -1
  190. package/dist/sdk/workflow/tdx-config.js +1 -1
  191. package/dist/sdk/workflow/workflow-utils.js +1 -1
  192. package/dist/sdk/workspace/access-tracker.js +1 -1
  193. package/dist/sdk/workspace/frontmatter.js +1 -1
  194. package/dist/sdk/workspace/git.js +1 -1
  195. package/dist/sdk/workspace/index.js +1 -1
  196. package/dist/sdk/workspace/templates.js +1 -1
  197. package/dist/sdk/workspace/weekly.js +1 -1
  198. package/dist/sdk/workspace/wikilinks.js +1 -1
  199. package/dist/test-utils/command-runner.js +1 -1
  200. package/dist/test-utils/factories.js +1 -1
  201. package/dist/test-utils/fixtures.js +1 -1
  202. package/dist/test-utils/http-mock.js +1 -1
  203. package/dist/test-utils/index.js +1 -1
  204. package/dist/utils/async.js +1 -1
  205. package/dist/utils/colors.js +1 -1
  206. package/dist/utils/diff.js +1 -1
  207. package/dist/utils/file-permissions.js +1 -1
  208. package/dist/utils/file-reader.js +1 -1
  209. package/dist/utils/github-releases.js +1 -1
  210. package/dist/utils/global-cache.js +1 -1
  211. package/dist/utils/json-loader.js +1 -1
  212. package/dist/utils/local-cache.js +1 -1
  213. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  214. package/dist/utils/logger/formatters/index.js +1 -1
  215. package/dist/utils/logger/handlers/console-handler.js +1 -1
  216. package/dist/utils/logger/handlers/file-handler.js +1 -1
  217. package/dist/utils/logger/handlers/index.js +1 -1
  218. package/dist/utils/logger/handlers/null-handler.js +1 -1
  219. package/dist/utils/logger/index.js +1 -1
  220. package/dist/utils/logger/logger.js +1 -1
  221. package/dist/utils/logger/types.js +1 -1
  222. package/dist/utils/option-validation.js +1 -1
  223. package/dist/utils/process.js +1 -1
  224. package/dist/utils/prompt.js +1 -1
  225. package/dist/utils/spinner.js +1 -1
  226. package/dist/utils/sse-parser.js +1 -1
  227. package/dist/utils/string-utils.js +1 -1
  228. package/dist/utils/table-ref-parser.js +1 -1
  229. package/dist/utils/tdx-logger.js +1 -1
  230. package/dist/utils/version-check.js +1 -1
  231. package/package.json +1 -1
@@ -1 +1 @@
1
- const a32_0x58f2b6=a32_0x45ac;(function(_0x5d89df,_0x36eaf4){const _0xc49555=a32_0x45ac,_0x545a71=_0x5d89df();while(!![]){try{const _0x361081=-parseInt(_0xc49555(0x132))/0x1+parseInt(_0xc49555(0x118))/0x2*(-parseInt(_0xc49555(0x10d))/0x3)+parseInt(_0xc49555(0x131))/0x4+-parseInt(_0xc49555(0x13b))/0x5+-parseInt(_0xc49555(0x149))/0x6*(parseInt(_0xc49555(0x123))/0x7)+-parseInt(_0xc49555(0x13e))/0x8*(-parseInt(_0xc49555(0x12c))/0x9)+parseInt(_0xc49555(0x120))/0xa;if(_0x361081===_0x36eaf4)break;else _0x545a71['push'](_0x545a71['shift']());}catch(_0x2109f7){_0x545a71['push'](_0x545a71['shift']());}}}(a32_0x548b,0xb30f0));function a32_0x45ac(_0x2d9608,_0x2fc7d6){_0x2d9608=_0x2d9608-0x10d;const _0x548b19=a32_0x548b();let _0x45ac1c=_0x548b19[_0x2d9608];return _0x45ac1c;}import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x836054 from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x58f2b6(0x126)]=a32_0x58f2b6(0x142);[a32_0x58f2b6(0x10e)]='Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions';async[a32_0x58f2b6(0x128)](_0x403656){const _0x16d717=a32_0x58f2b6,{options:_0x2a468c,tdx:_0x3eb819}=_0x403656,_0x3f2e29=await withSpinner(_0x16d717(0x139),async()=>{const _0x17d7f9=_0x16d717,[_0x238ad0,_0x105173]=await Promise['all']([_0x3eb819['user'][_0x17d7f9(0x11f)](),_0x3eb819[_0x17d7f9(0x142)][_0x17d7f9(0x121)]()]);return{'userInfo':_0x238ad0,'permissions':_0x105173};},{'verbose':_0x2a468c[_0x16d717(0x11c)]}),{userInfo:_0x2e99d4,permissions:_0x491177}=_0x3f2e29['data'];if(isStructuredFormat(_0x2a468c))return await handleSingleObjectOutput(_0x491177,_0x2a468c),0x0;const _0x505aec=_0x2e99d4[_0x16d717(0x13d)]?_0x16d717(0x13f):_0x2e99d4[_0x16d717(0x116)]?'Administrator':'Member';console[_0x16d717(0x138)]('\x0a'+a32_0x836054[_0x16d717(0x13a)]('👤')+'\x20'+a32_0x836054[_0x16d717(0x13a)](_0x2e99d4['name'])+'\x20'+a32_0x836054[_0x16d717(0x130)]('('+_0x2e99d4[_0x16d717(0x117)]+')')+'\x20—\x20'+_0x505aec),console[_0x16d717(0x138)](a32_0x836054[_0x16d717(0x130)](_0x16d717(0x10f)+_0x3eb819[_0x16d717(0x114)][_0x16d717(0x12e)]+':'+_0x2e99d4[_0x16d717(0x133)]+_0x16d717(0x146)+_0x2e99d4['id']));const _0x16e65d=_0x491177[_0x16d717(0x124)];console[_0x16d717(0x138)]('\x0a'+a32_0x836054[_0x16d717(0x13a)](_0x16d717(0x111))+'\x20('+_0x16e65d['length']+'):');if(_0x16e65d[_0x16d717(0x113)]===0x0)console[_0x16d717(0x138)](a32_0x836054[_0x16d717(0x130)]('\x20\x20No\x20policies\x20assigned'));else for(const _0x433197 of _0x16e65d){console[_0x16d717(0x138)](_0x16d717(0x11e)+_0x433197[_0x16d717(0x126)]);}return printPermissionsMap(_0x491177[_0x16d717(0x140)]),console[_0x16d717(0x138)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x58f2b6(0x126)]=a32_0x58f2b6(0x148);['description']=a32_0x58f2b6(0x11d);async[a32_0x58f2b6(0x128)](_0x438d31){const _0x4365ad=a32_0x58f2b6,{options:_0x21db07,tdx:_0xdbf5d7}=_0x438d31,_0x3588e5=await withSpinner(_0x4365ad(0x115),()=>_0xdbf5d7[_0x4365ad(0x142)][_0x4365ad(0x13c)](),{'verbose':_0x21db07['verbose']}),_0x1401b9=_0x3588e5[_0x4365ad(0x12b)];console[_0x4365ad(0x122)](_0x4365ad(0x129)+_0x1401b9['length']+_0x4365ad(0x127)+(_0x1401b9[_0x4365ad(0x113)]!==0x1?'ies':'y'));if(isStructuredFormat(_0x21db07))return await handleSDKOutput(_0x1401b9,_0x21db07),0x0;if(_0x1401b9[_0x4365ad(0x113)]===0x0)console[_0x4365ad(0x138)](a32_0x836054[_0x4365ad(0x130)](_0x4365ad(0x110)));else for(const _0x367c7a of _0x1401b9){const _0xff5a53=_0x367c7a[_0x4365ad(0x10e)]?a32_0x836054[_0x4365ad(0x130)](_0x4365ad(0x137)+_0x367c7a[_0x4365ad(0x10e)]):'';console['log']('\x20\x20•\x20'+_0x367c7a[_0x4365ad(0x126)]+_0xff5a53);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{['name']='policy\x20show';[a32_0x58f2b6(0x10e)]=a32_0x58f2b6(0x141);[a32_0x58f2b6(0x12f)](_0x30ff16){const _0x3b5894=a32_0x58f2b6;if(_0x30ff16[_0x3b5894(0x136)][_0x3b5894(0x113)]===0x0)return _0x3b5894(0x134);return undefined;}async['execute'](_0x3253ae){const _0x1d644c=a32_0x58f2b6,{options:_0x12dad1,tdx:_0x536ab9}=_0x3253ae,_0x2260b2=_0x3253ae[_0x1d644c(0x136)][0x0],_0x42859a=await withSpinner(_0x1d644c(0x14a),async()=>{const _0x304c6f=_0x1d644c,_0x5b2259=await _0x536ab9[_0x304c6f(0x142)][_0x304c6f(0x11b)](_0x2260b2),[_0x837b12,_0x23c5c4]=await Promise[_0x304c6f(0x145)]([_0x536ab9[_0x304c6f(0x142)][_0x304c6f(0x12d)](_0x5b2259['id']),_0x536ab9['policy'][_0x304c6f(0x12a)](_0x5b2259['id'])]);return{'policy':_0x5b2259,'perms':_0x837b12,'users':_0x23c5c4};},{'verbose':_0x12dad1[_0x1d644c(0x11c)]}),{policy:_0x544131,perms:_0x456868,users:_0x29e436}=_0x42859a[_0x1d644c(0x12b)];if(isStructuredFormat(_0x12dad1))return await handleSingleObjectOutput({..._0x544131,'permissions':_0x456868[_0x1d644c(0x140)],'users':_0x29e436},_0x12dad1),0x0;console[_0x1d644c(0x138)]('\x0a'+a32_0x836054[_0x1d644c(0x13a)]('📋')+'\x20'+a32_0x836054[_0x1d644c(0x13a)](_0x544131['name'])+'\x20'+a32_0x836054[_0x1d644c(0x130)]('(ID:\x20'+_0x544131['id']+')'));_0x544131[_0x1d644c(0x10e)]&&console['log'](_0x1d644c(0x10f)+a32_0x836054['dim'](_0x544131[_0x1d644c(0x10e)]));console[_0x1d644c(0x138)](_0x1d644c(0x10f)+_0x29e436[_0x1d644c(0x113)]+_0x1d644c(0x125)+(_0x29e436[_0x1d644c(0x113)]!==0x1?'s':'')+_0x1d644c(0x119)),printPermissionsMap(_0x456868[_0x1d644c(0x140)]);if(_0x29e436['length']>0x0){console[_0x1d644c(0x138)]('\x0a'+a32_0x836054[_0x1d644c(0x13a)]('👥\x20Assigned\x20Users')+':');for(const _0x26cf50 of _0x29e436){const _0x15c396=_0x26cf50[_0x1d644c(0x117)]&&_0x26cf50['email']!==_0x26cf50[_0x1d644c(0x126)]?a32_0x836054['dim']('\x20<'+_0x26cf50[_0x1d644c(0x117)]+'>'):'';console['log'](_0x1d644c(0x11e)+_0x26cf50[_0x1d644c(0x126)]+_0x15c396);}}return console[_0x1d644c(0x138)](),0x0;}}function printPermissionsMap(_0x5e56aa){const _0x30795a=a32_0x58f2b6,_0x2b476d=Object[_0x30795a(0x143)](_0x5e56aa);console[_0x30795a(0x138)]('\x0a'+a32_0x836054['bold'](_0x30795a(0x135))+':');if(_0x2b476d[_0x30795a(0x113)]===0x0){console[_0x30795a(0x138)](a32_0x836054['dim'](_0x30795a(0x144)));return;}const _0x117de1=Math['max'](..._0x2b476d[_0x30795a(0x147)](([_0x2d7cc3])=>_0x2d7cc3['length']));for(const [_0x3ed6bb,_0x5a7a95]of _0x2b476d){const _0x4f23d2=formatOperations(_0x5a7a95);console[_0x30795a(0x138)]('\x20\x20'+_0x3ed6bb[_0x30795a(0x112)](_0x117de1+0x2)+_0x4f23d2);}}function a32_0x548b(){const _0x5e6758=['permissions','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','policy','entries','\x20\x20No\x20permissions','all',',\x20user_id:','map','policy\x20list','60jtBlMU','Fetching\x20policy...','72MiUAcv','description','\x20\x20\x20','No\x20policies\x20found','📋\x20Assigned\x20Policies','padEnd','length','context','Listing\x20policies...','administrator','email','65314WVkEWe','\x20assigned','operation','getPolicy','verbose','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','\x20\x20•\x20','getCurrent','12639680cCUCUd','getMyPermissions','error','33964juQEds','policies','\x20user','name','\x20polic','execute','✔\x20Found\x20','getPolicyUsers','data','4554PacOOW','getPolicyPermissions','site','validate','dim','2261980UtwyEQ','370191RxsRsd','account_id','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','🔑\x20Effective\x20Permissions','args','\x20—\x20','log','Fetching\x20permissions...','bold','1749860vojUxs','listPolicies','account_owner','7216BygKGt','Account\x20Owner'];a32_0x548b=function(){return _0x5e6758;};return a32_0x548b();}function formatOperations(_0x3e8603){const _0xc4968a=a32_0x58f2b6,_0x16a3c9=[...new Set(_0x3e8603['map'](_0x44284f=>_0x44284f[_0xc4968a(0x11a)]))];return _0x16a3c9['join'](',\x20');}
1
+ const a32_0x541fd6=a32_0x4869;(function(_0x1b28eb,_0x127e39){const _0x508134=a32_0x4869,_0x70e648=_0x1b28eb();while(!![]){try{const _0x4e523b=parseInt(_0x508134(0x10e))/0x1+parseInt(_0x508134(0x122))/0x2+-parseInt(_0x508134(0x12f))/0x3*(parseInt(_0x508134(0x12b))/0x4)+-parseInt(_0x508134(0x111))/0x5*(parseInt(_0x508134(0x117))/0x6)+parseInt(_0x508134(0x101))/0x7*(-parseInt(_0x508134(0x126))/0x8)+-parseInt(_0x508134(0x112))/0x9+parseInt(_0x508134(0x138))/0xa;if(_0x4e523b===_0x127e39)break;else _0x70e648['push'](_0x70e648['shift']());}catch(_0x5cadff){_0x70e648['push'](_0x70e648['shift']());}}}(a32_0x5e31,0x4d66a));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';function a32_0x4869(_0x1b0bcb,_0x424be8){_0x1b0bcb=_0x1b0bcb-0x100;const _0x5e31b0=a32_0x5e31();let _0x48690a=_0x5e31b0[_0x1b0bcb];return _0x48690a;}import{withSpinner}from'../utils/spinner.js';import a32_0x4c4d20 from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x541fd6(0x125)]=a32_0x541fd6(0x10c);[a32_0x541fd6(0x127)]='Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions';async[a32_0x541fd6(0x13b)](_0x68c601){const _0x2c646b=a32_0x541fd6,{options:_0x131af0,tdx:_0x1a6e0e}=_0x68c601,_0x5ea915=await withSpinner(_0x2c646b(0x12e),async()=>{const _0x320f4b=_0x2c646b,[_0x3a9733,_0x5b2a04]=await Promise[_0x320f4b(0x11c)]([_0x1a6e0e['user'][_0x320f4b(0x116)](),_0x1a6e0e[_0x320f4b(0x10c)][_0x320f4b(0x133)]()]);return{'userInfo':_0x3a9733,'permissions':_0x5b2a04};},{'verbose':_0x131af0[_0x2c646b(0x13a)]}),{userInfo:_0x40ec32,permissions:_0x572ab0}=_0x5ea915['data'];if(isStructuredFormat(_0x131af0))return await handleSingleObjectOutput(_0x572ab0,_0x131af0),0x0;const _0x3134f9=_0x40ec32[_0x2c646b(0x123)]?_0x2c646b(0x10f):_0x40ec32[_0x2c646b(0x120)]?_0x2c646b(0x139):_0x2c646b(0x113);console[_0x2c646b(0x115)]('\x0a'+a32_0x4c4d20['bold']('👤')+'\x20'+a32_0x4c4d20['bold'](_0x40ec32['name'])+'\x20'+a32_0x4c4d20[_0x2c646b(0x109)]('('+_0x40ec32[_0x2c646b(0x131)]+')')+_0x2c646b(0x134)+_0x3134f9),console[_0x2c646b(0x115)](a32_0x4c4d20[_0x2c646b(0x109)]('\x20\x20\x20'+_0x1a6e0e['context'][_0x2c646b(0x132)]+':'+_0x40ec32[_0x2c646b(0x128)]+_0x2c646b(0x10b)+_0x40ec32['id']));const _0x37f22f=_0x572ab0[_0x2c646b(0x12c)];console[_0x2c646b(0x115)]('\x0a'+a32_0x4c4d20[_0x2c646b(0x100)](_0x2c646b(0x110))+'\x20('+_0x37f22f[_0x2c646b(0x107)]+'):');if(_0x37f22f[_0x2c646b(0x107)]===0x0)console[_0x2c646b(0x115)](a32_0x4c4d20[_0x2c646b(0x109)](_0x2c646b(0x10d)));else for(const _0x3a339d of _0x37f22f){console[_0x2c646b(0x115)](_0x2c646b(0x106)+_0x3a339d['name']);}return printPermissionsMap(_0x572ab0[_0x2c646b(0x119)]),console[_0x2c646b(0x115)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x541fd6(0x125)]=a32_0x541fd6(0x104);['description']='List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)';async['execute'](_0x58a2fe){const _0x526589=a32_0x541fd6,{options:_0x3ea831,tdx:_0x3b1005}=_0x58a2fe,_0x1f7e3b=await withSpinner(_0x526589(0x108),()=>_0x3b1005[_0x526589(0x10c)][_0x526589(0x136)](),{'verbose':_0x3ea831[_0x526589(0x13a)]}),_0x5460b9=_0x1f7e3b[_0x526589(0x103)];console[_0x526589(0x11d)](_0x526589(0x11f)+_0x5460b9[_0x526589(0x107)]+'\x20polic'+(_0x5460b9['length']!==0x1?_0x526589(0x135):'y'));if(isStructuredFormat(_0x3ea831))return await handleSDKOutput(_0x5460b9,_0x3ea831),0x0;if(_0x5460b9[_0x526589(0x107)]===0x0)console['log'](a32_0x4c4d20['dim']('No\x20policies\x20found'));else for(const _0x3e51df of _0x5460b9){const _0x3ee1e3=_0x3e51df[_0x526589(0x127)]?a32_0x4c4d20[_0x526589(0x109)](_0x526589(0x134)+_0x3e51df[_0x526589(0x127)]):'';console['log'](_0x526589(0x106)+_0x3e51df[_0x526589(0x125)]+_0x3ee1e3);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x541fd6(0x125)]=a32_0x541fd6(0x121);[a32_0x541fd6(0x127)]=a32_0x541fd6(0x114);['validate'](_0x4069c7){const _0x244454=a32_0x541fd6;if(_0x4069c7[_0x244454(0x10a)]['length']===0x0)return'Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>';return undefined;}async[a32_0x541fd6(0x13b)](_0x196860){const _0x420fbd=a32_0x541fd6,{options:_0x7948f2,tdx:_0x631139}=_0x196860,_0x21c9b0=_0x196860[_0x420fbd(0x10a)][0x0],_0x3cf898=await withSpinner(_0x420fbd(0x137),async()=>{const _0x58377c=_0x420fbd,_0x2ef598=await _0x631139['policy'][_0x58377c(0x12d)](_0x21c9b0),[_0x4fc9e7,_0x4a30a3]=await Promise[_0x58377c(0x11c)]([_0x631139[_0x58377c(0x10c)][_0x58377c(0x129)](_0x2ef598['id']),_0x631139[_0x58377c(0x10c)][_0x58377c(0x11e)](_0x2ef598['id'])]);return{'policy':_0x2ef598,'perms':_0x4fc9e7,'users':_0x4a30a3};},{'verbose':_0x7948f2[_0x420fbd(0x13a)]}),{policy:_0x4d7ac2,perms:_0x3b1a86,users:_0x3e28a9}=_0x3cf898['data'];if(isStructuredFormat(_0x7948f2))return await handleSingleObjectOutput({..._0x4d7ac2,'permissions':_0x3b1a86[_0x420fbd(0x119)],'users':_0x3e28a9},_0x7948f2),0x0;console['log']('\x0a'+a32_0x4c4d20['bold']('📋')+'\x20'+a32_0x4c4d20[_0x420fbd(0x100)](_0x4d7ac2[_0x420fbd(0x125)])+'\x20'+a32_0x4c4d20[_0x420fbd(0x109)](_0x420fbd(0x124)+_0x4d7ac2['id']+')'));_0x4d7ac2[_0x420fbd(0x127)]&&console[_0x420fbd(0x115)](_0x420fbd(0x105)+a32_0x4c4d20[_0x420fbd(0x109)](_0x4d7ac2[_0x420fbd(0x127)]));console['log'](_0x420fbd(0x105)+_0x3e28a9['length']+_0x420fbd(0x12a)+(_0x3e28a9[_0x420fbd(0x107)]!==0x1?'s':'')+'\x20assigned'),printPermissionsMap(_0x3b1a86[_0x420fbd(0x119)]);if(_0x3e28a9[_0x420fbd(0x107)]>0x0){console[_0x420fbd(0x115)]('\x0a'+a32_0x4c4d20[_0x420fbd(0x100)]('👥\x20Assigned\x20Users')+':');for(const _0x277af5 of _0x3e28a9){const _0x19ddf0=_0x277af5[_0x420fbd(0x131)]&&_0x277af5[_0x420fbd(0x131)]!==_0x277af5[_0x420fbd(0x125)]?a32_0x4c4d20[_0x420fbd(0x109)]('\x20<'+_0x277af5[_0x420fbd(0x131)]+'>'):'';console[_0x420fbd(0x115)](_0x420fbd(0x106)+_0x277af5[_0x420fbd(0x125)]+_0x19ddf0);}}return console[_0x420fbd(0x115)](),0x0;}}function printPermissionsMap(_0x48abc1){const _0x1be4c2=a32_0x541fd6,_0x1df7a0=Object[_0x1be4c2(0x118)](_0x48abc1);console['log']('\x0a'+a32_0x4c4d20['bold'](_0x1be4c2(0x11a))+':');if(_0x1df7a0[_0x1be4c2(0x107)]===0x0){console[_0x1be4c2(0x115)](a32_0x4c4d20['dim']('\x20\x20No\x20permissions'));return;}const _0x2090ff=Math[_0x1be4c2(0x11b)](..._0x1df7a0[_0x1be4c2(0x130)](([_0x2124ac])=>_0x2124ac[_0x1be4c2(0x107)]));for(const [_0x4b1612,_0x2cc211]of _0x1df7a0){const _0x2ef689=formatOperations(_0x2cc211);console[_0x1be4c2(0x115)]('\x20\x20'+_0x4b1612[_0x1be4c2(0x102)](_0x2090ff+0x2)+_0x2ef689);}}function a32_0x5e31(){const _0x501267=['data','policy\x20list','\x20\x20\x20','\x20\x20•\x20','length','Listing\x20policies...','dim','args',',\x20user_id:','policy','\x20\x20No\x20policies\x20assigned','236889NrcUmH','Account\x20Owner','📋\x20Assigned\x20Policies','2268355AJeGVo','1744047zPunDI','Member','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','log','getCurrent','6xqZQMq','entries','permissions','🔑\x20Effective\x20Permissions','max','all','error','getPolicyUsers','✔\x20Found\x20','administrator','policy\x20show','951812akOJXF','account_owner','(ID:\x20','name','1441624rbuuTJ','description','account_id','getPolicyPermissions','\x20user','794776ssiBMN','policies','getPolicy','Fetching\x20permissions...','3aGLWKZ','map','email','site','getMyPermissions','\x20—\x20','ies','listPolicies','Fetching\x20policy...','6305900viyAoA','Administrator','verbose','execute','operation','bold','7lShRcG','padEnd'];a32_0x5e31=function(){return _0x501267;};return a32_0x5e31();}function formatOperations(_0x2db6eb){const _0x37ce20=a32_0x541fd6,_0x30ca0f=[...new Set(_0x2db6eb[_0x37ce20(0x130)](_0x36ff11=>_0x36ff11[_0x37ce20(0x13c)]))];return _0x30ca0f['join'](',\x20');}
@@ -1 +1 @@
1
- const a33_0x29e15a=a33_0x46a2;(function(_0x1af4fe,_0x4f8ec5){const _0x1e4d3a=a33_0x46a2,_0x3659e6=_0x1af4fe();while(!![]){try{const _0x4a1ca7=-parseInt(_0x1e4d3a(0x1e8))/0x1+parseInt(_0x1e4d3a(0x1c2))/0x2+parseInt(_0x1e4d3a(0x1c0))/0x3+parseInt(_0x1e4d3a(0x1dd))/0x4*(-parseInt(_0x1e4d3a(0x18f))/0x5)+parseInt(_0x1e4d3a(0x19d))/0x6*(parseInt(_0x1e4d3a(0x1b2))/0x7)+-parseInt(_0x1e4d3a(0x18e))/0x8+parseInt(_0x1e4d3a(0x1e2))/0x9*(parseInt(_0x1e4d3a(0x1a7))/0xa);if(_0x4a1ca7===_0x4f8ec5)break;else _0x3659e6['push'](_0x3659e6['shift']());}catch(_0x99271){_0x3659e6['push'](_0x3659e6['shift']());}}}(a33_0x4647,0xdff48));import{BaseCommand,printAuthError}from'./command.js';function a33_0x4647(){const _0x5ac903=['10lPrYdq','/app/mp/ak','You\x20can\x20find\x20your\x20API\x20key\x20at:','red','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','database','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Removed\x20existing\x20profile\x20\x27','oauth','llm_agent','ERROR','27727qtOpeY','error','\x27\x20deleted','\x0aSaved\x20to:\x20','\x20\x20(no\x20profiles\x20found)','session','tdx:\x20profile\x20set','Default\x20profile\x20set\x20to:\x20','config','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','\x27\x20updated:\x20','5339253mEhcer','warn','726174iYzwZg','Changing\x20site\x20to\x20\x27','\x0aSetup\x20cancelled','execute','Enter\x20description\x20(optional):','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x0aAvailable\x20profiles:','includes','site','llm_project','Setup\x20cancelled','length','\x27\x20does\x20not\x20exist.','Site\x20was\x20not\x20changed.','profile:set','Profile\x20\x27','Set\x20session\x20profile','logLevel','status','dim','Profile\x20name\x20cannot\x20be\x20empty','name','join','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','trim','Validating\x20API\x20key...','description','198564xYSTlw','jobs','\x27\x20created','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','profile','3946356ejwTuS','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','log','Enter\x20profile\x20name:','335045TfhCxI','profileName','us01','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','Unknown\x20key\x20\x27','profile:create','\x27.\x0a\x0aValid\x20keys:\x20','bold','\x20\x20tdx\x20--profile\x20','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','Delete\x20a\x20profile','text','\x27\x20requires\x20API\x20key\x20validation.','split','yellow','10364184cHaCSY','145pVgXgb','tdx.json','\x0aOperation\x20cancelled','Operation\x20cancelled','parent_segment','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','skipExistsCheck','create','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','validate','message','password','API\x20key\x20cannot\x20be\x20empty','2130TmUSsf','confirm','\x20\x20-\x20','\x20Profile\x20\x27','getUserInfo','green','default','apiKey','VALID_KEYS','Failed\x20to\x20delete\x20profile:\x20'];a33_0x4647=function(){return _0x5ac903;};return a33_0x4647();}import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a33_0x33762e from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';function a33_0x46a2(_0x51af6d,_0x9c5fe6){_0x51af6d=_0x51af6d-0x189;const _0x464718=a33_0x4647();let _0x46a2a6=_0x464718[_0x51af6d];return _0x46a2a6;}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_0x330606 from'prompts';import a33_0x341376 from'chalk';function validateProfileName(_0x52062c,_0xa0f5ba){const _0x1f30d9=a33_0x46a2;if(!_0x52062c||!_0x52062c['trim']())return _0x1f30d9(0x1d6);const _0x4c958c=_0x52062c[_0x1f30d9(0x1da)]();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x4c958c))return _0x1f30d9(0x1e0);if(!_0xa0f5ba?.[_0x1f30d9(0x196)]&&profileExists(_0x4c958c))return _0x1f30d9(0x1d1)+_0x4c958c+_0x1f30d9(0x1bd)+_0x4c958c+_0x1f30d9(0x1f2);return!![];}async function deleteProfileAndCredentials(_0x52b900){removeProfileFromUserConfig(_0x52b900);const _0x18fc49=await isKeychainAvailable();_0x18fc49&&await Promise['all']([deleteKeychainAPIKey(_0x52b900),deleteOAuthTokens(_0x52b900)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x29e15a(0x1d7)]=a33_0x29e15a(0x1ee);[a33_0x29e15a(0x1dc)]='Create\x20a\x20new\x20profile';async[a33_0x29e15a(0x1c5)](_0x482fd5){const _0x103284=a33_0x29e15a,{options:_0x41e7e8,args:_0x5253f0}=_0x482fd5,_0x224c32=!!_0x41e7e8['force'];console[_0x103284(0x1e6)](a33_0x341376['bold']('tdx:\x20profile\x20create'));let _0x346905;if(_0x5253f0[_0x103284(0x1cd)]>0x0&&_0x5253f0[0x0]){const _0x347d18=_0x5253f0[0x0]['trim']();_0x224c32&&profileExists(_0x347d18)&&(await deleteProfileAndCredentials(_0x347d18),console[_0x103284(0x1e6)](_0x103284(0x1ae)+_0x347d18+'\x27'));const _0x101614=validateProfileName(_0x347d18);if(_0x101614!==!![])return console[_0x103284(0x1b3)](a33_0x341376['red'](_0x101614)),0x1;_0x346905=_0x347d18;}else{const _0x5059a6=await a33_0x330606({'type':_0x103284(0x18a),'name':_0x103284(0x1e9),'message':_0x103284(0x1e7),'validate':_0x226b9c=>validateProfileName(_0x226b9c,{'skipExistsCheck':_0x224c32})});if(!_0x5059a6['profileName'])return console[_0x103284(0x1e6)](_0x103284(0x1c4)),0x1;_0x346905=_0x5059a6[_0x103284(0x1e9)][_0x103284(0x1da)](),_0x224c32&&profileExists(_0x346905)&&(await deleteProfileAndCredentials(_0x346905),console[_0x103284(0x1e6)](_0x103284(0x1ae)+_0x346905+'\x27'));}const _0x460ab0=await a33_0x330606({'type':'text','name':_0x103284(0x1dc),'message':_0x103284(0x1c6)}),_0x16cdb2=_0x460ab0['description']?.[_0x103284(0x1da)]()||undefined,_0x1962ad=_0x41e7e8['site']||_0x103284(0x1ea),_0x16efd6=await promptSiteSelection(_0x1962ad,_0x346905,_0x103284(0x1cc));if(!_0x16efd6)return 0x1;const _0x431c1f=resolveSite(_0x16efd6),_0x574962=await promptAuthMethod();if(!_0x574962)return console['log']('\x0aSetup\x20cancelled'),0x1;if(_0x574962===_0x103284(0x1af)){if(_0x16cdb2){const _0x1f69c9={'site':_0x431c1f,'description':_0x16cdb2};saveProfileToUserConfig(_0x346905,_0x1f69c9);}const {accountName:_0x407768}=_0x41e7e8;return await runOAuthLoginFlow(_0x431c1f,_0x346905,_0x41e7e8[_0x103284(0x1d3)]??LogLevel[_0x103284(0x1b1)],{'accountName':_0x407768}),0x0;}console[_0x103284(0x1e6)](_0x103284(0x1e3)+_0x431c1f),console[_0x103284(0x1e6)](_0x103284(0x1a9)),console[_0x103284(0x1e6)]('\x20\x20'+getConsoleUrl(_0x431c1f,_0x103284(0x1a8)));const _0x2f69ac=await a33_0x330606({'type':_0x103284(0x19b),'name':_0x103284(0x1a4),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0xd001e4=>{const _0x224a09=_0x103284;if(!_0xd001e4||!_0xd001e4['trim']())return _0x224a09(0x19c);return!![];}});if(!_0x2f69ac[_0x103284(0x1a4)])return console[_0x103284(0x1e6)](_0x103284(0x1c4)),0x1;const _0x2a4cfe=_0x2f69ac[_0x103284(0x1a4)];console[_0x103284(0x1e6)](_0x103284(0x1db));try{const _0x29fa13=TDX[_0x103284(0x197)]({'site':_0x431c1f,'apiKey':_0x2a4cfe[_0x103284(0x1da)](),'logLevel':_0x41e7e8[_0x103284(0x1d3)]??LogLevel[_0x103284(0x1b1)]}),_0x4c438b=await _0x29fa13['jobs']['getUserInfo']();console['log'](a33_0x341376[_0x103284(0x1a2)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x4c438b['email']+')');const _0x5c9e00=await isKeychainAvailable();_0x5c9e00?(await saveAPIKeyAsync(_0x2a4cfe[_0x103284(0x1da)](),_0x431c1f,_0x346905),console[_0x103284(0x1e6)](a33_0x341376[_0x103284(0x1a2)]('✓')+_0x103284(0x1ad)+_0x346905+')')):(console[_0x103284(0x1c1)](a33_0x341376[_0x103284(0x18d)](_0x103284(0x195))),console[_0x103284(0x1c1)](a33_0x341376['yellow'](_0x103284(0x1ec))));const _0x1badb5={'site':_0x431c1f,..._0x16cdb2&&{'description':_0x16cdb2}};return saveProfileToUserConfig(_0x346905,_0x1badb5),console[_0x103284(0x1e6)](a33_0x341376[_0x103284(0x1a2)]('✓')+_0x103284(0x1a0)+_0x346905+_0x103284(0x1df)),console[_0x103284(0x1e6)](),console[_0x103284(0x1e6)](_0x103284(0x198)),console[_0x103284(0x1e6)](_0x103284(0x1f1)+_0x346905+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x103284(0x1e6)](_0x103284(0x1f1)+_0x346905+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x317707){if(_0x317707 instanceof HTTPClientError&&_0x317707[_0x103284(0x1d4)]===0x191)return printAuthError(_0x317707),0x1;return console[_0x103284(0x1b3)](a33_0x341376[_0x103284(0x1aa)]('✗\x20Validation\x20failed:\x20'+(_0x317707 instanceof Error?_0x317707['message']:String(_0x317707)))),console[_0x103284(0x1b3)](_0x103284(0x1bc)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x29e15a(0x1d7)]='profile:delete';[a33_0x29e15a(0x1dc)]=a33_0x29e15a(0x189);[a33_0x29e15a(0x199)](_0x1ff8a7){const _0x29288f=a33_0x29e15a,{args:_0x5c50eb}=_0x1ff8a7;if(_0x5c50eb[_0x29288f(0x1cd)]===0x0)return _0x29288f(0x1ab);return undefined;}async[a33_0x29e15a(0x1c5)](_0xedb9f2){const _0x1abe06=a33_0x29e15a,{args:_0x475ac5}=_0xedb9f2,_0x39e863=_0x475ac5[0x0];console[_0x1abe06(0x1e6)](a33_0x341376[_0x1abe06(0x1f0)]('tdx:\x20profile\x20delete'));if(!profileExists(_0x39e863)){console['error'](a33_0x341376[_0x1abe06(0x1aa)]('Profile\x20\x27'+_0x39e863+'\x27\x20does\x20not\x20exist.')),console[_0x1abe06(0x1e6)](_0x1abe06(0x1c8));const _0x3673d5=listProfiles();if(_0x3673d5[_0x1abe06(0x1cd)]===0x0)console['log'](_0x1abe06(0x1b6));else for(const _0x1040bc of _0x3673d5){console[_0x1abe06(0x1e6)](_0x1abe06(0x19f)+_0x1040bc[_0x1abe06(0x1d7)]);}return 0x1;}const _0x1ac34e=await a33_0x330606({'type':'confirm','name':_0x1abe06(0x19e),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x39e863+'\x27?','initial':![]});if(!_0x1ac34e[_0x1abe06(0x19e)])return console['log']('Removal\x20cancelled'),0x0;try{await deleteProfileAndCredentials(_0x39e863),console['log'](a33_0x341376[_0x1abe06(0x1a2)]('✓')+_0x1abe06(0x1a0)+_0x39e863+_0x1abe06(0x1b4));}catch(_0x5c22a6){return console['error'](a33_0x341376['red'](_0x1abe06(0x1a6)+(_0x5c22a6 instanceof Error?_0x5c22a6['message']:String(_0x5c22a6)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0x29e15a(0x1d7)]=a33_0x29e15a(0x1d0);[a33_0x29e15a(0x1dc)]='Set\x20a\x20profile\x20configuration\x20value';static [a33_0x29e15a(0x1a5)]=[a33_0x29e15a(0x1ca),a33_0x29e15a(0x1ac),a33_0x29e15a(0x193),a33_0x29e15a(0x1cb),a33_0x29e15a(0x1b0),a33_0x29e15a(0x1dc)];[a33_0x29e15a(0x199)](_0xfee6ff){const _0x5c01eb=a33_0x29e15a,{args:_0x2b622d,options:_0x1187ea}=_0xfee6ff,_0x53f6ed=_0x1187ea[_0x5c01eb(0x1e1)]||getActiveProfile();if(!_0x53f6ed)return _0x5c01eb(0x1be);if(_0x2b622d[_0x5c01eb(0x1cd)]===0x0)return _0x5c01eb(0x194)+ProfileSetCommand[_0x5c01eb(0x1a5)][_0x5c01eb(0x1d8)](',\x20');const _0x2fe3c9=_0x2b622d[0x0];if(!_0x2fe3c9['includes']('='))return _0x5c01eb(0x1e5)+ProfileSetCommand[_0x5c01eb(0x1a5)][_0x5c01eb(0x1d8)](',\x20');const [_0x5077e7]=_0x2fe3c9[_0x5c01eb(0x18c)]('=',0x2);if(!ProfileSetCommand[_0x5c01eb(0x1a5)][_0x5c01eb(0x1c9)](_0x5077e7))return _0x5c01eb(0x1ed)+_0x5077e7+_0x5c01eb(0x1ef)+ProfileSetCommand[_0x5c01eb(0x1a5)][_0x5c01eb(0x1d8)](',\x20');return undefined;}async['execute'](_0xb9b4c7){const _0x1ea8d5=a33_0x29e15a,{args:_0x5ae4bb,options:_0x217a05}=_0xb9b4c7,_0x47172a=_0x217a05['profile']||getActiveProfile(),[_0x191f82,..._0x52ea33]=_0x5ae4bb[0x0][_0x1ea8d5(0x18c)]('='),_0x49836e=_0x52ea33['join']('=');console['log'](a33_0x341376[_0x1ea8d5(0x1f0)](_0x1ea8d5(0x1b8)));if(!profileExists(_0x47172a)){const _0x329c3b=await a33_0x330606({'type':_0x1ea8d5(0x19e),'name':_0x1ea8d5(0x197),'message':_0x1ea8d5(0x1d1)+_0x47172a+_0x1ea8d5(0x1eb),'initial':!![]});if(!_0x329c3b[_0x1ea8d5(0x197)])return console[_0x1ea8d5(0x1e6)](_0x1ea8d5(0x192)),0x1;}const _0x1272d0=loadProfile(_0x47172a),_0x32d8eb=_0x1272d0?.[_0x1ea8d5(0x1ba)]||{};if(_0x191f82===_0x1ea8d5(0x1ca)){const _0x4ec7a1=resolveSite(_0x49836e);console['log'](_0x1ea8d5(0x1c3)+_0x4ec7a1+_0x1ea8d5(0x18b)),console[_0x1ea8d5(0x1e6)](_0x1ea8d5(0x1d9)),console[_0x1ea8d5(0x1e6)]('\x20\x20'+getConsoleUrl(_0x4ec7a1,_0x1ea8d5(0x1a8)));const _0x2a1f50=await a33_0x330606({'type':_0x1ea8d5(0x19b),'name':_0x1ea8d5(0x1a4),'message':_0x1ea8d5(0x1c7),'validate':_0x406987=>{if(!_0x406987||!_0x406987['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x2a1f50[_0x1ea8d5(0x1a4)])return console[_0x1ea8d5(0x1e6)](_0x1ea8d5(0x191)),0x1;console[_0x1ea8d5(0x1e6)](_0x1ea8d5(0x1db));try{const _0x5c3ffe=TDX[_0x1ea8d5(0x197)]({'site':_0x4ec7a1,'apiKey':_0x2a1f50[_0x1ea8d5(0x1a4)][_0x1ea8d5(0x1da)](),'logLevel':_0x217a05['logLevel']??LogLevel['ERROR']}),_0x4a4d1b=await _0x5c3ffe[_0x1ea8d5(0x1de)][_0x1ea8d5(0x1a1)]();console[_0x1ea8d5(0x1e6)](a33_0x341376[_0x1ea8d5(0x1a2)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x4a4d1b['email']+')');const _0x3f1d3b=await isKeychainAvailable();_0x3f1d3b?(await saveAPIKeyAsync(_0x2a1f50['apiKey']['trim'](),_0x4ec7a1,_0x47172a),console['log'](a33_0x341376[_0x1ea8d5(0x1a2)]('✓')+_0x1ea8d5(0x1bb))):console[_0x1ea8d5(0x1c1)](a33_0x341376[_0x1ea8d5(0x18d)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x32d8eb[_0x1ea8d5(0x1ca)]=_0x4ec7a1;}catch(_0x2a9c15){if(_0x2a9c15 instanceof HTTPClientError&&_0x2a9c15[_0x1ea8d5(0x1d4)]===0x191)return printAuthError(_0x2a9c15),0x1;return console['error'](a33_0x341376[_0x1ea8d5(0x1aa)]('✗\x20Validation\x20failed:\x20'+(_0x2a9c15 instanceof Error?_0x2a9c15[_0x1ea8d5(0x19a)]:String(_0x2a9c15)))),console[_0x1ea8d5(0x1b3)](_0x1ea8d5(0x1cf)),0x1;}}else _0x32d8eb[_0x191f82]=_0x49836e||undefined;return saveProfileToUserConfig(_0x47172a,_0x32d8eb),console[_0x1ea8d5(0x1e6)](a33_0x341376[_0x1ea8d5(0x1a2)]('✓')+_0x1ea8d5(0x1a0)+_0x47172a+_0x1ea8d5(0x1bf)+_0x191f82+'='+(_0x49836e||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x29e15a(0x1d7)]='profile:use';[a33_0x29e15a(0x1dc)]=a33_0x29e15a(0x1d2);['validate'](_0x49c009){const _0x3475c8=a33_0x29e15a,{args:_0x3d0c19}=_0x49c009;if(_0x3d0c19[_0x3475c8(0x1cd)]===0x0)return _0x3475c8(0x1e4);return undefined;}async[a33_0x29e15a(0x1c5)](_0x16c1e4){const _0x5ad3fb=a33_0x29e15a,{args:_0x3e873d,options:_0x3e602b}=_0x16c1e4,_0x4d578e=_0x3e873d[0x0],_0x3b06d8=_0x3e602b[_0x5ad3fb(0x1a3)];cleanExpiredSessions();if(!profileExists(_0x4d578e)){console[_0x5ad3fb(0x1b3)](a33_0x341376['red'](_0x5ad3fb(0x1d1)+_0x4d578e+_0x5ad3fb(0x1ce))),console['log']('\x0aAvailable\x20profiles:');const _0x355d36=listProfiles();if(_0x355d36[_0x5ad3fb(0x1cd)]===0x0)console[_0x5ad3fb(0x1e6)](_0x5ad3fb(0x1b6));else for(const _0x1a452a of _0x355d36){console[_0x5ad3fb(0x1e6)](_0x5ad3fb(0x19f)+_0x1a452a['name']);}return 0x1;}if(_0x3b06d8){const _0x571850=a33_0x33762e[_0x5ad3fb(0x1d8)](getConfigDir(),_0x5ad3fb(0x190));return saveActiveProfileToUserConfig(_0x4d578e),console[_0x5ad3fb(0x1e6)](_0x5ad3fb(0x1b9)+a33_0x341376[_0x5ad3fb(0x1a2)](_0x4d578e)),console[_0x5ad3fb(0x1e6)](a33_0x341376[_0x5ad3fb(0x1d5)](_0x5ad3fb(0x1b5)+_0x571850)),0x0;}const _0x468996=getSessionID(_0x3e602b[_0x5ad3fb(0x1b7)]);return saveSessionContext({'profile':_0x4d578e},_0x3e602b[_0x5ad3fb(0x1b7)]),console['log']('Session\x20profile\x20set\x20to:\x20'+a33_0x341376[_0x5ad3fb(0x1a2)](_0x4d578e)+'\x20'+a33_0x341376[_0x5ad3fb(0x1d5)]('(session:\x20'+_0x468996+')')),console[_0x5ad3fb(0x1e6)](a33_0x341376[_0x5ad3fb(0x1d5)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x4d578e+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
1
+ const a33_0x1bc630=a33_0x1586;(function(_0x425893,_0x159e6e){const _0x1e7894=a33_0x1586,_0x3046b5=_0x425893();while(!![]){try{const _0x1e1a5f=-parseInt(_0x1e7894(0xaa))/0x1+-parseInt(_0x1e7894(0xca))/0x2+-parseInt(_0x1e7894(0xbb))/0x3*(-parseInt(_0x1e7894(0xcf))/0x4)+parseInt(_0x1e7894(0x6b))/0x5*(parseInt(_0x1e7894(0xd2))/0x6)+-parseInt(_0x1e7894(0xa5))/0x7*(-parseInt(_0x1e7894(0xa0))/0x8)+parseInt(_0x1e7894(0x85))/0x9*(-parseInt(_0x1e7894(0xb0))/0xa)+parseInt(_0x1e7894(0x7c))/0xb;if(_0x1e1a5f===_0x159e6e)break;else _0x3046b5['push'](_0x3046b5['shift']());}catch(_0x5b5a8c){_0x3046b5['push'](_0x3046b5['shift']());}}}(a33_0x508f,0x1df64));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_0x53994c from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';function a33_0x1586(_0x11a791,_0x569bb2){_0x11a791=_0x11a791-0x68;const _0x508f04=a33_0x508f();let _0x1586a4=_0x508f04[_0x11a791];return _0x1586a4;}import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';function a33_0x508f(){const _0x4965ca=['length','21512zCWHoE','\x0aSaved\x20to:\x20','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','72QxGvvL','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','tdx:\x20profile\x20create','\x27\x20updated:\x20','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','password','(cleared)','\x0aSetup\x20cancelled','Changing\x20site\x20to\x20\x27','\x27\x20created','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','profileName','create','71580fquFkN','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','\x20Profile\x20\x27','bold','Delete\x20a\x20profile','Operation\x20cancelled','Session\x20profile\x20set\x20to:\x20','default','Validating\x20API\x20key...','\x27\x20requires\x20API\x20key\x20validation.','profile:delete','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','us01','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Removal\x20cancelled','Profile\x20\x27','Site\x20was\x20not\x20changed.','1579303IQVMgO','/app/mp/ak','ERROR','logLevel','email','\x20\x20-\x20','\x20API\x20key\x20is\x20valid\x20(User:\x20','session','apiKey','255699BnhjJo','llm_agent','VALID_KEYS','API\x20key\x20cannot\x20be\x20empty','Create\x20a\x20new\x20profile','dim','\x27\x20does\x20not\x20exist.','Profile\x20name\x20cannot\x20be\x20empty','Removed\x20existing\x20profile\x20\x27','\x27\x20deleted','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','force','Enter\x20description\x20(optional):','\x20API\x20key\x20saved\x20to\x20system\x20keychain','llm_project','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','Setup\x20cancelled','execute','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','status','\x20\x20tdx\x20--profile\x20','includes','green','profile:set','You\x20can\x20find\x20your\x20API\x20key\x20at:','name','Enter\x20profile\x20name:','91096SIrdDP','text','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','site','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','49WdjvDp','warn','oauth','confirm','Default\x20profile\x20set\x20to:\x20','208272AeEoOo','test','\x20\x20(no\x20profiles\x20found)','description','config','message','10iKxltg','split','Set\x20session\x20profile','join','jobs','\x27.\x0a\x0aValid\x20keys:\x20','validate','yellow','log','trim','profile','111PTzuZH','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','skipExistsCheck','red','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','database','\x27\x20does\x20not\x20exist.\x20Create\x20it?','profile:create','Enter\x20your\x20TD\x20API\x20key:','getUserInfo','✗\x20Validation\x20failed:\x20','Failed\x20to\x20delete\x20profile:\x20','Set\x20a\x20profile\x20configuration\x20value','error','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','469306UmdDlR','\x0aAvailable\x20profiles:','tdx.json','tdx:\x20profile\x20delete'];a33_0x508f=function(){return _0x4965ca;};return a33_0x508f();}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_0x3b2d5b from'prompts';import a33_0x4c36d0 from'chalk';function validateProfileName(_0x2fd1a6,_0x40205f){const _0x57a35c=a33_0x1586;if(!_0x2fd1a6||!_0x2fd1a6[_0x57a35c(0xb9)]())return _0x57a35c(0x8c);const _0x3c6429=_0x2fd1a6['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x57a35c(0xab)](_0x3c6429))return _0x57a35c(0xbf);if(!_0x40205f?.[_0x57a35c(0xbd)]&&profileExists(_0x3c6429))return _0x57a35c(0x7a)+_0x3c6429+_0x57a35c(0xd6)+_0x3c6429+_0x57a35c(0xa2);return!![];}async function deleteProfileAndCredentials(_0x420676){removeProfileFromUserConfig(_0x420676);const _0x3c4baf=await isKeychainAvailable();_0x3c4baf&&await Promise['all']([deleteKeychainAPIKey(_0x420676),deleteOAuthTokens(_0x420676)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x1bc630(0x9e)]=a33_0x1bc630(0xc2);[a33_0x1bc630(0xad)]=a33_0x1bc630(0x89);async[a33_0x1bc630(0x96)](_0x5000b4){const _0x4eb2a6=a33_0x1bc630,{options:_0x5c9486,args:_0x111231}=_0x5000b4,_0x15c586=!!_0x5c9486[_0x4eb2a6(0x90)];console['log'](a33_0x4c36d0['bold'](_0x4eb2a6(0xd4)));let _0x5f3fb9;if(_0x111231[_0x4eb2a6(0xce)]>0x0&&_0x111231[0x0]){const _0x209867=_0x111231[0x0][_0x4eb2a6(0xb9)]();_0x15c586&&profileExists(_0x209867)&&(await deleteProfileAndCredentials(_0x209867),console[_0x4eb2a6(0xb8)](_0x4eb2a6(0x8d)+_0x209867+'\x27'));const _0x52ba08=validateProfileName(_0x209867);if(_0x52ba08!==!![])return console[_0x4eb2a6(0xc8)](a33_0x4c36d0[_0x4eb2a6(0xbe)](_0x52ba08)),0x1;_0x5f3fb9=_0x209867;}else{const _0x279f24=await a33_0x3b2d5b({'type':'text','name':_0x4eb2a6(0x69),'message':_0x4eb2a6(0x9f),'validate':_0x595193=>validateProfileName(_0x595193,{'skipExistsCheck':_0x15c586})});if(!_0x279f24[_0x4eb2a6(0x69)])return console[_0x4eb2a6(0xb8)](_0x4eb2a6(0xd9)),0x1;_0x5f3fb9=_0x279f24[_0x4eb2a6(0x69)][_0x4eb2a6(0xb9)](),_0x15c586&&profileExists(_0x5f3fb9)&&(await deleteProfileAndCredentials(_0x5f3fb9),console[_0x4eb2a6(0xb8)](_0x4eb2a6(0x8d)+_0x5f3fb9+'\x27'));}const _0x485878=await a33_0x3b2d5b({'type':_0x4eb2a6(0xa1),'name':_0x4eb2a6(0xad),'message':_0x4eb2a6(0x91)}),_0x4a9a89=_0x485878[_0x4eb2a6(0xad)]?.[_0x4eb2a6(0xb9)]()||undefined,_0x4b110e=_0x5c9486[_0x4eb2a6(0xa3)]||_0x4eb2a6(0x77),_0x329c70=await promptSiteSelection(_0x4b110e,_0x5f3fb9,_0x4eb2a6(0x95));if(!_0x329c70)return 0x1;const _0x38e2b3=resolveSite(_0x329c70),_0x2ef27c=await promptAuthMethod();if(!_0x2ef27c)return console[_0x4eb2a6(0xb8)]('\x0aSetup\x20cancelled'),0x1;if(_0x2ef27c===_0x4eb2a6(0xa7)){if(_0x4a9a89){const _0x5e29cb={'site':_0x38e2b3,'description':_0x4a9a89};saveProfileToUserConfig(_0x5f3fb9,_0x5e29cb);}const {accountName:_0x48bfcb}=_0x5c9486;return await runOAuthLoginFlow(_0x38e2b3,_0x5f3fb9,_0x5c9486['logLevel']??LogLevel[_0x4eb2a6(0x7e)],{'accountName':_0x48bfcb}),0x0;}console[_0x4eb2a6(0xb8)](_0x4eb2a6(0x68)+_0x38e2b3),console['log'](_0x4eb2a6(0x9d)),console['log']('\x20\x20'+getConsoleUrl(_0x38e2b3,_0x4eb2a6(0x7d)));const _0x455b97=await a33_0x3b2d5b({'type':_0x4eb2a6(0xd7),'name':_0x4eb2a6(0x84),'message':_0x4eb2a6(0xc3),'validate':_0x350980=>{const _0x4aeb38=_0x4eb2a6;if(!_0x350980||!_0x350980[_0x4aeb38(0xb9)]())return _0x4aeb38(0x88);return!![];}});if(!_0x455b97[_0x4eb2a6(0x84)])return console[_0x4eb2a6(0xb8)](_0x4eb2a6(0xd9)),0x1;const _0x5417ba=_0x455b97[_0x4eb2a6(0x84)];console['log'](_0x4eb2a6(0x73));try{const _0x422ed5=TDX[_0x4eb2a6(0x6a)]({'site':_0x38e2b3,'apiKey':_0x5417ba['trim'](),'logLevel':_0x5c9486['logLevel']??LogLevel['ERROR']}),_0x2c29eb=await _0x422ed5[_0x4eb2a6(0xb4)]['getUserInfo']();console[_0x4eb2a6(0xb8)](a33_0x4c36d0[_0x4eb2a6(0x9b)]('✓')+_0x4eb2a6(0x82)+_0x2c29eb[_0x4eb2a6(0x80)]+')');const _0xfe643d=await isKeychainAvailable();_0xfe643d?(await saveAPIKeyAsync(_0x5417ba[_0x4eb2a6(0xb9)](),_0x38e2b3,_0x5f3fb9),console[_0x4eb2a6(0xb8)](a33_0x4c36d0['green']('✓')+_0x4eb2a6(0x6c)+_0x5f3fb9+')')):(console[_0x4eb2a6(0xa6)](a33_0x4c36d0[_0x4eb2a6(0xb7)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x4eb2a6(0xa6)](a33_0x4c36d0[_0x4eb2a6(0xb7)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x5a47be={'site':_0x38e2b3,..._0x4a9a89&&{'description':_0x4a9a89}};return saveProfileToUserConfig(_0x5f3fb9,_0x5a47be),console['log'](a33_0x4c36d0['green']('✓')+_0x4eb2a6(0x6d)+_0x5f3fb9+_0x4eb2a6(0xdb)),console[_0x4eb2a6(0xb8)](),console[_0x4eb2a6(0xb8)](_0x4eb2a6(0xbc)),console['log'](_0x4eb2a6(0x99)+_0x5f3fb9+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x4eb2a6(0xb8)]('\x20\x20tdx\x20--profile\x20'+_0x5f3fb9+_0x4eb2a6(0x78)),0x0;}catch(_0xcafe0d){if(_0xcafe0d instanceof HTTPClientError&&_0xcafe0d[_0x4eb2a6(0x98)]===0x191)return printAuthError(_0xcafe0d),0x1;return console[_0x4eb2a6(0xc8)](a33_0x4c36d0[_0x4eb2a6(0xbe)](_0x4eb2a6(0xc5)+(_0xcafe0d instanceof Error?_0xcafe0d[_0x4eb2a6(0xaf)]:String(_0xcafe0d)))),console['error'](_0x4eb2a6(0xd3)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x1bc630(0x9e)]=a33_0x1bc630(0x75);[a33_0x1bc630(0xad)]=a33_0x1bc630(0x6f);['validate'](_0x95f561){const _0x1f5682=a33_0x1bc630,{args:_0x92257f}=_0x95f561;if(_0x92257f[_0x1f5682(0xce)]===0x0)return _0x1f5682(0x97);return undefined;}async[a33_0x1bc630(0x96)](_0x2abba8){const _0x2e46e0=a33_0x1bc630,{args:_0x40913c}=_0x2abba8,_0x22d735=_0x40913c[0x0];console['log'](a33_0x4c36d0[_0x2e46e0(0x6e)](_0x2e46e0(0xcd)));if(!profileExists(_0x22d735)){console[_0x2e46e0(0xc8)](a33_0x4c36d0[_0x2e46e0(0xbe)](_0x2e46e0(0x7a)+_0x22d735+_0x2e46e0(0x8b))),console[_0x2e46e0(0xb8)](_0x2e46e0(0xcb));const _0xecfd5a=listProfiles();if(_0xecfd5a[_0x2e46e0(0xce)]===0x0)console[_0x2e46e0(0xb8)](_0x2e46e0(0xac));else for(const _0x35bec2 of _0xecfd5a){console[_0x2e46e0(0xb8)]('\x20\x20-\x20'+_0x35bec2[_0x2e46e0(0x9e)]);}return 0x1;}const _0x317c37=await a33_0x3b2d5b({'type':_0x2e46e0(0xa8),'name':'confirm','message':_0x2e46e0(0x94)+_0x22d735+'\x27?','initial':![]});if(!_0x317c37['confirm'])return console[_0x2e46e0(0xb8)](_0x2e46e0(0x79)),0x0;try{await deleteProfileAndCredentials(_0x22d735),console['log'](a33_0x4c36d0[_0x2e46e0(0x9b)]('✓')+_0x2e46e0(0x6d)+_0x22d735+_0x2e46e0(0x8e));}catch(_0x6903eb){return console[_0x2e46e0(0xc8)](a33_0x4c36d0[_0x2e46e0(0xbe)](_0x2e46e0(0xc6)+(_0x6903eb instanceof Error?_0x6903eb[_0x2e46e0(0xaf)]:String(_0x6903eb)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0x1bc630(0x9e)]=a33_0x1bc630(0x9c);[a33_0x1bc630(0xad)]=a33_0x1bc630(0xc7);static [a33_0x1bc630(0x87)]=[a33_0x1bc630(0xa3),a33_0x1bc630(0xc0),'parent_segment',a33_0x1bc630(0x93),a33_0x1bc630(0x86),'description'];[a33_0x1bc630(0xb6)](_0x430f6c){const _0x525f6a=a33_0x1bc630,{args:_0x2c5554,options:_0x114a3c}=_0x430f6c,_0x1db0d2=_0x114a3c[_0x525f6a(0xba)]||getActiveProfile();if(!_0x1db0d2)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(_0x2c5554['length']===0x0)return _0x525f6a(0xd1)+ProfileSetCommand[_0x525f6a(0x87)][_0x525f6a(0xb3)](',\x20');const _0x435152=_0x2c5554[0x0];if(!_0x435152[_0x525f6a(0x9a)]('='))return _0x525f6a(0xa4)+ProfileSetCommand[_0x525f6a(0x87)][_0x525f6a(0xb3)](',\x20');const [_0x731ba4]=_0x435152[_0x525f6a(0xb1)]('=',0x2);if(!ProfileSetCommand[_0x525f6a(0x87)][_0x525f6a(0x9a)](_0x731ba4))return'Unknown\x20key\x20\x27'+_0x731ba4+_0x525f6a(0xb5)+ProfileSetCommand[_0x525f6a(0x87)][_0x525f6a(0xb3)](',\x20');return undefined;}async[a33_0x1bc630(0x96)](_0x4ebb1a){const _0x46720b=a33_0x1bc630,{args:_0x322cd7,options:_0x36c4b2}=_0x4ebb1a,_0x41e404=_0x36c4b2[_0x46720b(0xba)]||getActiveProfile(),[_0x3ba449,..._0x5a7925]=_0x322cd7[0x0]['split']('='),_0x3b44bc=_0x5a7925[_0x46720b(0xb3)]('=');console['log'](a33_0x4c36d0[_0x46720b(0x6e)]('tdx:\x20profile\x20set'));if(!profileExists(_0x41e404)){const _0x42a5bb=await a33_0x3b2d5b({'type':_0x46720b(0xa8),'name':'create','message':_0x46720b(0x7a)+_0x41e404+_0x46720b(0xc1),'initial':!![]});if(!_0x42a5bb[_0x46720b(0x6a)])return console[_0x46720b(0xb8)](_0x46720b(0x70)),0x1;}const _0x8781c6=loadProfile(_0x41e404),_0x43679d=_0x8781c6?.[_0x46720b(0xae)]||{};if(_0x3ba449===_0x46720b(0xa3)){const _0x55c78d=resolveSite(_0x3b44bc);console['log'](_0x46720b(0xda)+_0x55c78d+_0x46720b(0x74)),console[_0x46720b(0xb8)](_0x46720b(0xdc)),console[_0x46720b(0xb8)]('\x20\x20'+getConsoleUrl(_0x55c78d,_0x46720b(0x7d)));const _0xede66=await a33_0x3b2d5b({'type':_0x46720b(0xd7),'name':_0x46720b(0x84),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x5c9265=>{const _0x1d4ce3=_0x46720b;if(!_0x5c9265||!_0x5c9265[_0x1d4ce3(0xb9)]())return _0x1d4ce3(0x88);return!![];}});if(!_0xede66['apiKey'])return console['log']('\x0aOperation\x20cancelled'),0x1;console['log'](_0x46720b(0x73));try{const _0x2dc2be=TDX['create']({'site':_0x55c78d,'apiKey':_0xede66[_0x46720b(0x84)][_0x46720b(0xb9)](),'logLevel':_0x36c4b2[_0x46720b(0x7f)]??LogLevel[_0x46720b(0x7e)]}),_0xbef1fc=await _0x2dc2be[_0x46720b(0xb4)][_0x46720b(0xc4)]();console[_0x46720b(0xb8)](a33_0x4c36d0[_0x46720b(0x9b)]('✓')+_0x46720b(0x82)+_0xbef1fc[_0x46720b(0x80)]+')');const _0x6cfd44=await isKeychainAvailable();_0x6cfd44?(await saveAPIKeyAsync(_0xede66['apiKey'][_0x46720b(0xb9)](),_0x55c78d,_0x41e404),console[_0x46720b(0xb8)](a33_0x4c36d0[_0x46720b(0x9b)]('✓')+_0x46720b(0x92))):console[_0x46720b(0xa6)](a33_0x4c36d0[_0x46720b(0xb7)](_0x46720b(0xc9))),_0x43679d['site']=_0x55c78d;}catch(_0x262af3){if(_0x262af3 instanceof HTTPClientError&&_0x262af3[_0x46720b(0x98)]===0x191)return printAuthError(_0x262af3),0x1;return console[_0x46720b(0xc8)](a33_0x4c36d0[_0x46720b(0xbe)]('✗\x20Validation\x20failed:\x20'+(_0x262af3 instanceof Error?_0x262af3['message']:String(_0x262af3)))),console[_0x46720b(0xc8)](_0x46720b(0x7b)),0x1;}}else _0x43679d[_0x3ba449]=_0x3b44bc||undefined;return saveProfileToUserConfig(_0x41e404,_0x43679d),console[_0x46720b(0xb8)](a33_0x4c36d0['green']('✓')+_0x46720b(0x6d)+_0x41e404+_0x46720b(0xd5)+_0x3ba449+'='+(_0x3b44bc||_0x46720b(0xd8))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x1bc630(0x9e)]='profile:use';[a33_0x1bc630(0xad)]=a33_0x1bc630(0xb2);[a33_0x1bc630(0xb6)](_0xc9f395){const _0x21c83e=a33_0x1bc630,{args:_0x4d4c1e}=_0xc9f395;if(_0x4d4c1e[_0x21c83e(0xce)]===0x0)return _0x21c83e(0x76);return undefined;}async[a33_0x1bc630(0x96)](_0x37c73b){const _0x4ef4e5=a33_0x1bc630,{args:_0x5203ce,options:_0x1fb7ca}=_0x37c73b,_0x335fa9=_0x5203ce[0x0],_0x3794cc=_0x1fb7ca[_0x4ef4e5(0x72)];cleanExpiredSessions();if(!profileExists(_0x335fa9)){console['error'](a33_0x4c36d0[_0x4ef4e5(0xbe)]('Profile\x20\x27'+_0x335fa9+_0x4ef4e5(0x8b))),console[_0x4ef4e5(0xb8)](_0x4ef4e5(0xcb));const _0x4bf9cf=listProfiles();if(_0x4bf9cf['length']===0x0)console['log'](_0x4ef4e5(0xac));else for(const _0x6e303a of _0x4bf9cf){console[_0x4ef4e5(0xb8)](_0x4ef4e5(0x81)+_0x6e303a[_0x4ef4e5(0x9e)]);}return 0x1;}if(_0x3794cc){const _0x5baa86=a33_0x53994c[_0x4ef4e5(0xb3)](getConfigDir(),_0x4ef4e5(0xcc));return saveActiveProfileToUserConfig(_0x335fa9),console['log'](_0x4ef4e5(0xa9)+a33_0x4c36d0['green'](_0x335fa9)),console[_0x4ef4e5(0xb8)](a33_0x4c36d0[_0x4ef4e5(0x8a)](_0x4ef4e5(0xd0)+_0x5baa86)),0x0;}const _0x4ddfce=getSessionID(_0x1fb7ca[_0x4ef4e5(0x83)]);return saveSessionContext({'profile':_0x335fa9},_0x1fb7ca[_0x4ef4e5(0x83)]),console[_0x4ef4e5(0xb8)](_0x4ef4e5(0x71)+a33_0x4c36d0['green'](_0x335fa9)+'\x20'+a33_0x4c36d0[_0x4ef4e5(0x8a)]('(session:\x20'+_0x4ddfce+')')),console[_0x4ef4e5(0xb8)](a33_0x4c36d0[_0x4ef4e5(0x8a)](_0x4ef4e5(0x8f)+_0x335fa9+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
@@ -1 +1 @@
1
- const a34_0x58e3f3=a34_0x1199;(function(_0x11404b,_0x1f583e){const _0x2832c5=a34_0x1199,_0xfd0d4c=_0x11404b();while(!![]){try{const _0x401420=parseInt(_0x2832c5(0x12c))/0x1*(parseInt(_0x2832c5(0x11a))/0x2)+-parseInt(_0x2832c5(0x11f))/0x3*(-parseInt(_0x2832c5(0x12d))/0x4)+parseInt(_0x2832c5(0x128))/0x5*(parseInt(_0x2832c5(0x125))/0x6)+-parseInt(_0x2832c5(0x11e))/0x7*(parseInt(_0x2832c5(0x126))/0x8)+parseInt(_0x2832c5(0x134))/0x9+parseInt(_0x2832c5(0x129))/0xa*(parseInt(_0x2832c5(0x131))/0xb)+-parseInt(_0x2832c5(0x124))/0xc;if(_0x401420===_0x1f583e)break;else _0xfd0d4c['push'](_0xfd0d4c['shift']());}catch(_0x148a48){_0xfd0d4c['push'](_0xfd0d4c['shift']());}}}(a34_0x115b,0x326df));import{BaseCommand}from'./command.js';function a34_0x115b(){const _0x28f4d3=['582aHkOLZ','8hdsajK','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','18395vgdcsC','4610sVAJho','👤\x20','description','1wlcadE','8RtZiyM','dim','map','\x20\x20Global:\x20~/.config/tdx/tdx.json','5951IrBlDV','green','name','2728170dqWInc','Error:\x20','747728eihgKC','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','execute','scope','615237elbkda','221847rhbfYn','length','log','List\x20all\x20available\x20profiles','config','13640472FNOQmh'];a34_0x115b=function(){return _0x28f4d3;};return a34_0x115b();}function a34_0x1199(_0x367762,_0x547b91){_0x367762=_0x367762-0x11a;const _0x115bd7=a34_0x115b();let _0x11997c=_0x115bd7[_0x367762];return _0x11997c;}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x125901 from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x58e3f3(0x133)]='profiles';[a34_0x58e3f3(0x12b)]=a34_0x58e3f3(0x122);async[a34_0x58e3f3(0x11c)](_0x277b2c){const _0x2ea356=a34_0x58e3f3,{options:_0x580f90}=_0x277b2c;try{const _0x2fa823=listProfiles(),_0x1c2497=getActiveProfile();if(_0x2fa823[_0x2ea356(0x120)]===0x0)return console[_0x2ea356(0x121)](_0x2ea356(0x127)),console['log'](_0x2ea356(0x11b)),console['log'](_0x2ea356(0x130)),0x0;const _0x2d2d22=_0x2fa823[_0x2ea356(0x12f)](_0x59f097=>{const _0x4fb75d=_0x2ea356,_0x2a36e2=_0x59f097[_0x4fb75d(0x133)]===_0x1c2497,_0x1091b3=getProfileParams(_0x59f097[_0x4fb75d(0x123)]);return{'name':_0x59f097['name'],'active':_0x2a36e2,'scope':_0x59f097[_0x4fb75d(0x11d)],'description':_0x59f097[_0x4fb75d(0x123)]['description']||'','params':_0x1091b3};});if(isStructuredFormat(_0x580f90))await handleSDKOutput(_0x2d2d22,_0x580f90);else for(const _0x275a23 of _0x2fa823){const _0x3b24a1=_0x275a23[_0x2ea356(0x133)]===_0x1c2497?a34_0x125901[_0x2ea356(0x132)]('\x20✓'):'',_0x572fad=_0x275a23[_0x2ea356(0x123)]['site']?a34_0x125901[_0x2ea356(0x12e)]('\x20'+_0x275a23[_0x2ea356(0x123)]['site']):'',_0x20466a=_0x275a23[_0x2ea356(0x123)][_0x2ea356(0x12b)]?a34_0x125901[_0x2ea356(0x12e)]('\x20\x20'+_0x275a23[_0x2ea356(0x123)][_0x2ea356(0x12b)]):'';console[_0x2ea356(0x121)](_0x2ea356(0x12a)+_0x275a23[_0x2ea356(0x133)]+_0x3b24a1+_0x572fad+_0x20466a);}return 0x0;}catch(_0x1fe594){return _0x1fe594 instanceof Error&&console['error'](_0x2ea356(0x135)+_0x1fe594['message']),0x1;}}}
1
+ const a34_0x347a22=a34_0x2afd;(function(_0x31941d,_0x87718c){const _0x5508cd=a34_0x2afd,_0x33fbf5=_0x31941d();while(!![]){try{const _0x50a450=parseInt(_0x5508cd(0x7d))/0x1+parseInt(_0x5508cd(0x92))/0x2*(parseInt(_0x5508cd(0x8b))/0x3)+-parseInt(_0x5508cd(0x81))/0x4+-parseInt(_0x5508cd(0x7e))/0x5+-parseInt(_0x5508cd(0x95))/0x6*(parseInt(_0x5508cd(0x94))/0x7)+parseInt(_0x5508cd(0x89))/0x8*(-parseInt(_0x5508cd(0x82))/0x9)+parseInt(_0x5508cd(0x90))/0xa;if(_0x50a450===_0x87718c)break;else _0x33fbf5['push'](_0x33fbf5['shift']());}catch(_0x1b900f){_0x33fbf5['push'](_0x33fbf5['shift']());}}}(a34_0x53e2,0xc4fa1));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a34_0x53e2(){const _0x3c4ac7=['scope','753538SqMyiE','execute','1533Zclbrz','40548csgjiA','dim','👤\x20','description','42322JGYRkG','630695EkkhMd','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','List\x20all\x20available\x20profiles','3091356lnMlql','117WatRrE','Error:\x20','profiles','error','site','length','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','871576ezwyYj','green','9plnuYs','config','log','message','name','34294790YugFBy'];a34_0x53e2=function(){return _0x3c4ac7;};return a34_0x53e2();}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x38b3cd from'chalk';function a34_0x2afd(_0x365e0e,_0x17621c){_0x365e0e=_0x365e0e-0x7a;const _0x53e23b=a34_0x53e2();let _0x2afd2f=_0x53e23b[_0x365e0e];return _0x2afd2f;}export class ProfilesCommand extends BaseCommand{['name']=a34_0x347a22(0x84);['description']=a34_0x347a22(0x80);async[a34_0x347a22(0x93)](_0x220785){const _0x5da7c8=a34_0x347a22,{options:_0x1c2504}=_0x220785;try{const _0x12ccdb=listProfiles(),_0x31564f=getActiveProfile();if(_0x12ccdb[_0x5da7c8(0x87)]===0x0)return console[_0x5da7c8(0x8d)](_0x5da7c8(0x88)),console[_0x5da7c8(0x8d)](_0x5da7c8(0x7f)),console[_0x5da7c8(0x8d)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x56954f=_0x12ccdb['map'](_0x7721ac=>{const _0x4efd90=_0x5da7c8,_0x7a1644=_0x7721ac[_0x4efd90(0x8f)]===_0x31564f,_0x5b6fa1=getProfileParams(_0x7721ac[_0x4efd90(0x8c)]);return{'name':_0x7721ac[_0x4efd90(0x8f)],'active':_0x7a1644,'scope':_0x7721ac[_0x4efd90(0x91)],'description':_0x7721ac['config'][_0x4efd90(0x7c)]||'','params':_0x5b6fa1};});if(isStructuredFormat(_0x1c2504))await handleSDKOutput(_0x56954f,_0x1c2504);else for(const _0x393382 of _0x12ccdb){const _0xd4aa14=_0x393382[_0x5da7c8(0x8f)]===_0x31564f?a34_0x38b3cd[_0x5da7c8(0x8a)]('\x20✓'):'',_0x58d5c3=_0x393382['config'][_0x5da7c8(0x86)]?a34_0x38b3cd[_0x5da7c8(0x7a)]('\x20'+_0x393382[_0x5da7c8(0x8c)][_0x5da7c8(0x86)]):'',_0x5767ed=_0x393382['config']['description']?a34_0x38b3cd[_0x5da7c8(0x7a)]('\x20\x20'+_0x393382[_0x5da7c8(0x8c)]['description']):'';console[_0x5da7c8(0x8d)](_0x5da7c8(0x7b)+_0x393382['name']+_0xd4aa14+_0x58d5c3+_0x5767ed);}return 0x0;}catch(_0x4d3eb2){return _0x4d3eb2 instanceof Error&&console[_0x5da7c8(0x85)](_0x5da7c8(0x83)+_0x4d3eb2[_0x5da7c8(0x8e)]),0x1;}}}
@@ -1 +1 @@
1
- const a35_0x3ddffd=a35_0x1dbc;(function(_0x42d096,_0x241d99){const _0x364fca=a35_0x1dbc,_0x506e78=_0x42d096();while(!![]){try{const _0x54673d=-parseInt(_0x364fca(0x19a))/0x1*(parseInt(_0x364fca(0x187))/0x2)+-parseInt(_0x364fca(0x1a6))/0x3+-parseInt(_0x364fca(0x197))/0x4*(parseInt(_0x364fca(0x195))/0x5)+parseInt(_0x364fca(0x188))/0x6*(-parseInt(_0x364fca(0x182))/0x7)+-parseInt(_0x364fca(0x1aa))/0x8+parseInt(_0x364fca(0x18f))/0x9+-parseInt(_0x364fca(0x1a2))/0xa*(-parseInt(_0x364fca(0x198))/0xb);if(_0x54673d===_0x241d99)break;else _0x506e78['push'](_0x506e78['shift']());}catch(_0x2329ad){_0x506e78['push'](_0x506e78['shift']());}}}(a35_0x43e2,0x5fd58));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';function a35_0x43e2(){const _0x47490e=['Site:\x20','Run\x20Trino\x20queries\x20(streaming)','database','args','5jomjnz','length','219356HBfMPB','2222ZsxnCO','error','1qGTTjW','SQL:\x20','...','in\x20','output','validate','file','\x20-\x20','83810PFuYMi','completedSplits','join','catalog','2269104VbMtnd','originalMessage','stats','\x20splits','5885304XUvlKL','\x20[Job\x20ID:\x20','query','message','push','options','verbose','information_schema','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','setJobId','setExtra','totalSplits','site','1186507YszQzq','elapsedTimeMillis','description','processedRows','Schema:\x20','111946SesHUa','6POHVmn','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','execute','\x0aAll\x20results\x20saved\x20to\x20','Statement\x20','state','\x20rows\x20','4247262UXCEyT','Executing\x20query...'];a35_0x43e2=function(){return _0x47490e;};return a35_0x43e2();}import{formatRows}from'../sdk/util/formatters.js';function a35_0x1dbc(_0x4b6102,_0x24bee1){_0x4b6102=_0x4b6102-0x177;const _0x43e20c=a35_0x43e2();let _0x1dbc69=_0x43e20c[_0x4b6102];return _0x1dbc69;}export class QueryCommand extends BaseCommand{['name']=a35_0x3ddffd(0x177);[a35_0x3ddffd(0x184)]=a35_0x3ddffd(0x192);async[a35_0x3ddffd(0x18a)](_0x3afa80){const _0x2f51a8=a35_0x3ddffd,{options:_0x181592,args:_0x4905c2,tdx:_0xd29f38}=_0x3afa80,_0x4b74c1={..._0x181592,'limitStructuredFormats':!![]},_0x3f6a44=_0x4905c2[0x0],_0x11df26=_0x181592[_0x2f51a8(0x1a0)];let _0x26563c;try{if(_0x11df26)_0x26563c=readSqlStatementsFromFile(_0x11df26);else{if(_0x3f6a44==='-')_0x26563c=await readSqlStatementsFromStdin();else{if(_0x3f6a44&&isSqlFilePath(_0x3f6a44))_0x26563c=readSqlStatementsFromFile(_0x3f6a44);else{if(_0x3f6a44)_0x26563c=splitSqlStatements(_0x3f6a44);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x16d2b5){return console['error']('Error:\x20'+_0x16d2b5[_0x2f51a8(0x178)]),0x1;}const _0x1dc019=_0x181592[_0x2f51a8(0x193)]||_0x2f51a8(0x17c),_0x2b22b1=_0x181592[_0x2f51a8(0x1a5)];try{const _0x429819=[],_0x162019=!!_0x181592['output'];for(let _0x561a1e=0x0;_0x561a1e<_0x26563c[_0x2f51a8(0x196)];_0x561a1e++){const _0x42f588=_0x26563c[_0x561a1e],_0xc8a1cf=_0x561a1e+0x1,_0x479f3d=_0x26563c[_0x2f51a8(0x196)],_0x2d2291=_0x479f3d>0x1;_0x181592['verbose']&&(console[_0x2f51a8(0x199)]('\x0a'+(_0x2d2291?'Statement\x20'+_0xc8a1cf+'/'+_0x479f3d+':':'')),console[_0x2f51a8(0x199)](_0x2f51a8(0x191)+_0x181592[_0x2f51a8(0x181)]),console[_0x2f51a8(0x199)]('Catalog:\x20'+(_0x2b22b1||'td')),console[_0x2f51a8(0x199)](_0x2f51a8(0x186)+_0x1dc019),console[_0x2f51a8(0x199)](_0x2f51a8(0x19b)+_0x42f588));const _0x314049=_0x2d2291?'Executing\x20statement\x20'+_0xc8a1cf+'/'+_0x479f3d+_0x2f51a8(0x19c):_0x2f51a8(0x190);try{const _0x1e4b24=await withProgressSpinner(_0x314049,async _0x260604=>{const _0x58db84=await _0xd29f38['query']['execute'](_0x42f588,{'catalog':_0x2b22b1,'schema':_0x1dc019,'onJobId':_0x555225=>{const _0x469665=a35_0x1dbc;_0x260604[_0x469665(0x17e)](_0x555225);},'onProgress':_0x2e2f7b=>{const _0x47a9d1=a35_0x1dbc;_0x260604['setPhase']('Executing\x20query\x20['+_0x2e2f7b[_0x47a9d1(0x18d)]+']'),_0x260604[_0x47a9d1(0x17f)](formatRows(_0x2e2f7b[_0x47a9d1(0x185)])+_0x47a9d1(0x18e)+_0x2e2f7b[_0x47a9d1(0x1a3)]+'/'+_0x2e2f7b[_0x47a9d1(0x180)]+_0x47a9d1(0x1a9));}});return _0x58db84;},{'verbose':_0x181592[_0x2f51a8(0x17b)]}),_0x56ccdc=_0x1e4b24['data'],_0x457d4f=_0x56ccdc['jobId']?_0x2f51a8(0x1ab)+_0x56ccdc['jobId']+']':'',_0x1d1af4=_0x2d2291?_0x2f51a8(0x18c)+_0xc8a1cf+'/'+_0x479f3d+_0x2f51a8(0x1a1):'';console['error']('✔\x20'+_0x1d1af4+'Query\x20completed:\x20Processed\x20'+formatRows(_0x56ccdc[_0x2f51a8(0x1a8)]['processedRows'])+'\x20rows\x20'+(_0x2f51a8(0x19d)+formatElapsed(_0x56ccdc[_0x2f51a8(0x1a8)][_0x2f51a8(0x183)])+_0x457d4f));if(_0x2d2291&&_0x162019){const _0x3b3f2a=resolveOutputOptions(_0x4b74c1),_0x1571ac=await formatQueryOutput(_0x56ccdc,_0x3b3f2a);_0x429819[_0x2f51a8(0x179)](_0x1571ac);}else await handleQueryOutput(_0x56ccdc,_0x4b74c1);}catch(_0x18a2c8){const _0x28f71e=_0x2d2291?_0x2f51a8(0x18c)+_0xc8a1cf+'/'+_0x479f3d+':\x0a':'',_0x492b44=_0x18a2c8 instanceof SDKError?_0x18a2c8[_0x2f51a8(0x1a7)]:_0x18a2c8['message'];return console[_0x2f51a8(0x199)](''+_0x28f71e+_0x492b44),0x1;}}if(_0x26563c[_0x2f51a8(0x196)]>0x1&&_0x162019&&_0x429819[_0x2f51a8(0x196)]>0x0){const _0x14c521=_0x429819[_0x2f51a8(0x1a4)]('\x0a');writeFileSync(_0x181592[_0x2f51a8(0x19e)],_0x14c521),console['error'](_0x2f51a8(0x18b)+_0x181592[_0x2f51a8(0x19e)]);}return 0x0;}catch(_0x25cae2){throw _0x25cae2;}}[a35_0x3ddffd(0x19f)](_0x2c7141){const _0x176b7b=a35_0x3ddffd,_0x3ee9e3=_0x2c7141[_0x176b7b(0x194)][0x0],_0x379dc4=_0x2c7141[_0x176b7b(0x17a)]['file'];if(!_0x3ee9e3&&!_0x379dc4)return _0x176b7b(0x17d);if(_0x3ee9e3&&_0x379dc4)return _0x176b7b(0x189);return undefined;}}
1
+ function a35_0x4b49(_0x3587b9,_0x405151){_0x3587b9=_0x3587b9-0x1b0;const _0x5e2dfb=a35_0x5e2d();let _0x4b49e8=_0x5e2dfb[_0x3587b9];return _0x4b49e8;}function a35_0x5e2d(){const _0xeb388=['totalSplits','data','validate','\x20-\x20','jobId','739614pZkNhZ','completedSplits','1647UoNbSp','in\x20','information_schema','output','375040YGNBCb','elapsedTimeMillis','setPhase','execute','state','file','error','SQL:\x20','stats','args','\x20[Job\x20ID:\x20','Schema:\x20','originalMessage','60730wZlujh','processedRows','message','No\x20SQL\x20provided','Query\x20completed:\x20Processed\x20','\x0aAll\x20results\x20saved\x20to\x20','3119724vGNKWq','verbose','1JHaEvx','1042726siiZNb','setExtra','Run\x20Trino\x20queries\x20(streaming)','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','site','Statement\x20','2127900eccFIG','Site:\x20','database','918084qWpVYP','7wySyEx','setJobId','\x20rows\x20','options','join','push','catalog','query','length','Executing\x20query\x20[','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options'];a35_0x5e2d=function(){return _0xeb388;};return a35_0x5e2d();}const a35_0x1b7f47=a35_0x4b49;(function(_0x13a775,_0x11eb18){const _0x436653=a35_0x4b49,_0x235656=_0x13a775();while(!![]){try{const _0x3398ae=-parseInt(_0x436653(0x1c2))/0x1*(-parseInt(_0x436653(0x1c3))/0x2)+-parseInt(_0x436653(0x1cc))/0x3+parseInt(_0x436653(0x1c0))/0x4+parseInt(_0x436653(0x1c9))/0x5+parseInt(_0x436653(0x1dd))/0x6*(parseInt(_0x436653(0x1cd))/0x7)+parseInt(_0x436653(0x1e3))/0x8+-parseInt(_0x436653(0x1df))/0x9*(parseInt(_0x436653(0x1ba))/0xa);if(_0x3398ae===_0x11eb18)break;else _0x235656['push'](_0x235656['shift']());}catch(_0x1f1c0a){_0x235656['push'](_0x235656['shift']());}}}(a35_0x5e2d,0x75194));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a35_0x1b7f47(0x1d4);['description']=a35_0x1b7f47(0x1c5);async['execute'](_0x29f0c9){const _0x2c4a67=a35_0x1b7f47,{options:_0xd160c1,args:_0x2d901f,tdx:_0x1c6de1}=_0x29f0c9,_0x54391e={..._0xd160c1,'limitStructuredFormats':!![]},_0x40ff47=_0x2d901f[0x0],_0x5abbed=_0xd160c1[_0x2c4a67(0x1b2)];let _0x380540;try{if(_0x5abbed)_0x380540=readSqlStatementsFromFile(_0x5abbed);else{if(_0x40ff47==='-')_0x380540=await readSqlStatementsFromStdin();else{if(_0x40ff47&&isSqlFilePath(_0x40ff47))_0x380540=readSqlStatementsFromFile(_0x40ff47);else{if(_0x40ff47)_0x380540=splitSqlStatements(_0x40ff47);else throw new Error(_0x2c4a67(0x1bd));}}}}catch(_0x18eac3){return console[_0x2c4a67(0x1b3)]('Error:\x20'+_0x18eac3[_0x2c4a67(0x1bc)]),0x1;}const _0x2ca935=_0xd160c1[_0x2c4a67(0x1cb)]||_0x2c4a67(0x1e1),_0x50f08d=_0xd160c1[_0x2c4a67(0x1d3)];try{const _0xc374a6=[],_0x360647=!!_0xd160c1[_0x2c4a67(0x1e2)];for(let _0x47af98=0x0;_0x47af98<_0x380540[_0x2c4a67(0x1d5)];_0x47af98++){const _0x46af62=_0x380540[_0x47af98],_0x412f82=_0x47af98+0x1,_0x34db28=_0x380540[_0x2c4a67(0x1d5)],_0x32d819=_0x34db28>0x1;_0xd160c1[_0x2c4a67(0x1c1)]&&(console[_0x2c4a67(0x1b3)]('\x0a'+(_0x32d819?_0x2c4a67(0x1c8)+_0x412f82+'/'+_0x34db28+':':'')),console[_0x2c4a67(0x1b3)](_0x2c4a67(0x1ca)+_0xd160c1[_0x2c4a67(0x1c7)]),console[_0x2c4a67(0x1b3)]('Catalog:\x20'+(_0x50f08d||'td')),console[_0x2c4a67(0x1b3)](_0x2c4a67(0x1b8)+_0x2ca935),console['error'](_0x2c4a67(0x1b4)+_0x46af62));const _0x4c84e6=_0x32d819?'Executing\x20statement\x20'+_0x412f82+'/'+_0x34db28+'...':'Executing\x20query...';try{const _0x10ba41=await withProgressSpinner(_0x4c84e6,async _0x22b480=>{const _0x1b49c1=_0x2c4a67,_0x2db52d=await _0x1c6de1[_0x1b49c1(0x1d4)][_0x1b49c1(0x1b0)](_0x46af62,{'catalog':_0x50f08d,'schema':_0x2ca935,'onJobId':_0xd9a660=>{const _0x35f22a=_0x1b49c1;_0x22b480[_0x35f22a(0x1ce)](_0xd9a660);},'onProgress':_0x21690a=>{const _0x3f0430=_0x1b49c1;_0x22b480[_0x3f0430(0x1e5)](_0x3f0430(0x1d6)+_0x21690a[_0x3f0430(0x1b1)]+']'),_0x22b480[_0x3f0430(0x1c4)](formatRows(_0x21690a[_0x3f0430(0x1bb)])+'\x20rows\x20'+_0x21690a[_0x3f0430(0x1de)]+'/'+_0x21690a[_0x3f0430(0x1d8)]+'\x20splits');}});return _0x2db52d;},{'verbose':_0xd160c1[_0x2c4a67(0x1c1)]}),_0x4c605d=_0x10ba41[_0x2c4a67(0x1d9)],_0x4a63e3=_0x4c605d['jobId']?_0x2c4a67(0x1b7)+_0x4c605d[_0x2c4a67(0x1dc)]+']':'',_0x53e749=_0x32d819?'Statement\x20'+_0x412f82+'/'+_0x34db28+_0x2c4a67(0x1db):'';console['error']('✔\x20'+_0x53e749+_0x2c4a67(0x1be)+formatRows(_0x4c605d[_0x2c4a67(0x1b5)][_0x2c4a67(0x1bb)])+_0x2c4a67(0x1cf)+(_0x2c4a67(0x1e0)+formatElapsed(_0x4c605d[_0x2c4a67(0x1b5)][_0x2c4a67(0x1e4)])+_0x4a63e3));if(_0x32d819&&_0x360647){const _0x76e957=resolveOutputOptions(_0x54391e),_0x2310fb=await formatQueryOutput(_0x4c605d,_0x76e957);_0xc374a6[_0x2c4a67(0x1d2)](_0x2310fb);}else await handleQueryOutput(_0x4c605d,_0x54391e);}catch(_0x11e3ca){const _0x4036c5=_0x32d819?'Statement\x20'+_0x412f82+'/'+_0x34db28+':\x0a':'',_0x144264=_0x11e3ca instanceof SDKError?_0x11e3ca[_0x2c4a67(0x1b9)]:_0x11e3ca['message'];return console[_0x2c4a67(0x1b3)](''+_0x4036c5+_0x144264),0x1;}}if(_0x380540[_0x2c4a67(0x1d5)]>0x1&&_0x360647&&_0xc374a6['length']>0x0){const _0x3e376e=_0xc374a6[_0x2c4a67(0x1d1)]('\x0a');writeFileSync(_0xd160c1[_0x2c4a67(0x1e2)],_0x3e376e),console['error'](_0x2c4a67(0x1bf)+_0xd160c1[_0x2c4a67(0x1e2)]);}return 0x0;}catch(_0x1a3c15){throw _0x1a3c15;}}[a35_0x1b7f47(0x1da)](_0x33a985){const _0x5a57ef=a35_0x1b7f47,_0xcd496b=_0x33a985[_0x5a57ef(0x1b6)][0x0],_0x5aa0b6=_0x33a985[_0x5a57ef(0x1d0)]['file'];if(!_0xcd496b&&!_0x5aa0b6)return _0x5a57ef(0x1d7);if(_0xcd496b&&_0x5aa0b6)return _0x5a57ef(0x1c6);return undefined;}}
@@ -1 +1 @@
1
- const a36_0x56f38b=a36_0x1993;(function(_0x5709c2,_0xd83dbd){const _0x467de1=a36_0x1993,_0x4c7873=_0x5709c2();while(!![]){try{const _0x8bbdc2=-parseInt(_0x467de1(0x23f))/0x1+-parseInt(_0x467de1(0x1d4))/0x2+parseInt(_0x467de1(0x1d8))/0x3*(parseInt(_0x467de1(0x1f4))/0x4)+parseInt(_0x467de1(0x1e3))/0x5*(-parseInt(_0x467de1(0x1ba))/0x6)+-parseInt(_0x467de1(0x1fa))/0x7*(-parseInt(_0x467de1(0x1d9))/0x8)+-parseInt(_0x467de1(0x237))/0x9*(parseInt(_0x467de1(0x21a))/0xa)+parseInt(_0x467de1(0x1cc))/0xb;if(_0x8bbdc2===_0xd83dbd)break;else _0x4c7873['push'](_0x4c7873['shift']());}catch(_0x1fa8f4){_0x4c7873['push'](_0x4c7873['shift']());}}}(a36_0x2588,0xbb5c1));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_0x383424 from'chalk';function a36_0x2588(){const _0x3fa07a=['jsonl','utf-8','No\x20scheduled\x20queries\x20found','timezone','history','Creating\x20schedule:\x20','78YmkrNU','Schedule\x20updated:\x20','limit','Running\x20schedule:\x20','\x20job','h\x20ago','Create\x20a\x20scheduled\x20query','cyan','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','...','/app/queries/editor?queryId=','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','Run\x20a\x20scheduled\x20query\x20immediately','lastRun','\x20execution','\x20scheduled\x20quer','count','from','56435962heWjeb','\x20\x20Type:\x20','Running\x20schedule...','Failed\x20to\x20read\x20file:\x20','in\x20','getTime','nextRun','user_name','2926260iJjIKe','statusIcon','json','description','11727YLbpVh','2024MbQyoi','retryLimit','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','cron','\x20\x20Database:\x20','Delete\x20a\x20scheduled\x20query','soon','result','engineVersion','pagination','372865zdpcnW','retry_limit','database','jobs','List\x20scheduled\x20queries','Show\x20schedule\x20execution\x20history','\x20\x20Cron:\x20','Show\x20schedule\x20details','\x20matching\x20\x22','ies','format','\x20\x20Time:\x20','verbose','tsv','Cancelled','query','schedule:show','188TKmmsn','\x20\x20Timezone:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','data','file','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','1519XrcomQ','\x22...','Listing\x20scheduled\x20queries...','next_run_at','Showing\x20first\x20','execute','\x20\x20Num:\x20','options','listQueries','schedules','Deleting\x20schedule...','map','site','create','length','\x20(use\x20--limit\x20to\x20see\x20more)','Schedule\x20deleted:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','args','show','padEnd','m\x20ago','Getting\x20schedule\x20history...','delete','round','log','\x20(showing\x20','queryUrl','ended_at','engine_version','time_zone','update','11608150QFwnIC','validate','Getting\x20schedule\x20details...','delay','priority','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','schedule:delete','INVALID_ARGUMENT','schedule:history','d\x20ago','error','status','join','schedule:update','output','type','\x20created','Searching\x20scheduled\x20queries\x20matching\x20\x22','toLocaleDateString','job_id','table','Schedule\x20run\x20submitted:\x20','entries','run','time','\x20\x20Job\x20ID:\x20','Found\x20','\x20schedules','max','9LTiULx','substring','trino','name','executing_user_id','Creating\x20schedule...','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','schedule:list','1008347kHBDQJ','just\x20now','last_job','trim','list','yes','success'];a36_0x2588=function(){return _0x3fa07a;};return a36_0x2588();}function formatRelativeTime(_0x12be11){const _0x5bb0a4=a36_0x1993,_0x2199c2=new Date(_0x12be11),_0x20b77b=new Date(),_0x464590=_0x2199c2[_0x5bb0a4(0x1d1)]()-_0x20b77b[_0x5bb0a4(0x1d1)](),_0x2202e7=Math['abs'](_0x464590)/0x3e8,_0x401216=_0x464590<0x0;if(_0x2202e7<0x3c)return _0x401216?_0x5bb0a4(0x1ae):_0x5bb0a4(0x1df);else{if(_0x2202e7<0xe10){const _0xfefb0e=Math[_0x5bb0a4(0x212)](_0x2202e7/0x3c);return _0x401216?_0xfefb0e+_0x5bb0a4(0x20f):_0x5bb0a4(0x1d0)+_0xfefb0e+'m';}else{if(_0x2202e7<0x15180){const _0x263f01=Math[_0x5bb0a4(0x212)](_0x2202e7/0xe10);return _0x401216?_0x263f01+_0x5bb0a4(0x1bf):'in\x20'+_0x263f01+'h';}else{if(_0x2202e7<0x93a80){const _0x4a7f0f=Math[_0x5bb0a4(0x212)](_0x2202e7/0x15180);return _0x401216?_0x4a7f0f+_0x5bb0a4(0x223):_0x5bb0a4(0x1d0)+_0x4a7f0f+'d';}else return _0x2199c2[_0x5bb0a4(0x22c)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x56f38b(0x23a)]=a36_0x56f38b(0x23e);[a36_0x56f38b(0x1d7)]=a36_0x56f38b(0x1e7);async[a36_0x56f38b(0x1ff)](_0x50d148){const _0x38b491=a36_0x56f38b,{options:_0x1db7f9,args:_0x4f9f61,tdx:_0x2f5957}=_0x50d148,_0xea81e8=resolveLimit(_0x1db7f9[_0x38b491(0x1bc)],DEFAULT_DISPLAY_LIMIT),_0x276b04=_0x4f9f61[0x0],_0xbb020a=_0x276b04?_0x38b491(0x22b)+_0x276b04+_0x38b491(0x1fb):_0x38b491(0x1fc),_0x2768b2=await withSpinner(_0xbb020a,()=>_0x2f5957[_0x38b491(0x203)][_0x38b491(0x202)]({'limit':_0xea81e8,'scheduled':!![],'pattern':_0x276b04}),{'verbose':_0x1db7f9['verbose']}),_0x25acf0=_0x2768b2[_0x38b491(0x1f7)]['queries'],_0x2a7c1d=_0x2768b2['data'][_0x38b491(0x1e2)]['has_next_page'],_0x1bf012=_0x276b04?_0x38b491(0x1eb)+_0x276b04+'\x22':'';_0x2a7c1d?console[_0x38b491(0x224)](_0x38b491(0x1fe)+_0x25acf0['length']+_0x38b491(0x235)+_0x1bf012+_0x38b491(0x209)):console[_0x38b491(0x224)](_0x38b491(0x234)+_0x25acf0['length']+_0x38b491(0x1c9)+(_0x25acf0[_0x38b491(0x208)]!==0x1?_0x38b491(0x1ec):'y')+_0x1bf012);if(_0x1db7f9[_0x38b491(0x1ed)]===_0x38b491(0x1d6)||_0x1db7f9[_0x38b491(0x1ed)]===_0x38b491(0x1b4)||_0x1db7f9['format']===_0x38b491(0x22e)||_0x1db7f9['format']===_0x38b491(0x1f0)){const _0x4ac958=_0x25acf0[_0x38b491(0x205)](_0x2abc63=>({'id':_0x2abc63['id'],'name':_0x2abc63[_0x38b491(0x23a)],'cron':_0x2abc63['cron'],'database':_0x2abc63[_0x38b491(0x1e5)]?.['name'],'type':_0x2abc63[_0x38b491(0x229)],'timezone':_0x2abc63[_0x38b491(0x218)],'user_name':_0x2abc63['user']?.[_0x38b491(0x23a)],'updated_at':_0x2abc63['updated_at'],'next_run_at':_0x2abc63[_0x38b491(0x1fd)],'last_job_status':_0x2abc63[_0x38b491(0x1af)]?.[_0x38b491(0x225)]}));await handleSDKOutput(_0x4ac958,_0x1db7f9);}else{if(_0x25acf0[_0x38b491(0x208)]===0x0)console[_0x38b491(0x213)](_0x38b491(0x1b6));else{const _0x517fb6=_0x1db7f9[_0x38b491(0x206)],_0x54eada=_0x25acf0['map'](_0x459628=>{const _0x1e33c6=_0x38b491,_0x1d7002=_0x459628[_0x1e33c6(0x1af)]?.[_0x1e33c6(0x225)]?_0x459628[_0x1e33c6(0x1af)][_0x1e33c6(0x225)]===_0x1e33c6(0x1b3)?'✓':'✗':'-',_0x284c97=_0x459628['last_job']?.[_0x1e33c6(0x216)]?formatRelativeTime(_0x459628[_0x1e33c6(0x1af)][_0x1e33c6(0x216)]):'never',_0x17b41a=_0x459628['next_run_at']?formatRelativeTime(_0x459628[_0x1e33c6(0x1fd)]):'-',_0x3db0a6=_0x459628[_0x1e33c6(0x1dc)]||'',_0x4b8962=_0x459628['name']||'(unnamed)',_0x36716a=getConsoleUrl(_0x517fb6,_0x1e33c6(0x1c4)+_0x459628['id']);return{'statusIcon':_0x1d7002,'lastRun':_0x284c97,'nextRun':_0x17b41a,'cron':_0x3db0a6,'name':_0x4b8962,'queryUrl':_0x36716a,'status':_0x459628[_0x1e33c6(0x1af)]?.[_0x1e33c6(0x225)]};}),_0x400222=Math[_0x38b491(0x236)](..._0x54eada[_0x38b491(0x205)](_0x28180a=>_0x28180a[_0x38b491(0x1c7)][_0x38b491(0x208)])),_0x10b272=Math[_0x38b491(0x236)](..._0x54eada['map'](_0x338503=>_0x338503[_0x38b491(0x1d2)][_0x38b491(0x208)])),_0x779f6b=Math[_0x38b491(0x236)](..._0x54eada[_0x38b491(0x205)](_0x5b0d3f=>_0x5b0d3f[_0x38b491(0x1dc)][_0x38b491(0x208)])),_0x532832=_0x54eada[_0x38b491(0x205)](_0x5a49ab=>{const _0x2de0d9=_0x38b491,_0x9c326b=_0x5a49ab['status']==='success'?a36_0x383424['green'](_0x5a49ab[_0x2de0d9(0x1d5)]):_0x5a49ab['status']===_0x2de0d9(0x224)?a36_0x383424['red'](_0x5a49ab['statusIcon']):a36_0x383424['dim'](_0x5a49ab[_0x2de0d9(0x1d5)]),_0x4cb7bd=_0x5a49ab[_0x2de0d9(0x1c7)][_0x2de0d9(0x20e)](_0x400222),_0x12f5bd=_0x5a49ab['nextRun'][_0x2de0d9(0x20e)](_0x10b272),_0x13d50f=_0x5a49ab[_0x2de0d9(0x1dc)]?a36_0x383424[_0x2de0d9(0x1c1)](_0x5a49ab[_0x2de0d9(0x1dc)][_0x2de0d9(0x20e)](_0x779f6b)):'\x20'['repeat'](_0x779f6b),_0x5e9788=hyperlink(_0x5a49ab['name'],_0x5a49ab[_0x2de0d9(0x215)]);return'📅\x20'+_0x9c326b+'\x20'+_0x4cb7bd+'\x20\x20→\x20'+_0x12f5bd+'\x20\x20'+_0x13d50f+'\x20\x20'+_0x5e9788;});await writeOutput(_0x532832[_0x38b491(0x226)]('\x0a'),_0x1db7f9[_0x38b491(0x228)],_0x38b491(0x1b1));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x56f38b(0x23a)]=a36_0x56f38b(0x1f3);[a36_0x56f38b(0x1d7)]=a36_0x56f38b(0x1ea);[a36_0x56f38b(0x21b)](_0x5d0d0f){const _0x201652=a36_0x56f38b,_0x18dc60=_0x5d0d0f[_0x201652(0x20c)][0x0];if(!_0x18dc60)return _0x201652(0x20b);return undefined;}async['execute'](_0x5aaf1b){const _0x21c96d=a36_0x56f38b,{options:_0xc0ad01,args:_0xe07902,tdx:_0x4ccde1}=_0x5aaf1b,_0x4da8fc=_0xe07902[0x0],_0x23f704=await withSpinner(_0x21c96d(0x21c),()=>_0x4ccde1[_0x21c96d(0x203)][_0x21c96d(0x20d)](_0x4da8fc),{'verbose':_0xc0ad01[_0x21c96d(0x1ef)]}),_0x3e27b8=_0x23f704[_0x21c96d(0x1f7)],_0x3b0e43={'name':_0x3e27b8[_0x21c96d(0x23a)],'cron':_0x3e27b8[_0x21c96d(0x1dc)],'database':_0x3e27b8['database'],'type':_0x3e27b8[_0x21c96d(0x229)],'timezone':_0x3e27b8['timezone'],'user_name':_0x3e27b8[_0x21c96d(0x1d3)],'created_at':_0x3e27b8['created_at'],'engine_version':_0x3e27b8[_0x21c96d(0x217)],'executing_user_id':_0x3e27b8[_0x21c96d(0x23b)],'query':_0x3e27b8['query'],'delay':_0x3e27b8[_0x21c96d(0x21d)],'priority':_0x3e27b8['priority'],'retry_limit':_0x3e27b8['retry_limit'],..._0x3e27b8[_0x21c96d(0x1e0)]&&{'result':_0x3e27b8[_0x21c96d(0x1e0)]}};return await handleSingleObjectOutput(_0x3b0e43,_0xc0ad01),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x56f38b(0x23a)]='schedule:create';[a36_0x56f38b(0x1d7)]=a36_0x56f38b(0x1c0);[a36_0x56f38b(0x21b)](_0x421b60){const _0x5677fa=a36_0x56f38b,_0x36acd7=_0x421b60[_0x5677fa(0x20c)][0x0];if(!_0x36acd7)return _0x5677fa(0x1c2);const _0x13d35c=_0x421b60[_0x5677fa(0x201)];if(!_0x13d35c[_0x5677fa(0x1e5)])return _0x5677fa(0x1c5);return undefined;}async[a36_0x56f38b(0x1ff)](_0x47f15e){const _0x5261f6=a36_0x56f38b,{options:_0x268f07,args:_0xb641,tdx:_0x232c9f}=_0x47f15e,_0x57ee53=_0xb641[0x0],_0x2b059c=_0x268f07,_0x593a9d=_0x2b059c[_0x5261f6(0x1e5)],_0x579b28=_0x2b059c[_0x5261f6(0x1f8)],_0x1af010=_0x2b059c['type']||_0x5261f6(0x239);let _0x1bb332;try{_0x1bb332=readFileSync(_0x579b28,'utf-8')[_0x5261f6(0x1b0)]();}catch(_0x421fb4){throw new SDKError(ErrorCode[_0x5261f6(0x221)],_0x5261f6(0x1cf)+_0x579b28,_0x421fb4 instanceof Error?_0x421fb4:undefined);}if(!_0x1bb332)throw new SDKError(ErrorCode[_0x5261f6(0x221)],'Query\x20file\x20is\x20empty');const _0x570a0e={'database':_0x593a9d,'query':_0x1bb332,'type':_0x1af010};if(_0x2b059c[_0x5261f6(0x1dc)])_0x570a0e[_0x5261f6(0x1dc)]=_0x2b059c[_0x5261f6(0x1dc)];if(_0x2b059c[_0x5261f6(0x1b7)])_0x570a0e[_0x5261f6(0x1b7)]=_0x2b059c[_0x5261f6(0x1b7)];if(_0x2b059c[_0x5261f6(0x21d)]!==undefined)_0x570a0e[_0x5261f6(0x21d)]=Number(_0x2b059c[_0x5261f6(0x21d)]);if(_0x2b059c[_0x5261f6(0x21e)]!==undefined)_0x570a0e[_0x5261f6(0x21e)]=Number(_0x2b059c[_0x5261f6(0x21e)]);if(_0x2b059c['retryLimit']!==undefined)_0x570a0e[_0x5261f6(0x1e4)]=Number(_0x2b059c[_0x5261f6(0x1da)]);if(_0x2b059c[_0x5261f6(0x1e1)])_0x570a0e[_0x5261f6(0x217)]=_0x2b059c[_0x5261f6(0x1e1)];if(_0x2b059c[_0x5261f6(0x1e0)])_0x570a0e[_0x5261f6(0x1e0)]=_0x2b059c[_0x5261f6(0x1e0)];if(_0x268f07['verbose']){console[_0x5261f6(0x224)](_0x5261f6(0x1b9)+_0x57ee53),console[_0x5261f6(0x224)](_0x5261f6(0x1dd)+_0x593a9d),console[_0x5261f6(0x224)](_0x5261f6(0x1cd)+_0x1af010);if(_0x570a0e['cron'])console[_0x5261f6(0x224)](_0x5261f6(0x1e9)+_0x570a0e[_0x5261f6(0x1dc)]);if(_0x570a0e['timezone'])console[_0x5261f6(0x224)](_0x5261f6(0x1f5)+_0x570a0e[_0x5261f6(0x1b7)]);}const _0x43e3e6=await withSpinner(_0x5261f6(0x23c),()=>_0x232c9f['schedules'][_0x5261f6(0x207)](_0x57ee53,_0x570a0e),{'verbose':_0x268f07[_0x5261f6(0x1ef)]});return console[_0x5261f6(0x224)]('Schedule\x20created:\x20'+_0x43e3e6[_0x5261f6(0x1f7)][_0x5261f6(0x23a)]),await handleSingleObjectOutput(_0x43e3e6[_0x5261f6(0x1f7)],_0x268f07),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x56f38b(0x23a)]=a36_0x56f38b(0x227);['description']='Update\x20a\x20scheduled\x20query';[a36_0x56f38b(0x21b)](_0x345208){const _0x1f02cd=a36_0x56f38b,_0x28bed6=_0x345208[_0x1f02cd(0x20c)][0x0];if(!_0x28bed6)return _0x1f02cd(0x1f6);return undefined;}async[a36_0x56f38b(0x1ff)](_0x1b989e){const _0xe9389c=a36_0x56f38b,{options:_0x51a219,args:_0x25ffdd,tdx:_0x1f88a0}=_0x1b989e,_0x1792d3=_0x25ffdd[0x0],_0x4db2f1=_0x51a219,_0x49dd8f={};if(_0x4db2f1[_0xe9389c(0x1e5)])_0x49dd8f[_0xe9389c(0x1e5)]=_0x4db2f1[_0xe9389c(0x1e5)];if(_0x4db2f1[_0xe9389c(0x229)])_0x49dd8f[_0xe9389c(0x229)]=_0x4db2f1[_0xe9389c(0x229)];if(_0x4db2f1[_0xe9389c(0x1dc)])_0x49dd8f[_0xe9389c(0x1dc)]=_0x4db2f1[_0xe9389c(0x1dc)];if(_0x4db2f1[_0xe9389c(0x1b7)])_0x49dd8f[_0xe9389c(0x1b7)]=_0x4db2f1['timezone'];if(_0x4db2f1['delay']!==undefined)_0x49dd8f[_0xe9389c(0x21d)]=Number(_0x4db2f1[_0xe9389c(0x21d)]);if(_0x4db2f1['priority']!==undefined)_0x49dd8f[_0xe9389c(0x21e)]=Number(_0x4db2f1[_0xe9389c(0x21e)]);if(_0x4db2f1[_0xe9389c(0x1da)]!==undefined)_0x49dd8f['retry_limit']=Number(_0x4db2f1[_0xe9389c(0x1da)]);if(_0x4db2f1[_0xe9389c(0x1e1)])_0x49dd8f[_0xe9389c(0x217)]=_0x4db2f1['engineVersion'];if(_0x4db2f1[_0xe9389c(0x1e0)])_0x49dd8f['result']=_0x4db2f1[_0xe9389c(0x1e0)];if(_0x4db2f1[_0xe9389c(0x1f8)])try{_0x49dd8f['query']=readFileSync(_0x4db2f1[_0xe9389c(0x1f8)],_0xe9389c(0x1b5))[_0xe9389c(0x1b0)]();}catch(_0x105af8){throw new SDKError(ErrorCode[_0xe9389c(0x221)],_0xe9389c(0x1cf)+_0x4db2f1[_0xe9389c(0x1f8)],_0x105af8 instanceof Error?_0x105af8:undefined);}if(Object['keys'](_0x49dd8f)['length']===0x0)throw new SDKError(ErrorCode[_0xe9389c(0x221)],_0xe9389c(0x23d));if(_0x51a219[_0xe9389c(0x1ef)]){console['error']('Updating\x20schedule:\x20'+_0x1792d3);for(const [_0x2b1850,_0x39e9f9]of Object[_0xe9389c(0x230)](_0x49dd8f)){_0x2b1850===_0xe9389c(0x1f2)?console[_0xe9389c(0x224)]('\x20\x20'+_0x2b1850+':\x20'+_0x39e9f9[_0xe9389c(0x238)](0x0,0x32)+_0xe9389c(0x1c3)):console[_0xe9389c(0x224)]('\x20\x20'+_0x2b1850+':\x20'+_0x39e9f9);}}const _0x3ebc9b=await withSpinner('Updating\x20schedule...',()=>_0x1f88a0[_0xe9389c(0x203)][_0xe9389c(0x219)](_0x1792d3,_0x49dd8f),{'verbose':_0x51a219[_0xe9389c(0x1ef)]});return console[_0xe9389c(0x224)](_0xe9389c(0x1bb)+_0x3ebc9b['data'][_0xe9389c(0x23a)]),await handleSingleObjectOutput(_0x3ebc9b[_0xe9389c(0x1f7)],_0x51a219),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x56f38b(0x23a)]=a36_0x56f38b(0x220);[a36_0x56f38b(0x1d7)]=a36_0x56f38b(0x1de);[a36_0x56f38b(0x21b)](_0x187ec5){const _0x13fc3a=a36_0x56f38b,_0x491c3c=_0x187ec5[_0x13fc3a(0x20c)][0x0];if(!_0x491c3c)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async['execute'](_0x5070cd){const _0x33c337=a36_0x56f38b,{options:_0x1bcb0d,args:_0x34e6d9,tdx:_0x3f3657}=_0x5070cd,_0x5d92f6=_0x34e6d9[0x0];if(!_0x1bcb0d[_0x33c337(0x1b2)]){const _0x524a0c=await confirm(_0x33c337(0x1f9)+_0x5d92f6+'\x22?');if(!_0x524a0c)return console[_0x33c337(0x224)](_0x33c337(0x1f1)),0x0;}const _0x260a4e=await withSpinner(_0x33c337(0x204),()=>_0x3f3657[_0x33c337(0x203)][_0x33c337(0x211)](_0x5d92f6),{'verbose':_0x1bcb0d['verbose']});return console[_0x33c337(0x224)](_0x33c337(0x20a)+_0x260a4e[_0x33c337(0x1f7)][_0x33c337(0x23a)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x56f38b(0x23a)]='schedule:run';['description']=a36_0x56f38b(0x1c6);[a36_0x56f38b(0x21b)](_0x558ddf){const _0xc4a063=a36_0x56f38b,_0x38c5c9=_0x558ddf['args'][0x0];if(!_0x38c5c9)return _0xc4a063(0x21f);return undefined;}async[a36_0x56f38b(0x1ff)](_0xbeb7a4){const _0x553b58=a36_0x56f38b,{options:_0x1e28e6,args:_0x171e84,tdx:_0x1810f4}=_0xbeb7a4,_0x5be5a3=_0x171e84[0x0],_0x4f9634=_0x1e28e6,_0x38d9a7=_0x4f9634[_0x553b58(0x232)],_0x173a7d=_0x4f9634['num']!==undefined?Number(_0x4f9634['num']):undefined;if(_0x1e28e6['verbose']){console['error'](_0x553b58(0x1bd)+_0x5be5a3);if(_0x38d9a7)console[_0x553b58(0x224)](_0x553b58(0x1ee)+_0x38d9a7);if(_0x173a7d)console[_0x553b58(0x224)](_0x553b58(0x200)+_0x173a7d);}const _0x1dd02e=await withSpinner(_0x553b58(0x1ce),()=>_0x1810f4[_0x553b58(0x203)][_0x553b58(0x231)](_0x5be5a3,{'time':_0x38d9a7,'num':_0x173a7d}),{'verbose':_0x1e28e6['verbose']}),_0x357e71=_0x1dd02e[_0x553b58(0x1f7)][_0x553b58(0x1e6)];console[_0x553b58(0x224)](_0x553b58(0x22f)+_0x357e71['length']+_0x553b58(0x1be)+(_0x357e71[_0x553b58(0x208)]!==0x1?'s':'')+_0x553b58(0x22a));for(const _0x52d4d4 of _0x357e71){console[_0x553b58(0x224)](_0x553b58(0x233)+_0x52d4d4[_0x553b58(0x22d)]);}return await handleSDKOutput(_0x357e71,_0x1e28e6),0x0;}}function a36_0x1993(_0x5a0e55,_0x42164a){_0x5a0e55=_0x5a0e55-0x1ae;const _0x258802=a36_0x2588();let _0x1993df=_0x258802[_0x5a0e55];return _0x1993df;}export class ScheduleHistoryCommand extends BaseCommand{['name']=a36_0x56f38b(0x222);[a36_0x56f38b(0x1d7)]=a36_0x56f38b(0x1e8);[a36_0x56f38b(0x21b)](_0x4fcfa7){const _0xbcc3a3=a36_0x56f38b,_0x3e985a=_0x4fcfa7[_0xbcc3a3(0x20c)][0x0];if(!_0x3e985a)return _0xbcc3a3(0x1db);return undefined;}async['execute'](_0x498695){const _0x54ff24=a36_0x56f38b,{options:_0xda6e20,args:_0x407dcc,tdx:_0x22ee2e}=_0x498695,_0x466a64=_0x407dcc[0x0],_0x2cfac9=_0xda6e20,_0x1eff6d=_0x2cfac9[_0x54ff24(0x1cb)]!==undefined?Number(_0x2cfac9[_0x54ff24(0x1cb)]):undefined,_0x20ffd1=_0x2cfac9['to']!==undefined?Number(_0x2cfac9['to']):undefined,_0x52dbce=await withSpinner(_0x54ff24(0x210),()=>_0x22ee2e['schedules']['history'](_0x466a64,{'from':_0x1eff6d,'to':_0x20ffd1}),{'verbose':_0xda6e20[_0x54ff24(0x1ef)]}),_0x3b9447=_0x52dbce[_0x54ff24(0x1f7)];console[_0x54ff24(0x224)]('Found\x20'+_0x3b9447[_0x54ff24(0x1ca)]+_0x54ff24(0x1c8)+(_0x3b9447[_0x54ff24(0x1ca)]!==0x1?'s':'')+_0x54ff24(0x214)+_0x3b9447[_0x54ff24(0x1cb)]+'-'+_0x3b9447['to']+')');const _0x369178=_0x3b9447[_0x54ff24(0x1b8)][_0x54ff24(0x205)](_0x383c01=>({'job_id':_0x383c01[_0x54ff24(0x22d)],'type':_0x383c01[_0x54ff24(0x229)],'status':_0x383c01[_0x54ff24(0x225)],'scheduled_at':_0x383c01['scheduled_at'],'created_at':_0x383c01['created_at'],'start_at':_0x383c01['start_at'],'end_at':_0x383c01['end_at']}));return await handleSDKOutput(_0x369178,_0xda6e20),0x0;}}
1
+ const a36_0x32adf0=a36_0x43b7;(function(_0x189c67,_0x5c9000){const _0x2b23d8=a36_0x43b7,_0x43486b=_0x189c67();while(!![]){try{const _0x9509b=-parseInt(_0x2b23d8(0x149))/0x1+parseInt(_0x2b23d8(0x135))/0x2+parseInt(_0x2b23d8(0x143))/0x3+parseInt(_0x2b23d8(0x114))/0x4+-parseInt(_0x2b23d8(0x144))/0x5+-parseInt(_0x2b23d8(0x16b))/0x6*(parseInt(_0x2b23d8(0x142))/0x7)+parseInt(_0x2b23d8(0x139))/0x8*(parseInt(_0x2b23d8(0x10a))/0x9);if(_0x9509b===_0x5c9000)break;else _0x43486b['push'](_0x43486b['shift']());}catch(_0x286e4a){_0x43486b['push'](_0x43486b['shift']());}}}(a36_0x3ec2,0x4580f));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';function a36_0x3ec2(){const _0x52e2d8=['entries','\x20schedules','delay','d\x20ago','getTime','verbose','Show\x20schedule\x20details','Searching\x20scheduled\x20queries\x20matching\x20\x22','queryUrl','file','schedule:create','listQueries','name','last_job','engineVersion','abs','substring','ended_at','red','\x20\x20Job\x20ID:\x20','length','INVALID_ARGUMENT','limit','execute','retry_limit','Creating\x20schedule...','description','list','format','404526qDPJWA','Creating\x20schedule:\x20','nextRun','tsv','schedule:show','keys','\x20\x20Type:\x20','\x20matching\x20\x22','Getting\x20schedule\x20history...','json','success','\x20(showing\x20','Found\x20','next_run_at','error','type','max','No\x20scheduled\x20queries\x20found','options','schedule:update','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','padEnd','\x20\x20Cron:\x20','h\x20ago','statusIcon','show','Listing\x20scheduled\x20queries...','trim','executing_user_id','Schedule\x20run\x20submitted:\x20','Running\x20schedule...','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','query','Updating\x20schedule...','(unnamed)','output','Getting\x20schedule\x20details...','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','Delete\x20a\x20scheduled\x20query','Deleting\x20schedule...','utf-8','user_name','\x20execution','Showing\x20first\x20','Schedule\x20deleted:\x20','18yQwLDQ','job_id','in\x20','queries','soon','map','cron','\x20\x20→\x20','table','dim','904164ofZNyr','delete','Query\x20file\x20is\x20empty','history','/app/queries/editor?queryId=','log','round','schedule:list','has_next_page','timezone','result','engine_version','Update\x20a\x20scheduled\x20query','join','Create\x20a\x20scheduled\x20query','time_zone','end_at','green','pagination','from','update','args','jsonl','Cancelled','updated_at','created_at','status','start_at','create','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','validate','database','Updating\x20schedule:\x20','137646HdhBDF','schedules','count','\x20created','1656296URHvBb','repeat','📅\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','num','data','priority','site','\x20(use\x20--limit\x20to\x20see\x20more)','49hVPJYI','1003602EFSdXk','519225MjPBlI','retryLimit','schedule:delete','\x20\x20Database:\x20','\x20scheduled\x20quer','182993JzFBJI','never','scheduled_at','\x20\x20Time:\x20','Run\x20a\x20scheduled\x20query\x20immediately'];a36_0x3ec2=function(){return _0x52e2d8;};return a36_0x3ec2();}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_0x134565 from'chalk';function formatRelativeTime(_0x4c0a47){const _0x1064ea=a36_0x43b7,_0x1a935d=new Date(_0x4c0a47),_0x11f380=new Date(),_0x4c300c=_0x1a935d['getTime']()-_0x11f380[_0x1064ea(0x152)](),_0x2497e3=Math[_0x1064ea(0x15d)](_0x4c300c)/0x3e8,_0x2757e6=_0x4c300c<0x0;if(_0x2497e3<0x3c)return _0x2757e6?'just\x20now':_0x1064ea(0x10e);else{if(_0x2497e3<0xe10){const _0xadc471=Math['round'](_0x2497e3/0x3c);return _0x2757e6?_0xadc471+'m\x20ago':_0x1064ea(0x10c)+_0xadc471+'m';}else{if(_0x2497e3<0x15180){const _0x2ebf6c=Math[_0x1064ea(0x11a)](_0x2497e3/0xe10);return _0x2757e6?_0x2ebf6c+_0x1064ea(0x182):_0x1064ea(0x10c)+_0x2ebf6c+'h';}else{if(_0x2497e3<0x93a80){const _0x9aa629=Math[_0x1064ea(0x11a)](_0x2497e3/0x15180);return _0x2757e6?_0x9aa629+_0x1064ea(0x151):_0x1064ea(0x10c)+_0x9aa629+'d';}else return _0x1a935d['toLocaleDateString']();}}}}export class ScheduleListCommand extends BaseCommand{['name']=a36_0x32adf0(0x11b);[a36_0x32adf0(0x168)]='List\x20scheduled\x20queries';async[a36_0x32adf0(0x165)](_0xf39ea5){const _0x599394=a36_0x32adf0,{options:_0x54134e,args:_0x26f085,tdx:_0x510b47}=_0xf39ea5,_0x2e5278=resolveLimit(_0x54134e[_0x599394(0x164)],DEFAULT_DISPLAY_LIMIT),_0x5b456b=_0x26f085[0x0],_0x550794=_0x5b456b?_0x599394(0x155)+_0x5b456b+'\x22...':_0x599394(0x185),_0x1432c3=await withSpinner(_0x550794,()=>_0x510b47['schedules'][_0x599394(0x159)]({'limit':_0x2e5278,'scheduled':!![],'pattern':_0x5b456b}),{'verbose':_0x54134e['verbose']}),_0xd26bb3=_0x1432c3['data'][_0x599394(0x10d)],_0x232e5d=_0x1432c3[_0x599394(0x13e)][_0x599394(0x126)][_0x599394(0x11c)],_0x4897ef=_0x5b456b?_0x599394(0x172)+_0x5b456b+'\x22':'';_0x232e5d?console[_0x599394(0x179)](_0x599394(0x196)+_0xd26bb3[_0x599394(0x162)]+_0x599394(0x14f)+_0x4897ef+_0x599394(0x141)):console['error'](_0x599394(0x177)+_0xd26bb3[_0x599394(0x162)]+_0x599394(0x148)+(_0xd26bb3[_0x599394(0x162)]!==0x1?'ies':'y')+_0x4897ef);if(_0x54134e[_0x599394(0x16a)]===_0x599394(0x174)||_0x54134e['format']===_0x599394(0x12a)||_0x54134e[_0x599394(0x16a)]===_0x599394(0x112)||_0x54134e['format']===_0x599394(0x16e)){const _0x4552d6=_0xd26bb3[_0x599394(0x10f)](_0xed2380=>({'id':_0xed2380['id'],'name':_0xed2380['name'],'cron':_0xed2380[_0x599394(0x110)],'database':_0xed2380[_0x599394(0x133)]?.['name'],'type':_0xed2380[_0x599394(0x17a)],'timezone':_0xed2380[_0x599394(0x123)],'user_name':_0xed2380['user']?.['name'],'updated_at':_0xed2380[_0x599394(0x12c)],'next_run_at':_0xed2380['next_run_at'],'last_job_status':_0xed2380[_0x599394(0x15b)]?.['status']}));await handleSDKOutput(_0x4552d6,_0x54134e);}else{if(_0xd26bb3[_0x599394(0x162)]===0x0)console[_0x599394(0x119)](_0x599394(0x17c));else{const _0x2b74c7=_0x54134e[_0x599394(0x140)],_0x1b5258=_0xd26bb3[_0x599394(0x10f)](_0x23e39b=>{const _0x4d53b9=_0x599394,_0xcea8f4=_0x23e39b['last_job']?.['status']?_0x23e39b[_0x4d53b9(0x15b)][_0x4d53b9(0x12e)]===_0x4d53b9(0x175)?'✓':'✗':'-',_0x535013=_0x23e39b[_0x4d53b9(0x15b)]?.[_0x4d53b9(0x15f)]?formatRelativeTime(_0x23e39b[_0x4d53b9(0x15b)][_0x4d53b9(0x15f)]):_0x4d53b9(0x14a),_0x186e55=_0x23e39b['next_run_at']?formatRelativeTime(_0x23e39b[_0x4d53b9(0x178)]):'-',_0x4b45a1=_0x23e39b[_0x4d53b9(0x110)]||'',_0x1036e2=_0x23e39b['name']||_0x4d53b9(0x18d),_0x17ada9=getConsoleUrl(_0x2b74c7,_0x4d53b9(0x118)+_0x23e39b['id']);return{'statusIcon':_0xcea8f4,'lastRun':_0x535013,'nextRun':_0x186e55,'cron':_0x4b45a1,'name':_0x1036e2,'queryUrl':_0x17ada9,'status':_0x23e39b['last_job']?.[_0x4d53b9(0x12e)]};}),_0x28125d=Math['max'](..._0x1b5258[_0x599394(0x10f)](_0x127e2f=>_0x127e2f['lastRun']['length'])),_0x3d3774=Math[_0x599394(0x17b)](..._0x1b5258[_0x599394(0x10f)](_0x15f1dc=>_0x15f1dc[_0x599394(0x16d)][_0x599394(0x162)])),_0x396286=Math['max'](..._0x1b5258[_0x599394(0x10f)](_0x2620a2=>_0x2620a2['cron'][_0x599394(0x162)])),_0x3f6dcf=_0x1b5258['map'](_0x52c56e=>{const _0x306f4b=_0x599394,_0x159e47=_0x52c56e[_0x306f4b(0x12e)]===_0x306f4b(0x175)?a36_0x134565[_0x306f4b(0x125)](_0x52c56e[_0x306f4b(0x183)]):_0x52c56e[_0x306f4b(0x12e)]===_0x306f4b(0x179)?a36_0x134565[_0x306f4b(0x160)](_0x52c56e[_0x306f4b(0x183)]):a36_0x134565[_0x306f4b(0x113)](_0x52c56e[_0x306f4b(0x183)]),_0x5d830f=_0x52c56e['lastRun'][_0x306f4b(0x180)](_0x28125d),_0x512a26=_0x52c56e[_0x306f4b(0x16d)]['padEnd'](_0x3d3774),_0x335591=_0x52c56e[_0x306f4b(0x110)]?a36_0x134565['cyan'](_0x52c56e[_0x306f4b(0x110)][_0x306f4b(0x180)](_0x396286)):'\x20'[_0x306f4b(0x13a)](_0x396286),_0x32381f=hyperlink(_0x52c56e[_0x306f4b(0x15a)],_0x52c56e[_0x306f4b(0x156)]);return _0x306f4b(0x13b)+_0x159e47+'\x20'+_0x5d830f+_0x306f4b(0x111)+_0x512a26+'\x20\x20'+_0x335591+'\x20\x20'+_0x32381f;});await writeOutput(_0x3f6dcf[_0x599394(0x121)]('\x0a'),_0x54134e[_0x599394(0x18e)],_0x599394(0x169));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x32adf0(0x15a)]=a36_0x32adf0(0x16f);['description']=a36_0x32adf0(0x154);['validate'](_0x58d41e){const _0x59b827=a36_0x32adf0,_0xe160a4=_0x58d41e[_0x59b827(0x129)][0x0];if(!_0xe160a4)return _0x59b827(0x13c);return undefined;}async['execute'](_0x1b1daa){const _0x3c7bfb=a36_0x32adf0,{options:_0x63abda,args:_0x4f3a3f,tdx:_0x17e827}=_0x1b1daa,_0x2fd404=_0x4f3a3f[0x0],_0x2a8408=await withSpinner(_0x3c7bfb(0x18f),()=>_0x17e827[_0x3c7bfb(0x136)][_0x3c7bfb(0x184)](_0x2fd404),{'verbose':_0x63abda[_0x3c7bfb(0x153)]}),_0x12eac0=_0x2a8408['data'],_0x2c7dc9={'name':_0x12eac0[_0x3c7bfb(0x15a)],'cron':_0x12eac0[_0x3c7bfb(0x110)],'database':_0x12eac0[_0x3c7bfb(0x133)],'type':_0x12eac0[_0x3c7bfb(0x17a)],'timezone':_0x12eac0[_0x3c7bfb(0x11d)],'user_name':_0x12eac0[_0x3c7bfb(0x194)],'created_at':_0x12eac0[_0x3c7bfb(0x12d)],'engine_version':_0x12eac0[_0x3c7bfb(0x11f)],'executing_user_id':_0x12eac0[_0x3c7bfb(0x187)],'query':_0x12eac0['query'],'delay':_0x12eac0[_0x3c7bfb(0x150)],'priority':_0x12eac0[_0x3c7bfb(0x13f)],'retry_limit':_0x12eac0[_0x3c7bfb(0x166)],..._0x12eac0[_0x3c7bfb(0x11e)]&&{'result':_0x12eac0[_0x3c7bfb(0x11e)]}};return await handleSingleObjectOutput(_0x2c7dc9,_0x63abda),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x32adf0(0x15a)]=a36_0x32adf0(0x158);[a36_0x32adf0(0x168)]=a36_0x32adf0(0x122);[a36_0x32adf0(0x132)](_0x1c36df){const _0x34782e=a36_0x32adf0,_0x177156=_0x1c36df[_0x34782e(0x129)][0x0];if(!_0x177156)return _0x34782e(0x190);const _0x2d5242=_0x1c36df[_0x34782e(0x17d)];if(!_0x2d5242[_0x34782e(0x133)])return _0x34782e(0x17f);return undefined;}async['execute'](_0x32373b){const _0x4193bb=a36_0x32adf0,{options:_0x5c27ed,args:_0x378f72,tdx:_0x5c2d24}=_0x32373b,_0xed009c=_0x378f72[0x0],_0x1e6c92=_0x5c27ed,_0x9325ba=_0x1e6c92[_0x4193bb(0x133)],_0x431cb5=_0x1e6c92[_0x4193bb(0x157)],_0x4db273=_0x1e6c92[_0x4193bb(0x17a)]||'trino';let _0x4c9fdb;try{_0x4c9fdb=readFileSync(_0x431cb5,_0x4193bb(0x193))[_0x4193bb(0x186)]();}catch(_0x4b9662){throw new SDKError(ErrorCode[_0x4193bb(0x163)],'Failed\x20to\x20read\x20file:\x20'+_0x431cb5,_0x4b9662 instanceof Error?_0x4b9662:undefined);}if(!_0x4c9fdb)throw new SDKError(ErrorCode[_0x4193bb(0x163)],_0x4193bb(0x116));const _0x2a1d7b={'database':_0x9325ba,'query':_0x4c9fdb,'type':_0x4db273};if(_0x1e6c92[_0x4193bb(0x110)])_0x2a1d7b[_0x4193bb(0x110)]=_0x1e6c92[_0x4193bb(0x110)];if(_0x1e6c92['timezone'])_0x2a1d7b[_0x4193bb(0x11d)]=_0x1e6c92['timezone'];if(_0x1e6c92[_0x4193bb(0x150)]!==undefined)_0x2a1d7b['delay']=Number(_0x1e6c92[_0x4193bb(0x150)]);if(_0x1e6c92['priority']!==undefined)_0x2a1d7b[_0x4193bb(0x13f)]=Number(_0x1e6c92[_0x4193bb(0x13f)]);if(_0x1e6c92['retryLimit']!==undefined)_0x2a1d7b[_0x4193bb(0x166)]=Number(_0x1e6c92[_0x4193bb(0x145)]);if(_0x1e6c92['engineVersion'])_0x2a1d7b['engine_version']=_0x1e6c92[_0x4193bb(0x15c)];if(_0x1e6c92['result'])_0x2a1d7b['result']=_0x1e6c92[_0x4193bb(0x11e)];if(_0x5c27ed[_0x4193bb(0x153)]){console['error'](_0x4193bb(0x16c)+_0xed009c),console[_0x4193bb(0x179)](_0x4193bb(0x147)+_0x9325ba),console[_0x4193bb(0x179)](_0x4193bb(0x171)+_0x4db273);if(_0x2a1d7b['cron'])console[_0x4193bb(0x179)](_0x4193bb(0x181)+_0x2a1d7b['cron']);if(_0x2a1d7b['timezone'])console[_0x4193bb(0x179)]('\x20\x20Timezone:\x20'+_0x2a1d7b['timezone']);}const _0x684e5c=await withSpinner(_0x4193bb(0x167),()=>_0x5c2d24['schedules'][_0x4193bb(0x130)](_0xed009c,_0x2a1d7b),{'verbose':_0x5c27ed[_0x4193bb(0x153)]});return console['error']('Schedule\x20created:\x20'+_0x684e5c[_0x4193bb(0x13e)][_0x4193bb(0x15a)]),await handleSingleObjectOutput(_0x684e5c[_0x4193bb(0x13e)],_0x5c27ed),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x32adf0(0x15a)]=a36_0x32adf0(0x17e);[a36_0x32adf0(0x168)]=a36_0x32adf0(0x120);['validate'](_0x3d35f1){const _0x16ccf7=a36_0x32adf0,_0x1a9ef4=_0x3d35f1[_0x16ccf7(0x129)][0x0];if(!_0x1a9ef4)return _0x16ccf7(0x131);return undefined;}async[a36_0x32adf0(0x165)](_0x40ab5d){const _0x50b483=a36_0x32adf0,{options:_0x577b27,args:_0x2bcbde,tdx:_0x3951f2}=_0x40ab5d,_0x1f9545=_0x2bcbde[0x0],_0x2ec507=_0x577b27,_0x356ff3={};if(_0x2ec507[_0x50b483(0x133)])_0x356ff3[_0x50b483(0x133)]=_0x2ec507['database'];if(_0x2ec507['type'])_0x356ff3[_0x50b483(0x17a)]=_0x2ec507[_0x50b483(0x17a)];if(_0x2ec507[_0x50b483(0x110)])_0x356ff3[_0x50b483(0x110)]=_0x2ec507['cron'];if(_0x2ec507[_0x50b483(0x11d)])_0x356ff3[_0x50b483(0x11d)]=_0x2ec507[_0x50b483(0x11d)];if(_0x2ec507[_0x50b483(0x150)]!==undefined)_0x356ff3[_0x50b483(0x150)]=Number(_0x2ec507[_0x50b483(0x150)]);if(_0x2ec507[_0x50b483(0x13f)]!==undefined)_0x356ff3[_0x50b483(0x13f)]=Number(_0x2ec507[_0x50b483(0x13f)]);if(_0x2ec507[_0x50b483(0x145)]!==undefined)_0x356ff3[_0x50b483(0x166)]=Number(_0x2ec507['retryLimit']);if(_0x2ec507[_0x50b483(0x15c)])_0x356ff3['engine_version']=_0x2ec507[_0x50b483(0x15c)];if(_0x2ec507[_0x50b483(0x11e)])_0x356ff3['result']=_0x2ec507[_0x50b483(0x11e)];if(_0x2ec507[_0x50b483(0x157)])try{_0x356ff3['query']=readFileSync(_0x2ec507[_0x50b483(0x157)],'utf-8')['trim']();}catch(_0x29b7b8){throw new SDKError(ErrorCode[_0x50b483(0x163)],'Failed\x20to\x20read\x20file:\x20'+_0x2ec507['file'],_0x29b7b8 instanceof Error?_0x29b7b8:undefined);}if(Object[_0x50b483(0x170)](_0x356ff3)[_0x50b483(0x162)]===0x0)throw new SDKError(ErrorCode[_0x50b483(0x163)],'At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update');if(_0x577b27['verbose']){console['error'](_0x50b483(0x134)+_0x1f9545);for(const [_0x3193aa,_0x41f30f]of Object[_0x50b483(0x14e)](_0x356ff3)){_0x3193aa===_0x50b483(0x18b)?console[_0x50b483(0x179)]('\x20\x20'+_0x3193aa+':\x20'+_0x41f30f[_0x50b483(0x15e)](0x0,0x32)+'...'):console[_0x50b483(0x179)]('\x20\x20'+_0x3193aa+':\x20'+_0x41f30f);}}const _0x38fabc=await withSpinner(_0x50b483(0x18c),()=>_0x3951f2[_0x50b483(0x136)][_0x50b483(0x128)](_0x1f9545,_0x356ff3),{'verbose':_0x577b27[_0x50b483(0x153)]});return console['error']('Schedule\x20updated:\x20'+_0x38fabc['data'][_0x50b483(0x15a)]),await handleSingleObjectOutput(_0x38fabc[_0x50b483(0x13e)],_0x577b27),0x0;}}function a36_0x43b7(_0xba73be,_0x553949){_0xba73be=_0xba73be-0x10a;const _0x3ec2cc=a36_0x3ec2();let _0x43b722=_0x3ec2cc[_0xba73be];return _0x43b722;}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x32adf0(0x15a)]=a36_0x32adf0(0x146);[a36_0x32adf0(0x168)]=a36_0x32adf0(0x191);[a36_0x32adf0(0x132)](_0x713d4c){const _0x4bace=a36_0x32adf0,_0xbe3e96=_0x713d4c[_0x4bace(0x129)][0x0];if(!_0xbe3e96)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async['execute'](_0x2def39){const _0x29a622=a36_0x32adf0,{options:_0x5fdb93,args:_0x532ef3,tdx:_0x112288}=_0x2def39,_0xb0aa38=_0x532ef3[0x0];if(!_0x5fdb93['yes']){const _0x27b58b=await confirm(_0x29a622(0x18a)+_0xb0aa38+'\x22?');if(!_0x27b58b)return console[_0x29a622(0x179)](_0x29a622(0x12b)),0x0;}const _0x11245b=await withSpinner(_0x29a622(0x192),()=>_0x112288[_0x29a622(0x136)][_0x29a622(0x115)](_0xb0aa38),{'verbose':_0x5fdb93[_0x29a622(0x153)]});return console[_0x29a622(0x179)](_0x29a622(0x197)+_0x11245b['data']['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x32adf0(0x15a)]='schedule:run';[a36_0x32adf0(0x168)]=a36_0x32adf0(0x14d);['validate'](_0x451cd1){const _0x4abb4f=a36_0x32adf0,_0xd1976f=_0x451cd1[_0x4abb4f(0x129)][0x0];if(!_0xd1976f)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async['execute'](_0x796fc8){const _0x2fae99=a36_0x32adf0,{options:_0x1fba4d,args:_0x4773bb,tdx:_0x391af7}=_0x796fc8,_0x246a82=_0x4773bb[0x0],_0x5892c8=_0x1fba4d,_0x5cd840=_0x5892c8['time'],_0x124ca6=_0x5892c8['num']!==undefined?Number(_0x5892c8[_0x2fae99(0x13d)]):undefined;if(_0x1fba4d[_0x2fae99(0x153)]){console[_0x2fae99(0x179)]('Running\x20schedule:\x20'+_0x246a82);if(_0x5cd840)console[_0x2fae99(0x179)](_0x2fae99(0x14c)+_0x5cd840);if(_0x124ca6)console['error']('\x20\x20Num:\x20'+_0x124ca6);}const _0x4b3f60=await withSpinner(_0x2fae99(0x189),()=>_0x391af7[_0x2fae99(0x136)]['run'](_0x246a82,{'time':_0x5cd840,'num':_0x124ca6}),{'verbose':_0x1fba4d['verbose']}),_0x1f167a=_0x4b3f60[_0x2fae99(0x13e)]['jobs'];console['error'](_0x2fae99(0x188)+_0x1f167a[_0x2fae99(0x162)]+'\x20job'+(_0x1f167a['length']!==0x1?'s':'')+_0x2fae99(0x138));for(const _0x2644a9 of _0x1f167a){console['error'](_0x2fae99(0x161)+_0x2644a9[_0x2fae99(0x10b)]);}return await handleSDKOutput(_0x1f167a,_0x1fba4d),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{['name']='schedule:history';[a36_0x32adf0(0x168)]='Show\x20schedule\x20execution\x20history';[a36_0x32adf0(0x132)](_0x5f2319){const _0x1cf919=a36_0x32adf0,_0xe3de30=_0x5f2319[_0x1cf919(0x129)][0x0];if(!_0xe3de30)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async[a36_0x32adf0(0x165)](_0x215487){const _0x3675a1=a36_0x32adf0,{options:_0x158fbc,args:_0x2b7270,tdx:_0x1643a8}=_0x215487,_0x548d9b=_0x2b7270[0x0],_0x4f1959=_0x158fbc,_0xca32c0=_0x4f1959[_0x3675a1(0x127)]!==undefined?Number(_0x4f1959[_0x3675a1(0x127)]):undefined,_0x3c3124=_0x4f1959['to']!==undefined?Number(_0x4f1959['to']):undefined,_0x245dd9=await withSpinner(_0x3675a1(0x173),()=>_0x1643a8['schedules'][_0x3675a1(0x117)](_0x548d9b,{'from':_0xca32c0,'to':_0x3c3124}),{'verbose':_0x158fbc[_0x3675a1(0x153)]}),_0x19e807=_0x245dd9['data'];console[_0x3675a1(0x179)]('Found\x20'+_0x19e807[_0x3675a1(0x137)]+_0x3675a1(0x195)+(_0x19e807[_0x3675a1(0x137)]!==0x1?'s':'')+_0x3675a1(0x176)+_0x19e807[_0x3675a1(0x127)]+'-'+_0x19e807['to']+')');const _0x4f3b3b=_0x19e807['history']['map'](_0x1858e2=>({'job_id':_0x1858e2[_0x3675a1(0x10b)],'type':_0x1858e2[_0x3675a1(0x17a)],'status':_0x1858e2[_0x3675a1(0x12e)],'scheduled_at':_0x1858e2[_0x3675a1(0x14b)],'created_at':_0x1858e2[_0x3675a1(0x12d)],'start_at':_0x1858e2[_0x3675a1(0x12f)],'end_at':_0x1858e2[_0x3675a1(0x124)]}));return await handleSDKOutput(_0x4f3b3b,_0x158fbc),0x0;}}
@@ -1 +1 @@
1
- const a37_0x5511b7=a37_0x1f14;(function(_0x25f8e8,_0x1d0a02){const _0x398a3c=a37_0x1f14,_0x5cda92=_0x25f8e8();while(!![]){try{const _0x8f65d=-parseInt(_0x398a3c(0x16f))/0x1*(parseInt(_0x398a3c(0x13c))/0x2)+-parseInt(_0x398a3c(0x18c))/0x3+-parseInt(_0x398a3c(0x15e))/0x4*(parseInt(_0x398a3c(0x14d))/0x5)+-parseInt(_0x398a3c(0x149))/0x6+parseInt(_0x398a3c(0x16b))/0x7+-parseInt(_0x398a3c(0x11d))/0x8*(-parseInt(_0x398a3c(0xfe))/0x9)+parseInt(_0x398a3c(0x12a))/0xa;if(_0x8f65d===_0x1d0a02)break;else _0x5cda92['push'](_0x5cda92['shift']());}catch(_0xf2cbf){_0x5cda92['push'](_0x5cda92['shift']());}}}(a37_0x1c4a,0xb3d28));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a37_0x1f14(_0x4e524b,_0x3e6117){_0x4e524b=_0x4e524b-0xef;const _0x1c4ae7=a37_0x1c4a();let _0x1f1469=_0x1c4ae7[_0x4e524b];return _0x1f1469;}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_0x16279d from'chalk';async function resolveSegmentTarget(_0x35e44a,_0x2280ee,_0x596286){const _0x28024b=a37_0x1f14;if(isYamlFilePath(_0x35e44a))try{const _0x3094d7=await resolveYamlFilePath(_0x35e44a);return _0x596286&&(console[_0x28024b(0x189)](_0x28024b(0x198)+_0x35e44a),console['error'](_0x28024b(0x18f)+_0x3094d7[_0x28024b(0x178)]),console['error'](_0x28024b(0x154)+_0x3094d7['segmentName']),console[_0x28024b(0x189)]('\x20\x20Folder\x20path:\x20'+(_0x3094d7[_0x28024b(0xfa)]||_0x28024b(0x13f))),console[_0x28024b(0x189)](_0x28024b(0x155)+_0x3094d7['fullPath'])),_0x3094d7['fullPath'];}catch(_0x4d47ca){throw new SDKError(ErrorCode[_0x28024b(0x162)],_0x28024b(0x190)+_0x4d47ca[_0x28024b(0x101)]);}if(!_0x2280ee)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x28024b(0x174));return _0x2280ee+'/'+_0x35e44a;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x5511b7(0x195)]=a37_0x5511b7(0x194);['description']=a37_0x5511b7(0xff);async[a37_0x5511b7(0x144)](_0x44124e){const _0xc0ce05=a37_0x5511b7,{options:_0x49dc38,args:_0x1a0551,tdx:_0x24917b}=_0x44124e,_0xe93f9c=_0x1a0551[0x0],_0x2df745=!_0xe93f9c&&!!_0x49dc38['parentSegment'],_0x4f74bf=_0xe93f9c||_0x49dc38['parentSegment'];if(!_0x4f74bf)return console[_0xc0ce05(0x189)](_0xc0ce05(0x165)),console[_0xc0ce05(0x189)](_0xc0ce05(0xf5)),console[_0xc0ce05(0x189)](_0xc0ce05(0x197)),console[_0xc0ce05(0x189)](_0xc0ce05(0x132)),console[_0xc0ce05(0x189)](_0xc0ce05(0x151)),console[_0xc0ce05(0x189)](_0xc0ce05(0x10e)),console[_0xc0ce05(0x189)](_0xc0ce05(0x116)),0x1;try{const _0x31e933=_0x49dc38[_0xc0ce05(0x18a)];let _0x4315fd=_0x4f74bf;!_0x2df745&&_0x31e933&&!_0x4f74bf['includes']('/')&&(_0x4315fd=_0x31e933+'/'+_0x4f74bf,_0x49dc38[_0xc0ce05(0x126)]&&console['error'](_0xc0ce05(0x17d)+_0x4315fd));const _0x1fb29f=await withSpinner(_0xc0ce05(0x164)+_0x4315fd+_0xc0ce05(0x10f),()=>_0x24917b[_0xc0ce05(0x160)][_0xc0ce05(0x159)](_0x4315fd),{'verbose':_0x49dc38[_0xc0ce05(0x126)]}),_0x52c8a5=_0x1fb29f[_0xc0ce05(0x127)];_0x49dc38[_0xc0ce05(0x126)]&&(console[_0xc0ce05(0x189)](_0xc0ce05(0x110)+_0x52c8a5[_0xc0ce05(0x181)]),console[_0xc0ce05(0x189)](_0xc0ce05(0x15f)+_0x52c8a5['parentId']),_0x52c8a5[_0xc0ce05(0x120)]&&console[_0xc0ce05(0x189)]('Folder\x20ID:\x20'+_0x52c8a5['folderId']),_0x52c8a5[_0xc0ce05(0x130)]&&console[_0xc0ce05(0x189)](_0xc0ce05(0x140)+_0x52c8a5[_0xc0ce05(0x130)]));if(_0x52c8a5[_0xc0ce05(0x181)]==='parent'){const _0x3743e1=await withSpinner(_0xc0ce05(0x12c),()=>_0x24917b[_0xc0ce05(0x160)][_0xc0ce05(0x17b)](_0x52c8a5[_0xc0ce05(0x199)]),{'verbose':_0x49dc38[_0xc0ce05(0x126)]});await handleSingleObjectOutput(_0x3743e1['data'],_0x49dc38);}else{if(_0x52c8a5[_0xc0ce05(0x181)]===_0xc0ce05(0x11a)){if(!_0x52c8a5[_0xc0ce05(0x120)])throw new SDKError(ErrorCode[_0xc0ce05(0x176)],_0xc0ce05(0x125));const _0x37e80c=await withSpinner(_0xc0ce05(0x108),()=>_0x24917b[_0xc0ce05(0x160)][_0xc0ce05(0x161)](_0x52c8a5[_0xc0ce05(0x120)]),{'verbose':_0x49dc38[_0xc0ce05(0x126)]});await handleSingleObjectOutput(_0x37e80c[_0xc0ce05(0x127)],_0x49dc38);}else{if(_0x52c8a5[_0xc0ce05(0x181)]===_0xc0ce05(0x160)){if(!_0x52c8a5['segmentId'])throw new SDKError(ErrorCode[_0xc0ce05(0x153)],_0xc0ce05(0x156));const _0x34e067=await withSpinner('Fetching\x20segment\x20details...',()=>_0x24917b[_0xc0ce05(0x160)][_0xc0ce05(0x14b)](_0x52c8a5['parentId'],_0x52c8a5[_0xc0ce05(0x130)]),{'verbose':_0x49dc38[_0xc0ce05(0x126)]});await handleSingleObjectOutput(_0x34e067[_0xc0ce05(0x127)],_0x49dc38);}}}return 0x0;}catch(_0x575c46){if(_0x575c46 instanceof SDKError)return console[_0xc0ce05(0x189)](_0xc0ce05(0x10a)+_0x575c46[_0xc0ce05(0x101)]),_0x575c46[_0xc0ce05(0x180)]&&console[_0xc0ce05(0x189)](_0xc0ce05(0x179)+_0x575c46['cause']),0x1;throw _0x575c46;}}}export class SegmentShowCommand extends BaseCommand{['name']=a37_0x5511b7(0x18e);[a37_0x5511b7(0x13a)]=a37_0x5511b7(0x170);async[a37_0x5511b7(0x144)](_0x58ebad){const _0x14124a=a37_0x5511b7,{options:_0x137fe4,args:_0x38611f,tdx:_0x359b44}=_0x58ebad,_0x585d6f=_0x38611f[0x0];if(!_0x585d6f)return console[_0x14124a(0x189)](_0x14124a(0x163)),console['error']('Usage:\x20tdx\x20sg\x20show\x20<name>'),console[_0x14124a(0x189)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x14124a(0x189)](_0x14124a(0x197)),console[_0x14124a(0x189)](_0x14124a(0x191)),console['error'](_0x14124a(0x111)),0x1;try{const _0x201d8c=_0x137fe4['parentSegment'],_0x2bb598=await resolveSegmentTarget(_0x585d6f,_0x201d8c,_0x137fe4[_0x14124a(0x126)]);_0x137fe4[_0x14124a(0x126)]&&console['error']('Target\x20path:\x20'+_0x2bb598);const _0x438376=await withSpinner('Resolving\x20\x27'+_0x585d6f+'\x27...',()=>_0x359b44['segment'][_0x14124a(0x159)](_0x2bb598),{'verbose':_0x137fe4[_0x14124a(0x126)]}),_0x5438a7=_0x438376[_0x14124a(0x127)];_0x137fe4[_0x14124a(0x126)]&&(console[_0x14124a(0x189)](_0x14124a(0x110)+_0x5438a7[_0x14124a(0x181)]),console[_0x14124a(0x189)]('Parent\x20ID:\x20'+_0x5438a7[_0x14124a(0x199)]));if(_0x5438a7[_0x14124a(0x181)]===_0x14124a(0x11a))return console[_0x14124a(0x189)](_0x14124a(0x112)),console[_0x14124a(0x189)](_0x14124a(0x187)),0x1;if(_0x5438a7['type']===_0x14124a(0x16e))return console[_0x14124a(0x189)](_0x14124a(0x150)),console[_0x14124a(0x189)](_0x14124a(0x157)),0x1;if(!_0x5438a7[_0x14124a(0x130)])throw new SDKError(ErrorCode[_0x14124a(0x153)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x24a30d=await withSpinner(_0x14124a(0xef),()=>_0x359b44[_0x14124a(0x160)][_0x14124a(0x158)](_0x5438a7[_0x14124a(0x199)],_0x5438a7['segmentId']),{'verbose':_0x137fe4[_0x14124a(0x126)]});let _0x497206=_0x24a30d[_0x14124a(0x127)];const _0x14c744=resolveLimit(_0x137fe4[_0x14124a(0x148)],DEFAULT_DISPLAY_LIMIT),_0x258fa2=/\bLIMIT\s+\d+/i[_0x14124a(0x133)](_0x497206);!_0x258fa2&&(_0x497206=_0x497206[_0x14124a(0x12e)]()['replace'](/;+$/,''),_0x497206=_0x14124a(0x118)+_0x497206+_0x14124a(0x124)+_0x14c744);_0x137fe4['verbose']&&console[_0x14124a(0x189)](_0x14124a(0x19a)+_0x497206);const _0x269b4d=await withProgressSpinner(_0x14124a(0x15b),async _0x4cef9b=>{const _0x2ca00e=_0x14124a,_0xaeff3f=await _0x359b44[_0x2ca00e(0xf7)][_0x2ca00e(0x144)](_0x497206,{'catalog':'td','schema':_0x2ca00e(0x11b),'onJobId':_0x4ebecb=>{_0x4cef9b['setJobId'](_0x4ebecb);}});return _0xaeff3f;},{'verbose':_0x137fe4[_0x14124a(0x126)]}),_0xeee44b=_0x269b4d[_0x14124a(0x127)],_0x29aa8e=_0xeee44b['jobId']?_0x14124a(0x10b)+_0xeee44b[_0x14124a(0x186)]+']':'';return console[_0x14124a(0x189)](_0x14124a(0x139)+_0xeee44b['stats'][_0x14124a(0x16a)][_0x14124a(0x19b)]()+_0x14124a(0x169)+(_0x14124a(0x109)+formatElapsed(_0xeee44b[_0x14124a(0x171)][_0x14124a(0x17a)])+_0x29aa8e)),await handleQueryOutput(_0xeee44b,_0x137fe4),0x0;}catch(_0x4d6dd5){if(_0x4d6dd5 instanceof SDKError)return console[_0x14124a(0x189)](_0x14124a(0x107)+_0x4d6dd5['code']+']'),console[_0x14124a(0x189)]('\x0a'+_0x4d6dd5[_0x14124a(0x101)]),0x1;throw _0x4d6dd5;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x5511b7(0x195)]=a37_0x5511b7(0x196);[a37_0x5511b7(0x13a)]=a37_0x5511b7(0x15d);async[a37_0x5511b7(0x144)](_0x45efe7){const _0x16af74=a37_0x5511b7,{options:_0x430c42,args:_0x191510,tdx:_0x1f3180}=_0x45efe7;if(_0x191510[_0x16af74(0x102)]===0x0)return console['error'](_0x16af74(0x152)),console[_0x16af74(0x189)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x2f33fc=_0x191510[0x0];try{_0x430c42['verbose']&&(console[_0x16af74(0x189)]('Site:\x20'+_0x430c42[_0x16af74(0x192)]),console['error'](_0x16af74(0x113)+_0x2f33fc));const _0x59d6b5=await withSpinner(_0x16af74(0x10c)+_0x2f33fc+_0x16af74(0x10f),()=>_0x1f3180[_0x16af74(0x160)][_0x16af74(0x142)](_0x2f33fc),{'verbose':_0x430c42[_0x16af74(0x126)]}),_0x52ed48=_0x59d6b5[_0x16af74(0x127)];_0x430c42['verbose']&&console[_0x16af74(0x189)](_0x16af74(0x172)+_0x52ed48);const _0x43447e=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x2f33fc+_0x16af74(0x10f),()=>_0x1f3180[_0x16af74(0x160)]['listFolders'](_0x52ed48),{'verbose':_0x430c42[_0x16af74(0x126)]}),_0x40ba70=_0x43447e[_0x16af74(0x127)];return console[_0x16af74(0x189)]('✔\x20Found\x20'+_0x40ba70[_0x16af74(0x102)]+_0x16af74(0xfc)+(_0x40ba70[_0x16af74(0x102)]!==0x1?'s':'')),await handleSDKOutput(_0x40ba70,_0x430c42),0x0;}catch(_0x3f05b7){if(_0x3f05b7 instanceof SDKError)return console[_0x16af74(0x189)](_0x16af74(0x10a)+_0x3f05b7[_0x16af74(0x101)]),_0x3f05b7[_0x16af74(0x180)]&&console[_0x16af74(0x189)](_0x16af74(0x179)+_0x3f05b7['cause']),0x1;throw _0x3f05b7;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a37_0x5511b7(0x17e);[a37_0x5511b7(0x13a)]=a37_0x5511b7(0xf9);async[a37_0x5511b7(0x144)](_0x478893){const _0x266ac1=a37_0x5511b7,{options:_0x4750f5,args:_0x3cfcab,tdx:_0x3aa7af}=_0x478893;if(_0x3cfcab['length']===0x0)return console[_0x266ac1(0x189)]('Error:\x20Folder\x20reference\x20is\x20required'),console[_0x266ac1(0x189)](_0x266ac1(0x173)),0x1;try{const {parentId:_0x19ab54,childId:_0x18ef94}=parseSegmentRef(_0x3cfcab[0x0]);_0x4750f5[_0x266ac1(0x126)]&&(console[_0x266ac1(0x189)](_0x266ac1(0x15c)+_0x4750f5[_0x266ac1(0x192)]),console[_0x266ac1(0x189)](_0x266ac1(0x113)+_0x19ab54),_0x18ef94&&console[_0x266ac1(0x189)]('Folder\x20name:\x20'+_0x18ef94));if(!_0x18ef94)return console['error'](_0x266ac1(0x12f)),0x1;const _0x242a32=await withSpinner(_0x266ac1(0x10c)+_0x19ab54+'\x27...',()=>_0x3aa7af['segment']['resolveParentId'](_0x19ab54),{'verbose':_0x4750f5[_0x266ac1(0x126)]}),_0x892904=_0x242a32['data'];_0x4750f5[_0x266ac1(0x126)]&&console[_0x266ac1(0x189)](_0x266ac1(0x172)+_0x892904);const _0x5793de=await withSpinner(_0x266ac1(0x123)+_0x18ef94+_0x266ac1(0x10f),()=>_0x3aa7af[_0x266ac1(0x160)][_0x266ac1(0xfd)](_0x892904,_0x18ef94),{'verbose':_0x4750f5[_0x266ac1(0x126)]}),_0x8d1f23=_0x5793de[_0x266ac1(0x127)];_0x4750f5[_0x266ac1(0x126)]&&console[_0x266ac1(0x189)]('Resolved\x20folder\x20ID:\x20'+_0x8d1f23);const _0x7b9f7e=await withSpinner(_0x266ac1(0x17f)+_0x18ef94+_0x266ac1(0x10f),()=>_0x3aa7af[_0x266ac1(0x160)]['getFolder'](_0x8d1f23),{'verbose':_0x4750f5[_0x266ac1(0x126)]});return await handleSDKOutput([_0x7b9f7e[_0x266ac1(0x127)]],_0x4750f5),0x0;}catch(_0x299ccc){if(_0x299ccc instanceof SDKError)return console['error'](_0x266ac1(0x10a)+_0x299ccc[_0x266ac1(0x101)]),_0x299ccc[_0x266ac1(0x180)]&&console[_0x266ac1(0x189)](_0x266ac1(0x179)+_0x299ccc[_0x266ac1(0x180)]),0x1;throw _0x299ccc;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a37_0x5511b7(0x167);[a37_0x5511b7(0x13a)]=a37_0x5511b7(0x136);async[a37_0x5511b7(0x144)](_0x4dbb35){const _0x3a7d66=a37_0x5511b7,{options:_0x1de537,args:_0x209590}=_0x4dbb35,_0x30fc5e=_0x1de537,_0x199813=_0x30fc5e[_0x3a7d66(0x18b)],_0x1104f4=_0x209590[0x0];if(!_0x1104f4&&!_0x199813)return console[_0x3a7d66(0x189)](a37_0x16279d[_0x3a7d66(0x147)](_0x3a7d66(0x103))),console[_0x3a7d66(0x189)]('Usage:'),console[_0x3a7d66(0x189)]('\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>'),console[_0x3a7d66(0x189)](_0x3a7d66(0x193)),console[_0x3a7d66(0x189)](_0x3a7d66(0x197)),console['error'](_0x3a7d66(0x16c)),console['error'](_0x3a7d66(0x182)),0x1;if(_0x1104f4&&_0x199813)return console[_0x3a7d66(0x189)](a37_0x16279d[_0x3a7d66(0x147)]('Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both')),0x1;try{let _0x1780f9;if(_0x199813)_0x1780f9=await this[_0x3a7d66(0x14f)](_0x199813,_0x4dbb35);else{if(isYamlFilePath(_0x1104f4))return console[_0x3a7d66(0x189)](a37_0x16279d[_0x3a7d66(0x147)](_0x3a7d66(0x175))),console[_0x3a7d66(0x189)](_0x3a7d66(0x13e)+_0x1104f4),0x1;else _0x1780f9=await this[_0x3a7d66(0x12d)](_0x1104f4,_0x4dbb35);}return _0x1de537['format']===_0x3a7d66(0x184)||_0x1de537[_0x3a7d66(0x185)]===_0x3a7d66(0x166)?await handleSDKOutput([{'sql':_0x1780f9}],_0x1de537):console['log'](_0x1780f9),0x0;}catch(_0x2507be){if(_0x2507be instanceof SDKError)return console[_0x3a7d66(0x189)](_0x3a7d66(0x10a)+_0x2507be[_0x3a7d66(0x101)]),_0x2507be[_0x3a7d66(0x180)]&&console['error']('\x20\x20Cause:\x20'+_0x2507be[_0x3a7d66(0x180)]),0x1;throw _0x2507be;}}async[a37_0x5511b7(0x14f)](_0x1d91ad,_0x2f92c4){const _0x1138bd=a37_0x5511b7,{options:_0x487c23,tdx:_0x4700a8}=_0x2f92c4;let _0x539ab9;try{_0x539ab9=await resolveYamlFilePath(_0x1d91ad);}catch(_0x29e634){throw new SDKError(ErrorCode[_0x1138bd(0x162)],_0x1138bd(0x190)+_0x29e634[_0x1138bd(0x101)]);}_0x487c23[_0x1138bd(0x126)]&&console[_0x1138bd(0x189)]('Resolved:\x20'+_0x539ab9['parentSegment']+'/'+_0x539ab9['segmentName']);const _0x2bdaf2=await withSpinner(_0x1138bd(0x188),()=>_0x4700a8[_0x1138bd(0x160)][_0x1138bd(0x16d)](_0x539ab9[_0x1138bd(0x11e)],_0x539ab9[_0x1138bd(0x178)],_0x539ab9[_0x1138bd(0x138)]),{'verbose':_0x487c23[_0x1138bd(0x126)]});return _0x2bdaf2[_0x1138bd(0x127)];}async['getSQLFromServerSegment'](_0x19aded,_0x296198){const _0x1525e0=a37_0x5511b7,{options:_0x2de502,tdx:_0x1bb108}=_0x296198,_0x16b241=_0x2de502[_0x1525e0(0x178)],_0xf63fcb=await resolveSegmentTarget(_0x19aded,_0x16b241,_0x2de502['verbose']);_0x2de502[_0x1525e0(0x126)]&&console[_0x1525e0(0x189)](_0x1525e0(0x11f)+_0xf63fcb);const _0x265b85=await withSpinner(_0x1525e0(0x141)+_0x19aded+_0x1525e0(0x10f),()=>_0x1bb108['segment'][_0x1525e0(0x159)](_0xf63fcb),{'verbose':_0x2de502['verbose']}),_0x57ef17=_0x265b85[_0x1525e0(0x127)];_0x2de502['verbose']&&(console[_0x1525e0(0x189)]('Resolved\x20type:\x20'+_0x57ef17[_0x1525e0(0x181)]),console['error'](_0x1525e0(0x15f)+_0x57ef17['parentId']));if(_0x57ef17[_0x1525e0(0x181)]===_0x1525e0(0x11a))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.');if(_0x57ef17['type']===_0x1525e0(0x16e))throw new SDKError(ErrorCode[_0x1525e0(0x162)],_0x1525e0(0x177));if(!_0x57ef17[_0x1525e0(0x130)])throw new SDKError(ErrorCode[_0x1525e0(0x153)],_0x1525e0(0x156));const _0x5aad9b=await withSpinner(_0x1525e0(0xef),()=>_0x1bb108[_0x1525e0(0x160)][_0x1525e0(0x158)](_0x57ef17[_0x1525e0(0x199)],_0x57ef17[_0x1525e0(0x130)]),{'verbose':_0x2de502[_0x1525e0(0x126)]});return _0x5aad9b[_0x1525e0(0x127)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x5511b7(0x195)]=a37_0x5511b7(0x114);[a37_0x5511b7(0x13a)]=a37_0x5511b7(0x13b);async[a37_0x5511b7(0x144)](_0x2c2b20){const _0x1b9aeb=a37_0x5511b7,{options:_0x4b2432,args:_0x2f0de9,tdx:_0xd93dfc}=_0x2c2b20,_0x1eb3f6=_0x4b2432;if(_0x2f0de9[_0x1b9aeb(0x102)]<0x2)return console[_0x1b9aeb(0x189)](_0x1b9aeb(0xf8)),console[_0x1b9aeb(0x189)](_0x1b9aeb(0x14a)),0x1;const _0x2746f6=_0x2f0de9[0x0],_0x23435a=_0x2f0de9[0x1];_0x1eb3f6[_0x1b9aeb(0x126)]&&(console[_0x1b9aeb(0x189)](_0x1b9aeb(0x15c)+_0x1eb3f6[_0x1b9aeb(0x192)]),console['error']('Parent\x20segment:\x20'+_0x2746f6),console['error'](_0x1b9aeb(0x117)+_0x23435a));let _0xb1c65c;if(_0x1eb3f6['parentFolder']){const _0x441d74=_0x1eb3f6[_0x1b9aeb(0x17c)],_0xb52385=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2746f6+_0x1b9aeb(0x10f),()=>_0xd93dfc[_0x1b9aeb(0x160)]['resolveParentId'](_0x2746f6),{'verbose':_0x1eb3f6['verbose']}),_0x2b2bd6=_0xb52385[_0x1b9aeb(0x127)],_0x3ea5f2=await withSpinner(_0x1b9aeb(0x183)+_0x441d74+_0x1b9aeb(0x10f),()=>_0xd93dfc[_0x1b9aeb(0x160)][_0x1b9aeb(0xfd)](_0x2b2bd6,_0x441d74),{'verbose':_0x1eb3f6[_0x1b9aeb(0x126)]});_0xb1c65c=_0x3ea5f2['data'],_0x1eb3f6[_0x1b9aeb(0x126)]&&console[_0x1b9aeb(0x189)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0xb1c65c);}const _0x341d50={'name':_0x23435a,'description':_0x1eb3f6['description'],'parentFolderId':_0xb1c65c},_0x5c2b7e=await withSpinner(_0x1b9aeb(0x14c)+_0x23435a+'\x27...',()=>_0xd93dfc[_0x1b9aeb(0x160)][_0x1b9aeb(0xf2)](_0x2746f6,_0x341d50),{'verbose':_0x1eb3f6[_0x1b9aeb(0x126)]}),_0x1f100d=_0x5c2b7e[_0x1b9aeb(0x127)];return console[_0x1b9aeb(0x189)](_0x1b9aeb(0xf0)+_0x1f100d['name']+_0x1b9aeb(0x131)+_0x1f100d['id']),await handleSDKOutput([_0x1f100d],_0x1eb3f6),0x0;}}function a37_0x1c4a(){const _0x172c49=['type','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','Resolving\x20parent\x20folder\x20\x27','json','format','jobId','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Fetching\x20SQL\x20from\x20rule...','error','segmentPath','path','394239OaZbqF','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','segment:show','\x20\x20Parent\x20segment:\x20','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','site','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','segment:describe','name','segment:folder:list','Examples:','Resolved\x20YAML\x20file:\x20','parentId','SQL\x20query:\x0a','toLocaleString','Fetching\x20SQL\x20for\x20segment...','✔\x20Created\x20folder\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','createFolder','\x20Opening\x20','Use:\x20tdx\x20ps\x20view\x20-w','Usage:\x20tdx\x20segment\x20describe\x20<path>','Fetching\x20segment\x20details...','query','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Show\x20segment\x20folder\x20details','folderPath','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','\x20folder','resolveFolderId','847080nWGgQZ','Show\x20segment\x20or\x20folder\x20details','/app/ps/','message','length','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','/e/','Use:\x20tdx\x20ps\x20desc','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','✖\x20Query\x20failed\x20[','Fetching\x20folder\x20details...','in\x20','Error:\x20','\x20[Job\x20ID:\x20','Resolving\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','\x27...','Resolved\x20type:\x20','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Parent\x20name:\x20','segment:folder:create','Usage:\x20tdx\x20sg\x20desc\x20<name>','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Folder\x20name:\x20','SELECT\x20*\x20FROM\x20(\x0a','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','folder','information_schema','green','64UVbLvn','content','Target\x20path:\x20','folderId','Options:','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Resolving\x20folder\x20\x27','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Folder\x20ID\x20missing\x20from\x20resolved\x20path','verbose','data','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','cyan','9068890nTsaMN','segment:desc','Fetching\x20parent\x20segment\x20details...','getSQLFromServerSegment','trim','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','segmentId','\x27\x20with\x20ID:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','test','Use:\x20tdx\x20ps\x20view','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Get\x20SQL\x20query\x20for\x20child\x20segment','url','segmentName','✔\x20Query\x20completed:\x20Processed\x20','description','Create\x20segment\x20folder\x20for\x20organization','1165186JIYfbS','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','\x20\x20tdx\x20sg\x20sql\x20--path\x20','(root)','Segment\x20ID:\x20','Resolving\x20\x27','resolveParentId','Show\x20folder\x20or\x20child\x20segment\x20details','execute','segment:view','web','red','limit','900024YAUgXe','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','getSegment','Creating\x20folder\x20\x27','5lCAeRn','Folder\x20ID:\x20','getSQLFromYamlFile','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Error:\x20Parent\x20segment\x20name\x20is\x20required','SEGMENT_NOT_FOUND','\x20\x20Segment\x20name:\x20','\x20\x20Full\x20path:\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Use:\x20tdx\x20ps\x20show','getSegmentSQL','resolvePathToResource','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Executing\x20segment\x20query...','Site:\x20','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','210516Rtsdwy','Parent\x20ID:\x20','segment','getFolder','INVALID_ARGUMENT','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Resolving\x20path\x20\x27','Error:\x20Path\x20or\x20name\x20is\x20required','jsonl','segment:sql','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','\x20rows\x20','processedRows','4031545iPjxPR','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','getSegmentSQLFromYaml','parent','2UqlXme','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','stats','Resolved\x20parent\x20ID:\x20','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','SEGMENT_FOLDER_NOT_FOUND','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','parentSegment','\x20\x20Cause:\x20','elapsedTimeMillis','getParent','parentFolder','Resolved\x20relative\x20path\x20to:\x20','segment:folder:show','Fetching\x20folder\x20\x27','cause'];a37_0x1c4a=function(){return _0x172c49;};return a37_0x1c4a();}export class SegmentViewCommand extends BaseCommand{['name']=a37_0x5511b7(0x145);['description']=a37_0x5511b7(0x143);async[a37_0x5511b7(0x144)](_0x30e0f4){const _0x4323b4=a37_0x5511b7,{options:_0x1e4771,args:_0x335471,tdx:_0x5142ef}=_0x30e0f4,_0x1df446=_0x335471[0x0];if(!_0x1df446)return console[_0x4323b4(0x189)](_0x4323b4(0x15a)),console['error'](_0x4323b4(0x10d)),console[_0x4323b4(0x189)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console[_0x4323b4(0x189)](_0x4323b4(0x121)),console['error'](_0x4323b4(0x128)),console['error'](_0x4323b4(0x197)),console[_0x4323b4(0x189)](_0x4323b4(0x119)),console[_0x4323b4(0x189)](_0x4323b4(0x135)),console[_0x4323b4(0x189)](_0x4323b4(0x106)),console[_0x4323b4(0x189)](_0x4323b4(0xfb)),0x1;try{const _0x57251b=_0x1e4771[_0x4323b4(0x178)],_0x1e5ade=await resolveSegmentTarget(_0x1df446,_0x57251b,_0x1e4771[_0x4323b4(0x126)]);_0x1e4771[_0x4323b4(0x126)]&&console[_0x4323b4(0x189)]('Target\x20path:\x20'+_0x1e5ade);const _0x271aca=await withSpinner('Resolving\x20\x27'+_0x1df446+_0x4323b4(0x10f),()=>_0x5142ef[_0x4323b4(0x160)][_0x4323b4(0x159)](_0x1e5ade),{'verbose':_0x1e4771[_0x4323b4(0x126)]}),_0x330494=_0x271aca[_0x4323b4(0x127)];_0x1e4771[_0x4323b4(0x126)]&&(console[_0x4323b4(0x189)](_0x4323b4(0x110)+_0x330494['type']),console[_0x4323b4(0x189)](_0x4323b4(0x15f)+_0x330494['parentId']),_0x330494[_0x4323b4(0x120)]&&console[_0x4323b4(0x189)](_0x4323b4(0x14e)+_0x330494['folderId']),_0x330494[_0x4323b4(0x130)]&&console[_0x4323b4(0x189)](_0x4323b4(0x140)+_0x330494['segmentId']));if(_0x1e4771[_0x4323b4(0x146)]){if(_0x330494[_0x4323b4(0x181)]===_0x4323b4(0x11a))return console['error'](_0x4323b4(0x168)),0x1;if(_0x330494[_0x4323b4(0x181)]==='parent')return console[_0x4323b4(0x189)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x4323b4(0x189)](_0x4323b4(0xf4)),0x1;if(!_0x330494['segmentId'])throw new SDKError(ErrorCode[_0x4323b4(0x153)],_0x4323b4(0x156));const _0x851bbb=getConsoleNextUrl(_0x1e4771['site'],_0x4323b4(0x100)+_0x330494['parentId']+'/e/'+_0x330494['segmentId']);return console[_0x4323b4(0x189)](a37_0x16279d[_0x4323b4(0x11c)]('✔')+_0x4323b4(0xf3)+a37_0x16279d[_0x4323b4(0x129)](_0x851bbb)),openBrowser(_0x851bbb),0x0;}if(_0x330494[_0x4323b4(0x181)]===_0x4323b4(0x11a)){if(!_0x330494['folderId'])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x139267=await withSpinner(_0x4323b4(0x108),()=>_0x5142ef[_0x4323b4(0x160)]['getFolder'](_0x330494['folderId']),{'verbose':_0x1e4771[_0x4323b4(0x126)]});await handleSingleObjectOutput(_0x139267['data'],_0x1e4771);}else{if(_0x330494[_0x4323b4(0x181)]===_0x4323b4(0x160)){if(!_0x330494['segmentId'])throw new SDKError(ErrorCode[_0x4323b4(0x153)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x5726fa=await withSpinner(_0x4323b4(0xf6),()=>_0x5142ef[_0x4323b4(0x160)][_0x4323b4(0x14b)](_0x330494[_0x4323b4(0x199)],_0x330494['segmentId']),{'verbose':_0x1e4771[_0x4323b4(0x126)]}),_0x3dc3ce=getConsoleNextUrl(_0x1e4771[_0x4323b4(0x192)],_0x4323b4(0x100)+_0x330494['parentId']+_0x4323b4(0x104)+_0x330494['segmentId']),_0x3ca211=_0x5726fa[_0x4323b4(0x127)];_0x3ca211[_0x4323b4(0x137)]=_0x3dc3ce,await handleSingleObjectOutput(_0x3ca211,_0x1e4771);}else return console[_0x4323b4(0x189)](_0x4323b4(0x13d)),console[_0x4323b4(0x189)](_0x4323b4(0x134)),0x1;}return 0x0;}catch(_0x6f1cdc){if(_0x6f1cdc instanceof SDKError)return console[_0x4323b4(0x189)]('Error:\x20'+_0x6f1cdc[_0x4323b4(0x101)]),_0x6f1cdc[_0x4323b4(0x180)]&&console[_0x4323b4(0x189)](_0x4323b4(0x179)+_0x6f1cdc[_0x4323b4(0x180)]),0x1;throw _0x6f1cdc;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x5511b7(0x195)]=a37_0x5511b7(0x12b);['description']='Show\x20child\x20segment\x20schema\x20(column\x20types)';async[a37_0x5511b7(0x144)](_0x5517f0){const _0xe280ef=a37_0x5511b7,{options:_0x4fd7b1,args:_0xec57f2,tdx:_0xfb5023}=_0x5517f0,_0x5e6fd3=_0xec57f2[0x0];if(!_0x5e6fd3)return console[_0xe280ef(0x189)](_0xe280ef(0x163)),console[_0xe280ef(0x189)](_0xe280ef(0x115)),console[_0xe280ef(0x189)](_0xe280ef(0xf1)),console[_0xe280ef(0x189)]('Examples:'),console[_0xe280ef(0x189)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console['error']('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x34e65e=_0x4fd7b1[_0xe280ef(0x178)],_0x438d43=await resolveSegmentTarget(_0x5e6fd3,_0x34e65e,_0x4fd7b1[_0xe280ef(0x126)]);_0x4fd7b1[_0xe280ef(0x126)]&&console[_0xe280ef(0x189)](_0xe280ef(0x11f)+_0x438d43);const _0x1ccc12=await withSpinner('Resolving\x20\x27'+_0x5e6fd3+_0xe280ef(0x10f),()=>_0xfb5023[_0xe280ef(0x160)][_0xe280ef(0x159)](_0x438d43),{'verbose':_0x4fd7b1[_0xe280ef(0x126)]}),_0x456464=_0x1ccc12[_0xe280ef(0x127)];_0x4fd7b1[_0xe280ef(0x126)]&&(console[_0xe280ef(0x189)]('Resolved\x20type:\x20'+_0x456464[_0xe280ef(0x181)]),console[_0xe280ef(0x189)](_0xe280ef(0x15f)+_0x456464[_0xe280ef(0x199)]));if(_0x456464[_0xe280ef(0x181)]===_0xe280ef(0x11a))return console[_0xe280ef(0x189)](_0xe280ef(0x122)),console[_0xe280ef(0x189)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x456464['type']===_0xe280ef(0x16e))return console['error'](_0xe280ef(0x18d)),console[_0xe280ef(0x189)](_0xe280ef(0x105)),0x1;if(!_0x456464['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0xe280ef(0x156));const _0x1838e1=await withSpinner(_0xe280ef(0xef),()=>_0xfb5023[_0xe280ef(0x160)][_0xe280ef(0x158)](_0x456464[_0xe280ef(0x199)],_0x456464[_0xe280ef(0x130)]),{'verbose':_0x4fd7b1[_0xe280ef(0x126)]}),_0x3279b1=_0x1838e1[_0xe280ef(0x127)],_0x1a46bf=await executeSchemaQuery(_0x3279b1,_0xfb5023,_0x4fd7b1);return await handleQueryOutput(_0x1a46bf,_0x4fd7b1),0x0;}catch(_0x20489c){if(_0x20489c instanceof SDKError)return console[_0xe280ef(0x189)](_0xe280ef(0x10a)+_0x20489c['message']),_0x20489c[_0xe280ef(0x180)]&&console[_0xe280ef(0x189)](_0xe280ef(0x179)+_0x20489c[_0xe280ef(0x180)]),0x1;throw _0x20489c;}}}
1
+ const a37_0xfb19a1=a37_0x2221;(function(_0x5390b9,_0x16f7f8){const _0x104298=a37_0x2221,_0x440e9e=_0x5390b9();while(!![]){try{const _0x485c66=parseInt(_0x104298(0x1f1))/0x1+parseInt(_0x104298(0x1b0))/0x2+-parseInt(_0x104298(0x23c))/0x3+parseInt(_0x104298(0x219))/0x4*(-parseInt(_0x104298(0x1c1))/0x5)+parseInt(_0x104298(0x1b4))/0x6*(parseInt(_0x104298(0x1db))/0x7)+-parseInt(_0x104298(0x21a))/0x8*(parseInt(_0x104298(0x1e3))/0x9)+parseInt(_0x104298(0x1ad))/0xa;if(_0x485c66===_0x16f7f8)break;else _0x440e9e['push'](_0x440e9e['shift']());}catch(_0x39e7d6){_0x440e9e['push'](_0x440e9e['shift']());}}}(a37_0x243a,0x9b606));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_0x57c980 from'chalk';async function resolveSegmentTarget(_0x7d6104,_0x2504e3,_0x12721d){const _0x5ce0c5=a37_0x2221;if(isYamlFilePath(_0x7d6104))try{const _0x263e71=await resolveYamlFilePath(_0x7d6104);return _0x12721d&&(console[_0x5ce0c5(0x22f)](_0x5ce0c5(0x20a)+_0x7d6104),console[_0x5ce0c5(0x22f)](_0x5ce0c5(0x218)+_0x263e71[_0x5ce0c5(0x1ae)]),console['error'](_0x5ce0c5(0x1e7)+_0x263e71[_0x5ce0c5(0x1fc)]),console['error'](_0x5ce0c5(0x245)+(_0x263e71[_0x5ce0c5(0x21b)]||_0x5ce0c5(0x1e9))),console[_0x5ce0c5(0x22f)](_0x5ce0c5(0x1cf)+_0x263e71[_0x5ce0c5(0x1dc)])),_0x263e71[_0x5ce0c5(0x1dc)];}catch(_0x571676){throw new SDKError(ErrorCode[_0x5ce0c5(0x1ef)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x571676[_0x5ce0c5(0x251)]);}if(!_0x2504e3)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x2504e3+'/'+_0x7d6104;}export class SegmentDescribeCommand extends BaseCommand{[a37_0xfb19a1(0x209)]='segment:describe';[a37_0xfb19a1(0x1b1)]='Show\x20segment\x20or\x20folder\x20details';async[a37_0xfb19a1(0x1bf)](_0x2de510){const _0x2a3c21=a37_0xfb19a1,{options:_0x2cb654,args:_0x1f0ec7,tdx:_0x41085d}=_0x2de510,_0xf27fe=_0x1f0ec7[0x0],_0x486cd2=!_0xf27fe&&!!_0x2cb654[_0x2a3c21(0x1ae)],_0x30132d=_0xf27fe||_0x2cb654[_0x2a3c21(0x1ae)];if(!_0x30132d)return console[_0x2a3c21(0x22f)](_0x2a3c21(0x242)),console[_0x2a3c21(0x22f)](_0x2a3c21(0x208)),console[_0x2a3c21(0x22f)](_0x2a3c21(0x1b5)),console[_0x2a3c21(0x22f)](_0x2a3c21(0x223)),console[_0x2a3c21(0x22f)](_0x2a3c21(0x1fb)),console[_0x2a3c21(0x22f)](_0x2a3c21(0x1e1)),console[_0x2a3c21(0x22f)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0x18f354=_0x2cb654['segmentPath'];let _0x300a04=_0x30132d;!_0x486cd2&&_0x18f354&&!_0x30132d['includes']('/')&&(_0x300a04=_0x18f354+'/'+_0x30132d,_0x2cb654[_0x2a3c21(0x1d5)]&&console[_0x2a3c21(0x22f)](_0x2a3c21(0x1ce)+_0x300a04));const _0x5e2951=await withSpinner(_0x2a3c21(0x1ed)+_0x300a04+_0x2a3c21(0x205),()=>_0x41085d['segment'][_0x2a3c21(0x24f)](_0x300a04),{'verbose':_0x2cb654[_0x2a3c21(0x1d5)]}),_0x69de25=_0x5e2951[_0x2a3c21(0x257)];_0x2cb654[_0x2a3c21(0x1d5)]&&(console[_0x2a3c21(0x22f)](_0x2a3c21(0x20e)+_0x69de25[_0x2a3c21(0x1af)]),console[_0x2a3c21(0x22f)]('Parent\x20ID:\x20'+_0x69de25[_0x2a3c21(0x1c8)]),_0x69de25[_0x2a3c21(0x201)]&&console[_0x2a3c21(0x22f)](_0x2a3c21(0x256)+_0x69de25[_0x2a3c21(0x201)]),_0x69de25[_0x2a3c21(0x253)]&&console[_0x2a3c21(0x22f)](_0x2a3c21(0x1c0)+_0x69de25['segmentId']));if(_0x69de25[_0x2a3c21(0x1af)]==='parent'){const _0x32f4ed=await withSpinner(_0x2a3c21(0x247),()=>_0x41085d[_0x2a3c21(0x227)][_0x2a3c21(0x225)](_0x69de25[_0x2a3c21(0x1c8)]),{'verbose':_0x2cb654[_0x2a3c21(0x1d5)]});await handleSingleObjectOutput(_0x32f4ed[_0x2a3c21(0x257)],_0x2cb654);}else{if(_0x69de25[_0x2a3c21(0x1af)]===_0x2a3c21(0x238)){if(!_0x69de25[_0x2a3c21(0x201)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x2a3c21(0x211));const _0x55257b=await withSpinner(_0x2a3c21(0x204),()=>_0x41085d[_0x2a3c21(0x227)][_0x2a3c21(0x254)](_0x69de25[_0x2a3c21(0x201)]),{'verbose':_0x2cb654['verbose']});await handleSingleObjectOutput(_0x55257b['data'],_0x2cb654);}else{if(_0x69de25[_0x2a3c21(0x1af)]===_0x2a3c21(0x227)){if(!_0x69de25[_0x2a3c21(0x253)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x2a3c21(0x1d6));const _0x39ad57=await withSpinner(_0x2a3c21(0x1c2),()=>_0x41085d[_0x2a3c21(0x227)][_0x2a3c21(0x1bd)](_0x69de25[_0x2a3c21(0x1c8)],_0x69de25[_0x2a3c21(0x253)]),{'verbose':_0x2cb654[_0x2a3c21(0x1d5)]});await handleSingleObjectOutput(_0x39ad57['data'],_0x2cb654);}}}return 0x0;}catch(_0x509aaa){if(_0x509aaa instanceof SDKError)return console[_0x2a3c21(0x22f)](_0x2a3c21(0x1d7)+_0x509aaa['message']),_0x509aaa['cause']&&console['error'](_0x2a3c21(0x233)+_0x509aaa[_0x2a3c21(0x22e)]),0x1;throw _0x509aaa;}}}export class SegmentShowCommand extends BaseCommand{[a37_0xfb19a1(0x209)]='segment:show';[a37_0xfb19a1(0x1b1)]=a37_0xfb19a1(0x20b);async['execute'](_0x29aad7){const _0x3ddd9d=a37_0xfb19a1,{options:_0xe8204a,args:_0x3d40ee,tdx:_0x229b62}=_0x29aad7,_0xaf202a=_0x3d40ee[0x0];if(!_0xaf202a)return console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x206)),console[_0x3ddd9d(0x22f)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console['error'](_0x3ddd9d(0x224)),console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x1b5)),console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x1e8)),console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x1ba)),0x1;try{const _0xd2f64d=_0xe8204a[_0x3ddd9d(0x1ae)],_0x43e162=await resolveSegmentTarget(_0xaf202a,_0xd2f64d,_0xe8204a[_0x3ddd9d(0x1d5)]);_0xe8204a[_0x3ddd9d(0x1d5)]&&console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x20c)+_0x43e162);const _0x5e288a=await withSpinner(_0x3ddd9d(0x1c6)+_0xaf202a+_0x3ddd9d(0x205),()=>_0x229b62[_0x3ddd9d(0x227)][_0x3ddd9d(0x24f)](_0x43e162),{'verbose':_0xe8204a['verbose']}),_0x2e5195=_0x5e288a[_0x3ddd9d(0x257)];_0xe8204a['verbose']&&(console['error'](_0x3ddd9d(0x20e)+_0x2e5195[_0x3ddd9d(0x1af)]),console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x1ee)+_0x2e5195[_0x3ddd9d(0x1c8)]));if(_0x2e5195['type']===_0x3ddd9d(0x238))return console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x216)),console[_0x3ddd9d(0x22f)]('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x2e5195[_0x3ddd9d(0x1af)]==='parent')return console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x1fe)),console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x200)),0x1;if(!_0x2e5195[_0x3ddd9d(0x253)])throw new SDKError(ErrorCode[_0x3ddd9d(0x1e5)],_0x3ddd9d(0x1d6));const _0x94b60d=await withSpinner(_0x3ddd9d(0x1f4),()=>_0x229b62[_0x3ddd9d(0x227)][_0x3ddd9d(0x207)](_0x2e5195['parentId'],_0x2e5195[_0x3ddd9d(0x253)]),{'verbose':_0xe8204a['verbose']});let _0x26aed1=_0x94b60d['data'];const _0x595d00=resolveLimit(_0xe8204a[_0x3ddd9d(0x1cc)],DEFAULT_DISPLAY_LIMIT),_0x2ba99d=/\bLIMIT\s+\d+/i['test'](_0x26aed1);!_0x2ba99d&&(_0x26aed1=_0x26aed1['trim']()[_0x3ddd9d(0x244)](/;+$/,''),_0x26aed1=_0x3ddd9d(0x21c)+_0x26aed1+_0x3ddd9d(0x246)+_0x595d00);_0xe8204a['verbose']&&console[_0x3ddd9d(0x22f)](_0x3ddd9d(0x237)+_0x26aed1);const _0x20c079=await withProgressSpinner(_0x3ddd9d(0x221),async _0xb1d487=>{const _0x43f7ad=_0x3ddd9d,_0x52f365=await _0x229b62[_0x43f7ad(0x23f)][_0x43f7ad(0x1bf)](_0x26aed1,{'catalog':'td','schema':_0x43f7ad(0x1c9),'onJobId':_0x26b4d6=>{_0xb1d487['setJobId'](_0x26b4d6);}});return _0x52f365;},{'verbose':_0xe8204a[_0x3ddd9d(0x1d5)]}),_0x587018=_0x20c079[_0x3ddd9d(0x257)],_0xf2ed08=_0x587018[_0x3ddd9d(0x1f3)]?'\x20[Job\x20ID:\x20'+_0x587018[_0x3ddd9d(0x1f3)]+']':'';return console['error'](_0x3ddd9d(0x222)+_0x587018[_0x3ddd9d(0x229)][_0x3ddd9d(0x1f5)][_0x3ddd9d(0x1c5)]()+_0x3ddd9d(0x20d)+(_0x3ddd9d(0x1ec)+formatElapsed(_0x587018[_0x3ddd9d(0x229)][_0x3ddd9d(0x202)])+_0xf2ed08)),await handleQueryOutput(_0x587018,_0xe8204a),0x0;}catch(_0x4908fb){if(_0x4908fb instanceof SDKError)return console[_0x3ddd9d(0x22f)]('✖\x20Query\x20failed\x20['+_0x4908fb['code']+']'),console[_0x3ddd9d(0x22f)]('\x0a'+_0x4908fb[_0x3ddd9d(0x251)]),0x1;throw _0x4908fb;}}}function a37_0x2221(_0x272921,_0x1d4199){_0x272921=_0x272921-0x1ad;const _0x243a7c=a37_0x243a();let _0x2221a5=_0x243a7c[_0x272921];return _0x2221a5;}export class SegmentFolderListCommand extends BaseCommand{[a37_0xfb19a1(0x209)]=a37_0xfb19a1(0x235);[a37_0xfb19a1(0x1b1)]=a37_0xfb19a1(0x1de);async[a37_0xfb19a1(0x1bf)](_0x3fab1f){const _0x4d45db=a37_0xfb19a1,{options:_0x4d8b6a,args:_0x29790d,tdx:_0x43d762}=_0x3fab1f;if(_0x29790d['length']===0x0)return console[_0x4d45db(0x22f)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x4d45db(0x22f)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x1d29cf=_0x29790d[0x0];try{_0x4d8b6a[_0x4d45db(0x1d5)]&&(console[_0x4d45db(0x22f)]('Site:\x20'+_0x4d8b6a[_0x4d45db(0x226)]),console[_0x4d45db(0x22f)]('Parent\x20name:\x20'+_0x1d29cf));const _0x465959=await withSpinner(_0x4d45db(0x1e4)+_0x1d29cf+_0x4d45db(0x205),()=>_0x43d762[_0x4d45db(0x227)][_0x4d45db(0x255)](_0x1d29cf),{'verbose':_0x4d8b6a[_0x4d45db(0x1d5)]}),_0xa2836f=_0x465959[_0x4d45db(0x257)];_0x4d8b6a[_0x4d45db(0x1d5)]&&console[_0x4d45db(0x22f)](_0x4d45db(0x1fd)+_0xa2836f);const _0x4fa309=await withSpinner(_0x4d45db(0x252)+_0x1d29cf+_0x4d45db(0x205),()=>_0x43d762['segment'][_0x4d45db(0x1e0)](_0xa2836f),{'verbose':_0x4d8b6a['verbose']}),_0x5aa488=_0x4fa309[_0x4d45db(0x257)];return console[_0x4d45db(0x22f)](_0x4d45db(0x24a)+_0x5aa488[_0x4d45db(0x1b9)]+_0x4d45db(0x213)+(_0x5aa488[_0x4d45db(0x1b9)]!==0x1?'s':'')),await handleSDKOutput(_0x5aa488,_0x4d8b6a),0x0;}catch(_0x4fff28){if(_0x4fff28 instanceof SDKError)return console[_0x4d45db(0x22f)](_0x4d45db(0x1d7)+_0x4fff28['message']),_0x4fff28[_0x4d45db(0x22e)]&&console[_0x4d45db(0x22f)](_0x4d45db(0x233)+_0x4fff28[_0x4d45db(0x22e)]),0x1;throw _0x4fff28;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0xfb19a1(0x209)]='segment:folder:show';[a37_0xfb19a1(0x1b1)]='Show\x20segment\x20folder\x20details';async[a37_0xfb19a1(0x1bf)](_0x2fff99){const _0x1e8bea=a37_0xfb19a1,{options:_0x336c81,args:_0xc5ed19,tdx:_0x5cb48f}=_0x2fff99;if(_0xc5ed19[_0x1e8bea(0x1b9)]===0x0)return console[_0x1e8bea(0x22f)]('Error:\x20Folder\x20reference\x20is\x20required'),console['error'](_0x1e8bea(0x228)),0x1;try{const {parentId:_0x33b596,childId:_0x12cdbd}=parseSegmentRef(_0xc5ed19[0x0]);_0x336c81[_0x1e8bea(0x1d5)]&&(console['error'](_0x1e8bea(0x220)+_0x336c81[_0x1e8bea(0x226)]),console[_0x1e8bea(0x22f)](_0x1e8bea(0x1b8)+_0x33b596),_0x12cdbd&&console[_0x1e8bea(0x22f)](_0x1e8bea(0x1bc)+_0x12cdbd));if(!_0x12cdbd)return console[_0x1e8bea(0x22f)](_0x1e8bea(0x1bb)),0x1;const _0x15af19=await withSpinner(_0x1e8bea(0x1e4)+_0x33b596+_0x1e8bea(0x205),()=>_0x5cb48f[_0x1e8bea(0x227)][_0x1e8bea(0x255)](_0x33b596),{'verbose':_0x336c81[_0x1e8bea(0x1d5)]}),_0x353fc1=_0x15af19[_0x1e8bea(0x257)];_0x336c81['verbose']&&console[_0x1e8bea(0x22f)]('Resolved\x20parent\x20ID:\x20'+_0x353fc1);const _0x282c58=await withSpinner(_0x1e8bea(0x236)+_0x12cdbd+_0x1e8bea(0x205),()=>_0x5cb48f[_0x1e8bea(0x227)][_0x1e8bea(0x239)](_0x353fc1,_0x12cdbd),{'verbose':_0x336c81[_0x1e8bea(0x1d5)]}),_0x1898ca=_0x282c58[_0x1e8bea(0x257)];_0x336c81['verbose']&&console[_0x1e8bea(0x22f)](_0x1e8bea(0x1d2)+_0x1898ca);const _0x5087a7=await withSpinner(_0x1e8bea(0x1d1)+_0x12cdbd+'\x27...',()=>_0x5cb48f['segment'][_0x1e8bea(0x254)](_0x1898ca),{'verbose':_0x336c81[_0x1e8bea(0x1d5)]});return await handleSDKOutput([_0x5087a7['data']],_0x336c81),0x0;}catch(_0xa559c6){if(_0xa559c6 instanceof SDKError)return console[_0x1e8bea(0x22f)](_0x1e8bea(0x1d7)+_0xa559c6[_0x1e8bea(0x251)]),_0xa559c6['cause']&&console[_0x1e8bea(0x22f)](_0x1e8bea(0x233)+_0xa559c6['cause']),0x1;throw _0xa559c6;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a37_0xfb19a1(0x1d8);[a37_0xfb19a1(0x1b1)]=a37_0xfb19a1(0x1ea);async[a37_0xfb19a1(0x1bf)](_0x5961c2){const _0x513a9f=a37_0xfb19a1,{options:_0x322b60,args:_0x5eef32}=_0x5961c2,_0x5dfb7c=_0x322b60,_0x22f854=_0x5dfb7c[_0x513a9f(0x1b6)],_0x56ad3e=_0x5eef32[0x0];if(!_0x56ad3e&&!_0x22f854)return console[_0x513a9f(0x22f)](a37_0x57c980[_0x513a9f(0x22d)](_0x513a9f(0x1fa))),console[_0x513a9f(0x22f)](_0x513a9f(0x250)),console[_0x513a9f(0x22f)](_0x513a9f(0x22c)),console[_0x513a9f(0x22f)](_0x513a9f(0x240)),console[_0x513a9f(0x22f)]('Examples:'),console['error'](_0x513a9f(0x1c7)),console[_0x513a9f(0x22f)](_0x513a9f(0x24e)),0x1;if(_0x56ad3e&&_0x22f854)return console['error'](a37_0x57c980[_0x513a9f(0x22d)](_0x513a9f(0x1b3))),0x1;try{let _0x18b4cf;if(_0x22f854)_0x18b4cf=await this[_0x513a9f(0x1f6)](_0x22f854,_0x5961c2);else{if(isYamlFilePath(_0x56ad3e))return console['error'](a37_0x57c980[_0x513a9f(0x22d)](_0x513a9f(0x1ff))),console['error'](_0x513a9f(0x23d)+_0x56ad3e),0x1;else _0x18b4cf=await this['getSQLFromServerSegment'](_0x56ad3e,_0x5961c2);}return _0x322b60['format']===_0x513a9f(0x1dd)||_0x322b60[_0x513a9f(0x1cb)]===_0x513a9f(0x1f9)?await handleSDKOutput([{'sql':_0x18b4cf}],_0x322b60):console[_0x513a9f(0x232)](_0x18b4cf),0x0;}catch(_0x480a02){if(_0x480a02 instanceof SDKError)return console[_0x513a9f(0x22f)]('Error:\x20'+_0x480a02['message']),_0x480a02['cause']&&console[_0x513a9f(0x22f)]('\x20\x20Cause:\x20'+_0x480a02[_0x513a9f(0x22e)]),0x1;throw _0x480a02;}}async[a37_0xfb19a1(0x1f6)](_0x135aae,_0x444c11){const _0x3b42f9=a37_0xfb19a1,{options:_0x23983a,tdx:_0x557062}=_0x444c11;let _0x5da537;try{_0x5da537=await resolveYamlFilePath(_0x135aae);}catch(_0x5c1210){throw new SDKError(ErrorCode[_0x3b42f9(0x1ef)],_0x3b42f9(0x231)+_0x5c1210['message']);}_0x23983a[_0x3b42f9(0x1d5)]&&console[_0x3b42f9(0x22f)]('Resolved:\x20'+_0x5da537[_0x3b42f9(0x1ae)]+'/'+_0x5da537[_0x3b42f9(0x1fc)]);const _0x3198eb=await withSpinner(_0x3b42f9(0x1d0),()=>_0x557062[_0x3b42f9(0x227)][_0x3b42f9(0x23a)](_0x5da537['content'],_0x5da537[_0x3b42f9(0x1ae)],_0x5da537[_0x3b42f9(0x1fc)]),{'verbose':_0x23983a[_0x3b42f9(0x1d5)]});return _0x3198eb[_0x3b42f9(0x257)];}async[a37_0xfb19a1(0x1b7)](_0x3dc34f,_0x643706){const _0x377ff4=a37_0xfb19a1,{options:_0x332ad6,tdx:_0x24ad60}=_0x643706,_0x286ab1=_0x332ad6['parentSegment'],_0x5be8d8=await resolveSegmentTarget(_0x3dc34f,_0x286ab1,_0x332ad6[_0x377ff4(0x1d5)]);_0x332ad6[_0x377ff4(0x1d5)]&&console[_0x377ff4(0x22f)]('Target\x20path:\x20'+_0x5be8d8);const _0x196106=await withSpinner(_0x377ff4(0x1c6)+_0x3dc34f+_0x377ff4(0x205),()=>_0x24ad60[_0x377ff4(0x227)][_0x377ff4(0x24f)](_0x5be8d8),{'verbose':_0x332ad6[_0x377ff4(0x1d5)]}),_0x1361e4=_0x196106[_0x377ff4(0x257)];_0x332ad6[_0x377ff4(0x1d5)]&&(console[_0x377ff4(0x22f)](_0x377ff4(0x20e)+_0x1361e4[_0x377ff4(0x1af)]),console[_0x377ff4(0x22f)](_0x377ff4(0x1ee)+_0x1361e4[_0x377ff4(0x1c8)]));if(_0x1361e4[_0x377ff4(0x1af)]==='folder')throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x377ff4(0x1f0));if(_0x1361e4[_0x377ff4(0x1af)]===_0x377ff4(0x1e6))throw new SDKError(ErrorCode[_0x377ff4(0x1ef)],_0x377ff4(0x23e));if(!_0x1361e4[_0x377ff4(0x253)])throw new SDKError(ErrorCode[_0x377ff4(0x1e5)],_0x377ff4(0x1d6));const _0x181c59=await withSpinner(_0x377ff4(0x1f4),()=>_0x24ad60[_0x377ff4(0x227)][_0x377ff4(0x207)](_0x1361e4[_0x377ff4(0x1c8)],_0x1361e4[_0x377ff4(0x253)]),{'verbose':_0x332ad6[_0x377ff4(0x1d5)]});return _0x181c59[_0x377ff4(0x257)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0xfb19a1(0x209)]=a37_0xfb19a1(0x217);['description']=a37_0xfb19a1(0x22a);async[a37_0xfb19a1(0x1bf)](_0x5c3c63){const _0x4c23b7=a37_0xfb19a1,{options:_0x50f776,args:_0x48814d,tdx:_0x42a01b}=_0x5c3c63,_0x1f041b=_0x50f776;if(_0x48814d[_0x4c23b7(0x1b9)]<0x2)return console[_0x4c23b7(0x22f)](_0x4c23b7(0x21e)),console['error'](_0x4c23b7(0x248)),0x1;const _0x5b5ef6=_0x48814d[0x0],_0x5a84f1=_0x48814d[0x1];_0x1f041b[_0x4c23b7(0x1d5)]&&(console[_0x4c23b7(0x22f)](_0x4c23b7(0x220)+_0x1f041b[_0x4c23b7(0x226)]),console[_0x4c23b7(0x22f)](_0x4c23b7(0x21f)+_0x5b5ef6),console['error'](_0x4c23b7(0x1bc)+_0x5a84f1));let _0x94e906;if(_0x1f041b[_0x4c23b7(0x22b)]){const _0x368e6a=_0x1f041b['parentFolder'],_0x159a51=await withSpinner(_0x4c23b7(0x1e4)+_0x5b5ef6+'\x27...',()=>_0x42a01b[_0x4c23b7(0x227)][_0x4c23b7(0x255)](_0x5b5ef6),{'verbose':_0x1f041b[_0x4c23b7(0x1d5)]}),_0x12b913=_0x159a51[_0x4c23b7(0x257)],_0x5e6350=await withSpinner(_0x4c23b7(0x24c)+_0x368e6a+'\x27...',()=>_0x42a01b[_0x4c23b7(0x227)][_0x4c23b7(0x239)](_0x12b913,_0x368e6a),{'verbose':_0x1f041b[_0x4c23b7(0x1d5)]});_0x94e906=_0x5e6350[_0x4c23b7(0x257)],_0x1f041b['verbose']&&console[_0x4c23b7(0x22f)](_0x4c23b7(0x21d)+_0x94e906);}const _0x3d6ce6={'name':_0x5a84f1,'description':_0x1f041b['description'],'parentFolderId':_0x94e906},_0x33104f=await withSpinner(_0x4c23b7(0x1c3)+_0x5a84f1+_0x4c23b7(0x205),()=>_0x42a01b[_0x4c23b7(0x227)][_0x4c23b7(0x23b)](_0x5b5ef6,_0x3d6ce6),{'verbose':_0x1f041b['verbose']}),_0x423ef5=_0x33104f['data'];return console['error'](_0x4c23b7(0x1d4)+_0x423ef5[_0x4c23b7(0x209)]+_0x4c23b7(0x1f2)+_0x423ef5['id']),await handleSDKOutput([_0x423ef5],_0x1f041b),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a37_0xfb19a1(0x243);['description']=a37_0xfb19a1(0x1eb);async['execute'](_0x1692fc){const _0x1f41ef=a37_0xfb19a1,{options:_0x404d83,args:_0x201097,tdx:_0x30b4b4}=_0x1692fc,_0x115812=_0x201097[0x0];if(!_0x115812)return console[_0x1f41ef(0x22f)](_0x1f41ef(0x1d3)),console[_0x1f41ef(0x22f)](_0x1f41ef(0x1ca)),console[_0x1f41ef(0x22f)](_0x1f41ef(0x24b)),console['error'](_0x1f41ef(0x214)),console[_0x1f41ef(0x22f)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x1f41ef(0x22f)](_0x1f41ef(0x1b5)),console[_0x1f41ef(0x22f)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console['error'](_0x1f41ef(0x1e2)),console[_0x1f41ef(0x22f)](_0x1f41ef(0x1da)),console[_0x1f41ef(0x22f)](_0x1f41ef(0x1be)),0x1;try{const _0x3f8f54=_0x404d83[_0x1f41ef(0x1ae)],_0x5166c8=await resolveSegmentTarget(_0x115812,_0x3f8f54,_0x404d83[_0x1f41ef(0x1d5)]);_0x404d83[_0x1f41ef(0x1d5)]&&console['error'](_0x1f41ef(0x20c)+_0x5166c8);const _0x3de974=await withSpinner(_0x1f41ef(0x1c6)+_0x115812+_0x1f41ef(0x205),()=>_0x30b4b4[_0x1f41ef(0x227)][_0x1f41ef(0x24f)](_0x5166c8),{'verbose':_0x404d83[_0x1f41ef(0x1d5)]}),_0x301d1c=_0x3de974['data'];_0x404d83[_0x1f41ef(0x1d5)]&&(console[_0x1f41ef(0x22f)](_0x1f41ef(0x20e)+_0x301d1c[_0x1f41ef(0x1af)]),console[_0x1f41ef(0x22f)]('Parent\x20ID:\x20'+_0x301d1c[_0x1f41ef(0x1c8)]),_0x301d1c['folderId']&&console['error']('Folder\x20ID:\x20'+_0x301d1c[_0x1f41ef(0x201)]),_0x301d1c[_0x1f41ef(0x253)]&&console[_0x1f41ef(0x22f)](_0x1f41ef(0x1c0)+_0x301d1c[_0x1f41ef(0x253)]));if(_0x404d83[_0x1f41ef(0x1d9)]){if(_0x301d1c[_0x1f41ef(0x1af)]===_0x1f41ef(0x238))return console['error'](_0x1f41ef(0x212)),0x1;if(_0x301d1c[_0x1f41ef(0x1af)]===_0x1f41ef(0x1e6))return console[_0x1f41ef(0x22f)](_0x1f41ef(0x230)),console['error']('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x301d1c[_0x1f41ef(0x253)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x1f41ef(0x1d6));const _0x10ada2=getConsoleNextUrl(_0x404d83['site'],_0x1f41ef(0x20f)+_0x301d1c[_0x1f41ef(0x1c8)]+'/e/'+_0x301d1c['segmentId']);return console[_0x1f41ef(0x22f)](a37_0x57c980[_0x1f41ef(0x210)]('✔')+_0x1f41ef(0x241)+a37_0x57c980[_0x1f41ef(0x203)](_0x10ada2)),openBrowser(_0x10ada2),0x0;}if(_0x301d1c[_0x1f41ef(0x1af)]===_0x1f41ef(0x238)){if(!_0x301d1c['folderId'])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x6c59aa=await withSpinner(_0x1f41ef(0x204),()=>_0x30b4b4[_0x1f41ef(0x227)][_0x1f41ef(0x254)](_0x301d1c[_0x1f41ef(0x201)]),{'verbose':_0x404d83[_0x1f41ef(0x1d5)]});await handleSingleObjectOutput(_0x6c59aa[_0x1f41ef(0x257)],_0x404d83);}else{if(_0x301d1c['type']===_0x1f41ef(0x227)){if(!_0x301d1c[_0x1f41ef(0x253)])throw new SDKError(ErrorCode[_0x1f41ef(0x1e5)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x31ae6a=await withSpinner('Fetching\x20segment\x20details...',()=>_0x30b4b4[_0x1f41ef(0x227)][_0x1f41ef(0x1bd)](_0x301d1c[_0x1f41ef(0x1c8)],_0x301d1c[_0x1f41ef(0x253)]),{'verbose':_0x404d83[_0x1f41ef(0x1d5)]}),_0x360563=getConsoleNextUrl(_0x404d83['site'],_0x1f41ef(0x20f)+_0x301d1c[_0x1f41ef(0x1c8)]+_0x1f41ef(0x1cd)+_0x301d1c[_0x1f41ef(0x253)]),_0x109cc4=_0x31ae6a[_0x1f41ef(0x257)];_0x109cc4[_0x1f41ef(0x1b2)]=_0x360563,await handleSingleObjectOutput(_0x109cc4,_0x404d83);}else return console[_0x1f41ef(0x22f)](_0x1f41ef(0x234)),console[_0x1f41ef(0x22f)](_0x1f41ef(0x1df)),0x1;}return 0x0;}catch(_0x5e7407){if(_0x5e7407 instanceof SDKError)return console['error'](_0x1f41ef(0x1d7)+_0x5e7407[_0x1f41ef(0x251)]),_0x5e7407[_0x1f41ef(0x22e)]&&console[_0x1f41ef(0x22f)](_0x1f41ef(0x233)+_0x5e7407[_0x1f41ef(0x22e)]),0x1;throw _0x5e7407;}}}export const SegmentInfoCommand=SegmentViewCommand;function a37_0x243a(){const _0x3f15b2=['Options:','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','segment:folder:create','\x20\x20Parent\x20segment:\x20','4288964mKJPNf','1859056QaAktK','folderPath','SELECT\x20*\x20FROM\x20(\x0a','Resolved\x20parent\x20folder\x20ID:\x20','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Parent\x20segment:\x20','Site:\x20','Executing\x20segment\x20query...','✔\x20Query\x20completed:\x20Processed\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','getParent','site','segment','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','stats','Create\x20segment\x20folder\x20for\x20organization','parentFolder','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','red','cause','error','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','log','\x20\x20Cause:\x20','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','segment:folder:list','Resolving\x20folder\x20\x27','SQL\x20query:\x0a','folder','resolveFolderId','getSegmentSQLFromYaml','createFolder','3712803vHiSBT','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','query','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','\x20Opening\x20','Error:\x20Path\x20or\x20name\x20is\x20required','segment:view','replace','\x20\x20Folder\x20path:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Fetching\x20parent\x20segment\x20details...','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Show\x20child\x20segment\x20schema\x20(column\x20types)','✔\x20Found\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Resolving\x20parent\x20folder\x20\x27','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','resolvePathToResource','Usage:','message','Listing\x20folders\x20for\x20parent\x20\x27','segmentId','getFolder','resolveParentId','Folder\x20ID:\x20','data','13878950fopvOT','parentSegment','type','426552AEbIku','description','url','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','6deGmKk','Examples:','path','getSQLFromServerSegment','Parent\x20name:\x20','length','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Folder\x20name:\x20','getSegment','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','execute','Segment\x20ID:\x20','5eSmrgl','Fetching\x20segment\x20details...','Creating\x20folder\x20\x27','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','toLocaleString','Resolving\x20\x27','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','parentId','information_schema','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','format','limit','/e/','Resolved\x20relative\x20path\x20to:\x20','\x20\x20Full\x20path:\x20','Fetching\x20SQL\x20from\x20rule...','Fetching\x20folder\x20\x27','Resolved\x20folder\x20ID:\x20','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','✔\x20Created\x20folder\x20\x27','verbose','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20','segment:sql','web','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','7222117bHwQON','fullPath','json','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Use:\x20tdx\x20ps\x20view','listFolders','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','18mKcBxx','Resolving\x20parent\x20segment\x20\x27','SEGMENT_NOT_FOUND','parent','\x20\x20Segment\x20name:\x20','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','(root)','Get\x20SQL\x20query\x20for\x20child\x20segment','Show\x20folder\x20or\x20child\x20segment\x20details','in\x20','Resolving\x20path\x20\x27','Parent\x20ID:\x20','INVALID_ARGUMENT','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','778126jODmYC','\x27\x20with\x20ID:\x20','jobId','Fetching\x20SQL\x20for\x20segment...','processedRows','getSQLFromYamlFile','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Usage:\x20tdx\x20sg\x20desc\x20<name>','jsonl','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','segmentName','Resolved\x20parent\x20ID:\x20','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','Use:\x20tdx\x20ps\x20show','folderId','elapsedTimeMillis','cyan','Fetching\x20folder\x20details...','\x27...','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','getSegmentSQL','Usage:\x20tdx\x20segment\x20describe\x20<path>','name','Resolved\x20YAML\x20file:\x20','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Target\x20path:\x20','\x20rows\x20','Resolved\x20type:\x20','/app/ps/','green','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','\x20folder'];a37_0x243a=function(){return _0x3f15b2;};return a37_0x243a();}export class SegmentDescCommand extends BaseCommand{[a37_0xfb19a1(0x209)]='segment:desc';[a37_0xfb19a1(0x1b1)]=a37_0xfb19a1(0x249);async[a37_0xfb19a1(0x1bf)](_0xe940c0){const _0x4b7a51=a37_0xfb19a1,{options:_0x403a3e,args:_0x4ab6b7,tdx:_0x23a3a3}=_0xe940c0,_0x1ee296=_0x4ab6b7[0x0];if(!_0x1ee296)return console[_0x4b7a51(0x22f)](_0x4b7a51(0x206)),console[_0x4b7a51(0x22f)](_0x4b7a51(0x1f8)),console['error'](_0x4b7a51(0x215)),console[_0x4b7a51(0x22f)](_0x4b7a51(0x1b5)),console[_0x4b7a51(0x22f)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x4b7a51(0x22f)](_0x4b7a51(0x1f7)),0x1;try{const _0x502ca5=_0x403a3e[_0x4b7a51(0x1ae)],_0xd5997c=await resolveSegmentTarget(_0x1ee296,_0x502ca5,_0x403a3e[_0x4b7a51(0x1d5)]);_0x403a3e[_0x4b7a51(0x1d5)]&&console[_0x4b7a51(0x22f)](_0x4b7a51(0x20c)+_0xd5997c);const _0x3b88ef=await withSpinner(_0x4b7a51(0x1c6)+_0x1ee296+_0x4b7a51(0x205),()=>_0x23a3a3[_0x4b7a51(0x227)][_0x4b7a51(0x24f)](_0xd5997c),{'verbose':_0x403a3e['verbose']}),_0xe1281c=_0x3b88ef[_0x4b7a51(0x257)];_0x403a3e['verbose']&&(console[_0x4b7a51(0x22f)]('Resolved\x20type:\x20'+_0xe1281c[_0x4b7a51(0x1af)]),console[_0x4b7a51(0x22f)](_0x4b7a51(0x1ee)+_0xe1281c[_0x4b7a51(0x1c8)]));if(_0xe1281c[_0x4b7a51(0x1af)]==='folder')return console[_0x4b7a51(0x22f)](_0x4b7a51(0x1c4)),console[_0x4b7a51(0x22f)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0xe1281c[_0x4b7a51(0x1af)]===_0x4b7a51(0x1e6))return console[_0x4b7a51(0x22f)](_0x4b7a51(0x24d)),console[_0x4b7a51(0x22f)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0xe1281c[_0x4b7a51(0x253)])throw new SDKError(ErrorCode[_0x4b7a51(0x1e5)],_0x4b7a51(0x1d6));const _0x56621a=await withSpinner(_0x4b7a51(0x1f4),()=>_0x23a3a3[_0x4b7a51(0x227)][_0x4b7a51(0x207)](_0xe1281c[_0x4b7a51(0x1c8)],_0xe1281c['segmentId']),{'verbose':_0x403a3e[_0x4b7a51(0x1d5)]}),_0x27874e=_0x56621a[_0x4b7a51(0x257)],_0x2b0390=await executeSchemaQuery(_0x27874e,_0x23a3a3,_0x403a3e);return await handleQueryOutput(_0x2b0390,_0x403a3e),0x0;}catch(_0x51d0e4){if(_0x51d0e4 instanceof SDKError)return console[_0x4b7a51(0x22f)]('Error:\x20'+_0x51d0e4[_0x4b7a51(0x251)]),_0x51d0e4['cause']&&console['error'](_0x4b7a51(0x233)+_0x51d0e4['cause']),0x1;throw _0x51d0e4;}}}
@@ -1 +1 @@
1
- const a38_0x445e80=a38_0x1cc5;(function(_0x22ebb6,_0x5c4bde){const _0x445682=a38_0x1cc5,_0x273ce0=_0x22ebb6();while(!![]){try{const _0x590a62=-parseInt(_0x445682(0xfd))/0x1*(parseInt(_0x445682(0xe3))/0x2)+-parseInt(_0x445682(0xfc))/0x3+-parseInt(_0x445682(0xf0))/0x4+-parseInt(_0x445682(0xda))/0x5+parseInt(_0x445682(0xed))/0x6+parseInt(_0x445682(0xef))/0x7*(parseInt(_0x445682(0xea))/0x8)+parseInt(_0x445682(0xc9))/0x9*(parseInt(_0x445682(0xca))/0xa);if(_0x590a62===_0x5c4bde)break;else _0x273ce0['push'](_0x273ce0['shift']());}catch(_0x2b19e6){_0x273ce0['push'](_0x273ce0['shift']());}}}(a38_0x1802,0xb3b8b));function a38_0x1cc5(_0x5ecaed,_0x2975fa){_0x5ecaed=_0x5ecaed-0xc9;const _0x180210=a38_0x1802();let _0x1cc58f=_0x180210[_0x5ecaed];return _0x1cc58f;}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x14e484 from'chalk';function a38_0x1802(){const _0x4020b6=['Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','Resolving\x20folder\x20\x27','kind','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','1350990CITDoq','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','resolveFolderId','segmentPath','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Segment\x20name:\x20','\x27...','Creating\x20segment\x20\x27','type','2744612RhTiEn','Resolved\x20relative\x20path\x20to:\x20','parent','Parent\x20path:\x20','data','rule','✔\x20Created\x20segment\x20\x27','7224wIoekp','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','segments','2897790dOzWGN','invisible','1827POVIwo','2009828lqOYLn','Site:\x20','Create\x20child\x20segment\x20with\x20filtering\x20rules','segment','folder','verbose','site','length','\x27\x20with\x20ID:\x20','Resolved\x20folder\x20ID:\x20','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','name','2749431pUUFPF','1CGIwWh','12159fEDfHQ','22790OProzK','resolvePathToResource','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','yellow','description','error','Resolving\x20folder\x20path\x20\x27','Target\x20path:\x20','createSegment','Parent:\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'];a38_0x1802=function(){return _0x4020b6;};return a38_0x1802();}export class SegmentCreateCommand extends BaseCommand{[a38_0x445e80(0xfb)]='segment:create';[a38_0x445e80(0xce)]=a38_0x445e80(0xf2);async['execute'](_0x2b42b1){const _0x443f88=a38_0x445e80;console[_0x443f88(0xcf)](a38_0x14e484[_0x443f88(0xcd)](_0x443f88(0xdb))),console['error'](a38_0x14e484[_0x443f88(0xcd)](_0x443f88(0xd4)));const {options:_0x4dfb77,args:_0x52f479,tdx:_0x1b813b}=_0x2b42b1,_0x3a01af=_0x4dfb77;if(_0x52f479[_0x443f88(0xf7)]===0x0)return console[_0x443f88(0xcf)](_0x443f88(0xd5)),console[_0x443f88(0xcf)](_0x443f88(0xd9)),console[_0x443f88(0xcf)]('Examples:'),console[_0x443f88(0xcf)](_0x443f88(0xeb)),console['error']('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console[_0x443f88(0xcf)](_0x443f88(0xde)),0x1;const _0x38c5bf=_0x52f479[0x0],_0x287325=_0x4dfb77[_0x443f88(0xdd)];let _0x5d9108=_0x38c5bf;_0x287325&&!_0x38c5bf['includes']('/')&&(_0x5d9108=_0x287325+'/'+_0x38c5bf,_0x3a01af[_0x443f88(0xf5)]&&console[_0x443f88(0xcf)](_0x443f88(0xe4)+_0x5d9108));const _0x2026e1=parsePath(_0x5d9108);if(_0x2026e1[_0x443f88(0xec)][_0x443f88(0xf7)]<0x2)return console[_0x443f88(0xcf)](_0x443f88(0xfa)),console[_0x443f88(0xcf)](_0x443f88(0xcc)),0x1;const _0x1f0efc=_0x2026e1[_0x443f88(0xec)][0x0],_0x5d5122=getBaseName(_0x5d9108),_0x40ca7f=getParentPath(_0x5d9108);_0x3a01af[_0x443f88(0xf5)]&&(console[_0x443f88(0xcf)](_0x443f88(0xf1)+_0x3a01af[_0x443f88(0xf6)]),console['error'](_0x443f88(0xd1)+_0x5d9108),console[_0x443f88(0xcf)](_0x443f88(0xd3)+_0x1f0efc),console[_0x443f88(0xcf)](_0x443f88(0xdf)+_0x5d5122),console[_0x443f88(0xcf)](_0x443f88(0xe6)+_0x40ca7f));const _0x5aadbb=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x1f0efc+'\x27...',()=>_0x1b813b['segment']['resolveParentId'](_0x1f0efc),{'verbose':_0x3a01af[_0x443f88(0xf5)]}),_0x4b439b=_0x5aadbb[_0x443f88(0xe7)];let _0x2c1225;if(_0x2026e1[_0x443f88(0xec)][_0x443f88(0xf7)]>0x2){const _0x479234=await withSpinner(_0x443f88(0xd0)+_0x40ca7f+_0x443f88(0xe0),()=>_0x1b813b[_0x443f88(0xf3)][_0x443f88(0xcb)](_0x40ca7f),{'verbose':_0x3a01af[_0x443f88(0xf5)]}),_0x5777cb=_0x479234['data'];if(_0x5777cb[_0x443f88(0xe2)]!=='folder'&&_0x5777cb[_0x443f88(0xe2)]!==_0x443f88(0xe5))return console['error'](_0x443f88(0xd6)),0x1;_0x2c1225=_0x5777cb['folderId'];}else{if(_0x3a01af[_0x443f88(0xf4)]){const _0x2c88f5=await withSpinner(_0x443f88(0xd7)+_0x3a01af[_0x443f88(0xf4)]+_0x443f88(0xe0),()=>_0x1b813b[_0x443f88(0xf3)][_0x443f88(0xdc)](_0x4b439b,_0x3a01af[_0x443f88(0xf4)]),{'verbose':_0x3a01af[_0x443f88(0xf5)]});_0x2c1225=_0x2c88f5[_0x443f88(0xe7)];}}_0x3a01af[_0x443f88(0xf5)]&&_0x2c1225&&console[_0x443f88(0xcf)](_0x443f88(0xf9)+_0x2c1225);const _0x14f61e=await loadJSONFromOptions(_0x3a01af[_0x443f88(0xe8)],_0x3a01af['ruleFile']),_0x165be8={'name':_0x5d5122,'description':_0x3a01af[_0x443f88(0xce)],'rule':_0x14f61e,'kind':_0x3a01af['kind']!==undefined?parseInt(_0x3a01af[_0x443f88(0xd8)],0xa):undefined,'isVisible':_0x3a01af[_0x443f88(0xee)]?![]:undefined,'segmentFolderId':_0x2c1225,'countPopulation':_0x3a01af['noCountPopulation']?![]:undefined},_0x5ded6b=await withSpinner(_0x443f88(0xe1)+_0x5d5122+_0x443f88(0xe0),()=>_0x1b813b[_0x443f88(0xf3)][_0x443f88(0xd2)](_0x4b439b,_0x165be8),{'verbose':_0x3a01af[_0x443f88(0xf5)]}),_0x4d0617=_0x5ded6b[_0x443f88(0xe7)];return console[_0x443f88(0xcf)](_0x443f88(0xe9)+_0x4d0617[_0x443f88(0xfb)]+_0x443f88(0xf8)+_0x4d0617['id']),_0x5d9108!==_0x38c5bf&&console[_0x443f88(0xcf)]('\x20\x20\x20Path:\x20'+_0x5d9108),await handleSDKOutput([_0x4d0617],_0x3a01af),0x0;}}
1
+ const a38_0x4ad0ff=a38_0x4b2b;(function(_0x24eb00,_0x3c5ce3){const _0xa0a6a0=a38_0x4b2b,_0x5f4bbd=_0x24eb00();while(!![]){try{const _0x384137=parseInt(_0xa0a6a0(0x153))/0x1*(parseInt(_0xa0a6a0(0x143))/0x2)+parseInt(_0xa0a6a0(0x144))/0x3*(-parseInt(_0xa0a6a0(0x135))/0x4)+parseInt(_0xa0a6a0(0x145))/0x5*(-parseInt(_0xa0a6a0(0x136))/0x6)+parseInt(_0xa0a6a0(0x134))/0x7*(-parseInt(_0xa0a6a0(0x148))/0x8)+parseInt(_0xa0a6a0(0x131))/0x9+-parseInt(_0xa0a6a0(0x155))/0xa+parseInt(_0xa0a6a0(0x12d))/0xb;if(_0x384137===_0x3c5ce3)break;else _0x5f4bbd['push'](_0x5f4bbd['shift']());}catch(_0x448213){_0x5f4bbd['push'](_0x5f4bbd['shift']());}}}(a38_0x2f7a,0xdb676));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a38_0x2f7a(){const _0x3ece54=['Create\x20child\x20segment\x20with\x20filtering\x20rules','8317001zuPtTA','8XUuVOM','102fHCWyS','name','createSegment','segments','rule','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','verbose','Parent\x20path:\x20','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','\x27\x20with\x20ID:\x20','folder','type','1306pZvWew','460563CnenOp','489605HTzTNK','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','yellow','8XzdDjd','length','Resolving\x20parent\x20segment\x20\x27','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','✔\x20Created\x20segment\x20\x27','kind','Resolving\x20folder\x20path\x20\x27','Resolved\x20folder\x20ID:\x20','segment','ruleFile','includes','2556kVnIzP','parent','10638240EjIEma','description','folderId','error','\x27...','\x20\x20\x20Path:\x20','Creating\x20segment\x20\x27','invisible','data','segment:create','20274529birkPU','Target\x20path:\x20','site','noCountPopulation','14491233nkvsSl','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'];a38_0x2f7a=function(){return _0x3ece54;};return a38_0x2f7a();}import{withSpinner}from'../utils/spinner.js';function a38_0x4b2b(_0x3d7ca7,_0x2ea350){_0x3d7ca7=_0x3d7ca7-0x124;const _0x2f7a34=a38_0x2f7a();let _0x4b2bb9=_0x2f7a34[_0x3d7ca7];return _0x4b2bb9;}import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x2a5f8e from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x4ad0ff(0x137)]=a38_0x4ad0ff(0x12c);['description']=a38_0x4ad0ff(0x133);async['execute'](_0xa4cfb2){const _0x1813e6=a38_0x4ad0ff;console[_0x1813e6(0x126)](a38_0x2a5f8e[_0x1813e6(0x147)]('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x1813e6(0x126)](a38_0x2a5f8e[_0x1813e6(0x147)](_0x1813e6(0x146)));const {options:_0x1e1bb1,args:_0x164318,tdx:_0xc841bb}=_0xa4cfb2,_0x1218d2=_0x1e1bb1;if(_0x164318[_0x1813e6(0x149)]===0x0)return console[_0x1813e6(0x126)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console['error'](_0x1813e6(0x13f)),console[_0x1813e6(0x126)]('Examples:'),console[_0x1813e6(0x126)](_0x1813e6(0x14b)),console[_0x1813e6(0x126)](_0x1813e6(0x132)),console[_0x1813e6(0x126)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x5d6066=_0x164318[0x0],_0x2b3175=_0x1e1bb1['segmentPath'];let _0x2ea68a=_0x5d6066;_0x2b3175&&!_0x5d6066[_0x1813e6(0x152)]('/')&&(_0x2ea68a=_0x2b3175+'/'+_0x5d6066,_0x1218d2[_0x1813e6(0x13c)]&&console[_0x1813e6(0x126)]('Resolved\x20relative\x20path\x20to:\x20'+_0x2ea68a));const _0x2c4e5e=parsePath(_0x2ea68a);if(_0x2c4e5e[_0x1813e6(0x139)][_0x1813e6(0x149)]<0x2)return console[_0x1813e6(0x126)](_0x1813e6(0x13b)),console[_0x1813e6(0x126)](_0x1813e6(0x13e)),0x1;const _0x559197=_0x2c4e5e['segments'][0x0],_0x42e61d=getBaseName(_0x2ea68a),_0x368fec=getParentPath(_0x2ea68a);_0x1218d2[_0x1813e6(0x13c)]&&(console[_0x1813e6(0x126)]('Site:\x20'+_0x1218d2[_0x1813e6(0x12f)]),console[_0x1813e6(0x126)](_0x1813e6(0x12e)+_0x2ea68a),console[_0x1813e6(0x126)]('Parent:\x20'+_0x559197),console['error']('Segment\x20name:\x20'+_0x42e61d),console[_0x1813e6(0x126)](_0x1813e6(0x13d)+_0x368fec));const _0x2816ef=await withSpinner(_0x1813e6(0x14a)+_0x559197+_0x1813e6(0x127),()=>_0xc841bb[_0x1813e6(0x150)]['resolveParentId'](_0x559197),{'verbose':_0x1218d2[_0x1813e6(0x13c)]}),_0x11a71f=_0x2816ef[_0x1813e6(0x12b)];let _0xc245fe;if(_0x2c4e5e['segments'][_0x1813e6(0x149)]>0x2){const _0x409a7f=await withSpinner(_0x1813e6(0x14e)+_0x368fec+_0x1813e6(0x127),()=>_0xc841bb[_0x1813e6(0x150)]['resolvePathToResource'](_0x368fec),{'verbose':_0x1218d2['verbose']}),_0x1a8ff0=_0x409a7f[_0x1813e6(0x12b)];if(_0x1a8ff0[_0x1813e6(0x142)]!==_0x1813e6(0x141)&&_0x1a8ff0[_0x1813e6(0x142)]!==_0x1813e6(0x154))return console[_0x1813e6(0x126)]('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0xc245fe=_0x1a8ff0[_0x1813e6(0x125)];}else{if(_0x1218d2[_0x1813e6(0x141)]){const _0x5759f4=await withSpinner('Resolving\x20folder\x20\x27'+_0x1218d2['folder']+'\x27...',()=>_0xc841bb[_0x1813e6(0x150)]['resolveFolderId'](_0x11a71f,_0x1218d2['folder']),{'verbose':_0x1218d2[_0x1813e6(0x13c)]});_0xc245fe=_0x5759f4[_0x1813e6(0x12b)];}}_0x1218d2['verbose']&&_0xc245fe&&console['error'](_0x1813e6(0x14f)+_0xc245fe);const _0x34419c=await loadJSONFromOptions(_0x1218d2[_0x1813e6(0x13a)],_0x1218d2[_0x1813e6(0x151)]),_0x56ff4f={'name':_0x42e61d,'description':_0x1218d2[_0x1813e6(0x124)],'rule':_0x34419c,'kind':_0x1218d2[_0x1813e6(0x14d)]!==undefined?parseInt(_0x1218d2[_0x1813e6(0x14d)],0xa):undefined,'isVisible':_0x1218d2[_0x1813e6(0x12a)]?![]:undefined,'segmentFolderId':_0xc245fe,'countPopulation':_0x1218d2[_0x1813e6(0x130)]?![]:undefined},_0x30f1fc=await withSpinner(_0x1813e6(0x129)+_0x42e61d+'\x27...',()=>_0xc841bb[_0x1813e6(0x150)][_0x1813e6(0x138)](_0x11a71f,_0x56ff4f),{'verbose':_0x1218d2[_0x1813e6(0x13c)]}),_0x5d5c00=_0x30f1fc[_0x1813e6(0x12b)];return console['error'](_0x1813e6(0x14c)+_0x5d5c00[_0x1813e6(0x137)]+_0x1813e6(0x140)+_0x5d5c00['id']),_0x2ea68a!==_0x5d6066&&console[_0x1813e6(0x126)](_0x1813e6(0x128)+_0x2ea68a),await handleSDKOutput([_0x5d5c00],_0x1218d2),0x0;}}