@treasuredata/tdx 0.8.1 → 0.8.3

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 (119) 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.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/client/cdp-api-client.js +1 -1
  8. package/dist/client/engage-api-client.js +1 -1
  9. package/dist/client/http-client.js +1 -1
  10. package/dist/client/llm-api-client.js +1 -1
  11. package/dist/client/rate-limiter.js +1 -1
  12. package/dist/client/td-api-client.js +1 -1
  13. package/dist/client/trino-api-client.js +1 -1
  14. package/dist/client/workflow-client.js +1 -1
  15. package/dist/commands/activations.js +1 -1
  16. package/dist/commands/api-command.js +1 -1
  17. package/dist/commands/auth-command.js +1 -1
  18. package/dist/commands/chat-command.js +1 -1
  19. package/dist/commands/claude-command.d.ts.map +1 -1
  20. package/dist/commands/claude-command.js +1 -1
  21. package/dist/commands/claude-command.js.map +1 -1
  22. package/dist/commands/claude-statusline-command.js +1 -1
  23. package/dist/commands/claude-usage-command.js +1 -1
  24. package/dist/commands/command.js +1 -1
  25. package/dist/commands/connection-command.js +1 -1
  26. package/dist/commands/context-command.js +1 -1
  27. package/dist/commands/databases.js +1 -1
  28. package/dist/commands/describe.js +1 -1
  29. package/dist/commands/engage-command.js +1 -1
  30. package/dist/commands/job-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/llm-proxy.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/profiles-command.js +1 -1
  35. package/dist/commands/query-command.js +1 -1
  36. package/dist/commands/segment-command.js +1 -1
  37. package/dist/commands/segment-create-command.js +1 -1
  38. package/dist/commands/segment-fields-command.js +1 -1
  39. package/dist/commands/segment-pull-command.js +1 -1
  40. package/dist/commands/segment-push-command.js +1 -1
  41. package/dist/commands/segment-update-command.js +1 -1
  42. package/dist/commands/segment-use-command.js +1 -1
  43. package/dist/commands/segments.js +1 -1
  44. package/dist/commands/show.js +1 -1
  45. package/dist/commands/tables.js +1 -1
  46. package/dist/commands/use-command.js +1 -1
  47. package/dist/commands/user-command.js +1 -1
  48. package/dist/commands/workflow-command.js +1 -1
  49. package/dist/core/auth.js +1 -1
  50. package/dist/core/config.js +1 -1
  51. package/dist/core/connection-cache.js +1 -1
  52. package/dist/core/credential-cache.js +1 -1
  53. package/dist/core/global-context.js +1 -1
  54. package/dist/core/keychain.js +1 -1
  55. package/dist/core/profile.js +1 -1
  56. package/dist/core/project-config.js +1 -1
  57. package/dist/core/session.js +1 -1
  58. package/dist/core/user-cache.js +1 -1
  59. package/dist/index.js +1 -1
  60. package/dist/proxy/anthropic-adapter.d.ts +11 -19
  61. package/dist/proxy/anthropic-adapter.d.ts.map +1 -1
  62. package/dist/proxy/anthropic-adapter.js +1 -1
  63. package/dist/proxy/anthropic-adapter.js.map +1 -1
  64. package/dist/proxy/claude-usage-tracker.js +1 -1
  65. package/dist/proxy/context-signature.js +1 -1
  66. package/dist/proxy/conversation-utils.js +1 -1
  67. package/dist/proxy/conversation-utils.js.map +1 -1
  68. package/dist/proxy/server.d.ts.map +1 -1
  69. package/dist/proxy/server.js +1 -1
  70. package/dist/proxy/server.js.map +1 -1
  71. package/dist/proxy/session-cache.js +1 -1
  72. package/dist/sdk/api.js +1 -1
  73. package/dist/sdk/connection.js +1 -1
  74. package/dist/sdk/engage.js +1 -1
  75. package/dist/sdk/errors.js +1 -1
  76. package/dist/sdk/index.js +1 -1
  77. package/dist/sdk/job.js +1 -1
  78. package/dist/sdk/llm.js +1 -1
  79. package/dist/sdk/query.js +1 -1
  80. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  81. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  82. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  83. package/dist/sdk/segment.js +1 -1
  84. package/dist/sdk/user.js +1 -1
  85. package/dist/sdk/workflow.js +1 -1
  86. package/dist/types/endpoints.js +1 -1
  87. package/dist/types/index.js +1 -1
  88. package/dist/utils/agent-ref-parser.js +1 -1
  89. package/dist/utils/async.js +1 -1
  90. package/dist/utils/chat-cache.js +1 -1
  91. package/dist/utils/colors.js +1 -1
  92. package/dist/utils/command-output.js +1 -1
  93. package/dist/utils/constants.js +1 -1
  94. package/dist/utils/diff.js +1 -1
  95. package/dist/utils/fields-display.js +1 -1
  96. package/dist/utils/file-permissions.js +1 -1
  97. package/dist/utils/format-detector.js +1 -1
  98. package/dist/utils/formatters.js +1 -1
  99. package/dist/utils/json-loader.js +1 -1
  100. package/dist/utils/llm-backup-utils.js +1 -1
  101. package/dist/utils/model-aliases.js +1 -1
  102. package/dist/utils/model-factors.js +1 -1
  103. package/dist/utils/option-validation.js +1 -1
  104. package/dist/utils/port.js +1 -1
  105. package/dist/utils/process.js +1 -1
  106. package/dist/utils/prompt.js +1 -1
  107. package/dist/utils/segment-path-parser.js +1 -1
  108. package/dist/utils/segment-ref-parser.js +1 -1
  109. package/dist/utils/spinner.js +1 -1
  110. package/dist/utils/sql-parser.js +1 -1
  111. package/dist/utils/sse-parser.js +1 -1
  112. package/dist/utils/string-utils.js +1 -1
  113. package/dist/utils/table-ref-parser.js +1 -1
  114. package/dist/utils/tdx-config.js +1 -1
  115. package/dist/utils/tdx-logger.js +1 -1
  116. package/dist/utils/tree-formatter.js +1 -1
  117. package/dist/utils/version-check.js +1 -1
  118. package/dist/utils/workflow-utils.js +1 -1
  119. package/package.json +1 -1
