@treasuredata/tdx 0.8.5 → 0.8.7
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.js +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 +1 -0
- 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/journey-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/journey.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/journey-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.d.ts.map +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/process.js.map +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 a32_0x3b9f40=a32_0x391d;(function(_0x2c6f29,_0x274ac8){const _0x155214=a32_0x391d,_0x547b7b=_0x2c6f29();while(!![]){try{const _0x311f4f=parseInt(_0x155214(0x1bd))/0x1*(parseInt(_0x155214(0x1c8))/0x2)+-parseInt(_0x155214(0x1d9))/0x3+parseInt(_0x155214(0x1db))/0x4+parseInt(_0x155214(0x1be))/0x5+-parseInt(_0x155214(0x1c4))/0x6*(-parseInt(_0x155214(0x1d1))/0x7)+-parseInt(_0x155214(0x1da))/0x8+-parseInt(_0x155214(0x1bc))/0x9*(-parseInt(_0x155214(0x1ab))/0xa);if(_0x311f4f===_0x274ac8)break;else _0x547b7b['push'](_0x547b7b['shift']());}catch(_0x5b97e5){_0x547b7b['push'](_0x547b7b['shift']());}}}(a32_0x4cc2,0x87540));import{BaseCommand}from'./command.js';function a32_0x391d(_0x5b3a52,_0x46c9f2){_0x5b3a52=_0x5b3a52-0x1a8;const _0x4cc2a7=a32_0x4cc2();let _0x391d11=_0x4cc2a7[_0x5b3a52];return _0x391d11;}import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../utils/segment-path-parser.js';import a32_0x13c691 from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']=a32_0x3b9f40(0x1d5);[a32_0x3b9f40(0x1dc)]='Create\x20child\x20segment\x20with\x20filtering\x20rules';async[a32_0x3b9f40(0x1c3)](_0x2fa631){const _0x534626=a32_0x3b9f40;console[_0x534626(0x1c6)](a32_0x13c691['yellow']('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x534626(0x1c6)](a32_0x13c691[_0x534626(0x1cb)](_0x534626(0x1b9)));const {options:_0x993faa,args:_0x9bc9a0,tdx:_0x341180}=_0x2fa631,_0x2ca7c6=_0x993faa;if(_0x9bc9a0[_0x534626(0x1b3)]===0x0)return console[_0x534626(0x1c6)](_0x534626(0x1cf)),console[_0x534626(0x1c6)]('Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'),console[_0x534626(0x1c6)](_0x534626(0x1cc)),console[_0x534626(0x1c6)](_0x534626(0x1af)),console['error'](_0x534626(0x1ce)),console[_0x534626(0x1c6)](_0x534626(0x1b5)),0x1;const _0x4cc4ef=_0x9bc9a0[0x0],_0x49d5e2=_0x993faa['segmentPath'];let _0x2aeaab=_0x4cc4ef;_0x49d5e2&&!_0x4cc4ef[_0x534626(0x1d3)]('/')&&(_0x2aeaab=_0x49d5e2+'/'+_0x4cc4ef,_0x2ca7c6['verbose']&&console[_0x534626(0x1c6)]('Resolved\x20relative\x20path\x20to:\x20'+_0x2aeaab));const _0x2bcd66=parsePath(_0x2aeaab);if(_0x2bcd66[_0x534626(0x1c7)][_0x534626(0x1b3)]<0x2)return console[_0x534626(0x1c6)]('Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)'),console[_0x534626(0x1c6)]('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x541ff0=_0x2bcd66['segments'][0x0],_0xbee0a7=getBaseName(_0x2aeaab),_0x510d03=getParentPath(_0x2aeaab);_0x2ca7c6['verbose']&&(console[_0x534626(0x1c6)](_0x534626(0x1c0)+_0x2ca7c6['site']),console[_0x534626(0x1c6)](_0x534626(0x1b8)+_0x2aeaab),console[_0x534626(0x1c6)](_0x534626(0x1a9)+_0x541ff0),console['error'](_0x534626(0x1bf)+_0xbee0a7),console['error'](_0x534626(0x1ad)+_0x510d03));const _0x480f2d=await withSpinner(_0x534626(0x1ae)+_0x541ff0+_0x534626(0x1ba),()=>_0x341180[_0x534626(0x1c1)][_0x534626(0x1b7)](_0x541ff0),{'verbose':_0x2ca7c6[_0x534626(0x1d6)]}),_0x2c2f5d=_0x480f2d[_0x534626(0x1d7)];let _0x2e4211;if(_0x2bcd66[_0x534626(0x1c7)][_0x534626(0x1b3)]>0x2){const _0x19b922=await withSpinner(_0x534626(0x1b2)+_0x510d03+_0x534626(0x1ba),()=>_0x341180['segment'][_0x534626(0x1bb)](_0x510d03),{'verbose':_0x2ca7c6['verbose']}),_0x947ef9=_0x19b922['data'];if(_0x947ef9['type']!==_0x534626(0x1aa)&&_0x947ef9[_0x534626(0x1d4)]!==_0x534626(0x1b1))return console['error'](_0x534626(0x1b0)),0x1;_0x2e4211=_0x947ef9[_0x534626(0x1ca)];}else{if(_0x2ca7c6[_0x534626(0x1aa)]){const _0x199d2f=await withSpinner(_0x534626(0x1cd)+_0x2ca7c6[_0x534626(0x1aa)]+_0x534626(0x1ba),()=>_0x341180['segment'][_0x534626(0x1b6)](_0x2c2f5d,_0x2ca7c6[_0x534626(0x1aa)]),{'verbose':_0x2ca7c6['verbose']});_0x2e4211=_0x199d2f[_0x534626(0x1d7)];}}_0x2ca7c6[_0x534626(0x1d6)]&&_0x2e4211&&console[_0x534626(0x1c6)]('Resolved\x20folder\x20ID:\x20'+_0x2e4211);const _0x49679a=await loadJSONFromOptions(_0x2ca7c6[_0x534626(0x1ac)],_0x2ca7c6[_0x534626(0x1c9)]),_0x28fc4c={'name':_0xbee0a7,'description':_0x2ca7c6[_0x534626(0x1dc)],'rule':_0x49679a,'kind':_0x2ca7c6[_0x534626(0x1c2)]!==undefined?parseInt(_0x2ca7c6[_0x534626(0x1c2)],0xa):undefined,'isVisible':_0x2ca7c6[_0x534626(0x1c5)]?![]:undefined,'segmentFolderId':_0x2e4211,'countPopulation':_0x2ca7c6[_0x534626(0x1d2)]?![]:undefined},_0x115143=await withSpinner('Creating\x20segment\x20\x27'+_0xbee0a7+_0x534626(0x1ba),()=>_0x341180[_0x534626(0x1c1)][_0x534626(0x1d0)](_0x2c2f5d,_0x28fc4c),{'verbose':_0x2ca7c6[_0x534626(0x1d6)]}),_0x4b2238=_0x115143[_0x534626(0x1d7)];return console[_0x534626(0x1c6)](_0x534626(0x1a8)+_0x4b2238[_0x534626(0x1b4)]+'\x27\x20with\x20ID:\x20'+_0x4b2238['id']),_0x2aeaab!==_0x4cc4ef&&console['error'](_0x534626(0x1d8)+_0x2aeaab),await handleSDKOutput([_0x4b2238],_0x2ca7c6),0x0;}}function a32_0x4cc2(){const _0x1e7e17=['Segment\x20name:\x20','Site:\x20','segment','kind','execute','5442VXRPkn','invisible','error','segments','2aLAHmL','ruleFile','folderId','yellow','Examples:','Resolving\x20folder\x20\x27','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','createSegment','1547YlFvDK','noCountPopulation','includes','type','segment:create','verbose','data','\x20\x20\x20Path:\x20','3191307NRHtGt','6551128omqBtg','3477088jQYUhR','description','✔\x20Created\x20segment\x20\x27','Parent:\x20','folder','80eokbLF','rule','Parent\x20path:\x20','Resolving\x20parent\x20segment\x20\x27','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','parent','Resolving\x20folder\x20path\x20\x27','length','name','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','resolveFolderId','resolveParentId','Target\x20path:\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','\x27...','resolvePathToResource','396009TRnmKr','123078OIqXCe','4460795yXihPJ'];a32_0x4cc2=function(){return _0x1e7e17;};return a32_0x4cc2();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a33_0x5ea83a=a33_0x38db;(function(_0x31bd8c,_0x126a44){const _0x29fca9=a33_0x38db,_0x3a402f=_0x31bd8c();while(!![]){try{const _0x4b0566=-parseInt(_0x29fca9(0x1db))/0x1+-parseInt(_0x29fca9(0x1d7))/0x2*(-parseInt(_0x29fca9(0x1d6))/0x3)+-parseInt(_0x29fca9(0x1e5))/0x4*(-parseInt(_0x29fca9(0x1d5))/0x5)+parseInt(_0x29fca9(0x1e6))/0x6+parseInt(_0x29fca9(0x1e3))/0x7+-parseInt(_0x29fca9(0x1d4))/0x8*(parseInt(_0x29fca9(0x1e2))/0x9)+parseInt(_0x29fca9(0x1e7))/0xa*(parseInt(_0x29fca9(0x1d9))/0xb);if(_0x4b0566===_0x126a44)break;else _0x3a402f['push'](_0x3a402f['shift']());}catch(_0x9c19ce){_0x3a402f['push'](_0x3a402f['shift']());}}}(a33_0x6251,0x81259));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';function a33_0x6251(){const _0x118644=['\x27...','name','listFields','segment:fields','error','description','1054712cpFeau','250NfnZdI','56274jOatAj','10csXxUq','parentSegment','4653umAxPc','jsonl','527006YUPVeq','Error:\x20Parent\x20segment\x20name\x20is\x20required','Site:\x20','length','data','verbose','\x20field','45EKaqMz','2278255YAoyjU','site','45996nRyYoy','422442qZCXJm','15380MVndin','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','segment','✔\x20Found\x20'];a33_0x6251=function(){return _0x118644;};return a33_0x6251();}import{withSpinner}from'../utils/spinner.js';function a33_0x38db(_0x162974,_0x2df9d3){_0x162974=_0x162974-0x1cd;const _0x62514d=a33_0x6251();let _0x38db60=_0x62514d[_0x162974];return _0x38db60;}import{displayFieldsHumanReadable}from'../utils/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a33_0x5ea83a(0x1cf)]=a33_0x5ea83a(0x1d1);[a33_0x5ea83a(0x1d3)]='List\x20available\x20fields\x20for\x20segmentation';async['execute'](_0x153999){const _0x474a58=a33_0x5ea83a,{options:_0x484062,args:_0x42fae1,tdx:_0x5e73a7}=_0x153999,_0x5c9040=_0x42fae1[0x0]||_0x484062[_0x474a58(0x1d8)];if(!_0x5c9040)return console[_0x474a58(0x1d2)](_0x474a58(0x1dc)),console[_0x474a58(0x1d2)](_0x474a58(0x1e8)),console['error']('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;_0x484062[_0x474a58(0x1e0)]&&(console['error'](_0x474a58(0x1dd)+_0x484062[_0x474a58(0x1e4)]),console['error']('Parent\x20segment:\x20'+_0x5c9040));const _0x572bc4=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x5c9040+_0x474a58(0x1ce),()=>_0x5e73a7[_0x474a58(0x1e9)][_0x474a58(0x1d0)](_0x5c9040),{'verbose':_0x484062[_0x474a58(0x1e0)]}),_0x2764d2=_0x572bc4[_0x474a58(0x1df)];console[_0x474a58(0x1d2)](_0x474a58(0x1cd)+_0x2764d2[_0x474a58(0x1de)]+_0x474a58(0x1e1)+(_0x2764d2['length']!==0x1?'s':''));if(_0x484062['json']||_0x484062[_0x474a58(0x1da)])return await handleSDKOutput(_0x2764d2,_0x484062),0x0;return displayFieldsHumanReadable(_0x2764d2,_0x5c9040),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a34_0x2dc722=a34_0x1bf6;(function(_0x2def0c,_0x4d6509){const _0x6b1819=a34_0x1bf6,_0x53bcc0=_0x2def0c();while(!![]){try{const _0x5cbb88=-parseInt(_0x6b1819(0x115))/0x1*(parseInt(_0x6b1819(0x108))/0x2)+parseInt(_0x6b1819(0xf8))/0x3*(-parseInt(_0x6b1819(0xd3))/0x4)+parseInt(_0x6b1819(0x101))/0x5+-parseInt(_0x6b1819(0x119))/0x6*(parseInt(_0x6b1819(0xd7))/0x7)+-parseInt(_0x6b1819(0x111))/0x8+-parseInt(_0x6b1819(0xfc))/0x9*(-parseInt(_0x6b1819(0xca))/0xa)+parseInt(_0x6b1819(0xd2))/0xb;if(_0x5cbb88===_0x4d6509)break;else _0x53bcc0['push'](_0x53bcc0['shift']());}catch(_0x1acaa7){_0x53bcc0['push'](_0x53bcc0['shift']());}}}(a34_0x310c,0x6edf9));import{BaseCommand}from'./command.js';import{withSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';function a34_0x1bf6(_0x2972c0,_0x1b1641){_0x2972c0=_0x2972c0-0xc6;const _0x310c19=a34_0x310c();let _0x1bf6ec=_0x310c19[_0x2972c0];return _0x1bf6ec;}import{batchAsync}from'../utils/async.js';import{getSegmentRootDir,createTdxConfigContent,findTdxConfigPath,loadTdxConfig}from'../utils/tdx-config.js';import{saveSessionContext}from'../core/session.js';import{segmentWithActivationsToYaml,segmentToYamlString}from'../sdk/segment/child-segment-yaml.js';import a34_0x442fa3 from'chalk';function a34_0x310c(){const _0x2628c8=['parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','set','Parent\x20segment:\x20','parentFolderId','1158000PgDGyE','name','description','Fetching\x20parent\x20segment\x20info...','48791dAYHNu','values','getParent','segment','213834YckJGg','segment:pull','connection','\x20new\x20files','red','length','Found\x20tdx.json\x20at:\x20','green','Fetching\x20folders...','.yml','164030glYHsX','Fetching\x20segments...','\x20files?','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','\x20unchanged\x20files','then','segmentFolderId','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','25222010TywxdV','28vlwRFA','isNew','\x0aChanges\x20to\x20\x27','diff','14yljfuf','has','Using\x20parent\x20segment:\x20','Site:\x20','Resolving\x20parent\x20segment\x20\x27','listFolders','isDirectory','error','site','verbose','push','yellow','dim','user','Aborted.','listSegments','get','✔\x20Context\x20set:\x20','\x0aPull\x20summary\x20for\x20\x27','dirname','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','Fetching\x20activations...','Pull\x20child\x20segments\x20to\x20YAML\x20files','attributes','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Found\x20existing\x20tdx.json\x20at:\x20','data','relativePath','hasChanges','cyan','buildIdToEmailMap','join','\x20files\x20to\x20','372939EhiMTh','Resolved\x20parent\x20name:\x20','\x20with\x20','parent_segment','9rjkxgs','Write\x20','relative','add','Fetching\x20users\x20for\x20email\x20resolution...','302450WcffCm','\x20segments','repeat','filter','resolveParentId','\x20=\x20','\x20changed\x20files','34LwUbNH','utf-8','yes','from','✔\x20All\x20files\x20are\x20up\x20to\x20date'];a34_0x310c=function(){return _0x2628c8;};return a34_0x310c();}import{existsSync,mkdirSync,readFileSync,writeFileSync,statSync}from'fs';import a34_0x3170b9 from'path';import{sanitizeFileName}from'../utils/string-utils.js';export class SegmentPullCommand extends BaseCommand{[a34_0x2dc722(0x112)]=a34_0x2dc722(0x11a);[a34_0x2dc722(0x113)]=a34_0x2dc722(0xed);async['execute'](_0x3f482d){const _0x2d69c8=a34_0x2dc722,{options:_0x255eda,args:_0x2dccab,tdx:_0x31ca33}=_0x3f482d,_0x4024e4=_0x255eda,_0xb5fab1=_0x255eda['parentSegment'],_0x41fe64=_0x2dccab[0x0],_0x3de5e8=findTdxConfigPath();let _0x5444b4,_0x4aa94d;if(!_0x41fe64&&_0x3de5e8){const _0x2b8846=loadTdxConfig(_0x3de5e8);_0x5444b4=_0x2b8846[_0x2d69c8(0xfb)],_0x4aa94d=a34_0x3170b9['dirname'](_0x3de5e8),_0x4024e4[_0x2d69c8(0xe0)]&&(console[_0x2d69c8(0xde)](_0x2d69c8(0xf0)+_0x3de5e8),console['error'](_0x2d69c8(0xd9)+_0x5444b4));}else{if(_0x41fe64){if(existsSync(_0x41fe64)&&statSync(_0x41fe64)[_0x2d69c8(0xdd)]()){const _0x4e0164=findTdxConfigPath(_0x41fe64);if(_0x4e0164){const _0x2db533=loadTdxConfig(_0x4e0164);_0x5444b4=_0x2db533[_0x2d69c8(0xfb)],_0x4aa94d=a34_0x3170b9[_0x2d69c8(0xea)](_0x4e0164),_0x4024e4[_0x2d69c8(0xe0)]&&(console[_0x2d69c8(0xde)](_0x2d69c8(0xc6)+_0x4e0164),console[_0x2d69c8(0xde)]('Using\x20parent\x20segment:\x20'+_0x5444b4));}else return console['error'](a34_0x442fa3[_0x2d69c8(0x11d)](_0x2d69c8(0xeb)+_0x41fe64+'\x0a')),console['error'](a34_0x442fa3[_0x2d69c8(0xf4)](_0x2d69c8(0xef))),0x1;}else _0x5444b4=_0x41fe64;}else _0x5444b4=_0xb5fab1;}if(!_0x5444b4)return console[_0x2d69c8(0xde)](a34_0x442fa3[_0x2d69c8(0xe2)](_0x2d69c8(0x10d))),console[_0x2d69c8(0xde)]('Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)'),console[_0x2d69c8(0xde)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent'),console[_0x2d69c8(0xde)](_0x2d69c8(0xcd)),0x1;_0x4024e4[_0x2d69c8(0xe0)]&&(console[_0x2d69c8(0xde)](_0x2d69c8(0xda)+_0x4024e4[_0x2d69c8(0xdf)]),console[_0x2d69c8(0xde)](_0x2d69c8(0x10f)+_0x5444b4));const _0x42fe74=await withSpinner(_0x2d69c8(0xdb)+_0x5444b4+'\x27...',()=>_0x31ca33['segment'][_0x2d69c8(0x105)](_0x5444b4),{'verbose':_0x4024e4['verbose']}),_0xc423a=_0x42fe74[_0x2d69c8(0xf1)],_0x43e3c1=await withSpinner(_0x2d69c8(0x114),()=>_0x31ca33[_0x2d69c8(0x118)][_0x2d69c8(0x117)](_0xc423a),{'verbose':_0x4024e4[_0x2d69c8(0xe0)]}),_0x4028f3=_0x43e3c1[_0x2d69c8(0xf1)][_0x2d69c8(0xee)]['name'];_0x4024e4[_0x2d69c8(0xe0)]&&console[_0x2d69c8(0xde)](_0x2d69c8(0xf9)+_0x4028f3);const [_0x330fee,_0xf9211f]=await Promise['all']([withSpinner(_0x2d69c8(0xcb),()=>_0x31ca33[_0x2d69c8(0x118)][_0x2d69c8(0xe6)](_0xc423a),{'verbose':_0x4024e4[_0x2d69c8(0xe0)]}),withSpinner(_0x2d69c8(0xc8),()=>_0x31ca33[_0x2d69c8(0x118)][_0x2d69c8(0xdc)](_0xc423a),{'verbose':_0x4024e4[_0x2d69c8(0xe0)]})]),_0x5a5135=_0x330fee[_0x2d69c8(0xf1)],_0xc2620=_0xf9211f[_0x2d69c8(0xf1)];if(_0x5a5135[_0x2d69c8(0x11e)]===0x0)return console['error'](a34_0x442fa3['yellow']('No\x20segments\x20found\x20in\x20parent\x20segment\x20\x27'+_0x4028f3+'\x27')),0x0;const _0x5b5f6e=buildFolderPathMap(_0xc2620),_0x403836=_0x4aa94d||getSegmentRootDir(sanitizeFileName(_0x5444b4)),_0xcc0f9a=new Map();await withSpinner(_0x2d69c8(0xec),async()=>{await batchAsync(_0x5a5135,async _0x41badf=>{const _0x4429ee=a34_0x1bf6,_0x28ecbd=await _0x31ca33[_0x4429ee(0x118)]['listActivations'](_0xc423a,_0x41badf['id']);_0xcc0f9a['set'](_0x41badf['id'],_0x28ecbd);});},{'verbose':_0x4024e4[_0x2d69c8(0xe0)]});const _0x3dafbf=await withSpinner(_0x2d69c8(0x100),()=>_0x31ca33[_0x2d69c8(0xe4)][_0x2d69c8(0xf5)](),{'verbose':_0x4024e4[_0x2d69c8(0xe0)]})[_0x2d69c8(0xcf)](_0x2e3eed=>_0x2e3eed[_0x2d69c8(0xf1)]),_0x27835d=await withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',()=>_0x31ca33[_0x2d69c8(0x11b)]['buildIdToNameMap'](),{'verbose':_0x4024e4[_0x2d69c8(0xe0)]})[_0x2d69c8(0xcf)](_0x1b80c0=>_0x1b80c0[_0x2d69c8(0xf1)]),_0x3d8797=[],_0x3b036b=a34_0x3170b9[_0x2d69c8(0xf6)](_0x403836,'tdx.json'),_0x368b09=createTdxConfigContent(_0x4028f3);_0x3d8797[_0x2d69c8(0xe1)](prepareFile(_0x3b036b,_0x368b09,_0x403836));const _0x168102=new Map();for(const _0x28efc4 of _0x5a5135){const _0x2710d4=_0x28efc4[_0x2d69c8(0xd0)]?_0x5b5f6e['get'](_0x28efc4[_0x2d69c8(0xd0)])||'':'',_0x4646d5=_0xcc0f9a[_0x2d69c8(0xe7)](_0x28efc4['id'])||[],_0x670975=segmentWithActivationsToYaml(_0x28efc4,_0x4646d5,undefined,_0x3dafbf,_0x27835d),_0x3c8d8f=_0x2710d4?a34_0x3170b9[_0x2d69c8(0xf6)](_0x403836,_0x2710d4):_0x403836,_0x442d9c=sanitizeFileName(_0x28efc4['name']),_0x3bf1b1=getUniqueFileName(_0x3c8d8f,_0x442d9c,_0x168102),_0xddf23f=a34_0x3170b9['join'](_0x3c8d8f,_0x3bf1b1+_0x2d69c8(0xc9)),_0x12ad87=segmentToYamlString(_0x670975);_0x3d8797[_0x2d69c8(0xe1)](prepareFile(_0xddf23f,_0x12ad87,_0x403836));}const _0x1781c6=Array[_0x2d69c8(0x10b)](_0xcc0f9a[_0x2d69c8(0x116)]())['reduce']((_0x4fce8a,_0xfca90b)=>_0x4fce8a+_0xfca90b[_0x2d69c8(0x11e)],0x0),_0x4a942e=_0x3d8797[_0x2d69c8(0x104)](_0x554f16=>_0x554f16[_0x2d69c8(0xd4)]),_0x374a61=_0x3d8797['filter'](_0x389e09=>!_0x389e09[_0x2d69c8(0xd4)]&&_0x389e09[_0x2d69c8(0xf3)]),_0x24f86a=_0x3d8797[_0x2d69c8(0x104)](_0x3dcdfc=>!_0x3dcdfc['isNew']&&!_0x3dcdfc[_0x2d69c8(0xf3)]);console[_0x2d69c8(0xde)](_0x2d69c8(0xe9)+_0x4028f3+'\x27:'),console[_0x2d69c8(0xde)]('\x20\x20'+a34_0x442fa3['cyan'](_0x5a5135[_0x2d69c8(0x11e)]+_0x2d69c8(0x102))+_0x2d69c8(0xfa)+a34_0x442fa3[_0x2d69c8(0xf4)](_0x1781c6+'\x20activations')),console[_0x2d69c8(0xde)]('\x20\x20'+a34_0x442fa3[_0x2d69c8(0xc7)]('+\x20'+_0x4a942e[_0x2d69c8(0x11e)]+_0x2d69c8(0x11c))),console['error']('\x20\x20'+a34_0x442fa3[_0x2d69c8(0xe2)]('~\x20'+_0x374a61[_0x2d69c8(0x11e)]+_0x2d69c8(0x107))),console['error']('\x20\x20'+a34_0x442fa3[_0x2d69c8(0xe3)]('=\x20'+_0x24f86a[_0x2d69c8(0x11e)]+_0x2d69c8(0xce))),console[_0x2d69c8(0xde)]('\x20\x20Target:\x20'+a34_0x442fa3[_0x2d69c8(0xf4)](_0x403836)+'\x0a');if(_0x374a61['length']>0x0)for(const _0x15dd8f of _0x374a61){console[_0x2d69c8(0xde)](_0x2d69c8(0xd5)+_0x15dd8f[_0x2d69c8(0xf2)]+'\x27:'),console[_0x2d69c8(0xde)]('─'['repeat'](0x3c)),console[_0x2d69c8(0xde)](_0x15dd8f[_0x2d69c8(0xd6)]),console[_0x2d69c8(0xde)]('─'[_0x2d69c8(0x103)](0x3c));}if(_0x4024e4['dryRun'])return console[_0x2d69c8(0xde)](a34_0x442fa3['yellow'](_0x2d69c8(0xd1))),0x0;if(_0x4a942e[_0x2d69c8(0x11e)]===0x0&&_0x374a61[_0x2d69c8(0x11e)]===0x0)return console[_0x2d69c8(0xde)](a34_0x442fa3[_0x2d69c8(0xc7)](_0x2d69c8(0x10c))),saveSessionContext({'parent_segment':_0x4028f3},_0x4024e4['session']),console[_0x2d69c8(0xde)](a34_0x442fa3[_0x2d69c8(0xc7)](_0x2d69c8(0xe8)+a34_0x442fa3[_0x2d69c8(0xe3)]('parent_segment')+_0x2d69c8(0x106)+a34_0x442fa3[_0x2d69c8(0xf4)](_0x4028f3))),0x0;if(!_0x4024e4[_0x2d69c8(0x10a)]&&(_0x4a942e[_0x2d69c8(0x11e)]>0x0||_0x374a61[_0x2d69c8(0x11e)]>0x0)){const _0x89581e=await confirmKey(_0x2d69c8(0xfd)+(_0x4a942e['length']+_0x374a61[_0x2d69c8(0x11e)])+_0x2d69c8(0xcc));if(!_0x89581e)return console[_0x2d69c8(0xde)](_0x2d69c8(0xe5)),0x1;}for(const _0x13a6a0 of _0x3d8797){if(_0x13a6a0[_0x2d69c8(0xd4)]||_0x13a6a0[_0x2d69c8(0xf3)]){const _0x2815d6=a34_0x3170b9[_0x2d69c8(0xea)](_0x13a6a0['absolutePath']);!existsSync(_0x2815d6)&&mkdirSync(_0x2815d6,{'recursive':!![]}),writeFileSync(_0x13a6a0['absolutePath'],_0x13a6a0['content'],_0x2d69c8(0x109));}}return console['error'](a34_0x442fa3[_0x2d69c8(0xc7)]('✔\x20Pulled\x20'+(_0x4a942e[_0x2d69c8(0x11e)]+_0x374a61[_0x2d69c8(0x11e)])+_0x2d69c8(0xf7)+_0x403836)),saveSessionContext({'parent_segment':_0x4028f3},_0x4024e4['session']),console[_0x2d69c8(0xde)](a34_0x442fa3['green'](_0x2d69c8(0xe8)+a34_0x442fa3['dim'](_0x2d69c8(0xfb))+'\x20=\x20'+a34_0x442fa3[_0x2d69c8(0xf4)](_0x4028f3))),0x0;}}function buildFolderPathMap(_0x7ec5f4){const _0x3855cd=a34_0x2dc722,_0x11ff4c=new Map(),_0x2d49b9=new Map();for(const _0x2f0cba of _0x7ec5f4){_0x2d49b9[_0x3855cd(0x10e)](_0x2f0cba['id'],_0x2f0cba);}const _0x30079d=new Set();for(const _0x1b8957 of _0x7ec5f4){!_0x1b8957['parentFolderId']&&_0x30079d[_0x3855cd(0xff)](_0x1b8957['id']);}function _0x12adcd(_0x513141){const _0x10b4d3=_0x3855cd;if(_0x11ff4c[_0x10b4d3(0xd8)](_0x513141['id']))return _0x11ff4c[_0x10b4d3(0xe7)](_0x513141['id']);if(_0x30079d[_0x10b4d3(0xd8)](_0x513141['id']))return _0x11ff4c[_0x10b4d3(0x10e)](_0x513141['id'],''),'';if(_0x513141['parentFolderId']){const _0xb26e66=_0x2d49b9['get'](_0x513141[_0x10b4d3(0x110)]);if(_0xb26e66){const _0x424924=_0x12adcd(_0xb26e66),_0x1b38e7=_0x424924?_0x424924+'/'+_0x513141['name']:_0x513141[_0x10b4d3(0x112)];return _0x11ff4c[_0x10b4d3(0x10e)](_0x513141['id'],_0x1b38e7),_0x1b38e7;}}const _0x34c913=_0x513141[_0x10b4d3(0x112)];return _0x11ff4c[_0x10b4d3(0x10e)](_0x513141['id'],_0x34c913),_0x34c913;}for(const _0xb25dbc of _0x7ec5f4){_0x12adcd(_0xb25dbc);}return _0x11ff4c;}function getUniqueFileName(_0x494c46,_0x435093,_0x52b092){const _0x578fb1=a34_0x2dc722,_0x51fe51=_0x494c46+':'+_0x435093,_0x1d1e19=_0x52b092['get'](_0x51fe51)||0x0;_0x52b092[_0x578fb1(0x10e)](_0x51fe51,_0x1d1e19+0x1);if(_0x1d1e19===0x0)return _0x435093;return _0x435093+'-'+_0x1d1e19;}function prepareFile(_0x184831,_0x336ebb,_0x3c774a){const _0x152d30=a34_0x2dc722,_0x1bc77c=a34_0x3170b9[_0x152d30(0xfe)](_0x3c774a,_0x184831);if(existsSync(_0x184831)){const _0x344998=readFileSync(_0x184831,_0x152d30(0x109)),_0x41590d=generateDiff(_0x344998,_0x336ebb),_0x3931dc=hasChanges(_0x41590d);return{'relativePath':_0x1bc77c,'absolutePath':_0x184831,'content':_0x336ebb,'isNew':![],'hasChanges':_0x3931dc,'diff':_0x3931dc?formatDiffWithColors(_0x41590d):undefined};}return{'relativePath':_0x1bc77c,'absolutePath':_0x184831,'content':_0x336ebb,'isNew':!![],'hasChanges':![]};}
|
|
1
|
+
const a34_0x3b65a9=a34_0x2456;(function(_0x50e640,_0x1b21b0){const _0x1707d6=a34_0x2456,_0x3b9e4c=_0x50e640();while(!![]){try{const _0x20fd94=-parseInt(_0x1707d6(0x7f))/0x1+-parseInt(_0x1707d6(0xbb))/0x2*(-parseInt(_0x1707d6(0x6f))/0x3)+parseInt(_0x1707d6(0xa5))/0x4*(parseInt(_0x1707d6(0x76))/0x5)+parseInt(_0x1707d6(0xa8))/0x6*(-parseInt(_0x1707d6(0xbc))/0x7)+-parseInt(_0x1707d6(0x89))/0x8*(-parseInt(_0x1707d6(0x75))/0x9)+-parseInt(_0x1707d6(0x9a))/0xa*(-parseInt(_0x1707d6(0xab))/0xb)+parseInt(_0x1707d6(0x73))/0xc*(parseInt(_0x1707d6(0xa3))/0xd);if(_0x20fd94===_0x1b21b0)break;else _0x3b9e4c['push'](_0x3b9e4c['shift']());}catch(_0x3d27cd){_0x3b9e4c['push'](_0x3b9e4c['shift']());}}}(a34_0x25cb,0x81553));import{BaseCommand}from'./command.js';import{withSpinner}from'../utils/spinner.js';function a34_0x25cb(){const _0x306f0d=['yellow','green','\x20\x20Target:\x20','✔\x20Pulled\x20','has','utf-8','Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)','attributes','26bHSyEb','user','3151348cbEAVz','data','\x20files\x20to\x20','620754flAsWN','Found\x20existing\x20tdx.json\x20at:\x20','Fetching\x20users\x20for\x20email\x20resolution...','11oUhLvU','parent_segment','dirname','\x0aPull\x20summary\x20for\x20\x27','length','verbose','Resolved\x20parent\x20name:\x20','set','Fetching\x20activations...','\x20files?','absolutePath','\x0aChanges\x20to\x20\x27','dim','red','values','repeat','202lShHdY','49mFlqtQ','segment','cyan','tdx.json','join','Using\x20parent\x20segment:\x20','listFolders','\x27...','Aborted.','yes','listActivations','12309aBkeXe','site','get','resolveParentId','2334504YMnfcy','✔\x20Context\x20set:\x20','1107BgZQgH','5zixSgR','Fetching\x20connections\x20for\x20name\x20resolution...','listSegments','\x20new\x20files','reduce','Write\x20','execute','✔\x20All\x20files\x20are\x20up\x20to\x20date','Pull\x20child\x20segments\x20to\x20YAML\x20files','967266oBVofI','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','description','getParent','then','all','filter','parentFolderId','buildIdToEmailMap','name','33544igOFFE','\x20activations','\x20=\x20','add','error','Fetching\x20parent\x20segment\x20info...','from','Fetching\x20segments...','hasChanges','\x20changed\x20files','diff','Fetching\x20folders...','isNew','parentSegment','segmentFolderId','\x20segments','segment:pull','1141630AvVYkz'];a34_0x25cb=function(){return _0x306f0d;};return a34_0x25cb();}import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{getSegmentRootDir,createTdxConfigContent,findTdxConfigPath,loadTdxConfig}from'../utils/tdx-config.js';import{saveSessionContext}from'../core/session.js';function a34_0x2456(_0x52c06e,_0x43bef9){_0x52c06e=_0x52c06e-0x69;const _0x25cb34=a34_0x25cb();let _0x24565a=_0x25cb34[_0x52c06e];return _0x24565a;}import{segmentWithActivationsToYaml,segmentToYamlString}from'../sdk/segment/child-segment-yaml.js';import a34_0x2a0149 from'chalk';import{existsSync,mkdirSync,readFileSync,writeFileSync,statSync}from'fs';import a34_0x2c162a from'path';import{sanitizeFileName}from'../utils/string-utils.js';export class SegmentPullCommand extends BaseCommand{[a34_0x3b65a9(0x88)]=a34_0x3b65a9(0x99);[a34_0x3b65a9(0x81)]=a34_0x3b65a9(0x7e);async[a34_0x3b65a9(0x7c)](_0x28612a){const _0x1a6909=a34_0x3b65a9,{options:_0x50e448,args:_0x524776,tdx:_0x5ad451}=_0x28612a,_0x14e67b=_0x50e448,_0xb3c61b=_0x50e448[_0x1a6909(0x96)],_0x493726=_0x524776[0x0],_0x3289cc=findTdxConfigPath();let _0x12e20b,_0x56dde8;if(!_0x493726&&_0x3289cc){const _0x5024c5=loadTdxConfig(_0x3289cc);_0x12e20b=_0x5024c5[_0x1a6909(0xac)],_0x56dde8=a34_0x2c162a[_0x1a6909(0xad)](_0x3289cc),_0x14e67b['verbose']&&(console[_0x1a6909(0x8d)](_0x1a6909(0xa9)+_0x3289cc),console[_0x1a6909(0x8d)](_0x1a6909(0x69)+_0x12e20b));}else{if(_0x493726){if(existsSync(_0x493726)&&statSync(_0x493726)['isDirectory']()){const _0x3e7ac3=findTdxConfigPath(_0x493726);if(_0x3e7ac3){const _0x4b0bb6=loadTdxConfig(_0x3e7ac3);_0x12e20b=_0x4b0bb6[_0x1a6909(0xac)],_0x56dde8=a34_0x2c162a['dirname'](_0x3e7ac3),_0x14e67b[_0x1a6909(0xb0)]&&(console['error']('Found\x20tdx.json\x20at:\x20'+_0x3e7ac3),console[_0x1a6909(0x8d)](_0x1a6909(0x69)+_0x12e20b));}else return console[_0x1a6909(0x8d)](a34_0x2a0149[_0x1a6909(0xb8)]('Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20'+_0x493726+'\x0a')),console[_0x1a6909(0x8d)](a34_0x2a0149[_0x1a6909(0xbe)](_0x1a6909(0x80))),0x1;}else _0x12e20b=_0x493726;}else _0x12e20b=_0xb3c61b;}if(!_0x12e20b)return console[_0x1a6909(0x8d)](a34_0x2a0149['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x1a6909(0x8d)](_0x1a6909(0xa1)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent'),console[_0x1a6909(0x8d)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file'),0x1;_0x14e67b['verbose']&&(console[_0x1a6909(0x8d)]('Site:\x20'+_0x14e67b[_0x1a6909(0x70)]),console[_0x1a6909(0x8d)]('Parent\x20segment:\x20'+_0x12e20b));const _0x2e0543=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x12e20b+_0x1a6909(0x6b),()=>_0x5ad451[_0x1a6909(0xbd)][_0x1a6909(0x72)](_0x12e20b),{'verbose':_0x14e67b['verbose']}),_0x486575=_0x2e0543[_0x1a6909(0xa6)],_0x48a853=await withSpinner(_0x1a6909(0x8e),()=>_0x5ad451['segment'][_0x1a6909(0x82)](_0x486575),{'verbose':_0x14e67b['verbose']}),_0x93bef4=_0x48a853['data'][_0x1a6909(0xa2)][_0x1a6909(0x88)];_0x14e67b[_0x1a6909(0xb0)]&&console[_0x1a6909(0x8d)](_0x1a6909(0xb1)+_0x93bef4);const [_0x561130,_0xa188d0]=await Promise[_0x1a6909(0x84)]([withSpinner(_0x1a6909(0x90),()=>_0x5ad451['segment'][_0x1a6909(0x78)](_0x486575),{'verbose':_0x14e67b[_0x1a6909(0xb0)]}),withSpinner(_0x1a6909(0x94),()=>_0x5ad451[_0x1a6909(0xbd)][_0x1a6909(0x6a)](_0x486575),{'verbose':_0x14e67b['verbose']})]),_0x3b4c95=_0x561130['data'],_0x84144c=_0xa188d0[_0x1a6909(0xa6)];if(_0x3b4c95['length']===0x0)return console[_0x1a6909(0x8d)](a34_0x2a0149[_0x1a6909(0x9b)]('No\x20segments\x20found\x20in\x20parent\x20segment\x20\x27'+_0x93bef4+'\x27')),0x0;const _0x269ab8=buildFolderPathMap(_0x84144c),_0x47deba=_0x56dde8||getSegmentRootDir(sanitizeFileName(_0x12e20b)),_0x58eb24=new Map();await withSpinner(_0x1a6909(0xb3),async()=>{await batchAsync(_0x3b4c95,async _0x2ef2c6=>{const _0x4f3981=a34_0x2456,_0x3f628b=await _0x5ad451[_0x4f3981(0xbd)][_0x4f3981(0x6e)](_0x486575,_0x2ef2c6['id']);_0x58eb24['set'](_0x2ef2c6['id'],_0x3f628b);});},{'verbose':_0x14e67b[_0x1a6909(0xb0)]});const _0x556e2f=await withSpinner(_0x1a6909(0xaa),()=>_0x5ad451[_0x1a6909(0xa4)][_0x1a6909(0x87)](),{'verbose':_0x14e67b[_0x1a6909(0xb0)]})[_0x1a6909(0x83)](_0x11554e=>_0x11554e['data']),_0x3e30d8=await withSpinner(_0x1a6909(0x77),()=>_0x5ad451['connection']['buildIdToNameMap'](),{'verbose':_0x14e67b[_0x1a6909(0xb0)]})[_0x1a6909(0x83)](_0x31a00f=>_0x31a00f['data']),_0x532402=[],_0x4f98a8=a34_0x2c162a[_0x1a6909(0xc0)](_0x47deba,_0x1a6909(0xbf)),_0xe85cf0=createTdxConfigContent(_0x93bef4);_0x532402['push'](prepareFile(_0x4f98a8,_0xe85cf0,_0x47deba));const _0x1faca5=new Map();for(const _0x2e7f0e of _0x3b4c95){const _0x3a2589=_0x2e7f0e[_0x1a6909(0x97)]?_0x269ab8[_0x1a6909(0x71)](_0x2e7f0e[_0x1a6909(0x97)])||'':'',_0x75e6aa=_0x58eb24[_0x1a6909(0x71)](_0x2e7f0e['id'])||[],_0x2f4417=segmentWithActivationsToYaml(_0x2e7f0e,_0x75e6aa,undefined,_0x556e2f,_0x3e30d8),_0x22ebd2=_0x3a2589?a34_0x2c162a[_0x1a6909(0xc0)](_0x47deba,_0x3a2589):_0x47deba,_0x568166=sanitizeFileName(_0x2e7f0e[_0x1a6909(0x88)]),_0x5b7d23=getUniqueFileName(_0x22ebd2,_0x568166,_0x1faca5),_0x2a708f=a34_0x2c162a[_0x1a6909(0xc0)](_0x22ebd2,_0x5b7d23+'.yml'),_0x5162c0=segmentToYamlString(_0x2f4417);_0x532402['push'](prepareFile(_0x2a708f,_0x5162c0,_0x47deba));}const _0x559cdf=Array[_0x1a6909(0x8f)](_0x58eb24[_0x1a6909(0xb9)]())[_0x1a6909(0x7a)]((_0x1cdd68,_0x541013)=>_0x1cdd68+_0x541013[_0x1a6909(0xaf)],0x0),_0x458660=_0x532402[_0x1a6909(0x85)](_0x48966b=>_0x48966b[_0x1a6909(0x95)]),_0x120fc9=_0x532402[_0x1a6909(0x85)](_0x3f9cfc=>!_0x3f9cfc[_0x1a6909(0x95)]&&_0x3f9cfc['hasChanges']),_0x227545=_0x532402['filter'](_0x1bfa72=>!_0x1bfa72[_0x1a6909(0x95)]&&!_0x1bfa72[_0x1a6909(0x91)]);console['error'](_0x1a6909(0xae)+_0x93bef4+'\x27:'),console['error']('\x20\x20'+a34_0x2a0149['cyan'](_0x3b4c95[_0x1a6909(0xaf)]+_0x1a6909(0x98))+'\x20with\x20'+a34_0x2a0149[_0x1a6909(0xbe)](_0x559cdf+_0x1a6909(0x8a))),console[_0x1a6909(0x8d)]('\x20\x20'+a34_0x2a0149['green']('+\x20'+_0x458660[_0x1a6909(0xaf)]+_0x1a6909(0x79))),console[_0x1a6909(0x8d)]('\x20\x20'+a34_0x2a0149[_0x1a6909(0x9b)]('~\x20'+_0x120fc9[_0x1a6909(0xaf)]+_0x1a6909(0x92))),console[_0x1a6909(0x8d)]('\x20\x20'+a34_0x2a0149['dim']('=\x20'+_0x227545[_0x1a6909(0xaf)]+'\x20unchanged\x20files')),console[_0x1a6909(0x8d)](_0x1a6909(0x9d)+a34_0x2a0149[_0x1a6909(0xbe)](_0x47deba)+'\x0a');if(_0x120fc9[_0x1a6909(0xaf)]>0x0)for(const _0x50247c of _0x120fc9){console[_0x1a6909(0x8d)](_0x1a6909(0xb6)+_0x50247c['relativePath']+'\x27:'),console[_0x1a6909(0x8d)]('─'[_0x1a6909(0xba)](0x3c)),console[_0x1a6909(0x8d)](_0x50247c[_0x1a6909(0x93)]),console['error']('─'['repeat'](0x3c));}if(_0x14e67b['dryRun'])return console[_0x1a6909(0x8d)](a34_0x2a0149[_0x1a6909(0x9b)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x458660[_0x1a6909(0xaf)]===0x0&&_0x120fc9[_0x1a6909(0xaf)]===0x0)return console[_0x1a6909(0x8d)](a34_0x2a0149[_0x1a6909(0x9c)](_0x1a6909(0x7d))),saveSessionContext({'parent_segment':_0x93bef4},_0x14e67b['session']),console[_0x1a6909(0x8d)](a34_0x2a0149[_0x1a6909(0x9c)](_0x1a6909(0x74)+a34_0x2a0149[_0x1a6909(0xb7)](_0x1a6909(0xac))+_0x1a6909(0x8b)+a34_0x2a0149['cyan'](_0x93bef4))),0x0;if(!_0x14e67b[_0x1a6909(0x6d)]&&(_0x458660[_0x1a6909(0xaf)]>0x0||_0x120fc9['length']>0x0)){const _0x24318d=await confirmKey(_0x1a6909(0x7b)+(_0x458660[_0x1a6909(0xaf)]+_0x120fc9[_0x1a6909(0xaf)])+_0x1a6909(0xb4));if(!_0x24318d)return console['error'](_0x1a6909(0x6c)),0x1;}for(const _0x44064b of _0x532402){if(_0x44064b[_0x1a6909(0x95)]||_0x44064b[_0x1a6909(0x91)]){const _0xad9ebf=a34_0x2c162a[_0x1a6909(0xad)](_0x44064b[_0x1a6909(0xb5)]);!existsSync(_0xad9ebf)&&mkdirSync(_0xad9ebf,{'recursive':!![]}),writeFileSync(_0x44064b[_0x1a6909(0xb5)],_0x44064b['content'],_0x1a6909(0xa0));}}return console[_0x1a6909(0x8d)](a34_0x2a0149[_0x1a6909(0x9c)](_0x1a6909(0x9e)+(_0x458660['length']+_0x120fc9[_0x1a6909(0xaf)])+_0x1a6909(0xa7)+_0x47deba)),saveSessionContext({'parent_segment':_0x93bef4},_0x14e67b['session']),console[_0x1a6909(0x8d)](a34_0x2a0149[_0x1a6909(0x9c)](_0x1a6909(0x74)+a34_0x2a0149[_0x1a6909(0xb7)](_0x1a6909(0xac))+_0x1a6909(0x8b)+a34_0x2a0149[_0x1a6909(0xbe)](_0x93bef4))),0x0;}}function buildFolderPathMap(_0x1deb03){const _0x139767=a34_0x3b65a9,_0x2cc72c=new Map(),_0x4ba515=new Map();for(const _0x5ca0fa of _0x1deb03){_0x4ba515[_0x139767(0xb2)](_0x5ca0fa['id'],_0x5ca0fa);}const _0x479413=new Set();for(const _0x5cbd of _0x1deb03){!_0x5cbd['parentFolderId']&&_0x479413[_0x139767(0x8c)](_0x5cbd['id']);}function _0x114be2(_0x119dc8){const _0x4c854c=_0x139767;if(_0x2cc72c[_0x4c854c(0x9f)](_0x119dc8['id']))return _0x2cc72c[_0x4c854c(0x71)](_0x119dc8['id']);if(_0x479413[_0x4c854c(0x9f)](_0x119dc8['id']))return _0x2cc72c[_0x4c854c(0xb2)](_0x119dc8['id'],''),'';if(_0x119dc8[_0x4c854c(0x86)]){const _0x59789c=_0x4ba515[_0x4c854c(0x71)](_0x119dc8[_0x4c854c(0x86)]);if(_0x59789c){const _0x23becf=_0x114be2(_0x59789c),_0x54bbf1=_0x23becf?_0x23becf+'/'+_0x119dc8['name']:_0x119dc8[_0x4c854c(0x88)];return _0x2cc72c['set'](_0x119dc8['id'],_0x54bbf1),_0x54bbf1;}}const _0x3f0836=_0x119dc8['name'];return _0x2cc72c[_0x4c854c(0xb2)](_0x119dc8['id'],_0x3f0836),_0x3f0836;}for(const _0x1e7ff3 of _0x1deb03){_0x114be2(_0x1e7ff3);}return _0x2cc72c;}function getUniqueFileName(_0x27bfb4,_0x35b25f,_0x31fb3e){const _0x431f18=a34_0x3b65a9,_0x134ed6=_0x27bfb4+':'+_0x35b25f,_0x163f6c=_0x31fb3e[_0x431f18(0x71)](_0x134ed6)||0x0;_0x31fb3e[_0x431f18(0xb2)](_0x134ed6,_0x163f6c+0x1);if(_0x163f6c===0x0)return _0x35b25f;return _0x35b25f+'-'+_0x163f6c;}function prepareFile(_0x48e4ef,_0x28a978,_0x402133){const _0x10ba22=a34_0x3b65a9,_0x504bb4=a34_0x2c162a['relative'](_0x402133,_0x48e4ef);if(existsSync(_0x48e4ef)){const _0x44a8cf=readFileSync(_0x48e4ef,_0x10ba22(0xa0)),_0x348020=generateDiff(_0x44a8cf,_0x28a978),_0x42f0d2=hasChanges(_0x348020);return{'relativePath':_0x504bb4,'absolutePath':_0x48e4ef,'content':_0x28a978,'isNew':![],'hasChanges':_0x42f0d2,'diff':_0x42f0d2?formatDiffWithColors(_0x348020):undefined};}return{'relativePath':_0x504bb4,'absolutePath':_0x48e4ef,'content':_0x28a978,'isNew':!![],'hasChanges':![]};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a35_0x29130b=a35_0x276a;(function(_0x4b39ca,_0x27711c){const _0x264f52=a35_0x276a,_0x29da37=_0x4b39ca();while(!![]){try{const _0xa5b55a=-parseInt(_0x264f52(0x134))/0x1+-parseInt(_0x264f52(0x167))/0x2+parseInt(_0x264f52(0x183))/0x3+-parseInt(_0x264f52(0x12d))/0x4+parseInt(_0x264f52(0x1a7))/0x5+parseInt(_0x264f52(0x169))/0x6*(parseInt(_0x264f52(0x142))/0x7)+parseInt(_0x264f52(0x1a2))/0x8;if(_0xa5b55a===_0x27711c)break;else _0x29da37['push'](_0x29da37['shift']());}catch(_0x30324a){_0x29da37['push'](_0x29da37['shift']());}}}(a35_0x9d10,0x212f9));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode,isHttp400Error,getErrorMessage}from'../sdk/errors.js';import{withSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{getSegmentRootDir,findTdxConfig}from'../utils/tdx-config.js';import{segmentToYamlString,segmentWithActivationsToYaml,parseSegmentYamlFile,normalizeChildSegmentYaml,yamlToCreateRequest,yamlToUpdateRequest,yamlActivationToCreateRequest,yamlActivationToUpdateRequest,activationToYaml}from'../sdk/segment/child-segment-yaml.js';import a35_0x373642 from'chalk';function a35_0x276a(_0x3c8ab8,_0x3bf111){_0x3c8ab8=_0x3c8ab8-0x12a;const _0x9d1012=a35_0x9d10();let _0x276a51=_0x9d1012[_0x3c8ab8];return _0x276a51;}import{existsSync,readFileSync,statSync,readdirSync}from'fs';import a35_0x2a4ccd from'path';import*as a35_0x1e7dc1 from'yaml';import{sanitizeFileName}from'../utils/string-utils.js';function tryFindTdxConfig(_0x5139ee){try{return findTdxConfig(_0x5139ee);}catch{return null;}}function resolveTDFolderPath(_0x56343c,_0x215ccd,_0x411a98){if(!_0x215ccd)return _0x56343c;return _0x56343c?_0x411a98+'/'+_0x56343c:_0x411a98;}export class SegmentPushCommand extends BaseCommand{['name']=a35_0x29130b(0x192);['description']='Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments';async[a35_0x29130b(0x148)](_0x1ecbfd){const _0x24b992=a35_0x29130b,{options:_0x4ef750,args:_0x33d616,tdx:_0xab5019}=_0x1ecbfd,_0x531843=_0x4ef750,_0x3489d0=_0x4ef750[_0x24b992(0x188)],_0x1c05da=_0x33d616[0x0];let _0x487d84,_0x37faac,_0x341d82,_0x1eca48;if(_0x1c05da){if(existsSync(_0x1c05da)&&statSync(_0x1c05da)[_0x24b992(0x16e)]()){const _0x49578e=tryFindTdxConfig(_0x1c05da);if(_0x49578e)_0x487d84=_0x49578e['config'][_0x24b992(0x17f)],_0x37faac=_0x1c05da,_0x341d82=_0x49578e[_0x24b992(0x144)];else return console[_0x24b992(0x19b)](a35_0x373642[_0x24b992(0x13d)](_0x24b992(0x193)+_0x1c05da+'\x0a')),console[_0x24b992(0x19b)](a35_0x373642[_0x24b992(0x13b)](_0x24b992(0x149))),0x1;}else{if(existsSync(_0x1c05da)&&statSync(_0x1c05da)['isFile']()){const _0x4033c8=a35_0x2a4ccd[_0x24b992(0x138)](_0x1c05da),_0xaa2786=tryFindTdxConfig(_0x4033c8);if(_0xaa2786)_0x487d84=_0xaa2786[_0x24b992(0x12a)][_0x24b992(0x17f)],_0x341d82=_0xaa2786[_0x24b992(0x144)],_0x37faac=_0xaa2786[_0x24b992(0x144)],_0x1eca48=a35_0x2a4ccd[_0x24b992(0x186)](_0x1c05da);else return console['error'](a35_0x373642[_0x24b992(0x13d)](_0x24b992(0x193)+_0x4033c8+'\x0a')),console[_0x24b992(0x19b)](a35_0x373642[_0x24b992(0x13b)](_0x24b992(0x149))),0x1;}else _0x487d84=_0x1c05da;}}else{const _0x4329c6=tryFindTdxConfig(process[_0x24b992(0x141)]());_0x4329c6?(_0x487d84=_0x4329c6[_0x24b992(0x12a)][_0x24b992(0x17f)],_0x37faac=process[_0x24b992(0x141)](),_0x341d82=_0x4329c6['configDir']):_0x487d84=_0x3489d0;}if(!_0x487d84)return console[_0x24b992(0x19b)](a35_0x373642[_0x24b992(0x19a)](_0x24b992(0x151))),console[_0x24b992(0x19b)](_0x24b992(0x131)),console[_0x24b992(0x19b)](_0x24b992(0x176)),console['error'](_0x24b992(0x159)),0x1;const _0x57c97d=_0x37faac||getSegmentRootDir(sanitizeFileName(_0x487d84)),_0x153a17=_0x341d82||_0x57c97d,_0x21f71e=a35_0x2a4ccd[_0x24b992(0x139)](_0x153a17,_0x57c97d),_0x48d14e=_0x21f71e!==''&&_0x21f71e!=='.';if(!existsSync(_0x57c97d))return console[_0x24b992(0x19b)](a35_0x373642['red']('Error:\x20Directory\x20not\x20found:\x20'+_0x57c97d+'\x0a')),console['error'](a35_0x373642[_0x24b992(0x13b)](_0x24b992(0x149))),0x1;_0x531843[_0x24b992(0x135)]&&(console[_0x24b992(0x19b)](_0x24b992(0x164)+_0x531843['site']),console['error'](_0x24b992(0x1aa)+_0x487d84),console[_0x24b992(0x19b)](_0x24b992(0x157)+_0x57c97d),_0x48d14e&&console['error'](_0x24b992(0x14f)+_0x21f71e));const _0x16740c=await withSpinner(_0x24b992(0x146)+_0x487d84+_0x24b992(0x16f),()=>_0xab5019['segment'][_0x24b992(0x13a)](_0x487d84),{'verbose':_0x531843['verbose']}),_0x103046=_0x16740c[_0x24b992(0x1a0)],[_0xa21e21,_0x44d2e1,_0x4eea1a]=await Promise[_0x24b992(0x14b)]([withSpinner(_0x24b992(0x15f),()=>_0xab5019['segment'][_0x24b992(0x14c)](_0x103046),{'verbose':_0x531843[_0x24b992(0x135)]}),withSpinner(_0x24b992(0x170),()=>_0xab5019[_0x24b992(0x16b)][_0x24b992(0x15c)](_0x103046),{'verbose':_0x531843[_0x24b992(0x135)]}),withSpinner(_0x24b992(0x17c),()=>_0xab5019[_0x24b992(0x174)][_0x24b992(0x152)](),{'verbose':_0x531843[_0x24b992(0x135)]})[_0x24b992(0x1b1)](_0xcb90b5=>_0xcb90b5[_0x24b992(0x1a0)])]),_0x23f22b=_0xa21e21[_0x24b992(0x1a0)],_0x4be813=_0x44d2e1[_0x24b992(0x1a0)],{emailToId:_0x1917aa,idToEmail:_0x1ee7d6}=_0x4eea1a,[_0x3faad8,_0xe31eda]=await withSpinner(_0x24b992(0x15e),async()=>{const _0x5732b6=_0x24b992,[_0x4f9f9c,_0x446bf4]=await Promise['all']([_0xab5019[_0x5732b6(0x1a3)]['buildNameToIdMap'](),_0xab5019[_0x5732b6(0x1a3)][_0x5732b6(0x1a4)]()]);return[_0x4f9f9c,_0x446bf4];},{'verbose':_0x531843[_0x24b992(0x135)]})[_0x24b992(0x1b1)](_0x46d9a4=>_0x46d9a4[_0x24b992(0x1a0)]),_0x5ccd75=buildFolderPathToIdMap(_0x4be813),_0x44f33c=new Map();for(const [_0x50cac4,_0x2dacdb]of _0x5ccd75[_0x24b992(0x190)]()){_0x44f33c['set'](_0x2dacdb,_0x50cac4);}const _0x249f7c=new Map();for(const _0x5a83f3 of _0x23f22b){const _0x54d52d=_0x5a83f3[_0x24b992(0x132)]?_0x44f33c['get'](_0x5a83f3[_0x24b992(0x132)][_0x24b992(0x196)]())||'':'',_0x24725d=_0x54d52d+':'+_0x5a83f3[_0x24b992(0x1a9)];_0x249f7c['set'](_0x24725d,_0x5a83f3);}let _0xccc15f;if(_0x1eca48){if(!_0x1eca48['endsWith'](_0x24b992(0x143))&&!_0x1eca48[_0x24b992(0x179)]('.yaml'))return console[_0x24b992(0x19b)](a35_0x373642[_0x24b992(0x13d)](_0x24b992(0x189)+_0x1eca48+'\x0a')),0x1;_0xccc15f=[_0x1eca48];}else _0xccc15f=findYamlFiles(_0x57c97d);if(_0xccc15f[_0x24b992(0x161)]===0x0)return console['error'](a35_0x373642[_0x24b992(0x13d)](_0x24b992(0x154)+_0x57c97d+'\x0a')),console['error'](a35_0x373642['cyan']('Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20files')),0x1;const _0xbd8608=[];for(const _0x5890ef of _0xccc15f){const _0x14c008=a35_0x2a4ccd[_0x24b992(0x139)](_0x57c97d,a35_0x2a4ccd[_0x24b992(0x138)](_0x5890ef)),_0x19d083=_0x14c008==='.'?'':_0x14c008,_0x2d9535=readFileSync(_0x5890ef,'utf-8');try{const _0x19d88d=parseSegmentYamlFile(_0x2d9535),_0x59f2f1=normalizeChildSegmentYaml(_0x19d88d);_0xbd8608[_0x24b992(0x18c)]({'yamlConfig':_0x59f2f1,'folderPath':_0x19d083,'sourcePath':_0x5890ef});}catch(_0x54c657){return console[_0x24b992(0x19b)](a35_0x373642['red'](_0x24b992(0x136)+_0x5890ef+':\x20'+(_0x54c657 instanceof Error?_0x54c657[_0x24b992(0x133)]:_0x54c657))),0x1;}}if(_0xbd8608['length']===0x0)return console[_0x24b992(0x19b)](a35_0x373642[_0x24b992(0x19a)](_0x24b992(0x13c))),0x0;const _0xeb9944=new Map();_0x23f22b[_0x24b992(0x161)]>0x0&&await withSpinner(_0x24b992(0x18b),async()=>{await batchAsync(_0x23f22b,async _0x2856f1=>{const _0x5914a1=await _0xab5019['segment']['listActivations'](_0x103046,_0x2856f1['id']);_0xeb9944['set'](_0x2856f1['id'],_0x5914a1);});},{'verbose':_0x531843[_0x24b992(0x135)]});const _0x1f9bd8=[],_0x370d83=new Set();for(const {yamlConfig:_0x553750,folderPath:_0x188919,sourcePath:_0x2b4090}of _0xbd8608){const _0x114484=resolveTDFolderPath(_0x188919,_0x48d14e,_0x21f71e),_0x104854=_0x114484+':'+_0x553750[_0x24b992(0x1a9)],_0x1d1e40=_0x249f7c[_0x24b992(0x177)](_0x104854),_0x3ab296=_0x1d1e40?_0xeb9944[_0x24b992(0x177)](_0x1d1e40['id'])||[]:[];if(_0x114484&&!_0x5ccd75[_0x24b992(0x195)](_0x114484)){const _0x4a730c=_0x114484[_0x24b992(0x172)]('/');let _0x5cdbab='';for(const _0x4b907a of _0x4a730c){_0x5cdbab=_0x5cdbab?_0x5cdbab+'/'+_0x4b907a:_0x4b907a,!_0x5ccd75[_0x24b992(0x195)](_0x5cdbab)&&_0x370d83['add'](_0x5cdbab);}}const _0x4fe3c8=calculateActivationActions(_0x553750[_0x24b992(0x1a5)]||[],_0x3ab296,_0x1ee7d6,_0xe31eda),_0x2e90b7=segmentToYamlString(_0x553750);let _0x245e7c,_0x42a3c2=![],_0x5f294c;if(_0x1d1e40){const _0x57b414=segmentWithActivationsToYaml(_0x1d1e40,_0x3ab296,undefined,_0x1ee7d6,_0xe31eda),_0x5b1ae5=segmentToYamlString(_0x57b414);_0x245e7c=generateDiff(_0x5b1ae5,_0x2e90b7),_0x42a3c2=hasChanges(_0x245e7c),_0x42a3c2&&(_0x5f294c=formatDiffWithColors(_0x245e7c));}else _0x245e7c=generateDiff('',_0x2e90b7),_0x5f294c=formatDiffWithColors(_0x245e7c);_0x1f9bd8[_0x24b992(0x18c)]({'relativePath':_0x553750[_0x24b992(0x1a9)],'absolutePath':_0x2b4090,'yamlConfig':_0x553750,'folderPath':_0x114484,'existingSegment':_0x1d1e40,'existingActivations':_0x3ab296,'isNew':!_0x1d1e40,'hasChanges':_0x42a3c2,'diff':_0x5f294c,'activationActions':_0x4fe3c8});}let _0x21c5eb=[];if(!_0x1eca48){const _0xd29696=new Set();for(const {yamlConfig:_0x4e8821,folderPath:_0x2151b6}of _0xbd8608){const _0x133c36=resolveTDFolderPath(_0x2151b6,_0x48d14e,_0x21f71e);_0xd29696[_0x24b992(0x1a8)](_0x133c36+':'+_0x4e8821[_0x24b992(0x1a9)]);}_0x21c5eb=_0x23f22b[_0x24b992(0x181)](_0x49e007=>{const _0x4ef7d0=_0x24b992,_0x28da6e=_0x49e007[_0x4ef7d0(0x132)]?_0x44f33c[_0x4ef7d0(0x177)](_0x49e007[_0x4ef7d0(0x132)][_0x4ef7d0(0x196)]())||'':'',_0x5a45e8=_0x28da6e+':'+_0x49e007[_0x4ef7d0(0x1a9)];if(_0xd29696[_0x4ef7d0(0x195)](_0x5a45e8))return![];if(_0x48d14e)return _0x28da6e===_0x21f71e||_0x28da6e[_0x4ef7d0(0x12c)](_0x21f71e+'/');return!![];});}const _0x4a2779=_0x1f9bd8[_0x24b992(0x181)](_0x45fef7=>_0x45fef7[_0x24b992(0x18d)]),_0x3538e7=_0x1f9bd8[_0x24b992(0x181)](_0x19e77c=>!_0x19e77c[_0x24b992(0x18d)]&&_0x19e77c[_0x24b992(0x166)]),_0x1bd557=_0x1f9bd8['filter'](_0x35565d=>!_0x35565d[_0x24b992(0x18d)]&&!_0x35565d[_0x24b992(0x166)]),_0x5d9ad9=Array['from'](_0x370d83)['sort'](),_0x31775a=_0x531843[_0x24b992(0x14d)]?_0x21c5eb:[],_0x47365c=_0x1f9bd8[_0x24b992(0x1a1)](_0x16e321=>_0x16e321[_0x24b992(0x1b2)]),_0x23e0ce=_0x47365c[_0x24b992(0x181)](_0x202847=>_0x202847[_0x24b992(0x14a)]===_0x24b992(0x13f)),_0x2dfb8a=_0x47365c[_0x24b992(0x181)](_0xc93a7c=>_0xc93a7c['type']===_0x24b992(0x171)),_0x60ee1c=_0x47365c[_0x24b992(0x181)](_0x495b92=>_0x495b92[_0x24b992(0x14a)]==='delete');console[_0x24b992(0x19b)](_0x24b992(0x19f)+_0x487d84+'\x27:');_0x5d9ad9[_0x24b992(0x161)]>0x0&&console[_0x24b992(0x19b)]('\x20\x20'+a35_0x373642[_0x24b992(0x1ad)](_0x24b992(0x17d)+_0x5d9ad9[_0x24b992(0x161)]+'\x20folders\x20to\x20create'));console['error']('\x20\x20'+a35_0x373642[_0x24b992(0x150)]('+\x20'+_0x4a2779[_0x24b992(0x161)]+_0x24b992(0x19e))),console[_0x24b992(0x19b)]('\x20\x20'+a35_0x373642[_0x24b992(0x19a)]('~\x20'+_0x3538e7[_0x24b992(0x161)]+'\x20changed\x20segments'));if(_0x31775a['length']>0x0)console['error']('\x20\x20'+a35_0x373642[_0x24b992(0x13d)]('-\x20'+_0x31775a[_0x24b992(0x161)]+_0x24b992(0x156)));else _0x21c5eb[_0x24b992(0x161)]>0x0&&!_0x531843[_0x24b992(0x14d)]&&console[_0x24b992(0x19b)]('\x20\x20'+a35_0x373642[_0x24b992(0x1af)]('\x20\x20'+_0x21c5eb[_0x24b992(0x161)]+'\x20segments\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console['error']('\x20\x20'+a35_0x373642[_0x24b992(0x1af)]('=\x20'+_0x1bd557['length']+'\x20unchanged\x20segments'));_0x47365c['length']>0x0&&(console[_0x24b992(0x19b)](''),console[_0x24b992(0x19b)](_0x24b992(0x1ae)),_0x23e0ce[_0x24b992(0x161)]>0x0&&console['error'](_0x24b992(0x19c)+a35_0x373642[_0x24b992(0x150)]('+\x20'+_0x23e0ce[_0x24b992(0x161)]+_0x24b992(0x175))),_0x2dfb8a[_0x24b992(0x161)]>0x0&&console['error'](_0x24b992(0x19c)+a35_0x373642['yellow']('~\x20'+_0x2dfb8a[_0x24b992(0x161)]+'\x20to\x20update')),_0x60ee1c['length']>0x0&&console[_0x24b992(0x19b)]('\x20\x20\x20\x20'+a35_0x373642['red']('-\x20'+_0x60ee1c[_0x24b992(0x161)]+_0x24b992(0x160))));console[_0x24b992(0x19b)](_0x24b992(0x145)+a35_0x373642[_0x24b992(0x13b)](_0x57c97d)+'\x0a');if(_0x5d9ad9[_0x24b992(0x161)]>0x0){console[_0x24b992(0x19b)](_0x24b992(0x180));for(const _0x9db5c5 of _0x5d9ad9){console[_0x24b992(0x19b)]('\x20\x20'+a35_0x373642[_0x24b992(0x1ad)]('+')+'\x20'+_0x9db5c5);}console[_0x24b992(0x19b)]('');}if(_0x4a2779[_0x24b992(0x161)]>0x0)for(const _0x20bc0f of _0x4a2779){const _0x4ab1aa=_0x20bc0f['folderPath']?_0x20bc0f[_0x24b992(0x158)]+'/'+_0x20bc0f[_0x24b992(0x15b)]['name']:_0x20bc0f[_0x24b992(0x15b)]['name'],_0x369204=_0x20bc0f['yamlConfig'][_0x24b992(0x1a5)]?.[_0x24b992(0x161)]||0x0,_0x151411=_0x369204>0x0?a35_0x373642[_0x24b992(0x1af)]('\x20['+_0x369204+_0x24b992(0x187)):'';console[_0x24b992(0x19b)]('\x0a'+a35_0x373642[_0x24b992(0x150)](_0x24b992(0x162))+'\x20'+_0x4ab1aa+_0x151411),console[_0x24b992(0x19b)]('─'[_0x24b992(0x17b)](0x3c)),_0x20bc0f[_0x24b992(0x1a6)]&&console[_0x24b992(0x19b)](_0x20bc0f[_0x24b992(0x1a6)]),console[_0x24b992(0x19b)]('─'['repeat'](0x3c));}if(_0x31775a[_0x24b992(0x161)]>0x0)for(const _0x50a113 of _0x31775a){const _0x1ec4c0=_0x50a113[_0x24b992(0x132)]?_0x44f33c[_0x24b992(0x177)](_0x50a113[_0x24b992(0x132)]['toString']())||'':'',_0x1b4f5e=_0x1ec4c0?_0x1ec4c0+'/'+_0x50a113[_0x24b992(0x1a9)]:_0x50a113['name'],_0x5786b8=_0xeb9944[_0x24b992(0x177)](_0x50a113['id'])||[],_0x563bda=_0x5786b8[_0x24b992(0x161)]>0x0?a35_0x373642['dim']('\x20['+_0x5786b8[_0x24b992(0x161)]+_0x24b992(0x187)):'';console['error']('\x0a'+a35_0x373642[_0x24b992(0x13d)](_0x24b992(0x165))+'\x20'+_0x1b4f5e+_0x563bda),console[_0x24b992(0x19b)]('─'[_0x24b992(0x17b)](0x3c));const _0x32de34=segmentWithActivationsToYaml(_0x50a113,_0x5786b8,undefined,_0x1ee7d6,_0xe31eda),_0x2a8308=segmentToYamlString(_0x32de34),_0x1b137e=generateDiff(_0x2a8308,'');console['error'](formatDiffWithColors(_0x1b137e)),console['error']('─'[_0x24b992(0x17b)](0x3c));}const _0x40d82e=_0x1f9bd8[_0x24b992(0x181)](_0x292124=>!_0x292124[_0x24b992(0x18d)]&&_0x292124[_0x24b992(0x1a6)]);if(_0x40d82e[_0x24b992(0x161)]>0x0)for(const _0x2170c0 of _0x40d82e){const _0x4e1fc5=_0x2170c0[_0x24b992(0x158)]?_0x2170c0[_0x24b992(0x158)]+'/'+_0x2170c0['yamlConfig'][_0x24b992(0x1a9)]:_0x2170c0['yamlConfig'][_0x24b992(0x1a9)];console['error']('\x0a'+a35_0x373642[_0x24b992(0x19a)](_0x24b992(0x15d))+'\x20'+_0x4e1fc5),console[_0x24b992(0x19b)]('─'[_0x24b992(0x17b)](0x3c)),console[_0x24b992(0x19b)](_0x2170c0[_0x24b992(0x1a6)]),console['error']('─'[_0x24b992(0x17b)](0x3c));}if(_0x531843[_0x24b992(0x13e)])return console[_0x24b992(0x19b)](a35_0x373642[_0x24b992(0x19a)]('\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made')),0x0;const _0x320aa6=_0x4a2779[_0x24b992(0x161)]>0x0||_0x3538e7[_0x24b992(0x161)]>0x0||_0x31775a['length']>0x0,_0x232fb6=_0x47365c[_0x24b992(0x161)]>0x0,_0x4df7a6=_0x5d9ad9[_0x24b992(0x161)]>0x0;if(!_0x320aa6&&!_0x232fb6&&!_0x4df7a6)return console[_0x24b992(0x19b)](a35_0x373642[_0x24b992(0x150)]('✔\x20All\x20segments\x20and\x20activations\x20are\x20up\x20to\x20date')),0x0;const _0x1a7dcc=_0x4a2779['length']+_0x3538e7[_0x24b992(0x161)]+_0x31775a['length']+_0x5d9ad9[_0x24b992(0x161)]+_0x47365c['length'];if(!_0x531843['yes']&&_0x1a7dcc>0x0){const _0x388ff8=await confirmKey('Push\x20'+_0x1a7dcc+'\x20changes?');if(!_0x388ff8)return console[_0x24b992(0x19b)](_0x24b992(0x182)),0x1;}for(const _0x1c0dff of _0x5d9ad9){const _0x5c3fb2=_0x1c0dff['split']('/'),_0x11a80e=_0x5c3fb2[_0x5c3fb2['length']-0x1],_0x24a368=_0x5c3fb2['slice'](0x0,-0x1)[_0x24b992(0x18e)]('/'),_0xbd9b97=_0x5ccd75[_0x24b992(0x177)](_0x24a368),_0x57277b={'name':_0x11a80e,'parentFolderId':_0xbd9b97},_0x4e34b3=await withSpinner(_0x24b992(0x199)+_0x1c0dff+_0x24b992(0x16f),()=>_0xab5019[_0x24b992(0x16b)][_0x24b992(0x16a)](_0x103046,_0x57277b),{'verbose':_0x531843['verbose']});_0x5ccd75[_0x24b992(0x153)](_0x1c0dff,_0x4e34b3[_0x24b992(0x1a0)]['id']),console[_0x24b992(0x19b)](a35_0x373642[_0x24b992(0x1ad)]('✔\x20Created\x20folder\x20\x27'+_0x1c0dff+'\x27'));}let _0x108e1a=0x0,_0x323fe7=0x0,_0xbc5d60=0x0,_0x59e2a9=0x0,_0x3c010d=0x0,_0x3b7a0d=0x0;const _0x1c7528=new Map();for(const _0xebd59f of _0x1f9bd8){const _0x4da3e6=_0xebd59f[_0x24b992(0x158)]?_0x5ccd75[_0x24b992(0x177)](_0xebd59f['folderPath']):undefined;let _0x35bd9a;try{if(_0xebd59f[_0x24b992(0x18d)]){const _0x4d72e2=yamlToCreateRequest(_0xebd59f['yamlConfig'],_0x4da3e6),_0x2b0681=await withSpinner(_0x24b992(0x147)+_0xebd59f[_0x24b992(0x15b)]['name']+'\x27...',()=>_0xab5019[_0x24b992(0x16b)][_0x24b992(0x155)](_0x103046,_0x4d72e2),{'verbose':_0x531843[_0x24b992(0x135)]});_0x35bd9a=_0x2b0681[_0x24b992(0x1a0)]['id'],_0x1c7528[_0x24b992(0x153)](_0xebd59f[_0x24b992(0x15b)][_0x24b992(0x1a9)],_0x35bd9a),console[_0x24b992(0x19b)](a35_0x373642[_0x24b992(0x150)]('✔\x20Created\x20segment\x20\x27'+_0xebd59f[_0x24b992(0x15b)][_0x24b992(0x1a9)]+'\x27')),_0x108e1a++;}else{if(_0xebd59f[_0x24b992(0x166)]){const _0x5e640b=yamlToUpdateRequest(_0xebd59f['yamlConfig']);_0x4da3e6!==_0xebd59f[_0x24b992(0x15a)]?.[_0x24b992(0x132)]&&(_0x5e640b['segmentFolderId']=_0x4da3e6?parseInt(_0x4da3e6,0xa):undefined),await withSpinner(_0x24b992(0x198)+_0xebd59f[_0x24b992(0x15b)][_0x24b992(0x1a9)]+_0x24b992(0x16f),()=>_0xab5019[_0x24b992(0x16b)][_0x24b992(0x185)](_0x103046,_0xebd59f[_0x24b992(0x15a)]['id'],_0x5e640b),{'verbose':_0x531843[_0x24b992(0x135)]}),_0x35bd9a=_0xebd59f[_0x24b992(0x15a)]['id'],console[_0x24b992(0x19b)](a35_0x373642[_0x24b992(0x19a)](_0x24b992(0x12f)+_0xebd59f[_0x24b992(0x15b)]['name']+'\x27')),_0x323fe7++;}else _0x35bd9a=_0xebd59f[_0x24b992(0x15a)]['id'];}}catch(_0x163837){const _0x2eab96=isHttp400Error(_0x163837),_0x4f952c=_0x2eab96?ErrorCode[_0x24b992(0x191)]:ErrorCode[_0x24b992(0x173)],_0x164750=getErrorMessage(_0x163837);throw new SDKError(_0x4f952c,_0x24b992(0x137)+(_0xebd59f[_0x24b992(0x18d)]?_0x24b992(0x13f):_0x24b992(0x171))+_0x24b992(0x18a)+_0xebd59f[_0x24b992(0x184)]+_0x24b992(0x163)+_0x164750,_0x163837);}for(const _0x411f38 of _0xebd59f[_0x24b992(0x1b2)]){try{if(_0x411f38[_0x24b992(0x14a)]===_0x24b992(0x13f)&&_0x411f38[_0x24b992(0x17a)]){const _0x27f8a5=yamlActivationToCreateRequest(_0x411f38[_0x24b992(0x17a)],_0x1917aa,_0x3faad8);await withSpinner(_0x24b992(0x14e)+_0x411f38[_0x24b992(0x1a9)]+_0x24b992(0x16f),()=>_0xab5019[_0x24b992(0x16b)]['createActivation'](_0x103046,_0x35bd9a,_0x27f8a5),{'verbose':_0x531843['verbose']}),console[_0x24b992(0x19b)](a35_0x373642['green'](_0x24b992(0x1b0)+_0x411f38['name']+'\x27')),_0x59e2a9++;}else{if(_0x411f38['type']==='update'&&_0x411f38['yamlActivation']&&_0x411f38['existingActivation']){const _0x314355=yamlActivationToUpdateRequest(_0x411f38[_0x24b992(0x17a)],_0x1917aa,_0x3faad8);await withSpinner('Updating\x20activation\x20\x27'+_0x411f38[_0x24b992(0x1a9)]+_0x24b992(0x16f),()=>_0xab5019[_0x24b992(0x16b)]['updateActivation'](_0x103046,_0x35bd9a,_0x411f38['existingActivation']['id'],_0x314355),{'verbose':_0x531843['verbose']}),console[_0x24b992(0x19b)](a35_0x373642['yellow'](_0x24b992(0x1ab)+_0x411f38[_0x24b992(0x1a9)]+'\x27')),_0x3c010d++;}else _0x411f38[_0x24b992(0x14a)]===_0x24b992(0x14d)&&_0x411f38[_0x24b992(0x130)]&&(await withSpinner(_0x24b992(0x197)+_0x411f38[_0x24b992(0x1a9)]+_0x24b992(0x16f),()=>_0xab5019[_0x24b992(0x16b)][_0x24b992(0x168)](_0x103046,_0x35bd9a,_0x411f38[_0x24b992(0x130)]['id']),{'verbose':_0x531843[_0x24b992(0x135)]}),console[_0x24b992(0x19b)](a35_0x373642['red']('\x20\x20✔\x20Deleted\x20activation\x20\x27'+_0x411f38[_0x24b992(0x1a9)]+'\x27')),_0x3b7a0d++);}}catch(_0x5ddb47){const _0x122cf9=isHttp400Error(_0x5ddb47),_0x584bac=_0x122cf9?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode[_0x24b992(0x18f)],_0x4ef65e=getErrorMessage(_0x5ddb47);throw new SDKError(_0x584bac,_0x24b992(0x137)+_0x411f38[_0x24b992(0x14a)]+'\x20activation\x20\x27'+_0x411f38[_0x24b992(0x1a9)]+_0x24b992(0x12b)+_0xebd59f[_0x24b992(0x184)]+'\x0a\x20\x20'+_0x4ef65e,_0x5ddb47);}}}for(const _0x2f044c of _0x31775a){await withSpinner('Deleting\x20segment\x20\x27'+_0x2f044c[_0x24b992(0x1a9)]+_0x24b992(0x16f),()=>_0xab5019[_0x24b992(0x16b)][_0x24b992(0x16c)](_0x2f044c['id']),{'verbose':_0x531843['verbose']}),console[_0x24b992(0x19b)](a35_0x373642[_0x24b992(0x13d)](_0x24b992(0x12e)+_0x2f044c['name']+'\x27')),_0xbc5d60++;}const _0x8d0516=[];if(_0x108e1a>0x0)_0x8d0516[_0x24b992(0x18c)](_0x108e1a+_0x24b992(0x194));if(_0x323fe7>0x0)_0x8d0516[_0x24b992(0x18c)](_0x323fe7+_0x24b992(0x16d));if(_0xbc5d60>0x0)_0x8d0516['push'](_0xbc5d60+'\x20deleted');const _0x40e445=[];if(_0x59e2a9>0x0)_0x40e445[_0x24b992(0x18c)](_0x59e2a9+_0x24b992(0x194));if(_0x3c010d>0x0)_0x40e445[_0x24b992(0x18c)](_0x3c010d+_0x24b992(0x16d));if(_0x3b7a0d>0x0)_0x40e445[_0x24b992(0x18c)](_0x3b7a0d+_0x24b992(0x1ac));return console[_0x24b992(0x19b)](a35_0x373642[_0x24b992(0x150)]('\x0a✔\x20Push\x20complete')),_0x8d0516[_0x24b992(0x161)]>0x0&&console[_0x24b992(0x19b)](_0x24b992(0x19d)+_0x8d0516[_0x24b992(0x18e)](',\x20')),_0x40e445['length']>0x0&&console[_0x24b992(0x19b)](_0x24b992(0x178)+_0x40e445[_0x24b992(0x18e)](',\x20')),0x0;}}function buildFolderPathToIdMap(_0x17447d){const _0x4097b3=a35_0x29130b,_0x57946a=new Map(),_0x41a1a3=new Map();for(const _0x167b62 of _0x17447d){_0x41a1a3[_0x4097b3(0x153)](_0x167b62['id'],_0x167b62);}const _0x59e4e5=new Set();for(const _0x4708b3 of _0x17447d){!_0x4708b3[_0x4097b3(0x17e)]&&_0x59e4e5['add'](_0x4708b3['id']);}function _0x44a4d1(_0x2ae8d9){const _0x325448=_0x4097b3;if(_0x59e4e5[_0x325448(0x195)](_0x2ae8d9['id']))return'';if(_0x2ae8d9[_0x325448(0x17e)]){const _0x2b8f26=_0x41a1a3['get'](_0x2ae8d9[_0x325448(0x17e)]);if(_0x2b8f26){const _0x26a30d=_0x44a4d1(_0x2b8f26);return _0x26a30d?_0x26a30d+'/'+_0x2ae8d9[_0x325448(0x1a9)]:_0x2ae8d9[_0x325448(0x1a9)];}}return _0x2ae8d9[_0x325448(0x1a9)];}for(const _0x4b206a of _0x17447d){const _0x483659=_0x44a4d1(_0x4b206a);_0x57946a[_0x4097b3(0x153)](_0x483659,_0x4b206a['id']);}return _0x57946a;}function a35_0x9d10(){const _0x6d78de=['159660HYRGhC','deleteActivation','258OSbhPP','createFolder','segment','deleteSegment','\x20updated','isDirectory','\x27...','Fetching\x20existing\x20folders...','update','split','SEGMENT_UPDATE_ERROR','user','\x20to\x20create','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','get','\x20\x20Activations:\x20','endsWith','yamlActivation','repeat','Fetching\x20users\x20for\x20email\x20resolution...','📁\x20','parentFolderId','parent_segment','Folders\x20to\x20create:','filter','Aborted.','121509SQDawr','absolutePath','updateSegmentById','resolve','\x20activations]','parentSegment','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','\x20segment\x20from\x20file:\x20','Fetching\x20existing\x20activations...','push','isNew','join','ACTIVATION_UPDATE_ERROR','entries','SEGMENT_SYNTAX_ERROR','segment:push','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','\x20created','has','toString','Deleting\x20activation\x20\x27','Updating\x20segment\x20\x27','Creating\x20folder\x20\x27','yellow','error','\x20\x20\x20\x20','\x20\x20Segments:\x20','\x20new\x20segments','\x0aPush\x20summary\x20for\x20\x27','data','flatMap','3047440MlWCKp','connection','buildIdToNameMap','activations','diff','68600nDcvhk','add','name','Parent\x20segment:\x20','\x20\x20✔\x20Updated\x20activation\x20\x27','\x20deleted','blue','\x20\x20Activations:','dim','\x20\x20✔\x20Created\x20activation\x20\x27','then','activationActions','config','\x27\x20from\x20file:\x20','startsWith','321436zPJOjX','✔\x20Deleted\x20segment\x20\x27','✔\x20Updated\x20segment\x20\x27','existingActivation','Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)','segmentFolderId','message','208136qLRblO','verbose','Error\x20parsing\x20','Failed\x20to\x20','dirname','relative','resolveParentId','cyan','No\x20segment\x20YAML\x20files\x20found','red','dryRun','create','stringify','cwd','11249ipXOCu','.yml','configDir','\x20\x20Source:\x20','Resolving\x20parent\x20segment\x20\x27','Creating\x20segment\x20\x27','execute','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','type','all','listSegments','delete','Creating\x20activation\x20\x27','Scoped\x20to\x20folder:\x20','green','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','buildUserMaps','set','Error:\x20No\x20segment\x20YAML\x20files\x20found\x20in\x20','createSegment','\x20segments\x20to\x20delete','Source\x20directory:\x20','folderPath','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','existingSegment','yamlConfig','listFolders','Changes\x20to:','Fetching\x20connections\x20for\x20name\x20resolution...','Fetching\x20existing\x20segments...','\x20to\x20delete','length','New\x20segment:','\x0a\x20\x20','Site:\x20','Delete\x20segment:','hasChanges'];a35_0x9d10=function(){return _0x6d78de;};return a35_0x9d10();}function findYamlFiles(_0x2e4364){const _0x1fd1ce=[];function _0x1d0f83(_0x5e874a){const _0x4d50c5=a35_0x276a,_0x490ded=readdirSync(_0x5e874a,{'withFileTypes':!![]});for(const _0x6dc816 of _0x490ded){const _0x5eb2c8=a35_0x2a4ccd[_0x4d50c5(0x18e)](_0x5e874a,_0x6dc816['name']);if(_0x6dc816[_0x4d50c5(0x16e)]())_0x1d0f83(_0x5eb2c8);else(_0x6dc816[_0x4d50c5(0x1a9)]['endsWith'](_0x4d50c5(0x143))||_0x6dc816['name'][_0x4d50c5(0x179)]('.yaml'))&&_0x1fd1ce[_0x4d50c5(0x18c)](_0x5eb2c8);}}return _0x1d0f83(_0x2e4364),_0x1fd1ce;}function calculateActivationActions(_0x39b639,_0x46d29b,_0x34b58d,_0x40be11){const _0x4e3e26=a35_0x29130b,_0x45d631=[],_0x3d54d8=new Map();for(const _0x139e70 of _0x46d29b){_0x3d54d8[_0x4e3e26(0x153)](_0x139e70[_0x4e3e26(0x1a9)],_0x139e70);}const _0x416d47=new Map();for(const _0x17b094 of _0x39b639){_0x416d47[_0x4e3e26(0x153)](_0x17b094[_0x4e3e26(0x1a9)],_0x17b094);}for(const _0x3299b7 of _0x39b639){const _0x46217d=_0x3d54d8['get'](_0x3299b7[_0x4e3e26(0x1a9)]);if(!_0x46217d)_0x45d631['push']({'type':_0x4e3e26(0x13f),'name':_0x3299b7[_0x4e3e26(0x1a9)],'yamlActivation':_0x3299b7});else{const _0x5c8e94=activationToYaml(_0x46217d,_0x34b58d,_0x40be11),_0x153ac3=a35_0x1e7dc1[_0x4e3e26(0x140)](_0x5c8e94),_0x3fe0a1=a35_0x1e7dc1[_0x4e3e26(0x140)](_0x3299b7);_0x153ac3!==_0x3fe0a1&&_0x45d631[_0x4e3e26(0x18c)]({'type':'update','name':_0x3299b7[_0x4e3e26(0x1a9)],'yamlActivation':_0x3299b7,'existingActivation':_0x46217d});}}for(const _0xe39e2e of _0x46d29b){!_0x416d47[_0x4e3e26(0x195)](_0xe39e2e[_0x4e3e26(0x1a9)])&&_0x45d631[_0x4e3e26(0x18c)]({'type':_0x4e3e26(0x14d),'name':_0xe39e2e['name'],'existingActivation':_0xe39e2e});}return _0x45d631;}
|
|
1
|
+
const a35_0x573744=a35_0x99f9;(function(_0x1ed017,_0x3112ce){const _0x325ae4=a35_0x99f9,_0x2e0afe=_0x1ed017();while(!![]){try{const _0x33c6bd=parseInt(_0x325ae4(0x96))/0x1*(-parseInt(_0x325ae4(0xb0))/0x2)+-parseInt(_0x325ae4(0xaa))/0x3+-parseInt(_0x325ae4(0xfa))/0x4+-parseInt(_0x325ae4(0xa1))/0x5*(parseInt(_0x325ae4(0xcf))/0x6)+parseInt(_0x325ae4(0xc0))/0x7*(parseInt(_0x325ae4(0x90))/0x8)+parseInt(_0x325ae4(0xb8))/0x9*(parseInt(_0x325ae4(0x7d))/0xa)+-parseInt(_0x325ae4(0xce))/0xb*(-parseInt(_0x325ae4(0xdf))/0xc);if(_0x33c6bd===_0x3112ce)break;else _0x2e0afe['push'](_0x2e0afe['shift']());}catch(_0x5d1327){_0x2e0afe['push'](_0x2e0afe['shift']());}}}(a35_0x3645,0xf2c6e));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode,isHttp400Error,getErrorMessage}from'../sdk/errors.js';import{withSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';function a35_0x3645(){const _0x69b646=['\x27...','segmentFolderId','resolveParentId','isDirectory','sort','\x20folders\x20to\x20create','SEGMENT_SYNTAX_ERROR','34812LOJagj','isNew','blue','set','Changes\x20to:','No\x20segment\x20YAML\x20files\x20found','\x20\x20✔\x20Updated\x20activation\x20\x27','join','Failed\x20to\x20','Parent\x20segment:\x20','Updating\x20activation\x20\x27','all','existingActivation','type','Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)','resolve','\x20to\x20delete','\x20unchanged\x20segments','toString','diff','Source\x20directory:\x20','deleteSegment','data','yes','parentSegment','Creating\x20folder\x20\x27','✔\x20Created\x20segment\x20\x27','7440520LuyGUk','delete','parent_segment','parentFolderId','\x20\x20Activations:','\x27\x20from\x20file:\x20','Deleting\x20activation\x20\x27','connection','\x20new\x20segments','\x20activations]','New\x20segment:','yamlActivation','Site:\x20','\x0aPush\x20summary\x20for\x20\x27','from','Fetching\x20existing\x20activations...','dim','3760mnZaoY','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','cwd','split','\x20segments\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','filter','updateSegmentById','segment:push','stringify','description','segment','Resolving\x20parent\x20segment\x20\x27','\x20changed\x20segments','\x20updated','cyan','hasChanges','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','Deleting\x20segment\x20\x27','\x20deleted','802184mhShoc','Fetching\x20users\x20for\x20email\x20resolution...','verbose','startsWith','createActivation','update','1628834DikQxk','activationActions','ACTIVATION_UPDATE_ERROR','Aborted.','Updating\x20segment\x20\x27','.yml','yamlConfig','Delete\x20segment:','absolutePath','name','repeat','9072285PiEyFO','Fetching\x20connections\x20for\x20name\x20resolution...','has','existingSegment','📁\x20','get','\x20to\x20update','configDir','buildIdToNameMap','2825871BpgHVS','createFolder','\x20\x20✔\x20Created\x20activation\x20\x27','dirname','\x20segment\x20from\x20file:\x20','push','2ErUjjE','Folders\x20to\x20create:','\x20created','activations','user','\x20\x20Segments:\x20','create','error','17919kDaJbC','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','flatMap','add','.yaml','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','site','green','7IvtlpQ','endsWith','\x20\x20✔\x20Deleted\x20activation\x20\x27','yellow','red','✔\x20Created\x20folder\x20\x27','then','\x20\x20Source:\x20','Scoped\x20to\x20folder:\x20','Error:\x20Directory\x20not\x20found:\x20','relative','deleteActivation','\x20changes?','folderPath','24233qShfRG','6CAByjF','config','SEGMENT_UPDATE_ERROR','updateActivation','length','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20files','\x20\x20\x20\x20','slice'];a35_0x3645=function(){return _0x69b646;};return a35_0x3645();}import{batchAsync}from'../utils/async.js';import{getSegmentRootDir,findTdxConfig}from'../utils/tdx-config.js';import{segmentToYamlString,segmentWithActivationsToYaml,parseSegmentYamlFile,normalizeChildSegmentYaml,yamlToCreateRequest,yamlToUpdateRequest,yamlActivationToCreateRequest,yamlActivationToUpdateRequest,activationToYaml}from'../sdk/segment/child-segment-yaml.js';import a35_0x526ed4 from'chalk';import{existsSync,readFileSync,statSync,readdirSync}from'fs';import a35_0x186522 from'path';import*as a35_0x4dfc51 from'yaml';import{sanitizeFileName}from'../utils/string-utils.js';function tryFindTdxConfig(_0x2f4af9){try{return findTdxConfig(_0x2f4af9);}catch{return null;}}function resolveTDFolderPath(_0x312df5,_0x1ad314,_0x1c7b35){if(!_0x1ad314)return _0x312df5;return _0x312df5?_0x1c7b35+'/'+_0x312df5:_0x1c7b35;}export class SegmentPushCommand extends BaseCommand{['name']=a35_0x573744(0x84);[a35_0x573744(0x86)]=a35_0x573744(0xbd);async['execute'](_0x5caaf4){const _0x1c8156=a35_0x573744,{options:_0x199607,args:_0x358e34,tdx:_0x2b54e0}=_0x5caaf4,_0x5b4148=_0x199607,_0x26dac7=_0x199607[_0x1c8156(0xf7)],_0x1c1459=_0x358e34[0x0];let _0xf21207,_0x2ee342,_0x40dac6,_0x7e331e;if(_0x1c1459){if(existsSync(_0x1c1459)&&statSync(_0x1c1459)['isDirectory']()){const _0xd29809=tryFindTdxConfig(_0x1c1459);if(_0xd29809)_0xf21207=_0xd29809[_0x1c8156(0xd0)]['parent_segment'],_0x2ee342=_0x1c1459,_0x40dac6=_0xd29809[_0x1c8156(0xa8)];else return console[_0x1c8156(0xb7)](a35_0x526ed4[_0x1c8156(0xc4)]('Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20'+_0x1c1459+'\x0a')),console[_0x1c8156(0xb7)](a35_0x526ed4['cyan'](_0x1c8156(0xb9))),0x1;}else{if(existsSync(_0x1c1459)&&statSync(_0x1c1459)['isFile']()){const _0x55dca5=a35_0x186522[_0x1c8156(0xad)](_0x1c1459),_0x1156cb=tryFindTdxConfig(_0x55dca5);if(_0x1156cb)_0xf21207=_0x1156cb['config'][_0x1c8156(0x6e)],_0x40dac6=_0x1156cb['configDir'],_0x2ee342=_0x1156cb['configDir'],_0x7e331e=a35_0x186522[_0x1c8156(0xee)](_0x1c1459);else return console[_0x1c8156(0xb7)](a35_0x526ed4[_0x1c8156(0xc4)]('Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20'+_0x55dca5+'\x0a')),console['error'](a35_0x526ed4['cyan'](_0x1c8156(0xb9))),0x1;}else _0xf21207=_0x1c1459;}}else{const _0x5b1bfe=tryFindTdxConfig(process[_0x1c8156(0x7f)]());_0x5b1bfe?(_0xf21207=_0x5b1bfe['config'][_0x1c8156(0x6e)],_0x2ee342=process[_0x1c8156(0x7f)](),_0x40dac6=_0x5b1bfe['configDir']):_0xf21207=_0x26dac7;}if(!_0xf21207)return console['error'](a35_0x526ed4['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console['error'](_0x1c8156(0xed)),console[_0x1c8156(0xb7)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent'),console[_0x1c8156(0xb7)](_0x1c8156(0xd4)),0x1;const _0x4bb15f=_0x2ee342||getSegmentRootDir(sanitizeFileName(_0xf21207)),_0x227337=_0x40dac6||_0x4bb15f,_0x404a9e=a35_0x186522[_0x1c8156(0xca)](_0x227337,_0x4bb15f),_0x5dcff4=_0x404a9e!==''&&_0x404a9e!=='.';if(!existsSync(_0x4bb15f))return console[_0x1c8156(0xb7)](a35_0x526ed4[_0x1c8156(0xc4)](_0x1c8156(0xc9)+_0x4bb15f+'\x0a')),console[_0x1c8156(0xb7)](a35_0x526ed4[_0x1c8156(0x8b)](_0x1c8156(0xb9))),0x1;_0x5b4148[_0x1c8156(0x92)]&&(console[_0x1c8156(0xb7)](_0x1c8156(0x78)+_0x5b4148[_0x1c8156(0xbe)]),console[_0x1c8156(0xb7)](_0x1c8156(0xe8)+_0xf21207),console['error'](_0x1c8156(0xf3)+_0x4bb15f),_0x5dcff4&&console['error'](_0x1c8156(0xc8)+_0x404a9e));const _0x40c8fb=await withSpinner(_0x1c8156(0x88)+_0xf21207+_0x1c8156(0xd8),()=>_0x2b54e0[_0x1c8156(0x87)][_0x1c8156(0xda)](_0xf21207),{'verbose':_0x5b4148[_0x1c8156(0x92)]}),_0x4122f8=_0x40c8fb['data'],[_0x351ca8,_0x5c7997,_0x10485f]=await Promise[_0x1c8156(0xea)]([withSpinner('Fetching\x20existing\x20segments...',()=>_0x2b54e0[_0x1c8156(0x87)]['listSegments'](_0x4122f8),{'verbose':_0x5b4148[_0x1c8156(0x92)]}),withSpinner('Fetching\x20existing\x20folders...',()=>_0x2b54e0[_0x1c8156(0x87)]['listFolders'](_0x4122f8),{'verbose':_0x5b4148[_0x1c8156(0x92)]}),withSpinner(_0x1c8156(0x91),()=>_0x2b54e0[_0x1c8156(0xb4)]['buildUserMaps'](),{'verbose':_0x5b4148[_0x1c8156(0x92)]})[_0x1c8156(0xc6)](_0x578e36=>_0x578e36[_0x1c8156(0xf5)])]),_0x73686e=_0x351ca8[_0x1c8156(0xf5)],_0x57fbdd=_0x5c7997[_0x1c8156(0xf5)],{emailToId:_0x4d5d27,idToEmail:_0xb80adc}=_0x10485f,[_0x316853,_0x31f7c2]=await withSpinner(_0x1c8156(0xa2),async()=>{const _0x196eaa=_0x1c8156,[_0x13de62,_0x2c5927]=await Promise['all']([_0x2b54e0[_0x196eaa(0x73)]['buildNameToIdMap'](),_0x2b54e0[_0x196eaa(0x73)][_0x196eaa(0xa9)]()]);return[_0x13de62,_0x2c5927];},{'verbose':_0x5b4148['verbose']})[_0x1c8156(0xc6)](_0x1b0899=>_0x1b0899[_0x1c8156(0xf5)]),_0x6f5a5f=buildFolderPathToIdMap(_0x57fbdd),_0x2b39cb=new Map();for(const [_0x47f439,_0x3a6c24]of _0x6f5a5f['entries']()){_0x2b39cb[_0x1c8156(0xe2)](_0x3a6c24,_0x47f439);}const _0x3aeb97=new Map();for(const _0x460a3f of _0x73686e){const _0x735f2d=_0x460a3f[_0x1c8156(0xd9)]?_0x2b39cb[_0x1c8156(0xa6)](_0x460a3f[_0x1c8156(0xd9)][_0x1c8156(0xf1)]())||'':'',_0x53a39b=_0x735f2d+':'+_0x460a3f[_0x1c8156(0x9f)];_0x3aeb97[_0x1c8156(0xe2)](_0x53a39b,_0x460a3f);}let _0x39f0f5;if(_0x7e331e){if(!_0x7e331e[_0x1c8156(0xc1)](_0x1c8156(0x9b))&&!_0x7e331e[_0x1c8156(0xc1)](_0x1c8156(0xbc)))return console[_0x1c8156(0xb7)](a35_0x526ed4['red'](_0x1c8156(0x7e)+_0x7e331e+'\x0a')),0x1;_0x39f0f5=[_0x7e331e];}else _0x39f0f5=findYamlFiles(_0x4bb15f);if(_0x39f0f5[_0x1c8156(0xd3)]===0x0)return console['error'](a35_0x526ed4[_0x1c8156(0xc4)]('Error:\x20No\x20segment\x20YAML\x20files\x20found\x20in\x20'+_0x4bb15f+'\x0a')),console[_0x1c8156(0xb7)](a35_0x526ed4[_0x1c8156(0x8b)](_0x1c8156(0xd5))),0x1;const _0x27a31e=[];for(const _0x4336f7 of _0x39f0f5){const _0x4fb342=a35_0x186522['relative'](_0x4bb15f,a35_0x186522['dirname'](_0x4336f7)),_0x5d5024=_0x4fb342==='.'?'':_0x4fb342,_0x443aa8=readFileSync(_0x4336f7,'utf-8');try{const _0x190f3e=parseSegmentYamlFile(_0x443aa8),_0x65bb50=normalizeChildSegmentYaml(_0x190f3e);_0x27a31e[_0x1c8156(0xaf)]({'yamlConfig':_0x65bb50,'folderPath':_0x5d5024,'sourcePath':_0x4336f7});}catch(_0x5d92f9){return console[_0x1c8156(0xb7)](a35_0x526ed4[_0x1c8156(0xc4)]('Error\x20parsing\x20'+_0x4336f7+':\x20'+(_0x5d92f9 instanceof Error?_0x5d92f9['message']:_0x5d92f9))),0x1;}}if(_0x27a31e['length']===0x0)return console['error'](a35_0x526ed4[_0x1c8156(0xc3)](_0x1c8156(0xe4))),0x0;const _0x38a02d=new Map();_0x73686e[_0x1c8156(0xd3)]>0x0&&await withSpinner(_0x1c8156(0x7b),async()=>{await batchAsync(_0x73686e,async _0x73b62e=>{const _0x81d60b=a35_0x99f9,_0x4770d5=await _0x2b54e0['segment']['listActivations'](_0x4122f8,_0x73b62e['id']);_0x38a02d[_0x81d60b(0xe2)](_0x73b62e['id'],_0x4770d5);});},{'verbose':_0x5b4148[_0x1c8156(0x92)]});const _0x2db2b5=[],_0x2ee17b=new Set();for(const {yamlConfig:_0x117e22,folderPath:_0x190cf4,sourcePath:_0x4156da}of _0x27a31e){const _0x18471d=resolveTDFolderPath(_0x190cf4,_0x5dcff4,_0x404a9e),_0x1e239c=_0x18471d+':'+_0x117e22[_0x1c8156(0x9f)],_0x406aad=_0x3aeb97[_0x1c8156(0xa6)](_0x1e239c),_0x4a7eb2=_0x406aad?_0x38a02d[_0x1c8156(0xa6)](_0x406aad['id'])||[]:[];if(_0x18471d&&!_0x6f5a5f[_0x1c8156(0xa3)](_0x18471d)){const _0x316d02=_0x18471d[_0x1c8156(0x80)]('/');let _0x1cccb7='';for(const _0x5bbb98 of _0x316d02){_0x1cccb7=_0x1cccb7?_0x1cccb7+'/'+_0x5bbb98:_0x5bbb98,!_0x6f5a5f['has'](_0x1cccb7)&&_0x2ee17b[_0x1c8156(0xbb)](_0x1cccb7);}}const _0x571118=calculateActivationActions(_0x117e22[_0x1c8156(0xb3)]||[],_0x4a7eb2,_0xb80adc,_0x31f7c2),_0x56c806=segmentToYamlString(_0x117e22);let _0x3bdc7a,_0x5d4e50=![],_0x512f9d;if(_0x406aad){const _0x4840c9=segmentWithActivationsToYaml(_0x406aad,_0x4a7eb2,undefined,_0xb80adc,_0x31f7c2),_0x1188b6=segmentToYamlString(_0x4840c9);_0x3bdc7a=generateDiff(_0x1188b6,_0x56c806),_0x5d4e50=hasChanges(_0x3bdc7a),_0x5d4e50&&(_0x512f9d=formatDiffWithColors(_0x3bdc7a));}else _0x3bdc7a=generateDiff('',_0x56c806),_0x512f9d=formatDiffWithColors(_0x3bdc7a);_0x2db2b5[_0x1c8156(0xaf)]({'relativePath':_0x117e22[_0x1c8156(0x9f)],'absolutePath':_0x4156da,'yamlConfig':_0x117e22,'folderPath':_0x18471d,'existingSegment':_0x406aad,'existingActivations':_0x4a7eb2,'isNew':!_0x406aad,'hasChanges':_0x5d4e50,'diff':_0x512f9d,'activationActions':_0x571118});}let _0x3b2e87=[];if(!_0x7e331e){const _0xcb2a2=new Set();for(const {yamlConfig:_0x2b3d06,folderPath:_0x206c65}of _0x27a31e){const _0x2688ba=resolveTDFolderPath(_0x206c65,_0x5dcff4,_0x404a9e);_0xcb2a2[_0x1c8156(0xbb)](_0x2688ba+':'+_0x2b3d06[_0x1c8156(0x9f)]);}_0x3b2e87=_0x73686e[_0x1c8156(0x82)](_0x3f6775=>{const _0x3d58a5=_0x1c8156,_0x3664fc=_0x3f6775[_0x3d58a5(0xd9)]?_0x2b39cb[_0x3d58a5(0xa6)](_0x3f6775['segmentFolderId']['toString']())||'':'',_0xae09f=_0x3664fc+':'+_0x3f6775[_0x3d58a5(0x9f)];if(_0xcb2a2['has'](_0xae09f))return![];if(_0x5dcff4)return _0x3664fc===_0x404a9e||_0x3664fc[_0x3d58a5(0x93)](_0x404a9e+'/');return!![];});}const _0x1b3466=_0x2db2b5[_0x1c8156(0x82)](_0x112986=>_0x112986[_0x1c8156(0xe0)]),_0x53ab62=_0x2db2b5[_0x1c8156(0x82)](_0x2eb294=>!_0x2eb294[_0x1c8156(0xe0)]&&_0x2eb294[_0x1c8156(0x8c)]),_0x161829=_0x2db2b5[_0x1c8156(0x82)](_0x47583d=>!_0x47583d['isNew']&&!_0x47583d[_0x1c8156(0x8c)]),_0x1122b8=Array[_0x1c8156(0x7a)](_0x2ee17b)[_0x1c8156(0xdc)](),_0x3948c6=_0x5b4148[_0x1c8156(0xfb)]?_0x3b2e87:[],_0x543ca2=_0x2db2b5[_0x1c8156(0xba)](_0x49146f=>_0x49146f[_0x1c8156(0x97)]),_0x32405d=_0x543ca2[_0x1c8156(0x82)](_0x32968a=>_0x32968a[_0x1c8156(0xec)]===_0x1c8156(0xb6)),_0xc79009=_0x543ca2[_0x1c8156(0x82)](_0x5b1238=>_0x5b1238['type']===_0x1c8156(0x95)),_0x36d646=_0x543ca2[_0x1c8156(0x82)](_0x39ea8f=>_0x39ea8f['type']==='delete');console['error'](_0x1c8156(0x79)+_0xf21207+'\x27:');_0x1122b8['length']>0x0&&console['error']('\x20\x20'+a35_0x526ed4[_0x1c8156(0xe1)](_0x1c8156(0xa5)+_0x1122b8[_0x1c8156(0xd3)]+_0x1c8156(0xdd)));console['error']('\x20\x20'+a35_0x526ed4[_0x1c8156(0xbf)]('+\x20'+_0x1b3466['length']+_0x1c8156(0x74))),console[_0x1c8156(0xb7)]('\x20\x20'+a35_0x526ed4[_0x1c8156(0xc3)]('~\x20'+_0x53ab62['length']+_0x1c8156(0x89)));if(_0x3948c6[_0x1c8156(0xd3)]>0x0)console[_0x1c8156(0xb7)]('\x20\x20'+a35_0x526ed4[_0x1c8156(0xc4)]('-\x20'+_0x3948c6[_0x1c8156(0xd3)]+'\x20segments\x20to\x20delete'));else _0x3b2e87[_0x1c8156(0xd3)]>0x0&&!_0x5b4148['delete']&&console[_0x1c8156(0xb7)]('\x20\x20'+a35_0x526ed4['dim']('\x20\x20'+_0x3b2e87[_0x1c8156(0xd3)]+_0x1c8156(0x81)));console[_0x1c8156(0xb7)]('\x20\x20'+a35_0x526ed4[_0x1c8156(0x7c)]('=\x20'+_0x161829[_0x1c8156(0xd3)]+_0x1c8156(0xf0)));_0x543ca2[_0x1c8156(0xd3)]>0x0&&(console['error'](''),console[_0x1c8156(0xb7)](_0x1c8156(0x70)),_0x32405d[_0x1c8156(0xd3)]>0x0&&console[_0x1c8156(0xb7)]('\x20\x20\x20\x20'+a35_0x526ed4[_0x1c8156(0xbf)]('+\x20'+_0x32405d['length']+'\x20to\x20create')),_0xc79009[_0x1c8156(0xd3)]>0x0&&console[_0x1c8156(0xb7)]('\x20\x20\x20\x20'+a35_0x526ed4['yellow']('~\x20'+_0xc79009[_0x1c8156(0xd3)]+_0x1c8156(0xa7))),_0x36d646[_0x1c8156(0xd3)]>0x0&&console['error'](_0x1c8156(0xd6)+a35_0x526ed4[_0x1c8156(0xc4)]('-\x20'+_0x36d646['length']+_0x1c8156(0xef))));console[_0x1c8156(0xb7)](_0x1c8156(0xc7)+a35_0x526ed4[_0x1c8156(0x8b)](_0x4bb15f)+'\x0a');if(_0x1122b8[_0x1c8156(0xd3)]>0x0){console[_0x1c8156(0xb7)](_0x1c8156(0xb1));for(const _0x278d9c of _0x1122b8){console[_0x1c8156(0xb7)]('\x20\x20'+a35_0x526ed4[_0x1c8156(0xe1)]('+')+'\x20'+_0x278d9c);}console[_0x1c8156(0xb7)]('');}if(_0x1b3466[_0x1c8156(0xd3)]>0x0)for(const _0x261eb0 of _0x1b3466){const _0x392b1c=_0x261eb0['folderPath']?_0x261eb0[_0x1c8156(0xcd)]+'/'+_0x261eb0['yamlConfig']['name']:_0x261eb0[_0x1c8156(0x9c)][_0x1c8156(0x9f)],_0x438c61=_0x261eb0[_0x1c8156(0x9c)][_0x1c8156(0xb3)]?.[_0x1c8156(0xd3)]||0x0,_0x38b289=_0x438c61>0x0?a35_0x526ed4[_0x1c8156(0x7c)]('\x20['+_0x438c61+_0x1c8156(0x75)):'';console[_0x1c8156(0xb7)]('\x0a'+a35_0x526ed4[_0x1c8156(0xbf)](_0x1c8156(0x76))+'\x20'+_0x392b1c+_0x38b289),console[_0x1c8156(0xb7)]('─'[_0x1c8156(0xa0)](0x3c)),_0x261eb0[_0x1c8156(0xf2)]&&console[_0x1c8156(0xb7)](_0x261eb0[_0x1c8156(0xf2)]),console[_0x1c8156(0xb7)]('─'['repeat'](0x3c));}if(_0x3948c6[_0x1c8156(0xd3)]>0x0)for(const _0x3238d2 of _0x3948c6){const _0x727eea=_0x3238d2[_0x1c8156(0xd9)]?_0x2b39cb[_0x1c8156(0xa6)](_0x3238d2[_0x1c8156(0xd9)][_0x1c8156(0xf1)]())||'':'',_0x404507=_0x727eea?_0x727eea+'/'+_0x3238d2[_0x1c8156(0x9f)]:_0x3238d2['name'],_0x2c0b6e=_0x38a02d[_0x1c8156(0xa6)](_0x3238d2['id'])||[],_0x150cee=_0x2c0b6e[_0x1c8156(0xd3)]>0x0?a35_0x526ed4[_0x1c8156(0x7c)]('\x20['+_0x2c0b6e[_0x1c8156(0xd3)]+_0x1c8156(0x75)):'';console[_0x1c8156(0xb7)]('\x0a'+a35_0x526ed4[_0x1c8156(0xc4)](_0x1c8156(0x9d))+'\x20'+_0x404507+_0x150cee),console[_0x1c8156(0xb7)]('─'[_0x1c8156(0xa0)](0x3c));const _0x103aae=segmentWithActivationsToYaml(_0x3238d2,_0x2c0b6e,undefined,_0xb80adc,_0x31f7c2),_0x1dd87e=segmentToYamlString(_0x103aae),_0x379ac4=generateDiff(_0x1dd87e,'');console[_0x1c8156(0xb7)](formatDiffWithColors(_0x379ac4)),console['error']('─'['repeat'](0x3c));}const _0xc36a91=_0x2db2b5[_0x1c8156(0x82)](_0x3f72d7=>!_0x3f72d7[_0x1c8156(0xe0)]&&_0x3f72d7[_0x1c8156(0xf2)]);if(_0xc36a91[_0x1c8156(0xd3)]>0x0)for(const _0x2289ad of _0xc36a91){const _0x4a7ff9=_0x2289ad[_0x1c8156(0xcd)]?_0x2289ad['folderPath']+'/'+_0x2289ad['yamlConfig'][_0x1c8156(0x9f)]:_0x2289ad[_0x1c8156(0x9c)][_0x1c8156(0x9f)];console['error']('\x0a'+a35_0x526ed4[_0x1c8156(0xc3)](_0x1c8156(0xe3))+'\x20'+_0x4a7ff9),console[_0x1c8156(0xb7)]('─'[_0x1c8156(0xa0)](0x3c)),console[_0x1c8156(0xb7)](_0x2289ad[_0x1c8156(0xf2)]),console[_0x1c8156(0xb7)]('─'['repeat'](0x3c));}if(_0x5b4148['dryRun'])return console['error'](a35_0x526ed4['yellow'](_0x1c8156(0x8d))),0x0;const _0x26853b=_0x1b3466[_0x1c8156(0xd3)]>0x0||_0x53ab62[_0x1c8156(0xd3)]>0x0||_0x3948c6[_0x1c8156(0xd3)]>0x0,_0x4f632f=_0x543ca2[_0x1c8156(0xd3)]>0x0,_0x141513=_0x1122b8['length']>0x0;if(!_0x26853b&&!_0x4f632f&&!_0x141513)return console[_0x1c8156(0xb7)](a35_0x526ed4['green']('✔\x20All\x20segments\x20and\x20activations\x20are\x20up\x20to\x20date')),0x0;const _0x5ab61d=_0x1b3466[_0x1c8156(0xd3)]+_0x53ab62[_0x1c8156(0xd3)]+_0x3948c6['length']+_0x1122b8[_0x1c8156(0xd3)]+_0x543ca2[_0x1c8156(0xd3)];if(!_0x5b4148[_0x1c8156(0xf6)]&&_0x5ab61d>0x0){const _0x2d07ce=await confirmKey('Push\x20'+_0x5ab61d+_0x1c8156(0xcc));if(!_0x2d07ce)return console[_0x1c8156(0xb7)](_0x1c8156(0x99)),0x1;}for(const _0x3c440e of _0x1122b8){const _0x3a0fe4=_0x3c440e['split']('/'),_0x2c2988=_0x3a0fe4[_0x3a0fe4[_0x1c8156(0xd3)]-0x1],_0x38c6ea=_0x3a0fe4[_0x1c8156(0xd7)](0x0,-0x1)[_0x1c8156(0xe6)]('/'),_0x4580ea=_0x6f5a5f[_0x1c8156(0xa6)](_0x38c6ea),_0x1fe18f={'name':_0x2c2988,'parentFolderId':_0x4580ea},_0x4a3dde=await withSpinner(_0x1c8156(0xf8)+_0x3c440e+'\x27...',()=>_0x2b54e0['segment'][_0x1c8156(0xab)](_0x4122f8,_0x1fe18f),{'verbose':_0x5b4148['verbose']});_0x6f5a5f[_0x1c8156(0xe2)](_0x3c440e,_0x4a3dde[_0x1c8156(0xf5)]['id']),console[_0x1c8156(0xb7)](a35_0x526ed4[_0x1c8156(0xe1)](_0x1c8156(0xc5)+_0x3c440e+'\x27'));}let _0x1a64f2=0x0,_0x536b6c=0x0,_0x3ab7d5=0x0,_0x72ec77=0x0,_0x3c7aab=0x0,_0x38c1ad=0x0;const _0x5c3954=new Map();for(const _0x1c4d0d of _0x2db2b5){const _0x40ce2f=_0x1c4d0d[_0x1c8156(0xcd)]?_0x6f5a5f['get'](_0x1c4d0d[_0x1c8156(0xcd)]):undefined;let _0x3e75ec;try{if(_0x1c4d0d[_0x1c8156(0xe0)]){const _0x54b83b=yamlToCreateRequest(_0x1c4d0d[_0x1c8156(0x9c)],_0x40ce2f),_0x4a1f7b=await withSpinner('Creating\x20segment\x20\x27'+_0x1c4d0d['yamlConfig'][_0x1c8156(0x9f)]+'\x27...',()=>_0x2b54e0[_0x1c8156(0x87)]['createSegment'](_0x4122f8,_0x54b83b),{'verbose':_0x5b4148[_0x1c8156(0x92)]});_0x3e75ec=_0x4a1f7b[_0x1c8156(0xf5)]['id'],_0x5c3954['set'](_0x1c4d0d[_0x1c8156(0x9c)][_0x1c8156(0x9f)],_0x3e75ec),console[_0x1c8156(0xb7)](a35_0x526ed4[_0x1c8156(0xbf)](_0x1c8156(0xf9)+_0x1c4d0d[_0x1c8156(0x9c)]['name']+'\x27')),_0x1a64f2++;}else{if(_0x1c4d0d['hasChanges']){const _0x3fb3dd=yamlToUpdateRequest(_0x1c4d0d[_0x1c8156(0x9c)]);_0x40ce2f!==_0x1c4d0d[_0x1c8156(0xa4)]?.[_0x1c8156(0xd9)]&&(_0x3fb3dd[_0x1c8156(0xd9)]=_0x40ce2f?parseInt(_0x40ce2f,0xa):undefined),await withSpinner(_0x1c8156(0x9a)+_0x1c4d0d['yamlConfig']['name']+_0x1c8156(0xd8),()=>_0x2b54e0[_0x1c8156(0x87)][_0x1c8156(0x83)](_0x4122f8,_0x1c4d0d['existingSegment']['id'],_0x3fb3dd),{'verbose':_0x5b4148['verbose']}),_0x3e75ec=_0x1c4d0d[_0x1c8156(0xa4)]['id'],console[_0x1c8156(0xb7)](a35_0x526ed4['yellow']('✔\x20Updated\x20segment\x20\x27'+_0x1c4d0d[_0x1c8156(0x9c)][_0x1c8156(0x9f)]+'\x27')),_0x536b6c++;}else _0x3e75ec=_0x1c4d0d[_0x1c8156(0xa4)]['id'];}}catch(_0x1bf8cf){const _0x35a673=isHttp400Error(_0x1bf8cf),_0x4c5362=_0x35a673?ErrorCode[_0x1c8156(0xde)]:ErrorCode[_0x1c8156(0xd1)],_0x5d13ce=getErrorMessage(_0x1bf8cf);throw new SDKError(_0x4c5362,'Failed\x20to\x20'+(_0x1c4d0d['isNew']?_0x1c8156(0xb6):_0x1c8156(0x95))+_0x1c8156(0xae)+_0x1c4d0d[_0x1c8156(0x9e)]+'\x0a\x20\x20'+_0x5d13ce,_0x1bf8cf);}for(const _0x382052 of _0x1c4d0d[_0x1c8156(0x97)]){try{if(_0x382052[_0x1c8156(0xec)]===_0x1c8156(0xb6)&&_0x382052[_0x1c8156(0x77)]){const _0x4c30dc=yamlActivationToCreateRequest(_0x382052[_0x1c8156(0x77)],_0x4d5d27,_0x316853);await withSpinner('Creating\x20activation\x20\x27'+_0x382052[_0x1c8156(0x9f)]+_0x1c8156(0xd8),()=>_0x2b54e0[_0x1c8156(0x87)][_0x1c8156(0x94)](_0x4122f8,_0x3e75ec,_0x4c30dc),{'verbose':_0x5b4148[_0x1c8156(0x92)]}),console['error'](a35_0x526ed4['green'](_0x1c8156(0xac)+_0x382052[_0x1c8156(0x9f)]+'\x27')),_0x72ec77++;}else{if(_0x382052[_0x1c8156(0xec)]===_0x1c8156(0x95)&&_0x382052[_0x1c8156(0x77)]&&_0x382052[_0x1c8156(0xeb)]){const _0x5047ee=yamlActivationToUpdateRequest(_0x382052['yamlActivation'],_0x4d5d27,_0x316853);await withSpinner(_0x1c8156(0xe9)+_0x382052['name']+'\x27...',()=>_0x2b54e0['segment'][_0x1c8156(0xd2)](_0x4122f8,_0x3e75ec,_0x382052[_0x1c8156(0xeb)]['id'],_0x5047ee),{'verbose':_0x5b4148['verbose']}),console[_0x1c8156(0xb7)](a35_0x526ed4[_0x1c8156(0xc3)](_0x1c8156(0xe5)+_0x382052[_0x1c8156(0x9f)]+'\x27')),_0x3c7aab++;}else _0x382052[_0x1c8156(0xec)]===_0x1c8156(0xfb)&&_0x382052['existingActivation']&&(await withSpinner(_0x1c8156(0x72)+_0x382052['name']+_0x1c8156(0xd8),()=>_0x2b54e0[_0x1c8156(0x87)][_0x1c8156(0xcb)](_0x4122f8,_0x3e75ec,_0x382052[_0x1c8156(0xeb)]['id']),{'verbose':_0x5b4148[_0x1c8156(0x92)]}),console['error'](a35_0x526ed4[_0x1c8156(0xc4)](_0x1c8156(0xc2)+_0x382052[_0x1c8156(0x9f)]+'\x27')),_0x38c1ad++);}}catch(_0x2eb847){const _0x153b42=isHttp400Error(_0x2eb847),_0x1fff67=_0x153b42?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode[_0x1c8156(0x98)],_0x4a6ca1=getErrorMessage(_0x2eb847);throw new SDKError(_0x1fff67,_0x1c8156(0xe7)+_0x382052[_0x1c8156(0xec)]+'\x20activation\x20\x27'+_0x382052[_0x1c8156(0x9f)]+_0x1c8156(0x71)+_0x1c4d0d[_0x1c8156(0x9e)]+'\x0a\x20\x20'+_0x4a6ca1,_0x2eb847);}}}for(const _0x18a6e3 of _0x3948c6){await withSpinner(_0x1c8156(0x8e)+_0x18a6e3[_0x1c8156(0x9f)]+'\x27...',()=>_0x2b54e0[_0x1c8156(0x87)][_0x1c8156(0xf4)](_0x18a6e3['id']),{'verbose':_0x5b4148['verbose']}),console[_0x1c8156(0xb7)](a35_0x526ed4['red']('✔\x20Deleted\x20segment\x20\x27'+_0x18a6e3['name']+'\x27')),_0x3ab7d5++;}const _0x6cbb6a=[];if(_0x1a64f2>0x0)_0x6cbb6a[_0x1c8156(0xaf)](_0x1a64f2+'\x20created');if(_0x536b6c>0x0)_0x6cbb6a[_0x1c8156(0xaf)](_0x536b6c+_0x1c8156(0x8a));if(_0x3ab7d5>0x0)_0x6cbb6a['push'](_0x3ab7d5+'\x20deleted');const _0x43b2c6=[];if(_0x72ec77>0x0)_0x43b2c6[_0x1c8156(0xaf)](_0x72ec77+_0x1c8156(0xb2));if(_0x3c7aab>0x0)_0x43b2c6['push'](_0x3c7aab+_0x1c8156(0x8a));if(_0x38c1ad>0x0)_0x43b2c6['push'](_0x38c1ad+_0x1c8156(0x8f));return console[_0x1c8156(0xb7)](a35_0x526ed4[_0x1c8156(0xbf)]('\x0a✔\x20Push\x20complete')),_0x6cbb6a[_0x1c8156(0xd3)]>0x0&&console['error'](_0x1c8156(0xb5)+_0x6cbb6a[_0x1c8156(0xe6)](',\x20')),_0x43b2c6[_0x1c8156(0xd3)]>0x0&&console[_0x1c8156(0xb7)]('\x20\x20Activations:\x20'+_0x43b2c6[_0x1c8156(0xe6)](',\x20')),0x0;}}function buildFolderPathToIdMap(_0x4424d8){const _0x57536c=a35_0x573744,_0x53ac86=new Map(),_0xa315cc=new Map();for(const _0x4e6190 of _0x4424d8){_0xa315cc[_0x57536c(0xe2)](_0x4e6190['id'],_0x4e6190);}const _0x43c9ea=new Set();for(const _0x5083bf of _0x4424d8){!_0x5083bf['parentFolderId']&&_0x43c9ea[_0x57536c(0xbb)](_0x5083bf['id']);}function _0x204c49(_0x9c5a67){const _0x4bc4c6=_0x57536c;if(_0x43c9ea[_0x4bc4c6(0xa3)](_0x9c5a67['id']))return'';if(_0x9c5a67['parentFolderId']){const _0xf23eca=_0xa315cc['get'](_0x9c5a67[_0x4bc4c6(0x6f)]);if(_0xf23eca){const _0x3e3b04=_0x204c49(_0xf23eca);return _0x3e3b04?_0x3e3b04+'/'+_0x9c5a67['name']:_0x9c5a67[_0x4bc4c6(0x9f)];}}return _0x9c5a67[_0x4bc4c6(0x9f)];}for(const _0x1fad6a of _0x4424d8){const _0x5405ef=_0x204c49(_0x1fad6a);_0x53ac86[_0x57536c(0xe2)](_0x5405ef,_0x1fad6a['id']);}return _0x53ac86;}function findYamlFiles(_0x5038ab){const _0x26f2bf=[];function _0x1ad606(_0x2123c1){const _0x117043=a35_0x99f9,_0x3c2434=readdirSync(_0x2123c1,{'withFileTypes':!![]});for(const _0x59a0c8 of _0x3c2434){const _0x3a53da=a35_0x186522[_0x117043(0xe6)](_0x2123c1,_0x59a0c8[_0x117043(0x9f)]);if(_0x59a0c8[_0x117043(0xdb)]())_0x1ad606(_0x3a53da);else(_0x59a0c8[_0x117043(0x9f)][_0x117043(0xc1)]('.yml')||_0x59a0c8[_0x117043(0x9f)][_0x117043(0xc1)](_0x117043(0xbc)))&&_0x26f2bf[_0x117043(0xaf)](_0x3a53da);}}return _0x1ad606(_0x5038ab),_0x26f2bf;}function a35_0x99f9(_0x4d8b2a,_0x4391ef){_0x4d8b2a=_0x4d8b2a-0x6e;const _0x3645b7=a35_0x3645();let _0x99f981=_0x3645b7[_0x4d8b2a];return _0x99f981;}function calculateActivationActions(_0x3190ea,_0x3ee484,_0x1a99bd,_0x2746eb){const _0x277956=a35_0x573744,_0x8b813b=[],_0x5dbb3f=new Map();for(const _0x195d4e of _0x3ee484){_0x5dbb3f[_0x277956(0xe2)](_0x195d4e['name'],_0x195d4e);}const _0x5d4842=new Map();for(const _0x1d54c7 of _0x3190ea){_0x5d4842[_0x277956(0xe2)](_0x1d54c7[_0x277956(0x9f)],_0x1d54c7);}for(const _0x2350fd of _0x3190ea){const _0x59bc13=_0x5dbb3f['get'](_0x2350fd[_0x277956(0x9f)]);if(!_0x59bc13)_0x8b813b[_0x277956(0xaf)]({'type':_0x277956(0xb6),'name':_0x2350fd[_0x277956(0x9f)],'yamlActivation':_0x2350fd});else{const _0x38e028=activationToYaml(_0x59bc13,_0x1a99bd,_0x2746eb),_0x928a96=a35_0x4dfc51[_0x277956(0x85)](_0x38e028),_0x47702b=a35_0x4dfc51['stringify'](_0x2350fd);_0x928a96!==_0x47702b&&_0x8b813b[_0x277956(0xaf)]({'type':_0x277956(0x95),'name':_0x2350fd[_0x277956(0x9f)],'yamlActivation':_0x2350fd,'existingActivation':_0x59bc13});}}for(const _0x34905a of _0x3ee484){!_0x5d4842[_0x277956(0xa3)](_0x34905a['name'])&&_0x8b813b[_0x277956(0xaf)]({'type':'delete','name':_0x34905a[_0x277956(0x9f)],'existingActivation':_0x34905a});}return _0x8b813b;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a36_0x500a(_0x3007fc,_0x4949b1){_0x3007fc=_0x3007fc-0x80;const _0x99a427=a36_0x99a4();let _0x500a35=_0x99a427[_0x3007fc];return _0x500a35;}function a36_0x99a4(){const _0xff63e1=['9614108HzCpfo','Resolved\x20relative\x20path\x20to:\x20','11271240JigowQ','updateSegmentById','data','error','40852EsKIgy','Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]','4663000vCrSxZ','segmentName','5GsmfSC','length','Segment\x20ID\x20missing\x20from\x20resolved\x20path','yellow','segment:update','ruleFile','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','Error:\x20Cannot\x20update\x20','resolvePathToResource','12aBgNYS','verbose','Parent\x20ID:\x20','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','✔\x20Updated\x20segment\x20\x27','type','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','32985139zsMLuK','Segment\x20ID:\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','segment','4EdcBJC','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','segmentId','\x27...','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','folder','rule','Updating\x20segment\x20\x27','description','Update\x20existing\x20child\x20segment','Resolving\x20path\x20\x27','7526814ZymQcq','includes','execute','370742bYyEaQ','⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.','417gfkbuw','kind','parentId','27PBTKcz'];a36_0x99a4=function(){return _0xff63e1;};return a36_0x99a4();}const a36_0x47cd23=a36_0x500a;(function(_0x2ca5f9,_0x1e2cfb){const _0x433f20=a36_0x500a,_0x395992=_0x2ca5f9();while(!![]){try{const _0x21453c=-parseInt(_0x433f20(0x98))/0x1*(parseInt(_0x433f20(0xa6))/0x2)+parseInt(_0x433f20(0xa8))/0x3*(-parseInt(_0x433f20(0x80))/0x4)+-parseInt(_0x433f20(0x84))/0x5*(-parseInt(_0x433f20(0xa3))/0x6)+-parseInt(_0x433f20(0xac))/0x7+parseInt(_0x433f20(0xae))/0x8+parseInt(_0x433f20(0xab))/0x9*(-parseInt(_0x433f20(0x82))/0xa)+parseInt(_0x433f20(0x94))/0xb*(parseInt(_0x433f20(0x8d))/0xc);if(_0x21453c===_0x1e2cfb)break;else _0x395992['push'](_0x395992['shift']());}catch(_0x49fc99){_0x395992['push'](_0x395992['shift']());}}}(a36_0x99a4,0xb1e0c));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{SDKError,ErrorCode}from'../sdk/index.js';import a36_0x191cef from'chalk';export class SegmentUpdateCommand extends BaseCommand{['name']=a36_0x47cd23(0x88);[a36_0x47cd23(0xa0)]=a36_0x47cd23(0xa1);async[a36_0x47cd23(0xa5)](_0x14e899){const _0x5a064d=a36_0x47cd23;console[_0x5a064d(0xb1)](a36_0x191cef[_0x5a064d(0x87)](_0x5a064d(0xa7))),console[_0x5a064d(0xb1)](a36_0x191cef[_0x5a064d(0x87)](_0x5a064d(0x96)));const {options:_0x4cc7e5,args:_0x552992,tdx:_0x17ad10}=_0x14e899,_0x11b872=_0x4cc7e5;if(_0x552992[_0x5a064d(0x85)]===0x0)return console[_0x5a064d(0xb1)](_0x5a064d(0x99)),console[_0x5a064d(0xb1)](_0x5a064d(0x93)),console[_0x5a064d(0xb1)]('Examples:'),console['error'](_0x5a064d(0x90)),console[_0x5a064d(0xb1)](_0x5a064d(0x9c)),0x1;const _0x1fbbdd=_0x552992[0x0],_0x2bef7b=_0x4cc7e5['segmentPath'];let _0x5bbdc3=_0x1fbbdd;_0x2bef7b&&!_0x1fbbdd[_0x5a064d(0xa4)]('/')&&(_0x5bbdc3=_0x2bef7b+'/'+_0x1fbbdd,_0x11b872['verbose']&&console[_0x5a064d(0xb1)](_0x5a064d(0xad)+_0x5bbdc3));const _0x1962be=await withSpinner(_0x5a064d(0xa2)+_0x5bbdc3+_0x5a064d(0x9b),()=>_0x17ad10[_0x5a064d(0x97)][_0x5a064d(0x8c)](_0x5bbdc3),{'verbose':_0x11b872['verbose']}),_0x9409d1=_0x1962be[_0x5a064d(0xb0)];_0x11b872['verbose']&&console[_0x5a064d(0xb1)]('Resolved\x20type:\x20'+_0x9409d1['type']);if(_0x9409d1[_0x5a064d(0x92)]!==_0x5a064d(0x97))return console['error'](_0x5a064d(0x8b)+_0x9409d1[_0x5a064d(0x92)]+_0x5a064d(0x8a)),console[_0x5a064d(0xb1)](_0x5a064d(0x81)),0x1;if(!_0x9409d1['segmentId'])throw new SDKError(ErrorCode['INTERNAL'],_0x5a064d(0x86));const _0x11712b=_0x9409d1[_0x5a064d(0xaa)],_0x33401b=_0x9409d1[_0x5a064d(0x9a)];_0x11b872[_0x5a064d(0x8e)]&&(console['error'](_0x5a064d(0x8f)+_0x11712b),console[_0x5a064d(0xb1)](_0x5a064d(0x95)+_0x33401b));let _0x54a9f7;if(_0x11b872['folder']){const _0xca6d54=_0x11b872[_0x5a064d(0x9d)],_0x409381=await withSpinner('Resolving\x20folder\x20\x27'+_0xca6d54+'\x27...',()=>_0x17ad10['segment']['resolveFolderId'](_0x11712b,_0xca6d54),{'verbose':_0x11b872['verbose']});_0x54a9f7=parseInt(_0x409381[_0x5a064d(0xb0)],0xa),_0x11b872['verbose']&&console['error']('Resolved\x20folder\x20ID:\x20'+_0x54a9f7);}const _0x9a4d9b=await loadJSONFromOptions(_0x11b872[_0x5a064d(0x9e)],_0x11b872[_0x5a064d(0x89)]),_0x53afc2={'name':_0x11b872['name'],'description':_0x11b872[_0x5a064d(0xa0)],'rule':_0x9a4d9b,'kind':_0x11b872['kind']!==undefined?parseInt(_0x11b872[_0x5a064d(0xa9)],0xa):undefined,'segmentFolderId':_0x54a9f7},_0x1628c7=await withSpinner(_0x5a064d(0x9f)+_0x9409d1[_0x5a064d(0x83)]+_0x5a064d(0x9b),()=>_0x17ad10[_0x5a064d(0x97)][_0x5a064d(0xaf)](_0x11712b,_0x33401b,_0x53afc2),{'verbose':_0x11b872[_0x5a064d(0x8e)]}),_0x5a0c1=_0x1628c7['data'];return console[_0x5a064d(0xb1)](_0x5a064d(0x91)+_0x5a0c1['name']+'\x27'),_0x5bbdc3!==_0x1fbbdd&&console[_0x5a064d(0xb1)]('\x20\x20\x20Path:\x20'+_0x5bbdc3),await handleSDKOutput([_0x5a0c1],_0x11b872),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a37_0x50fe(_0x985a4,_0x49b580){_0x985a4=_0x985a4-0x1e5;const _0x1be2cf=a37_0x1be2();let _0x50fe79=_0x1be2cf[_0x985a4];return _0x50fe79;}const a37_0x1a3324=a37_0x50fe;(function(_0x452a27,_0x465d26){const _0x3fe744=a37_0x50fe,_0x1faf1c=_0x452a27();while(!![]){try{const _0x669c60=-parseInt(_0x3fe744(0x208))/0x1+parseInt(_0x3fe744(0x1e7))/0x2*(-parseInt(_0x3fe744(0x218))/0x3)+parseInt(_0x3fe744(0x1fd))/0x4+-parseInt(_0x3fe744(0x214))/0x5+-parseInt(_0x3fe744(0x1fc))/0x6+parseInt(_0x3fe744(0x1ea))/0x7+-parseInt(_0x3fe744(0x21e))/0x8*(-parseInt(_0x3fe744(0x202))/0x9);if(_0x669c60===_0x465d26)break;else _0x1faf1c['push'](_0x1faf1c['shift']());}catch(_0x2b89f1){_0x1faf1c['push'](_0x1faf1c['shift']());}}}(a37_0x1be2,0x70bcd));import{existsSync,statSync}from'fs';import a37_0x43aa8a from'chalk';function a37_0x1be2(){const _0x22c459=['fullPath','folderId','length','cyan','\x27...','segmentPath','slice','2876595QnFDUR','segments','parent_segment','parentId','115143RxSURz','description','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','Use\x20\x22tdx\x20context\x22\x20to\x20see\x20all\x20context\x20parameters','data','execute','24049448VpNvBm','Site:\x20','log','error','Resolved\x20path\x20type:\x20','38FMtbRt','Resolved\x20relative\x20path\x20to:\x20','folderPath','1499218oqhUmg','segment','Folder\x20ID:\x20','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Set\x20current\x20segment/folder\x20context\x20for\x20navigation','parentName','Resolving\x20path\x20\x27','site','Target\x20path:\x20','isAbsolute','Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>','red','✔\x20Context\x20set\x20to:\x20','split','Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','dim','Usage:\x20tdx\x20segment\x20use\x20<path>','5025318tdTDSh','937548tHLOSN','Examples:','Use:\x20tdx\x20segment\x20use\x20','isDirectory','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','9biAKlx','name','join','config','verbose','Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.','850858UHmgzm','resolvePathToResource','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent','green'];a37_0x1be2=function(){return _0x22c459;};return a37_0x1be2();}import{BaseCommand}from'./command.js';import{saveSessionContext}from'../core/session.js';import{withSpinner}from'../utils/spinner.js';import{parsePath,normalizePath}from'../utils/segment-path-parser.js';import{findTdxConfig}from'../utils/tdx-config.js';export class SegmentUseCommand extends BaseCommand{[a37_0x1a3324(0x203)]='segment:use';[a37_0x1a3324(0x219)]=a37_0x1a3324(0x1ee);async[a37_0x1a3324(0x21d)](_0x253ada){const _0x376a5c=a37_0x1a3324,{options:_0x4044ff,args:_0x4ca11d,tdx:_0xd3dbcc}=_0x253ada;if(_0x4ca11d['length']===0x0)return console[_0x376a5c(0x1e5)](a37_0x43aa8a[_0x376a5c(0x1f5)]('Error:\x20Path\x20is\x20required\x0a')),console[_0x376a5c(0x1e5)](_0x376a5c(0x1fb)),console[_0x376a5c(0x1e5)](_0x376a5c(0x1fe)),console[_0x376a5c(0x1e5)](_0x376a5c(0x1f9)),console['error']('\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22'),console[_0x376a5c(0x1e5)]('\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context'),console['error'](_0x376a5c(0x20b)),0x1;const _0x355880=_0x4ca11d[0x0],_0x3fcb51=_0x4044ff['session'];try{if(_0x355880==='/')return saveSessionContext({'segment_path':undefined},_0x3fcb51),console['log'](a37_0x43aa8a['green']('✔\x20Context\x20cleared.\x20Back\x20to\x20root.')),0x0;if(existsSync(_0x355880)&&statSync(_0x355880)[_0x376a5c(0x200)]()){let _0x17e7fb;try{_0x17e7fb=findTdxConfig(_0x355880);}catch{return console[_0x376a5c(0x1e5)](a37_0x43aa8a[_0x376a5c(0x1f5)](_0x376a5c(0x21a)+_0x355880)),console[_0x376a5c(0x1e5)](a37_0x43aa8a[_0x376a5c(0x210)](_0x376a5c(0x1ed))),0x1;}const _0x42a2ed=_0x17e7fb[_0x376a5c(0x205)][_0x376a5c(0x216)];return saveSessionContext({'segment_path':_0x42a2ed,'parent_segment':_0x42a2ed},_0x3fcb51),console[_0x376a5c(0x220)](a37_0x43aa8a[_0x376a5c(0x20c)](_0x376a5c(0x1f6)+a37_0x43aa8a[_0x376a5c(0x210)](_0x42a2ed))),0x0;}const _0x147d0c=_0x4044ff[_0x376a5c(0x212)];let _0x17f262=_0x355880;const _0x390861=parsePath(_0x355880);if(!_0x390861[_0x376a5c(0x1f3)]){if(!_0x147d0c)return console[_0x376a5c(0x1e5)](a37_0x43aa8a[_0x376a5c(0x1f5)]('Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.')),console[_0x376a5c(0x1e5)](a37_0x43aa8a[_0x376a5c(0x210)](_0x376a5c(0x1f4))),0x1;if(_0x355880==='..'){const _0x363326=_0x147d0c[_0x376a5c(0x1f7)]('/')[_0x376a5c(0x213)](0x0,-0x1)[_0x376a5c(0x204)]('/');_0x17f262=_0x363326||'/';}else _0x355880==='.'?_0x17f262=_0x147d0c:_0x17f262=_0x147d0c+'/'+_0x355880;_0x4044ff[_0x376a5c(0x206)]&&console[_0x376a5c(0x1e5)](_0x376a5c(0x1e8)+_0x17f262);}if(_0x17f262==='/'||_0x17f262==='')return saveSessionContext({'segment_path':undefined},_0x3fcb51),console[_0x376a5c(0x220)](a37_0x43aa8a['green'](_0x376a5c(0x20a))),0x0;_0x17f262=normalizePath(_0x17f262);const _0x6535c=parsePath(_0x17f262)[_0x376a5c(0x215)];if(_0x6535c[_0x376a5c(0x20f)]===0x0)return saveSessionContext({'segment_path':undefined},_0x3fcb51),console[_0x376a5c(0x220)](a37_0x43aa8a[_0x376a5c(0x20c)]('✔\x20Context\x20cleared.\x20Back\x20to\x20root.')),0x0;_0x4044ff[_0x376a5c(0x206)]&&(console[_0x376a5c(0x1e5)](_0x376a5c(0x21f)+_0x4044ff[_0x376a5c(0x1f1)]),console[_0x376a5c(0x1e5)](_0x376a5c(0x1f2)+_0x17f262));const _0xc13493=await withSpinner(_0x376a5c(0x1f0)+_0x17f262+_0x376a5c(0x211),()=>_0xd3dbcc['segment'][_0x376a5c(0x209)](_0x17f262),{'verbose':_0x4044ff[_0x376a5c(0x206)]}),_0x389e0c=_0xc13493[_0x376a5c(0x21c)];_0x4044ff['verbose']&&(console['error'](_0x376a5c(0x1e6)+_0x389e0c['type']),console[_0x376a5c(0x1e5)]('Parent\x20ID:\x20'+_0x389e0c[_0x376a5c(0x217)]),_0x389e0c[_0x376a5c(0x20e)]&&console[_0x376a5c(0x1e5)](_0x376a5c(0x1ec)+_0x389e0c[_0x376a5c(0x20e)]));if(_0x389e0c['type']===_0x376a5c(0x1eb))return console[_0x376a5c(0x1e5)](a37_0x43aa8a[_0x376a5c(0x1f5)](_0x376a5c(0x207))),console['error'](_0x376a5c(0x201)),console[_0x376a5c(0x1e5)](a37_0x43aa8a[_0x376a5c(0x210)](_0x376a5c(0x1ff)+_0x389e0c[_0x376a5c(0x1ef)]+(_0x389e0c['folderPath']?'/'+_0x389e0c[_0x376a5c(0x1e9)][_0x376a5c(0x204)]('/'):''))),0x1;return saveSessionContext({'segment_path':_0x389e0c[_0x376a5c(0x20d)],'parent_segment':_0x389e0c[_0x376a5c(0x1ef)]},_0x3fcb51),console[_0x376a5c(0x220)](a37_0x43aa8a[_0x376a5c(0x20c)](_0x376a5c(0x1f6)+a37_0x43aa8a[_0x376a5c(0x210)](_0x389e0c[_0x376a5c(0x20d)]))),_0x4044ff['verbose']&&(console['error'](a37_0x43aa8a[_0x376a5c(0x1fa)](_0x376a5c(0x1f8))),console['error'](a37_0x43aa8a[_0x376a5c(0x1fa)](_0x376a5c(0x21b)))),0x0;}catch(_0x258c39){throw _0x258c39;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a38_0x17fec0=a38_0x364b;(function(_0x2b4623,_0x5d36b1){const _0x412289=a38_0x364b,_0x26d831=_0x2b4623();while(!![]){try{const _0x327f61=-parseInt(_0x412289(0x113))/0x1+-parseInt(_0x412289(0x150))/0x2+parseInt(_0x412289(0x137))/0x3+-parseInt(_0x412289(0x116))/0x4*(-parseInt(_0x412289(0x140))/0x5)+parseInt(_0x412289(0x11e))/0x6+-parseInt(_0x412289(0x110))/0x7*(-parseInt(_0x412289(0x125))/0x8)+parseInt(_0x412289(0x12c))/0x9;if(_0x327f61===_0x5d36b1)break;else _0x26d831['push'](_0x26d831['shift']());}catch(_0x6d96e2){_0x26d831['push'](_0x26d831['shift']());}}}(a38_0x264f,0xd3bb4));import{BaseCommand}from'./command.js';function a38_0x364b(_0x56b300,_0x58e36b){_0x56b300=_0x56b300-0x10c;const _0x264fa2=a38_0x264f();let _0x364bcb=_0x264fa2[_0x56b300];return _0x364bcb;}import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{formatFlatList,formatTree}from'../utils/tree-formatter.js';import{getConsoleNextUrl}from'../types/endpoints.js';function a38_0x264f(){const _0x5f1a37=['870655vOxFet','\x20top-level\x20items','localeCompare','/app/ps/','Use\x20tdx\x20ps\x20list\x20to\x20see\x20available\x20parent\x20segments.','\x20\x20Cause:\x20','recursive','No\x20items\x20match\x20pattern:\x20','Recursive\x20mode:\x20enabled','sort','segments','Folder\x20ID:\x20','Error:\x20No\x20parent\x20segment\x20context\x20set.','Resolving\x20parent\x20segment\x20\x27','\x20and\x20','Error:\x20','1692328yAnejo','site','/e/','resolvePathToResource','\x20folder','log','parentId','folderId','(empty)','3815NqCnWW','Listing\x20folders\x20and\x20segments...','test','1393100gfoEdL','List\x20folders\x20and\x20child\x20segments','folder','8CXECAH','length','cause','\x27...','✔\x20Found\x20','verbose','Set\x20a\x20parent\x20segment\x20context\x20first:','listRecursive','3918156Yusbey','segment','includes',']\x20matching\x20\x27','web','Parent\x20ID:\x20','jsonl','1336sJJytn','dim','format','\x20matching\x20\x27','Folder/pattern\x20arg:\x20','✔\x20Built\x20tree\x20with\x20','listUnified','13418532eBFxtL','\x5c$&','Parent\x20segment\x20context:\x20','execute','maxDepth','json','filter','(not\x20set)','listWithPattern','data','error','1569795zndLRg','Resolving\x20path\x20\x27','replace','description','\x20segment','name','map','parentSegment','\x20\x20tdx\x20sg\x20pull\x20\x22My\x20Audience\x22'];a38_0x264f=function(){return _0x5f1a37;};return a38_0x264f();}import a38_0x31e20b from'chalk';export class SegmentsCommand extends BaseCommand{[a38_0x17fec0(0x13c)]=a38_0x17fec0(0x14a);[a38_0x17fec0(0x13a)]=a38_0x17fec0(0x114);async[a38_0x17fec0(0x12f)](_0x244d75){const _0x18c2ce=a38_0x17fec0,{options:_0x197d2f,args:_0x294052}=_0x244d75,_0x5d2484=_0x197d2f[_0x18c2ce(0x146)],_0x1b6439=_0x294052[0x0];try{const _0x2f7296=_0x197d2f[_0x18c2ce(0x13e)];_0x197d2f[_0x18c2ce(0x11b)]&&(console[_0x18c2ce(0x136)]('Site:\x20'+_0x197d2f[_0x18c2ce(0x151)]),console[_0x18c2ce(0x136)](_0x18c2ce(0x12e)+(_0x2f7296||_0x18c2ce(0x133))),_0x1b6439&&console['error'](_0x18c2ce(0x129)+_0x1b6439),_0x5d2484&&console[_0x18c2ce(0x136)](_0x18c2ce(0x148)));if(!_0x2f7296)return console[_0x18c2ce(0x136)](_0x18c2ce(0x14c)),console['error'](''),console[_0x18c2ce(0x136)](_0x18c2ce(0x11c)),console[_0x18c2ce(0x136)](_0x18c2ce(0x13f)),console[_0x18c2ce(0x136)]('\x20\x20tdx\x20sg\x20use\x20\x22My\x20Audience\x22'),console[_0x18c2ce(0x136)](''),console[_0x18c2ce(0x136)](_0x18c2ce(0x144)),0x1;const _0xac38d4=_0x1b6439&&(_0x1b6439[_0x18c2ce(0x120)]('*')||_0x1b6439[_0x18c2ce(0x120)]('?'));if(_0xac38d4)return await this['listWithPattern'](_0x244d75,_0x2f7296,_0x1b6439);const _0x6d896f=_0x1b6439?_0x2f7296+'/'+_0x1b6439:_0x2f7296;return _0x5d2484?await this['listRecursive'](_0x244d75,_0x6d896f):await this['listUnified'](_0x244d75,_0x6d896f);}catch(_0x76ec84){if(_0x76ec84 instanceof SDKError)return console[_0x18c2ce(0x136)](_0x18c2ce(0x14f)+_0x76ec84['message']),_0x76ec84['cause']&&console[_0x18c2ce(0x136)](_0x18c2ce(0x145)+_0x76ec84[_0x18c2ce(0x118)]),0x1;throw _0x76ec84;}}async[a38_0x17fec0(0x134)](_0x538e65,_0xaec0b6,_0x2142ed){const _0x2d9d42=a38_0x17fec0,{options:_0x390db0,tdx:_0x20b99b}=_0x538e65,_0x36988e=_0x390db0[_0x2d9d42(0x122)],_0x407bb3=await withSpinner(_0x2d9d42(0x14d)+_0xaec0b6+_0x2d9d42(0x119),()=>_0x20b99b[_0x2d9d42(0x11f)][_0x2d9d42(0x153)](_0xaec0b6),{'verbose':_0x390db0[_0x2d9d42(0x11b)]}),_0x419223=_0x407bb3[_0x2d9d42(0x135)],_0x127ce6=await withSpinner('Listing\x20folders\x20and\x20segments...',()=>_0x20b99b[_0x2d9d42(0x11f)][_0x2d9d42(0x12b)](_0x419223[_0x2d9d42(0x10d)],_0x419223[_0x2d9d42(0x10e)]),{'verbose':_0x390db0[_0x2d9d42(0x11b)]}),{folders:_0x307b67,segments:_0x295f70}=_0x127ce6[_0x2d9d42(0x135)],_0x4ed899=_0x2142ed[_0x2d9d42(0x139)](/[.+^${}()|[\]\\]/g,_0x2d9d42(0x12d))[_0x2d9d42(0x139)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x294aa8=new RegExp('^'+_0x4ed899+'$','i'),_0x12d725=_0x307b67['filter'](_0x3e6db3=>_0x294aa8[_0x2d9d42(0x112)](_0x3e6db3['name'])),_0x29e138=_0x295f70[_0x2d9d42(0x132)](_0x10cfd3=>_0x294aa8['test'](_0x10cfd3[_0x2d9d42(0x13c)])),_0x2125ad=_0x12d725['length']+_0x29e138[_0x2d9d42(0x117)];console[_0x2d9d42(0x136)]('✔\x20Found\x20'+_0x12d725[_0x2d9d42(0x117)]+_0x2d9d42(0x154)+(_0x12d725[_0x2d9d42(0x117)]!==0x1?'s':'')+'\x20and\x20'+_0x29e138[_0x2d9d42(0x117)]+'\x20segment'+(_0x29e138[_0x2d9d42(0x117)]!==0x1?'s':'')+_0x2d9d42(0x128)+_0x2142ed+'\x27');const _0x2b3e54=_0x57bd77=>{const _0x34c0aa=_0x2d9d42;return getConsoleNextUrl(_0x390db0[_0x34c0aa(0x151)],'/app/ps/'+_0x419223['parentId']+'/e/'+_0x57bd77);},_0x5bb570=_0x390db0[_0x2d9d42(0x127)]===_0x2d9d42(0x131)||_0x390db0[_0x2d9d42(0x127)]===_0x2d9d42(0x124);if(_0x5bb570){const _0x25ea2a=[..._0x12d725[_0x2d9d42(0x13d)](_0x368f9d=>({..._0x368f9d,'type':_0x2d9d42(0x115)})),..._0x29e138[_0x2d9d42(0x13d)](_0x5358c0=>({..._0x5358c0,'type':_0x2d9d42(0x11f),'url':_0x2b3e54(_0x5358c0['id'])}))][_0x2d9d42(0x149)]((_0x591c0a,_0x4d2157)=>_0x591c0a[_0x2d9d42(0x13c)][_0x2d9d42(0x142)](_0x4d2157['name']));await handleSDKOutput(_0x25ea2a,_0x390db0);}else{if(_0x2125ad===0x0)console[_0x2d9d42(0x10c)](_0x2d9d42(0x147)+_0x2142ed);else{console[_0x2d9d42(0x10c)](a38_0x31e20b[_0x2d9d42(0x126)]('['+_0xaec0b6+_0x2d9d42(0x121)+_0x2142ed+'\x27'));const _0x24beab=formatFlatList(_0x12d725,_0x29e138,{'showMetadata':!![],'showUrl':_0x36988e,'getSegmentUrl':_0x2b3e54});console[_0x2d9d42(0x10c)](_0x24beab);}}return 0x0;}async[a38_0x17fec0(0x12b)](_0x38dcd3,_0x1a9c4b){const _0x2272e1=a38_0x17fec0,{options:_0x5a1dc7,tdx:_0x30c36b}=_0x38dcd3,_0x468860=_0x5a1dc7[_0x2272e1(0x122)],_0x2298fe=await withSpinner(_0x2272e1(0x138)+_0x1a9c4b+'\x27...',()=>_0x30c36b[_0x2272e1(0x11f)][_0x2272e1(0x153)](_0x1a9c4b),{'verbose':_0x5a1dc7[_0x2272e1(0x11b)]}),_0x309bb9=_0x2298fe[_0x2272e1(0x135)];_0x5a1dc7[_0x2272e1(0x11b)]&&(console['error'](_0x2272e1(0x123)+_0x309bb9[_0x2272e1(0x10d)]),_0x309bb9['folderId']&&console[_0x2272e1(0x136)]('Folder\x20ID:\x20'+_0x309bb9[_0x2272e1(0x10e)]));const _0x134616=await withSpinner(_0x2272e1(0x111),()=>_0x30c36b['segment'][_0x2272e1(0x12b)](_0x309bb9[_0x2272e1(0x10d)],_0x309bb9[_0x2272e1(0x10e)]),{'verbose':_0x5a1dc7[_0x2272e1(0x11b)]}),{folders:_0xe46014,segments:_0x3fe464}=_0x134616[_0x2272e1(0x135)],_0x406910=_0xe46014[_0x2272e1(0x117)]+_0x3fe464[_0x2272e1(0x117)];console[_0x2272e1(0x136)](_0x2272e1(0x11a)+_0xe46014[_0x2272e1(0x117)]+_0x2272e1(0x154)+(_0xe46014[_0x2272e1(0x117)]!==0x1?'s':'')+_0x2272e1(0x14e)+_0x3fe464['length']+_0x2272e1(0x13b)+(_0x3fe464[_0x2272e1(0x117)]!==0x1?'s':''));const _0xd173d3=_0x5ad807=>{const _0x3c02b3=_0x2272e1;return getConsoleNextUrl(_0x5a1dc7[_0x3c02b3(0x151)],_0x3c02b3(0x143)+_0x309bb9[_0x3c02b3(0x10d)]+_0x3c02b3(0x152)+_0x5ad807);},_0x26a32c=_0x5a1dc7['format']===_0x2272e1(0x131)||_0x5a1dc7[_0x2272e1(0x127)]==='jsonl';if(_0x26a32c){const _0x27602b=[..._0xe46014['map'](_0x1ea868=>({..._0x1ea868,'type':'folder'})),..._0x3fe464[_0x2272e1(0x13d)](_0x32ec3a=>({..._0x32ec3a,'type':'segment','url':_0xd173d3(_0x32ec3a['id'])}))]['sort']((_0x2f9e38,_0x52f4eb)=>_0x2f9e38[_0x2272e1(0x13c)][_0x2272e1(0x142)](_0x52f4eb[_0x2272e1(0x13c)]));await handleSDKOutput(_0x27602b,_0x5a1dc7);}else{if(_0x406910===0x0)console[_0x2272e1(0x10c)](a38_0x31e20b[_0x2272e1(0x126)]('['+_0x1a9c4b+']')),console[_0x2272e1(0x10c)](_0x2272e1(0x10f));else{console['log'](a38_0x31e20b['dim']('['+_0x1a9c4b+']'));const _0x2c1bba=formatFlatList(_0xe46014,_0x3fe464,{'showMetadata':!![],'showUrl':_0x468860,'getSegmentUrl':_0xd173d3});console[_0x2272e1(0x10c)](_0x2c1bba);}}return 0x0;}async[a38_0x17fec0(0x11d)](_0x2b9ff6,_0x536a34){const _0x1ef38a=a38_0x17fec0,{options:_0x308195,tdx:_0x4631f5}=_0x2b9ff6,_0x2bc0fe=_0x308195[_0x1ef38a(0x122)],_0x134ff5=await withSpinner('Resolving\x20path\x20\x27'+_0x536a34+_0x1ef38a(0x119),()=>_0x4631f5[_0x1ef38a(0x11f)]['resolvePathToResource'](_0x536a34),{'verbose':_0x308195['verbose']}),_0x2ca1bc=_0x134ff5[_0x1ef38a(0x135)];_0x308195['verbose']&&(console[_0x1ef38a(0x136)]('Parent\x20ID:\x20'+_0x2ca1bc[_0x1ef38a(0x10d)]),_0x2ca1bc[_0x1ef38a(0x10e)]&&console[_0x1ef38a(0x136)](_0x1ef38a(0x14b)+_0x2ca1bc[_0x1ef38a(0x10e)]));const _0x57e96c=_0x308195[_0x1ef38a(0x130)]||0xa,_0x474497=await withSpinner('Building\x20hierarchy\x20tree...',()=>_0x4631f5['segment'][_0x1ef38a(0x11d)](_0x2ca1bc['parentId'],_0x2ca1bc[_0x1ef38a(0x10e)],0x0,_0x57e96c),{'verbose':_0x308195[_0x1ef38a(0x11b)]}),_0x18e07d=_0x474497['data'];console[_0x1ef38a(0x136)](_0x1ef38a(0x12a)+_0x18e07d[_0x1ef38a(0x117)]+_0x1ef38a(0x141));const _0x19695a=_0x5895ba=>{const _0x48b93d=_0x1ef38a;return getConsoleNextUrl(_0x308195[_0x48b93d(0x151)],_0x48b93d(0x143)+_0x2ca1bc[_0x48b93d(0x10d)]+_0x48b93d(0x152)+_0x5895ba);};if(_0x308195['format']===_0x1ef38a(0x131)||_0x308195[_0x1ef38a(0x127)]==='jsonl')await handleSDKOutput(_0x18e07d,_0x308195);else{console[_0x1ef38a(0x10c)](a38_0x31e20b['dim']('['+_0x536a34+']'));const _0x69eed5=formatTree(_0x18e07d,{'showMetadata':!![],'showUrl':_0x2bc0fe,'getSegmentUrl':_0x19695a});console[_0x1ef38a(0x10c)](_0x69eed5);}return 0x0;}}
|
|
1
|
+
const a38_0x292ed6=a38_0x34a3;(function(_0x365d84,_0x31f9e6){const _0xd5d83c=a38_0x34a3,_0x4c6d9d=_0x365d84();while(!![]){try{const _0x336c4a=parseInt(_0xd5d83c(0x1f4))/0x1*(parseInt(_0xd5d83c(0x1cc))/0x2)+-parseInt(_0xd5d83c(0x1c8))/0x3*(parseInt(_0xd5d83c(0x1ec))/0x4)+-parseInt(_0xd5d83c(0x1f3))/0x5*(parseInt(_0xd5d83c(0x1db))/0x6)+parseInt(_0xd5d83c(0x1d4))/0x7*(-parseInt(_0xd5d83c(0x1d6))/0x8)+-parseInt(_0xd5d83c(0x1cf))/0x9+-parseInt(_0xd5d83c(0x1d9))/0xa+parseInt(_0xd5d83c(0x1c6))/0xb*(parseInt(_0xd5d83c(0x1c9))/0xc);if(_0x336c4a===_0x31f9e6)break;else _0x4c6d9d['push'](_0x4c6d9d['shift']());}catch(_0x5b3911){_0x4c6d9d['push'](_0x4c6d9d['shift']());}}}(a38_0x27a2,0x86ad5));function a38_0x27a2(){const _0x24230c=['Resolving\x20parent\x20segment\x20\x27','includes','List\x20folders\x20and\x20child\x20segments','folder','json','sort','Site:\x20','listWithPattern','\x5c$&','test','Recursive\x20mode:\x20enabled','recursive','82676JIJFxS','\x20\x20tdx\x20sg\x20use\x20\x22My\x20Audience\x22','segment','✔\x20Found\x20',']\x20matching\x20\x27','map','listUnified','5vlvwFO','26ZHPpel','listRecursive','parentSegment','format','Error:\x20','Listing\x20folders\x20and\x20segments...','Building\x20hierarchy\x20tree...','cause','Error:\x20No\x20parent\x20segment\x20context\x20set.','jsonl','\x20folder','✔\x20Built\x20tree\x20with\x20','parentId','message','log','replace','error','Parent\x20segment\x20context:\x20','length','site','filter','\x27...','verbose','name','description','30974779cqlqRX','folderId','81cDMUed','12oqVPVG','/e/','resolvePathToResource','78120rhZxzM','Parent\x20ID:\x20','dim','7552224hUNyTA','\x20\x20tdx\x20sg\x20pull\x20\x22My\x20Audience\x22','web','localeCompare','No\x20items\x20match\x20pattern:\x20','28byzILH','(not\x20set)','1113944AkhUfH','Folder\x20ID:\x20','execute','2757480awmfhP','/app/ps/','6299358IjKsmg','\x20segment','Use\x20tdx\x20ps\x20list\x20to\x20see\x20available\x20parent\x20segments.','Resolving\x20path\x20\x27','data'];a38_0x27a2=function(){return _0x24230c;};return a38_0x27a2();}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a38_0x34a3(_0x4883a8,_0x280fd4){_0x4883a8=_0x4883a8-0x1c4;const _0x27a2a0=a38_0x27a2();let _0x34a347=_0x27a2a0[_0x4883a8];return _0x34a347;}import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{formatFlatList,formatTree}from'../utils/tree-formatter.js';import{getConsoleNextUrl}from'../types/endpoints.js';import a38_0x5ab810 from'chalk';export class SegmentsCommand extends BaseCommand{[a38_0x292ed6(0x1c4)]='segments';[a38_0x292ed6(0x1c5)]=a38_0x292ed6(0x1e2);async[a38_0x292ed6(0x1d8)](_0x5f181d){const _0x1a5f60=a38_0x292ed6,{options:_0x2c54b7,args:_0x5f286e}=_0x5f181d,_0x1b4e81=_0x2c54b7[_0x1a5f60(0x1eb)],_0x4c4b6d=_0x5f286e[0x0];try{const _0xe13d60=_0x2c54b7[_0x1a5f60(0x1f6)];_0x2c54b7[_0x1a5f60(0x20a)]&&(console['error'](_0x1a5f60(0x1e6)+_0x2c54b7[_0x1a5f60(0x207)]),console[_0x1a5f60(0x204)](_0x1a5f60(0x205)+(_0xe13d60||_0x1a5f60(0x1d5))),_0x4c4b6d&&console[_0x1a5f60(0x204)]('Folder/pattern\x20arg:\x20'+_0x4c4b6d),_0x1b4e81&&console['error'](_0x1a5f60(0x1ea)));if(!_0xe13d60)return console['error'](_0x1a5f60(0x1fc)),console['error'](''),console['error']('Set\x20a\x20parent\x20segment\x20context\x20first:'),console['error'](_0x1a5f60(0x1d0)),console[_0x1a5f60(0x204)](_0x1a5f60(0x1ed)),console[_0x1a5f60(0x204)](''),console[_0x1a5f60(0x204)](_0x1a5f60(0x1dd)),0x1;const _0x26aa64=_0x4c4b6d&&(_0x4c4b6d['includes']('*')||_0x4c4b6d[_0x1a5f60(0x1e1)]('?'));if(_0x26aa64)return await this[_0x1a5f60(0x1e7)](_0x5f181d,_0xe13d60,_0x4c4b6d);const _0x124f73=_0x4c4b6d?_0xe13d60+'/'+_0x4c4b6d:_0xe13d60;return _0x1b4e81?await this[_0x1a5f60(0x1f5)](_0x5f181d,_0x124f73):await this[_0x1a5f60(0x1f2)](_0x5f181d,_0x124f73);}catch(_0x1e4142){if(_0x1e4142 instanceof SDKError)return console['error'](_0x1a5f60(0x1f8)+_0x1e4142[_0x1a5f60(0x201)]),_0x1e4142[_0x1a5f60(0x1fb)]&&console['error']('\x20\x20Cause:\x20'+_0x1e4142['cause']),0x1;throw _0x1e4142;}}async['listWithPattern'](_0x748acd,_0x539d4e,_0x4fd78b){const _0x4e4c3f=a38_0x292ed6,{options:_0x3c97d1,tdx:_0x5bca1b}=_0x748acd,_0x524699=_0x3c97d1[_0x4e4c3f(0x1d1)],_0x27d766=await withSpinner(_0x4e4c3f(0x1e0)+_0x539d4e+_0x4e4c3f(0x209),()=>_0x5bca1b['segment']['resolvePathToResource'](_0x539d4e),{'verbose':_0x3c97d1[_0x4e4c3f(0x20a)]}),_0x213cc7=_0x27d766[_0x4e4c3f(0x1df)],_0x223a89=await withSpinner(_0x4e4c3f(0x1f9),()=>_0x5bca1b[_0x4e4c3f(0x1ee)][_0x4e4c3f(0x1f2)](_0x213cc7[_0x4e4c3f(0x200)],_0x213cc7[_0x4e4c3f(0x1c7)]),{'verbose':_0x3c97d1['verbose']}),{folders:_0x2b759a,segments:_0x20bc39}=_0x223a89['data'],_0x26818c=_0x4fd78b['replace'](/[.+^${}()|[\]\\]/g,_0x4e4c3f(0x1e8))[_0x4e4c3f(0x203)](/\*/g,'.*')[_0x4e4c3f(0x203)](/\?/g,'.'),_0x39ebdb=new RegExp('^'+_0x26818c+'$','i'),_0x459ba9=_0x2b759a[_0x4e4c3f(0x208)](_0x30c9a6=>_0x39ebdb['test'](_0x30c9a6[_0x4e4c3f(0x1c4)])),_0x5bed55=_0x20bc39[_0x4e4c3f(0x208)](_0x38e208=>_0x39ebdb[_0x4e4c3f(0x1e9)](_0x38e208[_0x4e4c3f(0x1c4)])),_0x4e20c2=_0x459ba9['length']+_0x5bed55[_0x4e4c3f(0x206)];console[_0x4e4c3f(0x204)](_0x4e4c3f(0x1ef)+_0x459ba9['length']+_0x4e4c3f(0x1fe)+(_0x459ba9['length']!==0x1?'s':'')+'\x20and\x20'+_0x5bed55['length']+_0x4e4c3f(0x1dc)+(_0x5bed55[_0x4e4c3f(0x206)]!==0x1?'s':'')+'\x20matching\x20\x27'+_0x4fd78b+'\x27');const _0x562865=_0x7453f=>{const _0x3be87f=_0x4e4c3f;return getConsoleNextUrl(_0x3c97d1[_0x3be87f(0x207)],_0x3be87f(0x1da)+_0x213cc7[_0x3be87f(0x200)]+_0x3be87f(0x1ca)+_0x7453f);},_0x5b737a=_0x3c97d1[_0x4e4c3f(0x1f7)]===_0x4e4c3f(0x1e4)||_0x3c97d1[_0x4e4c3f(0x1f7)]===_0x4e4c3f(0x1fd);if(_0x5b737a){const _0xe2fc83=[..._0x459ba9[_0x4e4c3f(0x1f1)](_0xaad1bd=>({..._0xaad1bd,'type':'folder'})),..._0x5bed55[_0x4e4c3f(0x1f1)](_0xdf68cf=>({..._0xdf68cf,'type':_0x4e4c3f(0x1ee),'url':_0x562865(_0xdf68cf['id'])}))][_0x4e4c3f(0x1e5)]((_0x2f4fd4,_0x275109)=>_0x2f4fd4[_0x4e4c3f(0x1c4)]['localeCompare'](_0x275109[_0x4e4c3f(0x1c4)]));await handleSDKOutput(_0xe2fc83,_0x3c97d1);}else{if(_0x4e20c2===0x0)console['log'](_0x4e4c3f(0x1d3)+_0x4fd78b);else{console[_0x4e4c3f(0x202)](a38_0x5ab810[_0x4e4c3f(0x1ce)]('['+_0x539d4e+_0x4e4c3f(0x1f0)+_0x4fd78b+'\x27'));const _0x242727=formatFlatList(_0x459ba9,_0x5bed55,{'showMetadata':!![],'showUrl':_0x524699,'getSegmentUrl':_0x562865});console[_0x4e4c3f(0x202)](_0x242727);}}return 0x0;}async['listUnified'](_0x1e5475,_0xd2f393){const _0x2fa56d=a38_0x292ed6,{options:_0x312bf7,tdx:_0x4ce1be}=_0x1e5475,_0x4cf655=_0x312bf7['web'],_0x141857=await withSpinner(_0x2fa56d(0x1de)+_0xd2f393+_0x2fa56d(0x209),()=>_0x4ce1be[_0x2fa56d(0x1ee)][_0x2fa56d(0x1cb)](_0xd2f393),{'verbose':_0x312bf7[_0x2fa56d(0x20a)]}),_0x1e9e84=_0x141857['data'];_0x312bf7[_0x2fa56d(0x20a)]&&(console[_0x2fa56d(0x204)](_0x2fa56d(0x1cd)+_0x1e9e84[_0x2fa56d(0x200)]),_0x1e9e84['folderId']&&console[_0x2fa56d(0x204)](_0x2fa56d(0x1d7)+_0x1e9e84['folderId']));const _0xc96a08=await withSpinner(_0x2fa56d(0x1f9),()=>_0x4ce1be[_0x2fa56d(0x1ee)][_0x2fa56d(0x1f2)](_0x1e9e84[_0x2fa56d(0x200)],_0x1e9e84[_0x2fa56d(0x1c7)]),{'verbose':_0x312bf7[_0x2fa56d(0x20a)]}),{folders:_0x5f2487,segments:_0x34618d}=_0xc96a08[_0x2fa56d(0x1df)],_0x485173=_0x5f2487[_0x2fa56d(0x206)]+_0x34618d[_0x2fa56d(0x206)];console[_0x2fa56d(0x204)](_0x2fa56d(0x1ef)+_0x5f2487[_0x2fa56d(0x206)]+_0x2fa56d(0x1fe)+(_0x5f2487[_0x2fa56d(0x206)]!==0x1?'s':'')+'\x20and\x20'+_0x34618d[_0x2fa56d(0x206)]+_0x2fa56d(0x1dc)+(_0x34618d['length']!==0x1?'s':''));const _0x23e0c8=_0x5c5728=>{const _0x15115d=_0x2fa56d;return getConsoleNextUrl(_0x312bf7[_0x15115d(0x207)],_0x15115d(0x1da)+_0x1e9e84[_0x15115d(0x200)]+'/e/'+_0x5c5728);},_0x2b0783=_0x312bf7[_0x2fa56d(0x1f7)]==='json'||_0x312bf7[_0x2fa56d(0x1f7)]==='jsonl';if(_0x2b0783){const _0xc46c4=[..._0x5f2487[_0x2fa56d(0x1f1)](_0x5331b6=>({..._0x5331b6,'type':_0x2fa56d(0x1e3)})),..._0x34618d[_0x2fa56d(0x1f1)](_0x853392=>({..._0x853392,'type':_0x2fa56d(0x1ee),'url':_0x23e0c8(_0x853392['id'])}))][_0x2fa56d(0x1e5)]((_0x247937,_0x5b4616)=>_0x247937[_0x2fa56d(0x1c4)][_0x2fa56d(0x1d2)](_0x5b4616[_0x2fa56d(0x1c4)]));await handleSDKOutput(_0xc46c4,_0x312bf7);}else{if(_0x485173===0x0)console[_0x2fa56d(0x202)](a38_0x5ab810[_0x2fa56d(0x1ce)]('['+_0xd2f393+']')),console[_0x2fa56d(0x202)]('(empty)');else{console[_0x2fa56d(0x202)](a38_0x5ab810[_0x2fa56d(0x1ce)]('['+_0xd2f393+']'));const _0x5de6d9=formatFlatList(_0x5f2487,_0x34618d,{'showMetadata':!![],'showUrl':_0x4cf655,'getSegmentUrl':_0x23e0c8});console[_0x2fa56d(0x202)](_0x5de6d9);}}return 0x0;}async[a38_0x292ed6(0x1f5)](_0x36d42a,_0x3e3cf6){const _0x540e1b=a38_0x292ed6,{options:_0x4d8b73,tdx:_0x427169}=_0x36d42a,_0x2ac378=_0x4d8b73[_0x540e1b(0x1d1)],_0x12463a=await withSpinner(_0x540e1b(0x1de)+_0x3e3cf6+_0x540e1b(0x209),()=>_0x427169[_0x540e1b(0x1ee)][_0x540e1b(0x1cb)](_0x3e3cf6),{'verbose':_0x4d8b73[_0x540e1b(0x20a)]}),_0x4ff694=_0x12463a[_0x540e1b(0x1df)];_0x4d8b73[_0x540e1b(0x20a)]&&(console[_0x540e1b(0x204)](_0x540e1b(0x1cd)+_0x4ff694[_0x540e1b(0x200)]),_0x4ff694[_0x540e1b(0x1c7)]&&console[_0x540e1b(0x204)](_0x540e1b(0x1d7)+_0x4ff694['folderId']));const _0x410a36=_0x4d8b73['maxDepth']||0xa,_0x5d87e3=await withSpinner(_0x540e1b(0x1fa),()=>_0x427169[_0x540e1b(0x1ee)]['listRecursive'](_0x4ff694[_0x540e1b(0x200)],_0x4ff694[_0x540e1b(0x1c7)],0x0,_0x410a36),{'verbose':_0x4d8b73[_0x540e1b(0x20a)]}),_0x47d5df=_0x5d87e3[_0x540e1b(0x1df)];console[_0x540e1b(0x204)](_0x540e1b(0x1ff)+_0x47d5df[_0x540e1b(0x206)]+'\x20top-level\x20items');const _0x55575d=_0x328769=>{const _0x51a7a4=_0x540e1b;return getConsoleNextUrl(_0x4d8b73[_0x51a7a4(0x207)],_0x51a7a4(0x1da)+_0x4ff694[_0x51a7a4(0x200)]+_0x51a7a4(0x1ca)+_0x328769);};if(_0x4d8b73[_0x540e1b(0x1f7)]===_0x540e1b(0x1e4)||_0x4d8b73[_0x540e1b(0x1f7)]===_0x540e1b(0x1fd))await handleSDKOutput(_0x47d5df,_0x4d8b73);else{console['log'](a38_0x5ab810[_0x540e1b(0x1ce)]('['+_0x3e3cf6+']'));const _0x276675=formatTree(_0x47d5df,{'showMetadata':!![],'showUrl':_0x2ac378,'getSegmentUrl':_0x55575d});console['log'](_0x276675);}return 0x0;}}
|
package/dist/commands/show.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a39_0xfcb0fe=a39_0x1d37;(function(_0x141afd,_0x8b11ea){const _0x2fba92=a39_0x1d37,_0x156563=_0x141afd();while(!![]){try{const _0x411347=-parseInt(_0x2fba92(0x1e5))/0x1+-parseInt(_0x2fba92(0x1e9))/0x2*(parseInt(_0x2fba92(0x1f0))/0x3)+-parseInt(_0x2fba92(0x1e6))/0x4*(-parseInt(_0x2fba92(0x1d0))/0x5)+-parseInt(_0x2fba92(0x1eb))/0x6*(-parseInt(_0x2fba92(0x1f8))/0x7)+-parseInt(_0x2fba92(0x1ef))/0x8*(parseInt(_0x2fba92(0x1f6))/0x9)+-parseInt(_0x2fba92(0x1e8))/0xa*(-parseInt(_0x2fba92(0x1d7))/0xb)+-parseInt(_0x2fba92(0x1dd))/0xc*(-parseInt(_0x2fba92(0x1e3))/0xd);if(_0x411347===_0x8b11ea)break;else _0x156563['push'](_0x156563['shift']());}catch(_0x2f6b93){_0x156563['push'](_0x156563['shift']());}}}(a39_0x2ebd,0xd917a));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';function a39_0x2ebd(){const _0x349a9f=['27PBgqBm','execute','301SnggNj','✔\x20Retrieved\x20','Site:\x20','show','catalog','site','...','5TxLJIc','\x20row','name','\x20\x20Cause:\x20','data','limit','Error:\x20','80454DNPlfg','\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--database\x20<database>','Too\x20many\x20arguments\x0aUsage:\x20tdx\x20show\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--database\x20<database>\x0a\x0aRun\x20\x27tdx\x20show\x20--help\x27\x20for\x20more\x20options','Table:\x20','Database:\x20','showTable','1107084RhPxKV','Catalog:\x20','Limit:\x20','error','verbose','query','195kxxFwy','validate','1363117NeyeYY','3190996GKYnll','length','350rmSHWl','104564diXTjm','Show\x20table\x20contents','115380UiMriB','Querying\x20','cause','✔\x20Query\x20successful\x20-\x200\x20rows\x20returned','328968WRTIeX','51dPafMC','Usage:\x20tdx\x20show\x20<database.table>','database','table','args','description'];a39_0x2ebd=function(){return _0x349a9f;};return a39_0x2ebd();}function a39_0x1d37(_0x5b817f,_0x1d1346){_0x5b817f=_0x5b817f-0x1cc;const _0x2ebde2=a39_0x2ebd();let _0x1d371f=_0x2ebde2[_0x5b817f];return _0x1d371f;}import{parseTableReference,validateTableDescribeReference}from'../utils/table-ref-parser.js';import{withSpinner}from'../utils/spinner.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';export class ShowCommand extends BaseCommand{[a39_0xfcb0fe(0x1d2)]=a39_0xfcb0fe(0x1cc);[a39_0xfcb0fe(0x1f5)]=a39_0xfcb0fe(0x1ea);async[a39_0xfcb0fe(0x1f7)](_0x275372){const _0x306c66=a39_0xfcb0fe;return this[_0x306c66(0x1dc)](_0x275372);}async[a39_0xfcb0fe(0x1dc)](_0x117662){const _0x500e70=a39_0xfcb0fe,{options:_0x5851d9,args:_0x154d58,tdx:_0x3cea9e}=_0x117662;let _0x56c35f;try{_0x56c35f=parseTableReference(_0x154d58[0x0]);const _0x25f7b3=_0x5851d9[_0x500e70(0x1f2)];!_0x56c35f['database']&&_0x25f7b3&&(_0x56c35f['database']=_0x25f7b3);const _0x2ef27f=validateTableDescribeReference(_0x56c35f);if(_0x2ef27f)return console[_0x500e70(0x1e0)](_0x500e70(0x1d6)+_0x2ef27f),console[_0x500e70(0x1e0)](_0x500e70(0x1f1)),console['error']('\x20\x20\x20or:\x20tdx\x20show\x20<catalog.database.table>'),console[_0x500e70(0x1e0)](_0x500e70(0x1d8)),0x1;}catch(_0x274cf9){return console['error'](_0x500e70(0x1d6)+_0x274cf9['message']),console[_0x500e70(0x1e0)](_0x500e70(0x1f1)),console[_0x500e70(0x1e0)]('\x20\x20\x20or:\x20tdx\x20show\x20<catalog.database.table>'),console[_0x500e70(0x1e0)](_0x500e70(0x1d8)),0x1;}const _0x523ba6=_0x56c35f[_0x500e70(0x1cd)],_0xb6649c=_0x56c35f[_0x500e70(0x1f2)],_0x3b54ff=_0x56c35f[_0x500e70(0x1f3)],_0x4f1ddb=resolveLimit(_0x5851d9[_0x500e70(0x1d5)],DEFAULT_DISPLAY_LIMIT);try{_0x5851d9[_0x500e70(0x1e1)]&&(console[_0x500e70(0x1e0)](_0x500e70(0x1fa)+_0x5851d9[_0x500e70(0x1ce)]),_0x523ba6&&console[_0x500e70(0x1e0)](_0x500e70(0x1de)+_0x523ba6),console[_0x500e70(0x1e0)](_0x500e70(0x1db)+_0xb6649c),console[_0x500e70(0x1e0)](_0x500e70(0x1da)+_0x3b54ff),console['error'](_0x500e70(0x1df)+_0x4f1ddb));const _0x1674dd=_0x523ba6?_0x523ba6+'.'+_0xb6649c+'.'+_0x3b54ff:_0xb6649c+'.'+_0x3b54ff,_0x3054d5=await withSpinner(_0x500e70(0x1ec)+_0x1674dd+_0x500e70(0x1cf),()=>_0x3cea9e[_0x500e70(0x1e2)]['showTable'](_0xb6649c,_0x3b54ff,_0x4f1ddb,_0x523ba6),{'verbose':_0x5851d9[_0x500e70(0x1e1)]}),_0x29e703=_0x3054d5[_0x500e70(0x1d4)],_0x175cf5=_0x29e703['data'];return _0x175cf5['length']===0x0?console[_0x500e70(0x1e0)](_0x500e70(0x1ee)):console[_0x500e70(0x1e0)](_0x500e70(0x1f9)+_0x175cf5[_0x500e70(0x1e7)]+_0x500e70(0x1d1)+(_0x175cf5['length']!==0x1?'s':'')+'\x20from\x20'+_0x1674dd),await handleSDKOutput(_0x175cf5,_0x5851d9),0x0;}catch(_0xb3489d){if(_0xb3489d instanceof SDKError)return console[_0x500e70(0x1e0)]('Error:\x20'+_0xb3489d['message']),_0xb3489d[_0x500e70(0x1ed)]&&console['error'](_0x500e70(0x1d3)+_0xb3489d[_0x500e70(0x1ed)]),0x1;throw _0xb3489d;}}[a39_0xfcb0fe(0x1e4)](_0x4a596a){const _0x2ca0f5=a39_0xfcb0fe;if(_0x4a596a[_0x2ca0f5(0x1f4)][_0x2ca0f5(0x1e7)]===0x0)return'Usage:\x20tdx\x20show\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20show\x20<catalog.database.table>\x0a\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--database\x20<database>\x0a\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--in\x20<database>\x0a\x0aRun\x20\x27tdx\x20show\x20--help\x27\x20for\x20more\x20options';if(_0x4a596a[_0x2ca0f5(0x1f4)][_0x2ca0f5(0x1e7)]>0x1)return _0x2ca0f5(0x1d9);return undefined;}}
|
package/dist/commands/tables.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a40_0x1e80(_0x1131d4,_0x1b9b45){_0x1131d4=_0x1131d4-0x7b;const _0x26bcf0=a40_0x26bc();let _0x1e8019=_0x26bcf0[_0x1131d4];return _0x1e8019;}const a40_0x3258fb=a40_0x1e80;(function(_0xb25894,_0x7122cc){const _0x1ff936=a40_0x1e80,_0x52d776=_0xb25894();while(!![]){try{const _0x2456bb=-parseInt(_0x1ff936(0x94))/0x1+-parseInt(_0x1ff936(0x97))/0x2*(parseInt(_0x1ff936(0x95))/0x3)+-parseInt(_0x1ff936(0x83))/0x4+-parseInt(_0x1ff936(0xa9))/0x5*(-parseInt(_0x1ff936(0x7c))/0x6)+parseInt(_0x1ff936(0xa2))/0x7*(-parseInt(_0x1ff936(0xa1))/0x8)+-parseInt(_0x1ff936(0x82))/0x9+parseInt(_0x1ff936(0x8a))/0xa*(parseInt(_0x1ff936(0xa6))/0xb);if(_0x2456bb===_0x7122cc)break;else _0x52d776['push'](_0x52d776['shift']());}catch(_0x892123){_0x52d776['push'](_0x52d776['shift']());}}}(a40_0x26bc,0x32242));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';function a40_0x26bc(){const _0x365d44=['Listing\x20tables...','data','\x27\x20may\x20not\x20exist\x20or\x20contains\x20no\x20tables','Database:\x20','1041470mxSpPV','site','verbose','length','\x20\x20tdx\x20tables\x20\x22mydb.*\x22\x20\x20\x20\x20\x20\x20\x20\x20->\x20all\x20tables\x20from\x20mydb','database','.*\x22','\x20\x20tdx\x20tables\x20\x22*.user*\x22\x20\x20\x20\x20\x20\x20\x20->\x20tables\x20matching\x20user*\x20across\x20databases','description','limit','6574ZLjxzy','722151DACgWd','\x20\x20tdx\x20tables\x20users\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20->\x20table\x20\x22users\x22\x20across\x20all\x20databases','2QoipDa','Database\x20\x27','table','listTables','\x20\x20Cause:\x20','\x27\x20across\x20all\x20databases.','tables','includes','Database:\x20all','\x20\x20Or:\x20\x20tdx\x20tables\x20--database\x20','8iTcUbw','3115dfHxpr','\x20table','error','Note:\x20\x27','99mnSGit','List\x20tables\x20in\x20a\x20database','cause','5LLJNpV','\x20\x20tdx\x20tables\x20--in\x20mydb\x20\x20\x20\x20\x20\x20\x20->\x20all\x20tables\x20from\x20mydb','Error:\x20','1728852CPJnje','\x20\x20Use:\x20tdx\x20tables\x20\x22','\x20\x20tdx\x20tables\x20\x22mydb.users\x22\x20\x20\x20\x20->\x20table\x20\x22users\x22\x20in\x20database\x20mydb','Table\x20pattern:\x20','message','Site:\x20','3390408PJzXcn','1582556CCJHpZ','Error:\x20Pattern\x20\x27','\x27\x20is\x20ambiguous.'];a40_0x26bc=function(){return _0x365d44;};return a40_0x26bc();}import{parseTableReference}from'../utils/table-ref-parser.js';import{DEFAULT_LISTING_LIMIT,resolveLimit}from'../utils/constants.js';import{withSpinner}from'../utils/spinner.js';export class TablesCommand extends BaseCommand{['name']=a40_0x3258fb(0x9d);[a40_0x3258fb(0x92)]=a40_0x3258fb(0xa7);async['execute'](_0x143f0f){const _0x32d61f=a40_0x3258fb,{options:_0x59bead,args:_0x551fc6,tdx:_0x163f22}=_0x143f0f;let _0x46a1f1;if(_0x551fc6['length']===0x0)_0x46a1f1={'database':undefined,'table':undefined,'original':''};else{if(_0x551fc6[_0x32d61f(0x8d)]===0x1)try{_0x46a1f1=parseTableReference(_0x551fc6[0x0]);if(_0x46a1f1[_0x32d61f(0x99)]&&!_0x46a1f1[_0x32d61f(0x8f)]&&!_0x46a1f1[_0x32d61f(0x99)][_0x32d61f(0x9e)]('*')&&!_0x46a1f1[_0x32d61f(0x99)]['includes']('?'))return console[_0x32d61f(0xa4)](_0x32d61f(0x84)+_0x551fc6[0x0]+_0x32d61f(0x85)),console['error']('Did\x20you\x20mean\x20to\x20list\x20all\x20tables\x20from\x20database\x20\x27'+_0x46a1f1[_0x32d61f(0x99)]+'\x27?'),console[_0x32d61f(0xa4)](_0x32d61f(0x7d)+_0x46a1f1['table']+_0x32d61f(0x90)),console[_0x32d61f(0xa4)]('\x20\x20Or:\x20\x20tdx\x20tables\x20--in\x20'+_0x46a1f1['table']),console[_0x32d61f(0xa4)](_0x32d61f(0xa0)+_0x46a1f1[_0x32d61f(0x99)]),console[_0x32d61f(0xa4)](''),console['error'](_0x32d61f(0xa5)+_0x551fc6[0x0]+'\x27\x20without\x20wildcards\x20would\x20search\x20for\x20tables\x20named\x20\x27'+_0x46a1f1[_0x32d61f(0x99)]+_0x32d61f(0x9c)),0x1;}catch(_0x1e328b){return console['error'](_0x32d61f(0x7b)+_0x1e328b[_0x32d61f(0x80)]),0x1;}else return console['error']('Error:\x20Too\x20many\x20arguments.\x20Use\x20single\x20argument:'),console[_0x32d61f(0xa4)](_0x32d61f(0x96)),console[_0x32d61f(0xa4)](_0x32d61f(0x8e)),console['error'](_0x32d61f(0x7e)),console[_0x32d61f(0xa4)](_0x32d61f(0x91)),console[_0x32d61f(0xa4)]('Or\x20use\x20--in\x20flag:'),console[_0x32d61f(0xa4)](_0x32d61f(0xaa)),0x1;}const _0x3ddaaa=_0x59bead[_0x32d61f(0x8f)];!_0x46a1f1['database']&&_0x3ddaaa&&(_0x46a1f1[_0x32d61f(0x8f)]=_0x3ddaaa);try{const _0x5eaade=_0x5a1ef3=>_0x5a1ef3&&(_0x5a1ef3[_0x32d61f(0x9e)]('*')||_0x5a1ef3[_0x32d61f(0x9e)]('?')),_0x1336ff=_0x5eaade(_0x46a1f1[_0x32d61f(0x8f)]);_0x59bead[_0x32d61f(0x8c)]&&(console[_0x32d61f(0xa4)](_0x32d61f(0x81)+_0x59bead[_0x32d61f(0x8b)]),_0x46a1f1[_0x32d61f(0x8f)]?_0x1336ff?console[_0x32d61f(0xa4)]('Database\x20pattern:\x20'+_0x46a1f1[_0x32d61f(0x8f)]):console[_0x32d61f(0xa4)](_0x32d61f(0x89)+_0x46a1f1[_0x32d61f(0x8f)]):console['error'](_0x32d61f(0x9f)),_0x46a1f1[_0x32d61f(0x99)]&&console[_0x32d61f(0xa4)](_0x32d61f(0x7f)+_0x46a1f1['table']));const _0x2da632=_0x46a1f1[_0x32d61f(0x8f)]&&!_0x1336ff?_0x46a1f1[_0x32d61f(0x8f)]:undefined,_0x14468c=_0x1336ff?_0x46a1f1[_0x32d61f(0x8f)]:undefined,_0x3d5a52=_0x46a1f1[_0x32d61f(0x99)],_0x4cb9d2=resolveLimit(_0x59bead[_0x32d61f(0x93)],DEFAULT_LISTING_LIMIT),_0x17afc4=await withSpinner(_0x32d61f(0x86),()=>_0x163f22['query'][_0x32d61f(0x9a)](_0x2da632,_0x3d5a52,_0x14468c,_0x4cb9d2),{'verbose':_0x59bead['verbose']}),_0x356a42=_0x17afc4[_0x32d61f(0x87)];if(_0x356a42[_0x32d61f(0x8d)]===0x0&&_0x46a1f1[_0x32d61f(0x8f)]&&!_0x1336ff)return console[_0x32d61f(0xa4)]('✖\x20No\x20tables\x20found'),console[_0x32d61f(0xa4)](_0x32d61f(0x98)+_0x46a1f1[_0x32d61f(0x8f)]+_0x32d61f(0x88)),0x1;return console['error']('✔\x20Found\x20'+_0x356a42[_0x32d61f(0x8d)]+_0x32d61f(0xa3)+(_0x356a42[_0x32d61f(0x8d)]!==0x1?'s':'')),await handleSDKOutput(_0x356a42,{..._0x59bead,'limit':_0x4cb9d2}),0x0;}catch(_0x565386){if(_0x565386 instanceof SDKError)return console[_0x32d61f(0xa4)](_0x32d61f(0x7b)+_0x565386[_0x32d61f(0x80)]),_0x565386['cause']&&console[_0x32d61f(0xa4)](_0x32d61f(0x9b)+_0x565386[_0x32d61f(0xa8)]),0x1;throw _0x565386;}}['validate'](_0x42ec40){return undefined;}}
|