@treasuredata/tdx 0.8.7 → 0.8.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +2 -2
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/client/cdp-api-client.js +1 -1
  6. package/dist/client/engage-api-client.js +1 -1
  7. package/dist/client/http-client.js +1 -1
  8. package/dist/client/llm-api-client.js +1 -1
  9. package/dist/client/rate-limiter.js +1 -1
  10. package/dist/client/td-api-client.js +1 -1
  11. package/dist/client/trino-api-client.js +1 -1
  12. package/dist/client/workflow-client.js +1 -1
  13. package/dist/commands/activations.js +1 -1
  14. package/dist/commands/api-command.js +1 -1
  15. package/dist/commands/auth-command.js +1 -1
  16. package/dist/commands/chat-command.js +1 -1
  17. package/dist/commands/claude-command.d.ts.map +1 -1
  18. package/dist/commands/claude-command.js +1 -1
  19. package/dist/commands/claude-command.js.map +1 -1
  20. package/dist/commands/claude-statusline-command.js +1 -1
  21. package/dist/commands/claude-usage-command.js +1 -1
  22. package/dist/commands/command.js +1 -1
  23. package/dist/commands/connection-command.js +1 -1
  24. package/dist/commands/context-command.js +1 -1
  25. package/dist/commands/databases.js +1 -1
  26. package/dist/commands/describe.js +1 -1
  27. package/dist/commands/engage-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/journey-command.js +1 -1
  30. package/dist/commands/llm-command.js +1 -1
  31. package/dist/commands/llm-proxy.js +1 -1
  32. package/dist/commands/parent-segment-command.js +1 -1
  33. package/dist/commands/profiles-command.js +1 -1
  34. package/dist/commands/query-command.js +1 -1
  35. package/dist/commands/segment-command.js +1 -1
  36. package/dist/commands/segment-create-command.js +1 -1
  37. package/dist/commands/segment-fields-command.js +1 -1
  38. package/dist/commands/segment-pull-command.js +1 -1
  39. package/dist/commands/segment-push-command.js +1 -1
  40. package/dist/commands/segment-update-command.js +1 -1
  41. package/dist/commands/segment-use-command.js +1 -1
  42. package/dist/commands/segments.js +1 -1
  43. package/dist/commands/show.js +1 -1
  44. package/dist/commands/tables.js +1 -1
  45. package/dist/commands/use-command.js +1 -1
  46. package/dist/commands/user-command.js +1 -1
  47. package/dist/commands/workflow-command.js +1 -1
  48. package/dist/core/auth.js +1 -1
  49. package/dist/core/config.js +1 -1
  50. package/dist/core/connection-cache.js +1 -1
  51. package/dist/core/credential-cache.js +1 -1
  52. package/dist/core/global-context.js +1 -1
  53. package/dist/core/keychain.js +1 -1
  54. package/dist/core/profile.js +1 -1
  55. package/dist/core/project-config.js +1 -1
  56. package/dist/core/session.js +1 -1
  57. package/dist/core/user-cache.js +1 -1
  58. package/dist/index.js +1 -1
  59. package/dist/proxy/anthropic-adapter.js +1 -1
  60. package/dist/proxy/claude-usage-tracker.js +1 -1
  61. package/dist/proxy/context-signature.js +1 -1
  62. package/dist/proxy/conversation-utils.js +1 -1
  63. package/dist/proxy/server.js +1 -1
  64. package/dist/proxy/session-cache.js +1 -1
  65. package/dist/sdk/api.js +1 -1
  66. package/dist/sdk/connection.js +1 -1
  67. package/dist/sdk/engage.js +1 -1
  68. package/dist/sdk/errors.js +1 -1
  69. package/dist/sdk/index.js +1 -1
  70. package/dist/sdk/job.js +1 -1
  71. package/dist/sdk/journey.js +1 -1
  72. package/dist/sdk/llm.js +1 -1
  73. package/dist/sdk/query.js +1 -1
  74. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  75. package/dist/sdk/segment/journey-yaml.js +1 -1
  76. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  77. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  78. package/dist/sdk/segment.js +1 -1
  79. package/dist/sdk/user.js +1 -1
  80. package/dist/sdk/workflow.js +1 -1
  81. package/dist/types/endpoints.js +1 -1
  82. package/dist/types/index.js +1 -1
  83. package/dist/utils/agent-ref-parser.js +1 -1
  84. package/dist/utils/async.js +1 -1
  85. package/dist/utils/chat-cache.js +1 -1
  86. package/dist/utils/colors.js +1 -1
  87. package/dist/utils/command-output.js +1 -1
  88. package/dist/utils/constants.js +1 -1
  89. package/dist/utils/diff.js +1 -1
  90. package/dist/utils/fields-display.js +1 -1
  91. package/dist/utils/file-permissions.js +1 -1
  92. package/dist/utils/format-detector.js +1 -1
  93. package/dist/utils/formatters.js +1 -1
  94. package/dist/utils/json-loader.js +1 -1
  95. package/dist/utils/llm-backup-utils.js +1 -1
  96. package/dist/utils/model-aliases.js +1 -1
  97. package/dist/utils/model-factors.js +1 -1
  98. package/dist/utils/option-validation.js +1 -1
  99. package/dist/utils/port.js +1 -1
  100. package/dist/utils/process.js +1 -1
  101. package/dist/utils/prompt.js +1 -1
  102. package/dist/utils/segment-path-parser.js +1 -1
  103. package/dist/utils/segment-ref-parser.js +1 -1
  104. package/dist/utils/spinner.js +1 -1
  105. package/dist/utils/sql-parser.js +1 -1
  106. package/dist/utils/sse-parser.js +1 -1
  107. package/dist/utils/string-utils.js +1 -1
  108. package/dist/utils/table-ref-parser.js +1 -1
  109. package/dist/utils/tdx-config.js +1 -1
  110. package/dist/utils/tdx-logger.js +1 -1
  111. package/dist/utils/tree-formatter.js +1 -1
  112. package/dist/utils/version-check.js +1 -1
  113. package/dist/utils/workflow-utils.js +1 -1
  114. package/package.json +1 -1
