@treasuredata/tdx 0.23.1 β 0.24.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 +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/use-command.js +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/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/process.js.map +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a26_0x506400=a26_0x4389;(function(_0x1582ab,_0x46ad70){const _0x4cf849=a26_0x4389,_0xb90c6f=_0x1582ab();while(!![]){try{const _0x1fb093=parseInt(_0x4cf849(0x103))/0x1*(parseInt(_0x4cf849(0x134))/0x2)+parseInt(_0x4cf849(0x108))/0x3*(parseInt(_0x4cf849(0xf9))/0x4)+parseInt(_0x4cf849(0x14a))/0x5*(parseInt(_0x4cf849(0x150))/0x6)+parseInt(_0x4cf849(0x141))/0x7*(-parseInt(_0x4cf849(0x128))/0x8)+parseInt(_0x4cf849(0x10c))/0x9*(parseInt(_0x4cf849(0x11e))/0xa)+-parseInt(_0x4cf849(0xe0))/0xb+parseInt(_0x4cf849(0x11a))/0xc*(-parseInt(_0x4cf849(0xdc))/0xd);if(_0x1fb093===_0x46ad70)break;else _0xb90c6f['push'](_0xb90c6f['shift']());}catch(_0x27ec7d){_0xb90c6f['push'](_0xb90c6f['shift']());}}}(a26_0x45d5,0x8b30a));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a26_0x4389(_0x4a7aa2,_0x179684){_0x4a7aa2=_0x4a7aa2-0xc8;const _0x45d5ad=a26_0x45d5();let _0x43894a=_0x45d5ad[_0x4a7aa2];return _0x43894a;}function a26_0x45d5(){const _0x3e75a7=['list','trino','next_run_at','statusIcon','\x20scheduled\x20quer','output','substring','repeat','green','start_at','\x20(use\x20--limit\x20to\x20see\x20more)','run','description','ended_at','\x20\x20Type:\x20','has_next_page','site','padEnd','name','Run\x20a\x20scheduled\x20query\x20immediately','h\x20ago','Schedule\x20updated:\x20','\x20created','retry_limit','2793556dnNJGP','No\x20scheduled\x20queries\x20found','status','\x20job','schedule:update','result','lastRun','Deleting\x20schedule...','Delete\x20a\x20scheduled\x20query','utf-8','3nSglSq','delay','max','INVALID_ARGUMENT','queries','3yEwUkR','never','Schedule\x20created:\x20','schedule:delete','236565ifYHuO','num','user_name','map','Update\x20a\x20scheduled\x20query','Schedule\x20deleted:\x20','engineVersion','data','getTime','\x20execution','validate','join','table','schedule:show','816WsSlMf','job_id','create','timezone','240Dwwffr','Showing\x20first\x20','from','schedule:history','error','\x20\x20Cron:\x20','verbose','round','history','listQueries','1504888QAkxHl','time','cyan','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','/app/queries/editor?queryId=','schedules','Found\x20','Failed\x20to\x20read\x20file:\x20','trim','Updating\x20schedule...','\x20matching\x20\x22','\x20\x20β\x20','200470TdCrBf','query','scheduled_at','time_zone','args','Creating\x20schedule...','d\x20ago','user','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','file','end_at','last_job','execute','21OtpUsJ','type','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','executing_user_id','(unnamed)','engine_version','\x20\x20Time:\x20','in\x20','jobs','10bSdZJD','log','just\x20now','show','queryUrl','Getting\x20schedule\x20history...','1325070yDIbUc','entries','database','priority','schedule:run','count','format','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','json','m\x20ago','abs','length','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]','yes','retryLimit','success','\x20schedules','nextRun','cron','update','schedule:create','pagination','21346DoBldC','Getting\x20schedule\x20details...','updated_at','tsv','9080643XluRVU'];a26_0x45d5=function(){return _0x3e75a7;};return a26_0x45d5();}import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a26_0x328ac9 from'chalk';function formatRelativeTime(_0x403635){const _0x35f8a1=a26_0x4389,_0x1dfbe1=new Date(_0x403635),_0x4c5ca5=new Date(),_0x5579ed=_0x1dfbe1[_0x35f8a1(0x114)]()-_0x4c5ca5[_0x35f8a1(0x114)](),_0x72d2ac=Math[_0x35f8a1(0xd0)](_0x5579ed)/0x3e8,_0x14a51e=_0x5579ed<0x0;if(_0x72d2ac<0x3c)return _0x14a51e?_0x35f8a1(0x14c):'soon';else{if(_0x72d2ac<0xe10){const _0x67dc7c=Math['round'](_0x72d2ac/0x3c);return _0x14a51e?_0x67dc7c+_0x35f8a1(0xcf):_0x35f8a1(0x148)+_0x67dc7c+'m';}else{if(_0x72d2ac<0x15180){const _0x38cfb0=Math[_0x35f8a1(0x125)](_0x72d2ac/0xe10);return _0x14a51e?_0x38cfb0+_0x35f8a1(0xf5):_0x35f8a1(0x148)+_0x38cfb0+'h';}else{if(_0x72d2ac<0x93a80){const _0x59e47d=Math[_0x35f8a1(0x125)](_0x72d2ac/0x15180);return _0x14a51e?_0x59e47d+_0x35f8a1(0x13a):_0x35f8a1(0x148)+_0x59e47d+'d';}else return _0x1dfbe1['toLocaleDateString']();}}}}export class ScheduleListCommand extends BaseCommand{['name']='schedule:list';[a26_0x506400(0xed)]='List\x20scheduled\x20queries';async[a26_0x506400(0x140)](_0x5d9126){const _0x2f5a4a=a26_0x506400,{options:_0x5ee809,args:_0x480bbf,tdx:_0x4aa3cb}=_0x5d9126,_0x307533=resolveLimit(_0x5ee809['limit'],DEFAULT_DISPLAY_LIMIT),_0x25ac38=_0x480bbf[0x0],_0x4009c5=_0x25ac38?'Searching\x20scheduled\x20queries\x20matching\x20\x22'+_0x25ac38+'\x22...':'Listing\x20scheduled\x20queries...',_0x9645c9=await withSpinner(_0x4009c5,()=>_0x4aa3cb[_0x2f5a4a(0x12d)][_0x2f5a4a(0x127)]({'limit':_0x307533,'scheduled':!![],'pattern':_0x25ac38}),{'verbose':_0x5ee809[_0x2f5a4a(0x124)]}),_0x5b0a29=_0x9645c9['data'][_0x2f5a4a(0x107)],_0x55128f=_0x9645c9[_0x2f5a4a(0x113)][_0x2f5a4a(0xdb)][_0x2f5a4a(0xf0)],_0x5f37fe=_0x25ac38?_0x2f5a4a(0x132)+_0x25ac38+'\x22':'';_0x55128f?console[_0x2f5a4a(0x122)](_0x2f5a4a(0x11f)+_0x5b0a29[_0x2f5a4a(0xd1)]+_0x2f5a4a(0xd6)+_0x5f37fe+_0x2f5a4a(0xeb)):console['error'](_0x2f5a4a(0x12e)+_0x5b0a29[_0x2f5a4a(0xd1)]+_0x2f5a4a(0xe5)+(_0x5b0a29[_0x2f5a4a(0xd1)]!==0x1?'ies':'y')+_0x5f37fe);if(_0x5ee809[_0x2f5a4a(0xcc)]===_0x2f5a4a(0xce)||_0x5ee809[_0x2f5a4a(0xcc)]==='jsonl'||_0x5ee809[_0x2f5a4a(0xcc)]===_0x2f5a4a(0x118)||_0x5ee809[_0x2f5a4a(0xcc)]===_0x2f5a4a(0xdf)){const _0x1b7b30=_0x5b0a29[_0x2f5a4a(0x10f)](_0xdc4e35=>({'id':_0xdc4e35['id'],'name':_0xdc4e35[_0x2f5a4a(0xf3)],'cron':_0xdc4e35[_0x2f5a4a(0xd8)],'database':_0xdc4e35['database']?.[_0x2f5a4a(0xf3)],'type':_0xdc4e35[_0x2f5a4a(0x142)],'timezone':_0xdc4e35[_0x2f5a4a(0x137)],'user_name':_0xdc4e35[_0x2f5a4a(0x13b)]?.[_0x2f5a4a(0xf3)],'updated_at':_0xdc4e35[_0x2f5a4a(0xde)],'next_run_at':_0xdc4e35[_0x2f5a4a(0xe3)],'last_job_status':_0xdc4e35['last_job']?.['status']}));await handleSDKOutput(_0x1b7b30,_0x5ee809);}else{if(_0x5b0a29[_0x2f5a4a(0xd1)]===0x0)console[_0x2f5a4a(0x14b)](_0x2f5a4a(0xfa));else{const _0x546044=_0x5ee809[_0x2f5a4a(0xf1)],_0x20743a=_0x5b0a29[_0x2f5a4a(0x10f)](_0x17564a=>{const _0x4b3155=_0x2f5a4a,_0x1ef497=_0x17564a[_0x4b3155(0x13f)]?.[_0x4b3155(0xfb)]?_0x17564a['last_job'][_0x4b3155(0xfb)]===_0x4b3155(0xd5)?'β':'β':'-',_0x3d9e6c=_0x17564a[_0x4b3155(0x13f)]?.[_0x4b3155(0xee)]?formatRelativeTime(_0x17564a[_0x4b3155(0x13f)]['ended_at']):_0x4b3155(0x109),_0x400eac=_0x17564a[_0x4b3155(0xe3)]?formatRelativeTime(_0x17564a[_0x4b3155(0xe3)]):'-',_0x285bb0=_0x17564a[_0x4b3155(0xd8)]||'',_0x58edde=_0x17564a['name']||_0x4b3155(0x145),_0x2c4e26=getConsoleUrl(_0x546044,_0x4b3155(0x12c)+_0x17564a['id']);return{'statusIcon':_0x1ef497,'lastRun':_0x3d9e6c,'nextRun':_0x400eac,'cron':_0x285bb0,'name':_0x58edde,'queryUrl':_0x2c4e26,'status':_0x17564a['last_job']?.[_0x4b3155(0xfb)]};}),_0xc0c6c8=Math[_0x2f5a4a(0x105)](..._0x20743a[_0x2f5a4a(0x10f)](_0x5a0530=>_0x5a0530[_0x2f5a4a(0xff)][_0x2f5a4a(0xd1)])),_0x4e3883=Math[_0x2f5a4a(0x105)](..._0x20743a['map'](_0x3d6f93=>_0x3d6f93[_0x2f5a4a(0xd7)][_0x2f5a4a(0xd1)])),_0x1a242a=Math['max'](..._0x20743a['map'](_0x167ca9=>_0x167ca9[_0x2f5a4a(0xd8)]['length'])),_0x559a41=_0x20743a[_0x2f5a4a(0x10f)](_0x99b931=>{const _0x1cb03e=_0x2f5a4a,_0x39843e=_0x99b931[_0x1cb03e(0xfb)]===_0x1cb03e(0xd5)?a26_0x328ac9[_0x1cb03e(0xe9)](_0x99b931[_0x1cb03e(0xe4)]):_0x99b931[_0x1cb03e(0xfb)]===_0x1cb03e(0x122)?a26_0x328ac9['red'](_0x99b931[_0x1cb03e(0xe4)]):a26_0x328ac9['dim'](_0x99b931['statusIcon']),_0x3b9027=_0x99b931['lastRun'][_0x1cb03e(0xf2)](_0xc0c6c8),_0x309735=_0x99b931['nextRun']['padEnd'](_0x4e3883),_0x2a87f7=_0x99b931['cron']?a26_0x328ac9[_0x1cb03e(0x12a)](_0x99b931[_0x1cb03e(0xd8)][_0x1cb03e(0xf2)](_0x1a242a)):'\x20'[_0x1cb03e(0xe8)](_0x1a242a),_0x4b48dc=hyperlink(_0x99b931['name'],_0x99b931[_0x1cb03e(0x14e)]);return'π
\x20'+_0x39843e+'\x20'+_0x3b9027+_0x1cb03e(0x133)+_0x309735+'\x20\x20'+_0x2a87f7+'\x20\x20'+_0x4b48dc;});await writeOutput(_0x559a41[_0x2f5a4a(0x117)]('\x0a'),_0x5ee809[_0x2f5a4a(0xe6)],_0x2f5a4a(0xe1));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a26_0x506400(0xf3)]=a26_0x506400(0x119);[a26_0x506400(0xed)]='Show\x20schedule\x20details';[a26_0x506400(0x116)](_0x1ec3ae){const _0x512744=a26_0x506400,_0x41d592=_0x1ec3ae[_0x512744(0x138)][0x0];if(!_0x41d592)return _0x512744(0x12b);return undefined;}async['execute'](_0xcf677f){const _0x35fa9d=a26_0x506400,{options:_0x3a023d,args:_0x544049,tdx:_0x10217e}=_0xcf677f,_0x34c1ea=_0x544049[0x0],_0x2b225a=await withSpinner(_0x35fa9d(0xdd),()=>_0x10217e[_0x35fa9d(0x12d)][_0x35fa9d(0x14d)](_0x34c1ea),{'verbose':_0x3a023d[_0x35fa9d(0x124)]}),_0x4a030d=_0x2b225a[_0x35fa9d(0x113)],_0x35c6aa={'name':_0x4a030d['name'],'cron':_0x4a030d[_0x35fa9d(0xd8)],'database':_0x4a030d[_0x35fa9d(0xc8)],'type':_0x4a030d['type'],'timezone':_0x4a030d['timezone'],'user_name':_0x4a030d[_0x35fa9d(0x10e)],'created_at':_0x4a030d['created_at'],'engine_version':_0x4a030d[_0x35fa9d(0x146)],'executing_user_id':_0x4a030d[_0x35fa9d(0x144)],'query':_0x4a030d[_0x35fa9d(0x135)],'delay':_0x4a030d[_0x35fa9d(0x104)],'priority':_0x4a030d[_0x35fa9d(0xc9)],'retry_limit':_0x4a030d[_0x35fa9d(0xf8)],..._0x4a030d[_0x35fa9d(0xfe)]&&{'result':_0x4a030d[_0x35fa9d(0xfe)]}};return await handleSingleObjectOutput(_0x35c6aa,_0x3a023d),0x0;}}export class ScheduleCreateCommand extends BaseCommand{[a26_0x506400(0xf3)]=a26_0x506400(0xda);[a26_0x506400(0xed)]='Create\x20a\x20scheduled\x20query';[a26_0x506400(0x116)](_0x46842b){const _0x3adcd6=_0x46842b['args'][0x0];if(!_0x3adcd6)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]';return undefined;}async[a26_0x506400(0x140)](_0x283154){const _0x89aa0c=a26_0x506400,{options:_0x26b5fd,args:_0x683b03,tdx:_0x4abf09}=_0x283154,_0x50f76e=_0x683b03[0x0],_0xdd600f=_0x26b5fd,_0x246c3d=_0xdd600f[_0x89aa0c(0xc8)],_0x3475ff=_0xdd600f[_0x89aa0c(0x13d)],_0x123ec5=_0xdd600f[_0x89aa0c(0x142)]||_0x89aa0c(0xe2);let _0x168966;try{_0x168966=readFileSync(_0x3475ff,'utf-8')['trim']();}catch(_0x12705c){throw new SDKError(ErrorCode[_0x89aa0c(0x106)],_0x89aa0c(0x12f)+_0x3475ff,_0x12705c instanceof Error?_0x12705c:undefined);}if(!_0x168966)throw new SDKError(ErrorCode[_0x89aa0c(0x106)],'Query\x20file\x20is\x20empty');const _0x9ac9b3={'database':_0x246c3d,'query':_0x168966,'type':_0x123ec5};if(_0xdd600f[_0x89aa0c(0xd8)])_0x9ac9b3['cron']=_0xdd600f['cron'];if(_0xdd600f[_0x89aa0c(0x11d)])_0x9ac9b3['timezone']=_0xdd600f[_0x89aa0c(0x11d)];if(_0xdd600f[_0x89aa0c(0x104)]!==undefined)_0x9ac9b3[_0x89aa0c(0x104)]=Number(_0xdd600f['delay']);if(_0xdd600f[_0x89aa0c(0xc9)]!==undefined)_0x9ac9b3[_0x89aa0c(0xc9)]=Number(_0xdd600f[_0x89aa0c(0xc9)]);if(_0xdd600f['retryLimit']!==undefined)_0x9ac9b3[_0x89aa0c(0xf8)]=Number(_0xdd600f['retryLimit']);if(_0xdd600f[_0x89aa0c(0x112)])_0x9ac9b3[_0x89aa0c(0x146)]=_0xdd600f[_0x89aa0c(0x112)];if(_0xdd600f[_0x89aa0c(0xfe)])_0x9ac9b3[_0x89aa0c(0xfe)]=_0xdd600f['result'];if(_0x26b5fd[_0x89aa0c(0x124)]){console[_0x89aa0c(0x122)]('Creating\x20schedule:\x20'+_0x50f76e),console['error']('\x20\x20Database:\x20'+_0x246c3d),console['error'](_0x89aa0c(0xef)+_0x123ec5);if(_0x9ac9b3[_0x89aa0c(0xd8)])console[_0x89aa0c(0x122)](_0x89aa0c(0x123)+_0x9ac9b3[_0x89aa0c(0xd8)]);if(_0x9ac9b3[_0x89aa0c(0x11d)])console[_0x89aa0c(0x122)]('\x20\x20Timezone:\x20'+_0x9ac9b3[_0x89aa0c(0x11d)]);}const _0x562a0e=await withSpinner(_0x89aa0c(0x139),()=>_0x4abf09[_0x89aa0c(0x12d)][_0x89aa0c(0x11c)](_0x50f76e,_0x9ac9b3),{'verbose':_0x26b5fd[_0x89aa0c(0x124)]});return console[_0x89aa0c(0x122)](_0x89aa0c(0x10a)+_0x562a0e[_0x89aa0c(0x113)][_0x89aa0c(0xf3)]),await handleSingleObjectOutput(_0x562a0e[_0x89aa0c(0x113)],_0x26b5fd),0x0;}}export class ScheduleUpdateCommand extends BaseCommand{[a26_0x506400(0xf3)]=a26_0x506400(0xfd);[a26_0x506400(0xed)]=a26_0x506400(0x110);[a26_0x506400(0x116)](_0x83a7a5){const _0x2eedc9=a26_0x506400,_0x3b1583=_0x83a7a5[_0x2eedc9(0x138)][0x0];if(!_0x3b1583)return _0x2eedc9(0x143);return undefined;}async[a26_0x506400(0x140)](_0x57a645){const _0x49c305=a26_0x506400,{options:_0x59025b,args:_0x2f2113,tdx:_0x53932d}=_0x57a645,_0x179d7f=_0x2f2113[0x0],_0x5e7f74=_0x59025b,_0x7f89d4={};if(_0x5e7f74[_0x49c305(0xc8)])_0x7f89d4[_0x49c305(0xc8)]=_0x5e7f74['database'];if(_0x5e7f74[_0x49c305(0x142)])_0x7f89d4[_0x49c305(0x142)]=_0x5e7f74['type'];if(_0x5e7f74[_0x49c305(0xd8)])_0x7f89d4[_0x49c305(0xd8)]=_0x5e7f74[_0x49c305(0xd8)];if(_0x5e7f74['timezone'])_0x7f89d4[_0x49c305(0x11d)]=_0x5e7f74[_0x49c305(0x11d)];if(_0x5e7f74[_0x49c305(0x104)]!==undefined)_0x7f89d4[_0x49c305(0x104)]=Number(_0x5e7f74[_0x49c305(0x104)]);if(_0x5e7f74['priority']!==undefined)_0x7f89d4[_0x49c305(0xc9)]=Number(_0x5e7f74[_0x49c305(0xc9)]);if(_0x5e7f74['retryLimit']!==undefined)_0x7f89d4['retry_limit']=Number(_0x5e7f74[_0x49c305(0xd4)]);if(_0x5e7f74[_0x49c305(0x112)])_0x7f89d4[_0x49c305(0x146)]=_0x5e7f74['engineVersion'];if(_0x5e7f74['result'])_0x7f89d4['result']=_0x5e7f74['result'];if(_0x5e7f74[_0x49c305(0x13d)])try{_0x7f89d4[_0x49c305(0x135)]=readFileSync(_0x5e7f74[_0x49c305(0x13d)],_0x49c305(0x102))[_0x49c305(0x130)]();}catch(_0x4a25dc){throw new SDKError(ErrorCode[_0x49c305(0x106)],_0x49c305(0x12f)+_0x5e7f74[_0x49c305(0x13d)],_0x4a25dc instanceof Error?_0x4a25dc:undefined);}if(Object['keys'](_0x7f89d4)[_0x49c305(0xd1)]===0x0)throw new SDKError(ErrorCode[_0x49c305(0x106)],_0x49c305(0xcd));if(_0x59025b[_0x49c305(0x124)]){console[_0x49c305(0x122)]('Updating\x20schedule:\x20'+_0x179d7f);for(const [_0xf8d0c0,_0x57bf51]of Object[_0x49c305(0x151)](_0x7f89d4)){_0xf8d0c0===_0x49c305(0x135)?console['error']('\x20\x20'+_0xf8d0c0+':\x20'+_0x57bf51[_0x49c305(0xe7)](0x0,0x32)+'...'):console[_0x49c305(0x122)]('\x20\x20'+_0xf8d0c0+':\x20'+_0x57bf51);}}const _0x2d1dfa=await withSpinner(_0x49c305(0x131),()=>_0x53932d['schedules'][_0x49c305(0xd9)](_0x179d7f,_0x7f89d4),{'verbose':_0x59025b[_0x49c305(0x124)]});return console['error'](_0x49c305(0xf6)+_0x2d1dfa[_0x49c305(0x113)][_0x49c305(0xf3)]),await handleSingleObjectOutput(_0x2d1dfa[_0x49c305(0x113)],_0x59025b),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{['name']=a26_0x506400(0x10b);[a26_0x506400(0xed)]=a26_0x506400(0x101);['validate'](_0x301464){const _0x2a9566=a26_0x506400,_0x3f34a3=_0x301464['args'][0x0];if(!_0x3f34a3)return _0x2a9566(0x13c);return undefined;}async[a26_0x506400(0x140)](_0x455cf9){const _0x58573d=a26_0x506400,{options:_0x3579bf,args:_0x559eda,tdx:_0x318e29}=_0x455cf9,_0x34ad32=_0x559eda[0x0];if(!_0x3579bf[_0x58573d(0xd3)]){const _0x304e45=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22'+_0x34ad32+'\x22?');if(!_0x304e45)return console[_0x58573d(0x122)]('Cancelled'),0x0;}const _0x14a419=await withSpinner(_0x58573d(0x100),()=>_0x318e29[_0x58573d(0x12d)]['delete'](_0x34ad32),{'verbose':_0x3579bf[_0x58573d(0x124)]});return console[_0x58573d(0x122)](_0x58573d(0x111)+_0x14a419['data'][_0x58573d(0xf3)]),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a26_0x506400(0xf3)]=a26_0x506400(0xca);['description']=a26_0x506400(0xf4);['validate'](_0x1a427e){const _0x145db2=a26_0x506400,_0x193521=_0x1a427e[_0x145db2(0x138)][0x0];if(!_0x193521)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async[a26_0x506400(0x140)](_0xcac061){const _0x3b3488=a26_0x506400,{options:_0x2d0778,args:_0x24bf34,tdx:_0x468c67}=_0xcac061,_0x24bf6d=_0x24bf34[0x0],_0x6c7089=_0x2d0778,_0x5838e6=_0x6c7089[_0x3b3488(0x129)],_0x4f3404=_0x6c7089[_0x3b3488(0x10d)]!==undefined?Number(_0x6c7089[_0x3b3488(0x10d)]):undefined;if(_0x2d0778[_0x3b3488(0x124)]){console[_0x3b3488(0x122)]('Running\x20schedule:\x20'+_0x24bf6d);if(_0x5838e6)console[_0x3b3488(0x122)](_0x3b3488(0x147)+_0x5838e6);if(_0x4f3404)console['error']('\x20\x20Num:\x20'+_0x4f3404);}const _0x4e0821=await withSpinner('Running\x20schedule...',()=>_0x468c67[_0x3b3488(0x12d)][_0x3b3488(0xec)](_0x24bf6d,{'time':_0x5838e6,'num':_0x4f3404}),{'verbose':_0x2d0778[_0x3b3488(0x124)]}),_0x37b01a=_0x4e0821[_0x3b3488(0x113)][_0x3b3488(0x149)];console[_0x3b3488(0x122)]('Schedule\x20run\x20submitted:\x20'+_0x37b01a[_0x3b3488(0xd1)]+_0x3b3488(0xfc)+(_0x37b01a[_0x3b3488(0xd1)]!==0x1?'s':'')+_0x3b3488(0xf7));for(const _0x2117bc of _0x37b01a){console[_0x3b3488(0x122)]('\x20\x20Job\x20ID:\x20'+_0x2117bc[_0x3b3488(0x11b)]);}return await handleSDKOutput(_0x37b01a,_0x2d0778),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a26_0x506400(0xf3)]=a26_0x506400(0x121);[a26_0x506400(0xed)]='Show\x20schedule\x20execution\x20history';['validate'](_0x78b2f3){const _0x36e63d=a26_0x506400,_0x113c5f=_0x78b2f3[_0x36e63d(0x138)][0x0];if(!_0x113c5f)return _0x36e63d(0xd2);return undefined;}async[a26_0x506400(0x140)](_0x170cd8){const _0x2f0fa3=a26_0x506400,{options:_0x3ce61a,args:_0x2528c2,tdx:_0x5dbfc9}=_0x170cd8,_0x192683=_0x2528c2[0x0],_0x579fbc=_0x3ce61a,_0x2c9628=_0x579fbc[_0x2f0fa3(0x120)]!==undefined?Number(_0x579fbc[_0x2f0fa3(0x120)]):undefined,_0x15d82c=_0x579fbc['to']!==undefined?Number(_0x579fbc['to']):undefined,_0x46aa40=await withSpinner(_0x2f0fa3(0x14f),()=>_0x5dbfc9['schedules'][_0x2f0fa3(0x126)](_0x192683,{'from':_0x2c9628,'to':_0x15d82c}),{'verbose':_0x3ce61a[_0x2f0fa3(0x124)]}),_0x3dccb3=_0x46aa40['data'];console[_0x2f0fa3(0x122)](_0x2f0fa3(0x12e)+_0x3dccb3[_0x2f0fa3(0xcb)]+_0x2f0fa3(0x115)+(_0x3dccb3[_0x2f0fa3(0xcb)]!==0x1?'s':'')+'\x20(showing\x20'+_0x3dccb3[_0x2f0fa3(0x120)]+'-'+_0x3dccb3['to']+')');const _0x3983db=_0x3dccb3[_0x2f0fa3(0x126)][_0x2f0fa3(0x10f)](_0x364be1=>({'job_id':_0x364be1[_0x2f0fa3(0x11b)],'type':_0x364be1['type'],'status':_0x364be1[_0x2f0fa3(0xfb)],'scheduled_at':_0x364be1[_0x2f0fa3(0x136)],'created_at':_0x364be1['created_at'],'start_at':_0x364be1[_0x2f0fa3(0xea)],'end_at':_0x364be1[_0x2f0fa3(0x13e)]}));return await handleSDKOutput(_0x3983db,_0x3ce61a),0x0;}}
|
|
1
|
+
const a26_0x200056=a26_0x13d8;(function(_0x17f2f9,_0x18ff00){const _0x3948e3=a26_0x13d8,_0x30564f=_0x17f2f9();while(!![]){try{const _0x32a4cb=parseInt(_0x3948e3(0x13e))/0x1*(parseInt(_0x3948e3(0x14a))/0x2)+-parseInt(_0x3948e3(0x11f))/0x3*(parseInt(_0x3948e3(0x126))/0x4)+parseInt(_0x3948e3(0x127))/0x5*(parseInt(_0x3948e3(0x152))/0x6)+-parseInt(_0x3948e3(0x106))/0x7*(parseInt(_0x3948e3(0x14e))/0x8)+parseInt(_0x3948e3(0x16f))/0x9*(-parseInt(_0x3948e3(0x17b))/0xa)+-parseInt(_0x3948e3(0x13d))/0xb*(-parseInt(_0x3948e3(0x130))/0xc)+parseInt(_0x3948e3(0xf8))/0xd;if(_0x32a4cb===_0x18ff00)break;else _0x30564f['push'](_0x30564f['shift']());}catch(_0x333bd0){_0x30564f['push'](_0x30564f['shift']());}}}(a26_0x2654,0x269fb));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{readFileSync}from'fs';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import a26_0x4d2e6c from'chalk';function formatRelativeTime(_0x1c102d){const _0x38d7e1=a26_0x13d8,_0x570d7d=new Date(_0x1c102d),_0x344fc2=new Date(),_0x549c5e=_0x570d7d[_0x38d7e1(0x179)]()-_0x344fc2[_0x38d7e1(0x179)](),_0x58b00d=Math['abs'](_0x549c5e)/0x3e8,_0x30bf3a=_0x549c5e<0x0;if(_0x58b00d<0x3c)return _0x30bf3a?'just\x20now':_0x38d7e1(0x163);else{if(_0x58b00d<0xe10){const _0x2f8573=Math[_0x38d7e1(0x16a)](_0x58b00d/0x3c);return _0x30bf3a?_0x2f8573+_0x38d7e1(0xf4):_0x38d7e1(0x13b)+_0x2f8573+'m';}else{if(_0x58b00d<0x15180){const _0x518742=Math['round'](_0x58b00d/0xe10);return _0x30bf3a?_0x518742+_0x38d7e1(0x14d):_0x38d7e1(0x13b)+_0x518742+'h';}else{if(_0x58b00d<0x93a80){const _0x154f68=Math['round'](_0x58b00d/0x15180);return _0x30bf3a?_0x154f68+_0x38d7e1(0x116):'in\x20'+_0x154f68+'d';}else return _0x570d7d[_0x38d7e1(0x149)]();}}}}function a26_0x13d8(_0x119bd3,_0x379576){_0x119bd3=_0x119bd3-0xed;const _0x26543d=a26_0x2654();let _0x13d8e3=_0x26543d[_0x119bd3];return _0x13d8e3;}export class ScheduleListCommand extends BaseCommand{['name']=a26_0x200056(0x158);[a26_0x200056(0x13a)]=a26_0x200056(0x17e);async[a26_0x200056(0x10c)](_0x54b826){const _0x280314=a26_0x200056,{options:_0x67490b,args:_0x16edb0,tdx:_0x27b86d}=_0x54b826,_0x587c34=resolveLimit(_0x67490b['limit'],DEFAULT_DISPLAY_LIMIT),_0x274db4=_0x16edb0[0x0],_0x533703=_0x274db4?_0x280314(0x123)+_0x274db4+_0x280314(0x10d):_0x280314(0x111),_0x3dfc13=await withSpinner(_0x533703,()=>_0x27b86d[_0x280314(0x12d)]['listQueries']({'limit':_0x587c34,'scheduled':!![],'pattern':_0x274db4}),{'verbose':_0x67490b[_0x280314(0x105)]}),_0x35e0bf=_0x3dfc13[_0x280314(0x122)]['queries'],_0x41e99d=_0x3dfc13[_0x280314(0x122)][_0x280314(0xee)][_0x280314(0x177)],_0x4791bb=_0x274db4?'\x20matching\x20\x22'+_0x274db4+'\x22':'';_0x41e99d?console[_0x280314(0x137)]('Showing\x20first\x20'+_0x35e0bf[_0x280314(0x100)]+'\x20schedules'+_0x4791bb+_0x280314(0x12b)):console['error'](_0x280314(0xf9)+_0x35e0bf[_0x280314(0x100)]+_0x280314(0x176)+(_0x35e0bf[_0x280314(0x100)]!==0x1?_0x280314(0xf5):'y')+_0x4791bb);if(_0x67490b[_0x280314(0x110)]===_0x280314(0xfa)||_0x67490b[_0x280314(0x110)]===_0x280314(0x140)||_0x67490b[_0x280314(0x110)]===_0x280314(0x129)||_0x67490b[_0x280314(0x110)]==='tsv'){const _0x4d2863=_0x35e0bf[_0x280314(0x101)](_0x9f3316=>({'id':_0x9f3316['id'],'name':_0x9f3316[_0x280314(0x146)],'cron':_0x9f3316[_0x280314(0x157)],'database':_0x9f3316[_0x280314(0x138)]?.[_0x280314(0x146)],'type':_0x9f3316[_0x280314(0x109)],'timezone':_0x9f3316['time_zone'],'user_name':_0x9f3316[_0x280314(0x14b)]?.[_0x280314(0x146)],'updated_at':_0x9f3316[_0x280314(0x103)],'next_run_at':_0x9f3316[_0x280314(0x120)],'last_job_status':_0x9f3316[_0x280314(0x154)]?.[_0x280314(0x164)]}));await handleSDKOutput(_0x4d2863,_0x67490b);}else{if(_0x35e0bf[_0x280314(0x100)]===0x0)console['log'](_0x280314(0xfd));else{const _0x1829aa=_0x67490b[_0x280314(0x143)],_0x321c40=_0x35e0bf[_0x280314(0x101)](_0x29c325=>{const _0x42b72c=_0x280314,_0x2f0f28=_0x29c325[_0x42b72c(0x154)]?.[_0x42b72c(0x164)]?_0x29c325['last_job'][_0x42b72c(0x164)]===_0x42b72c(0x10a)?'β':'β':'-',_0x2a424f=_0x29c325[_0x42b72c(0x154)]?.['ended_at']?formatRelativeTime(_0x29c325[_0x42b72c(0x154)][_0x42b72c(0x166)]):_0x42b72c(0xff),_0x34d0be=_0x29c325[_0x42b72c(0x120)]?formatRelativeTime(_0x29c325[_0x42b72c(0x120)]):'-',_0xe0b4a5=_0x29c325[_0x42b72c(0x157)]||'',_0x3ed4bd=_0x29c325[_0x42b72c(0x146)]||_0x42b72c(0xed),_0x292e46=getConsoleUrl(_0x1829aa,_0x42b72c(0x11a)+_0x29c325['id']);return{'statusIcon':_0x2f0f28,'lastRun':_0x2a424f,'nextRun':_0x34d0be,'cron':_0xe0b4a5,'name':_0x3ed4bd,'queryUrl':_0x292e46,'status':_0x29c325[_0x42b72c(0x154)]?.[_0x42b72c(0x164)]};}),_0x20b4d0=Math[_0x280314(0x121)](..._0x321c40[_0x280314(0x101)](_0x5ac1ed=>_0x5ac1ed['lastRun'][_0x280314(0x100)])),_0x8cc1ae=Math[_0x280314(0x121)](..._0x321c40[_0x280314(0x101)](_0x2b0798=>_0x2b0798['nextRun'][_0x280314(0x100)])),_0x3c20f1=Math[_0x280314(0x121)](..._0x321c40['map'](_0x1b424d=>_0x1b424d[_0x280314(0x157)][_0x280314(0x100)])),_0x932bef=_0x321c40['map'](_0x198cfb=>{const _0x28b555=_0x280314,_0x805e7d=_0x198cfb[_0x28b555(0x164)]===_0x28b555(0x10a)?a26_0x4d2e6c[_0x28b555(0x12e)](_0x198cfb[_0x28b555(0x148)]):_0x198cfb['status']===_0x28b555(0x137)?a26_0x4d2e6c[_0x28b555(0x16d)](_0x198cfb[_0x28b555(0x148)]):a26_0x4d2e6c[_0x28b555(0x15b)](_0x198cfb[_0x28b555(0x148)]),_0xfdf3ec=_0x198cfb['lastRun'][_0x28b555(0x178)](_0x20b4d0),_0x46545e=_0x198cfb[_0x28b555(0x174)][_0x28b555(0x178)](_0x8cc1ae),_0x3c6f11=_0x198cfb[_0x28b555(0x157)]?a26_0x4d2e6c['cyan'](_0x198cfb[_0x28b555(0x157)]['padEnd'](_0x3c20f1)):'\x20'[_0x28b555(0x14f)](_0x3c20f1),_0x33d1f4=hyperlink(_0x198cfb[_0x28b555(0x146)],_0x198cfb['queryUrl']);return _0x28b555(0x11d)+_0x805e7d+'\x20'+_0xfdf3ec+'\x20\x20β\x20'+_0x46545e+'\x20\x20'+_0x3c6f11+'\x20\x20'+_0x33d1f4;});await writeOutput(_0x932bef[_0x280314(0x16b)]('\x0a'),_0x67490b['output'],_0x280314(0x147));}}return 0x0;}}export class ScheduleShowCommand extends BaseCommand{[a26_0x200056(0x146)]=a26_0x200056(0x11c);[a26_0x200056(0x13a)]=a26_0x200056(0x15a);[a26_0x200056(0x131)](_0x32866c){const _0x31e4ec=a26_0x200056,_0x51dd96=_0x32866c[_0x31e4ec(0x175)][0x0];if(!_0x51dd96)return _0x31e4ec(0x151);return undefined;}async['execute'](_0x507527){const _0x398460=a26_0x200056,{options:_0xabd7ea,args:_0x20a2c9,tdx:_0x2f83d9}=_0x507527,_0x4f1db5=_0x20a2c9[0x0],_0x1faecc=await withSpinner(_0x398460(0x10b),()=>_0x2f83d9[_0x398460(0x12d)][_0x398460(0x150)](_0x4f1db5),{'verbose':_0xabd7ea[_0x398460(0x105)]}),_0x210712=_0x1faecc[_0x398460(0x122)],_0x32fb8b={'name':_0x210712[_0x398460(0x146)],'cron':_0x210712['cron'],'database':_0x210712[_0x398460(0x138)],'type':_0x210712[_0x398460(0x109)],'timezone':_0x210712[_0x398460(0xfb)],'user_name':_0x210712[_0x398460(0x113)],'created_at':_0x210712[_0x398460(0x125)],'engine_version':_0x210712[_0x398460(0x112)],'executing_user_id':_0x210712[_0x398460(0x117)],'query':_0x210712[_0x398460(0x10e)],'delay':_0x210712['delay'],'priority':_0x210712[_0x398460(0x155)],'retry_limit':_0x210712['retry_limit'],..._0x210712[_0x398460(0x16c)]&&{'result':_0x210712['result']}};return await handleSingleObjectOutput(_0x32fb8b,_0xabd7ea),0x0;}}export class ScheduleCreateCommand extends BaseCommand{['name']=a26_0x200056(0x144);[a26_0x200056(0x13a)]=a26_0x200056(0x135);[a26_0x200056(0x131)](_0x14b9df){const _0x38fb16=a26_0x200056,_0x45dd0e=_0x14b9df[_0x38fb16(0x175)][0x0];if(!_0x45dd0e)return _0x38fb16(0xf2);return undefined;}async[a26_0x200056(0x10c)](_0x22c3cd){const _0x15f770=a26_0x200056,{options:_0x2893a8,args:_0x39deed,tdx:_0x36b925}=_0x22c3cd,_0x25ff50=_0x39deed[0x0],_0x35650=_0x2893a8,_0x21d575=_0x35650['database'],_0x2e6984=_0x35650[_0x15f770(0x159)],_0x14d9a5=_0x35650[_0x15f770(0x109)]||_0x15f770(0xf7);let _0x498c3d;try{_0x498c3d=readFileSync(_0x2e6984,_0x15f770(0x107))['trim']();}catch(_0x3fac25){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x15f770(0x165)+_0x2e6984,_0x3fac25 instanceof Error?_0x3fac25:undefined);}if(!_0x498c3d)throw new SDKError(ErrorCode[_0x15f770(0x134)],_0x15f770(0x142));const _0x413497={'database':_0x21d575,'query':_0x498c3d,'type':_0x14d9a5};if(_0x35650[_0x15f770(0x157)])_0x413497[_0x15f770(0x157)]=_0x35650['cron'];if(_0x35650['timezone'])_0x413497[_0x15f770(0xfb)]=_0x35650['timezone'];if(_0x35650[_0x15f770(0x16e)]!==undefined)_0x413497[_0x15f770(0x16e)]=Number(_0x35650['delay']);if(_0x35650[_0x15f770(0x155)]!==undefined)_0x413497['priority']=Number(_0x35650[_0x15f770(0x155)]);if(_0x35650[_0x15f770(0x17a)]!==undefined)_0x413497['retry_limit']=Number(_0x35650[_0x15f770(0x17a)]);if(_0x35650[_0x15f770(0x161)])_0x413497[_0x15f770(0x112)]=_0x35650['engineVersion'];if(_0x35650[_0x15f770(0x16c)])_0x413497[_0x15f770(0x16c)]=_0x35650[_0x15f770(0x16c)];if(_0x2893a8[_0x15f770(0x105)]){console['error'](_0x15f770(0x132)+_0x25ff50),console[_0x15f770(0x137)](_0x15f770(0x118)+_0x21d575),console[_0x15f770(0x137)]('\x20\x20Type:\x20'+_0x14d9a5);if(_0x413497[_0x15f770(0x157)])console[_0x15f770(0x137)]('\x20\x20Cron:\x20'+_0x413497[_0x15f770(0x157)]);if(_0x413497[_0x15f770(0xfb)])console[_0x15f770(0x137)](_0x15f770(0x115)+_0x413497[_0x15f770(0xfb)]);}const _0x51cc5c=await withSpinner(_0x15f770(0x13c),()=>_0x36b925[_0x15f770(0x12d)][_0x15f770(0x17d)](_0x25ff50,_0x413497),{'verbose':_0x2893a8[_0x15f770(0x105)]});return console[_0x15f770(0x137)](_0x15f770(0x108)+_0x51cc5c[_0x15f770(0x122)]['name']),await handleSingleObjectOutput(_0x51cc5c['data'],_0x2893a8),0x0;}}function a26_0x2654(){const _0xed3377=['Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20update\x20<name>\x20[options]','m\x20ago','ies','trim','trino','5358899PpLNqi','Found\x20','json','timezone','end_at','No\x20scheduled\x20queries\x20found','Delete\x20a\x20scheduled\x20query','never','length','map','Updating\x20schedule...','updated_at','Cancelled','verbose','22421XpNmZs','utf-8','Schedule\x20created:\x20','type','success','Getting\x20schedule\x20details...','execute','\x22...','query','schedule:run','format','Listing\x20scheduled\x20queries...','engine_version','user_name','entries','\x20\x20Timezone:\x20','d\x20ago','executing_user_id','\x20\x20Database:\x20','Deleting\x20schedule...','/app/queries/editor?queryId=','count','schedule:show','π
\x20','\x20job','42bnUYBA','next_run_at','max','data','Searching\x20scheduled\x20queries\x20matching\x20\x22','\x20\x20Job\x20ID:\x20','created_at','34376OolxzF','46405AjzRBz','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20schedule\x20\x22','table','\x20created','\x20(use\x20--limit\x20to\x20see\x20more)','Schedule\x20run\x20submitted:\x20','schedules','green','Running\x20schedule:\x20','12RCcLbY','validate','Creating\x20schedule:\x20','Running\x20schedule...','INVALID_ARGUMENT','Create\x20a\x20scheduled\x20query','...','error','database','run','description','in\x20','Creating\x20schedule...','2459897fnmOhh','9SPgasl','Run\x20a\x20scheduled\x20query\x20immediately','jsonl','yes','Query\x20file\x20is\x20empty','site','schedule:create','Show\x20schedule\x20execution\x20history','name','list','statusIcon','toLocaleDateString','26734JUkJbC','user','job_id','h\x20ago','616yCLbZj','repeat','show','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20show\x20<name>','6WqhWIN','jobs','last_job','priority','\x20execution','cron','schedule:list','file','Show\x20schedule\x20details','dim','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20delete\x20<name>','Getting\x20schedule\x20history...','\x20(showing\x20','retry_limit','schedule:update','engineVersion','num','soon','status','Failed\x20to\x20read\x20file:\x20','ended_at','\x20\x20Num:\x20','update','time','round','join','result','red','delay','2162556sAijEa','history','scheduled_at','schedule:delete','start_at','nextRun','args','\x20scheduled\x20quer','has_next_page','padEnd','getTime','retryLimit','10quwOfc','At\x20least\x20one\x20option\x20must\x20be\x20provided\x20to\x20update','create','List\x20scheduled\x20queries','Schedule\x20deleted:\x20','(unnamed)','pagination','Updating\x20schedule:\x20','Update\x20a\x20scheduled\x20query','from','Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20create\x20<name>\x20-d\x20<db>\x20--file\x20<path>\x20[options]'];a26_0x2654=function(){return _0xed3377;};return a26_0x2654();}export class ScheduleUpdateCommand extends BaseCommand{[a26_0x200056(0x146)]=a26_0x200056(0x160);[a26_0x200056(0x13a)]=a26_0x200056(0xf0);['validate'](_0x539329){const _0x24dbbe=a26_0x200056,_0x32073f=_0x539329[_0x24dbbe(0x175)][0x0];if(!_0x32073f)return _0x24dbbe(0xf3);return undefined;}async[a26_0x200056(0x10c)](_0x24fadc){const _0x58d42e=a26_0x200056,{options:_0x585c94,args:_0x1b2cb0,tdx:_0x58c391}=_0x24fadc,_0x1b1f28=_0x1b2cb0[0x0],_0x580f35=_0x585c94,_0x3b4350={};if(_0x580f35[_0x58d42e(0x138)])_0x3b4350[_0x58d42e(0x138)]=_0x580f35[_0x58d42e(0x138)];if(_0x580f35[_0x58d42e(0x109)])_0x3b4350[_0x58d42e(0x109)]=_0x580f35['type'];if(_0x580f35[_0x58d42e(0x157)])_0x3b4350[_0x58d42e(0x157)]=_0x580f35[_0x58d42e(0x157)];if(_0x580f35[_0x58d42e(0xfb)])_0x3b4350['timezone']=_0x580f35[_0x58d42e(0xfb)];if(_0x580f35['delay']!==undefined)_0x3b4350[_0x58d42e(0x16e)]=Number(_0x580f35[_0x58d42e(0x16e)]);if(_0x580f35[_0x58d42e(0x155)]!==undefined)_0x3b4350[_0x58d42e(0x155)]=Number(_0x580f35[_0x58d42e(0x155)]);if(_0x580f35['retryLimit']!==undefined)_0x3b4350[_0x58d42e(0x15f)]=Number(_0x580f35['retryLimit']);if(_0x580f35[_0x58d42e(0x161)])_0x3b4350[_0x58d42e(0x112)]=_0x580f35[_0x58d42e(0x161)];if(_0x580f35[_0x58d42e(0x16c)])_0x3b4350[_0x58d42e(0x16c)]=_0x580f35[_0x58d42e(0x16c)];if(_0x580f35[_0x58d42e(0x159)])try{_0x3b4350[_0x58d42e(0x10e)]=readFileSync(_0x580f35[_0x58d42e(0x159)],_0x58d42e(0x107))[_0x58d42e(0xf6)]();}catch(_0x5032f9){throw new SDKError(ErrorCode[_0x58d42e(0x134)],_0x58d42e(0x165)+_0x580f35[_0x58d42e(0x159)],_0x5032f9 instanceof Error?_0x5032f9:undefined);}if(Object['keys'](_0x3b4350)['length']===0x0)throw new SDKError(ErrorCode[_0x58d42e(0x134)],_0x58d42e(0x17c));if(_0x585c94[_0x58d42e(0x105)]){console[_0x58d42e(0x137)](_0x58d42e(0xef)+_0x1b1f28);for(const [_0x38d8ec,_0x4bdf55]of Object[_0x58d42e(0x114)](_0x3b4350)){_0x38d8ec===_0x58d42e(0x10e)?console[_0x58d42e(0x137)]('\x20\x20'+_0x38d8ec+':\x20'+_0x4bdf55['substring'](0x0,0x32)+_0x58d42e(0x136)):console['error']('\x20\x20'+_0x38d8ec+':\x20'+_0x4bdf55);}}const _0x363f2e=await withSpinner(_0x58d42e(0x102),()=>_0x58c391[_0x58d42e(0x12d)][_0x58d42e(0x168)](_0x1b1f28,_0x3b4350),{'verbose':_0x585c94[_0x58d42e(0x105)]});return console[_0x58d42e(0x137)]('Schedule\x20updated:\x20'+_0x363f2e[_0x58d42e(0x122)]['name']),await handleSingleObjectOutput(_0x363f2e[_0x58d42e(0x122)],_0x585c94),0x0;}}export class ScheduleDeleteCommand extends BaseCommand{[a26_0x200056(0x146)]=a26_0x200056(0x172);['description']=a26_0x200056(0xfe);['validate'](_0x134042){const _0x322818=a26_0x200056,_0x4c8ce9=_0x134042['args'][0x0];if(!_0x4c8ce9)return _0x322818(0x15c);return undefined;}async[a26_0x200056(0x10c)](_0x223466){const _0x5c11ed=a26_0x200056,{options:_0x5b3669,args:_0xe65ced,tdx:_0x83d175}=_0x223466,_0x6015a8=_0xe65ced[0x0];if(!_0x5b3669[_0x5c11ed(0x141)]){const _0x2b5b7a=await confirm(_0x5c11ed(0x128)+_0x6015a8+'\x22?');if(!_0x2b5b7a)return console[_0x5c11ed(0x137)](_0x5c11ed(0x104)),0x0;}const _0x14c3b4=await withSpinner(_0x5c11ed(0x119),()=>_0x83d175[_0x5c11ed(0x12d)]['delete'](_0x6015a8),{'verbose':_0x5b3669[_0x5c11ed(0x105)]});return console['error'](_0x5c11ed(0x17f)+_0x14c3b4[_0x5c11ed(0x122)]['name']),0x0;}}export class ScheduleRunCommand extends BaseCommand{[a26_0x200056(0x146)]=a26_0x200056(0x10f);[a26_0x200056(0x13a)]=a26_0x200056(0x13f);[a26_0x200056(0x131)](_0x418d52){const _0x227abf=_0x418d52['args'][0x0];if(!_0x227abf)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20run\x20<name>\x20[--time\x20<iso8601>]\x20[--num\x20<1-10>]';return undefined;}async['execute'](_0x426c29){const _0x3dc048=a26_0x200056,{options:_0x5945bd,args:_0x3bab1d,tdx:_0x8b3fa}=_0x426c29,_0x3af9a0=_0x3bab1d[0x0],_0x1347be=_0x5945bd,_0x5eceba=_0x1347be[_0x3dc048(0x169)],_0x1c5903=_0x1347be[_0x3dc048(0x162)]!==undefined?Number(_0x1347be[_0x3dc048(0x162)]):undefined;if(_0x5945bd[_0x3dc048(0x105)]){console['error'](_0x3dc048(0x12f)+_0x3af9a0);if(_0x5eceba)console[_0x3dc048(0x137)]('\x20\x20Time:\x20'+_0x5eceba);if(_0x1c5903)console[_0x3dc048(0x137)](_0x3dc048(0x167)+_0x1c5903);}const _0x114031=await withSpinner(_0x3dc048(0x133),()=>_0x8b3fa['schedules'][_0x3dc048(0x139)](_0x3af9a0,{'time':_0x5eceba,'num':_0x1c5903}),{'verbose':_0x5945bd[_0x3dc048(0x105)]}),_0x442b54=_0x114031['data'][_0x3dc048(0x153)];console[_0x3dc048(0x137)](_0x3dc048(0x12c)+_0x442b54[_0x3dc048(0x100)]+_0x3dc048(0x11e)+(_0x442b54[_0x3dc048(0x100)]!==0x1?'s':'')+_0x3dc048(0x12a));for(const _0x266873 of _0x442b54){console[_0x3dc048(0x137)](_0x3dc048(0x124)+_0x266873[_0x3dc048(0x14c)]);}return await handleSDKOutput(_0x442b54,_0x5945bd),0x0;}}export class ScheduleHistoryCommand extends BaseCommand{[a26_0x200056(0x146)]='schedule:history';[a26_0x200056(0x13a)]=a26_0x200056(0x145);[a26_0x200056(0x131)](_0xbf99cf){const _0x37d5cc=_0xbf99cf['args'][0x0];if(!_0x37d5cc)return'Schedule\x20name\x20is\x20required\x0aUsage:\x20job\x20schedule\x20history\x20<name>\x20[--from\x20<n>]\x20[--to\x20<n>]';return undefined;}async[a26_0x200056(0x10c)](_0x3219a7){const _0x1f8c05=a26_0x200056,{options:_0x24a0c5,args:_0x31c6d7,tdx:_0x9061e9}=_0x3219a7,_0x133289=_0x31c6d7[0x0],_0x1436c7=_0x24a0c5,_0xfb4d2e=_0x1436c7[_0x1f8c05(0xf1)]!==undefined?Number(_0x1436c7[_0x1f8c05(0xf1)]):undefined,_0x53e7ef=_0x1436c7['to']!==undefined?Number(_0x1436c7['to']):undefined,_0x52bcd0=await withSpinner(_0x1f8c05(0x15d),()=>_0x9061e9[_0x1f8c05(0x12d)][_0x1f8c05(0x170)](_0x133289,{'from':_0xfb4d2e,'to':_0x53e7ef}),{'verbose':_0x24a0c5['verbose']}),_0x390dbb=_0x52bcd0[_0x1f8c05(0x122)];console[_0x1f8c05(0x137)]('Found\x20'+_0x390dbb[_0x1f8c05(0x11b)]+_0x1f8c05(0x156)+(_0x390dbb[_0x1f8c05(0x11b)]!==0x1?'s':'')+_0x1f8c05(0x15e)+_0x390dbb[_0x1f8c05(0xf1)]+'-'+_0x390dbb['to']+')');const _0x2948f3=_0x390dbb[_0x1f8c05(0x170)][_0x1f8c05(0x101)](_0x3d8c9c=>({'job_id':_0x3d8c9c[_0x1f8c05(0x14c)],'type':_0x3d8c9c[_0x1f8c05(0x109)],'status':_0x3d8c9c[_0x1f8c05(0x164)],'scheduled_at':_0x3d8c9c[_0x1f8c05(0x171)],'created_at':_0x3d8c9c[_0x1f8c05(0x125)],'start_at':_0x3d8c9c[_0x1f8c05(0x173)],'end_at':_0x3d8c9c[_0x1f8c05(0xfc)]}));return await handleSDKOutput(_0x2948f3,_0x24a0c5),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a27_0x23123a=a27_0x2440;(function(_0x86d2,_0x1a4f48){const _0x22cd66=a27_0x2440,_0x509152=_0x86d2();while(!![]){try{const _0x2ef829=-parseInt(_0x22cd66(0x10f))/0x1+parseInt(_0x22cd66(0x109))/0x2+parseInt(_0x22cd66(0x12c))/0x3+parseInt(_0x22cd66(0x146))/0x4+-parseInt(_0x22cd66(0xff))/0x5*(parseInt(_0x22cd66(0xf2))/0x6)+parseInt(_0x22cd66(0x163))/0x7*(-parseInt(_0x22cd66(0x154))/0x8)+-parseInt(_0x22cd66(0x158))/0x9*(-parseInt(_0x22cd66(0xd7))/0xa);if(_0x2ef829===_0x1a4f48)break;else _0x509152['push'](_0x509152['shift']());}catch(_0x131fd4){_0x509152['push'](_0x509152['shift']());}}}(a27_0x596a,0xbd3d9));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a27_0x1f9cf2 from'chalk';function a27_0x596a(){const _0x1299b3=['3695280tjjeEA','SEGMENT_NOT_FOUND','Folder\x20ID:\x20','stats','Target\x20path:\x20','trim','Show\x20folder\x20or\x20child\x20segment\x20details','segment:folder:create','β\x20Found\x20','Error:\x20Folder\x20reference\x20is\x20required','Folder\x20ID\x20missing\x20from\x20resolved\x20path','createFolder','error','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','8841536lELICq','Create\x20segment\x20folder\x20for\x20organization','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Use:\x20tdx\x20ps\x20show','747eKYooJ','green','Fetching\x20SQL\x20for\x20segment...','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Use:\x20tdx\x20ps\x20sql','length','(root)','execute','Fetching\x20folder\x20details...','INVALID_ARGUMENT','\x20\x20Cause:\x20','7zPMnmK','\x20\x20Folder\x20path:\x20','resolvePathToResource','segment:sql','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Resolving\x20parent\x20segment\x20\x27','248980TKklGv','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','Use:\x20tdx\x20ps\x20view\x20-w','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','Use:\x20tdx\x20ps\x20view','segment:folder:list','format','jobId','Error:\x20','type','folderPath','Resolving\x20path\x20\x27','verbose','getSegment','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser','resolveFolderId','segment:show','in\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Usage:\x20tdx\x20sg\x20sql\x20<name>','Show\x20child\x20segment\x20schema\x20(column\x20types)','segmentId','Resolved\x20folder\x20ID:\x20','20094ibNgOD','getFolder','log','json','Fetching\x20segment\x20details...','segment:folder:show','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Usage:\x20tdx\x20sg\x20show\x20<name>','segment','\x20Opening\x20','\x20\x20Parent\x20segment:\x20','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','895wrmtAQ','segmentPath','segment:desc','resolveParentId','SEGMENT_FOLDER_NOT_FOUND','Creating\x20folder\x20\x27','Site:\x20','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','Listing\x20folders\x20for\x20parent\x20\x27','jsonl','304450AzTLeR','setJobId','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','Use:\x20tdx\x20ps\x20desc','description','685484zbkjMV','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','message','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Fetching\x20folder\x20\x27','Options:','Error:\x20Path\x20or\x20name\x20is\x20required','name','code','Examples:','/e/','\x20folder','Segment\x20ID:\x20','Parent\x20segment:\x20','\x20\x20Full\x20path:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Executing\x20segment\x20query...','Resolved\x20type:\x20','folder','cause','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','Parent\x20ID:\x20','parentSegment','getSegmentSQL','elapsedTimeMillis','site','parentFolder','Folder\x20name:\x20','68091dTMeXk','Get\x20SQL\x20query\x20for\x20child\x20segment','parentId','parent','segment:describe','data','Resolved\x20parent\x20ID:\x20','\x27...','fullPath','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Error:\x20Parent\x20segment\x20name\x20is\x20required','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','folderId','β\x20Query\x20completed:\x20Processed\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Resolved\x20parent\x20folder\x20ID:\x20','SELECT\x20*\x20FROM\x20(\x0a','Resolving\x20\x27','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','/app/ps/','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','β\x20Query\x20failed\x20[','β\x20Created\x20folder\x20\x27','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment'];a27_0x596a=function(){return _0x1299b3;};return a27_0x596a();}async function resolveSegmentTarget(_0x5ab485,_0x14c96e,_0x258c5f){const _0x1bd448=a27_0x2440;if(isYamlFilePath(_0x5ab485))try{const _0x4bd518=await resolveYamlFilePath(_0x5ab485);return _0x258c5f&&(console[_0x1bd448(0x152)]('Resolved\x20YAML\x20file:\x20'+_0x5ab485),console[_0x1bd448(0x152)](_0x1bd448(0xfd)+_0x4bd518['parentSegment']),console['error']('\x20\x20Segment\x20name:\x20'+_0x4bd518['segmentName']),console[_0x1bd448(0x152)](_0x1bd448(0x164)+(_0x4bd518[_0x1bd448(0xe3)]||_0x1bd448(0x15e))),console['error'](_0x1bd448(0x11d)+_0x4bd518[_0x1bd448(0x134)])),_0x4bd518['fullPath'];}catch(_0xaa6acd){throw new SDKError(ErrorCode[_0x1bd448(0x161)],_0x1bd448(0x123)+_0xaa6acd[_0x1bd448(0x111)]);}if(!_0x14c96e)throw new SDKError(ErrorCode[_0x1bd448(0x161)],_0x1bd448(0x140));return _0x14c96e+'/'+_0x5ab485;}export class SegmentDescribeCommand extends BaseCommand{[a27_0x23123a(0x116)]=a27_0x23123a(0x130);[a27_0x23123a(0x10e)]='Show\x20segment\x20or\x20folder\x20details';async[a27_0x23123a(0x15f)](_0x200877){const _0x56941a=a27_0x23123a,{options:_0x383669,args:_0x466699,tdx:_0x4a30eb}=_0x200877,_0x34c87d=_0x466699[0x0],_0x3364c5=!_0x34c87d&&!!_0x383669[_0x56941a(0x126)],_0x4b0b66=_0x34c87d||_0x383669[_0x56941a(0x126)];if(!_0x4b0b66)return console[_0x56941a(0x152)](_0x56941a(0x115)),console[_0x56941a(0x152)]('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x56941a(0x152)](_0x56941a(0x118)),console[_0x56941a(0x152)](_0x56941a(0x156)),console[_0x56941a(0x152)]('\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22'),console['error']('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console[_0x56941a(0x152)](_0x56941a(0xdb)),0x1;try{const _0x1ee27c=_0x383669[_0x56941a(0x100)];let _0x4175cd=_0x4b0b66;!_0x3364c5&&_0x1ee27c&&!_0x4b0b66['includes']('/')&&(_0x4175cd=_0x1ee27c+'/'+_0x4b0b66,_0x383669['verbose']&&console[_0x56941a(0x152)]('Resolved\x20relative\x20path\x20to:\x20'+_0x4175cd));const _0xa12143=await withSpinner(_0x56941a(0xe4)+_0x4175cd+'\x27...',()=>_0x4a30eb[_0x56941a(0xfb)][_0x56941a(0x165)](_0x4175cd),{'verbose':_0x383669['verbose']}),_0x344a64=_0xa12143['data'];_0x383669[_0x56941a(0xe5)]&&(console['error'](_0x56941a(0x120)+_0x344a64[_0x56941a(0xe2)]),console['error'](_0x56941a(0x125)+_0x344a64[_0x56941a(0x12e)]),_0x344a64[_0x56941a(0x138)]&&console['error']('Folder\x20ID:\x20'+_0x344a64['folderId']),_0x344a64[_0x56941a(0xf0)]&&console[_0x56941a(0x152)]('Segment\x20ID:\x20'+_0x344a64[_0x56941a(0xf0)]));if(_0x344a64[_0x56941a(0xe2)]===_0x56941a(0x12f)){const _0x1ae7e2=await withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x4a30eb[_0x56941a(0xfb)]['getParent'](_0x344a64[_0x56941a(0x12e)]),{'verbose':_0x383669[_0x56941a(0xe5)]});await handleSingleObjectOutput(_0x1ae7e2[_0x56941a(0x131)],_0x383669);}else{if(_0x344a64[_0x56941a(0xe2)]===_0x56941a(0x121)){if(!_0x344a64[_0x56941a(0x138)])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],_0x56941a(0x150));const _0x27dab9=await withSpinner(_0x56941a(0x160),()=>_0x4a30eb[_0x56941a(0xfb)][_0x56941a(0xf3)](_0x344a64[_0x56941a(0x138)]),{'verbose':_0x383669[_0x56941a(0xe5)]});await handleSingleObjectOutput(_0x27dab9[_0x56941a(0x131)],_0x383669);}else{if(_0x344a64[_0x56941a(0xe2)]==='segment'){if(!_0x344a64[_0x56941a(0xf0)])throw new SDKError(ErrorCode[_0x56941a(0x147)],_0x56941a(0x10b));const _0x40ed0d=await withSpinner(_0x56941a(0xf6),()=>_0x4a30eb[_0x56941a(0xfb)][_0x56941a(0xe6)](_0x344a64[_0x56941a(0x12e)],_0x344a64[_0x56941a(0xf0)]),{'verbose':_0x383669[_0x56941a(0xe5)]});await handleSingleObjectOutput(_0x40ed0d[_0x56941a(0x131)],_0x383669);}}}return 0x0;}catch(_0x2eb68c){if(_0x2eb68c instanceof SDKError)return console[_0x56941a(0x152)]('Error:\x20'+_0x2eb68c[_0x56941a(0x111)]),_0x2eb68c[_0x56941a(0x122)]&&console['error'](_0x56941a(0x162)+_0x2eb68c[_0x56941a(0x122)]),0x1;throw _0x2eb68c;}}}export class SegmentShowCommand extends BaseCommand{[a27_0x23123a(0x116)]=a27_0x23123a(0xeb);['description']='Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a27_0x23123a(0x15f)](_0x4bbc69){const _0x3fcd86=a27_0x23123a,{options:_0x5155c1,args:_0x3ed98b,tdx:_0x493aa8}=_0x4bbc69,_0x3304ae=_0x3ed98b[0x0];if(!_0x3304ae)return console['error'](_0x3fcd86(0x142)),console[_0x3fcd86(0x152)](_0x3fcd86(0xfa)),console[_0x3fcd86(0x152)](_0x3fcd86(0xe8)),console['error']('Examples:'),console[_0x3fcd86(0x152)](_0x3fcd86(0x106)),console[_0x3fcd86(0x152)](_0x3fcd86(0x110)),0x1;try{const _0x5ecdc1=_0x5155c1[_0x3fcd86(0x126)],_0x1b155a=await resolveSegmentTarget(_0x3304ae,_0x5ecdc1,_0x5155c1[_0x3fcd86(0xe5)]);_0x5155c1['verbose']&&console[_0x3fcd86(0x152)](_0x3fcd86(0x14a)+_0x1b155a);const _0x1dedbb=await withSpinner('Resolving\x20\x27'+_0x3304ae+_0x3fcd86(0x133),()=>_0x493aa8[_0x3fcd86(0xfb)][_0x3fcd86(0x165)](_0x1b155a),{'verbose':_0x5155c1[_0x3fcd86(0xe5)]}),_0x4e6886=_0x1dedbb[_0x3fcd86(0x131)];_0x5155c1['verbose']&&(console[_0x3fcd86(0x152)](_0x3fcd86(0x120)+_0x4e6886[_0x3fcd86(0xe2)]),console[_0x3fcd86(0x152)](_0x3fcd86(0x125)+_0x4e6886[_0x3fcd86(0x12e)]));if(_0x4e6886['type']==='folder')return console['error']('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0x3fcd86(0x152)]('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x4e6886[_0x3fcd86(0xe2)]==='parent')return console[_0x3fcd86(0x152)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x3fcd86(0x152)](_0x3fcd86(0x157)),0x1;if(!_0x4e6886[_0x3fcd86(0xf0)])throw new SDKError(ErrorCode[_0x3fcd86(0x147)],_0x3fcd86(0x10b));const _0x298c4c=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x493aa8[_0x3fcd86(0xfb)][_0x3fcd86(0x127)](_0x4e6886[_0x3fcd86(0x12e)],_0x4e6886['segmentId']),{'verbose':_0x5155c1[_0x3fcd86(0xe5)]});let _0x366741=_0x298c4c['data'];const _0x24810c=resolveLimit(_0x5155c1['limit'],DEFAULT_DISPLAY_LIMIT),_0x2d254e=/\bLIMIT\s+\d+/i['test'](_0x366741);!_0x2d254e&&(_0x366741=_0x366741[_0x3fcd86(0x14b)]()['replace'](/;+$/,''),_0x366741=_0x3fcd86(0x13d)+_0x366741+_0x3fcd86(0x15b)+_0x24810c);_0x5155c1[_0x3fcd86(0xe5)]&&console['error']('SQL\x20query:\x0a'+_0x366741);const _0xde6e84=await withProgressSpinner(_0x3fcd86(0x11f),async _0x4476c3=>{const _0x37f875=_0x3fcd86,_0x4644f3=await _0x493aa8['query'][_0x37f875(0x15f)](_0x366741,{'catalog':'td','schema':'information_schema','onJobId':_0x191d67=>{const _0x375a9f=_0x37f875;_0x4476c3[_0x375a9f(0x10a)](_0x191d67);}});return _0x4644f3;},{'verbose':_0x5155c1['verbose']}),_0x1b4d76=_0xde6e84[_0x3fcd86(0x131)],_0x190373=_0x1b4d76[_0x3fcd86(0xe0)]?'\x20[Job\x20ID:\x20'+_0x1b4d76['jobId']+']':'';return console[_0x3fcd86(0x152)](_0x3fcd86(0x139)+_0x1b4d76['stats']['processedRows']['toLocaleString']()+'\x20rows\x20'+(_0x3fcd86(0xec)+formatElapsed(_0x1b4d76[_0x3fcd86(0x149)][_0x3fcd86(0x128)])+_0x190373)),await handleQueryOutput(_0x1b4d76,_0x5155c1),0x0;}catch(_0x2b25a2){if(_0x2b25a2 instanceof SDKError)return console[_0x3fcd86(0x152)](_0x3fcd86(0x143)+_0x2b25a2[_0x3fcd86(0x117)]+']'),console[_0x3fcd86(0x152)]('\x0a'+_0x2b25a2['message']),0x1;throw _0x2b25a2;}}}function a27_0x2440(_0x526d80,_0x3f38d9){_0x526d80=_0x526d80-0xd7;const _0x596abb=a27_0x596a();let _0x244025=_0x596abb[_0x526d80];return _0x244025;}export class SegmentFolderListCommand extends BaseCommand{[a27_0x23123a(0x116)]=a27_0x23123a(0xde);[a27_0x23123a(0x10e)]=a27_0x23123a(0x145);async[a27_0x23123a(0x15f)](_0x2c1d5e){const _0x46060e=a27_0x23123a,{options:_0x4378ce,args:_0x3e6140,tdx:_0x313159}=_0x2c1d5e;if(_0x3e6140[_0x46060e(0x15d)]===0x0)return console[_0x46060e(0x152)](_0x46060e(0x136)),console['error'](_0x46060e(0x137)),0x1;const _0x34c7aa=_0x3e6140[0x0];try{_0x4378ce[_0x46060e(0xe5)]&&(console[_0x46060e(0x152)](_0x46060e(0x105)+_0x4378ce['site']),console['error']('Parent\x20name:\x20'+_0x34c7aa));const _0x12c284=await withSpinner(_0x46060e(0x168)+_0x34c7aa+'\x27...',()=>_0x313159[_0x46060e(0xfb)][_0x46060e(0x102)](_0x34c7aa),{'verbose':_0x4378ce[_0x46060e(0xe5)]}),_0x2fedc4=_0x12c284['data'];_0x4378ce[_0x46060e(0xe5)]&&console[_0x46060e(0x152)]('Resolved\x20parent\x20ID:\x20'+_0x2fedc4);const _0x506b81=await withSpinner(_0x46060e(0x107)+_0x34c7aa+_0x46060e(0x133),()=>_0x313159[_0x46060e(0xfb)]['listFolders'](_0x2fedc4),{'verbose':_0x4378ce[_0x46060e(0xe5)]}),_0x3f3892=_0x506b81[_0x46060e(0x131)];return console['error'](_0x46060e(0x14e)+_0x3f3892[_0x46060e(0x15d)]+_0x46060e(0x11a)+(_0x3f3892[_0x46060e(0x15d)]!==0x1?'s':'')),await handleSDKOutput(_0x3f3892,_0x4378ce),0x0;}catch(_0x2e9ae8){if(_0x2e9ae8 instanceof SDKError)return console['error'](_0x46060e(0xe1)+_0x2e9ae8['message']),_0x2e9ae8[_0x46060e(0x122)]&&console[_0x46060e(0x152)]('\x20\x20Cause:\x20'+_0x2e9ae8[_0x46060e(0x122)]),0x1;throw _0x2e9ae8;}}}export class SegmentFolderShowCommand extends BaseCommand{[a27_0x23123a(0x116)]=a27_0x23123a(0xf7);[a27_0x23123a(0x10e)]='Show\x20segment\x20folder\x20details';async[a27_0x23123a(0x15f)](_0xe4804e){const _0x217854=a27_0x23123a,{options:_0x13fa7d,args:_0x3c15a6,tdx:_0x1efd9c}=_0xe4804e;if(_0x3c15a6[_0x217854(0x15d)]===0x0)return console[_0x217854(0x152)](_0x217854(0x14f)),console[_0x217854(0x152)]('Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>'),0x1;try{const {parentId:_0xca393d,childId:_0x2d9c2a}=parseSegmentRef(_0x3c15a6[0x0]);_0x13fa7d[_0x217854(0xe5)]&&(console[_0x217854(0x152)](_0x217854(0x105)+_0x13fa7d[_0x217854(0x129)]),console[_0x217854(0x152)]('Parent\x20name:\x20'+_0xca393d),_0x2d9c2a&&console[_0x217854(0x152)](_0x217854(0x12b)+_0x2d9c2a));if(!_0x2d9c2a)return console[_0x217854(0x152)](_0x217854(0x135)),0x1;const _0x3de80a=await withSpinner(_0x217854(0x168)+_0xca393d+'\x27...',()=>_0x1efd9c[_0x217854(0xfb)]['resolveParentId'](_0xca393d),{'verbose':_0x13fa7d[_0x217854(0xe5)]}),_0xa2fccf=_0x3de80a[_0x217854(0x131)];_0x13fa7d[_0x217854(0xe5)]&&console[_0x217854(0x152)](_0x217854(0x132)+_0xa2fccf);const _0x25041f=await withSpinner('Resolving\x20folder\x20\x27'+_0x2d9c2a+'\x27...',()=>_0x1efd9c[_0x217854(0xfb)][_0x217854(0xea)](_0xa2fccf,_0x2d9c2a),{'verbose':_0x13fa7d[_0x217854(0xe5)]}),_0x1b908d=_0x25041f[_0x217854(0x131)];_0x13fa7d[_0x217854(0xe5)]&&console[_0x217854(0x152)](_0x217854(0xf1)+_0x1b908d);const _0x42e007=await withSpinner(_0x217854(0x113)+_0x2d9c2a+_0x217854(0x133),()=>_0x1efd9c[_0x217854(0xfb)][_0x217854(0xf3)](_0x1b908d),{'verbose':_0x13fa7d[_0x217854(0xe5)]});return await handleSDKOutput([_0x42e007['data']],_0x13fa7d),0x0;}catch(_0x17668f){if(_0x17668f instanceof SDKError)return console[_0x217854(0x152)]('Error:\x20'+_0x17668f[_0x217854(0x111)]),_0x17668f[_0x217854(0x122)]&&console[_0x217854(0x152)](_0x217854(0x162)+_0x17668f[_0x217854(0x122)]),0x1;throw _0x17668f;}}}export class SegmentSQLCommand extends BaseCommand{[a27_0x23123a(0x116)]=a27_0x23123a(0x166);[a27_0x23123a(0x10e)]=a27_0x23123a(0x12d);async[a27_0x23123a(0x15f)](_0x4f3ed4){const _0x495805=a27_0x23123a,{options:_0x5900a1,args:_0x52999d,tdx:_0x55d3f7}=_0x4f3ed4,_0x3f0c44=_0x52999d[0x0];if(!_0x3f0c44)return console['error'](_0x495805(0x142)),console['error'](_0x495805(0xee)),console[_0x495805(0x152)](_0x495805(0x13a)),console[_0x495805(0x152)](_0x495805(0x118)),console['error'](_0x495805(0xf8)),console[_0x495805(0x152)](_0x495805(0xdc)),0x1;try{const _0x41e82f=_0x5900a1['parentSegment'],_0x4ce53d=await resolveSegmentTarget(_0x3f0c44,_0x41e82f,_0x5900a1[_0x495805(0xe5)]);_0x5900a1[_0x495805(0xe5)]&&console['error']('Target\x20path:\x20'+_0x4ce53d);const _0x498feb=await withSpinner('Resolving\x20\x27'+_0x3f0c44+'\x27...',()=>_0x55d3f7['segment'][_0x495805(0x165)](_0x4ce53d),{'verbose':_0x5900a1[_0x495805(0xe5)]}),_0x15de13=_0x498feb[_0x495805(0x131)];_0x5900a1[_0x495805(0xe5)]&&(console[_0x495805(0x152)](_0x495805(0x120)+_0x15de13[_0x495805(0xe2)]),console[_0x495805(0x152)]('Parent\x20ID:\x20'+_0x15de13[_0x495805(0x12e)]));if(_0x15de13['type']===_0x495805(0x121))return console[_0x495805(0x152)](_0x495805(0xe7)),console[_0x495805(0x152)](_0x495805(0x10c)),0x1;if(_0x15de13[_0x495805(0xe2)]===_0x495805(0x12f))return console[_0x495805(0x152)](_0x495805(0xfe)),console['error'](_0x495805(0x15c)),0x1;if(!_0x15de13[_0x495805(0xf0)])throw new SDKError(ErrorCode[_0x495805(0x147)],_0x495805(0x10b));const _0x87270=await withSpinner(_0x495805(0x15a),()=>_0x55d3f7[_0x495805(0xfb)]['getSegmentSQL'](_0x15de13['parentId'],_0x15de13[_0x495805(0xf0)]),{'verbose':_0x5900a1[_0x495805(0xe5)]}),_0x502e9a=_0x87270['data'];return _0x5900a1[_0x495805(0xdf)]===_0x495805(0xf5)||_0x5900a1[_0x495805(0xdf)]===_0x495805(0x108)?await handleSDKOutput([{'sql':_0x502e9a}],_0x5900a1):console[_0x495805(0xf4)](_0x502e9a),0x0;}catch(_0x1ba833){if(_0x1ba833 instanceof SDKError)return console[_0x495805(0x152)](_0x495805(0xe1)+_0x1ba833[_0x495805(0x111)]),_0x1ba833[_0x495805(0x122)]&&console[_0x495805(0x152)]('\x20\x20Cause:\x20'+_0x1ba833[_0x495805(0x122)]),0x1;throw _0x1ba833;}}}export class SegmentFolderCreateCommand extends BaseCommand{['name']=a27_0x23123a(0x14d);[a27_0x23123a(0x10e)]=a27_0x23123a(0x155);async[a27_0x23123a(0x15f)](_0x19dd84){const _0x264818=a27_0x23123a,{options:_0x343883,args:_0x1a5f9d,tdx:_0x38b8e0}=_0x19dd84,_0x500ac2=_0x343883;if(_0x1a5f9d[_0x264818(0x15d)]<0x2)return console[_0x264818(0x152)](_0x264818(0xd8)),console['error']('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x4b3b01=_0x1a5f9d[0x0],_0x30cf72=_0x1a5f9d[0x1];_0x500ac2[_0x264818(0xe5)]&&(console[_0x264818(0x152)](_0x264818(0x105)+_0x500ac2[_0x264818(0x129)]),console['error'](_0x264818(0x11c)+_0x4b3b01),console[_0x264818(0x152)](_0x264818(0x12b)+_0x30cf72));let _0x525a20;if(_0x500ac2['parentFolder']){const _0x8871d9=_0x500ac2[_0x264818(0x12a)],_0x52aa69=await withSpinner(_0x264818(0x168)+_0x4b3b01+_0x264818(0x133),()=>_0x38b8e0[_0x264818(0xfb)]['resolveParentId'](_0x4b3b01),{'verbose':_0x500ac2[_0x264818(0xe5)]}),_0x29cce4=_0x52aa69[_0x264818(0x131)],_0x239781=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x8871d9+_0x264818(0x133),()=>_0x38b8e0[_0x264818(0xfb)][_0x264818(0xea)](_0x29cce4,_0x8871d9),{'verbose':_0x500ac2['verbose']});_0x525a20=_0x239781[_0x264818(0x131)],_0x500ac2[_0x264818(0xe5)]&&console['error'](_0x264818(0x13c)+_0x525a20);}const _0x440d67={'name':_0x30cf72,'description':_0x500ac2[_0x264818(0x10e)],'parentFolderId':_0x525a20},_0x3ff333=await withSpinner(_0x264818(0x104)+_0x30cf72+'\x27...',()=>_0x38b8e0[_0x264818(0xfb)][_0x264818(0x151)](_0x4b3b01,_0x440d67),{'verbose':_0x500ac2['verbose']}),_0x59e96c=_0x3ff333['data'];return console[_0x264818(0x152)](_0x264818(0x144)+_0x59e96c[_0x264818(0x116)]+'\x27\x20with\x20ID:\x20'+_0x59e96c['id']),await handleSDKOutput([_0x59e96c],_0x500ac2),0x0;}}export class SegmentViewCommand extends BaseCommand{[a27_0x23123a(0x116)]='segment:view';['description']=a27_0x23123a(0x14c);async[a27_0x23123a(0x15f)](_0x345d6d){const _0x377426=a27_0x23123a,{options:_0x45edb5,args:_0x34ba1b,tdx:_0x810f1a}=_0x345d6d,_0x5de029=_0x34ba1b[0x0];if(!_0x5de029)return console[_0x377426(0x152)](_0x377426(0x112)),console['error'](_0x377426(0xf9)),console[_0x377426(0x152)](_0x377426(0xed)),console['error'](_0x377426(0x114)),console['error'](_0x377426(0x124)),console[_0x377426(0x152)](_0x377426(0x118)),console[_0x377426(0x152)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x377426(0x152)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details'),console[_0x377426(0x152)](_0x377426(0xe9)),console[_0x377426(0x152)](_0x377426(0x153)),0x1;try{const _0x44838=_0x45edb5[_0x377426(0x126)],_0x3852f0=await resolveSegmentTarget(_0x5de029,_0x44838,_0x45edb5['verbose']);_0x45edb5['verbose']&&console[_0x377426(0x152)](_0x377426(0x14a)+_0x3852f0);const _0x6f0622=await withSpinner(_0x377426(0x13e)+_0x5de029+_0x377426(0x133),()=>_0x810f1a[_0x377426(0xfb)][_0x377426(0x165)](_0x3852f0),{'verbose':_0x45edb5[_0x377426(0xe5)]}),_0x3ed0b6=_0x6f0622[_0x377426(0x131)];_0x45edb5[_0x377426(0xe5)]&&(console['error'](_0x377426(0x120)+_0x3ed0b6['type']),console[_0x377426(0x152)](_0x377426(0x125)+_0x3ed0b6[_0x377426(0x12e)]),_0x3ed0b6['folderId']&&console['error'](_0x377426(0x148)+_0x3ed0b6[_0x377426(0x138)]),_0x3ed0b6[_0x377426(0xf0)]&&console[_0x377426(0x152)](_0x377426(0x11b)+_0x3ed0b6['segmentId']));if(_0x45edb5['web']){if(_0x3ed0b6[_0x377426(0xe2)]===_0x377426(0x121))return console[_0x377426(0x152)](_0x377426(0xd9)),0x1;if(_0x3ed0b6['type']===_0x377426(0x12f))return console[_0x377426(0x152)]('Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x377426(0x152)](_0x377426(0xda)),0x1;if(!_0x3ed0b6[_0x377426(0xf0)])throw new SDKError(ErrorCode[_0x377426(0x147)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x2703ad=getConsoleNextUrl(_0x45edb5['site'],'/app/ps/'+_0x3ed0b6[_0x377426(0x12e)]+_0x377426(0x119)+_0x3ed0b6[_0x377426(0xf0)]);return console[_0x377426(0x152)](a27_0x1f9cf2[_0x377426(0x159)]('β')+_0x377426(0xfc)+a27_0x1f9cf2['cyan'](_0x2703ad)),openBrowser(_0x2703ad),0x0;}if(_0x3ed0b6['type']===_0x377426(0x121)){if(!_0x3ed0b6[_0x377426(0x138)])throw new SDKError(ErrorCode[_0x377426(0x103)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x558d48=await withSpinner(_0x377426(0x160),()=>_0x810f1a[_0x377426(0xfb)][_0x377426(0xf3)](_0x3ed0b6[_0x377426(0x138)]),{'verbose':_0x45edb5['verbose']});await handleSingleObjectOutput(_0x558d48['data'],_0x45edb5);}else{if(_0x3ed0b6['type']===_0x377426(0xfb)){if(!_0x3ed0b6[_0x377426(0xf0)])throw new SDKError(ErrorCode[_0x377426(0x147)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x4bb2e9=await withSpinner(_0x377426(0xf6),()=>_0x810f1a[_0x377426(0xfb)][_0x377426(0xe6)](_0x3ed0b6[_0x377426(0x12e)],_0x3ed0b6['segmentId']),{'verbose':_0x45edb5[_0x377426(0xe5)]}),_0x5214aa=getConsoleNextUrl(_0x45edb5[_0x377426(0x129)],_0x377426(0x141)+_0x3ed0b6['parentId']+'/e/'+_0x3ed0b6[_0x377426(0xf0)]),_0x3df2f8=_0x4bb2e9[_0x377426(0x131)];_0x3df2f8['url']=_0x5214aa,await handleSingleObjectOutput(_0x3df2f8,_0x45edb5);}else return console['error']('Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.'),console[_0x377426(0x152)](_0x377426(0xdd)),0x1;}return 0x0;}catch(_0x4b6f11){if(_0x4b6f11 instanceof SDKError)return console[_0x377426(0x152)](_0x377426(0xe1)+_0x4b6f11[_0x377426(0x111)]),_0x4b6f11['cause']&&console[_0x377426(0x152)](_0x377426(0x162)+_0x4b6f11['cause']),0x1;throw _0x4b6f11;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{['name']=a27_0x23123a(0x101);[a27_0x23123a(0x10e)]=a27_0x23123a(0xef);async[a27_0x23123a(0x15f)](_0x2f854d){const _0x9bcd51=a27_0x23123a,{options:_0x8505d1,args:_0xdb5a6c,tdx:_0x2ad065}=_0x2f854d,_0x5c1b29=_0xdb5a6c[0x0];if(!_0x5c1b29)return console['error']('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error']('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console['error'](_0x9bcd51(0x13b)),console[_0x9bcd51(0x152)](_0x9bcd51(0x118)),console[_0x9bcd51(0x152)](_0x9bcd51(0x13f)),console[_0x9bcd51(0x152)]('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x37f0d7=_0x8505d1[_0x9bcd51(0x126)],_0x7d4e24=await resolveSegmentTarget(_0x5c1b29,_0x37f0d7,_0x8505d1[_0x9bcd51(0xe5)]);_0x8505d1[_0x9bcd51(0xe5)]&&console[_0x9bcd51(0x152)](_0x9bcd51(0x14a)+_0x7d4e24);const _0x14f787=await withSpinner(_0x9bcd51(0x13e)+_0x5c1b29+_0x9bcd51(0x133),()=>_0x2ad065['segment'][_0x9bcd51(0x165)](_0x7d4e24),{'verbose':_0x8505d1[_0x9bcd51(0xe5)]}),_0x10ae78=_0x14f787[_0x9bcd51(0x131)];_0x8505d1[_0x9bcd51(0xe5)]&&(console[_0x9bcd51(0x152)](_0x9bcd51(0x120)+_0x10ae78[_0x9bcd51(0xe2)]),console[_0x9bcd51(0x152)]('Parent\x20ID:\x20'+_0x10ae78[_0x9bcd51(0x12e)]));if(_0x10ae78['type']==='folder')return console[_0x9bcd51(0x152)](_0x9bcd51(0x11e)),console[_0x9bcd51(0x152)](_0x9bcd51(0x10c)),0x1;if(_0x10ae78[_0x9bcd51(0xe2)]===_0x9bcd51(0x12f))return console[_0x9bcd51(0x152)](_0x9bcd51(0x167)),console[_0x9bcd51(0x152)](_0x9bcd51(0x10d)),0x1;if(!_0x10ae78[_0x9bcd51(0xf0)])throw new SDKError(ErrorCode[_0x9bcd51(0x147)],_0x9bcd51(0x10b));const _0xfcd915=await withSpinner(_0x9bcd51(0x15a),()=>_0x2ad065['segment']['getSegmentSQL'](_0x10ae78['parentId'],_0x10ae78['segmentId']),{'verbose':_0x8505d1['verbose']}),_0x47c869=_0xfcd915[_0x9bcd51(0x131)],_0x86669d=await executeSchemaQuery(_0x47c869,_0x2ad065,_0x8505d1);return await handleQueryOutput(_0x86669d,_0x8505d1),0x0;}catch(_0xd31b1b){if(_0xd31b1b instanceof SDKError)return console[_0x9bcd51(0x152)](_0x9bcd51(0xe1)+_0xd31b1b['message']),_0xd31b1b[_0x9bcd51(0x122)]&&console['error']('\x20\x20Cause:\x20'+_0xd31b1b[_0x9bcd51(0x122)]),0x1;throw _0xd31b1b;}}}
|
|
1
|
+
const a27_0x3edf54=a27_0x58ba;(function(_0x650298,_0x37c04b){const _0x545604=a27_0x58ba,_0x745679=_0x650298();while(!![]){try{const _0x22a188=parseInt(_0x545604(0x142))/0x1+parseInt(_0x545604(0x159))/0x2+parseInt(_0x545604(0x1b5))/0x3+parseInt(_0x545604(0x1bb))/0x4+-parseInt(_0x545604(0x15c))/0x5*(-parseInt(_0x545604(0x122))/0x6)+parseInt(_0x545604(0x175))/0x7+-parseInt(_0x545604(0x138))/0x8*(parseInt(_0x545604(0x13d))/0x9);if(_0x22a188===_0x37c04b)break;else _0x745679['push'](_0x745679['shift']());}catch(_0x1fd2d2){_0x745679['push'](_0x745679['shift']());}}}(a27_0x2220,0xbd018));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../sdk/segment/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import{executeSchemaQuery}from'../sdk/segment/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import a27_0x111982 from'chalk';function a27_0x58ba(_0x493d7d,_0x1e3c3e){_0x493d7d=_0x493d7d-0x120;const _0x222063=a27_0x2220();let _0x58ba82=_0x222063[_0x493d7d];return _0x58ba82;}async function resolveSegmentTarget(_0x51177c,_0x48360f,_0x444b99){const _0x5f3dbf=a27_0x58ba;if(isYamlFilePath(_0x51177c))try{const _0x3d59d4=await resolveYamlFilePath(_0x51177c);return _0x444b99&&(console['error'](_0x5f3dbf(0x186)+_0x51177c),console[_0x5f3dbf(0x15f)](_0x5f3dbf(0x18a)+_0x3d59d4[_0x5f3dbf(0x1a0)]),console[_0x5f3dbf(0x15f)](_0x5f3dbf(0x14b)+_0x3d59d4['segmentName']),console[_0x5f3dbf(0x15f)](_0x5f3dbf(0x1a2)+(_0x3d59d4['folderPath']||_0x5f3dbf(0x18c))),console['error'](_0x5f3dbf(0x1a9)+_0x3d59d4[_0x5f3dbf(0x1b2)])),_0x3d59d4[_0x5f3dbf(0x1b2)];}catch(_0x35b8e4){throw new SDKError(ErrorCode[_0x5f3dbf(0x17a)],_0x5f3dbf(0x1ba)+_0x35b8e4['message']);}if(!_0x48360f)throw new SDKError(ErrorCode[_0x5f3dbf(0x17a)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return _0x48360f+'/'+_0x51177c;}export class SegmentDescribeCommand extends BaseCommand{['name']='segment:describe';[a27_0x3edf54(0x178)]='Show\x20segment\x20or\x20folder\x20details';async['execute'](_0x317fe2){const _0x3e4fff=a27_0x3edf54,{options:_0x1b505e,args:_0x15e67c,tdx:_0x45e625}=_0x317fe2,_0x4656b8=_0x15e67c[0x0],_0x157da4=!_0x4656b8&&!!_0x1b505e['parentSegment'],_0x38eb19=_0x4656b8||_0x1b505e['parentSegment'];if(!_0x38eb19)return console[_0x3e4fff(0x15f)](_0x3e4fff(0x169)),console[_0x3e4fff(0x15f)](_0x3e4fff(0x16a)),console[_0x3e4fff(0x15f)](_0x3e4fff(0x146)),console[_0x3e4fff(0x15f)](_0x3e4fff(0x155)),console[_0x3e4fff(0x15f)](_0x3e4fff(0x158)),console[_0x3e4fff(0x15f)](_0x3e4fff(0x121)),console[_0x3e4fff(0x15f)](_0x3e4fff(0x141)),0x1;try{const _0x4d1f39=_0x1b505e[_0x3e4fff(0x153)];let _0x2457e7=_0x38eb19;!_0x157da4&&_0x4d1f39&&!_0x38eb19[_0x3e4fff(0x14e)]('/')&&(_0x2457e7=_0x4d1f39+'/'+_0x38eb19,_0x1b505e['verbose']&&console[_0x3e4fff(0x15f)]('Resolved\x20relative\x20path\x20to:\x20'+_0x2457e7));const _0x253f72=await withSpinner(_0x3e4fff(0x188)+_0x2457e7+'\x27...',()=>_0x45e625[_0x3e4fff(0x14d)][_0x3e4fff(0x193)](_0x2457e7),{'verbose':_0x1b505e['verbose']}),_0x17e69f=_0x253f72[_0x3e4fff(0x1a5)];_0x1b505e['verbose']&&(console['error']('Resolved\x20type:\x20'+_0x17e69f[_0x3e4fff(0x125)]),console[_0x3e4fff(0x15f)](_0x3e4fff(0x17f)+_0x17e69f[_0x3e4fff(0x12a)]),_0x17e69f[_0x3e4fff(0x184)]&&console[_0x3e4fff(0x15f)](_0x3e4fff(0x18f)+_0x17e69f[_0x3e4fff(0x184)]),_0x17e69f[_0x3e4fff(0x12d)]&&console[_0x3e4fff(0x15f)](_0x3e4fff(0x148)+_0x17e69f['segmentId']));if(_0x17e69f['type']===_0x3e4fff(0x173)){const _0x3fad98=await withSpinner(_0x3e4fff(0x171),()=>_0x45e625[_0x3e4fff(0x14d)][_0x3e4fff(0x17b)](_0x17e69f[_0x3e4fff(0x12a)]),{'verbose':_0x1b505e['verbose']});await handleSingleObjectOutput(_0x3fad98[_0x3e4fff(0x1a5)],_0x1b505e);}else{if(_0x17e69f[_0x3e4fff(0x125)]===_0x3e4fff(0x128)){if(!_0x17e69f[_0x3e4fff(0x184)])throw new SDKError(ErrorCode[_0x3e4fff(0x185)],_0x3e4fff(0x150));const _0x216bc1=await withSpinner(_0x3e4fff(0x18e),()=>_0x45e625['segment'][_0x3e4fff(0x13c)](_0x17e69f['folderId']),{'verbose':_0x1b505e['verbose']});await handleSingleObjectOutput(_0x216bc1['data'],_0x1b505e);}else{if(_0x17e69f['type']==='segment'){if(!_0x17e69f[_0x3e4fff(0x12d)])throw new SDKError(ErrorCode[_0x3e4fff(0x1ab)],_0x3e4fff(0x16d));const _0x1894e9=await withSpinner(_0x3e4fff(0x129),()=>_0x45e625[_0x3e4fff(0x14d)]['getSegment'](_0x17e69f[_0x3e4fff(0x12a)],_0x17e69f[_0x3e4fff(0x12d)]),{'verbose':_0x1b505e[_0x3e4fff(0x180)]});await handleSingleObjectOutput(_0x1894e9[_0x3e4fff(0x1a5)],_0x1b505e);}}}return 0x0;}catch(_0x52a494){if(_0x52a494 instanceof SDKError)return console[_0x3e4fff(0x15f)](_0x3e4fff(0x177)+_0x52a494[_0x3e4fff(0x16b)]),_0x52a494['cause']&&console[_0x3e4fff(0x15f)](_0x3e4fff(0x124)+_0x52a494[_0x3e4fff(0x191)]),0x1;throw _0x52a494;}}}export class SegmentShowCommand extends BaseCommand{['name']=a27_0x3edf54(0x160);[a27_0x3edf54(0x178)]=a27_0x3edf54(0x131);async[a27_0x3edf54(0x1a6)](_0x3f04b2){const _0x4e1b26=a27_0x3edf54,{options:_0x3f222b,args:_0x1e7d82,tdx:_0x2d80b0}=_0x3f04b2,_0x2887b7=_0x1e7d82[0x0];if(!_0x2887b7)return console[_0x4e1b26(0x15f)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x4e1b26(0x15f)]('Usage:\x20tdx\x20sg\x20show\x20<name>'),console[_0x4e1b26(0x15f)](_0x4e1b26(0x137)),console[_0x4e1b26(0x15f)](_0x4e1b26(0x146)),console[_0x4e1b26(0x15f)](_0x4e1b26(0x132)),console['error'](_0x4e1b26(0x140)),0x1;try{const _0x5e9687=_0x3f222b[_0x4e1b26(0x1a0)],_0xa9550f=await resolveSegmentTarget(_0x2887b7,_0x5e9687,_0x3f222b['verbose']);_0x3f222b[_0x4e1b26(0x180)]&&console[_0x4e1b26(0x15f)](_0x4e1b26(0x1b7)+_0xa9550f);const _0xdd781a=await withSpinner(_0x4e1b26(0x14c)+_0x2887b7+_0x4e1b26(0x15a),()=>_0x2d80b0['segment'][_0x4e1b26(0x193)](_0xa9550f),{'verbose':_0x3f222b['verbose']}),_0x4ae73d=_0xdd781a[_0x4e1b26(0x1a5)];_0x3f222b[_0x4e1b26(0x180)]&&(console[_0x4e1b26(0x15f)](_0x4e1b26(0x1ae)+_0x4ae73d[_0x4e1b26(0x125)]),console['error'](_0x4e1b26(0x17f)+_0x4ae73d['parentId']));if(_0x4ae73d['type']==='folder')return console[_0x4e1b26(0x15f)](_0x4e1b26(0x190)),console['error']('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x4ae73d[_0x4e1b26(0x125)]===_0x4e1b26(0x173))return console[_0x4e1b26(0x15f)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console['error'](_0x4e1b26(0x151)),0x1;if(!_0x4ae73d['segmentId'])throw new SDKError(ErrorCode[_0x4e1b26(0x1ab)],_0x4e1b26(0x16d));const _0x36180f=await withSpinner(_0x4e1b26(0x19b),()=>_0x2d80b0[_0x4e1b26(0x14d)][_0x4e1b26(0x181)](_0x4ae73d[_0x4e1b26(0x12a)],_0x4ae73d[_0x4e1b26(0x12d)]),{'verbose':_0x3f222b[_0x4e1b26(0x180)]});let _0x4cbab7=_0x36180f[_0x4e1b26(0x1a5)];const _0x355b1e=resolveLimit(_0x3f222b[_0x4e1b26(0x12c)],DEFAULT_DISPLAY_LIMIT),_0x2c634d=/\bLIMIT\s+\d+/i[_0x4e1b26(0x1b8)](_0x4cbab7);!_0x2c634d&&(_0x4cbab7=_0x4cbab7['trim']()[_0x4e1b26(0x15d)](/;+$/,''),_0x4cbab7=_0x4e1b26(0x123)+_0x4cbab7+_0x4e1b26(0x165)+_0x355b1e);_0x3f222b[_0x4e1b26(0x180)]&&console[_0x4e1b26(0x15f)](_0x4e1b26(0x145)+_0x4cbab7);const _0x4142b5=await withProgressSpinner(_0x4e1b26(0x196),async _0x4b0ca6=>{const _0x1d3141=_0x4e1b26,_0x2e97d7=await _0x2d80b0[_0x1d3141(0x18b)][_0x1d3141(0x1a6)](_0x4cbab7,{'catalog':'td','schema':_0x1d3141(0x152),'onJobId':_0x39e58d=>{const _0x258335=_0x1d3141;_0x4b0ca6[_0x258335(0x16e)](_0x39e58d);}});return _0x2e97d7;},{'verbose':_0x3f222b['verbose']}),_0x59e1cb=_0x4142b5[_0x4e1b26(0x1a5)],_0x3c40a6=_0x59e1cb[_0x4e1b26(0x166)]?'\x20[Job\x20ID:\x20'+_0x59e1cb[_0x4e1b26(0x166)]+']':'';return console[_0x4e1b26(0x15f)](_0x4e1b26(0x17e)+_0x59e1cb['stats'][_0x4e1b26(0x18d)]['toLocaleString']()+'\x20rows\x20'+(_0x4e1b26(0x17d)+formatElapsed(_0x59e1cb['stats']['elapsedTimeMillis'])+_0x3c40a6)),await handleQueryOutput(_0x59e1cb,_0x3f222b),0x0;}catch(_0x206fd0){if(_0x206fd0 instanceof SDKError)return console[_0x4e1b26(0x15f)](_0x4e1b26(0x1a1)+_0x206fd0[_0x4e1b26(0x156)]+']'),console[_0x4e1b26(0x15f)]('\x0a'+_0x206fd0[_0x4e1b26(0x16b)]),0x1;throw _0x206fd0;}}}export class SegmentFolderListCommand extends BaseCommand{[a27_0x3edf54(0x134)]=a27_0x3edf54(0x176);[a27_0x3edf54(0x178)]=a27_0x3edf54(0x149);async[a27_0x3edf54(0x1a6)](_0x5b58d0){const _0x1d7f13=a27_0x3edf54,{options:_0x33d431,args:_0x5b23eb,tdx:_0x5527aa}=_0x5b58d0;if(_0x5b23eb[_0x1d7f13(0x15b)]===0x0)return console[_0x1d7f13(0x15f)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x1d7f13(0x15f)](_0x1d7f13(0x199)),0x1;const _0x1ae914=_0x5b23eb[0x0];try{_0x33d431[_0x1d7f13(0x180)]&&(console[_0x1d7f13(0x15f)]('Site:\x20'+_0x33d431['site']),console[_0x1d7f13(0x15f)](_0x1d7f13(0x1a3)+_0x1ae914));const _0x41720b=await withSpinner(_0x1d7f13(0x19a)+_0x1ae914+_0x1d7f13(0x15a),()=>_0x5527aa[_0x1d7f13(0x14d)][_0x1d7f13(0x172)](_0x1ae914),{'verbose':_0x33d431[_0x1d7f13(0x180)]}),_0x3774ca=_0x41720b[_0x1d7f13(0x1a5)];_0x33d431['verbose']&&console[_0x1d7f13(0x15f)]('Resolved\x20parent\x20ID:\x20'+_0x3774ca);const _0x22c85a=await withSpinner(_0x1d7f13(0x1b3)+_0x1ae914+'\x27...',()=>_0x5527aa[_0x1d7f13(0x14d)][_0x1d7f13(0x161)](_0x3774ca),{'verbose':_0x33d431[_0x1d7f13(0x180)]}),_0x4da017=_0x22c85a['data'];return console['error'](_0x1d7f13(0x170)+_0x4da017['length']+_0x1d7f13(0x16f)+(_0x4da017[_0x1d7f13(0x15b)]!==0x1?'s':'')),await handleSDKOutput(_0x4da017,_0x33d431),0x0;}catch(_0x340331){if(_0x340331 instanceof SDKError)return console[_0x1d7f13(0x15f)](_0x1d7f13(0x177)+_0x340331[_0x1d7f13(0x16b)]),_0x340331[_0x1d7f13(0x191)]&&console[_0x1d7f13(0x15f)](_0x1d7f13(0x124)+_0x340331['cause']),0x1;throw _0x340331;}}}export class SegmentFolderShowCommand extends BaseCommand{['name']=a27_0x3edf54(0x1b6);[a27_0x3edf54(0x178)]=a27_0x3edf54(0x120);async[a27_0x3edf54(0x1a6)](_0x4c3d53){const _0x28963f=a27_0x3edf54,{options:_0x251145,args:_0xcaabe8,tdx:_0x362198}=_0x4c3d53;if(_0xcaabe8[_0x28963f(0x15b)]===0x0)return console[_0x28963f(0x15f)](_0x28963f(0x164)),console[_0x28963f(0x15f)](_0x28963f(0x195)),0x1;try{const {parentId:_0x542f5e,childId:_0x4c8d9d}=parseSegmentRef(_0xcaabe8[0x0]);_0x251145[_0x28963f(0x180)]&&(console[_0x28963f(0x15f)]('Site:\x20'+_0x251145[_0x28963f(0x14a)]),console[_0x28963f(0x15f)]('Parent\x20name:\x20'+_0x542f5e),_0x4c8d9d&&console[_0x28963f(0x15f)](_0x28963f(0x130)+_0x4c8d9d));if(!_0x4c8d9d)return console['error'](_0x28963f(0x1ad)),0x1;const _0x1bd5a0=await withSpinner(_0x28963f(0x19a)+_0x542f5e+_0x28963f(0x15a),()=>_0x362198['segment']['resolveParentId'](_0x542f5e),{'verbose':_0x251145[_0x28963f(0x180)]}),_0xce64e5=_0x1bd5a0[_0x28963f(0x1a5)];_0x251145[_0x28963f(0x180)]&&console[_0x28963f(0x15f)]('Resolved\x20parent\x20ID:\x20'+_0xce64e5);const _0x296960=await withSpinner(_0x28963f(0x1aa)+_0x4c8d9d+_0x28963f(0x15a),()=>_0x362198[_0x28963f(0x14d)]['resolveFolderId'](_0xce64e5,_0x4c8d9d),{'verbose':_0x251145[_0x28963f(0x180)]}),_0x17c632=_0x296960['data'];_0x251145[_0x28963f(0x180)]&&console[_0x28963f(0x15f)](_0x28963f(0x167)+_0x17c632);const _0x3acc5e=await withSpinner('Fetching\x20folder\x20\x27'+_0x4c8d9d+_0x28963f(0x15a),()=>_0x362198[_0x28963f(0x14d)][_0x28963f(0x13c)](_0x17c632),{'verbose':_0x251145[_0x28963f(0x180)]});return await handleSDKOutput([_0x3acc5e[_0x28963f(0x1a5)]],_0x251145),0x0;}catch(_0x562eab){if(_0x562eab instanceof SDKError)return console['error'](_0x28963f(0x177)+_0x562eab[_0x28963f(0x16b)]),_0x562eab[_0x28963f(0x191)]&&console[_0x28963f(0x15f)]('\x20\x20Cause:\x20'+_0x562eab['cause']),0x1;throw _0x562eab;}}}export class SegmentSQLCommand extends BaseCommand{[a27_0x3edf54(0x134)]=a27_0x3edf54(0x189);[a27_0x3edf54(0x178)]='Get\x20SQL\x20query\x20for\x20child\x20segment';async[a27_0x3edf54(0x1a6)](_0x2339f6){const _0x2ee7f0=a27_0x3edf54,{options:_0x5d66d6,args:_0x57bd15,tdx:_0xc16f14}=_0x2339f6,_0x1b2230=_0x57bd15[0x0];if(!_0x1b2230)return console[_0x2ee7f0(0x15f)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0x2ee7f0(0x15f)](_0x2ee7f0(0x1b0)),console[_0x2ee7f0(0x15f)](_0x2ee7f0(0x143)),console['error'](_0x2ee7f0(0x146)),console['error']('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x2ee7f0(0x15f)](_0x2ee7f0(0x14f)),0x1;try{const _0x3ee298=_0x5d66d6[_0x2ee7f0(0x1a0)],_0x3e1729=await resolveSegmentTarget(_0x1b2230,_0x3ee298,_0x5d66d6[_0x2ee7f0(0x180)]);_0x5d66d6[_0x2ee7f0(0x180)]&&console[_0x2ee7f0(0x15f)](_0x2ee7f0(0x1b7)+_0x3e1729);const _0x244f12=await withSpinner(_0x2ee7f0(0x14c)+_0x1b2230+_0x2ee7f0(0x15a),()=>_0xc16f14[_0x2ee7f0(0x14d)][_0x2ee7f0(0x193)](_0x3e1729),{'verbose':_0x5d66d6[_0x2ee7f0(0x180)]}),_0x43f626=_0x244f12['data'];_0x5d66d6['verbose']&&(console[_0x2ee7f0(0x15f)](_0x2ee7f0(0x1ae)+_0x43f626['type']),console[_0x2ee7f0(0x15f)]('Parent\x20ID:\x20'+_0x43f626[_0x2ee7f0(0x12a)]));if(_0x43f626['type']===_0x2ee7f0(0x128))return console[_0x2ee7f0(0x15f)]('Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.'),console[_0x2ee7f0(0x15f)](_0x2ee7f0(0x1a4)),0x1;if(_0x43f626[_0x2ee7f0(0x125)]===_0x2ee7f0(0x173))return console[_0x2ee7f0(0x15f)](_0x2ee7f0(0x168)),console[_0x2ee7f0(0x15f)](_0x2ee7f0(0x179)),0x1;if(!_0x43f626[_0x2ee7f0(0x12d)])throw new SDKError(ErrorCode[_0x2ee7f0(0x1ab)],_0x2ee7f0(0x16d));const _0x4f0a89=await withSpinner(_0x2ee7f0(0x19b),()=>_0xc16f14[_0x2ee7f0(0x14d)]['getSegmentSQL'](_0x43f626['parentId'],_0x43f626[_0x2ee7f0(0x12d)]),{'verbose':_0x5d66d6[_0x2ee7f0(0x180)]}),_0x5b232a=_0x4f0a89[_0x2ee7f0(0x1a5)];return _0x5d66d6[_0x2ee7f0(0x157)]==='json'||_0x5d66d6['format']===_0x2ee7f0(0x154)?await handleSDKOutput([{'sql':_0x5b232a}],_0x5d66d6):console[_0x2ee7f0(0x197)](_0x5b232a),0x0;}catch(_0x1b4535){if(_0x1b4535 instanceof SDKError)return console[_0x2ee7f0(0x15f)](_0x2ee7f0(0x177)+_0x1b4535[_0x2ee7f0(0x16b)]),_0x1b4535[_0x2ee7f0(0x191)]&&console['error'](_0x2ee7f0(0x124)+_0x1b4535[_0x2ee7f0(0x191)]),0x1;throw _0x1b4535;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a27_0x3edf54(0x134)]=a27_0x3edf54(0x13e);[a27_0x3edf54(0x178)]=a27_0x3edf54(0x19e);async[a27_0x3edf54(0x1a6)](_0x18bd07){const _0x2a0c81=a27_0x3edf54,{options:_0x3d27c2,args:_0x257cd9,tdx:_0x4d028c}=_0x18bd07,_0xc1d403=_0x3d27c2;if(_0x257cd9[_0x2a0c81(0x15b)]<0x2)return console['error'](_0x2a0c81(0x16c)),console['error'](_0x2a0c81(0x1a8)),0x1;const _0xe1bc04=_0x257cd9[0x0],_0xe292c5=_0x257cd9[0x1];_0xc1d403[_0x2a0c81(0x180)]&&(console[_0x2a0c81(0x15f)](_0x2a0c81(0x174)+_0xc1d403[_0x2a0c81(0x14a)]),console[_0x2a0c81(0x15f)](_0x2a0c81(0x1b1)+_0xe1bc04),console[_0x2a0c81(0x15f)]('Folder\x20name:\x20'+_0xe292c5));let _0x54d369;if(_0xc1d403['parentFolder']){const _0x10c46f=_0xc1d403['parentFolder'],_0x37059f=await withSpinner(_0x2a0c81(0x19a)+_0xe1bc04+'\x27...',()=>_0x4d028c['segment'][_0x2a0c81(0x172)](_0xe1bc04),{'verbose':_0xc1d403['verbose']}),_0x30c1b7=_0x37059f['data'],_0x43ae46=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x10c46f+'\x27...',()=>_0x4d028c[_0x2a0c81(0x14d)][_0x2a0c81(0x198)](_0x30c1b7,_0x10c46f),{'verbose':_0xc1d403[_0x2a0c81(0x180)]});_0x54d369=_0x43ae46[_0x2a0c81(0x1a5)],_0xc1d403[_0x2a0c81(0x180)]&&console['error'](_0x2a0c81(0x183)+_0x54d369);}const _0x1bd49b={'name':_0xe292c5,'description':_0xc1d403[_0x2a0c81(0x178)],'parentFolderId':_0x54d369},_0xd51d60=await withSpinner('Creating\x20folder\x20\x27'+_0xe292c5+_0x2a0c81(0x15a),()=>_0x4d028c[_0x2a0c81(0x14d)]['createFolder'](_0xe1bc04,_0x1bd49b),{'verbose':_0xc1d403['verbose']}),_0x326b2b=_0xd51d60[_0x2a0c81(0x1a5)];return console[_0x2a0c81(0x15f)]('β\x20Created\x20folder\x20\x27'+_0x326b2b[_0x2a0c81(0x134)]+_0x2a0c81(0x1b4)+_0x326b2b['id']),await handleSDKOutput([_0x326b2b],_0xc1d403),0x0;}}export class SegmentViewCommand extends BaseCommand{[a27_0x3edf54(0x134)]=a27_0x3edf54(0x127);[a27_0x3edf54(0x178)]=a27_0x3edf54(0x136);async[a27_0x3edf54(0x1a6)](_0x7f3676){const _0x366c4d=a27_0x3edf54,{options:_0x1426ab,args:_0x4c3821,tdx:_0x21e9dc}=_0x7f3676,_0x4cdca8=_0x4c3821[0x0];if(!_0x4cdca8)return console[_0x366c4d(0x15f)](_0x366c4d(0x163)),console['error'](_0x366c4d(0x147)),console[_0x366c4d(0x15f)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console[_0x366c4d(0x15f)](_0x366c4d(0x1ac)),console['error'](_0x366c4d(0x15e)),console['error'](_0x366c4d(0x146)),console[_0x366c4d(0x15f)](_0x366c4d(0x19d)),console[_0x366c4d(0x15f)](_0x366c4d(0x12e)),console[_0x366c4d(0x15f)](_0x366c4d(0x139)),console[_0x366c4d(0x15f)](_0x366c4d(0x192)),0x1;try{const _0x5556e9=_0x1426ab[_0x366c4d(0x1a0)],_0x3e2fe3=await resolveSegmentTarget(_0x4cdca8,_0x5556e9,_0x1426ab['verbose']);_0x1426ab[_0x366c4d(0x180)]&&console[_0x366c4d(0x15f)](_0x366c4d(0x1b7)+_0x3e2fe3);const _0x55fb2b=await withSpinner(_0x366c4d(0x14c)+_0x4cdca8+_0x366c4d(0x15a),()=>_0x21e9dc[_0x366c4d(0x14d)][_0x366c4d(0x193)](_0x3e2fe3),{'verbose':_0x1426ab[_0x366c4d(0x180)]}),_0x4cb487=_0x55fb2b['data'];_0x1426ab[_0x366c4d(0x180)]&&(console[_0x366c4d(0x15f)](_0x366c4d(0x1ae)+_0x4cb487[_0x366c4d(0x125)]),console[_0x366c4d(0x15f)](_0x366c4d(0x17f)+_0x4cb487[_0x366c4d(0x12a)]),_0x4cb487['folderId']&&console[_0x366c4d(0x15f)]('Folder\x20ID:\x20'+_0x4cb487[_0x366c4d(0x184)]),_0x4cb487[_0x366c4d(0x12d)]&&console[_0x366c4d(0x15f)](_0x366c4d(0x148)+_0x4cb487[_0x366c4d(0x12d)]));if(_0x1426ab[_0x366c4d(0x13f)]){if(_0x4cb487[_0x366c4d(0x125)]===_0x366c4d(0x128))return console[_0x366c4d(0x15f)](_0x366c4d(0x126)),0x1;if(_0x4cb487[_0x366c4d(0x125)]==='parent')return console[_0x366c4d(0x15f)](_0x366c4d(0x13a)),console[_0x366c4d(0x15f)](_0x366c4d(0x13b)),0x1;if(!_0x4cb487[_0x366c4d(0x12d)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x366c4d(0x16d));const _0x2aa136=getConsoleNextUrl(_0x1426ab[_0x366c4d(0x14a)],'/app/ps/'+_0x4cb487['parentId']+_0x366c4d(0x135)+_0x4cb487[_0x366c4d(0x12d)]);return console[_0x366c4d(0x15f)](a27_0x111982['green']('β')+_0x366c4d(0x187)+a27_0x111982[_0x366c4d(0x182)](_0x2aa136)),openBrowser(_0x2aa136),0x0;}if(_0x4cb487[_0x366c4d(0x125)]===_0x366c4d(0x128)){if(!_0x4cb487['folderId'])throw new SDKError(ErrorCode['SEGMENT_FOLDER_NOT_FOUND'],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x3722b6=await withSpinner('Fetching\x20folder\x20details...',()=>_0x21e9dc['segment'][_0x366c4d(0x13c)](_0x4cb487[_0x366c4d(0x184)]),{'verbose':_0x1426ab[_0x366c4d(0x180)]});await handleSingleObjectOutput(_0x3722b6[_0x366c4d(0x1a5)],_0x1426ab);}else{if(_0x4cb487[_0x366c4d(0x125)]===_0x366c4d(0x14d)){if(!_0x4cb487[_0x366c4d(0x12d)])throw new SDKError(ErrorCode[_0x366c4d(0x1ab)],_0x366c4d(0x16d));const _0x2fc44a=await withSpinner(_0x366c4d(0x129),()=>_0x21e9dc[_0x366c4d(0x14d)][_0x366c4d(0x12b)](_0x4cb487[_0x366c4d(0x12a)],_0x4cb487[_0x366c4d(0x12d)]),{'verbose':_0x1426ab[_0x366c4d(0x180)]}),_0x42f64b=getConsoleNextUrl(_0x1426ab[_0x366c4d(0x14a)],_0x366c4d(0x12f)+_0x4cb487[_0x366c4d(0x12a)]+_0x366c4d(0x135)+_0x4cb487[_0x366c4d(0x12d)]),_0x3232fb=_0x2fc44a[_0x366c4d(0x1a5)];_0x3232fb[_0x366c4d(0x144)]=_0x42f64b,await handleSingleObjectOutput(_0x3232fb,_0x1426ab);}else return console[_0x366c4d(0x15f)](_0x366c4d(0x1a7)),console[_0x366c4d(0x15f)](_0x366c4d(0x1b9)),0x1;}return 0x0;}catch(_0x3d353c){if(_0x3d353c instanceof SDKError)return console[_0x366c4d(0x15f)](_0x366c4d(0x177)+_0x3d353c[_0x366c4d(0x16b)]),_0x3d353c['cause']&&console[_0x366c4d(0x15f)](_0x366c4d(0x124)+_0x3d353c[_0x366c4d(0x191)]),0x1;throw _0x3d353c;}}}export const SegmentInfoCommand=SegmentViewCommand;function a27_0x2220(){const _0x1a99e5=['\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','619902eFMRbo','SELECT\x20*\x20FROM\x20(\x0a','\x20\x20Cause:\x20','type','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','segment:view','folder','Fetching\x20segment\x20details...','parentId','getSegment','limit','segmentId','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','/app/ps/','Folder\x20name:\x20','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','name','/e/','Show\x20folder\x20or\x20child\x20segment\x20details','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','8gNQGzc','\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.','Use:\x20tdx\x20ps\x20view\x20-w','getFolder','33763185vVtykN','segment:folder:create','web','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','1123361XNkUjv','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','url','SQL\x20query:\x0a','Examples:','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Segment\x20ID:\x20','List\x20segment\x20folders\x20under\x20a\x20parent\x20segment','site','\x20\x20Segment\x20name:\x20','Resolving\x20\x27','segment','includes','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Use:\x20tdx\x20ps\x20show','information_schema','segmentPath','jsonl','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','code','format','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','2341604QVcEKx','\x27...','length','60SsNLtj','replace','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','error','segment:show','listFolders','\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Error:\x20Folder\x20reference\x20is\x20required','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','jobId','Resolved\x20folder\x20ID:\x20','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','Error:\x20Path\x20or\x20name\x20is\x20required','Usage:\x20tdx\x20segment\x20describe\x20<path>','message','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','Segment\x20ID\x20missing\x20from\x20resolved\x20path','setJobId','\x20folder','β\x20Found\x20','Fetching\x20parent\x20segment\x20details...','resolveParentId','parent','Site:\x20','3341968ghQBaB','segment:folder:list','Error:\x20','description','Use:\x20tdx\x20ps\x20sql','INVALID_ARGUMENT','getParent','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','in\x20','β\x20Query\x20completed:\x20Processed\x20','Parent\x20ID:\x20','verbose','getSegmentSQL','cyan','Resolved\x20parent\x20folder\x20ID:\x20','folderId','SEGMENT_FOLDER_NOT_FOUND','Resolved\x20YAML\x20file:\x20','\x20Opening\x20','Resolving\x20path\x20\x27','segment:sql','\x20\x20Parent\x20segment:\x20','query','(root)','processedRows','Fetching\x20folder\x20details...','Folder\x20ID:\x20','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','cause','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','resolvePathToResource','Show\x20child\x20segment\x20schema\x20(column\x20types)','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','Executing\x20segment\x20query...','log','resolveFolderId','Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>','Resolving\x20parent\x20segment\x20\x27','Fetching\x20SQL\x20for\x20segment...','Use:\x20tdx\x20ps\x20desc','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','Create\x20segment\x20folder\x20for\x20organization','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','parentSegment','β\x20Query\x20failed\x20[','\x20\x20Folder\x20path:\x20','Parent\x20name:\x20','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','data','execute','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','\x20\x20Full\x20path:\x20','Resolving\x20folder\x20\x27','SEGMENT_NOT_FOUND','Options:','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Resolved\x20type:\x20','Usage:\x20tdx\x20sg\x20desc\x20<name>','Usage:\x20tdx\x20sg\x20sql\x20<name>','Parent\x20segment:\x20','fullPath','Listing\x20folders\x20for\x20parent\x20\x27','\x27\x20with\x20ID:\x20','973185JMWzRP','segment:folder:show','Target\x20path:\x20','test','Use:\x20tdx\x20ps\x20view','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','759388isEhSe','Show\x20segment\x20folder\x20details'];a27_0x2220=function(){return _0x1a99e5;};return a27_0x2220();}export class SegmentDescCommand extends BaseCommand{[a27_0x3edf54(0x134)]='segment:desc';[a27_0x3edf54(0x178)]=a27_0x3edf54(0x194);async[a27_0x3edf54(0x1a6)](_0xc15d4d){const _0xd69958=a27_0x3edf54,{options:_0x4a5eb3,args:_0x5d7c13,tdx:_0x236836}=_0xc15d4d,_0x22b1e4=_0x5d7c13[0x0];if(!_0x22b1e4)return console[_0xd69958(0x15f)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console[_0xd69958(0x15f)](_0xd69958(0x1af)),console['error'](_0xd69958(0x133)),console[_0xd69958(0x15f)]('Examples:'),console[_0xd69958(0x15f)](_0xd69958(0x162)),console['error']('\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x2b03f2=_0x4a5eb3['parentSegment'],_0x357773=await resolveSegmentTarget(_0x22b1e4,_0x2b03f2,_0x4a5eb3[_0xd69958(0x180)]);_0x4a5eb3['verbose']&&console[_0xd69958(0x15f)](_0xd69958(0x1b7)+_0x357773);const _0x112c07=await withSpinner('Resolving\x20\x27'+_0x22b1e4+_0xd69958(0x15a),()=>_0x236836[_0xd69958(0x14d)][_0xd69958(0x193)](_0x357773),{'verbose':_0x4a5eb3[_0xd69958(0x180)]}),_0x15e050=_0x112c07[_0xd69958(0x1a5)];_0x4a5eb3['verbose']&&(console[_0xd69958(0x15f)](_0xd69958(0x1ae)+_0x15e050[_0xd69958(0x125)]),console[_0xd69958(0x15f)]('Parent\x20ID:\x20'+_0x15e050[_0xd69958(0x12a)]));if(_0x15e050[_0xd69958(0x125)]===_0xd69958(0x128))return console[_0xd69958(0x15f)](_0xd69958(0x19f)),console['error'](_0xd69958(0x1a4)),0x1;if(_0x15e050[_0xd69958(0x125)]===_0xd69958(0x173))return console['error'](_0xd69958(0x17c)),console[_0xd69958(0x15f)](_0xd69958(0x19c)),0x1;if(!_0x15e050[_0xd69958(0x12d)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0xd69958(0x16d));const _0x38d29c=await withSpinner('Fetching\x20SQL\x20for\x20segment...',()=>_0x236836[_0xd69958(0x14d)]['getSegmentSQL'](_0x15e050['parentId'],_0x15e050['segmentId']),{'verbose':_0x4a5eb3[_0xd69958(0x180)]}),_0x4b2ce3=_0x38d29c['data'],_0x32c64a=await executeSchemaQuery(_0x4b2ce3,_0x236836,_0x4a5eb3);return await handleQueryOutput(_0x32c64a,_0x4a5eb3),0x0;}catch(_0x161440){if(_0x161440 instanceof SDKError)return console[_0xd69958(0x15f)](_0xd69958(0x177)+_0x161440[_0xd69958(0x16b)]),_0x161440['cause']&&console[_0xd69958(0x15f)](_0xd69958(0x124)+_0x161440[_0xd69958(0x191)]),0x1;throw _0x161440;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a28_0x5e555e=a28_0x4947;(function(_0x2ebe27,_0x2d4f06){const _0x4c6f37=a28_0x4947,_0x3b677c=_0x2ebe27();while(!![]){try{const _0x4d1770=-parseInt(_0x4c6f37(0x199))/0x1*(-parseInt(_0x4c6f37(0x1a4))/0x2)+-parseInt(_0x4c6f37(0x1a5))/0x3*(-parseInt(_0x4c6f37(0x191))/0x4)+parseInt(_0x4c6f37(0x1a3))/0x5+parseInt(_0x4c6f37(0x195))/0x6*(-parseInt(_0x4c6f37(0x18e))/0x7)+-parseInt(_0x4c6f37(0x189))/0x8+-parseInt(_0x4c6f37(0x18c))/0x9+parseInt(_0x4c6f37(0x1ae))/0xa;if(_0x4d1770===_0x2d4f06)break;else _0x3b677c['push'](_0x3b677c['shift']());}catch(_0x201ed2){_0x3b677c['push'](_0x3b677c['shift']());}}}(a28_0x723c,0x9780d));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a28_0x4947(_0x5b2ec3,_0x412e1b){_0x5b2ec3=_0x5b2ec3-0x183;const _0x723cdf=a28_0x723c();let _0x494789=_0x723cdf[_0x5b2ec3];return _0x494789;}import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../sdk/segment/segment-path-parser.js';import a28_0x2944b3 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a28_0x5e555e(0x18d)]=a28_0x5e555e(0x1a1);['description']='Create\x20child\x20segment\x20with\x20filtering\x20rules';async[a28_0x5e555e(0x198)](_0x53594d){const _0x35bc33=a28_0x5e555e;console[_0x35bc33(0x197)](a28_0x2944b3[_0x35bc33(0x1b4)](_0x35bc33(0x192))),console[_0x35bc33(0x197)](a28_0x2944b3[_0x35bc33(0x1b4)](_0x35bc33(0x19a)));const {options:_0x2ccbdd,args:_0x4e1e7f,tdx:_0x7a420a}=_0x53594d,_0x8fba6d=_0x2ccbdd;if(_0x4e1e7f[_0x35bc33(0x1a8)]===0x0)return console[_0x35bc33(0x197)](_0x35bc33(0x193)),console[_0x35bc33(0x197)](_0x35bc33(0x1ab)),console['error'](_0x35bc33(0x1aa)),console['error']('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console[_0x35bc33(0x197)](_0x35bc33(0x186)),console['error'](_0x35bc33(0x1b6)),0x1;const _0x4ee53f=_0x4e1e7f[0x0],_0x2093e5=_0x2ccbdd[_0x35bc33(0x18b)];let _0x2b734b=_0x4ee53f;_0x2093e5&&!_0x4ee53f['includes']('/')&&(_0x2b734b=_0x2093e5+'/'+_0x4ee53f,_0x8fba6d['verbose']&&console[_0x35bc33(0x197)](_0x35bc33(0x19f)+_0x2b734b));const _0x263cd8=parsePath(_0x2b734b);if(_0x263cd8[_0x35bc33(0x19e)][_0x35bc33(0x1a8)]<0x2)return console['error'](_0x35bc33(0x1b0)),console[_0x35bc33(0x197)]('Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]'),0x1;const _0x5ec2bf=_0x263cd8[_0x35bc33(0x19e)][0x0],_0x1b2f91=getBaseName(_0x2b734b),_0x3876a8=getParentPath(_0x2b734b);_0x8fba6d['verbose']&&(console['error'](_0x35bc33(0x184)+_0x8fba6d['site']),console['error']('Target\x20path:\x20'+_0x2b734b),console[_0x35bc33(0x197)](_0x35bc33(0x18a)+_0x5ec2bf),console[_0x35bc33(0x197)]('Segment\x20name:\x20'+_0x1b2f91),console[_0x35bc33(0x197)](_0x35bc33(0x1af)+_0x3876a8));const _0x16e402=await withSpinner(_0x35bc33(0x1b2)+_0x5ec2bf+_0x35bc33(0x183),()=>_0x7a420a[_0x35bc33(0x190)][_0x35bc33(0x1b1)](_0x5ec2bf),{'verbose':_0x8fba6d[_0x35bc33(0x1a6)]}),_0x357d81=_0x16e402[_0x35bc33(0x187)];let _0x28aeaf;if(_0x263cd8['segments'][_0x35bc33(0x1a8)]>0x2){const _0x2d2919=await withSpinner(_0x35bc33(0x1a7)+_0x3876a8+_0x35bc33(0x183),()=>_0x7a420a[_0x35bc33(0x190)][_0x35bc33(0x19c)](_0x3876a8),{'verbose':_0x8fba6d['verbose']}),_0x23eaf0=_0x2d2919['data'];if(_0x23eaf0[_0x35bc33(0x18f)]!==_0x35bc33(0x1b5)&&_0x23eaf0[_0x35bc33(0x18f)]!==_0x35bc33(0x19b))return console[_0x35bc33(0x197)](_0x35bc33(0x1a0)),0x1;_0x28aeaf=_0x23eaf0['folderId'];}else{if(_0x8fba6d[_0x35bc33(0x1b5)]){const _0x35430e=await withSpinner('Resolving\x20folder\x20\x27'+_0x8fba6d[_0x35bc33(0x1b5)]+_0x35bc33(0x183),()=>_0x7a420a[_0x35bc33(0x190)][_0x35bc33(0x1ac)](_0x357d81,_0x8fba6d[_0x35bc33(0x1b5)]),{'verbose':_0x8fba6d[_0x35bc33(0x1a6)]});_0x28aeaf=_0x35430e[_0x35bc33(0x187)];}}_0x8fba6d[_0x35bc33(0x1a6)]&&_0x28aeaf&&console['error'](_0x35bc33(0x1b3)+_0x28aeaf);const _0x1f8732=await loadJSONFromOptions(_0x8fba6d['rule'],_0x8fba6d[_0x35bc33(0x188)]),_0xf0121f={'name':_0x1b2f91,'description':_0x8fba6d['description'],'rule':_0x1f8732,'kind':_0x8fba6d[_0x35bc33(0x1a2)]!==undefined?parseInt(_0x8fba6d['kind'],0xa):undefined,'isVisible':_0x8fba6d['invisible']?![]:undefined,'segmentFolderId':_0x28aeaf,'countPopulation':_0x8fba6d[_0x35bc33(0x1ad)]?![]:undefined},_0xb9429a=await withSpinner(_0x35bc33(0x194)+_0x1b2f91+_0x35bc33(0x183),()=>_0x7a420a['segment'][_0x35bc33(0x185)](_0x357d81,_0xf0121f),{'verbose':_0x8fba6d[_0x35bc33(0x1a6)]}),_0x2add35=_0xb9429a['data'];return console[_0x35bc33(0x197)](_0x35bc33(0x19d)+_0x2add35['name']+_0x35bc33(0x1a9)+_0x2add35['id']),_0x2b734b!==_0x4ee53f&&console[_0x35bc33(0x197)](_0x35bc33(0x196)+_0x2b734b),await handleSDKOutput([_0x2add35],_0x8fba6d),0x0;}}function a28_0x723c(){const _0x4883a1=['execute','3ZDIzyN','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','parent','resolvePathToResource','β\x20Created\x20segment\x20\x27','segments','Resolved\x20relative\x20path\x20to:\x20','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','segment:create','kind','3678270aESjGF','276678qcKKqq','1650837VYvutf','verbose','Resolving\x20folder\x20path\x20\x27','length','\x27\x20with\x20ID:\x20','Examples:','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','resolveFolderId','noCountPopulation','16421490wPesZo','Parent\x20path:\x20','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','resolveParentId','Resolving\x20parent\x20segment\x20\x27','Resolved\x20folder\x20ID:\x20','yellow','folder','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','\x27...','Site:\x20','createSegment','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','data','ruleFile','6211648jOIXmv','Parent:\x20','segmentPath','6488649UQWJZM','name','38115AYDFOg','type','segment','4YsTluw','β \x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','Creating\x20segment\x20\x27','1350PnmMvE','\x20\x20\x20Path:\x20','error'];a28_0x723c=function(){return _0x4883a1;};return a28_0x723c();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a29_0x1015c1=a29_0x2be0;(function(_0x492f10,_0x3cd444){const _0x3c9f54=a29_0x2be0,_0x54ea63=_0x492f10();while(!![]){try{const _0x478a28=parseInt(_0x3c9f54(0x1e3))/0x1+parseInt(_0x3c9f54(0x1f0))/0x2*(parseInt(_0x3c9f54(0x1e7))/0x3)+parseInt(_0x3c9f54(0x1f1))/0x4*(parseInt(_0x3c9f54(0x1e0))/0x5)+parseInt(_0x3c9f54(0x1e8))/0x6*(-parseInt(_0x3c9f54(0x1f9))/0x7)+parseInt(_0x3c9f54(0x1fc))/0x8+-parseInt(_0x3c9f54(0x1f2))/0x9*(-parseInt(_0x3c9f54(0x1f6))/0xa)+-parseInt(_0x3c9f54(0x1ec))/0xb*(parseInt(_0x3c9f54(0x1ef))/0xc);if(_0x478a28===_0x3cd444)break;else _0x54ea63['push'](_0x54ea63['shift']());}catch(_0x3e3ace){_0x54ea63['push'](_0x54ea63['shift']());}}}(a29_0x4b63,0x69791));function a29_0x2be0(_0xc341a9,_0x1d037b){_0xc341a9=_0xc341a9-0x1e0;const _0x4b63a5=a29_0x4b63();let _0x2be031=_0x4b63a5[_0xc341a9];return _0x2be031;}import{BaseCommand}from'./command.js';function a29_0x4b63(){const _0x2a47c7=['553SKkZzc','jsonl','verbose','5765752HQLpoD','name','segment','864670ktXHRT','description','listFields','538912LGGRMX','\x27...','json','data','3tqypGg','40578JVExPw','Listing\x20fields\x20for\x20\x27','error','β\x20Found\x20','569591QGsKIZ','segment:fields','\x20field','540QrLoXq','1417564VfZUsX','16pAQxaK','2863305UNbfDn','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','length','Usage:\x20tdx\x20segment\x20fields\x20<parent_name>','20MceiJb','site','parentSegment'];a29_0x4b63=function(){return _0x2a47c7;};return a29_0x4b63();}import{handleSDKOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{displayFieldsHumanReadable}from'../sdk/segment/fields-display.js';export class SegmentFieldsCommand extends BaseCommand{[a29_0x1015c1(0x1fd)]=a29_0x1015c1(0x1ed);[a29_0x1015c1(0x1e1)]='List\x20available\x20fields\x20for\x20segmentation';async['execute'](_0x51c430){const _0x209a71=a29_0x1015c1,{options:_0x2a0e89,args:_0x5395ec,tdx:_0x36e527}=_0x51c430,_0x3ed104=_0x5395ec[0x0]||_0x2a0e89[_0x209a71(0x1f8)];if(!_0x3ed104)return console[_0x209a71(0x1ea)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x209a71(0x1ea)](_0x209a71(0x1f5)),console[_0x209a71(0x1ea)](_0x209a71(0x1f3)),0x1;_0x2a0e89[_0x209a71(0x1fb)]&&(console[_0x209a71(0x1ea)]('Site:\x20'+_0x2a0e89[_0x209a71(0x1f7)]),console[_0x209a71(0x1ea)]('Parent\x20segment:\x20'+_0x3ed104));const _0x3f1145=await withSpinner(_0x209a71(0x1e9)+_0x3ed104+_0x209a71(0x1e4),()=>_0x36e527[_0x209a71(0x1fe)][_0x209a71(0x1e2)](_0x3ed104),{'verbose':_0x2a0e89[_0x209a71(0x1fb)]}),_0x494356=_0x3f1145[_0x209a71(0x1e6)];console[_0x209a71(0x1ea)](_0x209a71(0x1eb)+_0x494356[_0x209a71(0x1f4)]+_0x209a71(0x1ee)+(_0x494356[_0x209a71(0x1f4)]!==0x1?'s':''));if(_0x2a0e89[_0x209a71(0x1e5)]||_0x2a0e89[_0x209a71(0x1fa)])return await handleSDKOutput(_0x494356,_0x2a0e89),0x0;return displayFieldsHumanReadable(_0x494356,_0x3ed104),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a30_0x4873b0=a30_0x2b9c;(function(_0x5a83ba,_0x388401){const _0x11a1d8=a30_0x2b9c,_0xc68fcf=_0x5a83ba();while(!![]){try{const _0x10fcc3=parseInt(_0x11a1d8(0x138))/0x1+parseInt(_0x11a1d8(0x124))/0x2*(-parseInt(_0x11a1d8(0x11a))/0x3)+parseInt(_0x11a1d8(0x119))/0x4+parseInt(_0x11a1d8(0x113))/0x5+-parseInt(_0x11a1d8(0x10f))/0x6+-parseInt(_0x11a1d8(0xff))/0x7+parseInt(_0x11a1d8(0x10e))/0x8;if(_0x10fcc3===_0x388401)break;else _0xc68fcf['push'](_0xc68fcf['shift']());}catch(_0x3a4af8){_0xc68fcf['push'](_0xc68fcf['shift']());}}}(a30_0x1a51,0x5a201));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';function a30_0x1a51(){const _0x2191ba=['site','yellow','isNew','utf-8','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Pull\x20all\x20segments\x20from\x20parent','cyan','\x20files?','159212etLlqs','segment:pull','setPhase','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','parent_segment','helpText','\x20\x20Target:\x20','red','error','cwd','resourceName','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)','session','targetDir','length','\x20changed\x20files','type','\x0aPull\x20summary\x20for\x20\x27','yes','Error:\x20','507783PXEpDZ','Parent\x20segment:\x20','segments','files','-\x20no\x20files\x20written','Pulling\x20segments\x20from\x20\x27','no_parent','data','counts','filter','file','parentName','β\x20Context\x20set:\x20','\x20unchanged\x20files','\x27...','\x20\x20π―\x20','Target\x20resource:\x20','parentSegment','β\x20Pulled\x20','\x20files\x20to\x20','relativePath','segment','description','\x0aError:','957432xZtiQd','diff','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','\x20activations','\x20new\x20files','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20pull\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20segment\x20file','journeyVersions','Pull\x20child\x20segments\x20and\x20journeys\x20to\x20YAML\x20files','dim','Site:\x20','activations','\x20with\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','absolutePath','hasChanges','5053624XzMDbA','3442632UxnCuI','Aborted.','dirname','\x20\x20πΊοΈ\x20\x20','590945Isvhit','name','Write\x20','verbose','\x20segments','journeys','2153920YSrMWk','27hiMvLO','green','\x20=\x20'];a30_0x1a51=function(){return _0x2191ba;};return a30_0x1a51();}import{confirmKey,isInteractive}from'../utils/prompt.js';function a30_0x2b9c(_0x2ac0bb,_0x52bb37){_0x2ac0bb=_0x2ac0bb-0xf7;const _0x1a51d3=a30_0x1a51();let _0x2b9ce9=_0x1a51d3[_0x2ac0bb];return _0x2b9ce9;}import{saveSessionContext}from'../core/session.js';import a30_0x373e9c from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a30_0x41ebaa from'path';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';export{buildFolderIdToPathMap as buildFolderPathMap}from'../sdk/segment/resolution-context.js';export class SegmentPullCommand extends BaseCommand{[a30_0x4873b0(0x114)]=a30_0x4873b0(0x125);[a30_0x4873b0(0xfd)]=a30_0x4873b0(0x106);async['execute'](_0x26e6bf){const _0x275560=a30_0x4873b0,{options:_0x2b4b9d,args:_0x4c652c,tdx:_0xfd5d90}=_0x26e6bf,_0x1585b6=_0x2b4b9d,_0x1d2464=await resolveTarget({'arg':_0x4c652c[0x0],'contextParent':_0x2b4b9d[_0x275560(0xf8)],'cwd':process[_0x275560(0x12d)]()});if(!isSuccessfulResolution(_0x1d2464))return _0x1d2464['errorCode']===_0x275560(0x13e)?(console[_0x275560(0x12c)](a30_0x373e9c[_0x275560(0x11e)](_0x275560(0x10b))),console[_0x275560(0x12c)](_0x275560(0x12f)),console[_0x275560(0x12c)](_0x275560(0x121)),console[_0x275560(0x12c)](_0x275560(0x104))):(console[_0x275560(0x12c)](a30_0x373e9c[_0x275560(0x12b)](_0x275560(0x137)+_0x1d2464['message']+'\x0a')),_0x1d2464['helpText']&&console[_0x275560(0x12c)](a30_0x373e9c[_0x275560(0x122)](_0x1d2464[_0x275560(0x129)]))),0x1;const _0x3ceec2=_0x1d2464['parentName'],_0x49bd0e=_0x1d2464[_0x275560(0x131)],_0x236ece=_0x1d2464[_0x275560(0x134)]===_0x275560(0x142)?_0x1d2464[_0x275560(0x12e)]:undefined;_0x1585b6[_0x275560(0x116)]&&(console[_0x275560(0x12c)](_0x275560(0x108)+_0x1585b6[_0x275560(0x11d)]),console[_0x275560(0x12c)](_0x275560(0x139)+_0x3ceec2),_0x236ece&&console[_0x275560(0x12c)](_0x275560(0xf7)+_0x236ece));const _0x5226e2=await withProgressSpinner(_0x275560(0x13d)+_0x3ceec2+_0x275560(0x146),_0x5ba1ac=>_0xfd5d90[_0x275560(0xfc)]['pullSegments'](_0x3ceec2,{'targetDir':_0x49bd0e,'targetResourceName':_0x236ece,'verbose':_0x1585b6[_0x275560(0x116)],'progress':{'update':_0x146eff=>{const _0x501baf=_0x275560;_0x5ba1ac[_0x501baf(0x126)](_0x146eff),_0x1585b6[_0x501baf(0x116)]&&console[_0x501baf(0x12c)]('\x20\x20'+_0x146eff);}}}),{'verbose':_0x1585b6[_0x275560(0x116)]}),_0x53b408=_0x5226e2[_0x275560(0x13f)];if(_0x53b408[_0x275560(0x140)][_0x275560(0x13a)]===0x0&&_0x53b408['counts']['journeys']===0x0)return console[_0x275560(0x12c)](a30_0x373e9c[_0x275560(0x11e)]('No\x20segments\x20or\x20journeys\x20found\x20in\x20parent\x20segment\x20\x27'+_0x53b408[_0x275560(0x143)]+'\x27')),0x0;const _0x5128a4=_0x53b408['files'][_0x275560(0x141)](_0x19ee52=>_0x19ee52[_0x275560(0x11f)]),_0x54cd99=_0x53b408['files'][_0x275560(0x141)](_0xa4b4ef=>!_0xa4b4ef[_0x275560(0x11f)]&&_0xa4b4ef[_0x275560(0x10d)]),_0x5237de=_0x53b408['files'][_0x275560(0x141)](_0x262557=>!_0x262557[_0x275560(0x11f)]&&!_0x262557[_0x275560(0x10d)]);console[_0x275560(0x12c)](_0x275560(0x135)+_0x53b408[_0x275560(0x143)]+'\x27:'),console[_0x275560(0x12c)](_0x275560(0x147)+a30_0x373e9c['cyan'](_0x53b408[_0x275560(0x140)][_0x275560(0x13a)]+_0x275560(0x117))+_0x275560(0x10a)+a30_0x373e9c[_0x275560(0x122)](_0x53b408['counts'][_0x275560(0x109)]+_0x275560(0x102)));if(_0x53b408[_0x275560(0x140)]['journeys']>0x0){const _0x5c5fd5=_0x53b408['counts'][_0x275560(0x105)]>_0x53b408['counts']['journeys']?'\x20('+_0x53b408[_0x275560(0x140)][_0x275560(0x105)]+'\x20versions)':'';console[_0x275560(0x12c)](_0x275560(0x112)+a30_0x373e9c['cyan'](_0x53b408[_0x275560(0x140)][_0x275560(0x118)]+'\x20journeys')+a30_0x373e9c[_0x275560(0x107)](_0x5c5fd5));}console[_0x275560(0x12c)]('\x20\x20'+a30_0x373e9c[_0x275560(0x11b)]('+\x20'+_0x5128a4['length']+_0x275560(0x103))),console[_0x275560(0x12c)]('\x20\x20'+a30_0x373e9c[_0x275560(0x11e)]('~\x20'+_0x54cd99[_0x275560(0x132)]+_0x275560(0x133))),console['error']('\x20\x20'+a30_0x373e9c[_0x275560(0x107)]('=\x20'+_0x5237de[_0x275560(0x132)]+_0x275560(0x145))),console[_0x275560(0x12c)](_0x275560(0x12a)+a30_0x373e9c[_0x275560(0x122)](_0x53b408[_0x275560(0x131)])+'\x0a');if(_0x54cd99[_0x275560(0x132)]>0x0)for(const _0x3ce661 of _0x54cd99){console[_0x275560(0x12c)]('\x0aChanges\x20to\x20\x27'+_0x3ce661[_0x275560(0xfb)]+'\x27:'),console[_0x275560(0x12c)]('β'['repeat'](0x3c)),console[_0x275560(0x12c)](_0x3ce661[_0x275560(0x100)]),console['error']('β'['repeat'](0x3c));}if(_0x1585b6['dryRun'])return console[_0x275560(0x12c)](a30_0x373e9c[_0x275560(0x11e)](_0x275560(0x101))),0x0;if(_0x5128a4[_0x275560(0x132)]===0x0&&_0x54cd99[_0x275560(0x132)]===0x0)return console[_0x275560(0x12c)](a30_0x373e9c[_0x275560(0x11b)]('β\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x53b408['parentName']},_0x1585b6[_0x275560(0x130)]),console[_0x275560(0x12c)](a30_0x373e9c[_0x275560(0x11b)]('β\x20Context\x20set:\x20'+a30_0x373e9c['dim']('parent_segment')+'\x20=\x20'+a30_0x373e9c[_0x275560(0x122)](_0x53b408[_0x275560(0x143)]))),0x0;if(!_0x1585b6[_0x275560(0x136)]){if(!isInteractive())return console['error'](a30_0x373e9c[_0x275560(0x12b)](_0x275560(0xfe)),_0x275560(0x127)),console['error'](a30_0x373e9c[_0x275560(0x107)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x2e15d1=await confirmKey(_0x275560(0x115)+(_0x5128a4[_0x275560(0x132)]+_0x54cd99['length'])+_0x275560(0x123));if(!_0x2e15d1)return console[_0x275560(0x12c)](a30_0x373e9c['yellow'](_0x275560(0x110)),_0x275560(0x13c)),0x1;}for(const _0x15e35a of _0x53b408[_0x275560(0x13b)]){if(_0x15e35a[_0x275560(0x11f)]||_0x15e35a[_0x275560(0x10d)]){const _0x4932e5=a30_0x41ebaa[_0x275560(0x111)](_0x15e35a[_0x275560(0x10c)]);!existsSync(_0x4932e5)&&mkdirSync(_0x4932e5,{'recursive':!![]}),writeFileSync(_0x15e35a[_0x275560(0x10c)],_0x15e35a['content'],_0x275560(0x120));}}return console[_0x275560(0x12c)](a30_0x373e9c['green'](_0x275560(0xf9)+(_0x5128a4[_0x275560(0x132)]+_0x54cd99[_0x275560(0x132)])+_0x275560(0xfa)+_0x53b408[_0x275560(0x131)])),saveSessionContext({'parent_segment':_0x53b408[_0x275560(0x143)]},_0x1585b6[_0x275560(0x130)]),console[_0x275560(0x12c)](a30_0x373e9c['green'](_0x275560(0x144)+a30_0x373e9c[_0x275560(0x107)](_0x275560(0x128))+_0x275560(0x11c)+a30_0x373e9c[_0x275560(0x122)](_0x53b408[_0x275560(0x143)]))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a31_0x2f5efb=a31_0x15de;(function(_0x5f5807,_0x40964f){const _0x9f8e75=a31_0x15de,_0x15db8b=_0x5f5807();while(!![]){try{const _0x1f1adc=parseInt(_0x9f8e75(0x18d))/0x1+parseInt(_0x9f8e75(0x17a))/0x2*(-parseInt(_0x9f8e75(0x13a))/0x3)+parseInt(_0x9f8e75(0x12c))/0x4+-parseInt(_0x9f8e75(0x120))/0x5+-parseInt(_0x9f8e75(0x139))/0x6+-parseInt(_0x9f8e75(0x142))/0x7*(parseInt(_0x9f8e75(0x14d))/0x8)+-parseInt(_0x9f8e75(0x144))/0x9*(-parseInt(_0x9f8e75(0x17f))/0xa);if(_0x1f1adc===_0x40964f)break;else _0x15db8b['push'](_0x15db8b['shift']());}catch(_0xff407d){_0x15db8b['push'](_0x15db8b['shift']());}}}(a31_0xe6b4,0x6f1c2));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors}from'../utils/diff.js';function a31_0x15de(_0x32a7d0,_0x3055bb){_0x32a7d0=_0x32a7d0-0xf3;const _0xe6b417=a31_0xe6b4();let _0x15dee5=_0xe6b417[_0x32a7d0];return _0x15dee5;}import{confirmKey,isInteractive}from'../utils/prompt.js';import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a31_0x383748 from'chalk';import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';function a31_0xe6b4(){const _0x26faa8=['red','journeyId','β\x20All\x20journeys\x20are\x20up\x20to\x20date','deleted','New\x20segment:','length','repeat','folderId','cyan','listJourneysWithDetailsFromParentSegment','\x20\x20Journeys:\x20','dim','segmentFolderId','206270vMsxZe','created','endsWith','updated','Fetching\x20existing\x20segments...','30MOMlmR','blue','\x0aPush\x20summary\x20for\x20\x27','\x20\x20Segments:\x20','results','\x20\x20\x20\x20','createdAt','Delete\x20segment:','parentName','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','toUpdate','segment:push','set','journeysOnly','618523dEOXnC','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','\x20\x20πΊοΈ\x20\x20Journeys:','\x20changed','Fetching\x20connections\x20for\x20name\x20resolution...','Site:\x20','Push\x20','paused','new','no_parent','add','activations','unchanged','file','Delete\x20journey:','execute','targetDir','(Journey\x20will\x20be\x20deleted)','journey','segments','Fetching\x20users\x20for\x20email\x20resolution...','/app/ps/','isNew','listActivations','\x20updated','folders','getParent','journeyBundleId','versionNumber','Fetching\x20existing\x20folders...','Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)','nameToId','description','Aborted.','\x20folders\x20to\x20create','idToName','filter','error','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','Resolving\x20parent\x20segment\x20\x27','list','Fetching\x20existing\x20journeys...','push','relationships','connection','2612900cVRHmH','then','toDelete','nameToType','all','helpText','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','resolveParentId','\x20activations]','updatedAt','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','236032EAenAK','getOutputSchemaWithCache','\x20unchanged','message','\x20new','Error\x20parsing\x20YAML:\x20','toCreate','yamlConfig','journeys','getJourney','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','green','.yaml','3670542TlRxZS','9pXvHHj','join','yellow','get','\x20to\x20update','\x20to\x20create','\x0aError:','parentSegment','616AzfpgC','yes','5293359vfXIXi','Source\x20directory:\x20','Folders\x20to\x20create:','scopedFolderPath','data','map','name','cwd','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','49376Fyhrmk','buildUserMaps','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','\x0aβ\x20Push\x20complete','\x20to\x20delete','type','journeyBundleName','Changes\x20to\x20journey:','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent','/e/','user','\x20\x20π\x20Segments:','\x20changes?','\x20created','diff','delete','\x20deleted','Changes\x20to:','β\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','isScoped','Preparing\x20journeys...','site','verbose','attributes','changed','.yml','filePath','existingJourney','folderPath','segment','\x20\x20Source:\x20','Error:\x20'];a31_0xe6b4=function(){return _0x26faa8;};return a31_0xe6b4();}import{buildFolderMaps}from'../sdk/segment/resolution-context.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{[a31_0x2f5efb(0x14a)]=a31_0x2f5efb(0x18a);[a31_0x2f5efb(0x112)]=a31_0x2f5efb(0x12b);async[a31_0x2f5efb(0x101)](_0x275e38){const _0x2bba36=a31_0x2f5efb,{options:_0x21972b,args:_0x65b493,tdx:_0x1fcc41}=_0x275e38,_0x159481=_0x21972b,_0x3cf76a=await resolveTarget({'arg':_0x65b493[0x0],'contextParent':_0x21972b[_0x2bba36(0x141)],'cwd':process[_0x2bba36(0x14b)]()});if(!isSuccessfulResolution(_0x3cf76a))return _0x3cf76a['errorCode']===_0x2bba36(0xfb)?(console[_0x2bba36(0x117)](a31_0x383748[_0x2bba36(0x13c)](_0x2bba36(0x119))),console[_0x2bba36(0x117)](_0x2bba36(0x110)),console[_0x2bba36(0x117)](_0x2bba36(0x155)),console[_0x2bba36(0x117)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file')):(console['error'](a31_0x383748[_0x2bba36(0x16d)](_0x2bba36(0x16c)+_0x3cf76a['message']+'\x0a')),_0x3cf76a[_0x2bba36(0x125)]&&console[_0x2bba36(0x117)](a31_0x383748[_0x2bba36(0x175)](_0x3cf76a[_0x2bba36(0x125)]))),0x1;if(_0x3cf76a['type']==='parent_name')return console[_0x2bba36(0x117)](a31_0x383748[_0x2bba36(0x16d)]('Error:\x20Directory\x20not\x20found:\x20'+_0x3cf76a[_0x2bba36(0x102)]+'\x0a')),console[_0x2bba36(0x117)](a31_0x383748['cyan'](_0x2bba36(0xf3))),0x1;const _0x46c453=_0x3cf76a[_0x2bba36(0x187)],_0x221bde=_0x3cf76a[_0x2bba36(0x102)],_0x3b6de0=_0x3cf76a[_0x2bba36(0x152)]===_0x2bba36(0xff)?_0x3cf76a[_0x2bba36(0x167)]:undefined,_0x2788d6=getScopedDetails(_0x3cf76a),_0x5d9828=_0x2788d6?.[_0x2bba36(0x160)]??![],_0x411746=_0x2788d6?.[_0x2bba36(0x147)]??'';if(!existsSync(_0x221bde))return console[_0x2bba36(0x117)](a31_0x383748[_0x2bba36(0x16d)]('Error:\x20Directory\x20not\x20found:\x20'+_0x221bde+'\x0a')),console[_0x2bba36(0x117)](a31_0x383748[_0x2bba36(0x175)]('Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;_0x159481['verbose']&&(console['error'](_0x2bba36(0xf7)+_0x159481[_0x2bba36(0x162)]),console['error']('Parent\x20segment:\x20'+_0x46c453),console[_0x2bba36(0x117)](_0x2bba36(0x145)+_0x221bde),_0x5d9828&&console[_0x2bba36(0x117)]('Scoped\x20to\x20folder:\x20'+_0x411746));const _0x23006e=await withSpinner(_0x2bba36(0x11a)+_0x46c453+'\x27...',()=>_0x1fcc41[_0x2bba36(0x16a)][_0x2bba36(0x127)](_0x46c453),{'verbose':_0x159481[_0x2bba36(0x163)]}),_0x58ed2b=_0x23006e['data'],[_0xff4469,_0x4c91eb,_0x547f2f,_0x94a344,_0x520e1b]=await Promise[_0x2bba36(0x124)]([withSpinner('Fetching\x20parent\x20segment\x20details...',()=>_0x1fcc41[_0x2bba36(0x16a)][_0x2bba36(0x10c)](_0x58ed2b),{'verbose':_0x159481[_0x2bba36(0x163)]}),withSpinner(_0x2bba36(0x17e),()=>_0x1fcc41['segment']['listSegments'](_0x58ed2b),{'verbose':_0x159481[_0x2bba36(0x163)]}),withSpinner(_0x2bba36(0x10f),()=>_0x1fcc41[_0x2bba36(0x16a)]['listFolders'](_0x58ed2b),{'verbose':_0x159481[_0x2bba36(0x163)]}),withSpinner(_0x2bba36(0x11c),()=>_0x1fcc41[_0x2bba36(0x104)][_0x2bba36(0x176)](_0x58ed2b,{'includeAllVersions':!![]}),{'verbose':_0x159481[_0x2bba36(0x163)]}),withSpinner(_0x2bba36(0x106),()=>_0x1fcc41[_0x2bba36(0x157)][_0x2bba36(0x14e)](),{'verbose':_0x159481[_0x2bba36(0x163)]})[_0x2bba36(0x121)](_0x1341a1=>_0x1341a1['data'])]),_0xc2f434=_0xff4469[_0x2bba36(0x148)],_0x2688fd=extractRootFolderId(_0xc2f434),_0x4c14e0=_0x4c91eb[_0x2bba36(0x148)],_0x367009=_0x547f2f[_0x2bba36(0x148)],{journeys:_0x21360a,activationStepsById:_0x265d6b}=_0x94a344['data'],_0xa73dd4=new Map(_0x21360a[_0x2bba36(0x149)](_0x21d67c=>[_0x21d67c['id'],_0x21d67c])),_0x3725fa=_0x21360a[_0x2bba36(0x149)](_0x344fb3=>({'id':_0x344fb3['id'],'name':_0x344fb3[_0x2bba36(0x164)]['name'],'journeyBundleName':_0x344fb3['attributes'][_0x2bba36(0x153)]||'','journeyBundleId':_0x344fb3[_0x2bba36(0x164)][_0x2bba36(0x10d)]||'','versionNumber':_0x344fb3[_0x2bba36(0x164)][_0x2bba36(0x10e)],'description':_0x344fb3['attributes'][_0x2bba36(0x112)],'state':_0x344fb3[_0x2bba36(0x164)]['state'],'paused':_0x344fb3[_0x2bba36(0x164)][_0x2bba36(0xf9)],'audienceId':_0x344fb3[_0x2bba36(0x164)]['audienceId'],'folderId':_0x344fb3[_0x2bba36(0x11e)]?.['parentFolder']?.[_0x2bba36(0x148)]?.['id'],'createdAt':_0x344fb3[_0x2bba36(0x164)][_0x2bba36(0x185)],'updatedAt':_0x344fb3['attributes'][_0x2bba36(0x129)]})),{emailToId:_0x3500a2,idToEmail:_0x2d418c}=_0x520e1b,_0x99a77d=await withSpinner(_0x2bba36(0xf6),async()=>{const _0x42fe77=_0x2bba36,_0x37ff66=await _0x1fcc41[_0x42fe77(0x11f)][_0x42fe77(0x11b)]();return buildConnectionMaps(_0x37ff66);},{'verbose':_0x159481[_0x2bba36(0x163)]})[_0x2bba36(0x121)](_0x2cb90f=>_0x2cb90f[_0x2bba36(0x148)]),_0x4896ff=_0x99a77d[_0x2bba36(0x111)],_0x857ea0=_0x99a77d[_0x2bba36(0x115)],_0x48131c=_0x99a77d[_0x2bba36(0x123)],_0x276f8c={'emailToIdMap':_0x3500a2,'connectionNameToIdMap':_0x4896ff,'connectionNameToTypeMap':_0x48131c,'getSchema':_0x3c4487=>_0x1fcc41[_0x2bba36(0x11f)][_0x2bba36(0x12d)](_0x3c4487)};let {pathToId:_0x4f975a,idToPath:_0x18648f}=buildFolderMaps(_0x367009);const _0x2dc534=buildSegmentLookupMap(_0x4c14e0,_0x18648f),_0x5be75d=buildSegmentNameToIdMap(_0x4c14e0),_0x202453=buildJourneyBundleLookupMap(_0x3725fa,_0x18648f);let _0x32e8fc;if(_0x3b6de0){if(!_0x3b6de0['endsWith'](_0x2bba36(0x166))&&!_0x3b6de0[_0x2bba36(0x17c)](_0x2bba36(0x138)))return console['error'](a31_0x383748[_0x2bba36(0x16d)](_0x2bba36(0x14c)+_0x3b6de0+'\x0a')),0x1;_0x32e8fc=[_0x3b6de0];}else _0x32e8fc=findYamlFiles(_0x221bde);if(_0x32e8fc[_0x2bba36(0x172)]===0x0)return console[_0x2bba36(0x117)](a31_0x383748[_0x2bba36(0x16d)](_0x2bba36(0x136)+_0x221bde+'\x0a')),console[_0x2bba36(0x117)](a31_0x383748[_0x2bba36(0x175)](_0x2bba36(0x188))),0x1;let _0x3ea57f,_0x3ff176;try{const _0x106f1a=parseAndClassifyYamlFiles(_0x32e8fc,_0x221bde,{'skipSegments':_0x159481['journeysOnly']});_0x3ea57f=_0x106f1a[_0x2bba36(0x105)],_0x3ff176=_0x106f1a['journeys'];const _0x55ed18=validateParsedFiles(_0x106f1a,_0x221bde);if(_0x55ed18['length']>0x0)return console[_0x2bba36(0x117)](a31_0x383748[_0x2bba36(0x16d)]('\x0aValidation\x20failed:')),console['error'](formatValidationErrors(_0x55ed18)),console[_0x2bba36(0x117)](a31_0x383748['yellow']('\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.')),0x1;}catch(_0x30f0a2){return console[_0x2bba36(0x117)](a31_0x383748[_0x2bba36(0x16d)](_0x2bba36(0x131)+(_0x30f0a2 instanceof Error?_0x30f0a2[_0x2bba36(0x12f)]:_0x30f0a2))),0x1;}if(_0x3ea57f[_0x2bba36(0x172)]===0x0&&_0x3ff176[_0x2bba36(0x172)]===0x0){const _0x5c0590=_0x159481[_0x2bba36(0x18c)]?'journey':'segment\x20or\x20journey';return console['error'](a31_0x383748[_0x2bba36(0x13c)]('No\x20'+_0x5c0590+'\x20YAML\x20files\x20found')),0x0;}const _0x4f17d2=new Map();_0x4c14e0[_0x2bba36(0x172)]>0x0&&!_0x159481[_0x2bba36(0x18c)]&&await withSpinner('Fetching\x20existing\x20activations...',async()=>{await batchAsync(_0x4c14e0,async _0x26211d=>{const _0x1cffbf=a31_0x15de,_0x1ed397=await _0x1fcc41[_0x1cffbf(0x16a)][_0x1cffbf(0x109)](_0x58ed2b,_0x26211d['id']);_0x4f17d2['set'](_0x26211d['id'],_0x1ed397);});},{'verbose':_0x159481[_0x2bba36(0x163)]});const {segmentFiles:_0x326245,foldersToCreate:_0x4ca7a4}=await prepareSegmentFiles(_0x3ea57f,{'segmentByFolderAndName':_0x2dc534,'activationsBySegmentId':_0x4f17d2,'folderPathToId':_0x4f975a,'idToEmailMap':_0x2d418c,'connectionIdToNameMap':_0x857ea0},_0x276f8c,_0x5d9828,_0x411746),_0x1b8062=_0x3b6de0?[]:findSegmentsToDelete(_0x4c14e0,_0x3ea57f[_0x2bba36(0x149)](({yamlConfig:_0x4c502,folderPath:_0xd4f445})=>({'yamlConfig':_0x4c502,'folderPath':resolveTDFolderPath(_0xd4f445,_0x5d9828,_0x411746)})),_0x18648f,_0x411746,_0x5d9828),{journeyFiles:_0x252cc9,foldersToCreate:_0xa39637}=await withProgressSpinner(_0x2bba36(0x161),async _0x20488b=>prepareJourneyFiles(_0x3ff176,{'fetchJourney':async _0x147c82=>_0x1fcc41['journey'][_0x2bba36(0x135)](_0x147c82[_0x2bba36(0x16e)]),'journeyBundlesByFolderAndName':_0x202453,'folderPathToId':_0x4f975a,'idToEmailMap':_0x2d418c,'connectionIdToNameMap':_0x857ea0,'existingSegments':_0x4c14e0,'parentId':_0x58ed2b,'deps':_0x1fcc41,'progress':{'update':_0x4b9da5=>{const _0x6175ce=_0x2bba36;_0x20488b['setPhase'](_0x4b9da5),_0x159481[_0x6175ce(0x163)]&&console[_0x6175ce(0x117)]('\x20\x20'+_0x4b9da5);}},'journeyById':_0xa73dd4,'activationStepsById':_0x265d6b},_0x5d9828,_0x411746),{'verbose':_0x159481['verbose']})[_0x2bba36(0x121)](_0xec43d2=>_0xec43d2[_0x2bba36(0x148)]);for(const _0x51820e of _0xa39637){_0x4ca7a4[_0x2bba36(0xfc)](_0x51820e);}const _0x2c46a6=_0x3b6de0?[]:findJourneysToDelete(_0x3725fa,_0x3ff176[_0x2bba36(0x149)](({yamlConfig:_0x591405,folderPath:_0x539a39})=>({'yamlConfig':_0x591405,'folderPath':resolveTDFolderPath(_0x539a39,_0x5d9828,_0x411746)})),_0x18648f,_0x411746,_0x5d9828),_0x4044fa=calculatePushStats(_0x326245,_0x252cc9,_0x4ca7a4,_0x1b8062,_0x2c46a6,!!_0x159481['delete'],!!_0x159481['journeysOnly']),_0x5575c5=_0x4044fa[_0x2bba36(0x105)][_0x2bba36(0xfa)],_0x5351ab=_0x4044fa[_0x2bba36(0x105)][_0x2bba36(0x165)],_0x328df9=_0x4044fa[_0x2bba36(0x105)][_0x2bba36(0xfe)],_0x30299d=_0x4044fa['segments'][_0x2bba36(0x122)],_0x343a19=_0x4044fa[_0x2bba36(0x10b)][_0x2bba36(0x132)],_0x255654=_0x4044fa[_0x2bba36(0x134)]['new'],_0x1347fe=_0x4044fa[_0x2bba36(0x134)][_0x2bba36(0x165)],_0x46743b=_0x4044fa[_0x2bba36(0x134)][_0x2bba36(0xfe)],_0x2226fc=_0x4044fa[_0x2bba36(0x134)][_0x2bba36(0x122)],_0x2cbdd9=_0x4044fa[_0x2bba36(0xfd)][_0x2bba36(0x124)],_0x4fbccb=_0x4044fa['activations'][_0x2bba36(0x132)],_0xf586de=_0x4044fa[_0x2bba36(0xfd)][_0x2bba36(0x189)],_0x3609c0=_0x4044fa['activations']['toDelete'];console[_0x2bba36(0x117)](_0x2bba36(0x181)+_0x46c453+'\x27:');_0x343a19[_0x2bba36(0x172)]>0x0&&console[_0x2bba36(0x117)]('\x20\x20'+a31_0x383748[_0x2bba36(0x180)]('π\x20'+_0x343a19[_0x2bba36(0x172)]+_0x2bba36(0x114)));if(!_0x159481[_0x2bba36(0x18c)]){console[_0x2bba36(0x117)](_0x2bba36(0x158)),console['error'](_0x2bba36(0x184)+a31_0x383748[_0x2bba36(0x137)]('+\x20'+_0x5575c5[_0x2bba36(0x172)]+_0x2bba36(0x130))),console[_0x2bba36(0x117)](_0x2bba36(0x184)+a31_0x383748[_0x2bba36(0x13c)]('~\x20'+_0x5351ab[_0x2bba36(0x172)]+_0x2bba36(0xf5)));if(_0x30299d[_0x2bba36(0x172)]>0x0)console['error'](_0x2bba36(0x184)+a31_0x383748['red']('-\x20'+_0x30299d[_0x2bba36(0x172)]+_0x2bba36(0x151)));else _0x1b8062[_0x2bba36(0x172)]>0x0&&!_0x159481[_0x2bba36(0x15c)]&&console[_0x2bba36(0x117)](_0x2bba36(0x184)+a31_0x383748[_0x2bba36(0x178)](_0x1b8062['length']+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x2bba36(0x117)](_0x2bba36(0x184)+a31_0x383748[_0x2bba36(0x178)]('=\x20'+_0x328df9[_0x2bba36(0x172)]+_0x2bba36(0x12e)));}if(_0x252cc9['length']>0x0||_0x2c46a6['length']>0x0){console[_0x2bba36(0x117)](_0x2bba36(0xf4)),console['error']('\x20\x20\x20\x20'+a31_0x383748['green']('+\x20'+_0x255654['length']+_0x2bba36(0x130))),console[_0x2bba36(0x117)]('\x20\x20\x20\x20'+a31_0x383748[_0x2bba36(0x13c)]('~\x20'+_0x1347fe[_0x2bba36(0x172)]+_0x2bba36(0xf5)));if(_0x2226fc[_0x2bba36(0x172)]>0x0)console[_0x2bba36(0x117)](_0x2bba36(0x184)+a31_0x383748[_0x2bba36(0x16d)]('-\x20'+_0x2226fc['length']+_0x2bba36(0x151)));else _0x2c46a6[_0x2bba36(0x172)]>0x0&&!_0x159481[_0x2bba36(0x15c)]&&console[_0x2bba36(0x117)](_0x2bba36(0x184)+a31_0x383748['dim'](_0x2c46a6[_0x2bba36(0x172)]+_0x2bba36(0x14f)));console[_0x2bba36(0x117)](_0x2bba36(0x184)+a31_0x383748[_0x2bba36(0x178)]('=\x20'+_0x46743b[_0x2bba36(0x172)]+_0x2bba36(0x12e)));}_0x2cbdd9['length']>0x0&&!_0x159481[_0x2bba36(0x18c)]&&(console[_0x2bba36(0x117)](''),console['error']('\x20\x20Activations:'),_0x4fbccb['length']>0x0&&console['error'](_0x2bba36(0x184)+a31_0x383748['green']('+\x20'+_0x4fbccb[_0x2bba36(0x172)]+_0x2bba36(0x13f))),_0xf586de['length']>0x0&&console[_0x2bba36(0x117)]('\x20\x20\x20\x20'+a31_0x383748[_0x2bba36(0x13c)]('~\x20'+_0xf586de[_0x2bba36(0x172)]+_0x2bba36(0x13e))),_0x3609c0[_0x2bba36(0x172)]>0x0&&console[_0x2bba36(0x117)]('\x20\x20\x20\x20'+a31_0x383748[_0x2bba36(0x16d)]('-\x20'+_0x3609c0[_0x2bba36(0x172)]+_0x2bba36(0x151))));console['error'](_0x2bba36(0x16b)+a31_0x383748[_0x2bba36(0x175)](_0x221bde)+'\x0a');if(_0x343a19[_0x2bba36(0x172)]>0x0){console[_0x2bba36(0x117)](_0x2bba36(0x146));for(const _0x2f428a of _0x343a19){console[_0x2bba36(0x117)]('\x20\x20'+a31_0x383748[_0x2bba36(0x180)]('+')+'\x20'+_0x2f428a);}console[_0x2bba36(0x117)]('');}if(_0x5575c5['length']>0x0&&!_0x159481[_0x2bba36(0x18c)])for(const _0x5a2626 of _0x5575c5){const _0x41427e=_0x5a2626[_0x2bba36(0x169)]?_0x5a2626[_0x2bba36(0x169)]+'/'+_0x5a2626['yamlConfig'][_0x2bba36(0x14a)]:_0x5a2626['yamlConfig']['name'],_0x408b66=_0x5a2626[_0x2bba36(0x133)][_0x2bba36(0xfd)]?.[_0x2bba36(0x172)]||0x0,_0xb896d4=_0x408b66>0x0?a31_0x383748[_0x2bba36(0x178)]('\x20['+_0x408b66+_0x2bba36(0x128)):'';console['error']('\x0a'+a31_0x383748[_0x2bba36(0x137)](_0x2bba36(0x171))+'\x20'+_0x41427e+_0xb896d4),console['error']('β'[_0x2bba36(0x173)](0x3c)),_0x5a2626[_0x2bba36(0x15b)]&&console[_0x2bba36(0x117)](_0x5a2626['diff']),console['error']('β'['repeat'](0x3c));}if(_0x30299d[_0x2bba36(0x172)]>0x0&&!_0x159481[_0x2bba36(0x18c)])for(const _0xf42a2c of _0x30299d){const _0x5db07d=_0xf42a2c[_0x2bba36(0x179)]?_0x18648f[_0x2bba36(0x13d)](_0xf42a2c[_0x2bba36(0x179)]['toString']())||'':'',_0x264556=_0x5db07d?_0x5db07d+'/'+_0xf42a2c[_0x2bba36(0x14a)]:_0xf42a2c[_0x2bba36(0x14a)],_0x5449d6=_0x4f17d2[_0x2bba36(0x13d)](_0xf42a2c['id'])||[],_0x59a471=_0x5449d6[_0x2bba36(0x172)]>0x0?a31_0x383748[_0x2bba36(0x178)]('\x20['+_0x5449d6[_0x2bba36(0x172)]+_0x2bba36(0x128)):'';console[_0x2bba36(0x117)]('\x0a'+a31_0x383748[_0x2bba36(0x16d)](_0x2bba36(0x186))+'\x20'+_0x264556+_0x59a471),console[_0x2bba36(0x117)]('β'[_0x2bba36(0x173)](0x3c));const _0x596a02=segmentWithActivationsToYaml(_0xf42a2c,_0x5449d6,undefined,_0x2d418c,_0x857ea0),_0x1957dc=segmentToYamlString(_0x596a02),_0x1ac7f8=generateDiff(_0x1957dc,'');console[_0x2bba36(0x117)](formatDiffWithColors(_0x1ac7f8)),console[_0x2bba36(0x117)]('β'[_0x2bba36(0x173)](0x3c));}const _0x258b2a=_0x326245[_0x2bba36(0x116)](_0x462768=>!_0x462768['isNew']&&_0x462768[_0x2bba36(0x15b)]);if(_0x258b2a[_0x2bba36(0x172)]>0x0&&!_0x159481[_0x2bba36(0x18c)])for(const _0x260302 of _0x258b2a){const _0x175966=_0x260302[_0x2bba36(0x169)]?_0x260302[_0x2bba36(0x169)]+'/'+_0x260302[_0x2bba36(0x133)][_0x2bba36(0x14a)]:_0x260302[_0x2bba36(0x133)]['name'];console[_0x2bba36(0x117)]('\x0a'+a31_0x383748[_0x2bba36(0x13c)](_0x2bba36(0x15e))+'\x20'+_0x175966),console['error']('β'[_0x2bba36(0x173)](0x3c)),console[_0x2bba36(0x117)](_0x260302[_0x2bba36(0x15b)]),console[_0x2bba36(0x117)]('β'[_0x2bba36(0x173)](0x3c));}if(_0x255654['length']>0x0)for(const _0x54117b of _0x255654){const _0x4ea83e=_0x54117b[_0x2bba36(0x169)]?_0x54117b[_0x2bba36(0x169)]+'/'+_0x54117b[_0x2bba36(0x133)]['name']:_0x54117b['yamlConfig'][_0x2bba36(0x14a)];console[_0x2bba36(0x117)]('\x0a'+a31_0x383748[_0x2bba36(0x137)]('New\x20journey:')+'\x20'+_0x4ea83e),console[_0x2bba36(0x117)]('β'[_0x2bba36(0x173)](0x3c)),_0x54117b[_0x2bba36(0x15b)]&&console[_0x2bba36(0x117)](_0x54117b[_0x2bba36(0x15b)]),console[_0x2bba36(0x117)]('β'['repeat'](0x3c));}const _0x503455=_0x252cc9[_0x2bba36(0x116)](_0x52ff8b=>!_0x52ff8b[_0x2bba36(0x108)]&&_0x52ff8b[_0x2bba36(0x15b)]);if(_0x503455['length']>0x0)for(const _0x51dea2 of _0x503455){const _0x501d38=_0x51dea2[_0x2bba36(0x169)]?_0x51dea2[_0x2bba36(0x169)]+'/'+_0x51dea2[_0x2bba36(0x133)][_0x2bba36(0x14a)]:_0x51dea2['yamlConfig']['name'];console[_0x2bba36(0x117)]('\x0a'+a31_0x383748[_0x2bba36(0x13c)](_0x2bba36(0x154))+'\x20'+_0x501d38),console[_0x2bba36(0x117)]('β'[_0x2bba36(0x173)](0x3c)),console[_0x2bba36(0x117)](_0x51dea2[_0x2bba36(0x15b)]),console['error']('β'[_0x2bba36(0x173)](0x3c));}if(_0x2226fc[_0x2bba36(0x172)]>0x0)for(const _0x316c62 of _0x2226fc){const _0x15f9c2=_0x316c62[_0x2bba36(0x174)]?_0x18648f['get'](_0x316c62[_0x2bba36(0x174)])||'':'',_0x4a7fa6=_0x15f9c2?_0x15f9c2+'/'+_0x316c62[_0x2bba36(0x153)]:_0x316c62[_0x2bba36(0x153)];console['error']('\x0a'+a31_0x383748['red'](_0x2bba36(0x100))+'\x20'+_0x4a7fa6),console[_0x2bba36(0x117)]('β'[_0x2bba36(0x173)](0x3c)),console[_0x2bba36(0x117)](a31_0x383748['red'](_0x2bba36(0x103))),console['error']('β'[_0x2bba36(0x173)](0x3c));}if(_0x159481['dryRun'])return console['error'](a31_0x383748[_0x2bba36(0x13c)](_0x2bba36(0x118))),0x0;const _0xa9bc26=_0x159481['journeysOnly']?![]:_0x5575c5[_0x2bba36(0x172)]>0x0||_0x5351ab[_0x2bba36(0x172)]>0x0||_0x30299d['length']>0x0,_0x1a1ddd=_0x255654[_0x2bba36(0x172)]>0x0||_0x1347fe[_0x2bba36(0x172)]>0x0||_0x2226fc['length']>0x0,_0x4511cb=_0x159481[_0x2bba36(0x18c)]?![]:_0x2cbdd9[_0x2bba36(0x172)]>0x0,_0x2d3b15=_0x343a19[_0x2bba36(0x172)]>0x0;if(!_0xa9bc26&&!_0x1a1ddd&&!_0x4511cb&&!_0x2d3b15){const _0x424ec4=_0x159481[_0x2bba36(0x18c)]?_0x2bba36(0x16f):_0x2bba36(0x15f);console[_0x2bba36(0x117)](a31_0x383748[_0x2bba36(0x137)](_0x424ec4));if(_0x3b6de0&&_0x46743b[_0x2bba36(0x172)]===0x1){const _0x493b3e=_0x46743b[0x0];if(_0x493b3e[_0x2bba36(0x168)]?.['id']){const _0x15d3ae=getConsoleNextUrl(_0x159481[_0x2bba36(0x162)],_0x2bba36(0x107)+_0x58ed2b+_0x2bba36(0x156)+_0x493b3e['existingJourney']['id']+'/j/da/je');console[_0x2bba36(0x117)]('\x20\x20'+a31_0x383748['cyan'](_0x15d3ae));}}return 0x0;}const _0x4f66e2=_0x159481['journeysOnly']?_0x255654[_0x2bba36(0x172)]+_0x1347fe['length']+_0x2226fc[_0x2bba36(0x172)]+_0x343a19['length']:_0x5575c5[_0x2bba36(0x172)]+_0x5351ab[_0x2bba36(0x172)]+_0x30299d[_0x2bba36(0x172)]+_0x255654[_0x2bba36(0x172)]+_0x1347fe[_0x2bba36(0x172)]+_0x2226fc[_0x2bba36(0x172)]+_0x343a19[_0x2bba36(0x172)]+_0x2cbdd9['length'];if(!_0x159481[_0x2bba36(0x143)]&&_0x4f66e2>0x0){if(!isInteractive())return console['error'](a31_0x383748[_0x2bba36(0x16d)](_0x2bba36(0x140)),_0x2bba36(0x12a)),console['error'](a31_0x383748[_0x2bba36(0x178)](_0x2bba36(0x126))),0x1;const _0x3f95f3=await confirmKey(_0x2bba36(0xf8)+_0x4f66e2+_0x2bba36(0x159));if(!_0x3f95f3)return console[_0x2bba36(0x117)](a31_0x383748[_0x2bba36(0x13c)](_0x2bba36(0x113))),0x1;}const _0x321c2f={'withProgress':async(_0x14c586,_0x4f03b2)=>{const _0xdddd44=_0x2bba36,_0x1bc7a7=await withSpinner(_0x14c586,_0x4f03b2,{'verbose':_0x159481[_0xdddd44(0x163)]});return{'data':_0x1bc7a7[_0xdddd44(0x148)]};},'logInfo':_0x36d087=>console[_0x2bba36(0x117)](a31_0x383748[_0x2bba36(0x180)]('β\x20'+_0x36d087)),'logSuccess':_0xbcace0=>console['error'](a31_0x383748['green']('β\x20'+_0xbcace0)),'logWarning':_0x1b1525=>console[_0x2bba36(0x117)](a31_0x383748[_0x2bba36(0x13c)]('β \x20'+_0x1b1525)),'logDeleted':_0x23291c=>console[_0x2bba36(0x117)](a31_0x383748[_0x2bba36(0x16d)]('β\x20'+_0x23291c))},_0x1cf368={'segment':_0x1fcc41[_0x2bba36(0x16a)],'journey':_0x1fcc41[_0x2bba36(0x104)],'user':_0x1fcc41[_0x2bba36(0x157)],'connection':_0x1fcc41[_0x2bba36(0x11f)]};_0x343a19[_0x2bba36(0x172)]>0x0&&(_0x4f975a=await executePushFolders(_0x1cf368,_0x343a19,_0x4f975a,{'parentId':_0x58ed2b},_0x321c2f));const _0x4b282c={'rootFolderId':_0x2688fd,'folderPathToId':_0x4f975a,'folderIdToPath':_0x18648f,'segmentNameToId':_0x5be75d,'activationsBySegmentId':_0x4f17d2,'emailToIdMap':_0x3500a2,'idToEmailMap':_0x2d418c,'connectionNameToIdMap':_0x99a77d['nameToId'],'connectionIdToNameMap':_0x99a77d[_0x2bba36(0x115)],'connectionNameToTypeMap':_0x48131c},_0x53128a=await executePushSegments(_0x1cf368,_0x159481[_0x2bba36(0x18c)]?[]:_0x326245,_0x4b282c,{'parentId':_0x58ed2b},_0x321c2f),_0x143e4c=_0x53128a[_0x2bba36(0x17b)],_0x52d26a=_0x53128a[_0x2bba36(0x17d)],_0x5d64d4=_0x53128a['activations'][_0x2bba36(0x17b)],_0x4f1891=_0x53128a[_0x2bba36(0xfd)][_0x2bba36(0x17d)],_0x1a7975=_0x53128a['activations'][_0x2bba36(0x170)],_0x2af896=await executePushSegmentDeletions(_0x1cf368,_0x159481[_0x2bba36(0x18c)]?[]:_0x30299d,_0x321c2f);let _0x31816b=0x0,_0x119d8b=0x0,_0x149801=0x0;const _0x2c97fa=new Map(_0x5be75d);for(const [_0x2b2582,_0x41b457]of _0x53128a['createdSegmentIds']){_0x2c97fa[_0x2bba36(0x18b)](_0x2b2582,_0x41b457);}if(_0x252cc9[_0x2bba36(0x172)]>0x0){const _0x54ddc6={..._0x4b282c,'segmentNameToId':_0x2c97fa,'existingSegments':_0x4c14e0,'activationContext':_0x276f8c},_0x3aa201=await executePushJourneys(_0x1cf368,_0x252cc9,_0x54ddc6,{'parentId':_0x58ed2b,'rootFolderId':_0x2688fd,'verbose':_0x159481[_0x2bba36(0x163)]},_0x321c2f);_0x31816b=_0x3aa201[_0x2bba36(0x17b)],_0x119d8b=_0x3aa201[_0x2bba36(0x17d)];if(_0x3b6de0&&_0x3aa201[_0x2bba36(0x183)]['length']===0x1){const _0x11b64e=_0x3aa201['results'][0x0];if(_0x11b64e[_0x2bba36(0x16e)]){const _0x31cb14=getConsoleNextUrl(_0x159481['site'],_0x2bba36(0x107)+_0x58ed2b+_0x2bba36(0x156)+_0x11b64e[_0x2bba36(0x16e)]+'/j/da/je');console[_0x2bba36(0x117)]('\x20\x20'+a31_0x383748[_0x2bba36(0x175)](_0x31cb14));}}}for(const _0x49cfc8 of _0x2226fc){console[_0x2bba36(0x117)](a31_0x383748['yellow']('β \x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20'+_0x49cfc8['journeyBundleName'])),_0x149801++;}const _0x1d2098=[];if(_0x143e4c>0x0)_0x1d2098['push'](_0x143e4c+_0x2bba36(0x15a));if(_0x52d26a>0x0)_0x1d2098[_0x2bba36(0x11d)](_0x52d26a+'\x20updated');if(_0x2af896>0x0)_0x1d2098[_0x2bba36(0x11d)](_0x2af896+'\x20deleted');const _0x5bff54=[];if(_0x31816b>0x0)_0x5bff54[_0x2bba36(0x11d)](_0x31816b+_0x2bba36(0x15a));if(_0x119d8b>0x0)_0x5bff54[_0x2bba36(0x11d)](_0x119d8b+_0x2bba36(0x10a));if(_0x149801>0x0)_0x5bff54[_0x2bba36(0x11d)](_0x149801+'\x20deleted');const _0x2d1fe5=[];if(_0x5d64d4>0x0)_0x2d1fe5[_0x2bba36(0x11d)](_0x5d64d4+_0x2bba36(0x15a));if(_0x4f1891>0x0)_0x2d1fe5['push'](_0x4f1891+_0x2bba36(0x10a));if(_0x1a7975>0x0)_0x2d1fe5['push'](_0x1a7975+_0x2bba36(0x15d));return console[_0x2bba36(0x117)](a31_0x383748['green'](_0x2bba36(0x150))),_0x1d2098[_0x2bba36(0x172)]>0x0&&!_0x159481['journeysOnly']&&console['error'](_0x2bba36(0x182)+_0x1d2098['join'](',\x20')),_0x5bff54[_0x2bba36(0x172)]>0x0&&console['error'](_0x2bba36(0x177)+_0x5bff54[_0x2bba36(0x13b)](',\x20')),_0x2d1fe5[_0x2bba36(0x172)]>0x0&&!_0x159481['journeysOnly']&&console[_0x2bba36(0x117)]('\x20\x20Activations:\x20'+_0x2d1fe5[_0x2bba36(0x13b)](',\x20')),0x0;}}
|
|
1
|
+
const a31_0x897ea5=a31_0x489c;(function(_0x340a84,_0x39deda){const _0x26e03b=a31_0x489c,_0x5e44af=_0x340a84();while(!![]){try{const _0xcba1ec=parseInt(_0x26e03b(0x143))/0x1*(-parseInt(_0x26e03b(0x156))/0x2)+-parseInt(_0x26e03b(0x17a))/0x3*(-parseInt(_0x26e03b(0x13a))/0x4)+parseInt(_0x26e03b(0x125))/0x5+-parseInt(_0x26e03b(0x175))/0x6+parseInt(_0x26e03b(0x1a8))/0x7+parseInt(_0x26e03b(0x120))/0x8+-parseInt(_0x26e03b(0x168))/0x9;if(_0xcba1ec===_0x39deda)break;else _0x5e44af['push'](_0x5e44af['shift']());}catch(_0x224223){_0x5e44af['push'](_0x5e44af['shift']());}}}(a31_0x9554,0x576b4));import{BaseCommand}from'./command.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{generateDiff,formatDiffWithColors}from'../utils/diff.js';import{confirmKey,isInteractive}from'../utils/prompt.js';function a31_0x9554(){const _0x15b5f1=['journeysOnly','getOutputSchemaWithCache','blue','length','316581adTcwz','get','journeyId','push','all','execute','parentName','file','Fetching\x20existing\x20segments...','state','journey','dryRun','Error:\x20','Delete\x20journey:','Push\x20YAML\x20files\x20to\x20Treasure\x20Data\x20as\x20child\x20segments','β \x20Journey\x20deletion\x20not\x20yet\x20implemented:\x20','.yml','description','folderPath','2yTQsVO','Push\x20','getJourney','segment:push','Source\x20directory:\x20','\x20changed','site','parentSegment','verbose','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','new','folderId','updated','parent_name','\x20\x20πΊοΈ\x20\x20Journeys:','endsWith','results','yes','1676061rZJnpO','toUpdate','nameToType','map','targetDir','join','paused','resolveParentId','connection','\x20\x20Activations:\x20','user','folders','Changes\x20to:','1160616JKHVYx','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','New\x20segment:','π\x20','yellow','29655JOWWEg','Parent\x20segment:\x20','Changes\x20to\x20journey:','\x20\x20\x20\x20','cwd','nameToId','Site:\x20','Tip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','/app/ps/','\x0aValidation\x20failed:','changed','Error:\x20Directory\x20not\x20found:\x20','Fetching\x20existing\x20journeys...','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x20activations]','journeys','message','existingJourney','data','\x20to\x20create','\x20to\x20delete','Fetching\x20parent\x20segment\x20details...','getParent','\x20folders\x20to\x20create','\x20\x20Segments:\x20','.yaml','errorCode','parentFolder','segmentFolderId','createdAt','Fetching\x20existing\x20folders...','/j/da/je','New\x20journey:','created','scopedFolderPath','error','relationships','Tip:\x20Run\x20`tdx\x20sg\x20pull`\x20first\x20to\x20create\x20segment\x20and\x20journey\x20files','/e/','unchanged','yamlConfig','createdSegmentIds','\x20unchanged','\x20deleted','segment\x20or\x20journey','\x0a[Dry\x20run]\x20No\x20changes\x20were\x20made','2265641XZTExz','activations','list','segments','no_parent','toCreate','isNew','segment','helpText','\x20new','add','\x20\x20Activations:','\x20created','\x20\x20Journeys:\x20','dim','attributes','green','cyan','\x20updated','1081136gfZPqX','\x0aβ\x20Push\x20complete','listActivations','diff','red','1593645EMbStr','\x0aError:','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','toDelete','then','Resolving\x20parent\x20segment\x20\x27','\x20to\x20update','toString','listSegments','listJourneysWithDetailsFromParentSegment','Usage:\x20tdx\x20sg\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20(requires\x20context)','name','type','repeat','\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)','audienceId','set','journeyBundleName','\x0aFix\x20the\x20errors\x20above\x20and\x20try\x20again.\x20Use\x20`tdx\x20sg\x20validate`\x20to\x20check\x20files\x20locally.','idToName','Aborted.','112ukZZQY','Error\x20parsing\x20YAML:\x20','\x0aPush\x20summary\x20for\x20\x27','β\x20All\x20segments,\x20journeys,\x20and\x20activations\x20are\x20up\x20to\x20date','Fetching\x20users\x20for\x20email\x20resolution...'];a31_0x9554=function(){return _0x15b5f1;};return a31_0x9554();}import{batchAsync}from'../utils/async.js';import{segmentToYamlString,segmentWithActivationsToYaml}from'../sdk/segment/child-segment-yaml.js';import a31_0x53c583 from'chalk';function a31_0x489c(_0x126206,_0x4f8782){_0x126206=_0x126206-0x118;const _0x95549d=a31_0x9554();let _0x489c0f=_0x95549d[_0x126206];return _0x489c0f;}import{existsSync}from'fs';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{resolveTarget,isSuccessfulResolution,getScopedDetails}from'../sdk/segment/target-resolution.js';import{buildFolderMaps}from'../sdk/segment/resolution-context.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{resolveTDFolderPath,findSegmentsToDelete,findJourneysToDelete,buildSegmentLookupMap,buildSegmentNameToIdMap,buildJourneyBundleLookupMap,parseAndClassifyYamlFiles,validateParsedFiles,formatValidationErrors,extractRootFolderId,buildConnectionMaps,calculatePushStats,prepareSegmentFiles,prepareJourneyFiles,executePushSegments,executePushFolders,executePushSegmentDeletions,executePushJourneys}from'../sdk/segment/push-workflow.js';export class SegmentPushCommand extends BaseCommand{['name']=a31_0x897ea5(0x159);[a31_0x897ea5(0x154)]=a31_0x897ea5(0x151);async[a31_0x897ea5(0x148)](_0x5eb0dd){const _0x38bf18=a31_0x897ea5,{options:_0xc1e7dc,args:_0x3f9ed2,tdx:_0x314a09}=_0x5eb0dd,_0x20f2e3=_0xc1e7dc,_0xd63e4b=await resolveTarget({'arg':_0x3f9ed2[0x0],'contextParent':_0xc1e7dc[_0x38bf18(0x15d)],'cwd':process[_0x38bf18(0x17e)]()});if(!isSuccessfulResolution(_0xd63e4b))return _0xd63e4b[_0x38bf18(0x194)]===_0x38bf18(0x1ac)?(console['error'](a31_0x53c583['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a')),console[_0x38bf18(0x19d)](_0x38bf18(0x12f)),console[_0x38bf18(0x19d)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<parent_name>\x20\x20\x20\x20\x20\x20#\x20Push\x20all\x20segments\x20to\x20parent'),console[_0x38bf18(0x19d)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20push\x20<file_path>\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20segment\x20file')):(console[_0x38bf18(0x19d)](a31_0x53c583[_0x38bf18(0x124)](_0x38bf18(0x14f)+_0xd63e4b[_0x38bf18(0x18a)]+'\x0a')),_0xd63e4b[_0x38bf18(0x1b0)]&&console['error'](a31_0x53c583[_0x38bf18(0x11e)](_0xd63e4b['helpText']))),0x1;if(_0xd63e4b[_0x38bf18(0x131)]===_0x38bf18(0x163))return console[_0x38bf18(0x19d)](a31_0x53c583[_0x38bf18(0x124)](_0x38bf18(0x185)+_0xd63e4b[_0x38bf18(0x16c)]+'\x0a')),console[_0x38bf18(0x19d)](a31_0x53c583[_0x38bf18(0x11e)](_0x38bf18(0x181))),0x1;const _0x165886=_0xd63e4b[_0x38bf18(0x149)],_0x1bf35a=_0xd63e4b['targetDir'],_0x46ffff=_0xd63e4b[_0x38bf18(0x131)]===_0x38bf18(0x14a)?_0xd63e4b['filePath']:undefined,_0x7f3576=getScopedDetails(_0xd63e4b),_0x907ea5=_0x7f3576?.['isScoped']??![],_0x59d60b=_0x7f3576?.[_0x38bf18(0x19c)]??'';if(!existsSync(_0x1bf35a))return console['error'](a31_0x53c583[_0x38bf18(0x124)](_0x38bf18(0x185)+_0x1bf35a+'\x0a')),console['error'](a31_0x53c583[_0x38bf18(0x11e)](_0x38bf18(0x181))),0x1;_0x20f2e3['verbose']&&(console[_0x38bf18(0x19d)](_0x38bf18(0x180)+_0x20f2e3['site']),console[_0x38bf18(0x19d)](_0x38bf18(0x17b)+_0x165886),console[_0x38bf18(0x19d)](_0x38bf18(0x15a)+_0x1bf35a),_0x907ea5&&console[_0x38bf18(0x19d)]('Scoped\x20to\x20folder:\x20'+_0x59d60b));const _0x26ae95=await withSpinner(_0x38bf18(0x12a)+_0x165886+'\x27...',()=>_0x314a09['segment'][_0x38bf18(0x16f)](_0x165886),{'verbose':_0x20f2e3[_0x38bf18(0x15e)]}),_0x32cc51=_0x26ae95[_0x38bf18(0x18c)],[_0x481507,_0x57b065,_0x5a242d,_0x55b271,_0x5ec34c]=await Promise['all']([withSpinner(_0x38bf18(0x18f),()=>_0x314a09['segment'][_0x38bf18(0x190)](_0x32cc51),{'verbose':_0x20f2e3[_0x38bf18(0x15e)]}),withSpinner(_0x38bf18(0x14b),()=>_0x314a09[_0x38bf18(0x1af)][_0x38bf18(0x12d)](_0x32cc51),{'verbose':_0x20f2e3[_0x38bf18(0x15e)]}),withSpinner(_0x38bf18(0x198),()=>_0x314a09[_0x38bf18(0x1af)]['listFolders'](_0x32cc51),{'verbose':_0x20f2e3[_0x38bf18(0x15e)]}),withSpinner(_0x38bf18(0x186),()=>_0x314a09[_0x38bf18(0x14d)][_0x38bf18(0x12e)](_0x32cc51,{'includeAllVersions':!![]}),{'verbose':_0x20f2e3[_0x38bf18(0x15e)]}),withSpinner(_0x38bf18(0x13e),()=>_0x314a09[_0x38bf18(0x172)]['buildUserMaps'](),{'verbose':_0x20f2e3[_0x38bf18(0x15e)]})[_0x38bf18(0x129)](_0x58d1fd=>_0x58d1fd['data'])]),_0x357f97=_0x481507[_0x38bf18(0x18c)],_0x410028=extractRootFolderId(_0x357f97),_0x208e06=_0x57b065[_0x38bf18(0x18c)],_0x336812=_0x5a242d['data'],{journeys:_0x1701e4,activationStepsById:_0x35b402}=_0x55b271['data'],_0x4b93cc=new Map(_0x1701e4[_0x38bf18(0x16b)](_0xc53597=>[_0xc53597['id'],_0xc53597])),_0x1c5d4e=_0x1701e4[_0x38bf18(0x16b)](_0x363558=>({'id':_0x363558['id'],'name':_0x363558[_0x38bf18(0x11c)]['name'],'journeyBundleName':_0x363558['attributes'][_0x38bf18(0x136)]||'','journeyBundleId':_0x363558[_0x38bf18(0x11c)]['journeyBundleId']||'','versionNumber':_0x363558[_0x38bf18(0x11c)]['versionNumber'],'description':_0x363558['attributes'][_0x38bf18(0x154)],'state':_0x363558[_0x38bf18(0x11c)][_0x38bf18(0x14c)],'paused':_0x363558[_0x38bf18(0x11c)][_0x38bf18(0x16e)],'audienceId':_0x363558['attributes'][_0x38bf18(0x134)],'folderId':_0x363558[_0x38bf18(0x19e)]?.[_0x38bf18(0x195)]?.[_0x38bf18(0x18c)]?.['id'],'createdAt':_0x363558[_0x38bf18(0x11c)][_0x38bf18(0x197)],'updatedAt':_0x363558[_0x38bf18(0x11c)]['updatedAt']})),{emailToId:_0x52a8b2,idToEmail:_0x36260f}=_0x5ec34c,_0x13d0de=await withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',async()=>{const _0x56773c=_0x38bf18,_0x3509b3=await _0x314a09[_0x56773c(0x170)][_0x56773c(0x1aa)]();return buildConnectionMaps(_0x3509b3);},{'verbose':_0x20f2e3['verbose']})[_0x38bf18(0x129)](_0x1561e4=>_0x1561e4[_0x38bf18(0x18c)]),_0x3bd800=_0x13d0de[_0x38bf18(0x17f)],_0x3fe795=_0x13d0de[_0x38bf18(0x138)],_0x626af1=_0x13d0de[_0x38bf18(0x16a)],_0x566509={'emailToIdMap':_0x52a8b2,'connectionNameToIdMap':_0x3bd800,'connectionNameToTypeMap':_0x626af1,'getSchema':_0x5b9139=>_0x314a09[_0x38bf18(0x170)][_0x38bf18(0x140)](_0x5b9139)};let {pathToId:_0x357a71,idToPath:_0x26000c}=buildFolderMaps(_0x336812);const _0x7dc6c6=buildSegmentLookupMap(_0x208e06,_0x26000c),_0x4b35b7=buildSegmentNameToIdMap(_0x208e06),_0xff781f=buildJourneyBundleLookupMap(_0x1c5d4e,_0x26000c);let _0x41438c;if(_0x46ffff){if(!_0x46ffff[_0x38bf18(0x165)](_0x38bf18(0x153))&&!_0x46ffff[_0x38bf18(0x165)](_0x38bf18(0x193)))return console[_0x38bf18(0x19d)](a31_0x53c583[_0x38bf18(0x124)](_0x38bf18(0x15f)+_0x46ffff+'\x0a')),0x1;_0x41438c=[_0x46ffff];}else _0x41438c=findYamlFiles(_0x1bf35a);if(_0x41438c[_0x38bf18(0x142)]===0x0)return console[_0x38bf18(0x19d)](a31_0x53c583[_0x38bf18(0x124)](_0x38bf18(0x176)+_0x1bf35a+'\x0a')),console[_0x38bf18(0x19d)](a31_0x53c583[_0x38bf18(0x11e)](_0x38bf18(0x19f))),0x1;let _0x290e5c,_0x3f394d;try{const _0x16b06f=parseAndClassifyYamlFiles(_0x41438c,_0x1bf35a,{'skipSegments':_0x20f2e3[_0x38bf18(0x13f)]});_0x290e5c=_0x16b06f['segments'],_0x3f394d=_0x16b06f[_0x38bf18(0x189)];const _0x114c4a=validateParsedFiles(_0x16b06f,_0x1bf35a);if(_0x114c4a[_0x38bf18(0x142)]>0x0)return console[_0x38bf18(0x19d)](a31_0x53c583[_0x38bf18(0x124)](_0x38bf18(0x183))),console[_0x38bf18(0x19d)](formatValidationErrors(_0x114c4a)),console[_0x38bf18(0x19d)](a31_0x53c583['yellow'](_0x38bf18(0x137))),0x1;}catch(_0x22fafc){return console[_0x38bf18(0x19d)](a31_0x53c583[_0x38bf18(0x124)](_0x38bf18(0x13b)+(_0x22fafc instanceof Error?_0x22fafc[_0x38bf18(0x18a)]:_0x22fafc))),0x1;}if(_0x290e5c[_0x38bf18(0x142)]===0x0&&_0x3f394d[_0x38bf18(0x142)]===0x0){const _0x53d01d=_0x20f2e3[_0x38bf18(0x13f)]?_0x38bf18(0x14d):_0x38bf18(0x1a6);return console[_0x38bf18(0x19d)](a31_0x53c583[_0x38bf18(0x179)]('No\x20'+_0x53d01d+'\x20YAML\x20files\x20found')),0x0;}const _0x869fe2=new Map();_0x208e06[_0x38bf18(0x142)]>0x0&&!_0x20f2e3[_0x38bf18(0x13f)]&&await withSpinner('Fetching\x20existing\x20activations...',async()=>{await batchAsync(_0x208e06,async _0x413bc8=>{const _0x1885c2=a31_0x489c,_0x47fbcd=await _0x314a09['segment'][_0x1885c2(0x122)](_0x32cc51,_0x413bc8['id']);_0x869fe2[_0x1885c2(0x135)](_0x413bc8['id'],_0x47fbcd);});},{'verbose':_0x20f2e3[_0x38bf18(0x15e)]});const {segmentFiles:_0x42117d,foldersToCreate:_0x107d61}=await prepareSegmentFiles(_0x290e5c,{'segmentByFolderAndName':_0x7dc6c6,'activationsBySegmentId':_0x869fe2,'folderPathToId':_0x357a71,'idToEmailMap':_0x36260f,'connectionIdToNameMap':_0x3fe795},_0x566509,_0x907ea5,_0x59d60b),_0x36b0d8=_0x46ffff?[]:findSegmentsToDelete(_0x208e06,_0x290e5c[_0x38bf18(0x16b)](({yamlConfig:_0x5f0533,folderPath:_0x3bbc66})=>({'yamlConfig':_0x5f0533,'folderPath':resolveTDFolderPath(_0x3bbc66,_0x907ea5,_0x59d60b)})),_0x26000c,_0x59d60b,_0x907ea5),{journeyFiles:_0x4d2fc4,foldersToCreate:_0x4f4205}=await withProgressSpinner('Preparing\x20journeys...',async _0xcc5aaa=>prepareJourneyFiles(_0x3f394d,{'fetchJourney':async _0x646871=>_0x314a09[_0x38bf18(0x14d)][_0x38bf18(0x158)](_0x646871[_0x38bf18(0x145)]),'journeyBundlesByFolderAndName':_0xff781f,'folderPathToId':_0x357a71,'idToEmailMap':_0x36260f,'connectionIdToNameMap':_0x3fe795,'existingSegments':_0x208e06,'parentId':_0x32cc51,'deps':_0x314a09,'progress':{'update':_0x3a7e25=>{const _0x4638b0=_0x38bf18;_0xcc5aaa['setPhase'](_0x3a7e25),_0x20f2e3[_0x4638b0(0x15e)]&&console[_0x4638b0(0x19d)]('\x20\x20'+_0x3a7e25);}},'journeyById':_0x4b93cc,'activationStepsById':_0x35b402},_0x907ea5,_0x59d60b),{'verbose':_0x20f2e3[_0x38bf18(0x15e)]})['then'](_0x157fa6=>_0x157fa6[_0x38bf18(0x18c)]);for(const _0x4a63d8 of _0x4f4205){_0x107d61[_0x38bf18(0x1b2)](_0x4a63d8);}const _0x57aade=_0x46ffff?[]:findJourneysToDelete(_0x1c5d4e,_0x3f394d['map'](({yamlConfig:_0x1c8565,folderPath:_0x5352a4})=>({'yamlConfig':_0x1c8565,'folderPath':resolveTDFolderPath(_0x5352a4,_0x907ea5,_0x59d60b)})),_0x26000c,_0x59d60b,_0x907ea5),_0x1ec876=calculatePushStats(_0x42117d,_0x4d2fc4,_0x107d61,_0x36b0d8,_0x57aade,!!_0x20f2e3['delete'],!!_0x20f2e3['journeysOnly']),_0x1fa691=_0x1ec876[_0x38bf18(0x1ab)]['new'],_0x3c5d82=_0x1ec876[_0x38bf18(0x1ab)][_0x38bf18(0x184)],_0x30b83d=_0x1ec876[_0x38bf18(0x1ab)]['unchanged'],_0x4db5f2=_0x1ec876[_0x38bf18(0x1ab)][_0x38bf18(0x128)],_0x184cdf=_0x1ec876[_0x38bf18(0x173)][_0x38bf18(0x1ad)],_0x55822a=_0x1ec876[_0x38bf18(0x189)][_0x38bf18(0x160)],_0xba32ef=_0x1ec876['journeys'][_0x38bf18(0x184)],_0x536778=_0x1ec876[_0x38bf18(0x189)][_0x38bf18(0x1a1)],_0x1f50ee=_0x1ec876[_0x38bf18(0x189)][_0x38bf18(0x128)],_0x57196f=_0x1ec876[_0x38bf18(0x1a9)][_0x38bf18(0x147)],_0x96089f=_0x1ec876['activations']['toCreate'],_0x290e7d=_0x1ec876[_0x38bf18(0x1a9)][_0x38bf18(0x169)],_0x316d59=_0x1ec876[_0x38bf18(0x1a9)]['toDelete'];console[_0x38bf18(0x19d)](_0x38bf18(0x13c)+_0x165886+'\x27:');_0x184cdf[_0x38bf18(0x142)]>0x0&&console[_0x38bf18(0x19d)]('\x20\x20'+a31_0x53c583[_0x38bf18(0x141)](_0x38bf18(0x178)+_0x184cdf[_0x38bf18(0x142)]+_0x38bf18(0x191)));if(!_0x20f2e3[_0x38bf18(0x13f)]){console['error']('\x20\x20π\x20Segments:'),console[_0x38bf18(0x19d)](_0x38bf18(0x17d)+a31_0x53c583[_0x38bf18(0x11d)]('+\x20'+_0x1fa691[_0x38bf18(0x142)]+'\x20new')),console[_0x38bf18(0x19d)](_0x38bf18(0x17d)+a31_0x53c583[_0x38bf18(0x179)]('~\x20'+_0x3c5d82['length']+_0x38bf18(0x15b)));if(_0x4db5f2[_0x38bf18(0x142)]>0x0)console[_0x38bf18(0x19d)](_0x38bf18(0x17d)+a31_0x53c583['red']('-\x20'+_0x4db5f2[_0x38bf18(0x142)]+_0x38bf18(0x18e)));else _0x36b0d8[_0x38bf18(0x142)]>0x0&&!_0x20f2e3['delete']&&console[_0x38bf18(0x19d)]('\x20\x20\x20\x20'+a31_0x53c583[_0x38bf18(0x11b)](_0x36b0d8[_0x38bf18(0x142)]+'\x20on\x20server\x20not\x20in\x20YAML\x20(use\x20--delete\x20to\x20remove)'));console[_0x38bf18(0x19d)](_0x38bf18(0x17d)+a31_0x53c583[_0x38bf18(0x11b)]('=\x20'+_0x30b83d[_0x38bf18(0x142)]+_0x38bf18(0x1a4)));}if(_0x4d2fc4[_0x38bf18(0x142)]>0x0||_0x57aade[_0x38bf18(0x142)]>0x0){console[_0x38bf18(0x19d)](_0x38bf18(0x164)),console['error'](_0x38bf18(0x17d)+a31_0x53c583[_0x38bf18(0x11d)]('+\x20'+_0x55822a[_0x38bf18(0x142)]+_0x38bf18(0x1b1))),console[_0x38bf18(0x19d)](_0x38bf18(0x17d)+a31_0x53c583['yellow']('~\x20'+_0xba32ef[_0x38bf18(0x142)]+_0x38bf18(0x15b)));if(_0x1f50ee[_0x38bf18(0x142)]>0x0)console[_0x38bf18(0x19d)](_0x38bf18(0x17d)+a31_0x53c583[_0x38bf18(0x124)]('-\x20'+_0x1f50ee[_0x38bf18(0x142)]+_0x38bf18(0x18e)));else _0x57aade[_0x38bf18(0x142)]>0x0&&!_0x20f2e3['delete']&&console[_0x38bf18(0x19d)](_0x38bf18(0x17d)+a31_0x53c583[_0x38bf18(0x11b)](_0x57aade['length']+_0x38bf18(0x133)));console[_0x38bf18(0x19d)](_0x38bf18(0x17d)+a31_0x53c583[_0x38bf18(0x11b)]('=\x20'+_0x536778['length']+'\x20unchanged'));}_0x57196f['length']>0x0&&!_0x20f2e3[_0x38bf18(0x13f)]&&(console[_0x38bf18(0x19d)](''),console[_0x38bf18(0x19d)](_0x38bf18(0x118)),_0x96089f[_0x38bf18(0x142)]>0x0&&console[_0x38bf18(0x19d)](_0x38bf18(0x17d)+a31_0x53c583[_0x38bf18(0x11d)]('+\x20'+_0x96089f['length']+_0x38bf18(0x18d))),_0x290e7d[_0x38bf18(0x142)]>0x0&&console[_0x38bf18(0x19d)]('\x20\x20\x20\x20'+a31_0x53c583[_0x38bf18(0x179)]('~\x20'+_0x290e7d[_0x38bf18(0x142)]+_0x38bf18(0x12b))),_0x316d59['length']>0x0&&console[_0x38bf18(0x19d)](_0x38bf18(0x17d)+a31_0x53c583[_0x38bf18(0x124)]('-\x20'+_0x316d59[_0x38bf18(0x142)]+'\x20to\x20delete')));console['error']('\x20\x20Source:\x20'+a31_0x53c583[_0x38bf18(0x11e)](_0x1bf35a)+'\x0a');if(_0x184cdf['length']>0x0){console['error']('Folders\x20to\x20create:');for(const _0x17adcf of _0x184cdf){console[_0x38bf18(0x19d)]('\x20\x20'+a31_0x53c583[_0x38bf18(0x141)]('+')+'\x20'+_0x17adcf);}console[_0x38bf18(0x19d)]('');}if(_0x1fa691[_0x38bf18(0x142)]>0x0&&!_0x20f2e3[_0x38bf18(0x13f)])for(const _0x53de7a of _0x1fa691){const _0x4bac45=_0x53de7a[_0x38bf18(0x155)]?_0x53de7a[_0x38bf18(0x155)]+'/'+_0x53de7a[_0x38bf18(0x1a2)][_0x38bf18(0x130)]:_0x53de7a[_0x38bf18(0x1a2)][_0x38bf18(0x130)],_0x381971=_0x53de7a['yamlConfig'][_0x38bf18(0x1a9)]?.[_0x38bf18(0x142)]||0x0,_0x5f1fef=_0x381971>0x0?a31_0x53c583[_0x38bf18(0x11b)]('\x20['+_0x381971+_0x38bf18(0x188)):'';console[_0x38bf18(0x19d)]('\x0a'+a31_0x53c583[_0x38bf18(0x11d)](_0x38bf18(0x177))+'\x20'+_0x4bac45+_0x5f1fef),console[_0x38bf18(0x19d)]('β'[_0x38bf18(0x132)](0x3c)),_0x53de7a['diff']&&console[_0x38bf18(0x19d)](_0x53de7a[_0x38bf18(0x123)]),console['error']('β'[_0x38bf18(0x132)](0x3c));}if(_0x4db5f2[_0x38bf18(0x142)]>0x0&&!_0x20f2e3[_0x38bf18(0x13f)])for(const _0x42ebd0 of _0x4db5f2){const _0x26a837=_0x42ebd0[_0x38bf18(0x196)]?_0x26000c[_0x38bf18(0x144)](_0x42ebd0[_0x38bf18(0x196)][_0x38bf18(0x12c)]())||'':'',_0x5389bf=_0x26a837?_0x26a837+'/'+_0x42ebd0[_0x38bf18(0x130)]:_0x42ebd0['name'],_0x139409=_0x869fe2['get'](_0x42ebd0['id'])||[],_0x270385=_0x139409[_0x38bf18(0x142)]>0x0?a31_0x53c583[_0x38bf18(0x11b)]('\x20['+_0x139409[_0x38bf18(0x142)]+_0x38bf18(0x188)):'';console['error']('\x0a'+a31_0x53c583[_0x38bf18(0x124)]('Delete\x20segment:')+'\x20'+_0x5389bf+_0x270385),console[_0x38bf18(0x19d)]('β'[_0x38bf18(0x132)](0x3c));const _0x3ea990=segmentWithActivationsToYaml(_0x42ebd0,_0x139409,undefined,_0x36260f,_0x3fe795),_0x3156da=segmentToYamlString(_0x3ea990),_0x22479e=generateDiff(_0x3156da,'');console[_0x38bf18(0x19d)](formatDiffWithColors(_0x22479e)),console[_0x38bf18(0x19d)]('β'[_0x38bf18(0x132)](0x3c));}const _0x5b1538=_0x42117d['filter'](_0x54ce54=>!_0x54ce54[_0x38bf18(0x1ae)]&&_0x54ce54['diff']);if(_0x5b1538[_0x38bf18(0x142)]>0x0&&!_0x20f2e3[_0x38bf18(0x13f)])for(const _0x32e153 of _0x5b1538){const _0x4f27d9=_0x32e153[_0x38bf18(0x155)]?_0x32e153['folderPath']+'/'+_0x32e153[_0x38bf18(0x1a2)]['name']:_0x32e153[_0x38bf18(0x1a2)]['name'];console['error']('\x0a'+a31_0x53c583['yellow'](_0x38bf18(0x174))+'\x20'+_0x4f27d9),console[_0x38bf18(0x19d)]('β'[_0x38bf18(0x132)](0x3c)),console['error'](_0x32e153[_0x38bf18(0x123)]),console['error']('β'['repeat'](0x3c));}if(_0x55822a[_0x38bf18(0x142)]>0x0)for(const _0x468169 of _0x55822a){const _0x30e197=_0x468169['folderPath']?_0x468169[_0x38bf18(0x155)]+'/'+_0x468169[_0x38bf18(0x1a2)]['name']:_0x468169['yamlConfig'][_0x38bf18(0x130)];console[_0x38bf18(0x19d)]('\x0a'+a31_0x53c583[_0x38bf18(0x11d)](_0x38bf18(0x19a))+'\x20'+_0x30e197),console['error']('β'[_0x38bf18(0x132)](0x3c)),_0x468169[_0x38bf18(0x123)]&&console[_0x38bf18(0x19d)](_0x468169['diff']),console[_0x38bf18(0x19d)]('β'[_0x38bf18(0x132)](0x3c));}const _0xced3b3=_0x4d2fc4['filter'](_0xf178f8=>!_0xf178f8[_0x38bf18(0x1ae)]&&_0xf178f8['diff']);if(_0xced3b3['length']>0x0)for(const _0xce2fd1 of _0xced3b3){const _0x14bac4=_0xce2fd1[_0x38bf18(0x155)]?_0xce2fd1[_0x38bf18(0x155)]+'/'+_0xce2fd1[_0x38bf18(0x1a2)]['name']:_0xce2fd1[_0x38bf18(0x1a2)][_0x38bf18(0x130)];console[_0x38bf18(0x19d)]('\x0a'+a31_0x53c583[_0x38bf18(0x179)](_0x38bf18(0x17c))+'\x20'+_0x14bac4),console['error']('β'['repeat'](0x3c)),console['error'](_0xce2fd1[_0x38bf18(0x123)]),console[_0x38bf18(0x19d)]('β'['repeat'](0x3c));}if(_0x1f50ee[_0x38bf18(0x142)]>0x0)for(const _0x1fd5ff of _0x1f50ee){const _0x3eac3e=_0x1fd5ff[_0x38bf18(0x161)]?_0x26000c['get'](_0x1fd5ff[_0x38bf18(0x161)])||'':'',_0xcfa7fe=_0x3eac3e?_0x3eac3e+'/'+_0x1fd5ff[_0x38bf18(0x136)]:_0x1fd5ff[_0x38bf18(0x136)];console[_0x38bf18(0x19d)]('\x0a'+a31_0x53c583[_0x38bf18(0x124)](_0x38bf18(0x150))+'\x20'+_0xcfa7fe),console[_0x38bf18(0x19d)]('β'[_0x38bf18(0x132)](0x3c)),console['error'](a31_0x53c583[_0x38bf18(0x124)]('(Journey\x20will\x20be\x20deleted)')),console[_0x38bf18(0x19d)]('β'['repeat'](0x3c));}if(_0x20f2e3[_0x38bf18(0x14e)])return console[_0x38bf18(0x19d)](a31_0x53c583[_0x38bf18(0x179)](_0x38bf18(0x1a7))),0x0;const _0x3b607e=_0x20f2e3[_0x38bf18(0x13f)]?![]:_0x1fa691[_0x38bf18(0x142)]>0x0||_0x3c5d82[_0x38bf18(0x142)]>0x0||_0x4db5f2[_0x38bf18(0x142)]>0x0,_0x1262d3=_0x55822a['length']>0x0||_0xba32ef[_0x38bf18(0x142)]>0x0||_0x1f50ee['length']>0x0,_0x38c3cc=_0x20f2e3[_0x38bf18(0x13f)]?![]:_0x57196f['length']>0x0,_0x5e5b49=_0x184cdf['length']>0x0;if(!_0x3b607e&&!_0x1262d3&&!_0x38c3cc&&!_0x5e5b49){const _0x488647=_0x20f2e3[_0x38bf18(0x13f)]?'β\x20All\x20journeys\x20are\x20up\x20to\x20date':_0x38bf18(0x13d);console['error'](a31_0x53c583[_0x38bf18(0x11d)](_0x488647));if(_0x46ffff&&_0x536778['length']===0x1){const _0x5d7aa5=_0x536778[0x0];if(_0x5d7aa5[_0x38bf18(0x18b)]?.['id']){const _0x2e52e5=getConsoleNextUrl(_0x20f2e3[_0x38bf18(0x15c)],_0x38bf18(0x182)+_0x32cc51+_0x38bf18(0x1a0)+_0x5d7aa5[_0x38bf18(0x18b)]['id']+_0x38bf18(0x199));console['error']('\x20\x20'+a31_0x53c583[_0x38bf18(0x11e)](_0x2e52e5));}}return 0x0;}const _0x21c8d2=_0x20f2e3[_0x38bf18(0x13f)]?_0x55822a[_0x38bf18(0x142)]+_0xba32ef[_0x38bf18(0x142)]+_0x1f50ee[_0x38bf18(0x142)]+_0x184cdf['length']:_0x1fa691[_0x38bf18(0x142)]+_0x3c5d82[_0x38bf18(0x142)]+_0x4db5f2[_0x38bf18(0x142)]+_0x55822a[_0x38bf18(0x142)]+_0xba32ef[_0x38bf18(0x142)]+_0x1f50ee['length']+_0x184cdf[_0x38bf18(0x142)]+_0x57196f[_0x38bf18(0x142)];if(!_0x20f2e3[_0x38bf18(0x167)]&&_0x21c8d2>0x0){if(!isInteractive())return console['error'](a31_0x53c583[_0x38bf18(0x124)](_0x38bf18(0x126)),_0x38bf18(0x127)),console[_0x38bf18(0x19d)](a31_0x53c583['dim'](_0x38bf18(0x187))),0x1;const _0x474c60=await confirmKey(_0x38bf18(0x157)+_0x21c8d2+'\x20changes?');if(!_0x474c60)return console[_0x38bf18(0x19d)](a31_0x53c583[_0x38bf18(0x179)](_0x38bf18(0x139))),0x1;}const _0x568a32={'withProgress':async(_0x44c09f,_0xe453a9)=>{const _0x18764a=_0x38bf18,_0x44aa5f=await withSpinner(_0x44c09f,_0xe453a9,{'verbose':_0x20f2e3[_0x18764a(0x15e)]});return{'data':_0x44aa5f['data']};},'logInfo':_0x2374fb=>console['error'](a31_0x53c583[_0x38bf18(0x141)]('β\x20'+_0x2374fb)),'logSuccess':_0x192e2a=>console['error'](a31_0x53c583[_0x38bf18(0x11d)]('β\x20'+_0x192e2a)),'logWarning':_0x60d70c=>console[_0x38bf18(0x19d)](a31_0x53c583['yellow']('β \x20'+_0x60d70c)),'logDeleted':_0x3bed5e=>console[_0x38bf18(0x19d)](a31_0x53c583[_0x38bf18(0x124)]('β\x20'+_0x3bed5e))},_0x53ce={'segment':_0x314a09[_0x38bf18(0x1af)],'journey':_0x314a09[_0x38bf18(0x14d)],'user':_0x314a09['user'],'connection':_0x314a09['connection']};_0x184cdf[_0x38bf18(0x142)]>0x0&&(_0x357a71=await executePushFolders(_0x53ce,_0x184cdf,_0x357a71,{'parentId':_0x32cc51},_0x568a32));const _0xafb4a5={'rootFolderId':_0x410028,'folderPathToId':_0x357a71,'folderIdToPath':_0x26000c,'segmentNameToId':_0x4b35b7,'activationsBySegmentId':_0x869fe2,'emailToIdMap':_0x52a8b2,'idToEmailMap':_0x36260f,'connectionNameToIdMap':_0x13d0de[_0x38bf18(0x17f)],'connectionIdToNameMap':_0x13d0de[_0x38bf18(0x138)],'connectionNameToTypeMap':_0x626af1},_0x49ed49=await executePushSegments(_0x53ce,_0x20f2e3[_0x38bf18(0x13f)]?[]:_0x42117d,_0xafb4a5,{'parentId':_0x32cc51},_0x568a32),_0xf21591=_0x49ed49[_0x38bf18(0x19b)],_0x144c97=_0x49ed49[_0x38bf18(0x162)],_0x2dbc56=_0x49ed49[_0x38bf18(0x1a9)][_0x38bf18(0x19b)],_0x36de27=_0x49ed49[_0x38bf18(0x1a9)][_0x38bf18(0x162)],_0x519a6c=_0x49ed49[_0x38bf18(0x1a9)]['deleted'],_0x102e9a=await executePushSegmentDeletions(_0x53ce,_0x20f2e3['journeysOnly']?[]:_0x4db5f2,_0x568a32);let _0x5077cc=0x0,_0x441166=0x0,_0x3a1d1b=0x0;const _0x18f6db=new Map(_0x4b35b7);for(const [_0x9e2bad,_0x539543]of _0x49ed49[_0x38bf18(0x1a3)]){_0x18f6db[_0x38bf18(0x135)](_0x9e2bad,_0x539543);}if(_0x4d2fc4[_0x38bf18(0x142)]>0x0){const _0x344edf={..._0xafb4a5,'segmentNameToId':_0x18f6db,'existingSegments':_0x208e06,'activationContext':_0x566509},_0x2a2a7f=await executePushJourneys(_0x53ce,_0x4d2fc4,_0x344edf,{'parentId':_0x32cc51,'rootFolderId':_0x410028,'verbose':_0x20f2e3[_0x38bf18(0x15e)]},_0x568a32);_0x5077cc=_0x2a2a7f['created'],_0x441166=_0x2a2a7f['updated'];if(_0x46ffff&&_0x2a2a7f[_0x38bf18(0x166)]['length']===0x1){const _0x22cb44=_0x2a2a7f['results'][0x0];if(_0x22cb44[_0x38bf18(0x145)]){const _0x1bffc7=getConsoleNextUrl(_0x20f2e3[_0x38bf18(0x15c)],'/app/ps/'+_0x32cc51+'/e/'+_0x22cb44[_0x38bf18(0x145)]+_0x38bf18(0x199));console[_0x38bf18(0x19d)]('\x20\x20'+a31_0x53c583[_0x38bf18(0x11e)](_0x1bffc7));}}}for(const _0x1ce524 of _0x1f50ee){console['error'](a31_0x53c583[_0x38bf18(0x179)](_0x38bf18(0x152)+_0x1ce524[_0x38bf18(0x136)])),_0x3a1d1b++;}const _0x48176d=[];if(_0xf21591>0x0)_0x48176d['push'](_0xf21591+_0x38bf18(0x119));if(_0x144c97>0x0)_0x48176d[_0x38bf18(0x146)](_0x144c97+_0x38bf18(0x11f));if(_0x102e9a>0x0)_0x48176d[_0x38bf18(0x146)](_0x102e9a+_0x38bf18(0x1a5));const _0x3eab86=[];if(_0x5077cc>0x0)_0x3eab86['push'](_0x5077cc+'\x20created');if(_0x441166>0x0)_0x3eab86[_0x38bf18(0x146)](_0x441166+'\x20updated');if(_0x3a1d1b>0x0)_0x3eab86[_0x38bf18(0x146)](_0x3a1d1b+'\x20deleted');const _0x53285a=[];if(_0x2dbc56>0x0)_0x53285a[_0x38bf18(0x146)](_0x2dbc56+_0x38bf18(0x119));if(_0x36de27>0x0)_0x53285a[_0x38bf18(0x146)](_0x36de27+_0x38bf18(0x11f));if(_0x519a6c>0x0)_0x53285a[_0x38bf18(0x146)](_0x519a6c+_0x38bf18(0x1a5));return console['error'](a31_0x53c583[_0x38bf18(0x11d)](_0x38bf18(0x121))),_0x48176d['length']>0x0&&!_0x20f2e3['journeysOnly']&&console[_0x38bf18(0x19d)](_0x38bf18(0x192)+_0x48176d[_0x38bf18(0x16d)](',\x20')),_0x3eab86['length']>0x0&&console[_0x38bf18(0x19d)](_0x38bf18(0x11a)+_0x3eab86['join'](',\x20')),_0x53285a['length']>0x0&&!_0x20f2e3['journeysOnly']&&console[_0x38bf18(0x19d)](_0x38bf18(0x171)+_0x53285a[_0x38bf18(0x16d)](',\x20')),0x0;}}
|