@treasuredata/tdx 0.8.6 → 0.8.8

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 (116) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +2 -2
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/client/cdp-api-client.js +1 -1
  6. package/dist/client/engage-api-client.js +1 -1
  7. package/dist/client/http-client.js +1 -1
  8. package/dist/client/llm-api-client.js +1 -1
  9. package/dist/client/rate-limiter.js +1 -1
  10. package/dist/client/td-api-client.js +1 -1
  11. package/dist/client/trino-api-client.js +1 -1
  12. package/dist/client/workflow-client.js +1 -1
  13. package/dist/commands/activations.js +1 -1
  14. package/dist/commands/api-command.js +1 -1
  15. package/dist/commands/auth-command.js +1 -1
  16. package/dist/commands/chat-command.js +1 -1
  17. package/dist/commands/claude-command.d.ts.map +1 -1
  18. package/dist/commands/claude-command.js +1 -1
  19. package/dist/commands/claude-command.js.map +1 -1
  20. package/dist/commands/claude-statusline-command.js +1 -1
  21. package/dist/commands/claude-usage-command.js +1 -1
  22. package/dist/commands/command.js +1 -1
  23. package/dist/commands/connection-command.js +1 -1
  24. package/dist/commands/context-command.js +1 -1
  25. package/dist/commands/databases.js +1 -1
  26. package/dist/commands/describe.js +1 -1
  27. package/dist/commands/engage-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/journey-command.js +1 -1
  30. package/dist/commands/llm-command.js +1 -1
  31. package/dist/commands/llm-proxy.js +1 -1
  32. package/dist/commands/parent-segment-command.js +1 -1
  33. package/dist/commands/profiles-command.js +1 -1
  34. package/dist/commands/query-command.js +1 -1
  35. package/dist/commands/segment-command.js +1 -1
  36. package/dist/commands/segment-create-command.js +1 -1
  37. package/dist/commands/segment-fields-command.js +1 -1
  38. package/dist/commands/segment-pull-command.js +1 -1
  39. package/dist/commands/segment-push-command.js +1 -1
  40. package/dist/commands/segment-update-command.js +1 -1
  41. package/dist/commands/segment-use-command.js +1 -1
  42. package/dist/commands/segments.js +1 -1
  43. package/dist/commands/show.js +1 -1
  44. package/dist/commands/tables.js +1 -1
  45. package/dist/commands/use-command.js +1 -1
  46. package/dist/commands/user-command.js +1 -1
  47. package/dist/commands/workflow-command.js +1 -1
  48. package/dist/core/auth.js +1 -1
  49. package/dist/core/config.js +1 -1
  50. package/dist/core/connection-cache.js +1 -1
  51. package/dist/core/credential-cache.js +1 -1
  52. package/dist/core/global-context.js +1 -1
  53. package/dist/core/keychain.js +1 -1
  54. package/dist/core/profile.js +1 -1
  55. package/dist/core/project-config.js +1 -1
  56. package/dist/core/session.js +1 -1
  57. package/dist/core/user-cache.js +1 -1
  58. package/dist/index.js +1 -1
  59. package/dist/proxy/anthropic-adapter.js +1 -1
  60. package/dist/proxy/claude-usage-tracker.js +1 -1
  61. package/dist/proxy/context-signature.js +1 -1
  62. package/dist/proxy/conversation-utils.js +1 -1
  63. package/dist/proxy/server.js +1 -1
  64. package/dist/proxy/session-cache.js +1 -1
  65. package/dist/sdk/api.js +1 -1
  66. package/dist/sdk/connection.js +1 -1
  67. package/dist/sdk/engage.js +1 -1
  68. package/dist/sdk/errors.js +1 -1
  69. package/dist/sdk/index.js +1 -1
  70. package/dist/sdk/job.js +1 -1
  71. package/dist/sdk/journey.js +1 -1
  72. package/dist/sdk/llm.js +1 -1
  73. package/dist/sdk/query.js +1 -1
  74. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  75. package/dist/sdk/segment/journey-yaml.js +1 -1
  76. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  77. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  78. package/dist/sdk/segment.js +1 -1
  79. package/dist/sdk/user.js +1 -1
  80. package/dist/sdk/workflow.js +1 -1
  81. package/dist/types/endpoints.js +1 -1
  82. package/dist/types/index.js +1 -1
  83. package/dist/utils/agent-ref-parser.js +1 -1
  84. package/dist/utils/async.js +1 -1
  85. package/dist/utils/chat-cache.js +1 -1
  86. package/dist/utils/colors.js +1 -1
  87. package/dist/utils/command-output.js +1 -1
  88. package/dist/utils/constants.js +1 -1
  89. package/dist/utils/diff.js +1 -1
  90. package/dist/utils/fields-display.js +1 -1
  91. package/dist/utils/file-permissions.js +1 -1
  92. package/dist/utils/format-detector.js +1 -1
  93. package/dist/utils/formatters.js +1 -1
  94. package/dist/utils/json-loader.js +1 -1
  95. package/dist/utils/llm-backup-utils.js +1 -1
  96. package/dist/utils/model-aliases.js +1 -1
  97. package/dist/utils/model-factors.js +1 -1
  98. package/dist/utils/option-validation.js +1 -1
  99. package/dist/utils/port.js +1 -1
  100. package/dist/utils/process.d.ts.map +1 -1
  101. package/dist/utils/process.js +1 -1
  102. package/dist/utils/process.js.map +1 -1
  103. package/dist/utils/prompt.js +1 -1
  104. package/dist/utils/segment-path-parser.js +1 -1
  105. package/dist/utils/segment-ref-parser.js +1 -1
  106. package/dist/utils/spinner.js +1 -1
  107. package/dist/utils/sql-parser.js +1 -1
  108. package/dist/utils/sse-parser.js +1 -1
  109. package/dist/utils/string-utils.js +1 -1
  110. package/dist/utils/table-ref-parser.js +1 -1
  111. package/dist/utils/tdx-config.js +1 -1
  112. package/dist/utils/tdx-logger.js +1 -1
  113. package/dist/utils/tree-formatter.js +1 -1
  114. package/dist/utils/version-check.js +1 -1
  115. package/dist/utils/workflow-utils.js +1 -1
  116. package/package.json +1 -1
