@treasuredata/tdx 0.14.0 → 0.14.2

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 (165) 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/api-command.js +1 -1
  10. package/dist/commands/api-command.js.map +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.d.ts +1 -0
  14. package/dist/commands/claude-command.d.ts.map +1 -1
  15. package/dist/commands/claude-command.js +1 -1
  16. package/dist/commands/claude-command.js.map +1 -1
  17. package/dist/commands/claude-statusline-command.js +1 -1
  18. package/dist/commands/claude-usage-command.js +1 -1
  19. package/dist/commands/command.js +1 -1
  20. package/dist/commands/connection-command.js +1 -1
  21. package/dist/commands/databases.js +1 -1
  22. package/dist/commands/describe.js +1 -1
  23. package/dist/commands/engage-command.js +1 -1
  24. package/dist/commands/job-command.js +1 -1
  25. package/dist/commands/journey-command.js +1 -1
  26. package/dist/commands/journey-validate-command.js +1 -1
  27. package/dist/commands/llm-command.js +1 -1
  28. package/dist/commands/llm-proxy.js +1 -1
  29. package/dist/commands/parent-segment-command.js +1 -1
  30. package/dist/commands/profile-command.d.ts +3 -4
  31. package/dist/commands/profile-command.d.ts.map +1 -1
  32. package/dist/commands/profile-command.js +1 -1
  33. package/dist/commands/profile-command.js.map +1 -1
  34. package/dist/commands/profiles-command.js +1 -1
  35. package/dist/commands/query-command.js +1 -1
  36. package/dist/commands/segment-command.js +1 -1
  37. package/dist/commands/segment-create-command.js +1 -1
  38. package/dist/commands/segment-fields-command.js +1 -1
  39. package/dist/commands/segment-pull-command.js +1 -1
  40. package/dist/commands/segment-push-command.js +1 -1
  41. package/dist/commands/segment-update-command.js +1 -1
  42. package/dist/commands/segment-use-command.js +1 -1
  43. package/dist/commands/segment-validate-command.js +1 -1
  44. package/dist/commands/segments.js +1 -1
  45. package/dist/commands/show.js +1 -1
  46. package/dist/commands/tables.js +1 -1
  47. package/dist/commands/use-command.js +1 -1
  48. package/dist/commands/user-command.js +1 -1
  49. package/dist/commands/workflow-command.js +1 -1
  50. package/dist/core/auth.js +1 -1
  51. package/dist/core/command-output.js +1 -1
  52. package/dist/core/config.js +1 -1
  53. package/dist/core/connection-cache.js +1 -1
  54. package/dist/core/constants.js +1 -1
  55. package/dist/core/credential-cache.js +1 -1
  56. package/dist/core/global-context.js +1 -1
  57. package/dist/core/keychain.js +1 -1
  58. package/dist/core/profile.js +1 -1
  59. package/dist/core/project-config.js +1 -1
  60. package/dist/core/session.js +1 -1
  61. package/dist/core/user-cache.js +1 -1
  62. package/dist/core/version.js +1 -1
  63. package/dist/index.js +1 -1
  64. package/dist/proxy/anthropic-adapter.js +1 -1
  65. package/dist/proxy/claude-usage-tracker.d.ts +2 -0
  66. package/dist/proxy/claude-usage-tracker.d.ts.map +1 -1
  67. package/dist/proxy/claude-usage-tracker.js +1 -1
  68. package/dist/proxy/claude-usage-tracker.js.map +1 -1
  69. package/dist/proxy/context-signature.js +1 -1
  70. package/dist/proxy/conversation-utils.js +1 -1
  71. package/dist/proxy/passthrough-server.d.ts +86 -0
  72. package/dist/proxy/passthrough-server.d.ts.map +1 -0
  73. package/dist/proxy/passthrough-server.js +1 -0
  74. package/dist/proxy/passthrough-server.js.map +1 -0
  75. package/dist/proxy/server.js +1 -1
  76. package/dist/proxy/session-cache.js +1 -1
  77. package/dist/proxy/sse-usage-parser.d.ts +99 -0
  78. package/dist/proxy/sse-usage-parser.d.ts.map +1 -0
  79. package/dist/proxy/sse-usage-parser.js +1 -0
  80. package/dist/proxy/sse-usage-parser.js.map +1 -0
  81. package/dist/sdk/agent/agent-config.js +1 -1
  82. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  83. package/dist/sdk/agent/agent-yaml.js +1 -1
  84. package/dist/sdk/api.js +1 -1
  85. package/dist/sdk/client/cdp-api-client.js +1 -1
  86. package/dist/sdk/client/endpoints.d.ts +5 -0
  87. package/dist/sdk/client/endpoints.d.ts.map +1 -1
  88. package/dist/sdk/client/endpoints.js +1 -1
  89. package/dist/sdk/client/endpoints.js.map +1 -1
  90. package/dist/sdk/client/engage-api-client.js +1 -1
  91. package/dist/sdk/client/http-client.js +1 -1
  92. package/dist/sdk/client/llm-api-client.js +1 -1
  93. package/dist/sdk/client/rate-limiter.js +1 -1
  94. package/dist/sdk/client/td-api-client.js +1 -1
  95. package/dist/sdk/client/trino-api-client.js +1 -1
  96. package/dist/sdk/client/workflow-client.js +1 -1
  97. package/dist/sdk/connection-validator.js +1 -1
  98. package/dist/sdk/connection.js +1 -1
  99. package/dist/sdk/engage.js +1 -1
  100. package/dist/sdk/errors.js +1 -1
  101. package/dist/sdk/index.js +1 -1
  102. package/dist/sdk/io/index.js +1 -1
  103. package/dist/sdk/io/node-filesystem.js +1 -1
  104. package/dist/sdk/job.js +1 -1
  105. package/dist/sdk/journey.js +1 -1
  106. package/dist/sdk/llm/chat-cache.js +1 -1
  107. package/dist/sdk/llm/index.js +1 -1
  108. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  109. package/dist/sdk/llm/model-aliases.js +1 -1
  110. package/dist/sdk/llm/model-factors.js +1 -1
  111. package/dist/sdk/query/index.js +1 -1
  112. package/dist/sdk/query/sql-parser.js +1 -1
  113. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  114. package/dist/sdk/segment/fields-display.js +1 -1
  115. package/dist/sdk/segment/file-discovery.js +1 -1
  116. package/dist/sdk/segment/journey-utils.js +1 -1
  117. package/dist/sdk/segment/journey-yaml.js +1 -1
  118. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  119. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  120. package/dist/sdk/segment/pull-workflow.js +1 -1
  121. package/dist/sdk/segment/push-workflow.js +1 -1
  122. package/dist/sdk/segment/resolution-context.js +1 -1
  123. package/dist/sdk/segment/segment-path-parser.js +1 -1
  124. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  125. package/dist/sdk/segment/target-resolution.js +1 -1
  126. package/dist/sdk/segment/tdx-config.js +1 -1
  127. package/dist/sdk/segment/validate-files.js +1 -1
  128. package/dist/sdk/segment/yaml-validator.js +1 -1
  129. package/dist/sdk/segment.js +1 -1
  130. package/dist/sdk/types/index.d.ts +1 -1
  131. package/dist/sdk/types/index.d.ts.map +1 -1
  132. package/dist/sdk/types/index.js +1 -1
  133. package/dist/sdk/types/progress.js +1 -1
  134. package/dist/sdk/user.js +1 -1
  135. package/dist/sdk/util/format-detector.js +1 -1
  136. package/dist/sdk/util/formatters.js +1 -1
  137. package/dist/sdk/util/index.js +1 -1
  138. package/dist/sdk/util/tree-formatter.js +1 -1
  139. package/dist/sdk/workflow/clone-workflow.js +1 -1
  140. package/dist/sdk/workflow/index.js +1 -1
  141. package/dist/sdk/workflow/pull-workflow.js +1 -1
  142. package/dist/sdk/workflow/push-workflow.d.ts.map +1 -1
  143. package/dist/sdk/workflow/push-workflow.js +1 -1
  144. package/dist/sdk/workflow/push-workflow.js.map +1 -1
  145. package/dist/sdk/workflow/tdx-config.js +1 -1
  146. package/dist/sdk/workflow/workflow-utils.d.ts +60 -0
  147. package/dist/sdk/workflow/workflow-utils.d.ts.map +1 -1
  148. package/dist/sdk/workflow/workflow-utils.js +1 -1
  149. package/dist/sdk/workflow/workflow-utils.js.map +1 -1
  150. package/dist/utils/async.js +1 -1
  151. package/dist/utils/colors.js +1 -1
  152. package/dist/utils/diff.js +1 -1
  153. package/dist/utils/file-permissions.js +1 -1
  154. package/dist/utils/json-loader.js +1 -1
  155. package/dist/utils/option-validation.js +1 -1
  156. package/dist/utils/port.js +1 -1
  157. package/dist/utils/process.js +1 -1
  158. package/dist/utils/prompt.js +1 -1
  159. package/dist/utils/spinner.js +1 -1
  160. package/dist/utils/sse-parser.js +1 -1
  161. package/dist/utils/string-utils.js +1 -1
  162. package/dist/utils/table-ref-parser.js +1 -1
  163. package/dist/utils/tdx-logger.js +1 -1
  164. package/dist/utils/version-check.js +1 -1
  165. package/package.json +2 -1