@@ -1 +1 @@
1
- const a28_0x32031f=a28_0x3338;(function(_0x22f1f9,_0x15e51f){const _0xac4e28=a28_0x3338,_0xa1fd3c=_0x22f1f9();while(!![]){try{const _0x30a25a=parseInt(_0xac4e28(0x1ba))/0x1+-parseInt(_0xac4e28(0x1af))/0x2+-parseInt(_0xac4e28(0x1b6))/0x3+-parseInt(_0xac4e28(0x1a9))/0x4*(parseInt(_0xac4e28(0x1b3))/0x5)+-parseInt(_0xac4e28(0x1ac))/0x6+-parseInt(_0xac4e28(0x1b4))/0x7*(-parseInt(_0xac4e28(0x1a6))/0x8)+parseInt(_0xac4e28(0x1aa))/0x9*(parseInt(_0xac4e28(0x1a7))/0xa);if(_0x30a25a===_0x15e51f)break;else _0xa1fd3c['push'](_0xa1fd3c['shift']());}catch(_0xd260ee){_0xa1fd3c['push'](_0xa1fd3c['shift']());}}}(a28_0x352f,0x29737));import{BaseCommand}from'./command.js';function a28_0x352f(){const _0x6b3c7c=['length','712LHxvkz','8924166BcdhPr','log','1386828sNjILX','error','map','612846JvxZqw','profiles','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','description','6360qicJmx','2415FXVvio','List\x20all\x20available\x20profiles','459912yDJLRX','Error:\x20','name','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','20280shzwRa','config','scope','1744bYoixj','10YSACvH'];a28_0x352f=function(){return _0x6b3c7c;};return a28_0x352f();}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a28_0x3338(_0x28c195,_0x26cb1e){_0x28c195=_0x28c195-0x1a5;const _0x352f9f=a28_0x352f();let _0x3338b2=_0x352f9f[_0x28c195];return _0x3338b2;}import{handleSDKOutput}from'../utils/command-output.js';export class ProfilesCommand extends BaseCommand{[a28_0x32031f(0x1b8)]=a28_0x32031f(0x1b0);[a28_0x32031f(0x1b2)]=a28_0x32031f(0x1b5);async['execute'](_0x1803a2){const _0x27e698=a28_0x32031f,{options:_0x326771}=_0x1803a2;try{const _0x24f5ca=listProfiles(),_0x4659b1=getActiveProfile();if(_0x24f5ca[_0x27e698(0x1a8)]===0x0)return console['log'](_0x27e698(0x1b9)),console[_0x27e698(0x1ab)](_0x27e698(0x1b1)),console[_0x27e698(0x1ab)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x58d118=_0x24f5ca[_0x27e698(0x1ae)](_0x436f8a=>{const _0x54f737=_0x27e698,_0x1a4354=_0x436f8a[_0x54f737(0x1b8)]===_0x4659b1,_0x18f618=getProfileParams(_0x436f8a[_0x54f737(0x1bb)]);return{'name':_0x436f8a[_0x54f737(0x1b8)],'active':_0x1a4354,'scope':_0x436f8a[_0x54f737(0x1a5)],'description':_0x436f8a[_0x54f737(0x1bb)][_0x54f737(0x1b2)]||'','params':_0x18f618};});return await handleSDKOutput(_0x58d118,_0x326771),0x0;}catch(_0x5b3677){return _0x5b3677 instanceof Error&&console[_0x27e698(0x1ad)](_0x27e698(0x1b7)+_0x5b3677['message']),0x1;}}}
1
+ const a28_0x3029da=a28_0x1a81;function a28_0x437d(){const _0x265189=['error','12qlssfs','21CikMHo','1323932NryWXR','15590ujfFoL','log','\x20\x20Global:\x20~/.config/tdx/tdx.json','294IuLFHK','config','3ngzrhb','name','735633iPEGsN','27235aegwlD','1325610UqhMLq','5949VEwScI','4736941kMkikn','scope','profiles','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','message','map','length','description','185624wANgtV'];a28_0x437d=function(){return _0x265189;};return a28_0x437d();}function a28_0x1a81(_0x546aa2,_0x364e45){_0x546aa2=_0x546aa2-0x186;const _0x437d21=a28_0x437d();let _0x1a8116=_0x437d21[_0x546aa2];return _0x1a8116;}(function(_0x204e71,_0x57047e){const _0x470599=a28_0x1a81,_0x54e3bb=_0x204e71();while(!![]){try{const _0x393485=parseInt(_0x470599(0x198))/0x1+parseInt(_0x470599(0x19a))/0x2+-parseInt(_0x470599(0x196))/0x3*(-parseInt(_0x470599(0x190))/0x4)+parseInt(_0x470599(0x199))/0x5*(parseInt(_0x470599(0x194))/0x6)+parseInt(_0x470599(0x18f))/0x7*(parseInt(_0x470599(0x18c))/0x8)+parseInt(_0x470599(0x19b))/0x9*(-parseInt(_0x470599(0x191))/0xa)+parseInt(_0x470599(0x19c))/0xb*(-parseInt(_0x470599(0x18e))/0xc);if(_0x393485===_0x57047e)break;else _0x54e3bb['push'](_0x54e3bb['shift']());}catch(_0x13602b){_0x54e3bb['push'](_0x54e3bb['shift']());}}}(a28_0x437d,0x93a83));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../utils/command-output.js';export class ProfilesCommand extends BaseCommand{[a28_0x3029da(0x197)]=a28_0x3029da(0x186);[a28_0x3029da(0x18b)]='List\x20all\x20available\x20profiles';async['execute'](_0x4476f9){const _0x5d3e40=a28_0x3029da,{options:_0x46a100}=_0x4476f9;try{const _0x434c31=listProfiles(),_0xd0fdfc=getActiveProfile();if(_0x434c31[_0x5d3e40(0x18a)]===0x0)return console['log'](_0x5d3e40(0x187)),console[_0x5d3e40(0x192)]('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console[_0x5d3e40(0x192)](_0x5d3e40(0x193)),0x0;const _0x53b2fc=_0x434c31[_0x5d3e40(0x189)](_0x84a8f2=>{const _0x94331d=_0x5d3e40,_0x1cb5aa=_0x84a8f2[_0x94331d(0x197)]===_0xd0fdfc,_0x3c9113=getProfileParams(_0x84a8f2['config']);return{'name':_0x84a8f2[_0x94331d(0x197)],'active':_0x1cb5aa,'scope':_0x84a8f2[_0x94331d(0x19d)],'description':_0x84a8f2[_0x94331d(0x195)][_0x94331d(0x18b)]||'','params':_0x3c9113};});return await handleSDKOutput(_0x53b2fc,_0x46a100),0x0;}catch(_0x3ae3b4){return _0x3ae3b4 instanceof Error&&console[_0x5d3e40(0x18d)]('Error:\x20'+_0x3ae3b4[_0x5d3e40(0x188)]),0x1;}}}
@@ -1 +1 @@
1
- function a29_0x1603(_0x5c92ed,_0x15b101){_0x5c92ed=_0x5c92ed-0x6b;const _0x73ac50=a29_0x73ac();let _0x16039a=_0x73ac50[_0x5c92ed];return _0x16039a;}const a29_0x18599d=a29_0x1603;(function(_0x3cc838,_0x17e835){const _0x1832a4=a29_0x1603,_0x1429d1=_0x3cc838();while(!![]){try{const _0x53a4ad=-parseInt(_0x1832a4(0x6b))/0x1+parseInt(_0x1832a4(0x99))/0x2*(-parseInt(_0x1832a4(0x75))/0x3)+-parseInt(_0x1832a4(0x71))/0x4*(-parseInt(_0x1832a4(0x9c))/0x5)+parseInt(_0x1832a4(0x8b))/0x6*(parseInt(_0x1832a4(0x80))/0x7)+-parseInt(_0x1832a4(0x97))/0x8+-parseInt(_0x1832a4(0x6e))/0x9+parseInt(_0x1832a4(0x98))/0xa;if(_0x53a4ad===_0x17e835)break;else _0x1429d1['push'](_0x1429d1['shift']());}catch(_0x3b3070){_0x1429d1['push'](_0x1429d1['shift']());}}}(a29_0x73ac,0xe714f));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../utils/command-output.js';import{readSqlStatementsFromFile,splitSqlStatements}from'../utils/sql-parser.js';import{writeFileSync}from'fs';import{withQuerySpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../utils/formatters.js';export class QueryCommand extends BaseCommand{['name']='query';[a29_0x18599d(0x78)]=a29_0x18599d(0x94);async[a29_0x18599d(0x8f)](_0x65fef2){const _0x3750de=a29_0x18599d,{options:_0x36fda4,args:_0x255b2f,tdx:_0x4e02a0}=_0x65fef2,_0x516fdf=_0x255b2f[0x0],_0x22c7b6=_0x36fda4[_0x3750de(0x7c)];let _0x3e7bee;if(_0x22c7b6)try{_0x3e7bee=readSqlStatementsFromFile(_0x22c7b6);}catch(_0x1e140c){return console['error'](_0x3750de(0x86)+_0x1e140c[_0x3750de(0x76)]),0x1;}else try{_0x3e7bee=splitSqlStatements(_0x516fdf);}catch(_0x2b7a89){return console[_0x3750de(0x74)]('Error:\x20'+_0x2b7a89[_0x3750de(0x76)]),0x1;}const _0xb42517=_0x36fda4[_0x3750de(0x79)]||_0x3750de(0x96),_0x3a6b99=_0x36fda4[_0x3750de(0x8e)];try{const _0x5e13d8=[],_0x11bd9d=!!_0x36fda4[_0x3750de(0x87)];for(let _0x2d1c1d=0x0;_0x2d1c1d<_0x3e7bee['length'];_0x2d1c1d++){const _0x4d6033=_0x3e7bee[_0x2d1c1d],_0x3d036a=_0x2d1c1d+0x1,_0x36088a=_0x3e7bee['length'],_0x4756ad=_0x36088a>0x1;_0x36fda4[_0x3750de(0x70)]&&(console[_0x3750de(0x74)]('\x0a'+(_0x4756ad?_0x3750de(0x93)+_0x3d036a+'/'+_0x36088a+':':'')),console['error'](_0x3750de(0x82)+_0x36fda4[_0x3750de(0x95)]),console['error'](_0x3750de(0x72)+(_0x3a6b99||'td')),console[_0x3750de(0x74)]('Schema:\x20'+_0xb42517),console[_0x3750de(0x74)]('SQL:\x20'+_0x4d6033));const _0x750ef8=_0x4756ad?'Executing\x20statement\x20'+_0x3d036a+'/'+_0x36088a+_0x3750de(0x9d):_0x3750de(0x91);try{const _0x25e028=await withQuerySpinner(_0x750ef8,async _0x158c1b=>{const _0x16301c=_0x3750de,_0x4bc9cb=await _0x4e02a0[_0x16301c(0x6f)][_0x16301c(0x8f)](_0x4d6033,{'catalog':_0x3a6b99,'schema':_0xb42517,'onJobId':_0x179792=>{const _0x3e0377=_0x16301c;_0x158c1b[_0x3e0377(0x8a)](_0x179792);},'onProgress':_0x50ff93=>{const _0x2bad12=_0x16301c;_0x158c1b[_0x2bad12(0x73)]('Executing\x20query\x20['+_0x50ff93[_0x2bad12(0x7f)]+']'),_0x158c1b[_0x2bad12(0x9a)](formatRows(_0x50ff93[_0x2bad12(0x7d)])+_0x2bad12(0x81)+_0x50ff93[_0x2bad12(0x7e)]+'/'+_0x50ff93['totalSplits']+_0x2bad12(0x8d));}});return _0x4bc9cb;},{'verbose':_0x36fda4[_0x3750de(0x70)]}),_0x2b440b=_0x25e028['data'],_0x4d46d8=_0x2b440b[_0x3750de(0x6d)]?_0x3750de(0x85)+_0x2b440b[_0x3750de(0x6d)]+']':'',_0x2149bd=_0x4756ad?_0x3750de(0x93)+_0x3d036a+'/'+_0x36088a+_0x3750de(0x84):'';console[_0x3750de(0x74)]('✔\x20'+_0x2149bd+_0x3750de(0x6c)+formatRows(_0x2b440b[_0x3750de(0x7a)][_0x3750de(0x7d)])+_0x3750de(0x81)+(_0x3750de(0x83)+formatElapsed(_0x2b440b[_0x3750de(0x7a)][_0x3750de(0x77)])+_0x4d46d8));if(_0x4756ad&&_0x11bd9d){const _0x2d5496=resolveOutputOptions(_0x36fda4),_0x133eb1=await formatQueryOutput(_0x2b440b,_0x2d5496);_0x5e13d8[_0x3750de(0x88)](_0x133eb1);}else await handleQueryOutput(_0x2b440b,_0x36fda4);}catch(_0x302d66){const _0x3586c3=_0x4756ad?'Statement\x20'+_0x3d036a+'/'+_0x36088a+':\x0a':'',_0x4f72a9=_0x302d66 instanceof SDKError?_0x302d66['originalMessage']:_0x302d66[_0x3750de(0x76)];return console[_0x3750de(0x74)](''+_0x3586c3+_0x4f72a9),0x1;}}if(_0x3e7bee[_0x3750de(0x90)]>0x1&&_0x11bd9d&&_0x5e13d8[_0x3750de(0x90)]>0x0){const _0x1e4e9a=_0x5e13d8[_0x3750de(0x7b)]('\x0a');writeFileSync(_0x36fda4['output'],_0x1e4e9a),console[_0x3750de(0x74)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x36fda4[_0x3750de(0x87)]);}return 0x0;}catch(_0x3e3f1b){throw _0x3e3f1b;}}['validate'](_0x488e5f){const _0x5cc468=a29_0x18599d,_0x468943=_0x488e5f[_0x5cc468(0x8c)][0x0],_0x848f24=_0x488e5f[_0x5cc468(0x89)][_0x5cc468(0x7c)];if(!_0x468943&&!_0x848f24)return _0x5cc468(0x92);if(_0x468943&&_0x848f24)return _0x5cc468(0x9b);return undefined;}}function a29_0x73ac(){const _0x368b0b=['Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','5DqWjuW','...','218148nVNWpB','Query\x20completed:\x20Processed\x20','jobId','2585106xyRgbK','query','verbose','541932gUtOoT','Catalog:\x20','setPhase','error','1431351dTnwag','message','elapsedTimeMillis','description','database','stats','join','file','processedRows','completedSplits','state','7QNYnSK','\x20rows\x20','Site:\x20','in\x20','\x20-\x20','\x20[Job\x20ID:\x20','Error:\x20','output','push','options','setJobId','9306294ogUiuT','args','\x20splits','catalog','execute','length','Executing\x20query...','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20--file\x20query.sql\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','Statement\x20','Run\x20Trino\x20queries\x20(streaming)','site','information_schema','6115048FwtRqy','10068590mEGLMP','2YqoAFl','setExtra'];a29_0x73ac=function(){return _0x368b0b;};return a29_0x73ac();}
1
+ const a29_0x182567=a29_0x1a07;(function(_0x779976,_0x169155){const _0x2764af=a29_0x1a07,_0x282453=_0x779976();while(!![]){try{const _0x2016dd=parseInt(_0x2764af(0xc8))/0x1+parseInt(_0x2764af(0xb8))/0x2*(parseInt(_0x2764af(0xc2))/0x3)+parseInt(_0x2764af(0xa9))/0x4+parseInt(_0x2764af(0xc4))/0x5*(parseInt(_0x2764af(0xce))/0x6)+parseInt(_0x2764af(0xcd))/0x7+parseInt(_0x2764af(0xaa))/0x8+-parseInt(_0x2764af(0xc0))/0x9;if(_0x2016dd===_0x169155)break;else _0x282453['push'](_0x282453['shift']());}catch(_0x54620d){_0x282453['push'](_0x282453['shift']());}}}(a29_0x78ce,0x8408b));function a29_0x78ce(){const _0x11ff08=['database','push','setExtra','Run\x20Trino\x20queries\x20(streaming)','setJobId','processedRows','state','error','in\x20','2926664FDWrzC','7910384ChUcFy','execute','jobId','Statement\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','stats','query','Executing\x20statement\x20','Executing\x20query\x20[','options','output','\x20rows\x20','Query\x20completed:\x20Processed\x20','Site:\x20','1659106XRZosy','data','\x20splits','description','SQL:\x20','file','setPhase','message','32921577JzEizL','...','3aNaqot','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20--file\x20query.sql\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','5UaiFbZ','validate','Error:\x20','name','600424QeVnbP','elapsedTimeMillis','information_schema','length','originalMessage','5733945NBjfAv','1375128xPqWcB','join','\x20[Job\x20ID:\x20','Catalog:\x20','args','\x20-\x20','verbose'];a29_0x78ce=function(){return _0x11ff08;};return a29_0x78ce();}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../utils/command-output.js';import{readSqlStatementsFromFile,splitSqlStatements}from'../utils/sql-parser.js';import{writeFileSync}from'fs';import{withQuerySpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../utils/formatters.js';function a29_0x1a07(_0x333dcc,_0x331bb8){_0x333dcc=_0x333dcc-0xa4;const _0x78ceb1=a29_0x78ce();let _0x1a07d6=_0x78ceb1[_0x333dcc];return _0x1a07d6;}export class QueryCommand extends BaseCommand{[a29_0x182567(0xc7)]='query';[a29_0x182567(0xbb)]=a29_0x182567(0xd8);async[a29_0x182567(0xab)](_0x3a6586){const _0x3e0e12=a29_0x182567,{options:_0xf7b84a,args:_0x2dcddc,tdx:_0x34f32b}=_0x3a6586,_0x53ffe4=_0x2dcddc[0x0],_0x248c2a=_0xf7b84a[_0x3e0e12(0xbd)];let _0x131ca3;if(_0x248c2a)try{_0x131ca3=readSqlStatementsFromFile(_0x248c2a);}catch(_0x44ba43){return console['error'](_0x3e0e12(0xc6)+_0x44ba43['message']),0x1;}else try{_0x131ca3=splitSqlStatements(_0x53ffe4);}catch(_0x20fcd5){return console['error'](_0x3e0e12(0xc6)+_0x20fcd5[_0x3e0e12(0xbf)]),0x1;}const _0x370bcc=_0xf7b84a[_0x3e0e12(0xd5)]||_0x3e0e12(0xca),_0x949de8=_0xf7b84a['catalog'];try{const _0x3f5f1d=[],_0x54edfa=!!_0xf7b84a[_0x3e0e12(0xb4)];for(let _0x37c404=0x0;_0x37c404<_0x131ca3[_0x3e0e12(0xcb)];_0x37c404++){const _0x3c1de9=_0x131ca3[_0x37c404],_0x35ced4=_0x37c404+0x1,_0x4342f7=_0x131ca3[_0x3e0e12(0xcb)],_0x5b67f4=_0x4342f7>0x1;_0xf7b84a[_0x3e0e12(0xd4)]&&(console['error']('\x0a'+(_0x5b67f4?_0x3e0e12(0xad)+_0x35ced4+'/'+_0x4342f7+':':'')),console['error'](_0x3e0e12(0xb7)+_0xf7b84a['site']),console['error'](_0x3e0e12(0xd1)+(_0x949de8||'td')),console[_0x3e0e12(0xa7)]('Schema:\x20'+_0x370bcc),console['error'](_0x3e0e12(0xbc)+_0x3c1de9));const _0x1f352f=_0x5b67f4?_0x3e0e12(0xb1)+_0x35ced4+'/'+_0x4342f7+_0x3e0e12(0xc1):'Executing\x20query...';try{const _0x182ed1=await withQuerySpinner(_0x1f352f,async _0x193922=>{const _0x23389a=_0x3e0e12,_0x119581=await _0x34f32b[_0x23389a(0xb0)][_0x23389a(0xab)](_0x3c1de9,{'catalog':_0x949de8,'schema':_0x370bcc,'onJobId':_0x1c5de4=>{const _0x4277ae=_0x23389a;_0x193922[_0x4277ae(0xa4)](_0x1c5de4);},'onProgress':_0x28f321=>{const _0x1ab76c=_0x23389a;_0x193922[_0x1ab76c(0xbe)](_0x1ab76c(0xb2)+_0x28f321[_0x1ab76c(0xa6)]+']'),_0x193922[_0x1ab76c(0xd7)](formatRows(_0x28f321[_0x1ab76c(0xa5)])+_0x1ab76c(0xb5)+_0x28f321['completedSplits']+'/'+_0x28f321['totalSplits']+_0x1ab76c(0xba));}});return _0x119581;},{'verbose':_0xf7b84a[_0x3e0e12(0xd4)]}),_0x393ce1=_0x182ed1[_0x3e0e12(0xb9)],_0x5d3f71=_0x393ce1['jobId']?_0x3e0e12(0xd0)+_0x393ce1[_0x3e0e12(0xac)]+']':'',_0x2b1c31=_0x5b67f4?'Statement\x20'+_0x35ced4+'/'+_0x4342f7+_0x3e0e12(0xd3):'';console[_0x3e0e12(0xa7)]('✔\x20'+_0x2b1c31+_0x3e0e12(0xb6)+formatRows(_0x393ce1[_0x3e0e12(0xaf)]['processedRows'])+_0x3e0e12(0xb5)+(_0x3e0e12(0xa8)+formatElapsed(_0x393ce1[_0x3e0e12(0xaf)][_0x3e0e12(0xc9)])+_0x5d3f71));if(_0x5b67f4&&_0x54edfa){const _0x18d0f2=resolveOutputOptions(_0xf7b84a),_0x3fd37a=await formatQueryOutput(_0x393ce1,_0x18d0f2);_0x3f5f1d[_0x3e0e12(0xd6)](_0x3fd37a);}else await handleQueryOutput(_0x393ce1,_0xf7b84a);}catch(_0x462edc){const _0x309e78=_0x5b67f4?_0x3e0e12(0xad)+_0x35ced4+'/'+_0x4342f7+':\x0a':'',_0x13be55=_0x462edc instanceof SDKError?_0x462edc[_0x3e0e12(0xcc)]:_0x462edc[_0x3e0e12(0xbf)];return console[_0x3e0e12(0xa7)](''+_0x309e78+_0x13be55),0x1;}}if(_0x131ca3[_0x3e0e12(0xcb)]>0x1&&_0x54edfa&&_0x3f5f1d[_0x3e0e12(0xcb)]>0x0){const _0x480da8=_0x3f5f1d[_0x3e0e12(0xcf)]('\x0a');writeFileSync(_0xf7b84a['output'],_0x480da8),console[_0x3e0e12(0xa7)]('\x0aAll\x20results\x20saved\x20to\x20'+_0xf7b84a['output']);}return 0x0;}catch(_0x443a7c){throw _0x443a7c;}}[a29_0x182567(0xc5)](_0x4e68a8){const _0x4b68dc=a29_0x182567,_0x37268d=_0x4e68a8[_0x4b68dc(0xd2)][0x0],_0x462398=_0x4e68a8[_0x4b68dc(0xb3)][_0x4b68dc(0xbd)];if(!_0x37268d&&!_0x462398)return _0x4b68dc(0xc3);if(_0x37268d&&_0x462398)return _0x4b68dc(0xae);return undefined;}}
@@ -1 +1 @@
1
- const a30_0x3e9567=a30_0x42fe;(function(_0x1cd220,_0x20f7e9){const _0x1a33cd=a30_0x42fe,_0x44eb33=_0x1cd220();while(!![]){try{const _0x2085eb=parseInt(_0x1a33cd(0x101))/0x1+parseInt(_0x1a33cd(0xb7))/0x2*(parseInt(_0x1a33cd(0xfa))/0x3)+parseInt(_0x1a33cd(0xa1))/0x4+parseInt(_0x1a33cd(0xf8))/0x5+-parseInt(_0x1a33cd(0x109))/0x6+parseInt(_0x1a33cd(0xdb))/0x7*(parseInt(_0x1a33cd(0xc7))/0x8)+-parseInt(_0x1a33cd(0xa3))/0x9;if(_0x2085eb===_0x20f7e9)break;else _0x44eb33['push'](_0x44eb33['shift']());}catch(_0x1089ea){_0x44eb33['push'](_0x44eb33['shift']());}}}(a30_0x3748,0x6f672));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner,withQuerySpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../utils/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import{executeSchemaQuery}from'../utils/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../utils/segment-path-parser.js';function resolveSegmentTarget(_0x3403f0,_0x27bd5d,_0xbf847c){const _0x47584f=a30_0x42fe;if(isYamlFilePath(_0x3403f0))try{const _0x3b9aa8=resolveYamlFilePath(_0x3403f0);return _0xbf847c&&(console[_0x47584f(0xda)](_0x47584f(0xfd)+_0x3403f0),console[_0x47584f(0xda)]('\x20\x20Parent\x20segment:\x20'+_0x3b9aa8[_0x47584f(0xd9)]),console['error']('\x20\x20Segment\x20name:\x20'+_0x3b9aa8['segmentName']),console['error'](_0x47584f(0xff)+(_0x3b9aa8[_0x47584f(0x125)]||_0x47584f(0xf9))),console[_0x47584f(0xda)](_0x47584f(0x11a)+_0x3b9aa8[_0x47584f(0xa0)])),_0x3b9aa8['fullPath'];}catch(_0x4d0399){throw new SDKError(ErrorCode[_0x47584f(0x9e)],_0x47584f(0x121)+_0x4d0399[_0x47584f(0x100)]);}if(!_0x27bd5d)throw new SDKError(ErrorCode[_0x47584f(0x9e)],_0x47584f(0xd0));return _0x27bd5d+'/'+_0x3403f0;}export class SegmentDescribeCommand extends BaseCommand{[a30_0x3e9567(0xfc)]=a30_0x3e9567(0x11f);[a30_0x3e9567(0xeb)]=a30_0x3e9567(0xdc);async['execute'](_0x26ad99){const _0x4ec9a0=a30_0x3e9567,{options:_0x45a091,args:_0x2ccece,tdx:_0x1b596b}=_0x26ad99,_0x53f211=_0x2ccece[0x0],_0x2146c9=!_0x53f211&&!!_0x45a091['parentSegment'],_0xe731c7=_0x53f211||_0x45a091['parentSegment'];if(!_0xe731c7)return console[_0x4ec9a0(0xda)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console[_0x4ec9a0(0xda)](_0x4ec9a0(0x9f)),console[_0x4ec9a0(0xda)]('Examples:'),console[_0x4ec9a0(0xda)](_0x4ec9a0(0xe7)),console[_0x4ec9a0(0xda)](_0x4ec9a0(0xd2)),console[_0x4ec9a0(0xda)](_0x4ec9a0(0x120)),console['error']('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0x59b3c2=_0x45a091[_0x4ec9a0(0xfe)];let _0x210772=_0xe731c7;!_0x2146c9&&_0x59b3c2&&!_0xe731c7['includes']('/')&&(_0x210772=_0x59b3c2+'/'+_0xe731c7,_0x45a091[_0x4ec9a0(0xe6)]&&console[_0x4ec9a0(0xda)](_0x4ec9a0(0xf6)+_0x210772));const _0x5350c9=await withSpinner(_0x4ec9a0(0xb3)+_0x210772+_0x4ec9a0(0x10b),()=>_0x1b596b[_0x4ec9a0(0xad)][_0x4ec9a0(0xbe)](_0x210772),{'verbose':_0x45a091[_0x4ec9a0(0xe6)]}),_0x244335=_0x5350c9[_0x4ec9a0(0xa7)];_0x45a091[_0x4ec9a0(0xe6)]&&(console[_0x4ec9a0(0xda)](_0x4ec9a0(0xe2)+_0x244335[_0x4ec9a0(0xac)]),console['error'](_0x4ec9a0(0xa8)+_0x244335[_0x4ec9a0(0x104)]),_0x244335[_0x4ec9a0(0xb4)]&&console[_0x4ec9a0(0xda)]('Folder\x20ID:\x20'+_0x244335[_0x4ec9a0(0xb4)]),_0x244335[_0x4ec9a0(0xe4)]&&console[_0x4ec9a0(0xda)](_0x4ec9a0(0xc9)+_0x244335[_0x4ec9a0(0xe4)]));if(_0x244335[_0x4ec9a0(0xac)]===_0x4ec9a0(0xbc)){const _0x307d07=await withSpinner(_0x4ec9a0(0xea),()=>_0x1b596b[_0x4ec9a0(0xad)][_0x4ec9a0(0xaa)](_0x244335[_0x4ec9a0(0x104)]),{'verbose':_0x45a091[_0x4ec9a0(0xe6)]});await handleSingleObjectOutput(_0x307d07['data'],_0x45a091);}else{if(_0x244335['type']===_0x4ec9a0(0xf4)){if(!_0x244335[_0x4ec9a0(0xb4)])throw new SDKError(ErrorCode[_0x4ec9a0(0xb8)],_0x4ec9a0(0x118));const _0x584a69=await withSpinner(_0x4ec9a0(0xb9),()=>_0x1b596b[_0x4ec9a0(0xad)][_0x4ec9a0(0xab)](_0x244335[_0x4ec9a0(0xb4)]),{'verbose':_0x45a091[_0x4ec9a0(0xe6)]});await handleSingleObjectOutput(_0x584a69[_0x4ec9a0(0xa7)],_0x45a091);}else{if(_0x244335[_0x4ec9a0(0xac)]==='segment'){if(!_0x244335[_0x4ec9a0(0xe4)])throw new SDKError(ErrorCode[_0x4ec9a0(0xef)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x2101fd=await withSpinner('Fetching\x20segment\x20details...',()=>_0x1b596b[_0x4ec9a0(0xad)]['getSegment'](_0x244335[_0x4ec9a0(0x104)],_0x244335[_0x4ec9a0(0xe4)]),{'verbose':_0x45a091[_0x4ec9a0(0xe6)]});await handleSingleObjectOutput(_0x2101fd['data'],_0x45a091);}}}return 0x0;}catch(_0x43c82b){if(_0x43c82b instanceof SDKError)return console[_0x4ec9a0(0xda)]('Error:\x20'+_0x43c82b[_0x4ec9a0(0x100)]),_0x43c82b[_0x4ec9a0(0xce)]&&console[_0x4ec9a0(0xda)]('\x20\x20Cause:\x20'+_0x43c82b[_0x4ec9a0(0xce)]),0x1;throw _0x43c82b;}}}export class SegmentShowCommand extends BaseCommand{['name']=a30_0x3e9567(0xa5);[a30_0x3e9567(0xeb)]=a30_0x3e9567(0x115);async[a30_0x3e9567(0x9d)](_0x484b69){const _0x33d53f=a30_0x3e9567,{options:_0x546dc7,args:_0x5687de,tdx:_0xa575d6}=_0x484b69,_0x542872=_0x5687de[0x0];if(!_0x542872)return console[_0x33d53f(0xda)](_0x33d53f(0xbb)),console['error'](_0x33d53f(0xd4)),console[_0x33d53f(0xda)](_0x33d53f(0xbd)),console[_0x33d53f(0xda)]('Examples:'),console[_0x33d53f(0xda)]('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console['error'](_0x33d53f(0x119)),0x1;try{const _0x8ae4b0=_0x546dc7[_0x33d53f(0xd9)],_0x198ad1=resolveSegmentTarget(_0x542872,_0x8ae4b0,_0x546dc7['verbose']);_0x546dc7[_0x33d53f(0xe6)]&&console[_0x33d53f(0xda)]('Target\x20path:\x20'+_0x198ad1);const _0x5d672e=await withSpinner('Resolving\x20\x27'+_0x542872+_0x33d53f(0x10b),()=>_0xa575d6[_0x33d53f(0xad)][_0x33d53f(0xbe)](_0x198ad1),{'verbose':_0x546dc7[_0x33d53f(0xe6)]}),_0x41c395=_0x5d672e[_0x33d53f(0xa7)];_0x546dc7['verbose']&&(console['error'](_0x33d53f(0xe2)+_0x41c395[_0x33d53f(0xac)]),console[_0x33d53f(0xda)](_0x33d53f(0xa8)+_0x41c395[_0x33d53f(0x104)]));if(_0x41c395[_0x33d53f(0xac)]===_0x33d53f(0xf4))return console[_0x33d53f(0xda)](_0x33d53f(0xd1)),console[_0x33d53f(0xda)](_0x33d53f(0xf5)),0x1;if(_0x41c395[_0x33d53f(0xac)]==='parent')return console[_0x33d53f(0xda)](_0x33d53f(0xb6)),console[_0x33d53f(0xda)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x41c395[_0x33d53f(0xe4)])throw new SDKError(ErrorCode[_0x33d53f(0xef)],_0x33d53f(0xee));const _0x527cb4=await withSpinner(_0x33d53f(0xae),()=>_0xa575d6[_0x33d53f(0xad)][_0x33d53f(0xaf)](_0x41c395[_0x33d53f(0x104)],_0x41c395['segmentId']),{'verbose':_0x546dc7[_0x33d53f(0xe6)]});let _0x3e1b44=_0x527cb4[_0x33d53f(0xa7)];const _0x150c8d=resolveLimit(_0x546dc7[_0x33d53f(0xba)],DEFAULT_DISPLAY_LIMIT),_0x573032=/\bLIMIT\s+\d+/i[_0x33d53f(0xb0)](_0x3e1b44);!_0x573032&&(_0x3e1b44=_0x3e1b44[_0x33d53f(0x9b)]()[_0x33d53f(0xe3)](/;+$/,''),_0x3e1b44=_0x33d53f(0xcd)+_0x3e1b44+_0x33d53f(0xd8)+_0x150c8d);_0x546dc7['verbose']&&console['error'](_0x33d53f(0xe8)+_0x3e1b44);const _0x1f23e1=await withQuerySpinner('Executing\x20segment\x20query...',async _0x45fc73=>{const _0x1b9e92=_0x33d53f,_0x1e4eb8=await _0xa575d6['query'][_0x1b9e92(0x9d)](_0x3e1b44,{'catalog':'td','schema':'information_schema','onJobId':_0x125565=>{const _0x14d08f=_0x1b9e92;_0x45fc73[_0x14d08f(0x127)](_0x125565);}});return _0x1e4eb8;},{'verbose':_0x546dc7[_0x33d53f(0xe6)]}),_0x515c1c=_0x1f23e1[_0x33d53f(0xa7)],_0x22d910=_0x515c1c[_0x33d53f(0xcc)]?_0x33d53f(0x10e)+_0x515c1c['jobId']+']':'';return console['error'](_0x33d53f(0x112)+_0x515c1c[_0x33d53f(0xc4)]['processedRows']['toLocaleString']()+_0x33d53f(0xc2)+(_0x33d53f(0xfb)+formatElapsed(_0x515c1c[_0x33d53f(0xc4)][_0x33d53f(0xcf)])+_0x22d910)),await handleQueryOutput(_0x515c1c,_0x546dc7),0x0;}catch(_0x44aaa1){if(_0x44aaa1 instanceof SDKError)return console[_0x33d53f(0xda)]('✖\x20Query\x20failed\x20['+_0x44aaa1[_0x33d53f(0xcb)]+']'),console[_0x33d53f(0xda)]('\x0a'+_0x44aaa1['message']),0x1;throw _0x44aaa1;}}}export class SegmentFolderListCommand extends BaseCommand{[a30_0x3e9567(0xfc)]='segment:folder:list';[a30_0x3e9567(0xeb)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a30_0x3e9567(0x9d)](_0x25ad16){const _0x4cedea=a30_0x3e9567,{options:_0x359ff1,args:_0x4540ca,tdx:_0x9efcbc}=_0x25ad16;if(_0x4540ca[_0x4cedea(0xc1)]===0x0)return console[_0x4cedea(0xda)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x4cedea(0xda)](_0x4cedea(0xd3)),0x1;const _0x2c3a3a=_0x4540ca[0x0];try{_0x359ff1[_0x4cedea(0xe6)]&&(console[_0x4cedea(0xda)](_0x4cedea(0xa9)+_0x359ff1['site']),console[_0x4cedea(0xda)](_0x4cedea(0x126)+_0x2c3a3a));const _0x1e3a52=await withSpinner(_0x4cedea(0xd7)+_0x2c3a3a+'\x27...',()=>_0x9efcbc[_0x4cedea(0xad)][_0x4cedea(0xc5)](_0x2c3a3a),{'verbose':_0x359ff1[_0x4cedea(0xe6)]}),_0x55133c=_0x1e3a52['data'];_0x359ff1['verbose']&&console[_0x4cedea(0xda)](_0x4cedea(0x10f)+_0x55133c);const _0x9efeaf=await withSpinner(_0x4cedea(0x110)+_0x2c3a3a+_0x4cedea(0x10b),()=>_0x9efcbc['segment'][_0x4cedea(0x122)](_0x55133c),{'verbose':_0x359ff1[_0x4cedea(0xe6)]}),_0x325470=_0x9efeaf[_0x4cedea(0xa7)];return console['error'](_0x4cedea(0xf7)+_0x325470['length']+_0x4cedea(0xb2)+(_0x325470[_0x4cedea(0xc1)]!==0x1?'s':'')),await handleSDKOutput(_0x325470,_0x359ff1),0x0;}catch(_0x2539a4){if(_0x2539a4 instanceof SDKError)return console[_0x4cedea(0xda)](_0x4cedea(0xde)+_0x2539a4['message']),_0x2539a4[_0x4cedea(0xce)]&&console[_0x4cedea(0xda)](_0x4cedea(0xf0)+_0x2539a4[_0x4cedea(0xce)]),0x1;throw _0x2539a4;}}}export class SegmentFolderShowCommand extends BaseCommand{[a30_0x3e9567(0xfc)]='segment:folder:show';[a30_0x3e9567(0xeb)]=a30_0x3e9567(0xed);async[a30_0x3e9567(0x9d)](_0x1867f9){const _0x25ba1e=a30_0x3e9567,{options:_0x2d9e5b,args:_0x2d0988,tdx:_0x16603f}=_0x1867f9;if(_0x2d0988[_0x25ba1e(0xc1)]===0x0)return console[_0x25ba1e(0xda)](_0x25ba1e(0x10a)),console[_0x25ba1e(0xda)](_0x25ba1e(0xd6)),0x1;try{const {parentId:_0x2517ed,childId:_0x4fbda4}=parseSegmentRef(_0x2d0988[0x0]);_0x2d9e5b[_0x25ba1e(0xe6)]&&(console['error'](_0x25ba1e(0xa9)+_0x2d9e5b[_0x25ba1e(0x108)]),console[_0x25ba1e(0xda)](_0x25ba1e(0x126)+_0x2517ed),_0x4fbda4&&console['error'](_0x25ba1e(0x107)+_0x4fbda4));if(!_0x4fbda4)return console[_0x25ba1e(0xda)](_0x25ba1e(0x11b)),0x1;const _0x410233=await withSpinner(_0x25ba1e(0xd7)+_0x2517ed+_0x25ba1e(0x10b),()=>_0x16603f[_0x25ba1e(0xad)][_0x25ba1e(0xc5)](_0x2517ed),{'verbose':_0x2d9e5b[_0x25ba1e(0xe6)]}),_0xbb64c0=_0x410233[_0x25ba1e(0xa7)];_0x2d9e5b[_0x25ba1e(0xe6)]&&console[_0x25ba1e(0xda)](_0x25ba1e(0x10f)+_0xbb64c0);const _0x1ca417=await withSpinner('Resolving\x20folder\x20\x27'+_0x4fbda4+'\x27...',()=>_0x16603f[_0x25ba1e(0xad)][_0x25ba1e(0xca)](_0xbb64c0,_0x4fbda4),{'verbose':_0x2d9e5b[_0x25ba1e(0xe6)]}),_0x50ec89=_0x1ca417[_0x25ba1e(0xa7)];_0x2d9e5b[_0x25ba1e(0xe6)]&&console[_0x25ba1e(0xda)]('Resolved\x20folder\x20ID:\x20'+_0x50ec89);const _0x2b53d1=await withSpinner('Fetching\x20folder\x20\x27'+_0x4fbda4+'\x27...',()=>_0x16603f[_0x25ba1e(0xad)]['getFolder'](_0x50ec89),{'verbose':_0x2d9e5b[_0x25ba1e(0xe6)]});return await handleSDKOutput([_0x2b53d1[_0x25ba1e(0xa7)]],_0x2d9e5b),0x0;}catch(_0x4285a7){if(_0x4285a7 instanceof SDKError)return console[_0x25ba1e(0xda)](_0x25ba1e(0xde)+_0x4285a7[_0x25ba1e(0x100)]),_0x4285a7[_0x25ba1e(0xce)]&&console[_0x25ba1e(0xda)]('\x20\x20Cause:\x20'+_0x4285a7[_0x25ba1e(0xce)]),0x1;throw _0x4285a7;}}}export class SegmentSQLCommand extends BaseCommand{[a30_0x3e9567(0xfc)]='segment:sql';[a30_0x3e9567(0xeb)]='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a30_0x3e9567(0x9d)](_0x1401eb){const _0x34e669=a30_0x3e9567,{options:_0x46ac47,args:_0x2fc2b3,tdx:_0xefd928}=_0x1401eb,_0xe37ece=_0x2fc2b3[0x0];if(!_0xe37ece)return console[_0x34e669(0xda)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x34e669(0xda)](_0x34e669(0xdd)),console[_0x34e669(0xda)](_0x34e669(0x114)),console[_0x34e669(0xda)]('Examples:'),console[_0x34e669(0xda)](_0x34e669(0x103)),console[_0x34e669(0xda)](_0x34e669(0xc8)),0x1;try{const _0x46769a=_0x46ac47[_0x34e669(0xd9)],_0x3b06f5=resolveSegmentTarget(_0xe37ece,_0x46769a,_0x46ac47['verbose']);_0x46ac47[_0x34e669(0xe6)]&&console[_0x34e669(0xda)]('Target\x20path:\x20'+_0x3b06f5);const _0x444671=await withSpinner(_0x34e669(0xe0)+_0xe37ece+_0x34e669(0x10b),()=>_0xefd928['segment'][_0x34e669(0xbe)](_0x3b06f5),{'verbose':_0x46ac47[_0x34e669(0xe6)]}),_0x41e446=_0x444671[_0x34e669(0xa7)];_0x46ac47[_0x34e669(0xe6)]&&(console['error'](_0x34e669(0xe2)+_0x41e446[_0x34e669(0xac)]),console['error'](_0x34e669(0xa8)+_0x41e446[_0x34e669(0x104)]));if(_0x41e446[_0x34e669(0xac)]===_0x34e669(0xf4))return console[_0x34e669(0xda)](_0x34e669(0xc6)),console['error'](_0x34e669(0x11d)),0x1;if(_0x41e446[_0x34e669(0xac)]===_0x34e669(0xbc))return console[_0x34e669(0xda)](_0x34e669(0x111)),console['error'](_0x34e669(0xec)),0x1;if(!_0x41e446['segmentId'])throw new SDKError(ErrorCode[_0x34e669(0xef)],_0x34e669(0xee));const _0x4900e6=await withSpinner(_0x34e669(0xae),()=>_0xefd928[_0x34e669(0xad)][_0x34e669(0xaf)](_0x41e446['parentId'],_0x41e446['segmentId']),{'verbose':_0x46ac47[_0x34e669(0xe6)]}),_0x11f5a5=_0x4900e6[_0x34e669(0xa7)];return _0x46ac47[_0x34e669(0xe9)]===_0x34e669(0xa4)||_0x46ac47[_0x34e669(0xe9)]===_0x34e669(0xdf)?await handleSDKOutput([{'sql':_0x11f5a5}],_0x46ac47):console[_0x34e669(0xa6)](_0x11f5a5),0x0;}catch(_0x56705f){if(_0x56705f instanceof SDKError)return console[_0x34e669(0xda)](_0x34e669(0xde)+_0x56705f[_0x34e669(0x100)]),_0x56705f[_0x34e669(0xce)]&&console[_0x34e669(0xda)](_0x34e669(0xf0)+_0x56705f['cause']),0x1;throw _0x56705f;}}}export class SegmentFolderCreateCommand extends BaseCommand{['name']=a30_0x3e9567(0xc3);[a30_0x3e9567(0xeb)]='Create\x20segment\x20folder\x20for\x20organization';async[a30_0x3e9567(0x9d)](_0x2fec5d){const _0x294ac3=a30_0x3e9567,{options:_0x81e532,args:_0x51b4b3,tdx:_0x1f37fa}=_0x2fec5d,_0x2aff3c=_0x81e532;if(_0x51b4b3[_0x294ac3(0xc1)]<0x2)return console[_0x294ac3(0xda)](_0x294ac3(0xbf)),console[_0x294ac3(0xda)](_0x294ac3(0x102)),0x1;const _0x6eb922=_0x51b4b3[0x0],_0x4711a3=_0x51b4b3[0x1];_0x2aff3c[_0x294ac3(0xe6)]&&(console['error'](_0x294ac3(0xa9)+_0x2aff3c[_0x294ac3(0x108)]),console[_0x294ac3(0xda)](_0x294ac3(0x116)+_0x6eb922),console[_0x294ac3(0xda)]('Folder\x20name:\x20'+_0x4711a3));let _0x2d1de0;if(_0x2aff3c[_0x294ac3(0x105)]){const _0x47c359=_0x2aff3c[_0x294ac3(0x105)],_0x43d5ed=await withSpinner(_0x294ac3(0xd7)+_0x6eb922+_0x294ac3(0x10b),()=>_0x1f37fa[_0x294ac3(0xad)]['resolveParentId'](_0x6eb922),{'verbose':_0x2aff3c[_0x294ac3(0xe6)]}),_0x36aca1=_0x43d5ed[_0x294ac3(0xa7)],_0xe3c9ec=await withSpinner(_0x294ac3(0x11e)+_0x47c359+_0x294ac3(0x10b),()=>_0x1f37fa[_0x294ac3(0xad)][_0x294ac3(0xca)](_0x36aca1,_0x47c359),{'verbose':_0x2aff3c[_0x294ac3(0xe6)]});_0x2d1de0=_0xe3c9ec[_0x294ac3(0xa7)],_0x2aff3c[_0x294ac3(0xe6)]&&console['error'](_0x294ac3(0x9c)+_0x2d1de0);}const _0x389859={'name':_0x4711a3,'description':_0x2aff3c[_0x294ac3(0xeb)],'parentFolderId':_0x2d1de0},_0x405b55=await withSpinner(_0x294ac3(0x10d)+_0x4711a3+_0x294ac3(0x10b),()=>_0x1f37fa[_0x294ac3(0xad)]['createFolder'](_0x6eb922,_0x389859),{'verbose':_0x2aff3c[_0x294ac3(0xe6)]}),_0x50fbda=_0x405b55[_0x294ac3(0xa7)];return console[_0x294ac3(0xda)](_0x294ac3(0x106)+_0x50fbda[_0x294ac3(0xfc)]+_0x294ac3(0x128)+_0x50fbda['id']),await handleSDKOutput([_0x50fbda],_0x2aff3c),0x0;}}export class SegmentViewCommand extends BaseCommand{[a30_0x3e9567(0xfc)]=a30_0x3e9567(0x11c);['description']=a30_0x3e9567(0xa2);async[a30_0x3e9567(0x9d)](_0x39e4e5){const _0x21e1f6=a30_0x3e9567,{options:_0x3679e1,args:_0x4dcbfc,tdx:_0x1ea7d2}=_0x39e4e5,_0xccb102=_0x4dcbfc[0x0];if(!_0xccb102)return console[_0x21e1f6(0xda)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x21e1f6(0xda)]('Usage:\x20tdx\x20sg\x20view\x20<name>'),console[_0x21e1f6(0xda)](_0x21e1f6(0x124)),console['error']('Examples:'),console['error'](_0x21e1f6(0xe1)),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x21e1f6(0xda)](_0x21e1f6(0x123)),0x1;try{const _0x47429f=_0x3679e1['parentSegment'],_0x7a981a=resolveSegmentTarget(_0xccb102,_0x47429f,_0x3679e1[_0x21e1f6(0xe6)]);_0x3679e1[_0x21e1f6(0xe6)]&&console[_0x21e1f6(0xda)]('Target\x20path:\x20'+_0x7a981a);const _0x2b58bf=await withSpinner(_0x21e1f6(0xe0)+_0xccb102+_0x21e1f6(0x10b),()=>_0x1ea7d2[_0x21e1f6(0xad)][_0x21e1f6(0xbe)](_0x7a981a),{'verbose':_0x3679e1[_0x21e1f6(0xe6)]}),_0x124ca9=_0x2b58bf[_0x21e1f6(0xa7)];_0x3679e1[_0x21e1f6(0xe6)]&&(console[_0x21e1f6(0xda)](_0x21e1f6(0xe2)+_0x124ca9[_0x21e1f6(0xac)]),console['error'](_0x21e1f6(0xa8)+_0x124ca9[_0x21e1f6(0x104)]),_0x124ca9['folderId']&&console['error']('Folder\x20ID:\x20'+_0x124ca9[_0x21e1f6(0xb4)]),_0x124ca9[_0x21e1f6(0xe4)]&&console[_0x21e1f6(0xda)](_0x21e1f6(0xc9)+_0x124ca9[_0x21e1f6(0xe4)]));if(_0x124ca9['type']===_0x21e1f6(0xf4)){if(!_0x124ca9[_0x21e1f6(0xb4)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x21e1f6(0x118));const _0x2240e2=await withSpinner(_0x21e1f6(0xb9),()=>_0x1ea7d2['segment'][_0x21e1f6(0xab)](_0x124ca9[_0x21e1f6(0xb4)]),{'verbose':_0x3679e1[_0x21e1f6(0xe6)]});await handleSingleObjectOutput(_0x2240e2[_0x21e1f6(0xa7)],_0x3679e1);}else{if(_0x124ca9[_0x21e1f6(0xac)]===_0x21e1f6(0xad)){if(!_0x124ca9[_0x21e1f6(0xe4)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x21e1f6(0xee));const _0x422f98=await withSpinner(_0x21e1f6(0x10c),()=>_0x1ea7d2[_0x21e1f6(0xad)]['getSegment'](_0x124ca9[_0x21e1f6(0x104)],_0x124ca9[_0x21e1f6(0xe4)]),{'verbose':_0x3679e1[_0x21e1f6(0xe6)]});await handleSingleObjectOutput(_0x422f98['data'],_0x3679e1);}else return console[_0x21e1f6(0xda)](_0x21e1f6(0xf2)),console[_0x21e1f6(0xda)](_0x21e1f6(0xf1)),0x1;}return 0x0;}catch(_0x9bea37){if(_0x9bea37 instanceof SDKError)return console[_0x21e1f6(0xda)]('Error:\x20'+_0x9bea37[_0x21e1f6(0x100)]),_0x9bea37[_0x21e1f6(0xce)]&&console[_0x21e1f6(0xda)]('\x20\x20Cause:\x20'+_0x9bea37[_0x21e1f6(0xce)]),0x1;throw _0x9bea37;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a30_0x3e9567(0xfc)]=a30_0x3e9567(0xf3);[a30_0x3e9567(0xeb)]=a30_0x3e9567(0xd5);async[a30_0x3e9567(0x9d)](_0x131127){const _0x2863dd=a30_0x3e9567,{options:_0x595458,args:_0x8c0ce7,tdx:_0x4443ec}=_0x131127,_0x39b01c=_0x8c0ce7[0x0];if(!_0x39b01c)return console[_0x2863dd(0xda)](_0x2863dd(0xbb)),console['error']('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x2863dd(0xda)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console[_0x2863dd(0xda)]('Examples:'),console[_0x2863dd(0xda)](_0x2863dd(0xb5)),console[_0x2863dd(0xda)](_0x2863dd(0x117)),0x1;try{const _0x44235a=_0x595458[_0x2863dd(0xd9)],_0x5283dc=resolveSegmentTarget(_0x39b01c,_0x44235a,_0x595458[_0x2863dd(0xe6)]);_0x595458['verbose']&&console[_0x2863dd(0xda)](_0x2863dd(0xb1)+_0x5283dc);const _0x1c9dc8=await withSpinner(_0x2863dd(0xe0)+_0x39b01c+_0x2863dd(0x10b),()=>_0x4443ec[_0x2863dd(0xad)][_0x2863dd(0xbe)](_0x5283dc),{'verbose':_0x595458['verbose']}),_0x1f5a7f=_0x1c9dc8[_0x2863dd(0xa7)];_0x595458[_0x2863dd(0xe6)]&&(console[_0x2863dd(0xda)]('Resolved\x20type:\x20'+_0x1f5a7f['type']),console['error'](_0x2863dd(0xa8)+_0x1f5a7f[_0x2863dd(0x104)]));if(_0x1f5a7f[_0x2863dd(0xac)]===_0x2863dd(0xf4))return console['error'](_0x2863dd(0xc0)),console[_0x2863dd(0xda)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x1f5a7f[_0x2863dd(0xac)]===_0x2863dd(0xbc))return console[_0x2863dd(0xda)](_0x2863dd(0x113)),console[_0x2863dd(0xda)](_0x2863dd(0xe5)),0x1;if(!_0x1f5a7f[_0x2863dd(0xe4)])throw new SDKError(ErrorCode[_0x2863dd(0xef)],_0x2863dd(0xee));const _0x362053=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x4443ec[_0x2863dd(0xad)][_0x2863dd(0xaf)](_0x1f5a7f[_0x2863dd(0x104)],_0x1f5a7f[_0x2863dd(0xe4)]),{'verbose':_0x595458[_0x2863dd(0xe6)]}),_0x4b3b89=_0x362053['data'],_0x326936=await executeSchemaQuery(_0x4b3b89,_0x4443ec,_0x595458);return await handleQueryOutput(_0x326936,_0x595458),0x0;}catch(_0x41a822){if(_0x41a822 instanceof SDKError)return console['error']('Error:\x20'+_0x41a822[_0x2863dd(0x100)]),_0x41a822['cause']&&console[_0x2863dd(0xda)]('\x20\x20Cause:\x20'+_0x41a822['cause']),0x1;throw _0x41a822;}}}function a30_0x42fe(_0x55fed7,_0x38f1b2){_0x55fed7=_0x55fed7-0x9b;const _0x3748c6=a30_0x3748();let _0x42fef4=_0x3748c6[_0x55fed7];return _0x42fef4;}function a30_0x3748(){const _0xa654e6=['segment:describe','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','listFolders','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','folderPath','Parent\x20name:\x20','setJobId','\x27\x20with\x20ID:\x20','trim','Resolved\x20parent\x20folder\x20ID:\x20','execute','INVALID_ARGUMENT','Usage:\x20tdx\x20segment\x20describe\x20<path>','fullPath','3644500KjRykA','Show\x20folder\x20or\x20child\x20segment\x20details','13144554WqHWff','json','segment:show','log','data','Parent\x20ID:\x20','Site:\x20','getParent','getFolder','type','segment','Fetching\x20SQL\x20for\x20segment...','getSegmentSQL','test','Target\x20path:\x20','\x20folder','Resolving\x20path\x20\x27','folderId','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','4zdLOIb','SEGMENT_FOLDER_NOT_FOUND','Fetching\x20folder\x20details...','limit','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','parent','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','resolvePathToResource','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','length','\x20rows\x20','segment:folder:create','stats','resolveParentId','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','1112djSeqF','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','Segment\x20ID:\x20','resolveFolderId','code','jobId','SELECT\x20*\x20FROM\x20(\x0a','cause','elapsedTimeMillis','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Usage:\x20tdx\x20sg\x20show\x20<name>','Show\x20child\x20segment\x20schema\x20(column\x20types)','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Resolving\x20parent\x20segment\x20\x27','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','parentSegment','error','5481uyppFz','Show\x20segment\x20or\x20folder\x20details','Usage:\x20tdx\x20sg\x20sql\x20<name>','Error:\x20','jsonl','Resolving\x20\x27','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Resolved\x20type:\x20','replace','segmentId','Use:\x20tdx\x20ps\x20desc','verbose','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','SQL\x20query:\x0a','format','Fetching\x20parent\x20segment\x20details...','description','Use:\x20tdx\x20ps\x20sql','Show\x20segment\x20folder\x20details','Segment\x20ID\x20missing\x20from\x20resolved\x20path','SEGMENT_NOT_FOUND','\x20\x20Cause:\x20','Use:\x20tdx\x20ps\x20view','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','segment:desc','folder','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Resolved\x20relative\x20path\x20to:\x20','✔\x20Found\x20','1685935PbzSbs','(root)','1160583tDcGFZ','in\x20','name','Resolved\x20YAML\x20file:\x20','segmentPath','\x20\x20Folder\x20path:\x20','message','644142WiVcJK','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','parentId','parentFolder','✔\x20Created\x20folder\x20\x27','Folder\x20name:\x20','site','5149206KUzNNV','Error:\x20Folder\x20reference\x20is\x20required','\x27...','Fetching\x20segment\x20details...','Creating\x20folder\x20\x27','\x20[Job\x20ID:\x20','Resolved\x20parent\x20ID:\x20','Listing\x20folders\x20for\x20parent\x20\x27','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','✔\x20Query\x20completed:\x20Processed\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Parent\x20segment:\x20','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Folder\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','\x20\x20Full\x20path:\x20','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','segment:view','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Resolving\x20parent\x20folder\x20\x27'];a30_0x3748=function(){return _0xa654e6;};return a30_0x3748();}
1
+ const a30_0x2c4a73=a30_0xb2a0;(function(_0x49a787,_0x14ab12){const _0x397555=a30_0xb2a0,_0x35b08c=_0x49a787();while(!![]){try{const _0x537085=parseInt(_0x397555(0x78))/0x1*(parseInt(_0x397555(0xdc))/0x2)+-parseInt(_0x397555(0xa0))/0x3+-parseInt(_0x397555(0xe2))/0x4+-parseInt(_0x397555(0xc2))/0x5+parseInt(_0x397555(0x88))/0x6*(parseInt(_0x397555(0xf6))/0x7)+-parseInt(_0x397555(0x74))/0x8+parseInt(_0x397555(0xfa))/0x9;if(_0x537085===_0x14ab12)break;else _0x35b08c['push'](_0x35b08c['shift']());}catch(_0x312a91){_0x35b08c['push'](_0x35b08c['shift']());}}}(a30_0x1469,0x1e608));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner,withQuerySpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../utils/segment-ref-parser.js';function a30_0x1469(){const _0xf8d242=['Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','Examples:','site','\x20\x20Segment\x20name:\x20','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Fetching\x20segment\x20details...','48186eUAlce','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Folder\x20ID:\x20','Resolving\x20parent\x20segment\x20\x27','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','Resolved\x20folder\x20ID:\x20','Parent\x20name:\x20','Fetching\x20parent\x20segment\x20details...','Use:\x20tdx\x20ps\x20view','getSegment','segment:show','createFolder','trim','\x27...','segment','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Resolving\x20parent\x20folder\x20\x27','segmentId','Parent\x20ID:\x20','Fetching\x20folder\x20details...','Show\x20segment\x20folder\x20details','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','Error:\x20Path\x20or\x20name\x20is\x20required','Resolving\x20\x27','70776zqIOlr','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','segment:folder:create','Usage:\x20tdx\x20sg\x20desc\x20<name>','Folder\x20name:\x20','Parent\x20segment:\x20','message','\x20\x20Full\x20path:\x20','stats','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','format','\x27\x20with\x20ID:\x20','(root)','Show\x20folder\x20or\x20child\x20segment\x20details','getFolder','segmentPath','type','resolvePathToResource','\x20\x20Cause:\x20','Show\x20child\x20segment\x20schema\x20(column\x20types)','json','log','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','parentFolder','Usage:\x20tdx\x20sg\x20sql\x20<name>','parentId','\x20[Job\x20ID:\x20','parentSegment','segmentName','getSegmentSQL','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','data','Error:\x20Folder\x20reference\x20is\x20required','resolveParentId','736285ykTtkJ','cause','name','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','error','Executing\x20segment\x20query...','Get\x20SQL\x20query\x20for\x20child\x20segment','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','limit','segment:folder:show','getParent','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','\x20\x20Folder\x20path:\x20','segment:view','\x20rows\x20','Resolving\x20path\x20\x27','code','description','folder','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Usage:\x20tdx\x20segment\x20describe\x20<path>','folderId','Resolved\x20parent\x20ID:\x20','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','2190WabHnU','Create\x20segment\x20folder\x20for\x20organization','Use:\x20tdx\x20ps\x20show','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Resolved\x20parent\x20folder\x20ID:\x20','SEGMENT_FOLDER_NOT_FOUND','108732onzYNo','Usage:\x20tdx\x20sg\x20view\x20<name>','SEGMENT_NOT_FOUND','Show\x20segment\x20or\x20folder\x20details','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','✔\x20Created\x20folder\x20\x27','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Resolved\x20type:\x20','✖\x20Query\x20failed\x20[','Listing\x20folders\x20for\x20parent\x20\x27','Target\x20path:\x20','resolveFolderId','Error:\x20','segment:describe','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','replace','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Fetching\x20folder\x20\x27','Use:\x20tdx\x20ps\x20sql','\x20\x20Parent\x20segment:\x20','63gJOcOl','SELECT\x20*\x20FROM\x20(\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Segment\x20ID\x20missing\x20from\x20resolved\x20path','3220830bZcGIX','segment:folder:list','length','Fetching\x20SQL\x20for\x20segment...','INVALID_ARGUMENT','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','execute','folderPath','verbose','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','processedRows','Use:\x20tdx\x20ps\x20desc','fullPath','Resolving\x20folder\x20\x27','Resolved\x20YAML\x20file:\x20','1063024kqdWeo','parent','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Resolved\x20relative\x20path\x20to:\x20','23agkulh','includes','jobId','SQL\x20query:\x0a','segment:sql','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Folder\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','information_schema'];a30_0x1469=function(){return _0xf8d242;};return a30_0x1469();}import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import{executeSchemaQuery}from'../utils/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../utils/segment-path-parser.js';function resolveSegmentTarget(_0x4e4d8d,_0x3678fc,_0xe2eb71){const _0x32f648=a30_0xb2a0;if(isYamlFilePath(_0x4e4d8d))try{const _0x1b87fe=resolveYamlFilePath(_0x4e4d8d);return _0xe2eb71&&(console[_0x32f648(0xc6)](_0x32f648(0x73)+_0x4e4d8d),console[_0x32f648(0xc6)](_0x32f648(0xf5)+_0x1b87fe[_0x32f648(0xbb)]),console[_0x32f648(0xc6)](_0x32f648(0x85)+_0x1b87fe[_0x32f648(0xbc)]),console['error'](_0x32f648(0xcf)+(_0x1b87fe[_0x32f648(0x6c)]||_0x32f648(0xac))),console[_0x32f648(0xc6)](_0x32f648(0xa7)+_0x1b87fe[_0x32f648(0x71)])),_0x1b87fe[_0x32f648(0x71)];}catch(_0x748101){throw new SDKError(ErrorCode[_0x32f648(0x69)],_0x32f648(0x81)+_0x748101[_0x32f648(0xa6)]);}if(!_0x3678fc)throw new SDKError(ErrorCode[_0x32f648(0x69)],_0x32f648(0x76));return _0x3678fc+'/'+_0x4e4d8d;}export class SegmentDescribeCommand extends BaseCommand{[a30_0x2c4a73(0xc4)]=a30_0x2c4a73(0xef);[a30_0x2c4a73(0xd4)]=a30_0x2c4a73(0xe5);async[a30_0x2c4a73(0x6b)](_0x187253){const _0x3f4220=a30_0x2c4a73,{options:_0x3648a7,args:_0x5dfecf,tdx:_0x78b3b1}=_0x187253,_0x51c00a=_0x5dfecf[0x0],_0x2a823e=!_0x51c00a&&!!_0x3648a7[_0x3f4220(0xbb)],_0x12a970=_0x51c00a||_0x3648a7[_0x3f4220(0xbb)];if(!_0x12a970)return console[_0x3f4220(0xc6)](_0x3f4220(0x9e)),console['error'](_0x3f4220(0xd8)),console[_0x3f4220(0xc6)](_0x3f4220(0x83)),console[_0x3f4220(0xc6)](_0x3f4220(0xce)),console[_0x3f4220(0xc6)](_0x3f4220(0x7d)),console[_0x3f4220(0xc6)](_0x3f4220(0xc5)),console[_0x3f4220(0xc6)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0x2abaa1=_0x3648a7[_0x3f4220(0xaf)];let _0x3b9223=_0x12a970;!_0x2a823e&&_0x2abaa1&&!_0x12a970[_0x3f4220(0x79)]('/')&&(_0x3b9223=_0x2abaa1+'/'+_0x12a970,_0x3648a7['verbose']&&console[_0x3f4220(0xc6)](_0x3f4220(0x77)+_0x3b9223));const _0x3eff53=await withSpinner(_0x3f4220(0xd2)+_0x3b9223+'\x27...',()=>_0x78b3b1[_0x3f4220(0x96)][_0x3f4220(0xb1)](_0x3b9223),{'verbose':_0x3648a7[_0x3f4220(0x6d)]}),_0x4d696d=_0x3eff53[_0x3f4220(0xbf)];_0x3648a7[_0x3f4220(0x6d)]&&(console[_0x3f4220(0xc6)](_0x3f4220(0xe9)+_0x4d696d[_0x3f4220(0xb0)]),console['error'](_0x3f4220(0x9a)+_0x4d696d[_0x3f4220(0xb9)]),_0x4d696d[_0x3f4220(0xd9)]&&console[_0x3f4220(0xc6)](_0x3f4220(0x8a)+_0x4d696d[_0x3f4220(0xd9)]),_0x4d696d[_0x3f4220(0x99)]&&console[_0x3f4220(0xc6)]('Segment\x20ID:\x20'+_0x4d696d[_0x3f4220(0x99)]));if(_0x4d696d[_0x3f4220(0xb0)]==='parent'){const _0x1add34=await withSpinner(_0x3f4220(0x8f),()=>_0x78b3b1[_0x3f4220(0x96)][_0x3f4220(0xcc)](_0x4d696d[_0x3f4220(0xb9)]),{'verbose':_0x3648a7['verbose']});await handleSingleObjectOutput(_0x1add34[_0x3f4220(0xbf)],_0x3648a7);}else{if(_0x4d696d['type']==='folder'){if(!_0x4d696d[_0x3f4220(0xd9)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x3f4220(0x7e));const _0x5c5949=await withSpinner(_0x3f4220(0x9b),()=>_0x78b3b1['segment'][_0x3f4220(0xae)](_0x4d696d['folderId']),{'verbose':_0x3648a7[_0x3f4220(0x6d)]});await handleSingleObjectOutput(_0x5c5949[_0x3f4220(0xbf)],_0x3648a7);}else{if(_0x4d696d[_0x3f4220(0xb0)]===_0x3f4220(0x96)){if(!_0x4d696d[_0x3f4220(0x99)])throw new SDKError(ErrorCode[_0x3f4220(0xe4)],_0x3f4220(0xf9));const _0x564cf1=await withSpinner(_0x3f4220(0x87),()=>_0x78b3b1[_0x3f4220(0x96)][_0x3f4220(0x91)](_0x4d696d[_0x3f4220(0xb9)],_0x4d696d[_0x3f4220(0x99)]),{'verbose':_0x3648a7['verbose']});await handleSingleObjectOutput(_0x564cf1['data'],_0x3648a7);}}}return 0x0;}catch(_0x4613c0){if(_0x4613c0 instanceof SDKError)return console[_0x3f4220(0xc6)](_0x3f4220(0xee)+_0x4613c0[_0x3f4220(0xa6)]),_0x4613c0['cause']&&console[_0x3f4220(0xc6)](_0x3f4220(0xb2)+_0x4613c0['cause']),0x1;throw _0x4613c0;}}}export class SegmentShowCommand extends BaseCommand{[a30_0x2c4a73(0xc4)]=a30_0x2c4a73(0x92);[a30_0x2c4a73(0xd4)]=a30_0x2c4a73(0x86);async[a30_0x2c4a73(0x6b)](_0x599072){const _0x3c8425=a30_0x2c4a73,{options:_0x25a27,args:_0xa73c63,tdx:_0x31a767}=_0x599072,_0x879243=_0xa73c63[0x0];if(!_0x879243)return console[_0x3c8425(0xc6)](_0x3c8425(0x6a)),console[_0x3c8425(0xc6)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console[_0x3c8425(0xc6)](_0x3c8425(0x7f)),console[_0x3c8425(0xc6)]('Examples:'),console[_0x3c8425(0xc6)](_0x3c8425(0xe8)),console['error']('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x58ff1e=_0x25a27[_0x3c8425(0xbb)],_0x3968e4=resolveSegmentTarget(_0x879243,_0x58ff1e,_0x25a27['verbose']);_0x25a27['verbose']&&console[_0x3c8425(0xc6)](_0x3c8425(0xec)+_0x3968e4);const _0x3e23ad=await withSpinner(_0x3c8425(0x9f)+_0x879243+'\x27...',()=>_0x31a767[_0x3c8425(0x96)]['resolvePathToResource'](_0x3968e4),{'verbose':_0x25a27[_0x3c8425(0x6d)]}),_0x2fa367=_0x3e23ad[_0x3c8425(0xbf)];_0x25a27[_0x3c8425(0x6d)]&&(console[_0x3c8425(0xc6)](_0x3c8425(0xe9)+_0x2fa367[_0x3c8425(0xb0)]),console[_0x3c8425(0xc6)]('Parent\x20ID:\x20'+_0x2fa367[_0x3c8425(0xb9)]));if(_0x2fa367['type']==='folder')return console[_0x3c8425(0xc6)](_0x3c8425(0x89)),console[_0x3c8425(0xc6)]('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x2fa367['type']===_0x3c8425(0x75))return console['error'](_0x3c8425(0xf2)),console[_0x3c8425(0xc6)](_0x3c8425(0xde)),0x1;if(!_0x2fa367[_0x3c8425(0x99)])throw new SDKError(ErrorCode[_0x3c8425(0xe4)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x305e10=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x31a767[_0x3c8425(0x96)][_0x3c8425(0xbd)](_0x2fa367['parentId'],_0x2fa367['segmentId']),{'verbose':_0x25a27[_0x3c8425(0x6d)]});let _0x22ce12=_0x305e10[_0x3c8425(0xbf)];const _0x112243=resolveLimit(_0x25a27[_0x3c8425(0xca)],DEFAULT_DISPLAY_LIMIT),_0x2aaa91=/\bLIMIT\s+\d+/i['test'](_0x22ce12);!_0x2aaa91&&(_0x22ce12=_0x22ce12[_0x3c8425(0x94)]()[_0x3c8425(0xf1)](/;+$/,''),_0x22ce12=_0x3c8425(0xf7)+_0x22ce12+_0x3c8425(0xb6)+_0x112243);_0x25a27['verbose']&&console[_0x3c8425(0xc6)](_0x3c8425(0x7b)+_0x22ce12);const _0x2fc5fa=await withQuerySpinner(_0x3c8425(0xc7),async _0x454f5e=>{const _0x45cb2c=_0x3c8425,_0x2a5ced=await _0x31a767['query'][_0x45cb2c(0x6b)](_0x22ce12,{'catalog':'td','schema':_0x45cb2c(0x80),'onJobId':_0x35881f=>{_0x454f5e['setJobId'](_0x35881f);}});return _0x2a5ced;},{'verbose':_0x25a27[_0x3c8425(0x6d)]}),_0x3a23a2=_0x2fc5fa[_0x3c8425(0xbf)],_0x101568=_0x3a23a2['jobId']?_0x3c8425(0xba)+_0x3a23a2[_0x3c8425(0x7a)]+']':'';return console[_0x3c8425(0xc6)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x3a23a2[_0x3c8425(0xa8)][_0x3c8425(0x6f)]['toLocaleString']()+_0x3c8425(0xd1)+('in\x20'+formatElapsed(_0x3a23a2[_0x3c8425(0xa8)]['elapsedTimeMillis'])+_0x101568)),await handleQueryOutput(_0x3a23a2,_0x25a27),0x0;}catch(_0x133749){if(_0x133749 instanceof SDKError)return console['error'](_0x3c8425(0xea)+_0x133749[_0x3c8425(0xd3)]+']'),console[_0x3c8425(0xc6)]('\x0a'+_0x133749[_0x3c8425(0xa6)]),0x1;throw _0x133749;}}}export class SegmentFolderListCommand extends BaseCommand{[a30_0x2c4a73(0xc4)]=a30_0x2c4a73(0xfb);['description']='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async['execute'](_0x4af0ac){const _0x18a119=a30_0x2c4a73,{options:_0x28e83f,args:_0x4ffa1c,tdx:_0x463777}=_0x4af0ac;if(_0x4ffa1c[_0x18a119(0x67)]===0x0)return console[_0x18a119(0xc6)](_0x18a119(0x82)),console[_0x18a119(0xc6)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x230d06=_0x4ffa1c[0x0];try{_0x28e83f[_0x18a119(0x6d)]&&(console[_0x18a119(0xc6)]('Site:\x20'+_0x28e83f['site']),console[_0x18a119(0xc6)]('Parent\x20name:\x20'+_0x230d06));const _0xb275c=await withSpinner(_0x18a119(0x8b)+_0x230d06+_0x18a119(0x95),()=>_0x463777[_0x18a119(0x96)][_0x18a119(0xc1)](_0x230d06),{'verbose':_0x28e83f[_0x18a119(0x6d)]}),_0x1ef531=_0xb275c['data'];_0x28e83f[_0x18a119(0x6d)]&&console[_0x18a119(0xc6)](_0x18a119(0xda)+_0x1ef531);const _0x12c552=await withSpinner(_0x18a119(0xeb)+_0x230d06+_0x18a119(0x95),()=>_0x463777[_0x18a119(0x96)]['listFolders'](_0x1ef531),{'verbose':_0x28e83f['verbose']}),_0x573537=_0x12c552['data'];return console['error']('✔\x20Found\x20'+_0x573537['length']+'\x20folder'+(_0x573537[_0x18a119(0x67)]!==0x1?'s':'')),await handleSDKOutput(_0x573537,_0x28e83f),0x0;}catch(_0x2cf875){if(_0x2cf875 instanceof SDKError)return console['error']('Error:\x20'+_0x2cf875['message']),_0x2cf875[_0x18a119(0xc3)]&&console[_0x18a119(0xc6)](_0x18a119(0xb2)+_0x2cf875[_0x18a119(0xc3)]),0x1;throw _0x2cf875;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a30_0x2c4a73(0xcb);[a30_0x2c4a73(0xd4)]=a30_0x2c4a73(0x9c);async['execute'](_0x1de214){const _0x22c97a=a30_0x2c4a73,{options:_0x28a61d,args:_0x290168,tdx:_0x472755}=_0x1de214;if(_0x290168['length']===0x0)return console[_0x22c97a(0xc6)](_0x22c97a(0xc0)),console[_0x22c97a(0xc6)](_0x22c97a(0xd6)),0x1;try{const {parentId:_0x121a86,childId:_0x2256a5}=parseSegmentRef(_0x290168[0x0]);_0x28a61d[_0x22c97a(0x6d)]&&(console[_0x22c97a(0xc6)]('Site:\x20'+_0x28a61d[_0x22c97a(0x84)]),console[_0x22c97a(0xc6)](_0x22c97a(0x8e)+_0x121a86),_0x2256a5&&console[_0x22c97a(0xc6)](_0x22c97a(0xa4)+_0x2256a5));if(!_0x2256a5)return console[_0x22c97a(0xc6)](_0x22c97a(0xc9)),0x1;const _0x18a88a=await withSpinner(_0x22c97a(0x8b)+_0x121a86+_0x22c97a(0x95),()=>_0x472755[_0x22c97a(0x96)]['resolveParentId'](_0x121a86),{'verbose':_0x28a61d[_0x22c97a(0x6d)]}),_0x2061e4=_0x18a88a[_0x22c97a(0xbf)];_0x28a61d[_0x22c97a(0x6d)]&&console[_0x22c97a(0xc6)]('Resolved\x20parent\x20ID:\x20'+_0x2061e4);const _0x2aedea=await withSpinner(_0x22c97a(0x72)+_0x2256a5+_0x22c97a(0x95),()=>_0x472755[_0x22c97a(0x96)][_0x22c97a(0xed)](_0x2061e4,_0x2256a5),{'verbose':_0x28a61d['verbose']}),_0x18b17b=_0x2aedea[_0x22c97a(0xbf)];_0x28a61d[_0x22c97a(0x6d)]&&console[_0x22c97a(0xc6)](_0x22c97a(0x8d)+_0x18b17b);const _0x116cb0=await withSpinner(_0x22c97a(0xf3)+_0x2256a5+_0x22c97a(0x95),()=>_0x472755['segment']['getFolder'](_0x18b17b),{'verbose':_0x28a61d['verbose']});return await handleSDKOutput([_0x116cb0[_0x22c97a(0xbf)]],_0x28a61d),0x0;}catch(_0x27793f){if(_0x27793f instanceof SDKError)return console[_0x22c97a(0xc6)]('Error:\x20'+_0x27793f[_0x22c97a(0xa6)]),_0x27793f[_0x22c97a(0xc3)]&&console[_0x22c97a(0xc6)](_0x22c97a(0xb2)+_0x27793f[_0x22c97a(0xc3)]),0x1;throw _0x27793f;}}}export class SegmentSQLCommand extends BaseCommand{[a30_0x2c4a73(0xc4)]=a30_0x2c4a73(0x7c);['description']=a30_0x2c4a73(0xc8);async[a30_0x2c4a73(0x6b)](_0x4ccd05){const _0x16eabf=a30_0x2c4a73,{options:_0x2d673b,args:_0x44ccf4,tdx:_0x2c5fbd}=_0x4ccd05,_0x41eb39=_0x44ccf4[0x0];if(!_0x41eb39)return console[_0x16eabf(0xc6)](_0x16eabf(0x6a)),console[_0x16eabf(0xc6)](_0x16eabf(0xb8)),console[_0x16eabf(0xc6)](_0x16eabf(0x9d)),console[_0x16eabf(0xc6)](_0x16eabf(0x83)),console[_0x16eabf(0xc6)](_0x16eabf(0xf0)),console['error'](_0x16eabf(0xe6)),0x1;try{const _0x500084=_0x2d673b[_0x16eabf(0xbb)],_0x101e30=resolveSegmentTarget(_0x41eb39,_0x500084,_0x2d673b['verbose']);_0x2d673b['verbose']&&console[_0x16eabf(0xc6)](_0x16eabf(0xec)+_0x101e30);const _0x17cc26=await withSpinner(_0x16eabf(0x9f)+_0x41eb39+'\x27...',()=>_0x2c5fbd['segment']['resolvePathToResource'](_0x101e30),{'verbose':_0x2d673b[_0x16eabf(0x6d)]}),_0xe3b015=_0x17cc26['data'];_0x2d673b[_0x16eabf(0x6d)]&&(console[_0x16eabf(0xc6)](_0x16eabf(0xe9)+_0xe3b015[_0x16eabf(0xb0)]),console[_0x16eabf(0xc6)](_0x16eabf(0x9a)+_0xe3b015[_0x16eabf(0xb9)]));if(_0xe3b015[_0x16eabf(0xb0)]===_0x16eabf(0xd5))return console[_0x16eabf(0xc6)]('Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.'),console['error'](_0x16eabf(0xd7)),0x1;if(_0xe3b015[_0x16eabf(0xb0)]==='parent')return console['error'](_0x16eabf(0x8c)),console[_0x16eabf(0xc6)](_0x16eabf(0xf4)),0x1;if(!_0xe3b015[_0x16eabf(0x99)])throw new SDKError(ErrorCode[_0x16eabf(0xe4)],_0x16eabf(0xf9));const _0xc6144e=await withSpinner(_0x16eabf(0x68),()=>_0x2c5fbd[_0x16eabf(0x96)][_0x16eabf(0xbd)](_0xe3b015[_0x16eabf(0xb9)],_0xe3b015[_0x16eabf(0x99)]),{'verbose':_0x2d673b[_0x16eabf(0x6d)]}),_0x541252=_0xc6144e[_0x16eabf(0xbf)];return _0x2d673b[_0x16eabf(0xaa)]===_0x16eabf(0xb4)||_0x2d673b['format']==='jsonl'?await handleSDKOutput([{'sql':_0x541252}],_0x2d673b):console[_0x16eabf(0xb5)](_0x541252),0x0;}catch(_0x3478cc){if(_0x3478cc instanceof SDKError)return console[_0x16eabf(0xc6)](_0x16eabf(0xee)+_0x3478cc[_0x16eabf(0xa6)]),_0x3478cc['cause']&&console[_0x16eabf(0xc6)](_0x16eabf(0xb2)+_0x3478cc[_0x16eabf(0xc3)]),0x1;throw _0x3478cc;}}}export class SegmentFolderCreateCommand extends BaseCommand{['name']=a30_0x2c4a73(0xa2);[a30_0x2c4a73(0xd4)]=a30_0x2c4a73(0xdd);async['execute'](_0x41173c){const _0x40ffd5=a30_0x2c4a73,{options:_0x4aa00c,args:_0x3a5638,tdx:_0x2bdf04}=_0x41173c,_0x3a2c57=_0x4aa00c;if(_0x3a5638[_0x40ffd5(0x67)]<0x2)return console[_0x40ffd5(0xc6)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console[_0x40ffd5(0xc6)](_0x40ffd5(0x97)),0x1;const _0x23504e=_0x3a5638[0x0],_0x41716f=_0x3a5638[0x1];_0x3a2c57[_0x40ffd5(0x6d)]&&(console['error']('Site:\x20'+_0x3a2c57[_0x40ffd5(0x84)]),console['error'](_0x40ffd5(0xa5)+_0x23504e),console['error']('Folder\x20name:\x20'+_0x41716f));let _0x16c528;if(_0x3a2c57[_0x40ffd5(0xb7)]){const _0x2f5f97=_0x3a2c57[_0x40ffd5(0xb7)],_0x125222=await withSpinner(_0x40ffd5(0x8b)+_0x23504e+_0x40ffd5(0x95),()=>_0x2bdf04[_0x40ffd5(0x96)][_0x40ffd5(0xc1)](_0x23504e),{'verbose':_0x3a2c57[_0x40ffd5(0x6d)]}),_0x229dc9=_0x125222['data'],_0x10a63e=await withSpinner(_0x40ffd5(0x98)+_0x2f5f97+_0x40ffd5(0x95),()=>_0x2bdf04[_0x40ffd5(0x96)][_0x40ffd5(0xed)](_0x229dc9,_0x2f5f97),{'verbose':_0x3a2c57[_0x40ffd5(0x6d)]});_0x16c528=_0x10a63e[_0x40ffd5(0xbf)],_0x3a2c57[_0x40ffd5(0x6d)]&&console[_0x40ffd5(0xc6)](_0x40ffd5(0xe0)+_0x16c528);}const _0x1e5d7f={'name':_0x41716f,'description':_0x3a2c57[_0x40ffd5(0xd4)],'parentFolderId':_0x16c528},_0xff36b=await withSpinner('Creating\x20folder\x20\x27'+_0x41716f+_0x40ffd5(0x95),()=>_0x2bdf04['segment'][_0x40ffd5(0x93)](_0x23504e,_0x1e5d7f),{'verbose':_0x3a2c57[_0x40ffd5(0x6d)]}),_0x41fabe=_0xff36b[_0x40ffd5(0xbf)];return console[_0x40ffd5(0xc6)](_0x40ffd5(0xe7)+_0x41fabe[_0x40ffd5(0xc4)]+_0x40ffd5(0xab)+_0x41fabe['id']),await handleSDKOutput([_0x41fabe],_0x3a2c57),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a30_0x2c4a73(0xd0);[a30_0x2c4a73(0xd4)]=a30_0x2c4a73(0xad);async[a30_0x2c4a73(0x6b)](_0x49f978){const _0x4175c2=a30_0x2c4a73,{options:_0x15e050,args:_0x4e4453,tdx:_0x276d75}=_0x49f978,_0x2c04b7=_0x4e4453[0x0];if(!_0x2c04b7)return console[_0x4175c2(0xc6)](_0x4175c2(0xdb)),console['error'](_0x4175c2(0xe3)),console[_0x4175c2(0xc6)](_0x4175c2(0xbe)),console[_0x4175c2(0xc6)](_0x4175c2(0x83)),console[_0x4175c2(0xc6)](_0x4175c2(0xcd)),console[_0x4175c2(0xc6)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x4175c2(0xc6)](_0x4175c2(0xa9)),0x1;try{const _0x356d1f=_0x15e050[_0x4175c2(0xbb)],_0x227f16=resolveSegmentTarget(_0x2c04b7,_0x356d1f,_0x15e050[_0x4175c2(0x6d)]);_0x15e050[_0x4175c2(0x6d)]&&console[_0x4175c2(0xc6)](_0x4175c2(0xec)+_0x227f16);const _0x43e600=await withSpinner(_0x4175c2(0x9f)+_0x2c04b7+_0x4175c2(0x95),()=>_0x276d75[_0x4175c2(0x96)][_0x4175c2(0xb1)](_0x227f16),{'verbose':_0x15e050[_0x4175c2(0x6d)]}),_0x35e5ec=_0x43e600[_0x4175c2(0xbf)];_0x15e050[_0x4175c2(0x6d)]&&(console[_0x4175c2(0xc6)](_0x4175c2(0xe9)+_0x35e5ec[_0x4175c2(0xb0)]),console['error'](_0x4175c2(0x9a)+_0x35e5ec[_0x4175c2(0xb9)]),_0x35e5ec[_0x4175c2(0xd9)]&&console[_0x4175c2(0xc6)]('Folder\x20ID:\x20'+_0x35e5ec[_0x4175c2(0xd9)]),_0x35e5ec[_0x4175c2(0x99)]&&console[_0x4175c2(0xc6)]('Segment\x20ID:\x20'+_0x35e5ec[_0x4175c2(0x99)]));if(_0x35e5ec[_0x4175c2(0xb0)]===_0x4175c2(0xd5)){if(!_0x35e5ec[_0x4175c2(0xd9)])throw new SDKError(ErrorCode[_0x4175c2(0xe1)],_0x4175c2(0x7e));const _0x5d3b6a=await withSpinner(_0x4175c2(0x9b),()=>_0x276d75[_0x4175c2(0x96)][_0x4175c2(0xae)](_0x35e5ec[_0x4175c2(0xd9)]),{'verbose':_0x15e050['verbose']});await handleSingleObjectOutput(_0x5d3b6a['data'],_0x15e050);}else{if(_0x35e5ec['type']===_0x4175c2(0x96)){if(!_0x35e5ec[_0x4175c2(0x99)])throw new SDKError(ErrorCode[_0x4175c2(0xe4)],_0x4175c2(0xf9));const _0x31e4de=await withSpinner(_0x4175c2(0x87),()=>_0x276d75[_0x4175c2(0x96)]['getSegment'](_0x35e5ec[_0x4175c2(0xb9)],_0x35e5ec[_0x4175c2(0x99)]),{'verbose':_0x15e050['verbose']});await handleSingleObjectOutput(_0x31e4de[_0x4175c2(0xbf)],_0x15e050);}else return console['error']('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console[_0x4175c2(0xc6)](_0x4175c2(0x90)),0x1;}return 0x0;}catch(_0xad7d92){if(_0xad7d92 instanceof SDKError)return console[_0x4175c2(0xc6)]('Error:\x20'+_0xad7d92[_0x4175c2(0xa6)]),_0xad7d92[_0x4175c2(0xc3)]&&console['error'](_0x4175c2(0xb2)+_0xad7d92['cause']),0x1;throw _0xad7d92;}}}export const SegmentInfoCommand=SegmentViewCommand;function a30_0xb2a0(_0x206853,_0x12c497){_0x206853=_0x206853-0x67;const _0x14694c=a30_0x1469();let _0xb2a0aa=_0x14694c[_0x206853];return _0xb2a0aa;}export class SegmentDescCommand extends BaseCommand{[a30_0x2c4a73(0xc4)]='segment:desc';['description']=a30_0x2c4a73(0xb3);async[a30_0x2c4a73(0x6b)](_0x2e7f0b){const _0x386bf7=a30_0x2c4a73,{options:_0x1e6a88,args:_0x26f68c,tdx:_0x538303}=_0x2e7f0b,_0x25147b=_0x26f68c[0x0];if(!_0x25147b)return console[_0x386bf7(0xc6)](_0x386bf7(0x6a)),console[_0x386bf7(0xc6)](_0x386bf7(0xa3)),console[_0x386bf7(0xc6)](_0x386bf7(0xf8)),console['error'](_0x386bf7(0x83)),console[_0x386bf7(0xc6)](_0x386bf7(0x6e)),console[_0x386bf7(0xc6)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x4b3b50=_0x1e6a88[_0x386bf7(0xbb)],_0x162239=resolveSegmentTarget(_0x25147b,_0x4b3b50,_0x1e6a88[_0x386bf7(0x6d)]);_0x1e6a88['verbose']&&console[_0x386bf7(0xc6)]('Target\x20path:\x20'+_0x162239);const _0x1ecf13=await withSpinner(_0x386bf7(0x9f)+_0x25147b+'\x27...',()=>_0x538303[_0x386bf7(0x96)][_0x386bf7(0xb1)](_0x162239),{'verbose':_0x1e6a88['verbose']}),_0x35a8f0=_0x1ecf13[_0x386bf7(0xbf)];_0x1e6a88[_0x386bf7(0x6d)]&&(console[_0x386bf7(0xc6)](_0x386bf7(0xe9)+_0x35a8f0[_0x386bf7(0xb0)]),console['error'](_0x386bf7(0x9a)+_0x35a8f0[_0x386bf7(0xb9)]));if(_0x35a8f0[_0x386bf7(0xb0)]==='folder')return console[_0x386bf7(0xc6)](_0x386bf7(0xdf)),console['error'](_0x386bf7(0xd7)),0x1;if(_0x35a8f0[_0x386bf7(0xb0)]===_0x386bf7(0x75))return console[_0x386bf7(0xc6)](_0x386bf7(0xa1)),console[_0x386bf7(0xc6)](_0x386bf7(0x70)),0x1;if(!_0x35a8f0[_0x386bf7(0x99)])throw new SDKError(ErrorCode[_0x386bf7(0xe4)],_0x386bf7(0xf9));const _0x1917b5=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x538303['segment'][_0x386bf7(0xbd)](_0x35a8f0[_0x386bf7(0xb9)],_0x35a8f0['segmentId']),{'verbose':_0x1e6a88[_0x386bf7(0x6d)]}),_0xfb308c=_0x1917b5[_0x386bf7(0xbf)],_0x56c74f=await executeSchemaQuery(_0xfb308c,_0x538303,_0x1e6a88);return await handleQueryOutput(_0x56c74f,_0x1e6a88),0x0;}catch(_0x21adc2){if(_0x21adc2 instanceof SDKError)return console['error'](_0x386bf7(0xee)+_0x21adc2[_0x386bf7(0xa6)]),_0x21adc2[_0x386bf7(0xc3)]&&console[_0x386bf7(0xc6)](_0x386bf7(0xb2)+_0x21adc2[_0x386bf7(0xc3)]),0x1;throw _0x21adc2;}}}
@@ -1 +1 @@
1
- const a31_0x4fcff6=a31_0x328d;(function(_0x4a0a85,_0x2e9a46){const _0xfd53ab=a31_0x328d,_0x1cbcac=_0x4a0a85();while(!![]){try{const _0x57c9bb=-parseInt(_0xfd53ab(0x18f))/0x1*(-parseInt(_0xfd53ab(0x19b))/0x2)+parseInt(_0xfd53ab(0x1a7))/0x3+-parseInt(_0xfd53ab(0x188))/0x4+-parseInt(_0xfd53ab(0x1a8))/0x5+-parseInt(_0xfd53ab(0x19d))/0x6+-parseInt(_0xfd53ab(0x1a5))/0x7*(parseInt(_0xfd53ab(0x198))/0x8)+parseInt(_0xfd53ab(0x1af))/0x9*(parseInt(_0xfd53ab(0x1a6))/0xa);if(_0x57c9bb===_0x2e9a46)break;else _0x1cbcac['push'](_0x1cbcac['shift']());}catch(_0x2731f2){_0x1cbcac['push'](_0x1cbcac['shift']());}}}(a31_0x516e,0x7d2d6));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';function a31_0x516e(){const _0x301522=['Create\x20child\x20segment\x20with\x20filtering\x20rules','noCountPopulation','folder','data','createSegment','resolveFolderId','ruleFile','4723768nArFOQ','14310150irjoJD','2384676qJvLom','3583015gpVaRq','yellow','\x20\x20\x20Path:\x20','Parent\x20path:\x20','Creating\x20segment\x20\x27','verbose','invisible','9KcDyCw','Site:\x20','resolvePathToResource','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','folderId','execute','name','Target\x20path:\x20','segment:create','segment','description','2496240QEJTaJ','resolveParentId','Segment\x20name:\x20','Resolving\x20folder\x20path\x20\x27','Resolving\x20folder\x20\x27','Examples:','Resolved\x20relative\x20path\x20to:\x20','5EOZsxG','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','\x27...','Resolving\x20parent\x20segment\x20\x27','Resolved\x20folder\x20ID:\x20','error','site','rule','kind','8SrMXru','segments','includes','226762aPmSSP','length','1587594dPpGvd'];a31_0x516e=function(){return _0x301522;};return a31_0x516e();}import{withSpinner}from'../utils/spinner.js';function a31_0x328d(_0x3d4813,_0x2a242b){_0x3d4813=_0x3d4813-0x181;const _0x516e35=a31_0x516e();let _0x328d9c=_0x516e35[_0x3d4813];return _0x328d9c;}import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../utils/segment-path-parser.js';import a31_0x2f787a from'chalk';export class SegmentCreateCommand extends BaseCommand{[a31_0x4fcff6(0x183)]=a31_0x4fcff6(0x185);[a31_0x4fcff6(0x187)]=a31_0x4fcff6(0x19e);async[a31_0x4fcff6(0x182)](_0x2c54a3){const _0x74e252=a31_0x4fcff6;console[_0x74e252(0x194)](a31_0x2f787a['yellow']('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x74e252(0x194)](a31_0x2f787a[_0x74e252(0x1a9)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0xd1ca7d,args:_0x22c6cd,tdx:_0x57c707}=_0x2c54a3,_0x346cf4=_0xd1ca7d;if(_0x22c6cd[_0x74e252(0x19c)]===0x0)return console[_0x74e252(0x194)](_0x74e252(0x1b2)),console[_0x74e252(0x194)]('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console[_0x74e252(0x194)](_0x74e252(0x18d)),console[_0x74e252(0x194)](_0x74e252(0x190)),console[_0x74e252(0x194)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console[_0x74e252(0x194)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x577c68=_0x22c6cd[0x0],_0x4ec856=_0xd1ca7d['segmentPath'];let _0x28723c=_0x577c68;_0x4ec856&&!_0x577c68[_0x74e252(0x19a)]('/')&&(_0x28723c=_0x4ec856+'/'+_0x577c68,_0x346cf4[_0x74e252(0x1ad)]&&console[_0x74e252(0x194)](_0x74e252(0x18e)+_0x28723c));const _0xd97e66=parsePath(_0x28723c);if(_0xd97e66[_0x74e252(0x199)][_0x74e252(0x19c)]<0x2)return console['error']('Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'),console['error']('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x22527b=_0xd97e66[_0x74e252(0x199)][0x0],_0x4e53ba=getBaseName(_0x28723c),_0x37d9c4=getParentPath(_0x28723c);_0x346cf4['verbose']&&(console['error'](_0x74e252(0x1b0)+_0x346cf4[_0x74e252(0x195)]),console[_0x74e252(0x194)](_0x74e252(0x184)+_0x28723c),console['error']('Parent:\x20'+_0x22527b),console[_0x74e252(0x194)](_0x74e252(0x18a)+_0x4e53ba),console[_0x74e252(0x194)](_0x74e252(0x1ab)+_0x37d9c4));const _0x112345=await withSpinner(_0x74e252(0x192)+_0x22527b+_0x74e252(0x191),()=>_0x57c707['segment'][_0x74e252(0x189)](_0x22527b),{'verbose':_0x346cf4[_0x74e252(0x1ad)]}),_0x2413ca=_0x112345['data'];let _0x12e9a9;if(_0xd97e66[_0x74e252(0x199)]['length']>0x2){const _0x5ddb9a=await withSpinner(_0x74e252(0x18b)+_0x37d9c4+_0x74e252(0x191),()=>_0x57c707['segment'][_0x74e252(0x1b1)](_0x37d9c4),{'verbose':_0x346cf4[_0x74e252(0x1ad)]}),_0x7620ad=_0x5ddb9a[_0x74e252(0x1a1)];if(_0x7620ad['type']!==_0x74e252(0x1a0)&&_0x7620ad['type']!=='parent')return console[_0x74e252(0x194)]('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x12e9a9=_0x7620ad[_0x74e252(0x181)];}else{if(_0x346cf4['folder']){const _0x51095b=await withSpinner(_0x74e252(0x18c)+_0x346cf4[_0x74e252(0x1a0)]+_0x74e252(0x191),()=>_0x57c707[_0x74e252(0x186)][_0x74e252(0x1a3)](_0x2413ca,_0x346cf4['folder']),{'verbose':_0x346cf4[_0x74e252(0x1ad)]});_0x12e9a9=_0x51095b[_0x74e252(0x1a1)];}}_0x346cf4[_0x74e252(0x1ad)]&&_0x12e9a9&&console[_0x74e252(0x194)](_0x74e252(0x193)+_0x12e9a9);const _0x568895=await loadJSONFromOptions(_0x346cf4[_0x74e252(0x196)],_0x346cf4[_0x74e252(0x1a4)]),_0x5f04ce={'name':_0x4e53ba,'description':_0x346cf4[_0x74e252(0x187)],'rule':_0x568895,'kind':_0x346cf4[_0x74e252(0x197)]!==undefined?parseInt(_0x346cf4['kind'],0xa):undefined,'isVisible':_0x346cf4[_0x74e252(0x1ae)]?![]:undefined,'segmentFolderId':_0x12e9a9,'countPopulation':_0x346cf4[_0x74e252(0x19f)]?![]:undefined},_0x25cfc6=await withSpinner(_0x74e252(0x1ac)+_0x4e53ba+_0x74e252(0x191),()=>_0x57c707[_0x74e252(0x186)][_0x74e252(0x1a2)](_0x2413ca,_0x5f04ce),{'verbose':_0x346cf4[_0x74e252(0x1ad)]}),_0x121220=_0x25cfc6[_0x74e252(0x1a1)];return console[_0x74e252(0x194)]('✔\x20Created\x20segment\x20\x27'+_0x121220['name']+'\x27\x20with\x20ID:\x20'+_0x121220['id']),_0x28723c!==_0x577c68&&console[_0x74e252(0x194)](_0x74e252(0x1aa)+_0x28723c),await handleSDKOutput([_0x121220],_0x346cf4),0x0;}}
1
+ const a31_0x1bb36b=a31_0x44c8;(function(_0x22a820,_0x50fdc5){const _0x1de507=a31_0x44c8,_0x4172b7=_0x22a820();while(!![]){try{const _0x34259b=-parseInt(_0x1de507(0x186))/0x1+-parseInt(_0x1de507(0x183))/0x2+parseInt(_0x1de507(0x193))/0x3+-parseInt(_0x1de507(0x178))/0x4*(parseInt(_0x1de507(0x170))/0x5)+-parseInt(_0x1de507(0x172))/0x6*(-parseInt(_0x1de507(0x192))/0x7)+parseInt(_0x1de507(0x18c))/0x8+parseInt(_0x1de507(0x190))/0x9;if(_0x34259b===_0x50fdc5)break;else _0x4172b7['push'](_0x4172b7['shift']());}catch(_0x2d3057){_0x4172b7['push'](_0x4172b7['shift']());}}}(a31_0x55f3,0x56d4f));function a31_0x44c8(_0x3c32ef,_0x5cecc8){_0x3c32ef=_0x3c32ef-0x168;const _0x55f3fe=a31_0x55f3();let _0x44c8c0=_0x55f3fe[_0x3c32ef];return _0x44c8c0;}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';function a31_0x55f3(){const _0xf2eabc=['execute','1253434uIOhAl','parent','resolveFolderId','695607eYSJGb','name','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','segments','\x27...','1110264KTMHBl','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','length','site','9967293LLKEIG','error','98vRoPpU','906870kAqBnE','Creating\x20segment\x20\x27','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','kind','resolveParentId','Target\x20path:\x20','\x27\x20with\x20ID:\x20','noCountPopulation','description','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','segment:create','25aRvWPm','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','89298ExHSfQ','Resolving\x20parent\x20segment\x20\x27','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','data','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','Parent\x20path:\x20','63140UPvLKE','Resolved\x20folder\x20ID:\x20','yellow','folderId','folder','type','\x20\x20\x20Path:\x20','Resolving\x20folder\x20\x27','verbose','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'];a31_0x55f3=function(){return _0xf2eabc;};return a31_0x55f3();}import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../utils/segment-path-parser.js';import a31_0x4962ae from'chalk';export class SegmentCreateCommand extends BaseCommand{[a31_0x1bb36b(0x187)]=a31_0x1bb36b(0x16f);['description']='Create\x20child\x20segment\x20with\x20filtering\x20rules';async[a31_0x1bb36b(0x182)](_0xa7de5e){const _0x4f6232=a31_0x1bb36b;console[_0x4f6232(0x191)](a31_0x4962ae[_0x4f6232(0x17a)](_0x4f6232(0x18d))),console[_0x4f6232(0x191)](a31_0x4962ae[_0x4f6232(0x17a)](_0x4f6232(0x174)));const {options:_0x41bc2d,args:_0x22756a,tdx:_0x1e5f71}=_0xa7de5e,_0x1f6c8c=_0x41bc2d;if(_0x22756a[_0x4f6232(0x18e)]===0x0)return console[_0x4f6232(0x191)](_0x4f6232(0x181)),console[_0x4f6232(0x191)](_0x4f6232(0x189)),console['error']('Examples:'),console[_0x4f6232(0x191)](_0x4f6232(0x16e)),console[_0x4f6232(0x191)](_0x4f6232(0x188)),console[_0x4f6232(0x191)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0xb2eab5=_0x22756a[0x0],_0x21b914=_0x41bc2d['segmentPath'];let _0x474c87=_0xb2eab5;_0x21b914&&!_0xb2eab5['includes']('/')&&(_0x474c87=_0x21b914+'/'+_0xb2eab5,_0x1f6c8c[_0x4f6232(0x180)]&&console[_0x4f6232(0x191)]('Resolved\x20relative\x20path\x20to:\x20'+_0x474c87));const _0x3f7234=parsePath(_0x474c87);if(_0x3f7234['segments'][_0x4f6232(0x18e)]<0x2)return console[_0x4f6232(0x191)](_0x4f6232(0x171)),console[_0x4f6232(0x191)](_0x4f6232(0x195)),0x1;const _0x2b7311=_0x3f7234[_0x4f6232(0x18a)][0x0],_0x50a006=getBaseName(_0x474c87),_0x2955dd=getParentPath(_0x474c87);_0x1f6c8c[_0x4f6232(0x180)]&&(console[_0x4f6232(0x191)]('Site:\x20'+_0x1f6c8c[_0x4f6232(0x18f)]),console[_0x4f6232(0x191)](_0x4f6232(0x16a)+_0x474c87),console['error']('Parent:\x20'+_0x2b7311),console[_0x4f6232(0x191)]('Segment\x20name:\x20'+_0x50a006),console['error'](_0x4f6232(0x177)+_0x2955dd));const _0x257e37=await withSpinner(_0x4f6232(0x173)+_0x2b7311+_0x4f6232(0x18b),()=>_0x1e5f71['segment'][_0x4f6232(0x169)](_0x2b7311),{'verbose':_0x1f6c8c[_0x4f6232(0x180)]}),_0xaff29f=_0x257e37['data'];let _0x551a8e;if(_0x3f7234[_0x4f6232(0x18a)][_0x4f6232(0x18e)]>0x2){const _0x1657d7=await withSpinner('Resolving\x20folder\x20path\x20\x27'+_0x2955dd+'\x27...',()=>_0x1e5f71['segment']['resolvePathToResource'](_0x2955dd),{'verbose':_0x1f6c8c[_0x4f6232(0x180)]}),_0x5ac0c3=_0x1657d7[_0x4f6232(0x175)];if(_0x5ac0c3[_0x4f6232(0x17d)]!==_0x4f6232(0x17c)&&_0x5ac0c3[_0x4f6232(0x17d)]!==_0x4f6232(0x184))return console[_0x4f6232(0x191)](_0x4f6232(0x176)),0x1;_0x551a8e=_0x5ac0c3[_0x4f6232(0x17b)];}else{if(_0x1f6c8c['folder']){const _0x4ef40e=await withSpinner(_0x4f6232(0x17f)+_0x1f6c8c[_0x4f6232(0x17c)]+'\x27...',()=>_0x1e5f71['segment'][_0x4f6232(0x185)](_0xaff29f,_0x1f6c8c[_0x4f6232(0x17c)]),{'verbose':_0x1f6c8c[_0x4f6232(0x180)]});_0x551a8e=_0x4ef40e[_0x4f6232(0x175)];}}_0x1f6c8c[_0x4f6232(0x180)]&&_0x551a8e&&console[_0x4f6232(0x191)](_0x4f6232(0x179)+_0x551a8e);const _0x245130=await loadJSONFromOptions(_0x1f6c8c['rule'],_0x1f6c8c['ruleFile']),_0x42644b={'name':_0x50a006,'description':_0x1f6c8c[_0x4f6232(0x16d)],'rule':_0x245130,'kind':_0x1f6c8c[_0x4f6232(0x168)]!==undefined?parseInt(_0x1f6c8c[_0x4f6232(0x168)],0xa):undefined,'isVisible':_0x1f6c8c['invisible']?![]:undefined,'segmentFolderId':_0x551a8e,'countPopulation':_0x1f6c8c[_0x4f6232(0x16c)]?![]:undefined},_0x97e404=await withSpinner(_0x4f6232(0x194)+_0x50a006+_0x4f6232(0x18b),()=>_0x1e5f71['segment']['createSegment'](_0xaff29f,_0x42644b),{'verbose':_0x1f6c8c[_0x4f6232(0x180)]}),_0x39f583=_0x97e404['data'];return console['error']('✔\x20Created\x20segment\x20\x27'+_0x39f583[_0x4f6232(0x187)]+_0x4f6232(0x16b)+_0x39f583['id']),_0x474c87!==_0xb2eab5&&console[_0x4f6232(0x191)](_0x4f6232(0x17e)+_0x474c87),await handleSDKOutput([_0x39f583],_0x1f6c8c),0x0;}}
@@ -1 +1 @@
1
- const a32_0x3d396f=a32_0x51d6;function a32_0x51d6(_0x52be88,_0x246b4e){_0x52be88=_0x52be88-0x15b;const _0x18dccf=a32_0x18dc();let _0x51d60c=_0x18dccf[_0x52be88];return _0x51d60c;}function a32_0x18dc(){const _0x1f1102=['Listing\x20fields\x20for\x20\x27','jsonl','Error:\x20Parent\x20segment\x20name\x20is\x20required','3490570VsFjzx','6iiQHwO','Parent\x20segment:\x20','4397561HHeLni','823312ywoQCh','segment:fields','4971QPTldI','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','4499004VJGzMC','name','length','segment','verbose','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','Site:\x20','site','\x27...','✔\x20Found\x20','description','36fmMulu','1656220aMBDmI','execute','json','380022igqMAz','data','error','parentSegment','706TSOXRu'];a32_0x18dc=function(){return _0x1f1102;};return a32_0x18dc();}(function(_0x5763d5,_0x6f6dac){const _0x1295b7=a32_0x51d6,_0x1f376b=_0x5763d5();while(!![]){try{const _0x59efd8=-parseInt(_0x1295b7(0x166))/0x1+-parseInt(_0x1295b7(0x16a))/0x2*(-parseInt(_0x1295b7(0x174))/0x3)+-parseInt(_0x1295b7(0x176))/0x4+parseInt(_0x1295b7(0x163))/0x5*(-parseInt(_0x1295b7(0x16f))/0x6)+parseInt(_0x1295b7(0x171))/0x7+-parseInt(_0x1295b7(0x172))/0x8+-parseInt(_0x1295b7(0x162))/0x9*(-parseInt(_0x1295b7(0x16e))/0xa);if(_0x59efd8===_0x6f6dac)break;else _0x1f376b['push'](_0x1f376b['shift']());}catch(_0x2791cc){_0x1f376b['push'](_0x1f376b['shift']());}}}(a32_0x18dc,0xa3ae9));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../utils/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a32_0x3d396f(0x177)]=a32_0x3d396f(0x173);[a32_0x3d396f(0x161)]='List\x20available\x20fields\x20for\x20segmentation';async[a32_0x3d396f(0x164)](_0x53ffcb){const _0x1863e8=a32_0x3d396f,{options:_0x853dd4,args:_0x398058,tdx:_0x17dd22}=_0x53ffcb,_0xf5c3ec=_0x398058[0x0]||_0x853dd4[_0x1863e8(0x169)];if(!_0xf5c3ec)return console[_0x1863e8(0x168)](_0x1863e8(0x16d)),console[_0x1863e8(0x168)](_0x1863e8(0x15c)),console[_0x1863e8(0x168)](_0x1863e8(0x175)),0x1;_0x853dd4[_0x1863e8(0x15b)]&&(console[_0x1863e8(0x168)](_0x1863e8(0x15d)+_0x853dd4[_0x1863e8(0x15e)]),console[_0x1863e8(0x168)](_0x1863e8(0x170)+_0xf5c3ec));const _0x35c2cc=await withSpinner(_0x1863e8(0x16b)+_0xf5c3ec+_0x1863e8(0x15f),()=>_0x17dd22[_0x1863e8(0x179)]['listFields'](_0xf5c3ec),{'verbose':_0x853dd4[_0x1863e8(0x15b)]}),_0x5d62f2=_0x35c2cc[_0x1863e8(0x167)];console['error'](_0x1863e8(0x160)+_0x5d62f2[_0x1863e8(0x178)]+'\x20field'+(_0x5d62f2[_0x1863e8(0x178)]!==0x1?'s':''));if(_0x853dd4[_0x1863e8(0x165)]||_0x853dd4[_0x1863e8(0x16c)])return await handleSDKOutput(_0x5d62f2,_0x853dd4),0x0;return displayFieldsHumanReadable(_0x5d62f2,_0xf5c3ec),0x0;}}
1
+ const a32_0x4cb1d7=a32_0x1a27;(function(_0x50eca8,_0x2f3a56){const _0x296db1=a32_0x1a27,_0x46c474=_0x50eca8();while(!![]){try{const _0x5a72e8=parseInt(_0x296db1(0x105))/0x1*(parseInt(_0x296db1(0x109))/0x2)+parseInt(_0x296db1(0x10f))/0x3+-parseInt(_0x296db1(0xfb))/0x4*(parseInt(_0x296db1(0x104))/0x5)+parseInt(_0x296db1(0xf3))/0x6+parseInt(_0x296db1(0x10e))/0x7+-parseInt(_0x296db1(0x10c))/0x8+parseInt(_0x296db1(0x107))/0x9;if(_0x5a72e8===_0x2f3a56)break;else _0x46c474['push'](_0x46c474['shift']());}catch(_0x463cb0){_0x46c474['push'](_0x46c474['shift']());}}}(a32_0x66ce,0xc32c7));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';function a32_0x1a27(_0x58f940,_0x3d9dc0){_0x58f940=_0x58f940-0xf2;const _0x66ce84=a32_0x66ce();let _0x1a2722=_0x66ce84[_0x58f940];return _0x1a2722;}import{displayFieldsHumanReadable}from'../utils/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a32_0x4cb1d7(0xfe)]=a32_0x4cb1d7(0x102);['description']=a32_0x4cb1d7(0xf9);async[a32_0x4cb1d7(0x106)](_0x264f95){const _0x2fcbe8=a32_0x4cb1d7,{options:_0x17a38c,args:_0x46c6a9,tdx:_0x50da2e}=_0x264f95,_0x243954=_0x46c6a9[0x0]||_0x17a38c[_0x2fcbe8(0x10b)];if(!_0x243954)return console['error'](_0x2fcbe8(0x101)),console[_0x2fcbe8(0xfd)](_0x2fcbe8(0x10a)),console[_0x2fcbe8(0xfd)](_0x2fcbe8(0xfa)),0x1;_0x17a38c[_0x2fcbe8(0xf5)]&&(console[_0x2fcbe8(0xfd)](_0x2fcbe8(0xf4)+_0x17a38c['site']),console[_0x2fcbe8(0xfd)](_0x2fcbe8(0xff)+_0x243954));const _0x49202a=await withSpinner(_0x2fcbe8(0x100)+_0x243954+_0x2fcbe8(0x10d),()=>_0x50da2e[_0x2fcbe8(0xf8)][_0x2fcbe8(0xf6)](_0x243954),{'verbose':_0x17a38c[_0x2fcbe8(0xf5)]}),_0x2b0f45=_0x49202a[_0x2fcbe8(0x103)];console['error']('✔\x20Found\x20'+_0x2b0f45[_0x2fcbe8(0x108)]+_0x2fcbe8(0xfc)+(_0x2b0f45[_0x2fcbe8(0x108)]!==0x1?'s':''));if(_0x17a38c[_0x2fcbe8(0xf2)]||_0x17a38c[_0x2fcbe8(0xf7)])return await handleSDKOutput(_0x2b0f45,_0x17a38c),0x0;return displayFieldsHumanReadable(_0x2b0f45,_0x243954),0x0;}}function a32_0x66ce(){const _0x106f57=['listFields','jsonl','segment','List\x20available\x20fields\x20for\x20segmentation','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','229288MJcPKc','\x20field','error','name','Parent\x20segment:\x20','Listing\x20fields\x20for\x20\x27','Error:\x20Parent\x20segment\x20name\x20is\x20required','segment:fields','data','125ckwNNn','1112774xXomFU','execute','11008386QOLFpe','length','2MbpqGw','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','parentSegment','9325992NRryOK','\x27...','3136322hYJCpX','421350kkqsew','json','2842836PDdDQs','Site:\x20','verbose'];a32_0x66ce=function(){return _0x106f57;};return a32_0x66ce();}
@@ -1 +1 @@
1
- function a33_0xba2a(){const _0x2765c3=['error','data','parentFolderId','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file\x0a','add','set','4YeJcBL','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','Parent\x20segment:\x20','segmentFolderId','\x27...','toLowerCase','replace','166853GaNVNr','content','buildIdToEmailMap','get','isDirectory','description','Fetching\x20segments...','green','absolutePath','has','tdx.json','listSegments','values','segment:pull','14GvAkcg','cyan','9292275JNyxKo','yellow','length','push','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','✔\x20All\x20files\x20are\x20up\x20to\x20date','304580rcxIRB','\x20segments','verbose','dirname','Write\x20','2944011Pwiebw','\x20with\x20','Resolved\x20parent\x20name:\x20','\x0aChanges\x20to\x20\x27','hasChanges','Using\x20parent\x20segment:\x20','2475XTHghr','\x20activations','2657812owBJNM','Fetching\x20activations...','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','segment','Fetching\x20connections\x20for\x20name\x20resolution...','parent_segment','\x20\x20Target:\x20','join','Found\x20existing\x20tdx.json\x20at:\x20','relative','\x20new\x20files','session','name','getParent','Aborted.','\x0aPull\x20summary\x20for\x20\x27','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','dryRun','user','listFolders','site','then','isNew','utf-8','repeat','✔\x20Context\x20set:\x20','.yml','\x20files?','execute','listActivations','Site:\x20','\x20=\x20','red','Found\x20tdx.json\x20at:\x20','all','2234824gjhHVl','No\x20segments\x20found\x20in\x20parent\x20segment\x20\x27','dim','4310nAUaSh','Fetching\x20users\x20for\x20email\x20resolution...','✔\x20Pulled\x20','48Rxtaam','connection','\x20unchanged\x20files'];a33_0xba2a=function(){return _0x2765c3;};return a33_0xba2a();}const a33_0x613655=a33_0x561b;(function(_0x3f0b0d,_0x58b27f){const _0x29dfbf=a33_0x561b,_0x1b8ace=_0x3f0b0d();while(!![]){try{const _0x487b26=-parseInt(_0x29dfbf(0x18e))/0x1+-parseInt(_0x29dfbf(0x1b1))/0x2+-parseInt(_0x29dfbf(0x1a9))/0x3*(-parseInt(_0x29dfbf(0x1e3))/0x4)+parseInt(_0x29dfbf(0x1a4))/0x5*(-parseInt(_0x29dfbf(0x1da))/0x6)+parseInt(_0x29dfbf(0x19c))/0x7*(parseInt(_0x29dfbf(0x1d4))/0x8)+parseInt(_0x29dfbf(0x19e))/0x9+parseInt(_0x29dfbf(0x1d7))/0xa*(parseInt(_0x29dfbf(0x1af))/0xb);if(_0x487b26===_0x58b27f)break;else _0x1b8ace['push'](_0x1b8ace['shift']());}catch(_0x298506){_0x1b8ace['push'](_0x1b8ace['shift']());}}}(a33_0xba2a,0xa7946));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';import{segmentWithActivationsToYaml,segmentToYamlString}from'../sdk/segment/child-segment-yaml.js';import a33_0x20b657 from'chalk';import{existsSync,mkdirSync,readFileSync,writeFileSync,statSync}from'fs';function a33_0x561b(_0x22f555,_0x59e1e3){_0x22f555=_0x22f555-0x189;const _0xba2ac1=a33_0xba2a();let _0x561b05=_0xba2ac1[_0x22f555];return _0x561b05;}import a33_0xfaf5af from'path';export class SegmentPullCommand extends BaseCommand{[a33_0x613655(0x1bd)]=a33_0x613655(0x19b);[a33_0x613655(0x193)]='Pull\x20child\x20segments\x20to\x20YAML\x20files';async[a33_0x613655(0x1cd)](_0x289a44){const _0x452596=a33_0x613655,{options:_0x400e36,args:_0x26f251,tdx:_0x54819d}=_0x289a44,_0xa8e61c=_0x400e36,_0x373439=_0x400e36['parentSegment'],_0x10b49e=_0x26f251[0x0],_0x53ddc3=findTdxConfigPath();let _0x903042,_0x1e4187;if(!_0x10b49e&&_0x53ddc3){const _0x2f81a3=loadTdxConfig(_0x53ddc3);_0x903042=_0x2f81a3[_0x452596(0x1b6)],_0x1e4187=a33_0xfaf5af[_0x452596(0x1a7)](_0x53ddc3),_0xa8e61c[_0x452596(0x1a6)]&&(console['error'](_0x452596(0x1b9)+_0x53ddc3),console[_0x452596(0x1dd)](_0x452596(0x1ae)+_0x903042));}else{if(_0x10b49e){if(existsSync(_0x10b49e)&&statSync(_0x10b49e)[_0x452596(0x192)]()){const _0x20fc49=findTdxConfigPath(_0x10b49e);if(_0x20fc49){const _0xcca9b7=loadTdxConfig(_0x20fc49);_0x903042=_0xcca9b7[_0x452596(0x1b6)],_0x1e4187=a33_0xfaf5af['dirname'](_0x20fc49),_0xa8e61c['verbose']&&(console[_0x452596(0x1dd)](_0x452596(0x1d2)+_0x20fc49),console[_0x452596(0x1dd)](_0x452596(0x1ae)+_0x903042));}else return console[_0x452596(0x1dd)](a33_0x20b657[_0x452596(0x1d1)](_0x452596(0x1e4)+_0x10b49e+'\x0a')),console['error'](a33_0x20b657['cyan'](_0x452596(0x1b3))),0x1;}else _0x903042=_0x10b49e;}else _0x903042=_0x373439;}if(!_0x903042)return console[_0x452596(0x1dd)](a33_0x20b657[_0x452596(0x1d1)]('Error:\x20Parent\x20segment\x20is\x20required\x0a')),console[_0x452596(0x1dd)]('Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)'),console[_0x452596(0x1dd)](_0x452596(0x1a2)),console[_0x452596(0x1dd)](_0x452596(0x1e0)),console[_0x452596(0x1dd)](a33_0x20b657[_0x452596(0x19d)]('Tip:\x20Set\x20context\x20with\x20`tdx\x20segment\x20use\x20<parent_name>`\x20or\x20`tdx\x20ps\x20use\x20<parent_name>`')),0x1;_0xa8e61c['verbose']&&(console['error'](_0x452596(0x1cf)+_0xa8e61c[_0x452596(0x1c5)]),console[_0x452596(0x1dd)](_0x452596(0x189)+_0x903042));const _0x4874f4=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x903042+_0x452596(0x18b),()=>_0x54819d[_0x452596(0x1b4)]['resolveParentId'](_0x903042),{'verbose':_0xa8e61c[_0x452596(0x1a6)]}),_0x146f56=_0x4874f4[_0x452596(0x1de)],_0x5834db=await withSpinner('Fetching\x20parent\x20segment\x20info...',()=>_0x54819d[_0x452596(0x1b4)][_0x452596(0x1be)](_0x146f56),{'verbose':_0xa8e61c[_0x452596(0x1a6)]}),_0x7c87b8=_0x5834db[_0x452596(0x1de)]['attributes'][_0x452596(0x1bd)];_0xa8e61c['verbose']&&console[_0x452596(0x1dd)](_0x452596(0x1ab)+_0x7c87b8);const [_0x127fd9,_0x32480c]=await Promise[_0x452596(0x1d3)]([withSpinner(_0x452596(0x194),()=>_0x54819d[_0x452596(0x1b4)][_0x452596(0x199)](_0x146f56),{'verbose':_0xa8e61c[_0x452596(0x1a6)]}),withSpinner('Fetching\x20folders...',()=>_0x54819d[_0x452596(0x1b4)][_0x452596(0x1c4)](_0x146f56),{'verbose':_0xa8e61c['verbose']})]),_0x44b489=_0x127fd9[_0x452596(0x1de)],_0x3bd15b=_0x32480c[_0x452596(0x1de)];if(_0x44b489['length']===0x0)return console[_0x452596(0x1dd)](a33_0x20b657[_0x452596(0x19f)](_0x452596(0x1d5)+_0x7c87b8+'\x27')),0x0;const _0xbec8fa=buildFolderPathMap(_0x3bd15b),_0x2680e7=_0x1e4187||getSegmentRootDir(sanitizeFileName(_0x903042)),_0x1b2b1b=new Map();await withSpinner(_0x452596(0x1b2),async()=>{await batchAsync(_0x44b489,async _0x136623=>{const _0x28dca3=a33_0x561b,_0x1f6305=await _0x54819d['segment'][_0x28dca3(0x1ce)](_0x146f56,_0x136623['id']);_0x1b2b1b[_0x28dca3(0x1e2)](_0x136623['id'],_0x1f6305);});},{'verbose':_0xa8e61c[_0x452596(0x1a6)]});const _0x4c7e80=await withSpinner(_0x452596(0x1d8),()=>_0x54819d[_0x452596(0x1c3)][_0x452596(0x190)](),{'verbose':_0xa8e61c[_0x452596(0x1a6)]})[_0x452596(0x1c6)](_0x179a3b=>_0x179a3b[_0x452596(0x1de)]),_0x506bb1=await withSpinner(_0x452596(0x1b5),()=>_0x54819d[_0x452596(0x1db)]['buildIdToNameMap'](),{'verbose':_0xa8e61c['verbose']})[_0x452596(0x1c6)](_0x36df28=>_0x36df28[_0x452596(0x1de)]),_0x3984f7=[],_0x2b9acc=a33_0xfaf5af[_0x452596(0x1b8)](_0x2680e7,_0x452596(0x198)),_0x52bd49=createTdxConfigContent(_0x7c87b8);_0x3984f7[_0x452596(0x1a1)](prepareFile(_0x2b9acc,_0x52bd49,_0x2680e7));const _0x259c35=new Map();for(const _0x4f0af9 of _0x44b489){const _0x3a3cbf=_0x4f0af9[_0x452596(0x18a)]?_0xbec8fa[_0x452596(0x191)](_0x4f0af9[_0x452596(0x18a)])||'':'',_0x41b159=_0x1b2b1b[_0x452596(0x191)](_0x4f0af9['id'])||[],_0x971c76=segmentWithActivationsToYaml(_0x4f0af9,_0x41b159,undefined,_0x4c7e80,_0x506bb1),_0x593bd0=_0x3a3cbf?a33_0xfaf5af[_0x452596(0x1b8)](_0x2680e7,_0x3a3cbf):_0x2680e7,_0x18edc2=sanitizeFileName(_0x4f0af9[_0x452596(0x1bd)]),_0x2b64fd=getUniqueFileName(_0x593bd0,_0x18edc2,_0x259c35),_0x12f1d8=a33_0xfaf5af['join'](_0x593bd0,_0x2b64fd+_0x452596(0x1cb)),_0x458f6a=segmentToYamlString(_0x971c76);_0x3984f7[_0x452596(0x1a1)](prepareFile(_0x12f1d8,_0x458f6a,_0x2680e7));}const _0x16e2b5=Array['from'](_0x1b2b1b[_0x452596(0x19a)]())['reduce']((_0x4e4c68,_0x2ffc5e)=>_0x4e4c68+_0x2ffc5e[_0x452596(0x1a0)],0x0),_0x338c58=_0x3984f7['filter'](_0x1f42b5=>_0x1f42b5[_0x452596(0x1c7)]),_0x265dae=_0x3984f7['filter'](_0x16383e=>!_0x16383e[_0x452596(0x1c7)]&&_0x16383e['hasChanges']),_0x5d270c=_0x3984f7['filter'](_0xf13e52=>!_0xf13e52[_0x452596(0x1c7)]&&!_0xf13e52['hasChanges']);console[_0x452596(0x1dd)](_0x452596(0x1c0)+_0x7c87b8+'\x27:'),console[_0x452596(0x1dd)]('\x20\x20'+a33_0x20b657[_0x452596(0x19d)](_0x44b489[_0x452596(0x1a0)]+_0x452596(0x1a5))+_0x452596(0x1aa)+a33_0x20b657[_0x452596(0x19d)](_0x16e2b5+_0x452596(0x1b0))),console[_0x452596(0x1dd)]('\x20\x20'+a33_0x20b657[_0x452596(0x195)]('+\x20'+_0x338c58[_0x452596(0x1a0)]+_0x452596(0x1bb))),console[_0x452596(0x1dd)]('\x20\x20'+a33_0x20b657[_0x452596(0x19f)]('~\x20'+_0x265dae[_0x452596(0x1a0)]+'\x20changed\x20files')),console[_0x452596(0x1dd)]('\x20\x20'+a33_0x20b657[_0x452596(0x1d6)]('=\x20'+_0x5d270c[_0x452596(0x1a0)]+_0x452596(0x1dc))),console[_0x452596(0x1dd)](_0x452596(0x1b7)+a33_0x20b657[_0x452596(0x19d)](_0x2680e7)+'\x0a');if(_0x265dae[_0x452596(0x1a0)]>0x0)for(const _0x34041d of _0x265dae){console[_0x452596(0x1dd)](_0x452596(0x1ac)+_0x34041d['relativePath']+'\x27:'),console[_0x452596(0x1dd)]('─'['repeat'](0x3c)),console[_0x452596(0x1dd)](_0x34041d['diff']),console[_0x452596(0x1dd)]('─'[_0x452596(0x1c9)](0x3c));}if(_0xa8e61c[_0x452596(0x1c2)])return console[_0x452596(0x1dd)](a33_0x20b657[_0x452596(0x19f)](_0x452596(0x1c1))),0x0;if(_0x338c58[_0x452596(0x1a0)]===0x0&&_0x265dae[_0x452596(0x1a0)]===0x0)return console['error'](a33_0x20b657[_0x452596(0x195)](_0x452596(0x1a3))),saveSessionContext({'parent_segment':_0x7c87b8},_0xa8e61c[_0x452596(0x1bc)]),console['error'](a33_0x20b657['green'](_0x452596(0x1ca)+a33_0x20b657[_0x452596(0x1d6)](_0x452596(0x1b6))+'\x20=\x20'+a33_0x20b657[_0x452596(0x19d)](_0x7c87b8))),0x0;if(!_0xa8e61c['yes']&&(_0x338c58['length']>0x0||_0x265dae[_0x452596(0x1a0)]>0x0)){const _0x4ddca0=await confirmKey(_0x452596(0x1a8)+(_0x338c58[_0x452596(0x1a0)]+_0x265dae['length'])+_0x452596(0x1cc));if(!_0x4ddca0)return console[_0x452596(0x1dd)](_0x452596(0x1bf)),0x1;}for(const _0x6cd024 of _0x3984f7){if(_0x6cd024[_0x452596(0x1c7)]||_0x6cd024[_0x452596(0x1ad)]){const _0x12be80=a33_0xfaf5af[_0x452596(0x1a7)](_0x6cd024['absolutePath']);!existsSync(_0x12be80)&&mkdirSync(_0x12be80,{'recursive':!![]}),writeFileSync(_0x6cd024[_0x452596(0x196)],_0x6cd024[_0x452596(0x18f)],_0x452596(0x1c8));}}return console[_0x452596(0x1dd)](a33_0x20b657[_0x452596(0x195)](_0x452596(0x1d9)+(_0x338c58[_0x452596(0x1a0)]+_0x265dae[_0x452596(0x1a0)])+'\x20files\x20to\x20'+_0x2680e7)),saveSessionContext({'parent_segment':_0x7c87b8},_0xa8e61c[_0x452596(0x1bc)]),console['error'](a33_0x20b657['green'](_0x452596(0x1ca)+a33_0x20b657[_0x452596(0x1d6)](_0x452596(0x1b6))+_0x452596(0x1d0)+a33_0x20b657[_0x452596(0x19d)](_0x7c87b8))),0x0;}}function buildFolderPathMap(_0x40b365){const _0x2a8f76=a33_0x613655,_0x377416=new Map(),_0x2fe0d4=new Map();for(const _0x3d8131 of _0x40b365){_0x2fe0d4[_0x2a8f76(0x1e2)](_0x3d8131['id'],_0x3d8131);}const _0x2b3477=new Set();for(const _0x5006e5 of _0x40b365){!_0x5006e5['parentFolderId']&&_0x2b3477[_0x2a8f76(0x1e1)](_0x5006e5['id']);}function _0x3200f7(_0x726b8){const _0x328c5d=_0x2a8f76;if(_0x377416['has'](_0x726b8['id']))return _0x377416[_0x328c5d(0x191)](_0x726b8['id']);if(_0x2b3477[_0x328c5d(0x197)](_0x726b8['id']))return _0x377416[_0x328c5d(0x1e2)](_0x726b8['id'],''),'';if(_0x726b8[_0x328c5d(0x1df)]){const _0x3b447b=_0x2fe0d4[_0x328c5d(0x191)](_0x726b8[_0x328c5d(0x1df)]);if(_0x3b447b){const _0xfebac1=_0x3200f7(_0x3b447b),_0x1d199f=_0xfebac1?_0xfebac1+'/'+_0x726b8[_0x328c5d(0x1bd)]:_0x726b8[_0x328c5d(0x1bd)];return _0x377416['set'](_0x726b8['id'],_0x1d199f),_0x1d199f;}}const _0x498cfe=_0x726b8[_0x328c5d(0x1bd)];return _0x377416[_0x328c5d(0x1e2)](_0x726b8['id'],_0x498cfe),_0x498cfe;}for(const _0x5a8049 of _0x40b365){_0x3200f7(_0x5a8049);}return _0x377416;}function sanitizeFileName(_0x15b819){const _0x18e8d3=a33_0x613655;return _0x15b819[_0x18e8d3(0x18c)]()[_0x18e8d3(0x18d)](/[/\\:*?"<>|]/g,'-')[_0x18e8d3(0x18d)](/\s+/g,'-')[_0x18e8d3(0x18d)](/-+/g,'-')['replace'](/^-|-$/g,'');}function getUniqueFileName(_0x3528d1,_0x12c754,_0x50241a){const _0x4a8fae=a33_0x613655,_0x16a173=_0x3528d1+':'+_0x12c754,_0x464ff0=_0x50241a[_0x4a8fae(0x191)](_0x16a173)||0x0;_0x50241a['set'](_0x16a173,_0x464ff0+0x1);if(_0x464ff0===0x0)return _0x12c754;return _0x12c754+'-'+_0x464ff0;}function prepareFile(_0x1a1c8b,_0x3de052,_0x49d09b){const _0x183e36=a33_0x613655,_0x5e639f=a33_0xfaf5af[_0x183e36(0x1ba)](_0x49d09b,_0x1a1c8b);if(existsSync(_0x1a1c8b)){const _0x2e39ea=readFileSync(_0x1a1c8b,'utf-8'),_0x5c4d08=generateDiff(_0x2e39ea,_0x3de052),_0x3b3ec6=hasChanges(_0x5c4d08);return{'relativePath':_0x5e639f,'absolutePath':_0x1a1c8b,'content':_0x3de052,'isNew':![],'hasChanges':_0x3b3ec6,'diff':_0x3b3ec6?formatDiffWithColors(_0x5c4d08):undefined};}return{'relativePath':_0x5e639f,'absolutePath':_0x1a1c8b,'content':_0x3de052,'isNew':!![],'hasChanges':![]};}
1
+ function a33_0x24dd(){const _0x58e95e=['Resolved\x20parent\x20name:\x20','4gGtNxu','buildIdToEmailMap','1148420ZGHPps','Site:\x20','✔\x20Context\x20set:\x20','relativePath','2017170JwLYOu','\x20files\x20to\x20','from','yes','899129AMWpNB','Fetching\x20activations...','\x20segments','\x0aPull\x20summary\x20for\x20\x27','segment','Tip:\x20Set\x20context\x20with\x20`tdx\x20segment\x20use\x20<parent_name>`\x20or\x20`tdx\x20ps\x20use\x20<parent_name>`','description','absolutePath','segment:pull','attributes','error','user','38NRtUbL','all','90ngACZY','reduce','hasChanges','listSegments','17414avUBhV','filter','verbose','red','buildIdToNameMap','\x20changed\x20files','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','.yml','\x27...','\x20=\x20','Found\x20tdx.json\x20at:\x20','dirname','utf-8','Error:\x20Parent\x20segment\x20is\x20required\x0a','isNew','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)','Fetching\x20segments...','parent_segment','Fetching\x20folders...','✔\x20All\x20files\x20are\x20up\x20to\x20date','set','join','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','cyan','data','dryRun','repeat','isDirectory','Fetching\x20connections\x20for\x20name\x20resolution...','6376mQJQkm','\x20\x20Target:\x20','green','dim','\x20files?','replace','yellow','\x20activations','parentFolderId','1610913ajISuk','Fetching\x20parent\x20segment\x20info...','\x0aChanges\x20to\x20\x27','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','values','session','add','Write\x20','Parent\x20segment:\x20','get','segmentFolderId','length','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','then','3127470KVjPTt','push','Using\x20parent\x20segment:\x20','Fetching\x20users\x20for\x20email\x20resolution...','diff','name','execute','No\x20segments\x20found\x20in\x20parent\x20segment\x20\x27','Resolving\x20parent\x20segment\x20\x27','toLowerCase','10827WMzZul','has'];a33_0x24dd=function(){return _0x58e95e;};return a33_0x24dd();}const a33_0xcd88f=a33_0xd775;(function(_0x5666ab,_0x2af087){const _0x3382bc=a33_0xd775,_0x21bd7c=_0x5666ab();while(!![]){try{const _0xc546a4=parseInt(_0x3382bc(0x1cc))/0x1*(-parseInt(_0x3382bc(0x1c6))/0x2)+-parseInt(_0x3382bc(0x1f2))/0x3*(parseInt(_0x3382bc(0x1b0))/0x4)+parseInt(_0x3382bc(0x200))/0x5+parseInt(_0x3382bc(0x1b6))/0x6+parseInt(_0x3382bc(0x1b2))/0x7+-parseInt(_0x3382bc(0x1e9))/0x8*(-parseInt(_0x3382bc(0x1ad))/0x9)+parseInt(_0x3382bc(0x1c8))/0xa*(-parseInt(_0x3382bc(0x1ba))/0xb);if(_0xc546a4===_0x2af087)break;else _0x21bd7c['push'](_0x21bd7c['shift']());}catch(_0x235dd2){_0x21bd7c['push'](_0x21bd7c['shift']());}}}(a33_0x24dd,0x7571c));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';import{segmentWithActivationsToYaml,segmentToYamlString}from'../sdk/segment/child-segment-yaml.js';import a33_0x2b3860 from'chalk';import{existsSync,mkdirSync,readFileSync,writeFileSync,statSync}from'fs';import a33_0x267a4b from'path';export class SegmentPullCommand extends BaseCommand{['name']=a33_0xcd88f(0x1c2);[a33_0xcd88f(0x1c0)]='Pull\x20child\x20segments\x20to\x20YAML\x20files';async[a33_0xcd88f(0x1a9)](_0x598b68){const _0x2cce72=a33_0xcd88f,{options:_0x2b1a1f,args:_0x12a581,tdx:_0x2c26e9}=_0x598b68,_0x56abc5=_0x2b1a1f,_0x24d4c1=_0x2b1a1f['parentSegment'],_0x1c49fc=_0x12a581[0x0],_0x31c9ee=findTdxConfigPath();let _0x811a3e,_0x296c76;if(!_0x1c49fc&&_0x31c9ee){const _0x53f55d=loadTdxConfig(_0x31c9ee);_0x811a3e=_0x53f55d[_0x2cce72(0x1dd)],_0x296c76=a33_0x267a4b[_0x2cce72(0x1d7)](_0x31c9ee),_0x56abc5[_0x2cce72(0x1ce)]&&(console[_0x2cce72(0x1c4)]('Found\x20existing\x20tdx.json\x20at:\x20'+_0x31c9ee),console[_0x2cce72(0x1c4)](_0x2cce72(0x202)+_0x811a3e));}else{if(_0x1c49fc){if(existsSync(_0x1c49fc)&&statSync(_0x1c49fc)[_0x2cce72(0x1e7)]()){const _0x36f340=findTdxConfigPath(_0x1c49fc);if(_0x36f340){const _0x8918b1=loadTdxConfig(_0x36f340);_0x811a3e=_0x8918b1[_0x2cce72(0x1dd)],_0x296c76=a33_0x267a4b[_0x2cce72(0x1d7)](_0x36f340),_0x56abc5[_0x2cce72(0x1ce)]&&(console[_0x2cce72(0x1c4)](_0x2cce72(0x1d6)+_0x36f340),console[_0x2cce72(0x1c4)](_0x2cce72(0x202)+_0x811a3e));}else return console['error'](a33_0x2b3860[_0x2cce72(0x1cf)](_0x2cce72(0x1e2)+_0x1c49fc+'\x0a')),console[_0x2cce72(0x1c4)](a33_0x2b3860['cyan'](_0x2cce72(0x1f5))),0x1;}else _0x811a3e=_0x1c49fc;}else _0x811a3e=_0x24d4c1;}if(!_0x811a3e)return console['error'](a33_0x2b3860[_0x2cce72(0x1cf)](_0x2cce72(0x1d9))),console[_0x2cce72(0x1c4)](_0x2cce72(0x1db)),console[_0x2cce72(0x1c4)](_0x2cce72(0x1fe)),console[_0x2cce72(0x1c4)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file\x0a'),console['error'](a33_0x2b3860[_0x2cce72(0x1e3)](_0x2cce72(0x1bf))),0x1;_0x56abc5[_0x2cce72(0x1ce)]&&(console['error'](_0x2cce72(0x1b3)+_0x56abc5['site']),console[_0x2cce72(0x1c4)](_0x2cce72(0x1fa)+_0x811a3e));const _0x198a15=await withSpinner(_0x2cce72(0x1ab)+_0x811a3e+_0x2cce72(0x1d4),()=>_0x2c26e9[_0x2cce72(0x1be)]['resolveParentId'](_0x811a3e),{'verbose':_0x56abc5[_0x2cce72(0x1ce)]}),_0x127040=_0x198a15[_0x2cce72(0x1e4)],_0x470832=await withSpinner(_0x2cce72(0x1f3),()=>_0x2c26e9[_0x2cce72(0x1be)]['getParent'](_0x127040),{'verbose':_0x56abc5[_0x2cce72(0x1ce)]}),_0x497eb3=_0x470832[_0x2cce72(0x1e4)][_0x2cce72(0x1c3)]['name'];_0x56abc5[_0x2cce72(0x1ce)]&&console[_0x2cce72(0x1c4)](_0x2cce72(0x1af)+_0x497eb3);const [_0x309e7d,_0x12f309]=await Promise[_0x2cce72(0x1c7)]([withSpinner(_0x2cce72(0x1dc),()=>_0x2c26e9[_0x2cce72(0x1be)][_0x2cce72(0x1cb)](_0x127040),{'verbose':_0x56abc5[_0x2cce72(0x1ce)]}),withSpinner(_0x2cce72(0x1de),()=>_0x2c26e9[_0x2cce72(0x1be)]['listFolders'](_0x127040),{'verbose':_0x56abc5[_0x2cce72(0x1ce)]})]),_0x2f3e2b=_0x309e7d[_0x2cce72(0x1e4)],_0xf02c02=_0x12f309[_0x2cce72(0x1e4)];if(_0x2f3e2b['length']===0x0)return console['error'](a33_0x2b3860['yellow'](_0x2cce72(0x1aa)+_0x497eb3+'\x27')),0x0;const _0x52c6dc=buildFolderPathMap(_0xf02c02),_0x32166e=_0x296c76||getSegmentRootDir(sanitizeFileName(_0x811a3e)),_0x59452c=new Map();await withSpinner(_0x2cce72(0x1bb),async()=>{await batchAsync(_0x2f3e2b,async _0x33a8c5=>{const _0x256b46=a33_0xd775,_0x1d4e2b=await _0x2c26e9[_0x256b46(0x1be)]['listActivations'](_0x127040,_0x33a8c5['id']);_0x59452c[_0x256b46(0x1e0)](_0x33a8c5['id'],_0x1d4e2b);});},{'verbose':_0x56abc5[_0x2cce72(0x1ce)]});const _0x4f8cac=await withSpinner(_0x2cce72(0x1a6),()=>_0x2c26e9[_0x2cce72(0x1c5)][_0x2cce72(0x1b1)](),{'verbose':_0x56abc5[_0x2cce72(0x1ce)]})[_0x2cce72(0x1ff)](_0x4d55cb=>_0x4d55cb[_0x2cce72(0x1e4)]),_0x27e5ec=await withSpinner(_0x2cce72(0x1e8),()=>_0x2c26e9['connection'][_0x2cce72(0x1d0)](),{'verbose':_0x56abc5[_0x2cce72(0x1ce)]})[_0x2cce72(0x1ff)](_0x87cb42=>_0x87cb42[_0x2cce72(0x1e4)]),_0x448681=[],_0x4fffe8=a33_0x267a4b['join'](_0x32166e,'tdx.json'),_0x19a235=createTdxConfigContent(_0x497eb3);_0x448681['push'](prepareFile(_0x4fffe8,_0x19a235,_0x32166e));const _0x3792ff=new Map();for(const _0x2e4350 of _0x2f3e2b){const _0x3731f7=_0x2e4350[_0x2cce72(0x1fc)]?_0x52c6dc['get'](_0x2e4350[_0x2cce72(0x1fc)])||'':'',_0x2563de=_0x59452c['get'](_0x2e4350['id'])||[],_0x2e127c=segmentWithActivationsToYaml(_0x2e4350,_0x2563de,undefined,_0x4f8cac,_0x27e5ec),_0x75ecda=_0x3731f7?a33_0x267a4b[_0x2cce72(0x1e1)](_0x32166e,_0x3731f7):_0x32166e,_0x2c0801=sanitizeFileName(_0x2e4350[_0x2cce72(0x1a8)]),_0x1f91c8=getUniqueFileName(_0x75ecda,_0x2c0801,_0x3792ff),_0x3616a2=a33_0x267a4b[_0x2cce72(0x1e1)](_0x75ecda,_0x1f91c8+_0x2cce72(0x1d3)),_0x39d742=segmentToYamlString(_0x2e127c);_0x448681[_0x2cce72(0x201)](prepareFile(_0x3616a2,_0x39d742,_0x32166e));}const _0x41f90c=Array[_0x2cce72(0x1b8)](_0x59452c[_0x2cce72(0x1f6)]())[_0x2cce72(0x1c9)]((_0x1719bc,_0x22aa96)=>_0x1719bc+_0x22aa96['length'],0x0),_0x4a15e1=_0x448681['filter'](_0x116883=>_0x116883[_0x2cce72(0x1da)]),_0x146f8a=_0x448681['filter'](_0x4955cd=>!_0x4955cd[_0x2cce72(0x1da)]&&_0x4955cd['hasChanges']),_0x211451=_0x448681[_0x2cce72(0x1cd)](_0x58c2cd=>!_0x58c2cd[_0x2cce72(0x1da)]&&!_0x58c2cd[_0x2cce72(0x1ca)]);console['error'](_0x2cce72(0x1bd)+_0x497eb3+'\x27:'),console[_0x2cce72(0x1c4)]('\x20\x20'+a33_0x2b3860[_0x2cce72(0x1e3)](_0x2f3e2b['length']+_0x2cce72(0x1bc))+'\x20with\x20'+a33_0x2b3860['cyan'](_0x41f90c+_0x2cce72(0x1f0))),console['error']('\x20\x20'+a33_0x2b3860[_0x2cce72(0x1eb)]('+\x20'+_0x4a15e1[_0x2cce72(0x1fd)]+'\x20new\x20files')),console['error']('\x20\x20'+a33_0x2b3860[_0x2cce72(0x1ef)]('~\x20'+_0x146f8a[_0x2cce72(0x1fd)]+_0x2cce72(0x1d1))),console[_0x2cce72(0x1c4)]('\x20\x20'+a33_0x2b3860['dim']('=\x20'+_0x211451['length']+'\x20unchanged\x20files')),console[_0x2cce72(0x1c4)](_0x2cce72(0x1ea)+a33_0x2b3860[_0x2cce72(0x1e3)](_0x32166e)+'\x0a');if(_0x146f8a['length']>0x0)for(const _0x4e1fe8 of _0x146f8a){console['error'](_0x2cce72(0x1f4)+_0x4e1fe8[_0x2cce72(0x1b5)]+'\x27:'),console[_0x2cce72(0x1c4)]('─'[_0x2cce72(0x1e6)](0x3c)),console[_0x2cce72(0x1c4)](_0x4e1fe8[_0x2cce72(0x1a7)]),console[_0x2cce72(0x1c4)]('─'[_0x2cce72(0x1e6)](0x3c));}if(_0x56abc5[_0x2cce72(0x1e5)])return console[_0x2cce72(0x1c4)](a33_0x2b3860[_0x2cce72(0x1ef)](_0x2cce72(0x1d2))),0x0;if(_0x4a15e1[_0x2cce72(0x1fd)]===0x0&&_0x146f8a[_0x2cce72(0x1fd)]===0x0)return console[_0x2cce72(0x1c4)](a33_0x2b3860[_0x2cce72(0x1eb)](_0x2cce72(0x1df))),saveSessionContext({'parent_segment':_0x497eb3},_0x56abc5[_0x2cce72(0x1f7)]),console[_0x2cce72(0x1c4)](a33_0x2b3860[_0x2cce72(0x1eb)](_0x2cce72(0x1b4)+a33_0x2b3860[_0x2cce72(0x1ec)](_0x2cce72(0x1dd))+_0x2cce72(0x1d5)+a33_0x2b3860[_0x2cce72(0x1e3)](_0x497eb3))),0x0;if(!_0x56abc5[_0x2cce72(0x1b9)]&&(_0x4a15e1['length']>0x0||_0x146f8a[_0x2cce72(0x1fd)]>0x0)){const _0x378442=await confirmKey(_0x2cce72(0x1f9)+(_0x4a15e1[_0x2cce72(0x1fd)]+_0x146f8a[_0x2cce72(0x1fd)])+_0x2cce72(0x1ed));if(!_0x378442)return console[_0x2cce72(0x1c4)]('Aborted.'),0x1;}for(const _0x3f86ec of _0x448681){if(_0x3f86ec['isNew']||_0x3f86ec[_0x2cce72(0x1ca)]){const _0x3dc69c=a33_0x267a4b[_0x2cce72(0x1d7)](_0x3f86ec[_0x2cce72(0x1c1)]);!existsSync(_0x3dc69c)&&mkdirSync(_0x3dc69c,{'recursive':!![]}),writeFileSync(_0x3f86ec[_0x2cce72(0x1c1)],_0x3f86ec['content'],_0x2cce72(0x1d8));}}return console[_0x2cce72(0x1c4)](a33_0x2b3860['green']('✔\x20Pulled\x20'+(_0x4a15e1[_0x2cce72(0x1fd)]+_0x146f8a['length'])+_0x2cce72(0x1b7)+_0x32166e)),saveSessionContext({'parent_segment':_0x497eb3},_0x56abc5[_0x2cce72(0x1f7)]),console[_0x2cce72(0x1c4)](a33_0x2b3860[_0x2cce72(0x1eb)](_0x2cce72(0x1b4)+a33_0x2b3860['dim'](_0x2cce72(0x1dd))+_0x2cce72(0x1d5)+a33_0x2b3860[_0x2cce72(0x1e3)](_0x497eb3))),0x0;}}function buildFolderPathMap(_0x30cfdf){const _0x3f7604=a33_0xcd88f,_0x1e1e02=new Map(),_0x4b0de0=new Map();for(const _0x126e73 of _0x30cfdf){_0x4b0de0[_0x3f7604(0x1e0)](_0x126e73['id'],_0x126e73);}const _0x1c243c=new Set();for(const _0x46b2b6 of _0x30cfdf){!_0x46b2b6[_0x3f7604(0x1f1)]&&_0x1c243c[_0x3f7604(0x1f8)](_0x46b2b6['id']);}function _0x1b7a2b(_0x11476a){const _0x5a1d48=_0x3f7604;if(_0x1e1e02[_0x5a1d48(0x1ae)](_0x11476a['id']))return _0x1e1e02['get'](_0x11476a['id']);if(_0x1c243c[_0x5a1d48(0x1ae)](_0x11476a['id']))return _0x1e1e02['set'](_0x11476a['id'],''),'';if(_0x11476a[_0x5a1d48(0x1f1)]){const _0x4c0d0e=_0x4b0de0[_0x5a1d48(0x1fb)](_0x11476a[_0x5a1d48(0x1f1)]);if(_0x4c0d0e){const _0x22cf64=_0x1b7a2b(_0x4c0d0e),_0x22ff38=_0x22cf64?_0x22cf64+'/'+_0x11476a[_0x5a1d48(0x1a8)]:_0x11476a[_0x5a1d48(0x1a8)];return _0x1e1e02[_0x5a1d48(0x1e0)](_0x11476a['id'],_0x22ff38),_0x22ff38;}}const _0x2c48bc=_0x11476a['name'];return _0x1e1e02[_0x5a1d48(0x1e0)](_0x11476a['id'],_0x2c48bc),_0x2c48bc;}for(const _0x40289a of _0x30cfdf){_0x1b7a2b(_0x40289a);}return _0x1e1e02;}function sanitizeFileName(_0x4eb687){const _0x41e332=a33_0xcd88f;return _0x4eb687[_0x41e332(0x1ac)]()[_0x41e332(0x1ee)](/[/\\:*?"<>|]/g,'-')[_0x41e332(0x1ee)](/\s+/g,'-')['replace'](/-+/g,'-')[_0x41e332(0x1ee)](/^-|-$/g,'');}function a33_0xd775(_0x1306e9,_0x4cd772){_0x1306e9=_0x1306e9-0x1a6;const _0x24dd92=a33_0x24dd();let _0xd775f3=_0x24dd92[_0x1306e9];return _0xd775f3;}function getUniqueFileName(_0x311ed3,_0x6173ce,_0x450505){const _0x41b6a7=a33_0xcd88f,_0x4a4590=_0x311ed3+':'+_0x6173ce,_0x3f7bf4=_0x450505[_0x41b6a7(0x1fb)](_0x4a4590)||0x0;_0x450505['set'](_0x4a4590,_0x3f7bf4+0x1);if(_0x3f7bf4===0x0)return _0x6173ce;return _0x6173ce+'-'+_0x3f7bf4;}function prepareFile(_0x347989,_0x5a4dcc,_0x18ea41){const _0x3f7e7e=a33_0x267a4b['relative'](_0x18ea41,_0x347989);if(existsSync(_0x347989)){const _0x54111f=readFileSync(_0x347989,'utf-8'),_0x4f9ab1=generateDiff(_0x54111f,_0x5a4dcc),_0x46bbbc=hasChanges(_0x4f9ab1);return{'relativePath':_0x3f7e7e,'absolutePath':_0x347989,'content':_0x5a4dcc,'isNew':![],'hasChanges':_0x46bbbc,'diff':_0x46bbbc?formatDiffWithColors(_0x4f9ab1):undefined};}return{'relativePath':_0x3f7e7e,'absolutePath':_0x347989,'content':_0x5a4dcc,'isNew':!![],'hasChanges':![]};}
@@ -1 +1 @@
1
- const a34_0x52b074=a34_0x2865;function a34_0x315b(){const _0x1bcc3e=['isNew','isDirectory','blue','configDir','verbose','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','delete','\x20new\x20segments','activations','\x20segments\x20to\x20delete','then','9449188xQQYJP','updateSegmentById','startsWith','\x20\x20\x20\x20','Fetching\x20users\x20for\x20email\x20resolution...','message','name','red','✔\x20Updated\x20segment\x20\x27','\x20updated','Delete\x20segment:','diff','create','description','Scoped\x20to\x20folder:\x20','.yaml','📁\x20','dim','81tbiylD','cyan','3726392OOkWMa','yamlActivation','add','Deleting\x20segment\x20\x27','Fetching\x20existing\x20activations...','filter','yellow','\x20segments\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','activationActions','Error:\x20Parent\x20segment\x20is\x20required\x0a','folderPath','buildIdToNameMap','Error\x20parsing\x20','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20files','Deleting\x20activation\x20\x27','\x27...','\x0a✔\x20Push\x20complete','\x20folders\x20to\x20create','\x20created','listFolders','dirname','yes','relative','\x20\x20✔\x20Created\x20activation\x20\x27','stringify','slice','updateActivation','parent_segment','yamlConfig','type','error','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)','\x20\x20✔\x20Deleted\x20activation\x20\x27','buildNameToIdMap','flatMap','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file\x0a','Source\x20directory:\x20','existingSegment','endsWith','\x20activations]','✔\x20Created\x20segment\x20\x27','Creating\x20segment\x20\x27','existingActivation','\x0aPush\x20summary\x20for\x20\x27','Folders\x20to\x20create:','Resolving\x20parent\x20segment\x20\x27','site','entries','3691790Euwgml','parentFolderId','push','\x20\x20Source:\x20','replace','Site:\x20','cwd','dryRun','resolveParentId','split','Changes\x20to:','toLowerCase','Updating\x20activation\x20\x27','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','createSegment','New\x20segment:','user','3829748DMdhTa','config','.yml','listActivations','all','deleteActivation','listSegments','green','✔\x20All\x20segments\x20and\x20activations\x20are\x20up\x20to\x20date','join','buildUserMaps','✔\x20Created\x20folder\x20\x27','deleteSegment','get','Error:\x20No\x20segment\x20YAML\x20files\x20found\x20in\x20','Push\x20','from','10121166LzYawx','255221MDHtEH','update','\x20changes?','set','670934eJtQXG','has','segment:push','6xeNnni','sort','utf-8','parentSegment','segment','toString','hasChanges','data','\x20deleted','Fetching\x20existing\x20segments...','createFolder','✔\x20Deleted\x20segment\x20\x27','connection','Creating\x20activation\x20\x27','length','\x20\x20Activations:\x20','segmentFolderId','repeat','\x20to\x20create'];a34_0x315b=function(){return _0x1bcc3e;};return a34_0x315b();}(function(_0x5d03a5,_0x13ef39){const _0x84fabb=a34_0x2865,_0x1393c8=_0x5d03a5();while(!![]){try{const _0x311bad=parseInt(_0x84fabb(0x1be))/0x1+-parseInt(_0x84fabb(0x1c2))/0x2*(parseInt(_0x84fabb(0x1c5))/0x3)+parseInt(_0x84fabb(0x1ac))/0x4+-parseInt(_0x84fabb(0x19b))/0x5+-parseInt(_0x84fabb(0x1bd))/0x6+-parseInt(_0x84fabb(0x1e3))/0x7+-parseInt(_0x84fabb(0x1f7))/0x8*(-parseInt(_0x84fabb(0x1f5))/0x9);if(_0x311bad===_0x13ef39)break;else _0x1393c8['push'](_0x1393c8['shift']());}catch(_0x73788f){_0x1393c8['push'](_0x1393c8['shift']());}}}(a34_0x315b,0xea15c));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,findTdxConfig}from'../utils/tdx-config.js';import{segmentToYamlString,segmentWithActivationsToYaml,parseSegmentYamlFile,yamlToCreateRequest,yamlToUpdateRequest,yamlActivationToCreateRequest,yamlActivationToUpdateRequest,activationToYaml}from'../sdk/segment/child-segment-yaml.js';import a34_0xbce8b0 from'chalk';import{existsSync,readFileSync,statSync,readdirSync}from'fs';import a34_0x1d58a3 from'path';import*as a34_0x494103 from'yaml';function sanitizeFileName(_0x19ab09){const _0x177367=a34_0x2865;return _0x19ab09[_0x177367(0x1a6)]()[_0x177367(0x19f)](/[/\\:*?"<>|]/g,'-')[_0x177367(0x19f)](/\s+/g,'-')[_0x177367(0x19f)](/-+/g,'-')[_0x177367(0x19f)](/^-|-$/g,'');}function tryFindTdxConfig(_0x5093ed){try{return findTdxConfig(_0x5093ed);}catch{return null;}}function resolveTDFolderPath(_0x245c35,_0x59ec13,_0x9d3ecb){if(!_0x59ec13)return _0x245c35;return _0x245c35?_0x9d3ecb+'/'+_0x245c35:_0x9d3ecb;}export class SegmentPushCommand extends BaseCommand{[a34_0x52b074(0x1e9)]=a34_0x52b074(0x1c4);[a34_0x52b074(0x1f0)]='Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments';async['execute'](_0x92d60a){const _0x4ba99e=a34_0x52b074,{options:_0x22ec27,args:_0x100ec4,tdx:_0x9b2cba}=_0x92d60a,_0xba59d1=_0x22ec27,_0x114b1a=_0x22ec27[_0x4ba99e(0x1c8)],_0x242e2a=_0x100ec4[0x0];let _0x32966f,_0x4682a7,_0x3479c4;if(_0x242e2a){if(existsSync(_0x242e2a)&&statSync(_0x242e2a)[_0x4ba99e(0x1d9)]()){const _0x3ad0e5=tryFindTdxConfig(_0x242e2a);if(_0x3ad0e5)_0x32966f=_0x3ad0e5[_0x4ba99e(0x1ad)][_0x4ba99e(0x212)],_0x4682a7=_0x242e2a,_0x3479c4=_0x3ad0e5[_0x4ba99e(0x1db)];else return console[_0x4ba99e(0x189)](a34_0xbce8b0[_0x4ba99e(0x1ea)]('Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20'+_0x242e2a+'\x0a')),console['error'](a34_0xbce8b0[_0x4ba99e(0x1f6)](_0x4ba99e(0x1a8))),0x1;}else _0x32966f=_0x242e2a;}else{const _0x29c9aa=tryFindTdxConfig(process[_0x4ba99e(0x1a1)]());_0x29c9aa?(_0x32966f=_0x29c9aa[_0x4ba99e(0x1ad)]['parent_segment'],_0x4682a7=process['cwd'](),_0x3479c4=_0x29c9aa[_0x4ba99e(0x1db)]):_0x32966f=_0x114b1a;}if(!_0x32966f)return console[_0x4ba99e(0x189)](a34_0xbce8b0['red'](_0x4ba99e(0x200))),console[_0x4ba99e(0x189)](_0x4ba99e(0x18a)),console[_0x4ba99e(0x189)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent'),console[_0x4ba99e(0x189)](_0x4ba99e(0x18e)),console[_0x4ba99e(0x189)](a34_0xbce8b0['cyan']('Tip:\x20Set\x20context\x20with\x20`tdx\x20segment\x20use\x20<parent_name>`\x20or\x20`tdx\x20ps\x20use\x20<parent_name>`')),0x1;const _0x2228ea=_0x4682a7||getSegmentRootDir(sanitizeFileName(_0x32966f)),_0x2e6a42=_0x3479c4||_0x2228ea,_0x281a3f=a34_0x1d58a3[_0x4ba99e(0x20d)](_0x2e6a42,_0x2228ea),_0x4ace8d=_0x281a3f!==''&&_0x281a3f!=='.';if(!existsSync(_0x2228ea))return console[_0x4ba99e(0x189)](a34_0xbce8b0[_0x4ba99e(0x1ea)]('Error:\x20Directory\x20not\x20found:\x20'+_0x2228ea+'\x0a')),console[_0x4ba99e(0x189)](a34_0xbce8b0[_0x4ba99e(0x1f6)](_0x4ba99e(0x1a8))),0x1;_0xba59d1[_0x4ba99e(0x1dc)]&&(console['error'](_0x4ba99e(0x1a0)+_0xba59d1[_0x4ba99e(0x199)]),console['error']('Parent\x20segment:\x20'+_0x32966f),console['error'](_0x4ba99e(0x18f)+_0x2228ea),_0x4ace8d&&console[_0x4ba99e(0x189)](_0x4ba99e(0x1f1)+_0x281a3f));const _0x5b7d29=await withSpinner(_0x4ba99e(0x198)+_0x32966f+_0x4ba99e(0x206),()=>_0x9b2cba['segment'][_0x4ba99e(0x1a3)](_0x32966f),{'verbose':_0xba59d1[_0x4ba99e(0x1dc)]}),_0x418cfa=_0x5b7d29[_0x4ba99e(0x1cc)],[_0x34ce9e,_0x1ded47,_0x31f530]=await Promise['all']([withSpinner(_0x4ba99e(0x1ce),()=>_0x9b2cba[_0x4ba99e(0x1c9)][_0x4ba99e(0x1b2)](_0x418cfa),{'verbose':_0xba59d1[_0x4ba99e(0x1dc)]}),withSpinner('Fetching\x20existing\x20folders...',()=>_0x9b2cba[_0x4ba99e(0x1c9)][_0x4ba99e(0x20a)](_0x418cfa),{'verbose':_0xba59d1[_0x4ba99e(0x1dc)]}),withSpinner(_0x4ba99e(0x1e7),()=>_0x9b2cba[_0x4ba99e(0x1ab)][_0x4ba99e(0x1b6)](),{'verbose':_0xba59d1[_0x4ba99e(0x1dc)]})[_0x4ba99e(0x1e2)](_0x566832=>_0x566832[_0x4ba99e(0x1cc)])]),_0x260139=_0x34ce9e[_0x4ba99e(0x1cc)],_0x23c10b=_0x1ded47[_0x4ba99e(0x1cc)],{emailToId:_0x23afa2,idToEmail:_0x5d6ef8}=_0x31f530,[_0x243140,_0x4d998c]=await withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',async()=>{const _0x22ef34=_0x4ba99e,[_0x2b135e,_0x2f092e]=await Promise[_0x22ef34(0x1b0)]([_0x9b2cba[_0x22ef34(0x1d1)][_0x22ef34(0x18c)](),_0x9b2cba[_0x22ef34(0x1d1)][_0x22ef34(0x202)]()]);return[_0x2b135e,_0x2f092e];},{'verbose':_0xba59d1[_0x4ba99e(0x1dc)]})[_0x4ba99e(0x1e2)](_0x1c745e=>_0x1c745e['data']),_0x23f766=buildFolderPathToIdMap(_0x23c10b),_0x308613=new Map();for(const [_0x1f7289,_0x5b8a74]of _0x23f766[_0x4ba99e(0x19a)]()){_0x308613[_0x4ba99e(0x1c1)](_0x5b8a74,_0x1f7289);}const _0x74e77d=new Map();for(const _0x577309 of _0x260139){const _0x4bf582=_0x577309[_0x4ba99e(0x1d5)]?_0x308613[_0x4ba99e(0x1b9)](_0x577309['segmentFolderId'][_0x4ba99e(0x1ca)]())||'':'',_0x5f20fb=_0x4bf582+':'+_0x577309[_0x4ba99e(0x1e9)];_0x74e77d[_0x4ba99e(0x1c1)](_0x5f20fb,_0x577309);}const _0x55e050=findYamlFiles(_0x2228ea);if(_0x55e050[_0x4ba99e(0x1d3)]===0x0)return console[_0x4ba99e(0x189)](a34_0xbce8b0[_0x4ba99e(0x1ea)](_0x4ba99e(0x1ba)+_0x2228ea+'\x0a')),console[_0x4ba99e(0x189)](a34_0xbce8b0[_0x4ba99e(0x1f6)](_0x4ba99e(0x204))),0x1;const _0x1eb6c9=[];for(const _0x1d849c of _0x55e050){const _0x28a9a2=a34_0x1d58a3[_0x4ba99e(0x20d)](_0x2228ea,a34_0x1d58a3[_0x4ba99e(0x20b)](_0x1d849c)),_0x36632c=_0x28a9a2==='.'?'':_0x28a9a2,_0x339c9f=readFileSync(_0x1d849c,_0x4ba99e(0x1c7));try{const _0x1913f9=parseSegmentYamlFile(_0x339c9f);_0x1eb6c9['push']({'yamlConfig':_0x1913f9,'folderPath':_0x36632c,'sourcePath':_0x1d849c});}catch(_0xecb110){return console[_0x4ba99e(0x189)](a34_0xbce8b0[_0x4ba99e(0x1ea)](_0x4ba99e(0x203)+_0x1d849c+':\x20'+(_0xecb110 instanceof Error?_0xecb110[_0x4ba99e(0x1e8)]:_0xecb110))),0x1;}}if(_0x1eb6c9[_0x4ba99e(0x1d3)]===0x0)return console[_0x4ba99e(0x189)](a34_0xbce8b0[_0x4ba99e(0x1fd)]('No\x20segment\x20YAML\x20files\x20found')),0x0;const _0x554364=new Map();_0x260139['length']>0x0&&await withSpinner(_0x4ba99e(0x1fb),async()=>{await batchAsync(_0x260139,async _0x551ad3=>{const _0x5de668=a34_0x2865,_0x211413=await _0x9b2cba['segment'][_0x5de668(0x1af)](_0x418cfa,_0x551ad3['id']);_0x554364[_0x5de668(0x1c1)](_0x551ad3['id'],_0x211413);});},{'verbose':_0xba59d1[_0x4ba99e(0x1dc)]});const _0x23374c=[],_0x7fd6c0=new Set();for(const {yamlConfig:_0x5faed3,folderPath:_0x45dab2,sourcePath:_0xf1f398}of _0x1eb6c9){const _0x113d48=resolveTDFolderPath(_0x45dab2,_0x4ace8d,_0x281a3f),_0x31fbcd=_0x113d48+':'+_0x5faed3['name'],_0x1173cf=_0x74e77d[_0x4ba99e(0x1b9)](_0x31fbcd),_0x13068b=_0x1173cf?_0x554364[_0x4ba99e(0x1b9)](_0x1173cf['id'])||[]:[];if(_0x113d48&&!_0x23f766[_0x4ba99e(0x1c3)](_0x113d48)){const _0x5b202a=_0x113d48[_0x4ba99e(0x1a4)]('/');let _0x12c084='';for(const _0x2875d0 of _0x5b202a){_0x12c084=_0x12c084?_0x12c084+'/'+_0x2875d0:_0x2875d0,!_0x23f766[_0x4ba99e(0x1c3)](_0x12c084)&&_0x7fd6c0[_0x4ba99e(0x1f9)](_0x12c084);}}const _0x4170d6=calculateActivationActions(_0x5faed3['activations']||[],_0x13068b,_0x5d6ef8,_0x4d998c),_0x70f0ec=segmentToYamlString(_0x5faed3);let _0x20ddf9,_0x4cd62b=![],_0xb7b7ba;if(_0x1173cf){const _0x2610cf=segmentWithActivationsToYaml(_0x1173cf,_0x13068b,undefined,_0x5d6ef8,_0x4d998c),_0x12471e=segmentToYamlString(_0x2610cf);_0x20ddf9=generateDiff(_0x12471e,_0x70f0ec),_0x4cd62b=hasChanges(_0x20ddf9),_0x4cd62b&&(_0xb7b7ba=formatDiffWithColors(_0x20ddf9));}else _0x20ddf9=generateDiff('',_0x70f0ec),_0xb7b7ba=formatDiffWithColors(_0x20ddf9);_0x23374c[_0x4ba99e(0x19d)]({'relativePath':_0x5faed3[_0x4ba99e(0x1e9)],'absolutePath':_0xf1f398,'yamlConfig':_0x5faed3,'folderPath':_0x113d48,'existingSegment':_0x1173cf,'existingActivations':_0x13068b,'isNew':!_0x1173cf,'hasChanges':_0x4cd62b,'diff':_0xb7b7ba,'activationActions':_0x4170d6});}const _0x5b6f3a=new Set();for(const {yamlConfig:_0xcde49a,folderPath:_0x425aeb}of _0x1eb6c9){const _0x3b8cb1=resolveTDFolderPath(_0x425aeb,_0x4ace8d,_0x281a3f);_0x5b6f3a[_0x4ba99e(0x1f9)](_0x3b8cb1+':'+_0xcde49a['name']);}const _0x227dcd=_0x260139[_0x4ba99e(0x1fc)](_0x384450=>{const _0x25bc7d=_0x4ba99e,_0x309070=_0x384450[_0x25bc7d(0x1d5)]?_0x308613[_0x25bc7d(0x1b9)](_0x384450[_0x25bc7d(0x1d5)][_0x25bc7d(0x1ca)]())||'':'',_0xcad474=_0x309070+':'+_0x384450[_0x25bc7d(0x1e9)];if(_0x5b6f3a[_0x25bc7d(0x1c3)](_0xcad474))return![];if(_0x4ace8d)return _0x309070===_0x281a3f||_0x309070[_0x25bc7d(0x1e5)](_0x281a3f+'/');return!![];}),_0x235e9c=_0x23374c[_0x4ba99e(0x1fc)](_0x1173d9=>_0x1173d9[_0x4ba99e(0x1d8)]),_0x209627=_0x23374c[_0x4ba99e(0x1fc)](_0x106135=>!_0x106135['isNew']&&_0x106135['hasChanges']),_0x2b432f=_0x23374c[_0x4ba99e(0x1fc)](_0x4e22a8=>!_0x4e22a8[_0x4ba99e(0x1d8)]&&!_0x4e22a8[_0x4ba99e(0x1cb)]),_0x5e02d3=Array[_0x4ba99e(0x1bc)](_0x7fd6c0)[_0x4ba99e(0x1c6)](),_0xbc16a1=_0xba59d1[_0x4ba99e(0x1de)]?_0x227dcd:[],_0x346ed7=_0x23374c[_0x4ba99e(0x18d)](_0x55290f=>_0x55290f['activationActions']),_0x5cf649=_0x346ed7['filter'](_0x18415d=>_0x18415d[_0x4ba99e(0x188)]===_0x4ba99e(0x1ef)),_0x4ef8d0=_0x346ed7['filter'](_0x44dfbd=>_0x44dfbd[_0x4ba99e(0x188)]==='update'),_0x28ffc7=_0x346ed7[_0x4ba99e(0x1fc)](_0x12cafd=>_0x12cafd[_0x4ba99e(0x188)]===_0x4ba99e(0x1de));console['error'](_0x4ba99e(0x196)+_0x32966f+'\x27:');_0x5e02d3['length']>0x0&&console['error']('\x20\x20'+a34_0xbce8b0[_0x4ba99e(0x1da)](_0x4ba99e(0x1f3)+_0x5e02d3[_0x4ba99e(0x1d3)]+_0x4ba99e(0x208)));console['error']('\x20\x20'+a34_0xbce8b0['green']('+\x20'+_0x235e9c[_0x4ba99e(0x1d3)]+_0x4ba99e(0x1df))),console[_0x4ba99e(0x189)]('\x20\x20'+a34_0xbce8b0[_0x4ba99e(0x1fd)]('~\x20'+_0x209627['length']+'\x20changed\x20segments'));if(_0xbc16a1[_0x4ba99e(0x1d3)]>0x0)console[_0x4ba99e(0x189)]('\x20\x20'+a34_0xbce8b0[_0x4ba99e(0x1ea)]('-\x20'+_0xbc16a1[_0x4ba99e(0x1d3)]+_0x4ba99e(0x1e1)));else _0x227dcd[_0x4ba99e(0x1d3)]>0x0&&!_0xba59d1[_0x4ba99e(0x1de)]&&console[_0x4ba99e(0x189)]('\x20\x20'+a34_0xbce8b0[_0x4ba99e(0x1f4)]('\x20\x20'+_0x227dcd['length']+_0x4ba99e(0x1fe)));console[_0x4ba99e(0x189)]('\x20\x20'+a34_0xbce8b0[_0x4ba99e(0x1f4)]('=\x20'+_0x2b432f[_0x4ba99e(0x1d3)]+'\x20unchanged\x20segments'));_0x346ed7[_0x4ba99e(0x1d3)]>0x0&&(console[_0x4ba99e(0x189)](''),console[_0x4ba99e(0x189)]('\x20\x20Activations:'),_0x5cf649['length']>0x0&&console['error']('\x20\x20\x20\x20'+a34_0xbce8b0[_0x4ba99e(0x1b3)]('+\x20'+_0x5cf649[_0x4ba99e(0x1d3)]+_0x4ba99e(0x1d7))),_0x4ef8d0[_0x4ba99e(0x1d3)]>0x0&&console[_0x4ba99e(0x189)](_0x4ba99e(0x1e6)+a34_0xbce8b0[_0x4ba99e(0x1fd)]('~\x20'+_0x4ef8d0[_0x4ba99e(0x1d3)]+'\x20to\x20update')),_0x28ffc7[_0x4ba99e(0x1d3)]>0x0&&console['error'](_0x4ba99e(0x1e6)+a34_0xbce8b0[_0x4ba99e(0x1ea)]('-\x20'+_0x28ffc7[_0x4ba99e(0x1d3)]+'\x20to\x20delete')));console[_0x4ba99e(0x189)](_0x4ba99e(0x19e)+a34_0xbce8b0[_0x4ba99e(0x1f6)](_0x2228ea)+'\x0a');if(_0x5e02d3[_0x4ba99e(0x1d3)]>0x0){console[_0x4ba99e(0x189)](_0x4ba99e(0x197));for(const _0x2f54d6 of _0x5e02d3){console['error']('\x20\x20'+a34_0xbce8b0['blue']('+')+'\x20'+_0x2f54d6);}console[_0x4ba99e(0x189)]('');}if(_0x235e9c[_0x4ba99e(0x1d3)]>0x0)for(const _0x6792c5 of _0x235e9c){const _0x38f628=_0x6792c5[_0x4ba99e(0x201)]?_0x6792c5[_0x4ba99e(0x201)]+'/'+_0x6792c5[_0x4ba99e(0x213)][_0x4ba99e(0x1e9)]:_0x6792c5[_0x4ba99e(0x213)][_0x4ba99e(0x1e9)],_0x21f622=_0x6792c5[_0x4ba99e(0x213)][_0x4ba99e(0x1e0)]?.[_0x4ba99e(0x1d3)]||0x0,_0x2a52f1=_0x21f622>0x0?a34_0xbce8b0[_0x4ba99e(0x1f4)]('\x20['+_0x21f622+_0x4ba99e(0x192)):'';console[_0x4ba99e(0x189)]('\x0a'+a34_0xbce8b0[_0x4ba99e(0x1b3)](_0x4ba99e(0x1aa))+'\x20'+_0x38f628+_0x2a52f1),console[_0x4ba99e(0x189)]('─'[_0x4ba99e(0x1d6)](0x3c)),_0x6792c5[_0x4ba99e(0x1ee)]&&console[_0x4ba99e(0x189)](_0x6792c5[_0x4ba99e(0x1ee)]),console[_0x4ba99e(0x189)]('─'['repeat'](0x3c));}if(_0xbc16a1[_0x4ba99e(0x1d3)]>0x0)for(const _0x570cff of _0xbc16a1){const _0x10a99d=_0x570cff['segmentFolderId']?_0x308613[_0x4ba99e(0x1b9)](_0x570cff[_0x4ba99e(0x1d5)][_0x4ba99e(0x1ca)]())||'':'',_0x188f9a=_0x10a99d?_0x10a99d+'/'+_0x570cff[_0x4ba99e(0x1e9)]:_0x570cff[_0x4ba99e(0x1e9)],_0x401ff3=_0x554364[_0x4ba99e(0x1b9)](_0x570cff['id'])||[],_0xba2d63=_0x401ff3['length']>0x0?a34_0xbce8b0[_0x4ba99e(0x1f4)]('\x20['+_0x401ff3[_0x4ba99e(0x1d3)]+_0x4ba99e(0x192)):'';console[_0x4ba99e(0x189)]('\x0a'+a34_0xbce8b0[_0x4ba99e(0x1ea)](_0x4ba99e(0x1ed))+'\x20'+_0x188f9a+_0xba2d63),console[_0x4ba99e(0x189)]('─'[_0x4ba99e(0x1d6)](0x3c));const _0xd03dab=segmentWithActivationsToYaml(_0x570cff,_0x401ff3,undefined,_0x5d6ef8,_0x4d998c),_0x5f2673=segmentToYamlString(_0xd03dab),_0x2d0e11=generateDiff(_0x5f2673,'');console[_0x4ba99e(0x189)](formatDiffWithColors(_0x2d0e11)),console[_0x4ba99e(0x189)]('─'[_0x4ba99e(0x1d6)](0x3c));}const _0x4ea250=_0x23374c['filter'](_0x46b52d=>!_0x46b52d[_0x4ba99e(0x1d8)]&&_0x46b52d['diff']);if(_0x4ea250[_0x4ba99e(0x1d3)]>0x0)for(const _0x161292 of _0x4ea250){const _0x28294b=_0x161292[_0x4ba99e(0x201)]?_0x161292[_0x4ba99e(0x201)]+'/'+_0x161292[_0x4ba99e(0x213)][_0x4ba99e(0x1e9)]:_0x161292['yamlConfig']['name'];console[_0x4ba99e(0x189)]('\x0a'+a34_0xbce8b0[_0x4ba99e(0x1fd)](_0x4ba99e(0x1a5))+'\x20'+_0x28294b),console['error']('─'['repeat'](0x3c)),console['error'](_0x161292[_0x4ba99e(0x1ee)]),console[_0x4ba99e(0x189)]('─'[_0x4ba99e(0x1d6)](0x3c));}if(_0xba59d1[_0x4ba99e(0x1a2)])return console[_0x4ba99e(0x189)](a34_0xbce8b0[_0x4ba99e(0x1fd)](_0x4ba99e(0x1dd))),0x0;const _0x52ad1a=_0x235e9c['length']>0x0||_0x209627[_0x4ba99e(0x1d3)]>0x0||_0xbc16a1['length']>0x0,_0x5c5e76=_0x346ed7['length']>0x0,_0x12827f=_0x5e02d3[_0x4ba99e(0x1d3)]>0x0;if(!_0x52ad1a&&!_0x5c5e76&&!_0x12827f)return console[_0x4ba99e(0x189)](a34_0xbce8b0['green'](_0x4ba99e(0x1b4))),0x0;const _0x306c61=_0x235e9c['length']+_0x209627[_0x4ba99e(0x1d3)]+_0xbc16a1[_0x4ba99e(0x1d3)]+_0x5e02d3['length']+_0x346ed7['length'];if(!_0xba59d1[_0x4ba99e(0x20c)]&&_0x306c61>0x0){const _0x15bdda=await confirmKey(_0x4ba99e(0x1bb)+_0x306c61+_0x4ba99e(0x1c0));if(!_0x15bdda)return console['error']('Aborted.'),0x1;}for(const _0x7cfc42 of _0x5e02d3){const _0x3df716=_0x7cfc42[_0x4ba99e(0x1a4)]('/'),_0x43f41a=_0x3df716[_0x3df716[_0x4ba99e(0x1d3)]-0x1],_0x50145d=_0x3df716[_0x4ba99e(0x210)](0x0,-0x1)[_0x4ba99e(0x1b5)]('/'),_0x236318=_0x23f766[_0x4ba99e(0x1b9)](_0x50145d),_0x609abf={'name':_0x43f41a,'parentFolderId':_0x236318},_0xb708d1=await withSpinner('Creating\x20folder\x20\x27'+_0x7cfc42+'\x27...',()=>_0x9b2cba[_0x4ba99e(0x1c9)][_0x4ba99e(0x1cf)](_0x418cfa,_0x609abf),{'verbose':_0xba59d1['verbose']});_0x23f766[_0x4ba99e(0x1c1)](_0x7cfc42,_0xb708d1[_0x4ba99e(0x1cc)]['id']),console[_0x4ba99e(0x189)](a34_0xbce8b0['blue'](_0x4ba99e(0x1b7)+_0x7cfc42+'\x27'));}let _0x5bb429=0x0,_0x446c9a=0x0,_0x2d4d7e=0x0,_0x4ba42f=0x0,_0x157e07=0x0,_0x1e98d5=0x0;const _0x38a086=new Map();for(const _0x5ce26e of _0x23374c){const _0x6052e4=_0x5ce26e[_0x4ba99e(0x201)]?_0x23f766['get'](_0x5ce26e[_0x4ba99e(0x201)]):undefined;let _0x158c23;if(_0x5ce26e['isNew']){const _0xd3113c=yamlToCreateRequest(_0x5ce26e[_0x4ba99e(0x213)],_0x6052e4),_0xd48cc9=await withSpinner(_0x4ba99e(0x194)+_0x5ce26e['yamlConfig']['name']+_0x4ba99e(0x206),()=>_0x9b2cba[_0x4ba99e(0x1c9)][_0x4ba99e(0x1a9)](_0x418cfa,_0xd3113c),{'verbose':_0xba59d1[_0x4ba99e(0x1dc)]});_0x158c23=_0xd48cc9['data']['id'],_0x38a086[_0x4ba99e(0x1c1)](_0x5ce26e[_0x4ba99e(0x213)]['name'],_0x158c23),console['error'](a34_0xbce8b0[_0x4ba99e(0x1b3)](_0x4ba99e(0x193)+_0x5ce26e['yamlConfig'][_0x4ba99e(0x1e9)]+'\x27')),_0x5bb429++;}else{if(_0x5ce26e[_0x4ba99e(0x1cb)]){const _0x30a888=yamlToUpdateRequest(_0x5ce26e[_0x4ba99e(0x213)]);_0x6052e4!==_0x5ce26e['existingSegment']?.[_0x4ba99e(0x1d5)]&&(_0x30a888[_0x4ba99e(0x1d5)]=_0x6052e4?parseInt(_0x6052e4,0xa):undefined),await withSpinner('Updating\x20segment\x20\x27'+_0x5ce26e[_0x4ba99e(0x213)]['name']+_0x4ba99e(0x206),()=>_0x9b2cba[_0x4ba99e(0x1c9)][_0x4ba99e(0x1e4)](_0x418cfa,_0x5ce26e[_0x4ba99e(0x190)]['id'],_0x30a888),{'verbose':_0xba59d1[_0x4ba99e(0x1dc)]}),_0x158c23=_0x5ce26e[_0x4ba99e(0x190)]['id'],console[_0x4ba99e(0x189)](a34_0xbce8b0[_0x4ba99e(0x1fd)](_0x4ba99e(0x1eb)+_0x5ce26e['yamlConfig'][_0x4ba99e(0x1e9)]+'\x27')),_0x446c9a++;}else _0x158c23=_0x5ce26e[_0x4ba99e(0x190)]['id'];}for(const _0x355013 of _0x5ce26e[_0x4ba99e(0x1ff)]){if(_0x355013['type']===_0x4ba99e(0x1ef)&&_0x355013['yamlActivation']){const _0x4a9325=yamlActivationToCreateRequest(_0x355013[_0x4ba99e(0x1f8)],_0x23afa2,_0x243140);await withSpinner(_0x4ba99e(0x1d2)+_0x355013[_0x4ba99e(0x1e9)]+'\x27...',()=>_0x9b2cba['segment']['createActivation'](_0x418cfa,_0x158c23,_0x4a9325),{'verbose':_0xba59d1['verbose']}),console[_0x4ba99e(0x189)](a34_0xbce8b0['green'](_0x4ba99e(0x20e)+_0x355013[_0x4ba99e(0x1e9)]+'\x27')),_0x4ba42f++;}else{if(_0x355013[_0x4ba99e(0x188)]===_0x4ba99e(0x1bf)&&_0x355013[_0x4ba99e(0x1f8)]&&_0x355013[_0x4ba99e(0x195)]){const _0x1f03d4=yamlActivationToUpdateRequest(_0x355013[_0x4ba99e(0x1f8)],_0x23afa2,_0x243140);await withSpinner(_0x4ba99e(0x1a7)+_0x355013[_0x4ba99e(0x1e9)]+_0x4ba99e(0x206),()=>_0x9b2cba[_0x4ba99e(0x1c9)][_0x4ba99e(0x211)](_0x418cfa,_0x158c23,_0x355013[_0x4ba99e(0x195)]['id'],_0x1f03d4),{'verbose':_0xba59d1['verbose']}),console[_0x4ba99e(0x189)](a34_0xbce8b0['yellow']('\x20\x20✔\x20Updated\x20activation\x20\x27'+_0x355013[_0x4ba99e(0x1e9)]+'\x27')),_0x157e07++;}else _0x355013['type']===_0x4ba99e(0x1de)&&_0x355013[_0x4ba99e(0x195)]&&(await withSpinner(_0x4ba99e(0x205)+_0x355013[_0x4ba99e(0x1e9)]+_0x4ba99e(0x206),()=>_0x9b2cba[_0x4ba99e(0x1c9)][_0x4ba99e(0x1b1)](_0x418cfa,_0x158c23,_0x355013['existingActivation']['id']),{'verbose':_0xba59d1[_0x4ba99e(0x1dc)]}),console[_0x4ba99e(0x189)](a34_0xbce8b0[_0x4ba99e(0x1ea)](_0x4ba99e(0x18b)+_0x355013[_0x4ba99e(0x1e9)]+'\x27')),_0x1e98d5++);}}}for(const _0x20c536 of _0xbc16a1){await withSpinner(_0x4ba99e(0x1fa)+_0x20c536[_0x4ba99e(0x1e9)]+_0x4ba99e(0x206),()=>_0x9b2cba[_0x4ba99e(0x1c9)][_0x4ba99e(0x1b8)](_0x20c536['id']),{'verbose':_0xba59d1[_0x4ba99e(0x1dc)]}),console[_0x4ba99e(0x189)](a34_0xbce8b0[_0x4ba99e(0x1ea)](_0x4ba99e(0x1d0)+_0x20c536[_0x4ba99e(0x1e9)]+'\x27')),_0x2d4d7e++;}const _0x5cb99a=[];if(_0x5bb429>0x0)_0x5cb99a['push'](_0x5bb429+_0x4ba99e(0x209));if(_0x446c9a>0x0)_0x5cb99a[_0x4ba99e(0x19d)](_0x446c9a+_0x4ba99e(0x1ec));if(_0x2d4d7e>0x0)_0x5cb99a[_0x4ba99e(0x19d)](_0x2d4d7e+_0x4ba99e(0x1cd));const _0x354aeb=[];if(_0x4ba42f>0x0)_0x354aeb[_0x4ba99e(0x19d)](_0x4ba42f+_0x4ba99e(0x209));if(_0x157e07>0x0)_0x354aeb[_0x4ba99e(0x19d)](_0x157e07+'\x20updated');if(_0x1e98d5>0x0)_0x354aeb[_0x4ba99e(0x19d)](_0x1e98d5+_0x4ba99e(0x1cd));return console[_0x4ba99e(0x189)](a34_0xbce8b0[_0x4ba99e(0x1b3)](_0x4ba99e(0x207))),_0x5cb99a[_0x4ba99e(0x1d3)]>0x0&&console[_0x4ba99e(0x189)]('\x20\x20Segments:\x20'+_0x5cb99a[_0x4ba99e(0x1b5)](',\x20')),_0x354aeb[_0x4ba99e(0x1d3)]>0x0&&console[_0x4ba99e(0x189)](_0x4ba99e(0x1d4)+_0x354aeb['join'](',\x20')),0x0;}}function a34_0x2865(_0x1c8fae,_0x56ace7){_0x1c8fae=_0x1c8fae-0x188;const _0x315bb3=a34_0x315b();let _0x286517=_0x315bb3[_0x1c8fae];return _0x286517;}function buildFolderPathToIdMap(_0x2b4a19){const _0x19cf57=a34_0x52b074,_0x3303c9=new Map(),_0x4cc515=new Map();for(const _0x574dc2 of _0x2b4a19){_0x4cc515['set'](_0x574dc2['id'],_0x574dc2);}const _0x5358ed=new Set();for(const _0x36ac4d of _0x2b4a19){!_0x36ac4d[_0x19cf57(0x19c)]&&_0x5358ed[_0x19cf57(0x1f9)](_0x36ac4d['id']);}function _0x465587(_0x248ebe){const _0x30a8c0=_0x19cf57;if(_0x5358ed[_0x30a8c0(0x1c3)](_0x248ebe['id']))return'';if(_0x248ebe[_0x30a8c0(0x19c)]){const _0x52f1b2=_0x4cc515[_0x30a8c0(0x1b9)](_0x248ebe[_0x30a8c0(0x19c)]);if(_0x52f1b2){const _0x33de86=_0x465587(_0x52f1b2);return _0x33de86?_0x33de86+'/'+_0x248ebe[_0x30a8c0(0x1e9)]:_0x248ebe[_0x30a8c0(0x1e9)];}}return _0x248ebe[_0x30a8c0(0x1e9)];}for(const _0x399b9a of _0x2b4a19){const _0xa31ad5=_0x465587(_0x399b9a);_0x3303c9[_0x19cf57(0x1c1)](_0xa31ad5,_0x399b9a['id']);}return _0x3303c9;}function findYamlFiles(_0x3a5c52){const _0x366e1f=[];function _0x7761a8(_0x377aec){const _0x2f8821=a34_0x2865,_0x5bfdf4=readdirSync(_0x377aec,{'withFileTypes':!![]});for(const _0x1414ba of _0x5bfdf4){const _0x5923ca=a34_0x1d58a3['join'](_0x377aec,_0x1414ba[_0x2f8821(0x1e9)]);if(_0x1414ba['isDirectory']())_0x7761a8(_0x5923ca);else(_0x1414ba['name']['endsWith'](_0x2f8821(0x1ae))||_0x1414ba[_0x2f8821(0x1e9)][_0x2f8821(0x191)](_0x2f8821(0x1f2)))&&_0x366e1f[_0x2f8821(0x19d)](_0x5923ca);}}return _0x7761a8(_0x3a5c52),_0x366e1f;}function calculateActivationActions(_0x2e9da2,_0x483e15,_0x2fa74c,_0x5432a9){const _0x1741a2=a34_0x52b074,_0x156453=[],_0x1141e2=new Map();for(const _0x373e2f of _0x483e15){_0x1141e2['set'](_0x373e2f[_0x1741a2(0x1e9)],_0x373e2f);}const _0xe84e78=new Map();for(const _0x4ff4fb of _0x2e9da2){_0xe84e78[_0x1741a2(0x1c1)](_0x4ff4fb[_0x1741a2(0x1e9)],_0x4ff4fb);}for(const _0x256eab of _0x2e9da2){const _0xf9b385=_0x1141e2[_0x1741a2(0x1b9)](_0x256eab[_0x1741a2(0x1e9)]);if(!_0xf9b385)_0x156453[_0x1741a2(0x19d)]({'type':_0x1741a2(0x1ef),'name':_0x256eab[_0x1741a2(0x1e9)],'yamlActivation':_0x256eab});else{const _0x3a36ab=activationToYaml(_0xf9b385,_0x2fa74c,_0x5432a9),_0x479339=a34_0x494103['stringify'](_0x3a36ab),_0x362398=a34_0x494103[_0x1741a2(0x20f)](_0x256eab);_0x479339!==_0x362398&&_0x156453[_0x1741a2(0x19d)]({'type':_0x1741a2(0x1bf),'name':_0x256eab[_0x1741a2(0x1e9)],'yamlActivation':_0x256eab,'existingActivation':_0xf9b385});}}for(const _0x495b40 of _0x483e15){!_0xe84e78[_0x1741a2(0x1c3)](_0x495b40[_0x1741a2(0x1e9)])&&_0x156453[_0x1741a2(0x19d)]({'type':_0x1741a2(0x1de),'name':_0x495b40[_0x1741a2(0x1e9)],'existingActivation':_0x495b40});}return _0x156453;}
1
+ const a34_0x247e21=a34_0xe85f;(function(_0x28c67b,_0x43b0d9){const _0x1d73d3=a34_0xe85f,_0x57ac90=_0x28c67b();while(!![]){try{const _0x292d86=-parseInt(_0x1d73d3(0x200))/0x1+parseInt(_0x1d73d3(0x20d))/0x2*(-parseInt(_0x1d73d3(0x1f6))/0x3)+parseInt(_0x1d73d3(0x1a5))/0x4*(parseInt(_0x1d73d3(0x1b7))/0x5)+parseInt(_0x1d73d3(0x1cb))/0x6*(parseInt(_0x1d73d3(0x20c))/0x7)+-parseInt(_0x1d73d3(0x209))/0x8+-parseInt(_0x1d73d3(0x1f4))/0x9+parseInt(_0x1d73d3(0x1df))/0xa;if(_0x292d86===_0x43b0d9)break;else _0x57ac90['push'](_0x57ac90['shift']());}catch(_0x5ee537){_0x57ac90['push'](_0x57ac90['shift']());}}}(a34_0x1321,0x8e943));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,findTdxConfig}from'../utils/tdx-config.js';import{segmentToYamlString,segmentWithActivationsToYaml,parseSegmentYamlFile,yamlToCreateRequest,yamlToUpdateRequest,yamlActivationToCreateRequest,yamlActivationToUpdateRequest,activationToYaml}from'../sdk/segment/child-segment-yaml.js';import a34_0x5f1c93 from'chalk';import{existsSync,readFileSync,statSync,readdirSync}from'fs';import a34_0x14ebde from'path';function a34_0x1321(){const _0x338f80=['.yml','dryRun','deleteSegment','Source\x20directory:\x20','segment','parent_segment','yamlActivation','parentFolderId','listFolders','cwd','create','add','cyan','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file\x0a','parentSegment','activations','387744cakaZD','\x20updated','\x20deleted','createFolder','Error:\x20Parent\x20segment\x20is\x20required\x0a','\x20activations]','relative','connection','isNew','Updating\x20segment\x20\x27','Fetching\x20existing\x20activations...','createActivation','\x20created','length','buildIdToNameMap','updateSegmentById','Parent\x20segment:\x20','\x20\x20✔\x20Updated\x20activation\x20\x27','config','\x27...','14211410VHfZRg','.yaml','dirname','sort','red','Creating\x20activation\x20\x27','push','slice','error','✔\x20Updated\x20segment\x20\x27','resolveParentId','segmentFolderId','Creating\x20folder\x20\x27','delete','then','type','\x20segments\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','Error:\x20No\x20segment\x20YAML\x20files\x20found\x20in\x20','Resolving\x20parent\x20segment\x20\x27','filter','listActivations','3477186eROiyc','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','87NiyXwN','listSegments','Site:\x20','buildUserMaps','✔\x20All\x20segments\x20and\x20activations\x20are\x20up\x20to\x20date','repeat','✔\x20Created\x20folder\x20\x27','isDirectory','split','\x0a✔\x20Push\x20complete','1014820ZiaKWK','replace','folderPath','segment:push','update','set','diff','Deleting\x20activation\x20\x27','user','5553672noWDMp','get','data','91KFvzrB','2126TZNpEF','No\x20segment\x20YAML\x20files\x20found','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','\x20\x20✔\x20Deleted\x20activation\x20\x27','stringify','entries','activationActions','blue','existingActivation','📁\x20','yellow','\x20to\x20update','flatMap','configDir','toString','✔\x20Created\x20segment\x20\x27','green','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20files','Fetching\x20existing\x20segments...','Tip:\x20Set\x20context\x20with\x20`tdx\x20segment\x20use\x20<parent_name>`\x20or\x20`tdx\x20ps\x20use\x20<parent_name>`','site','verbose','\x20\x20Activations:','\x20\x20✔\x20Created\x20activation\x20\x27','\x20\x20\x20\x20','all','1472pwEMIo','utf-8','\x20\x20Source:\x20','existingSegment','\x20\x20Segments:\x20','\x20folders\x20to\x20create','name','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Aborted.','message','\x20\x20Activations:\x20','dim','Fetching\x20existing\x20folders...','Creating\x20segment\x20\x27','yamlConfig','Folders\x20to\x20create:','has','Updating\x20activation\x20\x27','6100vXPbkT','join','\x20segments\x20to\x20delete','hasChanges'];a34_0x1321=function(){return _0x338f80;};return a34_0x1321();}import*as a34_0x54d242 from'yaml';function sanitizeFileName(_0x217645){const _0x3d4a48=a34_0xe85f;return _0x217645['toLowerCase']()[_0x3d4a48(0x201)](/[/\\:*?"<>|]/g,'-')[_0x3d4a48(0x201)](/\s+/g,'-')[_0x3d4a48(0x201)](/-+/g,'-')[_0x3d4a48(0x201)](/^-|-$/g,'');}function tryFindTdxConfig(_0x49b125){try{return findTdxConfig(_0x49b125);}catch{return null;}}function resolveTDFolderPath(_0x443103,_0x570fcf,_0x4ce74a){if(!_0x570fcf)return _0x443103;return _0x443103?_0x4ce74a+'/'+_0x443103:_0x4ce74a;}export class SegmentPushCommand extends BaseCommand{[a34_0x247e21(0x1ab)]=a34_0x247e21(0x203);['description']=a34_0x247e21(0x20f);async['execute'](_0x5efdeb){const _0x596eda=a34_0x247e21,{options:_0x1ed5e6,args:_0x494d63,tdx:_0x20ad71}=_0x5efdeb,_0x2208ca=_0x1ed5e6,_0x37006c=_0x1ed5e6[_0x596eda(0x1c9)],_0x3c6ff0=_0x494d63[0x0];let _0x11b2c6,_0x54b6ba,_0x258825;if(_0x3c6ff0){if(existsSync(_0x3c6ff0)&&statSync(_0x3c6ff0)[_0x596eda(0x1fd)]()){const _0x3cf618=tryFindTdxConfig(_0x3c6ff0);if(_0x3cf618)_0x11b2c6=_0x3cf618[_0x596eda(0x1dd)][_0x596eda(0x1c0)],_0x54b6ba=_0x3c6ff0,_0x258825=_0x3cf618[_0x596eda(0x198)];else return console[_0x596eda(0x1e7)](a34_0x5f1c93['red']('Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20'+_0x3c6ff0+'\x0a')),console[_0x596eda(0x1e7)](a34_0x5f1c93['cyan'](_0x596eda(0x1ac))),0x1;}else _0x11b2c6=_0x3c6ff0;}else{const _0x3bcce6=tryFindTdxConfig(process['cwd']());_0x3bcce6?(_0x11b2c6=_0x3bcce6['config'][_0x596eda(0x1c0)],_0x54b6ba=process[_0x596eda(0x1c4)](),_0x258825=_0x3bcce6[_0x596eda(0x198)]):_0x11b2c6=_0x37006c;}if(!_0x11b2c6)return console['error'](a34_0x5f1c93[_0x596eda(0x1e3)](_0x596eda(0x1cf))),console[_0x596eda(0x1e7)]('Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)'),console[_0x596eda(0x1e7)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent'),console[_0x596eda(0x1e7)](_0x596eda(0x1c8)),console['error'](a34_0x5f1c93[_0x596eda(0x1c7)](_0x596eda(0x19e))),0x1;const _0xc1a389=_0x54b6ba||getSegmentRootDir(sanitizeFileName(_0x11b2c6)),_0x1d6f63=_0x258825||_0xc1a389,_0x3e8f13=a34_0x14ebde['relative'](_0x1d6f63,_0xc1a389),_0x28d875=_0x3e8f13!==''&&_0x3e8f13!=='.';if(!existsSync(_0xc1a389))return console['error'](a34_0x5f1c93[_0x596eda(0x1e3)]('Error:\x20Directory\x20not\x20found:\x20'+_0xc1a389+'\x0a')),console[_0x596eda(0x1e7)](a34_0x5f1c93[_0x596eda(0x1c7)](_0x596eda(0x1ac))),0x1;_0x2208ca['verbose']&&(console[_0x596eda(0x1e7)](_0x596eda(0x1f8)+_0x2208ca[_0x596eda(0x19f)]),console['error'](_0x596eda(0x1db)+_0x11b2c6),console[_0x596eda(0x1e7)](_0x596eda(0x1be)+_0xc1a389),_0x28d875&&console[_0x596eda(0x1e7)]('Scoped\x20to\x20folder:\x20'+_0x3e8f13));const _0x2193b1=await withSpinner(_0x596eda(0x1f1)+_0x11b2c6+'\x27...',()=>_0x20ad71[_0x596eda(0x1bf)][_0x596eda(0x1e9)](_0x11b2c6),{'verbose':_0x2208ca['verbose']}),_0x4e4df6=_0x2193b1[_0x596eda(0x20b)],[_0x108240,_0x185844,_0x412d9d]=await Promise[_0x596eda(0x1a4)]([withSpinner(_0x596eda(0x19d),()=>_0x20ad71['segment'][_0x596eda(0x1f7)](_0x4e4df6),{'verbose':_0x2208ca[_0x596eda(0x1a0)]}),withSpinner(_0x596eda(0x1b1),()=>_0x20ad71[_0x596eda(0x1bf)][_0x596eda(0x1c3)](_0x4e4df6),{'verbose':_0x2208ca[_0x596eda(0x1a0)]}),withSpinner('Fetching\x20users\x20for\x20email\x20resolution...',()=>_0x20ad71[_0x596eda(0x208)][_0x596eda(0x1f9)](),{'verbose':_0x2208ca['verbose']})[_0x596eda(0x1ed)](_0x525b89=>_0x525b89[_0x596eda(0x20b)])]),_0x5b72d4=_0x108240[_0x596eda(0x20b)],_0x5b2e20=_0x185844[_0x596eda(0x20b)],{emailToId:_0x88e6ab,idToEmail:_0x3713e1}=_0x412d9d,[_0x34832d,_0x18a879]=await withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',async()=>{const _0x2ad455=_0x596eda,[_0x42da6e,_0x29415a]=await Promise[_0x2ad455(0x1a4)]([_0x20ad71['connection']['buildNameToIdMap'](),_0x20ad71[_0x2ad455(0x1d2)][_0x2ad455(0x1d9)]()]);return[_0x42da6e,_0x29415a];},{'verbose':_0x2208ca[_0x596eda(0x1a0)]})['then'](_0x3ca207=>_0x3ca207[_0x596eda(0x20b)]),_0x29bfe3=buildFolderPathToIdMap(_0x5b2e20),_0x18fcae=new Map();for(const [_0xd4a3cb,_0xfb14df]of _0x29bfe3[_0x596eda(0x212)]()){_0x18fcae[_0x596eda(0x205)](_0xfb14df,_0xd4a3cb);}const _0x167944=new Map();for(const _0x235644 of _0x5b72d4){const _0x286865=_0x235644[_0x596eda(0x1ea)]?_0x18fcae['get'](_0x235644[_0x596eda(0x1ea)][_0x596eda(0x199)]())||'':'',_0x38b9a2=_0x286865+':'+_0x235644[_0x596eda(0x1ab)];_0x167944[_0x596eda(0x205)](_0x38b9a2,_0x235644);}const _0x1eac55=findYamlFiles(_0xc1a389);if(_0x1eac55[_0x596eda(0x1d8)]===0x0)return console['error'](a34_0x5f1c93[_0x596eda(0x1e3)](_0x596eda(0x1f0)+_0xc1a389+'\x0a')),console[_0x596eda(0x1e7)](a34_0x5f1c93[_0x596eda(0x1c7)](_0x596eda(0x19c))),0x1;const _0x3fe49e=[];for(const _0x44258b of _0x1eac55){const _0x4b4f3=a34_0x14ebde[_0x596eda(0x1d1)](_0xc1a389,a34_0x14ebde[_0x596eda(0x1e1)](_0x44258b)),_0x528888=_0x4b4f3==='.'?'':_0x4b4f3,_0x191ccf=readFileSync(_0x44258b,_0x596eda(0x1a6));try{const _0x2dacdd=parseSegmentYamlFile(_0x191ccf);_0x3fe49e[_0x596eda(0x1e5)]({'yamlConfig':_0x2dacdd,'folderPath':_0x528888,'sourcePath':_0x44258b});}catch(_0x489f69){return console[_0x596eda(0x1e7)](a34_0x5f1c93['red']('Error\x20parsing\x20'+_0x44258b+':\x20'+(_0x489f69 instanceof Error?_0x489f69[_0x596eda(0x1ae)]:_0x489f69))),0x1;}}if(_0x3fe49e[_0x596eda(0x1d8)]===0x0)return console[_0x596eda(0x1e7)](a34_0x5f1c93[_0x596eda(0x217)](_0x596eda(0x20e))),0x0;const _0x3b47cd=new Map();_0x5b72d4[_0x596eda(0x1d8)]>0x0&&await withSpinner(_0x596eda(0x1d5),async()=>{await batchAsync(_0x5b72d4,async _0x373bc8=>{const _0x1c6e17=a34_0xe85f,_0x5631bf=await _0x20ad71['segment'][_0x1c6e17(0x1f3)](_0x4e4df6,_0x373bc8['id']);_0x3b47cd[_0x1c6e17(0x205)](_0x373bc8['id'],_0x5631bf);});},{'verbose':_0x2208ca['verbose']});const _0x3b88d9=[],_0x232cfc=new Set();for(const {yamlConfig:_0x351da1,folderPath:_0x1f9688,sourcePath:_0xb821e5}of _0x3fe49e){const _0x2d7f8c=resolveTDFolderPath(_0x1f9688,_0x28d875,_0x3e8f13),_0x39b216=_0x2d7f8c+':'+_0x351da1[_0x596eda(0x1ab)],_0x58ae80=_0x167944[_0x596eda(0x20a)](_0x39b216),_0x5475e6=_0x58ae80?_0x3b47cd['get'](_0x58ae80['id'])||[]:[];if(_0x2d7f8c&&!_0x29bfe3['has'](_0x2d7f8c)){const _0x59d2a2=_0x2d7f8c[_0x596eda(0x1fe)]('/');let _0x262d15='';for(const _0x32f221 of _0x59d2a2){_0x262d15=_0x262d15?_0x262d15+'/'+_0x32f221:_0x32f221,!_0x29bfe3[_0x596eda(0x1b5)](_0x262d15)&&_0x232cfc[_0x596eda(0x1c6)](_0x262d15);}}const _0x587128=calculateActivationActions(_0x351da1[_0x596eda(0x1ca)]||[],_0x5475e6,_0x3713e1,_0x18a879),_0x1f0426=segmentToYamlString(_0x351da1);let _0x5baa1a,_0x5b4657=![],_0x104381;if(_0x58ae80){const _0x2a2c65=segmentWithActivationsToYaml(_0x58ae80,_0x5475e6,undefined,_0x3713e1,_0x18a879),_0x1bf810=segmentToYamlString(_0x2a2c65);_0x5baa1a=generateDiff(_0x1bf810,_0x1f0426),_0x5b4657=hasChanges(_0x5baa1a),_0x5b4657&&(_0x104381=formatDiffWithColors(_0x5baa1a));}else _0x5baa1a=generateDiff('',_0x1f0426),_0x104381=formatDiffWithColors(_0x5baa1a);_0x3b88d9[_0x596eda(0x1e5)]({'relativePath':_0x351da1['name'],'absolutePath':_0xb821e5,'yamlConfig':_0x351da1,'folderPath':_0x2d7f8c,'existingSegment':_0x58ae80,'existingActivations':_0x5475e6,'isNew':!_0x58ae80,'hasChanges':_0x5b4657,'diff':_0x104381,'activationActions':_0x587128});}const _0x2cbd50=new Set();for(const {yamlConfig:_0x44ec13,folderPath:_0x2d2069}of _0x3fe49e){const _0x394f01=resolveTDFolderPath(_0x2d2069,_0x28d875,_0x3e8f13);_0x2cbd50['add'](_0x394f01+':'+_0x44ec13[_0x596eda(0x1ab)]);}const _0x1d70a2=_0x5b72d4['filter'](_0x33dc3b=>{const _0x100ac6=_0x596eda,_0xc4e936=_0x33dc3b[_0x100ac6(0x1ea)]?_0x18fcae['get'](_0x33dc3b['segmentFolderId']['toString']())||'':'',_0x2360e8=_0xc4e936+':'+_0x33dc3b['name'];if(_0x2cbd50[_0x100ac6(0x1b5)](_0x2360e8))return![];if(_0x28d875)return _0xc4e936===_0x3e8f13||_0xc4e936['startsWith'](_0x3e8f13+'/');return!![];}),_0xec7fda=_0x3b88d9[_0x596eda(0x1f2)](_0x424baa=>_0x424baa[_0x596eda(0x1d3)]),_0x3f27b6=_0x3b88d9[_0x596eda(0x1f2)](_0x11aa90=>!_0x11aa90[_0x596eda(0x1d3)]&&_0x11aa90[_0x596eda(0x1ba)]),_0x3ae575=_0x3b88d9[_0x596eda(0x1f2)](_0x6db935=>!_0x6db935[_0x596eda(0x1d3)]&&!_0x6db935[_0x596eda(0x1ba)]),_0xd2a783=Array['from'](_0x232cfc)[_0x596eda(0x1e2)](),_0x22d2d3=_0x2208ca[_0x596eda(0x1ec)]?_0x1d70a2:[],_0x6437ba=_0x3b88d9[_0x596eda(0x197)](_0x3d1dc2=>_0x3d1dc2['activationActions']),_0x3c5597=_0x6437ba[_0x596eda(0x1f2)](_0x3cb0f3=>_0x3cb0f3[_0x596eda(0x1ee)]===_0x596eda(0x1c5)),_0x430579=_0x6437ba[_0x596eda(0x1f2)](_0x2c0ddb=>_0x2c0ddb[_0x596eda(0x1ee)]===_0x596eda(0x204)),_0x215e35=_0x6437ba[_0x596eda(0x1f2)](_0x2ec056=>_0x2ec056[_0x596eda(0x1ee)]===_0x596eda(0x1ec));console[_0x596eda(0x1e7)]('\x0aPush\x20summary\x20for\x20\x27'+_0x11b2c6+'\x27:');_0xd2a783[_0x596eda(0x1d8)]>0x0&&console[_0x596eda(0x1e7)]('\x20\x20'+a34_0x5f1c93[_0x596eda(0x214)](_0x596eda(0x216)+_0xd2a783['length']+_0x596eda(0x1aa)));console[_0x596eda(0x1e7)]('\x20\x20'+a34_0x5f1c93[_0x596eda(0x19b)]('+\x20'+_0xec7fda[_0x596eda(0x1d8)]+'\x20new\x20segments')),console[_0x596eda(0x1e7)]('\x20\x20'+a34_0x5f1c93[_0x596eda(0x217)]('~\x20'+_0x3f27b6[_0x596eda(0x1d8)]+'\x20changed\x20segments'));if(_0x22d2d3[_0x596eda(0x1d8)]>0x0)console[_0x596eda(0x1e7)]('\x20\x20'+a34_0x5f1c93['red']('-\x20'+_0x22d2d3[_0x596eda(0x1d8)]+_0x596eda(0x1b9)));else _0x1d70a2[_0x596eda(0x1d8)]>0x0&&!_0x2208ca[_0x596eda(0x1ec)]&&console[_0x596eda(0x1e7)]('\x20\x20'+a34_0x5f1c93[_0x596eda(0x1b0)]('\x20\x20'+_0x1d70a2[_0x596eda(0x1d8)]+_0x596eda(0x1ef)));console[_0x596eda(0x1e7)]('\x20\x20'+a34_0x5f1c93[_0x596eda(0x1b0)]('=\x20'+_0x3ae575['length']+'\x20unchanged\x20segments'));_0x6437ba['length']>0x0&&(console[_0x596eda(0x1e7)](''),console[_0x596eda(0x1e7)](_0x596eda(0x1a1)),_0x3c5597[_0x596eda(0x1d8)]>0x0&&console[_0x596eda(0x1e7)]('\x20\x20\x20\x20'+a34_0x5f1c93['green']('+\x20'+_0x3c5597['length']+'\x20to\x20create')),_0x430579[_0x596eda(0x1d8)]>0x0&&console[_0x596eda(0x1e7)](_0x596eda(0x1a3)+a34_0x5f1c93[_0x596eda(0x217)]('~\x20'+_0x430579[_0x596eda(0x1d8)]+_0x596eda(0x196))),_0x215e35[_0x596eda(0x1d8)]>0x0&&console[_0x596eda(0x1e7)](_0x596eda(0x1a3)+a34_0x5f1c93['red']('-\x20'+_0x215e35['length']+'\x20to\x20delete')));console[_0x596eda(0x1e7)](_0x596eda(0x1a7)+a34_0x5f1c93[_0x596eda(0x1c7)](_0xc1a389)+'\x0a');if(_0xd2a783[_0x596eda(0x1d8)]>0x0){console['error'](_0x596eda(0x1b4));for(const _0x1f9b5d of _0xd2a783){console['error']('\x20\x20'+a34_0x5f1c93[_0x596eda(0x214)]('+')+'\x20'+_0x1f9b5d);}console[_0x596eda(0x1e7)]('');}if(_0xec7fda['length']>0x0)for(const _0x145f02 of _0xec7fda){const _0x24927d=_0x145f02[_0x596eda(0x202)]?_0x145f02['folderPath']+'/'+_0x145f02[_0x596eda(0x1b3)][_0x596eda(0x1ab)]:_0x145f02[_0x596eda(0x1b3)][_0x596eda(0x1ab)],_0x5aef70=_0x145f02[_0x596eda(0x1b3)][_0x596eda(0x1ca)]?.[_0x596eda(0x1d8)]||0x0,_0x4f1342=_0x5aef70>0x0?a34_0x5f1c93[_0x596eda(0x1b0)]('\x20['+_0x5aef70+'\x20activations]'):'';console[_0x596eda(0x1e7)]('\x0a'+a34_0x5f1c93[_0x596eda(0x19b)]('New\x20segment:')+'\x20'+_0x24927d+_0x4f1342),console[_0x596eda(0x1e7)]('─'[_0x596eda(0x1fb)](0x3c)),_0x145f02['diff']&&console[_0x596eda(0x1e7)](_0x145f02[_0x596eda(0x206)]),console[_0x596eda(0x1e7)]('─'['repeat'](0x3c));}if(_0x22d2d3[_0x596eda(0x1d8)]>0x0)for(const _0x7c5195 of _0x22d2d3){const _0x3579a1=_0x7c5195[_0x596eda(0x1ea)]?_0x18fcae[_0x596eda(0x20a)](_0x7c5195[_0x596eda(0x1ea)][_0x596eda(0x199)]())||'':'',_0x52d006=_0x3579a1?_0x3579a1+'/'+_0x7c5195[_0x596eda(0x1ab)]:_0x7c5195[_0x596eda(0x1ab)],_0xcb729b=_0x3b47cd[_0x596eda(0x20a)](_0x7c5195['id'])||[],_0x97a97d=_0xcb729b['length']>0x0?a34_0x5f1c93[_0x596eda(0x1b0)]('\x20['+_0xcb729b[_0x596eda(0x1d8)]+_0x596eda(0x1d0)):'';console['error']('\x0a'+a34_0x5f1c93[_0x596eda(0x1e3)]('Delete\x20segment:')+'\x20'+_0x52d006+_0x97a97d),console['error']('─'[_0x596eda(0x1fb)](0x3c));const _0x266ae5=segmentWithActivationsToYaml(_0x7c5195,_0xcb729b,undefined,_0x3713e1,_0x18a879),_0x541ee2=segmentToYamlString(_0x266ae5),_0x1d32d9=generateDiff(_0x541ee2,'');console[_0x596eda(0x1e7)](formatDiffWithColors(_0x1d32d9)),console[_0x596eda(0x1e7)]('─'[_0x596eda(0x1fb)](0x3c));}const _0x43c06c=_0x3b88d9[_0x596eda(0x1f2)](_0xb4a5=>!_0xb4a5['isNew']&&_0xb4a5['diff']);if(_0x43c06c[_0x596eda(0x1d8)]>0x0)for(const _0x5403ef of _0x43c06c){const _0x4caac6=_0x5403ef[_0x596eda(0x202)]?_0x5403ef[_0x596eda(0x202)]+'/'+_0x5403ef[_0x596eda(0x1b3)][_0x596eda(0x1ab)]:_0x5403ef[_0x596eda(0x1b3)][_0x596eda(0x1ab)];console[_0x596eda(0x1e7)]('\x0a'+a34_0x5f1c93[_0x596eda(0x217)]('Changes\x20to:')+'\x20'+_0x4caac6),console[_0x596eda(0x1e7)]('─'[_0x596eda(0x1fb)](0x3c)),console[_0x596eda(0x1e7)](_0x5403ef[_0x596eda(0x206)]),console[_0x596eda(0x1e7)]('─'['repeat'](0x3c));}if(_0x2208ca[_0x596eda(0x1bc)])return console[_0x596eda(0x1e7)](a34_0x5f1c93[_0x596eda(0x217)](_0x596eda(0x1f5))),0x0;const _0x5bb73d=_0xec7fda[_0x596eda(0x1d8)]>0x0||_0x3f27b6[_0x596eda(0x1d8)]>0x0||_0x22d2d3[_0x596eda(0x1d8)]>0x0,_0x499607=_0x6437ba['length']>0x0,_0x49d49b=_0xd2a783['length']>0x0;if(!_0x5bb73d&&!_0x499607&&!_0x49d49b)return console[_0x596eda(0x1e7)](a34_0x5f1c93['green'](_0x596eda(0x1fa))),0x0;const _0x19dc85=_0xec7fda[_0x596eda(0x1d8)]+_0x3f27b6[_0x596eda(0x1d8)]+_0x22d2d3[_0x596eda(0x1d8)]+_0xd2a783['length']+_0x6437ba['length'];if(!_0x2208ca['yes']&&_0x19dc85>0x0){const _0x10abee=await confirmKey('Push\x20'+_0x19dc85+'\x20changes?');if(!_0x10abee)return console[_0x596eda(0x1e7)](_0x596eda(0x1ad)),0x1;}for(const _0x27d5df of _0xd2a783){const _0x1313af=_0x27d5df[_0x596eda(0x1fe)]('/'),_0x499813=_0x1313af[_0x1313af[_0x596eda(0x1d8)]-0x1],_0x489922=_0x1313af[_0x596eda(0x1e6)](0x0,-0x1)[_0x596eda(0x1b8)]('/'),_0xe676ec=_0x29bfe3[_0x596eda(0x20a)](_0x489922),_0x371a5e={'name':_0x499813,'parentFolderId':_0xe676ec},_0x135b94=await withSpinner(_0x596eda(0x1eb)+_0x27d5df+'\x27...',()=>_0x20ad71[_0x596eda(0x1bf)][_0x596eda(0x1ce)](_0x4e4df6,_0x371a5e),{'verbose':_0x2208ca[_0x596eda(0x1a0)]});_0x29bfe3['set'](_0x27d5df,_0x135b94[_0x596eda(0x20b)]['id']),console[_0x596eda(0x1e7)](a34_0x5f1c93[_0x596eda(0x214)](_0x596eda(0x1fc)+_0x27d5df+'\x27'));}let _0x3ceced=0x0,_0x48ee31=0x0,_0x3295bd=0x0,_0x30b66d=0x0,_0x3d11ca=0x0,_0x392fd5=0x0;const _0x37aad9=new Map();for(const _0x232083 of _0x3b88d9){const _0x313f4e=_0x232083[_0x596eda(0x202)]?_0x29bfe3[_0x596eda(0x20a)](_0x232083[_0x596eda(0x202)]):undefined;let _0x2cc333;if(_0x232083['isNew']){const _0x302021=yamlToCreateRequest(_0x232083['yamlConfig'],_0x313f4e),_0x4c74a7=await withSpinner(_0x596eda(0x1b2)+_0x232083[_0x596eda(0x1b3)][_0x596eda(0x1ab)]+'\x27...',()=>_0x20ad71['segment']['createSegment'](_0x4e4df6,_0x302021),{'verbose':_0x2208ca['verbose']});_0x2cc333=_0x4c74a7[_0x596eda(0x20b)]['id'],_0x37aad9[_0x596eda(0x205)](_0x232083[_0x596eda(0x1b3)][_0x596eda(0x1ab)],_0x2cc333),console['error'](a34_0x5f1c93['green'](_0x596eda(0x19a)+_0x232083[_0x596eda(0x1b3)][_0x596eda(0x1ab)]+'\x27')),_0x3ceced++;}else{if(_0x232083[_0x596eda(0x1ba)]){const _0x5d06e0=yamlToUpdateRequest(_0x232083[_0x596eda(0x1b3)]);_0x313f4e!==_0x232083[_0x596eda(0x1a8)]?.[_0x596eda(0x1ea)]&&(_0x5d06e0[_0x596eda(0x1ea)]=_0x313f4e?parseInt(_0x313f4e,0xa):undefined),await withSpinner(_0x596eda(0x1d4)+_0x232083[_0x596eda(0x1b3)][_0x596eda(0x1ab)]+_0x596eda(0x1de),()=>_0x20ad71[_0x596eda(0x1bf)][_0x596eda(0x1da)](_0x4e4df6,_0x232083['existingSegment']['id'],_0x5d06e0),{'verbose':_0x2208ca[_0x596eda(0x1a0)]}),_0x2cc333=_0x232083[_0x596eda(0x1a8)]['id'],console[_0x596eda(0x1e7)](a34_0x5f1c93[_0x596eda(0x217)](_0x596eda(0x1e8)+_0x232083[_0x596eda(0x1b3)]['name']+'\x27')),_0x48ee31++;}else _0x2cc333=_0x232083[_0x596eda(0x1a8)]['id'];}for(const _0x99af04 of _0x232083[_0x596eda(0x213)]){if(_0x99af04[_0x596eda(0x1ee)]===_0x596eda(0x1c5)&&_0x99af04['yamlActivation']){const _0x2b9c7b=yamlActivationToCreateRequest(_0x99af04[_0x596eda(0x1c1)],_0x88e6ab,_0x34832d);await withSpinner(_0x596eda(0x1e4)+_0x99af04[_0x596eda(0x1ab)]+'\x27...',()=>_0x20ad71['segment'][_0x596eda(0x1d6)](_0x4e4df6,_0x2cc333,_0x2b9c7b),{'verbose':_0x2208ca[_0x596eda(0x1a0)]}),console[_0x596eda(0x1e7)](a34_0x5f1c93[_0x596eda(0x19b)](_0x596eda(0x1a2)+_0x99af04[_0x596eda(0x1ab)]+'\x27')),_0x30b66d++;}else{if(_0x99af04['type']===_0x596eda(0x204)&&_0x99af04[_0x596eda(0x1c1)]&&_0x99af04[_0x596eda(0x215)]){const _0x5d7491=yamlActivationToUpdateRequest(_0x99af04[_0x596eda(0x1c1)],_0x88e6ab,_0x34832d);await withSpinner(_0x596eda(0x1b6)+_0x99af04[_0x596eda(0x1ab)]+_0x596eda(0x1de),()=>_0x20ad71[_0x596eda(0x1bf)]['updateActivation'](_0x4e4df6,_0x2cc333,_0x99af04['existingActivation']['id'],_0x5d7491),{'verbose':_0x2208ca[_0x596eda(0x1a0)]}),console[_0x596eda(0x1e7)](a34_0x5f1c93[_0x596eda(0x217)](_0x596eda(0x1dc)+_0x99af04[_0x596eda(0x1ab)]+'\x27')),_0x3d11ca++;}else _0x99af04['type']==='delete'&&_0x99af04[_0x596eda(0x215)]&&(await withSpinner(_0x596eda(0x207)+_0x99af04['name']+_0x596eda(0x1de),()=>_0x20ad71[_0x596eda(0x1bf)]['deleteActivation'](_0x4e4df6,_0x2cc333,_0x99af04[_0x596eda(0x215)]['id']),{'verbose':_0x2208ca['verbose']}),console['error'](a34_0x5f1c93[_0x596eda(0x1e3)](_0x596eda(0x210)+_0x99af04['name']+'\x27')),_0x392fd5++);}}}for(const _0x3db667 of _0x22d2d3){await withSpinner('Deleting\x20segment\x20\x27'+_0x3db667[_0x596eda(0x1ab)]+_0x596eda(0x1de),()=>_0x20ad71['segment'][_0x596eda(0x1bd)](_0x3db667['id']),{'verbose':_0x2208ca[_0x596eda(0x1a0)]}),console[_0x596eda(0x1e7)](a34_0x5f1c93[_0x596eda(0x1e3)]('✔\x20Deleted\x20segment\x20\x27'+_0x3db667[_0x596eda(0x1ab)]+'\x27')),_0x3295bd++;}const _0x48cad7=[];if(_0x3ceced>0x0)_0x48cad7[_0x596eda(0x1e5)](_0x3ceced+_0x596eda(0x1d7));if(_0x48ee31>0x0)_0x48cad7[_0x596eda(0x1e5)](_0x48ee31+_0x596eda(0x1cc));if(_0x3295bd>0x0)_0x48cad7[_0x596eda(0x1e5)](_0x3295bd+_0x596eda(0x1cd));const _0x20f308=[];if(_0x30b66d>0x0)_0x20f308[_0x596eda(0x1e5)](_0x30b66d+_0x596eda(0x1d7));if(_0x3d11ca>0x0)_0x20f308[_0x596eda(0x1e5)](_0x3d11ca+_0x596eda(0x1cc));if(_0x392fd5>0x0)_0x20f308[_0x596eda(0x1e5)](_0x392fd5+_0x596eda(0x1cd));return console['error'](a34_0x5f1c93[_0x596eda(0x19b)](_0x596eda(0x1ff))),_0x48cad7[_0x596eda(0x1d8)]>0x0&&console[_0x596eda(0x1e7)](_0x596eda(0x1a9)+_0x48cad7['join'](',\x20')),_0x20f308['length']>0x0&&console[_0x596eda(0x1e7)](_0x596eda(0x1af)+_0x20f308[_0x596eda(0x1b8)](',\x20')),0x0;}}function buildFolderPathToIdMap(_0x146a65){const _0x2e2c29=a34_0x247e21,_0x596689=new Map(),_0x1de93f=new Map();for(const _0x45c53b of _0x146a65){_0x1de93f[_0x2e2c29(0x205)](_0x45c53b['id'],_0x45c53b);}const _0x23d2e1=new Set();for(const _0x37d54e of _0x146a65){!_0x37d54e[_0x2e2c29(0x1c2)]&&_0x23d2e1[_0x2e2c29(0x1c6)](_0x37d54e['id']);}function _0x49302a(_0x219971){const _0x12648a=_0x2e2c29;if(_0x23d2e1['has'](_0x219971['id']))return'';if(_0x219971['parentFolderId']){const _0x8edb49=_0x1de93f[_0x12648a(0x20a)](_0x219971[_0x12648a(0x1c2)]);if(_0x8edb49){const _0xf116f7=_0x49302a(_0x8edb49);return _0xf116f7?_0xf116f7+'/'+_0x219971[_0x12648a(0x1ab)]:_0x219971[_0x12648a(0x1ab)];}}return _0x219971['name'];}for(const _0x46f632 of _0x146a65){const _0x5d534c=_0x49302a(_0x46f632);_0x596689[_0x2e2c29(0x205)](_0x5d534c,_0x46f632['id']);}return _0x596689;}function a34_0xe85f(_0x354c6d,_0x32b361){_0x354c6d=_0x354c6d-0x196;const _0x132122=a34_0x1321();let _0xe85ff9=_0x132122[_0x354c6d];return _0xe85ff9;}function findYamlFiles(_0x5b59ac){const _0x4d6d6a=[];function _0x3e89b1(_0x5c0b6e){const _0x362d02=a34_0xe85f,_0x3a4108=readdirSync(_0x5c0b6e,{'withFileTypes':!![]});for(const _0x419282 of _0x3a4108){const _0xdd6e40=a34_0x14ebde[_0x362d02(0x1b8)](_0x5c0b6e,_0x419282[_0x362d02(0x1ab)]);if(_0x419282[_0x362d02(0x1fd)]())_0x3e89b1(_0xdd6e40);else(_0x419282[_0x362d02(0x1ab)]['endsWith'](_0x362d02(0x1bb))||_0x419282[_0x362d02(0x1ab)]['endsWith'](_0x362d02(0x1e0)))&&_0x4d6d6a[_0x362d02(0x1e5)](_0xdd6e40);}}return _0x3e89b1(_0x5b59ac),_0x4d6d6a;}function calculateActivationActions(_0x218e59,_0x25600a,_0xeb3dd8,_0x407c81){const _0xa42e1a=a34_0x247e21,_0x4cc088=[],_0x5e795f=new Map();for(const _0xc65895 of _0x25600a){_0x5e795f['set'](_0xc65895['name'],_0xc65895);}const _0x1b9edf=new Map();for(const _0x19f871 of _0x218e59){_0x1b9edf[_0xa42e1a(0x205)](_0x19f871[_0xa42e1a(0x1ab)],_0x19f871);}for(const _0xdf943e of _0x218e59){const _0x1017b0=_0x5e795f[_0xa42e1a(0x20a)](_0xdf943e['name']);if(!_0x1017b0)_0x4cc088['push']({'type':_0xa42e1a(0x1c5),'name':_0xdf943e['name'],'yamlActivation':_0xdf943e});else{const _0x42ffea=activationToYaml(_0x1017b0,_0xeb3dd8,_0x407c81),_0x54a117=a34_0x54d242['stringify'](_0x42ffea),_0x34c15d=a34_0x54d242[_0xa42e1a(0x211)](_0xdf943e);_0x54a117!==_0x34c15d&&_0x4cc088[_0xa42e1a(0x1e5)]({'type':_0xa42e1a(0x204),'name':_0xdf943e[_0xa42e1a(0x1ab)],'yamlActivation':_0xdf943e,'existingActivation':_0x1017b0});}}for(const _0x4d303e of _0x25600a){!_0x1b9edf['has'](_0x4d303e[_0xa42e1a(0x1ab)])&&_0x4cc088[_0xa42e1a(0x1e5)]({'type':_0xa42e1a(0x1ec),'name':_0x4d303e[_0xa42e1a(0x1ab)],'existingActivation':_0x4d303e});}return _0x4cc088;}
@@ -1 +1 @@
1
- const a35_0x1eddb8=a35_0x5066;function a35_0x35a5(){const _0x431cfe=['556LgCOPM','name','1775784uTOvgv','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','kind','16101wBvLPe','rule','\x27...','Resolved\x20relative\x20path\x20to:\x20','resolveFolderId','Resolving\x20folder\x20\x27','1095zhVWcf','execute','description','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','verbose','resolvePathToResource','data','35UqCiWy','⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.','segmentId','Updating\x20segment\x20\x27','618440buACAE','type','Examples:','yellow','segmentPath','segment:update','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','includes','segment','276YGWcIl','Parent\x20ID:\x20','parentId','Segment\x20ID\x20missing\x20from\x20resolved\x20path','error','\x20\x20\x20Path:\x20','Update\x20existing\x20child\x20segment','ruleFile','217368gPbjLh','22lexLMH','703870ptxYKY','Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]','Error:\x20Cannot\x20update\x20','folder','✔\x20Updated\x20segment\x20\x27','350990ujtMUx'];a35_0x35a5=function(){return _0x431cfe;};return a35_0x35a5();}(function(_0x15ff24,_0xa690a7){const _0x5d221f=a35_0x5066,_0x556f69=_0x15ff24();while(!![]){try{const _0x27a6d7=-parseInt(_0x5d221f(0x100))/0x1*(-parseInt(_0x5d221f(0x124))/0x2)+parseInt(_0x5d221f(0xfa))/0x3*(parseInt(_0x5d221f(0x114))/0x4)+parseInt(_0x5d221f(0x11e))/0x5+-parseInt(_0x5d221f(0xf7))/0x6+parseInt(_0x5d221f(0x107))/0x7*(-parseInt(_0x5d221f(0x10b))/0x8)+parseInt(_0x5d221f(0x11c))/0x9+-parseInt(_0x5d221f(0x123))/0xa*(-parseInt(_0x5d221f(0x11d))/0xb);if(_0x27a6d7===_0xa690a7)break;else _0x556f69['push'](_0x556f69['shift']());}catch(_0x237cdd){_0x556f69['push'](_0x556f69['shift']());}}}(a35_0x35a5,0x37828));import{BaseCommand}from'./command.js';function a35_0x5066(_0x27bf32,_0x510f26){_0x27bf32=_0x27bf32-0xf7;const _0x35a5a7=a35_0x35a5();let _0x506657=_0x35a5a7[_0x27bf32];return _0x506657;}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 a35_0x492ad1 from'chalk';export class SegmentUpdateCommand extends BaseCommand{[a35_0x1eddb8(0x125)]=a35_0x1eddb8(0x110);[a35_0x1eddb8(0x102)]=a35_0x1eddb8(0x11a);async[a35_0x1eddb8(0x101)](_0x61caf5){const _0xb6cc18=a35_0x1eddb8;console[_0xb6cc18(0x118)](a35_0x492ad1[_0xb6cc18(0x10e)](_0xb6cc18(0x108))),console[_0xb6cc18(0x118)](a35_0x492ad1[_0xb6cc18(0x10e)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x432558,args:_0x24b35b,tdx:_0x46522d}=_0x61caf5,_0x45ab9d=_0x432558;if(_0x24b35b['length']===0x0)return console[_0xb6cc18(0x118)](_0xb6cc18(0x111)),console[_0xb6cc18(0x118)](_0xb6cc18(0x103)),console['error'](_0xb6cc18(0x10d)),console[_0xb6cc18(0x118)](_0xb6cc18(0xf8)),console[_0xb6cc18(0x118)]('\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x32e356=_0x24b35b[0x0],_0x3d7de0=_0x432558[_0xb6cc18(0x10f)];let _0x575a25=_0x32e356;_0x3d7de0&&!_0x32e356[_0xb6cc18(0x112)]('/')&&(_0x575a25=_0x3d7de0+'/'+_0x32e356,_0x45ab9d['verbose']&&console[_0xb6cc18(0x118)](_0xb6cc18(0xfd)+_0x575a25));const _0x129ed5=await withSpinner('Resolving\x20path\x20\x27'+_0x575a25+_0xb6cc18(0xfc),()=>_0x46522d[_0xb6cc18(0x113)][_0xb6cc18(0x105)](_0x575a25),{'verbose':_0x45ab9d[_0xb6cc18(0x104)]}),_0x212f5f=_0x129ed5[_0xb6cc18(0x106)];_0x45ab9d[_0xb6cc18(0x104)]&&console[_0xb6cc18(0x118)]('Resolved\x20type:\x20'+_0x212f5f[_0xb6cc18(0x10c)]);if(_0x212f5f[_0xb6cc18(0x10c)]!==_0xb6cc18(0x113))return console[_0xb6cc18(0x118)](_0xb6cc18(0x120)+_0x212f5f[_0xb6cc18(0x10c)]+'.\x20Only\x20child\x20segments\x20can\x20be\x20updated.'),console[_0xb6cc18(0x118)](_0xb6cc18(0x11f)),0x1;if(!_0x212f5f[_0xb6cc18(0x109)])throw new SDKError(ErrorCode['INTERNAL'],_0xb6cc18(0x117));const _0xf154ec=_0x212f5f[_0xb6cc18(0x116)],_0xcdd19c=_0x212f5f[_0xb6cc18(0x109)];_0x45ab9d[_0xb6cc18(0x104)]&&(console[_0xb6cc18(0x118)](_0xb6cc18(0x115)+_0xf154ec),console['error']('Segment\x20ID:\x20'+_0xcdd19c));let _0x471047;if(_0x45ab9d['folder']){const _0x21317d=_0x45ab9d[_0xb6cc18(0x121)],_0x4e54b6=await withSpinner(_0xb6cc18(0xff)+_0x21317d+'\x27...',()=>_0x46522d[_0xb6cc18(0x113)][_0xb6cc18(0xfe)](_0xf154ec,_0x21317d),{'verbose':_0x45ab9d['verbose']});_0x471047=parseInt(_0x4e54b6['data'],0xa),_0x45ab9d[_0xb6cc18(0x104)]&&console['error']('Resolved\x20folder\x20ID:\x20'+_0x471047);}const _0x474c0e=await loadJSONFromOptions(_0x45ab9d[_0xb6cc18(0xfb)],_0x45ab9d[_0xb6cc18(0x11b)]),_0x4e354d={'name':_0x45ab9d[_0xb6cc18(0x125)],'description':_0x45ab9d[_0xb6cc18(0x102)],'rule':_0x474c0e,'kind':_0x45ab9d[_0xb6cc18(0xf9)]!==undefined?parseInt(_0x45ab9d['kind'],0xa):undefined,'segmentFolderId':_0x471047},_0x1e50df=await withSpinner(_0xb6cc18(0x10a)+_0x212f5f['segmentName']+_0xb6cc18(0xfc),()=>_0x46522d[_0xb6cc18(0x113)]['updateSegmentById'](_0xf154ec,_0xcdd19c,_0x4e354d),{'verbose':_0x45ab9d[_0xb6cc18(0x104)]}),_0x1b3f94=_0x1e50df[_0xb6cc18(0x106)];return console[_0xb6cc18(0x118)](_0xb6cc18(0x122)+_0x1b3f94['name']+'\x27'),_0x575a25!==_0x32e356&&console[_0xb6cc18(0x118)](_0xb6cc18(0x119)+_0x575a25),await handleSDKOutput([_0x1b3f94],_0x45ab9d),0x0;}}
1
+ function a35_0x5f03(_0x13ea23,_0x3b9ab9){_0x13ea23=_0x13ea23-0x1ce;const _0x1b4088=a35_0x1b40();let _0x5f03ea=_0x1b4088[_0x13ea23];return _0x5f03ea;}const a35_0x309974=a35_0x5f03;(function(_0x256fe9,_0x5642fb){const _0x244b2e=a35_0x5f03,_0x46079e=_0x256fe9();while(!![]){try{const _0x5f4dba=parseInt(_0x244b2e(0x1f7))/0x1+parseInt(_0x244b2e(0x1e7))/0x2*(-parseInt(_0x244b2e(0x1f6))/0x3)+-parseInt(_0x244b2e(0x1d9))/0x4*(parseInt(_0x244b2e(0x1e3))/0x5)+parseInt(_0x244b2e(0x1ea))/0x6*(-parseInt(_0x244b2e(0x1de))/0x7)+-parseInt(_0x244b2e(0x1f2))/0x8+-parseInt(_0x244b2e(0x1ee))/0x9+parseInt(_0x244b2e(0x1d7))/0xa;if(_0x5f4dba===_0x5642fb)break;else _0x46079e['push'](_0x46079e['shift']());}catch(_0x30cfb6){_0x46079e['push'](_0x46079e['shift']());}}}(a35_0x1b40,0x4875b));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 a35_0x42dbae from'chalk';function a35_0x1b40(){const _0x2b6ffe=['execute','373745fHyufT','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','\x20\x20\x20Path:\x20','folder','4xvkSUE','Examples:','Segment\x20ID\x20missing\x20from\x20resolved\x20path','636jAzhEG','kind','verbose','yellow','1695024qaAkwh','ruleFile','✔\x20Updated\x20segment\x20\x27','type','2295208qmuKNA','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','rule','error','69294lwGlsF','1083DcrJqm','INTERNAL','data','Resolved\x20relative\x20path\x20to:\x20','segmentId','Resolved\x20type:\x20','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','Resolved\x20folder\x20ID:\x20','updateSegmentById','\x27...','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','name','Segment\x20ID:\x20','14038820kabfvc','Updating\x20segment\x20\x27','28FiXiyP','includes','Resolving\x20folder\x20\x27','description','segment:update','4193dTwxnO','resolveFolderId','Error:\x20Cannot\x20update\x20','segment'];a35_0x1b40=function(){return _0x2b6ffe;};return a35_0x1b40();}export class SegmentUpdateCommand extends BaseCommand{[a35_0x309974(0x1d5)]=a35_0x309974(0x1dd);[a35_0x309974(0x1dc)]='Update\x20existing\x20child\x20segment';async[a35_0x309974(0x1e2)](_0x3811b7){const _0x1705c2=a35_0x309974;console[_0x1705c2(0x1f5)](a35_0x42dbae[_0x1705c2(0x1ed)]('⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.')),console[_0x1705c2(0x1f5)](a35_0x42dbae[_0x1705c2(0x1ed)](_0x1705c2(0x1d4)));const {options:_0x9c0f7d,args:_0x5ac9ed,tdx:_0x1a24e4}=_0x3811b7,_0x2f3593=_0x9c0f7d;if(_0x5ac9ed['length']===0x0)return console[_0x1705c2(0x1f5)](_0x1705c2(0x1f3)),console['error'](_0x1705c2(0x1d0)),console['error'](_0x1705c2(0x1e8)),console[_0x1705c2(0x1f5)](_0x1705c2(0x1e4)),console[_0x1705c2(0x1f5)]('\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x6aa24=_0x5ac9ed[0x0],_0x10b1a4=_0x9c0f7d['segmentPath'];let _0x27d652=_0x6aa24;_0x10b1a4&&!_0x6aa24[_0x1705c2(0x1da)]('/')&&(_0x27d652=_0x10b1a4+'/'+_0x6aa24,_0x2f3593[_0x1705c2(0x1ec)]&&console[_0x1705c2(0x1f5)](_0x1705c2(0x1fa)+_0x27d652));const _0x154802=await withSpinner('Resolving\x20path\x20\x27'+_0x27d652+_0x1705c2(0x1d3),()=>_0x1a24e4['segment']['resolvePathToResource'](_0x27d652),{'verbose':_0x2f3593['verbose']}),_0x4aa5c8=_0x154802['data'];_0x2f3593[_0x1705c2(0x1ec)]&&console[_0x1705c2(0x1f5)](_0x1705c2(0x1cf)+_0x4aa5c8[_0x1705c2(0x1f1)]);if(_0x4aa5c8[_0x1705c2(0x1f1)]!==_0x1705c2(0x1e1))return console[_0x1705c2(0x1f5)](_0x1705c2(0x1e0)+_0x4aa5c8[_0x1705c2(0x1f1)]+'.\x20Only\x20child\x20segments\x20can\x20be\x20updated.'),console['error']('Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]'),0x1;if(!_0x4aa5c8[_0x1705c2(0x1ce)])throw new SDKError(ErrorCode[_0x1705c2(0x1f8)],_0x1705c2(0x1e9));const _0x579b16=_0x4aa5c8['parentId'],_0x4891a0=_0x4aa5c8['segmentId'];_0x2f3593[_0x1705c2(0x1ec)]&&(console[_0x1705c2(0x1f5)]('Parent\x20ID:\x20'+_0x579b16),console[_0x1705c2(0x1f5)](_0x1705c2(0x1d6)+_0x4891a0));let _0x15c56e;if(_0x2f3593[_0x1705c2(0x1e6)]){const _0x4434c1=_0x2f3593[_0x1705c2(0x1e6)],_0x2fd8c3=await withSpinner(_0x1705c2(0x1db)+_0x4434c1+_0x1705c2(0x1d3),()=>_0x1a24e4[_0x1705c2(0x1e1)][_0x1705c2(0x1df)](_0x579b16,_0x4434c1),{'verbose':_0x2f3593[_0x1705c2(0x1ec)]});_0x15c56e=parseInt(_0x2fd8c3['data'],0xa),_0x2f3593[_0x1705c2(0x1ec)]&&console[_0x1705c2(0x1f5)](_0x1705c2(0x1d1)+_0x15c56e);}const _0x2b0f17=await loadJSONFromOptions(_0x2f3593[_0x1705c2(0x1f4)],_0x2f3593[_0x1705c2(0x1ef)]),_0xf66264={'name':_0x2f3593['name'],'description':_0x2f3593[_0x1705c2(0x1dc)],'rule':_0x2b0f17,'kind':_0x2f3593['kind']!==undefined?parseInt(_0x2f3593[_0x1705c2(0x1eb)],0xa):undefined,'segmentFolderId':_0x15c56e},_0x13626d=await withSpinner(_0x1705c2(0x1d8)+_0x4aa5c8['segmentName']+_0x1705c2(0x1d3),()=>_0x1a24e4['segment'][_0x1705c2(0x1d2)](_0x579b16,_0x4891a0,_0xf66264),{'verbose':_0x2f3593[_0x1705c2(0x1ec)]}),_0x51dc80=_0x13626d[_0x1705c2(0x1f9)];return console[_0x1705c2(0x1f5)](_0x1705c2(0x1f0)+_0x51dc80[_0x1705c2(0x1d5)]+'\x27'),_0x27d652!==_0x6aa24&&console[_0x1705c2(0x1f5)](_0x1705c2(0x1e5)+_0x27d652),await handleSDKOutput([_0x51dc80],_0x2f3593),0x0;}}