@treasuredata/tdx 2026.4.14 → 2026.4.16
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/README.md +1 -1
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +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/cas-command.js +1 -1
- package/dist/commands/cas-segment-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/delivery-command.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-campaign-pull-command.js +1 -1
- package/dist/commands/engage-campaign-push-command.js +1 -1
- package/dist/commands/engage-campaign-validate-command.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/engage-template-pull-command.js +1 -1
- package/dist/commands/engage-template-push-command.js +1 -1
- package/dist/commands/engage-template-validate-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.js +1 -1
- package/dist/commands/policy-command.js +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/upgrade-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/work-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/oauth-keychain.js +1 -1
- package/dist/core/oauth.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/tools/work-create-item.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/agent/tool-target-registry.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/cas/cas-api-client.js +1 -1
- package/dist/sdk/cas/cas-audience-yaml.js +1 -1
- package/dist/sdk/cas/cas-segment-yaml.js +1 -1
- package/dist/sdk/cas/index.js +1 -1
- package/dist/sdk/cas/pull-workflow.js +1 -1
- package/dist/sdk/cas/push-workflow.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/delivery-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/oauth-refresh.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/delivery.js +1 -1
- package/dist/sdk/engage/campaign-pull.js +1 -1
- package/dist/sdk/engage/campaign-push.js +1 -1
- package/dist/sdk/engage/campaign-validator.js +1 -1
- package/dist/sdk/engage/campaign-yaml.js +1 -1
- package/dist/sdk/engage/template-pull.js +1 -1
- package/dist/sdk/engage/template-push.js +1 -1
- package/dist/sdk/engage/template-validator.js +1 -1
- package/dist/sdk/engage/template-yaml.js +1 -1
- package/dist/sdk/engage/types/campaign-def.js +1 -1
- package/dist/sdk/engage/types/campaign-schema.js +1 -1
- package/dist/sdk/engage/types/template-schema.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/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.js +1 -1
- package/dist/sdk/policy.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- 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-validator.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-recovery.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/segment-validator.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/activation-schema.js +1 -1
- package/dist/sdk/segment/types/journey-def.js +1 -1
- package/dist/sdk/segment/types/journey-schema.js +1 -1
- package/dist/sdk/segment/types/segment-def.js +1 -1
- package/dist/sdk/segment/types/segment-schema.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/types/workspace.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/paginate.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/sdk/workspace/access-tracker.js +1 -1
- package/dist/sdk/workspace/frontmatter.js +1 -1
- package/dist/sdk/workspace/git.js +1 -1
- package/dist/sdk/workspace/index.js +1 -1
- package/dist/sdk/workspace/templates.js +1 -1
- package/dist/sdk/workspace/weekly.js +1 -1
- package/dist/sdk/workspace/wikilinks.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/file-reader.js +1 -1
- package/dist/utils/github-releases.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/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 +30 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a40_0x399312=a40_0x5186;(function(_0x58a744,_0x22fccf){const _0x21889a=a40_0x5186,_0x5c6716=_0x58a744();while(!![]){try{const _0x56c5ef=parseInt(_0x21889a(0xf5))/0x1+-parseInt(_0x21889a(0x11d))/0x2*(parseInt(_0x21889a(0x118))/0x3)+parseInt(_0x21889a(0x106))/0x4*(-parseInt(_0x21889a(0x103))/0x5)+parseInt(_0x21889a(0x121))/0x6*(parseInt(_0x21889a(0x11f))/0x7)+parseInt(_0x21889a(0x135))/0x8*(-parseInt(_0x21889a(0x124))/0x9)+parseInt(_0x21889a(0xec))/0xa*(parseInt(_0x21889a(0x129))/0xb)+parseInt(_0x21889a(0x12d))/0xc;if(_0x56c5ef===_0x22fccf)break;else _0x5c6716['push'](_0x5c6716['shift']());}catch(_0x30ad86){_0x5c6716['push'](_0x5c6716['shift']());}}}(a40_0x91ff,0xde9f0));import{BaseCommand}from'./command.js';function a40_0x5186(_0x36c921,_0xd35949){_0x36c921=_0x36c921-0xe8;const _0x91ffc1=a40_0x91ff();let _0x51867a=_0x91ffc1[_0x36c921];return _0x51867a;}import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';function a40_0x91ff(){const _0x3916a1=['\x20unchanged\x20files','✔\x20Context\x20set:\x20','4488DKkXEW','\x0aError:','journeys','files','27976488iDJdXS','Parent\x20segment:\x20','counts','hasChanges','filter','cwd','parent_segment','no_parent','43776diCrQC','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','✔\x20All\x20files\x20are\x20up\x20to\x20date','dirname','\x20new\x20files','session','description','helpText','relativePath','22140oIjGxc','error','journeyVersions','cyan','\x20\x20🎯\x20','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','segment','\x20journeys','✔\x20Pulled\x20','34069ANbeIJ','segment:pull','parentSegment','\x20segments','Aborted.','Site:\x20','resourceName','yes','length','\x27...','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','yellow','pullSegments','verbose','3770dHhxDC','content','targetDir','7204qPfiHz','parentName','\x0aPull\x20summary\x20for\x20\x27','errorCode','isNew','message','segments','\x20files?','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','\x0aChanges\x20to\x20\x27','file','absolutePath','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','diff','dim','Write\x20','red','\x20=\x20','4728189IMBsUG','type','repeat','green','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','2KLFTTg','-\x20no\x20files\x20written','49zabpuG','utf-8','846444oRoYYE','\x20versions)','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)','675YeLAOM','\x20with\x20','\x20\x20🗺️\x20\x20'];a40_0x91ff=function(){return _0x3916a1;};return a40_0x91ff();}import{saveSessionContext}from'../core/session.js';import a40_0x208dcd from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a40_0x303894 from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';export class SegmentPullCommand extends BaseCommand{['name']=a40_0x399312(0xf6);[a40_0x399312(0xe9)]='Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files';async['execute'](_0x3378c9){const _0x12776e=a40_0x399312,{options:_0x3cef4e,args:_0x4e551a,tdx:_0x280b7a}=_0x3378c9,_0x47d876=_0x3cef4e,_0x5d7076=await resolveTarget({'arg':_0x4e551a[0x0],'contextParent':_0x3cef4e[_0x12776e(0xf7)],'cwd':process[_0x12776e(0x132)]()});if(!isSuccessfulResolution(_0x5d7076))return _0x5d7076[_0x12776e(0x109)]===_0x12776e(0x134)?(console['error'](a40_0x208dcd['yellow'](_0x12776e(0x136))),console[_0x12776e(0xed)](_0x12776e(0x123)),console[_0x12776e(0xed)](_0x12776e(0xff)),console[_0x12776e(0xed)](_0x12776e(0x11c))):(console[_0x12776e(0xed)](a40_0x208dcd[_0x12776e(0x116)]('Error:\x20'+_0x5d7076[_0x12776e(0x10b)]+'\x0a')),_0x5d7076[_0x12776e(0xea)]&&console[_0x12776e(0xed)](a40_0x208dcd[_0x12776e(0xef)](_0x5d7076[_0x12776e(0xea)]))),0x1;const _0x11535f=_0x5d7076[_0x12776e(0x107)],_0x467f9a=_0x5d7076[_0x12776e(0x105)],_0x5751a9=_0x5d7076[_0x12776e(0x119)]===_0x12776e(0x110)?_0x5d7076[_0x12776e(0xfb)]:undefined;_0x47d876[_0x12776e(0x102)]&&(console[_0x12776e(0xed)](_0x12776e(0xfa)+_0x47d876['site']),console[_0x12776e(0xed)](_0x12776e(0x12e)+_0x11535f),_0x5751a9&&console[_0x12776e(0xed)]('Target\x20resource:\x20'+_0x5751a9));const _0x12d520=await withProgressSpinner('Pulling\x20segments\x20from\x20\x27'+_0x11535f+_0x12776e(0xfe),_0x52ec61=>_0x280b7a[_0x12776e(0xf2)][_0x12776e(0x101)](_0x11535f,{'targetDir':_0x467f9a,'targetResourceName':_0x5751a9,'verbose':_0x47d876['verbose'],'progress':{'update':_0x1f4cd5=>{const _0x381aa6=_0x12776e;_0x52ec61['setPhase'](_0x1f4cd5),_0x47d876[_0x381aa6(0x102)]&&console[_0x381aa6(0xed)]('\x20\x20'+_0x1f4cd5);}}}),{'verbose':_0x47d876[_0x12776e(0x102)]}),_0x5dd71a=_0x12d520['data'];if(_0x5dd71a[_0x12776e(0x12f)][_0x12776e(0x10c)]===0x0&&_0x5dd71a[_0x12776e(0x12f)][_0x12776e(0x12b)]===0x0)return console[_0x12776e(0xed)](a40_0x208dcd[_0x12776e(0x100)]('No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27'+_0x5dd71a[_0x12776e(0x107)]+'\x27')),0x0;const _0x5656a0=_0x5dd71a[_0x12776e(0x12c)]['filter'](_0x4a25ad=>_0x4a25ad[_0x12776e(0x10a)]),_0x4065d2=_0x5dd71a['files']['filter'](_0x2a5978=>!_0x2a5978[_0x12776e(0x10a)]&&_0x2a5978[_0x12776e(0x130)]),_0x85494f=_0x5dd71a[_0x12776e(0x12c)][_0x12776e(0x131)](_0x3cdaee=>!_0x3cdaee[_0x12776e(0x10a)]&&!_0x3cdaee[_0x12776e(0x130)]);console[_0x12776e(0xed)](_0x12776e(0x108)+_0x5dd71a['parentName']+'\x27:'),console['error'](_0x12776e(0xf0)+a40_0x208dcd[_0x12776e(0xef)](_0x5dd71a[_0x12776e(0x12f)]['segments']+_0x12776e(0xf8))+_0x12776e(0x125)+a40_0x208dcd[_0x12776e(0xef)](_0x5dd71a[_0x12776e(0x12f)]['activations']+'\x20activations'));if(_0x5dd71a[_0x12776e(0x12f)][_0x12776e(0x12b)]>0x0){const _0x170347=_0x5dd71a[_0x12776e(0x12f)][_0x12776e(0xee)]>_0x5dd71a[_0x12776e(0x12f)]['journeys']?'\x20('+_0x5dd71a[_0x12776e(0x12f)]['journeyVersions']+_0x12776e(0x122):'';console[_0x12776e(0xed)](_0x12776e(0x126)+a40_0x208dcd[_0x12776e(0xef)](_0x5dd71a[_0x12776e(0x12f)][_0x12776e(0x12b)]+_0x12776e(0xf3))+a40_0x208dcd[_0x12776e(0x114)](_0x170347));}console[_0x12776e(0xed)]('\x20\x20'+a40_0x208dcd[_0x12776e(0x11b)]('+\x20'+_0x5656a0[_0x12776e(0xfd)]+_0x12776e(0x139))),console['error']('\x20\x20'+a40_0x208dcd['yellow']('~\x20'+_0x4065d2[_0x12776e(0xfd)]+'\x20changed\x20files')),console['error']('\x20\x20'+a40_0x208dcd[_0x12776e(0x114)]('=\x20'+_0x85494f['length']+_0x12776e(0x127))),console[_0x12776e(0xed)]('\x20\x20Target:\x20'+a40_0x208dcd[_0x12776e(0xef)](_0x5dd71a['targetDir'])+'\x0a');if(_0x4065d2['length']>0x0)for(const _0x7031ef of _0x4065d2){console[_0x12776e(0xed)](_0x12776e(0x10f)+_0x7031ef[_0x12776e(0xeb)]+'\x27:'),console[_0x12776e(0xed)]('─'[_0x12776e(0x11a)](0x3c)),console['error'](_0x7031ef[_0x12776e(0x113)]),console[_0x12776e(0xed)]('─'[_0x12776e(0x11a)](0x3c));}if(_0x47d876['dryRun'])return console[_0x12776e(0xed)](a40_0x208dcd['yellow'](_0x12776e(0x10e))),0x0;if(_0x5656a0[_0x12776e(0xfd)]===0x0&&_0x4065d2[_0x12776e(0xfd)]===0x0)return console['error'](a40_0x208dcd['green'](_0x12776e(0x137))),saveSessionContext({'parent_segment':_0x5dd71a['parentName']},_0x47d876[_0x12776e(0xe8)]),console[_0x12776e(0xed)](a40_0x208dcd[_0x12776e(0x11b)](_0x12776e(0x128)+a40_0x208dcd[_0x12776e(0x114)](_0x12776e(0x133))+_0x12776e(0x117)+a40_0x208dcd[_0x12776e(0xef)](_0x5dd71a[_0x12776e(0x107)]))),0x0;if(!_0x47d876[_0x12776e(0xfc)]){if(!isInteractive())return console[_0x12776e(0xed)](a40_0x208dcd[_0x12776e(0x116)](_0x12776e(0x12a)),_0x12776e(0x112)),console['error'](a40_0x208dcd[_0x12776e(0x114)](_0x12776e(0xf1))),0x1;const _0x413916=await confirmKey(_0x12776e(0x115)+(_0x5656a0['length']+_0x4065d2[_0x12776e(0xfd)])+_0x12776e(0x10d));if(!_0x413916)return console[_0x12776e(0xed)](a40_0x208dcd['yellow'](_0x12776e(0xf9)),_0x12776e(0x11e)),0x1;}for(const _0x1f15f7 of _0x5dd71a[_0x12776e(0x12c)]){if(_0x1f15f7[_0x12776e(0x10a)]||_0x1f15f7[_0x12776e(0x130)]){const _0x23d2bf=a40_0x303894[_0x12776e(0x138)](_0x1f15f7[_0x12776e(0x111)]);!existsSync(_0x23d2bf)&&mkdirSync(_0x23d2bf,{'recursive':!![]}),writeFileSync(_0x1f15f7['absolutePath'],_0x1f15f7[_0x12776e(0x104)],_0x12776e(0x120));}}return console[_0x12776e(0xed)](a40_0x208dcd[_0x12776e(0x11b)](_0x12776e(0xf4)+(_0x5656a0[_0x12776e(0xfd)]+_0x4065d2['length'])+'\x20files\x20to\x20'+_0x5dd71a[_0x12776e(0x105)])),saveSessionContext({'parent_segment':_0x5dd71a['parentName']},_0x47d876[_0x12776e(0xe8)]),console[_0x12776e(0xed)](a40_0x208dcd[_0x12776e(0x11b)]('✔\x20Context\x20set:\x20'+a40_0x208dcd[_0x12776e(0x114)](_0x12776e(0x133))+_0x12776e(0x117)+a40_0x208dcd['cyan'](_0x5dd71a['parentName']))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a41_0x4491ab=a41_0x4e8e;(function(_0x291a87,_0x231c4c){const _0xff7f1f=a41_0x4e8e,_0x3498a8=_0x291a87();while(!![]){try{const _0x2fc4a9=-parseInt(_0xff7f1f(0x20f))/0x1+-parseInt(_0xff7f1f(0x223))/0x2*(parseInt(_0xff7f1f(0x1df))/0x3)+parseInt(_0xff7f1f(0x258))/0x4+-parseInt(_0xff7f1f(0x1d9))/0x5*(-parseInt(_0xff7f1f(0x227))/0x6)+parseInt(_0xff7f1f(0x232))/0x7+parseInt(_0xff7f1f(0x256))/0x8+-parseInt(_0xff7f1f(0x1e0))/0x9;if(_0x2fc4a9===_0x231c4c)break;else _0x3498a8['push'](_0x3498a8['shift']());}catch(_0x106baa){_0x3498a8['push'](_0x3498a8['shift']());}}}(a41_0x463c,0x76dd0));import{BaseCommand}from'./command.js';function a41_0x463c(){const _0x5599cc=['Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','created','folderId','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','Scoped\x20to\x20folder:\x20','endsWith','filter','data','description','Error:\x20','targetDir','\x20created','parentSegment','\x20changed','Resolving\x20parent\x20segment\x20\x27','yamlConfig','attributes','existingSegment','journeysOnly','journeyBundleName','/e/','createdSegmentIds','repeat','add','get','Changes\x20to\x20journey:','deleted','journeys','parentFolder','.yaml','419312tCYrZc','diff','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','segment:push','folderPath','connection','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','unchanged','/app/ps/','📁\x20','execute','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','toUpdate','list','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','all','then','Fetching\x20existing\x20activations...','Folders\x20to\x20create:','existingJourney','6316LgnUqz','\x20deleted','Error:\x20Directory\x20not\x20found:\x20','dryRun','102DzeMEv','new','name','/j/da/je','segments','\x20updated','Fetching\x20existing\x20data...','versionNumber','toDelete','segment','audienceId','4693857OuLWtE','folders','site','user','listActivations','idToName','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','activations','\x0aValidation\x20failed:','(Journey\x20will\x20be\x20deleted)','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','.yml','\x0a✔\x20Push\x20complete','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','delete','listJourneysWithDetailsFromParentSegment','\x20to\x20update','journeyId','getOutputSchemaWithCache','nameToType','set','state','\x20\x20\x20\x20','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','\x20to\x20delete','Aborted.','\x20new','journeyBundleId','red','yellow','\x20YAML\x20files\x20found','error','New\x20segment:','type','nameToId','toCreate','724984KWCOkH','Delete\x20segment:','1708620FPBOyh','map','cyan','/sb/da/esr','segmentFolderId','updated','changed','setPhase','push','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','Parent\x20segment:\x20','join','file','createdAt','green','Changes\x20to:','Push\x20','errorCode','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','message','\x20\x20Activations:','parent_name','dim','109415lRcTLO','isScoped','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','length','\x20\x20Activations:\x20','paused','420vtNhlc','1908396guZvtf','\x20\x20Console\x20URL\x20(share\x20with\x20client):\x20','getJourney','\x20\x20📊\x20Segments:','\x20unchanged','resolveParentId','blue','verbose','filePath','helpText','relationships','Site:\x20','isNew','journey','toString','listSegments','listFolders'];a41_0x463c=function(){return _0x5599cc;};return a41_0x463c();}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 a41_0x46fc59 from'chalk';function a41_0x4e8e(_0x40459b,_0x4e5d4c){_0x40459b=_0x40459b-0x1d3;const _0x463cb0=a41_0x463c();let _0x4e8e2b=_0x463cb0[_0x40459b];return _0x4e8e2b;}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{[a41_0x4491ab(0x229)]=a41_0x4491ab(0x212);[a41_0x4491ab(0x1f9)]=a41_0x4491ab(0x1f4);async[a41_0x4491ab(0x219)](_0x11fb34){const _0x28cbf7=a41_0x4491ab,{options:_0x11a60e,args:_0x1e6f4e,tdx:_0x5bef7a}=_0x11fb34,_0x9b0375=_0x11a60e,_0x4716a4=await resolveTarget({'arg':_0x1e6f4e[0x0],'contextParent':_0x11a60e[_0x28cbf7(0x1fd)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x4716a4))return _0x4716a4[_0x28cbf7(0x1d3)]==='no_parent'?(console[_0x28cbf7(0x251)](a41_0x46fc59['yellow'](_0x28cbf7(0x215))),console[_0x28cbf7(0x251)]('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['error'](_0x28cbf7(0x23c)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file')):(console[_0x28cbf7(0x251)](a41_0x46fc59['red'](_0x28cbf7(0x1fa)+_0x4716a4[_0x28cbf7(0x1d5)]+'\x0a')),_0x4716a4[_0x28cbf7(0x1e9)]&&console[_0x28cbf7(0x251)](a41_0x46fc59[_0x28cbf7(0x25a)](_0x4716a4['helpText']))),0x1;if(_0x4716a4[_0x28cbf7(0x253)]===_0x28cbf7(0x1d7))return console[_0x28cbf7(0x251)](a41_0x46fc59[_0x28cbf7(0x24e)](_0x28cbf7(0x225)+_0x4716a4['targetDir']+'\x0a')),console['error'](a41_0x46fc59[_0x28cbf7(0x25a)]('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;const _0x3c5720=_0x4716a4['parentName'],_0x47f69a=_0x4716a4[_0x28cbf7(0x1fb)],_0x4f2ac1=_0x4716a4[_0x28cbf7(0x253)]===_0x28cbf7(0x264)?_0x4716a4[_0x28cbf7(0x1e8)]:undefined,_0x1f3325=getScopedDetails(_0x4716a4),_0x2212c8=_0x1f3325?.[_0x28cbf7(0x1da)]??![],_0x598ad2=_0x1f3325?.['scopedFolderPath']??'';if(!existsSync(_0x47f69a))return console[_0x28cbf7(0x251)](a41_0x46fc59[_0x28cbf7(0x24e)](_0x28cbf7(0x225)+_0x47f69a+'\x0a')),console[_0x28cbf7(0x251)](a41_0x46fc59[_0x28cbf7(0x25a)]('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;_0x9b0375['verbose']&&(console[_0x28cbf7(0x251)](_0x28cbf7(0x1eb)+_0x9b0375[_0x28cbf7(0x234)]),console[_0x28cbf7(0x251)](_0x28cbf7(0x262)+_0x3c5720),console['error']('Source\x20directory:\x20'+_0x47f69a),_0x2212c8&&console[_0x28cbf7(0x251)](_0x28cbf7(0x1f5)+_0x598ad2));const _0x36b955=await withSpinner(_0x28cbf7(0x1ff)+_0x3c5720+'\x27...',()=>_0x5bef7a[_0x28cbf7(0x230)][_0x28cbf7(0x1e5)](_0x3c5720),{'verbose':_0x9b0375[_0x28cbf7(0x1e7)]}),_0x5d7710=_0x36b955[_0x28cbf7(0x1f8)],{parentSegmentResult:_0x51c51a,segmentsResult:_0x3d98d6,foldersResult:_0x2fdc22,journeysWithDetailsResult:_0x269078,userMaps:_0x363391}=await withSpinner(_0x28cbf7(0x22d),async()=>{const _0x5f4329=_0x28cbf7,[_0x48842c,_0x26bb24,_0x167697,_0x1aa8bb,_0x267c3a]=await Promise[_0x5f4329(0x21e)]([_0x5bef7a[_0x5f4329(0x230)]['getParent'](_0x5d7710),_0x5bef7a[_0x5f4329(0x230)][_0x5f4329(0x1ef)](_0x5d7710),_0x5bef7a['segment'][_0x5f4329(0x1f0)](_0x5d7710),_0x5bef7a[_0x5f4329(0x1ed)][_0x5f4329(0x241)](_0x5d7710,{'includeAllVersions':!![]}),_0x5bef7a[_0x5f4329(0x235)]['buildUserMaps']()]);return{'parentSegmentResult':_0x48842c,'segmentsResult':_0x26bb24,'foldersResult':_0x167697,'journeysWithDetailsResult':_0x1aa8bb,'userMaps':_0x267c3a};},{'verbose':_0x9b0375[_0x28cbf7(0x1e7)]})[_0x28cbf7(0x21f)](_0xa59d34=>_0xa59d34['data']),_0x37364c=_0x51c51a,_0x14713b=extractRootFolderId(_0x37364c),_0x1f9237=_0x3d98d6,_0x2605b2=_0x2fdc22,{journeys:_0x3e33af,activationStepsById:_0x1d7141}=_0x269078,_0x492ea1=new Map(_0x3e33af[_0x28cbf7(0x259)](_0x2d4a78=>[_0x2d4a78['id'],_0x2d4a78])),_0xb13528=_0x3e33af[_0x28cbf7(0x259)](_0x1e0ea2=>({'id':_0x1e0ea2['id'],'name':_0x1e0ea2['attributes'][_0x28cbf7(0x229)],'journeyBundleName':_0x1e0ea2[_0x28cbf7(0x201)][_0x28cbf7(0x204)]||'','journeyBundleId':_0x1e0ea2[_0x28cbf7(0x201)][_0x28cbf7(0x24d)]||'','versionNumber':_0x1e0ea2['attributes'][_0x28cbf7(0x22e)],'description':_0x1e0ea2[_0x28cbf7(0x201)]['description'],'state':_0x1e0ea2[_0x28cbf7(0x201)][_0x28cbf7(0x247)],'paused':_0x1e0ea2['attributes'][_0x28cbf7(0x1de)],'audienceId':_0x1e0ea2['attributes'][_0x28cbf7(0x231)],'folderId':_0x1e0ea2[_0x28cbf7(0x1ea)]?.[_0x28cbf7(0x20d)]?.[_0x28cbf7(0x1f8)]?.['id'],'createdAt':_0x1e0ea2[_0x28cbf7(0x201)][_0x28cbf7(0x265)],'updatedAt':_0x1e0ea2[_0x28cbf7(0x201)]['updatedAt']})),{emailToId:_0x25283b,idToEmail:_0x319809}=_0x363391,_0x2ebb65=await withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',async()=>{const _0x2e89da=_0x28cbf7,_0x4f56cc=await _0x5bef7a[_0x2e89da(0x214)][_0x2e89da(0x21c)]();return buildConnectionMaps(_0x4f56cc);},{'verbose':_0x9b0375[_0x28cbf7(0x1e7)]})[_0x28cbf7(0x21f)](_0x457ac9=>_0x457ac9['data']),_0x5d865f=_0x2ebb65[_0x28cbf7(0x254)],_0x3297ed=_0x2ebb65[_0x28cbf7(0x237)],_0x2c82a1=_0x2ebb65[_0x28cbf7(0x245)],_0x17c935={'emailToIdMap':_0x25283b,'connectionNameToIdMap':_0x5d865f,'connectionNameToTypeMap':_0x2c82a1,'getSchema':_0x42cff5=>_0x5bef7a['connection'][_0x28cbf7(0x244)](_0x42cff5)};let {pathToId:_0x396ab7,idToPath:_0x40a74e}=buildFolderMaps(_0x2605b2);const _0x50aac2=buildSegmentLookupMap(_0x1f9237,_0x40a74e),_0x1b9240=buildSegmentNameToIdMap(_0x1f9237),_0x1ac331=buildJourneyBundleLookupMap(_0xb13528,_0x40a74e);let _0x413e3d;if(_0x4f2ac1){if(!_0x4f2ac1[_0x28cbf7(0x1f6)](_0x28cbf7(0x23d))&&!_0x4f2ac1[_0x28cbf7(0x1f6)](_0x28cbf7(0x20e)))return console['error'](a41_0x46fc59[_0x28cbf7(0x24e)](_0x28cbf7(0x249)+_0x4f2ac1+'\x0a')),0x1;_0x413e3d=[_0x4f2ac1];}else _0x413e3d=findYamlFiles(_0x47f69a);if(_0x413e3d[_0x28cbf7(0x1dc)]===0x0)return console[_0x28cbf7(0x251)](a41_0x46fc59[_0x28cbf7(0x24e)](_0x28cbf7(0x1d4)+_0x47f69a+'\x0a')),console[_0x28cbf7(0x251)](a41_0x46fc59[_0x28cbf7(0x25a)](_0x28cbf7(0x1f1))),0x1;let _0x15291f,_0x58d7e1;try{const _0x1c1e7f=parseAndClassifyYamlFiles(_0x413e3d,_0x47f69a,{'skipSegments':_0x9b0375[_0x28cbf7(0x203)]});_0x15291f=_0x1c1e7f['segments'],_0x58d7e1=_0x1c1e7f[_0x28cbf7(0x20c)];const _0x36cf59=validateParsedFiles(_0x1c1e7f,_0x47f69a);if(_0x36cf59[_0x28cbf7(0x1dc)]>0x0)return console[_0x28cbf7(0x251)](a41_0x46fc59['red'](_0x28cbf7(0x23a))),console['error'](formatValidationErrors(_0x36cf59)),console['error'](a41_0x46fc59[_0x28cbf7(0x24f)](_0x28cbf7(0x238))),0x1;}catch(_0x25b821){return console[_0x28cbf7(0x251)](a41_0x46fc59[_0x28cbf7(0x24e)]('Error\x20parsing\x20YAML:\x20'+(_0x25b821 instanceof Error?_0x25b821['message']:_0x25b821))),0x1;}if(_0x15291f[_0x28cbf7(0x1dc)]===0x0&&_0x58d7e1[_0x28cbf7(0x1dc)]===0x0){const _0x3344d2=_0x9b0375[_0x28cbf7(0x203)]?_0x28cbf7(0x1ed):'segment\x20or\x20journey';return console[_0x28cbf7(0x251)](a41_0x46fc59[_0x28cbf7(0x24f)]('No\x20'+_0x3344d2+_0x28cbf7(0x250))),0x0;}const _0x3b15c5=new Map();_0x1f9237[_0x28cbf7(0x1dc)]>0x0&&!_0x9b0375['journeysOnly']&&await withSpinner(_0x28cbf7(0x220),async()=>{await batchAsync(_0x1f9237,async _0x4e513d=>{const _0x154ec9=a41_0x4e8e,_0x23e492=await _0x5bef7a[_0x154ec9(0x230)][_0x154ec9(0x236)](_0x5d7710,_0x4e513d['id']);_0x3b15c5['set'](_0x4e513d['id'],_0x23e492);});},{'verbose':_0x9b0375[_0x28cbf7(0x1e7)]});const {segmentFiles:_0x12c4d9,foldersToCreate:_0x4d8d54}=await prepareSegmentFiles(_0x15291f,{'segmentByFolderAndName':_0x50aac2,'activationsBySegmentId':_0x3b15c5,'folderPathToId':_0x396ab7,'idToEmailMap':_0x319809,'connectionIdToNameMap':_0x3297ed},_0x17c935,_0x2212c8,_0x598ad2),_0x3cead4=_0x4f2ac1?[]:findSegmentsToDelete(_0x1f9237,_0x15291f[_0x28cbf7(0x259)](({yamlConfig:_0x3ca79e,folderPath:_0x1f606a})=>({'yamlConfig':_0x3ca79e,'folderPath':resolveTDFolderPath(_0x1f606a,_0x2212c8,_0x598ad2)})),_0x40a74e,_0x598ad2,_0x2212c8),{journeyFiles:_0x30c7fa,foldersToCreate:_0xd6a7d7}=await withProgressSpinner('Preparing\x20journeys...',async _0x1e13a4=>prepareJourneyFiles(_0x58d7e1,{'fetchJourney':async _0x9a7b68=>_0x5bef7a['journey'][_0x28cbf7(0x1e2)](_0x9a7b68[_0x28cbf7(0x243)]),'journeyBundlesByFolderAndName':_0x1ac331,'folderPathToId':_0x396ab7,'idToEmailMap':_0x319809,'connectionIdToNameMap':_0x3297ed,'existingSegments':_0x1f9237,'parentId':_0x5d7710,'deps':_0x5bef7a,'progress':{'update':_0x3bd06a=>{const _0x214f70=_0x28cbf7;_0x1e13a4[_0x214f70(0x25f)](_0x3bd06a),_0x9b0375['verbose']&&console[_0x214f70(0x251)]('\x20\x20'+_0x3bd06a);}},'journeyById':_0x492ea1,'activationStepsById':_0x1d7141},_0x2212c8,_0x598ad2),{'verbose':_0x9b0375[_0x28cbf7(0x1e7)]})[_0x28cbf7(0x21f)](_0x4b267b=>_0x4b267b[_0x28cbf7(0x1f8)]);for(const _0x4bc622 of _0xd6a7d7){_0x4d8d54[_0x28cbf7(0x208)](_0x4bc622);}const _0x52f2fd=_0x4f2ac1?[]:findJourneysToDelete(_0xb13528,_0x58d7e1[_0x28cbf7(0x259)](({yamlConfig:_0x535217,folderPath:_0x1b336e})=>({'yamlConfig':_0x535217,'folderPath':resolveTDFolderPath(_0x1b336e,_0x2212c8,_0x598ad2)})),_0x40a74e,_0x598ad2,_0x2212c8),_0x208ab4=calculatePushStats(_0x12c4d9,_0x30c7fa,_0x4d8d54,_0x3cead4,_0x52f2fd,!!_0x9b0375[_0x28cbf7(0x240)],!!_0x9b0375[_0x28cbf7(0x203)]),_0x41be80=_0x208ab4[_0x28cbf7(0x22b)][_0x28cbf7(0x228)],_0x20e116=_0x208ab4['segments'][_0x28cbf7(0x25e)],_0x2fc568=_0x208ab4[_0x28cbf7(0x22b)]['unchanged'],_0x3a5f30=_0x208ab4[_0x28cbf7(0x22b)][_0x28cbf7(0x22f)],_0x371043=_0x208ab4[_0x28cbf7(0x233)][_0x28cbf7(0x255)],_0x3a8bd7=_0x208ab4['journeys']['new'],_0x1d1325=_0x208ab4[_0x28cbf7(0x20c)][_0x28cbf7(0x25e)],_0x3791bd=_0x208ab4[_0x28cbf7(0x20c)][_0x28cbf7(0x216)],_0x5206be=_0x208ab4[_0x28cbf7(0x20c)][_0x28cbf7(0x22f)],_0x5af43f=_0x208ab4[_0x28cbf7(0x239)][_0x28cbf7(0x21e)],_0x4378a2=_0x208ab4['activations'][_0x28cbf7(0x255)],_0x30f667=_0x208ab4[_0x28cbf7(0x239)][_0x28cbf7(0x21b)],_0x52a4e3=_0x208ab4[_0x28cbf7(0x239)][_0x28cbf7(0x22f)];console[_0x28cbf7(0x251)]('\x0aPush\x20summary\x20for\x20\x27'+_0x3c5720+'\x27:');_0x371043[_0x28cbf7(0x1dc)]>0x0&&console['error']('\x20\x20'+a41_0x46fc59[_0x28cbf7(0x1e6)](_0x28cbf7(0x218)+_0x371043[_0x28cbf7(0x1dc)]+'\x20folders\x20to\x20create'));if(!_0x9b0375['journeysOnly']){console[_0x28cbf7(0x251)](_0x28cbf7(0x1e3)),console[_0x28cbf7(0x251)](_0x28cbf7(0x248)+a41_0x46fc59[_0x28cbf7(0x266)]('+\x20'+_0x41be80[_0x28cbf7(0x1dc)]+'\x20new')),console['error'](_0x28cbf7(0x248)+a41_0x46fc59[_0x28cbf7(0x24f)]('~\x20'+_0x20e116[_0x28cbf7(0x1dc)]+_0x28cbf7(0x1fe)));if(_0x3a5f30[_0x28cbf7(0x1dc)]>0x0)console[_0x28cbf7(0x251)](_0x28cbf7(0x248)+a41_0x46fc59[_0x28cbf7(0x24e)]('-\x20'+_0x3a5f30[_0x28cbf7(0x1dc)]+_0x28cbf7(0x24a)));else _0x3cead4['length']>0x0&&!_0x9b0375[_0x28cbf7(0x240)]&&console[_0x28cbf7(0x251)]('\x20\x20\x20\x20'+a41_0x46fc59['dim'](_0x3cead4[_0x28cbf7(0x1dc)]+_0x28cbf7(0x211)));console[_0x28cbf7(0x251)]('\x20\x20\x20\x20'+a41_0x46fc59[_0x28cbf7(0x1d8)]('=\x20'+_0x2fc568[_0x28cbf7(0x1dc)]+_0x28cbf7(0x1e4)));}if(_0x30c7fa['length']>0x0||_0x52f2fd[_0x28cbf7(0x1dc)]>0x0){console[_0x28cbf7(0x251)]('\x20\x20🗺️\x20\x20Journeys:'),console[_0x28cbf7(0x251)](_0x28cbf7(0x248)+a41_0x46fc59[_0x28cbf7(0x266)]('+\x20'+_0x3a8bd7[_0x28cbf7(0x1dc)]+_0x28cbf7(0x24c))),console[_0x28cbf7(0x251)](_0x28cbf7(0x248)+a41_0x46fc59[_0x28cbf7(0x24f)]('~\x20'+_0x1d1325[_0x28cbf7(0x1dc)]+_0x28cbf7(0x1fe)));if(_0x5206be[_0x28cbf7(0x1dc)]>0x0)console['error'](_0x28cbf7(0x248)+a41_0x46fc59[_0x28cbf7(0x24e)]('-\x20'+_0x5206be['length']+_0x28cbf7(0x24a)));else _0x52f2fd[_0x28cbf7(0x1dc)]>0x0&&!_0x9b0375[_0x28cbf7(0x240)]&&console[_0x28cbf7(0x251)](_0x28cbf7(0x248)+a41_0x46fc59[_0x28cbf7(0x1d8)](_0x52f2fd[_0x28cbf7(0x1dc)]+_0x28cbf7(0x211)));console[_0x28cbf7(0x251)](_0x28cbf7(0x248)+a41_0x46fc59['dim']('=\x20'+_0x3791bd[_0x28cbf7(0x1dc)]+_0x28cbf7(0x1e4)));}_0x5af43f[_0x28cbf7(0x1dc)]>0x0&&!_0x9b0375[_0x28cbf7(0x203)]&&(console[_0x28cbf7(0x251)](''),console[_0x28cbf7(0x251)](_0x28cbf7(0x1d6)),_0x4378a2[_0x28cbf7(0x1dc)]>0x0&&console[_0x28cbf7(0x251)](_0x28cbf7(0x248)+a41_0x46fc59['green']('+\x20'+_0x4378a2[_0x28cbf7(0x1dc)]+'\x20to\x20create')),_0x30f667['length']>0x0&&console[_0x28cbf7(0x251)]('\x20\x20\x20\x20'+a41_0x46fc59['yellow']('~\x20'+_0x30f667['length']+_0x28cbf7(0x242))),_0x52a4e3[_0x28cbf7(0x1dc)]>0x0&&console[_0x28cbf7(0x251)](_0x28cbf7(0x248)+a41_0x46fc59['red']('-\x20'+_0x52a4e3[_0x28cbf7(0x1dc)]+_0x28cbf7(0x24a))));console[_0x28cbf7(0x251)]('\x20\x20Source:\x20'+a41_0x46fc59[_0x28cbf7(0x25a)](_0x47f69a)+'\x0a');if(_0x371043['length']>0x0){console[_0x28cbf7(0x251)](_0x28cbf7(0x221));for(const _0x5e629f of _0x371043){console[_0x28cbf7(0x251)]('\x20\x20'+a41_0x46fc59['blue']('+')+'\x20'+_0x5e629f);}console['error']('');}if(_0x41be80[_0x28cbf7(0x1dc)]>0x0&&!_0x9b0375[_0x28cbf7(0x203)])for(const _0x67edc6 of _0x41be80){const _0x36ae6e=_0x67edc6['folderPath']?_0x67edc6[_0x28cbf7(0x213)]+'/'+_0x67edc6[_0x28cbf7(0x200)][_0x28cbf7(0x229)]:_0x67edc6['yamlConfig'][_0x28cbf7(0x229)],_0x36ff8e=_0x67edc6[_0x28cbf7(0x200)]['activations']?.[_0x28cbf7(0x1dc)]||0x0,_0x48f1d0=_0x36ff8e>0x0?a41_0x46fc59['dim']('\x20['+_0x36ff8e+'\x20activations]'):'';console[_0x28cbf7(0x251)]('\x0a'+a41_0x46fc59[_0x28cbf7(0x266)](_0x28cbf7(0x252))+'\x20'+_0x36ae6e+_0x48f1d0),console[_0x28cbf7(0x251)]('─'[_0x28cbf7(0x207)](0x3c)),_0x67edc6['diff']&&console[_0x28cbf7(0x251)](_0x67edc6[_0x28cbf7(0x210)]),console['error']('─'[_0x28cbf7(0x207)](0x3c));}if(_0x3a5f30[_0x28cbf7(0x1dc)]>0x0&&!_0x9b0375[_0x28cbf7(0x203)])for(const _0x4ae1eb of _0x3a5f30){const _0x4746a0=_0x4ae1eb[_0x28cbf7(0x25c)]?_0x40a74e[_0x28cbf7(0x209)](_0x4ae1eb[_0x28cbf7(0x25c)][_0x28cbf7(0x1ee)]())||'':'',_0x51b994=_0x4746a0?_0x4746a0+'/'+_0x4ae1eb[_0x28cbf7(0x229)]:_0x4ae1eb[_0x28cbf7(0x229)],_0x381d7f=_0x3b15c5['get'](_0x4ae1eb['id'])||[],_0x47f2c8=_0x381d7f[_0x28cbf7(0x1dc)]>0x0?a41_0x46fc59[_0x28cbf7(0x1d8)]('\x20['+_0x381d7f[_0x28cbf7(0x1dc)]+'\x20activations]'):'';console[_0x28cbf7(0x251)]('\x0a'+a41_0x46fc59['red'](_0x28cbf7(0x257))+'\x20'+_0x51b994+_0x47f2c8),console['error']('─'['repeat'](0x3c));const _0x55f2ea=segmentWithActivationsToYaml(_0x4ae1eb,_0x381d7f,undefined,_0x319809,_0x3297ed),_0x3b9b2a=segmentToYamlString(_0x55f2ea),_0x1632e0=generateDiff(_0x3b9b2a,'');console[_0x28cbf7(0x251)](formatDiffWithColors(_0x1632e0)),console[_0x28cbf7(0x251)]('─'['repeat'](0x3c));}const _0x31ab96=_0x12c4d9[_0x28cbf7(0x1f7)](_0xd3541b=>!_0xd3541b[_0x28cbf7(0x1ec)]&&_0xd3541b[_0x28cbf7(0x210)]);if(_0x31ab96[_0x28cbf7(0x1dc)]>0x0&&!_0x9b0375[_0x28cbf7(0x203)])for(const _0x5c2ff3 of _0x31ab96){const _0x4835bc=_0x5c2ff3['folderPath']?_0x5c2ff3['folderPath']+'/'+_0x5c2ff3[_0x28cbf7(0x200)][_0x28cbf7(0x229)]:_0x5c2ff3[_0x28cbf7(0x200)]['name'];console['error']('\x0a'+a41_0x46fc59['yellow'](_0x28cbf7(0x267))+'\x20'+_0x4835bc),console[_0x28cbf7(0x251)]('─'[_0x28cbf7(0x207)](0x3c)),console[_0x28cbf7(0x251)](_0x5c2ff3[_0x28cbf7(0x210)]),console[_0x28cbf7(0x251)]('─'[_0x28cbf7(0x207)](0x3c));}if(_0x3a8bd7['length']>0x0)for(const _0x372b6b of _0x3a8bd7){const _0xc40da0=_0x372b6b['folderPath']?_0x372b6b['folderPath']+'/'+_0x372b6b['yamlConfig'][_0x28cbf7(0x229)]:_0x372b6b[_0x28cbf7(0x200)][_0x28cbf7(0x229)];console[_0x28cbf7(0x251)]('\x0a'+a41_0x46fc59[_0x28cbf7(0x266)]('New\x20journey:')+'\x20'+_0xc40da0),console[_0x28cbf7(0x251)]('─'[_0x28cbf7(0x207)](0x3c)),_0x372b6b['diff']&&console['error'](_0x372b6b[_0x28cbf7(0x210)]),console[_0x28cbf7(0x251)]('─'[_0x28cbf7(0x207)](0x3c));}const _0x40e96f=_0x30c7fa[_0x28cbf7(0x1f7)](_0xc16820=>!_0xc16820[_0x28cbf7(0x1ec)]&&_0xc16820[_0x28cbf7(0x210)]);if(_0x40e96f['length']>0x0)for(const _0x3a0cc4 of _0x40e96f){const _0x21d327=_0x3a0cc4['folderPath']?_0x3a0cc4['folderPath']+'/'+_0x3a0cc4['yamlConfig'][_0x28cbf7(0x229)]:_0x3a0cc4['yamlConfig'][_0x28cbf7(0x229)];console[_0x28cbf7(0x251)]('\x0a'+a41_0x46fc59['yellow'](_0x28cbf7(0x20a))+'\x20'+_0x21d327),console[_0x28cbf7(0x251)]('─'['repeat'](0x3c)),console[_0x28cbf7(0x251)](_0x3a0cc4[_0x28cbf7(0x210)]),console[_0x28cbf7(0x251)]('─'[_0x28cbf7(0x207)](0x3c));}if(_0x5206be[_0x28cbf7(0x1dc)]>0x0)for(const _0x5ba162 of _0x5206be){const _0x562369=_0x5ba162[_0x28cbf7(0x1f3)]?_0x40a74e[_0x28cbf7(0x209)](_0x5ba162['folderId'])||'':'',_0x187bf4=_0x562369?_0x562369+'/'+_0x5ba162[_0x28cbf7(0x204)]:_0x5ba162[_0x28cbf7(0x204)];console['error']('\x0a'+a41_0x46fc59[_0x28cbf7(0x24e)]('Delete\x20journey:')+'\x20'+_0x187bf4),console[_0x28cbf7(0x251)]('─'['repeat'](0x3c)),console[_0x28cbf7(0x251)](a41_0x46fc59[_0x28cbf7(0x24e)](_0x28cbf7(0x23b))),console[_0x28cbf7(0x251)]('─'[_0x28cbf7(0x207)](0x3c));}if(_0x9b0375[_0x28cbf7(0x226)])return console['error'](a41_0x46fc59[_0x28cbf7(0x24f)](_0x28cbf7(0x23f))),0x0;const _0x2a2ebe=_0x9b0375[_0x28cbf7(0x203)]?![]:_0x41be80['length']>0x0||_0x20e116['length']>0x0||_0x3a5f30[_0x28cbf7(0x1dc)]>0x0,_0x284f3f=_0x3a8bd7[_0x28cbf7(0x1dc)]>0x0||_0x1d1325[_0x28cbf7(0x1dc)]>0x0||_0x5206be[_0x28cbf7(0x1dc)]>0x0,_0x436c8a=_0x9b0375[_0x28cbf7(0x203)]?![]:_0x5af43f[_0x28cbf7(0x1dc)]>0x0,_0x22eea1=_0x371043['length']>0x0;if(!_0x2a2ebe&&!_0x284f3f&&!_0x436c8a&&!_0x22eea1){const _0x49c41e=_0x9b0375[_0x28cbf7(0x203)]?_0x28cbf7(0x1db):_0x28cbf7(0x261);console[_0x28cbf7(0x251)](a41_0x46fc59[_0x28cbf7(0x266)](_0x49c41e));if(_0x4f2ac1&&_0x2fc568[_0x28cbf7(0x1dc)]===0x1){const _0x2e720e=_0x2fc568[0x0];if(_0x2e720e['existingSegment']?.['id']){const _0x2b130f=getConsoleNextUrl(_0x9b0375['site'],_0x28cbf7(0x217)+_0x5d7710+_0x28cbf7(0x205)+_0x2e720e[_0x28cbf7(0x202)]['id']+_0x28cbf7(0x25b));console['error'](_0x28cbf7(0x1e1)+a41_0x46fc59[_0x28cbf7(0x25a)](_0x2b130f));}}if(_0x4f2ac1&&_0x3791bd[_0x28cbf7(0x1dc)]===0x1){const _0x15a964=_0x3791bd[0x0];if(_0x15a964['existingJourney']?.['id']){const _0x461e29=getConsoleNextUrl(_0x9b0375['site'],_0x28cbf7(0x217)+_0x5d7710+'/e/'+_0x15a964[_0x28cbf7(0x222)]['id']+_0x28cbf7(0x22a));console['error']('\x20\x20'+a41_0x46fc59[_0x28cbf7(0x25a)](_0x461e29));}}return 0x0;}const _0x4ad48d=_0x9b0375[_0x28cbf7(0x203)]?_0x3a8bd7['length']+_0x1d1325['length']+_0x5206be['length']+_0x371043[_0x28cbf7(0x1dc)]:_0x41be80['length']+_0x20e116[_0x28cbf7(0x1dc)]+_0x3a5f30[_0x28cbf7(0x1dc)]+_0x3a8bd7['length']+_0x1d1325[_0x28cbf7(0x1dc)]+_0x5206be[_0x28cbf7(0x1dc)]+_0x371043[_0x28cbf7(0x1dc)]+_0x5af43f[_0x28cbf7(0x1dc)];if(!_0x9b0375['yes']&&_0x4ad48d>0x0){if(!isInteractive())return console[_0x28cbf7(0x251)](a41_0x46fc59['red']('\x0aError:'),_0x28cbf7(0x21d)),console[_0x28cbf7(0x251)](a41_0x46fc59['dim']('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0xefd14b=await confirmKey(_0x28cbf7(0x268)+_0x4ad48d+'\x20changes?');if(!_0xefd14b)return console[_0x28cbf7(0x251)](a41_0x46fc59['yellow'](_0x28cbf7(0x24b))),0x1;}const _0x2739a7={'withProgress':async(_0x5542e4,_0x16c4f5)=>{const _0x28d435=_0x28cbf7,_0x21c531=await withSpinner(_0x5542e4,_0x16c4f5,{'verbose':_0x9b0375[_0x28d435(0x1e7)]});return{'data':_0x21c531[_0x28d435(0x1f8)]};},'logInfo':_0x3454ea=>console[_0x28cbf7(0x251)](a41_0x46fc59[_0x28cbf7(0x1e6)]('✔\x20'+_0x3454ea)),'logSuccess':_0x5129ab=>console[_0x28cbf7(0x251)](a41_0x46fc59['green']('✔\x20'+_0x5129ab)),'logWarning':_0x2994b7=>console[_0x28cbf7(0x251)](a41_0x46fc59[_0x28cbf7(0x24f)]('⚠\x20'+_0x2994b7)),'logDeleted':_0x410ea9=>console['error'](a41_0x46fc59[_0x28cbf7(0x24e)]('✔\x20'+_0x410ea9))},_0x4bb8a4={'segment':_0x5bef7a[_0x28cbf7(0x230)],'journey':_0x5bef7a[_0x28cbf7(0x1ed)],'user':_0x5bef7a['user'],'connection':_0x5bef7a[_0x28cbf7(0x214)]};_0x371043[_0x28cbf7(0x1dc)]>0x0&&(_0x396ab7=await executePushFolders(_0x4bb8a4,_0x371043,_0x396ab7,{'parentId':_0x5d7710},_0x2739a7));const _0x2a3633={'rootFolderId':_0x14713b,'folderPathToId':_0x396ab7,'folderIdToPath':_0x40a74e,'segmentNameToId':_0x1b9240,'activationsBySegmentId':_0x3b15c5,'emailToIdMap':_0x25283b,'idToEmailMap':_0x319809,'connectionNameToIdMap':_0x2ebb65[_0x28cbf7(0x254)],'connectionIdToNameMap':_0x2ebb65[_0x28cbf7(0x237)],'connectionNameToTypeMap':_0x2c82a1},_0x8d4c52=await executePushSegments(_0x4bb8a4,_0x9b0375[_0x28cbf7(0x203)]?[]:_0x12c4d9,_0x2a3633,{'parentId':_0x5d7710},_0x2739a7),_0xaf272d=_0x8d4c52[_0x28cbf7(0x1f2)],_0x406a49=_0x8d4c52['updated'],_0x5f5b0a=_0x8d4c52[_0x28cbf7(0x239)][_0x28cbf7(0x1f2)],_0x5324b2=_0x8d4c52['activations'][_0x28cbf7(0x25d)],_0x948af9=_0x8d4c52[_0x28cbf7(0x239)][_0x28cbf7(0x20b)];let _0x52af73;if(_0x4f2ac1&&_0x12c4d9['length']===0x1){const _0x5c45f1=_0x12c4d9[0x0];_0x52af73=_0x5c45f1[_0x28cbf7(0x202)]?.['id']??_0x8d4c52[_0x28cbf7(0x206)][_0x28cbf7(0x209)](_0x5c45f1[_0x28cbf7(0x200)][_0x28cbf7(0x229)]);}const _0x293764=await executePushSegmentDeletions(_0x4bb8a4,_0x9b0375[_0x28cbf7(0x203)]?[]:_0x3a5f30,_0x2739a7);let _0x3d2aa7=0x0,_0x35fbcb=0x0,_0x5b7a35=0x0;const _0x45a119=new Map(_0x1b9240);for(const [_0x281e66,_0x15dc8c]of _0x8d4c52[_0x28cbf7(0x206)]){_0x45a119[_0x28cbf7(0x246)](_0x281e66,_0x15dc8c);}if(_0x30c7fa[_0x28cbf7(0x1dc)]>0x0){const _0x52b251={..._0x2a3633,'segmentNameToId':_0x45a119,'existingSegments':_0x1f9237,'activationContext':_0x17c935},_0x434fc8=await executePushJourneys(_0x4bb8a4,_0x30c7fa,_0x52b251,{'parentId':_0x5d7710,'rootFolderId':_0x14713b,'verbose':_0x9b0375[_0x28cbf7(0x1e7)]},_0x2739a7);_0x3d2aa7=_0x434fc8['created'],_0x35fbcb=_0x434fc8[_0x28cbf7(0x25d)];if(_0x4f2ac1&&_0x434fc8['results'][_0x28cbf7(0x1dc)]===0x1){const _0x41d325=_0x434fc8['results'][0x0];if(_0x41d325['journeyId']){const _0x1709da=getConsoleNextUrl(_0x9b0375['site'],_0x28cbf7(0x217)+_0x5d7710+_0x28cbf7(0x205)+_0x41d325[_0x28cbf7(0x243)]+_0x28cbf7(0x22a));console[_0x28cbf7(0x251)]('\x20\x20'+a41_0x46fc59[_0x28cbf7(0x25a)](_0x1709da));}}}for(const _0x5b714c of _0x5206be){console[_0x28cbf7(0x251)](a41_0x46fc59[_0x28cbf7(0x24f)](_0x28cbf7(0x21a)+_0x5b714c[_0x28cbf7(0x204)])),_0x5b7a35++;}const _0x6d4f84=[];if(_0xaf272d>0x0)_0x6d4f84['push'](_0xaf272d+_0x28cbf7(0x1fc));if(_0x406a49>0x0)_0x6d4f84[_0x28cbf7(0x260)](_0x406a49+_0x28cbf7(0x22c));if(_0x293764>0x0)_0x6d4f84[_0x28cbf7(0x260)](_0x293764+_0x28cbf7(0x224));const _0xc8eb61=[];if(_0x3d2aa7>0x0)_0xc8eb61[_0x28cbf7(0x260)](_0x3d2aa7+_0x28cbf7(0x1fc));if(_0x35fbcb>0x0)_0xc8eb61[_0x28cbf7(0x260)](_0x35fbcb+_0x28cbf7(0x22c));if(_0x5b7a35>0x0)_0xc8eb61[_0x28cbf7(0x260)](_0x5b7a35+_0x28cbf7(0x224));const _0x177ea2=[];if(_0x5f5b0a>0x0)_0x177ea2[_0x28cbf7(0x260)](_0x5f5b0a+'\x20created');if(_0x5324b2>0x0)_0x177ea2[_0x28cbf7(0x260)](_0x5324b2+'\x20updated');if(_0x948af9>0x0)_0x177ea2[_0x28cbf7(0x260)](_0x948af9+_0x28cbf7(0x224));console[_0x28cbf7(0x251)](a41_0x46fc59[_0x28cbf7(0x266)](_0x28cbf7(0x23e)));_0x6d4f84['length']>0x0&&!_0x9b0375[_0x28cbf7(0x203)]&&console['error']('\x20\x20Segments:\x20'+_0x6d4f84[_0x28cbf7(0x263)](',\x20'));_0xc8eb61[_0x28cbf7(0x1dc)]>0x0&&console[_0x28cbf7(0x251)]('\x20\x20Journeys:\x20'+_0xc8eb61[_0x28cbf7(0x263)](',\x20'));_0x177ea2[_0x28cbf7(0x1dc)]>0x0&&!_0x9b0375['journeysOnly']&&console['error'](_0x28cbf7(0x1dd)+_0x177ea2['join'](',\x20'));if(_0x52af73){const _0x112add=getConsoleNextUrl(_0x9b0375[_0x28cbf7(0x234)],_0x28cbf7(0x217)+_0x5d7710+_0x28cbf7(0x205)+_0x52af73+_0x28cbf7(0x25b));console[_0x28cbf7(0x251)](_0x28cbf7(0x1e1)+a41_0x46fc59[_0x28cbf7(0x25a)](_0x112add));}return 0x0;}}
|
|
1
|
+
const a41_0x263525=a41_0x1be6;(function(_0xcf9baa,_0x325d3f){const _0x4c07e5=a41_0x1be6,_0x4a6bc6=_0xcf9baa();while(!![]){try{const _0x4ac89a=parseInt(_0x4c07e5(0x143))/0x1+parseInt(_0x4c07e5(0x111))/0x2+-parseInt(_0x4c07e5(0x125))/0x3+parseInt(_0x4c07e5(0x146))/0x4+-parseInt(_0x4c07e5(0x184))/0x5*(-parseInt(_0x4c07e5(0x161))/0x6)+-parseInt(_0x4c07e5(0x149))/0x7*(-parseInt(_0x4c07e5(0x127))/0x8)+-parseInt(_0x4c07e5(0xf1))/0x9;if(_0x4ac89a===_0x325d3f)break;else _0x4a6bc6['push'](_0x4a6bc6['shift']());}catch(_0x2bf69b){_0x4a6bc6['push'](_0x4a6bc6['shift']());}}}(a41_0x18f8,0x19eac));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 a41_0x18f8(){const _0x145b29=['Fetching\x20connections\x20for\x20name\x20resolution...','Site:\x20','journeysOnly','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','verbose','add','229611LBESLo','description','2224JbGFRl','join','Scoped\x20to\x20folder:\x20','new','journeyBundleId','all','filePath','name','green','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','filter','created','yamlConfig','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','parentSegment','idToName','\x20unchanged','list','resolveParentId','createdSegmentIds','toDelete','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Resolving\x20parent\x20segment\x20\x27','\x20created','/sb/da/esr','listFolders','toUpdate','\x20\x20Activations:','166295JYpTYo','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)','listActivations','475316sdYKTC','audienceId','\x0aError:','4718URNDJe','\x20\x20🗺️\x20\x20Journeys:','diff','attributes','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','segment:push','\x20changes?','map','New\x20segment:','message','scopedFolderPath','Source\x20directory:\x20','red','blue','errorCode','isNew','getParent','\x20\x20\x20\x20','endsWith','existingSegment','folders','cyan','Changes\x20to:','Delete\x20journey:','12972cRlfoD','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Error:\x20Directory\x20not\x20found:\x20','data','parentFolder','length','listSegments','site','journeyBundleName','set','nameToId','updatedAt','\x0a✔\x20Push\x20complete','state','📁\x20','\x20new','versionNumber','createdAt','execute','type','repeat','activations','Folders\x20to\x20create:','user','no_parent','\x20\x20Segments:\x20','/app/ps/','/e/','journeys','results','parent_name','\x0aPush\x20summary\x20for\x20\x27','helpText','targetDir','then','430FBUAmh','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','toCreate','\x20\x20Console\x20URL\x20(share\x20with\x20client):\x20','\x20changed','segmentFolderId','getJourney','existingJourney','get','\x20activations]','4731453kozgiu','push','segment','No\x20','segments','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','\x20deleted','Parent\x20segment:\x20','Delete\x20segment:','journey','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','yellow','(Journey\x20will\x20be\x20deleted)','\x20\x20Source:\x20','folderPath','\x20folders\x20to\x20create','getOutputSchemaWithCache','setPhase','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','/j/da/je','isScoped','\x20to\x20delete','delete','dim','changed','Changes\x20to\x20journey:','Error:\x20','Fetching\x20existing\x20activations...','nameToType','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','folderId','99964gFJmzJ','\x20\x20Activations:\x20','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','\x20\x20Journeys:\x20','journeyId','Error\x20parsing\x20YAML:\x20','relationships','\x20updated','toString','unchanged','error','\x20to\x20create','updated','\x27...'];a41_0x18f8=function(){return _0x145b29;};return a41_0x18f8();}import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a41_0x5d3ea3 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';function a41_0x1be6(_0x22176c,_0x3eacc1){_0x22176c=_0x22176c-0xec;const _0x18f8c9=a41_0x18f8();let _0x1be6d2=_0x18f8c9[_0x22176c];return _0x1be6d2;}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{[a41_0x263525(0x12e)]=a41_0x263525(0x14e);['description']=a41_0x263525(0x122);async[a41_0x263525(0x173)](_0x199588){const _0x5c3b52=a41_0x263525,{options:_0x108be5,args:_0xab8d0e,tdx:_0x5885a9}=_0x199588,_0x11fc33=_0x108be5,_0x595536=await resolveTarget({'arg':_0xab8d0e[0x0],'contextParent':_0x108be5[_0x5c3b52(0x135)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x595536))return _0x595536[_0x5c3b52(0x157)]===_0x5c3b52(0x179)?(console[_0x5c3b52(0x11b)](a41_0x5d3ea3[_0x5c3b52(0xfd)](_0x5c3b52(0xf7))),console['error'](_0x5c3b52(0x144)),console[_0x5c3b52(0x11b)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent'),console[_0x5c3b52(0x11b)]('\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['error'](a41_0x5d3ea3[_0x5c3b52(0x155)](_0x5c3b52(0x10c)+_0x595536[_0x5c3b52(0x152)]+'\x0a')),_0x595536[_0x5c3b52(0x181)]&&console[_0x5c3b52(0x11b)](a41_0x5d3ea3[_0x5c3b52(0x15e)](_0x595536[_0x5c3b52(0x181)]))),0x1;if(_0x595536[_0x5c3b52(0x174)]===_0x5c3b52(0x17f))return console[_0x5c3b52(0x11b)](a41_0x5d3ea3[_0x5c3b52(0x155)]('Error:\x20Directory\x20not\x20found:\x20'+_0x595536[_0x5c3b52(0x182)]+'\x0a')),console['error'](a41_0x5d3ea3[_0x5c3b52(0x15e)](_0x5c3b52(0x13c))),0x1;const _0x18b692=_0x595536['parentName'],_0x13feeb=_0x595536['targetDir'],_0x28cdf0=_0x595536[_0x5c3b52(0x174)]==='file'?_0x595536[_0x5c3b52(0x12d)]:undefined,_0x222d3d=getScopedDetails(_0x595536),_0x471423=_0x222d3d?.[_0x5c3b52(0x106)]??![],_0x26e3d8=_0x222d3d?.[_0x5c3b52(0x153)]??'';if(!existsSync(_0x13feeb))return console[_0x5c3b52(0x11b)](a41_0x5d3ea3[_0x5c3b52(0x155)](_0x5c3b52(0x163)+_0x13feeb+'\x0a')),console[_0x5c3b52(0x11b)](a41_0x5d3ea3[_0x5c3b52(0x15e)](_0x5c3b52(0x13c))),0x1;_0x11fc33[_0x5c3b52(0x123)]&&(console['error'](_0x5c3b52(0x120)+_0x11fc33[_0x5c3b52(0x168)]),console[_0x5c3b52(0x11b)](_0x5c3b52(0xf9)+_0x18b692),console[_0x5c3b52(0x11b)](_0x5c3b52(0x154)+_0x13feeb),_0x471423&&console[_0x5c3b52(0x11b)](_0x5c3b52(0x129)+_0x26e3d8));const _0x190aa5=await withSpinner(_0x5c3b52(0x13d)+_0x18b692+_0x5c3b52(0x11e),()=>_0x5885a9['segment'][_0x5c3b52(0x139)](_0x18b692),{'verbose':_0x11fc33[_0x5c3b52(0x123)]}),_0x1c4957=_0x190aa5[_0x5c3b52(0x164)],{parentSegmentResult:_0x2b26cb,segmentsResult:_0x4c33fc,foldersResult:_0x3869d2,journeysWithDetailsResult:_0x3f1466,userMaps:_0x552c4a}=await withSpinner('Fetching\x20existing\x20data...',async()=>{const _0x46098f=_0x5c3b52,[_0x5c8e77,_0x2cdcb5,_0x54cb12,_0x1bf066,_0x4b4ec8]=await Promise[_0x46098f(0x12c)]([_0x5885a9[_0x46098f(0xf3)][_0x46098f(0x159)](_0x1c4957),_0x5885a9[_0x46098f(0xf3)][_0x46098f(0x167)](_0x1c4957),_0x5885a9[_0x46098f(0xf3)][_0x46098f(0x140)](_0x1c4957),_0x5885a9[_0x46098f(0xfb)]['listJourneysWithDetailsFromParentSegment'](_0x1c4957,{'includeAllVersions':!![]}),_0x5885a9['user']['buildUserMaps']()]);return{'parentSegmentResult':_0x5c8e77,'segmentsResult':_0x2cdcb5,'foldersResult':_0x54cb12,'journeysWithDetailsResult':_0x1bf066,'userMaps':_0x4b4ec8};},{'verbose':_0x11fc33[_0x5c3b52(0x123)]})[_0x5c3b52(0x183)](_0x615413=>_0x615413['data']),_0xf96e17=_0x2b26cb,_0x4bd8f0=extractRootFolderId(_0xf96e17),_0x301d8f=_0x4c33fc,_0x1183e2=_0x3869d2,{journeys:_0x3b9214,activationStepsById:_0x45af02}=_0x3f1466,_0x392ee9=new Map(_0x3b9214[_0x5c3b52(0x150)](_0x311c31=>[_0x311c31['id'],_0x311c31])),_0x27abcc=_0x3b9214['map'](_0x3503d2=>({'id':_0x3503d2['id'],'name':_0x3503d2[_0x5c3b52(0x14c)]['name'],'journeyBundleName':_0x3503d2[_0x5c3b52(0x14c)][_0x5c3b52(0x169)]||'','journeyBundleId':_0x3503d2[_0x5c3b52(0x14c)][_0x5c3b52(0x12b)]||'','versionNumber':_0x3503d2['attributes'][_0x5c3b52(0x171)],'description':_0x3503d2[_0x5c3b52(0x14c)][_0x5c3b52(0x126)],'state':_0x3503d2[_0x5c3b52(0x14c)][_0x5c3b52(0x16e)],'paused':_0x3503d2[_0x5c3b52(0x14c)]['paused'],'audienceId':_0x3503d2[_0x5c3b52(0x14c)][_0x5c3b52(0x147)],'folderId':_0x3503d2[_0x5c3b52(0x117)]?.[_0x5c3b52(0x165)]?.[_0x5c3b52(0x164)]?.['id'],'createdAt':_0x3503d2['attributes'][_0x5c3b52(0x172)],'updatedAt':_0x3503d2[_0x5c3b52(0x14c)][_0x5c3b52(0x16c)]})),{emailToId:_0x4729f1,idToEmail:_0x154aea}=_0x552c4a,_0x36a945=await withSpinner(_0x5c3b52(0x11f),async()=>{const _0x580f5f=_0x5c3b52,_0x4699bd=await _0x5885a9['connection'][_0x580f5f(0x138)]();return buildConnectionMaps(_0x4699bd);},{'verbose':_0x11fc33[_0x5c3b52(0x123)]})['then'](_0x1ee170=>_0x1ee170[_0x5c3b52(0x164)]),_0x464936=_0x36a945[_0x5c3b52(0x16b)],_0x284116=_0x36a945['idToName'],_0x3d6f19=_0x36a945[_0x5c3b52(0x10e)],_0x1fe579={'emailToIdMap':_0x4729f1,'connectionNameToIdMap':_0x464936,'connectionNameToTypeMap':_0x3d6f19,'getSchema':_0x3e7d27=>_0x5885a9['connection'][_0x5c3b52(0x102)](_0x3e7d27)};let {pathToId:_0x291dad,idToPath:_0x1aab53}=buildFolderMaps(_0x1183e2);const _0x3ee905=buildSegmentLookupMap(_0x301d8f,_0x1aab53),_0x3bcce0=buildSegmentNameToIdMap(_0x301d8f),_0x40e4ba=buildJourneyBundleLookupMap(_0x27abcc,_0x1aab53);let _0x30b92d;if(_0x28cdf0){if(!_0x28cdf0[_0x5c3b52(0x15b)]('.yml')&&!_0x28cdf0['endsWith']('.yaml'))return console[_0x5c3b52(0x11b)](a41_0x5d3ea3[_0x5c3b52(0x155)](_0x5c3b52(0x14d)+_0x28cdf0+'\x0a')),0x1;_0x30b92d=[_0x28cdf0];}else _0x30b92d=findYamlFiles(_0x13feeb);if(_0x30b92d[_0x5c3b52(0x166)]===0x0)return console['error'](a41_0x5d3ea3[_0x5c3b52(0x155)](_0x5c3b52(0xfc)+_0x13feeb+'\x0a')),console[_0x5c3b52(0x11b)](a41_0x5d3ea3['cyan'](_0x5c3b52(0x113))),0x1;let _0x2a6bb7,_0x5c517b;try{const _0x2d165b=parseAndClassifyYamlFiles(_0x30b92d,_0x13feeb,{'skipSegments':_0x11fc33[_0x5c3b52(0x121)]});_0x2a6bb7=_0x2d165b[_0x5c3b52(0xf5)],_0x5c517b=_0x2d165b[_0x5c3b52(0x17d)];const _0xa2a83c=validateParsedFiles(_0x2d165b,_0x13feeb);if(_0xa2a83c['length']>0x0)return console[_0x5c3b52(0x11b)](a41_0x5d3ea3[_0x5c3b52(0x155)]('\x0aValidation\x20failed:')),console[_0x5c3b52(0x11b)](formatValidationErrors(_0xa2a83c)),console[_0x5c3b52(0x11b)](a41_0x5d3ea3[_0x5c3b52(0xfd)](_0x5c3b52(0xf6))),0x1;}catch(_0x59505d){return console[_0x5c3b52(0x11b)](a41_0x5d3ea3[_0x5c3b52(0x155)](_0x5c3b52(0x116)+(_0x59505d instanceof Error?_0x59505d[_0x5c3b52(0x152)]:_0x59505d))),0x1;}if(_0x2a6bb7['length']===0x0&&_0x5c517b[_0x5c3b52(0x166)]===0x0){const _0x3203d8=_0x11fc33['journeysOnly']?_0x5c3b52(0xfb):'segment\x20or\x20journey';return console[_0x5c3b52(0x11b)](a41_0x5d3ea3[_0x5c3b52(0xfd)](_0x5c3b52(0xf4)+_0x3203d8+'\x20YAML\x20files\x20found')),0x0;}const _0x43c393=new Map();_0x301d8f[_0x5c3b52(0x166)]>0x0&&!_0x11fc33['journeysOnly']&&await withSpinner(_0x5c3b52(0x10d),async()=>{await batchAsync(_0x301d8f,async _0x574756=>{const _0x34cc43=a41_0x1be6,_0x2695fc=await _0x5885a9[_0x34cc43(0xf3)][_0x34cc43(0x145)](_0x1c4957,_0x574756['id']);_0x43c393[_0x34cc43(0x16a)](_0x574756['id'],_0x2695fc);});},{'verbose':_0x11fc33[_0x5c3b52(0x123)]});const {segmentFiles:_0x40f4b7,foldersToCreate:_0x32f96b}=await prepareSegmentFiles(_0x2a6bb7,{'segmentByFolderAndName':_0x3ee905,'activationsBySegmentId':_0x43c393,'folderPathToId':_0x291dad,'idToEmailMap':_0x154aea,'connectionIdToNameMap':_0x284116},_0x1fe579,_0x471423,_0x26e3d8),_0x4b90a3=_0x28cdf0?[]:findSegmentsToDelete(_0x301d8f,_0x2a6bb7[_0x5c3b52(0x150)](({yamlConfig:_0x149c08,folderPath:_0x320735})=>({'yamlConfig':_0x149c08,'folderPath':resolveTDFolderPath(_0x320735,_0x471423,_0x26e3d8)})),_0x1aab53,_0x26e3d8,_0x471423),{journeyFiles:_0x1baac3,foldersToCreate:_0x334b9a}=await withProgressSpinner('Preparing\x20journeys...',async _0x39e1f7=>prepareJourneyFiles(_0x5c517b,{'fetchJourney':async _0x34f47d=>_0x5885a9['journey'][_0x5c3b52(0xed)](_0x34f47d[_0x5c3b52(0x115)]),'journeyBundlesByFolderAndName':_0x40e4ba,'folderPathToId':_0x291dad,'idToEmailMap':_0x154aea,'connectionIdToNameMap':_0x284116,'existingSegments':_0x301d8f,'parentId':_0x1c4957,'deps':_0x5885a9,'progress':{'update':_0x14ad0e=>{const _0x4d18af=_0x5c3b52;_0x39e1f7[_0x4d18af(0x103)](_0x14ad0e),_0x11fc33[_0x4d18af(0x123)]&&console[_0x4d18af(0x11b)]('\x20\x20'+_0x14ad0e);}},'journeyById':_0x392ee9,'activationStepsById':_0x45af02},_0x471423,_0x26e3d8),{'verbose':_0x11fc33[_0x5c3b52(0x123)]})[_0x5c3b52(0x183)](_0x305f45=>_0x305f45[_0x5c3b52(0x164)]);for(const _0x21df85 of _0x334b9a){_0x32f96b[_0x5c3b52(0x124)](_0x21df85);}const _0x15b934=_0x28cdf0?[]:findJourneysToDelete(_0x27abcc,_0x5c517b['map'](({yamlConfig:_0x598ba6,folderPath:_0x5b4ca1})=>({'yamlConfig':_0x598ba6,'folderPath':resolveTDFolderPath(_0x5b4ca1,_0x471423,_0x26e3d8)})),_0x1aab53,_0x26e3d8,_0x471423),_0x5a7aa0=calculatePushStats(_0x40f4b7,_0x1baac3,_0x32f96b,_0x4b90a3,_0x15b934,!!_0x11fc33[_0x5c3b52(0x108)],!!_0x11fc33['journeysOnly']),_0x22c071=_0x5a7aa0[_0x5c3b52(0xf5)][_0x5c3b52(0x12a)],_0x33dde5=_0x5a7aa0['segments'][_0x5c3b52(0x10a)],_0x1a9c3e=_0x5a7aa0[_0x5c3b52(0xf5)]['unchanged'],_0x243bda=_0x5a7aa0[_0x5c3b52(0xf5)][_0x5c3b52(0x13b)],_0x30bf32=_0x5a7aa0[_0x5c3b52(0x15d)]['toCreate'],_0x59b2cf=_0x5a7aa0[_0x5c3b52(0x17d)][_0x5c3b52(0x12a)],_0x44bd35=_0x5a7aa0[_0x5c3b52(0x17d)]['changed'],_0x52f71a=_0x5a7aa0[_0x5c3b52(0x17d)][_0x5c3b52(0x11a)],_0xd87840=_0x5a7aa0['journeys']['toDelete'],_0x50268f=_0x5a7aa0['activations'][_0x5c3b52(0x12c)],_0x58b745=_0x5a7aa0['activations'][_0x5c3b52(0x186)],_0x2ae1c0=_0x5a7aa0[_0x5c3b52(0x176)][_0x5c3b52(0x141)],_0x26ff5d=_0x5a7aa0[_0x5c3b52(0x176)][_0x5c3b52(0x13b)];console[_0x5c3b52(0x11b)](_0x5c3b52(0x180)+_0x18b692+'\x27:');_0x30bf32[_0x5c3b52(0x166)]>0x0&&console[_0x5c3b52(0x11b)]('\x20\x20'+a41_0x5d3ea3[_0x5c3b52(0x156)](_0x5c3b52(0x16f)+_0x30bf32[_0x5c3b52(0x166)]+_0x5c3b52(0x101)));if(!_0x11fc33[_0x5c3b52(0x121)]){console[_0x5c3b52(0x11b)]('\x20\x20📊\x20Segments:'),console[_0x5c3b52(0x11b)](_0x5c3b52(0x15a)+a41_0x5d3ea3[_0x5c3b52(0x12f)]('+\x20'+_0x22c071[_0x5c3b52(0x166)]+_0x5c3b52(0x170))),console['error']('\x20\x20\x20\x20'+a41_0x5d3ea3[_0x5c3b52(0xfd)]('~\x20'+_0x33dde5['length']+'\x20changed'));if(_0x243bda[_0x5c3b52(0x166)]>0x0)console[_0x5c3b52(0x11b)](_0x5c3b52(0x15a)+a41_0x5d3ea3[_0x5c3b52(0x155)]('-\x20'+_0x243bda[_0x5c3b52(0x166)]+_0x5c3b52(0x107)));else _0x4b90a3[_0x5c3b52(0x166)]>0x0&&!_0x11fc33[_0x5c3b52(0x108)]&&console['error'](_0x5c3b52(0x15a)+a41_0x5d3ea3[_0x5c3b52(0x109)](_0x4b90a3[_0x5c3b52(0x166)]+_0x5c3b52(0x185)));console[_0x5c3b52(0x11b)](_0x5c3b52(0x15a)+a41_0x5d3ea3['dim']('=\x20'+_0x1a9c3e[_0x5c3b52(0x166)]+_0x5c3b52(0x137)));}if(_0x1baac3[_0x5c3b52(0x166)]>0x0||_0x15b934['length']>0x0){console['error'](_0x5c3b52(0x14a)),console[_0x5c3b52(0x11b)](_0x5c3b52(0x15a)+a41_0x5d3ea3[_0x5c3b52(0x12f)]('+\x20'+_0x59b2cf[_0x5c3b52(0x166)]+_0x5c3b52(0x170))),console[_0x5c3b52(0x11b)](_0x5c3b52(0x15a)+a41_0x5d3ea3[_0x5c3b52(0xfd)]('~\x20'+_0x44bd35[_0x5c3b52(0x166)]+_0x5c3b52(0x188)));if(_0xd87840[_0x5c3b52(0x166)]>0x0)console[_0x5c3b52(0x11b)](_0x5c3b52(0x15a)+a41_0x5d3ea3['red']('-\x20'+_0xd87840['length']+_0x5c3b52(0x107)));else _0x15b934[_0x5c3b52(0x166)]>0x0&&!_0x11fc33[_0x5c3b52(0x108)]&&console[_0x5c3b52(0x11b)](_0x5c3b52(0x15a)+a41_0x5d3ea3[_0x5c3b52(0x109)](_0x15b934[_0x5c3b52(0x166)]+_0x5c3b52(0x185)));console[_0x5c3b52(0x11b)]('\x20\x20\x20\x20'+a41_0x5d3ea3[_0x5c3b52(0x109)]('=\x20'+_0x52f71a['length']+'\x20unchanged'));}_0x50268f[_0x5c3b52(0x166)]>0x0&&!_0x11fc33['journeysOnly']&&(console[_0x5c3b52(0x11b)](''),console[_0x5c3b52(0x11b)](_0x5c3b52(0x142)),_0x58b745[_0x5c3b52(0x166)]>0x0&&console['error'](_0x5c3b52(0x15a)+a41_0x5d3ea3[_0x5c3b52(0x12f)]('+\x20'+_0x58b745[_0x5c3b52(0x166)]+_0x5c3b52(0x11c))),_0x2ae1c0[_0x5c3b52(0x166)]>0x0&&console[_0x5c3b52(0x11b)](_0x5c3b52(0x15a)+a41_0x5d3ea3['yellow']('~\x20'+_0x2ae1c0[_0x5c3b52(0x166)]+'\x20to\x20update')),_0x26ff5d[_0x5c3b52(0x166)]>0x0&&console[_0x5c3b52(0x11b)](_0x5c3b52(0x15a)+a41_0x5d3ea3[_0x5c3b52(0x155)]('-\x20'+_0x26ff5d[_0x5c3b52(0x166)]+_0x5c3b52(0x107))));console[_0x5c3b52(0x11b)](_0x5c3b52(0xff)+a41_0x5d3ea3[_0x5c3b52(0x15e)](_0x13feeb)+'\x0a');if(_0x30bf32[_0x5c3b52(0x166)]>0x0){console['error'](_0x5c3b52(0x177));for(const _0x71a539 of _0x30bf32){console[_0x5c3b52(0x11b)]('\x20\x20'+a41_0x5d3ea3[_0x5c3b52(0x156)]('+')+'\x20'+_0x71a539);}console[_0x5c3b52(0x11b)]('');}if(_0x22c071[_0x5c3b52(0x166)]>0x0&&!_0x11fc33['journeysOnly'])for(const _0x1b5b3e of _0x22c071){const _0x3bff8e=_0x1b5b3e[_0x5c3b52(0x100)]?_0x1b5b3e[_0x5c3b52(0x100)]+'/'+_0x1b5b3e[_0x5c3b52(0x133)][_0x5c3b52(0x12e)]:_0x1b5b3e[_0x5c3b52(0x133)][_0x5c3b52(0x12e)],_0x230be0=_0x1b5b3e[_0x5c3b52(0x133)][_0x5c3b52(0x176)]?.[_0x5c3b52(0x166)]||0x0,_0x1a1ae5=_0x230be0>0x0?a41_0x5d3ea3[_0x5c3b52(0x109)]('\x20['+_0x230be0+'\x20activations]'):'';console[_0x5c3b52(0x11b)]('\x0a'+a41_0x5d3ea3[_0x5c3b52(0x12f)](_0x5c3b52(0x151))+'\x20'+_0x3bff8e+_0x1a1ae5),console[_0x5c3b52(0x11b)]('─'[_0x5c3b52(0x175)](0x3c)),_0x1b5b3e[_0x5c3b52(0x14b)]&&console[_0x5c3b52(0x11b)](_0x1b5b3e[_0x5c3b52(0x14b)]),console[_0x5c3b52(0x11b)]('─'['repeat'](0x3c));}if(_0x243bda[_0x5c3b52(0x166)]>0x0&&!_0x11fc33[_0x5c3b52(0x121)])for(const _0x2ae467 of _0x243bda){const _0x54e759=_0x2ae467[_0x5c3b52(0xec)]?_0x1aab53['get'](_0x2ae467[_0x5c3b52(0xec)][_0x5c3b52(0x119)]())||'':'',_0x693c7=_0x54e759?_0x54e759+'/'+_0x2ae467[_0x5c3b52(0x12e)]:_0x2ae467[_0x5c3b52(0x12e)],_0x389005=_0x43c393[_0x5c3b52(0xef)](_0x2ae467['id'])||[],_0x5ef8be=_0x389005[_0x5c3b52(0x166)]>0x0?a41_0x5d3ea3[_0x5c3b52(0x109)]('\x20['+_0x389005['length']+_0x5c3b52(0xf0)):'';console[_0x5c3b52(0x11b)]('\x0a'+a41_0x5d3ea3[_0x5c3b52(0x155)](_0x5c3b52(0xfa))+'\x20'+_0x693c7+_0x5ef8be),console[_0x5c3b52(0x11b)]('─'[_0x5c3b52(0x175)](0x3c));const _0x242614=segmentWithActivationsToYaml(_0x2ae467,_0x389005,undefined,_0x154aea,_0x284116),_0x475fd7=segmentToYamlString(_0x242614),_0x37071d=generateDiff(_0x475fd7,'');console[_0x5c3b52(0x11b)](formatDiffWithColors(_0x37071d)),console[_0x5c3b52(0x11b)]('─'[_0x5c3b52(0x175)](0x3c));}const _0x792b48=_0x40f4b7[_0x5c3b52(0x131)](_0x5561ee=>!_0x5561ee[_0x5c3b52(0x158)]&&_0x5561ee[_0x5c3b52(0x14b)]);if(_0x792b48[_0x5c3b52(0x166)]>0x0&&!_0x11fc33['journeysOnly'])for(const _0x2e7229 of _0x792b48){const _0x5d6cb5=_0x2e7229[_0x5c3b52(0x100)]?_0x2e7229[_0x5c3b52(0x100)]+'/'+_0x2e7229[_0x5c3b52(0x133)][_0x5c3b52(0x12e)]:_0x2e7229[_0x5c3b52(0x133)][_0x5c3b52(0x12e)];console[_0x5c3b52(0x11b)]('\x0a'+a41_0x5d3ea3[_0x5c3b52(0xfd)](_0x5c3b52(0x15f))+'\x20'+_0x5d6cb5),console[_0x5c3b52(0x11b)]('─'[_0x5c3b52(0x175)](0x3c)),console[_0x5c3b52(0x11b)](_0x2e7229['diff']),console['error']('─'['repeat'](0x3c));}if(_0x59b2cf[_0x5c3b52(0x166)]>0x0)for(const _0x1a4d84 of _0x59b2cf){const _0x44224f=_0x1a4d84[_0x5c3b52(0x100)]?_0x1a4d84[_0x5c3b52(0x100)]+'/'+_0x1a4d84['yamlConfig']['name']:_0x1a4d84[_0x5c3b52(0x133)][_0x5c3b52(0x12e)];console[_0x5c3b52(0x11b)]('\x0a'+a41_0x5d3ea3['green']('New\x20journey:')+'\x20'+_0x44224f),console['error']('─'['repeat'](0x3c)),_0x1a4d84[_0x5c3b52(0x14b)]&&console['error'](_0x1a4d84[_0x5c3b52(0x14b)]),console[_0x5c3b52(0x11b)]('─'[_0x5c3b52(0x175)](0x3c));}const _0x1e6cf5=_0x1baac3[_0x5c3b52(0x131)](_0x1ea40d=>!_0x1ea40d['isNew']&&_0x1ea40d[_0x5c3b52(0x14b)]);if(_0x1e6cf5['length']>0x0)for(const _0xc49036 of _0x1e6cf5){const _0x9f8879=_0xc49036[_0x5c3b52(0x100)]?_0xc49036[_0x5c3b52(0x100)]+'/'+_0xc49036[_0x5c3b52(0x133)]['name']:_0xc49036[_0x5c3b52(0x133)]['name'];console['error']('\x0a'+a41_0x5d3ea3[_0x5c3b52(0xfd)](_0x5c3b52(0x10b))+'\x20'+_0x9f8879),console[_0x5c3b52(0x11b)]('─'[_0x5c3b52(0x175)](0x3c)),console[_0x5c3b52(0x11b)](_0xc49036[_0x5c3b52(0x14b)]),console['error']('─'[_0x5c3b52(0x175)](0x3c));}if(_0xd87840['length']>0x0)for(const _0x4a69d1 of _0xd87840){const _0x30963a=_0x4a69d1[_0x5c3b52(0x110)]?_0x1aab53[_0x5c3b52(0xef)](_0x4a69d1[_0x5c3b52(0x110)])||'':'',_0x439a18=_0x30963a?_0x30963a+'/'+_0x4a69d1[_0x5c3b52(0x169)]:_0x4a69d1['journeyBundleName'];console['error']('\x0a'+a41_0x5d3ea3['red'](_0x5c3b52(0x160))+'\x20'+_0x439a18),console[_0x5c3b52(0x11b)]('─'[_0x5c3b52(0x175)](0x3c)),console[_0x5c3b52(0x11b)](a41_0x5d3ea3['red'](_0x5c3b52(0xfe))),console[_0x5c3b52(0x11b)]('─'['repeat'](0x3c));}if(_0x11fc33['dryRun'])return console[_0x5c3b52(0x11b)](a41_0x5d3ea3['yellow']('\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made')),0x0;const _0x1c690c=_0x11fc33['journeysOnly']?![]:_0x22c071[_0x5c3b52(0x166)]>0x0||_0x33dde5[_0x5c3b52(0x166)]>0x0||_0x243bda[_0x5c3b52(0x166)]>0x0,_0x35fef9=_0x59b2cf[_0x5c3b52(0x166)]>0x0||_0x44bd35[_0x5c3b52(0x166)]>0x0||_0xd87840[_0x5c3b52(0x166)]>0x0,_0x581bcd=_0x11fc33['journeysOnly']?![]:_0x50268f[_0x5c3b52(0x166)]>0x0,_0x40e71d=_0x30bf32[_0x5c3b52(0x166)]>0x0;if(!_0x1c690c&&!_0x35fef9&&!_0x581bcd&&!_0x40e71d){const _0x48c4de=_0x11fc33[_0x5c3b52(0x121)]?_0x5c3b52(0x10f):_0x5c3b52(0x104);console[_0x5c3b52(0x11b)](a41_0x5d3ea3[_0x5c3b52(0x12f)](_0x48c4de));if(_0x28cdf0&&_0x1a9c3e['length']===0x1){const _0x4e6872=_0x1a9c3e[0x0];if(_0x4e6872[_0x5c3b52(0x15c)]?.['id']){const _0x220a36=getConsoleNextUrl(_0x11fc33['site'],_0x5c3b52(0x17b)+_0x1c4957+_0x5c3b52(0x17c)+_0x4e6872[_0x5c3b52(0x15c)]['id']+'/sb/da/esr');console[_0x5c3b52(0x11b)](_0x5c3b52(0x187)+a41_0x5d3ea3[_0x5c3b52(0x15e)](_0x220a36));}}if(_0x28cdf0&&_0x52f71a[_0x5c3b52(0x166)]===0x1){const _0x580ba9=_0x52f71a[0x0];if(_0x580ba9[_0x5c3b52(0xee)]?.['id']){const _0x3a5f5b=getConsoleNextUrl(_0x11fc33[_0x5c3b52(0x168)],'/app/ps/'+_0x1c4957+_0x5c3b52(0x17c)+_0x580ba9[_0x5c3b52(0xee)]['id']+_0x5c3b52(0x105));console[_0x5c3b52(0x11b)]('\x20\x20'+a41_0x5d3ea3[_0x5c3b52(0x15e)](_0x3a5f5b));}}return 0x0;}const _0x3b9fc3=_0x11fc33[_0x5c3b52(0x121)]?_0x59b2cf[_0x5c3b52(0x166)]+_0x44bd35[_0x5c3b52(0x166)]+_0xd87840[_0x5c3b52(0x166)]+_0x30bf32[_0x5c3b52(0x166)]:_0x22c071[_0x5c3b52(0x166)]+_0x33dde5[_0x5c3b52(0x166)]+_0x243bda[_0x5c3b52(0x166)]+_0x59b2cf[_0x5c3b52(0x166)]+_0x44bd35['length']+_0xd87840[_0x5c3b52(0x166)]+_0x30bf32[_0x5c3b52(0x166)]+_0x50268f['length'];if(!_0x11fc33['yes']&&_0x3b9fc3>0x0){if(!isInteractive())return console[_0x5c3b52(0x11b)](a41_0x5d3ea3[_0x5c3b52(0x155)](_0x5c3b52(0x148)),_0x5c3b52(0x130)),console[_0x5c3b52(0x11b)](a41_0x5d3ea3['dim'](_0x5c3b52(0x162))),0x1;const _0x446b44=await confirmKey('Push\x20'+_0x3b9fc3+_0x5c3b52(0x14f));if(!_0x446b44)return console[_0x5c3b52(0x11b)](a41_0x5d3ea3['yellow']('Aborted.')),0x1;}const _0x57c78f={'withProgress':async(_0x49bbc3,_0x3ee478)=>{const _0x2748da=_0x5c3b52,_0x2808a7=await withSpinner(_0x49bbc3,_0x3ee478,{'verbose':_0x11fc33[_0x2748da(0x123)]});return{'data':_0x2808a7[_0x2748da(0x164)]};},'logInfo':_0x3cfbc1=>console['error'](a41_0x5d3ea3[_0x5c3b52(0x156)]('✔\x20'+_0x3cfbc1)),'logSuccess':_0x40e68e=>console[_0x5c3b52(0x11b)](a41_0x5d3ea3[_0x5c3b52(0x12f)]('✔\x20'+_0x40e68e)),'logWarning':_0x5d49c4=>console[_0x5c3b52(0x11b)](a41_0x5d3ea3[_0x5c3b52(0xfd)]('⚠\x20'+_0x5d49c4)),'logDeleted':_0x92dfdc=>console['error'](a41_0x5d3ea3[_0x5c3b52(0x155)]('✔\x20'+_0x92dfdc))},_0x29489b={'segment':_0x5885a9[_0x5c3b52(0xf3)],'journey':_0x5885a9[_0x5c3b52(0xfb)],'user':_0x5885a9[_0x5c3b52(0x178)],'connection':_0x5885a9['connection']};_0x30bf32[_0x5c3b52(0x166)]>0x0&&(_0x291dad=await executePushFolders(_0x29489b,_0x30bf32,_0x291dad,{'parentId':_0x1c4957},_0x57c78f));const _0x58694c={'rootFolderId':_0x4bd8f0,'folderPathToId':_0x291dad,'folderIdToPath':_0x1aab53,'segmentNameToId':_0x3bcce0,'activationsBySegmentId':_0x43c393,'emailToIdMap':_0x4729f1,'idToEmailMap':_0x154aea,'connectionNameToIdMap':_0x36a945[_0x5c3b52(0x16b)],'connectionIdToNameMap':_0x36a945[_0x5c3b52(0x136)],'connectionNameToTypeMap':_0x3d6f19},_0xe23928=await executePushSegments(_0x29489b,_0x11fc33[_0x5c3b52(0x121)]?[]:_0x40f4b7,_0x58694c,{'parentId':_0x1c4957},_0x57c78f),_0x3e07c3=_0xe23928[_0x5c3b52(0x132)],_0x5539f6=_0xe23928['updated'],_0x1feb17=_0xe23928[_0x5c3b52(0x176)]['created'],_0x5e98dc=_0xe23928[_0x5c3b52(0x176)][_0x5c3b52(0x11d)],_0x3508f8=_0xe23928[_0x5c3b52(0x176)]['deleted'];let _0x7b2a4f;if(_0x28cdf0&&_0x40f4b7[_0x5c3b52(0x166)]===0x1){const _0x4bc7b5=_0x40f4b7[0x0];_0x7b2a4f=_0x4bc7b5[_0x5c3b52(0x15c)]?.['id']??_0xe23928[_0x5c3b52(0x13a)][_0x5c3b52(0xef)](_0x4bc7b5[_0x5c3b52(0x133)]['name']);}const _0x110998=await executePushSegmentDeletions(_0x29489b,_0x11fc33['journeysOnly']?[]:_0x243bda,_0x57c78f);let _0xa7cc9e=0x0,_0x3a4fa4=0x0,_0x411035=0x0;const _0x1f7b94=new Map(_0x3bcce0);for(const [_0x4bcd8b,_0x4adec0]of _0xe23928[_0x5c3b52(0x13a)]){_0x1f7b94[_0x5c3b52(0x16a)](_0x4bcd8b,_0x4adec0);}if(_0x1baac3[_0x5c3b52(0x166)]>0x0){const _0x145995={..._0x58694c,'segmentNameToId':_0x1f7b94,'existingSegments':_0x301d8f,'activationContext':_0x1fe579},_0x5785bd=await executePushJourneys(_0x29489b,_0x1baac3,_0x145995,{'parentId':_0x1c4957,'rootFolderId':_0x4bd8f0,'verbose':_0x11fc33[_0x5c3b52(0x123)]},_0x57c78f);_0xa7cc9e=_0x5785bd['created'],_0x3a4fa4=_0x5785bd[_0x5c3b52(0x11d)];if(_0x28cdf0&&_0x5785bd[_0x5c3b52(0x17e)][_0x5c3b52(0x166)]===0x1){const _0x4eaec1=_0x5785bd['results'][0x0];if(_0x4eaec1[_0x5c3b52(0x115)]){const _0x866b63=getConsoleNextUrl(_0x11fc33[_0x5c3b52(0x168)],'/app/ps/'+_0x1c4957+_0x5c3b52(0x17c)+_0x4eaec1[_0x5c3b52(0x115)]+_0x5c3b52(0x105));console['error']('\x20\x20'+a41_0x5d3ea3[_0x5c3b52(0x15e)](_0x866b63));}}}for(const _0x28a73f of _0xd87840){console['error'](a41_0x5d3ea3[_0x5c3b52(0xfd)](_0x5c3b52(0x134)+_0x28a73f[_0x5c3b52(0x169)])),_0x411035++;}const _0x4cc74b=[];if(_0x3e07c3>0x0)_0x4cc74b[_0x5c3b52(0xf2)](_0x3e07c3+_0x5c3b52(0x13e));if(_0x5539f6>0x0)_0x4cc74b[_0x5c3b52(0xf2)](_0x5539f6+_0x5c3b52(0x118));if(_0x110998>0x0)_0x4cc74b[_0x5c3b52(0xf2)](_0x110998+_0x5c3b52(0xf8));const _0xd50048=[];if(_0xa7cc9e>0x0)_0xd50048[_0x5c3b52(0xf2)](_0xa7cc9e+'\x20created');if(_0x3a4fa4>0x0)_0xd50048[_0x5c3b52(0xf2)](_0x3a4fa4+_0x5c3b52(0x118));if(_0x411035>0x0)_0xd50048[_0x5c3b52(0xf2)](_0x411035+_0x5c3b52(0xf8));const _0x41722e=[];if(_0x1feb17>0x0)_0x41722e[_0x5c3b52(0xf2)](_0x1feb17+_0x5c3b52(0x13e));if(_0x5e98dc>0x0)_0x41722e[_0x5c3b52(0xf2)](_0x5e98dc+_0x5c3b52(0x118));if(_0x3508f8>0x0)_0x41722e['push'](_0x3508f8+_0x5c3b52(0xf8));console[_0x5c3b52(0x11b)](a41_0x5d3ea3[_0x5c3b52(0x12f)](_0x5c3b52(0x16d)));_0x4cc74b['length']>0x0&&!_0x11fc33[_0x5c3b52(0x121)]&&console['error'](_0x5c3b52(0x17a)+_0x4cc74b[_0x5c3b52(0x128)](',\x20'));_0xd50048[_0x5c3b52(0x166)]>0x0&&console['error'](_0x5c3b52(0x114)+_0xd50048[_0x5c3b52(0x128)](',\x20'));_0x41722e['length']>0x0&&!_0x11fc33['journeysOnly']&&console[_0x5c3b52(0x11b)](_0x5c3b52(0x112)+_0x41722e[_0x5c3b52(0x128)](',\x20'));if(_0x7b2a4f){const _0x5a15f4=getConsoleNextUrl(_0x11fc33[_0x5c3b52(0x168)],'/app/ps/'+_0x1c4957+_0x5c3b52(0x17c)+_0x7b2a4f+_0x5c3b52(0x13f));console['error'](_0x5c3b52(0x187)+a41_0x5d3ea3[_0x5c3b52(0x15e)](_0x5a15f4));}return 0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a42_0x54f4a3=a42_0x28b2;(function(_0x2284c1,_0x2c7e68){const _0x2ed59c=a42_0x28b2,_0x252016=_0x2284c1();while(!![]){try{const _0x2d6ed7=parseInt(_0x2ed59c(0x1ea))/0x1*(parseInt(_0x2ed59c(0x1f0))/0x2)+parseInt(_0x2ed59c(0x1f1))/0x3+-parseInt(_0x2ed59c(0x1ed))/0x4+-parseInt(_0x2ed59c(0x1f7))/0x5*(parseInt(_0x2ed59c(0x1e3))/0x6)+-parseInt(_0x2ed59c(0x1c9))/0x7+parseInt(_0x2ed59c(0x1f3))/0x8*(-parseInt(_0x2ed59c(0x1de))/0x9)+-parseInt(_0x2ed59c(0x1d7))/0xa*(-parseInt(_0x2ed59c(0x1d1))/0xb);if(_0x2d6ed7===_0x2c7e68)break;else _0x252016['push'](_0x252016['shift']());}catch(_0x6772e9){_0x252016['push'](_0x252016['shift']());}}}(a42_0x31c7,0xf046a));import{BaseCommand}from'./command.js';function a42_0x28b2(_0x3c9826,_0x5342ea){_0x3c9826=_0x3c9826-0x1c6;const _0x31c7b1=a42_0x31c7();let _0x28b26b=_0x31c7b1[_0x3c9826];return _0x28b26b;}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{SDKError,ErrorCode}from'../sdk/index.js';import a42_0x28f56b from'chalk';function a42_0x31c7(){const _0x2cd0e6=['13315617gzzrIE','Segment\x20ID\x20missing\x20from\x20resolved\x20path','⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.','Segment\x20ID:\x20','type','segmentId','Examples:','\x20\x20\x20Path:\x20','99TKVfBH','Parent\x20ID:\x20','name','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Resolving\x20folder\x20\x27','yellow','5173400bMWiuZ','resolvePathToResource','Updating\x20segment\x20\x27','execute','Error:\x20Cannot\x20update\x20','Resolved\x20relative\x20path\x20to:\x20','resolveFolderId','9QSYVao','description','includes','\x27...','rule','1671006aivNgr','kind','folder','segment','segment:update','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','1IgXqkO','ruleFile','Resolving\x20path\x20\x27','2428860IxZScf','error','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','550166CnjbLk','4055169AtdYYt','Resolved\x20folder\x20ID:\x20','15629976PrVXMK','length','verbose','data','15cAvQyg','Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','✔\x20Updated\x20segment\x20\x27'];a42_0x31c7=function(){return _0x2cd0e6;};return a42_0x31c7();}export class SegmentUpdateCommand extends BaseCommand{['name']=a42_0x54f4a3(0x1e7);[a42_0x54f4a3(0x1df)]='Update\x20existing\x20child\x20segment';async[a42_0x54f4a3(0x1da)](_0x303db8){const _0x4f9131=a42_0x54f4a3;console['error'](a42_0x28f56b['yellow'](_0x4f9131(0x1cb))),console['error'](a42_0x28f56b[_0x4f9131(0x1d6)](_0x4f9131(0x1d4)));const {options:_0x399503,args:_0xa172e5,tdx:_0x17a250}=_0x303db8,_0x2deab7=_0x399503;if(_0xa172e5[_0x4f9131(0x1f4)]===0x0)return console[_0x4f9131(0x1ee)](_0x4f9131(0x1e8)),console[_0x4f9131(0x1ee)]('Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]'),console[_0x4f9131(0x1ee)](_0x4f9131(0x1cf)),console[_0x4f9131(0x1ee)](_0x4f9131(0x1e9)),console[_0x4f9131(0x1ee)](_0x4f9131(0x1c7)),0x1;const _0x550726=_0xa172e5[0x0],_0x56219e=_0x399503['segmentPath'];let _0x59e817=_0x550726;_0x56219e&&!_0x550726[_0x4f9131(0x1e0)]('/')&&(_0x59e817=_0x56219e+'/'+_0x550726,_0x2deab7[_0x4f9131(0x1f5)]&&console[_0x4f9131(0x1ee)](_0x4f9131(0x1dc)+_0x59e817));const _0x6aae3c=await withSpinner(_0x4f9131(0x1ec)+_0x59e817+_0x4f9131(0x1e1),()=>_0x17a250[_0x4f9131(0x1e6)][_0x4f9131(0x1d8)](_0x59e817),{'verbose':_0x2deab7[_0x4f9131(0x1f5)]}),_0x4a0e19=_0x6aae3c[_0x4f9131(0x1f6)];_0x2deab7[_0x4f9131(0x1f5)]&&console[_0x4f9131(0x1ee)]('Resolved\x20type:\x20'+_0x4a0e19['type']);if(_0x4a0e19[_0x4f9131(0x1cd)]!=='segment')return console[_0x4f9131(0x1ee)](_0x4f9131(0x1db)+_0x4a0e19[_0x4f9131(0x1cd)]+_0x4f9131(0x1ef)),console[_0x4f9131(0x1ee)](_0x4f9131(0x1c6)),0x1;if(!_0x4a0e19[_0x4f9131(0x1ce)])throw new SDKError(ErrorCode['INTERNAL'],_0x4f9131(0x1ca));const _0x137fca=_0x4a0e19['parentId'],_0x13b7ab=_0x4a0e19[_0x4f9131(0x1ce)];_0x2deab7[_0x4f9131(0x1f5)]&&(console[_0x4f9131(0x1ee)](_0x4f9131(0x1d2)+_0x137fca),console[_0x4f9131(0x1ee)](_0x4f9131(0x1cc)+_0x13b7ab));let _0x1bdc7f;if(_0x2deab7[_0x4f9131(0x1e5)]){const _0x27487b=_0x2deab7[_0x4f9131(0x1e5)],_0x2236a3=await withSpinner(_0x4f9131(0x1d5)+_0x27487b+_0x4f9131(0x1e1),()=>_0x17a250[_0x4f9131(0x1e6)][_0x4f9131(0x1dd)](_0x137fca,_0x27487b),{'verbose':_0x2deab7[_0x4f9131(0x1f5)]});_0x1bdc7f=parseInt(_0x2236a3['data'],0xa),_0x2deab7[_0x4f9131(0x1f5)]&&console[_0x4f9131(0x1ee)](_0x4f9131(0x1f2)+_0x1bdc7f);}const _0x57ea0f=await loadJSONFromOptions(_0x2deab7[_0x4f9131(0x1e2)],_0x2deab7[_0x4f9131(0x1eb)]),_0x35aa94={'name':_0x2deab7[_0x4f9131(0x1d3)],'description':_0x2deab7[_0x4f9131(0x1df)],'rule':_0x57ea0f,'kind':_0x2deab7[_0x4f9131(0x1e4)]!==undefined?parseInt(_0x2deab7['kind'],0xa):undefined,'segmentFolderId':_0x1bdc7f},_0x4bb205=await withSpinner(_0x4f9131(0x1d9)+_0x4a0e19['segmentName']+'\x27...',()=>_0x17a250[_0x4f9131(0x1e6)]['updateSegmentById'](_0x137fca,_0x13b7ab,_0x35aa94),{'verbose':_0x2deab7['verbose']}),_0x4a8a3f=_0x4bb205[_0x4f9131(0x1f6)];return console[_0x4f9131(0x1ee)](_0x4f9131(0x1c8)+_0x4a8a3f[_0x4f9131(0x1d3)]+'\x27'),_0x59e817!==_0x550726&&console[_0x4f9131(0x1ee)](_0x4f9131(0x1d0)+_0x59e817),await handleSDKOutput([_0x4a8a3f],_0x2deab7),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a43_0x21e73f=a43_0x28b0;(function(_0x3926f5,_0x5d5d3d){const _0x279552=a43_0x28b0,_0x3bbb34=_0x3926f5();while(!![]){try{const _0x5ebd57=parseInt(_0x279552(0x11a))/0x1+parseInt(_0x279552(0x114))/0x2+parseInt(_0x279552(0xe3))/0x3+parseInt(_0x279552(0x104))/0x4*(parseInt(_0x279552(0x11b))/0x5)+parseInt(_0x279552(0x113))/0x6*(parseInt(_0x279552(0x111))/0x7)+-parseInt(_0x279552(0x105))/0x8*(-parseInt(_0x279552(0xf6))/0x9)+-parseInt(_0x279552(0x107))/0xa;if(_0x5ebd57===_0x5d5d3d)break;else _0x3bbb34['push'](_0x3bbb34['shift']());}catch(_0x5b01a1){_0x3bbb34['push'](_0x3bbb34['shift']());}}}(a43_0x3b1d,0xb2e0c));import{existsSync,statSync}from'fs';import a43_0x3d61c9 from'chalk';import{BaseCommand}from'./command.js';function a43_0x28b0(_0x513d29,_0x930101){_0x513d29=_0x513d29-0xe3;const _0x3b1d94=a43_0x3b1d();let _0x28b0e7=_0x3b1d94[_0x513d29];return _0x28b0e7;}import{saveSessionContext}from'../core/session.js';import{withSpinner}from'../utils/spinner.js';import{parsePath,normalizePath}from'../sdk/segment/segment-path-parser.js';function a43_0x3b1d(){const _0x282f40=['703773UKBgLf','join','18XVJwPs','2645576GCMSuU','length','Resolving\x20path\x20\x27','segments','dim','resolvePathToResource','992397zPrrpo','2715310CrtNed','log','2898228sOxWrA','slice','type','split','\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent','folderPath','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','folderId','parent_segment','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','isDirectory','Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>','parentName','cyan','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','parentId','data','Use\x20\x22tdx\x20use\x22\x20to\x20see\x20all\x20context\x20parameters','session','9800550PxVBrL','name','fullPath','Error:\x20Path\x20is\x20required\x0a','Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context','Set\x20current\x20segment/folder\x20context\x20for\x20navigation','\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context','Usage:\x20tdx\x20segment\x20use\x20<path>','Resolved\x20relative\x20path\x20to:\x20','red','green','error','Resolved\x20path\x20type:\x20','Examples:','8XKqkDd','8AQKhJx','Site:\x20','50252680iljgMp','segment','Folder\x20ID:\x20','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22','✔\x20Context\x20set\x20to:\x20','execute','verbose','site','Target\x20path:\x20'];a43_0x3b1d=function(){return _0x282f40;};return a43_0x3b1d();}import{findTdxConfig}from'../sdk/segment/tdx-config.js';export class SegmentUseCommand extends BaseCommand{[a43_0x21e73f(0xf7)]='segment:use';['description']=a43_0x21e73f(0xfb);async[a43_0x21e73f(0x10d)](_0x1567a5){const _0x2dccc0=a43_0x21e73f,{options:_0x276b63,args:_0x1d3ebd,tdx:_0x4a3e77}=_0x1567a5;if(_0x1d3ebd[_0x2dccc0(0x115)]===0x0)return console['error'](a43_0x3d61c9[_0x2dccc0(0xff)](_0x2dccc0(0xf9))),console[_0x2dccc0(0x101)](_0x2dccc0(0xfd)),console[_0x2dccc0(0x101)](_0x2dccc0(0x103)),console[_0x2dccc0(0x101)](_0x2dccc0(0xe9)),console[_0x2dccc0(0x101)](_0x2dccc0(0x10b)),console[_0x2dccc0(0x101)](_0x2dccc0(0xfc)),console['error'](_0x2dccc0(0xe7)),0x1;const _0x4df313=_0x1d3ebd[0x0],_0x2ff9ec=_0x276b63[_0x2dccc0(0xf5)];try{if(_0x4df313==='/')return saveSessionContext({'segment_path':undefined},_0x2ff9ec),console[_0x2dccc0(0x11c)](a43_0x3d61c9['green'](_0x2dccc0(0x10a))),0x0;if(existsSync(_0x4df313)&&statSync(_0x4df313)[_0x2dccc0(0xed)]()){let _0x1ab9c8;try{_0x1ab9c8=findTdxConfig(_0x4df313);}catch{return console[_0x2dccc0(0x101)](a43_0x3d61c9[_0x2dccc0(0xff)](_0x2dccc0(0xf1)+_0x4df313)),console['error'](a43_0x3d61c9[_0x2dccc0(0xf0)](_0x2dccc0(0xec))),0x1;}const _0x1afc8b=_0x1ab9c8['config'][_0x2dccc0(0xeb)];return saveSessionContext({'segment_path':_0x1afc8b,'parent_segment':_0x1afc8b},_0x2ff9ec),console[_0x2dccc0(0x11c)](a43_0x3d61c9[_0x2dccc0(0x100)]('✔\x20Context\x20set\x20to:\x20'+a43_0x3d61c9[_0x2dccc0(0xf0)](_0x1afc8b))),0x0;}const _0x17d2fa=_0x276b63['segmentPath'];let _0x47e213=_0x4df313;const _0x26d36c=parsePath(_0x4df313);if(!_0x26d36c['isAbsolute']){if(!_0x17d2fa)return console[_0x2dccc0(0x101)](a43_0x3d61c9[_0x2dccc0(0xff)]('Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.')),console[_0x2dccc0(0x101)](a43_0x3d61c9[_0x2dccc0(0xf0)](_0x2dccc0(0xee))),0x1;if(_0x4df313==='..'){const _0xbd16bf=_0x17d2fa[_0x2dccc0(0xe6)]('/')[_0x2dccc0(0xe4)](0x0,-0x1)[_0x2dccc0(0x112)]('/');_0x47e213=_0xbd16bf||'/';}else _0x4df313==='.'?_0x47e213=_0x17d2fa:_0x47e213=_0x17d2fa+'/'+_0x4df313;_0x276b63['verbose']&&console[_0x2dccc0(0x101)](_0x2dccc0(0xfe)+_0x47e213);}if(_0x47e213==='/'||_0x47e213==='')return saveSessionContext({'segment_path':undefined},_0x2ff9ec),console[_0x2dccc0(0x11c)](a43_0x3d61c9[_0x2dccc0(0x100)](_0x2dccc0(0x10a))),0x0;_0x47e213=normalizePath(_0x47e213);const _0x341f00=parsePath(_0x47e213)[_0x2dccc0(0x117)];if(_0x341f00[_0x2dccc0(0x115)]===0x0)return saveSessionContext({'segment_path':undefined},_0x2ff9ec),console[_0x2dccc0(0x11c)](a43_0x3d61c9[_0x2dccc0(0x100)](_0x2dccc0(0x10a))),0x0;_0x276b63[_0x2dccc0(0x10e)]&&(console['error'](_0x2dccc0(0x106)+_0x276b63[_0x2dccc0(0x10f)]),console[_0x2dccc0(0x101)](_0x2dccc0(0x110)+_0x47e213));const _0x21df59=await withSpinner(_0x2dccc0(0x116)+_0x47e213+'\x27...',()=>_0x4a3e77['segment'][_0x2dccc0(0x119)](_0x47e213),{'verbose':_0x276b63[_0x2dccc0(0x10e)]}),_0x236789=_0x21df59[_0x2dccc0(0xf3)];_0x276b63[_0x2dccc0(0x10e)]&&(console[_0x2dccc0(0x101)](_0x2dccc0(0x102)+_0x236789[_0x2dccc0(0xe5)]),console['error']('Parent\x20ID:\x20'+_0x236789[_0x2dccc0(0xf2)]),_0x236789['folderId']&&console[_0x2dccc0(0x101)](_0x2dccc0(0x109)+_0x236789[_0x2dccc0(0xea)]));if(_0x236789[_0x2dccc0(0xe5)]===_0x2dccc0(0x108))return console[_0x2dccc0(0x101)](a43_0x3d61c9[_0x2dccc0(0xff)]('Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.')),console[_0x2dccc0(0x101)]('Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.'),console[_0x2dccc0(0x101)](a43_0x3d61c9[_0x2dccc0(0xf0)]('Use:\x20tdx\x20segment\x20use\x20'+_0x236789[_0x2dccc0(0xef)]+(_0x236789[_0x2dccc0(0xe8)]?'/'+_0x236789[_0x2dccc0(0xe8)]['join']('/'):''))),0x1;return saveSessionContext({'segment_path':_0x236789[_0x2dccc0(0xf8)],'parent_segment':_0x236789[_0x2dccc0(0xef)]},_0x2ff9ec),console[_0x2dccc0(0x11c)](a43_0x3d61c9[_0x2dccc0(0x100)](_0x2dccc0(0x10c)+a43_0x3d61c9['cyan'](_0x236789[_0x2dccc0(0xf8)]))),_0x276b63['verbose']&&(console[_0x2dccc0(0x101)](a43_0x3d61c9['dim'](_0x2dccc0(0xfa))),console['error'](a43_0x3d61c9[_0x2dccc0(0x118)](_0x2dccc0(0xf4)))),0x0;}catch(_0x4a873a){throw _0x4a873a;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a44_0x2a0751=a44_0x3beb;function a44_0x3beb(_0x27c8b7,_0x3fbd5e){_0x27c8b7=_0x27c8b7-0x9e;const _0x367e22=a44_0x367e();let _0x3beb55=_0x367e22[_0x27c8b7];return _0x3beb55;}(function(_0x4fa8c6,_0x22eb70){const _0x3ffe5f=a44_0x3beb,_0x1d731f=_0x4fa8c6();while(!![]){try{const _0x24228f=parseInt(_0x3ffe5f(0xd2))/0x1*(parseInt(_0x3ffe5f(0xae))/0x2)+-parseInt(_0x3ffe5f(0xd5))/0x3+-parseInt(_0x3ffe5f(0xb9))/0x4*(-parseInt(_0x3ffe5f(0xce))/0x5)+-parseInt(_0x3ffe5f(0xc3))/0x6+-parseInt(_0x3ffe5f(0xa8))/0x7+parseInt(_0x3ffe5f(0xc8))/0x8*(parseInt(_0x3ffe5f(0xaa))/0x9)+parseInt(_0x3ffe5f(0xd3))/0xa*(parseInt(_0x3ffe5f(0xc2))/0xb);if(_0x24228f===_0x22eb70)break;else _0x1d731f['push'](_0x1d731f['shift']());}catch(_0x308a08){_0x1d731f['push'](_0x1d731f['shift']());}}}(a44_0x367e,0xbaac7));import{BaseCommand}from'./command.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';function a44_0x367e(){const _0x7f3fff=['Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','\x20valid','name','yellow','endsWith','cwd','length','1661LrwGwc','6269748ktoREy','file','warningCount','error','type','6421200zACnhV','\x20error(s)','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20validate\x20.\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20current\x20directory','\x20warning(s)','red','✔\x20All\x20','8795nAZkEj','warnings','validCount','segment:validate','72139JToCwm','29010NNWtcE','description','915501oaZZVe','no_parent','parentSegment','helpText','green','errorCode','):\x20','valid','Error:\x20Directory\x20not\x20found:\x20','.yaml','\x20warning(s)\x20found','7403781jjfnfY','verbose','9EHsKVP','hasErrors','log','Usage:\x20tdx\x20sg\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','34EbFFpP','targetDir','Validate\x20segment\x20and\x20journey\x20YAML\x20files','invalidCount','\x20file(s)\x20with\x20errors,\x20','\x20file(s)\x20valid','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','cyan','execute','dim','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','1604lWnsfa','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file'];a44_0x367e=function(){return _0x7f3fff;};return a44_0x367e();}import a44_0x29d6ba from'chalk';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class SegmentValidateCommand extends BaseCommand{[a44_0x2a0751(0xbd)]=a44_0x2a0751(0xd1);[a44_0x2a0751(0xd4)]=a44_0x2a0751(0xb0);async[a44_0x2a0751(0xb6)](_0x34bdbe){const _0x3bb89a=a44_0x2a0751,{options:_0x44f504,args:_0x2f94ec}=_0x34bdbe,_0x5f3d7c=_0x44f504,_0xc29e4b=await resolveTarget({'arg':_0x2f94ec[0x0],'contextParent':_0x44f504[_0x3bb89a(0x9f)],'cwd':process[_0x3bb89a(0xc0)]()});if(!isSuccessfulResolution(_0xc29e4b))return _0xc29e4b[_0x3bb89a(0xa2)]===_0x3bb89a(0x9e)?(console['error'](a44_0x29d6ba[_0x3bb89a(0xbe)](_0x3bb89a(0xb8))),console[_0x3bb89a(0xc6)](_0x3bb89a(0xad)),console[_0x3bb89a(0xc6)](_0x3bb89a(0xca)),console[_0x3bb89a(0xc6)](_0x3bb89a(0xba))):(console[_0x3bb89a(0xc6)](a44_0x29d6ba[_0x3bb89a(0xcc)]('Error:\x20'+_0xc29e4b['message']+'\x0a')),_0xc29e4b[_0x3bb89a(0xa0)]&&console[_0x3bb89a(0xc6)](a44_0x29d6ba[_0x3bb89a(0xb5)](_0xc29e4b[_0x3bb89a(0xa0)]))),0x1;const _0x1be2cf=_0xc29e4b[_0x3bb89a(0xaf)],_0x492f1a=_0xc29e4b[_0x3bb89a(0xc7)]===_0x3bb89a(0xc4)?_0xc29e4b['filePath']:undefined;if(!_0x492f1a&&!existsSync(_0x1be2cf))return console[_0x3bb89a(0xc6)](a44_0x29d6ba[_0x3bb89a(0xcc)](_0x3bb89a(0xa5)+_0x1be2cf+'\x0a')),0x1;let _0x262b40;if(_0x492f1a){if(!_0x492f1a['endsWith']('.yml')&&!_0x492f1a[_0x3bb89a(0xbf)](_0x3bb89a(0xa6)))return console[_0x3bb89a(0xc6)](a44_0x29d6ba[_0x3bb89a(0xcc)](_0x3bb89a(0xbb)+_0x492f1a+'\x0a')),0x1;_0x262b40=[_0x492f1a];}else _0x262b40=findYamlFiles(_0x1be2cf);if(_0x262b40[_0x3bb89a(0xc1)]===0x0)return console[_0x3bb89a(0xc6)](a44_0x29d6ba[_0x3bb89a(0xcc)](_0x3bb89a(0xb4)+_0x1be2cf+'\x0a')),0x1;const _0x607edd=validateYamlFiles(_0x262b40,_0x1be2cf),_0x43ac59=calculateSummary(_0x607edd);for(const _0x49a823 of _0x607edd){if(!isValidationResult(_0x49a823))continue;const {relativePath:_0x31745e,source:_0x54f066,result:_0x5812cc,fileType:_0x5636cb}=_0x49a823,_0x19dad7=_0x5636cb;if(_0x5812cc[_0x3bb89a(0xa4)]&&_0x5812cc[_0x3bb89a(0xcf)][_0x3bb89a(0xc1)]===0x0)_0x5f3d7c[_0x3bb89a(0xa9)]&&console[_0x3bb89a(0xac)](a44_0x29d6ba[_0x3bb89a(0xa1)]('✔\x20'+_0x31745e)+a44_0x29d6ba['dim']('\x20('+_0x19dad7+')'));else _0x5812cc['valid']?(console[_0x3bb89a(0xac)](a44_0x29d6ba[_0x3bb89a(0xbe)]('⚠\x20'+_0x31745e)+a44_0x29d6ba[_0x3bb89a(0xb7)]('\x20('+_0x19dad7+_0x3bb89a(0xa3)+_0x5812cc[_0x3bb89a(0xcf)]['length']+_0x3bb89a(0xcb))),console[_0x3bb89a(0xac)](formatValidationResult(_0x5812cc,_0x54f066,_0x31745e))):(console[_0x3bb89a(0xac)](a44_0x29d6ba[_0x3bb89a(0xcc)]('✖\x20'+_0x31745e)+a44_0x29d6ba[_0x3bb89a(0xb7)]('\x20('+_0x19dad7+'):\x20'+_0x5812cc['errors'][_0x3bb89a(0xc1)]+_0x3bb89a(0xc9))),console[_0x3bb89a(0xac)](formatValidationResult(_0x5812cc,_0x54f066,_0x31745e)));}return console[_0x3bb89a(0xac)](''),_0x43ac59[_0x3bb89a(0xab)]?(console[_0x3bb89a(0xac)](a44_0x29d6ba['red']('Validation\x20failed:\x20'+_0x43ac59[_0x3bb89a(0xb1)]+_0x3bb89a(0xb2)+_0x43ac59[_0x3bb89a(0xd0)]+_0x3bb89a(0xbc))),_0x43ac59[_0x3bb89a(0xc5)]>0x0&&console['log'](a44_0x29d6ba[_0x3bb89a(0xbe)](_0x43ac59['warningCount']+_0x3bb89a(0xa7))),0x1):(console['log'](a44_0x29d6ba[_0x3bb89a(0xa1)](_0x3bb89a(0xcd)+_0x43ac59[_0x3bb89a(0xd0)]+_0x3bb89a(0xb3))),_0x43ac59['warningCount']>0x0&&console[_0x3bb89a(0xac)](a44_0x29d6ba[_0x3bb89a(0xbe)](_0x43ac59[_0x3bb89a(0xc5)]+'\x20warning(s)\x20found')),0x0);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a45_0x4260e1=a45_0x475c;function a45_0x475c(_0x5a94a9,_0x4a756a){_0x5a94a9=_0x5a94a9-0x176;const _0x5df7c5=a45_0x5df7();let _0x475c49=_0x5df7c5[_0x5a94a9];return _0x475c49;}(function(_0x19abf9,_0x4b8625){const _0x4a8948=a45_0x475c,_0x43d3a3=_0x19abf9();while(!![]){try{const _0x51811b=-parseInt(_0x4a8948(0x17f))/0x1+-parseInt(_0x4a8948(0x1a6))/0x2+-parseInt(_0x4a8948(0x18f))/0x3+-parseInt(_0x4a8948(0x1b3))/0x4+parseInt(_0x4a8948(0x183))/0x5*(-parseInt(_0x4a8948(0x1ac))/0x6)+parseInt(_0x4a8948(0x1a1))/0x7*(-parseInt(_0x4a8948(0x199))/0x8)+parseInt(_0x4a8948(0x184))/0x9;if(_0x51811b===_0x4b8625)break;else _0x43d3a3['push'](_0x43d3a3['shift']());}catch(_0x2469d8){_0x43d3a3['push'](_0x43d3a3['shift']());}}}(a45_0x5df7,0xb3f5a));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a45_0x5df7(){const _0x522168=['test','\x20segment','log','Use\x20tdx\x20ps\x20list\x20to\x20see\x20available\x20parent\x20segments.','verbose','12sJixVb','resolvePathToResource','(empty)','format','replace','Site:\x20','/j/da','2551356DEoZqZ','\x5c$&','listUnified','folders','Parent\x20segment\x20context:\x20','localeCompare','jsonl','cause','journey','✔\x20Found\x20',']\x20matching\x20\x27','/e/','name','✔\x20Built\x20tree\x20with\x20','\x20folder','Folder\x20ID:\x20','children','includes','map','parentSegment','parentId','data','Parent\x20ID:\x20','Building\x20hierarchy\x20tree...','Resolving\x20path\x20\x27','/app/ps/','88284BtUGMt','length','type','\x20\x20tdx\x20sg\x20use\x20\x22My\x20Audience\x22','1424355RhPYbR','32988267LNchKC',',\x20and\x20','journeys','maxDepth','journeyBundleName','Resolving\x20parent\x20segment\x20\x27','dim','listUnifiedWithJourneys','Error:\x20No\x20parent\x20segment\x20context\x20set.','listWithPattern','Folder/pattern\x20arg:\x20','3128493IgHDhO','error','Listing\x20folders,\x20segments,\x20and\x20journeys...','\x20\x20tdx\x20sg\x20pull\x20\x22My\x20Audience\x22','\x20matching\x20\x27','\x20journey','listRecursive','No\x20items\x20match\x20pattern:\x20','filter','folderId','26120FVdCRV','sort','segment','Error:\x20','folder','Set\x20a\x20parent\x20segment\x20context\x20first:','execute','segments','889rrKOaC','json','(not\x20set)','site','description','349796RyrNXc'];a45_0x5df7=function(){return _0x522168;};return a45_0x5df7();}import{formatFlatList,formatTree}from'../sdk/util/tree-formatter.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import a45_0xf41dc from'chalk';export class SegmentsCommand extends BaseCommand{[a45_0x4260e1(0x1bf)]=a45_0x4260e1(0x1a0);[a45_0x4260e1(0x1a5)]='List\x20folders\x20and\x20child\x20segments';async[a45_0x4260e1(0x19f)](_0x51e3c6){const _0x1c05be=a45_0x4260e1,{options:_0xfc9645,args:_0xd755ad}=_0x51e3c6,_0xf2b28=_0xfc9645['recursive'],_0x53ff25=_0xd755ad[0x0];try{const _0x13b6c2=_0xfc9645[_0x1c05be(0x178)];_0xfc9645[_0x1c05be(0x1ab)]&&(console[_0x1c05be(0x190)](_0x1c05be(0x1b1)+_0xfc9645[_0x1c05be(0x1a4)]),console['error'](_0x1c05be(0x1b7)+(_0x13b6c2||_0x1c05be(0x1a3))),_0x53ff25&&console[_0x1c05be(0x190)](_0x1c05be(0x18e)+_0x53ff25),_0xf2b28&&console[_0x1c05be(0x190)]('Recursive\x20mode:\x20enabled'));if(!_0x13b6c2)return console['error'](_0x1c05be(0x18c)),console['error'](''),console['error'](_0x1c05be(0x19e)),console['error'](_0x1c05be(0x192)),console[_0x1c05be(0x190)](_0x1c05be(0x182)),console['error'](''),console['error'](_0x1c05be(0x1aa)),0x1;const _0x48fdb5=_0x53ff25&&(_0x53ff25[_0x1c05be(0x176)]('*')||_0x53ff25[_0x1c05be(0x176)]('?'));if(_0x48fdb5)return await this[_0x1c05be(0x18d)](_0x51e3c6,_0x13b6c2,_0x53ff25);const _0x1e268e=_0x53ff25?_0x13b6c2+'/'+_0x53ff25:_0x13b6c2;return _0xf2b28?await this[_0x1c05be(0x195)](_0x51e3c6,_0x1e268e):await this[_0x1c05be(0x1b5)](_0x51e3c6,_0x1e268e);}catch(_0x559cc5){if(_0x559cc5 instanceof SDKError)return console[_0x1c05be(0x190)](_0x1c05be(0x19c)+_0x559cc5['message']),_0x559cc5[_0x1c05be(0x1ba)]&&console['error']('\x20\x20Cause:\x20'+_0x559cc5['cause']),0x1;throw _0x559cc5;}}async[a45_0x4260e1(0x18d)](_0x479723,_0x5a61fc,_0x39f317){const _0x57cab3=a45_0x4260e1,{options:_0x534d7a,tdx:_0x3eade2}=_0x479723,_0x19d73e=await withSpinner(_0x57cab3(0x189)+_0x5a61fc+'\x27...',()=>_0x3eade2['segment'][_0x57cab3(0x1ad)](_0x5a61fc),{'verbose':_0x534d7a[_0x57cab3(0x1ab)]}),_0x541872=_0x19d73e[_0x57cab3(0x17a)],_0x930372=await withSpinner(_0x57cab3(0x191),()=>_0x3eade2['segment']['listUnifiedWithJourneys'](_0x541872[_0x57cab3(0x179)],_0x541872[_0x57cab3(0x198)]),{'verbose':_0x534d7a[_0x57cab3(0x1ab)]}),{folders:_0x41fb53,segments:_0x2ea04e,journeys:_0x1f3bb6}=_0x930372['data'],_0x19df27=_0x39f317[_0x57cab3(0x1b0)](/[.+^${}()|[\]\\]/g,_0x57cab3(0x1b4))[_0x57cab3(0x1b0)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x504bee=new RegExp('^'+_0x19df27+'$','i'),_0x1ae581=_0x41fb53[_0x57cab3(0x197)](_0x2a5314=>_0x504bee['test'](_0x2a5314[_0x57cab3(0x1bf)])),_0x46116b=_0x2ea04e[_0x57cab3(0x197)](_0x13bc91=>_0x504bee[_0x57cab3(0x1a7)](_0x13bc91[_0x57cab3(0x1bf)])),_0xe2a6ce=_0x1f3bb6[_0x57cab3(0x197)](_0x36b2f4=>_0x504bee[_0x57cab3(0x1a7)](_0x36b2f4['journeyBundleName'])),_0x566236=_0x1ae581[_0x57cab3(0x180)]+_0x46116b['length']+_0xe2a6ce['length'];console[_0x57cab3(0x190)](_0x57cab3(0x1bc)+_0x1ae581['length']+_0x57cab3(0x1c1)+(_0x1ae581[_0x57cab3(0x180)]!==0x1?'s':'')+',\x20'+_0x46116b[_0x57cab3(0x180)]+_0x57cab3(0x1a8)+(_0x46116b[_0x57cab3(0x180)]!==0x1?'s':'')+_0x57cab3(0x185)+_0xe2a6ce[_0x57cab3(0x180)]+'\x20journey'+(_0xe2a6ce[_0x57cab3(0x180)]!==0x1?'s':'')+_0x57cab3(0x193)+_0x39f317+'\x27');const _0x2de856=_0x576c3e=>{const _0x28753b=_0x57cab3;return getConsoleNextUrl(_0x534d7a[_0x28753b(0x1a4)],'/app/ps/'+_0x541872['parentId']+_0x28753b(0x1be)+_0x576c3e);},_0x2d983d=_0x534d7a['format']===_0x57cab3(0x1a2)||_0x534d7a[_0x57cab3(0x1af)]===_0x57cab3(0x1b9);if(_0x2d983d){const _0x128687=[..._0x1ae581['map'](_0x3c64b3=>({..._0x3c64b3,'type':_0x57cab3(0x19d)})),..._0x46116b[_0x57cab3(0x177)](_0x39d8b3=>({..._0x39d8b3,'type':_0x57cab3(0x19b),'url':_0x2de856(_0x39d8b3['id'])})),..._0xe2a6ce[_0x57cab3(0x177)](_0x50d672=>({..._0x50d672,'name':_0x50d672[_0x57cab3(0x188)],'type':_0x57cab3(0x1bb)}))]['sort']((_0x4998ed,_0x2a14b7)=>_0x4998ed['name']['localeCompare'](_0x2a14b7[_0x57cab3(0x1bf)]));await handleSDKOutput(_0x128687,_0x534d7a);}else{if(_0x566236===0x0)console[_0x57cab3(0x1a9)](_0x57cab3(0x196)+_0x39f317);else{console[_0x57cab3(0x1a9)](a45_0xf41dc[_0x57cab3(0x18a)]('['+_0x5a61fc+_0x57cab3(0x1bd)+_0x39f317+'\x27'));const _0x4b7193=formatFlatList(_0x1ae581,_0x46116b,{'showMetadata':!![],'getSegmentUrl':_0x2de856},_0xe2a6ce);console[_0x57cab3(0x1a9)](_0x4b7193);}}return 0x0;}async[a45_0x4260e1(0x1b5)](_0x5f8c7d,_0x120a6c){const _0x105330=a45_0x4260e1,{options:_0x2457c1,tdx:_0x5a7e3d}=_0x5f8c7d,_0x50d4b3=await withSpinner(_0x105330(0x17d)+_0x120a6c+'\x27...',()=>_0x5a7e3d[_0x105330(0x19b)][_0x105330(0x1ad)](_0x120a6c),{'verbose':_0x2457c1[_0x105330(0x1ab)]}),_0x54fc03=_0x50d4b3['data'];_0x2457c1[_0x105330(0x1ab)]&&(console[_0x105330(0x190)]('Parent\x20ID:\x20'+_0x54fc03[_0x105330(0x179)]),_0x54fc03['folderId']&&console[_0x105330(0x190)](_0x105330(0x1c2)+_0x54fc03[_0x105330(0x198)]));const _0x6792e8=await withSpinner(_0x105330(0x191),()=>_0x5a7e3d[_0x105330(0x19b)][_0x105330(0x18b)](_0x54fc03[_0x105330(0x179)],_0x54fc03['folderId']),{'verbose':_0x2457c1[_0x105330(0x1ab)]}),{folders:_0x430da9,segments:_0x213b9c,journeys:_0x2744e5}=_0x6792e8[_0x105330(0x17a)],_0x21cd4f=_0x430da9[_0x105330(0x180)]+_0x213b9c[_0x105330(0x180)]+_0x2744e5['length'];console[_0x105330(0x190)]('✔\x20Found\x20'+_0x430da9[_0x105330(0x180)]+_0x105330(0x1c1)+(_0x430da9['length']!==0x1?'s':'')+',\x20'+_0x213b9c[_0x105330(0x180)]+_0x105330(0x1a8)+(_0x213b9c[_0x105330(0x180)]!==0x1?'s':'')+',\x20and\x20'+_0x2744e5[_0x105330(0x180)]+_0x105330(0x194)+(_0x2744e5[_0x105330(0x180)]!==0x1?'s':''));const _0x4660a4=_0x227f04=>{const _0x18426e=_0x105330;return getConsoleNextUrl(_0x2457c1[_0x18426e(0x1a4)],_0x18426e(0x17e)+_0x54fc03[_0x18426e(0x179)]+_0x18426e(0x1be)+_0x227f04);},_0x468564=_0x414541=>{const _0x8fd2ce=_0x105330;return getConsoleNextUrl(_0x2457c1['site'],_0x8fd2ce(0x17e)+_0x54fc03[_0x8fd2ce(0x179)]+_0x8fd2ce(0x1be)+_0x414541+_0x8fd2ce(0x1b2));},_0x169ec0=_0x2457c1[_0x105330(0x1af)]==='json'||_0x2457c1[_0x105330(0x1af)]==='jsonl';if(_0x169ec0){const _0x19a784=[..._0x430da9['map'](_0x337af9=>({..._0x337af9,'type':_0x105330(0x19d)})),..._0x213b9c[_0x105330(0x177)](_0x54f164=>({..._0x54f164,'type':_0x105330(0x19b),'url':_0x4660a4(_0x54f164['id'])})),..._0x2744e5[_0x105330(0x177)](_0x4b3931=>({..._0x4b3931,'name':_0x4b3931[_0x105330(0x188)],'type':_0x105330(0x1bb),'url':_0x468564(_0x4b3931['id'])}))][_0x105330(0x19a)]((_0x5c243c,_0x367ca8)=>_0x5c243c[_0x105330(0x1bf)][_0x105330(0x1b8)](_0x367ca8[_0x105330(0x1bf)]));await handleSDKOutput(_0x19a784,_0x2457c1);}else{if(_0x21cd4f===0x0)console['log'](a45_0xf41dc[_0x105330(0x18a)]('['+_0x120a6c+']')),console[_0x105330(0x1a9)](_0x105330(0x1ae));else{console[_0x105330(0x1a9)](a45_0xf41dc['dim']('['+_0x120a6c+']'));const _0x50cfb1=formatFlatList(_0x430da9,_0x213b9c,{'showMetadata':!![],'getSegmentUrl':_0x4660a4,'getJourneyUrl':_0x468564},_0x2744e5);console['log'](_0x50cfb1);}}return 0x0;}async['listRecursive'](_0x4b75bf,_0xe8304){const _0x3df135=a45_0x4260e1,{options:_0x379e49,tdx:_0x2ffc5f}=_0x4b75bf,_0x489542=await withSpinner('Resolving\x20path\x20\x27'+_0xe8304+'\x27...',()=>_0x2ffc5f['segment'][_0x3df135(0x1ad)](_0xe8304),{'verbose':_0x379e49[_0x3df135(0x1ab)]}),_0x326e5f=_0x489542[_0x3df135(0x17a)];_0x379e49[_0x3df135(0x1ab)]&&(console[_0x3df135(0x190)](_0x3df135(0x17b)+_0x326e5f[_0x3df135(0x179)]),_0x326e5f[_0x3df135(0x198)]&&console[_0x3df135(0x190)](_0x3df135(0x1c2)+_0x326e5f[_0x3df135(0x198)]));const _0x4ca61a=_0x379e49[_0x3df135(0x187)]||0xa,_0x27fe8e=await withSpinner(_0x3df135(0x17c),()=>_0x2ffc5f[_0x3df135(0x19b)][_0x3df135(0x195)](_0x326e5f[_0x3df135(0x179)],_0x326e5f[_0x3df135(0x198)],0x0,_0x4ca61a),{'verbose':_0x379e49['verbose']}),_0x1374ee=_0x27fe8e[_0x3df135(0x17a)],_0x538281=_0x44a4d6=>{const _0x44441f=_0x3df135;let _0x27bd12=0x0,_0x38af74=0x0,_0xae25b1=0x0;for(const _0x1067d8 of _0x44a4d6){if(_0x1067d8[_0x44441f(0x181)]==='folder')_0x27bd12++;else{if(_0x1067d8[_0x44441f(0x181)]===_0x44441f(0x19b))_0x38af74++;else{if(_0x1067d8[_0x44441f(0x181)]===_0x44441f(0x1bb))_0xae25b1++;}}if(_0x1067d8[_0x44441f(0x1c3)]){const _0x17816b=_0x538281(_0x1067d8['children']);_0x27bd12+=_0x17816b[_0x44441f(0x1b6)],_0x38af74+=_0x17816b[_0x44441f(0x1a0)],_0xae25b1+=_0x17816b[_0x44441f(0x186)];}}return{'folders':_0x27bd12,'segments':_0x38af74,'journeys':_0xae25b1};},_0x3c1591=_0x538281(_0x1374ee);console[_0x3df135(0x190)](_0x3df135(0x1c0)+_0x3c1591[_0x3df135(0x1b6)]+_0x3df135(0x1c1)+(_0x3c1591['folders']!==0x1?'s':'')+',\x20'+_0x3c1591[_0x3df135(0x1a0)]+'\x20segment'+(_0x3c1591['segments']!==0x1?'s':'')+_0x3df135(0x185)+_0x3c1591['journeys']+_0x3df135(0x194)+(_0x3c1591[_0x3df135(0x186)]!==0x1?'s':''));const _0x33ecbd=_0x45f0f1=>{const _0x245fb9=_0x3df135;return getConsoleNextUrl(_0x379e49[_0x245fb9(0x1a4)],_0x245fb9(0x17e)+_0x326e5f['parentId']+_0x245fb9(0x1be)+_0x45f0f1);},_0x219a61=_0x40f863=>{const _0x369ccf=_0x3df135;return getConsoleNextUrl(_0x379e49[_0x369ccf(0x1a4)],'/app/ps/'+_0x326e5f[_0x369ccf(0x179)]+_0x369ccf(0x1be)+_0x40f863+_0x369ccf(0x1b2));};if(_0x379e49[_0x3df135(0x1af)]===_0x3df135(0x1a2)||_0x379e49[_0x3df135(0x1af)]===_0x3df135(0x1b9))await handleSDKOutput(_0x1374ee,_0x379e49);else{console['log'](a45_0xf41dc[_0x3df135(0x18a)]('['+_0xe8304+']'));const _0x44c084=formatTree(_0x1374ee,{'showMetadata':!![],'getSegmentUrl':_0x33ecbd,'getJourneyUrl':_0x219a61});console[_0x3df135(0x1a9)](_0x44c084);}return 0x0;}}
|
|
1
|
+
const a45_0x1ba5ee=a45_0x4224;(function(_0x22a23a,_0x273d34){const _0x3fe538=a45_0x4224,_0x2a99b2=_0x22a23a();while(!![]){try{const _0x1ff945=parseInt(_0x3fe538(0x118))/0x1*(parseInt(_0x3fe538(0x111))/0x2)+-parseInt(_0x3fe538(0x105))/0x3+-parseInt(_0x3fe538(0x12b))/0x4+parseInt(_0x3fe538(0x10a))/0x5+-parseInt(_0x3fe538(0x10d))/0x6+parseInt(_0x3fe538(0x10f))/0x7*(-parseInt(_0x3fe538(0x109))/0x8)+parseInt(_0x3fe538(0x110))/0x9*(parseInt(_0x3fe538(0x129))/0xa);if(_0x1ff945===_0x273d34)break;else _0x2a99b2['push'](_0x2a99b2['shift']());}catch(_0x3fc06a){_0x2a99b2['push'](_0x2a99b2['shift']());}}}(a45_0x2344,0x9fcce));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a45_0x4224(_0x93a702,_0x1c7a57){_0x93a702=_0x93a702-0x103;const _0x234446=a45_0x2344();let _0x4224d0=_0x234446[_0x93a702];return _0x4224d0;}import{formatFlatList,formatTree}from'../sdk/util/tree-formatter.js';function a45_0x2344(){const _0x4219aa=['listUnifiedWithJourneys','name','parentId','Listing\x20folders,\x20segments,\x20and\x20journeys...','/app/ps/','format','/j/da','recursive','maxDepth','journeys','\x20folder','journey','Resolving\x20parent\x20segment\x20\x27','json','Set\x20a\x20parent\x20segment\x20context\x20first:','8748310oEFVoE','data','3066472UdElon','folderId','segments',',\x20and\x20','folders','No\x20items\x20match\x20pattern:\x20','folder','List\x20folders\x20and\x20child\x20segments','Error:\x20','listRecursive','description','message','map','jsonl','includes','parentSegment','\x20journey','✔\x20Built\x20tree\x20with\x20','dim','\x20segment','resolvePathToResource','(empty)','\x27...','\x20\x20Cause:\x20','listWithPattern',']\x20matching\x20\x27','Resolving\x20path\x20\x27','Parent\x20segment\x20context:\x20','segment','\x20\x20tdx\x20sg\x20pull\x20\x22My\x20Audience\x22','✔\x20Found\x20','Parent\x20ID:\x20','log','verbose','cause','length','821619cQHXzc','site','replace','journeyBundleName','632wpzunK','4805230rxIsUr','Use\x20tdx\x20ps\x20list\x20to\x20see\x20available\x20parent\x20segments.','listUnified','1532010RiTbnf','test','96614ozHkhq','18oZUIhk','12AmACrD','Folder\x20ID:\x20','error','/e/','type','filter','children','55003XklAPd','sort'];a45_0x2344=function(){return _0x4219aa;};return a45_0x2344();}import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import a45_0x3ffe80 from'chalk';export class SegmentsCommand extends BaseCommand{[a45_0x1ba5ee(0x11b)]=a45_0x1ba5ee(0x12d);[a45_0x1ba5ee(0x135)]=a45_0x1ba5ee(0x132);async['execute'](_0x1ef75c){const _0x34c85e=a45_0x1ba5ee,{options:_0x364b58,args:_0xacc024}=_0x1ef75c,_0x10689d=_0x364b58[_0x34c85e(0x121)],_0x30cda1=_0xacc024[0x0];try{const _0x20de14=_0x364b58[_0x34c85e(0x13a)];_0x364b58['verbose']&&(console[_0x34c85e(0x113)]('Site:\x20'+_0x364b58[_0x34c85e(0x106)]),console[_0x34c85e(0x113)](_0x34c85e(0x146)+(_0x20de14||'(not\x20set)')),_0x30cda1&&console[_0x34c85e(0x113)]('Folder/pattern\x20arg:\x20'+_0x30cda1),_0x10689d&&console[_0x34c85e(0x113)]('Recursive\x20mode:\x20enabled'));if(!_0x20de14)return console[_0x34c85e(0x113)]('Error:\x20No\x20parent\x20segment\x20context\x20set.'),console[_0x34c85e(0x113)](''),console[_0x34c85e(0x113)](_0x34c85e(0x128)),console[_0x34c85e(0x113)](_0x34c85e(0x148)),console[_0x34c85e(0x113)]('\x20\x20tdx\x20sg\x20use\x20\x22My\x20Audience\x22'),console[_0x34c85e(0x113)](''),console['error'](_0x34c85e(0x10b)),0x1;const _0x107ca5=_0x30cda1&&(_0x30cda1[_0x34c85e(0x139)]('*')||_0x30cda1[_0x34c85e(0x139)]('?'));if(_0x107ca5)return await this[_0x34c85e(0x143)](_0x1ef75c,_0x20de14,_0x30cda1);const _0x4870aa=_0x30cda1?_0x20de14+'/'+_0x30cda1:_0x20de14;return _0x10689d?await this[_0x34c85e(0x134)](_0x1ef75c,_0x4870aa):await this[_0x34c85e(0x10c)](_0x1ef75c,_0x4870aa);}catch(_0x3d9ca6){if(_0x3d9ca6 instanceof SDKError)return console[_0x34c85e(0x113)](_0x34c85e(0x133)+_0x3d9ca6[_0x34c85e(0x136)]),_0x3d9ca6[_0x34c85e(0x103)]&&console['error'](_0x34c85e(0x142)+_0x3d9ca6[_0x34c85e(0x103)]),0x1;throw _0x3d9ca6;}}async[a45_0x1ba5ee(0x143)](_0xaac24,_0x461361,_0xa90f3d){const _0x495fe8=a45_0x1ba5ee,{options:_0x27e9bd,tdx:_0x4ae0b2}=_0xaac24,_0x1ba0a1=await withSpinner(_0x495fe8(0x126)+_0x461361+_0x495fe8(0x141),()=>_0x4ae0b2['segment']['resolvePathToResource'](_0x461361),{'verbose':_0x27e9bd[_0x495fe8(0x14c)]}),_0x576f5d=_0x1ba0a1['data'],_0x54e475=await withSpinner(_0x495fe8(0x11d),()=>_0x4ae0b2[_0x495fe8(0x147)][_0x495fe8(0x11a)](_0x576f5d[_0x495fe8(0x11c)],_0x576f5d[_0x495fe8(0x12c)]),{'verbose':_0x27e9bd[_0x495fe8(0x14c)]}),{folders:_0x24e852,segments:_0x51116d,journeys:_0xdaca63}=_0x54e475[_0x495fe8(0x12a)],_0x5191ce=_0xa90f3d[_0x495fe8(0x107)](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0x495fe8(0x107)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x377476=new RegExp('^'+_0x5191ce+'$','i'),_0x4f7737=_0x24e852[_0x495fe8(0x116)](_0x37dead=>_0x377476['test'](_0x37dead['name'])),_0x316ec6=_0x51116d[_0x495fe8(0x116)](_0x1d7892=>_0x377476[_0x495fe8(0x10e)](_0x1d7892['name'])),_0x4d34c5=_0xdaca63[_0x495fe8(0x116)](_0x2a28f7=>_0x377476[_0x495fe8(0x10e)](_0x2a28f7[_0x495fe8(0x108)])),_0x2f44e=_0x4f7737['length']+_0x316ec6['length']+_0x4d34c5[_0x495fe8(0x104)];console[_0x495fe8(0x113)](_0x495fe8(0x149)+_0x4f7737[_0x495fe8(0x104)]+_0x495fe8(0x124)+(_0x4f7737[_0x495fe8(0x104)]!==0x1?'s':'')+',\x20'+_0x316ec6[_0x495fe8(0x104)]+_0x495fe8(0x13e)+(_0x316ec6[_0x495fe8(0x104)]!==0x1?'s':'')+_0x495fe8(0x12e)+_0x4d34c5[_0x495fe8(0x104)]+_0x495fe8(0x13b)+(_0x4d34c5['length']!==0x1?'s':'')+'\x20matching\x20\x27'+_0xa90f3d+'\x27');const _0x22c7b6=_0x3c0f9b=>{const _0x3df283=_0x495fe8;return getConsoleNextUrl(_0x27e9bd[_0x3df283(0x106)],_0x3df283(0x11e)+_0x576f5d[_0x3df283(0x11c)]+_0x3df283(0x114)+_0x3c0f9b);},_0x1e6697=_0x27e9bd[_0x495fe8(0x11f)]===_0x495fe8(0x127)||_0x27e9bd[_0x495fe8(0x11f)]===_0x495fe8(0x138);if(_0x1e6697){const _0x58dde5=[..._0x4f7737[_0x495fe8(0x137)](_0x3f7155=>({..._0x3f7155,'type':_0x495fe8(0x131)})),..._0x316ec6[_0x495fe8(0x137)](_0x256c99=>({..._0x256c99,'type':_0x495fe8(0x147),'url':_0x22c7b6(_0x256c99['id'])})),..._0x4d34c5[_0x495fe8(0x137)](_0x1d6eff=>({..._0x1d6eff,'name':_0x1d6eff['journeyBundleName'],'type':'journey'}))][_0x495fe8(0x119)]((_0x2d82b0,_0x15db03)=>_0x2d82b0['name']['localeCompare'](_0x15db03[_0x495fe8(0x11b)]));await handleSDKOutput(_0x58dde5,_0x27e9bd);}else{if(_0x2f44e===0x0)console['log'](_0x495fe8(0x130)+_0xa90f3d);else{console[_0x495fe8(0x14b)](a45_0x3ffe80[_0x495fe8(0x13d)]('['+_0x461361+_0x495fe8(0x144)+_0xa90f3d+'\x27'));const _0x237b45=formatFlatList(_0x4f7737,_0x316ec6,{'showMetadata':!![],'getSegmentUrl':_0x22c7b6},_0x4d34c5);console[_0x495fe8(0x14b)](_0x237b45);}}return 0x0;}async[a45_0x1ba5ee(0x10c)](_0x496667,_0x322a44){const _0x30c629=a45_0x1ba5ee,{options:_0x193459,tdx:_0x37c264}=_0x496667,_0x64cc7=await withSpinner(_0x30c629(0x145)+_0x322a44+_0x30c629(0x141),()=>_0x37c264[_0x30c629(0x147)][_0x30c629(0x13f)](_0x322a44),{'verbose':_0x193459[_0x30c629(0x14c)]}),_0x3a1223=_0x64cc7[_0x30c629(0x12a)];_0x193459['verbose']&&(console['error']('Parent\x20ID:\x20'+_0x3a1223[_0x30c629(0x11c)]),_0x3a1223[_0x30c629(0x12c)]&&console[_0x30c629(0x113)](_0x30c629(0x112)+_0x3a1223['folderId']));const _0xedfb14=await withSpinner(_0x30c629(0x11d),()=>_0x37c264[_0x30c629(0x147)][_0x30c629(0x11a)](_0x3a1223[_0x30c629(0x11c)],_0x3a1223[_0x30c629(0x12c)]),{'verbose':_0x193459[_0x30c629(0x14c)]}),{folders:_0x419165,segments:_0x261f99,journeys:_0xc86898}=_0xedfb14[_0x30c629(0x12a)],_0x141457=_0x419165[_0x30c629(0x104)]+_0x261f99[_0x30c629(0x104)]+_0xc86898['length'];console[_0x30c629(0x113)]('✔\x20Found\x20'+_0x419165[_0x30c629(0x104)]+_0x30c629(0x124)+(_0x419165['length']!==0x1?'s':'')+',\x20'+_0x261f99[_0x30c629(0x104)]+_0x30c629(0x13e)+(_0x261f99['length']!==0x1?'s':'')+',\x20and\x20'+_0xc86898[_0x30c629(0x104)]+_0x30c629(0x13b)+(_0xc86898[_0x30c629(0x104)]!==0x1?'s':''));const _0xedaabc=_0x8a2b59=>{const _0x5a46d4=_0x30c629;return getConsoleNextUrl(_0x193459[_0x5a46d4(0x106)],_0x5a46d4(0x11e)+_0x3a1223[_0x5a46d4(0x11c)]+_0x5a46d4(0x114)+_0x8a2b59);},_0x10be80=_0x2ad1e3=>{const _0x3c6bff=_0x30c629;return getConsoleNextUrl(_0x193459[_0x3c6bff(0x106)],_0x3c6bff(0x11e)+_0x3a1223[_0x3c6bff(0x11c)]+_0x3c6bff(0x114)+_0x2ad1e3+_0x3c6bff(0x120));},_0x5621bd=_0x193459[_0x30c629(0x11f)]===_0x30c629(0x127)||_0x193459[_0x30c629(0x11f)]===_0x30c629(0x138);if(_0x5621bd){const _0x18dc08=[..._0x419165[_0x30c629(0x137)](_0x424e2c=>({..._0x424e2c,'type':'folder'})),..._0x261f99[_0x30c629(0x137)](_0x51fb92=>({..._0x51fb92,'type':'segment','url':_0xedaabc(_0x51fb92['id'])})),..._0xc86898['map'](_0x4cc16c=>({..._0x4cc16c,'name':_0x4cc16c[_0x30c629(0x108)],'type':'journey','url':_0x10be80(_0x4cc16c['id'])}))][_0x30c629(0x119)]((_0x59e82d,_0x435dd8)=>_0x59e82d[_0x30c629(0x11b)]['localeCompare'](_0x435dd8['name']));await handleSDKOutput(_0x18dc08,_0x193459);}else{if(_0x141457===0x0)console[_0x30c629(0x14b)](a45_0x3ffe80[_0x30c629(0x13d)]('['+_0x322a44+']')),console['log'](_0x30c629(0x140));else{console[_0x30c629(0x14b)](a45_0x3ffe80[_0x30c629(0x13d)]('['+_0x322a44+']'));const _0x3e5a8b=formatFlatList(_0x419165,_0x261f99,{'showMetadata':!![],'getSegmentUrl':_0xedaabc,'getJourneyUrl':_0x10be80},_0xc86898);console[_0x30c629(0x14b)](_0x3e5a8b);}}return 0x0;}async[a45_0x1ba5ee(0x134)](_0x4e8a55,_0x38d536){const _0x38765c=a45_0x1ba5ee,{options:_0x25492b,tdx:_0xb7f589}=_0x4e8a55,_0x34565f=await withSpinner(_0x38765c(0x145)+_0x38d536+_0x38765c(0x141),()=>_0xb7f589[_0x38765c(0x147)][_0x38765c(0x13f)](_0x38d536),{'verbose':_0x25492b[_0x38765c(0x14c)]}),_0x3885dd=_0x34565f[_0x38765c(0x12a)];_0x25492b[_0x38765c(0x14c)]&&(console[_0x38765c(0x113)](_0x38765c(0x14a)+_0x3885dd['parentId']),_0x3885dd[_0x38765c(0x12c)]&&console[_0x38765c(0x113)](_0x38765c(0x112)+_0x3885dd['folderId']));const _0x31ed06=_0x25492b[_0x38765c(0x122)]||0xa,_0x2accd0=await withSpinner('Building\x20hierarchy\x20tree...',()=>_0xb7f589[_0x38765c(0x147)]['listRecursive'](_0x3885dd[_0x38765c(0x11c)],_0x3885dd[_0x38765c(0x12c)],0x0,_0x31ed06),{'verbose':_0x25492b['verbose']}),_0x508fe1=_0x2accd0[_0x38765c(0x12a)],_0x1a110e=_0x335084=>{const _0x1937bf=_0x38765c;let _0x4ed60b=0x0,_0x10fcd8=0x0,_0xa866d3=0x0;for(const _0x4a4097 of _0x335084){if(_0x4a4097['type']==='folder')_0x4ed60b++;else{if(_0x4a4097['type']===_0x1937bf(0x147))_0x10fcd8++;else{if(_0x4a4097[_0x1937bf(0x115)]===_0x1937bf(0x125))_0xa866d3++;}}if(_0x4a4097[_0x1937bf(0x117)]){const _0x14ae79=_0x1a110e(_0x4a4097[_0x1937bf(0x117)]);_0x4ed60b+=_0x14ae79[_0x1937bf(0x12f)],_0x10fcd8+=_0x14ae79[_0x1937bf(0x12d)],_0xa866d3+=_0x14ae79[_0x1937bf(0x123)];}}return{'folders':_0x4ed60b,'segments':_0x10fcd8,'journeys':_0xa866d3};},_0x3d0fa5=_0x1a110e(_0x508fe1);console[_0x38765c(0x113)](_0x38765c(0x13c)+_0x3d0fa5['folders']+_0x38765c(0x124)+(_0x3d0fa5[_0x38765c(0x12f)]!==0x1?'s':'')+',\x20'+_0x3d0fa5[_0x38765c(0x12d)]+_0x38765c(0x13e)+(_0x3d0fa5[_0x38765c(0x12d)]!==0x1?'s':'')+_0x38765c(0x12e)+_0x3d0fa5[_0x38765c(0x123)]+_0x38765c(0x13b)+(_0x3d0fa5[_0x38765c(0x123)]!==0x1?'s':''));const _0x10d9c2=_0x2c657b=>{const _0x37c339=_0x38765c;return getConsoleNextUrl(_0x25492b['site'],_0x37c339(0x11e)+_0x3885dd[_0x37c339(0x11c)]+_0x37c339(0x114)+_0x2c657b);},_0x202597=_0x31464a=>{const _0x13a2bc=_0x38765c;return getConsoleNextUrl(_0x25492b[_0x13a2bc(0x106)],_0x13a2bc(0x11e)+_0x3885dd[_0x13a2bc(0x11c)]+_0x13a2bc(0x114)+_0x31464a+_0x13a2bc(0x120));};if(_0x25492b[_0x38765c(0x11f)]==='json'||_0x25492b[_0x38765c(0x11f)]===_0x38765c(0x138))await handleSDKOutput(_0x508fe1,_0x25492b);else{console[_0x38765c(0x14b)](a45_0x3ffe80[_0x38765c(0x13d)]('['+_0x38d536+']'));const _0x2d5a7e=formatTree(_0x508fe1,{'showMetadata':!![],'getSegmentUrl':_0x10d9c2,'getJourneyUrl':_0x202597});console[_0x38765c(0x14b)](_0x2d5a7e);}return 0x0;}}
|
package/dist/commands/show.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a46_0x15ff6f=a46_0x1108;(function(_0x1f64e7,_0x12b0b9){const _0x26d139=a46_0x1108,_0xab0aec=_0x1f64e7();while(!![]){try{const _0x4be7e9=-parseInt(_0x26d139(0x12f))/0x1+-parseInt(_0x26d139(0x10b))/0x2+-parseInt(_0x26d139(0x12c))/0x3+parseInt(_0x26d139(0x11b))/0x4+-parseInt(_0x26d139(0x11a))/0x5+parseInt(_0x26d139(0x10f))/0x6*(-parseInt(_0x26d139(0x115))/0x7)+parseInt(_0x26d139(0x10d))/0x8;if(_0x4be7e9===_0x12b0b9)break;else _0xab0aec['push'](_0xab0aec['shift']());}catch(_0x1e287d){_0xab0aec['push'](_0xab0aec['shift']());}}}(a46_0x5079,0x2a329));function a46_0x1108(_0x240af6,_0x5263c4){_0x240af6=_0x240af6-0x10b;const _0x50792e=a46_0x5079();let _0x1108ad=_0x50792e[_0x240af6];return _0x1108ad;}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../core/command-output.js';import{parseTableReference,validateTableDescribeReference}from'../utils/table-ref-parser.js';import{withSpinner}from'../utils/spinner.js';function a46_0x5079(){const _0x5ec0a6=['site','cause','args','Error:\x20','catalog','Database:\x20','Table:\x20','Querying\x20','851025JqKDpf','error','\x20\x20Cause:\x20','184298xAFTQU','data','Usage:\x20tdx\x20show\x20<database.table>','query','verbose','532422yJzukY','\x20\x20\x20or:\x20tdx\x20show\x20<catalog.database.table>','6918640aLwadU','table','28662YfRBLZ','...','✔\x20Retrieved\x20','database','name','message','42UDnkrX','length','Site:\x20','showTable','\x20row','1168640POgwun','1218340mJflxX','description','limit','Catalog:\x20','Too\x20many\x20arguments\x0aUsage:\x20tdx\x20show\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--database\x20<database>\x0a\x0aRun\x20\x27tdx\x20show\x20--help\x27\x20for\x20more\x20options','validate','\x20from\x20','\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--database\x20<database>','show'];a46_0x5079=function(){return _0x5ec0a6;};return a46_0x5079();}import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';export class ShowCommand extends BaseCommand{[a46_0x15ff6f(0x113)]=a46_0x15ff6f(0x123);[a46_0x15ff6f(0x11c)]='Show\x20table\x20contents';async['execute'](_0x1f31d1){const _0x5bd0c3=a46_0x15ff6f;return this[_0x5bd0c3(0x118)](_0x1f31d1);}async['showTable'](_0x48028e){const _0x18bbd3=a46_0x15ff6f,{options:_0x587392,args:_0x496cd1,tdx:_0x31a734}=_0x48028e;let _0x385390;try{_0x385390=parseTableReference(_0x496cd1[0x0]);const _0x1370bf=_0x587392[_0x18bbd3(0x112)];!_0x385390[_0x18bbd3(0x112)]&&_0x1370bf&&(_0x385390[_0x18bbd3(0x112)]=_0x1370bf);const _0x4efd81=validateTableDescribeReference(_0x385390);if(_0x4efd81)return console[_0x18bbd3(0x12d)](_0x18bbd3(0x127)+_0x4efd81),console[_0x18bbd3(0x12d)](_0x18bbd3(0x131)),console[_0x18bbd3(0x12d)](_0x18bbd3(0x10c)),console['error'](_0x18bbd3(0x122)),0x1;}catch(_0x515241){return console['error'](_0x18bbd3(0x127)+_0x515241['message']),console[_0x18bbd3(0x12d)]('Usage:\x20tdx\x20show\x20<database.table>'),console[_0x18bbd3(0x12d)]('\x20\x20\x20or:\x20tdx\x20show\x20<catalog.database.table>'),console[_0x18bbd3(0x12d)](_0x18bbd3(0x122)),0x1;}const _0x3bb6b4=_0x385390[_0x18bbd3(0x128)],_0x3bf2a5=_0x385390[_0x18bbd3(0x112)],_0x566177=_0x385390[_0x18bbd3(0x10e)],_0x3833b8=resolveLimit(_0x587392[_0x18bbd3(0x11d)],DEFAULT_DISPLAY_LIMIT);try{_0x587392[_0x18bbd3(0x133)]&&(console[_0x18bbd3(0x12d)](_0x18bbd3(0x117)+_0x587392[_0x18bbd3(0x124)]),_0x3bb6b4&&console['error'](_0x18bbd3(0x11e)+_0x3bb6b4),console[_0x18bbd3(0x12d)](_0x18bbd3(0x129)+_0x3bf2a5),console[_0x18bbd3(0x12d)](_0x18bbd3(0x12a)+_0x566177),console[_0x18bbd3(0x12d)]('Limit:\x20'+_0x3833b8));const _0x2c4b8c=_0x3bb6b4?_0x3bb6b4+'.'+_0x3bf2a5+'.'+_0x566177:_0x3bf2a5+'.'+_0x566177,_0x512761=await withSpinner(_0x18bbd3(0x12b)+_0x2c4b8c+_0x18bbd3(0x110),()=>_0x31a734[_0x18bbd3(0x132)][_0x18bbd3(0x118)](_0x3bf2a5,_0x566177,_0x3833b8,_0x3bb6b4),{'verbose':_0x587392[_0x18bbd3(0x133)]}),_0x4ec12c=_0x512761['data'],_0x1b34d9=_0x4ec12c[_0x18bbd3(0x130)];return _0x1b34d9[_0x18bbd3(0x116)]===0x0?console[_0x18bbd3(0x12d)]('✔\x20Query\x20successful\x20-\x200\x20rows\x20returned'):console[_0x18bbd3(0x12d)](_0x18bbd3(0x111)+_0x1b34d9['length']+_0x18bbd3(0x119)+(_0x1b34d9[_0x18bbd3(0x116)]!==0x1?'s':'')+_0x18bbd3(0x121)+_0x2c4b8c),await handleSDKOutput(_0x1b34d9,_0x587392),0x0;}catch(_0x263fc2){if(_0x263fc2 instanceof SDKError)return console[_0x18bbd3(0x12d)](_0x18bbd3(0x127)+_0x263fc2[_0x18bbd3(0x114)]),_0x263fc2[_0x18bbd3(0x125)]&&console[_0x18bbd3(0x12d)](_0x18bbd3(0x12e)+_0x263fc2['cause']),0x1;throw _0x263fc2;}}[a46_0x15ff6f(0x120)](_0x960bd4){const _0x45bd54=a46_0x15ff6f;if(_0x960bd4['args'][_0x45bd54(0x116)]===0x0)return'Usage:\x20tdx\x20show\x20<database.table>\x0a\x20\x20\x20or:\x20tdx\x20show\x20<catalog.database.table>\x0a\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--database\x20<database>\x0a\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--in\x20<database>\x0a\x0aRun\x20\x27tdx\x20show\x20--help\x27\x20for\x20more\x20options';if(_0x960bd4[_0x45bd54(0x126)][_0x45bd54(0x116)]>0x1)return _0x45bd54(0x11f);return undefined;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a47_0x40b47d=a47_0x5a2e;(function(_0x3fd9c8,_0x129a53){const _0x5a7930=a47_0x5a2e,_0x5e5cf0=_0x3fd9c8();while(!![]){try{const _0x36713e=-parseInt(_0x5a7930(0x197))/0x1*(-parseInt(_0x5a7930(0x196))/0x2)+-parseInt(_0x5a7930(0x1aa))/0x3+-parseInt(_0x5a7930(0x1ab))/0x4*(-parseInt(_0x5a7930(0x19d))/0x5)+parseInt(_0x5a7930(0x19b))/0x6*(-parseInt(_0x5a7930(0x1b6))/0x7)+-parseInt(_0x5a7930(0x1a6))/0x8+parseInt(_0x5a7930(0x1a2))/0x9+-parseInt(_0x5a7930(0x1a3))/0xa;if(_0x36713e===_0x129a53)break;else _0x5e5cf0['push'](_0x5e5cf0['shift']());}catch(_0x7c5398){_0x5e5cf0['push'](_0x5e5cf0['shift']());}}}(a47_0x59a8,0xa8229));import{BaseCommand,printAuthError}from'./command.js';import{resolveAPIKeyAsync}from'../core/config.js';function a47_0x5a2e(_0x595c31,_0x1fd125){_0x595c31=_0x595c31-0x192;const _0x59a8c8=a47_0x59a8();let _0x5a2e0a=_0x59a8c8[_0x595c31];return _0x5a2e0a;}function a47_0x59a8(){const _0x339334=['env','1385wvpkin','✓\x20Authentication\x20successful\x0a','config','\x20profile:\x20','bold','11583135aogvBG','2335670zvjkEu','profileSource','join','7718848vcMXaC','CLI\x20flag','log','last_name','3155808ctXoeR','17332qqHUHq','first_name','status','Show\x20authentication\x20status\x20and\x20current\x20context','green','Credential\x20type:\x20','cli','Read\x20credential\x20from\x20','TDX_PROFILE\x20env','site','profile','101003rseKvo','email','execute','Name:','session','account_id','displayWithSources','getUserInfo','Account\x20ID:','yellow','tdx','description','red','message','filter','242fMniYt','3853zjCDlP','dim','error','cyan','6ISndfq'];a47_0x59a8=function(){return _0x339334;};return a47_0x59a8();}import{getOAuthTokens}from'../core/oauth-keychain.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{GlobalContext}from'../core/global-context.js';import a47_0x3eb86c from'chalk';export class StatusCommand extends BaseCommand{['name']='status';[a47_0x40b47d(0x192)]=a47_0x40b47d(0x1ae);async[a47_0x40b47d(0x1b8)](_0x1ccc98){const _0x5dbfa0=a47_0x40b47d,{options:_0x541a45,tdx:_0x1cf898}=_0x1ccc98,_0x144363=_0x541a45[_0x5dbfa0(0x1b4)],_0x4367dc=new GlobalContext(_0x541a45),_0x2148cf=_0x4367dc[_0x5dbfa0(0x1b5)],_0x538b1f=_0x4367dc[_0x5dbfa0(0x1a4)],_0x5a69f7=_0x538b1f===_0x5dbfa0(0x1b1)?_0x5dbfa0(0x1a7):_0x538b1f===_0x5dbfa0(0x1ba)?_0x5dbfa0(0x1ba):_0x538b1f===_0x5dbfa0(0x19c)?_0x5dbfa0(0x1b3):_0x538b1f===_0x5dbfa0(0x19f)?_0x5dbfa0(0x19f):null,_0x38da35=_0x2148cf?a47_0x3eb86c[_0x5dbfa0(0x19a)](_0x2148cf):a47_0x3eb86c[_0x5dbfa0(0x198)]('N/A'),_0x170e59=_0x5a69f7?'\x20'+a47_0x3eb86c[_0x5dbfa0(0x198)]('(from\x20'+_0x5a69f7+')'):'';console[_0x5dbfa0(0x1a8)](a47_0x3eb86c['bold'](_0x5dbfa0(0x1c0))+_0x5dbfa0(0x1a0)+_0x38da35+_0x170e59+'\x20'+a47_0x3eb86c['dim']('(')+'site:\x20'+a47_0x3eb86c[_0x5dbfa0(0x19a)](_0x144363)+a47_0x3eb86c[_0x5dbfa0(0x198)](')'));const _0x5ccaa7=await getOAuthTokens(_0x2148cf);if(_0x5ccaa7)console[_0x5dbfa0(0x1a8)](_0x5dbfa0(0x1b0)+a47_0x3eb86c[_0x5dbfa0(0x19a)]('OAuth'));else{const _0x24f9a7=await resolveAPIKeyAsync(_0x144363,_0x2148cf);if(_0x24f9a7){const {source:_0x39cd4e,isDeprecated:_0x328d68}=_0x24f9a7,_0x3ed589=_0x5dbfa0(0x1b2)+a47_0x3eb86c[_0x5dbfa0(0x19a)](_0x39cd4e);console[_0x5dbfa0(0x1a8)](_0x328d68?a47_0x3eb86c[_0x5dbfa0(0x1bf)](_0x3ed589):_0x3ed589);}else console['log'](a47_0x3eb86c[_0x5dbfa0(0x1bf)]('No\x20credential\x20found'));}let _0x29407a=![];try{const _0x5690ff=await _0x1cf898['jobs'][_0x5dbfa0(0x1bd)]();console[_0x5dbfa0(0x1a8)](a47_0x3eb86c[_0x5dbfa0(0x1af)](_0x5dbfa0(0x19e))),console[_0x5dbfa0(0x1a8)](a47_0x3eb86c[_0x5dbfa0(0x1a1)]('User:')+'\x20'+a47_0x3eb86c[_0x5dbfa0(0x19a)](_0x5690ff[_0x5dbfa0(0x1b7)]));if(_0x5690ff['first_name']||_0x5690ff['last_name']){const _0x48df75=[_0x5690ff[_0x5dbfa0(0x1ac)],_0x5690ff[_0x5dbfa0(0x1a9)]][_0x5dbfa0(0x195)](Boolean)[_0x5dbfa0(0x1a5)]('\x20');console[_0x5dbfa0(0x1a8)](a47_0x3eb86c[_0x5dbfa0(0x1a1)](_0x5dbfa0(0x1b9))+'\x20'+_0x48df75);}_0x5690ff['account_id']&&console[_0x5dbfa0(0x1a8)](a47_0x3eb86c['bold'](_0x5dbfa0(0x1be))+'\x20'+a47_0x3eb86c[_0x5dbfa0(0x1bf)](_0x5690ff[_0x5dbfa0(0x1bb)])),_0x29407a=!![];}catch(_0x30a51e){_0x30a51e instanceof HTTPClientError&&_0x30a51e[_0x5dbfa0(0x1ad)]===0x191?printAuthError(_0x30a51e,!![],_0x2148cf):console[_0x5dbfa0(0x199)](a47_0x3eb86c[_0x5dbfa0(0x193)]('✗\x20Validation\x20failed:\x20'+(_0x30a51e instanceof Error?_0x30a51e[_0x5dbfa0(0x194)]:String(_0x30a51e))));}return console[_0x5dbfa0(0x1a8)](),_0x4367dc[_0x5dbfa0(0x1bc)](),_0x29407a?0x0:0x1;}}
|