@treasuredata/tdx 2026.3.42 → 2026.3.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.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/auth-login-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/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/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 +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a41_0x331929=a41_0x112b;function a41_0x112b(_0x2c213d,_0xe47294){_0x2c213d=_0x2c213d-0x1d7;const _0x4b0e7e=a41_0x4b0e();let _0x112b6a=_0x4b0e7e[_0x2c213d];return _0x112b6a;}(function(_0x344a47,_0xbd5295){const _0xc7a998=a41_0x112b,_0x4866bb=_0x344a47();while(!![]){try{const _0x3f1ad1=-parseInt(_0xc7a998(0x1ec))/0x1+parseInt(_0xc7a998(0x1e3))/0x2*(parseInt(_0xc7a998(0x202))/0x3)+-parseInt(_0xc7a998(0x1fa))/0x4*(-parseInt(_0xc7a998(0x1fe))/0x5)+-parseInt(_0xc7a998(0x217))/0x6*(parseInt(_0xc7a998(0x1ee))/0x7)+parseInt(_0xc7a998(0x21b))/0x8*(parseInt(_0xc7a998(0x1f4))/0x9)+parseInt(_0xc7a998(0x219))/0xa+-parseInt(_0xc7a998(0x224))/0xb;if(_0x3f1ad1===_0xbd5295)break;else _0x4866bb['push'](_0x4866bb['shift']());}catch(_0x337200){_0x4866bb['push'](_0x4866bb['shift']());}}}(a41_0x4b0e,0xc5155));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';function a41_0x4b0e(){const _0x4a8e8d=['yes','Aborted.','\x20files?','cyan','no_parent','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','dirname','✔\x20Context\x20set:\x20','site','message','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','Parent\x20segment:\x20','red','files','parent_segment','filter','\x20\x20🗺️\x20\x20','\x20new\x20files','\x27...','\x20\x20🎯\x20','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','3544fAqqSk','setPhase','\x0aPull\x20summary\x20for\x20\x27','\x0aError:','targetDir','\x20files\x20to\x20','isNew','\x20with\x20','Pulling\x20segments\x20from\x20\x27','1124088odekNL','parentSegment','265027QjHDMd','hasChanges','verbose','diff','\x20versions)','segments','10877562anwmGU','errorCode','dim','file','activations','yellow','1345468uJMUcE','segment:pull','\x20unchanged\x20files','✔\x20All\x20files\x20are\x20up\x20to\x20date','5afUfiS','error','Write\x20','Site:\x20','813SafJYp','description','absolutePath','dryRun','Error:\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','relativePath','\x0aChanges\x20to\x20\x27','counts','Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','journeys','repeat','execute','parentName','Target\x20resource:\x20','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','resourceName','\x20activations','\x20changed\x20files','6sxrrpA','session','7048470LSDcBV','\x20segments','8ZYDkwe','segment','journeyVersions','green','\x20=\x20','utf-8','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','length','type','8369262XucTtS','✔\x20Pulled\x20'];a41_0x4b0e=function(){return _0x4a8e8d;};return a41_0x4b0e();}import a41_0x44fc9b from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a41_0x4b52fd 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']=a41_0x331929(0x1fb);[a41_0x331929(0x203)]=a41_0x331929(0x221);async[a41_0x331929(0x210)](_0x2aa336){const _0xf65477=a41_0x331929,{options:_0x116cec,args:_0x387e68,tdx:_0x158e0d}=_0x2aa336,_0x282f1f=_0x116cec,_0x2e41bf=await resolveTarget({'arg':_0x387e68[0x0],'contextParent':_0x116cec[_0xf65477(0x1ed)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x2e41bf))return _0x2e41bf[_0xf65477(0x1f5)]===_0xf65477(0x22a)?(console[_0xf65477(0x1ff)](a41_0x44fc9b[_0xf65477(0x1f9)](_0xf65477(0x207))),console[_0xf65477(0x1ff)](_0xf65477(0x20c)),console[_0xf65477(0x1ff)](_0xf65477(0x20d)),console[_0xf65477(0x1ff)](_0xf65477(0x208))):(console[_0xf65477(0x1ff)](a41_0x44fc9b[_0xf65477(0x1da)](_0xf65477(0x206)+_0x2e41bf[_0xf65477(0x1d7)]+'\x0a')),_0x2e41bf['helpText']&&console[_0xf65477(0x1ff)](a41_0x44fc9b[_0xf65477(0x229)](_0x2e41bf['helpText']))),0x1;const _0x5d0942=_0x2e41bf[_0xf65477(0x211)],_0x5e0f10=_0x2e41bf[_0xf65477(0x1e7)],_0x589c75=_0x2e41bf[_0xf65477(0x223)]===_0xf65477(0x1f7)?_0x2e41bf[_0xf65477(0x214)]:undefined;_0x282f1f[_0xf65477(0x1f0)]&&(console['error'](_0xf65477(0x201)+_0x282f1f[_0xf65477(0x22e)]),console[_0xf65477(0x1ff)](_0xf65477(0x1d9)+_0x5d0942),_0x589c75&&console[_0xf65477(0x1ff)](_0xf65477(0x212)+_0x589c75));const _0x3989f2=await withProgressSpinner(_0xf65477(0x1eb)+_0x5d0942+_0xf65477(0x1e0),_0x481f39=>_0x158e0d[_0xf65477(0x21c)]['pullSegments'](_0x5d0942,{'targetDir':_0x5e0f10,'targetResourceName':_0x589c75,'verbose':_0x282f1f['verbose'],'progress':{'update':_0x517b0c=>{const _0x1bd92a=_0xf65477;_0x481f39[_0x1bd92a(0x1e4)](_0x517b0c),_0x282f1f[_0x1bd92a(0x1f0)]&&console['error']('\x20\x20'+_0x517b0c);}}}),{'verbose':_0x282f1f[_0xf65477(0x1f0)]}),_0x43704a=_0x3989f2['data'];if(_0x43704a[_0xf65477(0x20b)][_0xf65477(0x1f3)]===0x0&&_0x43704a[_0xf65477(0x20b)][_0xf65477(0x20e)]===0x0)return console['error'](a41_0x44fc9b[_0xf65477(0x1f9)](_0xf65477(0x213)+_0x43704a[_0xf65477(0x211)]+'\x27')),0x0;const _0x48484b=_0x43704a['files'][_0xf65477(0x1dd)](_0x23b45d=>_0x23b45d[_0xf65477(0x1e9)]),_0x507226=_0x43704a[_0xf65477(0x1db)]['filter'](_0x1ef5c2=>!_0x1ef5c2['isNew']&&_0x1ef5c2[_0xf65477(0x1ef)]),_0x349312=_0x43704a['files'][_0xf65477(0x1dd)](_0x6fcb60=>!_0x6fcb60[_0xf65477(0x1e9)]&&!_0x6fcb60[_0xf65477(0x1ef)]);console[_0xf65477(0x1ff)](_0xf65477(0x1e5)+_0x43704a[_0xf65477(0x211)]+'\x27:'),console['error'](_0xf65477(0x1e1)+a41_0x44fc9b[_0xf65477(0x229)](_0x43704a[_0xf65477(0x20b)][_0xf65477(0x1f3)]+_0xf65477(0x21a))+_0xf65477(0x1ea)+a41_0x44fc9b[_0xf65477(0x229)](_0x43704a[_0xf65477(0x20b)][_0xf65477(0x1f8)]+_0xf65477(0x215)));if(_0x43704a[_0xf65477(0x20b)][_0xf65477(0x20e)]>0x0){const _0x5cbe30=_0x43704a['counts'][_0xf65477(0x21d)]>_0x43704a[_0xf65477(0x20b)]['journeys']?'\x20('+_0x43704a['counts'][_0xf65477(0x21d)]+_0xf65477(0x1f2):'';console[_0xf65477(0x1ff)](_0xf65477(0x1de)+a41_0x44fc9b[_0xf65477(0x229)](_0x43704a[_0xf65477(0x20b)][_0xf65477(0x20e)]+'\x20journeys')+a41_0x44fc9b[_0xf65477(0x1f6)](_0x5cbe30));}console['error']('\x20\x20'+a41_0x44fc9b[_0xf65477(0x21e)]('+\x20'+_0x48484b[_0xf65477(0x222)]+_0xf65477(0x1df))),console[_0xf65477(0x1ff)]('\x20\x20'+a41_0x44fc9b['yellow']('~\x20'+_0x507226[_0xf65477(0x222)]+_0xf65477(0x216))),console[_0xf65477(0x1ff)]('\x20\x20'+a41_0x44fc9b[_0xf65477(0x1f6)]('=\x20'+_0x349312[_0xf65477(0x222)]+_0xf65477(0x1fc))),console[_0xf65477(0x1ff)]('\x20\x20Target:\x20'+a41_0x44fc9b[_0xf65477(0x229)](_0x43704a['targetDir'])+'\x0a');if(_0x507226[_0xf65477(0x222)]>0x0)for(const _0x398054 of _0x507226){console[_0xf65477(0x1ff)](_0xf65477(0x20a)+_0x398054[_0xf65477(0x209)]+'\x27:'),console[_0xf65477(0x1ff)]('─'[_0xf65477(0x20f)](0x3c)),console[_0xf65477(0x1ff)](_0x398054[_0xf65477(0x1f1)]),console['error']('─'[_0xf65477(0x20f)](0x3c));}if(_0x282f1f[_0xf65477(0x205)])return console['error'](a41_0x44fc9b[_0xf65477(0x1f9)](_0xf65477(0x1d8))),0x0;if(_0x48484b[_0xf65477(0x222)]===0x0&&_0x507226[_0xf65477(0x222)]===0x0)return console[_0xf65477(0x1ff)](a41_0x44fc9b[_0xf65477(0x21e)](_0xf65477(0x1fd))),saveSessionContext({'parent_segment':_0x43704a[_0xf65477(0x211)]},_0x282f1f[_0xf65477(0x218)]),console[_0xf65477(0x1ff)](a41_0x44fc9b[_0xf65477(0x21e)](_0xf65477(0x22d)+a41_0x44fc9b['dim'](_0xf65477(0x1dc))+_0xf65477(0x21f)+a41_0x44fc9b[_0xf65477(0x229)](_0x43704a[_0xf65477(0x211)]))),0x0;if(!_0x282f1f[_0xf65477(0x226)]){if(!isInteractive())return console[_0xf65477(0x1ff)](a41_0x44fc9b[_0xf65477(0x1da)](_0xf65477(0x1e6)),_0xf65477(0x22b)),console[_0xf65477(0x1ff)](a41_0x44fc9b[_0xf65477(0x1f6)](_0xf65477(0x1e2))),0x1;const _0xd681b=await confirmKey(_0xf65477(0x200)+(_0x48484b['length']+_0x507226[_0xf65477(0x222)])+_0xf65477(0x228));if(!_0xd681b)return console[_0xf65477(0x1ff)](a41_0x44fc9b[_0xf65477(0x1f9)](_0xf65477(0x227)),'-\x20no\x20files\x20written'),0x1;}for(const _0x353d7e of _0x43704a[_0xf65477(0x1db)]){if(_0x353d7e[_0xf65477(0x1e9)]||_0x353d7e[_0xf65477(0x1ef)]){const _0x55617a=a41_0x4b52fd[_0xf65477(0x22c)](_0x353d7e['absolutePath']);!existsSync(_0x55617a)&&mkdirSync(_0x55617a,{'recursive':!![]}),writeFileSync(_0x353d7e[_0xf65477(0x204)],_0x353d7e['content'],_0xf65477(0x220));}}return console[_0xf65477(0x1ff)](a41_0x44fc9b[_0xf65477(0x21e)](_0xf65477(0x225)+(_0x48484b[_0xf65477(0x222)]+_0x507226[_0xf65477(0x222)])+_0xf65477(0x1e8)+_0x43704a[_0xf65477(0x1e7)])),saveSessionContext({'parent_segment':_0x43704a[_0xf65477(0x211)]},_0x282f1f[_0xf65477(0x218)]),console[_0xf65477(0x1ff)](a41_0x44fc9b[_0xf65477(0x21e)](_0xf65477(0x22d)+a41_0x44fc9b[_0xf65477(0x1f6)](_0xf65477(0x1dc))+_0xf65477(0x21f)+a41_0x44fc9b[_0xf65477(0x229)](_0x43704a[_0xf65477(0x211)]))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a42_0x4f09d1=a42_0x38c6;(function(_0x2e48dd,_0x764383){const _0x347e73=a42_0x38c6,_0xae7482=_0x2e48dd();while(!![]){try{const _0x37d277=-parseInt(_0x347e73(0x11c))/0x1*(parseInt(_0x347e73(0x18b))/0x2)+-parseInt(_0x347e73(0x14c))/0x3+parseInt(_0x347e73(0x13b))/0x4+parseInt(_0x347e73(0x123))/0x5+-parseInt(_0x347e73(0x145))/0x6+-parseInt(_0x347e73(0x114))/0x7+parseInt(_0x347e73(0x17a))/0x8;if(_0x37d277===_0x764383)break;else _0xae7482['push'](_0xae7482['shift']());}catch(_0xc06700){_0xae7482['push'](_0xae7482['shift']());}}}(a42_0x57ed,0xb16db));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 a42_0x38c6(_0x21e8cf,_0x5e8179){_0x21e8cf=_0x21e8cf-0xfd;const _0x57edd5=a42_0x57ed();let _0x38c652=_0x57edd5[_0x21e8cf];return _0x38c652;}import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';function a42_0x57ed(){const _0x124ce8=['journeys','Resolving\x20parent\x20segment\x20\x27','journeyId','5387yiDsVZ','cyan','Delete\x20segment:','getParent','\x20to\x20update','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','segment','4137415ZpsLdQ','\x0aError:','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','updatedAt','targetDir','updated','yes','\x20to\x20delete','\x20to\x20create','\x20\x20Activations:','isScoped','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','\x20new','nameToType','Fetching\x20existing\x20data...','\x20\x20Console\x20URL\x20(share\x20with\x20client):\x20','add','segments','toDelete','audienceId','/e/','connection','filter','dim','658596HPKfFX','yamlConfig','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','existingJourney','journeysOnly','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','push','toString','deleted','errorCode','911256SxmAfL','folderId','Parent\x20segment:\x20','new','listSegments','idToName','blue','3634023NSAbdJ','Site:\x20','endsWith','\x20unchanged','paused','/app/ps/','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','nameToId','data','listJourneysWithDetailsFromParentSegment','join','state','Preparing\x20journeys...','\x20changed','\x20\x20📊\x20Segments:','diff','toCreate','Error:\x20','red','Fetching\x20existing\x20activations...','dryRun','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','existingSegment','📁\x20','type','name','cwd','\x20folders\x20to\x20create','length','Error:\x20Directory\x20not\x20found:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','get','yellow','getOutputSchemaWithCache','\x0aPush\x20summary\x20for\x20\x27','delete','green','created','\x20\x20Segments:\x20','versionNumber','journeyBundleName','activations','parent_name','execute','\x20deleted','changed','17480264KuHrwq','\x20changes?','\x20created','(Journey\x20will\x20be\x20deleted)','\x20activations]','isNew','journey','then','Changes\x20to\x20journey:','\x0aValidation\x20failed:','message','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Delete\x20journey:','parentName','segmentFolderId','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','results','226ttMXup','\x20\x20Journeys:\x20','verbose','user','folderPath','description','listFolders','relationships','setPhase','repeat','site','\x20\x20Source:\x20','Changes\x20to:','Push\x20','\x20\x20Activations:\x20','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','\x20YAML\x20files\x20found','createdSegmentIds','.yml','set','parentFolder','\x27...','Error\x20parsing\x20YAML:\x20','toUpdate','Folders\x20to\x20create:','/sb/da/esr','\x20\x20\x20\x20','unchanged','\x20updated','/j/da/je','attributes','file','segment\x20or\x20journey','scopedFolderPath','error','Source\x20directory:\x20','3349290CwOTcy','Fetching\x20connections\x20for\x20name\x20resolution...','New\x20journey:','helpText','map'];a42_0x57ed=function(){return _0x124ce8;};return a42_0x57ed();}import a42_0x4a954e from'chalk';import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';import{buildFolderMaps}from'../sdk/segment/resolution-context.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{[a42_0x4f09d1(0x165)]='segment:push';[a42_0x4f09d1(0x190)]=a42_0x4f09d1(0x189);async[a42_0x4f09d1(0x177)](_0x515e43){const _0x4df836=a42_0x4f09d1,{options:_0x44e78c,args:_0x1dc3c8,tdx:_0x4f5d4d}=_0x515e43,_0x195602=_0x44e78c,_0x1ed6e9=await resolveTarget({'arg':_0x1dc3c8[0x0],'contextParent':_0x44e78c['parentSegment'],'cwd':process[_0x4df836(0x166)]()});if(!isSuccessfulResolution(_0x1ed6e9))return _0x1ed6e9[_0x4df836(0x144)]==='no_parent'?(console[_0x4df836(0x112)](a42_0x4a954e['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console['error']('Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)'),console[_0x4df836(0x112)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent'),console[_0x4df836(0x112)](_0x4df836(0x16a))):(console[_0x4df836(0x112)](a42_0x4a954e[_0x4df836(0x15e)](_0x4df836(0x15d)+_0x1ed6e9[_0x4df836(0x184)]+'\x0a')),_0x1ed6e9['helpText']&&console[_0x4df836(0x112)](a42_0x4a954e[_0x4df836(0x11d)](_0x1ed6e9[_0x4df836(0x117)]))),0x1;if(_0x1ed6e9[_0x4df836(0x164)]===_0x4df836(0x176))return console[_0x4df836(0x112)](a42_0x4a954e[_0x4df836(0x15e)](_0x4df836(0x169)+_0x1ed6e9[_0x4df836(0x127)]+'\x0a')),console['error'](a42_0x4a954e[_0x4df836(0x11d)](_0x4df836(0xff))),0x1;const _0x592980=_0x1ed6e9[_0x4df836(0x187)],_0x53fc09=_0x1ed6e9['targetDir'],_0xfcfcf=_0x1ed6e9[_0x4df836(0x164)]===_0x4df836(0x10f)?_0x1ed6e9['filePath']:undefined,_0x2b3e8d=getScopedDetails(_0x1ed6e9),_0x3acbfa=_0x2b3e8d?.[_0x4df836(0x12d)]??![],_0x4b9618=_0x2b3e8d?.[_0x4df836(0x111)]??'';if(!existsSync(_0x53fc09))return console[_0x4df836(0x112)](a42_0x4a954e[_0x4df836(0x15e)](_0x4df836(0x169)+_0x53fc09+'\x0a')),console['error'](a42_0x4a954e['cyan'](_0x4df836(0xff))),0x1;_0x195602[_0x4df836(0x18d)]&&(console['error'](_0x4df836(0x14d)+_0x195602[_0x4df836(0x195)]),console['error'](_0x4df836(0x147)+_0x592980),console[_0x4df836(0x112)](_0x4df836(0x113)+_0x53fc09),_0x3acbfa&&console[_0x4df836(0x112)]('Scoped\x20to\x20folder:\x20'+_0x4b9618));const _0x3681d3=await withSpinner(_0x4df836(0x11a)+_0x592980+_0x4df836(0x105),()=>_0x4f5d4d[_0x4df836(0x122)]['resolveParentId'](_0x592980),{'verbose':_0x195602[_0x4df836(0x18d)]}),_0x4018a7=_0x3681d3[_0x4df836(0x154)],{parentSegmentResult:_0x3fed4a,segmentsResult:_0xde7e5,foldersResult:_0x4a92d5,journeysWithDetailsResult:_0x2c0d7c,userMaps:_0x12d967}=await withSpinner(_0x4df836(0x131),async()=>{const _0x6b1afa=_0x4df836,[_0x1b1bd1,_0x73cda9,_0x202c82,_0x27fc6d,_0x8b1d11]=await Promise['all']([_0x4f5d4d[_0x6b1afa(0x122)][_0x6b1afa(0x11f)](_0x4018a7),_0x4f5d4d[_0x6b1afa(0x122)][_0x6b1afa(0x149)](_0x4018a7),_0x4f5d4d[_0x6b1afa(0x122)][_0x6b1afa(0x191)](_0x4018a7),_0x4f5d4d[_0x6b1afa(0x180)][_0x6b1afa(0x155)](_0x4018a7,{'includeAllVersions':!![]}),_0x4f5d4d[_0x6b1afa(0x18e)]['buildUserMaps']()]);return{'parentSegmentResult':_0x1b1bd1,'segmentsResult':_0x73cda9,'foldersResult':_0x202c82,'journeysWithDetailsResult':_0x27fc6d,'userMaps':_0x8b1d11};},{'verbose':_0x195602[_0x4df836(0x18d)]})[_0x4df836(0x181)](_0xd34474=>_0xd34474[_0x4df836(0x154)]),_0x40b36e=_0x3fed4a,_0xa6d8fe=extractRootFolderId(_0x40b36e),_0x331952=_0xde7e5,_0x173b2b=_0x4a92d5,{journeys:_0x19b84a,activationStepsById:_0xe2ca1c}=_0x2c0d7c,_0x2ab07a=new Map(_0x19b84a[_0x4df836(0x118)](_0x416a85=>[_0x416a85['id'],_0x416a85])),_0x549041=_0x19b84a['map'](_0x39243e=>({'id':_0x39243e['id'],'name':_0x39243e[_0x4df836(0x10e)]['name'],'journeyBundleName':_0x39243e['attributes']['journeyBundleName']||'','journeyBundleId':_0x39243e['attributes']['journeyBundleId']||'','versionNumber':_0x39243e[_0x4df836(0x10e)][_0x4df836(0x173)],'description':_0x39243e[_0x4df836(0x10e)][_0x4df836(0x190)],'state':_0x39243e['attributes'][_0x4df836(0x157)],'paused':_0x39243e['attributes'][_0x4df836(0x150)],'audienceId':_0x39243e[_0x4df836(0x10e)][_0x4df836(0x136)],'folderId':_0x39243e[_0x4df836(0x192)]?.[_0x4df836(0x104)]?.[_0x4df836(0x154)]?.['id'],'createdAt':_0x39243e[_0x4df836(0x10e)]['createdAt'],'updatedAt':_0x39243e[_0x4df836(0x10e)][_0x4df836(0x126)]})),{emailToId:_0x9c456b,idToEmail:_0x1edcab}=_0x12d967,_0x52a22b=await withSpinner(_0x4df836(0x115),async()=>{const _0x54a09c=_0x4df836,_0x5b1677=await _0x4f5d4d[_0x54a09c(0x138)]['list']();return buildConnectionMaps(_0x5b1677);},{'verbose':_0x195602[_0x4df836(0x18d)]})[_0x4df836(0x181)](_0x5cca38=>_0x5cca38[_0x4df836(0x154)]),_0x32f275=_0x52a22b[_0x4df836(0x153)],_0x1b645c=_0x52a22b['idToName'],_0x35e774=_0x52a22b[_0x4df836(0x130)],_0x157daf={'emailToIdMap':_0x9c456b,'connectionNameToIdMap':_0x32f275,'connectionNameToTypeMap':_0x35e774,'getSchema':_0x3620b7=>_0x4f5d4d[_0x4df836(0x138)][_0x4df836(0x16d)](_0x3620b7)};let {pathToId:_0x475d5f,idToPath:_0x307ff0}=buildFolderMaps(_0x173b2b);const _0x48ab81=buildSegmentLookupMap(_0x331952,_0x307ff0),_0x5aa587=buildSegmentNameToIdMap(_0x331952),_0x703a6e=buildJourneyBundleLookupMap(_0x549041,_0x307ff0);let _0x47915d;if(_0xfcfcf){if(!_0xfcfcf[_0x4df836(0x14e)](_0x4df836(0x102))&&!_0xfcfcf['endsWith']('.yaml'))return console[_0x4df836(0x112)](a42_0x4a954e[_0x4df836(0x15e)]('Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20'+_0xfcfcf+'\x0a')),0x1;_0x47915d=[_0xfcfcf];}else _0x47915d=findYamlFiles(_0x53fc09);if(_0x47915d[_0x4df836(0x168)]===0x0)return console[_0x4df836(0x112)](a42_0x4a954e['red']('Error:\x20No\x20YAML\x20files\x20found\x20in\x20'+_0x53fc09+'\x0a')),console[_0x4df836(0x112)](a42_0x4a954e[_0x4df836(0x11d)](_0x4df836(0x121))),0x1;let _0x25be79,_0x544b86;try{const _0x2c370c=parseAndClassifyYamlFiles(_0x47915d,_0x53fc09,{'skipSegments':_0x195602[_0x4df836(0x13f)]});_0x25be79=_0x2c370c[_0x4df836(0x134)],_0x544b86=_0x2c370c[_0x4df836(0x119)];const _0x2474e3=validateParsedFiles(_0x2c370c,_0x53fc09);if(_0x2474e3['length']>0x0)return console['error'](a42_0x4a954e[_0x4df836(0x15e)](_0x4df836(0x183))),console['error'](formatValidationErrors(_0x2474e3)),console['error'](a42_0x4a954e[_0x4df836(0x16c)](_0x4df836(0x161))),0x1;}catch(_0x301cbe){return console[_0x4df836(0x112)](a42_0x4a954e[_0x4df836(0x15e)](_0x4df836(0x106)+(_0x301cbe instanceof Error?_0x301cbe[_0x4df836(0x184)]:_0x301cbe))),0x1;}if(_0x25be79['length']===0x0&&_0x544b86[_0x4df836(0x168)]===0x0){const _0x5c05cd=_0x195602[_0x4df836(0x13f)]?_0x4df836(0x180):_0x4df836(0x110);return console['error'](a42_0x4a954e['yellow']('No\x20'+_0x5c05cd+_0x4df836(0x100))),0x0;}const _0x51b9db=new Map();_0x331952[_0x4df836(0x168)]>0x0&&!_0x195602['journeysOnly']&&await withSpinner(_0x4df836(0x15f),async()=>{await batchAsync(_0x331952,async _0x29f866=>{const _0x51fee0=a42_0x38c6,_0x47c98=await _0x4f5d4d[_0x51fee0(0x122)]['listActivations'](_0x4018a7,_0x29f866['id']);_0x51b9db[_0x51fee0(0x103)](_0x29f866['id'],_0x47c98);});},{'verbose':_0x195602[_0x4df836(0x18d)]});const {segmentFiles:_0x5865de,foldersToCreate:_0x37d742}=await prepareSegmentFiles(_0x25be79,{'segmentByFolderAndName':_0x48ab81,'activationsBySegmentId':_0x51b9db,'folderPathToId':_0x475d5f,'idToEmailMap':_0x1edcab,'connectionIdToNameMap':_0x1b645c},_0x157daf,_0x3acbfa,_0x4b9618),_0x4ddd4e=_0xfcfcf?[]:findSegmentsToDelete(_0x331952,_0x25be79[_0x4df836(0x118)](({yamlConfig:_0x7c9aaa,folderPath:_0x28a858})=>({'yamlConfig':_0x7c9aaa,'folderPath':resolveTDFolderPath(_0x28a858,_0x3acbfa,_0x4b9618)})),_0x307ff0,_0x4b9618,_0x3acbfa),{journeyFiles:_0x25e33c,foldersToCreate:_0x47bd69}=await withProgressSpinner(_0x4df836(0x158),async _0x1b7474=>prepareJourneyFiles(_0x544b86,{'fetchJourney':async _0x14e153=>_0x4f5d4d[_0x4df836(0x180)]['getJourney'](_0x14e153[_0x4df836(0x11b)]),'journeyBundlesByFolderAndName':_0x703a6e,'folderPathToId':_0x475d5f,'idToEmailMap':_0x1edcab,'connectionIdToNameMap':_0x1b645c,'existingSegments':_0x331952,'parentId':_0x4018a7,'deps':_0x4f5d4d,'progress':{'update':_0x549785=>{const _0x92a170=_0x4df836;_0x1b7474[_0x92a170(0x193)](_0x549785),_0x195602['verbose']&&console[_0x92a170(0x112)]('\x20\x20'+_0x549785);}},'journeyById':_0x2ab07a,'activationStepsById':_0xe2ca1c},_0x3acbfa,_0x4b9618),{'verbose':_0x195602['verbose']})[_0x4df836(0x181)](_0x2f2f06=>_0x2f2f06[_0x4df836(0x154)]);for(const _0x424b92 of _0x47bd69){_0x37d742[_0x4df836(0x133)](_0x424b92);}const _0x1b1432=_0xfcfcf?[]:findJourneysToDelete(_0x549041,_0x544b86[_0x4df836(0x118)](({yamlConfig:_0xf0410d,folderPath:_0x8e4405})=>({'yamlConfig':_0xf0410d,'folderPath':resolveTDFolderPath(_0x8e4405,_0x3acbfa,_0x4b9618)})),_0x307ff0,_0x4b9618,_0x3acbfa),_0x4e5854=calculatePushStats(_0x5865de,_0x25e33c,_0x37d742,_0x4ddd4e,_0x1b1432,!!_0x195602[_0x4df836(0x16f)],!!_0x195602[_0x4df836(0x13f)]),_0x4ed389=_0x4e5854[_0x4df836(0x134)]['new'],_0x337977=_0x4e5854['segments']['changed'],_0x4e31c7=_0x4e5854[_0x4df836(0x134)][_0x4df836(0x10b)],_0x10130a=_0x4e5854[_0x4df836(0x134)][_0x4df836(0x135)],_0xdcb498=_0x4e5854['folders'][_0x4df836(0x15c)],_0x2adaac=_0x4e5854[_0x4df836(0x119)][_0x4df836(0x148)],_0x20905d=_0x4e5854[_0x4df836(0x119)][_0x4df836(0x179)],_0x555731=_0x4e5854[_0x4df836(0x119)][_0x4df836(0x10b)],_0x3b0441=_0x4e5854[_0x4df836(0x119)][_0x4df836(0x135)],_0x3e734d=_0x4e5854[_0x4df836(0x175)]['all'],_0x56cad7=_0x4e5854[_0x4df836(0x175)]['toCreate'],_0x5c5615=_0x4e5854[_0x4df836(0x175)][_0x4df836(0x107)],_0x5ab814=_0x4e5854['activations'][_0x4df836(0x135)];console['error'](_0x4df836(0x16e)+_0x592980+'\x27:');_0xdcb498[_0x4df836(0x168)]>0x0&&console['error']('\x20\x20'+a42_0x4a954e[_0x4df836(0x14b)](_0x4df836(0x163)+_0xdcb498[_0x4df836(0x168)]+_0x4df836(0x167)));if(!_0x195602[_0x4df836(0x13f)]){console['error'](_0x4df836(0x15a)),console[_0x4df836(0x112)](_0x4df836(0x10a)+a42_0x4a954e[_0x4df836(0x170)]('+\x20'+_0x4ed389[_0x4df836(0x168)]+_0x4df836(0x12f))),console['error'](_0x4df836(0x10a)+a42_0x4a954e[_0x4df836(0x16c)]('~\x20'+_0x337977['length']+_0x4df836(0x159)));if(_0x10130a[_0x4df836(0x168)]>0x0)console[_0x4df836(0x112)](_0x4df836(0x10a)+a42_0x4a954e[_0x4df836(0x15e)]('-\x20'+_0x10130a[_0x4df836(0x168)]+'\x20to\x20delete'));else _0x4ddd4e['length']>0x0&&!_0x195602[_0x4df836(0x16f)]&&console[_0x4df836(0x112)](_0x4df836(0x10a)+a42_0x4a954e[_0x4df836(0x13a)](_0x4ddd4e[_0x4df836(0x168)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x4df836(0x112)](_0x4df836(0x10a)+a42_0x4a954e['dim']('=\x20'+_0x4e31c7[_0x4df836(0x168)]+'\x20unchanged'));}if(_0x25e33c[_0x4df836(0x168)]>0x0||_0x1b1432[_0x4df836(0x168)]>0x0){console[_0x4df836(0x112)]('\x20\x20🗺️\x20\x20Journeys:'),console[_0x4df836(0x112)](_0x4df836(0x10a)+a42_0x4a954e[_0x4df836(0x170)]('+\x20'+_0x2adaac['length']+_0x4df836(0x12f))),console[_0x4df836(0x112)]('\x20\x20\x20\x20'+a42_0x4a954e[_0x4df836(0x16c)]('~\x20'+_0x20905d[_0x4df836(0x168)]+'\x20changed'));if(_0x3b0441[_0x4df836(0x168)]>0x0)console[_0x4df836(0x112)](_0x4df836(0x10a)+a42_0x4a954e[_0x4df836(0x15e)]('-\x20'+_0x3b0441[_0x4df836(0x168)]+_0x4df836(0x12a)));else _0x1b1432['length']>0x0&&!_0x195602['delete']&&console['error']('\x20\x20\x20\x20'+a42_0x4a954e[_0x4df836(0x13a)](_0x1b1432[_0x4df836(0x168)]+_0x4df836(0x125)));console['error'](_0x4df836(0x10a)+a42_0x4a954e['dim']('=\x20'+_0x555731[_0x4df836(0x168)]+_0x4df836(0x14f)));}_0x3e734d[_0x4df836(0x168)]>0x0&&!_0x195602['journeysOnly']&&(console['error'](''),console[_0x4df836(0x112)](_0x4df836(0x12c)),_0x56cad7[_0x4df836(0x168)]>0x0&&console[_0x4df836(0x112)](_0x4df836(0x10a)+a42_0x4a954e[_0x4df836(0x170)]('+\x20'+_0x56cad7[_0x4df836(0x168)]+_0x4df836(0x12b))),_0x5c5615['length']>0x0&&console[_0x4df836(0x112)](_0x4df836(0x10a)+a42_0x4a954e['yellow']('~\x20'+_0x5c5615[_0x4df836(0x168)]+_0x4df836(0x120))),_0x5ab814[_0x4df836(0x168)]>0x0&&console[_0x4df836(0x112)]('\x20\x20\x20\x20'+a42_0x4a954e[_0x4df836(0x15e)]('-\x20'+_0x5ab814[_0x4df836(0x168)]+_0x4df836(0x12a))));console[_0x4df836(0x112)](_0x4df836(0x196)+a42_0x4a954e[_0x4df836(0x11d)](_0x53fc09)+'\x0a');if(_0xdcb498[_0x4df836(0x168)]>0x0){console[_0x4df836(0x112)](_0x4df836(0x108));for(const _0x192aa2 of _0xdcb498){console[_0x4df836(0x112)]('\x20\x20'+a42_0x4a954e[_0x4df836(0x14b)]('+')+'\x20'+_0x192aa2);}console['error']('');}if(_0x4ed389[_0x4df836(0x168)]>0x0&&!_0x195602[_0x4df836(0x13f)])for(const _0x31bedf of _0x4ed389){const _0x53a5d6=_0x31bedf['folderPath']?_0x31bedf[_0x4df836(0x18f)]+'/'+_0x31bedf['yamlConfig']['name']:_0x31bedf['yamlConfig']['name'],_0x203470=_0x31bedf[_0x4df836(0x13c)][_0x4df836(0x175)]?.[_0x4df836(0x168)]||0x0,_0x4a8b4f=_0x203470>0x0?a42_0x4a954e['dim']('\x20['+_0x203470+_0x4df836(0x17e)):'';console[_0x4df836(0x112)]('\x0a'+a42_0x4a954e[_0x4df836(0x170)]('New\x20segment:')+'\x20'+_0x53a5d6+_0x4a8b4f),console['error']('─'[_0x4df836(0x194)](0x3c)),_0x31bedf[_0x4df836(0x15b)]&&console[_0x4df836(0x112)](_0x31bedf['diff']),console[_0x4df836(0x112)]('─'[_0x4df836(0x194)](0x3c));}if(_0x10130a[_0x4df836(0x168)]>0x0&&!_0x195602[_0x4df836(0x13f)])for(const _0x3442a2 of _0x10130a){const _0x64e214=_0x3442a2[_0x4df836(0x188)]?_0x307ff0[_0x4df836(0x16b)](_0x3442a2[_0x4df836(0x188)][_0x4df836(0x142)]())||'':'',_0x57acdf=_0x64e214?_0x64e214+'/'+_0x3442a2[_0x4df836(0x165)]:_0x3442a2[_0x4df836(0x165)],_0x47c922=_0x51b9db[_0x4df836(0x16b)](_0x3442a2['id'])||[],_0x4a4f29=_0x47c922[_0x4df836(0x168)]>0x0?a42_0x4a954e[_0x4df836(0x13a)]('\x20['+_0x47c922['length']+'\x20activations]'):'';console[_0x4df836(0x112)]('\x0a'+a42_0x4a954e[_0x4df836(0x15e)](_0x4df836(0x11e))+'\x20'+_0x57acdf+_0x4a4f29),console['error']('─'[_0x4df836(0x194)](0x3c));const _0x5b4829=segmentWithActivationsToYaml(_0x3442a2,_0x47c922,undefined,_0x1edcab,_0x1b645c),_0x38f51a=segmentToYamlString(_0x5b4829),_0x1a3447=generateDiff(_0x38f51a,'');console['error'](formatDiffWithColors(_0x1a3447)),console[_0x4df836(0x112)]('─'[_0x4df836(0x194)](0x3c));}const _0x34dc68=_0x5865de[_0x4df836(0x139)](_0x1149c1=>!_0x1149c1[_0x4df836(0x17f)]&&_0x1149c1[_0x4df836(0x15b)]);if(_0x34dc68[_0x4df836(0x168)]>0x0&&!_0x195602['journeysOnly'])for(const _0x2f8168 of _0x34dc68){const _0x4b0b01=_0x2f8168['folderPath']?_0x2f8168[_0x4df836(0x18f)]+'/'+_0x2f8168[_0x4df836(0x13c)][_0x4df836(0x165)]:_0x2f8168[_0x4df836(0x13c)]['name'];console['error']('\x0a'+a42_0x4a954e['yellow'](_0x4df836(0x197))+'\x20'+_0x4b0b01),console[_0x4df836(0x112)]('─'[_0x4df836(0x194)](0x3c)),console[_0x4df836(0x112)](_0x2f8168[_0x4df836(0x15b)]),console[_0x4df836(0x112)]('─'['repeat'](0x3c));}if(_0x2adaac[_0x4df836(0x168)]>0x0)for(const _0x21661e of _0x2adaac){const _0x337fa5=_0x21661e['folderPath']?_0x21661e[_0x4df836(0x18f)]+'/'+_0x21661e[_0x4df836(0x13c)][_0x4df836(0x165)]:_0x21661e[_0x4df836(0x13c)]['name'];console['error']('\x0a'+a42_0x4a954e[_0x4df836(0x170)](_0x4df836(0x116))+'\x20'+_0x337fa5),console[_0x4df836(0x112)]('─'[_0x4df836(0x194)](0x3c)),_0x21661e[_0x4df836(0x15b)]&&console[_0x4df836(0x112)](_0x21661e[_0x4df836(0x15b)]),console[_0x4df836(0x112)]('─'[_0x4df836(0x194)](0x3c));}const _0x178af8=_0x25e33c[_0x4df836(0x139)](_0x49c598=>!_0x49c598[_0x4df836(0x17f)]&&_0x49c598[_0x4df836(0x15b)]);if(_0x178af8[_0x4df836(0x168)]>0x0)for(const _0x4e2726 of _0x178af8){const _0x398f6c=_0x4e2726['folderPath']?_0x4e2726['folderPath']+'/'+_0x4e2726[_0x4df836(0x13c)][_0x4df836(0x165)]:_0x4e2726[_0x4df836(0x13c)][_0x4df836(0x165)];console[_0x4df836(0x112)]('\x0a'+a42_0x4a954e[_0x4df836(0x16c)](_0x4df836(0x182))+'\x20'+_0x398f6c),console[_0x4df836(0x112)]('─'['repeat'](0x3c)),console[_0x4df836(0x112)](_0x4e2726[_0x4df836(0x15b)]),console[_0x4df836(0x112)]('─'[_0x4df836(0x194)](0x3c));}if(_0x3b0441['length']>0x0)for(const _0x3f4cbd of _0x3b0441){const _0x40c853=_0x3f4cbd['folderId']?_0x307ff0[_0x4df836(0x16b)](_0x3f4cbd[_0x4df836(0x146)])||'':'',_0x1656b5=_0x40c853?_0x40c853+'/'+_0x3f4cbd['journeyBundleName']:_0x3f4cbd[_0x4df836(0x174)];console[_0x4df836(0x112)]('\x0a'+a42_0x4a954e['red'](_0x4df836(0x186))+'\x20'+_0x1656b5),console[_0x4df836(0x112)]('─'['repeat'](0x3c)),console[_0x4df836(0x112)](a42_0x4a954e[_0x4df836(0x15e)](_0x4df836(0x17d))),console[_0x4df836(0x112)]('─'[_0x4df836(0x194)](0x3c));}if(_0x195602[_0x4df836(0x160)])return console[_0x4df836(0x112)](a42_0x4a954e[_0x4df836(0x16c)](_0x4df836(0x13d))),0x0;const _0x25352e=_0x195602[_0x4df836(0x13f)]?![]:_0x4ed389['length']>0x0||_0x337977[_0x4df836(0x168)]>0x0||_0x10130a[_0x4df836(0x168)]>0x0,_0x28b00e=_0x2adaac[_0x4df836(0x168)]>0x0||_0x20905d['length']>0x0||_0x3b0441[_0x4df836(0x168)]>0x0,_0x887ecf=_0x195602['journeysOnly']?![]:_0x3e734d[_0x4df836(0x168)]>0x0,_0x11c843=_0xdcb498[_0x4df836(0x168)]>0x0;if(!_0x25352e&&!_0x28b00e&&!_0x887ecf&&!_0x11c843){const _0x17835b=_0x195602['journeysOnly']?_0x4df836(0x140):_0x4df836(0x152);console[_0x4df836(0x112)](a42_0x4a954e[_0x4df836(0x170)](_0x17835b));if(_0xfcfcf&&_0x4e31c7[_0x4df836(0x168)]===0x1){const _0x38805c=_0x4e31c7[0x0];if(_0x38805c[_0x4df836(0x162)]?.['id']){const _0x2e3601=getConsoleNextUrl(_0x195602[_0x4df836(0x195)],_0x4df836(0x151)+_0x4018a7+_0x4df836(0x137)+_0x38805c[_0x4df836(0x162)]['id']+_0x4df836(0x109));console['error'](_0x4df836(0x132)+a42_0x4a954e[_0x4df836(0x11d)](_0x2e3601));}}if(_0xfcfcf&&_0x555731[_0x4df836(0x168)]===0x1){const _0x1db8a4=_0x555731[0x0];if(_0x1db8a4['existingJourney']?.['id']){const _0x2a8596=getConsoleNextUrl(_0x195602[_0x4df836(0x195)],_0x4df836(0x151)+_0x4018a7+_0x4df836(0x137)+_0x1db8a4[_0x4df836(0x13e)]['id']+_0x4df836(0x10d));console[_0x4df836(0x112)]('\x20\x20'+a42_0x4a954e[_0x4df836(0x11d)](_0x2a8596));}}return 0x0;}const _0x532839=_0x195602[_0x4df836(0x13f)]?_0x2adaac[_0x4df836(0x168)]+_0x20905d[_0x4df836(0x168)]+_0x3b0441[_0x4df836(0x168)]+_0xdcb498['length']:_0x4ed389[_0x4df836(0x168)]+_0x337977[_0x4df836(0x168)]+_0x10130a['length']+_0x2adaac['length']+_0x20905d[_0x4df836(0x168)]+_0x3b0441[_0x4df836(0x168)]+_0xdcb498[_0x4df836(0x168)]+_0x3e734d['length'];if(!_0x195602[_0x4df836(0x129)]&&_0x532839>0x0){if(!isInteractive())return console['error'](a42_0x4a954e[_0x4df836(0x15e)](_0x4df836(0x124)),_0x4df836(0x185)),console[_0x4df836(0x112)](a42_0x4a954e[_0x4df836(0x13a)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x51f514=await confirmKey(_0x4df836(0xfd)+_0x532839+_0x4df836(0x17b));if(!_0x51f514)return console['error'](a42_0x4a954e[_0x4df836(0x16c)]('Aborted.')),0x1;}const _0x1f063b={'withProgress':async(_0x32ca1c,_0x4dc049)=>{const _0x2f58dd=_0x4df836,_0x108a65=await withSpinner(_0x32ca1c,_0x4dc049,{'verbose':_0x195602[_0x2f58dd(0x18d)]});return{'data':_0x108a65[_0x2f58dd(0x154)]};},'logInfo':_0x480437=>console[_0x4df836(0x112)](a42_0x4a954e['blue']('✔\x20'+_0x480437)),'logSuccess':_0x4f782f=>console[_0x4df836(0x112)](a42_0x4a954e[_0x4df836(0x170)]('✔\x20'+_0x4f782f)),'logWarning':_0x34b8e7=>console['error'](a42_0x4a954e['yellow']('⚠\x20'+_0x34b8e7)),'logDeleted':_0x4cec15=>console[_0x4df836(0x112)](a42_0x4a954e[_0x4df836(0x15e)]('✔\x20'+_0x4cec15))},_0x2f7470={'segment':_0x4f5d4d['segment'],'journey':_0x4f5d4d['journey'],'user':_0x4f5d4d[_0x4df836(0x18e)],'connection':_0x4f5d4d[_0x4df836(0x138)]};_0xdcb498[_0x4df836(0x168)]>0x0&&(_0x475d5f=await executePushFolders(_0x2f7470,_0xdcb498,_0x475d5f,{'parentId':_0x4018a7},_0x1f063b));const _0x3bafa4={'rootFolderId':_0xa6d8fe,'folderPathToId':_0x475d5f,'folderIdToPath':_0x307ff0,'segmentNameToId':_0x5aa587,'activationsBySegmentId':_0x51b9db,'emailToIdMap':_0x9c456b,'idToEmailMap':_0x1edcab,'connectionNameToIdMap':_0x52a22b[_0x4df836(0x153)],'connectionIdToNameMap':_0x52a22b[_0x4df836(0x14a)],'connectionNameToTypeMap':_0x35e774},_0x16bf63=await executePushSegments(_0x2f7470,_0x195602[_0x4df836(0x13f)]?[]:_0x5865de,_0x3bafa4,{'parentId':_0x4018a7},_0x1f063b),_0x331f3c=_0x16bf63['created'],_0x2ab4c2=_0x16bf63['updated'],_0x55c698=_0x16bf63[_0x4df836(0x175)]['created'],_0x2ab76b=_0x16bf63['activations'][_0x4df836(0x128)],_0x4e5abc=_0x16bf63[_0x4df836(0x175)][_0x4df836(0x143)];let _0x963142;if(_0xfcfcf&&_0x5865de[_0x4df836(0x168)]===0x1){const _0x2190e9=_0x5865de[0x0];_0x963142=_0x2190e9[_0x4df836(0x162)]?.['id']??_0x16bf63[_0x4df836(0x101)][_0x4df836(0x16b)](_0x2190e9[_0x4df836(0x13c)][_0x4df836(0x165)]);}const _0x323d17=await executePushSegmentDeletions(_0x2f7470,_0x195602[_0x4df836(0x13f)]?[]:_0x10130a,_0x1f063b);let _0x3a38f2=0x0,_0x1f3150=0x0,_0x2c189c=0x0;const _0x8717cf=new Map(_0x5aa587);for(const [_0x22c53c,_0x773677]of _0x16bf63['createdSegmentIds']){_0x8717cf['set'](_0x22c53c,_0x773677);}if(_0x25e33c[_0x4df836(0x168)]>0x0){const _0x565528={..._0x3bafa4,'segmentNameToId':_0x8717cf,'existingSegments':_0x331952,'activationContext':_0x157daf},_0x1cad33=await executePushJourneys(_0x2f7470,_0x25e33c,_0x565528,{'parentId':_0x4018a7,'rootFolderId':_0xa6d8fe,'verbose':_0x195602['verbose']},_0x1f063b);_0x3a38f2=_0x1cad33[_0x4df836(0x171)],_0x1f3150=_0x1cad33[_0x4df836(0x128)];if(_0xfcfcf&&_0x1cad33[_0x4df836(0x18a)]['length']===0x1){const _0x359f04=_0x1cad33[_0x4df836(0x18a)][0x0];if(_0x359f04[_0x4df836(0x11b)]){const _0x455f10=getConsoleNextUrl(_0x195602[_0x4df836(0x195)],_0x4df836(0x151)+_0x4018a7+_0x4df836(0x137)+_0x359f04[_0x4df836(0x11b)]+_0x4df836(0x10d));console['error']('\x20\x20'+a42_0x4a954e[_0x4df836(0x11d)](_0x455f10));}}}for(const _0x567b54 of _0x3b0441){console[_0x4df836(0x112)](a42_0x4a954e[_0x4df836(0x16c)](_0x4df836(0x12e)+_0x567b54[_0x4df836(0x174)])),_0x2c189c++;}const _0x2bc30b=[];if(_0x331f3c>0x0)_0x2bc30b[_0x4df836(0x141)](_0x331f3c+'\x20created');if(_0x2ab4c2>0x0)_0x2bc30b[_0x4df836(0x141)](_0x2ab4c2+_0x4df836(0x10c));if(_0x323d17>0x0)_0x2bc30b[_0x4df836(0x141)](_0x323d17+'\x20deleted');const _0x296004=[];if(_0x3a38f2>0x0)_0x296004[_0x4df836(0x141)](_0x3a38f2+_0x4df836(0x17c));if(_0x1f3150>0x0)_0x296004['push'](_0x1f3150+_0x4df836(0x10c));if(_0x2c189c>0x0)_0x296004[_0x4df836(0x141)](_0x2c189c+'\x20deleted');const _0x48c2fc=[];if(_0x55c698>0x0)_0x48c2fc['push'](_0x55c698+'\x20created');if(_0x2ab76b>0x0)_0x48c2fc[_0x4df836(0x141)](_0x2ab76b+_0x4df836(0x10c));if(_0x4e5abc>0x0)_0x48c2fc[_0x4df836(0x141)](_0x4e5abc+_0x4df836(0x178));console[_0x4df836(0x112)](a42_0x4a954e[_0x4df836(0x170)]('\x0a✔\x20Push\x20complete'));_0x2bc30b['length']>0x0&&!_0x195602['journeysOnly']&&console[_0x4df836(0x112)](_0x4df836(0x172)+_0x2bc30b[_0x4df836(0x156)](',\x20'));_0x296004['length']>0x0&&console[_0x4df836(0x112)](_0x4df836(0x18c)+_0x296004[_0x4df836(0x156)](',\x20'));_0x48c2fc[_0x4df836(0x168)]>0x0&&!_0x195602['journeysOnly']&&console['error'](_0x4df836(0xfe)+_0x48c2fc[_0x4df836(0x156)](',\x20'));if(_0x963142){const _0x4dd2aa=getConsoleNextUrl(_0x195602['site'],_0x4df836(0x151)+_0x4018a7+'/e/'+_0x963142+'/sb/da/esr');console[_0x4df836(0x112)](_0x4df836(0x132)+a42_0x4a954e['cyan'](_0x4dd2aa));}return 0x0;}}
|
|
1
|
+
const a42_0xd75319=a42_0x3def;function a42_0x54a0(){const _0x21e2a6=['listSegments','parentSegment','no_parent','Parent\x20segment:\x20','toString','journeys','\x27...','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','deleted','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','/app/ps/','journey','14605rAncWI','execute','createdAt','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','\x20updated','existingJourney','error','scopedFolderPath','type','yellow','\x20folders\x20to\x20create','all','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)','endsWith','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','\x20unchanged','\x20\x20🗺️\x20\x20Journeys:','isScoped','\x0aError:','red','segments','journeysOnly','listFolders','journeyId','folderPath','delete','Push\x20','map','set','getOutputSchemaWithCache','1098abYbqO','journeyBundleName','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','parent_name','blue','2180962QKFIkD','segmentFolderId','\x0a✔\x20Push\x20complete','toDelete','length','listActivations','createdSegmentIds','74188MpfSiS','284222toIuRM','\x20to\x20update','data','/e/','.yaml','6lcqNGy','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','No\x20','connection','Error\x20parsing\x20YAML:\x20','segment:push','idToName','attributes','segment\x20or\x20journey','Site:\x20','Delete\x20journey:','\x20changed','\x20\x20Segments:\x20','user','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','Changes\x20to:','getJourney','helpText','segment','Scoped\x20to\x20folder:\x20','list','changed','existingSegment','versionNumber','yes','Source\x20directory:\x20','verbose','\x20activations]','folderId','2306736ylRAlw','filter','\x20\x20Source:\x20','\x20to\x20create','Error:\x20Directory\x20not\x20found:\x20','(Journey\x20will\x20be\x20deleted)','New\x20segment:','2UwOCpo','.yml','getParent','get','results','new','site','then','10587540lGzsLx','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','created','resolveParentId','file','description','\x20created','\x0aValidation\x20failed:','\x20YAML\x20files\x20found','\x20\x20Console\x20URL\x20(share\x20with\x20client):\x20','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','activations','/sb/da/esr','Fetching\x20existing\x20data...','nameToType','toCreate','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','cwd','repeat','/j/da/je','Changes\x20to\x20journey:','\x20\x20\x20\x20','green','targetDir','\x20\x20📊\x20Segments:','nameToId','dim','diff','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','unchanged','📁\x20','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','cyan','filePath','isNew','Resolving\x20parent\x20segment\x20\x27','Delete\x20segment:','journeyBundleId','push','yamlConfig','\x20\x20Journeys:\x20','listJourneysWithDetailsFromParentSegment','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','setPhase','\x20to\x20delete','name','6885513ClzWAd'];a42_0x54a0=function(){return _0x21e2a6;};return a42_0x54a0();}function a42_0x3def(_0x76d34,_0x55a369){_0x76d34=_0x76d34-0x19d;const _0x54a0cb=a42_0x54a0();let _0x3defec=_0x54a0cb[_0x76d34];return _0x3defec;}(function(_0xf776e5,_0x25c496){const _0x57deb3=a42_0x3def,_0x1cfe60=_0xf776e5();while(!![]){try{const _0x30789e=parseInt(_0x57deb3(0x1b0))/0x1*(parseInt(_0x57deb3(0x1d9))/0x2)+-parseInt(_0x57deb3(0x1b5))/0x3*(parseInt(_0x57deb3(0x1af))/0x4)+-parseInt(_0x57deb3(0x21c))/0x5*(-parseInt(_0x57deb3(0x1a2))/0x6)+-parseInt(_0x57deb3(0x1a8))/0x7+parseInt(_0x57deb3(0x1d2))/0x8+parseInt(_0x57deb3(0x20f))/0x9+-parseInt(_0x57deb3(0x1e1))/0xa;if(_0x30789e===_0x25c496)break;else _0x1cfe60['push'](_0x1cfe60['shift']());}catch(_0xc92eb){_0x1cfe60['push'](_0x1cfe60['shift']());}}}(a42_0x54a0,0x7176e));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors}from'../utils/diff.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a42_0x3c5463 from'chalk';import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';import{buildFolderMaps}from'../sdk/segment/resolution-context.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{[a42_0xd75319(0x20e)]=a42_0xd75319(0x1ba);[a42_0xd75319(0x1e6)]='Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments';async[a42_0xd75319(0x21d)](_0x392dda){const _0x1a33f7=a42_0xd75319,{options:_0x29cd20,args:_0x3d347e,tdx:_0x2dde80}=_0x392dda,_0x4d340f=_0x29cd20,_0x3bbf6f=await resolveTarget({'arg':_0x3d347e[0x0],'contextParent':_0x29cd20[_0x1a33f7(0x211)],'cwd':process[_0x1a33f7(0x1f2)]()});if(!isSuccessfulResolution(_0x3bbf6f))return _0x3bbf6f['errorCode']===_0x1a33f7(0x212)?(console['error'](a42_0x3c5463['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console['error'](_0x1a33f7(0x228)),console[_0x1a33f7(0x222)](_0x1a33f7(0x1e2)),console['error'](_0x1a33f7(0x1a5))):(console[_0x1a33f7(0x222)](a42_0x3c5463['red']('Error:\x20'+_0x3bbf6f['message']+'\x0a')),_0x3bbf6f[_0x1a33f7(0x1c6)]&&console[_0x1a33f7(0x222)](a42_0x3c5463['cyan'](_0x3bbf6f[_0x1a33f7(0x1c6)]))),0x1;if(_0x3bbf6f['type']===_0x1a33f7(0x1a6))return console[_0x1a33f7(0x222)](a42_0x3c5463[_0x1a33f7(0x22f)](_0x1a33f7(0x1d6)+_0x3bbf6f[_0x1a33f7(0x1f8)]+'\x0a')),console[_0x1a33f7(0x222)](a42_0x3c5463[_0x1a33f7(0x201)](_0x1a33f7(0x217))),0x1;const _0x359325=_0x3bbf6f['parentName'],_0x2cd4a3=_0x3bbf6f[_0x1a33f7(0x1f8)],_0x435d70=_0x3bbf6f[_0x1a33f7(0x224)]===_0x1a33f7(0x1e5)?_0x3bbf6f[_0x1a33f7(0x202)]:undefined,_0x7bf389=getScopedDetails(_0x3bbf6f),_0x42251f=_0x7bf389?.[_0x1a33f7(0x22d)]??![],_0x2332ce=_0x7bf389?.[_0x1a33f7(0x223)]??'';if(!existsSync(_0x2cd4a3))return console[_0x1a33f7(0x222)](a42_0x3c5463[_0x1a33f7(0x22f)](_0x1a33f7(0x1d6)+_0x2cd4a3+'\x0a')),console[_0x1a33f7(0x222)](a42_0x3c5463[_0x1a33f7(0x201)](_0x1a33f7(0x217))),0x1;_0x4d340f[_0x1a33f7(0x1cf)]&&(console['error'](_0x1a33f7(0x1be)+_0x4d340f[_0x1a33f7(0x1df)]),console[_0x1a33f7(0x222)](_0x1a33f7(0x213)+_0x359325),console['error'](_0x1a33f7(0x1ce)+_0x2cd4a3),_0x42251f&&console[_0x1a33f7(0x222)](_0x1a33f7(0x1c8)+_0x2332ce));const _0x10abf2=await withSpinner(_0x1a33f7(0x204)+_0x359325+_0x1a33f7(0x216),()=>_0x2dde80[_0x1a33f7(0x1c7)][_0x1a33f7(0x1e4)](_0x359325),{'verbose':_0x4d340f['verbose']}),_0x22be70=_0x10abf2[_0x1a33f7(0x1b2)],{parentSegmentResult:_0x454a2e,segmentsResult:_0x208d7b,foldersResult:_0x1d6564,journeysWithDetailsResult:_0x167436,userMaps:_0x246cd7}=await withSpinner(_0x1a33f7(0x1ee),async()=>{const _0x264082=_0x1a33f7,[_0x4fbc26,_0x2bb4f5,_0x43e6b0,_0x5bd72c,_0x557d11]=await Promise['all']([_0x2dde80[_0x264082(0x1c7)][_0x264082(0x1db)](_0x22be70),_0x2dde80[_0x264082(0x1c7)][_0x264082(0x210)](_0x22be70),_0x2dde80[_0x264082(0x1c7)][_0x264082(0x232)](_0x22be70),_0x2dde80[_0x264082(0x21b)][_0x264082(0x20a)](_0x22be70,{'includeAllVersions':!![]}),_0x2dde80['user']['buildUserMaps']()]);return{'parentSegmentResult':_0x4fbc26,'segmentsResult':_0x2bb4f5,'foldersResult':_0x43e6b0,'journeysWithDetailsResult':_0x5bd72c,'userMaps':_0x557d11};},{'verbose':_0x4d340f['verbose']})[_0x1a33f7(0x1e0)](_0x4db913=>_0x4db913[_0x1a33f7(0x1b2)]),_0xf24f16=_0x454a2e,_0x735174=extractRootFolderId(_0xf24f16),_0x4f809e=_0x208d7b,_0x2ed9cf=_0x1d6564,{journeys:_0x250726,activationStepsById:_0x4e6871}=_0x167436,_0x61c7cc=new Map(_0x250726['map'](_0x2ad10b=>[_0x2ad10b['id'],_0x2ad10b])),_0x4fc1ee=_0x250726[_0x1a33f7(0x19f)](_0x2a75ed=>({'id':_0x2a75ed['id'],'name':_0x2a75ed[_0x1a33f7(0x1bc)][_0x1a33f7(0x20e)],'journeyBundleName':_0x2a75ed[_0x1a33f7(0x1bc)][_0x1a33f7(0x1a3)]||'','journeyBundleId':_0x2a75ed['attributes'][_0x1a33f7(0x206)]||'','versionNumber':_0x2a75ed[_0x1a33f7(0x1bc)][_0x1a33f7(0x1cc)],'description':_0x2a75ed['attributes'][_0x1a33f7(0x1e6)],'state':_0x2a75ed[_0x1a33f7(0x1bc)]['state'],'paused':_0x2a75ed['attributes']['paused'],'audienceId':_0x2a75ed[_0x1a33f7(0x1bc)]['audienceId'],'folderId':_0x2a75ed['relationships']?.['parentFolder']?.[_0x1a33f7(0x1b2)]?.['id'],'createdAt':_0x2a75ed[_0x1a33f7(0x1bc)][_0x1a33f7(0x21e)],'updatedAt':_0x2a75ed[_0x1a33f7(0x1bc)]['updatedAt']})),{emailToId:_0xd16f6f,idToEmail:_0x27356f}=_0x246cd7,_0x1cd8d6=await withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',async()=>{const _0x558651=_0x1a33f7,_0x5a971c=await _0x2dde80[_0x558651(0x1b8)][_0x558651(0x1c9)]();return buildConnectionMaps(_0x5a971c);},{'verbose':_0x4d340f[_0x1a33f7(0x1cf)]})[_0x1a33f7(0x1e0)](_0x477299=>_0x477299['data']),_0x5b059c=_0x1cd8d6['nameToId'],_0x5ec192=_0x1cd8d6[_0x1a33f7(0x1bb)],_0x198695=_0x1cd8d6[_0x1a33f7(0x1ef)],_0x36f7e3={'emailToIdMap':_0xd16f6f,'connectionNameToIdMap':_0x5b059c,'connectionNameToTypeMap':_0x198695,'getSchema':_0xcca222=>_0x2dde80['connection'][_0x1a33f7(0x1a1)](_0xcca222)};let {pathToId:_0x557269,idToPath:_0x464e3c}=buildFolderMaps(_0x2ed9cf);const _0x128a89=buildSegmentLookupMap(_0x4f809e,_0x464e3c),_0x2d86f3=buildSegmentNameToIdMap(_0x4f809e),_0xaf1ce4=buildJourneyBundleLookupMap(_0x4fc1ee,_0x464e3c);let _0x583d8f;if(_0x435d70){if(!_0x435d70[_0x1a33f7(0x229)](_0x1a33f7(0x1da))&&!_0x435d70[_0x1a33f7(0x229)](_0x1a33f7(0x1b4)))return console['error'](a42_0x3c5463['red'](_0x1a33f7(0x1a4)+_0x435d70+'\x0a')),0x1;_0x583d8f=[_0x435d70];}else _0x583d8f=findYamlFiles(_0x2cd4a3);if(_0x583d8f[_0x1a33f7(0x1ac)]===0x0)return console['error'](a42_0x3c5463[_0x1a33f7(0x22f)](_0x1a33f7(0x21f)+_0x2cd4a3+'\x0a')),console[_0x1a33f7(0x222)](a42_0x3c5463[_0x1a33f7(0x201)](_0x1a33f7(0x1b6))),0x1;let _0x3cf55e,_0xc76e2d;try{const _0x3cd73a=parseAndClassifyYamlFiles(_0x583d8f,_0x2cd4a3,{'skipSegments':_0x4d340f['journeysOnly']});_0x3cf55e=_0x3cd73a['segments'],_0xc76e2d=_0x3cd73a[_0x1a33f7(0x215)];const _0x35f2f5=validateParsedFiles(_0x3cd73a,_0x2cd4a3);if(_0x35f2f5['length']>0x0)return console[_0x1a33f7(0x222)](a42_0x3c5463[_0x1a33f7(0x22f)](_0x1a33f7(0x1e8))),console[_0x1a33f7(0x222)](formatValidationErrors(_0x35f2f5)),console['error'](a42_0x3c5463[_0x1a33f7(0x225)](_0x1a33f7(0x200))),0x1;}catch(_0x3a7460){return console[_0x1a33f7(0x222)](a42_0x3c5463[_0x1a33f7(0x22f)](_0x1a33f7(0x1b9)+(_0x3a7460 instanceof Error?_0x3a7460['message']:_0x3a7460))),0x1;}if(_0x3cf55e[_0x1a33f7(0x1ac)]===0x0&&_0xc76e2d[_0x1a33f7(0x1ac)]===0x0){const _0x1d264f=_0x4d340f['journeysOnly']?'journey':_0x1a33f7(0x1bd);return console[_0x1a33f7(0x222)](a42_0x3c5463[_0x1a33f7(0x225)](_0x1a33f7(0x1b7)+_0x1d264f+_0x1a33f7(0x1e9))),0x0;}const _0x573e77=new Map();_0x4f809e[_0x1a33f7(0x1ac)]>0x0&&!_0x4d340f[_0x1a33f7(0x231)]&&await withSpinner('Fetching\x20existing\x20activations...',async()=>{await batchAsync(_0x4f809e,async _0x6a7fad=>{const _0xe309af=a42_0x3def,_0x1d120a=await _0x2dde80[_0xe309af(0x1c7)][_0xe309af(0x1ad)](_0x22be70,_0x6a7fad['id']);_0x573e77['set'](_0x6a7fad['id'],_0x1d120a);});},{'verbose':_0x4d340f[_0x1a33f7(0x1cf)]});const {segmentFiles:_0x6bacd7,foldersToCreate:_0x5a985a}=await prepareSegmentFiles(_0x3cf55e,{'segmentByFolderAndName':_0x128a89,'activationsBySegmentId':_0x573e77,'folderPathToId':_0x557269,'idToEmailMap':_0x27356f,'connectionIdToNameMap':_0x5ec192},_0x36f7e3,_0x42251f,_0x2332ce),_0x779cce=_0x435d70?[]:findSegmentsToDelete(_0x4f809e,_0x3cf55e[_0x1a33f7(0x19f)](({yamlConfig:_0x4187d3,folderPath:_0x57940e})=>({'yamlConfig':_0x4187d3,'folderPath':resolveTDFolderPath(_0x57940e,_0x42251f,_0x2332ce)})),_0x464e3c,_0x2332ce,_0x42251f),{journeyFiles:_0x49ae96,foldersToCreate:_0x55ed9e}=await withProgressSpinner('Preparing\x20journeys...',async _0x203632=>prepareJourneyFiles(_0xc76e2d,{'fetchJourney':async _0x438c92=>_0x2dde80[_0x1a33f7(0x21b)][_0x1a33f7(0x1c5)](_0x438c92[_0x1a33f7(0x233)]),'journeyBundlesByFolderAndName':_0xaf1ce4,'folderPathToId':_0x557269,'idToEmailMap':_0x27356f,'connectionIdToNameMap':_0x5ec192,'existingSegments':_0x4f809e,'parentId':_0x22be70,'deps':_0x2dde80,'progress':{'update':_0x127d76=>{const _0x52197a=_0x1a33f7;_0x203632[_0x52197a(0x20c)](_0x127d76),_0x4d340f[_0x52197a(0x1cf)]&&console[_0x52197a(0x222)]('\x20\x20'+_0x127d76);}},'journeyById':_0x61c7cc,'activationStepsById':_0x4e6871},_0x42251f,_0x2332ce),{'verbose':_0x4d340f['verbose']})['then'](_0x5d85f5=>_0x5d85f5[_0x1a33f7(0x1b2)]);for(const _0xe10e92 of _0x55ed9e){_0x5a985a['add'](_0xe10e92);}const _0x3527d1=_0x435d70?[]:findJourneysToDelete(_0x4fc1ee,_0xc76e2d[_0x1a33f7(0x19f)](({yamlConfig:_0x4f2de4,folderPath:_0x3cab81})=>({'yamlConfig':_0x4f2de4,'folderPath':resolveTDFolderPath(_0x3cab81,_0x42251f,_0x2332ce)})),_0x464e3c,_0x2332ce,_0x42251f),_0x58f189=calculatePushStats(_0x6bacd7,_0x49ae96,_0x5a985a,_0x779cce,_0x3527d1,!!_0x4d340f[_0x1a33f7(0x19d)],!!_0x4d340f['journeysOnly']),_0xb4e352=_0x58f189[_0x1a33f7(0x230)][_0x1a33f7(0x1de)],_0x4c4b63=_0x58f189[_0x1a33f7(0x230)][_0x1a33f7(0x1ca)],_0x4bf39d=_0x58f189[_0x1a33f7(0x230)]['unchanged'],_0x5e631a=_0x58f189[_0x1a33f7(0x230)][_0x1a33f7(0x1ab)],_0x40a219=_0x58f189['folders'][_0x1a33f7(0x1f0)],_0x3b2ffd=_0x58f189[_0x1a33f7(0x215)][_0x1a33f7(0x1de)],_0x52a7b7=_0x58f189[_0x1a33f7(0x215)][_0x1a33f7(0x1ca)],_0x39869d=_0x58f189['journeys'][_0x1a33f7(0x1fe)],_0x50ff65=_0x58f189[_0x1a33f7(0x215)][_0x1a33f7(0x1ab)],_0x45d7fc=_0x58f189['activations'][_0x1a33f7(0x227)],_0x4e8ee1=_0x58f189[_0x1a33f7(0x1ec)][_0x1a33f7(0x1f0)],_0x3a273d=_0x58f189[_0x1a33f7(0x1ec)]['toUpdate'],_0x40b71d=_0x58f189['activations'][_0x1a33f7(0x1ab)];console[_0x1a33f7(0x222)]('\x0aPush\x20summary\x20for\x20\x27'+_0x359325+'\x27:');_0x40a219[_0x1a33f7(0x1ac)]>0x0&&console[_0x1a33f7(0x222)]('\x20\x20'+a42_0x3c5463[_0x1a33f7(0x1a7)](_0x1a33f7(0x1ff)+_0x40a219[_0x1a33f7(0x1ac)]+_0x1a33f7(0x226)));if(!_0x4d340f[_0x1a33f7(0x231)]){console[_0x1a33f7(0x222)](_0x1a33f7(0x1f9)),console[_0x1a33f7(0x222)]('\x20\x20\x20\x20'+a42_0x3c5463['green']('+\x20'+_0xb4e352[_0x1a33f7(0x1ac)]+'\x20new')),console['error'](_0x1a33f7(0x1f6)+a42_0x3c5463[_0x1a33f7(0x225)]('~\x20'+_0x4c4b63[_0x1a33f7(0x1ac)]+'\x20changed'));if(_0x5e631a[_0x1a33f7(0x1ac)]>0x0)console[_0x1a33f7(0x222)](_0x1a33f7(0x1f6)+a42_0x3c5463[_0x1a33f7(0x22f)]('-\x20'+_0x5e631a[_0x1a33f7(0x1ac)]+'\x20to\x20delete'));else _0x779cce[_0x1a33f7(0x1ac)]>0x0&&!_0x4d340f[_0x1a33f7(0x19d)]&&console['error'](_0x1a33f7(0x1f6)+a42_0x3c5463[_0x1a33f7(0x1fb)](_0x779cce[_0x1a33f7(0x1ac)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x1a33f7(0x222)](_0x1a33f7(0x1f6)+a42_0x3c5463[_0x1a33f7(0x1fb)]('=\x20'+_0x4bf39d[_0x1a33f7(0x1ac)]+_0x1a33f7(0x22b)));}if(_0x49ae96['length']>0x0||_0x3527d1[_0x1a33f7(0x1ac)]>0x0){console['error'](_0x1a33f7(0x22c)),console[_0x1a33f7(0x222)](_0x1a33f7(0x1f6)+a42_0x3c5463[_0x1a33f7(0x1f7)]('+\x20'+_0x3b2ffd[_0x1a33f7(0x1ac)]+'\x20new')),console[_0x1a33f7(0x222)](_0x1a33f7(0x1f6)+a42_0x3c5463['yellow']('~\x20'+_0x52a7b7[_0x1a33f7(0x1ac)]+_0x1a33f7(0x1c0)));if(_0x50ff65[_0x1a33f7(0x1ac)]>0x0)console[_0x1a33f7(0x222)](_0x1a33f7(0x1f6)+a42_0x3c5463[_0x1a33f7(0x22f)]('-\x20'+_0x50ff65[_0x1a33f7(0x1ac)]+_0x1a33f7(0x20d)));else _0x3527d1[_0x1a33f7(0x1ac)]>0x0&&!_0x4d340f['delete']&&console['error']('\x20\x20\x20\x20'+a42_0x3c5463[_0x1a33f7(0x1fb)](_0x3527d1['length']+_0x1a33f7(0x1eb)));console['error'](_0x1a33f7(0x1f6)+a42_0x3c5463[_0x1a33f7(0x1fb)]('=\x20'+_0x39869d['length']+'\x20unchanged'));}_0x45d7fc[_0x1a33f7(0x1ac)]>0x0&&!_0x4d340f[_0x1a33f7(0x231)]&&(console['error'](''),console[_0x1a33f7(0x222)]('\x20\x20Activations:'),_0x4e8ee1[_0x1a33f7(0x1ac)]>0x0&&console[_0x1a33f7(0x222)](_0x1a33f7(0x1f6)+a42_0x3c5463[_0x1a33f7(0x1f7)]('+\x20'+_0x4e8ee1['length']+_0x1a33f7(0x1d5))),_0x3a273d[_0x1a33f7(0x1ac)]>0x0&&console[_0x1a33f7(0x222)]('\x20\x20\x20\x20'+a42_0x3c5463[_0x1a33f7(0x225)]('~\x20'+_0x3a273d[_0x1a33f7(0x1ac)]+_0x1a33f7(0x1b1))),_0x40b71d[_0x1a33f7(0x1ac)]>0x0&&console[_0x1a33f7(0x222)]('\x20\x20\x20\x20'+a42_0x3c5463[_0x1a33f7(0x22f)]('-\x20'+_0x40b71d[_0x1a33f7(0x1ac)]+_0x1a33f7(0x20d))));console[_0x1a33f7(0x222)](_0x1a33f7(0x1d4)+a42_0x3c5463[_0x1a33f7(0x201)](_0x2cd4a3)+'\x0a');if(_0x40a219[_0x1a33f7(0x1ac)]>0x0){console[_0x1a33f7(0x222)]('Folders\x20to\x20create:');for(const _0x2d5931 of _0x40a219){console['error']('\x20\x20'+a42_0x3c5463['blue']('+')+'\x20'+_0x2d5931);}console[_0x1a33f7(0x222)]('');}if(_0xb4e352[_0x1a33f7(0x1ac)]>0x0&&!_0x4d340f[_0x1a33f7(0x231)])for(const _0x302367 of _0xb4e352){const _0x183763=_0x302367['folderPath']?_0x302367[_0x1a33f7(0x234)]+'/'+_0x302367['yamlConfig'][_0x1a33f7(0x20e)]:_0x302367[_0x1a33f7(0x208)][_0x1a33f7(0x20e)],_0x4680af=_0x302367[_0x1a33f7(0x208)][_0x1a33f7(0x1ec)]?.[_0x1a33f7(0x1ac)]||0x0,_0x9d4a9a=_0x4680af>0x0?a42_0x3c5463[_0x1a33f7(0x1fb)]('\x20['+_0x4680af+_0x1a33f7(0x1d0)):'';console[_0x1a33f7(0x222)]('\x0a'+a42_0x3c5463['green'](_0x1a33f7(0x1d8))+'\x20'+_0x183763+_0x9d4a9a),console[_0x1a33f7(0x222)]('─'['repeat'](0x3c)),_0x302367[_0x1a33f7(0x1fc)]&&console[_0x1a33f7(0x222)](_0x302367[_0x1a33f7(0x1fc)]),console['error']('─'[_0x1a33f7(0x1f3)](0x3c));}if(_0x5e631a[_0x1a33f7(0x1ac)]>0x0&&!_0x4d340f[_0x1a33f7(0x231)])for(const _0x3b850c of _0x5e631a){const _0x2f9bab=_0x3b850c[_0x1a33f7(0x1a9)]?_0x464e3c[_0x1a33f7(0x1dc)](_0x3b850c[_0x1a33f7(0x1a9)][_0x1a33f7(0x214)]())||'':'',_0x246c80=_0x2f9bab?_0x2f9bab+'/'+_0x3b850c[_0x1a33f7(0x20e)]:_0x3b850c['name'],_0x4ae454=_0x573e77[_0x1a33f7(0x1dc)](_0x3b850c['id'])||[],_0x53d114=_0x4ae454[_0x1a33f7(0x1ac)]>0x0?a42_0x3c5463[_0x1a33f7(0x1fb)]('\x20['+_0x4ae454[_0x1a33f7(0x1ac)]+_0x1a33f7(0x1d0)):'';console[_0x1a33f7(0x222)]('\x0a'+a42_0x3c5463[_0x1a33f7(0x22f)](_0x1a33f7(0x205))+'\x20'+_0x246c80+_0x53d114),console[_0x1a33f7(0x222)]('─'[_0x1a33f7(0x1f3)](0x3c));const _0x416ba0=segmentWithActivationsToYaml(_0x3b850c,_0x4ae454,undefined,_0x27356f,_0x5ec192),_0x35a3bc=segmentToYamlString(_0x416ba0),_0x27f360=generateDiff(_0x35a3bc,'');console[_0x1a33f7(0x222)](formatDiffWithColors(_0x27f360)),console[_0x1a33f7(0x222)]('─'[_0x1a33f7(0x1f3)](0x3c));}const _0x56cfcc=_0x6bacd7[_0x1a33f7(0x1d3)](_0x1429ff=>!_0x1429ff[_0x1a33f7(0x203)]&&_0x1429ff[_0x1a33f7(0x1fc)]);if(_0x56cfcc[_0x1a33f7(0x1ac)]>0x0&&!_0x4d340f[_0x1a33f7(0x231)])for(const _0x4de9f7 of _0x56cfcc){const _0x2030d6=_0x4de9f7[_0x1a33f7(0x234)]?_0x4de9f7['folderPath']+'/'+_0x4de9f7[_0x1a33f7(0x208)][_0x1a33f7(0x20e)]:_0x4de9f7[_0x1a33f7(0x208)][_0x1a33f7(0x20e)];console[_0x1a33f7(0x222)]('\x0a'+a42_0x3c5463[_0x1a33f7(0x225)](_0x1a33f7(0x1c4))+'\x20'+_0x2030d6),console[_0x1a33f7(0x222)]('─'[_0x1a33f7(0x1f3)](0x3c)),console[_0x1a33f7(0x222)](_0x4de9f7[_0x1a33f7(0x1fc)]),console[_0x1a33f7(0x222)]('─'[_0x1a33f7(0x1f3)](0x3c));}if(_0x3b2ffd[_0x1a33f7(0x1ac)]>0x0)for(const _0x37404f of _0x3b2ffd){const _0x5cf989=_0x37404f['folderPath']?_0x37404f[_0x1a33f7(0x234)]+'/'+_0x37404f[_0x1a33f7(0x208)][_0x1a33f7(0x20e)]:_0x37404f[_0x1a33f7(0x208)][_0x1a33f7(0x20e)];console[_0x1a33f7(0x222)]('\x0a'+a42_0x3c5463[_0x1a33f7(0x1f7)]('New\x20journey:')+'\x20'+_0x5cf989),console[_0x1a33f7(0x222)]('─'[_0x1a33f7(0x1f3)](0x3c)),_0x37404f['diff']&&console[_0x1a33f7(0x222)](_0x37404f[_0x1a33f7(0x1fc)]),console['error']('─'[_0x1a33f7(0x1f3)](0x3c));}const _0x5535eb=_0x49ae96[_0x1a33f7(0x1d3)](_0x7e9e67=>!_0x7e9e67[_0x1a33f7(0x203)]&&_0x7e9e67[_0x1a33f7(0x1fc)]);if(_0x5535eb[_0x1a33f7(0x1ac)]>0x0)for(const _0x2e2d73 of _0x5535eb){const _0x37cc84=_0x2e2d73[_0x1a33f7(0x234)]?_0x2e2d73[_0x1a33f7(0x234)]+'/'+_0x2e2d73[_0x1a33f7(0x208)][_0x1a33f7(0x20e)]:_0x2e2d73[_0x1a33f7(0x208)]['name'];console[_0x1a33f7(0x222)]('\x0a'+a42_0x3c5463[_0x1a33f7(0x225)](_0x1a33f7(0x1f5))+'\x20'+_0x37cc84),console['error']('─'[_0x1a33f7(0x1f3)](0x3c)),console[_0x1a33f7(0x222)](_0x2e2d73[_0x1a33f7(0x1fc)]),console[_0x1a33f7(0x222)]('─'[_0x1a33f7(0x1f3)](0x3c));}if(_0x50ff65[_0x1a33f7(0x1ac)]>0x0)for(const _0x2dc072 of _0x50ff65){const _0x2765d6=_0x2dc072['folderId']?_0x464e3c[_0x1a33f7(0x1dc)](_0x2dc072[_0x1a33f7(0x1d1)])||'':'',_0x472142=_0x2765d6?_0x2765d6+'/'+_0x2dc072['journeyBundleName']:_0x2dc072['journeyBundleName'];console[_0x1a33f7(0x222)]('\x0a'+a42_0x3c5463[_0x1a33f7(0x22f)](_0x1a33f7(0x1bf))+'\x20'+_0x472142),console['error']('─'[_0x1a33f7(0x1f3)](0x3c)),console[_0x1a33f7(0x222)](a42_0x3c5463['red'](_0x1a33f7(0x1d7))),console[_0x1a33f7(0x222)]('─'[_0x1a33f7(0x1f3)](0x3c));}if(_0x4d340f['dryRun'])return console[_0x1a33f7(0x222)](a42_0x3c5463[_0x1a33f7(0x225)](_0x1a33f7(0x1f1))),0x0;const _0x564825=_0x4d340f['journeysOnly']?![]:_0xb4e352['length']>0x0||_0x4c4b63[_0x1a33f7(0x1ac)]>0x0||_0x5e631a[_0x1a33f7(0x1ac)]>0x0,_0x4ab5fa=_0x3b2ffd[_0x1a33f7(0x1ac)]>0x0||_0x52a7b7[_0x1a33f7(0x1ac)]>0x0||_0x50ff65[_0x1a33f7(0x1ac)]>0x0,_0x3d74c0=_0x4d340f[_0x1a33f7(0x231)]?![]:_0x45d7fc[_0x1a33f7(0x1ac)]>0x0,_0x298d11=_0x40a219[_0x1a33f7(0x1ac)]>0x0;if(!_0x564825&&!_0x4ab5fa&&!_0x3d74c0&&!_0x298d11){const _0x345819=_0x4d340f['journeysOnly']?_0x1a33f7(0x1c3):_0x1a33f7(0x22a);console[_0x1a33f7(0x222)](a42_0x3c5463['green'](_0x345819));if(_0x435d70&&_0x4bf39d[_0x1a33f7(0x1ac)]===0x1){const _0x47ad29=_0x4bf39d[0x0];if(_0x47ad29[_0x1a33f7(0x1cb)]?.['id']){const _0x3eb7e8=getConsoleNextUrl(_0x4d340f['site'],_0x1a33f7(0x21a)+_0x22be70+'/e/'+_0x47ad29[_0x1a33f7(0x1cb)]['id']+_0x1a33f7(0x1ed));console[_0x1a33f7(0x222)](_0x1a33f7(0x1ea)+a42_0x3c5463[_0x1a33f7(0x201)](_0x3eb7e8));}}if(_0x435d70&&_0x39869d[_0x1a33f7(0x1ac)]===0x1){const _0x26cdc7=_0x39869d[0x0];if(_0x26cdc7[_0x1a33f7(0x221)]?.['id']){const _0x1fbcc3=getConsoleNextUrl(_0x4d340f['site'],_0x1a33f7(0x21a)+_0x22be70+_0x1a33f7(0x1b3)+_0x26cdc7[_0x1a33f7(0x221)]['id']+_0x1a33f7(0x1f4));console[_0x1a33f7(0x222)]('\x20\x20'+a42_0x3c5463[_0x1a33f7(0x201)](_0x1fbcc3));}}return 0x0;}const _0xc67a42=_0x4d340f[_0x1a33f7(0x231)]?_0x3b2ffd[_0x1a33f7(0x1ac)]+_0x52a7b7[_0x1a33f7(0x1ac)]+_0x50ff65[_0x1a33f7(0x1ac)]+_0x40a219['length']:_0xb4e352['length']+_0x4c4b63[_0x1a33f7(0x1ac)]+_0x5e631a[_0x1a33f7(0x1ac)]+_0x3b2ffd[_0x1a33f7(0x1ac)]+_0x52a7b7[_0x1a33f7(0x1ac)]+_0x50ff65['length']+_0x40a219[_0x1a33f7(0x1ac)]+_0x45d7fc[_0x1a33f7(0x1ac)];if(!_0x4d340f[_0x1a33f7(0x1cd)]&&_0xc67a42>0x0){if(!isInteractive())return console[_0x1a33f7(0x222)](a42_0x3c5463[_0x1a33f7(0x22f)](_0x1a33f7(0x22e)),_0x1a33f7(0x20b)),console['error'](a42_0x3c5463[_0x1a33f7(0x1fb)](_0x1a33f7(0x219))),0x1;const _0x5c6fc6=await confirmKey(_0x1a33f7(0x19e)+_0xc67a42+'\x20changes?');if(!_0x5c6fc6)return console[_0x1a33f7(0x222)](a42_0x3c5463[_0x1a33f7(0x225)]('Aborted.')),0x1;}const _0x2a9c52={'withProgress':async(_0xc1a5a4,_0x44b2c0)=>{const _0x58b863=_0x1a33f7,_0x2d7ce5=await withSpinner(_0xc1a5a4,_0x44b2c0,{'verbose':_0x4d340f[_0x58b863(0x1cf)]});return{'data':_0x2d7ce5[_0x58b863(0x1b2)]};},'logInfo':_0x22d417=>console[_0x1a33f7(0x222)](a42_0x3c5463['blue']('✔\x20'+_0x22d417)),'logSuccess':_0x599649=>console['error'](a42_0x3c5463['green']('✔\x20'+_0x599649)),'logWarning':_0xfe9d21=>console['error'](a42_0x3c5463[_0x1a33f7(0x225)]('⚠\x20'+_0xfe9d21)),'logDeleted':_0x2c6cd6=>console[_0x1a33f7(0x222)](a42_0x3c5463['red']('✔\x20'+_0x2c6cd6))},_0x1dab47={'segment':_0x2dde80[_0x1a33f7(0x1c7)],'journey':_0x2dde80['journey'],'user':_0x2dde80[_0x1a33f7(0x1c2)],'connection':_0x2dde80[_0x1a33f7(0x1b8)]};_0x40a219[_0x1a33f7(0x1ac)]>0x0&&(_0x557269=await executePushFolders(_0x1dab47,_0x40a219,_0x557269,{'parentId':_0x22be70},_0x2a9c52));const _0x497052={'rootFolderId':_0x735174,'folderPathToId':_0x557269,'folderIdToPath':_0x464e3c,'segmentNameToId':_0x2d86f3,'activationsBySegmentId':_0x573e77,'emailToIdMap':_0xd16f6f,'idToEmailMap':_0x27356f,'connectionNameToIdMap':_0x1cd8d6[_0x1a33f7(0x1fa)],'connectionIdToNameMap':_0x1cd8d6['idToName'],'connectionNameToTypeMap':_0x198695},_0xe1f00e=await executePushSegments(_0x1dab47,_0x4d340f['journeysOnly']?[]:_0x6bacd7,_0x497052,{'parentId':_0x22be70},_0x2a9c52),_0x1da1c5=_0xe1f00e[_0x1a33f7(0x1e3)],_0x8b8334=_0xe1f00e['updated'],_0x20cdb9=_0xe1f00e['activations'][_0x1a33f7(0x1e3)],_0x5149a7=_0xe1f00e['activations']['updated'],_0x9b29ee=_0xe1f00e[_0x1a33f7(0x1ec)][_0x1a33f7(0x218)];let _0x473306;if(_0x435d70&&_0x6bacd7[_0x1a33f7(0x1ac)]===0x1){const _0x374aac=_0x6bacd7[0x0];_0x473306=_0x374aac[_0x1a33f7(0x1cb)]?.['id']??_0xe1f00e[_0x1a33f7(0x1ae)][_0x1a33f7(0x1dc)](_0x374aac['yamlConfig'][_0x1a33f7(0x20e)]);}const _0x7495eb=await executePushSegmentDeletions(_0x1dab47,_0x4d340f[_0x1a33f7(0x231)]?[]:_0x5e631a,_0x2a9c52);let _0x550d9e=0x0,_0x51ecf1=0x0,_0x154f49=0x0;const _0x2dc9f3=new Map(_0x2d86f3);for(const [_0xfa6111,_0x21d45a]of _0xe1f00e['createdSegmentIds']){_0x2dc9f3[_0x1a33f7(0x1a0)](_0xfa6111,_0x21d45a);}if(_0x49ae96[_0x1a33f7(0x1ac)]>0x0){const _0x269b5b={..._0x497052,'segmentNameToId':_0x2dc9f3,'existingSegments':_0x4f809e,'activationContext':_0x36f7e3},_0x206357=await executePushJourneys(_0x1dab47,_0x49ae96,_0x269b5b,{'parentId':_0x22be70,'rootFolderId':_0x735174,'verbose':_0x4d340f[_0x1a33f7(0x1cf)]},_0x2a9c52);_0x550d9e=_0x206357[_0x1a33f7(0x1e3)],_0x51ecf1=_0x206357['updated'];if(_0x435d70&&_0x206357[_0x1a33f7(0x1dd)][_0x1a33f7(0x1ac)]===0x1){const _0x45db96=_0x206357['results'][0x0];if(_0x45db96[_0x1a33f7(0x233)]){const _0x3f2f02=getConsoleNextUrl(_0x4d340f['site'],_0x1a33f7(0x21a)+_0x22be70+'/e/'+_0x45db96[_0x1a33f7(0x233)]+'/j/da/je');console[_0x1a33f7(0x222)]('\x20\x20'+a42_0x3c5463[_0x1a33f7(0x201)](_0x3f2f02));}}}for(const _0x1ec51f of _0x50ff65){console[_0x1a33f7(0x222)](a42_0x3c5463['yellow'](_0x1a33f7(0x1fd)+_0x1ec51f[_0x1a33f7(0x1a3)])),_0x154f49++;}const _0x3ecf52=[];if(_0x1da1c5>0x0)_0x3ecf52['push'](_0x1da1c5+'\x20created');if(_0x8b8334>0x0)_0x3ecf52['push'](_0x8b8334+_0x1a33f7(0x220));if(_0x7495eb>0x0)_0x3ecf52['push'](_0x7495eb+'\x20deleted');const _0x228120=[];if(_0x550d9e>0x0)_0x228120[_0x1a33f7(0x207)](_0x550d9e+_0x1a33f7(0x1e7));if(_0x51ecf1>0x0)_0x228120[_0x1a33f7(0x207)](_0x51ecf1+_0x1a33f7(0x220));if(_0x154f49>0x0)_0x228120[_0x1a33f7(0x207)](_0x154f49+'\x20deleted');const _0x4ad6c5=[];if(_0x20cdb9>0x0)_0x4ad6c5['push'](_0x20cdb9+_0x1a33f7(0x1e7));if(_0x5149a7>0x0)_0x4ad6c5[_0x1a33f7(0x207)](_0x5149a7+_0x1a33f7(0x220));if(_0x9b29ee>0x0)_0x4ad6c5[_0x1a33f7(0x207)](_0x9b29ee+'\x20deleted');console[_0x1a33f7(0x222)](a42_0x3c5463[_0x1a33f7(0x1f7)](_0x1a33f7(0x1aa)));_0x3ecf52[_0x1a33f7(0x1ac)]>0x0&&!_0x4d340f[_0x1a33f7(0x231)]&&console[_0x1a33f7(0x222)](_0x1a33f7(0x1c1)+_0x3ecf52['join'](',\x20'));_0x228120[_0x1a33f7(0x1ac)]>0x0&&console['error'](_0x1a33f7(0x209)+_0x228120['join'](',\x20'));_0x4ad6c5['length']>0x0&&!_0x4d340f['journeysOnly']&&console[_0x1a33f7(0x222)]('\x20\x20Activations:\x20'+_0x4ad6c5['join'](',\x20'));if(_0x473306){const _0x3915d5=getConsoleNextUrl(_0x4d340f[_0x1a33f7(0x1df)],_0x1a33f7(0x21a)+_0x22be70+_0x1a33f7(0x1b3)+_0x473306+_0x1a33f7(0x1ed));console['error'](_0x1a33f7(0x1ea)+a42_0x3c5463[_0x1a33f7(0x201)](_0x3915d5));}return 0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a43_0x866c(_0x434447,_0x4d95ce){_0x434447=_0x434447-0x95;const _0x35ab59=a43_0x35ab();let _0x866c5b=_0x35ab59[_0x434447];return _0x866c5b;}const a43_0x21a666=a43_0x866c;(function(_0x167d0f,_0x11601e){const _0x5c4d62=a43_0x866c,_0x45ac26=_0x167d0f();while(!![]){try{const _0x217a52=parseInt(_0x5c4d62(0xb6))/0x1+-parseInt(_0x5c4d62(0xa7))/0x2+-parseInt(_0x5c4d62(0xa8))/0x3*(-parseInt(_0x5c4d62(0xb0))/0x4)+parseInt(_0x5c4d62(0xae))/0x5+parseInt(_0x5c4d62(0xa3))/0x6+parseInt(_0x5c4d62(0x95))/0x7+-parseInt(_0x5c4d62(0xb9))/0x8;if(_0x217a52===_0x11601e)break;else _0x45ac26['push'](_0x45ac26['shift']());}catch(_0x50bad3){_0x45ac26['push'](_0x45ac26['shift']());}}}(a43_0x35ab,0xe5fc5));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{SDKError,ErrorCode}from'../sdk/index.js';import a43_0x3a2eb7 from'chalk';function a43_0x35ab(){const _0x14bb71=['Update\x20existing\x20child\x20segment','Resolved\x20folder\x20ID:\x20','length','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','rule','ruleFile','Examples:','parentId','name','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','10085664DobkAL','kind','Resolving\x20path\x20\x27','folder','1388470wYyytR','3NUKXFf','Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]','type','verbose','segment','Segment\x20ID\x20missing\x20from\x20resolved\x20path','1178065MBTPsV','Updating\x20segment\x20\x27','4112636TfWfYU','\x27...','error','Resolved\x20type:\x20','resolveFolderId','execute','378630rKOXXb','Error:\x20Cannot\x20update\x20','Segment\x20ID:\x20','15322776lGDeCM','⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.','segmentName','Resolving\x20folder\x20\x27','segmentId','Resolved\x20relative\x20path\x20to:\x20','updateSegmentById','data','resolvePathToResource','INTERNAL','1597799DTdCmx','includes','Parent\x20ID:\x20','yellow'];a43_0x35ab=function(){return _0x14bb71;};return a43_0x35ab();}export class SegmentUpdateCommand extends BaseCommand{['name']='segment:update';['description']=a43_0x21a666(0x99);async[a43_0x21a666(0xb5)](_0x2df290){const _0x2bd1b4=a43_0x21a666;console[_0x2bd1b4(0xb2)](a43_0x3a2eb7[_0x2bd1b4(0x98)](_0x2bd1b4(0xba))),console[_0x2bd1b4(0xb2)](a43_0x3a2eb7[_0x2bd1b4(0x98)]('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x32c34b,args:_0x3498ca,tdx:_0x5ea6aa}=_0x2df290,_0x55fe63=_0x32c34b;if(_0x3498ca[_0x2bd1b4(0x9b)]===0x0)return console[_0x2bd1b4(0xb2)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x2bd1b4(0xb2)]('Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]'),console[_0x2bd1b4(0xb2)](_0x2bd1b4(0x9f)),console[_0x2bd1b4(0xb2)]('\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22'),console[_0x2bd1b4(0xb2)](_0x2bd1b4(0xa2)),0x1;const _0x3cf423=_0x3498ca[0x0],_0x10865a=_0x32c34b['segmentPath'];let _0x3fea6d=_0x3cf423;_0x10865a&&!_0x3cf423[_0x2bd1b4(0x96)]('/')&&(_0x3fea6d=_0x10865a+'/'+_0x3cf423,_0x55fe63['verbose']&&console[_0x2bd1b4(0xb2)](_0x2bd1b4(0xbe)+_0x3fea6d));const _0x1d173f=await withSpinner(_0x2bd1b4(0xa5)+_0x3fea6d+_0x2bd1b4(0xb1),()=>_0x5ea6aa[_0x2bd1b4(0xac)][_0x2bd1b4(0xc1)](_0x3fea6d),{'verbose':_0x55fe63[_0x2bd1b4(0xab)]}),_0x4fef7b=_0x1d173f[_0x2bd1b4(0xc0)];_0x55fe63[_0x2bd1b4(0xab)]&&console[_0x2bd1b4(0xb2)](_0x2bd1b4(0xb3)+_0x4fef7b[_0x2bd1b4(0xaa)]);if(_0x4fef7b[_0x2bd1b4(0xaa)]!==_0x2bd1b4(0xac))return console[_0x2bd1b4(0xb2)](_0x2bd1b4(0xb7)+_0x4fef7b[_0x2bd1b4(0xaa)]+_0x2bd1b4(0x9c)),console[_0x2bd1b4(0xb2)](_0x2bd1b4(0xa9)),0x1;if(!_0x4fef7b[_0x2bd1b4(0xbd)])throw new SDKError(ErrorCode[_0x2bd1b4(0xc2)],_0x2bd1b4(0xad));const _0x2bc7f3=_0x4fef7b[_0x2bd1b4(0xa0)],_0x5825cd=_0x4fef7b[_0x2bd1b4(0xbd)];_0x55fe63['verbose']&&(console[_0x2bd1b4(0xb2)](_0x2bd1b4(0x97)+_0x2bc7f3),console['error'](_0x2bd1b4(0xb8)+_0x5825cd));let _0x356ab5;if(_0x55fe63[_0x2bd1b4(0xa6)]){const _0x50434f=_0x55fe63[_0x2bd1b4(0xa6)],_0xc34188=await withSpinner(_0x2bd1b4(0xbc)+_0x50434f+'\x27...',()=>_0x5ea6aa[_0x2bd1b4(0xac)][_0x2bd1b4(0xb4)](_0x2bc7f3,_0x50434f),{'verbose':_0x55fe63[_0x2bd1b4(0xab)]});_0x356ab5=parseInt(_0xc34188[_0x2bd1b4(0xc0)],0xa),_0x55fe63[_0x2bd1b4(0xab)]&&console[_0x2bd1b4(0xb2)](_0x2bd1b4(0x9a)+_0x356ab5);}const _0xb2d402=await loadJSONFromOptions(_0x55fe63[_0x2bd1b4(0x9d)],_0x55fe63[_0x2bd1b4(0x9e)]),_0x310fee={'name':_0x55fe63[_0x2bd1b4(0xa1)],'description':_0x55fe63['description'],'rule':_0xb2d402,'kind':_0x55fe63[_0x2bd1b4(0xa4)]!==undefined?parseInt(_0x55fe63[_0x2bd1b4(0xa4)],0xa):undefined,'segmentFolderId':_0x356ab5},_0x538952=await withSpinner(_0x2bd1b4(0xaf)+_0x4fef7b[_0x2bd1b4(0xbb)]+'\x27...',()=>_0x5ea6aa[_0x2bd1b4(0xac)][_0x2bd1b4(0xbf)](_0x2bc7f3,_0x5825cd,_0x310fee),{'verbose':_0x55fe63['verbose']}),_0x29d428=_0x538952[_0x2bd1b4(0xc0)];return console[_0x2bd1b4(0xb2)]('✔\x20Updated\x20segment\x20\x27'+_0x29d428[_0x2bd1b4(0xa1)]+'\x27'),_0x3fea6d!==_0x3cf423&&console[_0x2bd1b4(0xb2)]('\x20\x20\x20Path:\x20'+_0x3fea6d),await handleSDKOutput([_0x29d428],_0x55fe63),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a44_0x50d166=a44_0x4e10;function a44_0x4e10(_0x42c131,_0x37ba99){_0x42c131=_0x42c131-0x170;const _0x389ff8=a44_0x389f();let _0x4e102e=_0x389ff8[_0x42c131];return _0x4e102e;}(function(_0x4501a4,_0x274db7){const _0x4294f9=a44_0x4e10,_0x37f571=_0x4501a4();while(!![]){try{const _0x3c4c32=-parseInt(_0x4294f9(0x1af))/0x1*(parseInt(_0x4294f9(0x1a6))/0x2)+-parseInt(_0x4294f9(0x184))/0x3+parseInt(_0x4294f9(0x174))/0x4+parseInt(_0x4294f9(0x18d))/0x5*(parseInt(_0x4294f9(0x18a))/0x6)+-parseInt(_0x4294f9(0x1a3))/0x7*(-parseInt(_0x4294f9(0x17c))/0x8)+-parseInt(_0x4294f9(0x1aa))/0x9*(-parseInt(_0x4294f9(0x1ac))/0xa)+-parseInt(_0x4294f9(0x17d))/0xb*(parseInt(_0x4294f9(0x191))/0xc);if(_0x3c4c32===_0x274db7)break;else _0x37f571['push'](_0x37f571['shift']());}catch(_0x383f7e){_0x37f571['push'](_0x37f571['shift']());}}}(a44_0x389f,0x67933));import{existsSync,statSync}from'fs';import a44_0x5e537 from'chalk';import{BaseCommand}from'./command.js';import{saveSessionContext}from'../core/session.js';import{withSpinner}from'../utils/spinner.js';function a44_0x389f(){const _0x39e0f1=['folderPath','folderId','Target\x20path:\x20','\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent','parentName','67088cEwKoA','89144TNQYCa','segments','resolvePathToResource','isDirectory','red','Folder\x20ID:\x20','type','883734PwdbKI','segment','✔\x20Context\x20cleared.\x20Back\x20to\x20root.','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','Error:\x20Path\x20is\x20required\x0a','\x27...','6CBEYux','cyan','segmentPath','3768315eoPkuJ','Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context','log','site','1908tENFac','Use:\x20tdx\x20segment\x20use\x20','Use\x20\x22tdx\x20use\x22\x20to\x20see\x20all\x20context\x20parameters','error','session','\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','verbose','green','length','segment:use','Examples:','description','Resolving\x20path\x20\x27','execute','Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>','✔\x20Context\x20set\x20to:\x20','name','511gbFKMz','Site:\x20','parent_segment','28954keFkNC','dim','parentId','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','7548039EJalgL','Resolved\x20relative\x20path\x20to:\x20','10ketKEQ','fullPath','join','31QkOpAi','data','isAbsolute','split','Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.','1006528glyjNo','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22','config'];a44_0x389f=function(){return _0x39e0f1;};return a44_0x389f();}import{parsePath,normalizePath}from'../sdk/segment/segment-path-parser.js';import{findTdxConfig}from'../sdk/segment/tdx-config.js';export class SegmentUseCommand extends BaseCommand{[a44_0x50d166(0x1a2)]=a44_0x50d166(0x19b);[a44_0x50d166(0x19d)]='Set\x20current\x20segment/folder\x20context\x20for\x20navigation';async[a44_0x50d166(0x19f)](_0x321168){const _0x115d9c=a44_0x50d166,{options:_0x596baf,args:_0x322448,tdx:_0x1acea7}=_0x321168;if(_0x322448[_0x115d9c(0x19a)]===0x0)return console['error'](a44_0x5e537[_0x115d9c(0x181)](_0x115d9c(0x188))),console[_0x115d9c(0x194)]('Usage:\x20tdx\x20segment\x20use\x20<path>'),console[_0x115d9c(0x194)](_0x115d9c(0x19c)),console['error']('\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22'),console[_0x115d9c(0x194)](_0x115d9c(0x175)),console[_0x115d9c(0x194)](_0x115d9c(0x196)),console['error'](_0x115d9c(0x17a)),0x1;const _0x5432e2=_0x322448[0x0],_0x3e40af=_0x596baf[_0x115d9c(0x195)];try{if(_0x5432e2==='/')return saveSessionContext({'segment_path':undefined},_0x3e40af),console[_0x115d9c(0x18f)](a44_0x5e537[_0x115d9c(0x199)]('✔\x20Context\x20cleared.\x20Back\x20to\x20root.')),0x0;if(existsSync(_0x5432e2)&&statSync(_0x5432e2)[_0x115d9c(0x180)]()){let _0x38e210;try{_0x38e210=findTdxConfig(_0x5432e2);}catch{return console['error'](a44_0x5e537['red'](_0x115d9c(0x1a9)+_0x5432e2)),console['error'](a44_0x5e537[_0x115d9c(0x18b)](_0x115d9c(0x197))),0x1;}const _0x4abc92=_0x38e210[_0x115d9c(0x176)][_0x115d9c(0x1a5)];return saveSessionContext({'segment_path':_0x4abc92,'parent_segment':_0x4abc92},_0x3e40af),console['log'](a44_0x5e537[_0x115d9c(0x199)](_0x115d9c(0x1a1)+a44_0x5e537[_0x115d9c(0x18b)](_0x4abc92))),0x0;}const _0x13670b=_0x596baf[_0x115d9c(0x18c)];let _0x3e9f6e=_0x5432e2;const _0x2aeaa1=parsePath(_0x5432e2);if(!_0x2aeaa1[_0x115d9c(0x171)]){if(!_0x13670b)return console['error'](a44_0x5e537['red']('Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.')),console[_0x115d9c(0x194)](a44_0x5e537['cyan'](_0x115d9c(0x1a0))),0x1;if(_0x5432e2==='..'){const _0x24fc91=_0x13670b[_0x115d9c(0x172)]('/')['slice'](0x0,-0x1)[_0x115d9c(0x1ae)]('/');_0x3e9f6e=_0x24fc91||'/';}else _0x5432e2==='.'?_0x3e9f6e=_0x13670b:_0x3e9f6e=_0x13670b+'/'+_0x5432e2;_0x596baf['verbose']&&console[_0x115d9c(0x194)](_0x115d9c(0x1ab)+_0x3e9f6e);}if(_0x3e9f6e==='/'||_0x3e9f6e==='')return saveSessionContext({'segment_path':undefined},_0x3e40af),console[_0x115d9c(0x18f)](a44_0x5e537[_0x115d9c(0x199)]('✔\x20Context\x20cleared.\x20Back\x20to\x20root.')),0x0;_0x3e9f6e=normalizePath(_0x3e9f6e);const _0x23cd31=parsePath(_0x3e9f6e)[_0x115d9c(0x17e)];if(_0x23cd31['length']===0x0)return saveSessionContext({'segment_path':undefined},_0x3e40af),console[_0x115d9c(0x18f)](a44_0x5e537[_0x115d9c(0x199)](_0x115d9c(0x186))),0x0;_0x596baf[_0x115d9c(0x198)]&&(console['error'](_0x115d9c(0x1a4)+_0x596baf[_0x115d9c(0x190)]),console[_0x115d9c(0x194)](_0x115d9c(0x179)+_0x3e9f6e));const _0x3b8c89=await withSpinner(_0x115d9c(0x19e)+_0x3e9f6e+_0x115d9c(0x189),()=>_0x1acea7[_0x115d9c(0x185)][_0x115d9c(0x17f)](_0x3e9f6e),{'verbose':_0x596baf[_0x115d9c(0x198)]}),_0x4dc88f=_0x3b8c89[_0x115d9c(0x170)];_0x596baf[_0x115d9c(0x198)]&&(console[_0x115d9c(0x194)]('Resolved\x20path\x20type:\x20'+_0x4dc88f['type']),console['error']('Parent\x20ID:\x20'+_0x4dc88f[_0x115d9c(0x1a8)]),_0x4dc88f[_0x115d9c(0x178)]&&console[_0x115d9c(0x194)](_0x115d9c(0x182)+_0x4dc88f['folderId']));if(_0x4dc88f[_0x115d9c(0x183)]===_0x115d9c(0x185))return console[_0x115d9c(0x194)](a44_0x5e537[_0x115d9c(0x181)](_0x115d9c(0x173))),console['error'](_0x115d9c(0x187)),console[_0x115d9c(0x194)](a44_0x5e537[_0x115d9c(0x18b)](_0x115d9c(0x192)+_0x4dc88f[_0x115d9c(0x17b)]+(_0x4dc88f[_0x115d9c(0x177)]?'/'+_0x4dc88f[_0x115d9c(0x177)][_0x115d9c(0x1ae)]('/'):''))),0x1;return saveSessionContext({'segment_path':_0x4dc88f[_0x115d9c(0x1ad)],'parent_segment':_0x4dc88f['parentName']},_0x3e40af),console[_0x115d9c(0x18f)](a44_0x5e537[_0x115d9c(0x199)]('✔\x20Context\x20set\x20to:\x20'+a44_0x5e537['cyan'](_0x4dc88f[_0x115d9c(0x1ad)]))),_0x596baf[_0x115d9c(0x198)]&&(console[_0x115d9c(0x194)](a44_0x5e537[_0x115d9c(0x1a7)](_0x115d9c(0x18e))),console[_0x115d9c(0x194)](a44_0x5e537['dim'](_0x115d9c(0x193)))),0x0;}catch(_0x5464e5){throw _0x5464e5;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a45_0x408dfb=a45_0x5d51;function a45_0x5d51(_0xd60e0c,_0xb222f3){_0xd60e0c=_0xd60e0c-0x19e;const _0x1d6177=a45_0x1d61();let _0x5d51c3=_0x1d6177[_0xd60e0c];return _0x5d51c3;}(function(_0x3fbae0,_0x13078f){const _0x56cfb5=a45_0x5d51,_0x4298f9=_0x3fbae0();while(!![]){try{const _0x8caf51=parseInt(_0x56cfb5(0x1b3))/0x1*(parseInt(_0x56cfb5(0x1ca))/0x2)+parseInt(_0x56cfb5(0x1c1))/0x3*(parseInt(_0x56cfb5(0x1b1))/0x4)+-parseInt(_0x56cfb5(0x1af))/0x5*(parseInt(_0x56cfb5(0x1c5))/0x6)+parseInt(_0x56cfb5(0x1c7))/0x7+-parseInt(_0x56cfb5(0x1a9))/0x8*(parseInt(_0x56cfb5(0x1a8))/0x9)+parseInt(_0x56cfb5(0x1a2))/0xa+-parseInt(_0x56cfb5(0x1ba))/0xb*(parseInt(_0x56cfb5(0x1bf))/0xc);if(_0x8caf51===_0x13078f)break;else _0x4298f9['push'](_0x4298f9['shift']());}catch(_0x24c21d){_0x4298f9['push'](_0x4298f9['shift']());}}}(a45_0x1d61,0xa07a7));import{BaseCommand}from'./command.js';function a45_0x1d61(){const _0x190262=['type','helpText','red','18PyEmts','\x20valid','7805966smbVLo','Usage:\x20tdx\x20sg\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','cyan','68VikuNL','length','message','yellow','validCount','\x20warning(s)\x20found','\x20warning(s)','error','errors','.yaml','targetDir','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','Error:\x20','\x20file(s)\x20with\x20errors,\x20','cwd','execute','12360760lQtTma','no_parent','valid','warnings','description','hasErrors','387ftZqir','224320qfSgnq','endsWith','\x20file(s)\x20valid','):\x20','file','✔\x20All\x20','576005cyegyR','Validation\x20failed:\x20','570216VXwSLE','name','34153FakxTs','invalidCount','dim','log','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','\x20error(s)','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','44zBpMGo','warningCount','green','.yml','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','6904956raMdJS','\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','21HBRbvP'];a45_0x1d61=function(){return _0x190262;};return a45_0x1d61();}import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';import a45_0x409843 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{[a45_0x408dfb(0x1b2)]='segment:validate';[a45_0x408dfb(0x1a6)]='Validate\x20segment\x20and\x20journey\x20YAML\x20files';async[a45_0x408dfb(0x1a1)](_0x300417){const _0x4e98ad=a45_0x408dfb,{options:_0x415339,args:_0x4042a0}=_0x300417,_0x21d8c3=_0x415339,_0x58233c=await resolveTarget({'arg':_0x4042a0[0x0],'contextParent':_0x415339['parentSegment'],'cwd':process[_0x4e98ad(0x1a0)]()});if(!isSuccessfulResolution(_0x58233c))return _0x58233c['errorCode']===_0x4e98ad(0x1a3)?(console[_0x4e98ad(0x1d1)](a45_0x409843[_0x4e98ad(0x1cd)](_0x4e98ad(0x1be))),console[_0x4e98ad(0x1d1)](_0x4e98ad(0x1c8)),console[_0x4e98ad(0x1d1)](_0x4e98ad(0x1c0)),console[_0x4e98ad(0x1d1)](_0x4e98ad(0x1b9))):(console[_0x4e98ad(0x1d1)](a45_0x409843[_0x4e98ad(0x1c4)](_0x4e98ad(0x19e)+_0x58233c[_0x4e98ad(0x1cc)]+'\x0a')),_0x58233c[_0x4e98ad(0x1c3)]&&console[_0x4e98ad(0x1d1)](a45_0x409843[_0x4e98ad(0x1c9)](_0x58233c[_0x4e98ad(0x1c3)]))),0x1;const _0x4080a7=_0x58233c[_0x4e98ad(0x1d4)],_0x8d68b3=_0x58233c[_0x4e98ad(0x1c2)]===_0x4e98ad(0x1ad)?_0x58233c['filePath']:undefined;if(!_0x8d68b3&&!existsSync(_0x4080a7))return console['error'](a45_0x409843[_0x4e98ad(0x1c4)]('Error:\x20Directory\x20not\x20found:\x20'+_0x4080a7+'\x0a')),0x1;let _0x2b843a;if(_0x8d68b3){if(!_0x8d68b3[_0x4e98ad(0x1aa)](_0x4e98ad(0x1bd))&&!_0x8d68b3[_0x4e98ad(0x1aa)](_0x4e98ad(0x1d3)))return console[_0x4e98ad(0x1d1)](a45_0x409843[_0x4e98ad(0x1c4)](_0x4e98ad(0x1b7)+_0x8d68b3+'\x0a')),0x1;_0x2b843a=[_0x8d68b3];}else _0x2b843a=findYamlFiles(_0x4080a7);if(_0x2b843a[_0x4e98ad(0x1cb)]===0x0)return console[_0x4e98ad(0x1d1)](a45_0x409843['red'](_0x4e98ad(0x1d5)+_0x4080a7+'\x0a')),0x1;const _0x4d1c14=validateYamlFiles(_0x2b843a,_0x4080a7),_0xf75131=calculateSummary(_0x4d1c14);for(const _0x4c606e of _0x4d1c14){if(!isValidationResult(_0x4c606e))continue;const {relativePath:_0x427b23,source:_0x36d833,result:_0x2f8a9b,fileType:_0x4535a6}=_0x4c606e,_0x4107f1=_0x4535a6;if(_0x2f8a9b['valid']&&_0x2f8a9b[_0x4e98ad(0x1a5)]['length']===0x0)_0x21d8c3['verbose']&&console['log'](a45_0x409843[_0x4e98ad(0x1bc)]('✔\x20'+_0x427b23)+a45_0x409843[_0x4e98ad(0x1b5)]('\x20('+_0x4107f1+')'));else _0x2f8a9b[_0x4e98ad(0x1a4)]?(console[_0x4e98ad(0x1b6)](a45_0x409843[_0x4e98ad(0x1cd)]('⚠\x20'+_0x427b23)+a45_0x409843[_0x4e98ad(0x1b5)]('\x20('+_0x4107f1+_0x4e98ad(0x1ac)+_0x2f8a9b[_0x4e98ad(0x1a5)][_0x4e98ad(0x1cb)]+_0x4e98ad(0x1d0))),console['log'](formatValidationResult(_0x2f8a9b,_0x36d833,_0x427b23))):(console['log'](a45_0x409843[_0x4e98ad(0x1c4)]('✖\x20'+_0x427b23)+a45_0x409843['dim']('\x20('+_0x4107f1+'):\x20'+_0x2f8a9b[_0x4e98ad(0x1d2)]['length']+_0x4e98ad(0x1b8))),console['log'](formatValidationResult(_0x2f8a9b,_0x36d833,_0x427b23)));}return console[_0x4e98ad(0x1b6)](''),_0xf75131[_0x4e98ad(0x1a7)]?(console['log'](a45_0x409843[_0x4e98ad(0x1c4)](_0x4e98ad(0x1b0)+_0xf75131[_0x4e98ad(0x1b4)]+_0x4e98ad(0x19f)+_0xf75131['validCount']+_0x4e98ad(0x1c6))),_0xf75131[_0x4e98ad(0x1bb)]>0x0&&console[_0x4e98ad(0x1b6)](a45_0x409843['yellow'](_0xf75131[_0x4e98ad(0x1bb)]+_0x4e98ad(0x1cf))),0x1):(console[_0x4e98ad(0x1b6)](a45_0x409843[_0x4e98ad(0x1bc)](_0x4e98ad(0x1ae)+_0xf75131[_0x4e98ad(0x1ce)]+_0x4e98ad(0x1ab))),_0xf75131['warningCount']>0x0&&console['log'](a45_0x409843[_0x4e98ad(0x1cd)](_0xf75131['warningCount']+_0x4e98ad(0x1cf))),0x0);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a46_0x1779d3=a46_0x23ac;(function(_0x4be943,_0x42142d){const _0x735348=a46_0x23ac,_0x56d5d0=_0x4be943();while(!![]){try{const _0x487a8b=parseInt(_0x735348(0xc7))/0x1*(-parseInt(_0x735348(0xd7))/0x2)+-parseInt(_0x735348(0xbf))/0x3*(-parseInt(_0x735348(0xd0))/0x4)+-parseInt(_0x735348(0xca))/0x5*(-parseInt(_0x735348(0xbc))/0x6)+parseInt(_0x735348(0xef))/0x7+-parseInt(_0x735348(0xba))/0x8*(-parseInt(_0x735348(0x101))/0x9)+-parseInt(_0x735348(0xc3))/0xa*(parseInt(_0x735348(0xbe))/0xb)+parseInt(_0x735348(0xfa))/0xc*(-parseInt(_0x735348(0xee))/0xd);if(_0x487a8b===_0x42142d)break;else _0x56d5d0['push'](_0x56d5d0['shift']());}catch(_0x4aa0cb){_0x56d5d0['push'](_0x56d5d0['shift']());}}}(a46_0x16a5,0x1c84a));import{BaseCommand}from'./command.js';function a46_0x23ac(_0x2920f9,_0x3c7944){_0x2920f9=_0x2920f9-0xba;const _0x16a5b5=a46_0x16a5();let _0x23ac01=_0x16a5b5[_0x2920f9];return _0x23ac01;}import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{formatFlatList,formatTree}from'../sdk/util/tree-formatter.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';function a46_0x16a5(){const _0x201e17=['listUnified','\x20folder','Parent\x20segment\x20context:\x20','type','Folder/pattern\x20arg:\x20','map','10KNbuIx','listRecursive','/e/','Folder\x20ID:\x20','Listing\x20folders,\x20segments,\x20and\x20journeys...','cause','listWithPattern','\x20segment','segment','sort','Site:\x20','Error:\x20No\x20parent\x20segment\x20context\x20set.','parentId','message','\x27...','log','folderId','journeys','execute','json','\x20matching\x20\x27','/app/ps/','jsonl','65VsTlBq','6321nEukqv','Parent\x20ID:\x20','includes','parentSegment','Use\x20tdx\x20ps\x20list\x20to\x20see\x20available\x20parent\x20segments.','Error:\x20','\x5c$&','\x20journey','✔\x20Found\x20','resolvePathToResource','data','77736ZcRjql','verbose','\x20\x20tdx\x20sg\x20pull\x20\x22My\x20Audience\x22','name','dim','folder','No\x20items\x20match\x20pattern:\x20','240417xQhdLb','Building\x20hierarchy\x20tree...','replace','folders','segments',']\x20matching\x20\x27','64XjUYfU','site','12378HUOatX',',\x20and\x20','11parzYe','30576JGtJIO','error','test','recursive','1268360XbBLsG','Recursive\x20mode:\x20enabled','journeyBundleName','localeCompare','44795bUKwbu','length','(not\x20set)','420RpXyPw','filter','format','listUnifiedWithJourneys','journey','List\x20folders\x20and\x20child\x20segments','44RYelHQ'];a46_0x16a5=function(){return _0x201e17;};return a46_0x16a5();}import a46_0x573c02 from'chalk';export class SegmentsCommand extends BaseCommand{[a46_0x1779d3(0xfd)]='segments';['description']=a46_0x1779d3(0xcf);async[a46_0x1779d3(0xe9)](_0x230d84){const _0xe24c05=a46_0x1779d3,{options:_0x430f02,args:_0x5a5591}=_0x230d84,_0x105a0a=_0x430f02[_0xe24c05(0xc2)],_0x55839c=_0x5a5591[0x0];try{const _0xbd26a1=_0x430f02[_0xe24c05(0xf2)];_0x430f02['verbose']&&(console['error'](_0xe24c05(0xe1)+_0x430f02['site']),console[_0xe24c05(0xc0)](_0xe24c05(0xd3)+(_0xbd26a1||_0xe24c05(0xc9))),_0x55839c&&console[_0xe24c05(0xc0)](_0xe24c05(0xd5)+_0x55839c),_0x105a0a&&console['error'](_0xe24c05(0xc4)));if(!_0xbd26a1)return console[_0xe24c05(0xc0)](_0xe24c05(0xe2)),console[_0xe24c05(0xc0)](''),console['error']('Set\x20a\x20parent\x20segment\x20context\x20first:'),console['error'](_0xe24c05(0xfc)),console['error']('\x20\x20tdx\x20sg\x20use\x20\x22My\x20Audience\x22'),console[_0xe24c05(0xc0)](''),console[_0xe24c05(0xc0)](_0xe24c05(0xf3)),0x1;const _0x2bed4a=_0x55839c&&(_0x55839c[_0xe24c05(0xf1)]('*')||_0x55839c[_0xe24c05(0xf1)]('?'));if(_0x2bed4a)return await this[_0xe24c05(0xdd)](_0x230d84,_0xbd26a1,_0x55839c);const _0x1448f7=_0x55839c?_0xbd26a1+'/'+_0x55839c:_0xbd26a1;return _0x105a0a?await this['listRecursive'](_0x230d84,_0x1448f7):await this[_0xe24c05(0xd1)](_0x230d84,_0x1448f7);}catch(_0x3f39ad){if(_0x3f39ad instanceof SDKError)return console[_0xe24c05(0xc0)](_0xe24c05(0xf4)+_0x3f39ad[_0xe24c05(0xe4)]),_0x3f39ad[_0xe24c05(0xdc)]&&console['error']('\x20\x20Cause:\x20'+_0x3f39ad[_0xe24c05(0xdc)]),0x1;throw _0x3f39ad;}}async[a46_0x1779d3(0xdd)](_0x2b7ef0,_0x5a0235,_0x219fd3){const _0x5aa454=a46_0x1779d3,{options:_0x3d0e41,tdx:_0xc878db}=_0x2b7ef0,_0x9c068d=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5a0235+'\x27...',()=>_0xc878db[_0x5aa454(0xdf)][_0x5aa454(0xf8)](_0x5a0235),{'verbose':_0x3d0e41['verbose']}),_0x23f4c4=_0x9c068d['data'],_0x4e5eb1=await withSpinner(_0x5aa454(0xdb),()=>_0xc878db[_0x5aa454(0xdf)][_0x5aa454(0xcd)](_0x23f4c4[_0x5aa454(0xe3)],_0x23f4c4['folderId']),{'verbose':_0x3d0e41['verbose']}),{folders:_0x21f4dd,segments:_0xe65c09,journeys:_0x53bea7}=_0x4e5eb1[_0x5aa454(0xf9)],_0x5ae226=_0x219fd3['replace'](/[.+^${}()|[\]\\]/g,_0x5aa454(0xf5))[_0x5aa454(0x103)](/\*/g,'.*')[_0x5aa454(0x103)](/\?/g,'.'),_0x4aef98=new RegExp('^'+_0x5ae226+'$','i'),_0x59c78a=_0x21f4dd['filter'](_0x8f8d70=>_0x4aef98['test'](_0x8f8d70['name'])),_0x3df1ad=_0xe65c09[_0x5aa454(0xcb)](_0x405ac8=>_0x4aef98[_0x5aa454(0xc1)](_0x405ac8[_0x5aa454(0xfd)])),_0x566726=_0x53bea7['filter'](_0x1cd3e9=>_0x4aef98[_0x5aa454(0xc1)](_0x1cd3e9[_0x5aa454(0xc5)])),_0x53a0ec=_0x59c78a['length']+_0x3df1ad['length']+_0x566726[_0x5aa454(0xc8)];console[_0x5aa454(0xc0)]('✔\x20Found\x20'+_0x59c78a[_0x5aa454(0xc8)]+'\x20folder'+(_0x59c78a['length']!==0x1?'s':'')+',\x20'+_0x3df1ad[_0x5aa454(0xc8)]+'\x20segment'+(_0x3df1ad['length']!==0x1?'s':'')+_0x5aa454(0xbd)+_0x566726[_0x5aa454(0xc8)]+_0x5aa454(0xf6)+(_0x566726[_0x5aa454(0xc8)]!==0x1?'s':'')+_0x5aa454(0xeb)+_0x219fd3+'\x27');const _0x2ef7a8=_0x15e8d0=>{const _0xa97686=_0x5aa454;return getConsoleNextUrl(_0x3d0e41[_0xa97686(0xbb)],_0xa97686(0xec)+_0x23f4c4['parentId']+'/e/'+_0x15e8d0);},_0x44d077=_0x3d0e41[_0x5aa454(0xcc)]==='json'||_0x3d0e41[_0x5aa454(0xcc)]===_0x5aa454(0xed);if(_0x44d077){const _0x591dba=[..._0x59c78a['map'](_0x5196c0=>({..._0x5196c0,'type':_0x5aa454(0xff)})),..._0x3df1ad['map'](_0x29ca47=>({..._0x29ca47,'type':_0x5aa454(0xdf),'url':_0x2ef7a8(_0x29ca47['id'])})),..._0x566726[_0x5aa454(0xd6)](_0x33280a=>({..._0x33280a,'name':_0x33280a[_0x5aa454(0xc5)],'type':_0x5aa454(0xce)}))][_0x5aa454(0xe0)]((_0x40ea8a,_0x3b5746)=>_0x40ea8a[_0x5aa454(0xfd)][_0x5aa454(0xc6)](_0x3b5746[_0x5aa454(0xfd)]));await handleSDKOutput(_0x591dba,_0x3d0e41);}else{if(_0x53a0ec===0x0)console['log'](_0x5aa454(0x100)+_0x219fd3);else{console[_0x5aa454(0xe6)](a46_0x573c02[_0x5aa454(0xfe)]('['+_0x5a0235+_0x5aa454(0x106)+_0x219fd3+'\x27'));const _0x497800=formatFlatList(_0x59c78a,_0x3df1ad,{'showMetadata':!![],'getSegmentUrl':_0x2ef7a8},_0x566726);console[_0x5aa454(0xe6)](_0x497800);}}return 0x0;}async[a46_0x1779d3(0xd1)](_0x5c8c29,_0x3d3e35){const _0x1a92a7=a46_0x1779d3,{options:_0x1dc2e7,tdx:_0xe5c4}=_0x5c8c29,_0x2883f8=await withSpinner('Resolving\x20path\x20\x27'+_0x3d3e35+_0x1a92a7(0xe5),()=>_0xe5c4['segment'][_0x1a92a7(0xf8)](_0x3d3e35),{'verbose':_0x1dc2e7['verbose']}),_0x597596=_0x2883f8[_0x1a92a7(0xf9)];_0x1dc2e7[_0x1a92a7(0xfb)]&&(console['error']('Parent\x20ID:\x20'+_0x597596[_0x1a92a7(0xe3)]),_0x597596['folderId']&&console['error'](_0x1a92a7(0xda)+_0x597596[_0x1a92a7(0xe7)]));const _0x4415db=await withSpinner(_0x1a92a7(0xdb),()=>_0xe5c4[_0x1a92a7(0xdf)][_0x1a92a7(0xcd)](_0x597596[_0x1a92a7(0xe3)],_0x597596[_0x1a92a7(0xe7)]),{'verbose':_0x1dc2e7[_0x1a92a7(0xfb)]}),{folders:_0xa5ce94,segments:_0x471c77,journeys:_0x4f9b5b}=_0x4415db['data'],_0x5911cc=_0xa5ce94[_0x1a92a7(0xc8)]+_0x471c77['length']+_0x4f9b5b[_0x1a92a7(0xc8)];console[_0x1a92a7(0xc0)](_0x1a92a7(0xf7)+_0xa5ce94[_0x1a92a7(0xc8)]+_0x1a92a7(0xd2)+(_0xa5ce94[_0x1a92a7(0xc8)]!==0x1?'s':'')+',\x20'+_0x471c77['length']+'\x20segment'+(_0x471c77[_0x1a92a7(0xc8)]!==0x1?'s':'')+_0x1a92a7(0xbd)+_0x4f9b5b[_0x1a92a7(0xc8)]+_0x1a92a7(0xf6)+(_0x4f9b5b[_0x1a92a7(0xc8)]!==0x1?'s':''));const _0x21c10f=_0x4d26f4=>{const _0x21851d=_0x1a92a7;return getConsoleNextUrl(_0x1dc2e7['site'],_0x21851d(0xec)+_0x597596[_0x21851d(0xe3)]+_0x21851d(0xd9)+_0x4d26f4);},_0x273599=_0x52e70e=>{const _0x4d60e1=_0x1a92a7;return getConsoleNextUrl(_0x1dc2e7[_0x4d60e1(0xbb)],_0x4d60e1(0xec)+_0x597596[_0x4d60e1(0xe3)]+'/e/'+_0x52e70e+'/j/da');},_0xa2c604=_0x1dc2e7[_0x1a92a7(0xcc)]===_0x1a92a7(0xea)||_0x1dc2e7[_0x1a92a7(0xcc)]===_0x1a92a7(0xed);if(_0xa2c604){const _0x326cc6=[..._0xa5ce94[_0x1a92a7(0xd6)](_0xfd5d9=>({..._0xfd5d9,'type':_0x1a92a7(0xff)})),..._0x471c77['map'](_0x46c1ed=>({..._0x46c1ed,'type':'segment','url':_0x21c10f(_0x46c1ed['id'])})),..._0x4f9b5b[_0x1a92a7(0xd6)](_0x5b16d9=>({..._0x5b16d9,'name':_0x5b16d9[_0x1a92a7(0xc5)],'type':'journey','url':_0x273599(_0x5b16d9['id'])}))][_0x1a92a7(0xe0)]((_0x25bd18,_0x1428a0)=>_0x25bd18['name'][_0x1a92a7(0xc6)](_0x1428a0[_0x1a92a7(0xfd)]));await handleSDKOutput(_0x326cc6,_0x1dc2e7);}else{if(_0x5911cc===0x0)console[_0x1a92a7(0xe6)](a46_0x573c02[_0x1a92a7(0xfe)]('['+_0x3d3e35+']')),console[_0x1a92a7(0xe6)]('(empty)');else{console['log'](a46_0x573c02[_0x1a92a7(0xfe)]('['+_0x3d3e35+']'));const _0x1946ad=formatFlatList(_0xa5ce94,_0x471c77,{'showMetadata':!![],'getSegmentUrl':_0x21c10f,'getJourneyUrl':_0x273599},_0x4f9b5b);console['log'](_0x1946ad);}}return 0x0;}async['listRecursive'](_0x3d938d,_0x1ca5f0){const _0x5774f6=a46_0x1779d3,{options:_0x475af7,tdx:_0x1a6bc3}=_0x3d938d,_0x3a9125=await withSpinner('Resolving\x20path\x20\x27'+_0x1ca5f0+_0x5774f6(0xe5),()=>_0x1a6bc3['segment'][_0x5774f6(0xf8)](_0x1ca5f0),{'verbose':_0x475af7[_0x5774f6(0xfb)]}),_0x33fc9c=_0x3a9125[_0x5774f6(0xf9)];_0x475af7[_0x5774f6(0xfb)]&&(console[_0x5774f6(0xc0)](_0x5774f6(0xf0)+_0x33fc9c[_0x5774f6(0xe3)]),_0x33fc9c[_0x5774f6(0xe7)]&&console['error'](_0x5774f6(0xda)+_0x33fc9c['folderId']));const _0x2d2ddf=_0x475af7['maxDepth']||0xa,_0x175db9=await withSpinner(_0x5774f6(0x102),()=>_0x1a6bc3[_0x5774f6(0xdf)][_0x5774f6(0xd8)](_0x33fc9c[_0x5774f6(0xe3)],_0x33fc9c[_0x5774f6(0xe7)],0x0,_0x2d2ddf),{'verbose':_0x475af7[_0x5774f6(0xfb)]}),_0x36bad7=_0x175db9[_0x5774f6(0xf9)],_0x47eb8a=_0x4b4d12=>{const _0x571f70=_0x5774f6;let _0x4a1d57=0x0,_0x1e7a9a=0x0,_0x1bb911=0x0;for(const _0x137745 of _0x4b4d12){if(_0x137745[_0x571f70(0xd4)]===_0x571f70(0xff))_0x4a1d57++;else{if(_0x137745[_0x571f70(0xd4)]===_0x571f70(0xdf))_0x1e7a9a++;else{if(_0x137745[_0x571f70(0xd4)]===_0x571f70(0xce))_0x1bb911++;}}if(_0x137745['children']){const _0x28b64b=_0x47eb8a(_0x137745['children']);_0x4a1d57+=_0x28b64b[_0x571f70(0x104)],_0x1e7a9a+=_0x28b64b[_0x571f70(0x105)],_0x1bb911+=_0x28b64b[_0x571f70(0xe8)];}}return{'folders':_0x4a1d57,'segments':_0x1e7a9a,'journeys':_0x1bb911};},_0x437661=_0x47eb8a(_0x36bad7);console[_0x5774f6(0xc0)]('✔\x20Built\x20tree\x20with\x20'+_0x437661['folders']+_0x5774f6(0xd2)+(_0x437661[_0x5774f6(0x104)]!==0x1?'s':'')+',\x20'+_0x437661[_0x5774f6(0x105)]+_0x5774f6(0xde)+(_0x437661[_0x5774f6(0x105)]!==0x1?'s':'')+_0x5774f6(0xbd)+_0x437661[_0x5774f6(0xe8)]+_0x5774f6(0xf6)+(_0x437661['journeys']!==0x1?'s':''));const _0x296c54=_0x1318d0=>{const _0x3ab247=_0x5774f6;return getConsoleNextUrl(_0x475af7[_0x3ab247(0xbb)],_0x3ab247(0xec)+_0x33fc9c['parentId']+'/e/'+_0x1318d0);},_0x1c5397=_0x38e4d3=>{const _0x3f090b=_0x5774f6;return getConsoleNextUrl(_0x475af7[_0x3f090b(0xbb)],'/app/ps/'+_0x33fc9c['parentId']+'/e/'+_0x38e4d3+'/j/da');};if(_0x475af7[_0x5774f6(0xcc)]===_0x5774f6(0xea)||_0x475af7[_0x5774f6(0xcc)]===_0x5774f6(0xed))await handleSDKOutput(_0x36bad7,_0x475af7);else{console[_0x5774f6(0xe6)](a46_0x573c02[_0x5774f6(0xfe)]('['+_0x1ca5f0+']'));const _0x425ca9=formatTree(_0x36bad7,{'showMetadata':!![],'getSegmentUrl':_0x296c54,'getJourneyUrl':_0x1c5397});console[_0x5774f6(0xe6)](_0x425ca9);}return 0x0;}}
|
|
1
|
+
function a46_0x5192(_0x47ad8c,_0x171650){_0x47ad8c=_0x47ad8c-0x13b;const _0x360bc4=a46_0x360b();let _0x5192d7=_0x360bc4[_0x47ad8c];return _0x5192d7;}const a46_0x1a8d7c=a46_0x5192;(function(_0x4be4d9,_0x49aa0a){const _0x1d519c=a46_0x5192,_0x448f89=_0x4be4d9();while(!![]){try{const _0x552e27=-parseInt(_0x1d519c(0x155))/0x1*(-parseInt(_0x1d519c(0x16b))/0x2)+-parseInt(_0x1d519c(0x149))/0x3*(parseInt(_0x1d519c(0x17d))/0x4)+parseInt(_0x1d519c(0x142))/0x5*(parseInt(_0x1d519c(0x185))/0x6)+parseInt(_0x1d519c(0x16a))/0x7*(parseInt(_0x1d519c(0x144))/0x8)+-parseInt(_0x1d519c(0x17b))/0x9+-parseInt(_0x1d519c(0x167))/0xa*(parseInt(_0x1d519c(0x140))/0xb)+-parseInt(_0x1d519c(0x16f))/0xc*(-parseInt(_0x1d519c(0x163))/0xd);if(_0x552e27===_0x49aa0a)break;else _0x448f89['push'](_0x448f89['shift']());}catch(_0x2a0555){_0x448f89['push'](_0x448f89['shift']());}}}(a46_0x360b,0x85401));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 a46_0x360b(){const _0x1aad4d=['segments','✔\x20Found\x20','59412aIcRHH','\x20\x20tdx\x20sg\x20pull\x20\x22My\x20Audience\x22','\x20\x20Cause:\x20','listWithPattern','Parent\x20segment\x20context:\x20','✔\x20Built\x20tree\x20with\x20','test','journey','dim','json','Parent\x20ID:\x20','Site:\x20','8774874BArRgd','Resolving\x20parent\x20segment\x20\x27','1251968BsHCDK','\x27...','replace','(not\x20set)','segment','Listing\x20folders,\x20segments,\x20and\x20journeys...','journeyBundleName','/app/ps/','69180DAflKK','jsonl','execute','name','site','Building\x20hierarchy\x20tree...','localeCompare','folder','error','journeys','data',',\x20and\x20','children','11dkTLVw','sort','285CnBtyV','map','138976XzSHDN','message','\x20matching\x20\x27','description','/j/da','3FwFJhu','parentSegment','folders','\x20\x20tdx\x20sg\x20use\x20\x22My\x20Audience\x22','log','resolvePathToResource','\x20journey','\x20segment','type','includes','parentId','format','13TDCLCx','cause','listRecursive','recursive','No\x20items\x20match\x20pattern:\x20','\x5c$&','length','maxDepth','Set\x20a\x20parent\x20segment\x20context\x20first:','/e/','verbose','filter','listUnifiedWithJourneys','\x20folder','2119JlqsOv','(empty)','Resolving\x20path\x20\x27','List\x20folders\x20and\x20child\x20segments','9003230JiFbFi','Error:\x20','folderId','259WodiTL','96478fJEytH',']\x20matching\x20\x27'];a46_0x360b=function(){return _0x1aad4d;};return a46_0x360b();}import{formatFlatList,formatTree}from'../sdk/util/tree-formatter.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import a46_0x24726b from'chalk';export class SegmentsCommand extends BaseCommand{['name']=a46_0x1a8d7c(0x16d);[a46_0x1a8d7c(0x147)]=a46_0x1a8d7c(0x166);async[a46_0x1a8d7c(0x187)](_0x3d158d){const _0x1bf462=a46_0x1a8d7c,{options:_0x5cccd8,args:_0x396575}=_0x3d158d,_0x53ab5e=_0x5cccd8[_0x1bf462(0x158)],_0x1fcf45=_0x396575[0x0];try{const _0x45fa38=_0x5cccd8[_0x1bf462(0x14a)];_0x5cccd8[_0x1bf462(0x15f)]&&(console[_0x1bf462(0x13b)](_0x1bf462(0x17a)+_0x5cccd8[_0x1bf462(0x189)]),console[_0x1bf462(0x13b)](_0x1bf462(0x173)+(_0x45fa38||_0x1bf462(0x180))),_0x1fcf45&&console['error']('Folder/pattern\x20arg:\x20'+_0x1fcf45),_0x53ab5e&&console[_0x1bf462(0x13b)]('Recursive\x20mode:\x20enabled'));if(!_0x45fa38)return console['error']('Error:\x20No\x20parent\x20segment\x20context\x20set.'),console[_0x1bf462(0x13b)](''),console['error'](_0x1bf462(0x15d)),console[_0x1bf462(0x13b)](_0x1bf462(0x170)),console[_0x1bf462(0x13b)](_0x1bf462(0x14c)),console[_0x1bf462(0x13b)](''),console[_0x1bf462(0x13b)]('Use\x20tdx\x20ps\x20list\x20to\x20see\x20available\x20parent\x20segments.'),0x1;const _0x41bb57=_0x1fcf45&&(_0x1fcf45[_0x1bf462(0x152)]('*')||_0x1fcf45['includes']('?'));if(_0x41bb57)return await this[_0x1bf462(0x172)](_0x3d158d,_0x45fa38,_0x1fcf45);const _0x4139aa=_0x1fcf45?_0x45fa38+'/'+_0x1fcf45:_0x45fa38;return _0x53ab5e?await this['listRecursive'](_0x3d158d,_0x4139aa):await this['listUnified'](_0x3d158d,_0x4139aa);}catch(_0x437837){if(_0x437837 instanceof SDKError)return console[_0x1bf462(0x13b)](_0x1bf462(0x168)+_0x437837[_0x1bf462(0x145)]),_0x437837[_0x1bf462(0x156)]&&console[_0x1bf462(0x13b)](_0x1bf462(0x171)+_0x437837['cause']),0x1;throw _0x437837;}}async['listWithPattern'](_0xe81b72,_0x59d71e,_0x13998c){const _0x30a472=a46_0x1a8d7c,{options:_0x4d5fe8,tdx:_0x5b196e}=_0xe81b72,_0x36bf7b=await withSpinner(_0x30a472(0x17c)+_0x59d71e+_0x30a472(0x17e),()=>_0x5b196e[_0x30a472(0x181)][_0x30a472(0x14e)](_0x59d71e),{'verbose':_0x4d5fe8['verbose']}),_0x284db9=_0x36bf7b[_0x30a472(0x13d)],_0xbe697a=await withSpinner(_0x30a472(0x182),()=>_0x5b196e[_0x30a472(0x181)][_0x30a472(0x161)](_0x284db9[_0x30a472(0x153)],_0x284db9[_0x30a472(0x169)]),{'verbose':_0x4d5fe8[_0x30a472(0x15f)]}),{folders:_0x1fa49b,segments:_0x3da059,journeys:_0x240b9e}=_0xbe697a[_0x30a472(0x13d)],_0x41ccd7=_0x13998c[_0x30a472(0x17f)](/[.+^${}()|[\]\\]/g,_0x30a472(0x15a))['replace'](/\*/g,'.*')[_0x30a472(0x17f)](/\?/g,'.'),_0x5c4088=new RegExp('^'+_0x41ccd7+'$','i'),_0x12b1d8=_0x1fa49b[_0x30a472(0x160)](_0x27f631=>_0x5c4088[_0x30a472(0x175)](_0x27f631[_0x30a472(0x188)])),_0x1b57a7=_0x3da059[_0x30a472(0x160)](_0x1e69e8=>_0x5c4088[_0x30a472(0x175)](_0x1e69e8[_0x30a472(0x188)])),_0x1befae=_0x240b9e[_0x30a472(0x160)](_0x30463c=>_0x5c4088['test'](_0x30463c['journeyBundleName'])),_0x34e51d=_0x12b1d8[_0x30a472(0x15b)]+_0x1b57a7[_0x30a472(0x15b)]+_0x1befae[_0x30a472(0x15b)];console[_0x30a472(0x13b)](_0x30a472(0x16e)+_0x12b1d8[_0x30a472(0x15b)]+_0x30a472(0x162)+(_0x12b1d8['length']!==0x1?'s':'')+',\x20'+_0x1b57a7[_0x30a472(0x15b)]+_0x30a472(0x150)+(_0x1b57a7[_0x30a472(0x15b)]!==0x1?'s':'')+_0x30a472(0x13e)+_0x1befae['length']+_0x30a472(0x14f)+(_0x1befae[_0x30a472(0x15b)]!==0x1?'s':'')+_0x30a472(0x146)+_0x13998c+'\x27');const _0x551fb7=_0x30bd7c=>{const _0x213c5d=_0x30a472;return getConsoleNextUrl(_0x4d5fe8[_0x213c5d(0x189)],_0x213c5d(0x184)+_0x284db9[_0x213c5d(0x153)]+'/e/'+_0x30bd7c);},_0x1cd0e2=_0x4d5fe8['format']===_0x30a472(0x178)||_0x4d5fe8[_0x30a472(0x154)]===_0x30a472(0x186);if(_0x1cd0e2){const _0x23fc27=[..._0x12b1d8[_0x30a472(0x143)](_0x3842c3=>({..._0x3842c3,'type':'folder'})),..._0x1b57a7[_0x30a472(0x143)](_0x1479f2=>({..._0x1479f2,'type':_0x30a472(0x181),'url':_0x551fb7(_0x1479f2['id'])})),..._0x1befae[_0x30a472(0x143)](_0x31a5bd=>({..._0x31a5bd,'name':_0x31a5bd[_0x30a472(0x183)],'type':_0x30a472(0x176)}))][_0x30a472(0x141)]((_0x276b96,_0x559a0a)=>_0x276b96['name']['localeCompare'](_0x559a0a[_0x30a472(0x188)]));await handleSDKOutput(_0x23fc27,_0x4d5fe8);}else{if(_0x34e51d===0x0)console[_0x30a472(0x14d)](_0x30a472(0x159)+_0x13998c);else{console['log'](a46_0x24726b['dim']('['+_0x59d71e+_0x30a472(0x16c)+_0x13998c+'\x27'));const _0x3ee2b1=formatFlatList(_0x12b1d8,_0x1b57a7,{'showMetadata':!![],'getSegmentUrl':_0x551fb7},_0x1befae);console[_0x30a472(0x14d)](_0x3ee2b1);}}return 0x0;}async['listUnified'](_0x1a77af,_0x1305e1){const _0x17da8f=a46_0x1a8d7c,{options:_0x2d21a0,tdx:_0xf8a640}=_0x1a77af,_0x54f51e=await withSpinner(_0x17da8f(0x165)+_0x1305e1+_0x17da8f(0x17e),()=>_0xf8a640['segment'][_0x17da8f(0x14e)](_0x1305e1),{'verbose':_0x2d21a0[_0x17da8f(0x15f)]}),_0x5c015e=_0x54f51e['data'];_0x2d21a0[_0x17da8f(0x15f)]&&(console[_0x17da8f(0x13b)](_0x17da8f(0x179)+_0x5c015e[_0x17da8f(0x153)]),_0x5c015e['folderId']&&console[_0x17da8f(0x13b)]('Folder\x20ID:\x20'+_0x5c015e['folderId']));const _0x205e2b=await withSpinner('Listing\x20folders,\x20segments,\x20and\x20journeys...',()=>_0xf8a640[_0x17da8f(0x181)][_0x17da8f(0x161)](_0x5c015e[_0x17da8f(0x153)],_0x5c015e['folderId']),{'verbose':_0x2d21a0['verbose']}),{folders:_0x424e1d,segments:_0x57b44c,journeys:_0xd90ba2}=_0x205e2b[_0x17da8f(0x13d)],_0x38c3a4=_0x424e1d[_0x17da8f(0x15b)]+_0x57b44c[_0x17da8f(0x15b)]+_0xd90ba2[_0x17da8f(0x15b)];console[_0x17da8f(0x13b)]('✔\x20Found\x20'+_0x424e1d['length']+_0x17da8f(0x162)+(_0x424e1d[_0x17da8f(0x15b)]!==0x1?'s':'')+',\x20'+_0x57b44c[_0x17da8f(0x15b)]+_0x17da8f(0x150)+(_0x57b44c[_0x17da8f(0x15b)]!==0x1?'s':'')+',\x20and\x20'+_0xd90ba2[_0x17da8f(0x15b)]+'\x20journey'+(_0xd90ba2[_0x17da8f(0x15b)]!==0x1?'s':''));const _0xf52faa=_0x394c4f=>{const _0x3924ff=_0x17da8f;return getConsoleNextUrl(_0x2d21a0[_0x3924ff(0x189)],_0x3924ff(0x184)+_0x5c015e['parentId']+_0x3924ff(0x15e)+_0x394c4f);},_0x2de74e=_0x4f5b58=>{const _0xf853ad=_0x17da8f;return getConsoleNextUrl(_0x2d21a0[_0xf853ad(0x189)],'/app/ps/'+_0x5c015e[_0xf853ad(0x153)]+_0xf853ad(0x15e)+_0x4f5b58+_0xf853ad(0x148));},_0x324ad5=_0x2d21a0[_0x17da8f(0x154)]===_0x17da8f(0x178)||_0x2d21a0[_0x17da8f(0x154)]==='jsonl';if(_0x324ad5){const _0x1b1b28=[..._0x424e1d[_0x17da8f(0x143)](_0x27576b=>({..._0x27576b,'type':'folder'})),..._0x57b44c['map'](_0x4be8d9=>({..._0x4be8d9,'type':_0x17da8f(0x181),'url':_0xf52faa(_0x4be8d9['id'])})),..._0xd90ba2[_0x17da8f(0x143)](_0x4fa28a=>({..._0x4fa28a,'name':_0x4fa28a[_0x17da8f(0x183)],'type':_0x17da8f(0x176),'url':_0x2de74e(_0x4fa28a['id'])}))][_0x17da8f(0x141)]((_0x6f668b,_0x4ca9fe)=>_0x6f668b[_0x17da8f(0x188)][_0x17da8f(0x18b)](_0x4ca9fe[_0x17da8f(0x188)]));await handleSDKOutput(_0x1b1b28,_0x2d21a0);}else{if(_0x38c3a4===0x0)console[_0x17da8f(0x14d)](a46_0x24726b[_0x17da8f(0x177)]('['+_0x1305e1+']')),console[_0x17da8f(0x14d)](_0x17da8f(0x164));else{console['log'](a46_0x24726b[_0x17da8f(0x177)]('['+_0x1305e1+']'));const _0x38d478=formatFlatList(_0x424e1d,_0x57b44c,{'showMetadata':!![],'getSegmentUrl':_0xf52faa,'getJourneyUrl':_0x2de74e},_0xd90ba2);console[_0x17da8f(0x14d)](_0x38d478);}}return 0x0;}async[a46_0x1a8d7c(0x157)](_0x57f277,_0x45b0d5){const _0x521305=a46_0x1a8d7c,{options:_0x3709bd,tdx:_0x1e784c}=_0x57f277,_0x2e372a=await withSpinner(_0x521305(0x165)+_0x45b0d5+_0x521305(0x17e),()=>_0x1e784c['segment'][_0x521305(0x14e)](_0x45b0d5),{'verbose':_0x3709bd['verbose']}),_0xcb8c30=_0x2e372a[_0x521305(0x13d)];_0x3709bd[_0x521305(0x15f)]&&(console['error'](_0x521305(0x179)+_0xcb8c30[_0x521305(0x153)]),_0xcb8c30[_0x521305(0x169)]&&console[_0x521305(0x13b)]('Folder\x20ID:\x20'+_0xcb8c30[_0x521305(0x169)]));const _0xa7785=_0x3709bd[_0x521305(0x15c)]||0xa,_0x3b2b18=await withSpinner(_0x521305(0x18a),()=>_0x1e784c['segment'][_0x521305(0x157)](_0xcb8c30[_0x521305(0x153)],_0xcb8c30[_0x521305(0x169)],0x0,_0xa7785),{'verbose':_0x3709bd[_0x521305(0x15f)]}),_0x3378de=_0x3b2b18['data'],_0x42124f=_0x371ee5=>{const _0x47a6fd=_0x521305;let _0x33fe10=0x0,_0x39f51c=0x0,_0x20960b=0x0;for(const _0x3c61fd of _0x371ee5){if(_0x3c61fd[_0x47a6fd(0x151)]===_0x47a6fd(0x18c))_0x33fe10++;else{if(_0x3c61fd[_0x47a6fd(0x151)]===_0x47a6fd(0x181))_0x39f51c++;else{if(_0x3c61fd['type']===_0x47a6fd(0x176))_0x20960b++;}}if(_0x3c61fd[_0x47a6fd(0x13f)]){const _0x514a55=_0x42124f(_0x3c61fd[_0x47a6fd(0x13f)]);_0x33fe10+=_0x514a55[_0x47a6fd(0x14b)],_0x39f51c+=_0x514a55['segments'],_0x20960b+=_0x514a55[_0x47a6fd(0x13c)];}}return{'folders':_0x33fe10,'segments':_0x39f51c,'journeys':_0x20960b};},_0x5d1505=_0x42124f(_0x3378de);console[_0x521305(0x13b)](_0x521305(0x174)+_0x5d1505['folders']+_0x521305(0x162)+(_0x5d1505[_0x521305(0x14b)]!==0x1?'s':'')+',\x20'+_0x5d1505[_0x521305(0x16d)]+_0x521305(0x150)+(_0x5d1505['segments']!==0x1?'s':'')+_0x521305(0x13e)+_0x5d1505[_0x521305(0x13c)]+_0x521305(0x14f)+(_0x5d1505[_0x521305(0x13c)]!==0x1?'s':''));const _0x3b2eb5=_0x50cc67=>{const _0x26a25b=_0x521305;return getConsoleNextUrl(_0x3709bd[_0x26a25b(0x189)],_0x26a25b(0x184)+_0xcb8c30[_0x26a25b(0x153)]+_0x26a25b(0x15e)+_0x50cc67);},_0x1c6e5d=_0x4a764e=>{const _0x76bb42=_0x521305;return getConsoleNextUrl(_0x3709bd['site'],'/app/ps/'+_0xcb8c30[_0x76bb42(0x153)]+_0x76bb42(0x15e)+_0x4a764e+_0x76bb42(0x148));};if(_0x3709bd[_0x521305(0x154)]===_0x521305(0x178)||_0x3709bd[_0x521305(0x154)]===_0x521305(0x186))await handleSDKOutput(_0x3378de,_0x3709bd);else{console[_0x521305(0x14d)](a46_0x24726b[_0x521305(0x177)]('['+_0x45b0d5+']'));const _0x5eb2e6=formatTree(_0x3378de,{'showMetadata':!![],'getSegmentUrl':_0x3b2eb5,'getJourneyUrl':_0x1c6e5d});console[_0x521305(0x14d)](_0x5eb2e6);}return 0x0;}}
|
package/dist/commands/show.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a47_0x9df5(_0x4a23cf,_0x2a6cf0){_0x4a23cf=_0x4a23cf-0x156;const _0x430e06=a47_0x430e();let _0x9df568=_0x430e06[_0x4a23cf];return _0x9df568;}const a47_0x4cbd32=a47_0x9df5;(function(_0x398de2,_0x267b62){const _0x40e8a2=a47_0x9df5,_0x5744d2=_0x398de2();while(!![]){try{const _0x4401d3=-parseInt(_0x40e8a2(0x160))/0x1+parseInt(_0x40e8a2(0x165))/0x2+parseInt(_0x40e8a2(0x157))/0x3+parseInt(_0x40e8a2(0x166))/0x4*(-parseInt(_0x40e8a2(0x167))/0x5)+parseInt(_0x40e8a2(0x16b))/0x6*(-parseInt(_0x40e8a2(0x15a))/0x7)+parseInt(_0x40e8a2(0x163))/0x8+parseInt(_0x40e8a2(0x170))/0x9;if(_0x4401d3===_0x267b62)break;else _0x5744d2['push'](_0x5744d2['shift']());}catch(_0x156ad2){_0x5744d2['push'](_0x5744d2['shift']());}}}(a47_0x430e,0x90a48));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';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';export class ShowCommand extends BaseCommand{[a47_0x4cbd32(0x161)]=a47_0x4cbd32(0x178);[a47_0x4cbd32(0x15d)]=a47_0x4cbd32(0x174);async['execute'](_0x58a809){const _0x1aeb12=a47_0x4cbd32;return this[_0x1aeb12(0x17b)](_0x58a809);}async[a47_0x4cbd32(0x17b)](_0x29ecfa){const _0x2c5993=a47_0x4cbd32,{options:_0x59db87,args:_0x1910a0,tdx:_0x33513d}=_0x29ecfa;let _0x5144cf;try{_0x5144cf=parseTableReference(_0x1910a0[0x0]);const _0x4c3042=_0x59db87[_0x2c5993(0x171)];!_0x5144cf['database']&&_0x4c3042&&(_0x5144cf['database']=_0x4c3042);const _0xec492a=validateTableDescribeReference(_0x5144cf);if(_0xec492a)return console[_0x2c5993(0x156)](_0x2c5993(0x162)+_0xec492a),console['error'](_0x2c5993(0x16c)),console[_0x2c5993(0x156)](_0x2c5993(0x16a)),console[_0x2c5993(0x156)](_0x2c5993(0x15b)),0x1;}catch(_0x3d12b3){return console[_0x2c5993(0x156)](_0x2c5993(0x162)+_0x3d12b3['message']),console['error'](_0x2c5993(0x16c)),console['error'](_0x2c5993(0x16a)),console[_0x2c5993(0x156)](_0x2c5993(0x15b)),0x1;}const _0x5ee749=_0x5144cf[_0x2c5993(0x16e)],_0x245232=_0x5144cf[_0x2c5993(0x171)],_0x223f36=_0x5144cf[_0x2c5993(0x169)],_0x566ec1=resolveLimit(_0x59db87[_0x2c5993(0x15f)],DEFAULT_DISPLAY_LIMIT);try{_0x59db87[_0x2c5993(0x159)]&&(console[_0x2c5993(0x156)](_0x2c5993(0x15e)+_0x59db87[_0x2c5993(0x164)]),_0x5ee749&&console[_0x2c5993(0x156)]('Catalog:\x20'+_0x5ee749),console['error'](_0x2c5993(0x168)+_0x245232),console[_0x2c5993(0x156)]('Table:\x20'+_0x223f36),console[_0x2c5993(0x156)](_0x2c5993(0x175)+_0x566ec1));const _0x3ed0ce=_0x5ee749?_0x5ee749+'.'+_0x245232+'.'+_0x223f36:_0x245232+'.'+_0x223f36,_0x2ffbf1=await withSpinner(_0x2c5993(0x17c)+_0x3ed0ce+_0x2c5993(0x15c),()=>_0x33513d[_0x2c5993(0x16f)][_0x2c5993(0x17b)](_0x245232,_0x223f36,_0x566ec1,_0x5ee749),{'verbose':_0x59db87['verbose']}),_0x101b4d=_0x2ffbf1[_0x2c5993(0x177)],_0x586409=_0x101b4d[_0x2c5993(0x177)];return _0x586409[_0x2c5993(0x179)]===0x0?console['error']('✔\x20Query\x20successful\x20-\x200\x20rows\x20returned'):console[_0x2c5993(0x156)](_0x2c5993(0x17d)+_0x586409[_0x2c5993(0x179)]+_0x2c5993(0x16d)+(_0x586409[_0x2c5993(0x179)]!==0x1?'s':'')+'\x20from\x20'+_0x3ed0ce),await handleSDKOutput(_0x586409,_0x59db87),0x0;}catch(_0x155ec9){if(_0x155ec9 instanceof SDKError)return console['error'](_0x2c5993(0x162)+_0x155ec9[_0x2c5993(0x173)]),_0x155ec9[_0x2c5993(0x172)]&&console[_0x2c5993(0x156)](_0x2c5993(0x17a)+_0x155ec9[_0x2c5993(0x172)]),0x1;throw _0x155ec9;}}['validate'](_0x450c42){const _0xd6aef5=a47_0x4cbd32;if(_0x450c42[_0xd6aef5(0x176)][_0xd6aef5(0x179)]===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(_0x450c42[_0xd6aef5(0x176)][_0xd6aef5(0x179)]>0x1)return _0xd6aef5(0x158);return undefined;}}function a47_0x430e(){const _0x4203f1=['limit','1037149IVBoGu','name','Error:\x20','2392768uaphCQ','site','1745900UJkQCc','8644lrDXui','665hLHbPs','Database:\x20','table','\x20\x20\x20or:\x20tdx\x20show\x20<catalog.database.table>','6YmwJJi','Usage:\x20tdx\x20show\x20<database.table>','\x20row','catalog','query','1305270uhScUS','database','cause','message','Show\x20table\x20contents','Limit:\x20','args','data','show','length','\x20\x20Cause:\x20','showTable','Querying\x20','✔\x20Retrieved\x20','error','3393840LkQMkX','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','verbose','3719366zPGNyw','\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--database\x20<database>','...','description','Site:\x20'];a47_0x430e=function(){return _0x4203f1;};return a47_0x430e();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a48_0x59bdda=a48_0x7a6b;(function(_0x40ee2c,_0x2b6d89){const _0x925a4b=a48_0x7a6b,_0x50ce62=_0x40ee2c();while(!![]){try{const _0x309f5c=parseInt(_0x925a4b(0x99))/0x1*(parseInt(_0x925a4b(0x8d))/0x2)+-parseInt(_0x925a4b(0x8c))/0x3+parseInt(_0x925a4b(0xa0))/0x4+-parseInt(_0x925a4b(0x82))/0x5*(-parseInt(_0x925a4b(0x83))/0x6)+-parseInt(_0x925a4b(0x76))/0x7*(parseInt(_0x925a4b(0x92))/0x8)+parseInt(_0x925a4b(0x78))/0x9+-parseInt(_0x925a4b(0x79))/0xa*(-parseInt(_0x925a4b(0x7b))/0xb);if(_0x309f5c===_0x2b6d89)break;else _0x50ce62['push'](_0x50ce62['shift']());}catch(_0x22073d){_0x50ce62['push'](_0x50ce62['shift']());}}}(a48_0x9745,0xbc4e7));function a48_0x7a6b(_0x2472e1,_0x2a565d){_0x2472e1=_0x2472e1-0x76;const _0x97451c=a48_0x9745();let _0x7a6b9e=_0x97451c[_0x2472e1];return _0x7a6b9e;}import{BaseCommand,printAuthError}from'./command.js';import{resolveAPIKeyAsync}from'../core/config.js';import{getOAuthTokens}from'../core/oauth-keychain.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{GlobalContext}from'../core/global-context.js';function a48_0x9745(){const _0xc97d75=['log','cyan','4536546SLkDgb','20PSVREd','status','OAuth','account_id','✓\x20Authentication\x20successful\x0a','88eoFUoO','(from\x20','yellow','email','Read\x20credential\x20from\x20','Name:','✗\x20Validation\x20failed:\x20','2066hYlazu','site','TDX_PROFILE\x20env','displayWithSources','CLI\x20flag','first_name','cli','5991848ERDUSj','execute','User:','310219gvULGt','red','2004057YsFDTe','110BJvCsh','getUserInfo','947419PJimwZ','Account\x20ID:','bold','last_name','config','message','session','411290HzVplK','6mPSUeL','\x20profile:\x20','Show\x20authentication\x20status\x20and\x20current\x20context','filter','No\x20credential\x20found','profile','dim'];a48_0x9745=function(){return _0xc97d75;};return a48_0x9745();}import a48_0x3bc030 from'chalk';export class StatusCommand extends BaseCommand{['name']=a48_0x59bdda(0x8e);['description']=a48_0x59bdda(0x85);async[a48_0x59bdda(0xa1)](_0x30a5bb){const _0x1d7667=a48_0x59bdda,{options:_0x77bdcc,tdx:_0x3a870d}=_0x30a5bb,_0x3ac90b=_0x77bdcc[_0x1d7667(0x9a)],_0x571745=new GlobalContext(_0x77bdcc),_0x5e3b51=_0x571745[_0x1d7667(0x88)],_0x244dac=_0x571745['profileSource'],_0x2750ea=_0x244dac===_0x1d7667(0x9f)?_0x1d7667(0x9d):_0x244dac===_0x1d7667(0x81)?_0x1d7667(0x81):_0x244dac==='env'?_0x1d7667(0x9b):_0x244dac===_0x1d7667(0x7f)?_0x1d7667(0x7f):null,_0x50df2c=_0x5e3b51?a48_0x3bc030[_0x1d7667(0x8b)](_0x5e3b51):a48_0x3bc030[_0x1d7667(0x89)]('N/A'),_0x379eda=_0x2750ea?'\x20'+a48_0x3bc030['dim'](_0x1d7667(0x93)+_0x2750ea+')'):'';console['log'](a48_0x3bc030[_0x1d7667(0x7d)]('tdx')+_0x1d7667(0x84)+_0x50df2c+_0x379eda+'\x20'+a48_0x3bc030[_0x1d7667(0x89)]('(')+'site:\x20'+a48_0x3bc030['cyan'](_0x3ac90b)+a48_0x3bc030[_0x1d7667(0x89)](')'));const _0x1eb513=await getOAuthTokens(_0x5e3b51);if(_0x1eb513)console['log']('Credential\x20type:\x20'+a48_0x3bc030['cyan'](_0x1d7667(0x8f)));else{const _0x234fe6=await resolveAPIKeyAsync(_0x3ac90b,_0x5e3b51);if(_0x234fe6){const {source:_0x3c6336,isDeprecated:_0x547a9b}=_0x234fe6,_0xc3960e=_0x1d7667(0x96)+a48_0x3bc030['cyan'](_0x3c6336);console[_0x1d7667(0x8a)](_0x547a9b?a48_0x3bc030[_0x1d7667(0x94)](_0xc3960e):_0xc3960e);}else console[_0x1d7667(0x8a)](a48_0x3bc030[_0x1d7667(0x94)](_0x1d7667(0x87)));}let _0x88a5f=![];try{const _0x5c36bd=await _0x3a870d['jobs'][_0x1d7667(0x7a)]();console[_0x1d7667(0x8a)](a48_0x3bc030['green'](_0x1d7667(0x91))),console[_0x1d7667(0x8a)](a48_0x3bc030[_0x1d7667(0x7d)](_0x1d7667(0xa2))+'\x20'+a48_0x3bc030[_0x1d7667(0x8b)](_0x5c36bd[_0x1d7667(0x95)]));if(_0x5c36bd['first_name']||_0x5c36bd[_0x1d7667(0x7e)]){const _0x2637ab=[_0x5c36bd[_0x1d7667(0x9e)],_0x5c36bd[_0x1d7667(0x7e)]][_0x1d7667(0x86)](Boolean)['join']('\x20');console['log'](a48_0x3bc030[_0x1d7667(0x7d)](_0x1d7667(0x97))+'\x20'+_0x2637ab);}_0x5c36bd[_0x1d7667(0x90)]&&console['log'](a48_0x3bc030[_0x1d7667(0x7d)](_0x1d7667(0x7c))+'\x20'+a48_0x3bc030[_0x1d7667(0x94)](_0x5c36bd[_0x1d7667(0x90)])),_0x88a5f=!![];}catch(_0x3690d3){_0x3690d3 instanceof HTTPClientError&&_0x3690d3['status']===0x191?printAuthError(_0x3690d3,!![],_0x5e3b51):console['error'](a48_0x3bc030[_0x1d7667(0x77)](_0x1d7667(0x98)+(_0x3690d3 instanceof Error?_0x3690d3[_0x1d7667(0x80)]:String(_0x3690d3))));}return console[_0x1d7667(0x8a)](),_0x571745[_0x1d7667(0x9c)](),_0x88a5f?0x0:0x1;}}
|