@treasuredata/tdx 2026.3.39 → 2026.3.41
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.d.ts.map +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js.map +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/segment-validator.js.map +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/cdp.d.ts +3 -0
- package/dist/sdk/types/cdp.d.ts.map +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_0x5a94be=a41_0x5aae;(function(_0x35a0a7,_0x2c0f5b){const _0x536d66=a41_0x5aae,_0x244514=_0x35a0a7();while(!![]){try{const _0x1fcf47=parseInt(_0x536d66(0x184))/0x1*(parseInt(_0x536d66(0x189))/0x2)+-parseInt(_0x536d66(0x19b))/0x3*(-parseInt(_0x536d66(0x1a6))/0x4)+parseInt(_0x536d66(0x17d))/0x5*(-parseInt(_0x536d66(0x193))/0x6)+parseInt(_0x536d66(0x1b8))/0x7*(parseInt(_0x536d66(0x1ba))/0x8)+parseInt(_0x536d66(0x1ae))/0x9+-parseInt(_0x536d66(0x1af))/0xa+-parseInt(_0x536d66(0x198))/0xb*(parseInt(_0x536d66(0x1a4))/0xc);if(_0x1fcf47===_0x2c0f5b)break;else _0x244514['push'](_0x244514['shift']());}catch(_0x378ec8){_0x244514['push'](_0x244514['shift']());}}}(a41_0xd6ee,0x507f9));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a41_0x6826a6 from'chalk';function a41_0xd6ee(){const _0x29ada0=['\x20versions)','segments','35uGgQGu','segment','878400LGmbsf','parent_segment','Aborted.','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','\x20segments','name','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','pullSegments','targetDir','\x20\x20🗺️\x20\x20','activations','\x20\x20🎯\x20','parentName','site','filter','\x20activations','Parent\x20segment:\x20','dim','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','10jmwngj','files','absolutePath','relativePath','isNew','error','resourceName','638590GYYteq','verbose','yellow','\x20unchanged\x20files','helpText','2UYiHWX','green','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','✔\x20All\x20files\x20are\x20up\x20to\x20date','Pulling\x20segments\x20from\x20\x27','\x20new\x20files','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','\x20\x20Target:\x20','repeat','setPhase','749718cXqyqs','no_parent','\x27...','execute','red','11nKXWKp','segment:pull','counts','3zifjgl','\x0aPull\x20summary\x20for\x20\x27','data','diff','✔\x20Context\x20set:\x20','Target\x20resource:\x20','file','utf-8','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','14146836DqSBtS','dirname','2597776khRUUG','hasChanges','cyan','-\x20no\x20files\x20written','\x20=\x20','\x20changed\x20files','length','Site:\x20','2733048meJaHK','3821760rLxsXF','content','\x0aChanges\x20to\x20\x27','yes','journeyVersions','journeys','Error:\x20'];a41_0xd6ee=function(){return _0x29ada0;};return a41_0xd6ee();}import{existsSync,mkdirSync,writeFileSync}from'fs';import a41_0x302b8f from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';function a41_0x5aae(_0x2f15d6,_0x185bd3){_0x2f15d6=_0x2f15d6-0x177;const _0xd6ee7b=a41_0xd6ee();let _0x5aae04=_0xd6ee7b[_0x2f15d6];return _0x5aae04;}export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';export class SegmentPullCommand extends BaseCommand{[a41_0x5a94be(0x1bf)]=a41_0x5a94be(0x199);['description']=a41_0x5a94be(0x17c);async[a41_0x5a94be(0x196)](_0x46a683){const _0x187c41=a41_0x5a94be,{options:_0x7c36f7,args:_0x3126b3,tdx:_0x2a862a}=_0x46a683,_0x3cc72f=_0x7c36f7,_0x425acf=await resolveTarget({'arg':_0x3126b3[0x0],'contextParent':_0x7c36f7['parentSegment'],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x425acf))return _0x425acf['errorCode']===_0x187c41(0x194)?(console['error'](a41_0x6826a6[_0x187c41(0x186)](_0x187c41(0x18f))),console['error']('Usage:\x20tdx\x20sg\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20(requires\x20context\x20or\x20tdx.json)'),console[_0x187c41(0x182)](_0x187c41(0x18b)),console[_0x187c41(0x182)](_0x187c41(0x1a3))):(console[_0x187c41(0x182)](a41_0x6826a6[_0x187c41(0x197)](_0x187c41(0x1b5)+_0x425acf['message']+'\x0a')),_0x425acf[_0x187c41(0x188)]&&console[_0x187c41(0x182)](a41_0x6826a6[_0x187c41(0x1a8)](_0x425acf[_0x187c41(0x188)]))),0x1;const _0x430d4e=_0x425acf[_0x187c41(0x1c6)],_0x1062c7=_0x425acf[_0x187c41(0x1c2)],_0x3a3bb5=_0x425acf['type']===_0x187c41(0x1a1)?_0x425acf[_0x187c41(0x183)]:undefined;_0x3cc72f[_0x187c41(0x185)]&&(console[_0x187c41(0x182)](_0x187c41(0x1ad)+_0x3cc72f[_0x187c41(0x177)]),console[_0x187c41(0x182)](_0x187c41(0x17a)+_0x430d4e),_0x3a3bb5&&console['error'](_0x187c41(0x1a0)+_0x3a3bb5));const _0x39eb2f=await withProgressSpinner(_0x187c41(0x18d)+_0x430d4e+_0x187c41(0x195),_0x2fe33c=>_0x2a862a[_0x187c41(0x1b9)][_0x187c41(0x1c1)](_0x430d4e,{'targetDir':_0x1062c7,'targetResourceName':_0x3a3bb5,'verbose':_0x3cc72f[_0x187c41(0x185)],'progress':{'update':_0x5de131=>{const _0x4ef0df=_0x187c41;_0x2fe33c[_0x4ef0df(0x192)](_0x5de131),_0x3cc72f['verbose']&&console['error']('\x20\x20'+_0x5de131);}}}),{'verbose':_0x3cc72f[_0x187c41(0x185)]}),_0x3c38d4=_0x39eb2f[_0x187c41(0x19d)];if(_0x3c38d4[_0x187c41(0x19a)][_0x187c41(0x1b7)]===0x0&&_0x3c38d4['counts']['journeys']===0x0)return console[_0x187c41(0x182)](a41_0x6826a6[_0x187c41(0x186)]('No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27'+_0x3c38d4[_0x187c41(0x1c6)]+'\x27')),0x0;const _0x464484=_0x3c38d4['files']['filter'](_0x1c72f9=>_0x1c72f9[_0x187c41(0x181)]),_0x1b1d3e=_0x3c38d4[_0x187c41(0x17e)][_0x187c41(0x178)](_0x97149c=>!_0x97149c[_0x187c41(0x181)]&&_0x97149c['hasChanges']),_0x533054=_0x3c38d4[_0x187c41(0x17e)]['filter'](_0x570d99=>!_0x570d99[_0x187c41(0x181)]&&!_0x570d99['hasChanges']);console[_0x187c41(0x182)](_0x187c41(0x19c)+_0x3c38d4[_0x187c41(0x1c6)]+'\x27:'),console['error'](_0x187c41(0x1c5)+a41_0x6826a6['cyan'](_0x3c38d4['counts'][_0x187c41(0x1b7)]+_0x187c41(0x1be))+'\x20with\x20'+a41_0x6826a6[_0x187c41(0x1a8)](_0x3c38d4['counts'][_0x187c41(0x1c4)]+_0x187c41(0x179)));if(_0x3c38d4[_0x187c41(0x19a)][_0x187c41(0x1b4)]>0x0){const _0x2fa1b6=_0x3c38d4[_0x187c41(0x19a)][_0x187c41(0x1b3)]>_0x3c38d4['counts'][_0x187c41(0x1b4)]?'\x20('+_0x3c38d4['counts'][_0x187c41(0x1b3)]+_0x187c41(0x1b6):'';console[_0x187c41(0x182)](_0x187c41(0x1c3)+a41_0x6826a6[_0x187c41(0x1a8)](_0x3c38d4[_0x187c41(0x19a)][_0x187c41(0x1b4)]+'\x20journeys')+a41_0x6826a6[_0x187c41(0x17b)](_0x2fa1b6));}console[_0x187c41(0x182)]('\x20\x20'+a41_0x6826a6['green']('+\x20'+_0x464484[_0x187c41(0x1ac)]+_0x187c41(0x18e))),console[_0x187c41(0x182)]('\x20\x20'+a41_0x6826a6[_0x187c41(0x186)]('~\x20'+_0x1b1d3e['length']+_0x187c41(0x1ab))),console[_0x187c41(0x182)]('\x20\x20'+a41_0x6826a6['dim']('=\x20'+_0x533054['length']+_0x187c41(0x187))),console[_0x187c41(0x182)](_0x187c41(0x190)+a41_0x6826a6[_0x187c41(0x1a8)](_0x3c38d4['targetDir'])+'\x0a');if(_0x1b1d3e['length']>0x0)for(const _0xb3bae5 of _0x1b1d3e){console['error'](_0x187c41(0x1b1)+_0xb3bae5[_0x187c41(0x180)]+'\x27:'),console[_0x187c41(0x182)]('─'[_0x187c41(0x191)](0x3c)),console[_0x187c41(0x182)](_0xb3bae5[_0x187c41(0x19e)]),console[_0x187c41(0x182)]('─'[_0x187c41(0x191)](0x3c));}if(_0x3cc72f['dryRun'])return console[_0x187c41(0x182)](a41_0x6826a6[_0x187c41(0x186)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x464484['length']===0x0&&_0x1b1d3e['length']===0x0)return console[_0x187c41(0x182)](a41_0x6826a6[_0x187c41(0x18a)](_0x187c41(0x18c))),saveSessionContext({'parent_segment':_0x3c38d4['parentName']},_0x3cc72f['session']),console[_0x187c41(0x182)](a41_0x6826a6[_0x187c41(0x18a)](_0x187c41(0x19f)+a41_0x6826a6[_0x187c41(0x17b)](_0x187c41(0x1bb))+_0x187c41(0x1aa)+a41_0x6826a6[_0x187c41(0x1a8)](_0x3c38d4['parentName']))),0x0;if(!_0x3cc72f[_0x187c41(0x1b2)]){if(!isInteractive())return console[_0x187c41(0x182)](a41_0x6826a6[_0x187c41(0x197)]('\x0aError:'),_0x187c41(0x1bd)),console[_0x187c41(0x182)](a41_0x6826a6[_0x187c41(0x17b)](_0x187c41(0x1c0))),0x1;const _0x4bebcb=await confirmKey('Write\x20'+(_0x464484[_0x187c41(0x1ac)]+_0x1b1d3e[_0x187c41(0x1ac)])+'\x20files?');if(!_0x4bebcb)return console['error'](a41_0x6826a6['yellow'](_0x187c41(0x1bc)),_0x187c41(0x1a9)),0x1;}for(const _0x26bd18 of _0x3c38d4['files']){if(_0x26bd18[_0x187c41(0x181)]||_0x26bd18[_0x187c41(0x1a7)]){const _0x2c6ea8=a41_0x302b8f[_0x187c41(0x1a5)](_0x26bd18[_0x187c41(0x17f)]);!existsSync(_0x2c6ea8)&&mkdirSync(_0x2c6ea8,{'recursive':!![]}),writeFileSync(_0x26bd18[_0x187c41(0x17f)],_0x26bd18[_0x187c41(0x1b0)],_0x187c41(0x1a2));}}return console[_0x187c41(0x182)](a41_0x6826a6[_0x187c41(0x18a)]('✔\x20Pulled\x20'+(_0x464484['length']+_0x1b1d3e[_0x187c41(0x1ac)])+'\x20files\x20to\x20'+_0x3c38d4[_0x187c41(0x1c2)])),saveSessionContext({'parent_segment':_0x3c38d4[_0x187c41(0x1c6)]},_0x3cc72f['session']),console[_0x187c41(0x182)](a41_0x6826a6[_0x187c41(0x18a)](_0x187c41(0x19f)+a41_0x6826a6[_0x187c41(0x17b)](_0x187c41(0x1bb))+_0x187c41(0x1aa)+a41_0x6826a6['cyan'](_0x3c38d4[_0x187c41(0x1c6)]))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a42_0x504d21=a42_0x3133;(function(_0x4b088a,_0x9b7c4c){const _0x2a58bc=a42_0x3133,_0x27e8af=_0x4b088a();while(!![]){try{const _0x2c75c5=parseInt(_0x2a58bc(0x1d5))/0x1*(-parseInt(_0x2a58bc(0x244))/0x2)+-parseInt(_0x2a58bc(0x1d3))/0x3+-parseInt(_0x2a58bc(0x24c))/0x4+parseInt(_0x2a58bc(0x270))/0x5*(-parseInt(_0x2a58bc(0x1f6))/0x6)+parseInt(_0x2a58bc(0x25d))/0x7+-parseInt(_0x2a58bc(0x210))/0x8*(parseInt(_0x2a58bc(0x248))/0x9)+parseInt(_0x2a58bc(0x25a))/0xa;if(_0x2c75c5===_0x9b7c4c)break;else _0x27e8af['push'](_0x27e8af['shift']());}catch(_0x436bf4){_0x27e8af['push'](_0x27e8af['shift']());}}}(a42_0x1956,0x93a8f));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_0x19f976 from'chalk';import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';import{buildFolderMaps}from'../sdk/segment/resolution-context.js';function a42_0x1956(){const _0x43bb9d=['connection','parentSegment','29471250eHxuFD','Folders\x20to\x20create:','/e/','7102095XPlwZo','filePath','error','Resolving\x20parent\x20segment\x20\x27','\x20deleted','\x20\x20Journeys:\x20','segmentFolderId','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','updated','isNew','journeysOnly','add','Fetching\x20connections\x20for\x20name\x20resolution...','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','then','.yaml','setPhase','attributes','/sb/da/esr','4715485iqRpVQ','1144146EGYtYj','toCreate','12611OGkkYo','Error\x20parsing\x20YAML:\x20','name','Aborted.','.yml','segment:push','audienceId','toUpdate','new','getJourney','\x0a✔\x20Push\x20complete','repeat','cwd','endsWith','created','\x20\x20Segments:\x20','Delete\x20segment:','Fetching\x20existing\x20activations...','resolveParentId','Push\x20','\x0aPush\x20summary\x20for\x20\x27','push','\x20\x20🗺️\x20\x20Journeys:','site','delete','/app/ps/','\x20to\x20create','createdAt','journeys','toDelete','listSegments','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','\x20activations]','6FllAVt','Source\x20directory:\x20','unchanged','nameToId','message','updatedAt','yellow','helpText','parent_name','\x27...','journeyBundleName','versionNumber','createdSegmentIds','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','map','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','📁\x20','diff','\x0aValidation\x20failed:','red','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','data','idToName','execute','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','journeyId','7302832TVFCAo','\x20to\x20delete','verbose','paused','deleted','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','\x20folders\x20to\x20create','journeyBundleId','type','existingJourney','Scoped\x20to\x20folder:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','no_parent','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)','buildUserMaps','Parent\x20segment:\x20','dim','user','parentName','yamlConfig','\x20\x20Source:\x20','blue','description','all','\x20updated','folderPath','yes','changed','get','parentFolder','\x20\x20Console\x20URL\x20(share\x20with\x20client):\x20','green','relationships','targetDir','toString','segments','\x20new','New\x20segment:','\x20\x20\x20\x20','results','Changes\x20to\x20journey:','New\x20journey:','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','listJourneysWithDetailsFromParentSegment','\x20changed','set','No\x20','\x20created','Error:\x20','segment\x20or\x20journey','scopedFolderPath','join','174SFGKsA','listActivations','Preparing\x20journeys...','existingSegment','9znhgpH','length','Error:\x20Directory\x20not\x20found:\x20','⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','89620nFGbXw','dryRun','getOutputSchemaWithCache','state','segment','\x20unchanged','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','journey','folderId','\x20\x20📊\x20Segments:','cyan','activations'];a42_0x1956=function(){return _0x43bb9d;};return a42_0x1956();}import{findYamlFiles}from'../sdk/segment/file-discovery.js';function a42_0x3133(_0x2d2036,_0x1eb6ef){_0x2d2036=_0x2d2036-0x1d3;const _0x195666=a42_0x1956();let _0x31337e=_0x195666[_0x2d2036];return _0x31337e;}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_0x504d21(0x1d7)]=a42_0x504d21(0x1da);[a42_0x504d21(0x226)]=a42_0x504d21(0x205);async[a42_0x504d21(0x20d)](_0x3da4a1){const _0x16d981=a42_0x504d21,{options:_0x79bb76,args:_0x54d632,tdx:_0x37d573}=_0x3da4a1,_0x50950d=_0x79bb76,_0x1fb844=await resolveTarget({'arg':_0x54d632[0x0],'contextParent':_0x79bb76[_0x16d981(0x259)],'cwd':process[_0x16d981(0x1e1)]()});if(!isSuccessfulResolution(_0x1fb844))return _0x1fb844['errorCode']===_0x16d981(0x21c)?(console['error'](a42_0x19f976[_0x16d981(0x1fc)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x16d981(0x25f)](_0x16d981(0x21d)),console['error'](_0x16d981(0x21b)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file')):(console[_0x16d981(0x25f)](a42_0x19f976[_0x16d981(0x209)](_0x16d981(0x240)+_0x1fb844[_0x16d981(0x1fa)]+'\x0a')),_0x1fb844[_0x16d981(0x1fd)]&&console[_0x16d981(0x25f)](a42_0x19f976['cyan'](_0x1fb844[_0x16d981(0x1fd)]))),0x1;if(_0x1fb844[_0x16d981(0x218)]===_0x16d981(0x1fe))return console[_0x16d981(0x25f)](a42_0x19f976[_0x16d981(0x209)](_0x16d981(0x24a)+_0x1fb844[_0x16d981(0x231)]+'\x0a')),console[_0x16d981(0x25f)](a42_0x19f976[_0x16d981(0x256)](_0x16d981(0x20a))),0x1;const _0x247e24=_0x1fb844[_0x16d981(0x222)],_0x1c484f=_0x1fb844['targetDir'],_0x55fdab=_0x1fb844['type']==='file'?_0x1fb844[_0x16d981(0x25e)]:undefined,_0x203732=getScopedDetails(_0x1fb844),_0x1afd25=_0x203732?.['isScoped']??![],_0x4da8e2=_0x203732?.[_0x16d981(0x242)]??'';if(!existsSync(_0x1c484f))return console[_0x16d981(0x25f)](a42_0x19f976[_0x16d981(0x209)](_0x16d981(0x24a)+_0x1c484f+'\x0a')),console['error'](a42_0x19f976[_0x16d981(0x256)]('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;_0x50950d[_0x16d981(0x212)]&&(console[_0x16d981(0x25f)]('Site:\x20'+_0x50950d[_0x16d981(0x1ec)]),console[_0x16d981(0x25f)](_0x16d981(0x21f)+_0x247e24),console[_0x16d981(0x25f)](_0x16d981(0x1f7)+_0x1c484f),_0x1afd25&&console[_0x16d981(0x25f)](_0x16d981(0x21a)+_0x4da8e2));const _0x5c909f=await withSpinner(_0x16d981(0x260)+_0x247e24+_0x16d981(0x1ff),()=>_0x37d573[_0x16d981(0x250)][_0x16d981(0x1e7)](_0x247e24),{'verbose':_0x50950d['verbose']}),_0x1f7173=_0x5c909f[_0x16d981(0x20b)],{parentSegmentResult:_0x263747,segmentsResult:_0x33bf10,foldersResult:_0x299c1f,journeysWithDetailsResult:_0x2a0610,userMaps:_0x3fe0ae}=await withSpinner('Fetching\x20existing\x20data...',async()=>{const _0x20dd62=_0x16d981,[_0x2b47e5,_0x1dc61a,_0x58c2df,_0x1f70a4,_0x14298d]=await Promise[_0x20dd62(0x227)]([_0x37d573[_0x20dd62(0x250)]['getParent'](_0x1f7173),_0x37d573['segment'][_0x20dd62(0x1f3)](_0x1f7173),_0x37d573[_0x20dd62(0x250)]['listFolders'](_0x1f7173),_0x37d573[_0x20dd62(0x253)][_0x20dd62(0x23b)](_0x1f7173,{'includeAllVersions':!![]}),_0x37d573[_0x20dd62(0x221)][_0x20dd62(0x21e)]()]);return{'parentSegmentResult':_0x2b47e5,'segmentsResult':_0x1dc61a,'foldersResult':_0x58c2df,'journeysWithDetailsResult':_0x1f70a4,'userMaps':_0x14298d};},{'verbose':_0x50950d[_0x16d981(0x212)]})[_0x16d981(0x26b)](_0x59b82b=>_0x59b82b[_0x16d981(0x20b)]),_0x194820=_0x263747,_0x4a789b=extractRootFolderId(_0x194820),_0x5b01cf=_0x33bf10,_0x994184=_0x299c1f,{journeys:_0x5bdf41,activationStepsById:_0x51507f}=_0x2a0610,_0x5906ef=new Map(_0x5bdf41[_0x16d981(0x204)](_0xe82cad=>[_0xe82cad['id'],_0xe82cad])),_0x37435a=_0x5bdf41[_0x16d981(0x204)](_0x1acde5=>({'id':_0x1acde5['id'],'name':_0x1acde5[_0x16d981(0x26e)]['name'],'journeyBundleName':_0x1acde5['attributes'][_0x16d981(0x200)]||'','journeyBundleId':_0x1acde5[_0x16d981(0x26e)][_0x16d981(0x217)]||'','versionNumber':_0x1acde5[_0x16d981(0x26e)][_0x16d981(0x201)],'description':_0x1acde5[_0x16d981(0x26e)]['description'],'state':_0x1acde5['attributes'][_0x16d981(0x24f)],'paused':_0x1acde5[_0x16d981(0x26e)][_0x16d981(0x213)],'audienceId':_0x1acde5[_0x16d981(0x26e)][_0x16d981(0x1db)],'folderId':_0x1acde5[_0x16d981(0x230)]?.[_0x16d981(0x22d)]?.[_0x16d981(0x20b)]?.['id'],'createdAt':_0x1acde5[_0x16d981(0x26e)][_0x16d981(0x1f0)],'updatedAt':_0x1acde5[_0x16d981(0x26e)][_0x16d981(0x1fb)]})),{emailToId:_0x508c4b,idToEmail:_0x4c6171}=_0x3fe0ae,_0x525c75=await withSpinner(_0x16d981(0x269),async()=>{const _0x42860f=_0x16d981,_0xffe72f=await _0x37d573[_0x42860f(0x258)]['list']();return buildConnectionMaps(_0xffe72f);},{'verbose':_0x50950d[_0x16d981(0x212)]})[_0x16d981(0x26b)](_0xa7ffc5=>_0xa7ffc5[_0x16d981(0x20b)]),_0x352f85=_0x525c75[_0x16d981(0x1f9)],_0x24612f=_0x525c75[_0x16d981(0x20c)],_0xf69f2=_0x525c75['nameToType'],_0x5e85f8={'emailToIdMap':_0x508c4b,'connectionNameToIdMap':_0x352f85,'connectionNameToTypeMap':_0xf69f2,'getSchema':_0x502754=>_0x37d573[_0x16d981(0x258)][_0x16d981(0x24e)](_0x502754)};let {pathToId:_0x15a2dd,idToPath:_0x31dc0b}=buildFolderMaps(_0x994184);const _0x35a87b=buildSegmentLookupMap(_0x5b01cf,_0x31dc0b),_0x137fb6=buildSegmentNameToIdMap(_0x5b01cf),_0x192201=buildJourneyBundleLookupMap(_0x37435a,_0x31dc0b);let _0xfea360;if(_0x55fdab){if(!_0x55fdab['endsWith'](_0x16d981(0x1d9))&&!_0x55fdab[_0x16d981(0x1e2)](_0x16d981(0x26c)))return console[_0x16d981(0x25f)](a42_0x19f976[_0x16d981(0x209)](_0x16d981(0x203)+_0x55fdab+'\x0a')),0x1;_0xfea360=[_0x55fdab];}else _0xfea360=findYamlFiles(_0x1c484f);if(_0xfea360[_0x16d981(0x249)]===0x0)return console[_0x16d981(0x25f)](a42_0x19f976[_0x16d981(0x209)](_0x16d981(0x264)+_0x1c484f+'\x0a')),console[_0x16d981(0x25f)](a42_0x19f976['cyan'](_0x16d981(0x1f4))),0x1;let _0x361066,_0xabc53d;try{const _0x430294=parseAndClassifyYamlFiles(_0xfea360,_0x1c484f,{'skipSegments':_0x50950d['journeysOnly']});_0x361066=_0x430294[_0x16d981(0x233)],_0xabc53d=_0x430294[_0x16d981(0x1f1)];const _0x23ae31=validateParsedFiles(_0x430294,_0x1c484f);if(_0x23ae31[_0x16d981(0x249)]>0x0)return console[_0x16d981(0x25f)](a42_0x19f976[_0x16d981(0x209)](_0x16d981(0x208))),console[_0x16d981(0x25f)](formatValidationErrors(_0x23ae31)),console[_0x16d981(0x25f)](a42_0x19f976[_0x16d981(0x1fc)](_0x16d981(0x26a))),0x1;}catch(_0x437729){return console[_0x16d981(0x25f)](a42_0x19f976[_0x16d981(0x209)](_0x16d981(0x1d6)+(_0x437729 instanceof Error?_0x437729[_0x16d981(0x1fa)]:_0x437729))),0x1;}if(_0x361066[_0x16d981(0x249)]===0x0&&_0xabc53d[_0x16d981(0x249)]===0x0){const _0x1dad26=_0x50950d[_0x16d981(0x267)]?_0x16d981(0x253):_0x16d981(0x241);return console[_0x16d981(0x25f)](a42_0x19f976[_0x16d981(0x1fc)](_0x16d981(0x23e)+_0x1dad26+'\x20YAML\x20files\x20found')),0x0;}const _0x46e1f7=new Map();_0x5b01cf[_0x16d981(0x249)]>0x0&&!_0x50950d[_0x16d981(0x267)]&&await withSpinner(_0x16d981(0x1e6),async()=>{await batchAsync(_0x5b01cf,async _0x1c2371=>{const _0x2ed326=a42_0x3133,_0x3bdcaf=await _0x37d573['segment'][_0x2ed326(0x245)](_0x1f7173,_0x1c2371['id']);_0x46e1f7[_0x2ed326(0x23d)](_0x1c2371['id'],_0x3bdcaf);});},{'verbose':_0x50950d['verbose']});const {segmentFiles:_0x3405e7,foldersToCreate:_0x3f3c71}=await prepareSegmentFiles(_0x361066,{'segmentByFolderAndName':_0x35a87b,'activationsBySegmentId':_0x46e1f7,'folderPathToId':_0x15a2dd,'idToEmailMap':_0x4c6171,'connectionIdToNameMap':_0x24612f},_0x5e85f8,_0x1afd25,_0x4da8e2),_0x450c94=_0x55fdab?[]:findSegmentsToDelete(_0x5b01cf,_0x361066[_0x16d981(0x204)](({yamlConfig:_0x1b3d15,folderPath:_0x223ac8})=>({'yamlConfig':_0x1b3d15,'folderPath':resolveTDFolderPath(_0x223ac8,_0x1afd25,_0x4da8e2)})),_0x31dc0b,_0x4da8e2,_0x1afd25),{journeyFiles:_0x705f22,foldersToCreate:_0xcadb43}=await withProgressSpinner(_0x16d981(0x246),async _0x3c661e=>prepareJourneyFiles(_0xabc53d,{'fetchJourney':async _0x591763=>_0x37d573[_0x16d981(0x253)][_0x16d981(0x1de)](_0x591763[_0x16d981(0x20f)]),'journeyBundlesByFolderAndName':_0x192201,'folderPathToId':_0x15a2dd,'idToEmailMap':_0x4c6171,'connectionIdToNameMap':_0x24612f,'existingSegments':_0x5b01cf,'parentId':_0x1f7173,'deps':_0x37d573,'progress':{'update':_0x4e646f=>{const _0x4796a4=_0x16d981;_0x3c661e[_0x4796a4(0x26d)](_0x4e646f),_0x50950d[_0x4796a4(0x212)]&&console['error']('\x20\x20'+_0x4e646f);}},'journeyById':_0x5906ef,'activationStepsById':_0x51507f},_0x1afd25,_0x4da8e2),{'verbose':_0x50950d[_0x16d981(0x212)]})['then'](_0x4ea764=>_0x4ea764['data']);for(const _0x5a8d28 of _0xcadb43){_0x3f3c71[_0x16d981(0x268)](_0x5a8d28);}const _0x4b7d94=_0x55fdab?[]:findJourneysToDelete(_0x37435a,_0xabc53d[_0x16d981(0x204)](({yamlConfig:_0x26ced6,folderPath:_0x2cbbf1})=>({'yamlConfig':_0x26ced6,'folderPath':resolveTDFolderPath(_0x2cbbf1,_0x1afd25,_0x4da8e2)})),_0x31dc0b,_0x4da8e2,_0x1afd25),_0xf36c19=calculatePushStats(_0x3405e7,_0x705f22,_0x3f3c71,_0x450c94,_0x4b7d94,!!_0x50950d['delete'],!!_0x50950d[_0x16d981(0x267)]),_0xa2f253=_0xf36c19[_0x16d981(0x233)]['new'],_0x5504ef=_0xf36c19[_0x16d981(0x233)]['changed'],_0x329fa0=_0xf36c19[_0x16d981(0x233)][_0x16d981(0x1f8)],_0x3c4af4=_0xf36c19[_0x16d981(0x233)]['toDelete'],_0x3403b7=_0xf36c19['folders'][_0x16d981(0x1d4)],_0x346d62=_0xf36c19[_0x16d981(0x1f1)][_0x16d981(0x1dd)],_0x5a9e15=_0xf36c19['journeys'][_0x16d981(0x22b)],_0xbf69ff=_0xf36c19['journeys'][_0x16d981(0x1f8)],_0x447275=_0xf36c19['journeys'][_0x16d981(0x1f2)],_0x398369=_0xf36c19[_0x16d981(0x257)][_0x16d981(0x227)],_0x4d6a22=_0xf36c19[_0x16d981(0x257)][_0x16d981(0x1d4)],_0x54773d=_0xf36c19[_0x16d981(0x257)][_0x16d981(0x1dc)],_0x42415e=_0xf36c19[_0x16d981(0x257)][_0x16d981(0x1f2)];console['error'](_0x16d981(0x1e9)+_0x247e24+'\x27:');_0x3403b7[_0x16d981(0x249)]>0x0&&console[_0x16d981(0x25f)]('\x20\x20'+a42_0x19f976['blue'](_0x16d981(0x206)+_0x3403b7[_0x16d981(0x249)]+_0x16d981(0x216)));if(!_0x50950d['journeysOnly']){console[_0x16d981(0x25f)](_0x16d981(0x255)),console['error'](_0x16d981(0x236)+a42_0x19f976['green']('+\x20'+_0xa2f253[_0x16d981(0x249)]+_0x16d981(0x234))),console[_0x16d981(0x25f)](_0x16d981(0x236)+a42_0x19f976[_0x16d981(0x1fc)]('~\x20'+_0x5504ef[_0x16d981(0x249)]+_0x16d981(0x23c)));if(_0x3c4af4[_0x16d981(0x249)]>0x0)console[_0x16d981(0x25f)](_0x16d981(0x236)+a42_0x19f976[_0x16d981(0x209)]('-\x20'+_0x3c4af4[_0x16d981(0x249)]+_0x16d981(0x211)));else _0x450c94[_0x16d981(0x249)]>0x0&&!_0x50950d[_0x16d981(0x1ed)]&&console[_0x16d981(0x25f)](_0x16d981(0x236)+a42_0x19f976[_0x16d981(0x220)](_0x450c94[_0x16d981(0x249)]+_0x16d981(0x215)));console['error'](_0x16d981(0x236)+a42_0x19f976['dim']('=\x20'+_0x329fa0['length']+_0x16d981(0x251)));}if(_0x705f22['length']>0x0||_0x4b7d94[_0x16d981(0x249)]>0x0){console[_0x16d981(0x25f)](_0x16d981(0x1eb)),console[_0x16d981(0x25f)](_0x16d981(0x236)+a42_0x19f976['green']('+\x20'+_0x346d62[_0x16d981(0x249)]+_0x16d981(0x234))),console[_0x16d981(0x25f)](_0x16d981(0x236)+a42_0x19f976[_0x16d981(0x1fc)]('~\x20'+_0x5a9e15[_0x16d981(0x249)]+_0x16d981(0x23c)));if(_0x447275[_0x16d981(0x249)]>0x0)console[_0x16d981(0x25f)]('\x20\x20\x20\x20'+a42_0x19f976[_0x16d981(0x209)]('-\x20'+_0x447275[_0x16d981(0x249)]+_0x16d981(0x211)));else _0x4b7d94[_0x16d981(0x249)]>0x0&&!_0x50950d['delete']&&console[_0x16d981(0x25f)]('\x20\x20\x20\x20'+a42_0x19f976[_0x16d981(0x220)](_0x4b7d94[_0x16d981(0x249)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x16d981(0x25f)]('\x20\x20\x20\x20'+a42_0x19f976['dim']('=\x20'+_0xbf69ff[_0x16d981(0x249)]+'\x20unchanged'));}_0x398369[_0x16d981(0x249)]>0x0&&!_0x50950d[_0x16d981(0x267)]&&(console['error'](''),console[_0x16d981(0x25f)]('\x20\x20Activations:'),_0x4d6a22[_0x16d981(0x249)]>0x0&&console[_0x16d981(0x25f)]('\x20\x20\x20\x20'+a42_0x19f976['green']('+\x20'+_0x4d6a22[_0x16d981(0x249)]+_0x16d981(0x1ef))),_0x54773d['length']>0x0&&console[_0x16d981(0x25f)](_0x16d981(0x236)+a42_0x19f976['yellow']('~\x20'+_0x54773d[_0x16d981(0x249)]+'\x20to\x20update')),_0x42415e[_0x16d981(0x249)]>0x0&&console[_0x16d981(0x25f)](_0x16d981(0x236)+a42_0x19f976[_0x16d981(0x209)]('-\x20'+_0x42415e[_0x16d981(0x249)]+_0x16d981(0x211))));console[_0x16d981(0x25f)](_0x16d981(0x224)+a42_0x19f976[_0x16d981(0x256)](_0x1c484f)+'\x0a');if(_0x3403b7[_0x16d981(0x249)]>0x0){console[_0x16d981(0x25f)](_0x16d981(0x25b));for(const _0x5d5c31 of _0x3403b7){console[_0x16d981(0x25f)]('\x20\x20'+a42_0x19f976[_0x16d981(0x225)]('+')+'\x20'+_0x5d5c31);}console[_0x16d981(0x25f)]('');}if(_0xa2f253[_0x16d981(0x249)]>0x0&&!_0x50950d['journeysOnly'])for(const _0x1aadd9 of _0xa2f253){const _0x210a9a=_0x1aadd9[_0x16d981(0x229)]?_0x1aadd9[_0x16d981(0x229)]+'/'+_0x1aadd9[_0x16d981(0x223)]['name']:_0x1aadd9[_0x16d981(0x223)][_0x16d981(0x1d7)],_0x4460b8=_0x1aadd9[_0x16d981(0x223)][_0x16d981(0x257)]?.[_0x16d981(0x249)]||0x0,_0x2ef7dc=_0x4460b8>0x0?a42_0x19f976[_0x16d981(0x220)]('\x20['+_0x4460b8+_0x16d981(0x1f5)):'';console['error']('\x0a'+a42_0x19f976[_0x16d981(0x22f)](_0x16d981(0x235))+'\x20'+_0x210a9a+_0x2ef7dc),console[_0x16d981(0x25f)]('─'[_0x16d981(0x1e0)](0x3c)),_0x1aadd9[_0x16d981(0x207)]&&console[_0x16d981(0x25f)](_0x1aadd9[_0x16d981(0x207)]),console['error']('─'['repeat'](0x3c));}if(_0x3c4af4[_0x16d981(0x249)]>0x0&&!_0x50950d[_0x16d981(0x267)])for(const _0x3964cb of _0x3c4af4){const _0x2b0066=_0x3964cb[_0x16d981(0x263)]?_0x31dc0b[_0x16d981(0x22c)](_0x3964cb[_0x16d981(0x263)][_0x16d981(0x232)]())||'':'',_0x300c9b=_0x2b0066?_0x2b0066+'/'+_0x3964cb[_0x16d981(0x1d7)]:_0x3964cb[_0x16d981(0x1d7)],_0x5b6090=_0x46e1f7['get'](_0x3964cb['id'])||[],_0x27cad5=_0x5b6090[_0x16d981(0x249)]>0x0?a42_0x19f976['dim']('\x20['+_0x5b6090['length']+_0x16d981(0x1f5)):'';console['error']('\x0a'+a42_0x19f976[_0x16d981(0x209)](_0x16d981(0x1e5))+'\x20'+_0x300c9b+_0x27cad5),console['error']('─'[_0x16d981(0x1e0)](0x3c));const _0x49e794=segmentWithActivationsToYaml(_0x3964cb,_0x5b6090,undefined,_0x4c6171,_0x24612f),_0xad2b6c=segmentToYamlString(_0x49e794),_0x13422c=generateDiff(_0xad2b6c,'');console[_0x16d981(0x25f)](formatDiffWithColors(_0x13422c)),console[_0x16d981(0x25f)]('─'[_0x16d981(0x1e0)](0x3c));}const _0x9b72e3=_0x3405e7['filter'](_0x36b03a=>!_0x36b03a[_0x16d981(0x266)]&&_0x36b03a[_0x16d981(0x207)]);if(_0x9b72e3['length']>0x0&&!_0x50950d[_0x16d981(0x267)])for(const _0x57a3a3 of _0x9b72e3){const _0x5b3d73=_0x57a3a3['folderPath']?_0x57a3a3[_0x16d981(0x229)]+'/'+_0x57a3a3[_0x16d981(0x223)][_0x16d981(0x1d7)]:_0x57a3a3['yamlConfig'][_0x16d981(0x1d7)];console[_0x16d981(0x25f)]('\x0a'+a42_0x19f976[_0x16d981(0x1fc)]('Changes\x20to:')+'\x20'+_0x5b3d73),console[_0x16d981(0x25f)]('─'['repeat'](0x3c)),console[_0x16d981(0x25f)](_0x57a3a3[_0x16d981(0x207)]),console[_0x16d981(0x25f)]('─'[_0x16d981(0x1e0)](0x3c));}if(_0x346d62[_0x16d981(0x249)]>0x0)for(const _0x393735 of _0x346d62){const _0xe136e3=_0x393735[_0x16d981(0x229)]?_0x393735[_0x16d981(0x229)]+'/'+_0x393735[_0x16d981(0x223)][_0x16d981(0x1d7)]:_0x393735[_0x16d981(0x223)][_0x16d981(0x1d7)];console['error']('\x0a'+a42_0x19f976[_0x16d981(0x22f)](_0x16d981(0x239))+'\x20'+_0xe136e3),console[_0x16d981(0x25f)]('─'[_0x16d981(0x1e0)](0x3c)),_0x393735['diff']&&console[_0x16d981(0x25f)](_0x393735[_0x16d981(0x207)]),console[_0x16d981(0x25f)]('─'[_0x16d981(0x1e0)](0x3c));}const _0x3c7f59=_0x705f22['filter'](_0x14da06=>!_0x14da06[_0x16d981(0x266)]&&_0x14da06['diff']);if(_0x3c7f59[_0x16d981(0x249)]>0x0)for(const _0x241ac5 of _0x3c7f59){const _0x1790b4=_0x241ac5[_0x16d981(0x229)]?_0x241ac5[_0x16d981(0x229)]+'/'+_0x241ac5[_0x16d981(0x223)][_0x16d981(0x1d7)]:_0x241ac5['yamlConfig'][_0x16d981(0x1d7)];console[_0x16d981(0x25f)]('\x0a'+a42_0x19f976[_0x16d981(0x1fc)](_0x16d981(0x238))+'\x20'+_0x1790b4),console[_0x16d981(0x25f)]('─'['repeat'](0x3c)),console[_0x16d981(0x25f)](_0x241ac5[_0x16d981(0x207)]),console[_0x16d981(0x25f)]('─'[_0x16d981(0x1e0)](0x3c));}if(_0x447275[_0x16d981(0x249)]>0x0)for(const _0x4cfcfb of _0x447275){const _0x5974f9=_0x4cfcfb['folderId']?_0x31dc0b[_0x16d981(0x22c)](_0x4cfcfb[_0x16d981(0x254)])||'':'',_0x4235f6=_0x5974f9?_0x5974f9+'/'+_0x4cfcfb[_0x16d981(0x200)]:_0x4cfcfb[_0x16d981(0x200)];console[_0x16d981(0x25f)]('\x0a'+a42_0x19f976[_0x16d981(0x209)]('Delete\x20journey:')+'\x20'+_0x4235f6),console[_0x16d981(0x25f)]('─'[_0x16d981(0x1e0)](0x3c)),console[_0x16d981(0x25f)](a42_0x19f976['red']('(Journey\x20will\x20be\x20deleted)')),console['error']('─'['repeat'](0x3c));}if(_0x50950d[_0x16d981(0x24d)])return console['error'](a42_0x19f976['yellow'](_0x16d981(0x20e))),0x0;const _0x7e14ab=_0x50950d[_0x16d981(0x267)]?![]:_0xa2f253[_0x16d981(0x249)]>0x0||_0x5504ef[_0x16d981(0x249)]>0x0||_0x3c4af4[_0x16d981(0x249)]>0x0,_0x304986=_0x346d62[_0x16d981(0x249)]>0x0||_0x5a9e15['length']>0x0||_0x447275['length']>0x0,_0x186b37=_0x50950d['journeysOnly']?![]:_0x398369['length']>0x0,_0x3921ca=_0x3403b7['length']>0x0;if(!_0x7e14ab&&!_0x304986&&!_0x186b37&&!_0x3921ca){const _0x5c1994=_0x50950d[_0x16d981(0x267)]?'✔\x20All\x20journeys\x20are\x20up\x20to\x20date':_0x16d981(0x23a);console[_0x16d981(0x25f)](a42_0x19f976[_0x16d981(0x22f)](_0x5c1994));if(_0x55fdab&&_0x329fa0[_0x16d981(0x249)]===0x1){const _0x4b456e=_0x329fa0[0x0];if(_0x4b456e['existingSegment']?.['id']){const _0x3853f7=getConsoleNextUrl(_0x50950d['site'],_0x16d981(0x1ee)+_0x1f7173+'/e/'+_0x4b456e[_0x16d981(0x247)]['id']+_0x16d981(0x26f));console[_0x16d981(0x25f)](_0x16d981(0x22e)+a42_0x19f976['cyan'](_0x3853f7));}}if(_0x55fdab&&_0xbf69ff['length']===0x1){const _0x2d4757=_0xbf69ff[0x0];if(_0x2d4757[_0x16d981(0x219)]?.['id']){const _0x5e0334=getConsoleNextUrl(_0x50950d[_0x16d981(0x1ec)],_0x16d981(0x1ee)+_0x1f7173+_0x16d981(0x25c)+_0x2d4757[_0x16d981(0x219)]['id']+'/j/da/je');console['error']('\x20\x20'+a42_0x19f976[_0x16d981(0x256)](_0x5e0334));}}return 0x0;}const _0x1d3221=_0x50950d[_0x16d981(0x267)]?_0x346d62[_0x16d981(0x249)]+_0x5a9e15[_0x16d981(0x249)]+_0x447275['length']+_0x3403b7[_0x16d981(0x249)]:_0xa2f253[_0x16d981(0x249)]+_0x5504ef[_0x16d981(0x249)]+_0x3c4af4[_0x16d981(0x249)]+_0x346d62[_0x16d981(0x249)]+_0x5a9e15['length']+_0x447275[_0x16d981(0x249)]+_0x3403b7[_0x16d981(0x249)]+_0x398369[_0x16d981(0x249)];if(!_0x50950d[_0x16d981(0x22a)]&&_0x1d3221>0x0){if(!isInteractive())return console[_0x16d981(0x25f)](a42_0x19f976[_0x16d981(0x209)]('\x0aError:'),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console['error'](a42_0x19f976[_0x16d981(0x220)](_0x16d981(0x252))),0x1;const _0x31932b=await confirmKey(_0x16d981(0x1e8)+_0x1d3221+'\x20changes?');if(!_0x31932b)return console['error'](a42_0x19f976[_0x16d981(0x1fc)](_0x16d981(0x1d8))),0x1;}const _0x47c578={'withProgress':async(_0x45df9b,_0x30e1b9)=>{const _0x1e9a27=_0x16d981,_0x4364d6=await withSpinner(_0x45df9b,_0x30e1b9,{'verbose':_0x50950d[_0x1e9a27(0x212)]});return{'data':_0x4364d6[_0x1e9a27(0x20b)]};},'logInfo':_0x74b06e=>console[_0x16d981(0x25f)](a42_0x19f976[_0x16d981(0x225)]('✔\x20'+_0x74b06e)),'logSuccess':_0x509d8d=>console[_0x16d981(0x25f)](a42_0x19f976[_0x16d981(0x22f)]('✔\x20'+_0x509d8d)),'logWarning':_0x463b84=>console[_0x16d981(0x25f)](a42_0x19f976[_0x16d981(0x1fc)]('⚠\x20'+_0x463b84)),'logDeleted':_0x28b9ec=>console[_0x16d981(0x25f)](a42_0x19f976[_0x16d981(0x209)]('✔\x20'+_0x28b9ec))},_0xdc9cc={'segment':_0x37d573[_0x16d981(0x250)],'journey':_0x37d573['journey'],'user':_0x37d573[_0x16d981(0x221)],'connection':_0x37d573[_0x16d981(0x258)]};_0x3403b7[_0x16d981(0x249)]>0x0&&(_0x15a2dd=await executePushFolders(_0xdc9cc,_0x3403b7,_0x15a2dd,{'parentId':_0x1f7173},_0x47c578));const _0x2a191f={'rootFolderId':_0x4a789b,'folderPathToId':_0x15a2dd,'folderIdToPath':_0x31dc0b,'segmentNameToId':_0x137fb6,'activationsBySegmentId':_0x46e1f7,'emailToIdMap':_0x508c4b,'idToEmailMap':_0x4c6171,'connectionNameToIdMap':_0x525c75[_0x16d981(0x1f9)],'connectionIdToNameMap':_0x525c75['idToName'],'connectionNameToTypeMap':_0xf69f2},_0x5c3e87=await executePushSegments(_0xdc9cc,_0x50950d[_0x16d981(0x267)]?[]:_0x3405e7,_0x2a191f,{'parentId':_0x1f7173},_0x47c578),_0x2236d7=_0x5c3e87[_0x16d981(0x1e3)],_0x3b37cf=_0x5c3e87['updated'],_0x3af326=_0x5c3e87[_0x16d981(0x257)]['created'],_0x36c078=_0x5c3e87[_0x16d981(0x257)][_0x16d981(0x265)],_0x355b18=_0x5c3e87[_0x16d981(0x257)][_0x16d981(0x214)];let _0x54dab6;if(_0x55fdab&&_0x3405e7['length']===0x1){const _0x28af91=_0x3405e7[0x0];_0x54dab6=_0x28af91[_0x16d981(0x247)]?.['id']??_0x5c3e87[_0x16d981(0x202)][_0x16d981(0x22c)](_0x28af91[_0x16d981(0x223)][_0x16d981(0x1d7)]);}const _0x78ac02=await executePushSegmentDeletions(_0xdc9cc,_0x50950d[_0x16d981(0x267)]?[]:_0x3c4af4,_0x47c578);let _0x1ce1e3=0x0,_0x20c14e=0x0,_0x1b6528=0x0;const _0x3e810d=new Map(_0x137fb6);for(const [_0x4f0ddd,_0x12924b]of _0x5c3e87[_0x16d981(0x202)]){_0x3e810d[_0x16d981(0x23d)](_0x4f0ddd,_0x12924b);}if(_0x705f22[_0x16d981(0x249)]>0x0){const _0x32eb3a={..._0x2a191f,'segmentNameToId':_0x3e810d,'existingSegments':_0x5b01cf,'activationContext':_0x5e85f8},_0x1123fc=await executePushJourneys(_0xdc9cc,_0x705f22,_0x32eb3a,{'parentId':_0x1f7173,'rootFolderId':_0x4a789b,'verbose':_0x50950d[_0x16d981(0x212)]},_0x47c578);_0x1ce1e3=_0x1123fc[_0x16d981(0x1e3)],_0x20c14e=_0x1123fc['updated'];if(_0x55fdab&&_0x1123fc[_0x16d981(0x237)][_0x16d981(0x249)]===0x1){const _0x82b587=_0x1123fc['results'][0x0];if(_0x82b587[_0x16d981(0x20f)]){const _0x56ee27=getConsoleNextUrl(_0x50950d['site'],_0x16d981(0x1ee)+_0x1f7173+'/e/'+_0x82b587[_0x16d981(0x20f)]+'/j/da/je');console['error']('\x20\x20'+a42_0x19f976[_0x16d981(0x256)](_0x56ee27));}}}for(const _0x366db7 of _0x447275){console[_0x16d981(0x25f)](a42_0x19f976[_0x16d981(0x1fc)](_0x16d981(0x24b)+_0x366db7[_0x16d981(0x200)])),_0x1b6528++;}const _0x3c7338=[];if(_0x2236d7>0x0)_0x3c7338[_0x16d981(0x1ea)](_0x2236d7+'\x20created');if(_0x3b37cf>0x0)_0x3c7338['push'](_0x3b37cf+_0x16d981(0x228));if(_0x78ac02>0x0)_0x3c7338[_0x16d981(0x1ea)](_0x78ac02+_0x16d981(0x261));const _0x17d999=[];if(_0x1ce1e3>0x0)_0x17d999['push'](_0x1ce1e3+_0x16d981(0x23f));if(_0x20c14e>0x0)_0x17d999[_0x16d981(0x1ea)](_0x20c14e+'\x20updated');if(_0x1b6528>0x0)_0x17d999[_0x16d981(0x1ea)](_0x1b6528+'\x20deleted');const _0x3ef436=[];if(_0x3af326>0x0)_0x3ef436[_0x16d981(0x1ea)](_0x3af326+_0x16d981(0x23f));if(_0x36c078>0x0)_0x3ef436[_0x16d981(0x1ea)](_0x36c078+_0x16d981(0x228));if(_0x355b18>0x0)_0x3ef436[_0x16d981(0x1ea)](_0x355b18+_0x16d981(0x261));console[_0x16d981(0x25f)](a42_0x19f976[_0x16d981(0x22f)](_0x16d981(0x1df)));_0x3c7338[_0x16d981(0x249)]>0x0&&!_0x50950d[_0x16d981(0x267)]&&console[_0x16d981(0x25f)](_0x16d981(0x1e4)+_0x3c7338[_0x16d981(0x243)](',\x20'));_0x17d999[_0x16d981(0x249)]>0x0&&console[_0x16d981(0x25f)](_0x16d981(0x262)+_0x17d999[_0x16d981(0x243)](',\x20'));_0x3ef436[_0x16d981(0x249)]>0x0&&!_0x50950d[_0x16d981(0x267)]&&console['error']('\x20\x20Activations:\x20'+_0x3ef436[_0x16d981(0x243)](',\x20'));if(_0x54dab6){const _0x354f1f=getConsoleNextUrl(_0x50950d[_0x16d981(0x1ec)],_0x16d981(0x1ee)+_0x1f7173+_0x16d981(0x25c)+_0x54dab6+'/sb/da/esr');console[_0x16d981(0x25f)](_0x16d981(0x22e)+a42_0x19f976[_0x16d981(0x256)](_0x354f1f));}return 0x0;}}
|
|
1
|
+
const a42_0x272f92=a42_0x3f05;(function(_0x1b939a,_0x3b779d){const _0xfc5818=a42_0x3f05,_0x2fd8aa=_0x1b939a();while(!![]){try{const _0xeaafa=-parseInt(_0xfc5818(0x1f6))/0x1+-parseInt(_0xfc5818(0x1dd))/0x2*(parseInt(_0xfc5818(0x1cf))/0x3)+-parseInt(_0xfc5818(0x243))/0x4+parseInt(_0xfc5818(0x1f8))/0x5+parseInt(_0xfc5818(0x20c))/0x6+parseInt(_0xfc5818(0x1fb))/0x7+-parseInt(_0xfc5818(0x226))/0x8;if(_0xeaafa===_0x3b779d)break;else _0x2fd8aa['push'](_0x2fd8aa['shift']());}catch(_0x2aa667){_0x2fd8aa['push'](_0x2fd8aa['shift']());}}}(a42_0x390c,0x760b5));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';function a42_0x3f05(_0x592ce8,_0x4b9f11){_0x592ce8=_0x592ce8-0x1a7;const _0x390cb0=a42_0x390c();let _0x3f0529=_0x390cb0[_0x592ce8];return _0x3f0529;}import{generateDiff,formatDiffWithColors}from'../utils/diff.js';import{confirmKey,isInteractive}from'../utils/prompt.js';function a42_0x390c(){const _0x295c79=['parent_name','resolveParentId','\x20created','\x27...','buildUserMaps','targetDir','dryRun','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','no_parent','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','journey','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','toDelete','186592SmPWrB','filePath','activations','cyan','Folders\x20to\x20create:','segments','helpText','parentName','name','results','segment','new','isScoped','createdAt','attributes','relationships','/sb/da/esr','Changes\x20to\x20journey:','message','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','delete','parentFolder','listJourneysWithDetailsFromParentSegment','\x20to\x20create','yellow','\x0aError:','all','\x20to\x20update','isNew','(Journey\x20will\x20be\x20deleted)','type','list','Fetching\x20existing\x20data...','Error\x20parsing\x20YAML:\x20','then','push','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','error','Resolving\x20parent\x20segment\x20\x27','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','\x20\x20Console\x20URL\x20(share\x20with\x20client):\x20','Fetching\x20connections\x20for\x20name\x20resolution...','28767rNkWWA','user','journeyBundleName','errorCode','\x20\x20Activations:','Error:\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','Aborted.','data','endsWith','toUpdate','file','Preparing\x20journeys...','folderPath','120AtWbyi','green','repeat','existingJourney','\x20\x20\x20\x20','listFolders','Source\x20directory:\x20','getJourney','📁\x20','listActivations','yes','filter','connection','segmentFolderId','\x20deleted','join','\x0aValidation\x20failed:','\x20updated','length','red','journeysOnly','\x20\x20Activations:\x20','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','\x20YAML\x20files\x20found','parentSegment','69134NWseNQ','\x0a✔\x20Push\x20complete','4749895yWxNCM','created','\x20to\x20delete','4532521xnaJiG','toCreate','nameToId','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','description','journeys','createdSegmentIds','add','.yml','yamlConfig','verbose','blue','No\x20','\x20\x20🗺️\x20\x20Journeys:','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','\x20changed','segment:push','4746492Xwslpe','\x20changes?','unchanged','\x20unchanged','/j/da/je','\x20new','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','journeyBundleId','scopedFolderPath','dim','Delete\x20segment:','\x0aPush\x20summary\x20for\x20\x27','site','get','/e/','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)','Error:\x20Directory\x20not\x20found:\x20','diff','folders','Site:\x20','Push\x20','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','folderId','updated','changed','audienceId','9711464JPLbNF','journeyId','getParent','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','listSegments','versionNumber','cwd','New\x20segment:','existingSegment','\x20activations]','\x20\x20Source:\x20','set','/app/ps/','setPhase','nameToType','map'];a42_0x390c=function(){return _0x295c79;};return a42_0x390c();}import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a42_0x3abd33 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_0x272f92(0x1ad)]=a42_0x272f92(0x20b);['description']=a42_0x272f92(0x209);async['execute'](_0x187f8d){const _0x59cd63=a42_0x272f92,{options:_0x28a28f,args:_0x4da3fb,tdx:_0x293c7f}=_0x187f8d,_0xcda021=_0x28a28f,_0x164d6a=await resolveTarget({'arg':_0x4da3fb[0x0],'contextParent':_0x28a28f[_0x59cd63(0x1f5)],'cwd':process[_0x59cd63(0x22c)]()});if(!isSuccessfulResolution(_0x164d6a))return _0x164d6a[_0x59cd63(0x1d2)]===_0x59cd63(0x23e)?(console[_0x59cd63(0x1ca)](a42_0x3abd33[_0x59cd63(0x1bd)](_0x59cd63(0x1c9))),console[_0x59cd63(0x1ca)](_0x59cd63(0x21b)),console['error'](_0x59cd63(0x229)),console[_0x59cd63(0x1ca)](_0x59cd63(0x1d5))):(console[_0x59cd63(0x1ca)](a42_0x3abd33[_0x59cd63(0x1f0)](_0x59cd63(0x1d4)+_0x164d6a[_0x59cd63(0x1b7)]+'\x0a')),_0x164d6a[_0x59cd63(0x1ab)]&&console[_0x59cd63(0x1ca)](a42_0x3abd33['cyan'](_0x164d6a['helpText']))),0x1;if(_0x164d6a[_0x59cd63(0x1c3)]===_0x59cd63(0x236))return console['error'](a42_0x3abd33['red'](_0x59cd63(0x21c)+_0x164d6a[_0x59cd63(0x23b)]+'\x0a')),console[_0x59cd63(0x1ca)](a42_0x3abd33[_0x59cd63(0x1a8)]('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;const _0x221810=_0x164d6a[_0x59cd63(0x1ac)],_0x20fbb3=_0x164d6a[_0x59cd63(0x23b)],_0x1cfedc=_0x164d6a['type']===_0x59cd63(0x1da)?_0x164d6a[_0x59cd63(0x244)]:undefined,_0x379b63=getScopedDetails(_0x164d6a),_0x4d3f9b=_0x379b63?.[_0x59cd63(0x1b1)]??![],_0x271e5e=_0x379b63?.[_0x59cd63(0x214)]??'';if(!existsSync(_0x20fbb3))return console[_0x59cd63(0x1ca)](a42_0x3abd33[_0x59cd63(0x1f0)](_0x59cd63(0x21c)+_0x20fbb3+'\x0a')),console[_0x59cd63(0x1ca)](a42_0x3abd33[_0x59cd63(0x1a8)](_0x59cd63(0x1fe))),0x1;_0xcda021[_0x59cd63(0x205)]&&(console[_0x59cd63(0x1ca)](_0x59cd63(0x21f)+_0xcda021[_0x59cd63(0x218)]),console[_0x59cd63(0x1ca)]('Parent\x20segment:\x20'+_0x221810),console[_0x59cd63(0x1ca)](_0x59cd63(0x1e3)+_0x20fbb3),_0x4d3f9b&&console[_0x59cd63(0x1ca)]('Scoped\x20to\x20folder:\x20'+_0x271e5e));const _0x1c5dda=await withSpinner(_0x59cd63(0x1cb)+_0x221810+_0x59cd63(0x239),()=>_0x293c7f['segment'][_0x59cd63(0x237)](_0x221810),{'verbose':_0xcda021[_0x59cd63(0x205)]}),_0x373731=_0x1c5dda['data'],{parentSegmentResult:_0x5a3f64,segmentsResult:_0x43c9e2,foldersResult:_0x216070,journeysWithDetailsResult:_0x4ae4e3,userMaps:_0x253059}=await withSpinner(_0x59cd63(0x1c5),async()=>{const _0x16d9de=_0x59cd63,[_0xf8b65a,_0x578c2a,_0x4e46a4,_0x1c571c,_0x49f1d3]=await Promise[_0x16d9de(0x1bf)]([_0x293c7f[_0x16d9de(0x1af)][_0x16d9de(0x228)](_0x373731),_0x293c7f[_0x16d9de(0x1af)][_0x16d9de(0x22a)](_0x373731),_0x293c7f[_0x16d9de(0x1af)][_0x16d9de(0x1e2)](_0x373731),_0x293c7f['journey'][_0x16d9de(0x1bb)](_0x373731,{'includeAllVersions':!![]}),_0x293c7f['user'][_0x16d9de(0x23a)]()]);return{'parentSegmentResult':_0xf8b65a,'segmentsResult':_0x578c2a,'foldersResult':_0x4e46a4,'journeysWithDetailsResult':_0x1c571c,'userMaps':_0x49f1d3};},{'verbose':_0xcda021[_0x59cd63(0x205)]})[_0x59cd63(0x1c7)](_0x44c203=>_0x44c203[_0x59cd63(0x1d7)]),_0x4aee5b=_0x5a3f64,_0x56224b=extractRootFolderId(_0x4aee5b),_0x3d04aa=_0x43c9e2,_0x1314c1=_0x216070,{journeys:_0x3d3fe7,activationStepsById:_0x1ee469}=_0x4ae4e3,_0x37e055=new Map(_0x3d3fe7[_0x59cd63(0x235)](_0x3b233d=>[_0x3b233d['id'],_0x3b233d])),_0x4da65d=_0x3d3fe7[_0x59cd63(0x235)](_0x451a9b=>({'id':_0x451a9b['id'],'name':_0x451a9b[_0x59cd63(0x1b3)][_0x59cd63(0x1ad)],'journeyBundleName':_0x451a9b[_0x59cd63(0x1b3)][_0x59cd63(0x1d1)]||'','journeyBundleId':_0x451a9b[_0x59cd63(0x1b3)][_0x59cd63(0x213)]||'','versionNumber':_0x451a9b[_0x59cd63(0x1b3)][_0x59cd63(0x22b)],'description':_0x451a9b['attributes'][_0x59cd63(0x1ff)],'state':_0x451a9b[_0x59cd63(0x1b3)]['state'],'paused':_0x451a9b[_0x59cd63(0x1b3)]['paused'],'audienceId':_0x451a9b[_0x59cd63(0x1b3)][_0x59cd63(0x225)],'folderId':_0x451a9b[_0x59cd63(0x1b4)]?.[_0x59cd63(0x1ba)]?.[_0x59cd63(0x1d7)]?.['id'],'createdAt':_0x451a9b['attributes'][_0x59cd63(0x1b2)],'updatedAt':_0x451a9b[_0x59cd63(0x1b3)]['updatedAt']})),{emailToId:_0x4fa6c0,idToEmail:_0x290fad}=_0x253059,_0x55d2f2=await withSpinner(_0x59cd63(0x1ce),async()=>{const _0x1bb5cc=_0x59cd63,_0x48be90=await _0x293c7f['connection'][_0x1bb5cc(0x1c4)]();return buildConnectionMaps(_0x48be90);},{'verbose':_0xcda021[_0x59cd63(0x205)]})[_0x59cd63(0x1c7)](_0x4e1012=>_0x4e1012['data']),_0x38cd04=_0x55d2f2[_0x59cd63(0x1fd)],_0x4693fb=_0x55d2f2['idToName'],_0x2dbfe9=_0x55d2f2[_0x59cd63(0x234)],_0x481eec={'emailToIdMap':_0x4fa6c0,'connectionNameToIdMap':_0x38cd04,'connectionNameToTypeMap':_0x2dbfe9,'getSchema':_0x5f2909=>_0x293c7f[_0x59cd63(0x1e9)]['getOutputSchemaWithCache'](_0x5f2909)};let {pathToId:_0x24ee17,idToPath:_0x2a010f}=buildFolderMaps(_0x1314c1);const _0x24fcb8=buildSegmentLookupMap(_0x3d04aa,_0x2a010f),_0x293b8b=buildSegmentNameToIdMap(_0x3d04aa),_0x70dfb6=buildJourneyBundleLookupMap(_0x4da65d,_0x2a010f);let _0x38d95a;if(_0x1cfedc){if(!_0x1cfedc[_0x59cd63(0x1d8)](_0x59cd63(0x203))&&!_0x1cfedc['endsWith']('.yaml'))return console[_0x59cd63(0x1ca)](a42_0x3abd33[_0x59cd63(0x1f0)]('Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20'+_0x1cfedc+'\x0a')),0x1;_0x38d95a=[_0x1cfedc];}else _0x38d95a=findYamlFiles(_0x20fbb3);if(_0x38d95a[_0x59cd63(0x1ef)]===0x0)return console[_0x59cd63(0x1ca)](a42_0x3abd33[_0x59cd63(0x1f0)](_0x59cd63(0x23d)+_0x20fbb3+'\x0a')),console[_0x59cd63(0x1ca)](a42_0x3abd33[_0x59cd63(0x1a8)](_0x59cd63(0x1f3))),0x1;let _0x42045e,_0x14bdff;try{const _0x1968f5=parseAndClassifyYamlFiles(_0x38d95a,_0x20fbb3,{'skipSegments':_0xcda021[_0x59cd63(0x1f1)]});_0x42045e=_0x1968f5[_0x59cd63(0x1aa)],_0x14bdff=_0x1968f5[_0x59cd63(0x200)];const _0x386355=validateParsedFiles(_0x1968f5,_0x20fbb3);if(_0x386355[_0x59cd63(0x1ef)]>0x0)return console['error'](a42_0x3abd33[_0x59cd63(0x1f0)](_0x59cd63(0x1ed))),console[_0x59cd63(0x1ca)](formatValidationErrors(_0x386355)),console[_0x59cd63(0x1ca)](a42_0x3abd33[_0x59cd63(0x1bd)](_0x59cd63(0x1b8))),0x1;}catch(_0x21f992){return console['error'](a42_0x3abd33[_0x59cd63(0x1f0)](_0x59cd63(0x1c6)+(_0x21f992 instanceof Error?_0x21f992[_0x59cd63(0x1b7)]:_0x21f992))),0x1;}if(_0x42045e[_0x59cd63(0x1ef)]===0x0&&_0x14bdff[_0x59cd63(0x1ef)]===0x0){const _0x5b970c=_0xcda021['journeysOnly']?_0x59cd63(0x240):'segment\x20or\x20journey';return console[_0x59cd63(0x1ca)](a42_0x3abd33['yellow'](_0x59cd63(0x207)+_0x5b970c+_0x59cd63(0x1f4))),0x0;}const _0x559017=new Map();_0x3d04aa[_0x59cd63(0x1ef)]>0x0&&!_0xcda021['journeysOnly']&&await withSpinner('Fetching\x20existing\x20activations...',async()=>{await batchAsync(_0x3d04aa,async _0x2ac72c=>{const _0x2408f2=a42_0x3f05,_0x2b1034=await _0x293c7f[_0x2408f2(0x1af)][_0x2408f2(0x1e6)](_0x373731,_0x2ac72c['id']);_0x559017[_0x2408f2(0x231)](_0x2ac72c['id'],_0x2b1034);});},{'verbose':_0xcda021[_0x59cd63(0x205)]});const {segmentFiles:_0x255b42,foldersToCreate:_0x31102a}=await prepareSegmentFiles(_0x42045e,{'segmentByFolderAndName':_0x24fcb8,'activationsBySegmentId':_0x559017,'folderPathToId':_0x24ee17,'idToEmailMap':_0x290fad,'connectionIdToNameMap':_0x4693fb},_0x481eec,_0x4d3f9b,_0x271e5e),_0x46f351=_0x1cfedc?[]:findSegmentsToDelete(_0x3d04aa,_0x42045e[_0x59cd63(0x235)](({yamlConfig:_0x12f78b,folderPath:_0x1d8df2})=>({'yamlConfig':_0x12f78b,'folderPath':resolveTDFolderPath(_0x1d8df2,_0x4d3f9b,_0x271e5e)})),_0x2a010f,_0x271e5e,_0x4d3f9b),{journeyFiles:_0x10b15f,foldersToCreate:_0x40078f}=await withProgressSpinner(_0x59cd63(0x1db),async _0x2e576a=>prepareJourneyFiles(_0x14bdff,{'fetchJourney':async _0x1be0d7=>_0x293c7f['journey'][_0x59cd63(0x1e4)](_0x1be0d7[_0x59cd63(0x227)]),'journeyBundlesByFolderAndName':_0x70dfb6,'folderPathToId':_0x24ee17,'idToEmailMap':_0x290fad,'connectionIdToNameMap':_0x4693fb,'existingSegments':_0x3d04aa,'parentId':_0x373731,'deps':_0x293c7f,'progress':{'update':_0x49bd15=>{const _0x3a8b38=_0x59cd63;_0x2e576a[_0x3a8b38(0x233)](_0x49bd15),_0xcda021[_0x3a8b38(0x205)]&&console[_0x3a8b38(0x1ca)]('\x20\x20'+_0x49bd15);}},'journeyById':_0x37e055,'activationStepsById':_0x1ee469},_0x4d3f9b,_0x271e5e),{'verbose':_0xcda021[_0x59cd63(0x205)]})[_0x59cd63(0x1c7)](_0x5f04ce=>_0x5f04ce[_0x59cd63(0x1d7)]);for(const _0x51fdc7 of _0x40078f){_0x31102a[_0x59cd63(0x202)](_0x51fdc7);}const _0x2bbeb5=_0x1cfedc?[]:findJourneysToDelete(_0x4da65d,_0x14bdff[_0x59cd63(0x235)](({yamlConfig:_0x17aeb9,folderPath:_0x10b4a9})=>({'yamlConfig':_0x17aeb9,'folderPath':resolveTDFolderPath(_0x10b4a9,_0x4d3f9b,_0x271e5e)})),_0x2a010f,_0x271e5e,_0x4d3f9b),_0x1e3f36=calculatePushStats(_0x255b42,_0x10b15f,_0x31102a,_0x46f351,_0x2bbeb5,!!_0xcda021['delete'],!!_0xcda021[_0x59cd63(0x1f1)]),_0x47778b=_0x1e3f36[_0x59cd63(0x1aa)][_0x59cd63(0x1b0)],_0x2068a5=_0x1e3f36[_0x59cd63(0x1aa)][_0x59cd63(0x224)],_0x4a789e=_0x1e3f36['segments']['unchanged'],_0xe339d6=_0x1e3f36[_0x59cd63(0x1aa)][_0x59cd63(0x242)],_0x1d1b3e=_0x1e3f36[_0x59cd63(0x21e)][_0x59cd63(0x1fc)],_0x153403=_0x1e3f36[_0x59cd63(0x200)][_0x59cd63(0x1b0)],_0x2c3fdb=_0x1e3f36[_0x59cd63(0x200)]['changed'],_0x27b4ce=_0x1e3f36[_0x59cd63(0x200)][_0x59cd63(0x20e)],_0x3d1bd9=_0x1e3f36[_0x59cd63(0x200)]['toDelete'],_0x4c3f3b=_0x1e3f36[_0x59cd63(0x1a7)][_0x59cd63(0x1bf)],_0x3499d6=_0x1e3f36['activations'][_0x59cd63(0x1fc)],_0x39e1a7=_0x1e3f36[_0x59cd63(0x1a7)][_0x59cd63(0x1d9)],_0x3ad3e0=_0x1e3f36[_0x59cd63(0x1a7)][_0x59cd63(0x242)];console[_0x59cd63(0x1ca)](_0x59cd63(0x217)+_0x221810+'\x27:');_0x1d1b3e[_0x59cd63(0x1ef)]>0x0&&console[_0x59cd63(0x1ca)]('\x20\x20'+a42_0x3abd33[_0x59cd63(0x206)](_0x59cd63(0x1e5)+_0x1d1b3e[_0x59cd63(0x1ef)]+'\x20folders\x20to\x20create'));if(!_0xcda021[_0x59cd63(0x1f1)]){console['error']('\x20\x20📊\x20Segments:'),console['error'](_0x59cd63(0x1e1)+a42_0x3abd33[_0x59cd63(0x1de)]('+\x20'+_0x47778b[_0x59cd63(0x1ef)]+_0x59cd63(0x211))),console[_0x59cd63(0x1ca)](_0x59cd63(0x1e1)+a42_0x3abd33[_0x59cd63(0x1bd)]('~\x20'+_0x2068a5[_0x59cd63(0x1ef)]+'\x20changed'));if(_0xe339d6['length']>0x0)console['error']('\x20\x20\x20\x20'+a42_0x3abd33['red']('-\x20'+_0xe339d6[_0x59cd63(0x1ef)]+_0x59cd63(0x1fa)));else _0x46f351['length']>0x0&&!_0xcda021[_0x59cd63(0x1b9)]&&console[_0x59cd63(0x1ca)](_0x59cd63(0x1e1)+a42_0x3abd33['dim'](_0x46f351[_0x59cd63(0x1ef)]+_0x59cd63(0x221)));console[_0x59cd63(0x1ca)](_0x59cd63(0x1e1)+a42_0x3abd33['dim']('=\x20'+_0x4a789e[_0x59cd63(0x1ef)]+_0x59cd63(0x20f)));}if(_0x10b15f[_0x59cd63(0x1ef)]>0x0||_0x2bbeb5[_0x59cd63(0x1ef)]>0x0){console[_0x59cd63(0x1ca)](_0x59cd63(0x208)),console[_0x59cd63(0x1ca)](_0x59cd63(0x1e1)+a42_0x3abd33[_0x59cd63(0x1de)]('+\x20'+_0x153403[_0x59cd63(0x1ef)]+_0x59cd63(0x211))),console[_0x59cd63(0x1ca)](_0x59cd63(0x1e1)+a42_0x3abd33[_0x59cd63(0x1bd)]('~\x20'+_0x2c3fdb[_0x59cd63(0x1ef)]+_0x59cd63(0x20a)));if(_0x3d1bd9[_0x59cd63(0x1ef)]>0x0)console[_0x59cd63(0x1ca)](_0x59cd63(0x1e1)+a42_0x3abd33['red']('-\x20'+_0x3d1bd9['length']+_0x59cd63(0x1fa)));else _0x2bbeb5[_0x59cd63(0x1ef)]>0x0&&!_0xcda021['delete']&&console[_0x59cd63(0x1ca)](_0x59cd63(0x1e1)+a42_0x3abd33[_0x59cd63(0x215)](_0x2bbeb5[_0x59cd63(0x1ef)]+_0x59cd63(0x221)));console['error'](_0x59cd63(0x1e1)+a42_0x3abd33['dim']('=\x20'+_0x27b4ce[_0x59cd63(0x1ef)]+_0x59cd63(0x20f)));}_0x4c3f3b[_0x59cd63(0x1ef)]>0x0&&!_0xcda021[_0x59cd63(0x1f1)]&&(console['error'](''),console[_0x59cd63(0x1ca)](_0x59cd63(0x1d3)),_0x3499d6[_0x59cd63(0x1ef)]>0x0&&console[_0x59cd63(0x1ca)](_0x59cd63(0x1e1)+a42_0x3abd33['green']('+\x20'+_0x3499d6[_0x59cd63(0x1ef)]+_0x59cd63(0x1bc))),_0x39e1a7[_0x59cd63(0x1ef)]>0x0&&console[_0x59cd63(0x1ca)](_0x59cd63(0x1e1)+a42_0x3abd33[_0x59cd63(0x1bd)]('~\x20'+_0x39e1a7[_0x59cd63(0x1ef)]+_0x59cd63(0x1c0))),_0x3ad3e0[_0x59cd63(0x1ef)]>0x0&&console[_0x59cd63(0x1ca)](_0x59cd63(0x1e1)+a42_0x3abd33[_0x59cd63(0x1f0)]('-\x20'+_0x3ad3e0['length']+_0x59cd63(0x1fa))));console['error'](_0x59cd63(0x230)+a42_0x3abd33[_0x59cd63(0x1a8)](_0x20fbb3)+'\x0a');if(_0x1d1b3e['length']>0x0){console['error'](_0x59cd63(0x1a9));for(const _0x83c5b9 of _0x1d1b3e){console[_0x59cd63(0x1ca)]('\x20\x20'+a42_0x3abd33['blue']('+')+'\x20'+_0x83c5b9);}console[_0x59cd63(0x1ca)]('');}if(_0x47778b[_0x59cd63(0x1ef)]>0x0&&!_0xcda021[_0x59cd63(0x1f1)])for(const _0x1c00b6 of _0x47778b){const _0x241da3=_0x1c00b6[_0x59cd63(0x1dc)]?_0x1c00b6[_0x59cd63(0x1dc)]+'/'+_0x1c00b6[_0x59cd63(0x204)][_0x59cd63(0x1ad)]:_0x1c00b6[_0x59cd63(0x204)][_0x59cd63(0x1ad)],_0xa28c83=_0x1c00b6[_0x59cd63(0x204)]['activations']?.[_0x59cd63(0x1ef)]||0x0,_0x216c7b=_0xa28c83>0x0?a42_0x3abd33['dim']('\x20['+_0xa28c83+_0x59cd63(0x22f)):'';console['error']('\x0a'+a42_0x3abd33[_0x59cd63(0x1de)](_0x59cd63(0x22d))+'\x20'+_0x241da3+_0x216c7b),console[_0x59cd63(0x1ca)]('─'[_0x59cd63(0x1df)](0x3c)),_0x1c00b6[_0x59cd63(0x21d)]&&console[_0x59cd63(0x1ca)](_0x1c00b6[_0x59cd63(0x21d)]),console['error']('─'['repeat'](0x3c));}if(_0xe339d6['length']>0x0&&!_0xcda021[_0x59cd63(0x1f1)])for(const _0x1ee595 of _0xe339d6){const _0x1f747f=_0x1ee595[_0x59cd63(0x1ea)]?_0x2a010f[_0x59cd63(0x219)](_0x1ee595['segmentFolderId']['toString']())||'':'',_0x2ec0ed=_0x1f747f?_0x1f747f+'/'+_0x1ee595[_0x59cd63(0x1ad)]:_0x1ee595[_0x59cd63(0x1ad)],_0x1d0d7e=_0x559017[_0x59cd63(0x219)](_0x1ee595['id'])||[],_0x404685=_0x1d0d7e['length']>0x0?a42_0x3abd33[_0x59cd63(0x215)]('\x20['+_0x1d0d7e[_0x59cd63(0x1ef)]+_0x59cd63(0x22f)):'';console[_0x59cd63(0x1ca)]('\x0a'+a42_0x3abd33['red'](_0x59cd63(0x216))+'\x20'+_0x2ec0ed+_0x404685),console[_0x59cd63(0x1ca)]('─'[_0x59cd63(0x1df)](0x3c));const _0x2194c0=segmentWithActivationsToYaml(_0x1ee595,_0x1d0d7e,undefined,_0x290fad,_0x4693fb),_0x5b47ae=segmentToYamlString(_0x2194c0),_0xa7fb77=generateDiff(_0x5b47ae,'');console[_0x59cd63(0x1ca)](formatDiffWithColors(_0xa7fb77)),console['error']('─'[_0x59cd63(0x1df)](0x3c));}const _0x49e5c7=_0x255b42['filter'](_0x2bd9eb=>!_0x2bd9eb[_0x59cd63(0x1c1)]&&_0x2bd9eb[_0x59cd63(0x21d)]);if(_0x49e5c7[_0x59cd63(0x1ef)]>0x0&&!_0xcda021[_0x59cd63(0x1f1)])for(const _0x1738a9 of _0x49e5c7){const _0xef3753=_0x1738a9[_0x59cd63(0x1dc)]?_0x1738a9[_0x59cd63(0x1dc)]+'/'+_0x1738a9['yamlConfig'][_0x59cd63(0x1ad)]:_0x1738a9['yamlConfig'][_0x59cd63(0x1ad)];console['error']('\x0a'+a42_0x3abd33[_0x59cd63(0x1bd)]('Changes\x20to:')+'\x20'+_0xef3753),console[_0x59cd63(0x1ca)]('─'[_0x59cd63(0x1df)](0x3c)),console[_0x59cd63(0x1ca)](_0x1738a9[_0x59cd63(0x21d)]),console['error']('─'[_0x59cd63(0x1df)](0x3c));}if(_0x153403['length']>0x0)for(const _0x299ff3 of _0x153403){const _0x137846=_0x299ff3[_0x59cd63(0x1dc)]?_0x299ff3[_0x59cd63(0x1dc)]+'/'+_0x299ff3[_0x59cd63(0x204)][_0x59cd63(0x1ad)]:_0x299ff3['yamlConfig'][_0x59cd63(0x1ad)];console['error']('\x0a'+a42_0x3abd33[_0x59cd63(0x1de)]('New\x20journey:')+'\x20'+_0x137846),console[_0x59cd63(0x1ca)]('─'['repeat'](0x3c)),_0x299ff3[_0x59cd63(0x21d)]&&console[_0x59cd63(0x1ca)](_0x299ff3['diff']),console[_0x59cd63(0x1ca)]('─'[_0x59cd63(0x1df)](0x3c));}const _0x70259c=_0x10b15f[_0x59cd63(0x1e8)](_0x389093=>!_0x389093[_0x59cd63(0x1c1)]&&_0x389093['diff']);if(_0x70259c[_0x59cd63(0x1ef)]>0x0)for(const _0x19b4bf of _0x70259c){const _0x3ea94d=_0x19b4bf[_0x59cd63(0x1dc)]?_0x19b4bf[_0x59cd63(0x1dc)]+'/'+_0x19b4bf[_0x59cd63(0x204)][_0x59cd63(0x1ad)]:_0x19b4bf[_0x59cd63(0x204)][_0x59cd63(0x1ad)];console[_0x59cd63(0x1ca)]('\x0a'+a42_0x3abd33[_0x59cd63(0x1bd)](_0x59cd63(0x1b6))+'\x20'+_0x3ea94d),console[_0x59cd63(0x1ca)]('─'[_0x59cd63(0x1df)](0x3c)),console[_0x59cd63(0x1ca)](_0x19b4bf['diff']),console[_0x59cd63(0x1ca)]('─'[_0x59cd63(0x1df)](0x3c));}if(_0x3d1bd9[_0x59cd63(0x1ef)]>0x0)for(const _0x6f453c of _0x3d1bd9){const _0x538f3c=_0x6f453c[_0x59cd63(0x222)]?_0x2a010f['get'](_0x6f453c['folderId'])||'':'',_0x5013be=_0x538f3c?_0x538f3c+'/'+_0x6f453c[_0x59cd63(0x1d1)]:_0x6f453c[_0x59cd63(0x1d1)];console[_0x59cd63(0x1ca)]('\x0a'+a42_0x3abd33[_0x59cd63(0x1f0)]('Delete\x20journey:')+'\x20'+_0x5013be),console['error']('─'[_0x59cd63(0x1df)](0x3c)),console[_0x59cd63(0x1ca)](a42_0x3abd33[_0x59cd63(0x1f0)](_0x59cd63(0x1c2))),console[_0x59cd63(0x1ca)]('─'[_0x59cd63(0x1df)](0x3c));}if(_0xcda021[_0x59cd63(0x23c)])return console[_0x59cd63(0x1ca)](a42_0x3abd33[_0x59cd63(0x1bd)](_0x59cd63(0x1cc))),0x0;const _0xadc080=_0xcda021[_0x59cd63(0x1f1)]?![]:_0x47778b[_0x59cd63(0x1ef)]>0x0||_0x2068a5[_0x59cd63(0x1ef)]>0x0||_0xe339d6[_0x59cd63(0x1ef)]>0x0,_0x33e00f=_0x153403[_0x59cd63(0x1ef)]>0x0||_0x2c3fdb[_0x59cd63(0x1ef)]>0x0||_0x3d1bd9[_0x59cd63(0x1ef)]>0x0,_0x4aa608=_0xcda021['journeysOnly']?![]:_0x4c3f3b[_0x59cd63(0x1ef)]>0x0,_0x485a65=_0x1d1b3e['length']>0x0;if(!_0xadc080&&!_0x33e00f&&!_0x4aa608&&!_0x485a65){const _0xce2c20=_0xcda021[_0x59cd63(0x1f1)]?_0x59cd63(0x212):_0x59cd63(0x23f);console[_0x59cd63(0x1ca)](a42_0x3abd33[_0x59cd63(0x1de)](_0xce2c20));if(_0x1cfedc&&_0x4a789e[_0x59cd63(0x1ef)]===0x1){const _0x19baf8=_0x4a789e[0x0];if(_0x19baf8[_0x59cd63(0x22e)]?.['id']){const _0x1f545b=getConsoleNextUrl(_0xcda021[_0x59cd63(0x218)],_0x59cd63(0x232)+_0x373731+_0x59cd63(0x21a)+_0x19baf8['existingSegment']['id']+_0x59cd63(0x1b5));console[_0x59cd63(0x1ca)](_0x59cd63(0x1cd)+a42_0x3abd33[_0x59cd63(0x1a8)](_0x1f545b));}}if(_0x1cfedc&&_0x27b4ce[_0x59cd63(0x1ef)]===0x1){const _0x349e64=_0x27b4ce[0x0];if(_0x349e64[_0x59cd63(0x1e0)]?.['id']){const _0xa6f4cf=getConsoleNextUrl(_0xcda021['site'],_0x59cd63(0x232)+_0x373731+_0x59cd63(0x21a)+_0x349e64[_0x59cd63(0x1e0)]['id']+_0x59cd63(0x210));console[_0x59cd63(0x1ca)]('\x20\x20'+a42_0x3abd33['cyan'](_0xa6f4cf));}}return 0x0;}const _0x1b6e21=_0xcda021[_0x59cd63(0x1f1)]?_0x153403[_0x59cd63(0x1ef)]+_0x2c3fdb[_0x59cd63(0x1ef)]+_0x3d1bd9[_0x59cd63(0x1ef)]+_0x1d1b3e['length']:_0x47778b[_0x59cd63(0x1ef)]+_0x2068a5[_0x59cd63(0x1ef)]+_0xe339d6[_0x59cd63(0x1ef)]+_0x153403[_0x59cd63(0x1ef)]+_0x2c3fdb[_0x59cd63(0x1ef)]+_0x3d1bd9[_0x59cd63(0x1ef)]+_0x1d1b3e[_0x59cd63(0x1ef)]+_0x4c3f3b[_0x59cd63(0x1ef)];if(!_0xcda021[_0x59cd63(0x1e7)]&&_0x1b6e21>0x0){if(!isInteractive())return console[_0x59cd63(0x1ca)](a42_0x3abd33['red'](_0x59cd63(0x1be)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x59cd63(0x1ca)](a42_0x3abd33[_0x59cd63(0x215)](_0x59cd63(0x241))),0x1;const _0x4dc38f=await confirmKey(_0x59cd63(0x220)+_0x1b6e21+_0x59cd63(0x20d));if(!_0x4dc38f)return console[_0x59cd63(0x1ca)](a42_0x3abd33[_0x59cd63(0x1bd)](_0x59cd63(0x1d6))),0x1;}const _0x23c54e={'withProgress':async(_0x12b041,_0xfb3300)=>{const _0x41cb67=_0x59cd63,_0x12cc4a=await withSpinner(_0x12b041,_0xfb3300,{'verbose':_0xcda021[_0x41cb67(0x205)]});return{'data':_0x12cc4a[_0x41cb67(0x1d7)]};},'logInfo':_0x219a50=>console[_0x59cd63(0x1ca)](a42_0x3abd33[_0x59cd63(0x206)]('✔\x20'+_0x219a50)),'logSuccess':_0x30bb24=>console['error'](a42_0x3abd33['green']('✔\x20'+_0x30bb24)),'logWarning':_0x1eba9e=>console[_0x59cd63(0x1ca)](a42_0x3abd33[_0x59cd63(0x1bd)]('⚠\x20'+_0x1eba9e)),'logDeleted':_0x48b0b9=>console[_0x59cd63(0x1ca)](a42_0x3abd33['red']('✔\x20'+_0x48b0b9))},_0x42827c={'segment':_0x293c7f[_0x59cd63(0x1af)],'journey':_0x293c7f[_0x59cd63(0x240)],'user':_0x293c7f[_0x59cd63(0x1d0)],'connection':_0x293c7f[_0x59cd63(0x1e9)]};_0x1d1b3e[_0x59cd63(0x1ef)]>0x0&&(_0x24ee17=await executePushFolders(_0x42827c,_0x1d1b3e,_0x24ee17,{'parentId':_0x373731},_0x23c54e));const _0x521726={'rootFolderId':_0x56224b,'folderPathToId':_0x24ee17,'folderIdToPath':_0x2a010f,'segmentNameToId':_0x293b8b,'activationsBySegmentId':_0x559017,'emailToIdMap':_0x4fa6c0,'idToEmailMap':_0x290fad,'connectionNameToIdMap':_0x55d2f2[_0x59cd63(0x1fd)],'connectionIdToNameMap':_0x55d2f2['idToName'],'connectionNameToTypeMap':_0x2dbfe9},_0x42710a=await executePushSegments(_0x42827c,_0xcda021[_0x59cd63(0x1f1)]?[]:_0x255b42,_0x521726,{'parentId':_0x373731},_0x23c54e),_0x38125a=_0x42710a[_0x59cd63(0x1f9)],_0x3924f2=_0x42710a[_0x59cd63(0x223)],_0x1af487=_0x42710a['activations'][_0x59cd63(0x1f9)],_0x5816dc=_0x42710a['activations'][_0x59cd63(0x223)],_0x2e7b29=_0x42710a['activations']['deleted'];let _0x3c1b0b;if(_0x1cfedc&&_0x255b42[_0x59cd63(0x1ef)]===0x1){const _0x12ab3e=_0x255b42[0x0];_0x3c1b0b=_0x12ab3e[_0x59cd63(0x22e)]?.['id']??_0x42710a['createdSegmentIds']['get'](_0x12ab3e[_0x59cd63(0x204)][_0x59cd63(0x1ad)]);}const _0x1b65f6=await executePushSegmentDeletions(_0x42827c,_0xcda021[_0x59cd63(0x1f1)]?[]:_0xe339d6,_0x23c54e);let _0x4d5080=0x0,_0x55892f=0x0,_0x4d0b8e=0x0;const _0x66c764=new Map(_0x293b8b);for(const [_0x558a14,_0x15f56a]of _0x42710a[_0x59cd63(0x201)]){_0x66c764[_0x59cd63(0x231)](_0x558a14,_0x15f56a);}if(_0x10b15f['length']>0x0){const _0x126a92={..._0x521726,'segmentNameToId':_0x66c764,'existingSegments':_0x3d04aa,'activationContext':_0x481eec},_0x288802=await executePushJourneys(_0x42827c,_0x10b15f,_0x126a92,{'parentId':_0x373731,'rootFolderId':_0x56224b,'verbose':_0xcda021[_0x59cd63(0x205)]},_0x23c54e);_0x4d5080=_0x288802['created'],_0x55892f=_0x288802[_0x59cd63(0x223)];if(_0x1cfedc&&_0x288802[_0x59cd63(0x1ae)]['length']===0x1){const _0x348a7b=_0x288802[_0x59cd63(0x1ae)][0x0];if(_0x348a7b[_0x59cd63(0x227)]){const _0x1488d1=getConsoleNextUrl(_0xcda021[_0x59cd63(0x218)],'/app/ps/'+_0x373731+_0x59cd63(0x21a)+_0x348a7b['journeyId']+_0x59cd63(0x210));console[_0x59cd63(0x1ca)]('\x20\x20'+a42_0x3abd33[_0x59cd63(0x1a8)](_0x1488d1));}}}for(const _0x4a7d1b of _0x3d1bd9){console[_0x59cd63(0x1ca)](a42_0x3abd33[_0x59cd63(0x1bd)]('⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20'+_0x4a7d1b[_0x59cd63(0x1d1)])),_0x4d0b8e++;}const _0x2873d1=[];if(_0x38125a>0x0)_0x2873d1[_0x59cd63(0x1c8)](_0x38125a+_0x59cd63(0x238));if(_0x3924f2>0x0)_0x2873d1['push'](_0x3924f2+_0x59cd63(0x1ee));if(_0x1b65f6>0x0)_0x2873d1[_0x59cd63(0x1c8)](_0x1b65f6+_0x59cd63(0x1eb));const _0x35dbc4=[];if(_0x4d5080>0x0)_0x35dbc4[_0x59cd63(0x1c8)](_0x4d5080+_0x59cd63(0x238));if(_0x55892f>0x0)_0x35dbc4['push'](_0x55892f+_0x59cd63(0x1ee));if(_0x4d0b8e>0x0)_0x35dbc4[_0x59cd63(0x1c8)](_0x4d0b8e+'\x20deleted');const _0x159107=[];if(_0x1af487>0x0)_0x159107[_0x59cd63(0x1c8)](_0x1af487+_0x59cd63(0x238));if(_0x5816dc>0x0)_0x159107['push'](_0x5816dc+'\x20updated');if(_0x2e7b29>0x0)_0x159107[_0x59cd63(0x1c8)](_0x2e7b29+'\x20deleted');console[_0x59cd63(0x1ca)](a42_0x3abd33[_0x59cd63(0x1de)](_0x59cd63(0x1f7)));_0x2873d1[_0x59cd63(0x1ef)]>0x0&&!_0xcda021[_0x59cd63(0x1f1)]&&console['error']('\x20\x20Segments:\x20'+_0x2873d1['join'](',\x20'));_0x35dbc4['length']>0x0&&console[_0x59cd63(0x1ca)]('\x20\x20Journeys:\x20'+_0x35dbc4['join'](',\x20'));_0x159107[_0x59cd63(0x1ef)]>0x0&&!_0xcda021[_0x59cd63(0x1f1)]&&console['error'](_0x59cd63(0x1f2)+_0x159107[_0x59cd63(0x1ec)](',\x20'));if(_0x3c1b0b){const _0x2a9051=getConsoleNextUrl(_0xcda021[_0x59cd63(0x218)],'/app/ps/'+_0x373731+'/e/'+_0x3c1b0b+_0x59cd63(0x1b5));console['error'](_0x59cd63(0x1cd)+a42_0x3abd33[_0x59cd63(0x1a8)](_0x2a9051));}return 0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a43_0x59cc38=a43_0x3273;function a43_0x495f(){const _0x4a4846=['1834350vMmcKG','INTERNAL','Update\x20existing\x20child\x20segment','Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]','yellow','Resolved\x20relative\x20path\x20to:\x20','segmentId','Resolved\x20type:\x20','Error:\x20Cannot\x20update\x20','Resolved\x20folder\x20ID:\x20','486605zDKkrq','segment:update','382906HpcQMA','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','1305328vmPLOw','segmentPath','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','1449665yoOBhb','error','\x27...','Resolving\x20path\x20\x27','segment','folder','name','description','execute','✔\x20Updated\x20segment\x20\x27','Resolving\x20folder\x20\x27','4480HIIOVW','length','Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]','segmentName','\x20\x20\x20Path:\x20','1323JXhyxn','Updating\x20segment\x20\x27','2368494lnizBb','Parent\x20ID:\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','resolvePathToResource','Segment\x20ID:\x20','ruleFile','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','kind','data','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','resolveFolderId','verbose','type'];a43_0x495f=function(){return _0x4a4846;};return a43_0x495f();}function a43_0x3273(_0x15792b,_0x54f0e2){_0x15792b=_0x15792b-0x183;const _0x495ffe=a43_0x495f();let _0x3273ec=_0x495ffe[_0x15792b];return _0x3273ec;}(function(_0x205b7a,_0x306c0f){const _0x3aa341=a43_0x3273,_0xced926=_0x205b7a();while(!![]){try{const _0x458b0a=-parseInt(_0x3aa341(0x1af))/0x1+parseInt(_0x3aa341(0x1b1))/0x2+-parseInt(_0x3aa341(0x196))/0x3*(parseInt(_0x3aa341(0x191))/0x4)+parseInt(_0x3aa341(0x186))/0x5+parseInt(_0x3aa341(0x198))/0x6+parseInt(_0x3aa341(0x1a5))/0x7+parseInt(_0x3aa341(0x183))/0x8;if(_0x458b0a===_0x306c0f)break;else _0xced926['push'](_0xced926['shift']());}catch(_0x430373){_0xced926['push'](_0xced926['shift']());}}}(a43_0x495f,0x4e53a));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_0x5180f4 from'chalk';export class SegmentUpdateCommand extends BaseCommand{[a43_0x59cc38(0x18c)]=a43_0x59cc38(0x1b0);[a43_0x59cc38(0x18d)]=a43_0x59cc38(0x1a7);async[a43_0x59cc38(0x18e)](_0x76ac17){const _0x5441b5=a43_0x59cc38;console[_0x5441b5(0x187)](a43_0x5180f4[_0x5441b5(0x1a9)]('⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.')),console[_0x5441b5(0x187)](a43_0x5180f4['yellow']('\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a'));const {options:_0x30af21,args:_0x479297,tdx:_0x5a7ca0}=_0x76ac17,_0x4895aa=_0x30af21;if(_0x479297[_0x5441b5(0x192)]===0x0)return console[_0x5441b5(0x187)](_0x5441b5(0x1a1)),console['error'](_0x5441b5(0x193)),console[_0x5441b5(0x187)]('Examples:'),console['error'](_0x5441b5(0x185)),console[_0x5441b5(0x187)](_0x5441b5(0x1b2)),0x1;const _0x1d638f=_0x479297[0x0],_0x3e84f8=_0x30af21[_0x5441b5(0x184)];let _0x3d2e97=_0x1d638f;_0x3e84f8&&!_0x1d638f['includes']('/')&&(_0x3d2e97=_0x3e84f8+'/'+_0x1d638f,_0x4895aa[_0x5441b5(0x1a3)]&&console[_0x5441b5(0x187)](_0x5441b5(0x1aa)+_0x3d2e97));const _0x468942=await withSpinner(_0x5441b5(0x189)+_0x3d2e97+_0x5441b5(0x188),()=>_0x5a7ca0[_0x5441b5(0x18a)][_0x5441b5(0x19b)](_0x3d2e97),{'verbose':_0x4895aa['verbose']}),_0x354b0c=_0x468942['data'];_0x4895aa['verbose']&&console[_0x5441b5(0x187)](_0x5441b5(0x1ac)+_0x354b0c[_0x5441b5(0x1a4)]);if(_0x354b0c[_0x5441b5(0x1a4)]!=='segment')return console['error'](_0x5441b5(0x1ad)+_0x354b0c[_0x5441b5(0x1a4)]+_0x5441b5(0x19e)),console[_0x5441b5(0x187)](_0x5441b5(0x1a8)),0x1;if(!_0x354b0c['segmentId'])throw new SDKError(ErrorCode[_0x5441b5(0x1a6)],_0x5441b5(0x19a));const _0x138d27=_0x354b0c['parentId'],_0x3390d4=_0x354b0c[_0x5441b5(0x1ab)];_0x4895aa[_0x5441b5(0x1a3)]&&(console[_0x5441b5(0x187)](_0x5441b5(0x199)+_0x138d27),console[_0x5441b5(0x187)](_0x5441b5(0x19c)+_0x3390d4));let _0x90a39f;if(_0x4895aa[_0x5441b5(0x18b)]){const _0x36bf32=_0x4895aa[_0x5441b5(0x18b)],_0x1ab42e=await withSpinner(_0x5441b5(0x190)+_0x36bf32+_0x5441b5(0x188),()=>_0x5a7ca0[_0x5441b5(0x18a)][_0x5441b5(0x1a2)](_0x138d27,_0x36bf32),{'verbose':_0x4895aa[_0x5441b5(0x1a3)]});_0x90a39f=parseInt(_0x1ab42e[_0x5441b5(0x1a0)],0xa),_0x4895aa[_0x5441b5(0x1a3)]&&console['error'](_0x5441b5(0x1ae)+_0x90a39f);}const _0x15c69a=await loadJSONFromOptions(_0x4895aa['rule'],_0x4895aa[_0x5441b5(0x19d)]),_0x2f790e={'name':_0x4895aa[_0x5441b5(0x18c)],'description':_0x4895aa[_0x5441b5(0x18d)],'rule':_0x15c69a,'kind':_0x4895aa[_0x5441b5(0x19f)]!==undefined?parseInt(_0x4895aa['kind'],0xa):undefined,'segmentFolderId':_0x90a39f},_0x554987=await withSpinner(_0x5441b5(0x197)+_0x354b0c[_0x5441b5(0x194)]+'\x27...',()=>_0x5a7ca0[_0x5441b5(0x18a)]['updateSegmentById'](_0x138d27,_0x3390d4,_0x2f790e),{'verbose':_0x4895aa[_0x5441b5(0x1a3)]}),_0x4fbc65=_0x554987[_0x5441b5(0x1a0)];return console[_0x5441b5(0x187)](_0x5441b5(0x18f)+_0x4fbc65[_0x5441b5(0x18c)]+'\x27'),_0x3d2e97!==_0x1d638f&&console[_0x5441b5(0x187)](_0x5441b5(0x195)+_0x3d2e97),await handleSDKOutput([_0x4fbc65],_0x4895aa),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a44_0x20a7f9=a44_0x2eed;(function(_0x59a1b5,_0x466f8c){const _0x16ab1c=a44_0x2eed,_0x16f9bb=_0x59a1b5();while(!![]){try{const _0x461ed6=-parseInt(_0x16ab1c(0x1f4))/0x1*(parseInt(_0x16ab1c(0x20f))/0x2)+-parseInt(_0x16ab1c(0x208))/0x3*(parseInt(_0x16ab1c(0x1e1))/0x4)+parseInt(_0x16ab1c(0x1e2))/0x5*(-parseInt(_0x16ab1c(0x1fc))/0x6)+-parseInt(_0x16ab1c(0x215))/0x7*(parseInt(_0x16ab1c(0x209))/0x8)+parseInt(_0x16ab1c(0x1ec))/0x9+parseInt(_0x16ab1c(0x1ef))/0xa+parseInt(_0x16ab1c(0x217))/0xb*(parseInt(_0x16ab1c(0x212))/0xc);if(_0x461ed6===_0x466f8c)break;else _0x16f9bb['push'](_0x16f9bb['shift']());}catch(_0x316b10){_0x16f9bb['push'](_0x16f9bb['shift']());}}}(a44_0x34c7,0x9188f));import{existsSync,statSync}from'fs';import a44_0x226283 from'chalk';import{BaseCommand}from'./command.js';import{saveSessionContext}from'../core/session.js';import{withSpinner}from'../utils/spinner.js';import{parsePath,normalizePath}from'../sdk/segment/segment-path-parser.js';function a44_0x2eed(_0x335382,_0xf4323f){_0x335382=_0x335382-0x1dd;const _0x34c7ac=a44_0x34c7();let _0x2eed50=_0x34c7ac[_0x335382];return _0x2eed50;}import{findTdxConfig}from'../sdk/segment/tdx-config.js';export class SegmentUseCommand extends BaseCommand{['name']=a44_0x20a7f9(0x1de);[a44_0x20a7f9(0x210)]='Set\x20current\x20segment/folder\x20context\x20for\x20navigation';async['execute'](_0x24dac8){const _0x4c187d=a44_0x20a7f9,{options:_0x338124,args:_0x24d996,tdx:_0x355c46}=_0x24dac8;if(_0x24d996['length']===0x0)return console['error'](a44_0x226283[_0x4c187d(0x1f0)](_0x4c187d(0x200))),console[_0x4c187d(0x211)](_0x4c187d(0x1ff)),console[_0x4c187d(0x211)](_0x4c187d(0x1fe)),console[_0x4c187d(0x211)](_0x4c187d(0x1fd)),console[_0x4c187d(0x211)](_0x4c187d(0x203)),console[_0x4c187d(0x211)]('\x20\x20tdx\x20segment\x20use\x20/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Clear\x20context'),console[_0x4c187d(0x211)](_0x4c187d(0x20d)),0x1;const _0x4e4228=_0x24d996[0x0],_0x5b11f0=_0x338124[_0x4c187d(0x1e8)];try{if(_0x4e4228==='/')return saveSessionContext({'segment_path':undefined},_0x5b11f0),console[_0x4c187d(0x1f5)](a44_0x226283[_0x4c187d(0x1f6)](_0x4c187d(0x214))),0x0;if(existsSync(_0x4e4228)&&statSync(_0x4e4228)['isDirectory']()){let _0xfed46a;try{_0xfed46a=findTdxConfig(_0x4e4228);}catch{return console[_0x4c187d(0x211)](a44_0x226283[_0x4c187d(0x1f0)](_0x4c187d(0x216)+_0x4e4228)),console[_0x4c187d(0x211)](a44_0x226283['cyan']('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;}const _0x396053=_0xfed46a['config'][_0x4c187d(0x1fa)];return saveSessionContext({'segment_path':_0x396053,'parent_segment':_0x396053},_0x5b11f0),console['log'](a44_0x226283[_0x4c187d(0x1f6)](_0x4c187d(0x1e4)+a44_0x226283[_0x4c187d(0x1ee)](_0x396053))),0x0;}const _0x227213=_0x338124['segmentPath'];let _0x4706fc=_0x4e4228;const _0x4d969c=parsePath(_0x4e4228);if(!_0x4d969c[_0x4c187d(0x1ed)]){if(!_0x227213)return console[_0x4c187d(0x211)](a44_0x226283[_0x4c187d(0x1f0)](_0x4c187d(0x1f2))),console[_0x4c187d(0x211)](a44_0x226283[_0x4c187d(0x1ee)](_0x4c187d(0x201))),0x1;if(_0x4e4228==='..'){const _0x4162e9=_0x227213[_0x4c187d(0x1f3)]('/')[_0x4c187d(0x213)](0x0,-0x1)[_0x4c187d(0x204)]('/');_0x4706fc=_0x4162e9||'/';}else _0x4e4228==='.'?_0x4706fc=_0x227213:_0x4706fc=_0x227213+'/'+_0x4e4228;_0x338124[_0x4c187d(0x1e5)]&&console[_0x4c187d(0x211)]('Resolved\x20relative\x20path\x20to:\x20'+_0x4706fc);}if(_0x4706fc==='/'||_0x4706fc==='')return saveSessionContext({'segment_path':undefined},_0x5b11f0),console[_0x4c187d(0x1f5)](a44_0x226283['green'](_0x4c187d(0x214))),0x0;_0x4706fc=normalizePath(_0x4706fc);const _0x163c91=parsePath(_0x4706fc)[_0x4c187d(0x1f8)];if(_0x163c91[_0x4c187d(0x1e0)]===0x0)return saveSessionContext({'segment_path':undefined},_0x5b11f0),console[_0x4c187d(0x1f5)](a44_0x226283[_0x4c187d(0x1f6)](_0x4c187d(0x214))),0x0;_0x338124[_0x4c187d(0x1e5)]&&(console[_0x4c187d(0x211)](_0x4c187d(0x1dd)+_0x338124[_0x4c187d(0x1eb)]),console[_0x4c187d(0x211)](_0x4c187d(0x205)+_0x4706fc));const _0x671ba2=await withSpinner(_0x4c187d(0x207)+_0x4706fc+'\x27...',()=>_0x355c46[_0x4c187d(0x1e9)][_0x4c187d(0x20a)](_0x4706fc),{'verbose':_0x338124['verbose']}),_0x3ab3d0=_0x671ba2[_0x4c187d(0x1f1)];_0x338124['verbose']&&(console[_0x4c187d(0x211)](_0x4c187d(0x1f7)+_0x3ab3d0[_0x4c187d(0x20e)]),console[_0x4c187d(0x211)](_0x4c187d(0x1f9)+_0x3ab3d0[_0x4c187d(0x206)]),_0x3ab3d0[_0x4c187d(0x1df)]&&console[_0x4c187d(0x211)]('Folder\x20ID:\x20'+_0x3ab3d0[_0x4c187d(0x1df)]));if(_0x3ab3d0[_0x4c187d(0x20e)]==='segment')return console[_0x4c187d(0x211)](a44_0x226283[_0x4c187d(0x1f0)](_0x4c187d(0x202))),console[_0x4c187d(0x211)](_0x4c187d(0x1fb)),console[_0x4c187d(0x211)](a44_0x226283[_0x4c187d(0x1ee)](_0x4c187d(0x1e6)+_0x3ab3d0[_0x4c187d(0x20c)]+(_0x3ab3d0['folderPath']?'/'+_0x3ab3d0[_0x4c187d(0x1ea)]['join']('/'):''))),0x1;return saveSessionContext({'segment_path':_0x3ab3d0['fullPath'],'parent_segment':_0x3ab3d0[_0x4c187d(0x20c)]},_0x5b11f0),console[_0x4c187d(0x1f5)](a44_0x226283['green'](_0x4c187d(0x1e4)+a44_0x226283['cyan'](_0x3ab3d0[_0x4c187d(0x1e3)]))),_0x338124['verbose']&&(console['error'](a44_0x226283[_0x4c187d(0x20b)]('Use\x20\x22tdx\x20segments\x22\x20to\x20list\x20contents\x20in\x20this\x20context')),console[_0x4c187d(0x211)](a44_0x226283[_0x4c187d(0x20b)](_0x4c187d(0x1e7)))),0x0;}catch(_0x31ad78){throw _0x31ad78;}}}function a44_0x34c7(){const _0x5147ab=['297171KnhUyE','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','11ZBtnNn','Site:\x20','segment:use','folderId','length','112kVQZVJ','10viThbd','fullPath','✔\x20Context\x20set\x20to:\x20','verbose','Use:\x20tdx\x20segment\x20use\x20','Use\x20\x22tdx\x20use\x22\x20to\x20see\x20all\x20context\x20parameters','session','segment','folderPath','site','6738111uIzBVz','isAbsolute','cyan','9280840NslaFe','red','data','Error:\x20No\x20context\x20set.\x20Cannot\x20use\x20relative\x20path.','split','2863IEpteF','log','green','Resolved\x20path\x20type:\x20','segments','Parent\x20ID:\x20','parent_segment','Context\x20can\x20only\x20be\x20set\x20to\x20a\x20parent\x20segment\x20or\x20folder.','98514tGKzwb','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience\x22','Examples:','Usage:\x20tdx\x20segment\x20use\x20<path>','Error:\x20Path\x20is\x20required\x0a','Use\x20an\x20absolute\x20path\x20or\x20set\x20context\x20with:\x20tdx\x20segment\x20use\x20<parent_name>','Error:\x20Cannot\x20set\x20context\x20to\x20a\x20segment.','\x20\x20tdx\x20segment\x20use\x20\x22My\x20Audience/Marketing\x22','join','Target\x20path:\x20','parentId','Resolving\x20path\x20\x27','89073nPrYBc','136xOoMEA','resolvePathToResource','dim','parentName','\x20\x20tdx\x20segment\x20use\x20..\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Go\x20to\x20parent','type','376XgLXjt','description','error','12521748mKZhwl','slice','✔\x20Context\x20cleared.\x20Back\x20to\x20root.'];a44_0x34c7=function(){return _0x5147ab;};return a44_0x34c7();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a45_0x550178=a45_0x3f23;function a45_0x3f23(_0x6a46ff,_0x18115d){_0x6a46ff=_0x6a46ff-0x1b2;const _0x19ec17=a45_0x19ec();let _0x3f2336=_0x19ec17[_0x6a46ff];return _0x3f2336;}(function(_0x597723,_0x552890){const _0x57a624=a45_0x3f23,_0x365c6a=_0x597723();while(!![]){try{const _0x46b473=parseInt(_0x57a624(0x1d9))/0x1*(-parseInt(_0x57a624(0x1de))/0x2)+-parseInt(_0x57a624(0x1d5))/0x3+parseInt(_0x57a624(0x1cd))/0x4+-parseInt(_0x57a624(0x1d7))/0x5*(parseInt(_0x57a624(0x1dc))/0x6)+-parseInt(_0x57a624(0x1b2))/0x7+-parseInt(_0x57a624(0x1db))/0x8+parseInt(_0x57a624(0x1dd))/0x9;if(_0x46b473===_0x552890)break;else _0x365c6a['push'](_0x365c6a['shift']());}catch(_0x1d0d24){_0x365c6a['push'](_0x365c6a['shift']());}}}(a45_0x19ec,0xdea86));import{BaseCommand}from'./command.js';function a45_0x19ec(){const _0x54ae71=['targetDir','cyan','warnings','invalidCount','\x20error(s)','hasErrors','warningCount','log','no_parent','length','filePath','error','name','validCount','red','\x20warning(s)\x20found','6799948GSixer','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','execute','verbose','message','type','file','endsWith','2559549whTqAp','green','25qXRHZn','description','1937UawkRq','dim','6962272ExmhoX','112644dInmLP','38502288RwUhSn','1552BoGzeU','Error:\x20Directory\x20not\x20found:\x20','yellow','.yaml','12218948iJRqTv','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','segment:validate','✔\x20All\x20','\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','valid','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','Error:\x20','Validation\x20failed:\x20','\x20file(s)\x20with\x20errors,\x20','Usage:\x20tdx\x20sg\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)'];a45_0x19ec=function(){return _0x54ae71;};return a45_0x19ec();}import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';import a45_0x37afd2 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_0x550178(0x1c9)]=a45_0x550178(0x1b4);[a45_0x550178(0x1d8)]='Validate\x20segment\x20and\x20journey\x20YAML\x20files';async[a45_0x550178(0x1cf)](_0x168ebf){const _0xc9b3f4=a45_0x550178,{options:_0x47b34b,args:_0x108881}=_0x168ebf,_0x244bb6=_0x47b34b,_0x3d8adb=await resolveTarget({'arg':_0x108881[0x0],'contextParent':_0x47b34b['parentSegment'],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x3d8adb))return _0x3d8adb['errorCode']===_0xc9b3f4(0x1c5)?(console[_0xc9b3f4(0x1c8)](a45_0x37afd2['yellow'](_0xc9b3f4(0x1b8))),console['error'](_0xc9b3f4(0x1bc)),console[_0xc9b3f4(0x1c8)](_0xc9b3f4(0x1b6)),console[_0xc9b3f4(0x1c8)](_0xc9b3f4(0x1ce))):(console[_0xc9b3f4(0x1c8)](a45_0x37afd2[_0xc9b3f4(0x1cb)](_0xc9b3f4(0x1b9)+_0x3d8adb[_0xc9b3f4(0x1d1)]+'\x0a')),_0x3d8adb['helpText']&&console[_0xc9b3f4(0x1c8)](a45_0x37afd2[_0xc9b3f4(0x1be)](_0x3d8adb['helpText']))),0x1;const _0x2ee4c5=_0x3d8adb[_0xc9b3f4(0x1bd)],_0x2f24e6=_0x3d8adb[_0xc9b3f4(0x1d2)]===_0xc9b3f4(0x1d3)?_0x3d8adb[_0xc9b3f4(0x1c7)]:undefined;if(!_0x2f24e6&&!existsSync(_0x2ee4c5))return console[_0xc9b3f4(0x1c8)](a45_0x37afd2[_0xc9b3f4(0x1cb)](_0xc9b3f4(0x1df)+_0x2ee4c5+'\x0a')),0x1;let _0x1deb7c;if(_0x2f24e6){if(!_0x2f24e6[_0xc9b3f4(0x1d4)]('.yml')&&!_0x2f24e6[_0xc9b3f4(0x1d4)](_0xc9b3f4(0x1e1)))return console[_0xc9b3f4(0x1c8)](a45_0x37afd2['red']('Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20'+_0x2f24e6+'\x0a')),0x1;_0x1deb7c=[_0x2f24e6];}else _0x1deb7c=findYamlFiles(_0x2ee4c5);if(_0x1deb7c[_0xc9b3f4(0x1c6)]===0x0)return console[_0xc9b3f4(0x1c8)](a45_0x37afd2[_0xc9b3f4(0x1cb)](_0xc9b3f4(0x1b3)+_0x2ee4c5+'\x0a')),0x1;const _0x1cb347=validateYamlFiles(_0x1deb7c,_0x2ee4c5),_0x1b88d2=calculateSummary(_0x1cb347);for(const _0x179903 of _0x1cb347){if(!isValidationResult(_0x179903))continue;const {relativePath:_0x1509de,source:_0x3cca6f,result:_0x2396ca,fileType:_0x14ab2a}=_0x179903,_0x4acfae=_0x14ab2a;if(_0x2396ca['valid']&&_0x2396ca[_0xc9b3f4(0x1bf)][_0xc9b3f4(0x1c6)]===0x0)_0x244bb6[_0xc9b3f4(0x1d0)]&&console['log'](a45_0x37afd2[_0xc9b3f4(0x1d6)]('✔\x20'+_0x1509de)+a45_0x37afd2[_0xc9b3f4(0x1da)]('\x20('+_0x4acfae+')'));else _0x2396ca[_0xc9b3f4(0x1b7)]?(console[_0xc9b3f4(0x1c4)](a45_0x37afd2[_0xc9b3f4(0x1e0)]('⚠\x20'+_0x1509de)+a45_0x37afd2['dim']('\x20('+_0x4acfae+'):\x20'+_0x2396ca['warnings'][_0xc9b3f4(0x1c6)]+'\x20warning(s)')),console['log'](formatValidationResult(_0x2396ca,_0x3cca6f,_0x1509de))):(console[_0xc9b3f4(0x1c4)](a45_0x37afd2[_0xc9b3f4(0x1cb)]('✖\x20'+_0x1509de)+a45_0x37afd2[_0xc9b3f4(0x1da)]('\x20('+_0x4acfae+'):\x20'+_0x2396ca['errors'][_0xc9b3f4(0x1c6)]+_0xc9b3f4(0x1c1))),console['log'](formatValidationResult(_0x2396ca,_0x3cca6f,_0x1509de)));}return console[_0xc9b3f4(0x1c4)](''),_0x1b88d2[_0xc9b3f4(0x1c2)]?(console['log'](a45_0x37afd2[_0xc9b3f4(0x1cb)](_0xc9b3f4(0x1ba)+_0x1b88d2[_0xc9b3f4(0x1c0)]+_0xc9b3f4(0x1bb)+_0x1b88d2['validCount']+'\x20valid')),_0x1b88d2['warningCount']>0x0&&console[_0xc9b3f4(0x1c4)](a45_0x37afd2[_0xc9b3f4(0x1e0)](_0x1b88d2[_0xc9b3f4(0x1c3)]+'\x20warning(s)\x20found')),0x1):(console[_0xc9b3f4(0x1c4)](a45_0x37afd2[_0xc9b3f4(0x1d6)](_0xc9b3f4(0x1b5)+_0x1b88d2[_0xc9b3f4(0x1ca)]+'\x20file(s)\x20valid')),_0x1b88d2[_0xc9b3f4(0x1c3)]>0x0&&console[_0xc9b3f4(0x1c4)](a45_0x37afd2[_0xc9b3f4(0x1e0)](_0x1b88d2['warningCount']+_0xc9b3f4(0x1cc))),0x0);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a46_0x13a210=a46_0x43cd;(function(_0x2f143f,_0x3b8eeb){const _0xcc49ae=a46_0x43cd,_0x3018b2=_0x2f143f();while(!![]){try{const _0x37bf7e=parseInt(_0xcc49ae(0x105))/0x1*(-parseInt(_0xcc49ae(0x128))/0x2)+-parseInt(_0xcc49ae(0x120))/0x3+parseInt(_0xcc49ae(0xf6))/0x4+-parseInt(_0xcc49ae(0x10d))/0x5+-parseInt(_0xcc49ae(0xfd))/0x6*(-parseInt(_0xcc49ae(0xe2))/0x7)+-parseInt(_0xcc49ae(0x122))/0x8+-parseInt(_0xcc49ae(0xe3))/0x9*(-parseInt(_0xcc49ae(0x10f))/0xa);if(_0x37bf7e===_0x3b8eeb)break;else _0x3018b2['push'](_0x3018b2['shift']());}catch(_0x50189a){_0x3018b2['push'](_0x3018b2['shift']());}}}(a46_0x153e,0x44bb5));import{BaseCommand}from'./command.js';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_0x153e(){const _0x563405=['Parent\x20segment\x20context:\x20','segments','children','filter','data','\x20journey','sort','1417270lnAHcC','format','2910iRfyzo','test','No\x20items\x20match\x20pattern:\x20','execute','listWithPattern','\x20matching\x20\x27','log','site','(not\x20set)','cause','length','Site:\x20','recursive','folderId','/e/','✔\x20Found\x20','/j/da','716208lykqcQ','Parent\x20ID:\x20','768600TNNwIL','journeyBundleName','listRecursive','verbose','(empty)','error','459366oGkbun','resolvePathToResource','35210wEGezF','19269rxYaps','Use\x20tdx\x20ps\x20list\x20to\x20see\x20available\x20parent\x20segments.','Folder/pattern\x20arg:\x20',',\x20and\x20','replace','✔\x20Built\x20tree\x20with\x20','/app/ps/','\x20\x20tdx\x20sg\x20use\x20\x22My\x20Audience\x22','Listing\x20folders,\x20segments,\x20and\x20journeys...','segment','maxDepth','folders','folder','listUnifiedWithJourneys','Folder\x20ID:\x20','name','\x20segment','Building\x20hierarchy\x20tree...','\x20folder','134488XfPmVK','\x27...','dim','journey','listUnified','Set\x20a\x20parent\x20segment\x20context\x20first:','json','564JGVyKO','map','type','localeCompare','parentId','jsonl',']\x20matching\x20\x27','journeys','1XrftQn'];a46_0x153e=function(){return _0x563405;};return a46_0x153e();}import a46_0x56b2b4 from'chalk';function a46_0x43cd(_0x59b0fd,_0x39d7c1){_0x59b0fd=_0x59b0fd-0xe2;const _0x153e2a=a46_0x153e();let _0x43cd05=_0x153e2a[_0x59b0fd];return _0x43cd05;}export class SegmentsCommand extends BaseCommand{[a46_0x13a210(0xf2)]=a46_0x13a210(0x107);['description']='List\x20folders\x20and\x20child\x20segments';async[a46_0x13a210(0x112)](_0x132876){const _0x519b56=a46_0x13a210,{options:_0x52d095,args:_0x5a31f9}=_0x132876,_0x21e0f7=_0x52d095[_0x519b56(0x11b)],_0x1b3473=_0x5a31f9[0x0];try{const _0x5ea0d8=_0x52d095['parentSegment'];_0x52d095[_0x519b56(0x125)]&&(console[_0x519b56(0x127)](_0x519b56(0x11a)+_0x52d095[_0x519b56(0x116)]),console[_0x519b56(0x127)](_0x519b56(0x106)+(_0x5ea0d8||_0x519b56(0x117))),_0x1b3473&&console[_0x519b56(0x127)](_0x519b56(0xe5)+_0x1b3473),_0x21e0f7&&console[_0x519b56(0x127)]('Recursive\x20mode:\x20enabled'));if(!_0x5ea0d8)return console[_0x519b56(0x127)]('Error:\x20No\x20parent\x20segment\x20context\x20set.'),console[_0x519b56(0x127)](''),console[_0x519b56(0x127)](_0x519b56(0xfb)),console[_0x519b56(0x127)]('\x20\x20tdx\x20sg\x20pull\x20\x22My\x20Audience\x22'),console[_0x519b56(0x127)](_0x519b56(0xea)),console['error'](''),console['error'](_0x519b56(0xe4)),0x1;const _0xa8880d=_0x1b3473&&(_0x1b3473['includes']('*')||_0x1b3473['includes']('?'));if(_0xa8880d)return await this['listWithPattern'](_0x132876,_0x5ea0d8,_0x1b3473);const _0x52f2ed=_0x1b3473?_0x5ea0d8+'/'+_0x1b3473:_0x5ea0d8;return _0x21e0f7?await this[_0x519b56(0x124)](_0x132876,_0x52f2ed):await this[_0x519b56(0xfa)](_0x132876,_0x52f2ed);}catch(_0xfb7ff0){if(_0xfb7ff0 instanceof SDKError)return console[_0x519b56(0x127)]('Error:\x20'+_0xfb7ff0['message']),_0xfb7ff0[_0x519b56(0x118)]&&console['error']('\x20\x20Cause:\x20'+_0xfb7ff0[_0x519b56(0x118)]),0x1;throw _0xfb7ff0;}}async[a46_0x13a210(0x113)](_0x1e6818,_0x5c6d9b,_0x42376c){const _0x21fae5=a46_0x13a210,{options:_0x20fc90,tdx:_0x33f496}=_0x1e6818,_0x2e97cc=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5c6d9b+'\x27...',()=>_0x33f496[_0x21fae5(0xec)][_0x21fae5(0x129)](_0x5c6d9b),{'verbose':_0x20fc90['verbose']}),_0x51885b=_0x2e97cc[_0x21fae5(0x10a)],_0x3aee13=await withSpinner('Listing\x20folders,\x20segments,\x20and\x20journeys...',()=>_0x33f496[_0x21fae5(0xec)][_0x21fae5(0xf0)](_0x51885b[_0x21fae5(0x101)],_0x51885b[_0x21fae5(0x11c)]),{'verbose':_0x20fc90[_0x21fae5(0x125)]}),{folders:_0x54275c,segments:_0x5d6d67,journeys:_0x13ebea}=_0x3aee13[_0x21fae5(0x10a)],_0x594187=_0x42376c[_0x21fae5(0xe7)](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0x21fae5(0xe7)](/\*/g,'.*')[_0x21fae5(0xe7)](/\?/g,'.'),_0x4cd835=new RegExp('^'+_0x594187+'$','i'),_0x20fdb3=_0x54275c[_0x21fae5(0x109)](_0x44b3a2=>_0x4cd835[_0x21fae5(0x110)](_0x44b3a2[_0x21fae5(0xf2)])),_0x2523f9=_0x5d6d67[_0x21fae5(0x109)](_0x1a5d2b=>_0x4cd835[_0x21fae5(0x110)](_0x1a5d2b['name'])),_0x141d8c=_0x13ebea['filter'](_0x5919a1=>_0x4cd835[_0x21fae5(0x110)](_0x5919a1[_0x21fae5(0x123)])),_0x399c55=_0x20fdb3[_0x21fae5(0x119)]+_0x2523f9[_0x21fae5(0x119)]+_0x141d8c[_0x21fae5(0x119)];console['error'](_0x21fae5(0x11e)+_0x20fdb3['length']+_0x21fae5(0xf5)+(_0x20fdb3['length']!==0x1?'s':'')+',\x20'+_0x2523f9['length']+_0x21fae5(0xf3)+(_0x2523f9[_0x21fae5(0x119)]!==0x1?'s':'')+_0x21fae5(0xe6)+_0x141d8c[_0x21fae5(0x119)]+_0x21fae5(0x10b)+(_0x141d8c[_0x21fae5(0x119)]!==0x1?'s':'')+_0x21fae5(0x114)+_0x42376c+'\x27');const _0x4a2085=_0x5a6ee1=>{const _0x16d32f=_0x21fae5;return getConsoleNextUrl(_0x20fc90[_0x16d32f(0x116)],_0x16d32f(0xe9)+_0x51885b['parentId']+_0x16d32f(0x11d)+_0x5a6ee1);},_0x2cdde3=_0x20fc90[_0x21fae5(0x10e)]===_0x21fae5(0xfc)||_0x20fc90[_0x21fae5(0x10e)]===_0x21fae5(0x102);if(_0x2cdde3){const _0x5cc14e=[..._0x20fdb3[_0x21fae5(0xfe)](_0x429b20=>({..._0x429b20,'type':_0x21fae5(0xef)})),..._0x2523f9[_0x21fae5(0xfe)](_0x176247=>({..._0x176247,'type':_0x21fae5(0xec),'url':_0x4a2085(_0x176247['id'])})),..._0x141d8c['map'](_0x495c29=>({..._0x495c29,'name':_0x495c29[_0x21fae5(0x123)],'type':'journey'}))][_0x21fae5(0x10c)]((_0xeb6bbc,_0x3f882d)=>_0xeb6bbc[_0x21fae5(0xf2)][_0x21fae5(0x100)](_0x3f882d['name']));await handleSDKOutput(_0x5cc14e,_0x20fc90);}else{if(_0x399c55===0x0)console['log'](_0x21fae5(0x111)+_0x42376c);else{console[_0x21fae5(0x115)](a46_0x56b2b4[_0x21fae5(0xf8)]('['+_0x5c6d9b+_0x21fae5(0x103)+_0x42376c+'\x27'));const _0x38ef99=formatFlatList(_0x20fdb3,_0x2523f9,{'showMetadata':!![],'getSegmentUrl':_0x4a2085},_0x141d8c);console[_0x21fae5(0x115)](_0x38ef99);}}return 0x0;}async['listUnified'](_0x2880dd,_0xdaaa64){const _0x5b0c93=a46_0x13a210,{options:_0x37c7da,tdx:_0x55fe08}=_0x2880dd,_0x2a8ac7=await withSpinner('Resolving\x20path\x20\x27'+_0xdaaa64+'\x27...',()=>_0x55fe08[_0x5b0c93(0xec)][_0x5b0c93(0x129)](_0xdaaa64),{'verbose':_0x37c7da['verbose']}),_0x531665=_0x2a8ac7[_0x5b0c93(0x10a)];_0x37c7da[_0x5b0c93(0x125)]&&(console[_0x5b0c93(0x127)](_0x5b0c93(0x121)+_0x531665[_0x5b0c93(0x101)]),_0x531665['folderId']&&console[_0x5b0c93(0x127)](_0x5b0c93(0xf1)+_0x531665[_0x5b0c93(0x11c)]));const _0x4c30e0=await withSpinner(_0x5b0c93(0xeb),()=>_0x55fe08[_0x5b0c93(0xec)][_0x5b0c93(0xf0)](_0x531665['parentId'],_0x531665[_0x5b0c93(0x11c)]),{'verbose':_0x37c7da[_0x5b0c93(0x125)]}),{folders:_0xce844f,segments:_0x543886,journeys:_0x2ba077}=_0x4c30e0['data'],_0x5c2cd7=_0xce844f[_0x5b0c93(0x119)]+_0x543886['length']+_0x2ba077[_0x5b0c93(0x119)];console['error'](_0x5b0c93(0x11e)+_0xce844f['length']+'\x20folder'+(_0xce844f['length']!==0x1?'s':'')+',\x20'+_0x543886[_0x5b0c93(0x119)]+_0x5b0c93(0xf3)+(_0x543886['length']!==0x1?'s':'')+_0x5b0c93(0xe6)+_0x2ba077[_0x5b0c93(0x119)]+_0x5b0c93(0x10b)+(_0x2ba077[_0x5b0c93(0x119)]!==0x1?'s':''));const _0x32198b=_0x495a10=>{const _0x2ccf8e=_0x5b0c93;return getConsoleNextUrl(_0x37c7da[_0x2ccf8e(0x116)],_0x2ccf8e(0xe9)+_0x531665['parentId']+'/e/'+_0x495a10);},_0x1c3f4e=_0x2ca26b=>{const _0x28b0c0=_0x5b0c93;return getConsoleNextUrl(_0x37c7da[_0x28b0c0(0x116)],_0x28b0c0(0xe9)+_0x531665['parentId']+_0x28b0c0(0x11d)+_0x2ca26b+_0x28b0c0(0x11f));},_0x2d0a20=_0x37c7da[_0x5b0c93(0x10e)]===_0x5b0c93(0xfc)||_0x37c7da[_0x5b0c93(0x10e)]===_0x5b0c93(0x102);if(_0x2d0a20){const _0x5809da=[..._0xce844f[_0x5b0c93(0xfe)](_0x58bbc3=>({..._0x58bbc3,'type':'folder'})),..._0x543886[_0x5b0c93(0xfe)](_0x571d9e=>({..._0x571d9e,'type':_0x5b0c93(0xec),'url':_0x32198b(_0x571d9e['id'])})),..._0x2ba077[_0x5b0c93(0xfe)](_0x4099f0=>({..._0x4099f0,'name':_0x4099f0[_0x5b0c93(0x123)],'type':_0x5b0c93(0xf9),'url':_0x1c3f4e(_0x4099f0['id'])}))][_0x5b0c93(0x10c)]((_0x4a6d77,_0x58eefb)=>_0x4a6d77[_0x5b0c93(0xf2)][_0x5b0c93(0x100)](_0x58eefb['name']));await handleSDKOutput(_0x5809da,_0x37c7da);}else{if(_0x5c2cd7===0x0)console[_0x5b0c93(0x115)](a46_0x56b2b4['dim']('['+_0xdaaa64+']')),console[_0x5b0c93(0x115)](_0x5b0c93(0x126));else{console[_0x5b0c93(0x115)](a46_0x56b2b4['dim']('['+_0xdaaa64+']'));const _0x579cdc=formatFlatList(_0xce844f,_0x543886,{'showMetadata':!![],'getSegmentUrl':_0x32198b,'getJourneyUrl':_0x1c3f4e},_0x2ba077);console[_0x5b0c93(0x115)](_0x579cdc);}}return 0x0;}async[a46_0x13a210(0x124)](_0x16da2a,_0x451a1e){const _0x2604d5=a46_0x13a210,{options:_0x3d1696,tdx:_0x278e6a}=_0x16da2a,_0x21ab4f=await withSpinner('Resolving\x20path\x20\x27'+_0x451a1e+_0x2604d5(0xf7),()=>_0x278e6a[_0x2604d5(0xec)]['resolvePathToResource'](_0x451a1e),{'verbose':_0x3d1696[_0x2604d5(0x125)]}),_0x10019d=_0x21ab4f['data'];_0x3d1696[_0x2604d5(0x125)]&&(console[_0x2604d5(0x127)](_0x2604d5(0x121)+_0x10019d[_0x2604d5(0x101)]),_0x10019d[_0x2604d5(0x11c)]&&console['error'](_0x2604d5(0xf1)+_0x10019d[_0x2604d5(0x11c)]));const _0x1dac05=_0x3d1696[_0x2604d5(0xed)]||0xa,_0x54961e=await withSpinner(_0x2604d5(0xf4),()=>_0x278e6a['segment']['listRecursive'](_0x10019d[_0x2604d5(0x101)],_0x10019d[_0x2604d5(0x11c)],0x0,_0x1dac05),{'verbose':_0x3d1696['verbose']}),_0x1b3f88=_0x54961e[_0x2604d5(0x10a)],_0xcec19e=_0x185933=>{const _0x41bc76=_0x2604d5;let _0xd14b3d=0x0,_0x272948=0x0,_0x14a0a9=0x0;for(const _0x30938d of _0x185933){if(_0x30938d[_0x41bc76(0xff)]===_0x41bc76(0xef))_0xd14b3d++;else{if(_0x30938d[_0x41bc76(0xff)]==='segment')_0x272948++;else{if(_0x30938d[_0x41bc76(0xff)]==='journey')_0x14a0a9++;}}if(_0x30938d[_0x41bc76(0x108)]){const _0x3c8cc0=_0xcec19e(_0x30938d[_0x41bc76(0x108)]);_0xd14b3d+=_0x3c8cc0[_0x41bc76(0xee)],_0x272948+=_0x3c8cc0['segments'],_0x14a0a9+=_0x3c8cc0['journeys'];}}return{'folders':_0xd14b3d,'segments':_0x272948,'journeys':_0x14a0a9};},_0x3178a0=_0xcec19e(_0x1b3f88);console['error'](_0x2604d5(0xe8)+_0x3178a0[_0x2604d5(0xee)]+_0x2604d5(0xf5)+(_0x3178a0[_0x2604d5(0xee)]!==0x1?'s':'')+',\x20'+_0x3178a0[_0x2604d5(0x107)]+_0x2604d5(0xf3)+(_0x3178a0[_0x2604d5(0x107)]!==0x1?'s':'')+_0x2604d5(0xe6)+_0x3178a0[_0x2604d5(0x104)]+_0x2604d5(0x10b)+(_0x3178a0[_0x2604d5(0x104)]!==0x1?'s':''));const _0x439bb1=_0x3916c8=>{const _0x50d85e=_0x2604d5;return getConsoleNextUrl(_0x3d1696[_0x50d85e(0x116)],'/app/ps/'+_0x10019d[_0x50d85e(0x101)]+_0x50d85e(0x11d)+_0x3916c8);},_0x5412f8=_0x243520=>{const _0x3096e2=_0x2604d5;return getConsoleNextUrl(_0x3d1696['site'],_0x3096e2(0xe9)+_0x10019d[_0x3096e2(0x101)]+_0x3096e2(0x11d)+_0x243520+'/j/da');};if(_0x3d1696[_0x2604d5(0x10e)]===_0x2604d5(0xfc)||_0x3d1696[_0x2604d5(0x10e)]===_0x2604d5(0x102))await handleSDKOutput(_0x1b3f88,_0x3d1696);else{console[_0x2604d5(0x115)](a46_0x56b2b4[_0x2604d5(0xf8)]('['+_0x451a1e+']'));const _0x57b61d=formatTree(_0x1b3f88,{'showMetadata':!![],'getSegmentUrl':_0x439bb1,'getJourneyUrl':_0x5412f8});console[_0x2604d5(0x115)](_0x57b61d);}return 0x0;}}
|
|
1
|
+
const a46_0xb44838=a46_0x15b2;function a46_0x15b2(_0x6f4afd,_0x398576){_0x6f4afd=_0x6f4afd-0x1b4;const _0x3cc23e=a46_0x3cc2();let _0x15b2fc=_0x3cc23e[_0x6f4afd];return _0x15b2fc;}(function(_0x3af515,_0x17b692){const _0x5f41c9=a46_0x15b2,_0x29b38a=_0x3af515();while(!![]){try{const _0x220541=-parseInt(_0x5f41c9(0x1ea))/0x1*(-parseInt(_0x5f41c9(0x1fa))/0x2)+-parseInt(_0x5f41c9(0x1ed))/0x3+-parseInt(_0x5f41c9(0x1f5))/0x4*(-parseInt(_0x5f41c9(0x1d4))/0x5)+-parseInt(_0x5f41c9(0x1ec))/0x6*(parseInt(_0x5f41c9(0x1e8))/0x7)+parseInt(_0x5f41c9(0x200))/0x8+parseInt(_0x5f41c9(0x1d9))/0x9*(-parseInt(_0x5f41c9(0x1e0))/0xa)+parseInt(_0x5f41c9(0x1c9))/0xb;if(_0x220541===_0x17b692)break;else _0x29b38a['push'](_0x29b38a['shift']());}catch(_0xed5b0e){_0x29b38a['push'](_0x29b38a['shift']());}}}(a46_0x3cc2,0x75d4c));function a46_0x3cc2(){const _0x5b14f3=['type','Site:\x20','maxDepth','listUnifiedWithJourneys','1057kOunYn','replace','946luQUnN','parentId','16464IMkMPs','1708614DdQlRj','Folder/pattern\x20arg:\x20','listRecursive','Parent\x20ID:\x20','✔\x20Found\x20','\x20folder','Listing\x20folders,\x20segments,\x20and\x20journeys...','Resolving\x20parent\x20segment\x20\x27','13880ujxwpw','\x5c$&','✔\x20Built\x20tree\x20with\x20','segments','error','806OlwPBl','jsonl','dim','No\x20items\x20match\x20pattern:\x20','Error:\x20',',\x20and\x20','12992pEGDhQ','verbose','Resolving\x20path\x20\x27','(not\x20set)','map','/app/ps/','localeCompare','Recursive\x20mode:\x20enabled','site','description','\x20journey','journeyBundleName','Set\x20a\x20parent\x20segment\x20context\x20first:','cause','folders','\x20matching\x20\x27','folderId','\x27...','/j/da','length','listWithPattern','folder',']\x20matching\x20\x27','name','recursive','includes','log','9582925HYfQNB','\x20\x20Cause:\x20','listUnified','sort','parentSegment','journey','(empty)','message','execute','segment','\x20segment','985wAcvbg','/e/','data','format','json','4239981hUgCIM','Building\x20hierarchy\x20tree...','\x20\x20tdx\x20sg\x20pull\x20\x22My\x20Audience\x22','filter','journeys','Use\x20tdx\x20ps\x20list\x20to\x20see\x20available\x20parent\x20segments.','children','10MBKHuz','test','resolvePathToResource','List\x20folders\x20and\x20child\x20segments'];a46_0x3cc2=function(){return _0x5b14f3;};return a46_0x3cc2();}import{BaseCommand}from'./command.js';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';import a46_0x51f9a0 from'chalk';export class SegmentsCommand extends BaseCommand{[a46_0xb44838(0x1c5)]=a46_0xb44838(0x1f8);[a46_0xb44838(0x1b7)]=a46_0xb44838(0x1e3);async[a46_0xb44838(0x1d1)](_0x2df1ed){const _0x363f6e=a46_0xb44838,{options:_0x61ca40,args:_0x8a5a71}=_0x2df1ed,_0x1fe59f=_0x61ca40[_0x363f6e(0x1c6)],_0x133b93=_0x8a5a71[0x0];try{const _0x4c843f=_0x61ca40[_0x363f6e(0x1cd)];_0x61ca40[_0x363f6e(0x201)]&&(console['error'](_0x363f6e(0x1e5)+_0x61ca40[_0x363f6e(0x1b6)]),console[_0x363f6e(0x1f9)]('Parent\x20segment\x20context:\x20'+(_0x4c843f||_0x363f6e(0x203))),_0x133b93&&console[_0x363f6e(0x1f9)](_0x363f6e(0x1ee)+_0x133b93),_0x1fe59f&&console['error'](_0x363f6e(0x1b5)));if(!_0x4c843f)return console['error']('Error:\x20No\x20parent\x20segment\x20context\x20set.'),console['error'](''),console[_0x363f6e(0x1f9)](_0x363f6e(0x1ba)),console[_0x363f6e(0x1f9)](_0x363f6e(0x1db)),console[_0x363f6e(0x1f9)]('\x20\x20tdx\x20sg\x20use\x20\x22My\x20Audience\x22'),console[_0x363f6e(0x1f9)](''),console['error'](_0x363f6e(0x1de)),0x1;const _0x24db98=_0x133b93&&(_0x133b93[_0x363f6e(0x1c7)]('*')||_0x133b93['includes']('?'));if(_0x24db98)return await this[_0x363f6e(0x1c2)](_0x2df1ed,_0x4c843f,_0x133b93);const _0x459472=_0x133b93?_0x4c843f+'/'+_0x133b93:_0x4c843f;return _0x1fe59f?await this['listRecursive'](_0x2df1ed,_0x459472):await this[_0x363f6e(0x1cb)](_0x2df1ed,_0x459472);}catch(_0x104799){if(_0x104799 instanceof SDKError)return console[_0x363f6e(0x1f9)](_0x363f6e(0x1fe)+_0x104799[_0x363f6e(0x1d0)]),_0x104799[_0x363f6e(0x1bb)]&&console[_0x363f6e(0x1f9)](_0x363f6e(0x1ca)+_0x104799[_0x363f6e(0x1bb)]),0x1;throw _0x104799;}}async[a46_0xb44838(0x1c2)](_0x4c02c5,_0x43ebfd,_0x153b0d){const _0x4f5067=a46_0xb44838,{options:_0x5c5a68,tdx:_0x558d04}=_0x4c02c5,_0x29b5e2=await withSpinner(_0x4f5067(0x1f4)+_0x43ebfd+_0x4f5067(0x1bf),()=>_0x558d04[_0x4f5067(0x1d2)][_0x4f5067(0x1e2)](_0x43ebfd),{'verbose':_0x5c5a68[_0x4f5067(0x201)]}),_0x105a2c=_0x29b5e2[_0x4f5067(0x1d6)],_0xda912d=await withSpinner(_0x4f5067(0x1f3),()=>_0x558d04[_0x4f5067(0x1d2)][_0x4f5067(0x1e7)](_0x105a2c[_0x4f5067(0x1eb)],_0x105a2c['folderId']),{'verbose':_0x5c5a68[_0x4f5067(0x201)]}),{folders:_0x2933a6,segments:_0x5f308d,journeys:_0x5564bd}=_0xda912d[_0x4f5067(0x1d6)],_0x59d88a=_0x153b0d[_0x4f5067(0x1e9)](/[.+^${}()|[\]\\]/g,_0x4f5067(0x1f6))[_0x4f5067(0x1e9)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x50d0da=new RegExp('^'+_0x59d88a+'$','i'),_0x167e26=_0x2933a6['filter'](_0x351408=>_0x50d0da['test'](_0x351408[_0x4f5067(0x1c5)])),_0x5d4063=_0x5f308d[_0x4f5067(0x1dc)](_0x322941=>_0x50d0da[_0x4f5067(0x1e1)](_0x322941[_0x4f5067(0x1c5)])),_0xc7b0ec=_0x5564bd[_0x4f5067(0x1dc)](_0x2ffce1=>_0x50d0da[_0x4f5067(0x1e1)](_0x2ffce1['journeyBundleName'])),_0x3d378=_0x167e26[_0x4f5067(0x1c1)]+_0x5d4063[_0x4f5067(0x1c1)]+_0xc7b0ec[_0x4f5067(0x1c1)];console[_0x4f5067(0x1f9)](_0x4f5067(0x1f1)+_0x167e26[_0x4f5067(0x1c1)]+_0x4f5067(0x1f2)+(_0x167e26['length']!==0x1?'s':'')+',\x20'+_0x5d4063[_0x4f5067(0x1c1)]+_0x4f5067(0x1d3)+(_0x5d4063['length']!==0x1?'s':'')+_0x4f5067(0x1ff)+_0xc7b0ec[_0x4f5067(0x1c1)]+'\x20journey'+(_0xc7b0ec['length']!==0x1?'s':'')+_0x4f5067(0x1bd)+_0x153b0d+'\x27');const _0x4e09e4=_0x35f259=>{const _0x1718b0=_0x4f5067;return getConsoleNextUrl(_0x5c5a68[_0x1718b0(0x1b6)],_0x1718b0(0x205)+_0x105a2c[_0x1718b0(0x1eb)]+_0x1718b0(0x1d5)+_0x35f259);},_0x28a9f2=_0x5c5a68[_0x4f5067(0x1d7)]===_0x4f5067(0x1d8)||_0x5c5a68['format']===_0x4f5067(0x1fb);if(_0x28a9f2){const _0xceb7f9=[..._0x167e26[_0x4f5067(0x204)](_0x4b8f08=>({..._0x4b8f08,'type':_0x4f5067(0x1c3)})),..._0x5d4063[_0x4f5067(0x204)](_0x2d3c1e=>({..._0x2d3c1e,'type':_0x4f5067(0x1d2),'url':_0x4e09e4(_0x2d3c1e['id'])})),..._0xc7b0ec[_0x4f5067(0x204)](_0x4f77eb=>({..._0x4f77eb,'name':_0x4f77eb[_0x4f5067(0x1b9)],'type':_0x4f5067(0x1ce)}))][_0x4f5067(0x1cc)]((_0x49e9ee,_0x3f507b)=>_0x49e9ee[_0x4f5067(0x1c5)]['localeCompare'](_0x3f507b[_0x4f5067(0x1c5)]));await handleSDKOutput(_0xceb7f9,_0x5c5a68);}else{if(_0x3d378===0x0)console['log'](_0x4f5067(0x1fd)+_0x153b0d);else{console[_0x4f5067(0x1c8)](a46_0x51f9a0[_0x4f5067(0x1fc)]('['+_0x43ebfd+_0x4f5067(0x1c4)+_0x153b0d+'\x27'));const _0x210cb6=formatFlatList(_0x167e26,_0x5d4063,{'showMetadata':!![],'getSegmentUrl':_0x4e09e4},_0xc7b0ec);console[_0x4f5067(0x1c8)](_0x210cb6);}}return 0x0;}async[a46_0xb44838(0x1cb)](_0x440f16,_0x1e1766){const _0xe143c=a46_0xb44838,{options:_0x10bc37,tdx:_0x342765}=_0x440f16,_0x16dd94=await withSpinner(_0xe143c(0x202)+_0x1e1766+'\x27...',()=>_0x342765[_0xe143c(0x1d2)][_0xe143c(0x1e2)](_0x1e1766),{'verbose':_0x10bc37['verbose']}),_0x33cfad=_0x16dd94[_0xe143c(0x1d6)];_0x10bc37[_0xe143c(0x201)]&&(console['error'](_0xe143c(0x1f0)+_0x33cfad['parentId']),_0x33cfad[_0xe143c(0x1be)]&&console[_0xe143c(0x1f9)]('Folder\x20ID:\x20'+_0x33cfad[_0xe143c(0x1be)]));const _0x11800e=await withSpinner(_0xe143c(0x1f3),()=>_0x342765['segment'][_0xe143c(0x1e7)](_0x33cfad[_0xe143c(0x1eb)],_0x33cfad['folderId']),{'verbose':_0x10bc37[_0xe143c(0x201)]}),{folders:_0x182c5a,segments:_0x26930f,journeys:_0x110d97}=_0x11800e[_0xe143c(0x1d6)],_0x51512b=_0x182c5a['length']+_0x26930f[_0xe143c(0x1c1)]+_0x110d97[_0xe143c(0x1c1)];console[_0xe143c(0x1f9)](_0xe143c(0x1f1)+_0x182c5a[_0xe143c(0x1c1)]+_0xe143c(0x1f2)+(_0x182c5a[_0xe143c(0x1c1)]!==0x1?'s':'')+',\x20'+_0x26930f[_0xe143c(0x1c1)]+'\x20segment'+(_0x26930f[_0xe143c(0x1c1)]!==0x1?'s':'')+_0xe143c(0x1ff)+_0x110d97[_0xe143c(0x1c1)]+_0xe143c(0x1b8)+(_0x110d97[_0xe143c(0x1c1)]!==0x1?'s':''));const _0x5d69e4=_0x3037ca=>{const _0x1e95c3=_0xe143c;return getConsoleNextUrl(_0x10bc37[_0x1e95c3(0x1b6)],'/app/ps/'+_0x33cfad[_0x1e95c3(0x1eb)]+'/e/'+_0x3037ca);},_0x1a2b0b=_0xc171c3=>{const _0x41ef66=_0xe143c;return getConsoleNextUrl(_0x10bc37[_0x41ef66(0x1b6)],_0x41ef66(0x205)+_0x33cfad[_0x41ef66(0x1eb)]+_0x41ef66(0x1d5)+_0xc171c3+_0x41ef66(0x1c0));},_0xf8cfb0=_0x10bc37[_0xe143c(0x1d7)]===_0xe143c(0x1d8)||_0x10bc37['format']===_0xe143c(0x1fb);if(_0xf8cfb0){const _0x13deb0=[..._0x182c5a[_0xe143c(0x204)](_0x77bfa4=>({..._0x77bfa4,'type':_0xe143c(0x1c3)})),..._0x26930f[_0xe143c(0x204)](_0x579384=>({..._0x579384,'type':_0xe143c(0x1d2),'url':_0x5d69e4(_0x579384['id'])})),..._0x110d97['map'](_0x40b1d3=>({..._0x40b1d3,'name':_0x40b1d3[_0xe143c(0x1b9)],'type':'journey','url':_0x1a2b0b(_0x40b1d3['id'])}))][_0xe143c(0x1cc)]((_0x407413,_0x2a19ef)=>_0x407413[_0xe143c(0x1c5)][_0xe143c(0x1b4)](_0x2a19ef[_0xe143c(0x1c5)]));await handleSDKOutput(_0x13deb0,_0x10bc37);}else{if(_0x51512b===0x0)console['log'](a46_0x51f9a0['dim']('['+_0x1e1766+']')),console[_0xe143c(0x1c8)](_0xe143c(0x1cf));else{console['log'](a46_0x51f9a0[_0xe143c(0x1fc)]('['+_0x1e1766+']'));const _0x1e31dd=formatFlatList(_0x182c5a,_0x26930f,{'showMetadata':!![],'getSegmentUrl':_0x5d69e4,'getJourneyUrl':_0x1a2b0b},_0x110d97);console[_0xe143c(0x1c8)](_0x1e31dd);}}return 0x0;}async[a46_0xb44838(0x1ef)](_0x2b27e5,_0xd9fc30){const _0x3f6605=a46_0xb44838,{options:_0x14f306,tdx:_0x5296bd}=_0x2b27e5,_0x4c349b=await withSpinner(_0x3f6605(0x202)+_0xd9fc30+_0x3f6605(0x1bf),()=>_0x5296bd[_0x3f6605(0x1d2)]['resolvePathToResource'](_0xd9fc30),{'verbose':_0x14f306['verbose']}),_0xba3e54=_0x4c349b['data'];_0x14f306['verbose']&&(console[_0x3f6605(0x1f9)]('Parent\x20ID:\x20'+_0xba3e54[_0x3f6605(0x1eb)]),_0xba3e54[_0x3f6605(0x1be)]&&console[_0x3f6605(0x1f9)]('Folder\x20ID:\x20'+_0xba3e54[_0x3f6605(0x1be)]));const _0x3a3d66=_0x14f306[_0x3f6605(0x1e6)]||0xa,_0x2a0436=await withSpinner(_0x3f6605(0x1da),()=>_0x5296bd[_0x3f6605(0x1d2)][_0x3f6605(0x1ef)](_0xba3e54['parentId'],_0xba3e54[_0x3f6605(0x1be)],0x0,_0x3a3d66),{'verbose':_0x14f306['verbose']}),_0x245450=_0x2a0436[_0x3f6605(0x1d6)],_0x1c3230=_0x262154=>{const _0x3bf6b5=_0x3f6605;let _0x1ee23f=0x0,_0x303a83=0x0,_0x25e0ea=0x0;for(const _0x36e43c of _0x262154){if(_0x36e43c[_0x3bf6b5(0x1e4)]===_0x3bf6b5(0x1c3))_0x1ee23f++;else{if(_0x36e43c[_0x3bf6b5(0x1e4)]===_0x3bf6b5(0x1d2))_0x303a83++;else{if(_0x36e43c[_0x3bf6b5(0x1e4)]===_0x3bf6b5(0x1ce))_0x25e0ea++;}}if(_0x36e43c['children']){const _0x173542=_0x1c3230(_0x36e43c[_0x3bf6b5(0x1df)]);_0x1ee23f+=_0x173542[_0x3bf6b5(0x1bc)],_0x303a83+=_0x173542[_0x3bf6b5(0x1f8)],_0x25e0ea+=_0x173542[_0x3bf6b5(0x1dd)];}}return{'folders':_0x1ee23f,'segments':_0x303a83,'journeys':_0x25e0ea};},_0x40f973=_0x1c3230(_0x245450);console['error'](_0x3f6605(0x1f7)+_0x40f973[_0x3f6605(0x1bc)]+'\x20folder'+(_0x40f973['folders']!==0x1?'s':'')+',\x20'+_0x40f973[_0x3f6605(0x1f8)]+_0x3f6605(0x1d3)+(_0x40f973[_0x3f6605(0x1f8)]!==0x1?'s':'')+_0x3f6605(0x1ff)+_0x40f973['journeys']+_0x3f6605(0x1b8)+(_0x40f973['journeys']!==0x1?'s':''));const _0x2d48fd=_0x597313=>{const _0x1fb9fa=_0x3f6605;return getConsoleNextUrl(_0x14f306[_0x1fb9fa(0x1b6)],_0x1fb9fa(0x205)+_0xba3e54[_0x1fb9fa(0x1eb)]+_0x1fb9fa(0x1d5)+_0x597313);},_0x119c93=_0xfaa161=>{const _0x11986e=_0x3f6605;return getConsoleNextUrl(_0x14f306[_0x11986e(0x1b6)],_0x11986e(0x205)+_0xba3e54[_0x11986e(0x1eb)]+_0x11986e(0x1d5)+_0xfaa161+_0x11986e(0x1c0));};if(_0x14f306['format']===_0x3f6605(0x1d8)||_0x14f306[_0x3f6605(0x1d7)]===_0x3f6605(0x1fb))await handleSDKOutput(_0x245450,_0x14f306);else{console['log'](a46_0x51f9a0['dim']('['+_0xd9fc30+']'));const _0x962983=formatTree(_0x245450,{'showMetadata':!![],'getSegmentUrl':_0x2d48fd,'getJourneyUrl':_0x119c93});console[_0x3f6605(0x1c8)](_0x962983);}return 0x0;}}
|
package/dist/commands/show.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a47_0x171bdd=a47_0x3a29;function a47_0x183b(){const _0x1df223=['execute','\x20\x20Cause:\x20','Table:\x20','4984KJqCCu','Limit:\x20','185596IhLBid','limit','description','args','show','1XrmbtP','Querying\x20','\x20\x20\x20or:\x20tdx\x20show\x20<table>\x20--database\x20<database>','Site:\x20','Usage:\x20tdx\x20show\x20<database.table>','4767uytUsa','\x20\x20\x20or:\x20tdx\x20show\x20<catalog.database.table>','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','17137716OpGANN','2582013qxydbr','table','Catalog:\x20','18slFydi','Error:\x20','11UKyZNI','389785sFKwGQ','error','verbose','7238070HsFhwb','query','44IwbEFH','data','message','cause','✔\x20Query\x20successful\x20-\x200\x20rows\x20returned','showTable','...','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','length','database','catalog','\x20row','2556966FqqTQv'];a47_0x183b=function(){return _0x1df223;};return a47_0x183b();}(function(_0x49a9aa,_0x546166){const _0x225456=a47_0x3a29,_0x2e5891=_0x49a9aa();while(!![]){try{const _0x18ffbd=-parseInt(_0x225456(0x105))/0x1*(parseInt(_0x225456(0x12b))/0x2)+-parseInt(_0x225456(0x10e))/0x3+parseInt(_0x225456(0x119))/0x4*(parseInt(_0x225456(0x114))/0x5)+parseInt(_0x225456(0x125))/0x6+-parseInt(_0x225456(0x10a))/0x7*(-parseInt(_0x225456(0x129))/0x8)+parseInt(_0x225456(0x111))/0x9*(parseInt(_0x225456(0x117))/0xa)+parseInt(_0x225456(0x113))/0xb*(-parseInt(_0x225456(0x10d))/0xc);if(_0x18ffbd===_0x546166)break;else _0x2e5891['push'](_0x2e5891['shift']());}catch(_0x1c268d){_0x2e5891['push'](_0x2e5891['shift']());}}}(a47_0x183b,0xbcf41));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';function a47_0x3a29(_0x38c348,_0x38721f){_0x38c348=_0x38c348-0x103;const _0x183bc3=a47_0x183b();let _0x3a291f=_0x183bc3[_0x38c348];return _0x3a291f;}import{withSpinner}from'../utils/spinner.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';export class ShowCommand extends BaseCommand{['name']=a47_0x171bdd(0x104);[a47_0x171bdd(0x12d)]='Show\x20table\x20contents';async[a47_0x171bdd(0x126)](_0x56d51b){return this['showTable'](_0x56d51b);}async[a47_0x171bdd(0x11e)](_0x3fd67e){const _0x8fe834=a47_0x171bdd,{options:_0x29f34d,args:_0x1b945a,tdx:_0x57938a}=_0x3fd67e;let _0x7d9b1d;try{_0x7d9b1d=parseTableReference(_0x1b945a[0x0]);const _0x372d64=_0x29f34d[_0x8fe834(0x122)];!_0x7d9b1d['database']&&_0x372d64&&(_0x7d9b1d[_0x8fe834(0x122)]=_0x372d64);const _0x1c3fa5=validateTableDescribeReference(_0x7d9b1d);if(_0x1c3fa5)return console['error'](_0x8fe834(0x112)+_0x1c3fa5),console[_0x8fe834(0x115)](_0x8fe834(0x109)),console[_0x8fe834(0x115)]('\x20\x20\x20or:\x20tdx\x20show\x20<catalog.database.table>'),console[_0x8fe834(0x115)](_0x8fe834(0x107)),0x1;}catch(_0x192000){return console[_0x8fe834(0x115)]('Error:\x20'+_0x192000[_0x8fe834(0x11b)]),console[_0x8fe834(0x115)](_0x8fe834(0x109)),console[_0x8fe834(0x115)](_0x8fe834(0x10b)),console[_0x8fe834(0x115)](_0x8fe834(0x107)),0x1;}const _0x9ec495=_0x7d9b1d[_0x8fe834(0x123)],_0xbbe8fa=_0x7d9b1d['database'],_0x470049=_0x7d9b1d[_0x8fe834(0x10f)],_0x383eab=resolveLimit(_0x29f34d[_0x8fe834(0x12c)],DEFAULT_DISPLAY_LIMIT);try{_0x29f34d[_0x8fe834(0x116)]&&(console[_0x8fe834(0x115)](_0x8fe834(0x108)+_0x29f34d['site']),_0x9ec495&&console[_0x8fe834(0x115)](_0x8fe834(0x110)+_0x9ec495),console['error']('Database:\x20'+_0xbbe8fa),console[_0x8fe834(0x115)](_0x8fe834(0x128)+_0x470049),console[_0x8fe834(0x115)](_0x8fe834(0x12a)+_0x383eab));const _0x13e0dd=_0x9ec495?_0x9ec495+'.'+_0xbbe8fa+'.'+_0x470049:_0xbbe8fa+'.'+_0x470049,_0x418365=await withSpinner(_0x8fe834(0x106)+_0x13e0dd+_0x8fe834(0x11f),()=>_0x57938a[_0x8fe834(0x118)][_0x8fe834(0x11e)](_0xbbe8fa,_0x470049,_0x383eab,_0x9ec495),{'verbose':_0x29f34d[_0x8fe834(0x116)]}),_0xc32b18=_0x418365['data'],_0x236cc5=_0xc32b18[_0x8fe834(0x11a)];return _0x236cc5[_0x8fe834(0x121)]===0x0?console[_0x8fe834(0x115)](_0x8fe834(0x11d)):console['error']('✔\x20Retrieved\x20'+_0x236cc5[_0x8fe834(0x121)]+_0x8fe834(0x124)+(_0x236cc5['length']!==0x1?'s':'')+'\x20from\x20'+_0x13e0dd),await handleSDKOutput(_0x236cc5,_0x29f34d),0x0;}catch(_0x1db727){if(_0x1db727 instanceof SDKError)return console[_0x8fe834(0x115)](_0x8fe834(0x112)+_0x1db727[_0x8fe834(0x11b)]),_0x1db727[_0x8fe834(0x11c)]&&console[_0x8fe834(0x115)](_0x8fe834(0x127)+_0x1db727['cause']),0x1;throw _0x1db727;}}['validate'](_0x3a5320){const _0x5f478f=a47_0x171bdd;if(_0x3a5320['args'][_0x5f478f(0x121)]===0x0)return _0x5f478f(0x120);if(_0x3a5320[_0x5f478f(0x103)]['length']>0x1)return _0x5f478f(0x10c);return undefined;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a48_0x4c48ea=a48_0x418f;function a48_0x418f(_0x5f4da7,_0x55b350){_0x5f4da7=_0x5f4da7-0x1d5;const _0x4f1291=a48_0x4f12();let _0x418fbe=_0x4f1291[_0x5f4da7];return _0x418fbe;}(function(_0x43f108,_0x1d484d){const _0x5b96df=a48_0x418f,_0x45bbd6=_0x43f108();while(!![]){try{const _0x27d591=-parseInt(_0x5b96df(0x1d8))/0x1*(parseInt(_0x5b96df(0x1e7))/0x2)+parseInt(_0x5b96df(0x1f5))/0x3+-parseInt(_0x5b96df(0x1f9))/0x4+-parseInt(_0x5b96df(0x1eb))/0x5+parseInt(_0x5b96df(0x1ec))/0x6+parseInt(_0x5b96df(0x1de))/0x7+parseInt(_0x5b96df(0x1fa))/0x8;if(_0x27d591===_0x1d484d)break;else _0x45bbd6['push'](_0x45bbd6['shift']());}catch(_0x25b7ba){_0x45bbd6['push'](_0x45bbd6['shift']());}}}(a48_0x4f12,0x2bc57));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';import a48_0x4e336a from'chalk';function a48_0x4f12(){const _0x147252=['green','execute','error','config','session','dim','Credential\x20type:\x20','jobs','yellow','description','19922sNMEsP','first_name','TDX_PROFILE\x20env','Account\x20ID:','cli','\x20profile:\x20','1652560CUvLct','filter','message','User:','getUserInfo','log','cyan','No\x20credential\x20found','bold','14cdeyLd','Name:','site:\x20','N/A','1581160OjNFfz','1238472zkSoMJ','status','CLI\x20flag','red','tdx','✓\x20Authentication\x20successful\x0a','site','env','profile','390492shZsyW','Read\x20credential\x20from\x20','join','Show\x20authentication\x20status\x20and\x20current\x20context','133316zHRQDr','765168MrEhDh','account_id','last_name','displayWithSources'];a48_0x4f12=function(){return _0x147252;};return a48_0x4f12();}export class StatusCommand extends BaseCommand{['name']=a48_0x4c48ea(0x1ed);[a48_0x4c48ea(0x1d7)]=a48_0x4c48ea(0x1f8);async[a48_0x4c48ea(0x1ff)](_0x42c37e){const _0x5980b9=a48_0x4c48ea,{options:_0x15f2cf,tdx:_0x39fb63}=_0x42c37e,_0xa44aa=_0x15f2cf[_0x5980b9(0x1f2)],_0x4a1544=new GlobalContext(_0x15f2cf),_0x455904=_0x4a1544[_0x5980b9(0x1f4)],_0x25b7e5=_0x4a1544['profileSource'],_0x4989b9=_0x25b7e5===_0x5980b9(0x1dc)?_0x5980b9(0x1ee):_0x25b7e5===_0x5980b9(0x202)?_0x5980b9(0x202):_0x25b7e5===_0x5980b9(0x1f3)?_0x5980b9(0x1da):_0x25b7e5==='config'?_0x5980b9(0x201):null,_0x28b8e9=_0x455904?a48_0x4e336a[_0x5980b9(0x1e4)](_0x455904):a48_0x4e336a[_0x5980b9(0x203)](_0x5980b9(0x1ea)),_0x2f3f40=_0x4989b9?'\x20'+a48_0x4e336a[_0x5980b9(0x203)]('(from\x20'+_0x4989b9+')'):'';console['log'](a48_0x4e336a['bold'](_0x5980b9(0x1f0))+_0x5980b9(0x1dd)+_0x28b8e9+_0x2f3f40+'\x20'+a48_0x4e336a[_0x5980b9(0x203)]('(')+_0x5980b9(0x1e9)+a48_0x4e336a[_0x5980b9(0x1e4)](_0xa44aa)+a48_0x4e336a[_0x5980b9(0x203)](')'));const _0x53f8a8=await getOAuthTokens(_0x455904);if(_0x53f8a8)console[_0x5980b9(0x1e3)](_0x5980b9(0x204)+a48_0x4e336a[_0x5980b9(0x1e4)]('OAuth'));else{const _0x4821ac=await resolveAPIKeyAsync(_0xa44aa,_0x455904);if(_0x4821ac){const {source:_0x5bc8ec,isDeprecated:_0x52df23}=_0x4821ac,_0x2a0440=_0x5980b9(0x1f6)+a48_0x4e336a['cyan'](_0x5bc8ec);console[_0x5980b9(0x1e3)](_0x52df23?a48_0x4e336a[_0x5980b9(0x1d6)](_0x2a0440):_0x2a0440);}else console['log'](a48_0x4e336a['yellow'](_0x5980b9(0x1e5)));}let _0x1d5627=![];try{const _0x5ef456=await _0x39fb63[_0x5980b9(0x1d5)][_0x5980b9(0x1e2)]();console[_0x5980b9(0x1e3)](a48_0x4e336a[_0x5980b9(0x1fe)](_0x5980b9(0x1f1))),console[_0x5980b9(0x1e3)](a48_0x4e336a[_0x5980b9(0x1e6)](_0x5980b9(0x1e1))+'\x20'+a48_0x4e336a[_0x5980b9(0x1e4)](_0x5ef456['email']));if(_0x5ef456[_0x5980b9(0x1d9)]||_0x5ef456[_0x5980b9(0x1fc)]){const _0x37fa9b=[_0x5ef456[_0x5980b9(0x1d9)],_0x5ef456[_0x5980b9(0x1fc)]][_0x5980b9(0x1df)](Boolean)[_0x5980b9(0x1f7)]('\x20');console[_0x5980b9(0x1e3)](a48_0x4e336a[_0x5980b9(0x1e6)](_0x5980b9(0x1e8))+'\x20'+_0x37fa9b);}_0x5ef456[_0x5980b9(0x1fb)]&&console[_0x5980b9(0x1e3)](a48_0x4e336a[_0x5980b9(0x1e6)](_0x5980b9(0x1db))+'\x20'+a48_0x4e336a[_0x5980b9(0x1d6)](_0x5ef456[_0x5980b9(0x1fb)])),_0x1d5627=!![];}catch(_0x1f4701){_0x1f4701 instanceof HTTPClientError&&_0x1f4701[_0x5980b9(0x1ed)]===0x191?printAuthError(_0x1f4701,!![],_0x455904):console[_0x5980b9(0x200)](a48_0x4e336a[_0x5980b9(0x1ef)]('✗\x20Validation\x20failed:\x20'+(_0x1f4701 instanceof Error?_0x1f4701[_0x5980b9(0x1e0)]:String(_0x1f4701))));}return console[_0x5980b9(0x1e3)](),_0x4a1544[_0x5980b9(0x1fd)](),_0x1d5627?0x0:0x1;}}
|