@treasuredata/tdx 0.10.1 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +2 -2
- package/dist/cli-categories.js +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/context-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-proxy.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.d.ts +73 -3
- package/dist/commands/workflow-command.d.ts.map +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/commands/workflow-command.js.map +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.d.ts +1 -1
- package/dist/core/command-output.d.ts.map +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.d.ts +1 -0
- package/dist/core/global-context.d.ts.map +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/global-context.js.map +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.d.ts +1 -0
- package/dist/core/session.d.ts.map +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/session.js.map +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/index.js +1 -1
- package/dist/proxy/anthropic-adapter.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/context-signature.js +1 -1
- package/dist/proxy/conversation-utils.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/sdk/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/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.d.ts +32 -4
- package/dist/sdk/client/workflow-client.d.ts.map +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/client/workflow-client.js.map +1 -1
- package/dist/sdk/connection-validator.d.ts +10 -6
- package/dist/sdk/connection-validator.d.ts.map +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection-validator.js.map +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.d.ts +2 -0
- package/dist/sdk/errors.d.ts.map +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/errors.js.map +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-aliases.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.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-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.d.ts +1 -0
- package/dist/sdk/types/index.d.ts.map +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/index.js.map +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/index.d.ts +74 -4
- package/dist/sdk/workflow/index.d.ts.map +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/index.js.map +1 -1
- package/dist/sdk/workflow/workflow-utils.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/json-loader.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a24_0x53d713=a24_0x1c6b;(function(_0x5aa665,_0x4fc59b){const _0x2850d0=a24_0x1c6b,_0x367a28=_0x5aa665();while(!![]){try{const _0x3744e6=-parseInt(_0x2850d0(0x1ba))/0x1*(parseInt(_0x2850d0(0x1be))/0x2)+-parseInt(_0x2850d0(0x1e3))/0x3*(parseInt(_0x2850d0(0x1df))/0x4)+-parseInt(_0x2850d0(0x1e7))/0x5+parseInt(_0x2850d0(0x1c1))/0x6*(parseInt(_0x2850d0(0x1c8))/0x7)+parseInt(_0x2850d0(0x1e5))/0x8+-parseInt(_0x2850d0(0x1d8))/0x9*(-parseInt(_0x2850d0(0x1db))/0xa)+-parseInt(_0x2850d0(0x1d3))/0xb;if(_0x3744e6===_0x4fc59b)break;else _0x367a28['push'](_0x367a28['shift']());}catch(_0x19132a){_0x367a28['push'](_0x367a28['shift']());}}}(a24_0x2279,0xe0fba));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a24_0x53d713(0x1e0)]=a24_0x53d713(0x1b9);[a24_0x53d713(0x1d1)]=a24_0x53d713(0x1c6);async['execute'](_0x3c2501){const _0x4d39d1=a24_0x53d713,{options:_0x61224d,args:_0x163b09,tdx:_0x196be8}=_0x3c2501,_0x838f71=_0x163b09[0x0],_0x40d690=_0x61224d[_0x4d39d1(0x1cb)];let _0x19fe98;try{if(_0x40d690)_0x19fe98=readSqlStatementsFromFile(_0x40d690);else{if(_0x838f71==='-')_0x19fe98=await readSqlStatementsFromStdin();else{if(_0x838f71&&isSqlFilePath(_0x838f71))_0x19fe98=readSqlStatementsFromFile(_0x838f71);else{if(_0x838f71)_0x19fe98=splitSqlStatements(_0x838f71);else throw new Error(_0x4d39d1(0x1e9));}}}}catch(_0x2d7a9d){return console[_0x4d39d1(0x1dd)](_0x4d39d1(0x1e4)+_0x2d7a9d[_0x4d39d1(0x1d5)]),0x1;}const _0x20a162=_0x61224d[_0x4d39d1(0x1bd)]||_0x4d39d1(0x1d9),_0x547ebe=_0x61224d[_0x4d39d1(0x1cf)];try{const _0x3ca96f=[],_0x2a8081=!!_0x61224d[_0x4d39d1(0x1d0)];for(let _0x2d11b8=0x0;_0x2d11b8<_0x19fe98[_0x4d39d1(0x1dc)];_0x2d11b8++){const _0x4e35e9=_0x19fe98[_0x2d11b8],_0x5bc4d3=_0x2d11b8+0x1,_0x31951d=_0x19fe98[_0x4d39d1(0x1dc)],_0x1bb64a=_0x31951d>0x1;_0x61224d['verbose']&&(console[_0x4d39d1(0x1dd)]('\x0a'+(_0x1bb64a?'Statement\x20'+_0x5bc4d3+'/'+_0x31951d+':':'')),console['error']('Site:\x20'+_0x61224d['site']),console[_0x4d39d1(0x1dd)]('Catalog:\x20'+(_0x547ebe||'td')),console[_0x4d39d1(0x1dd)](_0x4d39d1(0x1bb)+_0x20a162),console[_0x4d39d1(0x1dd)](_0x4d39d1(0x1cc)+_0x4e35e9));const _0x26259d=_0x1bb64a?_0x4d39d1(0x1c4)+_0x5bc4d3+'/'+_0x31951d+_0x4d39d1(0x1d7):_0x4d39d1(0x1ca);try{const _0x455113=await withProgressSpinner(_0x26259d,async _0x15a3bb=>{const _0xa3bd1d=_0x4d39d1,_0xc67de4=await _0x196be8[_0xa3bd1d(0x1b9)][_0xa3bd1d(0x1bc)](_0x4e35e9,{'catalog':_0x547ebe,'schema':_0x20a162,'onJobId':_0x4f1010=>{_0x15a3bb['setJobId'](_0x4f1010);},'onProgress':_0x2cfe02=>{const _0x158b41=_0xa3bd1d;_0x15a3bb[_0x158b41(0x1e2)](_0x158b41(0x1c5)+_0x2cfe02[_0x158b41(0x1e6)]+']'),_0x15a3bb[_0x158b41(0x1c7)](formatRows(_0x2cfe02[_0x158b41(0x1c2)])+_0x158b41(0x1cd)+_0x2cfe02[_0x158b41(0x1ea)]+'/'+_0x2cfe02['totalSplits']+_0x158b41(0x1c0));}});return _0xc67de4;},{'verbose':_0x61224d['verbose']}),_0x3ca766=_0x455113['data'],_0x5cc79b=_0x3ca766[_0x4d39d1(0x1c9)]?'\x20[Job\x20ID:\x20'+_0x3ca766[_0x4d39d1(0x1c9)]+']':'',_0x5e314d=_0x1bb64a?_0x4d39d1(0x1d6)+_0x5bc4d3+'/'+_0x31951d+_0x4d39d1(0x1ce):'';console[_0x4d39d1(0x1dd)]('✔\x20'+_0x5e314d+_0x4d39d1(0x1da)+formatRows(_0x3ca766[_0x4d39d1(0x1e1)][_0x4d39d1(0x1c2)])+_0x4d39d1(0x1cd)+('in\x20'+formatElapsed(_0x3ca766[_0x4d39d1(0x1e1)]['elapsedTimeMillis'])+_0x5cc79b));if(_0x1bb64a&&_0x2a8081){const _0x2012aa=resolveOutputOptions(_0x61224d),_0x5c437b=await formatQueryOutput(_0x3ca766,_0x2012aa);_0x3ca96f[_0x4d39d1(0x1bf)](_0x5c437b);}else await handleQueryOutput(_0x3ca766,_0x61224d);}catch(_0x440ec9){const _0x5db097=_0x1bb64a?_0x4d39d1(0x1d6)+_0x5bc4d3+'/'+_0x31951d+':\x0a':'',_0x460782=_0x440ec9 instanceof SDKError?_0x440ec9[_0x4d39d1(0x1e8)]:_0x440ec9[_0x4d39d1(0x1d5)];return console['error'](''+_0x5db097+_0x460782),0x1;}}if(_0x19fe98['length']>0x1&&_0x2a8081&&_0x3ca96f[_0x4d39d1(0x1dc)]>0x0){const _0x11ef1f=_0x3ca96f['join']('\x0a');writeFileSync(_0x61224d[_0x4d39d1(0x1d0)],_0x11ef1f),console['error'](_0x4d39d1(0x1b8)+_0x61224d['output']);}return 0x0;}catch(_0x41e0e2){throw _0x41e0e2;}}[a24_0x53d713(0x1d4)](_0x31d3dc){const _0x322d30=a24_0x53d713,_0x4a18d8=_0x31d3dc[_0x322d30(0x1c3)][0x0],_0x58dbf4=_0x31d3dc[_0x322d30(0x1de)][_0x322d30(0x1cb)];if(!_0x4a18d8&&!_0x58dbf4)return'Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options';if(_0x4a18d8&&_0x58dbf4)return _0x322d30(0x1d2);return undefined;}}function a24_0x1c6b(_0xde9bc2,_0x30b255){_0xde9bc2=_0xde9bc2-0x1b8;const _0x2279ef=a24_0x2279();let _0x1c6bf5=_0x2279ef[_0xde9bc2];return _0x1c6bf5;}function a24_0x2279(){const _0x183d5c=['\x0aAll\x20results\x20saved\x20to\x20','query','10540gLWwdC','Schema:\x20','execute','database','8zaojLh','push','\x20splits','9022326LVcNcZ','processedRows','args','Executing\x20statement\x20','Executing\x20query\x20[','Run\x20Trino\x20queries\x20(streaming)','setExtra','7smlQZp','jobId','Executing\x20query...','file','SQL:\x20','\x20rows\x20','\x20-\x20','catalog','output','description','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','13206193zAiNBk','validate','message','Statement\x20','...','1807479PQRhrD','information_schema','Query\x20completed:\x20Processed\x20','40alNuBQ','length','error','options','12CPdehL','name','stats','setPhase','1024317QdxzWO','Error:\x20','12165632bLwaws','state','3195895HbWbWj','originalMessage','No\x20SQL\x20provided','completedSplits'];a24_0x2279=function(){return _0x183d5c;};return a24_0x2279();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a25_0x5180b4=a25_0x4f40;(function(_0x257f4c,_0x4bccf6){const _0x842cd8=a25_0x4f40,_0x579b7b=_0x257f4c();while(!![]){try{const _0x47dd8d=parseInt(_0x842cd8(0x15c))/0x1+parseInt(_0x842cd8(0x17e))/0x2+parseInt(_0x842cd8(0x14c))/0x3+parseInt(_0x842cd8(0x17a))/0x4*(parseInt(_0x842cd8(0x193))/0x5)+-parseInt(_0x842cd8(0x13d))/0x6+parseInt(_0x842cd8(0x19b))/0x7+parseInt(_0x842cd8(0x168))/0x8*(-parseInt(_0x842cd8(0x14d))/0x9);if(_0x47dd8d===_0x4bccf6)break;else _0x579b7b['push'](_0x579b7b['shift']());}catch(_0x326512){_0x579b7b['push'](_0x579b7b['shift']());}}}(a25_0x1fa1,0xe2b86));import{BaseCommand}from'./command.js';function a25_0x1fa1(){const _0x29a738=['jobId','folderId','Usage:\x20tdx\x20sg\x20desc\x20<name>','Create\x20segment\x20folder\x20for\x20organization','21712392bWxIYa','✔\x20Created\x20folder\x20\x27','Show\x20folder\x20or\x20child\x20segment\x20details','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','json','\x20\x20Segment\x20name:\x20','Resolving\x20parent\x20segment\x20\x27','SELECT\x20*\x20FROM\x20(\x0a','Parent\x20ID:\x20','Fetching\x20parent\x20segment\x20details...','segmentId','parentId','parentSegment','Resolved\x20relative\x20path\x20to:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','execute','getSegmentSQL','68756yHEFFM','fullPath','log','Fetching\x20folder\x20\x27','151964zmiqZG','Usage:\x20tdx\x20sg\x20show\x20<name>','site','Resolving\x20\x27','Resolved\x20YAML\x20file:\x20','message','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','description','Fetching\x20SQL\x20for\x20segment...','Parent\x20name:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','trim','(root)','\x20\x20Cause:\x20','folder','\x20Opening\x20','getFolder','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','toLocaleString','✔\x20Found\x20','245fSvwxz','getParent','Use:\x20tdx\x20ps\x20view','segment:desc','segmentName','/e/','Fetching\x20segment\x20details...','Target\x20path:\x20','7930062nkPTBf','segmentPath','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','Examples:','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Folder\x20ID:\x20','Options:','/app/ps/','Site:\x20','Use:\x20tdx\x20ps\x20sql','parentFolder','error','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','code','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','cause','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','Error:\x20Path\x20or\x20name\x20is\x20required','getSegment','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Show\x20child\x20segment\x20schema\x20(column\x20types)','resolveParentId','\x20[Job\x20ID:\x20','Usage:\x20tdx\x20sg\x20sql\x20<name>','Resolving\x20path\x20\x27','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','verbose','\x27\x20with\x20ID:\x20','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','parent','format','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','name','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Fetching\x20folder\x20details...','includes','web','Resolved\x20folder\x20ID:\x20','Segment\x20ID:\x20','folderPath','segment','information_schema','Creating\x20folder\x20\x27','Resolved\x20type:\x20','data','INVALID_ARGUMENT','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','✖\x20Query\x20failed\x20[','resolvePathToResource','listFolders','Use:\x20tdx\x20ps\x20show','cyan','Show\x20segment\x20or\x20folder\x20details','type','Get\x20SQL\x20query\x20for\x20child\x20segment','\x20\x20Parent\x20segment:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','2920902nmeHYQ','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20','SEGMENT_NOT_FOUND','resolveFolderId','Folder\x20ID\x20missing\x20from\x20resolved\x20path','segment:sql','query','\x27...','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','SEGMENT_FOLDER_NOT_FOUND','Executing\x20segment\x20query...','✔\x20Query\x20completed:\x20Processed\x20','setJobId','replace','4590645AgXvyo','9kgkFra','test','\x20\x20Folder\x20path:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','stats','Resolved\x20parent\x20ID:\x20','segment:folder:create','\x20folder','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','limit','Use:\x20tdx\x20ps\x20view\x20-w','segment:view','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','length','548188ukjXoc','Folder\x20name:\x20','segment:folder:list','Listing\x20folders\x20for\x20parent\x20\x27','\x20rows\x20','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'];a25_0x1fa1=function(){return _0x29a738;};return a25_0x1fa1();}import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';function a25_0x4f40(_0xfa9d06,_0x44220f){_0xfa9d06=_0xfa9d06-0x13d;const _0x1fa1b4=a25_0x1fa1();let _0x4f4063=_0x1fa1b4[_0xfa9d06];return _0x4f4063;}import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a25_0x2ed445 from'chalk';async function resolveSegmentTarget(_0x30ea65,_0x36c767,_0x315dbc){const _0x3aa182=a25_0x4f40;if(isYamlFilePath(_0x30ea65))try{const _0x4ff15b=await resolveYamlFilePath(_0x30ea65);return _0x315dbc&&(console[_0x3aa182(0x1a8)](_0x3aa182(0x182)+_0x30ea65),console[_0x3aa182(0x1a8)](_0x3aa182(0x1d8)+_0x4ff15b[_0x3aa182(0x174)]),console[_0x3aa182(0x1a8)](_0x3aa182(0x16d)+_0x4ff15b[_0x3aa182(0x197)]),console[_0x3aa182(0x1a8)](_0x3aa182(0x14f)+(_0x4ff15b[_0x3aa182(0x1c8)]||_0x3aa182(0x18a))),console['error']('\x20\x20Full\x20path:\x20'+_0x4ff15b[_0x3aa182(0x17b)])),_0x4ff15b['fullPath'];}catch(_0x41ae52){throw new SDKError(ErrorCode[_0x3aa182(0x1ce)],_0x3aa182(0x1b9)+_0x41ae52[_0x3aa182(0x183)]);}if(!_0x36c767)throw new SDKError(ErrorCode[_0x3aa182(0x1ce)],_0x3aa182(0x18f));return _0x36c767+'/'+_0x30ea65;}export class SegmentDescribeCommand extends BaseCommand{['name']='segment:describe';[a25_0x5180b4(0x185)]=a25_0x5180b4(0x1d5);async[a25_0x5180b4(0x178)](_0x2b949f){const _0xbef1dd=a25_0x5180b4,{options:_0x29d9c7,args:_0xba7235,tdx:_0x4739f4}=_0x2b949f,_0x49f752=_0xba7235[0x0],_0xa03e9=!_0x49f752&&!!_0x29d9c7[_0xbef1dd(0x174)],_0x4e374c=_0x49f752||_0x29d9c7[_0xbef1dd(0x174)];if(!_0x4e374c)return console[_0xbef1dd(0x1a8)](_0xbef1dd(0x1b0)),console[_0xbef1dd(0x1a8)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0xbef1dd(0x1a8)](_0xbef1dd(0x19f)),console[_0xbef1dd(0x1a8)](_0xbef1dd(0x1a0)),console[_0xbef1dd(0x1a8)](_0xbef1dd(0x161)),console[_0xbef1dd(0x1a8)]('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console['error']('\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'),0x1;try{const _0x1c0ebf=_0x29d9c7[_0xbef1dd(0x19c)];let _0x1260ab=_0x4e374c;!_0xa03e9&&_0x1c0ebf&&!_0x4e374c[_0xbef1dd(0x1c4)]('/')&&(_0x1260ab=_0x1c0ebf+'/'+_0x4e374c,_0x29d9c7[_0xbef1dd(0x1ba)]&&console[_0xbef1dd(0x1a8)](_0xbef1dd(0x175)+_0x1260ab));const _0x1d6ced=await withSpinner(_0xbef1dd(0x1b8)+_0x1260ab+_0xbef1dd(0x145),()=>_0x4739f4['segment'][_0xbef1dd(0x1d1)](_0x1260ab),{'verbose':_0x29d9c7[_0xbef1dd(0x1ba)]}),_0x138e08=_0x1d6ced[_0xbef1dd(0x1cd)];_0x29d9c7[_0xbef1dd(0x1ba)]&&(console[_0xbef1dd(0x1a8)](_0xbef1dd(0x1cc)+_0x138e08[_0xbef1dd(0x1d6)]),console[_0xbef1dd(0x1a8)](_0xbef1dd(0x170)+_0x138e08['parentId']),_0x138e08['folderId']&&console['error'](_0xbef1dd(0x1a2)+_0x138e08[_0xbef1dd(0x165)]),_0x138e08[_0xbef1dd(0x172)]&&console[_0xbef1dd(0x1a8)](_0xbef1dd(0x1c7)+_0x138e08[_0xbef1dd(0x172)]));if(_0x138e08[_0xbef1dd(0x1d6)]===_0xbef1dd(0x1bd)){const _0x59cf5d=await withSpinner(_0xbef1dd(0x171),()=>_0x4739f4[_0xbef1dd(0x1c9)][_0xbef1dd(0x194)](_0x138e08[_0xbef1dd(0x173)]),{'verbose':_0x29d9c7['verbose']});await handleSingleObjectOutput(_0x59cf5d[_0xbef1dd(0x1cd)],_0x29d9c7);}else{if(_0x138e08[_0xbef1dd(0x1d6)]===_0xbef1dd(0x18c)){if(!_0x138e08['folderId'])throw new SDKError(ErrorCode[_0xbef1dd(0x147)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x375a1c=await withSpinner(_0xbef1dd(0x1c3),()=>_0x4739f4[_0xbef1dd(0x1c9)][_0xbef1dd(0x18e)](_0x138e08[_0xbef1dd(0x165)]),{'verbose':_0x29d9c7[_0xbef1dd(0x1ba)]});await handleSingleObjectOutput(_0x375a1c[_0xbef1dd(0x1cd)],_0x29d9c7);}else{if(_0x138e08['type']===_0xbef1dd(0x1c9)){if(!_0x138e08[_0xbef1dd(0x172)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0xbef1dd(0x13e));const _0x3a3228=await withSpinner('Fetching\x20segment\x20details...',()=>_0x4739f4[_0xbef1dd(0x1c9)]['getSegment'](_0x138e08[_0xbef1dd(0x173)],_0x138e08[_0xbef1dd(0x172)]),{'verbose':_0x29d9c7[_0xbef1dd(0x1ba)]});await handleSingleObjectOutput(_0x3a3228[_0xbef1dd(0x1cd)],_0x29d9c7);}}}return 0x0;}catch(_0x53eff7){if(_0x53eff7 instanceof SDKError)return console['error'](_0xbef1dd(0x13f)+_0x53eff7[_0xbef1dd(0x183)]),_0x53eff7[_0xbef1dd(0x1ae)]&&console[_0xbef1dd(0x1a8)](_0xbef1dd(0x18b)+_0x53eff7[_0xbef1dd(0x1ae)]),0x1;throw _0x53eff7;}}}export class SegmentShowCommand extends BaseCommand{[a25_0x5180b4(0x1c0)]='segment:show';['description']=a25_0x5180b4(0x16b);async['execute'](_0x469ed7){const _0x4f7b78=a25_0x5180b4,{options:_0x39400d,args:_0x2eb616,tdx:_0xcb60ad}=_0x469ed7,_0x3701ec=_0x2eb616[0x0];if(!_0x3701ec)return console[_0x4f7b78(0x1a8)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x4f7b78(0x1a8)](_0x4f7b78(0x17f)),console[_0x4f7b78(0x1a8)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x4f7b78(0x1a8)](_0x4f7b78(0x19f)),console[_0x4f7b78(0x1a8)](_0x4f7b78(0x146)),console[_0x4f7b78(0x1a8)](_0x4f7b78(0x1b3)),0x1;try{const _0x7edf42=_0x39400d[_0x4f7b78(0x174)],_0x4ac3f5=await resolveSegmentTarget(_0x3701ec,_0x7edf42,_0x39400d[_0x4f7b78(0x1ba)]);_0x39400d[_0x4f7b78(0x1ba)]&&console[_0x4f7b78(0x1a8)](_0x4f7b78(0x19a)+_0x4ac3f5);const _0x3106d0=await withSpinner(_0x4f7b78(0x181)+_0x3701ec+_0x4f7b78(0x145),()=>_0xcb60ad[_0x4f7b78(0x1c9)]['resolvePathToResource'](_0x4ac3f5),{'verbose':_0x39400d[_0x4f7b78(0x1ba)]}),_0x5b038e=_0x3106d0[_0x4f7b78(0x1cd)];_0x39400d[_0x4f7b78(0x1ba)]&&(console[_0x4f7b78(0x1a8)](_0x4f7b78(0x1cc)+_0x5b038e['type']),console[_0x4f7b78(0x1a8)](_0x4f7b78(0x170)+_0x5b038e[_0x4f7b78(0x173)]));if(_0x5b038e[_0x4f7b78(0x1d6)]==='folder')return console['error'](_0x4f7b78(0x1c1)),console[_0x4f7b78(0x1a8)](_0x4f7b78(0x1bf)),0x1;if(_0x5b038e['type']===_0x4f7b78(0x1bd))return console['error']('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x4f7b78(0x1a8)](_0x4f7b78(0x1d3)),0x1;if(!_0x5b038e[_0x4f7b78(0x172)])throw new SDKError(ErrorCode[_0x4f7b78(0x140)],_0x4f7b78(0x13e));const _0x4bf4d0=await withSpinner(_0x4f7b78(0x186),()=>_0xcb60ad[_0x4f7b78(0x1c9)][_0x4f7b78(0x179)](_0x5b038e[_0x4f7b78(0x173)],_0x5b038e[_0x4f7b78(0x172)]),{'verbose':_0x39400d[_0x4f7b78(0x1ba)]});let _0x59ed88=_0x4bf4d0[_0x4f7b78(0x1cd)];const _0xf04482=resolveLimit(_0x39400d[_0x4f7b78(0x157)],DEFAULT_DISPLAY_LIMIT),_0xc27511=/\bLIMIT\s+\d+/i[_0x4f7b78(0x14e)](_0x59ed88);!_0xc27511&&(_0x59ed88=_0x59ed88[_0x4f7b78(0x189)]()[_0x4f7b78(0x14b)](/;+$/,''),_0x59ed88=_0x4f7b78(0x16f)+_0x59ed88+_0x4f7b78(0x1d9)+_0xf04482);_0x39400d[_0x4f7b78(0x1ba)]&&console['error']('SQL\x20query:\x0a'+_0x59ed88);const _0x1c3019=await withProgressSpinner(_0x4f7b78(0x148),async _0x2c0caf=>{const _0x55d22f=_0x4f7b78,_0x3f4ac4=await _0xcb60ad[_0x55d22f(0x144)][_0x55d22f(0x178)](_0x59ed88,{'catalog':'td','schema':_0x55d22f(0x1ca),'onJobId':_0x14cc21=>{const _0x349cf2=_0x55d22f;_0x2c0caf[_0x349cf2(0x14a)](_0x14cc21);}});return _0x3f4ac4;},{'verbose':_0x39400d[_0x4f7b78(0x1ba)]}),_0x254300=_0x1c3019[_0x4f7b78(0x1cd)],_0x151bce=_0x254300[_0x4f7b78(0x164)]?_0x4f7b78(0x1b6)+_0x254300[_0x4f7b78(0x164)]+']':'';return console[_0x4f7b78(0x1a8)](_0x4f7b78(0x149)+_0x254300['stats']['processedRows'][_0x4f7b78(0x191)]()+_0x4f7b78(0x160)+('in\x20'+formatElapsed(_0x254300[_0x4f7b78(0x152)]['elapsedTimeMillis'])+_0x151bce)),await handleQueryOutput(_0x254300,_0x39400d),0x0;}catch(_0x44e1c1){if(_0x44e1c1 instanceof SDKError)return console['error'](_0x4f7b78(0x1d0)+_0x44e1c1[_0x4f7b78(0x1ab)]+']'),console[_0x4f7b78(0x1a8)]('\x0a'+_0x44e1c1[_0x4f7b78(0x183)]),0x1;throw _0x44e1c1;}}}export class SegmentFolderListCommand extends BaseCommand{[a25_0x5180b4(0x1c0)]=a25_0x5180b4(0x15e);[a25_0x5180b4(0x185)]=a25_0x5180b4(0x1cf);async[a25_0x5180b4(0x178)](_0x2a6105){const _0x43afea=a25_0x5180b4,{options:_0x52b0d4,args:_0x5f3a6d,tdx:_0x3e0e25}=_0x2a6105;if(_0x5f3a6d['length']===0x0)return console[_0x43afea(0x1a8)](_0x43afea(0x1b2)),console['error'](_0x43afea(0x163)),0x1;const _0x502ea1=_0x5f3a6d[0x0];try{_0x52b0d4[_0x43afea(0x1ba)]&&(console[_0x43afea(0x1a8)](_0x43afea(0x1a5)+_0x52b0d4[_0x43afea(0x180)]),console['error'](_0x43afea(0x187)+_0x502ea1));const _0x5d71d3=await withSpinner(_0x43afea(0x16e)+_0x502ea1+_0x43afea(0x145),()=>_0x3e0e25[_0x43afea(0x1c9)][_0x43afea(0x1b5)](_0x502ea1),{'verbose':_0x52b0d4[_0x43afea(0x1ba)]}),_0x36986f=_0x5d71d3['data'];_0x52b0d4[_0x43afea(0x1ba)]&&console[_0x43afea(0x1a8)]('Resolved\x20parent\x20ID:\x20'+_0x36986f);const _0x2aac5b=await withSpinner(_0x43afea(0x15f)+_0x502ea1+'\x27...',()=>_0x3e0e25[_0x43afea(0x1c9)][_0x43afea(0x1d2)](_0x36986f),{'verbose':_0x52b0d4[_0x43afea(0x1ba)]}),_0x56df77=_0x2aac5b[_0x43afea(0x1cd)];return console[_0x43afea(0x1a8)](_0x43afea(0x192)+_0x56df77[_0x43afea(0x15b)]+_0x43afea(0x155)+(_0x56df77[_0x43afea(0x15b)]!==0x1?'s':'')),await handleSDKOutput(_0x56df77,_0x52b0d4),0x0;}catch(_0x3a8291){if(_0x3a8291 instanceof SDKError)return console[_0x43afea(0x1a8)](_0x43afea(0x13f)+_0x3a8291[_0x43afea(0x183)]),_0x3a8291['cause']&&console['error'](_0x43afea(0x18b)+_0x3a8291[_0x43afea(0x1ae)]),0x1;throw _0x3a8291;}}}export class SegmentFolderShowCommand extends BaseCommand{[a25_0x5180b4(0x1c0)]='segment:folder:show';[a25_0x5180b4(0x185)]='Show\x20segment\x20folder\x20details';async[a25_0x5180b4(0x178)](_0x1f2602){const _0x1b41b7=a25_0x5180b4,{options:_0x312e3f,args:_0x354abb,tdx:_0x373fa3}=_0x1f2602;if(_0x354abb[_0x1b41b7(0x15b)]===0x0)return console[_0x1b41b7(0x1a8)]('Error:\x20Folder\x20reference\x20is\x20required'),console[_0x1b41b7(0x1a8)](_0x1b41b7(0x156)),0x1;try{const {parentId:_0x5100e6,childId:_0x158a7c}=parseSegmentRef(_0x354abb[0x0]);_0x312e3f['verbose']&&(console[_0x1b41b7(0x1a8)](_0x1b41b7(0x1a5)+_0x312e3f['site']),console['error'](_0x1b41b7(0x187)+_0x5100e6),_0x158a7c&&console[_0x1b41b7(0x1a8)](_0x1b41b7(0x15d)+_0x158a7c));if(!_0x158a7c)return console['error']('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x747c04=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5100e6+_0x1b41b7(0x145),()=>_0x373fa3[_0x1b41b7(0x1c9)]['resolveParentId'](_0x5100e6),{'verbose':_0x312e3f[_0x1b41b7(0x1ba)]}),_0x57ba1f=_0x747c04[_0x1b41b7(0x1cd)];_0x312e3f[_0x1b41b7(0x1ba)]&&console[_0x1b41b7(0x1a8)](_0x1b41b7(0x153)+_0x57ba1f);const _0x36a904=await withSpinner('Resolving\x20folder\x20\x27'+_0x158a7c+_0x1b41b7(0x145),()=>_0x373fa3['segment'][_0x1b41b7(0x141)](_0x57ba1f,_0x158a7c),{'verbose':_0x312e3f['verbose']}),_0x165b21=_0x36a904[_0x1b41b7(0x1cd)];_0x312e3f[_0x1b41b7(0x1ba)]&&console['error'](_0x1b41b7(0x1c6)+_0x165b21);const _0x3bf19d=await withSpinner(_0x1b41b7(0x17d)+_0x158a7c+_0x1b41b7(0x145),()=>_0x373fa3[_0x1b41b7(0x1c9)]['getFolder'](_0x165b21),{'verbose':_0x312e3f['verbose']});return await handleSDKOutput([_0x3bf19d[_0x1b41b7(0x1cd)]],_0x312e3f),0x0;}catch(_0x3ef871){if(_0x3ef871 instanceof SDKError)return console[_0x1b41b7(0x1a8)](_0x1b41b7(0x13f)+_0x3ef871[_0x1b41b7(0x183)]),_0x3ef871[_0x1b41b7(0x1ae)]&&console[_0x1b41b7(0x1a8)](_0x1b41b7(0x18b)+_0x3ef871[_0x1b41b7(0x1ae)]),0x1;throw _0x3ef871;}}}export class SegmentSQLCommand extends BaseCommand{[a25_0x5180b4(0x1c0)]=a25_0x5180b4(0x143);[a25_0x5180b4(0x185)]=a25_0x5180b4(0x1d7);async[a25_0x5180b4(0x178)](_0x1a25ac){const _0x56ebab=a25_0x5180b4,{options:_0x99bb95,args:_0x38a133,tdx:_0x3b944d}=_0x1a25ac,_0x5d6ee0=_0x38a133[0x0];if(!_0x5d6ee0)return console[_0x56ebab(0x1a8)](_0x56ebab(0x1aa)),console['error'](_0x56ebab(0x1b7)),console[_0x56ebab(0x1a8)](_0x56ebab(0x1af)),console[_0x56ebab(0x1a8)](_0x56ebab(0x19f)),console[_0x56ebab(0x1a8)](_0x56ebab(0x15a)),console[_0x56ebab(0x1a8)](_0x56ebab(0x19e)),0x1;try{const _0x150f0d=_0x99bb95[_0x56ebab(0x174)],_0x57b2b7=await resolveSegmentTarget(_0x5d6ee0,_0x150f0d,_0x99bb95[_0x56ebab(0x1ba)]);_0x99bb95[_0x56ebab(0x1ba)]&&console[_0x56ebab(0x1a8)]('Target\x20path:\x20'+_0x57b2b7);const _0x6079cd=await withSpinner('Resolving\x20\x27'+_0x5d6ee0+_0x56ebab(0x145),()=>_0x3b944d[_0x56ebab(0x1c9)][_0x56ebab(0x1d1)](_0x57b2b7),{'verbose':_0x99bb95[_0x56ebab(0x1ba)]}),_0x1a879b=_0x6079cd[_0x56ebab(0x1cd)];_0x99bb95['verbose']&&(console['error'](_0x56ebab(0x1cc)+_0x1a879b[_0x56ebab(0x1d6)]),console[_0x56ebab(0x1a8)]('Parent\x20ID:\x20'+_0x1a879b[_0x56ebab(0x173)]));if(_0x1a879b[_0x56ebab(0x1d6)]===_0x56ebab(0x18c))return console['error'](_0x56ebab(0x184)),console[_0x56ebab(0x1a8)](_0x56ebab(0x19d)),0x1;if(_0x1a879b[_0x56ebab(0x1d6)]===_0x56ebab(0x1bd))return console[_0x56ebab(0x1a8)](_0x56ebab(0x190)),console['error'](_0x56ebab(0x1a6)),0x1;if(!_0x1a879b[_0x56ebab(0x172)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x56ebab(0x13e));const _0x22de17=await withSpinner(_0x56ebab(0x186),()=>_0x3b944d['segment'][_0x56ebab(0x179)](_0x1a879b[_0x56ebab(0x173)],_0x1a879b[_0x56ebab(0x172)]),{'verbose':_0x99bb95[_0x56ebab(0x1ba)]}),_0x1df827=_0x22de17[_0x56ebab(0x1cd)];return _0x99bb95[_0x56ebab(0x1be)]===_0x56ebab(0x16c)||_0x99bb95['format']==='jsonl'?await handleSDKOutput([{'sql':_0x1df827}],_0x99bb95):console[_0x56ebab(0x17c)](_0x1df827),0x0;}catch(_0xcd5a70){if(_0xcd5a70 instanceof SDKError)return console[_0x56ebab(0x1a8)](_0x56ebab(0x13f)+_0xcd5a70[_0x56ebab(0x183)]),_0xcd5a70['cause']&&console[_0x56ebab(0x1a8)](_0x56ebab(0x18b)+_0xcd5a70['cause']),0x1;throw _0xcd5a70;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a25_0x5180b4(0x1c0)]=a25_0x5180b4(0x154);[a25_0x5180b4(0x185)]=a25_0x5180b4(0x167);async[a25_0x5180b4(0x178)](_0x11b637){const _0x4a011d=a25_0x5180b4,{options:_0xde90d0,args:_0x5d67d0,tdx:_0x330c0b}=_0x11b637,_0x5f20cc=_0xde90d0;if(_0x5d67d0[_0x4a011d(0x15b)]<0x2)return console[_0x4a011d(0x1a8)](_0x4a011d(0x1ad)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x5c4572=_0x5d67d0[0x0],_0x5a2133=_0x5d67d0[0x1];_0x5f20cc['verbose']&&(console['error'](_0x4a011d(0x1a5)+_0x5f20cc[_0x4a011d(0x180)]),console[_0x4a011d(0x1a8)]('Parent\x20segment:\x20'+_0x5c4572),console[_0x4a011d(0x1a8)](_0x4a011d(0x15d)+_0x5a2133));let _0x368eef;if(_0x5f20cc[_0x4a011d(0x1a7)]){const _0xe3dd28=_0x5f20cc[_0x4a011d(0x1a7)],_0x56cb6f=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5c4572+_0x4a011d(0x145),()=>_0x330c0b[_0x4a011d(0x1c9)]['resolveParentId'](_0x5c4572),{'verbose':_0x5f20cc[_0x4a011d(0x1ba)]}),_0x4312cc=_0x56cb6f[_0x4a011d(0x1cd)],_0x5418ee=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0xe3dd28+'\x27...',()=>_0x330c0b[_0x4a011d(0x1c9)]['resolveFolderId'](_0x4312cc,_0xe3dd28),{'verbose':_0x5f20cc[_0x4a011d(0x1ba)]});_0x368eef=_0x5418ee[_0x4a011d(0x1cd)],_0x5f20cc[_0x4a011d(0x1ba)]&&console[_0x4a011d(0x1a8)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x368eef);}const _0xc2c869={'name':_0x5a2133,'description':_0x5f20cc[_0x4a011d(0x185)],'parentFolderId':_0x368eef},_0x24764e=await withSpinner(_0x4a011d(0x1cb)+_0x5a2133+_0x4a011d(0x145),()=>_0x330c0b[_0x4a011d(0x1c9)]['createFolder'](_0x5c4572,_0xc2c869),{'verbose':_0x5f20cc[_0x4a011d(0x1ba)]}),_0x4db898=_0x24764e[_0x4a011d(0x1cd)];return console[_0x4a011d(0x1a8)](_0x4a011d(0x169)+_0x4db898[_0x4a011d(0x1c0)]+_0x4a011d(0x1bb)+_0x4db898['id']),await handleSDKOutput([_0x4db898],_0x5f20cc),0x0;}}export class SegmentViewCommand extends BaseCommand{[a25_0x5180b4(0x1c0)]=a25_0x5180b4(0x159);[a25_0x5180b4(0x185)]=a25_0x5180b4(0x16a);async['execute'](_0x52db71){const _0x47dc75=a25_0x5180b4,{options:_0x59b3a2,args:_0x245566,tdx:_0xa77d5b}=_0x52db71,_0x4e9b1c=_0x245566[0x0];if(!_0x4e9b1c)return console[_0x47dc75(0x1a8)](_0x47dc75(0x162)),console[_0x47dc75(0x1a8)]('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console[_0x47dc75(0x1a8)](_0x47dc75(0x150)),console[_0x47dc75(0x1a8)](_0x47dc75(0x1a3)),console[_0x47dc75(0x1a8)](_0x47dc75(0x1bc)),console['error'](_0x47dc75(0x19f)),console[_0x47dc75(0x1a8)](_0x47dc75(0x1c2)),console[_0x47dc75(0x1a8)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x47dc75(0x1a8)](_0x47dc75(0x1a1)),console[_0x47dc75(0x1a8)](_0x47dc75(0x151)),0x1;try{const _0x543c3b=_0x59b3a2['parentSegment'],_0x1975ab=await resolveSegmentTarget(_0x4e9b1c,_0x543c3b,_0x59b3a2['verbose']);_0x59b3a2[_0x47dc75(0x1ba)]&&console[_0x47dc75(0x1a8)](_0x47dc75(0x19a)+_0x1975ab);const _0x4d79bf=await withSpinner(_0x47dc75(0x181)+_0x4e9b1c+_0x47dc75(0x145),()=>_0xa77d5b[_0x47dc75(0x1c9)][_0x47dc75(0x1d1)](_0x1975ab),{'verbose':_0x59b3a2['verbose']}),_0x593a5a=_0x4d79bf[_0x47dc75(0x1cd)];_0x59b3a2[_0x47dc75(0x1ba)]&&(console['error'](_0x47dc75(0x1cc)+_0x593a5a[_0x47dc75(0x1d6)]),console[_0x47dc75(0x1a8)](_0x47dc75(0x170)+_0x593a5a['parentId']),_0x593a5a[_0x47dc75(0x165)]&&console[_0x47dc75(0x1a8)]('Folder\x20ID:\x20'+_0x593a5a[_0x47dc75(0x165)]),_0x593a5a['segmentId']&&console[_0x47dc75(0x1a8)]('Segment\x20ID:\x20'+_0x593a5a['segmentId']));if(_0x59b3a2[_0x47dc75(0x1c5)]){if(_0x593a5a[_0x47dc75(0x1d6)]===_0x47dc75(0x18c))return console['error'](_0x47dc75(0x1ac)),0x1;if(_0x593a5a['type']===_0x47dc75(0x1bd))return console[_0x47dc75(0x1a8)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x47dc75(0x1a8)](_0x47dc75(0x158)),0x1;if(!_0x593a5a[_0x47dc75(0x172)])throw new SDKError(ErrorCode[_0x47dc75(0x140)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1b36ac=getConsoleNextUrl(_0x59b3a2[_0x47dc75(0x180)],'/app/ps/'+_0x593a5a[_0x47dc75(0x173)]+_0x47dc75(0x198)+_0x593a5a[_0x47dc75(0x172)]);return console[_0x47dc75(0x1a8)](a25_0x2ed445['green']('✔')+_0x47dc75(0x18d)+a25_0x2ed445[_0x47dc75(0x1d4)](_0x1b36ac)),openBrowser(_0x1b36ac),0x0;}if(_0x593a5a['type']===_0x47dc75(0x18c)){if(!_0x593a5a['folderId'])throw new SDKError(ErrorCode[_0x47dc75(0x147)],_0x47dc75(0x142));const _0x5d6ced=await withSpinner(_0x47dc75(0x1c3),()=>_0xa77d5b[_0x47dc75(0x1c9)]['getFolder'](_0x593a5a['folderId']),{'verbose':_0x59b3a2[_0x47dc75(0x1ba)]});await handleSingleObjectOutput(_0x5d6ced[_0x47dc75(0x1cd)],_0x59b3a2);}else{if(_0x593a5a[_0x47dc75(0x1d6)]===_0x47dc75(0x1c9)){if(!_0x593a5a['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x533002=await withSpinner(_0x47dc75(0x199),()=>_0xa77d5b[_0x47dc75(0x1c9)][_0x47dc75(0x1b1)](_0x593a5a[_0x47dc75(0x173)],_0x593a5a[_0x47dc75(0x172)]),{'verbose':_0x59b3a2[_0x47dc75(0x1ba)]}),_0x483b2d=getConsoleNextUrl(_0x59b3a2[_0x47dc75(0x180)],_0x47dc75(0x1a4)+_0x593a5a[_0x47dc75(0x173)]+_0x47dc75(0x198)+_0x593a5a[_0x47dc75(0x172)]),_0x150861=_0x533002[_0x47dc75(0x1cd)];_0x150861['url']=_0x483b2d,await handleSingleObjectOutput(_0x150861,_0x59b3a2);}else return console[_0x47dc75(0x1a8)]('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console['error'](_0x47dc75(0x195)),0x1;}return 0x0;}catch(_0x207a79){if(_0x207a79 instanceof SDKError)return console[_0x47dc75(0x1a8)](_0x47dc75(0x13f)+_0x207a79[_0x47dc75(0x183)]),_0x207a79[_0x47dc75(0x1ae)]&&console[_0x47dc75(0x1a8)](_0x47dc75(0x18b)+_0x207a79[_0x47dc75(0x1ae)]),0x1;throw _0x207a79;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a25_0x5180b4(0x1c0)]=a25_0x5180b4(0x196);[a25_0x5180b4(0x185)]=a25_0x5180b4(0x1b4);async['execute'](_0x5db59c){const _0x7890f0=a25_0x5180b4,{options:_0x2a4587,args:_0x212298,tdx:_0x4878b0}=_0x5db59c,_0x488263=_0x212298[0x0];if(!_0x488263)return console['error'](_0x7890f0(0x1aa)),console[_0x7890f0(0x1a8)](_0x7890f0(0x166)),console[_0x7890f0(0x1a8)](_0x7890f0(0x188)),console[_0x7890f0(0x1a8)](_0x7890f0(0x19f)),console[_0x7890f0(0x1a8)](_0x7890f0(0x177)),console[_0x7890f0(0x1a8)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x576a95=_0x2a4587[_0x7890f0(0x174)],_0x34ba27=await resolveSegmentTarget(_0x488263,_0x576a95,_0x2a4587[_0x7890f0(0x1ba)]);_0x2a4587[_0x7890f0(0x1ba)]&&console[_0x7890f0(0x1a8)](_0x7890f0(0x19a)+_0x34ba27);const _0xc63504=await withSpinner(_0x7890f0(0x181)+_0x488263+'\x27...',()=>_0x4878b0[_0x7890f0(0x1c9)][_0x7890f0(0x1d1)](_0x34ba27),{'verbose':_0x2a4587[_0x7890f0(0x1ba)]}),_0x1e4c1e=_0xc63504[_0x7890f0(0x1cd)];_0x2a4587['verbose']&&(console['error'](_0x7890f0(0x1cc)+_0x1e4c1e[_0x7890f0(0x1d6)]),console[_0x7890f0(0x1a8)](_0x7890f0(0x170)+_0x1e4c1e[_0x7890f0(0x173)]));if(_0x1e4c1e[_0x7890f0(0x1d6)]===_0x7890f0(0x18c))return console['error'](_0x7890f0(0x176)),console['error'](_0x7890f0(0x19d)),0x1;if(_0x1e4c1e['type']===_0x7890f0(0x1bd))return console[_0x7890f0(0x1a8)](_0x7890f0(0x1a9)),console['error']('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x1e4c1e[_0x7890f0(0x172)])throw new SDKError(ErrorCode[_0x7890f0(0x140)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x1233f2=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x4878b0['segment']['getSegmentSQL'](_0x1e4c1e[_0x7890f0(0x173)],_0x1e4c1e[_0x7890f0(0x172)]),{'verbose':_0x2a4587[_0x7890f0(0x1ba)]}),_0x1b67e4=_0x1233f2[_0x7890f0(0x1cd)],_0x59a162=await executeSchemaQuery(_0x1b67e4,_0x4878b0,_0x2a4587);return await handleQueryOutput(_0x59a162,_0x2a4587),0x0;}catch(_0x28729a){if(_0x28729a instanceof SDKError)return console[_0x7890f0(0x1a8)]('Error:\x20'+_0x28729a[_0x7890f0(0x183)]),_0x28729a[_0x7890f0(0x1ae)]&&console[_0x7890f0(0x1a8)](_0x7890f0(0x18b)+_0x28729a[_0x7890f0(0x1ae)]),0x1;throw _0x28729a;}}}
|
|
1
|
+
const a25_0x1f4ab8=a25_0xffa8;(function(_0x5cd39a,_0x47159e){const _0x4a6d1f=a25_0xffa8,_0x28f39d=_0x5cd39a();while(!![]){try{const _0x10c121=parseInt(_0x4a6d1f(0x11c))/0x1*(-parseInt(_0x4a6d1f(0x13f))/0x2)+parseInt(_0x4a6d1f(0x129))/0x3+-parseInt(_0x4a6d1f(0x142))/0x4*(-parseInt(_0x4a6d1f(0xd1))/0x5)+parseInt(_0x4a6d1f(0x148))/0x6*(-parseInt(_0x4a6d1f(0x11b))/0x7)+-parseInt(_0x4a6d1f(0xc5))/0x8+parseInt(_0x4a6d1f(0x107))/0x9+parseInt(_0x4a6d1f(0x14c))/0xa;if(_0x10c121===_0x47159e)break;else _0x28f39d['push'](_0x28f39d['shift']());}catch(_0x52ac44){_0x28f39d['push'](_0x28f39d['shift']());}}}(a25_0x2590,0x4417c));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';function a25_0x2590(){const _0x4214cd=['\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','Resolving\x20path\x20\x27','error','verbose','segmentPath','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Resolving\x20parent\x20segment\x20\x27','Resolving\x20folder\x20\x27','Resolving\x20\x27','Fetching\x20folder\x20\x27','parentFolder','Folder\x20ID\x20missing\x20from\x20resolved\x20path','segment:describe','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','getSegmentSQL','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Show\x20folder\x20or\x20child\x20segment\x20details','Resolved\x20type:\x20','SEGMENT_NOT_FOUND','Usage:\x20tdx\x20sg\x20desc\x20<name>','code','Parent\x20name:\x20','Use:\x20tdx\x20ps\x20view','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','folderId','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','parentSegment','Create\x20segment\x20folder\x20for\x20organization','parentId','segment:show','(root)','getFolder','Resolved\x20folder\x20ID:\x20','test','url','Folder\x20ID:\x20','Parent\x20ID:\x20','site','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','✖\x20Query\x20failed\x20[','resolveParentId','resolveFolderId','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','\x27\x20with\x20ID:\x20','Examples:','web','Creating\x20folder\x20\x27','✔\x20Query\x20completed:\x20Processed\x20','log','1045638pgQNjP','Target\x20path:\x20','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','Show\x20segment\x20folder\x20details','segment:folder:create','Fetching\x20segment\x20details...','data','cause','Show\x20segment\x20or\x20folder\x20details','Use:\x20tdx\x20ps\x20sql','parent','jsonl','length','description','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','folder','Error:\x20Parent\x20segment\x20name\x20is\x20required','segment:view','14jceeLa','1KViBFs','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','/e/','Listing\x20folders\x20for\x20parent\x20\x27','\x20[Job\x20ID:\x20','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Folder\x20name:\x20','execute','stats','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','✔\x20Created\x20folder\x20\x27','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Use:\x20tdx\x20ps\x20show','608568TzGHpw','Error:\x20Folder\x20reference\x20is\x20required','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','type','Error:\x20Path\x20or\x20name\x20is\x20required','json','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','SEGMENT_FOLDER_NOT_FOUND','Fetching\x20parent\x20segment\x20details...','Usage:\x20tdx\x20sg\x20sql\x20<name>','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','segmentId','Get\x20SQL\x20query\x20for\x20child\x20segment','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','\x20\x20Parent\x20segment:\x20','INVALID_ARGUMENT','information_schema','SELECT\x20*\x20FROM\x20(\x0a','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','folderPath','\x20\x20Full\x20path:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','740994GhDlwg','processedRows','jobId','12356YcsypB','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Segment\x20ID:\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','message','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','1524858JBcgIi','\x20\x20Folder\x20path:\x20','Usage:\x20tdx\x20segment\x20describe\x20<path>','trim','12430460BIicFw','in\x20','Resolved\x20YAML\x20file:\x20','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','segmentName','getSegment','Fetching\x20folder\x20details...','\x27...','segment:sql','/app/ps/','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Show\x20child\x20segment\x20schema\x20(column\x20types)','Use:\x20tdx\x20ps\x20desc','replace','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','resolvePathToResource','segment','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','3457552gTlYLY','name','format','Resolved\x20parent\x20ID:\x20','\x20Opening\x20','segment:desc','Options:','Fetching\x20SQL\x20for\x20segment...','Parent\x20segment:\x20','query','\x20\x20Cause:\x20','fullPath','45hIWxYA'];a25_0x2590=function(){return _0x4214cd;};return a25_0x2590();}import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a25_0xddf546 from'chalk';async function resolveSegmentTarget(_0xc6e67a,_0x156d05,_0x5b01ac){const _0xb6031e=a25_0xffa8;if(isYamlFilePath(_0xc6e67a))try{const _0x425e2e=await resolveYamlFilePath(_0xc6e67a);return _0x5b01ac&&(console[_0xb6031e(0xd5)](_0xb6031e(0x14e)+_0xc6e67a),console[_0xb6031e(0xd5)](_0xb6031e(0x137)+_0x425e2e[_0xb6031e(0xee)]),console['error']('\x20\x20Segment\x20name:\x20'+_0x425e2e[_0xb6031e(0x150)]),console[_0xb6031e(0xd5)](_0xb6031e(0x149)+(_0x425e2e[_0xb6031e(0x13c)]||_0xb6031e(0xf2))),console['error'](_0xb6031e(0x13d)+_0x425e2e[_0xb6031e(0xd0)])),_0x425e2e[_0xb6031e(0xd0)];}catch(_0x1476b9){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0xb6031e(0x133)+_0x1476b9[_0xb6031e(0x146)]);}if(!_0x156d05)throw new SDKError(ErrorCode[_0xb6031e(0x138)],_0xb6031e(0x117));return _0x156d05+'/'+_0xc6e67a;}export class SegmentDescribeCommand extends BaseCommand{[a25_0x1f4ab8(0xc6)]=a25_0x1f4ab8(0xdf);[a25_0x1f4ab8(0x114)]=a25_0x1f4ab8(0x10f);async[a25_0x1f4ab8(0x123)](_0xb25dfc){const _0x2d3ca8=a25_0x1f4ab8,{options:_0x5d8f52,args:_0x3f1187,tdx:_0x4ba699}=_0xb25dfc,_0x4e1152=_0x3f1187[0x0],_0x441a06=!_0x4e1152&&!!_0x5d8f52['parentSegment'],_0x14e8df=_0x4e1152||_0x5d8f52[_0x2d3ca8(0xee)];if(!_0x14e8df)return console[_0x2d3ca8(0xd5)](_0x2d3ca8(0x12d)),console[_0x2d3ca8(0xd5)](_0x2d3ca8(0x14a)),console[_0x2d3ca8(0xd5)](_0x2d3ca8(0x102)),console[_0x2d3ca8(0xd5)](_0x2d3ca8(0xc3)),console['error'](_0x2d3ca8(0x13b)),console[_0x2d3ca8(0xd5)](_0x2d3ca8(0xd3)),console[_0x2d3ca8(0xd5)](_0x2d3ca8(0x136)),0x1;try{const _0xeae13f=_0x5d8f52[_0x2d3ca8(0xd7)];let _0x255d2b=_0x14e8df;!_0x441a06&&_0xeae13f&&!_0x14e8df['includes']('/')&&(_0x255d2b=_0xeae13f+'/'+_0x14e8df,_0x5d8f52[_0x2d3ca8(0xd6)]&&console['error']('Resolved\x20relative\x20path\x20to:\x20'+_0x255d2b));const _0x34f7b1=await withSpinner(_0x2d3ca8(0xd4)+_0x255d2b+_0x2d3ca8(0x153),()=>_0x4ba699[_0x2d3ca8(0xc2)][_0x2d3ca8(0xc1)](_0x255d2b),{'verbose':_0x5d8f52['verbose']}),_0x24bc48=_0x34f7b1[_0x2d3ca8(0x10d)];_0x5d8f52['verbose']&&(console[_0x2d3ca8(0xd5)](_0x2d3ca8(0xe4)+_0x24bc48[_0x2d3ca8(0x12c)]),console[_0x2d3ca8(0xd5)]('Parent\x20ID:\x20'+_0x24bc48[_0x2d3ca8(0xf0)]),_0x24bc48[_0x2d3ca8(0xeb)]&&console[_0x2d3ca8(0xd5)]('Folder\x20ID:\x20'+_0x24bc48['folderId']),_0x24bc48[_0x2d3ca8(0x134)]&&console['error'](_0x2d3ca8(0x144)+_0x24bc48[_0x2d3ca8(0x134)]));if(_0x24bc48[_0x2d3ca8(0x12c)]===_0x2d3ca8(0x111)){const _0x3e04eb=await withSpinner(_0x2d3ca8(0x131),()=>_0x4ba699[_0x2d3ca8(0xc2)]['getParent'](_0x24bc48['parentId']),{'verbose':_0x5d8f52[_0x2d3ca8(0xd6)]});await handleSingleObjectOutput(_0x3e04eb['data'],_0x5d8f52);}else{if(_0x24bc48[_0x2d3ca8(0x12c)]==='folder'){if(!_0x24bc48[_0x2d3ca8(0xeb)])throw new SDKError(ErrorCode[_0x2d3ca8(0x130)],_0x2d3ca8(0xde));const _0x4d47a3=await withSpinner(_0x2d3ca8(0x152),()=>_0x4ba699[_0x2d3ca8(0xc2)]['getFolder'](_0x24bc48[_0x2d3ca8(0xeb)]),{'verbose':_0x5d8f52['verbose']});await handleSingleObjectOutput(_0x4d47a3[_0x2d3ca8(0x10d)],_0x5d8f52);}else{if(_0x24bc48['type']===_0x2d3ca8(0xc2)){if(!_0x24bc48[_0x2d3ca8(0x134)])throw new SDKError(ErrorCode[_0x2d3ca8(0xe5)],_0x2d3ca8(0x145));const _0x45ee01=await withSpinner(_0x2d3ca8(0x10c),()=>_0x4ba699['segment'][_0x2d3ca8(0x151)](_0x24bc48[_0x2d3ca8(0xf0)],_0x24bc48[_0x2d3ca8(0x134)]),{'verbose':_0x5d8f52[_0x2d3ca8(0xd6)]});await handleSingleObjectOutput(_0x45ee01[_0x2d3ca8(0x10d)],_0x5d8f52);}}}return 0x0;}catch(_0x4eace4){if(_0x4eace4 instanceof SDKError)return console[_0x2d3ca8(0xd5)](_0x2d3ca8(0xfb)+_0x4eace4[_0x2d3ca8(0x146)]),_0x4eace4[_0x2d3ca8(0x10e)]&&console[_0x2d3ca8(0xd5)](_0x2d3ca8(0xcf)+_0x4eace4['cause']),0x1;throw _0x4eace4;}}}export class SegmentShowCommand extends BaseCommand{[a25_0x1f4ab8(0xc6)]=a25_0x1f4ab8(0xf1);[a25_0x1f4ab8(0x114)]=a25_0x1f4ab8(0x109);async[a25_0x1f4ab8(0x123)](_0x215176){const _0x974f9c=a25_0x1f4ab8,{options:_0x456366,args:_0x410e7b,tdx:_0x46b58f}=_0x215176,_0x2b0b95=_0x410e7b[0x0];if(!_0x2b0b95)return console['error'](_0x974f9c(0xfc)),console[_0x974f9c(0xd5)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console[_0x974f9c(0xd5)](_0x974f9c(0xd2)),console[_0x974f9c(0xd5)](_0x974f9c(0x102)),console['error'](_0x974f9c(0x12f)),console[_0x974f9c(0xd5)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x38ed49=_0x456366['parentSegment'],_0x460330=await resolveSegmentTarget(_0x2b0b95,_0x38ed49,_0x456366[_0x974f9c(0xd6)]);_0x456366[_0x974f9c(0xd6)]&&console['error']('Target\x20path:\x20'+_0x460330);const _0xa48f54=await withSpinner(_0x974f9c(0xdb)+_0x2b0b95+_0x974f9c(0x153),()=>_0x46b58f[_0x974f9c(0xc2)][_0x974f9c(0xc1)](_0x460330),{'verbose':_0x456366['verbose']}),_0x303ccb=_0xa48f54[_0x974f9c(0x10d)];_0x456366[_0x974f9c(0xd6)]&&(console['error']('Resolved\x20type:\x20'+_0x303ccb[_0x974f9c(0x12c)]),console[_0x974f9c(0xd5)](_0x974f9c(0xf8)+_0x303ccb[_0x974f9c(0xf0)]));if(_0x303ccb[_0x974f9c(0x12c)]===_0x974f9c(0x118))return console[_0x974f9c(0xd5)](_0x974f9c(0xc4)),console[_0x974f9c(0xd5)]('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x303ccb[_0x974f9c(0x12c)]==='parent')return console[_0x974f9c(0xd5)](_0x974f9c(0x11d)),console[_0x974f9c(0xd5)](_0x974f9c(0x128)),0x1;if(!_0x303ccb[_0x974f9c(0x134)])throw new SDKError(ErrorCode[_0x974f9c(0xe5)],_0x974f9c(0x145));const _0x44f3cc=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x46b58f[_0x974f9c(0xc2)][_0x974f9c(0xe1)](_0x303ccb[_0x974f9c(0xf0)],_0x303ccb[_0x974f9c(0x134)]),{'verbose':_0x456366[_0x974f9c(0xd6)]});let _0x12d95c=_0x44f3cc[_0x974f9c(0x10d)];const _0x11d5cc=resolveLimit(_0x456366['limit'],DEFAULT_DISPLAY_LIMIT),_0x443262=/\bLIMIT\s+\d+/i[_0x974f9c(0xf5)](_0x12d95c);!_0x443262&&(_0x12d95c=_0x12d95c[_0x974f9c(0x14b)]()[_0x974f9c(0xbf)](/;+$/,''),_0x12d95c=_0x974f9c(0x13a)+_0x12d95c+_0x974f9c(0xd8)+_0x11d5cc);_0x456366[_0x974f9c(0xd6)]&&console['error']('SQL\x20query:\x0a'+_0x12d95c);const _0x57a41f=await withProgressSpinner('Executing\x20segment\x20query...',async _0x3e6c91=>{const _0x4ec6a0=_0x974f9c,_0x171a24=await _0x46b58f[_0x4ec6a0(0xce)][_0x4ec6a0(0x123)](_0x12d95c,{'catalog':'td','schema':_0x4ec6a0(0x139),'onJobId':_0x5aa331=>{_0x3e6c91['setJobId'](_0x5aa331);}});return _0x171a24;},{'verbose':_0x456366[_0x974f9c(0xd6)]}),_0x56405a=_0x57a41f['data'],_0x4dec5c=_0x56405a[_0x974f9c(0x141)]?_0x974f9c(0x120)+_0x56405a['jobId']+']':'';return console[_0x974f9c(0xd5)](_0x974f9c(0x105)+_0x56405a[_0x974f9c(0x124)][_0x974f9c(0x140)]['toLocaleString']()+'\x20rows\x20'+(_0x974f9c(0x14d)+formatElapsed(_0x56405a['stats']['elapsedTimeMillis'])+_0x4dec5c)),await handleQueryOutput(_0x56405a,_0x456366),0x0;}catch(_0x17f2a0){if(_0x17f2a0 instanceof SDKError)return console[_0x974f9c(0xd5)](_0x974f9c(0xfd)+_0x17f2a0[_0x974f9c(0xe7)]+']'),console[_0x974f9c(0xd5)]('\x0a'+_0x17f2a0[_0x974f9c(0x146)]),0x1;throw _0x17f2a0;}}}function a25_0xffa8(_0x377863,_0x22c1e4){_0x377863=_0x377863-0xbb;const _0x259035=a25_0x2590();let _0xffa868=_0x259035[_0x377863];return _0xffa868;}export class SegmentFolderListCommand extends BaseCommand{[a25_0x1f4ab8(0xc6)]='segment:folder:list';[a25_0x1f4ab8(0x114)]=a25_0x1f4ab8(0xed);async[a25_0x1f4ab8(0x123)](_0x32e91e){const _0x374ea7=a25_0x1f4ab8,{options:_0x12cd81,args:_0x1ce374,tdx:_0x50506f}=_0x32e91e;if(_0x1ce374['length']===0x0)return console[_0x374ea7(0xd5)](_0x374ea7(0x119)),console[_0x374ea7(0xd5)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x272f5f=_0x1ce374[0x0];try{_0x12cd81[_0x374ea7(0xd6)]&&(console[_0x374ea7(0xd5)]('Site:\x20'+_0x12cd81[_0x374ea7(0xf9)]),console[_0x374ea7(0xd5)](_0x374ea7(0xe8)+_0x272f5f));const _0x34949e=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x272f5f+_0x374ea7(0x153),()=>_0x50506f[_0x374ea7(0xc2)][_0x374ea7(0xfe)](_0x272f5f),{'verbose':_0x12cd81[_0x374ea7(0xd6)]}),_0x261784=_0x34949e[_0x374ea7(0x10d)];_0x12cd81[_0x374ea7(0xd6)]&&console['error'](_0x374ea7(0xc8)+_0x261784);const _0x133021=await withSpinner(_0x374ea7(0x11f)+_0x272f5f+'\x27...',()=>_0x50506f[_0x374ea7(0xc2)]['listFolders'](_0x261784),{'verbose':_0x12cd81[_0x374ea7(0xd6)]}),_0x43d9e9=_0x133021['data'];return console[_0x374ea7(0xd5)]('✔\x20Found\x20'+_0x43d9e9[_0x374ea7(0x113)]+'\x20folder'+(_0x43d9e9['length']!==0x1?'s':'')),await handleSDKOutput(_0x43d9e9,_0x12cd81),0x0;}catch(_0x40c7e1){if(_0x40c7e1 instanceof SDKError)return console[_0x374ea7(0xd5)]('Error:\x20'+_0x40c7e1[_0x374ea7(0x146)]),_0x40c7e1[_0x374ea7(0x10e)]&&console[_0x374ea7(0xd5)](_0x374ea7(0xcf)+_0x40c7e1[_0x374ea7(0x10e)]),0x1;throw _0x40c7e1;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']='segment:folder:show';[a25_0x1f4ab8(0x114)]=a25_0x1f4ab8(0x10a);async[a25_0x1f4ab8(0x123)](_0x1df1fe){const _0x5e1de7=a25_0x1f4ab8,{options:_0x292c61,args:_0x3fc1d0,tdx:_0x2921b9}=_0x1df1fe;if(_0x3fc1d0[_0x5e1de7(0x113)]===0x0)return console[_0x5e1de7(0xd5)](_0x5e1de7(0x12a)),console[_0x5e1de7(0xd5)](_0x5e1de7(0xc0)),0x1;try{const {parentId:_0x33f62e,childId:_0x38b500}=parseSegmentRef(_0x3fc1d0[0x0]);_0x292c61[_0x5e1de7(0xd6)]&&(console[_0x5e1de7(0xd5)]('Site:\x20'+_0x292c61['site']),console[_0x5e1de7(0xd5)](_0x5e1de7(0xe8)+_0x33f62e),_0x38b500&&console[_0x5e1de7(0xd5)](_0x5e1de7(0x122)+_0x38b500));if(!_0x38b500)return console[_0x5e1de7(0xd5)]('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x127930=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x33f62e+_0x5e1de7(0x153),()=>_0x2921b9['segment'][_0x5e1de7(0xfe)](_0x33f62e),{'verbose':_0x292c61[_0x5e1de7(0xd6)]}),_0x248e5f=_0x127930[_0x5e1de7(0x10d)];_0x292c61[_0x5e1de7(0xd6)]&&console[_0x5e1de7(0xd5)](_0x5e1de7(0xc8)+_0x248e5f);const _0x5116f8=await withSpinner(_0x5e1de7(0xda)+_0x38b500+_0x5e1de7(0x153),()=>_0x2921b9[_0x5e1de7(0xc2)][_0x5e1de7(0xff)](_0x248e5f,_0x38b500),{'verbose':_0x292c61['verbose']}),_0x2c7880=_0x5116f8[_0x5e1de7(0x10d)];_0x292c61[_0x5e1de7(0xd6)]&&console['error'](_0x5e1de7(0xf4)+_0x2c7880);const _0x5471e1=await withSpinner(_0x5e1de7(0xdc)+_0x38b500+_0x5e1de7(0x153),()=>_0x2921b9[_0x5e1de7(0xc2)]['getFolder'](_0x2c7880),{'verbose':_0x292c61[_0x5e1de7(0xd6)]});return await handleSDKOutput([_0x5471e1[_0x5e1de7(0x10d)]],_0x292c61),0x0;}catch(_0x2bc255){if(_0x2bc255 instanceof SDKError)return console['error'](_0x5e1de7(0xfb)+_0x2bc255[_0x5e1de7(0x146)]),_0x2bc255[_0x5e1de7(0x10e)]&&console['error'](_0x5e1de7(0xcf)+_0x2bc255['cause']),0x1;throw _0x2bc255;}}}export class SegmentSQLCommand extends BaseCommand{[a25_0x1f4ab8(0xc6)]=a25_0x1f4ab8(0x154);['description']=a25_0x1f4ab8(0x135);async[a25_0x1f4ab8(0x123)](_0x7730f0){const _0x20234d=a25_0x1f4ab8,{options:_0x370d8b,args:_0x25bab0,tdx:_0x5538a6}=_0x7730f0,_0x40aa19=_0x25bab0[0x0];if(!_0x40aa19)return console['error'](_0x20234d(0xfc)),console[_0x20234d(0xd5)](_0x20234d(0x132)),console[_0x20234d(0xd5)](_0x20234d(0xe0)),console[_0x20234d(0xd5)](_0x20234d(0x102)),console['error'](_0x20234d(0x143)),console['error'](_0x20234d(0x116)),0x1;try{const _0x5a34ff=_0x370d8b['parentSegment'],_0x44ac8f=await resolveSegmentTarget(_0x40aa19,_0x5a34ff,_0x370d8b[_0x20234d(0xd6)]);_0x370d8b['verbose']&&console[_0x20234d(0xd5)](_0x20234d(0x108)+_0x44ac8f);const _0x36cc5b=await withSpinner(_0x20234d(0xdb)+_0x40aa19+_0x20234d(0x153),()=>_0x5538a6[_0x20234d(0xc2)][_0x20234d(0xc1)](_0x44ac8f),{'verbose':_0x370d8b[_0x20234d(0xd6)]}),_0x41b685=_0x36cc5b[_0x20234d(0x10d)];_0x370d8b['verbose']&&(console[_0x20234d(0xd5)]('Resolved\x20type:\x20'+_0x41b685['type']),console['error'](_0x20234d(0xf8)+_0x41b685[_0x20234d(0xf0)]));if(_0x41b685[_0x20234d(0x12c)]===_0x20234d(0x118))return console[_0x20234d(0xd5)](_0x20234d(0x115)),console[_0x20234d(0xd5)](_0x20234d(0xbc)),0x1;if(_0x41b685['type']===_0x20234d(0x111))return console[_0x20234d(0xd5)]('Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console['error'](_0x20234d(0x110)),0x1;if(!_0x41b685[_0x20234d(0x134)])throw new SDKError(ErrorCode[_0x20234d(0xe5)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x176167=await withSpinner(_0x20234d(0xcc),()=>_0x5538a6[_0x20234d(0xc2)][_0x20234d(0xe1)](_0x41b685[_0x20234d(0xf0)],_0x41b685['segmentId']),{'verbose':_0x370d8b[_0x20234d(0xd6)]}),_0x8a2190=_0x176167['data'];return _0x370d8b[_0x20234d(0xc7)]===_0x20234d(0x12e)||_0x370d8b[_0x20234d(0xc7)]===_0x20234d(0x112)?await handleSDKOutput([{'sql':_0x8a2190}],_0x370d8b):console[_0x20234d(0x106)](_0x8a2190),0x0;}catch(_0x5d4f70){if(_0x5d4f70 instanceof SDKError)return console[_0x20234d(0xd5)](_0x20234d(0xfb)+_0x5d4f70[_0x20234d(0x146)]),_0x5d4f70['cause']&&console[_0x20234d(0xd5)](_0x20234d(0xcf)+_0x5d4f70[_0x20234d(0x10e)]),0x1;throw _0x5d4f70;}}}export class SegmentFolderCreateCommand extends BaseCommand{['name']=a25_0x1f4ab8(0x10b);[a25_0x1f4ab8(0x114)]=a25_0x1f4ab8(0xef);async[a25_0x1f4ab8(0x123)](_0x653bcc){const _0x1fb3e0=a25_0x1f4ab8,{options:_0x1bd71b,args:_0x26cb2d,tdx:_0x520e31}=_0x653bcc,_0x3d8cbd=_0x1bd71b;if(_0x26cb2d[_0x1fb3e0(0x113)]<0x2)return console[_0x1fb3e0(0xd5)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console[_0x1fb3e0(0xd5)](_0x1fb3e0(0x14f)),0x1;const _0x42f835=_0x26cb2d[0x0],_0x5977f7=_0x26cb2d[0x1];_0x3d8cbd[_0x1fb3e0(0xd6)]&&(console[_0x1fb3e0(0xd5)]('Site:\x20'+_0x3d8cbd['site']),console[_0x1fb3e0(0xd5)](_0x1fb3e0(0xcd)+_0x42f835),console[_0x1fb3e0(0xd5)]('Folder\x20name:\x20'+_0x5977f7));let _0x4627ec;if(_0x3d8cbd['parentFolder']){const _0x53b2d9=_0x3d8cbd[_0x1fb3e0(0xdd)],_0x5eaa4d=await withSpinner(_0x1fb3e0(0xd9)+_0x42f835+'\x27...',()=>_0x520e31[_0x1fb3e0(0xc2)][_0x1fb3e0(0xfe)](_0x42f835),{'verbose':_0x3d8cbd[_0x1fb3e0(0xd6)]}),_0x12f15a=_0x5eaa4d[_0x1fb3e0(0x10d)],_0x3cbcbf=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x53b2d9+_0x1fb3e0(0x153),()=>_0x520e31['segment']['resolveFolderId'](_0x12f15a,_0x53b2d9),{'verbose':_0x3d8cbd[_0x1fb3e0(0xd6)]});_0x4627ec=_0x3cbcbf[_0x1fb3e0(0x10d)],_0x3d8cbd[_0x1fb3e0(0xd6)]&&console[_0x1fb3e0(0xd5)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x4627ec);}const _0x246aec={'name':_0x5977f7,'description':_0x3d8cbd[_0x1fb3e0(0x114)],'parentFolderId':_0x4627ec},_0xc71955=await withSpinner(_0x1fb3e0(0x104)+_0x5977f7+_0x1fb3e0(0x153),()=>_0x520e31[_0x1fb3e0(0xc2)]['createFolder'](_0x42f835,_0x246aec),{'verbose':_0x3d8cbd[_0x1fb3e0(0xd6)]}),_0x5555e9=_0xc71955['data'];return console[_0x1fb3e0(0xd5)](_0x1fb3e0(0x126)+_0x5555e9[_0x1fb3e0(0xc6)]+_0x1fb3e0(0x101)+_0x5555e9['id']),await handleSDKOutput([_0x5555e9],_0x3d8cbd),0x0;}}export class SegmentViewCommand extends BaseCommand{[a25_0x1f4ab8(0xc6)]=a25_0x1f4ab8(0x11a);[a25_0x1f4ab8(0x114)]=a25_0x1f4ab8(0xe3);async[a25_0x1f4ab8(0x123)](_0x30acce){const _0x47fb7b=a25_0x1f4ab8,{options:_0x1978da,args:_0x525f00,tdx:_0x137da4}=_0x30acce,_0x4fca8d=_0x525f00[0x0];if(!_0x4fca8d)return console[_0x47fb7b(0xd5)](_0x47fb7b(0x12b)),console[_0x47fb7b(0xd5)](_0x47fb7b(0x127)),console[_0x47fb7b(0xd5)](_0x47fb7b(0xe2)),console[_0x47fb7b(0xd5)](_0x47fb7b(0xcb)),console[_0x47fb7b(0xd5)]('\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x47fb7b(0xd5)]('Examples:'),console[_0x47fb7b(0xd5)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console['error']('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x47fb7b(0xd5)](_0x47fb7b(0xec)),console[_0x47fb7b(0xd5)]('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x451d38=_0x1978da[_0x47fb7b(0xee)],_0x42bd13=await resolveSegmentTarget(_0x4fca8d,_0x451d38,_0x1978da['verbose']);_0x1978da[_0x47fb7b(0xd6)]&&console[_0x47fb7b(0xd5)]('Target\x20path:\x20'+_0x42bd13);const _0x4c5562=await withSpinner('Resolving\x20\x27'+_0x4fca8d+_0x47fb7b(0x153),()=>_0x137da4[_0x47fb7b(0xc2)][_0x47fb7b(0xc1)](_0x42bd13),{'verbose':_0x1978da['verbose']}),_0x1aefdb=_0x4c5562['data'];_0x1978da[_0x47fb7b(0xd6)]&&(console[_0x47fb7b(0xd5)](_0x47fb7b(0xe4)+_0x1aefdb[_0x47fb7b(0x12c)]),console[_0x47fb7b(0xd5)](_0x47fb7b(0xf8)+_0x1aefdb['parentId']),_0x1aefdb['folderId']&&console[_0x47fb7b(0xd5)](_0x47fb7b(0xf7)+_0x1aefdb[_0x47fb7b(0xeb)]),_0x1aefdb[_0x47fb7b(0x134)]&&console[_0x47fb7b(0xd5)](_0x47fb7b(0x144)+_0x1aefdb['segmentId']));if(_0x1978da[_0x47fb7b(0x103)]){if(_0x1aefdb[_0x47fb7b(0x12c)]==='folder')return console[_0x47fb7b(0xd5)](_0x47fb7b(0xea)),0x1;if(_0x1aefdb[_0x47fb7b(0x12c)]===_0x47fb7b(0x111))return console[_0x47fb7b(0xd5)](_0x47fb7b(0xfa)),console[_0x47fb7b(0xd5)]('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x1aefdb[_0x47fb7b(0x134)])throw new SDKError(ErrorCode[_0x47fb7b(0xe5)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x2272b8=getConsoleNextUrl(_0x1978da[_0x47fb7b(0xf9)],_0x47fb7b(0xbb)+_0x1aefdb[_0x47fb7b(0xf0)]+_0x47fb7b(0x11e)+_0x1aefdb[_0x47fb7b(0x134)]);return console[_0x47fb7b(0xd5)](a25_0xddf546['green']('✔')+_0x47fb7b(0xc9)+a25_0xddf546['cyan'](_0x2272b8)),openBrowser(_0x2272b8),0x0;}if(_0x1aefdb[_0x47fb7b(0x12c)]===_0x47fb7b(0x118)){if(!_0x1aefdb['folderId'])throw new SDKError(ErrorCode[_0x47fb7b(0x130)],_0x47fb7b(0xde));const _0x26d023=await withSpinner(_0x47fb7b(0x152),()=>_0x137da4['segment'][_0x47fb7b(0xf3)](_0x1aefdb[_0x47fb7b(0xeb)]),{'verbose':_0x1978da[_0x47fb7b(0xd6)]});await handleSingleObjectOutput(_0x26d023[_0x47fb7b(0x10d)],_0x1978da);}else{if(_0x1aefdb[_0x47fb7b(0x12c)]==='segment'){if(!_0x1aefdb[_0x47fb7b(0x134)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x47fb7b(0x145));const _0x2b6a08=await withSpinner(_0x47fb7b(0x10c),()=>_0x137da4[_0x47fb7b(0xc2)]['getSegment'](_0x1aefdb[_0x47fb7b(0xf0)],_0x1aefdb['segmentId']),{'verbose':_0x1978da['verbose']}),_0x57f51e=getConsoleNextUrl(_0x1978da[_0x47fb7b(0xf9)],'/app/ps/'+_0x1aefdb['parentId']+_0x47fb7b(0x11e)+_0x1aefdb[_0x47fb7b(0x134)]),_0x504945=_0x2b6a08['data'];_0x504945[_0x47fb7b(0xf6)]=_0x57f51e,await handleSingleObjectOutput(_0x504945,_0x1978da);}else return console[_0x47fb7b(0xd5)](_0x47fb7b(0x121)),console[_0x47fb7b(0xd5)](_0x47fb7b(0xe9)),0x1;}return 0x0;}catch(_0x580e45){if(_0x580e45 instanceof SDKError)return console[_0x47fb7b(0xd5)](_0x47fb7b(0xfb)+_0x580e45[_0x47fb7b(0x146)]),_0x580e45[_0x47fb7b(0x10e)]&&console[_0x47fb7b(0xd5)](_0x47fb7b(0xcf)+_0x580e45['cause']),0x1;throw _0x580e45;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a25_0x1f4ab8(0xc6)]=a25_0x1f4ab8(0xca);['description']=a25_0x1f4ab8(0xbd);async[a25_0x1f4ab8(0x123)](_0x4679df){const _0x111b38=a25_0x1f4ab8,{options:_0x3964d2,args:_0x4d331b,tdx:_0xb4568}=_0x4679df,_0x1f0913=_0x4d331b[0x0];if(!_0x1f0913)return console[_0x111b38(0xd5)](_0x111b38(0xfc)),console[_0x111b38(0xd5)](_0x111b38(0xe6)),console[_0x111b38(0xd5)](_0x111b38(0x100)),console[_0x111b38(0xd5)](_0x111b38(0x102)),console['error']('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x111b38(0xd5)](_0x111b38(0x125)),0x1;try{const _0x5943b8=_0x3964d2[_0x111b38(0xee)],_0x20a714=await resolveSegmentTarget(_0x1f0913,_0x5943b8,_0x3964d2[_0x111b38(0xd6)]);_0x3964d2[_0x111b38(0xd6)]&&console[_0x111b38(0xd5)](_0x111b38(0x108)+_0x20a714);const _0x41cd24=await withSpinner(_0x111b38(0xdb)+_0x1f0913+_0x111b38(0x153),()=>_0xb4568[_0x111b38(0xc2)]['resolvePathToResource'](_0x20a714),{'verbose':_0x3964d2[_0x111b38(0xd6)]}),_0x3eb8ad=_0x41cd24[_0x111b38(0x10d)];_0x3964d2[_0x111b38(0xd6)]&&(console['error']('Resolved\x20type:\x20'+_0x3eb8ad[_0x111b38(0x12c)]),console[_0x111b38(0xd5)]('Parent\x20ID:\x20'+_0x3eb8ad['parentId']));if(_0x3eb8ad[_0x111b38(0x12c)]==='folder')return console[_0x111b38(0xd5)](_0x111b38(0x147)),console['error']('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x3eb8ad['type']===_0x111b38(0x111))return console['error'](_0x111b38(0x13e)),console['error'](_0x111b38(0xbe)),0x1;if(!_0x3eb8ad[_0x111b38(0x134)])throw new SDKError(ErrorCode[_0x111b38(0xe5)],_0x111b38(0x145));const _0x13e8f2=await withSpinner(_0x111b38(0xcc),()=>_0xb4568['segment'][_0x111b38(0xe1)](_0x3eb8ad['parentId'],_0x3eb8ad['segmentId']),{'verbose':_0x3964d2[_0x111b38(0xd6)]}),_0x5194dd=_0x13e8f2[_0x111b38(0x10d)],_0x235c54=await executeSchemaQuery(_0x5194dd,_0xb4568,_0x3964d2);return await handleQueryOutput(_0x235c54,_0x3964d2),0x0;}catch(_0x1049ab){if(_0x1049ab instanceof SDKError)return console[_0x111b38(0xd5)](_0x111b38(0xfb)+_0x1049ab[_0x111b38(0x146)]),_0x1049ab[_0x111b38(0x10e)]&&console['error'](_0x111b38(0xcf)+_0x1049ab[_0x111b38(0x10e)]),0x1;throw _0x1049ab;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a26_0x2f8e47=a26_0x76f4;function a26_0x76f4(_0x3f14df,_0x16605a){_0x3f14df=_0x3f14df-0xf3;const _0x24ae03=a26_0x24ae();let _0x76f4d9=_0x24ae03[_0x3f14df];return _0x76f4d9;}(function(_0x296c1c,_0x4fea95){const _0x4657cc=a26_0x76f4,_0xcfd95=_0x296c1c();while(!![]){try{const _0x5b80ae=parseInt(_0x4657cc(0x10f))/0x1+parseInt(_0x4657cc(0x10e))/0x2*(-parseInt(_0x4657cc(0x104))/0x3)+parseInt(_0x4657cc(0x103))/0x4*(-parseInt(_0x4657cc(0xf8))/0x5)+-parseInt(_0x4657cc(0x11e))/0x6*(-parseInt(_0x4657cc(0xfe))/0x7)+parseInt(_0x4657cc(0xf9))/0x8+-parseInt(_0x4657cc(0x112))/0x9+-parseInt(_0x4657cc(0x10c))/0xa*(-parseInt(_0x4657cc(0x121))/0xb);if(_0x5b80ae===_0x4fea95)break;else _0xcfd95['push'](_0xcfd95['shift']());}catch(_0x1bfe70){_0xcfd95['push'](_0xcfd95['shift']());}}}(a26_0x24ae,0x1ad56));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';function a26_0x24ae(){const _0x196a17=['includes','Site:\x20','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','Parent\x20path:\x20','Resolving\x20folder\x20path\x20\x27','Examples:','5YlEPnO','44216coMGRn','resolvePathToResource','✔\x20Created\x20segment\x20\x27','yellow','parent','749126lUjVHJ','description','Resolving\x20parent\x20segment\x20\x27','\x27...','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','397704KbxsIn','142119PVxQQG','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','resolveFolderId','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','rule','folder','Resolved\x20folder\x20ID:\x20','\x27\x20with\x20ID:\x20','10boBPvY','execute','4ZSFKZG','97805TlDHaW','segments','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','1010169HLanzf','verbose','length','noCountPopulation','invisible','ruleFile','type','name','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','data','Resolved\x20relative\x20path\x20to:\x20','Target\x20path:\x20','6iloYpA','createSegment','Parent:\x20','2265703kRKDUP','Resolving\x20folder\x20\x27','site','Segment\x20name:\x20','kind','error','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'];a26_0x24ae=function(){return _0x196a17;};return a26_0x24ae();}import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a26_0xb703bc from'chalk';export class SegmentCreateCommand extends BaseCommand{[a26_0x2f8e47(0x119)]='segment:create';['description']='Create\x20child\x20segment\x20with\x20filtering\x20rules';async[a26_0x2f8e47(0x10d)](_0x435189){const _0x29534c=a26_0x2f8e47;console[_0x29534c(0x126)](a26_0xb703bc[_0x29534c(0xfc)]('⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.')),console[_0x29534c(0x126)](a26_0xb703bc[_0x29534c(0xfc)](_0x29534c(0x105)));const {options:_0x52d695,args:_0x40f8c6,tdx:_0x5647d9}=_0x435189,_0x5e73e0=_0x52d695;if(_0x40f8c6['length']===0x0)return console[_0x29534c(0x126)](_0x29534c(0x102)),console[_0x29534c(0x126)](_0x29534c(0x111)),console[_0x29534c(0x126)](_0x29534c(0xf7)),console[_0x29534c(0x126)](_0x29534c(0x127)),console[_0x29534c(0x126)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console[_0x29534c(0x126)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0x5e5b79=_0x40f8c6[0x0],_0x32e3d5=_0x52d695['segmentPath'];let _0xb10e7c=_0x5e5b79;_0x32e3d5&&!_0x5e5b79[_0x29534c(0x128)]('/')&&(_0xb10e7c=_0x32e3d5+'/'+_0x5e5b79,_0x5e73e0[_0x29534c(0x113)]&&console['error'](_0x29534c(0x11c)+_0xb10e7c));const _0x345fe7=parsePath(_0xb10e7c);if(_0x345fe7[_0x29534c(0x110)][_0x29534c(0x114)]<0x2)return console['error'](_0x29534c(0x107)),console['error'](_0x29534c(0x11a)),0x1;const _0x2cb524=_0x345fe7[_0x29534c(0x110)][0x0],_0x3c4b81=getBaseName(_0xb10e7c),_0x551553=getParentPath(_0xb10e7c);_0x5e73e0[_0x29534c(0x113)]&&(console[_0x29534c(0x126)](_0x29534c(0xf3)+_0x5e73e0[_0x29534c(0x123)]),console[_0x29534c(0x126)](_0x29534c(0x11d)+_0xb10e7c),console[_0x29534c(0x126)](_0x29534c(0x120)+_0x2cb524),console[_0x29534c(0x126)](_0x29534c(0x124)+_0x3c4b81),console[_0x29534c(0x126)](_0x29534c(0xf5)+_0x551553));const _0x310c2c=await withSpinner(_0x29534c(0x100)+_0x2cb524+_0x29534c(0x101),()=>_0x5647d9['segment']['resolveParentId'](_0x2cb524),{'verbose':_0x5e73e0[_0x29534c(0x113)]}),_0x20a8ab=_0x310c2c[_0x29534c(0x11b)];let _0x554877;if(_0x345fe7[_0x29534c(0x110)][_0x29534c(0x114)]>0x2){const _0x181ef1=await withSpinner(_0x29534c(0xf6)+_0x551553+_0x29534c(0x101),()=>_0x5647d9['segment'][_0x29534c(0xfa)](_0x551553),{'verbose':_0x5e73e0[_0x29534c(0x113)]}),_0x37c5d8=_0x181ef1[_0x29534c(0x11b)];if(_0x37c5d8[_0x29534c(0x118)]!==_0x29534c(0x109)&&_0x37c5d8['type']!==_0x29534c(0xfd))return console[_0x29534c(0x126)](_0x29534c(0xf4)),0x1;_0x554877=_0x37c5d8['folderId'];}else{if(_0x5e73e0[_0x29534c(0x109)]){const _0x5b7d7e=await withSpinner(_0x29534c(0x122)+_0x5e73e0[_0x29534c(0x109)]+_0x29534c(0x101),()=>_0x5647d9['segment'][_0x29534c(0x106)](_0x20a8ab,_0x5e73e0['folder']),{'verbose':_0x5e73e0['verbose']});_0x554877=_0x5b7d7e[_0x29534c(0x11b)];}}_0x5e73e0['verbose']&&_0x554877&&console[_0x29534c(0x126)](_0x29534c(0x10a)+_0x554877);const _0x356426=await loadJSONFromOptions(_0x5e73e0[_0x29534c(0x108)],_0x5e73e0[_0x29534c(0x117)]),_0x30543d={'name':_0x3c4b81,'description':_0x5e73e0[_0x29534c(0xff)],'rule':_0x356426,'kind':_0x5e73e0[_0x29534c(0x125)]!==undefined?parseInt(_0x5e73e0[_0x29534c(0x125)],0xa):undefined,'isVisible':_0x5e73e0[_0x29534c(0x116)]?![]:undefined,'segmentFolderId':_0x554877,'countPopulation':_0x5e73e0[_0x29534c(0x115)]?![]:undefined},_0xbbd71=await withSpinner('Creating\x20segment\x20\x27'+_0x3c4b81+_0x29534c(0x101),()=>_0x5647d9['segment'][_0x29534c(0x11f)](_0x20a8ab,_0x30543d),{'verbose':_0x5e73e0[_0x29534c(0x113)]}),_0x17bffb=_0xbbd71['data'];return console[_0x29534c(0x126)](_0x29534c(0xfb)+_0x17bffb[_0x29534c(0x119)]+_0x29534c(0x10b)+_0x17bffb['id']),_0xb10e7c!==_0x5e5b79&&console[_0x29534c(0x126)]('\x20\x20\x20Path:\x20'+_0xb10e7c),await handleSDKOutput([_0x17bffb],_0x5e73e0),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a27_0x361d20=a27_0x2f58;(function(_0x3e04c2,_0x53403a){const _0x3a8060=a27_0x2f58,_0x1e081e=_0x3e04c2();while(!![]){try{const _0x18a016=-parseInt(_0x3a8060(0x18e))/0x1*(parseInt(_0x3a8060(0x188))/0x2)+-parseInt(_0x3a8060(0x187))/0x3+-parseInt(_0x3a8060(0x180))/0x4*(parseInt(_0x3a8060(0x173))/0x5)+-parseInt(_0x3a8060(0x175))/0x6+-parseInt(_0x3a8060(0x17d))/0x7+parseInt(_0x3a8060(0x186))/0x8+parseInt(_0x3a8060(0x177))/0x9;if(_0x18a016===_0x53403a)break;else _0x1e081e['push'](_0x1e081e['shift']());}catch(_0x4d5176){_0x1e081e['push'](_0x1e081e['shift']());}}}(a27_0x14c8,0x40de2));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a27_0x2f58(_0x2d1b05,_0x5cf729){_0x2d1b05=_0x2d1b05-0x172;const _0x14c886=a27_0x14c8();let _0x2f5899=_0x14c886[_0x2d1b05];return _0x2f5899;}function a27_0x14c8(){const _0x44ca7b=['136NCAFYW','execute','segment','Error:\x20Parent\x20segment\x20name\x20is\x20required','name','Site:\x20','7390jSCVnL','site','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','5wXylaE','✔\x20Found\x20','327426fTRuOs','description','15175926FdzZnr','\x27...','Listing\x20fields\x20for\x20\x27','parentSegment','json','segment:fields','3266599iVYmko','\x20field','verbose','973208zYOUHN','jsonl','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','List\x20available\x20fields\x20for\x20segmentation','error','data','2007416dfOCUe','1213179OnslBv'];a27_0x14c8=function(){return _0x44ca7b;};return a27_0x14c8();}import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a27_0x361d20(0x18c)]=a27_0x361d20(0x17c);[a27_0x361d20(0x176)]=a27_0x361d20(0x183);async[a27_0x361d20(0x189)](_0x4ad5f0){const _0x4fef4e=a27_0x361d20,{options:_0x2a71b8,args:_0xfbc0d,tdx:_0x2b4b5d}=_0x4ad5f0,_0x570e6f=_0xfbc0d[0x0]||_0x2a71b8[_0x4fef4e(0x17a)];if(!_0x570e6f)return console['error'](_0x4fef4e(0x18b)),console['error'](_0x4fef4e(0x172)),console[_0x4fef4e(0x184)](_0x4fef4e(0x182)),0x1;_0x2a71b8['verbose']&&(console[_0x4fef4e(0x184)](_0x4fef4e(0x18d)+_0x2a71b8[_0x4fef4e(0x18f)]),console[_0x4fef4e(0x184)]('Parent\x20segment:\x20'+_0x570e6f));const _0x3195ef=await withSpinner(_0x4fef4e(0x179)+_0x570e6f+_0x4fef4e(0x178),()=>_0x2b4b5d[_0x4fef4e(0x18a)]['listFields'](_0x570e6f),{'verbose':_0x2a71b8[_0x4fef4e(0x17f)]}),_0x579113=_0x3195ef[_0x4fef4e(0x185)];console['error'](_0x4fef4e(0x174)+_0x579113['length']+_0x4fef4e(0x17e)+(_0x579113['length']!==0x1?'s':''));if(_0x2a71b8[_0x4fef4e(0x17b)]||_0x2a71b8[_0x4fef4e(0x181)])return await handleSDKOutput(_0x579113,_0x2a71b8),0x0;return displayFieldsHumanReadable(_0x579113,_0x570e6f),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a28_0xcf9a(){const _0x4bf156=['green','journeys','dirname','site','parentSegment','targetDir','Site:\x20','cwd','no_parent','journeyVersions','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','200952QGgQcU','1843280rgeHcY','173378RFDbtn','\x20journeys','execute','segment:pull','yellow','description','\x20\x20🗺️\x20\x20','\x0aPull\x20summary\x20for\x20\x27','length','\x20unchanged\x20files','setPhase','activations','\x20segments','7330DIFveH','cyan','session','\x20=\x20','\x20changed\x20files','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','segment','utf-8','filter','files','helpText','relativePath','6KURfQD','name','1070550hcsAqz','repeat','Aborted.','data','segments','901033euIsND','parent_segment','\x20files?','No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27','error','✔\x20Context\x20set:\x20','Parent\x20segment:\x20','isNew','54juzxiS','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','diff','\x20activations','counts','dim','dryRun','2057XGPjnw','536276QTSiGJ','Pulling\x20segments\x20from\x20\x27','4izTbRI','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','\x0aChanges\x20to\x20\x27','\x20\x20Target:\x20','content','verbose','hasChanges','\x20files\x20to\x20','\x20versions)','parentName','\x20new\x20files','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)'];a28_0xcf9a=function(){return _0x4bf156;};return a28_0xcf9a();}const a28_0xc62009=a28_0x2d01;(function(_0x433ba4,_0x37465c){const _0xc6de38=a28_0x2d01,_0x3a8452=_0x433ba4();while(!![]){try{const _0x9786eb=-parseInt(_0xc6de38(0xd5))/0x1+parseInt(_0xc6de38(0x105))/0x2+parseInt(_0xc6de38(0xf0))/0x3+-parseInt(_0xc6de38(0x107))/0x4*(parseInt(_0xc6de38(0xd4))/0x5)+parseInt(_0xc6de38(0xee))/0x6*(-parseInt(_0xc6de38(0xf5))/0x7)+-parseInt(_0xc6de38(0x11e))/0x8*(-parseInt(_0xc6de38(0xfd))/0x9)+-parseInt(_0xc6de38(0xe2))/0xa*(-parseInt(_0xc6de38(0x104))/0xb);if(_0x9786eb===_0x37465c)break;else _0x3a8452['push'](_0x3a8452['shift']());}catch(_0x231400){_0x3a8452['push'](_0x3a8452['shift']());}}}(a28_0xcf9a,0x3b164));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{confirmKey}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import a28_0xf302e8 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';function a28_0x2d01(_0x1f3578,_0x19488c){_0x1f3578=_0x1f3578-0xd4;const _0xcf9a36=a28_0xcf9a();let _0x2d01bb=_0xcf9a36[_0x1f3578];return _0x2d01bb;}import a28_0x4e1c4e from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';export class SegmentPullCommand extends BaseCommand{[a28_0xc62009(0xef)]=a28_0xc62009(0xd8);[a28_0xc62009(0xda)]=a28_0xc62009(0x11d);async[a28_0xc62009(0xd7)](_0x13d5bd){const _0x2c7a3e=a28_0xc62009,{options:_0x3f4099,args:_0x31b0d8,tdx:_0x3b36a9}=_0x13d5bd,_0x5041f9=_0x3f4099,_0x9011=await resolveTarget({'arg':_0x31b0d8[0x0],'contextParent':_0x3f4099[_0x2c7a3e(0x117)],'cwd':process[_0x2c7a3e(0x11a)]()});if(!isSuccessfulResolution(_0x9011))return _0x9011['errorCode']===_0x2c7a3e(0x11b)?(console[_0x2c7a3e(0xf9)](a28_0xf302e8[_0x2c7a3e(0xd9)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x2c7a3e(0xf9)](_0x2c7a3e(0x112)),console[_0x2c7a3e(0xf9)](_0x2c7a3e(0x108)),console[_0x2c7a3e(0xf9)](_0x2c7a3e(0xe7))):(console[_0x2c7a3e(0xf9)](a28_0xf302e8['red']('Error:\x20'+_0x9011['message']+'\x0a')),_0x9011[_0x2c7a3e(0xec)]&&console[_0x2c7a3e(0xf9)](a28_0xf302e8[_0x2c7a3e(0xe3)](_0x9011[_0x2c7a3e(0xec)]))),0x1;const _0x41613c=_0x9011[_0x2c7a3e(0x110)],_0x23f7a9=_0x9011[_0x2c7a3e(0x118)];_0x5041f9[_0x2c7a3e(0x10c)]&&(console[_0x2c7a3e(0xf9)](_0x2c7a3e(0x119)+_0x5041f9[_0x2c7a3e(0x116)]),console['error'](_0x2c7a3e(0xfb)+_0x41613c));const _0x2315df=await withProgressSpinner(_0x2c7a3e(0x106)+_0x41613c+'\x27...',_0x57032d=>_0x3b36a9[_0x2c7a3e(0xe8)]['pullSegments'](_0x41613c,{'targetDir':_0x23f7a9,'verbose':_0x5041f9[_0x2c7a3e(0x10c)],'progress':{'update':_0x29c0ec=>{const _0x6c9b5d=_0x2c7a3e;_0x57032d[_0x6c9b5d(0xdf)](_0x29c0ec),_0x5041f9['verbose']&&console['error']('\x20\x20'+_0x29c0ec);}}}),{'verbose':_0x5041f9[_0x2c7a3e(0x10c)]}),_0x18af65=_0x2315df[_0x2c7a3e(0xf3)];if(_0x18af65[_0x2c7a3e(0x101)]['segments']===0x0&&_0x18af65[_0x2c7a3e(0x101)][_0x2c7a3e(0x114)]===0x0)return console[_0x2c7a3e(0xf9)](a28_0xf302e8[_0x2c7a3e(0xd9)](_0x2c7a3e(0xf8)+_0x18af65[_0x2c7a3e(0x110)]+'\x27')),0x0;const _0x272d32=_0x18af65[_0x2c7a3e(0xeb)][_0x2c7a3e(0xea)](_0x16aa9d=>_0x16aa9d[_0x2c7a3e(0xfc)]),_0x2c94c5=_0x18af65[_0x2c7a3e(0xeb)]['filter'](_0x58ad42=>!_0x58ad42['isNew']&&_0x58ad42[_0x2c7a3e(0x10d)]),_0xa38db3=_0x18af65[_0x2c7a3e(0xeb)][_0x2c7a3e(0xea)](_0x247d9f=>!_0x247d9f[_0x2c7a3e(0xfc)]&&!_0x247d9f[_0x2c7a3e(0x10d)]);console[_0x2c7a3e(0xf9)](_0x2c7a3e(0xdc)+_0x18af65[_0x2c7a3e(0x110)]+'\x27:'),console[_0x2c7a3e(0xf9)]('\x20\x20🎯\x20'+a28_0xf302e8[_0x2c7a3e(0xe3)](_0x18af65[_0x2c7a3e(0x101)][_0x2c7a3e(0xf4)]+_0x2c7a3e(0xe1))+'\x20with\x20'+a28_0xf302e8['cyan'](_0x18af65[_0x2c7a3e(0x101)][_0x2c7a3e(0xe0)]+_0x2c7a3e(0x100)));if(_0x18af65[_0x2c7a3e(0x101)][_0x2c7a3e(0x114)]>0x0){const _0x47f298=_0x18af65['counts'][_0x2c7a3e(0x11c)]>_0x18af65['counts']['journeys']?'\x20('+_0x18af65[_0x2c7a3e(0x101)][_0x2c7a3e(0x11c)]+_0x2c7a3e(0x10f):'';console['error'](_0x2c7a3e(0xdb)+a28_0xf302e8[_0x2c7a3e(0xe3)](_0x18af65[_0x2c7a3e(0x101)][_0x2c7a3e(0x114)]+_0x2c7a3e(0xd6))+a28_0xf302e8[_0x2c7a3e(0x102)](_0x47f298));}console[_0x2c7a3e(0xf9)]('\x20\x20'+a28_0xf302e8[_0x2c7a3e(0x113)]('+\x20'+_0x272d32['length']+_0x2c7a3e(0x111))),console['error']('\x20\x20'+a28_0xf302e8[_0x2c7a3e(0xd9)]('~\x20'+_0x2c94c5[_0x2c7a3e(0xdd)]+_0x2c7a3e(0xe6))),console[_0x2c7a3e(0xf9)]('\x20\x20'+a28_0xf302e8[_0x2c7a3e(0x102)]('=\x20'+_0xa38db3[_0x2c7a3e(0xdd)]+_0x2c7a3e(0xde))),console[_0x2c7a3e(0xf9)](_0x2c7a3e(0x10a)+a28_0xf302e8[_0x2c7a3e(0xe3)](_0x18af65[_0x2c7a3e(0x118)])+'\x0a');if(_0x2c94c5[_0x2c7a3e(0xdd)]>0x0)for(const _0x5a9e11 of _0x2c94c5){console[_0x2c7a3e(0xf9)](_0x2c7a3e(0x109)+_0x5a9e11[_0x2c7a3e(0xed)]+'\x27:'),console[_0x2c7a3e(0xf9)]('─'['repeat'](0x3c)),console[_0x2c7a3e(0xf9)](_0x5a9e11[_0x2c7a3e(0xff)]),console[_0x2c7a3e(0xf9)]('─'[_0x2c7a3e(0xf1)](0x3c));}if(_0x5041f9[_0x2c7a3e(0x103)])return console[_0x2c7a3e(0xf9)](a28_0xf302e8[_0x2c7a3e(0xd9)](_0x2c7a3e(0xfe))),0x0;if(_0x272d32[_0x2c7a3e(0xdd)]===0x0&&_0x2c94c5[_0x2c7a3e(0xdd)]===0x0)return console[_0x2c7a3e(0xf9)](a28_0xf302e8[_0x2c7a3e(0x113)]('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x18af65['parentName']},_0x5041f9[_0x2c7a3e(0xe4)]),console['error'](a28_0xf302e8['green'](_0x2c7a3e(0xfa)+a28_0xf302e8[_0x2c7a3e(0x102)]('parent_segment')+_0x2c7a3e(0xe5)+a28_0xf302e8[_0x2c7a3e(0xe3)](_0x18af65[_0x2c7a3e(0x110)]))),0x0;if(!_0x5041f9['yes']){const _0x5e0f3f=await confirmKey('Write\x20'+(_0x272d32[_0x2c7a3e(0xdd)]+_0x2c94c5[_0x2c7a3e(0xdd)])+_0x2c7a3e(0xf7));if(!_0x5e0f3f)return console[_0x2c7a3e(0xf9)](_0x2c7a3e(0xf2)),0x1;}for(const _0x38743f of _0x18af65['files']){if(_0x38743f['isNew']||_0x38743f['hasChanges']){const _0x14a92d=a28_0x4e1c4e[_0x2c7a3e(0x115)](_0x38743f['absolutePath']);!existsSync(_0x14a92d)&&mkdirSync(_0x14a92d,{'recursive':!![]}),writeFileSync(_0x38743f['absolutePath'],_0x38743f[_0x2c7a3e(0x10b)],_0x2c7a3e(0xe9));}}return console[_0x2c7a3e(0xf9)](a28_0xf302e8[_0x2c7a3e(0x113)]('✔\x20Pulled\x20'+(_0x272d32[_0x2c7a3e(0xdd)]+_0x2c94c5['length'])+_0x2c7a3e(0x10e)+_0x18af65[_0x2c7a3e(0x118)])),saveSessionContext({'parent_segment':_0x18af65[_0x2c7a3e(0x110)]},_0x5041f9[_0x2c7a3e(0xe4)]),console['error'](a28_0xf302e8[_0x2c7a3e(0x113)](_0x2c7a3e(0xfa)+a28_0xf302e8[_0x2c7a3e(0x102)](_0x2c7a3e(0xf6))+_0x2c7a3e(0xe5)+a28_0xf302e8[_0x2c7a3e(0xe3)](_0x18af65[_0x2c7a3e(0x110)]))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a29_0x1d6f4d=a29_0x3b91;(function(_0x5bf461,_0x4012d1){const _0x1cd15c=a29_0x3b91,_0x1c6da0=_0x5bf461();while(!![]){try{const _0x299cb1=parseInt(_0x1cd15c(0xfd))/0x1*(-parseInt(_0x1cd15c(0xf5))/0x2)+parseInt(_0x1cd15c(0x10c))/0x3*(-parseInt(_0x1cd15c(0xfe))/0x4)+parseInt(_0x1cd15c(0xfb))/0x5+parseInt(_0x1cd15c(0x16c))/0x6*(-parseInt(_0x1cd15c(0xff))/0x7)+-parseInt(_0x1cd15c(0x104))/0x8+parseInt(_0x1cd15c(0xf4))/0x9*(-parseInt(_0x1cd15c(0xe3))/0xa)+parseInt(_0x1cd15c(0x135))/0xb*(parseInt(_0x1cd15c(0x167))/0xc);if(_0x299cb1===_0x4012d1)break;else _0x1c6da0['push'](_0x1c6da0['shift']());}catch(_0x2535d2){_0x1c6da0['push'](_0x1c6da0['shift']());}}}(a29_0x501c,0x8a62e));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors}from'../utils/diff.js';function a29_0x3b91(_0x37c75b,_0x5c3fa1){_0x37c75b=_0x37c75b-0xd5;const _0x501c59=a29_0x501c();let _0x3b918c=_0x501c59[_0x37c75b];return _0x3b918c;}import{confirmKey}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a29_0x2028c8 from'chalk';import{existsSync}from'fs';function a29_0x501c(){const _0x48b2a9=['updated','segments','\x20changed','yellow','Aborted.','getJourney','36QpNVdb','📁\x20','/j/da/je','cyan','/app/ps/','4878660cOYeQR','verbose','targetDir','getParent','deleted','scopedFolderPath','red','Delete\x20journey:','existingJourney','isScoped','length','audienceId','Folders\x20to\x20create:','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','list','attributes','state','user','green','map','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)','push','10yDcGOQ','Fetching\x20existing\x20journeys...','\x20created','created','\x20\x20📊\x20Segments:','\x20activations]','Resolving\x20parent\x20segment\x20\x27','name','Fetching\x20connections\x20for\x20name\x20resolution...','folderId','.yaml','Error\x20parsing\x20YAML:\x20','parentFolder','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','paused','segment','\x20unchanged','9324837KaiFzZ','8uFWOAY','file','relationships','journeyBundleName','versionNumber','yes','577190VoxMsw','filePath','100690kZVtpN','1311752wjORjy','7LtTAZg','toCreate','listActivations','parent_name','toUpdate','4947592ZvStyo','get','join','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','Delete\x20segment:','no_parent','\x0aValidation\x20failed:','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','9TSOcYt','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','new','journeysOnly','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','\x20changes?','journeys','listFolders','Preparing\x20journeys...','filter','connection','updatedAt','dim','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','Fetching\x20parent\x20segment\x20details...','Source\x20directory:\x20','No\x20','site','\x20to\x20delete','toString','listSegments','Error:\x20','.yml','\x27...','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','idToName','data','activations','New\x20segment:','cwd','dryRun','errorCode','Fetching\x20existing\x20activations...','description','nameToId','\x20YAML\x20files\x20found','diff','\x20\x20Journeys:\x20','set','type','changed','15787266DpTUIw','journeyId','message','\x20to\x20update','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','\x20new','Parent\x20segment:\x20','parentSegment','\x20to\x20create','execute','delete','\x20folders\x20to\x20create','segmentFolderId','folders','blue','helpText','Push\x20','\x20updated','results','/e/','Error:\x20Directory\x20not\x20found:\x20','folderPath','all','toDelete','error','\x0a✔\x20Push\x20complete','setPhase','yamlConfig','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','isNew','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','Changes\x20to:','\x20\x20Activations:','\x20\x20Segments:\x20','unchanged','journey','\x20\x20\x20\x20','then','Changes\x20to\x20journey:','listJourneysWithDetailsFromParentSegment','\x20\x20Activations:\x20','\x20deleted','segment\x20or\x20journey','repeat'];a29_0x501c=function(){return _0x48b2a9;};return a29_0x501c();}import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';import{buildFolderMaps}from'../sdk/segment/resolution-context.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{['name']='segment:push';[a29_0x1d6f4d(0x12d)]=a29_0x1d6f4d(0x153);async[a29_0x1d6f4d(0x13e)](_0x25a124){const _0x492f60=a29_0x1d6f4d,{options:_0x37018f,args:_0x129e3e,tdx:_0x50cccb}=_0x25a124,_0x35b8ff=_0x37018f,_0x243e46=await resolveTarget({'arg':_0x129e3e[0x0],'contextParent':_0x37018f[_0x492f60(0x13c)],'cwd':process[_0x492f60(0x129)]()});if(!isSuccessfulResolution(_0x243e46))return _0x243e46[_0x492f60(0x12b)]===_0x492f60(0x109)?(console['error'](a29_0x2028c8[_0x492f60(0x164)](_0x492f60(0x107))),console['error'](_0x492f60(0xe1)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent'),console[_0x492f60(0x14d)](_0x492f60(0x119))):(console[_0x492f60(0x14d)](a29_0x2028c8[_0x492f60(0x172)](_0x492f60(0x121)+_0x243e46['message']+'\x0a')),_0x243e46[_0x492f60(0x144)]&&console[_0x492f60(0x14d)](a29_0x2028c8[_0x492f60(0x16a)](_0x243e46[_0x492f60(0x144)]))),0x1;if(_0x243e46['type']===_0x492f60(0x102))return console[_0x492f60(0x14d)](a29_0x2028c8['red'](_0x492f60(0x149)+_0x243e46[_0x492f60(0x16e)]+'\x0a')),console[_0x492f60(0x14d)](a29_0x2028c8[_0x492f60(0x16a)](_0x492f60(0xf0))),0x1;const _0x4faf0a=_0x243e46['parentName'],_0x2efe3b=_0x243e46['targetDir'],_0x319d3c=_0x243e46[_0x492f60(0x133)]===_0x492f60(0xf6)?_0x243e46[_0x492f60(0xfc)]:undefined,_0x402a4a=getScopedDetails(_0x243e46),_0x27e136=_0x402a4a?.[_0x492f60(0xd6)]??![],_0x209355=_0x402a4a?.[_0x492f60(0x171)]??'';if(!existsSync(_0x2efe3b))return console['error'](a29_0x2028c8['red']('Error:\x20Directory\x20not\x20found:\x20'+_0x2efe3b+'\x0a')),console[_0x492f60(0x14d)](a29_0x2028c8['cyan'](_0x492f60(0xf0))),0x1;_0x35b8ff[_0x492f60(0x16d)]&&(console[_0x492f60(0x14d)]('Site:\x20'+_0x35b8ff[_0x492f60(0x11d)]),console['error'](_0x492f60(0x13b)+_0x4faf0a),console[_0x492f60(0x14d)](_0x492f60(0x11b)+_0x2efe3b),_0x27e136&&console[_0x492f60(0x14d)]('Scoped\x20to\x20folder:\x20'+_0x209355));const _0x1079bb=await withSpinner(_0x492f60(0xe9)+_0x4faf0a+_0x492f60(0x123),()=>_0x50cccb[_0x492f60(0xf2)]['resolveParentId'](_0x4faf0a),{'verbose':_0x35b8ff[_0x492f60(0x16d)]}),_0x56bb69=_0x1079bb['data'],[_0x146d13,_0xca46e2,_0x29db1e,_0x274365,_0x1fd654]=await Promise[_0x492f60(0x14b)]([withSpinner(_0x492f60(0x11a),()=>_0x50cccb['segment'][_0x492f60(0x16f)](_0x56bb69),{'verbose':_0x35b8ff[_0x492f60(0x16d)]}),withSpinner('Fetching\x20existing\x20segments...',()=>_0x50cccb[_0x492f60(0xf2)][_0x492f60(0x120)](_0x56bb69),{'verbose':_0x35b8ff[_0x492f60(0x16d)]}),withSpinner('Fetching\x20existing\x20folders...',()=>_0x50cccb[_0x492f60(0xf2)][_0x492f60(0x113)](_0x56bb69),{'verbose':_0x35b8ff[_0x492f60(0x16d)]}),withSpinner(_0x492f60(0xe4),()=>_0x50cccb['journey'][_0x492f60(0x15c)](_0x56bb69),{'verbose':_0x35b8ff['verbose']}),withSpinner('Fetching\x20users\x20for\x20email\x20resolution...',()=>_0x50cccb['user']['buildUserMaps'](),{'verbose':_0x35b8ff[_0x492f60(0x16d)]})[_0x492f60(0x15a)](_0x594681=>_0x594681['data'])]),_0x451e54=_0x146d13[_0x492f60(0x126)],_0x295548=extractRootFolderId(_0x451e54),_0x462117=_0xca46e2[_0x492f60(0x126)],_0x388d96=_0x29db1e[_0x492f60(0x126)],{journeys:_0x5d6356,activationStepsById:_0x362b6c}=_0x274365[_0x492f60(0x126)],_0x2bd04c=new Map(_0x5d6356['map'](_0x40b9f1=>[_0x40b9f1['id'],_0x40b9f1])),_0x2f1155=_0x5d6356[_0x492f60(0xe0)](_0x26be4e=>({'id':_0x26be4e['id'],'name':_0x26be4e[_0x492f60(0xdc)][_0x492f60(0xea)],'journeyBundleName':_0x26be4e[_0x492f60(0xdc)][_0x492f60(0xf8)]||'','journeyBundleId':_0x26be4e[_0x492f60(0xdc)]['journeyBundleId']||'','versionNumber':_0x26be4e['attributes'][_0x492f60(0xf9)],'description':_0x26be4e[_0x492f60(0xdc)][_0x492f60(0x12d)],'state':_0x26be4e[_0x492f60(0xdc)][_0x492f60(0xdd)],'paused':_0x26be4e['attributes'][_0x492f60(0xf1)],'audienceId':_0x26be4e[_0x492f60(0xdc)][_0x492f60(0xd8)],'folderId':_0x26be4e[_0x492f60(0xf7)]?.[_0x492f60(0xef)]?.[_0x492f60(0x126)]?.['id'],'createdAt':_0x26be4e[_0x492f60(0xdc)]['createdAt'],'updatedAt':_0x26be4e[_0x492f60(0xdc)][_0x492f60(0x117)]})),{emailToId:_0x56de51,idToEmail:_0x35c743}=_0x1fd654,_0x193e7d=await withSpinner(_0x492f60(0xeb),async()=>{const _0x3cad44=_0x492f60,_0x1149b6=await _0x50cccb['connection'][_0x3cad44(0xdb)]();return buildConnectionMaps(_0x1149b6);},{'verbose':_0x35b8ff[_0x492f60(0x16d)]})[_0x492f60(0x15a)](_0x22cbb3=>_0x22cbb3['data']),_0x3b8bd4=_0x193e7d[_0x492f60(0x12e)],_0x4daa4c=_0x193e7d[_0x492f60(0x125)],_0x3cd568=_0x193e7d['nameToType'],_0x10088c={'emailToIdMap':_0x56de51,'connectionNameToIdMap':_0x3b8bd4,'connectionNameToTypeMap':_0x3cd568,'getSchema':_0xb71c8e=>_0x50cccb['connection']['getOutputSchemaWithCache'](_0xb71c8e)};let {pathToId:_0x3c00bf,idToPath:_0xd93894}=buildFolderMaps(_0x388d96);const _0x516bbf=buildSegmentLookupMap(_0x462117,_0xd93894),_0xe1dad7=buildSegmentNameToIdMap(_0x462117),_0x4f5f42=buildJourneyBundleLookupMap(_0x2f1155,_0xd93894);let _0x5c7b07;if(_0x319d3c){if(!_0x319d3c['endsWith'](_0x492f60(0x122))&&!_0x319d3c['endsWith'](_0x492f60(0xed)))return console[_0x492f60(0x14d)](a29_0x2028c8[_0x492f60(0x172)](_0x492f60(0x151)+_0x319d3c+'\x0a')),0x1;_0x5c7b07=[_0x319d3c];}else _0x5c7b07=findYamlFiles(_0x2efe3b);if(_0x5c7b07[_0x492f60(0xd7)]===0x0)return console[_0x492f60(0x14d)](a29_0x2028c8[_0x492f60(0x172)]('Error:\x20No\x20YAML\x20files\x20found\x20in\x20'+_0x2efe3b+'\x0a')),console['error'](a29_0x2028c8[_0x492f60(0x16a)](_0x492f60(0x10b))),0x1;let _0x49c26d,_0x4d34d8;try{const _0x41dca1=parseAndClassifyYamlFiles(_0x5c7b07,_0x2efe3b,{'skipSegments':_0x35b8ff['journeysOnly']});_0x49c26d=_0x41dca1[_0x492f60(0x162)],_0x4d34d8=_0x41dca1[_0x492f60(0x112)];const _0x5e4392=validateParsedFiles(_0x41dca1,_0x2efe3b);if(_0x5e4392[_0x492f60(0xd7)]>0x0)return console[_0x492f60(0x14d)](a29_0x2028c8[_0x492f60(0x172)](_0x492f60(0x10a))),console[_0x492f60(0x14d)](formatValidationErrors(_0x5e4392)),console[_0x492f60(0x14d)](a29_0x2028c8[_0x492f60(0x164)](_0x492f60(0x10d))),0x1;}catch(_0x398e3e){return console[_0x492f60(0x14d)](a29_0x2028c8['red'](_0x492f60(0xee)+(_0x398e3e instanceof Error?_0x398e3e[_0x492f60(0x137)]:_0x398e3e))),0x1;}if(_0x49c26d[_0x492f60(0xd7)]===0x0&&_0x4d34d8[_0x492f60(0xd7)]===0x0){const _0x424a49=_0x35b8ff[_0x492f60(0x10f)]?'journey':_0x492f60(0x15f);return console['error'](a29_0x2028c8[_0x492f60(0x164)](_0x492f60(0x11c)+_0x424a49+_0x492f60(0x12f))),0x0;}const _0x1515d2=new Map();_0x462117[_0x492f60(0xd7)]>0x0&&!_0x35b8ff[_0x492f60(0x10f)]&&await withSpinner(_0x492f60(0x12c),async()=>{await batchAsync(_0x462117,async _0x21cf19=>{const _0x45cfec=a29_0x3b91,_0x1f0e40=await _0x50cccb[_0x45cfec(0xf2)][_0x45cfec(0x101)](_0x56bb69,_0x21cf19['id']);_0x1515d2[_0x45cfec(0x132)](_0x21cf19['id'],_0x1f0e40);});},{'verbose':_0x35b8ff['verbose']});const {segmentFiles:_0xade78e,foldersToCreate:_0x509a14}=await prepareSegmentFiles(_0x49c26d,{'segmentByFolderAndName':_0x516bbf,'activationsBySegmentId':_0x1515d2,'folderPathToId':_0x3c00bf,'idToEmailMap':_0x35c743,'connectionIdToNameMap':_0x4daa4c},_0x10088c,_0x27e136,_0x209355),_0x5ecc6d=_0x319d3c?[]:findSegmentsToDelete(_0x462117,_0x49c26d[_0x492f60(0xe0)](({yamlConfig:_0xd4f418,folderPath:_0x35e935})=>({'yamlConfig':_0xd4f418,'folderPath':resolveTDFolderPath(_0x35e935,_0x27e136,_0x209355)})),_0xd93894,_0x209355,_0x27e136),{journeyFiles:_0x298512,foldersToCreate:_0x2b5535}=await withProgressSpinner(_0x492f60(0x114),async _0xecb6de=>prepareJourneyFiles(_0x4d34d8,{'fetchJourney':async _0x466ecf=>_0x50cccb[_0x492f60(0x158)][_0x492f60(0x166)](_0x466ecf[_0x492f60(0x136)]),'journeyBundlesByFolderAndName':_0x4f5f42,'folderPathToId':_0x3c00bf,'idToEmailMap':_0x35c743,'connectionIdToNameMap':_0x4daa4c,'existingSegments':_0x462117,'parentId':_0x56bb69,'deps':_0x50cccb,'progress':{'update':_0x37152c=>{const _0xb01103=_0x492f60;_0xecb6de[_0xb01103(0x14f)](_0x37152c),_0x35b8ff[_0xb01103(0x16d)]&&console['error']('\x20\x20'+_0x37152c);}},'journeyById':_0x2bd04c,'activationStepsById':_0x362b6c},_0x27e136,_0x209355),{'verbose':_0x35b8ff[_0x492f60(0x16d)]})[_0x492f60(0x15a)](_0x6daca3=>_0x6daca3['data']);for(const _0x1e5d6c of _0x2b5535){_0x509a14['add'](_0x1e5d6c);}const _0x277963=_0x319d3c?[]:findJourneysToDelete(_0x2f1155,_0x4d34d8[_0x492f60(0xe0)](({yamlConfig:_0x56f913,folderPath:_0x339101})=>({'yamlConfig':_0x56f913,'folderPath':resolveTDFolderPath(_0x339101,_0x27e136,_0x209355)})),_0xd93894,_0x209355,_0x27e136),_0x4bebad=calculatePushStats(_0xade78e,_0x298512,_0x509a14,_0x5ecc6d,_0x277963,!!_0x35b8ff[_0x492f60(0x13f)],!!_0x35b8ff[_0x492f60(0x10f)]),_0x3e0636=_0x4bebad['segments'][_0x492f60(0x10e)],_0x22b3df=_0x4bebad[_0x492f60(0x162)]['changed'],_0x4257b4=_0x4bebad['segments'][_0x492f60(0x157)],_0x5ea866=_0x4bebad[_0x492f60(0x162)][_0x492f60(0x14c)],_0x4773a7=_0x4bebad[_0x492f60(0x142)][_0x492f60(0x100)],_0x15ba81=_0x4bebad[_0x492f60(0x112)][_0x492f60(0x10e)],_0x48e00d=_0x4bebad[_0x492f60(0x112)][_0x492f60(0x134)],_0x4029a5=_0x4bebad[_0x492f60(0x112)][_0x492f60(0x157)],_0x272d42=_0x4bebad['journeys'][_0x492f60(0x14c)],_0x65d64d=_0x4bebad[_0x492f60(0x127)][_0x492f60(0x14b)],_0x4a5c05=_0x4bebad[_0x492f60(0x127)][_0x492f60(0x100)],_0x284ce1=_0x4bebad['activations'][_0x492f60(0x103)],_0x25f722=_0x4bebad[_0x492f60(0x127)][_0x492f60(0x14c)];console[_0x492f60(0x14d)]('\x0aPush\x20summary\x20for\x20\x27'+_0x4faf0a+'\x27:');_0x4773a7['length']>0x0&&console[_0x492f60(0x14d)]('\x20\x20'+a29_0x2028c8[_0x492f60(0x143)](_0x492f60(0x168)+_0x4773a7[_0x492f60(0xd7)]+_0x492f60(0x140)));if(!_0x35b8ff[_0x492f60(0x10f)]){console['error'](_0x492f60(0xe7)),console[_0x492f60(0x14d)]('\x20\x20\x20\x20'+a29_0x2028c8[_0x492f60(0xdf)]('+\x20'+_0x3e0636[_0x492f60(0xd7)]+'\x20new')),console[_0x492f60(0x14d)](_0x492f60(0x159)+a29_0x2028c8[_0x492f60(0x164)]('~\x20'+_0x22b3df[_0x492f60(0xd7)]+'\x20changed'));if(_0x5ea866[_0x492f60(0xd7)]>0x0)console[_0x492f60(0x14d)](_0x492f60(0x159)+a29_0x2028c8[_0x492f60(0x172)]('-\x20'+_0x5ea866[_0x492f60(0xd7)]+_0x492f60(0x11e)));else _0x5ecc6d[_0x492f60(0xd7)]>0x0&&!_0x35b8ff['delete']&&console[_0x492f60(0x14d)]('\x20\x20\x20\x20'+a29_0x2028c8[_0x492f60(0x118)](_0x5ecc6d['length']+_0x492f60(0x139)));console[_0x492f60(0x14d)](_0x492f60(0x159)+a29_0x2028c8[_0x492f60(0x118)]('=\x20'+_0x4257b4['length']+_0x492f60(0xf3)));}if(_0x298512['length']>0x0||_0x277963[_0x492f60(0xd7)]>0x0){console[_0x492f60(0x14d)]('\x20\x20🗺️\x20\x20Journeys:'),console[_0x492f60(0x14d)](_0x492f60(0x159)+a29_0x2028c8[_0x492f60(0xdf)]('+\x20'+_0x15ba81['length']+_0x492f60(0x13a))),console['error'](_0x492f60(0x159)+a29_0x2028c8[_0x492f60(0x164)]('~\x20'+_0x48e00d['length']+_0x492f60(0x163)));if(_0x272d42[_0x492f60(0xd7)]>0x0)console[_0x492f60(0x14d)](_0x492f60(0x159)+a29_0x2028c8[_0x492f60(0x172)]('-\x20'+_0x272d42[_0x492f60(0xd7)]+_0x492f60(0x11e)));else _0x277963[_0x492f60(0xd7)]>0x0&&!_0x35b8ff[_0x492f60(0x13f)]&&console['error'](_0x492f60(0x159)+a29_0x2028c8[_0x492f60(0x118)](_0x277963[_0x492f60(0xd7)]+_0x492f60(0x139)));console['error']('\x20\x20\x20\x20'+a29_0x2028c8[_0x492f60(0x118)]('=\x20'+_0x4029a5[_0x492f60(0xd7)]+_0x492f60(0xf3)));}_0x65d64d[_0x492f60(0xd7)]>0x0&&!_0x35b8ff['journeysOnly']&&(console[_0x492f60(0x14d)](''),console[_0x492f60(0x14d)](_0x492f60(0x155)),_0x4a5c05[_0x492f60(0xd7)]>0x0&&console[_0x492f60(0x14d)](_0x492f60(0x159)+a29_0x2028c8[_0x492f60(0xdf)]('+\x20'+_0x4a5c05[_0x492f60(0xd7)]+_0x492f60(0x13d))),_0x284ce1[_0x492f60(0xd7)]>0x0&&console['error'](_0x492f60(0x159)+a29_0x2028c8[_0x492f60(0x164)]('~\x20'+_0x284ce1['length']+_0x492f60(0x138))),_0x25f722['length']>0x0&&console[_0x492f60(0x14d)](_0x492f60(0x159)+a29_0x2028c8[_0x492f60(0x172)]('-\x20'+_0x25f722[_0x492f60(0xd7)]+_0x492f60(0x11e))));console[_0x492f60(0x14d)]('\x20\x20Source:\x20'+a29_0x2028c8[_0x492f60(0x16a)](_0x2efe3b)+'\x0a');if(_0x4773a7['length']>0x0){console['error'](_0x492f60(0xd9));for(const _0x56d959 of _0x4773a7){console[_0x492f60(0x14d)]('\x20\x20'+a29_0x2028c8[_0x492f60(0x143)]('+')+'\x20'+_0x56d959);}console[_0x492f60(0x14d)]('');}if(_0x3e0636[_0x492f60(0xd7)]>0x0&&!_0x35b8ff['journeysOnly'])for(const _0x1d3a46 of _0x3e0636){const _0x2ff341=_0x1d3a46[_0x492f60(0x14a)]?_0x1d3a46[_0x492f60(0x14a)]+'/'+_0x1d3a46['yamlConfig'][_0x492f60(0xea)]:_0x1d3a46[_0x492f60(0x150)][_0x492f60(0xea)],_0xf2d8da=_0x1d3a46[_0x492f60(0x150)][_0x492f60(0x127)]?.[_0x492f60(0xd7)]||0x0,_0x15b169=_0xf2d8da>0x0?a29_0x2028c8['dim']('\x20['+_0xf2d8da+'\x20activations]'):'';console[_0x492f60(0x14d)]('\x0a'+a29_0x2028c8[_0x492f60(0xdf)](_0x492f60(0x128))+'\x20'+_0x2ff341+_0x15b169),console[_0x492f60(0x14d)]('─'['repeat'](0x3c)),_0x1d3a46[_0x492f60(0x130)]&&console[_0x492f60(0x14d)](_0x1d3a46['diff']),console[_0x492f60(0x14d)]('─'[_0x492f60(0x160)](0x3c));}if(_0x5ea866[_0x492f60(0xd7)]>0x0&&!_0x35b8ff[_0x492f60(0x10f)])for(const _0x1bb1fd of _0x5ea866){const _0x2afecb=_0x1bb1fd[_0x492f60(0x141)]?_0xd93894[_0x492f60(0x105)](_0x1bb1fd[_0x492f60(0x141)][_0x492f60(0x11f)]())||'':'',_0x207362=_0x2afecb?_0x2afecb+'/'+_0x1bb1fd[_0x492f60(0xea)]:_0x1bb1fd['name'],_0x2b7ef3=_0x1515d2[_0x492f60(0x105)](_0x1bb1fd['id'])||[],_0x37eb3a=_0x2b7ef3[_0x492f60(0xd7)]>0x0?a29_0x2028c8[_0x492f60(0x118)]('\x20['+_0x2b7ef3[_0x492f60(0xd7)]+_0x492f60(0xe8)):'';console['error']('\x0a'+a29_0x2028c8['red'](_0x492f60(0x108))+'\x20'+_0x207362+_0x37eb3a),console[_0x492f60(0x14d)]('─'[_0x492f60(0x160)](0x3c));const _0x18e8b5=segmentWithActivationsToYaml(_0x1bb1fd,_0x2b7ef3,undefined,_0x35c743,_0x4daa4c),_0xc7f83b=segmentToYamlString(_0x18e8b5),_0xca14f6=generateDiff(_0xc7f83b,'');console[_0x492f60(0x14d)](formatDiffWithColors(_0xca14f6)),console['error']('─'['repeat'](0x3c));}const _0xb7bc82=_0xade78e[_0x492f60(0x115)](_0x255f3d=>!_0x255f3d['isNew']&&_0x255f3d[_0x492f60(0x130)]);if(_0xb7bc82[_0x492f60(0xd7)]>0x0&&!_0x35b8ff[_0x492f60(0x10f)])for(const _0x5c0f73 of _0xb7bc82){const _0x3c5cf6=_0x5c0f73[_0x492f60(0x14a)]?_0x5c0f73['folderPath']+'/'+_0x5c0f73[_0x492f60(0x150)][_0x492f60(0xea)]:_0x5c0f73['yamlConfig'][_0x492f60(0xea)];console['error']('\x0a'+a29_0x2028c8[_0x492f60(0x164)](_0x492f60(0x154))+'\x20'+_0x3c5cf6),console[_0x492f60(0x14d)]('─'[_0x492f60(0x160)](0x3c)),console[_0x492f60(0x14d)](_0x5c0f73[_0x492f60(0x130)]),console[_0x492f60(0x14d)]('─'['repeat'](0x3c));}if(_0x15ba81[_0x492f60(0xd7)]>0x0)for(const _0x145958 of _0x15ba81){const _0x1ce4ae=_0x145958[_0x492f60(0x14a)]?_0x145958[_0x492f60(0x14a)]+'/'+_0x145958['yamlConfig'][_0x492f60(0xea)]:_0x145958[_0x492f60(0x150)]['name'];console['error']('\x0a'+a29_0x2028c8[_0x492f60(0xdf)]('New\x20journey:')+'\x20'+_0x1ce4ae),console[_0x492f60(0x14d)]('─'[_0x492f60(0x160)](0x3c)),_0x145958[_0x492f60(0x130)]&&console[_0x492f60(0x14d)](_0x145958[_0x492f60(0x130)]),console[_0x492f60(0x14d)]('─'[_0x492f60(0x160)](0x3c));}const _0x11c54d=_0x298512[_0x492f60(0x115)](_0x2e10b6=>!_0x2e10b6[_0x492f60(0x152)]&&_0x2e10b6['diff']);if(_0x11c54d['length']>0x0)for(const _0x1a1b0f of _0x11c54d){const _0x262a0d=_0x1a1b0f[_0x492f60(0x14a)]?_0x1a1b0f['folderPath']+'/'+_0x1a1b0f[_0x492f60(0x150)][_0x492f60(0xea)]:_0x1a1b0f[_0x492f60(0x150)]['name'];console[_0x492f60(0x14d)]('\x0a'+a29_0x2028c8[_0x492f60(0x164)](_0x492f60(0x15b))+'\x20'+_0x262a0d),console['error']('─'['repeat'](0x3c)),console[_0x492f60(0x14d)](_0x1a1b0f[_0x492f60(0x130)]),console[_0x492f60(0x14d)]('─'['repeat'](0x3c));}if(_0x272d42['length']>0x0)for(const _0x101d45 of _0x272d42){const _0x11ae8f=_0x101d45[_0x492f60(0xec)]?_0xd93894[_0x492f60(0x105)](_0x101d45[_0x492f60(0xec)])||'':'',_0x48a9cb=_0x11ae8f?_0x11ae8f+'/'+_0x101d45[_0x492f60(0xf8)]:_0x101d45['journeyBundleName'];console[_0x492f60(0x14d)]('\x0a'+a29_0x2028c8[_0x492f60(0x172)](_0x492f60(0x173))+'\x20'+_0x48a9cb),console[_0x492f60(0x14d)]('─'[_0x492f60(0x160)](0x3c)),console[_0x492f60(0x14d)](a29_0x2028c8[_0x492f60(0x172)]('(Journey\x20will\x20be\x20deleted)')),console['error']('─'[_0x492f60(0x160)](0x3c));}if(_0x35b8ff[_0x492f60(0x12a)])return console['error'](a29_0x2028c8[_0x492f60(0x164)](_0x492f60(0x124))),0x0;const _0xe5ad8f=_0x35b8ff[_0x492f60(0x10f)]?![]:_0x3e0636['length']>0x0||_0x22b3df['length']>0x0||_0x5ea866[_0x492f60(0xd7)]>0x0,_0x562c24=_0x15ba81[_0x492f60(0xd7)]>0x0||_0x48e00d[_0x492f60(0xd7)]>0x0||_0x272d42[_0x492f60(0xd7)]>0x0,_0x779c81=_0x35b8ff[_0x492f60(0x10f)]?![]:_0x65d64d[_0x492f60(0xd7)]>0x0,_0x4426bf=_0x4773a7[_0x492f60(0xd7)]>0x0;if(!_0xe5ad8f&&!_0x562c24&&!_0x779c81&&!_0x4426bf){const _0x181f29=_0x35b8ff['journeysOnly']?_0x492f60(0xda):_0x492f60(0x110);console[_0x492f60(0x14d)](a29_0x2028c8[_0x492f60(0xdf)](_0x181f29));if(_0x319d3c&&_0x4029a5['length']===0x1){const _0x53ac3b=_0x4029a5[0x0];if(_0x53ac3b[_0x492f60(0xd5)]?.['id']){const _0x115f93=getConsoleNextUrl(_0x35b8ff[_0x492f60(0x11d)],_0x492f60(0x16b)+_0x56bb69+_0x492f60(0x148)+_0x53ac3b[_0x492f60(0xd5)]['id']+_0x492f60(0x169));console['error']('\x20\x20'+a29_0x2028c8[_0x492f60(0x16a)](_0x115f93));}}return 0x0;}const _0x276b14=_0x35b8ff[_0x492f60(0x10f)]?_0x15ba81[_0x492f60(0xd7)]+_0x48e00d[_0x492f60(0xd7)]+_0x272d42['length']+_0x4773a7[_0x492f60(0xd7)]:_0x3e0636['length']+_0x22b3df[_0x492f60(0xd7)]+_0x5ea866[_0x492f60(0xd7)]+_0x15ba81[_0x492f60(0xd7)]+_0x48e00d[_0x492f60(0xd7)]+_0x272d42['length']+_0x4773a7[_0x492f60(0xd7)]+_0x65d64d[_0x492f60(0xd7)];if(!_0x35b8ff[_0x492f60(0xfa)]&&_0x276b14>0x0){const _0x13026f=await confirmKey(_0x492f60(0x145)+_0x276b14+_0x492f60(0x111));if(!_0x13026f)return console[_0x492f60(0x14d)](_0x492f60(0x165)),0x1;}const _0x5f1df5={'withProgress':async(_0xe017cf,_0x252b35)=>{const _0x3a43a7=_0x492f60,_0x2e7962=await withSpinner(_0xe017cf,_0x252b35,{'verbose':_0x35b8ff[_0x3a43a7(0x16d)]});return{'data':_0x2e7962[_0x3a43a7(0x126)]};},'logInfo':_0x475dc8=>console[_0x492f60(0x14d)](a29_0x2028c8[_0x492f60(0x143)]('✔\x20'+_0x475dc8)),'logSuccess':_0x42b638=>console[_0x492f60(0x14d)](a29_0x2028c8['green']('✔\x20'+_0x42b638)),'logWarning':_0x126016=>console['error'](a29_0x2028c8[_0x492f60(0x164)]('⚠\x20'+_0x126016)),'logDeleted':_0x5363b3=>console['error'](a29_0x2028c8[_0x492f60(0x172)]('✔\x20'+_0x5363b3))},_0x88e782={'segment':_0x50cccb[_0x492f60(0xf2)],'journey':_0x50cccb[_0x492f60(0x158)],'user':_0x50cccb[_0x492f60(0xde)],'connection':_0x50cccb[_0x492f60(0x116)]};_0x4773a7['length']>0x0&&(_0x3c00bf=await executePushFolders(_0x88e782,_0x4773a7,_0x3c00bf,{'parentId':_0x56bb69},_0x5f1df5));const _0x1ff9e4={'rootFolderId':_0x295548,'folderPathToId':_0x3c00bf,'folderIdToPath':_0xd93894,'segmentNameToId':_0xe1dad7,'activationsBySegmentId':_0x1515d2,'emailToIdMap':_0x56de51,'idToEmailMap':_0x35c743,'connectionNameToIdMap':_0x193e7d['nameToId'],'connectionIdToNameMap':_0x193e7d['idToName'],'connectionNameToTypeMap':_0x3cd568},_0xd2bae0=await executePushSegments(_0x88e782,_0x35b8ff['journeysOnly']?[]:_0xade78e,_0x1ff9e4,{'parentId':_0x56bb69},_0x5f1df5),_0x586193=_0xd2bae0[_0x492f60(0xe6)],_0x5efb2f=_0xd2bae0[_0x492f60(0x161)],_0x17fe50=_0xd2bae0[_0x492f60(0x127)][_0x492f60(0xe6)],_0x3ba658=_0xd2bae0[_0x492f60(0x127)][_0x492f60(0x161)],_0x819822=_0xd2bae0[_0x492f60(0x127)][_0x492f60(0x170)],_0x1bcfaf=await executePushSegmentDeletions(_0x88e782,_0x35b8ff[_0x492f60(0x10f)]?[]:_0x5ea866,_0x5f1df5);let _0xdd8b72=0x0,_0x1cc254=0x0,_0x1a17ea=0x0;const _0x1c455c=new Map(_0xe1dad7);for(const [_0x4fd1d5,_0x38992c]of _0xd2bae0['createdSegmentIds']){_0x1c455c[_0x492f60(0x132)](_0x4fd1d5,_0x38992c);}if(_0x298512[_0x492f60(0xd7)]>0x0){const _0x28a0a4={..._0x1ff9e4,'segmentNameToId':_0x1c455c,'existingSegments':_0x462117,'activationContext':_0x10088c},_0x46602a=await executePushJourneys(_0x88e782,_0x298512,_0x28a0a4,{'parentId':_0x56bb69,'rootFolderId':_0x295548,'verbose':_0x35b8ff[_0x492f60(0x16d)]},_0x5f1df5);_0xdd8b72=_0x46602a['created'],_0x1cc254=_0x46602a['updated'];if(_0x319d3c&&_0x46602a[_0x492f60(0x147)]['length']===0x1){const _0x42d86b=_0x46602a[_0x492f60(0x147)][0x0];if(_0x42d86b[_0x492f60(0x136)]){const _0x2ba6a3=getConsoleNextUrl(_0x35b8ff[_0x492f60(0x11d)],_0x492f60(0x16b)+_0x56bb69+_0x492f60(0x148)+_0x42d86b[_0x492f60(0x136)]+_0x492f60(0x169));console['error']('\x20\x20'+a29_0x2028c8[_0x492f60(0x16a)](_0x2ba6a3));}}}for(const _0x4ee97d of _0x272d42){console[_0x492f60(0x14d)](a29_0x2028c8[_0x492f60(0x164)]('⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20'+_0x4ee97d['journeyBundleName'])),_0x1a17ea++;}const _0x2bf6f6=[];if(_0x586193>0x0)_0x2bf6f6[_0x492f60(0xe2)](_0x586193+_0x492f60(0xe5));if(_0x5efb2f>0x0)_0x2bf6f6[_0x492f60(0xe2)](_0x5efb2f+_0x492f60(0x146));if(_0x1bcfaf>0x0)_0x2bf6f6[_0x492f60(0xe2)](_0x1bcfaf+_0x492f60(0x15e));const _0x85adcd=[];if(_0xdd8b72>0x0)_0x85adcd['push'](_0xdd8b72+_0x492f60(0xe5));if(_0x1cc254>0x0)_0x85adcd[_0x492f60(0xe2)](_0x1cc254+'\x20updated');if(_0x1a17ea>0x0)_0x85adcd['push'](_0x1a17ea+_0x492f60(0x15e));const _0x240023=[];if(_0x17fe50>0x0)_0x240023[_0x492f60(0xe2)](_0x17fe50+_0x492f60(0xe5));if(_0x3ba658>0x0)_0x240023[_0x492f60(0xe2)](_0x3ba658+_0x492f60(0x146));if(_0x819822>0x0)_0x240023[_0x492f60(0xe2)](_0x819822+_0x492f60(0x15e));return console['error'](a29_0x2028c8[_0x492f60(0xdf)](_0x492f60(0x14e))),_0x2bf6f6[_0x492f60(0xd7)]>0x0&&!_0x35b8ff[_0x492f60(0x10f)]&&console[_0x492f60(0x14d)](_0x492f60(0x156)+_0x2bf6f6[_0x492f60(0x106)](',\x20')),_0x85adcd[_0x492f60(0xd7)]>0x0&&console[_0x492f60(0x14d)](_0x492f60(0x131)+_0x85adcd[_0x492f60(0x106)](',\x20')),_0x240023[_0x492f60(0xd7)]>0x0&&!_0x35b8ff[_0x492f60(0x10f)]&&console[_0x492f60(0x14d)](_0x492f60(0x15d)+_0x240023[_0x492f60(0x106)](',\x20')),0x0;}}
|
|
1
|
+
const a29_0x2c3d15=a29_0x3df0;(function(_0xb07671,_0x3e1c02){const _0x2e05be=a29_0x3df0,_0x4cdb95=_0xb07671();while(!![]){try{const _0xb6ed36=parseInt(_0x2e05be(0x211))/0x1*(-parseInt(_0x2e05be(0x236))/0x2)+parseInt(_0x2e05be(0x20b))/0x3*(-parseInt(_0x2e05be(0x1be))/0x4)+parseInt(_0x2e05be(0x21d))/0x5*(parseInt(_0x2e05be(0x22b))/0x6)+parseInt(_0x2e05be(0x238))/0x7+parseInt(_0x2e05be(0x201))/0x8*(parseInt(_0x2e05be(0x1bc))/0x9)+-parseInt(_0x2e05be(0x1f2))/0xa+parseInt(_0x2e05be(0x1e3))/0xb;if(_0xb6ed36===_0x3e1c02)break;else _0x4cdb95['push'](_0x4cdb95['shift']());}catch(_0x3bda17){_0x4cdb95['push'](_0x4cdb95['shift']());}}}(a29_0x53e8,0xcb0f2));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';function a29_0x3df0(_0x5cee,_0xc73432){_0x5cee=_0x5cee-0x1b6;const _0x53e880=a29_0x53e8();let _0x3df09d=_0x53e880[_0x5cee];return _0x3df09d;}import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a29_0x57bff8 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';function a29_0x53e8(){const _0x4ee03b=['nameToId','cyan','createdSegmentIds','journeys','resolveParentId','add','\x20to\x20delete','red','idToName','execute','description','getJourney','getOutputSchemaWithCache','filePath','\x20new','Changes\x20to:','\x20\x20Source:\x20','scopedFolderPath','activations','journey','folderId','message','new','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','25876818TldduZ','Push\x20','error','\x20to\x20create','name','green','\x0aPush\x20summary\x20for\x20\x27','Fetching\x20connections\x20for\x20name\x20resolution...','\x20to\x20update','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','\x20\x20📊\x20Segments:','Fetching\x20existing\x20folders...','targetDir','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','\x0aValidation\x20failed:','15451680gikBjB','Preparing\x20journeys...','\x20changed','No\x20','\x20unchanged','Folders\x20to\x20create:','\x20deleted','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','/e/','/app/ps/','created','helpText','segment','\x20\x20Journeys:\x20','no_parent','104dvPXTJ','\x20\x20\x20\x20','site','Error:\x20Directory\x20not\x20found:\x20','attributes','verbose','yamlConfig','toDelete','errorCode','nameToType','75321wDXKoH','updated','get','connection','segments','type','1479585WMyRkW','✔\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','then','Scoped\x20to\x20folder:\x20','journeyBundleName','results','Source\x20directory:\x20','Resolving\x20parent\x20segment\x20\x27','New\x20segment:','deleted','\x20\x20Segments:\x20','\x20activations]','7435GaBhRz','📁\x20','list','buildUserMaps','journeyBundleId','map','\x20updated','\x20created','user','listJourneysWithDetailsFromParentSegment','\x20\x20🗺️\x20\x20Journeys:','setPhase','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','folders','3162aGevGm','yellow','\x20folders\x20to\x20create','toUpdate','.yml','blue','parentFolder','\x20changes?','Aborted.','.yaml','segmentFolderId','2ptMGiy','folderPath','5163732HHMGWr','✔\x20All\x20journeys\x20are\x20up\x20to\x20date','paused','listFolders','\x0a✔\x20Push\x20complete','join','existingJourney','segment\x20or\x20journey','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','segment:push','isNew','Fetching\x20existing\x20segments...','toString','dim','Delete\x20segment:','file','journeysOnly','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','filter','endsWith','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file','Fetching\x20existing\x20journeys...','New\x20journey:','length','set','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','parent_name','changed','unchanged','data','getParent','Changes\x20to\x20journey:','\x20YAML\x20files\x20found','\x20\x20Activations:','961416fRXktT','journeyId','224nwfeIi','push','/j/da/je','repeat','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','Fetching\x20parent\x20segment\x20details...','createdAt','diff','delete','parentName','Error:\x20','\x27...','all'];a29_0x53e8=function(){return _0x4ee03b;};return a29_0x53e8();}import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{['name']=a29_0x2c3d15(0x241);[a29_0x2c3d15(0x1d5)]=a29_0x2c3d15(0x251);async[a29_0x2c3d15(0x1d4)](_0x141a60){const _0x564bf7=a29_0x2c3d15,{options:_0x364e84,args:_0x5cc4f4,tdx:_0x3e41d1}=_0x141a60,_0xbff4b2=_0x364e84,_0x4cc232=await resolveTarget({'arg':_0x5cc4f4[0x0],'contextParent':_0x364e84['parentSegment'],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x4cc232))return _0x4cc232[_0x564bf7(0x209)]===_0x564bf7(0x200)?(console[_0x564bf7(0x1e5)](a29_0x57bff8['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x564bf7(0x1e5)]('Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)'),console[_0x564bf7(0x1e5)](_0x564bf7(0x1f0)),console['error'](_0x564bf7(0x24c))):(console[_0x564bf7(0x1e5)](a29_0x57bff8[_0x564bf7(0x1d2)](_0x564bf7(0x1c8)+_0x4cc232[_0x564bf7(0x1e0)]+'\x0a')),_0x4cc232[_0x564bf7(0x1fd)]&&console[_0x564bf7(0x1e5)](a29_0x57bff8['cyan'](_0x4cc232[_0x564bf7(0x1fd)]))),0x1;if(_0x4cc232[_0x564bf7(0x210)]===_0x564bf7(0x252))return console[_0x564bf7(0x1e5)](a29_0x57bff8[_0x564bf7(0x1d2)](_0x564bf7(0x204)+_0x4cc232[_0x564bf7(0x1ef)]+'\x0a')),console[_0x564bf7(0x1e5)](a29_0x57bff8[_0x564bf7(0x1cc)](_0x564bf7(0x1f9))),0x1;const _0x1715fe=_0x4cc232[_0x564bf7(0x1c7)],_0x5319cf=_0x4cc232[_0x564bf7(0x1ef)],_0x31bb89=_0x4cc232[_0x564bf7(0x210)]===_0x564bf7(0x247)?_0x4cc232[_0x564bf7(0x1d8)]:undefined,_0x5c1d9a=getScopedDetails(_0x4cc232),_0x4c9c8d=_0x5c1d9a?.['isScoped']??![],_0x40e54b=_0x5c1d9a?.[_0x564bf7(0x1dc)]??'';if(!existsSync(_0x5319cf))return console[_0x564bf7(0x1e5)](a29_0x57bff8[_0x564bf7(0x1d2)](_0x564bf7(0x204)+_0x5319cf+'\x0a')),console[_0x564bf7(0x1e5)](a29_0x57bff8[_0x564bf7(0x1cc)]('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;_0xbff4b2[_0x564bf7(0x206)]&&(console[_0x564bf7(0x1e5)]('Site:\x20'+_0xbff4b2[_0x564bf7(0x203)]),console[_0x564bf7(0x1e5)]('Parent\x20segment:\x20'+_0x1715fe),console[_0x564bf7(0x1e5)](_0x564bf7(0x217)+_0x5319cf),_0x4c9c8d&&console['error'](_0x564bf7(0x214)+_0x40e54b));const _0x3bd9b4=await withSpinner(_0x564bf7(0x218)+_0x1715fe+_0x564bf7(0x1c9),()=>_0x3e41d1['segment'][_0x564bf7(0x1cf)](_0x1715fe),{'verbose':_0xbff4b2[_0x564bf7(0x206)]}),_0x486b22=_0x3bd9b4[_0x564bf7(0x1b7)],[_0x349980,_0x916f4,_0x359655,_0x2e5060,_0x321f02]=await Promise[_0x564bf7(0x1ca)]([withSpinner(_0x564bf7(0x1c3),()=>_0x3e41d1[_0x564bf7(0x1fe)][_0x564bf7(0x1b8)](_0x486b22),{'verbose':_0xbff4b2[_0x564bf7(0x206)]}),withSpinner(_0x564bf7(0x243),()=>_0x3e41d1[_0x564bf7(0x1fe)]['listSegments'](_0x486b22),{'verbose':_0xbff4b2['verbose']}),withSpinner(_0x564bf7(0x1ee),()=>_0x3e41d1['segment'][_0x564bf7(0x23b)](_0x486b22),{'verbose':_0xbff4b2['verbose']}),withSpinner(_0x564bf7(0x24d),()=>_0x3e41d1[_0x564bf7(0x1de)][_0x564bf7(0x226)](_0x486b22),{'verbose':_0xbff4b2[_0x564bf7(0x206)]}),withSpinner('Fetching\x20users\x20for\x20email\x20resolution...',()=>_0x3e41d1[_0x564bf7(0x225)][_0x564bf7(0x220)](),{'verbose':_0xbff4b2[_0x564bf7(0x206)]})[_0x564bf7(0x213)](_0x33027f=>_0x33027f['data'])]),_0x4bca0b=_0x349980[_0x564bf7(0x1b7)],_0x4e3151=extractRootFolderId(_0x4bca0b),_0x5b957c=_0x916f4[_0x564bf7(0x1b7)],_0x3aad06=_0x359655[_0x564bf7(0x1b7)],{journeys:_0x432906,activationStepsById:_0x18f394}=_0x2e5060[_0x564bf7(0x1b7)],_0x16fbe7=new Map(_0x432906['map'](_0x59c444=>[_0x59c444['id'],_0x59c444])),_0x27be1b=_0x432906['map'](_0xc55420=>({'id':_0xc55420['id'],'name':_0xc55420[_0x564bf7(0x205)][_0x564bf7(0x1e7)],'journeyBundleName':_0xc55420[_0x564bf7(0x205)][_0x564bf7(0x215)]||'','journeyBundleId':_0xc55420[_0x564bf7(0x205)][_0x564bf7(0x221)]||'','versionNumber':_0xc55420['attributes']['versionNumber'],'description':_0xc55420[_0x564bf7(0x205)][_0x564bf7(0x1d5)],'state':_0xc55420[_0x564bf7(0x205)]['state'],'paused':_0xc55420[_0x564bf7(0x205)][_0x564bf7(0x23a)],'audienceId':_0xc55420[_0x564bf7(0x205)]['audienceId'],'folderId':_0xc55420['relationships']?.[_0x564bf7(0x231)]?.['data']?.['id'],'createdAt':_0xc55420[_0x564bf7(0x205)][_0x564bf7(0x1c4)],'updatedAt':_0xc55420[_0x564bf7(0x205)]['updatedAt']})),{emailToId:_0x45d6fa,idToEmail:_0x18d96c}=_0x321f02,_0x5f46eb=await withSpinner(_0x564bf7(0x1ea),async()=>{const _0x55b53e=_0x564bf7,_0x140a65=await _0x3e41d1[_0x55b53e(0x20e)][_0x55b53e(0x21f)]();return buildConnectionMaps(_0x140a65);},{'verbose':_0xbff4b2['verbose']})[_0x564bf7(0x213)](_0x1511b8=>_0x1511b8['data']),_0x465c2f=_0x5f46eb['nameToId'],_0x3f55df=_0x5f46eb['idToName'],_0x51715e=_0x5f46eb[_0x564bf7(0x20a)],_0x3313df={'emailToIdMap':_0x45d6fa,'connectionNameToIdMap':_0x465c2f,'connectionNameToTypeMap':_0x51715e,'getSchema':_0x33685a=>_0x3e41d1[_0x564bf7(0x20e)][_0x564bf7(0x1d7)](_0x33685a)};let {pathToId:_0x1b75d9,idToPath:_0x305d57}=buildFolderMaps(_0x3aad06);const _0x47e3ed=buildSegmentLookupMap(_0x5b957c,_0x305d57),_0x5b61ff=buildSegmentNameToIdMap(_0x5b957c),_0x1f30e8=buildJourneyBundleLookupMap(_0x27be1b,_0x305d57);let _0x29ad8a;if(_0x31bb89){if(!_0x31bb89[_0x564bf7(0x24b)](_0x564bf7(0x22f))&&!_0x31bb89[_0x564bf7(0x24b)](_0x564bf7(0x234)))return console['error'](a29_0x57bff8['red'](_0x564bf7(0x1c2)+_0x31bb89+'\x0a')),0x1;_0x29ad8a=[_0x31bb89];}else _0x29ad8a=findYamlFiles(_0x5319cf);if(_0x29ad8a[_0x564bf7(0x24f)]===0x0)return console[_0x564bf7(0x1e5)](a29_0x57bff8['red'](_0x564bf7(0x249)+_0x5319cf+'\x0a')),console[_0x564bf7(0x1e5)](a29_0x57bff8['cyan'](_0x564bf7(0x1ec))),0x1;let _0x15f949,_0x26f58a;try{const _0x3c1807=parseAndClassifyYamlFiles(_0x29ad8a,_0x5319cf,{'skipSegments':_0xbff4b2[_0x564bf7(0x248)]});_0x15f949=_0x3c1807[_0x564bf7(0x20f)],_0x26f58a=_0x3c1807[_0x564bf7(0x1ce)];const _0x11d696=validateParsedFiles(_0x3c1807,_0x5319cf);if(_0x11d696[_0x564bf7(0x24f)]>0x0)return console[_0x564bf7(0x1e5)](a29_0x57bff8[_0x564bf7(0x1d2)](_0x564bf7(0x1f1))),console[_0x564bf7(0x1e5)](formatValidationErrors(_0x11d696)),console[_0x564bf7(0x1e5)](a29_0x57bff8[_0x564bf7(0x22c)](_0x564bf7(0x229))),0x1;}catch(_0x3bd83e){return console[_0x564bf7(0x1e5)](a29_0x57bff8[_0x564bf7(0x1d2)]('Error\x20parsing\x20YAML:\x20'+(_0x3bd83e instanceof Error?_0x3bd83e['message']:_0x3bd83e))),0x1;}if(_0x15f949[_0x564bf7(0x24f)]===0x0&&_0x26f58a[_0x564bf7(0x24f)]===0x0){const _0x24d0ab=_0xbff4b2['journeysOnly']?_0x564bf7(0x1de):_0x564bf7(0x23f);return console[_0x564bf7(0x1e5)](a29_0x57bff8['yellow'](_0x564bf7(0x1f5)+_0x24d0ab+_0x564bf7(0x1ba))),0x0;}const _0x4aca1c=new Map();_0x5b957c[_0x564bf7(0x24f)]>0x0&&!_0xbff4b2[_0x564bf7(0x248)]&&await withSpinner('Fetching\x20existing\x20activations...',async()=>{await batchAsync(_0x5b957c,async _0x4ec704=>{const _0xb77b26=a29_0x3df0,_0x17bdf7=await _0x3e41d1[_0xb77b26(0x1fe)]['listActivations'](_0x486b22,_0x4ec704['id']);_0x4aca1c[_0xb77b26(0x250)](_0x4ec704['id'],_0x17bdf7);});},{'verbose':_0xbff4b2[_0x564bf7(0x206)]});const {segmentFiles:_0xd09378,foldersToCreate:_0x25bcdb}=await prepareSegmentFiles(_0x15f949,{'segmentByFolderAndName':_0x47e3ed,'activationsBySegmentId':_0x4aca1c,'folderPathToId':_0x1b75d9,'idToEmailMap':_0x18d96c,'connectionIdToNameMap':_0x3f55df},_0x3313df,_0x4c9c8d,_0x40e54b),_0x2ead6b=_0x31bb89?[]:findSegmentsToDelete(_0x5b957c,_0x15f949['map'](({yamlConfig:_0x425623,folderPath:_0x131ad3})=>({'yamlConfig':_0x425623,'folderPath':resolveTDFolderPath(_0x131ad3,_0x4c9c8d,_0x40e54b)})),_0x305d57,_0x40e54b,_0x4c9c8d),{journeyFiles:_0x2d98f9,foldersToCreate:_0x1ed6e1}=await withProgressSpinner(_0x564bf7(0x1f3),async _0x3c6370=>prepareJourneyFiles(_0x26f58a,{'fetchJourney':async _0xdb2ba7=>_0x3e41d1[_0x564bf7(0x1de)][_0x564bf7(0x1d6)](_0xdb2ba7[_0x564bf7(0x1bd)]),'journeyBundlesByFolderAndName':_0x1f30e8,'folderPathToId':_0x1b75d9,'idToEmailMap':_0x18d96c,'connectionIdToNameMap':_0x3f55df,'existingSegments':_0x5b957c,'parentId':_0x486b22,'deps':_0x3e41d1,'progress':{'update':_0x364d96=>{const _0x1abeb9=_0x564bf7;_0x3c6370[_0x1abeb9(0x228)](_0x364d96),_0xbff4b2[_0x1abeb9(0x206)]&&console[_0x1abeb9(0x1e5)]('\x20\x20'+_0x364d96);}},'journeyById':_0x16fbe7,'activationStepsById':_0x18f394},_0x4c9c8d,_0x40e54b),{'verbose':_0xbff4b2['verbose']})[_0x564bf7(0x213)](_0x43e49d=>_0x43e49d[_0x564bf7(0x1b7)]);for(const _0x9742bc of _0x1ed6e1){_0x25bcdb[_0x564bf7(0x1d0)](_0x9742bc);}const _0x3a93b1=_0x31bb89?[]:findJourneysToDelete(_0x27be1b,_0x26f58a[_0x564bf7(0x222)](({yamlConfig:_0x5489ae,folderPath:_0x16b23c})=>({'yamlConfig':_0x5489ae,'folderPath':resolveTDFolderPath(_0x16b23c,_0x4c9c8d,_0x40e54b)})),_0x305d57,_0x40e54b,_0x4c9c8d),_0x38609e=calculatePushStats(_0xd09378,_0x2d98f9,_0x25bcdb,_0x2ead6b,_0x3a93b1,!!_0xbff4b2[_0x564bf7(0x1c6)],!!_0xbff4b2[_0x564bf7(0x248)]),_0x23f765=_0x38609e['segments'][_0x564bf7(0x1e1)],_0x46774c=_0x38609e[_0x564bf7(0x20f)][_0x564bf7(0x253)],_0x42e718=_0x38609e[_0x564bf7(0x20f)][_0x564bf7(0x1b6)],_0x15e42c=_0x38609e[_0x564bf7(0x20f)][_0x564bf7(0x208)],_0x4c0899=_0x38609e[_0x564bf7(0x22a)]['toCreate'],_0x5b17e6=_0x38609e[_0x564bf7(0x1ce)][_0x564bf7(0x1e1)],_0x3c3c7d=_0x38609e['journeys'][_0x564bf7(0x253)],_0x1badb2=_0x38609e[_0x564bf7(0x1ce)][_0x564bf7(0x1b6)],_0x1f2e89=_0x38609e[_0x564bf7(0x1ce)]['toDelete'],_0x6636b3=_0x38609e[_0x564bf7(0x1dd)][_0x564bf7(0x1ca)],_0x2db30c=_0x38609e['activations']['toCreate'],_0x277052=_0x38609e[_0x564bf7(0x1dd)][_0x564bf7(0x22e)],_0x2fcba0=_0x38609e[_0x564bf7(0x1dd)][_0x564bf7(0x208)];console[_0x564bf7(0x1e5)](_0x564bf7(0x1e9)+_0x1715fe+'\x27:');_0x4c0899[_0x564bf7(0x24f)]>0x0&&console[_0x564bf7(0x1e5)]('\x20\x20'+a29_0x57bff8[_0x564bf7(0x230)](_0x564bf7(0x21e)+_0x4c0899[_0x564bf7(0x24f)]+_0x564bf7(0x22d)));if(!_0xbff4b2[_0x564bf7(0x248)]){console['error'](_0x564bf7(0x1ed)),console[_0x564bf7(0x1e5)]('\x20\x20\x20\x20'+a29_0x57bff8['green']('+\x20'+_0x23f765[_0x564bf7(0x24f)]+_0x564bf7(0x1d9))),console[_0x564bf7(0x1e5)]('\x20\x20\x20\x20'+a29_0x57bff8[_0x564bf7(0x22c)]('~\x20'+_0x46774c['length']+_0x564bf7(0x1f4)));if(_0x15e42c[_0x564bf7(0x24f)]>0x0)console[_0x564bf7(0x1e5)](_0x564bf7(0x202)+a29_0x57bff8[_0x564bf7(0x1d2)]('-\x20'+_0x15e42c[_0x564bf7(0x24f)]+'\x20to\x20delete'));else _0x2ead6b[_0x564bf7(0x24f)]>0x0&&!_0xbff4b2[_0x564bf7(0x1c6)]&&console['error'](_0x564bf7(0x202)+a29_0x57bff8[_0x564bf7(0x245)](_0x2ead6b['length']+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x564bf7(0x1e5)](_0x564bf7(0x202)+a29_0x57bff8[_0x564bf7(0x245)]('=\x20'+_0x42e718[_0x564bf7(0x24f)]+'\x20unchanged'));}if(_0x2d98f9[_0x564bf7(0x24f)]>0x0||_0x3a93b1[_0x564bf7(0x24f)]>0x0){console[_0x564bf7(0x1e5)](_0x564bf7(0x227)),console[_0x564bf7(0x1e5)](_0x564bf7(0x202)+a29_0x57bff8['green']('+\x20'+_0x5b17e6[_0x564bf7(0x24f)]+'\x20new')),console[_0x564bf7(0x1e5)](_0x564bf7(0x202)+a29_0x57bff8[_0x564bf7(0x22c)]('~\x20'+_0x3c3c7d[_0x564bf7(0x24f)]+'\x20changed'));if(_0x1f2e89[_0x564bf7(0x24f)]>0x0)console[_0x564bf7(0x1e5)]('\x20\x20\x20\x20'+a29_0x57bff8[_0x564bf7(0x1d2)]('-\x20'+_0x1f2e89[_0x564bf7(0x24f)]+'\x20to\x20delete'));else _0x3a93b1['length']>0x0&&!_0xbff4b2[_0x564bf7(0x1c6)]&&console[_0x564bf7(0x1e5)](_0x564bf7(0x202)+a29_0x57bff8['dim'](_0x3a93b1[_0x564bf7(0x24f)]+_0x564bf7(0x1e2)));console[_0x564bf7(0x1e5)](_0x564bf7(0x202)+a29_0x57bff8[_0x564bf7(0x245)]('=\x20'+_0x1badb2[_0x564bf7(0x24f)]+_0x564bf7(0x1f6)));}_0x6636b3['length']>0x0&&!_0xbff4b2[_0x564bf7(0x248)]&&(console['error'](''),console['error'](_0x564bf7(0x1bb)),_0x2db30c['length']>0x0&&console[_0x564bf7(0x1e5)](_0x564bf7(0x202)+a29_0x57bff8[_0x564bf7(0x1e8)]('+\x20'+_0x2db30c['length']+_0x564bf7(0x1e6))),_0x277052[_0x564bf7(0x24f)]>0x0&&console[_0x564bf7(0x1e5)]('\x20\x20\x20\x20'+a29_0x57bff8[_0x564bf7(0x22c)]('~\x20'+_0x277052[_0x564bf7(0x24f)]+_0x564bf7(0x1eb))),_0x2fcba0[_0x564bf7(0x24f)]>0x0&&console['error'](_0x564bf7(0x202)+a29_0x57bff8[_0x564bf7(0x1d2)]('-\x20'+_0x2fcba0[_0x564bf7(0x24f)]+_0x564bf7(0x1d1))));console[_0x564bf7(0x1e5)](_0x564bf7(0x1db)+a29_0x57bff8['cyan'](_0x5319cf)+'\x0a');if(_0x4c0899[_0x564bf7(0x24f)]>0x0){console['error'](_0x564bf7(0x1f7));for(const _0x5c941d of _0x4c0899){console[_0x564bf7(0x1e5)]('\x20\x20'+a29_0x57bff8[_0x564bf7(0x230)]('+')+'\x20'+_0x5c941d);}console[_0x564bf7(0x1e5)]('');}if(_0x23f765[_0x564bf7(0x24f)]>0x0&&!_0xbff4b2[_0x564bf7(0x248)])for(const _0x3fe117 of _0x23f765){const _0x325345=_0x3fe117[_0x564bf7(0x237)]?_0x3fe117[_0x564bf7(0x237)]+'/'+_0x3fe117[_0x564bf7(0x207)][_0x564bf7(0x1e7)]:_0x3fe117[_0x564bf7(0x207)]['name'],_0x4f824b=_0x3fe117[_0x564bf7(0x207)][_0x564bf7(0x1dd)]?.[_0x564bf7(0x24f)]||0x0,_0x489c89=_0x4f824b>0x0?a29_0x57bff8['dim']('\x20['+_0x4f824b+'\x20activations]'):'';console[_0x564bf7(0x1e5)]('\x0a'+a29_0x57bff8[_0x564bf7(0x1e8)](_0x564bf7(0x219))+'\x20'+_0x325345+_0x489c89),console['error']('─'[_0x564bf7(0x1c1)](0x3c)),_0x3fe117[_0x564bf7(0x1c5)]&&console['error'](_0x3fe117[_0x564bf7(0x1c5)]),console[_0x564bf7(0x1e5)]('─'[_0x564bf7(0x1c1)](0x3c));}if(_0x15e42c['length']>0x0&&!_0xbff4b2[_0x564bf7(0x248)])for(const _0x3e819d of _0x15e42c){const _0x5d5d9d=_0x3e819d[_0x564bf7(0x235)]?_0x305d57[_0x564bf7(0x20d)](_0x3e819d[_0x564bf7(0x235)][_0x564bf7(0x244)]())||'':'',_0x4e6f72=_0x5d5d9d?_0x5d5d9d+'/'+_0x3e819d['name']:_0x3e819d[_0x564bf7(0x1e7)],_0x241b53=_0x4aca1c['get'](_0x3e819d['id'])||[],_0x503cdb=_0x241b53[_0x564bf7(0x24f)]>0x0?a29_0x57bff8['dim']('\x20['+_0x241b53[_0x564bf7(0x24f)]+_0x564bf7(0x21c)):'';console[_0x564bf7(0x1e5)]('\x0a'+a29_0x57bff8['red'](_0x564bf7(0x246))+'\x20'+_0x4e6f72+_0x503cdb),console[_0x564bf7(0x1e5)]('─'['repeat'](0x3c));const _0x402202=segmentWithActivationsToYaml(_0x3e819d,_0x241b53,undefined,_0x18d96c,_0x3f55df),_0x17c1f2=segmentToYamlString(_0x402202),_0x2d9058=generateDiff(_0x17c1f2,'');console['error'](formatDiffWithColors(_0x2d9058)),console[_0x564bf7(0x1e5)]('─'[_0x564bf7(0x1c1)](0x3c));}const _0x4a2bb5=_0xd09378[_0x564bf7(0x24a)](_0x319fe2=>!_0x319fe2[_0x564bf7(0x242)]&&_0x319fe2['diff']);if(_0x4a2bb5[_0x564bf7(0x24f)]>0x0&&!_0xbff4b2[_0x564bf7(0x248)])for(const _0x4d3b88 of _0x4a2bb5){const _0x178543=_0x4d3b88[_0x564bf7(0x237)]?_0x4d3b88['folderPath']+'/'+_0x4d3b88[_0x564bf7(0x207)][_0x564bf7(0x1e7)]:_0x4d3b88[_0x564bf7(0x207)][_0x564bf7(0x1e7)];console[_0x564bf7(0x1e5)]('\x0a'+a29_0x57bff8['yellow'](_0x564bf7(0x1da))+'\x20'+_0x178543),console[_0x564bf7(0x1e5)]('─'[_0x564bf7(0x1c1)](0x3c)),console[_0x564bf7(0x1e5)](_0x4d3b88[_0x564bf7(0x1c5)]),console[_0x564bf7(0x1e5)]('─'['repeat'](0x3c));}if(_0x5b17e6[_0x564bf7(0x24f)]>0x0)for(const _0x1dd694 of _0x5b17e6){const _0x3c51cb=_0x1dd694[_0x564bf7(0x237)]?_0x1dd694[_0x564bf7(0x237)]+'/'+_0x1dd694[_0x564bf7(0x207)][_0x564bf7(0x1e7)]:_0x1dd694['yamlConfig'][_0x564bf7(0x1e7)];console[_0x564bf7(0x1e5)]('\x0a'+a29_0x57bff8['green'](_0x564bf7(0x24e))+'\x20'+_0x3c51cb),console[_0x564bf7(0x1e5)]('─'[_0x564bf7(0x1c1)](0x3c)),_0x1dd694[_0x564bf7(0x1c5)]&&console[_0x564bf7(0x1e5)](_0x1dd694[_0x564bf7(0x1c5)]),console['error']('─'[_0x564bf7(0x1c1)](0x3c));}const _0x5b32a1=_0x2d98f9[_0x564bf7(0x24a)](_0x4570f2=>!_0x4570f2[_0x564bf7(0x242)]&&_0x4570f2[_0x564bf7(0x1c5)]);if(_0x5b32a1[_0x564bf7(0x24f)]>0x0)for(const _0x4e4ecd of _0x5b32a1){const _0xe6b659=_0x4e4ecd[_0x564bf7(0x237)]?_0x4e4ecd[_0x564bf7(0x237)]+'/'+_0x4e4ecd['yamlConfig'][_0x564bf7(0x1e7)]:_0x4e4ecd[_0x564bf7(0x207)]['name'];console[_0x564bf7(0x1e5)]('\x0a'+a29_0x57bff8[_0x564bf7(0x22c)](_0x564bf7(0x1b9))+'\x20'+_0xe6b659),console[_0x564bf7(0x1e5)]('─'['repeat'](0x3c)),console[_0x564bf7(0x1e5)](_0x4e4ecd[_0x564bf7(0x1c5)]),console['error']('─'[_0x564bf7(0x1c1)](0x3c));}if(_0x1f2e89[_0x564bf7(0x24f)]>0x0)for(const _0x51ee0d of _0x1f2e89){const _0x426688=_0x51ee0d[_0x564bf7(0x1df)]?_0x305d57[_0x564bf7(0x20d)](_0x51ee0d[_0x564bf7(0x1df)])||'':'',_0x5ee445=_0x426688?_0x426688+'/'+_0x51ee0d[_0x564bf7(0x215)]:_0x51ee0d[_0x564bf7(0x215)];console[_0x564bf7(0x1e5)]('\x0a'+a29_0x57bff8[_0x564bf7(0x1d2)]('Delete\x20journey:')+'\x20'+_0x5ee445),console['error']('─'[_0x564bf7(0x1c1)](0x3c)),console[_0x564bf7(0x1e5)](a29_0x57bff8[_0x564bf7(0x1d2)]('(Journey\x20will\x20be\x20deleted)')),console[_0x564bf7(0x1e5)]('─'[_0x564bf7(0x1c1)](0x3c));}if(_0xbff4b2['dryRun'])return console['error'](a29_0x57bff8[_0x564bf7(0x22c)](_0x564bf7(0x240))),0x0;const _0x1e8353=_0xbff4b2[_0x564bf7(0x248)]?![]:_0x23f765[_0x564bf7(0x24f)]>0x0||_0x46774c[_0x564bf7(0x24f)]>0x0||_0x15e42c[_0x564bf7(0x24f)]>0x0,_0x2faaa6=_0x5b17e6[_0x564bf7(0x24f)]>0x0||_0x3c3c7d['length']>0x0||_0x1f2e89[_0x564bf7(0x24f)]>0x0,_0x3c1cf0=_0xbff4b2['journeysOnly']?![]:_0x6636b3['length']>0x0,_0x1d1429=_0x4c0899['length']>0x0;if(!_0x1e8353&&!_0x2faaa6&&!_0x3c1cf0&&!_0x1d1429){const _0x2d4e49=_0xbff4b2[_0x564bf7(0x248)]?_0x564bf7(0x239):_0x564bf7(0x212);console[_0x564bf7(0x1e5)](a29_0x57bff8[_0x564bf7(0x1e8)](_0x2d4e49));if(_0x31bb89&&_0x1badb2[_0x564bf7(0x24f)]===0x1){const _0x3788a3=_0x1badb2[0x0];if(_0x3788a3[_0x564bf7(0x23e)]?.['id']){const _0x4ca696=getConsoleNextUrl(_0xbff4b2[_0x564bf7(0x203)],_0x564bf7(0x1fb)+_0x486b22+_0x564bf7(0x1fa)+_0x3788a3[_0x564bf7(0x23e)]['id']+_0x564bf7(0x1c0));console[_0x564bf7(0x1e5)]('\x20\x20'+a29_0x57bff8[_0x564bf7(0x1cc)](_0x4ca696));}}return 0x0;}const _0x4dae83=_0xbff4b2[_0x564bf7(0x248)]?_0x5b17e6[_0x564bf7(0x24f)]+_0x3c3c7d['length']+_0x1f2e89[_0x564bf7(0x24f)]+_0x4c0899[_0x564bf7(0x24f)]:_0x23f765[_0x564bf7(0x24f)]+_0x46774c[_0x564bf7(0x24f)]+_0x15e42c[_0x564bf7(0x24f)]+_0x5b17e6[_0x564bf7(0x24f)]+_0x3c3c7d[_0x564bf7(0x24f)]+_0x1f2e89[_0x564bf7(0x24f)]+_0x4c0899[_0x564bf7(0x24f)]+_0x6636b3[_0x564bf7(0x24f)];if(!_0xbff4b2['yes']&&_0x4dae83>0x0){const _0x5b93ff=await confirmKey(_0x564bf7(0x1e4)+_0x4dae83+_0x564bf7(0x232));if(!_0x5b93ff)return console[_0x564bf7(0x1e5)](_0x564bf7(0x233)),0x1;}const _0x1c0cd8={'withProgress':async(_0x3229ea,_0x22c69b)=>{const _0x317ab4=_0x564bf7,_0x500cc5=await withSpinner(_0x3229ea,_0x22c69b,{'verbose':_0xbff4b2[_0x317ab4(0x206)]});return{'data':_0x500cc5[_0x317ab4(0x1b7)]};},'logInfo':_0x4a6cd4=>console['error'](a29_0x57bff8[_0x564bf7(0x230)]('✔\x20'+_0x4a6cd4)),'logSuccess':_0x32986b=>console[_0x564bf7(0x1e5)](a29_0x57bff8['green']('✔\x20'+_0x32986b)),'logWarning':_0x4425a4=>console[_0x564bf7(0x1e5)](a29_0x57bff8['yellow']('⚠\x20'+_0x4425a4)),'logDeleted':_0x327d9b=>console[_0x564bf7(0x1e5)](a29_0x57bff8[_0x564bf7(0x1d2)]('✔\x20'+_0x327d9b))},_0x26e833={'segment':_0x3e41d1[_0x564bf7(0x1fe)],'journey':_0x3e41d1['journey'],'user':_0x3e41d1[_0x564bf7(0x225)],'connection':_0x3e41d1[_0x564bf7(0x20e)]};_0x4c0899[_0x564bf7(0x24f)]>0x0&&(_0x1b75d9=await executePushFolders(_0x26e833,_0x4c0899,_0x1b75d9,{'parentId':_0x486b22},_0x1c0cd8));const _0x17336e={'rootFolderId':_0x4e3151,'folderPathToId':_0x1b75d9,'folderIdToPath':_0x305d57,'segmentNameToId':_0x5b61ff,'activationsBySegmentId':_0x4aca1c,'emailToIdMap':_0x45d6fa,'idToEmailMap':_0x18d96c,'connectionNameToIdMap':_0x5f46eb[_0x564bf7(0x1cb)],'connectionIdToNameMap':_0x5f46eb[_0x564bf7(0x1d3)],'connectionNameToTypeMap':_0x51715e},_0x57b598=await executePushSegments(_0x26e833,_0xbff4b2[_0x564bf7(0x248)]?[]:_0xd09378,_0x17336e,{'parentId':_0x486b22},_0x1c0cd8),_0x3ad85e=_0x57b598[_0x564bf7(0x1fc)],_0x53c002=_0x57b598[_0x564bf7(0x20c)],_0x40bf85=_0x57b598[_0x564bf7(0x1dd)][_0x564bf7(0x1fc)],_0x108434=_0x57b598[_0x564bf7(0x1dd)][_0x564bf7(0x20c)],_0x38dcec=_0x57b598[_0x564bf7(0x1dd)][_0x564bf7(0x21a)],_0x3981a4=await executePushSegmentDeletions(_0x26e833,_0xbff4b2[_0x564bf7(0x248)]?[]:_0x15e42c,_0x1c0cd8);let _0x21b865=0x0,_0x3d6f62=0x0,_0x509c88=0x0;const _0xc9eb6a=new Map(_0x5b61ff);for(const [_0x1b2e09,_0x3c92a4]of _0x57b598[_0x564bf7(0x1cd)]){_0xc9eb6a[_0x564bf7(0x250)](_0x1b2e09,_0x3c92a4);}if(_0x2d98f9['length']>0x0){const _0x529349={..._0x17336e,'segmentNameToId':_0xc9eb6a,'existingSegments':_0x5b957c,'activationContext':_0x3313df},_0xb12e38=await executePushJourneys(_0x26e833,_0x2d98f9,_0x529349,{'parentId':_0x486b22,'rootFolderId':_0x4e3151,'verbose':_0xbff4b2['verbose']},_0x1c0cd8);_0x21b865=_0xb12e38['created'],_0x3d6f62=_0xb12e38[_0x564bf7(0x20c)];if(_0x31bb89&&_0xb12e38[_0x564bf7(0x216)][_0x564bf7(0x24f)]===0x1){const _0x167f95=_0xb12e38['results'][0x0];if(_0x167f95[_0x564bf7(0x1bd)]){const _0x451610=getConsoleNextUrl(_0xbff4b2[_0x564bf7(0x203)],_0x564bf7(0x1fb)+_0x486b22+_0x564bf7(0x1fa)+_0x167f95['journeyId']+'/j/da/je');console['error']('\x20\x20'+a29_0x57bff8[_0x564bf7(0x1cc)](_0x451610));}}}for(const _0x2b8d6f of _0x1f2e89){console[_0x564bf7(0x1e5)](a29_0x57bff8[_0x564bf7(0x22c)]('⚠\x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20'+_0x2b8d6f[_0x564bf7(0x215)])),_0x509c88++;}const _0x549aa0=[];if(_0x3ad85e>0x0)_0x549aa0[_0x564bf7(0x1bf)](_0x3ad85e+_0x564bf7(0x224));if(_0x53c002>0x0)_0x549aa0[_0x564bf7(0x1bf)](_0x53c002+'\x20updated');if(_0x3981a4>0x0)_0x549aa0[_0x564bf7(0x1bf)](_0x3981a4+'\x20deleted');const _0x3111b0=[];if(_0x21b865>0x0)_0x3111b0[_0x564bf7(0x1bf)](_0x21b865+_0x564bf7(0x224));if(_0x3d6f62>0x0)_0x3111b0['push'](_0x3d6f62+_0x564bf7(0x223));if(_0x509c88>0x0)_0x3111b0[_0x564bf7(0x1bf)](_0x509c88+'\x20deleted');const _0x437b4a=[];if(_0x40bf85>0x0)_0x437b4a['push'](_0x40bf85+_0x564bf7(0x224));if(_0x108434>0x0)_0x437b4a[_0x564bf7(0x1bf)](_0x108434+_0x564bf7(0x223));if(_0x38dcec>0x0)_0x437b4a[_0x564bf7(0x1bf)](_0x38dcec+_0x564bf7(0x1f8));return console[_0x564bf7(0x1e5)](a29_0x57bff8[_0x564bf7(0x1e8)](_0x564bf7(0x23c))),_0x549aa0[_0x564bf7(0x24f)]>0x0&&!_0xbff4b2[_0x564bf7(0x248)]&&console[_0x564bf7(0x1e5)](_0x564bf7(0x21b)+_0x549aa0[_0x564bf7(0x23d)](',\x20')),_0x3111b0[_0x564bf7(0x24f)]>0x0&&console[_0x564bf7(0x1e5)](_0x564bf7(0x1ff)+_0x3111b0[_0x564bf7(0x23d)](',\x20')),_0x437b4a['length']>0x0&&!_0xbff4b2['journeysOnly']&&console[_0x564bf7(0x1e5)]('\x20\x20Activations:\x20'+_0x437b4a[_0x564bf7(0x23d)](',\x20')),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a30_0x2d7abf=a30_0x2a02;function a30_0x2a02(_0x4e559b,_0xd8ae49){_0x4e559b=_0x4e559b-0x1d9;const _0x52f8e2=a30_0x52f8();let _0x2a029e=_0x52f8e2[_0x4e559b];return _0x2a029e;}(function(_0x12ea39,_0x588f75){const _0x100dcd=a30_0x2a02,_0x4ae9a5=_0x12ea39();while(!![]){try{const _0x4e9495=parseInt(_0x100dcd(0x1f1))/0x1*(parseInt(_0x100dcd(0x205))/0x2)+-parseInt(_0x100dcd(0x1e5))/0x3+parseInt(_0x100dcd(0x1dc))/0x4*(-parseInt(_0x100dcd(0x1df))/0x5)+-parseInt(_0x100dcd(0x207))/0x6*(-parseInt(_0x100dcd(0x1db))/0x7)+parseInt(_0x100dcd(0x1de))/0x8+parseInt(_0x100dcd(0x20e))/0x9*(parseInt(_0x100dcd(0x1f3))/0xa)+parseInt(_0x100dcd(0x1ff))/0xb*(-parseInt(_0x100dcd(0x1f0))/0xc);if(_0x4e9495===_0x588f75)break;else _0x4ae9a5['push'](_0x4ae9a5['shift']());}catch(_0xcd5a22){_0x4ae9a5['push'](_0x4ae9a5['shift']());}}}(a30_0x52f8,0x75b3a));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';function a30_0x52f8(){const _0x3235f3=['resolvePathToResource','1844194yiBGOF','Segment\x20ID\x20missing\x20from\x20resolved\x20path','yellow','Resolved\x20type:\x20','updateSegmentById','kind','2pQGzkI','length','108MSdNYb','segmentName','segment:update','description','INTERNAL','\x20\x20\x20Path:\x20','\x20\x20tdx\x20segment\x20update\x20\x22My\x20Audience/High\x20Value\x22\x20--description\x20\x22...\x22','28818WMICVN','Use:\x20tdx\x20segment\x20update\x20<path_to_segment>\x20[options]','error','239351rYhoMU','4316FQAGaJ','name','730424vxOuPa','2195rBySDP','Examples:','resolveFolderId','\x20\x20tdx\x20segment\x20update\x20\x22High\x20Value\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','type','Resolving\x20folder\x20\x27','787581dNOqmV','Parent\x20ID:\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','ruleFile','.\x20Only\x20child\x20segments\x20can\x20be\x20updated.','✔\x20Updated\x20segment\x20\x27','segmentId','Error:\x20Cannot\x20update\x20','rule','includes','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','24SSzCcf','843643qOoVrq','Resolved\x20folder\x20ID:\x20','10CHNCef','segmentPath','folder','execute','Updating\x20segment\x20\x27','verbose','data','\x27...','Resolving\x20path\x20\x27','segment','Segment\x20ID:\x20'];a30_0x52f8=function(){return _0x3235f3;};return a30_0x52f8();}import a30_0x32f2ba from'chalk';export class SegmentUpdateCommand extends BaseCommand{[a30_0x2d7abf(0x1dd)]=a30_0x2d7abf(0x209);['description']='Update\x20existing\x20child\x20segment';async[a30_0x2d7abf(0x1f6)](_0x2ed53d){const _0x50c6d5=a30_0x2d7abf;console[_0x50c6d5(0x1da)](a30_0x32f2ba[_0x50c6d5(0x201)]('⚠\x20Deprecation\x20warning:\x20`segment\x20update`\x20is\x20deprecated.')),console[_0x50c6d5(0x1da)](a30_0x32f2ba['yellow'](_0x50c6d5(0x1e7)));const {options:_0x3643c8,args:_0x147d5f,tdx:_0xe228d0}=_0x2ed53d,_0x4869ba=_0x3643c8;if(_0x147d5f[_0x50c6d5(0x206)]===0x0)return console[_0x50c6d5(0x1da)](_0x50c6d5(0x1ef)),console[_0x50c6d5(0x1da)]('Usage:\x20tdx\x20segment\x20update\x20<path>\x20[options]'),console[_0x50c6d5(0x1da)](_0x50c6d5(0x1e0)),console[_0x50c6d5(0x1da)](_0x50c6d5(0x20d)),console[_0x50c6d5(0x1da)](_0x50c6d5(0x1e2)),0x1;const _0xb887b9=_0x147d5f[0x0],_0x3140fa=_0x3643c8[_0x50c6d5(0x1f4)];let _0x8159cf=_0xb887b9;_0x3140fa&&!_0xb887b9[_0x50c6d5(0x1ee)]('/')&&(_0x8159cf=_0x3140fa+'/'+_0xb887b9,_0x4869ba[_0x50c6d5(0x1f8)]&&console[_0x50c6d5(0x1da)]('Resolved\x20relative\x20path\x20to:\x20'+_0x8159cf));const _0x1f02ec=await withSpinner(_0x50c6d5(0x1fb)+_0x8159cf+_0x50c6d5(0x1fa),()=>_0xe228d0['segment'][_0x50c6d5(0x1fe)](_0x8159cf),{'verbose':_0x4869ba[_0x50c6d5(0x1f8)]}),_0x4abf09=_0x1f02ec[_0x50c6d5(0x1f9)];_0x4869ba[_0x50c6d5(0x1f8)]&&console[_0x50c6d5(0x1da)](_0x50c6d5(0x202)+_0x4abf09[_0x50c6d5(0x1e3)]);if(_0x4abf09['type']!=='segment')return console['error'](_0x50c6d5(0x1ec)+_0x4abf09[_0x50c6d5(0x1e3)]+_0x50c6d5(0x1e9)),console[_0x50c6d5(0x1da)](_0x50c6d5(0x1d9)),0x1;if(!_0x4abf09[_0x50c6d5(0x1eb)])throw new SDKError(ErrorCode[_0x50c6d5(0x20b)],_0x50c6d5(0x200));const _0x7abb57=_0x4abf09['parentId'],_0xd79b27=_0x4abf09['segmentId'];_0x4869ba['verbose']&&(console[_0x50c6d5(0x1da)](_0x50c6d5(0x1e6)+_0x7abb57),console[_0x50c6d5(0x1da)](_0x50c6d5(0x1fd)+_0xd79b27));let _0x3d0b13;if(_0x4869ba[_0x50c6d5(0x1f5)]){const _0x33a170=_0x4869ba[_0x50c6d5(0x1f5)],_0x174f79=await withSpinner(_0x50c6d5(0x1e4)+_0x33a170+_0x50c6d5(0x1fa),()=>_0xe228d0['segment'][_0x50c6d5(0x1e1)](_0x7abb57,_0x33a170),{'verbose':_0x4869ba[_0x50c6d5(0x1f8)]});_0x3d0b13=parseInt(_0x174f79['data'],0xa),_0x4869ba[_0x50c6d5(0x1f8)]&&console[_0x50c6d5(0x1da)](_0x50c6d5(0x1f2)+_0x3d0b13);}const _0x44b881=await loadJSONFromOptions(_0x4869ba[_0x50c6d5(0x1ed)],_0x4869ba[_0x50c6d5(0x1e8)]),_0x13b43d={'name':_0x4869ba['name'],'description':_0x4869ba[_0x50c6d5(0x20a)],'rule':_0x44b881,'kind':_0x4869ba[_0x50c6d5(0x204)]!==undefined?parseInt(_0x4869ba[_0x50c6d5(0x204)],0xa):undefined,'segmentFolderId':_0x3d0b13},_0x3d5021=await withSpinner(_0x50c6d5(0x1f7)+_0x4abf09[_0x50c6d5(0x208)]+_0x50c6d5(0x1fa),()=>_0xe228d0[_0x50c6d5(0x1fc)][_0x50c6d5(0x203)](_0x7abb57,_0xd79b27,_0x13b43d),{'verbose':_0x4869ba[_0x50c6d5(0x1f8)]}),_0x350375=_0x3d5021[_0x50c6d5(0x1f9)];return console[_0x50c6d5(0x1da)](_0x50c6d5(0x1ea)+_0x350375[_0x50c6d5(0x1dd)]+'\x27'),_0x8159cf!==_0xb887b9&&console[_0x50c6d5(0x1da)](_0x50c6d5(0x20c)+_0x8159cf),await handleSDKOutput([_0x350375],_0x4869ba),0x0;}}
|