@treasuredata/tdx 2026.3.21 → 2026.3.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/auth-login-command.js +1 -1
  11. package/dist/commands/chat-command.js +1 -1
  12. package/dist/commands/claude-command.js +1 -1
  13. package/dist/commands/claude-statusline-command.js +1 -1
  14. package/dist/commands/claude-usage-command.js +1 -1
  15. package/dist/commands/command.js +1 -1
  16. package/dist/commands/connection-command.js +1 -1
  17. package/dist/commands/databases.js +1 -1
  18. package/dist/commands/delivery-command.js +1 -1
  19. package/dist/commands/describe.js +1 -1
  20. package/dist/commands/engage-campaign-pull-command.js +1 -1
  21. package/dist/commands/engage-campaign-push-command.js +1 -1
  22. package/dist/commands/engage-campaign-validate-command.js +1 -1
  23. package/dist/commands/engage-command.js +1 -1
  24. package/dist/commands/engage-template-pull-command.js +1 -1
  25. package/dist/commands/engage-template-push-command.js +1 -1
  26. package/dist/commands/engage-template-validate-command.js +1 -1
  27. package/dist/commands/job-command.js +1 -1
  28. package/dist/commands/journey-command.js +1 -1
  29. package/dist/commands/journey-validate-command.js +1 -1
  30. package/dist/commands/llm-command.js +1 -1
  31. package/dist/commands/mcp-command.js +1 -1
  32. package/dist/commands/parent-segment-command.js +1 -1
  33. package/dist/commands/policy-command.js +1 -1
  34. package/dist/commands/profile-command.js +1 -1
  35. package/dist/commands/profiles-command.js +1 -1
  36. package/dist/commands/query-command.js +1 -1
  37. package/dist/commands/schedule-command.js +1 -1
  38. package/dist/commands/segment-command.js +1 -1
  39. package/dist/commands/segment-create-command.js +1 -1
  40. package/dist/commands/segment-fields-command.js +1 -1
  41. package/dist/commands/segment-pull-command.js +1 -1
  42. package/dist/commands/segment-push-command.js +1 -1
  43. package/dist/commands/segment-update-command.js +1 -1
  44. package/dist/commands/segment-use-command.js +1 -1
  45. package/dist/commands/segment-validate-command.js +1 -1
  46. package/dist/commands/segments.js +1 -1
  47. package/dist/commands/show.js +1 -1
  48. package/dist/commands/status-command.js +1 -1
  49. package/dist/commands/tables.js +1 -1
  50. package/dist/commands/unset-command.js +1 -1
  51. package/dist/commands/upgrade-command.js +1 -1
  52. package/dist/commands/use-command.js +1 -1
  53. package/dist/commands/user-command.js +1 -1
  54. package/dist/commands/workflow-command.js +1 -1
  55. package/dist/core/auth.js +1 -1
  56. package/dist/core/command-output.js +1 -1
  57. package/dist/core/config.js +1 -1
  58. package/dist/core/connection-cache.js +1 -1
  59. package/dist/core/constants.js +1 -1
  60. package/dist/core/credential-cache.js +1 -1
  61. package/dist/core/global-context.js +1 -1
  62. package/dist/core/keychain.js +1 -1
  63. package/dist/core/oauth-keychain.js +1 -1
  64. package/dist/core/oauth.js +1 -1
  65. package/dist/core/profile.js +1 -1
  66. package/dist/core/project-config.js +1 -1
  67. package/dist/core/session.js +1 -1
  68. package/dist/core/user-cache.js +1 -1
  69. package/dist/core/version.js +1 -1
  70. package/dist/index.js +1 -1
  71. package/dist/mcp/server.js +1 -1
  72. package/dist/mcp/tools/index.js +1 -1
  73. package/dist/mcp/tools/tdx-run.js +1 -1
  74. package/dist/mcp/tools/tdx-search.js +1 -1
  75. package/dist/mcp/utils.js +1 -1
  76. package/dist/proxy/claude-usage-tracker.js +1 -1
  77. package/dist/proxy/passthrough-server.js +1 -1
  78. package/dist/proxy/sse-usage-parser.js +1 -1
  79. package/dist/sdk/agent/agent-config.js +1 -1
  80. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  81. package/dist/sdk/agent/agent-yaml.js +1 -1
  82. package/dist/sdk/agent/test/evaluator.js +1 -1
  83. package/dist/sdk/agent/test/executor.js +1 -1
  84. package/dist/sdk/agent/test/index.js +1 -1
  85. package/dist/sdk/agent/test/output.js +1 -1
  86. package/dist/sdk/agent/test/parser.js +1 -1
  87. package/dist/sdk/agent/tool-target-registry.js +1 -1
  88. package/dist/sdk/api.js +1 -1
  89. package/dist/sdk/client/cdp-api-client.js +1 -1
  90. package/dist/sdk/client/delivery-api-client.js +1 -1
  91. package/dist/sdk/client/endpoints.js +1 -1
  92. package/dist/sdk/client/engage-api-client.js +1 -1
  93. package/dist/sdk/client/http-client.js +1 -1
  94. package/dist/sdk/client/llm-api-client.js +1 -1
  95. package/dist/sdk/client/oauth-refresh.js +1 -1
  96. package/dist/sdk/client/rate-limiter.js +1 -1
  97. package/dist/sdk/client/td-api-client.js +1 -1
  98. package/dist/sdk/client/trino-api-client.js +1 -1
  99. package/dist/sdk/client/workflow-client.js +1 -1
  100. package/dist/sdk/connection-validator.js +1 -1
  101. package/dist/sdk/connection.js +1 -1
  102. package/dist/sdk/delivery.js +1 -1
  103. package/dist/sdk/engage/campaign-pull.js +1 -1
  104. package/dist/sdk/engage/campaign-push.js +1 -1
  105. package/dist/sdk/engage/campaign-validator.js +1 -1
  106. package/dist/sdk/engage/campaign-yaml.js +1 -1
  107. package/dist/sdk/engage/template-pull.js +1 -1
  108. package/dist/sdk/engage/template-push.js +1 -1
  109. package/dist/sdk/engage/template-validator.js +1 -1
  110. package/dist/sdk/engage/template-yaml.js +1 -1
  111. package/dist/sdk/engage/types/campaign-def.js +1 -1
  112. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  113. package/dist/sdk/engage/types/template-schema.js +1 -1
  114. package/dist/sdk/engage.js +1 -1
  115. package/dist/sdk/errors.js +1 -1
  116. package/dist/sdk/index.js +1 -1
  117. package/dist/sdk/io/index.js +1 -1
  118. package/dist/sdk/io/node-filesystem.js +1 -1
  119. package/dist/sdk/job.js +1 -1
  120. package/dist/sdk/journey.js +1 -1
  121. package/dist/sdk/llm/chat-cache.js +1 -1
  122. package/dist/sdk/llm/index.js +1 -1
  123. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  124. package/dist/sdk/llm/model-factors.js +1 -1
  125. package/dist/sdk/personalization.js +1 -1
  126. package/dist/sdk/policy.js +1 -1
  127. package/dist/sdk/query/index.js +1 -1
  128. package/dist/sdk/query/sql-parser.js +1 -1
  129. package/dist/sdk/realtime.js +1 -1
  130. package/dist/sdk/schedule.js +1 -1
  131. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  132. package/dist/sdk/segment/fields-display.js +1 -1
  133. package/dist/sdk/segment/file-discovery.js +1 -1
  134. package/dist/sdk/segment/journey-utils.js +1 -1
  135. package/dist/sdk/segment/journey-validator.js +1 -1
  136. package/dist/sdk/segment/journey-yaml.js +1 -1
  137. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  138. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  139. package/dist/sdk/segment/pull-workflow.js +1 -1
  140. package/dist/sdk/segment/push-recovery.js +1 -1
  141. package/dist/sdk/segment/push-workflow.js +1 -1
  142. package/dist/sdk/segment/resolution-context.js +1 -1
  143. package/dist/sdk/segment/segment-path-parser.js +1 -1
  144. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  145. package/dist/sdk/segment/segment-validator.js +1 -1
  146. package/dist/sdk/segment/target-resolution.js +1 -1
  147. package/dist/sdk/segment/tdx-config.js +1 -1
  148. package/dist/sdk/segment/types/activation-schema.js +1 -1
  149. package/dist/sdk/segment/types/journey-def.js +1 -1
  150. package/dist/sdk/segment/types/journey-schema.js +1 -1
  151. package/dist/sdk/segment/types/segment-def.js +1 -1
  152. package/dist/sdk/segment/types/segment-schema.js +1 -1
  153. package/dist/sdk/segment/validate-files.js +1 -1
  154. package/dist/sdk/segment/yaml-validator.js +1 -1
  155. package/dist/sdk/segment.js +1 -1
  156. package/dist/sdk/types/index.js +1 -1
  157. package/dist/sdk/types/progress.js +1 -1
  158. package/dist/sdk/user.js +1 -1
  159. package/dist/sdk/util/format-detector.js +1 -1
  160. package/dist/sdk/util/formatters.js +1 -1
  161. package/dist/sdk/util/index.js +1 -1
  162. package/dist/sdk/util/paginate.js +1 -1
  163. package/dist/sdk/util/tree-formatter.js +1 -1
  164. package/dist/sdk/workflow/archive-validation.js +1 -1
  165. package/dist/sdk/workflow/clone-workflow.js +1 -1
  166. package/dist/sdk/workflow/index.js +1 -1
  167. package/dist/sdk/workflow/pull-workflow.js +1 -1
  168. package/dist/sdk/workflow/push-workflow.js +1 -1
  169. package/dist/sdk/workflow/tdx-config.js +1 -1
  170. package/dist/sdk/workflow/workflow-utils.js +1 -1
  171. package/dist/test-utils/command-runner.js +1 -1
  172. package/dist/test-utils/factories.js +1 -1
  173. package/dist/test-utils/fixtures.js +1 -1
  174. package/dist/test-utils/http-mock.js +1 -1
  175. package/dist/test-utils/index.js +1 -1
  176. package/dist/utils/async.js +1 -1
  177. package/dist/utils/colors.js +1 -1
  178. package/dist/utils/diff.js +1 -1
  179. package/dist/utils/file-permissions.js +1 -1
  180. package/dist/utils/file-reader.js +1 -1
  181. package/dist/utils/github-releases.js +1 -1
  182. package/dist/utils/global-cache.js +1 -1
  183. package/dist/utils/json-loader.js +1 -1
  184. package/dist/utils/local-cache.js +1 -1
  185. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  186. package/dist/utils/logger/formatters/index.js +1 -1
  187. package/dist/utils/logger/handlers/console-handler.js +1 -1
  188. package/dist/utils/logger/handlers/file-handler.js +1 -1
  189. package/dist/utils/logger/handlers/index.js +1 -1
  190. package/dist/utils/logger/handlers/null-handler.js +1 -1
  191. package/dist/utils/logger/index.js +1 -1
  192. package/dist/utils/logger/logger.js +1 -1
  193. package/dist/utils/logger/types.js +1 -1
  194. package/dist/utils/option-validation.js +1 -1
  195. package/dist/utils/process.js +1 -1
  196. package/dist/utils/prompt.js +1 -1
  197. package/dist/utils/spinner.js +1 -1
  198. package/dist/utils/sse-parser.js +1 -1
  199. package/dist/utils/string-utils.js +1 -1
  200. package/dist/utils/table-ref-parser.js +1 -1
  201. package/dist/utils/tdx-logger.js +1 -1
  202. package/dist/utils/version-check.js +1 -1
  203. package/package.json +1 -1
