@treasuredata/tdx 0.8.11 → 0.9.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.d.ts +1 -1
- package/dist/cli-categories.js +1 -1
- package/dist/cli-categories.js.map +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/client/cdp-api-client.js +1 -1
- package/dist/client/engage-api-client.js +1 -1
- package/dist/client/http-client.js +1 -1
- package/dist/client/llm-api-client.d.ts +88 -0
- package/dist/client/llm-api-client.d.ts.map +1 -1
- package/dist/client/llm-api-client.js +1 -1
- package/dist/client/llm-api-client.js.map +1 -1
- package/dist/client/rate-limiter.js +1 -1
- package/dist/client/td-api-client.js +1 -1
- package/dist/client/trino-api-client.js +1 -1
- package/dist/client/workflow-client.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.d.ts +32 -0
- package/dist/commands/agent-command.d.ts.map +1 -0
- package/dist/commands/agent-command.js +1 -0
- package/dist/commands/agent-command.js.map +1 -0
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.d.ts +3 -2
- package/dist/commands/chat-command.d.ts.map +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/chat-command.js.map +1 -1
- package/dist/commands/claude-command.d.ts +23 -0
- package/dist/commands/claude-command.d.ts.map +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-command.js.map +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.d.ts +12 -0
- package/dist/commands/journey-command.d.ts.map +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-command.js.map +1 -1
- package/dist/commands/llm-command.d.ts +8 -4
- package/dist/commands/llm-command.d.ts.map +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-command.js.map +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.d.ts.map +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-push-command.js.map +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segments.d.ts.map +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/segments.js.map +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/use-command.d.ts +1 -0
- package/dist/commands/use-command.d.ts.map +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/use-command.js.map +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/config.d.ts +32 -0
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/config.js.map +1 -1
- package/dist/core/connection-cache.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-yaml.d.ts +386 -0
- package/dist/sdk/agent/agent-yaml.d.ts.map +1 -0
- package/dist/sdk/agent/agent-yaml.js +1 -0
- package/dist/sdk/agent/agent-yaml.js.map +1 -0
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.d.ts +6 -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/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm.d.ts +114 -0
- package/dist/sdk/llm.d.ts.map +1 -1
- package/dist/sdk/llm.js +1 -1
- package/dist/sdk/llm.js.map +1 -1
- package/dist/sdk/query.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.d.ts +4 -0
- package/dist/sdk/segment/child-segment-yaml.d.ts.map +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
- package/dist/sdk/segment/journey-yaml.d.ts +13 -1
- package/dist/sdk/segment/journey-yaml.d.ts.map +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/journey-yaml.js.map +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.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/workflow.js +1 -1
- package/dist/types/endpoints.d.ts +17 -0
- package/dist/types/endpoints.d.ts.map +1 -1
- package/dist/types/endpoints.js +1 -1
- package/dist/types/endpoints.js.map +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/llm.d.ts +203 -0
- package/dist/types/llm.d.ts.map +1 -1
- package/dist/utils/agent-config.d.ts +124 -0
- package/dist/utils/agent-config.d.ts.map +1 -0
- package/dist/utils/agent-config.js +1 -0
- package/dist/utils/agent-config.js.map +1 -0
- package/dist/utils/agent-ref-parser.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/chat-cache.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/command-output.js +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/fields-display.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/format-detector.js +1 -1
- package/dist/utils/formatters.js +1 -1
- package/dist/utils/journey-utils.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/llm-backup-utils.js +1 -1
- package/dist/utils/model-aliases.js +1 -1
- package/dist/utils/model-factors.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/segment-path-parser.js +1 -1
- package/dist/utils/segment-ref-parser.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sql-parser.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-config.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/tree-formatter.d.ts +2 -0
- package/dist/utils/tree-formatter.d.ts.map +1 -1
- package/dist/utils/tree-formatter.js +1 -1
- package/dist/utils/tree-formatter.js.map +1 -1
- package/dist/utils/version-check.js +1 -1
- package/dist/utils/workflow-utils.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a31_0x1537fe=a31_0x4a9a;(function(_0x4e7692,_0xa484b4){const _0x2bc9f5=a31_0x4a9a,_0x5c1076=_0x4e7692();while(!![]){try{const _0x348c01=-parseInt(_0x2bc9f5(0xf4))/0x1+-parseInt(_0x2bc9f5(0x139))/0x2*(-parseInt(_0x2bc9f5(0x11a))/0x3)+parseInt(_0x2bc9f5(0xa0))/0x4*(-parseInt(_0x2bc9f5(0xb7))/0x5)+-parseInt(_0x2bc9f5(0xec))/0x6+-parseInt(_0x2bc9f5(0xe1))/0x7+parseInt(_0x2bc9f5(0xe5))/0x8+-parseInt(_0x2bc9f5(0x115))/0x9*(-parseInt(_0x2bc9f5(0xf8))/0xa);if(_0x348c01===_0xa484b4)break;else _0x5c1076['push'](_0x5c1076['shift']());}catch(_0x3c329d){_0x5c1076['push'](_0x5c1076['shift']());}}}(a31_0x1d49,0x7b89f));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner,withQuerySpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../utils/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import{executeSchemaQuery}from'../utils/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../utils/segment-path-parser.js';function a31_0x1d49(){const _0x30486e=['processedRows','length','Parent\x20name:\x20','SEGMENT_FOLDER_NOT_FOUND','segment:folder:create','10eaQNjw','Use:\x20tdx\x20ps\x20desc','Usage:\x20tdx\x20sg\x20desc\x20<name>','web','Error:\x20Folder\x20reference\x20is\x20required','/app/ps/','Site:\x20','Use:\x20tdx\x20ps\x20view\x20-w','listFolders','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','✔\x20Created\x20folder\x20\x27','segment:view','parentId','error','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','\x20\x20Segment\x20name:\x20','Fetching\x20SQL\x20for\x20segment...','Usage:\x20tdx\x20segment\x20describe\x20<path>','data','parentSegment','test','Fetching\x20segment\x20details...','\x20\x20Folder\x20path:\x20','Error:\x20Path\x20or\x20name\x20is\x20required','Show\x20segment\x20folder\x20details','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','parent','name','✔\x20Query\x20completed:\x20Processed\x20','getFolder','parentFolder','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','replace','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','Listing\x20folders\x20for\x20parent\x20\x27','Resolved\x20relative\x20path\x20to:\x20','\x20Opening\x20','Show\x20child\x20segment\x20schema\x20(column\x20types)','toLocaleString','execute','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','2774800OGCEKL','Fetching\x20folder\x20details...','getSegment','Segment\x20ID:\x20','6559872eLxbLr','Options:','resolvePathToResource','INVALID_ARGUMENT','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Use:\x20tdx\x20ps\x20show','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','4003926tElhkS','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','query','segmentName','Folder\x20name:\x20','verbose','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','555200wVDNrg','jobId','format','segment:folder:show','39390bWCGXG','code','/e/','✔\x20Found\x20','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Show\x20folder\x20or\x20child\x20segment\x20details','Resolved\x20parent\x20ID:\x20','segment:describe','setJobId','\x27\x20with\x20ID:\x20','Resolved\x20type:\x20','Resolving\x20parent\x20folder\x20\x27','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','in\x20','segment:desc','Use:\x20tdx\x20ps\x20view','description','(root)','\x20\x20Parent\x20segment:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Error:\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','resolveFolderId','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Usage:\x20tdx\x20sg\x20sql\x20<name>','green','3582hYSvvy','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','\x20rows\x20','3kkFaba','segment','message','Error:\x20Parent\x20segment\x20name\x20is\x20required','json','SQL\x20query:\x0a','\x20\x20Cause:\x20','url','Show\x20segment\x20or\x20folder\x20details','Examples:','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Resolving\x20parent\x20segment\x20\x27','segment:folder:list','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Resolved\x20YAML\x20file:\x20','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','getSegmentSQL','Executing\x20segment\x20query...','Creating\x20folder\x20\x27','trim','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Target\x20path:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','type','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','createFolder','Fetching\x20folder\x20\x27','Folder\x20ID\x20missing\x20from\x20resolved\x20path','719848PSLniO','elapsedTimeMillis','\x27...','1245388WVMYGm','Resolving\x20folder\x20\x27','fullPath','resolveParentId','segmentId','folder','log','Parent\x20ID:\x20','cause','Folder\x20ID:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','segment:sql','SEGMENT_NOT_FOUND','Resolving\x20\x27','folderId','site','folderPath','Resolved\x20parent\x20folder\x20ID:\x20'];a31_0x1d49=function(){return _0x30486e;};return a31_0x1d49();}import{getConsoleNextUrl}from'../types/endpoints.js';import{openBrowser}from'../utils/process.js';import a31_0x447bcc from'chalk';function resolveSegmentTarget(_0x3d795d,_0x505f88,_0x29dfb9){const _0x1ec324=a31_0x4a9a;if(isYamlFilePath(_0x3d795d))try{const _0x32eac4=resolveYamlFilePath(_0x3d795d);return _0x29dfb9&&(console[_0x1ec324(0xc5)](_0x1ec324(0x128)+_0x3d795d),console[_0x1ec324(0xc5)](_0x1ec324(0x10c)+_0x32eac4[_0x1ec324(0xcb)]),console[_0x1ec324(0xc5)](_0x1ec324(0xc7)+_0x32eac4[_0x1ec324(0xf0)]),console[_0x1ec324(0xc5)](_0x1ec324(0xce)+(_0x32eac4[_0x1ec324(0xb0)]||_0x1ec324(0x10b))),console[_0x1ec324(0xc5)]('\x20\x20Full\x20path:\x20'+_0x32eac4[_0x1ec324(0xa2)])),_0x32eac4[_0x1ec324(0xa2)];}catch(_0xf97541){throw new SDKError(ErrorCode[_0x1ec324(0xe8)],_0x1ec324(0xc6)+_0xf97541[_0x1ec324(0x11c)]);}if(!_0x505f88)throw new SDKError(ErrorCode[_0x1ec324(0xe8)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x505f88+'/'+_0x3d795d;}export class SegmentDescribeCommand extends BaseCommand{['name']=a31_0x1537fe(0x100);['description']=a31_0x1537fe(0x122);async[a31_0x1537fe(0xdf)](_0x30bf2c){const _0x2dee87=a31_0x1537fe,{options:_0x58b349,args:_0x4f3966,tdx:_0x2ea92f}=_0x30bf2c,_0x5b433e=_0x4f3966[0x0],_0x14aaaa=!_0x5b433e&&!!_0x58b349['parentSegment'],_0x476311=_0x5b433e||_0x58b349['parentSegment'];if(!_0x476311)return console[_0x2dee87(0xc5)](_0x2dee87(0xcf)),console['error'](_0x2dee87(0xc9)),console[_0x2dee87(0xc5)]('Examples:'),console[_0x2dee87(0xc5)](_0x2dee87(0x124)),console[_0x2dee87(0xc5)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console[_0x2dee87(0xc5)](_0x2dee87(0xaa)),console[_0x2dee87(0xc5)](_0x2dee87(0xe0)),0x1;try{const _0x2161c0=_0x58b349['segmentPath'];let _0x3a8886=_0x476311;!_0x14aaaa&&_0x2161c0&&!_0x476311['includes']('/')&&(_0x3a8886=_0x2161c0+'/'+_0x476311,_0x58b349[_0x2dee87(0xf2)]&&console[_0x2dee87(0xc5)](_0x2dee87(0xdb)+_0x3a8886));const _0x3dc1b9=await withSpinner('Resolving\x20path\x20\x27'+_0x3a8886+'\x27...',()=>_0x2ea92f[_0x2dee87(0x11b)]['resolvePathToResource'](_0x3a8886),{'verbose':_0x58b349[_0x2dee87(0xf2)]}),_0x43b7f6=_0x3dc1b9[_0x2dee87(0xca)];_0x58b349['verbose']&&(console['error']('Resolved\x20type:\x20'+_0x43b7f6[_0x2dee87(0x132)]),console[_0x2dee87(0xc5)](_0x2dee87(0xa7)+_0x43b7f6[_0x2dee87(0xc4)]),_0x43b7f6['folderId']&&console[_0x2dee87(0xc5)](_0x2dee87(0xa9)+_0x43b7f6[_0x2dee87(0xae)]),_0x43b7f6[_0x2dee87(0xa4)]&&console['error']('Segment\x20ID:\x20'+_0x43b7f6['segmentId']));if(_0x43b7f6['type']===_0x2dee87(0xd2)){const _0x1c61ad=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x2ea92f[_0x2dee87(0x11b)]['getParent'](_0x43b7f6[_0x2dee87(0xc4)]),{'verbose':_0x58b349[_0x2dee87(0xf2)]});await handleSingleObjectOutput(_0x1c61ad[_0x2dee87(0xca)],_0x58b349);}else{if(_0x43b7f6[_0x2dee87(0x132)]===_0x2dee87(0xa5)){if(!_0x43b7f6['folderId'])throw new SDKError(ErrorCode[_0x2dee87(0xb5)],_0x2dee87(0x138));const _0x695944=await withSpinner(_0x2dee87(0xe2),()=>_0x2ea92f[_0x2dee87(0x11b)][_0x2dee87(0xd5)](_0x43b7f6[_0x2dee87(0xae)]),{'verbose':_0x58b349['verbose']});await handleSingleObjectOutput(_0x695944[_0x2dee87(0xca)],_0x58b349);}else{if(_0x43b7f6[_0x2dee87(0x132)]==='segment'){if(!_0x43b7f6[_0x2dee87(0xa4)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x2dee87(0x10f));const _0x5ddc52=await withSpinner('Fetching\x20segment\x20details...',()=>_0x2ea92f[_0x2dee87(0x11b)]['getSegment'](_0x43b7f6[_0x2dee87(0xc4)],_0x43b7f6[_0x2dee87(0xa4)]),{'verbose':_0x58b349[_0x2dee87(0xf2)]});await handleSingleObjectOutput(_0x5ddc52['data'],_0x58b349);}}}return 0x0;}catch(_0x269ba7){if(_0x269ba7 instanceof SDKError)return console[_0x2dee87(0xc5)](_0x2dee87(0x10e)+_0x269ba7[_0x2dee87(0x11c)]),_0x269ba7['cause']&&console['error'](_0x2dee87(0x120)+_0x269ba7[_0x2dee87(0xa8)]),0x1;throw _0x269ba7;}}}export class SegmentShowCommand extends BaseCommand{[a31_0x1537fe(0xd3)]='segment:show';['description']='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a31_0x1537fe(0xdf)](_0x3b9dfb){const _0x3618c8=a31_0x1537fe,{options:_0x3323e5,args:_0x9a6bcd,tdx:_0x4188c5}=_0x3b9dfb,_0x291346=_0x9a6bcd[0x0];if(!_0x291346)return console[_0x3618c8(0xc5)](_0x3618c8(0xed)),console[_0x3618c8(0xc5)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console[_0x3618c8(0xc5)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x3618c8(0xc5)]('Examples:'),console['error'](_0x3618c8(0x127)),console[_0x3618c8(0xc5)]('\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x503c32=_0x3323e5[_0x3618c8(0xcb)],_0x4aa25f=resolveSegmentTarget(_0x291346,_0x503c32,_0x3323e5['verbose']);_0x3323e5[_0x3618c8(0xf2)]&&console['error']('Target\x20path:\x20'+_0x4aa25f);const _0x3c4249=await withSpinner(_0x3618c8(0xad)+_0x291346+_0x3618c8(0x13b),()=>_0x4188c5[_0x3618c8(0x11b)][_0x3618c8(0xe7)](_0x4aa25f),{'verbose':_0x3323e5['verbose']}),_0x21e9e6=_0x3c4249['data'];_0x3323e5[_0x3618c8(0xf2)]&&(console['error'](_0x3618c8(0x103)+_0x21e9e6[_0x3618c8(0x132)]),console[_0x3618c8(0xc5)]('Parent\x20ID:\x20'+_0x21e9e6['parentId']));if(_0x21e9e6[_0x3618c8(0x132)]==='folder')return console[_0x3618c8(0xc5)](_0x3618c8(0xd1)),console['error'](_0x3618c8(0x117)),0x1;if(_0x21e9e6['type']==='parent')return console[_0x3618c8(0xc5)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x3618c8(0xc5)](_0x3618c8(0xea)),0x1;if(!_0x21e9e6['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x24db6e=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x4188c5[_0x3618c8(0x11b)][_0x3618c8(0x12a)](_0x21e9e6[_0x3618c8(0xc4)],_0x21e9e6[_0x3618c8(0xa4)]),{'verbose':_0x3323e5[_0x3618c8(0xf2)]});let _0x5e7fac=_0x24db6e[_0x3618c8(0xca)];const _0x52a9a1=resolveLimit(_0x3323e5['limit'],DEFAULT_DISPLAY_LIMIT),_0x10fda9=/\bLIMIT\s+\d+/i[_0x3618c8(0xcc)](_0x5e7fac);!_0x10fda9&&(_0x5e7fac=_0x5e7fac[_0x3618c8(0x12d)]()[_0x3618c8(0xd8)](/;+$/,''),_0x5e7fac='SELECT\x20*\x20FROM\x20(\x0a'+_0x5e7fac+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x52a9a1);_0x3323e5['verbose']&&console[_0x3618c8(0xc5)](_0x3618c8(0x11f)+_0x5e7fac);const _0x30d7ab=await withQuerySpinner(_0x3618c8(0x12b),async _0x56102f=>{const _0xd5e00d=_0x3618c8,_0x1bd299=await _0x4188c5[_0xd5e00d(0xef)][_0xd5e00d(0xdf)](_0x5e7fac,{'catalog':'td','schema':'information_schema','onJobId':_0x4cd62a=>{const _0x128b9d=_0xd5e00d;_0x56102f[_0x128b9d(0x101)](_0x4cd62a);}});return _0x1bd299;},{'verbose':_0x3323e5['verbose']}),_0x98a008=_0x30d7ab[_0x3618c8(0xca)],_0x15f98f=_0x98a008[_0x3618c8(0xf5)]?'\x20[Job\x20ID:\x20'+_0x98a008['jobId']+']':'';return console['error'](_0x3618c8(0xd4)+_0x98a008['stats'][_0x3618c8(0xb2)][_0x3618c8(0xde)]()+_0x3618c8(0x119)+(_0x3618c8(0x107)+formatElapsed(_0x98a008['stats'][_0x3618c8(0x13a)])+_0x15f98f)),await handleQueryOutput(_0x98a008,_0x3323e5),0x0;}catch(_0x5e81fb){if(_0x5e81fb instanceof SDKError)return console[_0x3618c8(0xc5)]('✖\x20Query\x20failed\x20['+_0x5e81fb[_0x3618c8(0xf9)]+']'),console[_0x3618c8(0xc5)]('\x0a'+_0x5e81fb[_0x3618c8(0x11c)]),0x1;throw _0x5e81fb;}}}export class SegmentFolderListCommand extends BaseCommand{[a31_0x1537fe(0xd3)]=a31_0x1537fe(0x126);[a31_0x1537fe(0x10a)]=a31_0x1537fe(0xee);async[a31_0x1537fe(0xdf)](_0x3a5c1f){const _0x49bb9c=a31_0x1537fe,{options:_0x12f090,args:_0x5e20af,tdx:_0x559a3f}=_0x3a5c1f;if(_0x5e20af[_0x49bb9c(0xb3)]===0x0)return console[_0x49bb9c(0xc5)](_0x49bb9c(0x11d)),console[_0x49bb9c(0xc5)](_0x49bb9c(0x134)),0x1;const _0x1f51f6=_0x5e20af[0x0];try{_0x12f090[_0x49bb9c(0xf2)]&&(console[_0x49bb9c(0xc5)](_0x49bb9c(0xbd)+_0x12f090[_0x49bb9c(0xaf)]),console['error']('Parent\x20name:\x20'+_0x1f51f6));const _0x41480c=await withSpinner(_0x49bb9c(0x125)+_0x1f51f6+'\x27...',()=>_0x559a3f['segment'][_0x49bb9c(0xa3)](_0x1f51f6),{'verbose':_0x12f090['verbose']}),_0x4c1962=_0x41480c[_0x49bb9c(0xca)];_0x12f090[_0x49bb9c(0xf2)]&&console[_0x49bb9c(0xc5)](_0x49bb9c(0xff)+_0x4c1962);const _0x51038c=await withSpinner(_0x49bb9c(0xda)+_0x1f51f6+'\x27...',()=>_0x559a3f[_0x49bb9c(0x11b)][_0x49bb9c(0xbf)](_0x4c1962),{'verbose':_0x12f090[_0x49bb9c(0xf2)]}),_0x3a4370=_0x51038c['data'];return console['error'](_0x49bb9c(0xfb)+_0x3a4370[_0x49bb9c(0xb3)]+'\x20folder'+(_0x3a4370[_0x49bb9c(0xb3)]!==0x1?'s':'')),await handleSDKOutput(_0x3a4370,_0x12f090),0x0;}catch(_0x48b558){if(_0x48b558 instanceof SDKError)return console[_0x49bb9c(0xc5)](_0x49bb9c(0x10e)+_0x48b558['message']),_0x48b558[_0x49bb9c(0xa8)]&&console[_0x49bb9c(0xc5)]('\x20\x20Cause:\x20'+_0x48b558['cause']),0x1;throw _0x48b558;}}}export class SegmentFolderShowCommand extends BaseCommand{[a31_0x1537fe(0xd3)]=a31_0x1537fe(0xf7);['description']=a31_0x1537fe(0xd0);async['execute'](_0x14ae70){const _0x17391a=a31_0x1537fe,{options:_0x2d370f,args:_0x5be10a,tdx:_0xff4f2c}=_0x14ae70;if(_0x5be10a[_0x17391a(0xb3)]===0x0)return console['error'](_0x17391a(0xbb)),console[_0x17391a(0xc5)](_0x17391a(0x112)),0x1;try{const {parentId:_0x15c8dc,childId:_0x2d0f2c}=parseSegmentRef(_0x5be10a[0x0]);_0x2d370f['verbose']&&(console[_0x17391a(0xc5)](_0x17391a(0xbd)+_0x2d370f[_0x17391a(0xaf)]),console[_0x17391a(0xc5)](_0x17391a(0xb4)+_0x15c8dc),_0x2d0f2c&&console[_0x17391a(0xc5)](_0x17391a(0xf1)+_0x2d0f2c));if(!_0x2d0f2c)return console['error'](_0x17391a(0xc0)),0x1;const _0x20f907=await withSpinner(_0x17391a(0x125)+_0x15c8dc+_0x17391a(0x13b),()=>_0xff4f2c[_0x17391a(0x11b)][_0x17391a(0xa3)](_0x15c8dc),{'verbose':_0x2d370f[_0x17391a(0xf2)]}),_0x52fb18=_0x20f907[_0x17391a(0xca)];_0x2d370f['verbose']&&console[_0x17391a(0xc5)](_0x17391a(0xff)+_0x52fb18);const _0x2ac02b=await withSpinner(_0x17391a(0xa1)+_0x2d0f2c+'\x27...',()=>_0xff4f2c[_0x17391a(0x11b)][_0x17391a(0x110)](_0x52fb18,_0x2d0f2c),{'verbose':_0x2d370f[_0x17391a(0xf2)]}),_0x37b471=_0x2ac02b['data'];_0x2d370f[_0x17391a(0xf2)]&&console[_0x17391a(0xc5)]('Resolved\x20folder\x20ID:\x20'+_0x37b471);const _0x1f808e=await withSpinner(_0x17391a(0x137)+_0x2d0f2c+'\x27...',()=>_0xff4f2c[_0x17391a(0x11b)][_0x17391a(0xd5)](_0x37b471),{'verbose':_0x2d370f['verbose']});return await handleSDKOutput([_0x1f808e[_0x17391a(0xca)]],_0x2d370f),0x0;}catch(_0xd65787){if(_0xd65787 instanceof SDKError)return console[_0x17391a(0xc5)](_0x17391a(0x10e)+_0xd65787[_0x17391a(0x11c)]),_0xd65787[_0x17391a(0xa8)]&&console['error'](_0x17391a(0x120)+_0xd65787[_0x17391a(0xa8)]),0x1;throw _0xd65787;}}}export class SegmentSQLCommand extends BaseCommand{[a31_0x1537fe(0xd3)]=a31_0x1537fe(0xab);[a31_0x1537fe(0x10a)]='Get\x20SQL\x20query\x20for\x20child\x20segment';async['execute'](_0x307b5e){const _0x4cb765=a31_0x1537fe,{options:_0x318afa,args:_0x3993dd,tdx:_0x4409e8}=_0x307b5e,_0x4a7194=_0x3993dd[0x0];if(!_0x4a7194)return console[_0x4cb765(0xc5)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x4cb765(0xc5)](_0x4cb765(0x113)),console['error'](_0x4cb765(0x106)),console[_0x4cb765(0xc5)](_0x4cb765(0x123)),console[_0x4cb765(0xc5)](_0x4cb765(0x12e)),console['error'](_0x4cb765(0xd9)),0x1;try{const _0x97474a=_0x318afa[_0x4cb765(0xcb)],_0x589e3c=resolveSegmentTarget(_0x4a7194,_0x97474a,_0x318afa[_0x4cb765(0xf2)]);_0x318afa['verbose']&&console[_0x4cb765(0xc5)](_0x4cb765(0x12f)+_0x589e3c);const _0x193bd5=await withSpinner(_0x4cb765(0xad)+_0x4a7194+_0x4cb765(0x13b),()=>_0x4409e8[_0x4cb765(0x11b)]['resolvePathToResource'](_0x589e3c),{'verbose':_0x318afa[_0x4cb765(0xf2)]}),_0x3f760f=_0x193bd5[_0x4cb765(0xca)];_0x318afa[_0x4cb765(0xf2)]&&(console[_0x4cb765(0xc5)](_0x4cb765(0x103)+_0x3f760f[_0x4cb765(0x132)]),console[_0x4cb765(0xc5)](_0x4cb765(0xa7)+_0x3f760f[_0x4cb765(0xc4)]));if(_0x3f760f[_0x4cb765(0x132)]==='folder')return console[_0x4cb765(0xc5)]('Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.'),console[_0x4cb765(0xc5)](_0x4cb765(0x135)),0x1;if(_0x3f760f[_0x4cb765(0x132)]===_0x4cb765(0xd2))return console[_0x4cb765(0xc5)](_0x4cb765(0xf3)),console[_0x4cb765(0xc5)]('Use:\x20tdx\x20ps\x20sql'),0x1;if(!_0x3f760f['segmentId'])throw new SDKError(ErrorCode[_0x4cb765(0xac)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x2427f8=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x4409e8[_0x4cb765(0x11b)][_0x4cb765(0x12a)](_0x3f760f[_0x4cb765(0xc4)],_0x3f760f['segmentId']),{'verbose':_0x318afa['verbose']}),_0xea784b=_0x2427f8[_0x4cb765(0xca)];return _0x318afa[_0x4cb765(0xf6)]===_0x4cb765(0x11e)||_0x318afa[_0x4cb765(0xf6)]==='jsonl'?await handleSDKOutput([{'sql':_0xea784b}],_0x318afa):console[_0x4cb765(0xa6)](_0xea784b),0x0;}catch(_0x3ed016){if(_0x3ed016 instanceof SDKError)return console['error'](_0x4cb765(0x10e)+_0x3ed016[_0x4cb765(0x11c)]),_0x3ed016[_0x4cb765(0xa8)]&&console['error'](_0x4cb765(0x120)+_0x3ed016[_0x4cb765(0xa8)]),0x1;throw _0x3ed016;}}}export class SegmentFolderCreateCommand extends BaseCommand{['name']=a31_0x1537fe(0xb6);[a31_0x1537fe(0x10a)]='Create\x20segment\x20folder\x20for\x20organization';async[a31_0x1537fe(0xdf)](_0x5639f3){const _0x454165=a31_0x1537fe,{options:_0xcb807c,args:_0x224102,tdx:_0x570011}=_0x5639f3,_0x1e35e5=_0xcb807c;if(_0x224102['length']<0x2)return console[_0x454165(0xc5)](_0x454165(0x129)),console['error'](_0x454165(0xfc)),0x1;const _0x7898c5=_0x224102[0x0],_0x11b706=_0x224102[0x1];_0x1e35e5['verbose']&&(console[_0x454165(0xc5)]('Site:\x20'+_0x1e35e5[_0x454165(0xaf)]),console[_0x454165(0xc5)]('Parent\x20segment:\x20'+_0x7898c5),console[_0x454165(0xc5)](_0x454165(0xf1)+_0x11b706));let _0x5eff2f;if(_0x1e35e5[_0x454165(0xd6)]){const _0x359cc4=_0x1e35e5[_0x454165(0xd6)],_0x3cf9ff=await withSpinner(_0x454165(0x125)+_0x7898c5+_0x454165(0x13b),()=>_0x570011[_0x454165(0x11b)][_0x454165(0xa3)](_0x7898c5),{'verbose':_0x1e35e5[_0x454165(0xf2)]}),_0x177fa1=_0x3cf9ff['data'],_0x1f12e5=await withSpinner(_0x454165(0x104)+_0x359cc4+'\x27...',()=>_0x570011[_0x454165(0x11b)][_0x454165(0x110)](_0x177fa1,_0x359cc4),{'verbose':_0x1e35e5[_0x454165(0xf2)]});_0x5eff2f=_0x1f12e5[_0x454165(0xca)],_0x1e35e5[_0x454165(0xf2)]&&console[_0x454165(0xc5)](_0x454165(0xb1)+_0x5eff2f);}const _0x355eef={'name':_0x11b706,'description':_0x1e35e5['description'],'parentFolderId':_0x5eff2f},_0x517128=await withSpinner(_0x454165(0x12c)+_0x11b706+_0x454165(0x13b),()=>_0x570011[_0x454165(0x11b)][_0x454165(0x136)](_0x7898c5,_0x355eef),{'verbose':_0x1e35e5[_0x454165(0xf2)]}),_0x3cbb88=_0x517128[_0x454165(0xca)];return console[_0x454165(0xc5)](_0x454165(0xc2)+_0x3cbb88[_0x454165(0xd3)]+_0x454165(0x102)+_0x3cbb88['id']),await handleSDKOutput([_0x3cbb88],_0x1e35e5),0x0;}}function a31_0x4a9a(_0x510f5b,_0x5a24bc){_0x510f5b=_0x510f5b-0xa0;const _0x1d49c3=a31_0x1d49();let _0x4a9af3=_0x1d49c3[_0x510f5b];return _0x4a9af3;}export class SegmentViewCommand extends BaseCommand{['name']=a31_0x1537fe(0xc3);[a31_0x1537fe(0x10a)]=a31_0x1537fe(0xfe);async[a31_0x1537fe(0xdf)](_0x2e2af8){const _0x299747=a31_0x1537fe,{options:_0x5be7a5,args:_0x183b50,tdx:_0x4b2e63}=_0x2e2af8,_0x1ddb3a=_0x183b50[0x0];if(!_0x1ddb3a)return console[_0x299747(0xc5)](_0x299747(0xc1)),console[_0x299747(0xc5)]('Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]'),console[_0x299747(0xc5)](_0x299747(0xd7)),console[_0x299747(0xc5)](_0x299747(0xe6)),console[_0x299747(0xc5)](_0x299747(0xe9)),console[_0x299747(0xc5)]('Examples:'),console[_0x299747(0xc5)](_0x299747(0x10d)),console['error'](_0x299747(0xfd)),console[_0x299747(0xc5)](_0x299747(0x130)),console['error'](_0x299747(0x105)),0x1;try{const _0x32137e=_0x5be7a5[_0x299747(0xcb)],_0xc79510=resolveSegmentTarget(_0x1ddb3a,_0x32137e,_0x5be7a5[_0x299747(0xf2)]);_0x5be7a5['verbose']&&console[_0x299747(0xc5)](_0x299747(0x12f)+_0xc79510);const _0x465d55=await withSpinner(_0x299747(0xad)+_0x1ddb3a+_0x299747(0x13b),()=>_0x4b2e63['segment'][_0x299747(0xe7)](_0xc79510),{'verbose':_0x5be7a5[_0x299747(0xf2)]}),_0x8f51d9=_0x465d55['data'];_0x5be7a5[_0x299747(0xf2)]&&(console[_0x299747(0xc5)]('Resolved\x20type:\x20'+_0x8f51d9[_0x299747(0x132)]),console['error']('Parent\x20ID:\x20'+_0x8f51d9[_0x299747(0xc4)]),_0x8f51d9[_0x299747(0xae)]&&console[_0x299747(0xc5)](_0x299747(0xa9)+_0x8f51d9[_0x299747(0xae)]),_0x8f51d9['segmentId']&&console[_0x299747(0xc5)](_0x299747(0xe4)+_0x8f51d9[_0x299747(0xa4)]));if(_0x5be7a5[_0x299747(0xba)]){if(_0x8f51d9['type']==='folder')return console['error'](_0x299747(0x111)),0x1;if(_0x8f51d9[_0x299747(0x132)]===_0x299747(0xd2))return console[_0x299747(0xc5)](_0x299747(0x131)),console['error'](_0x299747(0xbe)),0x1;if(!_0x8f51d9[_0x299747(0xa4)])throw new SDKError(ErrorCode[_0x299747(0xac)],_0x299747(0x10f));const _0x4f7d78=getConsoleNextUrl(_0x5be7a5['site'],_0x299747(0xbc)+_0x8f51d9[_0x299747(0xc4)]+_0x299747(0xfa)+_0x8f51d9[_0x299747(0xa4)]);return console['error'](a31_0x447bcc[_0x299747(0x114)]('✔')+_0x299747(0xdc)+a31_0x447bcc['cyan'](_0x4f7d78)),openBrowser(_0x4f7d78),0x0;}if(_0x8f51d9[_0x299747(0x132)]==='folder'){if(!_0x8f51d9[_0x299747(0xae)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x299747(0x138));const _0x821f27=await withSpinner('Fetching\x20folder\x20details...',()=>_0x4b2e63[_0x299747(0x11b)]['getFolder'](_0x8f51d9['folderId']),{'verbose':_0x5be7a5[_0x299747(0xf2)]});await handleSingleObjectOutput(_0x821f27['data'],_0x5be7a5);}else{if(_0x8f51d9[_0x299747(0x132)]==='segment'){if(!_0x8f51d9['segmentId'])throw new SDKError(ErrorCode[_0x299747(0xac)],_0x299747(0x10f));const _0x15cf2e=await withSpinner(_0x299747(0xcd),()=>_0x4b2e63[_0x299747(0x11b)][_0x299747(0xe3)](_0x8f51d9[_0x299747(0xc4)],_0x8f51d9[_0x299747(0xa4)]),{'verbose':_0x5be7a5[_0x299747(0xf2)]}),_0x1445f3=getConsoleNextUrl(_0x5be7a5[_0x299747(0xaf)],'/app/ps/'+_0x8f51d9[_0x299747(0xc4)]+_0x299747(0xfa)+_0x8f51d9['segmentId']),_0x2a908a=_0x15cf2e[_0x299747(0xca)];_0x2a908a[_0x299747(0x121)]=_0x1445f3,await handleSingleObjectOutput(_0x2a908a,_0x5be7a5);}else return console[_0x299747(0xc5)](_0x299747(0x133)),console[_0x299747(0xc5)](_0x299747(0x109)),0x1;}return 0x0;}catch(_0x3e405b){if(_0x3e405b instanceof SDKError)return console[_0x299747(0xc5)](_0x299747(0x10e)+_0x3e405b[_0x299747(0x11c)]),_0x3e405b['cause']&&console[_0x299747(0xc5)](_0x299747(0x120)+_0x3e405b[_0x299747(0xa8)]),0x1;throw _0x3e405b;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a31_0x1537fe(0xd3)]=a31_0x1537fe(0x108);[a31_0x1537fe(0x10a)]=a31_0x1537fe(0xdd);async[a31_0x1537fe(0xdf)](_0x217084){const _0x10401c=a31_0x1537fe,{options:_0x1a5f8b,args:_0x28fd97,tdx:_0x581050}=_0x217084,_0x40e0dc=_0x28fd97[0x0];if(!_0x40e0dc)return console[_0x10401c(0xc5)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x10401c(0xc5)](_0x10401c(0xb9)),console['error'](_0x10401c(0x118)),console['error'](_0x10401c(0x123)),console['error']('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x10401c(0xc5)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x56339f=_0x1a5f8b[_0x10401c(0xcb)],_0x3ababe=resolveSegmentTarget(_0x40e0dc,_0x56339f,_0x1a5f8b[_0x10401c(0xf2)]);_0x1a5f8b[_0x10401c(0xf2)]&&console['error'](_0x10401c(0x12f)+_0x3ababe);const _0x4188b0=await withSpinner(_0x10401c(0xad)+_0x40e0dc+'\x27...',()=>_0x581050[_0x10401c(0x11b)][_0x10401c(0xe7)](_0x3ababe),{'verbose':_0x1a5f8b[_0x10401c(0xf2)]}),_0x817ea3=_0x4188b0[_0x10401c(0xca)];_0x1a5f8b[_0x10401c(0xf2)]&&(console[_0x10401c(0xc5)]('Resolved\x20type:\x20'+_0x817ea3['type']),console[_0x10401c(0xc5)](_0x10401c(0xa7)+_0x817ea3[_0x10401c(0xc4)]));if(_0x817ea3['type']==='folder')return console['error'](_0x10401c(0xeb)),console[_0x10401c(0xc5)](_0x10401c(0x135)),0x1;if(_0x817ea3['type']==='parent')return console[_0x10401c(0xc5)](_0x10401c(0x116)),console[_0x10401c(0xc5)](_0x10401c(0xb8)),0x1;if(!_0x817ea3[_0x10401c(0xa4)])throw new SDKError(ErrorCode[_0x10401c(0xac)],_0x10401c(0x10f));const _0x5ceac4=await withSpinner(_0x10401c(0xc8),()=>_0x581050['segment'][_0x10401c(0x12a)](_0x817ea3[_0x10401c(0xc4)],_0x817ea3['segmentId']),{'verbose':_0x1a5f8b[_0x10401c(0xf2)]}),_0x5709a9=_0x5ceac4['data'],_0x33d145=await executeSchemaQuery(_0x5709a9,_0x581050,_0x1a5f8b);return await handleQueryOutput(_0x33d145,_0x1a5f8b),0x0;}catch(_0x4fe0f9){if(_0x4fe0f9 instanceof SDKError)return console['error'](_0x10401c(0x10e)+_0x4fe0f9['message']),_0x4fe0f9[_0x10401c(0xa8)]&&console[_0x10401c(0xc5)](_0x10401c(0x120)+_0x4fe0f9[_0x10401c(0xa8)]),0x1;throw _0x4fe0f9;}}}
|
|
1
|
+
const a32_0x2461d7=a32_0x3e09;(function(_0x134d69,_0x1a9542){const _0x3d25eb=a32_0x3e09,_0xe1506c=_0x134d69();while(!![]){try{const _0x3bba6e=parseInt(_0x3d25eb(0x223))/0x1+parseInt(_0x3d25eb(0x1d3))/0x2*(-parseInt(_0x3d25eb(0x230))/0x3)+parseInt(_0x3d25eb(0x1cd))/0x4+parseInt(_0x3d25eb(0x1c3))/0x5*(parseInt(_0x3d25eb(0x1d7))/0x6)+parseInt(_0x3d25eb(0x1cc))/0x7*(-parseInt(_0x3d25eb(0x226))/0x8)+-parseInt(_0x3d25eb(0x20a))/0x9+-parseInt(_0x3d25eb(0x248))/0xa*(-parseInt(_0x3d25eb(0x229))/0xb);if(_0x3bba6e===_0x1a9542)break;else _0xe1506c['push'](_0xe1506c['shift']());}catch(_0x236fbd){_0xe1506c['push'](_0xe1506c['shift']());}}}(a32_0x385c,0x98e58));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';function a32_0x385c(){const _0x71a3f3=['Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','url','getFolder','parent','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Executing\x20segment\x20query...','toLocaleString','includes','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','segmentPath','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','Fetching\x20folder\x20\x27','710QoutLc','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','segmentId','data','json','Parent\x20segment:\x20','Segment\x20ID:\x20','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','site','✔\x20Created\x20folder\x20\x27','/app/ps/','Folder\x20ID:\x20','trim','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20Parent\x20segment\x20name\x20is\x20required','folderId','Resolving\x20parent\x20segment\x20\x27','SEGMENT_FOLDER_NOT_FOUND','setJobId','66535hTOPrx','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','Fetching\x20parent\x20segment\x20details...','Show\x20segment\x20or\x20folder\x20details','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','cause','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','folderPath','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','101857LTrDYk','3117260jUATFn','Resolved\x20parent\x20ID:\x20','length','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Resolved\x20type:\x20','web','30bASSdU','\x20\x20Cause:\x20','Site:\x20','segment:folder:list','198DJBbSC','replace','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','jobId','description','segment:describe','Options:','\x27\x20with\x20ID:\x20','information_schema','parentSegment','Error:\x20','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','createFolder','\x20[Job\x20ID:\x20','parentFolder','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','in\x20','Creating\x20folder\x20\x27','Fetching\x20segment\x20details...','getSegmentSQL','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','resolveParentId','resolvePathToResource','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','Use:\x20tdx\x20ps\x20sql','stats','/e/','(root)','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Listing\x20folders\x20for\x20parent\x20\x27','log','Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details','Show\x20folder\x20or\x20child\x20segment\x20details','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Usage:\x20tdx\x20sg\x20sql\x20<name>','cyan','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','parentId','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','processedRows','execute','code','segment:folder:show','Resolving\x20path\x20\x27','green','Fetching\x20folder\x20details...','Get\x20SQL\x20query\x20for\x20child\x20segment','folder','6510204jZbolH','\x20\x20Segment\x20name:\x20','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','getSegment','\x20\x20Parent\x20segment:\x20','segmentName','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Examples:','\x20\x20Folder\x20path:\x20','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','Fetching\x20SQL\x20for\x20segment...','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Error:\x20Folder\x20reference\x20is\x20required','listFolders','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Show\x20segment\x20folder\x20details','INVALID_ARGUMENT','error','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','\x27...','Resolving\x20\x27','\x20Opening\x20','segment:view','SQL\x20query:\x0a','697808oQQYcD','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Use:\x20tdx\x20ps\x20show','440xygxtC','limit','jsonl','128326XyPpzs','Parent\x20ID:\x20','segment:show','Target\x20path:\x20','Usage:\x20tdx\x20sg\x20show\x20<name>','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','Parent\x20name:\x20','118923BURcDL','Resolved\x20relative\x20path\x20to:\x20','\x20folder','type','message','name','segment:folder:create','segment','resolveFolderId','Error:\x20Path\x20or\x20name\x20is\x20required','verbose','SEGMENT_NOT_FOUND'];a32_0x385c=function(){return _0x71a3f3;};return a32_0x385c();}import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../utils/command-output.js';function a32_0x3e09(_0x1c26fc,_0x13758c){_0x1c26fc=_0x1c26fc-0x1be;const _0x385c58=a32_0x385c();let _0x3e0971=_0x385c58[_0x1c26fc];return _0x3e0971;}import{withSpinner,withQuerySpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../utils/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import{executeSchemaQuery}from'../utils/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../utils/segment-path-parser.js';import{getConsoleNextUrl}from'../types/endpoints.js';import{openBrowser}from'../utils/process.js';import a32_0x19be70 from'chalk';function resolveSegmentTarget(_0xfc7c3,_0x171b5d,_0x5191b9){const _0x187504=a32_0x3e09;if(isYamlFilePath(_0xfc7c3))try{const _0x1e1a89=resolveYamlFilePath(_0xfc7c3);return _0x5191b9&&(console[_0x187504(0x21c)]('Resolved\x20YAML\x20file:\x20'+_0xfc7c3),console['error'](_0x187504(0x20e)+_0x1e1a89['parentSegment']),console['error'](_0x187504(0x20b)+_0x1e1a89[_0x187504(0x20f)]),console[_0x187504(0x21c)](_0x187504(0x213)+(_0x1e1a89[_0x187504(0x1ca)]||_0x187504(0x1f3))),console[_0x187504(0x21c)]('\x20\x20Full\x20path:\x20'+_0x1e1a89['fullPath'])),_0x1e1a89['fullPath'];}catch(_0x53a25b){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x187504(0x1f4)+_0x53a25b[_0x187504(0x234)]);}if(!_0x171b5d)throw new SDKError(ErrorCode[_0x187504(0x21b)],_0x187504(0x210));return _0x171b5d+'/'+_0xfc7c3;}export class SegmentDescribeCommand extends BaseCommand{[a32_0x2461d7(0x235)]=a32_0x2461d7(0x1dc);[a32_0x2461d7(0x1db)]=a32_0x2461d7(0x1c6);async[a32_0x2461d7(0x202)](_0x55e982){const _0x2ea0b2=a32_0x2461d7,{options:_0x3a2878,args:_0x3e9e35,tdx:_0x54822d}=_0x55e982,_0x2099c7=_0x3e9e35[0x0],_0x106a8f=!_0x2099c7&&!!_0x3a2878['parentSegment'],_0x216e58=_0x2099c7||_0x3a2878[_0x2ea0b2(0x1e0)];if(!_0x216e58)return console[_0x2ea0b2(0x21c)](_0x2ea0b2(0x239)),console[_0x2ea0b2(0x21c)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x2ea0b2(0x21c)](_0x2ea0b2(0x212)),console[_0x2ea0b2(0x21c)](_0x2ea0b2(0x200)),console['error'](_0x2ea0b2(0x255)),console[_0x2ea0b2(0x21c)]('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console['error'](_0x2ea0b2(0x1d9)),0x1;try{const _0x4f5542=_0x3a2878[_0x2ea0b2(0x245)];let _0x345cb1=_0x216e58;!_0x106a8f&&_0x4f5542&&!_0x216e58[_0x2ea0b2(0x243)]('/')&&(_0x345cb1=_0x4f5542+'/'+_0x216e58,_0x3a2878['verbose']&&console[_0x2ea0b2(0x21c)](_0x2ea0b2(0x231)+_0x345cb1));const _0x5a4103=await withSpinner(_0x2ea0b2(0x205)+_0x345cb1+_0x2ea0b2(0x21e),()=>_0x54822d[_0x2ea0b2(0x237)][_0x2ea0b2(0x1ed)](_0x345cb1),{'verbose':_0x3a2878['verbose']}),_0x1fa4f3=_0x5a4103[_0x2ea0b2(0x24b)];_0x3a2878[_0x2ea0b2(0x23a)]&&(console[_0x2ea0b2(0x21c)]('Resolved\x20type:\x20'+_0x1fa4f3[_0x2ea0b2(0x233)]),console[_0x2ea0b2(0x21c)](_0x2ea0b2(0x22a)+_0x1fa4f3[_0x2ea0b2(0x1ff)]),_0x1fa4f3[_0x2ea0b2(0x1bf)]&&console['error'](_0x2ea0b2(0x253)+_0x1fa4f3[_0x2ea0b2(0x1bf)]),_0x1fa4f3[_0x2ea0b2(0x24a)]&&console[_0x2ea0b2(0x21c)](_0x2ea0b2(0x24e)+_0x1fa4f3[_0x2ea0b2(0x24a)]));if(_0x1fa4f3[_0x2ea0b2(0x233)]===_0x2ea0b2(0x23f)){const _0x592056=await withSpinner(_0x2ea0b2(0x1c5),()=>_0x54822d['segment']['getParent'](_0x1fa4f3[_0x2ea0b2(0x1ff)]),{'verbose':_0x3a2878['verbose']});await handleSingleObjectOutput(_0x592056[_0x2ea0b2(0x24b)],_0x3a2878);}else{if(_0x1fa4f3[_0x2ea0b2(0x233)]==='folder'){if(!_0x1fa4f3[_0x2ea0b2(0x1bf)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x45d846=await withSpinner(_0x2ea0b2(0x207),()=>_0x54822d[_0x2ea0b2(0x237)][_0x2ea0b2(0x23e)](_0x1fa4f3[_0x2ea0b2(0x1bf)]),{'verbose':_0x3a2878[_0x2ea0b2(0x23a)]});await handleSingleObjectOutput(_0x45d846['data'],_0x3a2878);}else{if(_0x1fa4f3[_0x2ea0b2(0x233)]===_0x2ea0b2(0x237)){if(!_0x1fa4f3['segmentId'])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x2ea0b2(0x258));const _0x5ec3c0=await withSpinner(_0x2ea0b2(0x1e9),()=>_0x54822d['segment'][_0x2ea0b2(0x20d)](_0x1fa4f3[_0x2ea0b2(0x1ff)],_0x1fa4f3[_0x2ea0b2(0x24a)]),{'verbose':_0x3a2878[_0x2ea0b2(0x23a)]});await handleSingleObjectOutput(_0x5ec3c0['data'],_0x3a2878);}}}return 0x0;}catch(_0x44ff4a){if(_0x44ff4a instanceof SDKError)return console[_0x2ea0b2(0x21c)](_0x2ea0b2(0x1e1)+_0x44ff4a[_0x2ea0b2(0x234)]),_0x44ff4a[_0x2ea0b2(0x1c8)]&&console['error']('\x20\x20Cause:\x20'+_0x44ff4a[_0x2ea0b2(0x1c8)]),0x1;throw _0x44ff4a;}}}export class SegmentShowCommand extends BaseCommand{[a32_0x2461d7(0x235)]=a32_0x2461d7(0x22b);[a32_0x2461d7(0x1db)]=a32_0x2461d7(0x1e6);async[a32_0x2461d7(0x202)](_0x3db622){const _0x607e03=a32_0x2461d7,{options:_0x8b5b25,args:_0x35b8ae,tdx:_0x7c21e1}=_0x3db622,_0x24c669=_0x35b8ae[0x0];if(!_0x24c669)return console[_0x607e03(0x21c)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x607e03(0x21c)](_0x607e03(0x22d)),console[_0x607e03(0x21c)](_0x607e03(0x1eb)),console[_0x607e03(0x21c)](_0x607e03(0x212)),console[_0x607e03(0x21c)](_0x607e03(0x216)),console['error'](_0x607e03(0x1fe)),0x1;try{const _0x3e9516=_0x8b5b25[_0x607e03(0x1e0)],_0x4123c1=resolveSegmentTarget(_0x24c669,_0x3e9516,_0x8b5b25[_0x607e03(0x23a)]);_0x8b5b25[_0x607e03(0x23a)]&&console[_0x607e03(0x21c)](_0x607e03(0x22c)+_0x4123c1);const _0x5d45dc=await withSpinner('Resolving\x20\x27'+_0x24c669+'\x27...',()=>_0x7c21e1[_0x607e03(0x237)][_0x607e03(0x1ed)](_0x4123c1),{'verbose':_0x8b5b25[_0x607e03(0x23a)]}),_0xcb3bdd=_0x5d45dc['data'];_0x8b5b25[_0x607e03(0x23a)]&&(console[_0x607e03(0x21c)](_0x607e03(0x1d1)+_0xcb3bdd[_0x607e03(0x233)]),console[_0x607e03(0x21c)](_0x607e03(0x22a)+_0xcb3bdd[_0x607e03(0x1ff)]));if(_0xcb3bdd[_0x607e03(0x233)]===_0x607e03(0x209))return console[_0x607e03(0x21c)](_0x607e03(0x1cb)),console[_0x607e03(0x21c)](_0x607e03(0x1f7)),0x1;if(_0xcb3bdd[_0x607e03(0x233)]===_0x607e03(0x23f))return console[_0x607e03(0x21c)](_0x607e03(0x20c)),console[_0x607e03(0x21c)](_0x607e03(0x225)),0x1;if(!_0xcb3bdd[_0x607e03(0x24a)])throw new SDKError(ErrorCode[_0x607e03(0x23b)],_0x607e03(0x258));const _0x1ae8ed=await withSpinner(_0x607e03(0x215),()=>_0x7c21e1['segment'][_0x607e03(0x1ea)](_0xcb3bdd['parentId'],_0xcb3bdd[_0x607e03(0x24a)]),{'verbose':_0x8b5b25['verbose']});let _0x2e7b5a=_0x1ae8ed['data'];const _0x1af1d2=resolveLimit(_0x8b5b25[_0x607e03(0x227)],DEFAULT_DISPLAY_LIMIT),_0x1f9c75=/\bLIMIT\s+\d+/i['test'](_0x2e7b5a);!_0x1f9c75&&(_0x2e7b5a=_0x2e7b5a[_0x607e03(0x254)]()[_0x607e03(0x1d8)](/;+$/,''),_0x2e7b5a='SELECT\x20*\x20FROM\x20(\x0a'+_0x2e7b5a+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x1af1d2);_0x8b5b25[_0x607e03(0x23a)]&&console[_0x607e03(0x21c)](_0x607e03(0x222)+_0x2e7b5a);const _0x12e31b=await withQuerySpinner(_0x607e03(0x241),async _0x3448ac=>{const _0x2a6fe8=_0x607e03,_0x5af798=await _0x7c21e1['query']['execute'](_0x2e7b5a,{'catalog':'td','schema':_0x2a6fe8(0x1df),'onJobId':_0x499f3a=>{const _0xfef212=_0x2a6fe8;_0x3448ac[_0xfef212(0x1c2)](_0x499f3a);}});return _0x5af798;},{'verbose':_0x8b5b25[_0x607e03(0x23a)]}),_0x5aa724=_0x12e31b[_0x607e03(0x24b)],_0x578aa7=_0x5aa724[_0x607e03(0x1da)]?_0x607e03(0x1e4)+_0x5aa724['jobId']+']':'';return console[_0x607e03(0x21c)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x5aa724[_0x607e03(0x1f1)][_0x607e03(0x201)][_0x607e03(0x242)]()+'\x20rows\x20'+(_0x607e03(0x1e7)+formatElapsed(_0x5aa724[_0x607e03(0x1f1)]['elapsedTimeMillis'])+_0x578aa7)),await handleQueryOutput(_0x5aa724,_0x8b5b25),0x0;}catch(_0x5cac10){if(_0x5cac10 instanceof SDKError)return console[_0x607e03(0x21c)]('✖\x20Query\x20failed\x20['+_0x5cac10[_0x607e03(0x203)]+']'),console[_0x607e03(0x21c)]('\x0a'+_0x5cac10['message']),0x1;throw _0x5cac10;}}}export class SegmentFolderListCommand extends BaseCommand{[a32_0x2461d7(0x235)]=a32_0x2461d7(0x1d6);[a32_0x2461d7(0x1db)]=a32_0x2461d7(0x22e);async[a32_0x2461d7(0x202)](_0x56b476){const _0x18d300=a32_0x2461d7,{options:_0x1f42c5,args:_0x2231be,tdx:_0x52fbb1}=_0x56b476;if(_0x2231be[_0x18d300(0x1cf)]===0x0)return console[_0x18d300(0x21c)](_0x18d300(0x1be)),console[_0x18d300(0x21c)](_0x18d300(0x211)),0x1;const _0x3003f4=_0x2231be[0x0];try{_0x1f42c5[_0x18d300(0x23a)]&&(console['error'](_0x18d300(0x1d5)+_0x1f42c5[_0x18d300(0x250)]),console['error'](_0x18d300(0x22f)+_0x3003f4));const _0x5c058e=await withSpinner(_0x18d300(0x1c0)+_0x3003f4+_0x18d300(0x21e),()=>_0x52fbb1[_0x18d300(0x237)][_0x18d300(0x1ec)](_0x3003f4),{'verbose':_0x1f42c5['verbose']}),_0x401700=_0x5c058e[_0x18d300(0x24b)];_0x1f42c5[_0x18d300(0x23a)]&&console['error'](_0x18d300(0x1ce)+_0x401700);const _0x154c8f=await withSpinner(_0x18d300(0x1f5)+_0x3003f4+_0x18d300(0x21e),()=>_0x52fbb1[_0x18d300(0x237)][_0x18d300(0x218)](_0x401700),{'verbose':_0x1f42c5[_0x18d300(0x23a)]}),_0x224bae=_0x154c8f['data'];return console['error']('✔\x20Found\x20'+_0x224bae[_0x18d300(0x1cf)]+_0x18d300(0x232)+(_0x224bae[_0x18d300(0x1cf)]!==0x1?'s':'')),await handleSDKOutput(_0x224bae,_0x1f42c5),0x0;}catch(_0xcd0124){if(_0xcd0124 instanceof SDKError)return console[_0x18d300(0x21c)](_0x18d300(0x1e1)+_0xcd0124[_0x18d300(0x234)]),_0xcd0124['cause']&&console[_0x18d300(0x21c)]('\x20\x20Cause:\x20'+_0xcd0124['cause']),0x1;throw _0xcd0124;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a32_0x2461d7(0x204);[a32_0x2461d7(0x1db)]=a32_0x2461d7(0x21a);async[a32_0x2461d7(0x202)](_0x37d294){const _0x5641ff=a32_0x2461d7,{options:_0x58a289,args:_0x1d454e,tdx:_0x2601dc}=_0x37d294;if(_0x1d454e['length']===0x0)return console[_0x5641ff(0x21c)](_0x5641ff(0x217)),console['error'](_0x5641ff(0x224)),0x1;try{const {parentId:_0x56ef34,childId:_0x42747b}=parseSegmentRef(_0x1d454e[0x0]);_0x58a289[_0x5641ff(0x23a)]&&(console[_0x5641ff(0x21c)](_0x5641ff(0x1d5)+_0x58a289[_0x5641ff(0x250)]),console[_0x5641ff(0x21c)](_0x5641ff(0x22f)+_0x56ef34),_0x42747b&&console['error']('Folder\x20name:\x20'+_0x42747b));if(!_0x42747b)return console[_0x5641ff(0x21c)]('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x539ff5=await withSpinner(_0x5641ff(0x1c0)+_0x56ef34+_0x5641ff(0x21e),()=>_0x2601dc['segment']['resolveParentId'](_0x56ef34),{'verbose':_0x58a289[_0x5641ff(0x23a)]}),_0x36b92e=_0x539ff5[_0x5641ff(0x24b)];_0x58a289[_0x5641ff(0x23a)]&&console[_0x5641ff(0x21c)]('Resolved\x20parent\x20ID:\x20'+_0x36b92e);const _0x38c809=await withSpinner('Resolving\x20folder\x20\x27'+_0x42747b+_0x5641ff(0x21e),()=>_0x2601dc['segment'][_0x5641ff(0x238)](_0x36b92e,_0x42747b),{'verbose':_0x58a289[_0x5641ff(0x23a)]}),_0x471aab=_0x38c809[_0x5641ff(0x24b)];_0x58a289[_0x5641ff(0x23a)]&&console['error']('Resolved\x20folder\x20ID:\x20'+_0x471aab);const _0x26ce28=await withSpinner(_0x5641ff(0x247)+_0x42747b+_0x5641ff(0x21e),()=>_0x2601dc['segment'][_0x5641ff(0x23e)](_0x471aab),{'verbose':_0x58a289['verbose']});return await handleSDKOutput([_0x26ce28[_0x5641ff(0x24b)]],_0x58a289),0x0;}catch(_0x16544a){if(_0x16544a instanceof SDKError)return console[_0x5641ff(0x21c)]('Error:\x20'+_0x16544a[_0x5641ff(0x234)]),_0x16544a['cause']&&console[_0x5641ff(0x21c)](_0x5641ff(0x1d4)+_0x16544a[_0x5641ff(0x1c8)]),0x1;throw _0x16544a;}}}export class SegmentSQLCommand extends BaseCommand{[a32_0x2461d7(0x235)]='segment:sql';[a32_0x2461d7(0x1db)]=a32_0x2461d7(0x208);async[a32_0x2461d7(0x202)](_0xb6ea47){const _0x1d93b7=a32_0x2461d7,{options:_0x64920e,args:_0x17eea3,tdx:_0x4a65f3}=_0xb6ea47,_0x5025e4=_0x17eea3[0x0];if(!_0x5025e4)return console[_0x1d93b7(0x21c)](_0x1d93b7(0x1e2)),console[_0x1d93b7(0x21c)](_0x1d93b7(0x1fa)),console[_0x1d93b7(0x21c)](_0x1d93b7(0x244)),console[_0x1d93b7(0x21c)](_0x1d93b7(0x212)),console[_0x1d93b7(0x21c)](_0x1d93b7(0x249)),console['error']('\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x53abb2=_0x64920e[_0x1d93b7(0x1e0)],_0x3682b0=resolveSegmentTarget(_0x5025e4,_0x53abb2,_0x64920e[_0x1d93b7(0x23a)]);_0x64920e[_0x1d93b7(0x23a)]&&console['error']('Target\x20path:\x20'+_0x3682b0);const _0x3e200d=await withSpinner(_0x1d93b7(0x21f)+_0x5025e4+'\x27...',()=>_0x4a65f3[_0x1d93b7(0x237)][_0x1d93b7(0x1ed)](_0x3682b0),{'verbose':_0x64920e[_0x1d93b7(0x23a)]}),_0x160e52=_0x3e200d[_0x1d93b7(0x24b)];_0x64920e[_0x1d93b7(0x23a)]&&(console[_0x1d93b7(0x21c)](_0x1d93b7(0x1d1)+_0x160e52['type']),console[_0x1d93b7(0x21c)](_0x1d93b7(0x22a)+_0x160e52[_0x1d93b7(0x1ff)]));if(_0x160e52[_0x1d93b7(0x233)]===_0x1d93b7(0x209))return console[_0x1d93b7(0x21c)](_0x1d93b7(0x23c)),console[_0x1d93b7(0x21c)](_0x1d93b7(0x1f9)),0x1;if(_0x160e52[_0x1d93b7(0x233)]===_0x1d93b7(0x23f))return console[_0x1d93b7(0x21c)](_0x1d93b7(0x214)),console[_0x1d93b7(0x21c)](_0x1d93b7(0x1f0)),0x1;if(!_0x160e52[_0x1d93b7(0x24a)])throw new SDKError(ErrorCode[_0x1d93b7(0x23b)],_0x1d93b7(0x258));const _0x33e262=await withSpinner(_0x1d93b7(0x215),()=>_0x4a65f3[_0x1d93b7(0x237)][_0x1d93b7(0x1ea)](_0x160e52[_0x1d93b7(0x1ff)],_0x160e52[_0x1d93b7(0x24a)]),{'verbose':_0x64920e[_0x1d93b7(0x23a)]}),_0x26636d=_0x33e262[_0x1d93b7(0x24b)];return _0x64920e['format']===_0x1d93b7(0x24c)||_0x64920e['format']===_0x1d93b7(0x228)?await handleSDKOutput([{'sql':_0x26636d}],_0x64920e):console[_0x1d93b7(0x1f6)](_0x26636d),0x0;}catch(_0x1f7392){if(_0x1f7392 instanceof SDKError)return console[_0x1d93b7(0x21c)](_0x1d93b7(0x1e1)+_0x1f7392[_0x1d93b7(0x234)]),_0x1f7392[_0x1d93b7(0x1c8)]&&console[_0x1d93b7(0x21c)](_0x1d93b7(0x1d4)+_0x1f7392[_0x1d93b7(0x1c8)]),0x1;throw _0x1f7392;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a32_0x2461d7(0x235)]=a32_0x2461d7(0x236);[a32_0x2461d7(0x1db)]='Create\x20segment\x20folder\x20for\x20organization';async[a32_0x2461d7(0x202)](_0x5b010e){const _0x1df6b8=a32_0x2461d7,{options:_0x36c2ef,args:_0x51ad60,tdx:_0x21604e}=_0x5b010e,_0x36a6a6=_0x36c2ef;if(_0x51ad60['length']<0x2)return console[_0x1df6b8(0x21c)](_0x1df6b8(0x1d0)),console['error'](_0x1df6b8(0x246)),0x1;const _0x3f4cc5=_0x51ad60[0x0],_0x78f5df=_0x51ad60[0x1];_0x36a6a6[_0x1df6b8(0x23a)]&&(console[_0x1df6b8(0x21c)](_0x1df6b8(0x1d5)+_0x36a6a6[_0x1df6b8(0x250)]),console[_0x1df6b8(0x21c)](_0x1df6b8(0x24d)+_0x3f4cc5),console[_0x1df6b8(0x21c)]('Folder\x20name:\x20'+_0x78f5df));let _0x4e91bc;if(_0x36a6a6[_0x1df6b8(0x1e5)]){const _0x23e9e3=_0x36a6a6[_0x1df6b8(0x1e5)],_0x37ee05=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3f4cc5+_0x1df6b8(0x21e),()=>_0x21604e['segment'][_0x1df6b8(0x1ec)](_0x3f4cc5),{'verbose':_0x36a6a6[_0x1df6b8(0x23a)]}),_0xba3f2d=_0x37ee05[_0x1df6b8(0x24b)],_0x59de66=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x23e9e3+_0x1df6b8(0x21e),()=>_0x21604e[_0x1df6b8(0x237)][_0x1df6b8(0x238)](_0xba3f2d,_0x23e9e3),{'verbose':_0x36a6a6[_0x1df6b8(0x23a)]});_0x4e91bc=_0x59de66[_0x1df6b8(0x24b)],_0x36a6a6[_0x1df6b8(0x23a)]&&console['error']('Resolved\x20parent\x20folder\x20ID:\x20'+_0x4e91bc);}const _0x2ac50d={'name':_0x78f5df,'description':_0x36a6a6[_0x1df6b8(0x1db)],'parentFolderId':_0x4e91bc},_0x49a600=await withSpinner(_0x1df6b8(0x1e8)+_0x78f5df+_0x1df6b8(0x21e),()=>_0x21604e['segment'][_0x1df6b8(0x1e3)](_0x3f4cc5,_0x2ac50d),{'verbose':_0x36a6a6[_0x1df6b8(0x23a)]}),_0x1b0c4b=_0x49a600['data'];return console[_0x1df6b8(0x21c)](_0x1df6b8(0x251)+_0x1b0c4b[_0x1df6b8(0x235)]+_0x1df6b8(0x1de)+_0x1b0c4b['id']),await handleSDKOutput([_0x1b0c4b],_0x36a6a6),0x0;}}export class SegmentViewCommand extends BaseCommand{[a32_0x2461d7(0x235)]=a32_0x2461d7(0x221);[a32_0x2461d7(0x1db)]=a32_0x2461d7(0x1f8);async[a32_0x2461d7(0x202)](_0x1cf5da){const _0x2f4946=a32_0x2461d7,{options:_0x4d1a63,args:_0x36a8a2,tdx:_0x5eaccf}=_0x1cf5da,_0x2d7817=_0x36a8a2[0x0];if(!_0x2d7817)return console[_0x2f4946(0x21c)](_0x2f4946(0x1fd)),console[_0x2f4946(0x21c)](_0x2f4946(0x1c9)),console['error'](_0x2f4946(0x257)),console[_0x2f4946(0x21c)](_0x2f4946(0x1dd)),console[_0x2f4946(0x21c)](_0x2f4946(0x219)),console[_0x2f4946(0x21c)](_0x2f4946(0x212)),console[_0x2f4946(0x21c)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x2f4946(0x21c)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x2f4946(0x21c)](_0x2f4946(0x1c4)),console[_0x2f4946(0x21c)](_0x2f4946(0x24f)),0x1;try{const _0x43ba69=_0x4d1a63[_0x2f4946(0x1e0)],_0x3c86a8=resolveSegmentTarget(_0x2d7817,_0x43ba69,_0x4d1a63[_0x2f4946(0x23a)]);_0x4d1a63[_0x2f4946(0x23a)]&&console[_0x2f4946(0x21c)]('Target\x20path:\x20'+_0x3c86a8);const _0x273aee=await withSpinner(_0x2f4946(0x21f)+_0x2d7817+_0x2f4946(0x21e),()=>_0x5eaccf[_0x2f4946(0x237)][_0x2f4946(0x1ed)](_0x3c86a8),{'verbose':_0x4d1a63[_0x2f4946(0x23a)]}),_0x5f51f8=_0x273aee[_0x2f4946(0x24b)];_0x4d1a63[_0x2f4946(0x23a)]&&(console['error'](_0x2f4946(0x1d1)+_0x5f51f8[_0x2f4946(0x233)]),console['error'](_0x2f4946(0x22a)+_0x5f51f8[_0x2f4946(0x1ff)]),_0x5f51f8[_0x2f4946(0x1bf)]&&console['error'](_0x2f4946(0x253)+_0x5f51f8[_0x2f4946(0x1bf)]),_0x5f51f8[_0x2f4946(0x24a)]&&console[_0x2f4946(0x21c)](_0x2f4946(0x24e)+_0x5f51f8[_0x2f4946(0x24a)]));if(_0x4d1a63[_0x2f4946(0x1d2)]){if(_0x5f51f8['type']===_0x2f4946(0x209))return console[_0x2f4946(0x21c)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x5f51f8['type']===_0x2f4946(0x23f))return console[_0x2f4946(0x21c)](_0x2f4946(0x1ef)),console['error']('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x5f51f8[_0x2f4946(0x24a)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x2f4946(0x258));const _0x20c7ec=getConsoleNextUrl(_0x4d1a63[_0x2f4946(0x250)],_0x2f4946(0x252)+_0x5f51f8[_0x2f4946(0x1ff)]+_0x2f4946(0x1f2)+_0x5f51f8[_0x2f4946(0x24a)]);return console['error'](a32_0x19be70[_0x2f4946(0x206)]('✔')+_0x2f4946(0x220)+a32_0x19be70[_0x2f4946(0x1fb)](_0x20c7ec)),openBrowser(_0x20c7ec),0x0;}if(_0x5f51f8[_0x2f4946(0x233)]==='folder'){if(!_0x5f51f8['folderId'])throw new SDKError(ErrorCode[_0x2f4946(0x1c1)],_0x2f4946(0x1ee));const _0xf6ebbb=await withSpinner(_0x2f4946(0x207),()=>_0x5eaccf['segment'][_0x2f4946(0x23e)](_0x5f51f8[_0x2f4946(0x1bf)]),{'verbose':_0x4d1a63[_0x2f4946(0x23a)]});await handleSingleObjectOutput(_0xf6ebbb[_0x2f4946(0x24b)],_0x4d1a63);}else{if(_0x5f51f8[_0x2f4946(0x233)]===_0x2f4946(0x237)){if(!_0x5f51f8[_0x2f4946(0x24a)])throw new SDKError(ErrorCode[_0x2f4946(0x23b)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x59da13=await withSpinner(_0x2f4946(0x1e9),()=>_0x5eaccf[_0x2f4946(0x237)]['getSegment'](_0x5f51f8[_0x2f4946(0x1ff)],_0x5f51f8[_0x2f4946(0x24a)]),{'verbose':_0x4d1a63[_0x2f4946(0x23a)]}),_0x3d0d14=getConsoleNextUrl(_0x4d1a63[_0x2f4946(0x250)],_0x2f4946(0x252)+_0x5f51f8[_0x2f4946(0x1ff)]+_0x2f4946(0x1f2)+_0x5f51f8[_0x2f4946(0x24a)]),_0x5208e3=_0x59da13[_0x2f4946(0x24b)];_0x5208e3[_0x2f4946(0x23d)]=_0x3d0d14,await handleSingleObjectOutput(_0x5208e3,_0x4d1a63);}else return console[_0x2f4946(0x21c)](_0x2f4946(0x21d)),console[_0x2f4946(0x21c)]('Use:\x20tdx\x20ps\x20view'),0x1;}return 0x0;}catch(_0x169aeb){if(_0x169aeb instanceof SDKError)return console[_0x2f4946(0x21c)]('Error:\x20'+_0x169aeb[_0x2f4946(0x234)]),_0x169aeb[_0x2f4946(0x1c8)]&&console['error'](_0x2f4946(0x1d4)+_0x169aeb[_0x2f4946(0x1c8)]),0x1;throw _0x169aeb;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a32_0x2461d7(0x235)]='segment:desc';[a32_0x2461d7(0x1db)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async[a32_0x2461d7(0x202)](_0x420c32){const _0x56bb6d=a32_0x2461d7,{options:_0x2cc237,args:_0x322ea6,tdx:_0x13611f}=_0x420c32,_0x3b6828=_0x322ea6[0x0];if(!_0x3b6828)return console['error'](_0x56bb6d(0x1e2)),console[_0x56bb6d(0x21c)]('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console['error'](_0x56bb6d(0x1c7)),console[_0x56bb6d(0x21c)]('Examples:'),console[_0x56bb6d(0x21c)](_0x56bb6d(0x240)),console[_0x56bb6d(0x21c)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x1801a5=_0x2cc237[_0x56bb6d(0x1e0)],_0x39cb5e=resolveSegmentTarget(_0x3b6828,_0x1801a5,_0x2cc237['verbose']);_0x2cc237[_0x56bb6d(0x23a)]&&console[_0x56bb6d(0x21c)](_0x56bb6d(0x22c)+_0x39cb5e);const _0x31f428=await withSpinner(_0x56bb6d(0x21f)+_0x3b6828+_0x56bb6d(0x21e),()=>_0x13611f[_0x56bb6d(0x237)][_0x56bb6d(0x1ed)](_0x39cb5e),{'verbose':_0x2cc237[_0x56bb6d(0x23a)]}),_0x232d15=_0x31f428[_0x56bb6d(0x24b)];_0x2cc237['verbose']&&(console[_0x56bb6d(0x21c)](_0x56bb6d(0x1d1)+_0x232d15[_0x56bb6d(0x233)]),console[_0x56bb6d(0x21c)](_0x56bb6d(0x22a)+_0x232d15[_0x56bb6d(0x1ff)]));if(_0x232d15[_0x56bb6d(0x233)]===_0x56bb6d(0x209))return console[_0x56bb6d(0x21c)](_0x56bb6d(0x256)),console['error'](_0x56bb6d(0x1f9)),0x1;if(_0x232d15[_0x56bb6d(0x233)]===_0x56bb6d(0x23f))return console[_0x56bb6d(0x21c)](_0x56bb6d(0x1fc)),console[_0x56bb6d(0x21c)]('Use:\x20tdx\x20ps\x20desc'),0x1;if(!_0x232d15[_0x56bb6d(0x24a)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x56bb6d(0x258));const _0x53952a=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x13611f[_0x56bb6d(0x237)][_0x56bb6d(0x1ea)](_0x232d15[_0x56bb6d(0x1ff)],_0x232d15['segmentId']),{'verbose':_0x2cc237['verbose']}),_0x25c45e=_0x53952a[_0x56bb6d(0x24b)],_0x3cce8d=await executeSchemaQuery(_0x25c45e,_0x13611f,_0x2cc237);return await handleQueryOutput(_0x3cce8d,_0x2cc237),0x0;}catch(_0x5f1dc3){if(_0x5f1dc3 instanceof SDKError)return console[_0x56bb6d(0x21c)](_0x56bb6d(0x1e1)+_0x5f1dc3[_0x56bb6d(0x234)]),_0x5f1dc3[_0x56bb6d(0x1c8)]&&console['error']('\x20\x20Cause:\x20'+_0x5f1dc3[_0x56bb6d(0x1c8)]),0x1;throw _0x5f1dc3;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a33_0x252783=a33_0x49e1;(function(_0x4e5308,_0x1fa83f){const _0x3034d3=a33_0x49e1,_0x424687=_0x4e5308();while(!![]){try{const _0x2ca0b2=parseInt(_0x3034d3(0xcc))/0x1*(parseInt(_0x3034d3(0xa9))/0x2)+-parseInt(_0x3034d3(0x9f))/0x3+parseInt(_0x3034d3(0xb7))/0x4*(parseInt(_0x3034d3(0xb6))/0x5)+-parseInt(_0x3034d3(0xaa))/0x6*(-parseInt(_0x3034d3(0xa6))/0x7)+parseInt(_0x3034d3(0xba))/0x8*(parseInt(_0x3034d3(0xb4))/0x9)+-parseInt(_0x3034d3(0x9c))/0xa*(parseInt(_0x3034d3(0xc6))/0xb)+-parseInt(_0x3034d3(0xd9))/0xc*(parseInt(_0x3034d3(0xad))/0xd);if(_0x2ca0b2===_0x1fa83f)break;else _0x424687['push'](_0x424687['shift']());}catch(_0x27cb38){_0x424687['push'](_0x424687['shift']());}}}(a33_0x3844,0xcc528));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';function a33_0x49e1(_0x1b0847,_0x5c107d){_0x1b0847=_0x1b0847-0x9c;const _0x3844ec=a33_0x3844();let _0x49e142=_0x3844ec[_0x1b0847];return _0x49e142;}import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../utils/segment-path-parser.js';import a33_0x3dc2a5 from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']=a33_0x252783(0xbb);[a33_0x252783(0xcd)]=a33_0x252783(0xab);async[a33_0x252783(0xc0)](_0x3a1f56){const _0x49fb3a=a33_0x252783;console[_0x49fb3a(0xce)](a33_0x3dc2a5[_0x49fb3a(0xb0)](_0x49fb3a(0xd0))),console['error'](a33_0x3dc2a5[_0x49fb3a(0xb0)](_0x49fb3a(0xa2)));const {options:_0x140ac8,args:_0x462ddd,tdx:_0x408b14}=_0x3a1f56,_0xb914f7=_0x140ac8;if(_0x462ddd[_0x49fb3a(0xa0)]===0x0)return console[_0x49fb3a(0xce)](_0x49fb3a(0xcb)),console[_0x49fb3a(0xce)](_0x49fb3a(0xc5)),console[_0x49fb3a(0xce)](_0x49fb3a(0xd2)),console['error'](_0x49fb3a(0xc1)),console['error']('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27'),console[_0x49fb3a(0xce)](_0x49fb3a(0xb1)),0x1;const _0x4dc331=_0x462ddd[0x0],_0x432f23=_0x140ac8[_0x49fb3a(0xbd)];let _0x2dfa11=_0x4dc331;_0x432f23&&!_0x4dc331[_0x49fb3a(0xd7)]('/')&&(_0x2dfa11=_0x432f23+'/'+_0x4dc331,_0xb914f7[_0x49fb3a(0xac)]&&console[_0x49fb3a(0xce)](_0x49fb3a(0xae)+_0x2dfa11));const _0x5bd8e9=parsePath(_0x2dfa11);if(_0x5bd8e9[_0x49fb3a(0xd5)][_0x49fb3a(0xa0)]<0x2)return console['error'](_0x49fb3a(0xbc)),console[_0x49fb3a(0xce)](_0x49fb3a(0xd6)),0x1;const _0x36b3a3=_0x5bd8e9[_0x49fb3a(0xd5)][0x0],_0x52a761=getBaseName(_0x2dfa11),_0x464cea=getParentPath(_0x2dfa11);_0xb914f7['verbose']&&(console[_0x49fb3a(0xce)]('Site:\x20'+_0xb914f7[_0x49fb3a(0xcf)]),console['error'](_0x49fb3a(0xa8)+_0x2dfa11),console[_0x49fb3a(0xce)](_0x49fb3a(0xa7)+_0x36b3a3),console[_0x49fb3a(0xce)](_0x49fb3a(0xa5)+_0x52a761),console[_0x49fb3a(0xce)](_0x49fb3a(0xc2)+_0x464cea));const _0x10c979=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x36b3a3+_0x49fb3a(0xd4),()=>_0x408b14[_0x49fb3a(0xd1)][_0x49fb3a(0xa3)](_0x36b3a3),{'verbose':_0xb914f7[_0x49fb3a(0xac)]}),_0x11547f=_0x10c979[_0x49fb3a(0xc8)];let _0x29cdb2;if(_0x5bd8e9[_0x49fb3a(0xd5)][_0x49fb3a(0xa0)]>0x2){const _0x287be8=await withSpinner('Resolving\x20folder\x20path\x20\x27'+_0x464cea+_0x49fb3a(0xd4),()=>_0x408b14[_0x49fb3a(0xd1)][_0x49fb3a(0xca)](_0x464cea),{'verbose':_0xb914f7[_0x49fb3a(0xac)]}),_0x323c98=_0x287be8['data'];if(_0x323c98[_0x49fb3a(0xc3)]!==_0x49fb3a(0xc9)&&_0x323c98[_0x49fb3a(0xc3)]!==_0x49fb3a(0xc7))return console[_0x49fb3a(0xce)](_0x49fb3a(0x9e)),0x1;_0x29cdb2=_0x323c98[_0x49fb3a(0xbf)];}else{if(_0xb914f7['folder']){const _0xa395e3=await withSpinner(_0x49fb3a(0xaf)+_0xb914f7[_0x49fb3a(0xc9)]+'\x27...',()=>_0x408b14['segment'][_0x49fb3a(0x9d)](_0x11547f,_0xb914f7[_0x49fb3a(0xc9)]),{'verbose':_0xb914f7[_0x49fb3a(0xac)]});_0x29cdb2=_0xa395e3['data'];}}_0xb914f7[_0x49fb3a(0xac)]&&_0x29cdb2&&console[_0x49fb3a(0xce)](_0x49fb3a(0xb9)+_0x29cdb2);const _0x29d470=await loadJSONFromOptions(_0xb914f7[_0x49fb3a(0xb5)],_0xb914f7[_0x49fb3a(0xd3)]),_0x5ba15d={'name':_0x52a761,'description':_0xb914f7[_0x49fb3a(0xcd)],'rule':_0x29d470,'kind':_0xb914f7[_0x49fb3a(0xbe)]!==undefined?parseInt(_0xb914f7['kind'],0xa):undefined,'isVisible':_0xb914f7[_0x49fb3a(0xd8)]?![]:undefined,'segmentFolderId':_0x29cdb2,'countPopulation':_0xb914f7[_0x49fb3a(0xb2)]?![]:undefined},_0x22d7a0=await withSpinner(_0x49fb3a(0xa4)+_0x52a761+'\x27...',()=>_0x408b14[_0x49fb3a(0xd1)]['createSegment'](_0x11547f,_0x5ba15d),{'verbose':_0xb914f7['verbose']}),_0x50f408=_0x22d7a0[_0x49fb3a(0xc8)];return console['error'](_0x49fb3a(0xc4)+_0x50f408[_0x49fb3a(0xb8)]+_0x49fb3a(0xb3)+_0x50f408['id']),_0x2dfa11!==_0x4dc331&&console['error'](_0x49fb3a(0xa1)+_0x2dfa11),await handleSDKOutput([_0x50f408],_0xb914f7),0x0;}}function a33_0x3844(){const _0xd18ac=['2939718hWedVC','length','\x20\x20\x20Path:\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','resolveParentId','Creating\x20segment\x20\x27','Segment\x20name:\x20','1491QsFHix','Parent:\x20','Target\x20path:\x20','4eZmxzy','42918bwaJrK','Create\x20child\x20segment\x20with\x20filtering\x20rules','verbose','247pQbwGV','Resolved\x20relative\x20path\x20to:\x20','Resolving\x20folder\x20\x27','yellow','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','noCountPopulation','\x27\x20with\x20ID:\x20','261ACuhIq','rule','20TUdcty','1671176kLZGgY','name','Resolved\x20folder\x20ID:\x20','421712RDtrHa','segment:create','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','segmentPath','kind','folderId','execute','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27','Parent\x20path:\x20','type','✔\x20Created\x20segment\x20\x27','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','66IrYJJP','parent','data','folder','resolvePathToResource','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','371519CqZtRu','description','error','site','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','segment','Examples:','ruleFile','\x27...','segments','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','includes','invisible','2286300MhLolN','49540kGGNSZ','resolveFolderId','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'];a33_0x3844=function(){return _0xd18ac;};return a33_0x3844();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a34_0xc8407c=a34_0xc464;(function(_0x126f85,_0x567b4f){const _0x2194f7=a34_0xc464,_0x56123f=_0x126f85();while(!![]){try{const _0x568d88=parseInt(_0x2194f7(0xe2))/0x1*(parseInt(_0x2194f7(0xfa))/0x2)+parseInt(_0x2194f7(0xe3))/0x3+parseInt(_0x2194f7(0xe6))/0x4+parseInt(_0x2194f7(0xe7))/0x5+parseInt(_0x2194f7(0xf1))/0x6*(-parseInt(_0x2194f7(0xf5))/0x7)+parseInt(_0x2194f7(0xe9))/0x8+-parseInt(_0x2194f7(0xf0))/0x9;if(_0x568d88===_0x567b4f)break;else _0x56123f['push'](_0x56123f['shift']());}catch(_0x47c95a){_0x56123f['push'](_0x56123f['shift']());}}}(a34_0x2c34,0xd10b3));function a34_0xc464(_0x478e99,_0x47c646){_0x478e99=_0x478e99-0xdf;const _0x2c3416=a34_0x2c34();let _0xc464fb=_0x2c3416[_0x478e99];return _0xc464fb;}import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../utils/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a34_0xc8407c(0xe0)]='segment:fields';[a34_0xc8407c(0xf8)]=a34_0xc8407c(0xeb);async[a34_0xc8407c(0xee)](_0x243cd4){const _0x3a71ae=a34_0xc8407c,{options:_0x14f99a,args:_0x22081b,tdx:_0x6838df}=_0x243cd4,_0x3b8e34=_0x22081b[0x0]||_0x14f99a[_0x3a71ae(0xf3)];if(!_0x3b8e34)return console[_0x3a71ae(0xed)](_0x3a71ae(0xec)),console[_0x3a71ae(0xed)](_0x3a71ae(0xe1)),console[_0x3a71ae(0xed)](_0x3a71ae(0xf2)),0x1;_0x14f99a[_0x3a71ae(0xf4)]&&(console['error'](_0x3a71ae(0xe8)+_0x14f99a['site']),console[_0x3a71ae(0xed)](_0x3a71ae(0xef)+_0x3b8e34));const _0x3ed610=await withSpinner(_0x3a71ae(0xea)+_0x3b8e34+_0x3a71ae(0xe4),()=>_0x6838df[_0x3a71ae(0xf6)]['listFields'](_0x3b8e34),{'verbose':_0x14f99a[_0x3a71ae(0xf4)]}),_0x28951b=_0x3ed610[_0x3a71ae(0xe5)];console[_0x3a71ae(0xed)]('✔\x20Found\x20'+_0x28951b[_0x3a71ae(0xf7)]+_0x3a71ae(0xdf)+(_0x28951b[_0x3a71ae(0xf7)]!==0x1?'s':''));if(_0x14f99a['json']||_0x14f99a[_0x3a71ae(0xf9)])return await handleSDKOutput(_0x28951b,_0x14f99a),0x0;return displayFieldsHumanReadable(_0x28951b,_0x3b8e34),0x0;}}function a34_0x2c34(){const _0x377523=['\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','parentSegment','verbose','42QbmSwb','segment','length','description','jsonl','144770YMZkFz','\x20field','name','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','11hhcUwp','2956539BlzVlD','\x27...','data','4772804dAKVOo','7784590zIFYXp','Site:\x20','11536744mIgbdE','Listing\x20fields\x20for\x20\x27','List\x20available\x20fields\x20for\x20segmentation','Error:\x20Parent\x20segment\x20name\x20is\x20required','error','execute','Parent\x20segment:\x20','31882347hqvNSq','1575234TALpsv'];a34_0x2c34=function(){return _0x377523;};return a34_0x2c34();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a34_0x1efa65=a34_0x3cbd;(function(_0x13f8ba,_0x3acb99){const _0x52f482=a34_0x3cbd,_0xa87cbf=_0x13f8ba();while(!![]){try{const _0x2e11e3=parseInt(_0x52f482(0x213))/0x1*(-parseInt(_0x52f482(0x261))/0x2)+parseInt(_0x52f482(0x25d))/0x3*(-parseInt(_0x52f482(0x250))/0x4)+parseInt(_0x52f482(0x24a))/0x5*(parseInt(_0x52f482(0x1f3))/0x6)+parseInt(_0x52f482(0x1f8))/0x7*(parseInt(_0x52f482(0x229))/0x8)+parseInt(_0x52f482(0x228))/0x9+parseInt(_0x52f482(0x246))/0xa*(-parseInt(_0x52f482(0x1f4))/0xb)+-parseInt(_0x52f482(0x1f6))/0xc*(-parseInt(_0x52f482(0x20f))/0xd);if(_0x2e11e3===_0x3acb99)break;else _0xa87cbf['push'](_0xa87cbf['shift']());}catch(_0x587475){_0xa87cbf['push'](_0xa87cbf['shift']());}}}(a34_0x3262,0x2e298));function a34_0x3cbd(_0x58414c,_0x3b371b){_0x58414c=_0x58414c-0x1ee;const _0x32622e=a34_0x3262();let _0x3cbdd2=_0x32622e[_0x58414c];return _0x3cbdd2;}import{BaseCommand}from'./command.js';import{withSpinner,withQuerySpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{getSegmentRootDir,createTdxConfigContent,findTdxConfigPath,loadTdxConfig}from'../utils/tdx-config.js';import{saveSessionContext}from'../core/session.js';import{segmentWithActivationsToYaml,segmentToYamlString,apiRuleToYaml,journeyActivationStepToYaml}from'../sdk/segment/child-segment-yaml.js';import{apiToYamlAsync,toYamlString as a34_0x318de8}from'../sdk/segment/journey-yaml.js';import a34_0x2b6657 from'chalk';function a34_0x3262(){const _0x597872=['green','buildIdToNameMap','13MCPWKV','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','cyan','connection','12196KvLfJW','setPhase','Fetching\x20journeys...','filter','\x20\x20Target:\x20','segment:pull','\x20versions)','yaml','relative','absolutePath','parentFolderId','segment','Found\x20existing\x20tdx.json\x20at:\x20','\x20files?','slice','\x20files\x20to\x20','\x20\x20🗺️\x20\x20','\x20with\x20','content','data','hasChanges','189414xFtbiv','87272HKuDFJ','Fetching\x20activations...','Warning:\x20Could\x20not\x20resolve\x20activation\x20','✔\x20Pulled\x20','user','Fetching\x20users\x20for\x20email\x20resolution...','listActivations','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','folderId','\x20activations','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','\x20journeys','kind','execute','parentSegment','\x20changed\x20files','\x0aChanges\x20to\x20\x27','\x0aPull\x20summary\x20for\x20\x27','Site:\x20','getActivation','add','get','Warning:\x20Could\x20not\x20resolve\x20segment\x20','\x20=\x20','getJourney','from','has','segmentFolderId','Parent\x20segment:\x20','354610RbBaSE','red','journeyBundleId','dryRun','5oevytF','Write\x20','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)','getSegment','yellow','length','9244QXlCYJ','join','journey','site','audienceId','isDirectory','Fetching\x20connections\x20for\x20name\x20resolution...','isNew','parent_segment','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','\x20segments','values','✔\x20Context\x20set:\x20','60rfPLBU','Using\x20parent\x20segment:\x20','journeyBundleName','Resolved\x20parent\x20name:\x20','14onVZBf','\x20new\x20files','attributes','rule','activation_','size','verbose','all','listJourneysFromParentSegment','\x20unchanged\x20files','repeat','Found\x20tdx.json\x20at:\x20','session','131286JzIMxk','55kbmQjn','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','4020612iiEzSa','.yml','77uyXnqs','name','listSegments','set','dim','message','versionNumber','Processing\x20journeys...','relativePath','dirname','\x20\x20🎯\x20','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','description','Resolving\x20parent\x20segment\x20\x27','then','Fetching\x20folders...','error','✔\x20All\x20files\x20are\x20up\x20to\x20date','Aborted.','push','utf-8'];a34_0x3262=function(){return _0x597872;};return a34_0x3262();}import{existsSync,mkdirSync,readFileSync,writeFileSync,statSync}from'fs';import a34_0x5ed439 from'path';import{sanitizeFileName}from'../utils/string-utils.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyYaml,createJumpTargetCache,resolveJumpTarget}from'../utils/journey-utils.js';export class SegmentPullCommand extends BaseCommand{[a34_0x1efa65(0x1f9)]=a34_0x1efa65(0x218);[a34_0x1efa65(0x204)]=a34_0x1efa65(0x1f5);async[a34_0x1efa65(0x236)](_0x50f9e8){const _0x493df3=a34_0x1efa65,{options:_0x32b421,args:_0xbc599e,tdx:_0x2a178a}=_0x50f9e8,_0x2594b1=_0x32b421,_0x5cb6ce=_0x32b421[_0x493df3(0x237)],_0x1ec076=_0xbc599e[0x0],_0x50dadf=findTdxConfigPath();let _0x2c764f,_0x2bcf30;if(!_0x1ec076&&_0x50dadf){const _0x41c98d=loadTdxConfig(_0x50dadf);_0x2c764f=_0x41c98d[_0x493df3(0x258)],_0x2bcf30=a34_0x5ed439['dirname'](_0x50dadf),_0x2594b1[_0x493df3(0x267)]&&(console[_0x493df3(0x208)](_0x493df3(0x21f)+_0x50dadf),console[_0x493df3(0x208)](_0x493df3(0x25e)+_0x2c764f));}else{if(_0x1ec076){if(existsSync(_0x1ec076)&&statSync(_0x1ec076)[_0x493df3(0x255)]()){const _0x5edf26=findTdxConfigPath(_0x1ec076);if(_0x5edf26){const _0x3dec22=loadTdxConfig(_0x5edf26);_0x2c764f=_0x3dec22['parent_segment'],_0x2bcf30=a34_0x5ed439[_0x493df3(0x201)](_0x5edf26),_0x2594b1[_0x493df3(0x267)]&&(console['error'](_0x493df3(0x1f1)+_0x5edf26),console[_0x493df3(0x208)]('Using\x20parent\x20segment:\x20'+_0x2c764f));}else return console[_0x493df3(0x208)](a34_0x2b6657[_0x493df3(0x247)](_0x493df3(0x210)+_0x1ec076+'\x0a')),console['error'](a34_0x2b6657['cyan'](_0x493df3(0x259))),0x1;}else _0x2c764f=_0x1ec076;}else _0x2c764f=_0x5cb6ce;}if(!_0x2c764f)return console[_0x493df3(0x208)](a34_0x2b6657[_0x493df3(0x24e)](_0x493df3(0x233))),console['error'](_0x493df3(0x24c)),console[_0x493df3(0x208)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent'),console[_0x493df3(0x208)](_0x493df3(0x230)),0x1;_0x2594b1[_0x493df3(0x267)]&&(console[_0x493df3(0x208)](_0x493df3(0x23b)+_0x2594b1[_0x493df3(0x253)]),console[_0x493df3(0x208)](_0x493df3(0x245)+_0x2c764f));const _0x567b00=await withSpinner(_0x493df3(0x205)+_0x2c764f+'\x27...',()=>_0x2a178a[_0x493df3(0x21e)]['resolveParentId'](_0x2c764f),{'verbose':_0x2594b1[_0x493df3(0x267)]}),_0x5e536b=_0x567b00['data'],_0x1b1dd9=await withSpinner('Fetching\x20parent\x20segment\x20info...',()=>_0x2a178a['segment']['getParent'](_0x5e536b),{'verbose':_0x2594b1['verbose']}),_0x131124=_0x1b1dd9[_0x493df3(0x226)][_0x493df3(0x263)]['name'];_0x2594b1['verbose']&&console[_0x493df3(0x208)](_0x493df3(0x260)+_0x131124);const [_0x4e0d6c,_0x45e64b,_0x47e7ad]=await Promise[_0x493df3(0x268)]([withSpinner('Fetching\x20segments...',()=>_0x2a178a['segment'][_0x493df3(0x1fa)](_0x5e536b),{'verbose':_0x2594b1[_0x493df3(0x267)]}),withSpinner(_0x493df3(0x207),()=>_0x2a178a['segment']['listFolders'](_0x5e536b),{'verbose':_0x2594b1[_0x493df3(0x267)]}),withSpinner(_0x493df3(0x215),()=>_0x2a178a[_0x493df3(0x252)][_0x493df3(0x1ee)](_0x5e536b),{'verbose':_0x2594b1[_0x493df3(0x267)]})]),_0x51fd65=_0x4e0d6c[_0x493df3(0x226)],_0x4b7a98=_0x45e64b[_0x493df3(0x226)],_0x45ca82=_0x47e7ad[_0x493df3(0x226)];if(_0x51fd65[_0x493df3(0x24f)]===0x0&&_0x45ca82['length']===0x0)return console[_0x493df3(0x208)](a34_0x2b6657[_0x493df3(0x24e)]('No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27'+_0x131124+'\x27')),0x0;const _0xe3c608=buildFolderPathMap(_0x4b7a98),_0x1ff18a=_0x2bcf30||getSegmentRootDir(sanitizeFileName(_0x2c764f)),_0x59a75c=new Map();await withSpinner(_0x493df3(0x22a),async()=>{await batchAsync(_0x51fd65,async _0x1b4efd=>{const _0x4fd717=a34_0x3cbd,_0x3d75fd=await _0x2a178a[_0x4fd717(0x21e)][_0x4fd717(0x22f)](_0x5e536b,_0x1b4efd['id']);_0x59a75c[_0x4fd717(0x1fb)](_0x1b4efd['id'],_0x3d75fd);});},{'verbose':_0x2594b1[_0x493df3(0x267)]});const _0x4c7124=await withSpinner(_0x493df3(0x22e),()=>_0x2a178a[_0x493df3(0x22d)]['buildIdToEmailMap'](),{'verbose':_0x2594b1[_0x493df3(0x267)]})['then'](_0x512282=>_0x512282[_0x493df3(0x226)]),_0x39c142=await withSpinner(_0x493df3(0x256),()=>_0x2a178a[_0x493df3(0x212)][_0x493df3(0x20e)](),{'verbose':_0x2594b1[_0x493df3(0x267)]})[_0x493df3(0x206)](_0xd20435=>_0xd20435['data']),_0x587437=[],_0x23182f=a34_0x5ed439['join'](_0x1ff18a,'tdx.json'),_0x4d860c=createTdxConfigContent(_0x131124);_0x587437[_0x493df3(0x20b)](prepareFile(_0x23182f,_0x4d860c,_0x1ff18a));const _0x20ca0d=new Map();for(const _0x4ed3b2 of _0x51fd65){if(_0x4ed3b2['kind']===SEGMENT_KIND_JOURNEY)continue;const _0xaf678e=_0x4ed3b2[_0x493df3(0x244)]?_0xe3c608[_0x493df3(0x23e)](_0x4ed3b2['segmentFolderId'])||'':'',_0x488f4e=_0x59a75c[_0x493df3(0x23e)](_0x4ed3b2['id'])||[],_0x48fbec=segmentWithActivationsToYaml(_0x4ed3b2,_0x488f4e,undefined,_0x4c7124,_0x39c142),_0x4c9f4a=_0xaf678e?a34_0x5ed439[_0x493df3(0x251)](_0x1ff18a,_0xaf678e):_0x1ff18a,_0x4f2883=sanitizeFileName(_0x4ed3b2['name']),_0xe996e8=getUniqueFileName(_0x4c9f4a,_0x4f2883,_0x20ca0d),_0x28939e=a34_0x5ed439[_0x493df3(0x251)](_0x4c9f4a,_0xe996e8+_0x493df3(0x1f7)),_0x1be4cb=segmentToYamlString(_0x48fbec);_0x587437['push'](prepareFile(_0x28939e,_0x1be4cb,_0x1ff18a));}const _0x23cce1=new Map();for(const _0x5cf746 of _0x51fd65){_0x23cce1[_0x493df3(0x1fb)](_0x5cf746['id'],_0x5cf746);}const _0x72bad5=new Map();for(const _0x1d5399 of _0x45ca82){const _0x51bd10=_0x1d5399[_0x493df3(0x248)];!_0x72bad5[_0x493df3(0x243)](_0x51bd10)&&_0x72bad5[_0x493df3(0x1fb)](_0x51bd10,[]),_0x72bad5[_0x493df3(0x23e)](_0x51bd10)[_0x493df3(0x20b)](_0x1d5399);}for(const _0x281005 of _0x72bad5[_0x493df3(0x25b)]()){_0x281005['sort']((_0x35fd00,_0x5536d1)=>(_0x35fd00[_0x493df3(0x1fe)]||0x0)-(_0x5536d1[_0x493df3(0x1fe)]||0x0));}const _0x358448=()=>{const _0xbfa565=_0x493df3,_0x1f05b0=new Set(),_0x3bf8f9=new Set(),_0x1f9825=new Map(),_0x210a74=new Map(),_0x3c250d=createJumpTargetCache(),_0xdd6aa=(_0x404619,_0x14645d)=>({'resolveSegment':async _0x36052f=>{const _0x3ba572=a34_0x3cbd,_0x287131=_0x1f9825[_0x3ba572(0x23e)](_0x36052f);if(_0x287131!==undefined)return{'name':_0x287131,'isJourneyLocal':!![]};if(!_0x14645d)return{'name':_0x36052f,'isJourneyLocal':![]};try{let _0x1f4026=_0x23cce1[_0x3ba572(0x23e)](_0x36052f);!_0x1f4026&&(_0x1f4026=await _0x2a178a['segment'][_0x3ba572(0x24d)](_0x14645d,_0x36052f));const _0x41284b=generateJourneyLocalName(_0x1f4026['name']),_0x5ae649=_0x1f4026[_0x3ba572(0x235)]===SEGMENT_KIND_JOURNEY&&_0x41284b!==undefined;let _0x2dc488=_0x1f4026[_0x3ba572(0x1f9)];if(_0x5ae649&&_0x41284b){let _0x1357a0=_0x41284b,_0x420f3e=0x2;while(_0x1f05b0[_0x3ba572(0x243)](_0x1357a0)){_0x1357a0=_0x41284b+'_'+_0x420f3e,_0x420f3e++;}_0x1f05b0['add'](_0x1357a0),_0x2dc488=_0x1357a0,_0x1f9825['set'](_0x36052f,_0x2dc488);}let _0x1b664f;return _0x5ae649&&_0x1f4026[_0x3ba572(0x264)]&&(_0x1b664f={'description':_0x1f4026[_0x3ba572(0x204)],'rule':apiRuleToYaml(_0x1f4026[_0x3ba572(0x264)])}),{'name':_0x2dc488,'isJourneyLocal':_0x5ae649,'definition':_0x1b664f};}catch(_0x1f7fdb){return _0x2594b1[_0x3ba572(0x267)]&&console[_0x3ba572(0x208)](_0x3ba572(0x23f)+_0x36052f+':\x20'+_0x1f7fdb[_0x3ba572(0x1fd)]),{'name':_0x36052f,'isJourneyLocal':![]};}},'resolveActivation':async _0x49844b=>{const _0x597019=a34_0x3cbd,_0xab69be=_0x210a74['get'](_0x49844b);if(_0xab69be!==undefined)return{'name':_0xab69be,'isJourneyLocal':!![]};try{const _0x2ee8b5=await _0x2a178a[_0x597019(0x252)][_0x597019(0x23c)](_0x404619,_0x49844b),_0xa37de2=_0x2ee8b5[_0x597019(0x263)]['activationParams']['name']||_0x49844b,_0x1caf90=sanitizeYamlKey(_0xa37de2)||_0x597019(0x265)+_0x49844b;let _0x1ec687=_0x1caf90,_0x1a504d=0x2;while(_0x3bf8f9[_0x597019(0x243)](_0x1ec687)){_0x1ec687=_0x1caf90+'_'+_0x1a504d,_0x1a504d++;}_0x3bf8f9[_0x597019(0x23d)](_0x1ec687),_0x210a74[_0x597019(0x1fb)](_0x49844b,_0x1ec687);const _0x1c9d2f=journeyActivationStepToYaml(_0x2ee8b5,_0x4c7124,_0x39c142);return{'name':_0x1ec687,'isJourneyLocal':!![],'definition':_0x1c9d2f};}catch(_0x966cc4){return _0x2594b1[_0x597019(0x267)]&&console['error'](_0x597019(0x22b)+_0x49844b+':\x20'+_0x966cc4[_0x597019(0x1fd)]),{'name':_0x49844b,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x10d671,_0x165417)=>resolveJumpTarget(_0x10d671,_0x165417,_0x3c250d,_0x193345=>_0x2a178a[_0xbfa565(0x252)][_0xbfa565(0x241)](_0x193345))});return{'createYamlContext':_0xdd6aa};};if(_0x72bad5[_0x493df3(0x266)]>0x0){const _0x18c3b2=Array['from'](_0x72bad5[_0x493df3(0x25b)]()),_0x41bbe3=await withQuerySpinner(_0x493df3(0x1ff),async _0x3043d2=>{const _0x1a1c76=_0x493df3,_0x43c6f5=[];let _0x395269=0x0;const _0x1a2c1b=0x5;for(let _0x1072cd=0x0;_0x1072cd<_0x18c3b2[_0x1a1c76(0x24f)];_0x1072cd+=_0x1a2c1b){const _0x24cc8e=_0x18c3b2[_0x1a1c76(0x221)](_0x1072cd,_0x1072cd+_0x1a2c1b),_0x4d43d6=await Promise[_0x1a1c76(0x268)](_0x24cc8e['map'](async _0x3b726f=>{const _0x2721d2=_0x1a1c76,_0x5e31b6=_0x3b726f[0x0],_0x259cce=_0x5e31b6[_0x2721d2(0x25f)];_0x3043d2[_0x2721d2(0x214)]('Fetching\x20journey\x20\x27'+_0x259cce+'\x27');const _0x21ad84=_0x5e31b6[_0x2721d2(0x231)]?_0xe3c608[_0x2721d2(0x23e)](_0x5e31b6['folderId'])||'':'',{createYamlContext:_0x5c74f9}=_0x358448(),_0x58a59b=[];for(const _0x4abfd9 of _0x3b726f){const _0x441964=await _0x2a178a['journey'][_0x2721d2(0x241)](_0x4abfd9['id']),_0x461a84=_0x441964[_0x2721d2(0x263)]?.[_0x2721d2(0x254)],_0x501183=_0x5c74f9(_0x4abfd9['id'],_0x461a84),_0x294685=await apiToYamlAsync(_0x441964,_0x501183);_0x58a59b['push']({'item':_0x4abfd9,'yaml':_0x294685});}let _0x4a9832;return _0x58a59b[_0x2721d2(0x24f)]===0x1?_0x4a9832=_0x58a59b[0x0][_0x2721d2(0x21a)]:_0x4a9832=buildMergedJourneyYaml(_0x58a59b),{'bundleName':_0x259cce,'folderPath':_0x21ad84,'finalYaml':_0x4a9832};}));_0x43c6f5[_0x1a1c76(0x20b)](..._0x4d43d6),_0x395269+=_0x24cc8e[_0x1a1c76(0x24f)],_0x3043d2['setExtra']('('+_0x395269+'/'+_0x18c3b2['length']+')');}return _0x43c6f5;},{'verbose':_0x2594b1['verbose']});for(const {bundleName:_0x685382,folderPath:_0x15a516,finalYaml:_0x1f49b5}of _0x41bbe3[_0x493df3(0x226)]){const _0x24edee=a34_0x318de8(_0x1f49b5),_0x41e613=_0x15a516?a34_0x5ed439[_0x493df3(0x251)](_0x1ff18a,_0x15a516):_0x1ff18a,_0x2a4616=sanitizeFileName(_0x685382),_0x36efb2=getUniqueFileName(_0x41e613,_0x2a4616,_0x20ca0d),_0x2cf4db=a34_0x5ed439[_0x493df3(0x251)](_0x41e613,_0x36efb2+'.yml');_0x587437[_0x493df3(0x20b)](prepareFile(_0x2cf4db,_0x24edee,_0x1ff18a));}}const _0x43df25=Array[_0x493df3(0x242)](_0x59a75c['values']())['reduce']((_0x5b4fe1,_0x3bd158)=>_0x5b4fe1+_0x3bd158[_0x493df3(0x24f)],0x0),_0x5852ed=_0x587437[_0x493df3(0x216)](_0x5577a6=>_0x5577a6['isNew']),_0x427b7f=_0x587437[_0x493df3(0x216)](_0x1f5405=>!_0x1f5405[_0x493df3(0x257)]&&_0x1f5405[_0x493df3(0x227)]),_0x3be316=_0x587437[_0x493df3(0x216)](_0x2260e9=>!_0x2260e9[_0x493df3(0x257)]&&!_0x2260e9[_0x493df3(0x227)]),_0x3edb48=_0x51fd65['filter'](_0x360c3b=>_0x360c3b[_0x493df3(0x235)]!==SEGMENT_KIND_JOURNEY);console[_0x493df3(0x208)](_0x493df3(0x23a)+_0x131124+'\x27:'),console[_0x493df3(0x208)](_0x493df3(0x202)+a34_0x2b6657[_0x493df3(0x211)](_0x3edb48['length']+_0x493df3(0x25a))+_0x493df3(0x224)+a34_0x2b6657[_0x493df3(0x211)](_0x43df25+_0x493df3(0x232)));if(_0x72bad5[_0x493df3(0x266)]>0x0){const _0x36cfb1=_0x45ca82['length'],_0x405716=_0x72bad5[_0x493df3(0x266)],_0x267af5=_0x36cfb1>_0x405716?'\x20('+_0x36cfb1+_0x493df3(0x219):'';console[_0x493df3(0x208)](_0x493df3(0x223)+a34_0x2b6657[_0x493df3(0x211)](_0x405716+_0x493df3(0x234))+a34_0x2b6657[_0x493df3(0x1fc)](_0x267af5));}console['error']('\x20\x20'+a34_0x2b6657[_0x493df3(0x20d)]('+\x20'+_0x5852ed[_0x493df3(0x24f)]+_0x493df3(0x262))),console[_0x493df3(0x208)]('\x20\x20'+a34_0x2b6657[_0x493df3(0x24e)]('~\x20'+_0x427b7f[_0x493df3(0x24f)]+_0x493df3(0x238))),console[_0x493df3(0x208)]('\x20\x20'+a34_0x2b6657[_0x493df3(0x1fc)]('=\x20'+_0x3be316['length']+_0x493df3(0x1ef))),console[_0x493df3(0x208)](_0x493df3(0x217)+a34_0x2b6657[_0x493df3(0x211)](_0x1ff18a)+'\x0a');if(_0x427b7f[_0x493df3(0x24f)]>0x0)for(const _0x26d410 of _0x427b7f){console[_0x493df3(0x208)](_0x493df3(0x239)+_0x26d410[_0x493df3(0x200)]+'\x27:'),console['error']('─'[_0x493df3(0x1f0)](0x3c)),console[_0x493df3(0x208)](_0x26d410['diff']),console[_0x493df3(0x208)]('─'[_0x493df3(0x1f0)](0x3c));}if(_0x2594b1[_0x493df3(0x249)])return console['error'](a34_0x2b6657[_0x493df3(0x24e)](_0x493df3(0x203))),0x0;if(_0x5852ed[_0x493df3(0x24f)]===0x0&&_0x427b7f[_0x493df3(0x24f)]===0x0)return console[_0x493df3(0x208)](a34_0x2b6657[_0x493df3(0x20d)](_0x493df3(0x209))),saveSessionContext({'parent_segment':_0x131124},_0x2594b1['session']),console[_0x493df3(0x208)](a34_0x2b6657[_0x493df3(0x20d)](_0x493df3(0x25c)+a34_0x2b6657[_0x493df3(0x1fc)](_0x493df3(0x258))+'\x20=\x20'+a34_0x2b6657['cyan'](_0x131124))),0x0;if(!_0x2594b1['yes']&&(_0x5852ed['length']>0x0||_0x427b7f[_0x493df3(0x24f)]>0x0)){const _0xbcd908=await confirmKey(_0x493df3(0x24b)+(_0x5852ed[_0x493df3(0x24f)]+_0x427b7f['length'])+_0x493df3(0x220));if(!_0xbcd908)return console[_0x493df3(0x208)](_0x493df3(0x20a)),0x1;}for(const _0x184e7c of _0x587437){if(_0x184e7c[_0x493df3(0x257)]||_0x184e7c[_0x493df3(0x227)]){const _0xe4f6f7=a34_0x5ed439[_0x493df3(0x201)](_0x184e7c[_0x493df3(0x21c)]);!existsSync(_0xe4f6f7)&&mkdirSync(_0xe4f6f7,{'recursive':!![]}),writeFileSync(_0x184e7c[_0x493df3(0x21c)],_0x184e7c[_0x493df3(0x225)],_0x493df3(0x20c));}}return console['error'](a34_0x2b6657[_0x493df3(0x20d)](_0x493df3(0x22c)+(_0x5852ed[_0x493df3(0x24f)]+_0x427b7f[_0x493df3(0x24f)])+_0x493df3(0x222)+_0x1ff18a)),saveSessionContext({'parent_segment':_0x131124},_0x2594b1[_0x493df3(0x1f2)]),console[_0x493df3(0x208)](a34_0x2b6657[_0x493df3(0x20d)](_0x493df3(0x25c)+a34_0x2b6657[_0x493df3(0x1fc)]('parent_segment')+_0x493df3(0x240)+a34_0x2b6657[_0x493df3(0x211)](_0x131124))),0x0;}}function buildFolderPathMap(_0xd3ca0e){const _0x56eb47=a34_0x1efa65,_0x57f429=new Map(),_0x2c47e7=new Map();for(const _0x34e2ac of _0xd3ca0e){_0x2c47e7[_0x56eb47(0x1fb)](_0x34e2ac['id'],_0x34e2ac);}const _0x522f55=new Set();for(const _0x320c1d of _0xd3ca0e){!_0x320c1d['parentFolderId']&&_0x522f55[_0x56eb47(0x23d)](_0x320c1d['id']);}function _0x1121d2(_0x128c0b){const _0x38c6b2=_0x56eb47;if(_0x57f429[_0x38c6b2(0x243)](_0x128c0b['id']))return _0x57f429[_0x38c6b2(0x23e)](_0x128c0b['id']);if(_0x522f55[_0x38c6b2(0x243)](_0x128c0b['id']))return _0x57f429[_0x38c6b2(0x1fb)](_0x128c0b['id'],''),'';if(_0x128c0b[_0x38c6b2(0x21d)]){const _0x2473fd=_0x2c47e7[_0x38c6b2(0x23e)](_0x128c0b[_0x38c6b2(0x21d)]);if(_0x2473fd){const _0x21f1a9=_0x1121d2(_0x2473fd),_0x2153f9=_0x21f1a9?_0x21f1a9+'/'+_0x128c0b[_0x38c6b2(0x1f9)]:_0x128c0b[_0x38c6b2(0x1f9)];return _0x57f429[_0x38c6b2(0x1fb)](_0x128c0b['id'],_0x2153f9),_0x2153f9;}}const _0x1d817f=_0x128c0b[_0x38c6b2(0x1f9)];return _0x57f429['set'](_0x128c0b['id'],_0x1d817f),_0x1d817f;}for(const _0xb5f72b of _0xd3ca0e){_0x1121d2(_0xb5f72b);}return _0x57f429;}function getUniqueFileName(_0x33be19,_0x4d73a0,_0x2ce36e){const _0x502f67=a34_0x1efa65,_0x34bc6b=_0x33be19+':'+_0x4d73a0,_0x59fed5=_0x2ce36e[_0x502f67(0x23e)](_0x34bc6b)||0x0;_0x2ce36e[_0x502f67(0x1fb)](_0x34bc6b,_0x59fed5+0x1);if(_0x59fed5===0x0)return _0x4d73a0;return _0x4d73a0+'-'+_0x59fed5;}function prepareFile(_0x30f6eb,_0x1c08d5,_0x3cefae){const _0xcaf3d6=a34_0x1efa65,_0x41ca99=a34_0x5ed439[_0xcaf3d6(0x21b)](_0x3cefae,_0x30f6eb);if(existsSync(_0x30f6eb)){const _0x3cac4c=readFileSync(_0x30f6eb,_0xcaf3d6(0x20c)),_0x416437=generateDiff(_0x3cac4c,_0x1c08d5),_0x484cee=hasChanges(_0x416437);return{'relativePath':_0x41ca99,'absolutePath':_0x30f6eb,'content':_0x1c08d5,'isNew':![],'hasChanges':_0x484cee,'diff':_0x484cee?formatDiffWithColors(_0x416437):undefined};}return{'relativePath':_0x41ca99,'absolutePath':_0x30f6eb,'content':_0x1c08d5,'isNew':!![],'hasChanges':![]};}
|
|
1
|
+
const a35_0x816586=a35_0x4548;(function(_0xbeffbb,_0x3ac8d6){const _0x55eb7f=a35_0x4548,_0x5d64a0=_0xbeffbb();while(!![]){try{const _0x205fd7=parseInt(_0x55eb7f(0x22d))/0x1+-parseInt(_0x55eb7f(0x1ea))/0x2*(-parseInt(_0x55eb7f(0x21c))/0x3)+-parseInt(_0x55eb7f(0x1fb))/0x4+-parseInt(_0x55eb7f(0x215))/0x5+parseInt(_0x55eb7f(0x22f))/0x6+-parseInt(_0x55eb7f(0x1f2))/0x7*(parseInt(_0x55eb7f(0x232))/0x8)+parseInt(_0x55eb7f(0x1f6))/0x9*(-parseInt(_0x55eb7f(0x224))/0xa);if(_0x205fd7===_0x3ac8d6)break;else _0x5d64a0['push'](_0x5d64a0['shift']());}catch(_0x447d3b){_0x5d64a0['push'](_0x5d64a0['shift']());}}}(a35_0x5938,0x3833b));import{BaseCommand}from'./command.js';import{withSpinner,withQuerySpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{confirmKey}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{getSegmentRootDir,createTdxConfigContent,findTdxConfigPath,loadTdxConfig}from'../utils/tdx-config.js';import{saveSessionContext}from'../core/session.js';import{segmentWithActivationsToYaml,segmentToYamlString,apiRuleToYaml,journeyActivationStepToYaml}from'../sdk/segment/child-segment-yaml.js';import{apiToYamlAsync,toYamlString as a35_0x51a693}from'../sdk/segment/journey-yaml.js';import a35_0x398218 from'chalk';function a35_0x4548(_0x38131f,_0x41e73c){_0x38131f=_0x38131f-0x1e0;const _0x59387a=a35_0x5938();let _0x4548bf=_0x59387a[_0x38131f];return _0x4548bf;}import{existsSync,mkdirSync,readFileSync,writeFileSync,statSync}from'fs';import a35_0x2741df from'path';import{sanitizeFileName}from'../utils/string-utils.js';function a35_0x5938(){const _0x20931f=['Fetching\x20parent\x20segment\x20info...','isNew','journeyBundleId','\x20\x20Target:\x20','journeyBundleName','verbose','Fetching\x20journey\x20\x27','444050epUFvd','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','1802310vzAxGQ','hasChanges','size','13872lsNELR','error','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','set','\x20journeys','then','dim','\x0aPull\x20summary\x20for\x20\x27','session','name','getActivation','Fetching\x20journeys...','join','Found\x20tdx.json\x20at:\x20','utf-8','filter','isDirectory','content','✔\x20Context\x20set:\x20','red','data','get','\x20=\x20','segment','Error:\x20No\x20tdx.json\x20found\x20in\x20or\x20above:\x20','add','relativePath','dryRun','site','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)','.yml','description','journey','\x0aChanges\x20to\x20\x27','Fetching\x20activations...','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','activationParams','message','getParent','values','✔\x20Pulled\x20','repeat','yellow','\x20\x20🗺️\x20\x20','\x20files\x20to\x20','1682tiwDOq','rule','resolveParentId','\x27...','all','listSegments','cyan','Resolving\x20parent\x20segment\x20\x27','357PGCChB','folderId','from','listActivations','1670103DWJTmV','green','diff','kind','versionNumber','98432fqHqZV','execute','Fetching\x20connections\x20for\x20name\x20resolution...','user','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Using\x20parent\x20segment:\x20','Warning:\x20Could\x20not\x20resolve\x20segment\x20','Parent\x20segment:\x20','Fetching\x20folders...','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','parent_segment','push','\x20unchanged\x20files','Warning:\x20Could\x20not\x20resolve\x20activation\x20','\x20with\x20','dirname','\x20\x20🎯\x20','Processing\x20journeys...','length','setExtra','getJourney','parentSegment','sort','buildIdToEmailMap','absolutePath','getSegment','1365525CtoBcj','audienceId','\x20segments','\x20new\x20files','attributes','\x20files?','\x20versions)','867uLOCHh','relative','connection','listFolders','yaml','parentFolderId','has','reduce','20hMxMIE','setPhase'];a35_0x5938=function(){return _0x20931f;};return a35_0x5938();}import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyYaml,createJumpTargetCache,resolveJumpTarget}from'../utils/journey-utils.js';export class SegmentPullCommand extends BaseCommand{[a35_0x816586(0x23b)]='segment:pull';[a35_0x816586(0x251)]=a35_0x816586(0x204);async[a35_0x816586(0x1fc)](_0x45ac65){const _0x524813=a35_0x816586,{options:_0x74043b,args:_0x5ca3c7,tdx:_0x2c5b60}=_0x45ac65,_0x3f6063=_0x74043b,_0x25b80e=_0x74043b[_0x524813(0x210)],_0x2feb9d=_0x5ca3c7[0x0],_0x176d0c=findTdxConfigPath();let _0x47ce57,_0x1d6724;if(!_0x2feb9d&&_0x176d0c){const _0x174773=loadTdxConfig(_0x176d0c);_0x47ce57=_0x174773[_0x524813(0x205)],_0x1d6724=a35_0x2741df[_0x524813(0x20a)](_0x176d0c),_0x3f6063[_0x524813(0x22b)]&&(console[_0x524813(0x233)]('Found\x20existing\x20tdx.json\x20at:\x20'+_0x176d0c),console[_0x524813(0x233)](_0x524813(0x200)+_0x47ce57));}else{if(_0x2feb9d){if(existsSync(_0x2feb9d)&&statSync(_0x2feb9d)[_0x524813(0x242)]()){const _0x4e08bd=findTdxConfigPath(_0x2feb9d);if(_0x4e08bd){const _0x3268cd=loadTdxConfig(_0x4e08bd);_0x47ce57=_0x3268cd['parent_segment'],_0x1d6724=a35_0x2741df[_0x524813(0x20a)](_0x4e08bd),_0x3f6063[_0x524813(0x22b)]&&(console[_0x524813(0x233)](_0x524813(0x23f)+_0x4e08bd),console['error']('Using\x20parent\x20segment:\x20'+_0x47ce57));}else return console[_0x524813(0x233)](a35_0x398218[_0x524813(0x245)](_0x524813(0x24a)+_0x2feb9d+'\x0a')),console[_0x524813(0x233)](a35_0x398218[_0x524813(0x1f0)](_0x524813(0x1ff))),0x1;}else _0x47ce57=_0x2feb9d;}else _0x47ce57=_0x25b80e;}if(!_0x47ce57)return console[_0x524813(0x233)](a35_0x398218[_0x524813(0x1e7)](_0x524813(0x234))),console[_0x524813(0x233)](_0x524813(0x24f)),console['error'](_0x524813(0x1e0)),console[_0x524813(0x233)](_0x524813(0x22e)),0x1;_0x3f6063[_0x524813(0x22b)]&&(console[_0x524813(0x233)]('Site:\x20'+_0x3f6063[_0x524813(0x24e)]),console['error'](_0x524813(0x202)+_0x47ce57));const _0x3e214c=await withSpinner(_0x524813(0x1f1)+_0x47ce57+_0x524813(0x1ed),()=>_0x2c5b60[_0x524813(0x249)][_0x524813(0x1ec)](_0x47ce57),{'verbose':_0x3f6063[_0x524813(0x22b)]}),_0x36456f=_0x3e214c['data'],_0xf2503=await withSpinner(_0x524813(0x226),()=>_0x2c5b60[_0x524813(0x249)][_0x524813(0x1e3)](_0x36456f),{'verbose':_0x3f6063['verbose']}),_0x4327d1=_0xf2503[_0x524813(0x246)][_0x524813(0x219)]['name'];_0x3f6063['verbose']&&console[_0x524813(0x233)]('Resolved\x20parent\x20name:\x20'+_0x4327d1);const [_0x5adf48,_0x51d580,_0x4cb255]=await Promise[_0x524813(0x1ee)]([withSpinner('Fetching\x20segments...',()=>_0x2c5b60[_0x524813(0x249)][_0x524813(0x1ef)](_0x36456f),{'verbose':_0x3f6063[_0x524813(0x22b)]}),withSpinner(_0x524813(0x203),()=>_0x2c5b60[_0x524813(0x249)][_0x524813(0x21f)](_0x36456f),{'verbose':_0x3f6063['verbose']}),withSpinner(_0x524813(0x23d),()=>_0x2c5b60[_0x524813(0x252)]['listJourneysFromParentSegment'](_0x36456f),{'verbose':_0x3f6063[_0x524813(0x22b)]})]),_0x1c6ce7=_0x5adf48['data'],_0x264f97=_0x51d580[_0x524813(0x246)],_0x4bb3c2=_0x4cb255[_0x524813(0x246)];if(_0x1c6ce7[_0x524813(0x20d)]===0x0&&_0x4bb3c2[_0x524813(0x20d)]===0x0)return console[_0x524813(0x233)](a35_0x398218[_0x524813(0x1e7)]('No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27'+_0x4327d1+'\x27')),0x0;const _0x64cb46=buildFolderPathMap(_0x264f97),_0x12592b=_0x1d6724||getSegmentRootDir(sanitizeFileName(_0x47ce57)),_0x630f36=new Map();await withSpinner(_0x524813(0x254),async()=>{await batchAsync(_0x1c6ce7,async _0x5dda05=>{const _0x5dec0b=a35_0x4548,_0x4ae122=await _0x2c5b60['segment'][_0x5dec0b(0x1f5)](_0x36456f,_0x5dda05['id']);_0x630f36[_0x5dec0b(0x235)](_0x5dda05['id'],_0x4ae122);});},{'verbose':_0x3f6063[_0x524813(0x22b)]});const _0x4d49c9=await withSpinner('Fetching\x20users\x20for\x20email\x20resolution...',()=>_0x2c5b60[_0x524813(0x1fe)][_0x524813(0x212)](),{'verbose':_0x3f6063[_0x524813(0x22b)]})[_0x524813(0x237)](_0x16d633=>_0x16d633['data']),_0x8ee975=await withSpinner(_0x524813(0x1fd),()=>_0x2c5b60[_0x524813(0x21e)]['buildIdToNameMap'](),{'verbose':_0x3f6063[_0x524813(0x22b)]})[_0x524813(0x237)](_0x16bcb2=>_0x16bcb2[_0x524813(0x246)]),_0x11de11=[],_0x187991=a35_0x2741df[_0x524813(0x23e)](_0x12592b,'tdx.json'),_0x283cf9=createTdxConfigContent(_0x4327d1);_0x11de11['push'](prepareFile(_0x187991,_0x283cf9,_0x12592b));const _0x430774=new Map();for(const _0x5703c8 of _0x1c6ce7){if(_0x5703c8[_0x524813(0x1f9)]===SEGMENT_KIND_JOURNEY)continue;const _0x3984a4=_0x5703c8['segmentFolderId']?_0x64cb46[_0x524813(0x247)](_0x5703c8['segmentFolderId'])||'':'',_0x43e205=_0x630f36[_0x524813(0x247)](_0x5703c8['id'])||[],_0x38835b=segmentWithActivationsToYaml(_0x5703c8,_0x43e205,undefined,_0x4d49c9,_0x8ee975),_0x313a0d=_0x3984a4?a35_0x2741df['join'](_0x12592b,_0x3984a4):_0x12592b,_0x32253a=sanitizeFileName(_0x5703c8[_0x524813(0x23b)]),_0x637c9f=getUniqueFileName(_0x313a0d,_0x32253a,_0x430774),_0x53d052=a35_0x2741df[_0x524813(0x23e)](_0x313a0d,_0x637c9f+_0x524813(0x250)),_0x2791eb=segmentToYamlString(_0x38835b);_0x11de11[_0x524813(0x206)](prepareFile(_0x53d052,_0x2791eb,_0x12592b));}const _0x5c8a92=new Map();for(const _0x3caed2 of _0x1c6ce7){_0x5c8a92[_0x524813(0x235)](_0x3caed2['id'],_0x3caed2);}const _0x328e43=new Map();for(const _0x108641 of _0x4bb3c2){const _0x536afe=_0x108641[_0x524813(0x228)];!_0x328e43[_0x524813(0x222)](_0x536afe)&&_0x328e43[_0x524813(0x235)](_0x536afe,[]),_0x328e43[_0x524813(0x247)](_0x536afe)[_0x524813(0x206)](_0x108641);}for(const _0x2de750 of _0x328e43['values']()){_0x2de750[_0x524813(0x211)]((_0x4886b8,_0x597a52)=>(_0x4886b8[_0x524813(0x1fa)]||0x0)-(_0x597a52[_0x524813(0x1fa)]||0x0));}const _0x5f4b54=()=>{const _0x2b970b=_0x524813,_0x3e7726=new Set(),_0x180ee8=new Set(),_0x1d12d2=new Map(),_0x2a7411=new Map(),_0x5475f1=createJumpTargetCache(),_0x35b84b=(_0x14a6dd,_0xa95da5)=>({'resolveSegment':async _0x12864a=>{const _0x2ab5a6=a35_0x4548,_0x5513e4=_0x1d12d2[_0x2ab5a6(0x247)](_0x12864a);if(_0x5513e4!==undefined)return{'name':_0x5513e4,'isJourneyLocal':!![]};if(!_0xa95da5)return{'name':_0x12864a,'isJourneyLocal':![]};try{let _0x416627=_0x5c8a92[_0x2ab5a6(0x247)](_0x12864a);!_0x416627&&(_0x416627=await _0x2c5b60[_0x2ab5a6(0x249)][_0x2ab5a6(0x214)](_0xa95da5,_0x12864a));const _0x4635a6=generateJourneyLocalName(_0x416627[_0x2ab5a6(0x23b)]),_0x4f2cf4=_0x416627[_0x2ab5a6(0x1f9)]===SEGMENT_KIND_JOURNEY&&_0x4635a6!==undefined;let _0x4e1d38=_0x416627[_0x2ab5a6(0x23b)];if(_0x4f2cf4&&_0x4635a6){let _0x375707=_0x4635a6,_0x381b90=0x2;while(_0x3e7726[_0x2ab5a6(0x222)](_0x375707)){_0x375707=_0x4635a6+'_'+_0x381b90,_0x381b90++;}_0x3e7726[_0x2ab5a6(0x24b)](_0x375707),_0x4e1d38=_0x375707,_0x1d12d2[_0x2ab5a6(0x235)](_0x12864a,_0x4e1d38);}let _0x23161e;return _0x4f2cf4&&_0x416627['rule']&&(_0x23161e={'description':_0x416627[_0x2ab5a6(0x251)],'rule':apiRuleToYaml(_0x416627[_0x2ab5a6(0x1eb)])}),{'name':_0x4e1d38,'isJourneyLocal':_0x4f2cf4,'definition':_0x23161e};}catch(_0xcc0911){return _0x3f6063['verbose']&&console['error'](_0x2ab5a6(0x201)+_0x12864a+':\x20'+_0xcc0911[_0x2ab5a6(0x1e2)]),{'name':_0x12864a,'isJourneyLocal':![]};}},'resolveActivation':async _0x272705=>{const _0x2d9fe3=a35_0x4548,_0x192237=_0x2a7411[_0x2d9fe3(0x247)](_0x272705);if(_0x192237!==undefined)return{'name':_0x192237,'isJourneyLocal':!![]};try{const _0x418791=await _0x2c5b60[_0x2d9fe3(0x252)][_0x2d9fe3(0x23c)](_0x14a6dd,_0x272705),_0x499318=_0x418791[_0x2d9fe3(0x219)][_0x2d9fe3(0x1e1)]['name']||_0x272705,_0x5bd31a=sanitizeYamlKey(_0x499318)||'activation_'+_0x272705;let _0x3dcddf=_0x5bd31a,_0x1e9b57=0x2;while(_0x180ee8[_0x2d9fe3(0x222)](_0x3dcddf)){_0x3dcddf=_0x5bd31a+'_'+_0x1e9b57,_0x1e9b57++;}_0x180ee8[_0x2d9fe3(0x24b)](_0x3dcddf),_0x2a7411[_0x2d9fe3(0x235)](_0x272705,_0x3dcddf);const _0xdc64ba=journeyActivationStepToYaml(_0x418791,_0x4d49c9,_0x8ee975);return{'name':_0x3dcddf,'isJourneyLocal':!![],'definition':_0xdc64ba};}catch(_0xe2351e){return _0x3f6063[_0x2d9fe3(0x22b)]&&console['error'](_0x2d9fe3(0x208)+_0x272705+':\x20'+_0xe2351e['message']),{'name':_0x272705,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x259b3e,_0x8ddb5d)=>resolveJumpTarget(_0x259b3e,_0x8ddb5d,_0x5475f1,_0x5eef6b=>_0x2c5b60[_0x2b970b(0x252)]['getJourney'](_0x5eef6b))});return{'createYamlContext':_0x35b84b};};if(_0x328e43['size']>0x0){const _0x16cd37=Array[_0x524813(0x1f4)](_0x328e43['values']()),_0x239bf8=await withQuerySpinner(_0x524813(0x20c),async _0x510142=>{const _0x41ee8e=_0x524813,_0x16f9ed=[];let _0x34ef05=0x0;const _0xe45743=0x5;for(let _0x246c29=0x0;_0x246c29<_0x16cd37[_0x41ee8e(0x20d)];_0x246c29+=_0xe45743){const _0x2e38e9=_0x16cd37['slice'](_0x246c29,_0x246c29+_0xe45743),_0x2117ec=await Promise['all'](_0x2e38e9['map'](async _0x3d572c=>{const _0x27996e=_0x41ee8e,_0xabc60b=_0x3d572c[0x0],_0x21ed9d=_0xabc60b[_0x27996e(0x22a)];_0x510142[_0x27996e(0x225)](_0x27996e(0x22c)+_0x21ed9d+'\x27');const _0x3a147b=_0xabc60b[_0x27996e(0x1f3)]?_0x64cb46[_0x27996e(0x247)](_0xabc60b[_0x27996e(0x1f3)])||'':'',{createYamlContext:_0x5294c2}=_0x5f4b54(),_0x30896b=[];for(const _0x1511fa of _0x3d572c){const _0x4effb5=await _0x2c5b60[_0x27996e(0x252)][_0x27996e(0x20f)](_0x1511fa['id']),_0x5aa9a7=_0x4effb5[_0x27996e(0x219)]?.[_0x27996e(0x216)],_0xdcce4e=_0x5294c2(_0x1511fa['id'],_0x5aa9a7),_0xcc2e97=await apiToYamlAsync(_0x4effb5,_0xdcce4e);_0x30896b[_0x27996e(0x206)]({'item':_0x1511fa,'yaml':_0xcc2e97});}let _0x30ad52;return _0x30896b[_0x27996e(0x20d)]===0x1?_0x30ad52=_0x30896b[0x0][_0x27996e(0x220)]:_0x30ad52=buildMergedJourneyYaml(_0x30896b),{'bundleName':_0x21ed9d,'folderPath':_0x3a147b,'finalYaml':_0x30ad52};}));_0x16f9ed[_0x41ee8e(0x206)](..._0x2117ec),_0x34ef05+=_0x2e38e9[_0x41ee8e(0x20d)],_0x510142[_0x41ee8e(0x20e)]('('+_0x34ef05+'/'+_0x16cd37[_0x41ee8e(0x20d)]+')');}return _0x16f9ed;},{'verbose':_0x3f6063[_0x524813(0x22b)]});for(const {bundleName:_0x31d7ee,folderPath:_0x50779e,finalYaml:_0x569e0c}of _0x239bf8[_0x524813(0x246)]){const _0x1e0579=a35_0x51a693(_0x569e0c),_0x510301=_0x50779e?a35_0x2741df[_0x524813(0x23e)](_0x12592b,_0x50779e):_0x12592b,_0x4e4008=sanitizeFileName(_0x31d7ee),_0x1cacfd=getUniqueFileName(_0x510301,_0x4e4008,_0x430774),_0xae9a50=a35_0x2741df['join'](_0x510301,_0x1cacfd+_0x524813(0x250));_0x11de11[_0x524813(0x206)](prepareFile(_0xae9a50,_0x1e0579,_0x12592b));}}const _0x537ac7=Array['from'](_0x630f36[_0x524813(0x1e4)]())[_0x524813(0x223)]((_0x3b3568,_0x77a24)=>_0x3b3568+_0x77a24[_0x524813(0x20d)],0x0),_0x2c68aa=_0x11de11[_0x524813(0x241)](_0x3f5cf5=>_0x3f5cf5['isNew']),_0x83e86d=_0x11de11[_0x524813(0x241)](_0x558716=>!_0x558716[_0x524813(0x227)]&&_0x558716[_0x524813(0x230)]),_0x5e0f07=_0x11de11[_0x524813(0x241)](_0xc44b9=>!_0xc44b9[_0x524813(0x227)]&&!_0xc44b9['hasChanges']),_0x3395cc=_0x1c6ce7['filter'](_0xffd883=>_0xffd883['kind']!==SEGMENT_KIND_JOURNEY);console['error'](_0x524813(0x239)+_0x4327d1+'\x27:'),console[_0x524813(0x233)](_0x524813(0x20b)+a35_0x398218['cyan'](_0x3395cc['length']+_0x524813(0x217))+_0x524813(0x209)+a35_0x398218[_0x524813(0x1f0)](_0x537ac7+'\x20activations'));if(_0x328e43[_0x524813(0x231)]>0x0){const _0x18697d=_0x4bb3c2[_0x524813(0x20d)],_0x584bc6=_0x328e43['size'],_0x279dde=_0x18697d>_0x584bc6?'\x20('+_0x18697d+_0x524813(0x21b):'';console[_0x524813(0x233)](_0x524813(0x1e8)+a35_0x398218[_0x524813(0x1f0)](_0x584bc6+_0x524813(0x236))+a35_0x398218['dim'](_0x279dde));}console[_0x524813(0x233)]('\x20\x20'+a35_0x398218[_0x524813(0x1f7)]('+\x20'+_0x2c68aa[_0x524813(0x20d)]+_0x524813(0x218))),console[_0x524813(0x233)]('\x20\x20'+a35_0x398218['yellow']('~\x20'+_0x83e86d['length']+'\x20changed\x20files')),console[_0x524813(0x233)]('\x20\x20'+a35_0x398218[_0x524813(0x238)]('=\x20'+_0x5e0f07[_0x524813(0x20d)]+_0x524813(0x207))),console['error'](_0x524813(0x229)+a35_0x398218['cyan'](_0x12592b)+'\x0a');if(_0x83e86d[_0x524813(0x20d)]>0x0)for(const _0x508b23 of _0x83e86d){console['error'](_0x524813(0x253)+_0x508b23[_0x524813(0x24c)]+'\x27:'),console[_0x524813(0x233)]('─'[_0x524813(0x1e6)](0x3c)),console['error'](_0x508b23[_0x524813(0x1f8)]),console[_0x524813(0x233)]('─'[_0x524813(0x1e6)](0x3c));}if(_0x3f6063[_0x524813(0x24d)])return console[_0x524813(0x233)](a35_0x398218[_0x524813(0x1e7)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x2c68aa[_0x524813(0x20d)]===0x0&&_0x83e86d[_0x524813(0x20d)]===0x0)return console[_0x524813(0x233)](a35_0x398218['green']('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x4327d1},_0x3f6063['session']),console[_0x524813(0x233)](a35_0x398218[_0x524813(0x1f7)](_0x524813(0x244)+a35_0x398218[_0x524813(0x238)](_0x524813(0x205))+_0x524813(0x248)+a35_0x398218[_0x524813(0x1f0)](_0x4327d1))),0x0;if(!_0x3f6063['yes']&&(_0x2c68aa[_0x524813(0x20d)]>0x0||_0x83e86d[_0x524813(0x20d)]>0x0)){const _0x1ad495=await confirmKey('Write\x20'+(_0x2c68aa[_0x524813(0x20d)]+_0x83e86d[_0x524813(0x20d)])+_0x524813(0x21a));if(!_0x1ad495)return console[_0x524813(0x233)]('Aborted.'),0x1;}for(const _0x16775d of _0x11de11){if(_0x16775d[_0x524813(0x227)]||_0x16775d[_0x524813(0x230)]){const _0x4a9e9a=a35_0x2741df['dirname'](_0x16775d[_0x524813(0x213)]);!existsSync(_0x4a9e9a)&&mkdirSync(_0x4a9e9a,{'recursive':!![]}),writeFileSync(_0x16775d[_0x524813(0x213)],_0x16775d[_0x524813(0x243)],_0x524813(0x240));}}return console[_0x524813(0x233)](a35_0x398218['green'](_0x524813(0x1e5)+(_0x2c68aa['length']+_0x83e86d[_0x524813(0x20d)])+_0x524813(0x1e9)+_0x12592b)),saveSessionContext({'parent_segment':_0x4327d1},_0x3f6063[_0x524813(0x23a)]),console[_0x524813(0x233)](a35_0x398218[_0x524813(0x1f7)]('✔\x20Context\x20set:\x20'+a35_0x398218[_0x524813(0x238)](_0x524813(0x205))+_0x524813(0x248)+a35_0x398218['cyan'](_0x4327d1))),0x0;}}function buildFolderPathMap(_0x1a8e79){const _0x40350c=a35_0x816586,_0xc7ab7b=new Map(),_0x340ad2=new Map();for(const _0x3a47f1 of _0x1a8e79){_0x340ad2['set'](_0x3a47f1['id'],_0x3a47f1);}const _0x36f7a8=new Set();for(const _0x1f0cec of _0x1a8e79){!_0x1f0cec[_0x40350c(0x221)]&&_0x36f7a8[_0x40350c(0x24b)](_0x1f0cec['id']);}function _0x3d86ae(_0x2dab0d){const _0x1ab614=_0x40350c;if(_0xc7ab7b['has'](_0x2dab0d['id']))return _0xc7ab7b['get'](_0x2dab0d['id']);if(_0x36f7a8[_0x1ab614(0x222)](_0x2dab0d['id']))return _0xc7ab7b[_0x1ab614(0x235)](_0x2dab0d['id'],''),'';if(_0x2dab0d[_0x1ab614(0x221)]){const _0x23cdcd=_0x340ad2[_0x1ab614(0x247)](_0x2dab0d[_0x1ab614(0x221)]);if(_0x23cdcd){const _0x181615=_0x3d86ae(_0x23cdcd),_0x453789=_0x181615?_0x181615+'/'+_0x2dab0d[_0x1ab614(0x23b)]:_0x2dab0d[_0x1ab614(0x23b)];return _0xc7ab7b['set'](_0x2dab0d['id'],_0x453789),_0x453789;}}const _0x4dc7f2=_0x2dab0d[_0x1ab614(0x23b)];return _0xc7ab7b[_0x1ab614(0x235)](_0x2dab0d['id'],_0x4dc7f2),_0x4dc7f2;}for(const _0x154d34 of _0x1a8e79){_0x3d86ae(_0x154d34);}return _0xc7ab7b;}function getUniqueFileName(_0x2680bd,_0x3709c6,_0x4d429d){const _0x3b5134=a35_0x816586,_0x34e755=_0x2680bd+':'+_0x3709c6,_0x1faba1=_0x4d429d[_0x3b5134(0x247)](_0x34e755)||0x0;_0x4d429d[_0x3b5134(0x235)](_0x34e755,_0x1faba1+0x1);if(_0x1faba1===0x0)return _0x3709c6;return _0x3709c6+'-'+_0x1faba1;}function prepareFile(_0x111328,_0x506523,_0x54057e){const _0x40a32e=a35_0x816586,_0x126da3=a35_0x2741df[_0x40a32e(0x21d)](_0x54057e,_0x111328);if(existsSync(_0x111328)){const _0x5710a6=readFileSync(_0x111328,_0x40a32e(0x240)),_0x1361c2=generateDiff(_0x5710a6,_0x506523),_0x49af44=hasChanges(_0x1361c2);return{'relativePath':_0x126da3,'absolutePath':_0x111328,'content':_0x506523,'isNew':![],'hasChanges':_0x49af44,'diff':_0x49af44?formatDiffWithColors(_0x1361c2):undefined};}return{'relativePath':_0x126da3,'absolutePath':_0x111328,'content':_0x506523,'isNew':!![],'hasChanges':![]};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segment-push-command.d.ts","sourceRoot":"","sources":["../../src/commands/segment-push-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"segment-push-command.d.ts","sourceRoot":"","sources":["../../src/commands/segment-push-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAuMhE;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,WAAW;IACjD,QAAQ,CAAC,IAAI,kBAAkB;IAC/B,QAAQ,CAAC,WAAW,wDAAwD;IAEtE,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;CAooDxD"}
|