@treasuredata/tdx 2026.3.4 → 2026.3.6

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 (231) 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.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.d.ts.map +1 -1
  12. package/dist/commands/auth-command.js +1 -1
  13. package/dist/commands/auth-command.js.map +1 -1
  14. package/dist/commands/auth-login-command.d.ts +29 -0
  15. package/dist/commands/auth-login-command.d.ts.map +1 -0
  16. package/dist/commands/auth-login-command.js +1 -0
  17. package/dist/commands/auth-login-command.js.map +1 -0
  18. package/dist/commands/chat-command.js +1 -1
  19. package/dist/commands/claude-command.js +1 -1
  20. package/dist/commands/claude-statusline-command.js +1 -1
  21. package/dist/commands/claude-usage-command.js +1 -1
  22. package/dist/commands/command.js +1 -1
  23. package/dist/commands/connection-command.js +1 -1
  24. package/dist/commands/databases.js +1 -1
  25. package/dist/commands/delivery-command.js +1 -1
  26. package/dist/commands/describe.js +1 -1
  27. package/dist/commands/engage-campaign-pull-command.js +1 -1
  28. package/dist/commands/engage-campaign-push-command.js +1 -1
  29. package/dist/commands/engage-campaign-validate-command.js +1 -1
  30. package/dist/commands/engage-command.js +1 -1
  31. package/dist/commands/engage-template-pull-command.js +1 -1
  32. package/dist/commands/engage-template-push-command.js +1 -1
  33. package/dist/commands/engage-template-validate-command.js +1 -1
  34. package/dist/commands/job-command.js +1 -1
  35. package/dist/commands/journey-command.js +1 -1
  36. package/dist/commands/journey-validate-command.js +1 -1
  37. package/dist/commands/llm-command.js +1 -1
  38. package/dist/commands/mcp-command.d.ts.map +1 -1
  39. package/dist/commands/mcp-command.js +1 -1
  40. package/dist/commands/mcp-command.js.map +1 -1
  41. package/dist/commands/parent-segment-command.js +1 -1
  42. package/dist/commands/profile-command.d.ts.map +1 -1
  43. package/dist/commands/profile-command.js +1 -1
  44. package/dist/commands/profile-command.js.map +1 -1
  45. package/dist/commands/profiles-command.js +1 -1
  46. package/dist/commands/query-command.js +1 -1
  47. package/dist/commands/schedule-command.js +1 -1
  48. package/dist/commands/segment-command.js +1 -1
  49. package/dist/commands/segment-create-command.js +1 -1
  50. package/dist/commands/segment-fields-command.js +1 -1
  51. package/dist/commands/segment-pull-command.js +1 -1
  52. package/dist/commands/segment-push-command.js +1 -1
  53. package/dist/commands/segment-update-command.js +1 -1
  54. package/dist/commands/segment-use-command.js +1 -1
  55. package/dist/commands/segment-validate-command.js +1 -1
  56. package/dist/commands/segments.js +1 -1
  57. package/dist/commands/show.js +1 -1
  58. package/dist/commands/status-command.d.ts.map +1 -1
  59. package/dist/commands/status-command.js +1 -1
  60. package/dist/commands/status-command.js.map +1 -1
  61. package/dist/commands/tables.js +1 -1
  62. package/dist/commands/unset-command.js +1 -1
  63. package/dist/commands/upgrade-command.js +1 -1
  64. package/dist/commands/use-command.js +1 -1
  65. package/dist/commands/user-command.js +1 -1
  66. package/dist/commands/workflow-command.js +1 -1
  67. package/dist/core/auth.js +1 -1
  68. package/dist/core/command-output.js +1 -1
  69. package/dist/core/config.js +1 -1
  70. package/dist/core/connection-cache.js +1 -1
  71. package/dist/core/constants.d.ts +11 -0
  72. package/dist/core/constants.d.ts.map +1 -1
  73. package/dist/core/constants.js +1 -1
  74. package/dist/core/constants.js.map +1 -1
  75. package/dist/core/credential-cache.js +1 -1
  76. package/dist/core/global-context.d.ts.map +1 -1
  77. package/dist/core/global-context.js +1 -1
  78. package/dist/core/global-context.js.map +1 -1
  79. package/dist/core/keychain.js +1 -1
  80. package/dist/core/oauth-keychain.d.ts +32 -0
  81. package/dist/core/oauth-keychain.d.ts.map +1 -0
  82. package/dist/core/oauth-keychain.js +1 -0
  83. package/dist/core/oauth-keychain.js.map +1 -0
  84. package/dist/core/oauth.d.ts +112 -0
  85. package/dist/core/oauth.d.ts.map +1 -0
  86. package/dist/core/oauth.js +1 -0
  87. package/dist/core/oauth.js.map +1 -0
  88. package/dist/core/profile.js +1 -1
  89. package/dist/core/project-config.js +1 -1
  90. package/dist/core/session.js +1 -1
  91. package/dist/core/user-cache.js +1 -1
  92. package/dist/core/version.js +1 -1
  93. package/dist/index.js +1 -1
  94. package/dist/mcp/server.js +1 -1
  95. package/dist/mcp/tools/index.js +1 -1
  96. package/dist/mcp/tools/tdx-run.js +1 -1
  97. package/dist/mcp/tools/tdx-search.js +1 -1
  98. package/dist/mcp/utils.js +1 -1
  99. package/dist/proxy/claude-usage-tracker.js +1 -1
  100. package/dist/proxy/passthrough-server.js +1 -1
  101. package/dist/proxy/sse-usage-parser.js +1 -1
  102. package/dist/sdk/agent/agent-config.js +1 -1
  103. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  104. package/dist/sdk/agent/agent-yaml.js +1 -1
  105. package/dist/sdk/agent/test/evaluator.js +1 -1
  106. package/dist/sdk/agent/test/executor.js +1 -1
  107. package/dist/sdk/agent/test/index.js +1 -1
  108. package/dist/sdk/agent/test/output.js +1 -1
  109. package/dist/sdk/agent/test/parser.js +1 -1
  110. package/dist/sdk/agent/tool-target-registry.js +1 -1
  111. package/dist/sdk/api.js +1 -1
  112. package/dist/sdk/client/cdp-api-client.js +1 -1
  113. package/dist/sdk/client/delivery-api-client.js +1 -1
  114. package/dist/sdk/client/endpoints.js +1 -1
  115. package/dist/sdk/client/endpoints.js.map +1 -1
  116. package/dist/sdk/client/engage-api-client.js +1 -1
  117. package/dist/sdk/client/http-client.js +1 -1
  118. package/dist/sdk/client/llm-api-client.js +1 -1
  119. package/dist/sdk/client/oauth-refresh.d.ts +16 -0
  120. package/dist/sdk/client/oauth-refresh.d.ts.map +1 -0
  121. package/dist/sdk/client/oauth-refresh.js +1 -0
  122. package/dist/sdk/client/oauth-refresh.js.map +1 -0
  123. package/dist/sdk/client/rate-limiter.js +1 -1
  124. package/dist/sdk/client/td-api-client.js +1 -1
  125. package/dist/sdk/client/trino-api-client.js +1 -1
  126. package/dist/sdk/client/workflow-client.js +1 -1
  127. package/dist/sdk/connection-validator.js +1 -1
  128. package/dist/sdk/connection.js +1 -1
  129. package/dist/sdk/delivery.js +1 -1
  130. package/dist/sdk/engage/campaign-pull.js +1 -1
  131. package/dist/sdk/engage/campaign-push.js +1 -1
  132. package/dist/sdk/engage/campaign-validator.js +1 -1
  133. package/dist/sdk/engage/campaign-yaml.js +1 -1
  134. package/dist/sdk/engage/template-pull.js +1 -1
  135. package/dist/sdk/engage/template-push.js +1 -1
  136. package/dist/sdk/engage/template-validator.js +1 -1
  137. package/dist/sdk/engage/template-yaml.js +1 -1
  138. package/dist/sdk/engage/types/campaign-def.js +1 -1
  139. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  140. package/dist/sdk/engage/types/template-schema.js +1 -1
  141. package/dist/sdk/engage.js +1 -1
  142. package/dist/sdk/errors.js +1 -1
  143. package/dist/sdk/index.js +1 -1
  144. package/dist/sdk/io/index.js +1 -1
  145. package/dist/sdk/io/node-filesystem.js +1 -1
  146. package/dist/sdk/job.js +1 -1
  147. package/dist/sdk/journey.js +1 -1
  148. package/dist/sdk/llm/chat-cache.js +1 -1
  149. package/dist/sdk/llm/index.js +1 -1
  150. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  151. package/dist/sdk/llm/model-factors.d.ts.map +1 -1
  152. package/dist/sdk/llm/model-factors.js +1 -1
  153. package/dist/sdk/llm/model-factors.js.map +1 -1
  154. package/dist/sdk/personalization.js +1 -1
  155. package/dist/sdk/query/index.js +1 -1
  156. package/dist/sdk/query/sql-parser.js +1 -1
  157. package/dist/sdk/realtime.js +1 -1
  158. package/dist/sdk/schedule.js +1 -1
  159. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  160. package/dist/sdk/segment/fields-display.js +1 -1
  161. package/dist/sdk/segment/file-discovery.js +1 -1
  162. package/dist/sdk/segment/journey-utils.js +1 -1
  163. package/dist/sdk/segment/journey-validator.js +1 -1
  164. package/dist/sdk/segment/journey-yaml.js +1 -1
  165. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  166. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  167. package/dist/sdk/segment/pull-workflow.js +1 -1
  168. package/dist/sdk/segment/push-recovery.js +1 -1
  169. package/dist/sdk/segment/push-workflow.js +1 -1
  170. package/dist/sdk/segment/resolution-context.js +1 -1
  171. package/dist/sdk/segment/segment-path-parser.js +1 -1
  172. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  173. package/dist/sdk/segment/segment-validator.js +1 -1
  174. package/dist/sdk/segment/target-resolution.js +1 -1
  175. package/dist/sdk/segment/tdx-config.js +1 -1
  176. package/dist/sdk/segment/types/activation-schema.js +1 -1
  177. package/dist/sdk/segment/types/journey-def.js +1 -1
  178. package/dist/sdk/segment/types/journey-schema.js +1 -1
  179. package/dist/sdk/segment/types/segment-def.js +1 -1
  180. package/dist/sdk/segment/types/segment-schema.js +1 -1
  181. package/dist/sdk/segment/validate-files.js +1 -1
  182. package/dist/sdk/segment/yaml-validator.js +1 -1
  183. package/dist/sdk/segment.js +1 -1
  184. package/dist/sdk/types/index.js +1 -1
  185. package/dist/sdk/types/progress.js +1 -1
  186. package/dist/sdk/user.js +1 -1
  187. package/dist/sdk/util/format-detector.js +1 -1
  188. package/dist/sdk/util/formatters.js +1 -1
  189. package/dist/sdk/util/index.js +1 -1
  190. package/dist/sdk/util/paginate.js +1 -1
  191. package/dist/sdk/util/tree-formatter.js +1 -1
  192. package/dist/sdk/workflow/archive-validation.js +1 -1
  193. package/dist/sdk/workflow/clone-workflow.js +1 -1
  194. package/dist/sdk/workflow/index.js +1 -1
  195. package/dist/sdk/workflow/pull-workflow.js +1 -1
  196. package/dist/sdk/workflow/push-workflow.js +1 -1
  197. package/dist/sdk/workflow/tdx-config.js +1 -1
  198. package/dist/sdk/workflow/workflow-utils.js +1 -1
  199. package/dist/test-utils/command-runner.js +1 -1
  200. package/dist/test-utils/factories.js +1 -1
  201. package/dist/test-utils/fixtures.js +1 -1
  202. package/dist/test-utils/http-mock.js +1 -1
  203. package/dist/test-utils/index.js +1 -1
  204. package/dist/utils/async.js +1 -1
  205. package/dist/utils/colors.js +1 -1
  206. package/dist/utils/diff.js +1 -1
  207. package/dist/utils/file-permissions.js +1 -1
  208. package/dist/utils/file-reader.js +1 -1
  209. package/dist/utils/github-releases.js +1 -1
  210. package/dist/utils/global-cache.js +1 -1
  211. package/dist/utils/json-loader.js +1 -1
  212. package/dist/utils/local-cache.js +1 -1
  213. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  214. package/dist/utils/logger/formatters/index.js +1 -1
  215. package/dist/utils/logger/handlers/console-handler.js +1 -1
  216. package/dist/utils/logger/handlers/file-handler.js +1 -1
  217. package/dist/utils/logger/handlers/index.js +1 -1
  218. package/dist/utils/logger/handlers/null-handler.js +1 -1
  219. package/dist/utils/logger/index.js +1 -1
  220. package/dist/utils/logger/logger.js +1 -1
  221. package/dist/utils/logger/types.js +1 -1
  222. package/dist/utils/option-validation.js +1 -1
  223. package/dist/utils/process.js +1 -1
  224. package/dist/utils/prompt.js +1 -1
  225. package/dist/utils/spinner.js +1 -1
  226. package/dist/utils/sse-parser.js +1 -1
  227. package/dist/utils/string-utils.js +1 -1
  228. package/dist/utils/table-ref-parser.js +1 -1
  229. package/dist/utils/tdx-logger.js +1 -1
  230. package/dist/utils/version-check.js +1 -1
  231. package/package.json +1 -1