@@ -1 +1 @@
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
+ const a34_0x2f67d4=a34_0x56b6;(function(_0x2cdd8f,_0x3c8211){const _0x5b7568=a34_0x56b6,_0x8f4710=_0x2cdd8f();while(!![]){try{const _0x1af9ab=-parseInt(_0x5b7568(0xe1))/0x1+-parseInt(_0x5b7568(0xfa))/0x2*(parseInt(_0x5b7568(0xed))/0x3)+parseInt(_0x5b7568(0xfc))/0x4*(parseInt(_0x5b7568(0xea))/0x5)+-parseInt(_0x5b7568(0xdd))/0x6*(-parseInt(_0x5b7568(0xfb))/0x7)+-parseInt(_0x5b7568(0xf6))/0x8+-parseInt(_0x5b7568(0xfd))/0x9*(-parseInt(_0x5b7568(0xf7))/0xa)+parseInt(_0x5b7568(0x106))/0xb;if(_0x1af9ab===_0x3c8211)break;else _0x8f4710['push'](_0x8f4710['shift']());}catch(_0x2193fb){_0x8f4710['push'](_0x8f4710['shift']());}}}(a34_0x151d,0xc6971));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';function a34_0x151d(){const _0x46be39=['state','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','13398979BjmVDa','catalog','setPhase','error','push','Executing\x20query\x20[','stats','query','Site:\x20','setExtra','join','Statement\x20','in\x20','222FBQflr','execute','Query\x20completed:\x20Processed\x20','SQL:\x20','949465DKZCLH','\x20[Job\x20ID:\x20','args','processedRows','description','file','setJobId','length','Error:\x20','1430DAzhqt','verbose','...','1527ziPbgV','data','completedSplits','database','originalMessage','\x20rows\x20','site','\x20-\x20','\x0aAll\x20results\x20saved\x20to\x20','6717952bkPWUR','36130wOFSZl','message','No\x20SQL\x20provided','2402iJYOcw','52227unfgfz','7024WQmjWt','3033fQLJSf','options','Executing\x20query...','jobId','Executing\x20statement\x20','elapsedTimeMillis','output'];a34_0x151d=function(){return _0x46be39;};return a34_0x151d();}function a34_0x56b6(_0x56cb54,_0x352367){_0x56cb54=_0x56cb54-0xd2;const _0x151d4d=a34_0x151d();let _0x56b62b=_0x151d4d[_0x56cb54];return _0x56b62b;}import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a34_0x2f67d4(0xd7);[a34_0x2f67d4(0xe5)]='Run\x20Trino\x20queries\x20(streaming)';async['execute'](_0x481bfe){const _0x265da8=a34_0x2f67d4,{options:_0x5bc58a,args:_0x1fc7d5,tdx:_0xfde25f}=_0x481bfe,_0x2ef213={..._0x5bc58a,'limitStructuredFormats':!![]},_0x2d3065=_0x1fc7d5[0x0],_0x2fc14e=_0x5bc58a[_0x265da8(0xe6)];let _0x585546;try{if(_0x2fc14e)_0x585546=readSqlStatementsFromFile(_0x2fc14e);else{if(_0x2d3065==='-')_0x585546=await readSqlStatementsFromStdin();else{if(_0x2d3065&&isSqlFilePath(_0x2d3065))_0x585546=readSqlStatementsFromFile(_0x2d3065);else{if(_0x2d3065)_0x585546=splitSqlStatements(_0x2d3065);else throw new Error(_0x265da8(0xf9));}}}}catch(_0x29403f){return console[_0x265da8(0xd3)](_0x265da8(0xe9)+_0x29403f[_0x265da8(0xf8)]),0x1;}const _0x4f26fa=_0x5bc58a[_0x265da8(0xf0)]||'information_schema',_0x31826b=_0x5bc58a[_0x265da8(0x107)];try{const _0x3f6175=[],_0xe775b=!!_0x5bc58a[_0x265da8(0x103)];for(let _0x444a0a=0x0;_0x444a0a<_0x585546[_0x265da8(0xe8)];_0x444a0a++){const _0x4c9cd0=_0x585546[_0x444a0a],_0x452db1=_0x444a0a+0x1,_0xe62a27=_0x585546[_0x265da8(0xe8)],_0x4e0235=_0xe62a27>0x1;_0x5bc58a[_0x265da8(0xeb)]&&(console[_0x265da8(0xd3)]('\x0a'+(_0x4e0235?_0x265da8(0xdb)+_0x452db1+'/'+_0xe62a27+':':'')),console[_0x265da8(0xd3)](_0x265da8(0xd8)+_0x5bc58a[_0x265da8(0xf3)]),console[_0x265da8(0xd3)]('Catalog:\x20'+(_0x31826b||'td')),console[_0x265da8(0xd3)]('Schema:\x20'+_0x4f26fa),console['error'](_0x265da8(0xe0)+_0x4c9cd0));const _0x43675a=_0x4e0235?_0x265da8(0x101)+_0x452db1+'/'+_0xe62a27+_0x265da8(0xec):_0x265da8(0xff);try{const _0x3cbe96=await withProgressSpinner(_0x43675a,async _0x40dfa1=>{const _0x4ea0df=_0x265da8,_0x378cda=await _0xfde25f[_0x4ea0df(0xd7)][_0x4ea0df(0xde)](_0x4c9cd0,{'catalog':_0x31826b,'schema':_0x4f26fa,'onJobId':_0x41963b=>{const _0x573ff8=_0x4ea0df;_0x40dfa1[_0x573ff8(0xe7)](_0x41963b);},'onProgress':_0x3114cf=>{const _0x51bdf8=_0x4ea0df;_0x40dfa1[_0x51bdf8(0xd2)](_0x51bdf8(0xd5)+_0x3114cf[_0x51bdf8(0x104)]+']'),_0x40dfa1[_0x51bdf8(0xd9)](formatRows(_0x3114cf['processedRows'])+_0x51bdf8(0xf2)+_0x3114cf[_0x51bdf8(0xef)]+'/'+_0x3114cf['totalSplits']+'\x20splits');}});return _0x378cda;},{'verbose':_0x5bc58a['verbose']}),_0x1b085d=_0x3cbe96[_0x265da8(0xee)],_0xcf5d8e=_0x1b085d[_0x265da8(0x100)]?_0x265da8(0xe2)+_0x1b085d[_0x265da8(0x100)]+']':'',_0x536302=_0x4e0235?_0x265da8(0xdb)+_0x452db1+'/'+_0xe62a27+_0x265da8(0xf4):'';console[_0x265da8(0xd3)]('✔\x20'+_0x536302+_0x265da8(0xdf)+formatRows(_0x1b085d[_0x265da8(0xd6)][_0x265da8(0xe4)])+'\x20rows\x20'+(_0x265da8(0xdc)+formatElapsed(_0x1b085d[_0x265da8(0xd6)][_0x265da8(0x102)])+_0xcf5d8e));if(_0x4e0235&&_0xe775b){const _0x7d7072=resolveOutputOptions(_0x2ef213),_0x2ba922=await formatQueryOutput(_0x1b085d,_0x7d7072);_0x3f6175[_0x265da8(0xd4)](_0x2ba922);}else await handleQueryOutput(_0x1b085d,_0x2ef213);}catch(_0x141c15){const _0x175b01=_0x4e0235?'Statement\x20'+_0x452db1+'/'+_0xe62a27+':\x0a':'',_0x24e662=_0x141c15 instanceof SDKError?_0x141c15[_0x265da8(0xf1)]:_0x141c15[_0x265da8(0xf8)];return console[_0x265da8(0xd3)](''+_0x175b01+_0x24e662),0x1;}}if(_0x585546[_0x265da8(0xe8)]>0x1&&_0xe775b&&_0x3f6175[_0x265da8(0xe8)]>0x0){const _0x4f506e=_0x3f6175[_0x265da8(0xda)]('\x0a');writeFileSync(_0x5bc58a[_0x265da8(0x103)],_0x4f506e),console[_0x265da8(0xd3)](_0x265da8(0xf5)+_0x5bc58a[_0x265da8(0x103)]);}return 0x0;}catch(_0x874f95){throw _0x874f95;}}['validate'](_0x5a7095){const _0x245acc=a34_0x2f67d4,_0x1d6535=_0x5a7095[_0x245acc(0xe3)][0x0],_0x46cad3=_0x5a7095[_0x245acc(0xfe)][_0x245acc(0xe6)];if(!_0x1d6535&&!_0x46cad3)return _0x245acc(0x105);if(_0x1d6535&&_0x46cad3)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}
@@ -1 +1 @@
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
+ const a35_0x2bda45=a35_0x3309;(function(_0x180be8,_0x318980){const _0x2105b3=a35_0x3309,_0x53f0d6=_0x180be8();while(!![]){try{const _0x4e66a1=parseInt(_0x2105b3(0x100))/0x1*(parseInt(_0x2105b3(0x137))/0x2)+-parseInt(_0x2105b3(0x11b))/0x3*(-parseInt(_0x2105b3(0xec))/0x4)+parseInt(_0x2105b3(0x134))/0x5+parseInt(_0x2105b3(0x13a))/0x6+-parseInt(_0x2105b3(0xf6))/0x7+-parseInt(_0x2105b3(0xe3))/0x8*(parseInt(_0x2105b3(0x10b))/0x9)+-parseInt(_0x2105b3(0x144))/0xa*(parseInt(_0x2105b3(0x15b))/0xb);if(_0x4e66a1===_0x318980)break;else _0x53f0d6['push'](_0x53f0d6['shift']());}catch(_0x3215fc){_0x53f0d6['push'](_0x53f0d6['shift']());}}}(a35_0x1f77,0x57c3e));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';function a35_0x3309(_0x2c56f6,_0x22109e){_0x2c56f6=_0x2c56f6-0xe2;const _0x1f7742=a35_0x1f77();let _0x330981=_0x1f7742[_0x2c56f6];return _0x330981;}import{hyperlink}from'../sdk/util/formatters.js';import a35_0x1c9f79 from'chalk';function formatRelativeTime(_0x2dde31){const _0x341cca=a35_0x3309,_0x9766c7=new Date(_0x2dde31),_0x1b2578=new Date(),_0x1a16fa=_0x9766c7[_0x341cca(0xe9)]()-_0x1b2578[_0x341cca(0xe9)](),_0x4ac12d=Math['abs'](_0x1a16fa)/0x3e8,_0x368b1b=_0x1a16fa<0x0;if(_0x4ac12d<0x3c)return _0x368b1b?_0x341cca(0x163):'soon';else{if(_0x4ac12d<0xe10){const _0x92f13=Math[_0x341cca(0x12b)](_0x4ac12d/0x3c);return _0x368b1b?_0x92f13+_0x341cca(0x107):_0x341cca(0x153)+_0x92f13+'m';}else{if(_0x4ac12d<0x15180){const _0x134de6=Math[_0x341cca(0x12b)](_0x4ac12d/0xe10);return _0x368b1b?_0x134de6+_0x341cca(0x142):_0x341cca(0x153)+_0x134de6+'h';}else{if(_0x4ac12d<0x93a80){const _0x4c3150=Math['round'](_0x4ac12d/0x15180);return _0x368b1b?_0x4c3150+'d\x20ago':_0x341cca(0x153)+_0x4c3150+'d';}else return _0x9766c7[_0x341cca(0x160)]();}}}}export class ScheduleListCommand extends BaseCommand{['name']=a35_0x2bda45(0x16b);['description']='List\x20scheduled\x20queries';async['execute'](_0x20ae5c){const _0x1b6500=a35_0x2bda45,{options:_0x63c5a7,args:_0x338b99,tdx:_0x1c6756}=_0x20ae5c,_0x3e1ea7=resolveLimit(_0x63c5a7[_0x1b6500(0x124)],DEFAULT_DISPLAY_LIMIT),_0x274121=_0x338b99[0x0],_0x18c90c=_0x274121?_0x1b6500(0x12d)+_0x274121+_0x1b6500(0x10a):_0x1b6500(0x129),_0x56feb9=await withSpinner(_0x18c90c,()=>_0x1c6756[_0x1b6500(0x13f)][_0x1b6500(0x103)]({'limit':_0x3e1ea7,'scheduled':!![],'pattern':_0x274121}),{'verbose':_0x63c5a7[_0x1b6500(0x125)]}),_0x1d3340=_0x56feb9[_0x1b6500(0xf7)][_0x1b6500(0x119)],_0x47c2ca=_0x56feb9['data'][_0x1b6500(0x123)]['has_next_page'],_0x215531=_0x274121?_0x1b6500(0x15e)+_0x274121+'\x22':'';_0x47c2ca?console[_0x1b6500(0x109)](_0x1b6500(0xea)+_0x1d3340[_0x1b6500(0x151)]+'\x20schedules'+_0x215531+_0x1b6500(0x122)):console['error'](_0x1b6500(0x14f)+_0x1d3340[_0x1b6500(0x151)]+'\x20scheduled\x20quer'+(_0x1d3340[_0x1b6500(0x151)]!==0x1?_0x1b6500(0x117):'y')+_0x215531);if(_0x63c5a7[_0x1b6500(0xe6)]===_0x1b6500(0x11e)||_0x63c5a7[_0x1b6500(0xe6)]===_0x1b6500(0x165)||_0x63c5a7['format']===_0x1b6500(0x141)||_0x63c5a7[_0x1b6500(0xe6)]==='tsv'){const _0x2d019d=_0x1d3340[_0x1b6500(0x12a)](_0x5d13fb=>({'id':_0x5d13fb['id'],'name':_0x5d13fb[_0x1b6500(0xe5)],'cron':_0x5d13fb[_0x1b6500(0x112)],'database':_0x5d13fb['database']?.[_0x1b6500(0xe5)],'type':_0x5d13fb[_0x1b6500(0x16e)],'timezone':_0x5d13fb[_0x1b6500(0x159)],'user_name':_0x5d13fb[_0x1b6500(0xf0)]?.[_0x1b6500(0xe5)],'updated_at':_0x5d13fb['updated_at'],'next_run_at':_0x5d13fb['next_run_at'],'last_job_status':_0x5d13fb[_0x1b6500(0xfd)]?.[_0x1b6500(0x113)]}));await handleSDKOutput(_0x2d019d,_0x63c5a7);}else{if(_0x1d3340['length']===0x0)console[_0x1b6500(0x118)]('No\x20scheduled\x20queries\x20found');else{const _0x2f61f6=_0x63c5a7[_0x1b6500(0xe7)],_0x22f876=_0x1d3340[_0x1b6500(0x12a)](_0x1d0e0f=>{const _0x35c9c1=_0x1b6500,_0x44d42a=_0x1d0e0f['last_job']?.[_0x35c9c1(0x113)]?_0x1d0e0f[_0x35c9c1(0xfd)][_0x35c9c1(0x113)]===_0x35c9c1(0xfb)?'✓':'✗':'-',_0x38e6ac=_0x1d0e0f[_0x35c9c1(0xfd)]?.[_0x35c9c1(0x10d)]?formatRelativeTime(_0x1d0e0f[_0x35c9c1(0xfd)][_0x35c9c1(0x10d)]):_0x35c9c1(0x138),_0x20c7a3=_0x1d0e0f[_0x35c9c1(0xe2)]?formatRelativeTime(_0x1d0e0f[_0x35c9c1(0xe2)]):'-',_0x7b8a38=_0x1d0e0f[_0x35c9c1(0x112)]||'',_0x260a6a=_0x1d0e0f[_0x35c9c1(0xe5)]||_0x35c9c1(0x105),_0x4f22d3=getConsoleUrl(_0x2f61f6,_0x35c9c1(0xf3)+_0x1d0e0f['id']);return{'statusIcon':_0x44d42a,'lastRun':_0x38e6ac,'nextRun':_0x20c7a3,'cron':_0x7b8a38,'name':_0x260a6a,'queryUrl':_0x4f22d3,'status':_0x1d0e0f['last_job']?.[_0x35c9c1(0x113)]};}),_0x220eb2=Math['max'](..._0x22f876[_0x1b6500(0x12a)](_0x3ba86f=>_0x3ba86f[_0x1b6500(0x164)][_0x1b6500(0x151)])),_0x3fa05b=Math[_0x1b6500(0xeb)](..._0x22f876['map'](_0x18ffaa=>_0x18ffaa[_0x1b6500(0x104)][_0x1b6500(0x151)])),_0xdf67c1=Math[_0x1b6500(0xeb)](..._0x22f876[_0x1b6500(0x12a)](_0x4f6b03=>_0x4f6b03[_0x1b6500(0x112)][_0x1b6500(0x151)])),_0x1e43fc=_0x22f876['map'](_0x30182b=>{const _0x341800=_0x1b6500,_0x3ab1a6=_0x30182b[_0x341800(0x113)]===_0x341800(0xfb)?a35_0x1c9f79[_0x341800(0xef)](_0x30182b[_0x341800(0x131)]):_0x30182b[_0x341800(0x113)]==='error'?a35_0x1c9f79['red'](_0x30182b[_0x341800(0x131)]):a35_0x1c9f79['dim'](_0x30182b[_0x341800(0x131)]),_0x4ddb07=_0x30182b['lastRun'][_0x341800(0x166)](_0x220eb2),_0x53a290=_0x30182b[_0x341800(0x104)]['padEnd'](_0x3fa05b),_0x37c303=_0x30182b[_0x341800(0x112)]?a35_0x1c9f79[_0x341800(0xe4)](_0x30182b[_0x341800(0x112)][_0x341800(0x166)](_0xdf67c1)):'\x20'[_0x341800(0xfe)](_0xdf67c1),_0x35f4bf=hyperlink(_0x30182b[_0x341800(0xe5)],_0x30182b[_0x341800(0xf1)]);return _0x341800(0x139)+_0x3ab1a6+'\x20'+_0x4ddb07+'\x20\x20→\x20'+_0x53a290+'\x20\x20'+_0x37c303+'\x20\x20'+_0x35f4bf;});await writeOutput(_0x1e43fc['join']('\x0a'),_0x63c5a7[_0x1b6500(0x14a)],_0x1b6500(0x128));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{['name']='schedule:show';[a35_0x2bda45(0x13e)]=a35_0x2bda45(0x154);[a35_0x2bda45(0x12c)](_0x285912){const _0x3c775e=a35_0x2bda45,_0x41be6b=_0x285912['args'][0x0];if(!_0x41be6b)return _0x3c775e(0x115);return undefined;}async[a35_0x2bda45(0xf8)](_0x218f36){const _0x727f9c=a35_0x2bda45,{options:_0x59bcef,args:_0x665779,tdx:_0x243223}=_0x218f36,_0x2f55e3=_0x665779[0x0],_0x1e4fbb=await withSpinner(_0x727f9c(0x106),()=>_0x243223[_0x727f9c(0x13f)][_0x727f9c(0x12f)](_0x2f55e3),{'verbose':_0x59bcef['verbose']}),_0x589a7b=_0x1e4fbb[_0x727f9c(0xf7)],_0x12d5cc={'name':_0x589a7b[_0x727f9c(0xe5)],'cron':_0x589a7b[_0x727f9c(0x112)],'database':_0x589a7b[_0x727f9c(0x10f)],'type':_0x589a7b['type'],'timezone':_0x589a7b['timezone'],'user_name':_0x589a7b[_0x727f9c(0x11d)],'created_at':_0x589a7b['created_at'],'engine_version':_0x589a7b[_0x727f9c(0x148)],'executing_user_id':_0x589a7b['executing_user_id'],'query':_0x589a7b[_0x727f9c(0x101)],'delay':_0x589a7b['delay'],'priority':_0x589a7b['priority'],'retry_limit':_0x589a7b[_0x727f9c(0x14e)],..._0x589a7b[_0x727f9c(0x13b)]&&{'result':_0x589a7b['result']}};return await handleSingleObjectOutput(_0x12d5cc,_0x59bcef),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a35_0x2bda45(0xe5)]=a35_0x2bda45(0x136);[a35_0x2bda45(0x13e)]='Create\x20a\x20scheduled\x20query';[a35_0x2bda45(0x12c)](_0x532319){const _0x3b1d95=a35_0x2bda45,_0x1b5c6e=_0x532319['args'][0x0];if(!_0x1b5c6e)return _0x3b1d95(0x155);const _0x12a34a=_0x532319[_0x3b1d95(0x126)];if(!_0x12a34a[_0x3b1d95(0x10f)])return _0x3b1d95(0x162);return undefined;}async[a35_0x2bda45(0xf8)](_0x55751e){const _0x4bf19f=a35_0x2bda45,{options:_0x3476c2,args:_0x469605,tdx:_0x56e873}=_0x55751e,_0x4c8fa5=_0x469605[0x0],_0x27248f=_0x3476c2,_0x357fba=_0x27248f[_0x4bf19f(0x10f)],_0x2be7d1=_0x27248f[_0x4bf19f(0x11c)],_0x487344=_0x27248f[_0x4bf19f(0x16e)]||_0x4bf19f(0x140);let _0x513ffa;try{_0x513ffa=readFileSync(_0x2be7d1,_0x4bf19f(0x102))[_0x4bf19f(0x168)]();}catch(_0x4ea775){throw new SDKError(ErrorCode[_0x4bf19f(0x167)],_0x4bf19f(0xee)+_0x2be7d1,_0x4ea775 instanceof Error?_0x4ea775:undefined);}if(!_0x513ffa)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x4bf19f(0x16a));const _0x26a0d2={'database':_0x357fba,'query':_0x513ffa,'type':_0x487344};if(_0x27248f[_0x4bf19f(0x112)])_0x26a0d2[_0x4bf19f(0x112)]=_0x27248f[_0x4bf19f(0x112)];if(_0x27248f[_0x4bf19f(0x14c)])_0x26a0d2['timezone']=_0x27248f[_0x4bf19f(0x14c)];if(_0x27248f[_0x4bf19f(0x116)]!==undefined)_0x26a0d2[_0x4bf19f(0x116)]=Number(_0x27248f[_0x4bf19f(0x116)]);if(_0x27248f[_0x4bf19f(0x143)]!==undefined)_0x26a0d2[_0x4bf19f(0x143)]=Number(_0x27248f[_0x4bf19f(0x143)]);if(_0x27248f[_0x4bf19f(0x132)]!==undefined)_0x26a0d2[_0x4bf19f(0x14e)]=Number(_0x27248f[_0x4bf19f(0x132)]);if(_0x27248f['engineVersion'])_0x26a0d2[_0x4bf19f(0x148)]=_0x27248f[_0x4bf19f(0x111)];if(_0x27248f['result'])_0x26a0d2[_0x4bf19f(0x13b)]=_0x27248f[_0x4bf19f(0x13b)];if(_0x3476c2[_0x4bf19f(0x125)]){console['error'](_0x4bf19f(0xe8)+_0x4c8fa5),console[_0x4bf19f(0x109)](_0x4bf19f(0x127)+_0x357fba),console[_0x4bf19f(0x109)]('\x20\x20Type:\x20'+_0x487344);if(_0x26a0d2[_0x4bf19f(0x112)])console[_0x4bf19f(0x109)](_0x4bf19f(0x14d)+_0x26a0d2['cron']);if(_0x26a0d2['timezone'])console[_0x4bf19f(0x109)]('\x20\x20Timezone:\x20'+_0x26a0d2[_0x4bf19f(0x14c)]);}const _0x5b1969=await withSpinner(_0x4bf19f(0x147),()=>_0x56e873[_0x4bf19f(0x13f)][_0x4bf19f(0x13c)](_0x4c8fa5,_0x26a0d2),{'verbose':_0x3476c2['verbose']});return console[_0x4bf19f(0x109)]('Schedule\x20created:\x20'+_0x5b1969[_0x4bf19f(0xf7)][_0x4bf19f(0xe5)]),await handleSingleObjectOutput(_0x5b1969['data'],_0x3476c2),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a35_0x2bda45(0xe5)]=a35_0x2bda45(0x158);[a35_0x2bda45(0x13e)]=a35_0x2bda45(0x15f);[a35_0x2bda45(0x12c)](_0x58e3f0){const _0x60e035=a35_0x2bda45,_0x1ed2e8=_0x58e3f0[_0x60e035(0x11f)][0x0];if(!_0x1ed2e8)return _0x60e035(0x108);return undefined;}async[a35_0x2bda45(0xf8)](_0x411fa3){const _0x1ec740=a35_0x2bda45,{options:_0x24964d,args:_0x3e8ba8,tdx:_0x2642fb}=_0x411fa3,_0x354e35=_0x3e8ba8[0x0],_0x3e8d6a=_0x24964d,_0x5a6ccd={};if(_0x3e8d6a['database'])_0x5a6ccd[_0x1ec740(0x10f)]=_0x3e8d6a[_0x1ec740(0x10f)];if(_0x3e8d6a[_0x1ec740(0x16e)])_0x5a6ccd[_0x1ec740(0x16e)]=_0x3e8d6a[_0x1ec740(0x16e)];if(_0x3e8d6a[_0x1ec740(0x112)])_0x5a6ccd['cron']=_0x3e8d6a[_0x1ec740(0x112)];if(_0x3e8d6a[_0x1ec740(0x14c)])_0x5a6ccd[_0x1ec740(0x14c)]=_0x3e8d6a[_0x1ec740(0x14c)];if(_0x3e8d6a[_0x1ec740(0x116)]!==undefined)_0x5a6ccd[_0x1ec740(0x116)]=Number(_0x3e8d6a['delay']);if(_0x3e8d6a['priority']!==undefined)_0x5a6ccd[_0x1ec740(0x143)]=Number(_0x3e8d6a[_0x1ec740(0x143)]);if(_0x3e8d6a[_0x1ec740(0x132)]!==undefined)_0x5a6ccd['retry_limit']=Number(_0x3e8d6a[_0x1ec740(0x132)]);if(_0x3e8d6a['engineVersion'])_0x5a6ccd['engine_version']=_0x3e8d6a[_0x1ec740(0x111)];if(_0x3e8d6a[_0x1ec740(0x13b)])_0x5a6ccd[_0x1ec740(0x13b)]=_0x3e8d6a[_0x1ec740(0x13b)];if(_0x3e8d6a[_0x1ec740(0x11c)])try{_0x5a6ccd[_0x1ec740(0x101)]=readFileSync(_0x3e8d6a[_0x1ec740(0x11c)],'utf-8')[_0x1ec740(0x168)]();}catch(_0x429fd1){throw new SDKError(ErrorCode[_0x1ec740(0x167)],_0x1ec740(0xee)+_0x3e8d6a[_0x1ec740(0x11c)],_0x429fd1 instanceof Error?_0x429fd1:undefined);}if(Object[_0x1ec740(0xed)](_0x5a6ccd)[_0x1ec740(0x151)]===0x0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1ec740(0x146));if(_0x24964d[_0x1ec740(0x125)]){console['error'](_0x1ec740(0x110)+_0x354e35);for(const [_0x471478,_0x1136e7]of Object['entries'](_0x5a6ccd)){_0x471478==='query'?console[_0x1ec740(0x109)]('\x20\x20'+_0x471478+':\x20'+_0x1136e7[_0x1ec740(0x156)](0x0,0x32)+'...'):console[_0x1ec740(0x109)]('\x20\x20'+_0x471478+':\x20'+_0x1136e7);}}const _0x42ddf8=await withSpinner(_0x1ec740(0xfa),()=>_0x2642fb[_0x1ec740(0x13f)][_0x1ec740(0xf5)](_0x354e35,_0x5a6ccd),{'verbose':_0x24964d[_0x1ec740(0x125)]});return console[_0x1ec740(0x109)](_0x1ec740(0x15a)+_0x42ddf8['data']['name']),await handleSingleObjectOutput(_0x42ddf8[_0x1ec740(0xf7)],_0x24964d),0x0;}}function a35_0x1f77(){const _0x35b6dc=['queries','\x20\x20Time:\x20','572754cKqOIL','file','user_name','json','args','Show\x20schedule\x20execution\x20history','count','\x20(use\x20--limit\x20to\x20see\x20more)','pagination','limit','verbose','options','\x20\x20Database:\x20','list','Listing\x20scheduled\x20queries...','map','round','validate','Searching\x20scheduled\x20queries\x20matching\x20\x22','num','show','scheduled_at','statusIcon','retryLimit','yes','1209580VMNKab','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','schedule:create','4792uUUYoV','never','📅\x20','401238mgODMM','result','create','time','description','schedules','trino','table','h\x20ago','priority','4730cTznzF','schedule:history','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','Creating\x20schedule...','engine_version','Schedule\x20deleted:\x20','output','Run\x20a\x20scheduled\x20query\x20immediately','timezone','\x20\x20Cron:\x20','retry_limit','Found\x20','end_at','length','schedule:run','in\x20','Show\x20schedule\x20details','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','substring','\x20execution','schedule:update','time_zone','Schedule\x20updated:\x20','1232tExFlZ','Getting\x20schedule\x20history...','job_id','\x20matching\x20\x22','Update\x20a\x20scheduled\x20query','toLocaleDateString','created_at','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','just\x20now','lastRun','jsonl','padEnd','INVALID_ARGUMENT','trim','from','Query\x20file\x20is\x20empty','schedule:list','\x20created','\x20(showing\x20','type','\x20job','next_run_at','1696xvoiFa','cyan','name','format','site','Creating\x20schedule:\x20','getTime','Showing\x20first\x20','max','8WJeiXw','keys','Failed\x20to\x20read\x20file:\x20','green','user','queryUrl','Cancelled','/app/queries/editor?queryId=','start_at','update','271089DoANlh','data','execute','Running\x20schedule...','Updating\x20schedule...','success','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','last_job','repeat','delete','151QXBEzT','query','utf-8','listQueries','nextRun','(unnamed)','Getting\x20schedule\x20details...','m\x20ago','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','error','\x22...','25524rmUhLB','Delete\x20a\x20scheduled\x20query','ended_at','history','database','Updating\x20schedule:\x20','engineVersion','cron','status','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','delay','ies','log'];a35_0x1f77=function(){return _0x35b6dc;};return a35_0x1f77();}export class ScheduleDeleteCommand extends BaseCommand{[a35_0x2bda45(0xe5)]='schedule:delete';[a35_0x2bda45(0x13e)]=a35_0x2bda45(0x10c);[a35_0x2bda45(0x12c)](_0x37d7d7){const _0x11ec86=a35_0x2bda45,_0x5755e2=_0x37d7d7[_0x11ec86(0x11f)][0x0];if(!_0x5755e2)return _0x11ec86(0xfc);return undefined;}async[a35_0x2bda45(0xf8)](_0x55ef78){const _0x5e329c=a35_0x2bda45,{options:_0x45fa3c,args:_0x3b030e,tdx:_0x431183}=_0x55ef78,_0x266cf0=_0x3b030e[0x0];if(!_0x45fa3c[_0x5e329c(0x133)]){const _0x44a11a=await confirm(_0x5e329c(0x135)+_0x266cf0+'\x22?');if(!_0x44a11a)return console[_0x5e329c(0x109)](_0x5e329c(0xf2)),0x0;}const _0xd50427=await withSpinner('Deleting\x20schedule...',()=>_0x431183['schedules'][_0x5e329c(0xff)](_0x266cf0),{'verbose':_0x45fa3c[_0x5e329c(0x125)]});return console[_0x5e329c(0x109)](_0x5e329c(0x149)+_0xd50427['data'][_0x5e329c(0xe5)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a35_0x2bda45(0xe5)]=a35_0x2bda45(0x152);[a35_0x2bda45(0x13e)]=a35_0x2bda45(0x14b);['validate'](_0xb29fe5){const _0x3cc725=a35_0x2bda45,_0x5ee642=_0xb29fe5['args'][0x0];if(!_0x5ee642)return _0x3cc725(0x114);return undefined;}async[a35_0x2bda45(0xf8)](_0x3b0d6f){const _0x152378=a35_0x2bda45,{options:_0x5d1914,args:_0x229193,tdx:_0x287750}=_0x3b0d6f,_0x38923c=_0x229193[0x0],_0xa27497=_0x5d1914,_0x52a3cb=_0xa27497[_0x152378(0x13d)],_0x499321=_0xa27497['num']!==undefined?Number(_0xa27497[_0x152378(0x12e)]):undefined;if(_0x5d1914[_0x152378(0x125)]){console[_0x152378(0x109)]('Running\x20schedule:\x20'+_0x38923c);if(_0x52a3cb)console[_0x152378(0x109)](_0x152378(0x11a)+_0x52a3cb);if(_0x499321)console[_0x152378(0x109)]('\x20\x20Num:\x20'+_0x499321);}const _0x408087=await withSpinner(_0x152378(0xf9),()=>_0x287750[_0x152378(0x13f)]['run'](_0x38923c,{'time':_0x52a3cb,'num':_0x499321}),{'verbose':_0x5d1914[_0x152378(0x125)]}),_0xeb47ef=_0x408087[_0x152378(0xf7)]['jobs'];console[_0x152378(0x109)]('Schedule\x20run\x20submitted:\x20'+_0xeb47ef[_0x152378(0x151)]+_0x152378(0x16f)+(_0xeb47ef[_0x152378(0x151)]!==0x1?'s':'')+_0x152378(0x16c));for(const _0x57a5cb of _0xeb47ef){console[_0x152378(0x109)]('\x20\x20Job\x20ID:\x20'+_0x57a5cb[_0x152378(0x15d)]);}return await handleSDKOutput(_0xeb47ef,_0x5d1914),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a35_0x2bda45(0xe5)]=a35_0x2bda45(0x145);[a35_0x2bda45(0x13e)]=a35_0x2bda45(0x120);[a35_0x2bda45(0x12c)](_0xb31479){const _0x3d32cc=_0xb31479['args'][0x0];if(!_0x3d32cc)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async[a35_0x2bda45(0xf8)](_0x4b88f3){const _0x2820c2=a35_0x2bda45,{options:_0x1fcfa9,args:_0x503cd3,tdx:_0x5df111}=_0x4b88f3,_0x31c810=_0x503cd3[0x0],_0x5abb3d=_0x1fcfa9,_0x8474c5=_0x5abb3d[_0x2820c2(0x169)]!==undefined?Number(_0x5abb3d['from']):undefined,_0x2c7906=_0x5abb3d['to']!==undefined?Number(_0x5abb3d['to']):undefined,_0x185eb0=await withSpinner(_0x2820c2(0x15c),()=>_0x5df111[_0x2820c2(0x13f)][_0x2820c2(0x10e)](_0x31c810,{'from':_0x8474c5,'to':_0x2c7906}),{'verbose':_0x1fcfa9[_0x2820c2(0x125)]}),_0x29b9b5=_0x185eb0[_0x2820c2(0xf7)];console['error'](_0x2820c2(0x14f)+_0x29b9b5[_0x2820c2(0x121)]+_0x2820c2(0x157)+(_0x29b9b5['count']!==0x1?'s':'')+_0x2820c2(0x16d)+_0x29b9b5[_0x2820c2(0x169)]+'-'+_0x29b9b5['to']+')');const _0x42079b=_0x29b9b5[_0x2820c2(0x10e)][_0x2820c2(0x12a)](_0x16905c=>({'job_id':_0x16905c[_0x2820c2(0x15d)],'type':_0x16905c[_0x2820c2(0x16e)],'status':_0x16905c[_0x2820c2(0x113)],'scheduled_at':_0x16905c[_0x2820c2(0x130)],'created_at':_0x16905c[_0x2820c2(0x161)],'start_at':_0x16905c[_0x2820c2(0xf4)],'end_at':_0x16905c[_0x2820c2(0x150)]}));return await handleSDKOutput(_0x42079b,_0x1fcfa9),0x0;}}
@@ -1 +1 @@
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
+ const a36_0x2d2033=a36_0x844d;(function(_0x2cc6e3,_0x3b4f74){const _0x23d567=a36_0x844d,_0x87a4b4=_0x2cc6e3();while(!![]){try{const _0x41546b=parseInt(_0x23d567(0x1b6))/0x1*(parseInt(_0x23d567(0x1f8))/0x2)+-parseInt(_0x23d567(0x1f2))/0x3*(parseInt(_0x23d567(0x1d5))/0x4)+parseInt(_0x23d567(0x1c8))/0x5*(parseInt(_0x23d567(0x1ce))/0x6)+parseInt(_0x23d567(0x1ed))/0x7*(-parseInt(_0x23d567(0x197))/0x8)+-parseInt(_0x23d567(0x1e4))/0x9*(parseInt(_0x23d567(0x162))/0xa)+-parseInt(_0x23d567(0x1bb))/0xb*(parseInt(_0x23d567(0x1ca))/0xc)+-parseInt(_0x23d567(0x1ae))/0xd*(-parseInt(_0x23d567(0x192))/0xe);if(_0x41546b===_0x3b4f74)break;else _0x87a4b4['push'](_0x87a4b4['shift']());}catch(_0x4794ae){_0x87a4b4['push'](_0x87a4b4['shift']());}}}(a36_0x1ed6,0x71ad5));import{BaseCommand}from'./command.js';function a36_0x844d(_0x3c8df8,_0x365c76){_0x3c8df8=_0x3c8df8-0x14f;const _0x1ed6fe=a36_0x1ed6();let _0x844de=_0x1ed6fe[_0x3c8df8];return _0x844de;}function a36_0x1ed6(){const _0x164ea8=['Resolved\x20YAML\x20file:\x20','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','parentFolder','Segment\x20ID:\x20','Resolved\x20relative\x20path\x20to:\x20','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','json','Usage:\x20tdx\x20sg\x20show\x20<name>','Resolving\x20folder\x20\x27','(root)','Use:\x20tdx\x20ps\x20view\x20-w','type','fullPath','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','format','segmentId','13hSlYuM','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Examples:','Folder\x20ID:\x20','folderPath','Creating\x20folder\x20\x27','length','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','507739WYMGKk','\x20\x20Segment\x20name:\x20','Target\x20path:\x20','Site:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','11qcLYss','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','\x20\x20Cause:\x20','Error:\x20Folder\x20reference\x20is\x20required','getSegmentSQLFromYaml','Fetching\x20SQL\x20for\x20segment...','parent','\x20\x20Folder\x20path:\x20','listFolders','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','parentSegment','data','Resolving\x20path\x20\x27','1705WNnVbK','error','3831684hIJDUO','/e/','red','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','10830ECXxwg','parentId','Resolved\x20parent\x20ID:\x20','resolveParentId','site','getSQLFromYamlFile','Resolving\x20parent\x20segment\x20\x27','4dhTdmt','Parent\x20ID:\x20','Folder\x20ID\x20missing\x20from\x20resolved\x20path','/app/ps/','Fetching\x20parent\x20segment\x20details...','elapsedTimeMillis','SQL\x20query:\x0a','Show\x20segment\x20or\x20folder\x20details','✔\x20Query\x20completed:\x20Processed\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','test','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','✔\x20Created\x20folder\x20\x27','Use:\x20tdx\x20ps\x20show','9CaCHqH','segment:view','code','SELECT\x20*\x20FROM\x20(\x0a','folderId','Use:\x20tdx\x20ps\x20desc','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','resolvePathToResource','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','76265lviwlh','SEGMENT_FOLDER_NOT_FOUND','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','message','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','2781705FTIIDh','Fetching\x20segment\x20details...','SEGMENT_NOT_FOUND','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','processedRows','2gInbrj','folder','name','\x27\x20with\x20ID:\x20','\x20\x20Parent\x20segment:\x20','description','verbose','Resolved\x20parent\x20folder\x20ID:\x20','\x20folder','getParent','Fetching\x20folder\x20details...','web','Parent\x20name:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Get\x20SQL\x20query\x20for\x20child\x20segment','green','jobId','content','toLocaleString','getSegmentSQL','Listing\x20folders\x20for\x20parent\x20\x27','9281090HXPxLi','Usage:','Fetching\x20SQL\x20from\x20rule...','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','✔\x20Found\x20','Folder\x20name:\x20','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','path','resolveFolderId','Show\x20child\x20segment\x20schema\x20(column\x20types)','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Show\x20segment\x20folder\x20details','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','segment:folder:create','INVALID_ARGUMENT','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','url','Resolved\x20type:\x20','\x20\x20tdx\x20sg\x20sql\x20--path\x20','\x20\x20Full\x20path:\x20','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','segment:folder:list','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','includes','segment:sql','Use:\x20tdx\x20ps\x20view','execute','segment','\x20Opening\x20','segmentName','jsonl','✖\x20Query\x20failed\x20[','Segment\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Options:','Resolving\x20\x27','segment:desc','\x27...','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','segmentPath','getSQLFromServerSegment','Fetching\x20folder\x20\x27','Resolved:\x20','Error:\x20','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','Resolved\x20folder\x20ID:\x20','34203442kEyDrO','\x20[Job\x20ID:\x20','Error:\x20Path\x20or\x20name\x20is\x20required','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','680OFCeFc','stats','getSegment','trim','cause','\x20rows\x20'];a36_0x1ed6=function(){return _0x164ea8;};return a36_0x1ed6();}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_0x3702cc from'chalk';async function resolveSegmentTarget(_0x2ea164,_0x5f2872,_0x209b0c){const _0xd67aa=a36_0x844d;if(isYamlFilePath(_0x2ea164))try{const _0x1da761=await resolveYamlFilePath(_0x2ea164);return _0x209b0c&&(console['error'](_0xd67aa(0x19d)+_0x2ea164),console[_0xd67aa(0x1c9)](_0xd67aa(0x151)+_0x1da761['parentSegment']),console[_0xd67aa(0x1c9)](_0xd67aa(0x1b7)+_0x1da761[_0xd67aa(0x180)]),console['error'](_0xd67aa(0x1c2)+(_0x1da761[_0xd67aa(0x1b2)]||_0xd67aa(0x1a7))),console[_0xd67aa(0x1c9)](_0xd67aa(0x175)+_0x1da761['fullPath'])),_0x1da761[_0xd67aa(0x1aa)];}catch(_0x6bb6a){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0xd67aa(0x1e1)+_0x6bb6a[_0xd67aa(0x1f0)]);}if(!_0x5f2872)throw new SDKError(ErrorCode[_0xd67aa(0x170)],_0xd67aa(0x1cd));return _0x5f2872+'/'+_0x2ea164;}export class SegmentDescribeCommand extends BaseCommand{[a36_0x2d2033(0x14f)]='segment:describe';[a36_0x2d2033(0x152)]=a36_0x2d2033(0x1dc);async[a36_0x2d2033(0x17d)](_0x16194f){const _0x4bb57d=a36_0x2d2033,{options:_0x268c9b,args:_0xb551c8,tdx:_0x42e8bd}=_0x16194f,_0x5593d5=_0xb551c8[0x0],_0x5c8b4f=!_0x5593d5&&!!_0x268c9b['parentSegment'],_0x50176f=_0x5593d5||_0x268c9b['parentSegment'];if(!_0x50176f)return console[_0x4bb57d(0x1c9)](_0x4bb57d(0x194)),console[_0x4bb57d(0x1c9)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x4bb57d(0x1c9)]('Examples:'),console['error']('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console[_0x4bb57d(0x1c9)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console[_0x4bb57d(0x1c9)](_0x4bb57d(0x1c4)),console[_0x4bb57d(0x1c9)](_0x4bb57d(0x184)),0x1;try{const _0xeacb49=_0x268c9b[_0x4bb57d(0x18b)];let _0x1cd1c1=_0x50176f;!_0x5c8b4f&&_0xeacb49&&!_0x50176f[_0x4bb57d(0x17a)]('/')&&(_0x1cd1c1=_0xeacb49+'/'+_0x50176f,_0x268c9b[_0x4bb57d(0x153)]&&console['error'](_0x4bb57d(0x1a1)+_0x1cd1c1));const _0x4607d6=await withSpinner(_0x4bb57d(0x1c7)+_0x1cd1c1+'\x27...',()=>_0x42e8bd[_0x4bb57d(0x17e)][_0x4bb57d(0x1eb)](_0x1cd1c1),{'verbose':_0x268c9b[_0x4bb57d(0x153)]}),_0x5dd322=_0x4607d6[_0x4bb57d(0x1c6)];_0x268c9b[_0x4bb57d(0x153)]&&(console[_0x4bb57d(0x1c9)](_0x4bb57d(0x173)+_0x5dd322[_0x4bb57d(0x1a9)]),console[_0x4bb57d(0x1c9)](_0x4bb57d(0x1d6)+_0x5dd322[_0x4bb57d(0x1cf)]),_0x5dd322[_0x4bb57d(0x1e8)]&&console['error'](_0x4bb57d(0x1b1)+_0x5dd322[_0x4bb57d(0x1e8)]),_0x5dd322[_0x4bb57d(0x1ad)]&&console[_0x4bb57d(0x1c9)](_0x4bb57d(0x1a0)+_0x5dd322[_0x4bb57d(0x1ad)]));if(_0x5dd322[_0x4bb57d(0x1a9)]===_0x4bb57d(0x1c1)){const _0x28250e=await withSpinner(_0x4bb57d(0x1d9),()=>_0x42e8bd[_0x4bb57d(0x17e)][_0x4bb57d(0x156)](_0x5dd322[_0x4bb57d(0x1cf)]),{'verbose':_0x268c9b['verbose']});await handleSingleObjectOutput(_0x28250e[_0x4bb57d(0x1c6)],_0x268c9b);}else{if(_0x5dd322['type']==='folder'){if(!_0x5dd322[_0x4bb57d(0x1e8)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0xd15ecb=await withSpinner(_0x4bb57d(0x157),()=>_0x42e8bd['segment']['getFolder'](_0x5dd322[_0x4bb57d(0x1e8)]),{'verbose':_0x268c9b[_0x4bb57d(0x153)]});await handleSingleObjectOutput(_0xd15ecb[_0x4bb57d(0x1c6)],_0x268c9b);}else{if(_0x5dd322['type']==='segment'){if(!_0x5dd322[_0x4bb57d(0x1ad)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x4bb57d(0x183));const _0xdd13d9=await withSpinner(_0x4bb57d(0x1f3),()=>_0x42e8bd['segment']['getSegment'](_0x5dd322[_0x4bb57d(0x1cf)],_0x5dd322[_0x4bb57d(0x1ad)]),{'verbose':_0x268c9b[_0x4bb57d(0x153)]});await handleSingleObjectOutput(_0xdd13d9[_0x4bb57d(0x1c6)],_0x268c9b);}}}return 0x0;}catch(_0x4536e5){if(_0x4536e5 instanceof SDKError)return console['error'](_0x4bb57d(0x18f)+_0x4536e5[_0x4bb57d(0x1f0)]),_0x4536e5[_0x4bb57d(0x19b)]&&console[_0x4bb57d(0x1c9)](_0x4bb57d(0x1bd)+_0x4536e5[_0x4bb57d(0x19b)]),0x1;throw _0x4536e5;}}}export class SegmentShowCommand extends BaseCommand{[a36_0x2d2033(0x14f)]='segment:show';['description']=a36_0x2d2033(0x1ea);async['execute'](_0x198d5e){const _0x5216fa=a36_0x2d2033,{options:_0x1da6ed,args:_0x83453c,tdx:_0x44c24c}=_0x198d5e,_0x1b54ab=_0x83453c[0x0];if(!_0x1b54ab)return console[_0x5216fa(0x1c9)](_0x5216fa(0x165)),console[_0x5216fa(0x1c9)](_0x5216fa(0x1a5)),console[_0x5216fa(0x1c9)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console['error'](_0x5216fa(0x1b0)),console[_0x5216fa(0x1c9)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x5216fa(0x1c9)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x377b8d=_0x1da6ed['parentSegment'],_0x379d29=await resolveSegmentTarget(_0x1b54ab,_0x377b8d,_0x1da6ed[_0x5216fa(0x153)]);_0x1da6ed[_0x5216fa(0x153)]&&console[_0x5216fa(0x1c9)](_0x5216fa(0x1b8)+_0x379d29);const _0x3f6d35=await withSpinner('Resolving\x20\x27'+_0x1b54ab+'\x27...',()=>_0x44c24c[_0x5216fa(0x17e)]['resolvePathToResource'](_0x379d29),{'verbose':_0x1da6ed[_0x5216fa(0x153)]}),_0x338c20=_0x3f6d35[_0x5216fa(0x1c6)];_0x1da6ed[_0x5216fa(0x153)]&&(console[_0x5216fa(0x1c9)]('Resolved\x20type:\x20'+_0x338c20[_0x5216fa(0x1a9)]),console[_0x5216fa(0x1c9)](_0x5216fa(0x1d6)+_0x338c20['parentId']));if(_0x338c20['type']==='folder')return console[_0x5216fa(0x1c9)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console['error'](_0x5216fa(0x1f6)),0x1;if(_0x338c20[_0x5216fa(0x1a9)]===_0x5216fa(0x1c1))return console[_0x5216fa(0x1c9)](_0x5216fa(0x1b5)),console[_0x5216fa(0x1c9)](_0x5216fa(0x1e3)),0x1;if(!_0x338c20[_0x5216fa(0x1ad)])throw new SDKError(ErrorCode[_0x5216fa(0x1f4)],_0x5216fa(0x183));const _0x58fcde=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x44c24c[_0x5216fa(0x17e)][_0x5216fa(0x160)](_0x338c20[_0x5216fa(0x1cf)],_0x338c20[_0x5216fa(0x1ad)]),{'verbose':_0x1da6ed[_0x5216fa(0x153)]});let _0x1cb972=_0x58fcde[_0x5216fa(0x1c6)];const _0x235dfc=resolveLimit(_0x1da6ed['limit'],DEFAULT_DISPLAY_LIMIT),_0x4e90c6=/\bLIMIT\s+\d+/i[_0x5216fa(0x1df)](_0x1cb972);!_0x4e90c6&&(_0x1cb972=_0x1cb972[_0x5216fa(0x19a)]()['replace'](/;+$/,''),_0x1cb972=_0x5216fa(0x1e7)+_0x1cb972+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x235dfc);_0x1da6ed[_0x5216fa(0x153)]&&console[_0x5216fa(0x1c9)](_0x5216fa(0x1db)+_0x1cb972);const _0x4bd5a9=await withProgressSpinner('Executing\x20segment\x20query...',async _0x1b31c1=>{const _0x39f45c=_0x5216fa,_0x5d87e9=await _0x44c24c['query'][_0x39f45c(0x17d)](_0x1cb972,{'catalog':'td','schema':'information_schema','onJobId':_0x5112f5=>{_0x1b31c1['setJobId'](_0x5112f5);}});return _0x5d87e9;},{'verbose':_0x1da6ed[_0x5216fa(0x153)]}),_0x330729=_0x4bd5a9[_0x5216fa(0x1c6)],_0x3f5392=_0x330729[_0x5216fa(0x15d)]?_0x5216fa(0x193)+_0x330729[_0x5216fa(0x15d)]+']':'';return console['error'](_0x5216fa(0x1dd)+_0x330729[_0x5216fa(0x198)][_0x5216fa(0x1f7)][_0x5216fa(0x15f)]()+_0x5216fa(0x19c)+('in\x20'+formatElapsed(_0x330729[_0x5216fa(0x198)][_0x5216fa(0x1da)])+_0x3f5392)),await handleQueryOutput(_0x330729,_0x1da6ed),0x0;}catch(_0x146e69){if(_0x146e69 instanceof SDKError)return console[_0x5216fa(0x1c9)](_0x5216fa(0x182)+_0x146e69[_0x5216fa(0x1e6)]+']'),console[_0x5216fa(0x1c9)]('\x0a'+_0x146e69[_0x5216fa(0x1f0)]),0x1;throw _0x146e69;}}}export class SegmentFolderListCommand extends BaseCommand{['name']=a36_0x2d2033(0x178);[a36_0x2d2033(0x152)]=a36_0x2d2033(0x176);async[a36_0x2d2033(0x17d)](_0x15798a){const _0x2526a2=a36_0x2d2033,{options:_0x475972,args:_0xa301e0,tdx:_0x427fe3}=_0x15798a;if(_0xa301e0['length']===0x0)return console[_0x2526a2(0x1c9)](_0x2526a2(0x195)),console[_0x2526a2(0x1c9)](_0x2526a2(0x1ef)),0x1;const _0x16d048=_0xa301e0[0x0];try{_0x475972[_0x2526a2(0x153)]&&(console['error'](_0x2526a2(0x1b9)+_0x475972[_0x2526a2(0x1d2)]),console[_0x2526a2(0x1c9)](_0x2526a2(0x159)+_0x16d048));const _0x3f57f0=await withSpinner(_0x2526a2(0x1d4)+_0x16d048+_0x2526a2(0x189),()=>_0x427fe3['segment'][_0x2526a2(0x1d1)](_0x16d048),{'verbose':_0x475972['verbose']}),_0x22dc1a=_0x3f57f0['data'];_0x475972['verbose']&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x22dc1a);const _0x5ad6b4=await withSpinner(_0x2526a2(0x161)+_0x16d048+_0x2526a2(0x189),()=>_0x427fe3['segment'][_0x2526a2(0x1c3)](_0x22dc1a),{'verbose':_0x475972[_0x2526a2(0x153)]}),_0x9c52e3=_0x5ad6b4[_0x2526a2(0x1c6)];return console[_0x2526a2(0x1c9)](_0x2526a2(0x166)+_0x9c52e3['length']+_0x2526a2(0x155)+(_0x9c52e3[_0x2526a2(0x1b4)]!==0x1?'s':'')),await handleSDKOutput(_0x9c52e3,_0x475972),0x0;}catch(_0x54474f){if(_0x54474f instanceof SDKError)return console['error'](_0x2526a2(0x18f)+_0x54474f[_0x2526a2(0x1f0)]),_0x54474f[_0x2526a2(0x19b)]&&console['error']('\x20\x20Cause:\x20'+_0x54474f[_0x2526a2(0x19b)]),0x1;throw _0x54474f;}}}export class SegmentFolderShowCommand extends BaseCommand{[a36_0x2d2033(0x14f)]='segment:folder:show';[a36_0x2d2033(0x152)]=a36_0x2d2033(0x16d);async[a36_0x2d2033(0x17d)](_0x42d24a){const _0x34fbcc=a36_0x2d2033,{options:_0x276342,args:_0x1d95b8,tdx:_0x4e0e42}=_0x42d24a;if(_0x1d95b8[_0x34fbcc(0x1b4)]===0x0)return console[_0x34fbcc(0x1c9)](_0x34fbcc(0x1be)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x46560f,childId:_0x2c14f9}=parseSegmentRef(_0x1d95b8[0x0]);_0x276342['verbose']&&(console['error']('Site:\x20'+_0x276342[_0x34fbcc(0x1d2)]),console[_0x34fbcc(0x1c9)]('Parent\x20name:\x20'+_0x46560f),_0x2c14f9&&console[_0x34fbcc(0x1c9)]('Folder\x20name:\x20'+_0x2c14f9));if(!_0x2c14f9)return console[_0x34fbcc(0x1c9)](_0x34fbcc(0x177)),0x1;const _0x514428=await withSpinner(_0x34fbcc(0x1d4)+_0x46560f+'\x27...',()=>_0x4e0e42['segment']['resolveParentId'](_0x46560f),{'verbose':_0x276342[_0x34fbcc(0x153)]}),_0x3dc5d4=_0x514428['data'];_0x276342[_0x34fbcc(0x153)]&&console[_0x34fbcc(0x1c9)](_0x34fbcc(0x1d0)+_0x3dc5d4);const _0x40c152=await withSpinner(_0x34fbcc(0x1a6)+_0x2c14f9+_0x34fbcc(0x189),()=>_0x4e0e42[_0x34fbcc(0x17e)][_0x34fbcc(0x16a)](_0x3dc5d4,_0x2c14f9),{'verbose':_0x276342['verbose']}),_0x5685e3=_0x40c152[_0x34fbcc(0x1c6)];_0x276342[_0x34fbcc(0x153)]&&console[_0x34fbcc(0x1c9)](_0x34fbcc(0x191)+_0x5685e3);const _0x57802b=await withSpinner(_0x34fbcc(0x18d)+_0x2c14f9+_0x34fbcc(0x189),()=>_0x4e0e42[_0x34fbcc(0x17e)]['getFolder'](_0x5685e3),{'verbose':_0x276342[_0x34fbcc(0x153)]});return await handleSDKOutput([_0x57802b[_0x34fbcc(0x1c6)]],_0x276342),0x0;}catch(_0x38e7ab){if(_0x38e7ab instanceof SDKError)return console[_0x34fbcc(0x1c9)]('Error:\x20'+_0x38e7ab[_0x34fbcc(0x1f0)]),_0x38e7ab[_0x34fbcc(0x19b)]&&console[_0x34fbcc(0x1c9)]('\x20\x20Cause:\x20'+_0x38e7ab[_0x34fbcc(0x19b)]),0x1;throw _0x38e7ab;}}}export class SegmentSQLCommand extends BaseCommand{[a36_0x2d2033(0x14f)]=a36_0x2d2033(0x17b);['description']=a36_0x2d2033(0x15b);async[a36_0x2d2033(0x17d)](_0x3632d7){const _0x2b6b1a=a36_0x2d2033,{options:_0x635c38,args:_0x429124}=_0x3632d7,_0x365a94=_0x635c38,_0x23e7eb=_0x365a94[_0x2b6b1a(0x169)],_0x482d65=_0x429124[0x0];if(!_0x482d65&&!_0x23e7eb)return console[_0x2b6b1a(0x1c9)](a36_0x3702cc[_0x2b6b1a(0x1cc)](_0x2b6b1a(0x18a))),console['error'](_0x2b6b1a(0x163)),console['error'](_0x2b6b1a(0x190)),console[_0x2b6b1a(0x1c9)]('\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>'),console['error'](_0x2b6b1a(0x1b0)),console[_0x2b6b1a(0x1c9)]('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x2b6b1a(0x1c9)](_0x2b6b1a(0x1ab)),0x1;if(_0x482d65&&_0x23e7eb)return console[_0x2b6b1a(0x1c9)](a36_0x3702cc[_0x2b6b1a(0x1cc)](_0x2b6b1a(0x1f5))),0x1;try{let _0x21b075;if(_0x23e7eb)_0x21b075=await this[_0x2b6b1a(0x1d3)](_0x23e7eb,_0x3632d7);else{if(isYamlFilePath(_0x482d65))return console[_0x2b6b1a(0x1c9)](a36_0x3702cc[_0x2b6b1a(0x1cc)](_0x2b6b1a(0x168))),console[_0x2b6b1a(0x1c9)](_0x2b6b1a(0x174)+_0x482d65),0x1;else _0x21b075=await this['getSQLFromServerSegment'](_0x482d65,_0x3632d7);}return _0x635c38[_0x2b6b1a(0x1ac)]===_0x2b6b1a(0x1a4)||_0x635c38[_0x2b6b1a(0x1ac)]===_0x2b6b1a(0x181)?await handleSDKOutput([{'sql':_0x21b075}],_0x635c38):console['log'](_0x21b075),0x0;}catch(_0x567db9){if(_0x567db9 instanceof SDKError)return console[_0x2b6b1a(0x1c9)]('Error:\x20'+_0x567db9['message']),_0x567db9[_0x2b6b1a(0x19b)]&&console[_0x2b6b1a(0x1c9)]('\x20\x20Cause:\x20'+_0x567db9[_0x2b6b1a(0x19b)]),0x1;throw _0x567db9;}}async[a36_0x2d2033(0x1d3)](_0x58dd91,_0x399f62){const _0x54c10a=a36_0x2d2033,{options:_0xde192a,tdx:_0x39e581}=_0x399f62;let _0x1994de;try{_0x1994de=await resolveYamlFilePath(_0x58dd91);}catch(_0x196d2c){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x196d2c[_0x54c10a(0x1f0)]);}_0xde192a['verbose']&&console[_0x54c10a(0x1c9)](_0x54c10a(0x18e)+_0x1994de['parentSegment']+'/'+_0x1994de[_0x54c10a(0x180)]);const _0x5779ca=await withSpinner(_0x54c10a(0x164),()=>_0x39e581[_0x54c10a(0x17e)][_0x54c10a(0x1bf)](_0x1994de[_0x54c10a(0x15e)],_0x1994de[_0x54c10a(0x1c5)],_0x1994de[_0x54c10a(0x180)]),{'verbose':_0xde192a[_0x54c10a(0x153)]});return _0x5779ca[_0x54c10a(0x1c6)];}async[a36_0x2d2033(0x18c)](_0x500672,_0x5c01f1){const _0x49c16d=a36_0x2d2033,{options:_0x2ff9e3,tdx:_0x42d903}=_0x5c01f1,_0x3e05ab=_0x2ff9e3[_0x49c16d(0x1c5)],_0x292178=await resolveSegmentTarget(_0x500672,_0x3e05ab,_0x2ff9e3[_0x49c16d(0x153)]);_0x2ff9e3[_0x49c16d(0x153)]&&console[_0x49c16d(0x1c9)]('Target\x20path:\x20'+_0x292178);const _0x1a586f=await withSpinner(_0x49c16d(0x187)+_0x500672+_0x49c16d(0x189),()=>_0x42d903[_0x49c16d(0x17e)][_0x49c16d(0x1eb)](_0x292178),{'verbose':_0x2ff9e3['verbose']}),_0x33f799=_0x1a586f['data'];_0x2ff9e3['verbose']&&(console[_0x49c16d(0x1c9)](_0x49c16d(0x173)+_0x33f799[_0x49c16d(0x1a9)]),console[_0x49c16d(0x1c9)](_0x49c16d(0x1d6)+_0x33f799[_0x49c16d(0x1cf)]));if(_0x33f799[_0x49c16d(0x1a9)]===_0x49c16d(0x1f9))throw new SDKError(ErrorCode[_0x49c16d(0x170)],_0x49c16d(0x185));if(_0x33f799[_0x49c16d(0x1a9)]==='parent')throw new SDKError(ErrorCode[_0x49c16d(0x170)],_0x49c16d(0x1f1));if(!_0x33f799[_0x49c16d(0x1ad)])throw new SDKError(ErrorCode[_0x49c16d(0x1f4)],_0x49c16d(0x183));const _0x10daf2=await withSpinner(_0x49c16d(0x1c0),()=>_0x42d903[_0x49c16d(0x17e)][_0x49c16d(0x160)](_0x33f799[_0x49c16d(0x1cf)],_0x33f799[_0x49c16d(0x1ad)]),{'verbose':_0x2ff9e3[_0x49c16d(0x153)]});return _0x10daf2['data'];}}export class SegmentFolderCreateCommand extends BaseCommand{[a36_0x2d2033(0x14f)]=a36_0x2d2033(0x16f);['description']='Create\x20segment\x20folder\x20for\x20organization';async['execute'](_0x3e3f8b){const _0x59d806=a36_0x2d2033,{options:_0x5bdbf3,args:_0x533b78,tdx:_0x171071}=_0x3e3f8b,_0x3c1915=_0x5bdbf3;if(_0x533b78[_0x59d806(0x1b4)]<0x2)return console[_0x59d806(0x1c9)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console['error'](_0x59d806(0x16e)),0x1;const _0x2ffae9=_0x533b78[0x0],_0x3e8cef=_0x533b78[0x1];_0x3c1915[_0x59d806(0x153)]&&(console['error']('Site:\x20'+_0x3c1915[_0x59d806(0x1d2)]),console[_0x59d806(0x1c9)]('Parent\x20segment:\x20'+_0x2ffae9),console['error'](_0x59d806(0x167)+_0x3e8cef));let _0x3071e9;if(_0x3c1915[_0x59d806(0x19f)]){const _0x53909a=_0x3c1915[_0x59d806(0x19f)],_0x50a424=await withSpinner(_0x59d806(0x1d4)+_0x2ffae9+_0x59d806(0x189),()=>_0x171071[_0x59d806(0x17e)][_0x59d806(0x1d1)](_0x2ffae9),{'verbose':_0x3c1915[_0x59d806(0x153)]}),_0x5a55da=_0x50a424['data'],_0x4ddb06=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x53909a+'\x27...',()=>_0x171071['segment']['resolveFolderId'](_0x5a55da,_0x53909a),{'verbose':_0x3c1915['verbose']});_0x3071e9=_0x4ddb06[_0x59d806(0x1c6)],_0x3c1915[_0x59d806(0x153)]&&console['error'](_0x59d806(0x154)+_0x3071e9);}const _0x3287db={'name':_0x3e8cef,'description':_0x3c1915[_0x59d806(0x152)],'parentFolderId':_0x3071e9},_0x34772b=await withSpinner(_0x59d806(0x1b3)+_0x3e8cef+_0x59d806(0x189),()=>_0x171071['segment']['createFolder'](_0x2ffae9,_0x3287db),{'verbose':_0x3c1915['verbose']}),_0x2d6946=_0x34772b[_0x59d806(0x1c6)];return console[_0x59d806(0x1c9)](_0x59d806(0x1e2)+_0x2d6946[_0x59d806(0x14f)]+_0x59d806(0x150)+_0x2d6946['id']),await handleSDKOutput([_0x2d6946],_0x3c1915),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a36_0x2d2033(0x1e5);[a36_0x2d2033(0x152)]='Show\x20folder\x20or\x20child\x20segment\x20details';async[a36_0x2d2033(0x17d)](_0x19e639){const _0x4fb816=a36_0x2d2033,{options:_0x4a9841,args:_0x5b9ab9,tdx:_0x457430}=_0x19e639,_0x1a18d5=_0x5b9ab9[0x0];if(!_0x1a18d5)return console[_0x4fb816(0x1c9)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x4fb816(0x1c9)](_0x4fb816(0x171)),console[_0x4fb816(0x1c9)](_0x4fb816(0x1ec)),console[_0x4fb816(0x1c9)](_0x4fb816(0x186)),console['error'](_0x4fb816(0x19e)),console[_0x4fb816(0x1c9)]('Examples:'),console[_0x4fb816(0x1c9)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x4fb816(0x1c9)](_0x4fb816(0x1ba)),console[_0x4fb816(0x1c9)](_0x4fb816(0x15a)),console[_0x4fb816(0x1c9)](_0x4fb816(0x196)),0x1;try{const _0x2b2055=_0x4a9841[_0x4fb816(0x1c5)],_0x5e9d8b=await resolveSegmentTarget(_0x1a18d5,_0x2b2055,_0x4a9841[_0x4fb816(0x153)]);_0x4a9841[_0x4fb816(0x153)]&&console[_0x4fb816(0x1c9)]('Target\x20path:\x20'+_0x5e9d8b);const _0x2ea6ba=await withSpinner(_0x4fb816(0x187)+_0x1a18d5+_0x4fb816(0x189),()=>_0x457430[_0x4fb816(0x17e)][_0x4fb816(0x1eb)](_0x5e9d8b),{'verbose':_0x4a9841[_0x4fb816(0x153)]}),_0x43c320=_0x2ea6ba[_0x4fb816(0x1c6)];_0x4a9841['verbose']&&(console[_0x4fb816(0x1c9)](_0x4fb816(0x173)+_0x43c320['type']),console[_0x4fb816(0x1c9)](_0x4fb816(0x1d6)+_0x43c320[_0x4fb816(0x1cf)]),_0x43c320[_0x4fb816(0x1e8)]&&console[_0x4fb816(0x1c9)](_0x4fb816(0x1b1)+_0x43c320[_0x4fb816(0x1e8)]),_0x43c320[_0x4fb816(0x1ad)]&&console[_0x4fb816(0x1c9)](_0x4fb816(0x1a0)+_0x43c320[_0x4fb816(0x1ad)]));if(_0x4a9841[_0x4fb816(0x158)]){if(_0x43c320['type']===_0x4fb816(0x1f9))return console[_0x4fb816(0x1c9)](_0x4fb816(0x1a2)),0x1;if(_0x43c320[_0x4fb816(0x1a9)]===_0x4fb816(0x1c1))return console['error'](_0x4fb816(0x1af)),console[_0x4fb816(0x1c9)](_0x4fb816(0x1a8)),0x1;if(!_0x43c320['segmentId'])throw new SDKError(ErrorCode[_0x4fb816(0x1f4)],_0x4fb816(0x183));const _0x48ab94=getConsoleNextUrl(_0x4a9841[_0x4fb816(0x1d2)],_0x4fb816(0x1d8)+_0x43c320[_0x4fb816(0x1cf)]+_0x4fb816(0x1cb)+_0x43c320[_0x4fb816(0x1ad)]);return console[_0x4fb816(0x1c9)](a36_0x3702cc[_0x4fb816(0x15c)]('✔')+_0x4fb816(0x17f)+a36_0x3702cc['cyan'](_0x48ab94)),openBrowser(_0x48ab94),0x0;}if(_0x43c320[_0x4fb816(0x1a9)]===_0x4fb816(0x1f9)){if(!_0x43c320[_0x4fb816(0x1e8)])throw new SDKError(ErrorCode[_0x4fb816(0x1ee)],_0x4fb816(0x1d7));const _0x67409f=await withSpinner('Fetching\x20folder\x20details...',()=>_0x457430[_0x4fb816(0x17e)]['getFolder'](_0x43c320[_0x4fb816(0x1e8)]),{'verbose':_0x4a9841['verbose']});await handleSingleObjectOutput(_0x67409f[_0x4fb816(0x1c6)],_0x4a9841);}else{if(_0x43c320['type']===_0x4fb816(0x17e)){if(!_0x43c320[_0x4fb816(0x1ad)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x4fb816(0x183));const _0x297166=await withSpinner(_0x4fb816(0x1f3),()=>_0x457430['segment'][_0x4fb816(0x199)](_0x43c320[_0x4fb816(0x1cf)],_0x43c320[_0x4fb816(0x1ad)]),{'verbose':_0x4a9841['verbose']}),_0x4af0a3=getConsoleNextUrl(_0x4a9841[_0x4fb816(0x1d2)],_0x4fb816(0x1d8)+_0x43c320[_0x4fb816(0x1cf)]+_0x4fb816(0x1cb)+_0x43c320[_0x4fb816(0x1ad)]),_0x38a594=_0x297166[_0x4fb816(0x1c6)];_0x38a594[_0x4fb816(0x172)]=_0x4af0a3,await handleSingleObjectOutput(_0x38a594,_0x4a9841);}else return console[_0x4fb816(0x1c9)](_0x4fb816(0x1a3)),console[_0x4fb816(0x1c9)](_0x4fb816(0x17c)),0x1;}return 0x0;}catch(_0x5d6c6f){if(_0x5d6c6f instanceof SDKError)return console['error']('Error:\x20'+_0x5d6c6f[_0x4fb816(0x1f0)]),_0x5d6c6f[_0x4fb816(0x19b)]&&console[_0x4fb816(0x1c9)]('\x20\x20Cause:\x20'+_0x5d6c6f[_0x4fb816(0x19b)]),0x1;throw _0x5d6c6f;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a36_0x2d2033(0x14f)]=a36_0x2d2033(0x188);['description']=a36_0x2d2033(0x16b);async[a36_0x2d2033(0x17d)](_0x4e1c72){const _0x2844d6=a36_0x2d2033,{options:_0x21f2de,args:_0x4e8ccb,tdx:_0xb48179}=_0x4e1c72,_0x168ef4=_0x4e8ccb[0x0];if(!_0x168ef4)return console[_0x2844d6(0x1c9)](_0x2844d6(0x165)),console[_0x2844d6(0x1c9)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console['error'](_0x2844d6(0x16c)),console['error']('Examples:'),console['error'](_0x2844d6(0x1bc)),console[_0x2844d6(0x1c9)](_0x2844d6(0x1e0)),0x1;try{const _0x4280a4=_0x21f2de[_0x2844d6(0x1c5)],_0x7d392e=await resolveSegmentTarget(_0x168ef4,_0x4280a4,_0x21f2de[_0x2844d6(0x153)]);_0x21f2de[_0x2844d6(0x153)]&&console[_0x2844d6(0x1c9)](_0x2844d6(0x1b8)+_0x7d392e);const _0x339ea3=await withSpinner(_0x2844d6(0x187)+_0x168ef4+_0x2844d6(0x189),()=>_0xb48179[_0x2844d6(0x17e)][_0x2844d6(0x1eb)](_0x7d392e),{'verbose':_0x21f2de[_0x2844d6(0x153)]}),_0x914327=_0x339ea3['data'];_0x21f2de[_0x2844d6(0x153)]&&(console[_0x2844d6(0x1c9)](_0x2844d6(0x173)+_0x914327[_0x2844d6(0x1a9)]),console[_0x2844d6(0x1c9)]('Parent\x20ID:\x20'+_0x914327[_0x2844d6(0x1cf)]));if(_0x914327['type']===_0x2844d6(0x1f9))return console['error'](_0x2844d6(0x179)),console[_0x2844d6(0x1c9)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x914327['type']===_0x2844d6(0x1c1))return console[_0x2844d6(0x1c9)](_0x2844d6(0x1de)),console[_0x2844d6(0x1c9)](_0x2844d6(0x1e9)),0x1;if(!_0x914327[_0x2844d6(0x1ad)])throw new SDKError(ErrorCode[_0x2844d6(0x1f4)],_0x2844d6(0x183));const _0x19927a=await withSpinner(_0x2844d6(0x1c0),()=>_0xb48179[_0x2844d6(0x17e)][_0x2844d6(0x160)](_0x914327[_0x2844d6(0x1cf)],_0x914327['segmentId']),{'verbose':_0x21f2de[_0x2844d6(0x153)]}),_0x4d5fcf=_0x19927a[_0x2844d6(0x1c6)],_0x1c04c2=await executeSchemaQuery(_0x4d5fcf,_0xb48179,_0x21f2de);return await handleQueryOutput(_0x1c04c2,_0x21f2de),0x0;}catch(_0x39637d){if(_0x39637d instanceof SDKError)return console[_0x2844d6(0x1c9)](_0x2844d6(0x18f)+_0x39637d['message']),_0x39637d[_0x2844d6(0x19b)]&&console['error'](_0x2844d6(0x1bd)+_0x39637d[_0x2844d6(0x19b)]),0x1;throw _0x39637d;}}}
@@ -1 +1 @@
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
+ const a37_0x3e8272=a37_0x2199;(function(_0x9eecc0,_0x1257ee){const _0x4abd10=a37_0x2199,_0x3dfd4c=_0x9eecc0();while(!![]){try{const _0x32407b=-parseInt(_0x4abd10(0x1c9))/0x1*(parseInt(_0x4abd10(0x1d0))/0x2)+-parseInt(_0x4abd10(0x1f0))/0x3*(-parseInt(_0x4abd10(0x1cd))/0x4)+parseInt(_0x4abd10(0x1e2))/0x5+parseInt(_0x4abd10(0x1c6))/0x6+-parseInt(_0x4abd10(0x1dc))/0x7*(-parseInt(_0x4abd10(0x1c7))/0x8)+-parseInt(_0x4abd10(0x1df))/0x9+-parseInt(_0x4abd10(0x1da))/0xa;if(_0x32407b===_0x1257ee)break;else _0x3dfd4c['push'](_0x3dfd4c['shift']());}catch(_0x143e24){_0x3dfd4c['push'](_0x3dfd4c['shift']());}}}(a37_0x4ec6,0xeb711));import{BaseCommand}from'./command.js';function a37_0x2199(_0xe1706a,_0xe2e06){_0xe1706a=_0xe1706a-0x1c2;const _0x4ec603=a37_0x4ec6();let _0x2199ff=_0x4ec603[_0xe1706a];return _0x2199ff;}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_0x286eeb from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']=a37_0x3e8272(0x1e5);[a37_0x3e8272(0x1d6)]=a37_0x3e8272(0x1cc);async[a37_0x3e8272(0x1cf)](_0x26e8dd){const _0x595c9b=a37_0x3e8272;console[_0x595c9b(0x1e4)](a37_0x286eeb[_0x595c9b(0x1d4)](_0x595c9b(0x1ce))),console[_0x595c9b(0x1e4)](a37_0x286eeb[_0x595c9b(0x1d4)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x1b6625,args:_0x125604,tdx:_0x27a192}=_0x26e8dd,_0x3dab71=_0x1b6625;if(_0x125604['length']===0x0)return console['error'](_0x595c9b(0x1d7)),console[_0x595c9b(0x1e4)](_0x595c9b(0x1e7)),console['error'](_0x595c9b(0x1e0)),console[_0x595c9b(0x1e4)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console[_0x595c9b(0x1e4)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console[_0x595c9b(0x1e4)](_0x595c9b(0x1dd)),0x1;const _0x2c6946=_0x125604[0x0],_0x1c9ef8=_0x1b6625['segmentPath'];let _0x2f1e78=_0x2c6946;_0x1c9ef8&&!_0x2c6946[_0x595c9b(0x1e3)]('/')&&(_0x2f1e78=_0x1c9ef8+'/'+_0x2c6946,_0x3dab71[_0x595c9b(0x1f2)]&&console[_0x595c9b(0x1e4)](_0x595c9b(0x1c5)+_0x2f1e78));const _0x1ae56c=parsePath(_0x2f1e78);if(_0x1ae56c['segments']['length']<0x2)return console[_0x595c9b(0x1e4)](_0x595c9b(0x1c3)),console[_0x595c9b(0x1e4)](_0x595c9b(0x1ee)),0x1;const _0x43293b=_0x1ae56c[_0x595c9b(0x1d2)][0x0],_0x590e5a=getBaseName(_0x2f1e78),_0x406f2a=getParentPath(_0x2f1e78);_0x3dab71[_0x595c9b(0x1f2)]&&(console[_0x595c9b(0x1e4)](_0x595c9b(0x1ea)+_0x3dab71[_0x595c9b(0x1e6)]),console[_0x595c9b(0x1e4)]('Target\x20path:\x20'+_0x2f1e78),console[_0x595c9b(0x1e4)](_0x595c9b(0x1ed)+_0x43293b),console['error']('Segment\x20name:\x20'+_0x590e5a),console[_0x595c9b(0x1e4)]('Parent\x20path:\x20'+_0x406f2a));const _0x228cba=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x43293b+'\x27...',()=>_0x27a192[_0x595c9b(0x1f4)][_0x595c9b(0x1ec)](_0x43293b),{'verbose':_0x3dab71[_0x595c9b(0x1f2)]}),_0x543ec4=_0x228cba[_0x595c9b(0x1eb)];let _0x43742e;if(_0x1ae56c[_0x595c9b(0x1d2)][_0x595c9b(0x1d5)]>0x2){const _0x2d2bef=await withSpinner(_0x595c9b(0x1db)+_0x406f2a+_0x595c9b(0x1c2),()=>_0x27a192[_0x595c9b(0x1f4)][_0x595c9b(0x1d1)](_0x406f2a),{'verbose':_0x3dab71[_0x595c9b(0x1f2)]}),_0x4f71a3=_0x2d2bef[_0x595c9b(0x1eb)];if(_0x4f71a3['type']!==_0x595c9b(0x1f3)&&_0x4f71a3[_0x595c9b(0x1ef)]!==_0x595c9b(0x1f1))return console['error'](_0x595c9b(0x1d3)),0x1;_0x43742e=_0x4f71a3['folderId'];}else{if(_0x3dab71[_0x595c9b(0x1f3)]){const _0x541540=await withSpinner(_0x595c9b(0x1c4)+_0x3dab71[_0x595c9b(0x1f3)]+_0x595c9b(0x1c2),()=>_0x27a192[_0x595c9b(0x1f4)][_0x595c9b(0x1d8)](_0x543ec4,_0x3dab71['folder']),{'verbose':_0x3dab71[_0x595c9b(0x1f2)]});_0x43742e=_0x541540[_0x595c9b(0x1eb)];}}_0x3dab71['verbose']&&_0x43742e&&console[_0x595c9b(0x1e4)]('Resolved\x20folder\x20ID:\x20'+_0x43742e);const _0x261600=await loadJSONFromOptions(_0x3dab71[_0x595c9b(0x1ca)],_0x3dab71['ruleFile']),_0x279103={'name':_0x590e5a,'description':_0x3dab71[_0x595c9b(0x1d6)],'rule':_0x261600,'kind':_0x3dab71['kind']!==undefined?parseInt(_0x3dab71[_0x595c9b(0x1c8)],0xa):undefined,'isVisible':_0x3dab71[_0x595c9b(0x1d9)]?![]:undefined,'segmentFolderId':_0x43742e,'countPopulation':_0x3dab71['noCountPopulation']?![]:undefined},_0x29fb36=await withSpinner(_0x595c9b(0x1de)+_0x590e5a+_0x595c9b(0x1c2),()=>_0x27a192[_0x595c9b(0x1f4)]['createSegment'](_0x543ec4,_0x279103),{'verbose':_0x3dab71[_0x595c9b(0x1f2)]}),_0x56dc1f=_0x29fb36['data'];return console[_0x595c9b(0x1e4)](_0x595c9b(0x1cb)+_0x56dc1f[_0x595c9b(0x1e8)]+_0x595c9b(0x1e1)+_0x56dc1f['id']),_0x2f1e78!==_0x2c6946&&console[_0x595c9b(0x1e4)](_0x595c9b(0x1e9)+_0x2f1e78),await handleSDKOutput([_0x56dc1f],_0x3dab71),0x0;}}function a37_0x4ec6(){const _0x3c8f60=['Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','name','\x20\x20\x20Path:\x20','Site:\x20','data','resolveParentId','Parent:\x20','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','type','789846lTWPFU','parent','verbose','folder','segment','\x27...','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','Resolving\x20folder\x20\x27','Resolved\x20relative\x20path\x20to:\x20','5760690VWXtkx','15160oMPoTQ','kind','3535jxWXbO','rule','✔\x20Created\x20segment\x20\x27','Create\x20child\x20segment\x20with\x20filtering\x20rules','28mBgOdD','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','execute','1052IVdyBq','resolvePathToResource','segments','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','yellow','length','description','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','resolveFolderId','invisible','4836400EKytYq','Resolving\x20folder\x20path\x20\x27','84PXLgfp','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Creating\x20segment\x20\x27','1771893UQGbhc','Examples:','\x27\x20with\x20ID:\x20','3392335xEDwuV','includes','error','segment:create','site'];a37_0x4ec6=function(){return _0x3c8f60;};return a37_0x4ec6();}
@@ -1 +1 @@
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
+ const a38_0x249f12=a38_0x2e5b;(function(_0xf99845,_0x40f50a){const _0x731fda=a38_0x2e5b,_0x35ed1b=_0xf99845();while(!![]){try{const _0x1b8fbf=parseInt(_0x731fda(0x73))/0x1*(parseInt(_0x731fda(0x6d))/0x2)+parseInt(_0x731fda(0x6e))/0x3+-parseInt(_0x731fda(0x6b))/0x4+parseInt(_0x731fda(0x69))/0x5+-parseInt(_0x731fda(0x79))/0x6+parseInt(_0x731fda(0x65))/0x7+parseInt(_0x731fda(0x7c))/0x8*(-parseInt(_0x731fda(0x67))/0x9);if(_0x1b8fbf===_0x40f50a)break;else _0x35ed1b['push'](_0x35ed1b['shift']());}catch(_0x12bdd2){_0x35ed1b['push'](_0x35ed1b['shift']());}}}(a38_0x3762,0x2c2e1));function a38_0x3762(){const _0x38b792=['site','jsonl','\x27...','308023TktZHw','Parent\x20segment:\x20','List\x20available\x20fields\x20for\x20segmentation','verbose','error','execute','1510218fmGSKL','length','description','118280eDETHL','name','1737631PgHCcl','\x20field','63XAuUjX','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','1490990clOAOD','Listing\x20fields\x20for\x20\x27','1330252rpECkp','json','2YXbYwn','42804HNScfw','Error:\x20Parent\x20segment\x20name\x20is\x20required'];a38_0x3762=function(){return _0x38b792;};return a38_0x3762();}function a38_0x2e5b(_0x59d792,_0x3707a9){_0x59d792=_0x59d792-0x65;const _0x3762d4=a38_0x3762();let _0x2e5b35=_0x3762d4[_0x59d792];return _0x2e5b35;}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a38_0x249f12(0x7d)]='segment:fields';[a38_0x249f12(0x7b)]=a38_0x249f12(0x75);async[a38_0x249f12(0x78)](_0x9d0030){const _0x521aae=a38_0x249f12,{options:_0x599b6f,args:_0xb119e9,tdx:_0x292227}=_0x9d0030,_0x34e7d8=_0xb119e9[0x0]||_0x599b6f['parentSegment'];if(!_0x34e7d8)return console[_0x521aae(0x77)](_0x521aae(0x6f)),console[_0x521aae(0x77)]('Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'),console[_0x521aae(0x77)](_0x521aae(0x68)),0x1;_0x599b6f[_0x521aae(0x76)]&&(console['error']('Site:\x20'+_0x599b6f[_0x521aae(0x70)]),console[_0x521aae(0x77)](_0x521aae(0x74)+_0x34e7d8));const _0x3ce96a=await withSpinner(_0x521aae(0x6a)+_0x34e7d8+_0x521aae(0x72),()=>_0x292227['segment']['listFields'](_0x34e7d8),{'verbose':_0x599b6f[_0x521aae(0x76)]}),_0x52b705=_0x3ce96a['data'];console['error']('✔\x20Found\x20'+_0x52b705[_0x521aae(0x7a)]+_0x521aae(0x66)+(_0x52b705[_0x521aae(0x7a)]!==0x1?'s':''));if(_0x599b6f[_0x521aae(0x6c)]||_0x599b6f[_0x521aae(0x71)])return await handleSDKOutput(_0x52b705,_0x599b6f),0x0;return displayFieldsHumanReadable(_0x52b705,_0x34e7d8),0x0;}}
@@ -1 +1 @@
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;}}
1
+ const a39_0x40e803=a39_0x2014;(function(_0x5f14f4,_0x295f8b){const _0x2d4997=a39_0x2014,_0x289efb=_0x5f14f4();while(!![]){try{const _0x2bdd16=parseInt(_0x2d4997(0x209))/0x1+parseInt(_0x2d4997(0x1f2))/0x2*(parseInt(_0x2d4997(0x212))/0x3)+parseInt(_0x2d4997(0x1f1))/0x4*(parseInt(_0x2d4997(0x1ef))/0x5)+-parseInt(_0x2d4997(0x203))/0x6+parseInt(_0x2d4997(0x204))/0x7*(parseInt(_0x2d4997(0x238))/0x8)+parseInt(_0x2d4997(0x228))/0x9*(-parseInt(_0x2d4997(0x23a))/0xa)+parseInt(_0x2d4997(0x21c))/0xb;if(_0x2bdd16===_0x295f8b)break;else _0x289efb['push'](_0x289efb['shift']());}catch(_0x13d534){_0x289efb['push'](_0x289efb['shift']());}}}(a39_0xe71e,0x4d784));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';function a39_0x2014(_0x50055a,_0x3f72c8){_0x50055a=_0x50055a-0x1ed;const _0xe71eb3=a39_0xe71e();let _0x2014a3=_0xe71eb3[_0x50055a];return _0x2014a3;}import a39_0x4af337 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a39_0x337ca3 from'path';function a39_0xe71e(){const _0x576b84=['Error:\x20','error','Target\x20resource:\x20','activations','green','pullSegments','journeyVersions','segment:pull','no_parent','dim','\x20=\x20','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x20versions)','2915274ClpxLU','74662jGSJZv','filter','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)','\x20\x20Target:\x20','files','422984JQtakF','segments','parentName','length','hasChanges','dryRun','Site:\x20','-\x20no\x20files\x20written','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','71181iQIOCn','file','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','\x20with\x20','✔\x20Pulled\x20','yes','counts','absolutePath','repeat','verbose','3800753XpRHEC','Pulling\x20segments\x20from\x20\x27','cyan','\x27...','\x20journeys','dirname','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','errorCode','\x20segments','yellow','segment','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','2275380SVGYbS','\x0aChanges\x20to\x20\x27','\x20files\x20to\x20','parent_segment','\x20\x20🗺️\x20\x20','\x20activations','utf-8','Write\x20','Parent\x20segment:\x20','message','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','✔\x20All\x20files\x20are\x20up\x20to\x20date','✔\x20Context\x20set:\x20','isNew','targetDir','type','104EEscqx','\x0aError:','10LCjoxJ','cwd','content','helpText','name','5DdVVWE','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','405584MuRupH','4OnJwqk','execute','journeys','red'];a39_0xe71e=function(){return _0x576b84;};return a39_0xe71e();}import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';export class SegmentPullCommand extends BaseCommand{[a39_0x40e803(0x1ee)]=a39_0x40e803(0x1fd);['description']=a39_0x40e803(0x211);async[a39_0x40e803(0x1f3)](_0x9ed482){const _0x49c00c=a39_0x40e803,{options:_0x3f2004,args:_0x21e983,tdx:_0x2a1ca1}=_0x9ed482,_0x36afdb=_0x3f2004,_0x4c9bb1=await resolveTarget({'arg':_0x21e983[0x0],'contextParent':_0x3f2004['parentSegment'],'cwd':process[_0x49c00c(0x23b)]()});if(!isSuccessfulResolution(_0x4c9bb1))return _0x4c9bb1[_0x49c00c(0x223)]===_0x49c00c(0x1fe)?(console[_0x49c00c(0x1f7)](a39_0x4af337[_0x49c00c(0x225)](_0x49c00c(0x232))),console[_0x49c00c(0x1f7)](_0x49c00c(0x206)),console['error'](_0x49c00c(0x222)),console[_0x49c00c(0x1f7)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file')):(console['error'](a39_0x4af337['red'](_0x49c00c(0x1f6)+_0x4c9bb1[_0x49c00c(0x231)]+'\x0a')),_0x4c9bb1[_0x49c00c(0x1ed)]&&console[_0x49c00c(0x1f7)](a39_0x4af337['cyan'](_0x4c9bb1[_0x49c00c(0x1ed)]))),0x1;const _0x27bdb0=_0x4c9bb1[_0x49c00c(0x20b)],_0x375945=_0x4c9bb1['targetDir'],_0x129a16=_0x4c9bb1[_0x49c00c(0x237)]===_0x49c00c(0x213)?_0x4c9bb1['resourceName']:undefined;_0x36afdb[_0x49c00c(0x21b)]&&(console['error'](_0x49c00c(0x20f)+_0x36afdb['site']),console['error'](_0x49c00c(0x230)+_0x27bdb0),_0x129a16&&console['error'](_0x49c00c(0x1f8)+_0x129a16));const _0x315c69=await withProgressSpinner(_0x49c00c(0x21d)+_0x27bdb0+_0x49c00c(0x21f),_0xb77273=>_0x2a1ca1[_0x49c00c(0x226)][_0x49c00c(0x1fb)](_0x27bdb0,{'targetDir':_0x375945,'targetResourceName':_0x129a16,'verbose':_0x36afdb[_0x49c00c(0x21b)],'progress':{'update':_0x23ea9d=>{_0xb77273['setPhase'](_0x23ea9d),_0x36afdb['verbose']&&console['error']('\x20\x20'+_0x23ea9d);}}}),{'verbose':_0x36afdb[_0x49c00c(0x21b)]}),_0x2a8d53=_0x315c69['data'];if(_0x2a8d53['counts'][_0x49c00c(0x20a)]===0x0&&_0x2a8d53[_0x49c00c(0x218)][_0x49c00c(0x1f4)]===0x0)return console['error'](a39_0x4af337[_0x49c00c(0x225)](_0x49c00c(0x227)+_0x2a8d53[_0x49c00c(0x20b)]+'\x27')),0x0;const _0x271699=_0x2a8d53[_0x49c00c(0x208)][_0x49c00c(0x205)](_0x40c5fd=>_0x40c5fd[_0x49c00c(0x235)]),_0x4b9f08=_0x2a8d53['files'][_0x49c00c(0x205)](_0x1104a7=>!_0x1104a7[_0x49c00c(0x235)]&&_0x1104a7[_0x49c00c(0x20d)]),_0x438d16=_0x2a8d53['files'][_0x49c00c(0x205)](_0x4a7368=>!_0x4a7368[_0x49c00c(0x235)]&&!_0x4a7368[_0x49c00c(0x20d)]);console[_0x49c00c(0x1f7)]('\x0aPull\x20summary\x20for\x20\x27'+_0x2a8d53[_0x49c00c(0x20b)]+'\x27:'),console[_0x49c00c(0x1f7)]('\x20\x20🎯\x20'+a39_0x4af337[_0x49c00c(0x21e)](_0x2a8d53['counts'][_0x49c00c(0x20a)]+_0x49c00c(0x224))+_0x49c00c(0x215)+a39_0x4af337[_0x49c00c(0x21e)](_0x2a8d53['counts'][_0x49c00c(0x1f9)]+_0x49c00c(0x22d)));if(_0x2a8d53[_0x49c00c(0x218)]['journeys']>0x0){const _0x248e01=_0x2a8d53[_0x49c00c(0x218)][_0x49c00c(0x1fc)]>_0x2a8d53['counts']['journeys']?'\x20('+_0x2a8d53[_0x49c00c(0x218)][_0x49c00c(0x1fc)]+_0x49c00c(0x202):'';console[_0x49c00c(0x1f7)](_0x49c00c(0x22c)+a39_0x4af337['cyan'](_0x2a8d53[_0x49c00c(0x218)]['journeys']+_0x49c00c(0x220))+a39_0x4af337[_0x49c00c(0x1ff)](_0x248e01));}console[_0x49c00c(0x1f7)]('\x20\x20'+a39_0x4af337[_0x49c00c(0x1fa)]('+\x20'+_0x271699[_0x49c00c(0x20c)]+'\x20new\x20files')),console[_0x49c00c(0x1f7)]('\x20\x20'+a39_0x4af337[_0x49c00c(0x225)]('~\x20'+_0x4b9f08[_0x49c00c(0x20c)]+'\x20changed\x20files')),console[_0x49c00c(0x1f7)]('\x20\x20'+a39_0x4af337['dim']('=\x20'+_0x438d16[_0x49c00c(0x20c)]+'\x20unchanged\x20files')),console[_0x49c00c(0x1f7)](_0x49c00c(0x207)+a39_0x4af337[_0x49c00c(0x21e)](_0x2a8d53[_0x49c00c(0x236)])+'\x0a');if(_0x4b9f08[_0x49c00c(0x20c)]>0x0)for(const _0x440b78 of _0x4b9f08){console[_0x49c00c(0x1f7)](_0x49c00c(0x229)+_0x440b78['relativePath']+'\x27:'),console['error']('─'[_0x49c00c(0x21a)](0x3c)),console[_0x49c00c(0x1f7)](_0x440b78['diff']),console[_0x49c00c(0x1f7)]('─'['repeat'](0x3c));}if(_0x36afdb[_0x49c00c(0x20e)])return console[_0x49c00c(0x1f7)](a39_0x4af337[_0x49c00c(0x225)](_0x49c00c(0x214))),0x0;if(_0x271699[_0x49c00c(0x20c)]===0x0&&_0x4b9f08[_0x49c00c(0x20c)]===0x0)return console['error'](a39_0x4af337[_0x49c00c(0x1fa)](_0x49c00c(0x233))),saveSessionContext({'parent_segment':_0x2a8d53[_0x49c00c(0x20b)]},_0x36afdb['session']),console[_0x49c00c(0x1f7)](a39_0x4af337[_0x49c00c(0x1fa)](_0x49c00c(0x234)+a39_0x4af337[_0x49c00c(0x1ff)](_0x49c00c(0x22b))+_0x49c00c(0x200)+a39_0x4af337[_0x49c00c(0x21e)](_0x2a8d53[_0x49c00c(0x20b)]))),0x0;if(!_0x36afdb[_0x49c00c(0x217)]){if(!isInteractive())return console[_0x49c00c(0x1f7)](a39_0x4af337[_0x49c00c(0x1f5)](_0x49c00c(0x239)),_0x49c00c(0x1f0)),console[_0x49c00c(0x1f7)](a39_0x4af337[_0x49c00c(0x1ff)](_0x49c00c(0x201))),0x1;const _0x1f465b=await confirmKey(_0x49c00c(0x22f)+(_0x271699[_0x49c00c(0x20c)]+_0x4b9f08[_0x49c00c(0x20c)])+'\x20files?');if(!_0x1f465b)return console[_0x49c00c(0x1f7)](a39_0x4af337[_0x49c00c(0x225)]('Aborted.'),_0x49c00c(0x210)),0x1;}for(const _0x380253 of _0x2a8d53['files']){if(_0x380253[_0x49c00c(0x235)]||_0x380253['hasChanges']){const _0x543d11=a39_0x337ca3[_0x49c00c(0x221)](_0x380253[_0x49c00c(0x219)]);!existsSync(_0x543d11)&&mkdirSync(_0x543d11,{'recursive':!![]}),writeFileSync(_0x380253[_0x49c00c(0x219)],_0x380253[_0x49c00c(0x23c)],_0x49c00c(0x22e));}}return console[_0x49c00c(0x1f7)](a39_0x4af337[_0x49c00c(0x1fa)](_0x49c00c(0x216)+(_0x271699[_0x49c00c(0x20c)]+_0x4b9f08['length'])+_0x49c00c(0x22a)+_0x2a8d53[_0x49c00c(0x236)])),saveSessionContext({'parent_segment':_0x2a8d53[_0x49c00c(0x20b)]},_0x36afdb['session']),console[_0x49c00c(0x1f7)](a39_0x4af337[_0x49c00c(0x1fa)]('✔\x20Context\x20set:\x20'+a39_0x4af337[_0x49c00c(0x1ff)](_0x49c00c(0x22b))+_0x49c00c(0x200)+a39_0x4af337[_0x49c00c(0x21e)](_0x2a8d53[_0x49c00c(0x20b)]))),0x0;}}