@treasuredata/tdx 2026.4.3 → 2026.4.4

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 (219) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/cas-command.js +1 -1
  11. package/dist/commands/cas-segment-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/delivery-command.js +1 -1
  20. package/dist/commands/describe.js +1 -1
  21. package/dist/commands/engage-campaign-pull-command.js +1 -1
  22. package/dist/commands/engage-campaign-push-command.js +1 -1
  23. package/dist/commands/engage-campaign-validate-command.js +1 -1
  24. package/dist/commands/engage-command.js +1 -1
  25. package/dist/commands/engage-template-pull-command.js +1 -1
  26. package/dist/commands/engage-template-push-command.js +1 -1
  27. package/dist/commands/engage-template-validate-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/journey-command.js +1 -1
  30. package/dist/commands/journey-validate-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/mcp-command.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/policy-command.js +1 -1
  35. package/dist/commands/profile-command.js +1 -1
  36. package/dist/commands/profiles-command.js +1 -1
  37. package/dist/commands/query-command.js +1 -1
  38. package/dist/commands/schedule-command.js +1 -1
  39. package/dist/commands/segment-command.js +1 -1
  40. package/dist/commands/segment-create-command.js +1 -1
  41. package/dist/commands/segment-fields-command.js +1 -1
  42. package/dist/commands/segment-pull-command.js +1 -1
  43. package/dist/commands/segment-push-command.js +1 -1
  44. package/dist/commands/segment-update-command.js +1 -1
  45. package/dist/commands/segment-use-command.js +1 -1
  46. package/dist/commands/segment-validate-command.js +1 -1
  47. package/dist/commands/segments.js +1 -1
  48. package/dist/commands/show.js +1 -1
  49. package/dist/commands/status-command.js +1 -1
  50. package/dist/commands/tables.js +1 -1
  51. package/dist/commands/unset-command.js +1 -1
  52. package/dist/commands/upgrade-command.js +1 -1
  53. package/dist/commands/use-command.js +1 -1
  54. package/dist/commands/user-command.js +1 -1
  55. package/dist/commands/work-command.js +1 -1
  56. package/dist/commands/workflow-command.js +1 -1
  57. package/dist/core/auth.js +1 -1
  58. package/dist/core/command-output.js +1 -1
  59. package/dist/core/config.js +1 -1
  60. package/dist/core/connection-cache.js +1 -1
  61. package/dist/core/constants.js +1 -1
  62. package/dist/core/credential-cache.js +1 -1
  63. package/dist/core/global-context.js +1 -1
  64. package/dist/core/keychain.js +1 -1
  65. package/dist/core/oauth-keychain.js +1 -1
  66. package/dist/core/oauth.js +1 -1
  67. package/dist/core/profile.js +1 -1
  68. package/dist/core/project-config.js +1 -1
  69. package/dist/core/session.js +1 -1
  70. package/dist/core/user-cache.js +1 -1
  71. package/dist/core/version.js +1 -1
  72. package/dist/index.js +1 -1
  73. package/dist/mcp/server.js +1 -1
  74. package/dist/mcp/tools/index.js +1 -1
  75. package/dist/mcp/tools/tdx-run.js +1 -1
  76. package/dist/mcp/tools/tdx-search.js +1 -1
  77. package/dist/mcp/tools/work-create-item.js +1 -1
  78. package/dist/mcp/utils.js +1 -1
  79. package/dist/proxy/claude-usage-tracker.js +1 -1
  80. package/dist/proxy/passthrough-server.js +1 -1
  81. package/dist/proxy/sse-usage-parser.js +1 -1
  82. package/dist/sdk/agent/agent-config.js +1 -1
  83. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  84. package/dist/sdk/agent/agent-yaml.js +1 -1
  85. package/dist/sdk/agent/test/evaluator.js +1 -1
  86. package/dist/sdk/agent/test/executor.js +1 -1
  87. package/dist/sdk/agent/test/index.js +1 -1
  88. package/dist/sdk/agent/test/output.js +1 -1
  89. package/dist/sdk/agent/test/parser.js +1 -1
  90. package/dist/sdk/agent/tool-target-registry.js +1 -1
  91. package/dist/sdk/api.js +1 -1
  92. package/dist/sdk/cas/cas-api-client.js +1 -1
  93. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  94. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  95. package/dist/sdk/cas/index.js +1 -1
  96. package/dist/sdk/cas/pull-workflow.js +1 -1
  97. package/dist/sdk/cas/push-workflow.js +1 -1
  98. package/dist/sdk/client/cdp-api-client.js +1 -1
  99. package/dist/sdk/client/delivery-api-client.js +1 -1
  100. package/dist/sdk/client/endpoints.js +1 -1
  101. package/dist/sdk/client/engage-api-client.js +1 -1
  102. package/dist/sdk/client/http-client.js +1 -1
  103. package/dist/sdk/client/llm-api-client.js +1 -1
  104. package/dist/sdk/client/oauth-refresh.js +1 -1
  105. package/dist/sdk/client/rate-limiter.js +1 -1
  106. package/dist/sdk/client/td-api-client.js +1 -1
  107. package/dist/sdk/client/trino-api-client.js +1 -1
  108. package/dist/sdk/client/workflow-client.js +1 -1
  109. package/dist/sdk/connection-validator.js +1 -1
  110. package/dist/sdk/connection.js +1 -1
  111. package/dist/sdk/delivery.js +1 -1
  112. package/dist/sdk/engage/campaign-pull.js +1 -1
  113. package/dist/sdk/engage/campaign-push.js +1 -1
  114. package/dist/sdk/engage/campaign-validator.js +1 -1
  115. package/dist/sdk/engage/campaign-yaml.js +1 -1
  116. package/dist/sdk/engage/template-pull.js +1 -1
  117. package/dist/sdk/engage/template-push.js +1 -1
  118. package/dist/sdk/engage/template-validator.js +1 -1
  119. package/dist/sdk/engage/template-yaml.js +1 -1
  120. package/dist/sdk/engage/types/campaign-def.js +1 -1
  121. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  122. package/dist/sdk/engage/types/template-schema.js +1 -1
  123. package/dist/sdk/engage.js +1 -1
  124. package/dist/sdk/errors.js +1 -1
  125. package/dist/sdk/index.js +1 -1
  126. package/dist/sdk/io/index.js +1 -1
  127. package/dist/sdk/io/node-filesystem.js +1 -1
  128. package/dist/sdk/job.js +1 -1
  129. package/dist/sdk/journey.js +1 -1
  130. package/dist/sdk/llm/chat-cache.js +1 -1
  131. package/dist/sdk/llm/index.js +1 -1
  132. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  133. package/dist/sdk/llm/model-factors.js +1 -1
  134. package/dist/sdk/personalization.js +1 -1
  135. package/dist/sdk/policy.js +1 -1
  136. package/dist/sdk/query/index.js +1 -1
  137. package/dist/sdk/query/sql-parser.js +1 -1
  138. package/dist/sdk/realtime.js +1 -1
  139. package/dist/sdk/schedule.js +1 -1
  140. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  141. package/dist/sdk/segment/fields-display.js +1 -1
  142. package/dist/sdk/segment/file-discovery.js +1 -1
  143. package/dist/sdk/segment/journey-utils.js +1 -1
  144. package/dist/sdk/segment/journey-validator.js +1 -1
  145. package/dist/sdk/segment/journey-yaml.js +1 -1
  146. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  147. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  148. package/dist/sdk/segment/pull-workflow.js +1 -1
  149. package/dist/sdk/segment/push-recovery.js +1 -1
  150. package/dist/sdk/segment/push-workflow.js +1 -1
  151. package/dist/sdk/segment/resolution-context.js +1 -1
  152. package/dist/sdk/segment/segment-path-parser.js +1 -1
  153. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  154. package/dist/sdk/segment/segment-validator.js +1 -1
  155. package/dist/sdk/segment/target-resolution.js +1 -1
  156. package/dist/sdk/segment/tdx-config.js +1 -1
  157. package/dist/sdk/segment/types/activation-schema.js +1 -1
  158. package/dist/sdk/segment/types/journey-def.js +1 -1
  159. package/dist/sdk/segment/types/journey-schema.js +1 -1
  160. package/dist/sdk/segment/types/segment-def.js +1 -1
  161. package/dist/sdk/segment/types/segment-schema.js +1 -1
  162. package/dist/sdk/segment/validate-files.js +1 -1
  163. package/dist/sdk/segment/yaml-validator.js +1 -1
  164. package/dist/sdk/segment.js +1 -1
  165. package/dist/sdk/types/index.js +1 -1
  166. package/dist/sdk/types/progress.js +1 -1
  167. package/dist/sdk/types/workspace.js +1 -1
  168. package/dist/sdk/user.js +1 -1
  169. package/dist/sdk/util/format-detector.js +1 -1
  170. package/dist/sdk/util/formatters.js +1 -1
  171. package/dist/sdk/util/index.js +1 -1
  172. package/dist/sdk/util/paginate.js +1 -1
  173. package/dist/sdk/util/tree-formatter.js +1 -1
  174. package/dist/sdk/workflow/archive-validation.js +1 -1
  175. package/dist/sdk/workflow/clone-workflow.js +1 -1
  176. package/dist/sdk/workflow/index.js +1 -1
  177. package/dist/sdk/workflow/pull-workflow.js +1 -1
  178. package/dist/sdk/workflow/push-workflow.js +1 -1
  179. package/dist/sdk/workflow/tdx-config.js +1 -1
  180. package/dist/sdk/workflow/workflow-utils.js +1 -1
  181. package/dist/sdk/workspace/frontmatter.js +1 -1
  182. package/dist/sdk/workspace/git.js +1 -1
  183. package/dist/sdk/workspace/index.js +1 -1
  184. package/dist/sdk/workspace/templates.js +1 -1
  185. package/dist/sdk/workspace/weekly.js +1 -1
  186. package/dist/sdk/workspace/wikilinks.js +1 -1
  187. package/dist/test-utils/command-runner.js +1 -1
  188. package/dist/test-utils/factories.js +1 -1
  189. package/dist/test-utils/fixtures.js +1 -1
  190. package/dist/test-utils/http-mock.js +1 -1
  191. package/dist/test-utils/index.js +1 -1
  192. package/dist/utils/async.js +1 -1
  193. package/dist/utils/colors.js +1 -1
  194. package/dist/utils/diff.js +1 -1
  195. package/dist/utils/file-permissions.js +1 -1
  196. package/dist/utils/file-reader.js +1 -1
  197. package/dist/utils/github-releases.js +1 -1
  198. package/dist/utils/global-cache.js +1 -1
  199. package/dist/utils/json-loader.js +1 -1
  200. package/dist/utils/local-cache.js +1 -1
  201. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  202. package/dist/utils/logger/formatters/index.js +1 -1
  203. package/dist/utils/logger/handlers/console-handler.js +1 -1
  204. package/dist/utils/logger/handlers/file-handler.js +1 -1
  205. package/dist/utils/logger/handlers/index.js +1 -1
  206. package/dist/utils/logger/handlers/null-handler.js +1 -1
  207. package/dist/utils/logger/index.js +1 -1
  208. package/dist/utils/logger/logger.js +1 -1
  209. package/dist/utils/logger/types.js +1 -1
  210. package/dist/utils/option-validation.js +1 -1
  211. package/dist/utils/process.js +1 -1
  212. package/dist/utils/prompt.js +1 -1
  213. package/dist/utils/spinner.js +1 -1
  214. package/dist/utils/sse-parser.js +1 -1
  215. package/dist/utils/string-utils.js +1 -1
  216. package/dist/utils/table-ref-parser.js +1 -1
  217. package/dist/utils/tdx-logger.js +1 -1
  218. package/dist/utils/version-check.js +1 -1
  219. package/package.json +1 -1
