@treasuredata/tdx 2026.4.9 → 2026.4.10

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 (228) 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.js +1 -1
  82. package/dist/proxy/passthrough-server.js +1 -1
  83. package/dist/proxy/sse-usage-parser.js +1 -1
  84. package/dist/sdk/agent/agent-config.js +1 -1
  85. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  86. package/dist/sdk/agent/agent-yaml.js +1 -1
  87. package/dist/sdk/agent/test/evaluator.js +1 -1
  88. package/dist/sdk/agent/test/executor.js +1 -1
  89. package/dist/sdk/agent/test/index.js +1 -1
  90. package/dist/sdk/agent/test/output.js +1 -1
  91. package/dist/sdk/agent/test/parser.js +1 -1
  92. package/dist/sdk/agent/tool-target-registry.js +1 -1
  93. package/dist/sdk/api.js +1 -1
  94. package/dist/sdk/cas/cas-api-client.js +1 -1
  95. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  96. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  97. package/dist/sdk/cas/index.js +1 -1
  98. package/dist/sdk/cas/pull-workflow.js +1 -1
  99. package/dist/sdk/cas/push-workflow.js +1 -1
  100. package/dist/sdk/client/cdp-api-client.js +1 -1
  101. package/dist/sdk/client/delivery-api-client.js +1 -1
  102. package/dist/sdk/client/endpoints.js +1 -1
  103. package/dist/sdk/client/engage-api-client.js +1 -1
  104. package/dist/sdk/client/http-client.js +1 -1
  105. package/dist/sdk/client/llm-api-client.js +1 -1
  106. package/dist/sdk/client/oauth-refresh.js +1 -1
  107. package/dist/sdk/client/rate-limiter.js +1 -1
  108. package/dist/sdk/client/td-api-client.js +1 -1
  109. package/dist/sdk/client/trino-api-client.js +1 -1
  110. package/dist/sdk/client/workflow-client.js +1 -1
  111. package/dist/sdk/connection-validator.js +1 -1
  112. package/dist/sdk/connection.js +1 -1
  113. package/dist/sdk/delivery.js +1 -1
  114. package/dist/sdk/engage/campaign-pull.js +1 -1
  115. package/dist/sdk/engage/campaign-push.js +1 -1
  116. package/dist/sdk/engage/campaign-validator.js +1 -1
  117. package/dist/sdk/engage/campaign-yaml.js +1 -1
  118. package/dist/sdk/engage/template-pull.js +1 -1
  119. package/dist/sdk/engage/template-push.js +1 -1
  120. package/dist/sdk/engage/template-validator.js +1 -1
  121. package/dist/sdk/engage/template-yaml.js +1 -1
  122. package/dist/sdk/engage/types/campaign-def.js +1 -1
  123. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  124. package/dist/sdk/engage/types/template-schema.js +1 -1
  125. package/dist/sdk/engage.js +1 -1
  126. package/dist/sdk/errors.js +1 -1
  127. package/dist/sdk/index.js +1 -1
  128. package/dist/sdk/io/index.js +1 -1
  129. package/dist/sdk/io/node-filesystem.js +1 -1
  130. package/dist/sdk/job.js +1 -1
  131. package/dist/sdk/journey.js +1 -1
  132. package/dist/sdk/llm/chat-cache.js +1 -1
  133. package/dist/sdk/llm/index.js +1 -1
  134. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  135. package/dist/sdk/llm/model-factors.js +1 -1
  136. package/dist/sdk/personalization.js +1 -1
  137. package/dist/sdk/policy.js +1 -1
  138. package/dist/sdk/query/index.js +1 -1
  139. package/dist/sdk/query/sql-parser.js +1 -1
  140. package/dist/sdk/realtime.js +1 -1
  141. package/dist/sdk/schedule.js +1 -1
  142. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  143. package/dist/sdk/segment/fields-display.js +1 -1
  144. package/dist/sdk/segment/file-discovery.js +1 -1
  145. package/dist/sdk/segment/journey-utils.js +1 -1
  146. package/dist/sdk/segment/journey-validator.js +1 -1
  147. package/dist/sdk/segment/journey-yaml.js +1 -1
  148. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  149. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  150. package/dist/sdk/segment/pull-workflow.js +1 -1
  151. package/dist/sdk/segment/push-recovery.js +1 -1
  152. package/dist/sdk/segment/push-workflow.js +1 -1
  153. package/dist/sdk/segment/resolution-context.js +1 -1
  154. package/dist/sdk/segment/segment-path-parser.js +1 -1
  155. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  156. package/dist/sdk/segment/segment-validator.js +1 -1
  157. package/dist/sdk/segment/target-resolution.js +1 -1
  158. package/dist/sdk/segment/tdx-config.js +1 -1
  159. package/dist/sdk/segment/types/activation-schema.js +1 -1
  160. package/dist/sdk/segment/types/journey-def.js +1 -1
  161. package/dist/sdk/segment/types/journey-schema.js +1 -1
  162. package/dist/sdk/segment/types/segment-def.js +1 -1
  163. package/dist/sdk/segment/types/segment-schema.js +1 -1
  164. package/dist/sdk/segment/validate-files.js +1 -1
  165. package/dist/sdk/segment/yaml-validator.js +1 -1
  166. package/dist/sdk/segment.js +1 -1
  167. package/dist/sdk/types/index.js +1 -1
  168. package/dist/sdk/types/progress.js +1 -1
  169. package/dist/sdk/types/workspace.js +1 -1
  170. package/dist/sdk/user.js +1 -1
  171. package/dist/sdk/util/format-detector.js +1 -1
  172. package/dist/sdk/util/formatters.js +1 -1
  173. package/dist/sdk/util/index.js +1 -1
  174. package/dist/sdk/util/paginate.js +1 -1
  175. package/dist/sdk/util/tree-formatter.js +1 -1
  176. package/dist/sdk/workflow/archive-validation.js +1 -1
  177. package/dist/sdk/workflow/clone-workflow.js +1 -1
  178. package/dist/sdk/workflow/index.js +1 -1
  179. package/dist/sdk/workflow/pull-workflow.js +1 -1
  180. package/dist/sdk/workflow/push-workflow.js +1 -1
  181. package/dist/sdk/workflow/tdx-config.js +1 -1
  182. package/dist/sdk/workflow/workflow-utils.js +1 -1
  183. package/dist/sdk/workspace/access-tracker.js +1 -1
  184. package/dist/sdk/workspace/frontmatter.js +1 -1
  185. package/dist/sdk/workspace/git.d.ts +52 -0
  186. package/dist/sdk/workspace/git.d.ts.map +1 -1
  187. package/dist/sdk/workspace/git.js +1 -1
  188. package/dist/sdk/workspace/git.js.map +1 -1
  189. package/dist/sdk/workspace/index.d.ts +14 -0
  190. package/dist/sdk/workspace/index.d.ts.map +1 -1
  191. package/dist/sdk/workspace/index.js +1 -1
  192. package/dist/sdk/workspace/index.js.map +1 -1
  193. package/dist/sdk/workspace/templates.js +1 -1
  194. package/dist/sdk/workspace/weekly.js +1 -1
  195. package/dist/sdk/workspace/wikilinks.js +1 -1
  196. package/dist/test-utils/command-runner.js +1 -1
  197. package/dist/test-utils/factories.js +1 -1
  198. package/dist/test-utils/fixtures.js +1 -1
  199. package/dist/test-utils/http-mock.js +1 -1
  200. package/dist/test-utils/index.js +1 -1
  201. package/dist/utils/async.js +1 -1
  202. package/dist/utils/colors.js +1 -1
  203. package/dist/utils/diff.js +1 -1
  204. package/dist/utils/file-permissions.js +1 -1
  205. package/dist/utils/file-reader.js +1 -1
  206. package/dist/utils/github-releases.js +1 -1
  207. package/dist/utils/global-cache.js +1 -1
  208. package/dist/utils/json-loader.js +1 -1
  209. package/dist/utils/local-cache.js +1 -1
  210. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  211. package/dist/utils/logger/formatters/index.js +1 -1
  212. package/dist/utils/logger/handlers/console-handler.js +1 -1
  213. package/dist/utils/logger/handlers/file-handler.js +1 -1
  214. package/dist/utils/logger/handlers/index.js +1 -1
  215. package/dist/utils/logger/handlers/null-handler.js +1 -1
  216. package/dist/utils/logger/index.js +1 -1
  217. package/dist/utils/logger/logger.js +1 -1
  218. package/dist/utils/logger/types.js +1 -1
  219. package/dist/utils/option-validation.js +1 -1
  220. package/dist/utils/process.js +1 -1
  221. package/dist/utils/prompt.js +1 -1
  222. package/dist/utils/spinner.js +1 -1
  223. package/dist/utils/sse-parser.js +1 -1
  224. package/dist/utils/string-utils.js +1 -1
  225. package/dist/utils/table-ref-parser.js +1 -1
  226. package/dist/utils/tdx-logger.js +1 -1
  227. package/dist/utils/version-check.js +1 -1
  228. package/package.json +2 -1