@@ -1 +1 @@
1
- const a32_0x465a96=a32_0x2c68;(function(_0xcc8ab2,_0x5e6e62){const _0x89a1a3=a32_0x2c68,_0x106528=_0xcc8ab2();while(!![]){try{const _0x6a3f4c=-parseInt(_0x89a1a3(0x191))/0x1+parseInt(_0x89a1a3(0x199))/0x2*(-parseInt(_0x89a1a3(0x186))/0x3)+parseInt(_0x89a1a3(0x19e))/0x4+parseInt(_0x89a1a3(0x19c))/0x5*(parseInt(_0x89a1a3(0x17e))/0x6)+parseInt(_0x89a1a3(0x18f))/0x7*(-parseInt(_0x89a1a3(0x1a1))/0x8)+parseInt(_0x89a1a3(0x195))/0x9*(parseInt(_0x89a1a3(0x180))/0xa)+parseInt(_0x89a1a3(0x171))/0xb*(parseInt(_0x89a1a3(0x194))/0xc);if(_0x6a3f4c===_0x5e6e62)break;else _0x106528['push'](_0x106528['shift']());}catch(_0x2b57f1){_0x106528['push'](_0x106528['shift']());}}}(a32_0x30ac,0xbd876));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';function a32_0x2c68(_0xdf7658,_0x424a45){_0xdf7658=_0xdf7658-0x16f;const _0x30ac0c=a32_0x30ac();let _0x2c68a9=_0x30ac0c[_0xdf7658];return _0x2c68a9;}import{formatRows}from'../sdk/util/formatters.js';function a32_0x30ac(){const _0x4c648f=['80EewvIj','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','length','setPhase','90937YzhsUK','catalog','Schema:\x20','message','description','\x0aAll\x20results\x20saved\x20to\x20','\x20rows\x20','processedRows','push','Executing\x20query...','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','Catalog:\x20','args','1528806HHKOJF','information_schema','3075290VjKpsC','jobId','execute','elapsedTimeMillis','file','validate','69VSrNyv','totalSplits','output','stats','query','database','No\x20SQL\x20provided','verbose','...','929712VIlleP','site','620952BdWDmS','Statement\x20','data','264kbdYEi','18XNVxoW','error','Run\x20Trino\x20queries\x20(streaming)','setExtra','45446gxyVkp','Site:\x20','setJobId','25MfDhOH','\x20splits','4708456RcDswU','Executing\x20query\x20[','in\x20'];a32_0x30ac=function(){return _0x4c648f;};return a32_0x30ac();}export class QueryCommand extends BaseCommand{['name']=a32_0x465a96(0x18a);[a32_0x465a96(0x175)]=a32_0x465a96(0x197);async[a32_0x465a96(0x182)](_0x2e4587){const _0x4460e9=a32_0x465a96,{options:_0x247f70,args:_0x119064,tdx:_0x13f9f7}=_0x2e4587,_0x3c6ddb={..._0x247f70,'limitStructuredFormats':!![]},_0x317c5b=_0x119064[0x0],_0x53558a=_0x247f70[_0x4460e9(0x184)];let _0x1b6864;try{if(_0x53558a)_0x1b6864=readSqlStatementsFromFile(_0x53558a);else{if(_0x317c5b==='-')_0x1b6864=await readSqlStatementsFromStdin();else{if(_0x317c5b&&isSqlFilePath(_0x317c5b))_0x1b6864=readSqlStatementsFromFile(_0x317c5b);else{if(_0x317c5b)_0x1b6864=splitSqlStatements(_0x317c5b);else throw new Error(_0x4460e9(0x18c));}}}}catch(_0x454cb4){return console[_0x4460e9(0x196)]('Error:\x20'+_0x454cb4[_0x4460e9(0x174)]),0x1;}const _0x1a7ae0=_0x247f70[_0x4460e9(0x18b)]||_0x4460e9(0x17f),_0x5e6df0=_0x247f70[_0x4460e9(0x172)];try{const _0x195e5c=[],_0x10d12e=!!_0x247f70[_0x4460e9(0x188)];for(let _0x59485c=0x0;_0x59485c<_0x1b6864[_0x4460e9(0x16f)];_0x59485c++){const _0x21d59a=_0x1b6864[_0x59485c],_0x2268e2=_0x59485c+0x1,_0x10070b=_0x1b6864[_0x4460e9(0x16f)],_0x3d4c05=_0x10070b>0x1;_0x247f70[_0x4460e9(0x18d)]&&(console[_0x4460e9(0x196)]('\x0a'+(_0x3d4c05?_0x4460e9(0x192)+_0x2268e2+'/'+_0x10070b+':':'')),console['error'](_0x4460e9(0x19a)+_0x247f70[_0x4460e9(0x190)]),console[_0x4460e9(0x196)](_0x4460e9(0x17c)+(_0x5e6df0||'td')),console[_0x4460e9(0x196)](_0x4460e9(0x173)+_0x1a7ae0),console[_0x4460e9(0x196)]('SQL:\x20'+_0x21d59a));const _0x3174d9=_0x3d4c05?'Executing\x20statement\x20'+_0x2268e2+'/'+_0x10070b+_0x4460e9(0x18e):_0x4460e9(0x17a);try{const _0x29e2e1=await withProgressSpinner(_0x3174d9,async _0x56951b=>{const _0x595428=_0x4460e9,_0x489656=await _0x13f9f7[_0x595428(0x18a)][_0x595428(0x182)](_0x21d59a,{'catalog':_0x5e6df0,'schema':_0x1a7ae0,'onJobId':_0x40792a=>{const _0x5858dd=_0x595428;_0x56951b[_0x5858dd(0x19b)](_0x40792a);},'onProgress':_0x2c49c1=>{const _0x385edd=_0x595428;_0x56951b[_0x385edd(0x170)](_0x385edd(0x19f)+_0x2c49c1['state']+']'),_0x56951b[_0x385edd(0x198)](formatRows(_0x2c49c1[_0x385edd(0x178)])+_0x385edd(0x177)+_0x2c49c1['completedSplits']+'/'+_0x2c49c1[_0x385edd(0x187)]+_0x385edd(0x19d));}});return _0x489656;},{'verbose':_0x247f70[_0x4460e9(0x18d)]}),_0x1b6fd1=_0x29e2e1[_0x4460e9(0x193)],_0x68d2e2=_0x1b6fd1[_0x4460e9(0x181)]?'\x20[Job\x20ID:\x20'+_0x1b6fd1['jobId']+']':'',_0x41fefb=_0x3d4c05?'Statement\x20'+_0x2268e2+'/'+_0x10070b+'\x20-\x20':'';console[_0x4460e9(0x196)]('✔\x20'+_0x41fefb+'Query\x20completed:\x20Processed\x20'+formatRows(_0x1b6fd1[_0x4460e9(0x189)]['processedRows'])+'\x20rows\x20'+(_0x4460e9(0x1a0)+formatElapsed(_0x1b6fd1[_0x4460e9(0x189)][_0x4460e9(0x183)])+_0x68d2e2));if(_0x3d4c05&&_0x10d12e){const _0x5d2fee=resolveOutputOptions(_0x3c6ddb),_0x792e47=await formatQueryOutput(_0x1b6fd1,_0x5d2fee);_0x195e5c[_0x4460e9(0x179)](_0x792e47);}else await handleQueryOutput(_0x1b6fd1,_0x3c6ddb);}catch(_0xe3cc43){const _0x92754d=_0x3d4c05?'Statement\x20'+_0x2268e2+'/'+_0x10070b+':\x0a':'',_0x274640=_0xe3cc43 instanceof SDKError?_0xe3cc43['originalMessage']:_0xe3cc43[_0x4460e9(0x174)];return console[_0x4460e9(0x196)](''+_0x92754d+_0x274640),0x1;}}if(_0x1b6864[_0x4460e9(0x16f)]>0x1&&_0x10d12e&&_0x195e5c['length']>0x0){const _0x5b5507=_0x195e5c['join']('\x0a');writeFileSync(_0x247f70[_0x4460e9(0x188)],_0x5b5507),console[_0x4460e9(0x196)](_0x4460e9(0x176)+_0x247f70['output']);}return 0x0;}catch(_0xd78ac){throw _0xd78ac;}}[a32_0x465a96(0x185)](_0x279462){const _0x5826e5=a32_0x465a96,_0xe217c5=_0x279462[_0x5826e5(0x17d)][0x0],_0x47d059=_0x279462['options'][_0x5826e5(0x184)];if(!_0xe217c5&&!_0x47d059)return _0x5826e5(0x1a2);if(_0xe217c5&&_0x47d059)return _0x5826e5(0x17b);return undefined;}}
1
+ const a33_0x580a51=a33_0x217c;(function(_0x5d8e67,_0x55eb20){const _0x2ba2cb=a33_0x217c,_0x22d65f=_0x5d8e67();while(!![]){try{const _0x3abc63=-parseInt(_0x2ba2cb(0x112))/0x1+parseInt(_0x2ba2cb(0x135))/0x2*(-parseInt(_0x2ba2cb(0x11b))/0x3)+-parseInt(_0x2ba2cb(0x115))/0x4+parseInt(_0x2ba2cb(0x139))/0x5+-parseInt(_0x2ba2cb(0x130))/0x6*(parseInt(_0x2ba2cb(0x113))/0x7)+-parseInt(_0x2ba2cb(0x12b))/0x8*(-parseInt(_0x2ba2cb(0x12e))/0x9)+-parseInt(_0x2ba2cb(0x11e))/0xa*(-parseInt(_0x2ba2cb(0x145))/0xb);if(_0x3abc63===_0x55eb20)break;else _0x22d65f['push'](_0x22d65f['shift']());}catch(_0x9bb5e3){_0x22d65f['push'](_0x22d65f['shift']());}}}(a33_0x1b3f,0x49bbe));import{BaseCommand}from'./command.js';function a33_0x217c(_0x4e6d4c,_0x26ce35){_0x4e6d4c=_0x4e6d4c-0x112;const _0x1b3fa6=a33_0x1b3f();let _0x217c26=_0x1b3fa6[_0x4e6d4c];return _0x217c26;}import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a33_0x580a51(0x122)]=a33_0x580a51(0x127);[a33_0x580a51(0x138)]='Run\x20Trino\x20queries\x20(streaming)';async[a33_0x580a51(0x119)](_0x5456ae){const _0x48d441=a33_0x580a51,{options:_0x142d9d,args:_0x14fe04,tdx:_0x3e7510}=_0x5456ae,_0x3e8c64={..._0x142d9d,'limitStructuredFormats':!![]},_0x2055d1=_0x14fe04[0x0],_0x3642f8=_0x142d9d[_0x48d441(0x11a)];let _0x3087be;try{if(_0x3642f8)_0x3087be=readSqlStatementsFromFile(_0x3642f8);else{if(_0x2055d1==='-')_0x3087be=await readSqlStatementsFromStdin();else{if(_0x2055d1&&isSqlFilePath(_0x2055d1))_0x3087be=readSqlStatementsFromFile(_0x2055d1);else{if(_0x2055d1)_0x3087be=splitSqlStatements(_0x2055d1);else throw new Error(_0x48d441(0x117));}}}}catch(_0x2ace76){return console[_0x48d441(0x13b)](_0x48d441(0x116)+_0x2ace76[_0x48d441(0x11f)]),0x1;}const _0x566a6c=_0x142d9d[_0x48d441(0x124)]||'information_schema',_0x3250db=_0x142d9d[_0x48d441(0x147)];try{const _0x494a10=[],_0x1f33fa=!!_0x142d9d[_0x48d441(0x123)];for(let _0x46f6d8=0x0;_0x46f6d8<_0x3087be[_0x48d441(0x133)];_0x46f6d8++){const _0x2097f8=_0x3087be[_0x46f6d8],_0x4b0ff0=_0x46f6d8+0x1,_0x5ee17b=_0x3087be[_0x48d441(0x133)],_0x336400=_0x5ee17b>0x1;_0x142d9d['verbose']&&(console[_0x48d441(0x13b)]('\x0a'+(_0x336400?_0x48d441(0x148)+_0x4b0ff0+'/'+_0x5ee17b+':':'')),console[_0x48d441(0x13b)](_0x48d441(0x120)+_0x142d9d[_0x48d441(0x129)]),console[_0x48d441(0x13b)](_0x48d441(0x12f)+(_0x3250db||'td')),console['error']('Schema:\x20'+_0x566a6c),console[_0x48d441(0x13b)](_0x48d441(0x140)+_0x2097f8));const _0x9ea2f4=_0x336400?_0x48d441(0x137)+_0x4b0ff0+'/'+_0x5ee17b+_0x48d441(0x126):_0x48d441(0x13a);try{const _0x24cf45=await withProgressSpinner(_0x9ea2f4,async _0x32de61=>{const _0x3225a6=_0x48d441,_0x4eb896=await _0x3e7510[_0x3225a6(0x127)][_0x3225a6(0x119)](_0x2097f8,{'catalog':_0x3250db,'schema':_0x566a6c,'onJobId':_0x4bbb58=>{_0x32de61['setJobId'](_0x4bbb58);},'onProgress':_0x9ceeb1=>{const _0x5a4717=_0x3225a6;_0x32de61[_0x5a4717(0x11c)](_0x5a4717(0x132)+_0x9ceeb1['state']+']'),_0x32de61['setExtra'](formatRows(_0x9ceeb1[_0x5a4717(0x141)])+_0x5a4717(0x13c)+_0x9ceeb1['completedSplits']+'/'+_0x9ceeb1[_0x5a4717(0x118)]+_0x5a4717(0x143));}});return _0x4eb896;},{'verbose':_0x142d9d[_0x48d441(0x13d)]}),_0x271649=_0x24cf45[_0x48d441(0x146)],_0x4f985a=_0x271649[_0x48d441(0x142)]?_0x48d441(0x13f)+_0x271649['jobId']+']':'',_0xc80111=_0x336400?'Statement\x20'+_0x4b0ff0+'/'+_0x5ee17b+_0x48d441(0x12d):'';console[_0x48d441(0x13b)]('✔\x20'+_0xc80111+_0x48d441(0x125)+formatRows(_0x271649[_0x48d441(0x128)][_0x48d441(0x141)])+_0x48d441(0x13c)+(_0x48d441(0x12a)+formatElapsed(_0x271649[_0x48d441(0x128)][_0x48d441(0x11d)])+_0x4f985a));if(_0x336400&&_0x1f33fa){const _0x5f2848=resolveOutputOptions(_0x3e8c64),_0x405f3d=await formatQueryOutput(_0x271649,_0x5f2848);_0x494a10['push'](_0x405f3d);}else await handleQueryOutput(_0x271649,_0x3e8c64);}catch(_0xc57c41){const _0x3ee6f2=_0x336400?'Statement\x20'+_0x4b0ff0+'/'+_0x5ee17b+':\x0a':'',_0x1f54a7=_0xc57c41 instanceof SDKError?_0xc57c41[_0x48d441(0x136)]:_0xc57c41['message'];return console['error'](''+_0x3ee6f2+_0x1f54a7),0x1;}}if(_0x3087be[_0x48d441(0x133)]>0x1&&_0x1f33fa&&_0x494a10[_0x48d441(0x133)]>0x0){const _0x34c110=_0x494a10[_0x48d441(0x121)]('\x0a');writeFileSync(_0x142d9d[_0x48d441(0x123)],_0x34c110),console['error'](_0x48d441(0x12c)+_0x142d9d[_0x48d441(0x123)]);}return 0x0;}catch(_0x361362){throw _0x361362;}}[a33_0x580a51(0x13e)](_0x38999b){const _0x26f4e1=a33_0x580a51,_0x5096a6=_0x38999b[_0x26f4e1(0x144)][0x0],_0x5762cf=_0x38999b[_0x26f4e1(0x114)][_0x26f4e1(0x11a)];if(!_0x5096a6&&!_0x5762cf)return _0x26f4e1(0x131);if(_0x5096a6&&_0x5762cf)return _0x26f4e1(0x134);return undefined;}}function a33_0x1b3f(){const _0x561c81=['setPhase','elapsedTimeMillis','30FoZHzM','message','Site:\x20','join','name','output','database','Query\x20completed:\x20Processed\x20','...','query','stats','site','in\x20','1029592sanyUF','\x0aAll\x20results\x20saved\x20to\x20','\x20-\x20','18BkSYoL','Catalog:\x20','6Yyrrhp','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','Executing\x20query\x20[','length','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','4068DLtSuo','originalMessage','Executing\x20statement\x20','description','2023510elOnRc','Executing\x20query...','error','\x20rows\x20','verbose','validate','\x20[Job\x20ID:\x20','SQL:\x20','processedRows','jobId','\x20splits','args','2760923eEfzXg','data','catalog','Statement\x20','147267rVSYAc','3620197yQpWvN','options','606652gwSBVm','Error:\x20','No\x20SQL\x20provided','totalSplits','execute','file','438ZtrfIt'];a33_0x1b3f=function(){return _0x561c81;};return a33_0x1b3f();}
@@ -1 +1 @@
1
- const a33_0x1e4fb4=a33_0x2d54;(function(_0x1e7b7a,_0x1b1c79){const _0x47f7ca=a33_0x2d54,_0x54278d=_0x1e7b7a();while(!![]){try{const _0x52647c=parseInt(_0x47f7ca(0x113))/0x1+-parseInt(_0x47f7ca(0xf2))/0x2+-parseInt(_0x47f7ca(0x10a))/0x3*(parseInt(_0x47f7ca(0x92))/0x4)+-parseInt(_0x47f7ca(0x96))/0x5+-parseInt(_0x47f7ca(0xfa))/0x6*(parseInt(_0x47f7ca(0xd1))/0x7)+parseInt(_0x47f7ca(0xd0))/0x8+-parseInt(_0x47f7ca(0x90))/0x9*(-parseInt(_0x47f7ca(0xf8))/0xa);if(_0x52647c===_0x1b1c79)break;else _0x54278d['push'](_0x54278d['shift']());}catch(_0x36d754){_0x54278d['push'](_0x54278d['shift']());}}}(a33_0x1090,0x2bd0c));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a33_0x2d54(_0xa747a5,_0x2bddd5){_0xa747a5=_0xa747a5-0x83;const _0x109077=a33_0x1090();let _0x2d543b=_0x109077[_0xa747a5];return _0x2d543b;}import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';function a33_0x1090(){const _0x17a79e=['Update\x20a\x20scheduled\x20query','Creating\x20schedule:\x20','cyan','delete','result','description','query','Show\x20schedule\x20details','time','Updating\x20schedule:\x20','d\x20ago','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','num','\x20\x20Timezone:\x20','success','153knnEIM','Schedule\x20updated:\x20','268xYbzpT','schedule:show','keys','delay','1335620AhcyKX','Updating\x20schedule...','statusIcon','last_job','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','nextRun','user','next_run_at','schedule:update','substring','INVALID_ARGUMENT','engineVersion','args','schedules','yes','jsonl','red','Run\x20a\x20scheduled\x20query\x20immediately','validate','name','file','tsv','job_id','Schedule\x20run\x20submitted:\x20','schedule:run','\x22...','queries','\x20\x20Cron:\x20','json','cron','lastRun','Delete\x20a\x20scheduled\x20query','retryLimit','Listing\x20scheduled\x20queries...','just\x20now','\x20\x20Job\x20ID:\x20','Schedule\x20deleted:\x20','scheduled_at','No\x20scheduled\x20queries\x20found','format','Query\x20file\x20is\x20empty','Running\x20schedule:\x20','status','List\x20scheduled\x20queries','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','map','execute','executing_user_id','options','schedule:list','\x20\x20Type:\x20','m\x20ago','max','create','list','\x20(showing\x20','getTime','table','1329856rTCjaz','359170sOTgUd','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','data','utf-8','/app/queries/editor?queryId=','repeat','Running\x20schedule...','Showing\x20first\x20','type','h\x20ago','trino','error','Failed\x20to\x20read\x20file:\x20','pagination','priority','round','run','schedule:history','verbose','padEnd','\x20matching\x20\x22','time_zone','ies','site','\x20created','database','limit','schedule:delete','retry_limit','Schedule\x20created:\x20','📅\x20','\x20\x20Database:\x20','soon','264494TufwAd','entries','\x20schedules','\x20\x20→\x20','length','\x20\x20Num:\x20','271270xeCQWu','in\x20','6jNyhQy','\x20\x20Time:\x20','trim','timezone','show','from','created_at','queryUrl','join','engine_version','never','\x20scheduled\x20quer','history','...','has_next_page','Getting\x20schedule\x20details...','8727pDwouF','Searching\x20scheduled\x20queries\x20matching\x20\x22','count','start_at','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','\x20job','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','dim','end_at','197661YWmjcH'];a33_0x1090=function(){return _0x17a79e;};return a33_0x1090();}import{hyperlink}from'../sdk/util/formatters.js';import a33_0x2856af from'chalk';function formatRelativeTime(_0x3f2808){const _0x3fd785=a33_0x2d54,_0x3fbee5=new Date(_0x3f2808),_0x360d0d=new Date(),_0x262d08=_0x3fbee5[_0x3fd785(0xce)]()-_0x360d0d[_0x3fd785(0xce)](),_0x5dd8ec=Math['abs'](_0x262d08)/0x3e8,_0xf9c014=_0x262d08<0x0;if(_0x5dd8ec<0x3c)return _0xf9c014?_0x3fd785(0xb8):_0x3fd785(0xf1);else{if(_0x5dd8ec<0xe10){const _0x163cdc=Math[_0x3fd785(0xe0)](_0x5dd8ec/0x3c);return _0xf9c014?_0x163cdc+_0x3fd785(0xc9):_0x3fd785(0xf9)+_0x163cdc+'m';}else{if(_0x5dd8ec<0x15180){const _0x4b7f11=Math[_0x3fd785(0xe0)](_0x5dd8ec/0xe10);return _0xf9c014?_0x4b7f11+_0x3fd785(0xda):'in\x20'+_0x4b7f11+'h';}else{if(_0x5dd8ec<0x93a80){const _0xcf1a5b=Math[_0x3fd785(0xe0)](_0x5dd8ec/0x15180);return _0xf9c014?_0xcf1a5b+_0x3fd785(0x8b):_0x3fd785(0xf9)+_0xcf1a5b+'d';}else return _0x3fbee5['toLocaleDateString']();}}}}export class ScheduleListCommand extends BaseCommand{[a33_0x1e4fb4(0xa9)]=a33_0x1e4fb4(0xc7);['description']=a33_0x1e4fb4(0xc1);async['execute'](_0x1489d3){const _0x1c70f0=a33_0x1e4fb4,{options:_0x5a4631,args:_0x32399c,tdx:_0x362678}=_0x1489d3,_0x22707a=resolveLimit(_0x5a4631[_0x1c70f0(0xeb)],DEFAULT_DISPLAY_LIMIT),_0x4e2b56=_0x32399c[0x0],_0x44fd0f=_0x4e2b56?_0x1c70f0(0x10b)+_0x4e2b56+_0x1c70f0(0xaf):_0x1c70f0(0xb7),_0x5309e2=await withSpinner(_0x44fd0f,()=>_0x362678['schedules']['listQueries']({'limit':_0x22707a,'scheduled':!![],'pattern':_0x4e2b56}),{'verbose':_0x5a4631['verbose']}),_0x521247=_0x5309e2[_0x1c70f0(0xd3)][_0x1c70f0(0xb0)],_0x7febe6=_0x5309e2[_0x1c70f0(0xd3)][_0x1c70f0(0xde)][_0x1c70f0(0x108)],_0x2a7500=_0x4e2b56?_0x1c70f0(0xe5)+_0x4e2b56+'\x22':'';_0x7febe6?console[_0x1c70f0(0xdc)](_0x1c70f0(0xd8)+_0x521247[_0x1c70f0(0xf6)]+_0x1c70f0(0xf4)+_0x2a7500+'\x20(use\x20--limit\x20to\x20see\x20more)'):console[_0x1c70f0(0xdc)]('Found\x20'+_0x521247['length']+_0x1c70f0(0x105)+(_0x521247[_0x1c70f0(0xf6)]!==0x1?_0x1c70f0(0xe7):'y')+_0x2a7500);if(_0x5a4631[_0x1c70f0(0xbd)]===_0x1c70f0(0xb2)||_0x5a4631['format']===_0x1c70f0(0xa5)||_0x5a4631[_0x1c70f0(0xbd)]===_0x1c70f0(0xcf)||_0x5a4631[_0x1c70f0(0xbd)]===_0x1c70f0(0xab)){const _0x6d4d=_0x521247['map'](_0x48b2fd=>({'id':_0x48b2fd['id'],'name':_0x48b2fd[_0x1c70f0(0xa9)],'cron':_0x48b2fd[_0x1c70f0(0xb3)],'database':_0x48b2fd[_0x1c70f0(0xea)]?.['name'],'type':_0x48b2fd[_0x1c70f0(0xd9)],'timezone':_0x48b2fd[_0x1c70f0(0xe6)],'user_name':_0x48b2fd[_0x1c70f0(0x9c)]?.[_0x1c70f0(0xa9)],'updated_at':_0x48b2fd['updated_at'],'next_run_at':_0x48b2fd[_0x1c70f0(0x9d)],'last_job_status':_0x48b2fd[_0x1c70f0(0x99)]?.[_0x1c70f0(0xc0)]}));await handleSDKOutput(_0x6d4d,_0x5a4631);}else{if(_0x521247[_0x1c70f0(0xf6)]===0x0)console['log'](_0x1c70f0(0xbc));else{const _0x35f59e=_0x5a4631[_0x1c70f0(0xe8)],_0x18f38d=_0x521247[_0x1c70f0(0xc3)](_0x2b1f5e=>{const _0x3144e3=_0x1c70f0,_0x13f62d=_0x2b1f5e[_0x3144e3(0x99)]?.[_0x3144e3(0xc0)]?_0x2b1f5e[_0x3144e3(0x99)][_0x3144e3(0xc0)]===_0x3144e3(0x8f)?'✓':'✗':'-',_0xe7c629=_0x2b1f5e[_0x3144e3(0x99)]?.['ended_at']?formatRelativeTime(_0x2b1f5e['last_job']['ended_at']):_0x3144e3(0x104),_0x132342=_0x2b1f5e['next_run_at']?formatRelativeTime(_0x2b1f5e[_0x3144e3(0x9d)]):'-',_0x2821ee=_0x2b1f5e[_0x3144e3(0xb3)]||'',_0x14883a=_0x2b1f5e[_0x3144e3(0xa9)]||'(unnamed)',_0x48bfdb=getConsoleUrl(_0x35f59e,_0x3144e3(0xd5)+_0x2b1f5e['id']);return{'statusIcon':_0x13f62d,'lastRun':_0xe7c629,'nextRun':_0x132342,'cron':_0x2821ee,'name':_0x14883a,'queryUrl':_0x48bfdb,'status':_0x2b1f5e[_0x3144e3(0x99)]?.[_0x3144e3(0xc0)]};}),_0x3d462d=Math[_0x1c70f0(0xca)](..._0x18f38d['map'](_0xffa075=>_0xffa075[_0x1c70f0(0xb4)][_0x1c70f0(0xf6)])),_0x35a39a=Math[_0x1c70f0(0xca)](..._0x18f38d['map'](_0x36b082=>_0x36b082[_0x1c70f0(0x9b)][_0x1c70f0(0xf6)])),_0xd957d7=Math['max'](..._0x18f38d[_0x1c70f0(0xc3)](_0x176fdc=>_0x176fdc[_0x1c70f0(0xb3)][_0x1c70f0(0xf6)])),_0xdff62=_0x18f38d[_0x1c70f0(0xc3)](_0xc06bc5=>{const _0x371f3a=_0x1c70f0,_0x4a1595=_0xc06bc5[_0x371f3a(0xc0)]===_0x371f3a(0x8f)?a33_0x2856af['green'](_0xc06bc5[_0x371f3a(0x98)]):_0xc06bc5[_0x371f3a(0xc0)]===_0x371f3a(0xdc)?a33_0x2856af[_0x371f3a(0xa6)](_0xc06bc5['statusIcon']):a33_0x2856af[_0x371f3a(0x111)](_0xc06bc5[_0x371f3a(0x98)]),_0xda57e2=_0xc06bc5[_0x371f3a(0xb4)][_0x371f3a(0xe4)](_0x3d462d),_0x1a7268=_0xc06bc5['nextRun'][_0x371f3a(0xe4)](_0x35a39a),_0x3ddfeb=_0xc06bc5['cron']?a33_0x2856af[_0x371f3a(0x83)](_0xc06bc5[_0x371f3a(0xb3)][_0x371f3a(0xe4)](_0xd957d7)):'\x20'[_0x371f3a(0xd6)](_0xd957d7),_0x2e41eb=hyperlink(_0xc06bc5[_0x371f3a(0xa9)],_0xc06bc5[_0x371f3a(0x101)]);return _0x371f3a(0xef)+_0x4a1595+'\x20'+_0xda57e2+_0x371f3a(0xf5)+_0x1a7268+'\x20\x20'+_0x3ddfeb+'\x20\x20'+_0x2e41eb;});await writeOutput(_0xdff62[_0x1c70f0(0x102)]('\x0a'),_0x5a4631['output'],_0x1c70f0(0xcc));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a33_0x1e4fb4(0xa9)]=a33_0x1e4fb4(0x93);[a33_0x1e4fb4(0x86)]=a33_0x1e4fb4(0x88);['validate'](_0x53491a){const _0x202c93=a33_0x1e4fb4,_0x7b3698=_0x53491a[_0x202c93(0xa2)][0x0];if(!_0x7b3698)return _0x202c93(0x10e);return undefined;}async[a33_0x1e4fb4(0xc4)](_0x31b13c){const _0x27fc3b=a33_0x1e4fb4,{options:_0x5e3b50,args:_0x2eed7c,tdx:_0x4379cf}=_0x31b13c,_0x5b181e=_0x2eed7c[0x0],_0x2b9c6=await withSpinner(_0x27fc3b(0x109),()=>_0x4379cf[_0x27fc3b(0xa3)][_0x27fc3b(0xfe)](_0x5b181e),{'verbose':_0x5e3b50['verbose']}),_0x27acc9=_0x2b9c6['data'],_0x3ce93c={'name':_0x27acc9[_0x27fc3b(0xa9)],'cron':_0x27acc9[_0x27fc3b(0xb3)],'database':_0x27acc9['database'],'type':_0x27acc9[_0x27fc3b(0xd9)],'timezone':_0x27acc9[_0x27fc3b(0xfd)],'user_name':_0x27acc9['user_name'],'created_at':_0x27acc9['created_at'],'engine_version':_0x27acc9['engine_version'],'executing_user_id':_0x27acc9[_0x27fc3b(0xc5)],'query':_0x27acc9[_0x27fc3b(0x87)],'delay':_0x27acc9[_0x27fc3b(0x95)],'priority':_0x27acc9[_0x27fc3b(0xdf)],'retry_limit':_0x27acc9[_0x27fc3b(0xed)],..._0x27acc9['result']&&{'result':_0x27acc9[_0x27fc3b(0x85)]}};return await handleSingleObjectOutput(_0x3ce93c,_0x5e3b50),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a33_0x1e4fb4(0xa9)]='schedule:create';['description']='Create\x20a\x20scheduled\x20query';[a33_0x1e4fb4(0xa8)](_0x4cec8e){const _0x454cfd=a33_0x1e4fb4,_0x3789b4=_0x4cec8e[_0x454cfd(0xa2)][0x0];if(!_0x3789b4)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';const _0x11e8dd=_0x4cec8e[_0x454cfd(0xc6)];if(!_0x11e8dd[_0x454cfd(0xea)])return'Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';return undefined;}async[a33_0x1e4fb4(0xc4)](_0x3318da){const _0x117c92=a33_0x1e4fb4,{options:_0x1c8e51,args:_0x4d5d1d,tdx:_0x3d34ed}=_0x3318da,_0x3bafe5=_0x4d5d1d[0x0],_0x5ac4ed=_0x1c8e51,_0x5d1a97=_0x5ac4ed[_0x117c92(0xea)],_0x57e2ef=_0x5ac4ed[_0x117c92(0xaa)],_0x7c17a0=_0x5ac4ed[_0x117c92(0xd9)]||_0x117c92(0xdb);let _0x452901;try{_0x452901=readFileSync(_0x57e2ef,'utf-8')[_0x117c92(0xfc)]();}catch(_0x2800db){throw new SDKError(ErrorCode[_0x117c92(0xa0)],_0x117c92(0xdd)+_0x57e2ef,_0x2800db instanceof Error?_0x2800db:undefined);}if(!_0x452901)throw new SDKError(ErrorCode[_0x117c92(0xa0)],_0x117c92(0xbe));const _0x1bd02b={'database':_0x5d1a97,'query':_0x452901,'type':_0x7c17a0};if(_0x5ac4ed[_0x117c92(0xb3)])_0x1bd02b[_0x117c92(0xb3)]=_0x5ac4ed[_0x117c92(0xb3)];if(_0x5ac4ed['timezone'])_0x1bd02b['timezone']=_0x5ac4ed[_0x117c92(0xfd)];if(_0x5ac4ed[_0x117c92(0x95)]!==undefined)_0x1bd02b[_0x117c92(0x95)]=Number(_0x5ac4ed['delay']);if(_0x5ac4ed[_0x117c92(0xdf)]!==undefined)_0x1bd02b[_0x117c92(0xdf)]=Number(_0x5ac4ed[_0x117c92(0xdf)]);if(_0x5ac4ed[_0x117c92(0xb6)]!==undefined)_0x1bd02b[_0x117c92(0xed)]=Number(_0x5ac4ed[_0x117c92(0xb6)]);if(_0x5ac4ed[_0x117c92(0xa1)])_0x1bd02b[_0x117c92(0x103)]=_0x5ac4ed[_0x117c92(0xa1)];if(_0x5ac4ed[_0x117c92(0x85)])_0x1bd02b[_0x117c92(0x85)]=_0x5ac4ed[_0x117c92(0x85)];if(_0x1c8e51[_0x117c92(0xe3)]){console[_0x117c92(0xdc)](_0x117c92(0x115)+_0x3bafe5),console[_0x117c92(0xdc)](_0x117c92(0xf0)+_0x5d1a97),console[_0x117c92(0xdc)](_0x117c92(0xc8)+_0x7c17a0);if(_0x1bd02b['cron'])console['error'](_0x117c92(0xb1)+_0x1bd02b['cron']);if(_0x1bd02b[_0x117c92(0xfd)])console[_0x117c92(0xdc)](_0x117c92(0x8e)+_0x1bd02b[_0x117c92(0xfd)]);}const _0x3d89cc=await withSpinner('Creating\x20schedule...',()=>_0x3d34ed[_0x117c92(0xa3)][_0x117c92(0xcb)](_0x3bafe5,_0x1bd02b),{'verbose':_0x1c8e51[_0x117c92(0xe3)]});return console['error'](_0x117c92(0xee)+_0x3d89cc[_0x117c92(0xd3)][_0x117c92(0xa9)]),await handleSingleObjectOutput(_0x3d89cc['data'],_0x1c8e51),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a33_0x1e4fb4(0xa9)]=a33_0x1e4fb4(0x9e);['description']=a33_0x1e4fb4(0x114);[a33_0x1e4fb4(0xa8)](_0x1a834b){const _0x46127c=a33_0x1e4fb4,_0x4ef4c6=_0x1a834b[_0x46127c(0xa2)][0x0];if(!_0x4ef4c6)return _0x46127c(0x8c);return undefined;}async[a33_0x1e4fb4(0xc4)](_0x3416f3){const _0x8cbb3a=a33_0x1e4fb4,{options:_0x252b1c,args:_0x2054e4,tdx:_0x54cd98}=_0x3416f3,_0x406eb7=_0x2054e4[0x0],_0x5d2dd3=_0x252b1c,_0x54b624={};if(_0x5d2dd3[_0x8cbb3a(0xea)])_0x54b624[_0x8cbb3a(0xea)]=_0x5d2dd3[_0x8cbb3a(0xea)];if(_0x5d2dd3[_0x8cbb3a(0xd9)])_0x54b624[_0x8cbb3a(0xd9)]=_0x5d2dd3[_0x8cbb3a(0xd9)];if(_0x5d2dd3[_0x8cbb3a(0xb3)])_0x54b624[_0x8cbb3a(0xb3)]=_0x5d2dd3[_0x8cbb3a(0xb3)];if(_0x5d2dd3[_0x8cbb3a(0xfd)])_0x54b624['timezone']=_0x5d2dd3[_0x8cbb3a(0xfd)];if(_0x5d2dd3[_0x8cbb3a(0x95)]!==undefined)_0x54b624[_0x8cbb3a(0x95)]=Number(_0x5d2dd3[_0x8cbb3a(0x95)]);if(_0x5d2dd3[_0x8cbb3a(0xdf)]!==undefined)_0x54b624[_0x8cbb3a(0xdf)]=Number(_0x5d2dd3[_0x8cbb3a(0xdf)]);if(_0x5d2dd3[_0x8cbb3a(0xb6)]!==undefined)_0x54b624[_0x8cbb3a(0xed)]=Number(_0x5d2dd3[_0x8cbb3a(0xb6)]);if(_0x5d2dd3[_0x8cbb3a(0xa1)])_0x54b624[_0x8cbb3a(0x103)]=_0x5d2dd3[_0x8cbb3a(0xa1)];if(_0x5d2dd3[_0x8cbb3a(0x85)])_0x54b624[_0x8cbb3a(0x85)]=_0x5d2dd3[_0x8cbb3a(0x85)];if(_0x5d2dd3[_0x8cbb3a(0xaa)])try{_0x54b624[_0x8cbb3a(0x87)]=readFileSync(_0x5d2dd3[_0x8cbb3a(0xaa)],_0x8cbb3a(0xd4))[_0x8cbb3a(0xfc)]();}catch(_0x18acb4){throw new SDKError(ErrorCode[_0x8cbb3a(0xa0)],'Failed\x20to\x20read\x20file:\x20'+_0x5d2dd3[_0x8cbb3a(0xaa)],_0x18acb4 instanceof Error?_0x18acb4:undefined);}if(Object[_0x8cbb3a(0x94)](_0x54b624)[_0x8cbb3a(0xf6)]===0x0)throw new SDKError(ErrorCode[_0x8cbb3a(0xa0)],_0x8cbb3a(0x9a));if(_0x252b1c['verbose']){console[_0x8cbb3a(0xdc)](_0x8cbb3a(0x8a)+_0x406eb7);for(const [_0x3982d6,_0x1a173c]of Object[_0x8cbb3a(0xf3)](_0x54b624)){_0x3982d6===_0x8cbb3a(0x87)?console['error']('\x20\x20'+_0x3982d6+':\x20'+_0x1a173c[_0x8cbb3a(0x9f)](0x0,0x32)+_0x8cbb3a(0x107)):console[_0x8cbb3a(0xdc)]('\x20\x20'+_0x3982d6+':\x20'+_0x1a173c);}}const _0x12065d=await withSpinner(_0x8cbb3a(0x97),()=>_0x54cd98[_0x8cbb3a(0xa3)]['update'](_0x406eb7,_0x54b624),{'verbose':_0x252b1c[_0x8cbb3a(0xe3)]});return console['error'](_0x8cbb3a(0x91)+_0x12065d[_0x8cbb3a(0xd3)][_0x8cbb3a(0xa9)]),await handleSingleObjectOutput(_0x12065d['data'],_0x252b1c),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{['name']=a33_0x1e4fb4(0xec);[a33_0x1e4fb4(0x86)]=a33_0x1e4fb4(0xb5);[a33_0x1e4fb4(0xa8)](_0x379893){const _0x109de5=a33_0x1e4fb4,_0x8594e5=_0x379893['args'][0x0];if(!_0x8594e5)return _0x109de5(0xc2);return undefined;}async[a33_0x1e4fb4(0xc4)](_0x509ecb){const _0x3cce61=a33_0x1e4fb4,{options:_0x3325a1,args:_0x2e31da,tdx:_0x56520a}=_0x509ecb,_0x1ec184=_0x2e31da[0x0];if(!_0x3325a1[_0x3cce61(0xa4)]){const _0x1e3fa7=await confirm(_0x3cce61(0x110)+_0x1ec184+'\x22?');if(!_0x1e3fa7)return console['error']('Cancelled'),0x0;}const _0x4a1b92=await withSpinner('Deleting\x20schedule...',()=>_0x56520a[_0x3cce61(0xa3)][_0x3cce61(0x84)](_0x1ec184),{'verbose':_0x3325a1[_0x3cce61(0xe3)]});return console[_0x3cce61(0xdc)](_0x3cce61(0xba)+_0x4a1b92[_0x3cce61(0xd3)]['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a33_0x1e4fb4(0xa9)]=a33_0x1e4fb4(0xae);['description']=a33_0x1e4fb4(0xa7);['validate'](_0x49da80){const _0x2c94da=a33_0x1e4fb4,_0x168fb3=_0x49da80[_0x2c94da(0xa2)][0x0];if(!_0x168fb3)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async[a33_0x1e4fb4(0xc4)](_0xb963a6){const _0x46de11=a33_0x1e4fb4,{options:_0x9a00e9,args:_0x85b48e,tdx:_0x14ed82}=_0xb963a6,_0x503f0c=_0x85b48e[0x0],_0x2e36b5=_0x9a00e9,_0x582485=_0x2e36b5[_0x46de11(0x89)],_0x554d03=_0x2e36b5[_0x46de11(0x8d)]!==undefined?Number(_0x2e36b5[_0x46de11(0x8d)]):undefined;if(_0x9a00e9[_0x46de11(0xe3)]){console[_0x46de11(0xdc)](_0x46de11(0xbf)+_0x503f0c);if(_0x582485)console[_0x46de11(0xdc)](_0x46de11(0xfb)+_0x582485);if(_0x554d03)console[_0x46de11(0xdc)](_0x46de11(0xf7)+_0x554d03);}const _0xf96453=await withSpinner(_0x46de11(0xd7),()=>_0x14ed82[_0x46de11(0xa3)][_0x46de11(0xe1)](_0x503f0c,{'time':_0x582485,'num':_0x554d03}),{'verbose':_0x9a00e9['verbose']}),_0xa59b5d=_0xf96453[_0x46de11(0xd3)]['jobs'];console['error'](_0x46de11(0xad)+_0xa59b5d[_0x46de11(0xf6)]+_0x46de11(0x10f)+(_0xa59b5d[_0x46de11(0xf6)]!==0x1?'s':'')+_0x46de11(0xe9));for(const _0x4b9274 of _0xa59b5d){console[_0x46de11(0xdc)](_0x46de11(0xb9)+_0x4b9274[_0x46de11(0xac)]);}return await handleSDKOutput(_0xa59b5d,_0x9a00e9),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a33_0x1e4fb4(0xa9)]=a33_0x1e4fb4(0xe2);[a33_0x1e4fb4(0x86)]='Show\x20schedule\x20execution\x20history';[a33_0x1e4fb4(0xa8)](_0x419cd9){const _0x4af94e=a33_0x1e4fb4,_0xb1806=_0x419cd9['args'][0x0];if(!_0xb1806)return _0x4af94e(0xd2);return undefined;}async[a33_0x1e4fb4(0xc4)](_0x16ea9e){const _0x18b60b=a33_0x1e4fb4,{options:_0x1b568a,args:_0x80cdcd,tdx:_0x3f1b36}=_0x16ea9e,_0x303b0a=_0x80cdcd[0x0],_0x17680e=_0x1b568a,_0x383452=_0x17680e[_0x18b60b(0xff)]!==undefined?Number(_0x17680e[_0x18b60b(0xff)]):undefined,_0x133339=_0x17680e['to']!==undefined?Number(_0x17680e['to']):undefined,_0x592db0=await withSpinner('Getting\x20schedule\x20history...',()=>_0x3f1b36[_0x18b60b(0xa3)]['history'](_0x303b0a,{'from':_0x383452,'to':_0x133339}),{'verbose':_0x1b568a['verbose']}),_0x56be16=_0x592db0['data'];console[_0x18b60b(0xdc)]('Found\x20'+_0x56be16[_0x18b60b(0x10c)]+'\x20execution'+(_0x56be16['count']!==0x1?'s':'')+_0x18b60b(0xcd)+_0x56be16[_0x18b60b(0xff)]+'-'+_0x56be16['to']+')');const _0x536f8a=_0x56be16[_0x18b60b(0x106)][_0x18b60b(0xc3)](_0x469d3c=>({'job_id':_0x469d3c['job_id'],'type':_0x469d3c[_0x18b60b(0xd9)],'status':_0x469d3c[_0x18b60b(0xc0)],'scheduled_at':_0x469d3c[_0x18b60b(0xbb)],'created_at':_0x469d3c[_0x18b60b(0x100)],'start_at':_0x469d3c[_0x18b60b(0x10d)],'end_at':_0x469d3c[_0x18b60b(0x112)]}));return await handleSDKOutput(_0x536f8a,_0x1b568a),0x0;}}
1
+ const a34_0x4e6734=a34_0x367e;(function(_0x3f1906,_0x4843f3){const _0x18b0bc=a34_0x367e,_0x5ec300=_0x3f1906();while(!![]){try{const _0x28cb7e=-parseInt(_0x18b0bc(0xfa))/0x1*(-parseInt(_0x18b0bc(0x151))/0x2)+parseInt(_0x18b0bc(0x109))/0x3+parseInt(_0x18b0bc(0x104))/0x4+-parseInt(_0x18b0bc(0x14c))/0x5*(parseInt(_0x18b0bc(0x137))/0x6)+parseInt(_0x18b0bc(0x112))/0x7*(-parseInt(_0x18b0bc(0x12c))/0x8)+parseInt(_0x18b0bc(0x16a))/0x9+parseInt(_0x18b0bc(0x138))/0xa*(-parseInt(_0x18b0bc(0x14f))/0xb);if(_0x28cb7e===_0x4843f3)break;else _0x5ec300['push'](_0x5ec300['shift']());}catch(_0x431177){_0x5ec300['push'](_0x5ec300['shift']());}}}(a34_0x4646,0xab023));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';function a34_0x4646(){const _0x55e162=['substring','6919Lucynf','database','1765070qrxOEt','📅\x20','type','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','toLocaleDateString','\x20\x20Database:\x20','Found\x20','trim','Database\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','end_at','error','run','\x20created','limit','lastRun','\x20(showing\x20','Searching\x20scheduled\x20queries\x20matching\x20\x22','never','options','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]','abs','priority','(unnamed)','h\x20ago','Delete\x20a\x20scheduled\x20query','6440391cGJxrB','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]','last_job','format','schedule:update','getTime','history','queries','execute','/app/queries/editor?queryId=','ended_at','pagination','retry_limit','user','INVALID_ARGUMENT','query','Create\x20a\x20scheduled\x20query','update','statusIcon','schedule:show','\x20job','nextRun','name','Deleting\x20schedule...','\x20\x20Time:\x20','ies','timezone','Running\x20schedule:\x20','utf-8','list','listQueries','count','schedule:create','file','Run\x20a\x20scheduled\x20query\x20immediately','log','Update\x20a\x20scheduled\x20query','1QYZTnM','site','engineVersion','args','result','keys','delete','from','Schedule\x20run\x20submitted:\x20','Schedule\x20updated:\x20','4433404OjyIoX','status','round','green','map','3810735qIImcY','job_id','scheduled_at','verbose','Showing\x20first\x20','delay','show','json','\x20\x20Cron:\x20','201222GebPZc','Show\x20schedule\x20details','...','yes','Creating\x20schedule...','join','Show\x20schedule\x20execution\x20history','num','Running\x20schedule...','queryUrl','Updating\x20schedule...','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','Failed\x20to\x20read\x20file:\x20','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','tsv','d\x20ago','table','List\x20scheduled\x20queries','cron','schedule:delete','m\x20ago','next_run_at','just\x20now','retryLimit','Cancelled','\x20schedules','352qrjUht','schedules','Schedule\x20deleted:\x20','padEnd','cyan','success','entries','executing_user_id','\x20scheduled\x20quer','created_at','length','6FSZeWc','18310HyVDLP','\x20matching\x20\x22','in\x20','Updating\x20schedule:\x20','user_name','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','create','schedule:list','Creating\x20schedule:\x20','max','description','schedule:run','\x20\x20Timezone:\x20','red','validate','data','jsonl','No\x20scheduled\x20queries\x20found','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','time_zone','4298780WFTazW','\x20\x20→\x20'];a34_0x4646=function(){return _0x55e162;};return a34_0x4646();}import{hyperlink}from'../sdk/util/formatters.js';import a34_0x37eced from'chalk';function formatRelativeTime(_0x392da1){const _0x8a3e29=a34_0x367e,_0x57a6bb=new Date(_0x392da1),_0x1b23fe=new Date(),_0x5a1148=_0x57a6bb['getTime']()-_0x1b23fe[_0x8a3e29(0x16f)](),_0x3c3967=Math[_0x8a3e29(0x165)](_0x5a1148)/0x3e8,_0x215a6a=_0x5a1148<0x0;if(_0x3c3967<0x3c)return _0x215a6a?_0x8a3e29(0x128):'soon';else{if(_0x3c3967<0xe10){const _0x5c8d5e=Math[_0x8a3e29(0x106)](_0x3c3967/0x3c);return _0x215a6a?_0x5c8d5e+_0x8a3e29(0x126):'in\x20'+_0x5c8d5e+'m';}else{if(_0x3c3967<0x15180){const _0x45243a=Math[_0x8a3e29(0x106)](_0x3c3967/0xe10);return _0x215a6a?_0x45243a+_0x8a3e29(0x168):_0x8a3e29(0x13a)+_0x45243a+'h';}else{if(_0x3c3967<0x93a80){const _0xfcb303=Math[_0x8a3e29(0x106)](_0x3c3967/0x15180);return _0x215a6a?_0xfcb303+_0x8a3e29(0x121):_0x8a3e29(0x13a)+_0xfcb303+'d';}else return _0x57a6bb[_0x8a3e29(0x155)]();}}}}export class ScheduleListCommand extends BaseCommand{[a34_0x4e6734(0xeb)]=a34_0x4e6734(0x13f);['description']=a34_0x4e6734(0x123);async[a34_0x4e6734(0x172)](_0x12647e){const _0x5a886c=a34_0x4e6734,{options:_0x157b30,args:_0x43882e,tdx:_0x6f656a}=_0x12647e,_0x3b2074=resolveLimit(_0x157b30[_0x5a886c(0x15e)],DEFAULT_DISPLAY_LIMIT),_0x273a12=_0x43882e[0x0],_0xc6909f=_0x273a12?_0x5a886c(0x161)+_0x273a12+'\x22...':'Listing\x20scheduled\x20queries...',_0x5b854d=await withSpinner(_0xc6909f,()=>_0x6f656a[_0x5a886c(0x12d)][_0x5a886c(0xf3)]({'limit':_0x3b2074,'scheduled':!![],'pattern':_0x273a12}),{'verbose':_0x157b30[_0x5a886c(0x10c)]}),_0x5753ff=_0x5b854d[_0x5a886c(0x147)][_0x5a886c(0x171)],_0x10d343=_0x5b854d['data'][_0x5a886c(0x175)]['has_next_page'],_0x215158=_0x273a12?_0x5a886c(0x139)+_0x273a12+'\x22':'';_0x10d343?console['error'](_0x5a886c(0x10d)+_0x5753ff[_0x5a886c(0x136)]+_0x5a886c(0x12b)+_0x215158+'\x20(use\x20--limit\x20to\x20see\x20more)'):console[_0x5a886c(0x15b)](_0x5a886c(0x157)+_0x5753ff['length']+_0x5a886c(0x134)+(_0x5753ff[_0x5a886c(0x136)]!==0x1?_0x5a886c(0xee):'y')+_0x215158);if(_0x157b30[_0x5a886c(0x16d)]===_0x5a886c(0x110)||_0x157b30['format']===_0x5a886c(0x148)||_0x157b30['format']===_0x5a886c(0x122)||_0x157b30['format']===_0x5a886c(0x120)){const _0x347912=_0x5753ff['map'](_0x32eb59=>({'id':_0x32eb59['id'],'name':_0x32eb59[_0x5a886c(0xeb)],'cron':_0x32eb59['cron'],'database':_0x32eb59['database']?.[_0x5a886c(0xeb)],'type':_0x32eb59[_0x5a886c(0x153)],'timezone':_0x32eb59[_0x5a886c(0x14b)],'user_name':_0x32eb59[_0x5a886c(0x177)]?.[_0x5a886c(0xeb)],'updated_at':_0x32eb59['updated_at'],'next_run_at':_0x32eb59[_0x5a886c(0x127)],'last_job_status':_0x32eb59[_0x5a886c(0x16c)]?.[_0x5a886c(0x105)]}));await handleSDKOutput(_0x347912,_0x157b30);}else{if(_0x5753ff['length']===0x0)console[_0x5a886c(0xf8)](_0x5a886c(0x149));else{const _0x2d06c7=_0x157b30[_0x5a886c(0xfb)],_0x440053=_0x5753ff['map'](_0x2045db=>{const _0x28506a=_0x5a886c,_0x5d8c4b=_0x2045db['last_job']?.[_0x28506a(0x105)]?_0x2045db['last_job'][_0x28506a(0x105)]===_0x28506a(0x131)?'✓':'✗':'-',_0x51fcb0=_0x2045db[_0x28506a(0x16c)]?.[_0x28506a(0x174)]?formatRelativeTime(_0x2045db[_0x28506a(0x16c)][_0x28506a(0x174)]):_0x28506a(0x162),_0x1caf19=_0x2045db[_0x28506a(0x127)]?formatRelativeTime(_0x2045db[_0x28506a(0x127)]):'-',_0x4b7764=_0x2045db[_0x28506a(0x124)]||'',_0x15aa74=_0x2045db[_0x28506a(0xeb)]||_0x28506a(0x167),_0x142191=getConsoleUrl(_0x2d06c7,_0x28506a(0x173)+_0x2045db['id']);return{'statusIcon':_0x5d8c4b,'lastRun':_0x51fcb0,'nextRun':_0x1caf19,'cron':_0x4b7764,'name':_0x15aa74,'queryUrl':_0x142191,'status':_0x2045db[_0x28506a(0x16c)]?.[_0x28506a(0x105)]};}),_0x3fe37d=Math[_0x5a886c(0x141)](..._0x440053['map'](_0x46c5ad=>_0x46c5ad['lastRun'][_0x5a886c(0x136)])),_0x27029e=Math[_0x5a886c(0x141)](..._0x440053[_0x5a886c(0x108)](_0x1f9701=>_0x1f9701[_0x5a886c(0xea)][_0x5a886c(0x136)])),_0x2a32dc=Math[_0x5a886c(0x141)](..._0x440053[_0x5a886c(0x108)](_0x57dcd1=>_0x57dcd1[_0x5a886c(0x124)][_0x5a886c(0x136)])),_0x422d55=_0x440053['map'](_0x7bd534=>{const _0x118461=_0x5a886c,_0x49f17b=_0x7bd534[_0x118461(0x105)]==='success'?a34_0x37eced[_0x118461(0x107)](_0x7bd534[_0x118461(0x17c)]):_0x7bd534[_0x118461(0x105)]==='error'?a34_0x37eced[_0x118461(0x145)](_0x7bd534['statusIcon']):a34_0x37eced['dim'](_0x7bd534[_0x118461(0x17c)]),_0x3bc897=_0x7bd534[_0x118461(0x15f)][_0x118461(0x12f)](_0x3fe37d),_0x422603=_0x7bd534[_0x118461(0xea)]['padEnd'](_0x27029e),_0xce7e5d=_0x7bd534[_0x118461(0x124)]?a34_0x37eced[_0x118461(0x130)](_0x7bd534[_0x118461(0x124)][_0x118461(0x12f)](_0x2a32dc)):'\x20'['repeat'](_0x2a32dc),_0x5d7d6a=hyperlink(_0x7bd534[_0x118461(0xeb)],_0x7bd534[_0x118461(0x11b)]);return _0x118461(0x152)+_0x49f17b+'\x20'+_0x3bc897+_0x118461(0x14d)+_0x422603+'\x20\x20'+_0xce7e5d+'\x20\x20'+_0x5d7d6a;});await writeOutput(_0x422d55[_0x5a886c(0x117)]('\x0a'),_0x157b30['output'],_0x5a886c(0xf2));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a34_0x4e6734(0xeb)]=a34_0x4e6734(0x17d);[a34_0x4e6734(0x142)]=a34_0x4e6734(0x113);[a34_0x4e6734(0x146)](_0x4d8f1b){const _0x44446d=a34_0x4e6734,_0x4b0996=_0x4d8f1b[_0x44446d(0xfd)][0x0];if(!_0x4b0996)return _0x44446d(0x154);return undefined;}async[a34_0x4e6734(0x172)](_0x113c25){const _0x4d9347=a34_0x4e6734,{options:_0x368a0b,args:_0x236511,tdx:_0x25c274}=_0x113c25,_0x45a08c=_0x236511[0x0],_0x37d3ca=await withSpinner('Getting\x20schedule\x20details...',()=>_0x25c274[_0x4d9347(0x12d)][_0x4d9347(0x10f)](_0x45a08c),{'verbose':_0x368a0b[_0x4d9347(0x10c)]}),_0x5b6b3e=_0x37d3ca[_0x4d9347(0x147)],_0x3436e5={'name':_0x5b6b3e[_0x4d9347(0xeb)],'cron':_0x5b6b3e[_0x4d9347(0x124)],'database':_0x5b6b3e[_0x4d9347(0x150)],'type':_0x5b6b3e[_0x4d9347(0x153)],'timezone':_0x5b6b3e[_0x4d9347(0xef)],'user_name':_0x5b6b3e[_0x4d9347(0x13c)],'created_at':_0x5b6b3e[_0x4d9347(0x135)],'engine_version':_0x5b6b3e['engine_version'],'executing_user_id':_0x5b6b3e[_0x4d9347(0x133)],'query':_0x5b6b3e[_0x4d9347(0x179)],'delay':_0x5b6b3e[_0x4d9347(0x10e)],'priority':_0x5b6b3e[_0x4d9347(0x166)],'retry_limit':_0x5b6b3e[_0x4d9347(0x176)],..._0x5b6b3e['result']&&{'result':_0x5b6b3e[_0x4d9347(0xfe)]}};return await handleSingleObjectOutput(_0x3436e5,_0x368a0b),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a34_0x4e6734(0xeb)]=a34_0x4e6734(0xf5);[a34_0x4e6734(0x142)]=a34_0x4e6734(0x17a);[a34_0x4e6734(0x146)](_0x1ac68d){const _0x3c7943=a34_0x4e6734,_0x1fcfc9=_0x1ac68d[_0x3c7943(0xfd)][0x0];if(!_0x1fcfc9)return _0x3c7943(0x16b);const _0x1a8740=_0x1ac68d[_0x3c7943(0x163)];if(!_0x1a8740[_0x3c7943(0x150)])return _0x3c7943(0x159);return undefined;}async[a34_0x4e6734(0x172)](_0x1258a1){const _0x2fc478=a34_0x4e6734,{options:_0x31017d,args:_0x224f40,tdx:_0xd17c54}=_0x1258a1,_0x3e2a22=_0x224f40[0x0],_0x26ef23=_0x31017d,_0x307155=_0x26ef23[_0x2fc478(0x150)],_0x12eac1=_0x26ef23['file'],_0x55c6da=_0x26ef23[_0x2fc478(0x153)]||'trino';let _0x33d45b;try{_0x33d45b=readFileSync(_0x12eac1,_0x2fc478(0xf1))['trim']();}catch(_0x10b890){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2fc478(0x11e)+_0x12eac1,_0x10b890 instanceof Error?_0x10b890:undefined);}if(!_0x33d45b)throw new SDKError(ErrorCode[_0x2fc478(0x178)],'Query\x20file\x20is\x20empty');const _0x401ccc={'database':_0x307155,'query':_0x33d45b,'type':_0x55c6da};if(_0x26ef23['cron'])_0x401ccc['cron']=_0x26ef23[_0x2fc478(0x124)];if(_0x26ef23[_0x2fc478(0xef)])_0x401ccc[_0x2fc478(0xef)]=_0x26ef23['timezone'];if(_0x26ef23[_0x2fc478(0x10e)]!==undefined)_0x401ccc[_0x2fc478(0x10e)]=Number(_0x26ef23['delay']);if(_0x26ef23['priority']!==undefined)_0x401ccc[_0x2fc478(0x166)]=Number(_0x26ef23[_0x2fc478(0x166)]);if(_0x26ef23['retryLimit']!==undefined)_0x401ccc['retry_limit']=Number(_0x26ef23[_0x2fc478(0x129)]);if(_0x26ef23[_0x2fc478(0xfc)])_0x401ccc['engine_version']=_0x26ef23[_0x2fc478(0xfc)];if(_0x26ef23[_0x2fc478(0xfe)])_0x401ccc[_0x2fc478(0xfe)]=_0x26ef23[_0x2fc478(0xfe)];if(_0x31017d['verbose']){console['error'](_0x2fc478(0x140)+_0x3e2a22),console[_0x2fc478(0x15b)](_0x2fc478(0x156)+_0x307155),console[_0x2fc478(0x15b)]('\x20\x20Type:\x20'+_0x55c6da);if(_0x401ccc[_0x2fc478(0x124)])console['error'](_0x2fc478(0x111)+_0x401ccc[_0x2fc478(0x124)]);if(_0x401ccc['timezone'])console['error'](_0x2fc478(0x144)+_0x401ccc[_0x2fc478(0xef)]);}const _0x54ede1=await withSpinner(_0x2fc478(0x116),()=>_0xd17c54[_0x2fc478(0x12d)][_0x2fc478(0x13e)](_0x3e2a22,_0x401ccc),{'verbose':_0x31017d[_0x2fc478(0x10c)]});return console['error']('Schedule\x20created:\x20'+_0x54ede1['data'][_0x2fc478(0xeb)]),await handleSingleObjectOutput(_0x54ede1[_0x2fc478(0x147)],_0x31017d),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a34_0x4e6734(0xeb)]=a34_0x4e6734(0x16e);[a34_0x4e6734(0x142)]=a34_0x4e6734(0xf9);[a34_0x4e6734(0x146)](_0x51eb62){const _0x21a7e8=a34_0x4e6734,_0x5c5c08=_0x51eb62[_0x21a7e8(0xfd)][0x0];if(!_0x5c5c08)return _0x21a7e8(0x11d);return undefined;}async[a34_0x4e6734(0x172)](_0x12c6dd){const _0x347cb0=a34_0x4e6734,{options:_0x2c7651,args:_0x1a14d9,tdx:_0x307d2a}=_0x12c6dd,_0x52f77e=_0x1a14d9[0x0],_0xf3ddba=_0x2c7651,_0x26935d={};if(_0xf3ddba['database'])_0x26935d[_0x347cb0(0x150)]=_0xf3ddba[_0x347cb0(0x150)];if(_0xf3ddba['type'])_0x26935d[_0x347cb0(0x153)]=_0xf3ddba[_0x347cb0(0x153)];if(_0xf3ddba[_0x347cb0(0x124)])_0x26935d[_0x347cb0(0x124)]=_0xf3ddba[_0x347cb0(0x124)];if(_0xf3ddba[_0x347cb0(0xef)])_0x26935d[_0x347cb0(0xef)]=_0xf3ddba[_0x347cb0(0xef)];if(_0xf3ddba[_0x347cb0(0x10e)]!==undefined)_0x26935d[_0x347cb0(0x10e)]=Number(_0xf3ddba[_0x347cb0(0x10e)]);if(_0xf3ddba[_0x347cb0(0x166)]!==undefined)_0x26935d[_0x347cb0(0x166)]=Number(_0xf3ddba[_0x347cb0(0x166)]);if(_0xf3ddba[_0x347cb0(0x129)]!==undefined)_0x26935d[_0x347cb0(0x176)]=Number(_0xf3ddba[_0x347cb0(0x129)]);if(_0xf3ddba['engineVersion'])_0x26935d['engine_version']=_0xf3ddba['engineVersion'];if(_0xf3ddba['result'])_0x26935d[_0x347cb0(0xfe)]=_0xf3ddba[_0x347cb0(0xfe)];if(_0xf3ddba[_0x347cb0(0xf6)])try{_0x26935d[_0x347cb0(0x179)]=readFileSync(_0xf3ddba[_0x347cb0(0xf6)],_0x347cb0(0xf1))[_0x347cb0(0x158)]();}catch(_0x274fc1){throw new SDKError(ErrorCode[_0x347cb0(0x178)],'Failed\x20to\x20read\x20file:\x20'+_0xf3ddba[_0x347cb0(0xf6)],_0x274fc1 instanceof Error?_0x274fc1:undefined);}if(Object[_0x347cb0(0xff)](_0x26935d)['length']===0x0)throw new SDKError(ErrorCode[_0x347cb0(0x178)],_0x347cb0(0x11f));if(_0x2c7651[_0x347cb0(0x10c)]){console[_0x347cb0(0x15b)](_0x347cb0(0x13b)+_0x52f77e);for(const [_0x37eb0b,_0x46c7a4]of Object[_0x347cb0(0x132)](_0x26935d)){_0x37eb0b==='query'?console['error']('\x20\x20'+_0x37eb0b+':\x20'+_0x46c7a4[_0x347cb0(0x14e)](0x0,0x32)+_0x347cb0(0x114)):console[_0x347cb0(0x15b)]('\x20\x20'+_0x37eb0b+':\x20'+_0x46c7a4);}}const _0x19ece9=await withSpinner(_0x347cb0(0x11c),()=>_0x307d2a[_0x347cb0(0x12d)][_0x347cb0(0x17b)](_0x52f77e,_0x26935d),{'verbose':_0x2c7651['verbose']});return console[_0x347cb0(0x15b)](_0x347cb0(0x103)+_0x19ece9['data'][_0x347cb0(0xeb)]),await handleSingleObjectOutput(_0x19ece9['data'],_0x2c7651),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a34_0x4e6734(0xeb)]=a34_0x4e6734(0x125);[a34_0x4e6734(0x142)]=a34_0x4e6734(0x169);[a34_0x4e6734(0x146)](_0x28c8e4){const _0x218dd7=a34_0x4e6734,_0x4ddea9=_0x28c8e4[_0x218dd7(0xfd)][0x0];if(!_0x4ddea9)return _0x218dd7(0x14a);return undefined;}async[a34_0x4e6734(0x172)](_0x22a40b){const _0x2db397=a34_0x4e6734,{options:_0x511c49,args:_0x3826c8,tdx:_0x5aefd1}=_0x22a40b,_0x410709=_0x3826c8[0x0];if(!_0x511c49[_0x2db397(0x115)]){const _0x228fb4=await confirm(_0x2db397(0x13d)+_0x410709+'\x22?');if(!_0x228fb4)return console[_0x2db397(0x15b)](_0x2db397(0x12a)),0x0;}const _0x2433db=await withSpinner(_0x2db397(0xec),()=>_0x5aefd1[_0x2db397(0x12d)][_0x2db397(0x100)](_0x410709),{'verbose':_0x511c49[_0x2db397(0x10c)]});return console['error'](_0x2db397(0x12e)+_0x2433db[_0x2db397(0x147)]['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a34_0x4e6734(0xeb)]=a34_0x4e6734(0x143);[a34_0x4e6734(0x142)]=a34_0x4e6734(0xf7);['validate'](_0x503431){const _0x5c6858=a34_0x4e6734,_0x180e67=_0x503431[_0x5c6858(0xfd)][0x0];if(!_0x180e67)return _0x5c6858(0x164);return undefined;}async[a34_0x4e6734(0x172)](_0x35dbe6){const _0x55e986=a34_0x4e6734,{options:_0x2aab31,args:_0x49dbe3,tdx:_0x4975be}=_0x35dbe6,_0x9e57f3=_0x49dbe3[0x0],_0x201b75=_0x2aab31,_0x596d4b=_0x201b75['time'],_0x14c6b5=_0x201b75[_0x55e986(0x119)]!==undefined?Number(_0x201b75[_0x55e986(0x119)]):undefined;if(_0x2aab31['verbose']){console[_0x55e986(0x15b)](_0x55e986(0xf0)+_0x9e57f3);if(_0x596d4b)console[_0x55e986(0x15b)](_0x55e986(0xed)+_0x596d4b);if(_0x14c6b5)console[_0x55e986(0x15b)]('\x20\x20Num:\x20'+_0x14c6b5);}const _0x29f7bf=await withSpinner(_0x55e986(0x11a),()=>_0x4975be['schedules'][_0x55e986(0x15c)](_0x9e57f3,{'time':_0x596d4b,'num':_0x14c6b5}),{'verbose':_0x2aab31[_0x55e986(0x10c)]}),_0x5690f6=_0x29f7bf[_0x55e986(0x147)]['jobs'];console[_0x55e986(0x15b)](_0x55e986(0x102)+_0x5690f6[_0x55e986(0x136)]+_0x55e986(0x17e)+(_0x5690f6['length']!==0x1?'s':'')+_0x55e986(0x15d));for(const _0x3cdacc of _0x5690f6){console[_0x55e986(0x15b)]('\x20\x20Job\x20ID:\x20'+_0x3cdacc[_0x55e986(0x10a)]);}return await handleSDKOutput(_0x5690f6,_0x2aab31),0x0;}}function a34_0x367e(_0x1172fc,_0x11436c){_0x1172fc=_0x1172fc-0xea;const _0x4646e5=a34_0x4646();let _0x367e76=_0x4646e5[_0x1172fc];return _0x367e76;}export class ScheduleHistoryCommand extends BaseCommand{[a34_0x4e6734(0xeb)]='schedule:history';[a34_0x4e6734(0x142)]=a34_0x4e6734(0x118);[a34_0x4e6734(0x146)](_0x271949){const _0xcb2978=a34_0x4e6734,_0x1c5a1e=_0x271949[_0xcb2978(0xfd)][0x0];if(!_0x1c5a1e)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async[a34_0x4e6734(0x172)](_0x4ab10a){const _0x1f2474=a34_0x4e6734,{options:_0x3dd733,args:_0x54ccca,tdx:_0x1104cd}=_0x4ab10a,_0x596585=_0x54ccca[0x0],_0x15af05=_0x3dd733,_0x5b1ebf=_0x15af05[_0x1f2474(0x101)]!==undefined?Number(_0x15af05[_0x1f2474(0x101)]):undefined,_0x59ed1f=_0x15af05['to']!==undefined?Number(_0x15af05['to']):undefined,_0x2d68a5=await withSpinner('Getting\x20schedule\x20history...',()=>_0x1104cd[_0x1f2474(0x12d)][_0x1f2474(0x170)](_0x596585,{'from':_0x5b1ebf,'to':_0x59ed1f}),{'verbose':_0x3dd733[_0x1f2474(0x10c)]}),_0x5be4cd=_0x2d68a5[_0x1f2474(0x147)];console['error']('Found\x20'+_0x5be4cd[_0x1f2474(0xf4)]+'\x20execution'+(_0x5be4cd[_0x1f2474(0xf4)]!==0x1?'s':'')+_0x1f2474(0x160)+_0x5be4cd[_0x1f2474(0x101)]+'-'+_0x5be4cd['to']+')');const _0x7b7245=_0x5be4cd[_0x1f2474(0x170)][_0x1f2474(0x108)](_0x1192d4=>({'job_id':_0x1192d4[_0x1f2474(0x10a)],'type':_0x1192d4['type'],'status':_0x1192d4[_0x1f2474(0x105)],'scheduled_at':_0x1192d4[_0x1f2474(0x10b)],'created_at':_0x1192d4['created_at'],'start_at':_0x1192d4['start_at'],'end_at':_0x1192d4[_0x1f2474(0x15a)]}));return await handleSDKOutput(_0x7b7245,_0x3dd733),0x0;}}
@@ -1 +1 @@
1
- const a34_0xbe1e3b=a34_0x4609;(function(_0xee30f3,_0x2b05d4){const _0x43fc13=a34_0x4609,_0x32689b=_0xee30f3();while(!![]){try{const _0x21ff55=-parseInt(_0x43fc13(0x130))/0x1*(-parseInt(_0x43fc13(0x1a5))/0x2)+-parseInt(_0x43fc13(0x174))/0x3+-parseInt(_0x43fc13(0x1b8))/0x4*(-parseInt(_0x43fc13(0x1c7))/0x5)+parseInt(_0x43fc13(0x12a))/0x6+-parseInt(_0x43fc13(0x120))/0x7+-parseInt(_0x43fc13(0x188))/0x8*(-parseInt(_0x43fc13(0x17e))/0x9)+parseInt(_0x43fc13(0x12f))/0xa*(-parseInt(_0x43fc13(0x15e))/0xb);if(_0x21ff55===_0x2b05d4)break;else _0x32689b['push'](_0x32689b['shift']());}catch(_0x2fc2d9){_0x32689b['push'](_0x32689b['shift']());}}}(a34_0x4208,0x2eace));function a34_0x4609(_0x10c7ca,_0x38cab8){_0x10c7ca=_0x10c7ca-0x120;const _0x420882=a34_0x4208();let _0x4609e4=_0x420882[_0x10c7ca];return _0x4609e4;}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 a34_0x42cb39 from'chalk';async function resolveSegmentTarget(_0x3d7f0f,_0x2f9509,_0x189a72){const _0x4b891f=a34_0x4609;if(isYamlFilePath(_0x3d7f0f))try{const _0x59546a=await resolveYamlFilePath(_0x3d7f0f);return _0x189a72&&(console[_0x4b891f(0x143)](_0x4b891f(0x139)+_0x3d7f0f),console[_0x4b891f(0x143)](_0x4b891f(0x12b)+_0x59546a[_0x4b891f(0x198)]),console[_0x4b891f(0x143)](_0x4b891f(0x1bc)+_0x59546a[_0x4b891f(0x181)]),console[_0x4b891f(0x143)](_0x4b891f(0x1c6)+(_0x59546a['folderPath']||_0x4b891f(0x15a))),console[_0x4b891f(0x143)](_0x4b891f(0x16e)+_0x59546a[_0x4b891f(0x142)])),_0x59546a[_0x4b891f(0x142)];}catch(_0x552e5c){throw new SDKError(ErrorCode[_0x4b891f(0x17a)],_0x4b891f(0x169)+_0x552e5c[_0x4b891f(0x129)]);}if(!_0x2f9509)throw new SDKError(ErrorCode[_0x4b891f(0x17a)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x2f9509+'/'+_0x3d7f0f;}export class SegmentDescribeCommand extends BaseCommand{[a34_0xbe1e3b(0x16d)]='segment:describe';[a34_0xbe1e3b(0x1b5)]=a34_0xbe1e3b(0x1be);async[a34_0xbe1e3b(0x164)](_0x4fdada){const _0x2fb724=a34_0xbe1e3b,{options:_0x31e220,args:_0x55148e,tdx:_0x4acb9f}=_0x4fdada,_0x42148a=_0x55148e[0x0],_0x4b8a41=!_0x42148a&&!!_0x31e220[_0x2fb724(0x198)],_0x4ae643=_0x42148a||_0x31e220[_0x2fb724(0x198)];if(!_0x4ae643)return console[_0x2fb724(0x143)](_0x2fb724(0x145)),console[_0x2fb724(0x143)](_0x2fb724(0x123)),console[_0x2fb724(0x143)](_0x2fb724(0x156)),console['error'](_0x2fb724(0x13d)),console[_0x2fb724(0x143)](_0x2fb724(0x1a6)),console[_0x2fb724(0x143)](_0x2fb724(0x14a)),console[_0x2fb724(0x143)](_0x2fb724(0x191)),0x1;try{const _0x35de48=_0x31e220[_0x2fb724(0x146)];let _0x587155=_0x4ae643;!_0x4b8a41&&_0x35de48&&!_0x4ae643[_0x2fb724(0x1ad)]('/')&&(_0x587155=_0x35de48+'/'+_0x4ae643,_0x31e220[_0x2fb724(0x190)]&&console[_0x2fb724(0x143)](_0x2fb724(0x14e)+_0x587155));const _0x2d6d39=await withSpinner(_0x2fb724(0x167)+_0x587155+_0x2fb724(0x137),()=>_0x4acb9f[_0x2fb724(0x1b9)]['resolvePathToResource'](_0x587155),{'verbose':_0x31e220[_0x2fb724(0x190)]}),_0x1b7f13=_0x2d6d39['data'];_0x31e220[_0x2fb724(0x190)]&&(console[_0x2fb724(0x143)](_0x2fb724(0x1ab)+_0x1b7f13[_0x2fb724(0x18d)]),console[_0x2fb724(0x143)]('Parent\x20ID:\x20'+_0x1b7f13[_0x2fb724(0x1bb)]),_0x1b7f13[_0x2fb724(0x17d)]&&console[_0x2fb724(0x143)](_0x2fb724(0x19f)+_0x1b7f13['folderId']),_0x1b7f13[_0x2fb724(0x1b3)]&&console[_0x2fb724(0x143)](_0x2fb724(0x141)+_0x1b7f13[_0x2fb724(0x1b3)]));if(_0x1b7f13['type']===_0x2fb724(0x13a)){const _0x29562d=await withSpinner(_0x2fb724(0x134),()=>_0x4acb9f[_0x2fb724(0x1b9)]['getParent'](_0x1b7f13['parentId']),{'verbose':_0x31e220[_0x2fb724(0x190)]});await handleSingleObjectOutput(_0x29562d[_0x2fb724(0x14b)],_0x31e220);}else{if(_0x1b7f13[_0x2fb724(0x18d)]===_0x2fb724(0x122)){if(!_0x1b7f13[_0x2fb724(0x17d)])throw new SDKError(ErrorCode[_0x2fb724(0x147)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x5b56af=await withSpinner('Fetching\x20folder\x20details...',()=>_0x4acb9f[_0x2fb724(0x1b9)][_0x2fb724(0x1c5)](_0x1b7f13[_0x2fb724(0x17d)]),{'verbose':_0x31e220[_0x2fb724(0x190)]});await handleSingleObjectOutput(_0x5b56af[_0x2fb724(0x14b)],_0x31e220);}else{if(_0x1b7f13[_0x2fb724(0x18d)]==='segment'){if(!_0x1b7f13[_0x2fb724(0x1b3)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x2fb724(0x183));const _0x2be9b4=await withSpinner(_0x2fb724(0x16c),()=>_0x4acb9f['segment'][_0x2fb724(0x160)](_0x1b7f13[_0x2fb724(0x1bb)],_0x1b7f13[_0x2fb724(0x1b3)]),{'verbose':_0x31e220['verbose']});await handleSingleObjectOutput(_0x2be9b4[_0x2fb724(0x14b)],_0x31e220);}}}return 0x0;}catch(_0x570e45){if(_0x570e45 instanceof SDKError)return console[_0x2fb724(0x143)](_0x2fb724(0x182)+_0x570e45[_0x2fb724(0x129)]),_0x570e45[_0x2fb724(0x1a2)]&&console['error']('\x20\x20Cause:\x20'+_0x570e45[_0x2fb724(0x1a2)]),0x1;throw _0x570e45;}}}export class SegmentShowCommand extends BaseCommand{[a34_0xbe1e3b(0x16d)]=a34_0xbe1e3b(0x133);[a34_0xbe1e3b(0x1b5)]=a34_0xbe1e3b(0x184);async[a34_0xbe1e3b(0x164)](_0x4956e6){const _0xc05393=a34_0xbe1e3b,{options:_0xf89c74,args:_0x1acd19,tdx:_0x4ffb67}=_0x4956e6,_0x33c59d=_0x1acd19[0x0];if(!_0x33c59d)return console['error'](_0xc05393(0x149)),console[_0xc05393(0x143)](_0xc05393(0x17b)),console[_0xc05393(0x143)](_0xc05393(0x1c2)),console['error'](_0xc05393(0x156)),console[_0xc05393(0x143)](_0xc05393(0x1b4)),console[_0xc05393(0x143)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x2b3205=_0xf89c74[_0xc05393(0x198)],_0x25eb13=await resolveSegmentTarget(_0x33c59d,_0x2b3205,_0xf89c74['verbose']);_0xf89c74[_0xc05393(0x190)]&&console[_0xc05393(0x143)](_0xc05393(0x163)+_0x25eb13);const _0xb010e8=await withSpinner('Resolving\x20\x27'+_0x33c59d+_0xc05393(0x137),()=>_0x4ffb67[_0xc05393(0x1b9)][_0xc05393(0x16a)](_0x25eb13),{'verbose':_0xf89c74[_0xc05393(0x190)]}),_0x2c4d14=_0xb010e8['data'];_0xf89c74['verbose']&&(console[_0xc05393(0x143)]('Resolved\x20type:\x20'+_0x2c4d14[_0xc05393(0x18d)]),console['error'](_0xc05393(0x173)+_0x2c4d14[_0xc05393(0x1bb)]));if(_0x2c4d14[_0xc05393(0x18d)]===_0xc05393(0x122))return console[_0xc05393(0x143)](_0xc05393(0x12e)),console[_0xc05393(0x143)]('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x2c4d14[_0xc05393(0x18d)]==='parent')return console[_0xc05393(0x143)](_0xc05393(0x1af)),console[_0xc05393(0x143)](_0xc05393(0x1bf)),0x1;if(!_0x2c4d14[_0xc05393(0x1b3)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0xc05393(0x183));const _0x4d5d84=await withSpinner(_0xc05393(0x192),()=>_0x4ffb67[_0xc05393(0x1b9)][_0xc05393(0x186)](_0x2c4d14[_0xc05393(0x1bb)],_0x2c4d14[_0xc05393(0x1b3)]),{'verbose':_0xf89c74['verbose']});let _0xe092c5=_0x4d5d84['data'];const _0x472972=resolveLimit(_0xf89c74[_0xc05393(0x1b1)],DEFAULT_DISPLAY_LIMIT),_0x34287f=/\bLIMIT\s+\d+/i[_0xc05393(0x1bd)](_0xe092c5);!_0x34287f&&(_0xe092c5=_0xe092c5[_0xc05393(0x1c8)]()[_0xc05393(0x179)](/;+$/,''),_0xe092c5=_0xc05393(0x127)+_0xe092c5+_0xc05393(0x166)+_0x472972);_0xf89c74[_0xc05393(0x190)]&&console[_0xc05393(0x143)](_0xc05393(0x18a)+_0xe092c5);const _0x4f48d7=await withProgressSpinner(_0xc05393(0x1b2),async _0x7ff6de=>{const _0x3a92e2=_0xc05393,_0x134fea=await _0x4ffb67['query']['execute'](_0xe092c5,{'catalog':'td','schema':_0x3a92e2(0x19c),'onJobId':_0x388ef6=>{const _0x532179=_0x3a92e2;_0x7ff6de[_0x532179(0x1a7)](_0x388ef6);}});return _0x134fea;},{'verbose':_0xf89c74[_0xc05393(0x190)]}),_0x72cd07=_0x4f48d7['data'],_0x22856f=_0x72cd07[_0xc05393(0x161)]?_0xc05393(0x13b)+_0x72cd07[_0xc05393(0x161)]+']':'';return console[_0xc05393(0x143)](_0xc05393(0x1ae)+_0x72cd07['stats'][_0xc05393(0x131)][_0xc05393(0x13f)]()+'\x20rows\x20'+(_0xc05393(0x124)+formatElapsed(_0x72cd07[_0xc05393(0x157)][_0xc05393(0x125)])+_0x22856f)),await handleQueryOutput(_0x72cd07,_0xf89c74),0x0;}catch(_0x1fbe04){if(_0x1fbe04 instanceof SDKError)return console[_0xc05393(0x143)](_0xc05393(0x159)+_0x1fbe04['code']+']'),console[_0xc05393(0x143)]('\x0a'+_0x1fbe04[_0xc05393(0x129)]),0x1;throw _0x1fbe04;}}}export class SegmentFolderListCommand extends BaseCommand{['name']=a34_0xbe1e3b(0x14c);['description']=a34_0xbe1e3b(0x151);async['execute'](_0x216733){const _0x3cd380=a34_0xbe1e3b,{options:_0x5210b1,args:_0x4a579a,tdx:_0x39aac1}=_0x216733;if(_0x4a579a['length']===0x0)return console[_0x3cd380(0x143)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x3cd380(0x143)](_0x3cd380(0x15c)),0x1;const _0x3435c6=_0x4a579a[0x0];try{_0x5210b1[_0x3cd380(0x190)]&&(console[_0x3cd380(0x143)](_0x3cd380(0x1c3)+_0x5210b1[_0x3cd380(0x18b)]),console['error'](_0x3cd380(0x1a3)+_0x3435c6));const _0x1e15b5=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3435c6+_0x3cd380(0x137),()=>_0x39aac1[_0x3cd380(0x1b9)][_0x3cd380(0x19a)](_0x3435c6),{'verbose':_0x5210b1[_0x3cd380(0x190)]}),_0x226876=_0x1e15b5[_0x3cd380(0x14b)];_0x5210b1[_0x3cd380(0x190)]&&console[_0x3cd380(0x143)](_0x3cd380(0x196)+_0x226876);const _0x3024bb=await withSpinner(_0x3cd380(0x1a8)+_0x3435c6+_0x3cd380(0x137),()=>_0x39aac1['segment']['listFolders'](_0x226876),{'verbose':_0x5210b1['verbose']}),_0x245c8d=_0x3024bb[_0x3cd380(0x14b)];return console[_0x3cd380(0x143)]('✔\x20Found\x20'+_0x245c8d[_0x3cd380(0x180)]+_0x3cd380(0x176)+(_0x245c8d[_0x3cd380(0x180)]!==0x1?'s':'')),await handleSDKOutput(_0x245c8d,_0x5210b1),0x0;}catch(_0x32037c){if(_0x32037c instanceof SDKError)return console[_0x3cd380(0x143)]('Error:\x20'+_0x32037c[_0x3cd380(0x129)]),_0x32037c[_0x3cd380(0x1a2)]&&console[_0x3cd380(0x143)]('\x20\x20Cause:\x20'+_0x32037c[_0x3cd380(0x1a2)]),0x1;throw _0x32037c;}}}export class SegmentFolderShowCommand extends BaseCommand{[a34_0xbe1e3b(0x16d)]=a34_0xbe1e3b(0x19e);['description']=a34_0xbe1e3b(0x175);async[a34_0xbe1e3b(0x164)](_0x46354b){const _0x1eeb8e=a34_0xbe1e3b,{options:_0x1b4ef3,args:_0x3b44e0,tdx:_0x50c202}=_0x46354b;if(_0x3b44e0[_0x1eeb8e(0x180)]===0x0)return console[_0x1eeb8e(0x143)](_0x1eeb8e(0x121)),console[_0x1eeb8e(0x143)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x38019a,childId:_0x22804e}=parseSegmentRef(_0x3b44e0[0x0]);_0x1b4ef3[_0x1eeb8e(0x190)]&&(console[_0x1eeb8e(0x143)](_0x1eeb8e(0x1c3)+_0x1b4ef3[_0x1eeb8e(0x18b)]),console[_0x1eeb8e(0x143)](_0x1eeb8e(0x1a3)+_0x38019a),_0x22804e&&console['error'](_0x1eeb8e(0x1c0)+_0x22804e));if(!_0x22804e)return console['error']('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x30df91=await withSpinner(_0x1eeb8e(0x1c9)+_0x38019a+_0x1eeb8e(0x137),()=>_0x50c202[_0x1eeb8e(0x1b9)]['resolveParentId'](_0x38019a),{'verbose':_0x1b4ef3['verbose']}),_0x56abb3=_0x30df91[_0x1eeb8e(0x14b)];_0x1b4ef3[_0x1eeb8e(0x190)]&&console[_0x1eeb8e(0x143)](_0x1eeb8e(0x196)+_0x56abb3);const _0x43c14c=await withSpinner(_0x1eeb8e(0x15f)+_0x22804e+_0x1eeb8e(0x137),()=>_0x50c202['segment']['resolveFolderId'](_0x56abb3,_0x22804e),{'verbose':_0x1b4ef3[_0x1eeb8e(0x190)]}),_0x5d3c8e=_0x43c14c[_0x1eeb8e(0x14b)];_0x1b4ef3[_0x1eeb8e(0x190)]&&console[_0x1eeb8e(0x143)](_0x1eeb8e(0x135)+_0x5d3c8e);const _0x455f83=await withSpinner(_0x1eeb8e(0x16f)+_0x22804e+_0x1eeb8e(0x137),()=>_0x50c202[_0x1eeb8e(0x1b9)]['getFolder'](_0x5d3c8e),{'verbose':_0x1b4ef3[_0x1eeb8e(0x190)]});return await handleSDKOutput([_0x455f83['data']],_0x1b4ef3),0x0;}catch(_0x545aeb){if(_0x545aeb instanceof SDKError)return console['error'](_0x1eeb8e(0x182)+_0x545aeb['message']),_0x545aeb['cause']&&console[_0x1eeb8e(0x143)]('\x20\x20Cause:\x20'+_0x545aeb[_0x1eeb8e(0x1a2)]),0x1;throw _0x545aeb;}}}export class SegmentSQLCommand extends BaseCommand{[a34_0xbe1e3b(0x16d)]=a34_0xbe1e3b(0x14d);[a34_0xbe1e3b(0x1b5)]=a34_0xbe1e3b(0x18f);async[a34_0xbe1e3b(0x164)](_0x3988b){const _0x2af5c6=a34_0xbe1e3b,{options:_0x542695,args:_0x154ed0}=_0x3988b,_0x3c1ebf=_0x542695,_0x12494f=_0x3c1ebf[_0x2af5c6(0x1a4)],_0x43857e=_0x154ed0[0x0];if(!_0x43857e&&!_0x12494f)return console[_0x2af5c6(0x143)](a34_0x42cb39['red']('Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required')),console[_0x2af5c6(0x143)](_0x2af5c6(0x154)),console[_0x2af5c6(0x143)](_0x2af5c6(0x1aa)),console[_0x2af5c6(0x143)](_0x2af5c6(0x1a9)),console[_0x2af5c6(0x143)](_0x2af5c6(0x156)),console['error'](_0x2af5c6(0x136)),console[_0x2af5c6(0x143)](_0x2af5c6(0x1b7)),0x1;if(_0x43857e&&_0x12494f)return console[_0x2af5c6(0x143)](a34_0x42cb39[_0x2af5c6(0x18c)](_0x2af5c6(0x197))),0x1;try{let _0x315afc;if(_0x12494f)_0x315afc=await this['getSQLFromYamlFile'](_0x12494f,_0x3988b);else{if(isYamlFilePath(_0x43857e))return console[_0x2af5c6(0x143)](a34_0x42cb39[_0x2af5c6(0x18c)](_0x2af5c6(0x15d))),console[_0x2af5c6(0x143)](_0x2af5c6(0x19d)+_0x43857e),0x1;else _0x315afc=await this[_0x2af5c6(0x171)](_0x43857e,_0x3988b);}return _0x542695['format']===_0x2af5c6(0x1a1)||_0x542695[_0x2af5c6(0x13c)]===_0x2af5c6(0x185)?await handleSDKOutput([{'sql':_0x315afc}],_0x542695):console[_0x2af5c6(0x199)](_0x315afc),0x0;}catch(_0xac9f05){if(_0xac9f05 instanceof SDKError)return console['error'](_0x2af5c6(0x182)+_0xac9f05[_0x2af5c6(0x129)]),_0xac9f05[_0x2af5c6(0x1a2)]&&console[_0x2af5c6(0x143)](_0x2af5c6(0x128)+_0xac9f05[_0x2af5c6(0x1a2)]),0x1;throw _0xac9f05;}}async['getSQLFromYamlFile'](_0x36f457,_0x202af7){const _0x510ac1=a34_0xbe1e3b,{options:_0xff8bb4,tdx:_0x2ef656}=_0x202af7;let _0x24ef6;try{_0x24ef6=await resolveYamlFilePath(_0x36f457);}catch(_0x2d366c){throw new SDKError(ErrorCode[_0x510ac1(0x17a)],_0x510ac1(0x169)+_0x2d366c[_0x510ac1(0x129)]);}_0xff8bb4['verbose']&&console['error'](_0x510ac1(0x140)+_0x24ef6[_0x510ac1(0x198)]+'/'+_0x24ef6[_0x510ac1(0x181)]);const _0x1899fd=await withSpinner(_0x510ac1(0x194),()=>_0x2ef656[_0x510ac1(0x1b9)]['getSegmentSQLFromYaml'](_0x24ef6['content'],_0x24ef6['parentSegment'],_0x24ef6[_0x510ac1(0x181)]),{'verbose':_0xff8bb4[_0x510ac1(0x190)]});return _0x1899fd['data'];}async[a34_0xbe1e3b(0x171)](_0xb00ab4,_0x15e8c0){const _0x427626=a34_0xbe1e3b,{options:_0x4ee9e2,tdx:_0x41d3cc}=_0x15e8c0,_0x572d64=_0x4ee9e2[_0x427626(0x198)],_0x1d10e4=await resolveSegmentTarget(_0xb00ab4,_0x572d64,_0x4ee9e2['verbose']);_0x4ee9e2['verbose']&&console['error'](_0x427626(0x163)+_0x1d10e4);const _0xc39522=await withSpinner('Resolving\x20\x27'+_0xb00ab4+_0x427626(0x137),()=>_0x41d3cc[_0x427626(0x1b9)]['resolvePathToResource'](_0x1d10e4),{'verbose':_0x4ee9e2[_0x427626(0x190)]}),_0x134c70=_0xc39522[_0x427626(0x14b)];_0x4ee9e2[_0x427626(0x190)]&&(console[_0x427626(0x143)](_0x427626(0x1ab)+_0x134c70[_0x427626(0x18d)]),console[_0x427626(0x143)]('Parent\x20ID:\x20'+_0x134c70[_0x427626(0x1bb)]));if(_0x134c70[_0x427626(0x18d)]===_0x427626(0x122))throw new SDKError(ErrorCode[_0x427626(0x17a)],_0x427626(0x193));if(_0x134c70[_0x427626(0x18d)]==='parent')throw new SDKError(ErrorCode[_0x427626(0x17a)],_0x427626(0x189));if(!_0x134c70[_0x427626(0x1b3)])throw new SDKError(ErrorCode[_0x427626(0x1a0)],_0x427626(0x183));const _0x12cefd=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x41d3cc[_0x427626(0x1b9)][_0x427626(0x186)](_0x134c70[_0x427626(0x1bb)],_0x134c70[_0x427626(0x1b3)]),{'verbose':_0x4ee9e2[_0x427626(0x190)]});return _0x12cefd[_0x427626(0x14b)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a34_0xbe1e3b(0x16d)]=a34_0xbe1e3b(0x177);[a34_0xbe1e3b(0x1b5)]=a34_0xbe1e3b(0x168);async[a34_0xbe1e3b(0x164)](_0x3111ea){const _0xf99b78=a34_0xbe1e3b,{options:_0x23cd39,args:_0x19dbb3,tdx:_0x414246}=_0x3111ea,_0x3461a9=_0x23cd39;if(_0x19dbb3[_0xf99b78(0x180)]<0x2)return console[_0xf99b78(0x143)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console['error'](_0xf99b78(0x1b6)),0x1;const _0x216178=_0x19dbb3[0x0],_0x6ca20a=_0x19dbb3[0x1];_0x3461a9[_0xf99b78(0x190)]&&(console[_0xf99b78(0x143)](_0xf99b78(0x1c3)+_0x3461a9['site']),console[_0xf99b78(0x143)](_0xf99b78(0x1ca)+_0x216178),console[_0xf99b78(0x143)](_0xf99b78(0x1c0)+_0x6ca20a));let _0x4d42a4;if(_0x3461a9[_0xf99b78(0x14f)]){const _0x3c14b2=_0x3461a9['parentFolder'],_0x5bb4ef=await withSpinner(_0xf99b78(0x1c9)+_0x216178+_0xf99b78(0x137),()=>_0x414246[_0xf99b78(0x1b9)][_0xf99b78(0x19a)](_0x216178),{'verbose':_0x3461a9[_0xf99b78(0x190)]}),_0x5c8823=_0x5bb4ef[_0xf99b78(0x14b)],_0x1751b1=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x3c14b2+'\x27...',()=>_0x414246['segment'][_0xf99b78(0x1c4)](_0x5c8823,_0x3c14b2),{'verbose':_0x3461a9['verbose']});_0x4d42a4=_0x1751b1[_0xf99b78(0x14b)],_0x3461a9['verbose']&&console[_0xf99b78(0x143)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x4d42a4);}const _0x9aec04={'name':_0x6ca20a,'description':_0x3461a9[_0xf99b78(0x1b5)],'parentFolderId':_0x4d42a4},_0x5a256f=await withSpinner(_0xf99b78(0x158)+_0x6ca20a+_0xf99b78(0x137),()=>_0x414246[_0xf99b78(0x1b9)][_0xf99b78(0x172)](_0x216178,_0x9aec04),{'verbose':_0x3461a9['verbose']}),_0x4f9ef6=_0x5a256f['data'];return console['error']('✔\x20Created\x20folder\x20\x27'+_0x4f9ef6[_0xf99b78(0x16d)]+_0xf99b78(0x153)+_0x4f9ef6['id']),await handleSDKOutput([_0x4f9ef6],_0x3461a9),0x0;}}export class SegmentViewCommand extends BaseCommand{[a34_0xbe1e3b(0x16d)]=a34_0xbe1e3b(0x148);[a34_0xbe1e3b(0x1b5)]=a34_0xbe1e3b(0x165);async[a34_0xbe1e3b(0x164)](_0x17d954){const _0x42311b=a34_0xbe1e3b,{options:_0xad6d8b,args:_0x30ccde,tdx:_0x1ba089}=_0x17d954,_0x3241dc=_0x30ccde[0x0];if(!_0x3241dc)return console[_0x42311b(0x143)](_0x42311b(0x195)),console[_0x42311b(0x143)](_0x42311b(0x155)),console[_0x42311b(0x143)](_0x42311b(0x170)),console['error'](_0x42311b(0x152)),console[_0x42311b(0x143)](_0x42311b(0x1b0)),console[_0x42311b(0x143)]('Examples:'),console[_0x42311b(0x143)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x42311b(0x143)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x42311b(0x143)](_0x42311b(0x16b)),console[_0x42311b(0x143)](_0x42311b(0x132)),0x1;try{const _0x4984f1=_0xad6d8b[_0x42311b(0x198)],_0x17fe96=await resolveSegmentTarget(_0x3241dc,_0x4984f1,_0xad6d8b['verbose']);_0xad6d8b[_0x42311b(0x190)]&&console[_0x42311b(0x143)](_0x42311b(0x163)+_0x17fe96);const _0x189858=await withSpinner(_0x42311b(0x144)+_0x3241dc+_0x42311b(0x137),()=>_0x1ba089[_0x42311b(0x1b9)][_0x42311b(0x16a)](_0x17fe96),{'verbose':_0xad6d8b[_0x42311b(0x190)]}),_0x2ebde7=_0x189858[_0x42311b(0x14b)];_0xad6d8b[_0x42311b(0x190)]&&(console[_0x42311b(0x143)](_0x42311b(0x1ab)+_0x2ebde7[_0x42311b(0x18d)]),console[_0x42311b(0x143)]('Parent\x20ID:\x20'+_0x2ebde7['parentId']),_0x2ebde7['folderId']&&console[_0x42311b(0x143)]('Folder\x20ID:\x20'+_0x2ebde7[_0x42311b(0x17d)]),_0x2ebde7['segmentId']&&console[_0x42311b(0x143)](_0x42311b(0x141)+_0x2ebde7['segmentId']));if(_0xad6d8b[_0x42311b(0x13e)]){if(_0x2ebde7[_0x42311b(0x18d)]==='folder')return console[_0x42311b(0x143)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x2ebde7[_0x42311b(0x18d)]===_0x42311b(0x13a))return console['error'](_0x42311b(0x12c)),console[_0x42311b(0x143)]('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x2ebde7['segmentId'])throw new SDKError(ErrorCode[_0x42311b(0x1a0)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x2a4da3=getConsoleNextUrl(_0xad6d8b[_0x42311b(0x18b)],'/app/ps/'+_0x2ebde7[_0x42311b(0x1bb)]+_0x42311b(0x138)+_0x2ebde7[_0x42311b(0x1b3)]);return console[_0x42311b(0x143)](a34_0x42cb39[_0x42311b(0x18e)]('✔')+'\x20Opening\x20'+a34_0x42cb39['cyan'](_0x2a4da3)),openBrowser(_0x2a4da3),0x0;}if(_0x2ebde7['type']===_0x42311b(0x122)){if(!_0x2ebde7[_0x42311b(0x17d)])throw new SDKError(ErrorCode[_0x42311b(0x147)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x4716da=await withSpinner(_0x42311b(0x1ac),()=>_0x1ba089[_0x42311b(0x1b9)][_0x42311b(0x1c5)](_0x2ebde7['folderId']),{'verbose':_0xad6d8b[_0x42311b(0x190)]});await handleSingleObjectOutput(_0x4716da['data'],_0xad6d8b);}else{if(_0x2ebde7['type']==='segment'){if(!_0x2ebde7[_0x42311b(0x1b3)])throw new SDKError(ErrorCode[_0x42311b(0x1a0)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x2894fa=await withSpinner(_0x42311b(0x16c),()=>_0x1ba089['segment']['getSegment'](_0x2ebde7[_0x42311b(0x1bb)],_0x2ebde7[_0x42311b(0x1b3)]),{'verbose':_0xad6d8b['verbose']}),_0x2fb812=getConsoleNextUrl(_0xad6d8b[_0x42311b(0x18b)],_0x42311b(0x126)+_0x2ebde7['parentId']+_0x42311b(0x138)+_0x2ebde7['segmentId']),_0x2ea0ba=_0x2894fa[_0x42311b(0x14b)];_0x2ea0ba['url']=_0x2fb812,await handleSingleObjectOutput(_0x2ea0ba,_0xad6d8b);}else return console['error'](_0x42311b(0x1c1)),console['error'](_0x42311b(0x12d)),0x1;}return 0x0;}catch(_0xcaa15f){if(_0xcaa15f instanceof SDKError)return console['error'](_0x42311b(0x182)+_0xcaa15f['message']),_0xcaa15f[_0x42311b(0x1a2)]&&console[_0x42311b(0x143)](_0x42311b(0x128)+_0xcaa15f[_0x42311b(0x1a2)]),0x1;throw _0xcaa15f;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a34_0xbe1e3b(0x16d)]=a34_0xbe1e3b(0x150);[a34_0xbe1e3b(0x1b5)]=a34_0xbe1e3b(0x17c);async[a34_0xbe1e3b(0x164)](_0x221bcc){const _0x292ea9=a34_0xbe1e3b,{options:_0x35c888,args:_0xf93324,tdx:_0x2db580}=_0x221bcc,_0x47c77c=_0xf93324[0x0];if(!_0x47c77c)return console[_0x292ea9(0x143)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x292ea9(0x143)](_0x292ea9(0x178)),console[_0x292ea9(0x143)](_0x292ea9(0x1ba)),console['error']('Examples:'),console[_0x292ea9(0x143)](_0x292ea9(0x162)),console['error']('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x49d361=_0x35c888[_0x292ea9(0x198)],_0x3675ec=await resolveSegmentTarget(_0x47c77c,_0x49d361,_0x35c888['verbose']);_0x35c888[_0x292ea9(0x190)]&&console[_0x292ea9(0x143)]('Target\x20path:\x20'+_0x3675ec);const _0xe91174=await withSpinner('Resolving\x20\x27'+_0x47c77c+_0x292ea9(0x137),()=>_0x2db580[_0x292ea9(0x1b9)][_0x292ea9(0x16a)](_0x3675ec),{'verbose':_0x35c888[_0x292ea9(0x190)]}),_0x41f7bc=_0xe91174[_0x292ea9(0x14b)];_0x35c888[_0x292ea9(0x190)]&&(console[_0x292ea9(0x143)](_0x292ea9(0x1ab)+_0x41f7bc[_0x292ea9(0x18d)]),console[_0x292ea9(0x143)]('Parent\x20ID:\x20'+_0x41f7bc['parentId']));if(_0x41f7bc[_0x292ea9(0x18d)]===_0x292ea9(0x122))return console[_0x292ea9(0x143)](_0x292ea9(0x15b)),console[_0x292ea9(0x143)](_0x292ea9(0x187)),0x1;if(_0x41f7bc[_0x292ea9(0x18d)]===_0x292ea9(0x13a))return console[_0x292ea9(0x143)](_0x292ea9(0x19b)),console[_0x292ea9(0x143)](_0x292ea9(0x17f)),0x1;if(!_0x41f7bc[_0x292ea9(0x1b3)])throw new SDKError(ErrorCode[_0x292ea9(0x1a0)],_0x292ea9(0x183));const _0x39f0a4=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x2db580['segment'][_0x292ea9(0x186)](_0x41f7bc[_0x292ea9(0x1bb)],_0x41f7bc[_0x292ea9(0x1b3)]),{'verbose':_0x35c888[_0x292ea9(0x190)]}),_0x157df6=_0x39f0a4[_0x292ea9(0x14b)],_0x51153d=await executeSchemaQuery(_0x157df6,_0x2db580,_0x35c888);return await handleQueryOutput(_0x51153d,_0x35c888),0x0;}catch(_0x35a269){if(_0x35a269 instanceof SDKError)return console['error'](_0x292ea9(0x182)+_0x35a269[_0x292ea9(0x129)]),_0x35a269[_0x292ea9(0x1a2)]&&console[_0x292ea9(0x143)](_0x292ea9(0x128)+_0x35a269['cause']),0x1;throw _0x35a269;}}}function a34_0x4208(){const _0x4f567e=['115359njtMqX','Show\x20segment\x20folder\x20details','\x20folder','segment:folder:create','Usage:\x20tdx\x20sg\x20desc\x20<name>','replace','INVALID_ARGUMENT','Usage:\x20tdx\x20sg\x20show\x20<name>','Show\x20child\x20segment\x20schema\x20(column\x20types)','folderId','828081fXdzqh','Use:\x20tdx\x20ps\x20desc','length','segmentName','Error:\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','jsonl','getSegmentSQL','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','24CxyNOl','Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql','SQL\x20query:\x0a','site','red','type','green','Get\x20SQL\x20query\x20for\x20child\x20segment','verbose','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Fetching\x20SQL\x20for\x20segment...','Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Fetching\x20SQL\x20from\x20rule...','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Resolved\x20parent\x20ID:\x20','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','parentSegment','log','resolveParentId','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','information_schema','\x20\x20tdx\x20sg\x20sql\x20--path\x20','segment:folder:show','Folder\x20ID:\x20','SEGMENT_NOT_FOUND','json','cause','Parent\x20name:\x20','path','62ercuAJ','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','setJobId','Listing\x20folders\x20for\x20parent\x20\x27','\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','Resolved\x20type:\x20','Fetching\x20folder\x20details...','includes','✔\x20Query\x20completed:\x20Processed\x20','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','limit','Executing\x20segment\x20query...','segmentId','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','description','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml','4XCwIIn','segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','parentId','\x20\x20Segment\x20name:\x20','test','Show\x20segment\x20or\x20folder\x20details','Use:\x20tdx\x20ps\x20show','Folder\x20name:\x20','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Site:\x20','resolveFolderId','getFolder','\x20\x20Folder\x20path:\x20','398765zkQjnk','trim','Resolving\x20parent\x20segment\x20\x27','Parent\x20segment:\x20','1964690JgRQgm','Error:\x20Folder\x20reference\x20is\x20required','folder','Usage:\x20tdx\x20segment\x20describe\x20<path>','in\x20','elapsedTimeMillis','/app/ps/','SELECT\x20*\x20FROM\x20(\x0a','\x20\x20Cause:\x20','message','727536PVbmHC','\x20\x20Parent\x20segment:\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Use:\x20tdx\x20ps\x20view','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','140PPjuFi','4673YHmtBf','processedRows','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','segment:show','Fetching\x20parent\x20segment\x20details...','Resolved\x20folder\x20ID:\x20','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','\x27...','/e/','Resolved\x20YAML\x20file:\x20','parent','\x20[Job\x20ID:\x20','format','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','web','toLocaleString','Resolved:\x20','Segment\x20ID:\x20','fullPath','error','Resolving\x20\x27','Error:\x20Path\x20or\x20name\x20is\x20required','segmentPath','SEGMENT_FOLDER_NOT_FOUND','segment:view','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','data','segment:folder:list','segment:sql','Resolved\x20relative\x20path\x20to:\x20','parentFolder','segment:desc','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Options:','\x27\x20with\x20ID:\x20','Usage:','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Examples:','stats','Creating\x20folder\x20\x27','✖\x20Query\x20failed\x20[','(root)','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','87681nNysTI','Resolving\x20folder\x20\x27','getSegment','jobId','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Target\x20path:\x20','execute','Show\x20folder\x20or\x20child\x20segment\x20details','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Resolving\x20path\x20\x27','Create\x20segment\x20folder\x20for\x20organization','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','resolvePathToResource','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Fetching\x20segment\x20details...','name','\x20\x20Full\x20path:\x20','Fetching\x20folder\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','getSQLFromServerSegment','createFolder','Parent\x20ID:\x20'];a34_0x4208=function(){return _0x4f567e;};return a34_0x4208();}
1
+ const a35_0x1bd46b=a35_0x25c5;(function(_0x50504c,_0x3eb548){const _0x5620f1=a35_0x25c5,_0x5ea8df=_0x50504c();while(!![]){try{const _0x466fff=-parseInt(_0x5620f1(0x196))/0x1*(-parseInt(_0x5620f1(0x18d))/0x2)+parseInt(_0x5620f1(0x19a))/0x3+parseInt(_0x5620f1(0x1c8))/0x4+-parseInt(_0x5620f1(0x15e))/0x5+-parseInt(_0x5620f1(0x166))/0x6*(-parseInt(_0x5620f1(0x1b3))/0x7)+-parseInt(_0x5620f1(0x177))/0x8+-parseInt(_0x5620f1(0x15c))/0x9;if(_0x466fff===_0x3eb548)break;else _0x5ea8df['push'](_0x5ea8df['shift']());}catch(_0x581c4f){_0x5ea8df['push'](_0x5ea8df['shift']());}}}(a35_0x3a3d,0x93ae7));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';function a35_0x3a3d(){const _0x3e1dbc=['Show\x20child\x20segment\x20schema\x20(column\x20types)','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Fetching\x20folder\x20details...','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','getSegmentSQLFromYaml','resolveParentId','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Error:\x20Segment\x20name\x20or\x20--path\x20is\x20required','\x20folder','Site:\x20','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','4597560HXSHcS','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Resolved:\x20','parentSegment','fullPath','SEGMENT_NOT_FOUND','Segment\x20ID:\x20','Folder\x20name:\x20','Listing\x20folders\x20for\x20parent\x20\x27','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','\x20\x20tdx\x20sg\x20sql\x20--path\x20','\x20[Job\x20ID:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','error','Resolving\x20path\x20\x27','Fetching\x20SQL\x20for\x20segment...','✔\x20Found\x20','Show\x20segment\x20or\x20folder\x20details','Examples:','message','/e/','Resolved\x20parent\x20ID:\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','description','segment:folder:list','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','execute','Resolved\x20type:\x20','trim','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Resolving\x20parent\x20folder\x20\x27','\x20\x20Folder\x20path:\x20','processedRows','segmentId','cyan','verbose','Error:\x20','cause','SELECT\x20*\x20FROM\x20(\x0a','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','getSQLFromYamlFile','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','listFolders','Fetching\x20folder\x20\x27','red','replace','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','includes','code','Parent\x20name:\x20','content','17593947rdlONk','segment:folder:show','2304360agJClh','name','segmentName','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Show\x20folder\x20or\x20child\x20segment\x20details','json','getSegment','19254xDyklL','Fetching\x20segment\x20details...','toLocaleString','Use:\x20tdx\x20ps\x20show','query','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','jsonl','Usage:\x20tdx\x20sg\x20show\x20<name>','data','folderId','site','INVALID_ARGUMENT','✔\x20Query\x20completed:\x20Processed\x20','\x20\x20Segment\x20name:\x20','Error:\x20YAML\x20file\x20paths\x20must\x20be\x20specified\x20with\x20--path\x20option','path','6513808hqLQvQ','type','Use:\x20tdx\x20ps\x20desc','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','segmentPath','parentFolder','\x20rows\x20','Target\x20path:\x20','segment:show','\x20Opening\x20','getSegmentSQL','Usage:\x20tdx\x20segment\x20describe\x20<path>','getFolder','Show\x20segment\x20folder\x20details','limit','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','stats','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Resolving\x20parent\x20segment\x20\x27','2XfvJih','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','resolveFolderId','Folder\x20ID:\x20','segment','\x20\x20Server-side\x20segment:\x20\x20tdx\x20sg\x20sql\x20<name>','Error:\x20Path\x20or\x20name\x20is\x20required','SEGMENT_FOLDER_NOT_FOUND','Resolving\x20\x27','1136503YzTeQX','length','log','jobId','1797381YjZgHS','parent','format','Parent\x20ID:\x20','\x27\x20with\x20ID:\x20','Error:\x20Folder\x20reference\x20is\x20required','Resolved\x20folder\x20ID:\x20','✔\x20Created\x20folder\x20\x27','Creating\x20folder\x20\x27','resolvePathToResource','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','elapsedTimeMillis','✖\x20Query\x20failed\x20[','Error:\x20Parent\x20segment\x20name\x20is\x20required','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Fetching\x20SQL\x20from\x20rule...','parentId','Usage:\x20tdx\x20sg\x20desc\x20<name>','getSQLFromServerSegment','\x27...','\x20\x20Cause:\x20','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','folderPath','Executing\x20segment\x20query...','Resolved\x20parent\x20folder\x20ID:\x20','2072EreVZu','segment:describe','segment:desc','folder','in\x20','Usage:','Fetching\x20parent\x20segment\x20details...','Error:\x20Specify\x20either\x20segment\x20name\x20or\x20--path,\x20not\x20both','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'];a35_0x3a3d=function(){return _0x3e1dbc;};return a35_0x3a3d();}import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a35_0x1183da from'chalk';async function resolveSegmentTarget(_0x4c691a,_0x1dbb4b,_0x1d7c03){const _0x33cf0f=a35_0x25c5;if(isYamlFilePath(_0x4c691a))try{const _0x18e8be=await resolveYamlFilePath(_0x4c691a);return _0x1d7c03&&(console['error']('Resolved\x20YAML\x20file:\x20'+_0x4c691a),console[_0x33cf0f(0x1d6)]('\x20\x20Parent\x20segment:\x20'+_0x18e8be[_0x33cf0f(0x1cb)]),console[_0x33cf0f(0x1d6)](_0x33cf0f(0x174)+_0x18e8be[_0x33cf0f(0x160)]),console['error'](_0x33cf0f(0x147)+(_0x18e8be[_0x33cf0f(0x1b0)]||'(root)')),console[_0x33cf0f(0x1d6)]('\x20\x20Full\x20path:\x20'+_0x18e8be[_0x33cf0f(0x1cc)])),_0x18e8be[_0x33cf0f(0x1cc)];}catch(_0x58fadd){throw new SDKError(ErrorCode[_0x33cf0f(0x172)],_0x33cf0f(0x161)+_0x58fadd['message']);}if(!_0x1dbb4b)throw new SDKError(ErrorCode[_0x33cf0f(0x172)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x1dbb4b+'/'+_0x4c691a;}export class SegmentDescribeCommand extends BaseCommand{[a35_0x1bd46b(0x15f)]=a35_0x1bd46b(0x1b4);['description']=a35_0x1bd46b(0x1da);async[a35_0x1bd46b(0x142)](_0x50cc83){const _0x26f6ad=a35_0x1bd46b,{options:_0x296724,args:_0x5116fe,tdx:_0x4f3e69}=_0x50cc83,_0x4156f5=_0x5116fe[0x0],_0x56ebc6=!_0x4156f5&&!!_0x296724['parentSegment'],_0x3d6332=_0x4156f5||_0x296724['parentSegment'];if(!_0x3d6332)return console[_0x26f6ad(0x1d6)](_0x26f6ad(0x193)),console[_0x26f6ad(0x1d6)](_0x26f6ad(0x183)),console['error'](_0x26f6ad(0x1db)),console[_0x26f6ad(0x1d6)](_0x26f6ad(0x1c3)),console[_0x26f6ad(0x1d6)](_0x26f6ad(0x1a4)),console[_0x26f6ad(0x1d6)](_0x26f6ad(0x1d4)),console[_0x26f6ad(0x1d6)](_0x26f6ad(0x1bf)),0x1;try{const _0x1785f5=_0x296724[_0x26f6ad(0x17c)];let _0x2b7dff=_0x3d6332;!_0x56ebc6&&_0x1785f5&&!_0x3d6332[_0x26f6ad(0x158)]('/')&&(_0x2b7dff=_0x1785f5+'/'+_0x3d6332,_0x296724[_0x26f6ad(0x14b)]&&console['error']('Resolved\x20relative\x20path\x20to:\x20'+_0x2b7dff));const _0x3be67d=await withSpinner(_0x26f6ad(0x1d7)+_0x2b7dff+_0x26f6ad(0x1ad),()=>_0x4f3e69[_0x26f6ad(0x191)]['resolvePathToResource'](_0x2b7dff),{'verbose':_0x296724[_0x26f6ad(0x14b)]}),_0x566176=_0x3be67d['data'];_0x296724[_0x26f6ad(0x14b)]&&(console[_0x26f6ad(0x1d6)]('Resolved\x20type:\x20'+_0x566176[_0x26f6ad(0x178)]),console[_0x26f6ad(0x1d6)]('Parent\x20ID:\x20'+_0x566176[_0x26f6ad(0x1aa)]),_0x566176['folderId']&&console[_0x26f6ad(0x1d6)](_0x26f6ad(0x190)+_0x566176[_0x26f6ad(0x170)]),_0x566176[_0x26f6ad(0x149)]&&console[_0x26f6ad(0x1d6)](_0x26f6ad(0x1ce)+_0x566176['segmentId']));if(_0x566176[_0x26f6ad(0x178)]===_0x26f6ad(0x19b)){const _0x4c2035=await withSpinner(_0x26f6ad(0x1b9),()=>_0x4f3e69[_0x26f6ad(0x191)]['getParent'](_0x566176['parentId']),{'verbose':_0x296724[_0x26f6ad(0x14b)]});await handleSingleObjectOutput(_0x4c2035[_0x26f6ad(0x16f)],_0x296724);}else{if(_0x566176[_0x26f6ad(0x178)]===_0x26f6ad(0x1b6)){if(!_0x566176[_0x26f6ad(0x170)])throw new SDKError(ErrorCode[_0x26f6ad(0x194)],_0x26f6ad(0x1bd));const _0x32b457=await withSpinner('Fetching\x20folder\x20details...',()=>_0x4f3e69[_0x26f6ad(0x191)][_0x26f6ad(0x184)](_0x566176[_0x26f6ad(0x170)]),{'verbose':_0x296724[_0x26f6ad(0x14b)]});await handleSingleObjectOutput(_0x32b457[_0x26f6ad(0x16f)],_0x296724);}else{if(_0x566176[_0x26f6ad(0x178)]===_0x26f6ad(0x191)){if(!_0x566176[_0x26f6ad(0x149)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x26f6ad(0x145));const _0x1b9928=await withSpinner('Fetching\x20segment\x20details...',()=>_0x4f3e69['segment'][_0x26f6ad(0x165)](_0x566176[_0x26f6ad(0x1aa)],_0x566176[_0x26f6ad(0x149)]),{'verbose':_0x296724['verbose']});await handleSingleObjectOutput(_0x1b9928[_0x26f6ad(0x16f)],_0x296724);}}}return 0x0;}catch(_0x392711){if(_0x392711 instanceof SDKError)return console[_0x26f6ad(0x1d6)]('Error:\x20'+_0x392711['message']),_0x392711[_0x26f6ad(0x14d)]&&console[_0x26f6ad(0x1d6)](_0x26f6ad(0x1ae)+_0x392711['cause']),0x1;throw _0x392711;}}}export class SegmentShowCommand extends BaseCommand{[a35_0x1bd46b(0x15f)]=a35_0x1bd46b(0x180);[a35_0x1bd46b(0x1e0)]=a35_0x1bd46b(0x1c9);async[a35_0x1bd46b(0x142)](_0x22adb0){const _0x599e56=a35_0x1bd46b,{options:_0xc6c5b8,args:_0x173080,tdx:_0x5c3949}=_0x22adb0,_0x711a6c=_0x173080[0x0];if(!_0x711a6c)return console[_0x599e56(0x1d6)](_0x599e56(0x1df)),console[_0x599e56(0x1d6)](_0x599e56(0x16e)),console['error'](_0x599e56(0x151)),console['error']('Examples:'),console[_0x599e56(0x1d6)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x599e56(0x1d6)](_0x599e56(0x162)),0x1;try{const _0x1b94f1=_0xc6c5b8[_0x599e56(0x1cb)],_0x5b4a6f=await resolveSegmentTarget(_0x711a6c,_0x1b94f1,_0xc6c5b8[_0x599e56(0x14b)]);_0xc6c5b8[_0x599e56(0x14b)]&&console[_0x599e56(0x1d6)](_0x599e56(0x17f)+_0x5b4a6f);const _0x275c74=await withSpinner(_0x599e56(0x195)+_0x711a6c+_0x599e56(0x1ad),()=>_0x5c3949[_0x599e56(0x191)]['resolvePathToResource'](_0x5b4a6f),{'verbose':_0xc6c5b8['verbose']}),_0x13e956=_0x275c74[_0x599e56(0x16f)];_0xc6c5b8[_0x599e56(0x14b)]&&(console['error'](_0x599e56(0x143)+_0x13e956[_0x599e56(0x178)]),console[_0x599e56(0x1d6)](_0x599e56(0x19d)+_0x13e956[_0x599e56(0x1aa)]));if(_0x13e956[_0x599e56(0x178)]==='folder')return console[_0x599e56(0x1d6)](_0x599e56(0x16b)),console[_0x599e56(0x1d6)](_0x599e56(0x188)),0x1;if(_0x13e956[_0x599e56(0x178)]===_0x599e56(0x19b))return console[_0x599e56(0x1d6)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x599e56(0x1d6)](_0x599e56(0x169)),0x1;if(!_0x13e956[_0x599e56(0x149)])throw new SDKError(ErrorCode[_0x599e56(0x1cd)],_0x599e56(0x145));const _0x5f0200=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x5c3949[_0x599e56(0x191)][_0x599e56(0x182)](_0x13e956[_0x599e56(0x1aa)],_0x13e956['segmentId']),{'verbose':_0xc6c5b8[_0x599e56(0x14b)]});let _0x2a9482=_0x5f0200[_0x599e56(0x16f)];const _0x13638a=resolveLimit(_0xc6c5b8[_0x599e56(0x186)],DEFAULT_DISPLAY_LIMIT),_0x1a4e44=/\bLIMIT\s+\d+/i['test'](_0x2a9482);!_0x1a4e44&&(_0x2a9482=_0x2a9482[_0x599e56(0x144)]()[_0x599e56(0x156)](/;+$/,''),_0x2a9482=_0x599e56(0x14e)+_0x2a9482+_0x599e56(0x18a)+_0x13638a);_0xc6c5b8[_0x599e56(0x14b)]&&console[_0x599e56(0x1d6)]('SQL\x20query:\x0a'+_0x2a9482);const _0xbeb421=await withProgressSpinner(_0x599e56(0x1b1),async _0x20f896=>{const _0x5673c6=_0x599e56,_0xc623b1=await _0x5c3949[_0x5673c6(0x16a)]['execute'](_0x2a9482,{'catalog':'td','schema':'information_schema','onJobId':_0x187afd=>{_0x20f896['setJobId'](_0x187afd);}});return _0xc623b1;},{'verbose':_0xc6c5b8[_0x599e56(0x14b)]}),_0x43d7eb=_0xbeb421[_0x599e56(0x16f)],_0xb792f0=_0x43d7eb['jobId']?_0x599e56(0x1d3)+_0x43d7eb[_0x599e56(0x199)]+']':'';return console[_0x599e56(0x1d6)](_0x599e56(0x173)+_0x43d7eb[_0x599e56(0x189)][_0x599e56(0x148)][_0x599e56(0x168)]()+_0x599e56(0x17e)+(_0x599e56(0x1b7)+formatElapsed(_0x43d7eb[_0x599e56(0x189)][_0x599e56(0x1a5)])+_0xb792f0)),await handleQueryOutput(_0x43d7eb,_0xc6c5b8),0x0;}catch(_0x5369d7){if(_0x5369d7 instanceof SDKError)return console[_0x599e56(0x1d6)](_0x599e56(0x1a6)+_0x5369d7[_0x599e56(0x159)]+']'),console[_0x599e56(0x1d6)]('\x0a'+_0x5369d7[_0x599e56(0x1dc)]),0x1;throw _0x5369d7;}}}function a35_0x25c5(_0xcf8aba,_0x2ba5b8){_0xcf8aba=_0xcf8aba-0x140;const _0x3a3df9=a35_0x3a3d();let _0x25c508=_0x3a3df9[_0xcf8aba];return _0x25c508;}export class SegmentFolderListCommand extends BaseCommand{[a35_0x1bd46b(0x15f)]=a35_0x1bd46b(0x140);[a35_0x1bd46b(0x1e0)]=a35_0x1bd46b(0x1d5);async[a35_0x1bd46b(0x142)](_0x1758b0){const _0x552e60=a35_0x1bd46b,{options:_0x3ad68,args:_0x36ed4f,tdx:_0x5cc794}=_0x1758b0;if(_0x36ed4f[_0x552e60(0x197)]===0x0)return console['error'](_0x552e60(0x1a7)),console[_0x552e60(0x1d6)](_0x552e60(0x18b)),0x1;const _0x1d4290=_0x36ed4f[0x0];try{_0x3ad68[_0x552e60(0x14b)]&&(console['error'](_0x552e60(0x1c6)+_0x3ad68[_0x552e60(0x171)]),console[_0x552e60(0x1d6)]('Parent\x20name:\x20'+_0x1d4290));const _0x42aa4f=await withSpinner(_0x552e60(0x18c)+_0x1d4290+_0x552e60(0x1ad),()=>_0x5cc794[_0x552e60(0x191)][_0x552e60(0x1c1)](_0x1d4290),{'verbose':_0x3ad68['verbose']}),_0x24be95=_0x42aa4f[_0x552e60(0x16f)];_0x3ad68[_0x552e60(0x14b)]&&console['error'](_0x552e60(0x1de)+_0x24be95);const _0x461b3d=await withSpinner(_0x552e60(0x1d0)+_0x1d4290+_0x552e60(0x1ad),()=>_0x5cc794[_0x552e60(0x191)][_0x552e60(0x153)](_0x24be95),{'verbose':_0x3ad68[_0x552e60(0x14b)]}),_0x245b32=_0x461b3d['data'];return console['error'](_0x552e60(0x1d9)+_0x245b32[_0x552e60(0x197)]+_0x552e60(0x1c5)+(_0x245b32[_0x552e60(0x197)]!==0x1?'s':'')),await handleSDKOutput(_0x245b32,_0x3ad68),0x0;}catch(_0x4455d2){if(_0x4455d2 instanceof SDKError)return console[_0x552e60(0x1d6)](_0x552e60(0x14c)+_0x4455d2[_0x552e60(0x1dc)]),_0x4455d2['cause']&&console[_0x552e60(0x1d6)]('\x20\x20Cause:\x20'+_0x4455d2['cause']),0x1;throw _0x4455d2;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a35_0x1bd46b(0x15d);[a35_0x1bd46b(0x1e0)]=a35_0x1bd46b(0x185);async['execute'](_0x2857cd){const _0x38c87e=a35_0x1bd46b,{options:_0x5d55d8,args:_0x353af0,tdx:_0x1cb4b3}=_0x2857cd;if(_0x353af0['length']===0x0)return console['error'](_0x38c87e(0x19f)),console[_0x38c87e(0x1d6)](_0x38c87e(0x1af)),0x1;try{const {parentId:_0x29a5ca,childId:_0x562ea2}=parseSegmentRef(_0x353af0[0x0]);_0x5d55d8[_0x38c87e(0x14b)]&&(console[_0x38c87e(0x1d6)](_0x38c87e(0x1c6)+_0x5d55d8[_0x38c87e(0x171)]),console[_0x38c87e(0x1d6)](_0x38c87e(0x15a)+_0x29a5ca),_0x562ea2&&console[_0x38c87e(0x1d6)]('Folder\x20name:\x20'+_0x562ea2));if(!_0x562ea2)return console[_0x38c87e(0x1d6)](_0x38c87e(0x17a)),0x1;const _0x26391a=await withSpinner(_0x38c87e(0x18c)+_0x29a5ca+_0x38c87e(0x1ad),()=>_0x1cb4b3[_0x38c87e(0x191)][_0x38c87e(0x1c1)](_0x29a5ca),{'verbose':_0x5d55d8['verbose']}),_0x5e4ac2=_0x26391a[_0x38c87e(0x16f)];_0x5d55d8[_0x38c87e(0x14b)]&&console[_0x38c87e(0x1d6)]('Resolved\x20parent\x20ID:\x20'+_0x5e4ac2);const _0x336758=await withSpinner('Resolving\x20folder\x20\x27'+_0x562ea2+_0x38c87e(0x1ad),()=>_0x1cb4b3['segment'][_0x38c87e(0x18f)](_0x5e4ac2,_0x562ea2),{'verbose':_0x5d55d8[_0x38c87e(0x14b)]}),_0x115f29=_0x336758[_0x38c87e(0x16f)];_0x5d55d8[_0x38c87e(0x14b)]&&console[_0x38c87e(0x1d6)](_0x38c87e(0x1a0)+_0x115f29);const _0x5465ac=await withSpinner(_0x38c87e(0x154)+_0x562ea2+_0x38c87e(0x1ad),()=>_0x1cb4b3[_0x38c87e(0x191)][_0x38c87e(0x184)](_0x115f29),{'verbose':_0x5d55d8[_0x38c87e(0x14b)]});return await handleSDKOutput([_0x5465ac[_0x38c87e(0x16f)]],_0x5d55d8),0x0;}catch(_0x2cad47){if(_0x2cad47 instanceof SDKError)return console[_0x38c87e(0x1d6)](_0x38c87e(0x14c)+_0x2cad47[_0x38c87e(0x1dc)]),_0x2cad47[_0x38c87e(0x14d)]&&console['error'](_0x38c87e(0x1ae)+_0x2cad47[_0x38c87e(0x14d)]),0x1;throw _0x2cad47;}}}export class SegmentSQLCommand extends BaseCommand{[a35_0x1bd46b(0x15f)]='segment:sql';['description']='Get\x20SQL\x20query\x20for\x20child\x20segment';async['execute'](_0x68193e){const _0x5305aa=a35_0x1bd46b,{options:_0x2fdecf,args:_0x30536b}=_0x68193e,_0x68f04a=_0x2fdecf,_0x2de8ef=_0x68f04a[_0x5305aa(0x176)],_0x4861f9=_0x30536b[0x0];if(!_0x4861f9&&!_0x2de8ef)return console[_0x5305aa(0x1d6)](a35_0x1183da[_0x5305aa(0x155)](_0x5305aa(0x1c4))),console[_0x5305aa(0x1d6)](_0x5305aa(0x1b8)),console['error'](_0x5305aa(0x192)),console[_0x5305aa(0x1d6)]('\x20\x20Local\x20YAML\x20file:\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20--path\x20<file-path>'),console['error'](_0x5305aa(0x1db)),console[_0x5305aa(0x1d6)](_0x5305aa(0x1c7)),console['error']('\x20\x20tdx\x20sg\x20sql\x20--path\x20segments/my-audience/premium-users.yml'),0x1;if(_0x4861f9&&_0x2de8ef)return console[_0x5305aa(0x1d6)](a35_0x1183da[_0x5305aa(0x155)](_0x5305aa(0x1ba))),0x1;try{let _0x54ce44;if(_0x2de8ef)_0x54ce44=await this[_0x5305aa(0x150)](_0x2de8ef,_0x68193e);else{if(isYamlFilePath(_0x4861f9))return console[_0x5305aa(0x1d6)](a35_0x1183da[_0x5305aa(0x155)](_0x5305aa(0x175))),console[_0x5305aa(0x1d6)](_0x5305aa(0x1d2)+_0x4861f9),0x1;else _0x54ce44=await this[_0x5305aa(0x1ac)](_0x4861f9,_0x68193e);}return _0x2fdecf[_0x5305aa(0x19c)]===_0x5305aa(0x164)||_0x2fdecf[_0x5305aa(0x19c)]===_0x5305aa(0x16d)?await handleSDKOutput([{'sql':_0x54ce44}],_0x2fdecf):console[_0x5305aa(0x198)](_0x54ce44),0x0;}catch(_0x301c9d){if(_0x301c9d instanceof SDKError)return console[_0x5305aa(0x1d6)](_0x5305aa(0x14c)+_0x301c9d[_0x5305aa(0x1dc)]),_0x301c9d['cause']&&console[_0x5305aa(0x1d6)](_0x5305aa(0x1ae)+_0x301c9d[_0x5305aa(0x14d)]),0x1;throw _0x301c9d;}}async[a35_0x1bd46b(0x150)](_0x1558e1,_0x482ab9){const _0x308610=a35_0x1bd46b,{options:_0x59ad2d,tdx:_0x2dbc86}=_0x482ab9;let _0x3eba47;try{_0x3eba47=await resolveYamlFilePath(_0x1558e1);}catch(_0x4f7b1a){throw new SDKError(ErrorCode[_0x308610(0x172)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x4f7b1a[_0x308610(0x1dc)]);}_0x59ad2d[_0x308610(0x14b)]&&console['error'](_0x308610(0x1ca)+_0x3eba47['parentSegment']+'/'+_0x3eba47[_0x308610(0x160)]);const _0xda30f4=await withSpinner(_0x308610(0x1a9),()=>_0x2dbc86[_0x308610(0x191)][_0x308610(0x1c0)](_0x3eba47[_0x308610(0x15b)],_0x3eba47[_0x308610(0x1cb)],_0x3eba47[_0x308610(0x160)]),{'verbose':_0x59ad2d['verbose']});return _0xda30f4[_0x308610(0x16f)];}async[a35_0x1bd46b(0x1ac)](_0x5003ea,_0x4f55ec){const _0x537663=a35_0x1bd46b,{options:_0x3a56df,tdx:_0x595a6d}=_0x4f55ec,_0x2946ad=_0x3a56df[_0x537663(0x1cb)],_0x5e41d1=await resolveSegmentTarget(_0x5003ea,_0x2946ad,_0x3a56df[_0x537663(0x14b)]);_0x3a56df[_0x537663(0x14b)]&&console[_0x537663(0x1d6)](_0x537663(0x17f)+_0x5e41d1);const _0x53654c=await withSpinner(_0x537663(0x195)+_0x5003ea+_0x537663(0x1ad),()=>_0x595a6d[_0x537663(0x191)][_0x537663(0x1a3)](_0x5e41d1),{'verbose':_0x3a56df[_0x537663(0x14b)]}),_0x300396=_0x53654c['data'];_0x3a56df[_0x537663(0x14b)]&&(console['error'](_0x537663(0x143)+_0x300396[_0x537663(0x178)]),console[_0x537663(0x1d6)](_0x537663(0x19d)+_0x300396['parentId']));if(_0x300396['type']===_0x537663(0x1b6))throw new SDKError(ErrorCode[_0x537663(0x172)],'Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.\x20Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.');if(_0x300396[_0x537663(0x178)]===_0x537663(0x19b))throw new SDKError(ErrorCode[_0x537663(0x172)],'Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.\x20Use:\x20tdx\x20ps\x20sql');if(!_0x300396[_0x537663(0x149)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x30a74a=await withSpinner(_0x537663(0x1d8),()=>_0x595a6d[_0x537663(0x191)][_0x537663(0x182)](_0x300396[_0x537663(0x1aa)],_0x300396['segmentId']),{'verbose':_0x3a56df[_0x537663(0x14b)]});return _0x30a74a[_0x537663(0x16f)];}}export class SegmentFolderCreateCommand extends BaseCommand{[a35_0x1bd46b(0x15f)]='segment:folder:create';['description']='Create\x20segment\x20folder\x20for\x20organization';async[a35_0x1bd46b(0x142)](_0x392688){const _0x1c4ce5=a35_0x1bd46b,{options:_0x2511f4,args:_0x46ecbd,tdx:_0xea132c}=_0x392688,_0xd87fbb=_0x2511f4;if(_0x46ecbd['length']<0x2)return console[_0x1c4ce5(0x1d6)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console[_0x1c4ce5(0x1d6)](_0x1c4ce5(0x17b)),0x1;const _0x30ec04=_0x46ecbd[0x0],_0x40f541=_0x46ecbd[0x1];_0xd87fbb['verbose']&&(console[_0x1c4ce5(0x1d6)](_0x1c4ce5(0x1c6)+_0xd87fbb[_0x1c4ce5(0x171)]),console[_0x1c4ce5(0x1d6)]('Parent\x20segment:\x20'+_0x30ec04),console[_0x1c4ce5(0x1d6)](_0x1c4ce5(0x1cf)+_0x40f541));let _0x1f4440;if(_0xd87fbb[_0x1c4ce5(0x17d)]){const _0x268b3e=_0xd87fbb[_0x1c4ce5(0x17d)],_0x526738=await withSpinner(_0x1c4ce5(0x18c)+_0x30ec04+'\x27...',()=>_0xea132c[_0x1c4ce5(0x191)][_0x1c4ce5(0x1c1)](_0x30ec04),{'verbose':_0xd87fbb['verbose']}),_0x1d2ee2=_0x526738[_0x1c4ce5(0x16f)],_0x510db0=await withSpinner(_0x1c4ce5(0x146)+_0x268b3e+'\x27...',()=>_0xea132c[_0x1c4ce5(0x191)][_0x1c4ce5(0x18f)](_0x1d2ee2,_0x268b3e),{'verbose':_0xd87fbb[_0x1c4ce5(0x14b)]});_0x1f4440=_0x510db0['data'],_0xd87fbb[_0x1c4ce5(0x14b)]&&console[_0x1c4ce5(0x1d6)](_0x1c4ce5(0x1b2)+_0x1f4440);}const _0x260fa6={'name':_0x40f541,'description':_0xd87fbb[_0x1c4ce5(0x1e0)],'parentFolderId':_0x1f4440},_0x572ed9=await withSpinner(_0x1c4ce5(0x1a2)+_0x40f541+_0x1c4ce5(0x1ad),()=>_0xea132c[_0x1c4ce5(0x191)]['createFolder'](_0x30ec04,_0x260fa6),{'verbose':_0xd87fbb['verbose']}),_0x329a6c=_0x572ed9[_0x1c4ce5(0x16f)];return console[_0x1c4ce5(0x1d6)](_0x1c4ce5(0x1a1)+_0x329a6c[_0x1c4ce5(0x15f)]+_0x1c4ce5(0x19e)+_0x329a6c['id']),await handleSDKOutput([_0x329a6c],_0xd87fbb),0x0;}}export class SegmentViewCommand extends BaseCommand{[a35_0x1bd46b(0x15f)]='segment:view';['description']=a35_0x1bd46b(0x163);async[a35_0x1bd46b(0x142)](_0x287a2e){const _0x524651=a35_0x1bd46b,{options:_0x51722f,args:_0x158f46,tdx:_0x1055eb}=_0x287a2e,_0x3adf97=_0x158f46[0x0];if(!_0x3adf97)return console[_0x524651(0x1d6)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error'](_0x524651(0x1a8)),console[_0x524651(0x1d6)](_0x524651(0x157)),console[_0x524651(0x1d6)]('Options:'),console[_0x524651(0x1d6)](_0x524651(0x1c2)),console[_0x524651(0x1d6)](_0x524651(0x1db)),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x524651(0x1d6)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console['error'](_0x524651(0x1d1)),console['error'](_0x524651(0x14f)),0x1;try{const _0x4ea44e=_0x51722f[_0x524651(0x1cb)],_0x25c78c=await resolveSegmentTarget(_0x3adf97,_0x4ea44e,_0x51722f[_0x524651(0x14b)]);_0x51722f[_0x524651(0x14b)]&&console[_0x524651(0x1d6)](_0x524651(0x17f)+_0x25c78c);const _0x1ea919=await withSpinner(_0x524651(0x195)+_0x3adf97+_0x524651(0x1ad),()=>_0x1055eb[_0x524651(0x191)][_0x524651(0x1a3)](_0x25c78c),{'verbose':_0x51722f[_0x524651(0x14b)]}),_0x987aef=_0x1ea919['data'];_0x51722f[_0x524651(0x14b)]&&(console[_0x524651(0x1d6)](_0x524651(0x143)+_0x987aef[_0x524651(0x178)]),console[_0x524651(0x1d6)](_0x524651(0x19d)+_0x987aef['parentId']),_0x987aef[_0x524651(0x170)]&&console[_0x524651(0x1d6)](_0x524651(0x190)+_0x987aef['folderId']),_0x987aef['segmentId']&&console[_0x524651(0x1d6)](_0x524651(0x1ce)+_0x987aef[_0x524651(0x149)]));if(_0x51722f['web']){if(_0x987aef['type']==='folder')return console[_0x524651(0x1d6)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x987aef['type']===_0x524651(0x19b))return console[_0x524651(0x1d6)](_0x524651(0x18e)),console[_0x524651(0x1d6)]('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x987aef['segmentId'])throw new SDKError(ErrorCode[_0x524651(0x1cd)],_0x524651(0x145));const _0x1944c7=getConsoleNextUrl(_0x51722f[_0x524651(0x171)],'/app/ps/'+_0x987aef[_0x524651(0x1aa)]+'/e/'+_0x987aef[_0x524651(0x149)]);return console[_0x524651(0x1d6)](a35_0x1183da['green']('✔')+_0x524651(0x181)+a35_0x1183da[_0x524651(0x14a)](_0x1944c7)),openBrowser(_0x1944c7),0x0;}if(_0x987aef['type']==='folder'){if(!_0x987aef['folderId'])throw new SDKError(ErrorCode[_0x524651(0x194)],_0x524651(0x1bd));const _0x424d1f=await withSpinner(_0x524651(0x1be),()=>_0x1055eb[_0x524651(0x191)][_0x524651(0x184)](_0x987aef[_0x524651(0x170)]),{'verbose':_0x51722f[_0x524651(0x14b)]});await handleSingleObjectOutput(_0x424d1f['data'],_0x51722f);}else{if(_0x987aef[_0x524651(0x178)]==='segment'){if(!_0x987aef[_0x524651(0x149)])throw new SDKError(ErrorCode[_0x524651(0x1cd)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x23b3b9=await withSpinner(_0x524651(0x167),()=>_0x1055eb['segment'][_0x524651(0x165)](_0x987aef['parentId'],_0x987aef[_0x524651(0x149)]),{'verbose':_0x51722f[_0x524651(0x14b)]}),_0x511e7f=getConsoleNextUrl(_0x51722f[_0x524651(0x171)],'/app/ps/'+_0x987aef[_0x524651(0x1aa)]+_0x524651(0x1dd)+_0x987aef[_0x524651(0x149)]),_0x41e031=_0x23b3b9[_0x524651(0x16f)];_0x41e031['url']=_0x511e7f,await handleSingleObjectOutput(_0x41e031,_0x51722f);}else return console[_0x524651(0x1d6)]('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console[_0x524651(0x1d6)]('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0x23712b){if(_0x23712b instanceof SDKError)return console[_0x524651(0x1d6)](_0x524651(0x14c)+_0x23712b[_0x524651(0x1dc)]),_0x23712b[_0x524651(0x14d)]&&console[_0x524651(0x1d6)](_0x524651(0x1ae)+_0x23712b[_0x524651(0x14d)]),0x1;throw _0x23712b;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a35_0x1bd46b(0x15f)]=a35_0x1bd46b(0x1b5);[a35_0x1bd46b(0x1e0)]=a35_0x1bd46b(0x1bc);async[a35_0x1bd46b(0x142)](_0xa8369d){const _0x36eab7=a35_0x1bd46b,{options:_0x476c30,args:_0x2e8d30,tdx:_0x4fbd7f}=_0xa8369d,_0x1f94ac=_0x2e8d30[0x0];if(!_0x1f94ac)return console[_0x36eab7(0x1d6)](_0x36eab7(0x1df)),console['error'](_0x36eab7(0x1ab)),console[_0x36eab7(0x1d6)](_0x36eab7(0x16c)),console[_0x36eab7(0x1d6)](_0x36eab7(0x1db)),console[_0x36eab7(0x1d6)](_0x36eab7(0x141)),console[_0x36eab7(0x1d6)](_0x36eab7(0x152)),0x1;try{const _0x2ba369=_0x476c30[_0x36eab7(0x1cb)],_0x4f74cb=await resolveSegmentTarget(_0x1f94ac,_0x2ba369,_0x476c30[_0x36eab7(0x14b)]);_0x476c30[_0x36eab7(0x14b)]&&console[_0x36eab7(0x1d6)](_0x36eab7(0x17f)+_0x4f74cb);const _0xaabe7b=await withSpinner(_0x36eab7(0x195)+_0x1f94ac+'\x27...',()=>_0x4fbd7f[_0x36eab7(0x191)]['resolvePathToResource'](_0x4f74cb),{'verbose':_0x476c30[_0x36eab7(0x14b)]}),_0x38bd3e=_0xaabe7b[_0x36eab7(0x16f)];_0x476c30[_0x36eab7(0x14b)]&&(console[_0x36eab7(0x1d6)](_0x36eab7(0x143)+_0x38bd3e[_0x36eab7(0x178)]),console[_0x36eab7(0x1d6)]('Parent\x20ID:\x20'+_0x38bd3e[_0x36eab7(0x1aa)]));if(_0x38bd3e[_0x36eab7(0x178)]===_0x36eab7(0x1b6))return console[_0x36eab7(0x1d6)]('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console['error'](_0x36eab7(0x1bb)),0x1;if(_0x38bd3e['type']===_0x36eab7(0x19b))return console[_0x36eab7(0x1d6)](_0x36eab7(0x187)),console[_0x36eab7(0x1d6)](_0x36eab7(0x179)),0x1;if(!_0x38bd3e['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x36eab7(0x145));const _0x568c74=await withSpinner(_0x36eab7(0x1d8),()=>_0x4fbd7f[_0x36eab7(0x191)][_0x36eab7(0x182)](_0x38bd3e[_0x36eab7(0x1aa)],_0x38bd3e['segmentId']),{'verbose':_0x476c30[_0x36eab7(0x14b)]}),_0x2a58c4=_0x568c74[_0x36eab7(0x16f)],_0x21315c=await executeSchemaQuery(_0x2a58c4,_0x4fbd7f,_0x476c30);return await handleQueryOutput(_0x21315c,_0x476c30),0x0;}catch(_0x357813){if(_0x357813 instanceof SDKError)return console[_0x36eab7(0x1d6)]('Error:\x20'+_0x357813[_0x36eab7(0x1dc)]),_0x357813[_0x36eab7(0x14d)]&&console[_0x36eab7(0x1d6)](_0x36eab7(0x1ae)+_0x357813[_0x36eab7(0x14d)]),0x1;throw _0x357813;}}}
@@ -1 +1 @@
1
- function a35_0xb737(_0x1b2cf0,_0x251e1a){_0x1b2cf0=_0x1b2cf0-0x105;const _0x117626=a35_0x1176();let _0xb737d1=_0x117626[_0x1b2cf0];return _0xb737d1;}const a35_0x4ead0e=a35_0xb737;(function(_0x27ff3e,_0x2df1f2){const _0x513ebc=a35_0xb737,_0x939920=_0x27ff3e();while(!![]){try{const _0x29d213=-parseInt(_0x513ebc(0x138))/0x1+-parseInt(_0x513ebc(0x135))/0x2*(parseInt(_0x513ebc(0x108))/0x3)+-parseInt(_0x513ebc(0x136))/0x4*(-parseInt(_0x513ebc(0x112))/0x5)+-parseInt(_0x513ebc(0x127))/0x6+-parseInt(_0x513ebc(0x12a))/0x7+parseInt(_0x513ebc(0x10c))/0x8*(parseInt(_0x513ebc(0x11f))/0x9)+parseInt(_0x513ebc(0x139))/0xa*(parseInt(_0x513ebc(0x128))/0xb);if(_0x29d213===_0x2df1f2)break;else _0x939920['push'](_0x939920['shift']());}catch(_0x203081){_0x939920['push'](_0x939920['shift']());}}}(a35_0x1176,0xd2aad));function a35_0x1176(){const _0x412b92=['✔\x20Created\x20segment\x20\x27','Creating\x20segment\x20\x27','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Site:\x20','kind','2015hYqvyZ','Resolved\x20folder\x20ID:\x20','description','verbose','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','invisible','Examples:','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','error','Resolving\x20parent\x20segment\x20\x27','includes','type','6165DTYhYN','ruleFile','Target\x20path:\x20','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','noCountPopulation','execute','folder','resolveFolderId','10070736NboMKm','17478593RVpMbE','Resolved\x20relative\x20path\x20to:\x20','274946xSfivc','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','resolveParentId','Create\x20child\x20segment\x20with\x20filtering\x20rules','data','Resolving\x20folder\x20\x27','name','createSegment','segment','length','\x27...','127444GQQZGN','6004yvbILu','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','210633otisTV','20AogdKO','yellow','Parent:\x20','resolvePathToResource','66DseCGi','parent','\x27\x20with\x20ID:\x20','segments','4792hBoFIL'];a35_0x1176=function(){return _0x412b92;};return a35_0x1176();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a35_0xeaae53 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a35_0x4ead0e(0x130)]='segment:create';[a35_0x4ead0e(0x114)]=a35_0x4ead0e(0x12d);async[a35_0x4ead0e(0x124)](_0x3f03fe){const _0x21d828=a35_0x4ead0e;console[_0x21d828(0x11b)](a35_0xeaae53[_0x21d828(0x105)]('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console['error'](a35_0xeaae53[_0x21d828(0x105)](_0x21d828(0x137)));const {options:_0x1d6752,args:_0xbbb13b,tdx:_0x1024dc}=_0x3f03fe,_0x644c1=_0x1d6752;if(_0xbbb13b['length']===0x0)return console['error'](_0x21d828(0x116)),console['error'](_0x21d828(0x119)),console[_0x21d828(0x11b)](_0x21d828(0x118)),console[_0x21d828(0x11b)](_0x21d828(0x11a)),console['error'](_0x21d828(0x12b)),console[_0x21d828(0x11b)](_0x21d828(0x10f)),0x1;const _0x4ff80a=_0xbbb13b[0x0],_0xd3d63a=_0x1d6752['segmentPath'];let _0x21e781=_0x4ff80a;_0xd3d63a&&!_0x4ff80a[_0x21d828(0x11d)]('/')&&(_0x21e781=_0xd3d63a+'/'+_0x4ff80a,_0x644c1[_0x21d828(0x115)]&&console['error'](_0x21d828(0x129)+_0x21e781));const _0x4458fa=parsePath(_0x21e781);if(_0x4458fa[_0x21d828(0x10b)][_0x21d828(0x133)]<0x2)return console[_0x21d828(0x11b)]('Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'),console[_0x21d828(0x11b)]('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x22de55=_0x4458fa[_0x21d828(0x10b)][0x0],_0x2818fe=getBaseName(_0x21e781),_0xa00f99=getParentPath(_0x21e781);_0x644c1['verbose']&&(console[_0x21d828(0x11b)](_0x21d828(0x110)+_0x644c1['site']),console[_0x21d828(0x11b)](_0x21d828(0x121)+_0x21e781),console[_0x21d828(0x11b)](_0x21d828(0x106)+_0x22de55),console[_0x21d828(0x11b)]('Segment\x20name:\x20'+_0x2818fe),console[_0x21d828(0x11b)]('Parent\x20path:\x20'+_0xa00f99));const _0x4f9c9b=await withSpinner(_0x21d828(0x11c)+_0x22de55+_0x21d828(0x134),()=>_0x1024dc[_0x21d828(0x132)][_0x21d828(0x12c)](_0x22de55),{'verbose':_0x644c1['verbose']}),_0x5b2343=_0x4f9c9b[_0x21d828(0x12e)];let _0x558209;if(_0x4458fa['segments'][_0x21d828(0x133)]>0x2){const _0x3b5ec4=await withSpinner('Resolving\x20folder\x20path\x20\x27'+_0xa00f99+_0x21d828(0x134),()=>_0x1024dc['segment'][_0x21d828(0x107)](_0xa00f99),{'verbose':_0x644c1['verbose']}),_0x2b1622=_0x3b5ec4['data'];if(_0x2b1622['type']!==_0x21d828(0x125)&&_0x2b1622[_0x21d828(0x11e)]!==_0x21d828(0x109))return console[_0x21d828(0x11b)](_0x21d828(0x122)),0x1;_0x558209=_0x2b1622['folderId'];}else{if(_0x644c1['folder']){const _0x245347=await withSpinner(_0x21d828(0x12f)+_0x644c1['folder']+'\x27...',()=>_0x1024dc['segment'][_0x21d828(0x126)](_0x5b2343,_0x644c1['folder']),{'verbose':_0x644c1[_0x21d828(0x115)]});_0x558209=_0x245347['data'];}}_0x644c1[_0x21d828(0x115)]&&_0x558209&&console[_0x21d828(0x11b)](_0x21d828(0x113)+_0x558209);const _0x18d77c=await loadJSONFromOptions(_0x644c1['rule'],_0x644c1[_0x21d828(0x120)]),_0x50e5ba={'name':_0x2818fe,'description':_0x644c1[_0x21d828(0x114)],'rule':_0x18d77c,'kind':_0x644c1['kind']!==undefined?parseInt(_0x644c1[_0x21d828(0x111)],0xa):undefined,'isVisible':_0x644c1[_0x21d828(0x117)]?![]:undefined,'segmentFolderId':_0x558209,'countPopulation':_0x644c1[_0x21d828(0x123)]?![]:undefined},_0x44f2bb=await withSpinner(_0x21d828(0x10e)+_0x2818fe+_0x21d828(0x134),()=>_0x1024dc[_0x21d828(0x132)][_0x21d828(0x131)](_0x5b2343,_0x50e5ba),{'verbose':_0x644c1[_0x21d828(0x115)]}),_0x3ebe25=_0x44f2bb[_0x21d828(0x12e)];return console[_0x21d828(0x11b)](_0x21d828(0x10d)+_0x3ebe25['name']+_0x21d828(0x10a)+_0x3ebe25['id']),_0x21e781!==_0x4ff80a&&console[_0x21d828(0x11b)]('\x20\x20\x20Path:\x20'+_0x21e781),await handleSDKOutput([_0x3ebe25],_0x644c1),0x0;}}
1
+ const a36_0x53ee5a=a36_0x1a1e;(function(_0x5bb4b3,_0x48c08f){const _0x25db14=a36_0x1a1e,_0x34c6dc=_0x5bb4b3();while(!![]){try{const _0x54b370=-parseInt(_0x25db14(0xb6))/0x1*(parseInt(_0x25db14(0xb4))/0x2)+-parseInt(_0x25db14(0xe3))/0x3*(-parseInt(_0x25db14(0xc2))/0x4)+parseInt(_0x25db14(0xce))/0x5*(parseInt(_0x25db14(0xc1))/0x6)+parseInt(_0x25db14(0xbe))/0x7+parseInt(_0x25db14(0xd5))/0x8*(parseInt(_0x25db14(0xc7))/0x9)+-parseInt(_0x25db14(0xc5))/0xa+-parseInt(_0x25db14(0xd2))/0xb*(parseInt(_0x25db14(0xc0))/0xc);if(_0x54b370===_0x48c08f)break;else _0x34c6dc['push'](_0x34c6dc['shift']());}catch(_0x101caa){_0x34c6dc['push'](_0x34c6dc['shift']());}}}(a36_0x50ad,0xc14ad));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a36_0x1a1e(_0x422c8c,_0x32eabb){_0x422c8c=_0x422c8c-0xaf;const _0x50ad17=a36_0x50ad();let _0x1a1e00=_0x50ad17[_0x422c8c];return _0x1a1e00;}function a36_0x50ad(){const _0x54b261=['Resolving\x20parent\x20segment\x20\x27','rule','type','includes','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','Site:\x20','Resolving\x20folder\x20\x27','resolveFolderId','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','segment','66xtwBKV','description','44911QPxDxJ','verbose','Parent\x20path:\x20','Resolved\x20folder\x20ID:\x20','execute','Segment\x20name:\x20','folder','segment:create','10375918cqVSTE','invisible','4847124pjOCUE','7110318jXULrq','4756boBjiJ','Creating\x20segment\x20\x27','Resolving\x20folder\x20path\x20\x27','11155080inwQKf','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','8155089sXvEfe','ruleFile','resolveParentId','kind','segments','data','error','5ZECWyv','yellow','noCountPopulation','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','44iDDnoj','Parent:\x20','site','8Cfhtbo','length','Target\x20path:\x20','segmentPath','\x20\x20\x20Path:\x20','createSegment','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','Examples:','resolvePathToResource','folderId','\x27...','name','parent','3612jsFmwA'];a36_0x50ad=function(){return _0x54b261;};return a36_0x50ad();}import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a36_0xb9f341 from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']=a36_0x53ee5a(0xbd);[a36_0x53ee5a(0xb5)]='Create\x20child\x20segment\x20with\x20filtering\x20rules';async[a36_0x53ee5a(0xba)](_0x487c11){const _0x4db653=a36_0x53ee5a;console[_0x4db653(0xcd)](a36_0xb9f341[_0x4db653(0xcf)](_0x4db653(0xb2))),console['error'](a36_0xb9f341[_0x4db653(0xcf)](_0x4db653(0xdb)));const {options:_0x4a87af,args:_0x44068b,tdx:_0x189bf7}=_0x487c11,_0x5a7cfc=_0x4a87af;if(_0x44068b[_0x4db653(0xd6)]===0x0)return console[_0x4db653(0xcd)](_0x4db653(0xe8)),console['error'](_0x4db653(0xdc)),console[_0x4db653(0xcd)](_0x4db653(0xdd)),console[_0x4db653(0xcd)](_0x4db653(0xd1)),console[_0x4db653(0xcd)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console[_0x4db653(0xcd)](_0x4db653(0xc6)),0x1;const _0x1d5007=_0x44068b[0x0],_0x5a811d=_0x4a87af[_0x4db653(0xd8)];let _0x4a1571=_0x1d5007;_0x5a811d&&!_0x1d5007[_0x4db653(0xe7)]('/')&&(_0x4a1571=_0x5a811d+'/'+_0x1d5007,_0x5a7cfc[_0x4db653(0xb7)]&&console[_0x4db653(0xcd)]('Resolved\x20relative\x20path\x20to:\x20'+_0x4a1571));const _0x557405=parsePath(_0x4a1571);if(_0x557405['segments']['length']<0x2)return console[_0x4db653(0xcd)](_0x4db653(0xe9)),console[_0x4db653(0xcd)]('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x1c2da1=_0x557405[_0x4db653(0xcb)][0x0],_0x261b8a=getBaseName(_0x4a1571),_0x596b60=getParentPath(_0x4a1571);_0x5a7cfc[_0x4db653(0xb7)]&&(console[_0x4db653(0xcd)](_0x4db653(0xaf)+_0x5a7cfc[_0x4db653(0xd4)]),console[_0x4db653(0xcd)](_0x4db653(0xd7)+_0x4a1571),console[_0x4db653(0xcd)](_0x4db653(0xd3)+_0x1c2da1),console[_0x4db653(0xcd)](_0x4db653(0xbb)+_0x261b8a),console[_0x4db653(0xcd)](_0x4db653(0xb8)+_0x596b60));const _0x40d269=await withSpinner(_0x4db653(0xe4)+_0x1c2da1+_0x4db653(0xe0),()=>_0x189bf7[_0x4db653(0xb3)][_0x4db653(0xc9)](_0x1c2da1),{'verbose':_0x5a7cfc[_0x4db653(0xb7)]}),_0x56625c=_0x40d269[_0x4db653(0xcc)];let _0x5c0ba5;if(_0x557405['segments'][_0x4db653(0xd6)]>0x2){const _0x47e8b7=await withSpinner(_0x4db653(0xc4)+_0x596b60+_0x4db653(0xe0),()=>_0x189bf7[_0x4db653(0xb3)][_0x4db653(0xde)](_0x596b60),{'verbose':_0x5a7cfc[_0x4db653(0xb7)]}),_0x3781ac=_0x47e8b7[_0x4db653(0xcc)];if(_0x3781ac[_0x4db653(0xe6)]!=='folder'&&_0x3781ac[_0x4db653(0xe6)]!==_0x4db653(0xe2))return console['error']('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x5c0ba5=_0x3781ac[_0x4db653(0xdf)];}else{if(_0x5a7cfc[_0x4db653(0xbc)]){const _0x191d63=await withSpinner(_0x4db653(0xb0)+_0x5a7cfc[_0x4db653(0xbc)]+_0x4db653(0xe0),()=>_0x189bf7[_0x4db653(0xb3)][_0x4db653(0xb1)](_0x56625c,_0x5a7cfc[_0x4db653(0xbc)]),{'verbose':_0x5a7cfc['verbose']});_0x5c0ba5=_0x191d63[_0x4db653(0xcc)];}}_0x5a7cfc[_0x4db653(0xb7)]&&_0x5c0ba5&&console[_0x4db653(0xcd)](_0x4db653(0xb9)+_0x5c0ba5);const _0x323964=await loadJSONFromOptions(_0x5a7cfc[_0x4db653(0xe5)],_0x5a7cfc[_0x4db653(0xc8)]),_0x2fd044={'name':_0x261b8a,'description':_0x5a7cfc[_0x4db653(0xb5)],'rule':_0x323964,'kind':_0x5a7cfc['kind']!==undefined?parseInt(_0x5a7cfc[_0x4db653(0xca)],0xa):undefined,'isVisible':_0x5a7cfc[_0x4db653(0xbf)]?![]:undefined,'segmentFolderId':_0x5c0ba5,'countPopulation':_0x5a7cfc[_0x4db653(0xd0)]?![]:undefined},_0x4320d5=await withSpinner(_0x4db653(0xc3)+_0x261b8a+_0x4db653(0xe0),()=>_0x189bf7[_0x4db653(0xb3)][_0x4db653(0xda)](_0x56625c,_0x2fd044),{'verbose':_0x5a7cfc['verbose']}),_0xf8408c=_0x4320d5[_0x4db653(0xcc)];return console[_0x4db653(0xcd)]('✔\x20Created\x20segment\x20\x27'+_0xf8408c[_0x4db653(0xe1)]+'\x27\x20with\x20ID:\x20'+_0xf8408c['id']),_0x4a1571!==_0x1d5007&&console[_0x4db653(0xcd)](_0x4db653(0xd9)+_0x4a1571),await handleSDKOutput([_0xf8408c],_0x5a7cfc),0x0;}}
@@ -1 +1 @@
1
- function a36_0x57e2(_0x392715,_0x2d4ed3){_0x392715=_0x392715-0x1cb;const _0x3691e6=a36_0x3691();let _0x57e20f=_0x3691e6[_0x392715];return _0x57e20f;}const a36_0x5dfaee=a36_0x57e2;(function(_0x4b5ec1,_0x509e96){const _0x13fdc3=a36_0x57e2,_0x147ae0=_0x4b5ec1();while(!![]){try{const _0x3c5419=-parseInt(_0x13fdc3(0x1dd))/0x1+parseInt(_0x13fdc3(0x1db))/0x2+-parseInt(_0x13fdc3(0x1e4))/0x3*(-parseInt(_0x13fdc3(0x1ce))/0x4)+parseInt(_0x13fdc3(0x1d5))/0x5+-parseInt(_0x13fdc3(0x1dc))/0x6+parseInt(_0x13fdc3(0x1d8))/0x7*(parseInt(_0x13fdc3(0x1e2))/0x8)+parseInt(_0x13fdc3(0x1da))/0x9;if(_0x3c5419===_0x509e96)break;else _0x147ae0['push'](_0x147ae0['shift']());}catch(_0x1c395c){_0x147ae0['push'](_0x147ae0['shift']());}}}(a36_0x3691,0xa41ba));function a36_0x3691(){const _0x55a1b1=['site','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','jsonl','46848zsRDov','\x27...','name','Parent\x20segment:\x20','description','length','data','6637975cAGXwi','✔\x20Found\x20','Site:\x20','7XvvIPE','verbose','2026620eDIVLo','1341550WRYRmC','3638316szInPN','1235229XiYjbi','error','parentSegment','listFields','execute','822872ZuRJoW','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','48axLmlb','json','\x20field'];a36_0x3691=function(){return _0x55a1b1;};return a36_0x3691();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a36_0x5dfaee(0x1d0)]='segment:fields';[a36_0x5dfaee(0x1d2)]='List\x20available\x20fields\x20for\x20segmentation';async[a36_0x5dfaee(0x1e1)](_0x1dd9de){const _0x3423a6=a36_0x5dfaee,{options:_0x1d989a,args:_0x19b503,tdx:_0xd043ca}=_0x1dd9de,_0xe58bf8=_0x19b503[0x0]||_0x1d989a[_0x3423a6(0x1df)];if(!_0xe58bf8)return console['error']('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x3423a6(0x1de)](_0x3423a6(0x1cc)),console[_0x3423a6(0x1de)](_0x3423a6(0x1e3)),0x1;_0x1d989a[_0x3423a6(0x1d9)]&&(console[_0x3423a6(0x1de)](_0x3423a6(0x1d7)+_0x1d989a[_0x3423a6(0x1cb)]),console[_0x3423a6(0x1de)](_0x3423a6(0x1d1)+_0xe58bf8));const _0x3e0066=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0xe58bf8+_0x3423a6(0x1cf),()=>_0xd043ca['segment'][_0x3423a6(0x1e0)](_0xe58bf8),{'verbose':_0x1d989a[_0x3423a6(0x1d9)]}),_0x283b4d=_0x3e0066[_0x3423a6(0x1d4)];console[_0x3423a6(0x1de)](_0x3423a6(0x1d6)+_0x283b4d[_0x3423a6(0x1d3)]+_0x3423a6(0x1e6)+(_0x283b4d[_0x3423a6(0x1d3)]!==0x1?'s':''));if(_0x1d989a[_0x3423a6(0x1e5)]||_0x1d989a[_0x3423a6(0x1cd)])return await handleSDKOutput(_0x283b4d,_0x1d989a),0x0;return displayFieldsHumanReadable(_0x283b4d,_0xe58bf8),0x0;}}
1
+ const a37_0x156623=a37_0x5027;(function(_0x2aa432,_0x448970){const _0x464497=a37_0x5027,_0x4a3290=_0x2aa432();while(!![]){try{const _0x2e0953=-parseInt(_0x464497(0x104))/0x1*(-parseInt(_0x464497(0x10d))/0x2)+-parseInt(_0x464497(0x113))/0x3+parseInt(_0x464497(0x121))/0x4+parseInt(_0x464497(0x10a))/0x5*(parseInt(_0x464497(0x111))/0x6)+parseInt(_0x464497(0x110))/0x7+-parseInt(_0x464497(0x112))/0x8+-parseInt(_0x464497(0x109))/0x9*(parseInt(_0x464497(0x11c))/0xa);if(_0x2e0953===_0x448970)break;else _0x4a3290['push'](_0x4a3290['shift']());}catch(_0x33df40){_0x4a3290['push'](_0x4a3290['shift']());}}}(a37_0x35f0,0xe7d6f));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a37_0x35f0(){const _0x802d25=['\x27...','Parent\x20segment:\x20','2uXqCpz','length','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','12164292gHftcd','6738954TjrncA','8782360ujAucq','3258339lSojal','\x20field','data','name','error','Error:\x20Parent\x20segment\x20name\x20is\x20required','listFields','Listing\x20fields\x20for\x20\x27','verbose','70780XooYao','description','Site:\x20','parentSegment','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','5410796taNRdA','site','859281wqJUSf','List\x20available\x20fields\x20for\x20segmentation','✔\x20Found\x20','jsonl','segment:fields','2466NQtZBX','5agNNmV'];a37_0x35f0=function(){return _0x802d25;};return a37_0x35f0();}function a37_0x5027(_0x84f323,_0x198196){_0x84f323=_0x84f323-0x104;const _0x35f070=a37_0x35f0();let _0x502778=_0x35f070[_0x84f323];return _0x502778;}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a37_0x156623(0x116)]=a37_0x156623(0x108);[a37_0x156623(0x11d)]=a37_0x156623(0x105);async['execute'](_0xe4dd87){const _0xae7721=a37_0x156623,{options:_0x997b5,args:_0x376249,tdx:_0x237a24}=_0xe4dd87,_0x40d46a=_0x376249[0x0]||_0x997b5[_0xae7721(0x11f)];if(!_0x40d46a)return console[_0xae7721(0x117)](_0xae7721(0x118)),console[_0xae7721(0x117)](_0xae7721(0x10f)),console['error'](_0xae7721(0x120)),0x1;_0x997b5[_0xae7721(0x11b)]&&(console[_0xae7721(0x117)](_0xae7721(0x11e)+_0x997b5[_0xae7721(0x122)]),console[_0xae7721(0x117)](_0xae7721(0x10c)+_0x40d46a));const _0x298e80=await withSpinner(_0xae7721(0x11a)+_0x40d46a+_0xae7721(0x10b),()=>_0x237a24['segment'][_0xae7721(0x119)](_0x40d46a),{'verbose':_0x997b5[_0xae7721(0x11b)]}),_0xf8e003=_0x298e80[_0xae7721(0x115)];console['error'](_0xae7721(0x106)+_0xf8e003[_0xae7721(0x10e)]+_0xae7721(0x114)+(_0xf8e003[_0xae7721(0x10e)]!==0x1?'s':''));if(_0x997b5['json']||_0x997b5[_0xae7721(0x107)])return await handleSDKOutput(_0xf8e003,_0x997b5),0x0;return displayFieldsHumanReadable(_0xf8e003,_0x40d46a),0x0;}}
@@ -1 +1 @@
1
- const a37_0x381668=a37_0x42f4;function a37_0x42f4(_0x13e886,_0x40e102){_0x13e886=_0x13e886-0xe9;const _0x1000a9=a37_0x1000();let _0x42f4f8=_0x1000a9[_0x13e886];return _0x42f4f8;}(function(_0x1aed49,_0x216434){const _0x20da25=a37_0x42f4,_0x54fc0f=_0x1aed49();while(!![]){try{const _0x245e1=-parseInt(_0x20da25(0x133))/0x1+-parseInt(_0x20da25(0xf8))/0x2*(-parseInt(_0x20da25(0x113))/0x3)+parseInt(_0x20da25(0x10d))/0x4*(parseInt(_0x20da25(0xf4))/0x5)+parseInt(_0x20da25(0x126))/0x6*(parseInt(_0x20da25(0x130))/0x7)+parseInt(_0x20da25(0x11c))/0x8+parseInt(_0x20da25(0xf0))/0x9+-parseInt(_0x20da25(0x12e))/0xa;if(_0x245e1===_0x216434)break;else _0x54fc0f['push'](_0x54fc0f['shift']());}catch(_0x1aa086){_0x54fc0f['push'](_0x54fc0f['shift']());}}}(a37_0x1000,0x40592));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 a37_0x16d262 from'chalk';function a37_0x1000(){const _0x1663d7=['name','filter','resourceName','✔\x20All\x20files\x20are\x20up\x20to\x20date','journeys','targetDir','repeat','dim','isNew','description','-\x20no\x20files\x20written','\x20\x20Target:\x20','type','segment','Write\x20','segment:pull','message','session','152QNKJcK','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)','Parent\x20segment:\x20','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','\x20changed\x20files','parentName','892959MgnEqd','no_parent','counts','data','file','\x20=\x20','Target\x20resource:\x20','execute','\x20journeys','1822776fAdVYS','parent_segment','\x0aPull\x20summary\x20for\x20\x27','dryRun','\x20files?','\x0aError:','\x27...','parentSegment','\x20activations','\x20new\x20files','6jJiSJm','\x20files\x20to\x20','setPhase','cwd','dirname','helpText','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','\x20versions)','12231530PzYhbB','yellow','3145646hiSTee','error','\x20\x20🗺️\x20\x20','130684SNPlhq','Aborted.','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','length','journeyVersions','Pulling\x20segments\x20from\x20\x27','green','red','pullSegments','verbose','cyan','✔\x20Context\x20set:\x20','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','utf-8','content','hasChanges','Site:\x20','errorCode','\x20segments','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','2586087UKHrLk','\x20with\x20','files','absolutePath','46735rAlCuD','yes','diff','\x20\x20🎯\x20','2DuQVVt','segments','\x0aChanges\x20to\x20\x27'];a37_0x1000=function(){return _0x1663d7;};return a37_0x1000();}import{existsSync,mkdirSync,writeFileSync}from'fs';import a37_0x886f5a 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{[a37_0x381668(0xfb)]=a37_0x381668(0x10a);[a37_0x381668(0x104)]=a37_0x381668(0x12c);async[a37_0x381668(0x11a)](_0x14ae26){const _0x33cf82=a37_0x381668,{options:_0x449c43,args:_0x5ec407,tdx:_0x32f0f4}=_0x14ae26,_0x214a9e=_0x449c43,_0x3a451b=await resolveTarget({'arg':_0x5ec407[0x0],'contextParent':_0x449c43[_0x33cf82(0x123)],'cwd':process[_0x33cf82(0x129)]()});if(!isSuccessfulResolution(_0x3a451b))return _0x3a451b[_0x33cf82(0xed)]===_0x33cf82(0x114)?(console[_0x33cf82(0x131)](a37_0x16d262[_0x33cf82(0x12f)](_0x33cf82(0x135))),console[_0x33cf82(0x131)](_0x33cf82(0x10e)),console[_0x33cf82(0x131)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent'),console[_0x33cf82(0x131)]('\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[_0x33cf82(0x131)](a37_0x16d262[_0x33cf82(0x13a)]('Error:\x20'+_0x3a451b[_0x33cf82(0x10b)]+'\x0a')),_0x3a451b[_0x33cf82(0x12b)]&&console[_0x33cf82(0x131)](a37_0x16d262['cyan'](_0x3a451b[_0x33cf82(0x12b)]))),0x1;const _0x49f6bc=_0x3a451b[_0x33cf82(0x112)],_0x2eb4dd=_0x3a451b[_0x33cf82(0x100)],_0x1fcc36=_0x3a451b[_0x33cf82(0x107)]===_0x33cf82(0x117)?_0x3a451b[_0x33cf82(0xfd)]:undefined;_0x214a9e[_0x33cf82(0x13c)]&&(console[_0x33cf82(0x131)](_0x33cf82(0xec)+_0x214a9e['site']),console[_0x33cf82(0x131)](_0x33cf82(0x10f)+_0x49f6bc),_0x1fcc36&&console[_0x33cf82(0x131)](_0x33cf82(0x119)+_0x1fcc36));const _0x291c48=await withProgressSpinner(_0x33cf82(0x138)+_0x49f6bc+_0x33cf82(0x122),_0x5fb037=>_0x32f0f4[_0x33cf82(0x108)][_0x33cf82(0x13b)](_0x49f6bc,{'targetDir':_0x2eb4dd,'targetResourceName':_0x1fcc36,'verbose':_0x214a9e[_0x33cf82(0x13c)],'progress':{'update':_0x391b98=>{const _0x177aa6=_0x33cf82;_0x5fb037[_0x177aa6(0x128)](_0x391b98),_0x214a9e[_0x177aa6(0x13c)]&&console['error']('\x20\x20'+_0x391b98);}}}),{'verbose':_0x214a9e[_0x33cf82(0x13c)]}),_0x473221=_0x291c48[_0x33cf82(0x116)];if(_0x473221[_0x33cf82(0x115)]['segments']===0x0&&_0x473221[_0x33cf82(0x115)][_0x33cf82(0xff)]===0x0)return console['error'](a37_0x16d262['yellow'](_0x33cf82(0x110)+_0x473221[_0x33cf82(0x112)]+'\x27')),0x0;const _0xdf21cd=_0x473221[_0x33cf82(0xf2)][_0x33cf82(0xfc)](_0x434c0c=>_0x434c0c[_0x33cf82(0x103)]),_0x5e1657=_0x473221[_0x33cf82(0xf2)][_0x33cf82(0xfc)](_0x40ea92=>!_0x40ea92[_0x33cf82(0x103)]&&_0x40ea92['hasChanges']),_0x54c15e=_0x473221[_0x33cf82(0xf2)][_0x33cf82(0xfc)](_0x49003f=>!_0x49003f['isNew']&&!_0x49003f[_0x33cf82(0xeb)]);console[_0x33cf82(0x131)](_0x33cf82(0x11e)+_0x473221['parentName']+'\x27:'),console[_0x33cf82(0x131)](_0x33cf82(0xf7)+a37_0x16d262[_0x33cf82(0x13d)](_0x473221[_0x33cf82(0x115)][_0x33cf82(0xf9)]+_0x33cf82(0xee))+_0x33cf82(0xf1)+a37_0x16d262['cyan'](_0x473221['counts']['activations']+_0x33cf82(0x124)));if(_0x473221[_0x33cf82(0x115)][_0x33cf82(0xff)]>0x0){const _0x38c961=_0x473221[_0x33cf82(0x115)]['journeyVersions']>_0x473221[_0x33cf82(0x115)]['journeys']?'\x20('+_0x473221[_0x33cf82(0x115)][_0x33cf82(0x137)]+_0x33cf82(0x12d):'';console[_0x33cf82(0x131)](_0x33cf82(0x132)+a37_0x16d262[_0x33cf82(0x13d)](_0x473221['counts'][_0x33cf82(0xff)]+_0x33cf82(0x11b))+a37_0x16d262[_0x33cf82(0x102)](_0x38c961));}console[_0x33cf82(0x131)]('\x20\x20'+a37_0x16d262['green']('+\x20'+_0xdf21cd['length']+_0x33cf82(0x125))),console[_0x33cf82(0x131)]('\x20\x20'+a37_0x16d262[_0x33cf82(0x12f)]('~\x20'+_0x5e1657[_0x33cf82(0x136)]+_0x33cf82(0x111))),console[_0x33cf82(0x131)]('\x20\x20'+a37_0x16d262[_0x33cf82(0x102)]('=\x20'+_0x54c15e[_0x33cf82(0x136)]+'\x20unchanged\x20files')),console[_0x33cf82(0x131)](_0x33cf82(0x106)+a37_0x16d262[_0x33cf82(0x13d)](_0x473221['targetDir'])+'\x0a');if(_0x5e1657[_0x33cf82(0x136)]>0x0)for(const _0x15d2d4 of _0x5e1657){console['error'](_0x33cf82(0xfa)+_0x15d2d4['relativePath']+'\x27:'),console['error']('─'[_0x33cf82(0x101)](0x3c)),console[_0x33cf82(0x131)](_0x15d2d4[_0x33cf82(0xf6)]),console[_0x33cf82(0x131)]('─'[_0x33cf82(0x101)](0x3c));}if(_0x214a9e[_0x33cf82(0x11f)])return console[_0x33cf82(0x131)](a37_0x16d262[_0x33cf82(0x12f)](_0x33cf82(0x13f))),0x0;if(_0xdf21cd[_0x33cf82(0x136)]===0x0&&_0x5e1657[_0x33cf82(0x136)]===0x0)return console[_0x33cf82(0x131)](a37_0x16d262['green'](_0x33cf82(0xfe))),saveSessionContext({'parent_segment':_0x473221[_0x33cf82(0x112)]},_0x214a9e[_0x33cf82(0x10c)]),console[_0x33cf82(0x131)](a37_0x16d262[_0x33cf82(0x139)]('✔\x20Context\x20set:\x20'+a37_0x16d262['dim'](_0x33cf82(0x11d))+_0x33cf82(0x118)+a37_0x16d262[_0x33cf82(0x13d)](_0x473221[_0x33cf82(0x112)]))),0x0;if(!_0x214a9e[_0x33cf82(0xf5)]){if(!isInteractive())return console[_0x33cf82(0x131)](a37_0x16d262['red'](_0x33cf82(0x121)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x33cf82(0x131)](a37_0x16d262[_0x33cf82(0x102)](_0x33cf82(0xef))),0x1;const _0x44c9f4=await confirmKey(_0x33cf82(0x109)+(_0xdf21cd[_0x33cf82(0x136)]+_0x5e1657[_0x33cf82(0x136)])+_0x33cf82(0x120));if(!_0x44c9f4)return console['error'](a37_0x16d262['yellow'](_0x33cf82(0x134)),_0x33cf82(0x105)),0x1;}for(const _0x518cb2 of _0x473221[_0x33cf82(0xf2)]){if(_0x518cb2[_0x33cf82(0x103)]||_0x518cb2[_0x33cf82(0xeb)]){const _0x5080b1=a37_0x886f5a[_0x33cf82(0x12a)](_0x518cb2[_0x33cf82(0xf3)]);!existsSync(_0x5080b1)&&mkdirSync(_0x5080b1,{'recursive':!![]}),writeFileSync(_0x518cb2[_0x33cf82(0xf3)],_0x518cb2[_0x33cf82(0xea)],_0x33cf82(0xe9));}}return console[_0x33cf82(0x131)](a37_0x16d262[_0x33cf82(0x139)]('✔\x20Pulled\x20'+(_0xdf21cd[_0x33cf82(0x136)]+_0x5e1657['length'])+_0x33cf82(0x127)+_0x473221['targetDir'])),saveSessionContext({'parent_segment':_0x473221[_0x33cf82(0x112)]},_0x214a9e[_0x33cf82(0x10c)]),console['error'](a37_0x16d262[_0x33cf82(0x139)](_0x33cf82(0x13e)+a37_0x16d262[_0x33cf82(0x102)](_0x33cf82(0x11d))+_0x33cf82(0x118)+a37_0x16d262[_0x33cf82(0x13d)](_0x473221[_0x33cf82(0x112)]))),0x0;}}
1
+ const a38_0x4d3b1f=a38_0xb1bb;(function(_0x16e3b3,_0x31bb31){const _0x6d9cd8=a38_0xb1bb,_0x12513f=_0x16e3b3();while(!![]){try{const _0x157650=parseInt(_0x6d9cd8(0x1e8))/0x1*(-parseInt(_0x6d9cd8(0x1ec))/0x2)+-parseInt(_0x6d9cd8(0x1e0))/0x3*(parseInt(_0x6d9cd8(0x20c))/0x4)+-parseInt(_0x6d9cd8(0x1fc))/0x5*(parseInt(_0x6d9cd8(0x202))/0x6)+-parseInt(_0x6d9cd8(0x207))/0x7*(-parseInt(_0x6d9cd8(0x1f0))/0x8)+-parseInt(_0x6d9cd8(0x216))/0x9*(parseInt(_0x6d9cd8(0x21a))/0xa)+-parseInt(_0x6d9cd8(0x1c9))/0xb+-parseInt(_0x6d9cd8(0x1f9))/0xc*(-parseInt(_0x6d9cd8(0x21b))/0xd);if(_0x157650===_0x31bb31)break;else _0x12513f['push'](_0x12513f['shift']());}catch(_0x4e3d93){_0x12513f['push'](_0x12513f['shift']());}}}(a38_0x1d48,0x6b07e));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a38_0x3af7d2 from'chalk';function a38_0x1d48(){const _0x4ffce6=['\x0aPull\x20summary\x20for\x20\x27','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','\x20unchanged\x20files','3085810vFzSJc','13Xtiaoo','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','dryRun','files','1351889zXadAD','red','Site:\x20','segments','✔\x20All\x20files\x20are\x20up\x20to\x20date','session','error','\x27...','targetDir','repeat','site','dirname','file','\x20files?','message','execute','Pulling\x20segments\x20from\x20\x27','resourceName','relativePath','Aborted.','name','\x20journeys','segment:pull','5949vfHhIg','green','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','dim','\x0aError:','\x20activations','\x20changed\x20files','segment','438106rISGzW','yellow','\x20\x20🎯\x20','\x20=\x20','4dLXSDD','counts','activations','type','2123344RMGqMz','journeys','absolutePath','data','\x20\x20🗺️\x20\x20','\x0aChanges\x20to\x20\x27','parent_segment','hasChanges','yes','27418548cTEEuV','cyan','no_parent','15EmWRyC','\x20with\x20','Write\x20','\x20segments','length','content','18048AyuUls','helpText','\x20\x20Target:\x20','setPhase','isNew','7PmVaeG','Parent\x20segment:\x20','filter','pullSegments','Error:\x20','1604gwxxEb','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','journeyVersions','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','diff','errorCode','parentSegment','Target\x20resource:\x20','parentName','verbose','9uRCunC'];a38_0x1d48=function(){return _0x4ffce6;};return a38_0x1d48();}import{existsSync,mkdirSync,writeFileSync}from'fs';function a38_0xb1bb(_0x3c657c,_0x3ff6fa){_0x3c657c=_0x3c657c-0x1c6;const _0x1d48cd=a38_0x1d48();let _0xb1bbd9=_0x1d48cd[_0x3c657c];return _0xb1bbd9;}import a38_0x553518 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{[a38_0x4d3b1f(0x1dd)]=a38_0x4d3b1f(0x1df);['description']='Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files';async[a38_0x4d3b1f(0x1d8)](_0x47f914){const _0x584dbf=a38_0x4d3b1f,{options:_0x40d080,args:_0xbe5f77,tdx:_0x5ca24d}=_0x47f914,_0x4ce712=_0x40d080,_0x2b2990=await resolveTarget({'arg':_0xbe5f77[0x0],'contextParent':_0x40d080[_0x584dbf(0x212)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x2b2990))return _0x2b2990[_0x584dbf(0x211)]===_0x584dbf(0x1fb)?(console[_0x584dbf(0x1cf)](a38_0x3af7d2[_0x584dbf(0x1e9)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console['error']('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['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent'),console[_0x584dbf(0x1cf)](_0x584dbf(0x20f))):(console['error'](a38_0x3af7d2[_0x584dbf(0x1ca)](_0x584dbf(0x20b)+_0x2b2990[_0x584dbf(0x1d7)]+'\x0a')),_0x2b2990[_0x584dbf(0x203)]&&console['error'](a38_0x3af7d2['cyan'](_0x2b2990['helpText']))),0x1;const _0x3f8a0e=_0x2b2990[_0x584dbf(0x214)],_0x39ebd9=_0x2b2990[_0x584dbf(0x1d1)],_0x137882=_0x2b2990[_0x584dbf(0x1ef)]===_0x584dbf(0x1d5)?_0x2b2990[_0x584dbf(0x1da)]:undefined;_0x4ce712[_0x584dbf(0x215)]&&(console[_0x584dbf(0x1cf)](_0x584dbf(0x1cb)+_0x4ce712[_0x584dbf(0x1d3)]),console[_0x584dbf(0x1cf)](_0x584dbf(0x208)+_0x3f8a0e),_0x137882&&console[_0x584dbf(0x1cf)](_0x584dbf(0x213)+_0x137882));const _0x485ddd=await withProgressSpinner(_0x584dbf(0x1d9)+_0x3f8a0e+_0x584dbf(0x1d0),_0x53846c=>_0x5ca24d[_0x584dbf(0x1e7)][_0x584dbf(0x20a)](_0x3f8a0e,{'targetDir':_0x39ebd9,'targetResourceName':_0x137882,'verbose':_0x4ce712[_0x584dbf(0x215)],'progress':{'update':_0x45ab98=>{const _0x19060b=_0x584dbf;_0x53846c[_0x19060b(0x205)](_0x45ab98),_0x4ce712['verbose']&&console[_0x19060b(0x1cf)]('\x20\x20'+_0x45ab98);}}}),{'verbose':_0x4ce712[_0x584dbf(0x215)]}),_0x37b4f6=_0x485ddd[_0x584dbf(0x1f3)];if(_0x37b4f6[_0x584dbf(0x1ed)][_0x584dbf(0x1cc)]===0x0&&_0x37b4f6['counts']['journeys']===0x0)return console[_0x584dbf(0x1cf)](a38_0x3af7d2[_0x584dbf(0x1e9)](_0x584dbf(0x218)+_0x37b4f6[_0x584dbf(0x214)]+'\x27')),0x0;const _0x2fb4d9=_0x37b4f6[_0x584dbf(0x1c8)][_0x584dbf(0x209)](_0x323d8a=>_0x323d8a[_0x584dbf(0x206)]),_0x1dc463=_0x37b4f6[_0x584dbf(0x1c8)][_0x584dbf(0x209)](_0x3b4ce0=>!_0x3b4ce0[_0x584dbf(0x206)]&&_0x3b4ce0[_0x584dbf(0x1f7)]),_0x2d86c7=_0x37b4f6['files'][_0x584dbf(0x209)](_0x3eb1fc=>!_0x3eb1fc[_0x584dbf(0x206)]&&!_0x3eb1fc[_0x584dbf(0x1f7)]);console[_0x584dbf(0x1cf)](_0x584dbf(0x217)+_0x37b4f6['parentName']+'\x27:'),console[_0x584dbf(0x1cf)](_0x584dbf(0x1ea)+a38_0x3af7d2['cyan'](_0x37b4f6[_0x584dbf(0x1ed)][_0x584dbf(0x1cc)]+_0x584dbf(0x1ff))+_0x584dbf(0x1fd)+a38_0x3af7d2[_0x584dbf(0x1fa)](_0x37b4f6['counts'][_0x584dbf(0x1ee)]+_0x584dbf(0x1e5)));if(_0x37b4f6['counts']['journeys']>0x0){const _0x2211c1=_0x37b4f6[_0x584dbf(0x1ed)][_0x584dbf(0x20e)]>_0x37b4f6['counts'][_0x584dbf(0x1f1)]?'\x20('+_0x37b4f6[_0x584dbf(0x1ed)][_0x584dbf(0x20e)]+'\x20versions)':'';console['error'](_0x584dbf(0x1f4)+a38_0x3af7d2[_0x584dbf(0x1fa)](_0x37b4f6['counts']['journeys']+_0x584dbf(0x1de))+a38_0x3af7d2[_0x584dbf(0x1e3)](_0x2211c1));}console['error']('\x20\x20'+a38_0x3af7d2['green']('+\x20'+_0x2fb4d9[_0x584dbf(0x200)]+'\x20new\x20files')),console[_0x584dbf(0x1cf)]('\x20\x20'+a38_0x3af7d2[_0x584dbf(0x1e9)]('~\x20'+_0x1dc463[_0x584dbf(0x200)]+_0x584dbf(0x1e6))),console[_0x584dbf(0x1cf)]('\x20\x20'+a38_0x3af7d2[_0x584dbf(0x1e3)]('=\x20'+_0x2d86c7[_0x584dbf(0x200)]+_0x584dbf(0x219))),console[_0x584dbf(0x1cf)](_0x584dbf(0x204)+a38_0x3af7d2['cyan'](_0x37b4f6[_0x584dbf(0x1d1)])+'\x0a');if(_0x1dc463[_0x584dbf(0x200)]>0x0)for(const _0x32e95e of _0x1dc463){console[_0x584dbf(0x1cf)](_0x584dbf(0x1f5)+_0x32e95e[_0x584dbf(0x1db)]+'\x27:'),console[_0x584dbf(0x1cf)]('─'[_0x584dbf(0x1d2)](0x3c)),console['error'](_0x32e95e[_0x584dbf(0x210)]),console[_0x584dbf(0x1cf)]('─'[_0x584dbf(0x1d2)](0x3c));}if(_0x4ce712[_0x584dbf(0x1c7)])return console['error'](a38_0x3af7d2['yellow'](_0x584dbf(0x1e2))),0x0;if(_0x2fb4d9['length']===0x0&&_0x1dc463[_0x584dbf(0x200)]===0x0)return console[_0x584dbf(0x1cf)](a38_0x3af7d2['green'](_0x584dbf(0x1cd))),saveSessionContext({'parent_segment':_0x37b4f6[_0x584dbf(0x214)]},_0x4ce712[_0x584dbf(0x1ce)]),console[_0x584dbf(0x1cf)](a38_0x3af7d2[_0x584dbf(0x1e1)]('✔\x20Context\x20set:\x20'+a38_0x3af7d2[_0x584dbf(0x1e3)](_0x584dbf(0x1f6))+_0x584dbf(0x1eb)+a38_0x3af7d2[_0x584dbf(0x1fa)](_0x37b4f6[_0x584dbf(0x214)]))),0x0;if(!_0x4ce712[_0x584dbf(0x1f8)]){if(!isInteractive())return console[_0x584dbf(0x1cf)](a38_0x3af7d2[_0x584dbf(0x1ca)](_0x584dbf(0x1e4)),_0x584dbf(0x1c6)),console[_0x584dbf(0x1cf)](a38_0x3af7d2[_0x584dbf(0x1e3)](_0x584dbf(0x20d))),0x1;const _0xa24ed6=await confirmKey(_0x584dbf(0x1fe)+(_0x2fb4d9[_0x584dbf(0x200)]+_0x1dc463[_0x584dbf(0x200)])+_0x584dbf(0x1d6));if(!_0xa24ed6)return console[_0x584dbf(0x1cf)](a38_0x3af7d2['yellow'](_0x584dbf(0x1dc)),'-\x20no\x20files\x20written'),0x1;}for(const _0x1a3cb0 of _0x37b4f6[_0x584dbf(0x1c8)]){if(_0x1a3cb0[_0x584dbf(0x206)]||_0x1a3cb0[_0x584dbf(0x1f7)]){const _0x2c82fb=a38_0x553518[_0x584dbf(0x1d4)](_0x1a3cb0[_0x584dbf(0x1f2)]);!existsSync(_0x2c82fb)&&mkdirSync(_0x2c82fb,{'recursive':!![]}),writeFileSync(_0x1a3cb0[_0x584dbf(0x1f2)],_0x1a3cb0[_0x584dbf(0x201)],'utf-8');}}return console['error'](a38_0x3af7d2[_0x584dbf(0x1e1)]('✔\x20Pulled\x20'+(_0x2fb4d9[_0x584dbf(0x200)]+_0x1dc463[_0x584dbf(0x200)])+'\x20files\x20to\x20'+_0x37b4f6[_0x584dbf(0x1d1)])),saveSessionContext({'parent_segment':_0x37b4f6['parentName']},_0x4ce712[_0x584dbf(0x1ce)]),console[_0x584dbf(0x1cf)](a38_0x3af7d2[_0x584dbf(0x1e1)]('✔\x20Context\x20set:\x20'+a38_0x3af7d2[_0x584dbf(0x1e3)](_0x584dbf(0x1f6))+_0x584dbf(0x1eb)+a38_0x3af7d2[_0x584dbf(0x1fa)](_0x37b4f6[_0x584dbf(0x214)]))),0x0;}}