@treasuredata/tdx 0.8.1 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +2 -2
- package/dist/cli-categories.js +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/client/cdp-api-client.js +1 -1
- package/dist/client/engage-api-client.js +1 -1
- package/dist/client/http-client.js +1 -1
- package/dist/client/llm-api-client.js +1 -1
- package/dist/client/rate-limiter.js +1 -1
- package/dist/client/td-api-client.js +1 -1
- package/dist/client/trino-api-client.js +1 -1
- package/dist/client/workflow-client.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.d.ts.map +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-command.js.map +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/context-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-proxy.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/index.js +1 -1
- package/dist/proxy/anthropic-adapter.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/context-signature.js +1 -1
- package/dist/proxy/conversation-utils.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/llm.js +1 -1
- package/dist/sdk/query.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/workflow.js +1 -1
- package/dist/types/endpoints.js +1 -1
- package/dist/types/index.js +1 -1
- package/dist/utils/agent-ref-parser.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/chat-cache.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/command-output.js +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/fields-display.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/format-detector.js +1 -1
- package/dist/utils/formatters.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/llm-backup-utils.js +1 -1
- package/dist/utils/model-aliases.js +1 -1
- package/dist/utils/model-factors.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/segment-path-parser.js +1 -1
- package/dist/utils/segment-ref-parser.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sql-parser.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-config.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/tree-formatter.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/dist/utils/workflow-utils.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a28_0x4da8c0=a28_0x5d73;function a28_0x56fc(){const _0x2a53c4=['9zUYKWz','execute','2908975GzzvHb','2046KGROIR','map','scope','log','name','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','2121091kqPvPR','List\x20all\x20available\x20profiles','353085pDkylA','5406416SupNjP','profiles','Error:\x20','12CqLlyj','28880DotbOF','description','220300sbIEnY','message'];a28_0x56fc=function(){return _0x2a53c4;};return a28_0x56fc();}(function(_0x1112fd,_0x2b4cce){const _0x15c4e8=a28_0x5d73,_0x2a7386=_0x1112fd();while(!![]){try{const _0x254d65=parseInt(_0x15c4e8(0xdd))/0x1+-parseInt(_0x15c4e8(0xd6))/0x2+-parseInt(_0x15c4e8(0xd1))/0x3+-parseInt(_0x15c4e8(0xd8))/0x4+-parseInt(_0x15c4e8(0xdc))/0x5+parseInt(_0x15c4e8(0xd5))/0x6*(parseInt(_0x15c4e8(0xcf))/0x7)+parseInt(_0x15c4e8(0xd2))/0x8*(parseInt(_0x15c4e8(0xda))/0x9);if(_0x254d65===_0x2b4cce)break;else _0x2a7386['push'](_0x2a7386['shift']());}catch(_0x424adf){_0x2a7386['push'](_0x2a7386['shift']());}}}(a28_0x56fc,0x7db35));function a28_0x5d73(_0x1987af,_0x573d5b){_0x1987af=_0x1987af-0xce;const _0x56fc78=a28_0x56fc();let _0x5d7359=_0x56fc78[_0x1987af];return _0x5d7359;}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_0x4da8c0(0xe1)]=a28_0x4da8c0(0xd3);[a28_0x4da8c0(0xd7)]=a28_0x4da8c0(0xd0);async[a28_0x4da8c0(0xdb)](_0x2833d6){const _0x3c3c2e=a28_0x4da8c0,{options:_0x4b9a28}=_0x2833d6;try{const _0x1fe54d=listProfiles(),_0x33c902=getActiveProfile();if(_0x1fe54d['length']===0x0)return console[_0x3c3c2e(0xe0)](_0x3c3c2e(0xce)),console[_0x3c3c2e(0xe0)]('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console[_0x3c3c2e(0xe0)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0xdea32=_0x1fe54d[_0x3c3c2e(0xde)](_0x4c617b=>{const _0x46d376=_0x3c3c2e,_0x2c3d68=_0x4c617b[_0x46d376(0xe1)]===_0x33c902,_0x289f29=getProfileParams(_0x4c617b['config']);return{'name':_0x4c617b['name'],'active':_0x2c3d68,'scope':_0x4c617b[_0x46d376(0xdf)],'description':_0x4c617b['config'][_0x46d376(0xd7)]||'','params':_0x289f29};});return await handleSDKOutput(_0xdea32,_0x4b9a28),0x0;}catch(_0x400a05){return _0x400a05 instanceof Error&&console['error'](_0x3c3c2e(0xd4)+_0x400a05[_0x3c3c2e(0xd9)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a29_0x2f31f6=a29_0xc777;(function(_0x314e88,_0x5af573){const _0x1f3a99=a29_0xc777,_0x462145=_0x314e88();while(!![]){try{const _0x2b418b=parseInt(_0x1f3a99(0xd2))/0x1*(-parseInt(_0x1f3a99(0xca))/0x2)+parseInt(_0x1f3a99(0xc4))/0x3*(-parseInt(_0x1f3a99(0xc0))/0x4)+-parseInt(_0x1f3a99(0xba))/0x5+-parseInt(_0x1f3a99(0xaf))/0x6*(-parseInt(_0x1f3a99(0xcd))/0x7)+-parseInt(_0x1f3a99(0xdb))/0x8+-parseInt(_0x1f3a99(0xc1))/0x9+parseInt(_0x1f3a99(0xd9))/0xa*(parseInt(_0x1f3a99(0xae))/0xb);if(_0x2b418b===_0x5af573)break;else _0x462145['push'](_0x462145['shift']());}catch(_0x3b1311){_0x462145['push'](_0x462145['shift']());}}}(a29_0x4fd8,0x38023));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';function a29_0xc777(_0x2bee23,_0x4490b2){_0x2bee23=_0x2bee23-0xac;const _0x4fd8a0=a29_0x4fd8();let _0xc77765=_0x4fd8a0[_0x2bee23];return _0xc77765;}import{withQuerySpinner,formatElapsed}from'../utils/spinner.js';function a29_0x4fd8(){const _0xa6dff6=['Executing\x20statement\x20','totalSplits','...','in\x20','311566NcnScI','args','query','8603VQxlNh','file','validate','jobId','\x20-\x20','1mRJGid','data','error','push','Query\x20completed:\x20Processed\x20','Statement\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','695670bFPjdm','name','2311632GHUeQN','\x0aAll\x20results\x20saved\x20to\x20','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','Error:\x20','length','\x20rows\x20','209WLFzwd','150GCRPAR','site','Site:\x20','\x20[Job\x20ID:\x20','output','verbose','message','completedSplits','Schema:\x20','stats','execute','2290650DDvNbe','processedRows','elapsedTimeMillis','Catalog:\x20','information_schema','database','675856vYnzjH','461304RBCmIg','description','setPhase','3ymNrJO','SQL:\x20'];a29_0x4fd8=function(){return _0xa6dff6;};return a29_0x4fd8();}import{formatRows}from'../utils/formatters.js';export class QueryCommand extends BaseCommand{[a29_0x2f31f6(0xda)]=a29_0x2f31f6(0xcc);[a29_0x2f31f6(0xc2)]='Run\x20Trino\x20queries\x20(streaming)';async[a29_0x2f31f6(0xb9)](_0x52d58f){const _0x4f3eff=a29_0x2f31f6,{options:_0x21e487,args:_0x17d7a6,tdx:_0x52bede}=_0x52d58f,_0x114360=_0x17d7a6[0x0],_0x1e2c39=_0x21e487['file'];let _0x13aa05;if(_0x1e2c39)try{_0x13aa05=readSqlStatementsFromFile(_0x1e2c39);}catch(_0x515610){return console[_0x4f3eff(0xd4)]('Error:\x20'+_0x515610[_0x4f3eff(0xb5)]),0x1;}else try{_0x13aa05=splitSqlStatements(_0x114360);}catch(_0x40894c){return console['error'](_0x4f3eff(0xde)+_0x40894c[_0x4f3eff(0xb5)]),0x1;}const _0x497fbe=_0x21e487[_0x4f3eff(0xbf)]||_0x4f3eff(0xbe),_0x36c609=_0x21e487['catalog'];try{const _0x4123e1=[],_0x26fdb6=!!_0x21e487[_0x4f3eff(0xb3)];for(let _0x4b26da=0x0;_0x4b26da<_0x13aa05[_0x4f3eff(0xac)];_0x4b26da++){const _0x51db9a=_0x13aa05[_0x4b26da],_0x4a47a6=_0x4b26da+0x1,_0x271c05=_0x13aa05[_0x4f3eff(0xac)],_0x76977d=_0x271c05>0x1;_0x21e487[_0x4f3eff(0xb4)]&&(console[_0x4f3eff(0xd4)]('\x0a'+(_0x76977d?_0x4f3eff(0xd7)+_0x4a47a6+'/'+_0x271c05+':':'')),console['error'](_0x4f3eff(0xb1)+_0x21e487[_0x4f3eff(0xb0)]),console[_0x4f3eff(0xd4)](_0x4f3eff(0xbd)+(_0x36c609||'td')),console[_0x4f3eff(0xd4)](_0x4f3eff(0xb7)+_0x497fbe),console['error'](_0x4f3eff(0xc5)+_0x51db9a));const _0x5ea9a5=_0x76977d?_0x4f3eff(0xc6)+_0x4a47a6+'/'+_0x271c05+_0x4f3eff(0xc8):'Executing\x20query...';try{const _0x1d2633=await withQuerySpinner(_0x5ea9a5,async _0x4d8e9d=>{const _0x12442c=await _0x52bede['query']['execute'](_0x51db9a,{'catalog':_0x36c609,'schema':_0x497fbe,'onJobId':_0x515b98=>{_0x4d8e9d['setJobId'](_0x515b98);},'onProgress':_0x9e4924=>{const _0x5e78b9=a29_0xc777;_0x4d8e9d[_0x5e78b9(0xc3)]('Executing\x20query\x20['+_0x9e4924['state']+']'),_0x4d8e9d['setExtra'](formatRows(_0x9e4924[_0x5e78b9(0xbb)])+_0x5e78b9(0xad)+_0x9e4924[_0x5e78b9(0xb6)]+'/'+_0x9e4924[_0x5e78b9(0xc7)]+'\x20splits');}});return _0x12442c;},{'verbose':_0x21e487['verbose']}),_0x94f0e7=_0x1d2633[_0x4f3eff(0xd3)],_0x350eb5=_0x94f0e7[_0x4f3eff(0xd0)]?_0x4f3eff(0xb2)+_0x94f0e7[_0x4f3eff(0xd0)]+']':'',_0x1f4cdb=_0x76977d?_0x4f3eff(0xd7)+_0x4a47a6+'/'+_0x271c05+_0x4f3eff(0xd1):'';console[_0x4f3eff(0xd4)]('✔\x20'+_0x1f4cdb+_0x4f3eff(0xd6)+formatRows(_0x94f0e7[_0x4f3eff(0xb8)][_0x4f3eff(0xbb)])+_0x4f3eff(0xad)+(_0x4f3eff(0xc9)+formatElapsed(_0x94f0e7[_0x4f3eff(0xb8)][_0x4f3eff(0xbc)])+_0x350eb5));if(_0x76977d&&_0x26fdb6){const _0xfc2db2=resolveOutputOptions(_0x21e487),_0x21eb13=await formatQueryOutput(_0x94f0e7,_0xfc2db2);_0x4123e1[_0x4f3eff(0xd5)](_0x21eb13);}else await handleQueryOutput(_0x94f0e7,_0x21e487);}catch(_0x3e9d27){const _0x484819=_0x76977d?'Statement\x20'+_0x4a47a6+'/'+_0x271c05+':\x0a':'',_0x1ffc2c=_0x3e9d27 instanceof SDKError?_0x3e9d27['originalMessage']:_0x3e9d27[_0x4f3eff(0xb5)];return console[_0x4f3eff(0xd4)](''+_0x484819+_0x1ffc2c),0x1;}}if(_0x13aa05['length']>0x1&&_0x26fdb6&&_0x4123e1[_0x4f3eff(0xac)]>0x0){const _0x328654=_0x4123e1['join']('\x0a');writeFileSync(_0x21e487[_0x4f3eff(0xb3)],_0x328654),console[_0x4f3eff(0xd4)](_0x4f3eff(0xdc)+_0x21e487[_0x4f3eff(0xb3)]);}return 0x0;}catch(_0x38ff4b){throw _0x38ff4b;}}[a29_0x2f31f6(0xcf)](_0xfe6f9d){const _0x599d06=a29_0x2f31f6,_0x46930a=_0xfe6f9d[_0x599d06(0xcb)][0x0],_0x25528e=_0xfe6f9d['options'][_0x599d06(0xce)];if(!_0x46930a&&!_0x25528e)return _0x599d06(0xdd);if(_0x46930a&&_0x25528e)return _0x599d06(0xd8);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_0x5786e6=a30_0x44e6;(function(_0x5a1c34,_0xc273a7){const _0x14d5dc=a30_0x44e6,_0x24a614=_0x5a1c34();while(!![]){try{const _0x12eca5=-parseInt(_0x14d5dc(0x17b))/0x1+parseInt(_0x14d5dc(0x1e2))/0x2+-parseInt(_0x14d5dc(0x1f2))/0x3*(-parseInt(_0x14d5dc(0x1f5))/0x4)+parseInt(_0x14d5dc(0x1fb))/0x5+-parseInt(_0x14d5dc(0x1af))/0x6+-parseInt(_0x14d5dc(0x1e4))/0x7+parseInt(_0x14d5dc(0x17f))/0x8*(parseInt(_0x14d5dc(0x1f7))/0x9);if(_0x12eca5===_0xc273a7)break;else _0x24a614['push'](_0x24a614['shift']());}catch(_0x23d7ac){_0x24a614['push'](_0x24a614['shift']());}}}(a30_0x3689,0x31b07));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(_0x1d47b9,_0x576adf,_0x35fd7b){const _0x29670e=a30_0x44e6;if(isYamlFilePath(_0x1d47b9))try{const _0x1a9573=resolveYamlFilePath(_0x1d47b9);return _0x35fd7b&&(console[_0x29670e(0x1a1)](_0x29670e(0x1d8)+_0x1d47b9),console[_0x29670e(0x1a1)](_0x29670e(0x194)+_0x1a9573[_0x29670e(0x170)]),console['error'](_0x29670e(0x1e8)+_0x1a9573[_0x29670e(0x176)]),console['error']('\x20\x20Folder\x20path:\x20'+(_0x1a9573[_0x29670e(0x1e3)]||'(root)')),console['error']('\x20\x20Full\x20path:\x20'+_0x1a9573[_0x29670e(0x1b7)])),_0x1a9573[_0x29670e(0x1b7)];}catch(_0x1e5d37){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x1e5d37[_0x29670e(0x184)]);}if(!_0x576adf)throw new SDKError(ErrorCode[_0x29670e(0x196)],_0x29670e(0x1ec));return _0x576adf+'/'+_0x1d47b9;}export class SegmentDescribeCommand extends BaseCommand{['name']=a30_0x5786e6(0x1f4);[a30_0x5786e6(0x192)]=a30_0x5786e6(0x16b);async[a30_0x5786e6(0x177)](_0x4a8fed){const _0x1dd7b1=a30_0x5786e6,{options:_0x384e66,args:_0x372646,tdx:_0x622a3b}=_0x4a8fed,_0x47e4c2=_0x372646[0x0],_0x2f04db=!_0x47e4c2&&!!_0x384e66['parentSegment'],_0x3c485a=_0x47e4c2||_0x384e66[_0x1dd7b1(0x170)];if(!_0x3c485a)return console['error'](_0x1dd7b1(0x1f9)),console[_0x1dd7b1(0x1a1)](_0x1dd7b1(0x197)),console[_0x1dd7b1(0x1a1)](_0x1dd7b1(0x1c7)),console[_0x1dd7b1(0x1a1)](_0x1dd7b1(0x1b8)),console[_0x1dd7b1(0x1a1)](_0x1dd7b1(0x187)),console['error'](_0x1dd7b1(0x1b5)),console[_0x1dd7b1(0x1a1)](_0x1dd7b1(0x175)),0x1;try{const _0x3929f0=_0x384e66[_0x1dd7b1(0x19d)];let _0x5c4d09=_0x3c485a;!_0x2f04db&&_0x3929f0&&!_0x3c485a['includes']('/')&&(_0x5c4d09=_0x3929f0+'/'+_0x3c485a,_0x384e66[_0x1dd7b1(0x1b3)]&&console[_0x1dd7b1(0x1a1)](_0x1dd7b1(0x16a)+_0x5c4d09));const _0x512d2c=await withSpinner(_0x1dd7b1(0x1c0)+_0x5c4d09+'\x27...',()=>_0x622a3b[_0x1dd7b1(0x17a)]['resolvePathToResource'](_0x5c4d09),{'verbose':_0x384e66['verbose']}),_0x14156d=_0x512d2c['data'];_0x384e66[_0x1dd7b1(0x1b3)]&&(console[_0x1dd7b1(0x1a1)](_0x1dd7b1(0x1d0)+_0x14156d[_0x1dd7b1(0x17c)]),console[_0x1dd7b1(0x1a1)](_0x1dd7b1(0x1ce)+_0x14156d[_0x1dd7b1(0x1f6)]),_0x14156d['folderId']&&console[_0x1dd7b1(0x1a1)]('Folder\x20ID:\x20'+_0x14156d['folderId']),_0x14156d[_0x1dd7b1(0x1d9)]&&console[_0x1dd7b1(0x1a1)](_0x1dd7b1(0x1b1)+_0x14156d[_0x1dd7b1(0x1d9)]));if(_0x14156d['type']===_0x1dd7b1(0x1ca)){const _0x58a97a=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x622a3b[_0x1dd7b1(0x17a)][_0x1dd7b1(0x185)](_0x14156d[_0x1dd7b1(0x1f6)]),{'verbose':_0x384e66['verbose']});await handleSingleObjectOutput(_0x58a97a[_0x1dd7b1(0x1db)],_0x384e66);}else{if(_0x14156d[_0x1dd7b1(0x17c)]===_0x1dd7b1(0x1cf)){if(!_0x14156d[_0x1dd7b1(0x19a)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x545cef=await withSpinner(_0x1dd7b1(0x18a),()=>_0x622a3b['segment'][_0x1dd7b1(0x1a3)](_0x14156d[_0x1dd7b1(0x19a)]),{'verbose':_0x384e66[_0x1dd7b1(0x1b3)]});await handleSingleObjectOutput(_0x545cef[_0x1dd7b1(0x1db)],_0x384e66);}else{if(_0x14156d[_0x1dd7b1(0x17c)]===_0x1dd7b1(0x17a)){if(!_0x14156d[_0x1dd7b1(0x1d9)])throw new SDKError(ErrorCode[_0x1dd7b1(0x195)],_0x1dd7b1(0x1e1));const _0x626e68=await withSpinner(_0x1dd7b1(0x1d7),()=>_0x622a3b[_0x1dd7b1(0x17a)][_0x1dd7b1(0x1df)](_0x14156d['parentId'],_0x14156d[_0x1dd7b1(0x1d9)]),{'verbose':_0x384e66[_0x1dd7b1(0x1b3)]});await handleSingleObjectOutput(_0x626e68[_0x1dd7b1(0x1db)],_0x384e66);}}}return 0x0;}catch(_0x181fa4){if(_0x181fa4 instanceof SDKError)return console[_0x1dd7b1(0x1a1)]('Error:\x20'+_0x181fa4[_0x1dd7b1(0x184)]),_0x181fa4[_0x1dd7b1(0x193)]&&console[_0x1dd7b1(0x1a1)](_0x1dd7b1(0x1e7)+_0x181fa4[_0x1dd7b1(0x193)]),0x1;throw _0x181fa4;}}}export class SegmentShowCommand extends BaseCommand{[a30_0x5786e6(0x1ed)]=a30_0x5786e6(0x1ba);[a30_0x5786e6(0x192)]='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async['execute'](_0x175eae){const _0x192e19=a30_0x5786e6,{options:_0x142fce,args:_0x25f809,tdx:_0x405561}=_0x175eae,_0x3f4173=_0x25f809[0x0];if(!_0x3f4173)return console[_0x192e19(0x1a1)](_0x192e19(0x1b2)),console['error'](_0x192e19(0x1b0)),console[_0x192e19(0x1a1)](_0x192e19(0x1a4)),console['error']('Examples:'),console[_0x192e19(0x1a1)](_0x192e19(0x1e0)),console[_0x192e19(0x1a1)](_0x192e19(0x1be)),0x1;try{const _0x7d0a00=_0x142fce[_0x192e19(0x170)],_0x177016=resolveSegmentTarget(_0x3f4173,_0x7d0a00,_0x142fce[_0x192e19(0x1b3)]);_0x142fce[_0x192e19(0x1b3)]&&console[_0x192e19(0x1a1)](_0x192e19(0x1a6)+_0x177016);const _0x535f00=await withSpinner(_0x192e19(0x169)+_0x3f4173+'\x27...',()=>_0x405561[_0x192e19(0x17a)][_0x192e19(0x1eb)](_0x177016),{'verbose':_0x142fce['verbose']}),_0x40ae7d=_0x535f00[_0x192e19(0x1db)];_0x142fce['verbose']&&(console['error']('Resolved\x20type:\x20'+_0x40ae7d[_0x192e19(0x17c)]),console[_0x192e19(0x1a1)]('Parent\x20ID:\x20'+_0x40ae7d[_0x192e19(0x1f6)]));if(_0x40ae7d[_0x192e19(0x17c)]===_0x192e19(0x1cf))return console['error'](_0x192e19(0x1c9)),console['error'](_0x192e19(0x1ef)),0x1;if(_0x40ae7d[_0x192e19(0x17c)]===_0x192e19(0x1ca))return console[_0x192e19(0x1a1)](_0x192e19(0x18c)),console[_0x192e19(0x1a1)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x40ae7d[_0x192e19(0x1d9)])throw new SDKError(ErrorCode[_0x192e19(0x195)],_0x192e19(0x1e1));const _0x4054a1=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x405561[_0x192e19(0x17a)][_0x192e19(0x1c5)](_0x40ae7d[_0x192e19(0x1f6)],_0x40ae7d[_0x192e19(0x1d9)]),{'verbose':_0x142fce[_0x192e19(0x1b3)]});let _0x4c9528=_0x4054a1[_0x192e19(0x1db)];const _0x190945=resolveLimit(_0x142fce[_0x192e19(0x1f0)],DEFAULT_DISPLAY_LIMIT),_0x4b1df2=/\bLIMIT\s+\d+/i[_0x192e19(0x17e)](_0x4c9528);!_0x4b1df2&&(_0x4c9528=_0x4c9528['trim']()[_0x192e19(0x188)](/;+$/,''),_0x4c9528=_0x192e19(0x1b6)+_0x4c9528+_0x192e19(0x1ae)+_0x190945);_0x142fce[_0x192e19(0x1b3)]&&console[_0x192e19(0x1a1)](_0x192e19(0x179)+_0x4c9528);const _0x210534=await withQuerySpinner(_0x192e19(0x190),async _0x480e4d=>{const _0x4ec6f0=_0x192e19,_0x2caec5=await _0x405561[_0x4ec6f0(0x18d)][_0x4ec6f0(0x177)](_0x4c9528,{'catalog':'td','schema':_0x4ec6f0(0x1a9),'onJobId':_0x34a31e=>{const _0xda8fdc=_0x4ec6f0;_0x480e4d[_0xda8fdc(0x1c3)](_0x34a31e);}});return _0x2caec5;},{'verbose':_0x142fce['verbose']}),_0x29ed60=_0x210534['data'],_0x1ab272=_0x29ed60[_0x192e19(0x1b9)]?_0x192e19(0x1dd)+_0x29ed60['jobId']+']':'';return console['error'](_0x192e19(0x1bf)+_0x29ed60['stats'][_0x192e19(0x198)][_0x192e19(0x1c2)]()+_0x192e19(0x1fa)+(_0x192e19(0x1e6)+formatElapsed(_0x29ed60['stats'][_0x192e19(0x16c)])+_0x1ab272)),await handleQueryOutput(_0x29ed60,_0x142fce),0x0;}catch(_0x13aece){if(_0x13aece instanceof SDKError)return console[_0x192e19(0x1a1)](_0x192e19(0x1b4)+_0x13aece[_0x192e19(0x1ab)]+']'),console[_0x192e19(0x1a1)]('\x0a'+_0x13aece['message']),0x1;throw _0x13aece;}}}function a30_0x44e6(_0x1e4be3,_0x513d32){_0x1e4be3=_0x1e4be3-0x167;const _0x36895d=a30_0x3689();let _0x44e65f=_0x36895d[_0x1e4be3];return _0x44e65f;}export class SegmentFolderListCommand extends BaseCommand{[a30_0x5786e6(0x1ed)]=a30_0x5786e6(0x1ee);[a30_0x5786e6(0x192)]=a30_0x5786e6(0x1bb);async[a30_0x5786e6(0x177)](_0x442643){const _0x4c3865=a30_0x5786e6,{options:_0x4066fa,args:_0x18f6ea,tdx:_0x363be2}=_0x442643;if(_0x18f6ea[_0x4c3865(0x19e)]===0x0)return console[_0x4c3865(0x1a1)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x4c3865(0x1a1)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x3efa82=_0x18f6ea[0x0];try{_0x4066fa[_0x4c3865(0x1b3)]&&(console[_0x4c3865(0x1a1)](_0x4c3865(0x1f3)+_0x4066fa[_0x4c3865(0x19b)]),console['error']('Parent\x20name:\x20'+_0x3efa82));const _0x1e0f73=await withSpinner(_0x4c3865(0x1a5)+_0x3efa82+_0x4c3865(0x1a7),()=>_0x363be2[_0x4c3865(0x17a)][_0x4c3865(0x1ad)](_0x3efa82),{'verbose':_0x4066fa[_0x4c3865(0x1b3)]}),_0x2b4dcc=_0x1e0f73[_0x4c3865(0x1db)];_0x4066fa[_0x4c3865(0x1b3)]&&console[_0x4c3865(0x1a1)](_0x4c3865(0x180)+_0x2b4dcc);const _0x2c390d=await withSpinner(_0x4c3865(0x18f)+_0x3efa82+_0x4c3865(0x1a7),()=>_0x363be2[_0x4c3865(0x17a)][_0x4c3865(0x18e)](_0x2b4dcc),{'verbose':_0x4066fa[_0x4c3865(0x1b3)]}),_0x5bd37e=_0x2c390d[_0x4c3865(0x1db)];return console[_0x4c3865(0x1a1)](_0x4c3865(0x178)+_0x5bd37e[_0x4c3865(0x19e)]+'\x20folder'+(_0x5bd37e['length']!==0x1?'s':'')),await handleSDKOutput(_0x5bd37e,_0x4066fa),0x0;}catch(_0x23e83b){if(_0x23e83b instanceof SDKError)return console[_0x4c3865(0x1a1)](_0x4c3865(0x19f)+_0x23e83b[_0x4c3865(0x184)]),_0x23e83b[_0x4c3865(0x193)]&&console[_0x4c3865(0x1a1)]('\x20\x20Cause:\x20'+_0x23e83b[_0x4c3865(0x193)]),0x1;throw _0x23e83b;}}}export class SegmentFolderShowCommand extends BaseCommand{[a30_0x5786e6(0x1ed)]=a30_0x5786e6(0x189);[a30_0x5786e6(0x192)]=a30_0x5786e6(0x191);async[a30_0x5786e6(0x177)](_0x467c0f){const _0x501bf8=a30_0x5786e6,{options:_0x488585,args:_0x3fa6a7,tdx:_0x47261d}=_0x467c0f;if(_0x3fa6a7[_0x501bf8(0x19e)]===0x0)return console[_0x501bf8(0x1a1)](_0x501bf8(0x182)),console[_0x501bf8(0x1a1)](_0x501bf8(0x1d3)),0x1;try{const {parentId:_0x5a95ed,childId:_0x42cc30}=parseSegmentRef(_0x3fa6a7[0x0]);_0x488585[_0x501bf8(0x1b3)]&&(console['error'](_0x501bf8(0x1f3)+_0x488585[_0x501bf8(0x19b)]),console[_0x501bf8(0x1a1)](_0x501bf8(0x17d)+_0x5a95ed),_0x42cc30&&console['error'](_0x501bf8(0x199)+_0x42cc30));if(!_0x42cc30)return console['error'](_0x501bf8(0x1cb)),0x1;const _0x5ce6d0=await withSpinner(_0x501bf8(0x1a5)+_0x5a95ed+'\x27...',()=>_0x47261d['segment'][_0x501bf8(0x1ad)](_0x5a95ed),{'verbose':_0x488585[_0x501bf8(0x1b3)]}),_0x578bcf=_0x5ce6d0['data'];_0x488585['verbose']&&console[_0x501bf8(0x1a1)](_0x501bf8(0x180)+_0x578bcf);const _0xaa2ce2=await withSpinner('Resolving\x20folder\x20\x27'+_0x42cc30+_0x501bf8(0x1a7),()=>_0x47261d[_0x501bf8(0x17a)]['resolveFolderId'](_0x578bcf,_0x42cc30),{'verbose':_0x488585[_0x501bf8(0x1b3)]}),_0x44d511=_0xaa2ce2[_0x501bf8(0x1db)];_0x488585[_0x501bf8(0x1b3)]&&console[_0x501bf8(0x1a1)](_0x501bf8(0x172)+_0x44d511);const _0x29c2a1=await withSpinner('Fetching\x20folder\x20\x27'+_0x42cc30+_0x501bf8(0x1a7),()=>_0x47261d[_0x501bf8(0x17a)][_0x501bf8(0x1a3)](_0x44d511),{'verbose':_0x488585[_0x501bf8(0x1b3)]});return await handleSDKOutput([_0x29c2a1[_0x501bf8(0x1db)]],_0x488585),0x0;}catch(_0x59c1b6){if(_0x59c1b6 instanceof SDKError)return console[_0x501bf8(0x1a1)](_0x501bf8(0x19f)+_0x59c1b6[_0x501bf8(0x184)]),_0x59c1b6[_0x501bf8(0x193)]&&console['error'](_0x501bf8(0x1e7)+_0x59c1b6[_0x501bf8(0x193)]),0x1;throw _0x59c1b6;}}}function a30_0x3689(){const _0x2677d8=['8ZeokRv','Resolved\x20parent\x20ID:\x20','Usage:\x20tdx\x20sg\x20desc\x20<name>','Error:\x20Folder\x20reference\x20is\x20required','createFolder','message','getParent','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','replace','segment:folder:show','Fetching\x20folder\x20details...','Usage:\x20tdx\x20sg\x20view\x20<name>','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','query','listFolders','Listing\x20folders\x20for\x20parent\x20\x27','Executing\x20segment\x20query...','Show\x20segment\x20folder\x20details','description','cause','\x20\x20Parent\x20segment:\x20','SEGMENT_NOT_FOUND','INVALID_ARGUMENT','Usage:\x20tdx\x20segment\x20describe\x20<path>','processedRows','Folder\x20name:\x20','folderId','site','segment:sql','segmentPath','length','Error:\x20','resolveFolderId','error','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','getFolder','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','Resolving\x20parent\x20segment\x20\x27','Target\x20path:\x20','\x27...','Parent\x20segment:\x20','information_schema','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','code','Folder\x20ID\x20missing\x20from\x20resolved\x20path','resolveParentId','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','660378DGKqzf','Usage:\x20tdx\x20sg\x20show\x20<name>','Segment\x20ID:\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','verbose','✖\x20Query\x20failed\x20[','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','SELECT\x20*\x20FROM\x20(\x0a','fullPath','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','jobId','segment:show','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Resolved\x20parent\x20folder\x20ID:\x20','Show\x20child\x20segment\x20schema\x20(column\x20types)','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','✔\x20Query\x20completed:\x20Processed\x20','Resolving\x20path\x20\x27','segment:view','toLocaleString','setJobId','Creating\x20folder\x20\x27','getSegmentSQL','parentFolder','Examples:','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','parent','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','SEGMENT_FOLDER_NOT_FOUND','Fetching\x20SQL\x20for\x20segment...','Parent\x20ID:\x20','folder','Resolved\x20type:\x20','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','✔\x20Created\x20folder\x20\x27','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','format','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Resolving\x20parent\x20folder\x20\x27','Fetching\x20segment\x20details...','Resolved\x20YAML\x20file:\x20','segmentId','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','data','Use:\x20tdx\x20ps\x20view','\x20[Job\x20ID:\x20','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','getSegment','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Segment\x20ID\x20missing\x20from\x20resolved\x20path','420418EXUyGC','folderPath','955150RuSHPh','segment:folder:create','in\x20','\x20\x20Cause:\x20','\x20\x20Segment\x20name:\x20','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','jsonl','resolvePathToResource','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','name','segment:folder:list','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','limit','Use:\x20tdx\x20ps\x20desc','42hYekCB','Site:\x20','segment:describe','77116jLijHT','parentId','318267qkeVAl','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Error:\x20Path\x20or\x20name\x20is\x20required','\x20rows\x20','361745wNTSOI','Use:\x20tdx\x20ps\x20sql','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','Resolving\x20\x27','Resolved\x20relative\x20path\x20to:\x20','Show\x20segment\x20or\x20folder\x20details','elapsedTimeMillis','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Create\x20segment\x20folder\x20for\x20organization','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','parentSegment','segment:desc','Resolved\x20folder\x20ID:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Get\x20SQL\x20query\x20for\x20child\x20segment','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','segmentName','execute','✔\x20Found\x20','SQL\x20query:\x0a','segment','137787DDzfAk','type','Parent\x20name:\x20','test'];a30_0x3689=function(){return _0x2677d8;};return a30_0x3689();}export class SegmentSQLCommand extends BaseCommand{[a30_0x5786e6(0x1ed)]=a30_0x5786e6(0x19c);[a30_0x5786e6(0x192)]=a30_0x5786e6(0x174);async['execute'](_0x57da02){const _0x2240f3=a30_0x5786e6,{options:_0x475fd7,args:_0x77659f,tdx:_0x5932b3}=_0x57da02,_0x3f8199=_0x77659f[0x0];if(!_0x3f8199)return console[_0x2240f3(0x1a1)](_0x2240f3(0x1b2)),console[_0x2240f3(0x1a1)]('Usage:\x20tdx\x20sg\x20sql\x20<name>'),console['error'](_0x2240f3(0x1da)),console[_0x2240f3(0x1a1)](_0x2240f3(0x1c7)),console[_0x2240f3(0x1a1)](_0x2240f3(0x1d1)),console['error']('\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x3e6645=_0x475fd7[_0x2240f3(0x170)],_0x4e7af6=resolveSegmentTarget(_0x3f8199,_0x3e6645,_0x475fd7[_0x2240f3(0x1b3)]);_0x475fd7['verbose']&&console['error'](_0x2240f3(0x1a6)+_0x4e7af6);const _0xbc38a=await withSpinner(_0x2240f3(0x169)+_0x3f8199+'\x27...',()=>_0x5932b3[_0x2240f3(0x17a)][_0x2240f3(0x1eb)](_0x4e7af6),{'verbose':_0x475fd7[_0x2240f3(0x1b3)]}),_0x3a4c86=_0xbc38a[_0x2240f3(0x1db)];_0x475fd7[_0x2240f3(0x1b3)]&&(console[_0x2240f3(0x1a1)](_0x2240f3(0x1d0)+_0x3a4c86[_0x2240f3(0x17c)]),console[_0x2240f3(0x1a1)](_0x2240f3(0x1ce)+_0x3a4c86[_0x2240f3(0x1f6)]));if(_0x3a4c86['type']===_0x2240f3(0x1cf))return console[_0x2240f3(0x1a1)]('Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.'),console[_0x2240f3(0x1a1)](_0x2240f3(0x186)),0x1;if(_0x3a4c86[_0x2240f3(0x17c)]===_0x2240f3(0x1ca))return console['error'](_0x2240f3(0x168)),console[_0x2240f3(0x1a1)](_0x2240f3(0x167)),0x1;if(!_0x3a4c86[_0x2240f3(0x1d9)])throw new SDKError(ErrorCode[_0x2240f3(0x195)],_0x2240f3(0x1e1));const _0x2aa85a=await withSpinner(_0x2240f3(0x1cd),()=>_0x5932b3[_0x2240f3(0x17a)]['getSegmentSQL'](_0x3a4c86[_0x2240f3(0x1f6)],_0x3a4c86[_0x2240f3(0x1d9)]),{'verbose':_0x475fd7[_0x2240f3(0x1b3)]}),_0x5fa1b0=_0x2aa85a[_0x2240f3(0x1db)];return _0x475fd7[_0x2240f3(0x1d4)]==='json'||_0x475fd7[_0x2240f3(0x1d4)]===_0x2240f3(0x1ea)?await handleSDKOutput([{'sql':_0x5fa1b0}],_0x475fd7):console['log'](_0x5fa1b0),0x0;}catch(_0x122fbc){if(_0x122fbc instanceof SDKError)return console[_0x2240f3(0x1a1)](_0x2240f3(0x19f)+_0x122fbc[_0x2240f3(0x184)]),_0x122fbc[_0x2240f3(0x193)]&&console[_0x2240f3(0x1a1)](_0x2240f3(0x1e7)+_0x122fbc['cause']),0x1;throw _0x122fbc;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a30_0x5786e6(0x1ed)]=a30_0x5786e6(0x1e5);[a30_0x5786e6(0x192)]=a30_0x5786e6(0x16e);async[a30_0x5786e6(0x177)](_0x4b78b8){const _0x5845c7=a30_0x5786e6,{options:_0x3899b2,args:_0x20ed11,tdx:_0x4e0778}=_0x4b78b8,_0x3ec2ea=_0x3899b2;if(_0x20ed11[_0x5845c7(0x19e)]<0x2)return console[_0x5845c7(0x1a1)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console['error'](_0x5845c7(0x1e9)),0x1;const _0x1e9952=_0x20ed11[0x0],_0x5eb27d=_0x20ed11[0x1];_0x3ec2ea[_0x5845c7(0x1b3)]&&(console['error'](_0x5845c7(0x1f3)+_0x3ec2ea['site']),console[_0x5845c7(0x1a1)](_0x5845c7(0x1a8)+_0x1e9952),console[_0x5845c7(0x1a1)](_0x5845c7(0x199)+_0x5eb27d));let _0x4d5358;if(_0x3ec2ea['parentFolder']){const _0x3e6f72=_0x3ec2ea[_0x5845c7(0x1c6)],_0x289158=await withSpinner(_0x5845c7(0x1a5)+_0x1e9952+_0x5845c7(0x1a7),()=>_0x4e0778[_0x5845c7(0x17a)][_0x5845c7(0x1ad)](_0x1e9952),{'verbose':_0x3ec2ea[_0x5845c7(0x1b3)]}),_0x510eda=_0x289158[_0x5845c7(0x1db)],_0x495631=await withSpinner(_0x5845c7(0x1d6)+_0x3e6f72+_0x5845c7(0x1a7),()=>_0x4e0778[_0x5845c7(0x17a)][_0x5845c7(0x1a0)](_0x510eda,_0x3e6f72),{'verbose':_0x3ec2ea[_0x5845c7(0x1b3)]});_0x4d5358=_0x495631[_0x5845c7(0x1db)],_0x3ec2ea['verbose']&&console[_0x5845c7(0x1a1)](_0x5845c7(0x1bc)+_0x4d5358);}const _0x40e12b={'name':_0x5eb27d,'description':_0x3ec2ea[_0x5845c7(0x192)],'parentFolderId':_0x4d5358},_0x332393=await withSpinner(_0x5845c7(0x1c4)+_0x5eb27d+_0x5845c7(0x1a7),()=>_0x4e0778[_0x5845c7(0x17a)][_0x5845c7(0x183)](_0x1e9952,_0x40e12b),{'verbose':_0x3ec2ea[_0x5845c7(0x1b3)]}),_0x2f7683=_0x332393[_0x5845c7(0x1db)];return console[_0x5845c7(0x1a1)](_0x5845c7(0x1d2)+_0x2f7683[_0x5845c7(0x1ed)]+'\x27\x20with\x20ID:\x20'+_0x2f7683['id']),await handleSDKOutput([_0x2f7683],_0x3ec2ea),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']=a30_0x5786e6(0x1c1);['description']='Show\x20folder\x20or\x20child\x20segment\x20details';async['execute'](_0x568dc6){const _0x278558=a30_0x5786e6,{options:_0x1d82cd,args:_0x4d2dad,tdx:_0x2105da}=_0x568dc6,_0x16035a=_0x4d2dad[0x0];if(!_0x16035a)return console[_0x278558(0x1a1)](_0x278558(0x16f)),console['error'](_0x278558(0x18b)),console[_0x278558(0x1a1)](_0x278558(0x1aa)),console[_0x278558(0x1a1)](_0x278558(0x1c7)),console[_0x278558(0x1a1)](_0x278558(0x1a2)),console['error'](_0x278558(0x16d)),console['error'](_0x278558(0x1de)),0x1;try{const _0xd29fa7=_0x1d82cd[_0x278558(0x170)],_0x1d8e2d=resolveSegmentTarget(_0x16035a,_0xd29fa7,_0x1d82cd[_0x278558(0x1b3)]);_0x1d82cd['verbose']&&console[_0x278558(0x1a1)](_0x278558(0x1a6)+_0x1d8e2d);const _0x61049a=await withSpinner(_0x278558(0x169)+_0x16035a+_0x278558(0x1a7),()=>_0x2105da[_0x278558(0x17a)]['resolvePathToResource'](_0x1d8e2d),{'verbose':_0x1d82cd[_0x278558(0x1b3)]}),_0x3c9769=_0x61049a[_0x278558(0x1db)];_0x1d82cd['verbose']&&(console[_0x278558(0x1a1)](_0x278558(0x1d0)+_0x3c9769['type']),console[_0x278558(0x1a1)]('Parent\x20ID:\x20'+_0x3c9769[_0x278558(0x1f6)]),_0x3c9769['folderId']&&console['error']('Folder\x20ID:\x20'+_0x3c9769[_0x278558(0x19a)]),_0x3c9769[_0x278558(0x1d9)]&&console['error'](_0x278558(0x1b1)+_0x3c9769[_0x278558(0x1d9)]));if(_0x3c9769[_0x278558(0x17c)]===_0x278558(0x1cf)){if(!_0x3c9769['folderId'])throw new SDKError(ErrorCode[_0x278558(0x1cc)],_0x278558(0x1ac));const _0x2b7d84=await withSpinner(_0x278558(0x18a),()=>_0x2105da[_0x278558(0x17a)][_0x278558(0x1a3)](_0x3c9769[_0x278558(0x19a)]),{'verbose':_0x1d82cd[_0x278558(0x1b3)]});await handleSingleObjectOutput(_0x2b7d84[_0x278558(0x1db)],_0x1d82cd);}else{if(_0x3c9769[_0x278558(0x17c)]===_0x278558(0x17a)){if(!_0x3c9769[_0x278558(0x1d9)])throw new SDKError(ErrorCode[_0x278558(0x195)],_0x278558(0x1e1));const _0x307e42=await withSpinner(_0x278558(0x1d7),()=>_0x2105da[_0x278558(0x17a)][_0x278558(0x1df)](_0x3c9769[_0x278558(0x1f6)],_0x3c9769[_0x278558(0x1d9)]),{'verbose':_0x1d82cd[_0x278558(0x1b3)]});await handleSingleObjectOutput(_0x307e42[_0x278558(0x1db)],_0x1d82cd);}else return console[_0x278558(0x1a1)]('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console[_0x278558(0x1a1)](_0x278558(0x1dc)),0x1;}return 0x0;}catch(_0x8d32bc){if(_0x8d32bc instanceof SDKError)return console[_0x278558(0x1a1)](_0x278558(0x19f)+_0x8d32bc[_0x278558(0x184)]),_0x8d32bc['cause']&&console[_0x278558(0x1a1)](_0x278558(0x1e7)+_0x8d32bc['cause']),0x1;throw _0x8d32bc;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a30_0x5786e6(0x1ed)]=a30_0x5786e6(0x171);[a30_0x5786e6(0x192)]=a30_0x5786e6(0x1bd);async['execute'](_0x11153e){const _0x480e27=a30_0x5786e6,{options:_0xb622ca,args:_0x43ea5c,tdx:_0x276cf1}=_0x11153e,_0x329771=_0x43ea5c[0x0];if(!_0x329771)return console['error'](_0x480e27(0x1b2)),console[_0x480e27(0x1a1)](_0x480e27(0x181)),console[_0x480e27(0x1a1)](_0x480e27(0x1d5)),console[_0x480e27(0x1a1)](_0x480e27(0x1c7)),console[_0x480e27(0x1a1)](_0x480e27(0x1c8)),console[_0x480e27(0x1a1)](_0x480e27(0x1f8)),0x1;try{const _0x116e68=_0xb622ca['parentSegment'],_0x13257f=resolveSegmentTarget(_0x329771,_0x116e68,_0xb622ca[_0x480e27(0x1b3)]);_0xb622ca[_0x480e27(0x1b3)]&&console[_0x480e27(0x1a1)](_0x480e27(0x1a6)+_0x13257f);const _0x11a775=await withSpinner('Resolving\x20\x27'+_0x329771+_0x480e27(0x1a7),()=>_0x276cf1[_0x480e27(0x17a)][_0x480e27(0x1eb)](_0x13257f),{'verbose':_0xb622ca[_0x480e27(0x1b3)]}),_0x2ac9f0=_0x11a775[_0x480e27(0x1db)];_0xb622ca['verbose']&&(console[_0x480e27(0x1a1)]('Resolved\x20type:\x20'+_0x2ac9f0[_0x480e27(0x17c)]),console['error'](_0x480e27(0x1ce)+_0x2ac9f0[_0x480e27(0x1f6)]));if(_0x2ac9f0['type']===_0x480e27(0x1cf))return console[_0x480e27(0x1a1)](_0x480e27(0x173)),console['error'](_0x480e27(0x186)),0x1;if(_0x2ac9f0[_0x480e27(0x17c)]===_0x480e27(0x1ca))return console[_0x480e27(0x1a1)]('Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console['error'](_0x480e27(0x1f1)),0x1;if(!_0x2ac9f0[_0x480e27(0x1d9)])throw new SDKError(ErrorCode[_0x480e27(0x195)],_0x480e27(0x1e1));const _0x4bb071=await withSpinner(_0x480e27(0x1cd),()=>_0x276cf1[_0x480e27(0x17a)][_0x480e27(0x1c5)](_0x2ac9f0[_0x480e27(0x1f6)],_0x2ac9f0[_0x480e27(0x1d9)]),{'verbose':_0xb622ca[_0x480e27(0x1b3)]}),_0x1341e8=_0x4bb071[_0x480e27(0x1db)],_0x404af3=await executeSchemaQuery(_0x1341e8,_0x276cf1,_0xb622ca);return await handleQueryOutput(_0x404af3,_0xb622ca),0x0;}catch(_0x1c0d95){if(_0x1c0d95 instanceof SDKError)return console[_0x480e27(0x1a1)]('Error:\x20'+_0x1c0d95[_0x480e27(0x184)]),_0x1c0d95[_0x480e27(0x193)]&&console[_0x480e27(0x1a1)](_0x480e27(0x1e7)+_0x1c0d95[_0x480e27(0x193)]),0x1;throw _0x1c0d95;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a31_0x2e46(_0x511f7f,_0x4e64cf){_0x511f7f=_0x511f7f-0x1b2;const _0x2c5bcd=a31_0x2c5b();let _0x2e46f4=_0x2c5bcd[_0x511f7f];return _0x2e46f4;}const a31_0x1af8f5=a31_0x2e46;(function(_0x13927d,_0x4feade){const _0x237c82=a31_0x2e46,_0x5e8a80=_0x13927d();while(!![]){try{const _0x1983fc=-parseInt(_0x237c82(0x1ba))/0x1+parseInt(_0x237c82(0x1d6))/0x2+-parseInt(_0x237c82(0x1dd))/0x3*(-parseInt(_0x237c82(0x1bd))/0x4)+-parseInt(_0x237c82(0x1e4))/0x5*(parseInt(_0x237c82(0x1d5))/0x6)+-parseInt(_0x237c82(0x1e8))/0x7+-parseInt(_0x237c82(0x1c0))/0x8+parseInt(_0x237c82(0x1e0))/0x9*(parseInt(_0x237c82(0x1e1))/0xa);if(_0x1983fc===_0x4feade)break;else _0x5e8a80['push'](_0x5e8a80['shift']());}catch(_0x519e5f){_0x5e8a80['push'](_0x5e8a80['shift']());}}}(a31_0x2c5b,0x62456));function a31_0x2c5b(){const _0x2b741e=['\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Site:\x20','folder','error','invisible','\x20\x20\x20Path:\x20','noCountPopulation','Create\x20child\x20segment\x20with\x20filtering\x20rules','Resolved\x20relative\x20path\x20to:\x20','resolveParentId','Creating\x20segment\x20\x27','createSegment','8106ncyKoN','1074008tjPpJY','Resolved\x20folder\x20ID:\x20','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','Parent:\x20','verbose','segments','5616DWmfoH','yellow','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','9VTMFmM','8344480EHVsGN','length','Resolving\x20folder\x20path\x20\x27','1465MoTTiO','resolvePathToResource','segmentPath','resolveFolderId','3453779Yvygkl','\x27...','execute','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','description','includes','rule','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','Resolving\x20folder\x20\x27','16219SsAflS','segment','name','1120zJlYyT','folderId','type','4701080kUObLI','\x27\x20with\x20ID:\x20','kind','Segment\x20name:\x20','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','Parent\x20path:\x20','data','site'];a31_0x2c5b=function(){return _0x2b741e;};return a31_0x2c5b();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../utils/segment-path-parser.js';import a31_0x1ced08 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a31_0x1af8f5(0x1bc)]='segment:create';[a31_0x1af8f5(0x1b5)]=a31_0x1af8f5(0x1d0);async[a31_0x1af8f5(0x1b3)](_0x1a16a0){const _0x581efd=a31_0x1af8f5;console['error'](a31_0x1ced08[_0x581efd(0x1de)]('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x581efd(0x1cc)](a31_0x1ced08['yellow'](_0x581efd(0x1b4)));const {options:_0xc3f8f2,args:_0x4a876c,tdx:_0x3b3e33}=_0x1a16a0,_0x149788=_0xc3f8f2;if(_0x4a876c[_0x581efd(0x1e2)]===0x0)return console[_0x581efd(0x1cc)](_0x581efd(0x1c9)),console[_0x581efd(0x1cc)](_0x581efd(0x1b8)),console[_0x581efd(0x1cc)]('Examples:'),console[_0x581efd(0x1cc)](_0x581efd(0x1df)),console[_0x581efd(0x1cc)](_0x581efd(0x1d9)),console[_0x581efd(0x1cc)](_0x581efd(0x1c8)),0x1;const _0x5b1063=_0x4a876c[0x0],_0xa451f=_0xc3f8f2[_0x581efd(0x1e6)];let _0x1415cb=_0x5b1063;_0xa451f&&!_0x5b1063[_0x581efd(0x1b6)]('/')&&(_0x1415cb=_0xa451f+'/'+_0x5b1063,_0x149788['verbose']&&console[_0x581efd(0x1cc)](_0x581efd(0x1d1)+_0x1415cb));const _0x59d389=parsePath(_0x1415cb);if(_0x59d389[_0x581efd(0x1dc)][_0x581efd(0x1e2)]<0x2)return console['error'](_0x581efd(0x1c4)),console[_0x581efd(0x1cc)]('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x50733c=_0x59d389[_0x581efd(0x1dc)][0x0],_0x37eede=getBaseName(_0x1415cb),_0x2a19d3=getParentPath(_0x1415cb);_0x149788[_0x581efd(0x1db)]&&(console['error'](_0x581efd(0x1ca)+_0x149788[_0x581efd(0x1c7)]),console[_0x581efd(0x1cc)]('Target\x20path:\x20'+_0x1415cb),console['error'](_0x581efd(0x1da)+_0x50733c),console[_0x581efd(0x1cc)](_0x581efd(0x1c3)+_0x37eede),console[_0x581efd(0x1cc)](_0x581efd(0x1c5)+_0x2a19d3));const _0x3f77df=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x50733c+_0x581efd(0x1b2),()=>_0x3b3e33['segment'][_0x581efd(0x1d2)](_0x50733c),{'verbose':_0x149788['verbose']}),_0x4a56bc=_0x3f77df[_0x581efd(0x1c6)];let _0x4e01e9;if(_0x59d389[_0x581efd(0x1dc)][_0x581efd(0x1e2)]>0x2){const _0x208aac=await withSpinner(_0x581efd(0x1e3)+_0x2a19d3+_0x581efd(0x1b2),()=>_0x3b3e33[_0x581efd(0x1bb)][_0x581efd(0x1e5)](_0x2a19d3),{'verbose':_0x149788[_0x581efd(0x1db)]}),_0x1d5221=_0x208aac[_0x581efd(0x1c6)];if(_0x1d5221[_0x581efd(0x1bf)]!=='folder'&&_0x1d5221[_0x581efd(0x1bf)]!=='parent')return console[_0x581efd(0x1cc)](_0x581efd(0x1d8)),0x1;_0x4e01e9=_0x1d5221[_0x581efd(0x1be)];}else{if(_0x149788[_0x581efd(0x1cb)]){const _0x68d5ec=await withSpinner(_0x581efd(0x1b9)+_0x149788[_0x581efd(0x1cb)]+_0x581efd(0x1b2),()=>_0x3b3e33[_0x581efd(0x1bb)][_0x581efd(0x1e7)](_0x4a56bc,_0x149788[_0x581efd(0x1cb)]),{'verbose':_0x149788[_0x581efd(0x1db)]});_0x4e01e9=_0x68d5ec[_0x581efd(0x1c6)];}}_0x149788['verbose']&&_0x4e01e9&&console[_0x581efd(0x1cc)](_0x581efd(0x1d7)+_0x4e01e9);const _0x52c0f7=await loadJSONFromOptions(_0x149788[_0x581efd(0x1b7)],_0x149788['ruleFile']),_0x1abb5e={'name':_0x37eede,'description':_0x149788['description'],'rule':_0x52c0f7,'kind':_0x149788[_0x581efd(0x1c2)]!==undefined?parseInt(_0x149788[_0x581efd(0x1c2)],0xa):undefined,'isVisible':_0x149788[_0x581efd(0x1cd)]?![]:undefined,'segmentFolderId':_0x4e01e9,'countPopulation':_0x149788[_0x581efd(0x1cf)]?![]:undefined},_0x6908b3=await withSpinner(_0x581efd(0x1d3)+_0x37eede+_0x581efd(0x1b2),()=>_0x3b3e33['segment'][_0x581efd(0x1d4)](_0x4a56bc,_0x1abb5e),{'verbose':_0x149788[_0x581efd(0x1db)]}),_0x181573=_0x6908b3['data'];return console[_0x581efd(0x1cc)]('✔\x20Created\x20segment\x20\x27'+_0x181573['name']+_0x581efd(0x1c1)+_0x181573['id']),_0x1415cb!==_0x5b1063&&console['error'](_0x581efd(0x1ce)+_0x1415cb),await handleSDKOutput([_0x181573],_0x149788),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a32_0x1bc1(_0x293acf,_0x22d81e){_0x293acf=_0x293acf-0x199;const _0x14724a=a32_0x1472();let _0x1bc164=_0x14724a[_0x293acf];return _0x1bc164;}const a32_0x26ef60=a32_0x1bc1;function a32_0x1472(){const _0x4654ab=['site','170qLFBDH','Listing\x20fields\x20for\x20\x27','6025261SKzonV','listFields','11893QnObGZ','description','parentSegment','\x27...','verbose','8kVVpNq','List\x20available\x20fields\x20for\x20segmentation','189819HcwwZp','877050XOTzEm','4714896ILaDBE','486155LlNtAC','222dOlMAD','47567XpZHcK','Parent\x20segment:\x20','execute','Error:\x20Parent\x20segment\x20name\x20is\x20required','error','26xrpDtm','data','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','Site:\x20','segment:fields','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','length','\x20field','segment','name','json'];a32_0x1472=function(){return _0x4654ab;};return a32_0x1472();}(function(_0x34f588,_0x5e337d){const _0x573335=a32_0x1bc1,_0x5c6745=_0x34f588();while(!![]){try{const _0x26357d=-parseInt(_0x573335(0x1a3))/0x1*(parseInt(_0x573335(0x1a8))/0x2)+parseInt(_0x573335(0x19f))/0x3+parseInt(_0x573335(0x19c))/0x4*(-parseInt(_0x573335(0x1a1))/0x5)+-parseInt(_0x573335(0x1a2))/0x6*(-parseInt(_0x573335(0x1b8))/0x7)+parseInt(_0x573335(0x1a0))/0x8+-parseInt(_0x573335(0x19e))/0x9*(parseInt(_0x573335(0x1b4))/0xa)+parseInt(_0x573335(0x1b6))/0xb;if(_0x26357d===_0x5e337d)break;else _0x5c6745['push'](_0x5c6745['shift']());}catch(_0x33238a){_0x5c6745['push'](_0x5c6745['shift']());}}}(a32_0x1472,0x4e5b2));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_0x26ef60(0x1b1)]=a32_0x26ef60(0x1ac);[a32_0x26ef60(0x1b9)]=a32_0x26ef60(0x19d);async[a32_0x26ef60(0x1a5)](_0x3f276a){const _0x11c1f6=a32_0x26ef60,{options:_0x5e0b49,args:_0x66f43a,tdx:_0x2133af}=_0x3f276a,_0x22a205=_0x66f43a[0x0]||_0x5e0b49[_0x11c1f6(0x199)];if(!_0x22a205)return console[_0x11c1f6(0x1a7)](_0x11c1f6(0x1a6)),console[_0x11c1f6(0x1a7)](_0x11c1f6(0x1aa)),console[_0x11c1f6(0x1a7)](_0x11c1f6(0x1ad)),0x1;_0x5e0b49[_0x11c1f6(0x19b)]&&(console[_0x11c1f6(0x1a7)](_0x11c1f6(0x1ab)+_0x5e0b49[_0x11c1f6(0x1b3)]),console['error'](_0x11c1f6(0x1a4)+_0x22a205));const _0xd58edf=await withSpinner(_0x11c1f6(0x1b5)+_0x22a205+_0x11c1f6(0x19a),()=>_0x2133af[_0x11c1f6(0x1b0)][_0x11c1f6(0x1b7)](_0x22a205),{'verbose':_0x5e0b49[_0x11c1f6(0x19b)]}),_0x35f2a8=_0xd58edf[_0x11c1f6(0x1a9)];console[_0x11c1f6(0x1a7)]('✔\x20Found\x20'+_0x35f2a8[_0x11c1f6(0x1ae)]+_0x11c1f6(0x1af)+(_0x35f2a8['length']!==0x1?'s':''));if(_0x5e0b49[_0x11c1f6(0x1b2)]||_0x5e0b49['jsonl'])return await handleSDKOutput(_0x35f2a8,_0x5e0b49),0x0;return displayFieldsHumanReadable(_0x35f2a8,_0x22a205),0x0;}}
|
|
@@ -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
|
+
const a33_0x39d1b7=a33_0x25c6;function a33_0x5a03(){const _0x2c8694=['segment:pull','data','values','1972905zJCdSW','resolveParentId','absolutePath','Write\x20','getParent','listFolders','Resolving\x20parent\x20segment\x20\x27','No\x20segments\x20found\x20in\x20parent\x20segment\x20\x27','length','buildIdToEmailMap','\x20files\x20to\x20','diff','Fetching\x20folders...','cyan','name','description','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','buildIdToNameMap','\x20new\x20files','segmentFolderId','connection','Found\x20existing\x20tdx.json\x20at:\x20','parentFolderId','join','\x0aPull\x20summary\x20for\x20\x27','set','256955YPBPJA','listActivations','259425KXaXOA','Using\x20parent\x20segment:\x20','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','\x27...','8zDwnRV','28UMUZsH','relative','1264668TbxYgE','400QPdmqv','segment','\x20=\x20','dirname','attributes','yellow','session','\x20changed\x20files','isNew','user','error','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)','Site:\x20','Error:\x20Parent\x20segment\x20is\x20required\x0a','Fetching\x20activations...','has','red','✔\x20Context\x20set:\x20','\x20unchanged\x20files','3450204LZdKgq','\x20files?','1878324fKMWto','then','8970776kBRnVy','verbose','Found\x20tdx.json\x20at:\x20','push','Fetching\x20connections\x20for\x20name\x20resolution...','Tip:\x20Set\x20context\x20with\x20`tdx\x20segment\x20use\x20<parent_name>`\x20or\x20`tdx\x20ps\x20use\x20<parent_name>`','get','replace','Parent\x20segment:\x20','utf-8','dim','Fetching\x20segments...','Fetching\x20parent\x20segment\x20info...','green','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','site','.yml','repeat','dryRun','Resolved\x20parent\x20name:\x20','parent_segment','\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','filter','add','Fetching\x20users\x20for\x20email\x20resolution...','Aborted.','hasChanges','yes'];a33_0x5a03=function(){return _0x2c8694;};return a33_0x5a03();}(function(_0x3fc081,_0x81c1a6){const _0x515664=a33_0x25c6,_0x5d33aa=_0x3fc081();while(!![]){try{const _0x24167b=-parseInt(_0x515664(0x1bd))/0x1*(-parseInt(_0x515664(0x1c3))/0x2)+-parseInt(_0x515664(0x182))/0x3+-parseInt(_0x515664(0x180))/0x4+-parseInt(_0x515664(0x1a3))/0x5+parseInt(_0x515664(0x1c6))/0x6*(-parseInt(_0x515664(0x1c4))/0x7)+parseInt(_0x515664(0x184))/0x8+-parseInt(_0x515664(0x1bf))/0x9*(-parseInt(_0x515664(0x1c7))/0xa);if(_0x24167b===_0x81c1a6)break;else _0x5d33aa['push'](_0x5d33aa['shift']());}catch(_0x1f5a1d){_0x5d33aa['push'](_0x5d33aa['shift']());}}}(a33_0x5a03,0x8c947));function a33_0x25c6(_0x343ce6,_0x3a05d9){_0x343ce6=_0x343ce6-0x176;const _0x5a03bb=a33_0x5a03();let _0x25c6dc=_0x5a03bb[_0x343ce6];return _0x25c6dc;}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_0x48240e from'chalk';import{existsSync,mkdirSync,readFileSync,writeFileSync,statSync}from'fs';import a33_0x589d36 from'path';export class SegmentPullCommand extends BaseCommand{[a33_0x39d1b7(0x1b1)]=a33_0x39d1b7(0x1a0);[a33_0x39d1b7(0x1b2)]='Pull\x20child\x20segments\x20to\x20YAML\x20files';async['execute'](_0x4df509){const _0x4e5283=a33_0x39d1b7,{options:_0x558ccc,args:_0x3d6c4e,tdx:_0x14780e}=_0x4df509,_0x262377=_0x558ccc,_0xe16bbe=_0x558ccc['parentSegment'],_0x317081=_0x3d6c4e[0x0],_0x1ebff8=findTdxConfigPath();let _0x1ab07b,_0x4e201c;if(!_0x317081&&_0x1ebff8){const _0x3d5383=loadTdxConfig(_0x1ebff8);_0x1ab07b=_0x3d5383[_0x4e5283(0x198)],_0x4e201c=a33_0x589d36[_0x4e5283(0x1ca)](_0x1ebff8),_0x262377[_0x4e5283(0x185)]&&(console[_0x4e5283(0x177)](_0x4e5283(0x1b8)+_0x1ebff8),console[_0x4e5283(0x177)](_0x4e5283(0x1c0)+_0x1ab07b));}else{if(_0x317081){if(existsSync(_0x317081)&&statSync(_0x317081)['isDirectory']()){const _0x2ece09=findTdxConfigPath(_0x317081);if(_0x2ece09){const _0x4e18c7=loadTdxConfig(_0x2ece09);_0x1ab07b=_0x4e18c7[_0x4e5283(0x198)],_0x4e201c=a33_0x589d36[_0x4e5283(0x1ca)](_0x2ece09),_0x262377['verbose']&&(console[_0x4e5283(0x177)](_0x4e5283(0x186)+_0x2ece09),console[_0x4e5283(0x177)](_0x4e5283(0x1c0)+_0x1ab07b));}else return console['error'](a33_0x48240e[_0x4e5283(0x17d)](_0x4e5283(0x192)+_0x317081+'\x0a')),console[_0x4e5283(0x177)](a33_0x48240e[_0x4e5283(0x1b0)](_0x4e5283(0x1b3))),0x1;}else _0x1ab07b=_0x317081;}else _0x1ab07b=_0xe16bbe;}if(!_0x1ab07b)return console[_0x4e5283(0x177)](a33_0x48240e['red'](_0x4e5283(0x17a))),console[_0x4e5283(0x177)](_0x4e5283(0x178)),console[_0x4e5283(0x177)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent'),console['error'](_0x4e5283(0x199)),console[_0x4e5283(0x177)](a33_0x48240e[_0x4e5283(0x1b0)](_0x4e5283(0x189))),0x1;_0x262377[_0x4e5283(0x185)]&&(console[_0x4e5283(0x177)](_0x4e5283(0x179)+_0x262377[_0x4e5283(0x193)]),console[_0x4e5283(0x177)](_0x4e5283(0x18c)+_0x1ab07b));const _0x41322d=await withSpinner(_0x4e5283(0x1a9)+_0x1ab07b+_0x4e5283(0x1c2),()=>_0x14780e[_0x4e5283(0x1c8)][_0x4e5283(0x1a4)](_0x1ab07b),{'verbose':_0x262377[_0x4e5283(0x185)]}),_0x57a971=_0x41322d[_0x4e5283(0x1a1)],_0x5448b6=await withSpinner(_0x4e5283(0x190),()=>_0x14780e[_0x4e5283(0x1c8)][_0x4e5283(0x1a7)](_0x57a971),{'verbose':_0x262377[_0x4e5283(0x185)]}),_0x9d74f3=_0x5448b6[_0x4e5283(0x1a1)][_0x4e5283(0x1cb)]['name'];_0x262377[_0x4e5283(0x185)]&&console[_0x4e5283(0x177)](_0x4e5283(0x197)+_0x9d74f3);const [_0x1d1d4c,_0x25aa60]=await Promise['all']([withSpinner(_0x4e5283(0x18f),()=>_0x14780e[_0x4e5283(0x1c8)]['listSegments'](_0x57a971),{'verbose':_0x262377[_0x4e5283(0x185)]}),withSpinner(_0x4e5283(0x1af),()=>_0x14780e[_0x4e5283(0x1c8)][_0x4e5283(0x1a8)](_0x57a971),{'verbose':_0x262377[_0x4e5283(0x185)]})]),_0x20a915=_0x1d1d4c[_0x4e5283(0x1a1)],_0x4c2699=_0x25aa60['data'];if(_0x20a915['length']===0x0)return console[_0x4e5283(0x177)](a33_0x48240e[_0x4e5283(0x1cc)](_0x4e5283(0x1aa)+_0x9d74f3+'\x27')),0x0;const _0x2a4880=buildFolderPathMap(_0x4c2699),_0x57c247=_0x4e201c||getSegmentRootDir(sanitizeFileName(_0x1ab07b)),_0x14229e=new Map();await withSpinner(_0x4e5283(0x17b),async()=>{await batchAsync(_0x20a915,async _0x5301ba=>{const _0x9fb39c=a33_0x25c6,_0x21610c=await _0x14780e['segment'][_0x9fb39c(0x1be)](_0x57a971,_0x5301ba['id']);_0x14229e[_0x9fb39c(0x1bc)](_0x5301ba['id'],_0x21610c);});},{'verbose':_0x262377[_0x4e5283(0x185)]});const _0x3de5f7=await withSpinner(_0x4e5283(0x19c),()=>_0x14780e[_0x4e5283(0x176)][_0x4e5283(0x1ac)](),{'verbose':_0x262377[_0x4e5283(0x185)]})['then'](_0x17f47d=>_0x17f47d[_0x4e5283(0x1a1)]),_0x5ee732=await withSpinner(_0x4e5283(0x188),()=>_0x14780e[_0x4e5283(0x1b7)][_0x4e5283(0x1b4)](),{'verbose':_0x262377['verbose']})[_0x4e5283(0x183)](_0x61bd1=>_0x61bd1[_0x4e5283(0x1a1)]),_0x4f30af=[],_0x2519c4=a33_0x589d36[_0x4e5283(0x1ba)](_0x57c247,'tdx.json'),_0x103e6e=createTdxConfigContent(_0x9d74f3);_0x4f30af[_0x4e5283(0x187)](prepareFile(_0x2519c4,_0x103e6e,_0x57c247));const _0x51f31f=new Map();for(const _0x59fae2 of _0x20a915){const _0x94348a=_0x59fae2[_0x4e5283(0x1b6)]?_0x2a4880[_0x4e5283(0x18a)](_0x59fae2[_0x4e5283(0x1b6)])||'':'',_0x516de3=_0x14229e[_0x4e5283(0x18a)](_0x59fae2['id'])||[],_0x4100c7=segmentWithActivationsToYaml(_0x59fae2,_0x516de3,undefined,_0x3de5f7,_0x5ee732),_0x17526b=_0x94348a?a33_0x589d36[_0x4e5283(0x1ba)](_0x57c247,_0x94348a):_0x57c247,_0x427931=sanitizeFileName(_0x59fae2[_0x4e5283(0x1b1)]),_0x19cba6=getUniqueFileName(_0x17526b,_0x427931,_0x51f31f),_0x340e81=a33_0x589d36[_0x4e5283(0x1ba)](_0x17526b,_0x19cba6+_0x4e5283(0x194)),_0xf3f324=segmentToYamlString(_0x4100c7);_0x4f30af[_0x4e5283(0x187)](prepareFile(_0x340e81,_0xf3f324,_0x57c247));}const _0x311446=Array['from'](_0x14229e[_0x4e5283(0x1a2)]())['reduce']((_0x19ad6e,_0x4ebd20)=>_0x19ad6e+_0x4ebd20[_0x4e5283(0x1ab)],0x0),_0x4fa7df=_0x4f30af[_0x4e5283(0x19a)](_0x20d012=>_0x20d012[_0x4e5283(0x1cf)]),_0xe188de=_0x4f30af[_0x4e5283(0x19a)](_0xcd9302=>!_0xcd9302[_0x4e5283(0x1cf)]&&_0xcd9302['hasChanges']),_0x103337=_0x4f30af['filter'](_0x4dbdf4=>!_0x4dbdf4['isNew']&&!_0x4dbdf4['hasChanges']);console[_0x4e5283(0x177)](_0x4e5283(0x1bb)+_0x9d74f3+'\x27:'),console[_0x4e5283(0x177)]('\x20\x20'+a33_0x48240e[_0x4e5283(0x1b0)](_0x20a915[_0x4e5283(0x1ab)]+'\x20segments')+'\x20with\x20'+a33_0x48240e[_0x4e5283(0x1b0)](_0x311446+'\x20activations')),console[_0x4e5283(0x177)]('\x20\x20'+a33_0x48240e[_0x4e5283(0x191)]('+\x20'+_0x4fa7df['length']+_0x4e5283(0x1b5))),console[_0x4e5283(0x177)]('\x20\x20'+a33_0x48240e[_0x4e5283(0x1cc)]('~\x20'+_0xe188de[_0x4e5283(0x1ab)]+_0x4e5283(0x1ce))),console[_0x4e5283(0x177)]('\x20\x20'+a33_0x48240e[_0x4e5283(0x18e)]('=\x20'+_0x103337['length']+_0x4e5283(0x17f))),console['error']('\x20\x20Target:\x20'+a33_0x48240e[_0x4e5283(0x1b0)](_0x57c247)+'\x0a');if(_0xe188de['length']>0x0)for(const _0x20f777 of _0xe188de){console[_0x4e5283(0x177)]('\x0aChanges\x20to\x20\x27'+_0x20f777['relativePath']+'\x27:'),console[_0x4e5283(0x177)]('─'['repeat'](0x3c)),console[_0x4e5283(0x177)](_0x20f777[_0x4e5283(0x1ae)]),console[_0x4e5283(0x177)]('─'[_0x4e5283(0x195)](0x3c));}if(_0x262377[_0x4e5283(0x196)])return console[_0x4e5283(0x177)](a33_0x48240e[_0x4e5283(0x1cc)](_0x4e5283(0x1c1))),0x0;if(_0x4fa7df[_0x4e5283(0x1ab)]===0x0&&_0xe188de[_0x4e5283(0x1ab)]===0x0)return console[_0x4e5283(0x177)](a33_0x48240e[_0x4e5283(0x191)]('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x9d74f3},_0x262377[_0x4e5283(0x1cd)]),console[_0x4e5283(0x177)](a33_0x48240e[_0x4e5283(0x191)](_0x4e5283(0x17e)+a33_0x48240e[_0x4e5283(0x18e)](_0x4e5283(0x198))+_0x4e5283(0x1c9)+a33_0x48240e[_0x4e5283(0x1b0)](_0x9d74f3))),0x0;if(!_0x262377[_0x4e5283(0x19f)]&&(_0x4fa7df[_0x4e5283(0x1ab)]>0x0||_0xe188de[_0x4e5283(0x1ab)]>0x0)){const _0x22ecac=await confirmKey(_0x4e5283(0x1a6)+(_0x4fa7df[_0x4e5283(0x1ab)]+_0xe188de[_0x4e5283(0x1ab)])+_0x4e5283(0x181));if(!_0x22ecac)return console[_0x4e5283(0x177)](_0x4e5283(0x19d)),0x1;}for(const _0x36567f of _0x4f30af){if(_0x36567f['isNew']||_0x36567f[_0x4e5283(0x19e)]){const _0x4c7165=a33_0x589d36['dirname'](_0x36567f[_0x4e5283(0x1a5)]);!existsSync(_0x4c7165)&&mkdirSync(_0x4c7165,{'recursive':!![]}),writeFileSync(_0x36567f[_0x4e5283(0x1a5)],_0x36567f['content'],_0x4e5283(0x18d));}}return console['error'](a33_0x48240e[_0x4e5283(0x191)]('✔\x20Pulled\x20'+(_0x4fa7df[_0x4e5283(0x1ab)]+_0xe188de[_0x4e5283(0x1ab)])+_0x4e5283(0x1ad)+_0x57c247)),saveSessionContext({'parent_segment':_0x9d74f3},_0x262377[_0x4e5283(0x1cd)]),console[_0x4e5283(0x177)](a33_0x48240e[_0x4e5283(0x191)](_0x4e5283(0x17e)+a33_0x48240e[_0x4e5283(0x18e)](_0x4e5283(0x198))+_0x4e5283(0x1c9)+a33_0x48240e['cyan'](_0x9d74f3))),0x0;}}function buildFolderPathMap(_0x1881ed){const _0x44aead=a33_0x39d1b7,_0x533a9e=new Map(),_0x50a482=new Map();for(const _0x355b47 of _0x1881ed){_0x50a482[_0x44aead(0x1bc)](_0x355b47['id'],_0x355b47);}const _0x330489=new Set();for(const _0x502dfa of _0x1881ed){!_0x502dfa['parentFolderId']&&_0x330489[_0x44aead(0x19b)](_0x502dfa['id']);}function _0x121d07(_0x29dea8){const _0x32855d=_0x44aead;if(_0x533a9e[_0x32855d(0x17c)](_0x29dea8['id']))return _0x533a9e[_0x32855d(0x18a)](_0x29dea8['id']);if(_0x330489['has'](_0x29dea8['id']))return _0x533a9e[_0x32855d(0x1bc)](_0x29dea8['id'],''),'';if(_0x29dea8[_0x32855d(0x1b9)]){const _0x1477b4=_0x50a482[_0x32855d(0x18a)](_0x29dea8['parentFolderId']);if(_0x1477b4){const _0x236a49=_0x121d07(_0x1477b4),_0x8231d7=_0x236a49?_0x236a49+'/'+_0x29dea8[_0x32855d(0x1b1)]:_0x29dea8[_0x32855d(0x1b1)];return _0x533a9e[_0x32855d(0x1bc)](_0x29dea8['id'],_0x8231d7),_0x8231d7;}}const _0x404b8c=_0x29dea8['name'];return _0x533a9e['set'](_0x29dea8['id'],_0x404b8c),_0x404b8c;}for(const _0x548775 of _0x1881ed){_0x121d07(_0x548775);}return _0x533a9e;}function sanitizeFileName(_0x1cb95c){const _0x5b59cb=a33_0x39d1b7;return _0x1cb95c['toLowerCase']()['replace'](/[/\\:*?"<>|]/g,'-')[_0x5b59cb(0x18b)](/\s+/g,'-')[_0x5b59cb(0x18b)](/-+/g,'-')[_0x5b59cb(0x18b)](/^-|-$/g,'');}function getUniqueFileName(_0x123844,_0x20b421,_0x598443){const _0x7dc3c5=a33_0x39d1b7,_0x383f6d=_0x123844+':'+_0x20b421,_0x395316=_0x598443[_0x7dc3c5(0x18a)](_0x383f6d)||0x0;_0x598443['set'](_0x383f6d,_0x395316+0x1);if(_0x395316===0x0)return _0x20b421;return _0x20b421+'-'+_0x395316;}function prepareFile(_0x5d1132,_0x262050,_0x3769e2){const _0x27390b=a33_0x39d1b7,_0x37d199=a33_0x589d36[_0x27390b(0x1c5)](_0x3769e2,_0x5d1132);if(existsSync(_0x5d1132)){const _0x428d26=readFileSync(_0x5d1132,_0x27390b(0x18d)),_0x34bae5=generateDiff(_0x428d26,_0x262050),_0x2429b9=hasChanges(_0x34bae5);return{'relativePath':_0x37d199,'absolutePath':_0x5d1132,'content':_0x262050,'isNew':![],'hasChanges':_0x2429b9,'diff':_0x2429b9?formatDiffWithColors(_0x34bae5):undefined};}return{'relativePath':_0x37d199,'absolutePath':_0x5d1132,'content':_0x262050,'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
|
+
function a34_0x5a5f(_0x400b99,_0x1e98b0){_0x400b99=_0x400b99-0x1eb;const _0x3cc010=a34_0x3cc0();let _0x5a5f9b=_0x3cc010[_0x400b99];return _0x5a5f9b;}const a34_0x2515d0=a34_0x5a5f;(function(_0x2dcbc3,_0x31ac78){const _0x2b2f7c=a34_0x5a5f,_0x1044d0=_0x2dcbc3();while(!![]){try{const _0x4c119c=-parseInt(_0x2b2f7c(0x235))/0x1*(-parseInt(_0x2b2f7c(0x257))/0x2)+parseInt(_0x2b2f7c(0x271))/0x3+parseInt(_0x2b2f7c(0x206))/0x4*(-parseInt(_0x2b2f7c(0x200))/0x5)+parseInt(_0x2b2f7c(0x262))/0x6*(-parseInt(_0x2b2f7c(0x24d))/0x7)+parseInt(_0x2b2f7c(0x26b))/0x8+parseInt(_0x2b2f7c(0x1fe))/0x9+parseInt(_0x2b2f7c(0x263))/0xa*(parseInt(_0x2b2f7c(0x239))/0xb);if(_0x4c119c===_0x31ac78)break;else _0x1044d0['push'](_0x1044d0['shift']());}catch(_0x3bccb8){_0x1044d0['push'](_0x1044d0['shift']());}}}(a34_0x3cc0,0x47831));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';function a34_0x3cc0(){const _0x50767c=['\x27...','Source\x20directory:\x20','blue','listFolders','Error:\x20Parent\x20segment\x20is\x20required\x0a','buildNameToIdMap','\x20segments\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','✔\x20All\x20segments\x20and\x20activations\x20are\x20up\x20to\x20date','relative','configDir','execute','\x20deleted','Deleting\x20segment\x20\x27','endsWith','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','\x20activations]','Updating\x20activation\x20\x27','\x20changes?','Fetching\x20existing\x20folders...','12523itkuTQ','Creating\x20segment\x20\x27','parent_segment','\x20changed\x20segments','Aborted.','cwd','red','\x20\x20✔\x20Deleted\x20activation\x20\x27','flatMap','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','105284aorzMs','isNew','site','listSegments','delete','name','Fetching\x20connections\x20for\x20name\x20resolution...','✔\x20Created\x20segment\x20\x27','yellow','filter','Error:\x20No\x20segment\x20YAML\x20files\x20found\x20in\x20','1308UyGcAP','1850lNtbif','Error:\x20Directory\x20not\x20found:\x20','Resolving\x20parent\x20segment\x20\x27','create','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','\x20to\x20delete','parentSegment','hasChanges','3862416dhNSsu','dim','then','buildIdToNameMap','\x20\x20Segments:\x20','parentFolderId','34941dVFEVq','all','.yaml','join','.yml','\x20\x20✔\x20Created\x20activation\x20\x27','createActivation','type','diff','utf-8','\x20updated','Creating\x20activation\x20\x27','\x20\x20Activations:\x20','stringify','resolveParentId','Updating\x20segment\x20\x27','activations','toLowerCase','📁\x20','listActivations','updateSegmentById','\x20created','2259189mjcYjQ','Creating\x20folder\x20\x27','5VSeWfC','get','update','connection','Fetching\x20existing\x20activations...','from','1775844emYumy','has','error','config','deleteSegment','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','New\x20segment:','add','folderPath','✔\x20Created\x20folder\x20\x27','✔\x20Updated\x20segment\x20\x27','\x20to\x20create','Fetching\x20users\x20for\x20email\x20resolution...','yamlActivation','\x0a✔\x20Push\x20complete','Delete\x20segment:','sort','segment','\x20\x20\x20\x20','cyan','existingSegment','replace','existingActivation','push','dirname','yamlConfig','Changes\x20to:','\x0aPush\x20summary\x20for\x20\x27','Error\x20parsing\x20','Deleting\x20activation\x20\x27','Push\x20','green','verbose','\x20\x20Source:\x20','segmentFolderId','repeat','activationActions','\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','toString','length','dryRun','\x20unchanged\x20segments','set','isDirectory','No\x20segment\x20YAML\x20files\x20found','createFolder','3xFjJXg','entries','buildUserMaps','data','13288NvPcOm'];a34_0x3cc0=function(){return _0x50767c;};return a34_0x3cc0();}import a34_0x46b2dd from'chalk';import{existsSync,readFileSync,statSync,readdirSync}from'fs';import a34_0x5d5a02 from'path';import*as a34_0x37a678 from'yaml';function sanitizeFileName(_0x33d90c){const _0x5ab813=a34_0x5a5f;return _0x33d90c[_0x5ab813(0x1f9)]()[_0x5ab813(0x21c)](/[/\\:*?"<>|]/g,'-')[_0x5ab813(0x21c)](/\s+/g,'-')['replace'](/-+/g,'-')[_0x5ab813(0x21c)](/^-|-$/g,'');}function tryFindTdxConfig(_0x1c6a61){try{return findTdxConfig(_0x1c6a61);}catch{return null;}}function resolveTDFolderPath(_0x4e2ded,_0x31a1fd,_0x32074b){if(!_0x31a1fd)return _0x4e2ded;return _0x4e2ded?_0x32074b+'/'+_0x4e2ded:_0x32074b;}export class SegmentPushCommand extends BaseCommand{[a34_0x2515d0(0x25c)]='segment:push';['description']=a34_0x2515d0(0x20b);async[a34_0x2515d0(0x244)](_0x11eff9){const _0x2e412d=a34_0x2515d0,{options:_0x3c0c94,args:_0x220362,tdx:_0x3b31e6}=_0x11eff9,_0x4b497a=_0x3c0c94,_0x136726=_0x3c0c94[_0x2e412d(0x269)],_0x11f466=_0x220362[0x0];let _0x5ec2e0,_0x5aa8f1,_0x4737e8;if(_0x11f466){if(existsSync(_0x11f466)&&statSync(_0x11f466)[_0x2e412d(0x232)]()){const _0x22b3b0=tryFindTdxConfig(_0x11f466);if(_0x22b3b0)_0x5ec2e0=_0x22b3b0[_0x2e412d(0x209)][_0x2e412d(0x24f)],_0x5aa8f1=_0x11f466,_0x4737e8=_0x22b3b0[_0x2e412d(0x243)];else return console[_0x2e412d(0x208)](a34_0x46b2dd[_0x2e412d(0x253)](_0x2e412d(0x248)+_0x11f466+'\x0a')),console[_0x2e412d(0x208)](a34_0x46b2dd[_0x2e412d(0x21a)](_0x2e412d(0x267))),0x1;}else _0x5ec2e0=_0x11f466;}else{const _0x12c07f=tryFindTdxConfig(process[_0x2e412d(0x252)]());_0x12c07f?(_0x5ec2e0=_0x12c07f['config'][_0x2e412d(0x24f)],_0x5aa8f1=process[_0x2e412d(0x252)](),_0x4737e8=_0x12c07f[_0x2e412d(0x243)]):_0x5ec2e0=_0x136726;}if(!_0x5ec2e0)return console[_0x2e412d(0x208)](a34_0x46b2dd[_0x2e412d(0x253)](_0x2e412d(0x23e))),console[_0x2e412d(0x208)]('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[_0x2e412d(0x208)](_0x2e412d(0x256)),console[_0x2e412d(0x208)](_0x2e412d(0x22c)),console[_0x2e412d(0x208)](a34_0x46b2dd['cyan']('Tip:\x20Set\x20context\x20with\x20`tdx\x20segment\x20use\x20<parent_name>`\x20or\x20`tdx\x20ps\x20use\x20<parent_name>`')),0x1;const _0x44822d=_0x5aa8f1||getSegmentRootDir(sanitizeFileName(_0x5ec2e0)),_0x26ae07=_0x4737e8||_0x44822d,_0x3b26c3=a34_0x5d5a02[_0x2e412d(0x242)](_0x26ae07,_0x44822d),_0x2fb5bd=_0x3b26c3!==''&&_0x3b26c3!=='.';if(!existsSync(_0x44822d))return console[_0x2e412d(0x208)](a34_0x46b2dd[_0x2e412d(0x253)](_0x2e412d(0x264)+_0x44822d+'\x0a')),console[_0x2e412d(0x208)](a34_0x46b2dd[_0x2e412d(0x21a)](_0x2e412d(0x267))),0x1;_0x4b497a[_0x2e412d(0x227)]&&(console[_0x2e412d(0x208)]('Site:\x20'+_0x4b497a[_0x2e412d(0x259)]),console[_0x2e412d(0x208)]('Parent\x20segment:\x20'+_0x5ec2e0),console[_0x2e412d(0x208)](_0x2e412d(0x23b)+_0x44822d),_0x2fb5bd&&console[_0x2e412d(0x208)]('Scoped\x20to\x20folder:\x20'+_0x3b26c3));const _0x24380c=await withSpinner(_0x2e412d(0x265)+_0x5ec2e0+'\x27...',()=>_0x3b31e6[_0x2e412d(0x218)][_0x2e412d(0x1f6)](_0x5ec2e0),{'verbose':_0x4b497a['verbose']}),_0x1949bc=_0x24380c[_0x2e412d(0x238)],[_0x11cad5,_0x3730e1,_0x3c8f70]=await Promise[_0x2e412d(0x272)]([withSpinner('Fetching\x20existing\x20segments...',()=>_0x3b31e6[_0x2e412d(0x218)][_0x2e412d(0x25a)](_0x1949bc),{'verbose':_0x4b497a[_0x2e412d(0x227)]}),withSpinner(_0x2e412d(0x24c),()=>_0x3b31e6['segment'][_0x2e412d(0x23d)](_0x1949bc),{'verbose':_0x4b497a[_0x2e412d(0x227)]}),withSpinner(_0x2e412d(0x213),()=>_0x3b31e6['user'][_0x2e412d(0x237)](),{'verbose':_0x4b497a[_0x2e412d(0x227)]})[_0x2e412d(0x26d)](_0x4ae97c=>_0x4ae97c[_0x2e412d(0x238)])]),_0x198769=_0x11cad5['data'],_0x5a9ef5=_0x3730e1[_0x2e412d(0x238)],{emailToId:_0x523ae6,idToEmail:_0x288383}=_0x3c8f70,[_0x352001,_0x6ab6b3]=await withSpinner(_0x2e412d(0x25d),async()=>{const _0x314d75=_0x2e412d,[_0x45d91a,_0x1ed354]=await Promise[_0x314d75(0x272)]([_0x3b31e6[_0x314d75(0x203)][_0x314d75(0x23f)](),_0x3b31e6[_0x314d75(0x203)][_0x314d75(0x26e)]()]);return[_0x45d91a,_0x1ed354];},{'verbose':_0x4b497a['verbose']})[_0x2e412d(0x26d)](_0x1c08e0=>_0x1c08e0[_0x2e412d(0x238)]),_0x530c3f=buildFolderPathToIdMap(_0x5a9ef5),_0x3ea168=new Map();for(const [_0x57b708,_0x4be976]of _0x530c3f[_0x2e412d(0x236)]()){_0x3ea168[_0x2e412d(0x231)](_0x4be976,_0x57b708);}const _0x16712c=new Map();for(const _0x58a630 of _0x198769){const _0xc6f529=_0x58a630['segmentFolderId']?_0x3ea168[_0x2e412d(0x201)](_0x58a630[_0x2e412d(0x229)]['toString']())||'':'',_0x4689b8=_0xc6f529+':'+_0x58a630[_0x2e412d(0x25c)];_0x16712c[_0x2e412d(0x231)](_0x4689b8,_0x58a630);}const _0x595bc6=findYamlFiles(_0x44822d);if(_0x595bc6[_0x2e412d(0x22e)]===0x0)return console[_0x2e412d(0x208)](a34_0x46b2dd[_0x2e412d(0x253)](_0x2e412d(0x261)+_0x44822d+'\x0a')),console[_0x2e412d(0x208)](a34_0x46b2dd[_0x2e412d(0x21a)]('Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20files')),0x1;const _0x3a4edc=[];for(const _0x5e2fd4 of _0x595bc6){const _0x2e2732=a34_0x5d5a02['relative'](_0x44822d,a34_0x5d5a02[_0x2e412d(0x21f)](_0x5e2fd4)),_0x3f65b7=_0x2e2732==='.'?'':_0x2e2732,_0x364f08=readFileSync(_0x5e2fd4,_0x2e412d(0x1f1));try{const _0x141e71=parseSegmentYamlFile(_0x364f08);_0x3a4edc[_0x2e412d(0x21e)]({'yamlConfig':_0x141e71,'folderPath':_0x3f65b7,'sourcePath':_0x5e2fd4});}catch(_0x261199){return console['error'](a34_0x46b2dd[_0x2e412d(0x253)](_0x2e412d(0x223)+_0x5e2fd4+':\x20'+(_0x261199 instanceof Error?_0x261199['message']:_0x261199))),0x1;}}if(_0x3a4edc[_0x2e412d(0x22e)]===0x0)return console[_0x2e412d(0x208)](a34_0x46b2dd[_0x2e412d(0x25f)](_0x2e412d(0x233))),0x0;const _0x451e43=new Map();_0x198769[_0x2e412d(0x22e)]>0x0&&await withSpinner(_0x2e412d(0x204),async()=>{await batchAsync(_0x198769,async _0x384116=>{const _0x4ec2cb=a34_0x5a5f,_0x1184f2=await _0x3b31e6[_0x4ec2cb(0x218)][_0x4ec2cb(0x1fb)](_0x1949bc,_0x384116['id']);_0x451e43[_0x4ec2cb(0x231)](_0x384116['id'],_0x1184f2);});},{'verbose':_0x4b497a[_0x2e412d(0x227)]});const _0x23cb27=[],_0x181227=new Set();for(const {yamlConfig:_0xe5c1b2,folderPath:_0x113501,sourcePath:_0x4fbba8}of _0x3a4edc){const _0x12c139=resolveTDFolderPath(_0x113501,_0x2fb5bd,_0x3b26c3),_0x5801fb=_0x12c139+':'+_0xe5c1b2['name'],_0x3c37ce=_0x16712c[_0x2e412d(0x201)](_0x5801fb),_0xbb3268=_0x3c37ce?_0x451e43[_0x2e412d(0x201)](_0x3c37ce['id'])||[]:[];if(_0x12c139&&!_0x530c3f[_0x2e412d(0x207)](_0x12c139)){const _0x3cbfc1=_0x12c139['split']('/');let _0x1e2add='';for(const _0x7c2b40 of _0x3cbfc1){_0x1e2add=_0x1e2add?_0x1e2add+'/'+_0x7c2b40:_0x7c2b40,!_0x530c3f['has'](_0x1e2add)&&_0x181227[_0x2e412d(0x20e)](_0x1e2add);}}const _0x40f779=calculateActivationActions(_0xe5c1b2[_0x2e412d(0x1f8)]||[],_0xbb3268,_0x288383,_0x6ab6b3),_0x35fb20=segmentToYamlString(_0xe5c1b2);let _0x244e7f,_0x3870b3=![],_0xb4af26;if(_0x3c37ce){const _0x5a55d6=segmentWithActivationsToYaml(_0x3c37ce,_0xbb3268,undefined,_0x288383,_0x6ab6b3),_0xdd54fd=segmentToYamlString(_0x5a55d6);_0x244e7f=generateDiff(_0xdd54fd,_0x35fb20),_0x3870b3=hasChanges(_0x244e7f),_0x3870b3&&(_0xb4af26=formatDiffWithColors(_0x244e7f));}else _0x244e7f=generateDiff('',_0x35fb20),_0xb4af26=formatDiffWithColors(_0x244e7f);_0x23cb27[_0x2e412d(0x21e)]({'relativePath':_0xe5c1b2[_0x2e412d(0x25c)],'absolutePath':_0x4fbba8,'yamlConfig':_0xe5c1b2,'folderPath':_0x12c139,'existingSegment':_0x3c37ce,'existingActivations':_0xbb3268,'isNew':!_0x3c37ce,'hasChanges':_0x3870b3,'diff':_0xb4af26,'activationActions':_0x40f779});}const _0x25d178=new Set();for(const {yamlConfig:_0x429ab5,folderPath:_0x257e9d}of _0x3a4edc){const _0x3f1e1f=resolveTDFolderPath(_0x257e9d,_0x2fb5bd,_0x3b26c3);_0x25d178['add'](_0x3f1e1f+':'+_0x429ab5[_0x2e412d(0x25c)]);}const _0x59db1c=_0x198769[_0x2e412d(0x260)](_0x163a53=>{const _0x402654=_0x2e412d,_0x11783b=_0x163a53[_0x402654(0x229)]?_0x3ea168[_0x402654(0x201)](_0x163a53[_0x402654(0x229)][_0x402654(0x22d)]())||'':'',_0x4c8e2a=_0x11783b+':'+_0x163a53[_0x402654(0x25c)];if(_0x25d178['has'](_0x4c8e2a))return![];if(_0x2fb5bd)return _0x11783b===_0x3b26c3||_0x11783b['startsWith'](_0x3b26c3+'/');return!![];}),_0x42520c=_0x23cb27[_0x2e412d(0x260)](_0x3e81f7=>_0x3e81f7[_0x2e412d(0x258)]),_0x1c0872=_0x23cb27['filter'](_0x44dd72=>!_0x44dd72[_0x2e412d(0x258)]&&_0x44dd72[_0x2e412d(0x26a)]),_0x34fc79=_0x23cb27[_0x2e412d(0x260)](_0xad451f=>!_0xad451f[_0x2e412d(0x258)]&&!_0xad451f['hasChanges']),_0x293782=Array[_0x2e412d(0x205)](_0x181227)[_0x2e412d(0x217)](),_0x1f80c5=_0x4b497a['delete']?_0x59db1c:[],_0x34ad9b=_0x23cb27[_0x2e412d(0x255)](_0x8b867=>_0x8b867[_0x2e412d(0x22b)]),_0x4268c3=_0x34ad9b[_0x2e412d(0x260)](_0x2f8da4=>_0x2f8da4[_0x2e412d(0x1ef)]===_0x2e412d(0x266)),_0x3916eb=_0x34ad9b[_0x2e412d(0x260)](_0xfdbe3=>_0xfdbe3[_0x2e412d(0x1ef)]===_0x2e412d(0x202)),_0x34e4d3=_0x34ad9b['filter'](_0x26a351=>_0x26a351[_0x2e412d(0x1ef)]===_0x2e412d(0x25b));console['error'](_0x2e412d(0x222)+_0x5ec2e0+'\x27:');_0x293782[_0x2e412d(0x22e)]>0x0&&console[_0x2e412d(0x208)]('\x20\x20'+a34_0x46b2dd[_0x2e412d(0x23c)](_0x2e412d(0x1fa)+_0x293782[_0x2e412d(0x22e)]+'\x20folders\x20to\x20create'));console['error']('\x20\x20'+a34_0x46b2dd[_0x2e412d(0x226)]('+\x20'+_0x42520c[_0x2e412d(0x22e)]+'\x20new\x20segments')),console[_0x2e412d(0x208)]('\x20\x20'+a34_0x46b2dd['yellow']('~\x20'+_0x1c0872[_0x2e412d(0x22e)]+_0x2e412d(0x250)));if(_0x1f80c5[_0x2e412d(0x22e)]>0x0)console['error']('\x20\x20'+a34_0x46b2dd['red']('-\x20'+_0x1f80c5[_0x2e412d(0x22e)]+'\x20segments\x20to\x20delete'));else _0x59db1c['length']>0x0&&!_0x4b497a['delete']&&console[_0x2e412d(0x208)]('\x20\x20'+a34_0x46b2dd['dim']('\x20\x20'+_0x59db1c[_0x2e412d(0x22e)]+_0x2e412d(0x240)));console['error']('\x20\x20'+a34_0x46b2dd[_0x2e412d(0x26c)]('=\x20'+_0x34fc79[_0x2e412d(0x22e)]+_0x2e412d(0x230)));_0x34ad9b[_0x2e412d(0x22e)]>0x0&&(console['error'](''),console[_0x2e412d(0x208)]('\x20\x20Activations:'),_0x4268c3[_0x2e412d(0x22e)]>0x0&&console[_0x2e412d(0x208)]('\x20\x20\x20\x20'+a34_0x46b2dd[_0x2e412d(0x226)]('+\x20'+_0x4268c3['length']+_0x2e412d(0x212))),_0x3916eb['length']>0x0&&console['error'](_0x2e412d(0x219)+a34_0x46b2dd[_0x2e412d(0x25f)]('~\x20'+_0x3916eb[_0x2e412d(0x22e)]+'\x20to\x20update')),_0x34e4d3[_0x2e412d(0x22e)]>0x0&&console[_0x2e412d(0x208)]('\x20\x20\x20\x20'+a34_0x46b2dd[_0x2e412d(0x253)]('-\x20'+_0x34e4d3['length']+_0x2e412d(0x268))));console[_0x2e412d(0x208)](_0x2e412d(0x228)+a34_0x46b2dd['cyan'](_0x44822d)+'\x0a');if(_0x293782[_0x2e412d(0x22e)]>0x0){console[_0x2e412d(0x208)]('Folders\x20to\x20create:');for(const _0x6b1271 of _0x293782){console['error']('\x20\x20'+a34_0x46b2dd['blue']('+')+'\x20'+_0x6b1271);}console[_0x2e412d(0x208)]('');}if(_0x42520c['length']>0x0)for(const _0x4ea021 of _0x42520c){const _0x26eeed=_0x4ea021['folderPath']?_0x4ea021[_0x2e412d(0x20f)]+'/'+_0x4ea021[_0x2e412d(0x220)]['name']:_0x4ea021['yamlConfig'][_0x2e412d(0x25c)],_0x2ec185=_0x4ea021[_0x2e412d(0x220)][_0x2e412d(0x1f8)]?.[_0x2e412d(0x22e)]||0x0,_0x51468d=_0x2ec185>0x0?a34_0x46b2dd[_0x2e412d(0x26c)]('\x20['+_0x2ec185+_0x2e412d(0x249)):'';console[_0x2e412d(0x208)]('\x0a'+a34_0x46b2dd['green'](_0x2e412d(0x20d))+'\x20'+_0x26eeed+_0x51468d),console[_0x2e412d(0x208)]('─'['repeat'](0x3c)),_0x4ea021[_0x2e412d(0x1f0)]&&console['error'](_0x4ea021[_0x2e412d(0x1f0)]),console['error']('─'[_0x2e412d(0x22a)](0x3c));}if(_0x1f80c5[_0x2e412d(0x22e)]>0x0)for(const _0x231941 of _0x1f80c5){const _0xc9ce5f=_0x231941['segmentFolderId']?_0x3ea168[_0x2e412d(0x201)](_0x231941[_0x2e412d(0x229)][_0x2e412d(0x22d)]())||'':'',_0x4fe6c9=_0xc9ce5f?_0xc9ce5f+'/'+_0x231941[_0x2e412d(0x25c)]:_0x231941['name'],_0x1ddbcf=_0x451e43[_0x2e412d(0x201)](_0x231941['id'])||[],_0x43af5c=_0x1ddbcf[_0x2e412d(0x22e)]>0x0?a34_0x46b2dd['dim']('\x20['+_0x1ddbcf[_0x2e412d(0x22e)]+_0x2e412d(0x249)):'';console[_0x2e412d(0x208)]('\x0a'+a34_0x46b2dd[_0x2e412d(0x253)](_0x2e412d(0x216))+'\x20'+_0x4fe6c9+_0x43af5c),console[_0x2e412d(0x208)]('─'[_0x2e412d(0x22a)](0x3c));const _0x528dc2=segmentWithActivationsToYaml(_0x231941,_0x1ddbcf,undefined,_0x288383,_0x6ab6b3),_0xc2bf33=segmentToYamlString(_0x528dc2),_0x42c07b=generateDiff(_0xc2bf33,'');console[_0x2e412d(0x208)](formatDiffWithColors(_0x42c07b)),console[_0x2e412d(0x208)]('─'['repeat'](0x3c));}const _0x15b50b=_0x23cb27[_0x2e412d(0x260)](_0xdda11b=>!_0xdda11b['isNew']&&_0xdda11b['diff']);if(_0x15b50b['length']>0x0)for(const _0x34bf8c of _0x15b50b){const _0x5f261c=_0x34bf8c[_0x2e412d(0x20f)]?_0x34bf8c['folderPath']+'/'+_0x34bf8c['yamlConfig'][_0x2e412d(0x25c)]:_0x34bf8c[_0x2e412d(0x220)][_0x2e412d(0x25c)];console[_0x2e412d(0x208)]('\x0a'+a34_0x46b2dd[_0x2e412d(0x25f)](_0x2e412d(0x221))+'\x20'+_0x5f261c),console[_0x2e412d(0x208)]('─'['repeat'](0x3c)),console[_0x2e412d(0x208)](_0x34bf8c[_0x2e412d(0x1f0)]),console[_0x2e412d(0x208)]('─'['repeat'](0x3c));}if(_0x4b497a[_0x2e412d(0x22f)])return console['error'](a34_0x46b2dd[_0x2e412d(0x25f)](_0x2e412d(0x20c))),0x0;const _0x59e7ff=_0x42520c[_0x2e412d(0x22e)]>0x0||_0x1c0872[_0x2e412d(0x22e)]>0x0||_0x1f80c5[_0x2e412d(0x22e)]>0x0,_0x43d6e5=_0x34ad9b[_0x2e412d(0x22e)]>0x0,_0x2a4bcd=_0x293782[_0x2e412d(0x22e)]>0x0;if(!_0x59e7ff&&!_0x43d6e5&&!_0x2a4bcd)return console[_0x2e412d(0x208)](a34_0x46b2dd[_0x2e412d(0x226)](_0x2e412d(0x241))),0x0;const _0x48d4ff=_0x42520c['length']+_0x1c0872[_0x2e412d(0x22e)]+_0x1f80c5[_0x2e412d(0x22e)]+_0x293782['length']+_0x34ad9b[_0x2e412d(0x22e)];if(!_0x4b497a['yes']&&_0x48d4ff>0x0){const _0x1ab1a7=await confirmKey(_0x2e412d(0x225)+_0x48d4ff+_0x2e412d(0x24b));if(!_0x1ab1a7)return console[_0x2e412d(0x208)](_0x2e412d(0x251)),0x1;}for(const _0x345b08 of _0x293782){const _0x2cd4ec=_0x345b08['split']('/'),_0x230a14=_0x2cd4ec[_0x2cd4ec[_0x2e412d(0x22e)]-0x1],_0x58531c=_0x2cd4ec['slice'](0x0,-0x1)['join']('/'),_0x52011e=_0x530c3f[_0x2e412d(0x201)](_0x58531c),_0x28be0a={'name':_0x230a14,'parentFolderId':_0x52011e},_0x28b2f3=await withSpinner(_0x2e412d(0x1ff)+_0x345b08+_0x2e412d(0x23a),()=>_0x3b31e6[_0x2e412d(0x218)][_0x2e412d(0x234)](_0x1949bc,_0x28be0a),{'verbose':_0x4b497a['verbose']});_0x530c3f[_0x2e412d(0x231)](_0x345b08,_0x28b2f3['data']['id']),console[_0x2e412d(0x208)](a34_0x46b2dd[_0x2e412d(0x23c)](_0x2e412d(0x210)+_0x345b08+'\x27'));}let _0x27cbf8=0x0,_0x443bbb=0x0,_0x24afec=0x0,_0xff7b09=0x0,_0x5b0b25=0x0,_0x4c50ef=0x0;const _0x19fbde=new Map();for(const _0x18568c of _0x23cb27){const _0x30251d=_0x18568c[_0x2e412d(0x20f)]?_0x530c3f['get'](_0x18568c[_0x2e412d(0x20f)]):undefined;let _0x47fbf9;if(_0x18568c['isNew']){const _0x58893f=yamlToCreateRequest(_0x18568c[_0x2e412d(0x220)],_0x30251d),_0x53328a=await withSpinner(_0x2e412d(0x24e)+_0x18568c[_0x2e412d(0x220)][_0x2e412d(0x25c)]+'\x27...',()=>_0x3b31e6[_0x2e412d(0x218)]['createSegment'](_0x1949bc,_0x58893f),{'verbose':_0x4b497a['verbose']});_0x47fbf9=_0x53328a[_0x2e412d(0x238)]['id'],_0x19fbde[_0x2e412d(0x231)](_0x18568c[_0x2e412d(0x220)][_0x2e412d(0x25c)],_0x47fbf9),console[_0x2e412d(0x208)](a34_0x46b2dd[_0x2e412d(0x226)](_0x2e412d(0x25e)+_0x18568c[_0x2e412d(0x220)]['name']+'\x27')),_0x27cbf8++;}else{if(_0x18568c[_0x2e412d(0x26a)]){const _0x2a3af1=yamlToUpdateRequest(_0x18568c[_0x2e412d(0x220)]);_0x30251d!==_0x18568c[_0x2e412d(0x21b)]?.[_0x2e412d(0x229)]&&(_0x2a3af1[_0x2e412d(0x229)]=_0x30251d?parseInt(_0x30251d,0xa):undefined),await withSpinner(_0x2e412d(0x1f7)+_0x18568c['yamlConfig'][_0x2e412d(0x25c)]+_0x2e412d(0x23a),()=>_0x3b31e6[_0x2e412d(0x218)][_0x2e412d(0x1fc)](_0x1949bc,_0x18568c[_0x2e412d(0x21b)]['id'],_0x2a3af1),{'verbose':_0x4b497a['verbose']}),_0x47fbf9=_0x18568c[_0x2e412d(0x21b)]['id'],console[_0x2e412d(0x208)](a34_0x46b2dd[_0x2e412d(0x25f)](_0x2e412d(0x211)+_0x18568c[_0x2e412d(0x220)]['name']+'\x27')),_0x443bbb++;}else _0x47fbf9=_0x18568c[_0x2e412d(0x21b)]['id'];}for(const _0x4ae3d5 of _0x18568c['activationActions']){if(_0x4ae3d5[_0x2e412d(0x1ef)]===_0x2e412d(0x266)&&_0x4ae3d5[_0x2e412d(0x214)]){const _0x1983bd=yamlActivationToCreateRequest(_0x4ae3d5[_0x2e412d(0x214)],_0x523ae6,_0x352001);await withSpinner(_0x2e412d(0x1f3)+_0x4ae3d5[_0x2e412d(0x25c)]+_0x2e412d(0x23a),()=>_0x3b31e6[_0x2e412d(0x218)][_0x2e412d(0x1ee)](_0x1949bc,_0x47fbf9,_0x1983bd),{'verbose':_0x4b497a[_0x2e412d(0x227)]}),console[_0x2e412d(0x208)](a34_0x46b2dd[_0x2e412d(0x226)](_0x2e412d(0x1ed)+_0x4ae3d5['name']+'\x27')),_0xff7b09++;}else{if(_0x4ae3d5[_0x2e412d(0x1ef)]===_0x2e412d(0x202)&&_0x4ae3d5[_0x2e412d(0x214)]&&_0x4ae3d5[_0x2e412d(0x21d)]){const _0x1345f1=yamlActivationToUpdateRequest(_0x4ae3d5['yamlActivation'],_0x523ae6,_0x352001);await withSpinner(_0x2e412d(0x24a)+_0x4ae3d5[_0x2e412d(0x25c)]+'\x27...',()=>_0x3b31e6[_0x2e412d(0x218)]['updateActivation'](_0x1949bc,_0x47fbf9,_0x4ae3d5['existingActivation']['id'],_0x1345f1),{'verbose':_0x4b497a['verbose']}),console['error'](a34_0x46b2dd[_0x2e412d(0x25f)]('\x20\x20✔\x20Updated\x20activation\x20\x27'+_0x4ae3d5['name']+'\x27')),_0x5b0b25++;}else _0x4ae3d5['type']===_0x2e412d(0x25b)&&_0x4ae3d5[_0x2e412d(0x21d)]&&(await withSpinner(_0x2e412d(0x224)+_0x4ae3d5[_0x2e412d(0x25c)]+_0x2e412d(0x23a),()=>_0x3b31e6[_0x2e412d(0x218)]['deleteActivation'](_0x1949bc,_0x47fbf9,_0x4ae3d5[_0x2e412d(0x21d)]['id']),{'verbose':_0x4b497a[_0x2e412d(0x227)]}),console[_0x2e412d(0x208)](a34_0x46b2dd['red'](_0x2e412d(0x254)+_0x4ae3d5[_0x2e412d(0x25c)]+'\x27')),_0x4c50ef++);}}}for(const _0x37811e of _0x1f80c5){await withSpinner(_0x2e412d(0x246)+_0x37811e[_0x2e412d(0x25c)]+_0x2e412d(0x23a),()=>_0x3b31e6[_0x2e412d(0x218)][_0x2e412d(0x20a)](_0x37811e['id']),{'verbose':_0x4b497a[_0x2e412d(0x227)]}),console[_0x2e412d(0x208)](a34_0x46b2dd['red']('✔\x20Deleted\x20segment\x20\x27'+_0x37811e['name']+'\x27')),_0x24afec++;}const _0x32076e=[];if(_0x27cbf8>0x0)_0x32076e[_0x2e412d(0x21e)](_0x27cbf8+'\x20created');if(_0x443bbb>0x0)_0x32076e[_0x2e412d(0x21e)](_0x443bbb+'\x20updated');if(_0x24afec>0x0)_0x32076e[_0x2e412d(0x21e)](_0x24afec+_0x2e412d(0x245));const _0x34de29=[];if(_0xff7b09>0x0)_0x34de29[_0x2e412d(0x21e)](_0xff7b09+_0x2e412d(0x1fd));if(_0x5b0b25>0x0)_0x34de29[_0x2e412d(0x21e)](_0x5b0b25+_0x2e412d(0x1f2));if(_0x4c50ef>0x0)_0x34de29[_0x2e412d(0x21e)](_0x4c50ef+'\x20deleted');return console[_0x2e412d(0x208)](a34_0x46b2dd[_0x2e412d(0x226)](_0x2e412d(0x215))),_0x32076e[_0x2e412d(0x22e)]>0x0&&console[_0x2e412d(0x208)](_0x2e412d(0x26f)+_0x32076e[_0x2e412d(0x1eb)](',\x20')),_0x34de29[_0x2e412d(0x22e)]>0x0&&console['error'](_0x2e412d(0x1f4)+_0x34de29[_0x2e412d(0x1eb)](',\x20')),0x0;}}function buildFolderPathToIdMap(_0x292d95){const _0x2be9a3=a34_0x2515d0,_0x146c8f=new Map(),_0x3514a5=new Map();for(const _0x26963b of _0x292d95){_0x3514a5[_0x2be9a3(0x231)](_0x26963b['id'],_0x26963b);}const _0x131cad=new Set();for(const _0x473715 of _0x292d95){!_0x473715['parentFolderId']&&_0x131cad[_0x2be9a3(0x20e)](_0x473715['id']);}function _0x193f1b(_0x1e37ba){const _0x72e6=_0x2be9a3;if(_0x131cad[_0x72e6(0x207)](_0x1e37ba['id']))return'';if(_0x1e37ba['parentFolderId']){const _0x5286c2=_0x3514a5[_0x72e6(0x201)](_0x1e37ba[_0x72e6(0x270)]);if(_0x5286c2){const _0x2dec45=_0x193f1b(_0x5286c2);return _0x2dec45?_0x2dec45+'/'+_0x1e37ba[_0x72e6(0x25c)]:_0x1e37ba[_0x72e6(0x25c)];}}return _0x1e37ba[_0x72e6(0x25c)];}for(const _0x36c3fd of _0x292d95){const _0x104025=_0x193f1b(_0x36c3fd);_0x146c8f[_0x2be9a3(0x231)](_0x104025,_0x36c3fd['id']);}return _0x146c8f;}function findYamlFiles(_0x2b39b9){const _0x20837c=[];function _0x40e827(_0x39d7c8){const _0x1ec092=a34_0x5a5f,_0x375da5=readdirSync(_0x39d7c8,{'withFileTypes':!![]});for(const _0x24e4fd of _0x375da5){const _0x3b1df0=a34_0x5d5a02[_0x1ec092(0x1eb)](_0x39d7c8,_0x24e4fd[_0x1ec092(0x25c)]);if(_0x24e4fd[_0x1ec092(0x232)]())_0x40e827(_0x3b1df0);else(_0x24e4fd['name'][_0x1ec092(0x247)](_0x1ec092(0x1ec))||_0x24e4fd['name'][_0x1ec092(0x247)](_0x1ec092(0x273)))&&_0x20837c[_0x1ec092(0x21e)](_0x3b1df0);}}return _0x40e827(_0x2b39b9),_0x20837c;}function calculateActivationActions(_0x5f0d6c,_0x4a018b,_0x4c49b7,_0xc7f765){const _0x25698c=a34_0x2515d0,_0x402d14=[],_0x12b35a=new Map();for(const _0x19a809 of _0x4a018b){_0x12b35a['set'](_0x19a809[_0x25698c(0x25c)],_0x19a809);}const _0x4558a4=new Map();for(const _0x54ca16 of _0x5f0d6c){_0x4558a4[_0x25698c(0x231)](_0x54ca16[_0x25698c(0x25c)],_0x54ca16);}for(const _0x4fca69 of _0x5f0d6c){const _0x5c6cf3=_0x12b35a[_0x25698c(0x201)](_0x4fca69[_0x25698c(0x25c)]);if(!_0x5c6cf3)_0x402d14[_0x25698c(0x21e)]({'type':'create','name':_0x4fca69[_0x25698c(0x25c)],'yamlActivation':_0x4fca69});else{const _0x4f3cd3=activationToYaml(_0x5c6cf3,_0x4c49b7,_0xc7f765),_0x2b631f=a34_0x37a678[_0x25698c(0x1f5)](_0x4f3cd3),_0xfe6f8e=a34_0x37a678[_0x25698c(0x1f5)](_0x4fca69);_0x2b631f!==_0xfe6f8e&&_0x402d14[_0x25698c(0x21e)]({'type':_0x25698c(0x202),'name':_0x4fca69[_0x25698c(0x25c)],'yamlActivation':_0x4fca69,'existingActivation':_0x5c6cf3});}}for(const _0x386c1c of _0x4a018b){!_0x4558a4['has'](_0x386c1c[_0x25698c(0x25c)])&&_0x402d14[_0x25698c(0x21e)]({'type':'delete','name':_0x386c1c['name'],'existingActivation':_0x386c1c});}return _0x402d14;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0x2fdc21=a35_0x2c6c;(function(_0x4c44cc,_0x454d85){const _0x421a2f=a35_0x2c6c,_0x404633=_0x4c44cc();while(!![]){try{const _0x23c949=parseInt(_0x421a2f(0x1c7))/0x1*(-parseInt(_0x421a2f(0x1a0))/0x2)+parseInt(_0x421a2f(0x1c9))/0x3+parseInt(_0x421a2f(0x1c8))/0x4+-parseInt(_0x421a2f(0x1c5))/0x5+parseInt(_0x421a2f(0x1b4))/0x6*(-parseInt(_0x421a2f(0x1ad))/0x7)+-parseInt(_0x421a2f(0x1be))/0x8*(-parseInt(_0x421a2f(0x1a4))/0x9)+parseInt(_0x421a2f(0x199))/0xa*(-parseInt(_0x421a2f(0x1a2))/0xb);if(_0x23c949===_0x454d85)break;else _0x404633['push'](_0x404633['shift']());}catch(_0x3c1d20){_0x404633['push'](_0x404633['shift']());}}}(a35_0x2b40,0x3515e));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';function a35_0x2c6c(_0x54f056,_0x56d10b){_0x54f056=_0x54f056-0x199;const _0x2b4024=a35_0x2b40();let _0x2c6ceb=_0x2b4024[_0x54f056];return _0x2c6ceb;}function a35_0x2b40(){const _0x23e758=['\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Error:\x20Cannot\x20update\x20','Examples:','segmentPath','570adCkXn','yellow','Resolving\x20folder\x20\x27','description','segmentId','Resolved\x20folder\x20ID:\x20','type','name','Updating\x20segment\x20\x27','Segment\x20ID:\x20','931016RbrQXd','length','parentId','Resolved\x20type:\x20','updateSegmentById','includes','error','311465iqCAii','verbose','473Ukjyjb','669368moPAKZ','1141956LUdMJV','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','data','30IXUAkh','segment','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','resolveFolderId','rule','⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.','\x27...','154mlQkPb','✔\x20Updated\x20segment\x20\x27','591987eETcUt','INTERNAL','18svxcZE','kind','folder','Update\x20existing\x20child\x20segment','\x20\x20\x20Path:\x20','segmentName','segment:update','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Resolving\x20path\x20\x27','22337LjQwjC','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','resolvePathToResource'];a35_0x2b40=function(){return _0x23e758;};return a35_0x2b40();}import a35_0x3add9c from'chalk';export class SegmentUpdateCommand extends BaseCommand{['name']=a35_0x2fdc21(0x1aa);['description']=a35_0x2fdc21(0x1a7);async['execute'](_0x3c3227){const _0xa93c37=a35_0x2fdc21;console['error'](a35_0x3add9c[_0xa93c37(0x1b5)](_0xa93c37(0x19e))),console[_0xa93c37(0x1c4)](a35_0x3add9c[_0xa93c37(0x1b5)](_0xa93c37(0x1b0)));const {options:_0x5d9726,args:_0x207767,tdx:_0x13060c}=_0x3c3227,_0x3ec707=_0x5d9726;if(_0x207767[_0xa93c37(0x1bf)]===0x0)return console['error'](_0xa93c37(0x1ae)),console[_0xa93c37(0x1c4)](_0xa93c37(0x19b)),console['error'](_0xa93c37(0x1b2)),console[_0xa93c37(0x1c4)](_0xa93c37(0x1ca)),console['error']('\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x556a19=_0x207767[0x0],_0x122a32=_0x5d9726[_0xa93c37(0x1b3)];let _0x3452d5=_0x556a19;_0x122a32&&!_0x556a19[_0xa93c37(0x1c3)]('/')&&(_0x3452d5=_0x122a32+'/'+_0x556a19,_0x3ec707[_0xa93c37(0x1c6)]&&console[_0xa93c37(0x1c4)]('Resolved\x20relative\x20path\x20to:\x20'+_0x3452d5));const _0x3f074b=await withSpinner(_0xa93c37(0x1ac)+_0x3452d5+_0xa93c37(0x19f),()=>_0x13060c[_0xa93c37(0x19a)][_0xa93c37(0x1af)](_0x3452d5),{'verbose':_0x3ec707[_0xa93c37(0x1c6)]}),_0x643722=_0x3f074b[_0xa93c37(0x1cb)];_0x3ec707[_0xa93c37(0x1c6)]&&console['error'](_0xa93c37(0x1c1)+_0x643722[_0xa93c37(0x1ba)]);if(_0x643722[_0xa93c37(0x1ba)]!==_0xa93c37(0x19a))return console[_0xa93c37(0x1c4)](_0xa93c37(0x1b1)+_0x643722[_0xa93c37(0x1ba)]+'.\x20Only\x20child\x20segments\x20can\x20be\x20updated.'),console['error']('Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]'),0x1;if(!_0x643722[_0xa93c37(0x1b8)])throw new SDKError(ErrorCode[_0xa93c37(0x1a3)],_0xa93c37(0x1ab));const _0x1d46ca=_0x643722[_0xa93c37(0x1c0)],_0x5dcf86=_0x643722[_0xa93c37(0x1b8)];_0x3ec707[_0xa93c37(0x1c6)]&&(console[_0xa93c37(0x1c4)]('Parent\x20ID:\x20'+_0x1d46ca),console[_0xa93c37(0x1c4)](_0xa93c37(0x1bd)+_0x5dcf86));let _0x26e2b1;if(_0x3ec707[_0xa93c37(0x1a6)]){const _0x2ac7fc=_0x3ec707[_0xa93c37(0x1a6)],_0x511365=await withSpinner(_0xa93c37(0x1b6)+_0x2ac7fc+_0xa93c37(0x19f),()=>_0x13060c[_0xa93c37(0x19a)][_0xa93c37(0x19c)](_0x1d46ca,_0x2ac7fc),{'verbose':_0x3ec707['verbose']});_0x26e2b1=parseInt(_0x511365[_0xa93c37(0x1cb)],0xa),_0x3ec707[_0xa93c37(0x1c6)]&&console[_0xa93c37(0x1c4)](_0xa93c37(0x1b9)+_0x26e2b1);}const _0x2d1cc9=await loadJSONFromOptions(_0x3ec707[_0xa93c37(0x19d)],_0x3ec707['ruleFile']),_0xeedf3f={'name':_0x3ec707[_0xa93c37(0x1bb)],'description':_0x3ec707[_0xa93c37(0x1b7)],'rule':_0x2d1cc9,'kind':_0x3ec707[_0xa93c37(0x1a5)]!==undefined?parseInt(_0x3ec707[_0xa93c37(0x1a5)],0xa):undefined,'segmentFolderId':_0x26e2b1},_0x3c6b05=await withSpinner(_0xa93c37(0x1bc)+_0x643722[_0xa93c37(0x1a9)]+'\x27...',()=>_0x13060c['segment'][_0xa93c37(0x1c2)](_0x1d46ca,_0x5dcf86,_0xeedf3f),{'verbose':_0x3ec707[_0xa93c37(0x1c6)]}),_0x574786=_0x3c6b05[_0xa93c37(0x1cb)];return console[_0xa93c37(0x1c4)](_0xa93c37(0x1a1)+_0x574786['name']+'\x27'),_0x3452d5!==_0x556a19&&console[_0xa93c37(0x1c4)](_0xa93c37(0x1a8)+_0x3452d5),await handleSDKOutput([_0x574786],_0x3ec707),0x0;}}
|