@@ -1 +1 @@
1
- const a32_0x4f1a1a=a32_0x2966;function a32_0x3dae(){const _0x6256f7=['getCurrent','user','683028FxRDaT','ies','1421YBoiyJ','max','getMyPermissions','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','👥\x20Assigned\x20Users','verbose','all','account_id','Member','2212VojcTb','administrator','getPolicy','entries','email','Listing\x20policies...','\x20\x20No\x20permissions','No\x20policies\x20found','policies','error','456038ADCSgg','join','Account\x20Owner','dim','execute','18ZJCalX',',\x20user_id:','policy\x20list','\x20polic','padEnd','site','log','2165qcwFyk','policy\x20show','args','bold','Fetching\x20permissions...','name','context','2618860PBPaIS','data','description','getPolicyPermissions','\x20\x20•\x20','permissions','\x20—\x20','\x20\x20No\x20policies\x20assigned','\x20assigned','\x20\x20\x20','map','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','listPolicies','1351284CjulVh','Fetching\x20policy...','Administrator','52757ARKTjW','length','16744PqxTSo','policy','validate'];a32_0x3dae=function(){return _0x6256f7;};return a32_0x3dae();}(function(_0xdc10d3,_0x2d70d2){const _0x5f20ec=a32_0x2966,_0x57ca14=_0xdc10d3();while(!![]){try{const _0x2ac040=parseInt(_0x5f20ec(0x19e))/0x1+parseInt(_0x5f20ec(0x1ba))/0x2+-parseInt(_0x5f20ec(0x19b))/0x3+parseInt(_0x5f20ec(0x1b0))/0x4*(parseInt(_0x5f20ec(0x187))/0x5)+parseInt(_0x5f20ec(0x1a5))/0x6+-parseInt(_0x5f20ec(0x1a7))/0x7*(parseInt(_0x5f20ec(0x1a0))/0x8)+parseInt(_0x5f20ec(0x1bf))/0x9*(parseInt(_0x5f20ec(0x18e))/0xa);if(_0x2ac040===_0x2d70d2)break;else _0x57ca14['push'](_0x57ca14['shift']());}catch(_0xa261b2){_0x57ca14['push'](_0x57ca14['shift']());}}}(a32_0x3dae,0x44fa0));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a32_0x23dcc7 from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x4f1a1a(0x18c)]='policy';[a32_0x4f1a1a(0x190)]=a32_0x4f1a1a(0x1aa);async[a32_0x4f1a1a(0x1be)](_0x38912f){const _0x4f721f=a32_0x4f1a1a,{options:_0x12e349,tdx:_0x1b2642}=_0x38912f,_0x86809=await withSpinner(_0x4f721f(0x18b),async()=>{const _0x1adee1=_0x4f721f,[_0xbde503,_0x5abdf6]=await Promise[_0x1adee1(0x1ad)]([_0x1b2642[_0x1adee1(0x1a4)][_0x1adee1(0x1a3)](),_0x1b2642[_0x1adee1(0x1a1)][_0x1adee1(0x1a9)]()]);return{'userInfo':_0xbde503,'permissions':_0x5abdf6};},{'verbose':_0x12e349['verbose']}),{userInfo:_0x4bf040,permissions:_0x374672}=_0x86809[_0x4f721f(0x18f)];if(isStructuredFormat(_0x12e349))return await handleSingleObjectOutput(_0x374672,_0x12e349),0x0;const _0xe3497c=_0x4bf040['account_owner']?_0x4f721f(0x1bc):_0x4bf040[_0x4f721f(0x1b1)]?_0x4f721f(0x19d):_0x4f721f(0x1af);console[_0x4f721f(0x186)]('\x0a'+a32_0x23dcc7['bold']('👤')+'\x20'+a32_0x23dcc7[_0x4f721f(0x18a)](_0x4bf040[_0x4f721f(0x18c)])+'\x20'+a32_0x23dcc7[_0x4f721f(0x1bd)]('('+_0x4bf040[_0x4f721f(0x1b4)]+')')+_0x4f721f(0x194)+_0xe3497c),console[_0x4f721f(0x186)](a32_0x23dcc7[_0x4f721f(0x1bd)](_0x4f721f(0x197)+_0x1b2642[_0x4f721f(0x18d)][_0x4f721f(0x185)]+':'+_0x4bf040[_0x4f721f(0x1ae)]+_0x4f721f(0x1c0)+_0x4bf040['id']));const _0x5bdf16=_0x374672[_0x4f721f(0x1b8)];console[_0x4f721f(0x186)]('\x0a'+a32_0x23dcc7[_0x4f721f(0x18a)]('📋\x20Assigned\x20Policies')+'\x20('+_0x5bdf16[_0x4f721f(0x19f)]+'):');if(_0x5bdf16[_0x4f721f(0x19f)]===0x0)console['log'](a32_0x23dcc7[_0x4f721f(0x1bd)](_0x4f721f(0x195)));else for(const _0x2c397b of _0x5bdf16){console['log'](_0x4f721f(0x192)+_0x2c397b[_0x4f721f(0x18c)]);}return printPermissionsMap(_0x374672['permissions']),console[_0x4f721f(0x186)](),0x0;}}function a32_0x2966(_0x518f49,_0x27beb3){_0x518f49=_0x518f49-0x183;const _0x3dae33=a32_0x3dae();let _0x29668e=_0x3dae33[_0x518f49];return _0x29668e;}export class PolicyListCommand extends BaseCommand{[a32_0x4f1a1a(0x18c)]=a32_0x4f1a1a(0x1c1);['description']='List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)';async[a32_0x4f1a1a(0x1be)](_0x58d47a){const _0x49dd62=a32_0x4f1a1a,{options:_0x19693b,tdx:_0x22fc7b}=_0x58d47a,_0x6d9000=await withSpinner(_0x49dd62(0x1b5),()=>_0x22fc7b['policy'][_0x49dd62(0x19a)](),{'verbose':_0x19693b[_0x49dd62(0x1ac)]}),_0x1ee09d=_0x6d9000[_0x49dd62(0x18f)];console[_0x49dd62(0x1b9)]('✔\x20Found\x20'+_0x1ee09d[_0x49dd62(0x19f)]+_0x49dd62(0x183)+(_0x1ee09d['length']!==0x1?_0x49dd62(0x1a6):'y'));if(isStructuredFormat(_0x19693b))return await handleSDKOutput(_0x1ee09d,_0x19693b),0x0;if(_0x1ee09d[_0x49dd62(0x19f)]===0x0)console[_0x49dd62(0x186)](a32_0x23dcc7[_0x49dd62(0x1bd)](_0x49dd62(0x1b7)));else for(const _0x2978c4 of _0x1ee09d){const _0xe3a896=_0x2978c4[_0x49dd62(0x190)]?a32_0x23dcc7[_0x49dd62(0x1bd)](_0x49dd62(0x194)+_0x2978c4['description']):'';console[_0x49dd62(0x186)](_0x49dd62(0x192)+_0x2978c4[_0x49dd62(0x18c)]+_0xe3a896);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x4f1a1a(0x18c)]=a32_0x4f1a1a(0x188);[a32_0x4f1a1a(0x190)]='Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)';[a32_0x4f1a1a(0x1a2)](_0xc718d6){const _0xddc4e5=a32_0x4f1a1a;if(_0xc718d6[_0xddc4e5(0x189)][_0xddc4e5(0x19f)]===0x0)return _0xddc4e5(0x199);return undefined;}async['execute'](_0x448d6a){const _0x4eb194=a32_0x4f1a1a,{options:_0x5c9e27,tdx:_0x5b8671}=_0x448d6a,_0x1192f0=_0x448d6a[_0x4eb194(0x189)][0x0],_0x1d66ca=await withSpinner(_0x4eb194(0x19c),async()=>{const _0x18cd5b=_0x4eb194,_0x5be1eb=await _0x5b8671[_0x18cd5b(0x1a1)][_0x18cd5b(0x1b2)](_0x1192f0),[_0xbedcf,_0x35ebc3]=await Promise[_0x18cd5b(0x1ad)]([_0x5b8671[_0x18cd5b(0x1a1)][_0x18cd5b(0x191)](_0x5be1eb['id']),_0x5b8671[_0x18cd5b(0x1a1)]['getPolicyUsers'](_0x5be1eb['id'])]);return{'policy':_0x5be1eb,'perms':_0xbedcf,'users':_0x35ebc3};},{'verbose':_0x5c9e27['verbose']}),{policy:_0x5d21b1,perms:_0x38d495,users:_0x228bec}=_0x1d66ca[_0x4eb194(0x18f)];if(isStructuredFormat(_0x5c9e27))return await handleSingleObjectOutput({..._0x5d21b1,'permissions':_0x38d495[_0x4eb194(0x193)],'users':_0x228bec},_0x5c9e27),0x0;console[_0x4eb194(0x186)]('\x0a'+a32_0x23dcc7[_0x4eb194(0x18a)]('📋')+'\x20'+a32_0x23dcc7[_0x4eb194(0x18a)](_0x5d21b1['name'])+'\x20'+a32_0x23dcc7[_0x4eb194(0x1bd)]('(ID:\x20'+_0x5d21b1['id']+')'));_0x5d21b1[_0x4eb194(0x190)]&&console['log'](_0x4eb194(0x197)+a32_0x23dcc7['dim'](_0x5d21b1[_0x4eb194(0x190)]));console['log'](_0x4eb194(0x197)+_0x228bec[_0x4eb194(0x19f)]+'\x20user'+(_0x228bec[_0x4eb194(0x19f)]!==0x1?'s':'')+_0x4eb194(0x196)),printPermissionsMap(_0x38d495[_0x4eb194(0x193)]);if(_0x228bec[_0x4eb194(0x19f)]>0x0){console['log']('\x0a'+a32_0x23dcc7[_0x4eb194(0x18a)](_0x4eb194(0x1ab))+':');for(const _0x326d17 of _0x228bec){const _0x342c78=_0x326d17['email']&&_0x326d17[_0x4eb194(0x1b4)]!==_0x326d17[_0x4eb194(0x18c)]?a32_0x23dcc7[_0x4eb194(0x1bd)]('\x20<'+_0x326d17[_0x4eb194(0x1b4)]+'>'):'';console[_0x4eb194(0x186)](_0x4eb194(0x192)+_0x326d17['name']+_0x342c78);}}return console[_0x4eb194(0x186)](),0x0;}}function printPermissionsMap(_0xaae1c5){const _0x1de27a=a32_0x4f1a1a,_0x2b085d=Object[_0x1de27a(0x1b3)](_0xaae1c5);console[_0x1de27a(0x186)]('\x0a'+a32_0x23dcc7['bold']('🔑\x20Effective\x20Permissions')+':');if(_0x2b085d[_0x1de27a(0x19f)]===0x0){console[_0x1de27a(0x186)](a32_0x23dcc7[_0x1de27a(0x1bd)](_0x1de27a(0x1b6)));return;}const _0x3ebc6a=Math[_0x1de27a(0x1a8)](..._0x2b085d[_0x1de27a(0x198)](([_0x3f2eef])=>_0x3f2eef['length']));for(const [_0x2b5306,_0x250489]of _0x2b085d){const _0x390060=formatOperations(_0x250489);console[_0x1de27a(0x186)]('\x20\x20'+_0x2b5306[_0x1de27a(0x184)](_0x3ebc6a+0x2)+_0x390060);}}function formatOperations(_0x2eec53){const _0x3b8b07=a32_0x4f1a1a,_0x291cad=[...new Set(_0x2eec53['map'](_0x5a09fe=>_0x5a09fe['operation']))];return _0x291cad[_0x3b8b07(0x1bb)](',\x20');}
1
+ const a32_0x1664a4=a32_0x45a2;(function(_0x461b5f,_0x233cee){const _0x42b817=a32_0x45a2,_0x197b8a=_0x461b5f();while(!![]){try{const _0x5e4eb1=-parseInt(_0x42b817(0x13b))/0x1*(-parseInt(_0x42b817(0x14d))/0x2)+parseInt(_0x42b817(0x13d))/0x3*(-parseInt(_0x42b817(0x111))/0x4)+parseInt(_0x42b817(0x12b))/0x5*(parseInt(_0x42b817(0x12a))/0x6)+parseInt(_0x42b817(0x14a))/0x7*(-parseInt(_0x42b817(0x112))/0x8)+-parseInt(_0x42b817(0x144))/0x9*(-parseInt(_0x42b817(0x12d))/0xa)+parseInt(_0x42b817(0x13f))/0xb*(-parseInt(_0x42b817(0x146))/0xc)+-parseInt(_0x42b817(0x14c))/0xd*(-parseInt(_0x42b817(0x134))/0xe);if(_0x5e4eb1===_0x233cee)break;else _0x197b8a['push'](_0x197b8a['shift']());}catch(_0x33df8e){_0x197b8a['push'](_0x197b8a['shift']());}}}(a32_0x4b7a,0x2a231));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a32_0x4b7a(){const _0xe617eb=['Listing\x20policies...','21EiPXXu',',\x20user_id:','16094jMDhhd','9914gGNuUz','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','Member','name','policy\x20show','error','validate','4604FEjwBq','365104TyljZI','account_id','Fetching\x20permissions...','\x20assigned','getPolicyPermissions','account_owner','context','email','map','administrator','site','execute','getCurrent','\x20\x20No\x20permissions','Fetching\x20policy...','\x20—\x20','policies','operation','permissions','\x20\x20\x20','policy\x20list','Administrator','length','No\x20policies\x20found','630zsiKxW','3715EXrVtM','user','10kGXHSE','entries','getPolicy','\x20\x20No\x20policies\x20assigned','ies','✔\x20Found\x20','(ID:\x20','4844BmONrn','\x20polic','bold','data','description','args','👥\x20Assigned\x20Users','15ESqQBa','Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','582wRyeTv','join','15059lDwtDq','all','policy','dim','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','197118ibFRDe','verbose','612vRvkuw','log','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>'];a32_0x4b7a=function(){return _0xe617eb;};return a32_0x4b7a();}import a32_0x108f39 from'chalk';export class PolicyCommand extends BaseCommand{[a32_0x1664a4(0x150)]=a32_0x1664a4(0x141);[a32_0x1664a4(0x138)]=a32_0x1664a4(0x14e);async[a32_0x1664a4(0x11d)](_0x267fb0){const _0x14c6a2=a32_0x1664a4,{options:_0x5c31c7,tdx:_0x388285}=_0x267fb0,_0x1389d6=await withSpinner(_0x14c6a2(0x114),async()=>{const _0x195980=_0x14c6a2,[_0xdf388f,_0x2844dd]=await Promise['all']([_0x388285[_0x195980(0x12c)][_0x195980(0x11e)](),_0x388285[_0x195980(0x141)]['getMyPermissions']()]);return{'userInfo':_0xdf388f,'permissions':_0x2844dd};},{'verbose':_0x5c31c7['verbose']}),{userInfo:_0x3d3799,permissions:_0x29e4e7}=_0x1389d6[_0x14c6a2(0x137)];if(isStructuredFormat(_0x5c31c7))return await handleSingleObjectOutput(_0x29e4e7,_0x5c31c7),0x0;const _0x3a614b=_0x3d3799[_0x14c6a2(0x117)]?'Account\x20Owner':_0x3d3799[_0x14c6a2(0x11b)]?_0x14c6a2(0x127):_0x14c6a2(0x14f);console['log']('\x0a'+a32_0x108f39[_0x14c6a2(0x136)]('👤')+'\x20'+a32_0x108f39[_0x14c6a2(0x136)](_0x3d3799[_0x14c6a2(0x150)])+'\x20'+a32_0x108f39['dim']('('+_0x3d3799[_0x14c6a2(0x119)]+')')+_0x14c6a2(0x121)+_0x3a614b),console[_0x14c6a2(0x147)](a32_0x108f39['dim'](_0x14c6a2(0x125)+_0x388285[_0x14c6a2(0x118)][_0x14c6a2(0x11c)]+':'+_0x3d3799[_0x14c6a2(0x113)]+_0x14c6a2(0x14b)+_0x3d3799['id']));const _0x5eca39=_0x29e4e7[_0x14c6a2(0x122)];console[_0x14c6a2(0x147)]('\x0a'+a32_0x108f39[_0x14c6a2(0x136)]('📋\x20Assigned\x20Policies')+'\x20('+_0x5eca39[_0x14c6a2(0x128)]+'):');if(_0x5eca39[_0x14c6a2(0x128)]===0x0)console[_0x14c6a2(0x147)](a32_0x108f39[_0x14c6a2(0x142)](_0x14c6a2(0x130)));else for(const _0x42d089 of _0x5eca39){console[_0x14c6a2(0x147)]('\x20\x20•\x20'+_0x42d089['name']);}return printPermissionsMap(_0x29e4e7[_0x14c6a2(0x124)]),console[_0x14c6a2(0x147)](),0x0;}}function a32_0x45a2(_0x1dc9ce,_0xc7b6ef){_0x1dc9ce=_0x1dc9ce-0x10f;const _0x4b7a78=a32_0x4b7a();let _0x45a24b=_0x4b7a78[_0x1dc9ce];return _0x45a24b;}export class PolicyListCommand extends BaseCommand{['name']=a32_0x1664a4(0x126);['description']=a32_0x1664a4(0x143);async[a32_0x1664a4(0x11d)](_0x7b92e){const _0x1111b4=a32_0x1664a4,{options:_0x3ff3fc,tdx:_0x42c59f}=_0x7b92e,_0x3a7a9c=await withSpinner(_0x1111b4(0x149),()=>_0x42c59f[_0x1111b4(0x141)]['listPolicies'](),{'verbose':_0x3ff3fc[_0x1111b4(0x145)]}),_0xe5a007=_0x3a7a9c[_0x1111b4(0x137)];console[_0x1111b4(0x10f)](_0x1111b4(0x132)+_0xe5a007[_0x1111b4(0x128)]+_0x1111b4(0x135)+(_0xe5a007[_0x1111b4(0x128)]!==0x1?_0x1111b4(0x131):'y'));if(isStructuredFormat(_0x3ff3fc))return await handleSDKOutput(_0xe5a007,_0x3ff3fc),0x0;if(_0xe5a007[_0x1111b4(0x128)]===0x0)console[_0x1111b4(0x147)](a32_0x108f39[_0x1111b4(0x142)](_0x1111b4(0x129)));else for(const _0x572e5c of _0xe5a007){const _0x1b17de=_0x572e5c[_0x1111b4(0x138)]?a32_0x108f39[_0x1111b4(0x142)](_0x1111b4(0x121)+_0x572e5c[_0x1111b4(0x138)]):'';console[_0x1111b4(0x147)]('\x20\x20•\x20'+_0x572e5c['name']+_0x1b17de);}return 0x0;}}export class PolicyShowCommand extends BaseCommand{[a32_0x1664a4(0x150)]=a32_0x1664a4(0x151);['description']=a32_0x1664a4(0x13c);[a32_0x1664a4(0x110)](_0x598e48){const _0x28605b=a32_0x1664a4;if(_0x598e48[_0x28605b(0x139)]['length']===0x0)return _0x28605b(0x148);return undefined;}async['execute'](_0x1029f3){const _0x35042d=a32_0x1664a4,{options:_0x3f2be0,tdx:_0x272b70}=_0x1029f3,_0x3e0ac3=_0x1029f3[_0x35042d(0x139)][0x0],_0x498476=await withSpinner(_0x35042d(0x120),async()=>{const _0x8eec75=_0x35042d,_0x443410=await _0x272b70[_0x8eec75(0x141)][_0x8eec75(0x12f)](_0x3e0ac3),[_0x377cb3,_0xed071a]=await Promise[_0x8eec75(0x140)]([_0x272b70[_0x8eec75(0x141)][_0x8eec75(0x116)](_0x443410['id']),_0x272b70[_0x8eec75(0x141)]['getPolicyUsers'](_0x443410['id'])]);return{'policy':_0x443410,'perms':_0x377cb3,'users':_0xed071a};},{'verbose':_0x3f2be0[_0x35042d(0x145)]}),{policy:_0x3b3425,perms:_0x18c081,users:_0x482dbf}=_0x498476[_0x35042d(0x137)];if(isStructuredFormat(_0x3f2be0))return await handleSingleObjectOutput({..._0x3b3425,'permissions':_0x18c081[_0x35042d(0x124)],'users':_0x482dbf},_0x3f2be0),0x0;console[_0x35042d(0x147)]('\x0a'+a32_0x108f39[_0x35042d(0x136)]('📋')+'\x20'+a32_0x108f39[_0x35042d(0x136)](_0x3b3425[_0x35042d(0x150)])+'\x20'+a32_0x108f39['dim'](_0x35042d(0x133)+_0x3b3425['id']+')'));_0x3b3425[_0x35042d(0x138)]&&console[_0x35042d(0x147)]('\x20\x20\x20'+a32_0x108f39['dim'](_0x3b3425[_0x35042d(0x138)]));console[_0x35042d(0x147)](_0x35042d(0x125)+_0x482dbf[_0x35042d(0x128)]+'\x20user'+(_0x482dbf[_0x35042d(0x128)]!==0x1?'s':'')+_0x35042d(0x115)),printPermissionsMap(_0x18c081[_0x35042d(0x124)]);if(_0x482dbf[_0x35042d(0x128)]>0x0){console[_0x35042d(0x147)]('\x0a'+a32_0x108f39['bold'](_0x35042d(0x13a))+':');for(const _0x44b25b of _0x482dbf){const _0x586441=_0x44b25b['email']&&_0x44b25b[_0x35042d(0x119)]!==_0x44b25b[_0x35042d(0x150)]?a32_0x108f39[_0x35042d(0x142)]('\x20<'+_0x44b25b[_0x35042d(0x119)]+'>'):'';console[_0x35042d(0x147)]('\x20\x20•\x20'+_0x44b25b[_0x35042d(0x150)]+_0x586441);}}return console['log'](),0x0;}}function printPermissionsMap(_0x5c6df0){const _0x2e617b=a32_0x1664a4,_0x4617c9=Object[_0x2e617b(0x12e)](_0x5c6df0);console[_0x2e617b(0x147)]('\x0a'+a32_0x108f39['bold']('🔑\x20Effective\x20Permissions')+':');if(_0x4617c9[_0x2e617b(0x128)]===0x0){console[_0x2e617b(0x147)](a32_0x108f39[_0x2e617b(0x142)](_0x2e617b(0x11f)));return;}const _0x43b768=Math['max'](..._0x4617c9['map'](([_0x15023f])=>_0x15023f[_0x2e617b(0x128)]));for(const [_0x5079eb,_0x5ac87f]of _0x4617c9){const _0x1a1035=formatOperations(_0x5ac87f);console[_0x2e617b(0x147)]('\x20\x20'+_0x5079eb['padEnd'](_0x43b768+0x2)+_0x1a1035);}}function formatOperations(_0x437e94){const _0x9cfdef=a32_0x1664a4,_0x5b21af=[...new Set(_0x437e94[_0x9cfdef(0x11a)](_0x18bd98=>_0x18bd98[_0x9cfdef(0x123)]))];return _0x5b21af[_0x9cfdef(0x13e)](',\x20');}
@@ -1 +1 @@
1
- function a33_0x3652(_0x4ad75a,_0x25a5d9){_0x4ad75a=_0x4ad75a-0xf3;const _0x4fac72=a33_0x4fac();let _0x365277=_0x4fac72[_0x4ad75a];return _0x365277;}const a33_0x1755f1=a33_0x3652;(function(_0x19d61f,_0x38ffe0){const _0x3ce4dd=a33_0x3652,_0x495162=_0x19d61f();while(!![]){try{const _0xe185d0=-parseInt(_0x3ce4dd(0x10c))/0x1*(parseInt(_0x3ce4dd(0x11d))/0x2)+parseInt(_0x3ce4dd(0x135))/0x3+-parseInt(_0x3ce4dd(0x106))/0x4+parseInt(_0x3ce4dd(0x11b))/0x5+-parseInt(_0x3ce4dd(0x15d))/0x6+parseInt(_0x3ce4dd(0x126))/0x7*(parseInt(_0x3ce4dd(0x14d))/0x8)+-parseInt(_0x3ce4dd(0x15c))/0x9;if(_0xe185d0===_0x38ffe0)break;else _0x495162['push'](_0x495162['shift']());}catch(_0x39c5ed){_0x495162['push'](_0x495162['shift']());}}}(a33_0x4fac,0x26fe7));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_0x389d7f from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';function a33_0x4fac(){const _0x2269e3=['\x20--default\x27\x20to\x20save\x20permanently','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','\x0aAvailable\x20profiles:','getUserInfo','Removed\x20existing\x20profile\x20\x27','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','profile:set','tdx:\x20profile\x20set','(cleared)','tdx:\x20profile\x20create','API\x20key\x20cannot\x20be\x20empty','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','744012HfMPyo','510174hhHBzq','password','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','\x27.\x0a\x0aValid\x20keys:\x20','database','parent_segment','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Failed\x20to\x20delete\x20profile:\x20','dim','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','\x0aSetup\x20cancelled','green','Profile\x20\x27','default','\x27\x20requires\x20API\x20key\x20validation.','Set\x20a\x20profile\x20configuration\x20value','name','Enter\x20description\x20(optional):','us01','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','\x27\x20does\x20not\x20exist.\x20Create\x20it?','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>','apiKey','bold','llm_project','697348bwoeZj','\x27\x20does\x20not\x20exist.','ERROR','text','Create\x20a\x20new\x20profile','Enter\x20profile\x20name:','3WGKEyg','tdx.json','test','You\x20can\x20find\x20your\x20API\x20key\x20at:','\x20Profile\x20\x27','\x20\x20-\x20','email','profileName','profile:use','Validating\x20API\x20key...','tdx:\x20profile\x20delete','validate','Set\x20session\x20profile','\x27\x20deleted','profile','987360JyEbzT','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','55520PGNXJp','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x27\x20updated:\x20','trim','confirm','skipExistsCheck','VALID_KEYS','split','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','280zjXABl','description','includes','Unknown\x20key\x20\x27','llm_agent','profile:create','oauth','red','message','create','\x20\x20(no\x20profiles\x20found)','warn','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','execute','join','863643AtEGjM','Default\x20profile\x20set\x20to:\x20','\x20\x20tdx\x20--profile\x20','\x20API\x20key\x20saved\x20to\x20system\x20keychain','config','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','site','Delete\x20a\x20profile','Removal\x20cancelled','log','✗\x20Validation\x20failed:\x20','logLevel','error','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','status','\x0aSaved\x20to:\x20','\x0aOperation\x20cancelled','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','yellow','jobs','Profile\x20name\x20cannot\x20be\x20empty','length','/app/mp/ak','19936VfaDsC','Setup\x20cancelled'];a33_0x4fac=function(){return _0x2269e3;};return a33_0x4fac();}import a33_0x359afd from'prompts';import a33_0x33b1fd from'chalk';function validateProfileName(_0x1ce1b7,_0x431625){const _0x5bcbfe=a33_0x3652;if(!_0x1ce1b7||!_0x1ce1b7[_0x5bcbfe(0x120)]())return _0x5bcbfe(0x14a);const _0x237cb1=_0x1ce1b7[_0x5bcbfe(0x120)]();if(!/^[a-zA-Z0-9_-]+$/[_0x5bcbfe(0x10e)](_0x237cb1))return _0x5bcbfe(0x155);if(!_0x431625?.[_0x5bcbfe(0x122)]&&profileExists(_0x237cb1))return _0x5bcbfe(0xf9)+_0x237cb1+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20'+_0x237cb1+_0x5bcbfe(0x125);return!![];}async function deleteProfileAndCredentials(_0x45b6c0){removeProfileFromUserConfig(_0x45b6c0);const _0x246f32=await isKeychainAvailable();_0x246f32&&await Promise['all']([deleteKeychainAPIKey(_0x45b6c0),deleteOAuthTokens(_0x45b6c0)]);}export class ProfileCreateCommand extends BaseCommand{[a33_0x1755f1(0xfd)]=a33_0x1755f1(0x12b);['description']=a33_0x1755f1(0x10a);async['execute'](_0x94d60){const _0x583bc0=a33_0x1755f1,{options:_0x49a6e9,args:_0x467149}=_0x94d60,_0x53cb08=!!_0x49a6e9['force'];console['log'](a33_0x33b1fd[_0x583bc0(0x104)](_0x583bc0(0x159)));let _0x20cc35;if(_0x467149[_0x583bc0(0x14b)]>0x0&&_0x467149[0x0]){const _0x223fa9=_0x467149[0x0][_0x583bc0(0x120)]();_0x53cb08&&profileExists(_0x223fa9)&&(await deleteProfileAndCredentials(_0x223fa9),console[_0x583bc0(0x13e)](_0x583bc0(0x154)+_0x223fa9+'\x27'));const _0x4891af=validateProfileName(_0x223fa9);if(_0x4891af!==!![])return console[_0x583bc0(0x141)](a33_0x33b1fd[_0x583bc0(0x12d)](_0x4891af)),0x1;_0x20cc35=_0x223fa9;}else{const _0x4dd136=await a33_0x359afd({'type':'text','name':_0x583bc0(0x113),'message':_0x583bc0(0x10b),'validate':_0x2fd6f8=>validateProfileName(_0x2fd6f8,{'skipExistsCheck':_0x53cb08})});if(!_0x4dd136[_0x583bc0(0x113)])return console[_0x583bc0(0x13e)](_0x583bc0(0xf7)),0x1;_0x20cc35=_0x4dd136['profileName']['trim'](),_0x53cb08&&profileExists(_0x20cc35)&&(await deleteProfileAndCredentials(_0x20cc35),console[_0x583bc0(0x13e)](_0x583bc0(0x154)+_0x20cc35+'\x27'));}const _0x32fc85=await a33_0x359afd({'type':_0x583bc0(0x109),'name':_0x583bc0(0x127),'message':_0x583bc0(0xfe)}),_0x232f24=_0x32fc85[_0x583bc0(0x127)]?.[_0x583bc0(0x120)]()||undefined,_0x4380b5=_0x49a6e9[_0x583bc0(0x13b)]||_0x583bc0(0xff),_0x326538=await promptSiteSelection(_0x4380b5,_0x20cc35,_0x583bc0(0x14e));if(!_0x326538)return 0x1;const _0x1951dd=resolveSite(_0x326538),_0x3861ed=await promptAuthMethod();if(!_0x3861ed)return console[_0x583bc0(0x13e)](_0x583bc0(0xf7)),0x1;if(_0x3861ed===_0x583bc0(0x12c)){if(_0x232f24){const _0x38d2c4={'site':_0x1951dd,'description':_0x232f24};saveProfileToUserConfig(_0x20cc35,_0x38d2c4);}const {accountName:_0x4a99b1}=_0x49a6e9;return await runOAuthLoginFlow(_0x1951dd,_0x20cc35,_0x49a6e9[_0x583bc0(0x140)]??LogLevel[_0x583bc0(0x108)],{'accountName':_0x4a99b1}),0x0;}console['log'](_0x583bc0(0x15b)+_0x1951dd),console[_0x583bc0(0x13e)](_0x583bc0(0x10f)),console['log']('\x20\x20'+getConsoleUrl(_0x1951dd,'/app/mp/ak'));const _0x56d373=await a33_0x359afd({'type':_0x583bc0(0x15e),'name':_0x583bc0(0x103),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x2c2c07=>{const _0x28ca2d=_0x583bc0;if(!_0x2c2c07||!_0x2c2c07[_0x28ca2d(0x120)]())return _0x28ca2d(0x15a);return!![];}});if(!_0x56d373[_0x583bc0(0x103)])return console[_0x583bc0(0x13e)](_0x583bc0(0xf7)),0x1;const _0x47e4e2=_0x56d373['apiKey'];console[_0x583bc0(0x13e)](_0x583bc0(0x115));try{const _0x58fd4a=TDX['create']({'site':_0x1951dd,'apiKey':_0x47e4e2[_0x583bc0(0x120)](),'logLevel':_0x49a6e9[_0x583bc0(0x140)]??LogLevel['ERROR']}),_0x46297c=await _0x58fd4a[_0x583bc0(0x149)][_0x583bc0(0x153)]();console[_0x583bc0(0x13e)](a33_0x33b1fd[_0x583bc0(0xf8)]('✓')+_0x583bc0(0x11e)+_0x46297c[_0x583bc0(0x112)]+')');const _0x1ebdb2=await isKeychainAvailable();_0x1ebdb2?(await saveAPIKeyAsync(_0x47e4e2[_0x583bc0(0x120)](),_0x1951dd,_0x20cc35),console[_0x583bc0(0x13e)](a33_0x33b1fd[_0x583bc0(0xf8)]('✓')+_0x583bc0(0xf6)+_0x20cc35+')')):(console[_0x583bc0(0x131)](a33_0x33b1fd[_0x583bc0(0x148)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x583bc0(0x131)](a33_0x33b1fd[_0x583bc0(0x148)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x1ebdc4={'site':_0x1951dd,..._0x232f24&&{'description':_0x232f24}};return saveProfileToUserConfig(_0x20cc35,_0x1ebdc4),console[_0x583bc0(0x13e)](a33_0x33b1fd[_0x583bc0(0xf8)]('✓')+'\x20Profile\x20\x27'+_0x20cc35+'\x27\x20created'),console['log'](),console[_0x583bc0(0x13e)](_0x583bc0(0x151)),console[_0x583bc0(0x13e)](_0x583bc0(0x137)+_0x20cc35+_0x583bc0(0x100)),console[_0x583bc0(0x13e)](_0x583bc0(0x137)+_0x20cc35+_0x583bc0(0x147)),0x0;}catch(_0xc8b22f){if(_0xc8b22f instanceof HTTPClientError&&_0xc8b22f[_0x583bc0(0x144)]===0x191)return printAuthError(_0xc8b22f),0x1;return console['error'](a33_0x33b1fd[_0x583bc0(0x12d)](_0x583bc0(0x13f)+(_0xc8b22f instanceof Error?_0xc8b22f[_0x583bc0(0x12e)]:String(_0xc8b22f)))),console[_0x583bc0(0x141)](_0x583bc0(0x163)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x1755f1(0xfd)]='profile:delete';['description']=a33_0x1755f1(0x13c);[a33_0x1755f1(0x117)](_0x1ccacb){const _0x133619=a33_0x1755f1,{args:_0xc93911}=_0x1ccacb;if(_0xc93911[_0x133619(0x14b)]===0x0)return _0x133619(0x143);return undefined;}async['execute'](_0x46ff7f){const _0x31ef68=a33_0x1755f1,{args:_0x183387}=_0x46ff7f,_0x2e5b8d=_0x183387[0x0];console[_0x31ef68(0x13e)](a33_0x33b1fd[_0x31ef68(0x104)](_0x31ef68(0x116)));if(!profileExists(_0x2e5b8d)){console['error'](a33_0x33b1fd[_0x31ef68(0x12d)](_0x31ef68(0xf9)+_0x2e5b8d+'\x27\x20does\x20not\x20exist.')),console[_0x31ef68(0x13e)](_0x31ef68(0x152));const _0x1f3efc=listProfiles();if(_0x1f3efc[_0x31ef68(0x14b)]===0x0)console[_0x31ef68(0x13e)](_0x31ef68(0x130));else for(const _0x1a92b6 of _0x1f3efc){console[_0x31ef68(0x13e)](_0x31ef68(0x111)+_0x1a92b6[_0x31ef68(0xfd)]);}return 0x1;}const _0x4bad42=await a33_0x359afd({'type':_0x31ef68(0x121),'name':_0x31ef68(0x121),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x2e5b8d+'\x27?','initial':![]});if(!_0x4bad42[_0x31ef68(0x121)])return console['log'](_0x31ef68(0x13d)),0x0;try{await deleteProfileAndCredentials(_0x2e5b8d),console['log'](a33_0x33b1fd['green']('✓')+_0x31ef68(0x110)+_0x2e5b8d+_0x31ef68(0x119));}catch(_0x1ff5dd){return console[_0x31ef68(0x141)](a33_0x33b1fd[_0x31ef68(0x12d)](_0x31ef68(0xf4)+(_0x1ff5dd instanceof Error?_0x1ff5dd[_0x31ef68(0x12e)]:String(_0x1ff5dd)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0x1755f1(0xfd)]=a33_0x1755f1(0x156);[a33_0x1755f1(0x127)]=a33_0x1755f1(0xfc);static ['VALID_KEYS']=[a33_0x1755f1(0x13b),a33_0x1755f1(0x161),a33_0x1755f1(0x162),a33_0x1755f1(0x105),a33_0x1755f1(0x12a),a33_0x1755f1(0x127)];['validate'](_0x41d8eb){const _0x3ed600=a33_0x1755f1,{args:_0x3a40e3,options:_0x1508c5}=_0x41d8eb,_0x45c7b2=_0x1508c5[_0x3ed600(0x11a)]||getActiveProfile();if(!_0x45c7b2)return _0x3ed600(0x102);if(_0x3a40e3[_0x3ed600(0x14b)]===0x0)return _0x3ed600(0xf3)+ProfileSetCommand[_0x3ed600(0x123)][_0x3ed600(0x134)](',\x20');const _0xb189ab=_0x3a40e3[0x0];if(!_0xb189ab[_0x3ed600(0x128)]('='))return _0x3ed600(0x11c)+ProfileSetCommand[_0x3ed600(0x123)]['join'](',\x20');const [_0xfa1316]=_0xb189ab[_0x3ed600(0x124)]('=',0x2);if(!ProfileSetCommand[_0x3ed600(0x123)]['includes'](_0xfa1316))return _0x3ed600(0x129)+_0xfa1316+_0x3ed600(0x160)+ProfileSetCommand[_0x3ed600(0x123)][_0x3ed600(0x134)](',\x20');return undefined;}async[a33_0x1755f1(0x133)](_0x3a4a62){const _0x23c428=a33_0x1755f1,{args:_0x378da2,options:_0x387acc}=_0x3a4a62,_0x533b9c=_0x387acc['profile']||getActiveProfile(),[_0x127a15,..._0x489cd6]=_0x378da2[0x0][_0x23c428(0x124)]('='),_0x3aa39d=_0x489cd6[_0x23c428(0x134)]('=');console[_0x23c428(0x13e)](a33_0x33b1fd[_0x23c428(0x104)](_0x23c428(0x157)));if(!profileExists(_0x533b9c)){const _0x4d68cc=await a33_0x359afd({'type':_0x23c428(0x121),'name':_0x23c428(0x12f),'message':_0x23c428(0xf9)+_0x533b9c+_0x23c428(0x101),'initial':!![]});if(!_0x4d68cc['create'])return console[_0x23c428(0x13e)]('Operation\x20cancelled'),0x1;}const _0x1a61e9=loadProfile(_0x533b9c),_0x2b2b7a=_0x1a61e9?.[_0x23c428(0x139)]||{};if(_0x127a15===_0x23c428(0x13b)){const _0x3f7c31=resolveSite(_0x3aa39d);console[_0x23c428(0x13e)]('Changing\x20site\x20to\x20\x27'+_0x3f7c31+_0x23c428(0xfb)),console[_0x23c428(0x13e)](_0x23c428(0x13a)),console[_0x23c428(0x13e)]('\x20\x20'+getConsoleUrl(_0x3f7c31,_0x23c428(0x14c)));const _0x25da4f=await a33_0x359afd({'type':_0x23c428(0x15e),'name':_0x23c428(0x103),'message':_0x23c428(0x132),'validate':_0x238cc5=>{const _0x43e477=_0x23c428;if(!_0x238cc5||!_0x238cc5[_0x43e477(0x120)]())return _0x43e477(0x15a);return!![];}});if(!_0x25da4f[_0x23c428(0x103)])return console[_0x23c428(0x13e)](_0x23c428(0x146)),0x1;console[_0x23c428(0x13e)](_0x23c428(0x115));try{const _0x21a607=TDX[_0x23c428(0x12f)]({'site':_0x3f7c31,'apiKey':_0x25da4f['apiKey']['trim'](),'logLevel':_0x387acc[_0x23c428(0x140)]??LogLevel['ERROR']}),_0x226cce=await _0x21a607['jobs'][_0x23c428(0x153)]();console[_0x23c428(0x13e)](a33_0x33b1fd[_0x23c428(0xf8)]('✓')+_0x23c428(0x11e)+_0x226cce[_0x23c428(0x112)]+')');const _0x53f7c1=await isKeychainAvailable();_0x53f7c1?(await saveAPIKeyAsync(_0x25da4f['apiKey'][_0x23c428(0x120)](),_0x3f7c31,_0x533b9c),console[_0x23c428(0x13e)](a33_0x33b1fd[_0x23c428(0xf8)]('✓')+_0x23c428(0x138))):console[_0x23c428(0x131)](a33_0x33b1fd[_0x23c428(0x148)](_0x23c428(0x142))),_0x2b2b7a[_0x23c428(0x13b)]=_0x3f7c31;}catch(_0xc8a277){if(_0xc8a277 instanceof HTTPClientError&&_0xc8a277[_0x23c428(0x144)]===0x191)return printAuthError(_0xc8a277),0x1;return console[_0x23c428(0x141)](a33_0x33b1fd[_0x23c428(0x12d)](_0x23c428(0x13f)+(_0xc8a277 instanceof Error?_0xc8a277['message']:String(_0xc8a277)))),console[_0x23c428(0x141)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x2b2b7a[_0x127a15]=_0x3aa39d||undefined;return saveProfileToUserConfig(_0x533b9c,_0x2b2b7a),console[_0x23c428(0x13e)](a33_0x33b1fd[_0x23c428(0xf8)]('✓')+_0x23c428(0x110)+_0x533b9c+_0x23c428(0x11f)+_0x127a15+'='+(_0x3aa39d||_0x23c428(0x158))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x1755f1(0xfd)]=a33_0x1755f1(0x114);[a33_0x1755f1(0x127)]=a33_0x1755f1(0x118);[a33_0x1755f1(0x117)](_0x4ef61b){const _0x5a45e3=a33_0x1755f1,{args:_0x1ae5fd}=_0x4ef61b;if(_0x1ae5fd['length']===0x0)return _0x5a45e3(0x15f);return undefined;}async['execute'](_0x432da1){const _0x264808=a33_0x1755f1,{args:_0x364563,options:_0x14af9f}=_0x432da1,_0x483f5b=_0x364563[0x0],_0x2040c2=_0x14af9f[_0x264808(0xfa)];cleanExpiredSessions();if(!profileExists(_0x483f5b)){console['error'](a33_0x33b1fd[_0x264808(0x12d)](_0x264808(0xf9)+_0x483f5b+_0x264808(0x107))),console[_0x264808(0x13e)](_0x264808(0x152));const _0x25021f=listProfiles();if(_0x25021f[_0x264808(0x14b)]===0x0)console[_0x264808(0x13e)](_0x264808(0x130));else for(const _0x2287ab of _0x25021f){console[_0x264808(0x13e)](_0x264808(0x111)+_0x2287ab[_0x264808(0xfd)]);}return 0x1;}if(_0x2040c2){const _0x334d1c=a33_0x389d7f[_0x264808(0x134)](getConfigDir(),_0x264808(0x10d));return saveActiveProfileToUserConfig(_0x483f5b),console[_0x264808(0x13e)](_0x264808(0x136)+a33_0x33b1fd['green'](_0x483f5b)),console[_0x264808(0x13e)](a33_0x33b1fd[_0x264808(0xf5)](_0x264808(0x145)+_0x334d1c)),0x0;}const _0x8baea9=getSessionID(_0x14af9f['session']);return saveSessionContext({'profile':_0x483f5b},_0x14af9f['session']),console[_0x264808(0x13e)]('Session\x20profile\x20set\x20to:\x20'+a33_0x33b1fd['green'](_0x483f5b)+'\x20'+a33_0x33b1fd[_0x264808(0xf5)]('(session:\x20'+_0x8baea9+')')),console[_0x264808(0x13e)](a33_0x33b1fd[_0x264808(0xf5)](_0x264808(0x150)+_0x483f5b+_0x264808(0x14f))),0x0;}}
1
+ const a33_0x2c6e9a=a33_0x42b8;(function(_0x55df47,_0x54494e){const _0x3a5b1e=a33_0x42b8,_0x544f92=_0x55df47();while(!![]){try{const _0x1966fa=parseInt(_0x3a5b1e(0x1db))/0x1*(parseInt(_0x3a5b1e(0x1ef))/0x2)+-parseInt(_0x3a5b1e(0x230))/0x3+parseInt(_0x3a5b1e(0x23f))/0x4*(-parseInt(_0x3a5b1e(0x227))/0x5)+parseInt(_0x3a5b1e(0x1e0))/0x6*(-parseInt(_0x3a5b1e(0x235))/0x7)+parseInt(_0x3a5b1e(0x211))/0x8*(-parseInt(_0x3a5b1e(0x1fd))/0x9)+-parseInt(_0x3a5b1e(0x239))/0xa*(parseInt(_0x3a5b1e(0x201))/0xb)+-parseInt(_0x3a5b1e(0x23d))/0xc*(-parseInt(_0x3a5b1e(0x1e9))/0xd);if(_0x1966fa===_0x54494e)break;else _0x544f92['push'](_0x544f92['shift']());}catch(_0x262d10){_0x544f92['push'](_0x544f92['shift']());}}}(a33_0x1ab4,0x2d090));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';function a33_0x1ab4(){const _0x1ec1b9=['email','Operation\x20cancelled','API\x20key\x20cannot\x20be\x20empty','trim','profile:set','\x20Profile\x20\x27','3032226uRaVKB','create','Set\x20a\x20profile\x20configuration\x20value','Create\x20a\x20new\x20profile','231847TqDAQU','Failed\x20to\x20delete\x20profile:\x20','\x27\x20requires\x20API\x20key\x20validation.','Delete\x20a\x20profile','site','\x27\x20updated:\x20','llm_agent','jobs','confirm','profile:create','\x20\x20(no\x20profiles\x20found)','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','profile:use','\x0aOperation\x20cancelled','database','Enter\x20description\x20(optional):','8hPYIIO','session','/app/mp/ak','\x0aAvailable\x20profiles:','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x27\x20does\x20not\x20exist.\x20Create\x20it?','profile','config','yellow','includes','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','\x20\x20tdx\x20--profile\x20','(session:\x20','profileName','Changing\x20site\x20to\x20\x27','✗\x20Validation\x20failed:\x20','length','getUserInfo','green','Set\x20session\x20profile','execute','bold','11455lOPTtr','apiKey','Profile\x20\x27','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','name','Session\x20profile\x20set\x20to:\x20','validate','\x20API\x20key\x20is\x20valid\x20(User:\x20','force','959343kQauyo','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','join','\x27\x20does\x20not\x20exist.','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20delete\x20<name>','203lXNZai','VALID_KEYS','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','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>','20KfjJbk','(cleared)','Removal\x20cancelled','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','36LSPFSc','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','108TchleB','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','us01','\x0aSetup\x20cancelled','red','Default\x20profile\x20set\x20to:\x20','status','split','141499YAEJYp','profile:delete','Validating\x20API\x20key...','password','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','53322PkGhOA','logLevel','\x27.\x0a\x0aValid\x20keys:\x20','warn','You\x20can\x20find\x20your\x20API\x20key\x20at:','error','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','description','oauth','4599374uxFSeF','all','tdx.json','Setup\x20cancelled','test','ERROR','2lBmOmS','dim','log','message','\x27\x20to\x20remove\x20it\x20first,\x20or\x20re-create\x20with\x20--force.','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','\x20\x20-\x20','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20delete\x20'];a33_0x1ab4=function(){return _0x1ec1b9;};return a33_0x1ab4();}import*as a33_0x2dec35 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{deleteOAuthTokens}from'../core/oauth-keychain.js';import{runOAuthLoginFlow,promptAuthMethod}from'./auth-command.js';import{promptSiteSelection}from'../core/constants.js';function a33_0x42b8(_0x3e4ec1,_0x567f52){_0x3e4ec1=_0x3e4ec1-0x1da;const _0x1ab4e3=a33_0x1ab4();let _0x42b8f2=_0x1ab4e3[_0x3e4ec1];return _0x42b8f2;}import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a33_0x9d9e94 from'prompts';import a33_0x9c397b from'chalk';function validateProfileName(_0x5f9bf8,_0x4a58a5){const _0x1973d8=a33_0x42b8;if(!_0x5f9bf8||!_0x5f9bf8[_0x1973d8(0x1fa)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x5bbc8f=_0x5f9bf8['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x1973d8(0x1ed)](_0x5bbc8f))return _0x1973d8(0x237);if(!_0x4a58a5?.['skipExistsCheck']&&profileExists(_0x5bbc8f))return'Profile\x20\x27'+_0x5bbc8f+_0x1973d8(0x1f6)+_0x5bbc8f+_0x1973d8(0x1f3);return!![];}async function deleteProfileAndCredentials(_0x32a8aa){const _0x13d297=a33_0x42b8;removeProfileFromUserConfig(_0x32a8aa);const _0x968851=await isKeychainAvailable();_0x968851&&await Promise[_0x13d297(0x1ea)]([deleteKeychainAPIKey(_0x32a8aa),deleteOAuthTokens(_0x32a8aa)]);}export class ProfileCreateCommand extends BaseCommand{['name']=a33_0x2c6e9a(0x20a);['description']=a33_0x2c6e9a(0x200);async[a33_0x2c6e9a(0x225)](_0x549d80){const _0x2770e9=a33_0x2c6e9a,{options:_0x2ea486,args:_0x1d6c63}=_0x549d80,_0x45f47f=!!_0x2ea486[_0x2770e9(0x22f)];console[_0x2770e9(0x1f1)](a33_0x9c397b['bold']('tdx:\x20profile\x20create'));let _0x45516a;if(_0x1d6c63[_0x2770e9(0x221)]>0x0&&_0x1d6c63[0x0]){const _0x1f6739=_0x1d6c63[0x0]['trim']();_0x45f47f&&profileExists(_0x1f6739)&&(await deleteProfileAndCredentials(_0x1f6739),console[_0x2770e9(0x1f1)]('Removed\x20existing\x20profile\x20\x27'+_0x1f6739+'\x27'));const _0x2b4573=validateProfileName(_0x1f6739);if(_0x2b4573!==!![])return console[_0x2770e9(0x1e5)](a33_0x9c397b[_0x2770e9(0x243)](_0x2b4573)),0x1;_0x45516a=_0x1f6739;}else{const _0x5b4e58=await a33_0x9d9e94({'type':'text','name':_0x2770e9(0x21e),'message':'Enter\x20profile\x20name:','validate':_0x3ac28b=>validateProfileName(_0x3ac28b,{'skipExistsCheck':_0x45f47f})});if(!_0x5b4e58[_0x2770e9(0x21e)])return console['log'](_0x2770e9(0x242)),0x1;_0x45516a=_0x5b4e58[_0x2770e9(0x21e)][_0x2770e9(0x1fa)](),_0x45f47f&&profileExists(_0x45516a)&&(await deleteProfileAndCredentials(_0x45516a),console[_0x2770e9(0x1f1)]('Removed\x20existing\x20profile\x20\x27'+_0x45516a+'\x27'));}const _0x46767b=await a33_0x9d9e94({'type':'text','name':_0x2770e9(0x1e7),'message':_0x2770e9(0x210)}),_0x551c38=_0x46767b[_0x2770e9(0x1e7)]?.[_0x2770e9(0x1fa)]()||undefined,_0x497196=_0x2ea486['site']||_0x2770e9(0x241),_0x56542b=await promptSiteSelection(_0x497196,_0x45516a,_0x2770e9(0x1ec));if(!_0x56542b)return 0x1;const _0x48afdd=resolveSite(_0x56542b),_0xabfe33=await promptAuthMethod();if(!_0xabfe33)return console[_0x2770e9(0x1f1)]('\x0aSetup\x20cancelled'),0x1;if(_0xabfe33===_0x2770e9(0x1e8)){if(_0x551c38){const _0x51d277={'site':_0x48afdd,'description':_0x551c38};saveProfileToUserConfig(_0x45516a,_0x51d277);}const {accountName:_0x267e74}=_0x2ea486;return await runOAuthLoginFlow(_0x48afdd,_0x45516a,_0x2ea486['logLevel']??LogLevel['ERROR'],{'accountName':_0x267e74}),0x0;}console[_0x2770e9(0x1f1)](_0x2770e9(0x240)+_0x48afdd),console[_0x2770e9(0x1f1)](_0x2770e9(0x1e4)),console['log']('\x20\x20'+getConsoleUrl(_0x48afdd,_0x2770e9(0x213)));const _0x4cde2b=await a33_0x9d9e94({'type':_0x2770e9(0x1de),'name':_0x2770e9(0x228),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x35e482=>{if(!_0x35e482||!_0x35e482['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x4cde2b['apiKey'])return console['log'](_0x2770e9(0x242)),0x1;const _0x451228=_0x4cde2b['apiKey'];console[_0x2770e9(0x1f1)](_0x2770e9(0x1dd));try{const _0x15842b=TDX[_0x2770e9(0x1fe)]({'site':_0x48afdd,'apiKey':_0x451228[_0x2770e9(0x1fa)](),'logLevel':_0x2ea486[_0x2770e9(0x1e1)]??LogLevel[_0x2770e9(0x1ee)]}),_0x5a91b9=await _0x15842b[_0x2770e9(0x208)][_0x2770e9(0x222)]();console[_0x2770e9(0x1f1)](a33_0x9c397b[_0x2770e9(0x223)]('✓')+_0x2770e9(0x22e)+_0x5a91b9[_0x2770e9(0x1f7)]+')');const _0x10c2e7=await isKeychainAvailable();_0x10c2e7?(await saveAPIKeyAsync(_0x451228[_0x2770e9(0x1fa)](),_0x48afdd,_0x45516a),console[_0x2770e9(0x1f1)](a33_0x9c397b[_0x2770e9(0x223)]('✓')+_0x2770e9(0x23c)+_0x45516a+')')):(console[_0x2770e9(0x1e3)](a33_0x9c397b[_0x2770e9(0x219)](_0x2770e9(0x1e6))),console[_0x2770e9(0x1e3)](a33_0x9c397b[_0x2770e9(0x219)](_0x2770e9(0x20c))));const _0x32071b={'site':_0x48afdd,..._0x551c38&&{'description':_0x551c38}};return saveProfileToUserConfig(_0x45516a,_0x32071b),console[_0x2770e9(0x1f1)](a33_0x9c397b['green']('✓')+_0x2770e9(0x1fc)+_0x45516a+'\x27\x20created'),console[_0x2770e9(0x1f1)](),console[_0x2770e9(0x1f1)](_0x2770e9(0x22a)),console[_0x2770e9(0x1f1)](_0x2770e9(0x21c)+_0x45516a+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x2770e9(0x1f1)]('\x20\x20tdx\x20--profile\x20'+_0x45516a+_0x2770e9(0x21b)),0x0;}catch(_0x36c119){if(_0x36c119 instanceof HTTPClientError&&_0x36c119[_0x2770e9(0x245)]===0x191)return printAuthError(_0x36c119),0x1;return console[_0x2770e9(0x1e5)](a33_0x9c397b[_0x2770e9(0x243)](_0x2770e9(0x220)+(_0x36c119 instanceof Error?_0x36c119[_0x2770e9(0x1f2)]:String(_0x36c119)))),console[_0x2770e9(0x1e5)](_0x2770e9(0x1f4)),0x1;}}}export class ProfileDeleteCommand extends BaseCommand{[a33_0x2c6e9a(0x22b)]=a33_0x2c6e9a(0x1dc);['description']=a33_0x2c6e9a(0x204);[a33_0x2c6e9a(0x22d)](_0x345baa){const _0xf67ed6=a33_0x2c6e9a,{args:_0x4fee20}=_0x345baa;if(_0x4fee20[_0xf67ed6(0x221)]===0x0)return _0xf67ed6(0x234);return undefined;}async[a33_0x2c6e9a(0x225)](_0x3a59d9){const _0x47e9e9=a33_0x2c6e9a,{args:_0x3972a4}=_0x3a59d9,_0x229571=_0x3972a4[0x0];console['log'](a33_0x9c397b[_0x47e9e9(0x226)]('tdx:\x20profile\x20delete'));if(!profileExists(_0x229571)){console[_0x47e9e9(0x1e5)](a33_0x9c397b[_0x47e9e9(0x243)](_0x47e9e9(0x229)+_0x229571+_0x47e9e9(0x233))),console['log'](_0x47e9e9(0x214));const _0x190df6=listProfiles();if(_0x190df6[_0x47e9e9(0x221)]===0x0)console[_0x47e9e9(0x1f1)](_0x47e9e9(0x20b));else for(const _0x4ea2b2 of _0x190df6){console[_0x47e9e9(0x1f1)](_0x47e9e9(0x1f5)+_0x4ea2b2[_0x47e9e9(0x22b)]);}return 0x1;}const _0x47f7b4=await a33_0x9d9e94({'type':_0x47e9e9(0x209),'name':_0x47e9e9(0x209),'message':_0x47e9e9(0x215)+_0x229571+'\x27?','initial':![]});if(!_0x47f7b4[_0x47e9e9(0x209)])return console['log'](_0x47e9e9(0x23b)),0x0;try{await deleteProfileAndCredentials(_0x229571),console['log'](a33_0x9c397b[_0x47e9e9(0x223)]('✓')+_0x47e9e9(0x1fc)+_0x229571+'\x27\x20deleted');}catch(_0x1a469c){return console['error'](a33_0x9c397b[_0x47e9e9(0x243)](_0x47e9e9(0x202)+(_0x1a469c instanceof Error?_0x1a469c[_0x47e9e9(0x1f2)]:String(_0x1a469c)))),0x1;}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a33_0x2c6e9a(0x22b)]=a33_0x2c6e9a(0x1fb);['description']=a33_0x2c6e9a(0x1ff);static [a33_0x2c6e9a(0x236)]=[a33_0x2c6e9a(0x205),a33_0x2c6e9a(0x20f),'parent_segment','llm_project',a33_0x2c6e9a(0x207),a33_0x2c6e9a(0x1e7)];[a33_0x2c6e9a(0x22d)](_0x26ddf8){const _0x39085f=a33_0x2c6e9a,{args:_0x54674f,options:_0x490834}=_0x26ddf8,_0x59ad12=_0x490834[_0x39085f(0x217)]||getActiveProfile();if(!_0x59ad12)return _0x39085f(0x238);if(_0x54674f[_0x39085f(0x221)]===0x0)return _0x39085f(0x23e)+ProfileSetCommand[_0x39085f(0x236)][_0x39085f(0x232)](',\x20');const _0x2a1dfa=_0x54674f[0x0];if(!_0x2a1dfa[_0x39085f(0x21a)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS'][_0x39085f(0x232)](',\x20');const [_0x29c3a1]=_0x2a1dfa['split']('=',0x2);if(!ProfileSetCommand[_0x39085f(0x236)][_0x39085f(0x21a)](_0x29c3a1))return'Unknown\x20key\x20\x27'+_0x29c3a1+_0x39085f(0x1e2)+ProfileSetCommand['VALID_KEYS'][_0x39085f(0x232)](',\x20');return undefined;}async[a33_0x2c6e9a(0x225)](_0x21ab29){const _0x52b3c9=a33_0x2c6e9a,{args:_0x1291e7,options:_0x267f1b}=_0x21ab29,_0x4b65f6=_0x267f1b['profile']||getActiveProfile(),[_0xfeec09,..._0x4263d8]=_0x1291e7[0x0][_0x52b3c9(0x1da)]('='),_0x4b7b7a=_0x4263d8['join']('=');console[_0x52b3c9(0x1f1)](a33_0x9c397b[_0x52b3c9(0x226)]('tdx:\x20profile\x20set'));if(!profileExists(_0x4b65f6)){const _0x342550=await a33_0x9d9e94({'type':_0x52b3c9(0x209),'name':_0x52b3c9(0x1fe),'message':_0x52b3c9(0x229)+_0x4b65f6+_0x52b3c9(0x216),'initial':!![]});if(!_0x342550[_0x52b3c9(0x1fe)])return console['log'](_0x52b3c9(0x1f8)),0x1;}const _0x37281e=loadProfile(_0x4b65f6),_0x1e157d=_0x37281e?.[_0x52b3c9(0x218)]||{};if(_0xfeec09==='site'){const _0x48b579=resolveSite(_0x4b7b7a);console[_0x52b3c9(0x1f1)](_0x52b3c9(0x21f)+_0x48b579+_0x52b3c9(0x203)),console[_0x52b3c9(0x1f1)](_0x52b3c9(0x231)),console[_0x52b3c9(0x1f1)]('\x20\x20'+getConsoleUrl(_0x48b579,'/app/mp/ak'));const _0x22a755=await a33_0x9d9e94({'type':_0x52b3c9(0x1de),'name':_0x52b3c9(0x228),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x97c5da=>{const _0x6b9ccc=_0x52b3c9;if(!_0x97c5da||!_0x97c5da[_0x6b9ccc(0x1fa)]())return _0x6b9ccc(0x1f9);return!![];}});if(!_0x22a755['apiKey'])return console[_0x52b3c9(0x1f1)](_0x52b3c9(0x20e)),0x1;console[_0x52b3c9(0x1f1)]('Validating\x20API\x20key...');try{const _0x178a77=TDX['create']({'site':_0x48b579,'apiKey':_0x22a755[_0x52b3c9(0x228)][_0x52b3c9(0x1fa)](),'logLevel':_0x267f1b[_0x52b3c9(0x1e1)]??LogLevel[_0x52b3c9(0x1ee)]}),_0xa76da5=await _0x178a77['jobs'][_0x52b3c9(0x222)]();console['log'](a33_0x9c397b[_0x52b3c9(0x223)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0xa76da5[_0x52b3c9(0x1f7)]+')');const _0x1eb171=await isKeychainAvailable();_0x1eb171?(await saveAPIKeyAsync(_0x22a755['apiKey'][_0x52b3c9(0x1fa)](),_0x48b579,_0x4b65f6),console[_0x52b3c9(0x1f1)](a33_0x9c397b['green']('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x52b3c9(0x1e3)](a33_0x9c397b['yellow'](_0x52b3c9(0x1e6))),_0x1e157d['site']=_0x48b579;}catch(_0x57df84){if(_0x57df84 instanceof HTTPClientError&&_0x57df84[_0x52b3c9(0x245)]===0x191)return printAuthError(_0x57df84),0x1;return console[_0x52b3c9(0x1e5)](a33_0x9c397b[_0x52b3c9(0x243)](_0x52b3c9(0x220)+(_0x57df84 instanceof Error?_0x57df84[_0x52b3c9(0x1f2)]:String(_0x57df84)))),console[_0x52b3c9(0x1e5)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x1e157d[_0xfeec09]=_0x4b7b7a||undefined;return saveProfileToUserConfig(_0x4b65f6,_0x1e157d),console['log'](a33_0x9c397b[_0x52b3c9(0x223)]('✓')+_0x52b3c9(0x1fc)+_0x4b65f6+_0x52b3c9(0x206)+_0xfeec09+'='+(_0x4b7b7a||_0x52b3c9(0x23a))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a33_0x2c6e9a(0x22b)]=a33_0x2c6e9a(0x20d);[a33_0x2c6e9a(0x1e7)]=a33_0x2c6e9a(0x224);[a33_0x2c6e9a(0x22d)](_0x3fc19f){const _0x533bf7=a33_0x2c6e9a,{args:_0x1332ac}=_0x3fc19f;if(_0x1332ac['length']===0x0)return _0x533bf7(0x1df);return undefined;}async[a33_0x2c6e9a(0x225)](_0x1c20ce){const _0x5464d5=a33_0x2c6e9a,{args:_0x519aaa,options:_0x19a21a}=_0x1c20ce,_0x36fe1f=_0x519aaa[0x0],_0x4fe891=_0x19a21a['default'];cleanExpiredSessions();if(!profileExists(_0x36fe1f)){console['error'](a33_0x9c397b['red']('Profile\x20\x27'+_0x36fe1f+_0x5464d5(0x233))),console[_0x5464d5(0x1f1)](_0x5464d5(0x214));const _0x11c925=listProfiles();if(_0x11c925[_0x5464d5(0x221)]===0x0)console['log'](_0x5464d5(0x20b));else for(const _0x3c6e65 of _0x11c925){console[_0x5464d5(0x1f1)]('\x20\x20-\x20'+_0x3c6e65[_0x5464d5(0x22b)]);}return 0x1;}if(_0x4fe891){const _0x8f3fcb=a33_0x2dec35[_0x5464d5(0x232)](getConfigDir(),_0x5464d5(0x1eb));return saveActiveProfileToUserConfig(_0x36fe1f),console[_0x5464d5(0x1f1)](_0x5464d5(0x244)+a33_0x9c397b[_0x5464d5(0x223)](_0x36fe1f)),console[_0x5464d5(0x1f1)](a33_0x9c397b[_0x5464d5(0x1f0)]('\x0aSaved\x20to:\x20'+_0x8f3fcb)),0x0;}const _0x38449c=getSessionID(_0x19a21a[_0x5464d5(0x212)]);return saveSessionContext({'profile':_0x36fe1f},_0x19a21a[_0x5464d5(0x212)]),console[_0x5464d5(0x1f1)](_0x5464d5(0x22c)+a33_0x9c397b[_0x5464d5(0x223)](_0x36fe1f)+'\x20'+a33_0x9c397b[_0x5464d5(0x1f0)](_0x5464d5(0x21d)+_0x38449c+')')),console[_0x5464d5(0x1f1)](a33_0x9c397b[_0x5464d5(0x1f0)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x36fe1f+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
@@ -1 +1 @@
1
- const a34_0x5e78ad=a34_0x57c7;(function(_0x11ab5d,_0x359b62){const _0x189290=a34_0x57c7,_0x1a277d=_0x11ab5d();while(!![]){try{const _0x154be1=-parseInt(_0x189290(0x12f))/0x1+-parseInt(_0x189290(0x127))/0x2*(-parseInt(_0x189290(0x117))/0x3)+parseInt(_0x189290(0x12d))/0x4*(parseInt(_0x189290(0x119))/0x5)+parseInt(_0x189290(0x12b))/0x6*(-parseInt(_0x189290(0x11b))/0x7)+parseInt(_0x189290(0x11f))/0x8+-parseInt(_0x189290(0x11c))/0x9*(-parseInt(_0x189290(0x11e))/0xa)+parseInt(_0x189290(0x120))/0xb*(-parseInt(_0x189290(0x11d))/0xc);if(_0x154be1===_0x359b62)break;else _0x1a277d['push'](_0x1a277d['shift']());}catch(_0x21b737){_0x1a277d['push'](_0x1a277d['shift']());}}}(a34_0xe3b7,0xe5681));function a34_0x57c7(_0x5d77a5,_0x1193b7){_0x5d77a5=_0x5d77a5-0x115;const _0xe3b78d=a34_0xe3b7();let _0x57c7e0=_0xe3b78d[_0x5d77a5];return _0x57c7e0;}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0x3ed808 from'chalk';export class ProfilesCommand extends BaseCommand{['name']=a34_0x5e78ad(0x125);[a34_0x5e78ad(0x130)]=a34_0x5e78ad(0x132);async[a34_0x5e78ad(0x12a)](_0xedc23b){const _0x222ce=a34_0x5e78ad,{options:_0x1da8e7}=_0xedc23b;try{const _0x2ad448=listProfiles(),_0x33bf08=getActiveProfile();if(_0x2ad448[_0x222ce(0x123)]===0x0)return console['log'](_0x222ce(0x129)),console[_0x222ce(0x12e)](_0x222ce(0x131)),console[_0x222ce(0x12e)](_0x222ce(0x121)),0x0;const _0x4ed8af=_0x2ad448[_0x222ce(0x133)](_0x42759c=>{const _0x34ac2e=_0x222ce,_0x5be14f=_0x42759c['name']===_0x33bf08,_0x50f514=getProfileParams(_0x42759c['config']);return{'name':_0x42759c[_0x34ac2e(0x122)],'active':_0x5be14f,'scope':_0x42759c[_0x34ac2e(0x115)],'description':_0x42759c['config'][_0x34ac2e(0x130)]||'','params':_0x50f514};});if(isStructuredFormat(_0x1da8e7))await handleSDKOutput(_0x4ed8af,_0x1da8e7);else for(const _0x480772 of _0x2ad448){const _0x504f1e=_0x480772['name']===_0x33bf08?a34_0x3ed808[_0x222ce(0x126)]('\x20✓'):'',_0x426d4d=_0x480772[_0x222ce(0x124)]['site']?a34_0x3ed808[_0x222ce(0x11a)]('\x20'+_0x480772['config']['site']):'',_0x44be41=_0x480772[_0x222ce(0x124)][_0x222ce(0x130)]?a34_0x3ed808[_0x222ce(0x11a)]('\x20\x20'+_0x480772['config'][_0x222ce(0x130)]):'';console[_0x222ce(0x12e)](_0x222ce(0x118)+_0x480772[_0x222ce(0x122)]+_0x504f1e+_0x426d4d+_0x44be41);}return 0x0;}catch(_0x24a201){return _0x24a201 instanceof Error&&console[_0x222ce(0x128)](_0x222ce(0x12c)+_0x24a201[_0x222ce(0x116)]),0x1;}}}function a34_0xe3b7(){const _0x4f1f1a=['218449GhPzGh','\x20\x20Global:\x20~/.config/tdx/tdx.json','name','length','config','profiles','green','168788aVwaDV','error','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','execute','6Hrqwal','Error:\x20','260652OwdGdi','log','640251UVcWqF','description','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','List\x20all\x20available\x20profiles','map','scope','message','66MqIEGt','👤\x20','5gsqppn','dim','11523029wCGbCK','102663hltsHh','456DEtirz','1570mIWNkJ','2143672BhSHBc'];a34_0xe3b7=function(){return _0x4f1f1a;};return a34_0xe3b7();}
1
+ function a34_0x3210(){const _0xa6e107=['map','👤\x20','log','error','8dAPpdt','green','length','message','1138114LEdRWa','5modjrN','7432GzGwdu','\x20\x20Global:\x20~/.config/tdx/tdx.json','959fWybDy','description','4440402qELovj','33LEeWsA','2597780WLkQhh','11127096wZvySM','List\x20all\x20available\x20profiles','name','1oPNJSF','26GbnhmF','1807245QaQqOc','455595aUFeRH','config','site','scope','execute','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'];a34_0x3210=function(){return _0xa6e107;};return a34_0x3210();}const a34_0x2afa83=a34_0x747c;(function(_0x247ae5,_0x326b61){const _0xcf521b=a34_0x747c,_0x15dd18=_0x247ae5();while(!![]){try{const _0x3ecfce=parseInt(_0xcf521b(0x1ea))/0x1*(-parseInt(_0xcf521b(0x1de))/0x2)+parseInt(_0xcf521b(0x1ed))/0x3*(parseInt(_0xcf521b(0x1f7))/0x4)+-parseInt(_0xcf521b(0x1df))/0x5*(parseInt(_0xcf521b(0x1e4))/0x6)+parseInt(_0xcf521b(0x1e2))/0x7*(parseInt(_0xcf521b(0x1e0))/0x8)+parseInt(_0xcf521b(0x1ec))/0x9+-parseInt(_0xcf521b(0x1e6))/0xa*(parseInt(_0xcf521b(0x1e5))/0xb)+-parseInt(_0xcf521b(0x1e7))/0xc*(-parseInt(_0xcf521b(0x1eb))/0xd);if(_0x3ecfce===_0x326b61)break;else _0x15dd18['push'](_0x15dd18['shift']());}catch(_0x39acd0){_0x15dd18['push'](_0x15dd18['shift']());}}}(a34_0x3210,0x6122a));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a34_0x747c(_0x45c32b,_0x2f671d){_0x45c32b=_0x45c32b-0x1dd;const _0x3210fc=a34_0x3210();let _0x747cbc=_0x3210fc[_0x45c32b];return _0x747cbc;}import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a34_0xfb031a from'chalk';export class ProfilesCommand extends BaseCommand{[a34_0x2afa83(0x1e9)]='profiles';[a34_0x2afa83(0x1e3)]=a34_0x2afa83(0x1e8);async[a34_0x2afa83(0x1f1)](_0x52fe47){const _0x45b63c=a34_0x2afa83,{options:_0x26e5fb}=_0x52fe47;try{const _0x41c16d=listProfiles(),_0x578db8=getActiveProfile();if(_0x41c16d[_0x45b63c(0x1f9)]===0x0)return console['log'](_0x45b63c(0x1f2)),console[_0x45b63c(0x1f5)]('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console[_0x45b63c(0x1f5)](_0x45b63c(0x1e1)),0x0;const _0x39d867=_0x41c16d[_0x45b63c(0x1f3)](_0x363e11=>{const _0x2f4a0d=_0x45b63c,_0x3c2876=_0x363e11[_0x2f4a0d(0x1e9)]===_0x578db8,_0x20abc8=getProfileParams(_0x363e11[_0x2f4a0d(0x1ee)]);return{'name':_0x363e11['name'],'active':_0x3c2876,'scope':_0x363e11[_0x2f4a0d(0x1f0)],'description':_0x363e11['config']['description']||'','params':_0x20abc8};});if(isStructuredFormat(_0x26e5fb))await handleSDKOutput(_0x39d867,_0x26e5fb);else for(const _0x4ef9a0 of _0x41c16d){const _0x30d027=_0x4ef9a0[_0x45b63c(0x1e9)]===_0x578db8?a34_0xfb031a[_0x45b63c(0x1f8)]('\x20✓'):'',_0x1aa54d=_0x4ef9a0['config'][_0x45b63c(0x1ef)]?a34_0xfb031a['dim']('\x20'+_0x4ef9a0[_0x45b63c(0x1ee)][_0x45b63c(0x1ef)]):'',_0x3cb487=_0x4ef9a0[_0x45b63c(0x1ee)][_0x45b63c(0x1e3)]?a34_0xfb031a['dim']('\x20\x20'+_0x4ef9a0[_0x45b63c(0x1ee)][_0x45b63c(0x1e3)]):'';console['log'](_0x45b63c(0x1f4)+_0x4ef9a0[_0x45b63c(0x1e9)]+_0x30d027+_0x1aa54d+_0x3cb487);}return 0x0;}catch(_0x5d6d9e){return _0x5d6d9e instanceof Error&&console[_0x45b63c(0x1f6)]('Error:\x20'+_0x5d6d9e[_0x45b63c(0x1dd)]),0x1;}}}
@@ -1 +1 @@
1
- const a35_0x3bc2cd=a35_0x4239;(function(_0x341be0,_0x17c9db){const _0x44cc3f=a35_0x4239,_0x1a2e32=_0x341be0();while(!![]){try{const _0x223eb8=parseInt(_0x44cc3f(0x121))/0x1+parseInt(_0x44cc3f(0x10b))/0x2+parseInt(_0x44cc3f(0x100))/0x3*(parseInt(_0x44cc3f(0x119))/0x4)+-parseInt(_0x44cc3f(0x125))/0x5*(parseInt(_0x44cc3f(0x113))/0x6)+parseInt(_0x44cc3f(0x10f))/0x7*(-parseInt(_0x44cc3f(0xfe))/0x8)+-parseInt(_0x44cc3f(0x10d))/0x9+-parseInt(_0x44cc3f(0x117))/0xa;if(_0x223eb8===_0x17c9db)break;else _0x1a2e32['push'](_0x1a2e32['shift']());}catch(_0x16fcf6){_0x1a2e32['push'](_0x1a2e32['shift']());}}}(a35_0x4474,0x7c0cd));function a35_0x4239(_0xce36f8,_0x5e069b){_0xce36f8=_0xce36f8-0xf5;const _0x4474d6=a35_0x4474();let _0x4239cf=_0x4474d6[_0xce36f8];return _0x4239cf;}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';function a35_0x4474(){const _0x5e8c8c=['file','984gaKOYr','setJobId','output','message','7228100xpdIYI','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','4kiQDsx','Schema:\x20','length','site','stats','Run\x20Trino\x20queries\x20(streaming)','setPhase','...','917686yKBodd','\x20-\x20','database','query','5370Muuvqd','error','elapsedTimeMillis','args','catalog','jobId','in\x20','state','name','execute','options','Site:\x20','Executing\x20query\x20[','SQL:\x20','verbose','16Hoczno','completedSplits','2346717zPpcmy','\x0aAll\x20results\x20saved\x20to\x20','Executing\x20query...','push','validate','description','processedRows','information_schema','Statement\x20','Executing\x20statement\x20','\x20splits','912212wgimDu','originalMessage','4058190yKWyap','totalSplits','1043231GEmgwQ','Error:\x20','\x20rows\x20'];a35_0x4474=function(){return _0x5e8c8c;};return a35_0x4474();}import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a35_0x3bc2cd(0xf7)]=a35_0x3bc2cd(0x124);[a35_0x3bc2cd(0x105)]=a35_0x3bc2cd(0x11e);async[a35_0x3bc2cd(0xf8)](_0x3226fb){const _0x5df51b=a35_0x3bc2cd,{options:_0x431e4e,args:_0x2555cf,tdx:_0xb3f22b}=_0x3226fb,_0x29ec03={..._0x431e4e,'limitStructuredFormats':!![]},_0x582496=_0x2555cf[0x0],_0x4493f7=_0x431e4e[_0x5df51b(0x112)];let _0x5dedc3;try{if(_0x4493f7)_0x5dedc3=readSqlStatementsFromFile(_0x4493f7);else{if(_0x582496==='-')_0x5dedc3=await readSqlStatementsFromStdin();else{if(_0x582496&&isSqlFilePath(_0x582496))_0x5dedc3=readSqlStatementsFromFile(_0x582496);else{if(_0x582496)_0x5dedc3=splitSqlStatements(_0x582496);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0xc2e785){return console['error'](_0x5df51b(0x110)+_0xc2e785['message']),0x1;}const _0x1894aa=_0x431e4e[_0x5df51b(0x123)]||_0x5df51b(0x107),_0x370a63=_0x431e4e[_0x5df51b(0x129)];try{const _0x28e6b2=[],_0xaf6af3=!!_0x431e4e[_0x5df51b(0x115)];for(let _0x5a5b48=0x0;_0x5a5b48<_0x5dedc3[_0x5df51b(0x11b)];_0x5a5b48++){const _0x219f47=_0x5dedc3[_0x5a5b48],_0x51d528=_0x5a5b48+0x1,_0x30beb3=_0x5dedc3[_0x5df51b(0x11b)],_0x37f664=_0x30beb3>0x1;_0x431e4e[_0x5df51b(0xfd)]&&(console[_0x5df51b(0x126)]('\x0a'+(_0x37f664?_0x5df51b(0x108)+_0x51d528+'/'+_0x30beb3+':':'')),console[_0x5df51b(0x126)](_0x5df51b(0xfa)+_0x431e4e[_0x5df51b(0x11c)]),console['error']('Catalog:\x20'+(_0x370a63||'td')),console[_0x5df51b(0x126)](_0x5df51b(0x11a)+_0x1894aa),console[_0x5df51b(0x126)](_0x5df51b(0xfc)+_0x219f47));const _0x57ba59=_0x37f664?_0x5df51b(0x109)+_0x51d528+'/'+_0x30beb3+_0x5df51b(0x120):_0x5df51b(0x102);try{const _0x522d76=await withProgressSpinner(_0x57ba59,async _0x1d7aa3=>{const _0x384a56=_0x5df51b,_0x5ae3f3=await _0xb3f22b['query'][_0x384a56(0xf8)](_0x219f47,{'catalog':_0x370a63,'schema':_0x1894aa,'onJobId':_0x2c889b=>{const _0x57c00f=_0x384a56;_0x1d7aa3[_0x57c00f(0x114)](_0x2c889b);},'onProgress':_0xa16c4f=>{const _0x18c2c9=_0x384a56;_0x1d7aa3[_0x18c2c9(0x11f)](_0x18c2c9(0xfb)+_0xa16c4f[_0x18c2c9(0xf6)]+']'),_0x1d7aa3['setExtra'](formatRows(_0xa16c4f[_0x18c2c9(0x106)])+_0x18c2c9(0x111)+_0xa16c4f[_0x18c2c9(0xff)]+'/'+_0xa16c4f[_0x18c2c9(0x10e)]+_0x18c2c9(0x10a));}});return _0x5ae3f3;},{'verbose':_0x431e4e[_0x5df51b(0xfd)]}),_0x4845c5=_0x522d76['data'],_0x1e6563=_0x4845c5[_0x5df51b(0x12a)]?'\x20[Job\x20ID:\x20'+_0x4845c5[_0x5df51b(0x12a)]+']':'',_0x2be8f9=_0x37f664?_0x5df51b(0x108)+_0x51d528+'/'+_0x30beb3+_0x5df51b(0x122):'';console[_0x5df51b(0x126)]('✔\x20'+_0x2be8f9+'Query\x20completed:\x20Processed\x20'+formatRows(_0x4845c5['stats']['processedRows'])+_0x5df51b(0x111)+(_0x5df51b(0xf5)+formatElapsed(_0x4845c5[_0x5df51b(0x11d)][_0x5df51b(0x127)])+_0x1e6563));if(_0x37f664&&_0xaf6af3){const _0xcc6b68=resolveOutputOptions(_0x29ec03),_0x1c45d3=await formatQueryOutput(_0x4845c5,_0xcc6b68);_0x28e6b2[_0x5df51b(0x103)](_0x1c45d3);}else await handleQueryOutput(_0x4845c5,_0x29ec03);}catch(_0x187417){const _0x5b67ca=_0x37f664?'Statement\x20'+_0x51d528+'/'+_0x30beb3+':\x0a':'',_0x56dd57=_0x187417 instanceof SDKError?_0x187417[_0x5df51b(0x10c)]:_0x187417[_0x5df51b(0x116)];return console[_0x5df51b(0x126)](''+_0x5b67ca+_0x56dd57),0x1;}}if(_0x5dedc3[_0x5df51b(0x11b)]>0x1&&_0xaf6af3&&_0x28e6b2[_0x5df51b(0x11b)]>0x0){const _0x17ca5d=_0x28e6b2['join']('\x0a');writeFileSync(_0x431e4e['output'],_0x17ca5d),console[_0x5df51b(0x126)](_0x5df51b(0x101)+_0x431e4e['output']);}return 0x0;}catch(_0x5859d8){throw _0x5859d8;}}[a35_0x3bc2cd(0x104)](_0x12eee0){const _0x3a3e56=a35_0x3bc2cd,_0x4e92d3=_0x12eee0[_0x3a3e56(0x128)][0x0],_0x40568f=_0x12eee0[_0x3a3e56(0xf9)]['file'];if(!_0x4e92d3&&!_0x40568f)return'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';if(_0x4e92d3&&_0x40568f)return _0x3a3e56(0x118);return undefined;}}
1
+ const a35_0x5a9cb0=a35_0x2bba;(function(_0x16074b,_0x570596){const _0x321b65=a35_0x2bba,_0x55fe63=_0x16074b();while(!![]){try{const _0xf4b2ac=-parseInt(_0x321b65(0x136))/0x1+-parseInt(_0x321b65(0x135))/0x2+parseInt(_0x321b65(0x118))/0x3*(parseInt(_0x321b65(0x116))/0x4)+-parseInt(_0x321b65(0x134))/0x5+-parseInt(_0x321b65(0x123))/0x6*(-parseInt(_0x321b65(0x13c))/0x7)+-parseInt(_0x321b65(0x117))/0x8+parseInt(_0x321b65(0x140))/0x9*(parseInt(_0x321b65(0x11e))/0xa);if(_0xf4b2ac===_0x570596)break;else _0x55fe63['push'](_0x55fe63['shift']());}catch(_0xe04d0a){_0x55fe63['push'](_0x55fe63['shift']());}}}(a35_0x2b38,0x65527));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';function a35_0x2bba(_0x416d42,_0xa3d11d){_0x416d42=_0x416d42-0x111;const _0x2b38cc=a35_0x2b38();let _0x2bbaf3=_0x2b38cc[_0x416d42];return _0x2bbaf3;}import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';function a35_0x2b38(){const _0x2b9918=['Site:\x20','14VRdMcN','completedSplits','Schema:\x20','\x20rows\x20','9Mluyre','processedRows','catalog','jobId','validate','state','error','\x20splits','Executing\x20statement\x20','elapsedTimeMillis','\x0aAll\x20results\x20saved\x20to\x20','4wHkYKs','2026984hZfVsV','1490859sYENjS','Statement\x20','\x20-\x20','\x20[Job\x20ID:\x20','name','Executing\x20query...','5928910BifAUP','output','database','originalMessage','in\x20','1635846YVylBj','setJobId','execute','Executing\x20query\x20[','stats','totalSplits','args','Run\x20Trino\x20queries\x20(streaming)','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','setPhase','options','query','push','Catalog:\x20','join','length','SQL:\x20','1884180YooXaQ','197670gbNaob','491067YuTHBx','file','message','...','setExtra'];a35_0x2b38=function(){return _0x2b9918;};return a35_0x2b38();}import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a35_0x5a9cb0(0x11c)]=a35_0x5a9cb0(0x12e);['description']=a35_0x5a9cb0(0x12a);async[a35_0x5a9cb0(0x125)](_0x1f79a8){const _0x4d9d9e=a35_0x5a9cb0,{options:_0x2a2871,args:_0x2bc359,tdx:_0x3ed5bd}=_0x1f79a8,_0xba1287={..._0x2a2871,'limitStructuredFormats':!![]},_0xab1e0b=_0x2bc359[0x0],_0x53c912=_0x2a2871['file'];let _0xf3d1bc;try{if(_0x53c912)_0xf3d1bc=readSqlStatementsFromFile(_0x53c912);else{if(_0xab1e0b==='-')_0xf3d1bc=await readSqlStatementsFromStdin();else{if(_0xab1e0b&&isSqlFilePath(_0xab1e0b))_0xf3d1bc=readSqlStatementsFromFile(_0xab1e0b);else{if(_0xab1e0b)_0xf3d1bc=splitSqlStatements(_0xab1e0b);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x308d5b){return console[_0x4d9d9e(0x111)]('Error:\x20'+_0x308d5b[_0x4d9d9e(0x138)]),0x1;}const _0x236798=_0x2a2871[_0x4d9d9e(0x120)]||'information_schema',_0x963e5f=_0x2a2871[_0x4d9d9e(0x142)];try{const _0x52a294=[],_0x230c08=!!_0x2a2871['output'];for(let _0x2fb524=0x0;_0x2fb524<_0xf3d1bc['length'];_0x2fb524++){const _0x216560=_0xf3d1bc[_0x2fb524],_0x423b47=_0x2fb524+0x1,_0x29ccb8=_0xf3d1bc['length'],_0x3c7569=_0x29ccb8>0x1;_0x2a2871['verbose']&&(console[_0x4d9d9e(0x111)]('\x0a'+(_0x3c7569?_0x4d9d9e(0x119)+_0x423b47+'/'+_0x29ccb8+':':'')),console[_0x4d9d9e(0x111)](_0x4d9d9e(0x13b)+_0x2a2871['site']),console[_0x4d9d9e(0x111)](_0x4d9d9e(0x130)+(_0x963e5f||'td')),console[_0x4d9d9e(0x111)](_0x4d9d9e(0x13e)+_0x236798),console[_0x4d9d9e(0x111)](_0x4d9d9e(0x133)+_0x216560));const _0x371810=_0x3c7569?_0x4d9d9e(0x113)+_0x423b47+'/'+_0x29ccb8+_0x4d9d9e(0x139):_0x4d9d9e(0x11d);try{const _0x1376ff=await withProgressSpinner(_0x371810,async _0x53463e=>{const _0x5790e0=_0x4d9d9e,_0x2223b4=await _0x3ed5bd[_0x5790e0(0x12e)][_0x5790e0(0x125)](_0x216560,{'catalog':_0x963e5f,'schema':_0x236798,'onJobId':_0x20a909=>{const _0x4238b8=_0x5790e0;_0x53463e[_0x4238b8(0x124)](_0x20a909);},'onProgress':_0x2b6f88=>{const _0x202b4d=_0x5790e0;_0x53463e[_0x202b4d(0x12c)](_0x202b4d(0x126)+_0x2b6f88[_0x202b4d(0x145)]+']'),_0x53463e[_0x202b4d(0x13a)](formatRows(_0x2b6f88['processedRows'])+_0x202b4d(0x13f)+_0x2b6f88[_0x202b4d(0x13d)]+'/'+_0x2b6f88[_0x202b4d(0x128)]+_0x202b4d(0x112));}});return _0x2223b4;},{'verbose':_0x2a2871['verbose']}),_0x36a169=_0x1376ff['data'],_0x1c1dfb=_0x36a169[_0x4d9d9e(0x143)]?_0x4d9d9e(0x11b)+_0x36a169[_0x4d9d9e(0x143)]+']':'',_0x8e7c0a=_0x3c7569?_0x4d9d9e(0x119)+_0x423b47+'/'+_0x29ccb8+_0x4d9d9e(0x11a):'';console[_0x4d9d9e(0x111)]('✔\x20'+_0x8e7c0a+'Query\x20completed:\x20Processed\x20'+formatRows(_0x36a169[_0x4d9d9e(0x127)][_0x4d9d9e(0x141)])+_0x4d9d9e(0x13f)+(_0x4d9d9e(0x122)+formatElapsed(_0x36a169[_0x4d9d9e(0x127)][_0x4d9d9e(0x114)])+_0x1c1dfb));if(_0x3c7569&&_0x230c08){const _0x4b6470=resolveOutputOptions(_0xba1287),_0x27400b=await formatQueryOutput(_0x36a169,_0x4b6470);_0x52a294[_0x4d9d9e(0x12f)](_0x27400b);}else await handleQueryOutput(_0x36a169,_0xba1287);}catch(_0x304c5e){const _0x4620df=_0x3c7569?'Statement\x20'+_0x423b47+'/'+_0x29ccb8+':\x0a':'',_0x1cb6a5=_0x304c5e instanceof SDKError?_0x304c5e[_0x4d9d9e(0x121)]:_0x304c5e[_0x4d9d9e(0x138)];return console[_0x4d9d9e(0x111)](''+_0x4620df+_0x1cb6a5),0x1;}}if(_0xf3d1bc[_0x4d9d9e(0x132)]>0x1&&_0x230c08&&_0x52a294[_0x4d9d9e(0x132)]>0x0){const _0x51b669=_0x52a294[_0x4d9d9e(0x131)]('\x0a');writeFileSync(_0x2a2871['output'],_0x51b669),console[_0x4d9d9e(0x111)](_0x4d9d9e(0x115)+_0x2a2871[_0x4d9d9e(0x11f)]);}return 0x0;}catch(_0x12c8b4){throw _0x12c8b4;}}[a35_0x5a9cb0(0x144)](_0x3118d3){const _0x22e10f=a35_0x5a9cb0,_0x48f4aa=_0x3118d3[_0x22e10f(0x129)][0x0],_0x3d9495=_0x3118d3[_0x22e10f(0x12d)][_0x22e10f(0x137)];if(!_0x48f4aa&&!_0x3d9495)return _0x22e10f(0x12b);if(_0x48f4aa&&_0x3d9495)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}
@@ -1 +1 @@
1
- const a36_0x2c6f53=a36_0xf6a2;(function(_0x34f119,_0x562781){const _0x4def47=a36_0xf6a2,_0x19e010=_0x34f119();while(!![]){try{const _0x46b54b=parseInt(_0x4def47(0x159))/0x1+parseInt(_0x4def47(0x199))/0x2*(parseInt(_0x4def47(0x177))/0x3)+-parseInt(_0x4def47(0x15a))/0x4+parseInt(_0x4def47(0x146))/0x5*(parseInt(_0x4def47(0x150))/0x6)+-parseInt(_0x4def47(0x169))/0x7*(parseInt(_0x4def47(0x15c))/0x8)+parseInt(_0x4def47(0x197))/0x9+parseInt(_0x4def47(0x152))/0xa;if(_0x46b54b===_0x562781)break;else _0x19e010['push'](_0x19e010['shift']());}catch(_0x1a78c8){_0x19e010['push'](_0x19e010['shift']());}}}(a36_0x5d83,0x65517));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';function a36_0xf6a2(_0x2672d6,_0x38c02b){_0x2672d6=_0x2672d6-0x10a;const _0x5d8347=a36_0x5d83();let _0xf6a233=_0x5d8347[_0x2672d6];return _0xf6a233;}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_0x4cb819 from'chalk';function formatRelativeTime(_0x1a5e09){const _0x4f8aff=a36_0xf6a2,_0x4d9c91=new Date(_0x1a5e09),_0x2416d3=new Date(),_0xaa5592=_0x4d9c91[_0x4f8aff(0x186)]()-_0x2416d3['getTime'](),_0x55b12c=Math[_0x4f8aff(0x154)](_0xaa5592)/0x3e8,_0xc94fd9=_0xaa5592<0x0;if(_0x55b12c<0x3c)return _0xc94fd9?_0x4f8aff(0x196):'soon';else{if(_0x55b12c<0xe10){const _0x379b88=Math[_0x4f8aff(0x139)](_0x55b12c/0x3c);return _0xc94fd9?_0x379b88+_0x4f8aff(0x13d):_0x4f8aff(0x117)+_0x379b88+'m';}else{if(_0x55b12c<0x15180){const _0x313d0e=Math['round'](_0x55b12c/0xe10);return _0xc94fd9?_0x313d0e+'h\x20ago':_0x4f8aff(0x117)+_0x313d0e+'h';}else{if(_0x55b12c<0x93a80){const _0x2e03ad=Math[_0x4f8aff(0x139)](_0x55b12c/0x15180);return _0xc94fd9?_0x2e03ad+'d\x20ago':'in\x20'+_0x2e03ad+'d';}else return _0x4d9c91[_0x4f8aff(0x13c)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x2c6f53(0x16c)]=a36_0x2c6f53(0x18a);['description']=a36_0x2c6f53(0x161);async[a36_0x2c6f53(0x13f)](_0xc2b53d){const _0x4015cb=a36_0x2c6f53,{options:_0x33e071,args:_0x4c0010,tdx:_0x58e5ed}=_0xc2b53d,_0x24d59b=resolveLimit(_0x33e071[_0x4015cb(0x10f)],DEFAULT_DISPLAY_LIMIT),_0x18cb37=_0x4c0010[0x0],_0x114215=_0x18cb37?_0x4015cb(0x192)+_0x18cb37+_0x4015cb(0x19c):_0x4015cb(0x19a),_0x491361=await withSpinner(_0x114215,()=>_0x58e5ed[_0x4015cb(0x142)][_0x4015cb(0x17b)]({'limit':_0x24d59b,'scheduled':!![],'pattern':_0x18cb37}),{'verbose':_0x33e071['verbose']}),_0x4ecb09=_0x491361[_0x4015cb(0x160)]['queries'],_0x2685d7=_0x491361[_0x4015cb(0x160)][_0x4015cb(0x112)][_0x4015cb(0x194)],_0x35d93a=_0x18cb37?_0x4015cb(0x10c)+_0x18cb37+'\x22':'';_0x2685d7?console[_0x4015cb(0x13b)](_0x4015cb(0x15b)+_0x4ecb09[_0x4015cb(0x166)]+_0x4015cb(0x137)+_0x35d93a+'\x20(use\x20--limit\x20to\x20see\x20more)'):console['error']('Found\x20'+_0x4ecb09[_0x4015cb(0x166)]+_0x4015cb(0x10e)+(_0x4ecb09['length']!==0x1?'ies':'y')+_0x35d93a);if(_0x33e071['format']===_0x4015cb(0x118)||_0x33e071[_0x4015cb(0x18f)]===_0x4015cb(0x134)||_0x33e071[_0x4015cb(0x18f)]===_0x4015cb(0x18b)||_0x33e071['format']===_0x4015cb(0x18c)){const _0x4e4883=_0x4ecb09[_0x4015cb(0x17e)](_0xbd0ac8=>({'id':_0xbd0ac8['id'],'name':_0xbd0ac8[_0x4015cb(0x16c)],'cron':_0xbd0ac8[_0x4015cb(0x16e)],'database':_0xbd0ac8[_0x4015cb(0x129)]?.['name'],'type':_0xbd0ac8[_0x4015cb(0x172)],'timezone':_0xbd0ac8[_0x4015cb(0x136)],'user_name':_0xbd0ac8[_0x4015cb(0x11e)]?.['name'],'updated_at':_0xbd0ac8[_0x4015cb(0x168)],'next_run_at':_0xbd0ac8['next_run_at'],'last_job_status':_0xbd0ac8[_0x4015cb(0x14f)]?.[_0x4015cb(0x124)]}));await handleSDKOutput(_0x4e4883,_0x33e071);}else{if(_0x4ecb09[_0x4015cb(0x166)]===0x0)console['log'](_0x4015cb(0x143));else{const _0x254a69=_0x33e071[_0x4015cb(0x155)],_0x336baa=_0x4ecb09[_0x4015cb(0x17e)](_0xc28834=>{const _0x1eb9a9=_0x4015cb,_0x4007c3=_0xc28834[_0x1eb9a9(0x14f)]?.[_0x1eb9a9(0x124)]?_0xc28834[_0x1eb9a9(0x14f)]['status']===_0x1eb9a9(0x181)?'✓':'✗':'-',_0x4f542c=_0xc28834[_0x1eb9a9(0x14f)]?.[_0x1eb9a9(0x10b)]?formatRelativeTime(_0xc28834['last_job'][_0x1eb9a9(0x10b)]):_0x1eb9a9(0x13e),_0xb82664=_0xc28834['next_run_at']?formatRelativeTime(_0xc28834[_0x1eb9a9(0x17a)]):'-',_0x422b5a=_0xc28834[_0x1eb9a9(0x16e)]||'',_0x89a438=_0xc28834[_0x1eb9a9(0x16c)]||_0x1eb9a9(0x148),_0x57d959=getConsoleUrl(_0x254a69,_0x1eb9a9(0x11b)+_0xc28834['id']);return{'statusIcon':_0x4007c3,'lastRun':_0x4f542c,'nextRun':_0xb82664,'cron':_0x422b5a,'name':_0x89a438,'queryUrl':_0x57d959,'status':_0xc28834[_0x1eb9a9(0x14f)]?.[_0x1eb9a9(0x124)]};}),_0xfcd95f=Math[_0x4015cb(0x110)](..._0x336baa[_0x4015cb(0x17e)](_0x5cd9c5=>_0x5cd9c5[_0x4015cb(0x16b)][_0x4015cb(0x166)])),_0x34178c=Math[_0x4015cb(0x110)](..._0x336baa['map'](_0x2ee08a=>_0x2ee08a[_0x4015cb(0x12c)][_0x4015cb(0x166)])),_0x203fc1=Math[_0x4015cb(0x110)](..._0x336baa[_0x4015cb(0x17e)](_0x4c14e6=>_0x4c14e6[_0x4015cb(0x16e)][_0x4015cb(0x166)])),_0x5e7ea7=_0x336baa[_0x4015cb(0x17e)](_0x59f277=>{const _0x1c45f2=_0x4015cb,_0x3b2ba6=_0x59f277['status']==='success'?a36_0x4cb819[_0x1c45f2(0x173)](_0x59f277['statusIcon']):_0x59f277['status']===_0x1c45f2(0x13b)?a36_0x4cb819[_0x1c45f2(0x141)](_0x59f277[_0x1c45f2(0x184)]):a36_0x4cb819[_0x1c45f2(0x17c)](_0x59f277[_0x1c45f2(0x184)]),_0x1d37e2=_0x59f277[_0x1c45f2(0x16b)][_0x1c45f2(0x188)](_0xfcd95f),_0x105c17=_0x59f277[_0x1c45f2(0x12c)][_0x1c45f2(0x188)](_0x34178c),_0x46f176=_0x59f277['cron']?a36_0x4cb819[_0x1c45f2(0x17d)](_0x59f277[_0x1c45f2(0x16e)][_0x1c45f2(0x188)](_0x203fc1)):'\x20'[_0x1c45f2(0x16a)](_0x203fc1),_0x43411c=hyperlink(_0x59f277[_0x1c45f2(0x16c)],_0x59f277[_0x1c45f2(0x16d)]);return'📅\x20'+_0x3b2ba6+'\x20'+_0x1d37e2+'\x20\x20→\x20'+_0x105c17+'\x20\x20'+_0x46f176+'\x20\x20'+_0x43411c;});await writeOutput(_0x5e7ea7[_0x4015cb(0x156)]('\x0a'),_0x33e071[_0x4015cb(0x12d)],_0x4015cb(0x11c));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a36_0x2c6f53(0x16c)]=a36_0x2c6f53(0x128);['description']=a36_0x2c6f53(0x114);['validate'](_0x1e1871){const _0x3f633c=a36_0x2c6f53,_0x1fe18e=_0x1e1871[_0x3f633c(0x16f)][0x0];if(!_0x1fe18e)return _0x3f633c(0x14c);return undefined;}async[a36_0x2c6f53(0x13f)](_0x298fce){const _0x322115=a36_0x2c6f53,{options:_0x1a0906,args:_0x197be4,tdx:_0x53f0eb}=_0x298fce,_0x5d59c9=_0x197be4[0x0],_0x943ecf=await withSpinner(_0x322115(0x162),()=>_0x53f0eb['schedules'][_0x322115(0x190)](_0x5d59c9),{'verbose':_0x1a0906['verbose']}),_0x2211bd=_0x943ecf[_0x322115(0x160)],_0x47d9f4={'name':_0x2211bd['name'],'cron':_0x2211bd[_0x322115(0x16e)],'database':_0x2211bd[_0x322115(0x129)],'type':_0x2211bd[_0x322115(0x172)],'timezone':_0x2211bd[_0x322115(0x157)],'user_name':_0x2211bd[_0x322115(0x12b)],'created_at':_0x2211bd[_0x322115(0x15d)],'engine_version':_0x2211bd[_0x322115(0x10a)],'executing_user_id':_0x2211bd[_0x322115(0x179)],'query':_0x2211bd[_0x322115(0x113)],'delay':_0x2211bd[_0x322115(0x151)],'priority':_0x2211bd[_0x322115(0x11d)],'retry_limit':_0x2211bd[_0x322115(0x187)],..._0x2211bd[_0x322115(0x144)]&&{'result':_0x2211bd['result']}};return await handleSingleObjectOutput(_0x47d9f4,_0x1a0906),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']=a36_0x2c6f53(0x153);['description']=a36_0x2c6f53(0x140);[a36_0x2c6f53(0x17f)](_0x3636db){const _0x2e0d95=a36_0x2c6f53,_0x688070=_0x3636db[_0x2e0d95(0x16f)][0x0];if(!_0x688070)return _0x2e0d95(0x182);const _0x41aee0=_0x3636db[_0x2e0d95(0x164)];if(!_0x41aee0[_0x2e0d95(0x129)])return _0x2e0d95(0x193);return undefined;}async[a36_0x2c6f53(0x13f)](_0x45254f){const _0x3b4f4b=a36_0x2c6f53,{options:_0x456a2f,args:_0x56863d,tdx:_0x119a52}=_0x45254f,_0x350ba1=_0x56863d[0x0],_0x373a39=_0x456a2f,_0x3dd6bb=_0x373a39[_0x3b4f4b(0x129)],_0x11610=_0x373a39[_0x3b4f4b(0x135)],_0x4e6591=_0x373a39['type']||'trino';let _0x349fff;try{_0x349fff=readFileSync(_0x11610,_0x3b4f4b(0x195))['trim']();}catch(_0x535b8e){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20read\x20file:\x20'+_0x11610,_0x535b8e instanceof Error?_0x535b8e:undefined);}if(!_0x349fff)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x3b4f4b(0x130));const _0x5970b8={'database':_0x3dd6bb,'query':_0x349fff,'type':_0x4e6591};if(_0x373a39['cron'])_0x5970b8['cron']=_0x373a39[_0x3b4f4b(0x16e)];if(_0x373a39[_0x3b4f4b(0x157)])_0x5970b8[_0x3b4f4b(0x157)]=_0x373a39['timezone'];if(_0x373a39[_0x3b4f4b(0x151)]!==undefined)_0x5970b8['delay']=Number(_0x373a39[_0x3b4f4b(0x151)]);if(_0x373a39['priority']!==undefined)_0x5970b8[_0x3b4f4b(0x11d)]=Number(_0x373a39[_0x3b4f4b(0x11d)]);if(_0x373a39['retryLimit']!==undefined)_0x5970b8['retry_limit']=Number(_0x373a39[_0x3b4f4b(0x170)]);if(_0x373a39['engineVersion'])_0x5970b8[_0x3b4f4b(0x10a)]=_0x373a39['engineVersion'];if(_0x373a39['result'])_0x5970b8['result']=_0x373a39[_0x3b4f4b(0x144)];if(_0x456a2f[_0x3b4f4b(0x174)]){console['error'](_0x3b4f4b(0x126)+_0x350ba1),console['error'](_0x3b4f4b(0x121)+_0x3dd6bb),console[_0x3b4f4b(0x13b)](_0x3b4f4b(0x111)+_0x4e6591);if(_0x5970b8[_0x3b4f4b(0x16e)])console['error'](_0x3b4f4b(0x14a)+_0x5970b8[_0x3b4f4b(0x16e)]);if(_0x5970b8['timezone'])console[_0x3b4f4b(0x13b)](_0x3b4f4b(0x138)+_0x5970b8['timezone']);}const _0x4da759=await withSpinner(_0x3b4f4b(0x163),()=>_0x119a52[_0x3b4f4b(0x142)][_0x3b4f4b(0x198)](_0x350ba1,_0x5970b8),{'verbose':_0x456a2f[_0x3b4f4b(0x174)]});return console[_0x3b4f4b(0x13b)](_0x3b4f4b(0x18e)+_0x4da759[_0x3b4f4b(0x160)][_0x3b4f4b(0x16c)]),await handleSingleObjectOutput(_0x4da759['data'],_0x456a2f),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x2c6f53(0x16c)]=a36_0x2c6f53(0x14e);[a36_0x2c6f53(0x176)]=a36_0x2c6f53(0x171);[a36_0x2c6f53(0x17f)](_0x3d863b){const _0x463685=a36_0x2c6f53,_0x40096a=_0x3d863b['args'][0x0];if(!_0x40096a)return _0x463685(0x147);return undefined;}async[a36_0x2c6f53(0x13f)](_0x580fa6){const _0x15bb66=a36_0x2c6f53,{options:_0x41e477,args:_0x4e4a1a,tdx:_0x419ff1}=_0x580fa6,_0xdd49e6=_0x4e4a1a[0x0],_0xd403b9=_0x41e477,_0x1413e1={};if(_0xd403b9['database'])_0x1413e1['database']=_0xd403b9['database'];if(_0xd403b9[_0x15bb66(0x172)])_0x1413e1['type']=_0xd403b9[_0x15bb66(0x172)];if(_0xd403b9[_0x15bb66(0x16e)])_0x1413e1[_0x15bb66(0x16e)]=_0xd403b9[_0x15bb66(0x16e)];if(_0xd403b9['timezone'])_0x1413e1[_0x15bb66(0x157)]=_0xd403b9[_0x15bb66(0x157)];if(_0xd403b9[_0x15bb66(0x151)]!==undefined)_0x1413e1['delay']=Number(_0xd403b9[_0x15bb66(0x151)]);if(_0xd403b9['priority']!==undefined)_0x1413e1[_0x15bb66(0x11d)]=Number(_0xd403b9[_0x15bb66(0x11d)]);if(_0xd403b9[_0x15bb66(0x170)]!==undefined)_0x1413e1['retry_limit']=Number(_0xd403b9[_0x15bb66(0x170)]);if(_0xd403b9['engineVersion'])_0x1413e1[_0x15bb66(0x10a)]=_0xd403b9[_0x15bb66(0x116)];if(_0xd403b9[_0x15bb66(0x144)])_0x1413e1[_0x15bb66(0x144)]=_0xd403b9[_0x15bb66(0x144)];if(_0xd403b9['file'])try{_0x1413e1[_0x15bb66(0x113)]=readFileSync(_0xd403b9[_0x15bb66(0x135)],_0x15bb66(0x195))[_0x15bb66(0x183)]();}catch(_0x12936c){throw new SDKError(ErrorCode[_0x15bb66(0x13a)],_0x15bb66(0x175)+_0xd403b9[_0x15bb66(0x135)],_0x12936c instanceof Error?_0x12936c:undefined);}if(Object['keys'](_0x1413e1)[_0x15bb66(0x166)]===0x0)throw new SDKError(ErrorCode[_0x15bb66(0x13a)],_0x15bb66(0x132));if(_0x41e477[_0x15bb66(0x174)]){console[_0x15bb66(0x13b)](_0x15bb66(0x185)+_0xdd49e6);for(const [_0x4d2d31,_0x37b247]of Object[_0x15bb66(0x12e)](_0x1413e1)){_0x4d2d31===_0x15bb66(0x113)?console[_0x15bb66(0x13b)]('\x20\x20'+_0x4d2d31+':\x20'+_0x37b247[_0x15bb66(0x191)](0x0,0x32)+_0x15bb66(0x133)):console[_0x15bb66(0x13b)]('\x20\x20'+_0x4d2d31+':\x20'+_0x37b247);}}const _0x200c8e=await withSpinner(_0x15bb66(0x131),()=>_0x419ff1['schedules'][_0x15bb66(0x149)](_0xdd49e6,_0x1413e1),{'verbose':_0x41e477[_0x15bb66(0x174)]});return console[_0x15bb66(0x13b)](_0x15bb66(0x119)+_0x200c8e[_0x15bb66(0x160)][_0x15bb66(0x16c)]),await handleSingleObjectOutput(_0x200c8e[_0x15bb66(0x160)],_0x41e477),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a36_0x2c6f53(0x16c)]='schedule:delete';['description']=a36_0x2c6f53(0x115);[a36_0x2c6f53(0x17f)](_0x3893ff){const _0x29bb0f=_0x3893ff['args'][0x0];if(!_0x29bb0f)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async[a36_0x2c6f53(0x13f)](_0x5a0041){const _0x42cdb4=a36_0x2c6f53,{options:_0x3b4d21,args:_0x58f587,tdx:_0x44f1be}=_0x5a0041,_0x3c98d4=_0x58f587[0x0];if(!_0x3b4d21['yes']){const _0x73a402=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22'+_0x3c98d4+'\x22?');if(!_0x73a402)return console[_0x42cdb4(0x13b)](_0x42cdb4(0x127)),0x0;}const _0xe8300d=await withSpinner(_0x42cdb4(0x158),()=>_0x44f1be['schedules'][_0x42cdb4(0x15f)](_0x3c98d4),{'verbose':_0x3b4d21[_0x42cdb4(0x174)]});return console[_0x42cdb4(0x13b)](_0x42cdb4(0x178)+_0xe8300d[_0x42cdb4(0x160)]['name']),0x0;}}function a36_0x5d83(){const _0x8091d1=['12IrifOs','delay','6456330TEJGLJ','schedule:create','abs','site','join','timezone','Deleting\x20schedule...','221662eYTAxS','2873700UIMnfQ','Showing\x20first\x20','8QwXNrl','created_at','Found\x20','delete','data','List\x20scheduled\x20queries','Getting\x20schedule\x20details...','Creating\x20schedule...','options','\x20\x20Job\x20ID:\x20','length','from','updated_at','3224669tqRIji','repeat','lastRun','name','queryUrl','cron','args','retryLimit','Update\x20a\x20scheduled\x20query','type','green','verbose','Failed\x20to\x20read\x20file:\x20','description','994035uqBQHC','Schedule\x20deleted:\x20','executing_user_id','next_run_at','listQueries','dim','cyan','map','validate','\x20\x20Num:\x20','success','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','trim','statusIcon','Updating\x20schedule:\x20','getTime','retry_limit','padEnd','\x20job','schedule:list','table','tsv','\x20\x20Time:\x20','Schedule\x20created:\x20','format','show','substring','Searching\x20scheduled\x20queries\x20matching\x20\x22','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','has_next_page','utf-8','just\x20now','3396861nPVOXP','create','2LXYivu','Listing\x20scheduled\x20queries...','count','\x22...','engine_version','ended_at','\x20matching\x20\x22','schedule:run','\x20scheduled\x20quer','limit','max','\x20\x20Type:\x20','pagination','query','Show\x20schedule\x20details','Delete\x20a\x20scheduled\x20query','engineVersion','in\x20','json','Schedule\x20updated:\x20','job_id','/app/queries/editor?queryId=','list','priority','user','\x20created','\x20execution','\x20\x20Database:\x20','schedule:history','run','status','history','Creating\x20schedule:\x20','Cancelled','schedule:show','database','time','user_name','nextRun','output','entries','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','Query\x20file\x20is\x20empty','Updating\x20schedule...','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','...','jsonl','file','time_zone','\x20schedules','\x20\x20Timezone:\x20','round','INVALID_ARGUMENT','error','toLocaleDateString','m\x20ago','never','execute','Create\x20a\x20scheduled\x20query','red','schedules','No\x20scheduled\x20queries\x20found','result','Show\x20schedule\x20execution\x20history','45055OfJCiI','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','(unnamed)','update','\x20\x20Cron:\x20','Running\x20schedule...','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','num','schedule:update','last_job'];a36_0x5d83=function(){return _0x8091d1;};return a36_0x5d83();}export class ScheduleRunCommand extends BaseCommand{[a36_0x2c6f53(0x16c)]=a36_0x2c6f53(0x10d);[a36_0x2c6f53(0x176)]='Run\x20a\x20scheduled\x20query\x20immediately';[a36_0x2c6f53(0x17f)](_0x39c186){const _0x3b43ed=_0x39c186['args'][0x0];if(!_0x3b43ed)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async['execute'](_0x37c02e){const _0x561a4b=a36_0x2c6f53,{options:_0x4d7db2,args:_0x1ddc69,tdx:_0xbd060b}=_0x37c02e,_0x645a5=_0x1ddc69[0x0],_0x2e866b=_0x4d7db2,_0x352948=_0x2e866b[_0x561a4b(0x12a)],_0x1ca525=_0x2e866b['num']!==undefined?Number(_0x2e866b[_0x561a4b(0x14d)]):undefined;if(_0x4d7db2[_0x561a4b(0x174)]){console[_0x561a4b(0x13b)]('Running\x20schedule:\x20'+_0x645a5);if(_0x352948)console[_0x561a4b(0x13b)](_0x561a4b(0x18d)+_0x352948);if(_0x1ca525)console[_0x561a4b(0x13b)](_0x561a4b(0x180)+_0x1ca525);}const _0xcabb73=await withSpinner(_0x561a4b(0x14b),()=>_0xbd060b[_0x561a4b(0x142)][_0x561a4b(0x123)](_0x645a5,{'time':_0x352948,'num':_0x1ca525}),{'verbose':_0x4d7db2[_0x561a4b(0x174)]}),_0x17afe8=_0xcabb73[_0x561a4b(0x160)]['jobs'];console['error']('Schedule\x20run\x20submitted:\x20'+_0x17afe8[_0x561a4b(0x166)]+_0x561a4b(0x189)+(_0x17afe8[_0x561a4b(0x166)]!==0x1?'s':'')+_0x561a4b(0x11f));for(const _0x565040 of _0x17afe8){console[_0x561a4b(0x13b)](_0x561a4b(0x165)+_0x565040[_0x561a4b(0x11a)]);}return await handleSDKOutput(_0x17afe8,_0x4d7db2),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{['name']=a36_0x2c6f53(0x122);[a36_0x2c6f53(0x176)]=a36_0x2c6f53(0x145);[a36_0x2c6f53(0x17f)](_0x495204){const _0x152358=a36_0x2c6f53,_0x55ca23=_0x495204[_0x152358(0x16f)][0x0];if(!_0x55ca23)return _0x152358(0x12f);return undefined;}async[a36_0x2c6f53(0x13f)](_0x3aac13){const _0x14303b=a36_0x2c6f53,{options:_0x24239f,args:_0xe14bce,tdx:_0x2486bc}=_0x3aac13,_0x3480e7=_0xe14bce[0x0],_0x5c9f92=_0x24239f,_0x4d415a=_0x5c9f92[_0x14303b(0x167)]!==undefined?Number(_0x5c9f92['from']):undefined,_0x39d79e=_0x5c9f92['to']!==undefined?Number(_0x5c9f92['to']):undefined,_0x3f53ee=await withSpinner('Getting\x20schedule\x20history...',()=>_0x2486bc[_0x14303b(0x142)][_0x14303b(0x125)](_0x3480e7,{'from':_0x4d415a,'to':_0x39d79e}),{'verbose':_0x24239f[_0x14303b(0x174)]}),_0x2f5870=_0x3f53ee[_0x14303b(0x160)];console[_0x14303b(0x13b)](_0x14303b(0x15e)+_0x2f5870[_0x14303b(0x19b)]+_0x14303b(0x120)+(_0x2f5870[_0x14303b(0x19b)]!==0x1?'s':'')+'\x20(showing\x20'+_0x2f5870['from']+'-'+_0x2f5870['to']+')');const _0x13f8d4=_0x2f5870[_0x14303b(0x125)][_0x14303b(0x17e)](_0x2c4f57=>({'job_id':_0x2c4f57[_0x14303b(0x11a)],'type':_0x2c4f57['type'],'status':_0x2c4f57[_0x14303b(0x124)],'scheduled_at':_0x2c4f57['scheduled_at'],'created_at':_0x2c4f57['created_at'],'start_at':_0x2c4f57['start_at'],'end_at':_0x2c4f57['end_at']}));return await handleSDKOutput(_0x13f8d4,_0x24239f),0x0;}}
1
+ const a36_0x4e077d=a36_0x3d19;(function(_0x201a46,_0x1923b6){const _0x19a269=a36_0x3d19,_0x330a8d=_0x201a46();while(!![]){try{const _0x44f2c4=-parseInt(_0x19a269(0x19b))/0x1*(parseInt(_0x19a269(0x1dd))/0x2)+-parseInt(_0x19a269(0x196))/0x3+parseInt(_0x19a269(0x19e))/0x4*(-parseInt(_0x19a269(0x1c3))/0x5)+-parseInt(_0x19a269(0x1ee))/0x6+-parseInt(_0x19a269(0x17c))/0x7+parseInt(_0x19a269(0x19d))/0x8+-parseInt(_0x19a269(0x1f1))/0x9*(-parseInt(_0x19a269(0x192))/0xa);if(_0x44f2c4===_0x1923b6)break;else _0x330a8d['push'](_0x330a8d['shift']());}catch(_0x6d0150){_0x330a8d['push'](_0x330a8d['shift']());}}}(a36_0x4868,0x20b93));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';function a36_0x3d19(_0x5c2e7c,_0x3a3b18){_0x5c2e7c=_0x5c2e7c-0x179;const _0x486855=a36_0x4868();let _0x3d1929=_0x486855[_0x5c2e7c];return _0x3d1929;}import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a36_0x4fd8ef from'chalk';function formatRelativeTime(_0x3063b7){const _0xc62267=a36_0x3d19,_0x58ca8a=new Date(_0x3063b7),_0x19c082=new Date(),_0x25993c=_0x58ca8a[_0xc62267(0x1e9)]()-_0x19c082['getTime'](),_0x4fa89b=Math[_0xc62267(0x18f)](_0x25993c)/0x3e8,_0x392aa0=_0x25993c<0x0;if(_0x4fa89b<0x3c)return _0x392aa0?_0xc62267(0x188):_0xc62267(0x201);else{if(_0x4fa89b<0xe10){const _0x225bee=Math['round'](_0x4fa89b/0x3c);return _0x392aa0?_0x225bee+_0xc62267(0x1b2):'in\x20'+_0x225bee+'m';}else{if(_0x4fa89b<0x15180){const _0x1c6597=Math[_0xc62267(0x1ef)](_0x4fa89b/0xe10);return _0x392aa0?_0x1c6597+_0xc62267(0x190):_0xc62267(0x1f6)+_0x1c6597+'h';}else{if(_0x4fa89b<0x93a80){const _0x559efb=Math[_0xc62267(0x1ef)](_0x4fa89b/0x15180);return _0x392aa0?_0x559efb+_0xc62267(0x189):'in\x20'+_0x559efb+'d';}else return _0x58ca8a[_0xc62267(0x1ae)]();}}}}export class ScheduleListCommand extends BaseCommand{[a36_0x4e077d(0x1c5)]=a36_0x4e077d(0x1f8);[a36_0x4e077d(0x1f4)]=a36_0x4e077d(0x1a3);async[a36_0x4e077d(0x1cb)](_0x1e1d47){const _0x492d63=a36_0x4e077d,{options:_0x3c46ad,args:_0x316909,tdx:_0x497ae9}=_0x1e1d47,_0x50d1bf=resolveLimit(_0x3c46ad[_0x492d63(0x1a5)],DEFAULT_DISPLAY_LIMIT),_0x43654e=_0x316909[0x0],_0x57ddc0=_0x43654e?'Searching\x20scheduled\x20queries\x20matching\x20\x22'+_0x43654e+_0x492d63(0x1ac):_0x492d63(0x1df),_0x114608=await withSpinner(_0x57ddc0,()=>_0x497ae9[_0x492d63(0x1f2)]['listQueries']({'limit':_0x50d1bf,'scheduled':!![],'pattern':_0x43654e}),{'verbose':_0x3c46ad['verbose']}),_0x3cd2b5=_0x114608['data'][_0x492d63(0x1c8)],_0x1df3f6=_0x114608['data'][_0x492d63(0x1d8)][_0x492d63(0x19a)],_0x1fdc54=_0x43654e?_0x492d63(0x1c9)+_0x43654e+'\x22':'';_0x1df3f6?console[_0x492d63(0x1f3)](_0x492d63(0x1fe)+_0x3cd2b5[_0x492d63(0x1e4)]+_0x492d63(0x19c)+_0x1fdc54+_0x492d63(0x187)):console[_0x492d63(0x1f3)](_0x492d63(0x206)+_0x3cd2b5['length']+_0x492d63(0x1b7)+(_0x3cd2b5[_0x492d63(0x1e4)]!==0x1?_0x492d63(0x1d2):'y')+_0x1fdc54);if(_0x3c46ad['format']===_0x492d63(0x1a8)||_0x3c46ad[_0x492d63(0x203)]===_0x492d63(0x1f5)||_0x3c46ad[_0x492d63(0x203)]===_0x492d63(0x1c6)||_0x3c46ad[_0x492d63(0x203)]===_0x492d63(0x1ea)){const _0x1dc4a6=_0x3cd2b5[_0x492d63(0x181)](_0x418212=>({'id':_0x418212['id'],'name':_0x418212[_0x492d63(0x1c5)],'cron':_0x418212[_0x492d63(0x20a)],'database':_0x418212[_0x492d63(0x1cc)]?.[_0x492d63(0x1c5)],'type':_0x418212[_0x492d63(0x20b)],'timezone':_0x418212[_0x492d63(0x194)],'user_name':_0x418212[_0x492d63(0x1fc)]?.[_0x492d63(0x1c5)],'updated_at':_0x418212[_0x492d63(0x202)],'next_run_at':_0x418212['next_run_at'],'last_job_status':_0x418212[_0x492d63(0x18e)]?.[_0x492d63(0x1cd)]}));await handleSDKOutput(_0x1dc4a6,_0x3c46ad);}else{if(_0x3cd2b5[_0x492d63(0x1e4)]===0x0)console[_0x492d63(0x1a7)](_0x492d63(0x1b3));else{const _0x101f7f=_0x3c46ad[_0x492d63(0x1ba)],_0x2d5163=_0x3cd2b5[_0x492d63(0x181)](_0x4e2e85=>{const _0x22209f=_0x492d63,_0x172072=_0x4e2e85[_0x22209f(0x18e)]?.[_0x22209f(0x1cd)]?_0x4e2e85[_0x22209f(0x18e)][_0x22209f(0x1cd)]===_0x22209f(0x18d)?'✓':'✗':'-',_0x466705=_0x4e2e85[_0x22209f(0x18e)]?.[_0x22209f(0x1e3)]?formatRelativeTime(_0x4e2e85[_0x22209f(0x18e)][_0x22209f(0x1e3)]):_0x22209f(0x1f0),_0x4a5e10=_0x4e2e85[_0x22209f(0x1e1)]?formatRelativeTime(_0x4e2e85['next_run_at']):'-',_0x4d896a=_0x4e2e85[_0x22209f(0x20a)]||'',_0xc7555d=_0x4e2e85['name']||_0x22209f(0x1da),_0x1cf2b9=getConsoleUrl(_0x101f7f,_0x22209f(0x1b5)+_0x4e2e85['id']);return{'statusIcon':_0x172072,'lastRun':_0x466705,'nextRun':_0x4a5e10,'cron':_0x4d896a,'name':_0xc7555d,'queryUrl':_0x1cf2b9,'status':_0x4e2e85[_0x22209f(0x18e)]?.[_0x22209f(0x1cd)]};}),_0x5c129e=Math[_0x492d63(0x1ca)](..._0x2d5163[_0x492d63(0x181)](_0x350b04=>_0x350b04[_0x492d63(0x18c)]['length'])),_0x5af4c0=Math[_0x492d63(0x1ca)](..._0x2d5163[_0x492d63(0x181)](_0x507f82=>_0x507f82[_0x492d63(0x1af)][_0x492d63(0x1e4)])),_0x17747f=Math['max'](..._0x2d5163[_0x492d63(0x181)](_0x159109=>_0x159109['cron']['length'])),_0x13c66a=_0x2d5163[_0x492d63(0x181)](_0x278274=>{const _0x51a001=_0x492d63,_0x3bad5d=_0x278274[_0x51a001(0x1cd)]===_0x51a001(0x18d)?a36_0x4fd8ef['green'](_0x278274[_0x51a001(0x1ff)]):_0x278274['status']===_0x51a001(0x1f3)?a36_0x4fd8ef[_0x51a001(0x1fb)](_0x278274[_0x51a001(0x1ff)]):a36_0x4fd8ef[_0x51a001(0x1e5)](_0x278274['statusIcon']),_0x167788=_0x278274[_0x51a001(0x18c)]['padEnd'](_0x5c129e),_0x19e797=_0x278274[_0x51a001(0x1af)][_0x51a001(0x1c7)](_0x5af4c0),_0x2a06ef=_0x278274[_0x51a001(0x20a)]?a36_0x4fd8ef['cyan'](_0x278274[_0x51a001(0x20a)][_0x51a001(0x1c7)](_0x17747f)):'\x20'[_0x51a001(0x185)](_0x17747f),_0x4a321c=hyperlink(_0x278274[_0x51a001(0x1c5)],_0x278274[_0x51a001(0x198)]);return'📅\x20'+_0x3bad5d+'\x20'+_0x167788+'\x20\x20→\x20'+_0x19e797+'\x20\x20'+_0x2a06ef+'\x20\x20'+_0x4a321c;});await writeOutput(_0x13c66a[_0x492d63(0x1b9)]('\x0a'),_0x3c46ad[_0x492d63(0x1f7)],_0x492d63(0x191));}}return 0x0;}}function a36_0x4868(){const _0x4a7bde=['180294WuYPty','args','queryUrl','\x20\x20Database:\x20','has_next_page','19570XtEwDT','\x20schedules','1925080nQqrWV','232LjFYkl','delay','retry_limit','job_id','priority','List\x20scheduled\x20queries','update','limit','history','log','json','Update\x20a\x20scheduled\x20query','schedule:delete','Delete\x20a\x20scheduled\x20query','\x22...','retryLimit','toLocaleDateString','nextRun','schedule:show','utf-8','m\x20ago','No\x20scheduled\x20queries\x20found','Query\x20file\x20is\x20empty','/app/queries/editor?queryId=','Getting\x20schedule\x20history...','\x20scheduled\x20quer','created_at','join','site','data','\x20\x20Time:\x20','delete','schedule:run','Failed\x20to\x20read\x20file:\x20','INVALID_ARGUMENT','schedule:create','result','18680OfKLoL','timezone','name','table','padEnd','queries','\x20matching\x20\x22','max','execute','database','status','Getting\x20schedule\x20details...','Schedule\x20run\x20submitted:\x20','verbose','schedule:update','ies','\x20created','trim','yes','Updating\x20schedule:\x20','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','pagination','entries','(unnamed)','show','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','16ZUthkn','count','Listing\x20scheduled\x20queries...','engine_version','next_run_at','schedule:history','ended_at','length','dim','Updating\x20schedule...','file','\x20\x20Type:\x20','getTime','tsv','executing_user_id','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','...','164664CWDVpW','round','never','1562607EHUSgv','schedules','error','description','jsonl','in\x20','output','schedule:list','Create\x20a\x20scheduled\x20query','\x20\x20Cron:\x20','red','user','\x20job','Showing\x20first\x20','statusIcon','Cancelled','soon','updated_at','format','\x20(showing\x20','\x20\x20Timezone:\x20','Found\x20','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','trino','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','cron','type','Show\x20schedule\x20details','create','\x20execution','1166753SdcovV','scheduled_at','Creating\x20schedule:\x20','user_name','from','map','validate','num','engineVersion','repeat','query','\x20(use\x20--limit\x20to\x20see\x20more)','just\x20now','d\x20ago','run','Schedule\x20updated:\x20','lastRun','success','last_job','abs','h\x20ago','list','30ydDiII','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','time_zone','Run\x20a\x20scheduled\x20query\x20immediately'];a36_0x4868=function(){return _0x4a7bde;};return a36_0x4868();}export class ScheduleShowCommand extends BaseCommand{['name']=a36_0x4e077d(0x1b0);[a36_0x4e077d(0x1f4)]=a36_0x4e077d(0x179);[a36_0x4e077d(0x182)](_0x35af74){const _0x4a2596=a36_0x4e077d,_0x5ae548=_0x35af74[_0x4a2596(0x197)][0x0];if(!_0x5ae548)return _0x4a2596(0x209);return undefined;}async[a36_0x4e077d(0x1cb)](_0x68c1af){const _0xa9ed7e=a36_0x4e077d,{options:_0x3ff8e1,args:_0x41d372,tdx:_0x1d68ae}=_0x68c1af,_0x10cac5=_0x41d372[0x0],_0x2404ea=await withSpinner(_0xa9ed7e(0x1ce),()=>_0x1d68ae['schedules'][_0xa9ed7e(0x1db)](_0x10cac5),{'verbose':_0x3ff8e1[_0xa9ed7e(0x1d0)]}),_0x5c7d97=_0x2404ea['data'],_0x52e999={'name':_0x5c7d97[_0xa9ed7e(0x1c5)],'cron':_0x5c7d97[_0xa9ed7e(0x20a)],'database':_0x5c7d97[_0xa9ed7e(0x1cc)],'type':_0x5c7d97[_0xa9ed7e(0x20b)],'timezone':_0x5c7d97[_0xa9ed7e(0x1c4)],'user_name':_0x5c7d97[_0xa9ed7e(0x17f)],'created_at':_0x5c7d97[_0xa9ed7e(0x1b8)],'engine_version':_0x5c7d97['engine_version'],'executing_user_id':_0x5c7d97[_0xa9ed7e(0x1eb)],'query':_0x5c7d97[_0xa9ed7e(0x186)],'delay':_0x5c7d97[_0xa9ed7e(0x19f)],'priority':_0x5c7d97[_0xa9ed7e(0x1a2)],'retry_limit':_0x5c7d97[_0xa9ed7e(0x1a0)],..._0x5c7d97[_0xa9ed7e(0x1c2)]&&{'result':_0x5c7d97['result']}};return await handleSingleObjectOutput(_0x52e999,_0x3ff8e1),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']=a36_0x4e077d(0x1c1);[a36_0x4e077d(0x1f4)]=a36_0x4e077d(0x1f9);[a36_0x4e077d(0x182)](_0x2bf1f7){const _0x26f7ea=a36_0x4e077d,_0x10a832=_0x2bf1f7[_0x26f7ea(0x197)][0x0];if(!_0x10a832)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';const _0x8eff03=_0x2bf1f7['options'];if(!_0x8eff03[_0x26f7ea(0x1cc)])return _0x26f7ea(0x1d7);return undefined;}async[a36_0x4e077d(0x1cb)](_0x4b4e54){const _0x37b025=a36_0x4e077d,{options:_0x2d2a33,args:_0x42069f,tdx:_0x43c117}=_0x4b4e54,_0x5aa7ab=_0x42069f[0x0],_0x1a1d51=_0x2d2a33,_0x20dc7d=_0x1a1d51[_0x37b025(0x1cc)],_0x119c13=_0x1a1d51[_0x37b025(0x1e7)],_0x4b267a=_0x1a1d51[_0x37b025(0x20b)]||_0x37b025(0x208);let _0x1595dc;try{_0x1595dc=readFileSync(_0x119c13,_0x37b025(0x1b1))[_0x37b025(0x1d4)]();}catch(_0xe001e2){throw new SDKError(ErrorCode[_0x37b025(0x1c0)],_0x37b025(0x1bf)+_0x119c13,_0xe001e2 instanceof Error?_0xe001e2:undefined);}if(!_0x1595dc)throw new SDKError(ErrorCode[_0x37b025(0x1c0)],_0x37b025(0x1b4));const _0x28bf1a={'database':_0x20dc7d,'query':_0x1595dc,'type':_0x4b267a};if(_0x1a1d51['cron'])_0x28bf1a[_0x37b025(0x20a)]=_0x1a1d51[_0x37b025(0x20a)];if(_0x1a1d51[_0x37b025(0x1c4)])_0x28bf1a['timezone']=_0x1a1d51[_0x37b025(0x1c4)];if(_0x1a1d51[_0x37b025(0x19f)]!==undefined)_0x28bf1a[_0x37b025(0x19f)]=Number(_0x1a1d51[_0x37b025(0x19f)]);if(_0x1a1d51[_0x37b025(0x1a2)]!==undefined)_0x28bf1a[_0x37b025(0x1a2)]=Number(_0x1a1d51[_0x37b025(0x1a2)]);if(_0x1a1d51[_0x37b025(0x1ad)]!==undefined)_0x28bf1a[_0x37b025(0x1a0)]=Number(_0x1a1d51[_0x37b025(0x1ad)]);if(_0x1a1d51[_0x37b025(0x184)])_0x28bf1a['engine_version']=_0x1a1d51['engineVersion'];if(_0x1a1d51[_0x37b025(0x1c2)])_0x28bf1a[_0x37b025(0x1c2)]=_0x1a1d51[_0x37b025(0x1c2)];if(_0x2d2a33['verbose']){console[_0x37b025(0x1f3)](_0x37b025(0x17e)+_0x5aa7ab),console[_0x37b025(0x1f3)](_0x37b025(0x199)+_0x20dc7d),console[_0x37b025(0x1f3)](_0x37b025(0x1e8)+_0x4b267a);if(_0x28bf1a[_0x37b025(0x20a)])console[_0x37b025(0x1f3)](_0x37b025(0x1fa)+_0x28bf1a[_0x37b025(0x20a)]);if(_0x28bf1a[_0x37b025(0x1c4)])console[_0x37b025(0x1f3)](_0x37b025(0x205)+_0x28bf1a[_0x37b025(0x1c4)]);}const _0x2a1673=await withSpinner('Creating\x20schedule...',()=>_0x43c117[_0x37b025(0x1f2)][_0x37b025(0x17a)](_0x5aa7ab,_0x28bf1a),{'verbose':_0x2d2a33['verbose']});return console[_0x37b025(0x1f3)]('Schedule\x20created:\x20'+_0x2a1673['data'][_0x37b025(0x1c5)]),await handleSingleObjectOutput(_0x2a1673[_0x37b025(0x1bb)],_0x2d2a33),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a36_0x4e077d(0x1c5)]=a36_0x4e077d(0x1d1);[a36_0x4e077d(0x1f4)]=a36_0x4e077d(0x1a9);[a36_0x4e077d(0x182)](_0x23f6b3){const _0xf32e6d=a36_0x4e077d,_0x260962=_0x23f6b3['args'][0x0];if(!_0x260962)return _0xf32e6d(0x1ec);return undefined;}async['execute'](_0x347dfe){const _0xf60789=a36_0x4e077d,{options:_0x2ad03d,args:_0x476bbd,tdx:_0x37ed64}=_0x347dfe,_0xed0ca8=_0x476bbd[0x0],_0x10d2da=_0x2ad03d,_0x3dfe86={};if(_0x10d2da[_0xf60789(0x1cc)])_0x3dfe86[_0xf60789(0x1cc)]=_0x10d2da[_0xf60789(0x1cc)];if(_0x10d2da['type'])_0x3dfe86[_0xf60789(0x20b)]=_0x10d2da[_0xf60789(0x20b)];if(_0x10d2da[_0xf60789(0x20a)])_0x3dfe86[_0xf60789(0x20a)]=_0x10d2da[_0xf60789(0x20a)];if(_0x10d2da[_0xf60789(0x1c4)])_0x3dfe86[_0xf60789(0x1c4)]=_0x10d2da[_0xf60789(0x1c4)];if(_0x10d2da[_0xf60789(0x19f)]!==undefined)_0x3dfe86[_0xf60789(0x19f)]=Number(_0x10d2da[_0xf60789(0x19f)]);if(_0x10d2da['priority']!==undefined)_0x3dfe86['priority']=Number(_0x10d2da['priority']);if(_0x10d2da[_0xf60789(0x1ad)]!==undefined)_0x3dfe86[_0xf60789(0x1a0)]=Number(_0x10d2da[_0xf60789(0x1ad)]);if(_0x10d2da[_0xf60789(0x184)])_0x3dfe86[_0xf60789(0x1e0)]=_0x10d2da[_0xf60789(0x184)];if(_0x10d2da[_0xf60789(0x1c2)])_0x3dfe86[_0xf60789(0x1c2)]=_0x10d2da[_0xf60789(0x1c2)];if(_0x10d2da[_0xf60789(0x1e7)])try{_0x3dfe86[_0xf60789(0x186)]=readFileSync(_0x10d2da[_0xf60789(0x1e7)],_0xf60789(0x1b1))[_0xf60789(0x1d4)]();}catch(_0x4db4f6){throw new SDKError(ErrorCode[_0xf60789(0x1c0)],'Failed\x20to\x20read\x20file:\x20'+_0x10d2da['file'],_0x4db4f6 instanceof Error?_0x4db4f6:undefined);}if(Object['keys'](_0x3dfe86)[_0xf60789(0x1e4)]===0x0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update');if(_0x2ad03d[_0xf60789(0x1d0)]){console[_0xf60789(0x1f3)](_0xf60789(0x1d6)+_0xed0ca8);for(const [_0x1b1f7a,_0x362e38]of Object[_0xf60789(0x1d9)](_0x3dfe86)){_0x1b1f7a===_0xf60789(0x186)?console[_0xf60789(0x1f3)]('\x20\x20'+_0x1b1f7a+':\x20'+_0x362e38['substring'](0x0,0x32)+_0xf60789(0x1ed)):console[_0xf60789(0x1f3)]('\x20\x20'+_0x1b1f7a+':\x20'+_0x362e38);}}const _0x317ab9=await withSpinner(_0xf60789(0x1e6),()=>_0x37ed64[_0xf60789(0x1f2)][_0xf60789(0x1a4)](_0xed0ca8,_0x3dfe86),{'verbose':_0x2ad03d[_0xf60789(0x1d0)]});return console[_0xf60789(0x1f3)](_0xf60789(0x18b)+_0x317ab9['data'][_0xf60789(0x1c5)]),await handleSingleObjectOutput(_0x317ab9['data'],_0x2ad03d),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{['name']=a36_0x4e077d(0x1aa);['description']=a36_0x4e077d(0x1ab);['validate'](_0x106561){const _0x16903e=a36_0x4e077d,_0xe2d4f6=_0x106561[_0x16903e(0x197)][0x0];if(!_0xe2d4f6)return _0x16903e(0x193);return undefined;}async[a36_0x4e077d(0x1cb)](_0x21503a){const _0x1e4cda=a36_0x4e077d,{options:_0x45885a,args:_0x329b74,tdx:_0x56189c}=_0x21503a,_0x431dd9=_0x329b74[0x0];if(!_0x45885a[_0x1e4cda(0x1d5)]){const _0x34b9c9=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22'+_0x431dd9+'\x22?');if(!_0x34b9c9)return console['error'](_0x1e4cda(0x200)),0x0;}const _0x38f785=await withSpinner('Deleting\x20schedule...',()=>_0x56189c[_0x1e4cda(0x1f2)][_0x1e4cda(0x1bd)](_0x431dd9),{'verbose':_0x45885a[_0x1e4cda(0x1d0)]});return console['error']('Schedule\x20deleted:\x20'+_0x38f785[_0x1e4cda(0x1bb)][_0x1e4cda(0x1c5)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a36_0x4e077d(0x1c5)]=a36_0x4e077d(0x1be);[a36_0x4e077d(0x1f4)]=a36_0x4e077d(0x195);['validate'](_0x41830b){const _0x88cb7d=a36_0x4e077d,_0x31af7d=_0x41830b[_0x88cb7d(0x197)][0x0];if(!_0x31af7d)return _0x88cb7d(0x1dc);return undefined;}async[a36_0x4e077d(0x1cb)](_0x423d40){const _0x596c99=a36_0x4e077d,{options:_0x5370e5,args:_0x2c54e1,tdx:_0x4c6dee}=_0x423d40,_0x51c195=_0x2c54e1[0x0],_0x9561b5=_0x5370e5,_0x12e6f3=_0x9561b5['time'],_0x2e238d=_0x9561b5[_0x596c99(0x183)]!==undefined?Number(_0x9561b5['num']):undefined;if(_0x5370e5[_0x596c99(0x1d0)]){console[_0x596c99(0x1f3)]('Running\x20schedule:\x20'+_0x51c195);if(_0x12e6f3)console[_0x596c99(0x1f3)](_0x596c99(0x1bc)+_0x12e6f3);if(_0x2e238d)console[_0x596c99(0x1f3)]('\x20\x20Num:\x20'+_0x2e238d);}const _0x4bb430=await withSpinner('Running\x20schedule...',()=>_0x4c6dee[_0x596c99(0x1f2)][_0x596c99(0x18a)](_0x51c195,{'time':_0x12e6f3,'num':_0x2e238d}),{'verbose':_0x5370e5[_0x596c99(0x1d0)]}),_0x1d3947=_0x4bb430[_0x596c99(0x1bb)]['jobs'];console[_0x596c99(0x1f3)](_0x596c99(0x1cf)+_0x1d3947[_0x596c99(0x1e4)]+_0x596c99(0x1fd)+(_0x1d3947['length']!==0x1?'s':'')+_0x596c99(0x1d3));for(const _0x504772 of _0x1d3947){console[_0x596c99(0x1f3)]('\x20\x20Job\x20ID:\x20'+_0x504772[_0x596c99(0x1a1)]);}return await handleSDKOutput(_0x1d3947,_0x5370e5),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{['name']=a36_0x4e077d(0x1e2);['description']='Show\x20schedule\x20execution\x20history';[a36_0x4e077d(0x182)](_0x912f1c){const _0x43f3f6=a36_0x4e077d,_0x21dd8a=_0x912f1c[_0x43f3f6(0x197)][0x0];if(!_0x21dd8a)return _0x43f3f6(0x207);return undefined;}async[a36_0x4e077d(0x1cb)](_0xfe947a){const _0x4afd4d=a36_0x4e077d,{options:_0x2303db,args:_0xfdca32,tdx:_0xd9248a}=_0xfe947a,_0x19fa90=_0xfdca32[0x0],_0x78016b=_0x2303db,_0x468782=_0x78016b[_0x4afd4d(0x180)]!==undefined?Number(_0x78016b['from']):undefined,_0x3ce464=_0x78016b['to']!==undefined?Number(_0x78016b['to']):undefined,_0x5ddc5d=await withSpinner(_0x4afd4d(0x1b6),()=>_0xd9248a[_0x4afd4d(0x1f2)][_0x4afd4d(0x1a6)](_0x19fa90,{'from':_0x468782,'to':_0x3ce464}),{'verbose':_0x2303db[_0x4afd4d(0x1d0)]}),_0x2ac45d=_0x5ddc5d[_0x4afd4d(0x1bb)];console[_0x4afd4d(0x1f3)](_0x4afd4d(0x206)+_0x2ac45d[_0x4afd4d(0x1de)]+_0x4afd4d(0x17b)+(_0x2ac45d[_0x4afd4d(0x1de)]!==0x1?'s':'')+_0x4afd4d(0x204)+_0x2ac45d[_0x4afd4d(0x180)]+'-'+_0x2ac45d['to']+')');const _0x31bd5e=_0x2ac45d[_0x4afd4d(0x1a6)]['map'](_0x387e8f=>({'job_id':_0x387e8f['job_id'],'type':_0x387e8f[_0x4afd4d(0x20b)],'status':_0x387e8f[_0x4afd4d(0x1cd)],'scheduled_at':_0x387e8f[_0x4afd4d(0x17d)],'created_at':_0x387e8f['created_at'],'start_at':_0x387e8f['start_at'],'end_at':_0x387e8f['end_at']}));return await handleSDKOutput(_0x31bd5e,_0x2303db),0x0;}}
@@ -1 +1 @@
1
- const a37_0x4fd039=a37_0x42cd;(function(_0x1a7e58,_0x4a9920){const _0x2a49db=a37_0x42cd,_0xf01113=_0x1a7e58();while(!![]){try{const _0x313996=parseInt(_0x2a49db(0x1f3))/0x1+parseInt(_0x2a49db(0x277))/0x2*(-parseInt(_0x2a49db(0x251))/0x3)+parseInt(_0x2a49db(0x1ef))/0x4*(parseInt(_0x2a49db(0x1e4))/0x5)+-parseInt(_0x2a49db(0x247))/0x6*(-parseInt(_0x2a49db(0x212))/0x7)+-parseInt(_0x2a49db(0x281))/0x8+-parseInt(_0x2a49db(0x216))/0x9*(parseInt(_0x2a49db(0x211))/0xa)+parseInt(_0x2a49db(0x261))/0xb;if(_0x313996===_0x4a9920)break;else _0xf01113['push'](_0xf01113['shift']());}catch(_0x3f38d6){_0xf01113['push'](_0xf01113['shift']());}}}(a37_0x368d,0x2e05d));function a37_0x42cd(_0x1ec99c,_0x87b3ab){_0x1ec99c=_0x1ec99c-0x1e2;const _0x368d34=a37_0x368d();let _0x42cd69=_0x368d34[_0x1ec99c];return _0x42cd69;}import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0x5b3ea4 from'chalk';async function resolveSegmentTarget(_0x5dbc48,_0x407ecc,_0x516cfd){const _0x1ab8d3=a37_0x42cd;if(isYamlFilePath(_0x5dbc48))try{const _0x42c0c5=await resolveYamlFilePath(_0x5dbc48);return _0x516cfd&&(console[_0x1ab8d3(0x213)](_0x1ab8d3(0x27b)+_0x5dbc48),console[_0x1ab8d3(0x213)]('\x20\x20Parent\x20segment:\x20'+_0x42c0c5[_0x1ab8d3(0x26c)]),console[_0x1ab8d3(0x213)](_0x1ab8d3(0x1e3)+_0x42c0c5['segmentName']),console[_0x1ab8d3(0x213)](_0x1ab8d3(0x1ee)+(_0x42c0c5[_0x1ab8d3(0x25c)]||_0x1ab8d3(0x201))),console['error'](_0x1ab8d3(0x26e)+_0x42c0c5[_0x1ab8d3(0x20f)])),_0x42c0c5[_0x1ab8d3(0x20f)];}catch(_0x4c278a){throw new SDKError(ErrorCode[_0x1ab8d3(0x1e5)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x4c278a[_0x1ab8d3(0x271)]);}if(!_0x407ecc)throw new SDKError(ErrorCode[_0x1ab8d3(0x1e5)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x407ecc+'/'+_0x5dbc48;}export class SegmentDescribeCommand extends BaseCommand{['name']='segment:describe';['description']=a37_0x4fd039(0x257);async[a37_0x4fd039(0x1f8)](_0x186b58){const _0x4d62f1=a37_0x4fd039,{options:_0xe5f005,args:_0x48d937,tdx:_0x509760}=_0x186b58,_0x1b7b48=_0x48d937[0x0],_0x411ec2=!_0x1b7b48&&!!_0xe5f005[_0x4d62f1(0x26c)],_0x2b28a0=_0x1b7b48||_0xe5f005['parentSegment'];if(!_0x2b28a0)return console[_0x4d62f1(0x213)](_0x4d62f1(0x267)),console[_0x4d62f1(0x213)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console['error'](_0x4d62f1(0x282)),console['error']('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console[_0x4d62f1(0x213)](_0x4d62f1(0x244)),console[_0x4d62f1(0x213)](_0x4d62f1(0x25e)),console[_0x4d62f1(0x213)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0x33f92b=_0xe5f005[_0x4d62f1(0x23a)];let _0x362039=_0x2b28a0;!_0x411ec2&&_0x33f92b&&!_0x2b28a0[_0x4d62f1(0x207)]('/')&&(_0x362039=_0x33f92b+'/'+_0x2b28a0,_0xe5f005['verbose']&&console[_0x4d62f1(0x213)]('Resolved\x20relative\x20path\x20to:\x20'+_0x362039));const _0x297934=await withSpinner(_0x4d62f1(0x259)+_0x362039+_0x4d62f1(0x258),()=>_0x509760[_0x4d62f1(0x222)][_0x4d62f1(0x233)](_0x362039),{'verbose':_0xe5f005[_0x4d62f1(0x230)]}),_0x462f56=_0x297934['data'];_0xe5f005[_0x4d62f1(0x230)]&&(console[_0x4d62f1(0x213)](_0x4d62f1(0x221)+_0x462f56[_0x4d62f1(0x263)]),console[_0x4d62f1(0x213)](_0x4d62f1(0x273)+_0x462f56[_0x4d62f1(0x1fd)]),_0x462f56[_0x4d62f1(0x1f6)]&&console[_0x4d62f1(0x213)](_0x4d62f1(0x228)+_0x462f56[_0x4d62f1(0x1f6)]),_0x462f56[_0x4d62f1(0x217)]&&console[_0x4d62f1(0x213)](_0x4d62f1(0x240)+_0x462f56['segmentId']));if(_0x462f56[_0x4d62f1(0x263)]===_0x4d62f1(0x26f)){const _0x5be9ef=await withSpinner(_0x4d62f1(0x264),()=>_0x509760[_0x4d62f1(0x222)][_0x4d62f1(0x21b)](_0x462f56[_0x4d62f1(0x1fd)]),{'verbose':_0xe5f005[_0x4d62f1(0x230)]});await handleSingleObjectOutput(_0x5be9ef[_0x4d62f1(0x260)],_0xe5f005);}else{if(_0x462f56[_0x4d62f1(0x263)]===_0x4d62f1(0x1e9)){if(!_0x462f56['folderId'])throw new SDKError(ErrorCode[_0x4d62f1(0x283)],_0x4d62f1(0x25d));const _0x4bd26e=await withSpinner('Fetching\x20folder\x20details...',()=>_0x509760[_0x4d62f1(0x222)][_0x4d62f1(0x220)](_0x462f56[_0x4d62f1(0x1f6)]),{'verbose':_0xe5f005[_0x4d62f1(0x230)]});await handleSingleObjectOutput(_0x4bd26e['data'],_0xe5f005);}else{if(_0x462f56[_0x4d62f1(0x263)]==='segment'){if(!_0x462f56[_0x4d62f1(0x217)])throw new SDKError(ErrorCode[_0x4d62f1(0x234)],_0x4d62f1(0x1fc));const _0x5cbf61=await withSpinner(_0x4d62f1(0x208),()=>_0x509760[_0x4d62f1(0x222)][_0x4d62f1(0x238)](_0x462f56[_0x4d62f1(0x1fd)],_0x462f56[_0x4d62f1(0x217)]),{'verbose':_0xe5f005[_0x4d62f1(0x230)]});await handleSingleObjectOutput(_0x5cbf61[_0x4d62f1(0x260)],_0xe5f005);}}}return 0x0;}catch(_0xfbe52c){if(_0xfbe52c instanceof SDKError)return console[_0x4d62f1(0x213)](_0x4d62f1(0x204)+_0xfbe52c[_0x4d62f1(0x271)]),_0xfbe52c[_0x4d62f1(0x20e)]&&console[_0x4d62f1(0x213)](_0x4d62f1(0x236)+_0xfbe52c[_0x4d62f1(0x20e)]),0x1;throw _0xfbe52c;}}}export class SegmentShowCommand extends BaseCommand{['name']=a37_0x4fd039(0x276);[a37_0x4fd039(0x210)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a37_0x4fd039(0x1f8)](_0x4dffd8){const _0x4906ca=a37_0x4fd039,{options:_0x1c1583,args:_0x5d7645,tdx:_0x32c225}=_0x4dffd8,_0x2c8b4d=_0x5d7645[0x0];if(!_0x2c8b4d)return console[_0x4906ca(0x213)](_0x4906ca(0x1ed)),console[_0x4906ca(0x213)](_0x4906ca(0x21c)),console[_0x4906ca(0x213)](_0x4906ca(0x1f5)),console[_0x4906ca(0x213)](_0x4906ca(0x282)),console[_0x4906ca(0x213)](_0x4906ca(0x272)),console[_0x4906ca(0x213)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x57a738=_0x1c1583[_0x4906ca(0x26c)],_0x400db9=await resolveSegmentTarget(_0x2c8b4d,_0x57a738,_0x1c1583[_0x4906ca(0x230)]);_0x1c1583['verbose']&&console[_0x4906ca(0x213)](_0x4906ca(0x25a)+_0x400db9);const _0x313219=await withSpinner(_0x4906ca(0x1e8)+_0x2c8b4d+'\x27...',()=>_0x32c225['segment'][_0x4906ca(0x233)](_0x400db9),{'verbose':_0x1c1583[_0x4906ca(0x230)]}),_0x460b4f=_0x313219['data'];_0x1c1583[_0x4906ca(0x230)]&&(console['error']('Resolved\x20type:\x20'+_0x460b4f[_0x4906ca(0x263)]),console[_0x4906ca(0x213)]('Parent\x20ID:\x20'+_0x460b4f[_0x4906ca(0x1fd)]));if(_0x460b4f['type']===_0x4906ca(0x1e9))return console['error']('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0x4906ca(0x213)](_0x4906ca(0x1f7)),0x1;if(_0x460b4f['type']===_0x4906ca(0x26f))return console[_0x4906ca(0x213)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x4906ca(0x213)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x460b4f[_0x4906ca(0x217)])throw new SDKError(ErrorCode[_0x4906ca(0x234)],_0x4906ca(0x1fc));const _0x4be243=await withSpinner(_0x4906ca(0x1fe),()=>_0x32c225[_0x4906ca(0x222)]['getSegmentSQL'](_0x460b4f['parentId'],_0x460b4f[_0x4906ca(0x217)]),{'verbose':_0x1c1583[_0x4906ca(0x230)]});let _0x66f28f=_0x4be243[_0x4906ca(0x260)];const _0x36ab68=resolveLimit(_0x1c1583[_0x4906ca(0x253)],DEFAULT_DISPLAY_LIMIT),_0x4d20b1=/\bLIMIT\s+\d+/i[_0x4906ca(0x27f)](_0x66f28f);!_0x4d20b1&&(_0x66f28f=_0x66f28f[_0x4906ca(0x22c)]()[_0x4906ca(0x21a)](/;+$/,''),_0x66f28f=_0x4906ca(0x20d)+_0x66f28f+_0x4906ca(0x27e)+_0x36ab68);_0x1c1583[_0x4906ca(0x230)]&&console[_0x4906ca(0x213)]('SQL\x20query:\x0a'+_0x66f28f);const _0x5c6899=await withProgressSpinner('Executing\x20segment\x20query...',async _0x6baf8e=>{const _0x50ae59=_0x4906ca,_0x4afcbd=await _0x32c225[_0x50ae59(0x21e)][_0x50ae59(0x1f8)](_0x66f28f,{'catalog':'td','schema':_0x50ae59(0x22e),'onJobId':_0xb6c41a=>{const _0x158a8b=_0x50ae59;_0x6baf8e[_0x158a8b(0x23e)](_0xb6c41a);}});return _0x4afcbd;},{'verbose':_0x1c1583[_0x4906ca(0x230)]}),_0x36a9da=_0x5c6899['data'],_0x131fc2=_0x36a9da[_0x4906ca(0x246)]?_0x4906ca(0x279)+_0x36a9da[_0x4906ca(0x246)]+']':'';return console[_0x4906ca(0x213)](_0x4906ca(0x284)+_0x36a9da[_0x4906ca(0x24b)][_0x4906ca(0x1f4)]['toLocaleString']()+'\x20rows\x20'+(_0x4906ca(0x1ea)+formatElapsed(_0x36a9da[_0x4906ca(0x24b)][_0x4906ca(0x275)])+_0x131fc2)),await handleQueryOutput(_0x36a9da,_0x1c1583),0x0;}catch(_0x52887c){if(_0x52887c instanceof SDKError)return console[_0x4906ca(0x213)](_0x4906ca(0x1fa)+_0x52887c[_0x4906ca(0x1e7)]+']'),console[_0x4906ca(0x213)]('\x0a'+_0x52887c['message']),0x1;throw _0x52887c;}}}function a37_0x368d(){const _0x586a6b=['Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','Get\x20SQL\x20query\x20for\x20child\x20segment','\x20\x20tdx\x20sg\x20sql\x20--path\x20','setJobId','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','Segment\x20ID:\x20','Resolving\x20parent\x20folder\x20\x27','segment:folder:list','Creating\x20folder\x20\x27','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Site:\x20','jobId','18EFxAHb','Show\x20child\x20segment\x20schema\x20(column\x20types)','json','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','stats','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','resolveFolderId','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','segmentName','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','1038YPfKDC','getSegmentSQLFromYaml','limit','Resolving\x20parent\x20segment\x20\x27','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Show\x20segment\x20or\x20folder\x20details','\x27...','Resolving\x20path\x20\x27','Target\x20path:\x20','getSQLFromYamlFile','folderPath','Folder\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','data','663619fZVLTS','✔\x20Found\x20','type','Fetching\x20parent\x20segment\x20details...','url','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Error:\x20Path\x20or\x20name\x20is\x20required','segment:view','Folder\x20name:\x20','path','segment:folder:create','parentSegment','length','\x20\x20Full\x20path:\x20','parent','site','message','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Parent\x20ID:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','elapsedTimeMillis','segment:show','142OAtnoq','jsonl','\x20[Job\x20ID:\x20','Error:\x20Folder\x20reference\x20is\x20required','Resolved\x20YAML\x20file:\x20','Parent\x20name:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','test','Resolving\x20folder\x20\x27','82624sYRKRd','Examples:','SEGMENT_FOLDER_NOT_FOUND','✔\x20Query\x20completed:\x20Processed\x20','listFolders','\x20\x20Segment\x20name:\x20','5bfsDPH','INVALID_ARGUMENT','Show\x20segment\x20folder\x20details','code','Resolving\x20\x27','folder','in\x20','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Resolved\x20folder\x20ID:\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20Folder\x20path:\x20','1001908gHwhFl','Use:\x20tdx\x20ps\x20view','name','parentFolder','35406qpsoOK','processedRows','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','folderId','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','execute','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','✖\x20Query\x20failed\x20[','segment:sql','Segment\x20ID\x20missing\x20from\x20resolved\x20path','parentId','Fetching\x20SQL\x20for\x20segment...','Use:\x20tdx\x20ps\x20desc','web','(root)','Options:','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Error:\x20','Usage:','red','includes','Fetching\x20segment\x20details...','log','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','getSegmentSQL','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','SELECT\x20*\x20FROM\x20(\x0a','cause','fullPath','description','3419470kAezsH','511322aCJOkt','error','content','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','9UdUyOl','segmentId','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Create\x20segment\x20folder\x20for\x20organization','replace','getParent','Usage:\x20tdx\x20sg\x20show\x20<name>','format','query','Parent\x20segment:\x20','getFolder','Resolved\x20type:\x20','segment','segment:desc','resolveParentId','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','\x27\x20with\x20ID:\x20','Usage:\x20tdx\x20sg\x20desc\x20<name>','Folder\x20ID:\x20','segment:folder:show','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','trim','green','information_schema','/e/','verbose','Fetching\x20folder\x20\x27','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','resolvePathToResource','SEGMENT_NOT_FOUND','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','\x20\x20Cause:\x20','Resolved\x20parent\x20ID:\x20','getSegment','/app/ps/','segmentPath'];a37_0x368d=function(){return _0x586a6b;};return a37_0x368d();}export class SegmentFolderListCommand extends BaseCommand{['name']=a37_0x4fd039(0x242);[a37_0x4fd039(0x210)]=a37_0x4fd039(0x215);async[a37_0x4fd039(0x1f8)](_0x1e3ff2){const _0x2a8196=a37_0x4fd039,{options:_0x12ba07,args:_0x1e6e72,tdx:_0x5c3af0}=_0x1e3ff2;if(_0x1e6e72['length']===0x0)return console[_0x2a8196(0x213)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x2a8196(0x213)](_0x2a8196(0x266)),0x1;const _0xf7da39=_0x1e6e72[0x0];try{_0x12ba07[_0x2a8196(0x230)]&&(console['error'](_0x2a8196(0x245)+_0x12ba07['site']),console[_0x2a8196(0x213)]('Parent\x20name:\x20'+_0xf7da39));const _0x424f2d=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0xf7da39+'\x27...',()=>_0x5c3af0['segment'][_0x2a8196(0x224)](_0xf7da39),{'verbose':_0x12ba07[_0x2a8196(0x230)]}),_0x59bf3e=_0x424f2d[_0x2a8196(0x260)];_0x12ba07[_0x2a8196(0x230)]&&console[_0x2a8196(0x213)](_0x2a8196(0x237)+_0x59bf3e);const _0xb6331f=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0xf7da39+_0x2a8196(0x258),()=>_0x5c3af0['segment'][_0x2a8196(0x1e2)](_0x59bf3e),{'verbose':_0x12ba07[_0x2a8196(0x230)]}),_0x437005=_0xb6331f['data'];return console[_0x2a8196(0x213)](_0x2a8196(0x262)+_0x437005[_0x2a8196(0x26d)]+'\x20folder'+(_0x437005[_0x2a8196(0x26d)]!==0x1?'s':'')),await handleSDKOutput(_0x437005,_0x12ba07),0x0;}catch(_0x3db393){if(_0x3db393 instanceof SDKError)return console[_0x2a8196(0x213)](_0x2a8196(0x204)+_0x3db393[_0x2a8196(0x271)]),_0x3db393['cause']&&console[_0x2a8196(0x213)](_0x2a8196(0x236)+_0x3db393[_0x2a8196(0x20e)]),0x1;throw _0x3db393;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x4fd039(0x1f1)]=a37_0x4fd039(0x229);[a37_0x4fd039(0x210)]=a37_0x4fd039(0x1e6);async[a37_0x4fd039(0x1f8)](_0x46ea38){const _0x48e3c6=a37_0x4fd039,{options:_0x895333,args:_0x3b7d2f,tdx:_0x5734bc}=_0x46ea38;if(_0x3b7d2f['length']===0x0)return console['error'](_0x48e3c6(0x27a)),console[_0x48e3c6(0x213)](_0x48e3c6(0x25f)),0x1;try{const {parentId:_0x2b1bc2,childId:_0x34f279}=parseSegmentRef(_0x3b7d2f[0x0]);_0x895333['verbose']&&(console[_0x48e3c6(0x213)]('Site:\x20'+_0x895333[_0x48e3c6(0x270)]),console['error'](_0x48e3c6(0x27c)+_0x2b1bc2),_0x34f279&&console[_0x48e3c6(0x213)](_0x48e3c6(0x269)+_0x34f279));if(!_0x34f279)return console[_0x48e3c6(0x213)](_0x48e3c6(0x203)),0x1;const _0x3dc1bc=await withSpinner(_0x48e3c6(0x254)+_0x2b1bc2+_0x48e3c6(0x258),()=>_0x5734bc[_0x48e3c6(0x222)][_0x48e3c6(0x224)](_0x2b1bc2),{'verbose':_0x895333[_0x48e3c6(0x230)]}),_0x169b9c=_0x3dc1bc[_0x48e3c6(0x260)];_0x895333[_0x48e3c6(0x230)]&&console[_0x48e3c6(0x213)]('Resolved\x20parent\x20ID:\x20'+_0x169b9c);const _0x9d3d65=await withSpinner(_0x48e3c6(0x280)+_0x34f279+'\x27...',()=>_0x5734bc['segment'][_0x48e3c6(0x24d)](_0x169b9c,_0x34f279),{'verbose':_0x895333[_0x48e3c6(0x230)]}),_0x1be335=_0x9d3d65['data'];_0x895333[_0x48e3c6(0x230)]&&console[_0x48e3c6(0x213)](_0x48e3c6(0x1ec)+_0x1be335);const _0x258fc0=await withSpinner(_0x48e3c6(0x231)+_0x34f279+'\x27...',()=>_0x5734bc[_0x48e3c6(0x222)][_0x48e3c6(0x220)](_0x1be335),{'verbose':_0x895333[_0x48e3c6(0x230)]});return await handleSDKOutput([_0x258fc0[_0x48e3c6(0x260)]],_0x895333),0x0;}catch(_0x274c01){if(_0x274c01 instanceof SDKError)return console['error'](_0x48e3c6(0x204)+_0x274c01['message']),_0x274c01['cause']&&console['error'](_0x48e3c6(0x236)+_0x274c01[_0x48e3c6(0x20e)]),0x1;throw _0x274c01;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a37_0x4fd039(0x1fb);[a37_0x4fd039(0x210)]=a37_0x4fd039(0x23c);async[a37_0x4fd039(0x1f8)](_0x161b1a){const _0x1b3181=a37_0x4fd039,{options:_0x5f3588,args:_0xa3c69e}=_0x161b1a,_0x42e9ad=_0x5f3588,_0x55905c=_0x42e9ad[_0x1b3181(0x26a)],_0x305228=_0xa3c69e[0x0];if(!_0x305228&&!_0x55905c)return console[_0x1b3181(0x213)](a37_0x5b3ea4[_0x1b3181(0x206)](_0x1b3181(0x23b))),console[_0x1b3181(0x213)](_0x1b3181(0x205)),console[_0x1b3181(0x213)](_0x1b3181(0x24c)),console[_0x1b3181(0x213)](_0x1b3181(0x232)),console[_0x1b3181(0x213)]('Examples:'),console[_0x1b3181(0x213)](_0x1b3181(0x235)),console[_0x1b3181(0x213)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml'),0x1;if(_0x305228&&_0x55905c)return console[_0x1b3181(0x213)](a37_0x5b3ea4[_0x1b3181(0x206)](_0x1b3181(0x23f))),0x1;try{let _0x1ca55a;if(_0x55905c)_0x1ca55a=await this[_0x1b3181(0x25b)](_0x55905c,_0x161b1a);else{if(isYamlFilePath(_0x305228))return console[_0x1b3181(0x213)](a37_0x5b3ea4[_0x1b3181(0x206)](_0x1b3181(0x24e))),console[_0x1b3181(0x213)](_0x1b3181(0x23d)+_0x305228),0x1;else _0x1ca55a=await this['getSQLFromServerSegment'](_0x305228,_0x161b1a);}return _0x5f3588[_0x1b3181(0x21d)]===_0x1b3181(0x249)||_0x5f3588[_0x1b3181(0x21d)]===_0x1b3181(0x278)?await handleSDKOutput([{'sql':_0x1ca55a}],_0x5f3588):console[_0x1b3181(0x209)](_0x1ca55a),0x0;}catch(_0x3b8271){if(_0x3b8271 instanceof SDKError)return console[_0x1b3181(0x213)]('Error:\x20'+_0x3b8271[_0x1b3181(0x271)]),_0x3b8271['cause']&&console['error'](_0x1b3181(0x236)+_0x3b8271[_0x1b3181(0x20e)]),0x1;throw _0x3b8271;}}async['getSQLFromYamlFile'](_0x8feb8c,_0x2a868b){const _0x3c3b4f=a37_0x4fd039,{options:_0x27ba2e,tdx:_0x160cc6}=_0x2a868b;let _0x437497;try{_0x437497=await resolveYamlFilePath(_0x8feb8c);}catch(_0x25e61e){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x3c3b4f(0x22b)+_0x25e61e[_0x3c3b4f(0x271)]);}_0x27ba2e[_0x3c3b4f(0x230)]&&console['error']('Resolved:\x20'+_0x437497[_0x3c3b4f(0x26c)]+'/'+_0x437497['segmentName']);const _0x439d08=await withSpinner('Fetching\x20SQL\x20from\x20rule...',()=>_0x160cc6[_0x3c3b4f(0x222)][_0x3c3b4f(0x252)](_0x437497[_0x3c3b4f(0x214)],_0x437497[_0x3c3b4f(0x26c)],_0x437497[_0x3c3b4f(0x24f)]),{'verbose':_0x27ba2e[_0x3c3b4f(0x230)]});return _0x439d08[_0x3c3b4f(0x260)];}async['getSQLFromServerSegment'](_0x36a0c1,_0x5d2640){const _0x20aa31=a37_0x4fd039,{options:_0x14e571,tdx:_0x2b86f4}=_0x5d2640,_0x10bbd9=_0x14e571[_0x20aa31(0x26c)],_0x32221f=await resolveSegmentTarget(_0x36a0c1,_0x10bbd9,_0x14e571[_0x20aa31(0x230)]);_0x14e571['verbose']&&console[_0x20aa31(0x213)](_0x20aa31(0x25a)+_0x32221f);const _0x4ae31f=await withSpinner(_0x20aa31(0x1e8)+_0x36a0c1+_0x20aa31(0x258),()=>_0x2b86f4[_0x20aa31(0x222)][_0x20aa31(0x233)](_0x32221f),{'verbose':_0x14e571[_0x20aa31(0x230)]}),_0x8ee8ef=_0x4ae31f[_0x20aa31(0x260)];_0x14e571[_0x20aa31(0x230)]&&(console[_0x20aa31(0x213)](_0x20aa31(0x221)+_0x8ee8ef['type']),console[_0x20aa31(0x213)]('Parent\x20ID:\x20'+_0x8ee8ef[_0x20aa31(0x1fd)]));if(_0x8ee8ef[_0x20aa31(0x263)]===_0x20aa31(0x1e9))throw new SDKError(ErrorCode[_0x20aa31(0x1e5)],'Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.');if(_0x8ee8ef[_0x20aa31(0x263)]===_0x20aa31(0x26f))throw new SDKError(ErrorCode[_0x20aa31(0x1e5)],'Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql');if(!_0x8ee8ef[_0x20aa31(0x217)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x20aa31(0x1fc));const _0x402ea7=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x2b86f4[_0x20aa31(0x222)][_0x20aa31(0x20b)](_0x8ee8ef[_0x20aa31(0x1fd)],_0x8ee8ef[_0x20aa31(0x217)]),{'verbose':_0x14e571[_0x20aa31(0x230)]});return _0x402ea7[_0x20aa31(0x260)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x4fd039(0x1f1)]=a37_0x4fd039(0x26b);[a37_0x4fd039(0x210)]=a37_0x4fd039(0x219);async[a37_0x4fd039(0x1f8)](_0x3fd9ca){const _0x5474d7=a37_0x4fd039,{options:_0x42bbf0,args:_0x4f0d03,tdx:_0x231cb0}=_0x3fd9ca,_0x21ef11=_0x42bbf0;if(_0x4f0d03['length']<0x2)return console[_0x5474d7(0x213)](_0x5474d7(0x256)),console[_0x5474d7(0x213)]('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x3d294f=_0x4f0d03[0x0],_0x21499d=_0x4f0d03[0x1];_0x21ef11['verbose']&&(console[_0x5474d7(0x213)](_0x5474d7(0x245)+_0x21ef11[_0x5474d7(0x270)]),console[_0x5474d7(0x213)](_0x5474d7(0x21f)+_0x3d294f),console['error'](_0x5474d7(0x269)+_0x21499d));let _0x3c0047;if(_0x21ef11[_0x5474d7(0x1f2)]){const _0x2b63b8=_0x21ef11[_0x5474d7(0x1f2)],_0xd194e9=await withSpinner(_0x5474d7(0x254)+_0x3d294f+'\x27...',()=>_0x231cb0[_0x5474d7(0x222)][_0x5474d7(0x224)](_0x3d294f),{'verbose':_0x21ef11[_0x5474d7(0x230)]}),_0x3caa57=_0xd194e9[_0x5474d7(0x260)],_0x3fc1aa=await withSpinner(_0x5474d7(0x241)+_0x2b63b8+_0x5474d7(0x258),()=>_0x231cb0['segment']['resolveFolderId'](_0x3caa57,_0x2b63b8),{'verbose':_0x21ef11[_0x5474d7(0x230)]});_0x3c0047=_0x3fc1aa[_0x5474d7(0x260)],_0x21ef11[_0x5474d7(0x230)]&&console['error']('Resolved\x20parent\x20folder\x20ID:\x20'+_0x3c0047);}const _0x382bde={'name':_0x21499d,'description':_0x21ef11['description'],'parentFolderId':_0x3c0047},_0x2cd24f=await withSpinner(_0x5474d7(0x243)+_0x21499d+'\x27...',()=>_0x231cb0[_0x5474d7(0x222)]['createFolder'](_0x3d294f,_0x382bde),{'verbose':_0x21ef11['verbose']}),_0x418435=_0x2cd24f[_0x5474d7(0x260)];return console[_0x5474d7(0x213)]('✔\x20Created\x20folder\x20\x27'+_0x418435[_0x5474d7(0x1f1)]+_0x5474d7(0x226)+_0x418435['id']),await handleSDKOutput([_0x418435],_0x21ef11),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a37_0x4fd039(0x268);[a37_0x4fd039(0x210)]='Show\x20folder\x20or\x20child\x20segment\x20details';async['execute'](_0x4b7d65){const _0xfc45ea=a37_0x4fd039,{options:_0x94fb01,args:_0xd434f4,tdx:_0x1000f4}=_0x4b7d65,_0x50a321=_0xd434f4[0x0];if(!_0x50a321)return console['error']('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0xfc45ea(0x213)](_0xfc45ea(0x1eb)),console['error'](_0xfc45ea(0x218)),console[_0xfc45ea(0x213)](_0xfc45ea(0x202)),console['error'](_0xfc45ea(0x1f9)),console['error'](_0xfc45ea(0x282)),console[_0xfc45ea(0x213)](_0xfc45ea(0x22a)),console[_0xfc45ea(0x213)](_0xfc45ea(0x250)),console[_0xfc45ea(0x213)](_0xfc45ea(0x274)),console[_0xfc45ea(0x213)](_0xfc45ea(0x225)),0x1;try{const _0xbf2cb9=_0x94fb01[_0xfc45ea(0x26c)],_0x2591d0=await resolveSegmentTarget(_0x50a321,_0xbf2cb9,_0x94fb01[_0xfc45ea(0x230)]);_0x94fb01[_0xfc45ea(0x230)]&&console['error'](_0xfc45ea(0x25a)+_0x2591d0);const _0x32601c=await withSpinner('Resolving\x20\x27'+_0x50a321+_0xfc45ea(0x258),()=>_0x1000f4[_0xfc45ea(0x222)][_0xfc45ea(0x233)](_0x2591d0),{'verbose':_0x94fb01[_0xfc45ea(0x230)]}),_0x3b4b7a=_0x32601c[_0xfc45ea(0x260)];_0x94fb01[_0xfc45ea(0x230)]&&(console[_0xfc45ea(0x213)](_0xfc45ea(0x221)+_0x3b4b7a[_0xfc45ea(0x263)]),console[_0xfc45ea(0x213)]('Parent\x20ID:\x20'+_0x3b4b7a['parentId']),_0x3b4b7a[_0xfc45ea(0x1f6)]&&console['error']('Folder\x20ID:\x20'+_0x3b4b7a['folderId']),_0x3b4b7a[_0xfc45ea(0x217)]&&console[_0xfc45ea(0x213)](_0xfc45ea(0x240)+_0x3b4b7a[_0xfc45ea(0x217)]));if(_0x94fb01[_0xfc45ea(0x200)]){if(_0x3b4b7a[_0xfc45ea(0x263)]===_0xfc45ea(0x1e9))return console[_0xfc45ea(0x213)](_0xfc45ea(0x24a)),0x1;if(_0x3b4b7a[_0xfc45ea(0x263)]===_0xfc45ea(0x26f))return console[_0xfc45ea(0x213)](_0xfc45ea(0x255)),console['error']('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x3b4b7a['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0xfc45ea(0x1fc));const _0x2104cc=getConsoleNextUrl(_0x94fb01[_0xfc45ea(0x270)],_0xfc45ea(0x239)+_0x3b4b7a[_0xfc45ea(0x1fd)]+'/e/'+_0x3b4b7a[_0xfc45ea(0x217)]);return console[_0xfc45ea(0x213)](a37_0x5b3ea4[_0xfc45ea(0x22d)]('✔')+'\x20Opening\x20'+a37_0x5b3ea4['cyan'](_0x2104cc)),openBrowser(_0x2104cc),0x0;}if(_0x3b4b7a[_0xfc45ea(0x263)]==='folder'){if(!_0x3b4b7a[_0xfc45ea(0x1f6)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x169fa6=await withSpinner('Fetching\x20folder\x20details...',()=>_0x1000f4[_0xfc45ea(0x222)][_0xfc45ea(0x220)](_0x3b4b7a['folderId']),{'verbose':_0x94fb01['verbose']});await handleSingleObjectOutput(_0x169fa6[_0xfc45ea(0x260)],_0x94fb01);}else{if(_0x3b4b7a[_0xfc45ea(0x263)]===_0xfc45ea(0x222)){if(!_0x3b4b7a[_0xfc45ea(0x217)])throw new SDKError(ErrorCode[_0xfc45ea(0x234)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x54f4bf=await withSpinner('Fetching\x20segment\x20details...',()=>_0x1000f4['segment'][_0xfc45ea(0x238)](_0x3b4b7a[_0xfc45ea(0x1fd)],_0x3b4b7a[_0xfc45ea(0x217)]),{'verbose':_0x94fb01[_0xfc45ea(0x230)]}),_0x278b29=getConsoleNextUrl(_0x94fb01[_0xfc45ea(0x270)],_0xfc45ea(0x239)+_0x3b4b7a[_0xfc45ea(0x1fd)]+_0xfc45ea(0x22f)+_0x3b4b7a[_0xfc45ea(0x217)]),_0x305aa9=_0x54f4bf[_0xfc45ea(0x260)];_0x305aa9[_0xfc45ea(0x265)]=_0x278b29,await handleSingleObjectOutput(_0x305aa9,_0x94fb01);}else return console[_0xfc45ea(0x213)](_0xfc45ea(0x20c)),console['error'](_0xfc45ea(0x1f0)),0x1;}return 0x0;}catch(_0x1b0ec4){if(_0x1b0ec4 instanceof SDKError)return console[_0xfc45ea(0x213)](_0xfc45ea(0x204)+_0x1b0ec4[_0xfc45ea(0x271)]),_0x1b0ec4[_0xfc45ea(0x20e)]&&console[_0xfc45ea(0x213)](_0xfc45ea(0x236)+_0x1b0ec4[_0xfc45ea(0x20e)]),0x1;throw _0x1b0ec4;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']=a37_0x4fd039(0x223);['description']=a37_0x4fd039(0x248);async[a37_0x4fd039(0x1f8)](_0x349844){const _0x177e60=a37_0x4fd039,{options:_0x2ba358,args:_0x4adeaf,tdx:_0x4043b9}=_0x349844,_0x165ff6=_0x4adeaf[0x0];if(!_0x165ff6)return console[_0x177e60(0x213)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x177e60(0x213)](_0x177e60(0x227)),console[_0x177e60(0x213)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console[_0x177e60(0x213)](_0x177e60(0x282)),console[_0x177e60(0x213)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x177e60(0x213)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x5c0e5e=_0x2ba358['parentSegment'],_0x2b9e26=await resolveSegmentTarget(_0x165ff6,_0x5c0e5e,_0x2ba358[_0x177e60(0x230)]);_0x2ba358[_0x177e60(0x230)]&&console[_0x177e60(0x213)]('Target\x20path:\x20'+_0x2b9e26);const _0x2477ce=await withSpinner(_0x177e60(0x1e8)+_0x165ff6+_0x177e60(0x258),()=>_0x4043b9['segment']['resolvePathToResource'](_0x2b9e26),{'verbose':_0x2ba358[_0x177e60(0x230)]}),_0x401c87=_0x2477ce[_0x177e60(0x260)];_0x2ba358[_0x177e60(0x230)]&&(console[_0x177e60(0x213)](_0x177e60(0x221)+_0x401c87[_0x177e60(0x263)]),console[_0x177e60(0x213)](_0x177e60(0x273)+_0x401c87[_0x177e60(0x1fd)]));if(_0x401c87[_0x177e60(0x263)]===_0x177e60(0x1e9))return console[_0x177e60(0x213)](_0x177e60(0x27d)),console[_0x177e60(0x213)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x401c87[_0x177e60(0x263)]==='parent')return console['error'](_0x177e60(0x20a)),console['error'](_0x177e60(0x1ff)),0x1;if(!_0x401c87[_0x177e60(0x217)])throw new SDKError(ErrorCode[_0x177e60(0x234)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x4fae4e=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x4043b9[_0x177e60(0x222)][_0x177e60(0x20b)](_0x401c87[_0x177e60(0x1fd)],_0x401c87[_0x177e60(0x217)]),{'verbose':_0x2ba358[_0x177e60(0x230)]}),_0x55f05c=_0x4fae4e['data'],_0x5cc01f=await executeSchemaQuery(_0x55f05c,_0x4043b9,_0x2ba358);return await handleQueryOutput(_0x5cc01f,_0x2ba358),0x0;}catch(_0x552a25){if(_0x552a25 instanceof SDKError)return console['error'](_0x177e60(0x204)+_0x552a25[_0x177e60(0x271)]),_0x552a25[_0x177e60(0x20e)]&&console[_0x177e60(0x213)](_0x177e60(0x236)+_0x552a25[_0x177e60(0x20e)]),0x1;throw _0x552a25;}}}
1
+ function a37_0xb08f(){const _0xbc67d7=['✔\x20Created\x20folder\x20\x27','Resolved\x20type:\x20','Use:\x20tdx\x20ps\x20view','Error:\x20Parent\x20segment\x20name\x20is\x20required','2328NairmH','segment:view','Parent\x20name:\x20','processedRows','parent','Fetching\x20segment\x20details...','Resolved\x20YAML\x20file:\x20','Resolving\x20\x27','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','path','segmentName','\x20\x20tdx\x20sg\x20sql\x20--path\x20','INVALID_ARGUMENT','Resolving\x20folder\x20\x27','Fetching\x20folder\x20\x27','\x20\x20Folder\x20path:\x20','Parent\x20ID:\x20','220nNXRGZ','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Examples:','Folder\x20name:\x20','verbose','red','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Resolved\x20parent\x20folder\x20ID:\x20','\x20\x20Cause:\x20','\x27...','getSegmentSQL','web','toLocaleString','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','SELECT\x20*\x20FROM\x20(\x0a','Segment\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','description','getSegment','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','✔\x20Found\x20','18414JtpyuA','log','cause','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','segment','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','parentSegment','information_schema','setJobId','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','parentFolder','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','segment:folder:list','folderPath','folderId','Usage:\x20tdx\x20sg\x20show\x20<name>','Error:\x20Path\x20or\x20name\x20is\x20required','Resolved\x20folder\x20ID:\x20','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','segment:sql','Folder\x20ID\x20missing\x20from\x20resolved\x20path','\x20rows\x20','Parent\x20segment:\x20','Use:\x20tdx\x20ps\x20view\x20-w','SEGMENT_NOT_FOUND','includes','test','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','resolveParentId','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','\x20Opening\x20','json','Site:\x20','Error:\x20','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','listFolders','fullPath','Usage:\x20tdx\x20segment\x20describe\x20<path>','stats','getParent','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Fetching\x20parent\x20segment\x20details...','type','parentId','jobId','resolvePathToResource','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','11802bPtBNF','Target\x20path:\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','getSQLFromServerSegment','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','\x20\x20Full\x20path:\x20','8414784cPeYlu','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Resolving\x20parent\x20segment\x20\x27','segment:folder:create','Resolved:\x20','createFolder','segment:describe','\x20folder','Executing\x20segment\x20query...','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','name','segmentId','Listing\x20folders\x20for\x20parent\x20\x27','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','cyan','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','trim','data','Usage:\x20tdx\x20sg\x20desc\x20<name>','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','SEGMENT_FOLDER_NOT_FOUND','segment:show','site','✔\x20Query\x20completed:\x20Processed\x20','2629210kKQKOo','folder','in\x20','/app/ps/','limit','segment:desc','Resolved\x20relative\x20path\x20to:\x20','resolveFolderId','message','\x20\x20Parent\x20segment:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','execute','getSQLFromYamlFile','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Creating\x20folder\x20\x27','364YHeIzm','48486jIISsD','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','length','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','138265EDeLlV','Usage:','error','Fetching\x20SQL\x20from\x20rule...','2233090cVSNkL','Options:','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Show\x20segment\x20or\x20folder\x20details','Fetching\x20SQL\x20for\x20segment...','content','\x20\x20Segment\x20name:\x20','(root)','/e/','getFolder','\x27\x20with\x20ID:\x20','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Resolving\x20path\x20\x27','format'];a37_0xb08f=function(){return _0xbc67d7;};return a37_0xb08f();}const a37_0x372c5a=a37_0x3968;(function(_0x39456a,_0x3d274d){const _0x5f11a4=a37_0x3968,_0x5e1351=_0x39456a();while(!![]){try{const _0x557aba=-parseInt(_0x5f11a4(0x184))/0x1+-parseInt(_0x5f11a4(0x16e))/0x2+parseInt(_0x5f11a4(0x11c))/0x3*(parseInt(_0x5f11a4(0x17e))/0x4)+-parseInt(_0x5f11a4(0x106))/0x5*(-parseInt(_0x5f11a4(0x17f))/0x6)+parseInt(_0x5f11a4(0x14f))/0x7*(parseInt(_0x5f11a4(0xf5))/0x8)+parseInt(_0x5f11a4(0x155))/0x9+-parseInt(_0x5f11a4(0xe3))/0xa;if(_0x557aba===_0x3d274d)break;else _0x5e1351['push'](_0x5e1351['shift']());}catch(_0x21dc4e){_0x5e1351['push'](_0x5e1351['shift']());}}}(a37_0xb08f,0xa1ff9));import{BaseCommand}from'./command.js';function a37_0x3968(_0x434e32,_0x4390ce){_0x434e32=_0x434e32-0xe1;const _0xb08f9d=a37_0xb08f();let _0x396894=_0xb08f9d[_0x434e32];return _0x396894;}import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a37_0x4f23cf from'chalk';async function resolveSegmentTarget(_0x415860,_0x420ea2,_0x5eb8ef){const _0x3a9e80=a37_0x3968;if(isYamlFilePath(_0x415860))try{const _0x5dfbc0=await resolveYamlFilePath(_0x415860);return _0x5eb8ef&&(console['error'](_0x3a9e80(0xfb)+_0x415860),console[_0x3a9e80(0xe1)](_0x3a9e80(0x177)+_0x5dfbc0[_0x3a9e80(0x123)]),console['error'](_0x3a9e80(0xe9)+_0x5dfbc0[_0x3a9e80(0xff)]),console[_0x3a9e80(0xe1)](_0x3a9e80(0x104)+(_0x5dfbc0[_0x3a9e80(0x12a)]||_0x3a9e80(0xea))),console[_0x3a9e80(0xe1)](_0x3a9e80(0x154)+_0x5dfbc0['fullPath'])),_0x5dfbc0[_0x3a9e80(0x143)];}catch(_0x201a36){throw new SDKError(ErrorCode[_0x3a9e80(0x101)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x201a36[_0x3a9e80(0x176)]);}if(!_0x420ea2)throw new SDKError(ErrorCode[_0x3a9e80(0x101)],_0x3a9e80(0x163));return _0x420ea2+'/'+_0x415860;}export class SegmentDescribeCommand extends BaseCommand{[a37_0x372c5a(0x15f)]=a37_0x372c5a(0x15b);[a37_0x372c5a(0x118)]=a37_0x372c5a(0xe6);async['execute'](_0x15eb0b){const _0x2a0350=a37_0x372c5a,{options:_0x137e3f,args:_0x523907,tdx:_0x31ecfc}=_0x15eb0b,_0x14642e=_0x523907[0x0],_0x2fc8d6=!_0x14642e&&!!_0x137e3f['parentSegment'],_0x51bc55=_0x14642e||_0x137e3f[_0x2a0350(0x123)];if(!_0x51bc55)return console[_0x2a0350(0xe1)](_0x2a0350(0x12d)),console['error'](_0x2a0350(0x144)),console['error'](_0x2a0350(0x108)),console['error'](_0x2a0350(0x17c)),console['error']('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console['error'](_0x2a0350(0x141)),console['error'](_0x2a0350(0x169)),0x1;try{const _0x245d58=_0x137e3f['segmentPath'];let _0x287842=_0x51bc55;!_0x2fc8d6&&_0x245d58&&!_0x51bc55[_0x2a0350(0x136)]('/')&&(_0x287842=_0x245d58+'/'+_0x51bc55,_0x137e3f['verbose']&&console[_0x2a0350(0xe1)](_0x2a0350(0x174)+_0x287842));const _0x287464=await withSpinner(_0x2a0350(0xef)+_0x287842+_0x2a0350(0x110),()=>_0x31ecfc[_0x2a0350(0x121)][_0x2a0350(0x14c)](_0x287842),{'verbose':_0x137e3f['verbose']}),_0x407a29=_0x287464[_0x2a0350(0x167)];_0x137e3f[_0x2a0350(0x10a)]&&(console['error'](_0x2a0350(0xf2)+_0x407a29[_0x2a0350(0x149)]),console[_0x2a0350(0xe1)](_0x2a0350(0x105)+_0x407a29[_0x2a0350(0x14a)]),_0x407a29[_0x2a0350(0x12b)]&&console['error']('Folder\x20ID:\x20'+_0x407a29[_0x2a0350(0x12b)]),_0x407a29[_0x2a0350(0x160)]&&console['error']('Segment\x20ID:\x20'+_0x407a29[_0x2a0350(0x160)]));if(_0x407a29[_0x2a0350(0x149)]===_0x2a0350(0xf9)){const _0x417a4b=await withSpinner(_0x2a0350(0x148),()=>_0x31ecfc[_0x2a0350(0x121)][_0x2a0350(0x146)](_0x407a29[_0x2a0350(0x14a)]),{'verbose':_0x137e3f[_0x2a0350(0x10a)]});await handleSingleObjectOutput(_0x417a4b[_0x2a0350(0x167)],_0x137e3f);}else{if(_0x407a29[_0x2a0350(0x149)]==='folder'){if(!_0x407a29[_0x2a0350(0x12b)])throw new SDKError(ErrorCode[_0x2a0350(0x16a)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x2d93df=await withSpinner('Fetching\x20folder\x20details...',()=>_0x31ecfc['segment']['getFolder'](_0x407a29[_0x2a0350(0x12b)]),{'verbose':_0x137e3f['verbose']});await handleSingleObjectOutput(_0x2d93df[_0x2a0350(0x167)],_0x137e3f);}else{if(_0x407a29[_0x2a0350(0x149)]==='segment'){if(!_0x407a29[_0x2a0350(0x160)])throw new SDKError(ErrorCode[_0x2a0350(0x135)],_0x2a0350(0x116));const _0x318fd2=await withSpinner('Fetching\x20segment\x20details...',()=>_0x31ecfc[_0x2a0350(0x121)][_0x2a0350(0x119)](_0x407a29['parentId'],_0x407a29[_0x2a0350(0x160)]),{'verbose':_0x137e3f[_0x2a0350(0x10a)]});await handleSingleObjectOutput(_0x318fd2[_0x2a0350(0x167)],_0x137e3f);}}}return 0x0;}catch(_0x42d009){if(_0x42d009 instanceof SDKError)return console[_0x2a0350(0xe1)]('Error:\x20'+_0x42d009[_0x2a0350(0x176)]),_0x42d009[_0x2a0350(0x11e)]&&console[_0x2a0350(0xe1)](_0x2a0350(0x10f)+_0x42d009['cause']),0x1;throw _0x42d009;}}}export class SegmentShowCommand extends BaseCommand{[a37_0x372c5a(0x15f)]=a37_0x372c5a(0x16b);[a37_0x372c5a(0x118)]=a37_0x372c5a(0x10c);async[a37_0x372c5a(0x17a)](_0x4fd51){const _0x41d31f=a37_0x372c5a,{options:_0x45dc29,args:_0x2861e2,tdx:_0x34b9d6}=_0x4fd51,_0x415d45=_0x2861e2[0x0];if(!_0x415d45)return console['error'](_0x41d31f(0x151)),console[_0x41d31f(0xe1)](_0x41d31f(0x12c)),console['error'](_0x41d31f(0x10d)),console[_0x41d31f(0xe1)](_0x41d31f(0x108)),console[_0x41d31f(0xe1)](_0x41d31f(0x11a)),console[_0x41d31f(0xe1)](_0x41d31f(0x14e)),0x1;try{const _0x11c336=_0x45dc29['parentSegment'],_0x5f403d=await resolveSegmentTarget(_0x415d45,_0x11c336,_0x45dc29['verbose']);_0x45dc29[_0x41d31f(0x10a)]&&console['error']('Target\x20path:\x20'+_0x5f403d);const _0x4b2d53=await withSpinner(_0x41d31f(0xfc)+_0x415d45+'\x27...',()=>_0x34b9d6[_0x41d31f(0x121)][_0x41d31f(0x14c)](_0x5f403d),{'verbose':_0x45dc29[_0x41d31f(0x10a)]}),_0x14826e=_0x4b2d53[_0x41d31f(0x167)];_0x45dc29[_0x41d31f(0x10a)]&&(console[_0x41d31f(0xe1)](_0x41d31f(0xf2)+_0x14826e[_0x41d31f(0x149)]),console['error'](_0x41d31f(0x105)+_0x14826e[_0x41d31f(0x14a)]));if(_0x14826e[_0x41d31f(0x149)]==='folder')return console[_0x41d31f(0xe1)](_0x41d31f(0x15e)),console[_0x41d31f(0xe1)]('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x14826e[_0x41d31f(0x149)]==='parent')return console['error'](_0x41d31f(0x181)),console[_0x41d31f(0xe1)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x14826e[_0x41d31f(0x160)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x3d677d=await withSpinner(_0x41d31f(0xe7),()=>_0x34b9d6['segment'][_0x41d31f(0x111)](_0x14826e[_0x41d31f(0x14a)],_0x14826e[_0x41d31f(0x160)]),{'verbose':_0x45dc29['verbose']});let _0xdd7b27=_0x3d677d[_0x41d31f(0x167)];const _0x358b87=resolveLimit(_0x45dc29[_0x41d31f(0x172)],DEFAULT_DISPLAY_LIMIT),_0x39e534=/\bLIMIT\s+\d+/i[_0x41d31f(0x137)](_0xdd7b27);!_0x39e534&&(_0xdd7b27=_0xdd7b27[_0x41d31f(0x166)]()['replace'](/;+$/,''),_0xdd7b27=_0x41d31f(0x115)+_0xdd7b27+_0x41d31f(0x120)+_0x358b87);_0x45dc29[_0x41d31f(0x10a)]&&console[_0x41d31f(0xe1)]('SQL\x20query:\x0a'+_0xdd7b27);const _0x52673b=await withProgressSpinner(_0x41d31f(0x15d),async _0x3871bd=>{const _0x3cb6c6=_0x41d31f,_0x1bb723=await _0x34b9d6['query'][_0x3cb6c6(0x17a)](_0xdd7b27,{'catalog':'td','schema':_0x3cb6c6(0x124),'onJobId':_0x233d29=>{const _0x134fc0=_0x3cb6c6;_0x3871bd[_0x134fc0(0x125)](_0x233d29);}});return _0x1bb723;},{'verbose':_0x45dc29[_0x41d31f(0x10a)]}),_0x2747f6=_0x52673b[_0x41d31f(0x167)],_0x5a26f4=_0x2747f6[_0x41d31f(0x14b)]?'\x20[Job\x20ID:\x20'+_0x2747f6['jobId']+']':'';return console[_0x41d31f(0xe1)](_0x41d31f(0x16d)+_0x2747f6[_0x41d31f(0x145)][_0x41d31f(0xf8)][_0x41d31f(0x113)]()+_0x41d31f(0x132)+(_0x41d31f(0x170)+formatElapsed(_0x2747f6[_0x41d31f(0x145)]['elapsedTimeMillis'])+_0x5a26f4)),await handleQueryOutput(_0x2747f6,_0x45dc29),0x0;}catch(_0x447ffd){if(_0x447ffd instanceof SDKError)return console[_0x41d31f(0xe1)]('✖\x20Query\x20failed\x20['+_0x447ffd['code']+']'),console[_0x41d31f(0xe1)]('\x0a'+_0x447ffd[_0x41d31f(0x176)]),0x1;throw _0x447ffd;}}}export class SegmentFolderListCommand extends BaseCommand{[a37_0x372c5a(0x15f)]=a37_0x372c5a(0x129);['description']='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a37_0x372c5a(0x17a)](_0x2ee04d){const _0x1eaf04=a37_0x372c5a,{options:_0x36480c,args:_0x38a0aa,tdx:_0x3e6183}=_0x2ee04d;if(_0x38a0aa[_0x1eaf04(0x182)]===0x0)return console['error'](_0x1eaf04(0xf4)),console[_0x1eaf04(0xe1)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x3f6139=_0x38a0aa[0x0];try{_0x36480c[_0x1eaf04(0x10a)]&&(console[_0x1eaf04(0xe1)](_0x1eaf04(0x13e)+_0x36480c[_0x1eaf04(0x16c)]),console[_0x1eaf04(0xe1)]('Parent\x20name:\x20'+_0x3f6139));const _0x4a4dfe=await withSpinner(_0x1eaf04(0x157)+_0x3f6139+_0x1eaf04(0x110),()=>_0x3e6183[_0x1eaf04(0x121)][_0x1eaf04(0x13a)](_0x3f6139),{'verbose':_0x36480c[_0x1eaf04(0x10a)]}),_0x401e40=_0x4a4dfe[_0x1eaf04(0x167)];_0x36480c['verbose']&&console[_0x1eaf04(0xe1)]('Resolved\x20parent\x20ID:\x20'+_0x401e40);const _0x27844d=await withSpinner(_0x1eaf04(0x161)+_0x3f6139+_0x1eaf04(0x110),()=>_0x3e6183['segment'][_0x1eaf04(0x142)](_0x401e40),{'verbose':_0x36480c[_0x1eaf04(0x10a)]}),_0x1e777f=_0x27844d[_0x1eaf04(0x167)];return console[_0x1eaf04(0xe1)](_0x1eaf04(0x11b)+_0x1e777f[_0x1eaf04(0x182)]+_0x1eaf04(0x15c)+(_0x1e777f[_0x1eaf04(0x182)]!==0x1?'s':'')),await handleSDKOutput(_0x1e777f,_0x36480c),0x0;}catch(_0x5ea494){if(_0x5ea494 instanceof SDKError)return console[_0x1eaf04(0xe1)](_0x1eaf04(0x13f)+_0x5ea494[_0x1eaf04(0x176)]),_0x5ea494['cause']&&console['error'](_0x1eaf04(0x10f)+_0x5ea494[_0x1eaf04(0x11e)]),0x1;throw _0x5ea494;}}}export class SegmentFolderShowCommand extends BaseCommand{[a37_0x372c5a(0x15f)]='segment:folder:show';['description']='Show\x20segment\x20folder\x20details';async['execute'](_0x29911d){const _0x532136=a37_0x372c5a,{options:_0x5d6c18,args:_0x5c8909,tdx:_0xebb997}=_0x29911d;if(_0x5c8909[_0x532136(0x182)]===0x0)return console['error']('Error:\x20Folder\x20reference\x20is\x20required'),console[_0x532136(0xe1)](_0x532136(0x14d)),0x1;try{const {parentId:_0x27eed7,childId:_0x208950}=parseSegmentRef(_0x5c8909[0x0]);_0x5d6c18[_0x532136(0x10a)]&&(console['error'](_0x532136(0x13e)+_0x5d6c18[_0x532136(0x16c)]),console['error'](_0x532136(0xf7)+_0x27eed7),_0x208950&&console['error']('Folder\x20name:\x20'+_0x208950));if(!_0x208950)return console[_0x532136(0xe1)](_0x532136(0x183)),0x1;const _0x100985=await withSpinner(_0x532136(0x157)+_0x27eed7+_0x532136(0x110),()=>_0xebb997['segment']['resolveParentId'](_0x27eed7),{'verbose':_0x5d6c18[_0x532136(0x10a)]}),_0x26a9d1=_0x100985[_0x532136(0x167)];_0x5d6c18['verbose']&&console[_0x532136(0xe1)]('Resolved\x20parent\x20ID:\x20'+_0x26a9d1);const _0x3fd71b=await withSpinner(_0x532136(0x102)+_0x208950+_0x532136(0x110),()=>_0xebb997['segment'][_0x532136(0x175)](_0x26a9d1,_0x208950),{'verbose':_0x5d6c18['verbose']}),_0x11cce4=_0x3fd71b[_0x532136(0x167)];_0x5d6c18[_0x532136(0x10a)]&&console[_0x532136(0xe1)](_0x532136(0x12e)+_0x11cce4);const _0x2f6ffd=await withSpinner(_0x532136(0x103)+_0x208950+'\x27...',()=>_0xebb997[_0x532136(0x121)][_0x532136(0xec)](_0x11cce4),{'verbose':_0x5d6c18[_0x532136(0x10a)]});return await handleSDKOutput([_0x2f6ffd['data']],_0x5d6c18),0x0;}catch(_0xa0ed60){if(_0xa0ed60 instanceof SDKError)return console['error']('Error:\x20'+_0xa0ed60['message']),_0xa0ed60['cause']&&console['error'](_0x532136(0x10f)+_0xa0ed60[_0x532136(0x11e)]),0x1;throw _0xa0ed60;}}}export class SegmentSQLCommand extends BaseCommand{[a37_0x372c5a(0x15f)]=a37_0x372c5a(0x130);['description']='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a37_0x372c5a(0x17a)](_0xbe15dc){const _0x1550ee=a37_0x372c5a,{options:_0x266bdb,args:_0x3de5e4}=_0xbe15dc,_0x3273d1=_0x266bdb,_0x3fca66=_0x3273d1[_0x1550ee(0xfe)],_0x23a672=_0x3de5e4[0x0];if(!_0x23a672&&!_0x3fca66)return console['error'](a37_0x4f23cf[_0x1550ee(0x10b)](_0x1550ee(0x138))),console[_0x1550ee(0xe1)](_0x1550ee(0x185)),console[_0x1550ee(0xe1)](_0x1550ee(0x140)),console[_0x1550ee(0xe1)](_0x1550ee(0x165)),console[_0x1550ee(0xe1)](_0x1550ee(0x108)),console[_0x1550ee(0xe1)](_0x1550ee(0x139)),console['error']('\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml'),0x1;if(_0x23a672&&_0x3fca66)return console[_0x1550ee(0xe1)](a37_0x4f23cf['red'](_0x1550ee(0x12f))),0x1;try{let _0x452c19;if(_0x3fca66)_0x452c19=await this[_0x1550ee(0x17b)](_0x3fca66,_0xbe15dc);else{if(isYamlFilePath(_0x23a672))return console['error'](a37_0x4f23cf[_0x1550ee(0x10b)]('Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option')),console[_0x1550ee(0xe1)](_0x1550ee(0x100)+_0x23a672),0x1;else _0x452c19=await this[_0x1550ee(0x152)](_0x23a672,_0xbe15dc);}return _0x266bdb[_0x1550ee(0xf0)]===_0x1550ee(0x13d)||_0x266bdb[_0x1550ee(0xf0)]==='jsonl'?await handleSDKOutput([{'sql':_0x452c19}],_0x266bdb):console[_0x1550ee(0x11d)](_0x452c19),0x0;}catch(_0x3c602d){if(_0x3c602d instanceof SDKError)return console[_0x1550ee(0xe1)](_0x1550ee(0x13f)+_0x3c602d['message']),_0x3c602d[_0x1550ee(0x11e)]&&console['error'](_0x1550ee(0x10f)+_0x3c602d[_0x1550ee(0x11e)]),0x1;throw _0x3c602d;}}async['getSQLFromYamlFile'](_0x5c88ab,_0x5ef590){const _0x2ae57c=a37_0x372c5a,{options:_0x2bdee9,tdx:_0x497eba}=_0x5ef590;let _0x274105;try{_0x274105=await resolveYamlFilePath(_0x5c88ab);}catch(_0x5d2ed5){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2ae57c(0x114)+_0x5d2ed5[_0x2ae57c(0x176)]);}_0x2bdee9[_0x2ae57c(0x10a)]&&console[_0x2ae57c(0xe1)](_0x2ae57c(0x159)+_0x274105[_0x2ae57c(0x123)]+'/'+_0x274105[_0x2ae57c(0xff)]);const _0x4710ef=await withSpinner(_0x2ae57c(0xe2),()=>_0x497eba['segment']['getSegmentSQLFromYaml'](_0x274105[_0x2ae57c(0xe8)],_0x274105[_0x2ae57c(0x123)],_0x274105[_0x2ae57c(0xff)]),{'verbose':_0x2bdee9[_0x2ae57c(0x10a)]});return _0x4710ef[_0x2ae57c(0x167)];}async['getSQLFromServerSegment'](_0x54896e,_0x3ba6fa){const _0x218386=a37_0x372c5a,{options:_0x4774af,tdx:_0x55a0a8}=_0x3ba6fa,_0x30b516=_0x4774af['parentSegment'],_0xc50744=await resolveSegmentTarget(_0x54896e,_0x30b516,_0x4774af[_0x218386(0x10a)]);_0x4774af[_0x218386(0x10a)]&&console[_0x218386(0xe1)](_0x218386(0x150)+_0xc50744);const _0x5857af=await withSpinner(_0x218386(0xfc)+_0x54896e+_0x218386(0x110),()=>_0x55a0a8['segment'][_0x218386(0x14c)](_0xc50744),{'verbose':_0x4774af[_0x218386(0x10a)]}),_0x52925e=_0x5857af[_0x218386(0x167)];_0x4774af[_0x218386(0x10a)]&&(console[_0x218386(0xe1)]('Resolved\x20type:\x20'+_0x52925e[_0x218386(0x149)]),console[_0x218386(0xe1)](_0x218386(0x105)+_0x52925e[_0x218386(0x14a)]));if(_0x52925e[_0x218386(0x149)]==='folder')throw new SDKError(ErrorCode[_0x218386(0x101)],_0x218386(0x147));if(_0x52925e[_0x218386(0x149)]===_0x218386(0xf9))throw new SDKError(ErrorCode[_0x218386(0x101)],_0x218386(0x128));if(!_0x52925e[_0x218386(0x160)])throw new SDKError(ErrorCode[_0x218386(0x135)],_0x218386(0x116));const _0x2f9de4=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x55a0a8[_0x218386(0x121)][_0x218386(0x111)](_0x52925e[_0x218386(0x14a)],_0x52925e[_0x218386(0x160)]),{'verbose':_0x4774af[_0x218386(0x10a)]});return _0x2f9de4[_0x218386(0x167)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a37_0x372c5a(0x15f)]=a37_0x372c5a(0x158);['description']='Create\x20segment\x20folder\x20for\x20organization';async[a37_0x372c5a(0x17a)](_0x2355ed){const _0x558e94=a37_0x372c5a,{options:_0x332f72,args:_0x13802f,tdx:_0x369c0d}=_0x2355ed,_0xa6c9ba=_0x332f72;if(_0x13802f['length']<0x2)return console['error']('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console[_0x558e94(0xe1)]('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x3d2996=_0x13802f[0x0],_0x14014b=_0x13802f[0x1];_0xa6c9ba['verbose']&&(console[_0x558e94(0xe1)](_0x558e94(0x13e)+_0xa6c9ba[_0x558e94(0x16c)]),console['error'](_0x558e94(0x133)+_0x3d2996),console[_0x558e94(0xe1)](_0x558e94(0x109)+_0x14014b));let _0x53ab09;if(_0xa6c9ba[_0x558e94(0x127)]){const _0x3704fa=_0xa6c9ba[_0x558e94(0x127)],_0x2e2c0d=await withSpinner(_0x558e94(0x157)+_0x3d2996+_0x558e94(0x110),()=>_0x369c0d['segment'][_0x558e94(0x13a)](_0x3d2996),{'verbose':_0xa6c9ba['verbose']}),_0x2a59ef=_0x2e2c0d['data'],_0x30f277=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x3704fa+'\x27...',()=>_0x369c0d[_0x558e94(0x121)][_0x558e94(0x175)](_0x2a59ef,_0x3704fa),{'verbose':_0xa6c9ba['verbose']});_0x53ab09=_0x30f277['data'],_0xa6c9ba[_0x558e94(0x10a)]&&console[_0x558e94(0xe1)](_0x558e94(0x10e)+_0x53ab09);}const _0x181719={'name':_0x14014b,'description':_0xa6c9ba[_0x558e94(0x118)],'parentFolderId':_0x53ab09},_0x33de91=await withSpinner(_0x558e94(0x17d)+_0x14014b+'\x27...',()=>_0x369c0d[_0x558e94(0x121)][_0x558e94(0x15a)](_0x3d2996,_0x181719),{'verbose':_0xa6c9ba['verbose']}),_0x16c506=_0x33de91[_0x558e94(0x167)];return console[_0x558e94(0xe1)](_0x558e94(0xf1)+_0x16c506[_0x558e94(0x15f)]+_0x558e94(0xed)+_0x16c506['id']),await handleSDKOutput([_0x16c506],_0xa6c9ba),0x0;}}export class SegmentViewCommand extends BaseCommand{[a37_0x372c5a(0x15f)]=a37_0x372c5a(0xf6);[a37_0x372c5a(0x118)]='Show\x20folder\x20or\x20child\x20segment\x20details';async[a37_0x372c5a(0x17a)](_0x52bc24){const _0x1395da=a37_0x372c5a,{options:_0x497138,args:_0x44aff0,tdx:_0x3ca867}=_0x52bc24,_0x1aa017=_0x44aff0[0x0];if(!_0x1aa017)return console[_0x1395da(0xe1)](_0x1395da(0xfd)),console[_0x1395da(0xe1)](_0x1395da(0x11f)),console[_0x1395da(0xe1)](_0x1395da(0x107)),console[_0x1395da(0xe1)](_0x1395da(0xe4)),console[_0x1395da(0xe1)](_0x1395da(0x180)),console[_0x1395da(0xe1)](_0x1395da(0x108)),console[_0x1395da(0xe1)](_0x1395da(0x178)),console[_0x1395da(0xe1)](_0x1395da(0x117)),console[_0x1395da(0xe1)](_0x1395da(0x126)),console[_0x1395da(0xe1)](_0x1395da(0x13b)),0x1;try{const _0x416838=_0x497138[_0x1395da(0x123)],_0x1f70f4=await resolveSegmentTarget(_0x1aa017,_0x416838,_0x497138[_0x1395da(0x10a)]);_0x497138[_0x1395da(0x10a)]&&console[_0x1395da(0xe1)]('Target\x20path:\x20'+_0x1f70f4);const _0x3a12e0=await withSpinner('Resolving\x20\x27'+_0x1aa017+_0x1395da(0x110),()=>_0x3ca867['segment']['resolvePathToResource'](_0x1f70f4),{'verbose':_0x497138[_0x1395da(0x10a)]}),_0x478e7c=_0x3a12e0[_0x1395da(0x167)];_0x497138[_0x1395da(0x10a)]&&(console[_0x1395da(0xe1)](_0x1395da(0xf2)+_0x478e7c[_0x1395da(0x149)]),console[_0x1395da(0xe1)]('Parent\x20ID:\x20'+_0x478e7c[_0x1395da(0x14a)]),_0x478e7c[_0x1395da(0x12b)]&&console[_0x1395da(0xe1)]('Folder\x20ID:\x20'+_0x478e7c[_0x1395da(0x12b)]),_0x478e7c[_0x1395da(0x160)]&&console[_0x1395da(0xe1)]('Segment\x20ID:\x20'+_0x478e7c[_0x1395da(0x160)]));if(_0x497138[_0x1395da(0x112)]){if(_0x478e7c[_0x1395da(0x149)]===_0x1395da(0x16f))return console[_0x1395da(0xe1)](_0x1395da(0x179)),0x1;if(_0x478e7c['type']===_0x1395da(0xf9))return console[_0x1395da(0xe1)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x1395da(0xe1)](_0x1395da(0x134)),0x1;if(!_0x478e7c[_0x1395da(0x160)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x1395da(0x116));const _0x4c0c49=getConsoleNextUrl(_0x497138[_0x1395da(0x16c)],_0x1395da(0x171)+_0x478e7c[_0x1395da(0x14a)]+_0x1395da(0xeb)+_0x478e7c['segmentId']);return console['error'](a37_0x4f23cf['green']('✔')+_0x1395da(0x13c)+a37_0x4f23cf[_0x1395da(0x164)](_0x4c0c49)),openBrowser(_0x4c0c49),0x0;}if(_0x478e7c[_0x1395da(0x149)]===_0x1395da(0x16f)){if(!_0x478e7c[_0x1395da(0x12b)])throw new SDKError(ErrorCode[_0x1395da(0x16a)],_0x1395da(0x131));const _0x3ac412=await withSpinner('Fetching\x20folder\x20details...',()=>_0x3ca867[_0x1395da(0x121)]['getFolder'](_0x478e7c[_0x1395da(0x12b)]),{'verbose':_0x497138['verbose']});await handleSingleObjectOutput(_0x3ac412[_0x1395da(0x167)],_0x497138);}else{if(_0x478e7c['type']==='segment'){if(!_0x478e7c['segmentId'])throw new SDKError(ErrorCode[_0x1395da(0x135)],_0x1395da(0x116));const _0x3b3718=await withSpinner(_0x1395da(0xfa),()=>_0x3ca867[_0x1395da(0x121)][_0x1395da(0x119)](_0x478e7c[_0x1395da(0x14a)],_0x478e7c['segmentId']),{'verbose':_0x497138[_0x1395da(0x10a)]}),_0x4e1b4f=getConsoleNextUrl(_0x497138[_0x1395da(0x16c)],'/app/ps/'+_0x478e7c[_0x1395da(0x14a)]+_0x1395da(0xeb)+_0x478e7c['segmentId']),_0x30918f=_0x3b3718[_0x1395da(0x167)];_0x30918f['url']=_0x4e1b4f,await handleSingleObjectOutput(_0x30918f,_0x497138);}else return console[_0x1395da(0xe1)]('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console['error'](_0x1395da(0xf3)),0x1;}return 0x0;}catch(_0x567a83){if(_0x567a83 instanceof SDKError)return console[_0x1395da(0xe1)](_0x1395da(0x13f)+_0x567a83['message']),_0x567a83[_0x1395da(0x11e)]&&console[_0x1395da(0xe1)]('\x20\x20Cause:\x20'+_0x567a83[_0x1395da(0x11e)]),0x1;throw _0x567a83;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']=a37_0x372c5a(0x173);[a37_0x372c5a(0x118)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async[a37_0x372c5a(0x17a)](_0x341602){const _0x340ad6=a37_0x372c5a,{options:_0x228d0b,args:_0x15283f,tdx:_0x44f6c7}=_0x341602,_0x3ce9aa=_0x15283f[0x0];if(!_0x3ce9aa)return console[_0x340ad6(0xe1)](_0x340ad6(0x151)),console['error'](_0x340ad6(0x168)),console['error'](_0x340ad6(0xe5)),console[_0x340ad6(0xe1)](_0x340ad6(0x108)),console[_0x340ad6(0xe1)](_0x340ad6(0xee)),console[_0x340ad6(0xe1)](_0x340ad6(0x156)),0x1;try{const _0x587732=_0x228d0b[_0x340ad6(0x123)],_0x1689ab=await resolveSegmentTarget(_0x3ce9aa,_0x587732,_0x228d0b[_0x340ad6(0x10a)]);_0x228d0b[_0x340ad6(0x10a)]&&console['error']('Target\x20path:\x20'+_0x1689ab);const _0xe45030=await withSpinner(_0x340ad6(0xfc)+_0x3ce9aa+_0x340ad6(0x110),()=>_0x44f6c7[_0x340ad6(0x121)][_0x340ad6(0x14c)](_0x1689ab),{'verbose':_0x228d0b[_0x340ad6(0x10a)]}),_0x49662b=_0xe45030[_0x340ad6(0x167)];_0x228d0b[_0x340ad6(0x10a)]&&(console[_0x340ad6(0xe1)](_0x340ad6(0xf2)+_0x49662b['type']),console[_0x340ad6(0xe1)](_0x340ad6(0x105)+_0x49662b[_0x340ad6(0x14a)]));if(_0x49662b[_0x340ad6(0x149)]===_0x340ad6(0x16f))return console[_0x340ad6(0xe1)](_0x340ad6(0x153)),console['error'](_0x340ad6(0x162)),0x1;if(_0x49662b['type']===_0x340ad6(0xf9))return console[_0x340ad6(0xe1)](_0x340ad6(0x122)),console[_0x340ad6(0xe1)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x49662b[_0x340ad6(0x160)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x340ad6(0x116));const _0x15b322=await withSpinner(_0x340ad6(0xe7),()=>_0x44f6c7['segment']['getSegmentSQL'](_0x49662b[_0x340ad6(0x14a)],_0x49662b['segmentId']),{'verbose':_0x228d0b[_0x340ad6(0x10a)]}),_0x4786b5=_0x15b322[_0x340ad6(0x167)],_0x25124b=await executeSchemaQuery(_0x4786b5,_0x44f6c7,_0x228d0b);return await handleQueryOutput(_0x25124b,_0x228d0b),0x0;}catch(_0x52e70d){if(_0x52e70d instanceof SDKError)return console[_0x340ad6(0xe1)](_0x340ad6(0x13f)+_0x52e70d[_0x340ad6(0x176)]),_0x52e70d[_0x340ad6(0x11e)]&&console[_0x340ad6(0xe1)](_0x340ad6(0x10f)+_0x52e70d['cause']),0x1;throw _0x52e70d;}}}
@@ -1 +1 @@
1
- function a38_0x2934(){const _0x5c275f=['Parent:\x20','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','segments','resolvePathToResource','segmentPath','createSegment','Create\x20child\x20segment\x20with\x20filtering\x20rules','segment:create','521525rkYMyb','330323JvaGpD','resolveParentId','Segment\x20name:\x20','45273mAVThy','Target\x20path:\x20','folder','rule','name','ruleFile','Creating\x20segment\x20\x27','yellow','description','data','noCountPopulation','parent','kind','2684331bZacCa','177564TjTeTN','✔\x20Created\x20segment\x20\x27','69000zJEOuO','error','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','folderId','length','Resolved\x20relative\x20path\x20to:\x20','4515480AKalEr','verbose','12bDZPcq','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Resolving\x20folder\x20path\x20\x27','execute','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','4nbDsTs','resolveFolderId','8ILgRQU','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','segment','\x20\x20\x20Path:\x20','Resolving\x20parent\x20segment\x20\x27','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','\x27...','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','Parent\x20path:\x20','\x27\x20with\x20ID:\x20','invisible','Site:\x20','Resolved\x20folder\x20ID:\x20'];a38_0x2934=function(){return _0x5c275f;};return a38_0x2934();}const a38_0x472962=a38_0x3e6e;(function(_0x432bc7,_0x4e33ab){const _0x302e19=a38_0x3e6e,_0x5a5d71=_0x432bc7();while(!![]){try{const _0x163733=-parseInt(_0x302e19(0x100))/0x1+-parseInt(_0x302e19(0x10d))/0x2*(parseInt(_0x302e19(0xf0))/0x3)+-parseInt(_0x302e19(0xfe))/0x4+parseInt(_0x302e19(0xec))/0x5*(parseInt(_0x302e19(0x108))/0x6)+-parseInt(_0x302e19(0xed))/0x7+-parseInt(_0x302e19(0xd6))/0x8*(parseInt(_0x302e19(0xfd))/0x9)+parseInt(_0x302e19(0x106))/0xa;if(_0x163733===_0x4e33ab)break;else _0x5a5d71['push'](_0x5a5d71['shift']());}catch(_0x42cea9){_0x5a5d71['push'](_0x5a5d71['shift']());}}}(a38_0x2934,0x29c81));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x30eac4 from'chalk';function a38_0x3e6e(_0xc4e38c,_0x5e40f7){_0xc4e38c=_0xc4e38c-0xd5;const _0x2934ae=a38_0x2934();let _0x3e6e6e=_0x2934ae[_0xc4e38c];return _0x3e6e6e;}export class SegmentCreateCommand extends BaseCommand{[a38_0x472962(0xf4)]=a38_0x472962(0xeb);[a38_0x472962(0xf8)]=a38_0x472962(0xea);async[a38_0x472962(0x10b)](_0x9fb2e7){const _0x3873a6=a38_0x472962;console[_0x3873a6(0x101)](a38_0x30eac4[_0x3873a6(0xf7)](_0x3873a6(0xd7))),console['error'](a38_0x30eac4['yellow'](_0x3873a6(0x109)));const {options:_0x39bdb1,args:_0x561585,tdx:_0x60e7a3}=_0x9fb2e7,_0x3a093a=_0x39bdb1;if(_0x561585[_0x3873a6(0x104)]===0x0)return console[_0x3873a6(0x101)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x3873a6(0x101)](_0x3873a6(0xe5)),console[_0x3873a6(0x101)]('Examples:'),console['error'](_0x3873a6(0xde)),console[_0x3873a6(0x101)](_0x3873a6(0xd8)),console['error']('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x153a0e=_0x561585[0x0],_0x20a552=_0x39bdb1[_0x3873a6(0xe8)];let _0xa56493=_0x153a0e;_0x20a552&&!_0x153a0e['includes']('/')&&(_0xa56493=_0x20a552+'/'+_0x153a0e,_0x3a093a['verbose']&&console['error'](_0x3873a6(0x105)+_0xa56493));const _0x34f65d=parsePath(_0xa56493);if(_0x34f65d['segments'][_0x3873a6(0x104)]<0x2)return console['error'](_0x3873a6(0xdc)),console[_0x3873a6(0x101)](_0x3873a6(0x10c)),0x1;const _0x4fdcf7=_0x34f65d[_0x3873a6(0xe6)][0x0],_0x25f7d6=getBaseName(_0xa56493),_0x1c6684=getParentPath(_0xa56493);_0x3a093a[_0x3873a6(0x107)]&&(console['error'](_0x3873a6(0xe2)+_0x3a093a['site']),console['error'](_0x3873a6(0xf1)+_0xa56493),console[_0x3873a6(0x101)](_0x3873a6(0xe4)+_0x4fdcf7),console[_0x3873a6(0x101)](_0x3873a6(0xef)+_0x25f7d6),console[_0x3873a6(0x101)](_0x3873a6(0xdf)+_0x1c6684));const _0x2b13ab=await withSpinner(_0x3873a6(0xdb)+_0x4fdcf7+_0x3873a6(0xdd),()=>_0x60e7a3[_0x3873a6(0xd9)][_0x3873a6(0xee)](_0x4fdcf7),{'verbose':_0x3a093a[_0x3873a6(0x107)]}),_0x23f871=_0x2b13ab[_0x3873a6(0xf9)];let _0x4288eb;if(_0x34f65d[_0x3873a6(0xe6)][_0x3873a6(0x104)]>0x2){const _0x36e5a4=await withSpinner(_0x3873a6(0x10a)+_0x1c6684+_0x3873a6(0xdd),()=>_0x60e7a3[_0x3873a6(0xd9)][_0x3873a6(0xe7)](_0x1c6684),{'verbose':_0x3a093a['verbose']}),_0x561b4b=_0x36e5a4['data'];if(_0x561b4b['type']!==_0x3873a6(0xf2)&&_0x561b4b['type']!==_0x3873a6(0xfb))return console[_0x3873a6(0x101)](_0x3873a6(0x102)),0x1;_0x4288eb=_0x561b4b[_0x3873a6(0x103)];}else{if(_0x3a093a[_0x3873a6(0xf2)]){const _0x574855=await withSpinner('Resolving\x20folder\x20\x27'+_0x3a093a[_0x3873a6(0xf2)]+_0x3873a6(0xdd),()=>_0x60e7a3[_0x3873a6(0xd9)][_0x3873a6(0xd5)](_0x23f871,_0x3a093a['folder']),{'verbose':_0x3a093a[_0x3873a6(0x107)]});_0x4288eb=_0x574855[_0x3873a6(0xf9)];}}_0x3a093a[_0x3873a6(0x107)]&&_0x4288eb&&console[_0x3873a6(0x101)](_0x3873a6(0xe3)+_0x4288eb);const _0x3c251c=await loadJSONFromOptions(_0x3a093a[_0x3873a6(0xf3)],_0x3a093a[_0x3873a6(0xf5)]),_0x5a40a7={'name':_0x25f7d6,'description':_0x3a093a['description'],'rule':_0x3c251c,'kind':_0x3a093a[_0x3873a6(0xfc)]!==undefined?parseInt(_0x3a093a[_0x3873a6(0xfc)],0xa):undefined,'isVisible':_0x3a093a[_0x3873a6(0xe1)]?![]:undefined,'segmentFolderId':_0x4288eb,'countPopulation':_0x3a093a[_0x3873a6(0xfa)]?![]:undefined},_0x12c84e=await withSpinner(_0x3873a6(0xf6)+_0x25f7d6+'\x27...',()=>_0x60e7a3[_0x3873a6(0xd9)][_0x3873a6(0xe9)](_0x23f871,_0x5a40a7),{'verbose':_0x3a093a[_0x3873a6(0x107)]}),_0x30b4c3=_0x12c84e[_0x3873a6(0xf9)];return console[_0x3873a6(0x101)](_0x3873a6(0xff)+_0x30b4c3['name']+_0x3873a6(0xe0)+_0x30b4c3['id']),_0xa56493!==_0x153a0e&&console['error'](_0x3873a6(0xda)+_0xa56493),await handleSDKOutput([_0x30b4c3],_0x3a093a),0x0;}}
1
+ const a38_0x44a9b2=a38_0x285c;function a38_0x2607(){const _0x5f15c3=['380730xlDWYu','\x20\x20\x20Path:\x20','11EzadMw','description','5003845wZbDjV','resolvePathToResource','resolveFolderId','Parent:\x20','Parent\x20path:\x20','invisible','length','name','Segment\x20name:\x20','segmentPath','Resolving\x20folder\x20\x27','data','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','segment','8RweneJ','80vIsXfN','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','3938634raeBrd','Resolving\x20folder\x20path\x20\x27','\x27...','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','noCountPopulation','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','yellow','2110884okaJtg','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','✔\x20Created\x20segment\x20\x27','9027130QoLFNM','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','ruleFile','segments','rule','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','includes','19964ZImcEp','verbose','site','21VweHQM','414512ntpjuJ','Resolved\x20relative\x20path\x20to:\x20','Creating\x20segment\x20\x27','type','Resolved\x20folder\x20ID:\x20','Target\x20path:\x20','error','Examples:','kind','folder'];a38_0x2607=function(){return _0x5f15c3;};return a38_0x2607();}(function(_0x2768ec,_0x4cb6cf){const _0x10b181=a38_0x285c,_0x5df91b=_0x2768ec();while(!![]){try{const _0x51cea3=-parseInt(_0x10b181(0x1c1))/0x1*(-parseInt(_0x10b181(0x1d6))/0x2)+parseInt(_0x10b181(0x1d9))/0x3*(parseInt(_0x10b181(0x1da))/0x4)+-parseInt(_0x10b181(0x1e4))/0x5+-parseInt(_0x10b181(0x1ca))/0x6+-parseInt(_0x10b181(0x1e8))/0x7*(-parseInt(_0x10b181(0x1c0))/0x8)+-parseInt(_0x10b181(0x1c3))/0x9+parseInt(_0x10b181(0x1cd))/0xa*(-parseInt(_0x10b181(0x1e6))/0xb);if(_0x51cea3===_0x4cb6cf)break;else _0x5df91b['push'](_0x5df91b['shift']());}catch(_0x298778){_0x5df91b['push'](_0x5df91b['shift']());}}}(a38_0x2607,0x72ddc));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a38_0x47b5f3 from'chalk';function a38_0x285c(_0xf38703,_0x21a0b3){_0xf38703=_0xf38703-0x1bc;const _0x2607b7=a38_0x2607();let _0x285c99=_0x2607b7[_0xf38703];return _0x285c99;}export class SegmentCreateCommand extends BaseCommand{[a38_0x44a9b2(0x1ef)]='segment:create';['description']='Create\x20child\x20segment\x20with\x20filtering\x20rules';async['execute'](_0x2a4e3f){const _0x5d6ae8=a38_0x44a9b2;console[_0x5d6ae8(0x1e0)](a38_0x47b5f3[_0x5d6ae8(0x1c9)](_0x5d6ae8(0x1cb))),console['error'](a38_0x47b5f3[_0x5d6ae8(0x1c9)](_0x5d6ae8(0x1c2)));const {options:_0x24a0bd,args:_0x3a0ce5,tdx:_0x33ce34}=_0x2a4e3f,_0x116dfb=_0x24a0bd;if(_0x3a0ce5[_0x5d6ae8(0x1ee)]===0x0)return console[_0x5d6ae8(0x1e0)](_0x5d6ae8(0x1c8)),console[_0x5d6ae8(0x1e0)](_0x5d6ae8(0x1d4)),console[_0x5d6ae8(0x1e0)](_0x5d6ae8(0x1e1)),console['error'](_0x5d6ae8(0x1be)),console['error']('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console[_0x5d6ae8(0x1e0)](_0x5d6ae8(0x1ce)),0x1;const _0x376c28=_0x3a0ce5[0x0],_0x364303=_0x24a0bd[_0x5d6ae8(0x1f1)];let _0x3df31a=_0x376c28;_0x364303&&!_0x376c28[_0x5d6ae8(0x1d5)]('/')&&(_0x3df31a=_0x364303+'/'+_0x376c28,_0x116dfb[_0x5d6ae8(0x1d7)]&&console[_0x5d6ae8(0x1e0)](_0x5d6ae8(0x1db)+_0x3df31a));const _0x27d9fd=parsePath(_0x3df31a);if(_0x27d9fd[_0x5d6ae8(0x1d1)][_0x5d6ae8(0x1ee)]<0x2)return console['error'](_0x5d6ae8(0x1cf)),console[_0x5d6ae8(0x1e0)](_0x5d6ae8(0x1c6)),0x1;const _0x5f3969=_0x27d9fd[_0x5d6ae8(0x1d1)][0x0],_0x46c6af=getBaseName(_0x3df31a),_0x120f9d=getParentPath(_0x3df31a);_0x116dfb['verbose']&&(console[_0x5d6ae8(0x1e0)]('Site:\x20'+_0x116dfb[_0x5d6ae8(0x1d8)]),console['error'](_0x5d6ae8(0x1df)+_0x3df31a),console[_0x5d6ae8(0x1e0)](_0x5d6ae8(0x1eb)+_0x5f3969),console['error'](_0x5d6ae8(0x1f0)+_0x46c6af),console[_0x5d6ae8(0x1e0)](_0x5d6ae8(0x1ec)+_0x120f9d));const _0x3e82d2=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5f3969+_0x5d6ae8(0x1c5),()=>_0x33ce34['segment']['resolveParentId'](_0x5f3969),{'verbose':_0x116dfb['verbose']}),_0x2e7e64=_0x3e82d2[_0x5d6ae8(0x1bd)];let _0x52844c;if(_0x27d9fd[_0x5d6ae8(0x1d1)][_0x5d6ae8(0x1ee)]>0x2){const _0x2257d7=await withSpinner(_0x5d6ae8(0x1c4)+_0x120f9d+_0x5d6ae8(0x1c5),()=>_0x33ce34['segment'][_0x5d6ae8(0x1e9)](_0x120f9d),{'verbose':_0x116dfb['verbose']}),_0x48f948=_0x2257d7['data'];if(_0x48f948['type']!=='folder'&&_0x48f948[_0x5d6ae8(0x1dd)]!=='parent')return console[_0x5d6ae8(0x1e0)](_0x5d6ae8(0x1d3)),0x1;_0x52844c=_0x48f948['folderId'];}else{if(_0x116dfb[_0x5d6ae8(0x1e3)]){const _0x58736e=await withSpinner(_0x5d6ae8(0x1bc)+_0x116dfb[_0x5d6ae8(0x1e3)]+'\x27...',()=>_0x33ce34[_0x5d6ae8(0x1bf)][_0x5d6ae8(0x1ea)](_0x2e7e64,_0x116dfb['folder']),{'verbose':_0x116dfb['verbose']});_0x52844c=_0x58736e['data'];}}_0x116dfb['verbose']&&_0x52844c&&console[_0x5d6ae8(0x1e0)](_0x5d6ae8(0x1de)+_0x52844c);const _0x3ff0cc=await loadJSONFromOptions(_0x116dfb[_0x5d6ae8(0x1d2)],_0x116dfb[_0x5d6ae8(0x1d0)]),_0x3b1e24={'name':_0x46c6af,'description':_0x116dfb[_0x5d6ae8(0x1e7)],'rule':_0x3ff0cc,'kind':_0x116dfb[_0x5d6ae8(0x1e2)]!==undefined?parseInt(_0x116dfb[_0x5d6ae8(0x1e2)],0xa):undefined,'isVisible':_0x116dfb[_0x5d6ae8(0x1ed)]?![]:undefined,'segmentFolderId':_0x52844c,'countPopulation':_0x116dfb[_0x5d6ae8(0x1c7)]?![]:undefined},_0x46fde9=await withSpinner(_0x5d6ae8(0x1dc)+_0x46c6af+_0x5d6ae8(0x1c5),()=>_0x33ce34[_0x5d6ae8(0x1bf)]['createSegment'](_0x2e7e64,_0x3b1e24),{'verbose':_0x116dfb[_0x5d6ae8(0x1d7)]}),_0x439de2=_0x46fde9[_0x5d6ae8(0x1bd)];return console[_0x5d6ae8(0x1e0)](_0x5d6ae8(0x1cc)+_0x439de2[_0x5d6ae8(0x1ef)]+'\x27\x20with\x20ID:\x20'+_0x439de2['id']),_0x3df31a!==_0x376c28&&console[_0x5d6ae8(0x1e0)](_0x5d6ae8(0x1e5)+_0x3df31a),await handleSDKOutput([_0x439de2],_0x116dfb),0x0;}}