@treasuredata/tdx 0.25.5 → 0.25.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.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.js +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/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/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.d.ts +40 -0
- package/dist/commands/parent-segment-command.d.ts.map +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/parent-segment-command.js.map +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-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/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.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/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.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/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.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.d.ts +12 -0
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/personalization.d.ts +105 -0
- package/dist/sdk/personalization.d.ts.map +1 -0
- package/dist/sdk/personalization.js +1 -0
- package/dist/sdk/personalization.js.map +1 -0
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.d.ts +113 -0
- package/dist/sdk/realtime.d.ts.map +1 -0
- package/dist/sdk/realtime.js +1 -0
- package/dist/sdk/realtime.js.map +1 -0
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.d.ts +42 -0
- package/dist/sdk/segment/parent-segment-preview.d.ts.map +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js.map +1 -1
- package/dist/sdk/segment/parent-segment-yaml.d.ts +2 -2
- package/dist/sdk/segment/parent-segment-yaml.d.ts.map +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js.map +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/types/parent-segment-def.d.ts +84 -0
- package/dist/sdk/segment/types/parent-segment-def.d.ts.map +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.d.ts +22 -0
- package/dist/sdk/segment.d.ts.map +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/segment.js.map +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.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-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a27_0x59a4f0=a27_0x4b12;(function(_0x356ff2,_0x587766){const _0x1dcd10=a27_0x4b12,_0x4d6dd0=_0x356ff2();while(!![]){try{const _0x31fd7b=parseInt(_0x1dcd10(0x146))/0x1+parseInt(_0x1dcd10(0x15c))/0x2*(-parseInt(_0x1dcd10(0x14a))/0x3)+parseInt(_0x1dcd10(0x1b3))/0x4+parseInt(_0x1dcd10(0x1a4))/0x5+-parseInt(_0x1dcd10(0x16a))/0x6*(-parseInt(_0x1dcd10(0x19d))/0x7)+-parseInt(_0x1dcd10(0x139))/0x8*(-parseInt(_0x1dcd10(0x19a))/0x9)+-parseInt(_0x1dcd10(0x128))/0xa;if(_0x31fd7b===_0x587766)break;else _0x4d6dd0['push'](_0x4d6dd0['shift']());}catch(_0x4ca776){_0x4d6dd0['push'](_0x4d6dd0['shift']());}}}(a27_0x2699,0x4a9f3));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a27_0x4e2542 from'chalk';async function resolveSegmentTarget(_0x21e540,_0x56146d,_0x3409ea){const _0x45414f=a27_0x4b12;if(isYamlFilePath(_0x21e540))try{const _0x338cdb=await resolveYamlFilePath(_0x21e540);return _0x3409ea&&(console[_0x45414f(0x16b)](_0x45414f(0x13d)+_0x21e540),console[_0x45414f(0x16b)](_0x45414f(0x130)+_0x338cdb[_0x45414f(0x154)]),console[_0x45414f(0x16b)](_0x45414f(0x151)+_0x338cdb[_0x45414f(0x147)]),console[_0x45414f(0x16b)](_0x45414f(0x153)+(_0x338cdb[_0x45414f(0x191)]||'(root)')),console[_0x45414f(0x16b)](_0x45414f(0x161)+_0x338cdb[_0x45414f(0x165)])),_0x338cdb[_0x45414f(0x165)];}catch(_0x4e9eeb){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x4e9eeb[_0x45414f(0x194)]);}if(!_0x56146d)throw new SDKError(ErrorCode[_0x45414f(0x183)],_0x45414f(0x1ab));return _0x56146d+'/'+_0x21e540;}export class SegmentDescribeCommand extends BaseCommand{[a27_0x59a4f0(0x1ad)]=a27_0x59a4f0(0x1bc);[a27_0x59a4f0(0x12c)]='Show\x20segment\x20or\x20folder\x20details';async[a27_0x59a4f0(0x164)](_0x125d5f){const _0x2e855e=a27_0x59a4f0,{options:_0x4f5898,args:_0x24a344,tdx:_0x4c48ee}=_0x125d5f,_0x3b7e13=_0x24a344[0x0],_0xbbf71e=!_0x3b7e13&&!!_0x4f5898[_0x2e855e(0x154)],_0x195d43=_0x3b7e13||_0x4f5898[_0x2e855e(0x154)];if(!_0x195d43)return console[_0x2e855e(0x16b)](_0x2e855e(0x176)),console[_0x2e855e(0x16b)](_0x2e855e(0x162)),console[_0x2e855e(0x16b)](_0x2e855e(0x157)),console[_0x2e855e(0x16b)](_0x2e855e(0x156)),console['error'](_0x2e855e(0x17f)),console[_0x2e855e(0x16b)](_0x2e855e(0x143)),console[_0x2e855e(0x16b)]('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0x1a324d=_0x4f5898['segmentPath'];let _0x18b20e=_0x195d43;!_0xbbf71e&&_0x1a324d&&!_0x195d43[_0x2e855e(0x155)]('/')&&(_0x18b20e=_0x1a324d+'/'+_0x195d43,_0x4f5898['verbose']&&console[_0x2e855e(0x16b)](_0x2e855e(0x190)+_0x18b20e));const _0x19a76f=await withSpinner(_0x2e855e(0x16e)+_0x18b20e+'\x27...',()=>_0x4c48ee[_0x2e855e(0x16d)][_0x2e855e(0x1af)](_0x18b20e),{'verbose':_0x4f5898[_0x2e855e(0x17d)]}),_0xbaea6f=_0x19a76f[_0x2e855e(0x135)];_0x4f5898[_0x2e855e(0x17d)]&&(console[_0x2e855e(0x16b)]('Resolved\x20type:\x20'+_0xbaea6f['type']),console['error'](_0x2e855e(0x178)+_0xbaea6f[_0x2e855e(0x168)]),_0xbaea6f['folderId']&&console[_0x2e855e(0x16b)](_0x2e855e(0x171)+_0xbaea6f[_0x2e855e(0x18c)]),_0xbaea6f['segmentId']&&console[_0x2e855e(0x16b)]('Segment\x20ID:\x20'+_0xbaea6f[_0x2e855e(0x163)]));if(_0xbaea6f[_0x2e855e(0x196)]===_0x2e855e(0x17a)){const _0x40444e=await withSpinner(_0x2e855e(0x12a),()=>_0x4c48ee[_0x2e855e(0x16d)][_0x2e855e(0x167)](_0xbaea6f[_0x2e855e(0x168)]),{'verbose':_0x4f5898[_0x2e855e(0x17d)]});await handleSingleObjectOutput(_0x40444e[_0x2e855e(0x135)],_0x4f5898);}else{if(_0xbaea6f['type']===_0x2e855e(0x193)){if(!_0xbaea6f[_0x2e855e(0x18c)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x2e855e(0x149));const _0x18d384=await withSpinner(_0x2e855e(0x13c),()=>_0x4c48ee[_0x2e855e(0x16d)][_0x2e855e(0x144)](_0xbaea6f[_0x2e855e(0x18c)]),{'verbose':_0x4f5898[_0x2e855e(0x17d)]});await handleSingleObjectOutput(_0x18d384[_0x2e855e(0x135)],_0x4f5898);}else{if(_0xbaea6f['type']===_0x2e855e(0x16d)){if(!_0xbaea6f['segmentId'])throw new SDKError(ErrorCode[_0x2e855e(0x19b)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x410dd4=await withSpinner(_0x2e855e(0x1a5),()=>_0x4c48ee[_0x2e855e(0x16d)]['getSegment'](_0xbaea6f[_0x2e855e(0x168)],_0xbaea6f[_0x2e855e(0x163)]),{'verbose':_0x4f5898['verbose']});await handleSingleObjectOutput(_0x410dd4['data'],_0x4f5898);}}}return 0x0;}catch(_0x571ed3){if(_0x571ed3 instanceof SDKError)return console[_0x2e855e(0x16b)]('Error:\x20'+_0x571ed3[_0x2e855e(0x194)]),_0x571ed3[_0x2e855e(0x160)]&&console[_0x2e855e(0x16b)](_0x2e855e(0x12e)+_0x571ed3[_0x2e855e(0x160)]),0x1;throw _0x571ed3;}}}export class SegmentShowCommand extends BaseCommand{[a27_0x59a4f0(0x1ad)]=a27_0x59a4f0(0x199);['description']='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a27_0x59a4f0(0x164)](_0x3e0868){const _0x48bf09=a27_0x59a4f0,{options:_0xcb82f8,args:_0x22626c,tdx:_0x3290ad}=_0x3e0868,_0x559e14=_0x22626c[0x0];if(!_0x559e14)return console[_0x48bf09(0x16b)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x48bf09(0x16b)](_0x48bf09(0x18f)),console[_0x48bf09(0x16b)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x48bf09(0x16b)](_0x48bf09(0x157)),console['error']('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x48bf09(0x16b)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x2b9669=_0xcb82f8['parentSegment'],_0xbbe1d3=await resolveSegmentTarget(_0x559e14,_0x2b9669,_0xcb82f8[_0x48bf09(0x17d)]);_0xcb82f8[_0x48bf09(0x17d)]&&console[_0x48bf09(0x16b)](_0x48bf09(0x197)+_0xbbe1d3);const _0x374966=await withSpinner(_0x48bf09(0x1ae)+_0x559e14+_0x48bf09(0x198),()=>_0x3290ad[_0x48bf09(0x16d)][_0x48bf09(0x1af)](_0xbbe1d3),{'verbose':_0xcb82f8[_0x48bf09(0x17d)]}),_0x3187a1=_0x374966[_0x48bf09(0x135)];_0xcb82f8[_0x48bf09(0x17d)]&&(console[_0x48bf09(0x16b)](_0x48bf09(0x185)+_0x3187a1[_0x48bf09(0x196)]),console[_0x48bf09(0x16b)](_0x48bf09(0x178)+_0x3187a1[_0x48bf09(0x168)]));if(_0x3187a1[_0x48bf09(0x196)]===_0x48bf09(0x193))return console[_0x48bf09(0x16b)](_0x48bf09(0x177)),console['error'](_0x48bf09(0x169)),0x1;if(_0x3187a1[_0x48bf09(0x196)]===_0x48bf09(0x17a))return console['error'](_0x48bf09(0x150)),console['error']('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x3187a1[_0x48bf09(0x163)])throw new SDKError(ErrorCode[_0x48bf09(0x19b)],_0x48bf09(0x15b));const _0x52156d=await withSpinner(_0x48bf09(0x12f),()=>_0x3290ad[_0x48bf09(0x16d)][_0x48bf09(0x14c)](_0x3187a1['parentId'],_0x3187a1['segmentId']),{'verbose':_0xcb82f8['verbose']});let _0x4d8b2b=_0x52156d['data'];const _0x2fd217=resolveLimit(_0xcb82f8['limit'],DEFAULT_DISPLAY_LIMIT),_0x2a004e=/\bLIMIT\s+\d+/i['test'](_0x4d8b2b);!_0x2a004e&&(_0x4d8b2b=_0x4d8b2b['trim']()[_0x48bf09(0x179)](/;+$/,''),_0x4d8b2b='SELECT\x20*\x20FROM\x20(\x0a'+_0x4d8b2b+_0x48bf09(0x140)+_0x2fd217);_0xcb82f8[_0x48bf09(0x17d)]&&console[_0x48bf09(0x16b)](_0x48bf09(0x188)+_0x4d8b2b);const _0x5dea9e=await withProgressSpinner(_0x48bf09(0x18a),async _0x2c222c=>{const _0xeef90d=_0x48bf09,_0x8a5661=await _0x3290ad[_0xeef90d(0x1a9)][_0xeef90d(0x164)](_0x4d8b2b,{'catalog':'td','schema':_0xeef90d(0x1b2),'onJobId':_0x41e3ca=>{const _0x16eb88=_0xeef90d;_0x2c222c[_0x16eb88(0x17e)](_0x41e3ca);}});return _0x8a5661;},{'verbose':_0xcb82f8[_0x48bf09(0x17d)]}),_0x37ce0f=_0x5dea9e['data'],_0x5c5e85=_0x37ce0f['jobId']?_0x48bf09(0x134)+_0x37ce0f['jobId']+']':'';return console[_0x48bf09(0x16b)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x37ce0f['stats'][_0x48bf09(0x1b9)][_0x48bf09(0x12d)]()+'\x20rows\x20'+('in\x20'+formatElapsed(_0x37ce0f[_0x48bf09(0x189)][_0x48bf09(0x170)])+_0x5c5e85)),await handleQueryOutput(_0x37ce0f,_0xcb82f8),0x0;}catch(_0x2b8fb1){if(_0x2b8fb1 instanceof SDKError)return console[_0x48bf09(0x16b)]('✖\x20Query\x20failed\x20['+_0x2b8fb1[_0x48bf09(0x159)]+']'),console[_0x48bf09(0x16b)]('\x0a'+_0x2b8fb1[_0x48bf09(0x194)]),0x1;throw _0x2b8fb1;}}}export class SegmentFolderListCommand extends BaseCommand{[a27_0x59a4f0(0x1ad)]='segment:folder:list';['description']=a27_0x59a4f0(0x14e);async[a27_0x59a4f0(0x164)](_0x502c89){const _0x45c285=a27_0x59a4f0,{options:_0x3b034b,args:_0x42f09a,tdx:_0x33a51b}=_0x502c89;if(_0x42f09a['length']===0x0)return console['error'](_0x45c285(0x142)),console['error'](_0x45c285(0x138)),0x1;const _0xdfa188=_0x42f09a[0x0];try{_0x3b034b['verbose']&&(console[_0x45c285(0x16b)](_0x45c285(0x1a8)+_0x3b034b[_0x45c285(0x19c)]),console[_0x45c285(0x16b)](_0x45c285(0x141)+_0xdfa188));const _0x44038e=await withSpinner(_0x45c285(0x1ba)+_0xdfa188+_0x45c285(0x198),()=>_0x33a51b[_0x45c285(0x16d)][_0x45c285(0x18b)](_0xdfa188),{'verbose':_0x3b034b[_0x45c285(0x17d)]}),_0x48a6ed=_0x44038e[_0x45c285(0x135)];_0x3b034b[_0x45c285(0x17d)]&&console[_0x45c285(0x16b)](_0x45c285(0x1b5)+_0x48a6ed);const _0x595dab=await withSpinner(_0x45c285(0x148)+_0xdfa188+_0x45c285(0x198),()=>_0x33a51b[_0x45c285(0x16d)][_0x45c285(0x184)](_0x48a6ed),{'verbose':_0x3b034b[_0x45c285(0x17d)]}),_0x1fa46c=_0x595dab[_0x45c285(0x135)];return console['error']('✔\x20Found\x20'+_0x1fa46c[_0x45c285(0x1b1)]+_0x45c285(0x145)+(_0x1fa46c['length']!==0x1?'s':'')),await handleSDKOutput(_0x1fa46c,_0x3b034b),0x0;}catch(_0x389c99){if(_0x389c99 instanceof SDKError)return console['error']('Error:\x20'+_0x389c99['message']),_0x389c99['cause']&&console['error'](_0x45c285(0x12e)+_0x389c99[_0x45c285(0x160)]),0x1;throw _0x389c99;}}}export class SegmentFolderShowCommand extends BaseCommand{[a27_0x59a4f0(0x1ad)]='segment:folder:show';[a27_0x59a4f0(0x12c)]=a27_0x59a4f0(0x1a1);async[a27_0x59a4f0(0x164)](_0x3d744b){const _0x3c6537=a27_0x59a4f0,{options:_0xb96f,args:_0x429064,tdx:_0x1da654}=_0x3d744b;if(_0x429064[_0x3c6537(0x1b1)]===0x0)return console[_0x3c6537(0x16b)](_0x3c6537(0x1aa)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x32217f,childId:_0x9ae997}=parseSegmentRef(_0x429064[0x0]);_0xb96f[_0x3c6537(0x17d)]&&(console['error']('Site:\x20'+_0xb96f['site']),console['error']('Parent\x20name:\x20'+_0x32217f),_0x9ae997&&console['error'](_0x3c6537(0x19f)+_0x9ae997));if(!_0x9ae997)return console[_0x3c6537(0x16b)](_0x3c6537(0x18d)),0x1;const _0x46eb12=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x32217f+'\x27...',()=>_0x1da654[_0x3c6537(0x16d)][_0x3c6537(0x18b)](_0x32217f),{'verbose':_0xb96f[_0x3c6537(0x17d)]}),_0x1d656c=_0x46eb12['data'];_0xb96f['verbose']&&console[_0x3c6537(0x16b)](_0x3c6537(0x1b5)+_0x1d656c);const _0x24a862=await withSpinner(_0x3c6537(0x1ac)+_0x9ae997+_0x3c6537(0x198),()=>_0x1da654[_0x3c6537(0x16d)]['resolveFolderId'](_0x1d656c,_0x9ae997),{'verbose':_0xb96f[_0x3c6537(0x17d)]}),_0x106a54=_0x24a862[_0x3c6537(0x135)];_0xb96f[_0x3c6537(0x17d)]&&console[_0x3c6537(0x16b)](_0x3c6537(0x17b)+_0x106a54);const _0x503bd1=await withSpinner(_0x3c6537(0x137)+_0x9ae997+_0x3c6537(0x198),()=>_0x1da654[_0x3c6537(0x16d)]['getFolder'](_0x106a54),{'verbose':_0xb96f['verbose']});return await handleSDKOutput([_0x503bd1[_0x3c6537(0x135)]],_0xb96f),0x0;}catch(_0x571e35){if(_0x571e35 instanceof SDKError)return console[_0x3c6537(0x16b)](_0x3c6537(0x133)+_0x571e35[_0x3c6537(0x194)]),_0x571e35[_0x3c6537(0x160)]&&console['error'](_0x3c6537(0x12e)+_0x571e35[_0x3c6537(0x160)]),0x1;throw _0x571e35;}}}export class SegmentSQLCommand extends BaseCommand{['name']=a27_0x59a4f0(0x16f);[a27_0x59a4f0(0x12c)]=a27_0x59a4f0(0x1a3);async[a27_0x59a4f0(0x164)](_0x3c5908){const _0xd05ca8=a27_0x59a4f0,{options:_0x20400b,args:_0x519d62,tdx:_0x3c8b73}=_0x3c5908,_0xa8f9b4=_0x519d62[0x0];if(!_0xa8f9b4)return console['error'](_0xd05ca8(0x136)),console[_0xd05ca8(0x16b)](_0xd05ca8(0x131)),console['error'](_0xd05ca8(0x1bb)),console[_0xd05ca8(0x16b)]('Examples:'),console[_0xd05ca8(0x16b)](_0xd05ca8(0x173)),console[_0xd05ca8(0x16b)](_0xd05ca8(0x127)),0x1;try{const _0x483c0f=_0x20400b['parentSegment'],_0x274418=await resolveSegmentTarget(_0xa8f9b4,_0x483c0f,_0x20400b[_0xd05ca8(0x17d)]);_0x20400b['verbose']&&console[_0xd05ca8(0x16b)](_0xd05ca8(0x197)+_0x274418);const _0x1c365b=await withSpinner(_0xd05ca8(0x1ae)+_0xa8f9b4+'\x27...',()=>_0x3c8b73['segment'][_0xd05ca8(0x1af)](_0x274418),{'verbose':_0x20400b[_0xd05ca8(0x17d)]}),_0x307252=_0x1c365b[_0xd05ca8(0x135)];_0x20400b[_0xd05ca8(0x17d)]&&(console['error'](_0xd05ca8(0x185)+_0x307252['type']),console[_0xd05ca8(0x16b)](_0xd05ca8(0x178)+_0x307252[_0xd05ca8(0x168)]));if(_0x307252[_0xd05ca8(0x196)]===_0xd05ca8(0x193))return console['error'](_0xd05ca8(0x15a)),console['error'](_0xd05ca8(0x1b0)),0x1;if(_0x307252[_0xd05ca8(0x196)]===_0xd05ca8(0x17a))return console[_0xd05ca8(0x16b)](_0xd05ca8(0x132)),console['error'](_0xd05ca8(0x180)),0x1;if(!_0x307252[_0xd05ca8(0x163)])throw new SDKError(ErrorCode[_0xd05ca8(0x19b)],_0xd05ca8(0x15b));const _0x4c74d1=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x3c8b73['segment'][_0xd05ca8(0x14c)](_0x307252['parentId'],_0x307252[_0xd05ca8(0x163)]),{'verbose':_0x20400b[_0xd05ca8(0x17d)]}),_0x222578=_0x4c74d1[_0xd05ca8(0x135)];return _0x20400b[_0xd05ca8(0x15d)]===_0xd05ca8(0x13a)||_0x20400b[_0xd05ca8(0x15d)]===_0xd05ca8(0x14f)?await handleSDKOutput([{'sql':_0x222578}],_0x20400b):console[_0xd05ca8(0x172)](_0x222578),0x0;}catch(_0x203bca){if(_0x203bca instanceof SDKError)return console[_0xd05ca8(0x16b)]('Error:\x20'+_0x203bca[_0xd05ca8(0x194)]),_0x203bca[_0xd05ca8(0x160)]&&console['error'](_0xd05ca8(0x12e)+_0x203bca['cause']),0x1;throw _0x203bca;}}}function a27_0x4b12(_0x44752e,_0xc3c5b8){_0x44752e=_0x44752e-0x127;const _0x269995=a27_0x2699();let _0x4b1273=_0x269995[_0x44752e];return _0x4b1273;}export class SegmentFolderCreateCommand extends BaseCommand{[a27_0x59a4f0(0x1ad)]='segment:folder:create';[a27_0x59a4f0(0x12c)]=a27_0x59a4f0(0x186);async[a27_0x59a4f0(0x164)](_0x141ea1){const _0x5b5daa=a27_0x59a4f0,{options:_0xb6d1ed,args:_0xe1b1d3,tdx:_0x472119}=_0x141ea1,_0x444653=_0xb6d1ed;if(_0xe1b1d3[_0x5b5daa(0x1b1)]<0x2)return console[_0x5b5daa(0x16b)](_0x5b5daa(0x17c)),console[_0x5b5daa(0x16b)](_0x5b5daa(0x1a0)),0x1;const _0x485c2f=_0xe1b1d3[0x0],_0x4477c8=_0xe1b1d3[0x1];_0x444653[_0x5b5daa(0x17d)]&&(console['error'](_0x5b5daa(0x1a8)+_0x444653[_0x5b5daa(0x19c)]),console['error'](_0x5b5daa(0x16c)+_0x485c2f),console[_0x5b5daa(0x16b)](_0x5b5daa(0x19f)+_0x4477c8));let _0x52e3d7;if(_0x444653['parentFolder']){const _0x49fb4a=_0x444653[_0x5b5daa(0x1a7)],_0x2ff359=await withSpinner(_0x5b5daa(0x1ba)+_0x485c2f+_0x5b5daa(0x198),()=>_0x472119[_0x5b5daa(0x16d)][_0x5b5daa(0x18b)](_0x485c2f),{'verbose':_0x444653[_0x5b5daa(0x17d)]}),_0x636230=_0x2ff359['data'],_0x1dbbe3=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x49fb4a+_0x5b5daa(0x198),()=>_0x472119[_0x5b5daa(0x16d)]['resolveFolderId'](_0x636230,_0x49fb4a),{'verbose':_0x444653[_0x5b5daa(0x17d)]});_0x52e3d7=_0x1dbbe3['data'],_0x444653[_0x5b5daa(0x17d)]&&console[_0x5b5daa(0x16b)](_0x5b5daa(0x1b4)+_0x52e3d7);}const _0x4f83b6={'name':_0x4477c8,'description':_0x444653[_0x5b5daa(0x12c)],'parentFolderId':_0x52e3d7},_0x21d59=await withSpinner('Creating\x20folder\x20\x27'+_0x4477c8+_0x5b5daa(0x198),()=>_0x472119[_0x5b5daa(0x16d)][_0x5b5daa(0x1b6)](_0x485c2f,_0x4f83b6),{'verbose':_0x444653['verbose']}),_0x315468=_0x21d59[_0x5b5daa(0x135)];return console['error'](_0x5b5daa(0x15e)+_0x315468['name']+_0x5b5daa(0x1b8)+_0x315468['id']),await handleSDKOutput([_0x315468],_0x444653),0x0;}}function a27_0x2699(){const _0x3ce745=['listFolders','Resolved\x20type:\x20','Create\x20segment\x20folder\x20for\x20organization','segment:desc','SQL\x20query:\x0a','stats','Executing\x20segment\x20query...','resolveParentId','folderId','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','segment:view','Usage:\x20tdx\x20sg\x20show\x20<name>','Resolved\x20relative\x20path\x20to:\x20','folderPath','SEGMENT_FOLDER_NOT_FOUND','folder','message','Segment\x20ID:\x20','type','Target\x20path:\x20','\x27...','segment:show','9UIvHhc','SEGMENT_NOT_FOUND','site','14nhLInP','Options:','Folder\x20name:\x20','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Show\x20segment\x20folder\x20details','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Get\x20SQL\x20query\x20for\x20child\x20segment','843110NQJMGt','Fetching\x20segment\x20details...','\x20Opening\x20','parentFolder','Site:\x20','query','Error:\x20Folder\x20reference\x20is\x20required','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Resolving\x20folder\x20\x27','name','Resolving\x20\x27','resolvePathToResource','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','length','information_schema','849364uFsRGr','Resolved\x20parent\x20folder\x20ID:\x20','Resolved\x20parent\x20ID:\x20','createFolder','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','\x27\x20with\x20ID:\x20','processedRows','Resolving\x20parent\x20segment\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','segment:describe','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','13436390ErpcFt','Use:\x20tdx\x20ps\x20desc','Fetching\x20parent\x20segment\x20details...','Use:\x20tdx\x20ps\x20view\x20-w','description','toLocaleString','\x20\x20Cause:\x20','Fetching\x20SQL\x20for\x20segment...','\x20\x20Parent\x20segment:\x20','Usage:\x20tdx\x20sg\x20sql\x20<name>','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20','\x20[Job\x20ID:\x20','data','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Fetching\x20folder\x20\x27','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','1162024oRpYXA','json','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Fetching\x20folder\x20details...','Resolved\x20YAML\x20file:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','cyan','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Parent\x20name:\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','getFolder','\x20folder','590115vKFBCI','segmentName','Listing\x20folders\x20for\x20parent\x20\x27','Folder\x20ID\x20missing\x20from\x20resolved\x20path','3CyuPId','web','getSegmentSQL','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','jsonl','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20Segment\x20name:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','\x20\x20Folder\x20path:\x20','parentSegment','includes','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Examples:','Show\x20child\x20segment\x20schema\x20(column\x20types)','code','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','Segment\x20ID\x20missing\x20from\x20resolved\x20path','153666KrwtgY','format','✔\x20Created\x20folder\x20\x27','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','cause','\x20\x20Full\x20path:\x20','Usage:\x20tdx\x20segment\x20describe\x20<path>','segmentId','execute','fullPath','/app/ps/','getParent','parentId','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','1829376VeJUbr','error','Parent\x20segment:\x20','segment','Resolving\x20path\x20\x27','segment:sql','elapsedTimeMillis','Folder\x20ID:\x20','log','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','/e/','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Error:\x20Path\x20or\x20name\x20is\x20required','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Parent\x20ID:\x20','replace','parent','Resolved\x20folder\x20ID:\x20','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','verbose','setJobId','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Use:\x20tdx\x20ps\x20sql','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','INVALID_ARGUMENT'];a27_0x2699=function(){return _0x3ce745;};return a27_0x2699();}export class SegmentViewCommand extends BaseCommand{[a27_0x59a4f0(0x1ad)]=a27_0x59a4f0(0x18e);[a27_0x59a4f0(0x12c)]='Show\x20folder\x20or\x20child\x20segment\x20details';async[a27_0x59a4f0(0x164)](_0x1d4a66){const _0x4e075b=a27_0x59a4f0,{options:_0x521045,args:_0x52c625,tdx:_0x1530fe}=_0x1d4a66,_0x1baedf=_0x52c625[0x0];if(!_0x1baedf)return console[_0x4e075b(0x16b)]('Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error'](_0x4e075b(0x14d)),console[_0x4e075b(0x16b)](_0x4e075b(0x182)),console[_0x4e075b(0x16b)](_0x4e075b(0x19e)),console[_0x4e075b(0x16b)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console['error'](_0x4e075b(0x157)),console[_0x4e075b(0x16b)](_0x4e075b(0x15f)),console[_0x4e075b(0x16b)](_0x4e075b(0x152)),console[_0x4e075b(0x16b)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x4e075b(0x16b)](_0x4e075b(0x181)),0x1;try{const _0x13c071=_0x521045[_0x4e075b(0x154)],_0x174007=await resolveSegmentTarget(_0x1baedf,_0x13c071,_0x521045['verbose']);_0x521045[_0x4e075b(0x17d)]&&console[_0x4e075b(0x16b)]('Target\x20path:\x20'+_0x174007);const _0x5e59c7=await withSpinner(_0x4e075b(0x1ae)+_0x1baedf+'\x27...',()=>_0x1530fe['segment'][_0x4e075b(0x1af)](_0x174007),{'verbose':_0x521045['verbose']}),_0x1c6d5f=_0x5e59c7[_0x4e075b(0x135)];_0x521045[_0x4e075b(0x17d)]&&(console['error'](_0x4e075b(0x185)+_0x1c6d5f[_0x4e075b(0x196)]),console[_0x4e075b(0x16b)]('Parent\x20ID:\x20'+_0x1c6d5f[_0x4e075b(0x168)]),_0x1c6d5f[_0x4e075b(0x18c)]&&console[_0x4e075b(0x16b)](_0x4e075b(0x171)+_0x1c6d5f[_0x4e075b(0x18c)]),_0x1c6d5f[_0x4e075b(0x163)]&&console[_0x4e075b(0x16b)](_0x4e075b(0x195)+_0x1c6d5f['segmentId']));if(_0x521045[_0x4e075b(0x14b)]){if(_0x1c6d5f[_0x4e075b(0x196)]===_0x4e075b(0x193))return console[_0x4e075b(0x16b)](_0x4e075b(0x13b)),0x1;if(_0x1c6d5f['type']===_0x4e075b(0x17a))return console[_0x4e075b(0x16b)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x4e075b(0x16b)](_0x4e075b(0x12b)),0x1;if(!_0x1c6d5f['segmentId'])throw new SDKError(ErrorCode[_0x4e075b(0x19b)],_0x4e075b(0x15b));const _0x1e8577=getConsoleNextUrl(_0x521045['site'],_0x4e075b(0x166)+_0x1c6d5f[_0x4e075b(0x168)]+_0x4e075b(0x174)+_0x1c6d5f['segmentId']);return console[_0x4e075b(0x16b)](a27_0x4e2542['green']('✔')+_0x4e075b(0x1a6)+a27_0x4e2542[_0x4e075b(0x13f)](_0x1e8577)),openBrowser(_0x1e8577),0x0;}if(_0x1c6d5f[_0x4e075b(0x196)]===_0x4e075b(0x193)){if(!_0x1c6d5f[_0x4e075b(0x18c)])throw new SDKError(ErrorCode[_0x4e075b(0x192)],_0x4e075b(0x149));const _0xe78f5d=await withSpinner(_0x4e075b(0x13c),()=>_0x1530fe[_0x4e075b(0x16d)][_0x4e075b(0x144)](_0x1c6d5f[_0x4e075b(0x18c)]),{'verbose':_0x521045[_0x4e075b(0x17d)]});await handleSingleObjectOutput(_0xe78f5d[_0x4e075b(0x135)],_0x521045);}else{if(_0x1c6d5f[_0x4e075b(0x196)]==='segment'){if(!_0x1c6d5f['segmentId'])throw new SDKError(ErrorCode[_0x4e075b(0x19b)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1cd190=await withSpinner(_0x4e075b(0x1a5),()=>_0x1530fe[_0x4e075b(0x16d)]['getSegment'](_0x1c6d5f[_0x4e075b(0x168)],_0x1c6d5f[_0x4e075b(0x163)]),{'verbose':_0x521045[_0x4e075b(0x17d)]}),_0x47b063=getConsoleNextUrl(_0x521045[_0x4e075b(0x19c)],_0x4e075b(0x166)+_0x1c6d5f[_0x4e075b(0x168)]+_0x4e075b(0x174)+_0x1c6d5f[_0x4e075b(0x163)]),_0x717a56=_0x1cd190['data'];_0x717a56['url']=_0x47b063,await handleSingleObjectOutput(_0x717a56,_0x521045);}else return console[_0x4e075b(0x16b)](_0x4e075b(0x1b7)),console['error']('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0x20e2a9){if(_0x20e2a9 instanceof SDKError)return console[_0x4e075b(0x16b)](_0x4e075b(0x133)+_0x20e2a9['message']),_0x20e2a9[_0x4e075b(0x160)]&&console[_0x4e075b(0x16b)](_0x4e075b(0x12e)+_0x20e2a9[_0x4e075b(0x160)]),0x1;throw _0x20e2a9;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a27_0x59a4f0(0x1ad)]=a27_0x59a4f0(0x187);[a27_0x59a4f0(0x12c)]=a27_0x59a4f0(0x158);async['execute'](_0x18b444){const _0x53f0c5=a27_0x59a4f0,{options:_0x13d429,args:_0x45185d,tdx:_0x59b287}=_0x18b444,_0x234806=_0x45185d[0x0];if(!_0x234806)return console[_0x53f0c5(0x16b)](_0x53f0c5(0x136)),console[_0x53f0c5(0x16b)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x53f0c5(0x16b)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console[_0x53f0c5(0x16b)]('Examples:'),console[_0x53f0c5(0x16b)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x53f0c5(0x16b)](_0x53f0c5(0x1a2)),0x1;try{const _0x19bb3c=_0x13d429[_0x53f0c5(0x154)],_0x252691=await resolveSegmentTarget(_0x234806,_0x19bb3c,_0x13d429[_0x53f0c5(0x17d)]);_0x13d429[_0x53f0c5(0x17d)]&&console[_0x53f0c5(0x16b)](_0x53f0c5(0x197)+_0x252691);const _0x55a0e9=await withSpinner(_0x53f0c5(0x1ae)+_0x234806+'\x27...',()=>_0x59b287[_0x53f0c5(0x16d)][_0x53f0c5(0x1af)](_0x252691),{'verbose':_0x13d429['verbose']}),_0x1cbe1f=_0x55a0e9['data'];_0x13d429[_0x53f0c5(0x17d)]&&(console[_0x53f0c5(0x16b)](_0x53f0c5(0x185)+_0x1cbe1f[_0x53f0c5(0x196)]),console[_0x53f0c5(0x16b)]('Parent\x20ID:\x20'+_0x1cbe1f[_0x53f0c5(0x168)]));if(_0x1cbe1f[_0x53f0c5(0x196)]===_0x53f0c5(0x193))return console[_0x53f0c5(0x16b)](_0x53f0c5(0x175)),console['error'](_0x53f0c5(0x1b0)),0x1;if(_0x1cbe1f['type']===_0x53f0c5(0x17a))return console[_0x53f0c5(0x16b)](_0x53f0c5(0x13e)),console[_0x53f0c5(0x16b)](_0x53f0c5(0x129)),0x1;if(!_0x1cbe1f[_0x53f0c5(0x163)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x53f0c5(0x15b));const _0x551450=await withSpinner(_0x53f0c5(0x12f),()=>_0x59b287[_0x53f0c5(0x16d)]['getSegmentSQL'](_0x1cbe1f[_0x53f0c5(0x168)],_0x1cbe1f[_0x53f0c5(0x163)]),{'verbose':_0x13d429[_0x53f0c5(0x17d)]}),_0x1cfade=_0x551450[_0x53f0c5(0x135)],_0x1b0b5c=await executeSchemaQuery(_0x1cfade,_0x59b287,_0x13d429);return await handleQueryOutput(_0x1b0b5c,_0x13d429),0x0;}catch(_0x3b3d69){if(_0x3b3d69 instanceof SDKError)return console[_0x53f0c5(0x16b)](_0x53f0c5(0x133)+_0x3b3d69['message']),_0x3b3d69[_0x53f0c5(0x160)]&&console['error'](_0x53f0c5(0x12e)+_0x3b3d69['cause']),0x1;throw _0x3b3d69;}}}
|
|
1
|
+
const a27_0x2cf442=a27_0x2193;function a27_0x492d(){const _0x50aa89=['Segment\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','\x20\x20Folder\x20path:\x20','jsonl','Fetching\x20folder\x20details...','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','\x27...','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','\x27\x20with\x20ID:\x20','stats','cyan','site','Use:\x20tdx\x20ps\x20view','Use:\x20tdx\x20ps\x20sql','Error:\x20','Site:\x20','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','segment:describe','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Show\x20child\x20segment\x20schema\x20(column\x20types)','parentId','Use:\x20tdx\x20ps\x20desc','setJobId','Resolved\x20parent\x20folder\x20ID:\x20','information_schema','replace','Error:\x20Path\x20or\x20name\x20is\x20required','segmentPath','Resolving\x20\x27','Use:\x20tdx\x20ps\x20view\x20-w','segmentId','message','Options:','Get\x20SQL\x20query\x20for\x20child\x20segment','resolveFolderId','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','cause','segment:folder:show','Error:\x20Folder\x20reference\x20is\x20required','Resolved\x20relative\x20path\x20to:\x20','3370570ywaoWv','processedRows','Parent\x20name:\x20','segment','Creating\x20folder\x20\x27','/app/ps/','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Folder\x20ID:\x20','Folder\x20ID\x20missing\x20from\x20resolved\x20path','\x20Opening\x20','parentSegment','in\x20','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Parent\x20segment:\x20','Fetching\x20segment\x20details...','jobId','117188OgJvIx','getSegmentSQL','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','url','parentFolder','Executing\x20segment\x20query...','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','data','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','28TUrkvx','17749860CfLVWq','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Usage:\x20tdx\x20sg\x20desc\x20<name>','\x20folder','length','SELECT\x20*\x20FROM\x20(\x0a','3745611NyTBfj','resolveParentId','\x20\x20Cause:\x20','(root)','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','type','elapsedTimeMillis','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','execute','getFolder','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Resolved\x20parent\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','Fetching\x20SQL\x20for\x20segment...','Folder\x20name:\x20','Segment\x20ID:\x20','folder','verbose','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','/e/','test','Examples:','Resolving\x20parent\x20segment\x20\x27','log','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Listing\x20folders\x20for\x20parent\x20\x27','Parent\x20ID:\x20','parent','\x20\x20Segment\x20name:\x20','folderPath','SEGMENT_NOT_FOUND','format','getParent','green','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','90Ngkyms','INVALID_ARGUMENT','includes','547211oFcvVC','Target\x20path:\x20','query','segment:folder:create','web','error','segment:sql','Resolved\x20folder\x20ID:\x20','resolvePathToResource','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','segmentName','createFolder','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','45acVfYC','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','description','Resolved\x20type:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','fullPath','folderId','segment:folder:list','code','5283936kVdDzQ','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','getSegment','name','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Show\x20folder\x20or\x20child\x20segment\x20details','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','segment:view','87183DbltcR','Resolving\x20folder\x20\x27','trim'];a27_0x492d=function(){return _0x50aa89;};return a27_0x492d();}(function(_0xf6f963,_0x2f7432){const _0x3d37e7=a27_0x2193,_0x7983df=_0xf6f963();while(!![]){try{const _0x2d671d=-parseInt(_0x3d37e7(0x225))/0x1*(-parseInt(_0x3d37e7(0x1d7))/0x2)+-parseInt(_0x3d37e7(0x212))/0x3*(parseInt(_0x3d37e7(0x1cc))/0x4)+parseInt(_0x3d37e7(0x1bc))/0x5+-parseInt(_0x3d37e7(0x202))/0x6*(parseInt(_0x3d37e7(0x205))/0x7)+-parseInt(_0x3d37e7(0x21c))/0x8+-parseInt(_0x3d37e7(0x1df))/0x9+parseInt(_0x3d37e7(0x1d8))/0xa;if(_0x2d671d===_0x2f7432)break;else _0x7983df['push'](_0x7983df['shift']());}catch(_0x3073f9){_0x7983df['push'](_0x7983df['shift']());}}}(a27_0x492d,0xef7cd));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';function a27_0x2193(_0xa7d59c,_0x33a0a6){_0xa7d59c=_0xa7d59c-0x199;const _0x492d45=a27_0x492d();let _0x2193ff=_0x492d45[_0xa7d59c];return _0x2193ff;}import a27_0x30fcaa from'chalk';async function resolveSegmentTarget(_0x3c277a,_0x504f22,_0x5b68b4){const _0x50b455=a27_0x2193;if(isYamlFilePath(_0x3c277a))try{const _0x52ef9c=await resolveYamlFilePath(_0x3c277a);return _0x5b68b4&&(console[_0x50b455(0x20a)]('Resolved\x20YAML\x20file:\x20'+_0x3c277a),console['error']('\x20\x20Parent\x20segment:\x20'+_0x52ef9c[_0x50b455(0x1c6)]),console['error'](_0x50b455(0x1fb)+_0x52ef9c[_0x50b455(0x20f)]),console[_0x50b455(0x20a)](_0x50b455(0x22a)+(_0x52ef9c[_0x50b455(0x1fc)]||_0x50b455(0x1e2))),console['error']('\x20\x20Full\x20path:\x20'+_0x52ef9c[_0x50b455(0x218)])),_0x52ef9c['fullPath'];}catch(_0x2b1467){throw new SDKError(ErrorCode[_0x50b455(0x203)],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x2b1467[_0x50b455(0x1b3)]);}if(!_0x504f22)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x50b455(0x1d9));return _0x504f22+'/'+_0x3c277a;}export class SegmentDescribeCommand extends BaseCommand{[a27_0x2cf442(0x21f)]=a27_0x2cf442(0x1a5);[a27_0x2cf442(0x215)]='Show\x20segment\x20or\x20folder\x20details';async[a27_0x2cf442(0x1e7)](_0x3ade74){const _0x2035ef=a27_0x2cf442,{options:_0x2a8216,args:_0xd8c579,tdx:_0x53aab7}=_0x3ade74,_0x1d0c63=_0xd8c579[0x0],_0x2e2c45=!_0x1d0c63&&!!_0x2a8216[_0x2035ef(0x1c6)],_0x5b3dc2=_0x1d0c63||_0x2a8216['parentSegment'];if(!_0x5b3dc2)return console[_0x2035ef(0x20a)](_0x2035ef(0x1ae)),console[_0x2035ef(0x20a)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x2035ef(0x20a)]('Examples:'),console[_0x2035ef(0x20a)](_0x2035ef(0x217)),console[_0x2035ef(0x20a)](_0x2035ef(0x1c2)),console[_0x2035ef(0x20a)](_0x2035ef(0x1ce)),console['error']('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0xdcba5e=_0x2a8216[_0x2035ef(0x1af)];let _0x465c5d=_0x5b3dc2;!_0x2e2c45&&_0xdcba5e&&!_0x5b3dc2[_0x2035ef(0x204)]('/')&&(_0x465c5d=_0xdcba5e+'/'+_0x5b3dc2,_0x2a8216[_0x2035ef(0x1f0)]&&console['error'](_0x2035ef(0x1bb)+_0x465c5d));const _0x43193d=await withSpinner('Resolving\x20path\x20\x27'+_0x465c5d+_0x2035ef(0x19a),()=>_0x53aab7[_0x2035ef(0x1bf)][_0x2035ef(0x20d)](_0x465c5d),{'verbose':_0x2a8216[_0x2035ef(0x1f0)]}),_0x20f407=_0x43193d[_0x2035ef(0x1d3)];_0x2a8216[_0x2035ef(0x1f0)]&&(console[_0x2035ef(0x20a)](_0x2035ef(0x216)+_0x20f407[_0x2035ef(0x1e4)]),console[_0x2035ef(0x20a)]('Parent\x20ID:\x20'+_0x20f407['parentId']),_0x20f407[_0x2035ef(0x219)]&&console[_0x2035ef(0x20a)]('Folder\x20ID:\x20'+_0x20f407[_0x2035ef(0x219)]),_0x20f407['segmentId']&&console[_0x2035ef(0x20a)](_0x2035ef(0x1ee)+_0x20f407[_0x2035ef(0x1b2)]));if(_0x20f407[_0x2035ef(0x1e4)]===_0x2035ef(0x1fa)){const _0x1df541=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x53aab7[_0x2035ef(0x1bf)][_0x2035ef(0x1ff)](_0x20f407[_0x2035ef(0x1a8)]),{'verbose':_0x2a8216[_0x2035ef(0x1f0)]});await handleSingleObjectOutput(_0x1df541[_0x2035ef(0x1d3)],_0x2a8216);}else{if(_0x20f407[_0x2035ef(0x1e4)]===_0x2035ef(0x1ef)){if(!_0x20f407[_0x2035ef(0x219)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x2035ef(0x1c4));const _0x9529de=await withSpinner(_0x2035ef(0x22c),()=>_0x53aab7[_0x2035ef(0x1bf)]['getFolder'](_0x20f407['folderId']),{'verbose':_0x2a8216['verbose']});await handleSingleObjectOutput(_0x9529de[_0x2035ef(0x1d3)],_0x2a8216);}else{if(_0x20f407[_0x2035ef(0x1e4)]===_0x2035ef(0x1bf)){if(!_0x20f407[_0x2035ef(0x1b2)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x133991=await withSpinner('Fetching\x20segment\x20details...',()=>_0x53aab7['segment'][_0x2035ef(0x21e)](_0x20f407[_0x2035ef(0x1a8)],_0x20f407[_0x2035ef(0x1b2)]),{'verbose':_0x2a8216[_0x2035ef(0x1f0)]});await handleSingleObjectOutput(_0x133991[_0x2035ef(0x1d3)],_0x2a8216);}}}return 0x0;}catch(_0x161c80){if(_0x161c80 instanceof SDKError)return console[_0x2035ef(0x20a)](_0x2035ef(0x1a2)+_0x161c80[_0x2035ef(0x1b3)]),_0x161c80[_0x2035ef(0x1b8)]&&console[_0x2035ef(0x20a)](_0x2035ef(0x1e1)+_0x161c80[_0x2035ef(0x1b8)]),0x1;throw _0x161c80;}}}export class SegmentShowCommand extends BaseCommand{['name']='segment:show';['description']=a27_0x2cf442(0x1e6);async[a27_0x2cf442(0x1e7)](_0x4984f1){const _0x30bac0=a27_0x2cf442,{options:_0x50a7a0,args:_0x195c85,tdx:_0x5117f4}=_0x4984f1,_0x56f942=_0x195c85[0x0];if(!_0x56f942)return console[_0x30bac0(0x20a)](_0x30bac0(0x199)),console[_0x30bac0(0x20a)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console['error'](_0x30bac0(0x1d5)),console[_0x30bac0(0x20a)](_0x30bac0(0x1f4)),console[_0x30bac0(0x20a)](_0x30bac0(0x1a6)),console['error']('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x57e325=_0x50a7a0[_0x30bac0(0x1c6)],_0x1b91ce=await resolveSegmentTarget(_0x56f942,_0x57e325,_0x50a7a0[_0x30bac0(0x1f0)]);_0x50a7a0[_0x30bac0(0x1f0)]&&console[_0x30bac0(0x20a)](_0x30bac0(0x206)+_0x1b91ce);const _0x3ec6fa=await withSpinner(_0x30bac0(0x1b0)+_0x56f942+'\x27...',()=>_0x5117f4[_0x30bac0(0x1bf)][_0x30bac0(0x20d)](_0x1b91ce),{'verbose':_0x50a7a0['verbose']}),_0x15e949=_0x3ec6fa[_0x30bac0(0x1d3)];_0x50a7a0[_0x30bac0(0x1f0)]&&(console['error']('Resolved\x20type:\x20'+_0x15e949[_0x30bac0(0x1e4)]),console[_0x30bac0(0x20a)](_0x30bac0(0x1f9)+_0x15e949[_0x30bac0(0x1a8)]));if(_0x15e949[_0x30bac0(0x1e4)]===_0x30bac0(0x1ef))return console[_0x30bac0(0x20a)](_0x30bac0(0x220)),console['error']('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x15e949[_0x30bac0(0x1e4)]===_0x30bac0(0x1fa))return console[_0x30bac0(0x20a)](_0x30bac0(0x213)),console['error']('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x15e949[_0x30bac0(0x1b2)])throw new SDKError(ErrorCode[_0x30bac0(0x1fd)],_0x30bac0(0x228));const _0x349040=await withSpinner(_0x30bac0(0x1ec),()=>_0x5117f4[_0x30bac0(0x1bf)]['getSegmentSQL'](_0x15e949[_0x30bac0(0x1a8)],_0x15e949[_0x30bac0(0x1b2)]),{'verbose':_0x50a7a0[_0x30bac0(0x1f0)]});let _0x5474ef=_0x349040['data'];const _0x486236=resolveLimit(_0x50a7a0['limit'],DEFAULT_DISPLAY_LIMIT),_0x6acec9=/\bLIMIT\s+\d+/i[_0x30bac0(0x1f3)](_0x5474ef);!_0x6acec9&&(_0x5474ef=_0x5474ef[_0x30bac0(0x227)]()[_0x30bac0(0x1ad)](/;+$/,''),_0x5474ef=_0x30bac0(0x1de)+_0x5474ef+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x486236);_0x50a7a0[_0x30bac0(0x1f0)]&&console[_0x30bac0(0x20a)]('SQL\x20query:\x0a'+_0x5474ef);const _0x2d4879=await withProgressSpinner(_0x30bac0(0x1d1),async _0x177164=>{const _0x214cb2=_0x30bac0,_0x4ea282=await _0x5117f4[_0x214cb2(0x207)][_0x214cb2(0x1e7)](_0x5474ef,{'catalog':'td','schema':_0x214cb2(0x1ac),'onJobId':_0x3416d0=>{const _0x41570d=_0x214cb2;_0x177164[_0x41570d(0x1aa)](_0x3416d0);}});return _0x4ea282;},{'verbose':_0x50a7a0[_0x30bac0(0x1f0)]}),_0xa7ca99=_0x2d4879[_0x30bac0(0x1d3)],_0x4c9943=_0xa7ca99['jobId']?'\x20[Job\x20ID:\x20'+_0xa7ca99[_0x30bac0(0x1cb)]+']':'';return console[_0x30bac0(0x20a)]('✔\x20Query\x20completed:\x20Processed\x20'+_0xa7ca99[_0x30bac0(0x19d)][_0x30bac0(0x1bd)]['toLocaleString']()+'\x20rows\x20'+(_0x30bac0(0x1c7)+formatElapsed(_0xa7ca99[_0x30bac0(0x19d)][_0x30bac0(0x1e5)])+_0x4c9943)),await handleQueryOutput(_0xa7ca99,_0x50a7a0),0x0;}catch(_0x5d10e8){if(_0x5d10e8 instanceof SDKError)return console[_0x30bac0(0x20a)]('✖\x20Query\x20failed\x20['+_0x5d10e8[_0x30bac0(0x21b)]+']'),console['error']('\x0a'+_0x5d10e8[_0x30bac0(0x1b3)]),0x1;throw _0x5d10e8;}}}export class SegmentFolderListCommand extends BaseCommand{[a27_0x2cf442(0x21f)]=a27_0x2cf442(0x21a);['description']=a27_0x2cf442(0x1d6);async['execute'](_0x4dcc19){const _0x21bc53=a27_0x2cf442,{options:_0x443fe7,args:_0x1477e6,tdx:_0x148a41}=_0x4dcc19;if(_0x1477e6[_0x21bc53(0x1dd)]===0x0)return console[_0x21bc53(0x20a)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x21bc53(0x20a)](_0x21bc53(0x1f7)),0x1;const _0x5e7bf5=_0x1477e6[0x0];try{_0x443fe7['verbose']&&(console[_0x21bc53(0x20a)](_0x21bc53(0x1a3)+_0x443fe7[_0x21bc53(0x19f)]),console[_0x21bc53(0x20a)](_0x21bc53(0x1be)+_0x5e7bf5));const _0xec29da=await withSpinner(_0x21bc53(0x1f5)+_0x5e7bf5+_0x21bc53(0x19a),()=>_0x148a41[_0x21bc53(0x1bf)][_0x21bc53(0x1e0)](_0x5e7bf5),{'verbose':_0x443fe7[_0x21bc53(0x1f0)]}),_0x8a14cd=_0xec29da[_0x21bc53(0x1d3)];_0x443fe7[_0x21bc53(0x1f0)]&&console[_0x21bc53(0x20a)](_0x21bc53(0x1ea)+_0x8a14cd);const _0x3cc730=await withSpinner(_0x21bc53(0x1f8)+_0x5e7bf5+_0x21bc53(0x19a),()=>_0x148a41[_0x21bc53(0x1bf)]['listFolders'](_0x8a14cd),{'verbose':_0x443fe7[_0x21bc53(0x1f0)]}),_0x14b650=_0x3cc730[_0x21bc53(0x1d3)];return console[_0x21bc53(0x20a)]('✔\x20Found\x20'+_0x14b650[_0x21bc53(0x1dd)]+_0x21bc53(0x1dc)+(_0x14b650[_0x21bc53(0x1dd)]!==0x1?'s':'')),await handleSDKOutput(_0x14b650,_0x443fe7),0x0;}catch(_0xc59a9e){if(_0xc59a9e instanceof SDKError)return console['error']('Error:\x20'+_0xc59a9e[_0x21bc53(0x1b3)]),_0xc59a9e[_0x21bc53(0x1b8)]&&console[_0x21bc53(0x20a)](_0x21bc53(0x1e1)+_0xc59a9e['cause']),0x1;throw _0xc59a9e;}}}export class SegmentFolderShowCommand extends BaseCommand{[a27_0x2cf442(0x21f)]=a27_0x2cf442(0x1b9);[a27_0x2cf442(0x215)]='Show\x20segment\x20folder\x20details';async['execute'](_0x38a734){const _0x24f375=a27_0x2cf442,{options:_0x10e0d5,args:_0x4beef8,tdx:_0x4f52e2}=_0x38a734;if(_0x4beef8[_0x24f375(0x1dd)]===0x0)return console[_0x24f375(0x20a)](_0x24f375(0x1ba)),console[_0x24f375(0x20a)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0x1c46fa,childId:_0x45c91d}=parseSegmentRef(_0x4beef8[0x0]);_0x10e0d5[_0x24f375(0x1f0)]&&(console[_0x24f375(0x20a)](_0x24f375(0x1a3)+_0x10e0d5[_0x24f375(0x19f)]),console[_0x24f375(0x20a)](_0x24f375(0x1be)+_0x1c46fa),_0x45c91d&&console['error'](_0x24f375(0x1ed)+_0x45c91d));if(!_0x45c91d)return console[_0x24f375(0x20a)]('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x1ba4d7=await withSpinner(_0x24f375(0x1f5)+_0x1c46fa+'\x27...',()=>_0x4f52e2[_0x24f375(0x1bf)][_0x24f375(0x1e0)](_0x1c46fa),{'verbose':_0x10e0d5[_0x24f375(0x1f0)]}),_0x37ceb5=_0x1ba4d7[_0x24f375(0x1d3)];_0x10e0d5[_0x24f375(0x1f0)]&&console[_0x24f375(0x20a)](_0x24f375(0x1ea)+_0x37ceb5);const _0x5f4583=await withSpinner(_0x24f375(0x226)+_0x45c91d+_0x24f375(0x19a),()=>_0x4f52e2[_0x24f375(0x1bf)][_0x24f375(0x1b6)](_0x37ceb5,_0x45c91d),{'verbose':_0x10e0d5[_0x24f375(0x1f0)]}),_0x3227d8=_0x5f4583['data'];_0x10e0d5[_0x24f375(0x1f0)]&&console[_0x24f375(0x20a)](_0x24f375(0x20c)+_0x3227d8);const _0x1b8ce9=await withSpinner('Fetching\x20folder\x20\x27'+_0x45c91d+_0x24f375(0x19a),()=>_0x4f52e2[_0x24f375(0x1bf)][_0x24f375(0x1e8)](_0x3227d8),{'verbose':_0x10e0d5[_0x24f375(0x1f0)]});return await handleSDKOutput([_0x1b8ce9[_0x24f375(0x1d3)]],_0x10e0d5),0x0;}catch(_0x28a474){if(_0x28a474 instanceof SDKError)return console[_0x24f375(0x20a)]('Error:\x20'+_0x28a474['message']),_0x28a474[_0x24f375(0x1b8)]&&console[_0x24f375(0x20a)](_0x24f375(0x1e1)+_0x28a474['cause']),0x1;throw _0x28a474;}}}export class SegmentSQLCommand extends BaseCommand{[a27_0x2cf442(0x21f)]=a27_0x2cf442(0x20b);['description']=a27_0x2cf442(0x1b5);async[a27_0x2cf442(0x1e7)](_0x1324cc){const _0x1d892a=a27_0x2cf442,{options:_0x3df32e,args:_0xd228ae,tdx:_0x14d856}=_0x1324cc,_0x500699=_0xd228ae[0x0];if(!_0x500699)return console['error']('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x1d892a(0x20a)]('Usage:\x20tdx\x20sg\x20sql\x20<name>'),console[_0x1d892a(0x20a)](_0x1d892a(0x1eb)),console[_0x1d892a(0x20a)](_0x1d892a(0x1f4)),console[_0x1d892a(0x20a)](_0x1d892a(0x19b)),console[_0x1d892a(0x20a)](_0x1d892a(0x21d)),0x1;try{const _0x39d115=_0x3df32e[_0x1d892a(0x1c6)],_0x40e3fb=await resolveSegmentTarget(_0x500699,_0x39d115,_0x3df32e['verbose']);_0x3df32e[_0x1d892a(0x1f0)]&&console[_0x1d892a(0x20a)]('Target\x20path:\x20'+_0x40e3fb);const _0x2c4c12=await withSpinner('Resolving\x20\x27'+_0x500699+_0x1d892a(0x19a),()=>_0x14d856[_0x1d892a(0x1bf)]['resolvePathToResource'](_0x40e3fb),{'verbose':_0x3df32e[_0x1d892a(0x1f0)]}),_0x3c13be=_0x2c4c12[_0x1d892a(0x1d3)];_0x3df32e[_0x1d892a(0x1f0)]&&(console['error'](_0x1d892a(0x216)+_0x3c13be['type']),console['error'](_0x1d892a(0x1f9)+_0x3c13be['parentId']));if(_0x3c13be[_0x1d892a(0x1e4)]==='folder')return console['error']('Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.'),console[_0x1d892a(0x20a)](_0x1d892a(0x1a4)),0x1;if(_0x3c13be[_0x1d892a(0x1e4)]===_0x1d892a(0x1fa))return console[_0x1d892a(0x20a)](_0x1d892a(0x1d4)),console[_0x1d892a(0x20a)](_0x1d892a(0x1a1)),0x1;if(!_0x3c13be[_0x1d892a(0x1b2)])throw new SDKError(ErrorCode[_0x1d892a(0x1fd)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x39d497=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x14d856['segment']['getSegmentSQL'](_0x3c13be[_0x1d892a(0x1a8)],_0x3c13be[_0x1d892a(0x1b2)]),{'verbose':_0x3df32e['verbose']}),_0x4f9d0a=_0x39d497[_0x1d892a(0x1d3)];return _0x3df32e[_0x1d892a(0x1fe)]==='json'||_0x3df32e[_0x1d892a(0x1fe)]===_0x1d892a(0x22b)?await handleSDKOutput([{'sql':_0x4f9d0a}],_0x3df32e):console[_0x1d892a(0x1f6)](_0x4f9d0a),0x0;}catch(_0x4f33a8){if(_0x4f33a8 instanceof SDKError)return console[_0x1d892a(0x20a)](_0x1d892a(0x1a2)+_0x4f33a8[_0x1d892a(0x1b3)]),_0x4f33a8['cause']&&console[_0x1d892a(0x20a)](_0x1d892a(0x1e1)+_0x4f33a8['cause']),0x1;throw _0x4f33a8;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a27_0x2cf442(0x21f)]=a27_0x2cf442(0x208);['description']='Create\x20segment\x20folder\x20for\x20organization';async[a27_0x2cf442(0x1e7)](_0x28bf31){const _0x5890ba=a27_0x2cf442,{options:_0x31ef38,args:_0x10c998,tdx:_0x33b45d}=_0x28bf31,_0x452bb4=_0x31ef38;if(_0x10c998[_0x5890ba(0x1dd)]<0x2)return console['error'](_0x5890ba(0x229)),console[_0x5890ba(0x20a)](_0x5890ba(0x22d)),0x1;const _0x4061b1=_0x10c998[0x0],_0x538533=_0x10c998[0x1];_0x452bb4[_0x5890ba(0x1f0)]&&(console[_0x5890ba(0x20a)](_0x5890ba(0x1a3)+_0x452bb4[_0x5890ba(0x19f)]),console[_0x5890ba(0x20a)](_0x5890ba(0x1c9)+_0x4061b1),console[_0x5890ba(0x20a)](_0x5890ba(0x1ed)+_0x538533));let _0x49773f;if(_0x452bb4[_0x5890ba(0x1d0)]){const _0x1eac67=_0x452bb4[_0x5890ba(0x1d0)],_0x3b8cd7=await withSpinner(_0x5890ba(0x1f5)+_0x4061b1+_0x5890ba(0x19a),()=>_0x33b45d[_0x5890ba(0x1bf)]['resolveParentId'](_0x4061b1),{'verbose':_0x452bb4[_0x5890ba(0x1f0)]}),_0x58ffb6=_0x3b8cd7['data'],_0x28aa71=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x1eac67+_0x5890ba(0x19a),()=>_0x33b45d['segment']['resolveFolderId'](_0x58ffb6,_0x1eac67),{'verbose':_0x452bb4[_0x5890ba(0x1f0)]});_0x49773f=_0x28aa71[_0x5890ba(0x1d3)],_0x452bb4[_0x5890ba(0x1f0)]&&console[_0x5890ba(0x20a)](_0x5890ba(0x1ab)+_0x49773f);}const _0x45c663={'name':_0x538533,'description':_0x452bb4['description'],'parentFolderId':_0x49773f},_0x5d7449=await withSpinner(_0x5890ba(0x1c0)+_0x538533+'\x27...',()=>_0x33b45d['segment'][_0x5890ba(0x210)](_0x4061b1,_0x45c663),{'verbose':_0x452bb4['verbose']}),_0x39789f=_0x5d7449[_0x5890ba(0x1d3)];return console[_0x5890ba(0x20a)]('✔\x20Created\x20folder\x20\x27'+_0x39789f[_0x5890ba(0x21f)]+_0x5890ba(0x19c)+_0x39789f['id']),await handleSDKOutput([_0x39789f],_0x452bb4),0x0;}}export class SegmentViewCommand extends BaseCommand{[a27_0x2cf442(0x21f)]=a27_0x2cf442(0x224);['description']=a27_0x2cf442(0x221);async[a27_0x2cf442(0x1e7)](_0x594adf){const _0x732cd7=a27_0x2cf442,{options:_0x49ed1b,args:_0x4b8d9a,tdx:_0xbae7c7}=_0x594adf,_0x573f72=_0x4b8d9a[0x0];if(!_0x573f72)return console[_0x732cd7(0x20a)](_0x732cd7(0x222)),console['error'](_0x732cd7(0x1e3)),console[_0x732cd7(0x20a)](_0x732cd7(0x20e)),console[_0x732cd7(0x20a)](_0x732cd7(0x1b4)),console['error'](_0x732cd7(0x223)),console[_0x732cd7(0x20a)](_0x732cd7(0x1f4)),console[_0x732cd7(0x20a)](_0x732cd7(0x1f1)),console[_0x732cd7(0x20a)](_0x732cd7(0x211)),console[_0x732cd7(0x20a)](_0x732cd7(0x1b7)),console[_0x732cd7(0x20a)](_0x732cd7(0x1da)),0x1;try{const _0xb296e8=_0x49ed1b[_0x732cd7(0x1c6)],_0x5eb9f=await resolveSegmentTarget(_0x573f72,_0xb296e8,_0x49ed1b['verbose']);_0x49ed1b[_0x732cd7(0x1f0)]&&console['error']('Target\x20path:\x20'+_0x5eb9f);const _0x2c8574=await withSpinner('Resolving\x20\x27'+_0x573f72+_0x732cd7(0x19a),()=>_0xbae7c7['segment'][_0x732cd7(0x20d)](_0x5eb9f),{'verbose':_0x49ed1b[_0x732cd7(0x1f0)]}),_0x504542=_0x2c8574[_0x732cd7(0x1d3)];_0x49ed1b[_0x732cd7(0x1f0)]&&(console['error'](_0x732cd7(0x216)+_0x504542[_0x732cd7(0x1e4)]),console[_0x732cd7(0x20a)](_0x732cd7(0x1f9)+_0x504542[_0x732cd7(0x1a8)]),_0x504542['folderId']&&console[_0x732cd7(0x20a)](_0x732cd7(0x1c3)+_0x504542[_0x732cd7(0x219)]),_0x504542[_0x732cd7(0x1b2)]&&console[_0x732cd7(0x20a)](_0x732cd7(0x1ee)+_0x504542[_0x732cd7(0x1b2)]));if(_0x49ed1b[_0x732cd7(0x209)]){if(_0x504542['type']==='folder')return console[_0x732cd7(0x20a)](_0x732cd7(0x1e9)),0x1;if(_0x504542[_0x732cd7(0x1e4)]==='parent')return console[_0x732cd7(0x20a)](_0x732cd7(0x1c8)),console[_0x732cd7(0x20a)](_0x732cd7(0x1b1)),0x1;if(!_0x504542[_0x732cd7(0x1b2)])throw new SDKError(ErrorCode[_0x732cd7(0x1fd)],_0x732cd7(0x228));const _0x2f2609=getConsoleNextUrl(_0x49ed1b[_0x732cd7(0x19f)],_0x732cd7(0x1c1)+_0x504542[_0x732cd7(0x1a8)]+_0x732cd7(0x1f2)+_0x504542[_0x732cd7(0x1b2)]);return console[_0x732cd7(0x20a)](a27_0x30fcaa[_0x732cd7(0x200)]('✔')+_0x732cd7(0x1c5)+a27_0x30fcaa[_0x732cd7(0x19e)](_0x2f2609)),openBrowser(_0x2f2609),0x0;}if(_0x504542['type']===_0x732cd7(0x1ef)){if(!_0x504542[_0x732cd7(0x219)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x732cd7(0x1c4));const _0x249eff=await withSpinner('Fetching\x20folder\x20details...',()=>_0xbae7c7[_0x732cd7(0x1bf)][_0x732cd7(0x1e8)](_0x504542[_0x732cd7(0x219)]),{'verbose':_0x49ed1b['verbose']});await handleSingleObjectOutput(_0x249eff[_0x732cd7(0x1d3)],_0x49ed1b);}else{if(_0x504542[_0x732cd7(0x1e4)]==='segment'){if(!_0x504542[_0x732cd7(0x1b2)])throw new SDKError(ErrorCode[_0x732cd7(0x1fd)],_0x732cd7(0x228));const _0x3d6047=await withSpinner(_0x732cd7(0x1ca),()=>_0xbae7c7[_0x732cd7(0x1bf)]['getSegment'](_0x504542[_0x732cd7(0x1a8)],_0x504542['segmentId']),{'verbose':_0x49ed1b[_0x732cd7(0x1f0)]}),_0x122950=getConsoleNextUrl(_0x49ed1b[_0x732cd7(0x19f)],'/app/ps/'+_0x504542['parentId']+_0x732cd7(0x1f2)+_0x504542[_0x732cd7(0x1b2)]),_0x4fd79e=_0x3d6047[_0x732cd7(0x1d3)];_0x4fd79e[_0x732cd7(0x1cf)]=_0x122950,await handleSingleObjectOutput(_0x4fd79e,_0x49ed1b);}else return console['error'](_0x732cd7(0x214)),console['error'](_0x732cd7(0x1a0)),0x1;}return 0x0;}catch(_0x5d9403){if(_0x5d9403 instanceof SDKError)return console['error'](_0x732cd7(0x1a2)+_0x5d9403[_0x732cd7(0x1b3)]),_0x5d9403[_0x732cd7(0x1b8)]&&console[_0x732cd7(0x20a)](_0x732cd7(0x1e1)+_0x5d9403[_0x732cd7(0x1b8)]),0x1;throw _0x5d9403;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a27_0x2cf442(0x21f)]='segment:desc';['description']=a27_0x2cf442(0x1a7);async[a27_0x2cf442(0x1e7)](_0x48d4ef){const _0x38ba10=a27_0x2cf442,{options:_0x3fcb51,args:_0x30106a,tdx:_0x41bb9e}=_0x48d4ef,_0x56820a=_0x30106a[0x0];if(!_0x56820a)return console[_0x38ba10(0x20a)](_0x38ba10(0x199)),console[_0x38ba10(0x20a)](_0x38ba10(0x1db)),console[_0x38ba10(0x20a)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console[_0x38ba10(0x20a)](_0x38ba10(0x1f4)),console[_0x38ba10(0x20a)](_0x38ba10(0x1d2)),console[_0x38ba10(0x20a)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x5368fe=_0x3fcb51[_0x38ba10(0x1c6)],_0x3065f4=await resolveSegmentTarget(_0x56820a,_0x5368fe,_0x3fcb51[_0x38ba10(0x1f0)]);_0x3fcb51[_0x38ba10(0x1f0)]&&console['error'](_0x38ba10(0x206)+_0x3065f4);const _0x5e86e4=await withSpinner(_0x38ba10(0x1b0)+_0x56820a+_0x38ba10(0x19a),()=>_0x41bb9e[_0x38ba10(0x1bf)][_0x38ba10(0x20d)](_0x3065f4),{'verbose':_0x3fcb51[_0x38ba10(0x1f0)]}),_0x283760=_0x5e86e4[_0x38ba10(0x1d3)];_0x3fcb51[_0x38ba10(0x1f0)]&&(console[_0x38ba10(0x20a)]('Resolved\x20type:\x20'+_0x283760[_0x38ba10(0x1e4)]),console[_0x38ba10(0x20a)](_0x38ba10(0x1f9)+_0x283760[_0x38ba10(0x1a8)]));if(_0x283760['type']===_0x38ba10(0x1ef))return console[_0x38ba10(0x20a)]('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console['error'](_0x38ba10(0x1a4)),0x1;if(_0x283760[_0x38ba10(0x1e4)]==='parent')return console[_0x38ba10(0x20a)](_0x38ba10(0x201)),console[_0x38ba10(0x20a)](_0x38ba10(0x1a9)),0x1;if(!_0x283760[_0x38ba10(0x1b2)])throw new SDKError(ErrorCode[_0x38ba10(0x1fd)],_0x38ba10(0x228));const _0x5ab156=await withSpinner(_0x38ba10(0x1ec),()=>_0x41bb9e[_0x38ba10(0x1bf)][_0x38ba10(0x1cd)](_0x283760[_0x38ba10(0x1a8)],_0x283760[_0x38ba10(0x1b2)]),{'verbose':_0x3fcb51['verbose']}),_0x13c3a8=_0x5ab156['data'],_0x131cd9=await executeSchemaQuery(_0x13c3a8,_0x41bb9e,_0x3fcb51);return await handleQueryOutput(_0x131cd9,_0x3fcb51),0x0;}catch(_0x4be26b){if(_0x4be26b instanceof SDKError)return console[_0x38ba10(0x20a)](_0x38ba10(0x1a2)+_0x4be26b[_0x38ba10(0x1b3)]),_0x4be26b['cause']&&console['error'](_0x38ba10(0x1e1)+_0x4be26b[_0x38ba10(0x1b8)]),0x1;throw _0x4be26b;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a28_0x538f31=a28_0x4e82;(function(_0x193ebd,_0x1cdd7f){const _0x8393c7=a28_0x4e82,_0x2643f3=_0x193ebd();while(!![]){try{const _0x32e05a=parseInt(_0x8393c7(0x109))/0x1+-parseInt(_0x8393c7(0x119))/0x2+parseInt(_0x8393c7(0xf9))/0x3+-parseInt(_0x8393c7(0xff))/0x4+-parseInt(_0x8393c7(0x10a))/0x5+parseInt(_0x8393c7(0x111))/0x6+parseInt(_0x8393c7(0x10c))/0x7*(-parseInt(_0x8393c7(0xf6))/0x8);if(_0x32e05a===_0x1cdd7f)break;else _0x2643f3['push'](_0x2643f3['shift']());}catch(_0x51089c){_0x2643f3['push'](_0x2643f3['shift']());}}}(a28_0x1a6a,0xcfed0));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';function a28_0x1a6a(){const _0x305fbc=['\x27...','segmentPath','length','segment','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','659264FHSxwr','resolveFolderId','Parent:\x20','Create\x20child\x20segment\x20with\x20filtering\x20rules','data','description','Resolved\x20folder\x20ID:\x20','✔\x20Created\x20segment\x20\x27','parent','yellow','includes','resolvePathToResource','folder','\x27\x20with\x20ID:\x20','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','8kgkibo','Target\x20path:\x20','createSegment','1055574vCdkGp','Resolving\x20folder\x20path\x20\x27','segment:create','segments','Resolving\x20parent\x20segment\x20\x27','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','4338548JRpNvC','error','verbose','Segment\x20name:\x20','Resolving\x20folder\x20\x27','resolveParentId','kind','name','Parent\x20path:\x20','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','1253608JjdQQE','138880dCfzor','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','1767843LBRSxP','invisible','Site:\x20','Resolved\x20relative\x20path\x20to:\x20','type','5644752LsUWNc','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]'];a28_0x1a6a=function(){return _0x305fbc;};return a28_0x1a6a();}import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a28_0x22d269 from'chalk';function a28_0x4e82(_0x53ea3f,_0x4db1ce){_0x53ea3f=_0x53ea3f-0xec;const _0x1a6a2=a28_0x1a6a();let _0x4e821d=_0x1a6a2[_0x53ea3f];return _0x4e821d;}export class SegmentCreateCommand extends BaseCommand{['name']=a28_0x538f31(0xfb);[a28_0x538f31(0xec)]=a28_0x538f31(0x11c);async['execute'](_0x5a036a){const _0xa18cd1=a28_0x538f31;console[_0xa18cd1(0x100)](a28_0x22d269['yellow'](_0xa18cd1(0x112))),console[_0xa18cd1(0x100)](a28_0x22d269[_0xa18cd1(0xf0)](_0xa18cd1(0x118)));const {options:_0xed039c,args:_0x74fd74,tdx:_0x22e418}=_0x5a036a,_0x3f19bc=_0xed039c;if(_0x74fd74['length']===0x0)return console[_0xa18cd1(0x100)](_0xa18cd1(0x108)),console['error'](_0xa18cd1(0x113)),console[_0xa18cd1(0x100)]('Examples:'),console[_0xa18cd1(0x100)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console[_0xa18cd1(0x100)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console[_0xa18cd1(0x100)](_0xa18cd1(0x10b)),0x1;const _0x12f3c8=_0x74fd74[0x0],_0x44a21e=_0xed039c[_0xa18cd1(0x115)];let _0x5da9a5=_0x12f3c8;_0x44a21e&&!_0x12f3c8[_0xa18cd1(0xf1)]('/')&&(_0x5da9a5=_0x44a21e+'/'+_0x12f3c8,_0x3f19bc[_0xa18cd1(0x101)]&&console[_0xa18cd1(0x100)](_0xa18cd1(0x10f)+_0x5da9a5));const _0x2926e6=parsePath(_0x5da9a5);if(_0x2926e6[_0xa18cd1(0xfc)][_0xa18cd1(0x116)]<0x2)return console[_0xa18cd1(0x100)](_0xa18cd1(0xf5)),console[_0xa18cd1(0x100)]('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x3c7a6b=_0x2926e6[_0xa18cd1(0xfc)][0x0],_0x3ef056=getBaseName(_0x5da9a5),_0x391c64=getParentPath(_0x5da9a5);_0x3f19bc[_0xa18cd1(0x101)]&&(console[_0xa18cd1(0x100)](_0xa18cd1(0x10e)+_0x3f19bc['site']),console[_0xa18cd1(0x100)](_0xa18cd1(0xf7)+_0x5da9a5),console[_0xa18cd1(0x100)](_0xa18cd1(0x11b)+_0x3c7a6b),console[_0xa18cd1(0x100)](_0xa18cd1(0x102)+_0x3ef056),console['error'](_0xa18cd1(0x107)+_0x391c64));const _0x4a4c36=await withSpinner(_0xa18cd1(0xfd)+_0x3c7a6b+_0xa18cd1(0x114),()=>_0x22e418[_0xa18cd1(0x117)][_0xa18cd1(0x104)](_0x3c7a6b),{'verbose':_0x3f19bc[_0xa18cd1(0x101)]}),_0x1437e2=_0x4a4c36[_0xa18cd1(0x11d)];let _0x53e480;if(_0x2926e6['segments'][_0xa18cd1(0x116)]>0x2){const _0x577be5=await withSpinner(_0xa18cd1(0xfa)+_0x391c64+_0xa18cd1(0x114),()=>_0x22e418[_0xa18cd1(0x117)][_0xa18cd1(0xf2)](_0x391c64),{'verbose':_0x3f19bc['verbose']}),_0x4a675f=_0x577be5[_0xa18cd1(0x11d)];if(_0x4a675f['type']!==_0xa18cd1(0xf3)&&_0x4a675f[_0xa18cd1(0x110)]!==_0xa18cd1(0xef))return console[_0xa18cd1(0x100)](_0xa18cd1(0xfe)),0x1;_0x53e480=_0x4a675f['folderId'];}else{if(_0x3f19bc[_0xa18cd1(0xf3)]){const _0xb150f6=await withSpinner(_0xa18cd1(0x103)+_0x3f19bc[_0xa18cd1(0xf3)]+_0xa18cd1(0x114),()=>_0x22e418[_0xa18cd1(0x117)][_0xa18cd1(0x11a)](_0x1437e2,_0x3f19bc[_0xa18cd1(0xf3)]),{'verbose':_0x3f19bc[_0xa18cd1(0x101)]});_0x53e480=_0xb150f6[_0xa18cd1(0x11d)];}}_0x3f19bc[_0xa18cd1(0x101)]&&_0x53e480&&console[_0xa18cd1(0x100)](_0xa18cd1(0xed)+_0x53e480);const _0xa59eb6=await loadJSONFromOptions(_0x3f19bc['rule'],_0x3f19bc['ruleFile']),_0x39bea2={'name':_0x3ef056,'description':_0x3f19bc['description'],'rule':_0xa59eb6,'kind':_0x3f19bc[_0xa18cd1(0x105)]!==undefined?parseInt(_0x3f19bc[_0xa18cd1(0x105)],0xa):undefined,'isVisible':_0x3f19bc[_0xa18cd1(0x10d)]?![]:undefined,'segmentFolderId':_0x53e480,'countPopulation':_0x3f19bc['noCountPopulation']?![]:undefined},_0x17913e=await withSpinner('Creating\x20segment\x20\x27'+_0x3ef056+'\x27...',()=>_0x22e418['segment'][_0xa18cd1(0xf8)](_0x1437e2,_0x39bea2),{'verbose':_0x3f19bc[_0xa18cd1(0x101)]}),_0xfea270=_0x17913e[_0xa18cd1(0x11d)];return console[_0xa18cd1(0x100)](_0xa18cd1(0xee)+_0xfea270[_0xa18cd1(0x106)]+_0xa18cd1(0xf4)+_0xfea270['id']),_0x5da9a5!==_0x12f3c8&&console[_0xa18cd1(0x100)]('\x20\x20\x20Path:\x20'+_0x5da9a5),await handleSDKOutput([_0xfea270],_0x3f19bc),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a29_0x50ea60=a29_0x1d0a;function a29_0x1d0a(_0x1cbd2f,_0x1ff527){_0x1cbd2f=_0x1cbd2f-0x1c4;const _0x56f933=a29_0x56f9();let _0x1d0a2b=_0x56f933[_0x1cbd2f];return _0x1d0a2b;}(function(_0x2971c3,_0x4ca71a){const _0x4bfaaa=a29_0x1d0a,_0x4b5721=_0x2971c3();while(!![]){try{const _0x630f1a=parseInt(_0x4bfaaa(0x1ce))/0x1*(-parseInt(_0x4bfaaa(0x1dc))/0x2)+-parseInt(_0x4bfaaa(0x1c4))/0x3+parseInt(_0x4bfaaa(0x1c9))/0x4*(-parseInt(_0x4bfaaa(0x1d8))/0x5)+parseInt(_0x4bfaaa(0x1d5))/0x6+parseInt(_0x4bfaaa(0x1cd))/0x7+parseInt(_0x4bfaaa(0x1cc))/0x8+-parseInt(_0x4bfaaa(0x1ca))/0x9*(-parseInt(_0x4bfaaa(0x1d6))/0xa);if(_0x630f1a===_0x4ca71a)break;else _0x4b5721['push'](_0x4b5721['shift']());}catch(_0x497f36){_0x4b5721['push'](_0x4b5721['shift']());}}}(a29_0x56f9,0x2b1be));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';function a29_0x56f9(){const _0x1bcade=['24NcuLok','31698KvgTSt','Listing\x20fields\x20for\x20\x27','475984POVSRn','941444ReHKJh','1fVOwZf','parentSegment','Error:\x20Parent\x20segment\x20name\x20is\x20required','listFields','site','json','\x20field','1969944ZDmxQF','10WSdayi','\x27...','143540RcvFPg','segment','Site:\x20','Parent\x20segment:\x20','212892MbIngF','✔\x20Found\x20','verbose','List\x20available\x20fields\x20for\x20segmentation','data','211704kQnUux','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','error','description','segment:fields'];a29_0x56f9=function(){return _0x1bcade;};return a29_0x56f9();}export class SegmentFieldsCommand extends BaseCommand{['name']=a29_0x50ea60(0x1c8);[a29_0x50ea60(0x1c7)]=a29_0x50ea60(0x1df);async['execute'](_0x24de89){const _0x2603ad=a29_0x50ea60,{options:_0xee8d4c,args:_0x3fac2a,tdx:_0x41ca04}=_0x24de89,_0x1f97ca=_0x3fac2a[0x0]||_0xee8d4c[_0x2603ad(0x1cf)];if(!_0x1f97ca)return console[_0x2603ad(0x1c6)](_0x2603ad(0x1d0)),console[_0x2603ad(0x1c6)]('Usage:\x20tdx\x20segment\x20fields\x20<parent_name>'),console[_0x2603ad(0x1c6)](_0x2603ad(0x1c5)),0x1;_0xee8d4c[_0x2603ad(0x1de)]&&(console['error'](_0x2603ad(0x1da)+_0xee8d4c[_0x2603ad(0x1d2)]),console['error'](_0x2603ad(0x1db)+_0x1f97ca));const _0x35e199=await withSpinner(_0x2603ad(0x1cb)+_0x1f97ca+_0x2603ad(0x1d7),()=>_0x41ca04[_0x2603ad(0x1d9)][_0x2603ad(0x1d1)](_0x1f97ca),{'verbose':_0xee8d4c['verbose']}),_0x1eb04f=_0x35e199[_0x2603ad(0x1e0)];console[_0x2603ad(0x1c6)](_0x2603ad(0x1dd)+_0x1eb04f['length']+_0x2603ad(0x1d4)+(_0x1eb04f['length']!==0x1?'s':''));if(_0xee8d4c[_0x2603ad(0x1d3)]||_0xee8d4c['jsonl'])return await handleSDKOutput(_0x1eb04f,_0xee8d4c),0x0;return displayFieldsHumanReadable(_0x1eb04f,_0x1f97ca),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a30_0x5dd781=a30_0x5d1c;(function(_0x3599ff,_0x179dba){const _0x4ec67c=a30_0x5d1c,_0x5bf32f=_0x3599ff();while(!![]){try{const _0x4c7019=-parseInt(_0x4ec67c(0xd0))/0x1+parseInt(_0x4ec67c(0xd6))/0x2*(parseInt(_0x4ec67c(0xbd))/0x3)+parseInt(_0x4ec67c(0xcc))/0x4+parseInt(_0x4ec67c(0xc8))/0x5+-parseInt(_0x4ec67c(0x90))/0x6*(parseInt(_0x4ec67c(0xaf))/0x7)+parseInt(_0x4ec67c(0x9c))/0x8*(-parseInt(_0x4ec67c(0xdc))/0x9)+parseInt(_0x4ec67c(0xae))/0xa*(parseInt(_0x4ec67c(0xc3))/0xb);if(_0x4c7019===_0x179dba)break;else _0x5bf32f['push'](_0x5bf32f['shift']());}catch(_0x1b01ff){_0x5bf32f['push'](_0x5bf32f['shift']());}}}(a30_0x4155,0xa6b79));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a30_0x9af2c2 from'chalk';function a30_0x5d1c(_0x138b26,_0x4bc382){_0x138b26=_0x138b26-0x8b;const _0x41553a=a30_0x4155();let _0x5d1cbd=_0x41553a[_0x138b26];return _0x5d1cbd;}import{existsSync,mkdirSync,writeFileSync}from'fs';import a30_0x15a1c6 from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';function a30_0x4155(){const _0x3595e2=['type','session','73895LeAJFh','file','✔\x20Context\x20set:\x20','journeyVersions','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','data','1604KUlsuG','filter','segment','Site:\x20','no_parent','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','1017dEswJZ','-\x20no\x20files\x20written','parentName','length','segment:pull','repeat','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','6641358wzvdPb','resourceName','isNew','errorCode','\x20journeys','setPhase','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','journeys','Pulling\x20segments\x20from\x20\x27','\x20\x20🗺️\x20\x20','error','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','45256YmqxBa','hasChanges','helpText','Parent\x20segment:\x20','utf-8','content','\x27...','site','Aborted.','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','parentSegment','message','absolutePath','\x20\x20Target:\x20','diff','cwd','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)','\x20\x20🎯\x20','31010rirZox','7uKXXFD','description','Write\x20','name','\x20unchanged\x20files','cyan','segments','targetDir','\x20files?','dryRun','\x20with\x20','yellow','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','\x0aError:','3066uygVae','files','\x20activations','execute','Target\x20resource:\x20','\x20segments','1562MSbcMF','\x20=\x20','verbose','dim','red','4169760CxBysR','yes','green','counts','1635856mTZoCM','\x0aChanges\x20to\x20\x27'];a30_0x4155=function(){return _0x3595e2;};return a30_0x4155();}export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';export class SegmentPullCommand extends BaseCommand{[a30_0x5dd781(0xb2)]=a30_0x5dd781(0x8d);[a30_0x5dd781(0xb0)]=a30_0x5dd781(0x9b);async[a30_0x5dd781(0xc0)](_0x10c33c){const _0x3324ee=a30_0x5dd781,{options:_0x353c6a,args:_0x5e83a0,tdx:_0x56c5ea}=_0x10c33c,_0x35524a=_0x353c6a,_0xc52c0f=await resolveTarget({'arg':_0x5e83a0[0x0],'contextParent':_0x353c6a[_0x3324ee(0xa6)],'cwd':process[_0x3324ee(0xab)]()});if(!isSuccessfulResolution(_0xc52c0f))return _0xc52c0f[_0x3324ee(0x93)]===_0x3324ee(0xda)?(console[_0x3324ee(0x9a)](a30_0x9af2c2[_0x3324ee(0xba)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console['error'](_0x3324ee(0xac)),console['error'](_0x3324ee(0xbb)),console[_0x3324ee(0x9a)](_0x3324ee(0x8f))):(console[_0x3324ee(0x9a)](a30_0x9af2c2[_0x3324ee(0xc7)]('Error:\x20'+_0xc52c0f[_0x3324ee(0xa7)]+'\x0a')),_0xc52c0f[_0x3324ee(0x9e)]&&console['error'](a30_0x9af2c2[_0x3324ee(0xb4)](_0xc52c0f[_0x3324ee(0x9e)]))),0x1;const _0x1788a5=_0xc52c0f[_0x3324ee(0x8b)],_0x5c8c9f=_0xc52c0f[_0x3324ee(0xb6)],_0x652e5c=_0xc52c0f[_0x3324ee(0xce)]===_0x3324ee(0xd1)?_0xc52c0f[_0x3324ee(0x91)]:undefined;_0x35524a[_0x3324ee(0xc5)]&&(console[_0x3324ee(0x9a)](_0x3324ee(0xd9)+_0x35524a[_0x3324ee(0xa3)]),console[_0x3324ee(0x9a)](_0x3324ee(0x9f)+_0x1788a5),_0x652e5c&&console[_0x3324ee(0x9a)](_0x3324ee(0xc1)+_0x652e5c));const _0x581b22=await withProgressSpinner(_0x3324ee(0x98)+_0x1788a5+_0x3324ee(0xa2),_0x551e6c=>_0x56c5ea[_0x3324ee(0xd8)]['pullSegments'](_0x1788a5,{'targetDir':_0x5c8c9f,'targetResourceName':_0x652e5c,'verbose':_0x35524a['verbose'],'progress':{'update':_0x2d7750=>{const _0x11c8c4=_0x3324ee;_0x551e6c[_0x11c8c4(0x95)](_0x2d7750),_0x35524a[_0x11c8c4(0xc5)]&&console['error']('\x20\x20'+_0x2d7750);}}}),{'verbose':_0x35524a[_0x3324ee(0xc5)]}),_0x2aee1e=_0x581b22[_0x3324ee(0xd5)];if(_0x2aee1e[_0x3324ee(0xcb)][_0x3324ee(0xb5)]===0x0&&_0x2aee1e[_0x3324ee(0xcb)][_0x3324ee(0x97)]===0x0)return console[_0x3324ee(0x9a)](a30_0x9af2c2[_0x3324ee(0xba)](_0x3324ee(0xd4)+_0x2aee1e['parentName']+'\x27')),0x0;const _0x333c32=_0x2aee1e[_0x3324ee(0xbe)][_0x3324ee(0xd7)](_0x42765f=>_0x42765f[_0x3324ee(0x92)]),_0x2b87b3=_0x2aee1e[_0x3324ee(0xbe)][_0x3324ee(0xd7)](_0x473983=>!_0x473983[_0x3324ee(0x92)]&&_0x473983[_0x3324ee(0x9d)]),_0x394440=_0x2aee1e[_0x3324ee(0xbe)][_0x3324ee(0xd7)](_0x202184=>!_0x202184[_0x3324ee(0x92)]&&!_0x202184[_0x3324ee(0x9d)]);console[_0x3324ee(0x9a)]('\x0aPull\x20summary\x20for\x20\x27'+_0x2aee1e['parentName']+'\x27:'),console[_0x3324ee(0x9a)](_0x3324ee(0xad)+a30_0x9af2c2[_0x3324ee(0xb4)](_0x2aee1e[_0x3324ee(0xcb)]['segments']+_0x3324ee(0xc2))+_0x3324ee(0xb9)+a30_0x9af2c2[_0x3324ee(0xb4)](_0x2aee1e['counts']['activations']+_0x3324ee(0xbf)));if(_0x2aee1e[_0x3324ee(0xcb)][_0x3324ee(0x97)]>0x0){const _0x28fc35=_0x2aee1e[_0x3324ee(0xcb)][_0x3324ee(0xd3)]>_0x2aee1e[_0x3324ee(0xcb)]['journeys']?'\x20('+_0x2aee1e[_0x3324ee(0xcb)]['journeyVersions']+'\x20versions)':'';console[_0x3324ee(0x9a)](_0x3324ee(0x99)+a30_0x9af2c2['cyan'](_0x2aee1e['counts'][_0x3324ee(0x97)]+_0x3324ee(0x94))+a30_0x9af2c2[_0x3324ee(0xc6)](_0x28fc35));}console[_0x3324ee(0x9a)]('\x20\x20'+a30_0x9af2c2['green']('+\x20'+_0x333c32['length']+'\x20new\x20files')),console[_0x3324ee(0x9a)]('\x20\x20'+a30_0x9af2c2['yellow']('~\x20'+_0x2b87b3[_0x3324ee(0x8c)]+'\x20changed\x20files')),console['error']('\x20\x20'+a30_0x9af2c2[_0x3324ee(0xc6)]('=\x20'+_0x394440[_0x3324ee(0x8c)]+_0x3324ee(0xb3))),console['error'](_0x3324ee(0xa9)+a30_0x9af2c2[_0x3324ee(0xb4)](_0x2aee1e['targetDir'])+'\x0a');if(_0x2b87b3['length']>0x0)for(const _0x946fb5 of _0x2b87b3){console[_0x3324ee(0x9a)](_0x3324ee(0xcd)+_0x946fb5['relativePath']+'\x27:'),console['error']('─'[_0x3324ee(0x8e)](0x3c)),console[_0x3324ee(0x9a)](_0x946fb5[_0x3324ee(0xaa)]),console[_0x3324ee(0x9a)]('─'[_0x3324ee(0x8e)](0x3c));}if(_0x35524a[_0x3324ee(0xb8)])return console[_0x3324ee(0x9a)](a30_0x9af2c2[_0x3324ee(0xba)](_0x3324ee(0x96))),0x0;if(_0x333c32[_0x3324ee(0x8c)]===0x0&&_0x2b87b3[_0x3324ee(0x8c)]===0x0)return console[_0x3324ee(0x9a)](a30_0x9af2c2[_0x3324ee(0xca)]('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x2aee1e['parentName']},_0x35524a['session']),console[_0x3324ee(0x9a)](a30_0x9af2c2[_0x3324ee(0xca)](_0x3324ee(0xd2)+a30_0x9af2c2[_0x3324ee(0xc6)]('parent_segment')+_0x3324ee(0xc4)+a30_0x9af2c2['cyan'](_0x2aee1e[_0x3324ee(0x8b)]))),0x0;if(!_0x35524a[_0x3324ee(0xc9)]){if(!isInteractive())return console[_0x3324ee(0x9a)](a30_0x9af2c2[_0x3324ee(0xc7)](_0x3324ee(0xbc)),_0x3324ee(0xdb)),console['error'](a30_0x9af2c2['dim'](_0x3324ee(0xa5))),0x1;const _0x247141=await confirmKey(_0x3324ee(0xb1)+(_0x333c32[_0x3324ee(0x8c)]+_0x2b87b3['length'])+_0x3324ee(0xb7));if(!_0x247141)return console[_0x3324ee(0x9a)](a30_0x9af2c2['yellow'](_0x3324ee(0xa4)),_0x3324ee(0xdd)),0x1;}for(const _0x36e0d5 of _0x2aee1e['files']){if(_0x36e0d5[_0x3324ee(0x92)]||_0x36e0d5['hasChanges']){const _0x515eec=a30_0x15a1c6['dirname'](_0x36e0d5[_0x3324ee(0xa8)]);!existsSync(_0x515eec)&&mkdirSync(_0x515eec,{'recursive':!![]}),writeFileSync(_0x36e0d5[_0x3324ee(0xa8)],_0x36e0d5[_0x3324ee(0xa1)],_0x3324ee(0xa0));}}return console[_0x3324ee(0x9a)](a30_0x9af2c2['green']('✔\x20Pulled\x20'+(_0x333c32[_0x3324ee(0x8c)]+_0x2b87b3['length'])+'\x20files\x20to\x20'+_0x2aee1e[_0x3324ee(0xb6)])),saveSessionContext({'parent_segment':_0x2aee1e[_0x3324ee(0x8b)]},_0x35524a[_0x3324ee(0xcf)]),console[_0x3324ee(0x9a)](a30_0x9af2c2[_0x3324ee(0xca)](_0x3324ee(0xd2)+a30_0x9af2c2['dim']('parent_segment')+_0x3324ee(0xc4)+a30_0x9af2c2[_0x3324ee(0xb4)](_0x2aee1e['parentName']))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a31_0x169478=a31_0x3669;(function(_0x312aa7,_0x20d3f5){const _0x534774=a31_0x3669,_0x48e840=_0x312aa7();while(!![]){try{const _0x384561=-parseInt(_0x534774(0xf0))/0x1+parseInt(_0x534774(0xde))/0x2*(-parseInt(_0x534774(0x150))/0x3)+-parseInt(_0x534774(0x152))/0x4*(parseInt(_0x534774(0x139))/0x5)+parseInt(_0x534774(0xf7))/0x6*(-parseInt(_0x534774(0x14d))/0x7)+-parseInt(_0x534774(0x11d))/0x8+-parseInt(_0x534774(0xf3))/0x9+-parseInt(_0x534774(0xcd))/0xa*(-parseInt(_0x534774(0xd9))/0xb);if(_0x384561===_0x20d3f5)break;else _0x48e840['push'](_0x48e840['shift']());}catch(_0x14a53b){_0x48e840['push'](_0x48e840['shift']());}}}(a31_0x4097,0xae3e3));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors}from'../utils/diff.js';import{confirmKey,isInteractive}from'../utils/prompt.js';function a31_0x4097(){const _0x222b96=['New\x20segment:','message','\x20updated','filePath','diff','\x0aError:','segment','listFolders','\x20\x20📊\x20Segments:','state','\x20\x20Source:\x20','\x20created','segments','type','journeyBundleName','no_parent','segmentFolderId','\x20changed','toUpdate','filter','resolveParentId','description','green','\x20to\x20delete','62325FCpASI','\x20YAML\x20files\x20found','\x20\x20\x20\x20','targetDir','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','connection','Push\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','list','created','No\x20','push','listActivations','yellow','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','journeysOnly','getJourney','length','repeat','/app/ps/','7AveSxI','listSegments','parentFolder','21639vRSGiK','audienceId','252nmwoFp','verbose','errorCode','new','folderId','\x20\x20Segments:\x20','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','toCreate','then','get','parentSegment','\x27...','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','\x20to\x20update','add','📁\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','scopedFolderPath','data','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','attributes','updatedAt','5400qMmuqS','error','Delete\x20segment:','Preparing\x20journeys...','journeys','Aborted.','updated','dim','Error:\x20','\x20\x20Activations:\x20','yamlConfig','deleted','145420InBvPa','cyan','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','idToName','journey','272iATlXF','\x20folders\x20to\x20create','set','map','yes','name','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','helpText','/e/','delete','\x20new','activations','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','createdAt','user','\x0aPush\x20summary\x20for\x20\x27','Fetching\x20parent\x20segment\x20details...','Fetching\x20existing\x20activations...','647890LZtYha','Fetching\x20connections\x20for\x20name\x20resolution...','endsWith','12755430TtyFYC','Parent\x20segment:\x20','Error:\x20Directory\x20not\x20found:\x20','(Journey\x20will\x20be\x20deleted)','7960968zFCrGV','createdSegmentIds','\x20\x20🗺️\x20\x20Journeys:','isNew','Site:\x20','changed','Changes\x20to\x20journey:','\x20\x20Journeys:\x20','folderPath','Fetching\x20existing\x20journeys...','paused','join','\x20activations]','Source\x20directory:\x20','toDelete','parent_name','unchanged','New\x20journey:','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','\x20deleted','parentName','\x20unchanged','journeyId','results','Fetching\x20existing\x20folders...','execute','/j/da/je','Delete\x20journey:','red','relationships','all','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','Folders\x20to\x20create:','versionNumber','\x20changes?','\x20\x20Activations:','blue','segment\x20or\x20journey','10134800IHjlFd','dryRun','toString','\x20to\x20create'];a31_0x4097=function(){return _0x222b96;};return a31_0x4097();}function a31_0x3669(_0x11d7c7,_0x2c64d1){_0x11d7c7=_0x11d7c7-0xcd;const _0x409780=a31_0x4097();let _0x36691f=_0x409780[_0x11d7c7];return _0x36691f;}import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a31_0x26bb35 from'chalk';import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';import{buildFolderMaps}from'../sdk/segment/resolution-context.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{['name']='segment:push';[a31_0x169478(0x136)]=a31_0x169478(0x116);async[a31_0x169478(0x110)](_0x421f63){const _0xe33fd3=a31_0x169478,{options:_0x576d50,args:_0xabb22f,tdx:_0x2b1b08}=_0x421f63,_0x37f112=_0x576d50,_0x5b573f=await resolveTarget({'arg':_0xabb22f[0x0],'contextParent':_0x576d50[_0xe33fd3(0x15c)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x5b573f))return _0x5b573f[_0xe33fd3(0x154)]===_0xe33fd3(0x130)?(console[_0xe33fd3(0xce)](a31_0x26bb35['yellow'](_0xe33fd3(0x162))),console['error']('Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)'),console[_0xe33fd3(0xce)](_0xe33fd3(0x140)),console[_0xe33fd3(0xce)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file')):(console[_0xe33fd3(0xce)](a31_0x26bb35[_0xe33fd3(0x113)](_0xe33fd3(0xd5)+_0x5b573f['message']+'\x0a')),_0x5b573f[_0xe33fd3(0xe5)]&&console[_0xe33fd3(0xce)](a31_0x26bb35[_0xe33fd3(0xda)](_0x5b573f[_0xe33fd3(0xe5)]))),0x1;if(_0x5b573f[_0xe33fd3(0x12e)]===_0xe33fd3(0x106))return console['error'](a31_0x26bb35[_0xe33fd3(0x113)](_0xe33fd3(0xf5)+_0x5b573f[_0xe33fd3(0x13c)]+'\x0a')),console[_0xe33fd3(0xce)](a31_0x26bb35[_0xe33fd3(0xda)](_0xe33fd3(0x165))),0x1;const _0x44871e=_0x5b573f[_0xe33fd3(0x10b)],_0xdf912c=_0x5b573f[_0xe33fd3(0x13c)],_0x203e5b=_0x5b573f['type']==='file'?_0x5b573f[_0xe33fd3(0x124)]:undefined,_0x16a4b2=getScopedDetails(_0x5b573f),_0x868758=_0x16a4b2?.['isScoped']??![],_0xc117c2=_0x16a4b2?.[_0xe33fd3(0x163)]??'';if(!existsSync(_0xdf912c))return console['error'](a31_0x26bb35[_0xe33fd3(0x113)](_0xe33fd3(0xf5)+_0xdf912c+'\x0a')),console['error'](a31_0x26bb35['cyan'](_0xe33fd3(0x165))),0x1;_0x37f112[_0xe33fd3(0x153)]&&(console[_0xe33fd3(0xce)](_0xe33fd3(0xfb)+_0x37f112['site']),console[_0xe33fd3(0xce)](_0xe33fd3(0xf4)+_0x44871e),console[_0xe33fd3(0xce)](_0xe33fd3(0x104)+_0xdf912c),_0x868758&&console['error']('Scoped\x20to\x20folder:\x20'+_0xc117c2));const _0x29d181=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x44871e+_0xe33fd3(0x15d),()=>_0x2b1b08[_0xe33fd3(0x127)][_0xe33fd3(0x135)](_0x44871e),{'verbose':_0x37f112[_0xe33fd3(0x153)]}),_0x14df1c=_0x29d181[_0xe33fd3(0x164)],[_0x1ac831,_0x250ee3,_0x95e1a5,_0x2a4f95,_0x3461df]=await Promise[_0xe33fd3(0x115)]([withSpinner(_0xe33fd3(0xee),()=>_0x2b1b08['segment']['getParent'](_0x14df1c),{'verbose':_0x37f112[_0xe33fd3(0x153)]}),withSpinner('Fetching\x20existing\x20segments...',()=>_0x2b1b08[_0xe33fd3(0x127)][_0xe33fd3(0x14e)](_0x14df1c),{'verbose':_0x37f112[_0xe33fd3(0x153)]}),withSpinner(_0xe33fd3(0x10f),()=>_0x2b1b08[_0xe33fd3(0x127)][_0xe33fd3(0x128)](_0x14df1c),{'verbose':_0x37f112[_0xe33fd3(0x153)]}),withSpinner(_0xe33fd3(0x100),()=>_0x2b1b08[_0xe33fd3(0xdd)]['listJourneysWithDetailsFromParentSegment'](_0x14df1c,{'includeAllVersions':!![]}),{'verbose':_0x37f112['verbose']}),withSpinner('Fetching\x20users\x20for\x20email\x20resolution...',()=>_0x2b1b08[_0xe33fd3(0xec)]['buildUserMaps'](),{'verbose':_0x37f112[_0xe33fd3(0x153)]})[_0xe33fd3(0x15a)](_0x338da5=>_0x338da5[_0xe33fd3(0x164)])]),_0x30b320=_0x1ac831[_0xe33fd3(0x164)],_0x42c854=extractRootFolderId(_0x30b320),_0xf9780f=_0x250ee3[_0xe33fd3(0x164)],_0x18b999=_0x95e1a5['data'],{journeys:_0x237444,activationStepsById:_0xcfde81}=_0x2a4f95['data'],_0x378590=new Map(_0x237444[_0xe33fd3(0xe1)](_0x4c18ae=>[_0x4c18ae['id'],_0x4c18ae])),_0x3bf9f4=_0x237444[_0xe33fd3(0xe1)](_0xe41177=>({'id':_0xe41177['id'],'name':_0xe41177[_0xe33fd3(0x166)][_0xe33fd3(0xe3)],'journeyBundleName':_0xe41177[_0xe33fd3(0x166)][_0xe33fd3(0x12f)]||'','journeyBundleId':_0xe41177[_0xe33fd3(0x166)]['journeyBundleId']||'','versionNumber':_0xe41177['attributes'][_0xe33fd3(0x118)],'description':_0xe41177[_0xe33fd3(0x166)][_0xe33fd3(0x136)],'state':_0xe41177[_0xe33fd3(0x166)][_0xe33fd3(0x12a)],'paused':_0xe41177[_0xe33fd3(0x166)][_0xe33fd3(0x101)],'audienceId':_0xe41177[_0xe33fd3(0x166)][_0xe33fd3(0x151)],'folderId':_0xe41177[_0xe33fd3(0x114)]?.[_0xe33fd3(0x14f)]?.[_0xe33fd3(0x164)]?.['id'],'createdAt':_0xe41177[_0xe33fd3(0x166)][_0xe33fd3(0xeb)],'updatedAt':_0xe41177[_0xe33fd3(0x166)][_0xe33fd3(0x167)]})),{emailToId:_0x5274ba,idToEmail:_0x40e34b}=_0x3461df,_0x1de229=await withSpinner(_0xe33fd3(0xf1),async()=>{const _0x130e10=_0xe33fd3,_0x2a9b5d=await _0x2b1b08['connection'][_0x130e10(0x141)]();return buildConnectionMaps(_0x2a9b5d);},{'verbose':_0x37f112['verbose']})['then'](_0xc0fc82=>_0xc0fc82['data']),_0x2c4a84=_0x1de229['nameToId'],_0x42d780=_0x1de229['idToName'],_0x2e4eb0=_0x1de229['nameToType'],_0x40af41={'emailToIdMap':_0x5274ba,'connectionNameToIdMap':_0x2c4a84,'connectionNameToTypeMap':_0x2e4eb0,'getSchema':_0x439de8=>_0x2b1b08[_0xe33fd3(0x13e)]['getOutputSchemaWithCache'](_0x439de8)};let {pathToId:_0x3b22c6,idToPath:_0xc64af3}=buildFolderMaps(_0x18b999);const _0x431ddb=buildSegmentLookupMap(_0xf9780f,_0xc64af3),_0x53107f=buildSegmentNameToIdMap(_0xf9780f),_0x5cb436=buildJourneyBundleLookupMap(_0x3bf9f4,_0xc64af3);let _0x67de71;if(_0x203e5b){if(!_0x203e5b[_0xe33fd3(0xf2)]('.yml')&&!_0x203e5b['endsWith']('.yaml'))return console['error'](a31_0x26bb35[_0xe33fd3(0x113)](_0xe33fd3(0x147)+_0x203e5b+'\x0a')),0x1;_0x67de71=[_0x203e5b];}else _0x67de71=findYamlFiles(_0xdf912c);if(_0x67de71[_0xe33fd3(0x14a)]===0x0)return console['error'](a31_0x26bb35[_0xe33fd3(0x113)](_0xe33fd3(0xea)+_0xdf912c+'\x0a')),console['error'](a31_0x26bb35[_0xe33fd3(0xda)](_0xe33fd3(0x158))),0x1;let _0x4311db,_0x531b16;try{const _0x33c8fe=parseAndClassifyYamlFiles(_0x67de71,_0xdf912c,{'skipSegments':_0x37f112[_0xe33fd3(0x148)]});_0x4311db=_0x33c8fe[_0xe33fd3(0x12d)],_0x531b16=_0x33c8fe[_0xe33fd3(0xd1)];const _0x3530d8=validateParsedFiles(_0x33c8fe,_0xdf912c);if(_0x3530d8['length']>0x0)return console[_0xe33fd3(0xce)](a31_0x26bb35[_0xe33fd3(0x113)]('\x0aValidation\x20failed:')),console['error'](formatValidationErrors(_0x3530d8)),console[_0xe33fd3(0xce)](a31_0x26bb35['yellow'](_0xe33fd3(0x15e))),0x1;}catch(_0x116806){return console[_0xe33fd3(0xce)](a31_0x26bb35[_0xe33fd3(0x113)]('Error\x20parsing\x20YAML:\x20'+(_0x116806 instanceof Error?_0x116806[_0xe33fd3(0x122)]:_0x116806))),0x1;}if(_0x4311db[_0xe33fd3(0x14a)]===0x0&&_0x531b16['length']===0x0){const _0x3f792e=_0x37f112[_0xe33fd3(0x148)]?_0xe33fd3(0xdd):_0xe33fd3(0x11c);return console[_0xe33fd3(0xce)](a31_0x26bb35['yellow'](_0xe33fd3(0x143)+_0x3f792e+_0xe33fd3(0x13a))),0x0;}const _0x15606c=new Map();_0xf9780f['length']>0x0&&!_0x37f112[_0xe33fd3(0x148)]&&await withSpinner(_0xe33fd3(0xef),async()=>{await batchAsync(_0xf9780f,async _0x246c90=>{const _0x259376=a31_0x3669,_0x555386=await _0x2b1b08[_0x259376(0x127)][_0x259376(0x145)](_0x14df1c,_0x246c90['id']);_0x15606c[_0x259376(0xe0)](_0x246c90['id'],_0x555386);});},{'verbose':_0x37f112['verbose']});const {segmentFiles:_0x1415ac,foldersToCreate:_0x56409d}=await prepareSegmentFiles(_0x4311db,{'segmentByFolderAndName':_0x431ddb,'activationsBySegmentId':_0x15606c,'folderPathToId':_0x3b22c6,'idToEmailMap':_0x40e34b,'connectionIdToNameMap':_0x42d780},_0x40af41,_0x868758,_0xc117c2),_0x284981=_0x203e5b?[]:findSegmentsToDelete(_0xf9780f,_0x4311db[_0xe33fd3(0xe1)](({yamlConfig:_0xba1b58,folderPath:_0x1a1ac1})=>({'yamlConfig':_0xba1b58,'folderPath':resolveTDFolderPath(_0x1a1ac1,_0x868758,_0xc117c2)})),_0xc64af3,_0xc117c2,_0x868758),{journeyFiles:_0x4970a7,foldersToCreate:_0x18ea4d}=await withProgressSpinner(_0xe33fd3(0xd0),async _0x386e30=>prepareJourneyFiles(_0x531b16,{'fetchJourney':async _0x1609a2=>_0x2b1b08['journey'][_0xe33fd3(0x149)](_0x1609a2[_0xe33fd3(0x10d)]),'journeyBundlesByFolderAndName':_0x5cb436,'folderPathToId':_0x3b22c6,'idToEmailMap':_0x40e34b,'connectionIdToNameMap':_0x42d780,'existingSegments':_0xf9780f,'parentId':_0x14df1c,'deps':_0x2b1b08,'progress':{'update':_0x2ee6f9=>{const _0x182c6c=_0xe33fd3;_0x386e30['setPhase'](_0x2ee6f9),_0x37f112[_0x182c6c(0x153)]&&console[_0x182c6c(0xce)]('\x20\x20'+_0x2ee6f9);}},'journeyById':_0x378590,'activationStepsById':_0xcfde81},_0x868758,_0xc117c2),{'verbose':_0x37f112['verbose']})[_0xe33fd3(0x15a)](_0x405526=>_0x405526[_0xe33fd3(0x164)]);for(const _0xefc7f of _0x18ea4d){_0x56409d[_0xe33fd3(0x160)](_0xefc7f);}const _0x5f085f=_0x203e5b?[]:findJourneysToDelete(_0x3bf9f4,_0x531b16['map'](({yamlConfig:_0x314873,folderPath:_0x2197b6})=>({'yamlConfig':_0x314873,'folderPath':resolveTDFolderPath(_0x2197b6,_0x868758,_0xc117c2)})),_0xc64af3,_0xc117c2,_0x868758),_0x493128=calculatePushStats(_0x1415ac,_0x4970a7,_0x56409d,_0x284981,_0x5f085f,!!_0x37f112[_0xe33fd3(0xe7)],!!_0x37f112[_0xe33fd3(0x148)]),_0x528d95=_0x493128['segments']['new'],_0x3bbec0=_0x493128[_0xe33fd3(0x12d)][_0xe33fd3(0xfc)],_0x3b9c20=_0x493128[_0xe33fd3(0x12d)]['unchanged'],_0xa62c7f=_0x493128[_0xe33fd3(0x12d)][_0xe33fd3(0x105)],_0x140697=_0x493128['folders'][_0xe33fd3(0x159)],_0xbfc2e0=_0x493128[_0xe33fd3(0xd1)][_0xe33fd3(0x155)],_0x5ead04=_0x493128[_0xe33fd3(0xd1)][_0xe33fd3(0xfc)],_0x2d63ac=_0x493128[_0xe33fd3(0xd1)][_0xe33fd3(0x107)],_0xb28c3f=_0x493128[_0xe33fd3(0xd1)][_0xe33fd3(0x105)],_0x174b36=_0x493128[_0xe33fd3(0xe9)][_0xe33fd3(0x115)],_0x53efa1=_0x493128[_0xe33fd3(0xe9)]['toCreate'],_0x192fe6=_0x493128[_0xe33fd3(0xe9)][_0xe33fd3(0x133)],_0x25cb4d=_0x493128['activations']['toDelete'];console[_0xe33fd3(0xce)](_0xe33fd3(0xed)+_0x44871e+'\x27:');_0x140697[_0xe33fd3(0x14a)]>0x0&&console[_0xe33fd3(0xce)]('\x20\x20'+a31_0x26bb35[_0xe33fd3(0x11b)](_0xe33fd3(0x161)+_0x140697[_0xe33fd3(0x14a)]+_0xe33fd3(0xdf)));if(!_0x37f112[_0xe33fd3(0x148)]){console[_0xe33fd3(0xce)](_0xe33fd3(0x129)),console[_0xe33fd3(0xce)](_0xe33fd3(0x13b)+a31_0x26bb35[_0xe33fd3(0x137)]('+\x20'+_0x528d95['length']+_0xe33fd3(0xe8))),console['error'](_0xe33fd3(0x13b)+a31_0x26bb35[_0xe33fd3(0x146)]('~\x20'+_0x3bbec0[_0xe33fd3(0x14a)]+_0xe33fd3(0x132)));if(_0xa62c7f[_0xe33fd3(0x14a)]>0x0)console[_0xe33fd3(0xce)]('\x20\x20\x20\x20'+a31_0x26bb35['red']('-\x20'+_0xa62c7f['length']+_0xe33fd3(0x138)));else _0x284981[_0xe33fd3(0x14a)]>0x0&&!_0x37f112['delete']&&console[_0xe33fd3(0xce)]('\x20\x20\x20\x20'+a31_0x26bb35[_0xe33fd3(0xd4)](_0x284981[_0xe33fd3(0x14a)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console['error'](_0xe33fd3(0x13b)+a31_0x26bb35[_0xe33fd3(0xd4)]('=\x20'+_0x3b9c20[_0xe33fd3(0x14a)]+_0xe33fd3(0x10c)));}if(_0x4970a7['length']>0x0||_0x5f085f[_0xe33fd3(0x14a)]>0x0){console['error'](_0xe33fd3(0xf9)),console[_0xe33fd3(0xce)](_0xe33fd3(0x13b)+a31_0x26bb35['green']('+\x20'+_0xbfc2e0['length']+_0xe33fd3(0xe8))),console[_0xe33fd3(0xce)](_0xe33fd3(0x13b)+a31_0x26bb35[_0xe33fd3(0x146)]('~\x20'+_0x5ead04[_0xe33fd3(0x14a)]+_0xe33fd3(0x132)));if(_0xb28c3f[_0xe33fd3(0x14a)]>0x0)console[_0xe33fd3(0xce)](_0xe33fd3(0x13b)+a31_0x26bb35[_0xe33fd3(0x113)]('-\x20'+_0xb28c3f['length']+_0xe33fd3(0x138)));else _0x5f085f[_0xe33fd3(0x14a)]>0x0&&!_0x37f112['delete']&&console[_0xe33fd3(0xce)](_0xe33fd3(0x13b)+a31_0x26bb35[_0xe33fd3(0xd4)](_0x5f085f[_0xe33fd3(0x14a)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0xe33fd3(0xce)](_0xe33fd3(0x13b)+a31_0x26bb35[_0xe33fd3(0xd4)]('=\x20'+_0x2d63ac[_0xe33fd3(0x14a)]+_0xe33fd3(0x10c)));}_0x174b36[_0xe33fd3(0x14a)]>0x0&&!_0x37f112[_0xe33fd3(0x148)]&&(console['error'](''),console[_0xe33fd3(0xce)](_0xe33fd3(0x11a)),_0x53efa1[_0xe33fd3(0x14a)]>0x0&&console['error']('\x20\x20\x20\x20'+a31_0x26bb35[_0xe33fd3(0x137)]('+\x20'+_0x53efa1[_0xe33fd3(0x14a)]+_0xe33fd3(0x120))),_0x192fe6[_0xe33fd3(0x14a)]>0x0&&console[_0xe33fd3(0xce)](_0xe33fd3(0x13b)+a31_0x26bb35[_0xe33fd3(0x146)]('~\x20'+_0x192fe6[_0xe33fd3(0x14a)]+_0xe33fd3(0x15f))),_0x25cb4d['length']>0x0&&console[_0xe33fd3(0xce)](_0xe33fd3(0x13b)+a31_0x26bb35[_0xe33fd3(0x113)]('-\x20'+_0x25cb4d[_0xe33fd3(0x14a)]+'\x20to\x20delete')));console[_0xe33fd3(0xce)](_0xe33fd3(0x12b)+a31_0x26bb35[_0xe33fd3(0xda)](_0xdf912c)+'\x0a');if(_0x140697[_0xe33fd3(0x14a)]>0x0){console[_0xe33fd3(0xce)](_0xe33fd3(0x117));for(const _0xe72f0e of _0x140697){console[_0xe33fd3(0xce)]('\x20\x20'+a31_0x26bb35[_0xe33fd3(0x11b)]('+')+'\x20'+_0xe72f0e);}console[_0xe33fd3(0xce)]('');}if(_0x528d95[_0xe33fd3(0x14a)]>0x0&&!_0x37f112['journeysOnly'])for(const _0x33e352 of _0x528d95){const _0xee4caa=_0x33e352[_0xe33fd3(0xff)]?_0x33e352[_0xe33fd3(0xff)]+'/'+_0x33e352['yamlConfig'][_0xe33fd3(0xe3)]:_0x33e352[_0xe33fd3(0xd7)][_0xe33fd3(0xe3)],_0x5728a8=_0x33e352[_0xe33fd3(0xd7)][_0xe33fd3(0xe9)]?.['length']||0x0,_0x402cc7=_0x5728a8>0x0?a31_0x26bb35[_0xe33fd3(0xd4)]('\x20['+_0x5728a8+_0xe33fd3(0x103)):'';console[_0xe33fd3(0xce)]('\x0a'+a31_0x26bb35[_0xe33fd3(0x137)](_0xe33fd3(0x121))+'\x20'+_0xee4caa+_0x402cc7),console[_0xe33fd3(0xce)]('─'['repeat'](0x3c)),_0x33e352['diff']&&console[_0xe33fd3(0xce)](_0x33e352[_0xe33fd3(0x125)]),console[_0xe33fd3(0xce)]('─'[_0xe33fd3(0x14b)](0x3c));}if(_0xa62c7f['length']>0x0&&!_0x37f112[_0xe33fd3(0x148)])for(const _0x58081a of _0xa62c7f){const _0x57ebe4=_0x58081a[_0xe33fd3(0x131)]?_0xc64af3[_0xe33fd3(0x15b)](_0x58081a[_0xe33fd3(0x131)][_0xe33fd3(0x11f)]())||'':'',_0x51262=_0x57ebe4?_0x57ebe4+'/'+_0x58081a[_0xe33fd3(0xe3)]:_0x58081a[_0xe33fd3(0xe3)],_0x81f942=_0x15606c[_0xe33fd3(0x15b)](_0x58081a['id'])||[],_0x528d41=_0x81f942['length']>0x0?a31_0x26bb35[_0xe33fd3(0xd4)]('\x20['+_0x81f942[_0xe33fd3(0x14a)]+_0xe33fd3(0x103)):'';console[_0xe33fd3(0xce)]('\x0a'+a31_0x26bb35[_0xe33fd3(0x113)](_0xe33fd3(0xcf))+'\x20'+_0x51262+_0x528d41),console[_0xe33fd3(0xce)]('─'['repeat'](0x3c));const _0x4591ea=segmentWithActivationsToYaml(_0x58081a,_0x81f942,undefined,_0x40e34b,_0x42d780),_0x43c059=segmentToYamlString(_0x4591ea),_0x6324d8=generateDiff(_0x43c059,'');console[_0xe33fd3(0xce)](formatDiffWithColors(_0x6324d8)),console[_0xe33fd3(0xce)]('─'[_0xe33fd3(0x14b)](0x3c));}const _0x27031a=_0x1415ac[_0xe33fd3(0x134)](_0xbb9eb2=>!_0xbb9eb2[_0xe33fd3(0xfa)]&&_0xbb9eb2[_0xe33fd3(0x125)]);if(_0x27031a['length']>0x0&&!_0x37f112['journeysOnly'])for(const _0x1375ce of _0x27031a){const _0x5214e4=_0x1375ce[_0xe33fd3(0xff)]?_0x1375ce['folderPath']+'/'+_0x1375ce[_0xe33fd3(0xd7)][_0xe33fd3(0xe3)]:_0x1375ce['yamlConfig'][_0xe33fd3(0xe3)];console['error']('\x0a'+a31_0x26bb35[_0xe33fd3(0x146)]('Changes\x20to:')+'\x20'+_0x5214e4),console[_0xe33fd3(0xce)]('─'[_0xe33fd3(0x14b)](0x3c)),console[_0xe33fd3(0xce)](_0x1375ce[_0xe33fd3(0x125)]),console[_0xe33fd3(0xce)]('─'[_0xe33fd3(0x14b)](0x3c));}if(_0xbfc2e0[_0xe33fd3(0x14a)]>0x0)for(const _0x3303f1 of _0xbfc2e0){const _0x110875=_0x3303f1['folderPath']?_0x3303f1['folderPath']+'/'+_0x3303f1[_0xe33fd3(0xd7)][_0xe33fd3(0xe3)]:_0x3303f1[_0xe33fd3(0xd7)]['name'];console['error']('\x0a'+a31_0x26bb35['green'](_0xe33fd3(0x108))+'\x20'+_0x110875),console[_0xe33fd3(0xce)]('─'[_0xe33fd3(0x14b)](0x3c)),_0x3303f1[_0xe33fd3(0x125)]&&console[_0xe33fd3(0xce)](_0x3303f1[_0xe33fd3(0x125)]),console['error']('─'[_0xe33fd3(0x14b)](0x3c));}const _0x291f96=_0x4970a7[_0xe33fd3(0x134)](_0x5de010=>!_0x5de010[_0xe33fd3(0xfa)]&&_0x5de010['diff']);if(_0x291f96['length']>0x0)for(const _0x3908d0 of _0x291f96){const _0x499b99=_0x3908d0[_0xe33fd3(0xff)]?_0x3908d0[_0xe33fd3(0xff)]+'/'+_0x3908d0[_0xe33fd3(0xd7)][_0xe33fd3(0xe3)]:_0x3908d0['yamlConfig'][_0xe33fd3(0xe3)];console[_0xe33fd3(0xce)]('\x0a'+a31_0x26bb35[_0xe33fd3(0x146)](_0xe33fd3(0xfd))+'\x20'+_0x499b99),console['error']('─'[_0xe33fd3(0x14b)](0x3c)),console[_0xe33fd3(0xce)](_0x3908d0[_0xe33fd3(0x125)]),console['error']('─'['repeat'](0x3c));}if(_0xb28c3f[_0xe33fd3(0x14a)]>0x0)for(const _0x53524d of _0xb28c3f){const _0x10ad2d=_0x53524d['folderId']?_0xc64af3['get'](_0x53524d[_0xe33fd3(0x156)])||'':'',_0x11baf6=_0x10ad2d?_0x10ad2d+'/'+_0x53524d['journeyBundleName']:_0x53524d[_0xe33fd3(0x12f)];console['error']('\x0a'+a31_0x26bb35[_0xe33fd3(0x113)](_0xe33fd3(0x112))+'\x20'+_0x11baf6),console[_0xe33fd3(0xce)]('─'[_0xe33fd3(0x14b)](0x3c)),console['error'](a31_0x26bb35[_0xe33fd3(0x113)](_0xe33fd3(0xf6))),console['error']('─'[_0xe33fd3(0x14b)](0x3c));}if(_0x37f112[_0xe33fd3(0x11e)])return console[_0xe33fd3(0xce)](a31_0x26bb35[_0xe33fd3(0x146)]('\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made')),0x0;const _0x18c46f=_0x37f112['journeysOnly']?![]:_0x528d95[_0xe33fd3(0x14a)]>0x0||_0x3bbec0[_0xe33fd3(0x14a)]>0x0||_0xa62c7f[_0xe33fd3(0x14a)]>0x0,_0x43b613=_0xbfc2e0[_0xe33fd3(0x14a)]>0x0||_0x5ead04[_0xe33fd3(0x14a)]>0x0||_0xb28c3f[_0xe33fd3(0x14a)]>0x0,_0x509f7e=_0x37f112['journeysOnly']?![]:_0x174b36['length']>0x0,_0x485b09=_0x140697[_0xe33fd3(0x14a)]>0x0;if(!_0x18c46f&&!_0x43b613&&!_0x509f7e&&!_0x485b09){const _0x1404aa=_0x37f112[_0xe33fd3(0x148)]?_0xe33fd3(0x13d):_0xe33fd3(0xe4);console[_0xe33fd3(0xce)](a31_0x26bb35[_0xe33fd3(0x137)](_0x1404aa));if(_0x203e5b&&_0x2d63ac[_0xe33fd3(0x14a)]===0x1){const _0x2ebd81=_0x2d63ac[0x0];if(_0x2ebd81['existingJourney']?.['id']){const _0x9a9136=getConsoleNextUrl(_0x37f112['site'],_0xe33fd3(0x14c)+_0x14df1c+_0xe33fd3(0xe6)+_0x2ebd81['existingJourney']['id']+_0xe33fd3(0x111));console[_0xe33fd3(0xce)]('\x20\x20'+a31_0x26bb35[_0xe33fd3(0xda)](_0x9a9136));}}return 0x0;}const _0x4d0827=_0x37f112[_0xe33fd3(0x148)]?_0xbfc2e0[_0xe33fd3(0x14a)]+_0x5ead04[_0xe33fd3(0x14a)]+_0xb28c3f[_0xe33fd3(0x14a)]+_0x140697['length']:_0x528d95[_0xe33fd3(0x14a)]+_0x3bbec0['length']+_0xa62c7f[_0xe33fd3(0x14a)]+_0xbfc2e0[_0xe33fd3(0x14a)]+_0x5ead04[_0xe33fd3(0x14a)]+_0xb28c3f[_0xe33fd3(0x14a)]+_0x140697[_0xe33fd3(0x14a)]+_0x174b36[_0xe33fd3(0x14a)];if(!_0x37f112[_0xe33fd3(0xe2)]&&_0x4d0827>0x0){if(!isInteractive())return console[_0xe33fd3(0xce)](a31_0x26bb35[_0xe33fd3(0x113)](_0xe33fd3(0x126)),_0xe33fd3(0xdb)),console['error'](a31_0x26bb35['dim']('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x2e4633=await confirmKey(_0xe33fd3(0x13f)+_0x4d0827+_0xe33fd3(0x119));if(!_0x2e4633)return console[_0xe33fd3(0xce)](a31_0x26bb35[_0xe33fd3(0x146)](_0xe33fd3(0xd2))),0x1;}const _0x22b00a={'withProgress':async(_0x371dca,_0x3a6bbe)=>{const _0x2fdbc8=_0xe33fd3,_0x5bee5f=await withSpinner(_0x371dca,_0x3a6bbe,{'verbose':_0x37f112[_0x2fdbc8(0x153)]});return{'data':_0x5bee5f[_0x2fdbc8(0x164)]};},'logInfo':_0x28c612=>console[_0xe33fd3(0xce)](a31_0x26bb35['blue']('✔\x20'+_0x28c612)),'logSuccess':_0x4585d8=>console['error'](a31_0x26bb35[_0xe33fd3(0x137)]('✔\x20'+_0x4585d8)),'logWarning':_0x464aa5=>console[_0xe33fd3(0xce)](a31_0x26bb35[_0xe33fd3(0x146)]('⚠\x20'+_0x464aa5)),'logDeleted':_0x4084b3=>console[_0xe33fd3(0xce)](a31_0x26bb35[_0xe33fd3(0x113)]('✔\x20'+_0x4084b3))},_0x382992={'segment':_0x2b1b08[_0xe33fd3(0x127)],'journey':_0x2b1b08[_0xe33fd3(0xdd)],'user':_0x2b1b08['user'],'connection':_0x2b1b08[_0xe33fd3(0x13e)]};_0x140697[_0xe33fd3(0x14a)]>0x0&&(_0x3b22c6=await executePushFolders(_0x382992,_0x140697,_0x3b22c6,{'parentId':_0x14df1c},_0x22b00a));const _0x2cdbd9={'rootFolderId':_0x42c854,'folderPathToId':_0x3b22c6,'folderIdToPath':_0xc64af3,'segmentNameToId':_0x53107f,'activationsBySegmentId':_0x15606c,'emailToIdMap':_0x5274ba,'idToEmailMap':_0x40e34b,'connectionNameToIdMap':_0x1de229['nameToId'],'connectionIdToNameMap':_0x1de229[_0xe33fd3(0xdc)],'connectionNameToTypeMap':_0x2e4eb0},_0x5e27b8=await executePushSegments(_0x382992,_0x37f112[_0xe33fd3(0x148)]?[]:_0x1415ac,_0x2cdbd9,{'parentId':_0x14df1c},_0x22b00a),_0x1f8c47=_0x5e27b8[_0xe33fd3(0x142)],_0x140a47=_0x5e27b8[_0xe33fd3(0xd3)],_0x35ca11=_0x5e27b8[_0xe33fd3(0xe9)][_0xe33fd3(0x142)],_0x4b283e=_0x5e27b8[_0xe33fd3(0xe9)][_0xe33fd3(0xd3)],_0x240285=_0x5e27b8[_0xe33fd3(0xe9)][_0xe33fd3(0xd8)],_0x5278ff=await executePushSegmentDeletions(_0x382992,_0x37f112[_0xe33fd3(0x148)]?[]:_0xa62c7f,_0x22b00a);let _0x48cf2a=0x0,_0x3e7b96=0x0,_0x266e90=0x0;const _0x49ee99=new Map(_0x53107f);for(const [_0x2dffb3,_0x49184b]of _0x5e27b8[_0xe33fd3(0xf8)]){_0x49ee99[_0xe33fd3(0xe0)](_0x2dffb3,_0x49184b);}if(_0x4970a7[_0xe33fd3(0x14a)]>0x0){const _0x292e32={..._0x2cdbd9,'segmentNameToId':_0x49ee99,'existingSegments':_0xf9780f,'activationContext':_0x40af41},_0x27f7c1=await executePushJourneys(_0x382992,_0x4970a7,_0x292e32,{'parentId':_0x14df1c,'rootFolderId':_0x42c854,'verbose':_0x37f112[_0xe33fd3(0x153)]},_0x22b00a);_0x48cf2a=_0x27f7c1[_0xe33fd3(0x142)],_0x3e7b96=_0x27f7c1[_0xe33fd3(0xd3)];if(_0x203e5b&&_0x27f7c1['results'][_0xe33fd3(0x14a)]===0x1){const _0x435d0e=_0x27f7c1[_0xe33fd3(0x10e)][0x0];if(_0x435d0e[_0xe33fd3(0x10d)]){const _0x311b0a=getConsoleNextUrl(_0x37f112['site'],_0xe33fd3(0x14c)+_0x14df1c+_0xe33fd3(0xe6)+_0x435d0e[_0xe33fd3(0x10d)]+_0xe33fd3(0x111));console[_0xe33fd3(0xce)]('\x20\x20'+a31_0x26bb35['cyan'](_0x311b0a));}}}for(const _0x2cc5ec of _0xb28c3f){console[_0xe33fd3(0xce)](a31_0x26bb35['yellow'](_0xe33fd3(0x109)+_0x2cc5ec[_0xe33fd3(0x12f)])),_0x266e90++;}const _0x2714bf=[];if(_0x1f8c47>0x0)_0x2714bf[_0xe33fd3(0x144)](_0x1f8c47+_0xe33fd3(0x12c));if(_0x140a47>0x0)_0x2714bf[_0xe33fd3(0x144)](_0x140a47+'\x20updated');if(_0x5278ff>0x0)_0x2714bf[_0xe33fd3(0x144)](_0x5278ff+_0xe33fd3(0x10a));const _0x343006=[];if(_0x48cf2a>0x0)_0x343006[_0xe33fd3(0x144)](_0x48cf2a+_0xe33fd3(0x12c));if(_0x3e7b96>0x0)_0x343006[_0xe33fd3(0x144)](_0x3e7b96+_0xe33fd3(0x123));if(_0x266e90>0x0)_0x343006[_0xe33fd3(0x144)](_0x266e90+_0xe33fd3(0x10a));const _0x25434c=[];if(_0x35ca11>0x0)_0x25434c['push'](_0x35ca11+_0xe33fd3(0x12c));if(_0x4b283e>0x0)_0x25434c[_0xe33fd3(0x144)](_0x4b283e+_0xe33fd3(0x123));if(_0x240285>0x0)_0x25434c[_0xe33fd3(0x144)](_0x240285+_0xe33fd3(0x10a));return console[_0xe33fd3(0xce)](a31_0x26bb35[_0xe33fd3(0x137)]('\x0a✔\x20Push\x20complete')),_0x2714bf['length']>0x0&&!_0x37f112[_0xe33fd3(0x148)]&&console[_0xe33fd3(0xce)](_0xe33fd3(0x157)+_0x2714bf[_0xe33fd3(0x102)](',\x20')),_0x343006[_0xe33fd3(0x14a)]>0x0&&console[_0xe33fd3(0xce)](_0xe33fd3(0xfe)+_0x343006['join'](',\x20')),_0x25434c[_0xe33fd3(0x14a)]>0x0&&!_0x37f112['journeysOnly']&&console[_0xe33fd3(0xce)](_0xe33fd3(0xd6)+_0x25434c['join'](',\x20')),0x0;}}
|
|
1
|
+
const a31_0x123959=a31_0x3a8a;(function(_0x59153b,_0x7461c8){const _0x328b36=a31_0x3a8a,_0x589768=_0x59153b();while(!![]){try{const _0x145b5d=parseInt(_0x328b36(0x173))/0x1+parseInt(_0x328b36(0x154))/0x2*(parseInt(_0x328b36(0x177))/0x3)+parseInt(_0x328b36(0x149))/0x4*(-parseInt(_0x328b36(0x113))/0x5)+-parseInt(_0x328b36(0x175))/0x6+parseInt(_0x328b36(0x14f))/0x7+-parseInt(_0x328b36(0x12a))/0x8*(-parseInt(_0x328b36(0x118))/0x9)+parseInt(_0x328b36(0x17e))/0xa*(-parseInt(_0x328b36(0x130))/0xb);if(_0x145b5d===_0x7461c8)break;else _0x589768['push'](_0x589768['shift']());}catch(_0x4776c7){_0x589768['push'](_0x589768['shift']());}}}(a31_0x2bd0,0x3d7a7));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors}from'../utils/diff.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a31_0x12d151 from'chalk';import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';import{buildFolderMaps}from'../sdk/segment/resolution-context.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';function a31_0x2bd0(){const _0x2e230b=['Parent\x20segment:\x20','\x20\x20Segments:\x20','folders','folderId','\x20to\x20update','1492540FPVEZG','\x20updated','/app/ps/','createdAt','audienceId','2eKscfy','join','connection','\x20activations]','yellow','updatedAt','\x20new','Fetching\x20existing\x20segments...','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','toCreate','toDelete','journeyBundleId','user','length','description','journey','\x20to\x20delete','\x20\x20Activations:\x20','cyan','segments','Error\x20parsing\x20YAML:\x20','red','deleted','name','/j/da/je','.yaml','Fetching\x20existing\x20folders...','execute','Fetching\x20parent\x20segment\x20details...','\x20folders\x20to\x20create','\x20unchanged','37237IOuGGs','idToName','194136bggrEJ','no_parent','1127145NLfvgY','isNew','map','journeyId','parentName','errorCode','\x20\x20🗺️\x20\x20Journeys:','10VTUjoj','get','set','New\x20journey:','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','helpText','parent_name','Delete\x20journey:','(Journey\x20will\x20be\x20deleted)','paused','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','activations','filter','delete','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','segment\x20or\x20journey','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','segment','then','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','unchanged','\x20\x20Source:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','\x20to\x20create','Fetching\x20connections\x20for\x20name\x20resolution...','dim','\x20\x20📊\x20Segments:','changed','\x20\x20\x20\x20','targetDir','new','\x20created','\x20deleted','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)','results','Aborted.','getOutputSchemaWithCache','\x20YAML\x20files\x20found','yes','dryRun','existingJourney','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','diff','yamlConfig','add','listJourneysWithDetailsFromParentSegment','endsWith','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','205drHuCn','type','Changes\x20to\x20journey:','toString','site','81WmnGtP','message','segmentFolderId','Delete\x20segment:','error','buildUserMaps','journeys','Source\x20directory:\x20','\x0aError:','\x20changed','getJourney','Changes\x20to:','list','getParent','attributes','No\x20','Fetching\x20users\x20for\x20email\x20resolution...','resolveParentId','182304SqzbcN','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','Error:\x20','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','Preparing\x20journeys...','listSegments','1701051cCUYiP','updated','journeyBundleName','cwd','created','isScoped','\x20changes?','listActivations','New\x20segment:','Error:\x20Directory\x20not\x20found:\x20','push','journeysOnly','nameToId','\x0aPush\x20summary\x20for\x20\x27','versionNumber','folderPath','all','verbose','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','blue','repeat','segment:push','data','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','green','38288oRPjwt'];a31_0x2bd0=function(){return _0x2e230b;};return a31_0x2bd0();}function a31_0x3a8a(_0x2eb2cb,_0x55d14b){_0x2eb2cb=_0x2eb2cb-0xf6;const _0x2bd0f0=a31_0x2bd0();let _0x3a8a0a=_0x2bd0f0[_0x2eb2cb];return _0x3a8a0a;}export class SegmentPushCommand extends BaseCommand{['name']=a31_0x123959(0x145);[a31_0x123959(0x162)]=a31_0x123959(0x12d);async[a31_0x123959(0x16f)](_0x49a49c){const _0x113a1b=a31_0x123959,{options:_0x1b472e,args:_0x37b683,tdx:_0x284d80}=_0x49a49c,_0xcb9450=_0x1b472e,_0x5ee329=await resolveTarget({'arg':_0x37b683[0x0],'contextParent':_0x1b472e['parentSegment'],'cwd':process[_0x113a1b(0x133)]()});if(!isSuccessfulResolution(_0x5ee329))return _0x5ee329[_0x113a1b(0x17c)]===_0x113a1b(0x176)?(console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x158)](_0x113a1b(0x188))),console[_0x113a1b(0x11c)](_0x113a1b(0x104)),console[_0x113a1b(0x11c)](_0x113a1b(0xf9)),console[_0x113a1b(0x11c)](_0x113a1b(0x15c))):(console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x169)](_0x113a1b(0x12c)+_0x5ee329['message']+'\x0a')),_0x5ee329[_0x113a1b(0x183)]&&console[_0x113a1b(0x11c)](a31_0x12d151['cyan'](_0x5ee329['helpText']))),0x1;if(_0x5ee329[_0x113a1b(0x114)]===_0x113a1b(0x184))return console['error'](a31_0x12d151[_0x113a1b(0x169)](_0x113a1b(0x139)+_0x5ee329['targetDir']+'\x0a')),console[_0x113a1b(0x11c)](a31_0x12d151['cyan'](_0x113a1b(0x182))),0x1;const _0x7bc4c4=_0x5ee329[_0x113a1b(0x17b)],_0x464180=_0x5ee329[_0x113a1b(0x100)],_0x188e9d=_0x5ee329[_0x113a1b(0x114)]==='file'?_0x5ee329['filePath']:undefined,_0xcc1067=getScopedDetails(_0x5ee329),_0x374b81=_0xcc1067?.[_0x113a1b(0x135)]??![],_0x320dd0=_0xcc1067?.['scopedFolderPath']??'';if(!existsSync(_0x464180))return console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x169)](_0x113a1b(0x139)+_0x464180+'\x0a')),console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x166)](_0x113a1b(0x182))),0x1;_0xcb9450['verbose']&&(console[_0x113a1b(0x11c)]('Site:\x20'+_0xcb9450[_0x113a1b(0x117)]),console[_0x113a1b(0x11c)](_0x113a1b(0x14a)+_0x7bc4c4),console['error'](_0x113a1b(0x11f)+_0x464180),_0x374b81&&console['error']('Scoped\x20to\x20folder:\x20'+_0x320dd0));const _0x42b514=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x7bc4c4+'\x27...',()=>_0x284d80[_0x113a1b(0x18f)][_0x113a1b(0x129)](_0x7bc4c4),{'verbose':_0xcb9450['verbose']}),_0x8c26fb=_0x42b514[_0x113a1b(0x146)],[_0x43671b,_0x139acf,_0x4e1992,_0x458d0b,_0x39d864]=await Promise[_0x113a1b(0x140)]([withSpinner(_0x113a1b(0x170),()=>_0x284d80[_0x113a1b(0x18f)][_0x113a1b(0x125)](_0x8c26fb),{'verbose':_0xcb9450['verbose']}),withSpinner(_0x113a1b(0x15b),()=>_0x284d80['segment'][_0x113a1b(0x12f)](_0x8c26fb),{'verbose':_0xcb9450['verbose']}),withSpinner(_0x113a1b(0x16e),()=>_0x284d80[_0x113a1b(0x18f)]['listFolders'](_0x8c26fb),{'verbose':_0xcb9450['verbose']}),withSpinner('Fetching\x20existing\x20journeys...',()=>_0x284d80[_0x113a1b(0x163)][_0x113a1b(0x110)](_0x8c26fb,{'includeAllVersions':!![]}),{'verbose':_0xcb9450[_0x113a1b(0x141)]}),withSpinner(_0x113a1b(0x128),()=>_0x284d80[_0x113a1b(0x160)][_0x113a1b(0x11d)](),{'verbose':_0xcb9450[_0x113a1b(0x141)]})[_0x113a1b(0x190)](_0x2f7668=>_0x2f7668[_0x113a1b(0x146)])]),_0x1882ba=_0x43671b[_0x113a1b(0x146)],_0x4e992d=extractRootFolderId(_0x1882ba),_0x4732aa=_0x139acf['data'],_0x22dd3c=_0x4e1992[_0x113a1b(0x146)],{journeys:_0x1d0541,activationStepsById:_0x25c4b2}=_0x458d0b['data'],_0x333a8d=new Map(_0x1d0541[_0x113a1b(0x179)](_0x32c153=>[_0x32c153['id'],_0x32c153])),_0x4f74fd=_0x1d0541[_0x113a1b(0x179)](_0x27f1e1=>({'id':_0x27f1e1['id'],'name':_0x27f1e1[_0x113a1b(0x126)][_0x113a1b(0x16b)],'journeyBundleName':_0x27f1e1['attributes'][_0x113a1b(0x132)]||'','journeyBundleId':_0x27f1e1[_0x113a1b(0x126)][_0x113a1b(0x15f)]||'','versionNumber':_0x27f1e1['attributes'][_0x113a1b(0x13e)],'description':_0x27f1e1['attributes'][_0x113a1b(0x162)],'state':_0x27f1e1[_0x113a1b(0x126)]['state'],'paused':_0x27f1e1['attributes'][_0x113a1b(0x187)],'audienceId':_0x27f1e1[_0x113a1b(0x126)][_0x113a1b(0x153)],'folderId':_0x27f1e1['relationships']?.['parentFolder']?.['data']?.['id'],'createdAt':_0x27f1e1['attributes'][_0x113a1b(0x152)],'updatedAt':_0x27f1e1[_0x113a1b(0x126)][_0x113a1b(0x159)]})),{emailToId:_0x96534f,idToEmail:_0x4ff01f}=_0x39d864,_0x34bc40=await withSpinner(_0x113a1b(0xfb),async()=>{const _0x5e9738=_0x113a1b,_0x5764b1=await _0x284d80[_0x5e9738(0x156)][_0x5e9738(0x124)]();return buildConnectionMaps(_0x5764b1);},{'verbose':_0xcb9450[_0x113a1b(0x141)]})[_0x113a1b(0x190)](_0x25c0f4=>_0x25c0f4[_0x113a1b(0x146)]),_0xfb1b00=_0x34bc40['nameToId'],_0x298e4e=_0x34bc40[_0x113a1b(0x174)],_0x4aec5e=_0x34bc40['nameToType'],_0x180c6e={'emailToIdMap':_0x96534f,'connectionNameToIdMap':_0xfb1b00,'connectionNameToTypeMap':_0x4aec5e,'getSchema':_0x5c115d=>_0x284d80[_0x113a1b(0x156)][_0x113a1b(0x107)](_0x5c115d)};let {pathToId:_0xff9239,idToPath:_0x26e72c}=buildFolderMaps(_0x22dd3c);const _0x3ba3ae=buildSegmentLookupMap(_0x4732aa,_0x26e72c),_0x4fe2ba=buildSegmentNameToIdMap(_0x4732aa),_0x2408a9=buildJourneyBundleLookupMap(_0x4f74fd,_0x26e72c);let _0x6ca78a;if(_0x188e9d){if(!_0x188e9d[_0x113a1b(0x111)]('.yml')&&!_0x188e9d[_0x113a1b(0x111)](_0x113a1b(0x16d)))return console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x169)](_0x113a1b(0xf6)+_0x188e9d+'\x0a')),0x1;_0x6ca78a=[_0x188e9d];}else _0x6ca78a=findYamlFiles(_0x464180);if(_0x6ca78a[_0x113a1b(0x161)]===0x0)return console['error'](a31_0x12d151[_0x113a1b(0x169)](_0x113a1b(0x18c)+_0x464180+'\x0a')),console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x166)](_0x113a1b(0x12b))),0x1;let _0x41bfdc,_0x36c611;try{const _0x9c688d=parseAndClassifyYamlFiles(_0x6ca78a,_0x464180,{'skipSegments':_0xcb9450['journeysOnly']});_0x41bfdc=_0x9c688d['segments'],_0x36c611=_0x9c688d[_0x113a1b(0x11e)];const _0x12c525=validateParsedFiles(_0x9c688d,_0x464180);if(_0x12c525[_0x113a1b(0x161)]>0x0)return console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x169)]('\x0aValidation\x20failed:')),console[_0x113a1b(0x11c)](formatValidationErrors(_0x12c525)),console['error'](a31_0x12d151[_0x113a1b(0x158)]('\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.')),0x1;}catch(_0xd55a2a){return console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x169)](_0x113a1b(0x168)+(_0xd55a2a instanceof Error?_0xd55a2a[_0x113a1b(0x119)]:_0xd55a2a))),0x1;}if(_0x41bfdc[_0x113a1b(0x161)]===0x0&&_0x36c611[_0x113a1b(0x161)]===0x0){const _0x2506aa=_0xcb9450[_0x113a1b(0x13b)]?'journey':_0x113a1b(0x18d);return console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x158)](_0x113a1b(0x127)+_0x2506aa+_0x113a1b(0x108))),0x0;}const _0x1d6a3e=new Map();_0x4732aa[_0x113a1b(0x161)]>0x0&&!_0xcb9450['journeysOnly']&&await withSpinner('Fetching\x20existing\x20activations...',async()=>{await batchAsync(_0x4732aa,async _0x2c380d=>{const _0x527628=a31_0x3a8a,_0x17a77f=await _0x284d80[_0x527628(0x18f)][_0x527628(0x137)](_0x8c26fb,_0x2c380d['id']);_0x1d6a3e[_0x527628(0x180)](_0x2c380d['id'],_0x17a77f);});},{'verbose':_0xcb9450[_0x113a1b(0x141)]});const {segmentFiles:_0x32fd24,foldersToCreate:_0x4b2e62}=await prepareSegmentFiles(_0x41bfdc,{'segmentByFolderAndName':_0x3ba3ae,'activationsBySegmentId':_0x1d6a3e,'folderPathToId':_0xff9239,'idToEmailMap':_0x4ff01f,'connectionIdToNameMap':_0x298e4e},_0x180c6e,_0x374b81,_0x320dd0),_0x5c486e=_0x188e9d?[]:findSegmentsToDelete(_0x4732aa,_0x41bfdc[_0x113a1b(0x179)](({yamlConfig:_0x18e93f,folderPath:_0x48b074})=>({'yamlConfig':_0x18e93f,'folderPath':resolveTDFolderPath(_0x48b074,_0x374b81,_0x320dd0)})),_0x26e72c,_0x320dd0,_0x374b81),{journeyFiles:_0x47e34c,foldersToCreate:_0x414b61}=await withProgressSpinner(_0x113a1b(0x12e),async _0x277cb7=>prepareJourneyFiles(_0x36c611,{'fetchJourney':async _0x1e81e2=>_0x284d80['journey'][_0x113a1b(0x122)](_0x1e81e2[_0x113a1b(0x17a)]),'journeyBundlesByFolderAndName':_0x2408a9,'folderPathToId':_0xff9239,'idToEmailMap':_0x4ff01f,'connectionIdToNameMap':_0x298e4e,'existingSegments':_0x4732aa,'parentId':_0x8c26fb,'deps':_0x284d80,'progress':{'update':_0x4b1903=>{const _0x3782ed=_0x113a1b;_0x277cb7['setPhase'](_0x4b1903),_0xcb9450[_0x3782ed(0x141)]&&console['error']('\x20\x20'+_0x4b1903);}},'journeyById':_0x333a8d,'activationStepsById':_0x25c4b2},_0x374b81,_0x320dd0),{'verbose':_0xcb9450[_0x113a1b(0x141)]})['then'](_0x34a3a2=>_0x34a3a2[_0x113a1b(0x146)]);for(const _0x7d9b68 of _0x414b61){_0x4b2e62[_0x113a1b(0x10f)](_0x7d9b68);}const _0x332ac2=_0x188e9d?[]:findJourneysToDelete(_0x4f74fd,_0x36c611[_0x113a1b(0x179)](({yamlConfig:_0x48a949,folderPath:_0xd8461b})=>({'yamlConfig':_0x48a949,'folderPath':resolveTDFolderPath(_0xd8461b,_0x374b81,_0x320dd0)})),_0x26e72c,_0x320dd0,_0x374b81),_0x528c1d=calculatePushStats(_0x32fd24,_0x47e34c,_0x4b2e62,_0x5c486e,_0x332ac2,!!_0xcb9450['delete'],!!_0xcb9450['journeysOnly']),_0x1e1871=_0x528c1d[_0x113a1b(0x167)]['new'],_0xa2c547=_0x528c1d[_0x113a1b(0x167)][_0x113a1b(0xfe)],_0x5d20a5=_0x528c1d['segments'][_0x113a1b(0xf7)],_0x3bfc09=_0x528c1d[_0x113a1b(0x167)][_0x113a1b(0x15e)],_0x3cf048=_0x528c1d[_0x113a1b(0x14c)]['toCreate'],_0x5ebcb3=_0x528c1d[_0x113a1b(0x11e)][_0x113a1b(0x101)],_0x4f796c=_0x528c1d[_0x113a1b(0x11e)][_0x113a1b(0xfe)],_0x4e2779=_0x528c1d['journeys'][_0x113a1b(0xf7)],_0x5b310b=_0x528c1d['journeys'][_0x113a1b(0x15e)],_0x322aea=_0x528c1d[_0x113a1b(0x189)][_0x113a1b(0x140)],_0x1f4c12=_0x528c1d[_0x113a1b(0x189)][_0x113a1b(0x15d)],_0x17fbe2=_0x528c1d[_0x113a1b(0x189)]['toUpdate'],_0x5e47a6=_0x528c1d['activations']['toDelete'];console['error'](_0x113a1b(0x13d)+_0x7bc4c4+'\x27:');_0x3cf048[_0x113a1b(0x161)]>0x0&&console[_0x113a1b(0x11c)]('\x20\x20'+a31_0x12d151['blue']('📁\x20'+_0x3cf048[_0x113a1b(0x161)]+_0x113a1b(0x171)));if(!_0xcb9450['journeysOnly']){console['error'](_0x113a1b(0xfd)),console[_0x113a1b(0x11c)](_0x113a1b(0xff)+a31_0x12d151[_0x113a1b(0x148)]('+\x20'+_0x1e1871[_0x113a1b(0x161)]+_0x113a1b(0x15a))),console[_0x113a1b(0x11c)](_0x113a1b(0xff)+a31_0x12d151[_0x113a1b(0x158)]('~\x20'+_0xa2c547[_0x113a1b(0x161)]+'\x20changed'));if(_0x3bfc09[_0x113a1b(0x161)]>0x0)console[_0x113a1b(0x11c)](_0x113a1b(0xff)+a31_0x12d151[_0x113a1b(0x169)]('-\x20'+_0x3bfc09[_0x113a1b(0x161)]+_0x113a1b(0x164)));else _0x5c486e[_0x113a1b(0x161)]>0x0&&!_0xcb9450[_0x113a1b(0x18b)]&&console['error'](_0x113a1b(0xff)+a31_0x12d151[_0x113a1b(0xfc)](_0x5c486e[_0x113a1b(0x161)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x113a1b(0x11c)]('\x20\x20\x20\x20'+a31_0x12d151[_0x113a1b(0xfc)]('=\x20'+_0x5d20a5[_0x113a1b(0x161)]+_0x113a1b(0x172)));}if(_0x47e34c['length']>0x0||_0x332ac2[_0x113a1b(0x161)]>0x0){console['error'](_0x113a1b(0x17d)),console[_0x113a1b(0x11c)](_0x113a1b(0xff)+a31_0x12d151[_0x113a1b(0x148)]('+\x20'+_0x5ebcb3[_0x113a1b(0x161)]+_0x113a1b(0x15a))),console['error']('\x20\x20\x20\x20'+a31_0x12d151['yellow']('~\x20'+_0x4f796c[_0x113a1b(0x161)]+_0x113a1b(0x121)));if(_0x5b310b['length']>0x0)console['error'](_0x113a1b(0xff)+a31_0x12d151['red']('-\x20'+_0x5b310b[_0x113a1b(0x161)]+_0x113a1b(0x164)));else _0x332ac2['length']>0x0&&!_0xcb9450[_0x113a1b(0x18b)]&&console[_0x113a1b(0x11c)](_0x113a1b(0xff)+a31_0x12d151[_0x113a1b(0xfc)](_0x332ac2[_0x113a1b(0x161)]+_0x113a1b(0x142)));console[_0x113a1b(0x11c)](_0x113a1b(0xff)+a31_0x12d151[_0x113a1b(0xfc)]('=\x20'+_0x4e2779[_0x113a1b(0x161)]+_0x113a1b(0x172)));}_0x322aea[_0x113a1b(0x161)]>0x0&&!_0xcb9450[_0x113a1b(0x13b)]&&(console['error'](''),console['error']('\x20\x20Activations:'),_0x1f4c12['length']>0x0&&console[_0x113a1b(0x11c)]('\x20\x20\x20\x20'+a31_0x12d151[_0x113a1b(0x148)]('+\x20'+_0x1f4c12[_0x113a1b(0x161)]+_0x113a1b(0xfa))),_0x17fbe2[_0x113a1b(0x161)]>0x0&&console[_0x113a1b(0x11c)](_0x113a1b(0xff)+a31_0x12d151[_0x113a1b(0x158)]('~\x20'+_0x17fbe2['length']+_0x113a1b(0x14e))),_0x5e47a6[_0x113a1b(0x161)]>0x0&&console[_0x113a1b(0x11c)](_0x113a1b(0xff)+a31_0x12d151[_0x113a1b(0x169)]('-\x20'+_0x5e47a6[_0x113a1b(0x161)]+_0x113a1b(0x164))));console[_0x113a1b(0x11c)](_0x113a1b(0xf8)+a31_0x12d151[_0x113a1b(0x166)](_0x464180)+'\x0a');if(_0x3cf048[_0x113a1b(0x161)]>0x0){console[_0x113a1b(0x11c)]('Folders\x20to\x20create:');for(const _0x266894 of _0x3cf048){console[_0x113a1b(0x11c)]('\x20\x20'+a31_0x12d151[_0x113a1b(0x143)]('+')+'\x20'+_0x266894);}console[_0x113a1b(0x11c)]('');}if(_0x1e1871[_0x113a1b(0x161)]>0x0&&!_0xcb9450['journeysOnly'])for(const _0x24ea44 of _0x1e1871){const _0x53e4b3=_0x24ea44[_0x113a1b(0x13f)]?_0x24ea44[_0x113a1b(0x13f)]+'/'+_0x24ea44[_0x113a1b(0x10e)][_0x113a1b(0x16b)]:_0x24ea44[_0x113a1b(0x10e)]['name'],_0x5b58a5=_0x24ea44[_0x113a1b(0x10e)]['activations']?.[_0x113a1b(0x161)]||0x0,_0x30f6da=_0x5b58a5>0x0?a31_0x12d151[_0x113a1b(0xfc)]('\x20['+_0x5b58a5+'\x20activations]'):'';console[_0x113a1b(0x11c)]('\x0a'+a31_0x12d151[_0x113a1b(0x148)](_0x113a1b(0x138))+'\x20'+_0x53e4b3+_0x30f6da),console[_0x113a1b(0x11c)]('─'[_0x113a1b(0x144)](0x3c)),_0x24ea44[_0x113a1b(0x10d)]&&console[_0x113a1b(0x11c)](_0x24ea44[_0x113a1b(0x10d)]),console[_0x113a1b(0x11c)]('─'['repeat'](0x3c));}if(_0x3bfc09['length']>0x0&&!_0xcb9450[_0x113a1b(0x13b)])for(const _0x322dc9 of _0x3bfc09){const _0x311ead=_0x322dc9[_0x113a1b(0x11a)]?_0x26e72c[_0x113a1b(0x17f)](_0x322dc9[_0x113a1b(0x11a)][_0x113a1b(0x116)]())||'':'',_0x11a958=_0x311ead?_0x311ead+'/'+_0x322dc9[_0x113a1b(0x16b)]:_0x322dc9[_0x113a1b(0x16b)],_0x4b36c0=_0x1d6a3e[_0x113a1b(0x17f)](_0x322dc9['id'])||[],_0x18b5d3=_0x4b36c0['length']>0x0?a31_0x12d151[_0x113a1b(0xfc)]('\x20['+_0x4b36c0[_0x113a1b(0x161)]+_0x113a1b(0x157)):'';console[_0x113a1b(0x11c)]('\x0a'+a31_0x12d151['red'](_0x113a1b(0x11b))+'\x20'+_0x11a958+_0x18b5d3),console['error']('─'[_0x113a1b(0x144)](0x3c));const _0x5595bb=segmentWithActivationsToYaml(_0x322dc9,_0x4b36c0,undefined,_0x4ff01f,_0x298e4e),_0x3cfdbf=segmentToYamlString(_0x5595bb),_0x5a4ef5=generateDiff(_0x3cfdbf,'');console[_0x113a1b(0x11c)](formatDiffWithColors(_0x5a4ef5)),console[_0x113a1b(0x11c)]('─'[_0x113a1b(0x144)](0x3c));}const _0x5bcd35=_0x32fd24[_0x113a1b(0x18a)](_0x1b2612=>!_0x1b2612[_0x113a1b(0x178)]&&_0x1b2612[_0x113a1b(0x10d)]);if(_0x5bcd35[_0x113a1b(0x161)]>0x0&&!_0xcb9450[_0x113a1b(0x13b)])for(const _0x6c3355 of _0x5bcd35){const _0x169e16=_0x6c3355[_0x113a1b(0x13f)]?_0x6c3355[_0x113a1b(0x13f)]+'/'+_0x6c3355[_0x113a1b(0x10e)][_0x113a1b(0x16b)]:_0x6c3355[_0x113a1b(0x10e)][_0x113a1b(0x16b)];console['error']('\x0a'+a31_0x12d151[_0x113a1b(0x158)](_0x113a1b(0x123))+'\x20'+_0x169e16),console[_0x113a1b(0x11c)]('─'[_0x113a1b(0x144)](0x3c)),console[_0x113a1b(0x11c)](_0x6c3355[_0x113a1b(0x10d)]),console[_0x113a1b(0x11c)]('─'[_0x113a1b(0x144)](0x3c));}if(_0x5ebcb3['length']>0x0)for(const _0x603df of _0x5ebcb3){const _0x1ca895=_0x603df['folderPath']?_0x603df[_0x113a1b(0x13f)]+'/'+_0x603df['yamlConfig'][_0x113a1b(0x16b)]:_0x603df[_0x113a1b(0x10e)][_0x113a1b(0x16b)];console[_0x113a1b(0x11c)]('\x0a'+a31_0x12d151[_0x113a1b(0x148)](_0x113a1b(0x181))+'\x20'+_0x1ca895),console[_0x113a1b(0x11c)]('─'['repeat'](0x3c)),_0x603df[_0x113a1b(0x10d)]&&console[_0x113a1b(0x11c)](_0x603df[_0x113a1b(0x10d)]),console['error']('─'[_0x113a1b(0x144)](0x3c));}const _0x2dc502=_0x47e34c['filter'](_0x26743d=>!_0x26743d['isNew']&&_0x26743d[_0x113a1b(0x10d)]);if(_0x2dc502[_0x113a1b(0x161)]>0x0)for(const _0x217e26 of _0x2dc502){const _0x2cfd6e=_0x217e26['folderPath']?_0x217e26[_0x113a1b(0x13f)]+'/'+_0x217e26['yamlConfig'][_0x113a1b(0x16b)]:_0x217e26[_0x113a1b(0x10e)]['name'];console[_0x113a1b(0x11c)]('\x0a'+a31_0x12d151[_0x113a1b(0x158)](_0x113a1b(0x115))+'\x20'+_0x2cfd6e),console[_0x113a1b(0x11c)]('─'['repeat'](0x3c)),console[_0x113a1b(0x11c)](_0x217e26['diff']),console[_0x113a1b(0x11c)]('─'[_0x113a1b(0x144)](0x3c));}if(_0x5b310b[_0x113a1b(0x161)]>0x0)for(const _0x1104d3 of _0x5b310b){const _0x4e304f=_0x1104d3[_0x113a1b(0x14d)]?_0x26e72c[_0x113a1b(0x17f)](_0x1104d3[_0x113a1b(0x14d)])||'':'',_0xbfc04a=_0x4e304f?_0x4e304f+'/'+_0x1104d3[_0x113a1b(0x132)]:_0x1104d3[_0x113a1b(0x132)];console[_0x113a1b(0x11c)]('\x0a'+a31_0x12d151[_0x113a1b(0x169)](_0x113a1b(0x185))+'\x20'+_0xbfc04a),console[_0x113a1b(0x11c)]('─'[_0x113a1b(0x144)](0x3c)),console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x169)](_0x113a1b(0x186))),console['error']('─'[_0x113a1b(0x144)](0x3c));}if(_0xcb9450[_0x113a1b(0x10a)])return console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x158)]('\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made')),0x0;const _0x44025b=_0xcb9450[_0x113a1b(0x13b)]?![]:_0x1e1871[_0x113a1b(0x161)]>0x0||_0xa2c547[_0x113a1b(0x161)]>0x0||_0x3bfc09['length']>0x0,_0x2e2f16=_0x5ebcb3[_0x113a1b(0x161)]>0x0||_0x4f796c[_0x113a1b(0x161)]>0x0||_0x5b310b[_0x113a1b(0x161)]>0x0,_0x1ce9c4=_0xcb9450[_0x113a1b(0x13b)]?![]:_0x322aea[_0x113a1b(0x161)]>0x0,_0x284e5d=_0x3cf048['length']>0x0;if(!_0x44025b&&!_0x2e2f16&&!_0x1ce9c4&&!_0x284e5d){const _0x3fa4e1=_0xcb9450[_0x113a1b(0x13b)]?_0x113a1b(0x147):'✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date';console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x148)](_0x3fa4e1));if(_0x188e9d&&_0x4e2779[_0x113a1b(0x161)]===0x1){const _0xff4838=_0x4e2779[0x0];if(_0xff4838[_0x113a1b(0x10b)]?.['id']){const _0x10af7a=getConsoleNextUrl(_0xcb9450[_0x113a1b(0x117)],_0x113a1b(0x151)+_0x8c26fb+'/e/'+_0xff4838[_0x113a1b(0x10b)]['id']+_0x113a1b(0x16c));console[_0x113a1b(0x11c)]('\x20\x20'+a31_0x12d151[_0x113a1b(0x166)](_0x10af7a));}}return 0x0;}const _0x42667d=_0xcb9450['journeysOnly']?_0x5ebcb3[_0x113a1b(0x161)]+_0x4f796c[_0x113a1b(0x161)]+_0x5b310b[_0x113a1b(0x161)]+_0x3cf048[_0x113a1b(0x161)]:_0x1e1871[_0x113a1b(0x161)]+_0xa2c547[_0x113a1b(0x161)]+_0x3bfc09[_0x113a1b(0x161)]+_0x5ebcb3[_0x113a1b(0x161)]+_0x4f796c[_0x113a1b(0x161)]+_0x5b310b['length']+_0x3cf048[_0x113a1b(0x161)]+_0x322aea[_0x113a1b(0x161)];if(!_0xcb9450[_0x113a1b(0x109)]&&_0x42667d>0x0){if(!isInteractive())return console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x169)](_0x113a1b(0x120)),_0x113a1b(0x18e)),console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0xfc)](_0x113a1b(0x10c))),0x1;const _0x13eb15=await confirmKey('Push\x20'+_0x42667d+_0x113a1b(0x136));if(!_0x13eb15)return console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x158)](_0x113a1b(0x106))),0x1;}const _0x1db7c0={'withProgress':async(_0x48c200,_0xdaede1)=>{const _0x26d857=_0x113a1b,_0x2137a2=await withSpinner(_0x48c200,_0xdaede1,{'verbose':_0xcb9450['verbose']});return{'data':_0x2137a2[_0x26d857(0x146)]};},'logInfo':_0x405939=>console[_0x113a1b(0x11c)](a31_0x12d151['blue']('✔\x20'+_0x405939)),'logSuccess':_0x4a95ed=>console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x148)]('✔\x20'+_0x4a95ed)),'logWarning':_0x3694ba=>console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x158)]('⚠\x20'+_0x3694ba)),'logDeleted':_0x3ff966=>console[_0x113a1b(0x11c)](a31_0x12d151['red']('✔\x20'+_0x3ff966))},_0x1ad35b={'segment':_0x284d80[_0x113a1b(0x18f)],'journey':_0x284d80[_0x113a1b(0x163)],'user':_0x284d80[_0x113a1b(0x160)],'connection':_0x284d80['connection']};_0x3cf048[_0x113a1b(0x161)]>0x0&&(_0xff9239=await executePushFolders(_0x1ad35b,_0x3cf048,_0xff9239,{'parentId':_0x8c26fb},_0x1db7c0));const _0x37429f={'rootFolderId':_0x4e992d,'folderPathToId':_0xff9239,'folderIdToPath':_0x26e72c,'segmentNameToId':_0x4fe2ba,'activationsBySegmentId':_0x1d6a3e,'emailToIdMap':_0x96534f,'idToEmailMap':_0x4ff01f,'connectionNameToIdMap':_0x34bc40[_0x113a1b(0x13c)],'connectionIdToNameMap':_0x34bc40[_0x113a1b(0x174)],'connectionNameToTypeMap':_0x4aec5e},_0x3f9239=await executePushSegments(_0x1ad35b,_0xcb9450['journeysOnly']?[]:_0x32fd24,_0x37429f,{'parentId':_0x8c26fb},_0x1db7c0),_0xb506c3=_0x3f9239[_0x113a1b(0x134)],_0x1a71e3=_0x3f9239[_0x113a1b(0x131)],_0x54dc76=_0x3f9239[_0x113a1b(0x189)][_0x113a1b(0x134)],_0x51f778=_0x3f9239[_0x113a1b(0x189)]['updated'],_0xda9dc3=_0x3f9239[_0x113a1b(0x189)][_0x113a1b(0x16a)],_0x52ea65=await executePushSegmentDeletions(_0x1ad35b,_0xcb9450[_0x113a1b(0x13b)]?[]:_0x3bfc09,_0x1db7c0);let _0x16af3f=0x0,_0x97f0af=0x0,_0x2a6246=0x0;const _0x5a7ab6=new Map(_0x4fe2ba);for(const [_0x299554,_0x2942ea]of _0x3f9239['createdSegmentIds']){_0x5a7ab6[_0x113a1b(0x180)](_0x299554,_0x2942ea);}if(_0x47e34c[_0x113a1b(0x161)]>0x0){const _0x4d5ba6={..._0x37429f,'segmentNameToId':_0x5a7ab6,'existingSegments':_0x4732aa,'activationContext':_0x180c6e},_0x5d7c10=await executePushJourneys(_0x1ad35b,_0x47e34c,_0x4d5ba6,{'parentId':_0x8c26fb,'rootFolderId':_0x4e992d,'verbose':_0xcb9450[_0x113a1b(0x141)]},_0x1db7c0);_0x16af3f=_0x5d7c10[_0x113a1b(0x134)],_0x97f0af=_0x5d7c10[_0x113a1b(0x131)];if(_0x188e9d&&_0x5d7c10[_0x113a1b(0x105)]['length']===0x1){const _0x353ea1=_0x5d7c10['results'][0x0];if(_0x353ea1[_0x113a1b(0x17a)]){const _0x42cef5=getConsoleNextUrl(_0xcb9450['site'],'/app/ps/'+_0x8c26fb+'/e/'+_0x353ea1['journeyId']+_0x113a1b(0x16c));console[_0x113a1b(0x11c)]('\x20\x20'+a31_0x12d151[_0x113a1b(0x166)](_0x42cef5));}}}for(const _0x160081 of _0x5b310b){console['error'](a31_0x12d151['yellow'](_0x113a1b(0x112)+_0x160081[_0x113a1b(0x132)])),_0x2a6246++;}const _0x22202d=[];if(_0xb506c3>0x0)_0x22202d[_0x113a1b(0x13a)](_0xb506c3+_0x113a1b(0x102));if(_0x1a71e3>0x0)_0x22202d[_0x113a1b(0x13a)](_0x1a71e3+_0x113a1b(0x150));if(_0x52ea65>0x0)_0x22202d[_0x113a1b(0x13a)](_0x52ea65+_0x113a1b(0x103));const _0x1f0621=[];if(_0x16af3f>0x0)_0x1f0621[_0x113a1b(0x13a)](_0x16af3f+_0x113a1b(0x102));if(_0x97f0af>0x0)_0x1f0621['push'](_0x97f0af+_0x113a1b(0x150));if(_0x2a6246>0x0)_0x1f0621['push'](_0x2a6246+_0x113a1b(0x103));const _0x3013f8=[];if(_0x54dc76>0x0)_0x3013f8['push'](_0x54dc76+_0x113a1b(0x102));if(_0x51f778>0x0)_0x3013f8['push'](_0x51f778+_0x113a1b(0x150));if(_0xda9dc3>0x0)_0x3013f8[_0x113a1b(0x13a)](_0xda9dc3+_0x113a1b(0x103));return console[_0x113a1b(0x11c)](a31_0x12d151[_0x113a1b(0x148)]('\x0a✔\x20Push\x20complete')),_0x22202d[_0x113a1b(0x161)]>0x0&&!_0xcb9450['journeysOnly']&&console[_0x113a1b(0x11c)](_0x113a1b(0x14b)+_0x22202d[_0x113a1b(0x155)](',\x20')),_0x1f0621[_0x113a1b(0x161)]>0x0&&console[_0x113a1b(0x11c)]('\x20\x20Journeys:\x20'+_0x1f0621['join'](',\x20')),_0x3013f8['length']>0x0&&!_0xcb9450[_0x113a1b(0x13b)]&&console[_0x113a1b(0x11c)](_0x113a1b(0x165)+_0x3013f8[_0x113a1b(0x155)](',\x20')),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a32_0x37d50c=a32_0x239d;(function(_0x6a14bd,_0x3f628b){const _0x59daf1=a32_0x239d,_0x39f28c=_0x6a14bd();while(!![]){try{const _0x1601f8=-parseInt(_0x59daf1(0x8d))/0x1*(parseInt(_0x59daf1(0x92))/0x2)+-parseInt(_0x59daf1(0x91))/0x3+-parseInt(_0x59daf1(0x6c))/0x4*(-parseInt(_0x59daf1(0x96))/0x5)+-parseInt(_0x59daf1(0x7a))/0x6+parseInt(_0x59daf1(0x81))/0x7*(parseInt(_0x59daf1(0x97))/0x8)+-parseInt(_0x59daf1(0x77))/0x9*(-parseInt(_0x59daf1(0x84))/0xa)+-parseInt(_0x59daf1(0x93))/0xb*(parseInt(_0x59daf1(0x7b))/0xc);if(_0x1601f8===_0x3f628b)break;else _0x39f28c['push'](_0x39f28c['shift']());}catch(_0x12b26e){_0x39f28c['push'](_0x39f28c['shift']());}}}(a32_0x4b9e,0x58fc9));function a32_0x4b9e(){const _0x2117a7=['224oJHsEJ','Resolved\x20folder\x20ID:\x20','Resolving\x20path\x20\x27','resolvePathToResource','resolveFolderId','Segment\x20ID:\x20','description','116096gwgDYF','ruleFile','data','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','execute','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','error','segmentId','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]','Resolving\x20folder\x20\x27','153DQCKiJ','name','length','808344lBbOhx','197772UvxbLd','includes','updateSegmentById','folder','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','Examples:','58961YfBsgr','verbose','\x27...','229910cVQblQ','Resolved\x20type:\x20','Update\x20existing\x20child\x20segment','segmentName','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','type','Error:\x20Cannot\x20update\x20','segment','Resolved\x20relative\x20path\x20to:\x20','2LKXcEs','segmentPath','\x20\x20\x20Path:\x20','kind','197874JFXEiM','430956mDRbal','44pKgOsD','INTERNAL','Segment\x20ID\x20missing\x20from\x20resolved\x20path','75VSBtSh'];a32_0x4b9e=function(){return _0x2117a7;};return a32_0x4b9e();}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a32_0x239d(_0x3228b3,_0x456a82){_0x3228b3=_0x3228b3-0x6a;const _0x4b9e8a=a32_0x4b9e();let _0x239ddc=_0x4b9e8a[_0x3228b3];return _0x239ddc;}import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{SDKError,ErrorCode}from'../sdk/index.js';import a32_0x4cc259 from'chalk';export class SegmentUpdateCommand extends BaseCommand{['name']='segment:update';[a32_0x37d50c(0x6b)]=a32_0x37d50c(0x86);async[a32_0x37d50c(0x70)](_0x5db03a){const _0x40bf8c=a32_0x37d50c;console[_0x40bf8c(0x72)](a32_0x4cc259['yellow']('⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.')),console[_0x40bf8c(0x72)](a32_0x4cc259['yellow'](_0x40bf8c(0x71)));const {options:_0x88910b,args:_0x14156f,tdx:_0x43963a}=_0x5db03a,_0x575879=_0x88910b;if(_0x14156f[_0x40bf8c(0x79)]===0x0)return console[_0x40bf8c(0x72)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x40bf8c(0x72)](_0x40bf8c(0x6f)),console['error'](_0x40bf8c(0x80)),console['error'](_0x40bf8c(0x74)),console['error'](_0x40bf8c(0x7f)),0x1;const _0x2420e7=_0x14156f[0x0],_0x122f8b=_0x88910b[_0x40bf8c(0x8e)];let _0x14b6fb=_0x2420e7;_0x122f8b&&!_0x2420e7[_0x40bf8c(0x7c)]('/')&&(_0x14b6fb=_0x122f8b+'/'+_0x2420e7,_0x575879['verbose']&&console[_0x40bf8c(0x72)](_0x40bf8c(0x8c)+_0x14b6fb));const _0x39c2f1=await withSpinner(_0x40bf8c(0x99)+_0x14b6fb+'\x27...',()=>_0x43963a['segment'][_0x40bf8c(0x9a)](_0x14b6fb),{'verbose':_0x575879[_0x40bf8c(0x82)]}),_0xf11885=_0x39c2f1[_0x40bf8c(0x6e)];_0x575879['verbose']&&console[_0x40bf8c(0x72)](_0x40bf8c(0x85)+_0xf11885[_0x40bf8c(0x89)]);if(_0xf11885[_0x40bf8c(0x89)]!=='segment')return console['error'](_0x40bf8c(0x8a)+_0xf11885[_0x40bf8c(0x89)]+_0x40bf8c(0x88)),console['error'](_0x40bf8c(0x75)),0x1;if(!_0xf11885[_0x40bf8c(0x73)])throw new SDKError(ErrorCode[_0x40bf8c(0x94)],_0x40bf8c(0x95));const _0x2f9dbc=_0xf11885['parentId'],_0x1a3ea0=_0xf11885[_0x40bf8c(0x73)];_0x575879['verbose']&&(console['error']('Parent\x20ID:\x20'+_0x2f9dbc),console[_0x40bf8c(0x72)](_0x40bf8c(0x6a)+_0x1a3ea0));let _0x22ab2d;if(_0x575879[_0x40bf8c(0x7e)]){const _0x2c5ac7=_0x575879['folder'],_0xb778a0=await withSpinner(_0x40bf8c(0x76)+_0x2c5ac7+_0x40bf8c(0x83),()=>_0x43963a[_0x40bf8c(0x8b)][_0x40bf8c(0x9b)](_0x2f9dbc,_0x2c5ac7),{'verbose':_0x575879[_0x40bf8c(0x82)]});_0x22ab2d=parseInt(_0xb778a0['data'],0xa),_0x575879['verbose']&&console['error'](_0x40bf8c(0x98)+_0x22ab2d);}const _0x5466fa=await loadJSONFromOptions(_0x575879['rule'],_0x575879[_0x40bf8c(0x6d)]),_0xf1aa13={'name':_0x575879[_0x40bf8c(0x78)],'description':_0x575879[_0x40bf8c(0x6b)],'rule':_0x5466fa,'kind':_0x575879[_0x40bf8c(0x90)]!==undefined?parseInt(_0x575879[_0x40bf8c(0x90)],0xa):undefined,'segmentFolderId':_0x22ab2d},_0x134018=await withSpinner('Updating\x20segment\x20\x27'+_0xf11885[_0x40bf8c(0x87)]+_0x40bf8c(0x83),()=>_0x43963a['segment'][_0x40bf8c(0x7d)](_0x2f9dbc,_0x1a3ea0,_0xf1aa13),{'verbose':_0x575879[_0x40bf8c(0x82)]}),_0x39afb3=_0x134018['data'];return console[_0x40bf8c(0x72)]('✔\x20Updated\x20segment\x20\x27'+_0x39afb3['name']+'\x27'),_0x14b6fb!==_0x2420e7&&console[_0x40bf8c(0x72)](_0x40bf8c(0x8f)+_0x14b6fb),await handleSDKOutput([_0x39afb3],_0x575879),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a33_0x454ff0=a33_0x2734;function a33_0x2734(_0x2c533c,_0x1a0232){_0x2c533c=_0x2c533c-0x1c9;const _0x556acd=a33_0x556a();let _0x273461=_0x556acd[_0x2c533c];return _0x273461;}(function(_0x3bcd01,_0x6d3a79){const _0x756a19=a33_0x2734,_0x464be0=_0x3bcd01();while(!![]){try{const _0x5065ff=parseInt(_0x756a19(0x1d1))/0x1+parseInt(_0x756a19(0x1dc))/0x2*(-parseInt(_0x756a19(0x1d7))/0x3)+-parseInt(_0x756a19(0x1cb))/0x4+parseInt(_0x756a19(0x1ed))/0x5+parseInt(_0x756a19(0x1c9))/0x6*(parseInt(_0x756a19(0x1ef))/0x7)+-parseInt(_0x756a19(0x1fe))/0x8*(-parseInt(_0x756a19(0x1ce))/0x9)+-parseInt(_0x756a19(0x1f7))/0xa*(parseInt(_0x756a19(0x200))/0xb);if(_0x5065ff===_0x6d3a79)break;else _0x464be0['push'](_0x464be0['shift']());}catch(_0x15928b){_0x464be0['push'](_0x464be0['shift']());}}}(a33_0x556a,0xcecec));function a33_0x556a(){const _0x257b04=['length','Resolved\x20relative\x20path\x20to:\x20','Resolved\x20path\x20type:\x20','Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.','Use:\x20tdx\x20segment\x20use\x20','folderPath','isDirectory','isAbsolute','name','config','log','join','\x27...','7599135YiRwwh','\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent','47327habbUp','✔\x20Context\x20set\x20to:\x20','Usage:\x20tdx\x20segment\x20use\x20<path>','dim','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','parent_segment','cyan','slice','4710580poIlXp','Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','segmentPath','segment','1155256MIgmbd','Set\x20current\x20segment/folder\x20context\x20for\x20navigation','44fNJcml','Use\x20\x22tdx\x20use\x22\x20to\x20see\x20all\x20context\x20parameters','parentId','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','1158IpUlOS','Resolving\x20path\x20\x27','4146448rTqTQb','Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.','verbose','72XkloDS','description','Parent\x20ID:\x20','995345WFfalM','fullPath','Site:\x20','green','site','Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context','59379VDtUAU','error','segment:use','type','red','122SiiDwB','parentName','data','folderId'];a33_0x556a=function(){return _0x257b04;};return a33_0x556a();}import{existsSync,statSync}from'fs';import a33_0x15cb2f from'chalk';import{BaseCommand}from'./command.js';import{saveSessionContext}from'../core/session.js';import{withSpinner}from'../utils/spinner.js';import{parsePath,normalizePath}from'../sdk/segment/segment-path-parser.js';import{findTdxConfig}from'../sdk/segment/tdx-config.js';export class SegmentUseCommand extends BaseCommand{[a33_0x454ff0(0x1e8)]=a33_0x454ff0(0x1d9);[a33_0x454ff0(0x1cf)]=a33_0x454ff0(0x1ff);async['execute'](_0x386d8e){const _0x51fd5a=a33_0x454ff0,{options:_0xb647a0,args:_0x5c5fb7,tdx:_0x26392c}=_0x386d8e;if(_0x5c5fb7[_0x51fd5a(0x1e0)]===0x0)return console[_0x51fd5a(0x1d8)](a33_0x15cb2f['red']('Error:\x20Path\x20is\x20required\x0a')),console[_0x51fd5a(0x1d8)](_0x51fd5a(0x1f1)),console[_0x51fd5a(0x1d8)]('Examples:'),console[_0x51fd5a(0x1d8)](_0x51fd5a(0x1f3)),console[_0x51fd5a(0x1d8)](_0x51fd5a(0x1f9)),console[_0x51fd5a(0x1d8)]('\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context'),console[_0x51fd5a(0x1d8)](_0x51fd5a(0x1ee)),0x1;const _0x5d98f3=_0x5c5fb7[0x0],_0x2fb074=_0xb647a0['session'];try{if(_0x5d98f3==='/')return saveSessionContext({'segment_path':undefined},_0x2fb074),console[_0x51fd5a(0x1ea)](a33_0x15cb2f[_0x51fd5a(0x1d4)]('✔\x20Context\x20cleared.\x20Back\x20to\x20root.')),0x0;if(existsSync(_0x5d98f3)&&statSync(_0x5d98f3)[_0x51fd5a(0x1e6)]()){let _0x2f5918;try{_0x2f5918=findTdxConfig(_0x5d98f3);}catch{return console[_0x51fd5a(0x1d8)](a33_0x15cb2f[_0x51fd5a(0x1db)](_0x51fd5a(0x1fa)+_0x5d98f3)),console['error'](a33_0x15cb2f[_0x51fd5a(0x1f5)]('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;}const _0x41ffd0=_0x2f5918[_0x51fd5a(0x1e9)][_0x51fd5a(0x1f4)];return saveSessionContext({'segment_path':_0x41ffd0,'parent_segment':_0x41ffd0},_0x2fb074),console['log'](a33_0x15cb2f[_0x51fd5a(0x1d4)](_0x51fd5a(0x1f0)+a33_0x15cb2f[_0x51fd5a(0x1f5)](_0x41ffd0))),0x0;}const _0xd743d4=_0xb647a0[_0x51fd5a(0x1fc)];let _0x400150=_0x5d98f3;const _0x235ac4=parsePath(_0x5d98f3);if(!_0x235ac4[_0x51fd5a(0x1e7)]){if(!_0xd743d4)return console[_0x51fd5a(0x1d8)](a33_0x15cb2f[_0x51fd5a(0x1db)](_0x51fd5a(0x1cc))),console['error'](a33_0x15cb2f['cyan'](_0x51fd5a(0x1f8))),0x1;if(_0x5d98f3==='..'){const _0x17ab20=_0xd743d4['split']('/')[_0x51fd5a(0x1f6)](0x0,-0x1)[_0x51fd5a(0x1eb)]('/');_0x400150=_0x17ab20||'/';}else _0x5d98f3==='.'?_0x400150=_0xd743d4:_0x400150=_0xd743d4+'/'+_0x5d98f3;_0xb647a0['verbose']&&console['error'](_0x51fd5a(0x1e1)+_0x400150);}if(_0x400150==='/'||_0x400150==='')return saveSessionContext({'segment_path':undefined},_0x2fb074),console['log'](a33_0x15cb2f['green'](_0x51fd5a(0x1fb))),0x0;_0x400150=normalizePath(_0x400150);const _0x2e3d88=parsePath(_0x400150)['segments'];if(_0x2e3d88[_0x51fd5a(0x1e0)]===0x0)return saveSessionContext({'segment_path':undefined},_0x2fb074),console[_0x51fd5a(0x1ea)](a33_0x15cb2f[_0x51fd5a(0x1d4)](_0x51fd5a(0x1fb))),0x0;_0xb647a0[_0x51fd5a(0x1cd)]&&(console['error'](_0x51fd5a(0x1d3)+_0xb647a0[_0x51fd5a(0x1d5)]),console[_0x51fd5a(0x1d8)]('Target\x20path:\x20'+_0x400150));const _0x133025=await withSpinner(_0x51fd5a(0x1ca)+_0x400150+_0x51fd5a(0x1ec),()=>_0x26392c[_0x51fd5a(0x1fd)]['resolvePathToResource'](_0x400150),{'verbose':_0xb647a0[_0x51fd5a(0x1cd)]}),_0x5704e9=_0x133025[_0x51fd5a(0x1de)];_0xb647a0[_0x51fd5a(0x1cd)]&&(console[_0x51fd5a(0x1d8)](_0x51fd5a(0x1e2)+_0x5704e9[_0x51fd5a(0x1da)]),console['error'](_0x51fd5a(0x1d0)+_0x5704e9[_0x51fd5a(0x202)]),_0x5704e9[_0x51fd5a(0x1df)]&&console[_0x51fd5a(0x1d8)]('Folder\x20ID:\x20'+_0x5704e9[_0x51fd5a(0x1df)]));if(_0x5704e9['type']===_0x51fd5a(0x1fd))return console[_0x51fd5a(0x1d8)](a33_0x15cb2f[_0x51fd5a(0x1db)](_0x51fd5a(0x1e3))),console[_0x51fd5a(0x1d8)](_0x51fd5a(0x203)),console[_0x51fd5a(0x1d8)](a33_0x15cb2f['cyan'](_0x51fd5a(0x1e4)+_0x5704e9[_0x51fd5a(0x1dd)]+(_0x5704e9[_0x51fd5a(0x1e5)]?'/'+_0x5704e9[_0x51fd5a(0x1e5)][_0x51fd5a(0x1eb)]('/'):''))),0x1;return saveSessionContext({'segment_path':_0x5704e9[_0x51fd5a(0x1d2)],'parent_segment':_0x5704e9['parentName']},_0x2fb074),console['log'](a33_0x15cb2f[_0x51fd5a(0x1d4)](_0x51fd5a(0x1f0)+a33_0x15cb2f[_0x51fd5a(0x1f5)](_0x5704e9[_0x51fd5a(0x1d2)]))),_0xb647a0[_0x51fd5a(0x1cd)]&&(console[_0x51fd5a(0x1d8)](a33_0x15cb2f[_0x51fd5a(0x1f2)](_0x51fd5a(0x1d6))),console[_0x51fd5a(0x1d8)](a33_0x15cb2f[_0x51fd5a(0x1f2)](_0x51fd5a(0x201)))),0x0;}catch(_0x51c486){throw _0x51c486;}}}
|