@@ -1 +1 @@
1
- const a25_0x51372c=a25_0x576d;(function(_0x5e13ef,_0x3d0335){const _0x2cebe0=a25_0x576d,_0x5d9921=_0x5e13ef();while(!![]){try{const _0x354abb=parseInt(_0x2cebe0(0x1e2))/0x1+parseInt(_0x2cebe0(0x1fa))/0x2+-parseInt(_0x2cebe0(0x1ad))/0x3*(parseInt(_0x2cebe0(0x1f8))/0x4)+parseInt(_0x2cebe0(0x18a))/0x5*(-parseInt(_0x2cebe0(0x195))/0x6)+-parseInt(_0x2cebe0(0x1ff))/0x7*(parseInt(_0x2cebe0(0x1ca))/0x8)+parseInt(_0x2cebe0(0x189))/0x9*(-parseInt(_0x2cebe0(0x17f))/0xa)+parseInt(_0x2cebe0(0x187))/0xb*(parseInt(_0x2cebe0(0x184))/0xc);if(_0x354abb===_0x3d0335)break;else _0x5d9921['push'](_0x5d9921['shift']());}catch(_0xa47837){_0x5d9921['push'](_0x5d9921['shift']());}}}(a25_0x2d9a,0x27d12));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';function a25_0x576d(_0x237b90,_0x5c1121){_0x237b90=_0x237b90-0x164;const _0x2d9a15=a25_0x2d9a();let _0x576d1e=_0x2d9a15[_0x237b90];return _0x576d1e;}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 a25_0x4b6697 from'chalk';function a25_0x2d9a(){const _0xcc5c28=['format','/e/','416770mcOFyh','execute','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','getParent','3926616TQCzqf','replace','Get\x20SQL\x20query\x20for\x20child\x20segment','11OlLPhb','includes','45VcCPrG','70FIjUIT','Resolved\x20type:\x20','SEGMENT_FOLDER_NOT_FOUND','segment:desc','Fetching\x20folder\x20details...','Show\x20segment\x20folder\x20details','Resolved\x20relative\x20path\x20to:\x20','Creating\x20folder\x20\x27','Show\x20segment\x20or\x20folder\x20details','folder','stats','14868TKaTQA','Resolved\x20YAML\x20file:\x20','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Error:\x20Parent\x20segment\x20name\x20is\x20required','Usage:\x20tdx\x20sg\x20sql\x20<name>','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','SQL\x20query:\x0a','✖\x20Query\x20failed\x20[','Segment\x20ID:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','getFolder','resolvePathToResource','setJobId','Parent\x20ID:\x20','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Fetching\x20segment\x20details...','getSegmentSQL','Usage:\x20tdx\x20sg\x20desc\x20<name>','message','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Target\x20path:\x20','segment:view','686439tgNLEN','\x20\x20Folder\x20path:\x20','SEGMENT_NOT_FOUND','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Show\x20folder\x20or\x20child\x20segment\x20details','Site:\x20','fullPath','Fetching\x20folder\x20\x27','Create\x20segment\x20folder\x20for\x20organization','listFolders','trim','createFolder','Examples:','segmentName','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Error:\x20','\x27...','getSegment','type','Folder\x20ID:\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','✔\x20Found\x20','log','Folder\x20name:\x20','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','SELECT\x20*\x20FROM\x20(\x0a','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','18704PIGUuN','segment:show','(root)','\x20Opening\x20','segmentPath','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','segment:folder:list','Error:\x20Folder\x20reference\x20is\x20required','segment:folder:show','code','Usage:\x20tdx\x20segment\x20describe\x20<path>','segment:describe','Parent\x20name:\x20','segmentId','jobId','\x20[Job\x20ID:\x20','url','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Use:\x20tdx\x20ps\x20view','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','limit','folderId','parent','291632xhMfzn','verbose','resolveFolderId','site','segment','parentId','Resolving\x20\x27','length','processedRows','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','\x27\x20with\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Fetching\x20SQL\x20for\x20segment...','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20Parent\x20segment:\x20','Parent\x20segment:\x20','segment:folder:create','data','INVALID_ARGUMENT','/app/ps/','\x20\x20Full\x20path:\x20','4KGOSQh','cause','509212hnvdSj','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','in\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','714fftFzR','web','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','\x20\x20Cause:\x20','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Resolving\x20parent\x20segment\x20\x27','jsonl','Usage:\x20tdx\x20sg\x20show\x20<name>','Folder\x20ID\x20missing\x20from\x20resolved\x20path','description','parentSegment','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Options:','Resolving\x20path\x20\x27','error','Resolving\x20folder\x20\x27','query','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Resolved\x20folder\x20ID:\x20','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','resolveParentId','name','toLocaleString','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Use:\x20tdx\x20ps\x20show'];a25_0x2d9a=function(){return _0xcc5c28;};return a25_0x2d9a();}async function resolveSegmentTarget(_0x91e1ce,_0x19b93d,_0x83f668){const _0xa78e39=a25_0x576d;if(isYamlFilePath(_0x91e1ce))try{const _0x2da7cc=await resolveYamlFilePath(_0x91e1ce);return _0x83f668&&(console[_0xa78e39(0x171)](_0xa78e39(0x196)+_0x91e1ce),console['error'](_0xa78e39(0x1f1)+_0x2da7cc[_0xa78e39(0x16d)]),console[_0xa78e39(0x171)]('\x20\x20Segment\x20name:\x20'+_0x2da7cc[_0xa78e39(0x1ba)]),console[_0xa78e39(0x171)](_0xa78e39(0x1ae)+(_0x2da7cc['folderPath']||_0xa78e39(0x1cc))),console[_0xa78e39(0x171)](_0xa78e39(0x1f7)+_0x2da7cc[_0xa78e39(0x1b3)])),_0x2da7cc[_0xa78e39(0x1b3)];}catch(_0xfebbe5){throw new SDKError(ErrorCode[_0xa78e39(0x1f5)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0xfebbe5[_0xa78e39(0x1a9)]);}if(!_0x19b93d)throw new SDKError(ErrorCode[_0xa78e39(0x1f5)],_0xa78e39(0x1c9));return _0x19b93d+'/'+_0x91e1ce;}export class SegmentDescribeCommand extends BaseCommand{['name']=a25_0x51372c(0x1d5);[a25_0x51372c(0x16c)]=a25_0x51372c(0x192);async[a25_0x51372c(0x180)](_0x45a417){const _0x128010=a25_0x51372c,{options:_0x2f2152,args:_0x3b8222,tdx:_0x42b344}=_0x45a417,_0x29aab5=_0x3b8222[0x0],_0x20f6ef=!_0x29aab5&&!!_0x2f2152['parentSegment'],_0x16a6d6=_0x29aab5||_0x2f2152[_0x128010(0x16d)];if(!_0x16a6d6)return console[_0x128010(0x171)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x128010(0x171)](_0x128010(0x1d4)),console[_0x128010(0x171)](_0x128010(0x1b9)),console[_0x128010(0x171)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console[_0x128010(0x171)](_0x128010(0x1bb)),console[_0x128010(0x171)](_0x128010(0x174)),console[_0x128010(0x171)](_0x128010(0x1dd)),0x1;try{const _0x3b438c=_0x2f2152[_0x128010(0x1ce)];let _0x3906ef=_0x16a6d6;!_0x20f6ef&&_0x3b438c&&!_0x16a6d6[_0x128010(0x188)]('/')&&(_0x3906ef=_0x3b438c+'/'+_0x16a6d6,_0x2f2152[_0x128010(0x1e3)]&&console[_0x128010(0x171)](_0x128010(0x190)+_0x3906ef));const _0x1d7656=await withSpinner(_0x128010(0x170)+_0x3906ef+_0x128010(0x1be),()=>_0x42b344[_0x128010(0x1e6)][_0x128010(0x1a2)](_0x3906ef),{'verbose':_0x2f2152[_0x128010(0x1e3)]}),_0x1de92f=_0x1d7656[_0x128010(0x1f4)];_0x2f2152[_0x128010(0x1e3)]&&(console['error'](_0x128010(0x18b)+_0x1de92f[_0x128010(0x1c0)]),console[_0x128010(0x171)](_0x128010(0x1a4)+_0x1de92f[_0x128010(0x1e7)]),_0x1de92f[_0x128010(0x1e0)]&&console[_0x128010(0x171)](_0x128010(0x1c1)+_0x1de92f['folderId']),_0x1de92f[_0x128010(0x1d7)]&&console['error'](_0x128010(0x19e)+_0x1de92f[_0x128010(0x1d7)]));if(_0x1de92f['type']===_0x128010(0x1e1)){const _0x5d0834=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x42b344[_0x128010(0x1e6)][_0x128010(0x183)](_0x1de92f[_0x128010(0x1e7)]),{'verbose':_0x2f2152[_0x128010(0x1e3)]});await handleSingleObjectOutput(_0x5d0834[_0x128010(0x1f4)],_0x2f2152);}else{if(_0x1de92f[_0x128010(0x1c0)]===_0x128010(0x193)){if(!_0x1de92f[_0x128010(0x1e0)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x6b6f1=await withSpinner(_0x128010(0x18e),()=>_0x42b344[_0x128010(0x1e6)][_0x128010(0x1a1)](_0x1de92f[_0x128010(0x1e0)]),{'verbose':_0x2f2152[_0x128010(0x1e3)]});await handleSingleObjectOutput(_0x6b6f1[_0x128010(0x1f4)],_0x2f2152);}else{if(_0x1de92f[_0x128010(0x1c0)]===_0x128010(0x1e6)){if(!_0x1de92f['segmentId'])throw new SDKError(ErrorCode[_0x128010(0x1af)],_0x128010(0x1b0));const _0x58a185=await withSpinner(_0x128010(0x1a6),()=>_0x42b344['segment'][_0x128010(0x1bf)](_0x1de92f[_0x128010(0x1e7)],_0x1de92f[_0x128010(0x1d7)]),{'verbose':_0x2f2152['verbose']});await handleSingleObjectOutput(_0x58a185[_0x128010(0x1f4)],_0x2f2152);}}}return 0x0;}catch(_0x2b9e1){if(_0x2b9e1 instanceof SDKError)return console['error']('Error:\x20'+_0x2b9e1['message']),_0x2b9e1[_0x128010(0x1f9)]&&console[_0x128010(0x171)](_0x128010(0x165)+_0x2b9e1[_0x128010(0x1f9)]),0x1;throw _0x2b9e1;}}}export class SegmentShowCommand extends BaseCommand{[a25_0x51372c(0x178)]=a25_0x51372c(0x1cb);[a25_0x51372c(0x16c)]=a25_0x51372c(0x16e);async['execute'](_0x2abea1){const _0x49c208=a25_0x51372c,{options:_0xbabf09,args:_0x434686,tdx:_0x5b12ba}=_0x2abea1,_0xc7dcb0=_0x434686[0x0];if(!_0xc7dcb0)return console[_0x49c208(0x171)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error'](_0x49c208(0x16a)),console['error'](_0x49c208(0x1ed)),console[_0x49c208(0x171)](_0x49c208(0x1b9)),console[_0x49c208(0x171)](_0x49c208(0x182)),console[_0x49c208(0x171)](_0x49c208(0x197)),0x1;try{const _0x478098=_0xbabf09[_0x49c208(0x16d)],_0xfc3e4c=await resolveSegmentTarget(_0xc7dcb0,_0x478098,_0xbabf09[_0x49c208(0x1e3)]);_0xbabf09[_0x49c208(0x1e3)]&&console[_0x49c208(0x171)](_0x49c208(0x1ab)+_0xfc3e4c);const _0x2365cb=await withSpinner(_0x49c208(0x1e8)+_0xc7dcb0+_0x49c208(0x1be),()=>_0x5b12ba[_0x49c208(0x1e6)][_0x49c208(0x1a2)](_0xfc3e4c),{'verbose':_0xbabf09[_0x49c208(0x1e3)]}),_0x730793=_0x2365cb[_0x49c208(0x1f4)];_0xbabf09['verbose']&&(console['error']('Resolved\x20type:\x20'+_0x730793['type']),console['error'](_0x49c208(0x1a4)+_0x730793['parentId']));if(_0x730793['type']==='folder')return console['error']('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0x49c208(0x171)](_0x49c208(0x1eb)),0x1;if(_0x730793[_0x49c208(0x1c0)]==='parent')return console[_0x49c208(0x171)](_0x49c208(0x1ef)),console['error'](_0x49c208(0x17c)),0x1;if(!_0x730793[_0x49c208(0x1d7)])throw new SDKError(ErrorCode[_0x49c208(0x1af)],_0x49c208(0x1b0));const _0x2f7bd6=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x5b12ba[_0x49c208(0x1e6)][_0x49c208(0x1a7)](_0x730793['parentId'],_0x730793[_0x49c208(0x1d7)]),{'verbose':_0xbabf09[_0x49c208(0x1e3)]});let _0xf919ab=_0x2f7bd6['data'];const _0x1cb878=resolveLimit(_0xbabf09[_0x49c208(0x1df)],DEFAULT_DISPLAY_LIMIT),_0x1916e7=/\bLIMIT\s+\d+/i['test'](_0xf919ab);!_0x1916e7&&(_0xf919ab=_0xf919ab[_0x49c208(0x1b7)]()[_0x49c208(0x185)](/;+$/,''),_0xf919ab=_0x49c208(0x1c8)+_0xf919ab+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x1cb878);_0xbabf09[_0x49c208(0x1e3)]&&console[_0x49c208(0x171)](_0x49c208(0x19c)+_0xf919ab);const _0x5503ca=await withProgressSpinner('Executing\x20segment\x20query...',async _0x1ccb1c=>{const _0x2a47ba=_0x49c208,_0x416909=await _0x5b12ba[_0x2a47ba(0x173)][_0x2a47ba(0x180)](_0xf919ab,{'catalog':'td','schema':'information_schema','onJobId':_0x76434c=>{const _0x1456d5=_0x2a47ba;_0x1ccb1c[_0x1456d5(0x1a3)](_0x76434c);}});return _0x416909;},{'verbose':_0xbabf09[_0x49c208(0x1e3)]}),_0x461cbc=_0x5503ca[_0x49c208(0x1f4)],_0x4f8042=_0x461cbc['jobId']?_0x49c208(0x1d9)+_0x461cbc[_0x49c208(0x1d8)]+']':'';return console['error']('✔\x20Query\x20completed:\x20Processed\x20'+_0x461cbc[_0x49c208(0x194)][_0x49c208(0x1ea)][_0x49c208(0x179)]()+'\x20rows\x20'+(_0x49c208(0x1fd)+formatElapsed(_0x461cbc[_0x49c208(0x194)]['elapsedTimeMillis'])+_0x4f8042)),await handleQueryOutput(_0x461cbc,_0xbabf09),0x0;}catch(_0xfe09b1){if(_0xfe09b1 instanceof SDKError)return console[_0x49c208(0x171)](_0x49c208(0x19d)+_0xfe09b1[_0x49c208(0x1d3)]+']'),console['error']('\x0a'+_0xfe09b1[_0x49c208(0x1a9)]),0x1;throw _0xfe09b1;}}}export class SegmentFolderListCommand extends BaseCommand{['name']=a25_0x51372c(0x1d0);['description']=a25_0x51372c(0x17a);async['execute'](_0x3009e8){const _0x1809b8=a25_0x51372c,{options:_0x88bb51,args:_0x271e35,tdx:_0x169329}=_0x3009e8;if(_0x271e35[_0x1809b8(0x1e9)]===0x0)return console[_0x1809b8(0x171)](_0x1809b8(0x198)),console[_0x1809b8(0x171)](_0x1809b8(0x1fc)),0x1;const _0x5d2791=_0x271e35[0x0];try{_0x88bb51[_0x1809b8(0x1e3)]&&(console[_0x1809b8(0x171)]('Site:\x20'+_0x88bb51['site']),console[_0x1809b8(0x171)](_0x1809b8(0x1d6)+_0x5d2791));const _0xb3b14f=await withSpinner(_0x1809b8(0x168)+_0x5d2791+_0x1809b8(0x1be),()=>_0x169329[_0x1809b8(0x1e6)][_0x1809b8(0x177)](_0x5d2791),{'verbose':_0x88bb51[_0x1809b8(0x1e3)]}),_0x2415f3=_0xb3b14f['data'];_0x88bb51[_0x1809b8(0x1e3)]&&console[_0x1809b8(0x171)]('Resolved\x20parent\x20ID:\x20'+_0x2415f3);const _0x1683f6=await withSpinner('Listing\x20folders\x20for\x20parent\x20\x27'+_0x5d2791+_0x1809b8(0x1be),()=>_0x169329[_0x1809b8(0x1e6)][_0x1809b8(0x1b6)](_0x2415f3),{'verbose':_0x88bb51['verbose']}),_0x4ac7a2=_0x1683f6[_0x1809b8(0x1f4)];return console[_0x1809b8(0x171)](_0x1809b8(0x1c4)+_0x4ac7a2[_0x1809b8(0x1e9)]+'\x20folder'+(_0x4ac7a2[_0x1809b8(0x1e9)]!==0x1?'s':'')),await handleSDKOutput(_0x4ac7a2,_0x88bb51),0x0;}catch(_0x17fcf4){if(_0x17fcf4 instanceof SDKError)return console[_0x1809b8(0x171)](_0x1809b8(0x1bd)+_0x17fcf4[_0x1809b8(0x1a9)]),_0x17fcf4[_0x1809b8(0x1f9)]&&console[_0x1809b8(0x171)](_0x1809b8(0x165)+_0x17fcf4['cause']),0x1;throw _0x17fcf4;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a25_0x51372c(0x1d2);[a25_0x51372c(0x16c)]=a25_0x51372c(0x18f);async[a25_0x51372c(0x180)](_0x235af6){const _0x223079=a25_0x51372c,{options:_0x152d6c,args:_0xb10d00,tdx:_0x97f7ed}=_0x235af6;if(_0xb10d00[_0x223079(0x1e9)]===0x0)return console[_0x223079(0x171)](_0x223079(0x1d1)),console[_0x223079(0x171)](_0x223079(0x1a5)),0x1;try{const {parentId:_0x25d5a0,childId:_0x3df6a7}=parseSegmentRef(_0xb10d00[0x0]);_0x152d6c[_0x223079(0x1e3)]&&(console[_0x223079(0x171)]('Site:\x20'+_0x152d6c[_0x223079(0x1e5)]),console['error'](_0x223079(0x1d6)+_0x25d5a0),_0x3df6a7&&console[_0x223079(0x171)](_0x223079(0x1c6)+_0x3df6a7));if(!_0x3df6a7)return console[_0x223079(0x171)]('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0xf6507e=await withSpinner(_0x223079(0x168)+_0x25d5a0+_0x223079(0x1be),()=>_0x97f7ed[_0x223079(0x1e6)][_0x223079(0x177)](_0x25d5a0),{'verbose':_0x152d6c['verbose']}),_0x58996f=_0xf6507e['data'];_0x152d6c[_0x223079(0x1e3)]&&console[_0x223079(0x171)]('Resolved\x20parent\x20ID:\x20'+_0x58996f);const _0x33ab5c=await withSpinner(_0x223079(0x172)+_0x3df6a7+_0x223079(0x1be),()=>_0x97f7ed[_0x223079(0x1e6)]['resolveFolderId'](_0x58996f,_0x3df6a7),{'verbose':_0x152d6c['verbose']}),_0x5175b3=_0x33ab5c['data'];_0x152d6c[_0x223079(0x1e3)]&&console['error'](_0x223079(0x175)+_0x5175b3);const _0x201fb8=await withSpinner(_0x223079(0x1b4)+_0x3df6a7+_0x223079(0x1be),()=>_0x97f7ed[_0x223079(0x1e6)][_0x223079(0x1a1)](_0x5175b3),{'verbose':_0x152d6c[_0x223079(0x1e3)]});return await handleSDKOutput([_0x201fb8[_0x223079(0x1f4)]],_0x152d6c),0x0;}catch(_0x239ccd){if(_0x239ccd instanceof SDKError)return console[_0x223079(0x171)](_0x223079(0x1bd)+_0x239ccd['message']),_0x239ccd['cause']&&console['error'](_0x223079(0x165)+_0x239ccd[_0x223079(0x1f9)]),0x1;throw _0x239ccd;}}}export class SegmentSQLCommand extends BaseCommand{['name']='segment:sql';['description']=a25_0x51372c(0x186);async['execute'](_0x280cb8){const _0x541c38=a25_0x51372c,{options:_0x2d69e9,args:_0x477149,tdx:_0x7b13d2}=_0x280cb8,_0x58ca52=_0x477149[0x0];if(!_0x58ca52)return console[_0x541c38(0x171)](_0x541c38(0x1fe)),console[_0x541c38(0x171)](_0x541c38(0x199)),console['error'](_0x541c38(0x164)),console[_0x541c38(0x171)](_0x541c38(0x1b9)),console['error'](_0x541c38(0x1a0)),console[_0x541c38(0x171)](_0x541c38(0x19a)),0x1;try{const _0x5316e4=_0x2d69e9[_0x541c38(0x16d)],_0x3abd4b=await resolveSegmentTarget(_0x58ca52,_0x5316e4,_0x2d69e9[_0x541c38(0x1e3)]);_0x2d69e9[_0x541c38(0x1e3)]&&console[_0x541c38(0x171)](_0x541c38(0x1ab)+_0x3abd4b);const _0x166eaf=await withSpinner('Resolving\x20\x27'+_0x58ca52+'\x27...',()=>_0x7b13d2[_0x541c38(0x1e6)][_0x541c38(0x1a2)](_0x3abd4b),{'verbose':_0x2d69e9[_0x541c38(0x1e3)]}),_0x592f2c=_0x166eaf[_0x541c38(0x1f4)];_0x2d69e9[_0x541c38(0x1e3)]&&(console[_0x541c38(0x171)]('Resolved\x20type:\x20'+_0x592f2c['type']),console['error']('Parent\x20ID:\x20'+_0x592f2c[_0x541c38(0x1e7)]));if(_0x592f2c[_0x541c38(0x1c0)]===_0x541c38(0x193))return console[_0x541c38(0x171)](_0x541c38(0x1c3)),console[_0x541c38(0x171)](_0x541c38(0x1bc)),0x1;if(_0x592f2c['type']===_0x541c38(0x1e1))return console[_0x541c38(0x171)](_0x541c38(0x1f0)),console[_0x541c38(0x171)]('Use:\x20tdx\x20ps\x20sql'),0x1;if(!_0x592f2c[_0x541c38(0x1d7)])throw new SDKError(ErrorCode[_0x541c38(0x1af)],_0x541c38(0x1b0));const _0x1d3ad3=await withSpinner(_0x541c38(0x1ee),()=>_0x7b13d2[_0x541c38(0x1e6)][_0x541c38(0x1a7)](_0x592f2c[_0x541c38(0x1e7)],_0x592f2c['segmentId']),{'verbose':_0x2d69e9[_0x541c38(0x1e3)]}),_0x3c295b=_0x1d3ad3['data'];return _0x2d69e9[_0x541c38(0x17d)]==='json'||_0x2d69e9[_0x541c38(0x17d)]===_0x541c38(0x169)?await handleSDKOutput([{'sql':_0x3c295b}],_0x2d69e9):console[_0x541c38(0x1c5)](_0x3c295b),0x0;}catch(_0xeadd7b){if(_0xeadd7b instanceof SDKError)return console['error'](_0x541c38(0x1bd)+_0xeadd7b[_0x541c38(0x1a9)]),_0xeadd7b[_0x541c38(0x1f9)]&&console[_0x541c38(0x171)]('\x20\x20Cause:\x20'+_0xeadd7b['cause']),0x1;throw _0xeadd7b;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a25_0x51372c(0x178)]=a25_0x51372c(0x1f3);[a25_0x51372c(0x16c)]=a25_0x51372c(0x1b5);async['execute'](_0x1a7971){const _0x14b041=a25_0x51372c,{options:_0x1581c6,args:_0x18d405,tdx:_0x2c1b2c}=_0x1a7971,_0xe34fe1=_0x1581c6;if(_0x18d405[_0x14b041(0x1e9)]<0x2)return console[_0x14b041(0x171)](_0x14b041(0x17b)),console[_0x14b041(0x171)](_0x14b041(0x176)),0x1;const _0x5e4328=_0x18d405[0x0],_0x41ce2f=_0x18d405[0x1];_0xe34fe1[_0x14b041(0x1e3)]&&(console[_0x14b041(0x171)](_0x14b041(0x1b2)+_0xe34fe1['site']),console['error'](_0x14b041(0x1f2)+_0x5e4328),console['error'](_0x14b041(0x1c6)+_0x41ce2f));let _0x40ef8a;if(_0xe34fe1['parentFolder']){const _0xba671=_0xe34fe1['parentFolder'],_0x3a99e9=await withSpinner(_0x14b041(0x168)+_0x5e4328+'\x27...',()=>_0x2c1b2c['segment'][_0x14b041(0x177)](_0x5e4328),{'verbose':_0xe34fe1[_0x14b041(0x1e3)]}),_0x14f66a=_0x3a99e9[_0x14b041(0x1f4)],_0x4920ba=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0xba671+_0x14b041(0x1be),()=>_0x2c1b2c[_0x14b041(0x1e6)][_0x14b041(0x1e4)](_0x14f66a,_0xba671),{'verbose':_0xe34fe1[_0x14b041(0x1e3)]});_0x40ef8a=_0x4920ba[_0x14b041(0x1f4)],_0xe34fe1[_0x14b041(0x1e3)]&&console[_0x14b041(0x171)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x40ef8a);}const _0x22d62f={'name':_0x41ce2f,'description':_0xe34fe1[_0x14b041(0x16c)],'parentFolderId':_0x40ef8a},_0x27264d=await withSpinner(_0x14b041(0x191)+_0x41ce2f+_0x14b041(0x1be),()=>_0x2c1b2c[_0x14b041(0x1e6)][_0x14b041(0x1b8)](_0x5e4328,_0x22d62f),{'verbose':_0xe34fe1[_0x14b041(0x1e3)]}),_0x3baaf3=_0x27264d[_0x14b041(0x1f4)];return console[_0x14b041(0x171)]('✔\x20Created\x20folder\x20\x27'+_0x3baaf3['name']+_0x14b041(0x1ec)+_0x3baaf3['id']),await handleSDKOutput([_0x3baaf3],_0xe34fe1),0x0;}}export class SegmentViewCommand extends BaseCommand{[a25_0x51372c(0x178)]=a25_0x51372c(0x1ac);[a25_0x51372c(0x16c)]=a25_0x51372c(0x1b1);async['execute'](_0xbe412e){const _0x9f26c2=a25_0x51372c,{options:_0x38af00,args:_0x40a739,tdx:_0x304b6d}=_0xbe412e,_0x31ce19=_0x40a739[0x0];if(!_0x31ce19)return console['error'](_0x9f26c2(0x1de)),console[_0x9f26c2(0x171)](_0x9f26c2(0x1fb)),console[_0x9f26c2(0x171)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console['error'](_0x9f26c2(0x16f)),console['error']('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console['error'](_0x9f26c2(0x1b9)),console[_0x9f26c2(0x171)](_0x9f26c2(0x1aa)),console[_0x9f26c2(0x171)](_0x9f26c2(0x19f)),console[_0x9f26c2(0x171)](_0x9f26c2(0x19b)),console[_0x9f26c2(0x171)](_0x9f26c2(0x166)),0x1;try{const _0x454ccb=_0x38af00[_0x9f26c2(0x16d)],_0x21e1bf=await resolveSegmentTarget(_0x31ce19,_0x454ccb,_0x38af00['verbose']);_0x38af00[_0x9f26c2(0x1e3)]&&console[_0x9f26c2(0x171)](_0x9f26c2(0x1ab)+_0x21e1bf);const _0x3d3307=await withSpinner(_0x9f26c2(0x1e8)+_0x31ce19+_0x9f26c2(0x1be),()=>_0x304b6d[_0x9f26c2(0x1e6)][_0x9f26c2(0x1a2)](_0x21e1bf),{'verbose':_0x38af00[_0x9f26c2(0x1e3)]}),_0x220e42=_0x3d3307[_0x9f26c2(0x1f4)];_0x38af00[_0x9f26c2(0x1e3)]&&(console[_0x9f26c2(0x171)](_0x9f26c2(0x18b)+_0x220e42[_0x9f26c2(0x1c0)]),console[_0x9f26c2(0x171)](_0x9f26c2(0x1a4)+_0x220e42[_0x9f26c2(0x1e7)]),_0x220e42[_0x9f26c2(0x1e0)]&&console[_0x9f26c2(0x171)](_0x9f26c2(0x1c1)+_0x220e42['folderId']),_0x220e42[_0x9f26c2(0x1d7)]&&console[_0x9f26c2(0x171)]('Segment\x20ID:\x20'+_0x220e42[_0x9f26c2(0x1d7)]));if(_0x38af00[_0x9f26c2(0x200)]){if(_0x220e42[_0x9f26c2(0x1c0)]===_0x9f26c2(0x193))return console[_0x9f26c2(0x171)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x220e42[_0x9f26c2(0x1c0)]==='parent')return console[_0x9f26c2(0x171)](_0x9f26c2(0x1c2)),console[_0x9f26c2(0x171)]('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x220e42[_0x9f26c2(0x1d7)])throw new SDKError(ErrorCode[_0x9f26c2(0x1af)],_0x9f26c2(0x1b0));const _0x1978bd=getConsoleNextUrl(_0x38af00['site'],_0x9f26c2(0x1f6)+_0x220e42[_0x9f26c2(0x1e7)]+_0x9f26c2(0x17e)+_0x220e42['segmentId']);return console[_0x9f26c2(0x171)](a25_0x4b6697['green']('✔')+_0x9f26c2(0x1cd)+a25_0x4b6697['cyan'](_0x1978bd)),openBrowser(_0x1978bd),0x0;}if(_0x220e42[_0x9f26c2(0x1c0)]===_0x9f26c2(0x193)){if(!_0x220e42[_0x9f26c2(0x1e0)])throw new SDKError(ErrorCode[_0x9f26c2(0x18c)],_0x9f26c2(0x16b));const _0x47015c=await withSpinner(_0x9f26c2(0x18e),()=>_0x304b6d[_0x9f26c2(0x1e6)][_0x9f26c2(0x1a1)](_0x220e42[_0x9f26c2(0x1e0)]),{'verbose':_0x38af00['verbose']});await handleSingleObjectOutput(_0x47015c[_0x9f26c2(0x1f4)],_0x38af00);}else{if(_0x220e42[_0x9f26c2(0x1c0)]===_0x9f26c2(0x1e6)){if(!_0x220e42[_0x9f26c2(0x1d7)])throw new SDKError(ErrorCode[_0x9f26c2(0x1af)],_0x9f26c2(0x1b0));const _0x103063=await withSpinner(_0x9f26c2(0x1a6),()=>_0x304b6d['segment'][_0x9f26c2(0x1bf)](_0x220e42['parentId'],_0x220e42[_0x9f26c2(0x1d7)]),{'verbose':_0x38af00[_0x9f26c2(0x1e3)]}),_0x48f555=getConsoleNextUrl(_0x38af00['site'],'/app/ps/'+_0x220e42[_0x9f26c2(0x1e7)]+_0x9f26c2(0x17e)+_0x220e42[_0x9f26c2(0x1d7)]),_0x3422e6=_0x103063[_0x9f26c2(0x1f4)];_0x3422e6[_0x9f26c2(0x1da)]=_0x48f555,await handleSingleObjectOutput(_0x3422e6,_0x38af00);}else return console[_0x9f26c2(0x171)](_0x9f26c2(0x1c7)),console[_0x9f26c2(0x171)](_0x9f26c2(0x1dc)),0x1;}return 0x0;}catch(_0x44971a){if(_0x44971a instanceof SDKError)return console[_0x9f26c2(0x171)](_0x9f26c2(0x1bd)+_0x44971a[_0x9f26c2(0x1a9)]),_0x44971a[_0x9f26c2(0x1f9)]&&console['error'](_0x9f26c2(0x165)+_0x44971a[_0x9f26c2(0x1f9)]),0x1;throw _0x44971a;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']=a25_0x51372c(0x18d);[a25_0x51372c(0x16c)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async['execute'](_0x335266){const _0x127268=a25_0x51372c,{options:_0x2a3546,args:_0x2adf5a,tdx:_0x32e3a0}=_0x335266,_0x1655a2=_0x2adf5a[0x0];if(!_0x1655a2)return console[_0x127268(0x171)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x127268(0x171)](_0x127268(0x1a8)),console[_0x127268(0x171)](_0x127268(0x1cf)),console[_0x127268(0x171)]('Examples:'),console[_0x127268(0x171)](_0x127268(0x1db)),console[_0x127268(0x171)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x32fd53=_0x2a3546[_0x127268(0x16d)],_0x46a856=await resolveSegmentTarget(_0x1655a2,_0x32fd53,_0x2a3546[_0x127268(0x1e3)]);_0x2a3546[_0x127268(0x1e3)]&&console[_0x127268(0x171)]('Target\x20path:\x20'+_0x46a856);const _0x2069d0=await withSpinner(_0x127268(0x1e8)+_0x1655a2+_0x127268(0x1be),()=>_0x32e3a0[_0x127268(0x1e6)][_0x127268(0x1a2)](_0x46a856),{'verbose':_0x2a3546['verbose']}),_0x40a4b1=_0x2069d0[_0x127268(0x1f4)];_0x2a3546[_0x127268(0x1e3)]&&(console['error'](_0x127268(0x18b)+_0x40a4b1['type']),console['error']('Parent\x20ID:\x20'+_0x40a4b1[_0x127268(0x1e7)]));if(_0x40a4b1['type']==='folder')return console[_0x127268(0x171)](_0x127268(0x167)),console['error'](_0x127268(0x1bc)),0x1;if(_0x40a4b1['type']===_0x127268(0x1e1))return console[_0x127268(0x171)](_0x127268(0x181)),console[_0x127268(0x171)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x40a4b1[_0x127268(0x1d7)])throw new SDKError(ErrorCode[_0x127268(0x1af)],_0x127268(0x1b0));const _0x31e51=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x32e3a0[_0x127268(0x1e6)][_0x127268(0x1a7)](_0x40a4b1[_0x127268(0x1e7)],_0x40a4b1[_0x127268(0x1d7)]),{'verbose':_0x2a3546[_0x127268(0x1e3)]}),_0x2b979b=_0x31e51[_0x127268(0x1f4)],_0x165c99=await executeSchemaQuery(_0x2b979b,_0x32e3a0,_0x2a3546);return await handleQueryOutput(_0x165c99,_0x2a3546),0x0;}catch(_0x29a757){if(_0x29a757 instanceof SDKError)return console[_0x127268(0x171)](_0x127268(0x1bd)+_0x29a757[_0x127268(0x1a9)]),_0x29a757[_0x127268(0x1f9)]&&console['error'](_0x127268(0x165)+_0x29a757[_0x127268(0x1f9)]),0x1;throw _0x29a757;}}}
1
+ const a25_0xa0b743=a25_0x46e2;(function(_0x55cab0,_0x8c84e7){const _0x241b70=a25_0x46e2,_0x28683a=_0x55cab0();while(!![]){try{const _0x3ec7e6=-parseInt(_0x241b70(0x212))/0x1*(parseInt(_0x241b70(0x250))/0x2)+-parseInt(_0x241b70(0x200))/0x3+parseInt(_0x241b70(0x220))/0x4+parseInt(_0x241b70(0x219))/0x5+-parseInt(_0x241b70(0x1f5))/0x6*(-parseInt(_0x241b70(0x243))/0x7)+parseInt(_0x241b70(0x24a))/0x8+-parseInt(_0x241b70(0x1f2))/0x9;if(_0x3ec7e6===_0x8c84e7)break;else _0x28683a['push'](_0x28683a['shift']());}catch(_0x55c8d9){_0x28683a['push'](_0x28683a['shift']());}}}(a25_0xb8e9,0x81935));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 a25_0x1e7ed9 from'chalk';async function resolveSegmentTarget(_0x37b8ed,_0x33544d,_0x11f520){const _0x2e9876=a25_0x46e2;if(isYamlFilePath(_0x37b8ed))try{const _0x4a3322=await resolveYamlFilePath(_0x37b8ed);return _0x11f520&&(console[_0x2e9876(0x206)](_0x2e9876(0x1f9)+_0x37b8ed),console[_0x2e9876(0x206)](_0x2e9876(0x227)+_0x4a3322[_0x2e9876(0x275)]),console[_0x2e9876(0x206)]('\x20\x20Segment\x20name:\x20'+_0x4a3322[_0x2e9876(0x1f8)]),console[_0x2e9876(0x206)](_0x2e9876(0x278)+(_0x4a3322[_0x2e9876(0x27b)]||_0x2e9876(0x24b))),console[_0x2e9876(0x206)]('\x20\x20Full\x20path:\x20'+_0x4a3322[_0x2e9876(0x26d)])),_0x4a3322['fullPath'];}catch(_0x4a8885){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2e9876(0x265)+_0x4a8885[_0x2e9876(0x27c)]);}if(!_0x33544d)throw new SDKError(ErrorCode[_0x2e9876(0x245)],_0x2e9876(0x21c));return _0x33544d+'/'+_0x37b8ed;}export class SegmentDescribeCommand extends BaseCommand{['name']=a25_0xa0b743(0x267);[a25_0xa0b743(0x1ed)]=a25_0xa0b743(0x22a);async[a25_0xa0b743(0x1eb)](_0x32bda9){const _0x2492a4=a25_0xa0b743,{options:_0x3fb9f0,args:_0x572fa6,tdx:_0x3064ce}=_0x32bda9,_0x477c93=_0x572fa6[0x0],_0x184ef0=!_0x477c93&&!!_0x3fb9f0[_0x2492a4(0x275)],_0x5dd4c3=_0x477c93||_0x3fb9f0[_0x2492a4(0x275)];if(!_0x5dd4c3)return console[_0x2492a4(0x206)](_0x2492a4(0x226)),console['error']('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x2492a4(0x206)]('Examples:'),console['error']('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22'),console[_0x2492a4(0x206)](_0x2492a4(0x235)),console[_0x2492a4(0x206)](_0x2492a4(0x270)),console[_0x2492a4(0x206)](_0x2492a4(0x1e6)),0x1;try{const _0x9937b=_0x3fb9f0['segmentPath'];let _0x4cc7af=_0x5dd4c3;!_0x184ef0&&_0x9937b&&!_0x5dd4c3[_0x2492a4(0x242)]('/')&&(_0x4cc7af=_0x9937b+'/'+_0x5dd4c3,_0x3fb9f0[_0x2492a4(0x1ef)]&&console[_0x2492a4(0x206)]('Resolved\x20relative\x20path\x20to:\x20'+_0x4cc7af));const _0x51152d=await withSpinner('Resolving\x20path\x20\x27'+_0x4cc7af+_0x2492a4(0x27e),()=>_0x3064ce[_0x2492a4(0x27d)]['resolvePathToResource'](_0x4cc7af),{'verbose':_0x3fb9f0['verbose']}),_0x3110fd=_0x51152d['data'];_0x3fb9f0['verbose']&&(console[_0x2492a4(0x206)](_0x2492a4(0x268)+_0x3110fd['type']),console['error'](_0x2492a4(0x224)+_0x3110fd[_0x2492a4(0x276)]),_0x3110fd['folderId']&&console[_0x2492a4(0x206)](_0x2492a4(0x1ff)+_0x3110fd[_0x2492a4(0x1f1)]),_0x3110fd['segmentId']&&console[_0x2492a4(0x206)](_0x2492a4(0x1ee)+_0x3110fd[_0x2492a4(0x233)]));if(_0x3110fd[_0x2492a4(0x21d)]===_0x2492a4(0x25a)){const _0x51e314=await withSpinner(_0x2492a4(0x262),()=>_0x3064ce[_0x2492a4(0x27d)][_0x2492a4(0x228)](_0x3110fd[_0x2492a4(0x276)]),{'verbose':_0x3fb9f0[_0x2492a4(0x1ef)]});await handleSingleObjectOutput(_0x51e314[_0x2492a4(0x256)],_0x3fb9f0);}else{if(_0x3110fd[_0x2492a4(0x21d)]===_0x2492a4(0x251)){if(!_0x3110fd[_0x2492a4(0x1f1)])throw new SDKError(ErrorCode[_0x2492a4(0x216)],_0x2492a4(0x22e));const _0x8acc20=await withSpinner(_0x2492a4(0x25d),()=>_0x3064ce[_0x2492a4(0x27d)][_0x2492a4(0x261)](_0x3110fd[_0x2492a4(0x1f1)]),{'verbose':_0x3fb9f0[_0x2492a4(0x1ef)]});await handleSingleObjectOutput(_0x8acc20[_0x2492a4(0x256)],_0x3fb9f0);}else{if(_0x3110fd[_0x2492a4(0x21d)]==='segment'){if(!_0x3110fd['segmentId'])throw new SDKError(ErrorCode[_0x2492a4(0x21b)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x138caa=await withSpinner(_0x2492a4(0x208),()=>_0x3064ce['segment'][_0x2492a4(0x25f)](_0x3110fd['parentId'],_0x3110fd[_0x2492a4(0x233)]),{'verbose':_0x3fb9f0[_0x2492a4(0x1ef)]});await handleSingleObjectOutput(_0x138caa[_0x2492a4(0x256)],_0x3fb9f0);}}}return 0x0;}catch(_0x3d7297){if(_0x3d7297 instanceof SDKError)return console[_0x2492a4(0x206)]('Error:\x20'+_0x3d7297[_0x2492a4(0x27c)]),_0x3d7297[_0x2492a4(0x23a)]&&console[_0x2492a4(0x206)]('\x20\x20Cause:\x20'+_0x3d7297['cause']),0x1;throw _0x3d7297;}}}export class SegmentShowCommand extends BaseCommand{[a25_0xa0b743(0x266)]=a25_0xa0b743(0x26e);[a25_0xa0b743(0x1ed)]=a25_0xa0b743(0x1fb);async['execute'](_0x1e3e96){const _0x333cf0=a25_0xa0b743,{options:_0x2ad473,args:_0x2b1d16,tdx:_0x382aa0}=_0x1e3e96,_0x348b47=_0x2b1d16[0x0];if(!_0x348b47)return console[_0x333cf0(0x206)](_0x333cf0(0x234)),console[_0x333cf0(0x206)](_0x333cf0(0x217)),console[_0x333cf0(0x206)](_0x333cf0(0x236)),console[_0x333cf0(0x206)](_0x333cf0(0x204)),console[_0x333cf0(0x206)](_0x333cf0(0x22b)),console[_0x333cf0(0x206)](_0x333cf0(0x1e8)),0x1;try{const _0x5c99e9=_0x2ad473[_0x333cf0(0x275)],_0x495937=await resolveSegmentTarget(_0x348b47,_0x5c99e9,_0x2ad473[_0x333cf0(0x1ef)]);_0x2ad473[_0x333cf0(0x1ef)]&&console['error']('Target\x20path:\x20'+_0x495937);const _0x192f29=await withSpinner(_0x333cf0(0x26b)+_0x348b47+_0x333cf0(0x27e),()=>_0x382aa0[_0x333cf0(0x27d)][_0x333cf0(0x230)](_0x495937),{'verbose':_0x2ad473[_0x333cf0(0x1ef)]}),_0x2cc749=_0x192f29[_0x333cf0(0x256)];_0x2ad473[_0x333cf0(0x1ef)]&&(console[_0x333cf0(0x206)](_0x333cf0(0x268)+_0x2cc749[_0x333cf0(0x21d)]),console[_0x333cf0(0x206)](_0x333cf0(0x224)+_0x2cc749[_0x333cf0(0x276)]));if(_0x2cc749[_0x333cf0(0x21d)]===_0x333cf0(0x251))return console[_0x333cf0(0x206)](_0x333cf0(0x260)),console['error'](_0x333cf0(0x211)),0x1;if(_0x2cc749[_0x333cf0(0x21d)]===_0x333cf0(0x25a))return console[_0x333cf0(0x206)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x333cf0(0x206)](_0x333cf0(0x1fa)),0x1;if(!_0x2cc749['segmentId'])throw new SDKError(ErrorCode[_0x333cf0(0x21b)],_0x333cf0(0x22d));const _0x1897db=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x382aa0[_0x333cf0(0x27d)][_0x333cf0(0x207)](_0x2cc749[_0x333cf0(0x276)],_0x2cc749['segmentId']),{'verbose':_0x2ad473[_0x333cf0(0x1ef)]});let _0x2994c9=_0x1897db['data'];const _0x2ee28d=resolveLimit(_0x2ad473['limit'],DEFAULT_DISPLAY_LIMIT),_0x5be6b9=/\bLIMIT\s+\d+/i['test'](_0x2994c9);!_0x5be6b9&&(_0x2994c9=_0x2994c9[_0x333cf0(0x25c)]()['replace'](/;+$/,''),_0x2994c9=_0x333cf0(0x222)+_0x2994c9+_0x333cf0(0x24f)+_0x2ee28d);_0x2ad473['verbose']&&console['error'](_0x333cf0(0x253)+_0x2994c9);const _0x15f35b=await withProgressSpinner(_0x333cf0(0x257),async _0x46b9b9=>{const _0x59aa74=_0x333cf0,_0x1d8d51=await _0x382aa0[_0x59aa74(0x22f)][_0x59aa74(0x1eb)](_0x2994c9,{'catalog':'td','schema':'information_schema','onJobId':_0x3a1cda=>{_0x46b9b9['setJobId'](_0x3a1cda);}});return _0x1d8d51;},{'verbose':_0x2ad473[_0x333cf0(0x1ef)]}),_0x5c180d=_0x15f35b['data'],_0x23b00f=_0x5c180d[_0x333cf0(0x248)]?_0x333cf0(0x274)+_0x5c180d[_0x333cf0(0x248)]+']':'';return console['error'](_0x333cf0(0x232)+_0x5c180d[_0x333cf0(0x246)][_0x333cf0(0x277)]['toLocaleString']()+_0x333cf0(0x273)+(_0x333cf0(0x239)+formatElapsed(_0x5c180d['stats']['elapsedTimeMillis'])+_0x23b00f)),await handleQueryOutput(_0x5c180d,_0x2ad473),0x0;}catch(_0x61afc2){if(_0x61afc2 instanceof SDKError)return console[_0x333cf0(0x206)]('✖\x20Query\x20failed\x20['+_0x61afc2[_0x333cf0(0x1e7)]+']'),console['error']('\x0a'+_0x61afc2[_0x333cf0(0x27c)]),0x1;throw _0x61afc2;}}}function a25_0xb8e9(){const _0x374708=['INVALID_ARGUMENT','stats','Use:\x20tdx\x20ps\x20desc','jobId','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','4872344iEMtDT','(root)','Usage:\x20tdx\x20sg\x20sql\x20<name>','/e/','Use:\x20tdx\x20ps\x20view\x20-w','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','2uQjuTd','folder','segment:view','SQL\x20query:\x0a','Resolved\x20parent\x20folder\x20ID:\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','data','Executing\x20segment\x20query...','Show\x20segment\x20folder\x20details','Error:\x20','parent','/app/ps/','trim','Fetching\x20folder\x20details...','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','getSegment','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','getFolder','Fetching\x20parent\x20segment\x20details...','Fetching\x20folder\x20\x27','segment:folder:show','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','name','segment:describe','Resolved\x20type:\x20','parentFolder','cyan','Resolving\x20\x27','Parent\x20name:\x20','fullPath','segment:show','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','\x27\x20with\x20ID:\x20','\x20rows\x20','\x20[Job\x20ID:\x20','parentSegment','parentId','processedRows','\x20\x20Folder\x20path:\x20','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','Use:\x20tdx\x20ps\x20view','folderPath','message','segment','\x27...','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','code','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Creating\x20folder\x20\x27','execute','Show\x20child\x20segment\x20schema\x20(column\x20types)','description','Segment\x20ID:\x20','verbose','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','folderId','11528847SqUwAh','Site:\x20','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','66rlEhaa','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','listFolders','segmentName','Resolved\x20YAML\x20file:\x20','Use:\x20tdx\x20ps\x20show','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Resolving\x20parent\x20segment\x20\x27','Folder\x20name:\x20','Use:\x20tdx\x20ps\x20sql','Folder\x20ID:\x20','96909kPQMSC','✔\x20Found\x20','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','resolveFolderId','Examples:','Create\x20segment\x20folder\x20for\x20organization','error','getSegmentSQL','Fetching\x20segment\x20details...','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Parent\x20segment:\x20','Resolving\x20folder\x20\x27','format','✔\x20Created\x20folder\x20\x27','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','log','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','573499wbtvBg','site','Error:\x20Folder\x20reference\x20is\x20required','web','SEGMENT_FOLDER_NOT_FOUND','Usage:\x20tdx\x20sg\x20show\x20<name>','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','1609550lGsCmh','Fetching\x20SQL\x20for\x20segment...','SEGMENT_NOT_FOUND','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','type','length','segment:desc','2713568dZLJgW','segment:sql','SELECT\x20*\x20FROM\x20(\x0a','createFolder','Parent\x20ID:\x20','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Error:\x20Path\x20or\x20name\x20is\x20required','\x20\x20Parent\x20segment:\x20','getParent','resolveParentId','Show\x20segment\x20or\x20folder\x20details','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Target\x20path:\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Folder\x20ID\x20missing\x20from\x20resolved\x20path','query','resolvePathToResource','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','✔\x20Query\x20completed:\x20Processed\x20','segmentId','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','segment:folder:create','in\x20','cause','\x20\x20Cause:\x20','Listing\x20folders\x20for\x20parent\x20\x27','url','Resolved\x20parent\x20ID:\x20','\x20Opening\x20','\x20folder','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','includes','514297hGwWzN','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'];a25_0xb8e9=function(){return _0x374708;};return a25_0xb8e9();}export class SegmentFolderListCommand extends BaseCommand{['name']='segment:folder:list';[a25_0xa0b743(0x1ed)]=a25_0xa0b743(0x210);async[a25_0xa0b743(0x1eb)](_0x334c11){const _0x18cfab=a25_0xa0b743,{options:_0x3d5747,args:_0x4ffd6f,tdx:_0x454016}=_0x334c11;if(_0x4ffd6f[_0x18cfab(0x21e)]===0x0)return console['error']('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x18cfab(0x206)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x4b10f4=_0x4ffd6f[0x0];try{_0x3d5747[_0x18cfab(0x1ef)]&&(console['error']('Site:\x20'+_0x3d5747[_0x18cfab(0x213)]),console[_0x18cfab(0x206)]('Parent\x20name:\x20'+_0x4b10f4));const _0x10354b=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x4b10f4+_0x18cfab(0x27e),()=>_0x454016['segment'][_0x18cfab(0x229)](_0x4b10f4),{'verbose':_0x3d5747[_0x18cfab(0x1ef)]}),_0x3ec745=_0x10354b['data'];_0x3d5747['verbose']&&console['error'](_0x18cfab(0x23e)+_0x3ec745);const _0x249d35=await withSpinner(_0x18cfab(0x23c)+_0x4b10f4+_0x18cfab(0x27e),()=>_0x454016[_0x18cfab(0x27d)][_0x18cfab(0x1f7)](_0x3ec745),{'verbose':_0x3d5747[_0x18cfab(0x1ef)]}),_0x3f7128=_0x249d35[_0x18cfab(0x256)];return console[_0x18cfab(0x206)](_0x18cfab(0x201)+_0x3f7128[_0x18cfab(0x21e)]+_0x18cfab(0x240)+(_0x3f7128[_0x18cfab(0x21e)]!==0x1?'s':'')),await handleSDKOutput(_0x3f7128,_0x3d5747),0x0;}catch(_0xe4c08a){if(_0xe4c08a instanceof SDKError)return console[_0x18cfab(0x206)]('Error:\x20'+_0xe4c08a['message']),_0xe4c08a[_0x18cfab(0x23a)]&&console[_0x18cfab(0x206)](_0x18cfab(0x23b)+_0xe4c08a[_0x18cfab(0x23a)]),0x1;throw _0xe4c08a;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a25_0xa0b743(0x264);['description']=a25_0xa0b743(0x258);async[a25_0xa0b743(0x1eb)](_0x87c9bc){const _0x19595f=a25_0xa0b743,{options:_0x587d86,args:_0x2b8424,tdx:_0x54b796}=_0x87c9bc;if(_0x2b8424[_0x19595f(0x21e)]===0x0)return console['error'](_0x19595f(0x214)),console[_0x19595f(0x206)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x5b4941,childId:_0x50df3a}=parseSegmentRef(_0x2b8424[0x0]);_0x587d86[_0x19595f(0x1ef)]&&(console[_0x19595f(0x206)]('Site:\x20'+_0x587d86[_0x19595f(0x213)]),console['error'](_0x19595f(0x26c)+_0x5b4941),_0x50df3a&&console[_0x19595f(0x206)](_0x19595f(0x1fd)+_0x50df3a));if(!_0x50df3a)return console[_0x19595f(0x206)](_0x19595f(0x209)),0x1;const _0x44bb2e=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5b4941+_0x19595f(0x27e),()=>_0x54b796['segment'][_0x19595f(0x229)](_0x5b4941),{'verbose':_0x587d86[_0x19595f(0x1ef)]}),_0x4ddbf1=_0x44bb2e[_0x19595f(0x256)];_0x587d86[_0x19595f(0x1ef)]&&console[_0x19595f(0x206)]('Resolved\x20parent\x20ID:\x20'+_0x4ddbf1);const _0x52b62b=await withSpinner(_0x19595f(0x20b)+_0x50df3a+_0x19595f(0x27e),()=>_0x54b796[_0x19595f(0x27d)][_0x19595f(0x203)](_0x4ddbf1,_0x50df3a),{'verbose':_0x587d86[_0x19595f(0x1ef)]}),_0x42b375=_0x52b62b[_0x19595f(0x256)];_0x587d86[_0x19595f(0x1ef)]&&console[_0x19595f(0x206)]('Resolved\x20folder\x20ID:\x20'+_0x42b375);const _0x173b3f=await withSpinner(_0x19595f(0x263)+_0x50df3a+'\x27...',()=>_0x54b796[_0x19595f(0x27d)][_0x19595f(0x261)](_0x42b375),{'verbose':_0x587d86[_0x19595f(0x1ef)]});return await handleSDKOutput([_0x173b3f['data']],_0x587d86),0x0;}catch(_0x2f49a1){if(_0x2f49a1 instanceof SDKError)return console[_0x19595f(0x206)]('Error:\x20'+_0x2f49a1['message']),_0x2f49a1['cause']&&console[_0x19595f(0x206)]('\x20\x20Cause:\x20'+_0x2f49a1[_0x19595f(0x23a)]),0x1;throw _0x2f49a1;}}}export class SegmentSQLCommand extends BaseCommand{[a25_0xa0b743(0x266)]=a25_0xa0b743(0x221);['description']='Get\x20SQL\x20query\x20for\x20child\x20segment';async['execute'](_0xcb0557){const _0x3a8f5b=a25_0xa0b743,{options:_0x23c9b1,args:_0x2d35dd,tdx:_0x22f59f}=_0xcb0557,_0x2f2eab=_0x2d35dd[0x0];if(!_0x2f2eab)return console['error'](_0x3a8f5b(0x234)),console[_0x3a8f5b(0x206)](_0x3a8f5b(0x24c)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>'),console[_0x3a8f5b(0x206)](_0x3a8f5b(0x204)),console[_0x3a8f5b(0x206)](_0x3a8f5b(0x237)),console[_0x3a8f5b(0x206)](_0x3a8f5b(0x279)),0x1;try{const _0x50868c=_0x23c9b1['parentSegment'],_0x703950=await resolveSegmentTarget(_0x2f2eab,_0x50868c,_0x23c9b1['verbose']);_0x23c9b1['verbose']&&console['error'](_0x3a8f5b(0x22c)+_0x703950);const _0x1a67c3=await withSpinner(_0x3a8f5b(0x26b)+_0x2f2eab+_0x3a8f5b(0x27e),()=>_0x22f59f[_0x3a8f5b(0x27d)][_0x3a8f5b(0x230)](_0x703950),{'verbose':_0x23c9b1['verbose']}),_0x1805c0=_0x1a67c3['data'];_0x23c9b1[_0x3a8f5b(0x1ef)]&&(console[_0x3a8f5b(0x206)](_0x3a8f5b(0x268)+_0x1805c0[_0x3a8f5b(0x21d)]),console[_0x3a8f5b(0x206)](_0x3a8f5b(0x224)+_0x1805c0[_0x3a8f5b(0x276)]));if(_0x1805c0['type']===_0x3a8f5b(0x251))return console[_0x3a8f5b(0x206)](_0x3a8f5b(0x1f4)),console['error'](_0x3a8f5b(0x25e)),0x1;if(_0x1805c0[_0x3a8f5b(0x21d)]===_0x3a8f5b(0x25a))return console[_0x3a8f5b(0x206)](_0x3a8f5b(0x202)),console[_0x3a8f5b(0x206)](_0x3a8f5b(0x1fe)),0x1;if(!_0x1805c0[_0x3a8f5b(0x233)])throw new SDKError(ErrorCode[_0x3a8f5b(0x21b)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1bcbfe=await withSpinner(_0x3a8f5b(0x21a),()=>_0x22f59f['segment']['getSegmentSQL'](_0x1805c0[_0x3a8f5b(0x276)],_0x1805c0['segmentId']),{'verbose':_0x23c9b1[_0x3a8f5b(0x1ef)]}),_0x35c008=_0x1bcbfe[_0x3a8f5b(0x256)];return _0x23c9b1[_0x3a8f5b(0x20c)]==='json'||_0x23c9b1[_0x3a8f5b(0x20c)]==='jsonl'?await handleSDKOutput([{'sql':_0x35c008}],_0x23c9b1):console[_0x3a8f5b(0x20f)](_0x35c008),0x0;}catch(_0x5efd66){if(_0x5efd66 instanceof SDKError)return console[_0x3a8f5b(0x206)]('Error:\x20'+_0x5efd66[_0x3a8f5b(0x27c)]),_0x5efd66[_0x3a8f5b(0x23a)]&&console[_0x3a8f5b(0x206)](_0x3a8f5b(0x23b)+_0x5efd66[_0x3a8f5b(0x23a)]),0x1;throw _0x5efd66;}}}function a25_0x46e2(_0x1fa089,_0x2c8d80){_0x1fa089=_0x1fa089-0x1e6;const _0xb8e96a=a25_0xb8e9();let _0x46e23d=_0xb8e96a[_0x1fa089];return _0x46e23d;}export class SegmentFolderCreateCommand extends BaseCommand{[a25_0xa0b743(0x266)]=a25_0xa0b743(0x238);[a25_0xa0b743(0x1ed)]=a25_0xa0b743(0x205);async[a25_0xa0b743(0x1eb)](_0x32b0bd){const _0x1d2683=a25_0xa0b743,{options:_0x56de62,args:_0x1c569c,tdx:_0x51091a}=_0x32b0bd,_0x99125=_0x56de62;if(_0x1c569c[_0x1d2683(0x21e)]<0x2)return console['error'](_0x1d2683(0x1f6)),console[_0x1d2683(0x206)](_0x1d2683(0x249)),0x1;const _0x91bdde=_0x1c569c[0x0],_0x7e3dc0=_0x1c569c[0x1];_0x99125[_0x1d2683(0x1ef)]&&(console[_0x1d2683(0x206)](_0x1d2683(0x1f3)+_0x99125[_0x1d2683(0x213)]),console[_0x1d2683(0x206)](_0x1d2683(0x20a)+_0x91bdde),console[_0x1d2683(0x206)](_0x1d2683(0x1fd)+_0x7e3dc0));let _0x3f7ad6;if(_0x99125[_0x1d2683(0x269)]){const _0x180b42=_0x99125[_0x1d2683(0x269)],_0x21523d=await withSpinner(_0x1d2683(0x1fc)+_0x91bdde+_0x1d2683(0x27e),()=>_0x51091a[_0x1d2683(0x27d)][_0x1d2683(0x229)](_0x91bdde),{'verbose':_0x99125['verbose']}),_0x5c470b=_0x21523d[_0x1d2683(0x256)],_0x2b948b=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x180b42+_0x1d2683(0x27e),()=>_0x51091a[_0x1d2683(0x27d)][_0x1d2683(0x203)](_0x5c470b,_0x180b42),{'verbose':_0x99125[_0x1d2683(0x1ef)]});_0x3f7ad6=_0x2b948b['data'],_0x99125['verbose']&&console[_0x1d2683(0x206)](_0x1d2683(0x254)+_0x3f7ad6);}const _0x192de1={'name':_0x7e3dc0,'description':_0x99125[_0x1d2683(0x1ed)],'parentFolderId':_0x3f7ad6},_0x45fdfa=await withSpinner(_0x1d2683(0x1ea)+_0x7e3dc0+_0x1d2683(0x27e),()=>_0x51091a[_0x1d2683(0x27d)][_0x1d2683(0x223)](_0x91bdde,_0x192de1),{'verbose':_0x99125[_0x1d2683(0x1ef)]}),_0xe12101=_0x45fdfa[_0x1d2683(0x256)];return console[_0x1d2683(0x206)](_0x1d2683(0x20d)+_0xe12101['name']+_0x1d2683(0x272)+_0xe12101['id']),await handleSDKOutput([_0xe12101],_0x99125),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a25_0xa0b743(0x252);[a25_0xa0b743(0x1ed)]='Show\x20folder\x20or\x20child\x20segment\x20details';async[a25_0xa0b743(0x1eb)](_0x16f451){const _0x560eca=a25_0xa0b743,{options:_0x2007b7,args:_0x1a3a4e,tdx:_0x4c4ee7}=_0x16f451,_0x1940d0=_0x1a3a4e[0x0];if(!_0x1940d0)return console[_0x560eca(0x206)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x560eca(0x206)](_0x560eca(0x20e)),console['error'](_0x560eca(0x26f)),console[_0x560eca(0x206)]('Options:'),console['error']('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x560eca(0x206)]('Examples:'),console[_0x560eca(0x206)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console['error'](_0x560eca(0x231)),console[_0x560eca(0x206)](_0x560eca(0x218)),console['error'](_0x560eca(0x271)),0x1;try{const _0x2196dd=_0x2007b7['parentSegment'],_0x1a283a=await resolveSegmentTarget(_0x1940d0,_0x2196dd,_0x2007b7[_0x560eca(0x1ef)]);_0x2007b7[_0x560eca(0x1ef)]&&console[_0x560eca(0x206)](_0x560eca(0x22c)+_0x1a283a);const _0x399b10=await withSpinner(_0x560eca(0x26b)+_0x1940d0+_0x560eca(0x27e),()=>_0x4c4ee7[_0x560eca(0x27d)]['resolvePathToResource'](_0x1a283a),{'verbose':_0x2007b7[_0x560eca(0x1ef)]}),_0x35e231=_0x399b10['data'];_0x2007b7['verbose']&&(console[_0x560eca(0x206)](_0x560eca(0x268)+_0x35e231[_0x560eca(0x21d)]),console[_0x560eca(0x206)]('Parent\x20ID:\x20'+_0x35e231[_0x560eca(0x276)]),_0x35e231[_0x560eca(0x1f1)]&&console['error']('Folder\x20ID:\x20'+_0x35e231['folderId']),_0x35e231[_0x560eca(0x233)]&&console[_0x560eca(0x206)](_0x560eca(0x1ee)+_0x35e231[_0x560eca(0x233)]));if(_0x2007b7[_0x560eca(0x215)]){if(_0x35e231[_0x560eca(0x21d)]===_0x560eca(0x251))return console[_0x560eca(0x206)](_0x560eca(0x244)),0x1;if(_0x35e231['type']===_0x560eca(0x25a))return console['error'](_0x560eca(0x255)),console[_0x560eca(0x206)](_0x560eca(0x24e)),0x1;if(!_0x35e231[_0x560eca(0x233)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x38b344=getConsoleNextUrl(_0x2007b7[_0x560eca(0x213)],_0x560eca(0x25b)+_0x35e231['parentId']+_0x560eca(0x24d)+_0x35e231[_0x560eca(0x233)]);return console['error'](a25_0x1e7ed9['green']('✔')+_0x560eca(0x23f)+a25_0x1e7ed9[_0x560eca(0x26a)](_0x38b344)),openBrowser(_0x38b344),0x0;}if(_0x35e231['type']===_0x560eca(0x251)){if(!_0x35e231[_0x560eca(0x1f1)])throw new SDKError(ErrorCode[_0x560eca(0x216)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x25ce19=await withSpinner('Fetching\x20folder\x20details...',()=>_0x4c4ee7[_0x560eca(0x27d)][_0x560eca(0x261)](_0x35e231[_0x560eca(0x1f1)]),{'verbose':_0x2007b7['verbose']});await handleSingleObjectOutput(_0x25ce19[_0x560eca(0x256)],_0x2007b7);}else{if(_0x35e231[_0x560eca(0x21d)]==='segment'){if(!_0x35e231[_0x560eca(0x233)])throw new SDKError(ErrorCode[_0x560eca(0x21b)],_0x560eca(0x22d));const _0x48cfe4=await withSpinner('Fetching\x20segment\x20details...',()=>_0x4c4ee7[_0x560eca(0x27d)][_0x560eca(0x25f)](_0x35e231[_0x560eca(0x276)],_0x35e231['segmentId']),{'verbose':_0x2007b7[_0x560eca(0x1ef)]}),_0x3af575=getConsoleNextUrl(_0x2007b7[_0x560eca(0x213)],'/app/ps/'+_0x35e231[_0x560eca(0x276)]+'/e/'+_0x35e231['segmentId']),_0x404505=_0x48cfe4[_0x560eca(0x256)];_0x404505[_0x560eca(0x23d)]=_0x3af575,await handleSingleObjectOutput(_0x404505,_0x2007b7);}else return console[_0x560eca(0x206)](_0x560eca(0x225)),console[_0x560eca(0x206)](_0x560eca(0x27a)),0x1;}return 0x0;}catch(_0x539f88){if(_0x539f88 instanceof SDKError)return console[_0x560eca(0x206)]('Error:\x20'+_0x539f88[_0x560eca(0x27c)]),_0x539f88[_0x560eca(0x23a)]&&console[_0x560eca(0x206)](_0x560eca(0x23b)+_0x539f88[_0x560eca(0x23a)]),0x1;throw _0x539f88;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a25_0xa0b743(0x266)]=a25_0xa0b743(0x21f);[a25_0xa0b743(0x1ed)]=a25_0xa0b743(0x1ec);async[a25_0xa0b743(0x1eb)](_0x449f96){const _0x2b0fe2=a25_0xa0b743,{options:_0x5bdb82,args:_0x561e28,tdx:_0x245fad}=_0x449f96,_0x111791=_0x561e28[0x0];if(!_0x111791)return console['error'](_0x2b0fe2(0x234)),console[_0x2b0fe2(0x206)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console['error'](_0x2b0fe2(0x1e9)),console[_0x2b0fe2(0x206)]('Examples:'),console[_0x2b0fe2(0x206)](_0x2b0fe2(0x241)),console['error']('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x3bfbeb=_0x5bdb82[_0x2b0fe2(0x275)],_0x47335b=await resolveSegmentTarget(_0x111791,_0x3bfbeb,_0x5bdb82[_0x2b0fe2(0x1ef)]);_0x5bdb82['verbose']&&console[_0x2b0fe2(0x206)](_0x2b0fe2(0x22c)+_0x47335b);const _0x31457b=await withSpinner(_0x2b0fe2(0x26b)+_0x111791+_0x2b0fe2(0x27e),()=>_0x245fad[_0x2b0fe2(0x27d)]['resolvePathToResource'](_0x47335b),{'verbose':_0x5bdb82[_0x2b0fe2(0x1ef)]}),_0x1a3ca5=_0x31457b['data'];_0x5bdb82[_0x2b0fe2(0x1ef)]&&(console['error'](_0x2b0fe2(0x268)+_0x1a3ca5[_0x2b0fe2(0x21d)]),console['error']('Parent\x20ID:\x20'+_0x1a3ca5[_0x2b0fe2(0x276)]));if(_0x1a3ca5[_0x2b0fe2(0x21d)]==='folder')return console[_0x2b0fe2(0x206)](_0x2b0fe2(0x1f0)),console[_0x2b0fe2(0x206)](_0x2b0fe2(0x25e)),0x1;if(_0x1a3ca5['type']===_0x2b0fe2(0x25a))return console[_0x2b0fe2(0x206)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x2b0fe2(0x206)](_0x2b0fe2(0x247)),0x1;if(!_0x1a3ca5['segmentId'])throw new SDKError(ErrorCode[_0x2b0fe2(0x21b)],_0x2b0fe2(0x22d));const _0x25d8dc=await withSpinner(_0x2b0fe2(0x21a),()=>_0x245fad['segment']['getSegmentSQL'](_0x1a3ca5[_0x2b0fe2(0x276)],_0x1a3ca5['segmentId']),{'verbose':_0x5bdb82[_0x2b0fe2(0x1ef)]}),_0x5326b0=_0x25d8dc[_0x2b0fe2(0x256)],_0x2a3bb3=await executeSchemaQuery(_0x5326b0,_0x245fad,_0x5bdb82);return await handleQueryOutput(_0x2a3bb3,_0x5bdb82),0x0;}catch(_0x80070f){if(_0x80070f instanceof SDKError)return console['error'](_0x2b0fe2(0x259)+_0x80070f[_0x2b0fe2(0x27c)]),_0x80070f[_0x2b0fe2(0x23a)]&&console[_0x2b0fe2(0x206)](_0x2b0fe2(0x23b)+_0x80070f['cause']),0x1;throw _0x80070f;}}}
@@ -1 +1 @@
1
- const a26_0x4b463d=a26_0x2392;(function(_0x527860,_0x2e9c4e){const _0x4cc1b9=a26_0x2392,_0x3f9c94=_0x527860();while(!![]){try{const _0x4b0b90=-parseInt(_0x4cc1b9(0x159))/0x1*(-parseInt(_0x4cc1b9(0x16c))/0x2)+-parseInt(_0x4cc1b9(0x164))/0x3+-parseInt(_0x4cc1b9(0x14d))/0x4*(parseInt(_0x4cc1b9(0x17b))/0x5)+-parseInt(_0x4cc1b9(0x165))/0x6*(parseInt(_0x4cc1b9(0x162))/0x7)+parseInt(_0x4cc1b9(0x171))/0x8*(parseInt(_0x4cc1b9(0x17a))/0x9)+-parseInt(_0x4cc1b9(0x14c))/0xa+-parseInt(_0x4cc1b9(0x16e))/0xb*(-parseInt(_0x4cc1b9(0x16b))/0xc);if(_0x4b0b90===_0x2e9c4e)break;else _0x3f9c94['push'](_0x3f9c94['shift']());}catch(_0x27b458){_0x3f9c94['push'](_0x3f9c94['shift']());}}}(a26_0x15c2,0x40864));import{BaseCommand}from'./command.js';function a26_0x2392(_0x50c507,_0x11d16f){_0x50c507=_0x50c507-0x14c;const _0x15c268=a26_0x15c2();let _0x23927b=_0x15c268[_0x50c507];return _0x23927b;}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';function a26_0x15c2(){const _0x500085=['includes','264QdRJwf','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','✔\x20Created\x20segment\x20\x27','8BlxZPC','Examples:','segmentPath','noCountPopulation','yellow','kind','Resolving\x20folder\x20\x27','\x27...','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','4094343GgiFzX','1243235SvGlCS','Creating\x20segment\x20\x27','2830810ywtUAC','8ZcUzEn','name','Parent\x20path:\x20','resolveFolderId','\x20\x20\x20Path:\x20','segments','segment:create','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','type','invisible','folderId','folder','17933emNhCV','Create\x20child\x20segment\x20with\x20filtering\x20rules','Parent:\x20','Resolved\x20relative\x20path\x20to:\x20','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','length','\x27\x20with\x20ID:\x20','Site:\x20','verbose','98IgGNhL','segment','79563OtBvvy','89202KPqeyi','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','resolvePathToResource','data','Resolved\x20folder\x20ID:\x20','error','241836QeecRz','38FDKtRa'];a26_0x15c2=function(){return _0x500085;};return a26_0x15c2();}import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a26_0x4cbbb8 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a26_0x4b463d(0x14e)]=a26_0x4b463d(0x153);['description']=a26_0x4b463d(0x15a);async['execute'](_0x597c7e){const _0x1971b7=a26_0x4b463d;console[_0x1971b7(0x16a)](a26_0x4cbbb8[_0x1971b7(0x175)]('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x1971b7(0x16a)](a26_0x4cbbb8[_0x1971b7(0x175)](_0x1971b7(0x166)));const {options:_0x324fac,args:_0x5ad8d2,tdx:_0x1c198e}=_0x597c7e,_0xde7798=_0x324fac;if(_0x5ad8d2[_0x1971b7(0x15e)]===0x0)return console[_0x1971b7(0x16a)](_0x1971b7(0x179)),console['error']('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console['error'](_0x1971b7(0x172)),console['error'](_0x1971b7(0x16f)),console['error']('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console[_0x1971b7(0x16a)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x38eecb=_0x5ad8d2[0x0],_0x3d1798=_0x324fac[_0x1971b7(0x173)];let _0x2aac24=_0x38eecb;_0x3d1798&&!_0x38eecb[_0x1971b7(0x16d)]('/')&&(_0x2aac24=_0x3d1798+'/'+_0x38eecb,_0xde7798['verbose']&&console[_0x1971b7(0x16a)](_0x1971b7(0x15c)+_0x2aac24));const _0xc614c3=parsePath(_0x2aac24);if(_0xc614c3[_0x1971b7(0x152)]['length']<0x2)return console[_0x1971b7(0x16a)](_0x1971b7(0x15d)),console['error'](_0x1971b7(0x154)),0x1;const _0x5f0165=_0xc614c3[_0x1971b7(0x152)][0x0],_0x43167c=getBaseName(_0x2aac24),_0x2efb7b=getParentPath(_0x2aac24);_0xde7798[_0x1971b7(0x161)]&&(console[_0x1971b7(0x16a)](_0x1971b7(0x160)+_0xde7798['site']),console[_0x1971b7(0x16a)]('Target\x20path:\x20'+_0x2aac24),console[_0x1971b7(0x16a)](_0x1971b7(0x15b)+_0x5f0165),console['error']('Segment\x20name:\x20'+_0x43167c),console[_0x1971b7(0x16a)](_0x1971b7(0x14f)+_0x2efb7b));const _0x253055=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5f0165+_0x1971b7(0x178),()=>_0x1c198e['segment']['resolveParentId'](_0x5f0165),{'verbose':_0xde7798[_0x1971b7(0x161)]}),_0x318587=_0x253055[_0x1971b7(0x168)];let _0x583d7e;if(_0xc614c3[_0x1971b7(0x152)][_0x1971b7(0x15e)]>0x2){const _0x32d955=await withSpinner('Resolving\x20folder\x20path\x20\x27'+_0x2efb7b+_0x1971b7(0x178),()=>_0x1c198e['segment'][_0x1971b7(0x167)](_0x2efb7b),{'verbose':_0xde7798['verbose']}),_0x30eb01=_0x32d955[_0x1971b7(0x168)];if(_0x30eb01[_0x1971b7(0x155)]!==_0x1971b7(0x158)&&_0x30eb01[_0x1971b7(0x155)]!=='parent')return console['error']('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x583d7e=_0x30eb01[_0x1971b7(0x157)];}else{if(_0xde7798[_0x1971b7(0x158)]){const _0x40d90b=await withSpinner(_0x1971b7(0x177)+_0xde7798[_0x1971b7(0x158)]+_0x1971b7(0x178),()=>_0x1c198e[_0x1971b7(0x163)][_0x1971b7(0x150)](_0x318587,_0xde7798['folder']),{'verbose':_0xde7798[_0x1971b7(0x161)]});_0x583d7e=_0x40d90b[_0x1971b7(0x168)];}}_0xde7798[_0x1971b7(0x161)]&&_0x583d7e&&console[_0x1971b7(0x16a)](_0x1971b7(0x169)+_0x583d7e);const _0x40f835=await loadJSONFromOptions(_0xde7798['rule'],_0xde7798['ruleFile']),_0xd165d6={'name':_0x43167c,'description':_0xde7798['description'],'rule':_0x40f835,'kind':_0xde7798['kind']!==undefined?parseInt(_0xde7798[_0x1971b7(0x176)],0xa):undefined,'isVisible':_0xde7798[_0x1971b7(0x156)]?![]:undefined,'segmentFolderId':_0x583d7e,'countPopulation':_0xde7798[_0x1971b7(0x174)]?![]:undefined},_0x543619=await withSpinner(_0x1971b7(0x17c)+_0x43167c+_0x1971b7(0x178),()=>_0x1c198e[_0x1971b7(0x163)]['createSegment'](_0x318587,_0xd165d6),{'verbose':_0xde7798['verbose']}),_0x1ba238=_0x543619[_0x1971b7(0x168)];return console['error'](_0x1971b7(0x170)+_0x1ba238[_0x1971b7(0x14e)]+_0x1971b7(0x15f)+_0x1ba238['id']),_0x2aac24!==_0x38eecb&&console['error'](_0x1971b7(0x151)+_0x2aac24),await handleSDKOutput([_0x1ba238],_0xde7798),0x0;}}
1
+ const a26_0x23ab82=a26_0x11e6;(function(_0x5e229c,_0x4bf5a9){const _0x3946fc=a26_0x11e6,_0x45b280=_0x5e229c();while(!![]){try{const _0x29960e=-parseInt(_0x3946fc(0x1a7))/0x1+-parseInt(_0x3946fc(0x190))/0x2+parseInt(_0x3946fc(0x188))/0x3+-parseInt(_0x3946fc(0x191))/0x4*(parseInt(_0x3946fc(0x18f))/0x5)+parseInt(_0x3946fc(0x1a0))/0x6*(parseInt(_0x3946fc(0x193))/0x7)+-parseInt(_0x3946fc(0x177))/0x8+-parseInt(_0x3946fc(0x192))/0x9*(-parseInt(_0x3946fc(0x189))/0xa);if(_0x29960e===_0x4bf5a9)break;else _0x45b280['push'](_0x45b280['shift']());}catch(_0x5aa436){_0x45b280['push'](_0x45b280['shift']());}}}(a26_0x246b,0x498ce));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a26_0x11e6(_0x3c9f3a,_0x1a16fe){_0x3c9f3a=_0x3c9f3a-0x172;const _0x246b24=a26_0x246b();let _0x11e63d=_0x246b24[_0x3c9f3a];return _0x11e63d;}import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';function a26_0x246b(){const _0x54c143=['segmentPath','folder','segments','data','description','43712teNXge','✔\x20Created\x20segment\x20\x27','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','verbose','invisible','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','842328ajekbU','Resolving\x20folder\x20path\x20\x27','Site:\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Resolving\x20folder\x20\x27','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','segment','\x20\x20\x20Path:\x20','Examples:','\x27\x20with\x20ID:\x20','Resolving\x20parent\x20segment\x20\x27','error','name','ruleFile','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','resolveFolderId','site','835935acxaiD','20pmdrCO','Create\x20child\x20segment\x20with\x20filtering\x20rules','resolveParentId','Parent:\x20','Segment\x20name:\x20','Creating\x20segment\x20\x27','35vMpwvt','312982VmoyWc','17468HDgsXG','988974vBvXRB','5929aLlwyg','type','includes','parent','createSegment','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','folderId','yellow','length','Parent\x20path:\x20','\x27...','984mxVeIl','kind'];a26_0x246b=function(){return _0x54c143;};return a26_0x246b();}import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a26_0xb79d68 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a26_0x23ab82(0x183)]='segment:create';[a26_0x23ab82(0x1a6)]=a26_0x23ab82(0x18a);async['execute'](_0x1ec11f){const _0x2f3fd7=a26_0x23ab82;console[_0x2f3fd7(0x182)](a26_0xb79d68['yellow']('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x2f3fd7(0x182)](a26_0xb79d68[_0x2f3fd7(0x19c)](_0x2f3fd7(0x17a)));const {options:_0x393594,args:_0x38a2c8,tdx:_0x244be6}=_0x1ec11f,_0x21eec2=_0x393594;if(_0x38a2c8[_0x2f3fd7(0x19d)]===0x0)return console['error']('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x2f3fd7(0x182)](_0x2f3fd7(0x173)),console[_0x2f3fd7(0x182)](_0x2f3fd7(0x17f)),console['error'](_0x2f3fd7(0x185)),console['error'](_0x2f3fd7(0x19a)),console[_0x2f3fd7(0x182)](_0x2f3fd7(0x198)),0x1;const _0x511e1b=_0x38a2c8[0x0],_0x27b863=_0x393594[_0x2f3fd7(0x1a2)];let _0xf475fc=_0x511e1b;_0x27b863&&!_0x511e1b[_0x2f3fd7(0x195)]('/')&&(_0xf475fc=_0x27b863+'/'+_0x511e1b,_0x21eec2[_0x2f3fd7(0x174)]&&console[_0x2f3fd7(0x182)]('Resolved\x20relative\x20path\x20to:\x20'+_0xf475fc));const _0x2b2eff=parsePath(_0xf475fc);if(_0x2b2eff[_0x2f3fd7(0x1a4)]['length']<0x2)return console['error'](_0x2f3fd7(0x17c)),console[_0x2f3fd7(0x182)](_0x2f3fd7(0x199)),0x1;const _0x1f2826=_0x2b2eff[_0x2f3fd7(0x1a4)][0x0],_0x54794e=getBaseName(_0xf475fc),_0x38d7af=getParentPath(_0xf475fc);_0x21eec2['verbose']&&(console[_0x2f3fd7(0x182)](_0x2f3fd7(0x179)+_0x21eec2[_0x2f3fd7(0x187)]),console[_0x2f3fd7(0x182)]('Target\x20path:\x20'+_0xf475fc),console['error'](_0x2f3fd7(0x18c)+_0x1f2826),console[_0x2f3fd7(0x182)](_0x2f3fd7(0x18d)+_0x54794e),console[_0x2f3fd7(0x182)](_0x2f3fd7(0x19e)+_0x38d7af));const _0xd4cebc=await withSpinner(_0x2f3fd7(0x181)+_0x1f2826+_0x2f3fd7(0x19f),()=>_0x244be6[_0x2f3fd7(0x17d)][_0x2f3fd7(0x18b)](_0x1f2826),{'verbose':_0x21eec2[_0x2f3fd7(0x174)]}),_0x14ffb0=_0xd4cebc[_0x2f3fd7(0x1a5)];let _0x4b125c;if(_0x2b2eff['segments'][_0x2f3fd7(0x19d)]>0x2){const _0x2b94ec=await withSpinner(_0x2f3fd7(0x178)+_0x38d7af+_0x2f3fd7(0x19f),()=>_0x244be6['segment']['resolvePathToResource'](_0x38d7af),{'verbose':_0x21eec2[_0x2f3fd7(0x174)]}),_0x27604c=_0x2b94ec[_0x2f3fd7(0x1a5)];if(_0x27604c[_0x2f3fd7(0x194)]!==_0x2f3fd7(0x1a3)&&_0x27604c[_0x2f3fd7(0x194)]!==_0x2f3fd7(0x196))return console[_0x2f3fd7(0x182)](_0x2f3fd7(0x176)),0x1;_0x4b125c=_0x27604c[_0x2f3fd7(0x19b)];}else{if(_0x21eec2['folder']){const _0x1c9efc=await withSpinner(_0x2f3fd7(0x17b)+_0x21eec2[_0x2f3fd7(0x1a3)]+'\x27...',()=>_0x244be6[_0x2f3fd7(0x17d)][_0x2f3fd7(0x186)](_0x14ffb0,_0x21eec2[_0x2f3fd7(0x1a3)]),{'verbose':_0x21eec2[_0x2f3fd7(0x174)]});_0x4b125c=_0x1c9efc[_0x2f3fd7(0x1a5)];}}_0x21eec2['verbose']&&_0x4b125c&&console['error']('Resolved\x20folder\x20ID:\x20'+_0x4b125c);const _0x47a826=await loadJSONFromOptions(_0x21eec2['rule'],_0x21eec2[_0x2f3fd7(0x184)]),_0x5d6b52={'name':_0x54794e,'description':_0x21eec2['description'],'rule':_0x47a826,'kind':_0x21eec2[_0x2f3fd7(0x1a1)]!==undefined?parseInt(_0x21eec2[_0x2f3fd7(0x1a1)],0xa):undefined,'isVisible':_0x21eec2[_0x2f3fd7(0x175)]?![]:undefined,'segmentFolderId':_0x4b125c,'countPopulation':_0x21eec2['noCountPopulation']?![]:undefined},_0x3186d5=await withSpinner(_0x2f3fd7(0x18e)+_0x54794e+_0x2f3fd7(0x19f),()=>_0x244be6[_0x2f3fd7(0x17d)][_0x2f3fd7(0x197)](_0x14ffb0,_0x5d6b52),{'verbose':_0x21eec2[_0x2f3fd7(0x174)]}),_0x1eaea4=_0x3186d5[_0x2f3fd7(0x1a5)];return console[_0x2f3fd7(0x182)](_0x2f3fd7(0x172)+_0x1eaea4[_0x2f3fd7(0x183)]+_0x2f3fd7(0x180)+_0x1eaea4['id']),_0xf475fc!==_0x511e1b&&console[_0x2f3fd7(0x182)](_0x2f3fd7(0x17e)+_0xf475fc),await handleSDKOutput([_0x1eaea4],_0x21eec2),0x0;}}
@@ -1 +1 @@
1
- const a27_0x3a9cf0=a27_0x3a44;(function(_0x57779f,_0x36d96b){const _0x53c33d=a27_0x3a44,_0x38bd45=_0x57779f();while(!![]){try{const _0x4dd21f=-parseInt(_0x53c33d(0xc2))/0x1*(parseInt(_0x53c33d(0xb5))/0x2)+-parseInt(_0x53c33d(0xb3))/0x3+-parseInt(_0x53c33d(0xc4))/0x4*(parseInt(_0x53c33d(0xbc))/0x5)+parseInt(_0x53c33d(0xb6))/0x6*(parseInt(_0x53c33d(0xc0))/0x7)+parseInt(_0x53c33d(0xb4))/0x8+parseInt(_0x53c33d(0xc1))/0x9+-parseInt(_0x53c33d(0xc7))/0xa*(-parseInt(_0x53c33d(0xc6))/0xb);if(_0x4dd21f===_0x36d96b)break;else _0x38bd45['push'](_0x38bd45['shift']());}catch(_0x258e0c){_0x38bd45['push'](_0x38bd45['shift']());}}}(a27_0x42f0,0x6fefc));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a27_0x42f0(){const _0x300db1=['7195600eZSrhp','2IKbtCt','70458pRcJUb','\x27...','✔\x20Found\x20','\x20field','segment','length','10bkqEhS','data','execute','jsonl','329MBrMZn','1045242cxjFIg','417938odzcSQ','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','1372576lYoRZD','Listing\x20fields\x20for\x20\x27','174911sedxaA','380znipnY','Error:\x20Parent\x20segment\x20name\x20is\x20required','verbose','parentSegment','error','Parent\x20segment:\x20','site','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','listFields','1827087cNHGCv'];a27_0x42f0=function(){return _0x300db1;};return a27_0x42f0();}import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';function a27_0x3a44(_0x4644c6,_0x48de83){_0x4644c6=_0x4644c6-0xb3;const _0x42f0e6=a27_0x42f0();let _0x3a443f=_0x42f0e6[_0x4644c6];return _0x3a443f;}export class SegmentFieldsCommand extends BaseCommand{['name']='segment:fields';['description']='List\x20available\x20fields\x20for\x20segmentation';async[a27_0x3a9cf0(0xbe)](_0x1ec4d1){const _0x91c8be=a27_0x3a9cf0,{options:_0x24cebb,args:_0x261bea,tdx:_0x1fde2a}=_0x1ec4d1,_0x188359=_0x261bea[0x0]||_0x24cebb[_0x91c8be(0xca)];if(!_0x188359)return console[_0x91c8be(0xcb)](_0x91c8be(0xc8)),console[_0x91c8be(0xcb)](_0x91c8be(0xce)),console[_0x91c8be(0xcb)](_0x91c8be(0xc3)),0x1;_0x24cebb[_0x91c8be(0xc9)]&&(console[_0x91c8be(0xcb)]('Site:\x20'+_0x24cebb[_0x91c8be(0xcd)]),console[_0x91c8be(0xcb)](_0x91c8be(0xcc)+_0x188359));const _0x3f5dae=await withSpinner(_0x91c8be(0xc5)+_0x188359+_0x91c8be(0xb7),()=>_0x1fde2a[_0x91c8be(0xba)][_0x91c8be(0xcf)](_0x188359),{'verbose':_0x24cebb['verbose']}),_0x24ed1d=_0x3f5dae[_0x91c8be(0xbd)];console[_0x91c8be(0xcb)](_0x91c8be(0xb8)+_0x24ed1d[_0x91c8be(0xbb)]+_0x91c8be(0xb9)+(_0x24ed1d['length']!==0x1?'s':''));if(_0x24cebb['json']||_0x24cebb[_0x91c8be(0xbf)])return await handleSDKOutput(_0x24ed1d,_0x24cebb),0x0;return displayFieldsHumanReadable(_0x24ed1d,_0x188359),0x0;}}
1
+ const a27_0x1ca03e=a27_0x3ecc;(function(_0x6b4b02,_0x4057a5){const _0x49f187=a27_0x3ecc,_0x3e0207=_0x6b4b02();while(!![]){try{const _0xb3d5e2=-parseInt(_0x49f187(0x11f))/0x1+-parseInt(_0x49f187(0x122))/0x2+-parseInt(_0x49f187(0x127))/0x3+-parseInt(_0x49f187(0x12a))/0x4+-parseInt(_0x49f187(0x131))/0x5*(parseInt(_0x49f187(0x12b))/0x6)+parseInt(_0x49f187(0x12e))/0x7+parseInt(_0x49f187(0x11d))/0x8;if(_0xb3d5e2===_0x4057a5)break;else _0x3e0207['push'](_0x3e0207['shift']());}catch(_0x569e7f){_0x3e0207['push'](_0x3e0207['shift']());}}}(a27_0x2ab6,0x25c66));function a27_0x2ab6(){const _0x27250e=['51160CEcBxn','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','segment:fields','87980icPifZ','description','Listing\x20fields\x20for\x20\x27','jsonl','error','284520NKCTlo','Site:\x20','verbose','280220qHNiwG','229818MziAKE','site','List\x20available\x20fields\x20for\x20segmentation','1136016JOLMRc','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','name','5lxzdmQ','\x20field','Parent\x20segment:\x20','parentSegment','✔\x20Found\x20','\x27...','2326288ywFMIL','Error:\x20Parent\x20segment\x20name\x20is\x20required'];a27_0x2ab6=function(){return _0x27250e;};return a27_0x2ab6();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a27_0x3ecc(_0x1b1658,_0xa9c0a3){_0x1b1658=_0x1b1658-0x11a;const _0x2ab6f8=a27_0x2ab6();let _0x3ecce2=_0x2ab6f8[_0x1b1658];return _0x3ecce2;}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a27_0x1ca03e(0x130)]=a27_0x1ca03e(0x121);[a27_0x1ca03e(0x123)]=a27_0x1ca03e(0x12d);async['execute'](_0x38c021){const _0x4e25c1=a27_0x1ca03e,{options:_0x3bfb3d,args:_0x48892c,tdx:_0x817703}=_0x38c021,_0x27950b=_0x48892c[0x0]||_0x3bfb3d[_0x4e25c1(0x11a)];if(!_0x27950b)return console['error'](_0x4e25c1(0x11e)),console[_0x4e25c1(0x126)](_0x4e25c1(0x12f)),console[_0x4e25c1(0x126)](_0x4e25c1(0x120)),0x1;_0x3bfb3d[_0x4e25c1(0x129)]&&(console[_0x4e25c1(0x126)](_0x4e25c1(0x128)+_0x3bfb3d[_0x4e25c1(0x12c)]),console[_0x4e25c1(0x126)](_0x4e25c1(0x133)+_0x27950b));const _0x3bc704=await withSpinner(_0x4e25c1(0x124)+_0x27950b+_0x4e25c1(0x11c),()=>_0x817703['segment']['listFields'](_0x27950b),{'verbose':_0x3bfb3d['verbose']}),_0x418085=_0x3bc704['data'];console[_0x4e25c1(0x126)](_0x4e25c1(0x11b)+_0x418085['length']+_0x4e25c1(0x132)+(_0x418085['length']!==0x1?'s':''));if(_0x3bfb3d['json']||_0x3bfb3d[_0x4e25c1(0x125)])return await handleSDKOutput(_0x418085,_0x3bfb3d),0x0;return displayFieldsHumanReadable(_0x418085,_0x27950b),0x0;}}
@@ -1 +1 @@
1
- const a28_0x186962=a28_0x3bcb;(function(_0x146014,_0x17a4c3){const _0x10c1a3=a28_0x3bcb,_0x2fafc1=_0x146014();while(!![]){try{const _0x3bdc64=-parseInt(_0x10c1a3(0x1ed))/0x1+-parseInt(_0x10c1a3(0x1d8))/0x2+parseInt(_0x10c1a3(0x1cd))/0x3*(-parseInt(_0x10c1a3(0x1d7))/0x4)+parseInt(_0x10c1a3(0x1c5))/0x5+parseInt(_0x10c1a3(0x1c0))/0x6*(parseInt(_0x10c1a3(0x1b5))/0x7)+parseInt(_0x10c1a3(0x1f5))/0x8*(-parseInt(_0x10c1a3(0x1b3))/0x9)+parseInt(_0x10c1a3(0x1e3))/0xa;if(_0x3bdc64===_0x17a4c3)break;else _0x2fafc1['push'](_0x2fafc1['shift']());}catch(_0x11681b){_0x2fafc1['push'](_0x2fafc1['shift']());}}}(a28_0x33a9,0xe7267));function a28_0x33a9(){const _0x31b33e=['green','absolutePath','\x27...','description','length','\x20new\x20files','94230DjIwwq','Error:\x20','7QPPpWK','dryRun','files','red','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','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)','cwd','helpText','verbose','isNew','\x0aChanges\x20to\x20\x27','1331238VqcELX','type','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','utf-8','errorCode','2292945WydFjv','\x20journeys','resourceName','hasChanges','journeys','counts','journeyVersions','parent_segment','3nSDkNm','\x20versions)','Pulling\x20segments\x20from\x20\x27','error','\x20files\x20to\x20','session','targetDir','diff','Write\x20','Target\x20resource:\x20','7457780tinIRQ','2183120dzbadV','setPhase','pullSegments','parentName','relativePath','no_parent','dim','\x0aPull\x20summary\x20for\x20\x27','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','✔\x20Context\x20set:\x20','segment','55449830bNUObs','content','cyan','yes','repeat','segments','site','✔\x20Pulled\x20','\x20=\x20','yellow','1129069mhYwAH','\x20activations','\x20with\x20','Site:\x20','execute','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','Parent\x20segment:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','912qSlxSN','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','filter'];a28_0x33a9=function(){return _0x31b33e;};return a28_0x33a9();}import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a28_0x38b1f5 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a28_0x16e467 from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';function a28_0x3bcb(_0x5395d9,_0x36b32c){_0x5395d9=_0x5395d9-0x1af;const _0x33a905=a28_0x33a9();let _0x3bcb03=_0x33a905[_0x5395d9];return _0x3bcb03;}export class SegmentPullCommand extends BaseCommand{['name']='segment:pull';[a28_0x186962(0x1b0)]=a28_0x186962(0x1b9);async[a28_0x186962(0x1f1)](_0x268d35){const _0x482428=a28_0x186962,{options:_0x54220e,args:_0x12d9c7,tdx:_0x20cf7f}=_0x268d35,_0x16893e=_0x54220e,_0x5a4467=await resolveTarget({'arg':_0x12d9c7[0x0],'contextParent':_0x54220e['parentSegment'],'cwd':process[_0x482428(0x1bb)]()});if(!isSuccessfulResolution(_0x5a4467))return _0x5a4467[_0x482428(0x1c4)]===_0x482428(0x1dd)?(console[_0x482428(0x1d0)](a28_0x38b1f5[_0x482428(0x1ec)](_0x482428(0x1e0))),console[_0x482428(0x1d0)](_0x482428(0x1ba)),console[_0x482428(0x1d0)](_0x482428(0x1f6)),console[_0x482428(0x1d0)](_0x482428(0x1f4))):(console[_0x482428(0x1d0)](a28_0x38b1f5[_0x482428(0x1b8)](_0x482428(0x1b4)+_0x5a4467['message']+'\x0a')),_0x5a4467[_0x482428(0x1bc)]&&console['error'](a28_0x38b1f5[_0x482428(0x1e5)](_0x5a4467[_0x482428(0x1bc)]))),0x1;const _0x29cb66=_0x5a4467['parentName'],_0x12de62=_0x5a4467[_0x482428(0x1d3)],_0xc3ee40=_0x5a4467[_0x482428(0x1c1)]==='file'?_0x5a4467[_0x482428(0x1c7)]:undefined;_0x16893e['verbose']&&(console[_0x482428(0x1d0)](_0x482428(0x1f0)+_0x16893e[_0x482428(0x1e9)]),console['error'](_0x482428(0x1f3)+_0x29cb66),_0xc3ee40&&console[_0x482428(0x1d0)](_0x482428(0x1d6)+_0xc3ee40));const _0x3170b0=await withProgressSpinner(_0x482428(0x1cf)+_0x29cb66+_0x482428(0x1af),_0x1c46fa=>_0x20cf7f[_0x482428(0x1e2)][_0x482428(0x1da)](_0x29cb66,{'targetDir':_0x12de62,'targetResourceName':_0xc3ee40,'verbose':_0x16893e[_0x482428(0x1bd)],'progress':{'update':_0x38c710=>{const _0x3da44c=_0x482428;_0x1c46fa[_0x3da44c(0x1d9)](_0x38c710),_0x16893e[_0x3da44c(0x1bd)]&&console[_0x3da44c(0x1d0)]('\x20\x20'+_0x38c710);}}}),{'verbose':_0x16893e[_0x482428(0x1bd)]}),_0x5bc43c=_0x3170b0['data'];if(_0x5bc43c['counts']['segments']===0x0&&_0x5bc43c[_0x482428(0x1ca)]['journeys']===0x0)return console[_0x482428(0x1d0)](a28_0x38b1f5[_0x482428(0x1ec)](_0x482428(0x1c2)+_0x5bc43c[_0x482428(0x1db)]+'\x27')),0x0;const _0x30716c=_0x5bc43c[_0x482428(0x1b7)]['filter'](_0x54f966=>_0x54f966[_0x482428(0x1be)]),_0x4a5585=_0x5bc43c[_0x482428(0x1b7)][_0x482428(0x1f7)](_0x2ba9f6=>!_0x2ba9f6['isNew']&&_0x2ba9f6[_0x482428(0x1c8)]),_0x462f94=_0x5bc43c[_0x482428(0x1b7)]['filter'](_0x1b2e19=>!_0x1b2e19[_0x482428(0x1be)]&&!_0x1b2e19[_0x482428(0x1c8)]);console[_0x482428(0x1d0)](_0x482428(0x1df)+_0x5bc43c[_0x482428(0x1db)]+'\x27:'),console[_0x482428(0x1d0)]('\x20\x20🎯\x20'+a28_0x38b1f5[_0x482428(0x1e5)](_0x5bc43c[_0x482428(0x1ca)][_0x482428(0x1e8)]+'\x20segments')+_0x482428(0x1ef)+a28_0x38b1f5[_0x482428(0x1e5)](_0x5bc43c[_0x482428(0x1ca)]['activations']+_0x482428(0x1ee)));if(_0x5bc43c[_0x482428(0x1ca)][_0x482428(0x1c9)]>0x0){const _0x22a506=_0x5bc43c[_0x482428(0x1ca)][_0x482428(0x1cb)]>_0x5bc43c[_0x482428(0x1ca)][_0x482428(0x1c9)]?'\x20('+_0x5bc43c[_0x482428(0x1ca)][_0x482428(0x1cb)]+_0x482428(0x1ce):'';console['error']('\x20\x20🗺️\x20\x20'+a28_0x38b1f5[_0x482428(0x1e5)](_0x5bc43c[_0x482428(0x1ca)][_0x482428(0x1c9)]+_0x482428(0x1c6))+a28_0x38b1f5[_0x482428(0x1de)](_0x22a506));}console[_0x482428(0x1d0)]('\x20\x20'+a28_0x38b1f5[_0x482428(0x1f8)]('+\x20'+_0x30716c[_0x482428(0x1b1)]+_0x482428(0x1b2))),console[_0x482428(0x1d0)]('\x20\x20'+a28_0x38b1f5['yellow']('~\x20'+_0x4a5585['length']+'\x20changed\x20files')),console[_0x482428(0x1d0)]('\x20\x20'+a28_0x38b1f5[_0x482428(0x1de)]('=\x20'+_0x462f94[_0x482428(0x1b1)]+'\x20unchanged\x20files')),console[_0x482428(0x1d0)]('\x20\x20Target:\x20'+a28_0x38b1f5[_0x482428(0x1e5)](_0x5bc43c['targetDir'])+'\x0a');if(_0x4a5585['length']>0x0)for(const _0x382bf5 of _0x4a5585){console['error'](_0x482428(0x1bf)+_0x382bf5[_0x482428(0x1dc)]+'\x27:'),console[_0x482428(0x1d0)]('─'[_0x482428(0x1e7)](0x3c)),console['error'](_0x382bf5[_0x482428(0x1d4)]),console[_0x482428(0x1d0)]('─'['repeat'](0x3c));}if(_0x16893e[_0x482428(0x1b6)])return console[_0x482428(0x1d0)](a28_0x38b1f5['yellow'](_0x482428(0x1f2))),0x0;if(_0x30716c[_0x482428(0x1b1)]===0x0&&_0x4a5585[_0x482428(0x1b1)]===0x0)return console['error'](a28_0x38b1f5[_0x482428(0x1f8)]('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x5bc43c['parentName']},_0x16893e[_0x482428(0x1d2)]),console[_0x482428(0x1d0)](a28_0x38b1f5[_0x482428(0x1f8)]('✔\x20Context\x20set:\x20'+a28_0x38b1f5[_0x482428(0x1de)](_0x482428(0x1cc))+_0x482428(0x1eb)+a28_0x38b1f5['cyan'](_0x5bc43c[_0x482428(0x1db)]))),0x0;if(!_0x16893e[_0x482428(0x1e6)]){const _0x59fdc8=await confirmKey(_0x482428(0x1d5)+(_0x30716c[_0x482428(0x1b1)]+_0x4a5585[_0x482428(0x1b1)])+'\x20files?');if(!_0x59fdc8)return console[_0x482428(0x1d0)]('Aborted.'),0x1;}for(const _0xcc3b87 of _0x5bc43c['files']){if(_0xcc3b87[_0x482428(0x1be)]||_0xcc3b87[_0x482428(0x1c8)]){const _0x2f9168=a28_0x16e467['dirname'](_0xcc3b87['absolutePath']);!existsSync(_0x2f9168)&&mkdirSync(_0x2f9168,{'recursive':!![]}),writeFileSync(_0xcc3b87[_0x482428(0x1f9)],_0xcc3b87[_0x482428(0x1e4)],_0x482428(0x1c3));}}return console[_0x482428(0x1d0)](a28_0x38b1f5[_0x482428(0x1f8)](_0x482428(0x1ea)+(_0x30716c[_0x482428(0x1b1)]+_0x4a5585[_0x482428(0x1b1)])+_0x482428(0x1d1)+_0x5bc43c[_0x482428(0x1d3)])),saveSessionContext({'parent_segment':_0x5bc43c[_0x482428(0x1db)]},_0x16893e[_0x482428(0x1d2)]),console['error'](a28_0x38b1f5['green'](_0x482428(0x1e1)+a28_0x38b1f5[_0x482428(0x1de)](_0x482428(0x1cc))+_0x482428(0x1eb)+a28_0x38b1f5['cyan'](_0x5bc43c[_0x482428(0x1db)]))),0x0;}}
1
+ const a28_0x897b72=a28_0x2d36;(function(_0x50baed,_0x230cc3){const _0x4050ae=a28_0x2d36,_0x3c427c=_0x50baed();while(!![]){try{const _0x360efd=parseInt(_0x4050ae(0x1a2))/0x1+parseInt(_0x4050ae(0x1a3))/0x2+parseInt(_0x4050ae(0x1c8))/0x3*(-parseInt(_0x4050ae(0x198))/0x4)+parseInt(_0x4050ae(0x1bc))/0x5+parseInt(_0x4050ae(0x1ab))/0x6*(parseInt(_0x4050ae(0x1d4))/0x7)+parseInt(_0x4050ae(0x1c7))/0x8*(-parseInt(_0x4050ae(0x1aa))/0x9)+-parseInt(_0x4050ae(0x1c6))/0xa;if(_0x360efd===_0x230cc3)break;else _0x3c427c['push'](_0x3c427c['shift']());}catch(_0x65b654){_0x3c427c['push'](_0x3c427c['shift']());}}}(a28_0x2e76,0xa0b1b));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey}from'../utils/prompt.js';function a28_0x2d36(_0x57e224,_0x5983e4){_0x57e224=_0x57e224-0x194;const _0x2e76b1=a28_0x2e76();let _0x2d3622=_0x2e76b1[_0x57e224];return _0x2d3622;}function a28_0x2e76(){const _0x2b8aa2=['absolutePath','dirname','568736kxImcs','1401162cEUrcD','Site:\x20','setPhase','no_parent','helpText','yellow','segment','891342AEUyZC','2706cFgxmn','description','Write\x20','\x20changed\x20files','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','isNew','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','diff','parentName','\x0aChanges\x20to\x20\x27','file','cyan','data','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','\x20activations','utf-8','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','946075rzpkXp','message','resourceName','Parent\x20segment:\x20','length','errorCode','journeys','content','\x20=\x20','relativePath','13666110nrjvAi','8iCeDeT','175605sqRzsV','\x20new\x20files','counts','green','\x20with\x20','\x20unchanged\x20files','red','✔\x20Pulled\x20','files','pullSegments','\x20files\x20to\x20','\x20\x20Target:\x20','11235icPjdP','targetDir','\x0aPull\x20summary\x20for\x20\x27','error','✔\x20All\x20files\x20are\x20up\x20to\x20date','site','Pulling\x20segments\x20from\x20\x27','\x20journeys','✔\x20Context\x20set:\x20','verbose','journeyVersions','\x20versions)','Target\x20resource:\x20','repeat','filter','\x20\x20🎯\x20','Aborted.','4RuktxK','\x27...','hasChanges','type','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)','Error:\x20','dim','segments'];a28_0x2e76=function(){return _0x2b8aa2;};return a28_0x2e76();}import{saveSessionContext}from'../core/session.js';import a28_0x12f19e from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a28_0x5e97f9 from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';export class SegmentPullCommand extends BaseCommand{['name']='segment:pull';[a28_0x897b72(0x1ac)]='Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files';async['execute'](_0x1aa3f0){const _0x597e3f=a28_0x897b72,{options:_0x196512,args:_0x350c73,tdx:_0x1a0afe}=_0x1aa3f0,_0x7f9bde=_0x196512,_0x4e57bf=await resolveTarget({'arg':_0x350c73[0x0],'contextParent':_0x196512['parentSegment'],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x4e57bf))return _0x4e57bf[_0x597e3f(0x1c1)]===_0x597e3f(0x1a6)?(console[_0x597e3f(0x1d7)](a28_0x12f19e[_0x597e3f(0x1a8)](_0x597e3f(0x1b1))),console['error'](_0x597e3f(0x19c)),console[_0x597e3f(0x1d7)](_0x597e3f(0x1bb)),console[_0x597e3f(0x1d7)]('\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[_0x597e3f(0x1d7)](a28_0x12f19e[_0x597e3f(0x1ce)](_0x597e3f(0x19d)+_0x4e57bf[_0x597e3f(0x1bd)]+'\x0a')),_0x4e57bf[_0x597e3f(0x1a7)]&&console[_0x597e3f(0x1d7)](a28_0x12f19e[_0x597e3f(0x1b6)](_0x4e57bf['helpText']))),0x1;const _0x52e995=_0x4e57bf['parentName'],_0x2b0833=_0x4e57bf[_0x597e3f(0x1d5)],_0x48330e=_0x4e57bf[_0x597e3f(0x19b)]===_0x597e3f(0x1b5)?_0x4e57bf[_0x597e3f(0x1be)]:undefined;_0x7f9bde['verbose']&&(console['error'](_0x597e3f(0x1a4)+_0x7f9bde[_0x597e3f(0x1d9)]),console[_0x597e3f(0x1d7)](_0x597e3f(0x1bf)+_0x52e995),_0x48330e&&console['error'](_0x597e3f(0x1e0)+_0x48330e));const _0x2d644e=await withProgressSpinner(_0x597e3f(0x1da)+_0x52e995+_0x597e3f(0x199),_0x3f7b5c=>_0x1a0afe[_0x597e3f(0x1a9)][_0x597e3f(0x1d1)](_0x52e995,{'targetDir':_0x2b0833,'targetResourceName':_0x48330e,'verbose':_0x7f9bde[_0x597e3f(0x1dd)],'progress':{'update':_0x562042=>{const _0x5a4355=_0x597e3f;_0x3f7b5c[_0x5a4355(0x1a5)](_0x562042),_0x7f9bde['verbose']&&console[_0x5a4355(0x1d7)]('\x20\x20'+_0x562042);}}}),{'verbose':_0x7f9bde['verbose']}),_0x1e10a2=_0x2d644e[_0x597e3f(0x1b7)];if(_0x1e10a2['counts'][_0x597e3f(0x19f)]===0x0&&_0x1e10a2[_0x597e3f(0x1ca)][_0x597e3f(0x1c2)]===0x0)return console[_0x597e3f(0x1d7)](a28_0x12f19e[_0x597e3f(0x1a8)](_0x597e3f(0x1af)+_0x1e10a2[_0x597e3f(0x1b3)]+'\x27')),0x0;const _0x52465e=_0x1e10a2[_0x597e3f(0x1d0)]['filter'](_0x2edfd6=>_0x2edfd6[_0x597e3f(0x1b0)]),_0x30388c=_0x1e10a2[_0x597e3f(0x1d0)][_0x597e3f(0x195)](_0x14e223=>!_0x14e223[_0x597e3f(0x1b0)]&&_0x14e223[_0x597e3f(0x19a)]),_0x332954=_0x1e10a2[_0x597e3f(0x1d0)][_0x597e3f(0x195)](_0x17c246=>!_0x17c246[_0x597e3f(0x1b0)]&&!_0x17c246[_0x597e3f(0x19a)]);console[_0x597e3f(0x1d7)](_0x597e3f(0x1d6)+_0x1e10a2[_0x597e3f(0x1b3)]+'\x27:'),console[_0x597e3f(0x1d7)](_0x597e3f(0x196)+a28_0x12f19e['cyan'](_0x1e10a2['counts']['segments']+'\x20segments')+_0x597e3f(0x1cc)+a28_0x12f19e['cyan'](_0x1e10a2[_0x597e3f(0x1ca)]['activations']+_0x597e3f(0x1b9)));if(_0x1e10a2[_0x597e3f(0x1ca)][_0x597e3f(0x1c2)]>0x0){const _0x13bc11=_0x1e10a2[_0x597e3f(0x1ca)][_0x597e3f(0x1de)]>_0x1e10a2['counts'][_0x597e3f(0x1c2)]?'\x20('+_0x1e10a2[_0x597e3f(0x1ca)][_0x597e3f(0x1de)]+_0x597e3f(0x1df):'';console[_0x597e3f(0x1d7)]('\x20\x20🗺️\x20\x20'+a28_0x12f19e[_0x597e3f(0x1b6)](_0x1e10a2[_0x597e3f(0x1ca)][_0x597e3f(0x1c2)]+_0x597e3f(0x1db))+a28_0x12f19e['dim'](_0x13bc11));}console[_0x597e3f(0x1d7)]('\x20\x20'+a28_0x12f19e[_0x597e3f(0x1cb)]('+\x20'+_0x52465e[_0x597e3f(0x1c0)]+_0x597e3f(0x1c9))),console[_0x597e3f(0x1d7)]('\x20\x20'+a28_0x12f19e[_0x597e3f(0x1a8)]('~\x20'+_0x30388c[_0x597e3f(0x1c0)]+_0x597e3f(0x1ae))),console[_0x597e3f(0x1d7)]('\x20\x20'+a28_0x12f19e[_0x597e3f(0x19e)]('=\x20'+_0x332954[_0x597e3f(0x1c0)]+_0x597e3f(0x1cd))),console[_0x597e3f(0x1d7)](_0x597e3f(0x1d3)+a28_0x12f19e[_0x597e3f(0x1b6)](_0x1e10a2['targetDir'])+'\x0a');if(_0x30388c[_0x597e3f(0x1c0)]>0x0)for(const _0x5ba79 of _0x30388c){console['error'](_0x597e3f(0x1b4)+_0x5ba79[_0x597e3f(0x1c5)]+'\x27:'),console[_0x597e3f(0x1d7)]('─'['repeat'](0x3c)),console[_0x597e3f(0x1d7)](_0x5ba79[_0x597e3f(0x1b2)]),console[_0x597e3f(0x1d7)]('─'[_0x597e3f(0x194)](0x3c));}if(_0x7f9bde['dryRun'])return console[_0x597e3f(0x1d7)](a28_0x12f19e[_0x597e3f(0x1a8)](_0x597e3f(0x1b8))),0x0;if(_0x52465e[_0x597e3f(0x1c0)]===0x0&&_0x30388c[_0x597e3f(0x1c0)]===0x0)return console['error'](a28_0x12f19e[_0x597e3f(0x1cb)](_0x597e3f(0x1d8))),saveSessionContext({'parent_segment':_0x1e10a2[_0x597e3f(0x1b3)]},_0x7f9bde['session']),console[_0x597e3f(0x1d7)](a28_0x12f19e['green'](_0x597e3f(0x1dc)+a28_0x12f19e['dim']('parent_segment')+'\x20=\x20'+a28_0x12f19e[_0x597e3f(0x1b6)](_0x1e10a2[_0x597e3f(0x1b3)]))),0x0;if(!_0x7f9bde['yes']){const _0x49b3f9=await confirmKey(_0x597e3f(0x1ad)+(_0x52465e[_0x597e3f(0x1c0)]+_0x30388c[_0x597e3f(0x1c0)])+'\x20files?');if(!_0x49b3f9)return console[_0x597e3f(0x1d7)](_0x597e3f(0x197)),0x1;}for(const _0x3cfb7d of _0x1e10a2[_0x597e3f(0x1d0)]){if(_0x3cfb7d[_0x597e3f(0x1b0)]||_0x3cfb7d['hasChanges']){const _0x28428f=a28_0x5e97f9[_0x597e3f(0x1a1)](_0x3cfb7d[_0x597e3f(0x1a0)]);!existsSync(_0x28428f)&&mkdirSync(_0x28428f,{'recursive':!![]}),writeFileSync(_0x3cfb7d['absolutePath'],_0x3cfb7d[_0x597e3f(0x1c3)],_0x597e3f(0x1ba));}}return console[_0x597e3f(0x1d7)](a28_0x12f19e[_0x597e3f(0x1cb)](_0x597e3f(0x1cf)+(_0x52465e[_0x597e3f(0x1c0)]+_0x30388c[_0x597e3f(0x1c0)])+_0x597e3f(0x1d2)+_0x1e10a2[_0x597e3f(0x1d5)])),saveSessionContext({'parent_segment':_0x1e10a2[_0x597e3f(0x1b3)]},_0x7f9bde['session']),console[_0x597e3f(0x1d7)](a28_0x12f19e[_0x597e3f(0x1cb)](_0x597e3f(0x1dc)+a28_0x12f19e[_0x597e3f(0x19e)]('parent_segment')+_0x597e3f(0x1c4)+a28_0x12f19e['cyan'](_0x1e10a2['parentName']))),0x0;}}
@@ -1 +1 @@
1
- const a29_0x59cde6=a29_0x229b;(function(_0x20bf58,_0x46f8c3){const _0x1c4689=a29_0x229b,_0x23aef4=_0x20bf58();while(!![]){try{const _0x1288ee=parseInt(_0x1c4689(0x15b))/0x1+-parseInt(_0x1c4689(0x129))/0x2+-parseInt(_0x1c4689(0x109))/0x3+parseInt(_0x1c4689(0x15e))/0x4+-parseInt(_0x1c4689(0x137))/0x5*(parseInt(_0x1c4689(0x136))/0x6)+parseInt(_0x1c4689(0xdd))/0x7+parseInt(_0x1c4689(0x110))/0x8*(parseInt(_0x1c4689(0x152))/0x9);if(_0x1288ee===_0x46f8c3)break;else _0x23aef4['push'](_0x23aef4['shift']());}catch(_0x414fbd){_0x23aef4['push'](_0x23aef4['shift']());}}}(a29_0x1cbb,0xc7449));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a29_0x3d1326 from'chalk';import{existsSync}from'fs';function a29_0x1cbb(){const _0x2347d3=['\x0aPush\x20summary\x20for\x20\x27','\x20to\x20update','600XfXPIr','12665xlsFkF','Error:\x20','getOutputSchemaWithCache','\x20\x20Activations:','verbose','delete','activations','toDelete','get','new','journeyId','\x20deleted','nameToType','error','results','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','audienceId','createdSegmentIds','listActivations','unchanged','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','parentFolder','folderPath','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','all','join','file','8361ccilpy','getParent','No\x20','length','\x20new','connection','Scoped\x20to\x20folder:\x20','user','add','1587296eICXBC','Changes\x20to\x20journey:','no_parent','4860040wpMQMd','(Journey\x20will\x20be\x20deleted)','then','\x20to\x20create','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','buildUserMaps','getJourney','idToName','createdAt','segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','repeat','Fetching\x20existing\x20folders...','\x0a✔\x20Push\x20complete','.yaml','toCreate','red','\x20changed','yamlConfig','\x20\x20\x20\x20','journeyBundleId','map','\x20\x20Journeys:\x20','site','resolveParentId','filter','scopedFolderPath','3112830aNWQfv','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','\x0aValidation\x20failed:','message','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','dryRun','New\x20segment:','existingJourney','deleted','Parent\x20segment:\x20','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','list','endsWith','isNew','Fetching\x20existing\x20segments...','listSegments','Fetching\x20connections\x20for\x20name\x20resolution...','Resolving\x20parent\x20segment\x20\x27','updated','nameToId','\x20folders\x20to\x20create','\x20\x20Source:\x20','\x27...','state','type','filePath','helpText','journey','setPhase','data','journeysOnly','push','journeys','Push\x20','blue','attributes','Delete\x20segment:','\x20activations]','green','segments','errorCode','\x20created','updatedAt','segmentFolderId','4774680qsqtsD','\x20to\x20delete','cyan','/j/da/je','execute','\x20\x20📊\x20Segments:','yellow','7376CUsLYh','name','changed','Source\x20directory:\x20','description','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','Error:\x20Directory\x20not\x20found:\x20','Folders\x20to\x20create:','Site:\x20','dim','isScoped','segment\x20or\x20journey','segment:push','Fetching\x20existing\x20journeys...','created','Fetching\x20users\x20for\x20email\x20resolution...','Fetching\x20existing\x20activations...','.yml','parentSegment','\x20unchanged','folders','\x20changes?','\x20\x20Activations:\x20','targetDir','2884946gaRmtJ','journeyBundleName','relationships','diff','\x20YAML\x20files\x20found','set','toUpdate','\x20updated','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','paused','/e/'];a29_0x1cbb=function(){return _0x2347d3;};return a29_0x1cbb();}import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';import{buildFolderMaps}from'../sdk/segment/resolution-context.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';function a29_0x229b(_0x5257ff,_0x325ee2){_0x5257ff=_0x5257ff-0xcd;const _0x1cbb75=a29_0x1cbb();let _0x229b27=_0x1cbb75[_0x5257ff];return _0x229b27;}import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{[a29_0x59cde6(0x111)]=a29_0x59cde6(0x11d);[a29_0x59cde6(0x114)]=a29_0x59cde6(0x115);async[a29_0x59cde6(0x10d)](_0x14ae8a){const _0x4249f8=a29_0x59cde6,{options:_0x43530b,args:_0x4c7cd1,tdx:_0x6c92c5}=_0x14ae8a,_0x29e51d=_0x43530b,_0x96c6e1=await resolveTarget({'arg':_0x4c7cd1[0x0],'contextParent':_0x43530b[_0x4249f8(0x123)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x96c6e1))return _0x96c6e1[_0x4249f8(0x105)]===_0x4249f8(0x15d)?(console[_0x4249f8(0x144)](a29_0x3d1326[_0x4249f8(0x10f)](_0x4249f8(0x14b))),console[_0x4249f8(0x144)]('Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)'),console[_0x4249f8(0x144)](_0x4249f8(0x168)),console[_0x4249f8(0x144)](_0x4249f8(0x116))):(console[_0x4249f8(0x144)](a29_0x3d1326[_0x4249f8(0xd2)](_0x4249f8(0x138)+_0x96c6e1[_0x4249f8(0xe0)]+'\x0a')),_0x96c6e1[_0x4249f8(0xf7)]&&console[_0x4249f8(0x144)](a29_0x3d1326[_0x4249f8(0x10b)](_0x96c6e1['helpText']))),0x1;if(_0x96c6e1[_0x4249f8(0xf5)]==='parent_name')return console[_0x4249f8(0x144)](a29_0x3d1326['red'](_0x4249f8(0x117)+_0x96c6e1[_0x4249f8(0x128)]+'\x0a')),console[_0x4249f8(0x144)](a29_0x3d1326[_0x4249f8(0x10b)](_0x4249f8(0x146))),0x1;const _0x9fe777=_0x96c6e1['parentName'],_0x5d9a03=_0x96c6e1[_0x4249f8(0x128)],_0x2596ca=_0x96c6e1[_0x4249f8(0xf5)]===_0x4249f8(0x151)?_0x96c6e1[_0x4249f8(0xf6)]:undefined,_0x2faa3e=getScopedDetails(_0x96c6e1),_0x46b05e=_0x2faa3e?.[_0x4249f8(0x11b)]??![],_0x5cad96=_0x2faa3e?.[_0x4249f8(0xdc)]??'';if(!existsSync(_0x5d9a03))return console['error'](a29_0x3d1326['red']('Error:\x20Directory\x20not\x20found:\x20'+_0x5d9a03+'\x0a')),console[_0x4249f8(0x144)](a29_0x3d1326[_0x4249f8(0x10b)](_0x4249f8(0x146))),0x1;_0x29e51d[_0x4249f8(0x13b)]&&(console[_0x4249f8(0x144)](_0x4249f8(0x119)+_0x29e51d[_0x4249f8(0xd9)]),console[_0x4249f8(0x144)](_0x4249f8(0xe6)+_0x9fe777),console['error'](_0x4249f8(0x113)+_0x5d9a03),_0x46b05e&&console[_0x4249f8(0x144)](_0x4249f8(0x158)+_0x5cad96));const _0x5d9085=await withSpinner(_0x4249f8(0xee)+_0x9fe777+_0x4249f8(0xf3),()=>_0x6c92c5[_0x4249f8(0x167)][_0x4249f8(0xda)](_0x9fe777),{'verbose':_0x29e51d[_0x4249f8(0x13b)]}),_0x4fd2bf=_0x5d9085[_0x4249f8(0xfa)],[_0x526739,_0xa94930,_0x5ef1bc,_0x59dda0,_0x5e2e1d]=await Promise[_0x4249f8(0x14f)]([withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x6c92c5[_0x4249f8(0x167)][_0x4249f8(0x153)](_0x4fd2bf),{'verbose':_0x29e51d['verbose']}),withSpinner(_0x4249f8(0xeb),()=>_0x6c92c5[_0x4249f8(0x167)][_0x4249f8(0xec)](_0x4fd2bf),{'verbose':_0x29e51d[_0x4249f8(0x13b)]}),withSpinner(_0x4249f8(0xce),()=>_0x6c92c5[_0x4249f8(0x167)]['listFolders'](_0x4fd2bf),{'verbose':_0x29e51d['verbose']}),withSpinner(_0x4249f8(0x11e),()=>_0x6c92c5[_0x4249f8(0xf8)]['listJourneysWithDetailsFromParentSegment'](_0x4fd2bf,{'includeAllVersions':!![]}),{'verbose':_0x29e51d[_0x4249f8(0x13b)]}),withSpinner(_0x4249f8(0x120),()=>_0x6c92c5[_0x4249f8(0x159)][_0x4249f8(0x163)](),{'verbose':_0x29e51d[_0x4249f8(0x13b)]})['then'](_0x2dc2cf=>_0x2dc2cf[_0x4249f8(0xfa)])]),_0x812c45=_0x526739[_0x4249f8(0xfa)],_0x55f0b5=extractRootFolderId(_0x812c45),_0x4b6408=_0xa94930[_0x4249f8(0xfa)],_0xbf3c9d=_0x5ef1bc['data'],{journeys:_0x3c245e,activationStepsById:_0x271470}=_0x59dda0[_0x4249f8(0xfa)],_0x13b423=new Map(_0x3c245e['map'](_0x1808f1=>[_0x1808f1['id'],_0x1808f1])),_0x4d7a85=_0x3c245e['map'](_0x245cc1=>({'id':_0x245cc1['id'],'name':_0x245cc1['attributes']['name'],'journeyBundleName':_0x245cc1[_0x4249f8(0x100)]['journeyBundleName']||'','journeyBundleId':_0x245cc1[_0x4249f8(0x100)][_0x4249f8(0xd6)]||'','versionNumber':_0x245cc1[_0x4249f8(0x100)]['versionNumber'],'description':_0x245cc1[_0x4249f8(0x100)][_0x4249f8(0x114)],'state':_0x245cc1[_0x4249f8(0x100)][_0x4249f8(0xf4)],'paused':_0x245cc1[_0x4249f8(0x100)][_0x4249f8(0x132)],'audienceId':_0x245cc1[_0x4249f8(0x100)][_0x4249f8(0x147)],'folderId':_0x245cc1[_0x4249f8(0x12b)]?.[_0x4249f8(0x14c)]?.[_0x4249f8(0xfa)]?.['id'],'createdAt':_0x245cc1[_0x4249f8(0x100)][_0x4249f8(0x166)],'updatedAt':_0x245cc1['attributes'][_0x4249f8(0x107)]})),{emailToId:_0x1f0df2,idToEmail:_0x531083}=_0x5e2e1d,_0xa43306=await withSpinner(_0x4249f8(0xed),async()=>{const _0x52bf8a=_0x4249f8,_0x4939f0=await _0x6c92c5['connection'][_0x52bf8a(0xe8)]();return buildConnectionMaps(_0x4939f0);},{'verbose':_0x29e51d['verbose']})[_0x4249f8(0x160)](_0x4adcab=>_0x4adcab['data']),_0x34f46f=_0xa43306['nameToId'],_0x4d3f32=_0xa43306[_0x4249f8(0x165)],_0x42b4a6=_0xa43306[_0x4249f8(0x143)],_0x44c6a9={'emailToIdMap':_0x1f0df2,'connectionNameToIdMap':_0x34f46f,'connectionNameToTypeMap':_0x42b4a6,'getSchema':_0x4b47eb=>_0x6c92c5[_0x4249f8(0x157)][_0x4249f8(0x139)](_0x4b47eb)};let {pathToId:_0x46af59,idToPath:_0x31a015}=buildFolderMaps(_0xbf3c9d);const _0x39bf37=buildSegmentLookupMap(_0x4b6408,_0x31a015),_0x287e03=buildSegmentNameToIdMap(_0x4b6408),_0x2c50b2=buildJourneyBundleLookupMap(_0x4d7a85,_0x31a015);let _0x1a6863;if(_0x2596ca){if(!_0x2596ca[_0x4249f8(0xe9)](_0x4249f8(0x122))&&!_0x2596ca[_0x4249f8(0xe9)](_0x4249f8(0xd0)))return console[_0x4249f8(0x144)](a29_0x3d1326[_0x4249f8(0xd2)](_0x4249f8(0xe7)+_0x2596ca+'\x0a')),0x1;_0x1a6863=[_0x2596ca];}else _0x1a6863=findYamlFiles(_0x5d9a03);if(_0x1a6863[_0x4249f8(0x155)]===0x0)return console[_0x4249f8(0x144)](a29_0x3d1326['red'](_0x4249f8(0x162)+_0x5d9a03+'\x0a')),console[_0x4249f8(0x144)](a29_0x3d1326[_0x4249f8(0x10b)]('Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files')),0x1;let _0x1fd2f1,_0x3db54b;try{const _0x41aab9=parseAndClassifyYamlFiles(_0x1a6863,_0x5d9a03,{'skipSegments':_0x29e51d['journeysOnly']});_0x1fd2f1=_0x41aab9[_0x4249f8(0x104)],_0x3db54b=_0x41aab9['journeys'];const _0x25798d=validateParsedFiles(_0x41aab9,_0x5d9a03);if(_0x25798d[_0x4249f8(0x155)]>0x0)return console[_0x4249f8(0x144)](a29_0x3d1326[_0x4249f8(0xd2)](_0x4249f8(0xdf))),console[_0x4249f8(0x144)](formatValidationErrors(_0x25798d)),console['error'](a29_0x3d1326[_0x4249f8(0x10f)](_0x4249f8(0x131))),0x1;}catch(_0x51301f){return console['error'](a29_0x3d1326[_0x4249f8(0xd2)]('Error\x20parsing\x20YAML:\x20'+(_0x51301f instanceof Error?_0x51301f[_0x4249f8(0xe0)]:_0x51301f))),0x1;}if(_0x1fd2f1['length']===0x0&&_0x3db54b[_0x4249f8(0x155)]===0x0){const _0xb78615=_0x29e51d[_0x4249f8(0xfb)]?'journey':_0x4249f8(0x11c);return console[_0x4249f8(0x144)](a29_0x3d1326[_0x4249f8(0x10f)](_0x4249f8(0x154)+_0xb78615+_0x4249f8(0x12d))),0x0;}const _0x5c1e54=new Map();_0x4b6408[_0x4249f8(0x155)]>0x0&&!_0x29e51d['journeysOnly']&&await withSpinner(_0x4249f8(0x121),async()=>{await batchAsync(_0x4b6408,async _0x1d1b83=>{const _0x4f6c88=a29_0x229b,_0x35b565=await _0x6c92c5[_0x4f6c88(0x167)][_0x4f6c88(0x149)](_0x4fd2bf,_0x1d1b83['id']);_0x5c1e54[_0x4f6c88(0x12e)](_0x1d1b83['id'],_0x35b565);});},{'verbose':_0x29e51d['verbose']});const {segmentFiles:_0x4af029,foldersToCreate:_0xdfa388}=await prepareSegmentFiles(_0x1fd2f1,{'segmentByFolderAndName':_0x39bf37,'activationsBySegmentId':_0x5c1e54,'folderPathToId':_0x46af59,'idToEmailMap':_0x531083,'connectionIdToNameMap':_0x4d3f32},_0x44c6a9,_0x46b05e,_0x5cad96),_0x4da3b2=_0x2596ca?[]:findSegmentsToDelete(_0x4b6408,_0x1fd2f1[_0x4249f8(0xd7)](({yamlConfig:_0x2dbaa5,folderPath:_0x300f97})=>({'yamlConfig':_0x2dbaa5,'folderPath':resolveTDFolderPath(_0x300f97,_0x46b05e,_0x5cad96)})),_0x31a015,_0x5cad96,_0x46b05e),{journeyFiles:_0x125f28,foldersToCreate:_0x3dcef7}=await withProgressSpinner('Preparing\x20journeys...',async _0x5073ec=>prepareJourneyFiles(_0x3db54b,{'fetchJourney':async _0x3eaa33=>_0x6c92c5[_0x4249f8(0xf8)][_0x4249f8(0x164)](_0x3eaa33[_0x4249f8(0x141)]),'journeyBundlesByFolderAndName':_0x2c50b2,'folderPathToId':_0x46af59,'idToEmailMap':_0x531083,'connectionIdToNameMap':_0x4d3f32,'existingSegments':_0x4b6408,'parentId':_0x4fd2bf,'deps':_0x6c92c5,'progress':{'update':_0x215d8d=>{const _0x45ae69=_0x4249f8;_0x5073ec[_0x45ae69(0xf9)](_0x215d8d),_0x29e51d[_0x45ae69(0x13b)]&&console[_0x45ae69(0x144)]('\x20\x20'+_0x215d8d);}},'journeyById':_0x13b423,'activationStepsById':_0x271470},_0x46b05e,_0x5cad96),{'verbose':_0x29e51d[_0x4249f8(0x13b)]})[_0x4249f8(0x160)](_0x310ace=>_0x310ace['data']);for(const _0xf374a9 of _0x3dcef7){_0xdfa388[_0x4249f8(0x15a)](_0xf374a9);}const _0x30ae41=_0x2596ca?[]:findJourneysToDelete(_0x4d7a85,_0x3db54b[_0x4249f8(0xd7)](({yamlConfig:_0x563b03,folderPath:_0x3f21c7})=>({'yamlConfig':_0x563b03,'folderPath':resolveTDFolderPath(_0x3f21c7,_0x46b05e,_0x5cad96)})),_0x31a015,_0x5cad96,_0x46b05e),_0x2d8190=calculatePushStats(_0x4af029,_0x125f28,_0xdfa388,_0x4da3b2,_0x30ae41,!!_0x29e51d[_0x4249f8(0x13c)],!!_0x29e51d['journeysOnly']),_0x756bc1=_0x2d8190[_0x4249f8(0x104)][_0x4249f8(0x140)],_0x5df296=_0x2d8190[_0x4249f8(0x104)][_0x4249f8(0x112)],_0x12175e=_0x2d8190['segments'][_0x4249f8(0x14a)],_0x648382=_0x2d8190[_0x4249f8(0x104)][_0x4249f8(0x13e)],_0x3464b9=_0x2d8190[_0x4249f8(0x125)]['toCreate'],_0x130db1=_0x2d8190[_0x4249f8(0xfd)][_0x4249f8(0x140)],_0x584fc3=_0x2d8190[_0x4249f8(0xfd)][_0x4249f8(0x112)],_0x408b51=_0x2d8190[_0x4249f8(0xfd)][_0x4249f8(0x14a)],_0x2a954b=_0x2d8190['journeys'][_0x4249f8(0x13e)],_0x5e94e9=_0x2d8190[_0x4249f8(0x13d)][_0x4249f8(0x14f)],_0x5c6afd=_0x2d8190[_0x4249f8(0x13d)][_0x4249f8(0xd1)],_0x2a574c=_0x2d8190['activations'][_0x4249f8(0x12f)],_0x21f6c0=_0x2d8190[_0x4249f8(0x13d)]['toDelete'];console[_0x4249f8(0x144)](_0x4249f8(0x134)+_0x9fe777+'\x27:');_0x3464b9[_0x4249f8(0x155)]>0x0&&console[_0x4249f8(0x144)]('\x20\x20'+a29_0x3d1326[_0x4249f8(0xff)]('📁\x20'+_0x3464b9[_0x4249f8(0x155)]+_0x4249f8(0xf1)));if(!_0x29e51d[_0x4249f8(0xfb)]){console[_0x4249f8(0x144)](_0x4249f8(0x10e)),console['error'](_0x4249f8(0xd5)+a29_0x3d1326[_0x4249f8(0x103)]('+\x20'+_0x756bc1[_0x4249f8(0x155)]+_0x4249f8(0x156))),console['error'](_0x4249f8(0xd5)+a29_0x3d1326[_0x4249f8(0x10f)]('~\x20'+_0x5df296[_0x4249f8(0x155)]+_0x4249f8(0xd3)));if(_0x648382['length']>0x0)console[_0x4249f8(0x144)]('\x20\x20\x20\x20'+a29_0x3d1326['red']('-\x20'+_0x648382[_0x4249f8(0x155)]+_0x4249f8(0x10a)));else _0x4da3b2[_0x4249f8(0x155)]>0x0&&!_0x29e51d[_0x4249f8(0x13c)]&&console['error'](_0x4249f8(0xd5)+a29_0x3d1326[_0x4249f8(0x11a)](_0x4da3b2[_0x4249f8(0x155)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x4249f8(0x144)](_0x4249f8(0xd5)+a29_0x3d1326['dim']('=\x20'+_0x12175e[_0x4249f8(0x155)]+_0x4249f8(0x124)));}if(_0x125f28[_0x4249f8(0x155)]>0x0||_0x30ae41[_0x4249f8(0x155)]>0x0){console[_0x4249f8(0x144)]('\x20\x20🗺️\x20\x20Journeys:'),console['error'](_0x4249f8(0xd5)+a29_0x3d1326[_0x4249f8(0x103)]('+\x20'+_0x130db1[_0x4249f8(0x155)]+_0x4249f8(0x156))),console[_0x4249f8(0x144)](_0x4249f8(0xd5)+a29_0x3d1326[_0x4249f8(0x10f)]('~\x20'+_0x584fc3[_0x4249f8(0x155)]+_0x4249f8(0xd3)));if(_0x2a954b[_0x4249f8(0x155)]>0x0)console[_0x4249f8(0x144)]('\x20\x20\x20\x20'+a29_0x3d1326[_0x4249f8(0xd2)]('-\x20'+_0x2a954b[_0x4249f8(0x155)]+_0x4249f8(0x10a)));else _0x30ae41[_0x4249f8(0x155)]>0x0&&!_0x29e51d[_0x4249f8(0x13c)]&&console[_0x4249f8(0x144)](_0x4249f8(0xd5)+a29_0x3d1326[_0x4249f8(0x11a)](_0x30ae41[_0x4249f8(0x155)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x4249f8(0x144)](_0x4249f8(0xd5)+a29_0x3d1326[_0x4249f8(0x11a)]('=\x20'+_0x408b51[_0x4249f8(0x155)]+_0x4249f8(0x124)));}_0x5e94e9[_0x4249f8(0x155)]>0x0&&!_0x29e51d[_0x4249f8(0xfb)]&&(console[_0x4249f8(0x144)](''),console[_0x4249f8(0x144)](_0x4249f8(0x13a)),_0x5c6afd[_0x4249f8(0x155)]>0x0&&console[_0x4249f8(0x144)]('\x20\x20\x20\x20'+a29_0x3d1326[_0x4249f8(0x103)]('+\x20'+_0x5c6afd[_0x4249f8(0x155)]+_0x4249f8(0x161))),_0x2a574c['length']>0x0&&console[_0x4249f8(0x144)](_0x4249f8(0xd5)+a29_0x3d1326[_0x4249f8(0x10f)]('~\x20'+_0x2a574c['length']+_0x4249f8(0x135))),_0x21f6c0['length']>0x0&&console[_0x4249f8(0x144)](_0x4249f8(0xd5)+a29_0x3d1326[_0x4249f8(0xd2)]('-\x20'+_0x21f6c0[_0x4249f8(0x155)]+_0x4249f8(0x10a))));console['error'](_0x4249f8(0xf2)+a29_0x3d1326[_0x4249f8(0x10b)](_0x5d9a03)+'\x0a');if(_0x3464b9[_0x4249f8(0x155)]>0x0){console[_0x4249f8(0x144)](_0x4249f8(0x118));for(const _0x5a5f75 of _0x3464b9){console[_0x4249f8(0x144)]('\x20\x20'+a29_0x3d1326[_0x4249f8(0xff)]('+')+'\x20'+_0x5a5f75);}console[_0x4249f8(0x144)]('');}if(_0x756bc1[_0x4249f8(0x155)]>0x0&&!_0x29e51d[_0x4249f8(0xfb)])for(const _0x15aa80 of _0x756bc1){const _0x46e0f0=_0x15aa80[_0x4249f8(0x14d)]?_0x15aa80['folderPath']+'/'+_0x15aa80[_0x4249f8(0xd4)][_0x4249f8(0x111)]:_0x15aa80[_0x4249f8(0xd4)][_0x4249f8(0x111)],_0x5d0219=_0x15aa80[_0x4249f8(0xd4)]['activations']?.['length']||0x0,_0x2881c9=_0x5d0219>0x0?a29_0x3d1326[_0x4249f8(0x11a)]('\x20['+_0x5d0219+_0x4249f8(0x102)):'';console[_0x4249f8(0x144)]('\x0a'+a29_0x3d1326[_0x4249f8(0x103)](_0x4249f8(0xe3))+'\x20'+_0x46e0f0+_0x2881c9),console[_0x4249f8(0x144)]('─'[_0x4249f8(0xcd)](0x3c)),_0x15aa80[_0x4249f8(0x12c)]&&console[_0x4249f8(0x144)](_0x15aa80[_0x4249f8(0x12c)]),console[_0x4249f8(0x144)]('─'[_0x4249f8(0xcd)](0x3c));}if(_0x648382[_0x4249f8(0x155)]>0x0&&!_0x29e51d['journeysOnly'])for(const _0x2eea5f of _0x648382){const _0xd496b3=_0x2eea5f[_0x4249f8(0x108)]?_0x31a015[_0x4249f8(0x13f)](_0x2eea5f['segmentFolderId']['toString']())||'':'',_0x5c6754=_0xd496b3?_0xd496b3+'/'+_0x2eea5f[_0x4249f8(0x111)]:_0x2eea5f['name'],_0x2aa466=_0x5c1e54[_0x4249f8(0x13f)](_0x2eea5f['id'])||[],_0x4886aa=_0x2aa466[_0x4249f8(0x155)]>0x0?a29_0x3d1326[_0x4249f8(0x11a)]('\x20['+_0x2aa466[_0x4249f8(0x155)]+_0x4249f8(0x102)):'';console[_0x4249f8(0x144)]('\x0a'+a29_0x3d1326[_0x4249f8(0xd2)](_0x4249f8(0x101))+'\x20'+_0x5c6754+_0x4886aa),console[_0x4249f8(0x144)]('─'[_0x4249f8(0xcd)](0x3c));const _0x56356b=segmentWithActivationsToYaml(_0x2eea5f,_0x2aa466,undefined,_0x531083,_0x4d3f32),_0xb0061d=segmentToYamlString(_0x56356b),_0x51aaf4=generateDiff(_0xb0061d,'');console[_0x4249f8(0x144)](formatDiffWithColors(_0x51aaf4)),console[_0x4249f8(0x144)]('─'[_0x4249f8(0xcd)](0x3c));}const _0x38f5b5=_0x4af029['filter'](_0x43f8f1=>!_0x43f8f1['isNew']&&_0x43f8f1[_0x4249f8(0x12c)]);if(_0x38f5b5[_0x4249f8(0x155)]>0x0&&!_0x29e51d[_0x4249f8(0xfb)])for(const _0x360e01 of _0x38f5b5){const _0x4b5f30=_0x360e01[_0x4249f8(0x14d)]?_0x360e01[_0x4249f8(0x14d)]+'/'+_0x360e01[_0x4249f8(0xd4)][_0x4249f8(0x111)]:_0x360e01[_0x4249f8(0xd4)][_0x4249f8(0x111)];console[_0x4249f8(0x144)]('\x0a'+a29_0x3d1326['yellow']('Changes\x20to:')+'\x20'+_0x4b5f30),console['error']('─'['repeat'](0x3c)),console[_0x4249f8(0x144)](_0x360e01[_0x4249f8(0x12c)]),console[_0x4249f8(0x144)]('─'[_0x4249f8(0xcd)](0x3c));}if(_0x130db1[_0x4249f8(0x155)]>0x0)for(const _0x40dbfb of _0x130db1){const _0x477f2a=_0x40dbfb[_0x4249f8(0x14d)]?_0x40dbfb[_0x4249f8(0x14d)]+'/'+_0x40dbfb[_0x4249f8(0xd4)]['name']:_0x40dbfb['yamlConfig']['name'];console[_0x4249f8(0x144)]('\x0a'+a29_0x3d1326[_0x4249f8(0x103)]('New\x20journey:')+'\x20'+_0x477f2a),console[_0x4249f8(0x144)]('─'['repeat'](0x3c)),_0x40dbfb[_0x4249f8(0x12c)]&&console[_0x4249f8(0x144)](_0x40dbfb[_0x4249f8(0x12c)]),console[_0x4249f8(0x144)]('─'[_0x4249f8(0xcd)](0x3c));}const _0x41b962=_0x125f28[_0x4249f8(0xdb)](_0x22d0c0=>!_0x22d0c0[_0x4249f8(0xea)]&&_0x22d0c0[_0x4249f8(0x12c)]);if(_0x41b962[_0x4249f8(0x155)]>0x0)for(const _0x38bed0 of _0x41b962){const _0x35b289=_0x38bed0['folderPath']?_0x38bed0[_0x4249f8(0x14d)]+'/'+_0x38bed0[_0x4249f8(0xd4)][_0x4249f8(0x111)]:_0x38bed0['yamlConfig'][_0x4249f8(0x111)];console[_0x4249f8(0x144)]('\x0a'+a29_0x3d1326[_0x4249f8(0x10f)](_0x4249f8(0x15c))+'\x20'+_0x35b289),console[_0x4249f8(0x144)]('─'[_0x4249f8(0xcd)](0x3c)),console[_0x4249f8(0x144)](_0x38bed0[_0x4249f8(0x12c)]),console[_0x4249f8(0x144)]('─'[_0x4249f8(0xcd)](0x3c));}if(_0x2a954b[_0x4249f8(0x155)]>0x0)for(const _0x4cbbfc of _0x2a954b){const _0x10c037=_0x4cbbfc['folderId']?_0x31a015[_0x4249f8(0x13f)](_0x4cbbfc['folderId'])||'':'',_0x39d3dd=_0x10c037?_0x10c037+'/'+_0x4cbbfc['journeyBundleName']:_0x4cbbfc[_0x4249f8(0x12a)];console[_0x4249f8(0x144)]('\x0a'+a29_0x3d1326[_0x4249f8(0xd2)]('Delete\x20journey:')+'\x20'+_0x39d3dd),console[_0x4249f8(0x144)]('─'[_0x4249f8(0xcd)](0x3c)),console[_0x4249f8(0x144)](a29_0x3d1326['red'](_0x4249f8(0x15f))),console[_0x4249f8(0x144)]('─'[_0x4249f8(0xcd)](0x3c));}if(_0x29e51d[_0x4249f8(0xe2)])return console[_0x4249f8(0x144)](a29_0x3d1326[_0x4249f8(0x10f)](_0x4249f8(0x14e))),0x0;const _0x23b840=_0x29e51d[_0x4249f8(0xfb)]?![]:_0x756bc1['length']>0x0||_0x5df296[_0x4249f8(0x155)]>0x0||_0x648382[_0x4249f8(0x155)]>0x0,_0x15fe25=_0x130db1['length']>0x0||_0x584fc3['length']>0x0||_0x2a954b[_0x4249f8(0x155)]>0x0,_0xbfc707=_0x29e51d[_0x4249f8(0xfb)]?![]:_0x5e94e9[_0x4249f8(0x155)]>0x0,_0x258f68=_0x3464b9[_0x4249f8(0x155)]>0x0;if(!_0x23b840&&!_0x15fe25&&!_0xbfc707&&!_0x258f68){const _0x59efd6=_0x29e51d[_0x4249f8(0xfb)]?'✔\x20All\x20journeys\x20are\x20up\x20to\x20date':_0x4249f8(0xde);console[_0x4249f8(0x144)](a29_0x3d1326['green'](_0x59efd6));if(_0x2596ca&&_0x408b51[_0x4249f8(0x155)]===0x1){const _0x262c43=_0x408b51[0x0];if(_0x262c43[_0x4249f8(0xe4)]?.['id']){const _0x55001a=getConsoleNextUrl(_0x29e51d[_0x4249f8(0xd9)],'/app/ps/'+_0x4fd2bf+_0x4249f8(0x133)+_0x262c43[_0x4249f8(0xe4)]['id']+_0x4249f8(0x10c));console[_0x4249f8(0x144)]('\x20\x20'+a29_0x3d1326['cyan'](_0x55001a));}}return 0x0;}const _0x4fe248=_0x29e51d['journeysOnly']?_0x130db1['length']+_0x584fc3[_0x4249f8(0x155)]+_0x2a954b['length']+_0x3464b9[_0x4249f8(0x155)]:_0x756bc1[_0x4249f8(0x155)]+_0x5df296[_0x4249f8(0x155)]+_0x648382[_0x4249f8(0x155)]+_0x130db1[_0x4249f8(0x155)]+_0x584fc3[_0x4249f8(0x155)]+_0x2a954b[_0x4249f8(0x155)]+_0x3464b9[_0x4249f8(0x155)]+_0x5e94e9['length'];if(!_0x29e51d['yes']&&_0x4fe248>0x0){const _0x517fc4=await confirmKey(_0x4249f8(0xfe)+_0x4fe248+_0x4249f8(0x126));if(!_0x517fc4)return console[_0x4249f8(0x144)]('Aborted.'),0x1;}const _0x2c893c={'withProgress':async(_0x2f125b,_0x3b714c)=>{const _0x245377=_0x4249f8,_0x463ec1=await withSpinner(_0x2f125b,_0x3b714c,{'verbose':_0x29e51d[_0x245377(0x13b)]});return{'data':_0x463ec1['data']};},'logInfo':_0x531d7d=>console[_0x4249f8(0x144)](a29_0x3d1326[_0x4249f8(0xff)]('✔\x20'+_0x531d7d)),'logSuccess':_0x42b709=>console[_0x4249f8(0x144)](a29_0x3d1326[_0x4249f8(0x103)]('✔\x20'+_0x42b709)),'logWarning':_0x204930=>console[_0x4249f8(0x144)](a29_0x3d1326[_0x4249f8(0x10f)]('⚠\x20'+_0x204930)),'logDeleted':_0x53398c=>console[_0x4249f8(0x144)](a29_0x3d1326[_0x4249f8(0xd2)]('✔\x20'+_0x53398c))},_0x53fd17={'segment':_0x6c92c5[_0x4249f8(0x167)],'journey':_0x6c92c5[_0x4249f8(0xf8)],'user':_0x6c92c5[_0x4249f8(0x159)],'connection':_0x6c92c5[_0x4249f8(0x157)]};_0x3464b9[_0x4249f8(0x155)]>0x0&&(_0x46af59=await executePushFolders(_0x53fd17,_0x3464b9,_0x46af59,{'parentId':_0x4fd2bf},_0x2c893c));const _0x49de39={'rootFolderId':_0x55f0b5,'folderPathToId':_0x46af59,'folderIdToPath':_0x31a015,'segmentNameToId':_0x287e03,'activationsBySegmentId':_0x5c1e54,'emailToIdMap':_0x1f0df2,'idToEmailMap':_0x531083,'connectionNameToIdMap':_0xa43306[_0x4249f8(0xf0)],'connectionIdToNameMap':_0xa43306[_0x4249f8(0x165)],'connectionNameToTypeMap':_0x42b4a6},_0x1a94db=await executePushSegments(_0x53fd17,_0x29e51d[_0x4249f8(0xfb)]?[]:_0x4af029,_0x49de39,{'parentId':_0x4fd2bf},_0x2c893c),_0x4e1309=_0x1a94db[_0x4249f8(0x11f)],_0xfd4487=_0x1a94db[_0x4249f8(0xef)],_0x5095ce=_0x1a94db[_0x4249f8(0x13d)]['created'],_0x5896c1=_0x1a94db['activations']['updated'],_0x4c6e72=_0x1a94db['activations'][_0x4249f8(0xe5)],_0x5cc45b=await executePushSegmentDeletions(_0x53fd17,_0x29e51d[_0x4249f8(0xfb)]?[]:_0x648382,_0x2c893c);let _0x36eab3=0x0,_0x3cd094=0x0,_0x315d23=0x0;const _0xaa150a=new Map(_0x287e03);for(const [_0x193721,_0x331651]of _0x1a94db[_0x4249f8(0x148)]){_0xaa150a[_0x4249f8(0x12e)](_0x193721,_0x331651);}if(_0x125f28[_0x4249f8(0x155)]>0x0){const _0x4fda71={..._0x49de39,'segmentNameToId':_0xaa150a,'existingSegments':_0x4b6408,'activationContext':_0x44c6a9},_0x1d8153=await executePushJourneys(_0x53fd17,_0x125f28,_0x4fda71,{'parentId':_0x4fd2bf,'rootFolderId':_0x55f0b5,'verbose':_0x29e51d[_0x4249f8(0x13b)]},_0x2c893c);_0x36eab3=_0x1d8153[_0x4249f8(0x11f)],_0x3cd094=_0x1d8153[_0x4249f8(0xef)];if(_0x2596ca&&_0x1d8153['results'][_0x4249f8(0x155)]===0x1){const _0x3b5dab=_0x1d8153[_0x4249f8(0x145)][0x0];if(_0x3b5dab[_0x4249f8(0x141)]){const _0x269f31=getConsoleNextUrl(_0x29e51d[_0x4249f8(0xd9)],'/app/ps/'+_0x4fd2bf+_0x4249f8(0x133)+_0x3b5dab[_0x4249f8(0x141)]+_0x4249f8(0x10c));console['error']('\x20\x20'+a29_0x3d1326[_0x4249f8(0x10b)](_0x269f31));}}}for(const _0x3b037a of _0x2a954b){console[_0x4249f8(0x144)](a29_0x3d1326[_0x4249f8(0x10f)](_0x4249f8(0xe1)+_0x3b037a[_0x4249f8(0x12a)])),_0x315d23++;}const _0x5627b9=[];if(_0x4e1309>0x0)_0x5627b9[_0x4249f8(0xfc)](_0x4e1309+_0x4249f8(0x106));if(_0xfd4487>0x0)_0x5627b9[_0x4249f8(0xfc)](_0xfd4487+_0x4249f8(0x130));if(_0x5cc45b>0x0)_0x5627b9[_0x4249f8(0xfc)](_0x5cc45b+'\x20deleted');const _0x1ba87e=[];if(_0x36eab3>0x0)_0x1ba87e[_0x4249f8(0xfc)](_0x36eab3+_0x4249f8(0x106));if(_0x3cd094>0x0)_0x1ba87e['push'](_0x3cd094+'\x20updated');if(_0x315d23>0x0)_0x1ba87e[_0x4249f8(0xfc)](_0x315d23+_0x4249f8(0x142));const _0x40ab2a=[];if(_0x5095ce>0x0)_0x40ab2a[_0x4249f8(0xfc)](_0x5095ce+_0x4249f8(0x106));if(_0x5896c1>0x0)_0x40ab2a['push'](_0x5896c1+_0x4249f8(0x130));if(_0x4c6e72>0x0)_0x40ab2a[_0x4249f8(0xfc)](_0x4c6e72+_0x4249f8(0x142));return console[_0x4249f8(0x144)](a29_0x3d1326[_0x4249f8(0x103)](_0x4249f8(0xcf))),_0x5627b9[_0x4249f8(0x155)]>0x0&&!_0x29e51d[_0x4249f8(0xfb)]&&console[_0x4249f8(0x144)]('\x20\x20Segments:\x20'+_0x5627b9[_0x4249f8(0x150)](',\x20')),_0x1ba87e[_0x4249f8(0x155)]>0x0&&console[_0x4249f8(0x144)](_0x4249f8(0xd8)+_0x1ba87e[_0x4249f8(0x150)](',\x20')),_0x40ab2a[_0x4249f8(0x155)]>0x0&&!_0x29e51d[_0x4249f8(0xfb)]&&console[_0x4249f8(0x144)](_0x4249f8(0x127)+_0x40ab2a[_0x4249f8(0x150)](',\x20')),0x0;}}
1
+ const a29_0xd81b79=a29_0x3db9;(function(_0x336827,_0x4d1238){const _0x2d9462=a29_0x3db9,_0x56eb51=_0x336827();while(!![]){try{const _0x1a84ac=-parseInt(_0x2d9462(0x74))/0x1+-parseInt(_0x2d9462(0x6e))/0x2+parseInt(_0x2d9462(0x8b))/0x3+-parseInt(_0x2d9462(0xc6))/0x4+parseInt(_0x2d9462(0xb4))/0x5*(-parseInt(_0x2d9462(0x94))/0x6)+-parseInt(_0x2d9462(0xe2))/0x7*(parseInt(_0x2d9462(0xd2))/0x8)+parseInt(_0x2d9462(0x77))/0x9;if(_0x1a84ac===_0x4d1238)break;else _0x56eb51['push'](_0x56eb51['shift']());}catch(_0x56e8d7){_0x56eb51['push'](_0x56eb51['shift']());}}}(a29_0x3fc1,0xc0a8e));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a29_0x23cc89 from'chalk';import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';function a29_0x3fc1(){const _0x50489f=['Error:\x20Directory\x20not\x20found:\x20','toUpdate','journeys','parentSegment','activations','changed','set','\x20to\x20delete','buildUserMaps','Fetching\x20parent\x20segment\x20details...','/app/ps/','Changes\x20to\x20journey:','delete','Error:\x20','\x20to\x20create','message','nameToType','listSegments','\x20new','unchanged','then','Scoped\x20to\x20folder:\x20','35510EpbGPR','\x20deleted','\x27...','segment:push','\x20\x20Activations:\x20','dim','toCreate','Preparing\x20journeys...','filePath','yes','journeysOnly','segments','setPhase','nameToId','/j/da/je','name','idToName','/e/','1402152TIBiMB','\x20\x20\x20\x20','Folders\x20to\x20create:','join','red','filter','relationships','(Journey\x20will\x20be\x20deleted)','Site:\x20','updated','existingJourney','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','24wsiDDI','deleted','\x20unchanged','cwd','isScoped','scopedFolderPath','file','listFolders','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','green','getOutputSchemaWithCache','\x20\x20Source:\x20','helpText','\x20\x20Activations:','New\x20journey:','folderPath','1987916kHmGLZ','resolveParentId','listJourneysWithDetailsFromParentSegment','paused','\x20created','created','segmentFolderId','yellow','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','\x20updated','length','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','connection','\x20\x20Segments:\x20','journeyId','.yaml','targetDir','journey','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','segment','cyan','.yml','execute','\x20activations]','Error\x20parsing\x20YAML:\x20','getParent','\x20\x20📊\x20Segments:','journeyBundleName','Fetching\x20users\x20for\x20email\x20resolution...','state','description','results','errorCode','2852150GXhwRc','Delete\x20journey:','\x0aPush\x20summary\x20for\x20\x27','type','error','site','1506474IVDWkh','data','\x0a✔\x20Push\x20complete','40372470WRDQwb','diff','get','dryRun','repeat','push','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','getJourney','Parent\x20segment:\x20','Fetching\x20existing\x20activations...','Fetching\x20connections\x20for\x20name\x20resolution...','Fetching\x20existing\x20folders...','folders','list','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','all','map','Delete\x20segment:','Fetching\x20existing\x20journeys...','📁\x20','3275217epZSHG','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','attributes','new','user','segment\x20or\x20journey','Push\x20','verbose','folderId','552sEXIOP','Aborted.','listActivations','Resolving\x20parent\x20segment\x20\x27','parentName','yamlConfig','toDelete','blue','\x20\x20🗺️\x20\x20Journeys:','New\x20segment:'];a29_0x3fc1=function(){return _0x50489f;};return a29_0x3fc1();}import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';import{buildFolderMaps}from'../sdk/segment/resolution-context.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';function a29_0x3db9(_0x2dc45a,_0x2cbf8f){_0x2dc45a=_0x2dc45a-0x69;const _0x3fc131=a29_0x3fc1();let _0x3db941=_0x3fc131[_0x2dc45a];return _0x3db941;}import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{['name']=a29_0xd81b79(0xb7);[a29_0xd81b79(0x6b)]=a29_0xd81b79(0xea);async[a29_0xd81b79(0xf8)](_0xc953e2){const _0x5c8320=a29_0xd81b79,{options:_0x53338b,args:_0x525037,tdx:_0x1a5074}=_0xc953e2,_0x1716c3=_0x53338b,_0x4e8628=await resolveTarget({'arg':_0x525037[0x0],'contextParent':_0x53338b[_0x5c8320(0xa1)],'cwd':process[_0x5c8320(0xd5)]()});if(!isSuccessfulResolution(_0x4e8628))return _0x4e8628[_0x5c8320(0x6d)]==='no_parent'?(console['error'](a29_0x23cc89[_0x5c8320(0xe9)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x5c8320(0x72)]('Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)'),console['error'](_0x5c8320(0xd1)),console[_0x5c8320(0x72)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file')):(console[_0x5c8320(0x72)](a29_0x23cc89['red'](_0x5c8320(0xab)+_0x4e8628[_0x5c8320(0xad)]+'\x0a')),_0x4e8628[_0x5c8320(0xde)]&&console[_0x5c8320(0x72)](a29_0x23cc89[_0x5c8320(0xf6)](_0x4e8628[_0x5c8320(0xde)]))),0x1;if(_0x4e8628['type']==='parent_name')return console['error'](a29_0x23cc89[_0x5c8320(0xca)](_0x5c8320(0x9e)+_0x4e8628[_0x5c8320(0xf2)]+'\x0a')),console[_0x5c8320(0x72)](a29_0x23cc89[_0x5c8320(0xf6)](_0x5c8320(0x8c))),0x1;const _0x1fa6e7=_0x4e8628[_0x5c8320(0x98)],_0x1780da=_0x4e8628[_0x5c8320(0xf2)],_0x18abf9=_0x4e8628[_0x5c8320(0x71)]===_0x5c8320(0xd8)?_0x4e8628[_0x5c8320(0xbc)]:undefined,_0x4e3433=getScopedDetails(_0x4e8628),_0x56f883=_0x4e3433?.[_0x5c8320(0xd6)]??![],_0x352517=_0x4e3433?.[_0x5c8320(0xd7)]??'';if(!existsSync(_0x1780da))return console[_0x5c8320(0x72)](a29_0x23cc89['red']('Error:\x20Directory\x20not\x20found:\x20'+_0x1780da+'\x0a')),console[_0x5c8320(0x72)](a29_0x23cc89[_0x5c8320(0xf6)](_0x5c8320(0x8c))),0x1;_0x1716c3['verbose']&&(console[_0x5c8320(0x72)](_0x5c8320(0xce)+_0x1716c3[_0x5c8320(0x73)]),console['error'](_0x5c8320(0x7f)+_0x1fa6e7),console['error']('Source\x20directory:\x20'+_0x1780da),_0x56f883&&console[_0x5c8320(0x72)](_0x5c8320(0xb3)+_0x352517));const _0x4fc09f=await withSpinner(_0x5c8320(0x97)+_0x1fa6e7+_0x5c8320(0xb6),()=>_0x1a5074[_0x5c8320(0xf5)][_0x5c8320(0xe3)](_0x1fa6e7),{'verbose':_0x1716c3['verbose']}),_0x3e67a0=_0x4fc09f[_0x5c8320(0x75)],[_0x4265ff,_0x18dabd,_0x4f1260,_0x124dc2,_0x4e3e33]=await Promise[_0x5c8320(0x86)]([withSpinner(_0x5c8320(0xa7),()=>_0x1a5074[_0x5c8320(0xf5)][_0x5c8320(0xfb)](_0x3e67a0),{'verbose':_0x1716c3[_0x5c8320(0x92)]}),withSpinner('Fetching\x20existing\x20segments...',()=>_0x1a5074[_0x5c8320(0xf5)][_0x5c8320(0xaf)](_0x3e67a0),{'verbose':_0x1716c3[_0x5c8320(0x92)]}),withSpinner(_0x5c8320(0x82),()=>_0x1a5074[_0x5c8320(0xf5)][_0x5c8320(0xd9)](_0x3e67a0),{'verbose':_0x1716c3[_0x5c8320(0x92)]}),withSpinner(_0x5c8320(0x89),()=>_0x1a5074[_0x5c8320(0xf3)][_0x5c8320(0xe4)](_0x3e67a0,{'includeAllVersions':!![]}),{'verbose':_0x1716c3[_0x5c8320(0x92)]}),withSpinner(_0x5c8320(0x69),()=>_0x1a5074[_0x5c8320(0x8f)][_0x5c8320(0xa6)](),{'verbose':_0x1716c3[_0x5c8320(0x92)]})['then'](_0x518a50=>_0x518a50[_0x5c8320(0x75)])]),_0xca36a4=_0x4265ff[_0x5c8320(0x75)],_0x5e820b=extractRootFolderId(_0xca36a4),_0x5748b2=_0x18dabd[_0x5c8320(0x75)],_0x556197=_0x4f1260[_0x5c8320(0x75)],{journeys:_0x292556,activationStepsById:_0x48c59f}=_0x124dc2[_0x5c8320(0x75)],_0x438cd5=new Map(_0x292556[_0x5c8320(0x87)](_0x55b094=>[_0x55b094['id'],_0x55b094])),_0xa2d679=_0x292556[_0x5c8320(0x87)](_0x120d43=>({'id':_0x120d43['id'],'name':_0x120d43[_0x5c8320(0x8d)][_0x5c8320(0xc3)],'journeyBundleName':_0x120d43['attributes'][_0x5c8320(0xfd)]||'','journeyBundleId':_0x120d43[_0x5c8320(0x8d)]['journeyBundleId']||'','versionNumber':_0x120d43[_0x5c8320(0x8d)]['versionNumber'],'description':_0x120d43['attributes']['description'],'state':_0x120d43[_0x5c8320(0x8d)][_0x5c8320(0x6a)],'paused':_0x120d43[_0x5c8320(0x8d)][_0x5c8320(0xe5)],'audienceId':_0x120d43['attributes']['audienceId'],'folderId':_0x120d43[_0x5c8320(0xcc)]?.['parentFolder']?.[_0x5c8320(0x75)]?.['id'],'createdAt':_0x120d43['attributes']['createdAt'],'updatedAt':_0x120d43[_0x5c8320(0x8d)]['updatedAt']})),{emailToId:_0x2404d3,idToEmail:_0x1bd91e}=_0x4e3e33,_0x11852f=await withSpinner(_0x5c8320(0x81),async()=>{const _0x127dde=_0x5c8320,_0x2c61c1=await _0x1a5074[_0x127dde(0xee)][_0x127dde(0x84)]();return buildConnectionMaps(_0x2c61c1);},{'verbose':_0x1716c3[_0x5c8320(0x92)]})[_0x5c8320(0xb2)](_0x1a5393=>_0x1a5393['data']),_0x183191=_0x11852f['nameToId'],_0x2e698e=_0x11852f[_0x5c8320(0xc4)],_0xe99475=_0x11852f[_0x5c8320(0xae)],_0x13c8e8={'emailToIdMap':_0x2404d3,'connectionNameToIdMap':_0x183191,'connectionNameToTypeMap':_0xe99475,'getSchema':_0x61f357=>_0x1a5074[_0x5c8320(0xee)][_0x5c8320(0xdc)](_0x61f357)};let {pathToId:_0x38bf71,idToPath:_0x4cf4c4}=buildFolderMaps(_0x556197);const _0x22c282=buildSegmentLookupMap(_0x5748b2,_0x4cf4c4),_0x219fe0=buildSegmentNameToIdMap(_0x5748b2),_0x1ff779=buildJourneyBundleLookupMap(_0xa2d679,_0x4cf4c4);let _0x31bb5b;if(_0x18abf9){if(!_0x18abf9['endsWith'](_0x5c8320(0xf7))&&!_0x18abf9['endsWith'](_0x5c8320(0xf1)))return console[_0x5c8320(0x72)](a29_0x23cc89['red'](_0x5c8320(0x7d)+_0x18abf9+'\x0a')),0x1;_0x31bb5b=[_0x18abf9];}else _0x31bb5b=findYamlFiles(_0x1780da);if(_0x31bb5b[_0x5c8320(0xec)]===0x0)return console[_0x5c8320(0x72)](a29_0x23cc89[_0x5c8320(0xca)]('Error:\x20No\x20YAML\x20files\x20found\x20in\x20'+_0x1780da+'\x0a')),console['error'](a29_0x23cc89[_0x5c8320(0xf6)](_0x5c8320(0x85))),0x1;let _0x2086a0,_0x191578;try{const _0x1480cd=parseAndClassifyYamlFiles(_0x31bb5b,_0x1780da,{'skipSegments':_0x1716c3['journeysOnly']});_0x2086a0=_0x1480cd['segments'],_0x191578=_0x1480cd[_0x5c8320(0xa0)];const _0x149c38=validateParsedFiles(_0x1480cd,_0x1780da);if(_0x149c38[_0x5c8320(0xec)]>0x0)return console[_0x5c8320(0x72)](a29_0x23cc89[_0x5c8320(0xca)]('\x0aValidation\x20failed:')),console[_0x5c8320(0x72)](formatValidationErrors(_0x149c38)),console[_0x5c8320(0x72)](a29_0x23cc89['yellow'](_0x5c8320(0xda))),0x1;}catch(_0x3d6cf9){return console[_0x5c8320(0x72)](a29_0x23cc89['red'](_0x5c8320(0xfa)+(_0x3d6cf9 instanceof Error?_0x3d6cf9[_0x5c8320(0xad)]:_0x3d6cf9))),0x1;}if(_0x2086a0[_0x5c8320(0xec)]===0x0&&_0x191578[_0x5c8320(0xec)]===0x0){const _0x4262ac=_0x1716c3[_0x5c8320(0xbe)]?_0x5c8320(0xf3):_0x5c8320(0x90);return console['error'](a29_0x23cc89[_0x5c8320(0xe9)]('No\x20'+_0x4262ac+'\x20YAML\x20files\x20found')),0x0;}const _0xf0e166=new Map();_0x5748b2['length']>0x0&&!_0x1716c3[_0x5c8320(0xbe)]&&await withSpinner(_0x5c8320(0x80),async()=>{await batchAsync(_0x5748b2,async _0x5ccef5=>{const _0x2a2a61=a29_0x3db9,_0x589241=await _0x1a5074[_0x2a2a61(0xf5)][_0x2a2a61(0x96)](_0x3e67a0,_0x5ccef5['id']);_0xf0e166[_0x2a2a61(0xa4)](_0x5ccef5['id'],_0x589241);});},{'verbose':_0x1716c3['verbose']});const {segmentFiles:_0x5aec0c,foldersToCreate:_0x470f46}=await prepareSegmentFiles(_0x2086a0,{'segmentByFolderAndName':_0x22c282,'activationsBySegmentId':_0xf0e166,'folderPathToId':_0x38bf71,'idToEmailMap':_0x1bd91e,'connectionIdToNameMap':_0x2e698e},_0x13c8e8,_0x56f883,_0x352517),_0x180322=_0x18abf9?[]:findSegmentsToDelete(_0x5748b2,_0x2086a0[_0x5c8320(0x87)](({yamlConfig:_0x2e0b2e,folderPath:_0x320db8})=>({'yamlConfig':_0x2e0b2e,'folderPath':resolveTDFolderPath(_0x320db8,_0x56f883,_0x352517)})),_0x4cf4c4,_0x352517,_0x56f883),{journeyFiles:_0x2de132,foldersToCreate:_0x352a9c}=await withProgressSpinner(_0x5c8320(0xbb),async _0x5b082d=>prepareJourneyFiles(_0x191578,{'fetchJourney':async _0x6bc279=>_0x1a5074[_0x5c8320(0xf3)][_0x5c8320(0x7e)](_0x6bc279[_0x5c8320(0xf0)]),'journeyBundlesByFolderAndName':_0x1ff779,'folderPathToId':_0x38bf71,'idToEmailMap':_0x1bd91e,'connectionIdToNameMap':_0x2e698e,'existingSegments':_0x5748b2,'parentId':_0x3e67a0,'deps':_0x1a5074,'progress':{'update':_0x4f6c2e=>{const _0x1cb185=_0x5c8320;_0x5b082d[_0x1cb185(0xc0)](_0x4f6c2e),_0x1716c3[_0x1cb185(0x92)]&&console['error']('\x20\x20'+_0x4f6c2e);}},'journeyById':_0x438cd5,'activationStepsById':_0x48c59f},_0x56f883,_0x352517),{'verbose':_0x1716c3[_0x5c8320(0x92)]})[_0x5c8320(0xb2)](_0xf2b2fb=>_0xf2b2fb[_0x5c8320(0x75)]);for(const _0xdb7c3d of _0x352a9c){_0x470f46['add'](_0xdb7c3d);}const _0x5db2a0=_0x18abf9?[]:findJourneysToDelete(_0xa2d679,_0x191578['map'](({yamlConfig:_0x621559,folderPath:_0x1e35cd})=>({'yamlConfig':_0x621559,'folderPath':resolveTDFolderPath(_0x1e35cd,_0x56f883,_0x352517)})),_0x4cf4c4,_0x352517,_0x56f883),_0x2d37cf=calculatePushStats(_0x5aec0c,_0x2de132,_0x470f46,_0x180322,_0x5db2a0,!!_0x1716c3[_0x5c8320(0xaa)],!!_0x1716c3['journeysOnly']),_0x16bde8=_0x2d37cf[_0x5c8320(0xbf)][_0x5c8320(0x8e)],_0x94639=_0x2d37cf[_0x5c8320(0xbf)][_0x5c8320(0xa3)],_0x356126=_0x2d37cf[_0x5c8320(0xbf)][_0x5c8320(0xb1)],_0xc2f612=_0x2d37cf[_0x5c8320(0xbf)][_0x5c8320(0x9a)],_0x4f5f8d=_0x2d37cf[_0x5c8320(0x83)][_0x5c8320(0xba)],_0x26eb35=_0x2d37cf['journeys'][_0x5c8320(0x8e)],_0x1a3497=_0x2d37cf['journeys']['changed'],_0x4b3b7e=_0x2d37cf[_0x5c8320(0xa0)]['unchanged'],_0x34cde9=_0x2d37cf['journeys'][_0x5c8320(0x9a)],_0x4f7306=_0x2d37cf[_0x5c8320(0xa2)][_0x5c8320(0x86)],_0xc6175c=_0x2d37cf['activations'][_0x5c8320(0xba)],_0x2f81fe=_0x2d37cf[_0x5c8320(0xa2)][_0x5c8320(0x9f)],_0x3135fd=_0x2d37cf[_0x5c8320(0xa2)][_0x5c8320(0x9a)];console['error'](_0x5c8320(0x70)+_0x1fa6e7+'\x27:');_0x4f5f8d[_0x5c8320(0xec)]>0x0&&console[_0x5c8320(0x72)]('\x20\x20'+a29_0x23cc89[_0x5c8320(0x9b)](_0x5c8320(0x8a)+_0x4f5f8d[_0x5c8320(0xec)]+'\x20folders\x20to\x20create'));if(!_0x1716c3['journeysOnly']){console[_0x5c8320(0x72)](_0x5c8320(0xfc)),console[_0x5c8320(0x72)](_0x5c8320(0xc7)+a29_0x23cc89['green']('+\x20'+_0x16bde8[_0x5c8320(0xec)]+_0x5c8320(0xb0))),console['error'](_0x5c8320(0xc7)+a29_0x23cc89[_0x5c8320(0xe9)]('~\x20'+_0x94639['length']+'\x20changed'));if(_0xc2f612[_0x5c8320(0xec)]>0x0)console[_0x5c8320(0x72)](_0x5c8320(0xc7)+a29_0x23cc89[_0x5c8320(0xca)]('-\x20'+_0xc2f612[_0x5c8320(0xec)]+_0x5c8320(0xa5)));else _0x180322['length']>0x0&&!_0x1716c3[_0x5c8320(0xaa)]&&console[_0x5c8320(0x72)]('\x20\x20\x20\x20'+a29_0x23cc89[_0x5c8320(0xb9)](_0x180322[_0x5c8320(0xec)]+_0x5c8320(0xed)));console[_0x5c8320(0x72)](_0x5c8320(0xc7)+a29_0x23cc89[_0x5c8320(0xb9)]('=\x20'+_0x356126[_0x5c8320(0xec)]+'\x20unchanged'));}if(_0x2de132[_0x5c8320(0xec)]>0x0||_0x5db2a0[_0x5c8320(0xec)]>0x0){console[_0x5c8320(0x72)](_0x5c8320(0x9c)),console[_0x5c8320(0x72)]('\x20\x20\x20\x20'+a29_0x23cc89[_0x5c8320(0xdb)]('+\x20'+_0x26eb35[_0x5c8320(0xec)]+_0x5c8320(0xb0))),console[_0x5c8320(0x72)](_0x5c8320(0xc7)+a29_0x23cc89[_0x5c8320(0xe9)]('~\x20'+_0x1a3497[_0x5c8320(0xec)]+'\x20changed'));if(_0x34cde9[_0x5c8320(0xec)]>0x0)console[_0x5c8320(0x72)](_0x5c8320(0xc7)+a29_0x23cc89['red']('-\x20'+_0x34cde9[_0x5c8320(0xec)]+_0x5c8320(0xa5)));else _0x5db2a0[_0x5c8320(0xec)]>0x0&&!_0x1716c3[_0x5c8320(0xaa)]&&console[_0x5c8320(0x72)]('\x20\x20\x20\x20'+a29_0x23cc89[_0x5c8320(0xb9)](_0x5db2a0[_0x5c8320(0xec)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x5c8320(0x72)](_0x5c8320(0xc7)+a29_0x23cc89[_0x5c8320(0xb9)]('=\x20'+_0x4b3b7e['length']+_0x5c8320(0xd4)));}_0x4f7306[_0x5c8320(0xec)]>0x0&&!_0x1716c3[_0x5c8320(0xbe)]&&(console[_0x5c8320(0x72)](''),console['error'](_0x5c8320(0xdf)),_0xc6175c[_0x5c8320(0xec)]>0x0&&console[_0x5c8320(0x72)](_0x5c8320(0xc7)+a29_0x23cc89[_0x5c8320(0xdb)]('+\x20'+_0xc6175c['length']+_0x5c8320(0xac))),_0x2f81fe['length']>0x0&&console[_0x5c8320(0x72)](_0x5c8320(0xc7)+a29_0x23cc89[_0x5c8320(0xe9)]('~\x20'+_0x2f81fe[_0x5c8320(0xec)]+'\x20to\x20update')),_0x3135fd[_0x5c8320(0xec)]>0x0&&console[_0x5c8320(0x72)](_0x5c8320(0xc7)+a29_0x23cc89['red']('-\x20'+_0x3135fd['length']+_0x5c8320(0xa5))));console['error'](_0x5c8320(0xdd)+a29_0x23cc89['cyan'](_0x1780da)+'\x0a');if(_0x4f5f8d[_0x5c8320(0xec)]>0x0){console[_0x5c8320(0x72)](_0x5c8320(0xc8));for(const _0x4baf13 of _0x4f5f8d){console['error']('\x20\x20'+a29_0x23cc89[_0x5c8320(0x9b)]('+')+'\x20'+_0x4baf13);}console[_0x5c8320(0x72)]('');}if(_0x16bde8[_0x5c8320(0xec)]>0x0&&!_0x1716c3['journeysOnly'])for(const _0x2c7b68 of _0x16bde8){const _0x28a001=_0x2c7b68[_0x5c8320(0xe1)]?_0x2c7b68['folderPath']+'/'+_0x2c7b68[_0x5c8320(0x99)]['name']:_0x2c7b68['yamlConfig']['name'],_0x2f264c=_0x2c7b68[_0x5c8320(0x99)][_0x5c8320(0xa2)]?.[_0x5c8320(0xec)]||0x0,_0x10d256=_0x2f264c>0x0?a29_0x23cc89['dim']('\x20['+_0x2f264c+'\x20activations]'):'';console[_0x5c8320(0x72)]('\x0a'+a29_0x23cc89[_0x5c8320(0xdb)](_0x5c8320(0x9d))+'\x20'+_0x28a001+_0x10d256),console['error']('─'[_0x5c8320(0x7b)](0x3c)),_0x2c7b68['diff']&&console[_0x5c8320(0x72)](_0x2c7b68[_0x5c8320(0x78)]),console['error']('─'['repeat'](0x3c));}if(_0xc2f612[_0x5c8320(0xec)]>0x0&&!_0x1716c3['journeysOnly'])for(const _0x5de2e9 of _0xc2f612){const _0x276892=_0x5de2e9[_0x5c8320(0xe8)]?_0x4cf4c4[_0x5c8320(0x79)](_0x5de2e9[_0x5c8320(0xe8)]['toString']())||'':'',_0xa84537=_0x276892?_0x276892+'/'+_0x5de2e9['name']:_0x5de2e9[_0x5c8320(0xc3)],_0x354f1f=_0xf0e166['get'](_0x5de2e9['id'])||[],_0x5f29c8=_0x354f1f[_0x5c8320(0xec)]>0x0?a29_0x23cc89[_0x5c8320(0xb9)]('\x20['+_0x354f1f[_0x5c8320(0xec)]+_0x5c8320(0xf9)):'';console[_0x5c8320(0x72)]('\x0a'+a29_0x23cc89[_0x5c8320(0xca)](_0x5c8320(0x88))+'\x20'+_0xa84537+_0x5f29c8),console[_0x5c8320(0x72)]('─'[_0x5c8320(0x7b)](0x3c));const _0x267e37=segmentWithActivationsToYaml(_0x5de2e9,_0x354f1f,undefined,_0x1bd91e,_0x2e698e),_0xc5bc15=segmentToYamlString(_0x267e37),_0x402eae=generateDiff(_0xc5bc15,'');console[_0x5c8320(0x72)](formatDiffWithColors(_0x402eae)),console[_0x5c8320(0x72)]('─'[_0x5c8320(0x7b)](0x3c));}const _0x29c654=_0x5aec0c[_0x5c8320(0xcb)](_0x5316bf=>!_0x5316bf['isNew']&&_0x5316bf['diff']);if(_0x29c654[_0x5c8320(0xec)]>0x0&&!_0x1716c3[_0x5c8320(0xbe)])for(const _0x2e4ca0 of _0x29c654){const _0x8987e6=_0x2e4ca0[_0x5c8320(0xe1)]?_0x2e4ca0[_0x5c8320(0xe1)]+'/'+_0x2e4ca0['yamlConfig'][_0x5c8320(0xc3)]:_0x2e4ca0[_0x5c8320(0x99)]['name'];console[_0x5c8320(0x72)]('\x0a'+a29_0x23cc89['yellow']('Changes\x20to:')+'\x20'+_0x8987e6),console[_0x5c8320(0x72)]('─'[_0x5c8320(0x7b)](0x3c)),console[_0x5c8320(0x72)](_0x2e4ca0['diff']),console[_0x5c8320(0x72)]('─'['repeat'](0x3c));}if(_0x26eb35['length']>0x0)for(const _0x5a2977 of _0x26eb35){const _0x2c75a6=_0x5a2977['folderPath']?_0x5a2977['folderPath']+'/'+_0x5a2977['yamlConfig'][_0x5c8320(0xc3)]:_0x5a2977[_0x5c8320(0x99)][_0x5c8320(0xc3)];console['error']('\x0a'+a29_0x23cc89[_0x5c8320(0xdb)](_0x5c8320(0xe0))+'\x20'+_0x2c75a6),console[_0x5c8320(0x72)]('─'[_0x5c8320(0x7b)](0x3c)),_0x5a2977[_0x5c8320(0x78)]&&console[_0x5c8320(0x72)](_0x5a2977['diff']),console['error']('─'[_0x5c8320(0x7b)](0x3c));}const _0xc2d20d=_0x2de132[_0x5c8320(0xcb)](_0x3605a0=>!_0x3605a0['isNew']&&_0x3605a0[_0x5c8320(0x78)]);if(_0xc2d20d['length']>0x0)for(const _0x250da4 of _0xc2d20d){const _0x271584=_0x250da4['folderPath']?_0x250da4['folderPath']+'/'+_0x250da4[_0x5c8320(0x99)][_0x5c8320(0xc3)]:_0x250da4[_0x5c8320(0x99)][_0x5c8320(0xc3)];console[_0x5c8320(0x72)]('\x0a'+a29_0x23cc89['yellow'](_0x5c8320(0xa9))+'\x20'+_0x271584),console[_0x5c8320(0x72)]('─'[_0x5c8320(0x7b)](0x3c)),console['error'](_0x250da4[_0x5c8320(0x78)]),console[_0x5c8320(0x72)]('─'[_0x5c8320(0x7b)](0x3c));}if(_0x34cde9[_0x5c8320(0xec)]>0x0)for(const _0x3b4e00 of _0x34cde9){const _0x51cbe3=_0x3b4e00[_0x5c8320(0x93)]?_0x4cf4c4[_0x5c8320(0x79)](_0x3b4e00['folderId'])||'':'',_0x2f3991=_0x51cbe3?_0x51cbe3+'/'+_0x3b4e00['journeyBundleName']:_0x3b4e00[_0x5c8320(0xfd)];console[_0x5c8320(0x72)]('\x0a'+a29_0x23cc89[_0x5c8320(0xca)](_0x5c8320(0x6f))+'\x20'+_0x2f3991),console[_0x5c8320(0x72)]('─'[_0x5c8320(0x7b)](0x3c)),console['error'](a29_0x23cc89[_0x5c8320(0xca)](_0x5c8320(0xcd))),console[_0x5c8320(0x72)]('─'['repeat'](0x3c));}if(_0x1716c3[_0x5c8320(0x7a)])return console[_0x5c8320(0x72)](a29_0x23cc89['yellow']('\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made')),0x0;const _0x4e0b9f=_0x1716c3['journeysOnly']?![]:_0x16bde8[_0x5c8320(0xec)]>0x0||_0x94639['length']>0x0||_0xc2f612['length']>0x0,_0x5019ad=_0x26eb35['length']>0x0||_0x1a3497['length']>0x0||_0x34cde9[_0x5c8320(0xec)]>0x0,_0xc5d577=_0x1716c3[_0x5c8320(0xbe)]?![]:_0x4f7306[_0x5c8320(0xec)]>0x0,_0xfbfc82=_0x4f5f8d[_0x5c8320(0xec)]>0x0;if(!_0x4e0b9f&&!_0x5019ad&&!_0xc5d577&&!_0xfbfc82){const _0x4ec29d=_0x1716c3[_0x5c8320(0xbe)]?'✔\x20All\x20journeys\x20are\x20up\x20to\x20date':_0x5c8320(0xf4);console[_0x5c8320(0x72)](a29_0x23cc89[_0x5c8320(0xdb)](_0x4ec29d));if(_0x18abf9&&_0x4b3b7e[_0x5c8320(0xec)]===0x1){const _0x723282=_0x4b3b7e[0x0];if(_0x723282[_0x5c8320(0xd0)]?.['id']){const _0x513502=getConsoleNextUrl(_0x1716c3[_0x5c8320(0x73)],_0x5c8320(0xa8)+_0x3e67a0+_0x5c8320(0xc5)+_0x723282[_0x5c8320(0xd0)]['id']+'/j/da/je');console['error']('\x20\x20'+a29_0x23cc89[_0x5c8320(0xf6)](_0x513502));}}return 0x0;}const _0x498dd0=_0x1716c3['journeysOnly']?_0x26eb35['length']+_0x1a3497['length']+_0x34cde9[_0x5c8320(0xec)]+_0x4f5f8d[_0x5c8320(0xec)]:_0x16bde8[_0x5c8320(0xec)]+_0x94639[_0x5c8320(0xec)]+_0xc2f612[_0x5c8320(0xec)]+_0x26eb35[_0x5c8320(0xec)]+_0x1a3497[_0x5c8320(0xec)]+_0x34cde9['length']+_0x4f5f8d['length']+_0x4f7306[_0x5c8320(0xec)];if(!_0x1716c3[_0x5c8320(0xbd)]&&_0x498dd0>0x0){const _0x4e64e4=await confirmKey(_0x5c8320(0x91)+_0x498dd0+'\x20changes?');if(!_0x4e64e4)return console['error'](_0x5c8320(0x95)),0x1;}const _0x1ff790={'withProgress':async(_0x315a34,_0x272954)=>{const _0x3e9fdc=_0x5c8320,_0x575dc6=await withSpinner(_0x315a34,_0x272954,{'verbose':_0x1716c3[_0x3e9fdc(0x92)]});return{'data':_0x575dc6[_0x3e9fdc(0x75)]};},'logInfo':_0x5c7cb3=>console[_0x5c8320(0x72)](a29_0x23cc89[_0x5c8320(0x9b)]('✔\x20'+_0x5c7cb3)),'logSuccess':_0x4d42c5=>console[_0x5c8320(0x72)](a29_0x23cc89[_0x5c8320(0xdb)]('✔\x20'+_0x4d42c5)),'logWarning':_0x3f4d1d=>console[_0x5c8320(0x72)](a29_0x23cc89['yellow']('⚠\x20'+_0x3f4d1d)),'logDeleted':_0x16a8d6=>console[_0x5c8320(0x72)](a29_0x23cc89['red']('✔\x20'+_0x16a8d6))},_0x55d3e9={'segment':_0x1a5074[_0x5c8320(0xf5)],'journey':_0x1a5074[_0x5c8320(0xf3)],'user':_0x1a5074[_0x5c8320(0x8f)],'connection':_0x1a5074[_0x5c8320(0xee)]};_0x4f5f8d['length']>0x0&&(_0x38bf71=await executePushFolders(_0x55d3e9,_0x4f5f8d,_0x38bf71,{'parentId':_0x3e67a0},_0x1ff790));const _0xd288c1={'rootFolderId':_0x5e820b,'folderPathToId':_0x38bf71,'folderIdToPath':_0x4cf4c4,'segmentNameToId':_0x219fe0,'activationsBySegmentId':_0xf0e166,'emailToIdMap':_0x2404d3,'idToEmailMap':_0x1bd91e,'connectionNameToIdMap':_0x11852f[_0x5c8320(0xc1)],'connectionIdToNameMap':_0x11852f['idToName'],'connectionNameToTypeMap':_0xe99475},_0x2ad97f=await executePushSegments(_0x55d3e9,_0x1716c3[_0x5c8320(0xbe)]?[]:_0x5aec0c,_0xd288c1,{'parentId':_0x3e67a0},_0x1ff790),_0x221961=_0x2ad97f['created'],_0x29b02f=_0x2ad97f[_0x5c8320(0xcf)],_0x5635c1=_0x2ad97f['activations'][_0x5c8320(0xe7)],_0x483b1c=_0x2ad97f['activations'][_0x5c8320(0xcf)],_0x53382c=_0x2ad97f['activations'][_0x5c8320(0xd3)],_0x2d57a3=await executePushSegmentDeletions(_0x55d3e9,_0x1716c3[_0x5c8320(0xbe)]?[]:_0xc2f612,_0x1ff790);let _0x1f0075=0x0,_0x2a1f35=0x0,_0x40ba3b=0x0;const _0x59a24e=new Map(_0x219fe0);for(const [_0x3fca0f,_0x4ccb34]of _0x2ad97f['createdSegmentIds']){_0x59a24e[_0x5c8320(0xa4)](_0x3fca0f,_0x4ccb34);}if(_0x2de132[_0x5c8320(0xec)]>0x0){const _0x5120cc={..._0xd288c1,'segmentNameToId':_0x59a24e,'existingSegments':_0x5748b2,'activationContext':_0x13c8e8},_0x435f7c=await executePushJourneys(_0x55d3e9,_0x2de132,_0x5120cc,{'parentId':_0x3e67a0,'rootFolderId':_0x5e820b,'verbose':_0x1716c3[_0x5c8320(0x92)]},_0x1ff790);_0x1f0075=_0x435f7c[_0x5c8320(0xe7)],_0x2a1f35=_0x435f7c['updated'];if(_0x18abf9&&_0x435f7c[_0x5c8320(0x6c)]['length']===0x1){const _0x3d8e22=_0x435f7c[_0x5c8320(0x6c)][0x0];if(_0x3d8e22[_0x5c8320(0xf0)]){const _0x121e16=getConsoleNextUrl(_0x1716c3[_0x5c8320(0x73)],_0x5c8320(0xa8)+_0x3e67a0+'/e/'+_0x3d8e22[_0x5c8320(0xf0)]+_0x5c8320(0xc2));console[_0x5c8320(0x72)]('\x20\x20'+a29_0x23cc89[_0x5c8320(0xf6)](_0x121e16));}}}for(const _0x18ea9e of _0x34cde9){console[_0x5c8320(0x72)](a29_0x23cc89['yellow']('⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20'+_0x18ea9e[_0x5c8320(0xfd)])),_0x40ba3b++;}const _0x2555ff=[];if(_0x221961>0x0)_0x2555ff['push'](_0x221961+_0x5c8320(0xe6));if(_0x29b02f>0x0)_0x2555ff[_0x5c8320(0x7c)](_0x29b02f+_0x5c8320(0xeb));if(_0x2d57a3>0x0)_0x2555ff[_0x5c8320(0x7c)](_0x2d57a3+_0x5c8320(0xb5));const _0x312303=[];if(_0x1f0075>0x0)_0x312303[_0x5c8320(0x7c)](_0x1f0075+_0x5c8320(0xe6));if(_0x2a1f35>0x0)_0x312303[_0x5c8320(0x7c)](_0x2a1f35+_0x5c8320(0xeb));if(_0x40ba3b>0x0)_0x312303[_0x5c8320(0x7c)](_0x40ba3b+_0x5c8320(0xb5));const _0x4efa6e=[];if(_0x5635c1>0x0)_0x4efa6e[_0x5c8320(0x7c)](_0x5635c1+_0x5c8320(0xe6));if(_0x483b1c>0x0)_0x4efa6e[_0x5c8320(0x7c)](_0x483b1c+_0x5c8320(0xeb));if(_0x53382c>0x0)_0x4efa6e['push'](_0x53382c+_0x5c8320(0xb5));return console['error'](a29_0x23cc89[_0x5c8320(0xdb)](_0x5c8320(0x76))),_0x2555ff[_0x5c8320(0xec)]>0x0&&!_0x1716c3[_0x5c8320(0xbe)]&&console[_0x5c8320(0x72)](_0x5c8320(0xef)+_0x2555ff[_0x5c8320(0xc9)](',\x20')),_0x312303[_0x5c8320(0xec)]>0x0&&console['error']('\x20\x20Journeys:\x20'+_0x312303[_0x5c8320(0xc9)](',\x20')),_0x4efa6e['length']>0x0&&!_0x1716c3[_0x5c8320(0xbe)]&&console[_0x5c8320(0x72)](_0x5c8320(0xb8)+_0x4efa6e['join'](',\x20')),0x0;}}
@@ -1 +1 @@
1
- const a30_0x1050e6=a30_0x286c;(function(_0x389d2f,_0x27a0d2){const _0x2e0ad9=a30_0x286c,_0x2f914c=_0x389d2f();while(!![]){try{const _0x20a946=-parseInt(_0x2e0ad9(0x118))/0x1*(-parseInt(_0x2e0ad9(0x124))/0x2)+-parseInt(_0x2e0ad9(0x107))/0x3+-parseInt(_0x2e0ad9(0x10a))/0x4+-parseInt(_0x2e0ad9(0x111))/0x5+parseInt(_0x2e0ad9(0x112))/0x6*(-parseInt(_0x2e0ad9(0x104))/0x7)+parseInt(_0x2e0ad9(0x11e))/0x8*(-parseInt(_0x2e0ad9(0xfe))/0x9)+-parseInt(_0x2e0ad9(0x10d))/0xa*(-parseInt(_0x2e0ad9(0x122))/0xb);if(_0x20a946===_0x27a0d2)break;else _0x2f914c['push'](_0x2f914c['shift']());}catch(_0x2cc4f1){_0x2f914c['push'](_0x2f914c['shift']());}}}(a30_0x33db,0x5dfdf));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';function a30_0x286c(_0x7d7f6d,_0xaa8351){_0x7d7f6d=_0x7d7f6d-0xfc;const _0x33db1d=a30_0x33db();let _0x286c06=_0x33db1d[_0x7d7f6d];return _0x286c06;}import{SDKError,ErrorCode}from'../sdk/index.js';import a30_0x585224 from'chalk';function a30_0x33db(){const _0x298409=['description','resolveFolderId','547692RatoBa','includes','verbose','30NlHMXD','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','rule','ruleFile','1951425iUWufq','318468wxDHOP','Update\x20existing\x20child\x20segment','Resolved\x20relative\x20path\x20to:\x20','segmentId','segmentPath','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','359048wdsLpf','Updating\x20segment\x20\x27','segment','type','data','✔\x20Updated\x20segment\x20\x27','8rlmdcV','Segment\x20ID\x20missing\x20from\x20resolved\x20path','INTERNAL','name','3570787OwYcaQ','\x27...','4guBUav','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','\x20\x20\x20Path:\x20','Error:\x20Cannot\x20update\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','segmentName','folder','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','parentId','error','⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.','yellow','1017261UbRBDX','Resolving\x20folder\x20\x27','Resolved\x20folder\x20ID:\x20','kind','updateSegmentById','segment:update','28lxUSPc','Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]','Resolving\x20path\x20\x27','1363221EasXOX'];a30_0x33db=function(){return _0x298409;};return a30_0x33db();}export class SegmentUpdateCommand extends BaseCommand{[a30_0x1050e6(0x121)]=a30_0x1050e6(0x103);[a30_0x1050e6(0x108)]=a30_0x1050e6(0x113);async['execute'](_0x53fcdc){const _0x311e6d=a30_0x1050e6;console[_0x311e6d(0x12e)](a30_0x585224[_0x311e6d(0xfd)](_0x311e6d(0xfc))),console[_0x311e6d(0x12e)](a30_0x585224['yellow'](_0x311e6d(0x128)));const {options:_0x4b459c,args:_0x5bb266,tdx:_0x4bf459}=_0x53fcdc,_0x21eb5e=_0x4b459c;if(_0x5bb266['length']===0x0)return console[_0x311e6d(0x12e)](_0x311e6d(0x125)),console[_0x311e6d(0x12e)](_0x311e6d(0x10e)),console['error']('Examples:'),console[_0x311e6d(0x12e)](_0x311e6d(0x12c)),console[_0x311e6d(0x12e)](_0x311e6d(0x117)),0x1;const _0x30610b=_0x5bb266[0x0],_0x2bf2a0=_0x4b459c[_0x311e6d(0x116)];let _0x3836ef=_0x30610b;_0x2bf2a0&&!_0x30610b[_0x311e6d(0x10b)]('/')&&(_0x3836ef=_0x2bf2a0+'/'+_0x30610b,_0x21eb5e['verbose']&&console[_0x311e6d(0x12e)](_0x311e6d(0x114)+_0x3836ef));const _0x96c83d=await withSpinner(_0x311e6d(0x106)+_0x3836ef+'\x27...',()=>_0x4bf459[_0x311e6d(0x11a)]['resolvePathToResource'](_0x3836ef),{'verbose':_0x21eb5e[_0x311e6d(0x10c)]}),_0x1f89aa=_0x96c83d[_0x311e6d(0x11c)];_0x21eb5e[_0x311e6d(0x10c)]&&console[_0x311e6d(0x12e)]('Resolved\x20type:\x20'+_0x1f89aa[_0x311e6d(0x11b)]);if(_0x1f89aa['type']!==_0x311e6d(0x11a))return console[_0x311e6d(0x12e)](_0x311e6d(0x127)+_0x1f89aa[_0x311e6d(0x11b)]+_0x311e6d(0x12b)),console[_0x311e6d(0x12e)](_0x311e6d(0x105)),0x1;if(!_0x1f89aa[_0x311e6d(0x115)])throw new SDKError(ErrorCode[_0x311e6d(0x120)],_0x311e6d(0x11f));const _0x41e303=_0x1f89aa[_0x311e6d(0x12d)],_0x37f917=_0x1f89aa[_0x311e6d(0x115)];_0x21eb5e['verbose']&&(console[_0x311e6d(0x12e)]('Parent\x20ID:\x20'+_0x41e303),console[_0x311e6d(0x12e)]('Segment\x20ID:\x20'+_0x37f917));let _0x53e99b;if(_0x21eb5e[_0x311e6d(0x12a)]){const _0x1c9a74=_0x21eb5e[_0x311e6d(0x12a)],_0x2c6aec=await withSpinner(_0x311e6d(0xff)+_0x1c9a74+_0x311e6d(0x123),()=>_0x4bf459[_0x311e6d(0x11a)][_0x311e6d(0x109)](_0x41e303,_0x1c9a74),{'verbose':_0x21eb5e[_0x311e6d(0x10c)]});_0x53e99b=parseInt(_0x2c6aec[_0x311e6d(0x11c)],0xa),_0x21eb5e['verbose']&&console[_0x311e6d(0x12e)](_0x311e6d(0x100)+_0x53e99b);}const _0x479f17=await loadJSONFromOptions(_0x21eb5e[_0x311e6d(0x10f)],_0x21eb5e[_0x311e6d(0x110)]),_0x1036fc={'name':_0x21eb5e['name'],'description':_0x21eb5e['description'],'rule':_0x479f17,'kind':_0x21eb5e[_0x311e6d(0x101)]!==undefined?parseInt(_0x21eb5e[_0x311e6d(0x101)],0xa):undefined,'segmentFolderId':_0x53e99b},_0x14d9cf=await withSpinner(_0x311e6d(0x119)+_0x1f89aa[_0x311e6d(0x129)]+_0x311e6d(0x123),()=>_0x4bf459[_0x311e6d(0x11a)][_0x311e6d(0x102)](_0x41e303,_0x37f917,_0x1036fc),{'verbose':_0x21eb5e[_0x311e6d(0x10c)]}),_0x316044=_0x14d9cf[_0x311e6d(0x11c)];return console[_0x311e6d(0x12e)](_0x311e6d(0x11d)+_0x316044[_0x311e6d(0x121)]+'\x27'),_0x3836ef!==_0x30610b&&console[_0x311e6d(0x12e)](_0x311e6d(0x126)+_0x3836ef),await handleSDKOutput([_0x316044],_0x21eb5e),0x0;}}
1
+ const a30_0xa52670=a30_0x4409;(function(_0x618e5e,_0x4b4c0e){const _0xb66e93=a30_0x4409,_0x318a99=_0x618e5e();while(!![]){try{const _0x53d402=-parseInt(_0xb66e93(0x208))/0x1*(parseInt(_0xb66e93(0x214))/0x2)+parseInt(_0xb66e93(0x203))/0x3*(-parseInt(_0xb66e93(0x20b))/0x4)+parseInt(_0xb66e93(0x207))/0x5+parseInt(_0xb66e93(0x212))/0x6*(-parseInt(_0xb66e93(0x1ff))/0x7)+parseInt(_0xb66e93(0x1fc))/0x8*(parseInt(_0xb66e93(0x21c))/0x9)+-parseInt(_0xb66e93(0x213))/0xa+parseInt(_0xb66e93(0x206))/0xb*(parseInt(_0xb66e93(0x209))/0xc);if(_0x53d402===_0x4b4c0e)break;else _0x318a99['push'](_0x318a99['shift']());}catch(_0x2732ae){_0x318a99['push'](_0x318a99['shift']());}}}(a30_0x2150,0xe73b5));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a30_0x2150(){const _0x4d5833=['\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Segment\x20ID\x20missing\x20from\x20resolved\x20path','kind','7412202dbjska','5073570ltkiKM','3948qgzHaC','error','length','segmentPath','data','resolvePathToResource','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Resolving\x20folder\x20\x27','261pmNROl','yellow','\x20\x20\x20Path:\x20','Segment\x20ID:\x20','Updating\x20segment\x20\x27','Examples:','Error:\x20Cannot\x20update\x20','description','\x27...','Update\x20existing\x20child\x20segment','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','✔\x20Updated\x20segment\x20\x27','238088LuTUIT','INTERNAL','segment','7gCAdrq','execute','name','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','3NuhdTD','Resolving\x20path\x20\x27','type','561NgmCtS','7427280UXyVjM','271qURokv','525828NIiAXP','resolveFolderId','5433964TSCSPv','includes','verbose','Resolved\x20relative\x20path\x20to:\x20'];a30_0x2150=function(){return _0x4d5833;};return a30_0x2150();}import{withSpinner}from'../utils/spinner.js';function a30_0x4409(_0x1b847b,_0x276733){_0x1b847b=_0x1b847b-0x1f3;const _0x2150f9=a30_0x2150();let _0x4409de=_0x2150f9[_0x1b847b];return _0x4409de;}import{loadJSONFromOptions}from'../utils/json-loader.js';import{SDKError,ErrorCode}from'../sdk/index.js';import a30_0x231aae from'chalk';export class SegmentUpdateCommand extends BaseCommand{[a30_0xa52670(0x201)]='segment:update';[a30_0xa52670(0x1f7)]=a30_0xa52670(0x1f9);async[a30_0xa52670(0x200)](_0x11ffa1){const _0x822514=a30_0xa52670;console['error'](a30_0x231aae['yellow']('⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.')),console['error'](a30_0x231aae[_0x822514(0x21d)](_0x822514(0x20f)));const {options:_0x27fc16,args:_0x23c86c,tdx:_0x2300d5}=_0x11ffa1,_0x269ba4=_0x27fc16;if(_0x23c86c[_0x822514(0x216)]===0x0)return console[_0x822514(0x215)](_0x822514(0x21a)),console[_0x822514(0x215)]('Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]'),console[_0x822514(0x215)](_0x822514(0x1f5)),console[_0x822514(0x215)]('\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22'),console[_0x822514(0x215)](_0x822514(0x202)),0x1;const _0x174780=_0x23c86c[0x0],_0x47e7c9=_0x27fc16[_0x822514(0x217)];let _0x3533ab=_0x174780;_0x47e7c9&&!_0x174780[_0x822514(0x20c)]('/')&&(_0x3533ab=_0x47e7c9+'/'+_0x174780,_0x269ba4[_0x822514(0x20d)]&&console[_0x822514(0x215)](_0x822514(0x20e)+_0x3533ab));const _0x1f594d=await withSpinner(_0x822514(0x204)+_0x3533ab+_0x822514(0x1f8),()=>_0x2300d5['segment'][_0x822514(0x219)](_0x3533ab),{'verbose':_0x269ba4[_0x822514(0x20d)]}),_0x351d61=_0x1f594d[_0x822514(0x218)];_0x269ba4[_0x822514(0x20d)]&&console[_0x822514(0x215)]('Resolved\x20type:\x20'+_0x351d61[_0x822514(0x205)]);if(_0x351d61[_0x822514(0x205)]!==_0x822514(0x1fe))return console[_0x822514(0x215)](_0x822514(0x1f6)+_0x351d61['type']+_0x822514(0x1fa)),console[_0x822514(0x215)]('Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]'),0x1;if(!_0x351d61['segmentId'])throw new SDKError(ErrorCode[_0x822514(0x1fd)],_0x822514(0x210));const _0x295511=_0x351d61['parentId'],_0x4566a9=_0x351d61['segmentId'];_0x269ba4['verbose']&&(console['error']('Parent\x20ID:\x20'+_0x295511),console[_0x822514(0x215)](_0x822514(0x1f3)+_0x4566a9));let _0x3a6d8b;if(_0x269ba4['folder']){const _0x23789f=_0x269ba4['folder'],_0x1bec28=await withSpinner(_0x822514(0x21b)+_0x23789f+_0x822514(0x1f8),()=>_0x2300d5[_0x822514(0x1fe)][_0x822514(0x20a)](_0x295511,_0x23789f),{'verbose':_0x269ba4['verbose']});_0x3a6d8b=parseInt(_0x1bec28[_0x822514(0x218)],0xa),_0x269ba4[_0x822514(0x20d)]&&console[_0x822514(0x215)]('Resolved\x20folder\x20ID:\x20'+_0x3a6d8b);}const _0x48146b=await loadJSONFromOptions(_0x269ba4['rule'],_0x269ba4['ruleFile']),_0x5692b9={'name':_0x269ba4[_0x822514(0x201)],'description':_0x269ba4[_0x822514(0x1f7)],'rule':_0x48146b,'kind':_0x269ba4[_0x822514(0x211)]!==undefined?parseInt(_0x269ba4[_0x822514(0x211)],0xa):undefined,'segmentFolderId':_0x3a6d8b},_0x2dff0b=await withSpinner(_0x822514(0x1f4)+_0x351d61['segmentName']+_0x822514(0x1f8),()=>_0x2300d5[_0x822514(0x1fe)]['updateSegmentById'](_0x295511,_0x4566a9,_0x5692b9),{'verbose':_0x269ba4['verbose']}),_0x123186=_0x2dff0b[_0x822514(0x218)];return console[_0x822514(0x215)](_0x822514(0x1fb)+_0x123186[_0x822514(0x201)]+'\x27'),_0x3533ab!==_0x174780&&console[_0x822514(0x215)](_0x822514(0x21e)+_0x3533ab),await handleSDKOutput([_0x123186],_0x269ba4),0x0;}}
@@ -1 +1 @@
1
- const a31_0x399110=a31_0x4a18;(function(_0x45e577,_0x8c36f4){const _0x2e2a24=a31_0x4a18,_0x49cc9b=_0x45e577();while(!![]){try{const _0xb193f=-parseInt(_0x2e2a24(0x181))/0x1*(parseInt(_0x2e2a24(0x174))/0x2)+-parseInt(_0x2e2a24(0x17a))/0x3+parseInt(_0x2e2a24(0x176))/0x4+-parseInt(_0x2e2a24(0x16d))/0x5+parseInt(_0x2e2a24(0x18d))/0x6*(-parseInt(_0x2e2a24(0x192))/0x7)+parseInt(_0x2e2a24(0x172))/0x8+-parseInt(_0x2e2a24(0x16c))/0x9*(-parseInt(_0x2e2a24(0x19c))/0xa);if(_0xb193f===_0x8c36f4)break;else _0x49cc9b['push'](_0x49cc9b['shift']());}catch(_0x2a3b2b){_0x49cc9b['push'](_0x49cc9b['shift']());}}}(a31_0x5532,0x2a898));function a31_0x4a18(_0x36166c,_0xd46e55){_0x36166c=_0x36166c-0x166;const _0x55329f=a31_0x5532();let _0x4a183e=_0x55329f[_0x36166c];return _0x4a183e;}import{existsSync,statSync}from'fs';import a31_0xa183de from'chalk';import{BaseCommand}from'./command.js';import{saveSessionContext}from'../core/session.js';import{withSpinner}from'../utils/spinner.js';import{parsePath,normalizePath}from'../sdk/segment/segment-path-parser.js';function a31_0x5532(){const _0x47d71=['type','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','Set\x20current\x20segment/folder\x20context\x20for\x20navigation','description','red','green','folderPath','parent_segment','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','6660sFVIml','segment','Resolved\x20path\x20type:\x20','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','error','fullPath','Resolving\x20path\x20\x27','Examples:','verbose','3447CYLKZB','1282290QacRYh','segments','resolvePathToResource','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>','1710456vZqdUQ','Site:\x20','4bFRFan','\x27...','1134828EuNmpp','Parent\x20ID:\x20','Use:\x20tdx\x20segment\x20use\x20','cyan','367173RXKfHL','parentId','config','log','✔\x20Context\x20set\x20to:\x20','site','Target\x20path:\x20','86962GlqFpy','isAbsolute','session','data','Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.','join','dim','length','Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context','segmentPath','segment:use','Resolved\x20relative\x20path\x20to:\x20','17058PZivwE','execute','split','\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context','Use\x20\x22tdx\x20use\x22\x20to\x20see\x20all\x20context\x20parameters','63TyvWna'];a31_0x5532=function(){return _0x47d71;};return a31_0x5532();}import{findTdxConfig}from'../sdk/segment/tdx-config.js';export class SegmentUseCommand extends BaseCommand{['name']=a31_0x399110(0x18b);[a31_0x399110(0x196)]=a31_0x399110(0x195);async[a31_0x399110(0x18e)](_0x4daaec){const _0xd619d3=a31_0x399110,{options:_0x395223,args:_0x309cb8,tdx:_0x4df1c7}=_0x4daaec;if(_0x309cb8[_0xd619d3(0x188)]===0x0)return console[_0xd619d3(0x167)](a31_0xa183de['red']('Error:\x20Path\x20is\x20required\x0a')),console[_0xd619d3(0x167)]('Usage:\x20tdx\x20segment\x20use\x20<path>'),console['error'](_0xd619d3(0x16a)),console[_0xd619d3(0x167)]('\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22'),console[_0xd619d3(0x167)]('\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22'),console[_0xd619d3(0x167)](_0xd619d3(0x190)),console[_0xd619d3(0x167)]('\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent'),0x1;const _0x35fdf5=_0x309cb8[0x0],_0x22a3a8=_0x395223[_0xd619d3(0x183)];try{if(_0x35fdf5==='/')return saveSessionContext({'segment_path':undefined},_0x22a3a8),console[_0xd619d3(0x17d)](a31_0xa183de[_0xd619d3(0x198)](_0xd619d3(0x170))),0x0;if(existsSync(_0x35fdf5)&&statSync(_0x35fdf5)['isDirectory']()){let _0x49a732;try{_0x49a732=findTdxConfig(_0x35fdf5);}catch{return console[_0xd619d3(0x167)](a31_0xa183de[_0xd619d3(0x197)](_0xd619d3(0x166)+_0x35fdf5)),console[_0xd619d3(0x167)](a31_0xa183de['cyan'](_0xd619d3(0x19b))),0x1;}const _0x283bdf=_0x49a732[_0xd619d3(0x17c)][_0xd619d3(0x19a)];return saveSessionContext({'segment_path':_0x283bdf,'parent_segment':_0x283bdf},_0x22a3a8),console['log'](a31_0xa183de[_0xd619d3(0x198)]('✔\x20Context\x20set\x20to:\x20'+a31_0xa183de[_0xd619d3(0x179)](_0x283bdf))),0x0;}const _0x581954=_0x395223[_0xd619d3(0x18a)];let _0x447dea=_0x35fdf5;const _0x34ca85=parsePath(_0x35fdf5);if(!_0x34ca85[_0xd619d3(0x182)]){if(!_0x581954)return console['error'](a31_0xa183de[_0xd619d3(0x197)](_0xd619d3(0x185))),console['error'](a31_0xa183de[_0xd619d3(0x179)](_0xd619d3(0x171))),0x1;if(_0x35fdf5==='..'){const _0x3a927d=_0x581954[_0xd619d3(0x18f)]('/')['slice'](0x0,-0x1)['join']('/');_0x447dea=_0x3a927d||'/';}else _0x35fdf5==='.'?_0x447dea=_0x581954:_0x447dea=_0x581954+'/'+_0x35fdf5;_0x395223[_0xd619d3(0x16b)]&&console[_0xd619d3(0x167)](_0xd619d3(0x18c)+_0x447dea);}if(_0x447dea==='/'||_0x447dea==='')return saveSessionContext({'segment_path':undefined},_0x22a3a8),console[_0xd619d3(0x17d)](a31_0xa183de[_0xd619d3(0x198)]('✔\x20Context\x20cleared.\x20Back\x20to\x20root.')),0x0;_0x447dea=normalizePath(_0x447dea);const _0x3cdcbc=parsePath(_0x447dea)[_0xd619d3(0x16e)];if(_0x3cdcbc['length']===0x0)return saveSessionContext({'segment_path':undefined},_0x22a3a8),console[_0xd619d3(0x17d)](a31_0xa183de[_0xd619d3(0x198)](_0xd619d3(0x170))),0x0;_0x395223[_0xd619d3(0x16b)]&&(console[_0xd619d3(0x167)](_0xd619d3(0x173)+_0x395223[_0xd619d3(0x17f)]),console[_0xd619d3(0x167)](_0xd619d3(0x180)+_0x447dea));const _0x4fe6e7=await withSpinner(_0xd619d3(0x169)+_0x447dea+_0xd619d3(0x175),()=>_0x4df1c7[_0xd619d3(0x19d)][_0xd619d3(0x16f)](_0x447dea),{'verbose':_0x395223[_0xd619d3(0x16b)]}),_0xe93ab3=_0x4fe6e7[_0xd619d3(0x184)];_0x395223[_0xd619d3(0x16b)]&&(console[_0xd619d3(0x167)](_0xd619d3(0x19e)+_0xe93ab3[_0xd619d3(0x193)]),console[_0xd619d3(0x167)](_0xd619d3(0x177)+_0xe93ab3[_0xd619d3(0x17b)]),_0xe93ab3['folderId']&&console[_0xd619d3(0x167)]('Folder\x20ID:\x20'+_0xe93ab3['folderId']));if(_0xe93ab3[_0xd619d3(0x193)]==='segment')return console['error'](a31_0xa183de[_0xd619d3(0x197)]('Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.')),console[_0xd619d3(0x167)](_0xd619d3(0x194)),console[_0xd619d3(0x167)](a31_0xa183de[_0xd619d3(0x179)](_0xd619d3(0x178)+_0xe93ab3['parentName']+(_0xe93ab3[_0xd619d3(0x199)]?'/'+_0xe93ab3['folderPath'][_0xd619d3(0x186)]('/'):''))),0x1;return saveSessionContext({'segment_path':_0xe93ab3[_0xd619d3(0x168)],'parent_segment':_0xe93ab3['parentName']},_0x22a3a8),console[_0xd619d3(0x17d)](a31_0xa183de[_0xd619d3(0x198)](_0xd619d3(0x17e)+a31_0xa183de[_0xd619d3(0x179)](_0xe93ab3[_0xd619d3(0x168)]))),_0x395223[_0xd619d3(0x16b)]&&(console['error'](a31_0xa183de['dim'](_0xd619d3(0x189))),console[_0xd619d3(0x167)](a31_0xa183de[_0xd619d3(0x187)](_0xd619d3(0x191)))),0x0;}catch(_0x31f574){throw _0x31f574;}}}
1
+ const a31_0x2c49da=a31_0x4320;(function(_0x4aa9a,_0x938b5e){const _0x5bbf95=a31_0x4320,_0x1e4669=_0x4aa9a();while(!![]){try{const _0x4ea88b=parseInt(_0x5bbf95(0x97))/0x1+parseInt(_0x5bbf95(0xc1))/0x2*(parseInt(_0x5bbf95(0xbc))/0x3)+parseInt(_0x5bbf95(0xb6))/0x4*(-parseInt(_0x5bbf95(0xa1))/0x5)+-parseInt(_0x5bbf95(0xae))/0x6*(-parseInt(_0x5bbf95(0xa3))/0x7)+parseInt(_0x5bbf95(0xb7))/0x8+parseInt(_0x5bbf95(0xab))/0x9+-parseInt(_0x5bbf95(0xb5))/0xa;if(_0x4ea88b===_0x938b5e)break;else _0x1e4669['push'](_0x1e4669['shift']());}catch(_0x48c3e7){_0x1e4669['push'](_0x1e4669['shift']());}}}(a31_0x4907,0x8acd4));function a31_0x4320(_0x48938a,_0x435e79){_0x48938a=_0x48938a-0x96;const _0x490742=a31_0x4907();let _0x4320b9=_0x490742[_0x48938a];return _0x4320b9;}function a31_0x4907(){const _0x498d56=['Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','folderId','2980UBVNKR','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','291487xOknMh','error','Folder\x20ID:\x20','folderPath','config','session','cyan','Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context','6676101RGJcPV','\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent','segment:use','54VKBDKF','\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context','verbose','dim','slice','Use:\x20tdx\x20segment\x20use\x20','fullPath','22251470KMTQGg','1228XuNSFq','8204392GUxUNL','segmentPath','site','Resolved\x20relative\x20path\x20to:\x20','name','357873oKWEVR','red','resolvePathToResource','split','type','2RwBfFE','Usage:\x20tdx\x20segment\x20use\x20<path>','parentName','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.','length','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Use\x20\x22tdx\x20use\x22\x20to\x20see\x20all\x20context\x20parameters','Target\x20path:\x20','\x27...','log','segment','Site:\x20','Resolving\x20path\x20\x27','data','parentId','parent_segment','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','Resolved\x20path\x20type:\x20','segments','715253rocFvY','description','execute','✔\x20Context\x20set\x20to:\x20','green','join','Examples:','Set\x20current\x20segment/folder\x20context\x20for\x20navigation'];a31_0x4907=function(){return _0x498d56;};return a31_0x4907();}import{existsSync,statSync}from'fs';import a31_0x656a78 from'chalk';import{BaseCommand}from'./command.js';import{saveSessionContext}from'../core/session.js';import{withSpinner}from'../utils/spinner.js';import{parsePath,normalizePath}from'../sdk/segment/segment-path-parser.js';import{findTdxConfig}from'../sdk/segment/tdx-config.js';export class SegmentUseCommand extends BaseCommand{[a31_0x2c49da(0xbb)]=a31_0x2c49da(0xad);[a31_0x2c49da(0x98)]=a31_0x2c49da(0x9e);async[a31_0x2c49da(0x99)](_0x3b457d){const _0x551e24=a31_0x2c49da,{options:_0x1c51a0,args:_0x56db42,tdx:_0x1c2cc1}=_0x3b457d;if(_0x56db42['length']===0x0)return console[_0x551e24(0xa4)](a31_0x656a78[_0x551e24(0xbd)]('Error:\x20Path\x20is\x20required\x0a')),console['error'](_0x551e24(0xc2)),console[_0x551e24(0xa4)](_0x551e24(0x9d)),console[_0x551e24(0xa4)](_0x551e24(0xc4)),console[_0x551e24(0xa4)]('\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22'),console['error'](_0x551e24(0xaf)),console['error'](_0x551e24(0xac)),0x1;const _0x3322bb=_0x56db42[0x0],_0x33e8a1=_0x1c51a0[_0x551e24(0xa8)];try{if(_0x3322bb==='/')return saveSessionContext({'segment_path':undefined},_0x33e8a1),console[_0x551e24(0xcb)](a31_0x656a78['green'](_0x551e24(0xd2))),0x0;if(existsSync(_0x3322bb)&&statSync(_0x3322bb)['isDirectory']()){let _0x18d026;try{_0x18d026=findTdxConfig(_0x3322bb);}catch{return console[_0x551e24(0xa4)](a31_0x656a78[_0x551e24(0xbd)](_0x551e24(0x9f)+_0x3322bb)),console[_0x551e24(0xa4)](a31_0x656a78[_0x551e24(0xa9)](_0x551e24(0xc7))),0x1;}const _0x3bba3c=_0x18d026[_0x551e24(0xa7)][_0x551e24(0xd1)];return saveSessionContext({'segment_path':_0x3bba3c,'parent_segment':_0x3bba3c},_0x33e8a1),console[_0x551e24(0xcb)](a31_0x656a78[_0x551e24(0x9b)](_0x551e24(0x9a)+a31_0x656a78['cyan'](_0x3bba3c))),0x0;}const _0x3edbf5=_0x1c51a0[_0x551e24(0xb8)];let _0x5c73d9=_0x3322bb;const _0x50180b=parsePath(_0x3322bb);if(!_0x50180b['isAbsolute']){if(!_0x3edbf5)return console[_0x551e24(0xa4)](a31_0x656a78[_0x551e24(0xbd)](_0x551e24(0xc5))),console['error'](a31_0x656a78['cyan']('Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>')),0x1;if(_0x3322bb==='..'){const _0x519111=_0x3edbf5[_0x551e24(0xbf)]('/')[_0x551e24(0xb2)](0x0,-0x1)[_0x551e24(0x9c)]('/');_0x5c73d9=_0x519111||'/';}else _0x3322bb==='.'?_0x5c73d9=_0x3edbf5:_0x5c73d9=_0x3edbf5+'/'+_0x3322bb;_0x1c51a0[_0x551e24(0xb0)]&&console[_0x551e24(0xa4)](_0x551e24(0xba)+_0x5c73d9);}if(_0x5c73d9==='/'||_0x5c73d9==='')return saveSessionContext({'segment_path':undefined},_0x33e8a1),console[_0x551e24(0xcb)](a31_0x656a78[_0x551e24(0x9b)](_0x551e24(0xd2))),0x0;_0x5c73d9=normalizePath(_0x5c73d9);const _0x15abd6=parsePath(_0x5c73d9)[_0x551e24(0x96)];if(_0x15abd6[_0x551e24(0xc6)]===0x0)return saveSessionContext({'segment_path':undefined},_0x33e8a1),console[_0x551e24(0xcb)](a31_0x656a78[_0x551e24(0x9b)]('✔\x20Context\x20cleared.\x20Back\x20to\x20root.')),0x0;_0x1c51a0['verbose']&&(console['error'](_0x551e24(0xcd)+_0x1c51a0[_0x551e24(0xb9)]),console[_0x551e24(0xa4)](_0x551e24(0xc9)+_0x5c73d9));const _0x58d5e3=await withSpinner(_0x551e24(0xce)+_0x5c73d9+_0x551e24(0xca),()=>_0x1c2cc1[_0x551e24(0xcc)][_0x551e24(0xbe)](_0x5c73d9),{'verbose':_0x1c51a0[_0x551e24(0xb0)]}),_0x1b80e8=_0x58d5e3[_0x551e24(0xcf)];_0x1c51a0[_0x551e24(0xb0)]&&(console[_0x551e24(0xa4)](_0x551e24(0xd3)+_0x1b80e8['type']),console[_0x551e24(0xa4)]('Parent\x20ID:\x20'+_0x1b80e8[_0x551e24(0xd0)]),_0x1b80e8[_0x551e24(0xa0)]&&console[_0x551e24(0xa4)](_0x551e24(0xa5)+_0x1b80e8[_0x551e24(0xa0)]));if(_0x1b80e8[_0x551e24(0xc0)]===_0x551e24(0xcc))return console['error'](a31_0x656a78['red']('Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.')),console[_0x551e24(0xa4)](_0x551e24(0xa2)),console[_0x551e24(0xa4)](a31_0x656a78[_0x551e24(0xa9)](_0x551e24(0xb3)+_0x1b80e8[_0x551e24(0xc3)]+(_0x1b80e8[_0x551e24(0xa6)]?'/'+_0x1b80e8[_0x551e24(0xa6)][_0x551e24(0x9c)]('/'):''))),0x1;return saveSessionContext({'segment_path':_0x1b80e8[_0x551e24(0xb4)],'parent_segment':_0x1b80e8[_0x551e24(0xc3)]},_0x33e8a1),console[_0x551e24(0xcb)](a31_0x656a78['green'](_0x551e24(0x9a)+a31_0x656a78[_0x551e24(0xa9)](_0x1b80e8['fullPath']))),_0x1c51a0[_0x551e24(0xb0)]&&(console['error'](a31_0x656a78['dim'](_0x551e24(0xaa))),console[_0x551e24(0xa4)](a31_0x656a78[_0x551e24(0xb1)](_0x551e24(0xc8)))),0x0;}catch(_0x330036){throw _0x330036;}}}