@treasuredata/tdx 0.8.5 → 0.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) 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 +1 -0
  18. package/dist/commands/claude-command.d.ts.map +1 -1
  19. package/dist/commands/claude-command.js +1 -1
  20. package/dist/commands/claude-command.js.map +1 -1
  21. package/dist/commands/claude-statusline-command.js +1 -1
  22. package/dist/commands/claude-usage-command.js +1 -1
  23. package/dist/commands/command.js +1 -1
  24. package/dist/commands/connection-command.js +1 -1
  25. package/dist/commands/context-command.js +1 -1
  26. package/dist/commands/databases.js +1 -1
  27. package/dist/commands/describe.js +1 -1
  28. package/dist/commands/engage-command.js +1 -1
  29. package/dist/commands/job-command.js +1 -1
  30. package/dist/commands/journey-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/llm-proxy.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/profiles-command.js +1 -1
  35. package/dist/commands/query-command.js +1 -1
  36. package/dist/commands/segment-command.js +1 -1
  37. package/dist/commands/segment-create-command.js +1 -1
  38. package/dist/commands/segment-fields-command.js +1 -1
  39. package/dist/commands/segment-pull-command.js +1 -1
  40. package/dist/commands/segment-push-command.js +1 -1
  41. package/dist/commands/segment-update-command.js +1 -1
  42. package/dist/commands/segment-use-command.js +1 -1
  43. package/dist/commands/segments.js +1 -1
  44. package/dist/commands/show.js +1 -1
  45. package/dist/commands/tables.js +1 -1
  46. package/dist/commands/use-command.js +1 -1
  47. package/dist/commands/user-command.js +1 -1
  48. package/dist/commands/workflow-command.js +1 -1
  49. package/dist/core/auth.js +1 -1
  50. package/dist/core/config.js +1 -1
  51. package/dist/core/connection-cache.js +1 -1
  52. package/dist/core/credential-cache.js +1 -1
  53. package/dist/core/global-context.js +1 -1
  54. package/dist/core/keychain.js +1 -1
  55. package/dist/core/profile.js +1 -1
  56. package/dist/core/project-config.js +1 -1
  57. package/dist/core/session.js +1 -1
  58. package/dist/core/user-cache.js +1 -1
  59. package/dist/index.js +1 -1
  60. package/dist/proxy/anthropic-adapter.js +1 -1
  61. package/dist/proxy/claude-usage-tracker.js +1 -1
  62. package/dist/proxy/context-signature.js +1 -1
  63. package/dist/proxy/conversation-utils.js +1 -1
  64. package/dist/proxy/server.js +1 -1
  65. package/dist/proxy/session-cache.js +1 -1
  66. package/dist/sdk/api.js +1 -1
  67. package/dist/sdk/connection.js +1 -1
  68. package/dist/sdk/engage.js +1 -1
  69. package/dist/sdk/errors.js +1 -1
  70. package/dist/sdk/index.js +1 -1
  71. package/dist/sdk/job.js +1 -1
  72. package/dist/sdk/journey.js +1 -1
  73. package/dist/sdk/llm.js +1 -1
  74. package/dist/sdk/query.js +1 -1
  75. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  76. package/dist/sdk/segment/journey-yaml.js +1 -1
  77. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  78. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  79. package/dist/sdk/segment.js +1 -1
  80. package/dist/sdk/user.js +1 -1
  81. package/dist/sdk/workflow.js +1 -1
  82. package/dist/types/endpoints.js +1 -1
  83. package/dist/types/index.js +1 -1
  84. package/dist/utils/agent-ref-parser.js +1 -1
  85. package/dist/utils/async.js +1 -1
  86. package/dist/utils/chat-cache.js +1 -1
  87. package/dist/utils/colors.js +1 -1
  88. package/dist/utils/command-output.js +1 -1
  89. package/dist/utils/constants.js +1 -1
  90. package/dist/utils/diff.js +1 -1
  91. package/dist/utils/fields-display.js +1 -1
  92. package/dist/utils/file-permissions.js +1 -1
  93. package/dist/utils/format-detector.js +1 -1
  94. package/dist/utils/formatters.js +1 -1
  95. package/dist/utils/json-loader.js +1 -1
  96. package/dist/utils/llm-backup-utils.js +1 -1
  97. package/dist/utils/model-aliases.js +1 -1
  98. package/dist/utils/model-factors.js +1 -1
  99. package/dist/utils/option-validation.js +1 -1
  100. package/dist/utils/port.js +1 -1
  101. package/dist/utils/process.js +1 -1
  102. package/dist/utils/prompt.js +1 -1
  103. package/dist/utils/segment-path-parser.js +1 -1
  104. package/dist/utils/segment-ref-parser.js +1 -1
  105. package/dist/utils/spinner.js +1 -1
  106. package/dist/utils/sql-parser.js +1 -1
  107. package/dist/utils/sse-parser.js +1 -1
  108. package/dist/utils/string-utils.js +1 -1
  109. package/dist/utils/table-ref-parser.js +1 -1
  110. package/dist/utils/tdx-config.js +1 -1
  111. package/dist/utils/tdx-logger.js +1 -1
  112. package/dist/utils/tree-formatter.js +1 -1
  113. package/dist/utils/version-check.js +1 -1
  114. package/dist/utils/workflow-utils.js +1 -1
  115. package/package.json +1 -1