@@ -1 +1 @@
1
- const a32_0x3b9f40=a32_0x391d;(function(_0x2c6f29,_0x274ac8){const _0x155214=a32_0x391d,_0x547b7b=_0x2c6f29();while(!![]){try{const _0x311f4f=parseInt(_0x155214(0x1bd))/0x1*(parseInt(_0x155214(0x1c8))/0x2)+-parseInt(_0x155214(0x1d9))/0x3+parseInt(_0x155214(0x1db))/0x4+parseInt(_0x155214(0x1be))/0x5+-parseInt(_0x155214(0x1c4))/0x6*(-parseInt(_0x155214(0x1d1))/0x7)+-parseInt(_0x155214(0x1da))/0x8+-parseInt(_0x155214(0x1bc))/0x9*(-parseInt(_0x155214(0x1ab))/0xa);if(_0x311f4f===_0x274ac8)break;else _0x547b7b['push'](_0x547b7b['shift']());}catch(_0x5b97e5){_0x547b7b['push'](_0x547b7b['shift']());}}}(a32_0x4cc2,0x87540));import{BaseCommand}from'./command.js';function a32_0x391d(_0x5b3a52,_0x46c9f2){_0x5b3a52=_0x5b3a52-0x1a8;const _0x4cc2a7=a32_0x4cc2();let _0x391d11=_0x4cc2a7[_0x5b3a52];return _0x391d11;}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';import a32_0x13c691 from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']=a32_0x3b9f40(0x1d5);[a32_0x3b9f40(0x1dc)]='Create\x20child\x20segment\x20with\x20filtering\x20rules';async[a32_0x3b9f40(0x1c3)](_0x2fa631){const _0x534626=a32_0x3b9f40;console[_0x534626(0x1c6)](a32_0x13c691['yellow']('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x534626(0x1c6)](a32_0x13c691[_0x534626(0x1cb)](_0x534626(0x1b9)));const {options:_0x993faa,args:_0x9bc9a0,tdx:_0x341180}=_0x2fa631,_0x2ca7c6=_0x993faa;if(_0x9bc9a0[_0x534626(0x1b3)]===0x0)return console[_0x534626(0x1c6)](_0x534626(0x1cf)),console[_0x534626(0x1c6)]('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console[_0x534626(0x1c6)](_0x534626(0x1cc)),console[_0x534626(0x1c6)](_0x534626(0x1af)),console['error'](_0x534626(0x1ce)),console[_0x534626(0x1c6)](_0x534626(0x1b5)),0x1;const _0x4cc4ef=_0x9bc9a0[0x0],_0x49d5e2=_0x993faa['segmentPath'];let _0x2aeaab=_0x4cc4ef;_0x49d5e2&&!_0x4cc4ef[_0x534626(0x1d3)]('/')&&(_0x2aeaab=_0x49d5e2+'/'+_0x4cc4ef,_0x2ca7c6['verbose']&&console[_0x534626(0x1c6)]('Resolved\x20relative\x20path\x20to:\x20'+_0x2aeaab));const _0x2bcd66=parsePath(_0x2aeaab);if(_0x2bcd66[_0x534626(0x1c7)][_0x534626(0x1b3)]<0x2)return console[_0x534626(0x1c6)]('Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'),console[_0x534626(0x1c6)]('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x541ff0=_0x2bcd66['segments'][0x0],_0xbee0a7=getBaseName(_0x2aeaab),_0x510d03=getParentPath(_0x2aeaab);_0x2ca7c6['verbose']&&(console[_0x534626(0x1c6)](_0x534626(0x1c0)+_0x2ca7c6['site']),console[_0x534626(0x1c6)](_0x534626(0x1b8)+_0x2aeaab),console[_0x534626(0x1c6)](_0x534626(0x1a9)+_0x541ff0),console['error'](_0x534626(0x1bf)+_0xbee0a7),console['error'](_0x534626(0x1ad)+_0x510d03));const _0x480f2d=await withSpinner(_0x534626(0x1ae)+_0x541ff0+_0x534626(0x1ba),()=>_0x341180[_0x534626(0x1c1)][_0x534626(0x1b7)](_0x541ff0),{'verbose':_0x2ca7c6[_0x534626(0x1d6)]}),_0x2c2f5d=_0x480f2d[_0x534626(0x1d7)];let _0x2e4211;if(_0x2bcd66[_0x534626(0x1c7)][_0x534626(0x1b3)]>0x2){const _0x19b922=await withSpinner(_0x534626(0x1b2)+_0x510d03+_0x534626(0x1ba),()=>_0x341180['segment'][_0x534626(0x1bb)](_0x510d03),{'verbose':_0x2ca7c6['verbose']}),_0x947ef9=_0x19b922['data'];if(_0x947ef9['type']!==_0x534626(0x1aa)&&_0x947ef9[_0x534626(0x1d4)]!==_0x534626(0x1b1))return console['error'](_0x534626(0x1b0)),0x1;_0x2e4211=_0x947ef9[_0x534626(0x1ca)];}else{if(_0x2ca7c6[_0x534626(0x1aa)]){const _0x199d2f=await withSpinner(_0x534626(0x1cd)+_0x2ca7c6[_0x534626(0x1aa)]+_0x534626(0x1ba),()=>_0x341180['segment'][_0x534626(0x1b6)](_0x2c2f5d,_0x2ca7c6[_0x534626(0x1aa)]),{'verbose':_0x2ca7c6['verbose']});_0x2e4211=_0x199d2f[_0x534626(0x1d7)];}}_0x2ca7c6[_0x534626(0x1d6)]&&_0x2e4211&&console[_0x534626(0x1c6)]('Resolved\x20folder\x20ID:\x20'+_0x2e4211);const _0x49679a=await loadJSONFromOptions(_0x2ca7c6[_0x534626(0x1ac)],_0x2ca7c6[_0x534626(0x1c9)]),_0x28fc4c={'name':_0xbee0a7,'description':_0x2ca7c6[_0x534626(0x1dc)],'rule':_0x49679a,'kind':_0x2ca7c6[_0x534626(0x1c2)]!==undefined?parseInt(_0x2ca7c6[_0x534626(0x1c2)],0xa):undefined,'isVisible':_0x2ca7c6[_0x534626(0x1c5)]?![]:undefined,'segmentFolderId':_0x2e4211,'countPopulation':_0x2ca7c6[_0x534626(0x1d2)]?![]:undefined},_0x115143=await withSpinner('Creating\x20segment\x20\x27'+_0xbee0a7+_0x534626(0x1ba),()=>_0x341180[_0x534626(0x1c1)][_0x534626(0x1d0)](_0x2c2f5d,_0x28fc4c),{'verbose':_0x2ca7c6[_0x534626(0x1d6)]}),_0x4b2238=_0x115143[_0x534626(0x1d7)];return console[_0x534626(0x1c6)](_0x534626(0x1a8)+_0x4b2238[_0x534626(0x1b4)]+'\x27\x20with\x20ID:\x20'+_0x4b2238['id']),_0x2aeaab!==_0x4cc4ef&&console['error'](_0x534626(0x1d8)+_0x2aeaab),await handleSDKOutput([_0x4b2238],_0x2ca7c6),0x0;}}function a32_0x4cc2(){const _0x1e7e17=['Segment\x20name:\x20','Site:\x20','segment','kind','execute','5442VXRPkn','invisible','error','segments','2aLAHmL','ruleFile','folderId','yellow','Examples:','Resolving\x20folder\x20\x27','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','createSegment','1547YlFvDK','noCountPopulation','includes','type','segment:create','verbose','data','\x20\x20\x20Path:\x20','3191307NRHtGt','6551128omqBtg','3477088jQYUhR','description','✔\x20Created\x20segment\x20\x27','Parent:\x20','folder','80eokbLF','rule','Parent\x20path:\x20','Resolving\x20parent\x20segment\x20\x27','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','parent','Resolving\x20folder\x20path\x20\x27','length','name','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','resolveFolderId','resolveParentId','Target\x20path:\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','\x27...','resolvePathToResource','396009TRnmKr','123078OIqXCe','4460795yXihPJ'];a32_0x4cc2=function(){return _0x1e7e17;};return a32_0x4cc2();}
1
+ const a32_0x585bd3=a32_0x156e;(function(_0x5a6113,_0x3f96ca){const _0x1f6b7f=a32_0x156e,_0x5941bb=_0x5a6113();while(!![]){try{const _0x1e070c=parseInt(_0x1f6b7f(0xe2))/0x1*(-parseInt(_0x1f6b7f(0xe3))/0x2)+-parseInt(_0x1f6b7f(0xe0))/0x3*(-parseInt(_0x1f6b7f(0xd3))/0x4)+parseInt(_0x1f6b7f(0xc9))/0x5+-parseInt(_0x1f6b7f(0xd1))/0x6+parseInt(_0x1f6b7f(0xc5))/0x7+parseInt(_0x1f6b7f(0xc1))/0x8+-parseInt(_0x1f6b7f(0xd7))/0x9*(parseInt(_0x1f6b7f(0xcd))/0xa);if(_0x1e070c===_0x3f96ca)break;else _0x5941bb['push'](_0x5941bb['shift']());}catch(_0x59eb52){_0x5941bb['push'](_0x5941bb['shift']());}}}(a32_0x900d,0x82d15));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../utils/segment-path-parser.js';function a32_0x900d(){const _0x440223=['Resolving\x20parent\x20segment\x20\x27','Creating\x20segment\x20\x27','invisible','kind','noCountPopulation','length','7915352pUfKLZ','✔\x20Created\x20segment\x20\x27','\x27\x20with\x20ID:\x20','Resolving\x20folder\x20path\x20\x27','273861ICBavM','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','Target\x20path:\x20','parent','4389560VgeYCy','site','type','createSegment','10oXxTpz','data','name','rule','1627008coPOAw','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','69508BFubbh','Resolved\x20folder\x20ID:\x20','resolveParentId','Resolving\x20folder\x20\x27','5530797GhOgbU','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','Segment\x20name:\x20','ruleFile','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','yellow','execute','folderId','Examples:','36xNTbzo','Resolved\x20relative\x20path\x20to:\x20','203GmULms','6832wfziqf','segment','Parent:\x20','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','resolvePathToResource','segment:create','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','segments','folder','error','Site:\x20','description','segmentPath','verbose','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','includes','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','\x27...'];a32_0x900d=function(){return _0x440223;};return a32_0x900d();}import a32_0x574353 from'chalk';function a32_0x156e(_0x12e886,_0x2796d2){_0x12e886=_0x12e886-0xb7;const _0x900d4c=a32_0x900d();let _0x156e08=_0x900d4c[_0x12e886];return _0x156e08;}export class SegmentCreateCommand extends BaseCommand{[a32_0x585bd3(0xcf)]=a32_0x585bd3(0xe8);['description']='Create\x20child\x20segment\x20with\x20filtering\x20rules';async[a32_0x585bd3(0xdd)](_0x156437){const _0x3d7e77=a32_0x585bd3;console[_0x3d7e77(0xec)](a32_0x574353[_0x3d7e77(0xdc)](_0x3d7e77(0xd2))),console[_0x3d7e77(0xec)](a32_0x574353[_0x3d7e77(0xdc)](_0x3d7e77(0xdb)));const {options:_0x3571b5,args:_0x1f2829,tdx:_0x5907d0}=_0x156437,_0x3150f3=_0x3571b5;if(_0x1f2829['length']===0x0)return console[_0x3d7e77(0xec)](_0x3d7e77(0xb8)),console[_0x3d7e77(0xec)](_0x3d7e77(0xf1)),console[_0x3d7e77(0xec)](_0x3d7e77(0xdf)),console['error'](_0x3d7e77(0xd8)),console[_0x3d7e77(0xec)](_0x3d7e77(0xe9)),console[_0x3d7e77(0xec)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x3f564e=_0x1f2829[0x0],_0x1988f6=_0x3571b5[_0x3d7e77(0xef)];let _0x45fc02=_0x3f564e;_0x1988f6&&!_0x3f564e[_0x3d7e77(0xb7)]('/')&&(_0x45fc02=_0x1988f6+'/'+_0x3f564e,_0x3150f3[_0x3d7e77(0xf0)]&&console[_0x3d7e77(0xec)](_0x3d7e77(0xe1)+_0x45fc02));const _0x25e225=parsePath(_0x45fc02);if(_0x25e225[_0x3d7e77(0xea)][_0x3d7e77(0xc0)]<0x2)return console[_0x3d7e77(0xec)](_0x3d7e77(0xe6)),console[_0x3d7e77(0xec)](_0x3d7e77(0xc6)),0x1;const _0x14b2e9=_0x25e225['segments'][0x0],_0x29ff53=getBaseName(_0x45fc02),_0x1034d1=getParentPath(_0x45fc02);_0x3150f3[_0x3d7e77(0xf0)]&&(console['error'](_0x3d7e77(0xed)+_0x3150f3[_0x3d7e77(0xca)]),console[_0x3d7e77(0xec)](_0x3d7e77(0xc7)+_0x45fc02),console[_0x3d7e77(0xec)](_0x3d7e77(0xe5)+_0x14b2e9),console['error'](_0x3d7e77(0xd9)+_0x29ff53),console[_0x3d7e77(0xec)]('Parent\x20path:\x20'+_0x1034d1));const _0x3a126c=await withSpinner(_0x3d7e77(0xbb)+_0x14b2e9+'\x27...',()=>_0x5907d0[_0x3d7e77(0xe4)][_0x3d7e77(0xd5)](_0x14b2e9),{'verbose':_0x3150f3[_0x3d7e77(0xf0)]}),_0x43a4c5=_0x3a126c['data'];let _0x44f494;if(_0x25e225[_0x3d7e77(0xea)]['length']>0x2){const _0x29c222=await withSpinner(_0x3d7e77(0xc4)+_0x1034d1+_0x3d7e77(0xba),()=>_0x5907d0['segment'][_0x3d7e77(0xe7)](_0x1034d1),{'verbose':_0x3150f3[_0x3d7e77(0xf0)]}),_0x1a34ea=_0x29c222[_0x3d7e77(0xce)];if(_0x1a34ea[_0x3d7e77(0xcb)]!=='folder'&&_0x1a34ea[_0x3d7e77(0xcb)]!==_0x3d7e77(0xc8))return console[_0x3d7e77(0xec)](_0x3d7e77(0xb9)),0x1;_0x44f494=_0x1a34ea[_0x3d7e77(0xde)];}else{if(_0x3150f3[_0x3d7e77(0xeb)]){const _0x2db985=await withSpinner(_0x3d7e77(0xd6)+_0x3150f3[_0x3d7e77(0xeb)]+'\x27...',()=>_0x5907d0[_0x3d7e77(0xe4)]['resolveFolderId'](_0x43a4c5,_0x3150f3['folder']),{'verbose':_0x3150f3[_0x3d7e77(0xf0)]});_0x44f494=_0x2db985[_0x3d7e77(0xce)];}}_0x3150f3[_0x3d7e77(0xf0)]&&_0x44f494&&console[_0x3d7e77(0xec)](_0x3d7e77(0xd4)+_0x44f494);const _0x386fe1=await loadJSONFromOptions(_0x3150f3[_0x3d7e77(0xd0)],_0x3150f3[_0x3d7e77(0xda)]),_0x58f682={'name':_0x29ff53,'description':_0x3150f3[_0x3d7e77(0xee)],'rule':_0x386fe1,'kind':_0x3150f3[_0x3d7e77(0xbe)]!==undefined?parseInt(_0x3150f3[_0x3d7e77(0xbe)],0xa):undefined,'isVisible':_0x3150f3[_0x3d7e77(0xbd)]?![]:undefined,'segmentFolderId':_0x44f494,'countPopulation':_0x3150f3[_0x3d7e77(0xbf)]?![]:undefined},_0x661d7=await withSpinner(_0x3d7e77(0xbc)+_0x29ff53+_0x3d7e77(0xba),()=>_0x5907d0[_0x3d7e77(0xe4)][_0x3d7e77(0xcc)](_0x43a4c5,_0x58f682),{'verbose':_0x3150f3[_0x3d7e77(0xf0)]}),_0x43ea63=_0x661d7[_0x3d7e77(0xce)];return console[_0x3d7e77(0xec)](_0x3d7e77(0xc2)+_0x43ea63[_0x3d7e77(0xcf)]+_0x3d7e77(0xc3)+_0x43ea63['id']),_0x45fc02!==_0x3f564e&&console[_0x3d7e77(0xec)]('\x20\x20\x20Path:\x20'+_0x45fc02),await handleSDKOutput([_0x43ea63],_0x3150f3),0x0;}}
@@ -1 +1 @@
1
- const a33_0x5ea83a=a33_0x38db;(function(_0x31bd8c,_0x126a44){const _0x29fca9=a33_0x38db,_0x3a402f=_0x31bd8c();while(!![]){try{const _0x4b0566=-parseInt(_0x29fca9(0x1db))/0x1+-parseInt(_0x29fca9(0x1d7))/0x2*(-parseInt(_0x29fca9(0x1d6))/0x3)+-parseInt(_0x29fca9(0x1e5))/0x4*(-parseInt(_0x29fca9(0x1d5))/0x5)+parseInt(_0x29fca9(0x1e6))/0x6+parseInt(_0x29fca9(0x1e3))/0x7+-parseInt(_0x29fca9(0x1d4))/0x8*(parseInt(_0x29fca9(0x1e2))/0x9)+parseInt(_0x29fca9(0x1e7))/0xa*(parseInt(_0x29fca9(0x1d9))/0xb);if(_0x4b0566===_0x126a44)break;else _0x3a402f['push'](_0x3a402f['shift']());}catch(_0x9c19ce){_0x3a402f['push'](_0x3a402f['shift']());}}}(a33_0x6251,0x81259));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';function a33_0x6251(){const _0x118644=['\x27...','name','listFields','segment:fields','error','description','1054712cpFeau','250NfnZdI','56274jOatAj','10csXxUq','parentSegment','4653umAxPc','jsonl','527006YUPVeq','Error:\x20Parent\x20segment\x20name\x20is\x20required','Site:\x20','length','data','verbose','\x20field','45EKaqMz','2278255YAoyjU','site','45996nRyYoy','422442qZCXJm','15380MVndin','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','segment','✔\x20Found\x20'];a33_0x6251=function(){return _0x118644;};return a33_0x6251();}import{withSpinner}from'../utils/spinner.js';function a33_0x38db(_0x162974,_0x2df9d3){_0x162974=_0x162974-0x1cd;const _0x62514d=a33_0x6251();let _0x38db60=_0x62514d[_0x162974];return _0x38db60;}import{displayFieldsHumanReadable}from'../utils/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a33_0x5ea83a(0x1cf)]=a33_0x5ea83a(0x1d1);[a33_0x5ea83a(0x1d3)]='List\x20available\x20fields\x20for\x20segmentation';async['execute'](_0x153999){const _0x474a58=a33_0x5ea83a,{options:_0x484062,args:_0x42fae1,tdx:_0x5e73a7}=_0x153999,_0x5c9040=_0x42fae1[0x0]||_0x484062[_0x474a58(0x1d8)];if(!_0x5c9040)return console[_0x474a58(0x1d2)](_0x474a58(0x1dc)),console[_0x474a58(0x1d2)](_0x474a58(0x1e8)),console['error']('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;_0x484062[_0x474a58(0x1e0)]&&(console['error'](_0x474a58(0x1dd)+_0x484062[_0x474a58(0x1e4)]),console['error']('Parent\x20segment:\x20'+_0x5c9040));const _0x572bc4=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x5c9040+_0x474a58(0x1ce),()=>_0x5e73a7[_0x474a58(0x1e9)][_0x474a58(0x1d0)](_0x5c9040),{'verbose':_0x484062[_0x474a58(0x1e0)]}),_0x2764d2=_0x572bc4[_0x474a58(0x1df)];console[_0x474a58(0x1d2)](_0x474a58(0x1cd)+_0x2764d2[_0x474a58(0x1de)]+_0x474a58(0x1e1)+(_0x2764d2['length']!==0x1?'s':''));if(_0x484062['json']||_0x484062[_0x474a58(0x1da)])return await handleSDKOutput(_0x2764d2,_0x484062),0x0;return displayFieldsHumanReadable(_0x2764d2,_0x5c9040),0x0;}}
1
+ const a33_0x28eac8=a33_0x3f83;(function(_0x1feaf7,_0x2d0bdb){const _0x50802e=a33_0x3f83,_0x2face3=_0x1feaf7();while(!![]){try{const _0x35cb1e=-parseInt(_0x50802e(0x92))/0x1+-parseInt(_0x50802e(0x9a))/0x2*(parseInt(_0x50802e(0x8d))/0x3)+-parseInt(_0x50802e(0x8b))/0x4*(parseInt(_0x50802e(0x85))/0x5)+parseInt(_0x50802e(0x88))/0x6*(parseInt(_0x50802e(0x97))/0x7)+parseInt(_0x50802e(0x95))/0x8+-parseInt(_0x50802e(0x8f))/0x9*(-parseInt(_0x50802e(0xa1))/0xa)+parseInt(_0x50802e(0x91))/0xb;if(_0x35cb1e===_0x2d0bdb)break;else _0x2face3['push'](_0x2face3['shift']());}catch(_0x43e92d){_0x2face3['push'](_0x2face3['shift']());}}}(a33_0x49e4,0xf1cd4));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../utils/fields-display.js';function a33_0x3f83(_0x3bd7e8,_0x289b19){_0x3bd7e8=_0x3bd7e8-0x83;const _0x49e4c8=a33_0x49e4();let _0x3f837a=_0x49e4c8[_0x3bd7e8];return _0x3f837a;}export class SegmentFieldsCommand extends BaseCommand{[a33_0x28eac8(0x8e)]=a33_0x28eac8(0x9f);[a33_0x28eac8(0x96)]=a33_0x28eac8(0x99);async['execute'](_0x443c8c){const _0x5727a8=a33_0x28eac8,{options:_0x557670,args:_0xf54dde,tdx:_0x2fcec3}=_0x443c8c,_0x14148e=_0xf54dde[0x0]||_0x557670[_0x5727a8(0x84)];if(!_0x14148e)return console[_0x5727a8(0x98)](_0x5727a8(0x8a)),console[_0x5727a8(0x98)](_0x5727a8(0x94)),console[_0x5727a8(0x98)](_0x5727a8(0x9c)),0x1;_0x557670[_0x5727a8(0xa0)]&&(console[_0x5727a8(0x98)]('Site:\x20'+_0x557670[_0x5727a8(0x9b)]),console[_0x5727a8(0x98)](_0x5727a8(0x86)+_0x14148e));const _0x10f5d4=await withSpinner(_0x5727a8(0x8c)+_0x14148e+_0x5727a8(0x89),()=>_0x2fcec3[_0x5727a8(0x90)][_0x5727a8(0x87)](_0x14148e),{'verbose':_0x557670[_0x5727a8(0xa0)]}),_0x17fe18=_0x10f5d4[_0x5727a8(0x9d)];console[_0x5727a8(0x98)](_0x5727a8(0x93)+_0x17fe18[_0x5727a8(0x83)]+'\x20field'+(_0x17fe18[_0x5727a8(0x83)]!==0x1?'s':''));if(_0x557670['json']||_0x557670[_0x5727a8(0x9e)])return await handleSDKOutput(_0x17fe18,_0x557670),0x0;return displayFieldsHumanReadable(_0x17fe18,_0x14148e),0x0;}}function a33_0x49e4(){const _0x5cd005=['description','191282FeHfDx','error','List\x20available\x20fields\x20for\x20segmentation','761056uKAFWV','site','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','data','jsonl','segment:fields','verbose','330FEPwBg','length','parentSegment','5Iwpmvd','Parent\x20segment:\x20','listFields','282aeUkqQ','\x27...','Error:\x20Parent\x20segment\x20name\x20is\x20required','1157668jwlTCZ','Listing\x20fields\x20for\x20\x27','3frRfIP','name','129663xXePyZ','segment','929379JjSrmL','528461JJfGDJ','✔\x20Found\x20','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','2756672ffmxHg'];a33_0x49e4=function(){return _0x5cd005;};return a33_0x49e4();}
@@ -1 +1 @@
1
- const a34_0x3b65a9=a34_0x2456;(function(_0x50e640,_0x1b21b0){const _0x1707d6=a34_0x2456,_0x3b9e4c=_0x50e640();while(!![]){try{const _0x20fd94=-parseInt(_0x1707d6(0x7f))/0x1+-parseInt(_0x1707d6(0xbb))/0x2*(-parseInt(_0x1707d6(0x6f))/0x3)+parseInt(_0x1707d6(0xa5))/0x4*(parseInt(_0x1707d6(0x76))/0x5)+parseInt(_0x1707d6(0xa8))/0x6*(-parseInt(_0x1707d6(0xbc))/0x7)+-parseInt(_0x1707d6(0x89))/0x8*(-parseInt(_0x1707d6(0x75))/0x9)+-parseInt(_0x1707d6(0x9a))/0xa*(-parseInt(_0x1707d6(0xab))/0xb)+parseInt(_0x1707d6(0x73))/0xc*(parseInt(_0x1707d6(0xa3))/0xd);if(_0x20fd94===_0x1b21b0)break;else _0x3b9e4c['push'](_0x3b9e4c['shift']());}catch(_0x3d27cd){_0x3b9e4c['push'](_0x3b9e4c['shift']());}}}(a34_0x25cb,0x81553));import{BaseCommand}from'./command.js';import{withSpinner}from'../utils/spinner.js';function a34_0x25cb(){const _0x306f0d=['yellow','green','\x20\x20Target:\x20','✔\x20Pulled\x20','has','utf-8','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)','attributes','26bHSyEb','user','3151348cbEAVz','data','\x20files\x20to\x20','620754flAsWN','Found\x20existing\x20tdx.json\x20at:\x20','Fetching\x20users\x20for\x20email\x20resolution...','11oUhLvU','parent_segment','dirname','\x0aPull\x20summary\x20for\x20\x27','length','verbose','Resolved\x20parent\x20name:\x20','set','Fetching\x20activations...','\x20files?','absolutePath','\x0aChanges\x20to\x20\x27','dim','red','values','repeat','202lShHdY','49mFlqtQ','segment','cyan','tdx.json','join','Using\x20parent\x20segment:\x20','listFolders','\x27...','Aborted.','yes','listActivations','12309aBkeXe','site','get','resolveParentId','2334504YMnfcy','✔\x20Context\x20set:\x20','1107BgZQgH','5zixSgR','Fetching\x20connections\x20for\x20name\x20resolution...','listSegments','\x20new\x20files','reduce','Write\x20','execute','✔\x20All\x20files\x20are\x20up\x20to\x20date','Pull\x20child\x20segments\x20to\x20YAML\x20files','967266oBVofI','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','description','getParent','then','all','filter','parentFolderId','buildIdToEmailMap','name','33544igOFFE','\x20activations','\x20=\x20','add','error','Fetching\x20parent\x20segment\x20info...','from','Fetching\x20segments...','hasChanges','\x20changed\x20files','diff','Fetching\x20folders...','isNew','parentSegment','segmentFolderId','\x20segments','segment:pull','1141630AvVYkz'];a34_0x25cb=function(){return _0x306f0d;};return a34_0x25cb();}import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{getSegmentRootDir,createTdxConfigContent,findTdxConfigPath,loadTdxConfig}from'../utils/tdx-config.js';import{saveSessionContext}from'../core/session.js';function a34_0x2456(_0x52c06e,_0x43bef9){_0x52c06e=_0x52c06e-0x69;const _0x25cb34=a34_0x25cb();let _0x24565a=_0x25cb34[_0x52c06e];return _0x24565a;}import{segmentWithActivationsToYaml,segmentToYamlString}from'../sdk/segment/child-segment-yaml.js';import a34_0x2a0149 from'chalk';import{existsSync,mkdirSync,readFileSync,writeFileSync,statSync}from'fs';import a34_0x2c162a from'path';import{sanitizeFileName}from'../utils/string-utils.js';export class SegmentPullCommand extends BaseCommand{[a34_0x3b65a9(0x88)]=a34_0x3b65a9(0x99);[a34_0x3b65a9(0x81)]=a34_0x3b65a9(0x7e);async[a34_0x3b65a9(0x7c)](_0x28612a){const _0x1a6909=a34_0x3b65a9,{options:_0x50e448,args:_0x524776,tdx:_0x5ad451}=_0x28612a,_0x14e67b=_0x50e448,_0xb3c61b=_0x50e448[_0x1a6909(0x96)],_0x493726=_0x524776[0x0],_0x3289cc=findTdxConfigPath();let _0x12e20b,_0x56dde8;if(!_0x493726&&_0x3289cc){const _0x5024c5=loadTdxConfig(_0x3289cc);_0x12e20b=_0x5024c5[_0x1a6909(0xac)],_0x56dde8=a34_0x2c162a[_0x1a6909(0xad)](_0x3289cc),_0x14e67b['verbose']&&(console[_0x1a6909(0x8d)](_0x1a6909(0xa9)+_0x3289cc),console[_0x1a6909(0x8d)](_0x1a6909(0x69)+_0x12e20b));}else{if(_0x493726){if(existsSync(_0x493726)&&statSync(_0x493726)['isDirectory']()){const _0x3e7ac3=findTdxConfigPath(_0x493726);if(_0x3e7ac3){const _0x4b0bb6=loadTdxConfig(_0x3e7ac3);_0x12e20b=_0x4b0bb6[_0x1a6909(0xac)],_0x56dde8=a34_0x2c162a['dirname'](_0x3e7ac3),_0x14e67b[_0x1a6909(0xb0)]&&(console['error']('Found\x20tdx.json\x20at:\x20'+_0x3e7ac3),console[_0x1a6909(0x8d)](_0x1a6909(0x69)+_0x12e20b));}else return console[_0x1a6909(0x8d)](a34_0x2a0149[_0x1a6909(0xb8)]('Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20'+_0x493726+'\x0a')),console[_0x1a6909(0x8d)](a34_0x2a0149[_0x1a6909(0xbe)](_0x1a6909(0x80))),0x1;}else _0x12e20b=_0x493726;}else _0x12e20b=_0xb3c61b;}if(!_0x12e20b)return console[_0x1a6909(0x8d)](a34_0x2a0149['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x1a6909(0x8d)](_0x1a6909(0xa1)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent'),console[_0x1a6909(0x8d)]('\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;_0x14e67b['verbose']&&(console[_0x1a6909(0x8d)]('Site:\x20'+_0x14e67b[_0x1a6909(0x70)]),console[_0x1a6909(0x8d)]('Parent\x20segment:\x20'+_0x12e20b));const _0x2e0543=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x12e20b+_0x1a6909(0x6b),()=>_0x5ad451[_0x1a6909(0xbd)][_0x1a6909(0x72)](_0x12e20b),{'verbose':_0x14e67b['verbose']}),_0x486575=_0x2e0543[_0x1a6909(0xa6)],_0x48a853=await withSpinner(_0x1a6909(0x8e),()=>_0x5ad451['segment'][_0x1a6909(0x82)](_0x486575),{'verbose':_0x14e67b['verbose']}),_0x93bef4=_0x48a853['data'][_0x1a6909(0xa2)][_0x1a6909(0x88)];_0x14e67b[_0x1a6909(0xb0)]&&console[_0x1a6909(0x8d)](_0x1a6909(0xb1)+_0x93bef4);const [_0x561130,_0xa188d0]=await Promise[_0x1a6909(0x84)]([withSpinner(_0x1a6909(0x90),()=>_0x5ad451['segment'][_0x1a6909(0x78)](_0x486575),{'verbose':_0x14e67b[_0x1a6909(0xb0)]}),withSpinner(_0x1a6909(0x94),()=>_0x5ad451[_0x1a6909(0xbd)][_0x1a6909(0x6a)](_0x486575),{'verbose':_0x14e67b['verbose']})]),_0x3b4c95=_0x561130['data'],_0x84144c=_0xa188d0[_0x1a6909(0xa6)];if(_0x3b4c95['length']===0x0)return console[_0x1a6909(0x8d)](a34_0x2a0149[_0x1a6909(0x9b)]('No\x20segments\x20found\x20in\x20parent\x20segment\x20\x27'+_0x93bef4+'\x27')),0x0;const _0x269ab8=buildFolderPathMap(_0x84144c),_0x47deba=_0x56dde8||getSegmentRootDir(sanitizeFileName(_0x12e20b)),_0x58eb24=new Map();await withSpinner(_0x1a6909(0xb3),async()=>{await batchAsync(_0x3b4c95,async _0x2ef2c6=>{const _0x4f3981=a34_0x2456,_0x3f628b=await _0x5ad451[_0x4f3981(0xbd)][_0x4f3981(0x6e)](_0x486575,_0x2ef2c6['id']);_0x58eb24['set'](_0x2ef2c6['id'],_0x3f628b);});},{'verbose':_0x14e67b[_0x1a6909(0xb0)]});const _0x556e2f=await withSpinner(_0x1a6909(0xaa),()=>_0x5ad451[_0x1a6909(0xa4)][_0x1a6909(0x87)](),{'verbose':_0x14e67b[_0x1a6909(0xb0)]})[_0x1a6909(0x83)](_0x11554e=>_0x11554e['data']),_0x3e30d8=await withSpinner(_0x1a6909(0x77),()=>_0x5ad451['connection']['buildIdToNameMap'](),{'verbose':_0x14e67b[_0x1a6909(0xb0)]})[_0x1a6909(0x83)](_0x31a00f=>_0x31a00f['data']),_0x532402=[],_0x4f98a8=a34_0x2c162a[_0x1a6909(0xc0)](_0x47deba,_0x1a6909(0xbf)),_0xe85cf0=createTdxConfigContent(_0x93bef4);_0x532402['push'](prepareFile(_0x4f98a8,_0xe85cf0,_0x47deba));const _0x1faca5=new Map();for(const _0x2e7f0e of _0x3b4c95){const _0x3a2589=_0x2e7f0e[_0x1a6909(0x97)]?_0x269ab8[_0x1a6909(0x71)](_0x2e7f0e[_0x1a6909(0x97)])||'':'',_0x75e6aa=_0x58eb24[_0x1a6909(0x71)](_0x2e7f0e['id'])||[],_0x2f4417=segmentWithActivationsToYaml(_0x2e7f0e,_0x75e6aa,undefined,_0x556e2f,_0x3e30d8),_0x22ebd2=_0x3a2589?a34_0x2c162a[_0x1a6909(0xc0)](_0x47deba,_0x3a2589):_0x47deba,_0x568166=sanitizeFileName(_0x2e7f0e[_0x1a6909(0x88)]),_0x5b7d23=getUniqueFileName(_0x22ebd2,_0x568166,_0x1faca5),_0x2a708f=a34_0x2c162a[_0x1a6909(0xc0)](_0x22ebd2,_0x5b7d23+'.yml'),_0x5162c0=segmentToYamlString(_0x2f4417);_0x532402['push'](prepareFile(_0x2a708f,_0x5162c0,_0x47deba));}const _0x559cdf=Array[_0x1a6909(0x8f)](_0x58eb24[_0x1a6909(0xb9)]())[_0x1a6909(0x7a)]((_0x1cdd68,_0x541013)=>_0x1cdd68+_0x541013[_0x1a6909(0xaf)],0x0),_0x458660=_0x532402[_0x1a6909(0x85)](_0x48966b=>_0x48966b[_0x1a6909(0x95)]),_0x120fc9=_0x532402[_0x1a6909(0x85)](_0x3f9cfc=>!_0x3f9cfc[_0x1a6909(0x95)]&&_0x3f9cfc['hasChanges']),_0x227545=_0x532402['filter'](_0x1bfa72=>!_0x1bfa72[_0x1a6909(0x95)]&&!_0x1bfa72[_0x1a6909(0x91)]);console['error'](_0x1a6909(0xae)+_0x93bef4+'\x27:'),console['error']('\x20\x20'+a34_0x2a0149['cyan'](_0x3b4c95[_0x1a6909(0xaf)]+_0x1a6909(0x98))+'\x20with\x20'+a34_0x2a0149[_0x1a6909(0xbe)](_0x559cdf+_0x1a6909(0x8a))),console[_0x1a6909(0x8d)]('\x20\x20'+a34_0x2a0149['green']('+\x20'+_0x458660[_0x1a6909(0xaf)]+_0x1a6909(0x79))),console[_0x1a6909(0x8d)]('\x20\x20'+a34_0x2a0149[_0x1a6909(0x9b)]('~\x20'+_0x120fc9[_0x1a6909(0xaf)]+_0x1a6909(0x92))),console[_0x1a6909(0x8d)]('\x20\x20'+a34_0x2a0149['dim']('=\x20'+_0x227545[_0x1a6909(0xaf)]+'\x20unchanged\x20files')),console[_0x1a6909(0x8d)](_0x1a6909(0x9d)+a34_0x2a0149[_0x1a6909(0xbe)](_0x47deba)+'\x0a');if(_0x120fc9[_0x1a6909(0xaf)]>0x0)for(const _0x50247c of _0x120fc9){console[_0x1a6909(0x8d)](_0x1a6909(0xb6)+_0x50247c['relativePath']+'\x27:'),console[_0x1a6909(0x8d)]('─'[_0x1a6909(0xba)](0x3c)),console[_0x1a6909(0x8d)](_0x50247c[_0x1a6909(0x93)]),console['error']('─'['repeat'](0x3c));}if(_0x14e67b['dryRun'])return console[_0x1a6909(0x8d)](a34_0x2a0149[_0x1a6909(0x9b)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x458660[_0x1a6909(0xaf)]===0x0&&_0x120fc9[_0x1a6909(0xaf)]===0x0)return console[_0x1a6909(0x8d)](a34_0x2a0149[_0x1a6909(0x9c)](_0x1a6909(0x7d))),saveSessionContext({'parent_segment':_0x93bef4},_0x14e67b['session']),console[_0x1a6909(0x8d)](a34_0x2a0149[_0x1a6909(0x9c)](_0x1a6909(0x74)+a34_0x2a0149[_0x1a6909(0xb7)](_0x1a6909(0xac))+_0x1a6909(0x8b)+a34_0x2a0149['cyan'](_0x93bef4))),0x0;if(!_0x14e67b[_0x1a6909(0x6d)]&&(_0x458660[_0x1a6909(0xaf)]>0x0||_0x120fc9['length']>0x0)){const _0x24318d=await confirmKey(_0x1a6909(0x7b)+(_0x458660[_0x1a6909(0xaf)]+_0x120fc9[_0x1a6909(0xaf)])+_0x1a6909(0xb4));if(!_0x24318d)return console['error'](_0x1a6909(0x6c)),0x1;}for(const _0x44064b of _0x532402){if(_0x44064b[_0x1a6909(0x95)]||_0x44064b[_0x1a6909(0x91)]){const _0xad9ebf=a34_0x2c162a[_0x1a6909(0xad)](_0x44064b[_0x1a6909(0xb5)]);!existsSync(_0xad9ebf)&&mkdirSync(_0xad9ebf,{'recursive':!![]}),writeFileSync(_0x44064b[_0x1a6909(0xb5)],_0x44064b['content'],_0x1a6909(0xa0));}}return console[_0x1a6909(0x8d)](a34_0x2a0149[_0x1a6909(0x9c)](_0x1a6909(0x9e)+(_0x458660['length']+_0x120fc9[_0x1a6909(0xaf)])+_0x1a6909(0xa7)+_0x47deba)),saveSessionContext({'parent_segment':_0x93bef4},_0x14e67b['session']),console[_0x1a6909(0x8d)](a34_0x2a0149[_0x1a6909(0x9c)](_0x1a6909(0x74)+a34_0x2a0149[_0x1a6909(0xb7)](_0x1a6909(0xac))+_0x1a6909(0x8b)+a34_0x2a0149[_0x1a6909(0xbe)](_0x93bef4))),0x0;}}function buildFolderPathMap(_0x1deb03){const _0x139767=a34_0x3b65a9,_0x2cc72c=new Map(),_0x4ba515=new Map();for(const _0x5ca0fa of _0x1deb03){_0x4ba515[_0x139767(0xb2)](_0x5ca0fa['id'],_0x5ca0fa);}const _0x479413=new Set();for(const _0x5cbd of _0x1deb03){!_0x5cbd['parentFolderId']&&_0x479413[_0x139767(0x8c)](_0x5cbd['id']);}function _0x114be2(_0x119dc8){const _0x4c854c=_0x139767;if(_0x2cc72c[_0x4c854c(0x9f)](_0x119dc8['id']))return _0x2cc72c[_0x4c854c(0x71)](_0x119dc8['id']);if(_0x479413[_0x4c854c(0x9f)](_0x119dc8['id']))return _0x2cc72c[_0x4c854c(0xb2)](_0x119dc8['id'],''),'';if(_0x119dc8[_0x4c854c(0x86)]){const _0x59789c=_0x4ba515[_0x4c854c(0x71)](_0x119dc8[_0x4c854c(0x86)]);if(_0x59789c){const _0x23becf=_0x114be2(_0x59789c),_0x54bbf1=_0x23becf?_0x23becf+'/'+_0x119dc8['name']:_0x119dc8[_0x4c854c(0x88)];return _0x2cc72c['set'](_0x119dc8['id'],_0x54bbf1),_0x54bbf1;}}const _0x3f0836=_0x119dc8['name'];return _0x2cc72c[_0x4c854c(0xb2)](_0x119dc8['id'],_0x3f0836),_0x3f0836;}for(const _0x1e7ff3 of _0x1deb03){_0x114be2(_0x1e7ff3);}return _0x2cc72c;}function getUniqueFileName(_0x27bfb4,_0x35b25f,_0x31fb3e){const _0x431f18=a34_0x3b65a9,_0x134ed6=_0x27bfb4+':'+_0x35b25f,_0x163f6c=_0x31fb3e[_0x431f18(0x71)](_0x134ed6)||0x0;_0x31fb3e[_0x431f18(0xb2)](_0x134ed6,_0x163f6c+0x1);if(_0x163f6c===0x0)return _0x35b25f;return _0x35b25f+'-'+_0x163f6c;}function prepareFile(_0x48e4ef,_0x28a978,_0x402133){const _0x10ba22=a34_0x3b65a9,_0x504bb4=a34_0x2c162a['relative'](_0x402133,_0x48e4ef);if(existsSync(_0x48e4ef)){const _0x44a8cf=readFileSync(_0x48e4ef,_0x10ba22(0xa0)),_0x348020=generateDiff(_0x44a8cf,_0x28a978),_0x42f0d2=hasChanges(_0x348020);return{'relativePath':_0x504bb4,'absolutePath':_0x48e4ef,'content':_0x28a978,'isNew':![],'hasChanges':_0x42f0d2,'diff':_0x42f0d2?formatDiffWithColors(_0x348020):undefined};}return{'relativePath':_0x504bb4,'absolutePath':_0x48e4ef,'content':_0x28a978,'isNew':!![],'hasChanges':![]};}
1
+ const a34_0x465202=a34_0x465b;(function(_0x45f000,_0x30aefd){const _0x2313cc=a34_0x465b,_0x3847fb=_0x45f000();while(!![]){try{const _0xc4152b=-parseInt(_0x2313cc(0x115))/0x1+parseInt(_0x2313cc(0x161))/0x2+parseInt(_0x2313cc(0x11b))/0x3+-parseInt(_0x2313cc(0x116))/0x4*(parseInt(_0x2313cc(0x110))/0x5)+parseInt(_0x2313cc(0x125))/0x6*(parseInt(_0x2313cc(0x114))/0x7)+-parseInt(_0x2313cc(0x124))/0x8*(-parseInt(_0x2313cc(0x15d))/0x9)+-parseInt(_0x2313cc(0x151))/0xa*(parseInt(_0x2313cc(0x13a))/0xb);if(_0xc4152b===_0x30aefd)break;else _0x3847fb['push'](_0x3847fb['shift']());}catch(_0x513d22){_0x3847fb['push'](_0x3847fb['shift']());}}}(a34_0x3dd9,0x6062f));function a34_0x3dd9(){const _0x4de0c6=['repeat','Site:\x20','diff','\x20\x20Target:\x20','absolutePath','buildIdToNameMap','Aborted.','verbose','Fetching\x20users\x20for\x20email\x20resolution...','\x20=\x20','yellow','Resolved\x20parent\x20name:\x20','tdx.json','Fetching\x20activations...','resolveParentId','10ODaVQA','isNew','\x20activations','cyan','Write\x20','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','dirname','isDirectory','buildIdToEmailMap','green','from','attributes','9sMwWYn','Fetching\x20segments...','Found\x20existing\x20tdx.json\x20at:\x20','listActivations','1110424NlpxCR','getParent','utf-8','listSegments','Using\x20parent\x20segment:\x20','Resolving\x20parent\x20segment\x20\x27','\x20new\x20files','\x0aPull\x20summary\x20for\x20\x27','parent_segment','Fetching\x20connections\x20for\x20name\x20resolution...','\x20files\x20to\x20','hasChanges','1760195IODkWe','session','data','Found\x20tdx.json\x20at:\x20','1113KaoEXg','269817UgVoAg','4jeKeXK','user','filter','connection','✔\x20Context\x20set:\x20','2097051kbXvMR','Pull\x20child\x20segments\x20to\x20YAML\x20files','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','yes','join','dim','\x20with\x20','\x20unchanged\x20files','Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)','5233976nokRJl','18714lCXXPL','segmentFolderId','error','push','segment','content','Fetching\x20parent\x20segment\x20info...','execute','✔\x20Pulled\x20','name','\x0aChanges\x20to\x20\x27','get','relativePath','\x27...','then','Fetching\x20folders...','✔\x20All\x20files\x20are\x20up\x20to\x20date','set','relative','site','segment:pull','15265162eLdIIl','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','\x20segments','\x20changed\x20files','red','\x20files?','parentFolderId','length'];a34_0x3dd9=function(){return _0x4de0c6;};return a34_0x3dd9();}import{BaseCommand}from'./command.js';import{withSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{getSegmentRootDir,createTdxConfigContent,findTdxConfigPath,loadTdxConfig}from'../utils/tdx-config.js';import{saveSessionContext}from'../core/session.js';function a34_0x465b(_0x2d3296,_0x3f695c){_0x2d3296=_0x2d3296-0x106;const _0x3dd9e7=a34_0x3dd9();let _0x465b7e=_0x3dd9e7[_0x2d3296];return _0x465b7e;}import{segmentWithActivationsToYaml,segmentToYamlString}from'../sdk/segment/child-segment-yaml.js';import a34_0x270373 from'chalk';import{existsSync,mkdirSync,readFileSync,writeFileSync,statSync}from'fs';import a34_0x33aea1 from'path';import{sanitizeFileName}from'../utils/string-utils.js';export class SegmentPullCommand extends BaseCommand{[a34_0x465202(0x12e)]=a34_0x465202(0x139);['description']=a34_0x465202(0x11c);async[a34_0x465202(0x12c)](_0x35b601){const _0x11e91=a34_0x465202,{options:_0x35451c,args:_0x2a51f5,tdx:_0x3450e7}=_0x35b601,_0x4ffcdc=_0x35451c,_0x54d567=_0x35451c['parentSegment'],_0x5d597b=_0x2a51f5[0x0],_0x4b6a33=findTdxConfigPath();let _0x30f3bf,_0x400f73;if(!_0x5d597b&&_0x4b6a33){const _0x310237=loadTdxConfig(_0x4b6a33);_0x30f3bf=_0x310237[_0x11e91(0x10c)],_0x400f73=a34_0x33aea1[_0x11e91(0x157)](_0x4b6a33),_0x4ffcdc[_0x11e91(0x149)]&&(console[_0x11e91(0x127)](_0x11e91(0x15f)+_0x4b6a33),console[_0x11e91(0x127)](_0x11e91(0x108)+_0x30f3bf));}else{if(_0x5d597b){if(existsSync(_0x5d597b)&&statSync(_0x5d597b)[_0x11e91(0x158)]()){const _0x291728=findTdxConfigPath(_0x5d597b);if(_0x291728){const _0x297784=loadTdxConfig(_0x291728);_0x30f3bf=_0x297784[_0x11e91(0x10c)],_0x400f73=a34_0x33aea1[_0x11e91(0x157)](_0x291728),_0x4ffcdc[_0x11e91(0x149)]&&(console[_0x11e91(0x127)](_0x11e91(0x113)+_0x291728),console['error'](_0x11e91(0x108)+_0x30f3bf));}else return console[_0x11e91(0x127)](a34_0x270373[_0x11e91(0x13e)](_0x11e91(0x11d)+_0x5d597b+'\x0a')),console['error'](a34_0x270373[_0x11e91(0x154)](_0x11e91(0x156))),0x1;}else _0x30f3bf=_0x5d597b;}else _0x30f3bf=_0x54d567;}if(!_0x30f3bf)return console[_0x11e91(0x127)](a34_0x270373[_0x11e91(0x14c)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console['error'](_0x11e91(0x123)),console['error'](_0x11e91(0x13b)),console[_0x11e91(0x127)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file'),0x1;_0x4ffcdc[_0x11e91(0x149)]&&(console[_0x11e91(0x127)](_0x11e91(0x143)+_0x4ffcdc[_0x11e91(0x138)]),console['error']('Parent\x20segment:\x20'+_0x30f3bf));const _0x223f70=await withSpinner(_0x11e91(0x109)+_0x30f3bf+_0x11e91(0x132),()=>_0x3450e7[_0x11e91(0x129)][_0x11e91(0x150)](_0x30f3bf),{'verbose':_0x4ffcdc['verbose']}),_0x44f65d=_0x223f70[_0x11e91(0x112)],_0x705422=await withSpinner(_0x11e91(0x12b),()=>_0x3450e7[_0x11e91(0x129)][_0x11e91(0x162)](_0x44f65d),{'verbose':_0x4ffcdc[_0x11e91(0x149)]}),_0x220277=_0x705422[_0x11e91(0x112)][_0x11e91(0x15c)][_0x11e91(0x12e)];_0x4ffcdc['verbose']&&console[_0x11e91(0x127)](_0x11e91(0x14d)+_0x220277);const [_0x2d9d8d,_0x8de52d]=await Promise['all']([withSpinner(_0x11e91(0x15e),()=>_0x3450e7[_0x11e91(0x129)][_0x11e91(0x107)](_0x44f65d),{'verbose':_0x4ffcdc[_0x11e91(0x149)]}),withSpinner(_0x11e91(0x134),()=>_0x3450e7[_0x11e91(0x129)]['listFolders'](_0x44f65d),{'verbose':_0x4ffcdc[_0x11e91(0x149)]})]),_0x4528c5=_0x2d9d8d[_0x11e91(0x112)],_0x1a717b=_0x8de52d[_0x11e91(0x112)];if(_0x4528c5[_0x11e91(0x141)]===0x0)return console['error'](a34_0x270373[_0x11e91(0x14c)]('No\x20segments\x20found\x20in\x20parent\x20segment\x20\x27'+_0x220277+'\x27')),0x0;const _0x459dfb=buildFolderPathMap(_0x1a717b),_0x5206b2=_0x400f73||getSegmentRootDir(sanitizeFileName(_0x30f3bf)),_0x46b9e2=new Map();await withSpinner(_0x11e91(0x14f),async()=>{await batchAsync(_0x4528c5,async _0x275032=>{const _0x245b1e=a34_0x465b,_0x129366=await _0x3450e7[_0x245b1e(0x129)][_0x245b1e(0x160)](_0x44f65d,_0x275032['id']);_0x46b9e2[_0x245b1e(0x136)](_0x275032['id'],_0x129366);});},{'verbose':_0x4ffcdc[_0x11e91(0x149)]});const _0x1c7679=await withSpinner(_0x11e91(0x14a),()=>_0x3450e7[_0x11e91(0x117)][_0x11e91(0x159)](),{'verbose':_0x4ffcdc[_0x11e91(0x149)]})['then'](_0x10a466=>_0x10a466[_0x11e91(0x112)]),_0xf932dc=await withSpinner(_0x11e91(0x10d),()=>_0x3450e7[_0x11e91(0x119)][_0x11e91(0x147)](),{'verbose':_0x4ffcdc[_0x11e91(0x149)]})[_0x11e91(0x133)](_0x6e7d27=>_0x6e7d27[_0x11e91(0x112)]),_0x59aed9=[],_0x22f5ee=a34_0x33aea1['join'](_0x5206b2,_0x11e91(0x14e)),_0x2c7f95=createTdxConfigContent(_0x220277);_0x59aed9['push'](prepareFile(_0x22f5ee,_0x2c7f95,_0x5206b2));const _0x293047=new Map();for(const _0x15ea47 of _0x4528c5){const _0x19e106=_0x15ea47[_0x11e91(0x126)]?_0x459dfb[_0x11e91(0x130)](_0x15ea47[_0x11e91(0x126)])||'':'',_0x64fcea=_0x46b9e2[_0x11e91(0x130)](_0x15ea47['id'])||[],_0x31271d=segmentWithActivationsToYaml(_0x15ea47,_0x64fcea,undefined,_0x1c7679,_0xf932dc),_0x20ae41=_0x19e106?a34_0x33aea1[_0x11e91(0x11f)](_0x5206b2,_0x19e106):_0x5206b2,_0x35422f=sanitizeFileName(_0x15ea47['name']),_0x21b942=getUniqueFileName(_0x20ae41,_0x35422f,_0x293047),_0x5a75c6=a34_0x33aea1[_0x11e91(0x11f)](_0x20ae41,_0x21b942+'.yml'),_0x576e81=segmentToYamlString(_0x31271d);_0x59aed9[_0x11e91(0x128)](prepareFile(_0x5a75c6,_0x576e81,_0x5206b2));}const _0x204171=Array[_0x11e91(0x15b)](_0x46b9e2['values']())['reduce']((_0x4a930a,_0xd4e669)=>_0x4a930a+_0xd4e669[_0x11e91(0x141)],0x0),_0x3c04f1=_0x59aed9[_0x11e91(0x118)](_0x445b67=>_0x445b67[_0x11e91(0x152)]),_0x23874d=_0x59aed9[_0x11e91(0x118)](_0x53745b=>!_0x53745b[_0x11e91(0x152)]&&_0x53745b[_0x11e91(0x10f)]),_0x3f71e1=_0x59aed9['filter'](_0x260c6c=>!_0x260c6c[_0x11e91(0x152)]&&!_0x260c6c[_0x11e91(0x10f)]);console[_0x11e91(0x127)](_0x11e91(0x10b)+_0x220277+'\x27:'),console['error']('\x20\x20'+a34_0x270373[_0x11e91(0x154)](_0x4528c5['length']+_0x11e91(0x13c))+_0x11e91(0x121)+a34_0x270373[_0x11e91(0x154)](_0x204171+_0x11e91(0x153))),console['error']('\x20\x20'+a34_0x270373[_0x11e91(0x15a)]('+\x20'+_0x3c04f1['length']+_0x11e91(0x10a))),console[_0x11e91(0x127)]('\x20\x20'+a34_0x270373[_0x11e91(0x14c)]('~\x20'+_0x23874d[_0x11e91(0x141)]+_0x11e91(0x13d))),console['error']('\x20\x20'+a34_0x270373[_0x11e91(0x120)]('=\x20'+_0x3f71e1['length']+_0x11e91(0x122))),console[_0x11e91(0x127)](_0x11e91(0x145)+a34_0x270373[_0x11e91(0x154)](_0x5206b2)+'\x0a');if(_0x23874d[_0x11e91(0x141)]>0x0)for(const _0x527128 of _0x23874d){console[_0x11e91(0x127)](_0x11e91(0x12f)+_0x527128[_0x11e91(0x131)]+'\x27:'),console[_0x11e91(0x127)]('─'[_0x11e91(0x142)](0x3c)),console[_0x11e91(0x127)](_0x527128[_0x11e91(0x144)]),console['error']('─'[_0x11e91(0x142)](0x3c));}if(_0x4ffcdc['dryRun'])return console[_0x11e91(0x127)](a34_0x270373['yellow']('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x3c04f1['length']===0x0&&_0x23874d[_0x11e91(0x141)]===0x0)return console[_0x11e91(0x127)](a34_0x270373[_0x11e91(0x15a)](_0x11e91(0x135))),saveSessionContext({'parent_segment':_0x220277},_0x4ffcdc[_0x11e91(0x111)]),console['error'](a34_0x270373[_0x11e91(0x15a)](_0x11e91(0x11a)+a34_0x270373[_0x11e91(0x120)](_0x11e91(0x10c))+_0x11e91(0x14b)+a34_0x270373[_0x11e91(0x154)](_0x220277))),0x0;if(!_0x4ffcdc[_0x11e91(0x11e)]&&(_0x3c04f1[_0x11e91(0x141)]>0x0||_0x23874d[_0x11e91(0x141)]>0x0)){const _0x16cad8=await confirmKey(_0x11e91(0x155)+(_0x3c04f1[_0x11e91(0x141)]+_0x23874d[_0x11e91(0x141)])+_0x11e91(0x13f));if(!_0x16cad8)return console[_0x11e91(0x127)](_0x11e91(0x148)),0x1;}for(const _0x4620d8 of _0x59aed9){if(_0x4620d8[_0x11e91(0x152)]||_0x4620d8[_0x11e91(0x10f)]){const _0x146535=a34_0x33aea1['dirname'](_0x4620d8[_0x11e91(0x146)]);!existsSync(_0x146535)&&mkdirSync(_0x146535,{'recursive':!![]}),writeFileSync(_0x4620d8[_0x11e91(0x146)],_0x4620d8[_0x11e91(0x12a)],_0x11e91(0x106));}}return console[_0x11e91(0x127)](a34_0x270373[_0x11e91(0x15a)](_0x11e91(0x12d)+(_0x3c04f1['length']+_0x23874d[_0x11e91(0x141)])+_0x11e91(0x10e)+_0x5206b2)),saveSessionContext({'parent_segment':_0x220277},_0x4ffcdc['session']),console[_0x11e91(0x127)](a34_0x270373[_0x11e91(0x15a)](_0x11e91(0x11a)+a34_0x270373[_0x11e91(0x120)]('parent_segment')+_0x11e91(0x14b)+a34_0x270373['cyan'](_0x220277))),0x0;}}function buildFolderPathMap(_0x4c474c){const _0x298790=a34_0x465202,_0x5c4b99=new Map(),_0x31a798=new Map();for(const _0x57fdf1 of _0x4c474c){_0x31a798[_0x298790(0x136)](_0x57fdf1['id'],_0x57fdf1);}const _0x3681db=new Set();for(const _0x8e6f77 of _0x4c474c){!_0x8e6f77[_0x298790(0x140)]&&_0x3681db['add'](_0x8e6f77['id']);}function _0x45b4f0(_0x13c5ae){const _0xc10db9=_0x298790;if(_0x5c4b99['has'](_0x13c5ae['id']))return _0x5c4b99[_0xc10db9(0x130)](_0x13c5ae['id']);if(_0x3681db['has'](_0x13c5ae['id']))return _0x5c4b99['set'](_0x13c5ae['id'],''),'';if(_0x13c5ae[_0xc10db9(0x140)]){const _0x302ef8=_0x31a798['get'](_0x13c5ae[_0xc10db9(0x140)]);if(_0x302ef8){const _0x469d29=_0x45b4f0(_0x302ef8),_0x298543=_0x469d29?_0x469d29+'/'+_0x13c5ae[_0xc10db9(0x12e)]:_0x13c5ae[_0xc10db9(0x12e)];return _0x5c4b99['set'](_0x13c5ae['id'],_0x298543),_0x298543;}}const _0x4cd36d=_0x13c5ae[_0xc10db9(0x12e)];return _0x5c4b99[_0xc10db9(0x136)](_0x13c5ae['id'],_0x4cd36d),_0x4cd36d;}for(const _0x1ea0d4 of _0x4c474c){_0x45b4f0(_0x1ea0d4);}return _0x5c4b99;}function getUniqueFileName(_0xed0ba2,_0x301b34,_0x4251eb){const _0x1cfe33=a34_0x465202,_0x2ab3cd=_0xed0ba2+':'+_0x301b34,_0x4a3200=_0x4251eb[_0x1cfe33(0x130)](_0x2ab3cd)||0x0;_0x4251eb[_0x1cfe33(0x136)](_0x2ab3cd,_0x4a3200+0x1);if(_0x4a3200===0x0)return _0x301b34;return _0x301b34+'-'+_0x4a3200;}function prepareFile(_0x454e07,_0x88ee76,_0xb10657){const _0x57f9b5=a34_0x465202,_0x38743e=a34_0x33aea1[_0x57f9b5(0x137)](_0xb10657,_0x454e07);if(existsSync(_0x454e07)){const _0x3f2c67=readFileSync(_0x454e07,_0x57f9b5(0x106)),_0x2cbe62=generateDiff(_0x3f2c67,_0x88ee76),_0x52ab92=hasChanges(_0x2cbe62);return{'relativePath':_0x38743e,'absolutePath':_0x454e07,'content':_0x88ee76,'isNew':![],'hasChanges':_0x52ab92,'diff':_0x52ab92?formatDiffWithColors(_0x2cbe62):undefined};}return{'relativePath':_0x38743e,'absolutePath':_0x454e07,'content':_0x88ee76,'isNew':!![],'hasChanges':![]};}
@@ -1 +1 @@
1
- const a35_0x573744=a35_0x99f9;(function(_0x1ed017,_0x3112ce){const _0x325ae4=a35_0x99f9,_0x2e0afe=_0x1ed017();while(!![]){try{const _0x33c6bd=parseInt(_0x325ae4(0x96))/0x1*(-parseInt(_0x325ae4(0xb0))/0x2)+-parseInt(_0x325ae4(0xaa))/0x3+-parseInt(_0x325ae4(0xfa))/0x4+-parseInt(_0x325ae4(0xa1))/0x5*(parseInt(_0x325ae4(0xcf))/0x6)+parseInt(_0x325ae4(0xc0))/0x7*(parseInt(_0x325ae4(0x90))/0x8)+parseInt(_0x325ae4(0xb8))/0x9*(parseInt(_0x325ae4(0x7d))/0xa)+-parseInt(_0x325ae4(0xce))/0xb*(-parseInt(_0x325ae4(0xdf))/0xc);if(_0x33c6bd===_0x3112ce)break;else _0x2e0afe['push'](_0x2e0afe['shift']());}catch(_0x5d1327){_0x2e0afe['push'](_0x2e0afe['shift']());}}}(a35_0x3645,0xf2c6e));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';function a35_0x3645(){const _0x69b646=['\x27...','segmentFolderId','resolveParentId','isDirectory','sort','\x20folders\x20to\x20create','SEGMENT_SYNTAX_ERROR','34812LOJagj','isNew','blue','set','Changes\x20to:','No\x20segment\x20YAML\x20files\x20found','\x20\x20✔\x20Updated\x20activation\x20\x27','join','Failed\x20to\x20','Parent\x20segment:\x20','Updating\x20activation\x20\x27','all','existingActivation','type','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)','resolve','\x20to\x20delete','\x20unchanged\x20segments','toString','diff','Source\x20directory:\x20','deleteSegment','data','yes','parentSegment','Creating\x20folder\x20\x27','✔\x20Created\x20segment\x20\x27','7440520LuyGUk','delete','parent_segment','parentFolderId','\x20\x20Activations:','\x27\x20from\x20file:\x20','Deleting\x20activation\x20\x27','connection','\x20new\x20segments','\x20activations]','New\x20segment:','yamlActivation','Site:\x20','\x0aPush\x20summary\x20for\x20\x27','from','Fetching\x20existing\x20activations...','dim','3760mnZaoY','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','cwd','split','\x20segments\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','filter','updateSegmentById','segment:push','stringify','description','segment','Resolving\x20parent\x20segment\x20\x27','\x20changed\x20segments','\x20updated','cyan','hasChanges','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','Deleting\x20segment\x20\x27','\x20deleted','802184mhShoc','Fetching\x20users\x20for\x20email\x20resolution...','verbose','startsWith','createActivation','update','1628834DikQxk','activationActions','ACTIVATION_UPDATE_ERROR','Aborted.','Updating\x20segment\x20\x27','.yml','yamlConfig','Delete\x20segment:','absolutePath','name','repeat','9072285PiEyFO','Fetching\x20connections\x20for\x20name\x20resolution...','has','existingSegment','📁\x20','get','\x20to\x20update','configDir','buildIdToNameMap','2825871BpgHVS','createFolder','\x20\x20✔\x20Created\x20activation\x20\x27','dirname','\x20segment\x20from\x20file:\x20','push','2ErUjjE','Folders\x20to\x20create:','\x20created','activations','user','\x20\x20Segments:\x20','create','error','17919kDaJbC','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','flatMap','add','.yaml','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','site','green','7IvtlpQ','endsWith','\x20\x20✔\x20Deleted\x20activation\x20\x27','yellow','red','✔\x20Created\x20folder\x20\x27','then','\x20\x20Source:\x20','Scoped\x20to\x20folder:\x20','Error:\x20Directory\x20not\x20found:\x20','relative','deleteActivation','\x20changes?','folderPath','24233qShfRG','6CAByjF','config','SEGMENT_UPDATE_ERROR','updateActivation','length','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20files','\x20\x20\x20\x20','slice'];a35_0x3645=function(){return _0x69b646;};return a35_0x3645();}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_0x526ed4 from'chalk';import{existsSync,readFileSync,statSync,readdirSync}from'fs';import a35_0x186522 from'path';import*as a35_0x4dfc51 from'yaml';import{sanitizeFileName}from'../utils/string-utils.js';function tryFindTdxConfig(_0x2f4af9){try{return findTdxConfig(_0x2f4af9);}catch{return null;}}function resolveTDFolderPath(_0x312df5,_0x1ad314,_0x1c7b35){if(!_0x1ad314)return _0x312df5;return _0x312df5?_0x1c7b35+'/'+_0x312df5:_0x1c7b35;}export class SegmentPushCommand extends BaseCommand{['name']=a35_0x573744(0x84);[a35_0x573744(0x86)]=a35_0x573744(0xbd);async['execute'](_0x5caaf4){const _0x1c8156=a35_0x573744,{options:_0x199607,args:_0x358e34,tdx:_0x2b54e0}=_0x5caaf4,_0x5b4148=_0x199607,_0x26dac7=_0x199607[_0x1c8156(0xf7)],_0x1c1459=_0x358e34[0x0];let _0xf21207,_0x2ee342,_0x40dac6,_0x7e331e;if(_0x1c1459){if(existsSync(_0x1c1459)&&statSync(_0x1c1459)['isDirectory']()){const _0xd29809=tryFindTdxConfig(_0x1c1459);if(_0xd29809)_0xf21207=_0xd29809[_0x1c8156(0xd0)]['parent_segment'],_0x2ee342=_0x1c1459,_0x40dac6=_0xd29809[_0x1c8156(0xa8)];else return console[_0x1c8156(0xb7)](a35_0x526ed4[_0x1c8156(0xc4)]('Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20'+_0x1c1459+'\x0a')),console[_0x1c8156(0xb7)](a35_0x526ed4['cyan'](_0x1c8156(0xb9))),0x1;}else{if(existsSync(_0x1c1459)&&statSync(_0x1c1459)['isFile']()){const _0x55dca5=a35_0x186522[_0x1c8156(0xad)](_0x1c1459),_0x1156cb=tryFindTdxConfig(_0x55dca5);if(_0x1156cb)_0xf21207=_0x1156cb['config'][_0x1c8156(0x6e)],_0x40dac6=_0x1156cb['configDir'],_0x2ee342=_0x1156cb['configDir'],_0x7e331e=a35_0x186522[_0x1c8156(0xee)](_0x1c1459);else return console[_0x1c8156(0xb7)](a35_0x526ed4[_0x1c8156(0xc4)]('Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20'+_0x55dca5+'\x0a')),console['error'](a35_0x526ed4['cyan'](_0x1c8156(0xb9))),0x1;}else _0xf21207=_0x1c1459;}}else{const _0x5b1bfe=tryFindTdxConfig(process[_0x1c8156(0x7f)]());_0x5b1bfe?(_0xf21207=_0x5b1bfe['config'][_0x1c8156(0x6e)],_0x2ee342=process[_0x1c8156(0x7f)](),_0x40dac6=_0x5b1bfe['configDir']):_0xf21207=_0x26dac7;}if(!_0xf21207)return console['error'](a35_0x526ed4['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console['error'](_0x1c8156(0xed)),console[_0x1c8156(0xb7)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent'),console[_0x1c8156(0xb7)](_0x1c8156(0xd4)),0x1;const _0x4bb15f=_0x2ee342||getSegmentRootDir(sanitizeFileName(_0xf21207)),_0x227337=_0x40dac6||_0x4bb15f,_0x404a9e=a35_0x186522[_0x1c8156(0xca)](_0x227337,_0x4bb15f),_0x5dcff4=_0x404a9e!==''&&_0x404a9e!=='.';if(!existsSync(_0x4bb15f))return console[_0x1c8156(0xb7)](a35_0x526ed4[_0x1c8156(0xc4)](_0x1c8156(0xc9)+_0x4bb15f+'\x0a')),console[_0x1c8156(0xb7)](a35_0x526ed4[_0x1c8156(0x8b)](_0x1c8156(0xb9))),0x1;_0x5b4148[_0x1c8156(0x92)]&&(console[_0x1c8156(0xb7)](_0x1c8156(0x78)+_0x5b4148[_0x1c8156(0xbe)]),console[_0x1c8156(0xb7)](_0x1c8156(0xe8)+_0xf21207),console['error'](_0x1c8156(0xf3)+_0x4bb15f),_0x5dcff4&&console['error'](_0x1c8156(0xc8)+_0x404a9e));const _0x40c8fb=await withSpinner(_0x1c8156(0x88)+_0xf21207+_0x1c8156(0xd8),()=>_0x2b54e0[_0x1c8156(0x87)][_0x1c8156(0xda)](_0xf21207),{'verbose':_0x5b4148[_0x1c8156(0x92)]}),_0x4122f8=_0x40c8fb['data'],[_0x351ca8,_0x5c7997,_0x10485f]=await Promise[_0x1c8156(0xea)]([withSpinner('Fetching\x20existing\x20segments...',()=>_0x2b54e0[_0x1c8156(0x87)]['listSegments'](_0x4122f8),{'verbose':_0x5b4148[_0x1c8156(0x92)]}),withSpinner('Fetching\x20existing\x20folders...',()=>_0x2b54e0[_0x1c8156(0x87)]['listFolders'](_0x4122f8),{'verbose':_0x5b4148[_0x1c8156(0x92)]}),withSpinner(_0x1c8156(0x91),()=>_0x2b54e0[_0x1c8156(0xb4)]['buildUserMaps'](),{'verbose':_0x5b4148[_0x1c8156(0x92)]})[_0x1c8156(0xc6)](_0x578e36=>_0x578e36[_0x1c8156(0xf5)])]),_0x73686e=_0x351ca8[_0x1c8156(0xf5)],_0x57fbdd=_0x5c7997[_0x1c8156(0xf5)],{emailToId:_0x4d5d27,idToEmail:_0xb80adc}=_0x10485f,[_0x316853,_0x31f7c2]=await withSpinner(_0x1c8156(0xa2),async()=>{const _0x196eaa=_0x1c8156,[_0x13de62,_0x2c5927]=await Promise['all']([_0x2b54e0[_0x196eaa(0x73)]['buildNameToIdMap'](),_0x2b54e0[_0x196eaa(0x73)][_0x196eaa(0xa9)]()]);return[_0x13de62,_0x2c5927];},{'verbose':_0x5b4148['verbose']})[_0x1c8156(0xc6)](_0x1b0899=>_0x1b0899[_0x1c8156(0xf5)]),_0x6f5a5f=buildFolderPathToIdMap(_0x57fbdd),_0x2b39cb=new Map();for(const [_0x47f439,_0x3a6c24]of _0x6f5a5f['entries']()){_0x2b39cb[_0x1c8156(0xe2)](_0x3a6c24,_0x47f439);}const _0x3aeb97=new Map();for(const _0x460a3f of _0x73686e){const _0x735f2d=_0x460a3f[_0x1c8156(0xd9)]?_0x2b39cb[_0x1c8156(0xa6)](_0x460a3f[_0x1c8156(0xd9)][_0x1c8156(0xf1)]())||'':'',_0x53a39b=_0x735f2d+':'+_0x460a3f[_0x1c8156(0x9f)];_0x3aeb97[_0x1c8156(0xe2)](_0x53a39b,_0x460a3f);}let _0x39f0f5;if(_0x7e331e){if(!_0x7e331e[_0x1c8156(0xc1)](_0x1c8156(0x9b))&&!_0x7e331e[_0x1c8156(0xc1)](_0x1c8156(0xbc)))return console[_0x1c8156(0xb7)](a35_0x526ed4['red'](_0x1c8156(0x7e)+_0x7e331e+'\x0a')),0x1;_0x39f0f5=[_0x7e331e];}else _0x39f0f5=findYamlFiles(_0x4bb15f);if(_0x39f0f5[_0x1c8156(0xd3)]===0x0)return console['error'](a35_0x526ed4[_0x1c8156(0xc4)]('Error:\x20No\x20segment\x20YAML\x20files\x20found\x20in\x20'+_0x4bb15f+'\x0a')),console[_0x1c8156(0xb7)](a35_0x526ed4[_0x1c8156(0x8b)](_0x1c8156(0xd5))),0x1;const _0x27a31e=[];for(const _0x4336f7 of _0x39f0f5){const _0x4fb342=a35_0x186522['relative'](_0x4bb15f,a35_0x186522['dirname'](_0x4336f7)),_0x5d5024=_0x4fb342==='.'?'':_0x4fb342,_0x443aa8=readFileSync(_0x4336f7,'utf-8');try{const _0x190f3e=parseSegmentYamlFile(_0x443aa8),_0x65bb50=normalizeChildSegmentYaml(_0x190f3e);_0x27a31e[_0x1c8156(0xaf)]({'yamlConfig':_0x65bb50,'folderPath':_0x5d5024,'sourcePath':_0x4336f7});}catch(_0x5d92f9){return console[_0x1c8156(0xb7)](a35_0x526ed4[_0x1c8156(0xc4)]('Error\x20parsing\x20'+_0x4336f7+':\x20'+(_0x5d92f9 instanceof Error?_0x5d92f9['message']:_0x5d92f9))),0x1;}}if(_0x27a31e['length']===0x0)return console['error'](a35_0x526ed4[_0x1c8156(0xc3)](_0x1c8156(0xe4))),0x0;const _0x38a02d=new Map();_0x73686e[_0x1c8156(0xd3)]>0x0&&await withSpinner(_0x1c8156(0x7b),async()=>{await batchAsync(_0x73686e,async _0x73b62e=>{const _0x81d60b=a35_0x99f9,_0x4770d5=await _0x2b54e0['segment']['listActivations'](_0x4122f8,_0x73b62e['id']);_0x38a02d[_0x81d60b(0xe2)](_0x73b62e['id'],_0x4770d5);});},{'verbose':_0x5b4148[_0x1c8156(0x92)]});const _0x2db2b5=[],_0x2ee17b=new Set();for(const {yamlConfig:_0x117e22,folderPath:_0x190cf4,sourcePath:_0x4156da}of _0x27a31e){const _0x18471d=resolveTDFolderPath(_0x190cf4,_0x5dcff4,_0x404a9e),_0x1e239c=_0x18471d+':'+_0x117e22[_0x1c8156(0x9f)],_0x406aad=_0x3aeb97[_0x1c8156(0xa6)](_0x1e239c),_0x4a7eb2=_0x406aad?_0x38a02d[_0x1c8156(0xa6)](_0x406aad['id'])||[]:[];if(_0x18471d&&!_0x6f5a5f[_0x1c8156(0xa3)](_0x18471d)){const _0x316d02=_0x18471d[_0x1c8156(0x80)]('/');let _0x1cccb7='';for(const _0x5bbb98 of _0x316d02){_0x1cccb7=_0x1cccb7?_0x1cccb7+'/'+_0x5bbb98:_0x5bbb98,!_0x6f5a5f['has'](_0x1cccb7)&&_0x2ee17b[_0x1c8156(0xbb)](_0x1cccb7);}}const _0x571118=calculateActivationActions(_0x117e22[_0x1c8156(0xb3)]||[],_0x4a7eb2,_0xb80adc,_0x31f7c2),_0x56c806=segmentToYamlString(_0x117e22);let _0x3bdc7a,_0x5d4e50=![],_0x512f9d;if(_0x406aad){const _0x4840c9=segmentWithActivationsToYaml(_0x406aad,_0x4a7eb2,undefined,_0xb80adc,_0x31f7c2),_0x1188b6=segmentToYamlString(_0x4840c9);_0x3bdc7a=generateDiff(_0x1188b6,_0x56c806),_0x5d4e50=hasChanges(_0x3bdc7a),_0x5d4e50&&(_0x512f9d=formatDiffWithColors(_0x3bdc7a));}else _0x3bdc7a=generateDiff('',_0x56c806),_0x512f9d=formatDiffWithColors(_0x3bdc7a);_0x2db2b5[_0x1c8156(0xaf)]({'relativePath':_0x117e22[_0x1c8156(0x9f)],'absolutePath':_0x4156da,'yamlConfig':_0x117e22,'folderPath':_0x18471d,'existingSegment':_0x406aad,'existingActivations':_0x4a7eb2,'isNew':!_0x406aad,'hasChanges':_0x5d4e50,'diff':_0x512f9d,'activationActions':_0x571118});}let _0x3b2e87=[];if(!_0x7e331e){const _0xcb2a2=new Set();for(const {yamlConfig:_0x2b3d06,folderPath:_0x206c65}of _0x27a31e){const _0x2688ba=resolveTDFolderPath(_0x206c65,_0x5dcff4,_0x404a9e);_0xcb2a2[_0x1c8156(0xbb)](_0x2688ba+':'+_0x2b3d06[_0x1c8156(0x9f)]);}_0x3b2e87=_0x73686e[_0x1c8156(0x82)](_0x3f6775=>{const _0x3d58a5=_0x1c8156,_0x3664fc=_0x3f6775[_0x3d58a5(0xd9)]?_0x2b39cb[_0x3d58a5(0xa6)](_0x3f6775['segmentFolderId']['toString']())||'':'',_0xae09f=_0x3664fc+':'+_0x3f6775[_0x3d58a5(0x9f)];if(_0xcb2a2['has'](_0xae09f))return![];if(_0x5dcff4)return _0x3664fc===_0x404a9e||_0x3664fc[_0x3d58a5(0x93)](_0x404a9e+'/');return!![];});}const _0x1b3466=_0x2db2b5[_0x1c8156(0x82)](_0x112986=>_0x112986[_0x1c8156(0xe0)]),_0x53ab62=_0x2db2b5[_0x1c8156(0x82)](_0x2eb294=>!_0x2eb294[_0x1c8156(0xe0)]&&_0x2eb294[_0x1c8156(0x8c)]),_0x161829=_0x2db2b5[_0x1c8156(0x82)](_0x47583d=>!_0x47583d['isNew']&&!_0x47583d[_0x1c8156(0x8c)]),_0x1122b8=Array[_0x1c8156(0x7a)](_0x2ee17b)[_0x1c8156(0xdc)](),_0x3948c6=_0x5b4148[_0x1c8156(0xfb)]?_0x3b2e87:[],_0x543ca2=_0x2db2b5[_0x1c8156(0xba)](_0x49146f=>_0x49146f[_0x1c8156(0x97)]),_0x32405d=_0x543ca2[_0x1c8156(0x82)](_0x32968a=>_0x32968a[_0x1c8156(0xec)]===_0x1c8156(0xb6)),_0xc79009=_0x543ca2[_0x1c8156(0x82)](_0x5b1238=>_0x5b1238['type']===_0x1c8156(0x95)),_0x36d646=_0x543ca2[_0x1c8156(0x82)](_0x39ea8f=>_0x39ea8f['type']==='delete');console['error'](_0x1c8156(0x79)+_0xf21207+'\x27:');_0x1122b8['length']>0x0&&console['error']('\x20\x20'+a35_0x526ed4[_0x1c8156(0xe1)](_0x1c8156(0xa5)+_0x1122b8[_0x1c8156(0xd3)]+_0x1c8156(0xdd)));console['error']('\x20\x20'+a35_0x526ed4[_0x1c8156(0xbf)]('+\x20'+_0x1b3466['length']+_0x1c8156(0x74))),console[_0x1c8156(0xb7)]('\x20\x20'+a35_0x526ed4[_0x1c8156(0xc3)]('~\x20'+_0x53ab62['length']+_0x1c8156(0x89)));if(_0x3948c6[_0x1c8156(0xd3)]>0x0)console[_0x1c8156(0xb7)]('\x20\x20'+a35_0x526ed4[_0x1c8156(0xc4)]('-\x20'+_0x3948c6[_0x1c8156(0xd3)]+'\x20segments\x20to\x20delete'));else _0x3b2e87[_0x1c8156(0xd3)]>0x0&&!_0x5b4148['delete']&&console[_0x1c8156(0xb7)]('\x20\x20'+a35_0x526ed4['dim']('\x20\x20'+_0x3b2e87[_0x1c8156(0xd3)]+_0x1c8156(0x81)));console[_0x1c8156(0xb7)]('\x20\x20'+a35_0x526ed4[_0x1c8156(0x7c)]('=\x20'+_0x161829[_0x1c8156(0xd3)]+_0x1c8156(0xf0)));_0x543ca2[_0x1c8156(0xd3)]>0x0&&(console['error'](''),console[_0x1c8156(0xb7)](_0x1c8156(0x70)),_0x32405d[_0x1c8156(0xd3)]>0x0&&console[_0x1c8156(0xb7)]('\x20\x20\x20\x20'+a35_0x526ed4[_0x1c8156(0xbf)]('+\x20'+_0x32405d['length']+'\x20to\x20create')),_0xc79009[_0x1c8156(0xd3)]>0x0&&console[_0x1c8156(0xb7)]('\x20\x20\x20\x20'+a35_0x526ed4['yellow']('~\x20'+_0xc79009[_0x1c8156(0xd3)]+_0x1c8156(0xa7))),_0x36d646[_0x1c8156(0xd3)]>0x0&&console['error'](_0x1c8156(0xd6)+a35_0x526ed4[_0x1c8156(0xc4)]('-\x20'+_0x36d646['length']+_0x1c8156(0xef))));console[_0x1c8156(0xb7)](_0x1c8156(0xc7)+a35_0x526ed4[_0x1c8156(0x8b)](_0x4bb15f)+'\x0a');if(_0x1122b8[_0x1c8156(0xd3)]>0x0){console[_0x1c8156(0xb7)](_0x1c8156(0xb1));for(const _0x278d9c of _0x1122b8){console[_0x1c8156(0xb7)]('\x20\x20'+a35_0x526ed4[_0x1c8156(0xe1)]('+')+'\x20'+_0x278d9c);}console[_0x1c8156(0xb7)]('');}if(_0x1b3466[_0x1c8156(0xd3)]>0x0)for(const _0x261eb0 of _0x1b3466){const _0x392b1c=_0x261eb0['folderPath']?_0x261eb0[_0x1c8156(0xcd)]+'/'+_0x261eb0['yamlConfig']['name']:_0x261eb0[_0x1c8156(0x9c)][_0x1c8156(0x9f)],_0x438c61=_0x261eb0[_0x1c8156(0x9c)][_0x1c8156(0xb3)]?.[_0x1c8156(0xd3)]||0x0,_0x38b289=_0x438c61>0x0?a35_0x526ed4[_0x1c8156(0x7c)]('\x20['+_0x438c61+_0x1c8156(0x75)):'';console[_0x1c8156(0xb7)]('\x0a'+a35_0x526ed4[_0x1c8156(0xbf)](_0x1c8156(0x76))+'\x20'+_0x392b1c+_0x38b289),console[_0x1c8156(0xb7)]('─'[_0x1c8156(0xa0)](0x3c)),_0x261eb0[_0x1c8156(0xf2)]&&console[_0x1c8156(0xb7)](_0x261eb0[_0x1c8156(0xf2)]),console[_0x1c8156(0xb7)]('─'['repeat'](0x3c));}if(_0x3948c6[_0x1c8156(0xd3)]>0x0)for(const _0x3238d2 of _0x3948c6){const _0x727eea=_0x3238d2[_0x1c8156(0xd9)]?_0x2b39cb[_0x1c8156(0xa6)](_0x3238d2[_0x1c8156(0xd9)][_0x1c8156(0xf1)]())||'':'',_0x404507=_0x727eea?_0x727eea+'/'+_0x3238d2[_0x1c8156(0x9f)]:_0x3238d2['name'],_0x2c0b6e=_0x38a02d[_0x1c8156(0xa6)](_0x3238d2['id'])||[],_0x150cee=_0x2c0b6e[_0x1c8156(0xd3)]>0x0?a35_0x526ed4[_0x1c8156(0x7c)]('\x20['+_0x2c0b6e[_0x1c8156(0xd3)]+_0x1c8156(0x75)):'';console[_0x1c8156(0xb7)]('\x0a'+a35_0x526ed4[_0x1c8156(0xc4)](_0x1c8156(0x9d))+'\x20'+_0x404507+_0x150cee),console[_0x1c8156(0xb7)]('─'[_0x1c8156(0xa0)](0x3c));const _0x103aae=segmentWithActivationsToYaml(_0x3238d2,_0x2c0b6e,undefined,_0xb80adc,_0x31f7c2),_0x1dd87e=segmentToYamlString(_0x103aae),_0x379ac4=generateDiff(_0x1dd87e,'');console[_0x1c8156(0xb7)](formatDiffWithColors(_0x379ac4)),console['error']('─'['repeat'](0x3c));}const _0xc36a91=_0x2db2b5[_0x1c8156(0x82)](_0x3f72d7=>!_0x3f72d7[_0x1c8156(0xe0)]&&_0x3f72d7[_0x1c8156(0xf2)]);if(_0xc36a91[_0x1c8156(0xd3)]>0x0)for(const _0x2289ad of _0xc36a91){const _0x4a7ff9=_0x2289ad[_0x1c8156(0xcd)]?_0x2289ad['folderPath']+'/'+_0x2289ad['yamlConfig'][_0x1c8156(0x9f)]:_0x2289ad[_0x1c8156(0x9c)][_0x1c8156(0x9f)];console['error']('\x0a'+a35_0x526ed4[_0x1c8156(0xc3)](_0x1c8156(0xe3))+'\x20'+_0x4a7ff9),console[_0x1c8156(0xb7)]('─'[_0x1c8156(0xa0)](0x3c)),console[_0x1c8156(0xb7)](_0x2289ad[_0x1c8156(0xf2)]),console[_0x1c8156(0xb7)]('─'['repeat'](0x3c));}if(_0x5b4148['dryRun'])return console['error'](a35_0x526ed4['yellow'](_0x1c8156(0x8d))),0x0;const _0x26853b=_0x1b3466[_0x1c8156(0xd3)]>0x0||_0x53ab62[_0x1c8156(0xd3)]>0x0||_0x3948c6[_0x1c8156(0xd3)]>0x0,_0x4f632f=_0x543ca2[_0x1c8156(0xd3)]>0x0,_0x141513=_0x1122b8['length']>0x0;if(!_0x26853b&&!_0x4f632f&&!_0x141513)return console[_0x1c8156(0xb7)](a35_0x526ed4['green']('✔\x20All\x20segments\x20and\x20activations\x20are\x20up\x20to\x20date')),0x0;const _0x5ab61d=_0x1b3466[_0x1c8156(0xd3)]+_0x53ab62[_0x1c8156(0xd3)]+_0x3948c6['length']+_0x1122b8[_0x1c8156(0xd3)]+_0x543ca2[_0x1c8156(0xd3)];if(!_0x5b4148[_0x1c8156(0xf6)]&&_0x5ab61d>0x0){const _0x2d07ce=await confirmKey('Push\x20'+_0x5ab61d+_0x1c8156(0xcc));if(!_0x2d07ce)return console[_0x1c8156(0xb7)](_0x1c8156(0x99)),0x1;}for(const _0x3c440e of _0x1122b8){const _0x3a0fe4=_0x3c440e['split']('/'),_0x2c2988=_0x3a0fe4[_0x3a0fe4[_0x1c8156(0xd3)]-0x1],_0x38c6ea=_0x3a0fe4[_0x1c8156(0xd7)](0x0,-0x1)[_0x1c8156(0xe6)]('/'),_0x4580ea=_0x6f5a5f[_0x1c8156(0xa6)](_0x38c6ea),_0x1fe18f={'name':_0x2c2988,'parentFolderId':_0x4580ea},_0x4a3dde=await withSpinner(_0x1c8156(0xf8)+_0x3c440e+'\x27...',()=>_0x2b54e0['segment'][_0x1c8156(0xab)](_0x4122f8,_0x1fe18f),{'verbose':_0x5b4148['verbose']});_0x6f5a5f[_0x1c8156(0xe2)](_0x3c440e,_0x4a3dde[_0x1c8156(0xf5)]['id']),console[_0x1c8156(0xb7)](a35_0x526ed4[_0x1c8156(0xe1)](_0x1c8156(0xc5)+_0x3c440e+'\x27'));}let _0x1a64f2=0x0,_0x536b6c=0x0,_0x3ab7d5=0x0,_0x72ec77=0x0,_0x3c7aab=0x0,_0x38c1ad=0x0;const _0x5c3954=new Map();for(const _0x1c4d0d of _0x2db2b5){const _0x40ce2f=_0x1c4d0d[_0x1c8156(0xcd)]?_0x6f5a5f['get'](_0x1c4d0d[_0x1c8156(0xcd)]):undefined;let _0x3e75ec;try{if(_0x1c4d0d[_0x1c8156(0xe0)]){const _0x54b83b=yamlToCreateRequest(_0x1c4d0d[_0x1c8156(0x9c)],_0x40ce2f),_0x4a1f7b=await withSpinner('Creating\x20segment\x20\x27'+_0x1c4d0d['yamlConfig'][_0x1c8156(0x9f)]+'\x27...',()=>_0x2b54e0[_0x1c8156(0x87)]['createSegment'](_0x4122f8,_0x54b83b),{'verbose':_0x5b4148[_0x1c8156(0x92)]});_0x3e75ec=_0x4a1f7b[_0x1c8156(0xf5)]['id'],_0x5c3954['set'](_0x1c4d0d[_0x1c8156(0x9c)][_0x1c8156(0x9f)],_0x3e75ec),console[_0x1c8156(0xb7)](a35_0x526ed4[_0x1c8156(0xbf)](_0x1c8156(0xf9)+_0x1c4d0d[_0x1c8156(0x9c)]['name']+'\x27')),_0x1a64f2++;}else{if(_0x1c4d0d['hasChanges']){const _0x3fb3dd=yamlToUpdateRequest(_0x1c4d0d[_0x1c8156(0x9c)]);_0x40ce2f!==_0x1c4d0d[_0x1c8156(0xa4)]?.[_0x1c8156(0xd9)]&&(_0x3fb3dd[_0x1c8156(0xd9)]=_0x40ce2f?parseInt(_0x40ce2f,0xa):undefined),await withSpinner(_0x1c8156(0x9a)+_0x1c4d0d['yamlConfig']['name']+_0x1c8156(0xd8),()=>_0x2b54e0[_0x1c8156(0x87)][_0x1c8156(0x83)](_0x4122f8,_0x1c4d0d['existingSegment']['id'],_0x3fb3dd),{'verbose':_0x5b4148['verbose']}),_0x3e75ec=_0x1c4d0d[_0x1c8156(0xa4)]['id'],console[_0x1c8156(0xb7)](a35_0x526ed4['yellow']('✔\x20Updated\x20segment\x20\x27'+_0x1c4d0d[_0x1c8156(0x9c)][_0x1c8156(0x9f)]+'\x27')),_0x536b6c++;}else _0x3e75ec=_0x1c4d0d[_0x1c8156(0xa4)]['id'];}}catch(_0x1bf8cf){const _0x35a673=isHttp400Error(_0x1bf8cf),_0x4c5362=_0x35a673?ErrorCode[_0x1c8156(0xde)]:ErrorCode[_0x1c8156(0xd1)],_0x5d13ce=getErrorMessage(_0x1bf8cf);throw new SDKError(_0x4c5362,'Failed\x20to\x20'+(_0x1c4d0d['isNew']?_0x1c8156(0xb6):_0x1c8156(0x95))+_0x1c8156(0xae)+_0x1c4d0d[_0x1c8156(0x9e)]+'\x0a\x20\x20'+_0x5d13ce,_0x1bf8cf);}for(const _0x382052 of _0x1c4d0d[_0x1c8156(0x97)]){try{if(_0x382052[_0x1c8156(0xec)]===_0x1c8156(0xb6)&&_0x382052[_0x1c8156(0x77)]){const _0x4c30dc=yamlActivationToCreateRequest(_0x382052[_0x1c8156(0x77)],_0x4d5d27,_0x316853);await withSpinner('Creating\x20activation\x20\x27'+_0x382052[_0x1c8156(0x9f)]+_0x1c8156(0xd8),()=>_0x2b54e0[_0x1c8156(0x87)][_0x1c8156(0x94)](_0x4122f8,_0x3e75ec,_0x4c30dc),{'verbose':_0x5b4148[_0x1c8156(0x92)]}),console['error'](a35_0x526ed4['green'](_0x1c8156(0xac)+_0x382052[_0x1c8156(0x9f)]+'\x27')),_0x72ec77++;}else{if(_0x382052[_0x1c8156(0xec)]===_0x1c8156(0x95)&&_0x382052[_0x1c8156(0x77)]&&_0x382052[_0x1c8156(0xeb)]){const _0x5047ee=yamlActivationToUpdateRequest(_0x382052['yamlActivation'],_0x4d5d27,_0x316853);await withSpinner(_0x1c8156(0xe9)+_0x382052['name']+'\x27...',()=>_0x2b54e0['segment'][_0x1c8156(0xd2)](_0x4122f8,_0x3e75ec,_0x382052[_0x1c8156(0xeb)]['id'],_0x5047ee),{'verbose':_0x5b4148['verbose']}),console[_0x1c8156(0xb7)](a35_0x526ed4[_0x1c8156(0xc3)](_0x1c8156(0xe5)+_0x382052[_0x1c8156(0x9f)]+'\x27')),_0x3c7aab++;}else _0x382052[_0x1c8156(0xec)]===_0x1c8156(0xfb)&&_0x382052['existingActivation']&&(await withSpinner(_0x1c8156(0x72)+_0x382052['name']+_0x1c8156(0xd8),()=>_0x2b54e0[_0x1c8156(0x87)][_0x1c8156(0xcb)](_0x4122f8,_0x3e75ec,_0x382052[_0x1c8156(0xeb)]['id']),{'verbose':_0x5b4148[_0x1c8156(0x92)]}),console['error'](a35_0x526ed4[_0x1c8156(0xc4)](_0x1c8156(0xc2)+_0x382052[_0x1c8156(0x9f)]+'\x27')),_0x38c1ad++);}}catch(_0x2eb847){const _0x153b42=isHttp400Error(_0x2eb847),_0x1fff67=_0x153b42?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode[_0x1c8156(0x98)],_0x4a6ca1=getErrorMessage(_0x2eb847);throw new SDKError(_0x1fff67,_0x1c8156(0xe7)+_0x382052[_0x1c8156(0xec)]+'\x20activation\x20\x27'+_0x382052[_0x1c8156(0x9f)]+_0x1c8156(0x71)+_0x1c4d0d[_0x1c8156(0x9e)]+'\x0a\x20\x20'+_0x4a6ca1,_0x2eb847);}}}for(const _0x18a6e3 of _0x3948c6){await withSpinner(_0x1c8156(0x8e)+_0x18a6e3[_0x1c8156(0x9f)]+'\x27...',()=>_0x2b54e0[_0x1c8156(0x87)][_0x1c8156(0xf4)](_0x18a6e3['id']),{'verbose':_0x5b4148['verbose']}),console[_0x1c8156(0xb7)](a35_0x526ed4['red']('✔\x20Deleted\x20segment\x20\x27'+_0x18a6e3['name']+'\x27')),_0x3ab7d5++;}const _0x6cbb6a=[];if(_0x1a64f2>0x0)_0x6cbb6a[_0x1c8156(0xaf)](_0x1a64f2+'\x20created');if(_0x536b6c>0x0)_0x6cbb6a[_0x1c8156(0xaf)](_0x536b6c+_0x1c8156(0x8a));if(_0x3ab7d5>0x0)_0x6cbb6a['push'](_0x3ab7d5+'\x20deleted');const _0x43b2c6=[];if(_0x72ec77>0x0)_0x43b2c6[_0x1c8156(0xaf)](_0x72ec77+_0x1c8156(0xb2));if(_0x3c7aab>0x0)_0x43b2c6['push'](_0x3c7aab+_0x1c8156(0x8a));if(_0x38c1ad>0x0)_0x43b2c6['push'](_0x38c1ad+_0x1c8156(0x8f));return console[_0x1c8156(0xb7)](a35_0x526ed4[_0x1c8156(0xbf)]('\x0a✔\x20Push\x20complete')),_0x6cbb6a[_0x1c8156(0xd3)]>0x0&&console['error'](_0x1c8156(0xb5)+_0x6cbb6a[_0x1c8156(0xe6)](',\x20')),_0x43b2c6[_0x1c8156(0xd3)]>0x0&&console[_0x1c8156(0xb7)]('\x20\x20Activations:\x20'+_0x43b2c6[_0x1c8156(0xe6)](',\x20')),0x0;}}function buildFolderPathToIdMap(_0x4424d8){const _0x57536c=a35_0x573744,_0x53ac86=new Map(),_0xa315cc=new Map();for(const _0x4e6190 of _0x4424d8){_0xa315cc[_0x57536c(0xe2)](_0x4e6190['id'],_0x4e6190);}const _0x43c9ea=new Set();for(const _0x5083bf of _0x4424d8){!_0x5083bf['parentFolderId']&&_0x43c9ea[_0x57536c(0xbb)](_0x5083bf['id']);}function _0x204c49(_0x9c5a67){const _0x4bc4c6=_0x57536c;if(_0x43c9ea[_0x4bc4c6(0xa3)](_0x9c5a67['id']))return'';if(_0x9c5a67['parentFolderId']){const _0xf23eca=_0xa315cc['get'](_0x9c5a67[_0x4bc4c6(0x6f)]);if(_0xf23eca){const _0x3e3b04=_0x204c49(_0xf23eca);return _0x3e3b04?_0x3e3b04+'/'+_0x9c5a67['name']:_0x9c5a67[_0x4bc4c6(0x9f)];}}return _0x9c5a67[_0x4bc4c6(0x9f)];}for(const _0x1fad6a of _0x4424d8){const _0x5405ef=_0x204c49(_0x1fad6a);_0x53ac86[_0x57536c(0xe2)](_0x5405ef,_0x1fad6a['id']);}return _0x53ac86;}function findYamlFiles(_0x5038ab){const _0x26f2bf=[];function _0x1ad606(_0x2123c1){const _0x117043=a35_0x99f9,_0x3c2434=readdirSync(_0x2123c1,{'withFileTypes':!![]});for(const _0x59a0c8 of _0x3c2434){const _0x3a53da=a35_0x186522[_0x117043(0xe6)](_0x2123c1,_0x59a0c8[_0x117043(0x9f)]);if(_0x59a0c8[_0x117043(0xdb)]())_0x1ad606(_0x3a53da);else(_0x59a0c8[_0x117043(0x9f)][_0x117043(0xc1)]('.yml')||_0x59a0c8[_0x117043(0x9f)][_0x117043(0xc1)](_0x117043(0xbc)))&&_0x26f2bf[_0x117043(0xaf)](_0x3a53da);}}return _0x1ad606(_0x5038ab),_0x26f2bf;}function a35_0x99f9(_0x4d8b2a,_0x4391ef){_0x4d8b2a=_0x4d8b2a-0x6e;const _0x3645b7=a35_0x3645();let _0x99f981=_0x3645b7[_0x4d8b2a];return _0x99f981;}function calculateActivationActions(_0x3190ea,_0x3ee484,_0x1a99bd,_0x2746eb){const _0x277956=a35_0x573744,_0x8b813b=[],_0x5dbb3f=new Map();for(const _0x195d4e of _0x3ee484){_0x5dbb3f[_0x277956(0xe2)](_0x195d4e['name'],_0x195d4e);}const _0x5d4842=new Map();for(const _0x1d54c7 of _0x3190ea){_0x5d4842[_0x277956(0xe2)](_0x1d54c7[_0x277956(0x9f)],_0x1d54c7);}for(const _0x2350fd of _0x3190ea){const _0x59bc13=_0x5dbb3f['get'](_0x2350fd[_0x277956(0x9f)]);if(!_0x59bc13)_0x8b813b[_0x277956(0xaf)]({'type':_0x277956(0xb6),'name':_0x2350fd[_0x277956(0x9f)],'yamlActivation':_0x2350fd});else{const _0x38e028=activationToYaml(_0x59bc13,_0x1a99bd,_0x2746eb),_0x928a96=a35_0x4dfc51[_0x277956(0x85)](_0x38e028),_0x47702b=a35_0x4dfc51['stringify'](_0x2350fd);_0x928a96!==_0x47702b&&_0x8b813b[_0x277956(0xaf)]({'type':_0x277956(0x95),'name':_0x2350fd[_0x277956(0x9f)],'yamlActivation':_0x2350fd,'existingActivation':_0x59bc13});}}for(const _0x34905a of _0x3ee484){!_0x5d4842[_0x277956(0xa3)](_0x34905a['name'])&&_0x8b813b[_0x277956(0xaf)]({'type':'delete','name':_0x34905a[_0x277956(0x9f)],'existingActivation':_0x34905a});}return _0x8b813b;}
1
+ const a35_0x5802ad=a35_0x4bc8;(function(_0x28c092,_0x2d0e5c){const _0x297bc4=a35_0x4bc8,_0x121675=_0x28c092();while(!![]){try{const _0x494c49=parseInt(_0x297bc4(0x178))/0x1*(parseInt(_0x297bc4(0x140))/0x2)+-parseInt(_0x297bc4(0x102))/0x3+parseInt(_0x297bc4(0x18d))/0x4*(-parseInt(_0x297bc4(0x15b))/0x5)+parseInt(_0x297bc4(0x168))/0x6*(-parseInt(_0x297bc4(0x15e))/0x7)+parseInt(_0x297bc4(0x134))/0x8+-parseInt(_0x297bc4(0x144))/0x9+parseInt(_0x297bc4(0x155))/0xa;if(_0x494c49===_0x2d0e5c)break;else _0x121675['push'](_0x121675['shift']());}catch(_0x364537){_0x121675['push'](_0x121675['shift']());}}}(a35_0x3a41,0xbadb8));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode,isHttp400Error,getErrorMessage}from'../sdk/errors.js';function a35_0x3a41(){const _0x2f5c25=['yamlActivation','error','name','SEGMENT_SYNTAX_ERROR','get','join','\x0a\x20\x20','Creating\x20segment\x20\x27','activations','\x20unchanged\x20segments','SEGMENT_UPDATE_ERROR','3722517HgJknT','verbose','then','\x20\x20Activations:','startsWith','diff','deleteActivation','Push\x20','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','yamlConfig','\x20segments\x20to\x20delete','\x20to\x20create','type','message','entries','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20files','Updating\x20activation\x20\x27','sort','configDir','from','Fetching\x20existing\x20folders...','ACTIVATION_UPDATE_ERROR','endsWith','\x20\x20Source:\x20','Failed\x20to\x20','isNew','segment:push','yes','ACTIVATION_SYNTAX_ERROR','segmentFolderId','\x20activation\x20\x27','cwd','set','📁\x20','\x27...','\x20\x20Segments:\x20','✔\x20Created\x20segment\x20\x27','Aborted.','isFile','\x20changes?','parentSegment','\x20to\x20delete','segment','\x20updated','stringify','has','Fetching\x20connections\x20for\x20name\x20resolution...','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','length','8070416rkQIxw','hasChanges','✔\x20Deleted\x20segment\x20\x27','Error\x20parsing\x20','dim','createActivation','repeat','\x20activations]','\x0a✔\x20Push\x20complete','existingActivation','\x0aPush\x20summary\x20for\x20\x27','Scoped\x20to\x20folder:\x20','1269126ADihnh','site','description','listFolders','791901pLbjCM','parentFolderId','utf-8','config','Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)','New\x20segment:','parent_segment','delete','Resolving\x20parent\x20segment\x20\x27','cyan','relative','user','green','create','updateActivation','add','createFolder','16272140ryySFs','deleteSegment','activationActions','absolutePath','toString','filter','104515IWELxd','buildNameToIdMap','.yaml','21LZxhJe','split','update','\x20\x20✔\x20Deleted\x20activation\x20\x27','all','\x20segments\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','Updating\x20segment\x20\x27','.yml','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','✔\x20Updated\x20segment\x20\x27','555108zgaLia','existingSegment','\x20to\x20update','buildIdToNameMap','Fetching\x20existing\x20segments...','Delete\x20segment:','Fetching\x20users\x20for\x20email\x20resolution...','\x20segment\x20from\x20file:\x20','\x20\x20\x20\x20','\x20\x20✔\x20Updated\x20activation\x20\x27','slice','blue','createSegment','Error:\x20Directory\x20not\x20found:\x20','resolve','\x27\x20from\x20file:\x20','1nuZXEp','push','Changes\x20to:','No\x20segment\x20YAML\x20files\x20found','buildUserMaps','data','dirname','isDirectory','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','\x20changed\x20segments','✔\x20All\x20segments\x20and\x20activations\x20are\x20up\x20to\x20date','Site:\x20','dryRun','Fetching\x20existing\x20activations...','folderPath','\x20\x20✔\x20Created\x20activation\x20\x27','yellow','connection','red','Creating\x20activation\x20\x27','✔\x20Created\x20folder\x20\x27','172WfkeZj','\x20created','\x20deleted','Source\x20directory:\x20'];a35_0x3a41=function(){return _0x2f5c25;};return a35_0x3a41();}import{withSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';function a35_0x4bc8(_0x2ac5d8,_0x331a29){_0x2ac5d8=_0x2ac5d8-0xfb;const _0x3a416c=a35_0x3a41();let _0x4bc8f2=_0x3a416c[_0x2ac5d8];return _0x4bc8f2;}import{batchAsync}from'../utils/async.js';import{getSegmentRootDir,findTdxConfig}from'../utils/tdx-config.js';import{segmentToYamlString,segmentWithActivationsToYaml,parseSegmentYamlFile,normalizeChildSegmentYaml,yamlToCreateRequest,yamlToUpdateRequest,yamlActivationToCreateRequest,yamlActivationToUpdateRequest,activationToYaml}from'../sdk/segment/child-segment-yaml.js';import a35_0x364cda from'chalk';import{existsSync,readFileSync,statSync,readdirSync}from'fs';import a35_0x33e977 from'path';import*as a35_0x2c555e from'yaml';import{sanitizeFileName}from'../utils/string-utils.js';function tryFindTdxConfig(_0x17cf0e){try{return findTdxConfig(_0x17cf0e);}catch{return null;}}function resolveTDFolderPath(_0x1a7f32,_0x5a15f8,_0x811c31){if(!_0x5a15f8)return _0x1a7f32;return _0x1a7f32?_0x811c31+'/'+_0x1a7f32:_0x811c31;}export class SegmentPushCommand extends BaseCommand{[a35_0x5802ad(0x193)]=a35_0x5802ad(0x11c);[a35_0x5802ad(0x142)]='Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments';async['execute'](_0x2e2118){const _0x3f8c73=a35_0x5802ad,{options:_0x34ee06,args:_0x37e215,tdx:_0x27b90e}=_0x2e2118,_0x28d973=_0x34ee06,_0xd2cc0a=_0x34ee06[_0x3f8c73(0x12a)],_0x3167dc=_0x37e215[0x0];let _0x3abbb9,_0x5e9efc,_0x4614e2,_0x3c4920;if(_0x3167dc){if(existsSync(_0x3167dc)&&statSync(_0x3167dc)[_0x3f8c73(0x17f)]()){const _0x2ab6c3=tryFindTdxConfig(_0x3167dc);if(_0x2ab6c3)_0x3abbb9=_0x2ab6c3[_0x3f8c73(0x147)]['parent_segment'],_0x5e9efc=_0x3167dc,_0x4614e2=_0x2ab6c3['configDir'];else return console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x18a)](_0x3f8c73(0x166)+_0x3167dc+'\x0a')),console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x14d)](_0x3f8c73(0x180))),0x1;}else{if(existsSync(_0x3167dc)&&statSync(_0x3167dc)[_0x3f8c73(0x128)]()){const _0x2ed348=a35_0x33e977['dirname'](_0x3167dc),_0x2f3096=tryFindTdxConfig(_0x2ed348);if(_0x2f3096)_0x3abbb9=_0x2f3096[_0x3f8c73(0x147)][_0x3f8c73(0x14a)],_0x4614e2=_0x2f3096['configDir'],_0x5e9efc=_0x2f3096['configDir'],_0x3c4920=a35_0x33e977[_0x3f8c73(0x176)](_0x3167dc);else return console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x18a)]('Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20'+_0x2ed348+'\x0a')),console['error'](a35_0x364cda[_0x3f8c73(0x14d)](_0x3f8c73(0x180))),0x1;}else _0x3abbb9=_0x3167dc;}}else{const _0x2f0e41=tryFindTdxConfig(process[_0x3f8c73(0x121)]());_0x2f0e41?(_0x3abbb9=_0x2f0e41[_0x3f8c73(0x147)][_0x3f8c73(0x14a)],_0x5e9efc=process[_0x3f8c73(0x121)](),_0x4614e2=_0x2f0e41[_0x3f8c73(0x114)]):_0x3abbb9=_0xd2cc0a;}if(!_0x3abbb9)return console['error'](a35_0x364cda['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console['error'](_0x3f8c73(0x148)),console[_0x3f8c73(0x192)](_0x3f8c73(0x132)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file'),0x1;const _0xbf0c2=_0x5e9efc||getSegmentRootDir(sanitizeFileName(_0x3abbb9)),_0x231753=_0x4614e2||_0xbf0c2,_0x41d1df=a35_0x33e977[_0x3f8c73(0x14e)](_0x231753,_0xbf0c2),_0x49504e=_0x41d1df!==''&&_0x41d1df!=='.';if(!existsSync(_0xbf0c2))return console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x18a)](_0x3f8c73(0x175)+_0xbf0c2+'\x0a')),console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x14d)](_0x3f8c73(0x180))),0x1;_0x28d973['verbose']&&(console['error'](_0x3f8c73(0x183)+_0x28d973[_0x3f8c73(0x141)]),console[_0x3f8c73(0x192)]('Parent\x20segment:\x20'+_0x3abbb9),console[_0x3f8c73(0x192)](_0x3f8c73(0x190)+_0xbf0c2),_0x49504e&&console['error'](_0x3f8c73(0x13f)+_0x41d1df));const _0x5c7607=await withSpinner(_0x3f8c73(0x14c)+_0x3abbb9+_0x3f8c73(0x124),()=>_0x27b90e[_0x3f8c73(0x12c)]['resolveParentId'](_0x3abbb9),{'verbose':_0x28d973['verbose']}),_0x3c6ae5=_0x5c7607['data'],[_0x35dd44,_0x6b2320,_0x2b8239]=await Promise[_0x3f8c73(0x162)]([withSpinner(_0x3f8c73(0x16c),()=>_0x27b90e['segment']['listSegments'](_0x3c6ae5),{'verbose':_0x28d973[_0x3f8c73(0x103)]}),withSpinner(_0x3f8c73(0x116),()=>_0x27b90e[_0x3f8c73(0x12c)][_0x3f8c73(0x143)](_0x3c6ae5),{'verbose':_0x28d973[_0x3f8c73(0x103)]}),withSpinner(_0x3f8c73(0x16e),()=>_0x27b90e[_0x3f8c73(0x14f)][_0x3f8c73(0x17c)](),{'verbose':_0x28d973[_0x3f8c73(0x103)]})[_0x3f8c73(0x104)](_0x33760a=>_0x33760a['data'])]),_0x7b35f=_0x35dd44[_0x3f8c73(0x17d)],_0x290d80=_0x6b2320[_0x3f8c73(0x17d)],{emailToId:_0x534057,idToEmail:_0xa6a6f7}=_0x2b8239,[_0x4aba62,_0x2de820]=await withSpinner(_0x3f8c73(0x130),async()=>{const _0x129d14=_0x3f8c73,[_0xd2e758,_0xeec1a1]=await Promise[_0x129d14(0x162)]([_0x27b90e[_0x129d14(0x189)][_0x129d14(0x15c)](),_0x27b90e[_0x129d14(0x189)][_0x129d14(0x16b)]()]);return[_0xd2e758,_0xeec1a1];},{'verbose':_0x28d973['verbose']})[_0x3f8c73(0x104)](_0x4115ae=>_0x4115ae[_0x3f8c73(0x17d)]),_0x67cfcc=buildFolderPathToIdMap(_0x290d80),_0x5c8af6=new Map();for(const [_0x801972,_0x5fecf8]of _0x67cfcc[_0x3f8c73(0x110)]()){_0x5c8af6[_0x3f8c73(0x122)](_0x5fecf8,_0x801972);}const _0x46e521=new Map();for(const _0x192821 of _0x7b35f){const _0x1086ac=_0x192821[_0x3f8c73(0x11f)]?_0x5c8af6['get'](_0x192821[_0x3f8c73(0x11f)][_0x3f8c73(0x159)]())||'':'',_0x11ad25=_0x1086ac+':'+_0x192821[_0x3f8c73(0x193)];_0x46e521['set'](_0x11ad25,_0x192821);}let _0x511b7c;if(_0x3c4920){if(!_0x3c4920['endsWith'](_0x3f8c73(0x165))&&!_0x3c4920[_0x3f8c73(0x118)](_0x3f8c73(0x15d)))return console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x18a)](_0x3f8c73(0x10a)+_0x3c4920+'\x0a')),0x1;_0x511b7c=[_0x3c4920];}else _0x511b7c=findYamlFiles(_0xbf0c2);if(_0x511b7c['length']===0x0)return console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x18a)]('Error:\x20No\x20segment\x20YAML\x20files\x20found\x20in\x20'+_0xbf0c2+'\x0a')),console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x14d)](_0x3f8c73(0x111))),0x1;const _0x4289eb=[];for(const _0xae8455 of _0x511b7c){const _0x4f58e0=a35_0x33e977[_0x3f8c73(0x14e)](_0xbf0c2,a35_0x33e977[_0x3f8c73(0x17e)](_0xae8455)),_0xf6c128=_0x4f58e0==='.'?'':_0x4f58e0,_0x35c340=readFileSync(_0xae8455,_0x3f8c73(0x146));try{const _0x413f22=parseSegmentYamlFile(_0x35c340),_0x5d69da=normalizeChildSegmentYaml(_0x413f22);_0x4289eb['push']({'yamlConfig':_0x5d69da,'folderPath':_0xf6c128,'sourcePath':_0xae8455});}catch(_0x4235d9){return console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x18a)](_0x3f8c73(0x137)+_0xae8455+':\x20'+(_0x4235d9 instanceof Error?_0x4235d9[_0x3f8c73(0x10f)]:_0x4235d9))),0x1;}}if(_0x4289eb[_0x3f8c73(0x133)]===0x0)return console[_0x3f8c73(0x192)](a35_0x364cda['yellow'](_0x3f8c73(0x17b))),0x0;const _0x2f2229=new Map();_0x7b35f[_0x3f8c73(0x133)]>0x0&&await withSpinner(_0x3f8c73(0x185),async()=>{await batchAsync(_0x7b35f,async _0x3c458d=>{const _0x10510d=a35_0x4bc8,_0x20e1c7=await _0x27b90e[_0x10510d(0x12c)]['listActivations'](_0x3c6ae5,_0x3c458d['id']);_0x2f2229[_0x10510d(0x122)](_0x3c458d['id'],_0x20e1c7);});},{'verbose':_0x28d973[_0x3f8c73(0x103)]});const _0x393414=[],_0x2e1cef=new Set();for(const {yamlConfig:_0x507b8d,folderPath:_0x19424a,sourcePath:_0x94e2d6}of _0x4289eb){const _0x168701=resolveTDFolderPath(_0x19424a,_0x49504e,_0x41d1df),_0x81a6e1=_0x168701+':'+_0x507b8d[_0x3f8c73(0x193)],_0x321f49=_0x46e521[_0x3f8c73(0xfb)](_0x81a6e1),_0x56553e=_0x321f49?_0x2f2229[_0x3f8c73(0xfb)](_0x321f49['id'])||[]:[];if(_0x168701&&!_0x67cfcc['has'](_0x168701)){const _0x5630f6=_0x168701[_0x3f8c73(0x15f)]('/');let _0x1fae31='';for(const _0x3df0cd of _0x5630f6){_0x1fae31=_0x1fae31?_0x1fae31+'/'+_0x3df0cd:_0x3df0cd,!_0x67cfcc[_0x3f8c73(0x12f)](_0x1fae31)&&_0x2e1cef[_0x3f8c73(0x153)](_0x1fae31);}}const _0x53585f=calculateActivationActions(_0x507b8d[_0x3f8c73(0xff)]||[],_0x56553e,_0xa6a6f7,_0x2de820),_0x746f7d=segmentToYamlString(_0x507b8d);let _0x1d2994,_0x101bf5=![],_0x249ae3;if(_0x321f49){const _0x219ae6=segmentWithActivationsToYaml(_0x321f49,_0x56553e,undefined,_0xa6a6f7,_0x2de820),_0xcf78a5=segmentToYamlString(_0x219ae6);_0x1d2994=generateDiff(_0xcf78a5,_0x746f7d),_0x101bf5=hasChanges(_0x1d2994),_0x101bf5&&(_0x249ae3=formatDiffWithColors(_0x1d2994));}else _0x1d2994=generateDiff('',_0x746f7d),_0x249ae3=formatDiffWithColors(_0x1d2994);_0x393414[_0x3f8c73(0x179)]({'relativePath':_0x507b8d[_0x3f8c73(0x193)],'absolutePath':_0x94e2d6,'yamlConfig':_0x507b8d,'folderPath':_0x168701,'existingSegment':_0x321f49,'existingActivations':_0x56553e,'isNew':!_0x321f49,'hasChanges':_0x101bf5,'diff':_0x249ae3,'activationActions':_0x53585f});}let _0x1fbcd4=[];if(!_0x3c4920){const _0xedc1a2=new Set();for(const {yamlConfig:_0x304202,folderPath:_0x188610}of _0x4289eb){const _0x9b40a0=resolveTDFolderPath(_0x188610,_0x49504e,_0x41d1df);_0xedc1a2[_0x3f8c73(0x153)](_0x9b40a0+':'+_0x304202[_0x3f8c73(0x193)]);}_0x1fbcd4=_0x7b35f[_0x3f8c73(0x15a)](_0x3b1b92=>{const _0x1f9a7c=_0x3f8c73,_0x5e65f4=_0x3b1b92[_0x1f9a7c(0x11f)]?_0x5c8af6[_0x1f9a7c(0xfb)](_0x3b1b92[_0x1f9a7c(0x11f)]['toString']())||'':'',_0x282e32=_0x5e65f4+':'+_0x3b1b92[_0x1f9a7c(0x193)];if(_0xedc1a2[_0x1f9a7c(0x12f)](_0x282e32))return![];if(_0x49504e)return _0x5e65f4===_0x41d1df||_0x5e65f4[_0x1f9a7c(0x106)](_0x41d1df+'/');return!![];});}const _0xb56e60=_0x393414[_0x3f8c73(0x15a)](_0x5ad8e0=>_0x5ad8e0['isNew']),_0x447915=_0x393414['filter'](_0x192021=>!_0x192021[_0x3f8c73(0x11b)]&&_0x192021[_0x3f8c73(0x135)]),_0x1d6d9b=_0x393414['filter'](_0x54b575=>!_0x54b575[_0x3f8c73(0x11b)]&&!_0x54b575['hasChanges']),_0x511313=Array[_0x3f8c73(0x115)](_0x2e1cef)[_0x3f8c73(0x113)](),_0x515158=_0x28d973[_0x3f8c73(0x14b)]?_0x1fbcd4:[],_0x72789f=_0x393414['flatMap'](_0x57969f=>_0x57969f[_0x3f8c73(0x157)]),_0x57a9c7=_0x72789f[_0x3f8c73(0x15a)](_0x2cd050=>_0x2cd050[_0x3f8c73(0x10e)]===_0x3f8c73(0x151)),_0x45d37a=_0x72789f['filter'](_0xbc0fe=>_0xbc0fe[_0x3f8c73(0x10e)]===_0x3f8c73(0x160)),_0x50d70b=_0x72789f[_0x3f8c73(0x15a)](_0x1535d7=>_0x1535d7[_0x3f8c73(0x10e)]===_0x3f8c73(0x14b));console['error'](_0x3f8c73(0x13e)+_0x3abbb9+'\x27:');_0x511313['length']>0x0&&console[_0x3f8c73(0x192)]('\x20\x20'+a35_0x364cda[_0x3f8c73(0x173)](_0x3f8c73(0x123)+_0x511313[_0x3f8c73(0x133)]+'\x20folders\x20to\x20create'));console[_0x3f8c73(0x192)]('\x20\x20'+a35_0x364cda[_0x3f8c73(0x150)]('+\x20'+_0xb56e60[_0x3f8c73(0x133)]+'\x20new\x20segments')),console[_0x3f8c73(0x192)]('\x20\x20'+a35_0x364cda[_0x3f8c73(0x188)]('~\x20'+_0x447915[_0x3f8c73(0x133)]+_0x3f8c73(0x181)));if(_0x515158[_0x3f8c73(0x133)]>0x0)console[_0x3f8c73(0x192)]('\x20\x20'+a35_0x364cda[_0x3f8c73(0x18a)]('-\x20'+_0x515158[_0x3f8c73(0x133)]+_0x3f8c73(0x10c)));else _0x1fbcd4[_0x3f8c73(0x133)]>0x0&&!_0x28d973[_0x3f8c73(0x14b)]&&console[_0x3f8c73(0x192)]('\x20\x20'+a35_0x364cda[_0x3f8c73(0x138)]('\x20\x20'+_0x1fbcd4[_0x3f8c73(0x133)]+_0x3f8c73(0x163)));console[_0x3f8c73(0x192)]('\x20\x20'+a35_0x364cda[_0x3f8c73(0x138)]('=\x20'+_0x1d6d9b['length']+_0x3f8c73(0x100)));_0x72789f[_0x3f8c73(0x133)]>0x0&&(console[_0x3f8c73(0x192)](''),console[_0x3f8c73(0x192)](_0x3f8c73(0x105)),_0x57a9c7[_0x3f8c73(0x133)]>0x0&&console[_0x3f8c73(0x192)](_0x3f8c73(0x170)+a35_0x364cda['green']('+\x20'+_0x57a9c7['length']+_0x3f8c73(0x10d))),_0x45d37a['length']>0x0&&console[_0x3f8c73(0x192)](_0x3f8c73(0x170)+a35_0x364cda[_0x3f8c73(0x188)]('~\x20'+_0x45d37a['length']+_0x3f8c73(0x16a))),_0x50d70b[_0x3f8c73(0x133)]>0x0&&console[_0x3f8c73(0x192)]('\x20\x20\x20\x20'+a35_0x364cda[_0x3f8c73(0x18a)]('-\x20'+_0x50d70b[_0x3f8c73(0x133)]+_0x3f8c73(0x12b))));console[_0x3f8c73(0x192)](_0x3f8c73(0x119)+a35_0x364cda['cyan'](_0xbf0c2)+'\x0a');if(_0x511313[_0x3f8c73(0x133)]>0x0){console[_0x3f8c73(0x192)]('Folders\x20to\x20create:');for(const _0xa6fa31 of _0x511313){console['error']('\x20\x20'+a35_0x364cda['blue']('+')+'\x20'+_0xa6fa31);}console[_0x3f8c73(0x192)]('');}if(_0xb56e60[_0x3f8c73(0x133)]>0x0)for(const _0x43a88e of _0xb56e60){const _0x2b4387=_0x43a88e[_0x3f8c73(0x186)]?_0x43a88e[_0x3f8c73(0x186)]+'/'+_0x43a88e['yamlConfig'][_0x3f8c73(0x193)]:_0x43a88e[_0x3f8c73(0x10b)][_0x3f8c73(0x193)],_0x222d0d=_0x43a88e[_0x3f8c73(0x10b)][_0x3f8c73(0xff)]?.[_0x3f8c73(0x133)]||0x0,_0x59093b=_0x222d0d>0x0?a35_0x364cda[_0x3f8c73(0x138)]('\x20['+_0x222d0d+_0x3f8c73(0x13b)):'';console['error']('\x0a'+a35_0x364cda[_0x3f8c73(0x150)](_0x3f8c73(0x149))+'\x20'+_0x2b4387+_0x59093b),console[_0x3f8c73(0x192)]('─'[_0x3f8c73(0x13a)](0x3c)),_0x43a88e[_0x3f8c73(0x107)]&&console['error'](_0x43a88e[_0x3f8c73(0x107)]),console[_0x3f8c73(0x192)]('─'[_0x3f8c73(0x13a)](0x3c));}if(_0x515158['length']>0x0)for(const _0xe7c44e of _0x515158){const _0x5ed5d2=_0xe7c44e[_0x3f8c73(0x11f)]?_0x5c8af6[_0x3f8c73(0xfb)](_0xe7c44e[_0x3f8c73(0x11f)][_0x3f8c73(0x159)]())||'':'',_0x5542d2=_0x5ed5d2?_0x5ed5d2+'/'+_0xe7c44e[_0x3f8c73(0x193)]:_0xe7c44e[_0x3f8c73(0x193)],_0x2f423d=_0x2f2229[_0x3f8c73(0xfb)](_0xe7c44e['id'])||[],_0x1102af=_0x2f423d[_0x3f8c73(0x133)]>0x0?a35_0x364cda[_0x3f8c73(0x138)]('\x20['+_0x2f423d['length']+_0x3f8c73(0x13b)):'';console[_0x3f8c73(0x192)]('\x0a'+a35_0x364cda[_0x3f8c73(0x18a)](_0x3f8c73(0x16d))+'\x20'+_0x5542d2+_0x1102af),console[_0x3f8c73(0x192)]('─'[_0x3f8c73(0x13a)](0x3c));const _0x2d30f6=segmentWithActivationsToYaml(_0xe7c44e,_0x2f423d,undefined,_0xa6a6f7,_0x2de820),_0x4e44a5=segmentToYamlString(_0x2d30f6),_0x3a6686=generateDiff(_0x4e44a5,'');console['error'](formatDiffWithColors(_0x3a6686)),console[_0x3f8c73(0x192)]('─'[_0x3f8c73(0x13a)](0x3c));}const _0x1478c3=_0x393414[_0x3f8c73(0x15a)](_0x3c84b3=>!_0x3c84b3[_0x3f8c73(0x11b)]&&_0x3c84b3[_0x3f8c73(0x107)]);if(_0x1478c3[_0x3f8c73(0x133)]>0x0)for(const _0x4bae06 of _0x1478c3){const _0x370d32=_0x4bae06['folderPath']?_0x4bae06['folderPath']+'/'+_0x4bae06[_0x3f8c73(0x10b)][_0x3f8c73(0x193)]:_0x4bae06['yamlConfig'][_0x3f8c73(0x193)];console[_0x3f8c73(0x192)]('\x0a'+a35_0x364cda[_0x3f8c73(0x188)](_0x3f8c73(0x17a))+'\x20'+_0x370d32),console[_0x3f8c73(0x192)]('─'[_0x3f8c73(0x13a)](0x3c)),console[_0x3f8c73(0x192)](_0x4bae06['diff']),console[_0x3f8c73(0x192)]('─'[_0x3f8c73(0x13a)](0x3c));}if(_0x28d973[_0x3f8c73(0x184)])return console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x188)](_0x3f8c73(0x131))),0x0;const _0x420ded=_0xb56e60[_0x3f8c73(0x133)]>0x0||_0x447915['length']>0x0||_0x515158[_0x3f8c73(0x133)]>0x0,_0x2e77d5=_0x72789f[_0x3f8c73(0x133)]>0x0,_0x253802=_0x511313[_0x3f8c73(0x133)]>0x0;if(!_0x420ded&&!_0x2e77d5&&!_0x253802)return console['error'](a35_0x364cda[_0x3f8c73(0x150)](_0x3f8c73(0x182))),0x0;const _0x5874e9=_0xb56e60[_0x3f8c73(0x133)]+_0x447915[_0x3f8c73(0x133)]+_0x515158[_0x3f8c73(0x133)]+_0x511313[_0x3f8c73(0x133)]+_0x72789f[_0x3f8c73(0x133)];if(!_0x28d973[_0x3f8c73(0x11d)]&&_0x5874e9>0x0){const _0x4174e9=await confirmKey(_0x3f8c73(0x109)+_0x5874e9+_0x3f8c73(0x129));if(!_0x4174e9)return console['error'](_0x3f8c73(0x127)),0x1;}for(const _0x1dfd0f of _0x511313){const _0x39aa00=_0x1dfd0f['split']('/'),_0x3c7706=_0x39aa00[_0x39aa00['length']-0x1],_0x5ad64c=_0x39aa00[_0x3f8c73(0x172)](0x0,-0x1)[_0x3f8c73(0xfc)]('/'),_0x448b98=_0x67cfcc['get'](_0x5ad64c),_0x16be9a={'name':_0x3c7706,'parentFolderId':_0x448b98},_0x254d8b=await withSpinner('Creating\x20folder\x20\x27'+_0x1dfd0f+_0x3f8c73(0x124),()=>_0x27b90e[_0x3f8c73(0x12c)][_0x3f8c73(0x154)](_0x3c6ae5,_0x16be9a),{'verbose':_0x28d973[_0x3f8c73(0x103)]});_0x67cfcc['set'](_0x1dfd0f,_0x254d8b[_0x3f8c73(0x17d)]['id']),console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x173)](_0x3f8c73(0x18c)+_0x1dfd0f+'\x27'));}let _0xcaa921=0x0,_0x251b83=0x0,_0x476c58=0x0,_0x16732f=0x0,_0x218851=0x0,_0x265887=0x0;const _0x58c862=new Map();for(const _0x415377 of _0x393414){const _0x4ea223=_0x415377[_0x3f8c73(0x186)]?_0x67cfcc[_0x3f8c73(0xfb)](_0x415377[_0x3f8c73(0x186)]):undefined;let _0x25b4b7;try{if(_0x415377[_0x3f8c73(0x11b)]){const _0x36c323=yamlToCreateRequest(_0x415377[_0x3f8c73(0x10b)],_0x4ea223),_0x256bf5=await withSpinner(_0x3f8c73(0xfe)+_0x415377[_0x3f8c73(0x10b)][_0x3f8c73(0x193)]+_0x3f8c73(0x124),()=>_0x27b90e[_0x3f8c73(0x12c)][_0x3f8c73(0x174)](_0x3c6ae5,_0x36c323),{'verbose':_0x28d973[_0x3f8c73(0x103)]});_0x25b4b7=_0x256bf5[_0x3f8c73(0x17d)]['id'],_0x58c862['set'](_0x415377['yamlConfig']['name'],_0x25b4b7),console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x150)](_0x3f8c73(0x126)+_0x415377[_0x3f8c73(0x10b)][_0x3f8c73(0x193)]+'\x27')),_0xcaa921++;}else{if(_0x415377[_0x3f8c73(0x135)]){const _0x2d40dd=yamlToUpdateRequest(_0x415377[_0x3f8c73(0x10b)]);_0x4ea223!==_0x415377[_0x3f8c73(0x169)]?.[_0x3f8c73(0x11f)]&&(_0x2d40dd['segmentFolderId']=_0x4ea223?parseInt(_0x4ea223,0xa):undefined),await withSpinner(_0x3f8c73(0x164)+_0x415377[_0x3f8c73(0x10b)][_0x3f8c73(0x193)]+_0x3f8c73(0x124),()=>_0x27b90e[_0x3f8c73(0x12c)]['updateSegmentById'](_0x3c6ae5,_0x415377[_0x3f8c73(0x169)]['id'],_0x2d40dd),{'verbose':_0x28d973[_0x3f8c73(0x103)]}),_0x25b4b7=_0x415377[_0x3f8c73(0x169)]['id'],console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x188)](_0x3f8c73(0x167)+_0x415377[_0x3f8c73(0x10b)][_0x3f8c73(0x193)]+'\x27')),_0x251b83++;}else _0x25b4b7=_0x415377[_0x3f8c73(0x169)]['id'];}}catch(_0x5e0a05){const _0x5df498=isHttp400Error(_0x5e0a05),_0x40a2e0=_0x5df498?ErrorCode[_0x3f8c73(0x194)]:ErrorCode[_0x3f8c73(0x101)],_0x5cd543=getErrorMessage(_0x5e0a05);throw new SDKError(_0x40a2e0,_0x3f8c73(0x11a)+(_0x415377['isNew']?_0x3f8c73(0x151):_0x3f8c73(0x160))+_0x3f8c73(0x16f)+_0x415377[_0x3f8c73(0x158)]+_0x3f8c73(0xfd)+_0x5cd543,_0x5e0a05);}for(const _0x3404a9 of _0x415377['activationActions']){try{if(_0x3404a9[_0x3f8c73(0x10e)]===_0x3f8c73(0x151)&&_0x3404a9[_0x3f8c73(0x191)]){const _0x43a788=yamlActivationToCreateRequest(_0x3404a9[_0x3f8c73(0x191)],_0x534057,_0x4aba62);await withSpinner(_0x3f8c73(0x18b)+_0x3404a9[_0x3f8c73(0x193)]+_0x3f8c73(0x124),()=>_0x27b90e[_0x3f8c73(0x12c)][_0x3f8c73(0x139)](_0x3c6ae5,_0x25b4b7,_0x43a788),{'verbose':_0x28d973[_0x3f8c73(0x103)]}),console[_0x3f8c73(0x192)](a35_0x364cda['green'](_0x3f8c73(0x187)+_0x3404a9[_0x3f8c73(0x193)]+'\x27')),_0x16732f++;}else{if(_0x3404a9['type']===_0x3f8c73(0x160)&&_0x3404a9[_0x3f8c73(0x191)]&&_0x3404a9[_0x3f8c73(0x13d)]){const _0x1c89ed=yamlActivationToUpdateRequest(_0x3404a9[_0x3f8c73(0x191)],_0x534057,_0x4aba62);await withSpinner(_0x3f8c73(0x112)+_0x3404a9[_0x3f8c73(0x193)]+_0x3f8c73(0x124),()=>_0x27b90e[_0x3f8c73(0x12c)][_0x3f8c73(0x152)](_0x3c6ae5,_0x25b4b7,_0x3404a9[_0x3f8c73(0x13d)]['id'],_0x1c89ed),{'verbose':_0x28d973['verbose']}),console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x188)](_0x3f8c73(0x171)+_0x3404a9[_0x3f8c73(0x193)]+'\x27')),_0x218851++;}else _0x3404a9[_0x3f8c73(0x10e)]===_0x3f8c73(0x14b)&&_0x3404a9[_0x3f8c73(0x13d)]&&(await withSpinner('Deleting\x20activation\x20\x27'+_0x3404a9[_0x3f8c73(0x193)]+_0x3f8c73(0x124),()=>_0x27b90e[_0x3f8c73(0x12c)][_0x3f8c73(0x108)](_0x3c6ae5,_0x25b4b7,_0x3404a9['existingActivation']['id']),{'verbose':_0x28d973[_0x3f8c73(0x103)]}),console['error'](a35_0x364cda[_0x3f8c73(0x18a)](_0x3f8c73(0x161)+_0x3404a9['name']+'\x27')),_0x265887++);}}catch(_0x3475ff){const _0x2e67d7=isHttp400Error(_0x3475ff),_0x3a28a3=_0x2e67d7?ErrorCode[_0x3f8c73(0x11e)]:ErrorCode[_0x3f8c73(0x117)],_0x4cdfb1=getErrorMessage(_0x3475ff);throw new SDKError(_0x3a28a3,_0x3f8c73(0x11a)+_0x3404a9[_0x3f8c73(0x10e)]+_0x3f8c73(0x120)+_0x3404a9['name']+_0x3f8c73(0x177)+_0x415377['absolutePath']+'\x0a\x20\x20'+_0x4cdfb1,_0x3475ff);}}}for(const _0x4a63e1 of _0x515158){await withSpinner('Deleting\x20segment\x20\x27'+_0x4a63e1[_0x3f8c73(0x193)]+'\x27...',()=>_0x27b90e[_0x3f8c73(0x12c)][_0x3f8c73(0x156)](_0x4a63e1['id']),{'verbose':_0x28d973['verbose']}),console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x18a)](_0x3f8c73(0x136)+_0x4a63e1['name']+'\x27')),_0x476c58++;}const _0x1509bd=[];if(_0xcaa921>0x0)_0x1509bd[_0x3f8c73(0x179)](_0xcaa921+_0x3f8c73(0x18e));if(_0x251b83>0x0)_0x1509bd['push'](_0x251b83+_0x3f8c73(0x12d));if(_0x476c58>0x0)_0x1509bd['push'](_0x476c58+_0x3f8c73(0x18f));const _0xff22f4=[];if(_0x16732f>0x0)_0xff22f4[_0x3f8c73(0x179)](_0x16732f+_0x3f8c73(0x18e));if(_0x218851>0x0)_0xff22f4['push'](_0x218851+_0x3f8c73(0x12d));if(_0x265887>0x0)_0xff22f4[_0x3f8c73(0x179)](_0x265887+_0x3f8c73(0x18f));return console[_0x3f8c73(0x192)](a35_0x364cda[_0x3f8c73(0x150)](_0x3f8c73(0x13c))),_0x1509bd[_0x3f8c73(0x133)]>0x0&&console[_0x3f8c73(0x192)](_0x3f8c73(0x125)+_0x1509bd['join'](',\x20')),_0xff22f4[_0x3f8c73(0x133)]>0x0&&console['error']('\x20\x20Activations:\x20'+_0xff22f4[_0x3f8c73(0xfc)](',\x20')),0x0;}}function buildFolderPathToIdMap(_0xc65c7b){const _0x13644=a35_0x5802ad,_0x4adc5b=new Map(),_0x5eef85=new Map();for(const _0x1defd0 of _0xc65c7b){_0x5eef85[_0x13644(0x122)](_0x1defd0['id'],_0x1defd0);}const _0x5e5272=new Set();for(const _0x3347ed of _0xc65c7b){!_0x3347ed['parentFolderId']&&_0x5e5272[_0x13644(0x153)](_0x3347ed['id']);}function _0xf7dbb(_0x2fa93f){const _0x5351a6=_0x13644;if(_0x5e5272[_0x5351a6(0x12f)](_0x2fa93f['id']))return'';if(_0x2fa93f[_0x5351a6(0x145)]){const _0xe2d44b=_0x5eef85[_0x5351a6(0xfb)](_0x2fa93f[_0x5351a6(0x145)]);if(_0xe2d44b){const _0x218812=_0xf7dbb(_0xe2d44b);return _0x218812?_0x218812+'/'+_0x2fa93f[_0x5351a6(0x193)]:_0x2fa93f[_0x5351a6(0x193)];}}return _0x2fa93f['name'];}for(const _0x339025 of _0xc65c7b){const _0x356d79=_0xf7dbb(_0x339025);_0x4adc5b['set'](_0x356d79,_0x339025['id']);}return _0x4adc5b;}function findYamlFiles(_0x1bbb7c){const _0x59ff4f=[];function _0x2cccfa(_0x555034){const _0x173fdb=a35_0x4bc8,_0xbde1cc=readdirSync(_0x555034,{'withFileTypes':!![]});for(const _0x14d5bc of _0xbde1cc){const _0x5ea856=a35_0x33e977[_0x173fdb(0xfc)](_0x555034,_0x14d5bc['name']);if(_0x14d5bc[_0x173fdb(0x17f)]())_0x2cccfa(_0x5ea856);else(_0x14d5bc['name'][_0x173fdb(0x118)](_0x173fdb(0x165))||_0x14d5bc[_0x173fdb(0x193)][_0x173fdb(0x118)](_0x173fdb(0x15d)))&&_0x59ff4f[_0x173fdb(0x179)](_0x5ea856);}}return _0x2cccfa(_0x1bbb7c),_0x59ff4f;}function calculateActivationActions(_0x1f4879,_0x2c53f7,_0x5f3290,_0x43b96b){const _0x5771f6=a35_0x5802ad,_0x3fd62e=[],_0x529be9=new Map();for(const _0xcbb150 of _0x2c53f7){_0x529be9[_0x5771f6(0x122)](_0xcbb150[_0x5771f6(0x193)],_0xcbb150);}const _0x3eb293=new Map();for(const _0x4c5888 of _0x1f4879){_0x3eb293[_0x5771f6(0x122)](_0x4c5888[_0x5771f6(0x193)],_0x4c5888);}for(const _0x52304d of _0x1f4879){const _0x24dacb=_0x529be9[_0x5771f6(0xfb)](_0x52304d['name']);if(!_0x24dacb)_0x3fd62e[_0x5771f6(0x179)]({'type':_0x5771f6(0x151),'name':_0x52304d[_0x5771f6(0x193)],'yamlActivation':_0x52304d});else{const _0x44c978=activationToYaml(_0x24dacb,_0x5f3290,_0x43b96b),_0x521dfe=a35_0x2c555e[_0x5771f6(0x12e)](_0x44c978),_0x72996=a35_0x2c555e[_0x5771f6(0x12e)](_0x52304d);_0x521dfe!==_0x72996&&_0x3fd62e[_0x5771f6(0x179)]({'type':_0x5771f6(0x160),'name':_0x52304d[_0x5771f6(0x193)],'yamlActivation':_0x52304d,'existingActivation':_0x24dacb});}}for(const _0x25153b of _0x2c53f7){!_0x3eb293[_0x5771f6(0x12f)](_0x25153b[_0x5771f6(0x193)])&&_0x3fd62e[_0x5771f6(0x179)]({'type':_0x5771f6(0x14b),'name':_0x25153b['name'],'existingActivation':_0x25153b});}return _0x3fd62e;}
@@ -1 +1 @@
1
- function a36_0x500a(_0x3007fc,_0x4949b1){_0x3007fc=_0x3007fc-0x80;const _0x99a427=a36_0x99a4();let _0x500a35=_0x99a427[_0x3007fc];return _0x500a35;}function a36_0x99a4(){const _0xff63e1=['9614108HzCpfo','Resolved\x20relative\x20path\x20to:\x20','11271240JigowQ','updateSegmentById','data','error','40852EsKIgy','Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]','4663000vCrSxZ','segmentName','5GsmfSC','length','Segment\x20ID\x20missing\x20from\x20resolved\x20path','yellow','segment:update','ruleFile','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','Error:\x20Cannot\x20update\x20','resolvePathToResource','12aBgNYS','verbose','Parent\x20ID:\x20','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','✔\x20Updated\x20segment\x20\x27','type','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','32985139zsMLuK','Segment\x20ID:\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','segment','4EdcBJC','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','segmentId','\x27...','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','folder','rule','Updating\x20segment\x20\x27','description','Update\x20existing\x20child\x20segment','Resolving\x20path\x20\x27','7526814ZymQcq','includes','execute','370742bYyEaQ','⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.','417gfkbuw','kind','parentId','27PBTKcz'];a36_0x99a4=function(){return _0xff63e1;};return a36_0x99a4();}const a36_0x47cd23=a36_0x500a;(function(_0x2ca5f9,_0x1e2cfb){const _0x433f20=a36_0x500a,_0x395992=_0x2ca5f9();while(!![]){try{const _0x21453c=-parseInt(_0x433f20(0x98))/0x1*(parseInt(_0x433f20(0xa6))/0x2)+parseInt(_0x433f20(0xa8))/0x3*(-parseInt(_0x433f20(0x80))/0x4)+-parseInt(_0x433f20(0x84))/0x5*(-parseInt(_0x433f20(0xa3))/0x6)+-parseInt(_0x433f20(0xac))/0x7+parseInt(_0x433f20(0xae))/0x8+parseInt(_0x433f20(0xab))/0x9*(-parseInt(_0x433f20(0x82))/0xa)+parseInt(_0x433f20(0x94))/0xb*(parseInt(_0x433f20(0x8d))/0xc);if(_0x21453c===_0x1e2cfb)break;else _0x395992['push'](_0x395992['shift']());}catch(_0x49fc99){_0x395992['push'](_0x395992['shift']());}}}(a36_0x99a4,0xb1e0c));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_0x191cef from'chalk';export class SegmentUpdateCommand extends BaseCommand{['name']=a36_0x47cd23(0x88);[a36_0x47cd23(0xa0)]=a36_0x47cd23(0xa1);async[a36_0x47cd23(0xa5)](_0x14e899){const _0x5a064d=a36_0x47cd23;console[_0x5a064d(0xb1)](a36_0x191cef[_0x5a064d(0x87)](_0x5a064d(0xa7))),console[_0x5a064d(0xb1)](a36_0x191cef[_0x5a064d(0x87)](_0x5a064d(0x96)));const {options:_0x4cc7e5,args:_0x552992,tdx:_0x17ad10}=_0x14e899,_0x11b872=_0x4cc7e5;if(_0x552992[_0x5a064d(0x85)]===0x0)return console[_0x5a064d(0xb1)](_0x5a064d(0x99)),console[_0x5a064d(0xb1)](_0x5a064d(0x93)),console[_0x5a064d(0xb1)]('Examples:'),console['error'](_0x5a064d(0x90)),console[_0x5a064d(0xb1)](_0x5a064d(0x9c)),0x1;const _0x1fbbdd=_0x552992[0x0],_0x2bef7b=_0x4cc7e5['segmentPath'];let _0x5bbdc3=_0x1fbbdd;_0x2bef7b&&!_0x1fbbdd[_0x5a064d(0xa4)]('/')&&(_0x5bbdc3=_0x2bef7b+'/'+_0x1fbbdd,_0x11b872['verbose']&&console[_0x5a064d(0xb1)](_0x5a064d(0xad)+_0x5bbdc3));const _0x1962be=await withSpinner(_0x5a064d(0xa2)+_0x5bbdc3+_0x5a064d(0x9b),()=>_0x17ad10[_0x5a064d(0x97)][_0x5a064d(0x8c)](_0x5bbdc3),{'verbose':_0x11b872['verbose']}),_0x9409d1=_0x1962be[_0x5a064d(0xb0)];_0x11b872['verbose']&&console[_0x5a064d(0xb1)]('Resolved\x20type:\x20'+_0x9409d1['type']);if(_0x9409d1[_0x5a064d(0x92)]!==_0x5a064d(0x97))return console['error'](_0x5a064d(0x8b)+_0x9409d1[_0x5a064d(0x92)]+_0x5a064d(0x8a)),console[_0x5a064d(0xb1)](_0x5a064d(0x81)),0x1;if(!_0x9409d1['segmentId'])throw new SDKError(ErrorCode['INTERNAL'],_0x5a064d(0x86));const _0x11712b=_0x9409d1[_0x5a064d(0xaa)],_0x33401b=_0x9409d1[_0x5a064d(0x9a)];_0x11b872[_0x5a064d(0x8e)]&&(console['error'](_0x5a064d(0x8f)+_0x11712b),console[_0x5a064d(0xb1)](_0x5a064d(0x95)+_0x33401b));let _0x54a9f7;if(_0x11b872['folder']){const _0xca6d54=_0x11b872[_0x5a064d(0x9d)],_0x409381=await withSpinner('Resolving\x20folder\x20\x27'+_0xca6d54+'\x27...',()=>_0x17ad10['segment']['resolveFolderId'](_0x11712b,_0xca6d54),{'verbose':_0x11b872['verbose']});_0x54a9f7=parseInt(_0x409381[_0x5a064d(0xb0)],0xa),_0x11b872['verbose']&&console['error']('Resolved\x20folder\x20ID:\x20'+_0x54a9f7);}const _0x9a4d9b=await loadJSONFromOptions(_0x11b872[_0x5a064d(0x9e)],_0x11b872[_0x5a064d(0x89)]),_0x53afc2={'name':_0x11b872['name'],'description':_0x11b872[_0x5a064d(0xa0)],'rule':_0x9a4d9b,'kind':_0x11b872['kind']!==undefined?parseInt(_0x11b872[_0x5a064d(0xa9)],0xa):undefined,'segmentFolderId':_0x54a9f7},_0x1628c7=await withSpinner(_0x5a064d(0x9f)+_0x9409d1[_0x5a064d(0x83)]+_0x5a064d(0x9b),()=>_0x17ad10[_0x5a064d(0x97)][_0x5a064d(0xaf)](_0x11712b,_0x33401b,_0x53afc2),{'verbose':_0x11b872[_0x5a064d(0x8e)]}),_0x5a0c1=_0x1628c7['data'];return console[_0x5a064d(0xb1)](_0x5a064d(0x91)+_0x5a0c1['name']+'\x27'),_0x5bbdc3!==_0x1fbbdd&&console[_0x5a064d(0xb1)]('\x20\x20\x20Path:\x20'+_0x5bbdc3),await handleSDKOutput([_0x5a0c1],_0x11b872),0x0;}}
1
+ function a36_0x2189(_0x3b6a03,_0x2b53f3){_0x3b6a03=_0x3b6a03-0x1e5;const _0x44929f=a36_0x4492();let _0x2189b1=_0x44929f[_0x3b6a03];return _0x2189b1;}const a36_0x392998=a36_0x2189;(function(_0x21c30e,_0x9a1f03){const _0x5522d8=a36_0x2189,_0x3ed670=_0x21c30e();while(!![]){try{const _0x581bf0=parseInt(_0x5522d8(0x217))/0x1*(-parseInt(_0x5522d8(0x1fa))/0x2)+-parseInt(_0x5522d8(0x1f0))/0x3*(parseInt(_0x5522d8(0x207))/0x4)+-parseInt(_0x5522d8(0x204))/0x5+parseInt(_0x5522d8(0x20e))/0x6+parseInt(_0x5522d8(0x210))/0x7+parseInt(_0x5522d8(0x206))/0x8+-parseInt(_0x5522d8(0x216))/0x9;if(_0x581bf0===_0x9a1f03)break;else _0x3ed670['push'](_0x3ed670['shift']());}catch(_0x541bd8){_0x3ed670['push'](_0x3ed670['shift']());}}}(a36_0x4492,0x269ec));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';function a36_0x4492(){const _0x2b1506=['INTERNAL','kind','segmentId','length','updateSegmentById','46443FwIJyy','parentId','resolvePathToResource','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','segment','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','name','segmentPath','Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]','execute','2YNGjol','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','Resolved\x20relative\x20path\x20to:\x20','✔\x20Updated\x20segment\x20\x27','Resolved\x20folder\x20ID:\x20','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','verbose','Resolving\x20folder\x20\x27','type','Updating\x20segment\x20\x27','3755fLvyqc','Segment\x20ID:\x20','306456NicZMY','12GrBtal','ruleFile','resolveFolderId','folder','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Parent\x20ID:\x20','Error:\x20Cannot\x20update\x20','1750050Gurhed','yellow','1674029JFLSok','data','includes','segment:update','Examples:','rule','2839005sduneY','48302KkTPKO','description','\x20\x20\x20Path:\x20','segmentName','⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.','Resolved\x20type:\x20','error','\x27...','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Update\x20existing\x20child\x20segment'];a36_0x4492=function(){return _0x2b1506;};return a36_0x4492();}import{SDKError,ErrorCode}from'../sdk/index.js';import a36_0x1eeba6 from'chalk';export class SegmentUpdateCommand extends BaseCommand{['name']=a36_0x392998(0x213);[a36_0x392998(0x218)]=a36_0x392998(0x1ea);async[a36_0x392998(0x1f9)](_0x22d3f1){const _0x13ac87=a36_0x392998;console['error'](a36_0x1eeba6[_0x13ac87(0x20f)](_0x13ac87(0x1e5))),console['error'](a36_0x1eeba6[_0x13ac87(0x20f)](_0x13ac87(0x20b)));const {options:_0x3b409a,args:_0x819e15,tdx:_0xe25bc4}=_0x22d3f1,_0x267ae4=_0x3b409a;if(_0x819e15[_0x13ac87(0x1ee)]===0x0)return console['error'](_0x13ac87(0x1ff)),console['error'](_0x13ac87(0x1f3)),console[_0x13ac87(0x1e7)](_0x13ac87(0x214)),console[_0x13ac87(0x1e7)](_0x13ac87(0x1fb)),console['error'](_0x13ac87(0x1f5)),0x1;const _0x2cc981=_0x819e15[0x0],_0x5260e7=_0x3b409a[_0x13ac87(0x1f7)];let _0x2ecfa3=_0x2cc981;_0x5260e7&&!_0x2cc981[_0x13ac87(0x212)]('/')&&(_0x2ecfa3=_0x5260e7+'/'+_0x2cc981,_0x267ae4[_0x13ac87(0x200)]&&console[_0x13ac87(0x1e7)](_0x13ac87(0x1fc)+_0x2ecfa3));const _0x1f4bc4=await withSpinner('Resolving\x20path\x20\x27'+_0x2ecfa3+'\x27...',()=>_0xe25bc4[_0x13ac87(0x1f4)][_0x13ac87(0x1f2)](_0x2ecfa3),{'verbose':_0x267ae4[_0x13ac87(0x200)]}),_0x1ce888=_0x1f4bc4[_0x13ac87(0x211)];_0x267ae4[_0x13ac87(0x200)]&&console['error'](_0x13ac87(0x1e6)+_0x1ce888[_0x13ac87(0x202)]);if(_0x1ce888[_0x13ac87(0x202)]!==_0x13ac87(0x1f4))return console[_0x13ac87(0x1e7)](_0x13ac87(0x20d)+_0x1ce888[_0x13ac87(0x202)]+'.\x20Only\x20child\x20segments\x20can\x20be\x20updated.'),console[_0x13ac87(0x1e7)](_0x13ac87(0x1f8)),0x1;if(!_0x1ce888[_0x13ac87(0x1ed)])throw new SDKError(ErrorCode[_0x13ac87(0x1eb)],_0x13ac87(0x1e9));const _0x1e9b61=_0x1ce888[_0x13ac87(0x1f1)],_0x259872=_0x1ce888['segmentId'];_0x267ae4[_0x13ac87(0x200)]&&(console['error'](_0x13ac87(0x20c)+_0x1e9b61),console[_0x13ac87(0x1e7)](_0x13ac87(0x205)+_0x259872));let _0x168223;if(_0x267ae4[_0x13ac87(0x20a)]){const _0x55359=_0x267ae4['folder'],_0x2d0058=await withSpinner(_0x13ac87(0x201)+_0x55359+_0x13ac87(0x1e8),()=>_0xe25bc4[_0x13ac87(0x1f4)][_0x13ac87(0x209)](_0x1e9b61,_0x55359),{'verbose':_0x267ae4['verbose']});_0x168223=parseInt(_0x2d0058[_0x13ac87(0x211)],0xa),_0x267ae4[_0x13ac87(0x200)]&&console[_0x13ac87(0x1e7)](_0x13ac87(0x1fe)+_0x168223);}const _0x33d264=await loadJSONFromOptions(_0x267ae4[_0x13ac87(0x215)],_0x267ae4[_0x13ac87(0x208)]),_0x38a7c7={'name':_0x267ae4[_0x13ac87(0x1f6)],'description':_0x267ae4[_0x13ac87(0x218)],'rule':_0x33d264,'kind':_0x267ae4[_0x13ac87(0x1ec)]!==undefined?parseInt(_0x267ae4[_0x13ac87(0x1ec)],0xa):undefined,'segmentFolderId':_0x168223},_0x5b6457=await withSpinner(_0x13ac87(0x203)+_0x1ce888[_0x13ac87(0x21a)]+'\x27...',()=>_0xe25bc4['segment'][_0x13ac87(0x1ef)](_0x1e9b61,_0x259872,_0x38a7c7),{'verbose':_0x267ae4[_0x13ac87(0x200)]}),_0x24c348=_0x5b6457[_0x13ac87(0x211)];return console['error'](_0x13ac87(0x1fd)+_0x24c348['name']+'\x27'),_0x2ecfa3!==_0x2cc981&&console[_0x13ac87(0x1e7)](_0x13ac87(0x219)+_0x2ecfa3),await handleSDKOutput([_0x24c348],_0x267ae4),0x0;}}
@@ -1 +1 @@
1
- function a37_0x50fe(_0x985a4,_0x49b580){_0x985a4=_0x985a4-0x1e5;const _0x1be2cf=a37_0x1be2();let _0x50fe79=_0x1be2cf[_0x985a4];return _0x50fe79;}const a37_0x1a3324=a37_0x50fe;(function(_0x452a27,_0x465d26){const _0x3fe744=a37_0x50fe,_0x1faf1c=_0x452a27();while(!![]){try{const _0x669c60=-parseInt(_0x3fe744(0x208))/0x1+parseInt(_0x3fe744(0x1e7))/0x2*(-parseInt(_0x3fe744(0x218))/0x3)+parseInt(_0x3fe744(0x1fd))/0x4+-parseInt(_0x3fe744(0x214))/0x5+-parseInt(_0x3fe744(0x1fc))/0x6+parseInt(_0x3fe744(0x1ea))/0x7+-parseInt(_0x3fe744(0x21e))/0x8*(-parseInt(_0x3fe744(0x202))/0x9);if(_0x669c60===_0x465d26)break;else _0x1faf1c['push'](_0x1faf1c['shift']());}catch(_0x2b89f1){_0x1faf1c['push'](_0x1faf1c['shift']());}}}(a37_0x1be2,0x70bcd));import{existsSync,statSync}from'fs';import a37_0x43aa8a from'chalk';function a37_0x1be2(){const _0x22c459=['fullPath','folderId','length','cyan','\x27...','segmentPath','slice','2876595QnFDUR','segments','parent_segment','parentId','115143RxSURz','description','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','Use\x20\x22tdx\x20context\x22\x20to\x20see\x20all\x20context\x20parameters','data','execute','24049448VpNvBm','Site:\x20','log','error','Resolved\x20path\x20type:\x20','38FMtbRt','Resolved\x20relative\x20path\x20to:\x20','folderPath','1499218oqhUmg','segment','Folder\x20ID:\x20','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Set\x20current\x20segment/folder\x20context\x20for\x20navigation','parentName','Resolving\x20path\x20\x27','site','Target\x20path:\x20','isAbsolute','Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>','red','✔\x20Context\x20set\x20to:\x20','split','Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','dim','Usage:\x20tdx\x20segment\x20use\x20<path>','5025318tdTDSh','937548tHLOSN','Examples:','Use:\x20tdx\x20segment\x20use\x20','isDirectory','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','9biAKlx','name','join','config','verbose','Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.','850858UHmgzm','resolvePathToResource','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent','green'];a37_0x1be2=function(){return _0x22c459;};return a37_0x1be2();}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_0x1a3324(0x203)]='segment:use';[a37_0x1a3324(0x219)]=a37_0x1a3324(0x1ee);async[a37_0x1a3324(0x21d)](_0x253ada){const _0x376a5c=a37_0x1a3324,{options:_0x4044ff,args:_0x4ca11d,tdx:_0xd3dbcc}=_0x253ada;if(_0x4ca11d['length']===0x0)return console[_0x376a5c(0x1e5)](a37_0x43aa8a[_0x376a5c(0x1f5)]('Error:\x20Path\x20is\x20required\x0a')),console[_0x376a5c(0x1e5)](_0x376a5c(0x1fb)),console[_0x376a5c(0x1e5)](_0x376a5c(0x1fe)),console[_0x376a5c(0x1e5)](_0x376a5c(0x1f9)),console['error']('\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22'),console[_0x376a5c(0x1e5)]('\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context'),console['error'](_0x376a5c(0x20b)),0x1;const _0x355880=_0x4ca11d[0x0],_0x3fcb51=_0x4044ff['session'];try{if(_0x355880==='/')return saveSessionContext({'segment_path':undefined},_0x3fcb51),console['log'](a37_0x43aa8a['green']('✔\x20Context\x20cleared.\x20Back\x20to\x20root.')),0x0;if(existsSync(_0x355880)&&statSync(_0x355880)[_0x376a5c(0x200)]()){let _0x17e7fb;try{_0x17e7fb=findTdxConfig(_0x355880);}catch{return console[_0x376a5c(0x1e5)](a37_0x43aa8a[_0x376a5c(0x1f5)](_0x376a5c(0x21a)+_0x355880)),console[_0x376a5c(0x1e5)](a37_0x43aa8a[_0x376a5c(0x210)](_0x376a5c(0x1ed))),0x1;}const _0x42a2ed=_0x17e7fb[_0x376a5c(0x205)][_0x376a5c(0x216)];return saveSessionContext({'segment_path':_0x42a2ed,'parent_segment':_0x42a2ed},_0x3fcb51),console[_0x376a5c(0x220)](a37_0x43aa8a[_0x376a5c(0x20c)](_0x376a5c(0x1f6)+a37_0x43aa8a[_0x376a5c(0x210)](_0x42a2ed))),0x0;}const _0x147d0c=_0x4044ff[_0x376a5c(0x212)];let _0x17f262=_0x355880;const _0x390861=parsePath(_0x355880);if(!_0x390861[_0x376a5c(0x1f3)]){if(!_0x147d0c)return console[_0x376a5c(0x1e5)](a37_0x43aa8a[_0x376a5c(0x1f5)]('Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.')),console[_0x376a5c(0x1e5)](a37_0x43aa8a[_0x376a5c(0x210)](_0x376a5c(0x1f4))),0x1;if(_0x355880==='..'){const _0x363326=_0x147d0c[_0x376a5c(0x1f7)]('/')[_0x376a5c(0x213)](0x0,-0x1)[_0x376a5c(0x204)]('/');_0x17f262=_0x363326||'/';}else _0x355880==='.'?_0x17f262=_0x147d0c:_0x17f262=_0x147d0c+'/'+_0x355880;_0x4044ff[_0x376a5c(0x206)]&&console[_0x376a5c(0x1e5)](_0x376a5c(0x1e8)+_0x17f262);}if(_0x17f262==='/'||_0x17f262==='')return saveSessionContext({'segment_path':undefined},_0x3fcb51),console[_0x376a5c(0x220)](a37_0x43aa8a['green'](_0x376a5c(0x20a))),0x0;_0x17f262=normalizePath(_0x17f262);const _0x6535c=parsePath(_0x17f262)[_0x376a5c(0x215)];if(_0x6535c[_0x376a5c(0x20f)]===0x0)return saveSessionContext({'segment_path':undefined},_0x3fcb51),console[_0x376a5c(0x220)](a37_0x43aa8a[_0x376a5c(0x20c)]('✔\x20Context\x20cleared.\x20Back\x20to\x20root.')),0x0;_0x4044ff[_0x376a5c(0x206)]&&(console[_0x376a5c(0x1e5)](_0x376a5c(0x21f)+_0x4044ff[_0x376a5c(0x1f1)]),console[_0x376a5c(0x1e5)](_0x376a5c(0x1f2)+_0x17f262));const _0xc13493=await withSpinner(_0x376a5c(0x1f0)+_0x17f262+_0x376a5c(0x211),()=>_0xd3dbcc['segment'][_0x376a5c(0x209)](_0x17f262),{'verbose':_0x4044ff[_0x376a5c(0x206)]}),_0x389e0c=_0xc13493[_0x376a5c(0x21c)];_0x4044ff['verbose']&&(console['error'](_0x376a5c(0x1e6)+_0x389e0c['type']),console[_0x376a5c(0x1e5)]('Parent\x20ID:\x20'+_0x389e0c[_0x376a5c(0x217)]),_0x389e0c[_0x376a5c(0x20e)]&&console[_0x376a5c(0x1e5)](_0x376a5c(0x1ec)+_0x389e0c[_0x376a5c(0x20e)]));if(_0x389e0c['type']===_0x376a5c(0x1eb))return console[_0x376a5c(0x1e5)](a37_0x43aa8a[_0x376a5c(0x1f5)](_0x376a5c(0x207))),console['error'](_0x376a5c(0x201)),console[_0x376a5c(0x1e5)](a37_0x43aa8a[_0x376a5c(0x210)](_0x376a5c(0x1ff)+_0x389e0c[_0x376a5c(0x1ef)]+(_0x389e0c['folderPath']?'/'+_0x389e0c[_0x376a5c(0x1e9)][_0x376a5c(0x204)]('/'):''))),0x1;return saveSessionContext({'segment_path':_0x389e0c[_0x376a5c(0x20d)],'parent_segment':_0x389e0c[_0x376a5c(0x1ef)]},_0x3fcb51),console[_0x376a5c(0x220)](a37_0x43aa8a[_0x376a5c(0x20c)](_0x376a5c(0x1f6)+a37_0x43aa8a[_0x376a5c(0x210)](_0x389e0c[_0x376a5c(0x20d)]))),_0x4044ff['verbose']&&(console['error'](a37_0x43aa8a[_0x376a5c(0x1fa)](_0x376a5c(0x1f8))),console['error'](a37_0x43aa8a[_0x376a5c(0x1fa)](_0x376a5c(0x21b)))),0x0;}catch(_0x258c39){throw _0x258c39;}}}
1
+ function a37_0x1795(_0x308334,_0x37004){_0x308334=_0x308334-0x16c;const _0x4195b3=a37_0x4195();let _0x17954a=_0x4195b3[_0x308334];return _0x17954a;}const a37_0x596eb8=a37_0x1795;(function(_0x4aebf3,_0x563068){const _0x59f287=a37_0x1795,_0x4be823=_0x4aebf3();while(!![]){try{const _0x53cec4=-parseInt(_0x59f287(0x172))/0x1+-parseInt(_0x59f287(0x178))/0x2*(parseInt(_0x59f287(0x19f))/0x3)+-parseInt(_0x59f287(0x16c))/0x4*(parseInt(_0x59f287(0x18c))/0x5)+-parseInt(_0x59f287(0x195))/0x6+-parseInt(_0x59f287(0x18d))/0x7*(parseInt(_0x59f287(0x1a4))/0x8)+parseInt(_0x59f287(0x17d))/0x9+parseInt(_0x59f287(0x1a6))/0xa;if(_0x53cec4===_0x563068)break;else _0x4be823['push'](_0x4be823['shift']());}catch(_0x3f5f42){_0x4be823['push'](_0x4be823['shift']());}}}(a37_0x4195,0xd936f));import{existsSync,statSync}from'fs';import a37_0xe7b623 from'chalk';function a37_0x4195(){const _0xd76ac9=['config','segmentPath','Resolving\x20path\x20\x27','cyan','270510uOTvmq','91qzfRwJ','site','isDirectory','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','Resolved\x20path\x20type:\x20','red','isAbsolute','Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.','5207562OMDNMw','type','Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22','\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context','log','green','length','session','execute','776184YOVpwZ','Use:\x20tdx\x20segment\x20use\x20','Parent\x20ID:\x20','parentName','description','704888FyWIus','Folder\x20ID:\x20','32814940iQQkAY','segment','✔\x20Context\x20set\x20to:\x20','segments','8cdlcMj','join','Set\x20current\x20segment/folder\x20context\x20for\x20navigation','\x27...','Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>','Usage:\x20tdx\x20segment\x20use\x20<path>','963370gBxjDp','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','Use\x20\x22tdx\x20context\x22\x20to\x20see\x20all\x20context\x20parameters','data','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','name','6eKbLuY','folderId','parentId','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','parent_segment','13224105TaDqBY','Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context','verbose','dim','error','slice','Target\x20path:\x20','Examples:','folderPath','\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent','split'];a37_0x4195=function(){return _0xd76ac9;};return a37_0x4195();}import{BaseCommand}from'./command.js';import{saveSessionContext}from'../core/session.js';import{withSpinner}from'../utils/spinner.js';import{parsePath,normalizePath}from'../utils/segment-path-parser.js';import{findTdxConfig}from'../utils/tdx-config.js';export class SegmentUseCommand extends BaseCommand{[a37_0x596eb8(0x177)]='segment:use';[a37_0x596eb8(0x1a3)]=a37_0x596eb8(0x16e);async[a37_0x596eb8(0x19e)](_0x44679e){const _0x34a05a=a37_0x596eb8,{options:_0x667821,args:_0x5a9378,tdx:_0x119356}=_0x44679e;if(_0x5a9378[_0x34a05a(0x19c)]===0x0)return console[_0x34a05a(0x181)](a37_0xe7b623['red']('Error:\x20Path\x20is\x20required\x0a')),console['error'](_0x34a05a(0x171)),console['error'](_0x34a05a(0x184)),console['error'](_0x34a05a(0x173)),console[_0x34a05a(0x181)](_0x34a05a(0x198)),console[_0x34a05a(0x181)](_0x34a05a(0x199)),console['error'](_0x34a05a(0x186)),0x1;const _0x327b7a=_0x5a9378[0x0],_0xc88988=_0x667821[_0x34a05a(0x19d)];try{if(_0x327b7a==='/')return saveSessionContext({'segment_path':undefined},_0xc88988),console[_0x34a05a(0x19a)](a37_0xe7b623[_0x34a05a(0x19b)](_0x34a05a(0x17b))),0x0;if(existsSync(_0x327b7a)&&statSync(_0x327b7a)[_0x34a05a(0x18f)]()){let _0x4b0cf4;try{_0x4b0cf4=findTdxConfig(_0x327b7a);}catch{return console[_0x34a05a(0x181)](a37_0xe7b623[_0x34a05a(0x192)](_0x34a05a(0x176)+_0x327b7a)),console['error'](a37_0xe7b623['cyan']('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;}const _0x38ed26=_0x4b0cf4[_0x34a05a(0x188)][_0x34a05a(0x17c)];return saveSessionContext({'segment_path':_0x38ed26,'parent_segment':_0x38ed26},_0xc88988),console[_0x34a05a(0x19a)](a37_0xe7b623['green'](_0x34a05a(0x1a8)+a37_0xe7b623[_0x34a05a(0x18b)](_0x38ed26))),0x0;}const _0x5cb6d0=_0x667821[_0x34a05a(0x189)];let _0x4a57a8=_0x327b7a;const _0x1f28bb=parsePath(_0x327b7a);if(!_0x1f28bb[_0x34a05a(0x193)]){if(!_0x5cb6d0)return console[_0x34a05a(0x181)](a37_0xe7b623[_0x34a05a(0x192)](_0x34a05a(0x194))),console['error'](a37_0xe7b623[_0x34a05a(0x18b)](_0x34a05a(0x170))),0x1;if(_0x327b7a==='..'){const _0x940c95=_0x5cb6d0[_0x34a05a(0x187)]('/')[_0x34a05a(0x182)](0x0,-0x1)[_0x34a05a(0x16d)]('/');_0x4a57a8=_0x940c95||'/';}else _0x327b7a==='.'?_0x4a57a8=_0x5cb6d0:_0x4a57a8=_0x5cb6d0+'/'+_0x327b7a;_0x667821[_0x34a05a(0x17f)]&&console[_0x34a05a(0x181)]('Resolved\x20relative\x20path\x20to:\x20'+_0x4a57a8);}if(_0x4a57a8==='/'||_0x4a57a8==='')return saveSessionContext({'segment_path':undefined},_0xc88988),console[_0x34a05a(0x19a)](a37_0xe7b623[_0x34a05a(0x19b)](_0x34a05a(0x17b))),0x0;_0x4a57a8=normalizePath(_0x4a57a8);const _0x5ec9cf=parsePath(_0x4a57a8)[_0x34a05a(0x1a9)];if(_0x5ec9cf[_0x34a05a(0x19c)]===0x0)return saveSessionContext({'segment_path':undefined},_0xc88988),console[_0x34a05a(0x19a)](a37_0xe7b623[_0x34a05a(0x19b)](_0x34a05a(0x17b))),0x0;_0x667821['verbose']&&(console[_0x34a05a(0x181)]('Site:\x20'+_0x667821[_0x34a05a(0x18e)]),console['error'](_0x34a05a(0x183)+_0x4a57a8));const _0x3da77b=await withSpinner(_0x34a05a(0x18a)+_0x4a57a8+_0x34a05a(0x16f),()=>_0x119356[_0x34a05a(0x1a7)]['resolvePathToResource'](_0x4a57a8),{'verbose':_0x667821[_0x34a05a(0x17f)]}),_0x287669=_0x3da77b[_0x34a05a(0x175)];_0x667821[_0x34a05a(0x17f)]&&(console[_0x34a05a(0x181)](_0x34a05a(0x191)+_0x287669[_0x34a05a(0x196)]),console['error'](_0x34a05a(0x1a1)+_0x287669[_0x34a05a(0x17a)]),_0x287669[_0x34a05a(0x179)]&&console[_0x34a05a(0x181)](_0x34a05a(0x1a5)+_0x287669[_0x34a05a(0x179)]));if(_0x287669[_0x34a05a(0x196)]==='segment')return console[_0x34a05a(0x181)](a37_0xe7b623['red'](_0x34a05a(0x197))),console[_0x34a05a(0x181)](_0x34a05a(0x190)),console[_0x34a05a(0x181)](a37_0xe7b623['cyan'](_0x34a05a(0x1a0)+_0x287669[_0x34a05a(0x1a2)]+(_0x287669['folderPath']?'/'+_0x287669[_0x34a05a(0x185)][_0x34a05a(0x16d)]('/'):''))),0x1;return saveSessionContext({'segment_path':_0x287669['fullPath'],'parent_segment':_0x287669[_0x34a05a(0x1a2)]},_0xc88988),console['log'](a37_0xe7b623[_0x34a05a(0x19b)](_0x34a05a(0x1a8)+a37_0xe7b623[_0x34a05a(0x18b)](_0x287669['fullPath']))),_0x667821[_0x34a05a(0x17f)]&&(console[_0x34a05a(0x181)](a37_0xe7b623[_0x34a05a(0x180)](_0x34a05a(0x17e))),console[_0x34a05a(0x181)](a37_0xe7b623[_0x34a05a(0x180)](_0x34a05a(0x174)))),0x0;}catch(_0x3884fe){throw _0x3884fe;}}}
@@ -1 +1 @@
1
- const a38_0x292ed6=a38_0x34a3;(function(_0x365d84,_0x31f9e6){const _0xd5d83c=a38_0x34a3,_0x4c6d9d=_0x365d84();while(!![]){try{const _0x336c4a=parseInt(_0xd5d83c(0x1f4))/0x1*(parseInt(_0xd5d83c(0x1cc))/0x2)+-parseInt(_0xd5d83c(0x1c8))/0x3*(parseInt(_0xd5d83c(0x1ec))/0x4)+-parseInt(_0xd5d83c(0x1f3))/0x5*(parseInt(_0xd5d83c(0x1db))/0x6)+parseInt(_0xd5d83c(0x1d4))/0x7*(-parseInt(_0xd5d83c(0x1d6))/0x8)+-parseInt(_0xd5d83c(0x1cf))/0x9+-parseInt(_0xd5d83c(0x1d9))/0xa+parseInt(_0xd5d83c(0x1c6))/0xb*(parseInt(_0xd5d83c(0x1c9))/0xc);if(_0x336c4a===_0x31f9e6)break;else _0x4c6d9d['push'](_0x4c6d9d['shift']());}catch(_0x5b3911){_0x4c6d9d['push'](_0x4c6d9d['shift']());}}}(a38_0x27a2,0x86ad5));function a38_0x27a2(){const _0x24230c=['Resolving\x20parent\x20segment\x20\x27','includes','List\x20folders\x20and\x20child\x20segments','folder','json','sort','Site:\x20','listWithPattern','\x5c$&','test','Recursive\x20mode:\x20enabled','recursive','82676JIJFxS','\x20\x20tdx\x20sg\x20use\x20\x22My\x20Audience\x22','segment','✔\x20Found\x20',']\x20matching\x20\x27','map','listUnified','5vlvwFO','26ZHPpel','listRecursive','parentSegment','format','Error:\x20','Listing\x20folders\x20and\x20segments...','Building\x20hierarchy\x20tree...','cause','Error:\x20No\x20parent\x20segment\x20context\x20set.','jsonl','\x20folder','✔\x20Built\x20tree\x20with\x20','parentId','message','log','replace','error','Parent\x20segment\x20context:\x20','length','site','filter','\x27...','verbose','name','description','30974779cqlqRX','folderId','81cDMUed','12oqVPVG','/e/','resolvePathToResource','78120rhZxzM','Parent\x20ID:\x20','dim','7552224hUNyTA','\x20\x20tdx\x20sg\x20pull\x20\x22My\x20Audience\x22','web','localeCompare','No\x20items\x20match\x20pattern:\x20','28byzILH','(not\x20set)','1113944AkhUfH','Folder\x20ID:\x20','execute','2757480awmfhP','/app/ps/','6299358IjKsmg','\x20segment','Use\x20tdx\x20ps\x20list\x20to\x20see\x20available\x20parent\x20segments.','Resolving\x20path\x20\x27','data'];a38_0x27a2=function(){return _0x24230c;};return a38_0x27a2();}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a38_0x34a3(_0x4883a8,_0x280fd4){_0x4883a8=_0x4883a8-0x1c4;const _0x27a2a0=a38_0x27a2();let _0x34a347=_0x27a2a0[_0x4883a8];return _0x34a347;}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_0x5ab810 from'chalk';export class SegmentsCommand extends BaseCommand{[a38_0x292ed6(0x1c4)]='segments';[a38_0x292ed6(0x1c5)]=a38_0x292ed6(0x1e2);async[a38_0x292ed6(0x1d8)](_0x5f181d){const _0x1a5f60=a38_0x292ed6,{options:_0x2c54b7,args:_0x5f286e}=_0x5f181d,_0x1b4e81=_0x2c54b7[_0x1a5f60(0x1eb)],_0x4c4b6d=_0x5f286e[0x0];try{const _0xe13d60=_0x2c54b7[_0x1a5f60(0x1f6)];_0x2c54b7[_0x1a5f60(0x20a)]&&(console['error'](_0x1a5f60(0x1e6)+_0x2c54b7[_0x1a5f60(0x207)]),console[_0x1a5f60(0x204)](_0x1a5f60(0x205)+(_0xe13d60||_0x1a5f60(0x1d5))),_0x4c4b6d&&console[_0x1a5f60(0x204)]('Folder/pattern\x20arg:\x20'+_0x4c4b6d),_0x1b4e81&&console['error'](_0x1a5f60(0x1ea)));if(!_0xe13d60)return console['error'](_0x1a5f60(0x1fc)),console['error'](''),console['error']('Set\x20a\x20parent\x20segment\x20context\x20first:'),console['error'](_0x1a5f60(0x1d0)),console[_0x1a5f60(0x204)](_0x1a5f60(0x1ed)),console[_0x1a5f60(0x204)](''),console[_0x1a5f60(0x204)](_0x1a5f60(0x1dd)),0x1;const _0x26aa64=_0x4c4b6d&&(_0x4c4b6d['includes']('*')||_0x4c4b6d[_0x1a5f60(0x1e1)]('?'));if(_0x26aa64)return await this[_0x1a5f60(0x1e7)](_0x5f181d,_0xe13d60,_0x4c4b6d);const _0x124f73=_0x4c4b6d?_0xe13d60+'/'+_0x4c4b6d:_0xe13d60;return _0x1b4e81?await this[_0x1a5f60(0x1f5)](_0x5f181d,_0x124f73):await this[_0x1a5f60(0x1f2)](_0x5f181d,_0x124f73);}catch(_0x1e4142){if(_0x1e4142 instanceof SDKError)return console['error'](_0x1a5f60(0x1f8)+_0x1e4142[_0x1a5f60(0x201)]),_0x1e4142[_0x1a5f60(0x1fb)]&&console['error']('\x20\x20Cause:\x20'+_0x1e4142['cause']),0x1;throw _0x1e4142;}}async['listWithPattern'](_0x748acd,_0x539d4e,_0x4fd78b){const _0x4e4c3f=a38_0x292ed6,{options:_0x3c97d1,tdx:_0x5bca1b}=_0x748acd,_0x524699=_0x3c97d1[_0x4e4c3f(0x1d1)],_0x27d766=await withSpinner(_0x4e4c3f(0x1e0)+_0x539d4e+_0x4e4c3f(0x209),()=>_0x5bca1b['segment']['resolvePathToResource'](_0x539d4e),{'verbose':_0x3c97d1[_0x4e4c3f(0x20a)]}),_0x213cc7=_0x27d766[_0x4e4c3f(0x1df)],_0x223a89=await withSpinner(_0x4e4c3f(0x1f9),()=>_0x5bca1b[_0x4e4c3f(0x1ee)][_0x4e4c3f(0x1f2)](_0x213cc7[_0x4e4c3f(0x200)],_0x213cc7[_0x4e4c3f(0x1c7)]),{'verbose':_0x3c97d1['verbose']}),{folders:_0x2b759a,segments:_0x20bc39}=_0x223a89['data'],_0x26818c=_0x4fd78b['replace'](/[.+^${}()|[\]\\]/g,_0x4e4c3f(0x1e8))[_0x4e4c3f(0x203)](/\*/g,'.*')[_0x4e4c3f(0x203)](/\?/g,'.'),_0x39ebdb=new RegExp('^'+_0x26818c+'$','i'),_0x459ba9=_0x2b759a[_0x4e4c3f(0x208)](_0x30c9a6=>_0x39ebdb['test'](_0x30c9a6[_0x4e4c3f(0x1c4)])),_0x5bed55=_0x20bc39[_0x4e4c3f(0x208)](_0x38e208=>_0x39ebdb[_0x4e4c3f(0x1e9)](_0x38e208[_0x4e4c3f(0x1c4)])),_0x4e20c2=_0x459ba9['length']+_0x5bed55[_0x4e4c3f(0x206)];console[_0x4e4c3f(0x204)](_0x4e4c3f(0x1ef)+_0x459ba9['length']+_0x4e4c3f(0x1fe)+(_0x459ba9['length']!==0x1?'s':'')+'\x20and\x20'+_0x5bed55['length']+_0x4e4c3f(0x1dc)+(_0x5bed55[_0x4e4c3f(0x206)]!==0x1?'s':'')+'\x20matching\x20\x27'+_0x4fd78b+'\x27');const _0x562865=_0x7453f=>{const _0x3be87f=_0x4e4c3f;return getConsoleNextUrl(_0x3c97d1[_0x3be87f(0x207)],_0x3be87f(0x1da)+_0x213cc7[_0x3be87f(0x200)]+_0x3be87f(0x1ca)+_0x7453f);},_0x5b737a=_0x3c97d1[_0x4e4c3f(0x1f7)]===_0x4e4c3f(0x1e4)||_0x3c97d1[_0x4e4c3f(0x1f7)]===_0x4e4c3f(0x1fd);if(_0x5b737a){const _0xe2fc83=[..._0x459ba9[_0x4e4c3f(0x1f1)](_0xaad1bd=>({..._0xaad1bd,'type':'folder'})),..._0x5bed55[_0x4e4c3f(0x1f1)](_0xdf68cf=>({..._0xdf68cf,'type':_0x4e4c3f(0x1ee),'url':_0x562865(_0xdf68cf['id'])}))][_0x4e4c3f(0x1e5)]((_0x2f4fd4,_0x275109)=>_0x2f4fd4[_0x4e4c3f(0x1c4)]['localeCompare'](_0x275109[_0x4e4c3f(0x1c4)]));await handleSDKOutput(_0xe2fc83,_0x3c97d1);}else{if(_0x4e20c2===0x0)console['log'](_0x4e4c3f(0x1d3)+_0x4fd78b);else{console[_0x4e4c3f(0x202)](a38_0x5ab810[_0x4e4c3f(0x1ce)]('['+_0x539d4e+_0x4e4c3f(0x1f0)+_0x4fd78b+'\x27'));const _0x242727=formatFlatList(_0x459ba9,_0x5bed55,{'showMetadata':!![],'showUrl':_0x524699,'getSegmentUrl':_0x562865});console[_0x4e4c3f(0x202)](_0x242727);}}return 0x0;}async['listUnified'](_0x1e5475,_0xd2f393){const _0x2fa56d=a38_0x292ed6,{options:_0x312bf7,tdx:_0x4ce1be}=_0x1e5475,_0x4cf655=_0x312bf7['web'],_0x141857=await withSpinner(_0x2fa56d(0x1de)+_0xd2f393+_0x2fa56d(0x209),()=>_0x4ce1be[_0x2fa56d(0x1ee)][_0x2fa56d(0x1cb)](_0xd2f393),{'verbose':_0x312bf7[_0x2fa56d(0x20a)]}),_0x1e9e84=_0x141857['data'];_0x312bf7[_0x2fa56d(0x20a)]&&(console[_0x2fa56d(0x204)](_0x2fa56d(0x1cd)+_0x1e9e84[_0x2fa56d(0x200)]),_0x1e9e84['folderId']&&console[_0x2fa56d(0x204)](_0x2fa56d(0x1d7)+_0x1e9e84['folderId']));const _0xc96a08=await withSpinner(_0x2fa56d(0x1f9),()=>_0x4ce1be[_0x2fa56d(0x1ee)][_0x2fa56d(0x1f2)](_0x1e9e84[_0x2fa56d(0x200)],_0x1e9e84[_0x2fa56d(0x1c7)]),{'verbose':_0x312bf7[_0x2fa56d(0x20a)]}),{folders:_0x5f2487,segments:_0x34618d}=_0xc96a08[_0x2fa56d(0x1df)],_0x485173=_0x5f2487[_0x2fa56d(0x206)]+_0x34618d[_0x2fa56d(0x206)];console[_0x2fa56d(0x204)](_0x2fa56d(0x1ef)+_0x5f2487[_0x2fa56d(0x206)]+_0x2fa56d(0x1fe)+(_0x5f2487[_0x2fa56d(0x206)]!==0x1?'s':'')+'\x20and\x20'+_0x34618d[_0x2fa56d(0x206)]+_0x2fa56d(0x1dc)+(_0x34618d['length']!==0x1?'s':''));const _0x23e0c8=_0x5c5728=>{const _0x15115d=_0x2fa56d;return getConsoleNextUrl(_0x312bf7[_0x15115d(0x207)],_0x15115d(0x1da)+_0x1e9e84[_0x15115d(0x200)]+'/e/'+_0x5c5728);},_0x2b0783=_0x312bf7[_0x2fa56d(0x1f7)]==='json'||_0x312bf7[_0x2fa56d(0x1f7)]==='jsonl';if(_0x2b0783){const _0xc46c4=[..._0x5f2487[_0x2fa56d(0x1f1)](_0x5331b6=>({..._0x5331b6,'type':_0x2fa56d(0x1e3)})),..._0x34618d[_0x2fa56d(0x1f1)](_0x853392=>({..._0x853392,'type':_0x2fa56d(0x1ee),'url':_0x23e0c8(_0x853392['id'])}))][_0x2fa56d(0x1e5)]((_0x247937,_0x5b4616)=>_0x247937[_0x2fa56d(0x1c4)][_0x2fa56d(0x1d2)](_0x5b4616[_0x2fa56d(0x1c4)]));await handleSDKOutput(_0xc46c4,_0x312bf7);}else{if(_0x485173===0x0)console[_0x2fa56d(0x202)](a38_0x5ab810[_0x2fa56d(0x1ce)]('['+_0xd2f393+']')),console[_0x2fa56d(0x202)]('(empty)');else{console[_0x2fa56d(0x202)](a38_0x5ab810[_0x2fa56d(0x1ce)]('['+_0xd2f393+']'));const _0x5de6d9=formatFlatList(_0x5f2487,_0x34618d,{'showMetadata':!![],'showUrl':_0x4cf655,'getSegmentUrl':_0x23e0c8});console[_0x2fa56d(0x202)](_0x5de6d9);}}return 0x0;}async[a38_0x292ed6(0x1f5)](_0x36d42a,_0x3e3cf6){const _0x540e1b=a38_0x292ed6,{options:_0x4d8b73,tdx:_0x427169}=_0x36d42a,_0x2ac378=_0x4d8b73[_0x540e1b(0x1d1)],_0x12463a=await withSpinner(_0x540e1b(0x1de)+_0x3e3cf6+_0x540e1b(0x209),()=>_0x427169[_0x540e1b(0x1ee)][_0x540e1b(0x1cb)](_0x3e3cf6),{'verbose':_0x4d8b73[_0x540e1b(0x20a)]}),_0x4ff694=_0x12463a[_0x540e1b(0x1df)];_0x4d8b73[_0x540e1b(0x20a)]&&(console[_0x540e1b(0x204)](_0x540e1b(0x1cd)+_0x4ff694[_0x540e1b(0x200)]),_0x4ff694[_0x540e1b(0x1c7)]&&console[_0x540e1b(0x204)](_0x540e1b(0x1d7)+_0x4ff694['folderId']));const _0x410a36=_0x4d8b73['maxDepth']||0xa,_0x5d87e3=await withSpinner(_0x540e1b(0x1fa),()=>_0x427169[_0x540e1b(0x1ee)]['listRecursive'](_0x4ff694[_0x540e1b(0x200)],_0x4ff694[_0x540e1b(0x1c7)],0x0,_0x410a36),{'verbose':_0x4d8b73[_0x540e1b(0x20a)]}),_0x47d5df=_0x5d87e3[_0x540e1b(0x1df)];console[_0x540e1b(0x204)](_0x540e1b(0x1ff)+_0x47d5df[_0x540e1b(0x206)]+'\x20top-level\x20items');const _0x55575d=_0x328769=>{const _0x51a7a4=_0x540e1b;return getConsoleNextUrl(_0x4d8b73[_0x51a7a4(0x207)],_0x51a7a4(0x1da)+_0x4ff694[_0x51a7a4(0x200)]+_0x51a7a4(0x1ca)+_0x328769);};if(_0x4d8b73[_0x540e1b(0x1f7)]===_0x540e1b(0x1e4)||_0x4d8b73[_0x540e1b(0x1f7)]===_0x540e1b(0x1fd))await handleSDKOutput(_0x47d5df,_0x4d8b73);else{console['log'](a38_0x5ab810[_0x540e1b(0x1ce)]('['+_0x3e3cf6+']'));const _0x276675=formatTree(_0x47d5df,{'showMetadata':!![],'showUrl':_0x2ac378,'getSegmentUrl':_0x55575d});console['log'](_0x276675);}return 0x0;}}
1
+ const a38_0x38d25d=a38_0x4239;function a38_0x4753(){const _0x26a85d=['147328NemsJY','/app/ps/','(empty)','Folder\x20ID:\x20','map','\x20and\x20','100008zVXQAW','includes','\x27...','segment','dim','\x20\x20tdx\x20sg\x20use\x20\x22My\x20Audience\x22','243GPvRWo','/e/','web','description','\x20segment','length','\x20\x20tdx\x20sg\x20pull\x20\x22My\x20Audience\x22','Error:\x20No\x20parent\x20segment\x20context\x20set.','site','Listing\x20folders\x20and\x20segments...','error','10OpucTP','verbose','log','Building\x20hierarchy\x20tree...','List\x20folders\x20and\x20child\x20segments','3277728puQges','folderId','Error:\x20','listRecursive','Resolving\x20parent\x20segment\x20\x27','\x20matching\x20\x27','test','cause','\x20\x20Cause:\x20','folder','resolvePathToResource',']\x20matching\x20\x27','segments','14VJkrdT','3265108XOlSdS','json','✔\x20Found\x20','Recursive\x20mode:\x20enabled','\x20folder','Resolving\x20path\x20\x27','jsonl','24OVPWLG','execute','format','listUnified','listWithPattern','✔\x20Built\x20tree\x20with\x20','Set\x20a\x20parent\x20segment\x20context\x20first:','sort','Use\x20tdx\x20ps\x20list\x20to\x20see\x20available\x20parent\x20segments.','1763136RNnSFW','data','parentId','418270wJQjvW','334516ABSxoV','filter','Parent\x20ID:\x20','Folder/pattern\x20arg:\x20','parentSegment','localeCompare','name','replace'];a38_0x4753=function(){return _0x26a85d;};return a38_0x4753();}(function(_0x260859,_0x46f2af){const _0x29c5dc=a38_0x4239,_0x3d7a20=_0x260859();while(!![]){try{const _0x328b9f=parseInt(_0x29c5dc(0x1c6))/0x1+-parseInt(_0x29c5dc(0x1ce))/0x2*(parseInt(_0x29c5dc(0x1ff))/0x3)+parseInt(_0x29c5dc(0x1ea))/0x4+-parseInt(_0x29c5dc(0x1c5))/0x5+-parseInt(_0x29c5dc(0x1c2))/0x6*(-parseInt(_0x29c5dc(0x1f7))/0x7)+parseInt(_0x29c5dc(0x1d4))/0x8*(-parseInt(_0x29c5dc(0x1da))/0x9)+parseInt(_0x29c5dc(0x1e5))/0xa*(-parseInt(_0x29c5dc(0x1f8))/0xb);if(_0x328b9f===_0x46f2af)break;else _0x3d7a20['push'](_0x3d7a20['shift']());}catch(_0x539f25){_0x3d7a20['push'](_0x3d7a20['shift']());}}}(a38_0x4753,0x6a0a3));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{formatFlatList,formatTree}from'../utils/tree-formatter.js';import{getConsoleNextUrl}from'../types/endpoints.js';import a38_0x134cca from'chalk';function a38_0x4239(_0x39f6ef,_0x1bd04b){_0x39f6ef=_0x39f6ef-0x1c2;const _0x4753ea=a38_0x4753();let _0x423963=_0x4753ea[_0x39f6ef];return _0x423963;}export class SegmentsCommand extends BaseCommand{[a38_0x38d25d(0x1cc)]=a38_0x38d25d(0x1f6);[a38_0x38d25d(0x1dd)]=a38_0x38d25d(0x1e9);async[a38_0x38d25d(0x200)](_0x1f7b63){const _0x43239a=a38_0x38d25d,{options:_0x1300e2,args:_0x16cf21}=_0x1f7b63,_0x3a5030=_0x1300e2['recursive'],_0x746bfa=_0x16cf21[0x0];try{const _0x4f82be=_0x1300e2[_0x43239a(0x1ca)];_0x1300e2[_0x43239a(0x1e6)]&&(console[_0x43239a(0x1e4)]('Site:\x20'+_0x1300e2[_0x43239a(0x1e2)]),console[_0x43239a(0x1e4)]('Parent\x20segment\x20context:\x20'+(_0x4f82be||'(not\x20set)')),_0x746bfa&&console[_0x43239a(0x1e4)](_0x43239a(0x1c9)+_0x746bfa),_0x3a5030&&console['error'](_0x43239a(0x1fb)));if(!_0x4f82be)return console[_0x43239a(0x1e4)](_0x43239a(0x1e1)),console[_0x43239a(0x1e4)](''),console[_0x43239a(0x1e4)](_0x43239a(0x205)),console[_0x43239a(0x1e4)](_0x43239a(0x1e0)),console[_0x43239a(0x1e4)](_0x43239a(0x1d9)),console[_0x43239a(0x1e4)](''),console[_0x43239a(0x1e4)](_0x43239a(0x207)),0x1;const _0x538c99=_0x746bfa&&(_0x746bfa[_0x43239a(0x1d5)]('*')||_0x746bfa[_0x43239a(0x1d5)]('?'));if(_0x538c99)return await this[_0x43239a(0x203)](_0x1f7b63,_0x4f82be,_0x746bfa);const _0x229cd5=_0x746bfa?_0x4f82be+'/'+_0x746bfa:_0x4f82be;return _0x3a5030?await this[_0x43239a(0x1ed)](_0x1f7b63,_0x229cd5):await this['listUnified'](_0x1f7b63,_0x229cd5);}catch(_0x10644a){if(_0x10644a instanceof SDKError)return console[_0x43239a(0x1e4)](_0x43239a(0x1ec)+_0x10644a['message']),_0x10644a[_0x43239a(0x1f1)]&&console['error'](_0x43239a(0x1f2)+_0x10644a['cause']),0x1;throw _0x10644a;}}async[a38_0x38d25d(0x203)](_0xb63385,_0x1213fe,_0x505d9f){const _0x3e55ca=a38_0x38d25d,{options:_0x30250e,tdx:_0x4426d2}=_0xb63385,_0x1b3d0f=_0x30250e[_0x3e55ca(0x1dc)],_0x277fa7=await withSpinner(_0x3e55ca(0x1ee)+_0x1213fe+_0x3e55ca(0x1d6),()=>_0x4426d2[_0x3e55ca(0x1d7)][_0x3e55ca(0x1f4)](_0x1213fe),{'verbose':_0x30250e[_0x3e55ca(0x1e6)]}),_0x451d88=_0x277fa7[_0x3e55ca(0x1c3)],_0x475b6a=await withSpinner('Listing\x20folders\x20and\x20segments...',()=>_0x4426d2[_0x3e55ca(0x1d7)][_0x3e55ca(0x202)](_0x451d88[_0x3e55ca(0x1c4)],_0x451d88['folderId']),{'verbose':_0x30250e['verbose']}),{folders:_0x2b501b,segments:_0x299125}=_0x475b6a[_0x3e55ca(0x1c3)],_0x16487d=_0x505d9f[_0x3e55ca(0x1cd)](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0x3e55ca(0x1cd)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x2a23e5=new RegExp('^'+_0x16487d+'$','i'),_0x374684=_0x2b501b[_0x3e55ca(0x1c7)](_0x190777=>_0x2a23e5[_0x3e55ca(0x1f0)](_0x190777[_0x3e55ca(0x1cc)])),_0x14b21a=_0x299125[_0x3e55ca(0x1c7)](_0x163fb5=>_0x2a23e5[_0x3e55ca(0x1f0)](_0x163fb5[_0x3e55ca(0x1cc)])),_0x460f18=_0x374684[_0x3e55ca(0x1df)]+_0x14b21a[_0x3e55ca(0x1df)];console['error'](_0x3e55ca(0x1fa)+_0x374684['length']+_0x3e55ca(0x1fc)+(_0x374684[_0x3e55ca(0x1df)]!==0x1?'s':'')+_0x3e55ca(0x1d3)+_0x14b21a['length']+_0x3e55ca(0x1de)+(_0x14b21a[_0x3e55ca(0x1df)]!==0x1?'s':'')+_0x3e55ca(0x1ef)+_0x505d9f+'\x27');const _0x360a5c=_0xa763b5=>{const _0x460f0e=_0x3e55ca;return getConsoleNextUrl(_0x30250e['site'],_0x460f0e(0x1cf)+_0x451d88[_0x460f0e(0x1c4)]+_0x460f0e(0x1db)+_0xa763b5);},_0x11c05c=_0x30250e['format']===_0x3e55ca(0x1f9)||_0x30250e[_0x3e55ca(0x201)]===_0x3e55ca(0x1fe);if(_0x11c05c){const _0x5bc966=[..._0x374684[_0x3e55ca(0x1d2)](_0x428009=>({..._0x428009,'type':_0x3e55ca(0x1f3)})),..._0x14b21a[_0x3e55ca(0x1d2)](_0xd57818=>({..._0xd57818,'type':_0x3e55ca(0x1d7),'url':_0x360a5c(_0xd57818['id'])}))][_0x3e55ca(0x206)]((_0x29554c,_0x44a6f3)=>_0x29554c[_0x3e55ca(0x1cc)][_0x3e55ca(0x1cb)](_0x44a6f3['name']));await handleSDKOutput(_0x5bc966,_0x30250e);}else{if(_0x460f18===0x0)console['log']('No\x20items\x20match\x20pattern:\x20'+_0x505d9f);else{console[_0x3e55ca(0x1e7)](a38_0x134cca[_0x3e55ca(0x1d8)]('['+_0x1213fe+_0x3e55ca(0x1f5)+_0x505d9f+'\x27'));const _0x40c4ca=formatFlatList(_0x374684,_0x14b21a,{'showMetadata':!![],'showUrl':_0x1b3d0f,'getSegmentUrl':_0x360a5c});console['log'](_0x40c4ca);}}return 0x0;}async['listUnified'](_0x5c54e2,_0x4307d){const _0x57cf34=a38_0x38d25d,{options:_0x542d2b,tdx:_0x53f4db}=_0x5c54e2,_0x57e10b=_0x542d2b['web'],_0x856c77=await withSpinner(_0x57cf34(0x1fd)+_0x4307d+_0x57cf34(0x1d6),()=>_0x53f4db[_0x57cf34(0x1d7)][_0x57cf34(0x1f4)](_0x4307d),{'verbose':_0x542d2b['verbose']}),_0x3e2ee2=_0x856c77['data'];_0x542d2b['verbose']&&(console['error']('Parent\x20ID:\x20'+_0x3e2ee2[_0x57cf34(0x1c4)]),_0x3e2ee2['folderId']&&console[_0x57cf34(0x1e4)](_0x57cf34(0x1d1)+_0x3e2ee2[_0x57cf34(0x1eb)]));const _0x2f0569=await withSpinner(_0x57cf34(0x1e3),()=>_0x53f4db[_0x57cf34(0x1d7)]['listUnified'](_0x3e2ee2[_0x57cf34(0x1c4)],_0x3e2ee2['folderId']),{'verbose':_0x542d2b[_0x57cf34(0x1e6)]}),{folders:_0xf6686,segments:_0x3397b}=_0x2f0569[_0x57cf34(0x1c3)],_0x594000=_0xf6686[_0x57cf34(0x1df)]+_0x3397b['length'];console['error']('✔\x20Found\x20'+_0xf6686[_0x57cf34(0x1df)]+_0x57cf34(0x1fc)+(_0xf6686['length']!==0x1?'s':'')+_0x57cf34(0x1d3)+_0x3397b[_0x57cf34(0x1df)]+_0x57cf34(0x1de)+(_0x3397b['length']!==0x1?'s':''));const _0x59ee89=_0x3fd08e=>{const _0x3734a8=_0x57cf34;return getConsoleNextUrl(_0x542d2b[_0x3734a8(0x1e2)],_0x3734a8(0x1cf)+_0x3e2ee2[_0x3734a8(0x1c4)]+_0x3734a8(0x1db)+_0x3fd08e);},_0x5a4ed5=_0x542d2b[_0x57cf34(0x201)]===_0x57cf34(0x1f9)||_0x542d2b[_0x57cf34(0x201)]===_0x57cf34(0x1fe);if(_0x5a4ed5){const _0x1c7619=[..._0xf6686[_0x57cf34(0x1d2)](_0x312dc8=>({..._0x312dc8,'type':'folder'})),..._0x3397b[_0x57cf34(0x1d2)](_0x5d1bbf=>({..._0x5d1bbf,'type':_0x57cf34(0x1d7),'url':_0x59ee89(_0x5d1bbf['id'])}))][_0x57cf34(0x206)]((_0x157811,_0x433c06)=>_0x157811[_0x57cf34(0x1cc)][_0x57cf34(0x1cb)](_0x433c06[_0x57cf34(0x1cc)]));await handleSDKOutput(_0x1c7619,_0x542d2b);}else{if(_0x594000===0x0)console[_0x57cf34(0x1e7)](a38_0x134cca[_0x57cf34(0x1d8)]('['+_0x4307d+']')),console[_0x57cf34(0x1e7)](_0x57cf34(0x1d0));else{console['log'](a38_0x134cca['dim']('['+_0x4307d+']'));const _0x3b5af1=formatFlatList(_0xf6686,_0x3397b,{'showMetadata':!![],'showUrl':_0x57e10b,'getSegmentUrl':_0x59ee89});console[_0x57cf34(0x1e7)](_0x3b5af1);}}return 0x0;}async['listRecursive'](_0x414bb8,_0x1a41f4){const _0x5bf17f=a38_0x38d25d,{options:_0x1edbf0,tdx:_0x54a074}=_0x414bb8,_0x18fa50=_0x1edbf0[_0x5bf17f(0x1dc)],_0x3a4eb3=await withSpinner(_0x5bf17f(0x1fd)+_0x1a41f4+_0x5bf17f(0x1d6),()=>_0x54a074['segment'][_0x5bf17f(0x1f4)](_0x1a41f4),{'verbose':_0x1edbf0[_0x5bf17f(0x1e6)]}),_0x264230=_0x3a4eb3['data'];_0x1edbf0[_0x5bf17f(0x1e6)]&&(console[_0x5bf17f(0x1e4)](_0x5bf17f(0x1c8)+_0x264230[_0x5bf17f(0x1c4)]),_0x264230[_0x5bf17f(0x1eb)]&&console[_0x5bf17f(0x1e4)](_0x5bf17f(0x1d1)+_0x264230[_0x5bf17f(0x1eb)]));const _0x267f08=_0x1edbf0['maxDepth']||0xa,_0x3d28b4=await withSpinner(_0x5bf17f(0x1e8),()=>_0x54a074[_0x5bf17f(0x1d7)][_0x5bf17f(0x1ed)](_0x264230[_0x5bf17f(0x1c4)],_0x264230[_0x5bf17f(0x1eb)],0x0,_0x267f08),{'verbose':_0x1edbf0[_0x5bf17f(0x1e6)]}),_0xb1dac5=_0x3d28b4[_0x5bf17f(0x1c3)];console[_0x5bf17f(0x1e4)](_0x5bf17f(0x204)+_0xb1dac5[_0x5bf17f(0x1df)]+'\x20top-level\x20items');const _0x27eb91=_0x59fb33=>{const _0x14aabd=_0x5bf17f;return getConsoleNextUrl(_0x1edbf0['site'],'/app/ps/'+_0x264230[_0x14aabd(0x1c4)]+'/e/'+_0x59fb33);};if(_0x1edbf0[_0x5bf17f(0x201)]===_0x5bf17f(0x1f9)||_0x1edbf0[_0x5bf17f(0x201)]===_0x5bf17f(0x1fe))await handleSDKOutput(_0xb1dac5,_0x1edbf0);else{console[_0x5bf17f(0x1e7)](a38_0x134cca['dim']('['+_0x1a41f4+']'));const _0x4010c7=formatTree(_0xb1dac5,{'showMetadata':!![],'showUrl':_0x18fa50,'getSegmentUrl':_0x27eb91});console['log'](_0x4010c7);}return 0x0;}}
@@ -1 +1 @@
1
- const a39_0xfcb0fe=a39_0x1d37;(function(_0x141afd,_0x8b11ea){const _0x2fba92=a39_0x1d37,_0x156563=_0x141afd();while(!![]){try{const _0x411347=-parseInt(_0x2fba92(0x1e5))/0x1+-parseInt(_0x2fba92(0x1e9))/0x2*(parseInt(_0x2fba92(0x1f0))/0x3)+-parseInt(_0x2fba92(0x1e6))/0x4*(-parseInt(_0x2fba92(0x1d0))/0x5)+-parseInt(_0x2fba92(0x1eb))/0x6*(-parseInt(_0x2fba92(0x1f8))/0x7)+-parseInt(_0x2fba92(0x1ef))/0x8*(parseInt(_0x2fba92(0x1f6))/0x9)+-parseInt(_0x2fba92(0x1e8))/0xa*(-parseInt(_0x2fba92(0x1d7))/0xb)+-parseInt(_0x2fba92(0x1dd))/0xc*(-parseInt(_0x2fba92(0x1e3))/0xd);if(_0x411347===_0x8b11ea)break;else _0x156563['push'](_0x156563['shift']());}catch(_0x2f6b93){_0x156563['push'](_0x156563['shift']());}}}(a39_0x2ebd,0xd917a));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';function a39_0x2ebd(){const _0x349a9f=['27PBgqBm','execute','301SnggNj','✔\x20Retrieved\x20','Site:\x20','show','catalog','site','...','5TxLJIc','\x20row','name','\x20\x20Cause:\x20','data','limit','Error:\x20','80454DNPlfg','\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--database\x20<database>','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','Database:\x20','showTable','1107084RhPxKV','Catalog:\x20','Limit:\x20','error','verbose','query','195kxxFwy','validate','1363117NeyeYY','3190996GKYnll','length','350rmSHWl','104564diXTjm','Show\x20table\x20contents','115380UiMriB','Querying\x20','cause','✔\x20Query\x20successful\x20-\x200\x20rows\x20returned','328968WRTIeX','51dPafMC','Usage:\x20tdx\x20show\x20<database.table>','database','table','args','description'];a39_0x2ebd=function(){return _0x349a9f;};return a39_0x2ebd();}function a39_0x1d37(_0x5b817f,_0x1d1346){_0x5b817f=_0x5b817f-0x1cc;const _0x2ebde2=a39_0x2ebd();let _0x1d371f=_0x2ebde2[_0x5b817f];return _0x1d371f;}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_0xfcb0fe(0x1d2)]=a39_0xfcb0fe(0x1cc);[a39_0xfcb0fe(0x1f5)]=a39_0xfcb0fe(0x1ea);async[a39_0xfcb0fe(0x1f7)](_0x275372){const _0x306c66=a39_0xfcb0fe;return this[_0x306c66(0x1dc)](_0x275372);}async[a39_0xfcb0fe(0x1dc)](_0x117662){const _0x500e70=a39_0xfcb0fe,{options:_0x5851d9,args:_0x154d58,tdx:_0x3cea9e}=_0x117662;let _0x56c35f;try{_0x56c35f=parseTableReference(_0x154d58[0x0]);const _0x25f7b3=_0x5851d9[_0x500e70(0x1f2)];!_0x56c35f['database']&&_0x25f7b3&&(_0x56c35f['database']=_0x25f7b3);const _0x2ef27f=validateTableDescribeReference(_0x56c35f);if(_0x2ef27f)return console[_0x500e70(0x1e0)](_0x500e70(0x1d6)+_0x2ef27f),console[_0x500e70(0x1e0)](_0x500e70(0x1f1)),console['error']('\x20\x20\x20or:\x20tdx\x20show\x20<catalog.database.table>'),console[_0x500e70(0x1e0)](_0x500e70(0x1d8)),0x1;}catch(_0x274cf9){return console['error'](_0x500e70(0x1d6)+_0x274cf9['message']),console[_0x500e70(0x1e0)](_0x500e70(0x1f1)),console[_0x500e70(0x1e0)]('\x20\x20\x20or:\x20tdx\x20show\x20<catalog.database.table>'),console[_0x500e70(0x1e0)](_0x500e70(0x1d8)),0x1;}const _0x523ba6=_0x56c35f[_0x500e70(0x1cd)],_0xb6649c=_0x56c35f[_0x500e70(0x1f2)],_0x3b54ff=_0x56c35f[_0x500e70(0x1f3)],_0x4f1ddb=resolveLimit(_0x5851d9[_0x500e70(0x1d5)],DEFAULT_DISPLAY_LIMIT);try{_0x5851d9[_0x500e70(0x1e1)]&&(console[_0x500e70(0x1e0)](_0x500e70(0x1fa)+_0x5851d9[_0x500e70(0x1ce)]),_0x523ba6&&console[_0x500e70(0x1e0)](_0x500e70(0x1de)+_0x523ba6),console[_0x500e70(0x1e0)](_0x500e70(0x1db)+_0xb6649c),console[_0x500e70(0x1e0)](_0x500e70(0x1da)+_0x3b54ff),console['error'](_0x500e70(0x1df)+_0x4f1ddb));const _0x1674dd=_0x523ba6?_0x523ba6+'.'+_0xb6649c+'.'+_0x3b54ff:_0xb6649c+'.'+_0x3b54ff,_0x3054d5=await withSpinner(_0x500e70(0x1ec)+_0x1674dd+_0x500e70(0x1cf),()=>_0x3cea9e[_0x500e70(0x1e2)]['showTable'](_0xb6649c,_0x3b54ff,_0x4f1ddb,_0x523ba6),{'verbose':_0x5851d9[_0x500e70(0x1e1)]}),_0x29e703=_0x3054d5[_0x500e70(0x1d4)],_0x175cf5=_0x29e703['data'];return _0x175cf5['length']===0x0?console[_0x500e70(0x1e0)](_0x500e70(0x1ee)):console[_0x500e70(0x1e0)](_0x500e70(0x1f9)+_0x175cf5[_0x500e70(0x1e7)]+_0x500e70(0x1d1)+(_0x175cf5['length']!==0x1?'s':'')+'\x20from\x20'+_0x1674dd),await handleSDKOutput(_0x175cf5,_0x5851d9),0x0;}catch(_0xb3489d){if(_0xb3489d instanceof SDKError)return console[_0x500e70(0x1e0)]('Error:\x20'+_0xb3489d['message']),_0xb3489d[_0x500e70(0x1ed)]&&console['error'](_0x500e70(0x1d3)+_0xb3489d[_0x500e70(0x1ed)]),0x1;throw _0xb3489d;}}[a39_0xfcb0fe(0x1e4)](_0x4a596a){const _0x2ca0f5=a39_0xfcb0fe;if(_0x4a596a[_0x2ca0f5(0x1f4)][_0x2ca0f5(0x1e7)]===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(_0x4a596a[_0x2ca0f5(0x1f4)][_0x2ca0f5(0x1e7)]>0x1)return _0x2ca0f5(0x1d9);return undefined;}}
1
+ const a39_0x1302cf=a39_0x3ec8;function a39_0x3ec8(_0x5f28a2,_0xcb46fc){_0x5f28a2=_0x5f28a2-0x104;const _0x51416c=a39_0x5141();let _0x3ec860=_0x51416c[_0x5f28a2];return _0x3ec860;}(function(_0x5e20c8,_0x3a88a3){const _0x2332c3=a39_0x3ec8,_0x1b4feb=_0x5e20c8();while(!![]){try{const _0xa6b5f2=-parseInt(_0x2332c3(0x11e))/0x1*(parseInt(_0x2332c3(0x118))/0x2)+-parseInt(_0x2332c3(0x12f))/0x3*(-parseInt(_0x2332c3(0x11b))/0x4)+-parseInt(_0x2332c3(0x12a))/0x5*(parseInt(_0x2332c3(0x122))/0x6)+parseInt(_0x2332c3(0x10e))/0x7+parseInt(_0x2332c3(0x105))/0x8+parseInt(_0x2332c3(0x120))/0x9+-parseInt(_0x2332c3(0x12e))/0xa;if(_0xa6b5f2===_0x3a88a3)break;else _0x1b4feb['push'](_0x1b4feb['shift']());}catch(_0x595ca){_0x1b4feb['push'](_0x1b4feb['shift']());}}}(a39_0x5141,0x442f2));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{parseTableReference,validateTableDescribeReference}from'../utils/table-ref-parser.js';import{withSpinner}from'../utils/spinner.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';export class ShowCommand extends BaseCommand{[a39_0x1302cf(0x112)]=a39_0x1302cf(0x110);[a39_0x1302cf(0x12b)]=a39_0x1302cf(0x124);async[a39_0x1302cf(0x11c)](_0x1ec3c9){const _0x4beb7b=a39_0x1302cf;return this[_0x4beb7b(0x10d)](_0x1ec3c9);}async['showTable'](_0xd6a0f3){const _0x57fb69=a39_0x1302cf,{options:_0x4c61c1,args:_0x399573,tdx:_0x1716c7}=_0xd6a0f3;let _0x3a7315;try{_0x3a7315=parseTableReference(_0x399573[0x0]);const _0x2d41e3=_0x4c61c1[_0x57fb69(0x116)];!_0x3a7315['database']&&_0x2d41e3&&(_0x3a7315[_0x57fb69(0x116)]=_0x2d41e3);const _0x1b2304=validateTableDescribeReference(_0x3a7315);if(_0x1b2304)return console['error'](_0x57fb69(0x126)+_0x1b2304),console[_0x57fb69(0x117)](_0x57fb69(0x113)),console[_0x57fb69(0x117)](_0x57fb69(0x119)),console['error'](_0x57fb69(0x128)),0x1;}catch(_0x14086b){return console[_0x57fb69(0x117)](_0x57fb69(0x126)+_0x14086b[_0x57fb69(0x10f)]),console[_0x57fb69(0x117)]('Usage:\x20tdx\x20show\x20<database.table>'),console[_0x57fb69(0x117)](_0x57fb69(0x119)),console[_0x57fb69(0x117)](_0x57fb69(0x128)),0x1;}const _0x1a608c=_0x3a7315[_0x57fb69(0x108)],_0x3f79a6=_0x3a7315[_0x57fb69(0x116)],_0x2923bc=_0x3a7315[_0x57fb69(0x12d)],_0x29b04c=resolveLimit(_0x4c61c1[_0x57fb69(0x10c)],DEFAULT_DISPLAY_LIMIT);try{_0x4c61c1[_0x57fb69(0x115)]&&(console[_0x57fb69(0x117)](_0x57fb69(0x104)+_0x4c61c1[_0x57fb69(0x111)]),_0x1a608c&&console[_0x57fb69(0x117)](_0x57fb69(0x10a)+_0x1a608c),console[_0x57fb69(0x117)](_0x57fb69(0x106)+_0x3f79a6),console[_0x57fb69(0x117)](_0x57fb69(0x127)+_0x2923bc),console[_0x57fb69(0x117)](_0x57fb69(0x11d)+_0x29b04c));const _0x5c5d82=_0x1a608c?_0x1a608c+'.'+_0x3f79a6+'.'+_0x2923bc:_0x3f79a6+'.'+_0x2923bc,_0x525ce9=await withSpinner('Querying\x20'+_0x5c5d82+'...',()=>_0x1716c7[_0x57fb69(0x114)][_0x57fb69(0x10d)](_0x3f79a6,_0x2923bc,_0x29b04c,_0x1a608c),{'verbose':_0x4c61c1[_0x57fb69(0x115)]}),_0x4a46dc=_0x525ce9[_0x57fb69(0x123)],_0x26de89=_0x4a46dc['data'];return _0x26de89[_0x57fb69(0x121)]===0x0?console[_0x57fb69(0x117)](_0x57fb69(0x125)):console[_0x57fb69(0x117)](_0x57fb69(0x11f)+_0x26de89['length']+'\x20row'+(_0x26de89[_0x57fb69(0x121)]!==0x1?'s':'')+'\x20from\x20'+_0x5c5d82),await handleSDKOutput(_0x26de89,_0x4c61c1),0x0;}catch(_0x362d5e){if(_0x362d5e instanceof SDKError)return console[_0x57fb69(0x117)]('Error:\x20'+_0x362d5e[_0x57fb69(0x10f)]),_0x362d5e[_0x57fb69(0x11a)]&&console['error'](_0x57fb69(0x10b)+_0x362d5e[_0x57fb69(0x11a)]),0x1;throw _0x362d5e;}}[a39_0x1302cf(0x129)](_0x4d3702){const _0x1d52e0=a39_0x1302cf;if(_0x4d3702[_0x1d52e0(0x12c)][_0x1d52e0(0x121)]===0x0)return _0x1d52e0(0x107);if(_0x4d3702[_0x1d52e0(0x12c)][_0x1d52e0(0x121)]>0x1)return _0x1d52e0(0x109);return undefined;}}function a39_0x5141(){const _0x227cb8=['Usage:\x20tdx\x20show\x20<database.table>','query','verbose','database','error','482lxNwjW','\x20\x20\x20or:\x20tdx\x20show\x20<catalog.database.table>','cause','36feYeNF','execute','Limit:\x20','1684dPbAZf','✔\x20Retrieved\x20','2341755yCvCCh','length','282fcrXVH','data','Show\x20table\x20contents','✔\x20Query\x20successful\x20-\x200\x20rows\x20returned','Error:\x20','Table:\x20','\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--database\x20<database>','validate','53810jxhSNG','description','args','table','1228610yBtzXf','158031LVKWUT','Site:\x20','3698296hplFcs','Database:\x20','Usage:\x20tdx\x20show\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20show\x20<catalog.database.table>\x0a\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--database\x20<database>\x0a\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--in\x20<database>\x0a\x0aRun\x20\x27tdx\x20show\x20--help\x27\x20for\x20more\x20options','catalog','Too\x20many\x20arguments\x0aUsage:\x20tdx\x20show\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--database\x20<database>\x0a\x0aRun\x20\x27tdx\x20show\x20--help\x27\x20for\x20more\x20options','Catalog:\x20','\x20\x20Cause:\x20','limit','showTable','820582oKqVQJ','message','show','site','name'];a39_0x5141=function(){return _0x227cb8;};return a39_0x5141();}