@treasuredata/tdx 2026.3.20 → 2026.3.21

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 (223) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.d.ts +1 -1
  4. package/dist/cli-categories.js +1 -1
  5. package/dist/cli-categories.js.map +1 -1
  6. package/dist/cli.d.ts.map +1 -1
  7. package/dist/cli.js +1 -1
  8. package/dist/cli.js.map +1 -1
  9. package/dist/commands/activations.js +1 -1
  10. package/dist/commands/agent-command.js +1 -1
  11. package/dist/commands/agent-test-command.js +1 -1
  12. package/dist/commands/api-command.js +1 -1
  13. package/dist/commands/auth-command.js +1 -1
  14. package/dist/commands/auth-login-command.js +1 -1
  15. package/dist/commands/chat-command.js +1 -1
  16. package/dist/commands/claude-command.js +1 -1
  17. package/dist/commands/claude-statusline-command.js +1 -1
  18. package/dist/commands/claude-usage-command.js +1 -1
  19. package/dist/commands/command.js +1 -1
  20. package/dist/commands/connection-command.js +1 -1
  21. package/dist/commands/databases.js +1 -1
  22. package/dist/commands/delivery-command.js +1 -1
  23. package/dist/commands/describe.js +1 -1
  24. package/dist/commands/engage-campaign-pull-command.js +1 -1
  25. package/dist/commands/engage-campaign-push-command.js +1 -1
  26. package/dist/commands/engage-campaign-validate-command.js +1 -1
  27. package/dist/commands/engage-command.js +1 -1
  28. package/dist/commands/engage-template-pull-command.js +1 -1
  29. package/dist/commands/engage-template-push-command.js +1 -1
  30. package/dist/commands/engage-template-validate-command.js +1 -1
  31. package/dist/commands/job-command.js +1 -1
  32. package/dist/commands/journey-command.js +1 -1
  33. package/dist/commands/journey-validate-command.js +1 -1
  34. package/dist/commands/llm-command.js +1 -1
  35. package/dist/commands/mcp-command.js +1 -1
  36. package/dist/commands/parent-segment-command.js +1 -1
  37. package/dist/commands/policy-command.d.ts +33 -0
  38. package/dist/commands/policy-command.d.ts.map +1 -0
  39. package/dist/commands/policy-command.js +1 -0
  40. package/dist/commands/policy-command.js.map +1 -0
  41. package/dist/commands/profile-command.js +1 -1
  42. package/dist/commands/profiles-command.js +1 -1
  43. package/dist/commands/query-command.js +1 -1
  44. package/dist/commands/schedule-command.js +1 -1
  45. package/dist/commands/segment-command.js +1 -1
  46. package/dist/commands/segment-create-command.js +1 -1
  47. package/dist/commands/segment-fields-command.js +1 -1
  48. package/dist/commands/segment-pull-command.js +1 -1
  49. package/dist/commands/segment-push-command.js +1 -1
  50. package/dist/commands/segment-update-command.js +1 -1
  51. package/dist/commands/segment-use-command.js +1 -1
  52. package/dist/commands/segment-validate-command.js +1 -1
  53. package/dist/commands/segments.js +1 -1
  54. package/dist/commands/show.js +1 -1
  55. package/dist/commands/status-command.js +1 -1
  56. package/dist/commands/tables.js +1 -1
  57. package/dist/commands/unset-command.js +1 -1
  58. package/dist/commands/upgrade-command.js +1 -1
  59. package/dist/commands/use-command.js +1 -1
  60. package/dist/commands/user-command.js +1 -1
  61. package/dist/commands/workflow-command.js +1 -1
  62. package/dist/core/auth.js +1 -1
  63. package/dist/core/command-output.js +1 -1
  64. package/dist/core/config.js +1 -1
  65. package/dist/core/connection-cache.js +1 -1
  66. package/dist/core/constants.js +1 -1
  67. package/dist/core/credential-cache.js +1 -1
  68. package/dist/core/global-context.js +1 -1
  69. package/dist/core/keychain.js +1 -1
  70. package/dist/core/oauth-keychain.js +1 -1
  71. package/dist/core/oauth.js +1 -1
  72. package/dist/core/profile.js +1 -1
  73. package/dist/core/project-config.js +1 -1
  74. package/dist/core/session.js +1 -1
  75. package/dist/core/user-cache.js +1 -1
  76. package/dist/core/version.js +1 -1
  77. package/dist/index.js +1 -1
  78. package/dist/mcp/server.js +1 -1
  79. package/dist/mcp/tools/index.js +1 -1
  80. package/dist/mcp/tools/tdx-run.js +1 -1
  81. package/dist/mcp/tools/tdx-search.js +1 -1
  82. package/dist/mcp/utils.js +1 -1
  83. package/dist/proxy/claude-usage-tracker.js +1 -1
  84. package/dist/proxy/passthrough-server.js +1 -1
  85. package/dist/proxy/sse-usage-parser.js +1 -1
  86. package/dist/sdk/agent/agent-config.js +1 -1
  87. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  88. package/dist/sdk/agent/agent-yaml.js +1 -1
  89. package/dist/sdk/agent/test/evaluator.js +1 -1
  90. package/dist/sdk/agent/test/executor.js +1 -1
  91. package/dist/sdk/agent/test/index.js +1 -1
  92. package/dist/sdk/agent/test/output.js +1 -1
  93. package/dist/sdk/agent/test/parser.js +1 -1
  94. package/dist/sdk/agent/tool-target-registry.js +1 -1
  95. package/dist/sdk/api.js +1 -1
  96. package/dist/sdk/client/cdp-api-client.js +1 -1
  97. package/dist/sdk/client/delivery-api-client.js +1 -1
  98. package/dist/sdk/client/endpoints.js +1 -1
  99. package/dist/sdk/client/engage-api-client.js +1 -1
  100. package/dist/sdk/client/http-client.js +1 -1
  101. package/dist/sdk/client/llm-api-client.js +1 -1
  102. package/dist/sdk/client/oauth-refresh.js +1 -1
  103. package/dist/sdk/client/rate-limiter.js +1 -1
  104. package/dist/sdk/client/td-api-client.js +1 -1
  105. package/dist/sdk/client/trino-api-client.js +1 -1
  106. package/dist/sdk/client/workflow-client.js +1 -1
  107. package/dist/sdk/connection-validator.js +1 -1
  108. package/dist/sdk/connection.js +1 -1
  109. package/dist/sdk/delivery.js +1 -1
  110. package/dist/sdk/engage/campaign-pull.js +1 -1
  111. package/dist/sdk/engage/campaign-push.js +1 -1
  112. package/dist/sdk/engage/campaign-validator.js +1 -1
  113. package/dist/sdk/engage/campaign-yaml.js +1 -1
  114. package/dist/sdk/engage/template-pull.js +1 -1
  115. package/dist/sdk/engage/template-push.js +1 -1
  116. package/dist/sdk/engage/template-validator.js +1 -1
  117. package/dist/sdk/engage/template-yaml.js +1 -1
  118. package/dist/sdk/engage/types/campaign-def.js +1 -1
  119. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  120. package/dist/sdk/engage/types/template-schema.js +1 -1
  121. package/dist/sdk/engage.js +1 -1
  122. package/dist/sdk/errors.js +1 -1
  123. package/dist/sdk/index.d.ts +7 -0
  124. package/dist/sdk/index.d.ts.map +1 -1
  125. package/dist/sdk/index.js +1 -1
  126. package/dist/sdk/index.js.map +1 -1
  127. package/dist/sdk/io/index.js +1 -1
  128. package/dist/sdk/io/node-filesystem.js +1 -1
  129. package/dist/sdk/job.js +1 -1
  130. package/dist/sdk/journey.js +1 -1
  131. package/dist/sdk/llm/chat-cache.js +1 -1
  132. package/dist/sdk/llm/index.js +1 -1
  133. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  134. package/dist/sdk/llm/model-factors.js +1 -1
  135. package/dist/sdk/personalization.js +1 -1
  136. package/dist/sdk/policy.d.ts +41 -0
  137. package/dist/sdk/policy.d.ts.map +1 -0
  138. package/dist/sdk/policy.js +1 -0
  139. package/dist/sdk/policy.js.map +1 -0
  140. package/dist/sdk/query/index.js +1 -1
  141. package/dist/sdk/query/sql-parser.js +1 -1
  142. package/dist/sdk/realtime.js +1 -1
  143. package/dist/sdk/schedule.js +1 -1
  144. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  145. package/dist/sdk/segment/fields-display.js +1 -1
  146. package/dist/sdk/segment/file-discovery.js +1 -1
  147. package/dist/sdk/segment/journey-utils.js +1 -1
  148. package/dist/sdk/segment/journey-validator.js +1 -1
  149. package/dist/sdk/segment/journey-yaml.js +1 -1
  150. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  151. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  152. package/dist/sdk/segment/pull-workflow.js +1 -1
  153. package/dist/sdk/segment/push-recovery.js +1 -1
  154. package/dist/sdk/segment/push-workflow.js +1 -1
  155. package/dist/sdk/segment/resolution-context.js +1 -1
  156. package/dist/sdk/segment/segment-path-parser.js +1 -1
  157. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  158. package/dist/sdk/segment/segment-validator.js +1 -1
  159. package/dist/sdk/segment/target-resolution.js +1 -1
  160. package/dist/sdk/segment/tdx-config.js +1 -1
  161. package/dist/sdk/segment/types/activation-schema.js +1 -1
  162. package/dist/sdk/segment/types/journey-def.js +1 -1
  163. package/dist/sdk/segment/types/journey-schema.js +1 -1
  164. package/dist/sdk/segment/types/segment-def.js +1 -1
  165. package/dist/sdk/segment/types/segment-schema.js +1 -1
  166. package/dist/sdk/segment/validate-files.js +1 -1
  167. package/dist/sdk/segment/yaml-validator.js +1 -1
  168. package/dist/sdk/segment.js +1 -1
  169. package/dist/sdk/types/index.d.ts +1 -0
  170. package/dist/sdk/types/index.d.ts.map +1 -1
  171. package/dist/sdk/types/index.js +1 -1
  172. package/dist/sdk/types/index.js.map +1 -1
  173. package/dist/sdk/types/policy.d.ts +58 -0
  174. package/dist/sdk/types/policy.d.ts.map +1 -0
  175. package/dist/sdk/types/policy.js +1 -0
  176. package/dist/sdk/types/policy.js.map +1 -0
  177. package/dist/sdk/types/progress.js +1 -1
  178. package/dist/sdk/user.js +1 -1
  179. package/dist/sdk/util/format-detector.js +1 -1
  180. package/dist/sdk/util/formatters.js +1 -1
  181. package/dist/sdk/util/index.js +1 -1
  182. package/dist/sdk/util/paginate.js +1 -1
  183. package/dist/sdk/util/tree-formatter.js +1 -1
  184. package/dist/sdk/workflow/archive-validation.js +1 -1
  185. package/dist/sdk/workflow/clone-workflow.js +1 -1
  186. package/dist/sdk/workflow/index.js +1 -1
  187. package/dist/sdk/workflow/pull-workflow.js +1 -1
  188. package/dist/sdk/workflow/push-workflow.js +1 -1
  189. package/dist/sdk/workflow/tdx-config.js +1 -1
  190. package/dist/sdk/workflow/workflow-utils.js +1 -1
  191. package/dist/test-utils/command-runner.js +1 -1
  192. package/dist/test-utils/factories.js +1 -1
  193. package/dist/test-utils/fixtures.js +1 -1
  194. package/dist/test-utils/http-mock.js +1 -1
  195. package/dist/test-utils/index.js +1 -1
  196. package/dist/utils/async.js +1 -1
  197. package/dist/utils/colors.js +1 -1
  198. package/dist/utils/diff.js +1 -1
  199. package/dist/utils/file-permissions.js +1 -1
  200. package/dist/utils/file-reader.js +1 -1
  201. package/dist/utils/github-releases.js +1 -1
  202. package/dist/utils/global-cache.js +1 -1
  203. package/dist/utils/json-loader.js +1 -1
  204. package/dist/utils/local-cache.js +1 -1
  205. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  206. package/dist/utils/logger/formatters/index.js +1 -1
  207. package/dist/utils/logger/handlers/console-handler.js +1 -1
  208. package/dist/utils/logger/handlers/file-handler.js +1 -1
  209. package/dist/utils/logger/handlers/index.js +1 -1
  210. package/dist/utils/logger/handlers/null-handler.js +1 -1
  211. package/dist/utils/logger/index.js +1 -1
  212. package/dist/utils/logger/logger.js +1 -1
  213. package/dist/utils/logger/types.js +1 -1
  214. package/dist/utils/option-validation.js +1 -1
  215. package/dist/utils/process.js +1 -1
  216. package/dist/utils/prompt.js +1 -1
  217. package/dist/utils/spinner.js +1 -1
  218. package/dist/utils/sse-parser.js +1 -1
  219. package/dist/utils/string-utils.js +1 -1
  220. package/dist/utils/table-ref-parser.js +1 -1
  221. package/dist/utils/tdx-logger.js +1 -1
  222. package/dist/utils/version-check.js +1 -1
  223. package/package.json +1 -1
