@treasuredata/tdx 2026.3.24 → 2026.3.25

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_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
+ const a34_0x16f7ea=a34_0x3f3d;(function(_0x4389d8,_0x36cfe7){const _0x192d32=a34_0x3f3d,_0x2938f8=_0x4389d8();while(!![]){try{const _0x11af85=parseInt(_0x192d32(0x1b0))/0x1+parseInt(_0x192d32(0x1a3))/0x2*(-parseInt(_0x192d32(0x1a2))/0x3)+parseInt(_0x192d32(0x1a5))/0x4*(-parseInt(_0x192d32(0x17f))/0x5)+-parseInt(_0x192d32(0x18f))/0x6*(parseInt(_0x192d32(0x185))/0x7)+-parseInt(_0x192d32(0x198))/0x8*(-parseInt(_0x192d32(0x19a))/0x9)+parseInt(_0x192d32(0x1aa))/0xa+-parseInt(_0x192d32(0x1b3))/0xb*(parseInt(_0x192d32(0x194))/0xc);if(_0x11af85===_0x36cfe7)break;else _0x2938f8['push'](_0x2938f8['shift']());}catch(_0x12f15c){_0x2938f8['push'](_0x2938f8['shift']());}}}(a34_0x54ce,0xd0489));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a34_0x3f3d(_0x430bba,_0xe077f4){_0x430bba=_0x430bba-0x17e;const _0x54ce3f=a34_0x54ce();let _0x3f3da4=_0x54ce3f[_0x430bba];return _0x3f3da4;}import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';function a34_0x54ce(){const _0x9e6e5f=['in\x20','execute','1161202KoIKGf','\x20rows\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','11AVEUFd','query','\x0aAll\x20results\x20saved\x20to\x20','No\x20SQL\x20provided','args','754405zhUuGN','Executing\x20query\x20[','totalSplits','completedSplits','validate','Executing\x20query...','154KjaJPL','stats','database','processedRows','error','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','Error:\x20','name','information_schema','Statement\x20','251514fSdUiZ','output','jobId','setExtra','SQL:\x20','2645652VbhtYh','\x20[Job\x20ID:\x20','Run\x20Trino\x20queries\x20(streaming)','elapsedTimeMillis','64VjCXUf','setPhase','1643283htKyyQ','Query\x20completed:\x20Processed\x20','description','join','file','...','setJobId','Catalog:\x20','21gXqWnU','174332HaeRYN','length','4TEjQRN','state','message','push','data','1349630mVGbIh','originalMessage','verbose','Executing\x20statement\x20'];a34_0x54ce=function(){return _0x9e6e5f;};return a34_0x54ce();}import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a34_0x16f7ea(0x18c)]=a34_0x16f7ea(0x1b4);[a34_0x16f7ea(0x19c)]=a34_0x16f7ea(0x196);async[a34_0x16f7ea(0x1af)](_0x1c2774){const _0x51b748=a34_0x16f7ea,{options:_0x518900,args:_0x3b75bc,tdx:_0x568802}=_0x1c2774,_0x2fbb92={..._0x518900,'limitStructuredFormats':!![]},_0x18b833=_0x3b75bc[0x0],_0x19a503=_0x518900['file'];let _0x5df2ee;try{if(_0x19a503)_0x5df2ee=readSqlStatementsFromFile(_0x19a503);else{if(_0x18b833==='-')_0x5df2ee=await readSqlStatementsFromStdin();else{if(_0x18b833&&isSqlFilePath(_0x18b833))_0x5df2ee=readSqlStatementsFromFile(_0x18b833);else{if(_0x18b833)_0x5df2ee=splitSqlStatements(_0x18b833);else throw new Error(_0x51b748(0x1b6));}}}}catch(_0x56bb4a){return console[_0x51b748(0x189)](_0x51b748(0x18b)+_0x56bb4a[_0x51b748(0x1a7)]),0x1;}const _0x297abe=_0x518900[_0x51b748(0x187)]||_0x51b748(0x18d),_0x5244e7=_0x518900['catalog'];try{const _0x2d71a2=[],_0x20e8bf=!!_0x518900[_0x51b748(0x190)];for(let _0x2344a7=0x0;_0x2344a7<_0x5df2ee[_0x51b748(0x1a4)];_0x2344a7++){const _0x34be80=_0x5df2ee[_0x2344a7],_0x2e4582=_0x2344a7+0x1,_0xa4a6ab=_0x5df2ee['length'],_0x3f1ac4=_0xa4a6ab>0x1;_0x518900[_0x51b748(0x1ac)]&&(console[_0x51b748(0x189)]('\x0a'+(_0x3f1ac4?_0x51b748(0x18e)+_0x2e4582+'/'+_0xa4a6ab+':':'')),console[_0x51b748(0x189)]('Site:\x20'+_0x518900['site']),console[_0x51b748(0x189)](_0x51b748(0x1a1)+(_0x5244e7||'td')),console[_0x51b748(0x189)]('Schema:\x20'+_0x297abe),console[_0x51b748(0x189)](_0x51b748(0x193)+_0x34be80));const _0x163021=_0x3f1ac4?_0x51b748(0x1ad)+_0x2e4582+'/'+_0xa4a6ab+_0x51b748(0x19f):_0x51b748(0x184);try{const _0x34c6af=await withProgressSpinner(_0x163021,async _0x4a33ec=>{const _0x331834=_0x51b748,_0xc91282=await _0x568802[_0x331834(0x1b4)][_0x331834(0x1af)](_0x34be80,{'catalog':_0x5244e7,'schema':_0x297abe,'onJobId':_0x2b47b2=>{const _0x181402=_0x331834;_0x4a33ec[_0x181402(0x1a0)](_0x2b47b2);},'onProgress':_0x46a999=>{const _0x5d3509=_0x331834;_0x4a33ec[_0x5d3509(0x199)](_0x5d3509(0x180)+_0x46a999[_0x5d3509(0x1a6)]+']'),_0x4a33ec[_0x5d3509(0x192)](formatRows(_0x46a999[_0x5d3509(0x188)])+_0x5d3509(0x1b1)+_0x46a999[_0x5d3509(0x182)]+'/'+_0x46a999[_0x5d3509(0x181)]+'\x20splits');}});return _0xc91282;},{'verbose':_0x518900[_0x51b748(0x1ac)]}),_0x808de2=_0x34c6af[_0x51b748(0x1a9)],_0x31e953=_0x808de2[_0x51b748(0x191)]?_0x51b748(0x195)+_0x808de2[_0x51b748(0x191)]+']':'',_0x29a1b7=_0x3f1ac4?'Statement\x20'+_0x2e4582+'/'+_0xa4a6ab+'\x20-\x20':'';console['error']('✔\x20'+_0x29a1b7+_0x51b748(0x19b)+formatRows(_0x808de2[_0x51b748(0x186)][_0x51b748(0x188)])+_0x51b748(0x1b1)+(_0x51b748(0x1ae)+formatElapsed(_0x808de2[_0x51b748(0x186)][_0x51b748(0x197)])+_0x31e953));if(_0x3f1ac4&&_0x20e8bf){const _0x22fc31=resolveOutputOptions(_0x2fbb92),_0xb5fbf1=await formatQueryOutput(_0x808de2,_0x22fc31);_0x2d71a2[_0x51b748(0x1a8)](_0xb5fbf1);}else await handleQueryOutput(_0x808de2,_0x2fbb92);}catch(_0x493989){const _0x688b1b=_0x3f1ac4?_0x51b748(0x18e)+_0x2e4582+'/'+_0xa4a6ab+':\x0a':'',_0x5129a9=_0x493989 instanceof SDKError?_0x493989[_0x51b748(0x1ab)]:_0x493989[_0x51b748(0x1a7)];return console[_0x51b748(0x189)](''+_0x688b1b+_0x5129a9),0x1;}}if(_0x5df2ee[_0x51b748(0x1a4)]>0x1&&_0x20e8bf&&_0x2d71a2['length']>0x0){const _0x1b5e0c=_0x2d71a2[_0x51b748(0x19d)]('\x0a');writeFileSync(_0x518900[_0x51b748(0x190)],_0x1b5e0c),console[_0x51b748(0x189)](_0x51b748(0x1b5)+_0x518900[_0x51b748(0x190)]);}return 0x0;}catch(_0x4fafaf){throw _0x4fafaf;}}[a34_0x16f7ea(0x183)](_0x4b3bd6){const _0x498395=a34_0x16f7ea,_0x5e938c=_0x4b3bd6[_0x498395(0x17e)][0x0],_0x1f8241=_0x4b3bd6['options'][_0x498395(0x19e)];if(!_0x5e938c&&!_0x1f8241)return _0x498395(0x18a);if(_0x5e938c&&_0x1f8241)return _0x498395(0x1b2);return undefined;}}
@@ -1 +1 @@
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
+ const a35_0x1ec585=a35_0x26c2;(function(_0x56c62b,_0x270498){const _0x11c6c9=a35_0x26c2,_0x512e84=_0x56c62b();while(!![]){try{const _0x9115f0=parseInt(_0x11c6c9(0xe5))/0x1+parseInt(_0x11c6c9(0xcf))/0x2*(parseInt(_0x11c6c9(0xaf))/0x3)+-parseInt(_0x11c6c9(0xd2))/0x4+parseInt(_0x11c6c9(0xe2))/0x5+parseInt(_0x11c6c9(0x80))/0x6+-parseInt(_0x11c6c9(0xeb))/0x7+-parseInt(_0x11c6c9(0xb1))/0x8;if(_0x9115f0===_0x270498)break;else _0x512e84['push'](_0x512e84['shift']());}catch(_0x3de4d0){_0x512e84['push'](_0x512e84['shift']());}}}(a35_0x27aa,0x429be));import{BaseCommand}from'./command.js';function a35_0x26c2(_0x24a689,_0x220184){_0x24a689=_0x24a689-0x65;const _0x27aa62=a35_0x27aa();let _0x26c238=_0x27aa62[_0x24a689];return _0x26c238;}function a35_0x27aa(){const _0x3e6df4=['Getting\x20schedule\x20details...','has_next_page','List\x20scheduled\x20queries','job_id','success','queries','Create\x20a\x20scheduled\x20query','type','length','retryLimit','Getting\x20schedule\x20history...','join','2022560xFzegX','num','Schedule\x20run\x20submitted:\x20','404219DKTdiy','verbose','user','timezone','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','args','2986249QBhOFJ','priority','table','format','count','ended_at','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','Delete\x20a\x20scheduled\x20query','engine_version','lastRun','history','red','last_job','never','Creating\x20schedule:\x20','time','...','end_at','show','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','options','create','Listing\x20scheduled\x20queries...','trino','Update\x20a\x20scheduled\x20query','Searching\x20scheduled\x20queries\x20matching\x20\x22','query','file','in\x20','cron','padEnd','1214364zHzwbU','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','tsv','soon','schedule:update','delete','Schedule\x20updated:\x20','nextRun','Updating\x20schedule...','substring','next_run_at','Show\x20schedule\x20details','engineVersion','scheduled_at','\x20\x20→\x20','run','updated_at','Updating\x20schedule:\x20','result','max','INVALID_ARGUMENT','from','Running\x20schedule...','No\x20scheduled\x20queries\x20found','/app/queries/editor?queryId=','status','Failed\x20to\x20read\x20file:\x20','statusIcon','execute','database','delay','green','\x22...','jobs','user_name','schedule:create','repeat','limit','name','Running\x20schedule:\x20','map','dim','retry_limit','schedules','validate','queryUrl','\x20scheduled\x20quer','3dUiCUx','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','1272224iMcXYS','Schedule\x20deleted:\x20','\x20(showing\x20','\x20matching\x20\x22','log','pagination','created_at','h\x20ago','time_zone','Cancelled','keys','Schedule\x20created:\x20','yes','(unnamed)','utf-8','data','Showing\x20first\x20','jsonl','\x20created','Query\x20file\x20is\x20empty','\x20\x20Job\x20ID:\x20','schedule:run','Creating\x20schedule...','d\x20ago','error','\x20\x20Num:\x20','\x20\x20Database:\x20','site','round','getTime','258058tWFuzU','Found\x20','description','1126756lKLafg','schedule:list','📅\x20','\x20job'];a35_0x27aa=function(){return _0x3e6df4;};return a35_0x27aa();}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_0x263868 from'chalk';function formatRelativeTime(_0x4b2ea3){const _0x5c4ed0=a35_0x26c2,_0x2273ab=new Date(_0x4b2ea3),_0x2d75ca=new Date(),_0x4f6f41=_0x2273ab[_0x5c4ed0(0xce)]()-_0x2d75ca['getTime'](),_0x54976c=Math['abs'](_0x4f6f41)/0x3e8,_0xda2f25=_0x4f6f41<0x0;if(_0x54976c<0x3c)return _0xda2f25?'just\x20now':_0x5c4ed0(0x83);else{if(_0x54976c<0xe10){const _0x4022ce=Math[_0x5c4ed0(0xcd)](_0x54976c/0x3c);return _0xda2f25?_0x4022ce+'m\x20ago':_0x5c4ed0(0x7d)+_0x4022ce+'m';}else{if(_0x54976c<0x15180){const _0x47279a=Math[_0x5c4ed0(0xcd)](_0x54976c/0xe10);return _0xda2f25?_0x47279a+_0x5c4ed0(0xb8):'in\x20'+_0x47279a+'h';}else{if(_0x54976c<0x93a80){const _0x3e6846=Math[_0x5c4ed0(0xcd)](_0x54976c/0x15180);return _0xda2f25?_0x3e6846+_0x5c4ed0(0xc8):_0x5c4ed0(0x7d)+_0x3e6846+'d';}else return _0x2273ab['toLocaleDateString']();}}}}export class ScheduleListCommand extends BaseCommand{['name']=a35_0x1ec585(0xd3);[a35_0x1ec585(0xd1)]=a35_0x1ec585(0xd8);async[a35_0x1ec585(0x9c)](_0x209d3a){const _0x118f33=a35_0x1ec585,{options:_0x1da2ef,args:_0x5d94eb,tdx:_0x47ce65}=_0x209d3a,_0x511a30=resolveLimit(_0x1da2ef[_0x118f33(0xa5)],DEFAULT_DISPLAY_LIMIT),_0x159dd4=_0x5d94eb[0x0],_0xc92e13=_0x159dd4?_0x118f33(0x7a)+_0x159dd4+_0x118f33(0xa0):_0x118f33(0x77),_0x1829af=await withSpinner(_0xc92e13,()=>_0x47ce65[_0x118f33(0xab)]['listQueries']({'limit':_0x511a30,'scheduled':!![],'pattern':_0x159dd4}),{'verbose':_0x1da2ef[_0x118f33(0xe6)]}),_0x33cc64=_0x1829af[_0x118f33(0xc0)][_0x118f33(0xdb)],_0x327f95=_0x1829af[_0x118f33(0xc0)][_0x118f33(0xb6)][_0x118f33(0xd7)],_0x329a31=_0x159dd4?_0x118f33(0xb4)+_0x159dd4+'\x22':'';_0x327f95?console[_0x118f33(0xc9)](_0x118f33(0xc1)+_0x33cc64['length']+'\x20schedules'+_0x329a31+'\x20(use\x20--limit\x20to\x20see\x20more)'):console[_0x118f33(0xc9)](_0x118f33(0xd0)+_0x33cc64[_0x118f33(0xde)]+_0x118f33(0xae)+(_0x33cc64['length']!==0x1?'ies':'y')+_0x329a31);if(_0x1da2ef[_0x118f33(0xee)]==='json'||_0x1da2ef[_0x118f33(0xee)]===_0x118f33(0xc2)||_0x1da2ef['format']===_0x118f33(0xed)||_0x1da2ef[_0x118f33(0xee)]===_0x118f33(0x82)){const _0x281898=_0x33cc64[_0x118f33(0xa8)](_0x81e069=>({'id':_0x81e069['id'],'name':_0x81e069[_0x118f33(0xa6)],'cron':_0x81e069[_0x118f33(0x7e)],'database':_0x81e069['database']?.['name'],'type':_0x81e069['type'],'timezone':_0x81e069[_0x118f33(0xb9)],'user_name':_0x81e069[_0x118f33(0xe7)]?.[_0x118f33(0xa6)],'updated_at':_0x81e069[_0x118f33(0x90)],'next_run_at':_0x81e069[_0x118f33(0x8a)],'last_job_status':_0x81e069[_0x118f33(0x6d)]?.[_0x118f33(0x99)]}));await handleSDKOutput(_0x281898,_0x1da2ef);}else{if(_0x33cc64['length']===0x0)console[_0x118f33(0xb5)](_0x118f33(0x97));else{const _0x1e0af7=_0x1da2ef[_0x118f33(0xcc)],_0xaff628=_0x33cc64[_0x118f33(0xa8)](_0x1bc16d=>{const _0x1878de=_0x118f33,_0x205238=_0x1bc16d[_0x1878de(0x6d)]?.[_0x1878de(0x99)]?_0x1bc16d[_0x1878de(0x6d)][_0x1878de(0x99)]===_0x1878de(0xda)?'✓':'✗':'-',_0x44f8e3=_0x1bc16d[_0x1878de(0x6d)]?.[_0x1878de(0x66)]?formatRelativeTime(_0x1bc16d['last_job'][_0x1878de(0x66)]):_0x1878de(0x6e),_0xc0c6ca=_0x1bc16d[_0x1878de(0x8a)]?formatRelativeTime(_0x1bc16d[_0x1878de(0x8a)]):'-',_0x76107d=_0x1bc16d['cron']||'',_0xc90771=_0x1bc16d[_0x1878de(0xa6)]||_0x1878de(0xbe),_0x466f9f=getConsoleUrl(_0x1e0af7,_0x1878de(0x98)+_0x1bc16d['id']);return{'statusIcon':_0x205238,'lastRun':_0x44f8e3,'nextRun':_0xc0c6ca,'cron':_0x76107d,'name':_0xc90771,'queryUrl':_0x466f9f,'status':_0x1bc16d[_0x1878de(0x6d)]?.[_0x1878de(0x99)]};}),_0x30853b=Math[_0x118f33(0x93)](..._0xaff628['map'](_0x40a4dc=>_0x40a4dc[_0x118f33(0x6a)][_0x118f33(0xde)])),_0x181902=Math[_0x118f33(0x93)](..._0xaff628[_0x118f33(0xa8)](_0x377289=>_0x377289[_0x118f33(0x87)][_0x118f33(0xde)])),_0x102fd0=Math[_0x118f33(0x93)](..._0xaff628[_0x118f33(0xa8)](_0x31e09a=>_0x31e09a['cron'][_0x118f33(0xde)])),_0x19672c=_0xaff628[_0x118f33(0xa8)](_0x17b3d8=>{const _0x1376be=_0x118f33,_0x358fc4=_0x17b3d8[_0x1376be(0x99)]===_0x1376be(0xda)?a35_0x263868[_0x1376be(0x9f)](_0x17b3d8[_0x1376be(0x9b)]):_0x17b3d8['status']===_0x1376be(0xc9)?a35_0x263868[_0x1376be(0x6c)](_0x17b3d8[_0x1376be(0x9b)]):a35_0x263868[_0x1376be(0xa9)](_0x17b3d8[_0x1376be(0x9b)]),_0x29dbb6=_0x17b3d8[_0x1376be(0x6a)][_0x1376be(0x7f)](_0x30853b),_0x462360=_0x17b3d8['nextRun'][_0x1376be(0x7f)](_0x181902),_0x1a14a7=_0x17b3d8['cron']?a35_0x263868['cyan'](_0x17b3d8[_0x1376be(0x7e)][_0x1376be(0x7f)](_0x102fd0)):'\x20'[_0x1376be(0xa4)](_0x102fd0),_0x3f3398=hyperlink(_0x17b3d8[_0x1376be(0xa6)],_0x17b3d8[_0x1376be(0xad)]);return _0x1376be(0xd4)+_0x358fc4+'\x20'+_0x29dbb6+_0x1376be(0x8e)+_0x462360+'\x20\x20'+_0x1a14a7+'\x20\x20'+_0x3f3398;});await writeOutput(_0x19672c[_0x118f33(0xe1)]('\x0a'),_0x1da2ef['output'],'list');}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{['name']='schedule:show';[a35_0x1ec585(0xd1)]=a35_0x1ec585(0x8b);[a35_0x1ec585(0xac)](_0x56b8b3){const _0x22822d=a35_0x1ec585,_0x1b91c9=_0x56b8b3[_0x22822d(0xea)][0x0];if(!_0x1b91c9)return _0x22822d(0x81);return undefined;}async[a35_0x1ec585(0x9c)](_0x517d59){const _0x3458aa=a35_0x1ec585,{options:_0x4a86ae,args:_0x124ea6,tdx:_0x5c7cce}=_0x517d59,_0x483ae5=_0x124ea6[0x0],_0x381a71=await withSpinner(_0x3458aa(0xd6),()=>_0x5c7cce[_0x3458aa(0xab)][_0x3458aa(0x73)](_0x483ae5),{'verbose':_0x4a86ae[_0x3458aa(0xe6)]}),_0x4621ad=_0x381a71['data'],_0xbb45f6={'name':_0x4621ad[_0x3458aa(0xa6)],'cron':_0x4621ad[_0x3458aa(0x7e)],'database':_0x4621ad[_0x3458aa(0x9d)],'type':_0x4621ad['type'],'timezone':_0x4621ad[_0x3458aa(0xe8)],'user_name':_0x4621ad[_0x3458aa(0xa2)],'created_at':_0x4621ad[_0x3458aa(0xb7)],'engine_version':_0x4621ad['engine_version'],'executing_user_id':_0x4621ad['executing_user_id'],'query':_0x4621ad[_0x3458aa(0x7b)],'delay':_0x4621ad['delay'],'priority':_0x4621ad[_0x3458aa(0xec)],'retry_limit':_0x4621ad[_0x3458aa(0xaa)],..._0x4621ad['result']&&{'result':_0x4621ad['result']}};return await handleSingleObjectOutput(_0xbb45f6,_0x4a86ae),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a35_0x1ec585(0xa6)]=a35_0x1ec585(0xa3);[a35_0x1ec585(0xd1)]=a35_0x1ec585(0xdc);[a35_0x1ec585(0xac)](_0x2e9717){const _0x3185a7=a35_0x1ec585,_0x18cf42=_0x2e9717[_0x3185a7(0xea)][0x0];if(!_0x18cf42)return _0x3185a7(0x74);const _0x17adeb=_0x2e9717[_0x3185a7(0x75)];if(!_0x17adeb[_0x3185a7(0x9d)])return'Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';return undefined;}async[a35_0x1ec585(0x9c)](_0x4bb4cd){const _0x5b14f6=a35_0x1ec585,{options:_0x123a75,args:_0x3efc40,tdx:_0x22fd71}=_0x4bb4cd,_0xa71f1c=_0x3efc40[0x0],_0x1c0fdb=_0x123a75,_0x2061ba=_0x1c0fdb['database'],_0x581124=_0x1c0fdb[_0x5b14f6(0x7c)],_0x66d754=_0x1c0fdb[_0x5b14f6(0xdd)]||_0x5b14f6(0x78);let _0x155ef2;try{_0x155ef2=readFileSync(_0x581124,_0x5b14f6(0xbf))['trim']();}catch(_0x4b7b2d){throw new SDKError(ErrorCode[_0x5b14f6(0x94)],_0x5b14f6(0x9a)+_0x581124,_0x4b7b2d instanceof Error?_0x4b7b2d:undefined);}if(!_0x155ef2)throw new SDKError(ErrorCode[_0x5b14f6(0x94)],_0x5b14f6(0xc4));const _0x4a37d7={'database':_0x2061ba,'query':_0x155ef2,'type':_0x66d754};if(_0x1c0fdb[_0x5b14f6(0x7e)])_0x4a37d7['cron']=_0x1c0fdb[_0x5b14f6(0x7e)];if(_0x1c0fdb[_0x5b14f6(0xe8)])_0x4a37d7[_0x5b14f6(0xe8)]=_0x1c0fdb[_0x5b14f6(0xe8)];if(_0x1c0fdb['delay']!==undefined)_0x4a37d7[_0x5b14f6(0x9e)]=Number(_0x1c0fdb['delay']);if(_0x1c0fdb[_0x5b14f6(0xec)]!==undefined)_0x4a37d7[_0x5b14f6(0xec)]=Number(_0x1c0fdb[_0x5b14f6(0xec)]);if(_0x1c0fdb[_0x5b14f6(0xdf)]!==undefined)_0x4a37d7[_0x5b14f6(0xaa)]=Number(_0x1c0fdb[_0x5b14f6(0xdf)]);if(_0x1c0fdb['engineVersion'])_0x4a37d7[_0x5b14f6(0x69)]=_0x1c0fdb['engineVersion'];if(_0x1c0fdb[_0x5b14f6(0x92)])_0x4a37d7[_0x5b14f6(0x92)]=_0x1c0fdb['result'];if(_0x123a75['verbose']){console['error'](_0x5b14f6(0x6f)+_0xa71f1c),console['error'](_0x5b14f6(0xcb)+_0x2061ba),console['error']('\x20\x20Type:\x20'+_0x66d754);if(_0x4a37d7[_0x5b14f6(0x7e)])console[_0x5b14f6(0xc9)]('\x20\x20Cron:\x20'+_0x4a37d7[_0x5b14f6(0x7e)]);if(_0x4a37d7[_0x5b14f6(0xe8)])console[_0x5b14f6(0xc9)]('\x20\x20Timezone:\x20'+_0x4a37d7['timezone']);}const _0x2f9e99=await withSpinner(_0x5b14f6(0xc7),()=>_0x22fd71[_0x5b14f6(0xab)][_0x5b14f6(0x76)](_0xa71f1c,_0x4a37d7),{'verbose':_0x123a75[_0x5b14f6(0xe6)]});return console[_0x5b14f6(0xc9)](_0x5b14f6(0xbc)+_0x2f9e99[_0x5b14f6(0xc0)][_0x5b14f6(0xa6)]),await handleSingleObjectOutput(_0x2f9e99[_0x5b14f6(0xc0)],_0x123a75),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{['name']=a35_0x1ec585(0x84);['description']=a35_0x1ec585(0x79);[a35_0x1ec585(0xac)](_0x4df4c4){const _0x4baab1=a35_0x1ec585,_0x52d7cf=_0x4df4c4[_0x4baab1(0xea)][0x0];if(!_0x52d7cf)return _0x4baab1(0xe9);return undefined;}async[a35_0x1ec585(0x9c)](_0x103ba6){const _0x1a80ee=a35_0x1ec585,{options:_0x5b8b2d,args:_0x595e5d,tdx:_0x37f692}=_0x103ba6,_0x54c16b=_0x595e5d[0x0],_0x1b768e=_0x5b8b2d,_0x84e2ea={};if(_0x1b768e[_0x1a80ee(0x9d)])_0x84e2ea[_0x1a80ee(0x9d)]=_0x1b768e[_0x1a80ee(0x9d)];if(_0x1b768e[_0x1a80ee(0xdd)])_0x84e2ea[_0x1a80ee(0xdd)]=_0x1b768e[_0x1a80ee(0xdd)];if(_0x1b768e[_0x1a80ee(0x7e)])_0x84e2ea['cron']=_0x1b768e[_0x1a80ee(0x7e)];if(_0x1b768e['timezone'])_0x84e2ea[_0x1a80ee(0xe8)]=_0x1b768e['timezone'];if(_0x1b768e[_0x1a80ee(0x9e)]!==undefined)_0x84e2ea[_0x1a80ee(0x9e)]=Number(_0x1b768e[_0x1a80ee(0x9e)]);if(_0x1b768e[_0x1a80ee(0xec)]!==undefined)_0x84e2ea['priority']=Number(_0x1b768e[_0x1a80ee(0xec)]);if(_0x1b768e[_0x1a80ee(0xdf)]!==undefined)_0x84e2ea['retry_limit']=Number(_0x1b768e[_0x1a80ee(0xdf)]);if(_0x1b768e[_0x1a80ee(0x8c)])_0x84e2ea[_0x1a80ee(0x69)]=_0x1b768e['engineVersion'];if(_0x1b768e[_0x1a80ee(0x92)])_0x84e2ea[_0x1a80ee(0x92)]=_0x1b768e[_0x1a80ee(0x92)];if(_0x1b768e[_0x1a80ee(0x7c)])try{_0x84e2ea[_0x1a80ee(0x7b)]=readFileSync(_0x1b768e['file'],'utf-8')['trim']();}catch(_0x4cd70f){throw new SDKError(ErrorCode[_0x1a80ee(0x94)],_0x1a80ee(0x9a)+_0x1b768e['file'],_0x4cd70f instanceof Error?_0x4cd70f:undefined);}if(Object[_0x1a80ee(0xbb)](_0x84e2ea)['length']===0x0)throw new SDKError(ErrorCode[_0x1a80ee(0x94)],_0x1a80ee(0xb0));if(_0x5b8b2d[_0x1a80ee(0xe6)]){console[_0x1a80ee(0xc9)](_0x1a80ee(0x91)+_0x54c16b);for(const [_0xcdb87c,_0x37f9a5]of Object['entries'](_0x84e2ea)){_0xcdb87c===_0x1a80ee(0x7b)?console[_0x1a80ee(0xc9)]('\x20\x20'+_0xcdb87c+':\x20'+_0x37f9a5[_0x1a80ee(0x89)](0x0,0x32)+_0x1a80ee(0x71)):console[_0x1a80ee(0xc9)]('\x20\x20'+_0xcdb87c+':\x20'+_0x37f9a5);}}const _0x199ec0=await withSpinner(_0x1a80ee(0x88),()=>_0x37f692[_0x1a80ee(0xab)]['update'](_0x54c16b,_0x84e2ea),{'verbose':_0x5b8b2d['verbose']});return console[_0x1a80ee(0xc9)](_0x1a80ee(0x86)+_0x199ec0[_0x1a80ee(0xc0)][_0x1a80ee(0xa6)]),await handleSingleObjectOutput(_0x199ec0[_0x1a80ee(0xc0)],_0x5b8b2d),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a35_0x1ec585(0xa6)]='schedule:delete';[a35_0x1ec585(0xd1)]=a35_0x1ec585(0x68);[a35_0x1ec585(0xac)](_0x524316){const _0xd4b8=a35_0x1ec585,_0x37da68=_0x524316[_0xd4b8(0xea)][0x0];if(!_0x37da68)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>';return undefined;}async[a35_0x1ec585(0x9c)](_0x119b8b){const _0x30c20f=a35_0x1ec585,{options:_0x55e17a,args:_0x407786,tdx:_0x2b00f0}=_0x119b8b,_0x534b96=_0x407786[0x0];if(!_0x55e17a[_0x30c20f(0xbd)]){const _0x1757ed=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22'+_0x534b96+'\x22?');if(!_0x1757ed)return console[_0x30c20f(0xc9)](_0x30c20f(0xba)),0x0;}const _0x898aa=await withSpinner('Deleting\x20schedule...',()=>_0x2b00f0[_0x30c20f(0xab)][_0x30c20f(0x85)](_0x534b96),{'verbose':_0x55e17a[_0x30c20f(0xe6)]});return console[_0x30c20f(0xc9)](_0x30c20f(0xb2)+_0x898aa[_0x30c20f(0xc0)][_0x30c20f(0xa6)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a35_0x1ec585(0xa6)]=a35_0x1ec585(0xc6);[a35_0x1ec585(0xd1)]='Run\x20a\x20scheduled\x20query\x20immediately';['validate'](_0xb77e66){const _0x30d620=a35_0x1ec585,_0x507b65=_0xb77e66[_0x30d620(0xea)][0x0];if(!_0x507b65)return _0x30d620(0x67);return undefined;}async[a35_0x1ec585(0x9c)](_0x4557f1){const _0x46da7d=a35_0x1ec585,{options:_0x29b1f4,args:_0x5ef4d0,tdx:_0x42af59}=_0x4557f1,_0x5ed3c3=_0x5ef4d0[0x0],_0x10330b=_0x29b1f4,_0x54b0ba=_0x10330b[_0x46da7d(0x70)],_0x26ee52=_0x10330b['num']!==undefined?Number(_0x10330b[_0x46da7d(0xe3)]):undefined;if(_0x29b1f4[_0x46da7d(0xe6)]){console[_0x46da7d(0xc9)](_0x46da7d(0xa7)+_0x5ed3c3);if(_0x54b0ba)console[_0x46da7d(0xc9)]('\x20\x20Time:\x20'+_0x54b0ba);if(_0x26ee52)console[_0x46da7d(0xc9)](_0x46da7d(0xca)+_0x26ee52);}const _0x3460ca=await withSpinner(_0x46da7d(0x96),()=>_0x42af59[_0x46da7d(0xab)][_0x46da7d(0x8f)](_0x5ed3c3,{'time':_0x54b0ba,'num':_0x26ee52}),{'verbose':_0x29b1f4[_0x46da7d(0xe6)]}),_0x2b1620=_0x3460ca[_0x46da7d(0xc0)][_0x46da7d(0xa1)];console[_0x46da7d(0xc9)](_0x46da7d(0xe4)+_0x2b1620[_0x46da7d(0xde)]+_0x46da7d(0xd5)+(_0x2b1620[_0x46da7d(0xde)]!==0x1?'s':'')+_0x46da7d(0xc3));for(const _0x48defc of _0x2b1620){console[_0x46da7d(0xc9)](_0x46da7d(0xc5)+_0x48defc[_0x46da7d(0xd9)]);}return await handleSDKOutput(_0x2b1620,_0x29b1f4),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{['name']='schedule:history';[a35_0x1ec585(0xd1)]='Show\x20schedule\x20execution\x20history';[a35_0x1ec585(0xac)](_0x4ef8e8){const _0x508348=_0x4ef8e8['args'][0x0];if(!_0x508348)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async[a35_0x1ec585(0x9c)](_0xd92a4){const _0x333733=a35_0x1ec585,{options:_0x4b78cd,args:_0x290560,tdx:_0x148d85}=_0xd92a4,_0x294821=_0x290560[0x0],_0x2355a3=_0x4b78cd,_0x4b2a41=_0x2355a3[_0x333733(0x95)]!==undefined?Number(_0x2355a3['from']):undefined,_0x490e3a=_0x2355a3['to']!==undefined?Number(_0x2355a3['to']):undefined,_0x40b733=await withSpinner(_0x333733(0xe0),()=>_0x148d85['schedules'][_0x333733(0x6b)](_0x294821,{'from':_0x4b2a41,'to':_0x490e3a}),{'verbose':_0x4b78cd[_0x333733(0xe6)]}),_0x2475b5=_0x40b733[_0x333733(0xc0)];console['error'](_0x333733(0xd0)+_0x2475b5[_0x333733(0x65)]+'\x20execution'+(_0x2475b5[_0x333733(0x65)]!==0x1?'s':'')+_0x333733(0xb3)+_0x2475b5[_0x333733(0x95)]+'-'+_0x2475b5['to']+')');const _0x5aac13=_0x2475b5['history'][_0x333733(0xa8)](_0x33574f=>({'job_id':_0x33574f[_0x333733(0xd9)],'type':_0x33574f[_0x333733(0xdd)],'status':_0x33574f['status'],'scheduled_at':_0x33574f[_0x333733(0x8d)],'created_at':_0x33574f[_0x333733(0xb7)],'start_at':_0x33574f['start_at'],'end_at':_0x33574f[_0x333733(0x72)]}));return await handleSDKOutput(_0x5aac13,_0x4b78cd),0x0;}}
@@ -1 +1 @@
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
+ const a36_0x5c5596=a36_0x3c10;(function(_0x2e72ff,_0x5f0a83){const _0x536daa=a36_0x3c10,_0x3ffc14=_0x2e72ff();while(!![]){try{const _0x5e7f2e=-parseInt(_0x536daa(0x270))/0x1+parseInt(_0x536daa(0x227))/0x2+parseInt(_0x536daa(0x223))/0x3+parseInt(_0x536daa(0x212))/0x4*(-parseInt(_0x536daa(0x247))/0x5)+parseInt(_0x536daa(0x1cf))/0x6*(parseInt(_0x536daa(0x237))/0x7)+parseInt(_0x536daa(0x21f))/0x8+parseInt(_0x536daa(0x230))/0x9;if(_0x5e7f2e===_0x5f0a83)break;else _0x3ffc14['push'](_0x3ffc14['shift']());}catch(_0x6bcc05){_0x3ffc14['push'](_0x3ffc14['shift']());}}}(a36_0x1da0,0xdc509));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';function a36_0x3c10(_0x42a132,_0x4b822c){_0x42a132=_0x42a132-0x1cd;const _0x1da04b=a36_0x1da0();let _0x3c10b6=_0x1da04b[_0x42a132];return _0x3c10b6;}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_0x56827b from'chalk';async function resolveSegmentTarget(_0x55a7ae,_0x3395c5,_0x14520d){const _0x583f72=a36_0x3c10;if(isYamlFilePath(_0x55a7ae))try{const _0x4d5589=await resolveYamlFilePath(_0x55a7ae);return _0x14520d&&(console['error'](_0x583f72(0x1d4)+_0x55a7ae),console[_0x583f72(0x1d7)]('\x20\x20Parent\x20segment:\x20'+_0x4d5589[_0x583f72(0x249)]),console['error'](_0x583f72(0x1fa)+_0x4d5589['segmentName']),console[_0x583f72(0x1d7)]('\x20\x20Folder\x20path:\x20'+(_0x4d5589['folderPath']||_0x583f72(0x1fd))),console[_0x583f72(0x1d7)](_0x583f72(0x1df)+_0x4d5589[_0x583f72(0x221)])),_0x4d5589[_0x583f72(0x221)];}catch(_0x19c8fe){throw new SDKError(ErrorCode[_0x583f72(0x258)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x19c8fe[_0x583f72(0x232)]);}if(!_0x3395c5)throw new SDKError(ErrorCode[_0x583f72(0x258)],_0x583f72(0x1d5));return _0x3395c5+'/'+_0x55a7ae;}export class SegmentDescribeCommand extends BaseCommand{[a36_0x5c5596(0x1fb)]='segment:describe';[a36_0x5c5596(0x1d3)]=a36_0x5c5596(0x26b);async['execute'](_0x4bef27){const _0x1c3313=a36_0x5c5596,{options:_0x2d8b40,args:_0x186a7c,tdx:_0x3280f4}=_0x4bef27,_0x134ea6=_0x186a7c[0x0],_0x52b82b=!_0x134ea6&&!!_0x2d8b40[_0x1c3313(0x249)],_0x189a2b=_0x134ea6||_0x2d8b40[_0x1c3313(0x249)];if(!_0x189a2b)return console[_0x1c3313(0x1d7)](_0x1c3313(0x200)),console['error'](_0x1c3313(0x1d6)),console[_0x1c3313(0x1d7)](_0x1c3313(0x1db)),console[_0x1c3313(0x1d7)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console['error'](_0x1c3313(0x23c)),console[_0x1c3313(0x1d7)](_0x1c3313(0x1e9)),console[_0x1c3313(0x1d7)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0x549f8c=_0x2d8b40['segmentPath'];let _0x5731c2=_0x189a2b;!_0x52b82b&&_0x549f8c&&!_0x189a2b[_0x1c3313(0x1fc)]('/')&&(_0x5731c2=_0x549f8c+'/'+_0x189a2b,_0x2d8b40[_0x1c3313(0x1fe)]&&console[_0x1c3313(0x1d7)](_0x1c3313(0x23b)+_0x5731c2));const _0x3f414e=await withSpinner(_0x1c3313(0x205)+_0x5731c2+_0x1c3313(0x24c),()=>_0x3280f4[_0x1c3313(0x215)][_0x1c3313(0x1e4)](_0x5731c2),{'verbose':_0x2d8b40[_0x1c3313(0x1fe)]}),_0x83e1bf=_0x3f414e['data'];_0x2d8b40[_0x1c3313(0x1fe)]&&(console[_0x1c3313(0x1d7)]('Resolved\x20type:\x20'+_0x83e1bf[_0x1c3313(0x25d)]),console[_0x1c3313(0x1d7)](_0x1c3313(0x20a)+_0x83e1bf[_0x1c3313(0x244)]),_0x83e1bf['folderId']&&console[_0x1c3313(0x1d7)]('Folder\x20ID:\x20'+_0x83e1bf[_0x1c3313(0x24e)]),_0x83e1bf[_0x1c3313(0x222)]&&console[_0x1c3313(0x1d7)](_0x1c3313(0x254)+_0x83e1bf[_0x1c3313(0x222)]));if(_0x83e1bf['type']===_0x1c3313(0x20e)){const _0x4f588f=await withSpinner(_0x1c3313(0x1ea),()=>_0x3280f4['segment'][_0x1c3313(0x217)](_0x83e1bf[_0x1c3313(0x244)]),{'verbose':_0x2d8b40[_0x1c3313(0x1fe)]});await handleSingleObjectOutput(_0x4f588f[_0x1c3313(0x1e7)],_0x2d8b40);}else{if(_0x83e1bf[_0x1c3313(0x25d)]===_0x1c3313(0x233)){if(!_0x83e1bf[_0x1c3313(0x24e)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x784874=await withSpinner('Fetching\x20folder\x20details...',()=>_0x3280f4[_0x1c3313(0x215)][_0x1c3313(0x26e)](_0x83e1bf['folderId']),{'verbose':_0x2d8b40[_0x1c3313(0x1fe)]});await handleSingleObjectOutput(_0x784874[_0x1c3313(0x1e7)],_0x2d8b40);}else{if(_0x83e1bf[_0x1c3313(0x25d)]==='segment'){if(!_0x83e1bf[_0x1c3313(0x222)])throw new SDKError(ErrorCode[_0x1c3313(0x1f2)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x56d4f9=await withSpinner(_0x1c3313(0x24f),()=>_0x3280f4[_0x1c3313(0x215)]['getSegment'](_0x83e1bf['parentId'],_0x83e1bf[_0x1c3313(0x222)]),{'verbose':_0x2d8b40[_0x1c3313(0x1fe)]});await handleSingleObjectOutput(_0x56d4f9['data'],_0x2d8b40);}}}return 0x0;}catch(_0x40070c){if(_0x40070c instanceof SDKError)return console[_0x1c3313(0x1d7)]('Error:\x20'+_0x40070c[_0x1c3313(0x232)]),_0x40070c['cause']&&console[_0x1c3313(0x1d7)](_0x1c3313(0x25a)+_0x40070c[_0x1c3313(0x1d1)]),0x1;throw _0x40070c;}}}export class SegmentShowCommand extends BaseCommand{[a36_0x5c5596(0x1fb)]=a36_0x5c5596(0x23f);[a36_0x5c5596(0x1d3)]=a36_0x5c5596(0x1d9);async['execute'](_0x526a2d){const _0x24f342=a36_0x5c5596,{options:_0x54ad81,args:_0x5d8e09,tdx:_0x5751d1}=_0x526a2d,_0x42a2cf=_0x5d8e09[0x0];if(!_0x42a2cf)return console[_0x24f342(0x1d7)](_0x24f342(0x263)),console[_0x24f342(0x1d7)](_0x24f342(0x1eb)),console['error'](_0x24f342(0x26c)),console['error'](_0x24f342(0x1db)),console[_0x24f342(0x1d7)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x24f342(0x1d7)](_0x24f342(0x228)),0x1;try{const _0x5c1148=_0x54ad81[_0x24f342(0x249)],_0x3dd0ff=await resolveSegmentTarget(_0x42a2cf,_0x5c1148,_0x54ad81['verbose']);_0x54ad81[_0x24f342(0x1fe)]&&console[_0x24f342(0x1d7)](_0x24f342(0x20b)+_0x3dd0ff);const _0x5a2c6a=await withSpinner('Resolving\x20\x27'+_0x42a2cf+'\x27...',()=>_0x5751d1[_0x24f342(0x215)][_0x24f342(0x1e4)](_0x3dd0ff),{'verbose':_0x54ad81[_0x24f342(0x1fe)]}),_0x5bcbca=_0x5a2c6a[_0x24f342(0x1e7)];_0x54ad81['verbose']&&(console[_0x24f342(0x1d7)](_0x24f342(0x1ed)+_0x5bcbca[_0x24f342(0x25d)]),console[_0x24f342(0x1d7)](_0x24f342(0x20a)+_0x5bcbca[_0x24f342(0x244)]));if(_0x5bcbca['type']===_0x24f342(0x233))return console[_0x24f342(0x1d7)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0x24f342(0x1d7)]('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x5bcbca[_0x24f342(0x25d)]===_0x24f342(0x20e))return console[_0x24f342(0x1d7)](_0x24f342(0x23d)),console[_0x24f342(0x1d7)](_0x24f342(0x22e)),0x1;if(!_0x5bcbca[_0x24f342(0x222)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x24f342(0x206));const _0x45b4b4=await withSpinner(_0x24f342(0x242),()=>_0x5751d1[_0x24f342(0x215)][_0x24f342(0x1f7)](_0x5bcbca['parentId'],_0x5bcbca[_0x24f342(0x222)]),{'verbose':_0x54ad81['verbose']});let _0x1ba74a=_0x45b4b4[_0x24f342(0x1e7)];const _0xe6b58f=resolveLimit(_0x54ad81[_0x24f342(0x1e8)],DEFAULT_DISPLAY_LIMIT),_0x1f7156=/\bLIMIT\s+\d+/i[_0x24f342(0x26a)](_0x1ba74a);!_0x1f7156&&(_0x1ba74a=_0x1ba74a[_0x24f342(0x266)]()[_0x24f342(0x25e)](/;+$/,''),_0x1ba74a=_0x24f342(0x259)+_0x1ba74a+_0x24f342(0x234)+_0xe6b58f);_0x54ad81['verbose']&&console[_0x24f342(0x1d7)]('SQL\x20query:\x0a'+_0x1ba74a);const _0x3fe816=await withProgressSpinner(_0x24f342(0x1e1),async _0x29c10d=>{const _0x4cf88d=_0x24f342,_0x3c14ca=await _0x5751d1['query'][_0x4cf88d(0x214)](_0x1ba74a,{'catalog':'td','schema':'information_schema','onJobId':_0x291f75=>{_0x29c10d['setJobId'](_0x291f75);}});return _0x3c14ca;},{'verbose':_0x54ad81[_0x24f342(0x1fe)]}),_0x31d5c0=_0x3fe816[_0x24f342(0x1e7)],_0x284907=_0x31d5c0[_0x24f342(0x24b)]?_0x24f342(0x25f)+_0x31d5c0[_0x24f342(0x24b)]+']':'';return console[_0x24f342(0x1d7)](_0x24f342(0x253)+_0x31d5c0['stats'][_0x24f342(0x262)][_0x24f342(0x1e2)]()+_0x24f342(0x204)+('in\x20'+formatElapsed(_0x31d5c0[_0x24f342(0x224)][_0x24f342(0x1f6)])+_0x284907)),await handleQueryOutput(_0x31d5c0,_0x54ad81),0x0;}catch(_0x36387b){if(_0x36387b instanceof SDKError)return console[_0x24f342(0x1d7)](_0x24f342(0x20d)+_0x36387b[_0x24f342(0x21d)]+']'),console[_0x24f342(0x1d7)]('\x0a'+_0x36387b[_0x24f342(0x232)]),0x1;throw _0x36387b;}}}function a36_0x1da0(){const _0x307da7=['verbose','Show\x20segment\x20folder\x20details','Error:\x20Path\x20or\x20name\x20is\x20required','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','green','getSegmentSQLFromYaml','\x20rows\x20','Resolving\x20path\x20\x27','Segment\x20ID\x20missing\x20from\x20resolved\x20path','segment:view','Error:\x20Parent\x20segment\x20name\x20is\x20required','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Parent\x20ID:\x20','Target\x20path:\x20','Error:\x20','✖\x20Query\x20failed\x20[','parent','Use:\x20tdx\x20ps\x20view\x20-w','getSQLFromServerSegment','Resolved:\x20','7004RJcewu','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','execute','segment','createFolder','getParent','segment:folder:list','cyan','Use:\x20tdx\x20ps\x20desc','Resolved\x20folder\x20ID:\x20','segmentName','code','Get\x20SQL\x20query\x20for\x20child\x20segment','2938888HQnItM','✔\x20Found\x20','fullPath','segmentId','790170wRYBig','stats','parentFolder','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','311902UJYJeM','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Site:\x20','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Show\x20child\x20segment\x20schema\x20(column\x20types)','SEGMENT_FOLDER_NOT_FOUND','Create\x20segment\x20folder\x20for\x20organization','Use:\x20tdx\x20ps\x20show','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','18874827ZEVlRM','Folder\x20ID:\x20','message','folder','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','site','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','161LXHZTH','Fetching\x20folder\x20\x27','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Usage:\x20tdx\x20sg\x20desc\x20<name>','Resolved\x20relative\x20path\x20to:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','getSQLFromYamlFile','segment:show','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Fetching\x20SQL\x20for\x20segment...','Error:\x20Folder\x20reference\x20is\x20required','parentId','web','length','4915HhngtE','Resolving\x20parent\x20segment\x20\x27','parentSegment','segment:desc','jobId','\x27...','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','folderId','Fetching\x20segment\x20details...','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Listing\x20folders\x20for\x20parent\x20\x27','json','✔\x20Query\x20completed:\x20Processed\x20','Segment\x20ID:\x20','Resolving\x20\x27','log','segment:folder:show','INVALID_ARGUMENT','SELECT\x20*\x20FROM\x20(\x0a','\x20\x20Cause:\x20','Resolving\x20parent\x20folder\x20\x27','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','type','replace','\x20[Job\x20ID:\x20','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','processedRows','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Parent\x20name:\x20','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','trim','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','resolveFolderId','test','Show\x20segment\x20or\x20folder\x20details','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Parent\x20segment:\x20','getFolder','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','1330246tPaTBP','format','Resolved\x20parent\x20ID:\x20','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','279126GUsFJr','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','cause','\x20folder','description','Resolved\x20YAML\x20file:\x20','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Usage:\x20tdx\x20segment\x20describe\x20<path>','error','url','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Examples:','red','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20Full\x20path:\x20','content','Executing\x20segment\x20query...','toLocaleString','/e/','resolvePathToResource','path','Use:\x20tdx\x20ps\x20view','data','limit','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Fetching\x20parent\x20segment\x20details...','Usage:\x20tdx\x20sg\x20show\x20<name>','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Resolved\x20type:\x20','Usage:','Creating\x20folder\x20\x27','/app/ps/','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','SEGMENT_NOT_FOUND','resolveParentId','Options:','Folder\x20name:\x20','elapsedTimeMillis','getSegmentSQL','listFolders','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','\x20\x20Segment\x20name:\x20','name','includes','(root)'];a36_0x1da0=function(){return _0x307da7;};return a36_0x1da0();}export class SegmentFolderListCommand extends BaseCommand{[a36_0x5c5596(0x1fb)]=a36_0x5c5596(0x218);['description']=a36_0x5c5596(0x1f9);async['execute'](_0x21d9c6){const _0x3544a9=a36_0x5c5596,{options:_0x120e71,args:_0x32b9ff,tdx:_0x602e49}=_0x21d9c6;if(_0x32b9ff[_0x3544a9(0x246)]===0x0)return console[_0x3544a9(0x1d7)](_0x3544a9(0x208)),console[_0x3544a9(0x1d7)](_0x3544a9(0x265)),0x1;const _0x35a379=_0x32b9ff[0x0];try{_0x120e71[_0x3544a9(0x1fe)]&&(console['error'](_0x3544a9(0x229)+_0x120e71['site']),console[_0x3544a9(0x1d7)](_0x3544a9(0x264)+_0x35a379));const _0x2ad46e=await withSpinner(_0x3544a9(0x248)+_0x35a379+_0x3544a9(0x24c),()=>_0x602e49['segment']['resolveParentId'](_0x35a379),{'verbose':_0x120e71[_0x3544a9(0x1fe)]}),_0x16020d=_0x2ad46e[_0x3544a9(0x1e7)];_0x120e71['verbose']&&console[_0x3544a9(0x1d7)](_0x3544a9(0x1cd)+_0x16020d);const _0x214477=await withSpinner(_0x3544a9(0x251)+_0x35a379+_0x3544a9(0x24c),()=>_0x602e49[_0x3544a9(0x215)][_0x3544a9(0x1f8)](_0x16020d),{'verbose':_0x120e71[_0x3544a9(0x1fe)]}),_0x15835a=_0x214477[_0x3544a9(0x1e7)];return console['error'](_0x3544a9(0x220)+_0x15835a['length']+_0x3544a9(0x1d2)+(_0x15835a[_0x3544a9(0x246)]!==0x1?'s':'')),await handleSDKOutput(_0x15835a,_0x120e71),0x0;}catch(_0x19d1bb){if(_0x19d1bb instanceof SDKError)return console['error'](_0x3544a9(0x20c)+_0x19d1bb['message']),_0x19d1bb['cause']&&console['error'](_0x3544a9(0x25a)+_0x19d1bb['cause']),0x1;throw _0x19d1bb;}}}export class SegmentFolderShowCommand extends BaseCommand{[a36_0x5c5596(0x1fb)]=a36_0x5c5596(0x257);[a36_0x5c5596(0x1d3)]=a36_0x5c5596(0x1ff);async[a36_0x5c5596(0x214)](_0x1f71b9){const _0xb504c0=a36_0x5c5596,{options:_0x208de2,args:_0x4b9225,tdx:_0x5f3bb6}=_0x1f71b9;if(_0x4b9225[_0xb504c0(0x246)]===0x0)return console['error'](_0xb504c0(0x243)),console[_0xb504c0(0x1d7)](_0xb504c0(0x267)),0x1;try{const {parentId:_0xbff0e6,childId:_0x314a0f}=parseSegmentRef(_0x4b9225[0x0]);_0x208de2[_0xb504c0(0x1fe)]&&(console['error'](_0xb504c0(0x229)+_0x208de2[_0xb504c0(0x235)]),console[_0xb504c0(0x1d7)](_0xb504c0(0x264)+_0xbff0e6),_0x314a0f&&console[_0xb504c0(0x1d7)](_0xb504c0(0x1f5)+_0x314a0f));if(!_0x314a0f)return console[_0xb504c0(0x1d7)](_0xb504c0(0x1ce)),0x1;const _0xd9b946=await withSpinner(_0xb504c0(0x248)+_0xbff0e6+_0xb504c0(0x24c),()=>_0x5f3bb6[_0xb504c0(0x215)][_0xb504c0(0x1f3)](_0xbff0e6),{'verbose':_0x208de2['verbose']}),_0x80305b=_0xd9b946[_0xb504c0(0x1e7)];_0x208de2[_0xb504c0(0x1fe)]&&console[_0xb504c0(0x1d7)](_0xb504c0(0x1cd)+_0x80305b);const _0x453f14=await withSpinner('Resolving\x20folder\x20\x27'+_0x314a0f+'\x27...',()=>_0x5f3bb6['segment'][_0xb504c0(0x269)](_0x80305b,_0x314a0f),{'verbose':_0x208de2[_0xb504c0(0x1fe)]}),_0x5d45fd=_0x453f14[_0xb504c0(0x1e7)];_0x208de2[_0xb504c0(0x1fe)]&&console[_0xb504c0(0x1d7)](_0xb504c0(0x21b)+_0x5d45fd);const _0x3abb4c=await withSpinner(_0xb504c0(0x238)+_0x314a0f+_0xb504c0(0x24c),()=>_0x5f3bb6[_0xb504c0(0x215)][_0xb504c0(0x26e)](_0x5d45fd),{'verbose':_0x208de2[_0xb504c0(0x1fe)]});return await handleSDKOutput([_0x3abb4c[_0xb504c0(0x1e7)]],_0x208de2),0x0;}catch(_0x35aca8){if(_0x35aca8 instanceof SDKError)return console[_0xb504c0(0x1d7)](_0xb504c0(0x20c)+_0x35aca8[_0xb504c0(0x232)]),_0x35aca8[_0xb504c0(0x1d1)]&&console[_0xb504c0(0x1d7)](_0xb504c0(0x25a)+_0x35aca8['cause']),0x1;throw _0x35aca8;}}}export class SegmentSQLCommand extends BaseCommand{[a36_0x5c5596(0x1fb)]='segment:sql';['description']=a36_0x5c5596(0x21e);async[a36_0x5c5596(0x214)](_0x26bdfb){const _0x40c2f4=a36_0x5c5596,{options:_0x19ec12,args:_0x3643b8}=_0x26bdfb,_0x3dbf98=_0x19ec12,_0x1c3b87=_0x3dbf98[_0x40c2f4(0x1e5)],_0x59c15b=_0x3643b8[0x0];if(!_0x59c15b&&!_0x1c3b87)return console[_0x40c2f4(0x1d7)](a36_0x56827b['red'](_0x40c2f4(0x1d0))),console[_0x40c2f4(0x1d7)](_0x40c2f4(0x1ee)),console[_0x40c2f4(0x1d7)](_0x40c2f4(0x260)),console['error']('\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>'),console[_0x40c2f4(0x1d7)]('Examples:'),console[_0x40c2f4(0x1d7)](_0x40c2f4(0x240)),console[_0x40c2f4(0x1d7)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml'),0x1;if(_0x59c15b&&_0x1c3b87)return console[_0x40c2f4(0x1d7)](a36_0x56827b[_0x40c2f4(0x1dc)](_0x40c2f4(0x268))),0x1;try{let _0x3b79fb;if(_0x1c3b87)_0x3b79fb=await this[_0x40c2f4(0x23e)](_0x1c3b87,_0x26bdfb);else{if(isYamlFilePath(_0x59c15b))return console[_0x40c2f4(0x1d7)](a36_0x56827b[_0x40c2f4(0x1dc)]('Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option')),console[_0x40c2f4(0x1d7)]('\x20\x20tdx\x20sg\x20sql\x20--path\x20'+_0x59c15b),0x1;else _0x3b79fb=await this[_0x40c2f4(0x210)](_0x59c15b,_0x26bdfb);}return _0x19ec12[_0x40c2f4(0x271)]===_0x40c2f4(0x252)||_0x19ec12[_0x40c2f4(0x271)]==='jsonl'?await handleSDKOutput([{'sql':_0x3b79fb}],_0x19ec12):console[_0x40c2f4(0x256)](_0x3b79fb),0x0;}catch(_0x5ec32c){if(_0x5ec32c instanceof SDKError)return console[_0x40c2f4(0x1d7)](_0x40c2f4(0x20c)+_0x5ec32c[_0x40c2f4(0x232)]),_0x5ec32c[_0x40c2f4(0x1d1)]&&console[_0x40c2f4(0x1d7)](_0x40c2f4(0x25a)+_0x5ec32c[_0x40c2f4(0x1d1)]),0x1;throw _0x5ec32c;}}async['getSQLFromYamlFile'](_0x3e83f7,_0xb3e9b3){const _0x33ff9f=a36_0x5c5596,{options:_0x3b5040,tdx:_0x357c2e}=_0xb3e9b3;let _0x4c4fdc;try{_0x4c4fdc=await resolveYamlFilePath(_0x3e83f7);}catch(_0x1591f9){throw new SDKError(ErrorCode[_0x33ff9f(0x258)],_0x33ff9f(0x26f)+_0x1591f9[_0x33ff9f(0x232)]);}_0x3b5040[_0x33ff9f(0x1fe)]&&console[_0x33ff9f(0x1d7)](_0x33ff9f(0x211)+_0x4c4fdc[_0x33ff9f(0x249)]+'/'+_0x4c4fdc[_0x33ff9f(0x21c)]);const _0x545729=await withSpinner('Fetching\x20SQL\x20from\x20rule...',()=>_0x357c2e[_0x33ff9f(0x215)][_0x33ff9f(0x203)](_0x4c4fdc[_0x33ff9f(0x1e0)],_0x4c4fdc[_0x33ff9f(0x249)],_0x4c4fdc[_0x33ff9f(0x21c)]),{'verbose':_0x3b5040[_0x33ff9f(0x1fe)]});return _0x545729['data'];}async[a36_0x5c5596(0x210)](_0x2b2d72,_0xa6c1a8){const _0x3f4678=a36_0x5c5596,{options:_0x5c8fde,tdx:_0x46b16f}=_0xa6c1a8,_0x3cf937=_0x5c8fde[_0x3f4678(0x249)],_0x322654=await resolveSegmentTarget(_0x2b2d72,_0x3cf937,_0x5c8fde[_0x3f4678(0x1fe)]);_0x5c8fde[_0x3f4678(0x1fe)]&&console[_0x3f4678(0x1d7)](_0x3f4678(0x20b)+_0x322654);const _0x3b3224=await withSpinner(_0x3f4678(0x255)+_0x2b2d72+_0x3f4678(0x24c),()=>_0x46b16f[_0x3f4678(0x215)][_0x3f4678(0x1e4)](_0x322654),{'verbose':_0x5c8fde[_0x3f4678(0x1fe)]}),_0x266049=_0x3b3224[_0x3f4678(0x1e7)];_0x5c8fde[_0x3f4678(0x1fe)]&&(console[_0x3f4678(0x1d7)](_0x3f4678(0x1ed)+_0x266049[_0x3f4678(0x25d)]),console[_0x3f4678(0x1d7)](_0x3f4678(0x20a)+_0x266049['parentId']));if(_0x266049[_0x3f4678(0x25d)]===_0x3f4678(0x233))throw new SDKError(ErrorCode[_0x3f4678(0x258)],_0x3f4678(0x236));if(_0x266049[_0x3f4678(0x25d)]==='parent')throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x3f4678(0x1dd));if(!_0x266049[_0x3f4678(0x222)])throw new SDKError(ErrorCode[_0x3f4678(0x1f2)],_0x3f4678(0x206));const _0x342d95=await withSpinner(_0x3f4678(0x242),()=>_0x46b16f[_0x3f4678(0x215)]['getSegmentSQL'](_0x266049[_0x3f4678(0x244)],_0x266049[_0x3f4678(0x222)]),{'verbose':_0x5c8fde[_0x3f4678(0x1fe)]});return _0x342d95['data'];}}export class SegmentFolderCreateCommand extends BaseCommand{[a36_0x5c5596(0x1fb)]='segment:folder:create';[a36_0x5c5596(0x1d3)]=a36_0x5c5596(0x22d);async[a36_0x5c5596(0x214)](_0x463da8){const _0x379076=a36_0x5c5596,{options:_0x56fa1e,args:_0x2d2e9e,tdx:_0x33277b}=_0x463da8,_0x59e83e=_0x56fa1e;if(_0x2d2e9e[_0x379076(0x246)]<0x2)return console['error'](_0x379076(0x25c)),console[_0x379076(0x1d7)](_0x379076(0x201)),0x1;const _0xeb2427=_0x2d2e9e[0x0],_0x20a449=_0x2d2e9e[0x1];_0x59e83e[_0x379076(0x1fe)]&&(console[_0x379076(0x1d7)](_0x379076(0x229)+_0x59e83e[_0x379076(0x235)]),console['error'](_0x379076(0x26d)+_0xeb2427),console['error'](_0x379076(0x1f5)+_0x20a449));let _0x5d46a3;if(_0x59e83e[_0x379076(0x225)]){const _0x427fe8=_0x59e83e[_0x379076(0x225)],_0x14d0d2=await withSpinner(_0x379076(0x248)+_0xeb2427+_0x379076(0x24c),()=>_0x33277b[_0x379076(0x215)][_0x379076(0x1f3)](_0xeb2427),{'verbose':_0x59e83e[_0x379076(0x1fe)]}),_0x3dc280=_0x14d0d2['data'],_0x5c0eba=await withSpinner(_0x379076(0x25b)+_0x427fe8+'\x27...',()=>_0x33277b[_0x379076(0x215)][_0x379076(0x269)](_0x3dc280,_0x427fe8),{'verbose':_0x59e83e['verbose']});_0x5d46a3=_0x5c0eba[_0x379076(0x1e7)],_0x59e83e[_0x379076(0x1fe)]&&console[_0x379076(0x1d7)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x5d46a3);}const _0x273918={'name':_0x20a449,'description':_0x59e83e[_0x379076(0x1d3)],'parentFolderId':_0x5d46a3},_0x48b4d0=await withSpinner(_0x379076(0x1ef)+_0x20a449+_0x379076(0x24c),()=>_0x33277b['segment'][_0x379076(0x216)](_0xeb2427,_0x273918),{'verbose':_0x59e83e[_0x379076(0x1fe)]}),_0x20ea5d=_0x48b4d0[_0x379076(0x1e7)];return console[_0x379076(0x1d7)]('✔\x20Created\x20folder\x20\x27'+_0x20ea5d[_0x379076(0x1fb)]+'\x27\x20with\x20ID:\x20'+_0x20ea5d['id']),await handleSDKOutput([_0x20ea5d],_0x59e83e),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a36_0x5c5596(0x207);['description']='Show\x20folder\x20or\x20child\x20segment\x20details';async[a36_0x5c5596(0x214)](_0x930bf){const _0x2c2c28=a36_0x5c5596,{options:_0x40f464,args:_0x1528a2,tdx:_0x298bd1}=_0x930bf,_0x1c5cf6=_0x1528a2[0x0];if(!_0x1c5cf6)return console[_0x2c2c28(0x1d7)](_0x2c2c28(0x209)),console['error'](_0x2c2c28(0x22f)),console['error'](_0x2c2c28(0x1f1)),console[_0x2c2c28(0x1d7)](_0x2c2c28(0x1f4)),console['error'](_0x2c2c28(0x250)),console[_0x2c2c28(0x1d7)](_0x2c2c28(0x1db)),console[_0x2c2c28(0x1d7)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x2c2c28(0x1d7)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x2c2c28(0x1d7)](_0x2c2c28(0x1de)),console[_0x2c2c28(0x1d7)](_0x2c2c28(0x213)),0x1;try{const _0x2bbd3c=_0x40f464[_0x2c2c28(0x249)],_0x6eeb5f=await resolveSegmentTarget(_0x1c5cf6,_0x2bbd3c,_0x40f464[_0x2c2c28(0x1fe)]);_0x40f464[_0x2c2c28(0x1fe)]&&console['error'](_0x2c2c28(0x20b)+_0x6eeb5f);const _0x2c73fb=await withSpinner(_0x2c2c28(0x255)+_0x1c5cf6+_0x2c2c28(0x24c),()=>_0x298bd1['segment'][_0x2c2c28(0x1e4)](_0x6eeb5f),{'verbose':_0x40f464[_0x2c2c28(0x1fe)]}),_0x414c6e=_0x2c73fb['data'];_0x40f464[_0x2c2c28(0x1fe)]&&(console[_0x2c2c28(0x1d7)](_0x2c2c28(0x1ed)+_0x414c6e[_0x2c2c28(0x25d)]),console[_0x2c2c28(0x1d7)](_0x2c2c28(0x20a)+_0x414c6e[_0x2c2c28(0x244)]),_0x414c6e['folderId']&&console[_0x2c2c28(0x1d7)](_0x2c2c28(0x231)+_0x414c6e[_0x2c2c28(0x24e)]),_0x414c6e[_0x2c2c28(0x222)]&&console['error']('Segment\x20ID:\x20'+_0x414c6e[_0x2c2c28(0x222)]));if(_0x40f464[_0x2c2c28(0x245)]){if(_0x414c6e[_0x2c2c28(0x25d)]==='folder')return console[_0x2c2c28(0x1d7)](_0x2c2c28(0x22a)),0x1;if(_0x414c6e['type']===_0x2c2c28(0x20e))return console[_0x2c2c28(0x1d7)](_0x2c2c28(0x241)),console[_0x2c2c28(0x1d7)](_0x2c2c28(0x20f)),0x1;if(!_0x414c6e['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x2c2c28(0x206));const _0x9671a8=getConsoleNextUrl(_0x40f464['site'],_0x2c2c28(0x1f0)+_0x414c6e[_0x2c2c28(0x244)]+_0x2c2c28(0x1e3)+_0x414c6e[_0x2c2c28(0x222)]);return console[_0x2c2c28(0x1d7)](a36_0x56827b[_0x2c2c28(0x202)]('✔')+'\x20Opening\x20'+a36_0x56827b[_0x2c2c28(0x219)](_0x9671a8)),openBrowser(_0x9671a8),0x0;}if(_0x414c6e['type']===_0x2c2c28(0x233)){if(!_0x414c6e['folderId'])throw new SDKError(ErrorCode[_0x2c2c28(0x22c)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x30974d=await withSpinner('Fetching\x20folder\x20details...',()=>_0x298bd1[_0x2c2c28(0x215)]['getFolder'](_0x414c6e[_0x2c2c28(0x24e)]),{'verbose':_0x40f464[_0x2c2c28(0x1fe)]});await handleSingleObjectOutput(_0x30974d[_0x2c2c28(0x1e7)],_0x40f464);}else{if(_0x414c6e[_0x2c2c28(0x25d)]===_0x2c2c28(0x215)){if(!_0x414c6e['segmentId'])throw new SDKError(ErrorCode[_0x2c2c28(0x1f2)],_0x2c2c28(0x206));const _0x3b2b59=await withSpinner(_0x2c2c28(0x24f),()=>_0x298bd1['segment']['getSegment'](_0x414c6e[_0x2c2c28(0x244)],_0x414c6e[_0x2c2c28(0x222)]),{'verbose':_0x40f464['verbose']}),_0x50a9fc=getConsoleNextUrl(_0x40f464[_0x2c2c28(0x235)],_0x2c2c28(0x1f0)+_0x414c6e[_0x2c2c28(0x244)]+'/e/'+_0x414c6e[_0x2c2c28(0x222)]),_0x47ba63=_0x3b2b59[_0x2c2c28(0x1e7)];_0x47ba63[_0x2c2c28(0x1d8)]=_0x50a9fc,await handleSingleObjectOutput(_0x47ba63,_0x40f464);}else return console[_0x2c2c28(0x1d7)](_0x2c2c28(0x226)),console[_0x2c2c28(0x1d7)](_0x2c2c28(0x1e6)),0x1;}return 0x0;}catch(_0x360fef){if(_0x360fef instanceof SDKError)return console[_0x2c2c28(0x1d7)](_0x2c2c28(0x20c)+_0x360fef[_0x2c2c28(0x232)]),_0x360fef[_0x2c2c28(0x1d1)]&&console[_0x2c2c28(0x1d7)]('\x20\x20Cause:\x20'+_0x360fef['cause']),0x1;throw _0x360fef;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a36_0x5c5596(0x1fb)]=a36_0x5c5596(0x24a);['description']=a36_0x5c5596(0x22b);async[a36_0x5c5596(0x214)](_0x1284ed){const _0x40032b=a36_0x5c5596,{options:_0x5dd91c,args:_0x2e6e81,tdx:_0x4fefa7}=_0x1284ed,_0x55727f=_0x2e6e81[0x0];if(!_0x55727f)return console[_0x40032b(0x1d7)](_0x40032b(0x263)),console['error'](_0x40032b(0x23a)),console[_0x40032b(0x1d7)](_0x40032b(0x261)),console[_0x40032b(0x1d7)]('Examples:'),console[_0x40032b(0x1d7)](_0x40032b(0x239)),console[_0x40032b(0x1d7)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x421669=_0x5dd91c[_0x40032b(0x249)],_0x595198=await resolveSegmentTarget(_0x55727f,_0x421669,_0x5dd91c[_0x40032b(0x1fe)]);_0x5dd91c[_0x40032b(0x1fe)]&&console[_0x40032b(0x1d7)](_0x40032b(0x20b)+_0x595198);const _0x305f58=await withSpinner(_0x40032b(0x255)+_0x55727f+'\x27...',()=>_0x4fefa7[_0x40032b(0x215)]['resolvePathToResource'](_0x595198),{'verbose':_0x5dd91c['verbose']}),_0x10e387=_0x305f58['data'];_0x5dd91c[_0x40032b(0x1fe)]&&(console['error'](_0x40032b(0x1ed)+_0x10e387['type']),console[_0x40032b(0x1d7)](_0x40032b(0x20a)+_0x10e387[_0x40032b(0x244)]));if(_0x10e387[_0x40032b(0x25d)]===_0x40032b(0x233))return console[_0x40032b(0x1d7)](_0x40032b(0x1ec)),console[_0x40032b(0x1d7)](_0x40032b(0x24d)),0x1;if(_0x10e387['type']===_0x40032b(0x20e))return console[_0x40032b(0x1d7)](_0x40032b(0x1da)),console[_0x40032b(0x1d7)](_0x40032b(0x21a)),0x1;if(!_0x10e387['segmentId'])throw new SDKError(ErrorCode[_0x40032b(0x1f2)],_0x40032b(0x206));const _0xbcb7d1=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x4fefa7['segment'][_0x40032b(0x1f7)](_0x10e387[_0x40032b(0x244)],_0x10e387['segmentId']),{'verbose':_0x5dd91c['verbose']}),_0xc8fafc=_0xbcb7d1[_0x40032b(0x1e7)],_0x2b5185=await executeSchemaQuery(_0xc8fafc,_0x4fefa7,_0x5dd91c);return await handleQueryOutput(_0x2b5185,_0x5dd91c),0x0;}catch(_0x335b3d){if(_0x335b3d instanceof SDKError)return console[_0x40032b(0x1d7)](_0x40032b(0x20c)+_0x335b3d[_0x40032b(0x232)]),_0x335b3d[_0x40032b(0x1d1)]&&console[_0x40032b(0x1d7)](_0x40032b(0x25a)+_0x335b3d[_0x40032b(0x1d1)]),0x1;throw _0x335b3d;}}}
@@ -1 +1 @@
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
+ const a37_0xe9563=a37_0x92fe;(function(_0x42b96a,_0x428a4b){const _0x5ac83f=a37_0x92fe,_0x466712=_0x42b96a();while(!![]){try{const _0xd1e06c=-parseInt(_0x5ac83f(0x1ef))/0x1+-parseInt(_0x5ac83f(0x1e8))/0x2*(parseInt(_0x5ac83f(0x1dc))/0x3)+-parseInt(_0x5ac83f(0x1f6))/0x4+parseInt(_0x5ac83f(0x1e1))/0x5+-parseInt(_0x5ac83f(0x1fe))/0x6+parseInt(_0x5ac83f(0x1cc))/0x7+parseInt(_0x5ac83f(0x1d4))/0x8;if(_0xd1e06c===_0x428a4b)break;else _0x466712['push'](_0x466712['shift']());}catch(_0x2caf82){_0x466712['push'](_0x466712['shift']());}}}(a37_0x18c2,0x554a1));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';function a37_0x92fe(_0xcde186,_0x163e24){_0xcde186=_0xcde186-0x1ca;const _0x18c268=a37_0x18c2();let _0x92febe=_0x18c268[_0xcde186];return _0x92febe;}import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a37_0x187ced from'chalk';function a37_0x18c2(){const _0x341960=['✔\x20Created\x20segment\x20\x27','\x20\x20\x20Path:\x20','error','name','Create\x20child\x20segment\x20with\x20filtering\x20rules','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','978066RssqsD','segments','\x27\x20with\x20ID:\x20','Resolving\x20parent\x20segment\x20\x27','4848466opVLrQ','Resolved\x20relative\x20path\x20to:\x20','execute','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','segment','resolveFolderId','folderId','4600584jJwIUi','segmentPath','createSegment','length','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','resolveParentId','\x27...','Examples:','3AQkfnl','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','Resolved\x20folder\x20ID:\x20','type','Segment\x20name:\x20','452315nIMlfM','description','folder','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Creating\x20segment\x20\x27','data','Parent:\x20','255476VjKOZU','segment:create','resolvePathToResource','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','verbose','Resolving\x20folder\x20\x27','561510OpNefX','kind','invisible','Resolving\x20folder\x20path\x20\x27','yellow','rule','noCountPopulation','626280BwSatt','ruleFile'];a37_0x18c2=function(){return _0x341960;};return a37_0x18c2();}export class SegmentCreateCommand extends BaseCommand{[a37_0xe9563(0x1fb)]=a37_0xe9563(0x1e9);[a37_0xe9563(0x1e2)]=a37_0xe9563(0x1fc);async[a37_0xe9563(0x1ce)](_0x49a595){const _0x4392c7=a37_0xe9563;console['error'](a37_0x187ced[_0x4392c7(0x1f3)](_0x4392c7(0x1d8))),console[_0x4392c7(0x1fa)](a37_0x187ced[_0x4392c7(0x1f3)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x545be1,args:_0xca4279,tdx:_0x5acc5c}=_0x49a595,_0x5f359b=_0x545be1;if(_0xca4279[_0x4392c7(0x1d7)]===0x0)return console[_0x4392c7(0x1fa)](_0x4392c7(0x1cf)),console[_0x4392c7(0x1fa)](_0x4392c7(0x1eb)),console[_0x4392c7(0x1fa)](_0x4392c7(0x1db)),console['error'](_0x4392c7(0x1d0)),console[_0x4392c7(0x1fa)](_0x4392c7(0x1ec)),console[_0x4392c7(0x1fa)](_0x4392c7(0x1e4)),0x1;const _0x24e2b3=_0xca4279[0x0],_0x25a608=_0x545be1[_0x4392c7(0x1d5)];let _0x4fb789=_0x24e2b3;_0x25a608&&!_0x24e2b3['includes']('/')&&(_0x4fb789=_0x25a608+'/'+_0x24e2b3,_0x5f359b[_0x4392c7(0x1ed)]&&console['error'](_0x4392c7(0x1cd)+_0x4fb789));const _0x4a5a82=parsePath(_0x4fb789);if(_0x4a5a82[_0x4392c7(0x1ff)][_0x4392c7(0x1d7)]<0x2)return console['error'](_0x4392c7(0x1fd)),console['error'](_0x4392c7(0x1dd)),0x1;const _0x4fafa9=_0x4a5a82['segments'][0x0],_0x3a3657=getBaseName(_0x4fb789),_0x3ba7f3=getParentPath(_0x4fb789);_0x5f359b[_0x4392c7(0x1ed)]&&(console[_0x4392c7(0x1fa)]('Site:\x20'+_0x5f359b['site']),console[_0x4392c7(0x1fa)]('Target\x20path:\x20'+_0x4fb789),console[_0x4392c7(0x1fa)](_0x4392c7(0x1e7)+_0x4fafa9),console[_0x4392c7(0x1fa)](_0x4392c7(0x1e0)+_0x3a3657),console[_0x4392c7(0x1fa)]('Parent\x20path:\x20'+_0x3ba7f3));const _0x58b6f4=await withSpinner(_0x4392c7(0x1cb)+_0x4fafa9+'\x27...',()=>_0x5acc5c[_0x4392c7(0x1d1)][_0x4392c7(0x1d9)](_0x4fafa9),{'verbose':_0x5f359b['verbose']}),_0x31ebf4=_0x58b6f4[_0x4392c7(0x1e6)];let _0x5a2f46;if(_0x4a5a82[_0x4392c7(0x1ff)][_0x4392c7(0x1d7)]>0x2){const _0x5855f5=await withSpinner(_0x4392c7(0x1f2)+_0x3ba7f3+_0x4392c7(0x1da),()=>_0x5acc5c[_0x4392c7(0x1d1)][_0x4392c7(0x1ea)](_0x3ba7f3),{'verbose':_0x5f359b[_0x4392c7(0x1ed)]}),_0x4ac560=_0x5855f5[_0x4392c7(0x1e6)];if(_0x4ac560[_0x4392c7(0x1df)]!==_0x4392c7(0x1e3)&&_0x4ac560[_0x4392c7(0x1df)]!=='parent')return console['error']('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x5a2f46=_0x4ac560[_0x4392c7(0x1d3)];}else{if(_0x5f359b['folder']){const _0x1d25d1=await withSpinner(_0x4392c7(0x1ee)+_0x5f359b[_0x4392c7(0x1e3)]+_0x4392c7(0x1da),()=>_0x5acc5c['segment'][_0x4392c7(0x1d2)](_0x31ebf4,_0x5f359b['folder']),{'verbose':_0x5f359b[_0x4392c7(0x1ed)]});_0x5a2f46=_0x1d25d1['data'];}}_0x5f359b['verbose']&&_0x5a2f46&&console[_0x4392c7(0x1fa)](_0x4392c7(0x1de)+_0x5a2f46);const _0x4ff80=await loadJSONFromOptions(_0x5f359b[_0x4392c7(0x1f4)],_0x5f359b[_0x4392c7(0x1f7)]),_0x8609d8={'name':_0x3a3657,'description':_0x5f359b[_0x4392c7(0x1e2)],'rule':_0x4ff80,'kind':_0x5f359b[_0x4392c7(0x1f0)]!==undefined?parseInt(_0x5f359b[_0x4392c7(0x1f0)],0xa):undefined,'isVisible':_0x5f359b[_0x4392c7(0x1f1)]?![]:undefined,'segmentFolderId':_0x5a2f46,'countPopulation':_0x5f359b[_0x4392c7(0x1f5)]?![]:undefined},_0x4ed605=await withSpinner(_0x4392c7(0x1e5)+_0x3a3657+_0x4392c7(0x1da),()=>_0x5acc5c['segment'][_0x4392c7(0x1d6)](_0x31ebf4,_0x8609d8),{'verbose':_0x5f359b['verbose']}),_0xc72208=_0x4ed605[_0x4392c7(0x1e6)];return console[_0x4392c7(0x1fa)](_0x4392c7(0x1f8)+_0xc72208[_0x4392c7(0x1fb)]+_0x4392c7(0x1ca)+_0xc72208['id']),_0x4fb789!==_0x24e2b3&&console[_0x4392c7(0x1fa)](_0x4392c7(0x1f9)+_0x4fb789),await handleSDKOutput([_0xc72208],_0x5f359b),0x0;}}
@@ -1 +1 @@
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
+ const a38_0x8f6d93=a38_0x10d1;(function(_0x5ad817,_0x961435){const _0x399891=a38_0x10d1,_0x3c48c9=_0x5ad817();while(!![]){try{const _0x4d87ab=-parseInt(_0x399891(0x16a))/0x1*(-parseInt(_0x399891(0x16c))/0x2)+parseInt(_0x399891(0x17f))/0x3+-parseInt(_0x399891(0x183))/0x4+parseInt(_0x399891(0x178))/0x5*(parseInt(_0x399891(0x186))/0x6)+parseInt(_0x399891(0x184))/0x7*(parseInt(_0x399891(0x177))/0x8)+parseInt(_0x399891(0x17e))/0x9+-parseInt(_0x399891(0x16e))/0xa*(parseInt(_0x399891(0x175))/0xb);if(_0x4d87ab===_0x961435)break;else _0x3c48c9['push'](_0x3c48c9['shift']());}catch(_0xc48935){_0x3c48c9['push'](_0x3c48c9['shift']());}}}(a38_0x4f0e,0xf1c73));function a38_0x4f0e(){const _0xc4e215=['json','7640nqemxt','3310hNgjmZ','length','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','Listing\x20fields\x20for\x20\x27','description','verbose','3197979sBwEoo','1086702LslGTs','List\x20available\x20fields\x20for\x20segmentation','segment:fields','segment','7594988nNHWVH','504meYmgC','listFields','9078LLdUjO','\x27...','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','error','89WDFSrl','data','41194EThSGa','execute','7319940DIyDGt','\x20field','parentSegment','site','name','Site:\x20','✔\x20Found\x20','11EPjbiR'];a38_0x4f0e=function(){return _0xc4e215;};return a38_0x4f0e();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a38_0x10d1(_0x166281,_0x342ae6){_0x166281=_0x166281-0x168;const _0x4f0ef7=a38_0x4f0e();let _0x10d104=_0x4f0ef7[_0x166281];return _0x10d104;}import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a38_0x8f6d93(0x172)]=a38_0x8f6d93(0x181);[a38_0x8f6d93(0x17c)]=a38_0x8f6d93(0x180);async[a38_0x8f6d93(0x16d)](_0x10f5e5){const _0x50a693=a38_0x8f6d93,{options:_0x34c4cd,args:_0x63136c,tdx:_0x5517e7}=_0x10f5e5,_0x2aad8a=_0x63136c[0x0]||_0x34c4cd[_0x50a693(0x170)];if(!_0x2aad8a)return console[_0x50a693(0x169)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x50a693(0x169)](_0x50a693(0x17a)),console[_0x50a693(0x169)](_0x50a693(0x168)),0x1;_0x34c4cd[_0x50a693(0x17d)]&&(console[_0x50a693(0x169)](_0x50a693(0x173)+_0x34c4cd[_0x50a693(0x171)]),console[_0x50a693(0x169)]('Parent\x20segment:\x20'+_0x2aad8a));const _0x4d0d65=await withSpinner(_0x50a693(0x17b)+_0x2aad8a+_0x50a693(0x187),()=>_0x5517e7[_0x50a693(0x182)][_0x50a693(0x185)](_0x2aad8a),{'verbose':_0x34c4cd[_0x50a693(0x17d)]}),_0x4b54c6=_0x4d0d65[_0x50a693(0x16b)];console['error'](_0x50a693(0x174)+_0x4b54c6[_0x50a693(0x179)]+_0x50a693(0x16f)+(_0x4b54c6[_0x50a693(0x179)]!==0x1?'s':''));if(_0x34c4cd[_0x50a693(0x176)]||_0x34c4cd['jsonl'])return await handleSDKOutput(_0x4b54c6,_0x34c4cd),0x0;return displayFieldsHumanReadable(_0x4b54c6,_0x2aad8a),0x0;}}
@@ -1 +1 @@
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;}}
1
+ const a39_0xfaccec=a39_0x120b;(function(_0x488ef4,_0x195c65){const _0x2e6bc8=a39_0x120b,_0x2463ee=_0x488ef4();while(!![]){try{const _0x3585e5=parseInt(_0x2e6bc8(0x160))/0x1*(-parseInt(_0x2e6bc8(0x187))/0x2)+parseInt(_0x2e6bc8(0x15b))/0x3+parseInt(_0x2e6bc8(0x173))/0x4+parseInt(_0x2e6bc8(0x177))/0x5+parseInt(_0x2e6bc8(0x167))/0x6*(parseInt(_0x2e6bc8(0x146))/0x7)+-parseInt(_0x2e6bc8(0x17d))/0x8+parseInt(_0x2e6bc8(0x168))/0x9*(-parseInt(_0x2e6bc8(0x179))/0xa);if(_0x3585e5===_0x195c65)break;else _0x2463ee['push'](_0x2463ee['shift']());}catch(_0x44de65){_0x2463ee['push'](_0x2463ee['shift']());}}}(a39_0x2473,0x436e4));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_0x1f4ec0 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';function a39_0x120b(_0x142903,_0x737032){_0x142903=_0x142903-0x146;const _0x247318=a39_0x2473();let _0x120b0e=_0x247318[_0x142903];return _0x120b0e;}import a39_0x1718de from'path';function a39_0x2473(){const _0x59e9c7=['cyan','\x20\x20🎯\x20','site','\x20new\x20files','relativePath','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','pullSegments','1824904tOlLNg','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)','errorCode','verbose','2043860djQxFf','journeys','10kbrFpY','counts','absolutePath','segment','3506040ITmjHN','\x20segments','\x20files?','filter','Site:\x20','red','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','dryRun','helpText','Aborted.','2wkgUcV','content','\x20activations','-\x20no\x20files\x20written','dirname','segments','\x27...','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','repeat','error','segment:pull','\x20changed\x20files','file','2595719QMkatf','setPhase','\x20files\x20to\x20','hasChanges','\x20versions)','targetDir','\x20=\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','Target\x20resource:\x20','activations','Parent\x20segment:\x20','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','name','green','\x20\x20Target:\x20','dim','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','parentSegment','✔\x20Pulled\x20','resourceName','description','1605864sEEgYb','✔\x20Context\x20set:\x20','\x20\x20🗺️\x20\x20','\x0aError:','isNew','517711BEyQbn','files','session','type','yellow','\x20unchanged\x20files','journeyVersions','6hllZDa','4850469AOGXUV','parentName','no_parent','length'];a39_0x2473=function(){return _0x59e9c7;};return a39_0x2473();}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_0xfaccec(0x152)]=a39_0xfaccec(0x191);[a39_0xfaccec(0x15a)]=a39_0xfaccec(0x18e);async['execute'](_0x512597){const _0x1fa2a3=a39_0xfaccec,{options:_0x58c119,args:_0x4d3cb5,tdx:_0x30e7ea}=_0x512597,_0x279a1b=_0x58c119,_0x222252=await resolveTarget({'arg':_0x4d3cb5[0x0],'contextParent':_0x58c119[_0x1fa2a3(0x157)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x222252))return _0x222252[_0x1fa2a3(0x175)]===_0x1fa2a3(0x16a)?(console[_0x1fa2a3(0x190)](a39_0x1f4ec0[_0x1fa2a3(0x164)](_0x1fa2a3(0x14d))),console[_0x1fa2a3(0x190)](_0x1fa2a3(0x174)),console[_0x1fa2a3(0x190)](_0x1fa2a3(0x183)),console[_0x1fa2a3(0x190)]('\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[_0x1fa2a3(0x190)](a39_0x1f4ec0[_0x1fa2a3(0x182)]('Error:\x20'+_0x222252['message']+'\x0a')),_0x222252[_0x1fa2a3(0x185)]&&console[_0x1fa2a3(0x190)](a39_0x1f4ec0[_0x1fa2a3(0x16c)](_0x222252[_0x1fa2a3(0x185)]))),0x1;const _0x4460da=_0x222252[_0x1fa2a3(0x169)],_0x2678ed=_0x222252[_0x1fa2a3(0x14b)],_0x1e450f=_0x222252[_0x1fa2a3(0x163)]===_0x1fa2a3(0x193)?_0x222252[_0x1fa2a3(0x159)]:undefined;_0x279a1b[_0x1fa2a3(0x176)]&&(console[_0x1fa2a3(0x190)](_0x1fa2a3(0x181)+_0x279a1b[_0x1fa2a3(0x16e)]),console[_0x1fa2a3(0x190)](_0x1fa2a3(0x150)+_0x4460da),_0x1e450f&&console[_0x1fa2a3(0x190)](_0x1fa2a3(0x14e)+_0x1e450f));const _0x40c9f2=await withProgressSpinner('Pulling\x20segments\x20from\x20\x27'+_0x4460da+_0x1fa2a3(0x18d),_0x425ddd=>_0x30e7ea[_0x1fa2a3(0x17c)][_0x1fa2a3(0x172)](_0x4460da,{'targetDir':_0x2678ed,'targetResourceName':_0x1e450f,'verbose':_0x279a1b[_0x1fa2a3(0x176)],'progress':{'update':_0x3b60fd=>{const _0x41318e=_0x1fa2a3;_0x425ddd[_0x41318e(0x147)](_0x3b60fd),_0x279a1b[_0x41318e(0x176)]&&console['error']('\x20\x20'+_0x3b60fd);}}}),{'verbose':_0x279a1b[_0x1fa2a3(0x176)]}),_0x26b198=_0x40c9f2['data'];if(_0x26b198[_0x1fa2a3(0x17a)][_0x1fa2a3(0x18c)]===0x0&&_0x26b198[_0x1fa2a3(0x17a)][_0x1fa2a3(0x178)]===0x0)return console[_0x1fa2a3(0x190)](a39_0x1f4ec0[_0x1fa2a3(0x164)](_0x1fa2a3(0x156)+_0x26b198[_0x1fa2a3(0x169)]+'\x27')),0x0;const _0x2664a3=_0x26b198['files'][_0x1fa2a3(0x180)](_0x5a2541=>_0x5a2541['isNew']),_0x44b923=_0x26b198[_0x1fa2a3(0x161)][_0x1fa2a3(0x180)](_0x5ce10b=>!_0x5ce10b[_0x1fa2a3(0x15f)]&&_0x5ce10b[_0x1fa2a3(0x149)]),_0x441d91=_0x26b198[_0x1fa2a3(0x161)][_0x1fa2a3(0x180)](_0x458b3e=>!_0x458b3e[_0x1fa2a3(0x15f)]&&!_0x458b3e[_0x1fa2a3(0x149)]);console['error']('\x0aPull\x20summary\x20for\x20\x27'+_0x26b198['parentName']+'\x27:'),console[_0x1fa2a3(0x190)](_0x1fa2a3(0x16d)+a39_0x1f4ec0[_0x1fa2a3(0x16c)](_0x26b198['counts']['segments']+_0x1fa2a3(0x17e))+'\x20with\x20'+a39_0x1f4ec0[_0x1fa2a3(0x16c)](_0x26b198[_0x1fa2a3(0x17a)][_0x1fa2a3(0x14f)]+_0x1fa2a3(0x189)));if(_0x26b198[_0x1fa2a3(0x17a)][_0x1fa2a3(0x178)]>0x0){const _0x425735=_0x26b198[_0x1fa2a3(0x17a)][_0x1fa2a3(0x166)]>_0x26b198[_0x1fa2a3(0x17a)][_0x1fa2a3(0x178)]?'\x20('+_0x26b198[_0x1fa2a3(0x17a)][_0x1fa2a3(0x166)]+_0x1fa2a3(0x14a):'';console[_0x1fa2a3(0x190)](_0x1fa2a3(0x15d)+a39_0x1f4ec0[_0x1fa2a3(0x16c)](_0x26b198[_0x1fa2a3(0x17a)][_0x1fa2a3(0x178)]+'\x20journeys')+a39_0x1f4ec0[_0x1fa2a3(0x155)](_0x425735));}console[_0x1fa2a3(0x190)]('\x20\x20'+a39_0x1f4ec0['green']('+\x20'+_0x2664a3[_0x1fa2a3(0x16b)]+_0x1fa2a3(0x16f))),console['error']('\x20\x20'+a39_0x1f4ec0[_0x1fa2a3(0x164)]('~\x20'+_0x44b923[_0x1fa2a3(0x16b)]+_0x1fa2a3(0x192))),console[_0x1fa2a3(0x190)]('\x20\x20'+a39_0x1f4ec0['dim']('=\x20'+_0x441d91[_0x1fa2a3(0x16b)]+_0x1fa2a3(0x165))),console['error'](_0x1fa2a3(0x154)+a39_0x1f4ec0[_0x1fa2a3(0x16c)](_0x26b198[_0x1fa2a3(0x14b)])+'\x0a');if(_0x44b923['length']>0x0)for(const _0x1b4902 of _0x44b923){console[_0x1fa2a3(0x190)]('\x0aChanges\x20to\x20\x27'+_0x1b4902[_0x1fa2a3(0x170)]+'\x27:'),console['error']('─'['repeat'](0x3c)),console['error'](_0x1b4902['diff']),console[_0x1fa2a3(0x190)]('─'[_0x1fa2a3(0x18f)](0x3c));}if(_0x279a1b[_0x1fa2a3(0x184)])return console[_0x1fa2a3(0x190)](a39_0x1f4ec0['yellow'](_0x1fa2a3(0x171))),0x0;if(_0x2664a3['length']===0x0&&_0x44b923['length']===0x0)return console[_0x1fa2a3(0x190)](a39_0x1f4ec0[_0x1fa2a3(0x153)]('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x26b198[_0x1fa2a3(0x169)]},_0x279a1b[_0x1fa2a3(0x162)]),console[_0x1fa2a3(0x190)](a39_0x1f4ec0[_0x1fa2a3(0x153)](_0x1fa2a3(0x15c)+a39_0x1f4ec0[_0x1fa2a3(0x155)]('parent_segment')+'\x20=\x20'+a39_0x1f4ec0[_0x1fa2a3(0x16c)](_0x26b198[_0x1fa2a3(0x169)]))),0x0;if(!_0x279a1b['yes']){if(!isInteractive())return console['error'](a39_0x1f4ec0[_0x1fa2a3(0x182)](_0x1fa2a3(0x15e)),_0x1fa2a3(0x151)),console[_0x1fa2a3(0x190)](a39_0x1f4ec0['dim']('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x27fce2=await confirmKey('Write\x20'+(_0x2664a3['length']+_0x44b923[_0x1fa2a3(0x16b)])+_0x1fa2a3(0x17f));if(!_0x27fce2)return console['error'](a39_0x1f4ec0[_0x1fa2a3(0x164)](_0x1fa2a3(0x186)),_0x1fa2a3(0x18a)),0x1;}for(const _0x623548 of _0x26b198[_0x1fa2a3(0x161)]){if(_0x623548[_0x1fa2a3(0x15f)]||_0x623548[_0x1fa2a3(0x149)]){const _0x403f51=a39_0x1718de[_0x1fa2a3(0x18b)](_0x623548[_0x1fa2a3(0x17b)]);!existsSync(_0x403f51)&&mkdirSync(_0x403f51,{'recursive':!![]}),writeFileSync(_0x623548[_0x1fa2a3(0x17b)],_0x623548[_0x1fa2a3(0x188)],'utf-8');}}return console['error'](a39_0x1f4ec0['green'](_0x1fa2a3(0x158)+(_0x2664a3[_0x1fa2a3(0x16b)]+_0x44b923[_0x1fa2a3(0x16b)])+_0x1fa2a3(0x148)+_0x26b198[_0x1fa2a3(0x14b)])),saveSessionContext({'parent_segment':_0x26b198[_0x1fa2a3(0x169)]},_0x279a1b['session']),console[_0x1fa2a3(0x190)](a39_0x1f4ec0['green'](_0x1fa2a3(0x15c)+a39_0x1f4ec0[_0x1fa2a3(0x155)]('parent_segment')+_0x1fa2a3(0x14c)+a39_0x1f4ec0[_0x1fa2a3(0x16c)](_0x26b198[_0x1fa2a3(0x169)]))),0x0;}}