@treasuredata/tdx 2026.3.22 → 2026.3.24

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_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
+ const a34_0x40636f=a34_0x807e;function a34_0x4aa5(){const _0x50dd98=['message','Site:\x20','validate','Statement\x20','originalMessage','550950eTzyDI','args','output','33JzNmgG','\x0aAll\x20results\x20saved\x20to\x20','194466gHFzVI','length','SQL:\x20','Run\x20Trino\x20queries\x20(streaming)','name','2959782euuEFN','45koTbkJ','24dChgXU','Query\x20completed:\x20Processed\x20','\x20rows\x20','337168lIaIBh','setExtra','Executing\x20query...','query','options','catalog','join','Error:\x20','data','setJobId','setPhase','error','verbose','stats','622270vGHWOl','530324qvepEZ','execute','in\x20','2392836sCUZuM','jobId','processedRows','database','completedSplits','...','elapsedTimeMillis','\x20splits','description','Executing\x20statement\x20','Executing\x20query\x20[','site','Catalog:\x20','8mOfZYx','file','state','21hIYkGU'];a34_0x4aa5=function(){return _0x50dd98;};return a34_0x4aa5();}(function(_0x4cd091,_0x242c14){const _0x2a7225=a34_0x807e,_0x2b907f=_0x4cd091();while(!![]){try{const _0x1ddec4=parseInt(_0x2a7225(0x172))/0x1+-parseInt(_0x2a7225(0x159))/0x2*(parseInt(_0x2a7225(0x185))/0x3)+parseInt(_0x2a7225(0x163))/0x4+-parseInt(_0x2a7225(0x171))/0x5*(-parseInt(_0x2a7225(0x160))/0x6)+-parseInt(_0x2a7225(0x15e))/0x7*(-parseInt(_0x2a7225(0x182))/0x8)+-parseInt(_0x2a7225(0x15f))/0x9*(-parseInt(_0x2a7225(0x154))/0xa)+parseInt(_0x2a7225(0x157))/0xb*(-parseInt(_0x2a7225(0x175))/0xc);if(_0x1ddec4===_0x242c14)break;else _0x2b907f['push'](_0x2b907f['shift']());}catch(_0x4af349){_0x2b907f['push'](_0x2b907f['shift']());}}}(a34_0x4aa5,0x81db5));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a34_0x807e(_0x45b956,_0xa57743){_0x45b956=_0x45b956-0x14f;const _0x4aa5b1=a34_0x4aa5();let _0x807e7d=_0x4aa5b1[_0x45b956];return _0x807e7d;}import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a34_0x40636f(0x15d)]=a34_0x40636f(0x166);[a34_0x40636f(0x17d)]=a34_0x40636f(0x15c);async[a34_0x40636f(0x173)](_0x273114){const _0x301406=a34_0x40636f,{options:_0x4f4591,args:_0x18e6e6,tdx:_0x57d6a7}=_0x273114,_0x3f2ddb={..._0x4f4591,'limitStructuredFormats':!![]},_0x56dc12=_0x18e6e6[0x0],_0x2595fe=_0x4f4591[_0x301406(0x183)];let _0x369db8;try{if(_0x2595fe)_0x369db8=readSqlStatementsFromFile(_0x2595fe);else{if(_0x56dc12==='-')_0x369db8=await readSqlStatementsFromStdin();else{if(_0x56dc12&&isSqlFilePath(_0x56dc12))_0x369db8=readSqlStatementsFromFile(_0x56dc12);else{if(_0x56dc12)_0x369db8=splitSqlStatements(_0x56dc12);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x3e21a5){return console[_0x301406(0x16e)](_0x301406(0x16a)+_0x3e21a5[_0x301406(0x14f)]),0x1;}const _0x42a06d=_0x4f4591[_0x301406(0x178)]||'information_schema',_0x105bd9=_0x4f4591[_0x301406(0x168)];try{const _0x4c2c3b=[],_0x35ac77=!!_0x4f4591['output'];for(let _0x49e6a3=0x0;_0x49e6a3<_0x369db8[_0x301406(0x15a)];_0x49e6a3++){const _0x212cde=_0x369db8[_0x49e6a3],_0x26a8aa=_0x49e6a3+0x1,_0x57fb24=_0x369db8[_0x301406(0x15a)],_0x19984e=_0x57fb24>0x1;_0x4f4591[_0x301406(0x16f)]&&(console[_0x301406(0x16e)]('\x0a'+(_0x19984e?_0x301406(0x152)+_0x26a8aa+'/'+_0x57fb24+':':'')),console[_0x301406(0x16e)](_0x301406(0x150)+_0x4f4591[_0x301406(0x180)]),console[_0x301406(0x16e)](_0x301406(0x181)+(_0x105bd9||'td')),console[_0x301406(0x16e)]('Schema:\x20'+_0x42a06d),console[_0x301406(0x16e)](_0x301406(0x15b)+_0x212cde));const _0x37f56b=_0x19984e?_0x301406(0x17e)+_0x26a8aa+'/'+_0x57fb24+_0x301406(0x17a):_0x301406(0x165);try{const _0x27b80c=await withProgressSpinner(_0x37f56b,async _0x158db3=>{const _0x344b70=_0x301406,_0x33acd2=await _0x57d6a7[_0x344b70(0x166)][_0x344b70(0x173)](_0x212cde,{'catalog':_0x105bd9,'schema':_0x42a06d,'onJobId':_0x2f7306=>{const _0x5e45df=_0x344b70;_0x158db3[_0x5e45df(0x16c)](_0x2f7306);},'onProgress':_0x56d4bd=>{const _0x744512=_0x344b70;_0x158db3[_0x744512(0x16d)](_0x744512(0x17f)+_0x56d4bd[_0x744512(0x184)]+']'),_0x158db3[_0x744512(0x164)](formatRows(_0x56d4bd[_0x744512(0x177)])+_0x744512(0x162)+_0x56d4bd[_0x744512(0x179)]+'/'+_0x56d4bd['totalSplits']+_0x744512(0x17c));}});return _0x33acd2;},{'verbose':_0x4f4591[_0x301406(0x16f)]}),_0x3e9f71=_0x27b80c[_0x301406(0x16b)],_0x31523e=_0x3e9f71[_0x301406(0x176)]?'\x20[Job\x20ID:\x20'+_0x3e9f71[_0x301406(0x176)]+']':'',_0x585d07=_0x19984e?_0x301406(0x152)+_0x26a8aa+'/'+_0x57fb24+'\x20-\x20':'';console['error']('✔\x20'+_0x585d07+_0x301406(0x161)+formatRows(_0x3e9f71[_0x301406(0x170)][_0x301406(0x177)])+_0x301406(0x162)+(_0x301406(0x174)+formatElapsed(_0x3e9f71[_0x301406(0x170)][_0x301406(0x17b)])+_0x31523e));if(_0x19984e&&_0x35ac77){const _0x5ca596=resolveOutputOptions(_0x3f2ddb),_0xe41807=await formatQueryOutput(_0x3e9f71,_0x5ca596);_0x4c2c3b['push'](_0xe41807);}else await handleQueryOutput(_0x3e9f71,_0x3f2ddb);}catch(_0x625893){const _0x26271d=_0x19984e?_0x301406(0x152)+_0x26a8aa+'/'+_0x57fb24+':\x0a':'',_0x39da16=_0x625893 instanceof SDKError?_0x625893[_0x301406(0x153)]:_0x625893[_0x301406(0x14f)];return console[_0x301406(0x16e)](''+_0x26271d+_0x39da16),0x1;}}if(_0x369db8[_0x301406(0x15a)]>0x1&&_0x35ac77&&_0x4c2c3b['length']>0x0){const _0x706ec3=_0x4c2c3b[_0x301406(0x169)]('\x0a');writeFileSync(_0x4f4591[_0x301406(0x156)],_0x706ec3),console[_0x301406(0x16e)](_0x301406(0x158)+_0x4f4591[_0x301406(0x156)]);}return 0x0;}catch(_0x5ebd1b){throw _0x5ebd1b;}}[a34_0x40636f(0x151)](_0x85bfda){const _0x267e73=a34_0x40636f,_0x32b210=_0x85bfda[_0x267e73(0x155)][0x0],_0x343c2d=_0x85bfda[_0x267e73(0x167)][_0x267e73(0x183)];if(!_0x32b210&&!_0x343c2d)return'Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options';if(_0x32b210&&_0x343c2d)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}
@@ -1 +1 @@
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
+ const a35_0x4efa20=a35_0x56cd;function a35_0x56cd(_0x54277b,_0xf2cc6d){_0x54277b=_0x54277b-0x172;const _0x444515=a35_0x4445();let _0x56cd8f=_0x444515[_0x54277b];return _0x56cd8f;}(function(_0xb51962,_0x228e74){const _0x4a68ab=a35_0x56cd,_0x5b4e10=_0xb51962();while(!![]){try{const _0x1896ae=parseInt(_0x4a68ab(0x1b7))/0x1+-parseInt(_0x4a68ab(0x1ee))/0x2*(parseInt(_0x4a68ab(0x1cd))/0x3)+-parseInt(_0x4a68ab(0x1cb))/0x4*(-parseInt(_0x4a68ab(0x1ff))/0x5)+parseInt(_0x4a68ab(0x1e8))/0x6+-parseInt(_0x4a68ab(0x1df))/0x7*(-parseInt(_0x4a68ab(0x1c2))/0x8)+parseInt(_0x4a68ab(0x1f2))/0x9*(parseInt(_0x4a68ab(0x1a3))/0xa)+-parseInt(_0x4a68ab(0x17f))/0xb;if(_0x1896ae===_0x228e74)break;else _0x5b4e10['push'](_0x5b4e10['shift']());}catch(_0x8408e4){_0x5b4e10['push'](_0x5b4e10['shift']());}}}(a35_0x4445,0x45319));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a35_0x3b79a2 from'chalk';function formatRelativeTime(_0x53f358){const _0x375b8b=a35_0x56cd,_0x39e51a=new Date(_0x53f358),_0x3327f0=new Date(),_0x19665b=_0x39e51a[_0x375b8b(0x19f)]()-_0x3327f0[_0x375b8b(0x19f)](),_0x1cafba=Math[_0x375b8b(0x189)](_0x19665b)/0x3e8,_0x113cce=_0x19665b<0x0;if(_0x1cafba<0x3c)return _0x113cce?_0x375b8b(0x1b5):'soon';else{if(_0x1cafba<0xe10){const _0x399b2c=Math[_0x375b8b(0x1ad)](_0x1cafba/0x3c);return _0x113cce?_0x399b2c+_0x375b8b(0x186):_0x375b8b(0x197)+_0x399b2c+'m';}else{if(_0x1cafba<0x15180){const _0x177993=Math[_0x375b8b(0x1ad)](_0x1cafba/0xe10);return _0x113cce?_0x177993+_0x375b8b(0x172):_0x375b8b(0x197)+_0x177993+'h';}else{if(_0x1cafba<0x93a80){const _0x4e600e=Math[_0x375b8b(0x1ad)](_0x1cafba/0x15180);return _0x113cce?_0x4e600e+_0x375b8b(0x1d9):'in\x20'+_0x4e600e+'d';}else return _0x39e51a[_0x375b8b(0x1af)]();}}}}export class ScheduleListCommand extends BaseCommand{[a35_0x4efa20(0x1e5)]=a35_0x4efa20(0x1ea);[a35_0x4efa20(0x19e)]=a35_0x4efa20(0x1c5);async[a35_0x4efa20(0x1a1)](_0x12e741){const _0x3fc305=a35_0x4efa20,{options:_0x5bce8c,args:_0x2e0250,tdx:_0x73c448}=_0x12e741,_0x4a5471=resolveLimit(_0x5bce8c[_0x3fc305(0x176)],DEFAULT_DISPLAY_LIMIT),_0x537a24=_0x2e0250[0x0],_0x15694a=_0x537a24?'Searching\x20scheduled\x20queries\x20matching\x20\x22'+_0x537a24+_0x3fc305(0x1a7):'Listing\x20scheduled\x20queries...',_0x4215d5=await withSpinner(_0x15694a,()=>_0x73c448['schedules'][_0x3fc305(0x1f4)]({'limit':_0x4a5471,'scheduled':!![],'pattern':_0x537a24}),{'verbose':_0x5bce8c['verbose']}),_0x56d2bc=_0x4215d5[_0x3fc305(0x1c3)][_0x3fc305(0x1f7)],_0x47752f=_0x4215d5[_0x3fc305(0x1c3)][_0x3fc305(0x1ac)][_0x3fc305(0x198)],_0x1dad72=_0x537a24?'\x20matching\x20\x22'+_0x537a24+'\x22':'';_0x47752f?console[_0x3fc305(0x201)](_0x3fc305(0x179)+_0x56d2bc[_0x3fc305(0x1d6)]+'\x20schedules'+_0x1dad72+_0x3fc305(0x1c4)):console[_0x3fc305(0x201)](_0x3fc305(0x1f8)+_0x56d2bc[_0x3fc305(0x1d6)]+'\x20scheduled\x20quer'+(_0x56d2bc[_0x3fc305(0x1d6)]!==0x1?'ies':'y')+_0x1dad72);if(_0x5bce8c[_0x3fc305(0x18b)]===_0x3fc305(0x1b6)||_0x5bce8c[_0x3fc305(0x18b)]===_0x3fc305(0x1be)||_0x5bce8c[_0x3fc305(0x18b)]==='table'||_0x5bce8c[_0x3fc305(0x18b)]===_0x3fc305(0x1e6)){const _0x5af965=_0x56d2bc[_0x3fc305(0x1aa)](_0x5d9301=>({'id':_0x5d9301['id'],'name':_0x5d9301['name'],'cron':_0x5d9301['cron'],'database':_0x5d9301[_0x3fc305(0x1b1)]?.['name'],'type':_0x5d9301['type'],'timezone':_0x5d9301[_0x3fc305(0x18c)],'user_name':_0x5d9301['user']?.['name'],'updated_at':_0x5d9301[_0x3fc305(0x1fc)],'next_run_at':_0x5d9301[_0x3fc305(0x1ca)],'last_job_status':_0x5d9301[_0x3fc305(0x1c1)]?.[_0x3fc305(0x174)]}));await handleSDKOutput(_0x5af965,_0x5bce8c);}else{if(_0x56d2bc[_0x3fc305(0x1d6)]===0x0)console['log'](_0x3fc305(0x1bb));else{const _0x42f89d=_0x5bce8c[_0x3fc305(0x1a2)],_0x665376=_0x56d2bc[_0x3fc305(0x1aa)](_0x210e54=>{const _0x3e325a=_0x3fc305,_0x3e3f4c=_0x210e54[_0x3e325a(0x1c1)]?.[_0x3e325a(0x174)]?_0x210e54[_0x3e325a(0x1c1)]['status']===_0x3e325a(0x17c)?'✓':'✗':'-',_0x1b47a4=_0x210e54[_0x3e325a(0x1c1)]?.['ended_at']?formatRelativeTime(_0x210e54[_0x3e325a(0x1c1)]['ended_at']):'never',_0x35f4c2=_0x210e54[_0x3e325a(0x1ca)]?formatRelativeTime(_0x210e54[_0x3e325a(0x1ca)]):'-',_0x3491fe=_0x210e54[_0x3e325a(0x1b3)]||'',_0x5d47ea=_0x210e54[_0x3e325a(0x1e5)]||'(unnamed)',_0x2ef654=getConsoleUrl(_0x42f89d,_0x3e325a(0x1a5)+_0x210e54['id']);return{'statusIcon':_0x3e3f4c,'lastRun':_0x1b47a4,'nextRun':_0x35f4c2,'cron':_0x3491fe,'name':_0x5d47ea,'queryUrl':_0x2ef654,'status':_0x210e54[_0x3e325a(0x1c1)]?.[_0x3e325a(0x174)]};}),_0x11ccbb=Math[_0x3fc305(0x1da)](..._0x665376[_0x3fc305(0x1aa)](_0x4c54d1=>_0x4c54d1[_0x3fc305(0x19b)][_0x3fc305(0x1d6)])),_0x163731=Math['max'](..._0x665376[_0x3fc305(0x1aa)](_0x1d14e8=>_0x1d14e8[_0x3fc305(0x181)][_0x3fc305(0x1d6)])),_0x16cbe7=Math[_0x3fc305(0x1da)](..._0x665376[_0x3fc305(0x1aa)](_0x5dd1c3=>_0x5dd1c3[_0x3fc305(0x1b3)][_0x3fc305(0x1d6)])),_0x53ebb3=_0x665376[_0x3fc305(0x1aa)](_0x5dcfeb=>{const _0x4b020d=_0x3fc305,_0xa85ae6=_0x5dcfeb[_0x4b020d(0x174)]===_0x4b020d(0x17c)?a35_0x3b79a2[_0x4b020d(0x1d2)](_0x5dcfeb['statusIcon']):_0x5dcfeb['status']===_0x4b020d(0x201)?a35_0x3b79a2['red'](_0x5dcfeb[_0x4b020d(0x1f9)]):a35_0x3b79a2[_0x4b020d(0x18a)](_0x5dcfeb[_0x4b020d(0x1f9)]),_0x24eae7=_0x5dcfeb[_0x4b020d(0x19b)][_0x4b020d(0x1ec)](_0x11ccbb),_0x618cbf=_0x5dcfeb[_0x4b020d(0x181)][_0x4b020d(0x1ec)](_0x163731),_0x2ae65f=_0x5dcfeb[_0x4b020d(0x1b3)]?a35_0x3b79a2['cyan'](_0x5dcfeb[_0x4b020d(0x1b3)][_0x4b020d(0x1ec)](_0x16cbe7)):'\x20'[_0x4b020d(0x1ae)](_0x16cbe7),_0x3f5cb0=hyperlink(_0x5dcfeb['name'],_0x5dcfeb[_0x4b020d(0x1c8)]);return _0x4b020d(0x1de)+_0xa85ae6+'\x20'+_0x24eae7+_0x4b020d(0x1e7)+_0x618cbf+'\x20\x20'+_0x2ae65f+'\x20\x20'+_0x3f5cb0;});await writeOutput(_0x53ebb3['join']('\x0a'),_0x5bce8c[_0x3fc305(0x1b4)],_0x3fc305(0x1bc));}}return 0x0;}}function a35_0x4445(){const _0x149f3a=['Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','\x20(showing\x20','Showing\x20first\x20','job_id','file','success','history','Show\x20schedule\x20details','8055509mkEjdl','delay','nextRun','time','\x20\x20Time:\x20','Schedule\x20deleted:\x20','Show\x20schedule\x20execution\x20history','m\x20ago','create','schedule:create','abs','dim','format','time_zone','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','result','yes','schedule:run','timezone','type','args','jobs','\x20created','delete','in\x20','has_next_page','user_name','schedule:update','lastRun','validate','executing_user_id','description','getTime','Schedule\x20updated:\x20','execute','site','440wxuvoL','priority','/app/queries/editor?queryId=','Failed\x20to\x20read\x20file:\x20','\x22...','schedules','Getting\x20schedule\x20history...','map','Run\x20a\x20scheduled\x20query\x20immediately','pagination','round','repeat','toLocaleDateString','update','database','\x20\x20Timezone:\x20','cron','output','just\x20now','json','347398eAaWgZ','engineVersion','retry_limit','show','No\x20scheduled\x20queries\x20found','list','query','jsonl','Update\x20a\x20scheduled\x20query','verbose','last_job','16cJABoU','data','\x20(use\x20--limit\x20to\x20see\x20more)','List\x20scheduled\x20queries','substring','Getting\x20schedule\x20details...','queryUrl','count','next_run_at','4644aMiaQP','Query\x20file\x20is\x20empty','63EiGQIk','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','scheduled_at','\x20\x20Cron:\x20','retryLimit','green','Schedule\x20run\x20submitted:\x20','\x20execution','num','length','Delete\x20a\x20scheduled\x20query','end_at','d\x20ago','max','schedule:history','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','options','📅\x20','1965922YSreok','keys','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','\x20\x20Num:\x20','\x20\x20Job\x20ID:\x20','Updating\x20schedule:\x20','name','tsv','\x20\x20→\x20','501876keGKoK','Creating\x20schedule...','schedule:list','utf-8','padEnd','Creating\x20schedule:\x20','40882bqBUzA','trino','INVALID_ARGUMENT','entries','86571EMPYbj','Updating\x20schedule...','listQueries','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','\x20job','queries','Found\x20','statusIcon','Running\x20schedule:\x20','Deleting\x20schedule...','updated_at','start_at','schedule:delete','125VheOGc','run','error','h\x20ago','from','status','engine_version','limit'];a35_0x4445=function(){return _0x149f3a;};return a35_0x4445();}export class ScheduleShowCommand extends BaseCommand{[a35_0x4efa20(0x1e5)]='schedule:show';[a35_0x4efa20(0x19e)]=a35_0x4efa20(0x17e);[a35_0x4efa20(0x19c)](_0x3549d5){const _0x155f0f=a35_0x4efa20,_0x5b3bc6=_0x3549d5[_0x155f0f(0x193)][0x0];if(!_0x5b3bc6)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>';return undefined;}async[a35_0x4efa20(0x1a1)](_0xe2239){const _0x46f09e=a35_0x4efa20,{options:_0x137a73,args:_0x288223,tdx:_0x245a44}=_0xe2239,_0x22edcf=_0x288223[0x0],_0x188e49=await withSpinner(_0x46f09e(0x1c7),()=>_0x245a44[_0x46f09e(0x1a8)][_0x46f09e(0x1ba)](_0x22edcf),{'verbose':_0x137a73['verbose']}),_0x4e5620=_0x188e49['data'],_0x4597f1={'name':_0x4e5620[_0x46f09e(0x1e5)],'cron':_0x4e5620[_0x46f09e(0x1b3)],'database':_0x4e5620[_0x46f09e(0x1b1)],'type':_0x4e5620[_0x46f09e(0x192)],'timezone':_0x4e5620[_0x46f09e(0x191)],'user_name':_0x4e5620[_0x46f09e(0x199)],'created_at':_0x4e5620['created_at'],'engine_version':_0x4e5620[_0x46f09e(0x175)],'executing_user_id':_0x4e5620[_0x46f09e(0x19d)],'query':_0x4e5620[_0x46f09e(0x1bd)],'delay':_0x4e5620['delay'],'priority':_0x4e5620[_0x46f09e(0x1a4)],'retry_limit':_0x4e5620[_0x46f09e(0x1b9)],..._0x4e5620[_0x46f09e(0x18e)]&&{'result':_0x4e5620[_0x46f09e(0x18e)]}};return await handleSingleObjectOutput(_0x4597f1,_0x137a73),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a35_0x4efa20(0x1e5)]=a35_0x4efa20(0x188);[a35_0x4efa20(0x19e)]='Create\x20a\x20scheduled\x20query';['validate'](_0x50d0dc){const _0x20b3df=a35_0x4efa20,_0x1244fa=_0x50d0dc['args'][0x0];if(!_0x1244fa)return _0x20b3df(0x18d);const _0x4948ac=_0x50d0dc[_0x20b3df(0x1dd)];if(!_0x4948ac[_0x20b3df(0x1b1)])return _0x20b3df(0x1ce);return undefined;}async[a35_0x4efa20(0x1a1)](_0x37b060){const _0x492b04=a35_0x4efa20,{options:_0x9bbda8,args:_0x4f61e8,tdx:_0xaef5e9}=_0x37b060,_0x2106d4=_0x4f61e8[0x0],_0x3f5cd5=_0x9bbda8,_0x393b52=_0x3f5cd5[_0x492b04(0x1b1)],_0x24edb=_0x3f5cd5[_0x492b04(0x17b)],_0x472e15=_0x3f5cd5[_0x492b04(0x192)]||_0x492b04(0x1ef);let _0x458c10;try{_0x458c10=readFileSync(_0x24edb,_0x492b04(0x1eb))['trim']();}catch(_0x3fa3bb){throw new SDKError(ErrorCode[_0x492b04(0x1f0)],_0x492b04(0x1a6)+_0x24edb,_0x3fa3bb instanceof Error?_0x3fa3bb:undefined);}if(!_0x458c10)throw new SDKError(ErrorCode[_0x492b04(0x1f0)],_0x492b04(0x1cc));const _0x3bfd66={'database':_0x393b52,'query':_0x458c10,'type':_0x472e15};if(_0x3f5cd5[_0x492b04(0x1b3)])_0x3bfd66[_0x492b04(0x1b3)]=_0x3f5cd5['cron'];if(_0x3f5cd5['timezone'])_0x3bfd66[_0x492b04(0x191)]=_0x3f5cd5[_0x492b04(0x191)];if(_0x3f5cd5[_0x492b04(0x180)]!==undefined)_0x3bfd66[_0x492b04(0x180)]=Number(_0x3f5cd5[_0x492b04(0x180)]);if(_0x3f5cd5[_0x492b04(0x1a4)]!==undefined)_0x3bfd66[_0x492b04(0x1a4)]=Number(_0x3f5cd5[_0x492b04(0x1a4)]);if(_0x3f5cd5[_0x492b04(0x1d1)]!==undefined)_0x3bfd66[_0x492b04(0x1b9)]=Number(_0x3f5cd5[_0x492b04(0x1d1)]);if(_0x3f5cd5[_0x492b04(0x1b8)])_0x3bfd66[_0x492b04(0x175)]=_0x3f5cd5[_0x492b04(0x1b8)];if(_0x3f5cd5[_0x492b04(0x18e)])_0x3bfd66['result']=_0x3f5cd5[_0x492b04(0x18e)];if(_0x9bbda8['verbose']){console[_0x492b04(0x201)](_0x492b04(0x1ed)+_0x2106d4),console['error']('\x20\x20Database:\x20'+_0x393b52),console[_0x492b04(0x201)]('\x20\x20Type:\x20'+_0x472e15);if(_0x3bfd66['cron'])console[_0x492b04(0x201)](_0x492b04(0x1d0)+_0x3bfd66[_0x492b04(0x1b3)]);if(_0x3bfd66[_0x492b04(0x191)])console['error'](_0x492b04(0x1b2)+_0x3bfd66[_0x492b04(0x191)]);}const _0x3b89ea=await withSpinner(_0x492b04(0x1e9),()=>_0xaef5e9[_0x492b04(0x1a8)][_0x492b04(0x187)](_0x2106d4,_0x3bfd66),{'verbose':_0x9bbda8[_0x492b04(0x1c0)]});return console[_0x492b04(0x201)]('Schedule\x20created:\x20'+_0x3b89ea[_0x492b04(0x1c3)]['name']),await handleSingleObjectOutput(_0x3b89ea[_0x492b04(0x1c3)],_0x9bbda8),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a35_0x4efa20(0x1e5)]=a35_0x4efa20(0x19a);['description']=a35_0x4efa20(0x1bf);[a35_0x4efa20(0x19c)](_0x564395){const _0x62ffc9=_0x564395['args'][0x0];if(!_0x62ffc9)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]';return undefined;}async['execute'](_0x1197c9){const _0x5f27c0=a35_0x4efa20,{options:_0x566786,args:_0x5a3b04,tdx:_0x49b441}=_0x1197c9,_0x1d79d=_0x5a3b04[0x0],_0x4f1b77=_0x566786,_0x3bd777={};if(_0x4f1b77['database'])_0x3bd777[_0x5f27c0(0x1b1)]=_0x4f1b77[_0x5f27c0(0x1b1)];if(_0x4f1b77[_0x5f27c0(0x192)])_0x3bd777['type']=_0x4f1b77[_0x5f27c0(0x192)];if(_0x4f1b77[_0x5f27c0(0x1b3)])_0x3bd777[_0x5f27c0(0x1b3)]=_0x4f1b77[_0x5f27c0(0x1b3)];if(_0x4f1b77[_0x5f27c0(0x191)])_0x3bd777['timezone']=_0x4f1b77['timezone'];if(_0x4f1b77['delay']!==undefined)_0x3bd777[_0x5f27c0(0x180)]=Number(_0x4f1b77[_0x5f27c0(0x180)]);if(_0x4f1b77['priority']!==undefined)_0x3bd777['priority']=Number(_0x4f1b77[_0x5f27c0(0x1a4)]);if(_0x4f1b77[_0x5f27c0(0x1d1)]!==undefined)_0x3bd777[_0x5f27c0(0x1b9)]=Number(_0x4f1b77[_0x5f27c0(0x1d1)]);if(_0x4f1b77[_0x5f27c0(0x1b8)])_0x3bd777[_0x5f27c0(0x175)]=_0x4f1b77[_0x5f27c0(0x1b8)];if(_0x4f1b77[_0x5f27c0(0x18e)])_0x3bd777[_0x5f27c0(0x18e)]=_0x4f1b77[_0x5f27c0(0x18e)];if(_0x4f1b77[_0x5f27c0(0x17b)])try{_0x3bd777[_0x5f27c0(0x1bd)]=readFileSync(_0x4f1b77[_0x5f27c0(0x17b)],'utf-8')['trim']();}catch(_0x3d841c){throw new SDKError(ErrorCode[_0x5f27c0(0x1f0)],_0x5f27c0(0x1a6)+_0x4f1b77[_0x5f27c0(0x17b)],_0x3d841c instanceof Error?_0x3d841c:undefined);}if(Object[_0x5f27c0(0x1e0)](_0x3bd777)[_0x5f27c0(0x1d6)]===0x0)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x5f27c0(0x1dc));if(_0x566786[_0x5f27c0(0x1c0)]){console[_0x5f27c0(0x201)](_0x5f27c0(0x1e4)+_0x1d79d);for(const [_0x55818c,_0x226144]of Object[_0x5f27c0(0x1f1)](_0x3bd777)){_0x55818c==='query'?console[_0x5f27c0(0x201)]('\x20\x20'+_0x55818c+':\x20'+_0x226144[_0x5f27c0(0x1c6)](0x0,0x32)+'...'):console[_0x5f27c0(0x201)]('\x20\x20'+_0x55818c+':\x20'+_0x226144);}}const _0x4dca76=await withSpinner(_0x5f27c0(0x1f3),()=>_0x49b441[_0x5f27c0(0x1a8)][_0x5f27c0(0x1b0)](_0x1d79d,_0x3bd777),{'verbose':_0x566786[_0x5f27c0(0x1c0)]});return console['error'](_0x5f27c0(0x1a0)+_0x4dca76[_0x5f27c0(0x1c3)]['name']),await handleSingleObjectOutput(_0x4dca76[_0x5f27c0(0x1c3)],_0x566786),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a35_0x4efa20(0x1e5)]=a35_0x4efa20(0x1fe);[a35_0x4efa20(0x19e)]=a35_0x4efa20(0x1d7);[a35_0x4efa20(0x19c)](_0x5b8a53){const _0x7192da=a35_0x4efa20,_0x28148d=_0x5b8a53['args'][0x0];if(!_0x28148d)return _0x7192da(0x1f5);return undefined;}async[a35_0x4efa20(0x1a1)](_0x39e849){const _0x4d2c0d=a35_0x4efa20,{options:_0x4fd213,args:_0x4b398d,tdx:_0x4477eb}=_0x39e849,_0xdbb1de=_0x4b398d[0x0];if(!_0x4fd213[_0x4d2c0d(0x18f)]){const _0x4b1c62=await confirm(_0x4d2c0d(0x1e1)+_0xdbb1de+'\x22?');if(!_0x4b1c62)return console[_0x4d2c0d(0x201)]('Cancelled'),0x0;}const _0x28806b=await withSpinner(_0x4d2c0d(0x1fb),()=>_0x4477eb[_0x4d2c0d(0x1a8)][_0x4d2c0d(0x196)](_0xdbb1de),{'verbose':_0x4fd213[_0x4d2c0d(0x1c0)]});return console[_0x4d2c0d(0x201)](_0x4d2c0d(0x184)+_0x28806b[_0x4d2c0d(0x1c3)][_0x4d2c0d(0x1e5)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a35_0x4efa20(0x1e5)]=a35_0x4efa20(0x190);[a35_0x4efa20(0x19e)]=a35_0x4efa20(0x1ab);[a35_0x4efa20(0x19c)](_0x31e1a5){const _0x2ad2c7=a35_0x4efa20,_0x38275a=_0x31e1a5[_0x2ad2c7(0x193)][0x0];if(!_0x38275a)return _0x2ad2c7(0x177);return undefined;}async[a35_0x4efa20(0x1a1)](_0x45d3a1){const _0x3d248f=a35_0x4efa20,{options:_0x3d9734,args:_0x28f287,tdx:_0x337e59}=_0x45d3a1,_0x1b652e=_0x28f287[0x0],_0x258778=_0x3d9734,_0x28f195=_0x258778[_0x3d248f(0x182)],_0x392c53=_0x258778[_0x3d248f(0x1d5)]!==undefined?Number(_0x258778['num']):undefined;if(_0x3d9734[_0x3d248f(0x1c0)]){console[_0x3d248f(0x201)](_0x3d248f(0x1fa)+_0x1b652e);if(_0x28f195)console['error'](_0x3d248f(0x183)+_0x28f195);if(_0x392c53)console['error'](_0x3d248f(0x1e2)+_0x392c53);}const _0x38e82e=await withSpinner('Running\x20schedule...',()=>_0x337e59[_0x3d248f(0x1a8)][_0x3d248f(0x200)](_0x1b652e,{'time':_0x28f195,'num':_0x392c53}),{'verbose':_0x3d9734[_0x3d248f(0x1c0)]}),_0x4bda7a=_0x38e82e['data'][_0x3d248f(0x194)];console[_0x3d248f(0x201)](_0x3d248f(0x1d3)+_0x4bda7a[_0x3d248f(0x1d6)]+_0x3d248f(0x1f6)+(_0x4bda7a[_0x3d248f(0x1d6)]!==0x1?'s':'')+_0x3d248f(0x195));for(const _0x5324e8 of _0x4bda7a){console[_0x3d248f(0x201)](_0x3d248f(0x1e3)+_0x5324e8[_0x3d248f(0x17a)]);}return await handleSDKOutput(_0x4bda7a,_0x3d9734),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a35_0x4efa20(0x1e5)]=a35_0x4efa20(0x1db);[a35_0x4efa20(0x19e)]=a35_0x4efa20(0x185);[a35_0x4efa20(0x19c)](_0x625377){const _0x344207=a35_0x4efa20,_0xdee1ba=_0x625377[_0x344207(0x193)][0x0];if(!_0xdee1ba)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async[a35_0x4efa20(0x1a1)](_0x3714a8){const _0x6a1487=a35_0x4efa20,{options:_0x4e7adb,args:_0x10f6f7,tdx:_0x1d3927}=_0x3714a8,_0x1f9d32=_0x10f6f7[0x0],_0x597cba=_0x4e7adb,_0x3fc560=_0x597cba['from']!==undefined?Number(_0x597cba[_0x6a1487(0x173)]):undefined,_0x5aa8ab=_0x597cba['to']!==undefined?Number(_0x597cba['to']):undefined,_0x287b4a=await withSpinner(_0x6a1487(0x1a9),()=>_0x1d3927[_0x6a1487(0x1a8)][_0x6a1487(0x17d)](_0x1f9d32,{'from':_0x3fc560,'to':_0x5aa8ab}),{'verbose':_0x4e7adb['verbose']}),_0x3ed78d=_0x287b4a[_0x6a1487(0x1c3)];console[_0x6a1487(0x201)](_0x6a1487(0x1f8)+_0x3ed78d[_0x6a1487(0x1c9)]+_0x6a1487(0x1d4)+(_0x3ed78d[_0x6a1487(0x1c9)]!==0x1?'s':'')+_0x6a1487(0x178)+_0x3ed78d[_0x6a1487(0x173)]+'-'+_0x3ed78d['to']+')');const _0x1dee39=_0x3ed78d['history'][_0x6a1487(0x1aa)](_0x529f30=>({'job_id':_0x529f30[_0x6a1487(0x17a)],'type':_0x529f30[_0x6a1487(0x192)],'status':_0x529f30['status'],'scheduled_at':_0x529f30[_0x6a1487(0x1cf)],'created_at':_0x529f30['created_at'],'start_at':_0x529f30[_0x6a1487(0x1fd)],'end_at':_0x529f30[_0x6a1487(0x1d8)]}));return await handleSDKOutput(_0x1dee39,_0x4e7adb),0x0;}}
@@ -1 +1 @@
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
+ const a36_0x7b3c67=a36_0x415e;(function(_0x9beaa6,_0x4f9ceb){const _0x24d76a=a36_0x415e,_0x5d8744=_0x9beaa6();while(!![]){try{const _0x581924=-parseInt(_0x24d76a(0x23b))/0x1+-parseInt(_0x24d76a(0x1dc))/0x2*(-parseInt(_0x24d76a(0x210))/0x3)+parseInt(_0x24d76a(0x235))/0x4*(parseInt(_0x24d76a(0x1e2))/0x5)+parseInt(_0x24d76a(0x1d0))/0x6*(parseInt(_0x24d76a(0x1fb))/0x7)+-parseInt(_0x24d76a(0x1c1))/0x8*(-parseInt(_0x24d76a(0x1d3))/0x9)+parseInt(_0x24d76a(0x231))/0xa+parseInt(_0x24d76a(0x1f5))/0xb*(-parseInt(_0x24d76a(0x1cb))/0xc);if(_0x581924===_0x4f9ceb)break;else _0x5d8744['push'](_0x5d8744['shift']());}catch(_0x2b2329){_0x5d8744['push'](_0x5d8744['shift']());}}}(a36_0x4616,0x26467));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_0x5a84c5 from'chalk';async function resolveSegmentTarget(_0x1d56f6,_0x2c6ff9,_0x13470b){const _0x5535e1=a36_0x415e;if(isYamlFilePath(_0x1d56f6))try{const _0x251d97=await resolveYamlFilePath(_0x1d56f6);return _0x13470b&&(console[_0x5535e1(0x1eb)](_0x5535e1(0x1f4)+_0x1d56f6),console[_0x5535e1(0x1eb)](_0x5535e1(0x22e)+_0x251d97[_0x5535e1(0x1cd)]),console[_0x5535e1(0x1eb)](_0x5535e1(0x229)+_0x251d97[_0x5535e1(0x1ee)]),console['error']('\x20\x20Folder\x20path:\x20'+(_0x251d97['folderPath']||_0x5535e1(0x1e0))),console['error']('\x20\x20Full\x20path:\x20'+_0x251d97[_0x5535e1(0x1a7)])),_0x251d97[_0x5535e1(0x1a7)];}catch(_0x80f9a5){throw new SDKError(ErrorCode[_0x5535e1(0x223)],_0x5535e1(0x19a)+_0x80f9a5[_0x5535e1(0x1bb)]);}if(!_0x2c6ff9)throw new SDKError(ErrorCode[_0x5535e1(0x223)],_0x5535e1(0x221));return _0x2c6ff9+'/'+_0x1d56f6;}function a36_0x4616(){const _0x247d1f=['getSegmentSQL','46NaCJoV','elapsedTimeMillis','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','getSQLFromServerSegment','(root)','segmentId','485mPpIZl','processedRows','Create\x20segment\x20folder\x20for\x20organization','folder','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','code','Fetching\x20SQL\x20from\x20rule...','Listing\x20folders\x20for\x20parent\x20\x27','error','resolveFolderId','SQL\x20query:\x0a','segmentName','✔\x20Query\x20completed:\x20Processed\x20','Use:\x20tdx\x20ps\x20view\x20-w','\x20[Job\x20ID:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','information_schema','Resolved\x20YAML\x20file:\x20','2629MmEPvo','format','Resolved\x20type:\x20','Use:\x20tdx\x20ps\x20view','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','parentFolder','7LBlxPz','Parent\x20ID:\x20','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Folder\x20ID:\x20','log','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Resolving\x20parent\x20folder\x20\x27','Error:\x20Folder\x20reference\x20is\x20required','getSegmentSQLFromYaml','site','Resolved\x20parent\x20folder\x20ID:\x20','description','name','Parent\x20segment:\x20','Show\x20folder\x20or\x20child\x20segment\x20details','createFolder','trim','Parent\x20name:\x20','segment:folder:create','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','getFolder','11574zgzrVM','\x20folder','✔\x20Created\x20folder\x20\x27','toLocaleString','Site:\x20','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Resolving\x20\x27','stats','parentId','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Usage:\x20tdx\x20sg\x20desc\x20<name>','Folder\x20name:\x20','segment','data','getSegment','segment:desc','listFolders','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','verbose','INVALID_ARGUMENT','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','test','\x20rows\x20','✔\x20Found\x20','\x20\x20Segment\x20name:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Target\x20path:\x20','\x20\x20Parent\x20segment:\x20','type','Resolving\x20folder\x20\x27','1876890QixNli','segmentPath','execute','SEGMENT_NOT_FOUND','6748OumVwI','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Usage:\x20tdx\x20segment\x20describe\x20<path>','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Resolving\x20parent\x20segment\x20\x27','137878ZkMcuZ','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','parent','Resolved:\x20','resolvePathToResource','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','resolveParentId','Usage:\x20tdx\x20sg\x20show\x20<name>','Fetching\x20SQL\x20for\x20segment...','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Fetching\x20folder\x20details...','red','folderId','segment:describe','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Error:\x20Parent\x20segment\x20name\x20is\x20required','Fetching\x20folder\x20\x27','getSQLFromYamlFile','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Segment\x20ID:\x20','segment:show','fullPath','Use:\x20tdx\x20ps\x20show','segment:folder:show','Folder\x20ID\x20missing\x20from\x20resolved\x20path','segment:view','Usage:','Examples:','SELECT\x20*\x20FROM\x20(\x0a','content','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','/app/ps/','\x27...','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','length','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20tdx\x20sg\x20sql\x20--path\x20','limit','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','green','message','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','includes','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Resolved\x20parent\x20ID:\x20','550168Qnnoqs','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','Resolved\x20folder\x20ID:\x20','Show\x20segment\x20folder\x20details','/e/','jobId','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','url','getParent','path','17772nvcvwy','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','parentSegment','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','426048IuWdVZ','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','18aDHRMl','cyan','Error:\x20Path\x20or\x20name\x20is\x20required','Error:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','json','\x20\x20Cause:\x20','cause'];a36_0x4616=function(){return _0x247d1f;};return a36_0x4616();}export class SegmentDescribeCommand extends BaseCommand{[a36_0x7b3c67(0x207)]=a36_0x7b3c67(0x19e);[a36_0x7b3c67(0x206)]='Show\x20segment\x20or\x20folder\x20details';async[a36_0x7b3c67(0x233)](_0x58557b){const _0x107023=a36_0x7b3c67,{options:_0x23bb87,args:_0x4d6ba0,tdx:_0x5a630a}=_0x58557b,_0x1019b4=_0x4d6ba0[0x0],_0x348c08=!_0x1019b4&&!!_0x23bb87[_0x107023(0x1cd)],_0x134a87=_0x1019b4||_0x23bb87[_0x107023(0x1cd)];if(!_0x134a87)return console[_0x107023(0x1eb)](_0x107023(0x1d5)),console['error'](_0x107023(0x238)),console[_0x107023(0x1eb)]('Examples:'),console['error'](_0x107023(0x1b9)),console[_0x107023(0x1eb)](_0x107023(0x1e6)),console[_0x107023(0x1eb)](_0x107023(0x1f2)),console[_0x107023(0x1eb)](_0x107023(0x1a3)),0x1;try{const _0x449ad5=_0x23bb87[_0x107023(0x232)];let _0x96d113=_0x134a87;!_0x348c08&&_0x449ad5&&!_0x134a87[_0x107023(0x1bd)]('/')&&(_0x96d113=_0x449ad5+'/'+_0x134a87,_0x23bb87[_0x107023(0x222)]&&console[_0x107023(0x1eb)]('Resolved\x20relative\x20path\x20to:\x20'+_0x96d113));const _0x11e54e=await withSpinner('Resolving\x20path\x20\x27'+_0x96d113+_0x107023(0x1b3),()=>_0x5a630a[_0x107023(0x21c)][_0x107023(0x195)](_0x96d113),{'verbose':_0x23bb87['verbose']}),_0x3262e7=_0x11e54e[_0x107023(0x21d)];_0x23bb87[_0x107023(0x222)]&&(console[_0x107023(0x1eb)](_0x107023(0x1f7)+_0x3262e7['type']),console['error'](_0x107023(0x1fc)+_0x3262e7['parentId']),_0x3262e7[_0x107023(0x19d)]&&console['error'](_0x107023(0x1fe)+_0x3262e7['folderId']),_0x3262e7[_0x107023(0x1e1)]&&console[_0x107023(0x1eb)](_0x107023(0x1a5)+_0x3262e7[_0x107023(0x1e1)]));if(_0x3262e7[_0x107023(0x22f)]===_0x107023(0x23d)){const _0x259bd6=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x5a630a['segment'][_0x107023(0x1c9)](_0x3262e7[_0x107023(0x218)]),{'verbose':_0x23bb87[_0x107023(0x222)]});await handleSingleObjectOutput(_0x259bd6[_0x107023(0x21d)],_0x23bb87);}else{if(_0x3262e7[_0x107023(0x22f)]===_0x107023(0x1e5)){if(!_0x3262e7[_0x107023(0x19d)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x107023(0x1aa));const _0xfa7881=await withSpinner(_0x107023(0x19b),()=>_0x5a630a[_0x107023(0x21c)][_0x107023(0x20f)](_0x3262e7['folderId']),{'verbose':_0x23bb87[_0x107023(0x222)]});await handleSingleObjectOutput(_0xfa7881['data'],_0x23bb87);}else{if(_0x3262e7[_0x107023(0x22f)]===_0x107023(0x21c)){if(!_0x3262e7[_0x107023(0x1e1)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x365be8=await withSpinner('Fetching\x20segment\x20details...',()=>_0x5a630a[_0x107023(0x21c)][_0x107023(0x21e)](_0x3262e7[_0x107023(0x218)],_0x3262e7[_0x107023(0x1e1)]),{'verbose':_0x23bb87[_0x107023(0x222)]});await handleSingleObjectOutput(_0x365be8[_0x107023(0x21d)],_0x23bb87);}}}return 0x0;}catch(_0x132a0e){if(_0x132a0e instanceof SDKError)return console[_0x107023(0x1eb)]('Error:\x20'+_0x132a0e[_0x107023(0x1bb)]),_0x132a0e['cause']&&console['error']('\x20\x20Cause:\x20'+_0x132a0e[_0x107023(0x1da)]),0x1;throw _0x132a0e;}}}function a36_0x415e(_0x3d781f,_0xcd6c8){_0x3d781f=_0x3d781f-0x195;const _0x4616ec=a36_0x4616();let _0x415ef0=_0x4616ec[_0x3d781f];return _0x415ef0;}export class SegmentShowCommand extends BaseCommand{[a36_0x7b3c67(0x207)]=a36_0x7b3c67(0x1a6);[a36_0x7b3c67(0x206)]=a36_0x7b3c67(0x19f);async[a36_0x7b3c67(0x233)](_0x13241a){const _0x31441d=a36_0x7b3c67,{options:_0x17d082,args:_0x537a50,tdx:_0xec1af5}=_0x13241a,_0x5685ba=_0x537a50[0x0];if(!_0x5685ba)return console[_0x31441d(0x1eb)](_0x31441d(0x1d1)),console[_0x31441d(0x1eb)](_0x31441d(0x198)),console[_0x31441d(0x1eb)](_0x31441d(0x1d7)),console[_0x31441d(0x1eb)](_0x31441d(0x1ad)),console[_0x31441d(0x1eb)](_0x31441d(0x239)),console[_0x31441d(0x1eb)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x389b00=_0x17d082[_0x31441d(0x1cd)],_0x343ab3=await resolveSegmentTarget(_0x5685ba,_0x389b00,_0x17d082[_0x31441d(0x222)]);_0x17d082[_0x31441d(0x222)]&&console['error'](_0x31441d(0x22d)+_0x343ab3);const _0x4f6b9f=await withSpinner(_0x31441d(0x216)+_0x5685ba+_0x31441d(0x1b3),()=>_0xec1af5[_0x31441d(0x21c)][_0x31441d(0x195)](_0x343ab3),{'verbose':_0x17d082[_0x31441d(0x222)]}),_0x1ac768=_0x4f6b9f[_0x31441d(0x21d)];_0x17d082[_0x31441d(0x222)]&&(console[_0x31441d(0x1eb)](_0x31441d(0x1f7)+_0x1ac768[_0x31441d(0x22f)]),console[_0x31441d(0x1eb)]('Parent\x20ID:\x20'+_0x1ac768[_0x31441d(0x218)]));if(_0x1ac768[_0x31441d(0x22f)]===_0x31441d(0x1e5))return console['error']('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0x31441d(0x1eb)](_0x31441d(0x23c)),0x1;if(_0x1ac768['type']===_0x31441d(0x23d))return console[_0x31441d(0x1eb)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x31441d(0x1eb)](_0x31441d(0x1a8)),0x1;if(!_0x1ac768['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x31441d(0x219));const _0x1065cc=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0xec1af5['segment'][_0x31441d(0x1db)](_0x1ac768[_0x31441d(0x218)],_0x1ac768['segmentId']),{'verbose':_0x17d082[_0x31441d(0x222)]});let _0x26102b=_0x1065cc[_0x31441d(0x21d)];const _0x5a0d9=resolveLimit(_0x17d082[_0x31441d(0x1b8)],DEFAULT_DISPLAY_LIMIT),_0x33c342=/\bLIMIT\s+\d+/i[_0x31441d(0x226)](_0x26102b);!_0x33c342&&(_0x26102b=_0x26102b[_0x31441d(0x20b)]()['replace'](/;+$/,''),_0x26102b=_0x31441d(0x1ae)+_0x26102b+_0x31441d(0x1b1)+_0x5a0d9);_0x17d082[_0x31441d(0x222)]&&console[_0x31441d(0x1eb)](_0x31441d(0x1ed)+_0x26102b);const _0x164637=await withProgressSpinner('Executing\x20segment\x20query...',async _0xb11f76=>{const _0x397a4d=_0x31441d,_0x1c876f=await _0xec1af5['query'][_0x397a4d(0x233)](_0x26102b,{'catalog':'td','schema':_0x397a4d(0x1f3),'onJobId':_0x392c53=>{_0xb11f76['setJobId'](_0x392c53);}});return _0x1c876f;},{'verbose':_0x17d082[_0x31441d(0x222)]}),_0xdb14f0=_0x164637[_0x31441d(0x21d)],_0x4c2d83=_0xdb14f0[_0x31441d(0x1c6)]?_0x31441d(0x1f1)+_0xdb14f0[_0x31441d(0x1c6)]+']':'';return console[_0x31441d(0x1eb)](_0x31441d(0x1ef)+_0xdb14f0[_0x31441d(0x217)][_0x31441d(0x1e3)][_0x31441d(0x213)]()+_0x31441d(0x227)+('in\x20'+formatElapsed(_0xdb14f0[_0x31441d(0x217)][_0x31441d(0x1dd)])+_0x4c2d83)),await handleQueryOutput(_0xdb14f0,_0x17d082),0x0;}catch(_0x42f0c4){if(_0x42f0c4 instanceof SDKError)return console[_0x31441d(0x1eb)]('✖\x20Query\x20failed\x20['+_0x42f0c4[_0x31441d(0x1e8)]+']'),console['error']('\x0a'+_0x42f0c4[_0x31441d(0x1bb)]),0x1;throw _0x42f0c4;}}}export class SegmentFolderListCommand extends BaseCommand{['name']='segment:folder:list';[a36_0x7b3c67(0x206)]=a36_0x7b3c67(0x22c);async[a36_0x7b3c67(0x233)](_0x512f12){const _0x499d46=a36_0x7b3c67,{options:_0x5102e2,args:_0x49ff93,tdx:_0x33d323}=_0x512f12;if(_0x49ff93[_0x499d46(0x1b5)]===0x0)return console[_0x499d46(0x1eb)](_0x499d46(0x1a0)),console[_0x499d46(0x1eb)](_0x499d46(0x1b4)),0x1;const _0x4384bb=_0x49ff93[0x0];try{_0x5102e2[_0x499d46(0x222)]&&(console['error'](_0x499d46(0x214)+_0x5102e2[_0x499d46(0x204)]),console[_0x499d46(0x1eb)](_0x499d46(0x20c)+_0x4384bb));const _0x13c75b=await withSpinner(_0x499d46(0x23a)+_0x4384bb+'\x27...',()=>_0x33d323[_0x499d46(0x21c)][_0x499d46(0x197)](_0x4384bb),{'verbose':_0x5102e2[_0x499d46(0x222)]}),_0x4d3305=_0x13c75b[_0x499d46(0x21d)];_0x5102e2[_0x499d46(0x222)]&&console['error'](_0x499d46(0x1c0)+_0x4d3305);const _0x2ed36d=await withSpinner(_0x499d46(0x1ea)+_0x4384bb+_0x499d46(0x1b3),()=>_0x33d323['segment'][_0x499d46(0x220)](_0x4d3305),{'verbose':_0x5102e2[_0x499d46(0x222)]}),_0x116c9c=_0x2ed36d[_0x499d46(0x21d)];return console[_0x499d46(0x1eb)](_0x499d46(0x228)+_0x116c9c['length']+_0x499d46(0x211)+(_0x116c9c[_0x499d46(0x1b5)]!==0x1?'s':'')),await handleSDKOutput(_0x116c9c,_0x5102e2),0x0;}catch(_0x4a0033){if(_0x4a0033 instanceof SDKError)return console[_0x499d46(0x1eb)]('Error:\x20'+_0x4a0033['message']),_0x4a0033[_0x499d46(0x1da)]&&console[_0x499d46(0x1eb)](_0x499d46(0x1d9)+_0x4a0033[_0x499d46(0x1da)]),0x1;throw _0x4a0033;}}}export class SegmentFolderShowCommand extends BaseCommand{[a36_0x7b3c67(0x207)]=a36_0x7b3c67(0x1a9);[a36_0x7b3c67(0x206)]=a36_0x7b3c67(0x1c4);async['execute'](_0x27c650){const _0x131cd3=a36_0x7b3c67,{options:_0x5c3597,args:_0x5ab7f2,tdx:_0x52d131}=_0x27c650;if(_0x5ab7f2[_0x131cd3(0x1b5)]===0x0)return console['error'](_0x131cd3(0x202)),console[_0x131cd3(0x1eb)](_0x131cd3(0x1bc)),0x1;try{const {parentId:_0x16283f,childId:_0x1d0e1b}=parseSegmentRef(_0x5ab7f2[0x0]);_0x5c3597[_0x131cd3(0x222)]&&(console['error'](_0x131cd3(0x214)+_0x5c3597[_0x131cd3(0x204)]),console['error'](_0x131cd3(0x20c)+_0x16283f),_0x1d0e1b&&console['error']('Folder\x20name:\x20'+_0x1d0e1b));if(!_0x1d0e1b)return console[_0x131cd3(0x1eb)](_0x131cd3(0x200)),0x1;const _0xc0fb8b=await withSpinner(_0x131cd3(0x23a)+_0x16283f+'\x27...',()=>_0x52d131[_0x131cd3(0x21c)][_0x131cd3(0x197)](_0x16283f),{'verbose':_0x5c3597[_0x131cd3(0x222)]}),_0x55879f=_0xc0fb8b[_0x131cd3(0x21d)];_0x5c3597[_0x131cd3(0x222)]&&console['error'](_0x131cd3(0x1c0)+_0x55879f);const _0x3b88bf=await withSpinner(_0x131cd3(0x230)+_0x1d0e1b+'\x27...',()=>_0x52d131[_0x131cd3(0x21c)][_0x131cd3(0x1ec)](_0x55879f,_0x1d0e1b),{'verbose':_0x5c3597[_0x131cd3(0x222)]}),_0xc2256a=_0x3b88bf[_0x131cd3(0x21d)];_0x5c3597[_0x131cd3(0x222)]&&console[_0x131cd3(0x1eb)](_0x131cd3(0x1c3)+_0xc2256a);const _0x57a06d=await withSpinner(_0x131cd3(0x1a1)+_0x1d0e1b+_0x131cd3(0x1b3),()=>_0x52d131[_0x131cd3(0x21c)][_0x131cd3(0x20f)](_0xc2256a),{'verbose':_0x5c3597['verbose']});return await handleSDKOutput([_0x57a06d[_0x131cd3(0x21d)]],_0x5c3597),0x0;}catch(_0x44bcc7){if(_0x44bcc7 instanceof SDKError)return console[_0x131cd3(0x1eb)]('Error:\x20'+_0x44bcc7[_0x131cd3(0x1bb)]),_0x44bcc7[_0x131cd3(0x1da)]&&console[_0x131cd3(0x1eb)]('\x20\x20Cause:\x20'+_0x44bcc7[_0x131cd3(0x1da)]),0x1;throw _0x44bcc7;}}}export class SegmentSQLCommand extends BaseCommand{[a36_0x7b3c67(0x207)]='segment:sql';['description']='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a36_0x7b3c67(0x233)](_0x1eafd8){const _0x90351e=a36_0x7b3c67,{options:_0x5eef13,args:_0x1e0d45}=_0x1eafd8,_0x2f800f=_0x5eef13,_0x13c626=_0x2f800f[_0x90351e(0x1ca)],_0x3e90d5=_0x1e0d45[0x0];if(!_0x3e90d5&&!_0x13c626)return console[_0x90351e(0x1eb)](a36_0x5a84c5[_0x90351e(0x19c)](_0x90351e(0x224))),console[_0x90351e(0x1eb)](_0x90351e(0x1ac)),console[_0x90351e(0x1eb)](_0x90351e(0x20e)),console['error'](_0x90351e(0x22b)),console[_0x90351e(0x1eb)](_0x90351e(0x1ad)),console['error'](_0x90351e(0x1ce)),console[_0x90351e(0x1eb)](_0x90351e(0x1c7)),0x1;if(_0x3e90d5&&_0x13c626)return console[_0x90351e(0x1eb)](a36_0x5a84c5[_0x90351e(0x19c)](_0x90351e(0x1de))),0x1;try{let _0x4953d6;if(_0x13c626)_0x4953d6=await this[_0x90351e(0x1a2)](_0x13c626,_0x1eafd8);else{if(isYamlFilePath(_0x3e90d5))return console[_0x90351e(0x1eb)](a36_0x5a84c5[_0x90351e(0x19c)](_0x90351e(0x1c2))),console['error'](_0x90351e(0x1b7)+_0x3e90d5),0x1;else _0x4953d6=await this[_0x90351e(0x1df)](_0x3e90d5,_0x1eafd8);}return _0x5eef13[_0x90351e(0x1f6)]===_0x90351e(0x1d8)||_0x5eef13[_0x90351e(0x1f6)]==='jsonl'?await handleSDKOutput([{'sql':_0x4953d6}],_0x5eef13):console[_0x90351e(0x1ff)](_0x4953d6),0x0;}catch(_0x541e6e){if(_0x541e6e instanceof SDKError)return console[_0x90351e(0x1eb)](_0x90351e(0x1d6)+_0x541e6e[_0x90351e(0x1bb)]),_0x541e6e[_0x90351e(0x1da)]&&console[_0x90351e(0x1eb)]('\x20\x20Cause:\x20'+_0x541e6e[_0x90351e(0x1da)]),0x1;throw _0x541e6e;}}async['getSQLFromYamlFile'](_0x1ce90b,_0xa14c25){const _0x1b6ca9=a36_0x7b3c67,{options:_0x1a29d9,tdx:_0x4facfd}=_0xa14c25;let _0x5d59ce;try{_0x5d59ce=await resolveYamlFilePath(_0x1ce90b);}catch(_0x3de807){throw new SDKError(ErrorCode[_0x1b6ca9(0x223)],_0x1b6ca9(0x19a)+_0x3de807[_0x1b6ca9(0x1bb)]);}_0x1a29d9[_0x1b6ca9(0x222)]&&console['error'](_0x1b6ca9(0x23e)+_0x5d59ce[_0x1b6ca9(0x1cd)]+'/'+_0x5d59ce[_0x1b6ca9(0x1ee)]);const _0x3153e4=await withSpinner(_0x1b6ca9(0x1e9),()=>_0x4facfd[_0x1b6ca9(0x21c)][_0x1b6ca9(0x203)](_0x5d59ce[_0x1b6ca9(0x1af)],_0x5d59ce['parentSegment'],_0x5d59ce[_0x1b6ca9(0x1ee)]),{'verbose':_0x1a29d9[_0x1b6ca9(0x222)]});return _0x3153e4['data'];}async[a36_0x7b3c67(0x1df)](_0x258af9,_0x1355a8){const _0x52e2b3=a36_0x7b3c67,{options:_0x45f106,tdx:_0x350dc0}=_0x1355a8,_0x491635=_0x45f106[_0x52e2b3(0x1cd)],_0x35c912=await resolveSegmentTarget(_0x258af9,_0x491635,_0x45f106[_0x52e2b3(0x222)]);_0x45f106['verbose']&&console[_0x52e2b3(0x1eb)](_0x52e2b3(0x22d)+_0x35c912);const _0x592d68=await withSpinner(_0x52e2b3(0x216)+_0x258af9+_0x52e2b3(0x1b3),()=>_0x350dc0['segment'][_0x52e2b3(0x195)](_0x35c912),{'verbose':_0x45f106[_0x52e2b3(0x222)]}),_0x3c11ea=_0x592d68[_0x52e2b3(0x21d)];_0x45f106[_0x52e2b3(0x222)]&&(console[_0x52e2b3(0x1eb)](_0x52e2b3(0x1f7)+_0x3c11ea[_0x52e2b3(0x22f)]),console[_0x52e2b3(0x1eb)](_0x52e2b3(0x1fc)+_0x3c11ea[_0x52e2b3(0x218)]));if(_0x3c11ea[_0x52e2b3(0x22f)]==='folder')throw new SDKError(ErrorCode[_0x52e2b3(0x223)],'Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.');if(_0x3c11ea[_0x52e2b3(0x22f)]===_0x52e2b3(0x23d))throw new SDKError(ErrorCode[_0x52e2b3(0x223)],_0x52e2b3(0x1b0));if(!_0x3c11ea['segmentId'])throw new SDKError(ErrorCode[_0x52e2b3(0x234)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x3e928e=await withSpinner(_0x52e2b3(0x199),()=>_0x350dc0[_0x52e2b3(0x21c)]['getSegmentSQL'](_0x3c11ea['parentId'],_0x3c11ea[_0x52e2b3(0x1e1)]),{'verbose':_0x45f106[_0x52e2b3(0x222)]});return _0x3e928e[_0x52e2b3(0x21d)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a36_0x7b3c67(0x207)]=a36_0x7b3c67(0x20d);['description']=a36_0x7b3c67(0x1e4);async[a36_0x7b3c67(0x233)](_0x48cf16){const _0x3f8563=a36_0x7b3c67,{options:_0x56ef08,args:_0x9cb588,tdx:_0x3c48da}=_0x48cf16,_0x18b347=_0x56ef08;if(_0x9cb588['length']<0x2)return console[_0x3f8563(0x1eb)](_0x3f8563(0x1fd)),console['error'](_0x3f8563(0x1e7)),0x1;const _0x233646=_0x9cb588[0x0],_0xd64539=_0x9cb588[0x1];_0x18b347[_0x3f8563(0x222)]&&(console[_0x3f8563(0x1eb)]('Site:\x20'+_0x18b347[_0x3f8563(0x204)]),console[_0x3f8563(0x1eb)](_0x3f8563(0x208)+_0x233646),console[_0x3f8563(0x1eb)](_0x3f8563(0x21b)+_0xd64539));let _0x4f876d;if(_0x18b347[_0x3f8563(0x1fa)]){const _0x191407=_0x18b347[_0x3f8563(0x1fa)],_0x5f42bf=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x233646+_0x3f8563(0x1b3),()=>_0x3c48da['segment'][_0x3f8563(0x197)](_0x233646),{'verbose':_0x18b347['verbose']}),_0x52aada=_0x5f42bf[_0x3f8563(0x21d)],_0x1001fa=await withSpinner(_0x3f8563(0x201)+_0x191407+'\x27...',()=>_0x3c48da['segment'][_0x3f8563(0x1ec)](_0x52aada,_0x191407),{'verbose':_0x18b347['verbose']});_0x4f876d=_0x1001fa[_0x3f8563(0x21d)],_0x18b347[_0x3f8563(0x222)]&&console['error'](_0x3f8563(0x205)+_0x4f876d);}const _0xcae866={'name':_0xd64539,'description':_0x18b347['description'],'parentFolderId':_0x4f876d},_0x5d6009=await withSpinner('Creating\x20folder\x20\x27'+_0xd64539+'\x27...',()=>_0x3c48da[_0x3f8563(0x21c)][_0x3f8563(0x20a)](_0x233646,_0xcae866),{'verbose':_0x18b347[_0x3f8563(0x222)]}),_0x2afbac=_0x5d6009[_0x3f8563(0x21d)];return console[_0x3f8563(0x1eb)](_0x3f8563(0x212)+_0x2afbac[_0x3f8563(0x207)]+'\x27\x20with\x20ID:\x20'+_0x2afbac['id']),await handleSDKOutput([_0x2afbac],_0x18b347),0x0;}}export class SegmentViewCommand extends BaseCommand{[a36_0x7b3c67(0x207)]=a36_0x7b3c67(0x1ab);[a36_0x7b3c67(0x206)]=a36_0x7b3c67(0x209);async[a36_0x7b3c67(0x233)](_0xe9976b){const _0x231668=a36_0x7b3c67,{options:_0x4d1543,args:_0x1ab32a,tdx:_0x15a740}=_0xe9976b,_0x1329ad=_0x1ab32a[0x0];if(!_0x1329ad)return console['error'](_0x231668(0x1bf)),console[_0x231668(0x1eb)](_0x231668(0x1cc)),console[_0x231668(0x1eb)](_0x231668(0x237)),console[_0x231668(0x1eb)]('Options:'),console[_0x231668(0x1eb)](_0x231668(0x1b6)),console[_0x231668(0x1eb)](_0x231668(0x1ad)),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x231668(0x1eb)](_0x231668(0x1d2)),console['error'](_0x231668(0x22a)),console[_0x231668(0x1eb)](_0x231668(0x1a4)),0x1;try{const _0x319cc1=_0x4d1543[_0x231668(0x1cd)],_0x26aab=await resolveSegmentTarget(_0x1329ad,_0x319cc1,_0x4d1543[_0x231668(0x222)]);_0x4d1543[_0x231668(0x222)]&&console[_0x231668(0x1eb)](_0x231668(0x22d)+_0x26aab);const _0x1a6b62=await withSpinner(_0x231668(0x216)+_0x1329ad+_0x231668(0x1b3),()=>_0x15a740[_0x231668(0x21c)][_0x231668(0x195)](_0x26aab),{'verbose':_0x4d1543[_0x231668(0x222)]}),_0x38efca=_0x1a6b62[_0x231668(0x21d)];_0x4d1543[_0x231668(0x222)]&&(console[_0x231668(0x1eb)](_0x231668(0x1f7)+_0x38efca[_0x231668(0x22f)]),console['error']('Parent\x20ID:\x20'+_0x38efca[_0x231668(0x218)]),_0x38efca[_0x231668(0x19d)]&&console[_0x231668(0x1eb)](_0x231668(0x1fe)+_0x38efca[_0x231668(0x19d)]),_0x38efca[_0x231668(0x1e1)]&&console['error']('Segment\x20ID:\x20'+_0x38efca[_0x231668(0x1e1)]));if(_0x4d1543['web']){if(_0x38efca['type']===_0x231668(0x1e5))return console[_0x231668(0x1eb)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x38efca['type']===_0x231668(0x23d))return console[_0x231668(0x1eb)](_0x231668(0x225)),console['error'](_0x231668(0x1f0)),0x1;if(!_0x38efca[_0x231668(0x1e1)])throw new SDKError(ErrorCode[_0x231668(0x234)],_0x231668(0x219));const _0x1ae82f=getConsoleNextUrl(_0x4d1543['site'],_0x231668(0x1b2)+_0x38efca[_0x231668(0x218)]+_0x231668(0x1c5)+_0x38efca[_0x231668(0x1e1)]);return console[_0x231668(0x1eb)](a36_0x5a84c5[_0x231668(0x1ba)]('✔')+'\x20Opening\x20'+a36_0x5a84c5[_0x231668(0x1d4)](_0x1ae82f)),openBrowser(_0x1ae82f),0x0;}if(_0x38efca['type']==='folder'){if(!_0x38efca[_0x231668(0x19d)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x231668(0x1aa));const _0x4cc6c9=await withSpinner(_0x231668(0x19b),()=>_0x15a740[_0x231668(0x21c)][_0x231668(0x20f)](_0x38efca[_0x231668(0x19d)]),{'verbose':_0x4d1543[_0x231668(0x222)]});await handleSingleObjectOutput(_0x4cc6c9[_0x231668(0x21d)],_0x4d1543);}else{if(_0x38efca['type']===_0x231668(0x21c)){if(!_0x38efca[_0x231668(0x1e1)])throw new SDKError(ErrorCode[_0x231668(0x234)],_0x231668(0x219));const _0x11a3fb=await withSpinner('Fetching\x20segment\x20details...',()=>_0x15a740[_0x231668(0x21c)][_0x231668(0x21e)](_0x38efca[_0x231668(0x218)],_0x38efca[_0x231668(0x1e1)]),{'verbose':_0x4d1543['verbose']}),_0x7f99d9=getConsoleNextUrl(_0x4d1543[_0x231668(0x204)],_0x231668(0x1b2)+_0x38efca[_0x231668(0x218)]+_0x231668(0x1c5)+_0x38efca[_0x231668(0x1e1)]),_0x14c704=_0x11a3fb[_0x231668(0x21d)];_0x14c704[_0x231668(0x1c8)]=_0x7f99d9,await handleSingleObjectOutput(_0x14c704,_0x4d1543);}else return console[_0x231668(0x1eb)](_0x231668(0x1cf)),console[_0x231668(0x1eb)](_0x231668(0x1f8)),0x1;}return 0x0;}catch(_0x3f084b){if(_0x3f084b instanceof SDKError)return console[_0x231668(0x1eb)](_0x231668(0x1d6)+_0x3f084b[_0x231668(0x1bb)]),_0x3f084b['cause']&&console[_0x231668(0x1eb)](_0x231668(0x1d9)+_0x3f084b[_0x231668(0x1da)]),0x1;throw _0x3f084b;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']=a36_0x7b3c67(0x21f);[a36_0x7b3c67(0x206)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async[a36_0x7b3c67(0x233)](_0x549d6f){const _0x223b4c=a36_0x7b3c67,{options:_0x4b41c0,args:_0x58de04,tdx:_0x3eff2e}=_0x549d6f,_0x4f70fd=_0x58de04[0x0];if(!_0x4f70fd)return console[_0x223b4c(0x1eb)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x223b4c(0x1eb)](_0x223b4c(0x21a)),console[_0x223b4c(0x1eb)](_0x223b4c(0x1f9)),console[_0x223b4c(0x1eb)]('Examples:'),console[_0x223b4c(0x1eb)](_0x223b4c(0x236)),console[_0x223b4c(0x1eb)](_0x223b4c(0x215)),0x1;try{const _0x591048=_0x4b41c0[_0x223b4c(0x1cd)],_0xaca6c=await resolveSegmentTarget(_0x4f70fd,_0x591048,_0x4b41c0['verbose']);_0x4b41c0[_0x223b4c(0x222)]&&console['error'](_0x223b4c(0x22d)+_0xaca6c);const _0x34b44a=await withSpinner('Resolving\x20\x27'+_0x4f70fd+_0x223b4c(0x1b3),()=>_0x3eff2e[_0x223b4c(0x21c)][_0x223b4c(0x195)](_0xaca6c),{'verbose':_0x4b41c0[_0x223b4c(0x222)]}),_0x546437=_0x34b44a[_0x223b4c(0x21d)];_0x4b41c0[_0x223b4c(0x222)]&&(console[_0x223b4c(0x1eb)]('Resolved\x20type:\x20'+_0x546437['type']),console['error'](_0x223b4c(0x1fc)+_0x546437[_0x223b4c(0x218)]));if(_0x546437[_0x223b4c(0x22f)]===_0x223b4c(0x1e5))return console[_0x223b4c(0x1eb)](_0x223b4c(0x196)),console[_0x223b4c(0x1eb)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x546437[_0x223b4c(0x22f)]===_0x223b4c(0x23d))return console[_0x223b4c(0x1eb)](_0x223b4c(0x1be)),console['error']('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x546437[_0x223b4c(0x1e1)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x223b4c(0x219));const _0x253333=await withSpinner(_0x223b4c(0x199),()=>_0x3eff2e['segment']['getSegmentSQL'](_0x546437[_0x223b4c(0x218)],_0x546437[_0x223b4c(0x1e1)]),{'verbose':_0x4b41c0[_0x223b4c(0x222)]}),_0x596633=_0x253333[_0x223b4c(0x21d)],_0x413ac2=await executeSchemaQuery(_0x596633,_0x3eff2e,_0x4b41c0);return await handleQueryOutput(_0x413ac2,_0x4b41c0),0x0;}catch(_0x5b169e){if(_0x5b169e instanceof SDKError)return console[_0x223b4c(0x1eb)]('Error:\x20'+_0x5b169e['message']),_0x5b169e[_0x223b4c(0x1da)]&&console[_0x223b4c(0x1eb)](_0x223b4c(0x1d9)+_0x5b169e['cause']),0x1;throw _0x5b169e;}}}
@@ -1 +1 @@
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
+ const a37_0x208471=a37_0x5546;function a37_0x5546(_0x36a649,_0x3f32ac){_0x36a649=_0x36a649-0x157;const _0x5e7922=a37_0x5e79();let _0x55464a=_0x5e7922[_0x36a649];return _0x55464a;}(function(_0x3fe773,_0x4f2474){const _0x661099=a37_0x5546,_0x521cf6=_0x3fe773();while(!![]){try{const _0x145adf=-parseInt(_0x661099(0x17a))/0x1*(-parseInt(_0x661099(0x185))/0x2)+parseInt(_0x661099(0x17c))/0x3*(parseInt(_0x661099(0x160))/0x4)+parseInt(_0x661099(0x176))/0x5+-parseInt(_0x661099(0x16d))/0x6+parseInt(_0x661099(0x15b))/0x7*(parseInt(_0x661099(0x180))/0x8)+-parseInt(_0x661099(0x174))/0x9+parseInt(_0x661099(0x17d))/0xa;if(_0x145adf===_0x4f2474)break;else _0x521cf6['push'](_0x521cf6['shift']());}catch(_0x33cc19){_0x521cf6['push'](_0x521cf6['shift']());}}}(a37_0x5e79,0x9a6b1));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a37_0x5e79(){const _0x283f48=['resolveParentId','263rRqQWA','kind','468114EtMmof','490810HwQVxk','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Resolving\x20parent\x20segment\x20\x27','1658104UrhgOy','\x27...','execute','Site:\x20','folderId','1186MaOCJC','Target\x20path:\x20','description','name','Create\x20child\x20segment\x20with\x20filtering\x20rules','verbose','✔\x20Created\x20segment\x20\x27','Resolving\x20folder\x20path\x20\x27','42VAXwCu','segment','resolveFolderId','\x20\x20\x20Path:\x20','length','4LfDpeI','noCountPopulation','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','Resolved\x20folder\x20ID:\x20','folder','site','Segment\x20name:\x20','yellow','segments','Resolving\x20folder\x20\x27','data','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','\x27\x20with\x20ID:\x20','4105716UGlYse','Parent\x20path:\x20','type','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','segmentPath','6488577GFlGpW','segment:create','2165400XITBHQ','Creating\x20segment\x20\x27','error'];a37_0x5e79=function(){return _0x283f48;};return a37_0x5e79();}import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a37_0x2b7e48 from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']=a37_0x208471(0x175);['description']=a37_0x208471(0x157);async[a37_0x208471(0x182)](_0x148886){const _0x9da009=a37_0x208471;console['error'](a37_0x2b7e48[_0x9da009(0x167)](_0x9da009(0x170))),console[_0x9da009(0x178)](a37_0x2b7e48['yellow']('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x53cc19,args:_0x339339,tdx:_0x529828}=_0x148886,_0x2a044a=_0x53cc19;if(_0x339339[_0x9da009(0x15f)]===0x0)return console['error'](_0x9da009(0x172)),console[_0x9da009(0x178)](_0x9da009(0x162)),console[_0x9da009(0x178)]('Examples:'),console[_0x9da009(0x178)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console[_0x9da009(0x178)](_0x9da009(0x171)),console[_0x9da009(0x178)](_0x9da009(0x17e)),0x1;const _0x1f0f0a=_0x339339[0x0],_0x339138=_0x53cc19[_0x9da009(0x173)];let _0x2eabd0=_0x1f0f0a;_0x339138&&!_0x1f0f0a['includes']('/')&&(_0x2eabd0=_0x339138+'/'+_0x1f0f0a,_0x2a044a[_0x9da009(0x158)]&&console[_0x9da009(0x178)]('Resolved\x20relative\x20path\x20to:\x20'+_0x2eabd0));const _0x524d34=parsePath(_0x2eabd0);if(_0x524d34[_0x9da009(0x168)][_0x9da009(0x15f)]<0x2)return console['error']('Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'),console[_0x9da009(0x178)]('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0xfdbd16=_0x524d34['segments'][0x0],_0x4ffe18=getBaseName(_0x2eabd0),_0x3cc68d=getParentPath(_0x2eabd0);_0x2a044a[_0x9da009(0x158)]&&(console['error'](_0x9da009(0x183)+_0x2a044a[_0x9da009(0x165)]),console[_0x9da009(0x178)](_0x9da009(0x186)+_0x2eabd0),console[_0x9da009(0x178)]('Parent:\x20'+_0xfdbd16),console[_0x9da009(0x178)](_0x9da009(0x166)+_0x4ffe18),console['error'](_0x9da009(0x16e)+_0x3cc68d));const _0x3fcaba=await withSpinner(_0x9da009(0x17f)+_0xfdbd16+'\x27...',()=>_0x529828[_0x9da009(0x15c)][_0x9da009(0x179)](_0xfdbd16),{'verbose':_0x2a044a[_0x9da009(0x158)]}),_0x45ee03=_0x3fcaba['data'];let _0x57fdbc;if(_0x524d34['segments']['length']>0x2){const _0x51c522=await withSpinner(_0x9da009(0x15a)+_0x3cc68d+'\x27...',()=>_0x529828[_0x9da009(0x15c)]['resolvePathToResource'](_0x3cc68d),{'verbose':_0x2a044a[_0x9da009(0x158)]}),_0x38a0e1=_0x51c522[_0x9da009(0x16a)];if(_0x38a0e1[_0x9da009(0x16f)]!=='folder'&&_0x38a0e1[_0x9da009(0x16f)]!=='parent')return console[_0x9da009(0x178)](_0x9da009(0x16b)),0x1;_0x57fdbc=_0x38a0e1[_0x9da009(0x184)];}else{if(_0x2a044a[_0x9da009(0x164)]){const _0x313010=await withSpinner(_0x9da009(0x169)+_0x2a044a['folder']+_0x9da009(0x181),()=>_0x529828['segment'][_0x9da009(0x15d)](_0x45ee03,_0x2a044a[_0x9da009(0x164)]),{'verbose':_0x2a044a['verbose']});_0x57fdbc=_0x313010[_0x9da009(0x16a)];}}_0x2a044a[_0x9da009(0x158)]&&_0x57fdbc&&console[_0x9da009(0x178)](_0x9da009(0x163)+_0x57fdbc);const _0x190338=await loadJSONFromOptions(_0x2a044a['rule'],_0x2a044a['ruleFile']),_0x214745={'name':_0x4ffe18,'description':_0x2a044a[_0x9da009(0x187)],'rule':_0x190338,'kind':_0x2a044a[_0x9da009(0x17b)]!==undefined?parseInt(_0x2a044a[_0x9da009(0x17b)],0xa):undefined,'isVisible':_0x2a044a['invisible']?![]:undefined,'segmentFolderId':_0x57fdbc,'countPopulation':_0x2a044a[_0x9da009(0x161)]?![]:undefined},_0x16dfa0=await withSpinner(_0x9da009(0x177)+_0x4ffe18+_0x9da009(0x181),()=>_0x529828[_0x9da009(0x15c)]['createSegment'](_0x45ee03,_0x214745),{'verbose':_0x2a044a[_0x9da009(0x158)]}),_0x4ce414=_0x16dfa0[_0x9da009(0x16a)];return console[_0x9da009(0x178)](_0x9da009(0x159)+_0x4ce414[_0x9da009(0x188)]+_0x9da009(0x16c)+_0x4ce414['id']),_0x2eabd0!==_0x1f0f0a&&console[_0x9da009(0x178)](_0x9da009(0x15e)+_0x2eabd0),await handleSDKOutput([_0x4ce414],_0x2a044a),0x0;}}
@@ -1 +1 @@
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
+ const a38_0x356842=a38_0x272a;(function(_0x3d2ca,_0x1c64ba){const _0x3a6cf2=a38_0x272a,_0xb800c9=_0x3d2ca();while(!![]){try{const _0x5ad0cb=parseInt(_0x3a6cf2(0x190))/0x1+parseInt(_0x3a6cf2(0x185))/0x2*(-parseInt(_0x3a6cf2(0x18a))/0x3)+parseInt(_0x3a6cf2(0x193))/0x4+-parseInt(_0x3a6cf2(0x19a))/0x5+-parseInt(_0x3a6cf2(0x18e))/0x6*(-parseInt(_0x3a6cf2(0x194))/0x7)+-parseInt(_0x3a6cf2(0x191))/0x8*(parseInt(_0x3a6cf2(0x18d))/0x9)+parseInt(_0x3a6cf2(0x195))/0xa*(parseInt(_0x3a6cf2(0x192))/0xb);if(_0x5ad0cb===_0x1c64ba)break;else _0xb800c9['push'](_0xb800c9['shift']());}catch(_0x1da129){_0xb800c9['push'](_0xb800c9['shift']());}}}(a38_0x58cb,0x2c9dc));import{BaseCommand}from'./command.js';function a38_0x272a(_0x83c0aa,_0x37716b){_0x83c0aa=_0x83c0aa-0x180;const _0x58cb6a=a38_0x58cb();let _0x272a54=_0x58cb6a[_0x83c0aa];return _0x272a54;}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a38_0x58cb(){const _0x9150be=['Listing\x20fields\x20for\x20\x27','name','parentSegment','1687895rgtDmw','Parent\x20segment:\x20','\x20field','data','site','verbose','description','4172QIjnyQ','error','json','execute','segment:fields','426aAdSaL','Site:\x20','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','682173NOFvjc','35448ufkTFz','jsonl','16821keDNaB','24JiNaCq','26279pMPBWE','1338228GzetSz','28bMJZAX','2800txfLNL','length'];a38_0x58cb=function(){return _0x9150be;};return a38_0x58cb();}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a38_0x356842(0x198)]=a38_0x356842(0x189);[a38_0x356842(0x184)]='List\x20available\x20fields\x20for\x20segmentation';async[a38_0x356842(0x188)](_0xf79474){const _0x1629f3=a38_0x356842,{options:_0x4562ac,args:_0x1e3e24,tdx:_0x2a2e28}=_0xf79474,_0x159d48=_0x1e3e24[0x0]||_0x4562ac[_0x1629f3(0x199)];if(!_0x159d48)return console[_0x1629f3(0x186)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console['error']('Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'),console[_0x1629f3(0x186)](_0x1629f3(0x18c)),0x1;_0x4562ac[_0x1629f3(0x183)]&&(console[_0x1629f3(0x186)](_0x1629f3(0x18b)+_0x4562ac[_0x1629f3(0x182)]),console[_0x1629f3(0x186)](_0x1629f3(0x19b)+_0x159d48));const _0x43fbce=await withSpinner(_0x1629f3(0x197)+_0x159d48+'\x27...',()=>_0x2a2e28['segment']['listFields'](_0x159d48),{'verbose':_0x4562ac[_0x1629f3(0x183)]}),_0x2c076e=_0x43fbce[_0x1629f3(0x181)];console[_0x1629f3(0x186)]('✔\x20Found\x20'+_0x2c076e['length']+_0x1629f3(0x180)+(_0x2c076e[_0x1629f3(0x196)]!==0x1?'s':''));if(_0x4562ac[_0x1629f3(0x187)]||_0x4562ac[_0x1629f3(0x18f)])return await handleSDKOutput(_0x2c076e,_0x4562ac),0x0;return displayFieldsHumanReadable(_0x2c076e,_0x159d48),0x0;}}
@@ -1 +1 @@
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;}}
1
+ const a39_0x32d6c0=a39_0x5af9;function a39_0x1c71(){const _0x4e0e5c=['errorCode','files','execute','setPhase','✔\x20All\x20files\x20are\x20up\x20to\x20date','595125MfYNFh','parentName','✔\x20Context\x20set:\x20','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','\x20\x20🗺️\x20\x20','activations','10168740DAKoiq','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','\x20with\x20','yellow','32612136QiBrmm','absolutePath','journeys','3366075sQnUpj','counts','green','segment','relativePath','\x20=\x20','hasChanges','helpText','parent_segment','Site:\x20','2221562xfgspa','Parent\x20segment:\x20','3827384qNDUHT','-\x20no\x20files\x20written','yes','1strkAC','session','name','1229756fhHHJO','error','\x20changed\x20files','Aborted.','dirname','dim','filter','length','\x20segments','isNew','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','journeyVersions','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','targetDir','\x27...','Error:\x20','dryRun','content','Target\x20resource:\x20','\x20new\x20files','\x20\x20🎯\x20','Write\x20','site','segments','verbose','\x20files?','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','no_parent','type','utf-8','cyan','\x20journeys','\x20unchanged\x20files','red','diff','parentSegment','segment:pull','\x0aPull\x20summary\x20for\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','repeat'];a39_0x1c71=function(){return _0x4e0e5c;};return a39_0x1c71();}(function(_0x22cf00,_0x2a9327){const _0x5ca303=a39_0x5af9,_0x1cf6f9=_0x22cf00();while(!![]){try{const _0x2bd9c1=parseInt(_0x5ca303(0x17e))/0x1*(-parseInt(_0x5ca303(0x181))/0x2)+-parseInt(_0x5ca303(0x162))/0x3+-parseInt(_0x5ca303(0x17b))/0x4+parseInt(_0x5ca303(0x16f))/0x5+-parseInt(_0x5ca303(0x168))/0x6+-parseInt(_0x5ca303(0x179))/0x7+parseInt(_0x5ca303(0x16c))/0x8;if(_0x2bd9c1===_0x2a9327)break;else _0x1cf6f9['push'](_0x1cf6f9['shift']());}catch(_0x2b3d3f){_0x1cf6f9['push'](_0x1cf6f9['shift']());}}}(a39_0x1c71,0xec335));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a39_0xf56971 from'chalk';function a39_0x5af9(_0x5dd25d,_0x4e8511){_0x5dd25d=_0x5dd25d-0x142;const _0x1c71af=a39_0x1c71();let _0x5af9a3=_0x1c71af[_0x5dd25d];return _0x5af9a3;}import{existsSync,mkdirSync,writeFileSync}from'fs';import a39_0x1be9fc 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{[a39_0x32d6c0(0x180)]=a39_0x32d6c0(0x159);['description']='Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files';async[a39_0x32d6c0(0x15f)](_0x36cccd){const _0x59013a=a39_0x32d6c0,{options:_0xbf71ab,args:_0x109604,tdx:_0x22ebde}=_0x36cccd,_0x5943dc=_0xbf71ab,_0x2cc56a=await resolveTarget({'arg':_0x109604[0x0],'contextParent':_0xbf71ab[_0x59013a(0x158)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x2cc56a))return _0x2cc56a[_0x59013a(0x15d)]===_0x59013a(0x150)?(console[_0x59013a(0x182)](a39_0xf56971[_0x59013a(0x16b)](_0x59013a(0x14f))),console[_0x59013a(0x182)]('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[_0x59013a(0x182)](_0x59013a(0x18b)),console[_0x59013a(0x182)](_0x59013a(0x15b))):(console[_0x59013a(0x182)](a39_0xf56971[_0x59013a(0x156)](_0x59013a(0x144)+_0x2cc56a['message']+'\x0a')),_0x2cc56a['helpText']&&console[_0x59013a(0x182)](a39_0xf56971[_0x59013a(0x153)](_0x2cc56a[_0x59013a(0x176)]))),0x1;const _0x19a20b=_0x2cc56a['parentName'],_0x11d5a0=_0x2cc56a[_0x59013a(0x142)],_0x372047=_0x2cc56a[_0x59013a(0x151)]==='file'?_0x2cc56a['resourceName']:undefined;_0x5943dc['verbose']&&(console[_0x59013a(0x182)](_0x59013a(0x178)+_0x5943dc[_0x59013a(0x14b)]),console[_0x59013a(0x182)](_0x59013a(0x17a)+_0x19a20b),_0x372047&&console[_0x59013a(0x182)](_0x59013a(0x147)+_0x372047));const _0x22895=await withProgressSpinner('Pulling\x20segments\x20from\x20\x27'+_0x19a20b+_0x59013a(0x143),_0x1a187b=>_0x22ebde[_0x59013a(0x172)]['pullSegments'](_0x19a20b,{'targetDir':_0x11d5a0,'targetResourceName':_0x372047,'verbose':_0x5943dc['verbose'],'progress':{'update':_0x543653=>{const _0x49d9ad=_0x59013a;_0x1a187b[_0x49d9ad(0x160)](_0x543653),_0x5943dc[_0x49d9ad(0x14d)]&&console[_0x49d9ad(0x182)]('\x20\x20'+_0x543653);}}}),{'verbose':_0x5943dc[_0x59013a(0x14d)]}),_0x26a4cb=_0x22895['data'];if(_0x26a4cb['counts'][_0x59013a(0x14c)]===0x0&&_0x26a4cb[_0x59013a(0x170)][_0x59013a(0x16e)]===0x0)return console['error'](a39_0xf56971[_0x59013a(0x16b)](_0x59013a(0x165)+_0x26a4cb[_0x59013a(0x163)]+'\x27')),0x0;const _0x11de51=_0x26a4cb[_0x59013a(0x15e)]['filter'](_0x5cc29=>_0x5cc29[_0x59013a(0x18a)]),_0x386bc8=_0x26a4cb['files'][_0x59013a(0x187)](_0x21389e=>!_0x21389e[_0x59013a(0x18a)]&&_0x21389e['hasChanges']),_0x3d7477=_0x26a4cb[_0x59013a(0x15e)][_0x59013a(0x187)](_0x5e29a2=>!_0x5e29a2[_0x59013a(0x18a)]&&!_0x5e29a2[_0x59013a(0x175)]);console[_0x59013a(0x182)](_0x59013a(0x15a)+_0x26a4cb['parentName']+'\x27:'),console[_0x59013a(0x182)](_0x59013a(0x149)+a39_0xf56971[_0x59013a(0x153)](_0x26a4cb[_0x59013a(0x170)][_0x59013a(0x14c)]+_0x59013a(0x189))+_0x59013a(0x16a)+a39_0xf56971[_0x59013a(0x153)](_0x26a4cb[_0x59013a(0x170)][_0x59013a(0x167)]+'\x20activations'));if(_0x26a4cb[_0x59013a(0x170)][_0x59013a(0x16e)]>0x0){const _0x36705e=_0x26a4cb[_0x59013a(0x170)][_0x59013a(0x18c)]>_0x26a4cb[_0x59013a(0x170)][_0x59013a(0x16e)]?'\x20('+_0x26a4cb[_0x59013a(0x170)][_0x59013a(0x18c)]+'\x20versions)':'';console[_0x59013a(0x182)](_0x59013a(0x166)+a39_0xf56971[_0x59013a(0x153)](_0x26a4cb[_0x59013a(0x170)][_0x59013a(0x16e)]+_0x59013a(0x154))+a39_0xf56971['dim'](_0x36705e));}console[_0x59013a(0x182)]('\x20\x20'+a39_0xf56971[_0x59013a(0x171)]('+\x20'+_0x11de51['length']+_0x59013a(0x148))),console[_0x59013a(0x182)]('\x20\x20'+a39_0xf56971[_0x59013a(0x16b)]('~\x20'+_0x386bc8[_0x59013a(0x188)]+_0x59013a(0x183))),console[_0x59013a(0x182)]('\x20\x20'+a39_0xf56971[_0x59013a(0x186)]('=\x20'+_0x3d7477['length']+_0x59013a(0x155))),console[_0x59013a(0x182)]('\x20\x20Target:\x20'+a39_0xf56971['cyan'](_0x26a4cb[_0x59013a(0x142)])+'\x0a');if(_0x386bc8['length']>0x0)for(const _0x3e738a of _0x386bc8){console[_0x59013a(0x182)]('\x0aChanges\x20to\x20\x27'+_0x3e738a[_0x59013a(0x173)]+'\x27:'),console['error']('─'[_0x59013a(0x15c)](0x3c)),console[_0x59013a(0x182)](_0x3e738a[_0x59013a(0x157)]),console[_0x59013a(0x182)]('─'[_0x59013a(0x15c)](0x3c));}if(_0x5943dc[_0x59013a(0x145)])return console['error'](a39_0xf56971[_0x59013a(0x16b)](_0x59013a(0x18d))),0x0;if(_0x11de51[_0x59013a(0x188)]===0x0&&_0x386bc8[_0x59013a(0x188)]===0x0)return console['error'](a39_0xf56971[_0x59013a(0x171)](_0x59013a(0x161))),saveSessionContext({'parent_segment':_0x26a4cb[_0x59013a(0x163)]},_0x5943dc[_0x59013a(0x17f)]),console[_0x59013a(0x182)](a39_0xf56971[_0x59013a(0x171)](_0x59013a(0x164)+a39_0xf56971[_0x59013a(0x186)](_0x59013a(0x177))+_0x59013a(0x174)+a39_0xf56971['cyan'](_0x26a4cb[_0x59013a(0x163)]))),0x0;if(!_0x5943dc[_0x59013a(0x17d)]){if(!isInteractive())return console[_0x59013a(0x182)](a39_0xf56971['red']('\x0aError:'),_0x59013a(0x169)),console['error'](a39_0xf56971[_0x59013a(0x186)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x3452da=await confirmKey(_0x59013a(0x14a)+(_0x11de51[_0x59013a(0x188)]+_0x386bc8['length'])+_0x59013a(0x14e));if(!_0x3452da)return console['error'](a39_0xf56971[_0x59013a(0x16b)](_0x59013a(0x184)),_0x59013a(0x17c)),0x1;}for(const _0x900908 of _0x26a4cb[_0x59013a(0x15e)]){if(_0x900908[_0x59013a(0x18a)]||_0x900908['hasChanges']){const _0x23c0a1=a39_0x1be9fc[_0x59013a(0x185)](_0x900908[_0x59013a(0x16d)]);!existsSync(_0x23c0a1)&&mkdirSync(_0x23c0a1,{'recursive':!![]}),writeFileSync(_0x900908[_0x59013a(0x16d)],_0x900908[_0x59013a(0x146)],_0x59013a(0x152));}}return console[_0x59013a(0x182)](a39_0xf56971[_0x59013a(0x171)]('✔\x20Pulled\x20'+(_0x11de51[_0x59013a(0x188)]+_0x386bc8[_0x59013a(0x188)])+'\x20files\x20to\x20'+_0x26a4cb['targetDir'])),saveSessionContext({'parent_segment':_0x26a4cb['parentName']},_0x5943dc[_0x59013a(0x17f)]),console[_0x59013a(0x182)](a39_0xf56971[_0x59013a(0x171)](_0x59013a(0x164)+a39_0xf56971['dim'](_0x59013a(0x177))+_0x59013a(0x174)+a39_0xf56971['cyan'](_0x26a4cb[_0x59013a(0x163)]))),0x0;}}