@@ -1 +1 @@
1
- const a33_0x49afb9=a33_0xf527;(function(_0x5f45d0,_0x54b7a3){const _0x2008f6=a33_0xf527,_0x4c2db3=_0x5f45d0();while(!![]){try{const _0x3bac8b=parseInt(_0x2008f6(0x84))/0x1+-parseInt(_0x2008f6(0x91))/0x2+parseInt(_0x2008f6(0x7a))/0x3+-parseInt(_0x2008f6(0x96))/0x4+parseInt(_0x2008f6(0xa6))/0x5+-parseInt(_0x2008f6(0x83))/0x6+-parseInt(_0x2008f6(0xa4))/0x7;if(_0x3bac8b===_0x54b7a3)break;else _0x4c2db3['push'](_0x4c2db3['shift']());}catch(_0xf745a){_0x4c2db3['push'](_0x4c2db3['shift']());}}}(a33_0x5b78,0xb1fa3));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a33_0x5b78(){const _0x11ac38=['elapsedTimeMillis','processedRows','\x0aAll\x20results\x20saved\x20to\x20','state','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','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','Statement\x20','validate','database','SQL:\x20','site','description','335629IhHLJG','originalMessage','3581670JiiknJ','Catalog:\x20','setJobId','Query\x20completed:\x20Processed\x20','query','2396346QaGyRl','execute','\x20splits','Schema:\x20','\x20rows\x20','Executing\x20query...','information_schema','file','\x20[Job\x20ID:\x20','7483638euCrro','928791bThAHc','length','Executing\x20query\x20[','No\x20SQL\x20provided','data','setPhase','catalog','...','completedSplits','join','options','totalSplits','error','355042gpGNmK','message','args','verbose','output','968684fqbjEq','push'];a33_0x5b78=function(){return _0x11ac38;};return a33_0x5b78();}import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';function a33_0xf527(_0x2d6ba0,_0x3fb4c1){_0x2d6ba0=_0x2d6ba0-0x76;const _0x5b78fd=a33_0x5b78();let _0xf5277f=_0x5b78fd[_0x2d6ba0];return _0xf5277f;}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a33_0x49afb9(0x79);[a33_0x49afb9(0xa3)]='Run\x20Trino\x20queries\x20(streaming)';async[a33_0x49afb9(0x7b)](_0x5b3dc7){const _0x38c416=a33_0x49afb9,{options:_0x11c8da,args:_0x23fa5f,tdx:_0x4a3f40}=_0x5b3dc7,_0x2d3638={..._0x11c8da,'limitStructuredFormats':!![]},_0x103a12=_0x23fa5f[0x0],_0xd98356=_0x11c8da[_0x38c416(0x81)];let _0x363316;try{if(_0xd98356)_0x363316=readSqlStatementsFromFile(_0xd98356);else{if(_0x103a12==='-')_0x363316=await readSqlStatementsFromStdin();else{if(_0x103a12&&isSqlFilePath(_0x103a12))_0x363316=readSqlStatementsFromFile(_0x103a12);else{if(_0x103a12)_0x363316=splitSqlStatements(_0x103a12);else throw new Error(_0x38c416(0x87));}}}}catch(_0x32e10e){return console['error']('Error:\x20'+_0x32e10e['message']),0x1;}const _0x21b7c0=_0x11c8da[_0x38c416(0xa0)]||_0x38c416(0x80),_0x4c4a16=_0x11c8da[_0x38c416(0x8a)];try{const _0x9e68f=[],_0x10bf19=!!_0x11c8da['output'];for(let _0x5616cc=0x0;_0x5616cc<_0x363316[_0x38c416(0x85)];_0x5616cc++){const _0x1fec73=_0x363316[_0x5616cc],_0x2b2f8c=_0x5616cc+0x1,_0x1010b2=_0x363316[_0x38c416(0x85)],_0x29c682=_0x1010b2>0x1;_0x11c8da[_0x38c416(0x94)]&&(console[_0x38c416(0x90)]('\x0a'+(_0x29c682?_0x38c416(0x9e)+_0x2b2f8c+'/'+_0x1010b2+':':'')),console[_0x38c416(0x90)]('Site:\x20'+_0x11c8da[_0x38c416(0xa2)]),console[_0x38c416(0x90)](_0x38c416(0x76)+(_0x4c4a16||'td')),console['error'](_0x38c416(0x7d)+_0x21b7c0),console[_0x38c416(0x90)](_0x38c416(0xa1)+_0x1fec73));const _0x489a3b=_0x29c682?'Executing\x20statement\x20'+_0x2b2f8c+'/'+_0x1010b2+_0x38c416(0x8b):_0x38c416(0x7f);try{const _0xae56c8=await withProgressSpinner(_0x489a3b,async _0x3e519c=>{const _0x532644=_0x38c416,_0x3a8f5f=await _0x4a3f40[_0x532644(0x79)][_0x532644(0x7b)](_0x1fec73,{'catalog':_0x4c4a16,'schema':_0x21b7c0,'onJobId':_0x37d777=>{const _0x425bac=_0x532644;_0x3e519c[_0x425bac(0x77)](_0x37d777);},'onProgress':_0x22c713=>{const _0x317fb3=_0x532644;_0x3e519c[_0x317fb3(0x89)](_0x317fb3(0x86)+_0x22c713[_0x317fb3(0x9b)]+']'),_0x3e519c['setExtra'](formatRows(_0x22c713[_0x317fb3(0x99)])+_0x317fb3(0x7e)+_0x22c713[_0x317fb3(0x8c)]+'/'+_0x22c713[_0x317fb3(0x8f)]+_0x317fb3(0x7c));}});return _0x3a8f5f;},{'verbose':_0x11c8da[_0x38c416(0x94)]}),_0xf4de78=_0xae56c8[_0x38c416(0x88)],_0x189db6=_0xf4de78['jobId']?_0x38c416(0x82)+_0xf4de78['jobId']+']':'',_0x47c6f8=_0x29c682?_0x38c416(0x9e)+_0x2b2f8c+'/'+_0x1010b2+'\x20-\x20':'';console['error']('✔\x20'+_0x47c6f8+_0x38c416(0x78)+formatRows(_0xf4de78['stats'][_0x38c416(0x99)])+'\x20rows\x20'+('in\x20'+formatElapsed(_0xf4de78['stats'][_0x38c416(0x98)])+_0x189db6));if(_0x29c682&&_0x10bf19){const _0x1e9e68=resolveOutputOptions(_0x2d3638),_0x1d2a7f=await formatQueryOutput(_0xf4de78,_0x1e9e68);_0x9e68f[_0x38c416(0x97)](_0x1d2a7f);}else await handleQueryOutput(_0xf4de78,_0x2d3638);}catch(_0x98e127){const _0x5d9e49=_0x29c682?'Statement\x20'+_0x2b2f8c+'/'+_0x1010b2+':\x0a':'',_0xb33dcb=_0x98e127 instanceof SDKError?_0x98e127[_0x38c416(0xa5)]:_0x98e127[_0x38c416(0x92)];return console['error'](''+_0x5d9e49+_0xb33dcb),0x1;}}if(_0x363316[_0x38c416(0x85)]>0x1&&_0x10bf19&&_0x9e68f[_0x38c416(0x85)]>0x0){const _0x5b2151=_0x9e68f[_0x38c416(0x8d)]('\x0a');writeFileSync(_0x11c8da[_0x38c416(0x95)],_0x5b2151),console[_0x38c416(0x90)](_0x38c416(0x9a)+_0x11c8da[_0x38c416(0x95)]);}return 0x0;}catch(_0x2dc6f9){throw _0x2dc6f9;}}[a33_0x49afb9(0x9f)](_0x324e44){const _0x3b3afc=a33_0x49afb9,_0x8b7f0b=_0x324e44[_0x3b3afc(0x93)][0x0],_0x2d4d7f=_0x324e44[_0x3b3afc(0x8e)][_0x3b3afc(0x81)];if(!_0x8b7f0b&&!_0x2d4d7f)return _0x3b3afc(0x9d);if(_0x8b7f0b&&_0x2d4d7f)return _0x3b3afc(0x9c);return undefined;}}
1
+ const a34_0x28e3f6=a34_0x251d;(function(_0x51ee1b,_0x30666a){const _0x2ef14c=a34_0x251d,_0x30b71b=_0x51ee1b();while(!![]){try{const _0x313383=parseInt(_0x2ef14c(0xea))/0x1*(parseInt(_0x2ef14c(0xde))/0x2)+parseInt(_0x2ef14c(0xe1))/0x3+parseInt(_0x2ef14c(0xd1))/0x4*(parseInt(_0x2ef14c(0xbf))/0x5)+parseInt(_0x2ef14c(0xe5))/0x6*(parseInt(_0x2ef14c(0xe0))/0x7)+-parseInt(_0x2ef14c(0xd8))/0x8+parseInt(_0x2ef14c(0xc2))/0x9+-parseInt(_0x2ef14c(0xd2))/0xa;if(_0x313383===_0x30666a)break;else _0x30b71b['push'](_0x30b71b['shift']());}catch(_0x7ec565){_0x30b71b['push'](_0x30b71b['shift']());}}}(a34_0x37e5,0x35858));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 a34_0x37e5(){const _0x293e42=['jobId','state','248485CdSGDB','setPhase','setJobId','398457xVpItC','\x20splits','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','args','join','length','Schema:\x20','Query\x20completed:\x20Processed\x20','Executing\x20query\x20[','validate','Executing\x20statement\x20','...','catalog','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','processedRows','16JcyawG','5828870aYsjsu','message','originalMessage','site','\x0aAll\x20results\x20saved\x20to\x20','Error:\x20','177608noSHFl','file','name','\x20-\x20','query','Statement\x20','389026oJQVug','Run\x20Trino\x20queries\x20(streaming)','42jhqUss','1097052qceFOX','setExtra','SQL:\x20','database','21054QRfjcZ','description','\x20[Job\x20ID:\x20','Executing\x20query...','verbose','1AisihL','stats','execute','\x20rows\x20','error'];a34_0x37e5=function(){return _0x293e42;};return a34_0x37e5();}import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';function a34_0x251d(_0x20ad8a,_0x4b22f3){_0x20ad8a=_0x20ad8a-0xbf;const _0x37e514=a34_0x37e5();let _0x251d4b=_0x37e514[_0x20ad8a];return _0x251d4b;}export class QueryCommand extends BaseCommand{[a34_0x28e3f6(0xda)]=a34_0x28e3f6(0xdc);[a34_0x28e3f6(0xe6)]=a34_0x28e3f6(0xdf);async[a34_0x28e3f6(0xec)](_0x22e69b){const _0x557c9d=a34_0x28e3f6,{options:_0x5b2e02,args:_0x672c5d,tdx:_0x5a55b4}=_0x22e69b,_0x6c6b1e={..._0x5b2e02,'limitStructuredFormats':!![]},_0x8857cf=_0x672c5d[0x0],_0x14ef9d=_0x5b2e02[_0x557c9d(0xd9)];let _0x5a5133;try{if(_0x14ef9d)_0x5a5133=readSqlStatementsFromFile(_0x14ef9d);else{if(_0x8857cf==='-')_0x5a5133=await readSqlStatementsFromStdin();else{if(_0x8857cf&&isSqlFilePath(_0x8857cf))_0x5a5133=readSqlStatementsFromFile(_0x8857cf);else{if(_0x8857cf)_0x5a5133=splitSqlStatements(_0x8857cf);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x3d13d0){return console[_0x557c9d(0xee)](_0x557c9d(0xd7)+_0x3d13d0['message']),0x1;}const _0x22e4db=_0x5b2e02[_0x557c9d(0xe4)]||'information_schema',_0x5b9c0c=_0x5b2e02[_0x557c9d(0xce)];try{const _0x122fd8=[],_0x213867=!!_0x5b2e02['output'];for(let _0x2fafba=0x0;_0x2fafba<_0x5a5133[_0x557c9d(0xc7)];_0x2fafba++){const _0x365f4f=_0x5a5133[_0x2fafba],_0x11955e=_0x2fafba+0x1,_0x2cef8f=_0x5a5133['length'],_0x21cde6=_0x2cef8f>0x1;_0x5b2e02[_0x557c9d(0xe9)]&&(console[_0x557c9d(0xee)]('\x0a'+(_0x21cde6?_0x557c9d(0xdd)+_0x11955e+'/'+_0x2cef8f+':':'')),console[_0x557c9d(0xee)]('Site:\x20'+_0x5b2e02[_0x557c9d(0xd5)]),console[_0x557c9d(0xee)]('Catalog:\x20'+(_0x5b9c0c||'td')),console[_0x557c9d(0xee)](_0x557c9d(0xc8)+_0x22e4db),console[_0x557c9d(0xee)](_0x557c9d(0xe3)+_0x365f4f));const _0x4fa9a9=_0x21cde6?_0x557c9d(0xcc)+_0x11955e+'/'+_0x2cef8f+_0x557c9d(0xcd):_0x557c9d(0xe8);try{const _0x3f3177=await withProgressSpinner(_0x4fa9a9,async _0x115110=>{const _0x4c9513=_0x557c9d,_0x15f1ba=await _0x5a55b4[_0x4c9513(0xdc)][_0x4c9513(0xec)](_0x365f4f,{'catalog':_0x5b9c0c,'schema':_0x22e4db,'onJobId':_0x143c95=>{const _0xe24ed7=_0x4c9513;_0x115110[_0xe24ed7(0xc1)](_0x143c95);},'onProgress':_0x1c6b77=>{const _0x54fa85=_0x4c9513;_0x115110[_0x54fa85(0xc0)](_0x54fa85(0xca)+_0x1c6b77[_0x54fa85(0xf0)]+']'),_0x115110[_0x54fa85(0xe2)](formatRows(_0x1c6b77['processedRows'])+_0x54fa85(0xed)+_0x1c6b77['completedSplits']+'/'+_0x1c6b77['totalSplits']+_0x54fa85(0xc3));}});return _0x15f1ba;},{'verbose':_0x5b2e02[_0x557c9d(0xe9)]}),_0x53e0f2=_0x3f3177['data'],_0x55bcfa=_0x53e0f2[_0x557c9d(0xef)]?_0x557c9d(0xe7)+_0x53e0f2[_0x557c9d(0xef)]+']':'',_0x38d222=_0x21cde6?'Statement\x20'+_0x11955e+'/'+_0x2cef8f+_0x557c9d(0xdb):'';console['error']('✔\x20'+_0x38d222+_0x557c9d(0xc9)+formatRows(_0x53e0f2[_0x557c9d(0xeb)][_0x557c9d(0xd0)])+_0x557c9d(0xed)+('in\x20'+formatElapsed(_0x53e0f2[_0x557c9d(0xeb)]['elapsedTimeMillis'])+_0x55bcfa));if(_0x21cde6&&_0x213867){const _0xdf2371=resolveOutputOptions(_0x6c6b1e),_0x4ec45d=await formatQueryOutput(_0x53e0f2,_0xdf2371);_0x122fd8['push'](_0x4ec45d);}else await handleQueryOutput(_0x53e0f2,_0x6c6b1e);}catch(_0x22b48d){const _0x4cdd6c=_0x21cde6?_0x557c9d(0xdd)+_0x11955e+'/'+_0x2cef8f+':\x0a':'',_0x3e4726=_0x22b48d instanceof SDKError?_0x22b48d[_0x557c9d(0xd4)]:_0x22b48d[_0x557c9d(0xd3)];return console['error'](''+_0x4cdd6c+_0x3e4726),0x1;}}if(_0x5a5133['length']>0x1&&_0x213867&&_0x122fd8[_0x557c9d(0xc7)]>0x0){const _0x29cbc8=_0x122fd8[_0x557c9d(0xc6)]('\x0a');writeFileSync(_0x5b2e02['output'],_0x29cbc8),console[_0x557c9d(0xee)](_0x557c9d(0xd6)+_0x5b2e02['output']);}return 0x0;}catch(_0x3d25d4){throw _0x3d25d4;}}[a34_0x28e3f6(0xcb)](_0x3a3098){const _0x417c4e=a34_0x28e3f6,_0x44e111=_0x3a3098[_0x417c4e(0xc5)][0x0],_0x13ddbb=_0x3a3098['options'][_0x417c4e(0xd9)];if(!_0x44e111&&!_0x13ddbb)return _0x417c4e(0xcf);if(_0x44e111&&_0x13ddbb)return _0x417c4e(0xc4);return undefined;}}
@@ -1 +1 @@
1
- const a34_0x50663e=a34_0x1c09;(function(_0x34860c,_0x75140b){const _0x1e67c6=a34_0x1c09,_0xb6aebc=_0x34860c();while(!![]){try{const _0x44a031=parseInt(_0x1e67c6(0x196))/0x1+parseInt(_0x1e67c6(0x193))/0x2+-parseInt(_0x1e67c6(0x17a))/0x3+-parseInt(_0x1e67c6(0x167))/0x4*(-parseInt(_0x1e67c6(0x186))/0x5)+parseInt(_0x1e67c6(0x143))/0x6*(parseInt(_0x1e67c6(0x11e))/0x7)+parseInt(_0x1e67c6(0x189))/0x8+-parseInt(_0x1e67c6(0x174))/0x9*(parseInt(_0x1e67c6(0x145))/0xa);if(_0x44a031===_0x75140b)break;else _0xb6aebc['push'](_0xb6aebc['shift']());}catch(_0x4500ee){_0xb6aebc['push'](_0xb6aebc['shift']());}}}(a34_0xb884,0xbf601));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a34_0x4502d6 from'chalk';function a34_0xb884(){const _0x13bc7d=['\x20\x20Job\x20ID:\x20','nextRun','Schedule\x20deleted:\x20','getTime','Creating\x20schedule...','2640390hTldeZ','schedule:create','retryLimit','48401NHXEoq','Found\x20','Show\x20schedule\x20details','has_next_page','Schedule\x20created:\x20','last_job','time','limit','\x20\x20→\x20','result','in\x20','8555932HINepX','schedule:delete','timezone','args','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','length','m\x20ago','file','dim','d\x20ago','map','num','type','Listing\x20scheduled\x20queries...','name','No\x20scheduled\x20queries\x20found','max','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','Failed\x20to\x20read\x20file:\x20','executing_user_id','Query\x20file\x20is\x20empty','Getting\x20schedule\x20history...','green','format','toLocaleDateString','\x20schedules','yes','\x20scheduled\x20quer','cyan','ended_at','Delete\x20a\x20scheduled\x20query','description','site','jsonl','\x20matching\x20\x22','cron','delay','6vNhIpm','Updating\x20schedule...','5812370uSzMOg','status','Creating\x20schedule:\x20','engine_version','show','from','/app/queries/editor?queryId=','(unnamed)','validate','schedule:list','statusIcon','user_name','next_run_at','run','\x20\x20Timezone:\x20','job_id','schedules','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','start_at','substring','execute','\x20(use\x20--limit\x20to\x20see\x20more)','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','Searching\x20scheduled\x20queries\x20matching\x20\x22','utf-8','tsv','just\x20now','Getting\x20schedule\x20details...','Schedule\x20updated:\x20','database','query','listQueries','Deleting\x20schedule...','priority','1710756PjIbOO','list','options','data','created_at','entries','schedule:run','history','📅\x20','Cancelled','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','round','soon','63tiKtEp','\x20(showing\x20','\x20\x20Num:\x20','schedule:update','count','user','153093QFGhNh','INVALID_ARGUMENT','\x20\x20Database:\x20','error','...','repeat','\x20\x20Time:\x20','Show\x20schedule\x20execution\x20history','jobs','join','trim','time_zone','10Jmlnlt','List\x20scheduled\x20queries','engineVersion','11658504LcjDQD','retry_limit','padEnd','verbose','queryUrl'];a34_0xb884=function(){return _0x13bc7d;};return a34_0xb884();}function formatRelativeTime(_0x579d13){const _0x5b81cb=a34_0x1c09,_0x3aede3=new Date(_0x579d13),_0x480305=new Date(),_0x32dc39=_0x3aede3[_0x5b81cb(0x191)]()-_0x480305[_0x5b81cb(0x191)](),_0x34e2de=Math['abs'](_0x32dc39)/0x3e8,_0x1c36f7=_0x32dc39<0x0;if(_0x34e2de<0x3c)return _0x1c36f7?_0x5b81cb(0x15f):_0x5b81cb(0x173);else{if(_0x34e2de<0xe10){const _0x411a80=Math[_0x5b81cb(0x172)](_0x34e2de/0x3c);return _0x1c36f7?_0x411a80+_0x5b81cb(0x124):_0x5b81cb(0x11d)+_0x411a80+'m';}else{if(_0x34e2de<0x15180){const _0x40a18a=Math['round'](_0x34e2de/0xe10);return _0x1c36f7?_0x40a18a+'h\x20ago':_0x5b81cb(0x11d)+_0x40a18a+'h';}else{if(_0x34e2de<0x93a80){const _0x1e2bcb=Math[_0x5b81cb(0x172)](_0x34e2de/0x15180);return _0x1c36f7?_0x1e2bcb+_0x5b81cb(0x127):'in\x20'+_0x1e2bcb+'d';}else return _0x3aede3[_0x5b81cb(0x136)]();}}}}export class ScheduleListCommand extends BaseCommand{[a34_0x50663e(0x12c)]=a34_0x50663e(0x14e);[a34_0x50663e(0x13d)]=a34_0x50663e(0x187);async[a34_0x50663e(0x159)](_0x51a308){const _0x1602c7=a34_0x50663e,{options:_0x240a20,args:_0x1a77cd,tdx:_0x28a504}=_0x51a308,_0x3009f1=resolveLimit(_0x240a20[_0x1602c7(0x11a)],DEFAULT_DISPLAY_LIMIT),_0x107317=_0x1a77cd[0x0],_0x400056=_0x107317?_0x1602c7(0x15c)+_0x107317+'\x22...':_0x1602c7(0x12b),_0x45ef05=await withSpinner(_0x400056,()=>_0x28a504['schedules'][_0x1602c7(0x164)]({'limit':_0x3009f1,'scheduled':!![],'pattern':_0x107317}),{'verbose':_0x240a20[_0x1602c7(0x18c)]}),_0x3b8eab=_0x45ef05[_0x1602c7(0x16a)]['queries'],_0x5537ee=_0x45ef05[_0x1602c7(0x16a)]['pagination'][_0x1602c7(0x116)],_0x221fe3=_0x107317?_0x1602c7(0x140)+_0x107317+'\x22':'';_0x5537ee?console[_0x1602c7(0x17d)]('Showing\x20first\x20'+_0x3b8eab[_0x1602c7(0x123)]+_0x1602c7(0x137)+_0x221fe3+_0x1602c7(0x15a)):console[_0x1602c7(0x17d)]('Found\x20'+_0x3b8eab[_0x1602c7(0x123)]+_0x1602c7(0x139)+(_0x3b8eab[_0x1602c7(0x123)]!==0x1?'ies':'y')+_0x221fe3);if(_0x240a20['format']==='json'||_0x240a20[_0x1602c7(0x135)]===_0x1602c7(0x13f)||_0x240a20[_0x1602c7(0x135)]==='table'||_0x240a20[_0x1602c7(0x135)]===_0x1602c7(0x15e)){const _0x49ea61=_0x3b8eab[_0x1602c7(0x128)](_0x21b982=>({'id':_0x21b982['id'],'name':_0x21b982[_0x1602c7(0x12c)],'cron':_0x21b982['cron'],'database':_0x21b982['database']?.['name'],'type':_0x21b982[_0x1602c7(0x12a)],'timezone':_0x21b982[_0x1602c7(0x185)],'user_name':_0x21b982[_0x1602c7(0x179)]?.[_0x1602c7(0x12c)],'updated_at':_0x21b982['updated_at'],'next_run_at':_0x21b982[_0x1602c7(0x151)],'last_job_status':_0x21b982['last_job']?.[_0x1602c7(0x146)]}));await handleSDKOutput(_0x49ea61,_0x240a20);}else{if(_0x3b8eab[_0x1602c7(0x123)]===0x0)console['log'](_0x1602c7(0x12d));else{const _0x2d4f45=_0x240a20[_0x1602c7(0x13e)],_0xba1aa0=_0x3b8eab['map'](_0x1909c9=>{const _0x108042=_0x1602c7,_0x30e82b=_0x1909c9['last_job']?.[_0x108042(0x146)]?_0x1909c9[_0x108042(0x118)][_0x108042(0x146)]==='success'?'✓':'✗':'-',_0x345c41=_0x1909c9[_0x108042(0x118)]?.[_0x108042(0x13b)]?formatRelativeTime(_0x1909c9[_0x108042(0x118)][_0x108042(0x13b)]):'never',_0x2a1c9c=_0x1909c9['next_run_at']?formatRelativeTime(_0x1909c9['next_run_at']):'-',_0xeed898=_0x1909c9[_0x108042(0x141)]||'',_0x5e3632=_0x1909c9['name']||_0x108042(0x14c),_0x3cd74e=getConsoleUrl(_0x2d4f45,_0x108042(0x14b)+_0x1909c9['id']);return{'statusIcon':_0x30e82b,'lastRun':_0x345c41,'nextRun':_0x2a1c9c,'cron':_0xeed898,'name':_0x5e3632,'queryUrl':_0x3cd74e,'status':_0x1909c9[_0x108042(0x118)]?.['status']};}),_0x1a77ee=Math['max'](..._0xba1aa0[_0x1602c7(0x128)](_0x256a4e=>_0x256a4e['lastRun']['length'])),_0x36b7fc=Math[_0x1602c7(0x12e)](..._0xba1aa0['map'](_0x8c827a=>_0x8c827a['nextRun'][_0x1602c7(0x123)])),_0x26b522=Math[_0x1602c7(0x12e)](..._0xba1aa0[_0x1602c7(0x128)](_0xbed00c=>_0xbed00c[_0x1602c7(0x141)][_0x1602c7(0x123)])),_0x404795=_0xba1aa0['map'](_0x2b5b60=>{const _0x2bcad9=_0x1602c7,_0x41e3c7=_0x2b5b60[_0x2bcad9(0x146)]==='success'?a34_0x4502d6[_0x2bcad9(0x134)](_0x2b5b60[_0x2bcad9(0x14f)]):_0x2b5b60['status']===_0x2bcad9(0x17d)?a34_0x4502d6['red'](_0x2b5b60['statusIcon']):a34_0x4502d6[_0x2bcad9(0x126)](_0x2b5b60[_0x2bcad9(0x14f)]),_0x5206b6=_0x2b5b60['lastRun'][_0x2bcad9(0x18b)](_0x1a77ee),_0xaec250=_0x2b5b60[_0x2bcad9(0x18f)][_0x2bcad9(0x18b)](_0x36b7fc),_0x4a907f=_0x2b5b60[_0x2bcad9(0x141)]?a34_0x4502d6[_0x2bcad9(0x13a)](_0x2b5b60[_0x2bcad9(0x141)][_0x2bcad9(0x18b)](_0x26b522)):'\x20'[_0x2bcad9(0x17f)](_0x26b522),_0x57111e=hyperlink(_0x2b5b60[_0x2bcad9(0x12c)],_0x2b5b60[_0x2bcad9(0x18d)]);return _0x2bcad9(0x16f)+_0x41e3c7+'\x20'+_0x5206b6+_0x2bcad9(0x11b)+_0xaec250+'\x20\x20'+_0x4a907f+'\x20\x20'+_0x57111e;});await writeOutput(_0x404795[_0x1602c7(0x183)]('\x0a'),_0x240a20['output'],_0x1602c7(0x168));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{['name']='schedule:show';['description']=a34_0x50663e(0x198);['validate'](_0xcb631f){const _0x48a9bf=a34_0x50663e,_0x5ef0bf=_0xcb631f[_0x48a9bf(0x121)][0x0];if(!_0x5ef0bf)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async[a34_0x50663e(0x159)](_0x2dbb0b){const _0x39b539=a34_0x50663e,{options:_0x32ba58,args:_0x40acb1,tdx:_0x4d3b10}=_0x2dbb0b,_0x165cc4=_0x40acb1[0x0],_0x45afd8=await withSpinner(_0x39b539(0x160),()=>_0x4d3b10[_0x39b539(0x155)][_0x39b539(0x149)](_0x165cc4),{'verbose':_0x32ba58[_0x39b539(0x18c)]}),_0x2f99f8=_0x45afd8['data'],_0x436d4b={'name':_0x2f99f8[_0x39b539(0x12c)],'cron':_0x2f99f8['cron'],'database':_0x2f99f8[_0x39b539(0x162)],'type':_0x2f99f8[_0x39b539(0x12a)],'timezone':_0x2f99f8[_0x39b539(0x120)],'user_name':_0x2f99f8[_0x39b539(0x150)],'created_at':_0x2f99f8['created_at'],'engine_version':_0x2f99f8[_0x39b539(0x148)],'executing_user_id':_0x2f99f8[_0x39b539(0x131)],'query':_0x2f99f8[_0x39b539(0x163)],'delay':_0x2f99f8[_0x39b539(0x142)],'priority':_0x2f99f8[_0x39b539(0x166)],'retry_limit':_0x2f99f8['retry_limit'],..._0x2f99f8[_0x39b539(0x11c)]&&{'result':_0x2f99f8[_0x39b539(0x11c)]}};return await handleSingleObjectOutput(_0x436d4b,_0x32ba58),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']=a34_0x50663e(0x194);[a34_0x50663e(0x13d)]='Create\x20a\x20scheduled\x20query';[a34_0x50663e(0x14d)](_0x50392b){const _0x7c5dcd=a34_0x50663e,_0x5f3578=_0x50392b[_0x7c5dcd(0x121)][0x0];if(!_0x5f3578)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';const _0x35305a=_0x50392b[_0x7c5dcd(0x169)];if(!_0x35305a['database'])return _0x7c5dcd(0x122);return undefined;}async[a34_0x50663e(0x159)](_0x4a8d8e){const _0x244243=a34_0x50663e,{options:_0x5c3260,args:_0x3228c1,tdx:_0xec0e8f}=_0x4a8d8e,_0x42ef58=_0x3228c1[0x0],_0x316b95=_0x5c3260,_0x1ab431=_0x316b95[_0x244243(0x162)],_0x9bb0d9=_0x316b95[_0x244243(0x125)],_0x3ed305=_0x316b95[_0x244243(0x12a)]||'trino';let _0x1fae01;try{_0x1fae01=readFileSync(_0x9bb0d9,_0x244243(0x15d))[_0x244243(0x184)]();}catch(_0x254637){throw new SDKError(ErrorCode[_0x244243(0x17b)],'Failed\x20to\x20read\x20file:\x20'+_0x9bb0d9,_0x254637 instanceof Error?_0x254637:undefined);}if(!_0x1fae01)throw new SDKError(ErrorCode[_0x244243(0x17b)],_0x244243(0x132));const _0x588d09={'database':_0x1ab431,'query':_0x1fae01,'type':_0x3ed305};if(_0x316b95[_0x244243(0x141)])_0x588d09[_0x244243(0x141)]=_0x316b95[_0x244243(0x141)];if(_0x316b95[_0x244243(0x120)])_0x588d09['timezone']=_0x316b95[_0x244243(0x120)];if(_0x316b95[_0x244243(0x142)]!==undefined)_0x588d09[_0x244243(0x142)]=Number(_0x316b95['delay']);if(_0x316b95[_0x244243(0x166)]!==undefined)_0x588d09[_0x244243(0x166)]=Number(_0x316b95[_0x244243(0x166)]);if(_0x316b95['retryLimit']!==undefined)_0x588d09[_0x244243(0x18a)]=Number(_0x316b95['retryLimit']);if(_0x316b95['engineVersion'])_0x588d09[_0x244243(0x148)]=_0x316b95[_0x244243(0x188)];if(_0x316b95['result'])_0x588d09[_0x244243(0x11c)]=_0x316b95['result'];if(_0x5c3260[_0x244243(0x18c)]){console['error'](_0x244243(0x147)+_0x42ef58),console[_0x244243(0x17d)](_0x244243(0x17c)+_0x1ab431),console[_0x244243(0x17d)]('\x20\x20Type:\x20'+_0x3ed305);if(_0x588d09['cron'])console['error']('\x20\x20Cron:\x20'+_0x588d09[_0x244243(0x141)]);if(_0x588d09[_0x244243(0x120)])console['error'](_0x244243(0x153)+_0x588d09['timezone']);}const _0x37393b=await withSpinner(_0x244243(0x192),()=>_0xec0e8f[_0x244243(0x155)]['create'](_0x42ef58,_0x588d09),{'verbose':_0x5c3260[_0x244243(0x18c)]});return console[_0x244243(0x17d)](_0x244243(0x117)+_0x37393b[_0x244243(0x16a)][_0x244243(0x12c)]),await handleSingleObjectOutput(_0x37393b[_0x244243(0x16a)],_0x5c3260),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a34_0x50663e(0x12c)]=a34_0x50663e(0x177);[a34_0x50663e(0x13d)]='Update\x20a\x20scheduled\x20query';[a34_0x50663e(0x14d)](_0x5ba27){const _0x5869f2=a34_0x50663e,_0x563c49=_0x5ba27[_0x5869f2(0x121)][0x0];if(!_0x563c49)return _0x5869f2(0x12f);return undefined;}async['execute'](_0x463c79){const _0xdd1840=a34_0x50663e,{options:_0x4f7942,args:_0x53acfd,tdx:_0x117c9c}=_0x463c79,_0x232376=_0x53acfd[0x0],_0x34cb34=_0x4f7942,_0x43f80a={};if(_0x34cb34[_0xdd1840(0x162)])_0x43f80a[_0xdd1840(0x162)]=_0x34cb34['database'];if(_0x34cb34[_0xdd1840(0x12a)])_0x43f80a[_0xdd1840(0x12a)]=_0x34cb34[_0xdd1840(0x12a)];if(_0x34cb34['cron'])_0x43f80a[_0xdd1840(0x141)]=_0x34cb34[_0xdd1840(0x141)];if(_0x34cb34[_0xdd1840(0x120)])_0x43f80a[_0xdd1840(0x120)]=_0x34cb34[_0xdd1840(0x120)];if(_0x34cb34[_0xdd1840(0x142)]!==undefined)_0x43f80a[_0xdd1840(0x142)]=Number(_0x34cb34['delay']);if(_0x34cb34[_0xdd1840(0x166)]!==undefined)_0x43f80a[_0xdd1840(0x166)]=Number(_0x34cb34[_0xdd1840(0x166)]);if(_0x34cb34[_0xdd1840(0x195)]!==undefined)_0x43f80a[_0xdd1840(0x18a)]=Number(_0x34cb34['retryLimit']);if(_0x34cb34[_0xdd1840(0x188)])_0x43f80a['engine_version']=_0x34cb34[_0xdd1840(0x188)];if(_0x34cb34[_0xdd1840(0x11c)])_0x43f80a['result']=_0x34cb34[_0xdd1840(0x11c)];if(_0x34cb34['file'])try{_0x43f80a[_0xdd1840(0x163)]=readFileSync(_0x34cb34[_0xdd1840(0x125)],_0xdd1840(0x15d))['trim']();}catch(_0x55629d){throw new SDKError(ErrorCode[_0xdd1840(0x17b)],_0xdd1840(0x130)+_0x34cb34[_0xdd1840(0x125)],_0x55629d instanceof Error?_0x55629d:undefined);}if(Object['keys'](_0x43f80a)['length']===0x0)throw new SDKError(ErrorCode[_0xdd1840(0x17b)],_0xdd1840(0x171));if(_0x4f7942[_0xdd1840(0x18c)]){console['error']('Updating\x20schedule:\x20'+_0x232376);for(const [_0x37008b,_0x391dd7]of Object[_0xdd1840(0x16c)](_0x43f80a)){_0x37008b===_0xdd1840(0x163)?console[_0xdd1840(0x17d)]('\x20\x20'+_0x37008b+':\x20'+_0x391dd7[_0xdd1840(0x158)](0x0,0x32)+_0xdd1840(0x17e)):console[_0xdd1840(0x17d)]('\x20\x20'+_0x37008b+':\x20'+_0x391dd7);}}const _0x5138f3=await withSpinner(_0xdd1840(0x144),()=>_0x117c9c['schedules']['update'](_0x232376,_0x43f80a),{'verbose':_0x4f7942[_0xdd1840(0x18c)]});return console[_0xdd1840(0x17d)](_0xdd1840(0x161)+_0x5138f3[_0xdd1840(0x16a)]['name']),await handleSingleObjectOutput(_0x5138f3[_0xdd1840(0x16a)],_0x4f7942),0x0;}}function a34_0x1c09(_0x4b68b7,_0x5c988f){_0x4b68b7=_0x4b68b7-0x116;const _0xb88430=a34_0xb884();let _0x1c0918=_0xb88430[_0x4b68b7];return _0x1c0918;}export class ScheduleDeleteCommand extends BaseCommand{[a34_0x50663e(0x12c)]=a34_0x50663e(0x11f);[a34_0x50663e(0x13d)]=a34_0x50663e(0x13c);[a34_0x50663e(0x14d)](_0xc2acdf){const _0x289b8f=a34_0x50663e,_0x250d9f=_0xc2acdf['args'][0x0];if(!_0x250d9f)return _0x289b8f(0x156);return undefined;}async['execute'](_0x42a1b0){const _0x1a5d7f=a34_0x50663e,{options:_0x83d510,args:_0x2ab1a0,tdx:_0x53ff9a}=_0x42a1b0,_0x134705=_0x2ab1a0[0x0];if(!_0x83d510[_0x1a5d7f(0x138)]){const _0x1c2186=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22'+_0x134705+'\x22?');if(!_0x1c2186)return console[_0x1a5d7f(0x17d)](_0x1a5d7f(0x170)),0x0;}const _0x435da3=await withSpinner(_0x1a5d7f(0x165),()=>_0x53ff9a[_0x1a5d7f(0x155)]['delete'](_0x134705),{'verbose':_0x83d510['verbose']});return console[_0x1a5d7f(0x17d)](_0x1a5d7f(0x190)+_0x435da3[_0x1a5d7f(0x16a)][_0x1a5d7f(0x12c)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a34_0x50663e(0x12c)]=a34_0x50663e(0x16d);[a34_0x50663e(0x13d)]='Run\x20a\x20scheduled\x20query\x20immediately';[a34_0x50663e(0x14d)](_0x4cddc0){const _0x255d18=a34_0x50663e,_0x209946=_0x4cddc0[_0x255d18(0x121)][0x0];if(!_0x209946)return _0x255d18(0x15b);return undefined;}async[a34_0x50663e(0x159)](_0x1029ca){const _0x76a361=a34_0x50663e,{options:_0x46e018,args:_0x4a4150,tdx:_0xa3e6f7}=_0x1029ca,_0x35bd64=_0x4a4150[0x0],_0x10e873=_0x46e018,_0x78d0da=_0x10e873[_0x76a361(0x119)],_0x3e16a9=_0x10e873['num']!==undefined?Number(_0x10e873[_0x76a361(0x129)]):undefined;if(_0x46e018[_0x76a361(0x18c)]){console[_0x76a361(0x17d)]('Running\x20schedule:\x20'+_0x35bd64);if(_0x78d0da)console[_0x76a361(0x17d)](_0x76a361(0x180)+_0x78d0da);if(_0x3e16a9)console[_0x76a361(0x17d)](_0x76a361(0x176)+_0x3e16a9);}const _0x5e7fc5=await withSpinner('Running\x20schedule...',()=>_0xa3e6f7[_0x76a361(0x155)][_0x76a361(0x152)](_0x35bd64,{'time':_0x78d0da,'num':_0x3e16a9}),{'verbose':_0x46e018[_0x76a361(0x18c)]}),_0x28d9e5=_0x5e7fc5[_0x76a361(0x16a)][_0x76a361(0x182)];console[_0x76a361(0x17d)]('Schedule\x20run\x20submitted:\x20'+_0x28d9e5[_0x76a361(0x123)]+'\x20job'+(_0x28d9e5[_0x76a361(0x123)]!==0x1?'s':'')+'\x20created');for(const _0x2dd5a1 of _0x28d9e5){console[_0x76a361(0x17d)](_0x76a361(0x18e)+_0x2dd5a1[_0x76a361(0x154)]);}return await handleSDKOutput(_0x28d9e5,_0x46e018),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a34_0x50663e(0x12c)]='schedule:history';['description']=a34_0x50663e(0x181);[a34_0x50663e(0x14d)](_0x812aa9){const _0x23f946=_0x812aa9['args'][0x0];if(!_0x23f946)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async[a34_0x50663e(0x159)](_0x21d391){const _0x2eb6fd=a34_0x50663e,{options:_0x473a66,args:_0x7dbad6,tdx:_0x3ac36c}=_0x21d391,_0x2201df=_0x7dbad6[0x0],_0x5eadb7=_0x473a66,_0x120aa2=_0x5eadb7[_0x2eb6fd(0x14a)]!==undefined?Number(_0x5eadb7['from']):undefined,_0x17389d=_0x5eadb7['to']!==undefined?Number(_0x5eadb7['to']):undefined,_0x37533b=await withSpinner(_0x2eb6fd(0x133),()=>_0x3ac36c['schedules'][_0x2eb6fd(0x16e)](_0x2201df,{'from':_0x120aa2,'to':_0x17389d}),{'verbose':_0x473a66[_0x2eb6fd(0x18c)]}),_0x2f6487=_0x37533b[_0x2eb6fd(0x16a)];console[_0x2eb6fd(0x17d)](_0x2eb6fd(0x197)+_0x2f6487[_0x2eb6fd(0x178)]+'\x20execution'+(_0x2f6487[_0x2eb6fd(0x178)]!==0x1?'s':'')+_0x2eb6fd(0x175)+_0x2f6487['from']+'-'+_0x2f6487['to']+')');const _0x6e4dc3=_0x2f6487['history'][_0x2eb6fd(0x128)](_0x41c345=>({'job_id':_0x41c345[_0x2eb6fd(0x154)],'type':_0x41c345[_0x2eb6fd(0x12a)],'status':_0x41c345[_0x2eb6fd(0x146)],'scheduled_at':_0x41c345['scheduled_at'],'created_at':_0x41c345[_0x2eb6fd(0x16b)],'start_at':_0x41c345[_0x2eb6fd(0x157)],'end_at':_0x41c345['end_at']}));return await handleSDKOutput(_0x6e4dc3,_0x473a66),0x0;}}
1
+ const a35_0x56e7bc=a35_0x5776;(function(_0x4eed09,_0x3ba414){const _0x5308da=a35_0x5776,_0x59ad95=_0x4eed09();while(!![]){try{const _0x4421ed=parseInt(_0x5308da(0x16c))/0x1+-parseInt(_0x5308da(0x135))/0x2+-parseInt(_0x5308da(0x164))/0x3+-parseInt(_0x5308da(0x17d))/0x4*(parseInt(_0x5308da(0xf4))/0x5)+parseInt(_0x5308da(0x171))/0x6+parseInt(_0x5308da(0x136))/0x7+-parseInt(_0x5308da(0x148))/0x8*(-parseInt(_0x5308da(0x116))/0x9);if(_0x4421ed===_0x3ba414)break;else _0x59ad95['push'](_0x59ad95['shift']());}catch(_0x306c5){_0x59ad95['push'](_0x59ad95['shift']());}}}(a35_0x33ff,0xb99bc));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 a35_0x5776(_0x1264d0,_0x2ed8cd){_0x1264d0=_0x1264d0-0xf3;const _0x33ffc2=a35_0x33ff();let _0x577620=_0x33ffc2[_0x1264d0];return _0x577620;}import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a35_0x3a7855 from'chalk';function formatRelativeTime(_0x12a10f){const _0x589b89=a35_0x5776,_0x5cc10a=new Date(_0x12a10f),_0x52804a=new Date(),_0x10c43b=_0x5cc10a['getTime']()-_0x52804a[_0x589b89(0x129)](),_0x3de7aa=Math[_0x589b89(0x13a)](_0x10c43b)/0x3e8,_0x4f7a79=_0x10c43b<0x0;if(_0x3de7aa<0x3c)return _0x4f7a79?_0x589b89(0x178):_0x589b89(0x111);else{if(_0x3de7aa<0xe10){const _0x4fda4c=Math['round'](_0x3de7aa/0x3c);return _0x4f7a79?_0x4fda4c+'m\x20ago':'in\x20'+_0x4fda4c+'m';}else{if(_0x3de7aa<0x15180){const _0x3b2e8b=Math[_0x589b89(0x101)](_0x3de7aa/0xe10);return _0x4f7a79?_0x3b2e8b+_0x589b89(0x10d):'in\x20'+_0x3b2e8b+'h';}else{if(_0x3de7aa<0x93a80){const _0x9b973b=Math[_0x589b89(0x101)](_0x3de7aa/0x15180);return _0x4f7a79?_0x9b973b+_0x589b89(0x140):_0x589b89(0x106)+_0x9b973b+'d';}else return _0x5cc10a['toLocaleDateString']();}}}}export class ScheduleListCommand extends BaseCommand{[a35_0x56e7bc(0x113)]=a35_0x56e7bc(0x132);['description']='List\x20scheduled\x20queries';async[a35_0x56e7bc(0x130)](_0x76a65e){const _0x2a28c3=a35_0x56e7bc,{options:_0x578e1c,args:_0x11b9fa,tdx:_0x9fd184}=_0x76a65e,_0xc38d45=resolveLimit(_0x578e1c[_0x2a28c3(0x170)],DEFAULT_DISPLAY_LIMIT),_0x513702=_0x11b9fa[0x0],_0x966409=_0x513702?_0x2a28c3(0x13b)+_0x513702+'\x22...':_0x2a28c3(0x125),_0x406f95=await withSpinner(_0x966409,()=>_0x9fd184[_0x2a28c3(0xf3)][_0x2a28c3(0x10f)]({'limit':_0xc38d45,'scheduled':!![],'pattern':_0x513702}),{'verbose':_0x578e1c['verbose']}),_0x341965=_0x406f95[_0x2a28c3(0x107)]['queries'],_0x15e9cc=_0x406f95[_0x2a28c3(0x107)]['pagination'][_0x2a28c3(0xf6)],_0x42af17=_0x513702?'\x20matching\x20\x22'+_0x513702+'\x22':'';_0x15e9cc?console[_0x2a28c3(0x142)](_0x2a28c3(0x14c)+_0x341965['length']+_0x2a28c3(0x10b)+_0x42af17+_0x2a28c3(0x108)):console[_0x2a28c3(0x142)](_0x2a28c3(0x112)+_0x341965[_0x2a28c3(0x145)]+_0x2a28c3(0x141)+(_0x341965[_0x2a28c3(0x145)]!==0x1?'ies':'y')+_0x42af17);if(_0x578e1c[_0x2a28c3(0x144)]==='json'||_0x578e1c[_0x2a28c3(0x144)]===_0x2a28c3(0x100)||_0x578e1c[_0x2a28c3(0x144)]===_0x2a28c3(0x11d)||_0x578e1c[_0x2a28c3(0x144)]===_0x2a28c3(0x138)){const _0x5ddf75=_0x341965[_0x2a28c3(0x175)](_0x4533c8=>({'id':_0x4533c8['id'],'name':_0x4533c8[_0x2a28c3(0x113)],'cron':_0x4533c8[_0x2a28c3(0x172)],'database':_0x4533c8[_0x2a28c3(0x14e)]?.[_0x2a28c3(0x113)],'type':_0x4533c8['type'],'timezone':_0x4533c8[_0x2a28c3(0x114)],'user_name':_0x4533c8[_0x2a28c3(0x127)]?.[_0x2a28c3(0x113)],'updated_at':_0x4533c8[_0x2a28c3(0x109)],'next_run_at':_0x4533c8[_0x2a28c3(0x15d)],'last_job_status':_0x4533c8[_0x2a28c3(0x15b)]?.[_0x2a28c3(0x14d)]}));await handleSDKOutput(_0x5ddf75,_0x578e1c);}else{if(_0x341965[_0x2a28c3(0x145)]===0x0)console[_0x2a28c3(0x11f)](_0x2a28c3(0x11b));else{const _0x156e5f=_0x578e1c[_0x2a28c3(0xff)],_0x1c023f=_0x341965[_0x2a28c3(0x175)](_0x24072a=>{const _0x29a336=_0x2a28c3,_0x5d5192=_0x24072a[_0x29a336(0x15b)]?.[_0x29a336(0x14d)]?_0x24072a[_0x29a336(0x15b)][_0x29a336(0x14d)]==='success'?'✓':'✗':'-',_0x66a5a9=_0x24072a['last_job']?.[_0x29a336(0x16d)]?formatRelativeTime(_0x24072a[_0x29a336(0x15b)][_0x29a336(0x16d)]):_0x29a336(0xfe),_0x1d5c06=_0x24072a[_0x29a336(0x15d)]?formatRelativeTime(_0x24072a[_0x29a336(0x15d)]):'-',_0x4203ff=_0x24072a[_0x29a336(0x172)]||'',_0x2bb97e=_0x24072a['name']||_0x29a336(0x165),_0x51e4b8=getConsoleUrl(_0x156e5f,_0x29a336(0x13d)+_0x24072a['id']);return{'statusIcon':_0x5d5192,'lastRun':_0x66a5a9,'nextRun':_0x1d5c06,'cron':_0x4203ff,'name':_0x2bb97e,'queryUrl':_0x51e4b8,'status':_0x24072a[_0x29a336(0x15b)]?.[_0x29a336(0x14d)]};}),_0x546e83=Math[_0x2a28c3(0x10c)](..._0x1c023f[_0x2a28c3(0x175)](_0x370057=>_0x370057['lastRun']['length'])),_0x5f09ed=Math['max'](..._0x1c023f['map'](_0x5e4c57=>_0x5e4c57[_0x2a28c3(0x149)]['length'])),_0xa1ff15=Math[_0x2a28c3(0x10c)](..._0x1c023f[_0x2a28c3(0x175)](_0x4b4af4=>_0x4b4af4[_0x2a28c3(0x172)]['length'])),_0x21a35c=_0x1c023f['map'](_0x39592f=>{const _0x5125a6=_0x2a28c3,_0x2426e7=_0x39592f[_0x5125a6(0x14d)]===_0x5125a6(0x12d)?a35_0x3a7855[_0x5125a6(0x167)](_0x39592f['statusIcon']):_0x39592f[_0x5125a6(0x14d)]===_0x5125a6(0x142)?a35_0x3a7855[_0x5125a6(0x134)](_0x39592f['statusIcon']):a35_0x3a7855[_0x5125a6(0x161)](_0x39592f[_0x5125a6(0x11c)]),_0x47cc07=_0x39592f['lastRun'][_0x5125a6(0x158)](_0x546e83),_0x12e1ba=_0x39592f[_0x5125a6(0x149)][_0x5125a6(0x158)](_0x5f09ed),_0x18cac6=_0x39592f[_0x5125a6(0x172)]?a35_0x3a7855[_0x5125a6(0xf8)](_0x39592f[_0x5125a6(0x172)]['padEnd'](_0xa1ff15)):'\x20'['repeat'](_0xa1ff15),_0x3ee7ec=hyperlink(_0x39592f[_0x5125a6(0x113)],_0x39592f[_0x5125a6(0x14b)]);return _0x5125a6(0x153)+_0x2426e7+'\x20'+_0x47cc07+_0x5125a6(0x150)+_0x12e1ba+'\x20\x20'+_0x18cac6+'\x20\x20'+_0x3ee7ec;});await writeOutput(_0x21a35c['join']('\x0a'),_0x578e1c[_0x2a28c3(0x17c)],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a35_0x56e7bc(0x113)]=a35_0x56e7bc(0x159);[a35_0x56e7bc(0xfb)]=a35_0x56e7bc(0x157);[a35_0x56e7bc(0x17f)](_0x493303){const _0x24d269=a35_0x56e7bc,_0x4e1308=_0x493303[_0x24d269(0x16f)][0x0];if(!_0x4e1308)return _0x24d269(0x15f);return undefined;}async['execute'](_0xed83db){const _0x59dad2=a35_0x56e7bc,{options:_0x59f8d1,args:_0x349f2a,tdx:_0x5d63ee}=_0xed83db,_0x51d82d=_0x349f2a[0x0],_0x426045=await withSpinner('Getting\x20schedule\x20details...',()=>_0x5d63ee['schedules']['show'](_0x51d82d),{'verbose':_0x59f8d1['verbose']}),_0x3392e1=_0x426045[_0x59dad2(0x107)],_0x355922={'name':_0x3392e1[_0x59dad2(0x113)],'cron':_0x3392e1['cron'],'database':_0x3392e1[_0x59dad2(0x14e)],'type':_0x3392e1[_0x59dad2(0x117)],'timezone':_0x3392e1['timezone'],'user_name':_0x3392e1['user_name'],'created_at':_0x3392e1['created_at'],'engine_version':_0x3392e1[_0x59dad2(0x173)],'executing_user_id':_0x3392e1['executing_user_id'],'query':_0x3392e1[_0x59dad2(0x12c)],'delay':_0x3392e1[_0x59dad2(0x12e)],'priority':_0x3392e1[_0x59dad2(0xf7)],'retry_limit':_0x3392e1[_0x59dad2(0x17a)],..._0x3392e1['result']&&{'result':_0x3392e1['result']}};return await handleSingleObjectOutput(_0x355922,_0x59f8d1),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']='schedule:create';[a35_0x56e7bc(0xfb)]=a35_0x56e7bc(0x163);['validate'](_0x505fe4){const _0x442483=a35_0x56e7bc,_0x13a118=_0x505fe4[_0x442483(0x16f)][0x0];if(!_0x13a118)return _0x442483(0x14f);const _0x574f82=_0x505fe4[_0x442483(0x139)];if(!_0x574f82[_0x442483(0x14e)])return _0x442483(0x15e);return undefined;}async[a35_0x56e7bc(0x130)](_0x5cbdd0){const _0x1f1fa1=a35_0x56e7bc,{options:_0x13855a,args:_0x44ef9b,tdx:_0x27eb44}=_0x5cbdd0,_0x51bbab=_0x44ef9b[0x0],_0x50db85=_0x13855a,_0x4e58f7=_0x50db85[_0x1f1fa1(0x14e)],_0x534b79=_0x50db85[_0x1f1fa1(0x13f)],_0xda4ac3=_0x50db85['type']||_0x1f1fa1(0x120);let _0xc7eac;try{_0xc7eac=readFileSync(_0x534b79,_0x1f1fa1(0x104))['trim']();}catch(_0x3a806f){throw new SDKError(ErrorCode[_0x1f1fa1(0x11a)],_0x1f1fa1(0x16b)+_0x534b79,_0x3a806f instanceof Error?_0x3a806f:undefined);}if(!_0xc7eac)throw new SDKError(ErrorCode[_0x1f1fa1(0x11a)],_0x1f1fa1(0x151));const _0x90f341={'database':_0x4e58f7,'query':_0xc7eac,'type':_0xda4ac3};if(_0x50db85['cron'])_0x90f341[_0x1f1fa1(0x172)]=_0x50db85['cron'];if(_0x50db85['timezone'])_0x90f341[_0x1f1fa1(0x152)]=_0x50db85['timezone'];if(_0x50db85[_0x1f1fa1(0x12e)]!==undefined)_0x90f341[_0x1f1fa1(0x12e)]=Number(_0x50db85[_0x1f1fa1(0x12e)]);if(_0x50db85[_0x1f1fa1(0xf7)]!==undefined)_0x90f341['priority']=Number(_0x50db85[_0x1f1fa1(0xf7)]);if(_0x50db85[_0x1f1fa1(0x133)]!==undefined)_0x90f341['retry_limit']=Number(_0x50db85[_0x1f1fa1(0x133)]);if(_0x50db85['engineVersion'])_0x90f341[_0x1f1fa1(0x173)]=_0x50db85[_0x1f1fa1(0x166)];if(_0x50db85[_0x1f1fa1(0x123)])_0x90f341[_0x1f1fa1(0x123)]=_0x50db85[_0x1f1fa1(0x123)];if(_0x13855a['verbose']){console[_0x1f1fa1(0x142)](_0x1f1fa1(0x17b)+_0x51bbab),console[_0x1f1fa1(0x142)](_0x1f1fa1(0x15c)+_0x4e58f7),console[_0x1f1fa1(0x142)]('\x20\x20Type:\x20'+_0xda4ac3);if(_0x90f341[_0x1f1fa1(0x172)])console[_0x1f1fa1(0x142)](_0x1f1fa1(0x13c)+_0x90f341[_0x1f1fa1(0x172)]);if(_0x90f341[_0x1f1fa1(0x152)])console[_0x1f1fa1(0x142)](_0x1f1fa1(0xfa)+_0x90f341[_0x1f1fa1(0x152)]);}const _0x138e49=await withSpinner(_0x1f1fa1(0x154),()=>_0x27eb44[_0x1f1fa1(0xf3)][_0x1f1fa1(0x128)](_0x51bbab,_0x90f341),{'verbose':_0x13855a[_0x1f1fa1(0xf5)]});return console[_0x1f1fa1(0x142)](_0x1f1fa1(0x169)+_0x138e49[_0x1f1fa1(0x107)][_0x1f1fa1(0x113)]),await handleSingleObjectOutput(_0x138e49[_0x1f1fa1(0x107)],_0x13855a),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a35_0x56e7bc(0x113)]=a35_0x56e7bc(0x103);[a35_0x56e7bc(0xfb)]='Update\x20a\x20scheduled\x20query';[a35_0x56e7bc(0x17f)](_0x270ea2){const _0x4c5399=a35_0x56e7bc,_0xbcdb70=_0x270ea2[_0x4c5399(0x16f)][0x0];if(!_0xbcdb70)return _0x4c5399(0x137);return undefined;}async[a35_0x56e7bc(0x130)](_0x15f222){const _0x583fbf=a35_0x56e7bc,{options:_0x3ab315,args:_0x3ad2ac,tdx:_0x17f143}=_0x15f222,_0x116b3f=_0x3ad2ac[0x0],_0x493927=_0x3ab315,_0xa2f4df={};if(_0x493927[_0x583fbf(0x14e)])_0xa2f4df[_0x583fbf(0x14e)]=_0x493927[_0x583fbf(0x14e)];if(_0x493927[_0x583fbf(0x117)])_0xa2f4df['type']=_0x493927['type'];if(_0x493927[_0x583fbf(0x172)])_0xa2f4df[_0x583fbf(0x172)]=_0x493927['cron'];if(_0x493927['timezone'])_0xa2f4df[_0x583fbf(0x152)]=_0x493927[_0x583fbf(0x152)];if(_0x493927[_0x583fbf(0x12e)]!==undefined)_0xa2f4df['delay']=Number(_0x493927[_0x583fbf(0x12e)]);if(_0x493927[_0x583fbf(0xf7)]!==undefined)_0xa2f4df[_0x583fbf(0xf7)]=Number(_0x493927[_0x583fbf(0xf7)]);if(_0x493927[_0x583fbf(0x133)]!==undefined)_0xa2f4df[_0x583fbf(0x17a)]=Number(_0x493927[_0x583fbf(0x133)]);if(_0x493927['engineVersion'])_0xa2f4df[_0x583fbf(0x173)]=_0x493927[_0x583fbf(0x166)];if(_0x493927[_0x583fbf(0x123)])_0xa2f4df[_0x583fbf(0x123)]=_0x493927[_0x583fbf(0x123)];if(_0x493927['file'])try{_0xa2f4df[_0x583fbf(0x12c)]=readFileSync(_0x493927[_0x583fbf(0x13f)],_0x583fbf(0x104))[_0x583fbf(0x119)]();}catch(_0x2091dd){throw new SDKError(ErrorCode[_0x583fbf(0x11a)],'Failed\x20to\x20read\x20file:\x20'+_0x493927[_0x583fbf(0x13f)],_0x2091dd instanceof Error?_0x2091dd:undefined);}if(Object[_0x583fbf(0x118)](_0xa2f4df)[_0x583fbf(0x145)]===0x0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x583fbf(0x155));if(_0x3ab315['verbose']){console['error'](_0x583fbf(0x10e)+_0x116b3f);for(const [_0x19dae4,_0x4ffa71]of Object[_0x583fbf(0x105)](_0xa2f4df)){_0x19dae4===_0x583fbf(0x12c)?console['error']('\x20\x20'+_0x19dae4+':\x20'+_0x4ffa71['substring'](0x0,0x32)+_0x583fbf(0x177)):console[_0x583fbf(0x142)]('\x20\x20'+_0x19dae4+':\x20'+_0x4ffa71);}}const _0xafa262=await withSpinner(_0x583fbf(0x146),()=>_0x17f143[_0x583fbf(0xf3)][_0x583fbf(0x12f)](_0x116b3f,_0xa2f4df),{'verbose':_0x3ab315[_0x583fbf(0xf5)]});return console['error'](_0x583fbf(0x14a)+_0xafa262['data']['name']),await handleSingleObjectOutput(_0xafa262[_0x583fbf(0x107)],_0x3ab315),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a35_0x56e7bc(0x113)]='schedule:delete';[a35_0x56e7bc(0xfb)]=a35_0x56e7bc(0x15a);['validate'](_0x4b0726){const _0xd3cb68=a35_0x56e7bc,_0x23a5a1=_0x4b0726[_0xd3cb68(0x16f)][0x0];if(!_0x23a5a1)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async[a35_0x56e7bc(0x130)](_0x488707){const _0x200bc4=a35_0x56e7bc,{options:_0x48c97f,args:_0x3722c4,tdx:_0x45c7b8}=_0x488707,_0x2d8105=_0x3722c4[0x0];if(!_0x48c97f[_0x200bc4(0x102)]){const _0x47a20b=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22'+_0x2d8105+'\x22?');if(!_0x47a20b)return console[_0x200bc4(0x142)](_0x200bc4(0x10a)),0x0;}const _0x569c5f=await withSpinner('Deleting\x20schedule...',()=>_0x45c7b8['schedules'][_0x200bc4(0x122)](_0x2d8105),{'verbose':_0x48c97f[_0x200bc4(0xf5)]});return console[_0x200bc4(0x142)](_0x200bc4(0x12a)+_0x569c5f['data'][_0x200bc4(0x113)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a35_0x56e7bc(0x113)]=a35_0x56e7bc(0x176);['description']=a35_0x56e7bc(0x121);['validate'](_0x54fa01){const _0x4451ff=a35_0x56e7bc,_0x45c220=_0x54fa01[_0x4451ff(0x16f)][0x0];if(!_0x45c220)return _0x4451ff(0x168);return undefined;}async[a35_0x56e7bc(0x130)](_0x3fff18){const _0xda14be=a35_0x56e7bc,{options:_0x1d9faa,args:_0x41a229,tdx:_0x3896dd}=_0x3fff18,_0x178a96=_0x41a229[0x0],_0xca1b1=_0x1d9faa,_0x519984=_0xca1b1['time'],_0x7bf18c=_0xca1b1[_0xda14be(0x174)]!==undefined?Number(_0xca1b1[_0xda14be(0x174)]):undefined;if(_0x1d9faa['verbose']){console[_0xda14be(0x142)](_0xda14be(0x124)+_0x178a96);if(_0x519984)console[_0xda14be(0x142)](_0xda14be(0x11e)+_0x519984);if(_0x7bf18c)console[_0xda14be(0x142)]('\x20\x20Num:\x20'+_0x7bf18c);}const _0x2bf143=await withSpinner(_0xda14be(0x156),()=>_0x3896dd[_0xda14be(0xf3)]['run'](_0x178a96,{'time':_0x519984,'num':_0x7bf18c}),{'verbose':_0x1d9faa['verbose']}),_0x388aef=_0x2bf143['data'][_0xda14be(0x179)];console[_0xda14be(0x142)](_0xda14be(0x12b)+_0x388aef[_0xda14be(0x145)]+_0xda14be(0xfc)+(_0x388aef[_0xda14be(0x145)]!==0x1?'s':'')+_0xda14be(0xf9));for(const _0x8188a2 of _0x388aef){console['error'](_0xda14be(0xfd)+_0x8188a2[_0xda14be(0x162)]);}return await handleSDKOutput(_0x388aef,_0x1d9faa),0x0;}}function a35_0x33ff(){const _0x533e1d=['update','execute','created_at','schedule:list','retryLimit','red','2875118zvzsJV','4398639tBqnHz','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','tsv','options','abs','Searching\x20scheduled\x20queries\x20matching\x20\x22','\x20\x20Cron:\x20','/app/queries/editor?queryId=','from','file','d\x20ago','\x20scheduled\x20quer','error','scheduled_at','format','length','Updating\x20schedule...','\x20execution','136fCMPlS','nextRun','Schedule\x20updated:\x20','queryUrl','Showing\x20first\x20','status','database','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','\x20\x20→\x20','Query\x20file\x20is\x20empty','timezone','📅\x20','Creating\x20schedule...','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','Running\x20schedule...','Show\x20schedule\x20details','padEnd','schedule:show','Delete\x20a\x20scheduled\x20query','last_job','\x20\x20Database:\x20','next_run_at','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','dim','job_id','Create\x20a\x20scheduled\x20query','3182202VbdKVt','(unnamed)','engineVersion','green','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','Schedule\x20created:\x20','Show\x20schedule\x20execution\x20history','Failed\x20to\x20read\x20file:\x20','1191614GTFxeA','ended_at','end_at','args','limit','1407240NzzJIy','cron','engine_version','num','map','schedule:run','...','just\x20now','jobs','retry_limit','Creating\x20schedule:\x20','output','787008TgwKHQ','schedule:history','validate','schedules','5pyQACw','verbose','has_next_page','priority','cyan','\x20created','\x20\x20Timezone:\x20','description','\x20job','\x20\x20Job\x20ID:\x20','never','site','jsonl','round','yes','schedule:update','utf-8','entries','in\x20','data','\x20(use\x20--limit\x20to\x20see\x20more)','updated_at','Cancelled','\x20schedules','max','h\x20ago','Updating\x20schedule:\x20','listQueries','history','soon','Found\x20','name','time_zone','Getting\x20schedule\x20history...','741582tqOcVl','type','keys','trim','INVALID_ARGUMENT','No\x20scheduled\x20queries\x20found','statusIcon','table','\x20\x20Time:\x20','log','trino','Run\x20a\x20scheduled\x20query\x20immediately','delete','result','Running\x20schedule:\x20','Listing\x20scheduled\x20queries...','count','user','create','getTime','Schedule\x20deleted:\x20','Schedule\x20run\x20submitted:\x20','query','success','delay'];a35_0x33ff=function(){return _0x533e1d;};return a35_0x33ff();}export class ScheduleHistoryCommand extends BaseCommand{['name']=a35_0x56e7bc(0x17e);[a35_0x56e7bc(0xfb)]=a35_0x56e7bc(0x16a);[a35_0x56e7bc(0x17f)](_0x542a1c){const _0x2a001c=a35_0x56e7bc,_0x2e327c=_0x542a1c['args'][0x0];if(!_0x2e327c)return _0x2a001c(0x160);return undefined;}async[a35_0x56e7bc(0x130)](_0x1eebeb){const _0x2f0ef7=a35_0x56e7bc,{options:_0x373947,args:_0x19b6ee,tdx:_0xfec852}=_0x1eebeb,_0x46e60c=_0x19b6ee[0x0],_0x3cd9d7=_0x373947,_0x10e99e=_0x3cd9d7['from']!==undefined?Number(_0x3cd9d7[_0x2f0ef7(0x13e)]):undefined,_0x24935c=_0x3cd9d7['to']!==undefined?Number(_0x3cd9d7['to']):undefined,_0x4e4c63=await withSpinner(_0x2f0ef7(0x115),()=>_0xfec852[_0x2f0ef7(0xf3)][_0x2f0ef7(0x110)](_0x46e60c,{'from':_0x10e99e,'to':_0x24935c}),{'verbose':_0x373947[_0x2f0ef7(0xf5)]}),_0x5f5be5=_0x4e4c63[_0x2f0ef7(0x107)];console[_0x2f0ef7(0x142)](_0x2f0ef7(0x112)+_0x5f5be5[_0x2f0ef7(0x126)]+_0x2f0ef7(0x147)+(_0x5f5be5['count']!==0x1?'s':'')+'\x20(showing\x20'+_0x5f5be5[_0x2f0ef7(0x13e)]+'-'+_0x5f5be5['to']+')');const _0x184c59=_0x5f5be5[_0x2f0ef7(0x110)][_0x2f0ef7(0x175)](_0x265fe0=>({'job_id':_0x265fe0[_0x2f0ef7(0x162)],'type':_0x265fe0[_0x2f0ef7(0x117)],'status':_0x265fe0[_0x2f0ef7(0x14d)],'scheduled_at':_0x265fe0[_0x2f0ef7(0x143)],'created_at':_0x265fe0[_0x2f0ef7(0x131)],'start_at':_0x265fe0['start_at'],'end_at':_0x265fe0[_0x2f0ef7(0x16e)]}));return await handleSDKOutput(_0x184c59,_0x373947),0x0;}}
@@ -1 +1 @@
1
- const a35_0x29f1cb=a35_0x2ff3;function a35_0x2ff3(_0x30c0f1,_0x215d2f){_0x30c0f1=_0x30c0f1-0xf5;const _0x119a00=a35_0x119a();let _0x2ff346=_0x119a00[_0x30c0f1];return _0x2ff346;}(function(_0x4c3402,_0x26c750){const _0x222912=a35_0x2ff3,_0x423e6f=_0x4c3402();while(!![]){try{const _0x5492c0=-parseInt(_0x222912(0x14b))/0x1*(parseInt(_0x222912(0x13b))/0x2)+parseInt(_0x222912(0x153))/0x3+parseInt(_0x222912(0x11f))/0x4*(-parseInt(_0x222912(0x107))/0x5)+-parseInt(_0x222912(0x15b))/0x6+parseInt(_0x222912(0x11a))/0x7*(parseInt(_0x222912(0x112))/0x8)+-parseInt(_0x222912(0x17e))/0x9+parseInt(_0x222912(0x102))/0xa*(parseInt(_0x222912(0x15e))/0xb);if(_0x5492c0===_0x26c750)break;else _0x423e6f['push'](_0x423e6f['shift']());}catch(_0x1cbd78){_0x423e6f['push'](_0x423e6f['shift']());}}}(a35_0x119a,0x7fab5));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';function a35_0x119a(){const _0x4f6acf=['List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Fetching\x20SQL\x20for\x20segment...','Folder\x20name:\x20','Show\x20folder\x20or\x20child\x20segment\x20details','error','256NqDHdB','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Get\x20SQL\x20query\x20for\x20child\x20segment','message','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','listFolders','segment:sql','161336XTfHdp','elapsedTimeMillis','Resolving\x20parent\x20segment\x20\x27','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Listing\x20folders\x20for\x20parent\x20\x27','367228dvTXdX','Folder\x20ID:\x20','SELECT\x20*\x20FROM\x20(\x0a','Use:\x20tdx\x20ps\x20desc','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','Use:\x20tdx\x20ps\x20show','Show\x20child\x20segment\x20schema\x20(column\x20types)','getSQLFromServerSegment','\x20Opening\x20','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','segment:show','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','test','segment','path','type','\x27...','SEGMENT_NOT_FOUND','\x20folder','cyan','segment:folder:list','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Create\x20segment\x20folder\x20for\x20organization','createFolder','red','Usage:\x20tdx\x20sg\x20desc\x20<name>','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Resolving\x20parent\x20folder\x20\x27','8JIwvjI','jobId','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Resolved\x20YAML\x20file:\x20','Error:\x20','cause','Resolving\x20folder\x20\x27','Resolved\x20parent\x20ID:\x20','Parent\x20name:\x20','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','getFolder','log','Fetching\x20parent\x20segment\x20details...','segment:folder:create','74709esGgLN','getSegmentSQLFromYaml','processedRows','\x20\x20Folder\x20path:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Fetching\x20folder\x20details...','INVALID_ARGUMENT','Target\x20path:\x20','274533roOYJZ','limit','\x20\x20Segment\x20name:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','getSegment','resolvePathToResource','parent','information_schema','2847852DMRbfD','format','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','11GHicVe','url','\x20rows\x20','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Examples:','length','segmentName','parentFolder','stats','data','\x20\x20Full\x20path:\x20','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','Error:\x20Folder\x20reference\x20is\x20required','parentId','folderPath','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','Folder\x20ID\x20missing\x20from\x20resolved\x20path','folder','✔\x20Found\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','✖\x20Query\x20failed\x20[','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','\x20\x20Cause:\x20','Use:\x20tdx\x20ps\x20view','includes','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','(root)','/e/','segment:describe','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','/app/ps/','4294332ccImzs','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','json','description','Resolved\x20folder\x20ID:\x20','segment:folder:show','Usage:','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','\x20\x20Parent\x20segment:\x20','\x20\x20tdx\x20sg\x20sql\x20--path\x20','Resolving\x20\x27','✔\x20Query\x20completed:\x20Processed\x20','\x27\x20with\x20ID:\x20','name','content','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','query','setJobId','execute','SEGMENT_FOLDER_NOT_FOUND','Segment\x20ID:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Parent\x20ID:\x20','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','folderId','fullPath','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','\x20[Job\x20ID:\x20','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','replace','Site:\x20','segment:desc','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','verbose','resolveParentId','Options:','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Use:\x20tdx\x20ps\x20view\x20-w','site','Resolved\x20type:\x20','Fetching\x20SQL\x20from\x20rule...','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','segmentId','10363190WiySSt','parentSegment','Usage:\x20tdx\x20sg\x20show\x20<name>','getSQLFromYamlFile','Usage:\x20tdx\x20segment\x20describe\x20<path>','5CbjZgr','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','resolveFolderId','Show\x20segment\x20folder\x20details','getSegmentSQL','Segment\x20ID\x20missing\x20from\x20resolved\x20path'];a35_0x119a=function(){return _0x4f6acf;};return a35_0x119a();}import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a35_0x4e64e3 from'chalk';async function resolveSegmentTarget(_0x1e670d,_0x2888f4,_0x3ace87){const _0x4d42fa=a35_0x2ff3;if(isYamlFilePath(_0x1e670d))try{const _0x3301d9=await resolveYamlFilePath(_0x1e670d);return _0x3ace87&&(console['error'](_0x4d42fa(0x13e)+_0x1e670d),console[_0x4d42fa(0x111)](_0x4d42fa(0x186)+_0x3301d9['parentSegment']),console[_0x4d42fa(0x111)](_0x4d42fa(0x155)+_0x3301d9['segmentName']),console[_0x4d42fa(0x111)](_0x4d42fa(0x14e)+(_0x3301d9[_0x4d42fa(0x16c)]||_0x4d42fa(0x179))),console[_0x4d42fa(0x111)](_0x4d42fa(0x168)+_0x3301d9[_0x4d42fa(0x198)])),_0x3301d9[_0x4d42fa(0x198)];}catch(_0x283ea9){throw new SDKError(ErrorCode[_0x4d42fa(0x151)],_0x4d42fa(0x113)+_0x283ea9[_0x4d42fa(0x116)]);}if(!_0x2888f4)throw new SDKError(ErrorCode[_0x4d42fa(0x151)],_0x4d42fa(0x145));return _0x2888f4+'/'+_0x1e670d;}export class SegmentDescribeCommand extends BaseCommand{['name']=a35_0x29f1cb(0x17b);[a35_0x29f1cb(0x181)]='Show\x20segment\x20or\x20folder\x20details';async[a35_0x29f1cb(0x191)](_0x183af9){const _0x257e9e=a35_0x29f1cb,{options:_0xb224f0,args:_0x44a266,tdx:_0x587c9c}=_0x183af9,_0x163ea3=_0x44a266[0x0],_0x15a39d=!_0x163ea3&&!!_0xb224f0['parentSegment'],_0x450201=_0x163ea3||_0xb224f0[_0x257e9e(0x103)];if(!_0x450201)return console['error']('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x257e9e(0x111)](_0x257e9e(0x106)),console[_0x257e9e(0x111)](_0x257e9e(0x162)),console[_0x257e9e(0x111)](_0x257e9e(0x194)),console[_0x257e9e(0x111)](_0x257e9e(0x156)),console[_0x257e9e(0x111)](_0x257e9e(0x139)),console[_0x257e9e(0x111)](_0x257e9e(0x134)),0x1;try{const _0x3ee423=_0xb224f0['segmentPath'];let _0x4d62d1=_0x450201;!_0x15a39d&&_0x3ee423&&!_0x450201[_0x257e9e(0x177)]('/')&&(_0x4d62d1=_0x3ee423+'/'+_0x450201,_0xb224f0[_0x257e9e(0xf7)]&&console[_0x257e9e(0x111)]('Resolved\x20relative\x20path\x20to:\x20'+_0x4d62d1));const _0x416078=await withSpinner('Resolving\x20path\x20\x27'+_0x4d62d1+_0x257e9e(0x12f),()=>_0x587c9c[_0x257e9e(0x12c)][_0x257e9e(0x158)](_0x4d62d1),{'verbose':_0xb224f0[_0x257e9e(0xf7)]}),_0x4609d7=_0x416078['data'];_0xb224f0['verbose']&&(console[_0x257e9e(0x111)]('Resolved\x20type:\x20'+_0x4609d7[_0x257e9e(0x12e)]),console[_0x257e9e(0x111)](_0x257e9e(0x195)+_0x4609d7[_0x257e9e(0x16b)]),_0x4609d7['folderId']&&console[_0x257e9e(0x111)](_0x257e9e(0x120)+_0x4609d7[_0x257e9e(0x197)]),_0x4609d7[_0x257e9e(0x101)]&&console[_0x257e9e(0x111)](_0x257e9e(0x193)+_0x4609d7[_0x257e9e(0x101)]));if(_0x4609d7[_0x257e9e(0x12e)]===_0x257e9e(0x159)){const _0x3cf45b=await withSpinner(_0x257e9e(0x149),()=>_0x587c9c[_0x257e9e(0x12c)]['getParent'](_0x4609d7['parentId']),{'verbose':_0xb224f0[_0x257e9e(0xf7)]});await handleSingleObjectOutput(_0x3cf45b[_0x257e9e(0x167)],_0xb224f0);}else{if(_0x4609d7[_0x257e9e(0x12e)]==='folder'){if(!_0x4609d7[_0x257e9e(0x197)])throw new SDKError(ErrorCode[_0x257e9e(0x192)],_0x257e9e(0x16e));const _0x5a35fe=await withSpinner('Fetching\x20folder\x20details...',()=>_0x587c9c[_0x257e9e(0x12c)][_0x257e9e(0x147)](_0x4609d7['folderId']),{'verbose':_0xb224f0['verbose']});await handleSingleObjectOutput(_0x5a35fe[_0x257e9e(0x167)],_0xb224f0);}else{if(_0x4609d7[_0x257e9e(0x12e)]==='segment'){if(!_0x4609d7[_0x257e9e(0x101)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x257e9e(0x10c));const _0x24d4b8=await withSpinner('Fetching\x20segment\x20details...',()=>_0x587c9c[_0x257e9e(0x12c)][_0x257e9e(0x157)](_0x4609d7[_0x257e9e(0x16b)],_0x4609d7[_0x257e9e(0x101)]),{'verbose':_0xb224f0['verbose']});await handleSingleObjectOutput(_0x24d4b8[_0x257e9e(0x167)],_0xb224f0);}}}return 0x0;}catch(_0x20e2bc){if(_0x20e2bc instanceof SDKError)return console['error'](_0x257e9e(0x13f)+_0x20e2bc[_0x257e9e(0x116)]),_0x20e2bc[_0x257e9e(0x140)]&&console['error'](_0x257e9e(0x175)+_0x20e2bc[_0x257e9e(0x140)]),0x1;throw _0x20e2bc;}}}export class SegmentShowCommand extends BaseCommand{[a35_0x29f1cb(0x18b)]=a35_0x29f1cb(0x129);[a35_0x29f1cb(0x181)]=a35_0x29f1cb(0x117);async['execute'](_0x448335){const _0x284dd4=a35_0x29f1cb,{options:_0x47134e,args:_0x489832,tdx:_0x2bb139}=_0x448335,_0x45e090=_0x489832[0x0];if(!_0x45e090)return console[_0x284dd4(0x111)](_0x284dd4(0x18d)),console[_0x284dd4(0x111)](_0x284dd4(0x104)),console[_0x284dd4(0x111)](_0x284dd4(0x146)),console[_0x284dd4(0x111)](_0x284dd4(0x162)),console[_0x284dd4(0x111)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x284dd4(0x111)](_0x284dd4(0x178)),0x1;try{const _0x4fa510=_0x47134e[_0x284dd4(0x103)],_0x33a40c=await resolveSegmentTarget(_0x45e090,_0x4fa510,_0x47134e[_0x284dd4(0xf7)]);_0x47134e[_0x284dd4(0xf7)]&&console['error'](_0x284dd4(0x152)+_0x33a40c);const _0x2ecf00=await withSpinner(_0x284dd4(0x188)+_0x45e090+_0x284dd4(0x12f),()=>_0x2bb139[_0x284dd4(0x12c)][_0x284dd4(0x158)](_0x33a40c),{'verbose':_0x47134e['verbose']}),_0x480ea0=_0x2ecf00[_0x284dd4(0x167)];_0x47134e['verbose']&&(console[_0x284dd4(0x111)](_0x284dd4(0xfe)+_0x480ea0[_0x284dd4(0x12e)]),console[_0x284dd4(0x111)](_0x284dd4(0x195)+_0x480ea0['parentId']));if(_0x480ea0['type']===_0x284dd4(0x16f))return console[_0x284dd4(0x111)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0x284dd4(0x111)](_0x284dd4(0xf6)),0x1;if(_0x480ea0[_0x284dd4(0x12e)]==='parent')return console['error'](_0x284dd4(0x114)),console[_0x284dd4(0x111)](_0x284dd4(0x124)),0x1;if(!_0x480ea0['segmentId'])throw new SDKError(ErrorCode[_0x284dd4(0x130)],_0x284dd4(0x10c));const _0x42f17b=await withSpinner(_0x284dd4(0x10e),()=>_0x2bb139[_0x284dd4(0x12c)][_0x284dd4(0x10b)](_0x480ea0['parentId'],_0x480ea0[_0x284dd4(0x101)]),{'verbose':_0x47134e[_0x284dd4(0xf7)]});let _0x281ac9=_0x42f17b['data'];const _0x479589=resolveLimit(_0x47134e[_0x284dd4(0x154)],DEFAULT_DISPLAY_LIMIT),_0x4dceaf=/\bLIMIT\s+\d+/i[_0x284dd4(0x12b)](_0x281ac9);!_0x4dceaf&&(_0x281ac9=_0x281ac9['trim']()[_0x284dd4(0x19c)](/;+$/,''),_0x281ac9=_0x284dd4(0x121)+_0x281ac9+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x479589);_0x47134e[_0x284dd4(0xf7)]&&console['error']('SQL\x20query:\x0a'+_0x281ac9);const _0x2a5510=await withProgressSpinner('Executing\x20segment\x20query...',async _0x450d37=>{const _0x15a9f5=_0x284dd4,_0x5cb43e=await _0x2bb139[_0x15a9f5(0x18f)][_0x15a9f5(0x191)](_0x281ac9,{'catalog':'td','schema':_0x15a9f5(0x15a),'onJobId':_0x548919=>{const _0x5d69f6=_0x15a9f5;_0x450d37[_0x5d69f6(0x190)](_0x548919);}});return _0x5cb43e;},{'verbose':_0x47134e[_0x284dd4(0xf7)]}),_0x404e35=_0x2a5510[_0x284dd4(0x167)],_0x4040aa=_0x404e35['jobId']?_0x284dd4(0x19a)+_0x404e35[_0x284dd4(0x13c)]+']':'';return console[_0x284dd4(0x111)](_0x284dd4(0x189)+_0x404e35[_0x284dd4(0x166)][_0x284dd4(0x14d)]['toLocaleString']()+_0x284dd4(0x160)+('in\x20'+formatElapsed(_0x404e35['stats'][_0x284dd4(0x11b)])+_0x4040aa)),await handleQueryOutput(_0x404e35,_0x47134e),0x0;}catch(_0x1f2794){if(_0x1f2794 instanceof SDKError)return console['error'](_0x284dd4(0x172)+_0x1f2794['code']+']'),console[_0x284dd4(0x111)]('\x0a'+_0x1f2794[_0x284dd4(0x116)]),0x1;throw _0x1f2794;}}}export class SegmentFolderListCommand extends BaseCommand{['name']=a35_0x29f1cb(0x133);[a35_0x29f1cb(0x181)]=a35_0x29f1cb(0x10d);async[a35_0x29f1cb(0x191)](_0x5c31fe){const _0x29ca05=a35_0x29f1cb,{options:_0x43ee4e,args:_0x6781,tdx:_0x442279}=_0x5c31fe;if(_0x6781['length']===0x0)return console[_0x29ca05(0x111)](_0x29ca05(0x171)),console['error'](_0x29ca05(0x108)),0x1;const _0x1f97ce=_0x6781[0x0];try{_0x43ee4e[_0x29ca05(0xf7)]&&(console[_0x29ca05(0x111)]('Site:\x20'+_0x43ee4e[_0x29ca05(0xfd)]),console[_0x29ca05(0x111)](_0x29ca05(0x143)+_0x1f97ce));const _0x563a95=await withSpinner(_0x29ca05(0x11c)+_0x1f97ce+'\x27...',()=>_0x442279[_0x29ca05(0x12c)][_0x29ca05(0xf8)](_0x1f97ce),{'verbose':_0x43ee4e[_0x29ca05(0xf7)]}),_0x36ee18=_0x563a95[_0x29ca05(0x167)];_0x43ee4e[_0x29ca05(0xf7)]&&console[_0x29ca05(0x111)]('Resolved\x20parent\x20ID:\x20'+_0x36ee18);const _0x286520=await withSpinner(_0x29ca05(0x11e)+_0x1f97ce+_0x29ca05(0x12f),()=>_0x442279[_0x29ca05(0x12c)][_0x29ca05(0x118)](_0x36ee18),{'verbose':_0x43ee4e[_0x29ca05(0xf7)]}),_0x2fe7ee=_0x286520['data'];return console[_0x29ca05(0x111)](_0x29ca05(0x170)+_0x2fe7ee[_0x29ca05(0x163)]+_0x29ca05(0x131)+(_0x2fe7ee[_0x29ca05(0x163)]!==0x1?'s':'')),await handleSDKOutput(_0x2fe7ee,_0x43ee4e),0x0;}catch(_0x37a285){if(_0x37a285 instanceof SDKError)return console[_0x29ca05(0x111)](_0x29ca05(0x13f)+_0x37a285[_0x29ca05(0x116)]),_0x37a285['cause']&&console[_0x29ca05(0x111)](_0x29ca05(0x175)+_0x37a285[_0x29ca05(0x140)]),0x1;throw _0x37a285;}}}export class SegmentFolderShowCommand extends BaseCommand{[a35_0x29f1cb(0x18b)]=a35_0x29f1cb(0x183);['description']=a35_0x29f1cb(0x10a);async[a35_0x29f1cb(0x191)](_0x4e22c8){const _0xe2eceb=a35_0x29f1cb,{options:_0x42c969,args:_0x315102,tdx:_0x2fbe68}=_0x4e22c8;if(_0x315102[_0xe2eceb(0x163)]===0x0)return console['error'](_0xe2eceb(0x16a)),console[_0xe2eceb(0x111)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x4078c0,childId:_0x4ea406}=parseSegmentRef(_0x315102[0x0]);_0x42c969[_0xe2eceb(0xf7)]&&(console[_0xe2eceb(0x111)](_0xe2eceb(0x19d)+_0x42c969['site']),console[_0xe2eceb(0x111)]('Parent\x20name:\x20'+_0x4078c0),_0x4ea406&&console[_0xe2eceb(0x111)](_0xe2eceb(0x10f)+_0x4ea406));if(!_0x4ea406)return console[_0xe2eceb(0x111)](_0xe2eceb(0x19b)),0x1;const _0x299e29=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x4078c0+_0xe2eceb(0x12f),()=>_0x2fbe68[_0xe2eceb(0x12c)][_0xe2eceb(0xf8)](_0x4078c0),{'verbose':_0x42c969['verbose']}),_0x31f7dc=_0x299e29[_0xe2eceb(0x167)];_0x42c969[_0xe2eceb(0xf7)]&&console[_0xe2eceb(0x111)](_0xe2eceb(0x142)+_0x31f7dc);const _0x27bc27=await withSpinner(_0xe2eceb(0x141)+_0x4ea406+_0xe2eceb(0x12f),()=>_0x2fbe68['segment'][_0xe2eceb(0x109)](_0x31f7dc,_0x4ea406),{'verbose':_0x42c969[_0xe2eceb(0xf7)]}),_0x2200fa=_0x27bc27[_0xe2eceb(0x167)];_0x42c969[_0xe2eceb(0xf7)]&&console[_0xe2eceb(0x111)](_0xe2eceb(0x182)+_0x2200fa);const _0x1bbed4=await withSpinner('Fetching\x20folder\x20\x27'+_0x4ea406+_0xe2eceb(0x12f),()=>_0x2fbe68[_0xe2eceb(0x12c)][_0xe2eceb(0x147)](_0x2200fa),{'verbose':_0x42c969['verbose']});return await handleSDKOutput([_0x1bbed4[_0xe2eceb(0x167)]],_0x42c969),0x0;}catch(_0x31f330){if(_0x31f330 instanceof SDKError)return console[_0xe2eceb(0x111)](_0xe2eceb(0x13f)+_0x31f330[_0xe2eceb(0x116)]),_0x31f330[_0xe2eceb(0x140)]&&console[_0xe2eceb(0x111)](_0xe2eceb(0x175)+_0x31f330[_0xe2eceb(0x140)]),0x1;throw _0x31f330;}}}export class SegmentSQLCommand extends BaseCommand{[a35_0x29f1cb(0x18b)]=a35_0x29f1cb(0x119);['description']=a35_0x29f1cb(0x115);async['execute'](_0x3e0b6e){const _0x490cb9=a35_0x29f1cb,{options:_0x1ffe71,args:_0x13f961}=_0x3e0b6e,_0x85e944=_0x1ffe71,_0x16fb9e=_0x85e944[_0x490cb9(0x12d)],_0x43f75a=_0x13f961[0x0];if(!_0x43f75a&&!_0x16fb9e)return console[_0x490cb9(0x111)](a35_0x4e64e3[_0x490cb9(0x137)](_0x490cb9(0x17f))),console[_0x490cb9(0x111)](_0x490cb9(0x184)),console[_0x490cb9(0x111)](_0x490cb9(0x173)),console[_0x490cb9(0x111)](_0x490cb9(0x123)),console[_0x490cb9(0x111)]('Examples:'),console['error'](_0x490cb9(0x161)),console[_0x490cb9(0x111)](_0x490cb9(0x174)),0x1;if(_0x43f75a&&_0x16fb9e)return console[_0x490cb9(0x111)](a35_0x4e64e3[_0x490cb9(0x137)](_0x490cb9(0x16d))),0x1;try{let _0x326f87;if(_0x16fb9e)_0x326f87=await this[_0x490cb9(0x105)](_0x16fb9e,_0x3e0b6e);else{if(isYamlFilePath(_0x43f75a))return console[_0x490cb9(0x111)](a35_0x4e64e3['red'](_0x490cb9(0x196))),console[_0x490cb9(0x111)](_0x490cb9(0x187)+_0x43f75a),0x1;else _0x326f87=await this[_0x490cb9(0x126)](_0x43f75a,_0x3e0b6e);}return _0x1ffe71[_0x490cb9(0x15c)]===_0x490cb9(0x180)||_0x1ffe71[_0x490cb9(0x15c)]==='jsonl'?await handleSDKOutput([{'sql':_0x326f87}],_0x1ffe71):console[_0x490cb9(0x148)](_0x326f87),0x0;}catch(_0x78cb7d){if(_0x78cb7d instanceof SDKError)return console[_0x490cb9(0x111)](_0x490cb9(0x13f)+_0x78cb7d[_0x490cb9(0x116)]),_0x78cb7d[_0x490cb9(0x140)]&&console[_0x490cb9(0x111)](_0x490cb9(0x175)+_0x78cb7d[_0x490cb9(0x140)]),0x1;throw _0x78cb7d;}}async[a35_0x29f1cb(0x105)](_0x1f2227,_0x29e9a4){const _0x46f3a2=a35_0x29f1cb,{options:_0x577f80,tdx:_0x595832}=_0x29e9a4;let _0x501981;try{_0x501981=await resolveYamlFilePath(_0x1f2227);}catch(_0x56bc17){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x46f3a2(0x113)+_0x56bc17[_0x46f3a2(0x116)]);}_0x577f80[_0x46f3a2(0xf7)]&&console[_0x46f3a2(0x111)]('Resolved:\x20'+_0x501981[_0x46f3a2(0x103)]+'/'+_0x501981[_0x46f3a2(0x164)]);const _0x29d900=await withSpinner(_0x46f3a2(0xff),()=>_0x595832[_0x46f3a2(0x12c)][_0x46f3a2(0x14c)](_0x501981[_0x46f3a2(0x18c)],_0x501981[_0x46f3a2(0x103)],_0x501981['segmentName']),{'verbose':_0x577f80[_0x46f3a2(0xf7)]});return _0x29d900[_0x46f3a2(0x167)];}async[a35_0x29f1cb(0x126)](_0x3ed7c0,_0x39f724){const _0x4a8029=a35_0x29f1cb,{options:_0x39f2da,tdx:_0x58c445}=_0x39f724,_0x58fa2a=_0x39f2da['parentSegment'],_0x5a7e75=await resolveSegmentTarget(_0x3ed7c0,_0x58fa2a,_0x39f2da[_0x4a8029(0xf7)]);_0x39f2da['verbose']&&console[_0x4a8029(0x111)]('Target\x20path:\x20'+_0x5a7e75);const _0x59f070=await withSpinner(_0x4a8029(0x188)+_0x3ed7c0+_0x4a8029(0x12f),()=>_0x58c445[_0x4a8029(0x12c)][_0x4a8029(0x158)](_0x5a7e75),{'verbose':_0x39f2da[_0x4a8029(0xf7)]}),_0x19f95d=_0x59f070[_0x4a8029(0x167)];_0x39f2da[_0x4a8029(0xf7)]&&(console[_0x4a8029(0x111)](_0x4a8029(0xfe)+_0x19f95d[_0x4a8029(0x12e)]),console[_0x4a8029(0x111)]('Parent\x20ID:\x20'+_0x19f95d[_0x4a8029(0x16b)]));if(_0x19f95d['type']==='folder')throw new SDKError(ErrorCode[_0x4a8029(0x151)],_0x4a8029(0x11d));if(_0x19f95d[_0x4a8029(0x12e)]===_0x4a8029(0x159))throw new SDKError(ErrorCode[_0x4a8029(0x151)],_0x4a8029(0x169));if(!_0x19f95d[_0x4a8029(0x101)])throw new SDKError(ErrorCode[_0x4a8029(0x130)],_0x4a8029(0x10c));const _0x177f5a=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x58c445[_0x4a8029(0x12c)][_0x4a8029(0x10b)](_0x19f95d[_0x4a8029(0x16b)],_0x19f95d[_0x4a8029(0x101)]),{'verbose':_0x39f2da[_0x4a8029(0xf7)]});return _0x177f5a[_0x4a8029(0x167)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a35_0x29f1cb(0x18b)]=a35_0x29f1cb(0x14a);[a35_0x29f1cb(0x181)]=a35_0x29f1cb(0x135);async[a35_0x29f1cb(0x191)](_0x5e6218){const _0x546090=a35_0x29f1cb,{options:_0x3634c6,args:_0x11b78b,tdx:_0x3e6ae1}=_0x5e6218,_0x1ef102=_0x3634c6;if(_0x11b78b[_0x546090(0x163)]<0x2)return console[_0x546090(0x111)](_0x546090(0x128)),console[_0x546090(0x111)](_0x546090(0x144)),0x1;const _0x33255f=_0x11b78b[0x0],_0x518614=_0x11b78b[0x1];_0x1ef102[_0x546090(0xf7)]&&(console[_0x546090(0x111)]('Site:\x20'+_0x1ef102[_0x546090(0xfd)]),console[_0x546090(0x111)]('Parent\x20segment:\x20'+_0x33255f),console[_0x546090(0x111)](_0x546090(0x10f)+_0x518614));let _0x16472a;if(_0x1ef102[_0x546090(0x165)]){const _0x35ec7f=_0x1ef102[_0x546090(0x165)],_0x208a02=await withSpinner(_0x546090(0x11c)+_0x33255f+_0x546090(0x12f),()=>_0x3e6ae1[_0x546090(0x12c)]['resolveParentId'](_0x33255f),{'verbose':_0x1ef102[_0x546090(0xf7)]}),_0x34f213=_0x208a02[_0x546090(0x167)],_0x504947=await withSpinner(_0x546090(0x13a)+_0x35ec7f+_0x546090(0x12f),()=>_0x3e6ae1['segment'][_0x546090(0x109)](_0x34f213,_0x35ec7f),{'verbose':_0x1ef102[_0x546090(0xf7)]});_0x16472a=_0x504947[_0x546090(0x167)],_0x1ef102[_0x546090(0xf7)]&&console[_0x546090(0x111)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x16472a);}const _0x1ace21={'name':_0x518614,'description':_0x1ef102[_0x546090(0x181)],'parentFolderId':_0x16472a},_0x3ab7e4=await withSpinner('Creating\x20folder\x20\x27'+_0x518614+'\x27...',()=>_0x3e6ae1[_0x546090(0x12c)][_0x546090(0x136)](_0x33255f,_0x1ace21),{'verbose':_0x1ef102['verbose']}),_0x4d4f=_0x3ab7e4[_0x546090(0x167)];return console[_0x546090(0x111)]('✔\x20Created\x20folder\x20\x27'+_0x4d4f[_0x546090(0x18b)]+_0x546090(0x18a)+_0x4d4f['id']),await handleSDKOutput([_0x4d4f],_0x1ef102),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']='segment:view';['description']=a35_0x29f1cb(0x110);async['execute'](_0x208a42){const _0x53e92d=a35_0x29f1cb,{options:_0x2b322d,args:_0x1628bd,tdx:_0x130fb5}=_0x208a42,_0x21332d=_0x1628bd[0x0];if(!_0x21332d)return console[_0x53e92d(0x111)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error'](_0x53e92d(0x13d)),console['error'](_0x53e92d(0x14f)),console[_0x53e92d(0x111)](_0x53e92d(0xf9)),console[_0x53e92d(0x111)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console['error'](_0x53e92d(0x162)),console[_0x53e92d(0x111)](_0x53e92d(0x17c)),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console['error'](_0x53e92d(0x100)),console[_0x53e92d(0x111)](_0x53e92d(0x199)),0x1;try{const _0x15271c=_0x2b322d[_0x53e92d(0x103)],_0x50020f=await resolveSegmentTarget(_0x21332d,_0x15271c,_0x2b322d[_0x53e92d(0xf7)]);_0x2b322d[_0x53e92d(0xf7)]&&console[_0x53e92d(0x111)](_0x53e92d(0x152)+_0x50020f);const _0xf92564=await withSpinner(_0x53e92d(0x188)+_0x21332d+_0x53e92d(0x12f),()=>_0x130fb5['segment'][_0x53e92d(0x158)](_0x50020f),{'verbose':_0x2b322d[_0x53e92d(0xf7)]}),_0x56caa3=_0xf92564['data'];_0x2b322d[_0x53e92d(0xf7)]&&(console[_0x53e92d(0x111)](_0x53e92d(0xfe)+_0x56caa3[_0x53e92d(0x12e)]),console['error'](_0x53e92d(0x195)+_0x56caa3['parentId']),_0x56caa3['folderId']&&console[_0x53e92d(0x111)](_0x53e92d(0x120)+_0x56caa3['folderId']),_0x56caa3[_0x53e92d(0x101)]&&console['error'](_0x53e92d(0x193)+_0x56caa3[_0x53e92d(0x101)]));if(_0x2b322d['web']){if(_0x56caa3[_0x53e92d(0x12e)]===_0x53e92d(0x16f))return console[_0x53e92d(0x111)](_0x53e92d(0x12a)),0x1;if(_0x56caa3[_0x53e92d(0x12e)]===_0x53e92d(0x159))return console[_0x53e92d(0x111)](_0x53e92d(0x18e)),console['error'](_0x53e92d(0xfc)),0x1;if(!_0x56caa3['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x53e92d(0x10c));const _0x546d07=getConsoleNextUrl(_0x2b322d[_0x53e92d(0xfd)],_0x53e92d(0x17d)+_0x56caa3[_0x53e92d(0x16b)]+_0x53e92d(0x17a)+_0x56caa3[_0x53e92d(0x101)]);return console[_0x53e92d(0x111)](a35_0x4e64e3['green']('✔')+_0x53e92d(0x127)+a35_0x4e64e3[_0x53e92d(0x132)](_0x546d07)),openBrowser(_0x546d07),0x0;}if(_0x56caa3['type']===_0x53e92d(0x16f)){if(!_0x56caa3['folderId'])throw new SDKError(ErrorCode[_0x53e92d(0x192)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1c7b1f=await withSpinner(_0x53e92d(0x150),()=>_0x130fb5[_0x53e92d(0x12c)][_0x53e92d(0x147)](_0x56caa3[_0x53e92d(0x197)]),{'verbose':_0x2b322d['verbose']});await handleSingleObjectOutput(_0x1c7b1f[_0x53e92d(0x167)],_0x2b322d);}else{if(_0x56caa3[_0x53e92d(0x12e)]===_0x53e92d(0x12c)){if(!_0x56caa3['segmentId'])throw new SDKError(ErrorCode[_0x53e92d(0x130)],_0x53e92d(0x10c));const _0x52504d=await withSpinner('Fetching\x20segment\x20details...',()=>_0x130fb5[_0x53e92d(0x12c)][_0x53e92d(0x157)](_0x56caa3[_0x53e92d(0x16b)],_0x56caa3[_0x53e92d(0x101)]),{'verbose':_0x2b322d['verbose']}),_0x1d40b5=getConsoleNextUrl(_0x2b322d[_0x53e92d(0xfd)],_0x53e92d(0x17d)+_0x56caa3[_0x53e92d(0x16b)]+_0x53e92d(0x17a)+_0x56caa3[_0x53e92d(0x101)]),_0x19bcbf=_0x52504d[_0x53e92d(0x167)];_0x19bcbf[_0x53e92d(0x15f)]=_0x1d40b5,await handleSingleObjectOutput(_0x19bcbf,_0x2b322d);}else return console[_0x53e92d(0x111)](_0x53e92d(0xfa)),console['error'](_0x53e92d(0x176)),0x1;}return 0x0;}catch(_0x31933c){if(_0x31933c instanceof SDKError)return console[_0x53e92d(0x111)](_0x53e92d(0x13f)+_0x31933c[_0x53e92d(0x116)]),_0x31933c['cause']&&console[_0x53e92d(0x111)](_0x53e92d(0x175)+_0x31933c[_0x53e92d(0x140)]),0x1;throw _0x31933c;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']=a35_0x29f1cb(0xf5);[a35_0x29f1cb(0x181)]=a35_0x29f1cb(0x125);async[a35_0x29f1cb(0x191)](_0x1dfb1c){const _0x3d5b80=a35_0x29f1cb,{options:_0x3a8749,args:_0x271f1d,tdx:_0xbad1e3}=_0x1dfb1c,_0xf89302=_0x271f1d[0x0];if(!_0xf89302)return console[_0x3d5b80(0x111)](_0x3d5b80(0x18d)),console[_0x3d5b80(0x111)](_0x3d5b80(0x138)),console['error'](_0x3d5b80(0xfb)),console[_0x3d5b80(0x111)](_0x3d5b80(0x162)),console[_0x3d5b80(0x111)](_0x3d5b80(0x15d)),console['error']('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x2f4f7d=_0x3a8749[_0x3d5b80(0x103)],_0x1a84ac=await resolveSegmentTarget(_0xf89302,_0x2f4f7d,_0x3a8749[_0x3d5b80(0xf7)]);_0x3a8749[_0x3d5b80(0xf7)]&&console[_0x3d5b80(0x111)](_0x3d5b80(0x152)+_0x1a84ac);const _0x52d050=await withSpinner(_0x3d5b80(0x188)+_0xf89302+_0x3d5b80(0x12f),()=>_0xbad1e3[_0x3d5b80(0x12c)][_0x3d5b80(0x158)](_0x1a84ac),{'verbose':_0x3a8749[_0x3d5b80(0xf7)]}),_0x4a77f8=_0x52d050[_0x3d5b80(0x167)];_0x3a8749[_0x3d5b80(0xf7)]&&(console[_0x3d5b80(0x111)](_0x3d5b80(0xfe)+_0x4a77f8[_0x3d5b80(0x12e)]),console[_0x3d5b80(0x111)](_0x3d5b80(0x195)+_0x4a77f8[_0x3d5b80(0x16b)]));if(_0x4a77f8[_0x3d5b80(0x12e)]==='folder')return console[_0x3d5b80(0x111)]('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console['error'](_0x3d5b80(0x185)),0x1;if(_0x4a77f8[_0x3d5b80(0x12e)]==='parent')return console[_0x3d5b80(0x111)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x3d5b80(0x111)](_0x3d5b80(0x122)),0x1;if(!_0x4a77f8['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x3d5b80(0x10c));const _0x51e48e=await withSpinner(_0x3d5b80(0x10e),()=>_0xbad1e3[_0x3d5b80(0x12c)][_0x3d5b80(0x10b)](_0x4a77f8[_0x3d5b80(0x16b)],_0x4a77f8[_0x3d5b80(0x101)]),{'verbose':_0x3a8749[_0x3d5b80(0xf7)]}),_0x467962=_0x51e48e['data'],_0xeb260=await executeSchemaQuery(_0x467962,_0xbad1e3,_0x3a8749);return await handleQueryOutput(_0xeb260,_0x3a8749),0x0;}catch(_0x4627b9){if(_0x4627b9 instanceof SDKError)return console[_0x3d5b80(0x111)]('Error:\x20'+_0x4627b9[_0x3d5b80(0x116)]),_0x4627b9['cause']&&console['error'](_0x3d5b80(0x175)+_0x4627b9['cause']),0x1;throw _0x4627b9;}}}
1
+ const a36_0x5eb1c3=a36_0x2f15;(function(_0x5eda4c,_0x5a73c){const _0x5b5f61=a36_0x2f15,_0x5b88ea=_0x5eda4c();while(!![]){try{const _0x2fc7e0=parseInt(_0x5b5f61(0x233))/0x1+parseInt(_0x5b5f61(0x204))/0x2+parseInt(_0x5b5f61(0x1b7))/0x3+parseInt(_0x5b5f61(0x1cb))/0x4*(parseInt(_0x5b5f61(0x1f4))/0x5)+-parseInt(_0x5b5f61(0x236))/0x6+parseInt(_0x5b5f61(0x201))/0x7+-parseInt(_0x5b5f61(0x221))/0x8*(parseInt(_0x5b5f61(0x213))/0x9);if(_0x2fc7e0===_0x5a73c)break;else _0x5b88ea['push'](_0x5b88ea['shift']());}catch(_0x5d6184){_0x5b88ea['push'](_0x5b88ea['shift']());}}}(a36_0x37e1,0x6cd0a));function a36_0x37e1(){const _0xbc6dff=['Error:\x20Folder\x20reference\x20is\x20required','message','setJobId','\x27\x20with\x20ID:\x20','fullPath','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Fetching\x20SQL\x20from\x20rule...','execute','red','Resolved\x20folder\x20ID:\x20','SELECT\x20*\x20FROM\x20(\x0a','getFolder','Resolving\x20parent\x20segment\x20\x27','/e/','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','(root)','parentFolder','processedRows','\x27...','\x20[Job\x20ID:\x20','Folder\x20ID\x20missing\x20from\x20resolved\x20path','segment','toLocaleString','site','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','verbose','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','getSegmentSQLFromYaml','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Fetching\x20folder\x20details...','Creating\x20folder\x20\x27','Resolved\x20YAML\x20file:\x20','✔\x20Created\x20folder\x20\x27','Fetching\x20segment\x20details...','25czGvJs','data','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','getSQLFromYamlFile','segmentPath','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Examples:','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','type','Fetching\x20SQL\x20for\x20segment...','3878483SBxGVx','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','segment:folder:show','81080bMqJLg','createFolder','Segment\x20ID\x20missing\x20from\x20resolved\x20path','path','Error:\x20','error','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','Show\x20folder\x20or\x20child\x20segment\x20details','Resolving\x20path\x20\x27','/app/ps/','information_schema','getSQLFromServerSegment','jsonl','segmentName','trim','219303wneXFS','Fetching\x20folder\x20\x27','Parent\x20ID:\x20','Usage:','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','segment:folder:create','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','folderId','Parent\x20name:\x20','test','limit','344AkWBJR','\x20\x20Segment\x20name:\x20','resolveParentId','Resolved\x20parent\x20folder\x20ID:\x20','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','Resolving\x20folder\x20\x27','\x20\x20Cause:\x20','cause','resolvePathToResource','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Resolved\x20type:\x20','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','\x20\x20Folder\x20path:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','resolveFolderId','Use:\x20tdx\x20ps\x20show','48300HsKMhM','Use:\x20tdx\x20ps\x20view','Error:\x20Path\x20or\x20name\x20is\x20required','865704olMkwX','getSegment','Fetching\x20parent\x20segment\x20details...','Folder\x20name:\x20','segment:show','jobId','length','query','name','Show\x20segment\x20or\x20folder\x20details','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','SEGMENT_NOT_FOUND','Resolved:\x20','Use:\x20tdx\x20ps\x20view\x20-w','segmentId','✔\x20Query\x20completed:\x20Processed\x20','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','✔\x20Found\x20','folder','in\x20','Target\x20path:\x20','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Site:\x20','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Resolving\x20\x27','getParent','green','parentId','description','Usage:\x20tdx\x20segment\x20describe\x20<path>','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Resolved\x20parent\x20ID:\x20','Show\x20segment\x20folder\x20details','Usage:\x20tdx\x20sg\x20show\x20<name>','parent','✖\x20Query\x20failed\x20[','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','2218911AmZEoq','folderPath','\x20\x20Parent\x20segment:\x20','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','code','SQL\x20query:\x0a','stats','includes','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','listFolders','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Error:\x20Parent\x20segment\x20name\x20is\x20required','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Folder\x20ID:\x20','getSegmentSQL','segment:sql','parentSegment','format','INVALID_ARGUMENT','content','204180mxKcJE','segment:desc','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Usage:\x20tdx\x20sg\x20desc\x20<name>','\x20Opening\x20'];a36_0x37e1=function(){return _0xbc6dff;};return a36_0x37e1();}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 a36_0x307049 from'chalk';async function resolveSegmentTarget(_0x47e4a8,_0x4350c6,_0x6ba073){const _0x18834e=a36_0x2f15;if(isYamlFilePath(_0x47e4a8))try{const _0x5ccfd3=await resolveYamlFilePath(_0x47e4a8);return _0x6ba073&&(console[_0x18834e(0x209)](_0x18834e(0x1f1)+_0x47e4a8),console[_0x18834e(0x209)](_0x18834e(0x1b9)+_0x5ccfd3[_0x18834e(0x1c7)]),console[_0x18834e(0x209)](_0x18834e(0x222)+_0x5ccfd3[_0x18834e(0x211)]),console[_0x18834e(0x209)](_0x18834e(0x22d)+(_0x5ccfd3[_0x18834e(0x1b8)]||_0x18834e(0x1df))),console[_0x18834e(0x209)]('\x20\x20Full\x20path:\x20'+_0x5ccfd3[_0x18834e(0x1d4)])),_0x5ccfd3['fullPath'];}catch(_0x3a3185){throw new SDKError(ErrorCode[_0x18834e(0x1c9)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x3a3185[_0x18834e(0x1d1)]);}if(!_0x4350c6)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x18834e(0x22a));return _0x4350c6+'/'+_0x47e4a8;}export class SegmentDescribeCommand extends BaseCommand{[a36_0x5eb1c3(0x23e)]='segment:describe';[a36_0x5eb1c3(0x252)]=a36_0x5eb1c3(0x23f);async[a36_0x5eb1c3(0x1d7)](_0x4a5f94){const _0x4ffada=a36_0x5eb1c3,{options:_0x4a6463,args:_0x2fa789,tdx:_0x16725e}=_0x4a5f94,_0x540826=_0x2fa789[0x0],_0x4ecf15=!_0x540826&&!!_0x4a6463[_0x4ffada(0x1c7)],_0x37cf0f=_0x540826||_0x4a6463['parentSegment'];if(!_0x37cf0f)return console[_0x4ffada(0x209)](_0x4ffada(0x235)),console[_0x4ffada(0x209)](_0x4ffada(0x253)),console[_0x4ffada(0x209)]('Examples:'),console[_0x4ffada(0x209)](_0x4ffada(0x1e8)),console['error'](_0x4ffada(0x1fb)),console['error'](_0x4ffada(0x21c)),console[_0x4ffada(0x209)](_0x4ffada(0x1eb)),0x1;try{const _0x154f56=_0x4a6463[_0x4ffada(0x1fa)];let _0x4b0631=_0x37cf0f;!_0x4ecf15&&_0x154f56&&!_0x37cf0f[_0x4ffada(0x1be)]('/')&&(_0x4b0631=_0x154f56+'/'+_0x37cf0f,_0x4a6463[_0x4ffada(0x1ea)]&&console[_0x4ffada(0x209)]('Resolved\x20relative\x20path\x20to:\x20'+_0x4b0631));const _0x283666=await withSpinner(_0x4ffada(0x20c)+_0x4b0631+'\x27...',()=>_0x16725e[_0x4ffada(0x1e5)]['resolvePathToResource'](_0x4b0631),{'verbose':_0x4a6463['verbose']}),_0x1026fb=_0x283666['data'];_0x4a6463['verbose']&&(console[_0x4ffada(0x209)]('Resolved\x20type:\x20'+_0x1026fb[_0x4ffada(0x1ff)]),console[_0x4ffada(0x209)]('Parent\x20ID:\x20'+_0x1026fb[_0x4ffada(0x251)]),_0x1026fb[_0x4ffada(0x21d)]&&console['error'](_0x4ffada(0x1c4)+_0x1026fb[_0x4ffada(0x21d)]),_0x1026fb['segmentId']&&console[_0x4ffada(0x209)]('Segment\x20ID:\x20'+_0x1026fb['segmentId']));if(_0x1026fb[_0x4ffada(0x1ff)]===_0x4ffada(0x1b4)){const _0x48cb12=await withSpinner(_0x4ffada(0x238),()=>_0x16725e['segment'][_0x4ffada(0x24f)](_0x1026fb[_0x4ffada(0x251)]),{'verbose':_0x4a6463[_0x4ffada(0x1ea)]});await handleSingleObjectOutput(_0x48cb12['data'],_0x4a6463);}else{if(_0x1026fb[_0x4ffada(0x1ff)]===_0x4ffada(0x248)){if(!_0x1026fb[_0x4ffada(0x21d)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x4ffada(0x1e4));const _0x5d4640=await withSpinner(_0x4ffada(0x1ef),()=>_0x16725e[_0x4ffada(0x1e5)][_0x4ffada(0x1db)](_0x1026fb[_0x4ffada(0x21d)]),{'verbose':_0x4a6463[_0x4ffada(0x1ea)]});await handleSingleObjectOutput(_0x5d4640[_0x4ffada(0x1f5)],_0x4a6463);}else{if(_0x1026fb[_0x4ffada(0x1ff)]==='segment'){if(!_0x1026fb[_0x4ffada(0x244)])throw new SDKError(ErrorCode[_0x4ffada(0x241)],_0x4ffada(0x206));const _0xe814df=await withSpinner(_0x4ffada(0x1f3),()=>_0x16725e['segment']['getSegment'](_0x1026fb[_0x4ffada(0x251)],_0x1026fb[_0x4ffada(0x244)]),{'verbose':_0x4a6463[_0x4ffada(0x1ea)]});await handleSingleObjectOutput(_0xe814df['data'],_0x4a6463);}}}return 0x0;}catch(_0x461476){if(_0x461476 instanceof SDKError)return console[_0x4ffada(0x209)]('Error:\x20'+_0x461476['message']),_0x461476[_0x4ffada(0x228)]&&console[_0x4ffada(0x209)](_0x4ffada(0x227)+_0x461476[_0x4ffada(0x228)]),0x1;throw _0x461476;}}}export class SegmentShowCommand extends BaseCommand{[a36_0x5eb1c3(0x23e)]=a36_0x5eb1c3(0x23a);['description']='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a36_0x5eb1c3(0x1d7)](_0x2b53b9){const _0x1a45d2=a36_0x5eb1c3,{options:_0x34eb53,args:_0x199fcd,tdx:_0x37154b}=_0x2b53b9,_0x570eb6=_0x199fcd[0x0];if(!_0x570eb6)return console['error']('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x1a45d2(0x209)](_0x1a45d2(0x1b3)),console[_0x1a45d2(0x209)](_0x1a45d2(0x22e)),console[_0x1a45d2(0x209)]('Examples:'),console['error'](_0x1a45d2(0x240)),console[_0x1a45d2(0x209)](_0x1a45d2(0x1ec)),0x1;try{const _0x44d675=_0x34eb53['parentSegment'],_0x1a7863=await resolveSegmentTarget(_0x570eb6,_0x44d675,_0x34eb53[_0x1a45d2(0x1ea)]);_0x34eb53[_0x1a45d2(0x1ea)]&&console[_0x1a45d2(0x209)](_0x1a45d2(0x24a)+_0x1a7863);const _0xf3f2cc=await withSpinner('Resolving\x20\x27'+_0x570eb6+'\x27...',()=>_0x37154b[_0x1a45d2(0x1e5)][_0x1a45d2(0x229)](_0x1a7863),{'verbose':_0x34eb53[_0x1a45d2(0x1ea)]}),_0x4d929e=_0xf3f2cc[_0x1a45d2(0x1f5)];_0x34eb53[_0x1a45d2(0x1ea)]&&(console['error'](_0x1a45d2(0x22b)+_0x4d929e['type']),console['error'](_0x1a45d2(0x215)+_0x4d929e[_0x1a45d2(0x251)]));if(_0x4d929e[_0x1a45d2(0x1ff)]==='folder')return console['error'](_0x1a45d2(0x254)),console['error'](_0x1a45d2(0x1fe)),0x1;if(_0x4d929e[_0x1a45d2(0x1ff)]===_0x1a45d2(0x1b4))return console[_0x1a45d2(0x209)](_0x1a45d2(0x202)),console[_0x1a45d2(0x209)](_0x1a45d2(0x232)),0x1;if(!_0x4d929e[_0x1a45d2(0x244)])throw new SDKError(ErrorCode[_0x1a45d2(0x241)],_0x1a45d2(0x206));const _0x3959e=await withSpinner(_0x1a45d2(0x200),()=>_0x37154b[_0x1a45d2(0x1e5)]['getSegmentSQL'](_0x4d929e[_0x1a45d2(0x251)],_0x4d929e['segmentId']),{'verbose':_0x34eb53[_0x1a45d2(0x1ea)]});let _0xf7912=_0x3959e[_0x1a45d2(0x1f5)];const _0x1abcc9=resolveLimit(_0x34eb53[_0x1a45d2(0x220)],DEFAULT_DISPLAY_LIMIT),_0x1ecd45=/\bLIMIT\s+\d+/i[_0x1a45d2(0x21f)](_0xf7912);!_0x1ecd45&&(_0xf7912=_0xf7912[_0x1a45d2(0x212)]()['replace'](/;+$/,''),_0xf7912=_0x1a45d2(0x1da)+_0xf7912+_0x1a45d2(0x218)+_0x1abcc9);_0x34eb53[_0x1a45d2(0x1ea)]&&console[_0x1a45d2(0x209)](_0x1a45d2(0x1bc)+_0xf7912);const _0x2fabb0=await withProgressSpinner('Executing\x20segment\x20query...',async _0x1518e=>{const _0x39b0fb=_0x1a45d2,_0x595811=await _0x37154b[_0x39b0fb(0x23d)][_0x39b0fb(0x1d7)](_0xf7912,{'catalog':'td','schema':_0x39b0fb(0x20e),'onJobId':_0x5324b8=>{const _0x4234af=_0x39b0fb;_0x1518e[_0x4234af(0x1d2)](_0x5324b8);}});return _0x595811;},{'verbose':_0x34eb53['verbose']}),_0x1f6c63=_0x2fabb0[_0x1a45d2(0x1f5)],_0x207a16=_0x1f6c63['jobId']?_0x1a45d2(0x1e3)+_0x1f6c63[_0x1a45d2(0x23b)]+']':'';return console[_0x1a45d2(0x209)](_0x1a45d2(0x245)+_0x1f6c63['stats'][_0x1a45d2(0x1e1)][_0x1a45d2(0x1e6)]()+'\x20rows\x20'+(_0x1a45d2(0x249)+formatElapsed(_0x1f6c63[_0x1a45d2(0x1bd)]['elapsedTimeMillis'])+_0x207a16)),await handleQueryOutput(_0x1f6c63,_0x34eb53),0x0;}catch(_0x5e888a){if(_0x5e888a instanceof SDKError)return console[_0x1a45d2(0x209)](_0x1a45d2(0x1b5)+_0x5e888a[_0x1a45d2(0x1bb)]+']'),console[_0x1a45d2(0x209)]('\x0a'+_0x5e888a[_0x1a45d2(0x1d1)]),0x1;throw _0x5e888a;}}}function a36_0x2f15(_0x448998,_0x480a23){_0x448998=_0x448998-0x1b3;const _0x37e187=a36_0x37e1();let _0x2f15f5=_0x37e187[_0x448998];return _0x2f15f5;}export class SegmentFolderListCommand extends BaseCommand{['name']='segment:folder:list';['description']=a36_0x5eb1c3(0x1c1);async[a36_0x5eb1c3(0x1d7)](_0xeb1739){const _0x5b9f6a=a36_0x5eb1c3,{options:_0x512f48,args:_0x3754f9,tdx:_0x44f317}=_0xeb1739;if(_0x3754f9[_0x5b9f6a(0x23c)]===0x0)return console['error'](_0x5b9f6a(0x1c2)),console['error'](_0x5b9f6a(0x1cd)),0x1;const _0x1db72d=_0x3754f9[0x0];try{_0x512f48[_0x5b9f6a(0x1ea)]&&(console[_0x5b9f6a(0x209)](_0x5b9f6a(0x24c)+_0x512f48[_0x5b9f6a(0x1e7)]),console[_0x5b9f6a(0x209)](_0x5b9f6a(0x21e)+_0x1db72d));const _0x43dd2a=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x1db72d+_0x5b9f6a(0x1e2),()=>_0x44f317[_0x5b9f6a(0x1e5)][_0x5b9f6a(0x223)](_0x1db72d),{'verbose':_0x512f48['verbose']}),_0x118250=_0x43dd2a[_0x5b9f6a(0x1f5)];_0x512f48['verbose']&&console[_0x5b9f6a(0x209)](_0x5b9f6a(0x255)+_0x118250);const _0x9306c6=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x1db72d+_0x5b9f6a(0x1e2),()=>_0x44f317[_0x5b9f6a(0x1e5)][_0x5b9f6a(0x1c0)](_0x118250),{'verbose':_0x512f48[_0x5b9f6a(0x1ea)]}),_0x58e7c0=_0x9306c6['data'];return console[_0x5b9f6a(0x209)](_0x5b9f6a(0x247)+_0x58e7c0[_0x5b9f6a(0x23c)]+'\x20folder'+(_0x58e7c0[_0x5b9f6a(0x23c)]!==0x1?'s':'')),await handleSDKOutput(_0x58e7c0,_0x512f48),0x0;}catch(_0x238564){if(_0x238564 instanceof SDKError)return console[_0x5b9f6a(0x209)](_0x5b9f6a(0x208)+_0x238564['message']),_0x238564[_0x5b9f6a(0x228)]&&console['error'](_0x5b9f6a(0x227)+_0x238564[_0x5b9f6a(0x228)]),0x1;throw _0x238564;}}}export class SegmentFolderShowCommand extends BaseCommand{[a36_0x5eb1c3(0x23e)]=a36_0x5eb1c3(0x203);[a36_0x5eb1c3(0x252)]=a36_0x5eb1c3(0x256);async[a36_0x5eb1c3(0x1d7)](_0x54f4ac){const _0x43cd0e=a36_0x5eb1c3,{options:_0x4db9d6,args:_0x28883c,tdx:_0x463e43}=_0x54f4ac;if(_0x28883c[_0x43cd0e(0x23c)]===0x0)return console[_0x43cd0e(0x209)](_0x43cd0e(0x1d0)),console[_0x43cd0e(0x209)](_0x43cd0e(0x21a)),0x1;try{const {parentId:_0x467a8e,childId:_0x5f4236}=parseSegmentRef(_0x28883c[0x0]);_0x4db9d6['verbose']&&(console['error']('Site:\x20'+_0x4db9d6['site']),console['error'](_0x43cd0e(0x21e)+_0x467a8e),_0x5f4236&&console[_0x43cd0e(0x209)]('Folder\x20name:\x20'+_0x5f4236));if(!_0x5f4236)return console[_0x43cd0e(0x209)](_0x43cd0e(0x1d5)),0x1;const _0x513773=await withSpinner(_0x43cd0e(0x1dc)+_0x467a8e+'\x27...',()=>_0x463e43['segment'][_0x43cd0e(0x223)](_0x467a8e),{'verbose':_0x4db9d6[_0x43cd0e(0x1ea)]}),_0x2176f0=_0x513773[_0x43cd0e(0x1f5)];_0x4db9d6['verbose']&&console[_0x43cd0e(0x209)]('Resolved\x20parent\x20ID:\x20'+_0x2176f0);const _0xa27be8=await withSpinner(_0x43cd0e(0x226)+_0x5f4236+_0x43cd0e(0x1e2),()=>_0x463e43['segment'][_0x43cd0e(0x231)](_0x2176f0,_0x5f4236),{'verbose':_0x4db9d6[_0x43cd0e(0x1ea)]}),_0x17b99c=_0xa27be8[_0x43cd0e(0x1f5)];_0x4db9d6[_0x43cd0e(0x1ea)]&&console[_0x43cd0e(0x209)](_0x43cd0e(0x1d9)+_0x17b99c);const _0x9b913=await withSpinner(_0x43cd0e(0x214)+_0x5f4236+_0x43cd0e(0x1e2),()=>_0x463e43[_0x43cd0e(0x1e5)][_0x43cd0e(0x1db)](_0x17b99c),{'verbose':_0x4db9d6[_0x43cd0e(0x1ea)]});return await handleSDKOutput([_0x9b913[_0x43cd0e(0x1f5)]],_0x4db9d6),0x0;}catch(_0x89b324){if(_0x89b324 instanceof SDKError)return console[_0x43cd0e(0x209)](_0x43cd0e(0x208)+_0x89b324[_0x43cd0e(0x1d1)]),_0x89b324['cause']&&console[_0x43cd0e(0x209)](_0x43cd0e(0x227)+_0x89b324[_0x43cd0e(0x228)]),0x1;throw _0x89b324;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a36_0x5eb1c3(0x1c6);[a36_0x5eb1c3(0x252)]='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a36_0x5eb1c3(0x1d7)](_0x5f30e3){const _0x9b9997=a36_0x5eb1c3,{options:_0x3c0e29,args:_0x71a986}=_0x5f30e3,_0x5e7099=_0x3c0e29,_0x29102b=_0x5e7099[_0x9b9997(0x207)],_0x2135fe=_0x71a986[0x0];if(!_0x2135fe&&!_0x29102b)return console['error'](a36_0x307049['red']('Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required')),console[_0x9b9997(0x209)](_0x9b9997(0x216)),console[_0x9b9997(0x209)](_0x9b9997(0x1f7)),console['error'](_0x9b9997(0x219)),console[_0x9b9997(0x209)](_0x9b9997(0x1fc)),console[_0x9b9997(0x209)](_0x9b9997(0x24d)),console[_0x9b9997(0x209)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml'),0x1;if(_0x2135fe&&_0x29102b)return console['error'](a36_0x307049[_0x9b9997(0x1d8)](_0x9b9997(0x225))),0x1;try{let _0x12e925;if(_0x29102b)_0x12e925=await this[_0x9b9997(0x1f9)](_0x29102b,_0x5f30e3);else{if(isYamlFilePath(_0x2135fe))return console[_0x9b9997(0x209)](a36_0x307049[_0x9b9997(0x1d8)](_0x9b9997(0x1b6))),console[_0x9b9997(0x209)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20'+_0x2135fe),0x1;else _0x12e925=await this[_0x9b9997(0x20f)](_0x2135fe,_0x5f30e3);}return _0x3c0e29[_0x9b9997(0x1c8)]==='json'||_0x3c0e29[_0x9b9997(0x1c8)]===_0x9b9997(0x210)?await handleSDKOutput([{'sql':_0x12e925}],_0x3c0e29):console['log'](_0x12e925),0x0;}catch(_0x6f28b2){if(_0x6f28b2 instanceof SDKError)return console[_0x9b9997(0x209)](_0x9b9997(0x208)+_0x6f28b2[_0x9b9997(0x1d1)]),_0x6f28b2[_0x9b9997(0x228)]&&console['error']('\x20\x20Cause:\x20'+_0x6f28b2['cause']),0x1;throw _0x6f28b2;}}async['getSQLFromYamlFile'](_0x2f1223,_0x2d316c){const _0x3e58e3=a36_0x5eb1c3,{options:_0x35b0c4,tdx:_0x29df38}=_0x2d316c;let _0x402d23;try{_0x402d23=await resolveYamlFilePath(_0x2f1223);}catch(_0x227be8){throw new SDKError(ErrorCode[_0x3e58e3(0x1c9)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x227be8[_0x3e58e3(0x1d1)]);}_0x35b0c4[_0x3e58e3(0x1ea)]&&console['error'](_0x3e58e3(0x242)+_0x402d23['parentSegment']+'/'+_0x402d23[_0x3e58e3(0x211)]);const _0xe780a2=await withSpinner(_0x3e58e3(0x1d6),()=>_0x29df38[_0x3e58e3(0x1e5)][_0x3e58e3(0x1ed)](_0x402d23[_0x3e58e3(0x1ca)],_0x402d23[_0x3e58e3(0x1c7)],_0x402d23[_0x3e58e3(0x211)]),{'verbose':_0x35b0c4[_0x3e58e3(0x1ea)]});return _0xe780a2[_0x3e58e3(0x1f5)];}async[a36_0x5eb1c3(0x20f)](_0x330903,_0x15b97a){const _0x135126=a36_0x5eb1c3,{options:_0x43f579,tdx:_0x1abdf5}=_0x15b97a,_0x5f2afe=_0x43f579[_0x135126(0x1c7)],_0x36ec60=await resolveSegmentTarget(_0x330903,_0x5f2afe,_0x43f579[_0x135126(0x1ea)]);_0x43f579[_0x135126(0x1ea)]&&console[_0x135126(0x209)](_0x135126(0x24a)+_0x36ec60);const _0x1a5061=await withSpinner(_0x135126(0x24e)+_0x330903+_0x135126(0x1e2),()=>_0x1abdf5['segment'][_0x135126(0x229)](_0x36ec60),{'verbose':_0x43f579[_0x135126(0x1ea)]}),_0x58abb3=_0x1a5061[_0x135126(0x1f5)];_0x43f579[_0x135126(0x1ea)]&&(console[_0x135126(0x209)]('Resolved\x20type:\x20'+_0x58abb3[_0x135126(0x1ff)]),console['error']('Parent\x20ID:\x20'+_0x58abb3['parentId']));if(_0x58abb3[_0x135126(0x1ff)]===_0x135126(0x248))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x135126(0x246));if(_0x58abb3[_0x135126(0x1ff)]===_0x135126(0x1b4))throw new SDKError(ErrorCode[_0x135126(0x1c9)],_0x135126(0x20a));if(!_0x58abb3[_0x135126(0x244)])throw new SDKError(ErrorCode[_0x135126(0x241)],_0x135126(0x206));const _0x5be6a5=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x1abdf5[_0x135126(0x1e5)][_0x135126(0x1c5)](_0x58abb3['parentId'],_0x58abb3['segmentId']),{'verbose':_0x43f579['verbose']});return _0x5be6a5['data'];}}export class SegmentFolderCreateCommand extends BaseCommand{[a36_0x5eb1c3(0x23e)]=a36_0x5eb1c3(0x21b);[a36_0x5eb1c3(0x252)]='Create\x20segment\x20folder\x20for\x20organization';async[a36_0x5eb1c3(0x1d7)](_0x5d8b62){const _0x313a16=a36_0x5eb1c3,{options:_0x1d80df,args:_0x5204d4,tdx:_0xe4521b}=_0x5d8b62,_0x49dcf5=_0x1d80df;if(_0x5204d4[_0x313a16(0x23c)]<0x2)return console['error']('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console[_0x313a16(0x209)](_0x313a16(0x1ba)),0x1;const _0x5a5e29=_0x5204d4[0x0],_0x2ca6fe=_0x5204d4[0x1];_0x49dcf5[_0x313a16(0x1ea)]&&(console[_0x313a16(0x209)]('Site:\x20'+_0x49dcf5[_0x313a16(0x1e7)]),console[_0x313a16(0x209)]('Parent\x20segment:\x20'+_0x5a5e29),console[_0x313a16(0x209)](_0x313a16(0x239)+_0x2ca6fe));let _0x4f4ea4;if(_0x49dcf5['parentFolder']){const _0x104a82=_0x49dcf5[_0x313a16(0x1e0)],_0x56b7fa=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5a5e29+_0x313a16(0x1e2),()=>_0xe4521b[_0x313a16(0x1e5)][_0x313a16(0x223)](_0x5a5e29),{'verbose':_0x49dcf5[_0x313a16(0x1ea)]}),_0x19997b=_0x56b7fa[_0x313a16(0x1f5)],_0x4330c1=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x104a82+'\x27...',()=>_0xe4521b[_0x313a16(0x1e5)]['resolveFolderId'](_0x19997b,_0x104a82),{'verbose':_0x49dcf5['verbose']});_0x4f4ea4=_0x4330c1[_0x313a16(0x1f5)],_0x49dcf5[_0x313a16(0x1ea)]&&console['error'](_0x313a16(0x224)+_0x4f4ea4);}const _0x38b84c={'name':_0x2ca6fe,'description':_0x49dcf5[_0x313a16(0x252)],'parentFolderId':_0x4f4ea4},_0x341930=await withSpinner(_0x313a16(0x1f0)+_0x2ca6fe+'\x27...',()=>_0xe4521b[_0x313a16(0x1e5)][_0x313a16(0x205)](_0x5a5e29,_0x38b84c),{'verbose':_0x49dcf5[_0x313a16(0x1ea)]}),_0x1eba90=_0x341930[_0x313a16(0x1f5)];return console[_0x313a16(0x209)](_0x313a16(0x1f2)+_0x1eba90[_0x313a16(0x23e)]+_0x313a16(0x1d3)+_0x1eba90['id']),await handleSDKOutput([_0x1eba90],_0x49dcf5),0x0;}}export class SegmentViewCommand extends BaseCommand{[a36_0x5eb1c3(0x23e)]='segment:view';[a36_0x5eb1c3(0x252)]=a36_0x5eb1c3(0x20b);async[a36_0x5eb1c3(0x1d7)](_0x3c2980){const _0x55e3d4=a36_0x5eb1c3,{options:_0x36b3fb,args:_0x277938,tdx:_0x6ca36e}=_0x3c2980,_0x3b1725=_0x277938[0x0];if(!_0x3b1725)return console['error']('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x55e3d4(0x209)]('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console[_0x55e3d4(0x209)](_0x55e3d4(0x22f)),console[_0x55e3d4(0x209)]('Options:'),console['error'](_0x55e3d4(0x24b)),console['error'](_0x55e3d4(0x1fc)),console[_0x55e3d4(0x209)](_0x55e3d4(0x1de)),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console['error'](_0x55e3d4(0x1ee)),console[_0x55e3d4(0x209)](_0x55e3d4(0x217)),0x1;try{const _0x581c43=_0x36b3fb[_0x55e3d4(0x1c7)],_0x465642=await resolveSegmentTarget(_0x3b1725,_0x581c43,_0x36b3fb[_0x55e3d4(0x1ea)]);_0x36b3fb[_0x55e3d4(0x1ea)]&&console[_0x55e3d4(0x209)](_0x55e3d4(0x24a)+_0x465642);const _0x2fda5b=await withSpinner(_0x55e3d4(0x24e)+_0x3b1725+_0x55e3d4(0x1e2),()=>_0x6ca36e['segment'][_0x55e3d4(0x229)](_0x465642),{'verbose':_0x36b3fb[_0x55e3d4(0x1ea)]}),_0xc851a0=_0x2fda5b[_0x55e3d4(0x1f5)];_0x36b3fb[_0x55e3d4(0x1ea)]&&(console[_0x55e3d4(0x209)]('Resolved\x20type:\x20'+_0xc851a0[_0x55e3d4(0x1ff)]),console[_0x55e3d4(0x209)](_0x55e3d4(0x215)+_0xc851a0[_0x55e3d4(0x251)]),_0xc851a0[_0x55e3d4(0x21d)]&&console[_0x55e3d4(0x209)](_0x55e3d4(0x1c4)+_0xc851a0[_0x55e3d4(0x21d)]),_0xc851a0[_0x55e3d4(0x244)]&&console[_0x55e3d4(0x209)]('Segment\x20ID:\x20'+_0xc851a0['segmentId']));if(_0x36b3fb['web']){if(_0xc851a0[_0x55e3d4(0x1ff)]==='folder')return console['error']('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0xc851a0[_0x55e3d4(0x1ff)]===_0x55e3d4(0x1b4))return console[_0x55e3d4(0x209)](_0x55e3d4(0x1e9)),console[_0x55e3d4(0x209)](_0x55e3d4(0x243)),0x1;if(!_0xc851a0[_0x55e3d4(0x244)])throw new SDKError(ErrorCode[_0x55e3d4(0x241)],_0x55e3d4(0x206));const _0x2e4377=getConsoleNextUrl(_0x36b3fb[_0x55e3d4(0x1e7)],_0x55e3d4(0x20d)+_0xc851a0[_0x55e3d4(0x251)]+_0x55e3d4(0x1dd)+_0xc851a0[_0x55e3d4(0x244)]);return console[_0x55e3d4(0x209)](a36_0x307049[_0x55e3d4(0x250)]('✔')+_0x55e3d4(0x1cf)+a36_0x307049['cyan'](_0x2e4377)),openBrowser(_0x2e4377),0x0;}if(_0xc851a0['type']===_0x55e3d4(0x248)){if(!_0xc851a0[_0x55e3d4(0x21d)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x55e3d4(0x1e4));const _0x1feab5=await withSpinner(_0x55e3d4(0x1ef),()=>_0x6ca36e[_0x55e3d4(0x1e5)]['getFolder'](_0xc851a0['folderId']),{'verbose':_0x36b3fb[_0x55e3d4(0x1ea)]});await handleSingleObjectOutput(_0x1feab5[_0x55e3d4(0x1f5)],_0x36b3fb);}else{if(_0xc851a0[_0x55e3d4(0x1ff)]===_0x55e3d4(0x1e5)){if(!_0xc851a0[_0x55e3d4(0x244)])throw new SDKError(ErrorCode[_0x55e3d4(0x241)],_0x55e3d4(0x206));const _0x129cfb=await withSpinner(_0x55e3d4(0x1f3),()=>_0x6ca36e[_0x55e3d4(0x1e5)][_0x55e3d4(0x237)](_0xc851a0['parentId'],_0xc851a0[_0x55e3d4(0x244)]),{'verbose':_0x36b3fb[_0x55e3d4(0x1ea)]}),_0x43731d=getConsoleNextUrl(_0x36b3fb[_0x55e3d4(0x1e7)],_0x55e3d4(0x20d)+_0xc851a0[_0x55e3d4(0x251)]+'/e/'+_0xc851a0['segmentId']),_0x5a60fb=_0x129cfb[_0x55e3d4(0x1f5)];_0x5a60fb['url']=_0x43731d,await handleSingleObjectOutput(_0x5a60fb,_0x36b3fb);}else return console[_0x55e3d4(0x209)](_0x55e3d4(0x1fd)),console['error'](_0x55e3d4(0x234)),0x1;}return 0x0;}catch(_0x50e036){if(_0x50e036 instanceof SDKError)return console[_0x55e3d4(0x209)]('Error:\x20'+_0x50e036[_0x55e3d4(0x1d1)]),_0x50e036['cause']&&console[_0x55e3d4(0x209)]('\x20\x20Cause:\x20'+_0x50e036[_0x55e3d4(0x228)]),0x1;throw _0x50e036;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a36_0x5eb1c3(0x23e)]=a36_0x5eb1c3(0x1cc);[a36_0x5eb1c3(0x252)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async[a36_0x5eb1c3(0x1d7)](_0x5cb613){const _0x4edfa9=a36_0x5eb1c3,{options:_0xf71536,args:_0x25d41b,tdx:_0x108734}=_0x5cb613,_0x436184=_0x25d41b[0x0];if(!_0x436184)return console[_0x4edfa9(0x209)](_0x4edfa9(0x1c3)),console[_0x4edfa9(0x209)](_0x4edfa9(0x1ce)),console[_0x4edfa9(0x209)](_0x4edfa9(0x230)),console[_0x4edfa9(0x209)]('Examples:'),console[_0x4edfa9(0x209)](_0x4edfa9(0x1f6)),console['error'](_0x4edfa9(0x22c)),0x1;try{const _0x2ece6f=_0xf71536[_0x4edfa9(0x1c7)],_0x13e69a=await resolveSegmentTarget(_0x436184,_0x2ece6f,_0xf71536[_0x4edfa9(0x1ea)]);_0xf71536[_0x4edfa9(0x1ea)]&&console[_0x4edfa9(0x209)](_0x4edfa9(0x24a)+_0x13e69a);const _0x243dcf=await withSpinner(_0x4edfa9(0x24e)+_0x436184+_0x4edfa9(0x1e2),()=>_0x108734[_0x4edfa9(0x1e5)]['resolvePathToResource'](_0x13e69a),{'verbose':_0xf71536[_0x4edfa9(0x1ea)]}),_0x41d725=_0x243dcf[_0x4edfa9(0x1f5)];_0xf71536[_0x4edfa9(0x1ea)]&&(console[_0x4edfa9(0x209)](_0x4edfa9(0x22b)+_0x41d725[_0x4edfa9(0x1ff)]),console[_0x4edfa9(0x209)]('Parent\x20ID:\x20'+_0x41d725[_0x4edfa9(0x251)]));if(_0x41d725[_0x4edfa9(0x1ff)]===_0x4edfa9(0x248))return console[_0x4edfa9(0x209)](_0x4edfa9(0x1bf)),console['error']('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x41d725[_0x4edfa9(0x1ff)]===_0x4edfa9(0x1b4))return console[_0x4edfa9(0x209)](_0x4edfa9(0x1f8)),console[_0x4edfa9(0x209)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x41d725['segmentId'])throw new SDKError(ErrorCode[_0x4edfa9(0x241)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1283d7=await withSpinner(_0x4edfa9(0x200),()=>_0x108734[_0x4edfa9(0x1e5)]['getSegmentSQL'](_0x41d725['parentId'],_0x41d725[_0x4edfa9(0x244)]),{'verbose':_0xf71536['verbose']}),_0x268ee7=_0x1283d7[_0x4edfa9(0x1f5)],_0x2f4037=await executeSchemaQuery(_0x268ee7,_0x108734,_0xf71536);return await handleQueryOutput(_0x2f4037,_0xf71536),0x0;}catch(_0x34c695){if(_0x34c695 instanceof SDKError)return console['error'](_0x4edfa9(0x208)+_0x34c695[_0x4edfa9(0x1d1)]),_0x34c695['cause']&&console['error'](_0x4edfa9(0x227)+_0x34c695[_0x4edfa9(0x228)]),0x1;throw _0x34c695;}}}
@@ -1 +1 @@
1
- const a36_0x4f3780=a36_0x2ea9;(function(_0x152d18,_0x927819){const _0x257ecb=a36_0x2ea9,_0x3e286f=_0x152d18();while(!![]){try{const _0x320ffc=-parseInt(_0x257ecb(0x129))/0x1*(parseInt(_0x257ecb(0x10c))/0x2)+parseInt(_0x257ecb(0x117))/0x3+parseInt(_0x257ecb(0x124))/0x4*(-parseInt(_0x257ecb(0x114))/0x5)+-parseInt(_0x257ecb(0x12c))/0x6*(-parseInt(_0x257ecb(0x137))/0x7)+-parseInt(_0x257ecb(0x11f))/0x8*(parseInt(_0x257ecb(0x13a))/0x9)+parseInt(_0x257ecb(0x128))/0xa+parseInt(_0x257ecb(0x121))/0xb;if(_0x320ffc===_0x927819)break;else _0x3e286f['push'](_0x3e286f['shift']());}catch(_0x544930){_0x3e286f['push'](_0x3e286f['shift']());}}}(a36_0x30d5,0xde19c));function a36_0x2ea9(_0xb3753c,_0x394ba0){_0xb3753c=_0xb3753c-0x10a;const _0x30d50f=a36_0x30d5();let _0x2ea911=_0x30d50f[_0xb3753c];return _0x2ea911;}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a36_0x30d5(){const _0x17a904=['Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','resolveFolderId','17044zSSGzB','\x27\x20with\x20ID:\x20','includes','site','error','length','folderId','Segment\x20name:\x20','1508505FfbIjh','segments','Target\x20path:\x20','1219740vPPYUK','execute','description','resolvePathToResource','\x27...','invisible','✔\x20Created\x20segment\x20\x27','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','1472104LllaDR','\x20\x20\x20Path:\x20','4187172UxeYcI','name','type','4HkBZuk','Parent:\x20','rule','segment:create','8857180pSIpcf','103cBUYNn','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','kind','12cFdSba','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','data','segmentPath','segment','folder','Resolving\x20folder\x20path\x20\x27','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','parent','Site:\x20','Resolving\x20folder\x20\x27','4677071xDmmUM','verbose','Resolved\x20relative\x20path\x20to:\x20','45nGjZUl','Examples:','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','Creating\x20segment\x20\x27'];a36_0x30d5=function(){return _0x17a904;};return a36_0x30d5();}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 a36_0x3dd5dd from'chalk';export class SegmentCreateCommand extends BaseCommand{[a36_0x4f3780(0x122)]=a36_0x4f3780(0x127);[a36_0x4f3780(0x119)]='Create\x20child\x20segment\x20with\x20filtering\x20rules';async[a36_0x4f3780(0x118)](_0x449d95){const _0xe96fd7=a36_0x4f3780;console[_0xe96fd7(0x110)](a36_0x3dd5dd['yellow']('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0xe96fd7(0x110)](a36_0x3dd5dd['yellow'](_0xe96fd7(0x12d)));const {options:_0x3d4613,args:_0x355d4e,tdx:_0x341f1d}=_0x449d95,_0xe08f53=_0x3d4613;if(_0x355d4e[_0xe96fd7(0x111)]===0x0)return console['error'](_0xe96fd7(0x12a)),console[_0xe96fd7(0x110)]('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console[_0xe96fd7(0x110)](_0xe96fd7(0x13b)),console[_0xe96fd7(0x110)](_0xe96fd7(0x11e)),console[_0xe96fd7(0x110)](_0xe96fd7(0x13c)),console[_0xe96fd7(0x110)](_0xe96fd7(0x133)),0x1;const _0x574884=_0x355d4e[0x0],_0x33e313=_0x3d4613[_0xe96fd7(0x12f)];let _0x132f05=_0x574884;_0x33e313&&!_0x574884[_0xe96fd7(0x10e)]('/')&&(_0x132f05=_0x33e313+'/'+_0x574884,_0xe08f53[_0xe96fd7(0x138)]&&console[_0xe96fd7(0x110)](_0xe96fd7(0x139)+_0x132f05));const _0x31e4fa=parsePath(_0x132f05);if(_0x31e4fa[_0xe96fd7(0x115)]['length']<0x2)return console['error'](_0xe96fd7(0x10a)),console[_0xe96fd7(0x110)]('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x58e895=_0x31e4fa[_0xe96fd7(0x115)][0x0],_0x3b0e32=getBaseName(_0x132f05),_0x5d48ca=getParentPath(_0x132f05);_0xe08f53['verbose']&&(console[_0xe96fd7(0x110)](_0xe96fd7(0x135)+_0xe08f53[_0xe96fd7(0x10f)]),console['error'](_0xe96fd7(0x116)+_0x132f05),console[_0xe96fd7(0x110)](_0xe96fd7(0x125)+_0x58e895),console[_0xe96fd7(0x110)](_0xe96fd7(0x113)+_0x3b0e32),console['error']('Parent\x20path:\x20'+_0x5d48ca));const _0x4c2ee9=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x58e895+_0xe96fd7(0x11b),()=>_0x341f1d[_0xe96fd7(0x130)]['resolveParentId'](_0x58e895),{'verbose':_0xe08f53['verbose']}),_0x4cc953=_0x4c2ee9[_0xe96fd7(0x12e)];let _0x262c50;if(_0x31e4fa[_0xe96fd7(0x115)][_0xe96fd7(0x111)]>0x2){const _0x5e36b2=await withSpinner(_0xe96fd7(0x132)+_0x5d48ca+_0xe96fd7(0x11b),()=>_0x341f1d[_0xe96fd7(0x130)][_0xe96fd7(0x11a)](_0x5d48ca),{'verbose':_0xe08f53[_0xe96fd7(0x138)]}),_0x50e17f=_0x5e36b2[_0xe96fd7(0x12e)];if(_0x50e17f[_0xe96fd7(0x123)]!=='folder'&&_0x50e17f['type']!==_0xe96fd7(0x134))return console[_0xe96fd7(0x110)]('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x262c50=_0x50e17f[_0xe96fd7(0x112)];}else{if(_0xe08f53[_0xe96fd7(0x131)]){const _0x32daa4=await withSpinner(_0xe96fd7(0x136)+_0xe08f53['folder']+_0xe96fd7(0x11b),()=>_0x341f1d[_0xe96fd7(0x130)][_0xe96fd7(0x10b)](_0x4cc953,_0xe08f53['folder']),{'verbose':_0xe08f53[_0xe96fd7(0x138)]});_0x262c50=_0x32daa4[_0xe96fd7(0x12e)];}}_0xe08f53['verbose']&&_0x262c50&&console['error']('Resolved\x20folder\x20ID:\x20'+_0x262c50);const _0x144b1e=await loadJSONFromOptions(_0xe08f53[_0xe96fd7(0x126)],_0xe08f53['ruleFile']),_0x8c610e={'name':_0x3b0e32,'description':_0xe08f53[_0xe96fd7(0x119)],'rule':_0x144b1e,'kind':_0xe08f53['kind']!==undefined?parseInt(_0xe08f53[_0xe96fd7(0x12b)],0xa):undefined,'isVisible':_0xe08f53[_0xe96fd7(0x11c)]?![]:undefined,'segmentFolderId':_0x262c50,'countPopulation':_0xe08f53['noCountPopulation']?![]:undefined},_0x283847=await withSpinner(_0xe96fd7(0x13d)+_0x3b0e32+_0xe96fd7(0x11b),()=>_0x341f1d[_0xe96fd7(0x130)]['createSegment'](_0x4cc953,_0x8c610e),{'verbose':_0xe08f53[_0xe96fd7(0x138)]}),_0x117283=_0x283847['data'];return console[_0xe96fd7(0x110)](_0xe96fd7(0x11d)+_0x117283['name']+_0xe96fd7(0x10d)+_0x117283['id']),_0x132f05!==_0x574884&&console[_0xe96fd7(0x110)](_0xe96fd7(0x120)+_0x132f05),await handleSDKOutput([_0x117283],_0xe08f53),0x0;}}
1
+ const a37_0x2671f6=a37_0x54ba;function a37_0x2943(){const _0x2da391=['3007350NaCOTX','Create\x20child\x20segment\x20with\x20filtering\x20rules','segments','Segment\x20name:\x20','Target\x20path:\x20','Creating\x20segment\x20\x27','createSegment','length','segment:create','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','Parent\x20path:\x20','rule','resolveFolderId','execute','417204BDLNGY','Site:\x20','includes','7081151eWDZjc','segmentPath','error','yellow','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','verbose','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','folder','data','Resolved\x20folder\x20ID:\x20','Parent:\x20','8ciSfMJ','resolveParentId','ruleFile','\x20\x20\x20Path:\x20','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','Resolved\x20relative\x20path\x20to:\x20','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','name','kind','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','type','Resolving\x20folder\x20\x27','description','2876640joCpqi','6748110KgoUVp','resolvePathToResource','folderId','\x27...','1514053peTGIA','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','segment','site','Examples:','1828058NTKxFi'];a37_0x2943=function(){return _0x2da391;};return a37_0x2943();}function a37_0x54ba(_0x9082d2,_0x4af596){_0x9082d2=_0x9082d2-0x1b0;const _0x294383=a37_0x2943();let _0x54ba16=_0x294383[_0x9082d2];return _0x54ba16;}(function(_0x5b8689,_0x1d9380){const _0x34ae5c=a37_0x54ba,_0x5d388f=_0x5b8689();while(!![]){try{const _0x40e6c9=-parseInt(_0x34ae5c(0x1be))/0x1+parseInt(_0x34ae5c(0x1c3))/0x2+parseInt(_0x34ae5c(0x1c4))/0x3+-parseInt(_0x34ae5c(0x1d2))/0x4+parseInt(_0x34ae5c(0x1b9))/0x5+parseInt(_0x34ae5c(0x1ba))/0x6+-parseInt(_0x34ae5c(0x1d5))/0x7*(parseInt(_0x34ae5c(0x1e0))/0x8);if(_0x40e6c9===_0x1d9380)break;else _0x5d388f['push'](_0x5d388f['shift']());}catch(_0x37857f){_0x5d388f['push'](_0x5d388f['shift']());}}}(a37_0x2943,0xf0db1));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 a37_0x2dd92a from'chalk';export class SegmentCreateCommand extends BaseCommand{[a37_0x2671f6(0x1b3)]=a37_0x2671f6(0x1cc);['description']=a37_0x2671f6(0x1c5);async[a37_0x2671f6(0x1d1)](_0x434cf){const _0x7de8d1=a37_0x2671f6;console[_0x7de8d1(0x1d7)](a37_0x2dd92a[_0x7de8d1(0x1d8)]('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console['error'](a37_0x2dd92a[_0x7de8d1(0x1d8)](_0x7de8d1(0x1d9)));const {options:_0x1f13a7,args:_0x49c288,tdx:_0x556747}=_0x434cf,_0x268c6f=_0x1f13a7;if(_0x49c288[_0x7de8d1(0x1cb)]===0x0)return console[_0x7de8d1(0x1d7)](_0x7de8d1(0x1b5)),console[_0x7de8d1(0x1d7)]('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console[_0x7de8d1(0x1d7)](_0x7de8d1(0x1c2)),console[_0x7de8d1(0x1d7)](_0x7de8d1(0x1bf)),console[_0x7de8d1(0x1d7)](_0x7de8d1(0x1cd)),console[_0x7de8d1(0x1d7)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x2e15e1=_0x49c288[0x0],_0x3e364c=_0x1f13a7[_0x7de8d1(0x1d6)];let _0x2d424f=_0x2e15e1;_0x3e364c&&!_0x2e15e1[_0x7de8d1(0x1d4)]('/')&&(_0x2d424f=_0x3e364c+'/'+_0x2e15e1,_0x268c6f['verbose']&&console['error'](_0x7de8d1(0x1b1)+_0x2d424f));const _0xce7be8=parsePath(_0x2d424f);if(_0xce7be8[_0x7de8d1(0x1c6)][_0x7de8d1(0x1cb)]<0x2)return console[_0x7de8d1(0x1d7)](_0x7de8d1(0x1b2)),console['error'](_0x7de8d1(0x1db)),0x1;const _0x509098=_0xce7be8[_0x7de8d1(0x1c6)][0x0],_0x5ea849=getBaseName(_0x2d424f),_0x37ec03=getParentPath(_0x2d424f);_0x268c6f[_0x7de8d1(0x1da)]&&(console[_0x7de8d1(0x1d7)](_0x7de8d1(0x1d3)+_0x268c6f[_0x7de8d1(0x1c1)]),console[_0x7de8d1(0x1d7)](_0x7de8d1(0x1c8)+_0x2d424f),console[_0x7de8d1(0x1d7)](_0x7de8d1(0x1df)+_0x509098),console[_0x7de8d1(0x1d7)](_0x7de8d1(0x1c7)+_0x5ea849),console['error'](_0x7de8d1(0x1ce)+_0x37ec03));const _0xc565b8=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x509098+_0x7de8d1(0x1bd),()=>_0x556747[_0x7de8d1(0x1c0)][_0x7de8d1(0x1e1)](_0x509098),{'verbose':_0x268c6f[_0x7de8d1(0x1da)]}),_0x331af0=_0xc565b8[_0x7de8d1(0x1dd)];let _0x39453b;if(_0xce7be8[_0x7de8d1(0x1c6)][_0x7de8d1(0x1cb)]>0x2){const _0x5a6c0f=await withSpinner('Resolving\x20folder\x20path\x20\x27'+_0x37ec03+_0x7de8d1(0x1bd),()=>_0x556747[_0x7de8d1(0x1c0)][_0x7de8d1(0x1bb)](_0x37ec03),{'verbose':_0x268c6f[_0x7de8d1(0x1da)]}),_0x21063b=_0x5a6c0f[_0x7de8d1(0x1dd)];if(_0x21063b[_0x7de8d1(0x1b6)]!==_0x7de8d1(0x1dc)&&_0x21063b[_0x7de8d1(0x1b6)]!=='parent')return console[_0x7de8d1(0x1d7)](_0x7de8d1(0x1b0)),0x1;_0x39453b=_0x21063b[_0x7de8d1(0x1bc)];}else{if(_0x268c6f[_0x7de8d1(0x1dc)]){const _0x470953=await withSpinner(_0x7de8d1(0x1b7)+_0x268c6f[_0x7de8d1(0x1dc)]+_0x7de8d1(0x1bd),()=>_0x556747[_0x7de8d1(0x1c0)][_0x7de8d1(0x1d0)](_0x331af0,_0x268c6f[_0x7de8d1(0x1dc)]),{'verbose':_0x268c6f[_0x7de8d1(0x1da)]});_0x39453b=_0x470953[_0x7de8d1(0x1dd)];}}_0x268c6f[_0x7de8d1(0x1da)]&&_0x39453b&&console['error'](_0x7de8d1(0x1de)+_0x39453b);const _0x27e6ff=await loadJSONFromOptions(_0x268c6f[_0x7de8d1(0x1cf)],_0x268c6f[_0x7de8d1(0x1e2)]),_0x34d77b={'name':_0x5ea849,'description':_0x268c6f[_0x7de8d1(0x1b8)],'rule':_0x27e6ff,'kind':_0x268c6f['kind']!==undefined?parseInt(_0x268c6f[_0x7de8d1(0x1b4)],0xa):undefined,'isVisible':_0x268c6f['invisible']?![]:undefined,'segmentFolderId':_0x39453b,'countPopulation':_0x268c6f['noCountPopulation']?![]:undefined},_0x12ce27=await withSpinner(_0x7de8d1(0x1c9)+_0x5ea849+_0x7de8d1(0x1bd),()=>_0x556747[_0x7de8d1(0x1c0)][_0x7de8d1(0x1ca)](_0x331af0,_0x34d77b),{'verbose':_0x268c6f['verbose']}),_0x3841b9=_0x12ce27['data'];return console[_0x7de8d1(0x1d7)]('✔\x20Created\x20segment\x20\x27'+_0x3841b9[_0x7de8d1(0x1b3)]+'\x27\x20with\x20ID:\x20'+_0x3841b9['id']),_0x2d424f!==_0x2e15e1&&console['error'](_0x7de8d1(0x1e3)+_0x2d424f),await handleSDKOutput([_0x3841b9],_0x268c6f),0x0;}}
@@ -1 +1 @@
1
- const a37_0x213ad5=a37_0x5309;(function(_0x3028b4,_0x3f03c6){const _0xf473f0=a37_0x5309,_0x35bf6f=_0x3028b4();while(!![]){try{const _0x36970d=parseInt(_0xf473f0(0x8a))/0x1*(-parseInt(_0xf473f0(0x82))/0x2)+-parseInt(_0xf473f0(0x70))/0x3*(-parseInt(_0xf473f0(0x71))/0x4)+parseInt(_0xf473f0(0x89))/0x5*(-parseInt(_0xf473f0(0x74))/0x6)+parseInt(_0xf473f0(0x7d))/0x7*(parseInt(_0xf473f0(0x7a))/0x8)+-parseInt(_0xf473f0(0x8b))/0x9*(parseInt(_0xf473f0(0x80))/0xa)+parseInt(_0xf473f0(0x87))/0xb+parseInt(_0xf473f0(0x84))/0xc;if(_0x36970d===_0x3f03c6)break;else _0x35bf6f['push'](_0x35bf6f['shift']());}catch(_0x52cf20){_0x35bf6f['push'](_0x35bf6f['shift']());}}}(a37_0x260b,0xda018));import{BaseCommand}from'./command.js';function a37_0x5309(_0x437c09,_0x4184aa){_0x437c09=_0x437c09-0x6e;const _0x260bd5=a37_0x260b();let _0x530956=_0x260bd5[_0x437c09];return _0x530956;}function a37_0x260b(){const _0x4cd3ef=['\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','3crcciw','944792WVATQi','error','Error:\x20Parent\x20segment\x20name\x20is\x20required','1704PyFYIi','site','List\x20available\x20fields\x20for\x20segmentation','✔\x20Found\x20','data','jsonl','31792sygvfq','json','segment:fields','581IxymKr','Parent\x20segment:\x20','Listing\x20fields\x20for\x20\x27','10rfUUXL','\x27...','70VDqIhT','description','33210888YXBpNi','verbose','length','18083813EgPXZA','\x20field','30110JcJJwk','44777qXnnaX','7264818qSnJEn','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','name'];a37_0x260b=function(){return _0x4cd3ef;};return a37_0x260b();}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a37_0x213ad5(0x6e)]=a37_0x213ad5(0x7c);[a37_0x213ad5(0x83)]=a37_0x213ad5(0x76);async['execute'](_0x1fb9ec){const _0x16a8f1=a37_0x213ad5,{options:_0xf92578,args:_0x188d1c,tdx:_0x26fa16}=_0x1fb9ec,_0x317dff=_0x188d1c[0x0]||_0xf92578['parentSegment'];if(!_0x317dff)return console[_0x16a8f1(0x72)](_0x16a8f1(0x73)),console['error'](_0x16a8f1(0x8c)),console[_0x16a8f1(0x72)](_0x16a8f1(0x6f)),0x1;_0xf92578[_0x16a8f1(0x85)]&&(console[_0x16a8f1(0x72)]('Site:\x20'+_0xf92578[_0x16a8f1(0x75)]),console[_0x16a8f1(0x72)](_0x16a8f1(0x7e)+_0x317dff));const _0x4abcd2=await withSpinner(_0x16a8f1(0x7f)+_0x317dff+_0x16a8f1(0x81),()=>_0x26fa16['segment']['listFields'](_0x317dff),{'verbose':_0xf92578['verbose']}),_0x4f20fc=_0x4abcd2[_0x16a8f1(0x78)];console['error'](_0x16a8f1(0x77)+_0x4f20fc['length']+_0x16a8f1(0x88)+(_0x4f20fc[_0x16a8f1(0x86)]!==0x1?'s':''));if(_0xf92578[_0x16a8f1(0x7b)]||_0xf92578[_0x16a8f1(0x79)])return await handleSDKOutput(_0x4f20fc,_0xf92578),0x0;return displayFieldsHumanReadable(_0x4f20fc,_0x317dff),0x0;}}
1
+ const a38_0x1941b0=a38_0x5e68;(function(_0x2713f2,_0x4480df){const _0x16914a=a38_0x5e68,_0x52e412=_0x2713f2();while(!![]){try{const _0x6a8c9=parseInt(_0x16914a(0xde))/0x1+-parseInt(_0x16914a(0xcb))/0x2+parseInt(_0x16914a(0xe0))/0x3+parseInt(_0x16914a(0xc9))/0x4*(parseInt(_0x16914a(0xd3))/0x5)+-parseInt(_0x16914a(0xd7))/0x6*(parseInt(_0x16914a(0xdd))/0x7)+-parseInt(_0x16914a(0xd8))/0x8+parseInt(_0x16914a(0xcd))/0x9*(-parseInt(_0x16914a(0xd4))/0xa);if(_0x6a8c9===_0x4480df)break;else _0x52e412['push'](_0x52e412['shift']());}catch(_0x5b56d9){_0x52e412['push'](_0x52e412['shift']());}}}(a38_0x28d4,0x18adb));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';function a38_0x5e68(_0x87be19,_0x5ad02f){_0x87be19=_0x87be19-0xc7;const _0x28d4d0=a38_0x28d4();let _0x5e6821=_0x28d4d0[_0x87be19];return _0x5e6821;}function a38_0x28d4(){const _0x5f23f3=['238SGYdXZ','197815DpCrix','site','395193nvVLnF','✔\x20Found\x20','List\x20available\x20fields\x20for\x20segmentation','4KCHMTD','length','236606XxFYkt','verbose','9huYLSH','parentSegment','Error:\x20Parent\x20segment\x20name\x20is\x20required','segment:fields','data','name','70385jAAdZT','109860kDZbxw','\x27...','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','16494eIUzHU','158280AIRBLD','json','Parent\x20segment:\x20','Site:\x20','error'];a38_0x28d4=function(){return _0x5f23f3;};return a38_0x28d4();}export class SegmentFieldsCommand extends BaseCommand{[a38_0x1941b0(0xd2)]=a38_0x1941b0(0xd0);['description']=a38_0x1941b0(0xc8);async['execute'](_0x2c7968){const _0x34805a=a38_0x1941b0,{options:_0xb0be80,args:_0x10b5fc,tdx:_0x315662}=_0x2c7968,_0x13d6d5=_0x10b5fc[0x0]||_0xb0be80[_0x34805a(0xce)];if(!_0x13d6d5)return console[_0x34805a(0xdc)](_0x34805a(0xcf)),console[_0x34805a(0xdc)]('Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'),console[_0x34805a(0xdc)](_0x34805a(0xd6)),0x1;_0xb0be80['verbose']&&(console[_0x34805a(0xdc)](_0x34805a(0xdb)+_0xb0be80[_0x34805a(0xdf)]),console['error'](_0x34805a(0xda)+_0x13d6d5));const _0xea98f5=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x13d6d5+_0x34805a(0xd5),()=>_0x315662['segment']['listFields'](_0x13d6d5),{'verbose':_0xb0be80[_0x34805a(0xcc)]}),_0x518fcc=_0xea98f5[_0x34805a(0xd1)];console[_0x34805a(0xdc)](_0x34805a(0xc7)+_0x518fcc[_0x34805a(0xca)]+'\x20field'+(_0x518fcc[_0x34805a(0xca)]!==0x1?'s':''));if(_0xb0be80[_0x34805a(0xd9)]||_0xb0be80['jsonl'])return await handleSDKOutput(_0x518fcc,_0xb0be80),0x0;return displayFieldsHumanReadable(_0x518fcc,_0x13d6d5),0x0;}}
@@ -1 +1 @@
1
- const a38_0x3d5dd9=a38_0x5009;function a38_0x4c50(){const _0x30615a=['\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','1281501XJtVgt','content','length','yes','\x20new\x20files','\x20segments','description','type','targetDir','Pulling\x20segments\x20from\x20\x27','diff','red','\x20\x20🎯\x20','verbose','-\x20no\x20files\x20written','15VxnDGA','absolutePath','segment','Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)','site','parent_segment','message','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','helpText','resourceName','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','repeat','✔\x20Context\x20set:\x20','\x20unchanged\x20files','relativePath','Target\x20resource:\x20','\x20changed\x20files','\x20files?','\x0aPull\x20summary\x20for\x20\x27','pullSegments','hasChanges','name','files','27853767QgoEqh','155414UuPqWp','filter','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','\x0aError:','green','segment:pull','\x0aChanges\x20to\x20\x27','\x20versions)','\x27...','activations','isNew','14vjQQwo','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','dirname','no_parent','cyan','dim','segments','\x20=\x20','\x20files\x20to\x20','journeyVersions','file','1749184oZuesy','✔\x20Pulled\x20','parentSegment','\x20journeys','yellow','counts','Error:\x20','error','\x20with\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','1480182VJVffd','cwd','data','session','dryRun','errorCode','7190040hyjLFQ','journeys','3168024EYHkwH','parentName','utf-8'];a38_0x4c50=function(){return _0x30615a;};return a38_0x4c50();}(function(_0x40bddc,_0x276c4d){const _0x37bfaa=a38_0x5009,_0x20d3a5=_0x40bddc();while(!![]){try{const _0x35c842=parseInt(_0x37bfaa(0x1ee))/0x1*(-parseInt(_0x37bfaa(0x1b3))/0x2)+parseInt(_0x37bfaa(0x1df))/0x3+parseInt(_0x37bfaa(0x1db))/0x4+-parseInt(_0x37bfaa(0x1d9))/0x5+parseInt(_0x37bfaa(0x1d3))/0x6*(-parseInt(_0x37bfaa(0x1be))/0x7)+-parseInt(_0x37bfaa(0x1c9))/0x8+parseInt(_0x37bfaa(0x1b2))/0x9;if(_0x35c842===_0x276c4d)break;else _0x20d3a5['push'](_0x20d3a5['shift']());}catch(_0x4590a9){_0x20d3a5['push'](_0x20d3a5['shift']());}}}(a38_0x4c50,0xf3bed));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a38_0x5a4ccd from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a38_0x2d8895 from'path';function a38_0x5009(_0x5e9b48,_0x18542a){_0x5e9b48=_0x5e9b48-0x1b2;const _0x4c50b2=a38_0x4c50();let _0x500915=_0x4c50b2[_0x5e9b48];return _0x500915;}import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';export class SegmentPullCommand extends BaseCommand{[a38_0x3d5dd9(0x203)]=a38_0x3d5dd9(0x1b8);[a38_0x3d5dd9(0x1e5)]=a38_0x3d5dd9(0x1f8);async['execute'](_0x4d3011){const _0xdd4a3a=a38_0x3d5dd9,{options:_0x406970,args:_0x4dcac2,tdx:_0x3fcfc0}=_0x4d3011,_0x1d8b56=_0x406970,_0x59de1c=await resolveTarget({'arg':_0x4dcac2[0x0],'contextParent':_0x406970[_0xdd4a3a(0x1cb)],'cwd':process[_0xdd4a3a(0x1d4)]()});if(!isSuccessfulResolution(_0x59de1c))return _0x59de1c[_0xdd4a3a(0x1d8)]===_0xdd4a3a(0x1c1)?(console[_0xdd4a3a(0x1d0)](a38_0x5a4ccd['yellow'](_0xdd4a3a(0x1b5))),console['error'](_0xdd4a3a(0x1f1)),console[_0xdd4a3a(0x1d0)](_0xdd4a3a(0x1bf)),console['error'](_0xdd4a3a(0x1d2))):(console[_0xdd4a3a(0x1d0)](a38_0x5a4ccd[_0xdd4a3a(0x1ea)](_0xdd4a3a(0x1cf)+_0x59de1c[_0xdd4a3a(0x1f4)]+'\x0a')),_0x59de1c['helpText']&&console[_0xdd4a3a(0x1d0)](a38_0x5a4ccd[_0xdd4a3a(0x1c2)](_0x59de1c[_0xdd4a3a(0x1f6)]))),0x1;const _0x511967=_0x59de1c['parentName'],_0x2c9e0e=_0x59de1c[_0xdd4a3a(0x1e7)],_0x23ab7a=_0x59de1c[_0xdd4a3a(0x1e6)]===_0xdd4a3a(0x1c8)?_0x59de1c[_0xdd4a3a(0x1f7)]:undefined;_0x1d8b56['verbose']&&(console[_0xdd4a3a(0x1d0)]('Site:\x20'+_0x1d8b56[_0xdd4a3a(0x1f2)]),console[_0xdd4a3a(0x1d0)]('Parent\x20segment:\x20'+_0x511967),_0x23ab7a&&console[_0xdd4a3a(0x1d0)](_0xdd4a3a(0x1fd)+_0x23ab7a));const _0x1502b7=await withProgressSpinner(_0xdd4a3a(0x1e8)+_0x511967+_0xdd4a3a(0x1bb),_0x1e721d=>_0x3fcfc0[_0xdd4a3a(0x1f0)][_0xdd4a3a(0x201)](_0x511967,{'targetDir':_0x2c9e0e,'targetResourceName':_0x23ab7a,'verbose':_0x1d8b56[_0xdd4a3a(0x1ec)],'progress':{'update':_0x357399=>{_0x1e721d['setPhase'](_0x357399),_0x1d8b56['verbose']&&console['error']('\x20\x20'+_0x357399);}}}),{'verbose':_0x1d8b56[_0xdd4a3a(0x1ec)]}),_0x2f2234=_0x1502b7[_0xdd4a3a(0x1d5)];if(_0x2f2234[_0xdd4a3a(0x1ce)]['segments']===0x0&&_0x2f2234[_0xdd4a3a(0x1ce)][_0xdd4a3a(0x1da)]===0x0)return console[_0xdd4a3a(0x1d0)](a38_0x5a4ccd[_0xdd4a3a(0x1cd)]('No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27'+_0x2f2234['parentName']+'\x27')),0x0;const _0x4ee40f=_0x2f2234['files'][_0xdd4a3a(0x1b4)](_0xc189bb=>_0xc189bb[_0xdd4a3a(0x1bd)]),_0x30dc55=_0x2f2234[_0xdd4a3a(0x204)]['filter'](_0xd06369=>!_0xd06369[_0xdd4a3a(0x1bd)]&&_0xd06369[_0xdd4a3a(0x202)]),_0x334975=_0x2f2234[_0xdd4a3a(0x204)]['filter'](_0x1c5149=>!_0x1c5149[_0xdd4a3a(0x1bd)]&&!_0x1c5149[_0xdd4a3a(0x202)]);console[_0xdd4a3a(0x1d0)](_0xdd4a3a(0x200)+_0x2f2234[_0xdd4a3a(0x1dc)]+'\x27:'),console[_0xdd4a3a(0x1d0)](_0xdd4a3a(0x1eb)+a38_0x5a4ccd['cyan'](_0x2f2234[_0xdd4a3a(0x1ce)][_0xdd4a3a(0x1c4)]+_0xdd4a3a(0x1e4))+_0xdd4a3a(0x1d1)+a38_0x5a4ccd[_0xdd4a3a(0x1c2)](_0x2f2234['counts'][_0xdd4a3a(0x1bc)]+'\x20activations'));if(_0x2f2234['counts'][_0xdd4a3a(0x1da)]>0x0){const _0x234f18=_0x2f2234['counts']['journeyVersions']>_0x2f2234['counts'][_0xdd4a3a(0x1da)]?'\x20('+_0x2f2234[_0xdd4a3a(0x1ce)][_0xdd4a3a(0x1c7)]+_0xdd4a3a(0x1ba):'';console['error']('\x20\x20🗺️\x20\x20'+a38_0x5a4ccd['cyan'](_0x2f2234[_0xdd4a3a(0x1ce)]['journeys']+_0xdd4a3a(0x1cc))+a38_0x5a4ccd[_0xdd4a3a(0x1c3)](_0x234f18));}console[_0xdd4a3a(0x1d0)]('\x20\x20'+a38_0x5a4ccd[_0xdd4a3a(0x1b7)]('+\x20'+_0x4ee40f[_0xdd4a3a(0x1e1)]+_0xdd4a3a(0x1e3))),console['error']('\x20\x20'+a38_0x5a4ccd[_0xdd4a3a(0x1cd)]('~\x20'+_0x30dc55[_0xdd4a3a(0x1e1)]+_0xdd4a3a(0x1fe))),console[_0xdd4a3a(0x1d0)]('\x20\x20'+a38_0x5a4ccd[_0xdd4a3a(0x1c3)]('=\x20'+_0x334975[_0xdd4a3a(0x1e1)]+_0xdd4a3a(0x1fb))),console['error']('\x20\x20Target:\x20'+a38_0x5a4ccd[_0xdd4a3a(0x1c2)](_0x2f2234[_0xdd4a3a(0x1e7)])+'\x0a');if(_0x30dc55[_0xdd4a3a(0x1e1)]>0x0)for(const _0x26e2de of _0x30dc55){console['error'](_0xdd4a3a(0x1b9)+_0x26e2de[_0xdd4a3a(0x1fc)]+'\x27:'),console[_0xdd4a3a(0x1d0)]('─'[_0xdd4a3a(0x1f9)](0x3c)),console[_0xdd4a3a(0x1d0)](_0x26e2de[_0xdd4a3a(0x1e9)]),console[_0xdd4a3a(0x1d0)]('─'[_0xdd4a3a(0x1f9)](0x3c));}if(_0x1d8b56[_0xdd4a3a(0x1d7)])return console[_0xdd4a3a(0x1d0)](a38_0x5a4ccd[_0xdd4a3a(0x1cd)](_0xdd4a3a(0x1de))),0x0;if(_0x4ee40f['length']===0x0&&_0x30dc55[_0xdd4a3a(0x1e1)]===0x0)return console[_0xdd4a3a(0x1d0)](a38_0x5a4ccd[_0xdd4a3a(0x1b7)]('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x2f2234[_0xdd4a3a(0x1dc)]},_0x1d8b56['session']),console[_0xdd4a3a(0x1d0)](a38_0x5a4ccd[_0xdd4a3a(0x1b7)](_0xdd4a3a(0x1fa)+a38_0x5a4ccd[_0xdd4a3a(0x1c3)](_0xdd4a3a(0x1f3))+'\x20=\x20'+a38_0x5a4ccd[_0xdd4a3a(0x1c2)](_0x2f2234[_0xdd4a3a(0x1dc)]))),0x0;if(!_0x1d8b56[_0xdd4a3a(0x1e2)]){if(!isInteractive())return console['error'](a38_0x5a4ccd['red'](_0xdd4a3a(0x1b6)),_0xdd4a3a(0x1f5)),console[_0xdd4a3a(0x1d0)](a38_0x5a4ccd[_0xdd4a3a(0x1c3)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x380c36=await confirmKey('Write\x20'+(_0x4ee40f['length']+_0x30dc55[_0xdd4a3a(0x1e1)])+_0xdd4a3a(0x1ff));if(!_0x380c36)return console[_0xdd4a3a(0x1d0)](a38_0x5a4ccd[_0xdd4a3a(0x1cd)]('Aborted.'),_0xdd4a3a(0x1ed)),0x1;}for(const _0x3b0b64 of _0x2f2234[_0xdd4a3a(0x204)]){if(_0x3b0b64[_0xdd4a3a(0x1bd)]||_0x3b0b64[_0xdd4a3a(0x202)]){const _0x39904f=a38_0x2d8895[_0xdd4a3a(0x1c0)](_0x3b0b64['absolutePath']);!existsSync(_0x39904f)&&mkdirSync(_0x39904f,{'recursive':!![]}),writeFileSync(_0x3b0b64[_0xdd4a3a(0x1ef)],_0x3b0b64[_0xdd4a3a(0x1e0)],_0xdd4a3a(0x1dd));}}return console[_0xdd4a3a(0x1d0)](a38_0x5a4ccd[_0xdd4a3a(0x1b7)](_0xdd4a3a(0x1ca)+(_0x4ee40f['length']+_0x30dc55[_0xdd4a3a(0x1e1)])+_0xdd4a3a(0x1c6)+_0x2f2234[_0xdd4a3a(0x1e7)])),saveSessionContext({'parent_segment':_0x2f2234[_0xdd4a3a(0x1dc)]},_0x1d8b56[_0xdd4a3a(0x1d6)]),console[_0xdd4a3a(0x1d0)](a38_0x5a4ccd[_0xdd4a3a(0x1b7)]('✔\x20Context\x20set:\x20'+a38_0x5a4ccd[_0xdd4a3a(0x1c3)](_0xdd4a3a(0x1f3))+_0xdd4a3a(0x1c5)+a38_0x5a4ccd[_0xdd4a3a(0x1c2)](_0x2f2234[_0xdd4a3a(0x1dc)]))),0x0;}}
1
+ const a39_0x434145=a39_0x1cbd;(function(_0x4aa62b,_0xc1053e){const _0x5ef4bb=a39_0x1cbd,_0x48701a=_0x4aa62b();while(!![]){try{const _0x113810=parseInt(_0x5ef4bb(0x23f))/0x1+parseInt(_0x5ef4bb(0x20d))/0x2*(parseInt(_0x5ef4bb(0x218))/0x3)+-parseInt(_0x5ef4bb(0x214))/0x4*(parseInt(_0x5ef4bb(0x21d))/0x5)+-parseInt(_0x5ef4bb(0x217))/0x6*(parseInt(_0x5ef4bb(0x202))/0x7)+parseInt(_0x5ef4bb(0x22f))/0x8+parseInt(_0x5ef4bb(0x1f6))/0x9+parseInt(_0x5ef4bb(0x219))/0xa*(-parseInt(_0x5ef4bb(0x211))/0xb);if(_0x113810===_0xc1053e)break;else _0x48701a['push'](_0x48701a['shift']());}catch(_0x1b23a6){_0x48701a['push'](_0x48701a['shift']());}}}(a39_0x4940,0xd74e0));import{BaseCommand}from'./command.js';function a39_0x1cbd(_0x5b9f5d,_0x341a86){_0x5b9f5d=_0x5b9f5d-0x1f4;const _0x49403a=a39_0x4940();let _0x1cbd4d=_0x49403a[_0x5b9f5d];return _0x1cbd4d;}import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a39_0x53e363 from'chalk';function a39_0x4940(){const _0x1846b4=['hasChanges','\x20with\x20','setPhase','session','no_parent','length','14srprnw','segment','\x20changed\x20files','parentSegment','Write\x20','Aborted.','\x20\x20Target:\x20','Pulling\x20segments\x20from\x20\x27','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','segment:pull','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','218aAYXLg','segments','data','errorCode','6875SfIflw','\x20unchanged\x20files','execute','12IKWSut','\x20\x20🗺️\x20\x20','absolutePath','767238JEKGJn','6039kGYNxu','11410FfKhPf','\x20activations','dim','journeyVersions','708280wjrrWq','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','activations','filter','journeys','targetDir','Site:\x20','file','resourceName','repeat','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','\x20journeys','verbose','\x0aChanges\x20to\x20\x27','site','counts','parentName','red','10144944CorjRD','message','-\x20no\x20files\x20written','error','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','dryRun','\x0aPull\x20summary\x20for\x20\x27','\x20\x20🎯\x20','yellow','\x20=\x20','Error:\x20','Parent\x20segment:\x20','isNew','description','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','dirname','374549RErwpv','\x20files?','green','utf-8','content','3722787pOKIBy','files','helpText','cwd','parent_segment','cyan'];a39_0x4940=function(){return _0x1846b4;};return a39_0x4940();}import{existsSync,mkdirSync,writeFileSync}from'fs';import a39_0x203137 from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';export class SegmentPullCommand extends BaseCommand{['name']=a39_0x434145(0x20b);[a39_0x434145(0x23c)]=a39_0x434145(0x23d);async[a39_0x434145(0x213)](_0x5f201f){const _0x13938f=a39_0x434145,{options:_0x318fb4,args:_0x1f929d,tdx:_0x2ee70a}=_0x5f201f,_0x183bc6=_0x318fb4,_0x20887a=await resolveTarget({'arg':_0x1f929d[0x0],'contextParent':_0x318fb4[_0x13938f(0x205)],'cwd':process[_0x13938f(0x1f9)]()});if(!isSuccessfulResolution(_0x20887a))return _0x20887a[_0x13938f(0x210)]===_0x13938f(0x200)?(console[_0x13938f(0x232)](a39_0x53e363[_0x13938f(0x237)](_0x13938f(0x227))),console[_0x13938f(0x232)]('Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)'),console[_0x13938f(0x232)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent'),console['error'](_0x13938f(0x21e))):(console[_0x13938f(0x232)](a39_0x53e363[_0x13938f(0x22e)](_0x13938f(0x239)+_0x20887a[_0x13938f(0x230)]+'\x0a')),_0x20887a[_0x13938f(0x1f8)]&&console[_0x13938f(0x232)](a39_0x53e363[_0x13938f(0x1fb)](_0x20887a[_0x13938f(0x1f8)]))),0x1;const _0x6a0b3c=_0x20887a[_0x13938f(0x22d)],_0x80bca=_0x20887a['targetDir'],_0x3c8162=_0x20887a['type']===_0x13938f(0x224)?_0x20887a[_0x13938f(0x225)]:undefined;_0x183bc6[_0x13938f(0x229)]&&(console[_0x13938f(0x232)](_0x13938f(0x223)+_0x183bc6[_0x13938f(0x22b)]),console[_0x13938f(0x232)](_0x13938f(0x23a)+_0x6a0b3c),_0x3c8162&&console['error']('Target\x20resource:\x20'+_0x3c8162));const _0x3bb889=await withProgressSpinner(_0x13938f(0x209)+_0x6a0b3c+'\x27...',_0x408628=>_0x2ee70a[_0x13938f(0x203)]['pullSegments'](_0x6a0b3c,{'targetDir':_0x80bca,'targetResourceName':_0x3c8162,'verbose':_0x183bc6[_0x13938f(0x229)],'progress':{'update':_0x38d8da=>{const _0x11de73=_0x13938f;_0x408628[_0x11de73(0x1fe)](_0x38d8da),_0x183bc6[_0x11de73(0x229)]&&console[_0x11de73(0x232)]('\x20\x20'+_0x38d8da);}}}),{'verbose':_0x183bc6[_0x13938f(0x229)]}),_0x33c692=_0x3bb889[_0x13938f(0x20f)];if(_0x33c692[_0x13938f(0x22c)]['segments']===0x0&&_0x33c692[_0x13938f(0x22c)]['journeys']===0x0)return console[_0x13938f(0x232)](a39_0x53e363[_0x13938f(0x237)](_0x13938f(0x233)+_0x33c692['parentName']+'\x27')),0x0;const _0x364a1a=_0x33c692['files'][_0x13938f(0x220)](_0x5a17c1=>_0x5a17c1[_0x13938f(0x23b)]),_0x1dff6a=_0x33c692['files'][_0x13938f(0x220)](_0x26cfaf=>!_0x26cfaf['isNew']&&_0x26cfaf[_0x13938f(0x1fc)]),_0x122019=_0x33c692[_0x13938f(0x1f7)][_0x13938f(0x220)](_0x389bcf=>!_0x389bcf[_0x13938f(0x23b)]&&!_0x389bcf[_0x13938f(0x1fc)]);console[_0x13938f(0x232)](_0x13938f(0x235)+_0x33c692['parentName']+'\x27:'),console[_0x13938f(0x232)](_0x13938f(0x236)+a39_0x53e363['cyan'](_0x33c692['counts'][_0x13938f(0x20e)]+'\x20segments')+_0x13938f(0x1fd)+a39_0x53e363[_0x13938f(0x1fb)](_0x33c692[_0x13938f(0x22c)][_0x13938f(0x21f)]+_0x13938f(0x21a)));if(_0x33c692[_0x13938f(0x22c)][_0x13938f(0x221)]>0x0){const _0x3939a5=_0x33c692[_0x13938f(0x22c)]['journeyVersions']>_0x33c692[_0x13938f(0x22c)][_0x13938f(0x221)]?'\x20('+_0x33c692[_0x13938f(0x22c)][_0x13938f(0x21c)]+'\x20versions)':'';console[_0x13938f(0x232)](_0x13938f(0x215)+a39_0x53e363[_0x13938f(0x1fb)](_0x33c692[_0x13938f(0x22c)]['journeys']+_0x13938f(0x228))+a39_0x53e363[_0x13938f(0x21b)](_0x3939a5));}console['error']('\x20\x20'+a39_0x53e363[_0x13938f(0x241)]('+\x20'+_0x364a1a[_0x13938f(0x201)]+'\x20new\x20files')),console[_0x13938f(0x232)]('\x20\x20'+a39_0x53e363[_0x13938f(0x237)]('~\x20'+_0x1dff6a[_0x13938f(0x201)]+_0x13938f(0x204))),console[_0x13938f(0x232)]('\x20\x20'+a39_0x53e363[_0x13938f(0x21b)]('=\x20'+_0x122019['length']+_0x13938f(0x212))),console[_0x13938f(0x232)](_0x13938f(0x208)+a39_0x53e363[_0x13938f(0x1fb)](_0x33c692['targetDir'])+'\x0a');if(_0x1dff6a[_0x13938f(0x201)]>0x0)for(const _0x4c3e04 of _0x1dff6a){console['error'](_0x13938f(0x22a)+_0x4c3e04['relativePath']+'\x27:'),console[_0x13938f(0x232)]('─'['repeat'](0x3c)),console[_0x13938f(0x232)](_0x4c3e04['diff']),console[_0x13938f(0x232)]('─'[_0x13938f(0x226)](0x3c));}if(_0x183bc6[_0x13938f(0x234)])return console['error'](a39_0x53e363[_0x13938f(0x237)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x364a1a[_0x13938f(0x201)]===0x0&&_0x1dff6a[_0x13938f(0x201)]===0x0)return console[_0x13938f(0x232)](a39_0x53e363['green']('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x33c692[_0x13938f(0x22d)]},_0x183bc6['session']),console[_0x13938f(0x232)](a39_0x53e363[_0x13938f(0x241)]('✔\x20Context\x20set:\x20'+a39_0x53e363[_0x13938f(0x21b)](_0x13938f(0x1fa))+_0x13938f(0x238)+a39_0x53e363['cyan'](_0x33c692['parentName']))),0x0;if(!_0x183bc6['yes']){if(!isInteractive())return console[_0x13938f(0x232)](a39_0x53e363[_0x13938f(0x22e)]('\x0aError:'),_0x13938f(0x20a)),console[_0x13938f(0x232)](a39_0x53e363['dim'](_0x13938f(0x20c))),0x1;const _0x304cc7=await confirmKey(_0x13938f(0x206)+(_0x364a1a['length']+_0x1dff6a[_0x13938f(0x201)])+_0x13938f(0x240));if(!_0x304cc7)return console['error'](a39_0x53e363[_0x13938f(0x237)](_0x13938f(0x207)),_0x13938f(0x231)),0x1;}for(const _0x2cde4d of _0x33c692[_0x13938f(0x1f7)]){if(_0x2cde4d[_0x13938f(0x23b)]||_0x2cde4d[_0x13938f(0x1fc)]){const _0x46b11b=a39_0x203137[_0x13938f(0x23e)](_0x2cde4d[_0x13938f(0x216)]);!existsSync(_0x46b11b)&&mkdirSync(_0x46b11b,{'recursive':!![]}),writeFileSync(_0x2cde4d[_0x13938f(0x216)],_0x2cde4d[_0x13938f(0x1f5)],_0x13938f(0x1f4));}}return console[_0x13938f(0x232)](a39_0x53e363[_0x13938f(0x241)]('✔\x20Pulled\x20'+(_0x364a1a[_0x13938f(0x201)]+_0x1dff6a[_0x13938f(0x201)])+'\x20files\x20to\x20'+_0x33c692[_0x13938f(0x222)])),saveSessionContext({'parent_segment':_0x33c692[_0x13938f(0x22d)]},_0x183bc6[_0x13938f(0x1ff)]),console[_0x13938f(0x232)](a39_0x53e363[_0x13938f(0x241)]('✔\x20Context\x20set:\x20'+a39_0x53e363['dim'](_0x13938f(0x1fa))+_0x13938f(0x238)+a39_0x53e363['cyan'](_0x33c692[_0x13938f(0x22d)]))),0x0;}}