@@ -1 +1 @@
1
- const a32_0x36f024=a32_0x28c4;function a32_0xecbe(){const _0x249908=['2522910GVJPpl','6iKTRyf','160gyjYIn','getCurrent','Account\x20Owner','(ID:\x20','No\x20policies\x20found','dim','\x20\x20No\x20permissions','7cgtATw','policy','99492bZLwjS','all','Member','entries',',\x20user_id:','🔑\x20Effective\x20Permissions','length','Fetching\x20policy...','account_owner','22rBqcip','execute','\x20\x20\x20','policy\x20show','operation','account_id','site','\x20\x20•\x20','bold','getPolicy','context','\x20polic','9865304PUxptd','Administrator','451378PxcYMr','getPolicyUsers','getMyPermissions','name','\x20assigned','44204424LHHCXy','max','email','ies','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','validate','policy\x20list','6638395tQpiAy','data','join','log','3muQKyi','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','padEnd','policies','getPolicyPermissions','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','args','\x20\x20No\x20policies\x20assigned','description','permissions','verbose','👥\x20Assigned\x20Users','2873799ENiovr','\x20user'];a32_0xecbe=function(){return _0x249908;};return a32_0xecbe();}(function(_0x19cbf9,_0xe238a2){const _0x174272=a32_0x28c4,_0x44eee7=_0x19cbf9();while(!![]){try{const _0x2b27c4=parseInt(_0x174272(0x224))/0x1*(-parseInt(_0x174272(0x213))/0x2)+-parseInt(_0x174272(0x1fc))/0x3*(parseInt(_0x174272(0x1f3))/0x4)+-parseInt(_0x174272(0x220))/0x5*(parseInt(_0x174272(0x1f2))/0x6)+parseInt(_0x174272(0x1fa))/0x7*(parseInt(_0x174272(0x211))/0x8)+-parseInt(_0x174272(0x1ef))/0x9+parseInt(_0x174272(0x1f1))/0xa*(-parseInt(_0x174272(0x205))/0xb)+parseInt(_0x174272(0x218))/0xc;if(_0x2b27c4===_0xe238a2)break;else _0x44eee7['push'](_0x44eee7['shift']());}catch(_0x5ee7be){_0x44eee7['push'](_0x44eee7['shift']());}}}(a32_0xecbe,0xb9f42));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x2b1353 from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x36f024(0x216)]=a32_0x36f024(0x1fb);[a32_0x36f024(0x1eb)]=a32_0x36f024(0x225);async[a32_0x36f024(0x206)](_0x35442b){const _0x2fdb3c=a32_0x36f024,{options:_0x3d8abb,tdx:_0x1a1011}=_0x35442b,_0x3635be=await withSpinner('Fetching\x20permissions...',async()=>{const _0x3bd243=a32_0x28c4,[_0x2a0027,_0x539590]=await Promise['all']([_0x1a1011['user'][_0x3bd243(0x1f4)](),_0x1a1011[_0x3bd243(0x1fb)][_0x3bd243(0x215)]()]);return{'userInfo':_0x2a0027,'permissions':_0x539590};},{'verbose':_0x3d8abb[_0x2fdb3c(0x1ed)]}),{userInfo:_0x1a88fa,permissions:_0x137ea6}=_0x3635be[_0x2fdb3c(0x221)];if(isStructuredFormat(_0x3d8abb))return await handleSingleObjectOutput(_0x137ea6,_0x3d8abb),0x0;const _0x23bc49=_0x1a88fa[_0x2fdb3c(0x204)]?_0x2fdb3c(0x1f5):_0x1a88fa['administrator']?_0x2fdb3c(0x212):_0x2fdb3c(0x1fe);console['log']('\x0a'+a32_0x2b1353[_0x2fdb3c(0x20d)]('👤')+'\x20'+a32_0x2b1353[_0x2fdb3c(0x20d)](_0x1a88fa[_0x2fdb3c(0x216)])+'\x20'+a32_0x2b1353[_0x2fdb3c(0x1f8)]('('+_0x1a88fa['email']+')')+'\x20—\x20'+_0x23bc49),console[_0x2fdb3c(0x223)](a32_0x2b1353[_0x2fdb3c(0x1f8)](_0x2fdb3c(0x207)+_0x1a1011[_0x2fdb3c(0x20f)][_0x2fdb3c(0x20b)]+':'+_0x1a88fa[_0x2fdb3c(0x20a)]+_0x2fdb3c(0x200)+_0x1a88fa['id']));const _0xd2a47d=_0x137ea6[_0x2fdb3c(0x1e6)];console['log']('\x0a'+a32_0x2b1353[_0x2fdb3c(0x20d)]('📋\x20Assigned\x20Policies')+'\x20('+_0xd2a47d[_0x2fdb3c(0x202)]+'):');if(_0xd2a47d['length']===0x0)console['log'](a32_0x2b1353[_0x2fdb3c(0x1f8)](_0x2fdb3c(0x1ea)));else for(const _0x18ce71 of _0xd2a47d){console['log'](_0x2fdb3c(0x20c)+_0x18ce71[_0x2fdb3c(0x216)]);}return printPermissionsMap(_0x137ea6['permissions']),console[_0x2fdb3c(0x223)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x36f024(0x216)]=a32_0x36f024(0x21f);[a32_0x36f024(0x1eb)]=a32_0x36f024(0x21d);async[a32_0x36f024(0x206)](_0x559f32){const _0x1d13dd=a32_0x36f024,{options:_0x1cbc8e,tdx:_0x21833f}=_0x559f32,_0x3ae16f=await withSpinner('Listing\x20policies...',()=>_0x21833f[_0x1d13dd(0x1fb)]['listPolicies'](),{'verbose':_0x1cbc8e[_0x1d13dd(0x1ed)]}),_0x582c8d=_0x3ae16f['data'];console['error']('✔\x20Found\x20'+_0x582c8d[_0x1d13dd(0x202)]+_0x1d13dd(0x210)+(_0x582c8d[_0x1d13dd(0x202)]!==0x1?_0x1d13dd(0x21b):'y'));if(isStructuredFormat(_0x1cbc8e))return await handleSDKOutput(_0x582c8d,_0x1cbc8e),0x0;if(_0x582c8d['length']===0x0)console[_0x1d13dd(0x223)](a32_0x2b1353['dim'](_0x1d13dd(0x1f7)));else for(const _0x283b9e of _0x582c8d){const _0x27912a=_0x283b9e[_0x1d13dd(0x1eb)]?a32_0x2b1353[_0x1d13dd(0x1f8)]('\x20—\x20'+_0x283b9e['description']):'';console['log'](_0x1d13dd(0x20c)+_0x283b9e[_0x1d13dd(0x216)]+_0x27912a);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x36f024(0x216)]=a32_0x36f024(0x208);[a32_0x36f024(0x1eb)]=a32_0x36f024(0x1e8);[a32_0x36f024(0x21e)](_0x5ad217){const _0xb6dc0d=a32_0x36f024;if(_0x5ad217[_0xb6dc0d(0x1e9)][_0xb6dc0d(0x202)]===0x0)return _0xb6dc0d(0x21c);return undefined;}async['execute'](_0x5b8cba){const _0x180af0=a32_0x36f024,{options:_0x318f08,tdx:_0x4a6aa1}=_0x5b8cba,_0x2b2804=_0x5b8cba[_0x180af0(0x1e9)][0x0],_0x359bcd=await withSpinner(_0x180af0(0x203),async()=>{const _0x534b8c=_0x180af0,_0x5bc34e=await _0x4a6aa1['policy'][_0x534b8c(0x20e)](_0x2b2804),[_0x26404d,_0x41ae01]=await Promise[_0x534b8c(0x1fd)]([_0x4a6aa1[_0x534b8c(0x1fb)][_0x534b8c(0x1e7)](_0x5bc34e['id']),_0x4a6aa1[_0x534b8c(0x1fb)][_0x534b8c(0x214)](_0x5bc34e['id'])]);return{'policy':_0x5bc34e,'perms':_0x26404d,'users':_0x41ae01};},{'verbose':_0x318f08[_0x180af0(0x1ed)]}),{policy:_0x512607,perms:_0x341d99,users:_0x17489c}=_0x359bcd[_0x180af0(0x221)];if(isStructuredFormat(_0x318f08))return await handleSingleObjectOutput({..._0x512607,'permissions':_0x341d99[_0x180af0(0x1ec)],'users':_0x17489c},_0x318f08),0x0;console['log']('\x0a'+a32_0x2b1353['bold']('📋')+'\x20'+a32_0x2b1353['bold'](_0x512607[_0x180af0(0x216)])+'\x20'+a32_0x2b1353[_0x180af0(0x1f8)](_0x180af0(0x1f6)+_0x512607['id']+')'));_0x512607['description']&&console['log']('\x20\x20\x20'+a32_0x2b1353[_0x180af0(0x1f8)](_0x512607[_0x180af0(0x1eb)]));console[_0x180af0(0x223)]('\x20\x20\x20'+_0x17489c[_0x180af0(0x202)]+_0x180af0(0x1f0)+(_0x17489c[_0x180af0(0x202)]!==0x1?'s':'')+_0x180af0(0x217)),printPermissionsMap(_0x341d99['permissions']);if(_0x17489c[_0x180af0(0x202)]>0x0){console['log']('\x0a'+a32_0x2b1353[_0x180af0(0x20d)](_0x180af0(0x1ee))+':');for(const _0x5c151c of _0x17489c){const _0x308233=_0x5c151c[_0x180af0(0x21a)]&&_0x5c151c[_0x180af0(0x21a)]!==_0x5c151c[_0x180af0(0x216)]?a32_0x2b1353[_0x180af0(0x1f8)]('\x20<'+_0x5c151c[_0x180af0(0x21a)]+'>'):'';console[_0x180af0(0x223)](_0x180af0(0x20c)+_0x5c151c[_0x180af0(0x216)]+_0x308233);}}return console['log'](),0x0;}}function a32_0x28c4(_0x1ce506,_0x1fa88c){_0x1ce506=_0x1ce506-0x1e6;const _0xecbea2=a32_0xecbe();let _0x28c4ec=_0xecbea2[_0x1ce506];return _0x28c4ec;}function printPermissionsMap(_0x4e609b){const _0x3a4439=a32_0x36f024,_0x1ccf79=Object[_0x3a4439(0x1ff)](_0x4e609b);console[_0x3a4439(0x223)]('\x0a'+a32_0x2b1353['bold'](_0x3a4439(0x201))+':');if(_0x1ccf79[_0x3a4439(0x202)]===0x0){console['log'](a32_0x2b1353[_0x3a4439(0x1f8)](_0x3a4439(0x1f9)));return;}const _0x4d1ddd=Math[_0x3a4439(0x219)](..._0x1ccf79['map'](([_0x46333d])=>_0x46333d[_0x3a4439(0x202)]));for(const [_0x153c93,_0x244920]of _0x1ccf79){const _0x28fc67=formatOperations(_0x244920);console[_0x3a4439(0x223)]('\x20\x20'+_0x153c93[_0x3a4439(0x226)](_0x4d1ddd+0x2)+_0x28fc67);}}function formatOperations(_0x55b2c7){const _0x53bbc4=a32_0x36f024,_0x296f6a=[...new Set(_0x55b2c7['map'](_0x2ff75e=>_0x2ff75e[_0x53bbc4(0x209)]))];return _0x296f6a[_0x53bbc4(0x222)](',\x20');}
1
+ const a32_0x4137ca=a32_0x314d;function a32_0x48a2(){const _0x355d66=['Account\x20Owner','\x20—\x20','verbose','name','\x20\x20•\x20','150272cXKNZp','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','🔑\x20Effective\x20Permissions','38094ZppnUY','261LneIhk','account_owner','administrator','policy','padEnd','description','Fetching\x20permissions...','length',',\x20user_id:','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','execute','15355080zpALXE','No\x20policies\x20found','ies','listPolicies','permissions','4WiZFNl','\x20\x20\x20','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','Member','context','data','operation','1559614rUmicU','204832yHaSIk','getPolicyUsers','args','140knJOHx','1038468YqGqMX','Administrator','email','join','Listing\x20policies...','bold','682545xqLzgd','✔\x20Found\x20','getPolicyPermissions','log','(ID:\x20','map','dim','getMyPermissions','getCurrent','\x20\x20No\x20permissions','Fetching\x20policy...','max','📋\x20Assigned\x20Policies','\x20polic'];a32_0x48a2=function(){return _0x355d66;};return a32_0x48a2();}(function(_0x4398e9,_0x4062e1){const _0x286cc1=a32_0x314d,_0x3b913e=_0x4398e9();while(!![]){try{const _0x124ca6=-parseInt(_0x286cc1(0x202))/0x1+-parseInt(_0x286cc1(0x1e9))/0x2+parseInt(_0x286cc1(0x1ef))/0x3*(parseInt(_0x286cc1(0x1dd))/0x4)+-parseInt(_0x286cc1(0x1e8))/0x5*(parseInt(_0x286cc1(0x1cc))/0x6)+parseInt(_0x286cc1(0x1e4))/0x7+parseInt(_0x286cc1(0x1e5))/0x8*(-parseInt(_0x286cc1(0x1cd))/0x9)+parseInt(_0x286cc1(0x1d8))/0xa;if(_0x124ca6===_0x4062e1)break;else _0x3b913e['push'](_0x3b913e['shift']());}catch(_0x328e84){_0x3b913e['push'](_0x3b913e['shift']());}}}(a32_0x48a2,0x60aff));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';function a32_0x314d(_0x51c7f2,_0x13a828){_0x51c7f2=_0x51c7f2-0x1cc;const _0x48a299=a32_0x48a2();let _0x314d39=_0x48a299[_0x51c7f2];return _0x314d39;}import{withSpinner}from'../utils/spinner.js';import a32_0xbb0d72 from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x4137ca(0x200)]=a32_0x4137ca(0x1d0);[a32_0x4137ca(0x1d2)]=a32_0x4137ca(0x1d6);async[a32_0x4137ca(0x1d7)](_0xb4e6bf){const _0x9c8464=a32_0x4137ca,{options:_0x56a846,tdx:_0x268386}=_0xb4e6bf,_0x4ae5c3=await withSpinner(_0x9c8464(0x1d3),async()=>{const _0x4f933c=_0x9c8464,[_0x51988a,_0x16ce59]=await Promise['all']([_0x268386['user'][_0x4f933c(0x1f7)](),_0x268386[_0x4f933c(0x1d0)][_0x4f933c(0x1f6)]()]);return{'userInfo':_0x51988a,'permissions':_0x16ce59};},{'verbose':_0x56a846[_0x9c8464(0x1ff)]}),{userInfo:_0x1b0229,permissions:_0x2e31b2}=_0x4ae5c3[_0x9c8464(0x1e2)];if(isStructuredFormat(_0x56a846))return await handleSingleObjectOutput(_0x2e31b2,_0x56a846),0x0;const _0x26afc7=_0x1b0229[_0x9c8464(0x1ce)]?_0x9c8464(0x1fd):_0x1b0229[_0x9c8464(0x1cf)]?_0x9c8464(0x1ea):_0x9c8464(0x1e0);console[_0x9c8464(0x1f2)]('\x0a'+a32_0xbb0d72['bold']('👤')+'\x20'+a32_0xbb0d72[_0x9c8464(0x1ee)](_0x1b0229[_0x9c8464(0x200)])+'\x20'+a32_0xbb0d72[_0x9c8464(0x1f5)]('('+_0x1b0229[_0x9c8464(0x1eb)]+')')+_0x9c8464(0x1fe)+_0x26afc7),console['log'](a32_0xbb0d72['dim'](_0x9c8464(0x1de)+_0x268386[_0x9c8464(0x1e1)]['site']+':'+_0x1b0229['account_id']+_0x9c8464(0x1d5)+_0x1b0229['id']));const _0x469ccb=_0x2e31b2['policies'];console[_0x9c8464(0x1f2)]('\x0a'+a32_0xbb0d72[_0x9c8464(0x1ee)](_0x9c8464(0x1fb))+'\x20('+_0x469ccb[_0x9c8464(0x1d4)]+'):');if(_0x469ccb[_0x9c8464(0x1d4)]===0x0)console[_0x9c8464(0x1f2)](a32_0xbb0d72[_0x9c8464(0x1f5)]('\x20\x20No\x20policies\x20assigned'));else for(const _0x4442d0 of _0x469ccb){console[_0x9c8464(0x1f2)](_0x9c8464(0x201)+_0x4442d0[_0x9c8464(0x200)]);}return printPermissionsMap(_0x2e31b2[_0x9c8464(0x1dc)]),console[_0x9c8464(0x1f2)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a32_0x4137ca(0x200)]='policy\x20list';[a32_0x4137ca(0x1d2)]='List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)';async[a32_0x4137ca(0x1d7)](_0x4926e9){const _0xd76bd1=a32_0x4137ca,{options:_0x35270f,tdx:_0x51af6e}=_0x4926e9,_0x2b0095=await withSpinner(_0xd76bd1(0x1ed),()=>_0x51af6e[_0xd76bd1(0x1d0)][_0xd76bd1(0x1db)](),{'verbose':_0x35270f[_0xd76bd1(0x1ff)]}),_0x1a5da8=_0x2b0095[_0xd76bd1(0x1e2)];console['error'](_0xd76bd1(0x1f0)+_0x1a5da8[_0xd76bd1(0x1d4)]+_0xd76bd1(0x1fc)+(_0x1a5da8[_0xd76bd1(0x1d4)]!==0x1?_0xd76bd1(0x1da):'y'));if(isStructuredFormat(_0x35270f))return await handleSDKOutput(_0x1a5da8,_0x35270f),0x0;if(_0x1a5da8[_0xd76bd1(0x1d4)]===0x0)console[_0xd76bd1(0x1f2)](a32_0xbb0d72[_0xd76bd1(0x1f5)](_0xd76bd1(0x1d9)));else for(const _0x28eb0a of _0x1a5da8){const _0x10a8f2=_0x28eb0a[_0xd76bd1(0x1d2)]?a32_0xbb0d72['dim'](_0xd76bd1(0x1fe)+_0x28eb0a['description']):'';console[_0xd76bd1(0x1f2)](_0xd76bd1(0x201)+_0x28eb0a['name']+_0x10a8f2);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x4137ca(0x200)]='policy\x20show';['description']=a32_0x4137ca(0x203);['validate'](_0x16159b){const _0x39d1ec=a32_0x4137ca;if(_0x16159b[_0x39d1ec(0x1e7)][_0x39d1ec(0x1d4)]===0x0)return _0x39d1ec(0x1df);return undefined;}async[a32_0x4137ca(0x1d7)](_0x450340){const _0x59d278=a32_0x4137ca,{options:_0x1de727,tdx:_0x30a2f9}=_0x450340,_0xacee77=_0x450340[_0x59d278(0x1e7)][0x0],_0x34c4ae=await withSpinner(_0x59d278(0x1f9),async()=>{const _0x11235c=_0x59d278,_0x23302f=await _0x30a2f9[_0x11235c(0x1d0)]['getPolicy'](_0xacee77),[_0x350a36,_0x5d4420]=await Promise['all']([_0x30a2f9['policy'][_0x11235c(0x1f1)](_0x23302f['id']),_0x30a2f9['policy'][_0x11235c(0x1e6)](_0x23302f['id'])]);return{'policy':_0x23302f,'perms':_0x350a36,'users':_0x5d4420};},{'verbose':_0x1de727[_0x59d278(0x1ff)]}),{policy:_0x3a7fbb,perms:_0x40eb69,users:_0x159ff7}=_0x34c4ae[_0x59d278(0x1e2)];if(isStructuredFormat(_0x1de727))return await handleSingleObjectOutput({..._0x3a7fbb,'permissions':_0x40eb69['permissions'],'users':_0x159ff7},_0x1de727),0x0;console[_0x59d278(0x1f2)]('\x0a'+a32_0xbb0d72[_0x59d278(0x1ee)]('📋')+'\x20'+a32_0xbb0d72[_0x59d278(0x1ee)](_0x3a7fbb[_0x59d278(0x200)])+'\x20'+a32_0xbb0d72['dim'](_0x59d278(0x1f3)+_0x3a7fbb['id']+')'));_0x3a7fbb[_0x59d278(0x1d2)]&&console['log'](_0x59d278(0x1de)+a32_0xbb0d72[_0x59d278(0x1f5)](_0x3a7fbb['description']));console[_0x59d278(0x1f2)](_0x59d278(0x1de)+_0x159ff7[_0x59d278(0x1d4)]+'\x20user'+(_0x159ff7[_0x59d278(0x1d4)]!==0x1?'s':'')+'\x20assigned'),printPermissionsMap(_0x40eb69[_0x59d278(0x1dc)]);if(_0x159ff7['length']>0x0){console[_0x59d278(0x1f2)]('\x0a'+a32_0xbb0d72['bold']('👥\x20Assigned\x20Users')+':');for(const _0x487481 of _0x159ff7){const _0x5c6793=_0x487481[_0x59d278(0x1eb)]&&_0x487481[_0x59d278(0x1eb)]!==_0x487481[_0x59d278(0x200)]?a32_0xbb0d72[_0x59d278(0x1f5)]('\x20<'+_0x487481[_0x59d278(0x1eb)]+'>'):'';console[_0x59d278(0x1f2)]('\x20\x20•\x20'+_0x487481[_0x59d278(0x200)]+_0x5c6793);}}return console[_0x59d278(0x1f2)](),0x0;}}function printPermissionsMap(_0x3ba263){const _0x1879ae=a32_0x4137ca,_0x19f6d5=Object['entries'](_0x3ba263);console[_0x1879ae(0x1f2)]('\x0a'+a32_0xbb0d72[_0x1879ae(0x1ee)](_0x1879ae(0x204))+':');if(_0x19f6d5[_0x1879ae(0x1d4)]===0x0){console['log'](a32_0xbb0d72[_0x1879ae(0x1f5)](_0x1879ae(0x1f8)));return;}const _0x22cafc=Math[_0x1879ae(0x1fa)](..._0x19f6d5[_0x1879ae(0x1f4)](([_0x5a3b9e])=>_0x5a3b9e[_0x1879ae(0x1d4)]));for(const [_0x76f336,_0x41f393]of _0x19f6d5){const _0x481c33=formatOperations(_0x41f393);console[_0x1879ae(0x1f2)]('\x20\x20'+_0x76f336[_0x1879ae(0x1d1)](_0x22cafc+0x2)+_0x481c33);}}function formatOperations(_0x402b05){const _0x54154b=a32_0x4137ca,_0x8abedb=[...new Set(_0x402b05[_0x54154b(0x1f4)](_0x315634=>_0x315634[_0x54154b(0x1e3)]))];return _0x8abedb[_0x54154b(0x1ec)](',\x20');}
@@ -1 +1 @@
1
- const a33_0x33fff9=a33_0x21de;(function(_0x371b97,_0x139159){const _0x1b0237=a33_0x21de,_0x2e16b7=_0x371b97();while(!![]){try{const _0x2e7eeb=parseInt(_0x1b0237(0x131))/0x1+parseInt(_0x1b0237(0xe7))/0x2*(parseInt(_0x1b0237(0x137))/0x3)+-parseInt(_0x1b0237(0xed))/0x4+-parseInt(_0x1b0237(0x10a))/0x5*(-parseInt(_0x1b0237(0x12d))/0x6)+-parseInt(_0x1b0237(0x113))/0x7+-parseInt(_0x1b0237(0xf1))/0x8*(parseInt(_0x1b0237(0x136))/0x9)+-parseInt(_0x1b0237(0x11b))/0xa*(-parseInt(_0x1b0237(0x120))/0xb);if(_0x2e7eeb===_0x139159)break;else _0x2e16b7['push'](_0x2e16b7['shift']());}catch(_0xd19072){_0x2e16b7['push'](_0x2e16b7['shift']());}}}(a33_0x4b05,0xe1fa9));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_0x2d12c8 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';function a33_0x4b05(){const _0x3ccab7=['\x20API\x20key\x20saved\x20to\x20system\x20keychain','tdx:\x20profile\x20create','profile','includes','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x20\x20tdx\x20--profile\x20','\x0aSaved\x20to:\x20','305346OJtKak','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','\x27\x20requires\x20API\x20key\x20validation.','password','428279zSpZZJ','profile:use','status','apiKey','skipExistsCheck','729RsEDUs','3GzfZxS','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','\x0aSetup\x20cancelled','log','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','message','tdx:\x20profile\x20set','yellow','\x20\x20-\x20','Changing\x20site\x20to\x20\x27','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','(session:\x20','tdx.json','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','profileName','text','logLevel','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Enter\x20your\x20TD\x20API\x20key:','Profile\x20\x27','green','\x20\x20(no\x20profiles\x20found)','trim','Create\x20a\x20new\x20profile','dim','VALID_KEYS','default','1887078pBUXGF','create','confirm','Validating\x20API\x20key...','llm_project','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>','5540672SJZKjM','error','oauth','all','167792qWNEhp','\x0aAvailable\x20profiles:','API\x20key\x20cannot\x20be\x20empty','join','site','bold','description','test','profile:delete','Enter\x20profile\x20name:','red','Removal\x20cancelled','You\x20can\x20find\x20your\x20API\x20key\x20at:','validate','tdx:\x20profile\x20delete','Delete\x20a\x20profile','Setup\x20cancelled','warn','email','config','Profile\x20name\x20cannot\x20be\x20empty','split','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','length','Removed\x20existing\x20profile\x20\x27','140vUNNTn','\x27\x20created','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','/app/mp/ak','Enter\x20description\x20(optional):','\x20Profile\x20\x27','Set\x20a\x20profile\x20configuration\x20value','jobs','12029094kOZLSw','name','\x0aOperation\x20cancelled','✗\x20Validation\x20failed:\x20','profile:set','Set\x20session\x20profile','\x27\x20does\x20not\x20exist.','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','10GZorEa','us01','getUserInfo','Failed\x20to\x20delete\x20profile:\x20','ERROR','32244817gsYQdz','force','session','execute','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'];a33_0x4b05=function(){return _0x3ccab7;};return a33_0x4b05();}import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a33_0x32fb1d from'prompts';import a33_0x11d744 from'chalk';function validateProfileName(_0x242bf3,_0x4eae7a){const _0x519348=a33_0x21de;if(!_0x242bf3||!_0x242bf3[_0x519348(0xe2)]())return _0x519348(0x105);const _0x2543c2=_0x242bf3[_0x519348(0xe2)]();if(!/^[a-zA-Z0-9_-]+$/[_0x519348(0xf8)](_0x2543c2))return _0x519348(0x138);if(!_0x4eae7a?.[_0x519348(0x135)]&&profileExists(_0x2543c2))return _0x519348(0xdf)+_0x2543c2+_0x519348(0x107)+_0x2543c2+_0x519348(0x13b);return!![];}async function deleteProfileAndCredentials(_0x42e6e5){const _0x1b5f78=a33_0x21de;removeProfileFromUserConfig(_0x42e6e5);const _0x6107f9=await isKeychainAvailable();_0x6107f9&&await Promise[_0x1b5f78(0xf0)]([deleteKeychainAPIKey(_0x42e6e5),deleteOAuthTokens(_0x42e6e5)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x33fff9(0x114)]='profile:create';[a33_0x33fff9(0xf7)]=a33_0x33fff9(0xe3);async['execute'](_0x35cd8a){const _0x377b0a=a33_0x33fff9,{options:_0xa4b2e3,args:_0x30841c}=_0x35cd8a,_0x5a6ff7=!!_0xa4b2e3[_0x377b0a(0x121)];console[_0x377b0a(0x13a)](a33_0x11d744['bold'](_0x377b0a(0x127)));let _0x5492ed;if(_0x30841c[_0x377b0a(0x108)]>0x0&&_0x30841c[0x0]){const _0x34425d=_0x30841c[0x0][_0x377b0a(0xe2)]();_0x5a6ff7&&profileExists(_0x34425d)&&(await deleteProfileAndCredentials(_0x34425d),console['log'](_0x377b0a(0x109)+_0x34425d+'\x27'));const _0xff2f35=validateProfileName(_0x34425d);if(_0xff2f35!==!![])return console[_0x377b0a(0xee)](a33_0x11d744[_0x377b0a(0xfb)](_0xff2f35)),0x1;_0x5492ed=_0x34425d;}else{const _0x2d4852=await a33_0x32fb1d({'type':_0x377b0a(0xd9),'name':_0x377b0a(0xd8),'message':_0x377b0a(0xfa),'validate':_0x33f2bf=>validateProfileName(_0x33f2bf,{'skipExistsCheck':_0x5a6ff7})});if(!_0x2d4852['profileName'])return console[_0x377b0a(0x13a)](_0x377b0a(0x139)),0x1;_0x5492ed=_0x2d4852['profileName'][_0x377b0a(0xe2)](),_0x5a6ff7&&profileExists(_0x5492ed)&&(await deleteProfileAndCredentials(_0x5492ed),console[_0x377b0a(0x13a)](_0x377b0a(0x109)+_0x5492ed+'\x27'));}const _0x108305=await a33_0x32fb1d({'type':_0x377b0a(0xd9),'name':_0x377b0a(0xf7),'message':_0x377b0a(0x10f)}),_0x4c95f7=_0x108305[_0x377b0a(0xf7)]?.[_0x377b0a(0xe2)]()||undefined,_0x10320c=_0xa4b2e3[_0x377b0a(0xf5)]||_0x377b0a(0x11c),_0x56ac77=await promptSiteSelection(_0x10320c,_0x5492ed,_0x377b0a(0x101));if(!_0x56ac77)return 0x1;const _0x2425d6=resolveSite(_0x56ac77),_0x3419b5=await promptAuthMethod();if(!_0x3419b5)return console['log'](_0x377b0a(0x139)),0x1;if(_0x3419b5===_0x377b0a(0xef)){if(_0x4c95f7){const _0x15a81e={'site':_0x2425d6,'description':_0x4c95f7};saveProfileToUserConfig(_0x5492ed,_0x15a81e);}const {accountName:_0x3d214c}=_0xa4b2e3;return await runOAuthLoginFlow(_0x2425d6,_0x5492ed,_0xa4b2e3[_0x377b0a(0xda)]??LogLevel[_0x377b0a(0x11f)],{'accountName':_0x3d214c}),0x0;}console[_0x377b0a(0x13a)](_0x377b0a(0x125)+_0x2425d6),console['log'](_0x377b0a(0xfd)),console['log']('\x20\x20'+getConsoleUrl(_0x2425d6,_0x377b0a(0x10e)));const _0x593d14=await a33_0x32fb1d({'type':_0x377b0a(0x130),'name':'apiKey','message':_0x377b0a(0xde),'validate':_0x481ffd=>{const _0x650912=_0x377b0a;if(!_0x481ffd||!_0x481ffd[_0x650912(0xe2)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x593d14[_0x377b0a(0x134)])return console[_0x377b0a(0x13a)](_0x377b0a(0x139)),0x1;const _0x53d58f=_0x593d14[_0x377b0a(0x134)];console[_0x377b0a(0x13a)](_0x377b0a(0xea));try{const _0x5cf09c=TDX[_0x377b0a(0xe8)]({'site':_0x2425d6,'apiKey':_0x53d58f['trim'](),'logLevel':_0xa4b2e3[_0x377b0a(0xda)]??LogLevel['ERROR']}),_0x58d861=await _0x5cf09c[_0x377b0a(0x112)][_0x377b0a(0x11d)]();console[_0x377b0a(0x13a)](a33_0x11d744[_0x377b0a(0xe0)]('✓')+_0x377b0a(0xdc)+_0x58d861[_0x377b0a(0x103)]+')');const _0x2f748f=await isKeychainAvailable();_0x2f748f?(await saveAPIKeyAsync(_0x53d58f[_0x377b0a(0xe2)](),_0x2425d6,_0x5492ed),console[_0x377b0a(0x13a)](a33_0x11d744['green']('✓')+_0x377b0a(0x10d)+_0x5492ed+')')):(console['warn'](a33_0x11d744[_0x377b0a(0x13e)](_0x377b0a(0xdb))),console[_0x377b0a(0x102)](a33_0x11d744[_0x377b0a(0x13e)](_0x377b0a(0x124))));const _0x3d2d14={'site':_0x2425d6,..._0x4c95f7&&{'description':_0x4c95f7}};return saveProfileToUserConfig(_0x5492ed,_0x3d2d14),console['log'](a33_0x11d744[_0x377b0a(0xe0)]('✓')+'\x20Profile\x20\x27'+_0x5492ed+_0x377b0a(0x10b)),console[_0x377b0a(0x13a)](),console[_0x377b0a(0x13a)](_0x377b0a(0x12e)),console[_0x377b0a(0x13a)](_0x377b0a(0x12b)+_0x5492ed+_0x377b0a(0x10c)),console['log']('\x20\x20tdx\x20--profile\x20'+_0x5492ed+_0x377b0a(0xdd)),0x0;}catch(_0x47715a){if(_0x47715a instanceof HTTPClientError&&_0x47715a[_0x377b0a(0x133)]===0x191)return printAuthError(_0x47715a),0x1;return console['error'](a33_0x11d744['red'](_0x377b0a(0x116)+(_0x47715a instanceof Error?_0x47715a[_0x377b0a(0x13c)]:String(_0x47715a)))),console['error']('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x33fff9(0x114)]=a33_0x33fff9(0xf9);[a33_0x33fff9(0xf7)]=a33_0x33fff9(0x100);[a33_0x33fff9(0xfe)](_0x1492a3){const _0xb6417e=a33_0x33fff9,{args:_0x2ebca2}=_0x1492a3;if(_0x2ebca2[_0xb6417e(0x108)]===0x0)return _0xb6417e(0x11a);return undefined;}async[a33_0x33fff9(0x123)](_0x4d027c){const _0x2c16da=a33_0x33fff9,{args:_0x5b8247}=_0x4d027c,_0x596aba=_0x5b8247[0x0];console['log'](a33_0x11d744[_0x2c16da(0xf6)](_0x2c16da(0xff)));if(!profileExists(_0x596aba)){console[_0x2c16da(0xee)](a33_0x11d744[_0x2c16da(0xfb)](_0x2c16da(0xdf)+_0x596aba+_0x2c16da(0x119))),console[_0x2c16da(0x13a)](_0x2c16da(0xf2));const _0x4c7e17=listProfiles();if(_0x4c7e17[_0x2c16da(0x108)]===0x0)console[_0x2c16da(0x13a)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x1c4fa4 of _0x4c7e17){console[_0x2c16da(0x13a)]('\x20\x20-\x20'+_0x1c4fa4[_0x2c16da(0x114)]);}return 0x1;}const _0x3cdeeb=await a33_0x32fb1d({'type':_0x2c16da(0xe9),'name':'confirm','message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x596aba+'\x27?','initial':![]});if(!_0x3cdeeb[_0x2c16da(0xe9)])return console[_0x2c16da(0x13a)](_0x2c16da(0xfc)),0x0;try{await deleteProfileAndCredentials(_0x596aba),console[_0x2c16da(0x13a)](a33_0x11d744['green']('✓')+'\x20Profile\x20\x27'+_0x596aba+'\x27\x20deleted');}catch(_0x16287f){return console[_0x2c16da(0xee)](a33_0x11d744['red'](_0x2c16da(0x11e)+(_0x16287f instanceof Error?_0x16287f[_0x2c16da(0x13c)]:String(_0x16287f)))),0x1;}return 0x0;}}function a33_0x21de(_0x390b18,_0x120f5a){_0x390b18=_0x390b18-0xd4;const _0x4b05f8=a33_0x4b05();let _0x21defa=_0x4b05f8[_0x390b18];return _0x21defa;}export class ProfileSetCommand extends BaseCommand{['name']=a33_0x33fff9(0x117);[a33_0x33fff9(0xf7)]=a33_0x33fff9(0x111);static [a33_0x33fff9(0xe5)]=[a33_0x33fff9(0xf5),'database','parent_segment',a33_0x33fff9(0xeb),'llm_agent','description'];[a33_0x33fff9(0xfe)](_0x26a815){const _0x5c262c=a33_0x33fff9,{args:_0x459229,options:_0x33357e}=_0x26a815,_0x585ef1=_0x33357e[_0x5c262c(0x128)]||getActiveProfile();if(!_0x585ef1)return _0x5c262c(0xec);if(_0x459229['length']===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x5c262c(0xe5)][_0x5c262c(0xf4)](',\x20');const _0x9c583e=_0x459229[0x0];if(!_0x9c583e[_0x5c262c(0x129)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS']['join'](',\x20');const [_0x1e534d]=_0x9c583e[_0x5c262c(0x106)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x5c262c(0x129)](_0x1e534d))return'Unknown\x20key\x20\x27'+_0x1e534d+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x5c262c(0xe5)][_0x5c262c(0xf4)](',\x20');return undefined;}async['execute'](_0x2622b8){const _0x14f4e7=a33_0x33fff9,{args:_0x119b69,options:_0xe966d2}=_0x2622b8,_0x269007=_0xe966d2[_0x14f4e7(0x128)]||getActiveProfile(),[_0x21b426,..._0x594fad]=_0x119b69[0x0][_0x14f4e7(0x106)]('='),_0x4f0ea3=_0x594fad['join']('=');console[_0x14f4e7(0x13a)](a33_0x11d744['bold'](_0x14f4e7(0x13d)));if(!profileExists(_0x269007)){const _0x2cdacc=await a33_0x32fb1d({'type':_0x14f4e7(0xe9),'name':_0x14f4e7(0xe8),'message':_0x14f4e7(0xdf)+_0x269007+_0x14f4e7(0x12a),'initial':!![]});if(!_0x2cdacc[_0x14f4e7(0xe8)])return console['log']('Operation\x20cancelled'),0x1;}const _0x110718=loadProfile(_0x269007),_0x2eac04=_0x110718?.[_0x14f4e7(0x104)]||{};if(_0x21b426===_0x14f4e7(0xf5)){const _0x85cd1a=resolveSite(_0x4f0ea3);console[_0x14f4e7(0x13a)](_0x14f4e7(0x140)+_0x85cd1a+_0x14f4e7(0x12f)),console[_0x14f4e7(0x13a)](_0x14f4e7(0xd7)),console[_0x14f4e7(0x13a)]('\x20\x20'+getConsoleUrl(_0x85cd1a,_0x14f4e7(0x10e)));const _0x4b4ca0=await a33_0x32fb1d({'type':_0x14f4e7(0x130),'name':_0x14f4e7(0x134),'message':_0x14f4e7(0xd4),'validate':_0x48ce9b=>{const _0xa9545d=_0x14f4e7;if(!_0x48ce9b||!_0x48ce9b['trim']())return _0xa9545d(0xf3);return!![];}});if(!_0x4b4ca0[_0x14f4e7(0x134)])return console[_0x14f4e7(0x13a)](_0x14f4e7(0x115)),0x1;console['log'](_0x14f4e7(0xea));try{const _0x24b965=TDX['create']({'site':_0x85cd1a,'apiKey':_0x4b4ca0[_0x14f4e7(0x134)][_0x14f4e7(0xe2)](),'logLevel':_0xe966d2['logLevel']??LogLevel[_0x14f4e7(0x11f)]}),_0x33be44=await _0x24b965[_0x14f4e7(0x112)][_0x14f4e7(0x11d)]();console['log'](a33_0x11d744[_0x14f4e7(0xe0)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x33be44[_0x14f4e7(0x103)]+')');const _0x112086=await isKeychainAvailable();_0x112086?(await saveAPIKeyAsync(_0x4b4ca0[_0x14f4e7(0x134)][_0x14f4e7(0xe2)](),_0x85cd1a,_0x269007),console[_0x14f4e7(0x13a)](a33_0x11d744[_0x14f4e7(0xe0)]('✓')+_0x14f4e7(0x126))):console[_0x14f4e7(0x102)](a33_0x11d744[_0x14f4e7(0x13e)](_0x14f4e7(0xdb))),_0x2eac04[_0x14f4e7(0xf5)]=_0x85cd1a;}catch(_0x164f63){if(_0x164f63 instanceof HTTPClientError&&_0x164f63[_0x14f4e7(0x133)]===0x191)return printAuthError(_0x164f63),0x1;return console[_0x14f4e7(0xee)](a33_0x11d744[_0x14f4e7(0xfb)](_0x14f4e7(0x116)+(_0x164f63 instanceof Error?_0x164f63[_0x14f4e7(0x13c)]:String(_0x164f63)))),console['error']('Site\x20was\x20not\x20changed.'),0x1;}}else _0x2eac04[_0x21b426]=_0x4f0ea3||undefined;return saveProfileToUserConfig(_0x269007,_0x2eac04),console[_0x14f4e7(0x13a)](a33_0x11d744['green']('✓')+_0x14f4e7(0x110)+_0x269007+'\x27\x20updated:\x20'+_0x21b426+'='+(_0x4f0ea3||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a33_0x33fff9(0x132);[a33_0x33fff9(0xf7)]=a33_0x33fff9(0x118);[a33_0x33fff9(0xfe)](_0x13578c){const _0x3fd1fc=a33_0x33fff9,{args:_0x22e873}=_0x13578c;if(_0x22e873[_0x3fd1fc(0x108)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a33_0x33fff9(0x123)](_0x40a713){const _0xbd7c9=a33_0x33fff9,{args:_0x3b04b4,options:_0x355609}=_0x40a713,_0x5001ae=_0x3b04b4[0x0],_0x409445=_0x355609[_0xbd7c9(0xe6)];cleanExpiredSessions();if(!profileExists(_0x5001ae)){console[_0xbd7c9(0xee)](a33_0x11d744[_0xbd7c9(0xfb)](_0xbd7c9(0xdf)+_0x5001ae+_0xbd7c9(0x119))),console[_0xbd7c9(0x13a)](_0xbd7c9(0xf2));const _0x4cfbab=listProfiles();if(_0x4cfbab[_0xbd7c9(0x108)]===0x0)console[_0xbd7c9(0x13a)](_0xbd7c9(0xe1));else for(const _0x2cc958 of _0x4cfbab){console[_0xbd7c9(0x13a)](_0xbd7c9(0x13f)+_0x2cc958[_0xbd7c9(0x114)]);}return 0x1;}if(_0x409445){const _0x1e8bf2=a33_0x2d12c8[_0xbd7c9(0xf4)](getConfigDir(),_0xbd7c9(0xd6));return saveActiveProfileToUserConfig(_0x5001ae),console[_0xbd7c9(0x13a)]('Default\x20profile\x20set\x20to:\x20'+a33_0x11d744[_0xbd7c9(0xe0)](_0x5001ae)),console[_0xbd7c9(0x13a)](a33_0x11d744[_0xbd7c9(0xe4)](_0xbd7c9(0x12c)+_0x1e8bf2)),0x0;}const _0x3e742d=getSessionID(_0x355609[_0xbd7c9(0x122)]);return saveSessionContext({'profile':_0x5001ae},_0x355609[_0xbd7c9(0x122)]),console[_0xbd7c9(0x13a)]('Session\x20profile\x20set\x20to:\x20'+a33_0x11d744['green'](_0x5001ae)+'\x20'+a33_0x11d744[_0xbd7c9(0xe4)](_0xbd7c9(0xd5)+_0x3e742d+')')),console['log'](a33_0x11d744[_0xbd7c9(0xe4)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x5001ae+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
1
+ const a33_0x1fc065=a33_0x3eb6;(function(_0x4e64e3,_0xae3739){const _0x54018d=a33_0x3eb6,_0x5c0a68=_0x4e64e3();while(!![]){try{const _0x13960e=-parseInt(_0x54018d(0x197))/0x1+-parseInt(_0x54018d(0x1c0))/0x2+parseInt(_0x54018d(0x1e0))/0x3*(-parseInt(_0x54018d(0x1b2))/0x4)+-parseInt(_0x54018d(0x1c3))/0x5*(parseInt(_0x54018d(0x1e9))/0x6)+-parseInt(_0x54018d(0x1e3))/0x7+parseInt(_0x54018d(0x1dd))/0x8+parseInt(_0x54018d(0x1cd))/0x9;if(_0x13960e===_0xae3739)break;else _0x5c0a68['push'](_0x5c0a68['shift']());}catch(_0x943ec9){_0x5c0a68['push'](_0x5c0a68['shift']());}}}(a33_0x364c,0xa877a));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_0x4d8687 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';function a33_0x3eb6(_0x44bad2,_0x26dbf5){_0x44bad2=_0x44bad2-0x196;const _0x364c8c=a33_0x364c();let _0x3eb6e4=_0x364c8c[_0x44bad2];return _0x3eb6e4;}import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a33_0x2d5d7a from'prompts';import a33_0x283110 from'chalk';function validateProfileName(_0x358c31,_0x25e548){const _0x8b6f9d=a33_0x3eb6;if(!_0x358c31||!_0x358c31[_0x8b6f9d(0x1b7)]())return _0x8b6f9d(0x1a7);const _0x5708ff=_0x358c31[_0x8b6f9d(0x1b7)]();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x5708ff))return _0x8b6f9d(0x1f8);if(!_0x25e548?.[_0x8b6f9d(0x1c2)]&&profileExists(_0x5708ff))return _0x8b6f9d(0x1bf)+_0x5708ff+_0x8b6f9d(0x1df)+_0x5708ff+_0x8b6f9d(0x1bd);return!![];}function a33_0x364c(){const _0x4b0c59=['profile:set','✗\x20Validation\x20failed:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','597872HcxzkX','Enter\x20description\x20(optional):','\x27\x20requires\x20API\x20key\x20validation.','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','Site\x20was\x20not\x20changed.','ERROR','database','\x20\x20(no\x20profiles\x20found)','password','logLevel','(session:\x20','profile:use','Enter\x20your\x20TD\x20API\x20key:','\x0aSaved\x20to:\x20','session','\x27.\x0a\x0aValid\x20keys:\x20','Profile\x20name\x20cannot\x20be\x20empty','llm_agent','validate','\x20API\x20key\x20is\x20valid\x20(User:\x20','execute','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Set\x20a\x20profile\x20configuration\x20value','includes','You\x20can\x20find\x20your\x20API\x20key\x20at:','force','\x20Profile\x20\x27','3242472isWIYn','error','site','Removed\x20existing\x20profile\x20\x27','green','trim','Validating\x20API\x20key...','\x0aOperation\x20cancelled','confirm','description','\x27\x20updated:\x20','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','join','Profile\x20\x27','1767254hKFLsK','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','skipExistsCheck','75SXsJIg','tdx:\x20profile\x20set','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','length','tdx:\x20profile\x20create','split','profileName','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','red','(cleared)','38600478gpWaqP','Unknown\x20key\x20\x27','Set\x20session\x20profile','email','profile:delete','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','llm_project','bold','\x20--default\x27\x20to\x20save\x20permanently','Enter\x20profile\x20name:','\x27\x20does\x20not\x20exist.','parent_segment','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Changing\x20site\x20to\x20\x27','\x0aAvailable\x20profiles:','create','3323616vubvBU','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20','3JQutXw','oauth','Delete\x20a\x20profile','8938090DzxIMa','\x0aSetup\x20cancelled','apiKey','warn','name','yellow','178146aOpqVq','getUserInfo','message','profile','dim','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','text','log','VALID_KEYS','/app/mp/ak','Operation\x20cancelled','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','us01','API\x20key\x20cannot\x20be\x20empty','config','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Session\x20profile\x20set\x20to:\x20','\x20\x20tdx\x20--profile\x20','status','Default\x20profile\x20set\x20to:\x20','all'];a33_0x364c=function(){return _0x4b0c59;};return a33_0x364c();}async function deleteProfileAndCredentials(_0xaad341){const _0x111701=a33_0x3eb6;removeProfileFromUserConfig(_0xaad341);const _0x493a4a=await isKeychainAvailable();_0x493a4a&&await Promise[_0x111701(0x1fe)]([deleteKeychainAPIKey(_0xaad341),deleteOAuthTokens(_0xaad341)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x1fc065(0x1e7)]='profile:create';['description']='Create\x20a\x20new\x20profile';async['execute'](_0x816bba){const _0x22567c=a33_0x1fc065,{options:_0x41faee,args:_0x342d29}=_0x816bba,_0x35d2cc=!!_0x41faee[_0x22567c(0x1b0)];console['log'](a33_0x283110[_0x22567c(0x1d4)](_0x22567c(0x1c7)));let _0x48db37;if(_0x342d29[_0x22567c(0x1c6)]>0x0&&_0x342d29[0x0]){const _0x94585c=_0x342d29[0x0][_0x22567c(0x1b7)]();_0x35d2cc&&profileExists(_0x94585c)&&(await deleteProfileAndCredentials(_0x94585c),console[_0x22567c(0x1f0)](_0x22567c(0x1b5)+_0x94585c+'\x27'));const _0x3bc914=validateProfileName(_0x94585c);if(_0x3bc914!==!![])return console[_0x22567c(0x1b3)](a33_0x283110[_0x22567c(0x1cb)](_0x3bc914)),0x1;_0x48db37=_0x94585c;}else{const _0x2618aa=await a33_0x2d5d7a({'type':_0x22567c(0x1ef),'name':_0x22567c(0x1c9),'message':_0x22567c(0x1d6),'validate':_0x18cbbe=>validateProfileName(_0x18cbbe,{'skipExistsCheck':_0x35d2cc})});if(!_0x2618aa[_0x22567c(0x1c9)])return console[_0x22567c(0x1f0)](_0x22567c(0x1e4)),0x1;_0x48db37=_0x2618aa['profileName']['trim'](),_0x35d2cc&&profileExists(_0x48db37)&&(await deleteProfileAndCredentials(_0x48db37),console[_0x22567c(0x1f0)](_0x22567c(0x1b5)+_0x48db37+'\x27'));}const _0x1bbcb6=await a33_0x2d5d7a({'type':'text','name':_0x22567c(0x1bb),'message':_0x22567c(0x198)}),_0x60258d=_0x1bbcb6['description']?.[_0x22567c(0x1b7)]()||undefined,_0x4bbcf5=_0x41faee['site']||_0x22567c(0x1f5),_0x57ca69=await promptSiteSelection(_0x4bbcf5,_0x48db37,'Setup\x20cancelled');if(!_0x57ca69)return 0x1;const _0x1264a0=resolveSite(_0x57ca69),_0x44dbfc=await promptAuthMethod();if(!_0x44dbfc)return console[_0x22567c(0x1f0)](_0x22567c(0x1e4)),0x1;if(_0x44dbfc===_0x22567c(0x1e1)){if(_0x60258d){const _0x1609fb={'site':_0x1264a0,'description':_0x60258d};saveProfileToUserConfig(_0x48db37,_0x1609fb);}const {accountName:_0x56e590}=_0x41faee;return await runOAuthLoginFlow(_0x1264a0,_0x48db37,_0x41faee['logLevel']??LogLevel[_0x22567c(0x19c)],{'accountName':_0x56e590}),0x0;}console['log'](_0x22567c(0x1f9)+_0x1264a0),console['log'](_0x22567c(0x1af)),console['log']('\x20\x20'+getConsoleUrl(_0x1264a0,_0x22567c(0x1f2)));const _0x495af5=await a33_0x2d5d7a({'type':_0x22567c(0x19f),'name':_0x22567c(0x1e5),'message':_0x22567c(0x1a3),'validate':_0x256132=>{const _0x6c5b91=_0x22567c;if(!_0x256132||!_0x256132[_0x6c5b91(0x1b7)]())return _0x6c5b91(0x1f6);return!![];}});if(!_0x495af5[_0x22567c(0x1e5)])return console['log'](_0x22567c(0x1e4)),0x1;const _0x2af1c6=_0x495af5['apiKey'];console[_0x22567c(0x1f0)]('Validating\x20API\x20key...');try{const _0x1e1005=TDX[_0x22567c(0x1dc)]({'site':_0x1264a0,'apiKey':_0x2af1c6[_0x22567c(0x1b7)](),'logLevel':_0x41faee['logLevel']??LogLevel[_0x22567c(0x19c)]}),_0x55fe84=await _0x1e1005['jobs'][_0x22567c(0x1ea)]();console[_0x22567c(0x1f0)](a33_0x283110[_0x22567c(0x1b6)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x55fe84[_0x22567c(0x1d0)]+')');const _0x110fc8=await isKeychainAvailable();_0x110fc8?(await saveAPIKeyAsync(_0x2af1c6[_0x22567c(0x1b7)](),_0x1264a0,_0x48db37),console[_0x22567c(0x1f0)](a33_0x283110[_0x22567c(0x1b6)]('✓')+_0x22567c(0x1ac)+_0x48db37+')')):(console[_0x22567c(0x1e6)](a33_0x283110[_0x22567c(0x1e8)](_0x22567c(0x1c5))),console[_0x22567c(0x1e6)](a33_0x283110['yellow'](_0x22567c(0x19a))));const _0x90c994={'site':_0x1264a0,..._0x60258d&&{'description':_0x60258d}};return saveProfileToUserConfig(_0x48db37,_0x90c994),console[_0x22567c(0x1f0)](a33_0x283110[_0x22567c(0x1b6)]('✓')+_0x22567c(0x1b1)+_0x48db37+'\x27\x20created'),console[_0x22567c(0x1f0)](),console[_0x22567c(0x1f0)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console['log'](_0x22567c(0x1fb)+_0x48db37+_0x22567c(0x1f4)),console['log'](_0x22567c(0x1fb)+_0x48db37+_0x22567c(0x1d9)),0x0;}catch(_0x407575){if(_0x407575 instanceof HTTPClientError&&_0x407575[_0x22567c(0x1fc)]===0x191)return printAuthError(_0x407575),0x1;return console[_0x22567c(0x1b3)](a33_0x283110[_0x22567c(0x1cb)](_0x22567c(0x200)+(_0x407575 instanceof Error?_0x407575[_0x22567c(0x1eb)]:String(_0x407575)))),console[_0x22567c(0x1b3)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x1fc065(0x1e7)]=a33_0x1fc065(0x1d1);['description']=a33_0x1fc065(0x1e2);[a33_0x1fc065(0x1a9)](_0x4c9ca4){const _0x57b9e6=a33_0x1fc065,{args:_0x23555b}=_0x4c9ca4;if(_0x23555b[_0x57b9e6(0x1c6)]===0x0)return _0x57b9e6(0x196);return undefined;}async[a33_0x1fc065(0x1ab)](_0x45a7fe){const _0x533951=a33_0x1fc065,{args:_0x14cd29}=_0x45a7fe,_0x5989a5=_0x14cd29[0x0];console[_0x533951(0x1f0)](a33_0x283110[_0x533951(0x1d4)]('tdx:\x20profile\x20delete'));if(!profileExists(_0x5989a5)){console[_0x533951(0x1b3)](a33_0x283110[_0x533951(0x1cb)](_0x533951(0x1bf)+_0x5989a5+_0x533951(0x1d7))),console['log']('\x0aAvailable\x20profiles:');const _0x5e925a=listProfiles();if(_0x5e925a[_0x533951(0x1c6)]===0x0)console['log'](_0x533951(0x19e));else for(const _0x22eadf of _0x5e925a){console[_0x533951(0x1f0)]('\x20\x20-\x20'+_0x22eadf[_0x533951(0x1e7)]);}return 0x1;}const _0x23e2f2=await a33_0x2d5d7a({'type':'confirm','name':_0x533951(0x1ba),'message':_0x533951(0x1c1)+_0x5989a5+'\x27?','initial':![]});if(!_0x23e2f2[_0x533951(0x1ba)])return console['log']('Removal\x20cancelled'),0x0;try{await deleteProfileAndCredentials(_0x5989a5),console['log'](a33_0x283110[_0x533951(0x1b6)]('✓')+_0x533951(0x1b1)+_0x5989a5+'\x27\x20deleted');}catch(_0xf2baeb){return console[_0x533951(0x1b3)](a33_0x283110[_0x533951(0x1cb)]('Failed\x20to\x20delete\x20profile:\x20'+(_0xf2baeb instanceof Error?_0xf2baeb[_0x533951(0x1eb)]:String(_0xf2baeb)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0x1fc065(0x1e7)]=a33_0x1fc065(0x1ff);[a33_0x1fc065(0x1bb)]=a33_0x1fc065(0x1ad);static [a33_0x1fc065(0x1f1)]=['site',a33_0x1fc065(0x19d),a33_0x1fc065(0x1d8),a33_0x1fc065(0x1d3),a33_0x1fc065(0x1a8),a33_0x1fc065(0x1bb)];[a33_0x1fc065(0x1a9)](_0x3621e4){const _0x4e9802=a33_0x1fc065,{args:_0x4807c5,options:_0x36eac7}=_0x3621e4,_0x1339b7=_0x36eac7[_0x4e9802(0x1ec)]||getActiveProfile();if(!_0x1339b7)return _0x4e9802(0x1ee);if(_0x4807c5[_0x4e9802(0x1c6)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x4e9802(0x1f1)][_0x4e9802(0x1be)](',\x20');const _0x33b9fe=_0x4807c5[0x0];if(!_0x33b9fe[_0x4e9802(0x1ae)]('='))return _0x4e9802(0x1ca)+ProfileSetCommand[_0x4e9802(0x1f1)][_0x4e9802(0x1be)](',\x20');const [_0x34659b]=_0x33b9fe[_0x4e9802(0x1c8)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x4e9802(0x1ae)](_0x34659b))return _0x4e9802(0x1ce)+_0x34659b+_0x4e9802(0x1a6)+ProfileSetCommand[_0x4e9802(0x1f1)][_0x4e9802(0x1be)](',\x20');return undefined;}async[a33_0x1fc065(0x1ab)](_0x595d55){const _0x418091=a33_0x1fc065,{args:_0x35d864,options:_0x43b4ec}=_0x595d55,_0x498242=_0x43b4ec[_0x418091(0x1ec)]||getActiveProfile(),[_0x353e7f,..._0x3c6232]=_0x35d864[0x0]['split']('='),_0x290bdf=_0x3c6232[_0x418091(0x1be)]('=');console[_0x418091(0x1f0)](a33_0x283110[_0x418091(0x1d4)](_0x418091(0x1c4)));if(!profileExists(_0x498242)){const _0x2379f1=await a33_0x2d5d7a({'type':'confirm','name':_0x418091(0x1dc),'message':_0x418091(0x1bf)+_0x498242+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x2379f1[_0x418091(0x1dc)])return console[_0x418091(0x1f0)](_0x418091(0x1f3)),0x1;}const _0x455321=loadProfile(_0x498242),_0x16261f=_0x455321?.[_0x418091(0x1f7)]||{};if(_0x353e7f===_0x418091(0x1b4)){const _0x5d0166=resolveSite(_0x290bdf);console[_0x418091(0x1f0)](_0x418091(0x1da)+_0x5d0166+_0x418091(0x199)),console[_0x418091(0x1f0)](_0x418091(0x1d2)),console[_0x418091(0x1f0)]('\x20\x20'+getConsoleUrl(_0x5d0166,_0x418091(0x1f2)));const _0x2f9604=await a33_0x2d5d7a({'type':_0x418091(0x19f),'name':_0x418091(0x1e5),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x490bbf=>{const _0x114aed=_0x418091;if(!_0x490bbf||!_0x490bbf[_0x114aed(0x1b7)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x2f9604[_0x418091(0x1e5)])return console[_0x418091(0x1f0)](_0x418091(0x1b9)),0x1;console[_0x418091(0x1f0)](_0x418091(0x1b8));try{const _0x27f31d=TDX[_0x418091(0x1dc)]({'site':_0x5d0166,'apiKey':_0x2f9604[_0x418091(0x1e5)][_0x418091(0x1b7)](),'logLevel':_0x43b4ec[_0x418091(0x1a0)]??LogLevel[_0x418091(0x19c)]}),_0x402086=await _0x27f31d['jobs']['getUserInfo']();console['log'](a33_0x283110[_0x418091(0x1b6)]('✓')+_0x418091(0x1aa)+_0x402086['email']+')');const _0x1b2238=await isKeychainAvailable();_0x1b2238?(await saveAPIKeyAsync(_0x2f9604['apiKey'][_0x418091(0x1b7)](),_0x5d0166,_0x498242),console['log'](a33_0x283110[_0x418091(0x1b6)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x418091(0x1e6)](a33_0x283110[_0x418091(0x1e8)](_0x418091(0x1c5))),_0x16261f[_0x418091(0x1b4)]=_0x5d0166;}catch(_0x132df7){if(_0x132df7 instanceof HTTPClientError&&_0x132df7['status']===0x191)return printAuthError(_0x132df7),0x1;return console[_0x418091(0x1b3)](a33_0x283110[_0x418091(0x1cb)]('✗\x20Validation\x20failed:\x20'+(_0x132df7 instanceof Error?_0x132df7[_0x418091(0x1eb)]:String(_0x132df7)))),console[_0x418091(0x1b3)](_0x418091(0x19b)),0x1;}}else _0x16261f[_0x353e7f]=_0x290bdf||undefined;return saveProfileToUserConfig(_0x498242,_0x16261f),console[_0x418091(0x1f0)](a33_0x283110[_0x418091(0x1b6)]('✓')+_0x418091(0x1b1)+_0x498242+_0x418091(0x1bc)+_0x353e7f+'='+(_0x290bdf||_0x418091(0x1cc))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x1fc065(0x1e7)]=a33_0x1fc065(0x1a2);['description']=a33_0x1fc065(0x1cf);[a33_0x1fc065(0x1a9)](_0xd9385b){const _0x135f3a=a33_0x1fc065,{args:_0x1d8c0d}=_0xd9385b;if(_0x1d8c0d[_0x135f3a(0x1c6)]===0x0)return _0x135f3a(0x1de);return undefined;}async[a33_0x1fc065(0x1ab)](_0x3f6640){const _0xf2045f=a33_0x1fc065,{args:_0xb303f3,options:_0x142377}=_0x3f6640,_0xd28e78=_0xb303f3[0x0],_0x56e4a0=_0x142377['default'];cleanExpiredSessions();if(!profileExists(_0xd28e78)){console['error'](a33_0x283110[_0xf2045f(0x1cb)](_0xf2045f(0x1bf)+_0xd28e78+_0xf2045f(0x1d7))),console[_0xf2045f(0x1f0)](_0xf2045f(0x1db));const _0x12a2f0=listProfiles();if(_0x12a2f0[_0xf2045f(0x1c6)]===0x0)console[_0xf2045f(0x1f0)](_0xf2045f(0x19e));else for(const _0x2175a9 of _0x12a2f0){console[_0xf2045f(0x1f0)]('\x20\x20-\x20'+_0x2175a9['name']);}return 0x1;}if(_0x56e4a0){const _0x5c4a8b=a33_0x4d8687[_0xf2045f(0x1be)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0xd28e78),console[_0xf2045f(0x1f0)](_0xf2045f(0x1fd)+a33_0x283110['green'](_0xd28e78)),console['log'](a33_0x283110[_0xf2045f(0x1ed)](_0xf2045f(0x1a4)+_0x5c4a8b)),0x0;}const _0x2275a=getSessionID(_0x142377[_0xf2045f(0x1a5)]);return saveSessionContext({'profile':_0xd28e78},_0x142377[_0xf2045f(0x1a5)]),console['log'](_0xf2045f(0x1fa)+a33_0x283110['green'](_0xd28e78)+'\x20'+a33_0x283110[_0xf2045f(0x1ed)](_0xf2045f(0x1a1)+_0x2275a+')')),console[_0xf2045f(0x1f0)](a33_0x283110['dim']('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0xd28e78+_0xf2045f(0x1d5))),0x0;}}
@@ -1 +1 @@
1
- const a34_0x5690cd=a34_0x2dbb;(function(_0x4de510,_0x3d262a){const _0x28228f=a34_0x2dbb,_0x1be47e=_0x4de510();while(!![]){try{const _0x141b46=parseInt(_0x28228f(0x1ff))/0x1+-parseInt(_0x28228f(0x1f6))/0x2+-parseInt(_0x28228f(0x1ed))/0x3+-parseInt(_0x28228f(0x1ee))/0x4+-parseInt(_0x28228f(0x201))/0x5+parseInt(_0x28228f(0x1f3))/0x6+parseInt(_0x28228f(0x1f2))/0x7*(parseInt(_0x28228f(0x1f5))/0x8);if(_0x141b46===_0x3d262a)break;else _0x1be47e['push'](_0x1be47e['shift']());}catch(_0x52b743){_0x1be47e['push'](_0x1be47e['shift']());}}}(a34_0x39ae,0x9410f));function a34_0x2dbb(_0x1caa5d,_0x31947e){_0x1caa5d=_0x1caa5d-0x1ed;const _0x39aefb=a34_0x39ae();let _0x2dbb0a=_0x39aefb[_0x1caa5d];return _0x2dbb0a;}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a34_0x39ae(){const _0x48bc80=['error','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','config','map','length','description','message','364432sihZjm','site','28510WZeWSB','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','log','green','profiles','2065938KIDbGu','4381188lPzNeW','👤\x20','dim','name','8071JIRlPa','3170148lbFtGr','List\x20all\x20available\x20profiles','11912nRsIEx','426966dYbQdg','\x20\x20Global:\x20~/.config/tdx/tdx.json'];a34_0x39ae=function(){return _0x48bc80;};return a34_0x39ae();}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x189230 from'chalk';export class ProfilesCommand extends BaseCommand{['name']=a34_0x5690cd(0x205);[a34_0x5690cd(0x1fd)]=a34_0x5690cd(0x1f4);async['execute'](_0x3b6717){const _0x4d30d5=a34_0x5690cd,{options:_0xa8d06c}=_0x3b6717;try{const _0x59baed=listProfiles(),_0x4f4b5a=getActiveProfile();if(_0x59baed[_0x4d30d5(0x1fc)]===0x0)return console[_0x4d30d5(0x203)](_0x4d30d5(0x1f9)),console[_0x4d30d5(0x203)](_0x4d30d5(0x202)),console[_0x4d30d5(0x203)](_0x4d30d5(0x1f7)),0x0;const _0x4fd7d9=_0x59baed[_0x4d30d5(0x1fb)](_0x15115c=>{const _0x415cdc=_0x4d30d5,_0x3de627=_0x15115c[_0x415cdc(0x1f1)]===_0x4f4b5a,_0x22ccbe=getProfileParams(_0x15115c['config']);return{'name':_0x15115c[_0x415cdc(0x1f1)],'active':_0x3de627,'scope':_0x15115c['scope'],'description':_0x15115c['config'][_0x415cdc(0x1fd)]||'','params':_0x22ccbe};});if(isStructuredFormat(_0xa8d06c))await handleSDKOutput(_0x4fd7d9,_0xa8d06c);else for(const _0x1ce357 of _0x59baed){const _0x44752c=_0x1ce357[_0x4d30d5(0x1f1)]===_0x4f4b5a?a34_0x189230[_0x4d30d5(0x204)]('\x20✓'):'',_0x556b58=_0x1ce357[_0x4d30d5(0x1fa)][_0x4d30d5(0x200)]?a34_0x189230[_0x4d30d5(0x1f0)]('\x20'+_0x1ce357[_0x4d30d5(0x1fa)]['site']):'',_0x28c933=_0x1ce357[_0x4d30d5(0x1fa)][_0x4d30d5(0x1fd)]?a34_0x189230['dim']('\x20\x20'+_0x1ce357[_0x4d30d5(0x1fa)][_0x4d30d5(0x1fd)]):'';console[_0x4d30d5(0x203)](_0x4d30d5(0x1ef)+_0x1ce357['name']+_0x44752c+_0x556b58+_0x28c933);}return 0x0;}catch(_0x46e6a9){return _0x46e6a9 instanceof Error&&console[_0x4d30d5(0x1f8)]('Error:\x20'+_0x46e6a9[_0x4d30d5(0x1fe)]),0x1;}}}
1
+ const a34_0x456417=a34_0x4e24;function a34_0x4e24(_0x2f712c,_0x2fec52){_0x2f712c=_0x2f712c-0x11f;const _0x5e5ee2=a34_0x5e5e();let _0x4e2465=_0x5e5ee2[_0x2f712c];return _0x4e2465;}(function(_0x13d770,_0x570d4b){const _0x3c29ca=a34_0x4e24,_0x3300b2=_0x13d770();while(!![]){try{const _0x257a8d=-parseInt(_0x3c29ca(0x129))/0x1+-parseInt(_0x3c29ca(0x132))/0x2*(parseInt(_0x3c29ca(0x131))/0x3)+parseInt(_0x3c29ca(0x12c))/0x4*(-parseInt(_0x3c29ca(0x134))/0x5)+-parseInt(_0x3c29ca(0x133))/0x6+parseInt(_0x3c29ca(0x124))/0x7*(-parseInt(_0x3c29ca(0x12e))/0x8)+-parseInt(_0x3c29ca(0x11f))/0x9+parseInt(_0x3c29ca(0x123))/0xa;if(_0x257a8d===_0x570d4b)break;else _0x3300b2['push'](_0x3300b2['shift']());}catch(_0x2dafe3){_0x3300b2['push'](_0x3300b2['shift']());}}}(a34_0x5e5e,0x54f0e));import{BaseCommand}from'./command.js';function a34_0x5e5e(){const _0x219398=['1627654xrqhSt','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','description','dim','profiles','313665voBAwK','List\x20all\x20available\x20profiles','site','12lmXvSJ','message','8iwkuOI','error','name','17217FOdyGJ','106vFuTaw','1048452jHWsxp','771395YblJvN','green','map','length','log','394839MQXbwa','Error:\x20','👤\x20','config','18797220CfOSAC'];a34_0x5e5e=function(){return _0x219398;};return a34_0x5e5e();}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x194479 from'chalk';export class ProfilesCommand extends BaseCommand{['name']=a34_0x456417(0x128);[a34_0x456417(0x126)]=a34_0x456417(0x12a);async['execute'](_0x12ed38){const _0x88f79=a34_0x456417,{options:_0xa3147d}=_0x12ed38;try{const _0x22e7f4=listProfiles(),_0x13b705=getActiveProfile();if(_0x22e7f4[_0x88f79(0x137)]===0x0)return console[_0x88f79(0x138)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console[_0x88f79(0x138)](_0x88f79(0x125)),console[_0x88f79(0x138)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0xc7a803=_0x22e7f4[_0x88f79(0x136)](_0x4ad1bc=>{const _0x538de2=_0x88f79,_0x56cf06=_0x4ad1bc['name']===_0x13b705,_0x2fecf5=getProfileParams(_0x4ad1bc[_0x538de2(0x122)]);return{'name':_0x4ad1bc[_0x538de2(0x130)],'active':_0x56cf06,'scope':_0x4ad1bc['scope'],'description':_0x4ad1bc[_0x538de2(0x122)][_0x538de2(0x126)]||'','params':_0x2fecf5};});if(isStructuredFormat(_0xa3147d))await handleSDKOutput(_0xc7a803,_0xa3147d);else for(const _0x40b0c7 of _0x22e7f4){const _0x2791ce=_0x40b0c7[_0x88f79(0x130)]===_0x13b705?a34_0x194479[_0x88f79(0x135)]('\x20✓'):'',_0x23e76e=_0x40b0c7[_0x88f79(0x122)][_0x88f79(0x12b)]?a34_0x194479[_0x88f79(0x127)]('\x20'+_0x40b0c7[_0x88f79(0x122)][_0x88f79(0x12b)]):'',_0x3dc32f=_0x40b0c7[_0x88f79(0x122)][_0x88f79(0x126)]?a34_0x194479[_0x88f79(0x127)]('\x20\x20'+_0x40b0c7[_0x88f79(0x122)][_0x88f79(0x126)]):'';console[_0x88f79(0x138)](_0x88f79(0x121)+_0x40b0c7[_0x88f79(0x130)]+_0x2791ce+_0x23e76e+_0x3dc32f);}return 0x0;}catch(_0x2b847b){return _0x2b847b instanceof Error&&console[_0x88f79(0x12f)](_0x88f79(0x120)+_0x2b847b[_0x88f79(0x12d)]),0x1;}}}
@@ -1 +1 @@
1
- const a35_0x4dd003=a35_0x4f44;(function(_0x2153aa,_0x53a0e0){const _0x221ec7=a35_0x4f44,_0x4d2738=_0x2153aa();while(!![]){try{const _0x2a8291=-parseInt(_0x221ec7(0x16e))/0x1+-parseInt(_0x221ec7(0x148))/0x2*(parseInt(_0x221ec7(0x153))/0x3)+parseInt(_0x221ec7(0x145))/0x4+parseInt(_0x221ec7(0x171))/0x5+-parseInt(_0x221ec7(0x173))/0x6*(parseInt(_0x221ec7(0x14a))/0x7)+parseInt(_0x221ec7(0x161))/0x8*(parseInt(_0x221ec7(0x16d))/0x9)+parseInt(_0x221ec7(0x151))/0xa;if(_0x2a8291===_0x53a0e0)break;else _0x4d2738['push'](_0x4d2738['shift']());}catch(_0x1948df){_0x4d2738['push'](_0x4d2738['shift']());}}}(a35_0x41c6,0xc1cec));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a35_0x41c6(){const _0x130dea=['3191370FHutEy','setJobId','24viKTom','push','query','output','description','site','1834100FeIUsU','Run\x20Trino\x20queries\x20(streaming)','name','1236136HfFOre','\x20-\x20','2157729SzOYaG','...','stats','options','SQL:\x20','processedRows','error','21868370PRcGdh','setPhase','6ejqwyD','setExtra','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','totalSplits','length','Executing\x20statement\x20','\x20rows\x20','information_schema','Executing\x20query\x20[','join','state','jobId','Statement\x20','\x0aAll\x20results\x20saved\x20to\x20','11663048OIMpBj','execute','args','verbose','completedSplits','Query\x20completed:\x20Processed\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','data','Error:\x20','in\x20','originalMessage','file','9DYEeuS','1478557bMsCRh','Schema:\x20','message'];a35_0x41c6=function(){return _0x130dea;};return a35_0x41c6();}import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';function a35_0x4f44(_0x2e1690,_0x409d98){_0x2e1690=_0x2e1690-0x141;const _0x41c675=a35_0x41c6();let _0x4f444f=_0x41c675[_0x2e1690];return _0x4f444f;}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a35_0x4dd003(0x147)]=a35_0x4dd003(0x141);[a35_0x4dd003(0x143)]=a35_0x4dd003(0x146);async[a35_0x4dd003(0x162)](_0x212890){const _0x27df8f=a35_0x4dd003,{options:_0x1e5271,args:_0x5ce352,tdx:_0x241db6}=_0x212890,_0x5740ac={..._0x1e5271,'limitStructuredFormats':!![]},_0x29fc53=_0x5ce352[0x0],_0x380744=_0x1e5271[_0x27df8f(0x16c)];let _0x5dd86d;try{if(_0x380744)_0x5dd86d=readSqlStatementsFromFile(_0x380744);else{if(_0x29fc53==='-')_0x5dd86d=await readSqlStatementsFromStdin();else{if(_0x29fc53&&isSqlFilePath(_0x29fc53))_0x5dd86d=readSqlStatementsFromFile(_0x29fc53);else{if(_0x29fc53)_0x5dd86d=splitSqlStatements(_0x29fc53);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x47bcd1){return console[_0x27df8f(0x150)](_0x27df8f(0x169)+_0x47bcd1['message']),0x1;}const _0x2a3501=_0x1e5271['database']||_0x27df8f(0x15a),_0x506559=_0x1e5271['catalog'];try{const _0x34f8c5=[],_0x1df401=!!_0x1e5271[_0x27df8f(0x142)];for(let _0x6558d=0x0;_0x6558d<_0x5dd86d[_0x27df8f(0x157)];_0x6558d++){const _0xba8747=_0x5dd86d[_0x6558d],_0x473734=_0x6558d+0x1,_0x6d227c=_0x5dd86d[_0x27df8f(0x157)],_0x44d6b8=_0x6d227c>0x1;_0x1e5271[_0x27df8f(0x164)]&&(console[_0x27df8f(0x150)]('\x0a'+(_0x44d6b8?_0x27df8f(0x15f)+_0x473734+'/'+_0x6d227c+':':'')),console[_0x27df8f(0x150)]('Site:\x20'+_0x1e5271[_0x27df8f(0x144)]),console[_0x27df8f(0x150)]('Catalog:\x20'+(_0x506559||'td')),console[_0x27df8f(0x150)](_0x27df8f(0x16f)+_0x2a3501),console[_0x27df8f(0x150)](_0x27df8f(0x14e)+_0xba8747));const _0x43f794=_0x44d6b8?_0x27df8f(0x158)+_0x473734+'/'+_0x6d227c+_0x27df8f(0x14b):'Executing\x20query...';try{const _0x461c50=await withProgressSpinner(_0x43f794,async _0x3915c4=>{const _0x2bcd5a=_0x27df8f,_0x5f2fc9=await _0x241db6[_0x2bcd5a(0x141)][_0x2bcd5a(0x162)](_0xba8747,{'catalog':_0x506559,'schema':_0x2a3501,'onJobId':_0x4e15b1=>{const _0x200266=_0x2bcd5a;_0x3915c4[_0x200266(0x172)](_0x4e15b1);},'onProgress':_0x31478d=>{const _0x47167c=_0x2bcd5a;_0x3915c4[_0x47167c(0x152)](_0x47167c(0x15b)+_0x31478d[_0x47167c(0x15d)]+']'),_0x3915c4[_0x47167c(0x154)](formatRows(_0x31478d[_0x47167c(0x14f)])+_0x47167c(0x159)+_0x31478d[_0x47167c(0x165)]+'/'+_0x31478d[_0x47167c(0x156)]+'\x20splits');}});return _0x5f2fc9;},{'verbose':_0x1e5271[_0x27df8f(0x164)]}),_0x56c14c=_0x461c50[_0x27df8f(0x168)],_0x4f7bb7=_0x56c14c[_0x27df8f(0x15e)]?'\x20[Job\x20ID:\x20'+_0x56c14c[_0x27df8f(0x15e)]+']':'',_0x1b076f=_0x44d6b8?'Statement\x20'+_0x473734+'/'+_0x6d227c+_0x27df8f(0x149):'';console[_0x27df8f(0x150)]('✔\x20'+_0x1b076f+_0x27df8f(0x166)+formatRows(_0x56c14c[_0x27df8f(0x14c)]['processedRows'])+'\x20rows\x20'+(_0x27df8f(0x16a)+formatElapsed(_0x56c14c[_0x27df8f(0x14c)]['elapsedTimeMillis'])+_0x4f7bb7));if(_0x44d6b8&&_0x1df401){const _0x53a680=resolveOutputOptions(_0x5740ac),_0x1068b5=await formatQueryOutput(_0x56c14c,_0x53a680);_0x34f8c5[_0x27df8f(0x174)](_0x1068b5);}else await handleQueryOutput(_0x56c14c,_0x5740ac);}catch(_0x3067e8){const _0x4e3173=_0x44d6b8?_0x27df8f(0x15f)+_0x473734+'/'+_0x6d227c+':\x0a':'',_0x4d59a5=_0x3067e8 instanceof SDKError?_0x3067e8[_0x27df8f(0x16b)]:_0x3067e8[_0x27df8f(0x170)];return console[_0x27df8f(0x150)](''+_0x4e3173+_0x4d59a5),0x1;}}if(_0x5dd86d[_0x27df8f(0x157)]>0x1&&_0x1df401&&_0x34f8c5[_0x27df8f(0x157)]>0x0){const _0x1387e3=_0x34f8c5[_0x27df8f(0x15c)]('\x0a');writeFileSync(_0x1e5271[_0x27df8f(0x142)],_0x1387e3),console[_0x27df8f(0x150)](_0x27df8f(0x160)+_0x1e5271['output']);}return 0x0;}catch(_0x439d75){throw _0x439d75;}}['validate'](_0x5162e4){const _0xf902c1=a35_0x4dd003,_0x3e0e9d=_0x5162e4[_0xf902c1(0x163)][0x0],_0x33c438=_0x5162e4[_0xf902c1(0x14d)]['file'];if(!_0x3e0e9d&&!_0x33c438)return _0xf902c1(0x167);if(_0x3e0e9d&&_0x33c438)return _0xf902c1(0x155);return undefined;}}
1
+ const a35_0x5e38d4=a35_0x2870;function a35_0x3fe4(){const _0x2e9a72=['totalSplits','21865mrLLqG','length','\x0aAll\x20results\x20saved\x20to\x20','32800PtNyvi','Executing\x20statement\x20','verbose','3620397SEeugO','error','data','18132876SsXqLq','completedSplits','description','SQL:\x20','push','164384JuyagR','Error:\x20','\x20rows\x20','Executing\x20query\x20[','Schema:\x20','jobId','60SODUbs','output','Site:\x20','Executing\x20query...','message','8EWzcnd','database','\x20[Job\x20ID:\x20','site','...','\x20-\x20','\x20splits','processedRows','execute','stats','2041543hlRCpT','Statement\x20','originalMessage','elapsedTimeMillis','validate','No\x20SQL\x20provided','catalog','Catalog:\x20','8212941eoefNb','file','in\x20','setExtra','545jaOJIM','setPhase','query','args','20DeeFEC','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','24MoQCAE'];a35_0x3fe4=function(){return _0x2e9a72;};return a35_0x3fe4();}(function(_0x1fb673,_0x460db0){const _0x470bb3=a35_0x2870,_0x198c23=_0x1fb673();while(!![]){try{const _0x4666f3=parseInt(_0x470bb3(0x97))/0x1*(parseInt(_0x470bb3(0x93))/0x2)+parseInt(_0x470bb3(0x9d))/0x3+-parseInt(_0x470bb3(0x9a))/0x4*(-parseInt(_0x470bb3(0x8f))/0x5)+-parseInt(_0x470bb3(0x95))/0x6*(parseInt(_0x470bb3(0x83))/0x7)+parseInt(_0x470bb3(0x79))/0x8*(parseInt(_0x470bb3(0x8b))/0x9)+-parseInt(_0x470bb3(0x74))/0xa*(-parseInt(_0x470bb3(0xa5))/0xb)+-parseInt(_0x470bb3(0xa0))/0xc;if(_0x4666f3===_0x460db0)break;else _0x198c23['push'](_0x198c23['shift']());}catch(_0x128650){_0x198c23['push'](_0x198c23['shift']());}}}(a35_0x3fe4,0x9d2d1));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';function a35_0x2870(_0x1b9854,_0x4899b1){_0x1b9854=_0x1b9854-0x73;const _0x3fe4cd=a35_0x3fe4();let _0x287078=_0x3fe4cd[_0x1b9854];return _0x287078;}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a35_0x5e38d4(0x91);[a35_0x5e38d4(0xa2)]='Run\x20Trino\x20queries\x20(streaming)';async[a35_0x5e38d4(0x81)](_0x5a3416){const _0x51df42=a35_0x5e38d4,{options:_0x5e25e9,args:_0x2823c9,tdx:_0x4a400f}=_0x5a3416,_0x129a1e={..._0x5e25e9,'limitStructuredFormats':!![]},_0x48726b=_0x2823c9[0x0],_0x2e5e02=_0x5e25e9[_0x51df42(0x8c)];let _0x199ee8;try{if(_0x2e5e02)_0x199ee8=readSqlStatementsFromFile(_0x2e5e02);else{if(_0x48726b==='-')_0x199ee8=await readSqlStatementsFromStdin();else{if(_0x48726b&&isSqlFilePath(_0x48726b))_0x199ee8=readSqlStatementsFromFile(_0x48726b);else{if(_0x48726b)_0x199ee8=splitSqlStatements(_0x48726b);else throw new Error(_0x51df42(0x88));}}}}catch(_0x5d83b4){return console[_0x51df42(0x9e)](_0x51df42(0xa6)+_0x5d83b4[_0x51df42(0x78)]),0x1;}const _0x53373f=_0x5e25e9[_0x51df42(0x7a)]||'information_schema',_0xb0c2cf=_0x5e25e9[_0x51df42(0x89)];try{const _0x4c74e5=[],_0xa131ee=!!_0x5e25e9[_0x51df42(0x75)];for(let _0x11c9e3=0x0;_0x11c9e3<_0x199ee8[_0x51df42(0x98)];_0x11c9e3++){const _0x282825=_0x199ee8[_0x11c9e3],_0x48056e=_0x11c9e3+0x1,_0x55635b=_0x199ee8[_0x51df42(0x98)],_0x525a6c=_0x55635b>0x1;_0x5e25e9[_0x51df42(0x9c)]&&(console['error']('\x0a'+(_0x525a6c?_0x51df42(0x84)+_0x48056e+'/'+_0x55635b+':':'')),console[_0x51df42(0x9e)](_0x51df42(0x76)+_0x5e25e9[_0x51df42(0x7c)]),console['error'](_0x51df42(0x8a)+(_0xb0c2cf||'td')),console[_0x51df42(0x9e)](_0x51df42(0xa9)+_0x53373f),console[_0x51df42(0x9e)](_0x51df42(0xa3)+_0x282825));const _0x1a3593=_0x525a6c?_0x51df42(0x9b)+_0x48056e+'/'+_0x55635b+_0x51df42(0x7d):_0x51df42(0x77);try{const _0x23df64=await withProgressSpinner(_0x1a3593,async _0x4983a5=>{const _0x1df78b=_0x51df42,_0x5408cd=await _0x4a400f[_0x1df78b(0x91)]['execute'](_0x282825,{'catalog':_0xb0c2cf,'schema':_0x53373f,'onJobId':_0x410743=>{_0x4983a5['setJobId'](_0x410743);},'onProgress':_0x276233=>{const _0x4a9781=_0x1df78b;_0x4983a5[_0x4a9781(0x90)](_0x4a9781(0xa8)+_0x276233['state']+']'),_0x4983a5[_0x4a9781(0x8e)](formatRows(_0x276233[_0x4a9781(0x80)])+_0x4a9781(0xa7)+_0x276233[_0x4a9781(0xa1)]+'/'+_0x276233[_0x4a9781(0x96)]+_0x4a9781(0x7f));}});return _0x5408cd;},{'verbose':_0x5e25e9[_0x51df42(0x9c)]}),_0x472314=_0x23df64[_0x51df42(0x9f)],_0xabb0b6=_0x472314[_0x51df42(0x73)]?_0x51df42(0x7b)+_0x472314[_0x51df42(0x73)]+']':'',_0xcb3e82=_0x525a6c?_0x51df42(0x84)+_0x48056e+'/'+_0x55635b+_0x51df42(0x7e):'';console[_0x51df42(0x9e)]('✔\x20'+_0xcb3e82+'Query\x20completed:\x20Processed\x20'+formatRows(_0x472314[_0x51df42(0x82)][_0x51df42(0x80)])+'\x20rows\x20'+(_0x51df42(0x8d)+formatElapsed(_0x472314[_0x51df42(0x82)][_0x51df42(0x86)])+_0xabb0b6));if(_0x525a6c&&_0xa131ee){const _0x1637eb=resolveOutputOptions(_0x129a1e),_0xcd550c=await formatQueryOutput(_0x472314,_0x1637eb);_0x4c74e5[_0x51df42(0xa4)](_0xcd550c);}else await handleQueryOutput(_0x472314,_0x129a1e);}catch(_0x393113){const _0xbcdbaa=_0x525a6c?_0x51df42(0x84)+_0x48056e+'/'+_0x55635b+':\x0a':'',_0x5d6767=_0x393113 instanceof SDKError?_0x393113[_0x51df42(0x85)]:_0x393113[_0x51df42(0x78)];return console[_0x51df42(0x9e)](''+_0xbcdbaa+_0x5d6767),0x1;}}if(_0x199ee8[_0x51df42(0x98)]>0x1&&_0xa131ee&&_0x4c74e5[_0x51df42(0x98)]>0x0){const _0x202400=_0x4c74e5['join']('\x0a');writeFileSync(_0x5e25e9[_0x51df42(0x75)],_0x202400),console[_0x51df42(0x9e)](_0x51df42(0x99)+_0x5e25e9[_0x51df42(0x75)]);}return 0x0;}catch(_0x153815){throw _0x153815;}}[a35_0x5e38d4(0x87)](_0x192d69){const _0x1fe611=a35_0x5e38d4,_0x4c08d9=_0x192d69[_0x1fe611(0x92)][0x0],_0x1c4f23=_0x192d69['options'][_0x1fe611(0x8c)];if(!_0x4c08d9&&!_0x1c4f23)return _0x1fe611(0x94);if(_0x4c08d9&&_0x1c4f23)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}
@@ -1 +1 @@
1
- const a36_0x31ce36=a36_0x6416;(function(_0x432380,_0x25cb68){const _0x390031=a36_0x6416,_0x4f536b=_0x432380();while(!![]){try{const _0x41c922=-parseInt(_0x390031(0x1e8))/0x1*(parseInt(_0x390031(0x235))/0x2)+parseInt(_0x390031(0x1b2))/0x3+parseInt(_0x390031(0x1ae))/0x4*(parseInt(_0x390031(0x1b8))/0x5)+-parseInt(_0x390031(0x1bd))/0x6*(parseInt(_0x390031(0x1da))/0x7)+-parseInt(_0x390031(0x1f4))/0x8*(parseInt(_0x390031(0x215))/0x9)+-parseInt(_0x390031(0x234))/0xa*(-parseInt(_0x390031(0x1b0))/0xb)+-parseInt(_0x390031(0x222))/0xc;if(_0x41c922===_0x25cb68)break;else _0x4f536b['push'](_0x4f536b['shift']());}catch(_0x309bfa){_0x4f536b['push'](_0x4f536b['shift']());}}}(a36_0xd21d,0x8475c));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a36_0xd21d(){const _0x19a583=['/app/queries/editor?queryId=','3750ersIHl','34106ZIxtsd','\x20schedules','abs','nextRun','join','Schedule\x20deleted:\x20','INVALID_ARGUMENT','\x20\x20→\x20','jobs','trim','job_id','tsv','\x20\x20Database:\x20','\x20execution','\x20\x20Job\x20ID:\x20','📅\x20','Show\x20schedule\x20execution\x20history','4qNGRjC','Running\x20schedule...','27533xfUrls','padEnd','1454256WuLmRI','options','soon','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','success','getTime','3341905lVTpGl','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','type','keys','error','3306DpTbNw','m\x20ago','toLocaleDateString','data','schedules','next_run_at','Schedule\x20updated:\x20','\x20scheduled\x20quer','list','ended_at','\x20(use\x20--limit\x20to\x20see\x20more)','substring','timezone','Schedule\x20run\x20submitted:\x20','cyan','format','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','from','schedule:delete','map','dim','round','execute','\x20job','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','engineVersion','statusIcon','engine_version','queries','798xsYsQO','delay','retry_limit','start_at','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','user_name','cron','description','max','repeat','args','lastRun','trino','\x22...','3wVxjqN','jsonl','Updating\x20schedule:\x20','schedule:history','schedule:update','user','verbose','just\x20now','validate','count','retryLimit','queryUrl','8qZsuze','Cancelled','\x20matching\x20\x22','database','\x20(showing\x20','num','table','Getting\x20schedule\x20details...','Query\x20file\x20is\x20empty','d\x20ago','Found\x20','\x20created','updated_at','never','Updating\x20schedule...','time_zone','\x20\x20Time:\x20','created_at','query','json','Delete\x20a\x20scheduled\x20query','Creating\x20schedule...','status','file','end_at','Schedule\x20created:\x20','Running\x20schedule:\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','in\x20','\x20\x20Num:\x20','green','\x20\x20Timezone:\x20','Listing\x20scheduled\x20queries...','4915044gqXWDd','priority','List\x20scheduled\x20queries','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','Getting\x20schedule\x20history...','(unnamed)','scheduled_at','show','length','last_job','executing_user_id','pagination','Creating\x20schedule:\x20','10669356jBOpdE','result','utf-8','Show\x20schedule\x20details','limit','Showing\x20first\x20','name','Failed\x20to\x20read\x20file:\x20','Searching\x20scheduled\x20queries\x20matching\x20\x22','run','schedule:create','schedule:run','site','...','create','history','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update'];a36_0xd21d=function(){return _0x19a583;};return a36_0xd21d();}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';function a36_0x6416(_0x1dfa0e,_0xf9deba){_0x1dfa0e=_0x1dfa0e-0x19f;const _0xd21d47=a36_0xd21d();let _0x64165a=_0xd21d47[_0x1dfa0e];return _0x64165a;}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_0x114df7 from'chalk';function formatRelativeTime(_0x2c0cb2){const _0x24fdee=a36_0x6416,_0x8211ad=new Date(_0x2c0cb2),_0x49b1c7=new Date(),_0xffb585=_0x8211ad[_0x24fdee(0x1b7)]()-_0x49b1c7['getTime'](),_0x46ece7=Math[_0x24fdee(0x19f)](_0xffb585)/0x3e8,_0x1b3986=_0xffb585<0x0;if(_0x46ece7<0x3c)return _0x1b3986?_0x24fdee(0x1ef):_0x24fdee(0x1b4);else{if(_0x46ece7<0xe10){const _0x42a3c9=Math[_0x24fdee(0x1d2)](_0x46ece7/0x3c);return _0x1b3986?_0x42a3c9+_0x24fdee(0x1be):_0x24fdee(0x210)+_0x42a3c9+'m';}else{if(_0x46ece7<0x15180){const _0x502486=Math['round'](_0x46ece7/0xe10);return _0x1b3986?_0x502486+'h\x20ago':_0x24fdee(0x210)+_0x502486+'h';}else{if(_0x46ece7<0x93a80){const _0x52c185=Math[_0x24fdee(0x1d2)](_0x46ece7/0x15180);return _0x1b3986?_0x52c185+_0x24fdee(0x1fd):_0x24fdee(0x210)+_0x52c185+'d';}else return _0x8211ad[_0x24fdee(0x1bf)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x31ce36(0x228)]='schedule:list';[a36_0x31ce36(0x1e1)]=a36_0x31ce36(0x217);async[a36_0x31ce36(0x1d3)](_0x250a96){const _0x26edcd=a36_0x31ce36,{options:_0x453b8e,args:_0x5b64cc,tdx:_0x50bf04}=_0x250a96,_0x52e927=resolveLimit(_0x453b8e[_0x26edcd(0x226)],DEFAULT_DISPLAY_LIMIT),_0x22c34c=_0x5b64cc[0x0],_0x407dfc=_0x22c34c?_0x26edcd(0x22a)+_0x22c34c+_0x26edcd(0x1e7):_0x26edcd(0x214),_0x3bf70c=await withSpinner(_0x407dfc,()=>_0x50bf04['schedules']['listQueries']({'limit':_0x52e927,'scheduled':!![],'pattern':_0x22c34c}),{'verbose':_0x453b8e[_0x26edcd(0x1ee)]}),_0x2f7592=_0x3bf70c[_0x26edcd(0x1c0)][_0x26edcd(0x1d9)],_0x4842c5=_0x3bf70c['data'][_0x26edcd(0x220)]['has_next_page'],_0x4dc64d=_0x22c34c?_0x26edcd(0x1f6)+_0x22c34c+'\x22':'';_0x4842c5?console[_0x26edcd(0x1bc)](_0x26edcd(0x227)+_0x2f7592['length']+_0x26edcd(0x236)+_0x4dc64d+_0x26edcd(0x1c7)):console[_0x26edcd(0x1bc)](_0x26edcd(0x1fe)+_0x2f7592[_0x26edcd(0x21d)]+_0x26edcd(0x1c4)+(_0x2f7592['length']!==0x1?'ies':'y')+_0x4dc64d);if(_0x453b8e[_0x26edcd(0x1cc)]===_0x26edcd(0x207)||_0x453b8e[_0x26edcd(0x1cc)]===_0x26edcd(0x1e9)||_0x453b8e[_0x26edcd(0x1cc)]===_0x26edcd(0x1fa)||_0x453b8e['format']===_0x26edcd(0x1a8)){const _0x1186b7=_0x2f7592[_0x26edcd(0x1d0)](_0x4bd1ed=>({'id':_0x4bd1ed['id'],'name':_0x4bd1ed['name'],'cron':_0x4bd1ed[_0x26edcd(0x1e0)],'database':_0x4bd1ed['database']?.[_0x26edcd(0x228)],'type':_0x4bd1ed[_0x26edcd(0x1ba)],'timezone':_0x4bd1ed[_0x26edcd(0x203)],'user_name':_0x4bd1ed[_0x26edcd(0x1ed)]?.[_0x26edcd(0x228)],'updated_at':_0x4bd1ed[_0x26edcd(0x200)],'next_run_at':_0x4bd1ed[_0x26edcd(0x1c2)],'last_job_status':_0x4bd1ed['last_job']?.[_0x26edcd(0x20a)]}));await handleSDKOutput(_0x1186b7,_0x453b8e);}else{if(_0x2f7592[_0x26edcd(0x21d)]===0x0)console['log']('No\x20scheduled\x20queries\x20found');else{const _0x1b591e=_0x453b8e[_0x26edcd(0x22e)],_0x557154=_0x2f7592['map'](_0x1f3393=>{const _0x329665=_0x26edcd,_0x58c901=_0x1f3393[_0x329665(0x21e)]?.[_0x329665(0x20a)]?_0x1f3393[_0x329665(0x21e)][_0x329665(0x20a)]===_0x329665(0x1b6)?'✓':'✗':'-',_0x400a75=_0x1f3393[_0x329665(0x21e)]?.[_0x329665(0x1c6)]?formatRelativeTime(_0x1f3393[_0x329665(0x21e)][_0x329665(0x1c6)]):_0x329665(0x201),_0xdf0ae7=_0x1f3393[_0x329665(0x1c2)]?formatRelativeTime(_0x1f3393[_0x329665(0x1c2)]):'-',_0x79dd8b=_0x1f3393[_0x329665(0x1e0)]||'',_0x14b55d=_0x1f3393['name']||_0x329665(0x21a),_0x4feb42=getConsoleUrl(_0x1b591e,_0x329665(0x233)+_0x1f3393['id']);return{'statusIcon':_0x58c901,'lastRun':_0x400a75,'nextRun':_0xdf0ae7,'cron':_0x79dd8b,'name':_0x14b55d,'queryUrl':_0x4feb42,'status':_0x1f3393[_0x329665(0x21e)]?.['status']};}),_0x3e61f9=Math[_0x26edcd(0x1e2)](..._0x557154[_0x26edcd(0x1d0)](_0x16ebe8=>_0x16ebe8['lastRun'][_0x26edcd(0x21d)])),_0x3141eb=Math[_0x26edcd(0x1e2)](..._0x557154[_0x26edcd(0x1d0)](_0x57344c=>_0x57344c[_0x26edcd(0x1a0)][_0x26edcd(0x21d)])),_0x304414=Math[_0x26edcd(0x1e2)](..._0x557154[_0x26edcd(0x1d0)](_0x414701=>_0x414701[_0x26edcd(0x1e0)][_0x26edcd(0x21d)])),_0x34b232=_0x557154[_0x26edcd(0x1d0)](_0x8ddf35=>{const _0x1bfe0d=_0x26edcd,_0x5b5243=_0x8ddf35[_0x1bfe0d(0x20a)]===_0x1bfe0d(0x1b6)?a36_0x114df7[_0x1bfe0d(0x212)](_0x8ddf35[_0x1bfe0d(0x1d7)]):_0x8ddf35['status']===_0x1bfe0d(0x1bc)?a36_0x114df7['red'](_0x8ddf35[_0x1bfe0d(0x1d7)]):a36_0x114df7[_0x1bfe0d(0x1d1)](_0x8ddf35['statusIcon']),_0xf63aac=_0x8ddf35[_0x1bfe0d(0x1e5)]['padEnd'](_0x3e61f9),_0x31fefe=_0x8ddf35[_0x1bfe0d(0x1a0)][_0x1bfe0d(0x1b1)](_0x3141eb),_0x111134=_0x8ddf35[_0x1bfe0d(0x1e0)]?a36_0x114df7[_0x1bfe0d(0x1cb)](_0x8ddf35[_0x1bfe0d(0x1e0)][_0x1bfe0d(0x1b1)](_0x304414)):'\x20'[_0x1bfe0d(0x1e3)](_0x304414),_0x5636db=hyperlink(_0x8ddf35['name'],_0x8ddf35[_0x1bfe0d(0x1f3)]);return _0x1bfe0d(0x1ac)+_0x5b5243+'\x20'+_0xf63aac+_0x1bfe0d(0x1a4)+_0x31fefe+'\x20\x20'+_0x111134+'\x20\x20'+_0x5636db;});await writeOutput(_0x34b232[_0x26edcd(0x1a1)]('\x0a'),_0x453b8e['output'],_0x26edcd(0x1c5));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x31ce36(0x228)]='schedule:show';['description']=a36_0x31ce36(0x225);[a36_0x31ce36(0x1f0)](_0x27354e){const _0x29c61c=_0x27354e['args'][0x0];if(!_0x29c61c)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async[a36_0x31ce36(0x1d3)](_0x4722d6){const _0x2eb306=a36_0x31ce36,{options:_0x555001,args:_0x3f7dd7,tdx:_0x47cbb9}=_0x4722d6,_0x4a4e39=_0x3f7dd7[0x0],_0x2c2bcd=await withSpinner(_0x2eb306(0x1fb),()=>_0x47cbb9[_0x2eb306(0x1c1)][_0x2eb306(0x21c)](_0x4a4e39),{'verbose':_0x555001[_0x2eb306(0x1ee)]}),_0x23fa34=_0x2c2bcd[_0x2eb306(0x1c0)],_0x2c9e53={'name':_0x23fa34['name'],'cron':_0x23fa34[_0x2eb306(0x1e0)],'database':_0x23fa34[_0x2eb306(0x1f7)],'type':_0x23fa34[_0x2eb306(0x1ba)],'timezone':_0x23fa34[_0x2eb306(0x1c9)],'user_name':_0x23fa34[_0x2eb306(0x1df)],'created_at':_0x23fa34[_0x2eb306(0x205)],'engine_version':_0x23fa34[_0x2eb306(0x1d8)],'executing_user_id':_0x23fa34[_0x2eb306(0x21f)],'query':_0x23fa34[_0x2eb306(0x206)],'delay':_0x23fa34['delay'],'priority':_0x23fa34['priority'],'retry_limit':_0x23fa34[_0x2eb306(0x1dc)],..._0x23fa34[_0x2eb306(0x223)]&&{'result':_0x23fa34[_0x2eb306(0x223)]}};return await handleSingleObjectOutput(_0x2c9e53,_0x555001),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x31ce36(0x228)]=a36_0x31ce36(0x22c);['description']='Create\x20a\x20scheduled\x20query';[a36_0x31ce36(0x1f0)](_0x4d06fc){const _0xaf72e1=a36_0x31ce36,_0x49c9b8=_0x4d06fc[_0xaf72e1(0x1e4)][0x0];if(!_0x49c9b8)return _0xaf72e1(0x1cd);const _0xffcd63=_0x4d06fc[_0xaf72e1(0x1b3)];if(!_0xffcd63[_0xaf72e1(0x1f7)])return _0xaf72e1(0x1de);return undefined;}async[a36_0x31ce36(0x1d3)](_0x581750){const _0x35a750=a36_0x31ce36,{options:_0x2ab2d9,args:_0x4c083d,tdx:_0x377b27}=_0x581750,_0x4f322a=_0x4c083d[0x0],_0x5b7f11=_0x2ab2d9,_0x4f441b=_0x5b7f11['database'],_0x55e1a8=_0x5b7f11[_0x35a750(0x20b)],_0x2ab082=_0x5b7f11[_0x35a750(0x1ba)]||_0x35a750(0x1e6);let _0x4f80c7;try{_0x4f80c7=readFileSync(_0x55e1a8,'utf-8')[_0x35a750(0x1a6)]();}catch(_0x2cc6c2){throw new SDKError(ErrorCode[_0x35a750(0x1a3)],_0x35a750(0x229)+_0x55e1a8,_0x2cc6c2 instanceof Error?_0x2cc6c2:undefined);}if(!_0x4f80c7)throw new SDKError(ErrorCode[_0x35a750(0x1a3)],_0x35a750(0x1fc));const _0x437e34={'database':_0x4f441b,'query':_0x4f80c7,'type':_0x2ab082};if(_0x5b7f11['cron'])_0x437e34[_0x35a750(0x1e0)]=_0x5b7f11[_0x35a750(0x1e0)];if(_0x5b7f11['timezone'])_0x437e34[_0x35a750(0x1c9)]=_0x5b7f11['timezone'];if(_0x5b7f11['delay']!==undefined)_0x437e34['delay']=Number(_0x5b7f11['delay']);if(_0x5b7f11['priority']!==undefined)_0x437e34[_0x35a750(0x216)]=Number(_0x5b7f11[_0x35a750(0x216)]);if(_0x5b7f11['retryLimit']!==undefined)_0x437e34['retry_limit']=Number(_0x5b7f11[_0x35a750(0x1f2)]);if(_0x5b7f11['engineVersion'])_0x437e34[_0x35a750(0x1d8)]=_0x5b7f11[_0x35a750(0x1d6)];if(_0x5b7f11[_0x35a750(0x223)])_0x437e34['result']=_0x5b7f11[_0x35a750(0x223)];if(_0x2ab2d9[_0x35a750(0x1ee)]){console['error'](_0x35a750(0x221)+_0x4f322a),console[_0x35a750(0x1bc)](_0x35a750(0x1a9)+_0x4f441b),console[_0x35a750(0x1bc)]('\x20\x20Type:\x20'+_0x2ab082);if(_0x437e34['cron'])console['error']('\x20\x20Cron:\x20'+_0x437e34[_0x35a750(0x1e0)]);if(_0x437e34['timezone'])console[_0x35a750(0x1bc)](_0x35a750(0x213)+_0x437e34[_0x35a750(0x1c9)]);}const _0x527f57=await withSpinner(_0x35a750(0x209),()=>_0x377b27[_0x35a750(0x1c1)][_0x35a750(0x230)](_0x4f322a,_0x437e34),{'verbose':_0x2ab2d9[_0x35a750(0x1ee)]});return console[_0x35a750(0x1bc)](_0x35a750(0x20d)+_0x527f57[_0x35a750(0x1c0)]['name']),await handleSingleObjectOutput(_0x527f57[_0x35a750(0x1c0)],_0x2ab2d9),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x31ce36(0x228)]=a36_0x31ce36(0x1ec);['description']='Update\x20a\x20scheduled\x20query';[a36_0x31ce36(0x1f0)](_0x242752){const _0x2dfbe9=a36_0x31ce36,_0xafae1d=_0x242752[_0x2dfbe9(0x1e4)][0x0];if(!_0xafae1d)return _0x2dfbe9(0x1d5);return undefined;}async[a36_0x31ce36(0x1d3)](_0x403814){const _0x2284ab=a36_0x31ce36,{options:_0x4edfaf,args:_0x461273,tdx:_0x3e8fd7}=_0x403814,_0x282926=_0x461273[0x0],_0x38b7a0=_0x4edfaf,_0x3d84dd={};if(_0x38b7a0[_0x2284ab(0x1f7)])_0x3d84dd[_0x2284ab(0x1f7)]=_0x38b7a0[_0x2284ab(0x1f7)];if(_0x38b7a0[_0x2284ab(0x1ba)])_0x3d84dd[_0x2284ab(0x1ba)]=_0x38b7a0[_0x2284ab(0x1ba)];if(_0x38b7a0['cron'])_0x3d84dd[_0x2284ab(0x1e0)]=_0x38b7a0[_0x2284ab(0x1e0)];if(_0x38b7a0[_0x2284ab(0x1c9)])_0x3d84dd[_0x2284ab(0x1c9)]=_0x38b7a0['timezone'];if(_0x38b7a0[_0x2284ab(0x1db)]!==undefined)_0x3d84dd[_0x2284ab(0x1db)]=Number(_0x38b7a0[_0x2284ab(0x1db)]);if(_0x38b7a0[_0x2284ab(0x216)]!==undefined)_0x3d84dd[_0x2284ab(0x216)]=Number(_0x38b7a0[_0x2284ab(0x216)]);if(_0x38b7a0[_0x2284ab(0x1f2)]!==undefined)_0x3d84dd['retry_limit']=Number(_0x38b7a0[_0x2284ab(0x1f2)]);if(_0x38b7a0[_0x2284ab(0x1d6)])_0x3d84dd[_0x2284ab(0x1d8)]=_0x38b7a0[_0x2284ab(0x1d6)];if(_0x38b7a0[_0x2284ab(0x223)])_0x3d84dd['result']=_0x38b7a0['result'];if(_0x38b7a0[_0x2284ab(0x20b)])try{_0x3d84dd[_0x2284ab(0x206)]=readFileSync(_0x38b7a0[_0x2284ab(0x20b)],_0x2284ab(0x224))[_0x2284ab(0x1a6)]();}catch(_0x4ce2fa){throw new SDKError(ErrorCode[_0x2284ab(0x1a3)],_0x2284ab(0x229)+_0x38b7a0[_0x2284ab(0x20b)],_0x4ce2fa instanceof Error?_0x4ce2fa:undefined);}if(Object[_0x2284ab(0x1bb)](_0x3d84dd)[_0x2284ab(0x21d)]===0x0)throw new SDKError(ErrorCode[_0x2284ab(0x1a3)],_0x2284ab(0x232));if(_0x4edfaf[_0x2284ab(0x1ee)]){console['error'](_0x2284ab(0x1ea)+_0x282926);for(const [_0x3e237f,_0x50689b]of Object['entries'](_0x3d84dd)){_0x3e237f===_0x2284ab(0x206)?console[_0x2284ab(0x1bc)]('\x20\x20'+_0x3e237f+':\x20'+_0x50689b[_0x2284ab(0x1c8)](0x0,0x32)+_0x2284ab(0x22f)):console[_0x2284ab(0x1bc)]('\x20\x20'+_0x3e237f+':\x20'+_0x50689b);}}const _0x4fb46c=await withSpinner(_0x2284ab(0x202),()=>_0x3e8fd7['schedules']['update'](_0x282926,_0x3d84dd),{'verbose':_0x4edfaf[_0x2284ab(0x1ee)]});return console[_0x2284ab(0x1bc)](_0x2284ab(0x1c3)+_0x4fb46c[_0x2284ab(0x1c0)][_0x2284ab(0x228)]),await handleSingleObjectOutput(_0x4fb46c[_0x2284ab(0x1c0)],_0x4edfaf),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x31ce36(0x228)]=a36_0x31ce36(0x1cf);[a36_0x31ce36(0x1e1)]=a36_0x31ce36(0x208);[a36_0x31ce36(0x1f0)](_0x389e08){const _0x162475=a36_0x31ce36,_0x29ff8d=_0x389e08['args'][0x0];if(!_0x29ff8d)return _0x162475(0x1b5);return undefined;}async[a36_0x31ce36(0x1d3)](_0x462a00){const _0x51ef51=a36_0x31ce36,{options:_0x52984c,args:_0x1a3108,tdx:_0x3f1a41}=_0x462a00,_0x5c319c=_0x1a3108[0x0];if(!_0x52984c['yes']){const _0x53ccca=await confirm(_0x51ef51(0x1b9)+_0x5c319c+'\x22?');if(!_0x53ccca)return console[_0x51ef51(0x1bc)](_0x51ef51(0x1f5)),0x0;}const _0x22b03e=await withSpinner('Deleting\x20schedule...',()=>_0x3f1a41['schedules']['delete'](_0x5c319c),{'verbose':_0x52984c[_0x51ef51(0x1ee)]});return console[_0x51ef51(0x1bc)](_0x51ef51(0x1a2)+_0x22b03e[_0x51ef51(0x1c0)][_0x51ef51(0x228)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x31ce36(0x228)]=a36_0x31ce36(0x22d);[a36_0x31ce36(0x1e1)]='Run\x20a\x20scheduled\x20query\x20immediately';[a36_0x31ce36(0x1f0)](_0x478728){const _0x28d0ce=a36_0x31ce36,_0x2b5f72=_0x478728[_0x28d0ce(0x1e4)][0x0];if(!_0x2b5f72)return _0x28d0ce(0x20f);return undefined;}async[a36_0x31ce36(0x1d3)](_0x8ad257){const _0xd75f82=a36_0x31ce36,{options:_0x1d8050,args:_0x29272b,tdx:_0x501e43}=_0x8ad257,_0x4166b5=_0x29272b[0x0],_0x267995=_0x1d8050,_0x5b50e8=_0x267995['time'],_0x4fd5c0=_0x267995[_0xd75f82(0x1f9)]!==undefined?Number(_0x267995['num']):undefined;if(_0x1d8050['verbose']){console[_0xd75f82(0x1bc)](_0xd75f82(0x20e)+_0x4166b5);if(_0x5b50e8)console['error'](_0xd75f82(0x204)+_0x5b50e8);if(_0x4fd5c0)console['error'](_0xd75f82(0x211)+_0x4fd5c0);}const _0x56b7e5=await withSpinner(_0xd75f82(0x1af),()=>_0x501e43[_0xd75f82(0x1c1)][_0xd75f82(0x22b)](_0x4166b5,{'time':_0x5b50e8,'num':_0x4fd5c0}),{'verbose':_0x1d8050[_0xd75f82(0x1ee)]}),_0x4cf2e9=_0x56b7e5[_0xd75f82(0x1c0)][_0xd75f82(0x1a5)];console[_0xd75f82(0x1bc)](_0xd75f82(0x1ca)+_0x4cf2e9[_0xd75f82(0x21d)]+_0xd75f82(0x1d4)+(_0x4cf2e9['length']!==0x1?'s':'')+_0xd75f82(0x1ff));for(const _0x20d206 of _0x4cf2e9){console[_0xd75f82(0x1bc)](_0xd75f82(0x1ab)+_0x20d206['job_id']);}return await handleSDKOutput(_0x4cf2e9,_0x1d8050),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x31ce36(0x228)]=a36_0x31ce36(0x1eb);[a36_0x31ce36(0x1e1)]=a36_0x31ce36(0x1ad);[a36_0x31ce36(0x1f0)](_0x5c9de0){const _0x12cea2=a36_0x31ce36,_0x4a98b4=_0x5c9de0['args'][0x0];if(!_0x4a98b4)return _0x12cea2(0x218);return undefined;}async[a36_0x31ce36(0x1d3)](_0x25e6e8){const _0x98d888=a36_0x31ce36,{options:_0x21bfe4,args:_0x48b1ac,tdx:_0x1bd228}=_0x25e6e8,_0x1081af=_0x48b1ac[0x0],_0x41082e=_0x21bfe4,_0x502ef1=_0x41082e['from']!==undefined?Number(_0x41082e['from']):undefined,_0x313abd=_0x41082e['to']!==undefined?Number(_0x41082e['to']):undefined,_0x5d2414=await withSpinner(_0x98d888(0x219),()=>_0x1bd228[_0x98d888(0x1c1)][_0x98d888(0x231)](_0x1081af,{'from':_0x502ef1,'to':_0x313abd}),{'verbose':_0x21bfe4[_0x98d888(0x1ee)]}),_0x566195=_0x5d2414[_0x98d888(0x1c0)];console[_0x98d888(0x1bc)](_0x98d888(0x1fe)+_0x566195[_0x98d888(0x1f1)]+_0x98d888(0x1aa)+(_0x566195['count']!==0x1?'s':'')+_0x98d888(0x1f8)+_0x566195[_0x98d888(0x1ce)]+'-'+_0x566195['to']+')');const _0x28789b=_0x566195['history'][_0x98d888(0x1d0)](_0x22fe43=>({'job_id':_0x22fe43[_0x98d888(0x1a7)],'type':_0x22fe43['type'],'status':_0x22fe43['status'],'scheduled_at':_0x22fe43[_0x98d888(0x21b)],'created_at':_0x22fe43['created_at'],'start_at':_0x22fe43[_0x98d888(0x1dd)],'end_at':_0x22fe43[_0x98d888(0x20c)]}));return await handleSDKOutput(_0x28789b,_0x21bfe4),0x0;}}
1
+ const a36_0x572012=a36_0x240b;(function(_0x2d4442,_0x1d04b6){const _0x354017=a36_0x240b,_0x1112d2=_0x2d4442();while(!![]){try{const _0x455686=-parseInt(_0x354017(0x203))/0x1+parseInt(_0x354017(0x1b3))/0x2+-parseInt(_0x354017(0x220))/0x3+parseInt(_0x354017(0x211))/0x4+-parseInt(_0x354017(0x1ca))/0x5*(-parseInt(_0x354017(0x1f5))/0x6)+-parseInt(_0x354017(0x1b9))/0x7*(-parseInt(_0x354017(0x1ed))/0x8)+-parseInt(_0x354017(0x229))/0x9*(parseInt(_0x354017(0x1ac))/0xa);if(_0x455686===_0x1d04b6)break;else _0x1112d2['push'](_0x1112d2['shift']());}catch(_0x1b97f5){_0x1112d2['push'](_0x1112d2['shift']());}}}(a36_0x577f,0x517d2));function a36_0x577f(){const _0x432cc8=['Update\x20a\x20scheduled\x20query','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','schedules','padEnd','Updating\x20schedule:\x20','\x20\x20Num:\x20','Deleting\x20schedule...','abs','49745mUDrwx','data','retryLimit','schedule:run','length','user','name','\x20\x20Database:\x20','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','num','\x20\x20Time:\x20','\x20\x20Type:\x20','Listing\x20scheduled\x20queries...','Show\x20schedule\x20details','args','query','Schedule\x20run\x20submitted:\x20','jobs','max','utf-8','updated_at','Schedule\x20updated:\x20','list','\x20\x20Cron:\x20','Schedule\x20deleted:\x20','Showing\x20first\x20','\x22...','pagination','substring','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','repeat','format','json','m\x20ago','delay','990904kItsfc','Getting\x20schedule\x20details...','yes','Creating\x20schedule:\x20','\x20matching\x20\x22','map','error','getTime','204WbDKCL','\x20execution','nextRun','delete','listQueries','history','never','database','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','trino','\x20(showing\x20','Cancelled','schedule:list','schedule:update','655416GHuWuB','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','success','ended_at','created_at','\x20\x20→\x20','cron','soon','status','last_job','schedule:history','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','next_run_at','Show\x20schedule\x20execution\x20history','1569228GiHoaf','description','green','engineVersion','retry_limit','No\x20scheduled\x20queries\x20found','has_next_page','queries','priority','INVALID_ARGUMENT','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','timezone','round','user_name','List\x20scheduled\x20queries','1761015RsBPDQ','📅\x20','Running\x20schedule...','run','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','red','toLocaleDateString','in\x20','verbose','27FxfRso','Searching\x20scheduled\x20queries\x20matching\x20\x22','end_at','table','options','keys','count','engine_version','execute','...','result','queryUrl','Found\x20','type','site','Running\x20schedule:\x20','just\x20now','Delete\x20a\x20scheduled\x20query','1433340nbnrTu','\x20\x20Job\x20ID:\x20','job_id','\x20created','(unnamed)','entries','Schedule\x20created:\x20','1312626OjgzHf','schedule:show','tsv','\x20job','from','Updating\x20schedule...','35XxWPMz','schedule:delete','lastRun','create','output','limit','file','validate','schedule:create'];a36_0x577f=function(){return _0x432cc8;};return a36_0x577f();}import{BaseCommand}from'./command.js';function a36_0x240b(_0x42efe7,_0x3c18c8){_0x42efe7=_0x42efe7-0x1a1;const _0x577f85=a36_0x577f();let _0x240bef=_0x577f85[_0x42efe7];return _0x240bef;}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_0x597a27 from'chalk';function formatRelativeTime(_0x2f092f){const _0xd87909=a36_0x240b,_0x37571b=new Date(_0x2f092f),_0x3139b5=new Date(),_0x4c25c3=_0x37571b[_0xd87909(0x1f4)]()-_0x3139b5['getTime'](),_0x480341=Math[_0xd87909(0x1c9)](_0x4c25c3)/0x3e8,_0x24c899=_0x4c25c3<0x0;if(_0x480341<0x3c)return _0x24c899?_0xd87909(0x1aa):_0xd87909(0x20a);else{if(_0x480341<0xe10){const _0x1535fd=Math[_0xd87909(0x21d)](_0x480341/0x3c);return _0x24c899?_0x1535fd+_0xd87909(0x1eb):_0xd87909(0x227)+_0x1535fd+'m';}else{if(_0x480341<0x15180){const _0x52378c=Math[_0xd87909(0x21d)](_0x480341/0xe10);return _0x24c899?_0x52378c+'h\x20ago':_0xd87909(0x227)+_0x52378c+'h';}else{if(_0x480341<0x93a80){const _0x5ee1d8=Math[_0xd87909(0x21d)](_0x480341/0x15180);return _0x24c899?_0x5ee1d8+'d\x20ago':_0xd87909(0x227)+_0x5ee1d8+'d';}else return _0x37571b[_0xd87909(0x226)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x572012(0x1d0)]=a36_0x572012(0x201);[a36_0x572012(0x212)]=a36_0x572012(0x21f);async[a36_0x572012(0x1a2)](_0x26bd0b){const _0x2bad48=a36_0x572012,{options:_0x4c5486,args:_0xe834a9,tdx:_0x353a6a}=_0x26bd0b,_0x4f488d=resolveLimit(_0x4c5486[_0x2bad48(0x1be)],DEFAULT_DISPLAY_LIMIT),_0x2b03dd=_0xe834a9[0x0],_0xe22fd6=_0x2b03dd?_0x2bad48(0x22a)+_0x2b03dd+_0x2bad48(0x1e4):_0x2bad48(0x1d6),_0x4a427f=await withSpinner(_0xe22fd6,()=>_0x353a6a['schedules'][_0x2bad48(0x1f9)]({'limit':_0x4f488d,'scheduled':!![],'pattern':_0x2b03dd}),{'verbose':_0x4c5486[_0x2bad48(0x228)]}),_0x3d5a5c=_0x4a427f[_0x2bad48(0x1cb)][_0x2bad48(0x218)],_0x48a65d=_0x4a427f[_0x2bad48(0x1cb)][_0x2bad48(0x1e5)][_0x2bad48(0x217)],_0x264bef=_0x2b03dd?_0x2bad48(0x1f1)+_0x2b03dd+'\x22':'';_0x48a65d?console[_0x2bad48(0x1f3)](_0x2bad48(0x1e3)+_0x3d5a5c[_0x2bad48(0x1ce)]+'\x20schedules'+_0x264bef+'\x20(use\x20--limit\x20to\x20see\x20more)'):console[_0x2bad48(0x1f3)](_0x2bad48(0x1a6)+_0x3d5a5c[_0x2bad48(0x1ce)]+'\x20scheduled\x20quer'+(_0x3d5a5c[_0x2bad48(0x1ce)]!==0x1?'ies':'y')+_0x264bef);if(_0x4c5486[_0x2bad48(0x1e9)]===_0x2bad48(0x1ea)||_0x4c5486[_0x2bad48(0x1e9)]==='jsonl'||_0x4c5486['format']===_0x2bad48(0x22c)||_0x4c5486['format']===_0x2bad48(0x1b5)){const _0x2fbc8f=_0x3d5a5c['map'](_0x4c2ee9=>({'id':_0x4c2ee9['id'],'name':_0x4c2ee9['name'],'cron':_0x4c2ee9[_0x2bad48(0x209)],'database':_0x4c2ee9[_0x2bad48(0x1fc)]?.[_0x2bad48(0x1d0)],'type':_0x4c2ee9[_0x2bad48(0x1a7)],'timezone':_0x4c2ee9['time_zone'],'user_name':_0x4c2ee9[_0x2bad48(0x1cf)]?.['name'],'updated_at':_0x4c2ee9[_0x2bad48(0x1de)],'next_run_at':_0x4c2ee9[_0x2bad48(0x20f)],'last_job_status':_0x4c2ee9['last_job']?.[_0x2bad48(0x20b)]}));await handleSDKOutput(_0x2fbc8f,_0x4c5486);}else{if(_0x3d5a5c[_0x2bad48(0x1ce)]===0x0)console['log'](_0x2bad48(0x216));else{const _0x2b249a=_0x4c5486[_0x2bad48(0x1a8)],_0x4b42b7=_0x3d5a5c[_0x2bad48(0x1f2)](_0x78c053=>{const _0x14a264=_0x2bad48,_0x2a2b0b=_0x78c053[_0x14a264(0x20c)]?.['status']?_0x78c053[_0x14a264(0x20c)][_0x14a264(0x20b)]==='success'?'✓':'✗':'-',_0x5c4844=_0x78c053[_0x14a264(0x20c)]?.[_0x14a264(0x206)]?formatRelativeTime(_0x78c053[_0x14a264(0x20c)][_0x14a264(0x206)]):_0x14a264(0x1fb),_0x457377=_0x78c053[_0x14a264(0x20f)]?formatRelativeTime(_0x78c053[_0x14a264(0x20f)]):'-',_0x8549d7=_0x78c053['cron']||'',_0x1e8d47=_0x78c053['name']||_0x14a264(0x1b0),_0x4771fe=getConsoleUrl(_0x2b249a,'/app/queries/editor?queryId='+_0x78c053['id']);return{'statusIcon':_0x2a2b0b,'lastRun':_0x5c4844,'nextRun':_0x457377,'cron':_0x8549d7,'name':_0x1e8d47,'queryUrl':_0x4771fe,'status':_0x78c053[_0x14a264(0x20c)]?.['status']};}),_0x15affb=Math[_0x2bad48(0x1dc)](..._0x4b42b7[_0x2bad48(0x1f2)](_0x1621e1=>_0x1621e1[_0x2bad48(0x1bb)][_0x2bad48(0x1ce)])),_0x13cab5=Math[_0x2bad48(0x1dc)](..._0x4b42b7[_0x2bad48(0x1f2)](_0x40649f=>_0x40649f[_0x2bad48(0x1f7)][_0x2bad48(0x1ce)])),_0x29952f=Math['max'](..._0x4b42b7[_0x2bad48(0x1f2)](_0x565feb=>_0x565feb[_0x2bad48(0x209)][_0x2bad48(0x1ce)])),_0x5849c5=_0x4b42b7[_0x2bad48(0x1f2)](_0x51cd50=>{const _0x54d347=_0x2bad48,_0x42e5d4=_0x51cd50[_0x54d347(0x20b)]===_0x54d347(0x205)?a36_0x597a27[_0x54d347(0x213)](_0x51cd50['statusIcon']):_0x51cd50[_0x54d347(0x20b)]===_0x54d347(0x1f3)?a36_0x597a27[_0x54d347(0x225)](_0x51cd50['statusIcon']):a36_0x597a27['dim'](_0x51cd50['statusIcon']),_0x20b6e4=_0x51cd50[_0x54d347(0x1bb)]['padEnd'](_0x15affb),_0x28307c=_0x51cd50[_0x54d347(0x1f7)][_0x54d347(0x1c5)](_0x13cab5),_0x489a75=_0x51cd50[_0x54d347(0x209)]?a36_0x597a27['cyan'](_0x51cd50[_0x54d347(0x209)][_0x54d347(0x1c5)](_0x29952f)):'\x20'[_0x54d347(0x1e8)](_0x29952f),_0x51051c=hyperlink(_0x51cd50[_0x54d347(0x1d0)],_0x51cd50[_0x54d347(0x1a5)]);return _0x54d347(0x221)+_0x42e5d4+'\x20'+_0x20b6e4+_0x54d347(0x208)+_0x28307c+'\x20\x20'+_0x489a75+'\x20\x20'+_0x51051c;});await writeOutput(_0x5849c5['join']('\x0a'),_0x4c5486[_0x2bad48(0x1bd)],_0x2bad48(0x1e0));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x572012(0x1d0)]=a36_0x572012(0x1b4);[a36_0x572012(0x212)]=a36_0x572012(0x1d7);[a36_0x572012(0x1c0)](_0x33e8ba){const _0x1db3f6=a36_0x572012,_0x36a8be=_0x33e8ba[_0x1db3f6(0x1d8)][0x0];if(!_0x36a8be)return _0x1db3f6(0x1c3);return undefined;}async[a36_0x572012(0x1a2)](_0x3b7a36){const _0x3a1e2a=a36_0x572012,{options:_0x5f0959,args:_0x5dbea8,tdx:_0x1cbd48}=_0x3b7a36,_0x52473f=_0x5dbea8[0x0],_0x4a4eb7=await withSpinner(_0x3a1e2a(0x1ee),()=>_0x1cbd48[_0x3a1e2a(0x1c4)]['show'](_0x52473f),{'verbose':_0x5f0959[_0x3a1e2a(0x228)]}),_0x2d9564=_0x4a4eb7[_0x3a1e2a(0x1cb)],_0x3741d5={'name':_0x2d9564[_0x3a1e2a(0x1d0)],'cron':_0x2d9564[_0x3a1e2a(0x209)],'database':_0x2d9564[_0x3a1e2a(0x1fc)],'type':_0x2d9564[_0x3a1e2a(0x1a7)],'timezone':_0x2d9564[_0x3a1e2a(0x21c)],'user_name':_0x2d9564[_0x3a1e2a(0x21e)],'created_at':_0x2d9564['created_at'],'engine_version':_0x2d9564['engine_version'],'executing_user_id':_0x2d9564['executing_user_id'],'query':_0x2d9564[_0x3a1e2a(0x1d9)],'delay':_0x2d9564[_0x3a1e2a(0x1ec)],'priority':_0x2d9564['priority'],'retry_limit':_0x2d9564[_0x3a1e2a(0x215)],..._0x2d9564[_0x3a1e2a(0x1a4)]&&{'result':_0x2d9564[_0x3a1e2a(0x1a4)]}};return await handleSingleObjectOutput(_0x3741d5,_0x5f0959),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a36_0x572012(0x1d0)]=a36_0x572012(0x1c1);[a36_0x572012(0x212)]='Create\x20a\x20scheduled\x20query';[a36_0x572012(0x1c0)](_0x2022bd){const _0x384981=a36_0x572012,_0x6d05f2=_0x2022bd[_0x384981(0x1d8)][0x0];if(!_0x6d05f2)return _0x384981(0x20e);const _0x5a9957=_0x2022bd[_0x384981(0x22d)];if(!_0x5a9957['database'])return _0x384981(0x224);return undefined;}async[a36_0x572012(0x1a2)](_0x59c8b0){const _0xe4ef7d=a36_0x572012,{options:_0x59ccce,args:_0x18e9ea,tdx:_0x245fc1}=_0x59c8b0,_0x58db83=_0x18e9ea[0x0],_0x1716dd=_0x59ccce,_0x58c971=_0x1716dd['database'],_0x48d1b8=_0x1716dd['file'],_0x3a0d2d=_0x1716dd[_0xe4ef7d(0x1a7)]||_0xe4ef7d(0x1fe);let _0x1a81ef;try{_0x1a81ef=readFileSync(_0x48d1b8,_0xe4ef7d(0x1dd))['trim']();}catch(_0x4bf1be){throw new SDKError(ErrorCode[_0xe4ef7d(0x21a)],'Failed\x20to\x20read\x20file:\x20'+_0x48d1b8,_0x4bf1be instanceof Error?_0x4bf1be:undefined);}if(!_0x1a81ef)throw new SDKError(ErrorCode[_0xe4ef7d(0x21a)],'Query\x20file\x20is\x20empty');const _0x5148f9={'database':_0x58c971,'query':_0x1a81ef,'type':_0x3a0d2d};if(_0x1716dd[_0xe4ef7d(0x209)])_0x5148f9[_0xe4ef7d(0x209)]=_0x1716dd[_0xe4ef7d(0x209)];if(_0x1716dd['timezone'])_0x5148f9[_0xe4ef7d(0x21c)]=_0x1716dd['timezone'];if(_0x1716dd[_0xe4ef7d(0x1ec)]!==undefined)_0x5148f9[_0xe4ef7d(0x1ec)]=Number(_0x1716dd[_0xe4ef7d(0x1ec)]);if(_0x1716dd[_0xe4ef7d(0x219)]!==undefined)_0x5148f9[_0xe4ef7d(0x219)]=Number(_0x1716dd[_0xe4ef7d(0x219)]);if(_0x1716dd['retryLimit']!==undefined)_0x5148f9[_0xe4ef7d(0x215)]=Number(_0x1716dd[_0xe4ef7d(0x1cc)]);if(_0x1716dd[_0xe4ef7d(0x214)])_0x5148f9[_0xe4ef7d(0x1a1)]=_0x1716dd[_0xe4ef7d(0x214)];if(_0x1716dd[_0xe4ef7d(0x1a4)])_0x5148f9[_0xe4ef7d(0x1a4)]=_0x1716dd[_0xe4ef7d(0x1a4)];if(_0x59ccce[_0xe4ef7d(0x228)]){console[_0xe4ef7d(0x1f3)](_0xe4ef7d(0x1f0)+_0x58db83),console['error'](_0xe4ef7d(0x1d1)+_0x58c971),console['error'](_0xe4ef7d(0x1d5)+_0x3a0d2d);if(_0x5148f9[_0xe4ef7d(0x209)])console[_0xe4ef7d(0x1f3)](_0xe4ef7d(0x1e1)+_0x5148f9[_0xe4ef7d(0x209)]);if(_0x5148f9[_0xe4ef7d(0x21c)])console[_0xe4ef7d(0x1f3)]('\x20\x20Timezone:\x20'+_0x5148f9[_0xe4ef7d(0x21c)]);}const _0x7a2afb=await withSpinner('Creating\x20schedule...',()=>_0x245fc1[_0xe4ef7d(0x1c4)][_0xe4ef7d(0x1bc)](_0x58db83,_0x5148f9),{'verbose':_0x59ccce[_0xe4ef7d(0x228)]});return console[_0xe4ef7d(0x1f3)](_0xe4ef7d(0x1b2)+_0x7a2afb['data'][_0xe4ef7d(0x1d0)]),await handleSingleObjectOutput(_0x7a2afb[_0xe4ef7d(0x1cb)],_0x59ccce),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x572012(0x1d0)]=a36_0x572012(0x202);[a36_0x572012(0x212)]=a36_0x572012(0x1c2);['validate'](_0x2e3dc4){const _0x2e0e87=a36_0x572012,_0x586394=_0x2e3dc4['args'][0x0];if(!_0x586394)return _0x2e0e87(0x204);return undefined;}async['execute'](_0x2570e4){const _0x56cf67=a36_0x572012,{options:_0x144cfd,args:_0x3a48d4,tdx:_0x12efa0}=_0x2570e4,_0x76085d=_0x3a48d4[0x0],_0x252460=_0x144cfd,_0x303d70={};if(_0x252460['database'])_0x303d70[_0x56cf67(0x1fc)]=_0x252460['database'];if(_0x252460['type'])_0x303d70['type']=_0x252460[_0x56cf67(0x1a7)];if(_0x252460[_0x56cf67(0x209)])_0x303d70[_0x56cf67(0x209)]=_0x252460[_0x56cf67(0x209)];if(_0x252460[_0x56cf67(0x21c)])_0x303d70[_0x56cf67(0x21c)]=_0x252460['timezone'];if(_0x252460[_0x56cf67(0x1ec)]!==undefined)_0x303d70[_0x56cf67(0x1ec)]=Number(_0x252460[_0x56cf67(0x1ec)]);if(_0x252460[_0x56cf67(0x219)]!==undefined)_0x303d70['priority']=Number(_0x252460[_0x56cf67(0x219)]);if(_0x252460['retryLimit']!==undefined)_0x303d70[_0x56cf67(0x215)]=Number(_0x252460[_0x56cf67(0x1cc)]);if(_0x252460[_0x56cf67(0x214)])_0x303d70[_0x56cf67(0x1a1)]=_0x252460['engineVersion'];if(_0x252460[_0x56cf67(0x1a4)])_0x303d70[_0x56cf67(0x1a4)]=_0x252460[_0x56cf67(0x1a4)];if(_0x252460[_0x56cf67(0x1bf)])try{_0x303d70[_0x56cf67(0x1d9)]=readFileSync(_0x252460[_0x56cf67(0x1bf)],_0x56cf67(0x1dd))['trim']();}catch(_0x2db897){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20read\x20file:\x20'+_0x252460[_0x56cf67(0x1bf)],_0x2db897 instanceof Error?_0x2db897:undefined);}if(Object[_0x56cf67(0x22e)](_0x303d70)[_0x56cf67(0x1ce)]===0x0)throw new SDKError(ErrorCode[_0x56cf67(0x21a)],_0x56cf67(0x1d2));if(_0x144cfd[_0x56cf67(0x228)]){console[_0x56cf67(0x1f3)](_0x56cf67(0x1c6)+_0x76085d);for(const [_0x11695c,_0x2bedbb]of Object[_0x56cf67(0x1b1)](_0x303d70)){_0x11695c==='query'?console[_0x56cf67(0x1f3)]('\x20\x20'+_0x11695c+':\x20'+_0x2bedbb[_0x56cf67(0x1e6)](0x0,0x32)+_0x56cf67(0x1a3)):console['error']('\x20\x20'+_0x11695c+':\x20'+_0x2bedbb);}}const _0x1aedfa=await withSpinner(_0x56cf67(0x1b8),()=>_0x12efa0['schedules']['update'](_0x76085d,_0x303d70),{'verbose':_0x144cfd['verbose']});return console['error'](_0x56cf67(0x1df)+_0x1aedfa[_0x56cf67(0x1cb)]['name']),await handleSingleObjectOutput(_0x1aedfa[_0x56cf67(0x1cb)],_0x144cfd),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x572012(0x1d0)]=a36_0x572012(0x1ba);[a36_0x572012(0x212)]=a36_0x572012(0x1ab);[a36_0x572012(0x1c0)](_0x588d38){const _0x3cb87b=a36_0x572012,_0x2fa3b4=_0x588d38[_0x3cb87b(0x1d8)][0x0];if(!_0x2fa3b4)return _0x3cb87b(0x1e7);return undefined;}async[a36_0x572012(0x1a2)](_0x26bc98){const _0x4b5732=a36_0x572012,{options:_0x37ff53,args:_0x57c444,tdx:_0x1b4d0d}=_0x26bc98,_0x4a43c9=_0x57c444[0x0];if(!_0x37ff53[_0x4b5732(0x1ef)]){const _0x5f1812=await confirm(_0x4b5732(0x21b)+_0x4a43c9+'\x22?');if(!_0x5f1812)return console['error'](_0x4b5732(0x200)),0x0;}const _0x4ef3eb=await withSpinner(_0x4b5732(0x1c8),()=>_0x1b4d0d[_0x4b5732(0x1c4)][_0x4b5732(0x1f8)](_0x4a43c9),{'verbose':_0x37ff53[_0x4b5732(0x228)]});return console[_0x4b5732(0x1f3)](_0x4b5732(0x1e2)+_0x4ef3eb[_0x4b5732(0x1cb)][_0x4b5732(0x1d0)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x572012(0x1d0)]=a36_0x572012(0x1cd);[a36_0x572012(0x212)]='Run\x20a\x20scheduled\x20query\x20immediately';[a36_0x572012(0x1c0)](_0x8e7b97){const _0x17face=a36_0x572012,_0x3c6ef3=_0x8e7b97['args'][0x0];if(!_0x3c6ef3)return _0x17face(0x1fd);return undefined;}async[a36_0x572012(0x1a2)](_0x4bdcc3){const _0xdfae1b=a36_0x572012,{options:_0x196e19,args:_0x4efc49,tdx:_0x32d021}=_0x4bdcc3,_0x2d6cf7=_0x4efc49[0x0],_0x2d1710=_0x196e19,_0x300acb=_0x2d1710['time'],_0x3c30a4=_0x2d1710[_0xdfae1b(0x1d3)]!==undefined?Number(_0x2d1710[_0xdfae1b(0x1d3)]):undefined;if(_0x196e19[_0xdfae1b(0x228)]){console[_0xdfae1b(0x1f3)](_0xdfae1b(0x1a9)+_0x2d6cf7);if(_0x300acb)console[_0xdfae1b(0x1f3)](_0xdfae1b(0x1d4)+_0x300acb);if(_0x3c30a4)console[_0xdfae1b(0x1f3)](_0xdfae1b(0x1c7)+_0x3c30a4);}const _0x5c6b84=await withSpinner(_0xdfae1b(0x222),()=>_0x32d021[_0xdfae1b(0x1c4)][_0xdfae1b(0x223)](_0x2d6cf7,{'time':_0x300acb,'num':_0x3c30a4}),{'verbose':_0x196e19[_0xdfae1b(0x228)]}),_0x3cacf3=_0x5c6b84[_0xdfae1b(0x1cb)][_0xdfae1b(0x1db)];console[_0xdfae1b(0x1f3)](_0xdfae1b(0x1da)+_0x3cacf3['length']+_0xdfae1b(0x1b6)+(_0x3cacf3[_0xdfae1b(0x1ce)]!==0x1?'s':'')+_0xdfae1b(0x1af));for(const _0x451e99 of _0x3cacf3){console[_0xdfae1b(0x1f3)](_0xdfae1b(0x1ad)+_0x451e99[_0xdfae1b(0x1ae)]);}return await handleSDKOutput(_0x3cacf3,_0x196e19),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a36_0x572012(0x1d0)]=a36_0x572012(0x20d);['description']=a36_0x572012(0x210);['validate'](_0x1eb19b){const _0x4d2545=_0x1eb19b['args'][0x0];if(!_0x4d2545)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async[a36_0x572012(0x1a2)](_0x74d4c3){const _0x377354=a36_0x572012,{options:_0x18b607,args:_0x1dcde2,tdx:_0x564e12}=_0x74d4c3,_0x46c8cf=_0x1dcde2[0x0],_0x121faa=_0x18b607,_0x417fb0=_0x121faa[_0x377354(0x1b7)]!==undefined?Number(_0x121faa[_0x377354(0x1b7)]):undefined,_0x49fab5=_0x121faa['to']!==undefined?Number(_0x121faa['to']):undefined,_0x2546ed=await withSpinner('Getting\x20schedule\x20history...',()=>_0x564e12['schedules'][_0x377354(0x1fa)](_0x46c8cf,{'from':_0x417fb0,'to':_0x49fab5}),{'verbose':_0x18b607[_0x377354(0x228)]}),_0x15b3ad=_0x2546ed[_0x377354(0x1cb)];console['error'](_0x377354(0x1a6)+_0x15b3ad[_0x377354(0x22f)]+_0x377354(0x1f6)+(_0x15b3ad['count']!==0x1?'s':'')+_0x377354(0x1ff)+_0x15b3ad['from']+'-'+_0x15b3ad['to']+')');const _0x3bb4a3=_0x15b3ad[_0x377354(0x1fa)]['map'](_0x164b6a=>({'job_id':_0x164b6a[_0x377354(0x1ae)],'type':_0x164b6a[_0x377354(0x1a7)],'status':_0x164b6a[_0x377354(0x20b)],'scheduled_at':_0x164b6a['scheduled_at'],'created_at':_0x164b6a[_0x377354(0x207)],'start_at':_0x164b6a['start_at'],'end_at':_0x164b6a[_0x377354(0x22b)]}));return await handleSDKOutput(_0x3bb4a3,_0x18b607),0x0;}}
@@ -1 +1 @@
1
- const a37_0x43d6d6=a37_0x5178;(function(_0x3674af,_0x1ffbb8){const _0x1f822e=a37_0x5178,_0x427e7b=_0x3674af();while(!![]){try{const _0x39fc4d=parseInt(_0x1f822e(0x104))/0x1*(-parseInt(_0x1f822e(0x8c))/0x2)+-parseInt(_0x1f822e(0xfc))/0x3+parseInt(_0x1f822e(0xa6))/0x4*(parseInt(_0x1f822e(0x8f))/0x5)+parseInt(_0x1f822e(0x11c))/0x6+parseInt(_0x1f822e(0xfb))/0x7*(parseInt(_0x1f822e(0x8b))/0x8)+parseInt(_0x1f822e(0x97))/0x9*(parseInt(_0x1f822e(0x9f))/0xa)+-parseInt(_0x1f822e(0xa3))/0xb*(parseInt(_0x1f822e(0xc0))/0xc);if(_0x39fc4d===_0x1ffbb8)break;else _0x427e7b['push'](_0x427e7b['shift']());}catch(_0x2e6148){_0x427e7b['push'](_0x427e7b['shift']());}}}(a37_0xdfc8,0x6cc58));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';function a37_0xdfc8(){const _0x5323b3=['Error:\x20','404529NRwbhf','Use:\x20tdx\x20ps\x20desc','Fetching\x20folder\x20\x27','segment:sql','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','\x20\x20Full\x20path:\x20','\x20[Job\x20ID:\x20','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','length','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','\x27\x20with\x20ID:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','type','getSegmentSQLFromYaml','segment:describe','Fetching\x20segment\x20details...','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','name','\x27...','folder','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','2789178IdHaNq','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','information_schema','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Site:\x20','listFolders','/e/','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','getSegment','Fetching\x20folder\x20details...','Fetching\x20SQL\x20from\x20rule...','verbose','jobId','Error:\x20Path\x20or\x20name\x20is\x20required','log','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','error','Folder\x20name:\x20','segmentPath','resolvePathToResource','Show\x20segment\x20folder\x20details','SEGMENT_FOLDER_NOT_FOUND','format','Usage:\x20tdx\x20sg\x20desc\x20<name>','json','8EgrIzp','2VKJRle','Parent\x20ID:\x20','SQL\x20query:\x0a','665ikjwsk','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','cause','red','Error:\x20Parent\x20segment\x20name\x20is\x20required','/app/ps/','resolveFolderId','27ynBSJC','Usage:\x20tdx\x20sg\x20show\x20<name>','Resolving\x20path\x20\x27','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Resolved\x20parent\x20ID:\x20','execute','jsonl','parent','1789540npWwlN','SELECT\x20*\x20FROM\x20(\x0a','description','parentFolder','11MrwTbw','green','Folder\x20ID\x20missing\x20from\x20resolved\x20path','22028bjLjvc','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Usage:','Options:','Folder\x20ID:\x20','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Target\x20path:\x20','getSQLFromYamlFile','\x20\x20Parent\x20segment:\x20','Resolving\x20\x27','Examples:','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','content','getFolder','resolveParentId','Resolved\x20YAML\x20file:\x20','limit','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','segment','segmentId','\x20Opening\x20','includes','parentId','Parent\x20name:\x20','fullPath','Resolved\x20folder\x20ID:\x20','17920740ajZxwL','Segment\x20ID\x20missing\x20from\x20resolved\x20path','stats','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','\x20rows\x20','Resolved\x20type:\x20','Resolved\x20relative\x20path\x20to:\x20','createFolder','segment:folder:list','elapsedTimeMillis','test','setJobId','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','folderId','getSQLFromServerSegment','(root)','segment:show','Listing\x20folders\x20for\x20parent\x20\x27','url','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','\x20folder','Segment\x20ID:\x20','INVALID_ARGUMENT','data','toLocaleString','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20tdx\x20sg\x20sql\x20--path\x20','cyan','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Fetching\x20SQL\x20for\x20segment...','✔\x20Query\x20completed:\x20Processed\x20','getSegmentSQL','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','code','Use:\x20tdx\x20ps\x20view\x20-w','query','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20Cause:\x20','segment:view','trim','site','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','segmentName','processedRows','parentSegment','SEGMENT_NOT_FOUND','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','Show\x20folder\x20or\x20child\x20segment\x20details','Usage:\x20tdx\x20segment\x20describe\x20<path>','Resolving\x20parent\x20folder\x20\x27','message','Resolving\x20parent\x20segment\x20\x27','Get\x20SQL\x20query\x20for\x20child\x20segment','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','Parent\x20segment:\x20','web','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','✔\x20Found\x20','path','5793767IRcfaU','655155CZhJsU','Fetching\x20parent\x20segment\x20details...','Resolved:\x20','Use:\x20tdx\x20ps\x20show','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','\x20\x20Folder\x20path:\x20','\x20\x20Segment\x20name:\x20'];a37_0xdfc8=function(){return _0x5323b3;};return a37_0xdfc8();}import a37_0x3d1aae from'chalk';async function resolveSegmentTarget(_0x26421b,_0x59e7e6,_0x3514c3){const _0x3f8ddc=a37_0x5178;if(isYamlFilePath(_0x26421b))try{const _0x53ab4f=await resolveYamlFilePath(_0x26421b);return _0x3514c3&&(console['error'](_0x3f8ddc(0xb5)+_0x26421b),console['error'](_0x3f8ddc(0xae)+_0x53ab4f[_0x3f8ddc(0xec)]),console[_0x3f8ddc(0x82)](_0x3f8ddc(0x102)+_0x53ab4f[_0x3f8ddc(0xea)]),console['error'](_0x3f8ddc(0x101)+(_0x53ab4f['folderPath']||_0x3f8ddc(0xcf))),console[_0x3f8ddc(0x82)](_0x3f8ddc(0x109)+_0x53ab4f[_0x3f8ddc(0xbe)])),_0x53ab4f['fullPath'];}catch(_0x50a0aa){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x50a0aa['message']);}if(!_0x59e7e6)throw new SDKError(ErrorCode[_0x3f8ddc(0xd6)],_0x3f8ddc(0x100));return _0x59e7e6+'/'+_0x26421b;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x43d6d6(0x116)]=a37_0x43d6d6(0x112);[a37_0x43d6d6(0xa1)]='Show\x20segment\x20or\x20folder\x20details';async['execute'](_0xc1402c){const _0x157c3e=a37_0x43d6d6,{options:_0x1f8190,args:_0x54ae76,tdx:_0x58e708}=_0xc1402c,_0x5e7e6b=_0x54ae76[0x0],_0x26e08a=!_0x5e7e6b&&!!_0x1f8190[_0x157c3e(0xec)],_0x5b2918=_0x5e7e6b||_0x1f8190[_0x157c3e(0xec)];if(!_0x5b2918)return console[_0x157c3e(0x82)](_0x157c3e(0x7f)),console['error'](_0x157c3e(0xf0)),console[_0x157c3e(0x82)](_0x157c3e(0xb0)),console[_0x157c3e(0x82)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console[_0x157c3e(0x82)](_0x157c3e(0xf8)),console[_0x157c3e(0x82)](_0x157c3e(0x11d)),console[_0x157c3e(0x82)](_0x157c3e(0x11b)),0x1;try{const _0x3115e3=_0x1f8190[_0x157c3e(0x84)];let _0x2d724d=_0x5b2918;!_0x26e08a&&_0x3115e3&&!_0x5b2918[_0x157c3e(0xbb)]('/')&&(_0x2d724d=_0x3115e3+'/'+_0x5b2918,_0x1f8190[_0x157c3e(0x7d)]&&console[_0x157c3e(0x82)](_0x157c3e(0xc6)+_0x2d724d));const _0x2e4218=await withSpinner(_0x157c3e(0x99)+_0x2d724d+_0x157c3e(0x117),()=>_0x58e708[_0x157c3e(0xb8)][_0x157c3e(0x85)](_0x2d724d),{'verbose':_0x1f8190[_0x157c3e(0x7d)]}),_0x549f35=_0x2e4218[_0x157c3e(0xd7)];_0x1f8190[_0x157c3e(0x7d)]&&(console[_0x157c3e(0x82)]('Resolved\x20type:\x20'+_0x549f35[_0x157c3e(0x110)]),console[_0x157c3e(0x82)](_0x157c3e(0x8d)+_0x549f35['parentId']),_0x549f35[_0x157c3e(0xcd)]&&console[_0x157c3e(0x82)](_0x157c3e(0xaa)+_0x549f35[_0x157c3e(0xcd)]),_0x549f35[_0x157c3e(0xb9)]&&console['error'](_0x157c3e(0xd5)+_0x549f35[_0x157c3e(0xb9)]));if(_0x549f35[_0x157c3e(0x110)]===_0x157c3e(0x9e)){const _0x22630e=await withSpinner(_0x157c3e(0xfd),()=>_0x58e708[_0x157c3e(0xb8)]['getParent'](_0x549f35[_0x157c3e(0xbc)]),{'verbose':_0x1f8190[_0x157c3e(0x7d)]});await handleSingleObjectOutput(_0x22630e[_0x157c3e(0xd7)],_0x1f8190);}else{if(_0x549f35['type']===_0x157c3e(0x118)){if(!_0x549f35['folderId'])throw new SDKError(ErrorCode[_0x157c3e(0x87)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x5e84fe=await withSpinner('Fetching\x20folder\x20details...',()=>_0x58e708[_0x157c3e(0xb8)][_0x157c3e(0xb3)](_0x549f35[_0x157c3e(0xcd)]),{'verbose':_0x1f8190[_0x157c3e(0x7d)]});await handleSingleObjectOutput(_0x5e84fe['data'],_0x1f8190);}else{if(_0x549f35['type']===_0x157c3e(0xb8)){if(!_0x549f35[_0x157c3e(0xb9)])throw new SDKError(ErrorCode[_0x157c3e(0xed)],_0x157c3e(0xc1));const _0x170c29=await withSpinner(_0x157c3e(0x113),()=>_0x58e708[_0x157c3e(0xb8)]['getSegment'](_0x549f35[_0x157c3e(0xbc)],_0x549f35[_0x157c3e(0xb9)]),{'verbose':_0x1f8190[_0x157c3e(0x7d)]});await handleSingleObjectOutput(_0x170c29[_0x157c3e(0xd7)],_0x1f8190);}}}return 0x0;}catch(_0x153f25){if(_0x153f25 instanceof SDKError)return console[_0x157c3e(0x82)](_0x157c3e(0x103)+_0x153f25[_0x157c3e(0xf2)]),_0x153f25[_0x157c3e(0x92)]&&console[_0x157c3e(0x82)](_0x157c3e(0xe5)+_0x153f25[_0x157c3e(0x92)]),0x1;throw _0x153f25;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x43d6d6(0x116)]=a37_0x43d6d6(0xd0);[a37_0x43d6d6(0xa1)]=a37_0x43d6d6(0x123);async['execute'](_0x2047f4){const _0x2d9402=a37_0x43d6d6,{options:_0x92641d,args:_0x10ac7,tdx:_0x466003}=_0x2047f4,_0xe5b546=_0x10ac7[0x0];if(!_0xe5b546)return console[_0x2d9402(0x82)](_0x2d9402(0x90)),console[_0x2d9402(0x82)](_0x2d9402(0x98)),console[_0x2d9402(0x82)](_0x2d9402(0x115)),console[_0x2d9402(0x82)](_0x2d9402(0xb0)),console[_0x2d9402(0x82)](_0x2d9402(0x91)),console[_0x2d9402(0x82)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x4bacc4=_0x92641d[_0x2d9402(0xec)],_0x6256a9=await resolveSegmentTarget(_0xe5b546,_0x4bacc4,_0x92641d[_0x2d9402(0x7d)]);_0x92641d['verbose']&&console[_0x2d9402(0x82)](_0x2d9402(0xac)+_0x6256a9);const _0x13a789=await withSpinner(_0x2d9402(0xaf)+_0xe5b546+_0x2d9402(0x117),()=>_0x466003[_0x2d9402(0xb8)][_0x2d9402(0x85)](_0x6256a9),{'verbose':_0x92641d[_0x2d9402(0x7d)]}),_0x50bd69=_0x13a789[_0x2d9402(0xd7)];_0x92641d[_0x2d9402(0x7d)]&&(console[_0x2d9402(0x82)](_0x2d9402(0xc5)+_0x50bd69[_0x2d9402(0x110)]),console[_0x2d9402(0x82)](_0x2d9402(0x8d)+_0x50bd69[_0x2d9402(0xbc)]));if(_0x50bd69[_0x2d9402(0x110)]===_0x2d9402(0x118))return console[_0x2d9402(0x82)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0x2d9402(0x82)]('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x50bd69[_0x2d9402(0x110)]===_0x2d9402(0x9e))return console[_0x2d9402(0x82)](_0x2d9402(0xdc)),console[_0x2d9402(0x82)](_0x2d9402(0xff)),0x1;if(!_0x50bd69['segmentId'])throw new SDKError(ErrorCode[_0x2d9402(0xed)],_0x2d9402(0xc1));const _0x5750cd=await withSpinner(_0x2d9402(0xdd),()=>_0x466003[_0x2d9402(0xb8)][_0x2d9402(0xdf)](_0x50bd69[_0x2d9402(0xbc)],_0x50bd69[_0x2d9402(0xb9)]),{'verbose':_0x92641d[_0x2d9402(0x7d)]});let _0x87a398=_0x5750cd[_0x2d9402(0xd7)];const _0x53f1ef=resolveLimit(_0x92641d[_0x2d9402(0xb6)],DEFAULT_DISPLAY_LIMIT),_0x59f18d=/\bLIMIT\s+\d+/i[_0x2d9402(0xca)](_0x87a398);!_0x59f18d&&(_0x87a398=_0x87a398[_0x2d9402(0xe7)]()['replace'](/;+$/,''),_0x87a398=_0x2d9402(0xa0)+_0x87a398+_0x2d9402(0xa7)+_0x53f1ef);_0x92641d['verbose']&&console[_0x2d9402(0x82)](_0x2d9402(0x8e)+_0x87a398);const _0x5b4723=await withProgressSpinner('Executing\x20segment\x20query...',async _0x2a0b90=>{const _0x5abce6=_0x2d9402,_0x1ecc06=await _0x466003[_0x5abce6(0xe3)][_0x5abce6(0x9c)](_0x87a398,{'catalog':'td','schema':_0x5abce6(0x11e),'onJobId':_0xaf94e4=>{const _0x3b486c=_0x5abce6;_0x2a0b90[_0x3b486c(0xcb)](_0xaf94e4);}});return _0x1ecc06;},{'verbose':_0x92641d[_0x2d9402(0x7d)]}),_0x1fb5e8=_0x5b4723[_0x2d9402(0xd7)],_0x49e550=_0x1fb5e8[_0x2d9402(0x7e)]?_0x2d9402(0x10a)+_0x1fb5e8[_0x2d9402(0x7e)]+']':'';return console['error'](_0x2d9402(0xde)+_0x1fb5e8['stats'][_0x2d9402(0xeb)][_0x2d9402(0xd8)]()+_0x2d9402(0xc4)+('in\x20'+formatElapsed(_0x1fb5e8[_0x2d9402(0xc2)][_0x2d9402(0xc9)])+_0x49e550)),await handleQueryOutput(_0x1fb5e8,_0x92641d),0x0;}catch(_0x1f8469){if(_0x1f8469 instanceof SDKError)return console[_0x2d9402(0x82)]('✖\x20Query\x20failed\x20['+_0x1f8469[_0x2d9402(0xe1)]+']'),console[_0x2d9402(0x82)]('\x0a'+_0x1f8469[_0x2d9402(0xf2)]),0x1;throw _0x1f8469;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x43d6d6(0x116)]=a37_0x43d6d6(0xc8);[a37_0x43d6d6(0xa1)]=a37_0x43d6d6(0x119);async['execute'](_0x18802a){const _0x516457=a37_0x43d6d6,{options:_0x48a815,args:_0x138817,tdx:_0x1462b8}=_0x18802a;if(_0x138817[_0x516457(0x10c)]===0x0)return console['error'](_0x516457(0x94)),console[_0x516457(0x82)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x79a7ba=_0x138817[0x0];try{_0x48a815[_0x516457(0x7d)]&&(console['error'](_0x516457(0x120)+_0x48a815[_0x516457(0xe8)]),console['error'](_0x516457(0xbd)+_0x79a7ba));const _0xb872dc=await withSpinner(_0x516457(0xf3)+_0x79a7ba+_0x516457(0x117),()=>_0x1462b8[_0x516457(0xb8)][_0x516457(0xb4)](_0x79a7ba),{'verbose':_0x48a815[_0x516457(0x7d)]}),_0x2f0b1d=_0xb872dc['data'];_0x48a815['verbose']&&console[_0x516457(0x82)](_0x516457(0x9b)+_0x2f0b1d);const _0x263293=await withSpinner(_0x516457(0xd1)+_0x79a7ba+'\x27...',()=>_0x1462b8[_0x516457(0xb8)][_0x516457(0x121)](_0x2f0b1d),{'verbose':_0x48a815['verbose']}),_0x95b874=_0x263293[_0x516457(0xd7)];return console['error'](_0x516457(0xf9)+_0x95b874[_0x516457(0x10c)]+_0x516457(0xd4)+(_0x95b874['length']!==0x1?'s':'')),await handleSDKOutput(_0x95b874,_0x48a815),0x0;}catch(_0x4166e4){if(_0x4166e4 instanceof SDKError)return console[_0x516457(0x82)]('Error:\x20'+_0x4166e4[_0x516457(0xf2)]),_0x4166e4[_0x516457(0x92)]&&console['error'](_0x516457(0xe5)+_0x4166e4[_0x516457(0x92)]),0x1;throw _0x4166e4;}}}function a37_0x5178(_0x14d5a9,_0x3a880c){_0x14d5a9=_0x14d5a9-0x7d;const _0xdfc8c=a37_0xdfc8();let _0x517857=_0xdfc8c[_0x14d5a9];return _0x517857;}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x43d6d6(0x116)]='segment:folder:show';[a37_0x43d6d6(0xa1)]=a37_0x43d6d6(0x86);async[a37_0x43d6d6(0x9c)](_0x74b163){const _0x159f9c=a37_0x43d6d6,{options:_0x20b88b,args:_0x1d5e8d,tdx:_0x118282}=_0x74b163;if(_0x1d5e8d[_0x159f9c(0x10c)]===0x0)return console['error']('Error:\x20Folder\x20reference\x20is\x20required'),console[_0x159f9c(0x82)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x439521,childId:_0x40f322}=parseSegmentRef(_0x1d5e8d[0x0]);_0x20b88b['verbose']&&(console[_0x159f9c(0x82)]('Site:\x20'+_0x20b88b[_0x159f9c(0xe8)]),console['error'](_0x159f9c(0xbd)+_0x439521),_0x40f322&&console[_0x159f9c(0x82)]('Folder\x20name:\x20'+_0x40f322));if(!_0x40f322)return console['error']('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x49b031=await withSpinner(_0x159f9c(0xf3)+_0x439521+'\x27...',()=>_0x118282[_0x159f9c(0xb8)][_0x159f9c(0xb4)](_0x439521),{'verbose':_0x20b88b['verbose']}),_0x1d670f=_0x49b031[_0x159f9c(0xd7)];_0x20b88b['verbose']&&console['error'](_0x159f9c(0x9b)+_0x1d670f);const _0x54271b=await withSpinner('Resolving\x20folder\x20\x27'+_0x40f322+'\x27...',()=>_0x118282[_0x159f9c(0xb8)][_0x159f9c(0x96)](_0x1d670f,_0x40f322),{'verbose':_0x20b88b[_0x159f9c(0x7d)]}),_0x19ce7a=_0x54271b['data'];_0x20b88b[_0x159f9c(0x7d)]&&console[_0x159f9c(0x82)](_0x159f9c(0xbf)+_0x19ce7a);const _0x285af1=await withSpinner(_0x159f9c(0x106)+_0x40f322+_0x159f9c(0x117),()=>_0x118282[_0x159f9c(0xb8)][_0x159f9c(0xb3)](_0x19ce7a),{'verbose':_0x20b88b[_0x159f9c(0x7d)]});return await handleSDKOutput([_0x285af1[_0x159f9c(0xd7)]],_0x20b88b),0x0;}catch(_0x2a04e7){if(_0x2a04e7 instanceof SDKError)return console[_0x159f9c(0x82)](_0x159f9c(0x103)+_0x2a04e7[_0x159f9c(0xf2)]),_0x2a04e7[_0x159f9c(0x92)]&&console[_0x159f9c(0x82)](_0x159f9c(0xe5)+_0x2a04e7['cause']),0x1;throw _0x2a04e7;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x43d6d6(0x116)]=a37_0x43d6d6(0x107);[a37_0x43d6d6(0xa1)]=a37_0x43d6d6(0xf4);async[a37_0x43d6d6(0x9c)](_0x3b2856){const _0x7179fb=a37_0x43d6d6,{options:_0x1031ab,args:_0x25c890}=_0x3b2856,_0x192dda=_0x1031ab,_0x324fb6=_0x192dda[_0x7179fb(0xfa)],_0x578fe6=_0x25c890[0x0];if(!_0x578fe6&&!_0x324fb6)return console[_0x7179fb(0x82)](a37_0x3d1aae[_0x7179fb(0x93)](_0x7179fb(0xe0))),console[_0x7179fb(0x82)](_0x7179fb(0xa8)),console['error'](_0x7179fb(0xf5)),console[_0x7179fb(0x82)](_0x7179fb(0xb1)),console['error'](_0x7179fb(0xb0)),console[_0x7179fb(0x82)]('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x7179fb(0x82)](_0x7179fb(0xd3)),0x1;if(_0x578fe6&&_0x324fb6)return console['error'](a37_0x3d1aae[_0x7179fb(0x93)](_0x7179fb(0xee))),0x1;try{let _0x1412d7;if(_0x324fb6)_0x1412d7=await this[_0x7179fb(0xad)](_0x324fb6,_0x3b2856);else{if(isYamlFilePath(_0x578fe6))return console['error'](a37_0x3d1aae[_0x7179fb(0x93)]('Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option')),console[_0x7179fb(0x82)](_0x7179fb(0xda)+_0x578fe6),0x1;else _0x1412d7=await this[_0x7179fb(0xce)](_0x578fe6,_0x3b2856);}return _0x1031ab[_0x7179fb(0x88)]===_0x7179fb(0x8a)||_0x1031ab[_0x7179fb(0x88)]===_0x7179fb(0x9d)?await handleSDKOutput([{'sql':_0x1412d7}],_0x1031ab):console[_0x7179fb(0x80)](_0x1412d7),0x0;}catch(_0x5b9f54){if(_0x5b9f54 instanceof SDKError)return console['error'](_0x7179fb(0x103)+_0x5b9f54[_0x7179fb(0xf2)]),_0x5b9f54[_0x7179fb(0x92)]&&console[_0x7179fb(0x82)](_0x7179fb(0xe5)+_0x5b9f54[_0x7179fb(0x92)]),0x1;throw _0x5b9f54;}}async[a37_0x43d6d6(0xad)](_0x21c285,_0x4e21e3){const _0x28d755=a37_0x43d6d6,{options:_0x579c85,tdx:_0x2c5e6e}=_0x4e21e3;let _0x4d0a1d;try{_0x4d0a1d=await resolveYamlFilePath(_0x21c285);}catch(_0x257f10){throw new SDKError(ErrorCode[_0x28d755(0xd6)],_0x28d755(0x10b)+_0x257f10[_0x28d755(0xf2)]);}_0x579c85['verbose']&&console[_0x28d755(0x82)](_0x28d755(0xfe)+_0x4d0a1d[_0x28d755(0xec)]+'/'+_0x4d0a1d['segmentName']);const _0x59cc23=await withSpinner(_0x28d755(0x126),()=>_0x2c5e6e[_0x28d755(0xb8)][_0x28d755(0x111)](_0x4d0a1d[_0x28d755(0xb2)],_0x4d0a1d['parentSegment'],_0x4d0a1d[_0x28d755(0xea)]),{'verbose':_0x579c85[_0x28d755(0x7d)]});return _0x59cc23['data'];}async['getSQLFromServerSegment'](_0x222298,_0x37378a){const _0x2f4469=a37_0x43d6d6,{options:_0x4b868c,tdx:_0x4b9474}=_0x37378a,_0x346315=_0x4b868c[_0x2f4469(0xec)],_0x4fbac9=await resolveSegmentTarget(_0x222298,_0x346315,_0x4b868c[_0x2f4469(0x7d)]);_0x4b868c[_0x2f4469(0x7d)]&&console[_0x2f4469(0x82)]('Target\x20path:\x20'+_0x4fbac9);const _0x1b7bfc=await withSpinner('Resolving\x20\x27'+_0x222298+_0x2f4469(0x117),()=>_0x4b9474[_0x2f4469(0xb8)][_0x2f4469(0x85)](_0x4fbac9),{'verbose':_0x4b868c['verbose']}),_0x5a53bc=_0x1b7bfc['data'];_0x4b868c[_0x2f4469(0x7d)]&&(console[_0x2f4469(0x82)]('Resolved\x20type:\x20'+_0x5a53bc['type']),console[_0x2f4469(0x82)](_0x2f4469(0x8d)+_0x5a53bc['parentId']));if(_0x5a53bc[_0x2f4469(0x110)]===_0x2f4469(0x118))throw new SDKError(ErrorCode[_0x2f4469(0xd6)],_0x2f4469(0x11f));if(_0x5a53bc[_0x2f4469(0x110)]===_0x2f4469(0x9e))throw new SDKError(ErrorCode[_0x2f4469(0xd6)],_0x2f4469(0x108));if(!_0x5a53bc[_0x2f4469(0xb9)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x2f4469(0xc1));const _0x5f10df=await withSpinner(_0x2f4469(0xdd),()=>_0x4b9474[_0x2f4469(0xb8)]['getSegmentSQL'](_0x5a53bc['parentId'],_0x5a53bc[_0x2f4469(0xb9)]),{'verbose':_0x4b868c[_0x2f4469(0x7d)]});return _0x5f10df[_0x2f4469(0xd7)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x43d6d6(0x116)]='segment:folder:create';[a37_0x43d6d6(0xa1)]='Create\x20segment\x20folder\x20for\x20organization';async[a37_0x43d6d6(0x9c)](_0x3c3ddc){const _0x1a5f8f=a37_0x43d6d6,{options:_0x263629,args:_0x321dd9,tdx:_0x1b7151}=_0x3c3ddc,_0x5eb6e2=_0x263629;if(_0x321dd9[_0x1a5f8f(0x10c)]<0x2)return console[_0x1a5f8f(0x82)](_0x1a5f8f(0x81)),console[_0x1a5f8f(0x82)](_0x1a5f8f(0xe9)),0x1;const _0x4f45f0=_0x321dd9[0x0],_0x48972a=_0x321dd9[0x1];_0x5eb6e2['verbose']&&(console['error']('Site:\x20'+_0x5eb6e2['site']),console[_0x1a5f8f(0x82)](_0x1a5f8f(0xf6)+_0x4f45f0),console[_0x1a5f8f(0x82)](_0x1a5f8f(0x83)+_0x48972a));let _0x4ae32e;if(_0x5eb6e2[_0x1a5f8f(0xa2)]){const _0x501f32=_0x5eb6e2['parentFolder'],_0x2c8203=await withSpinner(_0x1a5f8f(0xf3)+_0x4f45f0+_0x1a5f8f(0x117),()=>_0x1b7151['segment']['resolveParentId'](_0x4f45f0),{'verbose':_0x5eb6e2[_0x1a5f8f(0x7d)]}),_0x10d09d=_0x2c8203['data'],_0x55fb48=await withSpinner(_0x1a5f8f(0xf1)+_0x501f32+_0x1a5f8f(0x117),()=>_0x1b7151[_0x1a5f8f(0xb8)][_0x1a5f8f(0x96)](_0x10d09d,_0x501f32),{'verbose':_0x5eb6e2[_0x1a5f8f(0x7d)]});_0x4ae32e=_0x55fb48[_0x1a5f8f(0xd7)],_0x5eb6e2['verbose']&&console['error']('Resolved\x20parent\x20folder\x20ID:\x20'+_0x4ae32e);}const _0x267a7={'name':_0x48972a,'description':_0x5eb6e2['description'],'parentFolderId':_0x4ae32e},_0x52b77c=await withSpinner('Creating\x20folder\x20\x27'+_0x48972a+'\x27...',()=>_0x1b7151['segment'][_0x1a5f8f(0xc7)](_0x4f45f0,_0x267a7),{'verbose':_0x5eb6e2[_0x1a5f8f(0x7d)]}),_0x1a92ee=_0x52b77c[_0x1a5f8f(0xd7)];return console[_0x1a5f8f(0x82)]('✔\x20Created\x20folder\x20\x27'+_0x1a92ee[_0x1a5f8f(0x116)]+_0x1a5f8f(0x10e)+_0x1a92ee['id']),await handleSDKOutput([_0x1a92ee],_0x5eb6e2),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x43d6d6(0x116)]=a37_0x43d6d6(0xe6);['description']=a37_0x43d6d6(0xef);async[a37_0x43d6d6(0x9c)](_0x4b758e){const _0x10eefa=a37_0x43d6d6,{options:_0x223ce2,args:_0x40e87d,tdx:_0x43d265}=_0x4b758e,_0x47d90e=_0x40e87d[0x0];if(!_0x47d90e)return console['error'](_0x10eefa(0xd9)),console[_0x10eefa(0x82)](_0x10eefa(0x114)),console[_0x10eefa(0x82)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console[_0x10eefa(0x82)](_0x10eefa(0xa9)),console[_0x10eefa(0x82)](_0x10eefa(0xe4)),console[_0x10eefa(0x82)](_0x10eefa(0xb0)),console[_0x10eefa(0x82)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x10eefa(0x82)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x10eefa(0x82)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console['error'](_0x10eefa(0x11a)),0x1;try{const _0x17d6c6=_0x223ce2[_0x10eefa(0xec)],_0x1eaa1a=await resolveSegmentTarget(_0x47d90e,_0x17d6c6,_0x223ce2['verbose']);_0x223ce2[_0x10eefa(0x7d)]&&console[_0x10eefa(0x82)](_0x10eefa(0xac)+_0x1eaa1a);const _0x538da9=await withSpinner(_0x10eefa(0xaf)+_0x47d90e+_0x10eefa(0x117),()=>_0x43d265[_0x10eefa(0xb8)][_0x10eefa(0x85)](_0x1eaa1a),{'verbose':_0x223ce2[_0x10eefa(0x7d)]}),_0x156271=_0x538da9[_0x10eefa(0xd7)];_0x223ce2[_0x10eefa(0x7d)]&&(console[_0x10eefa(0x82)](_0x10eefa(0xc5)+_0x156271[_0x10eefa(0x110)]),console[_0x10eefa(0x82)](_0x10eefa(0x8d)+_0x156271[_0x10eefa(0xbc)]),_0x156271[_0x10eefa(0xcd)]&&console['error']('Folder\x20ID:\x20'+_0x156271[_0x10eefa(0xcd)]),_0x156271[_0x10eefa(0xb9)]&&console[_0x10eefa(0x82)](_0x10eefa(0xd5)+_0x156271[_0x10eefa(0xb9)]));if(_0x223ce2[_0x10eefa(0xf7)]){if(_0x156271['type']===_0x10eefa(0x118))return console[_0x10eefa(0x82)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x156271[_0x10eefa(0x110)]===_0x10eefa(0x9e))return console[_0x10eefa(0x82)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x10eefa(0x82)](_0x10eefa(0xe2)),0x1;if(!_0x156271[_0x10eefa(0xb9)])throw new SDKError(ErrorCode[_0x10eefa(0xed)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x16b4d3=getConsoleNextUrl(_0x223ce2['site'],_0x10eefa(0x95)+_0x156271[_0x10eefa(0xbc)]+_0x10eefa(0x122)+_0x156271[_0x10eefa(0xb9)]);return console['error'](a37_0x3d1aae[_0x10eefa(0xa4)]('✔')+_0x10eefa(0xba)+a37_0x3d1aae[_0x10eefa(0xdb)](_0x16b4d3)),openBrowser(_0x16b4d3),0x0;}if(_0x156271[_0x10eefa(0x110)]===_0x10eefa(0x118)){if(!_0x156271[_0x10eefa(0xcd)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x10eefa(0xa5));const _0x53b850=await withSpinner(_0x10eefa(0x125),()=>_0x43d265[_0x10eefa(0xb8)]['getFolder'](_0x156271[_0x10eefa(0xcd)]),{'verbose':_0x223ce2['verbose']});await handleSingleObjectOutput(_0x53b850[_0x10eefa(0xd7)],_0x223ce2);}else{if(_0x156271[_0x10eefa(0x110)]===_0x10eefa(0xb8)){if(!_0x156271[_0x10eefa(0xb9)])throw new SDKError(ErrorCode[_0x10eefa(0xed)],_0x10eefa(0xc1));const _0x3f8739=await withSpinner(_0x10eefa(0x113),()=>_0x43d265[_0x10eefa(0xb8)][_0x10eefa(0x124)](_0x156271['parentId'],_0x156271[_0x10eefa(0xb9)]),{'verbose':_0x223ce2[_0x10eefa(0x7d)]}),_0xcf83dc=getConsoleNextUrl(_0x223ce2[_0x10eefa(0xe8)],_0x10eefa(0x95)+_0x156271[_0x10eefa(0xbc)]+_0x10eefa(0x122)+_0x156271[_0x10eefa(0xb9)]),_0x1bb70e=_0x3f8739['data'];_0x1bb70e[_0x10eefa(0xd2)]=_0xcf83dc,await handleSingleObjectOutput(_0x1bb70e,_0x223ce2);}else return console[_0x10eefa(0x82)](_0x10eefa(0xab)),console[_0x10eefa(0x82)]('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0x4e1f46){if(_0x4e1f46 instanceof SDKError)return console[_0x10eefa(0x82)]('Error:\x20'+_0x4e1f46[_0x10eefa(0xf2)]),_0x4e1f46[_0x10eefa(0x92)]&&console[_0x10eefa(0x82)]('\x20\x20Cause:\x20'+_0x4e1f46[_0x10eefa(0x92)]),0x1;throw _0x4e1f46;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a37_0x43d6d6(0x116)]='segment:desc';[a37_0x43d6d6(0xa1)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async['execute'](_0xe79580){const _0x57414a=a37_0x43d6d6,{options:_0x41810b,args:_0x17e7a4,tdx:_0x41866c}=_0xe79580,_0x1bcd7d=_0x17e7a4[0x0];if(!_0x1bcd7d)return console[_0x57414a(0x82)](_0x57414a(0x90)),console[_0x57414a(0x82)](_0x57414a(0x89)),console[_0x57414a(0x82)](_0x57414a(0xc3)),console[_0x57414a(0x82)](_0x57414a(0xb0)),console[_0x57414a(0x82)](_0x57414a(0x9a)),console[_0x57414a(0x82)](_0x57414a(0x10d)),0x1;try{const _0x22a3d6=_0x41810b[_0x57414a(0xec)],_0x328dce=await resolveSegmentTarget(_0x1bcd7d,_0x22a3d6,_0x41810b['verbose']);_0x41810b[_0x57414a(0x7d)]&&console[_0x57414a(0x82)](_0x57414a(0xac)+_0x328dce);const _0x363ac8=await withSpinner(_0x57414a(0xaf)+_0x1bcd7d+_0x57414a(0x117),()=>_0x41866c['segment'][_0x57414a(0x85)](_0x328dce),{'verbose':_0x41810b['verbose']}),_0x493a5f=_0x363ac8[_0x57414a(0xd7)];_0x41810b[_0x57414a(0x7d)]&&(console[_0x57414a(0x82)](_0x57414a(0xc5)+_0x493a5f['type']),console['error']('Parent\x20ID:\x20'+_0x493a5f[_0x57414a(0xbc)]));if(_0x493a5f['type']===_0x57414a(0x118))return console[_0x57414a(0x82)](_0x57414a(0xb7)),console['error'](_0x57414a(0xcc)),0x1;if(_0x493a5f[_0x57414a(0x110)]===_0x57414a(0x9e))return console['error'](_0x57414a(0x10f)),console['error'](_0x57414a(0x105)),0x1;if(!_0x493a5f[_0x57414a(0xb9)])throw new SDKError(ErrorCode[_0x57414a(0xed)],_0x57414a(0xc1));const _0x3dad28=await withSpinner(_0x57414a(0xdd),()=>_0x41866c[_0x57414a(0xb8)][_0x57414a(0xdf)](_0x493a5f[_0x57414a(0xbc)],_0x493a5f[_0x57414a(0xb9)]),{'verbose':_0x41810b['verbose']}),_0x27c331=_0x3dad28[_0x57414a(0xd7)],_0x2871bd=await executeSchemaQuery(_0x27c331,_0x41866c,_0x41810b);return await handleQueryOutput(_0x2871bd,_0x41810b),0x0;}catch(_0x17e4c8){if(_0x17e4c8 instanceof SDKError)return console[_0x57414a(0x82)](_0x57414a(0x103)+_0x17e4c8['message']),_0x17e4c8[_0x57414a(0x92)]&&console['error']('\x20\x20Cause:\x20'+_0x17e4c8[_0x57414a(0x92)]),0x1;throw _0x17e4c8;}}}
1
+ const a37_0x3edfaf=a37_0x421c;(function(_0x2115b6,_0x4f95f7){const _0x608324=a37_0x421c,_0x183c78=_0x2115b6();while(!![]){try{const _0x3309df=-parseInt(_0x608324(0x168))/0x1+-parseInt(_0x608324(0x173))/0x2+-parseInt(_0x608324(0x167))/0x3+-parseInt(_0x608324(0x16f))/0x4*(parseInt(_0x608324(0x107))/0x5)+parseInt(_0x608324(0x139))/0x6+-parseInt(_0x608324(0x106))/0x7+parseInt(_0x608324(0xe1))/0x8;if(_0x3309df===_0x4f95f7)break;else _0x183c78['push'](_0x183c78['shift']());}catch(_0x5b59b3){_0x183c78['push'](_0x183c78['shift']());}}}(a37_0x1f3a,0x2ff88));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';function a37_0x1f3a(){const _0xfc064d=['216527nrnVec','stats','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','✔\x20Query\x20completed:\x20Processed\x20','Use:\x20tdx\x20ps\x20view\x20-w','description','getSegmentSQL','8vSqAwd','folderPath','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','363496wYFVeH','segment','url','query','parentId','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','resolvePathToResource','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','Folder\x20ID:\x20','log','Folder\x20ID\x20missing\x20from\x20resolved\x20path','cyan','Segment\x20ID:\x20','path','jobId','Error:\x20Folder\x20reference\x20is\x20required','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Executing\x20segment\x20query...','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','parentFolder','Resolved\x20type:\x20','resolveParentId','9421192MICQcZ','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Show\x20segment\x20folder\x20details','\x20\x20Folder\x20path:\x20','Resolved\x20parent\x20ID:\x20','Usage:','includes','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','Fetching\x20folder\x20details...','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Resolving\x20\x27','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Site:\x20','SEGMENT_FOLDER_NOT_FOUND','Folder\x20name:\x20','Creating\x20folder\x20\x27','Error:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','segmentName','listFolders','Parent\x20ID:\x20','site','json','SELECT\x20*\x20FROM\x20(\x0a','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Resolved\x20YAML\x20file:\x20','fullPath','segmentPath','\x20\x20Full\x20path:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','data','parent','Show\x20segment\x20or\x20folder\x20details','SEGMENT_NOT_FOUND','Use:\x20tdx\x20ps\x20desc','format','segment:desc','1708847krQfEw','575765SbvXst','message','trim','segment:sql','Resolved:\x20','length','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Target\x20path:\x20','Resolved\x20parent\x20folder\x20ID:\x20','Fetching\x20parent\x20segment\x20details...','/app/ps/','Fetching\x20segment\x20details...','Use:\x20tdx\x20ps\x20view','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','Examples:','parentSegment','execute','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','segmentId','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Error:\x20Path\x20or\x20name\x20is\x20required','SQL\x20query:\x0a','resolveFolderId','replace','web','Parent\x20segment:\x20','setJobId','Use:\x20tdx\x20ps\x20show','green','test','\x27\x20with\x20ID:\x20','toLocaleString','verbose','processedRows','getSQLFromServerSegment','\x20\x20Cause:\x20','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','red','getSegmentSQLFromYaml','Create\x20segment\x20folder\x20for\x20organization','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','segment:folder:show','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','name','type','getFolder','1120692xAmJpS','\x20Opening\x20','Resolving\x20parent\x20folder\x20\x27','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','/e/','limit','elapsedTimeMillis','folder','Resolving\x20parent\x20segment\x20\x27','(root)','segment:view','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Fetching\x20SQL\x20from\x20rule...','error','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','createFolder','Parent\x20name:\x20','Fetching\x20folder\x20\x27','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','✔\x20Created\x20folder\x20\x27','Show\x20child\x20segment\x20schema\x20(column\x20types)','Get\x20SQL\x20query\x20for\x20child\x20segment','cause','segment:describe','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Resolving\x20path\x20\x27','getSegment','✖\x20Query\x20failed\x20[','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','jsonl','INVALID_ARGUMENT','getSQLFromYamlFile','Resolving\x20folder\x20\x27','\x27...','\x20folder','Error:\x20Parent\x20segment\x20name\x20is\x20required','Fetching\x20SQL\x20for\x20segment...','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','folderId','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','885723BoxIBf'];a37_0x1f3a=function(){return _0xfc064d;};return a37_0x1f3a();}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_0x4debc4 from'chalk';async function resolveSegmentTarget(_0x3f8c1f,_0x147a90,_0xd3b5c9){const _0x2f81d6=a37_0x421c;if(isYamlFilePath(_0x3f8c1f))try{const _0x201cf2=await resolveYamlFilePath(_0x3f8c1f);return _0xd3b5c9&&(console[_0x2f81d6(0x146)](_0x2f81d6(0xfa)+_0x3f8c1f),console['error']('\x20\x20Parent\x20segment:\x20'+_0x201cf2['parentSegment']),console[_0x2f81d6(0x146)]('\x20\x20Segment\x20name:\x20'+_0x201cf2['segmentName']),console[_0x2f81d6(0x146)](_0x2f81d6(0xe4)+(_0x201cf2[_0x2f81d6(0x170)]||_0x2f81d6(0x142))),console[_0x2f81d6(0x146)](_0x2f81d6(0xfd)+_0x201cf2[_0x2f81d6(0xfb)])),_0x201cf2[_0x2f81d6(0xfb)];}catch(_0x2692d7){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2f81d6(0x133)+_0x2692d7[_0x2f81d6(0x108)]);}if(!_0x147a90)throw new SDKError(ErrorCode[_0x2f81d6(0x15b)],_0x2f81d6(0x172));return _0x147a90+'/'+_0x3f8c1f;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x3edfaf(0x136)]=a37_0x3edfaf(0x152);[a37_0x3edfaf(0x16d)]=a37_0x3edfaf(0x101);async[a37_0x3edfaf(0x119)](_0x83bf19){const _0x1729e5=a37_0x3edfaf,{options:_0x6cc6a2,args:_0x3e5060,tdx:_0x1c6bf7}=_0x83bf19,_0x4a8d60=_0x3e5060[0x0],_0x2327a4=!_0x4a8d60&&!!_0x6cc6a2[_0x1729e5(0x118)],_0x463ff1=_0x4a8d60||_0x6cc6a2[_0x1729e5(0x118)];if(!_0x463ff1)return console['error'](_0x1729e5(0x11d)),console[_0x1729e5(0x146)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x1729e5(0x146)](_0x1729e5(0x117)),console[_0x1729e5(0x146)](_0x1729e5(0x159)),console[_0x1729e5(0x146)](_0x1729e5(0x149)),console[_0x1729e5(0x146)]('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console[_0x1729e5(0x146)](_0x1729e5(0x147)),0x1;try{const _0xbf0a29=_0x6cc6a2[_0x1729e5(0xfc)];let _0x2d0e9c=_0x463ff1;!_0x2327a4&&_0xbf0a29&&!_0x463ff1[_0x1729e5(0xe7)]('/')&&(_0x2d0e9c=_0xbf0a29+'/'+_0x463ff1,_0x6cc6a2[_0x1729e5(0x129)]&&console[_0x1729e5(0x146)]('Resolved\x20relative\x20path\x20to:\x20'+_0x2d0e9c));const _0x31a926=await withSpinner(_0x1729e5(0x156)+_0x2d0e9c+'\x27...',()=>_0x1c6bf7[_0x1729e5(0x174)][_0x1729e5(0x179)](_0x2d0e9c),{'verbose':_0x6cc6a2['verbose']}),_0x1b61fc=_0x31a926[_0x1729e5(0xff)];_0x6cc6a2[_0x1729e5(0x129)]&&(console[_0x1729e5(0x146)](_0x1729e5(0xdf)+_0x1b61fc[_0x1729e5(0x137)]),console[_0x1729e5(0x146)](_0x1729e5(0xf5)+_0x1b61fc['parentId']),_0x1b61fc[_0x1729e5(0x163)]&&console[_0x1729e5(0x146)]('Folder\x20ID:\x20'+_0x1b61fc['folderId']),_0x1b61fc[_0x1729e5(0x11b)]&&console[_0x1729e5(0x146)]('Segment\x20ID:\x20'+_0x1b61fc[_0x1729e5(0x11b)]));if(_0x1b61fc['type']===_0x1729e5(0x100)){const _0x5c0f00=await withSpinner(_0x1729e5(0x111),()=>_0x1c6bf7[_0x1729e5(0x174)]['getParent'](_0x1b61fc[_0x1729e5(0x177)]),{'verbose':_0x6cc6a2[_0x1729e5(0x129)]});await handleSingleObjectOutput(_0x5c0f00[_0x1729e5(0xff)],_0x6cc6a2);}else{if(_0x1b61fc[_0x1729e5(0x137)]===_0x1729e5(0x140)){if(!_0x1b61fc[_0x1729e5(0x163)])throw new SDKError(ErrorCode[_0x1729e5(0xee)],_0x1729e5(0x17f));const _0x4af76f=await withSpinner(_0x1729e5(0xe9),()=>_0x1c6bf7['segment']['getFolder'](_0x1b61fc['folderId']),{'verbose':_0x6cc6a2[_0x1729e5(0x129)]});await handleSingleObjectOutput(_0x4af76f[_0x1729e5(0xff)],_0x6cc6a2);}else{if(_0x1b61fc[_0x1729e5(0x137)]===_0x1729e5(0x174)){if(!_0x1b61fc[_0x1729e5(0x11b)])throw new SDKError(ErrorCode[_0x1729e5(0x102)],_0x1729e5(0x10e));const _0x1aef24=await withSpinner(_0x1729e5(0x113),()=>_0x1c6bf7['segment'][_0x1729e5(0x157)](_0x1b61fc[_0x1729e5(0x177)],_0x1b61fc[_0x1729e5(0x11b)]),{'verbose':_0x6cc6a2['verbose']});await handleSingleObjectOutput(_0x1aef24[_0x1729e5(0xff)],_0x6cc6a2);}}}return 0x0;}catch(_0xe6e49c){if(_0xe6e49c instanceof SDKError)return console[_0x1729e5(0x146)](_0x1729e5(0xf1)+_0xe6e49c['message']),_0xe6e49c['cause']&&console[_0x1729e5(0x146)]('\x20\x20Cause:\x20'+_0xe6e49c[_0x1729e5(0x151)]),0x1;throw _0xe6e49c;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x3edfaf(0x136)]='segment:show';[a37_0x3edfaf(0x16d)]=a37_0x3edfaf(0x13c);async[a37_0x3edfaf(0x119)](_0x4d7a7a){const _0x26ae5a=a37_0x3edfaf,{options:_0x270f3a,args:_0x1e95d7,tdx:_0x4bb257}=_0x4d7a7a,_0x11e0fe=_0x1e95d7[0x0];if(!_0x11e0fe)return console['error'](_0x26ae5a(0x11c)),console[_0x26ae5a(0x146)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console[_0x26ae5a(0x146)](_0x26ae5a(0x135)),console[_0x26ae5a(0x146)](_0x26ae5a(0x117)),console[_0x26ae5a(0x146)](_0x26ae5a(0x144)),console[_0x26ae5a(0x146)](_0x26ae5a(0xe2)),0x1;try{const _0x4b6ec9=_0x270f3a[_0x26ae5a(0x118)],_0x1b66b3=await resolveSegmentTarget(_0x11e0fe,_0x4b6ec9,_0x270f3a[_0x26ae5a(0x129)]);_0x270f3a[_0x26ae5a(0x129)]&&console[_0x26ae5a(0x146)](_0x26ae5a(0x10f)+_0x1b66b3);const _0x376aed=await withSpinner(_0x26ae5a(0xeb)+_0x11e0fe+_0x26ae5a(0x15e),()=>_0x4bb257[_0x26ae5a(0x174)]['resolvePathToResource'](_0x1b66b3),{'verbose':_0x270f3a[_0x26ae5a(0x129)]}),_0xd2a41=_0x376aed['data'];_0x270f3a[_0x26ae5a(0x129)]&&(console[_0x26ae5a(0x146)](_0x26ae5a(0xdf)+_0xd2a41[_0x26ae5a(0x137)]),console[_0x26ae5a(0x146)](_0x26ae5a(0xf5)+_0xd2a41['parentId']));if(_0xd2a41['type']===_0x26ae5a(0x140))return console['error']('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console['error'](_0x26ae5a(0x16a)),0x1;if(_0xd2a41[_0x26ae5a(0x137)]==='parent')return console[_0x26ae5a(0x146)](_0x26ae5a(0x178)),console[_0x26ae5a(0x146)](_0x26ae5a(0x124)),0x1;if(!_0xd2a41[_0x26ae5a(0x11b)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x26ae5a(0x10e));const _0x4eaa44=await withSpinner(_0x26ae5a(0x161),()=>_0x4bb257[_0x26ae5a(0x174)][_0x26ae5a(0x16e)](_0xd2a41['parentId'],_0xd2a41[_0x26ae5a(0x11b)]),{'verbose':_0x270f3a[_0x26ae5a(0x129)]});let _0x44fbca=_0x4eaa44[_0x26ae5a(0xff)];const _0x25e2a4=resolveLimit(_0x270f3a[_0x26ae5a(0x13e)],DEFAULT_DISPLAY_LIMIT),_0x4fd8ac=/\bLIMIT\s+\d+/i[_0x26ae5a(0x126)](_0x44fbca);!_0x4fd8ac&&(_0x44fbca=_0x44fbca[_0x26ae5a(0x109)]()[_0x26ae5a(0x120)](/;+$/,''),_0x44fbca=_0x26ae5a(0xf8)+_0x44fbca+_0x26ae5a(0xea)+_0x25e2a4);_0x270f3a[_0x26ae5a(0x129)]&&console[_0x26ae5a(0x146)](_0x26ae5a(0x11e)+_0x44fbca);const _0x2df66a=await withProgressSpinner(_0x26ae5a(0x186),async _0x32009b=>{const _0x345578=_0x26ae5a,_0x255944=await _0x4bb257[_0x345578(0x176)][_0x345578(0x119)](_0x44fbca,{'catalog':'td','schema':'information_schema','onJobId':_0xd0fa31=>{const _0x5bb617=_0x345578;_0x32009b[_0x5bb617(0x123)](_0xd0fa31);}});return _0x255944;},{'verbose':_0x270f3a[_0x26ae5a(0x129)]}),_0x4dd197=_0x2df66a[_0x26ae5a(0xff)],_0x579939=_0x4dd197[_0x26ae5a(0x183)]?'\x20[Job\x20ID:\x20'+_0x4dd197['jobId']+']':'';return console[_0x26ae5a(0x146)](_0x26ae5a(0x16b)+_0x4dd197['stats'][_0x26ae5a(0x12a)][_0x26ae5a(0x128)]()+'\x20rows\x20'+('in\x20'+formatElapsed(_0x4dd197[_0x26ae5a(0x169)][_0x26ae5a(0x13f)])+_0x579939)),await handleQueryOutput(_0x4dd197,_0x270f3a),0x0;}catch(_0x461139){if(_0x461139 instanceof SDKError)return console[_0x26ae5a(0x146)](_0x26ae5a(0x158)+_0x461139['code']+']'),console[_0x26ae5a(0x146)]('\x0a'+_0x461139[_0x26ae5a(0x108)]),0x1;throw _0x461139;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x3edfaf(0x136)]='segment:folder:list';[a37_0x3edfaf(0x16d)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a37_0x3edfaf(0x119)](_0x3387de){const _0x240e35=a37_0x3edfaf,{options:_0x5276ed,args:_0xdd734b,tdx:_0x1b26b5}=_0x3387de;if(_0xdd734b[_0x240e35(0x10c)]===0x0)return console[_0x240e35(0x146)](_0x240e35(0x160)),console[_0x240e35(0x146)](_0x240e35(0x10d)),0x1;const _0x2bb74a=_0xdd734b[0x0];try{_0x5276ed[_0x240e35(0x129)]&&(console[_0x240e35(0x146)]('Site:\x20'+_0x5276ed[_0x240e35(0xf6)]),console[_0x240e35(0x146)]('Parent\x20name:\x20'+_0x2bb74a));const _0x2a4bee=await withSpinner(_0x240e35(0x141)+_0x2bb74a+_0x240e35(0x15e),()=>_0x1b26b5['segment'][_0x240e35(0xe0)](_0x2bb74a),{'verbose':_0x5276ed[_0x240e35(0x129)]}),_0x2e4ae3=_0x2a4bee[_0x240e35(0xff)];_0x5276ed[_0x240e35(0x129)]&&console['error'](_0x240e35(0xe5)+_0x2e4ae3);const _0x42d6ce=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x2bb74a+_0x240e35(0x15e),()=>_0x1b26b5[_0x240e35(0x174)][_0x240e35(0xf4)](_0x2e4ae3),{'verbose':_0x5276ed['verbose']}),_0x1a52bc=_0x42d6ce[_0x240e35(0xff)];return console['error']('✔\x20Found\x20'+_0x1a52bc[_0x240e35(0x10c)]+_0x240e35(0x15f)+(_0x1a52bc[_0x240e35(0x10c)]!==0x1?'s':'')),await handleSDKOutput(_0x1a52bc,_0x5276ed),0x0;}catch(_0x4c0009){if(_0x4c0009 instanceof SDKError)return console[_0x240e35(0x146)](_0x240e35(0xf1)+_0x4c0009[_0x240e35(0x108)]),_0x4c0009[_0x240e35(0x151)]&&console[_0x240e35(0x146)](_0x240e35(0x12c)+_0x4c0009[_0x240e35(0x151)]),0x1;throw _0x4c0009;}}}function a37_0x421c(_0x4d94a4,_0x1f575f){_0x4d94a4=_0x4d94a4-0xde;const _0x1f3a3d=a37_0x1f3a();let _0x421c96=_0x1f3a3d[_0x4d94a4];return _0x421c96;}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x3edfaf(0x136)]=a37_0x3edfaf(0x132);['description']=a37_0x3edfaf(0xe3);async['execute'](_0x4c09f2){const _0x31612d=a37_0x3edfaf,{options:_0x342002,args:_0x1b8b3a,tdx:_0x2e7abf}=_0x4c09f2;if(_0x1b8b3a[_0x31612d(0x10c)]===0x0)return console['error'](_0x31612d(0x184)),console[_0x31612d(0x146)](_0x31612d(0x17b)),0x1;try{const {parentId:_0x5333e5,childId:_0x9be028}=parseSegmentRef(_0x1b8b3a[0x0]);_0x342002['verbose']&&(console[_0x31612d(0x146)](_0x31612d(0xed)+_0x342002[_0x31612d(0xf6)]),console[_0x31612d(0x146)](_0x31612d(0x14b)+_0x5333e5),_0x9be028&&console[_0x31612d(0x146)](_0x31612d(0xef)+_0x9be028));if(!_0x9be028)return console[_0x31612d(0x146)](_0x31612d(0x153)),0x1;const _0x1b9035=await withSpinner(_0x31612d(0x141)+_0x5333e5+_0x31612d(0x15e),()=>_0x2e7abf[_0x31612d(0x174)][_0x31612d(0xe0)](_0x5333e5),{'verbose':_0x342002[_0x31612d(0x129)]}),_0x368a11=_0x1b9035[_0x31612d(0xff)];_0x342002['verbose']&&console[_0x31612d(0x146)]('Resolved\x20parent\x20ID:\x20'+_0x368a11);const _0x33cfd1=await withSpinner(_0x31612d(0x15d)+_0x9be028+_0x31612d(0x15e),()=>_0x2e7abf[_0x31612d(0x174)][_0x31612d(0x11f)](_0x368a11,_0x9be028),{'verbose':_0x342002['verbose']}),_0x28f298=_0x33cfd1[_0x31612d(0xff)];_0x342002[_0x31612d(0x129)]&&console[_0x31612d(0x146)]('Resolved\x20folder\x20ID:\x20'+_0x28f298);const _0xb076fb=await withSpinner(_0x31612d(0x14c)+_0x9be028+'\x27...',()=>_0x2e7abf['segment'][_0x31612d(0x138)](_0x28f298),{'verbose':_0x342002['verbose']});return await handleSDKOutput([_0xb076fb[_0x31612d(0xff)]],_0x342002),0x0;}catch(_0x5b721a){if(_0x5b721a instanceof SDKError)return console[_0x31612d(0x146)](_0x31612d(0xf1)+_0x5b721a[_0x31612d(0x108)]),_0x5b721a[_0x31612d(0x151)]&&console[_0x31612d(0x146)](_0x31612d(0x12c)+_0x5b721a[_0x31612d(0x151)]),0x1;throw _0x5b721a;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x3edfaf(0x136)]=a37_0x3edfaf(0x10a);['description']=a37_0x3edfaf(0x150);async['execute'](_0x547076){const _0x17e9c7=a37_0x3edfaf,{options:_0x36d8bd,args:_0x1dac4d}=_0x547076,_0x3d2ec2=_0x36d8bd,_0x298791=_0x3d2ec2[_0x17e9c7(0x182)],_0x2880b5=_0x1dac4d[0x0];if(!_0x2880b5&&!_0x298791)return console[_0x17e9c7(0x146)](a37_0x4debc4[_0x17e9c7(0x12e)](_0x17e9c7(0x116))),console[_0x17e9c7(0x146)](_0x17e9c7(0xe6)),console[_0x17e9c7(0x146)](_0x17e9c7(0xe8)),console['error'](_0x17e9c7(0x17c)),console[_0x17e9c7(0x146)]('Examples:'),console['error'](_0x17e9c7(0x166)),console[_0x17e9c7(0x146)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml'),0x1;if(_0x2880b5&&_0x298791)return console[_0x17e9c7(0x146)](a37_0x4debc4[_0x17e9c7(0x12e)](_0x17e9c7(0x187))),0x1;try{let _0x49cfcb;if(_0x298791)_0x49cfcb=await this[_0x17e9c7(0x15c)](_0x298791,_0x547076);else{if(isYamlFilePath(_0x2880b5))return console[_0x17e9c7(0x146)](a37_0x4debc4['red'](_0x17e9c7(0x11a))),console[_0x17e9c7(0x146)](_0x17e9c7(0x17a)+_0x2880b5),0x1;else _0x49cfcb=await this['getSQLFromServerSegment'](_0x2880b5,_0x547076);}return _0x36d8bd[_0x17e9c7(0x104)]===_0x17e9c7(0xf7)||_0x36d8bd['format']===_0x17e9c7(0x15a)?await handleSDKOutput([{'sql':_0x49cfcb}],_0x36d8bd):console[_0x17e9c7(0x17e)](_0x49cfcb),0x0;}catch(_0x5e7c2d){if(_0x5e7c2d instanceof SDKError)return console[_0x17e9c7(0x146)](_0x17e9c7(0xf1)+_0x5e7c2d[_0x17e9c7(0x108)]),_0x5e7c2d[_0x17e9c7(0x151)]&&console['error']('\x20\x20Cause:\x20'+_0x5e7c2d[_0x17e9c7(0x151)]),0x1;throw _0x5e7c2d;}}async[a37_0x3edfaf(0x15c)](_0x3dea99,_0xd68854){const _0x572a7f=a37_0x3edfaf,{options:_0x3e124d,tdx:_0x3de24a}=_0xd68854;let _0x5d8026;try{_0x5d8026=await resolveYamlFilePath(_0x3dea99);}catch(_0x21b4ab){throw new SDKError(ErrorCode[_0x572a7f(0x15b)],_0x572a7f(0x133)+_0x21b4ab[_0x572a7f(0x108)]);}_0x3e124d[_0x572a7f(0x129)]&&console[_0x572a7f(0x146)](_0x572a7f(0x10b)+_0x5d8026['parentSegment']+'/'+_0x5d8026[_0x572a7f(0xf3)]);const _0x201343=await withSpinner(_0x572a7f(0x145),()=>_0x3de24a['segment'][_0x572a7f(0x12f)](_0x5d8026['content'],_0x5d8026[_0x572a7f(0x118)],_0x5d8026[_0x572a7f(0xf3)]),{'verbose':_0x3e124d[_0x572a7f(0x129)]});return _0x201343[_0x572a7f(0xff)];}async[a37_0x3edfaf(0x12b)](_0x58cf85,_0x44eed9){const _0x1d9c15=a37_0x3edfaf,{options:_0x2afb36,tdx:_0xc8f434}=_0x44eed9,_0x2a69bf=_0x2afb36[_0x1d9c15(0x118)],_0x2d00c2=await resolveSegmentTarget(_0x58cf85,_0x2a69bf,_0x2afb36[_0x1d9c15(0x129)]);_0x2afb36['verbose']&&console[_0x1d9c15(0x146)](_0x1d9c15(0x10f)+_0x2d00c2);const _0x22793d=await withSpinner(_0x1d9c15(0xeb)+_0x58cf85+'\x27...',()=>_0xc8f434[_0x1d9c15(0x174)][_0x1d9c15(0x179)](_0x2d00c2),{'verbose':_0x2afb36[_0x1d9c15(0x129)]}),_0x1dcc2b=_0x22793d['data'];_0x2afb36[_0x1d9c15(0x129)]&&(console[_0x1d9c15(0x146)](_0x1d9c15(0xdf)+_0x1dcc2b[_0x1d9c15(0x137)]),console[_0x1d9c15(0x146)](_0x1d9c15(0xf5)+_0x1dcc2b[_0x1d9c15(0x177)]));if(_0x1dcc2b[_0x1d9c15(0x137)]===_0x1d9c15(0x140))throw new SDKError(ErrorCode[_0x1d9c15(0x15b)],_0x1d9c15(0xec));if(_0x1dcc2b['type']===_0x1d9c15(0x100))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql');if(!_0x1dcc2b['segmentId'])throw new SDKError(ErrorCode[_0x1d9c15(0x102)],_0x1d9c15(0x10e));const _0x56b506=await withSpinner(_0x1d9c15(0x161),()=>_0xc8f434[_0x1d9c15(0x174)][_0x1d9c15(0x16e)](_0x1dcc2b[_0x1d9c15(0x177)],_0x1dcc2b[_0x1d9c15(0x11b)]),{'verbose':_0x2afb36[_0x1d9c15(0x129)]});return _0x56b506['data'];}}export class SegmentFolderCreateCommand extends BaseCommand{['name']='segment:folder:create';['description']=a37_0x3edfaf(0x130);async[a37_0x3edfaf(0x119)](_0x380ffd){const _0x191d99=a37_0x3edfaf,{options:_0x6944e7,args:_0x170fef,tdx:_0x3b57d9}=_0x380ffd,_0x186e39=_0x6944e7;if(_0x170fef[_0x191d99(0x10c)]<0x2)return console[_0x191d99(0x146)](_0x191d99(0x154)),console[_0x191d99(0x146)](_0x191d99(0x14d)),0x1;const _0x2de7f6=_0x170fef[0x0],_0x267530=_0x170fef[0x1];_0x186e39[_0x191d99(0x129)]&&(console[_0x191d99(0x146)](_0x191d99(0xed)+_0x186e39[_0x191d99(0xf6)]),console['error'](_0x191d99(0x122)+_0x2de7f6),console[_0x191d99(0x146)](_0x191d99(0xef)+_0x267530));let _0xe27a03;if(_0x186e39[_0x191d99(0xde)]){const _0x24bac6=_0x186e39[_0x191d99(0xde)],_0x55edc1=await withSpinner(_0x191d99(0x141)+_0x2de7f6+'\x27...',()=>_0x3b57d9[_0x191d99(0x174)]['resolveParentId'](_0x2de7f6),{'verbose':_0x186e39[_0x191d99(0x129)]}),_0x5cfbbe=_0x55edc1['data'],_0x5c0da6=await withSpinner(_0x191d99(0x13b)+_0x24bac6+_0x191d99(0x15e),()=>_0x3b57d9[_0x191d99(0x174)][_0x191d99(0x11f)](_0x5cfbbe,_0x24bac6),{'verbose':_0x186e39['verbose']});_0xe27a03=_0x5c0da6[_0x191d99(0xff)],_0x186e39['verbose']&&console['error'](_0x191d99(0x110)+_0xe27a03);}const _0x3990ce={'name':_0x267530,'description':_0x186e39['description'],'parentFolderId':_0xe27a03},_0x29fe6a=await withSpinner(_0x191d99(0xf0)+_0x267530+_0x191d99(0x15e),()=>_0x3b57d9[_0x191d99(0x174)][_0x191d99(0x14a)](_0x2de7f6,_0x3990ce),{'verbose':_0x186e39[_0x191d99(0x129)]}),_0x230724=_0x29fe6a[_0x191d99(0xff)];return console[_0x191d99(0x146)](_0x191d99(0x14e)+_0x230724[_0x191d99(0x136)]+_0x191d99(0x127)+_0x230724['id']),await handleSDKOutput([_0x230724],_0x186e39),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x3edfaf(0x136)]=a37_0x3edfaf(0x143);[a37_0x3edfaf(0x16d)]='Show\x20folder\x20or\x20child\x20segment\x20details';async[a37_0x3edfaf(0x119)](_0x1bc66e){const _0x3150b8=a37_0x3edfaf,{options:_0x1823b6,args:_0x2b96b4,tdx:_0xe78ce3}=_0x1bc66e,_0x55bd2b=_0x2b96b4[0x0];if(!_0x55bd2b)return console[_0x3150b8(0x146)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x3150b8(0x146)](_0x3150b8(0x134)),console[_0x3150b8(0x146)](_0x3150b8(0xfe)),console[_0x3150b8(0x146)]('Options:'),console[_0x3150b8(0x146)](_0x3150b8(0x131)),console[_0x3150b8(0x146)]('Examples:'),console[_0x3150b8(0x146)](_0x3150b8(0xf2)),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x3150b8(0x146)](_0x3150b8(0x12d)),0x1;try{const _0x4d596a=_0x1823b6[_0x3150b8(0x118)],_0x5e8ed1=await resolveSegmentTarget(_0x55bd2b,_0x4d596a,_0x1823b6[_0x3150b8(0x129)]);_0x1823b6[_0x3150b8(0x129)]&&console[_0x3150b8(0x146)](_0x3150b8(0x10f)+_0x5e8ed1);const _0x54f634=await withSpinner(_0x3150b8(0xeb)+_0x55bd2b+_0x3150b8(0x15e),()=>_0xe78ce3[_0x3150b8(0x174)][_0x3150b8(0x179)](_0x5e8ed1),{'verbose':_0x1823b6[_0x3150b8(0x129)]}),_0x18e6e6=_0x54f634[_0x3150b8(0xff)];_0x1823b6[_0x3150b8(0x129)]&&(console[_0x3150b8(0x146)](_0x3150b8(0xdf)+_0x18e6e6['type']),console[_0x3150b8(0x146)](_0x3150b8(0xf5)+_0x18e6e6[_0x3150b8(0x177)]),_0x18e6e6[_0x3150b8(0x163)]&&console[_0x3150b8(0x146)](_0x3150b8(0x17d)+_0x18e6e6[_0x3150b8(0x163)]),_0x18e6e6[_0x3150b8(0x11b)]&&console[_0x3150b8(0x146)](_0x3150b8(0x181)+_0x18e6e6['segmentId']));if(_0x1823b6[_0x3150b8(0x121)]){if(_0x18e6e6[_0x3150b8(0x137)]===_0x3150b8(0x140))return console[_0x3150b8(0x146)](_0x3150b8(0x171)),0x1;if(_0x18e6e6[_0x3150b8(0x137)]==='parent')return console[_0x3150b8(0x146)](_0x3150b8(0x185)),console[_0x3150b8(0x146)](_0x3150b8(0x16c)),0x1;if(!_0x18e6e6[_0x3150b8(0x11b)])throw new SDKError(ErrorCode[_0x3150b8(0x102)],_0x3150b8(0x10e));const _0x5eb6f4=getConsoleNextUrl(_0x1823b6[_0x3150b8(0xf6)],_0x3150b8(0x112)+_0x18e6e6['parentId']+'/e/'+_0x18e6e6[_0x3150b8(0x11b)]);return console[_0x3150b8(0x146)](a37_0x4debc4[_0x3150b8(0x125)]('✔')+_0x3150b8(0x13a)+a37_0x4debc4[_0x3150b8(0x180)](_0x5eb6f4)),openBrowser(_0x5eb6f4),0x0;}if(_0x18e6e6['type']===_0x3150b8(0x140)){if(!_0x18e6e6[_0x3150b8(0x163)])throw new SDKError(ErrorCode[_0x3150b8(0xee)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0xa21445=await withSpinner(_0x3150b8(0xe9),()=>_0xe78ce3[_0x3150b8(0x174)]['getFolder'](_0x18e6e6['folderId']),{'verbose':_0x1823b6['verbose']});await handleSingleObjectOutput(_0xa21445[_0x3150b8(0xff)],_0x1823b6);}else{if(_0x18e6e6['type']==='segment'){if(!_0x18e6e6[_0x3150b8(0x11b)])throw new SDKError(ErrorCode[_0x3150b8(0x102)],_0x3150b8(0x10e));const _0x233a13=await withSpinner('Fetching\x20segment\x20details...',()=>_0xe78ce3['segment']['getSegment'](_0x18e6e6[_0x3150b8(0x177)],_0x18e6e6['segmentId']),{'verbose':_0x1823b6[_0x3150b8(0x129)]}),_0x2c11c8=getConsoleNextUrl(_0x1823b6[_0x3150b8(0xf6)],'/app/ps/'+_0x18e6e6[_0x3150b8(0x177)]+_0x3150b8(0x13d)+_0x18e6e6[_0x3150b8(0x11b)]),_0xdf82ce=_0x233a13[_0x3150b8(0xff)];_0xdf82ce[_0x3150b8(0x175)]=_0x2c11c8,await handleSingleObjectOutput(_0xdf82ce,_0x1823b6);}else return console[_0x3150b8(0x146)](_0x3150b8(0x155)),console[_0x3150b8(0x146)](_0x3150b8(0x114)),0x1;}return 0x0;}catch(_0x14b864){if(_0x14b864 instanceof SDKError)return console['error'](_0x3150b8(0xf1)+_0x14b864[_0x3150b8(0x108)]),_0x14b864[_0x3150b8(0x151)]&&console[_0x3150b8(0x146)](_0x3150b8(0x12c)+_0x14b864['cause']),0x1;throw _0x14b864;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']=a37_0x3edfaf(0x105);[a37_0x3edfaf(0x16d)]=a37_0x3edfaf(0x14f);async[a37_0x3edfaf(0x119)](_0x15119d){const _0x2ccf22=a37_0x3edfaf,{options:_0x5e7609,args:_0x4f138e,tdx:_0x6e0df3}=_0x15119d,_0x259151=_0x4f138e[0x0];if(!_0x259151)return console[_0x2ccf22(0x146)](_0x2ccf22(0x11c)),console['error']('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x2ccf22(0x146)](_0x2ccf22(0x148)),console[_0x2ccf22(0x146)](_0x2ccf22(0x117)),console['error'](_0x2ccf22(0xf9)),console['error'](_0x2ccf22(0x162)),0x1;try{const _0x379280=_0x5e7609[_0x2ccf22(0x118)],_0x31866a=await resolveSegmentTarget(_0x259151,_0x379280,_0x5e7609[_0x2ccf22(0x129)]);_0x5e7609[_0x2ccf22(0x129)]&&console[_0x2ccf22(0x146)](_0x2ccf22(0x10f)+_0x31866a);const _0x49c2af=await withSpinner(_0x2ccf22(0xeb)+_0x259151+'\x27...',()=>_0x6e0df3['segment'][_0x2ccf22(0x179)](_0x31866a),{'verbose':_0x5e7609[_0x2ccf22(0x129)]}),_0x2d6af3=_0x49c2af[_0x2ccf22(0xff)];_0x5e7609[_0x2ccf22(0x129)]&&(console[_0x2ccf22(0x146)](_0x2ccf22(0xdf)+_0x2d6af3[_0x2ccf22(0x137)]),console[_0x2ccf22(0x146)]('Parent\x20ID:\x20'+_0x2d6af3[_0x2ccf22(0x177)]));if(_0x2d6af3[_0x2ccf22(0x137)]===_0x2ccf22(0x140))return console['error'](_0x2ccf22(0x164)),console[_0x2ccf22(0x146)](_0x2ccf22(0x165)),0x1;if(_0x2d6af3['type']===_0x2ccf22(0x100))return console[_0x2ccf22(0x146)](_0x2ccf22(0x115)),console[_0x2ccf22(0x146)](_0x2ccf22(0x103)),0x1;if(!_0x2d6af3[_0x2ccf22(0x11b)])throw new SDKError(ErrorCode[_0x2ccf22(0x102)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x4ff66a=await withSpinner(_0x2ccf22(0x161),()=>_0x6e0df3[_0x2ccf22(0x174)][_0x2ccf22(0x16e)](_0x2d6af3[_0x2ccf22(0x177)],_0x2d6af3[_0x2ccf22(0x11b)]),{'verbose':_0x5e7609[_0x2ccf22(0x129)]}),_0x1855f9=_0x4ff66a[_0x2ccf22(0xff)],_0x6f0c6=await executeSchemaQuery(_0x1855f9,_0x6e0df3,_0x5e7609);return await handleQueryOutput(_0x6f0c6,_0x5e7609),0x0;}catch(_0x5ae65c){if(_0x5ae65c instanceof SDKError)return console['error'](_0x2ccf22(0xf1)+_0x5ae65c[_0x2ccf22(0x108)]),_0x5ae65c[_0x2ccf22(0x151)]&&console[_0x2ccf22(0x146)](_0x2ccf22(0x12c)+_0x5ae65c[_0x2ccf22(0x151)]),0x1;throw _0x5ae65c;}}}
@@ -1 +1 @@
1
- const a38_0x117704=a38_0x106a;(function(_0x38bbf6,_0x225b55){const _0x5b466a=a38_0x106a,_0x20d5ab=_0x38bbf6();while(!![]){try{const _0x2bf5bd=-parseInt(_0x5b466a(0x21f))/0x1*(parseInt(_0x5b466a(0x215))/0x2)+parseInt(_0x5b466a(0x214))/0x3+-parseInt(_0x5b466a(0x205))/0x4*(parseInt(_0x5b466a(0x218))/0x5)+parseInt(_0x5b466a(0x206))/0x6+parseInt(_0x5b466a(0x1fb))/0x7+-parseInt(_0x5b466a(0x1fa))/0x8*(-parseInt(_0x5b466a(0x1f7))/0x9)+parseInt(_0x5b466a(0x20c))/0xa*(-parseInt(_0x5b466a(0x1f9))/0xb);if(_0x2bf5bd===_0x225b55)break;else _0x20d5ab['push'](_0x20d5ab['shift']());}catch(_0x11cf5f){_0x20d5ab['push'](_0x20d5ab['shift']());}}}(a38_0x3f43,0x3363b));import{BaseCommand}from'./command.js';function a38_0x106a(_0x55664c,_0x4b5fad){_0x55664c=_0x55664c-0x1f3;const _0x3f430c=a38_0x3f43();let _0x106ae1=_0x3f430c[_0x55664c];return _0x106ae1;}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';function a38_0x3f43(){const _0x504d11=['description','Target\x20path:\x20','Create\x20child\x20segment\x20with\x20filtering\x20rules','verbose','Segment\x20name:\x20','142050FQjkjL','410NrKuYm','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','ruleFile','185995mIvwOk','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','createSegment','segment','segmentPath','length','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','450uFJrFY','parent','segments','✔\x20Created\x20segment\x20\x27','kind','Parent\x20path:\x20','resolveFolderId','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','error','\x27...','1323333pzrKpT','yellow','102971oSGSSd','16fdfwjP','961520XLRnvh','folder','invisible','noCountPopulation','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','data','Site:\x20','Resolved\x20folder\x20ID:\x20','Examples:','rule','12sNkkcJ','568146BkDIzB','execute','site','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','includes','Parent:\x20','170RuOmct','name','type'];a38_0x3f43=function(){return _0x504d11;};return a38_0x3f43();}import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x5b733f from'chalk';export class SegmentCreateCommand extends BaseCommand{[a38_0x117704(0x20d)]='segment:create';[a38_0x117704(0x20f)]=a38_0x117704(0x211);async[a38_0x117704(0x207)](_0x2bb0c9){const _0x33b437=a38_0x117704;console[_0x33b437(0x1f5)](a38_0x5b733f[_0x33b437(0x1f8)]('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x33b437(0x1f5)](a38_0x5b733f[_0x33b437(0x1f8)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x1d9e11,args:_0xf70c5,tdx:_0x4715dd}=_0x2bb0c9,_0x60f858=_0x1d9e11;if(_0xf70c5['length']===0x0)return console[_0x33b437(0x1f5)](_0x33b437(0x219)),console[_0x33b437(0x1f5)](_0x33b437(0x1f4)),console[_0x33b437(0x1f5)](_0x33b437(0x203)),console['error'](_0x33b437(0x216)),console['error'](_0x33b437(0x21e)),console[_0x33b437(0x1f5)](_0x33b437(0x1ff)),0x1;const _0x1e9d9d=_0xf70c5[0x0],_0x5a1e04=_0x1d9e11[_0x33b437(0x21c)];let _0xdd8396=_0x1e9d9d;_0x5a1e04&&!_0x1e9d9d[_0x33b437(0x20a)]('/')&&(_0xdd8396=_0x5a1e04+'/'+_0x1e9d9d,_0x60f858['verbose']&&console[_0x33b437(0x1f5)]('Resolved\x20relative\x20path\x20to:\x20'+_0xdd8396));const _0x4181e3=parsePath(_0xdd8396);if(_0x4181e3['segments'][_0x33b437(0x21d)]<0x2)return console[_0x33b437(0x1f5)]('Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'),console['error'](_0x33b437(0x209)),0x1;const _0x2e3068=_0x4181e3['segments'][0x0],_0x24ce60=getBaseName(_0xdd8396),_0x3ca66d=getParentPath(_0xdd8396);_0x60f858[_0x33b437(0x212)]&&(console[_0x33b437(0x1f5)](_0x33b437(0x201)+_0x60f858[_0x33b437(0x208)]),console[_0x33b437(0x1f5)](_0x33b437(0x210)+_0xdd8396),console[_0x33b437(0x1f5)](_0x33b437(0x20b)+_0x2e3068),console[_0x33b437(0x1f5)](_0x33b437(0x213)+_0x24ce60),console[_0x33b437(0x1f5)](_0x33b437(0x224)+_0x3ca66d));const _0x558804=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2e3068+_0x33b437(0x1f6),()=>_0x4715dd[_0x33b437(0x21b)]['resolveParentId'](_0x2e3068),{'verbose':_0x60f858[_0x33b437(0x212)]}),_0xa3da8b=_0x558804['data'];let _0x4e8736;if(_0x4181e3[_0x33b437(0x221)]['length']>0x2){const _0x4d1133=await withSpinner('Resolving\x20folder\x20path\x20\x27'+_0x3ca66d+_0x33b437(0x1f6),()=>_0x4715dd['segment']['resolvePathToResource'](_0x3ca66d),{'verbose':_0x60f858[_0x33b437(0x212)]}),_0x2081cb=_0x4d1133['data'];if(_0x2081cb['type']!=='folder'&&_0x2081cb[_0x33b437(0x20e)]!==_0x33b437(0x220))return console['error']('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x4e8736=_0x2081cb['folderId'];}else{if(_0x60f858['folder']){const _0x21bf0d=await withSpinner('Resolving\x20folder\x20\x27'+_0x60f858[_0x33b437(0x1fc)]+_0x33b437(0x1f6),()=>_0x4715dd[_0x33b437(0x21b)][_0x33b437(0x1f3)](_0xa3da8b,_0x60f858[_0x33b437(0x1fc)]),{'verbose':_0x60f858[_0x33b437(0x212)]});_0x4e8736=_0x21bf0d[_0x33b437(0x200)];}}_0x60f858[_0x33b437(0x212)]&&_0x4e8736&&console[_0x33b437(0x1f5)](_0x33b437(0x202)+_0x4e8736);const _0x22a649=await loadJSONFromOptions(_0x60f858[_0x33b437(0x204)],_0x60f858[_0x33b437(0x217)]),_0x12c317={'name':_0x24ce60,'description':_0x60f858[_0x33b437(0x20f)],'rule':_0x22a649,'kind':_0x60f858[_0x33b437(0x223)]!==undefined?parseInt(_0x60f858['kind'],0xa):undefined,'isVisible':_0x60f858[_0x33b437(0x1fd)]?![]:undefined,'segmentFolderId':_0x4e8736,'countPopulation':_0x60f858[_0x33b437(0x1fe)]?![]:undefined},_0x4863be=await withSpinner('Creating\x20segment\x20\x27'+_0x24ce60+'\x27...',()=>_0x4715dd[_0x33b437(0x21b)][_0x33b437(0x21a)](_0xa3da8b,_0x12c317),{'verbose':_0x60f858['verbose']}),_0x1ba0d1=_0x4863be[_0x33b437(0x200)];return console[_0x33b437(0x1f5)](_0x33b437(0x222)+_0x1ba0d1[_0x33b437(0x20d)]+'\x27\x20with\x20ID:\x20'+_0x1ba0d1['id']),_0xdd8396!==_0x1e9d9d&&console[_0x33b437(0x1f5)]('\x20\x20\x20Path:\x20'+_0xdd8396),await handleSDKOutput([_0x1ba0d1],_0x60f858),0x0;}}
1
+ const a38_0x3ec82b=a38_0x2682;(function(_0x1417a4,_0x873e5c){const _0x30e2d2=a38_0x2682,_0x14a27c=_0x1417a4();while(!![]){try{const _0x12ca4b=-parseInt(_0x30e2d2(0x163))/0x1+-parseInt(_0x30e2d2(0x148))/0x2*(parseInt(_0x30e2d2(0x14b))/0x3)+-parseInt(_0x30e2d2(0x142))/0x4*(parseInt(_0x30e2d2(0x13b))/0x5)+parseInt(_0x30e2d2(0x160))/0x6*(parseInt(_0x30e2d2(0x166))/0x7)+parseInt(_0x30e2d2(0x15f))/0x8*(parseInt(_0x30e2d2(0x158))/0x9)+-parseInt(_0x30e2d2(0x145))/0xa*(parseInt(_0x30e2d2(0x151))/0xb)+-parseInt(_0x30e2d2(0x149))/0xc*(-parseInt(_0x30e2d2(0x16a))/0xd);if(_0x12ca4b===_0x873e5c)break;else _0x14a27c['push'](_0x14a27c['shift']());}catch(_0x39a429){_0x14a27c['push'](_0x14a27c['shift']());}}}(a38_0x15d4,0xe8bb9));function a38_0x2682(_0x45ba5f,_0x1d83aa){_0x45ba5f=_0x45ba5f-0x13b;const _0x15d415=a38_0x15d4();let _0x26822b=_0x15d415[_0x45ba5f];return _0x26822b;}import{BaseCommand}from'./command.js';function a38_0x15d4(){const _0x398d20=['32WIgwju','12fkQjRP','ruleFile','162936LXeeOe','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','segments','noCountPopulation','folder','33SPJOze','yellow','Create\x20child\x20segment\x20with\x20filtering\x20rules','\x27...','verbose','segment:create','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','10926513RovIse','resolvePathToResource','Site:\x20','execute','kind','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','Resolving\x20folder\x20\x27','8LGNZaw','6QGpDGb','Creating\x20segment\x20\x27','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','1536484ZFPvex','invisible','rule','2025233fXrDjf','Parent:\x20','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','includes','51194299eowBQF','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','length','type','segment','data','2545RlLeaA','folderId','\x20\x20\x20Path:\x20','error','description','resolveParentId','resolveFolderId','1828asjSJZ','Resolved\x20relative\x20path\x20to:\x20','Examples:','6166790hYISbi','name','Segment\x20name:\x20'];a38_0x15d4=function(){return _0x398d20;};return a38_0x15d4();}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_0x2e024c from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']=a38_0x3ec82b(0x156);[a38_0x3ec82b(0x13f)]=a38_0x3ec82b(0x153);async[a38_0x3ec82b(0x15b)](_0x1509a7){const _0x1de340=a38_0x3ec82b;console[_0x1de340(0x13e)](a38_0x2e024c[_0x1de340(0x152)](_0x1de340(0x162))),console[_0x1de340(0x13e)](a38_0x2e024c[_0x1de340(0x152)](_0x1de340(0x14c)));const {options:_0x58c1ca,args:_0x49cb26,tdx:_0x19c655}=_0x1509a7,_0x456123=_0x58c1ca;if(_0x49cb26[_0x1de340(0x16c)]===0x0)return console[_0x1de340(0x13e)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x1de340(0x13e)](_0x1de340(0x15d)),console['error'](_0x1de340(0x144)),console[_0x1de340(0x13e)](_0x1de340(0x157)),console[_0x1de340(0x13e)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console['error'](_0x1de340(0x14d)),0x1;const _0x361443=_0x49cb26[0x0],_0xe80408=_0x58c1ca['segmentPath'];let _0x59826e=_0x361443;_0xe80408&&!_0x361443[_0x1de340(0x169)]('/')&&(_0x59826e=_0xe80408+'/'+_0x361443,_0x456123[_0x1de340(0x155)]&&console[_0x1de340(0x13e)](_0x1de340(0x143)+_0x59826e));const _0x4bd3cc=parsePath(_0x59826e);if(_0x4bd3cc['segments']['length']<0x2)return console['error'](_0x1de340(0x16b)),console[_0x1de340(0x13e)](_0x1de340(0x168)),0x1;const _0x2dbfb9=_0x4bd3cc[_0x1de340(0x14e)][0x0],_0x13ec51=getBaseName(_0x59826e),_0x528613=getParentPath(_0x59826e);_0x456123[_0x1de340(0x155)]&&(console[_0x1de340(0x13e)](_0x1de340(0x15a)+_0x456123['site']),console[_0x1de340(0x13e)]('Target\x20path:\x20'+_0x59826e),console[_0x1de340(0x13e)](_0x1de340(0x167)+_0x2dbfb9),console['error'](_0x1de340(0x147)+_0x13ec51),console[_0x1de340(0x13e)]('Parent\x20path:\x20'+_0x528613));const _0x3b6fe7=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2dbfb9+_0x1de340(0x154),()=>_0x19c655[_0x1de340(0x16e)][_0x1de340(0x140)](_0x2dbfb9),{'verbose':_0x456123[_0x1de340(0x155)]}),_0x498dd9=_0x3b6fe7[_0x1de340(0x16f)];let _0x2e42e2;if(_0x4bd3cc['segments'][_0x1de340(0x16c)]>0x2){const _0x1d9d8f=await withSpinner('Resolving\x20folder\x20path\x20\x27'+_0x528613+_0x1de340(0x154),()=>_0x19c655[_0x1de340(0x16e)][_0x1de340(0x159)](_0x528613),{'verbose':_0x456123[_0x1de340(0x155)]}),_0x173c3c=_0x1d9d8f[_0x1de340(0x16f)];if(_0x173c3c[_0x1de340(0x16d)]!==_0x1de340(0x150)&&_0x173c3c[_0x1de340(0x16d)]!=='parent')return console[_0x1de340(0x13e)]('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x2e42e2=_0x173c3c[_0x1de340(0x13c)];}else{if(_0x456123['folder']){const _0x6e9504=await withSpinner(_0x1de340(0x15e)+_0x456123[_0x1de340(0x150)]+_0x1de340(0x154),()=>_0x19c655['segment'][_0x1de340(0x141)](_0x498dd9,_0x456123[_0x1de340(0x150)]),{'verbose':_0x456123[_0x1de340(0x155)]});_0x2e42e2=_0x6e9504[_0x1de340(0x16f)];}}_0x456123[_0x1de340(0x155)]&&_0x2e42e2&&console[_0x1de340(0x13e)]('Resolved\x20folder\x20ID:\x20'+_0x2e42e2);const _0x5d8078=await loadJSONFromOptions(_0x456123[_0x1de340(0x165)],_0x456123[_0x1de340(0x14a)]),_0x49f5e0={'name':_0x13ec51,'description':_0x456123['description'],'rule':_0x5d8078,'kind':_0x456123['kind']!==undefined?parseInt(_0x456123[_0x1de340(0x15c)],0xa):undefined,'isVisible':_0x456123[_0x1de340(0x164)]?![]:undefined,'segmentFolderId':_0x2e42e2,'countPopulation':_0x456123[_0x1de340(0x14f)]?![]:undefined},_0xc73da7=await withSpinner(_0x1de340(0x161)+_0x13ec51+_0x1de340(0x154),()=>_0x19c655['segment']['createSegment'](_0x498dd9,_0x49f5e0),{'verbose':_0x456123[_0x1de340(0x155)]}),_0xd745b3=_0xc73da7[_0x1de340(0x16f)];return console['error']('✔\x20Created\x20segment\x20\x27'+_0xd745b3[_0x1de340(0x146)]+'\x27\x20with\x20ID:\x20'+_0xd745b3['id']),_0x59826e!==_0x361443&&console['error'](_0x1de340(0x13d)+_0x59826e),await handleSDKOutput([_0xd745b3],_0x456123),0x0;}}