@@ -1 +1 @@
1
- const a32_0x57785c=a32_0x1b34;(function(_0x4b8ad6,_0x438369){const _0x1fcf87=a32_0x1b34,_0x24df40=_0x4b8ad6();while(!![]){try{const _0x55a55e=parseInt(_0x1fcf87(0x135))/0x1*(-parseInt(_0x1fcf87(0x141))/0x2)+parseInt(_0x1fcf87(0x13e))/0x3*(parseInt(_0x1fcf87(0x136))/0x4)+parseInt(_0x1fcf87(0x137))/0x5+parseInt(_0x1fcf87(0x149))/0x6*(parseInt(_0x1fcf87(0x140))/0x7)+parseInt(_0x1fcf87(0x11e))/0x8+parseInt(_0x1fcf87(0x13d))/0x9+parseInt(_0x1fcf87(0x118))/0xa*(-parseInt(_0x1fcf87(0x147))/0xb);if(_0x55a55e===_0x438369)break;else _0x24df40['push'](_0x24df40['shift']());}catch(_0x5ea9dc){_0x24df40['push'](_0x24df40['shift']());}}}(a32_0x41a9,0xd3e34));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../utils/segment-path-parser.js';function a32_0x1b34(_0x2ad2ba,_0x509a7f){_0x2ad2ba=_0x2ad2ba-0x117;const _0x41a974=a32_0x41a9();let _0x1b3452=_0x41a974[_0x2ad2ba];return _0x1b3452;}import a32_0x2f3d3d from'chalk';export class SegmentCreateCommand extends BaseCommand{[a32_0x57785c(0x145)]=a32_0x57785c(0x12e);['description']=a32_0x57785c(0x12c);async[a32_0x57785c(0x128)](_0x5d0e5a){const _0x5492d4=a32_0x57785c;console[_0x5492d4(0x14d)](a32_0x2f3d3d['yellow'](_0x5492d4(0x13b))),console[_0x5492d4(0x14d)](a32_0x2f3d3d[_0x5492d4(0x123)](_0x5492d4(0x134)));const {options:_0x25328b,args:_0xdc7455,tdx:_0x5e9db1}=_0x5d0e5a,_0x995773=_0x25328b;if(_0xdc7455[_0x5492d4(0x148)]===0x0)return console['error'](_0x5492d4(0x127)),console['error']('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console[_0x5492d4(0x14d)](_0x5492d4(0x14a)),console[_0x5492d4(0x14d)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console[_0x5492d4(0x14d)](_0x5492d4(0x11a)),console[_0x5492d4(0x14d)](_0x5492d4(0x12b)),0x1;const _0x5c8de4=_0xdc7455[0x0],_0x3bc4ae=_0x25328b['segmentPath'];let _0x5330a1=_0x5c8de4;_0x3bc4ae&&!_0x5c8de4[_0x5492d4(0x12f)]('/')&&(_0x5330a1=_0x3bc4ae+'/'+_0x5c8de4,_0x995773['verbose']&&console[_0x5492d4(0x14d)](_0x5492d4(0x142)+_0x5330a1));const _0x5756ac=parsePath(_0x5330a1);if(_0x5756ac[_0x5492d4(0x133)][_0x5492d4(0x148)]<0x2)return console['error'](_0x5492d4(0x11d)),console[_0x5492d4(0x14d)]('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x47189a=_0x5756ac[_0x5492d4(0x133)][0x0],_0x3d2b53=getBaseName(_0x5330a1),_0x31b10a=getParentPath(_0x5330a1);_0x995773[_0x5492d4(0x12a)]&&(console[_0x5492d4(0x14d)](_0x5492d4(0x146)+_0x995773[_0x5492d4(0x124)]),console[_0x5492d4(0x14d)](_0x5492d4(0x126)+_0x5330a1),console[_0x5492d4(0x14d)](_0x5492d4(0x11c)+_0x47189a),console[_0x5492d4(0x14d)]('Segment\x20name:\x20'+_0x3d2b53),console['error'](_0x5492d4(0x11f)+_0x31b10a));const _0x26ec37=await withSpinner(_0x5492d4(0x11b)+_0x47189a+'\x27...',()=>_0x5e9db1[_0x5492d4(0x117)][_0x5492d4(0x13a)](_0x47189a),{'verbose':_0x995773[_0x5492d4(0x12a)]}),_0x1ae165=_0x26ec37['data'];let _0x178192;if(_0x5756ac[_0x5492d4(0x133)][_0x5492d4(0x148)]>0x2){const _0x230672=await withSpinner(_0x5492d4(0x129)+_0x31b10a+_0x5492d4(0x138),()=>_0x5e9db1['segment'][_0x5492d4(0x12d)](_0x31b10a),{'verbose':_0x995773[_0x5492d4(0x12a)]}),_0x2efa13=_0x230672[_0x5492d4(0x120)];if(_0x2efa13[_0x5492d4(0x130)]!==_0x5492d4(0x122)&&_0x2efa13[_0x5492d4(0x130)]!=='parent')return console[_0x5492d4(0x14d)](_0x5492d4(0x125)),0x1;_0x178192=_0x2efa13[_0x5492d4(0x132)];}else{if(_0x995773[_0x5492d4(0x122)]){const _0x428d70=await withSpinner(_0x5492d4(0x139)+_0x995773[_0x5492d4(0x122)]+'\x27...',()=>_0x5e9db1[_0x5492d4(0x117)][_0x5492d4(0x13c)](_0x1ae165,_0x995773[_0x5492d4(0x122)]),{'verbose':_0x995773['verbose']});_0x178192=_0x428d70['data'];}}_0x995773[_0x5492d4(0x12a)]&&_0x178192&&console[_0x5492d4(0x14d)](_0x5492d4(0x121)+_0x178192);const _0x46136f=await loadJSONFromOptions(_0x995773[_0x5492d4(0x143)],_0x995773[_0x5492d4(0x14b)]),_0x1b0712={'name':_0x3d2b53,'description':_0x995773[_0x5492d4(0x13f)],'rule':_0x46136f,'kind':_0x995773[_0x5492d4(0x119)]!==undefined?parseInt(_0x995773['kind'],0xa):undefined,'isVisible':_0x995773['invisible']?![]:undefined,'segmentFolderId':_0x178192,'countPopulation':_0x995773['noCountPopulation']?![]:undefined},_0x1e2d7b=await withSpinner('Creating\x20segment\x20\x27'+_0x3d2b53+_0x5492d4(0x138),()=>_0x5e9db1[_0x5492d4(0x117)][_0x5492d4(0x14c)](_0x1ae165,_0x1b0712),{'verbose':_0x995773[_0x5492d4(0x12a)]}),_0xf4730f=_0x1e2d7b[_0x5492d4(0x120)];return console['error'](_0x5492d4(0x131)+_0xf4730f[_0x5492d4(0x145)]+_0x5492d4(0x144)+_0xf4730f['id']),_0x5330a1!==_0x5c8de4&&console[_0x5492d4(0x14d)]('\x20\x20\x20Path:\x20'+_0x5330a1),await handleSDKOutput([_0xf4730f],_0x995773),0x0;}}function a32_0x41a9(){const _0xdd0ca1=['Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','Target\x20path:\x20','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','execute','Resolving\x20folder\x20path\x20\x27','verbose','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Create\x20child\x20segment\x20with\x20filtering\x20rules','resolvePathToResource','segment:create','includes','type','✔\x20Created\x20segment\x20\x27','folderId','segments','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','2ZVPFwQ','685804qNKVTr','7297490BxHRFH','\x27...','Resolving\x20folder\x20\x27','resolveParentId','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','resolveFolderId','13896459OnwICW','15emveKJ','description','7DnXZcB','603832zJRCbH','Resolved\x20relative\x20path\x20to:\x20','rule','\x27\x20with\x20ID:\x20','name','Site:\x20','519805XRiEiY','length','9581610OKOwxW','Examples:','ruleFile','createSegment','error','segment','890juhAOj','kind','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','Resolving\x20parent\x20segment\x20\x27','Parent:\x20','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','1757440NWrBuR','Parent\x20path:\x20','data','Resolved\x20folder\x20ID:\x20','folder','yellow','site'];a32_0x41a9=function(){return _0xdd0ca1;};return a32_0x41a9();}
1
+ const a32_0x585bd3=a32_0x156e;(function(_0x5a6113,_0x3f96ca){const _0x1f6b7f=a32_0x156e,_0x5941bb=_0x5a6113();while(!![]){try{const _0x1e070c=parseInt(_0x1f6b7f(0xe2))/0x1*(-parseInt(_0x1f6b7f(0xe3))/0x2)+-parseInt(_0x1f6b7f(0xe0))/0x3*(-parseInt(_0x1f6b7f(0xd3))/0x4)+parseInt(_0x1f6b7f(0xc9))/0x5+-parseInt(_0x1f6b7f(0xd1))/0x6+parseInt(_0x1f6b7f(0xc5))/0x7+parseInt(_0x1f6b7f(0xc1))/0x8+-parseInt(_0x1f6b7f(0xd7))/0x9*(parseInt(_0x1f6b7f(0xcd))/0xa);if(_0x1e070c===_0x3f96ca)break;else _0x5941bb['push'](_0x5941bb['shift']());}catch(_0x59eb52){_0x5941bb['push'](_0x5941bb['shift']());}}}(a32_0x900d,0x82d15));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../utils/segment-path-parser.js';function a32_0x900d(){const _0x440223=['Resolving\x20parent\x20segment\x20\x27','Creating\x20segment\x20\x27','invisible','kind','noCountPopulation','length','7915352pUfKLZ','✔\x20Created\x20segment\x20\x27','\x27\x20with\x20ID:\x20','Resolving\x20folder\x20path\x20\x27','273861ICBavM','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','Target\x20path:\x20','parent','4389560VgeYCy','site','type','createSegment','10oXxTpz','data','name','rule','1627008coPOAw','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','69508BFubbh','Resolved\x20folder\x20ID:\x20','resolveParentId','Resolving\x20folder\x20\x27','5530797GhOgbU','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','Segment\x20name:\x20','ruleFile','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','yellow','execute','folderId','Examples:','36xNTbzo','Resolved\x20relative\x20path\x20to:\x20','203GmULms','6832wfziqf','segment','Parent:\x20','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','resolvePathToResource','segment:create','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','segments','folder','error','Site:\x20','description','segmentPath','verbose','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','includes','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','\x27...'];a32_0x900d=function(){return _0x440223;};return a32_0x900d();}import a32_0x574353 from'chalk';function a32_0x156e(_0x12e886,_0x2796d2){_0x12e886=_0x12e886-0xb7;const _0x900d4c=a32_0x900d();let _0x156e08=_0x900d4c[_0x12e886];return _0x156e08;}export class SegmentCreateCommand extends BaseCommand{[a32_0x585bd3(0xcf)]=a32_0x585bd3(0xe8);['description']='Create\x20child\x20segment\x20with\x20filtering\x20rules';async[a32_0x585bd3(0xdd)](_0x156437){const _0x3d7e77=a32_0x585bd3;console[_0x3d7e77(0xec)](a32_0x574353[_0x3d7e77(0xdc)](_0x3d7e77(0xd2))),console[_0x3d7e77(0xec)](a32_0x574353[_0x3d7e77(0xdc)](_0x3d7e77(0xdb)));const {options:_0x3571b5,args:_0x1f2829,tdx:_0x5907d0}=_0x156437,_0x3150f3=_0x3571b5;if(_0x1f2829['length']===0x0)return console[_0x3d7e77(0xec)](_0x3d7e77(0xb8)),console[_0x3d7e77(0xec)](_0x3d7e77(0xf1)),console[_0x3d7e77(0xec)](_0x3d7e77(0xdf)),console['error'](_0x3d7e77(0xd8)),console[_0x3d7e77(0xec)](_0x3d7e77(0xe9)),console[_0x3d7e77(0xec)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x3f564e=_0x1f2829[0x0],_0x1988f6=_0x3571b5[_0x3d7e77(0xef)];let _0x45fc02=_0x3f564e;_0x1988f6&&!_0x3f564e[_0x3d7e77(0xb7)]('/')&&(_0x45fc02=_0x1988f6+'/'+_0x3f564e,_0x3150f3[_0x3d7e77(0xf0)]&&console[_0x3d7e77(0xec)](_0x3d7e77(0xe1)+_0x45fc02));const _0x25e225=parsePath(_0x45fc02);if(_0x25e225[_0x3d7e77(0xea)][_0x3d7e77(0xc0)]<0x2)return console[_0x3d7e77(0xec)](_0x3d7e77(0xe6)),console[_0x3d7e77(0xec)](_0x3d7e77(0xc6)),0x1;const _0x14b2e9=_0x25e225['segments'][0x0],_0x29ff53=getBaseName(_0x45fc02),_0x1034d1=getParentPath(_0x45fc02);_0x3150f3[_0x3d7e77(0xf0)]&&(console['error'](_0x3d7e77(0xed)+_0x3150f3[_0x3d7e77(0xca)]),console[_0x3d7e77(0xec)](_0x3d7e77(0xc7)+_0x45fc02),console[_0x3d7e77(0xec)](_0x3d7e77(0xe5)+_0x14b2e9),console['error'](_0x3d7e77(0xd9)+_0x29ff53),console[_0x3d7e77(0xec)]('Parent\x20path:\x20'+_0x1034d1));const _0x3a126c=await withSpinner(_0x3d7e77(0xbb)+_0x14b2e9+'\x27...',()=>_0x5907d0[_0x3d7e77(0xe4)][_0x3d7e77(0xd5)](_0x14b2e9),{'verbose':_0x3150f3[_0x3d7e77(0xf0)]}),_0x43a4c5=_0x3a126c['data'];let _0x44f494;if(_0x25e225[_0x3d7e77(0xea)]['length']>0x2){const _0x29c222=await withSpinner(_0x3d7e77(0xc4)+_0x1034d1+_0x3d7e77(0xba),()=>_0x5907d0['segment'][_0x3d7e77(0xe7)](_0x1034d1),{'verbose':_0x3150f3[_0x3d7e77(0xf0)]}),_0x1a34ea=_0x29c222[_0x3d7e77(0xce)];if(_0x1a34ea[_0x3d7e77(0xcb)]!=='folder'&&_0x1a34ea[_0x3d7e77(0xcb)]!==_0x3d7e77(0xc8))return console[_0x3d7e77(0xec)](_0x3d7e77(0xb9)),0x1;_0x44f494=_0x1a34ea[_0x3d7e77(0xde)];}else{if(_0x3150f3[_0x3d7e77(0xeb)]){const _0x2db985=await withSpinner(_0x3d7e77(0xd6)+_0x3150f3[_0x3d7e77(0xeb)]+'\x27...',()=>_0x5907d0[_0x3d7e77(0xe4)]['resolveFolderId'](_0x43a4c5,_0x3150f3['folder']),{'verbose':_0x3150f3[_0x3d7e77(0xf0)]});_0x44f494=_0x2db985[_0x3d7e77(0xce)];}}_0x3150f3[_0x3d7e77(0xf0)]&&_0x44f494&&console[_0x3d7e77(0xec)](_0x3d7e77(0xd4)+_0x44f494);const _0x386fe1=await loadJSONFromOptions(_0x3150f3[_0x3d7e77(0xd0)],_0x3150f3[_0x3d7e77(0xda)]),_0x58f682={'name':_0x29ff53,'description':_0x3150f3[_0x3d7e77(0xee)],'rule':_0x386fe1,'kind':_0x3150f3[_0x3d7e77(0xbe)]!==undefined?parseInt(_0x3150f3[_0x3d7e77(0xbe)],0xa):undefined,'isVisible':_0x3150f3[_0x3d7e77(0xbd)]?![]:undefined,'segmentFolderId':_0x44f494,'countPopulation':_0x3150f3[_0x3d7e77(0xbf)]?![]:undefined},_0x661d7=await withSpinner(_0x3d7e77(0xbc)+_0x29ff53+_0x3d7e77(0xba),()=>_0x5907d0[_0x3d7e77(0xe4)][_0x3d7e77(0xcc)](_0x43a4c5,_0x58f682),{'verbose':_0x3150f3[_0x3d7e77(0xf0)]}),_0x43ea63=_0x661d7[_0x3d7e77(0xce)];return console[_0x3d7e77(0xec)](_0x3d7e77(0xc2)+_0x43ea63[_0x3d7e77(0xcf)]+_0x3d7e77(0xc3)+_0x43ea63['id']),_0x45fc02!==_0x3f564e&&console[_0x3d7e77(0xec)]('\x20\x20\x20Path:\x20'+_0x45fc02),await handleSDKOutput([_0x43ea63],_0x3150f3),0x0;}}
@@ -1 +1 @@
1
- function a33_0x5f4a(_0x54eb2b,_0x3ecb07){_0x54eb2b=_0x54eb2b-0x1c0;const _0x3b68e8=a33_0x3b68();let _0x5f4a00=_0x3b68e8[_0x54eb2b];return _0x5f4a00;}const a33_0x3a465a=a33_0x5f4a;function a33_0x3b68(){const _0x1d6afe=['length','55PmdAXf','description','jsonl','830952ojnAKK','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','\x20field','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','50FrJMbk','2891763ysFJjD','4417828RpPISj','verbose','Site:\x20','segment:fields','json','parentSegment','error','Error:\x20Parent\x20segment\x20name\x20is\x20required','9NNeItO','8NNKOGY','\x27...','18191446vcDdDY','segment','3qJkwph','5450890NryKvP','List\x20available\x20fields\x20for\x20segmentation','✔\x20Found\x20','Listing\x20fields\x20for\x20\x27','323706hQaFDl','635977FFzrHa','Parent\x20segment:\x20','name','2LRiiEi'];a33_0x3b68=function(){return _0x1d6afe;};return a33_0x3b68();}(function(_0x501767,_0x431316){const _0x4ecea6=a33_0x5f4a,_0x57e5a5=_0x501767();while(!![]){try{const _0x4d2a74=parseInt(_0x4ecea6(0x1cd))/0x1*(parseInt(_0x4ecea6(0x1d0))/0x2)+-parseInt(_0x4ecea6(0x1c7))/0x3*(parseInt(_0x4ecea6(0x1db))/0x4)+-parseInt(_0x4ecea6(0x1d9))/0x5*(parseInt(_0x4ecea6(0x1cc))/0x6)+-parseInt(_0x4ecea6(0x1da))/0x7*(parseInt(_0x4ecea6(0x1c3))/0x8)+parseInt(_0x4ecea6(0x1c2))/0x9*(parseInt(_0x4ecea6(0x1c8))/0xa)+-parseInt(_0x4ecea6(0x1d2))/0xb*(-parseInt(_0x4ecea6(0x1d5))/0xc)+parseInt(_0x4ecea6(0x1c5))/0xd;if(_0x4d2a74===_0x431316)break;else _0x57e5a5['push'](_0x57e5a5['shift']());}catch(_0x19441d){_0x57e5a5['push'](_0x57e5a5['shift']());}}}(a33_0x3b68,0xd44ba));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../utils/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a33_0x3a465a(0x1cf)]=a33_0x3a465a(0x1de);[a33_0x3a465a(0x1d3)]=a33_0x3a465a(0x1c9);async['execute'](_0x338b6c){const _0x3a5df9=a33_0x3a465a,{options:_0x54b0e3,args:_0x252da2,tdx:_0x13e190}=_0x338b6c,_0x205821=_0x252da2[0x0]||_0x54b0e3[_0x3a5df9(0x1e0)];if(!_0x205821)return console[_0x3a5df9(0x1c0)](_0x3a5df9(0x1c1)),console['error'](_0x3a5df9(0x1d8)),console[_0x3a5df9(0x1c0)](_0x3a5df9(0x1d6)),0x1;_0x54b0e3[_0x3a5df9(0x1dc)]&&(console[_0x3a5df9(0x1c0)](_0x3a5df9(0x1dd)+_0x54b0e3['site']),console[_0x3a5df9(0x1c0)](_0x3a5df9(0x1ce)+_0x205821));const _0x208c47=await withSpinner(_0x3a5df9(0x1cb)+_0x205821+_0x3a5df9(0x1c4),()=>_0x13e190[_0x3a5df9(0x1c6)]['listFields'](_0x205821),{'verbose':_0x54b0e3[_0x3a5df9(0x1dc)]}),_0x28d67b=_0x208c47['data'];console[_0x3a5df9(0x1c0)](_0x3a5df9(0x1ca)+_0x28d67b[_0x3a5df9(0x1d1)]+_0x3a5df9(0x1d7)+(_0x28d67b['length']!==0x1?'s':''));if(_0x54b0e3[_0x3a5df9(0x1df)]||_0x54b0e3[_0x3a5df9(0x1d4)])return await handleSDKOutput(_0x28d67b,_0x54b0e3),0x0;return displayFieldsHumanReadable(_0x28d67b,_0x205821),0x0;}}
1
+ const a33_0x28eac8=a33_0x3f83;(function(_0x1feaf7,_0x2d0bdb){const _0x50802e=a33_0x3f83,_0x2face3=_0x1feaf7();while(!![]){try{const _0x35cb1e=-parseInt(_0x50802e(0x92))/0x1+-parseInt(_0x50802e(0x9a))/0x2*(parseInt(_0x50802e(0x8d))/0x3)+-parseInt(_0x50802e(0x8b))/0x4*(parseInt(_0x50802e(0x85))/0x5)+parseInt(_0x50802e(0x88))/0x6*(parseInt(_0x50802e(0x97))/0x7)+parseInt(_0x50802e(0x95))/0x8+-parseInt(_0x50802e(0x8f))/0x9*(-parseInt(_0x50802e(0xa1))/0xa)+parseInt(_0x50802e(0x91))/0xb;if(_0x35cb1e===_0x2d0bdb)break;else _0x2face3['push'](_0x2face3['shift']());}catch(_0x43e92d){_0x2face3['push'](_0x2face3['shift']());}}}(a33_0x49e4,0xf1cd4));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../utils/fields-display.js';function a33_0x3f83(_0x3bd7e8,_0x289b19){_0x3bd7e8=_0x3bd7e8-0x83;const _0x49e4c8=a33_0x49e4();let _0x3f837a=_0x49e4c8[_0x3bd7e8];return _0x3f837a;}export class SegmentFieldsCommand extends BaseCommand{[a33_0x28eac8(0x8e)]=a33_0x28eac8(0x9f);[a33_0x28eac8(0x96)]=a33_0x28eac8(0x99);async['execute'](_0x443c8c){const _0x5727a8=a33_0x28eac8,{options:_0x557670,args:_0xf54dde,tdx:_0x2fcec3}=_0x443c8c,_0x14148e=_0xf54dde[0x0]||_0x557670[_0x5727a8(0x84)];if(!_0x14148e)return console[_0x5727a8(0x98)](_0x5727a8(0x8a)),console[_0x5727a8(0x98)](_0x5727a8(0x94)),console[_0x5727a8(0x98)](_0x5727a8(0x9c)),0x1;_0x557670[_0x5727a8(0xa0)]&&(console[_0x5727a8(0x98)]('Site:\x20'+_0x557670[_0x5727a8(0x9b)]),console[_0x5727a8(0x98)](_0x5727a8(0x86)+_0x14148e));const _0x10f5d4=await withSpinner(_0x5727a8(0x8c)+_0x14148e+_0x5727a8(0x89),()=>_0x2fcec3[_0x5727a8(0x90)][_0x5727a8(0x87)](_0x14148e),{'verbose':_0x557670[_0x5727a8(0xa0)]}),_0x17fe18=_0x10f5d4[_0x5727a8(0x9d)];console[_0x5727a8(0x98)](_0x5727a8(0x93)+_0x17fe18[_0x5727a8(0x83)]+'\x20field'+(_0x17fe18[_0x5727a8(0x83)]!==0x1?'s':''));if(_0x557670['json']||_0x557670[_0x5727a8(0x9e)])return await handleSDKOutput(_0x17fe18,_0x557670),0x0;return displayFieldsHumanReadable(_0x17fe18,_0x14148e),0x0;}}function a33_0x49e4(){const _0x5cd005=['description','191282FeHfDx','error','List\x20available\x20fields\x20for\x20segmentation','761056uKAFWV','site','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','data','jsonl','segment:fields','verbose','330FEPwBg','length','parentSegment','5Iwpmvd','Parent\x20segment:\x20','listFields','282aeUkqQ','\x27...','Error:\x20Parent\x20segment\x20name\x20is\x20required','1157668jwlTCZ','Listing\x20fields\x20for\x20\x27','3frRfIP','name','129663xXePyZ','segment','929379JjSrmL','528461JJfGDJ','✔\x20Found\x20','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','2756672ffmxHg'];a33_0x49e4=function(){return _0x5cd005;};return a33_0x49e4();}
@@ -1 +1 @@
1
- const a34_0x2d11dc=a34_0x4c4a;(function(_0x48f00a,_0x45921b){const _0x46db84=a34_0x4c4a,_0xbb8424=_0x48f00a();while(!![]){try{const _0x454fdd=parseInt(_0x46db84(0x8b))/0x1+parseInt(_0x46db84(0x87))/0x2+parseInt(_0x46db84(0xb5))/0x3*(-parseInt(_0x46db84(0xd2))/0x4)+parseInt(_0x46db84(0xcd))/0x5+-parseInt(_0x46db84(0xba))/0x6+-parseInt(_0x46db84(0xbc))/0x7*(parseInt(_0x46db84(0xb9))/0x8)+parseInt(_0x46db84(0x91))/0x9*(parseInt(_0x46db84(0xab))/0xa);if(_0x454fdd===_0x45921b)break;else _0xbb8424['push'](_0xbb8424['shift']());}catch(_0x1d858a){_0xbb8424['push'](_0xbb8424['shift']());}}}(a34_0x3b85,0xc688b));import{BaseCommand}from'./command.js';import{withSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';function a34_0x3b85(){const _0x5b8720=['parentFolderId','\x27...','Write\x20','\x20\x20Target:\x20','has','4236535zpUCiA','Fetching\x20parent\x20segment\x20info...','Fetching\x20users\x20for\x20email\x20resolution...','Found\x20tdx.json\x20at:\x20','Pull\x20child\x20segments\x20to\x20YAML\x20files','68668yfxfVD','utf-8','parent_segment','dirname','parentSegment','name','green','Fetching\x20activations...','push','303946MemqwK','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','attributes','all','471823AWIBfV','tdx.json','yellow','Fetching\x20folders...','from','segment','300249Zqtlvp','buildIdToNameMap','then','Resolving\x20parent\x20segment\x20\x27','Resolved\x20parent\x20name:\x20','Parent\x20segment:\x20','✔\x20Context\x20set:\x20','Fetching\x20connections\x20for\x20name\x20resolution...','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','execute','repeat','cyan','Using\x20parent\x20segment:\x20','Fetching\x20segments...','hasChanges','red','\x20unchanged\x20files','.yml','session','\x20files?','dim','join','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)','relativePath','yes','get','650cQTOmW','Site:\x20','verbose','filter','\x20segments','error','✔\x20All\x20files\x20are\x20up\x20to\x20date','No\x20segments\x20found\x20in\x20parent\x20segment\x20\x27','✔\x20Pulled\x20','description','39PqkSeF','set','absolutePath','data','15800zLrjpV','8615862ZhXGmj','diff','4137mznfIi','\x20changed\x20files','dryRun','\x20new\x20files','listSegments','resolveParentId','isNew','segment:pull','length','\x20=\x20','segmentFolderId','reduce'];a34_0x3b85=function(){return _0x5b8720;};return a34_0x3b85();}import{batchAsync}from'../utils/async.js';import{getSegmentRootDir,createTdxConfigContent,findTdxConfigPath,loadTdxConfig}from'../utils/tdx-config.js';import{saveSessionContext}from'../core/session.js';import{segmentWithActivationsToYaml,segmentToYamlString}from'../sdk/segment/child-segment-yaml.js';import a34_0x452505 from'chalk';import{existsSync,mkdirSync,readFileSync,writeFileSync,statSync}from'fs';import a34_0x2da008 from'path';import{sanitizeFileName}from'../utils/string-utils.js';export class SegmentPullCommand extends BaseCommand{[a34_0x2d11dc(0x83)]=a34_0x2d11dc(0xc3);[a34_0x2d11dc(0xb4)]=a34_0x2d11dc(0xd1);async[a34_0x2d11dc(0x9a)](_0x4416ff){const _0x4fcee2=a34_0x2d11dc,{options:_0x2042ec,args:_0x873c38,tdx:_0x35375e}=_0x4416ff,_0x286815=_0x2042ec,_0x11a2cb=_0x2042ec[_0x4fcee2(0x82)],_0x192066=_0x873c38[0x0],_0x33c0b9=findTdxConfigPath();let _0x3eb066,_0x50881d;if(!_0x192066&&_0x33c0b9){const _0x219dcf=loadTdxConfig(_0x33c0b9);_0x3eb066=_0x219dcf['parent_segment'],_0x50881d=a34_0x2da008[_0x4fcee2(0x81)](_0x33c0b9),_0x286815[_0x4fcee2(0xad)]&&(console['error']('Found\x20existing\x20tdx.json\x20at:\x20'+_0x33c0b9),console[_0x4fcee2(0xb0)](_0x4fcee2(0x9d)+_0x3eb066));}else{if(_0x192066){if(existsSync(_0x192066)&&statSync(_0x192066)['isDirectory']()){const _0x190e2a=findTdxConfigPath(_0x192066);if(_0x190e2a){const _0x13f347=loadTdxConfig(_0x190e2a);_0x3eb066=_0x13f347[_0x4fcee2(0x80)],_0x50881d=a34_0x2da008['dirname'](_0x190e2a),_0x286815[_0x4fcee2(0xad)]&&(console['error'](_0x4fcee2(0xd0)+_0x190e2a),console[_0x4fcee2(0xb0)](_0x4fcee2(0x9d)+_0x3eb066));}else return console[_0x4fcee2(0xb0)](a34_0x452505[_0x4fcee2(0xa0)]('Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20'+_0x192066+'\x0a')),console[_0x4fcee2(0xb0)](a34_0x452505['cyan'](_0x4fcee2(0x99))),0x1;}else _0x3eb066=_0x192066;}else _0x3eb066=_0x11a2cb;}if(!_0x3eb066)return console[_0x4fcee2(0xb0)](a34_0x452505[_0x4fcee2(0x8d)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x4fcee2(0xb0)](_0x4fcee2(0xa7)),console[_0x4fcee2(0xb0)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent'),console[_0x4fcee2(0xb0)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file'),0x1;_0x286815[_0x4fcee2(0xad)]&&(console[_0x4fcee2(0xb0)](_0x4fcee2(0xac)+_0x286815['site']),console[_0x4fcee2(0xb0)](_0x4fcee2(0x96)+_0x3eb066));const _0x238039=await withSpinner(_0x4fcee2(0x94)+_0x3eb066+_0x4fcee2(0xc9),()=>_0x35375e[_0x4fcee2(0x90)][_0x4fcee2(0xc1)](_0x3eb066),{'verbose':_0x286815[_0x4fcee2(0xad)]}),_0x5e0acd=_0x238039[_0x4fcee2(0xb8)],_0x4c47e5=await withSpinner(_0x4fcee2(0xce),()=>_0x35375e['segment']['getParent'](_0x5e0acd),{'verbose':_0x286815[_0x4fcee2(0xad)]}),_0x1b5915=_0x4c47e5[_0x4fcee2(0xb8)][_0x4fcee2(0x89)]['name'];_0x286815[_0x4fcee2(0xad)]&&console[_0x4fcee2(0xb0)](_0x4fcee2(0x95)+_0x1b5915);const [_0x3fae4f,_0x3f5c8a]=await Promise[_0x4fcee2(0x8a)]([withSpinner(_0x4fcee2(0x9e),()=>_0x35375e['segment'][_0x4fcee2(0xc0)](_0x5e0acd),{'verbose':_0x286815['verbose']}),withSpinner(_0x4fcee2(0x8e),()=>_0x35375e[_0x4fcee2(0x90)]['listFolders'](_0x5e0acd),{'verbose':_0x286815[_0x4fcee2(0xad)]})]),_0x5d8560=_0x3fae4f[_0x4fcee2(0xb8)],_0x1ea0a1=_0x3f5c8a[_0x4fcee2(0xb8)];if(_0x5d8560[_0x4fcee2(0xc4)]===0x0)return console['error'](a34_0x452505[_0x4fcee2(0x8d)](_0x4fcee2(0xb2)+_0x1b5915+'\x27')),0x0;const _0x143ac9=buildFolderPathMap(_0x1ea0a1),_0x4020a9=_0x50881d||getSegmentRootDir(sanitizeFileName(_0x3eb066)),_0x2d117d=new Map();await withSpinner(_0x4fcee2(0x85),async()=>{await batchAsync(_0x5d8560,async _0xe7ef9b=>{const _0xfc462c=a34_0x4c4a,_0x14aa97=await _0x35375e[_0xfc462c(0x90)]['listActivations'](_0x5e0acd,_0xe7ef9b['id']);_0x2d117d['set'](_0xe7ef9b['id'],_0x14aa97);});},{'verbose':_0x286815[_0x4fcee2(0xad)]});const _0x2476ae=await withSpinner(_0x4fcee2(0xcf),()=>_0x35375e['user']['buildIdToEmailMap'](),{'verbose':_0x286815[_0x4fcee2(0xad)]})['then'](_0x51805d=>_0x51805d[_0x4fcee2(0xb8)]),_0x2b790f=await withSpinner(_0x4fcee2(0x98),()=>_0x35375e['connection'][_0x4fcee2(0x92)](),{'verbose':_0x286815[_0x4fcee2(0xad)]})[_0x4fcee2(0x93)](_0x306360=>_0x306360[_0x4fcee2(0xb8)]),_0x511eb0=[],_0x1c056c=a34_0x2da008[_0x4fcee2(0xa6)](_0x4020a9,_0x4fcee2(0x8c)),_0x79e552=createTdxConfigContent(_0x1b5915);_0x511eb0[_0x4fcee2(0x86)](prepareFile(_0x1c056c,_0x79e552,_0x4020a9));const _0x347b61=new Map();for(const _0x4c3845 of _0x5d8560){const _0x22eddb=_0x4c3845[_0x4fcee2(0xc6)]?_0x143ac9[_0x4fcee2(0xaa)](_0x4c3845[_0x4fcee2(0xc6)])||'':'',_0x295b51=_0x2d117d[_0x4fcee2(0xaa)](_0x4c3845['id'])||[],_0x2c555d=segmentWithActivationsToYaml(_0x4c3845,_0x295b51,undefined,_0x2476ae,_0x2b790f),_0x18ea53=_0x22eddb?a34_0x2da008['join'](_0x4020a9,_0x22eddb):_0x4020a9,_0xb059c=sanitizeFileName(_0x4c3845[_0x4fcee2(0x83)]),_0x24dacf=getUniqueFileName(_0x18ea53,_0xb059c,_0x347b61),_0x581b94=a34_0x2da008[_0x4fcee2(0xa6)](_0x18ea53,_0x24dacf+_0x4fcee2(0xa2)),_0x1f2f80=segmentToYamlString(_0x2c555d);_0x511eb0[_0x4fcee2(0x86)](prepareFile(_0x581b94,_0x1f2f80,_0x4020a9));}const _0x1db58d=Array[_0x4fcee2(0x8f)](_0x2d117d['values']())[_0x4fcee2(0xc7)]((_0x16d46f,_0x23a220)=>_0x16d46f+_0x23a220['length'],0x0),_0x2eef1a=_0x511eb0['filter'](_0x153f65=>_0x153f65[_0x4fcee2(0xc2)]),_0x860f8=_0x511eb0[_0x4fcee2(0xae)](_0x5c1d72=>!_0x5c1d72[_0x4fcee2(0xc2)]&&_0x5c1d72['hasChanges']),_0x186b9f=_0x511eb0['filter'](_0x46b6e4=>!_0x46b6e4[_0x4fcee2(0xc2)]&&!_0x46b6e4[_0x4fcee2(0x9f)]);console[_0x4fcee2(0xb0)]('\x0aPull\x20summary\x20for\x20\x27'+_0x1b5915+'\x27:'),console[_0x4fcee2(0xb0)]('\x20\x20'+a34_0x452505[_0x4fcee2(0x9c)](_0x5d8560[_0x4fcee2(0xc4)]+_0x4fcee2(0xaf))+'\x20with\x20'+a34_0x452505[_0x4fcee2(0x9c)](_0x1db58d+'\x20activations')),console[_0x4fcee2(0xb0)]('\x20\x20'+a34_0x452505[_0x4fcee2(0x84)]('+\x20'+_0x2eef1a[_0x4fcee2(0xc4)]+_0x4fcee2(0xbf))),console[_0x4fcee2(0xb0)]('\x20\x20'+a34_0x452505[_0x4fcee2(0x8d)]('~\x20'+_0x860f8[_0x4fcee2(0xc4)]+_0x4fcee2(0xbd))),console[_0x4fcee2(0xb0)]('\x20\x20'+a34_0x452505['dim']('=\x20'+_0x186b9f[_0x4fcee2(0xc4)]+_0x4fcee2(0xa1))),console[_0x4fcee2(0xb0)](_0x4fcee2(0xcb)+a34_0x452505['cyan'](_0x4020a9)+'\x0a');if(_0x860f8[_0x4fcee2(0xc4)]>0x0)for(const _0x53d871 of _0x860f8){console[_0x4fcee2(0xb0)]('\x0aChanges\x20to\x20\x27'+_0x53d871[_0x4fcee2(0xa8)]+'\x27:'),console[_0x4fcee2(0xb0)]('─'[_0x4fcee2(0x9b)](0x3c)),console['error'](_0x53d871[_0x4fcee2(0xbb)]),console['error']('─'['repeat'](0x3c));}if(_0x286815[_0x4fcee2(0xbe)])return console[_0x4fcee2(0xb0)](a34_0x452505[_0x4fcee2(0x8d)](_0x4fcee2(0x88))),0x0;if(_0x2eef1a[_0x4fcee2(0xc4)]===0x0&&_0x860f8['length']===0x0)return console[_0x4fcee2(0xb0)](a34_0x452505[_0x4fcee2(0x84)](_0x4fcee2(0xb1))),saveSessionContext({'parent_segment':_0x1b5915},_0x286815[_0x4fcee2(0xa3)]),console[_0x4fcee2(0xb0)](a34_0x452505['green'](_0x4fcee2(0x97)+a34_0x452505['dim'](_0x4fcee2(0x80))+_0x4fcee2(0xc5)+a34_0x452505[_0x4fcee2(0x9c)](_0x1b5915))),0x0;if(!_0x286815[_0x4fcee2(0xa9)]&&(_0x2eef1a[_0x4fcee2(0xc4)]>0x0||_0x860f8[_0x4fcee2(0xc4)]>0x0)){const _0x85cef3=await confirmKey(_0x4fcee2(0xca)+(_0x2eef1a[_0x4fcee2(0xc4)]+_0x860f8[_0x4fcee2(0xc4)])+_0x4fcee2(0xa4));if(!_0x85cef3)return console[_0x4fcee2(0xb0)]('Aborted.'),0x1;}for(const _0x336582 of _0x511eb0){if(_0x336582[_0x4fcee2(0xc2)]||_0x336582[_0x4fcee2(0x9f)]){const _0x5203dd=a34_0x2da008['dirname'](_0x336582[_0x4fcee2(0xb7)]);!existsSync(_0x5203dd)&&mkdirSync(_0x5203dd,{'recursive':!![]}),writeFileSync(_0x336582['absolutePath'],_0x336582['content'],_0x4fcee2(0x7f));}}return console[_0x4fcee2(0xb0)](a34_0x452505[_0x4fcee2(0x84)](_0x4fcee2(0xb3)+(_0x2eef1a[_0x4fcee2(0xc4)]+_0x860f8[_0x4fcee2(0xc4)])+'\x20files\x20to\x20'+_0x4020a9)),saveSessionContext({'parent_segment':_0x1b5915},_0x286815[_0x4fcee2(0xa3)]),console['error'](a34_0x452505[_0x4fcee2(0x84)](_0x4fcee2(0x97)+a34_0x452505[_0x4fcee2(0xa5)](_0x4fcee2(0x80))+_0x4fcee2(0xc5)+a34_0x452505[_0x4fcee2(0x9c)](_0x1b5915))),0x0;}}function buildFolderPathMap(_0x49a57a){const _0x138ae2=a34_0x2d11dc,_0x1e98d4=new Map(),_0x5227e2=new Map();for(const _0x1928b2 of _0x49a57a){_0x5227e2['set'](_0x1928b2['id'],_0x1928b2);}const _0x86c986=new Set();for(const _0x568f05 of _0x49a57a){!_0x568f05[_0x138ae2(0xc8)]&&_0x86c986['add'](_0x568f05['id']);}function _0x27160b(_0x141486){const _0x19cb13=_0x138ae2;if(_0x1e98d4[_0x19cb13(0xcc)](_0x141486['id']))return _0x1e98d4['get'](_0x141486['id']);if(_0x86c986[_0x19cb13(0xcc)](_0x141486['id']))return _0x1e98d4[_0x19cb13(0xb6)](_0x141486['id'],''),'';if(_0x141486[_0x19cb13(0xc8)]){const _0xcd43b=_0x5227e2[_0x19cb13(0xaa)](_0x141486[_0x19cb13(0xc8)]);if(_0xcd43b){const _0x2aae4b=_0x27160b(_0xcd43b),_0x5147e0=_0x2aae4b?_0x2aae4b+'/'+_0x141486[_0x19cb13(0x83)]:_0x141486[_0x19cb13(0x83)];return _0x1e98d4['set'](_0x141486['id'],_0x5147e0),_0x5147e0;}}const _0x4487ea=_0x141486[_0x19cb13(0x83)];return _0x1e98d4[_0x19cb13(0xb6)](_0x141486['id'],_0x4487ea),_0x4487ea;}for(const _0x42f0b5 of _0x49a57a){_0x27160b(_0x42f0b5);}return _0x1e98d4;}function a34_0x4c4a(_0xc1e622,_0x4e7e02){_0xc1e622=_0xc1e622-0x7f;const _0x3b851d=a34_0x3b85();let _0x4c4a39=_0x3b851d[_0xc1e622];return _0x4c4a39;}function getUniqueFileName(_0xc13b04,_0x15d716,_0x500538){const _0x3bd509=a34_0x2d11dc,_0x4c487e=_0xc13b04+':'+_0x15d716,_0x202508=_0x500538[_0x3bd509(0xaa)](_0x4c487e)||0x0;_0x500538['set'](_0x4c487e,_0x202508+0x1);if(_0x202508===0x0)return _0x15d716;return _0x15d716+'-'+_0x202508;}function prepareFile(_0x5e970d,_0x4e25f2,_0x5571c5){const _0x12e19b=a34_0x2d11dc,_0x1cc1f2=a34_0x2da008['relative'](_0x5571c5,_0x5e970d);if(existsSync(_0x5e970d)){const _0x526956=readFileSync(_0x5e970d,_0x12e19b(0x7f)),_0x2a8cb7=generateDiff(_0x526956,_0x4e25f2),_0x156b72=hasChanges(_0x2a8cb7);return{'relativePath':_0x1cc1f2,'absolutePath':_0x5e970d,'content':_0x4e25f2,'isNew':![],'hasChanges':_0x156b72,'diff':_0x156b72?formatDiffWithColors(_0x2a8cb7):undefined};}return{'relativePath':_0x1cc1f2,'absolutePath':_0x5e970d,'content':_0x4e25f2,'isNew':!![],'hasChanges':![]};}
1
+ const a34_0x465202=a34_0x465b;(function(_0x45f000,_0x30aefd){const _0x2313cc=a34_0x465b,_0x3847fb=_0x45f000();while(!![]){try{const _0xc4152b=-parseInt(_0x2313cc(0x115))/0x1+parseInt(_0x2313cc(0x161))/0x2+parseInt(_0x2313cc(0x11b))/0x3+-parseInt(_0x2313cc(0x116))/0x4*(parseInt(_0x2313cc(0x110))/0x5)+parseInt(_0x2313cc(0x125))/0x6*(parseInt(_0x2313cc(0x114))/0x7)+-parseInt(_0x2313cc(0x124))/0x8*(-parseInt(_0x2313cc(0x15d))/0x9)+-parseInt(_0x2313cc(0x151))/0xa*(parseInt(_0x2313cc(0x13a))/0xb);if(_0xc4152b===_0x30aefd)break;else _0x3847fb['push'](_0x3847fb['shift']());}catch(_0x513d22){_0x3847fb['push'](_0x3847fb['shift']());}}}(a34_0x3dd9,0x6062f));function a34_0x3dd9(){const _0x4de0c6=['repeat','Site:\x20','diff','\x20\x20Target:\x20','absolutePath','buildIdToNameMap','Aborted.','verbose','Fetching\x20users\x20for\x20email\x20resolution...','\x20=\x20','yellow','Resolved\x20parent\x20name:\x20','tdx.json','Fetching\x20activations...','resolveParentId','10ODaVQA','isNew','\x20activations','cyan','Write\x20','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','dirname','isDirectory','buildIdToEmailMap','green','from','attributes','9sMwWYn','Fetching\x20segments...','Found\x20existing\x20tdx.json\x20at:\x20','listActivations','1110424NlpxCR','getParent','utf-8','listSegments','Using\x20parent\x20segment:\x20','Resolving\x20parent\x20segment\x20\x27','\x20new\x20files','\x0aPull\x20summary\x20for\x20\x27','parent_segment','Fetching\x20connections\x20for\x20name\x20resolution...','\x20files\x20to\x20','hasChanges','1760195IODkWe','session','data','Found\x20tdx.json\x20at:\x20','1113KaoEXg','269817UgVoAg','4jeKeXK','user','filter','connection','✔\x20Context\x20set:\x20','2097051kbXvMR','Pull\x20child\x20segments\x20to\x20YAML\x20files','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','yes','join','dim','\x20with\x20','\x20unchanged\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)','5233976nokRJl','18714lCXXPL','segmentFolderId','error','push','segment','content','Fetching\x20parent\x20segment\x20info...','execute','✔\x20Pulled\x20','name','\x0aChanges\x20to\x20\x27','get','relativePath','\x27...','then','Fetching\x20folders...','✔\x20All\x20files\x20are\x20up\x20to\x20date','set','relative','site','segment:pull','15265162eLdIIl','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','\x20segments','\x20changed\x20files','red','\x20files?','parentFolderId','length'];a34_0x3dd9=function(){return _0x4de0c6;};return a34_0x3dd9();}import{BaseCommand}from'./command.js';import{withSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{getSegmentRootDir,createTdxConfigContent,findTdxConfigPath,loadTdxConfig}from'../utils/tdx-config.js';import{saveSessionContext}from'../core/session.js';function a34_0x465b(_0x2d3296,_0x3f695c){_0x2d3296=_0x2d3296-0x106;const _0x3dd9e7=a34_0x3dd9();let _0x465b7e=_0x3dd9e7[_0x2d3296];return _0x465b7e;}import{segmentWithActivationsToYaml,segmentToYamlString}from'../sdk/segment/child-segment-yaml.js';import a34_0x270373 from'chalk';import{existsSync,mkdirSync,readFileSync,writeFileSync,statSync}from'fs';import a34_0x33aea1 from'path';import{sanitizeFileName}from'../utils/string-utils.js';export class SegmentPullCommand extends BaseCommand{[a34_0x465202(0x12e)]=a34_0x465202(0x139);['description']=a34_0x465202(0x11c);async[a34_0x465202(0x12c)](_0x35b601){const _0x11e91=a34_0x465202,{options:_0x35451c,args:_0x2a51f5,tdx:_0x3450e7}=_0x35b601,_0x4ffcdc=_0x35451c,_0x54d567=_0x35451c['parentSegment'],_0x5d597b=_0x2a51f5[0x0],_0x4b6a33=findTdxConfigPath();let _0x30f3bf,_0x400f73;if(!_0x5d597b&&_0x4b6a33){const _0x310237=loadTdxConfig(_0x4b6a33);_0x30f3bf=_0x310237[_0x11e91(0x10c)],_0x400f73=a34_0x33aea1[_0x11e91(0x157)](_0x4b6a33),_0x4ffcdc[_0x11e91(0x149)]&&(console[_0x11e91(0x127)](_0x11e91(0x15f)+_0x4b6a33),console[_0x11e91(0x127)](_0x11e91(0x108)+_0x30f3bf));}else{if(_0x5d597b){if(existsSync(_0x5d597b)&&statSync(_0x5d597b)[_0x11e91(0x158)]()){const _0x291728=findTdxConfigPath(_0x5d597b);if(_0x291728){const _0x297784=loadTdxConfig(_0x291728);_0x30f3bf=_0x297784[_0x11e91(0x10c)],_0x400f73=a34_0x33aea1[_0x11e91(0x157)](_0x291728),_0x4ffcdc[_0x11e91(0x149)]&&(console[_0x11e91(0x127)](_0x11e91(0x113)+_0x291728),console['error'](_0x11e91(0x108)+_0x30f3bf));}else return console[_0x11e91(0x127)](a34_0x270373[_0x11e91(0x13e)](_0x11e91(0x11d)+_0x5d597b+'\x0a')),console['error'](a34_0x270373[_0x11e91(0x154)](_0x11e91(0x156))),0x1;}else _0x30f3bf=_0x5d597b;}else _0x30f3bf=_0x54d567;}if(!_0x30f3bf)return console[_0x11e91(0x127)](a34_0x270373[_0x11e91(0x14c)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console['error'](_0x11e91(0x123)),console['error'](_0x11e91(0x13b)),console[_0x11e91(0x127)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file'),0x1;_0x4ffcdc[_0x11e91(0x149)]&&(console[_0x11e91(0x127)](_0x11e91(0x143)+_0x4ffcdc[_0x11e91(0x138)]),console['error']('Parent\x20segment:\x20'+_0x30f3bf));const _0x223f70=await withSpinner(_0x11e91(0x109)+_0x30f3bf+_0x11e91(0x132),()=>_0x3450e7[_0x11e91(0x129)][_0x11e91(0x150)](_0x30f3bf),{'verbose':_0x4ffcdc['verbose']}),_0x44f65d=_0x223f70[_0x11e91(0x112)],_0x705422=await withSpinner(_0x11e91(0x12b),()=>_0x3450e7[_0x11e91(0x129)][_0x11e91(0x162)](_0x44f65d),{'verbose':_0x4ffcdc[_0x11e91(0x149)]}),_0x220277=_0x705422[_0x11e91(0x112)][_0x11e91(0x15c)][_0x11e91(0x12e)];_0x4ffcdc['verbose']&&console[_0x11e91(0x127)](_0x11e91(0x14d)+_0x220277);const [_0x2d9d8d,_0x8de52d]=await Promise['all']([withSpinner(_0x11e91(0x15e),()=>_0x3450e7[_0x11e91(0x129)][_0x11e91(0x107)](_0x44f65d),{'verbose':_0x4ffcdc[_0x11e91(0x149)]}),withSpinner(_0x11e91(0x134),()=>_0x3450e7[_0x11e91(0x129)]['listFolders'](_0x44f65d),{'verbose':_0x4ffcdc[_0x11e91(0x149)]})]),_0x4528c5=_0x2d9d8d[_0x11e91(0x112)],_0x1a717b=_0x8de52d[_0x11e91(0x112)];if(_0x4528c5[_0x11e91(0x141)]===0x0)return console['error'](a34_0x270373[_0x11e91(0x14c)]('No\x20segments\x20found\x20in\x20parent\x20segment\x20\x27'+_0x220277+'\x27')),0x0;const _0x459dfb=buildFolderPathMap(_0x1a717b),_0x5206b2=_0x400f73||getSegmentRootDir(sanitizeFileName(_0x30f3bf)),_0x46b9e2=new Map();await withSpinner(_0x11e91(0x14f),async()=>{await batchAsync(_0x4528c5,async _0x275032=>{const _0x245b1e=a34_0x465b,_0x129366=await _0x3450e7[_0x245b1e(0x129)][_0x245b1e(0x160)](_0x44f65d,_0x275032['id']);_0x46b9e2[_0x245b1e(0x136)](_0x275032['id'],_0x129366);});},{'verbose':_0x4ffcdc[_0x11e91(0x149)]});const _0x1c7679=await withSpinner(_0x11e91(0x14a),()=>_0x3450e7[_0x11e91(0x117)][_0x11e91(0x159)](),{'verbose':_0x4ffcdc[_0x11e91(0x149)]})['then'](_0x10a466=>_0x10a466[_0x11e91(0x112)]),_0xf932dc=await withSpinner(_0x11e91(0x10d),()=>_0x3450e7[_0x11e91(0x119)][_0x11e91(0x147)](),{'verbose':_0x4ffcdc[_0x11e91(0x149)]})[_0x11e91(0x133)](_0x6e7d27=>_0x6e7d27[_0x11e91(0x112)]),_0x59aed9=[],_0x22f5ee=a34_0x33aea1['join'](_0x5206b2,_0x11e91(0x14e)),_0x2c7f95=createTdxConfigContent(_0x220277);_0x59aed9['push'](prepareFile(_0x22f5ee,_0x2c7f95,_0x5206b2));const _0x293047=new Map();for(const _0x15ea47 of _0x4528c5){const _0x19e106=_0x15ea47[_0x11e91(0x126)]?_0x459dfb[_0x11e91(0x130)](_0x15ea47[_0x11e91(0x126)])||'':'',_0x64fcea=_0x46b9e2[_0x11e91(0x130)](_0x15ea47['id'])||[],_0x31271d=segmentWithActivationsToYaml(_0x15ea47,_0x64fcea,undefined,_0x1c7679,_0xf932dc),_0x20ae41=_0x19e106?a34_0x33aea1[_0x11e91(0x11f)](_0x5206b2,_0x19e106):_0x5206b2,_0x35422f=sanitizeFileName(_0x15ea47['name']),_0x21b942=getUniqueFileName(_0x20ae41,_0x35422f,_0x293047),_0x5a75c6=a34_0x33aea1[_0x11e91(0x11f)](_0x20ae41,_0x21b942+'.yml'),_0x576e81=segmentToYamlString(_0x31271d);_0x59aed9[_0x11e91(0x128)](prepareFile(_0x5a75c6,_0x576e81,_0x5206b2));}const _0x204171=Array[_0x11e91(0x15b)](_0x46b9e2['values']())['reduce']((_0x4a930a,_0xd4e669)=>_0x4a930a+_0xd4e669[_0x11e91(0x141)],0x0),_0x3c04f1=_0x59aed9[_0x11e91(0x118)](_0x445b67=>_0x445b67[_0x11e91(0x152)]),_0x23874d=_0x59aed9[_0x11e91(0x118)](_0x53745b=>!_0x53745b[_0x11e91(0x152)]&&_0x53745b[_0x11e91(0x10f)]),_0x3f71e1=_0x59aed9['filter'](_0x260c6c=>!_0x260c6c[_0x11e91(0x152)]&&!_0x260c6c[_0x11e91(0x10f)]);console[_0x11e91(0x127)](_0x11e91(0x10b)+_0x220277+'\x27:'),console['error']('\x20\x20'+a34_0x270373[_0x11e91(0x154)](_0x4528c5['length']+_0x11e91(0x13c))+_0x11e91(0x121)+a34_0x270373[_0x11e91(0x154)](_0x204171+_0x11e91(0x153))),console['error']('\x20\x20'+a34_0x270373[_0x11e91(0x15a)]('+\x20'+_0x3c04f1['length']+_0x11e91(0x10a))),console[_0x11e91(0x127)]('\x20\x20'+a34_0x270373[_0x11e91(0x14c)]('~\x20'+_0x23874d[_0x11e91(0x141)]+_0x11e91(0x13d))),console['error']('\x20\x20'+a34_0x270373[_0x11e91(0x120)]('=\x20'+_0x3f71e1['length']+_0x11e91(0x122))),console[_0x11e91(0x127)](_0x11e91(0x145)+a34_0x270373[_0x11e91(0x154)](_0x5206b2)+'\x0a');if(_0x23874d[_0x11e91(0x141)]>0x0)for(const _0x527128 of _0x23874d){console[_0x11e91(0x127)](_0x11e91(0x12f)+_0x527128[_0x11e91(0x131)]+'\x27:'),console[_0x11e91(0x127)]('─'[_0x11e91(0x142)](0x3c)),console[_0x11e91(0x127)](_0x527128[_0x11e91(0x144)]),console['error']('─'[_0x11e91(0x142)](0x3c));}if(_0x4ffcdc['dryRun'])return console[_0x11e91(0x127)](a34_0x270373['yellow']('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x3c04f1['length']===0x0&&_0x23874d[_0x11e91(0x141)]===0x0)return console[_0x11e91(0x127)](a34_0x270373[_0x11e91(0x15a)](_0x11e91(0x135))),saveSessionContext({'parent_segment':_0x220277},_0x4ffcdc[_0x11e91(0x111)]),console['error'](a34_0x270373[_0x11e91(0x15a)](_0x11e91(0x11a)+a34_0x270373[_0x11e91(0x120)](_0x11e91(0x10c))+_0x11e91(0x14b)+a34_0x270373[_0x11e91(0x154)](_0x220277))),0x0;if(!_0x4ffcdc[_0x11e91(0x11e)]&&(_0x3c04f1[_0x11e91(0x141)]>0x0||_0x23874d[_0x11e91(0x141)]>0x0)){const _0x16cad8=await confirmKey(_0x11e91(0x155)+(_0x3c04f1[_0x11e91(0x141)]+_0x23874d[_0x11e91(0x141)])+_0x11e91(0x13f));if(!_0x16cad8)return console[_0x11e91(0x127)](_0x11e91(0x148)),0x1;}for(const _0x4620d8 of _0x59aed9){if(_0x4620d8[_0x11e91(0x152)]||_0x4620d8[_0x11e91(0x10f)]){const _0x146535=a34_0x33aea1['dirname'](_0x4620d8[_0x11e91(0x146)]);!existsSync(_0x146535)&&mkdirSync(_0x146535,{'recursive':!![]}),writeFileSync(_0x4620d8[_0x11e91(0x146)],_0x4620d8[_0x11e91(0x12a)],_0x11e91(0x106));}}return console[_0x11e91(0x127)](a34_0x270373[_0x11e91(0x15a)](_0x11e91(0x12d)+(_0x3c04f1['length']+_0x23874d[_0x11e91(0x141)])+_0x11e91(0x10e)+_0x5206b2)),saveSessionContext({'parent_segment':_0x220277},_0x4ffcdc['session']),console[_0x11e91(0x127)](a34_0x270373[_0x11e91(0x15a)](_0x11e91(0x11a)+a34_0x270373[_0x11e91(0x120)]('parent_segment')+_0x11e91(0x14b)+a34_0x270373['cyan'](_0x220277))),0x0;}}function buildFolderPathMap(_0x4c474c){const _0x298790=a34_0x465202,_0x5c4b99=new Map(),_0x31a798=new Map();for(const _0x57fdf1 of _0x4c474c){_0x31a798[_0x298790(0x136)](_0x57fdf1['id'],_0x57fdf1);}const _0x3681db=new Set();for(const _0x8e6f77 of _0x4c474c){!_0x8e6f77[_0x298790(0x140)]&&_0x3681db['add'](_0x8e6f77['id']);}function _0x45b4f0(_0x13c5ae){const _0xc10db9=_0x298790;if(_0x5c4b99['has'](_0x13c5ae['id']))return _0x5c4b99[_0xc10db9(0x130)](_0x13c5ae['id']);if(_0x3681db['has'](_0x13c5ae['id']))return _0x5c4b99['set'](_0x13c5ae['id'],''),'';if(_0x13c5ae[_0xc10db9(0x140)]){const _0x302ef8=_0x31a798['get'](_0x13c5ae[_0xc10db9(0x140)]);if(_0x302ef8){const _0x469d29=_0x45b4f0(_0x302ef8),_0x298543=_0x469d29?_0x469d29+'/'+_0x13c5ae[_0xc10db9(0x12e)]:_0x13c5ae[_0xc10db9(0x12e)];return _0x5c4b99['set'](_0x13c5ae['id'],_0x298543),_0x298543;}}const _0x4cd36d=_0x13c5ae[_0xc10db9(0x12e)];return _0x5c4b99[_0xc10db9(0x136)](_0x13c5ae['id'],_0x4cd36d),_0x4cd36d;}for(const _0x1ea0d4 of _0x4c474c){_0x45b4f0(_0x1ea0d4);}return _0x5c4b99;}function getUniqueFileName(_0xed0ba2,_0x301b34,_0x4251eb){const _0x1cfe33=a34_0x465202,_0x2ab3cd=_0xed0ba2+':'+_0x301b34,_0x4a3200=_0x4251eb[_0x1cfe33(0x130)](_0x2ab3cd)||0x0;_0x4251eb[_0x1cfe33(0x136)](_0x2ab3cd,_0x4a3200+0x1);if(_0x4a3200===0x0)return _0x301b34;return _0x301b34+'-'+_0x4a3200;}function prepareFile(_0x454e07,_0x88ee76,_0xb10657){const _0x57f9b5=a34_0x465202,_0x38743e=a34_0x33aea1[_0x57f9b5(0x137)](_0xb10657,_0x454e07);if(existsSync(_0x454e07)){const _0x3f2c67=readFileSync(_0x454e07,_0x57f9b5(0x106)),_0x2cbe62=generateDiff(_0x3f2c67,_0x88ee76),_0x52ab92=hasChanges(_0x2cbe62);return{'relativePath':_0x38743e,'absolutePath':_0x454e07,'content':_0x88ee76,'isNew':![],'hasChanges':_0x52ab92,'diff':_0x52ab92?formatDiffWithColors(_0x2cbe62):undefined};}return{'relativePath':_0x38743e,'absolutePath':_0x454e07,'content':_0x88ee76,'isNew':!![],'hasChanges':![]};}
@@ -1 +1 @@
1
- const a35_0x5a37db=a35_0x1302;(function(_0x172892,_0x64418b){const _0x45450a=a35_0x1302,_0x4f1789=_0x172892();while(!![]){try{const _0x2aeb75=parseInt(_0x45450a(0x134))/0x1*(-parseInt(_0x45450a(0x124))/0x2)+parseInt(_0x45450a(0x15c))/0x3+-parseInt(_0x45450a(0x135))/0x4+-parseInt(_0x45450a(0x159))/0x5*(parseInt(_0x45450a(0x188))/0x6)+parseInt(_0x45450a(0x162))/0x7*(-parseInt(_0x45450a(0x140))/0x8)+-parseInt(_0x45450a(0x119))/0x9+-parseInt(_0x45450a(0x154))/0xa*(-parseInt(_0x45450a(0x18a))/0xb);if(_0x2aeb75===_0x64418b)break;else _0x4f1789['push'](_0x4f1789['shift']());}catch(_0x57b6d9){_0x4f1789['push'](_0x4f1789['shift']());}}}(a35_0x8251,0xa627d));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode,isHttp400Error,getErrorMessage}from'../sdk/errors.js';import{withSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{getSegmentRootDir,findTdxConfig}from'../utils/tdx-config.js';import{segmentToYamlString,segmentWithActivationsToYaml,parseSegmentYamlFile,normalizeChildSegmentYaml,yamlToCreateRequest,yamlToUpdateRequest,yamlActivationToCreateRequest,yamlActivationToUpdateRequest,activationToYaml}from'../sdk/segment/child-segment-yaml.js';import a35_0x28e9b8 from'chalk';import{existsSync,readFileSync,statSync,readdirSync}from'fs';import a35_0x55cd94 from'path';import*as a35_0x45d4c3 from'yaml';import{sanitizeFileName}from'../utils/string-utils.js';function tryFindTdxConfig(_0x5dd658){try{return findTdxConfig(_0x5dd658);}catch{return null;}}function a35_0x1302(_0x284156,_0x2f8d7){_0x284156=_0x284156-0x10a;const _0x8251b7=a35_0x8251();let _0x1302ec=_0x8251b7[_0x284156];return _0x1302ec;}function resolveTDFolderPath(_0x22a55d,_0x57f96d,_0x3eeb90){if(!_0x57f96d)return _0x22a55d;return _0x22a55d?_0x3eeb90+'/'+_0x22a55d:_0x3eeb90;}export class SegmentPushCommand extends BaseCommand{[a35_0x5a37db(0x17c)]=a35_0x5a37db(0x125);['description']=a35_0x5a37db(0x17e);async[a35_0x5a37db(0x130)](_0x46a82e){const _0x5e1d94=a35_0x5a37db,{options:_0x350805,args:_0x13d98f,tdx:_0x893df7}=_0x46a82e,_0x1ebb5f=_0x350805,_0x51cab5=_0x350805[_0x5e1d94(0x11b)],_0x80a269=_0x13d98f[0x0];let _0x4b092f,_0x8b6035,_0x1040ba,_0x702f31;if(_0x80a269){if(existsSync(_0x80a269)&&statSync(_0x80a269)[_0x5e1d94(0x191)]()){const _0x30593f=tryFindTdxConfig(_0x80a269);if(_0x30593f)_0x4b092f=_0x30593f[_0x5e1d94(0x12d)][_0x5e1d94(0x113)],_0x8b6035=_0x80a269,_0x1040ba=_0x30593f[_0x5e1d94(0x10a)];else return console['error'](a35_0x28e9b8[_0x5e1d94(0x12e)](_0x5e1d94(0x152)+_0x80a269+'\x0a')),console['error'](a35_0x28e9b8['cyan'](_0x5e1d94(0x17a))),0x1;}else{if(existsSync(_0x80a269)&&statSync(_0x80a269)[_0x5e1d94(0x182)]()){const _0x5f10f8=a35_0x55cd94[_0x5e1d94(0x145)](_0x80a269),_0xb67d65=tryFindTdxConfig(_0x5f10f8);if(_0xb67d65)_0x4b092f=_0xb67d65[_0x5e1d94(0x12d)][_0x5e1d94(0x113)],_0x1040ba=_0xb67d65[_0x5e1d94(0x10a)],_0x8b6035=_0xb67d65['configDir'],_0x702f31=a35_0x55cd94['resolve'](_0x80a269);else return console[_0x5e1d94(0x127)](a35_0x28e9b8[_0x5e1d94(0x12e)](_0x5e1d94(0x152)+_0x5f10f8+'\x0a')),console[_0x5e1d94(0x127)](a35_0x28e9b8[_0x5e1d94(0x17d)](_0x5e1d94(0x17a))),0x1;}else _0x4b092f=_0x80a269;}}else{const _0x48355d=tryFindTdxConfig(process['cwd']());_0x48355d?(_0x4b092f=_0x48355d[_0x5e1d94(0x12d)]['parent_segment'],_0x8b6035=process['cwd'](),_0x1040ba=_0x48355d[_0x5e1d94(0x10a)]):_0x4b092f=_0x51cab5;}if(!_0x4b092f)return console[_0x5e1d94(0x127)](a35_0x28e9b8['yellow'](_0x5e1d94(0x158))),console[_0x5e1d94(0x127)](_0x5e1d94(0x18f)),console[_0x5e1d94(0x127)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent'),console[_0x5e1d94(0x127)](_0x5e1d94(0x116)),0x1;const _0x4f0d91=_0x8b6035||getSegmentRootDir(sanitizeFileName(_0x4b092f)),_0x10e7b3=_0x1040ba||_0x4f0d91,_0x15a04b=a35_0x55cd94[_0x5e1d94(0x15b)](_0x10e7b3,_0x4f0d91),_0x859ed2=_0x15a04b!==''&&_0x15a04b!=='.';if(!existsSync(_0x4f0d91))return console[_0x5e1d94(0x127)](a35_0x28e9b8['red'](_0x5e1d94(0x16e)+_0x4f0d91+'\x0a')),console[_0x5e1d94(0x127)](a35_0x28e9b8[_0x5e1d94(0x17d)](_0x5e1d94(0x17a))),0x1;_0x1ebb5f[_0x5e1d94(0x129)]&&(console[_0x5e1d94(0x127)]('Site:\x20'+_0x1ebb5f[_0x5e1d94(0x136)]),console[_0x5e1d94(0x127)](_0x5e1d94(0x11e)+_0x4b092f),console[_0x5e1d94(0x127)](_0x5e1d94(0x185)+_0x4f0d91),_0x859ed2&&console[_0x5e1d94(0x127)](_0x5e1d94(0x170)+_0x15a04b));const _0x359e95=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x4b092f+'\x27...',()=>_0x893df7[_0x5e1d94(0x18d)][_0x5e1d94(0x132)](_0x4b092f),{'verbose':_0x1ebb5f[_0x5e1d94(0x129)]}),_0x5267ba=_0x359e95['data'],[_0x3fbe50,_0x1cee9f,_0x3763a1]=await Promise[_0x5e1d94(0x15d)]([withSpinner(_0x5e1d94(0x164),()=>_0x893df7['segment']['listSegments'](_0x5267ba),{'verbose':_0x1ebb5f['verbose']}),withSpinner(_0x5e1d94(0x139),()=>_0x893df7['segment']['listFolders'](_0x5267ba),{'verbose':_0x1ebb5f[_0x5e1d94(0x129)]}),withSpinner('Fetching\x20users\x20for\x20email\x20resolution...',()=>_0x893df7['user']['buildUserMaps'](),{'verbose':_0x1ebb5f['verbose']})[_0x5e1d94(0x16a)](_0xcf9384=>_0xcf9384['data'])]),_0x3ee7d0=_0x3fbe50[_0x5e1d94(0x176)],_0x3c9dc5=_0x1cee9f[_0x5e1d94(0x176)],{emailToId:_0x569917,idToEmail:_0xdf8787}=_0x3763a1,[_0x4af19a,_0x53182f]=await withSpinner(_0x5e1d94(0x115),async()=>{const _0x209467=_0x5e1d94,[_0x238433,_0x54dab6]=await Promise['all']([_0x893df7['connection'][_0x209467(0x156)](),_0x893df7['connection'][_0x209467(0x198)]()]);return[_0x238433,_0x54dab6];},{'verbose':_0x1ebb5f[_0x5e1d94(0x129)]})[_0x5e1d94(0x16a)](_0x263776=>_0x263776[_0x5e1d94(0x176)]),_0x1717de=buildFolderPathToIdMap(_0x3c9dc5),_0x1a650d=new Map();for(const [_0x381129,_0x39add8]of _0x1717de[_0x5e1d94(0x17b)]()){_0x1a650d[_0x5e1d94(0x160)](_0x39add8,_0x381129);}const _0x560f8e=new Map();for(const _0xafe43a of _0x3ee7d0){const _0x834b61=_0xafe43a[_0x5e1d94(0x12c)]?_0x1a650d[_0x5e1d94(0x157)](_0xafe43a[_0x5e1d94(0x12c)][_0x5e1d94(0x179)]())||'':'',_0x2f7f7b=_0x834b61+':'+_0xafe43a[_0x5e1d94(0x17c)];_0x560f8e['set'](_0x2f7f7b,_0xafe43a);}let _0x1195a4;if(_0x702f31){if(!_0x702f31[_0x5e1d94(0x180)](_0x5e1d94(0x153))&&!_0x702f31[_0x5e1d94(0x180)](_0x5e1d94(0x181)))return console[_0x5e1d94(0x127)](a35_0x28e9b8[_0x5e1d94(0x12e)](_0x5e1d94(0x155)+_0x702f31+'\x0a')),0x1;_0x1195a4=[_0x702f31];}else _0x1195a4=findYamlFiles(_0x4f0d91);if(_0x1195a4[_0x5e1d94(0x122)]===0x0)return console[_0x5e1d94(0x127)](a35_0x28e9b8[_0x5e1d94(0x12e)](_0x5e1d94(0x165)+_0x4f0d91+'\x0a')),console['error'](a35_0x28e9b8[_0x5e1d94(0x17d)]('Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20files')),0x1;const _0xc5ac4d=[];for(const _0x738b67 of _0x1195a4){const _0x34633d=a35_0x55cd94[_0x5e1d94(0x15b)](_0x4f0d91,a35_0x55cd94[_0x5e1d94(0x145)](_0x738b67)),_0x47b40c=_0x34633d==='.'?'':_0x34633d,_0x24c335=readFileSync(_0x738b67,_0x5e1d94(0x128));try{const _0x9a35c0=parseSegmentYamlFile(_0x24c335),_0x55fc1d=normalizeChildSegmentYaml(_0x9a35c0);_0xc5ac4d[_0x5e1d94(0x166)]({'yamlConfig':_0x55fc1d,'folderPath':_0x47b40c,'sourcePath':_0x738b67});}catch(_0x5dfefe){return console[_0x5e1d94(0x127)](a35_0x28e9b8[_0x5e1d94(0x12e)](_0x5e1d94(0x12a)+_0x738b67+':\x20'+(_0x5dfefe instanceof Error?_0x5dfefe[_0x5e1d94(0x13e)]:_0x5dfefe))),0x1;}}if(_0xc5ac4d[_0x5e1d94(0x122)]===0x0)return console['error'](a35_0x28e9b8[_0x5e1d94(0x14c)](_0x5e1d94(0x177))),0x0;const _0x206f23=new Map();_0x3ee7d0[_0x5e1d94(0x122)]>0x0&&await withSpinner('Fetching\x20existing\x20activations...',async()=>{await batchAsync(_0x3ee7d0,async _0x39d6ae=>{const _0x45add7=a35_0x1302,_0x20b1b1=await _0x893df7[_0x45add7(0x18d)][_0x45add7(0x133)](_0x5267ba,_0x39d6ae['id']);_0x206f23['set'](_0x39d6ae['id'],_0x20b1b1);});},{'verbose':_0x1ebb5f['verbose']});const _0x475da2=[],_0x3cede8=new Set();for(const {yamlConfig:_0x14a1cb,folderPath:_0x1c8ab5,sourcePath:_0x2f6eaa}of _0xc5ac4d){const _0x351798=resolveTDFolderPath(_0x1c8ab5,_0x859ed2,_0x15a04b),_0x1188cb=_0x351798+':'+_0x14a1cb['name'],_0x1372e1=_0x560f8e['get'](_0x1188cb),_0x2e3b9e=_0x1372e1?_0x206f23[_0x5e1d94(0x157)](_0x1372e1['id'])||[]:[];if(_0x351798&&!_0x1717de['has'](_0x351798)){const _0x19afeb=_0x351798[_0x5e1d94(0x189)]('/');let _0x3abc0e='';for(const _0x25da94 of _0x19afeb){_0x3abc0e=_0x3abc0e?_0x3abc0e+'/'+_0x25da94:_0x25da94,!_0x1717de[_0x5e1d94(0x187)](_0x3abc0e)&&_0x3cede8['add'](_0x3abc0e);}}const _0xbef874=calculateActivationActions(_0x14a1cb[_0x5e1d94(0x16d)]||[],_0x2e3b9e,_0xdf8787,_0x53182f),_0x947025=segmentToYamlString(_0x14a1cb);let _0x28915f,_0x2eb434=![],_0x2b40c9;if(_0x1372e1){const _0x10364a=segmentWithActivationsToYaml(_0x1372e1,_0x2e3b9e,undefined,_0xdf8787,_0x53182f),_0x58f707=segmentToYamlString(_0x10364a);_0x28915f=generateDiff(_0x58f707,_0x947025),_0x2eb434=hasChanges(_0x28915f),_0x2eb434&&(_0x2b40c9=formatDiffWithColors(_0x28915f));}else _0x28915f=generateDiff('',_0x947025),_0x2b40c9=formatDiffWithColors(_0x28915f);_0x475da2['push']({'relativePath':_0x14a1cb[_0x5e1d94(0x17c)],'absolutePath':_0x2f6eaa,'yamlConfig':_0x14a1cb,'folderPath':_0x351798,'existingSegment':_0x1372e1,'existingActivations':_0x2e3b9e,'isNew':!_0x1372e1,'hasChanges':_0x2eb434,'diff':_0x2b40c9,'activationActions':_0xbef874});}let _0x3d4751=[];if(!_0x702f31){const _0x27df01=new Set();for(const {yamlConfig:_0x5eb6d6,folderPath:_0x4a38d5}of _0xc5ac4d){const _0x57ef1b=resolveTDFolderPath(_0x4a38d5,_0x859ed2,_0x15a04b);_0x27df01['add'](_0x57ef1b+':'+_0x5eb6d6[_0x5e1d94(0x17c)]);}_0x3d4751=_0x3ee7d0[_0x5e1d94(0x143)](_0x585b46=>{const _0x5a01fd=_0x5e1d94,_0x21407b=_0x585b46[_0x5a01fd(0x12c)]?_0x1a650d[_0x5a01fd(0x157)](_0x585b46[_0x5a01fd(0x12c)][_0x5a01fd(0x179)]())||'':'',_0xc39c6=_0x21407b+':'+_0x585b46[_0x5a01fd(0x17c)];if(_0x27df01['has'](_0xc39c6))return![];if(_0x859ed2)return _0x21407b===_0x15a04b||_0x21407b['startsWith'](_0x15a04b+'/');return!![];});}const _0x265980=_0x475da2[_0x5e1d94(0x143)](_0x3bc759=>_0x3bc759['isNew']),_0x567f20=_0x475da2[_0x5e1d94(0x143)](_0xf39102=>!_0xf39102[_0x5e1d94(0x14e)]&&_0xf39102[_0x5e1d94(0x10b)]),_0x4fcdd7=_0x475da2['filter'](_0x442235=>!_0x442235[_0x5e1d94(0x14e)]&&!_0x442235[_0x5e1d94(0x10b)]),_0x11f7d5=Array[_0x5e1d94(0x11c)](_0x3cede8)[_0x5e1d94(0x150)](),_0x3660f4=_0x1ebb5f[_0x5e1d94(0x138)]?_0x3d4751:[],_0x203e46=_0x475da2[_0x5e1d94(0x11d)](_0x4784e5=>_0x4784e5[_0x5e1d94(0x110)]),_0x117983=_0x203e46[_0x5e1d94(0x143)](_0x4e8210=>_0x4e8210['type']==='create'),_0x38317b=_0x203e46[_0x5e1d94(0x143)](_0x3faa9b=>_0x3faa9b[_0x5e1d94(0x190)]===_0x5e1d94(0x161)),_0x359c22=_0x203e46[_0x5e1d94(0x143)](_0x4e5584=>_0x4e5584['type']==='delete');console[_0x5e1d94(0x127)](_0x5e1d94(0x174)+_0x4b092f+'\x27:');_0x11f7d5[_0x5e1d94(0x122)]>0x0&&console[_0x5e1d94(0x127)]('\x20\x20'+a35_0x28e9b8[_0x5e1d94(0x163)]('📁\x20'+_0x11f7d5[_0x5e1d94(0x122)]+_0x5e1d94(0x146)));console['error']('\x20\x20'+a35_0x28e9b8[_0x5e1d94(0x16c)]('+\x20'+_0x265980['length']+_0x5e1d94(0x149))),console[_0x5e1d94(0x127)]('\x20\x20'+a35_0x28e9b8[_0x5e1d94(0x14c)]('~\x20'+_0x567f20['length']+_0x5e1d94(0x183)));if(_0x3660f4[_0x5e1d94(0x122)]>0x0)console['error']('\x20\x20'+a35_0x28e9b8[_0x5e1d94(0x12e)]('-\x20'+_0x3660f4[_0x5e1d94(0x122)]+'\x20segments\x20to\x20delete'));else _0x3d4751['length']>0x0&&!_0x1ebb5f[_0x5e1d94(0x138)]&&console['error']('\x20\x20'+a35_0x28e9b8[_0x5e1d94(0x195)]('\x20\x20'+_0x3d4751[_0x5e1d94(0x122)]+_0x5e1d94(0x15a)));console[_0x5e1d94(0x127)]('\x20\x20'+a35_0x28e9b8[_0x5e1d94(0x195)]('=\x20'+_0x4fcdd7[_0x5e1d94(0x122)]+'\x20unchanged\x20segments'));_0x203e46[_0x5e1d94(0x122)]>0x0&&(console[_0x5e1d94(0x127)](''),console['error']('\x20\x20Activations:'),_0x117983['length']>0x0&&console[_0x5e1d94(0x127)]('\x20\x20\x20\x20'+a35_0x28e9b8[_0x5e1d94(0x16c)]('+\x20'+_0x117983['length']+_0x5e1d94(0x168))),_0x38317b[_0x5e1d94(0x122)]>0x0&&console['error'](_0x5e1d94(0x117)+a35_0x28e9b8[_0x5e1d94(0x14c)]('~\x20'+_0x38317b[_0x5e1d94(0x122)]+_0x5e1d94(0x14b))),_0x359c22[_0x5e1d94(0x122)]>0x0&&console[_0x5e1d94(0x127)]('\x20\x20\x20\x20'+a35_0x28e9b8[_0x5e1d94(0x12e)]('-\x20'+_0x359c22[_0x5e1d94(0x122)]+_0x5e1d94(0x137))));console[_0x5e1d94(0x127)](_0x5e1d94(0x171)+a35_0x28e9b8[_0x5e1d94(0x17d)](_0x4f0d91)+'\x0a');if(_0x11f7d5[_0x5e1d94(0x122)]>0x0){console[_0x5e1d94(0x127)](_0x5e1d94(0x13a));for(const _0x266c9a of _0x11f7d5){console[_0x5e1d94(0x127)]('\x20\x20'+a35_0x28e9b8[_0x5e1d94(0x163)]('+')+'\x20'+_0x266c9a);}console[_0x5e1d94(0x127)]('');}if(_0x265980[_0x5e1d94(0x122)]>0x0)for(const _0xcc3451 of _0x265980){const _0xb89e0d=_0xcc3451[_0x5e1d94(0x10c)]?_0xcc3451[_0x5e1d94(0x10c)]+'/'+_0xcc3451[_0x5e1d94(0x120)][_0x5e1d94(0x17c)]:_0xcc3451[_0x5e1d94(0x120)][_0x5e1d94(0x17c)],_0x5a199e=_0xcc3451['yamlConfig'][_0x5e1d94(0x16d)]?.[_0x5e1d94(0x122)]||0x0,_0x16bdf8=_0x5a199e>0x0?a35_0x28e9b8[_0x5e1d94(0x195)]('\x20['+_0x5a199e+_0x5e1d94(0x148)):'';console[_0x5e1d94(0x127)]('\x0a'+a35_0x28e9b8[_0x5e1d94(0x16c)](_0x5e1d94(0x141))+'\x20'+_0xb89e0d+_0x16bdf8),console['error']('─'[_0x5e1d94(0x10f)](0x3c)),_0xcc3451[_0x5e1d94(0x18b)]&&console['error'](_0xcc3451[_0x5e1d94(0x18b)]),console[_0x5e1d94(0x127)]('─'[_0x5e1d94(0x10f)](0x3c));}if(_0x3660f4[_0x5e1d94(0x122)]>0x0)for(const _0x58365b of _0x3660f4){const _0x26710b=_0x58365b['segmentFolderId']?_0x1a650d[_0x5e1d94(0x157)](_0x58365b['segmentFolderId']['toString']())||'':'',_0x3dc624=_0x26710b?_0x26710b+'/'+_0x58365b['name']:_0x58365b['name'],_0x4553ee=_0x206f23['get'](_0x58365b['id'])||[],_0x4d5266=_0x4553ee[_0x5e1d94(0x122)]>0x0?a35_0x28e9b8['dim']('\x20['+_0x4553ee[_0x5e1d94(0x122)]+_0x5e1d94(0x148)):'';console[_0x5e1d94(0x127)]('\x0a'+a35_0x28e9b8[_0x5e1d94(0x12e)](_0x5e1d94(0x121))+'\x20'+_0x3dc624+_0x4d5266),console[_0x5e1d94(0x127)]('─'[_0x5e1d94(0x10f)](0x3c));const _0x2aae9b=segmentWithActivationsToYaml(_0x58365b,_0x4553ee,undefined,_0xdf8787,_0x53182f),_0xd6372e=segmentToYamlString(_0x2aae9b),_0xf255ea=generateDiff(_0xd6372e,'');console[_0x5e1d94(0x127)](formatDiffWithColors(_0xf255ea)),console[_0x5e1d94(0x127)]('─'[_0x5e1d94(0x10f)](0x3c));}const _0x533049=_0x475da2['filter'](_0x226ceb=>!_0x226ceb[_0x5e1d94(0x14e)]&&_0x226ceb[_0x5e1d94(0x18b)]);if(_0x533049['length']>0x0)for(const _0x2d185f of _0x533049){const _0x3c73bc=_0x2d185f[_0x5e1d94(0x10c)]?_0x2d185f[_0x5e1d94(0x10c)]+'/'+_0x2d185f[_0x5e1d94(0x120)][_0x5e1d94(0x17c)]:_0x2d185f[_0x5e1d94(0x120)][_0x5e1d94(0x17c)];console[_0x5e1d94(0x127)]('\x0a'+a35_0x28e9b8['yellow'](_0x5e1d94(0x173))+'\x20'+_0x3c73bc),console['error']('─'['repeat'](0x3c)),console[_0x5e1d94(0x127)](_0x2d185f['diff']),console[_0x5e1d94(0x127)]('─'[_0x5e1d94(0x10f)](0x3c));}if(_0x1ebb5f['dryRun'])return console[_0x5e1d94(0x127)](a35_0x28e9b8[_0x5e1d94(0x14c)](_0x5e1d94(0x167))),0x0;const _0x25e9a6=_0x265980['length']>0x0||_0x567f20[_0x5e1d94(0x122)]>0x0||_0x3660f4[_0x5e1d94(0x122)]>0x0,_0x37878a=_0x203e46['length']>0x0,_0x1de886=_0x11f7d5['length']>0x0;if(!_0x25e9a6&&!_0x37878a&&!_0x1de886)return console['error'](a35_0x28e9b8[_0x5e1d94(0x16c)](_0x5e1d94(0x193))),0x0;const _0x9ba1d4=_0x265980['length']+_0x567f20[_0x5e1d94(0x122)]+_0x3660f4[_0x5e1d94(0x122)]+_0x11f7d5[_0x5e1d94(0x122)]+_0x203e46[_0x5e1d94(0x122)];if(!_0x1ebb5f[_0x5e1d94(0x11f)]&&_0x9ba1d4>0x0){const _0x562af0=await confirmKey(_0x5e1d94(0x114)+_0x9ba1d4+_0x5e1d94(0x112));if(!_0x562af0)return console['error']('Aborted.'),0x1;}for(const _0xddf6c9 of _0x11f7d5){const _0x302761=_0xddf6c9['split']('/'),_0x40a87b=_0x302761[_0x302761[_0x5e1d94(0x122)]-0x1],_0x4fd5e4=_0x302761[_0x5e1d94(0x131)](0x0,-0x1)[_0x5e1d94(0x12f)]('/'),_0x55e683=_0x1717de[_0x5e1d94(0x157)](_0x4fd5e4),_0x5b9bad={'name':_0x40a87b,'parentFolderId':_0x55e683},_0x2998d0=await withSpinner(_0x5e1d94(0x186)+_0xddf6c9+_0x5e1d94(0x196),()=>_0x893df7[_0x5e1d94(0x18d)][_0x5e1d94(0x16b)](_0x5267ba,_0x5b9bad),{'verbose':_0x1ebb5f[_0x5e1d94(0x129)]});_0x1717de['set'](_0xddf6c9,_0x2998d0['data']['id']),console[_0x5e1d94(0x127)](a35_0x28e9b8[_0x5e1d94(0x163)]('✔\x20Created\x20folder\x20\x27'+_0xddf6c9+'\x27'));}let _0x8ef65=0x0,_0x379a08=0x0,_0x599437=0x0,_0x500783=0x0,_0x42c6cf=0x0,_0x12ddbe=0x0;const _0x9e5689=new Map();for(const _0x165d65 of _0x475da2){const _0x469edc=_0x165d65['folderPath']?_0x1717de[_0x5e1d94(0x157)](_0x165d65['folderPath']):undefined;let _0x43bd92;try{if(_0x165d65[_0x5e1d94(0x14e)]){const _0x428968=yamlToCreateRequest(_0x165d65['yamlConfig'],_0x469edc),_0x1d5337=await withSpinner('Creating\x20segment\x20\x27'+_0x165d65['yamlConfig'][_0x5e1d94(0x17c)]+_0x5e1d94(0x196),()=>_0x893df7[_0x5e1d94(0x18d)][_0x5e1d94(0x169)](_0x5267ba,_0x428968),{'verbose':_0x1ebb5f[_0x5e1d94(0x129)]});_0x43bd92=_0x1d5337['data']['id'],_0x9e5689[_0x5e1d94(0x160)](_0x165d65[_0x5e1d94(0x120)]['name'],_0x43bd92),console[_0x5e1d94(0x127)](a35_0x28e9b8[_0x5e1d94(0x16c)](_0x5e1d94(0x126)+_0x165d65[_0x5e1d94(0x120)]['name']+'\x27')),_0x8ef65++;}else{if(_0x165d65[_0x5e1d94(0x10b)]){const _0x2d2cb3=yamlToUpdateRequest(_0x165d65[_0x5e1d94(0x120)]);_0x469edc!==_0x165d65['existingSegment']?.['segmentFolderId']&&(_0x2d2cb3[_0x5e1d94(0x12c)]=_0x469edc?parseInt(_0x469edc,0xa):undefined),await withSpinner(_0x5e1d94(0x13f)+_0x165d65['yamlConfig'][_0x5e1d94(0x17c)]+_0x5e1d94(0x196),()=>_0x893df7[_0x5e1d94(0x18d)][_0x5e1d94(0x10e)](_0x5267ba,_0x165d65[_0x5e1d94(0x13d)]['id'],_0x2d2cb3),{'verbose':_0x1ebb5f[_0x5e1d94(0x129)]}),_0x43bd92=_0x165d65[_0x5e1d94(0x13d)]['id'],console[_0x5e1d94(0x127)](a35_0x28e9b8['yellow'](_0x5e1d94(0x15e)+_0x165d65[_0x5e1d94(0x120)]['name']+'\x27')),_0x379a08++;}else _0x43bd92=_0x165d65[_0x5e1d94(0x13d)]['id'];}}catch(_0x217bba){const _0x30c8a7=isHttp400Error(_0x217bba),_0x1d394c=_0x30c8a7?ErrorCode[_0x5e1d94(0x111)]:ErrorCode['SEGMENT_UPDATE_ERROR'],_0xcd6e74=getErrorMessage(_0x217bba);throw new SDKError(_0x1d394c,_0x5e1d94(0x12b)+(_0x165d65['isNew']?_0x5e1d94(0x172):_0x5e1d94(0x161))+_0x5e1d94(0x175)+_0x165d65['absolutePath']+_0x5e1d94(0x144)+_0xcd6e74,_0x217bba);}for(const _0x222f6e of _0x165d65[_0x5e1d94(0x110)]){try{if(_0x222f6e['type']===_0x5e1d94(0x172)&&_0x222f6e[_0x5e1d94(0x18c)]){const _0x57ed3d=yamlActivationToCreateRequest(_0x222f6e[_0x5e1d94(0x18c)],_0x569917,_0x4af19a);await withSpinner('Creating\x20activation\x20\x27'+_0x222f6e['name']+_0x5e1d94(0x196),()=>_0x893df7[_0x5e1d94(0x18d)][_0x5e1d94(0x13b)](_0x5267ba,_0x43bd92,_0x57ed3d),{'verbose':_0x1ebb5f[_0x5e1d94(0x129)]}),console[_0x5e1d94(0x127)](a35_0x28e9b8['green']('\x20\x20✔\x20Created\x20activation\x20\x27'+_0x222f6e[_0x5e1d94(0x17c)]+'\x27')),_0x500783++;}else{if(_0x222f6e[_0x5e1d94(0x190)]==='update'&&_0x222f6e['yamlActivation']&&_0x222f6e[_0x5e1d94(0x16f)]){const _0x2b0c4c=yamlActivationToUpdateRequest(_0x222f6e[_0x5e1d94(0x18c)],_0x569917,_0x4af19a);await withSpinner(_0x5e1d94(0x123)+_0x222f6e['name']+_0x5e1d94(0x196),()=>_0x893df7[_0x5e1d94(0x18d)][_0x5e1d94(0x14f)](_0x5267ba,_0x43bd92,_0x222f6e[_0x5e1d94(0x16f)]['id'],_0x2b0c4c),{'verbose':_0x1ebb5f[_0x5e1d94(0x129)]}),console[_0x5e1d94(0x127)](a35_0x28e9b8[_0x5e1d94(0x14c)](_0x5e1d94(0x17f)+_0x222f6e[_0x5e1d94(0x17c)]+'\x27')),_0x42c6cf++;}else _0x222f6e[_0x5e1d94(0x190)]==='delete'&&_0x222f6e[_0x5e1d94(0x16f)]&&(await withSpinner(_0x5e1d94(0x18e)+_0x222f6e['name']+_0x5e1d94(0x196),()=>_0x893df7['segment']['deleteActivation'](_0x5267ba,_0x43bd92,_0x222f6e['existingActivation']['id']),{'verbose':_0x1ebb5f[_0x5e1d94(0x129)]}),console[_0x5e1d94(0x127)](a35_0x28e9b8[_0x5e1d94(0x12e)](_0x5e1d94(0x197)+_0x222f6e[_0x5e1d94(0x17c)]+'\x27')),_0x12ddbe++);}}catch(_0x25c6a5){const _0x557189=isHttp400Error(_0x25c6a5),_0x18825d=_0x557189?ErrorCode[_0x5e1d94(0x151)]:ErrorCode[_0x5e1d94(0x10d)],_0x46e79b=getErrorMessage(_0x25c6a5);throw new SDKError(_0x18825d,_0x5e1d94(0x12b)+_0x222f6e[_0x5e1d94(0x190)]+_0x5e1d94(0x14a)+_0x222f6e[_0x5e1d94(0x17c)]+_0x5e1d94(0x11a)+_0x165d65[_0x5e1d94(0x14d)]+_0x5e1d94(0x144)+_0x46e79b,_0x25c6a5);}}}for(const _0x772cc2 of _0x3660f4){await withSpinner('Deleting\x20segment\x20\x27'+_0x772cc2[_0x5e1d94(0x17c)]+_0x5e1d94(0x196),()=>_0x893df7[_0x5e1d94(0x18d)][_0x5e1d94(0x147)](_0x772cc2['id']),{'verbose':_0x1ebb5f['verbose']}),console[_0x5e1d94(0x127)](a35_0x28e9b8[_0x5e1d94(0x12e)]('✔\x20Deleted\x20segment\x20\x27'+_0x772cc2[_0x5e1d94(0x17c)]+'\x27')),_0x599437++;}const _0xf53f99=[];if(_0x8ef65>0x0)_0xf53f99[_0x5e1d94(0x166)](_0x8ef65+_0x5e1d94(0x15f));if(_0x379a08>0x0)_0xf53f99[_0x5e1d94(0x166)](_0x379a08+_0x5e1d94(0x13c));if(_0x599437>0x0)_0xf53f99[_0x5e1d94(0x166)](_0x599437+'\x20deleted');const _0x29c648=[];if(_0x500783>0x0)_0x29c648[_0x5e1d94(0x166)](_0x500783+_0x5e1d94(0x15f));if(_0x42c6cf>0x0)_0x29c648[_0x5e1d94(0x166)](_0x42c6cf+_0x5e1d94(0x13c));if(_0x12ddbe>0x0)_0x29c648['push'](_0x12ddbe+_0x5e1d94(0x184));return console[_0x5e1d94(0x127)](a35_0x28e9b8[_0x5e1d94(0x16c)](_0x5e1d94(0x192))),_0xf53f99[_0x5e1d94(0x122)]>0x0&&console[_0x5e1d94(0x127)](_0x5e1d94(0x142)+_0xf53f99['join'](',\x20')),_0x29c648[_0x5e1d94(0x122)]>0x0&&console[_0x5e1d94(0x127)]('\x20\x20Activations:\x20'+_0x29c648['join'](',\x20')),0x0;}}function a35_0x8251(){const _0xab34ab=['8mrpqxL','New\x20segment:','\x20\x20Segments:\x20','filter','\x0a\x20\x20','dirname','\x20folders\x20to\x20create','deleteSegment','\x20activations]','\x20new\x20segments','\x20activation\x20\x27','\x20to\x20update','yellow','absolutePath','isNew','updateActivation','sort','ACTIVATION_SYNTAX_ERROR','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','.yml','3020EWkXjW','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','buildNameToIdMap','get','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','147935xpaBuM','\x20segments\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','relative','63621QXxVoF','all','✔\x20Updated\x20segment\x20\x27','\x20created','set','update','1309749myOnme','blue','Fetching\x20existing\x20segments...','Error:\x20No\x20segment\x20YAML\x20files\x20found\x20in\x20','push','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','\x20to\x20create','createSegment','then','createFolder','green','activations','Error:\x20Directory\x20not\x20found:\x20','existingActivation','Scoped\x20to\x20folder:\x20','\x20\x20Source:\x20','create','Changes\x20to:','\x0aPush\x20summary\x20for\x20\x27','\x20segment\x20from\x20file:\x20','data','No\x20segment\x20YAML\x20files\x20found','stringify','toString','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','entries','name','cyan','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','\x20\x20✔\x20Updated\x20activation\x20\x27','endsWith','.yaml','isFile','\x20changed\x20segments','\x20deleted','Source\x20directory:\x20','Creating\x20folder\x20\x27','has','6MIaTOm','split','121759yWqRyL','diff','yamlActivation','segment','Deleting\x20activation\x20\x27','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)','type','isDirectory','\x0a✔\x20Push\x20complete','✔\x20All\x20segments\x20and\x20activations\x20are\x20up\x20to\x20date','parentFolderId','dim','\x27...','\x20\x20✔\x20Deleted\x20activation\x20\x27','buildIdToNameMap','configDir','hasChanges','folderPath','ACTIVATION_UPDATE_ERROR','updateSegmentById','repeat','activationActions','SEGMENT_SYNTAX_ERROR','\x20changes?','parent_segment','Push\x20','Fetching\x20connections\x20for\x20name\x20resolution...','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','\x20\x20\x20\x20','add','6675201mJpxWj','\x27\x20from\x20file:\x20','parentSegment','from','flatMap','Parent\x20segment:\x20','yes','yamlConfig','Delete\x20segment:','length','Updating\x20activation\x20\x27','4NoAFsK','segment:push','✔\x20Created\x20segment\x20\x27','error','utf-8','verbose','Error\x20parsing\x20','Failed\x20to\x20','segmentFolderId','config','red','join','execute','slice','resolveParentId','listActivations','238121eVLeEb','4995388QoRFTo','site','\x20to\x20delete','delete','Fetching\x20existing\x20folders...','Folders\x20to\x20create:','createActivation','\x20updated','existingSegment','message','Updating\x20segment\x20\x27'];a35_0x8251=function(){return _0xab34ab;};return a35_0x8251();}function buildFolderPathToIdMap(_0x413cc4){const _0x3e1604=a35_0x5a37db,_0x5d748c=new Map(),_0x405900=new Map();for(const _0x3171d5 of _0x413cc4){_0x405900[_0x3e1604(0x160)](_0x3171d5['id'],_0x3171d5);}const _0x5f2140=new Set();for(const _0xcc7ff8 of _0x413cc4){!_0xcc7ff8[_0x3e1604(0x194)]&&_0x5f2140[_0x3e1604(0x118)](_0xcc7ff8['id']);}function _0x48443e(_0x385d62){const _0x2f3698=_0x3e1604;if(_0x5f2140[_0x2f3698(0x187)](_0x385d62['id']))return'';if(_0x385d62['parentFolderId']){const _0x4a6cae=_0x405900[_0x2f3698(0x157)](_0x385d62[_0x2f3698(0x194)]);if(_0x4a6cae){const _0x41f0df=_0x48443e(_0x4a6cae);return _0x41f0df?_0x41f0df+'/'+_0x385d62[_0x2f3698(0x17c)]:_0x385d62[_0x2f3698(0x17c)];}}return _0x385d62['name'];}for(const _0x88ed7 of _0x413cc4){const _0x33e999=_0x48443e(_0x88ed7);_0x5d748c[_0x3e1604(0x160)](_0x33e999,_0x88ed7['id']);}return _0x5d748c;}function findYamlFiles(_0x4b5e79){const _0x7df514=[];function _0x4ce2b7(_0x4009bc){const _0x2b6841=a35_0x1302,_0x5448b0=readdirSync(_0x4009bc,{'withFileTypes':!![]});for(const _0x341ff0 of _0x5448b0){const _0x4a07ea=a35_0x55cd94['join'](_0x4009bc,_0x341ff0['name']);if(_0x341ff0[_0x2b6841(0x191)]())_0x4ce2b7(_0x4a07ea);else(_0x341ff0['name']['endsWith'](_0x2b6841(0x153))||_0x341ff0[_0x2b6841(0x17c)][_0x2b6841(0x180)](_0x2b6841(0x181)))&&_0x7df514[_0x2b6841(0x166)](_0x4a07ea);}}return _0x4ce2b7(_0x4b5e79),_0x7df514;}function calculateActivationActions(_0x217cdf,_0x1801f4,_0x371724,_0x5af2ec){const _0xb57c39=a35_0x5a37db,_0x50e9b6=[],_0x5b6871=new Map();for(const _0x11e1a6 of _0x1801f4){_0x5b6871[_0xb57c39(0x160)](_0x11e1a6['name'],_0x11e1a6);}const _0x440d95=new Map();for(const _0xd178be of _0x217cdf){_0x440d95[_0xb57c39(0x160)](_0xd178be[_0xb57c39(0x17c)],_0xd178be);}for(const _0x25cf82 of _0x217cdf){const _0xa84bf1=_0x5b6871['get'](_0x25cf82[_0xb57c39(0x17c)]);if(!_0xa84bf1)_0x50e9b6[_0xb57c39(0x166)]({'type':_0xb57c39(0x172),'name':_0x25cf82[_0xb57c39(0x17c)],'yamlActivation':_0x25cf82});else{const _0x1fdefa=activationToYaml(_0xa84bf1,_0x371724,_0x5af2ec),_0x212aae=a35_0x45d4c3[_0xb57c39(0x178)](_0x1fdefa),_0x273545=a35_0x45d4c3['stringify'](_0x25cf82);_0x212aae!==_0x273545&&_0x50e9b6['push']({'type':_0xb57c39(0x161),'name':_0x25cf82[_0xb57c39(0x17c)],'yamlActivation':_0x25cf82,'existingActivation':_0xa84bf1});}}for(const _0x52aae4 of _0x1801f4){!_0x440d95[_0xb57c39(0x187)](_0x52aae4['name'])&&_0x50e9b6[_0xb57c39(0x166)]({'type':'delete','name':_0x52aae4[_0xb57c39(0x17c)],'existingActivation':_0x52aae4});}return _0x50e9b6;}
1
+ const a35_0x5802ad=a35_0x4bc8;(function(_0x28c092,_0x2d0e5c){const _0x297bc4=a35_0x4bc8,_0x121675=_0x28c092();while(!![]){try{const _0x494c49=parseInt(_0x297bc4(0x178))/0x1*(parseInt(_0x297bc4(0x140))/0x2)+-parseInt(_0x297bc4(0x102))/0x3+parseInt(_0x297bc4(0x18d))/0x4*(-parseInt(_0x297bc4(0x15b))/0x5)+parseInt(_0x297bc4(0x168))/0x6*(-parseInt(_0x297bc4(0x15e))/0x7)+parseInt(_0x297bc4(0x134))/0x8+-parseInt(_0x297bc4(0x144))/0x9+parseInt(_0x297bc4(0x155))/0xa;if(_0x494c49===_0x2d0e5c)break;else _0x121675['push'](_0x121675['shift']());}catch(_0x364537){_0x121675['push'](_0x121675['shift']());}}}(a35_0x3a41,0xbadb8));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode,isHttp400Error,getErrorMessage}from'../sdk/errors.js';function a35_0x3a41(){const _0x2f5c25=['yamlActivation','error','name','SEGMENT_SYNTAX_ERROR','get','join','\x0a\x20\x20','Creating\x20segment\x20\x27','activations','\x20unchanged\x20segments','SEGMENT_UPDATE_ERROR','3722517HgJknT','verbose','then','\x20\x20Activations:','startsWith','diff','deleteActivation','Push\x20','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','yamlConfig','\x20segments\x20to\x20delete','\x20to\x20create','type','message','entries','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20files','Updating\x20activation\x20\x27','sort','configDir','from','Fetching\x20existing\x20folders...','ACTIVATION_UPDATE_ERROR','endsWith','\x20\x20Source:\x20','Failed\x20to\x20','isNew','segment:push','yes','ACTIVATION_SYNTAX_ERROR','segmentFolderId','\x20activation\x20\x27','cwd','set','📁\x20','\x27...','\x20\x20Segments:\x20','✔\x20Created\x20segment\x20\x27','Aborted.','isFile','\x20changes?','parentSegment','\x20to\x20delete','segment','\x20updated','stringify','has','Fetching\x20connections\x20for\x20name\x20resolution...','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','length','8070416rkQIxw','hasChanges','✔\x20Deleted\x20segment\x20\x27','Error\x20parsing\x20','dim','createActivation','repeat','\x20activations]','\x0a✔\x20Push\x20complete','existingActivation','\x0aPush\x20summary\x20for\x20\x27','Scoped\x20to\x20folder:\x20','1269126ADihnh','site','description','listFolders','791901pLbjCM','parentFolderId','utf-8','config','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)','New\x20segment:','parent_segment','delete','Resolving\x20parent\x20segment\x20\x27','cyan','relative','user','green','create','updateActivation','add','createFolder','16272140ryySFs','deleteSegment','activationActions','absolutePath','toString','filter','104515IWELxd','buildNameToIdMap','.yaml','21LZxhJe','split','update','\x20\x20✔\x20Deleted\x20activation\x20\x27','all','\x20segments\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','Updating\x20segment\x20\x27','.yml','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','✔\x20Updated\x20segment\x20\x27','555108zgaLia','existingSegment','\x20to\x20update','buildIdToNameMap','Fetching\x20existing\x20segments...','Delete\x20segment:','Fetching\x20users\x20for\x20email\x20resolution...','\x20segment\x20from\x20file:\x20','\x20\x20\x20\x20','\x20\x20✔\x20Updated\x20activation\x20\x27','slice','blue','createSegment','Error:\x20Directory\x20not\x20found:\x20','resolve','\x27\x20from\x20file:\x20','1nuZXEp','push','Changes\x20to:','No\x20segment\x20YAML\x20files\x20found','buildUserMaps','data','dirname','isDirectory','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','\x20changed\x20segments','✔\x20All\x20segments\x20and\x20activations\x20are\x20up\x20to\x20date','Site:\x20','dryRun','Fetching\x20existing\x20activations...','folderPath','\x20\x20✔\x20Created\x20activation\x20\x27','yellow','connection','red','Creating\x20activation\x20\x27','✔\x20Created\x20folder\x20\x27','172WfkeZj','\x20created','\x20deleted','Source\x20directory:\x20'];a35_0x3a41=function(){return _0x2f5c25;};return a35_0x3a41();}import{withSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';function a35_0x4bc8(_0x2ac5d8,_0x331a29){_0x2ac5d8=_0x2ac5d8-0xfb;const _0x3a416c=a35_0x3a41();let _0x4bc8f2=_0x3a416c[_0x2ac5d8];return _0x4bc8f2;}import{batchAsync}from'../utils/async.js';import{getSegmentRootDir,findTdxConfig}from'../utils/tdx-config.js';import{segmentToYamlString,segmentWithActivationsToYaml,parseSegmentYamlFile,normalizeChildSegmentYaml,yamlToCreateRequest,yamlToUpdateRequest,yamlActivationToCreateRequest,yamlActivationToUpdateRequest,activationToYaml}from'../sdk/segment/child-segment-yaml.js';import a35_0x364cda from'chalk';import{existsSync,readFileSync,statSync,readdirSync}from'fs';import a35_0x33e977 from'path';import*as a35_0x2c555e from'yaml';import{sanitizeFileName}from'../utils/string-utils.js';function tryFindTdxConfig(_0x17cf0e){try{return findTdxConfig(_0x17cf0e);}catch{return null;}}function resolveTDFolderPath(_0x1a7f32,_0x5a15f8,_0x811c31){if(!_0x5a15f8)return _0x1a7f32;return _0x1a7f32?_0x811c31+'/'+_0x1a7f32:_0x811c31;}export class SegmentPushCommand extends BaseCommand{[a35_0x5802ad(0x193)]=a35_0x5802ad(0x11c);[a35_0x5802ad(0x142)]='Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments';async['execute'](_0x2e2118){const _0x3f8c73=a35_0x5802ad,{options:_0x34ee06,args:_0x37e215,tdx:_0x27b90e}=_0x2e2118,_0x28d973=_0x34ee06,_0xd2cc0a=_0x34ee06[_0x3f8c73(0x12a)],_0x3167dc=_0x37e215[0x0];let _0x3abbb9,_0x5e9efc,_0x4614e2,_0x3c4920;if(_0x3167dc){if(existsSync(_0x3167dc)&&statSync(_0x3167dc)[_0x3f8c73(0x17f)]()){const _0x2ab6c3=tryFindTdxConfig(_0x3167dc);if(_0x2ab6c3)_0x3abbb9=_0x2ab6c3[_0x3f8c73(0x147)]['parent_segment'],_0x5e9efc=_0x3167dc,_0x4614e2=_0x2ab6c3['configDir'];else return console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x18a)](_0x3f8c73(0x166)+_0x3167dc+'\x0a')),console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x14d)](_0x3f8c73(0x180))),0x1;}else{if(existsSync(_0x3167dc)&&statSync(_0x3167dc)[_0x3f8c73(0x128)]()){const _0x2ed348=a35_0x33e977['dirname'](_0x3167dc),_0x2f3096=tryFindTdxConfig(_0x2ed348);if(_0x2f3096)_0x3abbb9=_0x2f3096[_0x3f8c73(0x147)][_0x3f8c73(0x14a)],_0x4614e2=_0x2f3096['configDir'],_0x5e9efc=_0x2f3096['configDir'],_0x3c4920=a35_0x33e977[_0x3f8c73(0x176)](_0x3167dc);else return console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x18a)]('Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20'+_0x2ed348+'\x0a')),console['error'](a35_0x364cda[_0x3f8c73(0x14d)](_0x3f8c73(0x180))),0x1;}else _0x3abbb9=_0x3167dc;}}else{const _0x2f0e41=tryFindTdxConfig(process[_0x3f8c73(0x121)]());_0x2f0e41?(_0x3abbb9=_0x2f0e41[_0x3f8c73(0x147)][_0x3f8c73(0x14a)],_0x5e9efc=process[_0x3f8c73(0x121)](),_0x4614e2=_0x2f0e41[_0x3f8c73(0x114)]):_0x3abbb9=_0xd2cc0a;}if(!_0x3abbb9)return console['error'](a35_0x364cda['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console['error'](_0x3f8c73(0x148)),console[_0x3f8c73(0x192)](_0x3f8c73(0x132)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file'),0x1;const _0xbf0c2=_0x5e9efc||getSegmentRootDir(sanitizeFileName(_0x3abbb9)),_0x231753=_0x4614e2||_0xbf0c2,_0x41d1df=a35_0x33e977[_0x3f8c73(0x14e)](_0x231753,_0xbf0c2),_0x49504e=_0x41d1df!==''&&_0x41d1df!=='.';if(!existsSync(_0xbf0c2))return console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x18a)](_0x3f8c73(0x175)+_0xbf0c2+'\x0a')),console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x14d)](_0x3f8c73(0x180))),0x1;_0x28d973['verbose']&&(console['error'](_0x3f8c73(0x183)+_0x28d973[_0x3f8c73(0x141)]),console[_0x3f8c73(0x192)]('Parent\x20segment:\x20'+_0x3abbb9),console[_0x3f8c73(0x192)](_0x3f8c73(0x190)+_0xbf0c2),_0x49504e&&console['error'](_0x3f8c73(0x13f)+_0x41d1df));const _0x5c7607=await withSpinner(_0x3f8c73(0x14c)+_0x3abbb9+_0x3f8c73(0x124),()=>_0x27b90e[_0x3f8c73(0x12c)]['resolveParentId'](_0x3abbb9),{'verbose':_0x28d973['verbose']}),_0x3c6ae5=_0x5c7607['data'],[_0x35dd44,_0x6b2320,_0x2b8239]=await Promise[_0x3f8c73(0x162)]([withSpinner(_0x3f8c73(0x16c),()=>_0x27b90e['segment']['listSegments'](_0x3c6ae5),{'verbose':_0x28d973[_0x3f8c73(0x103)]}),withSpinner(_0x3f8c73(0x116),()=>_0x27b90e[_0x3f8c73(0x12c)][_0x3f8c73(0x143)](_0x3c6ae5),{'verbose':_0x28d973[_0x3f8c73(0x103)]}),withSpinner(_0x3f8c73(0x16e),()=>_0x27b90e[_0x3f8c73(0x14f)][_0x3f8c73(0x17c)](),{'verbose':_0x28d973[_0x3f8c73(0x103)]})[_0x3f8c73(0x104)](_0x33760a=>_0x33760a['data'])]),_0x7b35f=_0x35dd44[_0x3f8c73(0x17d)],_0x290d80=_0x6b2320[_0x3f8c73(0x17d)],{emailToId:_0x534057,idToEmail:_0xa6a6f7}=_0x2b8239,[_0x4aba62,_0x2de820]=await withSpinner(_0x3f8c73(0x130),async()=>{const _0x129d14=_0x3f8c73,[_0xd2e758,_0xeec1a1]=await Promise[_0x129d14(0x162)]([_0x27b90e[_0x129d14(0x189)][_0x129d14(0x15c)](),_0x27b90e[_0x129d14(0x189)][_0x129d14(0x16b)]()]);return[_0xd2e758,_0xeec1a1];},{'verbose':_0x28d973['verbose']})[_0x3f8c73(0x104)](_0x4115ae=>_0x4115ae[_0x3f8c73(0x17d)]),_0x67cfcc=buildFolderPathToIdMap(_0x290d80),_0x5c8af6=new Map();for(const [_0x801972,_0x5fecf8]of _0x67cfcc[_0x3f8c73(0x110)]()){_0x5c8af6[_0x3f8c73(0x122)](_0x5fecf8,_0x801972);}const _0x46e521=new Map();for(const _0x192821 of _0x7b35f){const _0x1086ac=_0x192821[_0x3f8c73(0x11f)]?_0x5c8af6['get'](_0x192821[_0x3f8c73(0x11f)][_0x3f8c73(0x159)]())||'':'',_0x11ad25=_0x1086ac+':'+_0x192821[_0x3f8c73(0x193)];_0x46e521['set'](_0x11ad25,_0x192821);}let _0x511b7c;if(_0x3c4920){if(!_0x3c4920['endsWith'](_0x3f8c73(0x165))&&!_0x3c4920[_0x3f8c73(0x118)](_0x3f8c73(0x15d)))return console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x18a)](_0x3f8c73(0x10a)+_0x3c4920+'\x0a')),0x1;_0x511b7c=[_0x3c4920];}else _0x511b7c=findYamlFiles(_0xbf0c2);if(_0x511b7c['length']===0x0)return console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x18a)]('Error:\x20No\x20segment\x20YAML\x20files\x20found\x20in\x20'+_0xbf0c2+'\x0a')),console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x14d)](_0x3f8c73(0x111))),0x1;const _0x4289eb=[];for(const _0xae8455 of _0x511b7c){const _0x4f58e0=a35_0x33e977[_0x3f8c73(0x14e)](_0xbf0c2,a35_0x33e977[_0x3f8c73(0x17e)](_0xae8455)),_0xf6c128=_0x4f58e0==='.'?'':_0x4f58e0,_0x35c340=readFileSync(_0xae8455,_0x3f8c73(0x146));try{const _0x413f22=parseSegmentYamlFile(_0x35c340),_0x5d69da=normalizeChildSegmentYaml(_0x413f22);_0x4289eb['push']({'yamlConfig':_0x5d69da,'folderPath':_0xf6c128,'sourcePath':_0xae8455});}catch(_0x4235d9){return console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x18a)](_0x3f8c73(0x137)+_0xae8455+':\x20'+(_0x4235d9 instanceof Error?_0x4235d9[_0x3f8c73(0x10f)]:_0x4235d9))),0x1;}}if(_0x4289eb[_0x3f8c73(0x133)]===0x0)return console[_0x3f8c73(0x192)](a35_0x364cda['yellow'](_0x3f8c73(0x17b))),0x0;const _0x2f2229=new Map();_0x7b35f[_0x3f8c73(0x133)]>0x0&&await withSpinner(_0x3f8c73(0x185),async()=>{await batchAsync(_0x7b35f,async _0x3c458d=>{const _0x10510d=a35_0x4bc8,_0x20e1c7=await _0x27b90e[_0x10510d(0x12c)]['listActivations'](_0x3c6ae5,_0x3c458d['id']);_0x2f2229[_0x10510d(0x122)](_0x3c458d['id'],_0x20e1c7);});},{'verbose':_0x28d973[_0x3f8c73(0x103)]});const _0x393414=[],_0x2e1cef=new Set();for(const {yamlConfig:_0x507b8d,folderPath:_0x19424a,sourcePath:_0x94e2d6}of _0x4289eb){const _0x168701=resolveTDFolderPath(_0x19424a,_0x49504e,_0x41d1df),_0x81a6e1=_0x168701+':'+_0x507b8d[_0x3f8c73(0x193)],_0x321f49=_0x46e521[_0x3f8c73(0xfb)](_0x81a6e1),_0x56553e=_0x321f49?_0x2f2229[_0x3f8c73(0xfb)](_0x321f49['id'])||[]:[];if(_0x168701&&!_0x67cfcc['has'](_0x168701)){const _0x5630f6=_0x168701[_0x3f8c73(0x15f)]('/');let _0x1fae31='';for(const _0x3df0cd of _0x5630f6){_0x1fae31=_0x1fae31?_0x1fae31+'/'+_0x3df0cd:_0x3df0cd,!_0x67cfcc[_0x3f8c73(0x12f)](_0x1fae31)&&_0x2e1cef[_0x3f8c73(0x153)](_0x1fae31);}}const _0x53585f=calculateActivationActions(_0x507b8d[_0x3f8c73(0xff)]||[],_0x56553e,_0xa6a6f7,_0x2de820),_0x746f7d=segmentToYamlString(_0x507b8d);let _0x1d2994,_0x101bf5=![],_0x249ae3;if(_0x321f49){const _0x219ae6=segmentWithActivationsToYaml(_0x321f49,_0x56553e,undefined,_0xa6a6f7,_0x2de820),_0xcf78a5=segmentToYamlString(_0x219ae6);_0x1d2994=generateDiff(_0xcf78a5,_0x746f7d),_0x101bf5=hasChanges(_0x1d2994),_0x101bf5&&(_0x249ae3=formatDiffWithColors(_0x1d2994));}else _0x1d2994=generateDiff('',_0x746f7d),_0x249ae3=formatDiffWithColors(_0x1d2994);_0x393414[_0x3f8c73(0x179)]({'relativePath':_0x507b8d[_0x3f8c73(0x193)],'absolutePath':_0x94e2d6,'yamlConfig':_0x507b8d,'folderPath':_0x168701,'existingSegment':_0x321f49,'existingActivations':_0x56553e,'isNew':!_0x321f49,'hasChanges':_0x101bf5,'diff':_0x249ae3,'activationActions':_0x53585f});}let _0x1fbcd4=[];if(!_0x3c4920){const _0xedc1a2=new Set();for(const {yamlConfig:_0x304202,folderPath:_0x188610}of _0x4289eb){const _0x9b40a0=resolveTDFolderPath(_0x188610,_0x49504e,_0x41d1df);_0xedc1a2[_0x3f8c73(0x153)](_0x9b40a0+':'+_0x304202[_0x3f8c73(0x193)]);}_0x1fbcd4=_0x7b35f[_0x3f8c73(0x15a)](_0x3b1b92=>{const _0x1f9a7c=_0x3f8c73,_0x5e65f4=_0x3b1b92[_0x1f9a7c(0x11f)]?_0x5c8af6[_0x1f9a7c(0xfb)](_0x3b1b92[_0x1f9a7c(0x11f)]['toString']())||'':'',_0x282e32=_0x5e65f4+':'+_0x3b1b92[_0x1f9a7c(0x193)];if(_0xedc1a2[_0x1f9a7c(0x12f)](_0x282e32))return![];if(_0x49504e)return _0x5e65f4===_0x41d1df||_0x5e65f4[_0x1f9a7c(0x106)](_0x41d1df+'/');return!![];});}const _0xb56e60=_0x393414[_0x3f8c73(0x15a)](_0x5ad8e0=>_0x5ad8e0['isNew']),_0x447915=_0x393414['filter'](_0x192021=>!_0x192021[_0x3f8c73(0x11b)]&&_0x192021[_0x3f8c73(0x135)]),_0x1d6d9b=_0x393414['filter'](_0x54b575=>!_0x54b575[_0x3f8c73(0x11b)]&&!_0x54b575['hasChanges']),_0x511313=Array[_0x3f8c73(0x115)](_0x2e1cef)[_0x3f8c73(0x113)](),_0x515158=_0x28d973[_0x3f8c73(0x14b)]?_0x1fbcd4:[],_0x72789f=_0x393414['flatMap'](_0x57969f=>_0x57969f[_0x3f8c73(0x157)]),_0x57a9c7=_0x72789f[_0x3f8c73(0x15a)](_0x2cd050=>_0x2cd050[_0x3f8c73(0x10e)]===_0x3f8c73(0x151)),_0x45d37a=_0x72789f['filter'](_0xbc0fe=>_0xbc0fe[_0x3f8c73(0x10e)]===_0x3f8c73(0x160)),_0x50d70b=_0x72789f[_0x3f8c73(0x15a)](_0x1535d7=>_0x1535d7[_0x3f8c73(0x10e)]===_0x3f8c73(0x14b));console['error'](_0x3f8c73(0x13e)+_0x3abbb9+'\x27:');_0x511313['length']>0x0&&console[_0x3f8c73(0x192)]('\x20\x20'+a35_0x364cda[_0x3f8c73(0x173)](_0x3f8c73(0x123)+_0x511313[_0x3f8c73(0x133)]+'\x20folders\x20to\x20create'));console[_0x3f8c73(0x192)]('\x20\x20'+a35_0x364cda[_0x3f8c73(0x150)]('+\x20'+_0xb56e60[_0x3f8c73(0x133)]+'\x20new\x20segments')),console[_0x3f8c73(0x192)]('\x20\x20'+a35_0x364cda[_0x3f8c73(0x188)]('~\x20'+_0x447915[_0x3f8c73(0x133)]+_0x3f8c73(0x181)));if(_0x515158[_0x3f8c73(0x133)]>0x0)console[_0x3f8c73(0x192)]('\x20\x20'+a35_0x364cda[_0x3f8c73(0x18a)]('-\x20'+_0x515158[_0x3f8c73(0x133)]+_0x3f8c73(0x10c)));else _0x1fbcd4[_0x3f8c73(0x133)]>0x0&&!_0x28d973[_0x3f8c73(0x14b)]&&console[_0x3f8c73(0x192)]('\x20\x20'+a35_0x364cda[_0x3f8c73(0x138)]('\x20\x20'+_0x1fbcd4[_0x3f8c73(0x133)]+_0x3f8c73(0x163)));console[_0x3f8c73(0x192)]('\x20\x20'+a35_0x364cda[_0x3f8c73(0x138)]('=\x20'+_0x1d6d9b['length']+_0x3f8c73(0x100)));_0x72789f[_0x3f8c73(0x133)]>0x0&&(console[_0x3f8c73(0x192)](''),console[_0x3f8c73(0x192)](_0x3f8c73(0x105)),_0x57a9c7[_0x3f8c73(0x133)]>0x0&&console[_0x3f8c73(0x192)](_0x3f8c73(0x170)+a35_0x364cda['green']('+\x20'+_0x57a9c7['length']+_0x3f8c73(0x10d))),_0x45d37a['length']>0x0&&console[_0x3f8c73(0x192)](_0x3f8c73(0x170)+a35_0x364cda[_0x3f8c73(0x188)]('~\x20'+_0x45d37a['length']+_0x3f8c73(0x16a))),_0x50d70b[_0x3f8c73(0x133)]>0x0&&console[_0x3f8c73(0x192)]('\x20\x20\x20\x20'+a35_0x364cda[_0x3f8c73(0x18a)]('-\x20'+_0x50d70b[_0x3f8c73(0x133)]+_0x3f8c73(0x12b))));console[_0x3f8c73(0x192)](_0x3f8c73(0x119)+a35_0x364cda['cyan'](_0xbf0c2)+'\x0a');if(_0x511313[_0x3f8c73(0x133)]>0x0){console[_0x3f8c73(0x192)]('Folders\x20to\x20create:');for(const _0xa6fa31 of _0x511313){console['error']('\x20\x20'+a35_0x364cda['blue']('+')+'\x20'+_0xa6fa31);}console[_0x3f8c73(0x192)]('');}if(_0xb56e60[_0x3f8c73(0x133)]>0x0)for(const _0x43a88e of _0xb56e60){const _0x2b4387=_0x43a88e[_0x3f8c73(0x186)]?_0x43a88e[_0x3f8c73(0x186)]+'/'+_0x43a88e['yamlConfig'][_0x3f8c73(0x193)]:_0x43a88e[_0x3f8c73(0x10b)][_0x3f8c73(0x193)],_0x222d0d=_0x43a88e[_0x3f8c73(0x10b)][_0x3f8c73(0xff)]?.[_0x3f8c73(0x133)]||0x0,_0x59093b=_0x222d0d>0x0?a35_0x364cda[_0x3f8c73(0x138)]('\x20['+_0x222d0d+_0x3f8c73(0x13b)):'';console['error']('\x0a'+a35_0x364cda[_0x3f8c73(0x150)](_0x3f8c73(0x149))+'\x20'+_0x2b4387+_0x59093b),console[_0x3f8c73(0x192)]('─'[_0x3f8c73(0x13a)](0x3c)),_0x43a88e[_0x3f8c73(0x107)]&&console['error'](_0x43a88e[_0x3f8c73(0x107)]),console[_0x3f8c73(0x192)]('─'[_0x3f8c73(0x13a)](0x3c));}if(_0x515158['length']>0x0)for(const _0xe7c44e of _0x515158){const _0x5ed5d2=_0xe7c44e[_0x3f8c73(0x11f)]?_0x5c8af6[_0x3f8c73(0xfb)](_0xe7c44e[_0x3f8c73(0x11f)][_0x3f8c73(0x159)]())||'':'',_0x5542d2=_0x5ed5d2?_0x5ed5d2+'/'+_0xe7c44e[_0x3f8c73(0x193)]:_0xe7c44e[_0x3f8c73(0x193)],_0x2f423d=_0x2f2229[_0x3f8c73(0xfb)](_0xe7c44e['id'])||[],_0x1102af=_0x2f423d[_0x3f8c73(0x133)]>0x0?a35_0x364cda[_0x3f8c73(0x138)]('\x20['+_0x2f423d['length']+_0x3f8c73(0x13b)):'';console[_0x3f8c73(0x192)]('\x0a'+a35_0x364cda[_0x3f8c73(0x18a)](_0x3f8c73(0x16d))+'\x20'+_0x5542d2+_0x1102af),console[_0x3f8c73(0x192)]('─'[_0x3f8c73(0x13a)](0x3c));const _0x2d30f6=segmentWithActivationsToYaml(_0xe7c44e,_0x2f423d,undefined,_0xa6a6f7,_0x2de820),_0x4e44a5=segmentToYamlString(_0x2d30f6),_0x3a6686=generateDiff(_0x4e44a5,'');console['error'](formatDiffWithColors(_0x3a6686)),console[_0x3f8c73(0x192)]('─'[_0x3f8c73(0x13a)](0x3c));}const _0x1478c3=_0x393414[_0x3f8c73(0x15a)](_0x3c84b3=>!_0x3c84b3[_0x3f8c73(0x11b)]&&_0x3c84b3[_0x3f8c73(0x107)]);if(_0x1478c3[_0x3f8c73(0x133)]>0x0)for(const _0x4bae06 of _0x1478c3){const _0x370d32=_0x4bae06['folderPath']?_0x4bae06['folderPath']+'/'+_0x4bae06[_0x3f8c73(0x10b)][_0x3f8c73(0x193)]:_0x4bae06['yamlConfig'][_0x3f8c73(0x193)];console[_0x3f8c73(0x192)]('\x0a'+a35_0x364cda[_0x3f8c73(0x188)](_0x3f8c73(0x17a))+'\x20'+_0x370d32),console[_0x3f8c73(0x192)]('─'[_0x3f8c73(0x13a)](0x3c)),console[_0x3f8c73(0x192)](_0x4bae06['diff']),console[_0x3f8c73(0x192)]('─'[_0x3f8c73(0x13a)](0x3c));}if(_0x28d973[_0x3f8c73(0x184)])return console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x188)](_0x3f8c73(0x131))),0x0;const _0x420ded=_0xb56e60[_0x3f8c73(0x133)]>0x0||_0x447915['length']>0x0||_0x515158[_0x3f8c73(0x133)]>0x0,_0x2e77d5=_0x72789f[_0x3f8c73(0x133)]>0x0,_0x253802=_0x511313[_0x3f8c73(0x133)]>0x0;if(!_0x420ded&&!_0x2e77d5&&!_0x253802)return console['error'](a35_0x364cda[_0x3f8c73(0x150)](_0x3f8c73(0x182))),0x0;const _0x5874e9=_0xb56e60[_0x3f8c73(0x133)]+_0x447915[_0x3f8c73(0x133)]+_0x515158[_0x3f8c73(0x133)]+_0x511313[_0x3f8c73(0x133)]+_0x72789f[_0x3f8c73(0x133)];if(!_0x28d973[_0x3f8c73(0x11d)]&&_0x5874e9>0x0){const _0x4174e9=await confirmKey(_0x3f8c73(0x109)+_0x5874e9+_0x3f8c73(0x129));if(!_0x4174e9)return console['error'](_0x3f8c73(0x127)),0x1;}for(const _0x1dfd0f of _0x511313){const _0x39aa00=_0x1dfd0f['split']('/'),_0x3c7706=_0x39aa00[_0x39aa00['length']-0x1],_0x5ad64c=_0x39aa00[_0x3f8c73(0x172)](0x0,-0x1)[_0x3f8c73(0xfc)]('/'),_0x448b98=_0x67cfcc['get'](_0x5ad64c),_0x16be9a={'name':_0x3c7706,'parentFolderId':_0x448b98},_0x254d8b=await withSpinner('Creating\x20folder\x20\x27'+_0x1dfd0f+_0x3f8c73(0x124),()=>_0x27b90e[_0x3f8c73(0x12c)][_0x3f8c73(0x154)](_0x3c6ae5,_0x16be9a),{'verbose':_0x28d973[_0x3f8c73(0x103)]});_0x67cfcc['set'](_0x1dfd0f,_0x254d8b[_0x3f8c73(0x17d)]['id']),console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x173)](_0x3f8c73(0x18c)+_0x1dfd0f+'\x27'));}let _0xcaa921=0x0,_0x251b83=0x0,_0x476c58=0x0,_0x16732f=0x0,_0x218851=0x0,_0x265887=0x0;const _0x58c862=new Map();for(const _0x415377 of _0x393414){const _0x4ea223=_0x415377[_0x3f8c73(0x186)]?_0x67cfcc[_0x3f8c73(0xfb)](_0x415377[_0x3f8c73(0x186)]):undefined;let _0x25b4b7;try{if(_0x415377[_0x3f8c73(0x11b)]){const _0x36c323=yamlToCreateRequest(_0x415377[_0x3f8c73(0x10b)],_0x4ea223),_0x256bf5=await withSpinner(_0x3f8c73(0xfe)+_0x415377[_0x3f8c73(0x10b)][_0x3f8c73(0x193)]+_0x3f8c73(0x124),()=>_0x27b90e[_0x3f8c73(0x12c)][_0x3f8c73(0x174)](_0x3c6ae5,_0x36c323),{'verbose':_0x28d973[_0x3f8c73(0x103)]});_0x25b4b7=_0x256bf5[_0x3f8c73(0x17d)]['id'],_0x58c862['set'](_0x415377['yamlConfig']['name'],_0x25b4b7),console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x150)](_0x3f8c73(0x126)+_0x415377[_0x3f8c73(0x10b)][_0x3f8c73(0x193)]+'\x27')),_0xcaa921++;}else{if(_0x415377[_0x3f8c73(0x135)]){const _0x2d40dd=yamlToUpdateRequest(_0x415377[_0x3f8c73(0x10b)]);_0x4ea223!==_0x415377[_0x3f8c73(0x169)]?.[_0x3f8c73(0x11f)]&&(_0x2d40dd['segmentFolderId']=_0x4ea223?parseInt(_0x4ea223,0xa):undefined),await withSpinner(_0x3f8c73(0x164)+_0x415377[_0x3f8c73(0x10b)][_0x3f8c73(0x193)]+_0x3f8c73(0x124),()=>_0x27b90e[_0x3f8c73(0x12c)]['updateSegmentById'](_0x3c6ae5,_0x415377[_0x3f8c73(0x169)]['id'],_0x2d40dd),{'verbose':_0x28d973[_0x3f8c73(0x103)]}),_0x25b4b7=_0x415377[_0x3f8c73(0x169)]['id'],console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x188)](_0x3f8c73(0x167)+_0x415377[_0x3f8c73(0x10b)][_0x3f8c73(0x193)]+'\x27')),_0x251b83++;}else _0x25b4b7=_0x415377[_0x3f8c73(0x169)]['id'];}}catch(_0x5e0a05){const _0x5df498=isHttp400Error(_0x5e0a05),_0x40a2e0=_0x5df498?ErrorCode[_0x3f8c73(0x194)]:ErrorCode[_0x3f8c73(0x101)],_0x5cd543=getErrorMessage(_0x5e0a05);throw new SDKError(_0x40a2e0,_0x3f8c73(0x11a)+(_0x415377['isNew']?_0x3f8c73(0x151):_0x3f8c73(0x160))+_0x3f8c73(0x16f)+_0x415377[_0x3f8c73(0x158)]+_0x3f8c73(0xfd)+_0x5cd543,_0x5e0a05);}for(const _0x3404a9 of _0x415377['activationActions']){try{if(_0x3404a9[_0x3f8c73(0x10e)]===_0x3f8c73(0x151)&&_0x3404a9[_0x3f8c73(0x191)]){const _0x43a788=yamlActivationToCreateRequest(_0x3404a9[_0x3f8c73(0x191)],_0x534057,_0x4aba62);await withSpinner(_0x3f8c73(0x18b)+_0x3404a9[_0x3f8c73(0x193)]+_0x3f8c73(0x124),()=>_0x27b90e[_0x3f8c73(0x12c)][_0x3f8c73(0x139)](_0x3c6ae5,_0x25b4b7,_0x43a788),{'verbose':_0x28d973[_0x3f8c73(0x103)]}),console[_0x3f8c73(0x192)](a35_0x364cda['green'](_0x3f8c73(0x187)+_0x3404a9[_0x3f8c73(0x193)]+'\x27')),_0x16732f++;}else{if(_0x3404a9['type']===_0x3f8c73(0x160)&&_0x3404a9[_0x3f8c73(0x191)]&&_0x3404a9[_0x3f8c73(0x13d)]){const _0x1c89ed=yamlActivationToUpdateRequest(_0x3404a9[_0x3f8c73(0x191)],_0x534057,_0x4aba62);await withSpinner(_0x3f8c73(0x112)+_0x3404a9[_0x3f8c73(0x193)]+_0x3f8c73(0x124),()=>_0x27b90e[_0x3f8c73(0x12c)][_0x3f8c73(0x152)](_0x3c6ae5,_0x25b4b7,_0x3404a9[_0x3f8c73(0x13d)]['id'],_0x1c89ed),{'verbose':_0x28d973['verbose']}),console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x188)](_0x3f8c73(0x171)+_0x3404a9[_0x3f8c73(0x193)]+'\x27')),_0x218851++;}else _0x3404a9[_0x3f8c73(0x10e)]===_0x3f8c73(0x14b)&&_0x3404a9[_0x3f8c73(0x13d)]&&(await withSpinner('Deleting\x20activation\x20\x27'+_0x3404a9[_0x3f8c73(0x193)]+_0x3f8c73(0x124),()=>_0x27b90e[_0x3f8c73(0x12c)][_0x3f8c73(0x108)](_0x3c6ae5,_0x25b4b7,_0x3404a9['existingActivation']['id']),{'verbose':_0x28d973[_0x3f8c73(0x103)]}),console['error'](a35_0x364cda[_0x3f8c73(0x18a)](_0x3f8c73(0x161)+_0x3404a9['name']+'\x27')),_0x265887++);}}catch(_0x3475ff){const _0x2e67d7=isHttp400Error(_0x3475ff),_0x3a28a3=_0x2e67d7?ErrorCode[_0x3f8c73(0x11e)]:ErrorCode[_0x3f8c73(0x117)],_0x4cdfb1=getErrorMessage(_0x3475ff);throw new SDKError(_0x3a28a3,_0x3f8c73(0x11a)+_0x3404a9[_0x3f8c73(0x10e)]+_0x3f8c73(0x120)+_0x3404a9['name']+_0x3f8c73(0x177)+_0x415377['absolutePath']+'\x0a\x20\x20'+_0x4cdfb1,_0x3475ff);}}}for(const _0x4a63e1 of _0x515158){await withSpinner('Deleting\x20segment\x20\x27'+_0x4a63e1[_0x3f8c73(0x193)]+'\x27...',()=>_0x27b90e[_0x3f8c73(0x12c)][_0x3f8c73(0x156)](_0x4a63e1['id']),{'verbose':_0x28d973['verbose']}),console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x18a)](_0x3f8c73(0x136)+_0x4a63e1['name']+'\x27')),_0x476c58++;}const _0x1509bd=[];if(_0xcaa921>0x0)_0x1509bd[_0x3f8c73(0x179)](_0xcaa921+_0x3f8c73(0x18e));if(_0x251b83>0x0)_0x1509bd['push'](_0x251b83+_0x3f8c73(0x12d));if(_0x476c58>0x0)_0x1509bd['push'](_0x476c58+_0x3f8c73(0x18f));const _0xff22f4=[];if(_0x16732f>0x0)_0xff22f4[_0x3f8c73(0x179)](_0x16732f+_0x3f8c73(0x18e));if(_0x218851>0x0)_0xff22f4['push'](_0x218851+_0x3f8c73(0x12d));if(_0x265887>0x0)_0xff22f4[_0x3f8c73(0x179)](_0x265887+_0x3f8c73(0x18f));return console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x150)](_0x3f8c73(0x13c))),_0x1509bd[_0x3f8c73(0x133)]>0x0&&console[_0x3f8c73(0x192)](_0x3f8c73(0x125)+_0x1509bd['join'](',\x20')),_0xff22f4[_0x3f8c73(0x133)]>0x0&&console['error']('\x20\x20Activations:\x20'+_0xff22f4[_0x3f8c73(0xfc)](',\x20')),0x0;}}function buildFolderPathToIdMap(_0xc65c7b){const _0x13644=a35_0x5802ad,_0x4adc5b=new Map(),_0x5eef85=new Map();for(const _0x1defd0 of _0xc65c7b){_0x5eef85[_0x13644(0x122)](_0x1defd0['id'],_0x1defd0);}const _0x5e5272=new Set();for(const _0x3347ed of _0xc65c7b){!_0x3347ed['parentFolderId']&&_0x5e5272[_0x13644(0x153)](_0x3347ed['id']);}function _0xf7dbb(_0x2fa93f){const _0x5351a6=_0x13644;if(_0x5e5272[_0x5351a6(0x12f)](_0x2fa93f['id']))return'';if(_0x2fa93f[_0x5351a6(0x145)]){const _0xe2d44b=_0x5eef85[_0x5351a6(0xfb)](_0x2fa93f[_0x5351a6(0x145)]);if(_0xe2d44b){const _0x218812=_0xf7dbb(_0xe2d44b);return _0x218812?_0x218812+'/'+_0x2fa93f[_0x5351a6(0x193)]:_0x2fa93f[_0x5351a6(0x193)];}}return _0x2fa93f['name'];}for(const _0x339025 of _0xc65c7b){const _0x356d79=_0xf7dbb(_0x339025);_0x4adc5b['set'](_0x356d79,_0x339025['id']);}return _0x4adc5b;}function findYamlFiles(_0x1bbb7c){const _0x59ff4f=[];function _0x2cccfa(_0x555034){const _0x173fdb=a35_0x4bc8,_0xbde1cc=readdirSync(_0x555034,{'withFileTypes':!![]});for(const _0x14d5bc of _0xbde1cc){const _0x5ea856=a35_0x33e977[_0x173fdb(0xfc)](_0x555034,_0x14d5bc['name']);if(_0x14d5bc[_0x173fdb(0x17f)]())_0x2cccfa(_0x5ea856);else(_0x14d5bc['name'][_0x173fdb(0x118)](_0x173fdb(0x165))||_0x14d5bc[_0x173fdb(0x193)][_0x173fdb(0x118)](_0x173fdb(0x15d)))&&_0x59ff4f[_0x173fdb(0x179)](_0x5ea856);}}return _0x2cccfa(_0x1bbb7c),_0x59ff4f;}function calculateActivationActions(_0x1f4879,_0x2c53f7,_0x5f3290,_0x43b96b){const _0x5771f6=a35_0x5802ad,_0x3fd62e=[],_0x529be9=new Map();for(const _0xcbb150 of _0x2c53f7){_0x529be9[_0x5771f6(0x122)](_0xcbb150[_0x5771f6(0x193)],_0xcbb150);}const _0x3eb293=new Map();for(const _0x4c5888 of _0x1f4879){_0x3eb293[_0x5771f6(0x122)](_0x4c5888[_0x5771f6(0x193)],_0x4c5888);}for(const _0x52304d of _0x1f4879){const _0x24dacb=_0x529be9[_0x5771f6(0xfb)](_0x52304d['name']);if(!_0x24dacb)_0x3fd62e[_0x5771f6(0x179)]({'type':_0x5771f6(0x151),'name':_0x52304d[_0x5771f6(0x193)],'yamlActivation':_0x52304d});else{const _0x44c978=activationToYaml(_0x24dacb,_0x5f3290,_0x43b96b),_0x521dfe=a35_0x2c555e[_0x5771f6(0x12e)](_0x44c978),_0x72996=a35_0x2c555e[_0x5771f6(0x12e)](_0x52304d);_0x521dfe!==_0x72996&&_0x3fd62e[_0x5771f6(0x179)]({'type':_0x5771f6(0x160),'name':_0x52304d[_0x5771f6(0x193)],'yamlActivation':_0x52304d,'existingActivation':_0x24dacb});}}for(const _0x25153b of _0x2c53f7){!_0x3eb293[_0x5771f6(0x12f)](_0x25153b[_0x5771f6(0x193)])&&_0x3fd62e[_0x5771f6(0x179)]({'type':_0x5771f6(0x14b),'name':_0x25153b['name'],'existingActivation':_0x25153b});}return _0x3fd62e;}
@@ -1 +1 @@
1
- const a36_0x441a53=a36_0x52c2;(function(_0x3f11ce,_0x74c5a5){const _0x34355e=a36_0x52c2,_0x19f4d0=_0x3f11ce();while(!![]){try{const _0x31b6d=-parseInt(_0x34355e(0x1c6))/0x1*(-parseInt(_0x34355e(0x1df))/0x2)+-parseInt(_0x34355e(0x1c7))/0x3+-parseInt(_0x34355e(0x1b8))/0x4+-parseInt(_0x34355e(0x1c1))/0x5*(parseInt(_0x34355e(0x1d1))/0x6)+-parseInt(_0x34355e(0x1b4))/0x7+parseInt(_0x34355e(0x1d5))/0x8*(-parseInt(_0x34355e(0x1e0))/0x9)+-parseInt(_0x34355e(0x1b0))/0xa*(-parseInt(_0x34355e(0x1bc))/0xb);if(_0x31b6d===_0x74c5a5)break;else _0x19f4d0['push'](_0x19f4d0['shift']());}catch(_0x6efb42){_0x19f4d0['push'](_0x19f4d0['shift']());}}}(a36_0xdbc4,0xcc473));function a36_0x52c2(_0x1e4b84,_0x6be90f){_0x1e4b84=_0x1e4b84-0x1ae;const _0xdbc4b0=a36_0xdbc4();let _0x52c21a=_0xdbc4b0[_0x1e4b84];return _0x52c21a;}function a36_0xdbc4(){const _0x29d352=['2960048tTgzsf','resolveFolderId','ruleFile','name','22995555FHSjtm','segmentId','updateSegmentById','description','Resolving\x20folder\x20\x27','33590goYdfO','resolvePathToResource','Parent\x20ID:\x20','Segment\x20ID:\x20','Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]','150881evACdG','2158785FeiuAh','includes','Segment\x20ID\x20missing\x20from\x20resolved\x20path','segment:update','error','data','kind','parentId','verbose','segmentName','1050YTIfyA','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','✔\x20Updated\x20segment\x20\x27','rule','8JMTaZo','yellow','\x27...','segmentPath','Resolved\x20folder\x20ID:\x20','\x20\x20\x20Path:\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','Resolved\x20relative\x20path\x20to:\x20','Examples:','22qcmnai','8922033RoelZP','length','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','20PmvVqL','⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.','Error:\x20Cannot\x20update\x20','type','9641688SlIKfp','folder','Update\x20existing\x20child\x20segment','segment'];a36_0xdbc4=function(){return _0x29d352;};return a36_0xdbc4();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{SDKError,ErrorCode}from'../sdk/index.js';import a36_0x507b38 from'chalk';export class SegmentUpdateCommand extends BaseCommand{[a36_0x441a53(0x1bb)]=a36_0x441a53(0x1ca);[a36_0x441a53(0x1bf)]=a36_0x441a53(0x1b6);async['execute'](_0x21bc44){const _0x5763e1=a36_0x441a53;console[_0x5763e1(0x1cb)](a36_0x507b38[_0x5763e1(0x1d6)](_0x5763e1(0x1b1))),console['error'](a36_0x507b38['yellow'](_0x5763e1(0x1db)));const {options:_0x103a6c,args:_0x58fd7c,tdx:_0x40e836}=_0x21bc44,_0x4c5f9f=_0x103a6c;if(_0x58fd7c[_0x5763e1(0x1ae)]===0x0)return console[_0x5763e1(0x1cb)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console['error'](_0x5763e1(0x1d2)),console[_0x5763e1(0x1cb)](_0x5763e1(0x1de)),console[_0x5763e1(0x1cb)](_0x5763e1(0x1dc)),console[_0x5763e1(0x1cb)]('\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x3b6a96=_0x58fd7c[0x0],_0x3a891c=_0x103a6c[_0x5763e1(0x1d8)];let _0xfa7e79=_0x3b6a96;_0x3a891c&&!_0x3b6a96[_0x5763e1(0x1c8)]('/')&&(_0xfa7e79=_0x3a891c+'/'+_0x3b6a96,_0x4c5f9f[_0x5763e1(0x1cf)]&&console[_0x5763e1(0x1cb)](_0x5763e1(0x1dd)+_0xfa7e79));const _0x2df06f=await withSpinner('Resolving\x20path\x20\x27'+_0xfa7e79+_0x5763e1(0x1d7),()=>_0x40e836[_0x5763e1(0x1b7)][_0x5763e1(0x1c2)](_0xfa7e79),{'verbose':_0x4c5f9f[_0x5763e1(0x1cf)]}),_0x4b30dc=_0x2df06f[_0x5763e1(0x1cc)];_0x4c5f9f['verbose']&&console[_0x5763e1(0x1cb)]('Resolved\x20type:\x20'+_0x4b30dc['type']);if(_0x4b30dc[_0x5763e1(0x1b3)]!==_0x5763e1(0x1b7))return console['error'](_0x5763e1(0x1b2)+_0x4b30dc[_0x5763e1(0x1b3)]+_0x5763e1(0x1af)),console[_0x5763e1(0x1cb)](_0x5763e1(0x1c5)),0x1;if(!_0x4b30dc[_0x5763e1(0x1bd)])throw new SDKError(ErrorCode['INTERNAL'],_0x5763e1(0x1c9));const _0x3c9a86=_0x4b30dc[_0x5763e1(0x1ce)],_0xa83ef3=_0x4b30dc['segmentId'];_0x4c5f9f['verbose']&&(console[_0x5763e1(0x1cb)](_0x5763e1(0x1c3)+_0x3c9a86),console[_0x5763e1(0x1cb)](_0x5763e1(0x1c4)+_0xa83ef3));let _0x2bfda2;if(_0x4c5f9f[_0x5763e1(0x1b5)]){const _0x2f8121=_0x4c5f9f[_0x5763e1(0x1b5)],_0x598c07=await withSpinner(_0x5763e1(0x1c0)+_0x2f8121+_0x5763e1(0x1d7),()=>_0x40e836[_0x5763e1(0x1b7)][_0x5763e1(0x1b9)](_0x3c9a86,_0x2f8121),{'verbose':_0x4c5f9f[_0x5763e1(0x1cf)]});_0x2bfda2=parseInt(_0x598c07[_0x5763e1(0x1cc)],0xa),_0x4c5f9f[_0x5763e1(0x1cf)]&&console[_0x5763e1(0x1cb)](_0x5763e1(0x1d9)+_0x2bfda2);}const _0x2aa0c7=await loadJSONFromOptions(_0x4c5f9f[_0x5763e1(0x1d4)],_0x4c5f9f[_0x5763e1(0x1ba)]),_0x1c5c11={'name':_0x4c5f9f['name'],'description':_0x4c5f9f[_0x5763e1(0x1bf)],'rule':_0x2aa0c7,'kind':_0x4c5f9f['kind']!==undefined?parseInt(_0x4c5f9f[_0x5763e1(0x1cd)],0xa):undefined,'segmentFolderId':_0x2bfda2},_0x2d3ffa=await withSpinner('Updating\x20segment\x20\x27'+_0x4b30dc[_0x5763e1(0x1d0)]+'\x27...',()=>_0x40e836['segment'][_0x5763e1(0x1be)](_0x3c9a86,_0xa83ef3,_0x1c5c11),{'verbose':_0x4c5f9f[_0x5763e1(0x1cf)]}),_0x10a491=_0x2d3ffa[_0x5763e1(0x1cc)];return console[_0x5763e1(0x1cb)](_0x5763e1(0x1d3)+_0x10a491[_0x5763e1(0x1bb)]+'\x27'),_0xfa7e79!==_0x3b6a96&&console[_0x5763e1(0x1cb)](_0x5763e1(0x1da)+_0xfa7e79),await handleSDKOutput([_0x10a491],_0x4c5f9f),0x0;}}
1
+ function a36_0x2189(_0x3b6a03,_0x2b53f3){_0x3b6a03=_0x3b6a03-0x1e5;const _0x44929f=a36_0x4492();let _0x2189b1=_0x44929f[_0x3b6a03];return _0x2189b1;}const a36_0x392998=a36_0x2189;(function(_0x21c30e,_0x9a1f03){const _0x5522d8=a36_0x2189,_0x3ed670=_0x21c30e();while(!![]){try{const _0x581bf0=parseInt(_0x5522d8(0x217))/0x1*(-parseInt(_0x5522d8(0x1fa))/0x2)+-parseInt(_0x5522d8(0x1f0))/0x3*(parseInt(_0x5522d8(0x207))/0x4)+-parseInt(_0x5522d8(0x204))/0x5+parseInt(_0x5522d8(0x20e))/0x6+parseInt(_0x5522d8(0x210))/0x7+parseInt(_0x5522d8(0x206))/0x8+-parseInt(_0x5522d8(0x216))/0x9;if(_0x581bf0===_0x9a1f03)break;else _0x3ed670['push'](_0x3ed670['shift']());}catch(_0x541bd8){_0x3ed670['push'](_0x3ed670['shift']());}}}(a36_0x4492,0x269ec));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';function a36_0x4492(){const _0x2b1506=['INTERNAL','kind','segmentId','length','updateSegmentById','46443FwIJyy','parentId','resolvePathToResource','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','segment','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','name','segmentPath','Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]','execute','2YNGjol','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','Resolved\x20relative\x20path\x20to:\x20','✔\x20Updated\x20segment\x20\x27','Resolved\x20folder\x20ID:\x20','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','verbose','Resolving\x20folder\x20\x27','type','Updating\x20segment\x20\x27','3755fLvyqc','Segment\x20ID:\x20','306456NicZMY','12GrBtal','ruleFile','resolveFolderId','folder','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Parent\x20ID:\x20','Error:\x20Cannot\x20update\x20','1750050Gurhed','yellow','1674029JFLSok','data','includes','segment:update','Examples:','rule','2839005sduneY','48302KkTPKO','description','\x20\x20\x20Path:\x20','segmentName','⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.','Resolved\x20type:\x20','error','\x27...','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Update\x20existing\x20child\x20segment'];a36_0x4492=function(){return _0x2b1506;};return a36_0x4492();}import{SDKError,ErrorCode}from'../sdk/index.js';import a36_0x1eeba6 from'chalk';export class SegmentUpdateCommand extends BaseCommand{['name']=a36_0x392998(0x213);[a36_0x392998(0x218)]=a36_0x392998(0x1ea);async[a36_0x392998(0x1f9)](_0x22d3f1){const _0x13ac87=a36_0x392998;console['error'](a36_0x1eeba6[_0x13ac87(0x20f)](_0x13ac87(0x1e5))),console['error'](a36_0x1eeba6[_0x13ac87(0x20f)](_0x13ac87(0x20b)));const {options:_0x3b409a,args:_0x819e15,tdx:_0xe25bc4}=_0x22d3f1,_0x267ae4=_0x3b409a;if(_0x819e15[_0x13ac87(0x1ee)]===0x0)return console['error'](_0x13ac87(0x1ff)),console['error'](_0x13ac87(0x1f3)),console[_0x13ac87(0x1e7)](_0x13ac87(0x214)),console[_0x13ac87(0x1e7)](_0x13ac87(0x1fb)),console['error'](_0x13ac87(0x1f5)),0x1;const _0x2cc981=_0x819e15[0x0],_0x5260e7=_0x3b409a[_0x13ac87(0x1f7)];let _0x2ecfa3=_0x2cc981;_0x5260e7&&!_0x2cc981[_0x13ac87(0x212)]('/')&&(_0x2ecfa3=_0x5260e7+'/'+_0x2cc981,_0x267ae4[_0x13ac87(0x200)]&&console[_0x13ac87(0x1e7)](_0x13ac87(0x1fc)+_0x2ecfa3));const _0x1f4bc4=await withSpinner('Resolving\x20path\x20\x27'+_0x2ecfa3+'\x27...',()=>_0xe25bc4[_0x13ac87(0x1f4)][_0x13ac87(0x1f2)](_0x2ecfa3),{'verbose':_0x267ae4[_0x13ac87(0x200)]}),_0x1ce888=_0x1f4bc4[_0x13ac87(0x211)];_0x267ae4[_0x13ac87(0x200)]&&console['error'](_0x13ac87(0x1e6)+_0x1ce888[_0x13ac87(0x202)]);if(_0x1ce888[_0x13ac87(0x202)]!==_0x13ac87(0x1f4))return console[_0x13ac87(0x1e7)](_0x13ac87(0x20d)+_0x1ce888[_0x13ac87(0x202)]+'.\x20Only\x20child\x20segments\x20can\x20be\x20updated.'),console[_0x13ac87(0x1e7)](_0x13ac87(0x1f8)),0x1;if(!_0x1ce888[_0x13ac87(0x1ed)])throw new SDKError(ErrorCode[_0x13ac87(0x1eb)],_0x13ac87(0x1e9));const _0x1e9b61=_0x1ce888[_0x13ac87(0x1f1)],_0x259872=_0x1ce888['segmentId'];_0x267ae4[_0x13ac87(0x200)]&&(console['error'](_0x13ac87(0x20c)+_0x1e9b61),console[_0x13ac87(0x1e7)](_0x13ac87(0x205)+_0x259872));let _0x168223;if(_0x267ae4[_0x13ac87(0x20a)]){const _0x55359=_0x267ae4['folder'],_0x2d0058=await withSpinner(_0x13ac87(0x201)+_0x55359+_0x13ac87(0x1e8),()=>_0xe25bc4[_0x13ac87(0x1f4)][_0x13ac87(0x209)](_0x1e9b61,_0x55359),{'verbose':_0x267ae4['verbose']});_0x168223=parseInt(_0x2d0058[_0x13ac87(0x211)],0xa),_0x267ae4[_0x13ac87(0x200)]&&console[_0x13ac87(0x1e7)](_0x13ac87(0x1fe)+_0x168223);}const _0x33d264=await loadJSONFromOptions(_0x267ae4[_0x13ac87(0x215)],_0x267ae4[_0x13ac87(0x208)]),_0x38a7c7={'name':_0x267ae4[_0x13ac87(0x1f6)],'description':_0x267ae4[_0x13ac87(0x218)],'rule':_0x33d264,'kind':_0x267ae4[_0x13ac87(0x1ec)]!==undefined?parseInt(_0x267ae4[_0x13ac87(0x1ec)],0xa):undefined,'segmentFolderId':_0x168223},_0x5b6457=await withSpinner(_0x13ac87(0x203)+_0x1ce888[_0x13ac87(0x21a)]+'\x27...',()=>_0xe25bc4['segment'][_0x13ac87(0x1ef)](_0x1e9b61,_0x259872,_0x38a7c7),{'verbose':_0x267ae4[_0x13ac87(0x200)]}),_0x24c348=_0x5b6457[_0x13ac87(0x211)];return console['error'](_0x13ac87(0x1fd)+_0x24c348['name']+'\x27'),_0x2ecfa3!==_0x2cc981&&console[_0x13ac87(0x1e7)](_0x13ac87(0x219)+_0x2ecfa3),await handleSDKOutput([_0x24c348],_0x267ae4),0x0;}}
@@ -1 +1 @@
1
- const a37_0x1ce3bb=a37_0x205b;(function(_0x5731ec,_0x15bb71){const _0x550279=a37_0x205b,_0x5ed09e=_0x5731ec();while(!![]){try{const _0x462964=parseInt(_0x550279(0xc3))/0x1+-parseInt(_0x550279(0xed))/0x2+parseInt(_0x550279(0xe6))/0x3*(-parseInt(_0x550279(0xbc))/0x4)+parseInt(_0x550279(0xc9))/0x5*(-parseInt(_0x550279(0xbe))/0x6)+-parseInt(_0x550279(0xd8))/0x7+-parseInt(_0x550279(0xd6))/0x8*(-parseInt(_0x550279(0xec))/0x9)+parseInt(_0x550279(0xea))/0xa;if(_0x462964===_0x15bb71)break;else _0x5ed09e['push'](_0x5ed09e['shift']());}catch(_0x41b337){_0x5ed09e['push'](_0x5ed09e['shift']());}}}(a37_0x1429,0x357cb));import{existsSync,statSync}from'fs';import a37_0x2244bf from'chalk';import{BaseCommand}from'./command.js';import{saveSessionContext}from'../core/session.js';import{withSpinner}from'../utils/spinner.js';import{parsePath,normalizePath}from'../utils/segment-path-parser.js';import{findTdxConfig}from'../utils/tdx-config.js';function a37_0x205b(_0x5a7d57,_0x20e3d4){_0x5a7d57=_0x5a7d57-0xba;const _0x14294d=a37_0x1429();let _0x205bd0=_0x14294d[_0x5a7d57];return _0x205bd0;}export class SegmentUseCommand extends BaseCommand{[a37_0x1ce3bb(0xdc)]=a37_0x1ce3bb(0xc1);['description']=a37_0x1ce3bb(0xe0);async['execute'](_0x55788b){const _0x775fdb=a37_0x1ce3bb,{options:_0x5bbe49,args:_0x5c95bb,tdx:_0x9a9ca0}=_0x55788b;if(_0x5c95bb[_0x775fdb(0xee)]===0x0)return console[_0x775fdb(0xc2)](a37_0x2244bf[_0x775fdb(0xd9)]('Error:\x20Path\x20is\x20required\x0a')),console['error'](_0x775fdb(0xc0)),console[_0x775fdb(0xc2)](_0x775fdb(0xcd)),console[_0x775fdb(0xc2)]('\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22'),console[_0x775fdb(0xc2)](_0x775fdb(0xcf)),console[_0x775fdb(0xc2)](_0x775fdb(0xbf)),console[_0x775fdb(0xc2)]('\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 _0x116159=_0x5c95bb[0x0],_0x5ca6ec=_0x5bbe49['session'];try{if(_0x116159==='/')return saveSessionContext({'segment_path':undefined},_0x5ca6ec),console['log'](a37_0x2244bf[_0x775fdb(0xe4)](_0x775fdb(0xd4))),0x0;if(existsSync(_0x116159)&&statSync(_0x116159)[_0x775fdb(0xd2)]()){let _0x1bc4c0;try{_0x1bc4c0=findTdxConfig(_0x116159);}catch{return console['error'](a37_0x2244bf[_0x775fdb(0xd9)]('Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20'+_0x116159)),console['error'](a37_0x2244bf['cyan'](_0x775fdb(0xcc))),0x1;}const _0x2864d4=_0x1bc4c0['config'][_0x775fdb(0xd7)];return saveSessionContext({'segment_path':_0x2864d4,'parent_segment':_0x2864d4},_0x5ca6ec),console[_0x775fdb(0xbb)](a37_0x2244bf['green'](_0x775fdb(0xdf)+a37_0x2244bf[_0x775fdb(0xce)](_0x2864d4))),0x0;}const _0x3eaccb=_0x5bbe49[_0x775fdb(0xde)];let _0x2b524c=_0x116159;const _0x4f244a=parsePath(_0x116159);if(!_0x4f244a[_0x775fdb(0xf1)]){if(!_0x3eaccb)return console['error'](a37_0x2244bf[_0x775fdb(0xd9)]('Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.')),console[_0x775fdb(0xc2)](a37_0x2244bf['cyan']('Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>')),0x1;if(_0x116159==='..'){const _0x4fb6d9=_0x3eaccb['split']('/')['slice'](0x0,-0x1)['join']('/');_0x2b524c=_0x4fb6d9||'/';}else _0x116159==='.'?_0x2b524c=_0x3eaccb:_0x2b524c=_0x3eaccb+'/'+_0x116159;_0x5bbe49[_0x775fdb(0xc7)]&&console[_0x775fdb(0xc2)](_0x775fdb(0xc5)+_0x2b524c);}if(_0x2b524c==='/'||_0x2b524c==='')return saveSessionContext({'segment_path':undefined},_0x5ca6ec),console[_0x775fdb(0xbb)](a37_0x2244bf[_0x775fdb(0xe4)](_0x775fdb(0xd4))),0x0;_0x2b524c=normalizePath(_0x2b524c);const _0xdef4ca=parsePath(_0x2b524c)[_0x775fdb(0xef)];if(_0xdef4ca['length']===0x0)return saveSessionContext({'segment_path':undefined},_0x5ca6ec),console[_0x775fdb(0xbb)](a37_0x2244bf[_0x775fdb(0xe4)](_0x775fdb(0xd4))),0x0;_0x5bbe49['verbose']&&(console[_0x775fdb(0xc2)](_0x775fdb(0xe7)+_0x5bbe49['site']),console[_0x775fdb(0xc2)](_0x775fdb(0xbd)+_0x2b524c));const _0x3773bd=await withSpinner(_0x775fdb(0xe9)+_0x2b524c+_0x775fdb(0xe8),()=>_0x9a9ca0[_0x775fdb(0xca)][_0x775fdb(0xf0)](_0x2b524c),{'verbose':_0x5bbe49[_0x775fdb(0xc7)]}),_0x58f7dc=_0x3773bd[_0x775fdb(0xd5)];_0x5bbe49[_0x775fdb(0xc7)]&&(console[_0x775fdb(0xc2)](_0x775fdb(0xdb)+_0x58f7dc[_0x775fdb(0xcb)]),console[_0x775fdb(0xc2)](_0x775fdb(0xd0)+_0x58f7dc[_0x775fdb(0xdd)]),_0x58f7dc[_0x775fdb(0xd1)]&&console['error'](_0x775fdb(0xe1)+_0x58f7dc[_0x775fdb(0xd1)]));if(_0x58f7dc[_0x775fdb(0xcb)]===_0x775fdb(0xca))return console[_0x775fdb(0xc2)](a37_0x2244bf[_0x775fdb(0xd9)](_0x775fdb(0xc8))),console[_0x775fdb(0xc2)](_0x775fdb(0xc4)),console[_0x775fdb(0xc2)](a37_0x2244bf[_0x775fdb(0xce)](_0x775fdb(0xeb)+_0x58f7dc[_0x775fdb(0xe5)]+(_0x58f7dc[_0x775fdb(0xe2)]?'/'+_0x58f7dc[_0x775fdb(0xe2)][_0x775fdb(0xda)]('/'):''))),0x1;return saveSessionContext({'segment_path':_0x58f7dc[_0x775fdb(0xc6)],'parent_segment':_0x58f7dc[_0x775fdb(0xe5)]},_0x5ca6ec),console[_0x775fdb(0xbb)](a37_0x2244bf[_0x775fdb(0xe4)]('✔\x20Context\x20set\x20to:\x20'+a37_0x2244bf['cyan'](_0x58f7dc['fullPath']))),_0x5bbe49[_0x775fdb(0xc7)]&&(console[_0x775fdb(0xc2)](a37_0x2244bf[_0x775fdb(0xe3)](_0x775fdb(0xba))),console[_0x775fdb(0xc2)](a37_0x2244bf['dim'](_0x775fdb(0xd3)))),0x0;}catch(_0x4d8883){throw _0x4d8883;}}}function a37_0x1429(){const _0x1b7c40=['dim','green','parentName','3clOvPD','Site:\x20','\x27...','Resolving\x20path\x20\x27','1300600mdqvUY','Use:\x20tdx\x20segment\x20use\x20','9yIqByQ','53584fwwrhd','length','segments','resolvePathToResource','isAbsolute','Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context','log','40860iCaQET','Target\x20path:\x20','12ZHWLTb','\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context','Usage:\x20tdx\x20segment\x20use\x20<path>','segment:use','error','385219ITFEVw','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','Resolved\x20relative\x20path\x20to:\x20','fullPath','verbose','Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.','424650TrCngy','segment','type','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Examples:','cyan','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22','Parent\x20ID:\x20','folderId','isDirectory','Use\x20\x22tdx\x20context\x22\x20to\x20see\x20all\x20context\x20parameters','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','data','1325664JAEZzv','parent_segment','1785259ajjujQ','red','join','Resolved\x20path\x20type:\x20','name','parentId','segmentPath','✔\x20Context\x20set\x20to:\x20','Set\x20current\x20segment/folder\x20context\x20for\x20navigation','Folder\x20ID:\x20','folderPath'];a37_0x1429=function(){return _0x1b7c40;};return a37_0x1429();}
1
+ function a37_0x1795(_0x308334,_0x37004){_0x308334=_0x308334-0x16c;const _0x4195b3=a37_0x4195();let _0x17954a=_0x4195b3[_0x308334];return _0x17954a;}const a37_0x596eb8=a37_0x1795;(function(_0x4aebf3,_0x563068){const _0x59f287=a37_0x1795,_0x4be823=_0x4aebf3();while(!![]){try{const _0x53cec4=-parseInt(_0x59f287(0x172))/0x1+-parseInt(_0x59f287(0x178))/0x2*(parseInt(_0x59f287(0x19f))/0x3)+-parseInt(_0x59f287(0x16c))/0x4*(parseInt(_0x59f287(0x18c))/0x5)+-parseInt(_0x59f287(0x195))/0x6+-parseInt(_0x59f287(0x18d))/0x7*(parseInt(_0x59f287(0x1a4))/0x8)+parseInt(_0x59f287(0x17d))/0x9+parseInt(_0x59f287(0x1a6))/0xa;if(_0x53cec4===_0x563068)break;else _0x4be823['push'](_0x4be823['shift']());}catch(_0x3f5f42){_0x4be823['push'](_0x4be823['shift']());}}}(a37_0x4195,0xd936f));import{existsSync,statSync}from'fs';import a37_0xe7b623 from'chalk';function a37_0x4195(){const _0xd76ac9=['config','segmentPath','Resolving\x20path\x20\x27','cyan','270510uOTvmq','91qzfRwJ','site','isDirectory','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','Resolved\x20path\x20type:\x20','red','isAbsolute','Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.','5207562OMDNMw','type','Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22','\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context','log','green','length','session','execute','776184YOVpwZ','Use:\x20tdx\x20segment\x20use\x20','Parent\x20ID:\x20','parentName','description','704888FyWIus','Folder\x20ID:\x20','32814940iQQkAY','segment','✔\x20Context\x20set\x20to:\x20','segments','8cdlcMj','join','Set\x20current\x20segment/folder\x20context\x20for\x20navigation','\x27...','Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>','Usage:\x20tdx\x20segment\x20use\x20<path>','963370gBxjDp','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','Use\x20\x22tdx\x20context\x22\x20to\x20see\x20all\x20context\x20parameters','data','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','name','6eKbLuY','folderId','parentId','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','parent_segment','13224105TaDqBY','Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context','verbose','dim','error','slice','Target\x20path:\x20','Examples:','folderPath','\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent','split'];a37_0x4195=function(){return _0xd76ac9;};return a37_0x4195();}import{BaseCommand}from'./command.js';import{saveSessionContext}from'../core/session.js';import{withSpinner}from'../utils/spinner.js';import{parsePath,normalizePath}from'../utils/segment-path-parser.js';import{findTdxConfig}from'../utils/tdx-config.js';export class SegmentUseCommand extends BaseCommand{[a37_0x596eb8(0x177)]='segment:use';[a37_0x596eb8(0x1a3)]=a37_0x596eb8(0x16e);async[a37_0x596eb8(0x19e)](_0x44679e){const _0x34a05a=a37_0x596eb8,{options:_0x667821,args:_0x5a9378,tdx:_0x119356}=_0x44679e;if(_0x5a9378[_0x34a05a(0x19c)]===0x0)return console[_0x34a05a(0x181)](a37_0xe7b623['red']('Error:\x20Path\x20is\x20required\x0a')),console['error'](_0x34a05a(0x171)),console['error'](_0x34a05a(0x184)),console['error'](_0x34a05a(0x173)),console[_0x34a05a(0x181)](_0x34a05a(0x198)),console[_0x34a05a(0x181)](_0x34a05a(0x199)),console['error'](_0x34a05a(0x186)),0x1;const _0x327b7a=_0x5a9378[0x0],_0xc88988=_0x667821[_0x34a05a(0x19d)];try{if(_0x327b7a==='/')return saveSessionContext({'segment_path':undefined},_0xc88988),console[_0x34a05a(0x19a)](a37_0xe7b623[_0x34a05a(0x19b)](_0x34a05a(0x17b))),0x0;if(existsSync(_0x327b7a)&&statSync(_0x327b7a)[_0x34a05a(0x18f)]()){let _0x4b0cf4;try{_0x4b0cf4=findTdxConfig(_0x327b7a);}catch{return console[_0x34a05a(0x181)](a37_0xe7b623[_0x34a05a(0x192)](_0x34a05a(0x176)+_0x327b7a)),console['error'](a37_0xe7b623['cyan']('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;}const _0x38ed26=_0x4b0cf4[_0x34a05a(0x188)][_0x34a05a(0x17c)];return saveSessionContext({'segment_path':_0x38ed26,'parent_segment':_0x38ed26},_0xc88988),console[_0x34a05a(0x19a)](a37_0xe7b623['green'](_0x34a05a(0x1a8)+a37_0xe7b623[_0x34a05a(0x18b)](_0x38ed26))),0x0;}const _0x5cb6d0=_0x667821[_0x34a05a(0x189)];let _0x4a57a8=_0x327b7a;const _0x1f28bb=parsePath(_0x327b7a);if(!_0x1f28bb[_0x34a05a(0x193)]){if(!_0x5cb6d0)return console[_0x34a05a(0x181)](a37_0xe7b623[_0x34a05a(0x192)](_0x34a05a(0x194))),console['error'](a37_0xe7b623[_0x34a05a(0x18b)](_0x34a05a(0x170))),0x1;if(_0x327b7a==='..'){const _0x940c95=_0x5cb6d0[_0x34a05a(0x187)]('/')[_0x34a05a(0x182)](0x0,-0x1)[_0x34a05a(0x16d)]('/');_0x4a57a8=_0x940c95||'/';}else _0x327b7a==='.'?_0x4a57a8=_0x5cb6d0:_0x4a57a8=_0x5cb6d0+'/'+_0x327b7a;_0x667821[_0x34a05a(0x17f)]&&console[_0x34a05a(0x181)]('Resolved\x20relative\x20path\x20to:\x20'+_0x4a57a8);}if(_0x4a57a8==='/'||_0x4a57a8==='')return saveSessionContext({'segment_path':undefined},_0xc88988),console[_0x34a05a(0x19a)](a37_0xe7b623[_0x34a05a(0x19b)](_0x34a05a(0x17b))),0x0;_0x4a57a8=normalizePath(_0x4a57a8);const _0x5ec9cf=parsePath(_0x4a57a8)[_0x34a05a(0x1a9)];if(_0x5ec9cf[_0x34a05a(0x19c)]===0x0)return saveSessionContext({'segment_path':undefined},_0xc88988),console[_0x34a05a(0x19a)](a37_0xe7b623[_0x34a05a(0x19b)](_0x34a05a(0x17b))),0x0;_0x667821['verbose']&&(console[_0x34a05a(0x181)]('Site:\x20'+_0x667821[_0x34a05a(0x18e)]),console['error'](_0x34a05a(0x183)+_0x4a57a8));const _0x3da77b=await withSpinner(_0x34a05a(0x18a)+_0x4a57a8+_0x34a05a(0x16f),()=>_0x119356[_0x34a05a(0x1a7)]['resolvePathToResource'](_0x4a57a8),{'verbose':_0x667821[_0x34a05a(0x17f)]}),_0x287669=_0x3da77b[_0x34a05a(0x175)];_0x667821[_0x34a05a(0x17f)]&&(console[_0x34a05a(0x181)](_0x34a05a(0x191)+_0x287669[_0x34a05a(0x196)]),console['error'](_0x34a05a(0x1a1)+_0x287669[_0x34a05a(0x17a)]),_0x287669[_0x34a05a(0x179)]&&console[_0x34a05a(0x181)](_0x34a05a(0x1a5)+_0x287669[_0x34a05a(0x179)]));if(_0x287669[_0x34a05a(0x196)]==='segment')return console[_0x34a05a(0x181)](a37_0xe7b623['red'](_0x34a05a(0x197))),console[_0x34a05a(0x181)](_0x34a05a(0x190)),console[_0x34a05a(0x181)](a37_0xe7b623['cyan'](_0x34a05a(0x1a0)+_0x287669[_0x34a05a(0x1a2)]+(_0x287669['folderPath']?'/'+_0x287669[_0x34a05a(0x185)][_0x34a05a(0x16d)]('/'):''))),0x1;return saveSessionContext({'segment_path':_0x287669['fullPath'],'parent_segment':_0x287669[_0x34a05a(0x1a2)]},_0xc88988),console['log'](a37_0xe7b623[_0x34a05a(0x19b)](_0x34a05a(0x1a8)+a37_0xe7b623[_0x34a05a(0x18b)](_0x287669['fullPath']))),_0x667821[_0x34a05a(0x17f)]&&(console[_0x34a05a(0x181)](a37_0xe7b623[_0x34a05a(0x180)](_0x34a05a(0x17e))),console[_0x34a05a(0x181)](a37_0xe7b623[_0x34a05a(0x180)](_0x34a05a(0x174)))),0x0;}catch(_0x3884fe){throw _0x3884fe;}}}
@@ -1 +1 @@
1
- const a38_0x583df3=a38_0x442f;(function(_0x3b0ce7,_0x1a7c90){const _0x391483=a38_0x442f,_0x5dcf38=_0x3b0ce7();while(!![]){try{const _0x176000=parseInt(_0x391483(0x75))/0x1*(parseInt(_0x391483(0x72))/0x2)+-parseInt(_0x391483(0xaa))/0x3*(parseInt(_0x391483(0x8b))/0x4)+parseInt(_0x391483(0x84))/0x5+-parseInt(_0x391483(0x95))/0x6+parseInt(_0x391483(0xad))/0x7+-parseInt(_0x391483(0x92))/0x8*(-parseInt(_0x391483(0xab))/0x9)+-parseInt(_0x391483(0x7e))/0xa;if(_0x176000===_0x1a7c90)break;else _0x5dcf38['push'](_0x5dcf38['shift']());}catch(_0x253227){_0x5dcf38['push'](_0x5dcf38['shift']());}}}(a38_0x2ef5,0xa086e));import{BaseCommand}from'./command.js';function a38_0x442f(_0x52926d,_0x2c632d){_0x52926d=_0x52926d-0x72;const _0x2ef510=a38_0x2ef5();let _0x442f31=_0x2ef510[_0x52926d];return _0x442f31;}import{SDKError}from'../sdk/index.js';function a38_0x2ef5(){const _0x5beaf1=['length','listWithPattern','5079BpHJEu','261HOJBKs','Parent\x20ID:\x20','2412704NiQdmw','resolvePathToResource','filter','segments','listRecursive','Listing\x20folders\x20and\x20segments...','4BjJXbV','\x20segment','description','222381jOPhXQ','Site:\x20','execute','Parent\x20segment\x20context:\x20','error','\x5c$&','name','List\x20folders\x20and\x20child\x20segments','json','11437790bAhfuI','Error:\x20','listUnified','includes','web','localeCompare','3283535apPbXO','(not\x20set)','dim','map','/app/ps/','Recursive\x20mode:\x20enabled','✔\x20Built\x20tree\x20with\x20','652eNvfEp','\x27...','recursive','Use\x20tdx\x20ps\x20list\x20to\x20see\x20available\x20parent\x20segments.','test','cause','jsonl','323096QdYUsl','Folder/pattern\x20arg:\x20','Resolving\x20parent\x20segment\x20\x27','3240648dWyOuq','segment','\x20folder','folder','parentId','folderId','data','verbose','/e/','replace','format','\x20top-level\x20items','Folder\x20ID:\x20','\x20and\x20','log','site','No\x20items\x20match\x20pattern:\x20','Building\x20hierarchy\x20tree...','\x20\x20tdx\x20sg\x20pull\x20\x22My\x20Audience\x22'];a38_0x2ef5=function(){return _0x5beaf1;};return a38_0x2ef5();}import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{formatFlatList,formatTree}from'../utils/tree-formatter.js';import{getConsoleNextUrl}from'../types/endpoints.js';import a38_0x297dd9 from'chalk';export class SegmentsCommand extends BaseCommand{[a38_0x583df3(0x7b)]=a38_0x583df3(0xb0);[a38_0x583df3(0x74)]=a38_0x583df3(0x7c);async[a38_0x583df3(0x77)](_0x2cc124){const _0xbe2769=a38_0x583df3,{options:_0x277947,args:_0xda43b7}=_0x2cc124,_0x77ec62=_0x277947[_0xbe2769(0x8d)],_0x4a397a=_0xda43b7[0x0];try{const _0x19676f=_0x277947['parentSegment'];_0x277947[_0xbe2769(0x9c)]&&(console[_0xbe2769(0x79)](_0xbe2769(0x76)+_0x277947[_0xbe2769(0xa4)]),console['error'](_0xbe2769(0x78)+(_0x19676f||_0xbe2769(0x85))),_0x4a397a&&console['error'](_0xbe2769(0x93)+_0x4a397a),_0x77ec62&&console[_0xbe2769(0x79)](_0xbe2769(0x89)));if(!_0x19676f)return console[_0xbe2769(0x79)]('Error:\x20No\x20parent\x20segment\x20context\x20set.'),console[_0xbe2769(0x79)](''),console[_0xbe2769(0x79)]('Set\x20a\x20parent\x20segment\x20context\x20first:'),console['error'](_0xbe2769(0xa7)),console[_0xbe2769(0x79)]('\x20\x20tdx\x20sg\x20use\x20\x22My\x20Audience\x22'),console[_0xbe2769(0x79)](''),console[_0xbe2769(0x79)](_0xbe2769(0x8e)),0x1;const _0x3a6f6d=_0x4a397a&&(_0x4a397a[_0xbe2769(0x81)]('*')||_0x4a397a[_0xbe2769(0x81)]('?'));if(_0x3a6f6d)return await this[_0xbe2769(0xa9)](_0x2cc124,_0x19676f,_0x4a397a);const _0x13c81e=_0x4a397a?_0x19676f+'/'+_0x4a397a:_0x19676f;return _0x77ec62?await this['listRecursive'](_0x2cc124,_0x13c81e):await this['listUnified'](_0x2cc124,_0x13c81e);}catch(_0x3affba){if(_0x3affba instanceof SDKError)return console[_0xbe2769(0x79)](_0xbe2769(0x7f)+_0x3affba['message']),_0x3affba[_0xbe2769(0x90)]&&console['error']('\x20\x20Cause:\x20'+_0x3affba[_0xbe2769(0x90)]),0x1;throw _0x3affba;}}async[a38_0x583df3(0xa9)](_0x4ef5dd,_0x50143d,_0x13c304){const _0x1048b4=a38_0x583df3,{options:_0x5cdc2a,tdx:_0x35d0fd}=_0x4ef5dd,_0x387676=_0x5cdc2a['web'],_0x31e865=await withSpinner(_0x1048b4(0x94)+_0x50143d+_0x1048b4(0x8c),()=>_0x35d0fd[_0x1048b4(0x96)][_0x1048b4(0xae)](_0x50143d),{'verbose':_0x5cdc2a[_0x1048b4(0x9c)]}),_0x2f30ae=_0x31e865[_0x1048b4(0x9b)],_0x596c26=await withSpinner(_0x1048b4(0xb2),()=>_0x35d0fd[_0x1048b4(0x96)]['listUnified'](_0x2f30ae['parentId'],_0x2f30ae['folderId']),{'verbose':_0x5cdc2a[_0x1048b4(0x9c)]}),{folders:_0x1f2c2c,segments:_0x3963a1}=_0x596c26[_0x1048b4(0x9b)],_0x8d9843=_0x13c304[_0x1048b4(0x9e)](/[.+^${}()|[\]\\]/g,_0x1048b4(0x7a))[_0x1048b4(0x9e)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x222b3f=new RegExp('^'+_0x8d9843+'$','i'),_0x23ecd0=_0x1f2c2c[_0x1048b4(0xaf)](_0x36b29a=>_0x222b3f[_0x1048b4(0x8f)](_0x36b29a[_0x1048b4(0x7b)])),_0x303b55=_0x3963a1[_0x1048b4(0xaf)](_0x18daea=>_0x222b3f[_0x1048b4(0x8f)](_0x18daea['name'])),_0x3b24e4=_0x23ecd0[_0x1048b4(0xa8)]+_0x303b55[_0x1048b4(0xa8)];console['error']('✔\x20Found\x20'+_0x23ecd0[_0x1048b4(0xa8)]+'\x20folder'+(_0x23ecd0[_0x1048b4(0xa8)]!==0x1?'s':'')+_0x1048b4(0xa2)+_0x303b55[_0x1048b4(0xa8)]+_0x1048b4(0x73)+(_0x303b55[_0x1048b4(0xa8)]!==0x1?'s':'')+'\x20matching\x20\x27'+_0x13c304+'\x27');const _0x12777d=_0x16c7db=>{const _0x106e43=_0x1048b4;return getConsoleNextUrl(_0x5cdc2a[_0x106e43(0xa4)],_0x106e43(0x88)+_0x2f30ae['parentId']+_0x106e43(0x9d)+_0x16c7db);},_0x97009a=_0x5cdc2a[_0x1048b4(0x9f)]===_0x1048b4(0x7d)||_0x5cdc2a[_0x1048b4(0x9f)]==='jsonl';if(_0x97009a){const _0x100433=[..._0x23ecd0['map'](_0x34d0e2=>({..._0x34d0e2,'type':_0x1048b4(0x98)})),..._0x303b55[_0x1048b4(0x87)](_0x54e20e=>({..._0x54e20e,'type':_0x1048b4(0x96),'url':_0x12777d(_0x54e20e['id'])}))]['sort']((_0x4c2ef2,_0x28582f)=>_0x4c2ef2['name'][_0x1048b4(0x83)](_0x28582f[_0x1048b4(0x7b)]));await handleSDKOutput(_0x100433,_0x5cdc2a);}else{if(_0x3b24e4===0x0)console[_0x1048b4(0xa3)](_0x1048b4(0xa5)+_0x13c304);else{console[_0x1048b4(0xa3)](a38_0x297dd9[_0x1048b4(0x86)]('['+_0x50143d+']\x20matching\x20\x27'+_0x13c304+'\x27'));const _0x4decbe=formatFlatList(_0x23ecd0,_0x303b55,{'showMetadata':!![],'showUrl':_0x387676,'getSegmentUrl':_0x12777d});console[_0x1048b4(0xa3)](_0x4decbe);}}return 0x0;}async[a38_0x583df3(0x80)](_0x195e1b,_0x48148e){const _0x28f30e=a38_0x583df3,{options:_0x347774,tdx:_0x32b576}=_0x195e1b,_0x5db443=_0x347774[_0x28f30e(0x82)],_0x50b1ab=await withSpinner('Resolving\x20path\x20\x27'+_0x48148e+_0x28f30e(0x8c),()=>_0x32b576['segment'][_0x28f30e(0xae)](_0x48148e),{'verbose':_0x347774[_0x28f30e(0x9c)]}),_0x141758=_0x50b1ab[_0x28f30e(0x9b)];_0x347774[_0x28f30e(0x9c)]&&(console[_0x28f30e(0x79)](_0x28f30e(0xac)+_0x141758[_0x28f30e(0x99)]),_0x141758[_0x28f30e(0x9a)]&&console['error'](_0x28f30e(0xa1)+_0x141758[_0x28f30e(0x9a)]));const _0x411ba3=await withSpinner('Listing\x20folders\x20and\x20segments...',()=>_0x32b576[_0x28f30e(0x96)][_0x28f30e(0x80)](_0x141758[_0x28f30e(0x99)],_0x141758[_0x28f30e(0x9a)]),{'verbose':_0x347774[_0x28f30e(0x9c)]}),{folders:_0x3c4803,segments:_0xae3a7e}=_0x411ba3[_0x28f30e(0x9b)],_0x1b9eb9=_0x3c4803['length']+_0xae3a7e[_0x28f30e(0xa8)];console[_0x28f30e(0x79)]('✔\x20Found\x20'+_0x3c4803['length']+_0x28f30e(0x97)+(_0x3c4803['length']!==0x1?'s':'')+_0x28f30e(0xa2)+_0xae3a7e[_0x28f30e(0xa8)]+_0x28f30e(0x73)+(_0xae3a7e[_0x28f30e(0xa8)]!==0x1?'s':''));const _0x452bcc=_0x41dc1d=>{const _0x16c579=_0x28f30e;return getConsoleNextUrl(_0x347774[_0x16c579(0xa4)],'/app/ps/'+_0x141758[_0x16c579(0x99)]+_0x16c579(0x9d)+_0x41dc1d);},_0x286bb8=_0x347774[_0x28f30e(0x9f)]===_0x28f30e(0x7d)||_0x347774['format']===_0x28f30e(0x91);if(_0x286bb8){const _0x4a760a=[..._0x3c4803[_0x28f30e(0x87)](_0x1bd782=>({..._0x1bd782,'type':'folder'})),..._0xae3a7e['map'](_0x1c0130=>({..._0x1c0130,'type':_0x28f30e(0x96),'url':_0x452bcc(_0x1c0130['id'])}))]['sort']((_0x2410e6,_0x391b79)=>_0x2410e6[_0x28f30e(0x7b)][_0x28f30e(0x83)](_0x391b79[_0x28f30e(0x7b)]));await handleSDKOutput(_0x4a760a,_0x347774);}else{if(_0x1b9eb9===0x0)console[_0x28f30e(0xa3)](a38_0x297dd9['dim']('['+_0x48148e+']')),console[_0x28f30e(0xa3)]('(empty)');else{console[_0x28f30e(0xa3)](a38_0x297dd9[_0x28f30e(0x86)]('['+_0x48148e+']'));const _0x5aebe9=formatFlatList(_0x3c4803,_0xae3a7e,{'showMetadata':!![],'showUrl':_0x5db443,'getSegmentUrl':_0x452bcc});console[_0x28f30e(0xa3)](_0x5aebe9);}}return 0x0;}async[a38_0x583df3(0xb1)](_0x57bfb3,_0x631c19){const _0x588382=a38_0x583df3,{options:_0x4bd36e,tdx:_0x5adf57}=_0x57bfb3,_0x599b2e=_0x4bd36e['web'],_0x3c8d90=await withSpinner('Resolving\x20path\x20\x27'+_0x631c19+'\x27...',()=>_0x5adf57['segment'][_0x588382(0xae)](_0x631c19),{'verbose':_0x4bd36e[_0x588382(0x9c)]}),_0x268298=_0x3c8d90[_0x588382(0x9b)];_0x4bd36e['verbose']&&(console[_0x588382(0x79)](_0x588382(0xac)+_0x268298[_0x588382(0x99)]),_0x268298[_0x588382(0x9a)]&&console[_0x588382(0x79)](_0x588382(0xa1)+_0x268298[_0x588382(0x9a)]));const _0x36bba3=_0x4bd36e['maxDepth']||0xa,_0x471268=await withSpinner(_0x588382(0xa6),()=>_0x5adf57[_0x588382(0x96)][_0x588382(0xb1)](_0x268298[_0x588382(0x99)],_0x268298[_0x588382(0x9a)],0x0,_0x36bba3),{'verbose':_0x4bd36e['verbose']}),_0x1a68ed=_0x471268[_0x588382(0x9b)];console[_0x588382(0x79)](_0x588382(0x8a)+_0x1a68ed[_0x588382(0xa8)]+_0x588382(0xa0));const _0x8014b1=_0x49bd73=>{const _0x5251e6=_0x588382;return getConsoleNextUrl(_0x4bd36e['site'],_0x5251e6(0x88)+_0x268298[_0x5251e6(0x99)]+'/e/'+_0x49bd73);};if(_0x4bd36e['format']===_0x588382(0x7d)||_0x4bd36e[_0x588382(0x9f)]===_0x588382(0x91))await handleSDKOutput(_0x1a68ed,_0x4bd36e);else{console[_0x588382(0xa3)](a38_0x297dd9[_0x588382(0x86)]('['+_0x631c19+']'));const _0x5a4f51=formatTree(_0x1a68ed,{'showMetadata':!![],'showUrl':_0x599b2e,'getSegmentUrl':_0x8014b1});console[_0x588382(0xa3)](_0x5a4f51);}return 0x0;}}
1
+ const a38_0x38d25d=a38_0x4239;function a38_0x4753(){const _0x26a85d=['147328NemsJY','/app/ps/','(empty)','Folder\x20ID:\x20','map','\x20and\x20','100008zVXQAW','includes','\x27...','segment','dim','\x20\x20tdx\x20sg\x20use\x20\x22My\x20Audience\x22','243GPvRWo','/e/','web','description','\x20segment','length','\x20\x20tdx\x20sg\x20pull\x20\x22My\x20Audience\x22','Error:\x20No\x20parent\x20segment\x20context\x20set.','site','Listing\x20folders\x20and\x20segments...','error','10OpucTP','verbose','log','Building\x20hierarchy\x20tree...','List\x20folders\x20and\x20child\x20segments','3277728puQges','folderId','Error:\x20','listRecursive','Resolving\x20parent\x20segment\x20\x27','\x20matching\x20\x27','test','cause','\x20\x20Cause:\x20','folder','resolvePathToResource',']\x20matching\x20\x27','segments','14VJkrdT','3265108XOlSdS','json','✔\x20Found\x20','Recursive\x20mode:\x20enabled','\x20folder','Resolving\x20path\x20\x27','jsonl','24OVPWLG','execute','format','listUnified','listWithPattern','✔\x20Built\x20tree\x20with\x20','Set\x20a\x20parent\x20segment\x20context\x20first:','sort','Use\x20tdx\x20ps\x20list\x20to\x20see\x20available\x20parent\x20segments.','1763136RNnSFW','data','parentId','418270wJQjvW','334516ABSxoV','filter','Parent\x20ID:\x20','Folder/pattern\x20arg:\x20','parentSegment','localeCompare','name','replace'];a38_0x4753=function(){return _0x26a85d;};return a38_0x4753();}(function(_0x260859,_0x46f2af){const _0x29c5dc=a38_0x4239,_0x3d7a20=_0x260859();while(!![]){try{const _0x328b9f=parseInt(_0x29c5dc(0x1c6))/0x1+-parseInt(_0x29c5dc(0x1ce))/0x2*(parseInt(_0x29c5dc(0x1ff))/0x3)+parseInt(_0x29c5dc(0x1ea))/0x4+-parseInt(_0x29c5dc(0x1c5))/0x5+-parseInt(_0x29c5dc(0x1c2))/0x6*(-parseInt(_0x29c5dc(0x1f7))/0x7)+parseInt(_0x29c5dc(0x1d4))/0x8*(-parseInt(_0x29c5dc(0x1da))/0x9)+parseInt(_0x29c5dc(0x1e5))/0xa*(-parseInt(_0x29c5dc(0x1f8))/0xb);if(_0x328b9f===_0x46f2af)break;else _0x3d7a20['push'](_0x3d7a20['shift']());}catch(_0x539f25){_0x3d7a20['push'](_0x3d7a20['shift']());}}}(a38_0x4753,0x6a0a3));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{formatFlatList,formatTree}from'../utils/tree-formatter.js';import{getConsoleNextUrl}from'../types/endpoints.js';import a38_0x134cca from'chalk';function a38_0x4239(_0x39f6ef,_0x1bd04b){_0x39f6ef=_0x39f6ef-0x1c2;const _0x4753ea=a38_0x4753();let _0x423963=_0x4753ea[_0x39f6ef];return _0x423963;}export class SegmentsCommand extends BaseCommand{[a38_0x38d25d(0x1cc)]=a38_0x38d25d(0x1f6);[a38_0x38d25d(0x1dd)]=a38_0x38d25d(0x1e9);async[a38_0x38d25d(0x200)](_0x1f7b63){const _0x43239a=a38_0x38d25d,{options:_0x1300e2,args:_0x16cf21}=_0x1f7b63,_0x3a5030=_0x1300e2['recursive'],_0x746bfa=_0x16cf21[0x0];try{const _0x4f82be=_0x1300e2[_0x43239a(0x1ca)];_0x1300e2[_0x43239a(0x1e6)]&&(console[_0x43239a(0x1e4)]('Site:\x20'+_0x1300e2[_0x43239a(0x1e2)]),console[_0x43239a(0x1e4)]('Parent\x20segment\x20context:\x20'+(_0x4f82be||'(not\x20set)')),_0x746bfa&&console[_0x43239a(0x1e4)](_0x43239a(0x1c9)+_0x746bfa),_0x3a5030&&console['error'](_0x43239a(0x1fb)));if(!_0x4f82be)return console[_0x43239a(0x1e4)](_0x43239a(0x1e1)),console[_0x43239a(0x1e4)](''),console[_0x43239a(0x1e4)](_0x43239a(0x205)),console[_0x43239a(0x1e4)](_0x43239a(0x1e0)),console[_0x43239a(0x1e4)](_0x43239a(0x1d9)),console[_0x43239a(0x1e4)](''),console[_0x43239a(0x1e4)](_0x43239a(0x207)),0x1;const _0x538c99=_0x746bfa&&(_0x746bfa[_0x43239a(0x1d5)]('*')||_0x746bfa[_0x43239a(0x1d5)]('?'));if(_0x538c99)return await this[_0x43239a(0x203)](_0x1f7b63,_0x4f82be,_0x746bfa);const _0x229cd5=_0x746bfa?_0x4f82be+'/'+_0x746bfa:_0x4f82be;return _0x3a5030?await this[_0x43239a(0x1ed)](_0x1f7b63,_0x229cd5):await this['listUnified'](_0x1f7b63,_0x229cd5);}catch(_0x10644a){if(_0x10644a instanceof SDKError)return console[_0x43239a(0x1e4)](_0x43239a(0x1ec)+_0x10644a['message']),_0x10644a[_0x43239a(0x1f1)]&&console['error'](_0x43239a(0x1f2)+_0x10644a['cause']),0x1;throw _0x10644a;}}async[a38_0x38d25d(0x203)](_0xb63385,_0x1213fe,_0x505d9f){const _0x3e55ca=a38_0x38d25d,{options:_0x30250e,tdx:_0x4426d2}=_0xb63385,_0x1b3d0f=_0x30250e[_0x3e55ca(0x1dc)],_0x277fa7=await withSpinner(_0x3e55ca(0x1ee)+_0x1213fe+_0x3e55ca(0x1d6),()=>_0x4426d2[_0x3e55ca(0x1d7)][_0x3e55ca(0x1f4)](_0x1213fe),{'verbose':_0x30250e[_0x3e55ca(0x1e6)]}),_0x451d88=_0x277fa7[_0x3e55ca(0x1c3)],_0x475b6a=await withSpinner('Listing\x20folders\x20and\x20segments...',()=>_0x4426d2[_0x3e55ca(0x1d7)][_0x3e55ca(0x202)](_0x451d88[_0x3e55ca(0x1c4)],_0x451d88['folderId']),{'verbose':_0x30250e['verbose']}),{folders:_0x2b501b,segments:_0x299125}=_0x475b6a[_0x3e55ca(0x1c3)],_0x16487d=_0x505d9f[_0x3e55ca(0x1cd)](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0x3e55ca(0x1cd)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x2a23e5=new RegExp('^'+_0x16487d+'$','i'),_0x374684=_0x2b501b[_0x3e55ca(0x1c7)](_0x190777=>_0x2a23e5[_0x3e55ca(0x1f0)](_0x190777[_0x3e55ca(0x1cc)])),_0x14b21a=_0x299125[_0x3e55ca(0x1c7)](_0x163fb5=>_0x2a23e5[_0x3e55ca(0x1f0)](_0x163fb5[_0x3e55ca(0x1cc)])),_0x460f18=_0x374684[_0x3e55ca(0x1df)]+_0x14b21a[_0x3e55ca(0x1df)];console['error'](_0x3e55ca(0x1fa)+_0x374684['length']+_0x3e55ca(0x1fc)+(_0x374684[_0x3e55ca(0x1df)]!==0x1?'s':'')+_0x3e55ca(0x1d3)+_0x14b21a['length']+_0x3e55ca(0x1de)+(_0x14b21a[_0x3e55ca(0x1df)]!==0x1?'s':'')+_0x3e55ca(0x1ef)+_0x505d9f+'\x27');const _0x360a5c=_0xa763b5=>{const _0x460f0e=_0x3e55ca;return getConsoleNextUrl(_0x30250e['site'],_0x460f0e(0x1cf)+_0x451d88[_0x460f0e(0x1c4)]+_0x460f0e(0x1db)+_0xa763b5);},_0x11c05c=_0x30250e['format']===_0x3e55ca(0x1f9)||_0x30250e[_0x3e55ca(0x201)]===_0x3e55ca(0x1fe);if(_0x11c05c){const _0x5bc966=[..._0x374684[_0x3e55ca(0x1d2)](_0x428009=>({..._0x428009,'type':_0x3e55ca(0x1f3)})),..._0x14b21a[_0x3e55ca(0x1d2)](_0xd57818=>({..._0xd57818,'type':_0x3e55ca(0x1d7),'url':_0x360a5c(_0xd57818['id'])}))][_0x3e55ca(0x206)]((_0x29554c,_0x44a6f3)=>_0x29554c[_0x3e55ca(0x1cc)][_0x3e55ca(0x1cb)](_0x44a6f3['name']));await handleSDKOutput(_0x5bc966,_0x30250e);}else{if(_0x460f18===0x0)console['log']('No\x20items\x20match\x20pattern:\x20'+_0x505d9f);else{console[_0x3e55ca(0x1e7)](a38_0x134cca[_0x3e55ca(0x1d8)]('['+_0x1213fe+_0x3e55ca(0x1f5)+_0x505d9f+'\x27'));const _0x40c4ca=formatFlatList(_0x374684,_0x14b21a,{'showMetadata':!![],'showUrl':_0x1b3d0f,'getSegmentUrl':_0x360a5c});console['log'](_0x40c4ca);}}return 0x0;}async['listUnified'](_0x5c54e2,_0x4307d){const _0x57cf34=a38_0x38d25d,{options:_0x542d2b,tdx:_0x53f4db}=_0x5c54e2,_0x57e10b=_0x542d2b['web'],_0x856c77=await withSpinner(_0x57cf34(0x1fd)+_0x4307d+_0x57cf34(0x1d6),()=>_0x53f4db[_0x57cf34(0x1d7)][_0x57cf34(0x1f4)](_0x4307d),{'verbose':_0x542d2b['verbose']}),_0x3e2ee2=_0x856c77['data'];_0x542d2b['verbose']&&(console['error']('Parent\x20ID:\x20'+_0x3e2ee2[_0x57cf34(0x1c4)]),_0x3e2ee2['folderId']&&console[_0x57cf34(0x1e4)](_0x57cf34(0x1d1)+_0x3e2ee2[_0x57cf34(0x1eb)]));const _0x2f0569=await withSpinner(_0x57cf34(0x1e3),()=>_0x53f4db[_0x57cf34(0x1d7)]['listUnified'](_0x3e2ee2[_0x57cf34(0x1c4)],_0x3e2ee2['folderId']),{'verbose':_0x542d2b[_0x57cf34(0x1e6)]}),{folders:_0xf6686,segments:_0x3397b}=_0x2f0569[_0x57cf34(0x1c3)],_0x594000=_0xf6686[_0x57cf34(0x1df)]+_0x3397b['length'];console['error']('✔\x20Found\x20'+_0xf6686[_0x57cf34(0x1df)]+_0x57cf34(0x1fc)+(_0xf6686['length']!==0x1?'s':'')+_0x57cf34(0x1d3)+_0x3397b[_0x57cf34(0x1df)]+_0x57cf34(0x1de)+(_0x3397b['length']!==0x1?'s':''));const _0x59ee89=_0x3fd08e=>{const _0x3734a8=_0x57cf34;return getConsoleNextUrl(_0x542d2b[_0x3734a8(0x1e2)],_0x3734a8(0x1cf)+_0x3e2ee2[_0x3734a8(0x1c4)]+_0x3734a8(0x1db)+_0x3fd08e);},_0x5a4ed5=_0x542d2b[_0x57cf34(0x201)]===_0x57cf34(0x1f9)||_0x542d2b[_0x57cf34(0x201)]===_0x57cf34(0x1fe);if(_0x5a4ed5){const _0x1c7619=[..._0xf6686[_0x57cf34(0x1d2)](_0x312dc8=>({..._0x312dc8,'type':'folder'})),..._0x3397b[_0x57cf34(0x1d2)](_0x5d1bbf=>({..._0x5d1bbf,'type':_0x57cf34(0x1d7),'url':_0x59ee89(_0x5d1bbf['id'])}))][_0x57cf34(0x206)]((_0x157811,_0x433c06)=>_0x157811[_0x57cf34(0x1cc)][_0x57cf34(0x1cb)](_0x433c06[_0x57cf34(0x1cc)]));await handleSDKOutput(_0x1c7619,_0x542d2b);}else{if(_0x594000===0x0)console[_0x57cf34(0x1e7)](a38_0x134cca[_0x57cf34(0x1d8)]('['+_0x4307d+']')),console[_0x57cf34(0x1e7)](_0x57cf34(0x1d0));else{console['log'](a38_0x134cca['dim']('['+_0x4307d+']'));const _0x3b5af1=formatFlatList(_0xf6686,_0x3397b,{'showMetadata':!![],'showUrl':_0x57e10b,'getSegmentUrl':_0x59ee89});console[_0x57cf34(0x1e7)](_0x3b5af1);}}return 0x0;}async['listRecursive'](_0x414bb8,_0x1a41f4){const _0x5bf17f=a38_0x38d25d,{options:_0x1edbf0,tdx:_0x54a074}=_0x414bb8,_0x18fa50=_0x1edbf0[_0x5bf17f(0x1dc)],_0x3a4eb3=await withSpinner(_0x5bf17f(0x1fd)+_0x1a41f4+_0x5bf17f(0x1d6),()=>_0x54a074['segment'][_0x5bf17f(0x1f4)](_0x1a41f4),{'verbose':_0x1edbf0[_0x5bf17f(0x1e6)]}),_0x264230=_0x3a4eb3['data'];_0x1edbf0[_0x5bf17f(0x1e6)]&&(console[_0x5bf17f(0x1e4)](_0x5bf17f(0x1c8)+_0x264230[_0x5bf17f(0x1c4)]),_0x264230[_0x5bf17f(0x1eb)]&&console[_0x5bf17f(0x1e4)](_0x5bf17f(0x1d1)+_0x264230[_0x5bf17f(0x1eb)]));const _0x267f08=_0x1edbf0['maxDepth']||0xa,_0x3d28b4=await withSpinner(_0x5bf17f(0x1e8),()=>_0x54a074[_0x5bf17f(0x1d7)][_0x5bf17f(0x1ed)](_0x264230[_0x5bf17f(0x1c4)],_0x264230[_0x5bf17f(0x1eb)],0x0,_0x267f08),{'verbose':_0x1edbf0[_0x5bf17f(0x1e6)]}),_0xb1dac5=_0x3d28b4[_0x5bf17f(0x1c3)];console[_0x5bf17f(0x1e4)](_0x5bf17f(0x204)+_0xb1dac5[_0x5bf17f(0x1df)]+'\x20top-level\x20items');const _0x27eb91=_0x59fb33=>{const _0x14aabd=_0x5bf17f;return getConsoleNextUrl(_0x1edbf0['site'],'/app/ps/'+_0x264230[_0x14aabd(0x1c4)]+'/e/'+_0x59fb33);};if(_0x1edbf0[_0x5bf17f(0x201)]===_0x5bf17f(0x1f9)||_0x1edbf0[_0x5bf17f(0x201)]===_0x5bf17f(0x1fe))await handleSDKOutput(_0xb1dac5,_0x1edbf0);else{console[_0x5bf17f(0x1e7)](a38_0x134cca['dim']('['+_0x1a41f4+']'));const _0x4010c7=formatTree(_0xb1dac5,{'showMetadata':!![],'showUrl':_0x18fa50,'getSegmentUrl':_0x27eb91});console['log'](_0x4010c7);}return 0x0;}}
@@ -1 +1 @@
1
- const a39_0x4eb041=a39_0x2ceb;(function(_0x38c9c9,_0x442f89){const _0x436064=a39_0x2ceb,_0x328e77=_0x38c9c9();while(!![]){try{const _0x2035ea=parseInt(_0x436064(0x193))/0x1+parseInt(_0x436064(0x18d))/0x2+-parseInt(_0x436064(0x192))/0x3+-parseInt(_0x436064(0x171))/0x4*(parseInt(_0x436064(0x185))/0x5)+parseInt(_0x436064(0x195))/0x6+-parseInt(_0x436064(0x187))/0x7*(-parseInt(_0x436064(0x18e))/0x8)+parseInt(_0x436064(0x188))/0x9;if(_0x2035ea===_0x442f89)break;else _0x328e77['push'](_0x328e77['shift']());}catch(_0x34fea2){_0x328e77['push'](_0x328e77['shift']());}}}(a39_0x4093,0x5c60c));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{parseTableReference,validateTableDescribeReference}from'../utils/table-ref-parser.js';function a39_0x4093(){const _0x448743=['Usage:\x20tdx\x20show\x20<database.table>','verbose','2163873iuxnVq','69480YGPuGu','Error:\x20','221040WLGuSC','Limit:\x20','\x20row','cause','error','4SksdNJ','✔\x20Retrieved\x20','limit','Site:\x20','validate','Too\x20many\x20arguments\x0aUsage:\x20tdx\x20show\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--database\x20<database>\x0a\x0aRun\x20\x27tdx\x20show\x20--help\x27\x20for\x20more\x20options','Table:\x20','Show\x20table\x20contents','execute','\x20from\x20','query','\x20\x20Cause:\x20','show','Database:\x20','data','database','table','message','description','\x20\x20\x20or:\x20tdx\x20show\x20<catalog.database.table>','1238030guqEEb','\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--database\x20<database>','7fKiHaY','8046432NadwjT','name','✔\x20Query\x20successful\x20-\x200\x20rows\x20returned','args','length','280168nGtCyu','1654600OMecjP','showTable'];a39_0x4093=function(){return _0x448743;};return a39_0x4093();}function a39_0x2ceb(_0x23354c,_0x352d42){_0x23354c=_0x23354c-0x16d;const _0x40939d=a39_0x4093();let _0x2ceb88=_0x40939d[_0x23354c];return _0x2ceb88;}import{withSpinner}from'../utils/spinner.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';export class ShowCommand extends BaseCommand{[a39_0x4eb041(0x189)]=a39_0x4eb041(0x17d);[a39_0x4eb041(0x183)]=a39_0x4eb041(0x178);async[a39_0x4eb041(0x179)](_0x5c13a3){const _0x2398fc=a39_0x4eb041;return this[_0x2398fc(0x18f)](_0x5c13a3);}async['showTable'](_0x18d0c2){const _0x76c138=a39_0x4eb041,{options:_0x271596,args:_0x21263d,tdx:_0x603ab}=_0x18d0c2;let _0x4140a6;try{_0x4140a6=parseTableReference(_0x21263d[0x0]);const _0x2ac50f=_0x271596[_0x76c138(0x180)];!_0x4140a6[_0x76c138(0x180)]&&_0x2ac50f&&(_0x4140a6['database']=_0x2ac50f);const _0x183699=validateTableDescribeReference(_0x4140a6);if(_0x183699)return console['error'](_0x76c138(0x194)+_0x183699),console[_0x76c138(0x170)](_0x76c138(0x190)),console['error'](_0x76c138(0x184)),console[_0x76c138(0x170)](_0x76c138(0x186)),0x1;}catch(_0x31f498){return console['error']('Error:\x20'+_0x31f498[_0x76c138(0x182)]),console[_0x76c138(0x170)](_0x76c138(0x190)),console[_0x76c138(0x170)](_0x76c138(0x184)),console[_0x76c138(0x170)](_0x76c138(0x186)),0x1;}const _0x56b743=_0x4140a6['catalog'],_0x15bca4=_0x4140a6[_0x76c138(0x180)],_0x55a775=_0x4140a6[_0x76c138(0x181)],_0x1452a8=resolveLimit(_0x271596[_0x76c138(0x173)],DEFAULT_DISPLAY_LIMIT);try{_0x271596[_0x76c138(0x191)]&&(console[_0x76c138(0x170)](_0x76c138(0x174)+_0x271596['site']),_0x56b743&&console['error']('Catalog:\x20'+_0x56b743),console[_0x76c138(0x170)](_0x76c138(0x17e)+_0x15bca4),console[_0x76c138(0x170)](_0x76c138(0x177)+_0x55a775),console[_0x76c138(0x170)](_0x76c138(0x16d)+_0x1452a8));const _0x287ff9=_0x56b743?_0x56b743+'.'+_0x15bca4+'.'+_0x55a775:_0x15bca4+'.'+_0x55a775,_0x57b9da=await withSpinner('Querying\x20'+_0x287ff9+'...',()=>_0x603ab[_0x76c138(0x17b)][_0x76c138(0x18f)](_0x15bca4,_0x55a775,_0x1452a8,_0x56b743),{'verbose':_0x271596['verbose']}),_0x196e9b=_0x57b9da[_0x76c138(0x17f)],_0x319add=_0x196e9b[_0x76c138(0x17f)];return _0x319add[_0x76c138(0x18c)]===0x0?console[_0x76c138(0x170)](_0x76c138(0x18a)):console[_0x76c138(0x170)](_0x76c138(0x172)+_0x319add[_0x76c138(0x18c)]+_0x76c138(0x16e)+(_0x319add['length']!==0x1?'s':'')+_0x76c138(0x17a)+_0x287ff9),await handleSDKOutput(_0x319add,_0x271596),0x0;}catch(_0x36a9f0){if(_0x36a9f0 instanceof SDKError)return console[_0x76c138(0x170)](_0x76c138(0x194)+_0x36a9f0[_0x76c138(0x182)]),_0x36a9f0[_0x76c138(0x16f)]&&console[_0x76c138(0x170)](_0x76c138(0x17c)+_0x36a9f0[_0x76c138(0x16f)]),0x1;throw _0x36a9f0;}}[a39_0x4eb041(0x175)](_0x3216e7){const _0x150ba3=a39_0x4eb041;if(_0x3216e7[_0x150ba3(0x18b)][_0x150ba3(0x18c)]===0x0)return'Usage:\x20tdx\x20show\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20show\x20<catalog.database.table>\x0a\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--database\x20<database>\x0a\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--in\x20<database>\x0a\x0aRun\x20\x27tdx\x20show\x20--help\x27\x20for\x20more\x20options';if(_0x3216e7[_0x150ba3(0x18b)][_0x150ba3(0x18c)]>0x1)return _0x150ba3(0x176);return undefined;}}
1
+ const a39_0x1302cf=a39_0x3ec8;function a39_0x3ec8(_0x5f28a2,_0xcb46fc){_0x5f28a2=_0x5f28a2-0x104;const _0x51416c=a39_0x5141();let _0x3ec860=_0x51416c[_0x5f28a2];return _0x3ec860;}(function(_0x5e20c8,_0x3a88a3){const _0x2332c3=a39_0x3ec8,_0x1b4feb=_0x5e20c8();while(!![]){try{const _0xa6b5f2=-parseInt(_0x2332c3(0x11e))/0x1*(parseInt(_0x2332c3(0x118))/0x2)+-parseInt(_0x2332c3(0x12f))/0x3*(-parseInt(_0x2332c3(0x11b))/0x4)+-parseInt(_0x2332c3(0x12a))/0x5*(parseInt(_0x2332c3(0x122))/0x6)+parseInt(_0x2332c3(0x10e))/0x7+parseInt(_0x2332c3(0x105))/0x8+parseInt(_0x2332c3(0x120))/0x9+-parseInt(_0x2332c3(0x12e))/0xa;if(_0xa6b5f2===_0x3a88a3)break;else _0x1b4feb['push'](_0x1b4feb['shift']());}catch(_0x595ca){_0x1b4feb['push'](_0x1b4feb['shift']());}}}(a39_0x5141,0x442f2));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{parseTableReference,validateTableDescribeReference}from'../utils/table-ref-parser.js';import{withSpinner}from'../utils/spinner.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';export class ShowCommand extends BaseCommand{[a39_0x1302cf(0x112)]=a39_0x1302cf(0x110);[a39_0x1302cf(0x12b)]=a39_0x1302cf(0x124);async[a39_0x1302cf(0x11c)](_0x1ec3c9){const _0x4beb7b=a39_0x1302cf;return this[_0x4beb7b(0x10d)](_0x1ec3c9);}async['showTable'](_0xd6a0f3){const _0x57fb69=a39_0x1302cf,{options:_0x4c61c1,args:_0x399573,tdx:_0x1716c7}=_0xd6a0f3;let _0x3a7315;try{_0x3a7315=parseTableReference(_0x399573[0x0]);const _0x2d41e3=_0x4c61c1[_0x57fb69(0x116)];!_0x3a7315['database']&&_0x2d41e3&&(_0x3a7315[_0x57fb69(0x116)]=_0x2d41e3);const _0x1b2304=validateTableDescribeReference(_0x3a7315);if(_0x1b2304)return console['error'](_0x57fb69(0x126)+_0x1b2304),console[_0x57fb69(0x117)](_0x57fb69(0x113)),console[_0x57fb69(0x117)](_0x57fb69(0x119)),console['error'](_0x57fb69(0x128)),0x1;}catch(_0x14086b){return console[_0x57fb69(0x117)](_0x57fb69(0x126)+_0x14086b[_0x57fb69(0x10f)]),console[_0x57fb69(0x117)]('Usage:\x20tdx\x20show\x20<database.table>'),console[_0x57fb69(0x117)](_0x57fb69(0x119)),console[_0x57fb69(0x117)](_0x57fb69(0x128)),0x1;}const _0x1a608c=_0x3a7315[_0x57fb69(0x108)],_0x3f79a6=_0x3a7315[_0x57fb69(0x116)],_0x2923bc=_0x3a7315[_0x57fb69(0x12d)],_0x29b04c=resolveLimit(_0x4c61c1[_0x57fb69(0x10c)],DEFAULT_DISPLAY_LIMIT);try{_0x4c61c1[_0x57fb69(0x115)]&&(console[_0x57fb69(0x117)](_0x57fb69(0x104)+_0x4c61c1[_0x57fb69(0x111)]),_0x1a608c&&console[_0x57fb69(0x117)](_0x57fb69(0x10a)+_0x1a608c),console[_0x57fb69(0x117)](_0x57fb69(0x106)+_0x3f79a6),console[_0x57fb69(0x117)](_0x57fb69(0x127)+_0x2923bc),console[_0x57fb69(0x117)](_0x57fb69(0x11d)+_0x29b04c));const _0x5c5d82=_0x1a608c?_0x1a608c+'.'+_0x3f79a6+'.'+_0x2923bc:_0x3f79a6+'.'+_0x2923bc,_0x525ce9=await withSpinner('Querying\x20'+_0x5c5d82+'...',()=>_0x1716c7[_0x57fb69(0x114)][_0x57fb69(0x10d)](_0x3f79a6,_0x2923bc,_0x29b04c,_0x1a608c),{'verbose':_0x4c61c1[_0x57fb69(0x115)]}),_0x4a46dc=_0x525ce9[_0x57fb69(0x123)],_0x26de89=_0x4a46dc['data'];return _0x26de89[_0x57fb69(0x121)]===0x0?console[_0x57fb69(0x117)](_0x57fb69(0x125)):console[_0x57fb69(0x117)](_0x57fb69(0x11f)+_0x26de89['length']+'\x20row'+(_0x26de89[_0x57fb69(0x121)]!==0x1?'s':'')+'\x20from\x20'+_0x5c5d82),await handleSDKOutput(_0x26de89,_0x4c61c1),0x0;}catch(_0x362d5e){if(_0x362d5e instanceof SDKError)return console[_0x57fb69(0x117)]('Error:\x20'+_0x362d5e[_0x57fb69(0x10f)]),_0x362d5e[_0x57fb69(0x11a)]&&console['error'](_0x57fb69(0x10b)+_0x362d5e[_0x57fb69(0x11a)]),0x1;throw _0x362d5e;}}[a39_0x1302cf(0x129)](_0x4d3702){const _0x1d52e0=a39_0x1302cf;if(_0x4d3702[_0x1d52e0(0x12c)][_0x1d52e0(0x121)]===0x0)return _0x1d52e0(0x107);if(_0x4d3702[_0x1d52e0(0x12c)][_0x1d52e0(0x121)]>0x1)return _0x1d52e0(0x109);return undefined;}}function a39_0x5141(){const _0x227cb8=['Usage:\x20tdx\x20show\x20<database.table>','query','verbose','database','error','482lxNwjW','\x20\x20\x20or:\x20tdx\x20show\x20<catalog.database.table>','cause','36feYeNF','execute','Limit:\x20','1684dPbAZf','✔\x20Retrieved\x20','2341755yCvCCh','length','282fcrXVH','data','Show\x20table\x20contents','✔\x20Query\x20successful\x20-\x200\x20rows\x20returned','Error:\x20','Table:\x20','\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--database\x20<database>','validate','53810jxhSNG','description','args','table','1228610yBtzXf','158031LVKWUT','Site:\x20','3698296hplFcs','Database:\x20','Usage:\x20tdx\x20show\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20show\x20<catalog.database.table>\x0a\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--database\x20<database>\x0a\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--in\x20<database>\x0a\x0aRun\x20\x27tdx\x20show\x20--help\x27\x20for\x20more\x20options','catalog','Too\x20many\x20arguments\x0aUsage:\x20tdx\x20show\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--database\x20<database>\x0a\x0aRun\x20\x27tdx\x20show\x20--help\x27\x20for\x20more\x20options','Catalog:\x20','\x20\x20Cause:\x20','limit','showTable','820582oKqVQJ','message','show','site','name'];a39_0x5141=function(){return _0x227cb8;};return a39_0x5141();}