@@ -1 +1 @@
1
- const a32_0x5c1c24=a32_0xfabf;(function(_0x3f41ab,_0xdad24){const _0x3f1faa=a32_0xfabf,_0x588fb6=_0x3f41ab();while(!![]){try{const _0x4eefcd=parseInt(_0x3f1faa(0x1cf))/0x1+-parseInt(_0x3f1faa(0x1e2))/0x2+parseInt(_0x3f1faa(0x1c2))/0x3+parseInt(_0x3f1faa(0x1e3))/0x4*(-parseInt(_0x3f1faa(0x1b9))/0x5)+parseInt(_0x3f1faa(0x1bd))/0x6*(-parseInt(_0x3f1faa(0x1d9))/0x7)+parseInt(_0x3f1faa(0x1c6))/0x8+-parseInt(_0x3f1faa(0x1c3))/0x9*(-parseInt(_0x3f1faa(0x1bc))/0xa);if(_0x4eefcd===_0xdad24)break;else _0x588fb6['push'](_0x588fb6['shift']());}catch(_0x10ba3e){_0x588fb6['push'](_0x588fb6['shift']());}}}(a32_0x539c,0x4d84d));import{BaseCommand}from'./command.js';function a32_0x539c(){const _0x45d3de=['Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','2517050rxpkwz','1674528HjRpEq','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','resolveFolderId','data','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','262341QoIyxP','9mQUUxV','Resolving\x20folder\x20path\x20\x27','resolveParentId','3191328HlisiH','Examples:','folderId','Segment\x20name:\x20','\x20\x20\x20Path:\x20','invisible','description','resolvePathToResource','verbose','513795HkgRoK','rule','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','segment','Resolved\x20folder\x20ID:\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','segment:create','kind','\x27\x20with\x20ID:\x20','segments','7KiZzmG','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','name','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Site:\x20','error','type','folder','1019926xuJDod','20YryXic','Parent:\x20','parent','\x27...','Parent\x20path:\x20','execute','Resolving\x20folder\x20\x27','Resolving\x20parent\x20segment\x20\x27','noCountPopulation','includes','segmentPath','length','✔\x20Created\x20segment\x20\x27','ruleFile','145295RYoxEQ','Target\x20path:\x20'];a32_0x539c=function(){return _0x45d3de;};return a32_0x539c();}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_0xfabf(_0x540e03,_0x373215){_0x540e03=_0x540e03-0x1b7;const _0x539c14=a32_0x539c();let _0xfabf02=_0x539c14[_0x540e03];return _0xfabf02;}import a32_0x144a87 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a32_0x5c1c24(0x1dc)]=a32_0x5c1c24(0x1d5);[a32_0x5c1c24(0x1cc)]='Create\x20child\x20segment\x20with\x20filtering\x20rules';async[a32_0x5c1c24(0x1e8)](_0x4a892a){const _0x4855c3=a32_0x5c1c24;console['error'](a32_0x144a87['yellow']('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x4855c3(0x1df)](a32_0x144a87['yellow'](_0x4855c3(0x1d4)));const {options:_0x21a322,args:_0x3cf1a8,tdx:_0x12cd7b}=_0x4a892a,_0x23bb30=_0x21a322;if(_0x3cf1a8[_0x4855c3(0x1ee)]===0x0)return console['error'](_0x4855c3(0x1da)),console[_0x4855c3(0x1df)](_0x4855c3(0x1bb)),console[_0x4855c3(0x1df)](_0x4855c3(0x1c7)),console['error'](_0x4855c3(0x1db)),console[_0x4855c3(0x1df)](_0x4855c3(0x1d1)),console[_0x4855c3(0x1df)](_0x4855c3(0x1dd)),0x1;const _0x156bff=_0x3cf1a8[0x0],_0x2b50c9=_0x21a322[_0x4855c3(0x1ed)];let _0x14d6e4=_0x156bff;_0x2b50c9&&!_0x156bff[_0x4855c3(0x1ec)]('/')&&(_0x14d6e4=_0x2b50c9+'/'+_0x156bff,_0x23bb30[_0x4855c3(0x1ce)]&&console[_0x4855c3(0x1df)]('Resolved\x20relative\x20path\x20to:\x20'+_0x14d6e4));const _0x31b391=parsePath(_0x14d6e4);if(_0x31b391['segments'][_0x4855c3(0x1ee)]<0x2)return console[_0x4855c3(0x1df)](_0x4855c3(0x1be)),console['error'](_0x4855c3(0x1c1)),0x1;const _0x301ac8=_0x31b391['segments'][0x0],_0x2685cd=getBaseName(_0x14d6e4),_0x36af1c=getParentPath(_0x14d6e4);_0x23bb30[_0x4855c3(0x1ce)]&&(console[_0x4855c3(0x1df)](_0x4855c3(0x1de)+_0x23bb30['site']),console[_0x4855c3(0x1df)](_0x4855c3(0x1ba)+_0x14d6e4),console[_0x4855c3(0x1df)](_0x4855c3(0x1e4)+_0x301ac8),console[_0x4855c3(0x1df)](_0x4855c3(0x1c9)+_0x2685cd),console[_0x4855c3(0x1df)](_0x4855c3(0x1e7)+_0x36af1c));const _0x7b166=await withSpinner(_0x4855c3(0x1ea)+_0x301ac8+_0x4855c3(0x1e6),()=>_0x12cd7b[_0x4855c3(0x1d2)][_0x4855c3(0x1c5)](_0x301ac8),{'verbose':_0x23bb30['verbose']}),_0x406b9c=_0x7b166[_0x4855c3(0x1c0)];let _0x26c1fb;if(_0x31b391[_0x4855c3(0x1d8)][_0x4855c3(0x1ee)]>0x2){const _0x3f0d58=await withSpinner(_0x4855c3(0x1c4)+_0x36af1c+'\x27...',()=>_0x12cd7b[_0x4855c3(0x1d2)][_0x4855c3(0x1cd)](_0x36af1c),{'verbose':_0x23bb30['verbose']}),_0x12161c=_0x3f0d58['data'];if(_0x12161c[_0x4855c3(0x1e0)]!==_0x4855c3(0x1e1)&&_0x12161c[_0x4855c3(0x1e0)]!==_0x4855c3(0x1e5))return console[_0x4855c3(0x1df)]('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x26c1fb=_0x12161c[_0x4855c3(0x1c8)];}else{if(_0x23bb30['folder']){const _0x4c0620=await withSpinner(_0x4855c3(0x1e9)+_0x23bb30[_0x4855c3(0x1e1)]+_0x4855c3(0x1e6),()=>_0x12cd7b[_0x4855c3(0x1d2)][_0x4855c3(0x1bf)](_0x406b9c,_0x23bb30[_0x4855c3(0x1e1)]),{'verbose':_0x23bb30[_0x4855c3(0x1ce)]});_0x26c1fb=_0x4c0620[_0x4855c3(0x1c0)];}}_0x23bb30[_0x4855c3(0x1ce)]&&_0x26c1fb&&console[_0x4855c3(0x1df)](_0x4855c3(0x1d3)+_0x26c1fb);const _0x5d2a29=await loadJSONFromOptions(_0x23bb30[_0x4855c3(0x1d0)],_0x23bb30[_0x4855c3(0x1b8)]),_0x2c8b9c={'name':_0x2685cd,'description':_0x23bb30[_0x4855c3(0x1cc)],'rule':_0x5d2a29,'kind':_0x23bb30[_0x4855c3(0x1d6)]!==undefined?parseInt(_0x23bb30[_0x4855c3(0x1d6)],0xa):undefined,'isVisible':_0x23bb30[_0x4855c3(0x1cb)]?![]:undefined,'segmentFolderId':_0x26c1fb,'countPopulation':_0x23bb30[_0x4855c3(0x1eb)]?![]:undefined},_0x3b0332=await withSpinner('Creating\x20segment\x20\x27'+_0x2685cd+_0x4855c3(0x1e6),()=>_0x12cd7b[_0x4855c3(0x1d2)]['createSegment'](_0x406b9c,_0x2c8b9c),{'verbose':_0x23bb30[_0x4855c3(0x1ce)]}),_0x5d2170=_0x3b0332[_0x4855c3(0x1c0)];return console[_0x4855c3(0x1df)](_0x4855c3(0x1b7)+_0x5d2170['name']+_0x4855c3(0x1d7)+_0x5d2170['id']),_0x14d6e4!==_0x156bff&&console[_0x4855c3(0x1df)](_0x4855c3(0x1ca)+_0x14d6e4),await handleSDKOutput([_0x5d2170],_0x23bb30),0x0;}}
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 +1 @@
1
- const a33_0x4566b9=a33_0x201c;(function(_0x49490c,_0x277f00){const _0x2152f6=a33_0x201c,_0x5e3bc3=_0x49490c();while(!![]){try{const _0x2216bc=parseInt(_0x2152f6(0xd1))/0x1+-parseInt(_0x2152f6(0xd9))/0x2+parseInt(_0x2152f6(0xe3))/0x3*(-parseInt(_0x2152f6(0xc9))/0x4)+parseInt(_0x2152f6(0xde))/0x5*(parseInt(_0x2152f6(0xd8))/0x6)+parseInt(_0x2152f6(0xcc))/0x7*(-parseInt(_0x2152f6(0xe0))/0x8)+-parseInt(_0x2152f6(0xd2))/0x9+parseInt(_0x2152f6(0xd4))/0xa*(parseInt(_0x2152f6(0xd6))/0xb);if(_0x2216bc===_0x277f00)break;else _0x5e3bc3['push'](_0x5e3bc3['shift']());}catch(_0x5bd95a){_0x5e3bc3['push'](_0x5e3bc3['shift']());}}}(a33_0x5575,0x1d352));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_0x201c(_0x1c6f2d,_0x4b37bd){_0x1c6f2d=_0x1c6f2d-0xc9;const _0x557567=a33_0x5575();let _0x201cbf=_0x557567[_0x1c6f2d];return _0x201cbf;}export class SegmentFieldsCommand extends BaseCommand{[a33_0x4566b9(0xca)]='segment:fields';[a33_0x4566b9(0xe2)]=a33_0x4566b9(0xdf);async[a33_0x4566b9(0xcf)](_0x5e816f){const _0x57a04c=a33_0x4566b9,{options:_0x18bc54,args:_0x1bee09,tdx:_0x41d420}=_0x5e816f,_0x533518=_0x1bee09[0x0]||_0x18bc54[_0x57a04c(0xd3)];if(!_0x533518)return console[_0x57a04c(0xe1)](_0x57a04c(0xdc)),console[_0x57a04c(0xe1)](_0x57a04c(0xe4)),console[_0x57a04c(0xe1)](_0x57a04c(0xce)),0x1;_0x18bc54['verbose']&&(console[_0x57a04c(0xe1)]('Site:\x20'+_0x18bc54[_0x57a04c(0xcb)]),console['error'](_0x57a04c(0xd7)+_0x533518));const _0x4d3e9d=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x533518+'\x27...',()=>_0x41d420['segment']['listFields'](_0x533518),{'verbose':_0x18bc54[_0x57a04c(0xdd)]}),_0xb871f5=_0x4d3e9d[_0x57a04c(0xda)];console['error'](_0x57a04c(0xd5)+_0xb871f5[_0x57a04c(0xe5)]+_0x57a04c(0xdb)+(_0xb871f5[_0x57a04c(0xe5)]!==0x1?'s':''));if(_0x18bc54[_0x57a04c(0xd0)]||_0x18bc54[_0x57a04c(0xcd)])return await handleSDKOutput(_0xb871f5,_0x18bc54),0x0;return displayFieldsHumanReadable(_0xb871f5,_0x533518),0x0;}}function a33_0x5575(){const _0x44d0b4=['44IdlZaX','Parent\x20segment:\x20','29586hXgLhu','152562zUtpGC','data','\x20field','Error:\x20Parent\x20segment\x20name\x20is\x20required','verbose','220Qwhpil','List\x20available\x20fields\x20for\x20segmentation','8nmXgFf','error','description','39QyEMKm','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','length','47416MUldNx','name','site','283409hhVAON','jsonl','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','execute','json','104952HIzgjd','864720sqQlcw','parentSegment','411670GFcZjc','✔\x20Found\x20'];a33_0x5575=function(){return _0x44d0b4;};return a33_0x5575();}
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 +1 @@
1
- const a34_0x2dc722=a34_0x1bf6;(function(_0x2def0c,_0x4d6509){const _0x6b1819=a34_0x1bf6,_0x53bcc0=_0x2def0c();while(!![]){try{const _0x5cbb88=-parseInt(_0x6b1819(0x115))/0x1*(parseInt(_0x6b1819(0x108))/0x2)+parseInt(_0x6b1819(0xf8))/0x3*(-parseInt(_0x6b1819(0xd3))/0x4)+parseInt(_0x6b1819(0x101))/0x5+-parseInt(_0x6b1819(0x119))/0x6*(parseInt(_0x6b1819(0xd7))/0x7)+-parseInt(_0x6b1819(0x111))/0x8+-parseInt(_0x6b1819(0xfc))/0x9*(-parseInt(_0x6b1819(0xca))/0xa)+parseInt(_0x6b1819(0xd2))/0xb;if(_0x5cbb88===_0x4d6509)break;else _0x53bcc0['push'](_0x53bcc0['shift']());}catch(_0x1acaa7){_0x53bcc0['push'](_0x53bcc0['shift']());}}}(a34_0x310c,0x6edf9));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_0x1bf6(_0x2972c0,_0x1b1641){_0x2972c0=_0x2972c0-0xc6;const _0x310c19=a34_0x310c();let _0x1bf6ec=_0x310c19[_0x2972c0];return _0x1bf6ec;}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_0x442fa3 from'chalk';function a34_0x310c(){const _0x2628c8=['parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','set','Parent\x20segment:\x20','parentFolderId','1158000PgDGyE','name','description','Fetching\x20parent\x20segment\x20info...','48791dAYHNu','values','getParent','segment','213834YckJGg','segment:pull','connection','\x20new\x20files','red','length','Found\x20tdx.json\x20at:\x20','green','Fetching\x20folders...','.yml','164030glYHsX','Fetching\x20segments...','\x20files?','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','\x20unchanged\x20files','then','segmentFolderId','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','25222010TywxdV','28vlwRFA','isNew','\x0aChanges\x20to\x20\x27','diff','14yljfuf','has','Using\x20parent\x20segment:\x20','Site:\x20','Resolving\x20parent\x20segment\x20\x27','listFolders','isDirectory','error','site','verbose','push','yellow','dim','user','Aborted.','listSegments','get','✔\x20Context\x20set:\x20','\x0aPull\x20summary\x20for\x20\x27','dirname','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','Fetching\x20activations...','Pull\x20child\x20segments\x20to\x20YAML\x20files','attributes','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Found\x20existing\x20tdx.json\x20at:\x20','data','relativePath','hasChanges','cyan','buildIdToEmailMap','join','\x20files\x20to\x20','372939EhiMTh','Resolved\x20parent\x20name:\x20','\x20with\x20','parent_segment','9rjkxgs','Write\x20','relative','add','Fetching\x20users\x20for\x20email\x20resolution...','302450WcffCm','\x20segments','repeat','filter','resolveParentId','\x20=\x20','\x20changed\x20files','34LwUbNH','utf-8','yes','from','✔\x20All\x20files\x20are\x20up\x20to\x20date'];a34_0x310c=function(){return _0x2628c8;};return a34_0x310c();}import{existsSync,mkdirSync,readFileSync,writeFileSync,statSync}from'fs';import a34_0x3170b9 from'path';import{sanitizeFileName}from'../utils/string-utils.js';export class SegmentPullCommand extends BaseCommand{[a34_0x2dc722(0x112)]=a34_0x2dc722(0x11a);[a34_0x2dc722(0x113)]=a34_0x2dc722(0xed);async['execute'](_0x3f482d){const _0x2d69c8=a34_0x2dc722,{options:_0x255eda,args:_0x2dccab,tdx:_0x31ca33}=_0x3f482d,_0x4024e4=_0x255eda,_0xb5fab1=_0x255eda['parentSegment'],_0x41fe64=_0x2dccab[0x0],_0x3de5e8=findTdxConfigPath();let _0x5444b4,_0x4aa94d;if(!_0x41fe64&&_0x3de5e8){const _0x2b8846=loadTdxConfig(_0x3de5e8);_0x5444b4=_0x2b8846[_0x2d69c8(0xfb)],_0x4aa94d=a34_0x3170b9['dirname'](_0x3de5e8),_0x4024e4[_0x2d69c8(0xe0)]&&(console[_0x2d69c8(0xde)](_0x2d69c8(0xf0)+_0x3de5e8),console['error'](_0x2d69c8(0xd9)+_0x5444b4));}else{if(_0x41fe64){if(existsSync(_0x41fe64)&&statSync(_0x41fe64)[_0x2d69c8(0xdd)]()){const _0x4e0164=findTdxConfigPath(_0x41fe64);if(_0x4e0164){const _0x2db533=loadTdxConfig(_0x4e0164);_0x5444b4=_0x2db533[_0x2d69c8(0xfb)],_0x4aa94d=a34_0x3170b9[_0x2d69c8(0xea)](_0x4e0164),_0x4024e4[_0x2d69c8(0xe0)]&&(console[_0x2d69c8(0xde)](_0x2d69c8(0xc6)+_0x4e0164),console[_0x2d69c8(0xde)]('Using\x20parent\x20segment:\x20'+_0x5444b4));}else return console['error'](a34_0x442fa3[_0x2d69c8(0x11d)](_0x2d69c8(0xeb)+_0x41fe64+'\x0a')),console['error'](a34_0x442fa3[_0x2d69c8(0xf4)](_0x2d69c8(0xef))),0x1;}else _0x5444b4=_0x41fe64;}else _0x5444b4=_0xb5fab1;}if(!_0x5444b4)return console[_0x2d69c8(0xde)](a34_0x442fa3[_0x2d69c8(0xe2)](_0x2d69c8(0x10d))),console[_0x2d69c8(0xde)]('Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)'),console[_0x2d69c8(0xde)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent'),console[_0x2d69c8(0xde)](_0x2d69c8(0xcd)),0x1;_0x4024e4[_0x2d69c8(0xe0)]&&(console[_0x2d69c8(0xde)](_0x2d69c8(0xda)+_0x4024e4[_0x2d69c8(0xdf)]),console[_0x2d69c8(0xde)](_0x2d69c8(0x10f)+_0x5444b4));const _0x42fe74=await withSpinner(_0x2d69c8(0xdb)+_0x5444b4+'\x27...',()=>_0x31ca33['segment'][_0x2d69c8(0x105)](_0x5444b4),{'verbose':_0x4024e4['verbose']}),_0xc423a=_0x42fe74[_0x2d69c8(0xf1)],_0x43e3c1=await withSpinner(_0x2d69c8(0x114),()=>_0x31ca33[_0x2d69c8(0x118)][_0x2d69c8(0x117)](_0xc423a),{'verbose':_0x4024e4[_0x2d69c8(0xe0)]}),_0x4028f3=_0x43e3c1[_0x2d69c8(0xf1)][_0x2d69c8(0xee)]['name'];_0x4024e4[_0x2d69c8(0xe0)]&&console[_0x2d69c8(0xde)](_0x2d69c8(0xf9)+_0x4028f3);const [_0x330fee,_0xf9211f]=await Promise['all']([withSpinner(_0x2d69c8(0xcb),()=>_0x31ca33[_0x2d69c8(0x118)][_0x2d69c8(0xe6)](_0xc423a),{'verbose':_0x4024e4[_0x2d69c8(0xe0)]}),withSpinner(_0x2d69c8(0xc8),()=>_0x31ca33[_0x2d69c8(0x118)][_0x2d69c8(0xdc)](_0xc423a),{'verbose':_0x4024e4[_0x2d69c8(0xe0)]})]),_0x5a5135=_0x330fee[_0x2d69c8(0xf1)],_0xc2620=_0xf9211f[_0x2d69c8(0xf1)];if(_0x5a5135[_0x2d69c8(0x11e)]===0x0)return console['error'](a34_0x442fa3['yellow']('No\x20segments\x20found\x20in\x20parent\x20segment\x20\x27'+_0x4028f3+'\x27')),0x0;const _0x5b5f6e=buildFolderPathMap(_0xc2620),_0x403836=_0x4aa94d||getSegmentRootDir(sanitizeFileName(_0x5444b4)),_0xcc0f9a=new Map();await withSpinner(_0x2d69c8(0xec),async()=>{await batchAsync(_0x5a5135,async _0x41badf=>{const _0x4429ee=a34_0x1bf6,_0x28ecbd=await _0x31ca33[_0x4429ee(0x118)]['listActivations'](_0xc423a,_0x41badf['id']);_0xcc0f9a['set'](_0x41badf['id'],_0x28ecbd);});},{'verbose':_0x4024e4[_0x2d69c8(0xe0)]});const _0x3dafbf=await withSpinner(_0x2d69c8(0x100),()=>_0x31ca33[_0x2d69c8(0xe4)][_0x2d69c8(0xf5)](),{'verbose':_0x4024e4[_0x2d69c8(0xe0)]})[_0x2d69c8(0xcf)](_0x2e3eed=>_0x2e3eed[_0x2d69c8(0xf1)]),_0x27835d=await withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',()=>_0x31ca33[_0x2d69c8(0x11b)]['buildIdToNameMap'](),{'verbose':_0x4024e4[_0x2d69c8(0xe0)]})[_0x2d69c8(0xcf)](_0x1b80c0=>_0x1b80c0[_0x2d69c8(0xf1)]),_0x3d8797=[],_0x3b036b=a34_0x3170b9[_0x2d69c8(0xf6)](_0x403836,'tdx.json'),_0x368b09=createTdxConfigContent(_0x4028f3);_0x3d8797[_0x2d69c8(0xe1)](prepareFile(_0x3b036b,_0x368b09,_0x403836));const _0x168102=new Map();for(const _0x28efc4 of _0x5a5135){const _0x2710d4=_0x28efc4[_0x2d69c8(0xd0)]?_0x5b5f6e['get'](_0x28efc4[_0x2d69c8(0xd0)])||'':'',_0x4646d5=_0xcc0f9a[_0x2d69c8(0xe7)](_0x28efc4['id'])||[],_0x670975=segmentWithActivationsToYaml(_0x28efc4,_0x4646d5,undefined,_0x3dafbf,_0x27835d),_0x3c8d8f=_0x2710d4?a34_0x3170b9[_0x2d69c8(0xf6)](_0x403836,_0x2710d4):_0x403836,_0x442d9c=sanitizeFileName(_0x28efc4['name']),_0x3bf1b1=getUniqueFileName(_0x3c8d8f,_0x442d9c,_0x168102),_0xddf23f=a34_0x3170b9['join'](_0x3c8d8f,_0x3bf1b1+_0x2d69c8(0xc9)),_0x12ad87=segmentToYamlString(_0x670975);_0x3d8797[_0x2d69c8(0xe1)](prepareFile(_0xddf23f,_0x12ad87,_0x403836));}const _0x1781c6=Array[_0x2d69c8(0x10b)](_0xcc0f9a[_0x2d69c8(0x116)]())['reduce']((_0x4fce8a,_0xfca90b)=>_0x4fce8a+_0xfca90b[_0x2d69c8(0x11e)],0x0),_0x4a942e=_0x3d8797[_0x2d69c8(0x104)](_0x554f16=>_0x554f16[_0x2d69c8(0xd4)]),_0x374a61=_0x3d8797['filter'](_0x389e09=>!_0x389e09[_0x2d69c8(0xd4)]&&_0x389e09[_0x2d69c8(0xf3)]),_0x24f86a=_0x3d8797[_0x2d69c8(0x104)](_0x3dcdfc=>!_0x3dcdfc['isNew']&&!_0x3dcdfc[_0x2d69c8(0xf3)]);console[_0x2d69c8(0xde)](_0x2d69c8(0xe9)+_0x4028f3+'\x27:'),console[_0x2d69c8(0xde)]('\x20\x20'+a34_0x442fa3['cyan'](_0x5a5135[_0x2d69c8(0x11e)]+_0x2d69c8(0x102))+_0x2d69c8(0xfa)+a34_0x442fa3[_0x2d69c8(0xf4)](_0x1781c6+'\x20activations')),console[_0x2d69c8(0xde)]('\x20\x20'+a34_0x442fa3[_0x2d69c8(0xc7)]('+\x20'+_0x4a942e[_0x2d69c8(0x11e)]+_0x2d69c8(0x11c))),console['error']('\x20\x20'+a34_0x442fa3[_0x2d69c8(0xe2)]('~\x20'+_0x374a61[_0x2d69c8(0x11e)]+_0x2d69c8(0x107))),console['error']('\x20\x20'+a34_0x442fa3[_0x2d69c8(0xe3)]('=\x20'+_0x24f86a[_0x2d69c8(0x11e)]+_0x2d69c8(0xce))),console[_0x2d69c8(0xde)]('\x20\x20Target:\x20'+a34_0x442fa3[_0x2d69c8(0xf4)](_0x403836)+'\x0a');if(_0x374a61['length']>0x0)for(const _0x15dd8f of _0x374a61){console[_0x2d69c8(0xde)](_0x2d69c8(0xd5)+_0x15dd8f[_0x2d69c8(0xf2)]+'\x27:'),console[_0x2d69c8(0xde)]('─'['repeat'](0x3c)),console[_0x2d69c8(0xde)](_0x15dd8f[_0x2d69c8(0xd6)]),console[_0x2d69c8(0xde)]('─'[_0x2d69c8(0x103)](0x3c));}if(_0x4024e4['dryRun'])return console[_0x2d69c8(0xde)](a34_0x442fa3['yellow'](_0x2d69c8(0xd1))),0x0;if(_0x4a942e[_0x2d69c8(0x11e)]===0x0&&_0x374a61[_0x2d69c8(0x11e)]===0x0)return console[_0x2d69c8(0xde)](a34_0x442fa3[_0x2d69c8(0xc7)](_0x2d69c8(0x10c))),saveSessionContext({'parent_segment':_0x4028f3},_0x4024e4['session']),console[_0x2d69c8(0xde)](a34_0x442fa3[_0x2d69c8(0xc7)](_0x2d69c8(0xe8)+a34_0x442fa3[_0x2d69c8(0xe3)]('parent_segment')+_0x2d69c8(0x106)+a34_0x442fa3[_0x2d69c8(0xf4)](_0x4028f3))),0x0;if(!_0x4024e4[_0x2d69c8(0x10a)]&&(_0x4a942e[_0x2d69c8(0x11e)]>0x0||_0x374a61[_0x2d69c8(0x11e)]>0x0)){const _0x89581e=await confirmKey(_0x2d69c8(0xfd)+(_0x4a942e['length']+_0x374a61[_0x2d69c8(0x11e)])+_0x2d69c8(0xcc));if(!_0x89581e)return console[_0x2d69c8(0xde)](_0x2d69c8(0xe5)),0x1;}for(const _0x13a6a0 of _0x3d8797){if(_0x13a6a0[_0x2d69c8(0xd4)]||_0x13a6a0[_0x2d69c8(0xf3)]){const _0x2815d6=a34_0x3170b9[_0x2d69c8(0xea)](_0x13a6a0['absolutePath']);!existsSync(_0x2815d6)&&mkdirSync(_0x2815d6,{'recursive':!![]}),writeFileSync(_0x13a6a0['absolutePath'],_0x13a6a0['content'],_0x2d69c8(0x109));}}return console['error'](a34_0x442fa3[_0x2d69c8(0xc7)]('✔\x20Pulled\x20'+(_0x4a942e[_0x2d69c8(0x11e)]+_0x374a61[_0x2d69c8(0x11e)])+_0x2d69c8(0xf7)+_0x403836)),saveSessionContext({'parent_segment':_0x4028f3},_0x4024e4['session']),console[_0x2d69c8(0xde)](a34_0x442fa3['green'](_0x2d69c8(0xe8)+a34_0x442fa3['dim'](_0x2d69c8(0xfb))+'\x20=\x20'+a34_0x442fa3[_0x2d69c8(0xf4)](_0x4028f3))),0x0;}}function buildFolderPathMap(_0x7ec5f4){const _0x3855cd=a34_0x2dc722,_0x11ff4c=new Map(),_0x2d49b9=new Map();for(const _0x2f0cba of _0x7ec5f4){_0x2d49b9[_0x3855cd(0x10e)](_0x2f0cba['id'],_0x2f0cba);}const _0x30079d=new Set();for(const _0x1b8957 of _0x7ec5f4){!_0x1b8957['parentFolderId']&&_0x30079d[_0x3855cd(0xff)](_0x1b8957['id']);}function _0x12adcd(_0x513141){const _0x10b4d3=_0x3855cd;if(_0x11ff4c[_0x10b4d3(0xd8)](_0x513141['id']))return _0x11ff4c[_0x10b4d3(0xe7)](_0x513141['id']);if(_0x30079d[_0x10b4d3(0xd8)](_0x513141['id']))return _0x11ff4c[_0x10b4d3(0x10e)](_0x513141['id'],''),'';if(_0x513141['parentFolderId']){const _0xb26e66=_0x2d49b9['get'](_0x513141[_0x10b4d3(0x110)]);if(_0xb26e66){const _0x424924=_0x12adcd(_0xb26e66),_0x1b38e7=_0x424924?_0x424924+'/'+_0x513141['name']:_0x513141[_0x10b4d3(0x112)];return _0x11ff4c[_0x10b4d3(0x10e)](_0x513141['id'],_0x1b38e7),_0x1b38e7;}}const _0x34c913=_0x513141[_0x10b4d3(0x112)];return _0x11ff4c[_0x10b4d3(0x10e)](_0x513141['id'],_0x34c913),_0x34c913;}for(const _0xb25dbc of _0x7ec5f4){_0x12adcd(_0xb25dbc);}return _0x11ff4c;}function getUniqueFileName(_0x494c46,_0x435093,_0x52b092){const _0x578fb1=a34_0x2dc722,_0x51fe51=_0x494c46+':'+_0x435093,_0x1d1e19=_0x52b092['get'](_0x51fe51)||0x0;_0x52b092[_0x578fb1(0x10e)](_0x51fe51,_0x1d1e19+0x1);if(_0x1d1e19===0x0)return _0x435093;return _0x435093+'-'+_0x1d1e19;}function prepareFile(_0x184831,_0x336ebb,_0x3c774a){const _0x152d30=a34_0x2dc722,_0x1bc77c=a34_0x3170b9[_0x152d30(0xfe)](_0x3c774a,_0x184831);if(existsSync(_0x184831)){const _0x344998=readFileSync(_0x184831,_0x152d30(0x109)),_0x41590d=generateDiff(_0x344998,_0x336ebb),_0x3931dc=hasChanges(_0x41590d);return{'relativePath':_0x1bc77c,'absolutePath':_0x184831,'content':_0x336ebb,'isNew':![],'hasChanges':_0x3931dc,'diff':_0x3931dc?formatDiffWithColors(_0x41590d):undefined};}return{'relativePath':_0x1bc77c,'absolutePath':_0x184831,'content':_0x336ebb,'isNew':!![],'hasChanges':![]};}
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 +1 @@
1
- const a35_0x29130b=a35_0x276a;(function(_0x4b39ca,_0x27711c){const _0x264f52=a35_0x276a,_0x29da37=_0x4b39ca();while(!![]){try{const _0xa5b55a=-parseInt(_0x264f52(0x134))/0x1+-parseInt(_0x264f52(0x167))/0x2+parseInt(_0x264f52(0x183))/0x3+-parseInt(_0x264f52(0x12d))/0x4+parseInt(_0x264f52(0x1a7))/0x5+parseInt(_0x264f52(0x169))/0x6*(parseInt(_0x264f52(0x142))/0x7)+parseInt(_0x264f52(0x1a2))/0x8;if(_0xa5b55a===_0x27711c)break;else _0x29da37['push'](_0x29da37['shift']());}catch(_0x30324a){_0x29da37['push'](_0x29da37['shift']());}}}(a35_0x9d10,0x212f9));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_0x373642 from'chalk';function a35_0x276a(_0x3c8ab8,_0x3bf111){_0x3c8ab8=_0x3c8ab8-0x12a;const _0x9d1012=a35_0x9d10();let _0x276a51=_0x9d1012[_0x3c8ab8];return _0x276a51;}import{existsSync,readFileSync,statSync,readdirSync}from'fs';import a35_0x2a4ccd from'path';import*as a35_0x1e7dc1 from'yaml';import{sanitizeFileName}from'../utils/string-utils.js';function tryFindTdxConfig(_0x5139ee){try{return findTdxConfig(_0x5139ee);}catch{return null;}}function resolveTDFolderPath(_0x56343c,_0x215ccd,_0x411a98){if(!_0x215ccd)return _0x56343c;return _0x56343c?_0x411a98+'/'+_0x56343c:_0x411a98;}export class SegmentPushCommand extends BaseCommand{['name']=a35_0x29130b(0x192);['description']='Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments';async[a35_0x29130b(0x148)](_0x1ecbfd){const _0x24b992=a35_0x29130b,{options:_0x4ef750,args:_0x33d616,tdx:_0xab5019}=_0x1ecbfd,_0x531843=_0x4ef750,_0x3489d0=_0x4ef750[_0x24b992(0x188)],_0x1c05da=_0x33d616[0x0];let _0x487d84,_0x37faac,_0x341d82,_0x1eca48;if(_0x1c05da){if(existsSync(_0x1c05da)&&statSync(_0x1c05da)[_0x24b992(0x16e)]()){const _0x49578e=tryFindTdxConfig(_0x1c05da);if(_0x49578e)_0x487d84=_0x49578e['config'][_0x24b992(0x17f)],_0x37faac=_0x1c05da,_0x341d82=_0x49578e[_0x24b992(0x144)];else return console[_0x24b992(0x19b)](a35_0x373642[_0x24b992(0x13d)](_0x24b992(0x193)+_0x1c05da+'\x0a')),console[_0x24b992(0x19b)](a35_0x373642[_0x24b992(0x13b)](_0x24b992(0x149))),0x1;}else{if(existsSync(_0x1c05da)&&statSync(_0x1c05da)['isFile']()){const _0x4033c8=a35_0x2a4ccd[_0x24b992(0x138)](_0x1c05da),_0xaa2786=tryFindTdxConfig(_0x4033c8);if(_0xaa2786)_0x487d84=_0xaa2786[_0x24b992(0x12a)][_0x24b992(0x17f)],_0x341d82=_0xaa2786[_0x24b992(0x144)],_0x37faac=_0xaa2786[_0x24b992(0x144)],_0x1eca48=a35_0x2a4ccd[_0x24b992(0x186)](_0x1c05da);else return console['error'](a35_0x373642[_0x24b992(0x13d)](_0x24b992(0x193)+_0x4033c8+'\x0a')),console[_0x24b992(0x19b)](a35_0x373642[_0x24b992(0x13b)](_0x24b992(0x149))),0x1;}else _0x487d84=_0x1c05da;}}else{const _0x4329c6=tryFindTdxConfig(process[_0x24b992(0x141)]());_0x4329c6?(_0x487d84=_0x4329c6[_0x24b992(0x12a)][_0x24b992(0x17f)],_0x37faac=process[_0x24b992(0x141)](),_0x341d82=_0x4329c6['configDir']):_0x487d84=_0x3489d0;}if(!_0x487d84)return console[_0x24b992(0x19b)](a35_0x373642[_0x24b992(0x19a)](_0x24b992(0x151))),console[_0x24b992(0x19b)](_0x24b992(0x131)),console[_0x24b992(0x19b)](_0x24b992(0x176)),console['error'](_0x24b992(0x159)),0x1;const _0x57c97d=_0x37faac||getSegmentRootDir(sanitizeFileName(_0x487d84)),_0x153a17=_0x341d82||_0x57c97d,_0x21f71e=a35_0x2a4ccd[_0x24b992(0x139)](_0x153a17,_0x57c97d),_0x48d14e=_0x21f71e!==''&&_0x21f71e!=='.';if(!existsSync(_0x57c97d))return console[_0x24b992(0x19b)](a35_0x373642['red']('Error:\x20Directory\x20not\x20found:\x20'+_0x57c97d+'\x0a')),console['error'](a35_0x373642[_0x24b992(0x13b)](_0x24b992(0x149))),0x1;_0x531843[_0x24b992(0x135)]&&(console[_0x24b992(0x19b)](_0x24b992(0x164)+_0x531843['site']),console['error'](_0x24b992(0x1aa)+_0x487d84),console[_0x24b992(0x19b)](_0x24b992(0x157)+_0x57c97d),_0x48d14e&&console['error'](_0x24b992(0x14f)+_0x21f71e));const _0x16740c=await withSpinner(_0x24b992(0x146)+_0x487d84+_0x24b992(0x16f),()=>_0xab5019['segment'][_0x24b992(0x13a)](_0x487d84),{'verbose':_0x531843['verbose']}),_0x103046=_0x16740c[_0x24b992(0x1a0)],[_0xa21e21,_0x44d2e1,_0x4eea1a]=await Promise[_0x24b992(0x14b)]([withSpinner(_0x24b992(0x15f),()=>_0xab5019['segment'][_0x24b992(0x14c)](_0x103046),{'verbose':_0x531843[_0x24b992(0x135)]}),withSpinner(_0x24b992(0x170),()=>_0xab5019[_0x24b992(0x16b)][_0x24b992(0x15c)](_0x103046),{'verbose':_0x531843[_0x24b992(0x135)]}),withSpinner(_0x24b992(0x17c),()=>_0xab5019[_0x24b992(0x174)][_0x24b992(0x152)](),{'verbose':_0x531843[_0x24b992(0x135)]})[_0x24b992(0x1b1)](_0xcb90b5=>_0xcb90b5[_0x24b992(0x1a0)])]),_0x23f22b=_0xa21e21[_0x24b992(0x1a0)],_0x4be813=_0x44d2e1[_0x24b992(0x1a0)],{emailToId:_0x1917aa,idToEmail:_0x1ee7d6}=_0x4eea1a,[_0x3faad8,_0xe31eda]=await withSpinner(_0x24b992(0x15e),async()=>{const _0x5732b6=_0x24b992,[_0x4f9f9c,_0x446bf4]=await Promise['all']([_0xab5019[_0x5732b6(0x1a3)]['buildNameToIdMap'](),_0xab5019[_0x5732b6(0x1a3)][_0x5732b6(0x1a4)]()]);return[_0x4f9f9c,_0x446bf4];},{'verbose':_0x531843[_0x24b992(0x135)]})[_0x24b992(0x1b1)](_0x46d9a4=>_0x46d9a4[_0x24b992(0x1a0)]),_0x5ccd75=buildFolderPathToIdMap(_0x4be813),_0x44f33c=new Map();for(const [_0x50cac4,_0x2dacdb]of _0x5ccd75[_0x24b992(0x190)]()){_0x44f33c['set'](_0x2dacdb,_0x50cac4);}const _0x249f7c=new Map();for(const _0x5a83f3 of _0x23f22b){const _0x54d52d=_0x5a83f3[_0x24b992(0x132)]?_0x44f33c['get'](_0x5a83f3[_0x24b992(0x132)][_0x24b992(0x196)]())||'':'',_0x24725d=_0x54d52d+':'+_0x5a83f3[_0x24b992(0x1a9)];_0x249f7c['set'](_0x24725d,_0x5a83f3);}let _0xccc15f;if(_0x1eca48){if(!_0x1eca48['endsWith'](_0x24b992(0x143))&&!_0x1eca48[_0x24b992(0x179)]('.yaml'))return console[_0x24b992(0x19b)](a35_0x373642[_0x24b992(0x13d)](_0x24b992(0x189)+_0x1eca48+'\x0a')),0x1;_0xccc15f=[_0x1eca48];}else _0xccc15f=findYamlFiles(_0x57c97d);if(_0xccc15f[_0x24b992(0x161)]===0x0)return console['error'](a35_0x373642[_0x24b992(0x13d)](_0x24b992(0x154)+_0x57c97d+'\x0a')),console['error'](a35_0x373642['cyan']('Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20files')),0x1;const _0xbd8608=[];for(const _0x5890ef of _0xccc15f){const _0x14c008=a35_0x2a4ccd[_0x24b992(0x139)](_0x57c97d,a35_0x2a4ccd[_0x24b992(0x138)](_0x5890ef)),_0x19d083=_0x14c008==='.'?'':_0x14c008,_0x2d9535=readFileSync(_0x5890ef,'utf-8');try{const _0x19d88d=parseSegmentYamlFile(_0x2d9535),_0x59f2f1=normalizeChildSegmentYaml(_0x19d88d);_0xbd8608[_0x24b992(0x18c)]({'yamlConfig':_0x59f2f1,'folderPath':_0x19d083,'sourcePath':_0x5890ef});}catch(_0x54c657){return console[_0x24b992(0x19b)](a35_0x373642['red'](_0x24b992(0x136)+_0x5890ef+':\x20'+(_0x54c657 instanceof Error?_0x54c657[_0x24b992(0x133)]:_0x54c657))),0x1;}}if(_0xbd8608['length']===0x0)return console[_0x24b992(0x19b)](a35_0x373642[_0x24b992(0x19a)](_0x24b992(0x13c))),0x0;const _0xeb9944=new Map();_0x23f22b[_0x24b992(0x161)]>0x0&&await withSpinner(_0x24b992(0x18b),async()=>{await batchAsync(_0x23f22b,async _0x2856f1=>{const _0x5914a1=await _0xab5019['segment']['listActivations'](_0x103046,_0x2856f1['id']);_0xeb9944['set'](_0x2856f1['id'],_0x5914a1);});},{'verbose':_0x531843[_0x24b992(0x135)]});const _0x1f9bd8=[],_0x370d83=new Set();for(const {yamlConfig:_0x553750,folderPath:_0x188919,sourcePath:_0x2b4090}of _0xbd8608){const _0x114484=resolveTDFolderPath(_0x188919,_0x48d14e,_0x21f71e),_0x104854=_0x114484+':'+_0x553750[_0x24b992(0x1a9)],_0x1d1e40=_0x249f7c[_0x24b992(0x177)](_0x104854),_0x3ab296=_0x1d1e40?_0xeb9944[_0x24b992(0x177)](_0x1d1e40['id'])||[]:[];if(_0x114484&&!_0x5ccd75[_0x24b992(0x195)](_0x114484)){const _0x4a730c=_0x114484[_0x24b992(0x172)]('/');let _0x5cdbab='';for(const _0x4b907a of _0x4a730c){_0x5cdbab=_0x5cdbab?_0x5cdbab+'/'+_0x4b907a:_0x4b907a,!_0x5ccd75[_0x24b992(0x195)](_0x5cdbab)&&_0x370d83['add'](_0x5cdbab);}}const _0x4fe3c8=calculateActivationActions(_0x553750[_0x24b992(0x1a5)]||[],_0x3ab296,_0x1ee7d6,_0xe31eda),_0x2e90b7=segmentToYamlString(_0x553750);let _0x245e7c,_0x42a3c2=![],_0x5f294c;if(_0x1d1e40){const _0x57b414=segmentWithActivationsToYaml(_0x1d1e40,_0x3ab296,undefined,_0x1ee7d6,_0xe31eda),_0x5b1ae5=segmentToYamlString(_0x57b414);_0x245e7c=generateDiff(_0x5b1ae5,_0x2e90b7),_0x42a3c2=hasChanges(_0x245e7c),_0x42a3c2&&(_0x5f294c=formatDiffWithColors(_0x245e7c));}else _0x245e7c=generateDiff('',_0x2e90b7),_0x5f294c=formatDiffWithColors(_0x245e7c);_0x1f9bd8[_0x24b992(0x18c)]({'relativePath':_0x553750[_0x24b992(0x1a9)],'absolutePath':_0x2b4090,'yamlConfig':_0x553750,'folderPath':_0x114484,'existingSegment':_0x1d1e40,'existingActivations':_0x3ab296,'isNew':!_0x1d1e40,'hasChanges':_0x42a3c2,'diff':_0x5f294c,'activationActions':_0x4fe3c8});}let _0x21c5eb=[];if(!_0x1eca48){const _0xd29696=new Set();for(const {yamlConfig:_0x4e8821,folderPath:_0x2151b6}of _0xbd8608){const _0x133c36=resolveTDFolderPath(_0x2151b6,_0x48d14e,_0x21f71e);_0xd29696[_0x24b992(0x1a8)](_0x133c36+':'+_0x4e8821[_0x24b992(0x1a9)]);}_0x21c5eb=_0x23f22b[_0x24b992(0x181)](_0x49e007=>{const _0x4ef7d0=_0x24b992,_0x28da6e=_0x49e007[_0x4ef7d0(0x132)]?_0x44f33c[_0x4ef7d0(0x177)](_0x49e007[_0x4ef7d0(0x132)][_0x4ef7d0(0x196)]())||'':'',_0x5a45e8=_0x28da6e+':'+_0x49e007[_0x4ef7d0(0x1a9)];if(_0xd29696[_0x4ef7d0(0x195)](_0x5a45e8))return![];if(_0x48d14e)return _0x28da6e===_0x21f71e||_0x28da6e[_0x4ef7d0(0x12c)](_0x21f71e+'/');return!![];});}const _0x4a2779=_0x1f9bd8[_0x24b992(0x181)](_0x45fef7=>_0x45fef7[_0x24b992(0x18d)]),_0x3538e7=_0x1f9bd8[_0x24b992(0x181)](_0x19e77c=>!_0x19e77c[_0x24b992(0x18d)]&&_0x19e77c[_0x24b992(0x166)]),_0x1bd557=_0x1f9bd8['filter'](_0x35565d=>!_0x35565d[_0x24b992(0x18d)]&&!_0x35565d[_0x24b992(0x166)]),_0x5d9ad9=Array['from'](_0x370d83)['sort'](),_0x31775a=_0x531843[_0x24b992(0x14d)]?_0x21c5eb:[],_0x47365c=_0x1f9bd8[_0x24b992(0x1a1)](_0x16e321=>_0x16e321[_0x24b992(0x1b2)]),_0x23e0ce=_0x47365c[_0x24b992(0x181)](_0x202847=>_0x202847[_0x24b992(0x14a)]===_0x24b992(0x13f)),_0x2dfb8a=_0x47365c[_0x24b992(0x181)](_0xc93a7c=>_0xc93a7c['type']===_0x24b992(0x171)),_0x60ee1c=_0x47365c[_0x24b992(0x181)](_0x495b92=>_0x495b92[_0x24b992(0x14a)]==='delete');console[_0x24b992(0x19b)](_0x24b992(0x19f)+_0x487d84+'\x27:');_0x5d9ad9[_0x24b992(0x161)]>0x0&&console[_0x24b992(0x19b)]('\x20\x20'+a35_0x373642[_0x24b992(0x1ad)](_0x24b992(0x17d)+_0x5d9ad9[_0x24b992(0x161)]+'\x20folders\x20to\x20create'));console['error']('\x20\x20'+a35_0x373642[_0x24b992(0x150)]('+\x20'+_0x4a2779[_0x24b992(0x161)]+_0x24b992(0x19e))),console[_0x24b992(0x19b)]('\x20\x20'+a35_0x373642[_0x24b992(0x19a)]('~\x20'+_0x3538e7[_0x24b992(0x161)]+'\x20changed\x20segments'));if(_0x31775a['length']>0x0)console['error']('\x20\x20'+a35_0x373642[_0x24b992(0x13d)]('-\x20'+_0x31775a[_0x24b992(0x161)]+_0x24b992(0x156)));else _0x21c5eb[_0x24b992(0x161)]>0x0&&!_0x531843[_0x24b992(0x14d)]&&console[_0x24b992(0x19b)]('\x20\x20'+a35_0x373642[_0x24b992(0x1af)]('\x20\x20'+_0x21c5eb[_0x24b992(0x161)]+'\x20segments\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console['error']('\x20\x20'+a35_0x373642[_0x24b992(0x1af)]('=\x20'+_0x1bd557['length']+'\x20unchanged\x20segments'));_0x47365c['length']>0x0&&(console[_0x24b992(0x19b)](''),console[_0x24b992(0x19b)](_0x24b992(0x1ae)),_0x23e0ce[_0x24b992(0x161)]>0x0&&console['error'](_0x24b992(0x19c)+a35_0x373642[_0x24b992(0x150)]('+\x20'+_0x23e0ce[_0x24b992(0x161)]+_0x24b992(0x175))),_0x2dfb8a[_0x24b992(0x161)]>0x0&&console['error'](_0x24b992(0x19c)+a35_0x373642['yellow']('~\x20'+_0x2dfb8a[_0x24b992(0x161)]+'\x20to\x20update')),_0x60ee1c['length']>0x0&&console[_0x24b992(0x19b)]('\x20\x20\x20\x20'+a35_0x373642['red']('-\x20'+_0x60ee1c[_0x24b992(0x161)]+_0x24b992(0x160))));console[_0x24b992(0x19b)](_0x24b992(0x145)+a35_0x373642[_0x24b992(0x13b)](_0x57c97d)+'\x0a');if(_0x5d9ad9[_0x24b992(0x161)]>0x0){console[_0x24b992(0x19b)](_0x24b992(0x180));for(const _0x9db5c5 of _0x5d9ad9){console[_0x24b992(0x19b)]('\x20\x20'+a35_0x373642[_0x24b992(0x1ad)]('+')+'\x20'+_0x9db5c5);}console[_0x24b992(0x19b)]('');}if(_0x4a2779[_0x24b992(0x161)]>0x0)for(const _0x20bc0f of _0x4a2779){const _0x4ab1aa=_0x20bc0f['folderPath']?_0x20bc0f[_0x24b992(0x158)]+'/'+_0x20bc0f[_0x24b992(0x15b)]['name']:_0x20bc0f[_0x24b992(0x15b)]['name'],_0x369204=_0x20bc0f['yamlConfig'][_0x24b992(0x1a5)]?.[_0x24b992(0x161)]||0x0,_0x151411=_0x369204>0x0?a35_0x373642[_0x24b992(0x1af)]('\x20['+_0x369204+_0x24b992(0x187)):'';console[_0x24b992(0x19b)]('\x0a'+a35_0x373642[_0x24b992(0x150)](_0x24b992(0x162))+'\x20'+_0x4ab1aa+_0x151411),console[_0x24b992(0x19b)]('─'[_0x24b992(0x17b)](0x3c)),_0x20bc0f[_0x24b992(0x1a6)]&&console[_0x24b992(0x19b)](_0x20bc0f[_0x24b992(0x1a6)]),console[_0x24b992(0x19b)]('─'['repeat'](0x3c));}if(_0x31775a[_0x24b992(0x161)]>0x0)for(const _0x50a113 of _0x31775a){const _0x1ec4c0=_0x50a113[_0x24b992(0x132)]?_0x44f33c[_0x24b992(0x177)](_0x50a113[_0x24b992(0x132)]['toString']())||'':'',_0x1b4f5e=_0x1ec4c0?_0x1ec4c0+'/'+_0x50a113[_0x24b992(0x1a9)]:_0x50a113['name'],_0x5786b8=_0xeb9944[_0x24b992(0x177)](_0x50a113['id'])||[],_0x563bda=_0x5786b8[_0x24b992(0x161)]>0x0?a35_0x373642['dim']('\x20['+_0x5786b8[_0x24b992(0x161)]+_0x24b992(0x187)):'';console['error']('\x0a'+a35_0x373642[_0x24b992(0x13d)](_0x24b992(0x165))+'\x20'+_0x1b4f5e+_0x563bda),console[_0x24b992(0x19b)]('─'[_0x24b992(0x17b)](0x3c));const _0x32de34=segmentWithActivationsToYaml(_0x50a113,_0x5786b8,undefined,_0x1ee7d6,_0xe31eda),_0x2a8308=segmentToYamlString(_0x32de34),_0x1b137e=generateDiff(_0x2a8308,'');console['error'](formatDiffWithColors(_0x1b137e)),console['error']('─'[_0x24b992(0x17b)](0x3c));}const _0x40d82e=_0x1f9bd8[_0x24b992(0x181)](_0x292124=>!_0x292124[_0x24b992(0x18d)]&&_0x292124[_0x24b992(0x1a6)]);if(_0x40d82e[_0x24b992(0x161)]>0x0)for(const _0x2170c0 of _0x40d82e){const _0x4e1fc5=_0x2170c0[_0x24b992(0x158)]?_0x2170c0[_0x24b992(0x158)]+'/'+_0x2170c0['yamlConfig'][_0x24b992(0x1a9)]:_0x2170c0['yamlConfig'][_0x24b992(0x1a9)];console['error']('\x0a'+a35_0x373642[_0x24b992(0x19a)](_0x24b992(0x15d))+'\x20'+_0x4e1fc5),console[_0x24b992(0x19b)]('─'[_0x24b992(0x17b)](0x3c)),console[_0x24b992(0x19b)](_0x2170c0[_0x24b992(0x1a6)]),console['error']('─'[_0x24b992(0x17b)](0x3c));}if(_0x531843[_0x24b992(0x13e)])return console[_0x24b992(0x19b)](a35_0x373642[_0x24b992(0x19a)]('\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made')),0x0;const _0x320aa6=_0x4a2779[_0x24b992(0x161)]>0x0||_0x3538e7[_0x24b992(0x161)]>0x0||_0x31775a['length']>0x0,_0x232fb6=_0x47365c[_0x24b992(0x161)]>0x0,_0x4df7a6=_0x5d9ad9[_0x24b992(0x161)]>0x0;if(!_0x320aa6&&!_0x232fb6&&!_0x4df7a6)return console[_0x24b992(0x19b)](a35_0x373642[_0x24b992(0x150)]('✔\x20All\x20segments\x20and\x20activations\x20are\x20up\x20to\x20date')),0x0;const _0x1a7dcc=_0x4a2779['length']+_0x3538e7[_0x24b992(0x161)]+_0x31775a['length']+_0x5d9ad9[_0x24b992(0x161)]+_0x47365c['length'];if(!_0x531843['yes']&&_0x1a7dcc>0x0){const _0x388ff8=await confirmKey('Push\x20'+_0x1a7dcc+'\x20changes?');if(!_0x388ff8)return console[_0x24b992(0x19b)](_0x24b992(0x182)),0x1;}for(const _0x1c0dff of _0x5d9ad9){const _0x5c3fb2=_0x1c0dff['split']('/'),_0x11a80e=_0x5c3fb2[_0x5c3fb2['length']-0x1],_0x24a368=_0x5c3fb2['slice'](0x0,-0x1)[_0x24b992(0x18e)]('/'),_0xbd9b97=_0x5ccd75[_0x24b992(0x177)](_0x24a368),_0x57277b={'name':_0x11a80e,'parentFolderId':_0xbd9b97},_0x4e34b3=await withSpinner(_0x24b992(0x199)+_0x1c0dff+_0x24b992(0x16f),()=>_0xab5019[_0x24b992(0x16b)][_0x24b992(0x16a)](_0x103046,_0x57277b),{'verbose':_0x531843['verbose']});_0x5ccd75[_0x24b992(0x153)](_0x1c0dff,_0x4e34b3[_0x24b992(0x1a0)]['id']),console[_0x24b992(0x19b)](a35_0x373642[_0x24b992(0x1ad)]('✔\x20Created\x20folder\x20\x27'+_0x1c0dff+'\x27'));}let _0x108e1a=0x0,_0x323fe7=0x0,_0xbc5d60=0x0,_0x59e2a9=0x0,_0x3c010d=0x0,_0x3b7a0d=0x0;const _0x1c7528=new Map();for(const _0xebd59f of _0x1f9bd8){const _0x4da3e6=_0xebd59f[_0x24b992(0x158)]?_0x5ccd75[_0x24b992(0x177)](_0xebd59f['folderPath']):undefined;let _0x35bd9a;try{if(_0xebd59f[_0x24b992(0x18d)]){const _0x4d72e2=yamlToCreateRequest(_0xebd59f['yamlConfig'],_0x4da3e6),_0x2b0681=await withSpinner(_0x24b992(0x147)+_0xebd59f[_0x24b992(0x15b)]['name']+'\x27...',()=>_0xab5019[_0x24b992(0x16b)][_0x24b992(0x155)](_0x103046,_0x4d72e2),{'verbose':_0x531843[_0x24b992(0x135)]});_0x35bd9a=_0x2b0681[_0x24b992(0x1a0)]['id'],_0x1c7528[_0x24b992(0x153)](_0xebd59f[_0x24b992(0x15b)][_0x24b992(0x1a9)],_0x35bd9a),console[_0x24b992(0x19b)](a35_0x373642[_0x24b992(0x150)]('✔\x20Created\x20segment\x20\x27'+_0xebd59f[_0x24b992(0x15b)][_0x24b992(0x1a9)]+'\x27')),_0x108e1a++;}else{if(_0xebd59f[_0x24b992(0x166)]){const _0x5e640b=yamlToUpdateRequest(_0xebd59f['yamlConfig']);_0x4da3e6!==_0xebd59f[_0x24b992(0x15a)]?.[_0x24b992(0x132)]&&(_0x5e640b['segmentFolderId']=_0x4da3e6?parseInt(_0x4da3e6,0xa):undefined),await withSpinner(_0x24b992(0x198)+_0xebd59f[_0x24b992(0x15b)][_0x24b992(0x1a9)]+_0x24b992(0x16f),()=>_0xab5019[_0x24b992(0x16b)][_0x24b992(0x185)](_0x103046,_0xebd59f[_0x24b992(0x15a)]['id'],_0x5e640b),{'verbose':_0x531843[_0x24b992(0x135)]}),_0x35bd9a=_0xebd59f[_0x24b992(0x15a)]['id'],console[_0x24b992(0x19b)](a35_0x373642[_0x24b992(0x19a)](_0x24b992(0x12f)+_0xebd59f[_0x24b992(0x15b)]['name']+'\x27')),_0x323fe7++;}else _0x35bd9a=_0xebd59f[_0x24b992(0x15a)]['id'];}}catch(_0x163837){const _0x2eab96=isHttp400Error(_0x163837),_0x4f952c=_0x2eab96?ErrorCode[_0x24b992(0x191)]:ErrorCode[_0x24b992(0x173)],_0x164750=getErrorMessage(_0x163837);throw new SDKError(_0x4f952c,_0x24b992(0x137)+(_0xebd59f[_0x24b992(0x18d)]?_0x24b992(0x13f):_0x24b992(0x171))+_0x24b992(0x18a)+_0xebd59f[_0x24b992(0x184)]+_0x24b992(0x163)+_0x164750,_0x163837);}for(const _0x411f38 of _0xebd59f[_0x24b992(0x1b2)]){try{if(_0x411f38[_0x24b992(0x14a)]===_0x24b992(0x13f)&&_0x411f38[_0x24b992(0x17a)]){const _0x27f8a5=yamlActivationToCreateRequest(_0x411f38[_0x24b992(0x17a)],_0x1917aa,_0x3faad8);await withSpinner(_0x24b992(0x14e)+_0x411f38[_0x24b992(0x1a9)]+_0x24b992(0x16f),()=>_0xab5019[_0x24b992(0x16b)]['createActivation'](_0x103046,_0x35bd9a,_0x27f8a5),{'verbose':_0x531843['verbose']}),console[_0x24b992(0x19b)](a35_0x373642['green'](_0x24b992(0x1b0)+_0x411f38['name']+'\x27')),_0x59e2a9++;}else{if(_0x411f38['type']==='update'&&_0x411f38['yamlActivation']&&_0x411f38['existingActivation']){const _0x314355=yamlActivationToUpdateRequest(_0x411f38[_0x24b992(0x17a)],_0x1917aa,_0x3faad8);await withSpinner('Updating\x20activation\x20\x27'+_0x411f38[_0x24b992(0x1a9)]+_0x24b992(0x16f),()=>_0xab5019[_0x24b992(0x16b)]['updateActivation'](_0x103046,_0x35bd9a,_0x411f38['existingActivation']['id'],_0x314355),{'verbose':_0x531843['verbose']}),console[_0x24b992(0x19b)](a35_0x373642['yellow'](_0x24b992(0x1ab)+_0x411f38[_0x24b992(0x1a9)]+'\x27')),_0x3c010d++;}else _0x411f38[_0x24b992(0x14a)]===_0x24b992(0x14d)&&_0x411f38[_0x24b992(0x130)]&&(await withSpinner(_0x24b992(0x197)+_0x411f38[_0x24b992(0x1a9)]+_0x24b992(0x16f),()=>_0xab5019[_0x24b992(0x16b)][_0x24b992(0x168)](_0x103046,_0x35bd9a,_0x411f38[_0x24b992(0x130)]['id']),{'verbose':_0x531843[_0x24b992(0x135)]}),console[_0x24b992(0x19b)](a35_0x373642['red']('\x20\x20✔\x20Deleted\x20activation\x20\x27'+_0x411f38[_0x24b992(0x1a9)]+'\x27')),_0x3b7a0d++);}}catch(_0x5ddb47){const _0x122cf9=isHttp400Error(_0x5ddb47),_0x584bac=_0x122cf9?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode[_0x24b992(0x18f)],_0x4ef65e=getErrorMessage(_0x5ddb47);throw new SDKError(_0x584bac,_0x24b992(0x137)+_0x411f38[_0x24b992(0x14a)]+'\x20activation\x20\x27'+_0x411f38[_0x24b992(0x1a9)]+_0x24b992(0x12b)+_0xebd59f[_0x24b992(0x184)]+'\x0a\x20\x20'+_0x4ef65e,_0x5ddb47);}}}for(const _0x2f044c of _0x31775a){await withSpinner('Deleting\x20segment\x20\x27'+_0x2f044c[_0x24b992(0x1a9)]+_0x24b992(0x16f),()=>_0xab5019[_0x24b992(0x16b)][_0x24b992(0x16c)](_0x2f044c['id']),{'verbose':_0x531843['verbose']}),console[_0x24b992(0x19b)](a35_0x373642[_0x24b992(0x13d)](_0x24b992(0x12e)+_0x2f044c['name']+'\x27')),_0xbc5d60++;}const _0x8d0516=[];if(_0x108e1a>0x0)_0x8d0516[_0x24b992(0x18c)](_0x108e1a+_0x24b992(0x194));if(_0x323fe7>0x0)_0x8d0516[_0x24b992(0x18c)](_0x323fe7+_0x24b992(0x16d));if(_0xbc5d60>0x0)_0x8d0516['push'](_0xbc5d60+'\x20deleted');const _0x40e445=[];if(_0x59e2a9>0x0)_0x40e445[_0x24b992(0x18c)](_0x59e2a9+_0x24b992(0x194));if(_0x3c010d>0x0)_0x40e445[_0x24b992(0x18c)](_0x3c010d+_0x24b992(0x16d));if(_0x3b7a0d>0x0)_0x40e445[_0x24b992(0x18c)](_0x3b7a0d+_0x24b992(0x1ac));return console[_0x24b992(0x19b)](a35_0x373642[_0x24b992(0x150)]('\x0a✔\x20Push\x20complete')),_0x8d0516[_0x24b992(0x161)]>0x0&&console[_0x24b992(0x19b)](_0x24b992(0x19d)+_0x8d0516[_0x24b992(0x18e)](',\x20')),_0x40e445['length']>0x0&&console[_0x24b992(0x19b)](_0x24b992(0x178)+_0x40e445[_0x24b992(0x18e)](',\x20')),0x0;}}function buildFolderPathToIdMap(_0x17447d){const _0x4097b3=a35_0x29130b,_0x57946a=new Map(),_0x41a1a3=new Map();for(const _0x167b62 of _0x17447d){_0x41a1a3[_0x4097b3(0x153)](_0x167b62['id'],_0x167b62);}const _0x59e4e5=new Set();for(const _0x4708b3 of _0x17447d){!_0x4708b3[_0x4097b3(0x17e)]&&_0x59e4e5['add'](_0x4708b3['id']);}function _0x44a4d1(_0x2ae8d9){const _0x325448=_0x4097b3;if(_0x59e4e5[_0x325448(0x195)](_0x2ae8d9['id']))return'';if(_0x2ae8d9[_0x325448(0x17e)]){const _0x2b8f26=_0x41a1a3['get'](_0x2ae8d9[_0x325448(0x17e)]);if(_0x2b8f26){const _0x26a30d=_0x44a4d1(_0x2b8f26);return _0x26a30d?_0x26a30d+'/'+_0x2ae8d9[_0x325448(0x1a9)]:_0x2ae8d9[_0x325448(0x1a9)];}}return _0x2ae8d9[_0x325448(0x1a9)];}for(const _0x4b206a of _0x17447d){const _0x483659=_0x44a4d1(_0x4b206a);_0x57946a[_0x4097b3(0x153)](_0x483659,_0x4b206a['id']);}return _0x57946a;}function a35_0x9d10(){const _0x6d78de=['159660HYRGhC','deleteActivation','258OSbhPP','createFolder','segment','deleteSegment','\x20updated','isDirectory','\x27...','Fetching\x20existing\x20folders...','update','split','SEGMENT_UPDATE_ERROR','user','\x20to\x20create','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','get','\x20\x20Activations:\x20','endsWith','yamlActivation','repeat','Fetching\x20users\x20for\x20email\x20resolution...','📁\x20','parentFolderId','parent_segment','Folders\x20to\x20create:','filter','Aborted.','121509SQDawr','absolutePath','updateSegmentById','resolve','\x20activations]','parentSegment','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','\x20segment\x20from\x20file:\x20','Fetching\x20existing\x20activations...','push','isNew','join','ACTIVATION_UPDATE_ERROR','entries','SEGMENT_SYNTAX_ERROR','segment:push','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','\x20created','has','toString','Deleting\x20activation\x20\x27','Updating\x20segment\x20\x27','Creating\x20folder\x20\x27','yellow','error','\x20\x20\x20\x20','\x20\x20Segments:\x20','\x20new\x20segments','\x0aPush\x20summary\x20for\x20\x27','data','flatMap','3047440MlWCKp','connection','buildIdToNameMap','activations','diff','68600nDcvhk','add','name','Parent\x20segment:\x20','\x20\x20✔\x20Updated\x20activation\x20\x27','\x20deleted','blue','\x20\x20Activations:','dim','\x20\x20✔\x20Created\x20activation\x20\x27','then','activationActions','config','\x27\x20from\x20file:\x20','startsWith','321436zPJOjX','✔\x20Deleted\x20segment\x20\x27','✔\x20Updated\x20segment\x20\x27','existingActivation','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)','segmentFolderId','message','208136qLRblO','verbose','Error\x20parsing\x20','Failed\x20to\x20','dirname','relative','resolveParentId','cyan','No\x20segment\x20YAML\x20files\x20found','red','dryRun','create','stringify','cwd','11249ipXOCu','.yml','configDir','\x20\x20Source:\x20','Resolving\x20parent\x20segment\x20\x27','Creating\x20segment\x20\x27','execute','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','type','all','listSegments','delete','Creating\x20activation\x20\x27','Scoped\x20to\x20folder:\x20','green','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','buildUserMaps','set','Error:\x20No\x20segment\x20YAML\x20files\x20found\x20in\x20','createSegment','\x20segments\x20to\x20delete','Source\x20directory:\x20','folderPath','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','existingSegment','yamlConfig','listFolders','Changes\x20to:','Fetching\x20connections\x20for\x20name\x20resolution...','Fetching\x20existing\x20segments...','\x20to\x20delete','length','New\x20segment:','\x0a\x20\x20','Site:\x20','Delete\x20segment:','hasChanges'];a35_0x9d10=function(){return _0x6d78de;};return a35_0x9d10();}function findYamlFiles(_0x2e4364){const _0x1fd1ce=[];function _0x1d0f83(_0x5e874a){const _0x4d50c5=a35_0x276a,_0x490ded=readdirSync(_0x5e874a,{'withFileTypes':!![]});for(const _0x6dc816 of _0x490ded){const _0x5eb2c8=a35_0x2a4ccd[_0x4d50c5(0x18e)](_0x5e874a,_0x6dc816['name']);if(_0x6dc816[_0x4d50c5(0x16e)]())_0x1d0f83(_0x5eb2c8);else(_0x6dc816[_0x4d50c5(0x1a9)]['endsWith'](_0x4d50c5(0x143))||_0x6dc816['name'][_0x4d50c5(0x179)]('.yaml'))&&_0x1fd1ce[_0x4d50c5(0x18c)](_0x5eb2c8);}}return _0x1d0f83(_0x2e4364),_0x1fd1ce;}function calculateActivationActions(_0x39b639,_0x46d29b,_0x34b58d,_0x40be11){const _0x4e3e26=a35_0x29130b,_0x45d631=[],_0x3d54d8=new Map();for(const _0x139e70 of _0x46d29b){_0x3d54d8[_0x4e3e26(0x153)](_0x139e70[_0x4e3e26(0x1a9)],_0x139e70);}const _0x416d47=new Map();for(const _0x17b094 of _0x39b639){_0x416d47[_0x4e3e26(0x153)](_0x17b094[_0x4e3e26(0x1a9)],_0x17b094);}for(const _0x3299b7 of _0x39b639){const _0x46217d=_0x3d54d8['get'](_0x3299b7[_0x4e3e26(0x1a9)]);if(!_0x46217d)_0x45d631['push']({'type':_0x4e3e26(0x13f),'name':_0x3299b7[_0x4e3e26(0x1a9)],'yamlActivation':_0x3299b7});else{const _0x5c8e94=activationToYaml(_0x46217d,_0x34b58d,_0x40be11),_0x153ac3=a35_0x1e7dc1[_0x4e3e26(0x140)](_0x5c8e94),_0x3fe0a1=a35_0x1e7dc1[_0x4e3e26(0x140)](_0x3299b7);_0x153ac3!==_0x3fe0a1&&_0x45d631[_0x4e3e26(0x18c)]({'type':'update','name':_0x3299b7[_0x4e3e26(0x1a9)],'yamlActivation':_0x3299b7,'existingActivation':_0x46217d});}}for(const _0xe39e2e of _0x46d29b){!_0x416d47[_0x4e3e26(0x195)](_0xe39e2e[_0x4e3e26(0x1a9)])&&_0x45d631[_0x4e3e26(0x18c)]({'type':_0x4e3e26(0x14d),'name':_0xe39e2e['name'],'existingActivation':_0xe39e2e});}return _0x45d631;}
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 +1 @@
1
- function a36_0x3946(){const _0x3ecdbf=['Error:\x20Cannot\x20update\x20','⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.','rule','Segment\x20ID:\x20','16wYGUEt','verbose','segmentId','type','21570WtZhdl','segment','folder','name','Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Parent\x20ID:\x20','length','\x20\x20\x20Path:\x20','7094565RMkqRX','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Examples:','1590008VBRmYf','execute','parentId','ruleFile','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','segmentName','yellow','updateSegmentById','418444QxNqdM','Resolving\x20path\x20\x27','\x27...','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Resolved\x20relative\x20path\x20to:\x20','includes','resolveFolderId','Update\x20existing\x20child\x20segment','✔\x20Updated\x20segment\x20\x27','Resolved\x20folder\x20ID:\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','description','error','Updating\x20segment\x20\x27','kind','Resolved\x20type:\x20','data','segmentPath','4678149mFTFkO','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','307791amAyxF','2331095ssICln','6FwgEVc'];a36_0x3946=function(){return _0x3ecdbf;};return a36_0x3946();}const a36_0x10bdb9=a36_0x4202;(function(_0x359d8c,_0x42c8a8){const _0x3500e4=a36_0x4202,_0x23fd2e=_0x359d8c();while(!![]){try{const _0x20fd89=-parseInt(_0x3500e4(0x89))/0x1+-parseInt(_0x3500e4(0x6a))/0x2+-parseInt(_0x3500e4(0x7e))/0x3*(-parseInt(_0x3500e4(0x85))/0x4)+-parseInt(_0x3500e4(0x7f))/0x5*(-parseInt(_0x3500e4(0x80))/0x6)+-parseInt(_0x3500e4(0x7c))/0x7+parseInt(_0x3500e4(0x95))/0x8+parseInt(_0x3500e4(0x92))/0x9;if(_0x20fd89===_0x42c8a8)break;else _0x23fd2e['push'](_0x23fd2e['shift']());}catch(_0x5ac83a){_0x23fd2e['push'](_0x23fd2e['shift']());}}}(a36_0x3946,0xeb7c0));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';function a36_0x4202(_0x2c6df0,_0x1b11e4){_0x2c6df0=_0x2c6df0-0x69;const _0x3946df=a36_0x3946();let _0x420285=_0x3946df[_0x2c6df0];return _0x420285;}import{loadJSONFromOptions}from'../utils/json-loader.js';import{SDKError,ErrorCode}from'../sdk/index.js';import a36_0x3d4833 from'chalk';export class SegmentUpdateCommand extends BaseCommand{['name']='segment:update';[a36_0x10bdb9(0x75)]=a36_0x10bdb9(0x71);async[a36_0x10bdb9(0x96)](_0x485eee){const _0x2785a6=a36_0x10bdb9;console[_0x2785a6(0x76)](a36_0x3d4833[_0x2785a6(0x9b)](_0x2785a6(0x82))),console[_0x2785a6(0x76)](a36_0x3d4833['yellow'](_0x2785a6(0x8e)));const {options:_0x3cef4a,args:_0x50b692,tdx:_0x218d0e}=_0x485eee,_0x3bb737=_0x3cef4a;if(_0x50b692[_0x2785a6(0x90)]===0x0)return console[_0x2785a6(0x76)](_0x2785a6(0x6d)),console[_0x2785a6(0x76)](_0x2785a6(0x7d)),console[_0x2785a6(0x76)](_0x2785a6(0x94)),console[_0x2785a6(0x76)](_0x2785a6(0x99)),console[_0x2785a6(0x76)](_0x2785a6(0x93)),0x1;const _0x4228e5=_0x50b692[0x0],_0x2c98d2=_0x3cef4a[_0x2785a6(0x7b)];let _0x14c90b=_0x4228e5;_0x2c98d2&&!_0x4228e5[_0x2785a6(0x6f)]('/')&&(_0x14c90b=_0x2c98d2+'/'+_0x4228e5,_0x3bb737[_0x2785a6(0x86)]&&console[_0x2785a6(0x76)](_0x2785a6(0x6e)+_0x14c90b));const _0x21cf24=await withSpinner(_0x2785a6(0x6b)+_0x14c90b+'\x27...',()=>_0x218d0e['segment']['resolvePathToResource'](_0x14c90b),{'verbose':_0x3bb737[_0x2785a6(0x86)]}),_0x29f27a=_0x21cf24[_0x2785a6(0x7a)];_0x3bb737['verbose']&&console['error'](_0x2785a6(0x79)+_0x29f27a[_0x2785a6(0x88)]);if(_0x29f27a['type']!=='segment')return console[_0x2785a6(0x76)](_0x2785a6(0x81)+_0x29f27a[_0x2785a6(0x88)]+'.\x20Only\x20child\x20segments\x20can\x20be\x20updated.'),console[_0x2785a6(0x76)](_0x2785a6(0x8d)),0x1;if(!_0x29f27a[_0x2785a6(0x87)])throw new SDKError(ErrorCode['INTERNAL'],_0x2785a6(0x74));const _0x5249c3=_0x29f27a[_0x2785a6(0x97)],_0x56faa2=_0x29f27a[_0x2785a6(0x87)];_0x3bb737[_0x2785a6(0x86)]&&(console[_0x2785a6(0x76)](_0x2785a6(0x8f)+_0x5249c3),console[_0x2785a6(0x76)](_0x2785a6(0x84)+_0x56faa2));let _0x53b996;if(_0x3bb737['folder']){const _0x4095d1=_0x3bb737[_0x2785a6(0x8b)],_0x4df374=await withSpinner('Resolving\x20folder\x20\x27'+_0x4095d1+_0x2785a6(0x6c),()=>_0x218d0e['segment'][_0x2785a6(0x70)](_0x5249c3,_0x4095d1),{'verbose':_0x3bb737['verbose']});_0x53b996=parseInt(_0x4df374[_0x2785a6(0x7a)],0xa),_0x3bb737[_0x2785a6(0x86)]&&console[_0x2785a6(0x76)](_0x2785a6(0x73)+_0x53b996);}const _0x5d2403=await loadJSONFromOptions(_0x3bb737[_0x2785a6(0x83)],_0x3bb737[_0x2785a6(0x98)]),_0x1c7032={'name':_0x3bb737[_0x2785a6(0x8c)],'description':_0x3bb737[_0x2785a6(0x75)],'rule':_0x5d2403,'kind':_0x3bb737[_0x2785a6(0x78)]!==undefined?parseInt(_0x3bb737['kind'],0xa):undefined,'segmentFolderId':_0x53b996},_0x7f7802=await withSpinner(_0x2785a6(0x77)+_0x29f27a[_0x2785a6(0x9a)]+_0x2785a6(0x6c),()=>_0x218d0e[_0x2785a6(0x8a)][_0x2785a6(0x69)](_0x5249c3,_0x56faa2,_0x1c7032),{'verbose':_0x3bb737[_0x2785a6(0x86)]}),_0x2aaffd=_0x7f7802[_0x2785a6(0x7a)];return console[_0x2785a6(0x76)](_0x2785a6(0x72)+_0x2aaffd[_0x2785a6(0x8c)]+'\x27'),_0x14c90b!==_0x4228e5&&console[_0x2785a6(0x76)](_0x2785a6(0x91)+_0x14c90b),await handleSDKOutput([_0x2aaffd],_0x3bb737),0x0;}}
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 +1 @@
1
- const a37_0x30648a=a37_0xe59a;function a37_0xe59a(_0x4d0cd5,_0x41d131){_0x4d0cd5=_0x4d0cd5-0x141;const _0x4da3c0=a37_0x4da3();let _0xe59a80=_0x4da3c0[_0x4d0cd5];return _0xe59a80;}(function(_0x32ad77,_0xd5faa3){const _0x54ca25=a37_0xe59a,_0x5a8922=_0x32ad77();while(!![]){try{const _0x23ae4f=parseInt(_0x54ca25(0x144))/0x1*(parseInt(_0x54ca25(0x156))/0x2)+parseInt(_0x54ca25(0x15a))/0x3*(parseInt(_0x54ca25(0x14f))/0x4)+-parseInt(_0x54ca25(0x146))/0x5+parseInt(_0x54ca25(0x16d))/0x6*(-parseInt(_0x54ca25(0x154))/0x7)+parseInt(_0x54ca25(0x151))/0x8+-parseInt(_0x54ca25(0x171))/0x9+-parseInt(_0x54ca25(0x16c))/0xa;if(_0x23ae4f===_0xd5faa3)break;else _0x5a8922['push'](_0x5a8922['shift']());}catch(_0x314848){_0x5a8922['push'](_0x5a8922['shift']());}}}(a37_0x4da3,0xca109));import{existsSync,statSync}from'fs';import a37_0x10c08e from'chalk';function a37_0x4da3(){const _0x5eba31=['Set\x20current\x20segment/folder\x20context\x20for\x20navigation','3440672Fgjcve','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','site','7SmCSid','Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.','698PzFyal','Usage:\x20tdx\x20segment\x20use\x20<path>','green','parentName','55272PXGrWO','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context','Examples:','verbose','join','error','folderId','\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent','segmentPath','session','Target\x20path:\x20','cyan','description','data','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','dim','1336250mTZKsk','4349676CuHOYn','length','Error:\x20Path\x20is\x20required\x0a','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','4031982fzToiV','config','Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.','execute','isDirectory','red','parentId','fullPath','Resolving\x20path\x20\x27','type','1783NBMQFW','segment','2144465PEcqRP','Parent\x20ID:\x20','segments','\x27...','name','✔\x20Context\x20set\x20to:\x20','folderPath','split','log','328nZpWhP'];a37_0x4da3=function(){return _0x5eba31;};return a37_0x4da3();}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_0x30648a(0x14a)]='segment:use';[a37_0x30648a(0x168)]=a37_0x30648a(0x150);async[a37_0x30648a(0x174)](_0x4436e2){const _0x24358c=a37_0x30648a,{options:_0x3a9187,args:_0x323a9c,tdx:_0x2afbd8}=_0x4436e2;if(_0x323a9c['length']===0x0)return console['error'](a37_0x10c08e['red'](_0x24358c(0x16f))),console[_0x24358c(0x161)](_0x24358c(0x157)),console['error'](_0x24358c(0x15e)),console[_0x24358c(0x161)](_0x24358c(0x170)),console[_0x24358c(0x161)]('\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22'),console[_0x24358c(0x161)]('\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context'),console[_0x24358c(0x161)](_0x24358c(0x163)),0x1;const _0x33a30e=_0x323a9c[0x0],_0x1db1aa=_0x3a9187[_0x24358c(0x165)];try{if(_0x33a30e==='/')return saveSessionContext({'segment_path':undefined},_0x1db1aa),console['log'](a37_0x10c08e[_0x24358c(0x158)](_0x24358c(0x15c))),0x0;if(existsSync(_0x33a30e)&&statSync(_0x33a30e)[_0x24358c(0x175)]()){let _0x1d64e0;try{_0x1d64e0=findTdxConfig(_0x33a30e);}catch{return console[_0x24358c(0x161)](a37_0x10c08e[_0x24358c(0x176)](_0x24358c(0x15b)+_0x33a30e)),console[_0x24358c(0x161)](a37_0x10c08e[_0x24358c(0x167)](_0x24358c(0x152))),0x1;}const _0x14e5a0=_0x1d64e0[_0x24358c(0x172)]['parent_segment'];return saveSessionContext({'segment_path':_0x14e5a0,'parent_segment':_0x14e5a0},_0x1db1aa),console['log'](a37_0x10c08e[_0x24358c(0x158)]('✔\x20Context\x20set\x20to:\x20'+a37_0x10c08e[_0x24358c(0x167)](_0x14e5a0))),0x0;}const _0x3fff7f=_0x3a9187[_0x24358c(0x164)];let _0x55f1e9=_0x33a30e;const _0x5f0810=parsePath(_0x33a30e);if(!_0x5f0810['isAbsolute']){if(!_0x3fff7f)return console[_0x24358c(0x161)](a37_0x10c08e[_0x24358c(0x176)](_0x24358c(0x155))),console[_0x24358c(0x161)](a37_0x10c08e[_0x24358c(0x167)]('Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>')),0x1;if(_0x33a30e==='..'){const _0x48a3fa=_0x3fff7f[_0x24358c(0x14d)]('/')['slice'](0x0,-0x1)['join']('/');_0x55f1e9=_0x48a3fa||'/';}else _0x33a30e==='.'?_0x55f1e9=_0x3fff7f:_0x55f1e9=_0x3fff7f+'/'+_0x33a30e;_0x3a9187[_0x24358c(0x15f)]&&console[_0x24358c(0x161)]('Resolved\x20relative\x20path\x20to:\x20'+_0x55f1e9);}if(_0x55f1e9==='/'||_0x55f1e9==='')return saveSessionContext({'segment_path':undefined},_0x1db1aa),console[_0x24358c(0x14e)](a37_0x10c08e[_0x24358c(0x158)](_0x24358c(0x15c))),0x0;_0x55f1e9=normalizePath(_0x55f1e9);const _0x5499ea=parsePath(_0x55f1e9)[_0x24358c(0x148)];if(_0x5499ea[_0x24358c(0x16e)]===0x0)return saveSessionContext({'segment_path':undefined},_0x1db1aa),console[_0x24358c(0x14e)](a37_0x10c08e[_0x24358c(0x158)](_0x24358c(0x15c))),0x0;_0x3a9187['verbose']&&(console[_0x24358c(0x161)]('Site:\x20'+_0x3a9187[_0x24358c(0x153)]),console[_0x24358c(0x161)](_0x24358c(0x166)+_0x55f1e9));const _0x4dd887=await withSpinner(_0x24358c(0x142)+_0x55f1e9+_0x24358c(0x149),()=>_0x2afbd8[_0x24358c(0x145)]['resolvePathToResource'](_0x55f1e9),{'verbose':_0x3a9187[_0x24358c(0x15f)]}),_0x522ea7=_0x4dd887[_0x24358c(0x169)];_0x3a9187[_0x24358c(0x15f)]&&(console['error']('Resolved\x20path\x20type:\x20'+_0x522ea7[_0x24358c(0x143)]),console[_0x24358c(0x161)](_0x24358c(0x147)+_0x522ea7[_0x24358c(0x177)]),_0x522ea7[_0x24358c(0x162)]&&console['error']('Folder\x20ID:\x20'+_0x522ea7[_0x24358c(0x162)]));if(_0x522ea7[_0x24358c(0x143)]===_0x24358c(0x145))return console[_0x24358c(0x161)](a37_0x10c08e[_0x24358c(0x176)](_0x24358c(0x173))),console['error'](_0x24358c(0x16a)),console[_0x24358c(0x161)](a37_0x10c08e['cyan']('Use:\x20tdx\x20segment\x20use\x20'+_0x522ea7[_0x24358c(0x159)]+(_0x522ea7[_0x24358c(0x14c)]?'/'+_0x522ea7[_0x24358c(0x14c)][_0x24358c(0x160)]('/'):''))),0x1;return saveSessionContext({'segment_path':_0x522ea7[_0x24358c(0x141)],'parent_segment':_0x522ea7[_0x24358c(0x159)]},_0x1db1aa),console[_0x24358c(0x14e)](a37_0x10c08e[_0x24358c(0x158)](_0x24358c(0x14b)+a37_0x10c08e[_0x24358c(0x167)](_0x522ea7[_0x24358c(0x141)]))),_0x3a9187[_0x24358c(0x15f)]&&(console[_0x24358c(0x161)](a37_0x10c08e[_0x24358c(0x16b)](_0x24358c(0x15d))),console[_0x24358c(0x161)](a37_0x10c08e['dim']('Use\x20\x22tdx\x20context\x22\x20to\x20see\x20all\x20context\x20parameters'))),0x0;}catch(_0x413f1f){throw _0x413f1f;}}}
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 +1 @@
1
- const a38_0x17fec0=a38_0x364b;(function(_0x2b4623,_0x5d36b1){const _0x412289=a38_0x364b,_0x26d831=_0x2b4623();while(!![]){try{const _0x327f61=-parseInt(_0x412289(0x113))/0x1+-parseInt(_0x412289(0x150))/0x2+parseInt(_0x412289(0x137))/0x3+-parseInt(_0x412289(0x116))/0x4*(-parseInt(_0x412289(0x140))/0x5)+parseInt(_0x412289(0x11e))/0x6+-parseInt(_0x412289(0x110))/0x7*(-parseInt(_0x412289(0x125))/0x8)+parseInt(_0x412289(0x12c))/0x9;if(_0x327f61===_0x5d36b1)break;else _0x26d831['push'](_0x26d831['shift']());}catch(_0x6d96e2){_0x26d831['push'](_0x26d831['shift']());}}}(a38_0x264f,0xd3bb4));import{BaseCommand}from'./command.js';function a38_0x364b(_0x56b300,_0x58e36b){_0x56b300=_0x56b300-0x10c;const _0x264fa2=a38_0x264f();let _0x364bcb=_0x264fa2[_0x56b300];return _0x364bcb;}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';function a38_0x264f(){const _0x5f1a37=['870655vOxFet','\x20top-level\x20items','localeCompare','/app/ps/','Use\x20tdx\x20ps\x20list\x20to\x20see\x20available\x20parent\x20segments.','\x20\x20Cause:\x20','recursive','No\x20items\x20match\x20pattern:\x20','Recursive\x20mode:\x20enabled','sort','segments','Folder\x20ID:\x20','Error:\x20No\x20parent\x20segment\x20context\x20set.','Resolving\x20parent\x20segment\x20\x27','\x20and\x20','Error:\x20','1692328yAnejo','site','/e/','resolvePathToResource','\x20folder','log','parentId','folderId','(empty)','3815NqCnWW','Listing\x20folders\x20and\x20segments...','test','1393100gfoEdL','List\x20folders\x20and\x20child\x20segments','folder','8CXECAH','length','cause','\x27...','✔\x20Found\x20','verbose','Set\x20a\x20parent\x20segment\x20context\x20first:','listRecursive','3918156Yusbey','segment','includes',']\x20matching\x20\x27','web','Parent\x20ID:\x20','jsonl','1336sJJytn','dim','format','\x20matching\x20\x27','Folder/pattern\x20arg:\x20','✔\x20Built\x20tree\x20with\x20','listUnified','13418532eBFxtL','\x5c$&','Parent\x20segment\x20context:\x20','execute','maxDepth','json','filter','(not\x20set)','listWithPattern','data','error','1569795zndLRg','Resolving\x20path\x20\x27','replace','description','\x20segment','name','map','parentSegment','\x20\x20tdx\x20sg\x20pull\x20\x22My\x20Audience\x22'];a38_0x264f=function(){return _0x5f1a37;};return a38_0x264f();}import a38_0x31e20b from'chalk';export class SegmentsCommand extends BaseCommand{[a38_0x17fec0(0x13c)]=a38_0x17fec0(0x14a);[a38_0x17fec0(0x13a)]=a38_0x17fec0(0x114);async[a38_0x17fec0(0x12f)](_0x244d75){const _0x18c2ce=a38_0x17fec0,{options:_0x197d2f,args:_0x294052}=_0x244d75,_0x5d2484=_0x197d2f[_0x18c2ce(0x146)],_0x1b6439=_0x294052[0x0];try{const _0x2f7296=_0x197d2f[_0x18c2ce(0x13e)];_0x197d2f[_0x18c2ce(0x11b)]&&(console[_0x18c2ce(0x136)]('Site:\x20'+_0x197d2f[_0x18c2ce(0x151)]),console[_0x18c2ce(0x136)](_0x18c2ce(0x12e)+(_0x2f7296||_0x18c2ce(0x133))),_0x1b6439&&console['error'](_0x18c2ce(0x129)+_0x1b6439),_0x5d2484&&console[_0x18c2ce(0x136)](_0x18c2ce(0x148)));if(!_0x2f7296)return console[_0x18c2ce(0x136)](_0x18c2ce(0x14c)),console['error'](''),console[_0x18c2ce(0x136)](_0x18c2ce(0x11c)),console[_0x18c2ce(0x136)](_0x18c2ce(0x13f)),console[_0x18c2ce(0x136)]('\x20\x20tdx\x20sg\x20use\x20\x22My\x20Audience\x22'),console[_0x18c2ce(0x136)](''),console[_0x18c2ce(0x136)](_0x18c2ce(0x144)),0x1;const _0xac38d4=_0x1b6439&&(_0x1b6439[_0x18c2ce(0x120)]('*')||_0x1b6439[_0x18c2ce(0x120)]('?'));if(_0xac38d4)return await this['listWithPattern'](_0x244d75,_0x2f7296,_0x1b6439);const _0x6d896f=_0x1b6439?_0x2f7296+'/'+_0x1b6439:_0x2f7296;return _0x5d2484?await this['listRecursive'](_0x244d75,_0x6d896f):await this['listUnified'](_0x244d75,_0x6d896f);}catch(_0x76ec84){if(_0x76ec84 instanceof SDKError)return console[_0x18c2ce(0x136)](_0x18c2ce(0x14f)+_0x76ec84['message']),_0x76ec84['cause']&&console[_0x18c2ce(0x136)](_0x18c2ce(0x145)+_0x76ec84[_0x18c2ce(0x118)]),0x1;throw _0x76ec84;}}async[a38_0x17fec0(0x134)](_0x538e65,_0xaec0b6,_0x2142ed){const _0x2d9d42=a38_0x17fec0,{options:_0x390db0,tdx:_0x20b99b}=_0x538e65,_0x36988e=_0x390db0[_0x2d9d42(0x122)],_0x407bb3=await withSpinner(_0x2d9d42(0x14d)+_0xaec0b6+_0x2d9d42(0x119),()=>_0x20b99b[_0x2d9d42(0x11f)][_0x2d9d42(0x153)](_0xaec0b6),{'verbose':_0x390db0[_0x2d9d42(0x11b)]}),_0x419223=_0x407bb3[_0x2d9d42(0x135)],_0x127ce6=await withSpinner('Listing\x20folders\x20and\x20segments...',()=>_0x20b99b[_0x2d9d42(0x11f)][_0x2d9d42(0x12b)](_0x419223[_0x2d9d42(0x10d)],_0x419223[_0x2d9d42(0x10e)]),{'verbose':_0x390db0[_0x2d9d42(0x11b)]}),{folders:_0x307b67,segments:_0x295f70}=_0x127ce6[_0x2d9d42(0x135)],_0x4ed899=_0x2142ed[_0x2d9d42(0x139)](/[.+^${}()|[\]\\]/g,_0x2d9d42(0x12d))[_0x2d9d42(0x139)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x294aa8=new RegExp('^'+_0x4ed899+'$','i'),_0x12d725=_0x307b67['filter'](_0x3e6db3=>_0x294aa8[_0x2d9d42(0x112)](_0x3e6db3['name'])),_0x29e138=_0x295f70[_0x2d9d42(0x132)](_0x10cfd3=>_0x294aa8['test'](_0x10cfd3[_0x2d9d42(0x13c)])),_0x2125ad=_0x12d725['length']+_0x29e138[_0x2d9d42(0x117)];console[_0x2d9d42(0x136)]('✔\x20Found\x20'+_0x12d725[_0x2d9d42(0x117)]+_0x2d9d42(0x154)+(_0x12d725[_0x2d9d42(0x117)]!==0x1?'s':'')+'\x20and\x20'+_0x29e138[_0x2d9d42(0x117)]+'\x20segment'+(_0x29e138[_0x2d9d42(0x117)]!==0x1?'s':'')+_0x2d9d42(0x128)+_0x2142ed+'\x27');const _0x2b3e54=_0x57bd77=>{const _0x34c0aa=_0x2d9d42;return getConsoleNextUrl(_0x390db0[_0x34c0aa(0x151)],'/app/ps/'+_0x419223['parentId']+'/e/'+_0x57bd77);},_0x5bb570=_0x390db0[_0x2d9d42(0x127)]===_0x2d9d42(0x131)||_0x390db0[_0x2d9d42(0x127)]===_0x2d9d42(0x124);if(_0x5bb570){const _0x25ea2a=[..._0x12d725[_0x2d9d42(0x13d)](_0x368f9d=>({..._0x368f9d,'type':_0x2d9d42(0x115)})),..._0x29e138[_0x2d9d42(0x13d)](_0x5358c0=>({..._0x5358c0,'type':_0x2d9d42(0x11f),'url':_0x2b3e54(_0x5358c0['id'])}))][_0x2d9d42(0x149)]((_0x591c0a,_0x4d2157)=>_0x591c0a[_0x2d9d42(0x13c)][_0x2d9d42(0x142)](_0x4d2157['name']));await handleSDKOutput(_0x25ea2a,_0x390db0);}else{if(_0x2125ad===0x0)console[_0x2d9d42(0x10c)](_0x2d9d42(0x147)+_0x2142ed);else{console[_0x2d9d42(0x10c)](a38_0x31e20b[_0x2d9d42(0x126)]('['+_0xaec0b6+_0x2d9d42(0x121)+_0x2142ed+'\x27'));const _0x24beab=formatFlatList(_0x12d725,_0x29e138,{'showMetadata':!![],'showUrl':_0x36988e,'getSegmentUrl':_0x2b3e54});console[_0x2d9d42(0x10c)](_0x24beab);}}return 0x0;}async[a38_0x17fec0(0x12b)](_0x38dcd3,_0x1a9c4b){const _0x2272e1=a38_0x17fec0,{options:_0x5a1dc7,tdx:_0x30c36b}=_0x38dcd3,_0x468860=_0x5a1dc7[_0x2272e1(0x122)],_0x2298fe=await withSpinner(_0x2272e1(0x138)+_0x1a9c4b+'\x27...',()=>_0x30c36b[_0x2272e1(0x11f)][_0x2272e1(0x153)](_0x1a9c4b),{'verbose':_0x5a1dc7[_0x2272e1(0x11b)]}),_0x309bb9=_0x2298fe[_0x2272e1(0x135)];_0x5a1dc7[_0x2272e1(0x11b)]&&(console['error'](_0x2272e1(0x123)+_0x309bb9[_0x2272e1(0x10d)]),_0x309bb9['folderId']&&console[_0x2272e1(0x136)]('Folder\x20ID:\x20'+_0x309bb9[_0x2272e1(0x10e)]));const _0x134616=await withSpinner(_0x2272e1(0x111),()=>_0x30c36b['segment'][_0x2272e1(0x12b)](_0x309bb9[_0x2272e1(0x10d)],_0x309bb9[_0x2272e1(0x10e)]),{'verbose':_0x5a1dc7[_0x2272e1(0x11b)]}),{folders:_0xe46014,segments:_0x3fe464}=_0x134616[_0x2272e1(0x135)],_0x406910=_0xe46014[_0x2272e1(0x117)]+_0x3fe464[_0x2272e1(0x117)];console[_0x2272e1(0x136)](_0x2272e1(0x11a)+_0xe46014[_0x2272e1(0x117)]+_0x2272e1(0x154)+(_0xe46014[_0x2272e1(0x117)]!==0x1?'s':'')+_0x2272e1(0x14e)+_0x3fe464['length']+_0x2272e1(0x13b)+(_0x3fe464[_0x2272e1(0x117)]!==0x1?'s':''));const _0xd173d3=_0x5ad807=>{const _0x3c02b3=_0x2272e1;return getConsoleNextUrl(_0x5a1dc7[_0x3c02b3(0x151)],_0x3c02b3(0x143)+_0x309bb9[_0x3c02b3(0x10d)]+_0x3c02b3(0x152)+_0x5ad807);},_0x26a32c=_0x5a1dc7['format']===_0x2272e1(0x131)||_0x5a1dc7[_0x2272e1(0x127)]==='jsonl';if(_0x26a32c){const _0x27602b=[..._0xe46014['map'](_0x1ea868=>({..._0x1ea868,'type':'folder'})),..._0x3fe464[_0x2272e1(0x13d)](_0x32ec3a=>({..._0x32ec3a,'type':'segment','url':_0xd173d3(_0x32ec3a['id'])}))]['sort']((_0x2f9e38,_0x52f4eb)=>_0x2f9e38[_0x2272e1(0x13c)][_0x2272e1(0x142)](_0x52f4eb[_0x2272e1(0x13c)]));await handleSDKOutput(_0x27602b,_0x5a1dc7);}else{if(_0x406910===0x0)console[_0x2272e1(0x10c)](a38_0x31e20b[_0x2272e1(0x126)]('['+_0x1a9c4b+']')),console[_0x2272e1(0x10c)](_0x2272e1(0x10f));else{console['log'](a38_0x31e20b['dim']('['+_0x1a9c4b+']'));const _0x2c1bba=formatFlatList(_0xe46014,_0x3fe464,{'showMetadata':!![],'showUrl':_0x468860,'getSegmentUrl':_0xd173d3});console[_0x2272e1(0x10c)](_0x2c1bba);}}return 0x0;}async[a38_0x17fec0(0x11d)](_0x2b9ff6,_0x536a34){const _0x1ef38a=a38_0x17fec0,{options:_0x308195,tdx:_0x4631f5}=_0x2b9ff6,_0x2bc0fe=_0x308195[_0x1ef38a(0x122)],_0x134ff5=await withSpinner('Resolving\x20path\x20\x27'+_0x536a34+_0x1ef38a(0x119),()=>_0x4631f5[_0x1ef38a(0x11f)]['resolvePathToResource'](_0x536a34),{'verbose':_0x308195['verbose']}),_0x2ca1bc=_0x134ff5[_0x1ef38a(0x135)];_0x308195['verbose']&&(console[_0x1ef38a(0x136)]('Parent\x20ID:\x20'+_0x2ca1bc[_0x1ef38a(0x10d)]),_0x2ca1bc[_0x1ef38a(0x10e)]&&console[_0x1ef38a(0x136)](_0x1ef38a(0x14b)+_0x2ca1bc[_0x1ef38a(0x10e)]));const _0x57e96c=_0x308195[_0x1ef38a(0x130)]||0xa,_0x474497=await withSpinner('Building\x20hierarchy\x20tree...',()=>_0x4631f5['segment'][_0x1ef38a(0x11d)](_0x2ca1bc['parentId'],_0x2ca1bc[_0x1ef38a(0x10e)],0x0,_0x57e96c),{'verbose':_0x308195[_0x1ef38a(0x11b)]}),_0x18e07d=_0x474497['data'];console[_0x1ef38a(0x136)](_0x1ef38a(0x12a)+_0x18e07d[_0x1ef38a(0x117)]+_0x1ef38a(0x141));const _0x19695a=_0x5895ba=>{const _0x48b93d=_0x1ef38a;return getConsoleNextUrl(_0x308195[_0x48b93d(0x151)],_0x48b93d(0x143)+_0x2ca1bc[_0x48b93d(0x10d)]+_0x48b93d(0x152)+_0x5895ba);};if(_0x308195['format']===_0x1ef38a(0x131)||_0x308195[_0x1ef38a(0x127)]==='jsonl')await handleSDKOutput(_0x18e07d,_0x308195);else{console[_0x1ef38a(0x10c)](a38_0x31e20b['dim']('['+_0x536a34+']'));const _0x69eed5=formatTree(_0x18e07d,{'showMetadata':!![],'showUrl':_0x2bc0fe,'getSegmentUrl':_0x19695a});console[_0x1ef38a(0x10c)](_0x69eed5);}return 0x0;}}
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 +1 @@
1
- const a39_0x35572b=a39_0x1340;(function(_0x2e3fde,_0xee2e2f){const _0x2de2a8=a39_0x1340,_0x149026=_0x2e3fde();while(!![]){try{const _0x810c3b=parseInt(_0x2de2a8(0x155))/0x1+-parseInt(_0x2de2a8(0x15d))/0x2*(-parseInt(_0x2de2a8(0x150))/0x3)+-parseInt(_0x2de2a8(0x152))/0x4*(-parseInt(_0x2de2a8(0x158))/0x5)+-parseInt(_0x2de2a8(0x16c))/0x6*(parseInt(_0x2de2a8(0x16d))/0x7)+-parseInt(_0x2de2a8(0x156))/0x8*(-parseInt(_0x2de2a8(0x16a))/0x9)+parseInt(_0x2de2a8(0x14f))/0xa+-parseInt(_0x2de2a8(0x170))/0xb*(parseInt(_0x2de2a8(0x165))/0xc);if(_0x810c3b===_0xee2e2f)break;else _0x149026['push'](_0x149026['shift']());}catch(_0x437544){_0x149026['push'](_0x149026['shift']());}}}(a39_0x357b,0x52896));function a39_0x357b(){const _0x537b96=['32641qwtxSQ','error','query','11plKyiv','Limit:\x20','✔\x20Query\x20successful\x20-\x200\x20rows\x20returned','\x20\x20\x20or:\x20tdx\x20show\x20<catalog.database.table>','validate','message','\x20from\x20','2259480bArhXn','79899uPEuZh','Table:\x20','1157992zEQgpN','\x20row','database','531227fXfdex','8ccfxky','catalog','5JzxPaB','Catalog:\x20','args','name','Site:\x20','46aocvvO','data','length','Database:\x20','\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--database\x20<database>','site','verbose','✔\x20Retrieved\x20','17454588ftcIlB','table','Usage:\x20tdx\x20show\x20<database.table>','Querying\x20','cause','2753262pHZQTT','show','222zUrlGQ'];a39_0x357b=function(){return _0x537b96;};return a39_0x357b();}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a39_0x1340(_0xc321f4,_0xb80f72){_0xc321f4=_0xc321f4-0x14d;const _0x357be7=a39_0x357b();let _0x134033=_0x357be7[_0xc321f4];return _0x134033;}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_0x35572b(0x15b)]=a39_0x35572b(0x16b);['description']='Show\x20table\x20contents';async['execute'](_0x573b6e){return this['showTable'](_0x573b6e);}async['showTable'](_0x373f06){const _0xc460a5=a39_0x35572b,{options:_0x3e0244,args:_0x490e19,tdx:_0x4004f2}=_0x373f06;let _0x2b1bbc;try{_0x2b1bbc=parseTableReference(_0x490e19[0x0]);const _0x3f4a8a=_0x3e0244['database'];!_0x2b1bbc[_0xc460a5(0x154)]&&_0x3f4a8a&&(_0x2b1bbc[_0xc460a5(0x154)]=_0x3f4a8a);const _0x3b4140=validateTableDescribeReference(_0x2b1bbc);if(_0x3b4140)return console[_0xc460a5(0x16e)]('Error:\x20'+_0x3b4140),console[_0xc460a5(0x16e)](_0xc460a5(0x167)),console[_0xc460a5(0x16e)](_0xc460a5(0x173)),console[_0xc460a5(0x16e)](_0xc460a5(0x161)),0x1;}catch(_0x58ac48){return console[_0xc460a5(0x16e)]('Error:\x20'+_0x58ac48[_0xc460a5(0x14d)]),console[_0xc460a5(0x16e)](_0xc460a5(0x167)),console['error'](_0xc460a5(0x173)),console['error'](_0xc460a5(0x161)),0x1;}const _0x2fb692=_0x2b1bbc[_0xc460a5(0x157)],_0x319163=_0x2b1bbc[_0xc460a5(0x154)],_0x2bbb29=_0x2b1bbc[_0xc460a5(0x166)],_0x3b0a6d=resolveLimit(_0x3e0244['limit'],DEFAULT_DISPLAY_LIMIT);try{_0x3e0244[_0xc460a5(0x163)]&&(console['error'](_0xc460a5(0x15c)+_0x3e0244[_0xc460a5(0x162)]),_0x2fb692&&console[_0xc460a5(0x16e)](_0xc460a5(0x159)+_0x2fb692),console['error'](_0xc460a5(0x160)+_0x319163),console['error'](_0xc460a5(0x151)+_0x2bbb29),console['error'](_0xc460a5(0x171)+_0x3b0a6d));const _0x2d57da=_0x2fb692?_0x2fb692+'.'+_0x319163+'.'+_0x2bbb29:_0x319163+'.'+_0x2bbb29,_0x5568e0=await withSpinner(_0xc460a5(0x168)+_0x2d57da+'...',()=>_0x4004f2[_0xc460a5(0x16f)]['showTable'](_0x319163,_0x2bbb29,_0x3b0a6d,_0x2fb692),{'verbose':_0x3e0244[_0xc460a5(0x163)]}),_0x1124e6=_0x5568e0[_0xc460a5(0x15e)],_0x4f2399=_0x1124e6[_0xc460a5(0x15e)];return _0x4f2399[_0xc460a5(0x15f)]===0x0?console[_0xc460a5(0x16e)](_0xc460a5(0x172)):console[_0xc460a5(0x16e)](_0xc460a5(0x164)+_0x4f2399[_0xc460a5(0x15f)]+_0xc460a5(0x153)+(_0x4f2399[_0xc460a5(0x15f)]!==0x1?'s':'')+_0xc460a5(0x14e)+_0x2d57da),await handleSDKOutput(_0x4f2399,_0x3e0244),0x0;}catch(_0x43259b){if(_0x43259b instanceof SDKError)return console['error']('Error:\x20'+_0x43259b['message']),_0x43259b['cause']&&console[_0xc460a5(0x16e)]('\x20\x20Cause:\x20'+_0x43259b[_0xc460a5(0x169)]),0x1;throw _0x43259b;}}[a39_0x35572b(0x174)](_0x2208f7){const _0x51ebb9=a39_0x35572b;if(_0x2208f7[_0x51ebb9(0x15a)][_0x51ebb9(0x15f)]===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(_0x2208f7[_0x51ebb9(0x15a)][_0x51ebb9(0x15f)]>0x1)return'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';return undefined;}}
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 +1 @@
1
- const a40_0x184df6=a40_0x52af;function a40_0x2131(){const _0x4e83df=['Database:\x20','error','execute','2IMdYUO','Note:\x20\x27','\x20table','\x20\x20tdx\x20tables\x20users\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20->\x20table\x20\x22users\x22\x20across\x20all\x20databases','400419KyJDle','\x20\x20tdx\x20tables\x20--in\x20mydb\x20\x20\x20\x20\x20\x20\x20->\x20all\x20tables\x20from\x20mydb','Table\x20pattern:\x20','2137086GNqZQH','Database\x20\x27','database','Did\x20you\x20mean\x20to\x20list\x20all\x20tables\x20from\x20database\x20\x27','message','Error:\x20Pattern\x20\x27','5zVKofE','List\x20tables\x20in\x20a\x20database','\x20\x20Use:\x20tdx\x20tables\x20\x22','8964XLkxzg','\x20\x20tdx\x20tables\x20\x22*.user*\x22\x20\x20\x20\x20\x20\x20\x20->\x20tables\x20matching\x20user*\x20across\x20databases','listTables','\x20\x20tdx\x20tables\x20\x22mydb.users\x22\x20\x20\x20\x20->\x20table\x20\x22users\x22\x20in\x20database\x20mydb','\x20\x20Or:\x20\x20tdx\x20tables\x20--database\x20','784EdViqz','646195GgYjfM','369936RNKchF','length','validate','✔\x20Found\x20','verbose','✖\x20No\x20tables\x20found','Error:\x20','\x20\x20tdx\x20tables\x20\x22mydb.*\x22\x20\x20\x20\x20\x20\x20\x20\x20->\x20all\x20tables\x20from\x20mydb','description','Error:\x20Too\x20many\x20arguments.\x20Use\x20single\x20argument:','Database:\x20all','table','cause','\x27\x20is\x20ambiguous.','21318BgsYPI','50MAiSac','973719shsNIj','includes','tables','name','20447tmTAMQ'];a40_0x2131=function(){return _0x4e83df;};return a40_0x2131();}(function(_0x56874a,_0x16fcf4){const _0x406ab3=a40_0x52af,_0x2391a4=_0x56874a();while(!![]){try{const _0x5268d4=-parseInt(_0x406ab3(0x11f))/0x1+-parseInt(_0x406ab3(0x109))/0x2*(-parseInt(_0x406ab3(0x101))/0x3)+parseInt(_0x406ab3(0x120))/0x4+-parseInt(_0x406ab3(0x116))/0x5*(parseInt(_0x406ab3(0x110))/0x6)+parseInt(_0x406ab3(0x105))/0x7*(-parseInt(_0x406ab3(0x11e))/0x8)+-parseInt(_0x406ab3(0x10d))/0x9*(parseInt(_0x406ab3(0x100))/0xa)+-parseInt(_0x406ab3(0xff))/0xb*(-parseInt(_0x406ab3(0x119))/0xc);if(_0x5268d4===_0x16fcf4)break;else _0x2391a4['push'](_0x2391a4['shift']());}catch(_0x19912e){_0x2391a4['push'](_0x2391a4['shift']());}}}(a40_0x2131,0x56576));import{BaseCommand}from'./command.js';function a40_0x52af(_0x23c227,_0x5c5363){_0x23c227=_0x23c227-0xfe;const _0x2131db=a40_0x2131();let _0x52af1a=_0x2131db[_0x23c227];return _0x52af1a;}import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{parseTableReference}from'../utils/table-ref-parser.js';import{DEFAULT_LISTING_LIMIT,resolveLimit}from'../utils/constants.js';import{withSpinner}from'../utils/spinner.js';export class TablesCommand extends BaseCommand{[a40_0x184df6(0x104)]=a40_0x184df6(0x103);[a40_0x184df6(0x128)]=a40_0x184df6(0x117);async[a40_0x184df6(0x108)](_0x12e479){const _0x6a5541=a40_0x184df6,{options:_0x59b1b2,args:_0x548004,tdx:_0x4dbbc8}=_0x12e479;let _0x26104d;if(_0x548004[_0x6a5541(0x121)]===0x0)_0x26104d={'database':undefined,'table':undefined,'original':''};else{if(_0x548004['length']===0x1)try{_0x26104d=parseTableReference(_0x548004[0x0]);if(_0x26104d[_0x6a5541(0x12b)]&&!_0x26104d[_0x6a5541(0x112)]&&!_0x26104d[_0x6a5541(0x12b)]['includes']('*')&&!_0x26104d['table']['includes']('?'))return console[_0x6a5541(0x107)](_0x6a5541(0x115)+_0x548004[0x0]+_0x6a5541(0xfe)),console[_0x6a5541(0x107)](_0x6a5541(0x113)+_0x26104d['table']+'\x27?'),console[_0x6a5541(0x107)](_0x6a5541(0x118)+_0x26104d[_0x6a5541(0x12b)]+'.*\x22'),console['error']('\x20\x20Or:\x20\x20tdx\x20tables\x20--in\x20'+_0x26104d['table']),console[_0x6a5541(0x107)](_0x6a5541(0x11d)+_0x26104d[_0x6a5541(0x12b)]),console[_0x6a5541(0x107)](''),console[_0x6a5541(0x107)](_0x6a5541(0x10a)+_0x548004[0x0]+'\x27\x20without\x20wildcards\x20would\x20search\x20for\x20tables\x20named\x20\x27'+_0x26104d[_0x6a5541(0x12b)]+'\x27\x20across\x20all\x20databases.'),0x1;}catch(_0xcd2d23){return console[_0x6a5541(0x107)](_0x6a5541(0x126)+_0xcd2d23[_0x6a5541(0x114)]),0x1;}else return console[_0x6a5541(0x107)](_0x6a5541(0x129)),console['error'](_0x6a5541(0x10c)),console[_0x6a5541(0x107)](_0x6a5541(0x127)),console[_0x6a5541(0x107)](_0x6a5541(0x11c)),console['error'](_0x6a5541(0x11a)),console['error']('Or\x20use\x20--in\x20flag:'),console[_0x6a5541(0x107)](_0x6a5541(0x10e)),0x1;}const _0x1a0f3a=_0x59b1b2['database'];!_0x26104d[_0x6a5541(0x112)]&&_0x1a0f3a&&(_0x26104d[_0x6a5541(0x112)]=_0x1a0f3a);try{const _0x5a7f04=_0x27160e=>_0x27160e&&(_0x27160e[_0x6a5541(0x102)]('*')||_0x27160e['includes']('?')),_0x4480e1=_0x5a7f04(_0x26104d[_0x6a5541(0x112)]);_0x59b1b2[_0x6a5541(0x124)]&&(console[_0x6a5541(0x107)]('Site:\x20'+_0x59b1b2['site']),_0x26104d['database']?_0x4480e1?console[_0x6a5541(0x107)]('Database\x20pattern:\x20'+_0x26104d[_0x6a5541(0x112)]):console[_0x6a5541(0x107)](_0x6a5541(0x106)+_0x26104d[_0x6a5541(0x112)]):console[_0x6a5541(0x107)](_0x6a5541(0x12a)),_0x26104d[_0x6a5541(0x12b)]&&console['error'](_0x6a5541(0x10f)+_0x26104d[_0x6a5541(0x12b)]));const _0x5f1004=_0x26104d['database']&&!_0x4480e1?_0x26104d[_0x6a5541(0x112)]:undefined,_0x299e43=_0x4480e1?_0x26104d[_0x6a5541(0x112)]:undefined,_0xa962d4=_0x26104d[_0x6a5541(0x12b)],_0x3183=resolveLimit(_0x59b1b2['limit'],DEFAULT_LISTING_LIMIT),_0x40b506=await withSpinner('Listing\x20tables...',()=>_0x4dbbc8['query'][_0x6a5541(0x11b)](_0x5f1004,_0xa962d4,_0x299e43,_0x3183),{'verbose':_0x59b1b2[_0x6a5541(0x124)]}),_0x509f25=_0x40b506['data'];if(_0x509f25[_0x6a5541(0x121)]===0x0&&_0x26104d[_0x6a5541(0x112)]&&!_0x4480e1)return console[_0x6a5541(0x107)](_0x6a5541(0x125)),console[_0x6a5541(0x107)](_0x6a5541(0x111)+_0x26104d['database']+'\x27\x20may\x20not\x20exist\x20or\x20contains\x20no\x20tables'),0x1;return console[_0x6a5541(0x107)](_0x6a5541(0x123)+_0x509f25[_0x6a5541(0x121)]+_0x6a5541(0x10b)+(_0x509f25[_0x6a5541(0x121)]!==0x1?'s':'')),await handleSDKOutput(_0x509f25,{..._0x59b1b2,'limit':_0x3183}),0x0;}catch(_0x4ff00c){if(_0x4ff00c instanceof SDKError)return console[_0x6a5541(0x107)](_0x6a5541(0x126)+_0x4ff00c[_0x6a5541(0x114)]),_0x4ff00c[_0x6a5541(0x12c)]&&console[_0x6a5541(0x107)]('\x20\x20Cause:\x20'+_0x4ff00c[_0x6a5541(0x12c)]),0x1;throw _0x4ff00c;}}[a40_0x184df6(0x122)](_0x46091b){return undefined;}}
1
+ const a40_0x5ebd52=a40_0x34dd;(function(_0x38405c,_0x5b98f4){const _0x2501d7=a40_0x34dd,_0x11e227=_0x38405c();while(!![]){try{const _0x24a380=parseInt(_0x2501d7(0xd3))/0x1+parseInt(_0x2501d7(0xcc))/0x2*(parseInt(_0x2501d7(0xcf))/0x3)+-parseInt(_0x2501d7(0xe1))/0x4+parseInt(_0x2501d7(0xc5))/0x5*(-parseInt(_0x2501d7(0xe7))/0x6)+parseInt(_0x2501d7(0xbf))/0x7+-parseInt(_0x2501d7(0xc7))/0x8*(parseInt(_0x2501d7(0xd4))/0x9)+parseInt(_0x2501d7(0xd0))/0xa*(-parseInt(_0x2501d7(0xe0))/0xb);if(_0x24a380===_0x5b98f4)break;else _0x11e227['push'](_0x11e227['shift']());}catch(_0x49e9aa){_0x11e227['push'](_0x11e227['shift']());}}}(a40_0x1443,0xc2f9b));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a40_0x34dd(_0x62c009,_0x46102f){_0x62c009=_0x62c009-0xbc;const _0x14437e=a40_0x1443();let _0x34ddae=_0x14437e[_0x62c009];return _0x34ddae;}import{handleSDKOutput}from'../utils/command-output.js';import{parseTableReference}from'../utils/table-ref-parser.js';import{DEFAULT_LISTING_LIMIT,resolveLimit}from'../utils/constants.js';import{withSpinner}from'../utils/spinner.js';export class TablesCommand extends BaseCommand{['name']=a40_0x5ebd52(0xbc);[a40_0x5ebd52(0xbe)]='List\x20tables\x20in\x20a\x20database';async[a40_0x5ebd52(0xe2)](_0x41fe0c){const _0xc59bd9=a40_0x5ebd52,{options:_0x33b4f8,args:_0x524058,tdx:_0x5e73b7}=_0x41fe0c;let _0x208a4d;if(_0x524058['length']===0x0)_0x208a4d={'database':undefined,'table':undefined,'original':''};else{if(_0x524058[_0xc59bd9(0xce)]===0x1)try{_0x208a4d=parseTableReference(_0x524058[0x0]);if(_0x208a4d[_0xc59bd9(0xda)]&&!_0x208a4d[_0xc59bd9(0xc2)]&&!_0x208a4d['table'][_0xc59bd9(0xc8)]('*')&&!_0x208a4d['table']['includes']('?'))return console[_0xc59bd9(0xd8)]('Error:\x20Pattern\x20\x27'+_0x524058[0x0]+_0xc59bd9(0xd2)),console[_0xc59bd9(0xd8)](_0xc59bd9(0xeb)+_0x208a4d[_0xc59bd9(0xda)]+'\x27?'),console[_0xc59bd9(0xd8)]('\x20\x20Use:\x20tdx\x20tables\x20\x22'+_0x208a4d['table']+_0xc59bd9(0xd6)),console[_0xc59bd9(0xd8)]('\x20\x20Or:\x20\x20tdx\x20tables\x20--in\x20'+_0x208a4d[_0xc59bd9(0xda)]),console['error'](_0xc59bd9(0xd7)+_0x208a4d['table']),console[_0xc59bd9(0xd8)](''),console['error'](_0xc59bd9(0xbd)+_0x524058[0x0]+_0xc59bd9(0xea)+_0x208a4d[_0xc59bd9(0xda)]+_0xc59bd9(0xdd)),0x1;}catch(_0x3e5796){return console[_0xc59bd9(0xd8)]('Error:\x20'+_0x3e5796['message']),0x1;}else return console['error'](_0xc59bd9(0xee)),console[_0xc59bd9(0xd8)](_0xc59bd9(0xdb)),console['error'](_0xc59bd9(0xe8)),console[_0xc59bd9(0xd8)](_0xc59bd9(0xe6)),console['error'](_0xc59bd9(0xc0)),console[_0xc59bd9(0xd8)](_0xc59bd9(0xc3)),console[_0xc59bd9(0xd8)](_0xc59bd9(0xc6)),0x1;}const _0x3d5b46=_0x33b4f8['database'];!_0x208a4d[_0xc59bd9(0xc2)]&&_0x3d5b46&&(_0x208a4d['database']=_0x3d5b46);try{const _0x38e05f=_0x1e6d54=>_0x1e6d54&&(_0x1e6d54[_0xc59bd9(0xc8)]('*')||_0x1e6d54[_0xc59bd9(0xc8)]('?')),_0x517d45=_0x38e05f(_0x208a4d[_0xc59bd9(0xc2)]);_0x33b4f8[_0xc59bd9(0xcb)]&&(console[_0xc59bd9(0xd8)](_0xc59bd9(0xc9)+_0x33b4f8[_0xc59bd9(0xca)]),_0x208a4d['database']?_0x517d45?console[_0xc59bd9(0xd8)](_0xc59bd9(0xe3)+_0x208a4d[_0xc59bd9(0xc2)]):console[_0xc59bd9(0xd8)](_0xc59bd9(0xc1)+_0x208a4d['database']):console[_0xc59bd9(0xd8)]('Database:\x20all'),_0x208a4d[_0xc59bd9(0xda)]&&console['error'](_0xc59bd9(0xcd)+_0x208a4d[_0xc59bd9(0xda)]));const _0x4c9399=_0x208a4d[_0xc59bd9(0xc2)]&&!_0x517d45?_0x208a4d[_0xc59bd9(0xc2)]:undefined,_0x44fdc2=_0x517d45?_0x208a4d[_0xc59bd9(0xc2)]:undefined,_0x395e56=_0x208a4d['table'],_0x59b07d=resolveLimit(_0x33b4f8[_0xc59bd9(0xef)],DEFAULT_LISTING_LIMIT),_0xcef0af=await withSpinner('Listing\x20tables...',()=>_0x5e73b7[_0xc59bd9(0xd9)][_0xc59bd9(0xe5)](_0x4c9399,_0x395e56,_0x44fdc2,_0x59b07d),{'verbose':_0x33b4f8[_0xc59bd9(0xcb)]}),_0x52654e=_0xcef0af[_0xc59bd9(0xed)];if(_0x52654e[_0xc59bd9(0xce)]===0x0&&_0x208a4d[_0xc59bd9(0xc2)]&&!_0x517d45)return console['error'](_0xc59bd9(0xe4)),console[_0xc59bd9(0xd8)](_0xc59bd9(0xdf)+_0x208a4d['database']+_0xc59bd9(0xd5)),0x1;return console[_0xc59bd9(0xd8)](_0xc59bd9(0xc4)+_0x52654e[_0xc59bd9(0xce)]+_0xc59bd9(0xec)+(_0x52654e['length']!==0x1?'s':'')),await handleSDKOutput(_0x52654e,{..._0x33b4f8,'limit':_0x59b07d}),0x0;}catch(_0x392eec){if(_0x392eec instanceof SDKError)return console[_0xc59bd9(0xd8)](_0xc59bd9(0xd1)+_0x392eec[_0xc59bd9(0xdc)]),_0x392eec[_0xc59bd9(0xde)]&&console[_0xc59bd9(0xd8)](_0xc59bd9(0xe9)+_0x392eec[_0xc59bd9(0xde)]),0x1;throw _0x392eec;}}['validate'](_0x4c08d6){return undefined;}}function a40_0x1443(){const _0x40b19d=['Did\x20you\x20mean\x20to\x20list\x20all\x20tables\x20from\x20database\x20\x27','\x20table','data','Error:\x20Too\x20many\x20arguments.\x20Use\x20single\x20argument:','limit','tables','Note:\x20\x27','description','6591543KHerRM','\x20\x20tdx\x20tables\x20\x22*.user*\x22\x20\x20\x20\x20\x20\x20\x20->\x20tables\x20matching\x20user*\x20across\x20databases','Database:\x20','database','Or\x20use\x20--in\x20flag:','✔\x20Found\x20','1462225NYYgyY','\x20\x20tdx\x20tables\x20--in\x20mydb\x20\x20\x20\x20\x20\x20\x20->\x20all\x20tables\x20from\x20mydb','202784EhrZjV','includes','Site:\x20','site','verbose','796nrUaZh','Table\x20pattern:\x20','length','3345FswXwx','220FZLgRV','Error:\x20','\x27\x20is\x20ambiguous.','1129947IAtxcY','9BeDQQA','\x27\x20may\x20not\x20exist\x20or\x20contains\x20no\x20tables','.*\x22','\x20\x20Or:\x20\x20tdx\x20tables\x20--database\x20','error','query','table','\x20\x20tdx\x20tables\x20users\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20->\x20table\x20\x22users\x22\x20across\x20all\x20databases','message','\x27\x20across\x20all\x20databases.','cause','Database\x20\x27','55550eXtrRy','3981636XqiuTP','execute','Database\x20pattern:\x20','✖\x20No\x20tables\x20found','listTables','\x20\x20tdx\x20tables\x20\x22mydb.users\x22\x20\x20\x20\x20->\x20table\x20\x22users\x22\x20in\x20database\x20mydb','12oRClsq','\x20\x20tdx\x20tables\x20\x22mydb.*\x22\x20\x20\x20\x20\x20\x20\x20\x20->\x20all\x20tables\x20from\x20mydb','\x20\x20Cause:\x20','\x27\x20without\x20wildcards\x20would\x20search\x20for\x20tables\x20named\x20\x27'];a40_0x1443=function(){return _0x40b19d;};return a40_0x1443();}