@treasuredata/tdx 0.8.6 → 0.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +2 -2
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/client/cdp-api-client.js +1 -1
- package/dist/client/engage-api-client.js +1 -1
- package/dist/client/http-client.js +1 -1
- package/dist/client/llm-api-client.js +1 -1
- package/dist/client/rate-limiter.js +1 -1
- package/dist/client/td-api-client.js +1 -1
- package/dist/client/trino-api-client.js +1 -1
- package/dist/client/workflow-client.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/context-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-proxy.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.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/index.js +1 -1
- package/dist/proxy/anthropic-adapter.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/context-signature.js +1 -1
- package/dist/proxy/conversation-utils.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/sdk/api.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/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm.js +1 -1
- package/dist/sdk/query.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.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.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/workflow.js +1 -1
- package/dist/types/endpoints.js +1 -1
- package/dist/types/index.js +1 -1
- package/dist/utils/agent-ref-parser.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/chat-cache.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/command-output.js +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/fields-display.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/format-detector.js +1 -1
- package/dist/utils/formatters.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/llm-backup-utils.js +1 -1
- package/dist/utils/model-aliases.js +1 -1
- package/dist/utils/model-factors.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.d.ts.map +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/segment-path-parser.js +1 -1
- package/dist/utils/segment-ref-parser.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sql-parser.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-config.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/tree-formatter.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/dist/utils/workflow-utils.js +1 -1
- package/package.json +1 -1
package/dist/sdk/segment.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a74_0xb59eb3=a74_0xf500;(function(_0x3071e4,_0x3756a3){const _0x2a23ee=a74_0xf500,_0x122489=_0x3071e4();while(!![]){try{const _0x274116=-parseInt(_0x2a23ee(0x17a))/0x1*(-parseInt(_0x2a23ee(0x179))/0x2)+-parseInt(_0x2a23ee(0x19b))/0x3+-parseInt(_0x2a23ee(0x1c8))/0x4*(-parseInt(_0x2a23ee(0x1c1))/0x5)+-parseInt(_0x2a23ee(0x1c2))/0x6+parseInt(_0x2a23ee(0x1cb))/0x7+parseInt(_0x2a23ee(0x1b9))/0x8*(-parseInt(_0x2a23ee(0x186))/0x9)+parseInt(_0x2a23ee(0x170))/0xa*(-parseInt(_0x2a23ee(0x1b1))/0xb);if(_0x274116===_0x3756a3)break;else _0x122489['push'](_0x122489['shift']());}catch(_0x5a07fb){_0x122489['push'](_0x122489['shift']());}}}(a74_0x327e,0x7abde));import{CDPApiClient}from'../client/cdp-api-client.js';function a74_0xf500(_0x180ad4,_0xa7dec7){_0x180ad4=_0x180ad4-0x144;const _0x327ecb=a74_0x327e();let _0xf5008c=_0x327ecb[_0x180ad4];return _0xf5008c;}import{TrinoApiClient}from'../client/trino-api-client.js';import{SDKError,ErrorCode}from'./errors.js';import{parsePath}from'../utils/segment-path-parser.js';import{apiToYaml,yamlToApi,toYamlString,parseYamlString}from'./segment/parent-segment-yaml.js';function a74_0x327e(){const _0x169a92=['rowCount','length','Behavior\x20\x27','map','Path\x20cannot\x20be\x20empty','\x27\x20not\x20found\x20in\x20path','getParent','groupingName','resolvePathToResource','rootFolderId','listFields','all','updateSegment','join','listRecursive','listParents','parent\x20segment','push','\x27\x20not\x20found','getParentFull','parentTableName','total_events','data','Master\x20table:\x20','Folder\x20\x27','source','previewParentYaml','description','Validating\x20master\x20table:\x20','resolveParentId','ambiguous','updatedAt','\x27\x20not\x20found\x20in\x20parent\x20segment','string','Fetching\x20sample\x20data\x20for:\x20','parent','catch','behaviors','totalEvents','interval','Maximum\x20recursion\x20depth\x20(','createParent','984690BZteYU','Parent\x20segment\x20not\x20found:\x20','schema','attribute','parentFolderId','executeQuery','Folder\x20not\x20found:\x20','customersWithEvents','enriched','1276deyEdf','883kLZbyj','behavior','Counting\x20master\x20table\x20rows...','find','listFolders','\x20in\x20parent\x20','database','getParentSQL','getAudienceAttributes','schemaValid','runParent','master','19566pBUGqZ','Fetching\x20master\x20sample\x20data...','getSegmentSQL','Validating\x20attribute:\x20',')\x20exceeded','Resource\x20\x27','isAbsolute','createFolder','customers_with_events','Enriched\x20query:\x20','Validating\x20all\x20behaviors\x20in\x20parallel...','attributes','updateParent','getActivation','\x27:\x20','Path\x20must\x20be\x20absolute\x20(cannot\x20start\x20with\x20.\x20or\x20..)','matched_count','segments','allValid','createdAt','segmentFolderId','1713417mTyLMM','getFolder','Fetching\x20enriched\x20master\x20data...','sampleData','SEGMENT_NOT_FOUND','createActivation','Calculating\x20statistics\x20for:\x20','segment','Validating\x20all\x20attributes\x20in\x20parallel...','listUnified','row_count','table','logger','parentColumn','folder','message','coveragePercent','schemaError','Attribute\x20\x27','test','detectResourceTypeInFolder','client','121hbGhQD','detectResourceType','trinoClient','updateSegmentById','listSegments','error','createSegment','deleteActivation','176KUOBsE','name','filter','listParentSegments','\x27\x20not\x20found\x20in\x20','child_key','Validating\x20behavior:\x20','INVALID_ARGUMENT','932390CIfCCD','1228578PWAMII','isArray','updateParentSegment','listActivations','resolveFolderId','type','20OyjpnD','resolveParentIdOrName','customerPercent','6397265qXZVcC','updateActivation','parentDatabaseName','resolveSegmentId','onProgress','listSegmentFolders','getSegment','then','parent_key','Segment\x20\x27'];a74_0x327e=function(){return _0x169a92;};return a74_0x327e();}import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{DEFAULT_TIME_RANGE,DEFAULT_SAMPLE_LIMIT,generateSchemaValidationSQL,generateMasterCountSQL,generateMasterSampleSQL,generateAttributeCoverageSQL,generateBehaviorStatsSQL,generateAttributeSampleSQL,generateBehaviorSampleSQL,generateEnrichedSQL,generateAttributeSchemaSQL,generateBehaviorSchemaSQL,findAttributeByName,findBehaviorByName,getAttributeColumns,getBehaviorColumns}from'./segment/parent-segment-preview.js';export class SegmentSDK{['client'];[a74_0xb59eb3(0x1b3)];constructor(_0x4df81e){const _0x3c24bb=a74_0xb59eb3;this[_0x3c24bb(0x1b0)]=new CDPApiClient(_0x4df81e,_0x4df81e[_0x3c24bb(0x1a7)]),this['trinoClient']=new TrinoApiClient(_0x4df81e,_0x4df81e[_0x3c24bb(0x1a7)]);}async[a74_0xb59eb3(0x155)](){const _0x43baf6=a74_0xb59eb3;return await this[_0x43baf6(0x1b0)][_0x43baf6(0x1bc)]();}async[a74_0xb59eb3(0x14c)](_0x5f2580){return await this['client']['getParentSegment'](_0x5f2580);}async[a74_0xb59eb3(0x1b5)](_0x41bcac){const _0x591eb3=a74_0xb59eb3;return await this[_0x591eb3(0x1b0)][_0x591eb3(0x1b5)](_0x41bcac);}async[a74_0xb59eb3(0x1d1)](_0x461f67,_0x239f9f){const _0x4df7ed=a74_0xb59eb3;return await this[_0x4df7ed(0x1b0)]['getSegment'](_0x461f67,_0x239f9f);}async[a74_0xb59eb3(0x17e)](_0x32feb6){const _0x5cfe83=a74_0xb59eb3;return await this['client'][_0x5cfe83(0x1d0)](_0x32feb6);}async[a74_0xb59eb3(0x19c)](_0x1c587c){const _0x176d0b=a74_0xb59eb3;return await this[_0x176d0b(0x1b0)]['getSegmentFolder'](_0x1c587c);}async[a74_0xb59eb3(0x1c5)](_0x3ccc43,_0x383f5c){const _0x3046b2=a74_0xb59eb3;return await this[_0x3046b2(0x1b0)]['listActivations'](_0x3ccc43,_0x383f5c);}async[a74_0xb59eb3(0x193)](_0x1cf57f,_0x336bc9,_0x1d51a2){const _0x34a3d0=a74_0xb59eb3;return await this[_0x34a3d0(0x1b0)]['getActivation'](_0x1cf57f,_0x336bc9,_0x1d51a2);}async[a74_0xb59eb3(0x1a0)](_0x461ed5,_0x3ba1ba,_0x327b05){const _0x46a3e6=a74_0xb59eb3;return await this[_0x46a3e6(0x1b0)][_0x46a3e6(0x1a0)](_0x461ed5,_0x3ba1ba,_0x327b05);}async[a74_0xb59eb3(0x1cc)](_0x197a8b,_0x59d76b,_0x3bd0a0,_0x166c4f){const _0x5c8526=a74_0xb59eb3;return await this[_0x5c8526(0x1b0)]['updateActivation'](_0x197a8b,_0x59d76b,_0x3bd0a0,_0x166c4f);}async[a74_0xb59eb3(0x1b8)](_0x1ca4ab,_0x5d170b,_0x4a4a41){const _0x431b54=a74_0xb59eb3;return await this['client'][_0x431b54(0x1b8)](_0x1ca4ab,_0x5d170b,_0x4a4a41);}async[a74_0xb59eb3(0x181)](_0x25fc52){const _0x4e9dc1=a74_0xb59eb3;return await this[_0x4e9dc1(0x1b0)]['getParentSegmentSQL'](_0x25fc52);}async[a74_0xb59eb3(0x188)](_0x8d97,_0x11e75f){const _0x19825a=a74_0xb59eb3;return await this['client'][_0x19825a(0x188)](_0x8d97,_0x11e75f);}async[a74_0xb59eb3(0x163)](_0xbfdfd9){const _0x419503=a74_0xb59eb3,_0x1f4b3d=await this['listParents'](),_0x48c7a3=_0x1f4b3d['find'](_0x58cab5=>_0x58cab5[_0x419503(0x191)][_0x419503(0x1ba)]===_0xbfdfd9);if(!_0x48c7a3)throw new SDKError(ErrorCode[_0x419503(0x19f)],_0x419503(0x171)+_0xbfdfd9);return _0x48c7a3['id'];}async[a74_0xb59eb3(0x184)](_0xb5a547){const _0x10281a=a74_0xb59eb3;let _0x238fe7=_0xb5a547;return!/^\d+$/[_0x10281a(0x1ae)](_0xb5a547)&&(_0x238fe7=await this[_0x10281a(0x163)](_0xb5a547)),await this['client']['runParentSegment'](_0x238fe7);}async['resolveSegmentId'](_0x91fa65,_0x41ddd3){const _0x11a502=a74_0xb59eb3,_0x30c11e=await this[_0x11a502(0x1b5)](_0x91fa65),_0x32dcbf=_0x30c11e[_0x11a502(0x17d)](_0x4d7b7d=>_0x4d7b7d[_0x11a502(0x1ba)]===_0x41ddd3);if(!_0x32dcbf)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Child\x20segment\x20not\x20found:\x20'+_0x41ddd3+_0x11a502(0x17f)+_0x91fa65);return _0x32dcbf['id'];}async[a74_0xb59eb3(0x1c6)](_0x330a60,_0x410240){const _0x3f7c3b=a74_0xb59eb3,_0x15edb7=await this[_0x3f7c3b(0x17e)](_0x330a60),_0x1ac0a1=_0x15edb7[_0x3f7c3b(0x17d)](_0x58de19=>_0x58de19[_0x3f7c3b(0x1ba)]===_0x410240);if(!_0x1ac0a1)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x3f7c3b(0x176)+_0x410240+'\x20in\x20parent\x20'+_0x330a60);return _0x1ac0a1['id'];}async[a74_0xb59eb3(0x150)](_0x15b67f){const _0x4934d9=a74_0xb59eb3,_0x2b11ce=await this[_0x4934d9(0x1c9)](_0x15b67f),[_0x3684a9,_0xbaa208]=await Promise['all']([this['client'][_0x4934d9(0x182)](_0x2b11ce),this['client']['getAudienceBehaviors'](_0x2b11ce)]),_0x459f0c=[];for(const _0x63e840 of _0x3684a9){_0x459f0c[_0x4934d9(0x157)]({'name':_0x63e840['name'],'type':_0x63e840['type'],'source':_0x4934d9(0x173),'parentDatabaseName':_0x63e840[_0x4934d9(0x1cd)],'parentTableName':_0x63e840[_0x4934d9(0x15a)],'parentColumn':_0x63e840[_0x4934d9(0x1a8)],'groupingName':_0x63e840[_0x4934d9(0x14d)]??undefined});}for(const _0x463d57 of _0xbaa208){const _0xa2c770=_0x463d57['name'];if(_0x463d57[_0x4934d9(0x172)]&&Array[_0x4934d9(0x1c3)](_0x463d57[_0x4934d9(0x172)]))for(const _0x3edb3a of _0x463d57[_0x4934d9(0x172)]){_0x3edb3a['name']&&_0x3edb3a[_0x4934d9(0x1c7)]&&_0x459f0c[_0x4934d9(0x157)]({'name':_0xa2c770+'.'+_0x3edb3a['name'],'type':_0x3edb3a[_0x4934d9(0x1c7)],'source':_0x4934d9(0x17b),'behaviorName':_0xa2c770,'parentDatabaseName':_0x463d57['parentDatabaseName'],'parentTableName':_0x463d57[_0x4934d9(0x15a)],'parentColumn':_0x3edb3a[_0x4934d9(0x1a8)]});}}return _0x459f0c;}async[a74_0xb59eb3(0x16f)](_0x5c3c02){return await this['client']['createParentSegment'](_0x5c3c02);}async[a74_0xb59eb3(0x192)](_0x69c9fd,_0x3125c1){const _0x3375d0=a74_0xb59eb3,_0x183169=await this[_0x3375d0(0x1c9)](_0x69c9fd);return await this['client'][_0x3375d0(0x1c4)](_0x183169,_0x3125c1);}async['getParentFull'](_0x490376){const _0x306c46=a74_0xb59eb3,_0x157f30=await this[_0x306c46(0x1c9)](_0x490376);return await this[_0x306c46(0x1b0)]['getParentSegmentFull'](_0x157f30);}async['pullParentYaml'](_0x1b9295){const _0xd54353=await this['getParentFull'](_0x1b9295),_0x3c3db5=apiToYaml(_0xd54353);return toYamlString(_0x3c3db5);}async['pushParentYaml'](_0xdd6ecf){const _0x2eb129=a74_0xb59eb3,_0xee768f=typeof _0xdd6ecf===_0x2eb129(0x167)?parseYamlString(_0xdd6ecf):_0xdd6ecf,_0x17d8dc=yamlToApi(_0xee768f);let _0x224d76=null,_0x3b8508='';try{_0x224d76=await this[_0x2eb129(0x159)](_0xee768f[_0x2eb129(0x1ba)]);const _0x346e82=apiToYaml(_0x224d76);_0x3b8508=toYamlString(_0x346e82);}catch{}const _0x132a90=toYamlString(_0xee768f),_0x28db4c=generateDiff(_0x3b8508,_0x132a90),_0x36ba1e=formatDiffWithColors(_0x28db4c),_0x5b4af2=_0x224d76===null,_0x5ccdb4=hasChanges(_0x28db4c),_0x51e844={'isNew':_0x5b4af2,'id':_0x224d76?.['id']||'','name':_0xee768f[_0x2eb129(0x1ba)],'diff':_0x28db4c,'diffFormatted':_0x36ba1e,'hasChanges':_0x5ccdb4},_0x48f02b=async()=>{const _0x5f33af=_0x2eb129;return _0x5b4af2?await this[_0x5f33af(0x16f)](_0x17d8dc):await this[_0x5f33af(0x192)](_0x224d76['id'],_0x17d8dc);};return{..._0x51e844,'apply':_0x48f02b};}async['validateParentYaml'](_0x1ff555,_0x5de632={}){const _0x29b1c3=a74_0xb59eb3,_0xa94cc=typeof _0x1ff555===_0x29b1c3(0x167)?parseYamlString(_0x1ff555):_0x1ff555,_0x88ad51=[];let _0x1622f9=!![];const _0x44ee02=_0x3f9192=>_0x5de632[_0x29b1c3(0x1cf)]?.(_0x3f9192),_0x244671={'name':_0xa94cc[_0x29b1c3(0x1ba)],'master':{'database':_0xa94cc[_0x29b1c3(0x185)][_0x29b1c3(0x180)],'table':_0xa94cc[_0x29b1c3(0x185)]['table'],'schemaValid':![]},'attributes':[],'behaviors':[],'errors':_0x88ad51,'allValid':!![]},_0x304ac2=async _0x5e7163=>{const _0x4aeb7f=_0x29b1c3;try{const _0x804ef3=await this['trinoClient'][_0x4aeb7f(0x175)](_0x5e7163);return{'data':_0x804ef3['data']};}catch(_0x27f1f2){const _0xa4de12=_0x27f1f2 instanceof Error?_0x27f1f2[_0x4aeb7f(0x1aa)]:String(_0x27f1f2);return{'data':[],'error':_0xa4de12};}};_0x44ee02(_0x29b1c3(0x162)+_0xa94cc['master'][_0x29b1c3(0x180)]+'.'+_0xa94cc[_0x29b1c3(0x185)]['table']);const _0x5b62db=generateSchemaValidationSQL(_0xa94cc[_0x29b1c3(0x185)]['database'],_0xa94cc[_0x29b1c3(0x185)]['table']),_0x3ea223=await _0x304ac2(_0x5b62db);if(_0x3ea223[_0x29b1c3(0x1b6)])_0x244671['master'][_0x29b1c3(0x183)]=![],_0x244671['master'][_0x29b1c3(0x1ac)]=_0x3ea223[_0x29b1c3(0x1b6)],_0x88ad51[_0x29b1c3(0x157)]('Master\x20table:\x20'+_0x3ea223[_0x29b1c3(0x1b6)]),_0x1622f9=![];else{_0x244671[_0x29b1c3(0x185)]['schemaValid']=!![],_0x44ee02(_0x29b1c3(0x17c));const _0x151599=await _0x304ac2(generateMasterCountSQL(_0xa94cc));!_0x151599['error']&&_0x151599[_0x29b1c3(0x15c)][_0x29b1c3(0x147)]>0x0&&(_0x244671['master'][_0x29b1c3(0x146)]=_0x151599[_0x29b1c3(0x15c)][0x0][_0x29b1c3(0x1a5)]);}if(_0x5de632[_0x29b1c3(0x185)])return _0x244671['allValid']=_0x1622f9,_0x244671;const _0x3db0cb=async _0x8bc90b=>{const _0x39e551=_0x29b1c3,_0x2169dc={'name':_0x8bc90b[_0x39e551(0x1ba)],'database':_0x8bc90b[_0x39e551(0x15f)][_0x39e551(0x180)],'table':_0x8bc90b[_0x39e551(0x15f)][_0x39e551(0x1a6)],'joinKey':_0x8bc90b[_0x39e551(0x153)][_0x39e551(0x1be)],'foreignKey':_0x8bc90b[_0x39e551(0x153)][_0x39e551(0x144)],'columns':getAttributeColumns(_0x8bc90b),'schemaValid':![]};_0x44ee02(_0x39e551(0x189)+_0x8bc90b[_0x39e551(0x1ba)]);const _0x42a8f1=await _0x304ac2(generateAttributeSchemaSQL(_0xa94cc,_0x8bc90b));if(_0x42a8f1['error'])_0x2169dc['schemaError']=_0x42a8f1[_0x39e551(0x1b6)];else{_0x2169dc[_0x39e551(0x183)]=!![],_0x44ee02('Calculating\x20coverage\x20for:\x20'+_0x8bc90b[_0x39e551(0x1ba)]);const _0x452705=await _0x304ac2(generateAttributeCoverageSQL(_0xa94cc,_0x8bc90b));!_0x452705['error']&&_0x452705[_0x39e551(0x15c)][_0x39e551(0x147)]>0x0&&(_0x2169dc['matchedCount']=_0x452705[_0x39e551(0x15c)][0x0][_0x39e551(0x196)],_0x244671['master'][_0x39e551(0x146)]&&_0x244671[_0x39e551(0x185)][_0x39e551(0x146)]>0x0&&(_0x2169dc[_0x39e551(0x1ab)]=_0x2169dc['matchedCount']/_0x244671['master']['rowCount']*0x64));}return _0x2169dc;},_0x49758a=async(_0x431783,_0xe11481)=>{const _0x3d4ec0=_0x29b1c3,_0x5d00c2={'name':_0x431783['name'],'database':_0x431783[_0x3d4ec0(0x15f)][_0x3d4ec0(0x180)],'table':_0x431783[_0x3d4ec0(0x15f)][_0x3d4ec0(0x1a6)],'joinKey':_0x431783['join'][_0x3d4ec0(0x1be)],'foreignKey':_0x431783[_0x3d4ec0(0x153)][_0x3d4ec0(0x144)],'columns':getBehaviorColumns(_0x431783),'schemaValid':![]};_0x44ee02(_0x3d4ec0(0x1bf)+_0x431783['name']);const _0x4c180f=await _0x304ac2(generateBehaviorSchemaSQL(_0xa94cc,_0x431783));if(_0x4c180f[_0x3d4ec0(0x1b6)])_0x5d00c2[_0x3d4ec0(0x1ac)]=_0x4c180f[_0x3d4ec0(0x1b6)];else{_0x5d00c2[_0x3d4ec0(0x183)]=!![],_0x44ee02(_0x3d4ec0(0x1a1)+_0x431783[_0x3d4ec0(0x1ba)]+'\x20('+_0xe11481+')');const _0xde56fb=await _0x304ac2(generateBehaviorStatsSQL(_0xa94cc,_0x431783,_0xe11481));!_0xde56fb[_0x3d4ec0(0x1b6)]&&_0xde56fb['data']['length']>0x0&&(_0x5d00c2[_0x3d4ec0(0x177)]=_0xde56fb[_0x3d4ec0(0x15c)][0x0][_0x3d4ec0(0x18e)],_0x5d00c2[_0x3d4ec0(0x16c)]=_0xde56fb[_0x3d4ec0(0x15c)][0x0][_0x3d4ec0(0x15b)],_0x244671[_0x3d4ec0(0x185)][_0x3d4ec0(0x146)]&&_0x244671[_0x3d4ec0(0x185)]['rowCount']>0x0&&(_0x5d00c2[_0x3d4ec0(0x1ca)]=_0x5d00c2[_0x3d4ec0(0x177)]/_0x244671[_0x3d4ec0(0x185)]['rowCount']*0x64));}return _0x5d00c2;},_0x3c261=(_0x5d1b38,_0x3f0dd4)=>{const _0x1d41ce=_0x29b1c3;_0x244671[_0x1d41ce(0x191)]=_0x5d1b38,_0x244671[_0x1d41ce(0x16b)]=_0x3f0dd4;for(const _0x57dc2c of _0x5d1b38){!_0x57dc2c['schemaValid']&&(_0x88ad51['push'](_0x1d41ce(0x1ad)+_0x57dc2c[_0x1d41ce(0x1ba)]+_0x1d41ce(0x194)+_0x57dc2c[_0x1d41ce(0x1ac)]),_0x1622f9=![]);}for(const _0x218625 of _0x3f0dd4){!_0x218625[_0x1d41ce(0x183)]&&(_0x88ad51[_0x1d41ce(0x157)]('Behavior\x20\x27'+_0x218625[_0x1d41ce(0x1ba)]+_0x1d41ce(0x194)+_0x218625[_0x1d41ce(0x1ac)]),_0x1622f9=![]);}},_0x35c7ee=_0x5de632['interval']||DEFAULT_TIME_RANGE;if(typeof _0x5de632[_0x29b1c3(0x173)]===_0x29b1c3(0x167)){const _0x234d47=findAttributeByName(_0xa94cc,_0x5de632[_0x29b1c3(0x173)]);if(!_0x234d47)throw new SDKError(ErrorCode[_0x29b1c3(0x19f)],_0x29b1c3(0x1ad)+_0x5de632[_0x29b1c3(0x173)]+_0x29b1c3(0x158));const _0x134cbb=await _0x3db0cb(_0x234d47);return _0x3c261([_0x134cbb],[]),_0x244671[_0x29b1c3(0x198)]=_0x1622f9,_0x244671;}if(_0x5de632[_0x29b1c3(0x173)]===!![]){_0x44ee02('Validating\x20all\x20attributes\x20in\x20parallel...');const _0x9b893c=await Promise['all']((_0xa94cc['attributes']||[])[_0x29b1c3(0x149)](_0x3a5021=>_0x3db0cb(_0x3a5021)));return _0x3c261(_0x9b893c,[]),_0x244671['allValid']=_0x1622f9,_0x244671;}if(typeof _0x5de632[_0x29b1c3(0x17b)]===_0x29b1c3(0x167)){const _0x4b5165=findBehaviorByName(_0xa94cc,_0x5de632[_0x29b1c3(0x17b)]);if(!_0x4b5165)throw new SDKError(ErrorCode[_0x29b1c3(0x19f)],_0x29b1c3(0x148)+_0x5de632[_0x29b1c3(0x17b)]+_0x29b1c3(0x158));const _0x5df828=await _0x49758a(_0x4b5165,_0x35c7ee);return _0x3c261([],[_0x5df828]),_0x244671[_0x29b1c3(0x198)]=_0x1622f9,_0x244671;}if(_0x5de632[_0x29b1c3(0x17b)]===!![]){_0x44ee02(_0x29b1c3(0x190));const _0x4836fe=await Promise[_0x29b1c3(0x151)]((_0xa94cc[_0x29b1c3(0x16b)]||[])[_0x29b1c3(0x149)](_0x4c788a=>_0x49758a(_0x4c788a,_0x35c7ee)));return _0x3c261([],_0x4836fe),_0x244671['allValid']=_0x1622f9,_0x244671;}if(_0x5de632[_0x29b1c3(0x178)]){_0x44ee02(_0x29b1c3(0x1a3));const _0x420300=await Promise[_0x29b1c3(0x151)]((_0xa94cc[_0x29b1c3(0x191)]||[])[_0x29b1c3(0x149)](_0x32ec6b=>_0x3db0cb(_0x32ec6b)));return _0x3c261(_0x420300,[]),_0x244671['allValid']=_0x1622f9,_0x244671;}_0x44ee02('Validating\x20all\x20attributes\x20and\x20behaviors\x20in\x20parallel...');const [_0x216762,_0x4a8624]=await Promise[_0x29b1c3(0x151)]([Promise[_0x29b1c3(0x151)]((_0xa94cc[_0x29b1c3(0x191)]||[])['map'](_0x517b11=>_0x3db0cb(_0x517b11))),Promise[_0x29b1c3(0x151)]((_0xa94cc[_0x29b1c3(0x16b)]||[])[_0x29b1c3(0x149)](_0x161f4b=>_0x49758a(_0x161f4b,_0x35c7ee)))]);return _0x3c261(_0x216762,_0x4a8624),_0x244671[_0x29b1c3(0x198)]=_0x1622f9,_0x244671;}async[a74_0xb59eb3(0x160)](_0x36b958,_0x52648e={}){const _0x3bb44f=a74_0xb59eb3,_0x943327=typeof _0x36b958==='string'?parseYamlString(_0x36b958):_0x36b958,_0x1387b4=[];let _0x52cae1=!![];const _0x43b30e=_0xa47f92=>_0x52648e['onProgress']?.(_0xa47f92),_0x2eb8e8={'name':_0x943327['name'],'master':{'database':_0x943327[_0x3bb44f(0x185)][_0x3bb44f(0x180)],'table':_0x943327[_0x3bb44f(0x185)][_0x3bb44f(0x1a6)],'schemaValid':!![]},'attributes':[],'behaviors':[],'errors':_0x1387b4,'allValid':!![]},_0x2dc3ad=async _0x151577=>{const _0xfc0391=_0x3bb44f;try{const _0x55889b=await this[_0xfc0391(0x1b3)][_0xfc0391(0x175)](_0x151577);return{'data':_0x55889b[_0xfc0391(0x15c)]};}catch(_0x29ce8f){const _0x149cec=_0x29ce8f instanceof Error?_0x29ce8f[_0xfc0391(0x1aa)]:String(_0x29ce8f);return{'data':[],'error':_0x149cec};}};if(_0x52648e[_0x3bb44f(0x185)]){_0x43b30e(_0x3bb44f(0x187));const _0x577a67=generateMasterSampleSQL(_0x943327,DEFAULT_SAMPLE_LIMIT),_0x391086=await _0x2dc3ad(_0x577a67);return!_0x391086['error']?_0x2eb8e8[_0x3bb44f(0x19e)]=_0x391086[_0x3bb44f(0x15c)]:(_0x1387b4['push'](_0x3bb44f(0x15d)+_0x391086[_0x3bb44f(0x1b6)]),_0x52cae1=![]),_0x2eb8e8['allValid']=_0x52cae1,_0x2eb8e8;}if(_0x52648e[_0x3bb44f(0x173)]){const _0x39d005=findAttributeByName(_0x943327,_0x52648e[_0x3bb44f(0x173)]);if(!_0x39d005)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x3bb44f(0x1ad)+_0x52648e[_0x3bb44f(0x173)]+'\x27\x20not\x20found');_0x43b30e(_0x3bb44f(0x168)+_0x39d005[_0x3bb44f(0x1ba)]);const _0x4d3cd5=generateAttributeSampleSQL(_0x943327,_0x39d005,DEFAULT_SAMPLE_LIMIT),_0x3b26e5=await _0x2dc3ad(_0x4d3cd5);return!_0x3b26e5[_0x3bb44f(0x1b6)]?_0x2eb8e8[_0x3bb44f(0x19e)]=_0x3b26e5['data']:(_0x1387b4[_0x3bb44f(0x157)](_0x3bb44f(0x1ad)+_0x39d005['name']+_0x3bb44f(0x194)+_0x3b26e5[_0x3bb44f(0x1b6)]),_0x52cae1=![]),_0x2eb8e8[_0x3bb44f(0x198)]=_0x52cae1,_0x2eb8e8;}if(_0x52648e[_0x3bb44f(0x17b)]){const _0x3fa924=findBehaviorByName(_0x943327,_0x52648e[_0x3bb44f(0x17b)]);if(!_0x3fa924)throw new SDKError(ErrorCode[_0x3bb44f(0x19f)],_0x3bb44f(0x148)+_0x52648e[_0x3bb44f(0x17b)]+_0x3bb44f(0x158));const _0x597746=_0x52648e[_0x3bb44f(0x16d)]||DEFAULT_TIME_RANGE;_0x43b30e('Fetching\x20sample\x20data\x20for:\x20'+_0x3fa924[_0x3bb44f(0x1ba)]+'\x20('+_0x597746+')');const _0x2798db=generateBehaviorSampleSQL(_0x943327,_0x3fa924,DEFAULT_SAMPLE_LIMIT,_0x597746),_0x661101=await _0x2dc3ad(_0x2798db);return!_0x661101[_0x3bb44f(0x1b6)]?_0x2eb8e8[_0x3bb44f(0x19e)]=_0x661101[_0x3bb44f(0x15c)]:(_0x1387b4['push']('Behavior\x20\x27'+_0x3fa924['name']+_0x3bb44f(0x194)+_0x661101[_0x3bb44f(0x1b6)]),_0x52cae1=![]),_0x2eb8e8[_0x3bb44f(0x198)]=_0x52cae1,_0x2eb8e8;}if(_0x52648e[_0x3bb44f(0x178)]){_0x43b30e(_0x3bb44f(0x19d));const _0x12f8f3=generateEnrichedSQL(_0x943327,DEFAULT_SAMPLE_LIMIT),_0x2a1d6a=await _0x2dc3ad(_0x12f8f3);return!_0x2a1d6a['error']?_0x2eb8e8[_0x3bb44f(0x19e)]=_0x2a1d6a[_0x3bb44f(0x15c)]:(_0x1387b4[_0x3bb44f(0x157)](_0x3bb44f(0x18f)+_0x2a1d6a[_0x3bb44f(0x1b6)]),_0x52cae1=![]),_0x2eb8e8[_0x3bb44f(0x198)]=_0x52cae1,_0x2eb8e8;}return _0x2eb8e8[_0x3bb44f(0x198)]=_0x52cae1,_0x2eb8e8;}async[a74_0xb59eb3(0x1b7)](_0x491346,_0x136a9e){const _0x59f700=a74_0xb59eb3;return await this[_0x59f700(0x1b0)]['createSegment'](_0x491346,_0x136a9e);}async[a74_0xb59eb3(0x1b4)](_0x3211d6,_0x3f51bc,_0x159bd5){const _0x5a02b8=a74_0xb59eb3;return await this['client'][_0x5a02b8(0x152)](_0x3211d6,_0x3f51bc,_0x159bd5);}async['deleteSegment'](_0x52476d){const _0x3890f3=a74_0xb59eb3;return await this[_0x3890f3(0x1b0)]['deleteSegment'](_0x52476d);}async[a74_0xb59eb3(0x18d)](_0x45163d,_0xddeac8){const _0x4292c5=a74_0xb59eb3,_0x333668=await this['resolveParentIdOrName'](_0x45163d);return await this[_0x4292c5(0x1b0)]['createSegmentFolder'](_0x333668,_0xddeac8);}async[a74_0xb59eb3(0x1c9)](_0x5043dc){const _0x5aedd2=a74_0xb59eb3;if(/^\d+$/[_0x5aedd2(0x1ae)](_0x5043dc))return _0x5043dc;return await this[_0x5aedd2(0x163)](_0x5043dc);}async[a74_0xb59eb3(0x1b2)](_0x1599f2,_0x1bab0f){const _0x4cd338=a74_0xb59eb3,[_0x4cff57,_0x151477]=await Promise['all']([this['resolveFolderId'](_0x1599f2,_0x1bab0f)[_0x4cd338(0x1d2)](()=>!![])[_0x4cd338(0x16a)](()=>![]),this[_0x4cd338(0x1ce)](_0x1599f2,_0x1bab0f)['then'](()=>!![])[_0x4cd338(0x16a)](()=>![])]);if(_0x4cff57&&_0x151477)return _0x4cd338(0x164);else{if(_0x4cff57)return _0x4cd338(0x1a9);else{if(_0x151477)return _0x4cd338(0x1a2);}}throw new SDKError(ErrorCode[_0x4cd338(0x19f)],_0x4cd338(0x18b)+_0x1bab0f+_0x4cd338(0x166));}async[a74_0xb59eb3(0x1af)](_0x87929c,_0x5ade58,_0xbc1e7c){const _0x195ccb=a74_0xb59eb3,[_0x122e64,_0x5bf3db]=await Promise['all']([this['listFolders'](_0x87929c),this[_0x195ccb(0x1b5)](_0x87929c)]),_0x12825a=_0xbc1e7c?_0x122e64[_0x195ccb(0x1bb)](_0x3c6472=>_0x3c6472[_0x195ccb(0x174)]===_0xbc1e7c):_0x122e64[_0x195ccb(0x1bb)](_0x52b63c=>!_0x52b63c[_0x195ccb(0x174)]),_0x2767af=_0xbc1e7c?_0x5bf3db[_0x195ccb(0x1bb)](_0x28b63c=>_0x28b63c[_0x195ccb(0x19a)]===_0xbc1e7c):_0x5bf3db[_0x195ccb(0x1bb)](_0x16b2fe=>!_0x16b2fe[_0x195ccb(0x19a)]),_0x2da38c=_0x12825a['some'](_0x88b009=>_0x88b009[_0x195ccb(0x1ba)]===_0x5ade58),_0x51d574=_0x2767af['some'](_0x528594=>_0x528594['name']===_0x5ade58);if(_0x2da38c&&_0x51d574)return _0x195ccb(0x164);else{if(_0x2da38c)return'folder';else{if(_0x51d574)return _0x195ccb(0x1a2);}}throw new SDKError(ErrorCode[_0x195ccb(0x19f)],_0x195ccb(0x18b)+_0x5ade58+_0x195ccb(0x1bd)+(_0xbc1e7c?_0x195ccb(0x1a9):_0x195ccb(0x156)));}async['traversePath'](_0x1442e2){const _0x4ae1b7=a74_0xb59eb3;if(_0x1442e2['length']===0x0)throw new SDKError(ErrorCode[_0x4ae1b7(0x1c0)],_0x4ae1b7(0x14a));const _0x5e2591=_0x1442e2[0x0],_0x2e0429=await this[_0x4ae1b7(0x163)](_0x5e2591);if(_0x1442e2[_0x4ae1b7(0x147)]===0x1)return{'parentId':_0x2e0429,'parentName':_0x5e2591,'type':_0x4ae1b7(0x169),'fullPath':_0x5e2591};const _0x594ffd=await this['getParentFull'](_0x2e0429),_0x4014e0=_0x594ffd[_0x4ae1b7(0x14f)],_0x15b63b=[];let _0x6632c5=_0x4014e0;for(let _0x1740fe=0x1;_0x1740fe<_0x1442e2[_0x4ae1b7(0x147)]-0x1;_0x1740fe++){const _0x473d82=_0x1442e2[_0x1740fe],_0x5801e7=await this[_0x4ae1b7(0x17e)](_0x2e0429),_0x3f5f7b=_0x6632c5?_0x5801e7[_0x4ae1b7(0x17d)](_0x447549=>_0x447549[_0x4ae1b7(0x1ba)]===_0x473d82&&_0x447549[_0x4ae1b7(0x174)]===_0x6632c5):_0x5801e7['find'](_0x73bd06=>_0x73bd06[_0x4ae1b7(0x1ba)]===_0x473d82&&!_0x73bd06[_0x4ae1b7(0x174)]);if(!_0x3f5f7b)throw new SDKError(ErrorCode[_0x4ae1b7(0x19f)],'Folder\x20\x27'+_0x473d82+_0x4ae1b7(0x14b));_0x15b63b['push'](_0x473d82),_0x6632c5=_0x3f5f7b['id'];}const _0x4a0bc5=_0x1442e2[_0x1442e2['length']-0x1],_0x5e086d=await this[_0x4ae1b7(0x1af)](_0x2e0429,_0x4a0bc5,_0x6632c5);if(_0x5e086d===_0x4ae1b7(0x164)||_0x5e086d===_0x4ae1b7(0x1a9)){const _0x228732=await this['listFolders'](_0x2e0429),_0x3e90be=_0x6632c5?_0x228732[_0x4ae1b7(0x17d)](_0x369766=>_0x369766['name']===_0x4a0bc5&&_0x369766['parentFolderId']===_0x6632c5):_0x228732[_0x4ae1b7(0x17d)](_0x21351b=>_0x21351b[_0x4ae1b7(0x1ba)]===_0x4a0bc5&&!_0x21351b[_0x4ae1b7(0x174)]);if(!_0x3e90be)throw new SDKError(ErrorCode[_0x4ae1b7(0x19f)],_0x4ae1b7(0x15e)+_0x4a0bc5+_0x4ae1b7(0x158));return _0x15b63b['push'](_0x4a0bc5),{'parentId':_0x2e0429,'parentName':_0x5e2591,'folderId':_0x3e90be['id'],'folderPath':_0x15b63b,'type':'folder','fullPath':_0x1442e2[_0x4ae1b7(0x153)]('/')};}else{const _0x496380=await this[_0x4ae1b7(0x1b5)](_0x2e0429),_0x33d4b2=_0x6632c5?_0x496380[_0x4ae1b7(0x17d)](_0xe563b4=>_0xe563b4[_0x4ae1b7(0x1ba)]===_0x4a0bc5&&_0xe563b4[_0x4ae1b7(0x19a)]===_0x6632c5):_0x496380[_0x4ae1b7(0x17d)](_0x4d6ea4=>_0x4d6ea4['name']===_0x4a0bc5&&!_0x4d6ea4['segmentFolderId']);if(!_0x33d4b2)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x4ae1b7(0x145)+_0x4a0bc5+_0x4ae1b7(0x158));return{'parentId':_0x2e0429,'parentName':_0x5e2591,'folderId':_0x6632c5,'folderPath':_0x15b63b['length']>0x0?_0x15b63b:undefined,'segmentId':_0x33d4b2['id'],'segmentName':_0x4a0bc5,'type':'segment','fullPath':_0x1442e2['join']('/')};}}async[a74_0xb59eb3(0x14e)](_0x3a6b66){const _0x9d1055=a74_0xb59eb3,_0xd0e9f3=parsePath(_0x3a6b66);if(!_0xd0e9f3[_0x9d1055(0x18c)])throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x9d1055(0x195));return await this['traversePath'](_0xd0e9f3[_0x9d1055(0x197)]);}async[a74_0xb59eb3(0x1a4)](_0x44b9f9,_0x1d504f){const _0x4a46ab=a74_0xb59eb3,[_0x243bee,_0x2d183c]=await Promise['all']([this['listFolders'](_0x44b9f9),this[_0x4a46ab(0x1b5)](_0x44b9f9)]);if(_0x1d504f){const _0x5b2aca=_0x243bee['filter'](_0x56de61=>_0x56de61[_0x4a46ab(0x174)]===_0x1d504f),_0x1e274e=_0x2d183c[_0x4a46ab(0x1bb)](_0x3bb192=>_0x3bb192[_0x4a46ab(0x19a)]===_0x1d504f);return{'folders':_0x5b2aca,'segments':_0x1e274e};}const _0x2a6dd7=await this[_0x4a46ab(0x159)](_0x44b9f9),_0x4cbd98=_0x2a6dd7[_0x4a46ab(0x14f)];if(_0x4cbd98){const _0x3c0476=_0x243bee[_0x4a46ab(0x1bb)](_0x23b53c=>_0x23b53c[_0x4a46ab(0x174)]===_0x4cbd98),_0x10692f=_0x2d183c['filter'](_0xedda86=>_0xedda86[_0x4a46ab(0x19a)]===_0x4cbd98);return{'folders':_0x3c0476,'segments':_0x10692f};}const _0x2b1792=_0x243bee['filter'](_0x136311=>!_0x136311[_0x4a46ab(0x174)]),_0x180cd8=_0x2d183c['filter'](_0x50c7fa=>!_0x50c7fa[_0x4a46ab(0x19a)]);return{'folders':_0x2b1792,'segments':_0x180cd8};}async['listRecursive'](_0x216a9b,_0x8f6a89,_0x183a8c=0x0,_0x4b9abc=0xa){const _0x3b30ff=a74_0xb59eb3;if(_0x183a8c>=_0x4b9abc)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x3b30ff(0x16e)+_0x4b9abc+_0x3b30ff(0x18a));const {folders:_0x4e7564,segments:_0x1e9357}=await this[_0x3b30ff(0x1a4)](_0x216a9b,_0x8f6a89),_0x21e54a=[];for(const _0x1dc213 of _0x4e7564){const _0x4fe458=await this[_0x3b30ff(0x154)](_0x216a9b,_0x1dc213['id'],_0x183a8c+0x1,_0x4b9abc);_0x21e54a[_0x3b30ff(0x157)]({'type':_0x3b30ff(0x1a9),'id':_0x1dc213['id'],'name':_0x1dc213['name'],'children':_0x4fe458[_0x3b30ff(0x147)]>0x0?_0x4fe458:undefined,'metadata':{'description':_0x1dc213[_0x3b30ff(0x161)]||undefined,'folderCount':_0x4fe458[_0x3b30ff(0x1bb)](_0x438e9e=>_0x438e9e[_0x3b30ff(0x1c7)]===_0x3b30ff(0x1a9))[_0x3b30ff(0x147)],'segmentCount':_0x4fe458['filter'](_0x354a22=>_0x354a22[_0x3b30ff(0x1c7)]===_0x3b30ff(0x1a2))[_0x3b30ff(0x147)],'createdAt':_0x1dc213[_0x3b30ff(0x199)],'updatedAt':_0x1dc213[_0x3b30ff(0x165)]}});}for(const _0x20f684 of _0x1e9357){_0x21e54a[_0x3b30ff(0x157)]({'type':_0x3b30ff(0x1a2),'id':_0x20f684['id'],'name':_0x20f684[_0x3b30ff(0x1ba)],'population':_0x20f684['population'],'metadata':{'description':_0x20f684[_0x3b30ff(0x161)],'createdAt':_0x20f684[_0x3b30ff(0x199)],'updatedAt':_0x20f684[_0x3b30ff(0x165)]}});}return _0x21e54a;}}
|
|
1
|
+
const a74_0x28f6b5=a74_0x371d;(function(_0xf53710,_0x4e84f5){const _0x32856c=a74_0x371d,_0x5ac126=_0xf53710();while(!![]){try{const _0x196712=-parseInt(_0x32856c(0x1b9))/0x1*(-parseInt(_0x32856c(0x1e0))/0x2)+-parseInt(_0x32856c(0x1b8))/0x3+parseInt(_0x32856c(0x22c))/0x4+parseInt(_0x32856c(0x1e9))/0x5*(parseInt(_0x32856c(0x1b7))/0x6)+parseInt(_0x32856c(0x1e6))/0x7+-parseInt(_0x32856c(0x1de))/0x8*(-parseInt(_0x32856c(0x23e))/0x9)+-parseInt(_0x32856c(0x21b))/0xa*(parseInt(_0x32856c(0x23f))/0xb);if(_0x196712===_0x4e84f5)break;else _0x5ac126['push'](_0x5ac126['shift']());}catch(_0xf13673){_0x5ac126['push'](_0x5ac126['shift']());}}}(a74_0xdaa0,0x88665));import{CDPApiClient}from'../client/cdp-api-client.js';import{TrinoApiClient}from'../client/trino-api-client.js';import{SDKError,ErrorCode}from'./errors.js';function a74_0x371d(_0x51dc6f,_0x20a8ba){_0x51dc6f=_0x51dc6f-0x1ad;const _0xdaa093=a74_0xdaa0();let _0x371d86=_0xdaa093[_0x51dc6f];return _0x371d86;}import{parsePath}from'../utils/segment-path-parser.js';import{apiToYaml,yamlToApi,toYamlString,parseYamlString}from'./segment/parent-segment-yaml.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';function a74_0xdaa0(){const _0x5b0bd5=['listFolders','\x27\x20not\x20found','Validating\x20master\x20table:\x20','parent','Segment\x20\x27','matched_count','pullParentYaml','getParent','trinoClient','updateParentSegment','Fetching\x20sample\x20data\x20for:\x20','map','runParent','behaviors','2776456BRkUNp','getParentSegment','parentFolderId','folder','population','schemaValid','onProgress','listSegments','error','table','\x27:\x20','getAudienceBehaviors','previewParentYaml','sampleData','filter','description','logger','string','297shRzeD','11YeoyVa','resolveSegmentId','updateSegment','parentTableName','createSegmentFolder','detectResourceTypeInFolder','Fetching\x20enriched\x20master\x20data...','updateParent','parent_key','attribute','Calculating\x20coverage\x20for:\x20',')\x20exceeded','6UavvKJ','531777pTwoWM','127SmiSbn','row_count','updateActivation','isArray','attributes','customersWithEvents','join','Attribute\x20\x27','parentColumn','groupingName','behavior','allValid','INVALID_ARGUMENT','createSegment','createParentSegment','master','listFields','resolvePathToResource','Folder\x20\x27','listParentSegments','SEGMENT_NOT_FOUND','getSegment','interval','Child\x20segment\x20not\x20found:\x20','executeQuery','\x27\x20not\x20found\x20in\x20','Master\x20table:\x20','type','segment','catch','detectResourceType','getParentSegmentFull','parentDatabaseName','database','pushParentYaml','\x27\x20not\x20found\x20in\x20path','resolveParentId','3112xlMtUN','data','14052mfEwuy','schema','coveragePercent','segmentFolderId','runParentSegment','client','4812934juPgUU','traversePath','customers_with_events','2565755cZnTrW','Behavior\x20\x27','deleteSegment','segments','resolveFolderId','listParents','getSegmentFolder','getActivation','name','some','createActivation','deleteActivation','parent\x20segment','customerPercent','Validating\x20all\x20attributes\x20in\x20parallel...','schemaError','resolveParentIdOrName','listUnified','totalEvents','all','listActivations','enriched','getParentFull','then','push','getFolder','getParentSQL','rowCount','Parent\x20segment\x20not\x20found:\x20','Validating\x20attribute:\x20','Folder\x20not\x20found:\x20','\x20in\x20parent\x20','createParent','test','find','Calculating\x20statistics\x20for:\x20','Resource\x20\x27','Counting\x20master\x20table\x20rows...','listRecursive','Validating\x20all\x20behaviors\x20in\x20parallel...','listSegmentFolders','child_key','getSegmentSQL','source','ambiguous','length','message','updatedAt','Enriched\x20query:\x20','Validating\x20behavior:\x20','20640140jUngus','\x27\x20not\x20found\x20in\x20parent\x20segment','createFolder'];a74_0xdaa0=function(){return _0x5b0bd5;};return a74_0xdaa0();}import{DEFAULT_TIME_RANGE,DEFAULT_SAMPLE_LIMIT,generateSchemaValidationSQL,generateMasterCountSQL,generateMasterSampleSQL,generateAttributeCoverageSQL,generateBehaviorStatsSQL,generateAttributeSampleSQL,generateBehaviorSampleSQL,generateEnrichedSQL,generateAttributeSchemaSQL,generateBehaviorSchemaSQL,findAttributeByName,findBehaviorByName,getAttributeColumns,getBehaviorColumns}from'./segment/parent-segment-preview.js';export class SegmentSDK{[a74_0x28f6b5(0x1e5)];[a74_0x28f6b5(0x226)];constructor(_0x7da21){const _0x4d86f4=a74_0x28f6b5;this[_0x4d86f4(0x1e5)]=new CDPApiClient(_0x7da21,_0x7da21[_0x4d86f4(0x23c)]),this['trinoClient']=new TrinoApiClient(_0x7da21,_0x7da21[_0x4d86f4(0x23c)]);}async[a74_0x28f6b5(0x1ee)](){const _0x409c82=a74_0x28f6b5;return await this['client'][_0x409c82(0x1cc)]();}async[a74_0x28f6b5(0x225)](_0x23a759){const _0x43f9c1=a74_0x28f6b5;return await this[_0x43f9c1(0x1e5)][_0x43f9c1(0x22d)](_0x23a759);}async[a74_0x28f6b5(0x233)](_0x499749){const _0x1596ee=a74_0x28f6b5;return await this[_0x1596ee(0x1e5)][_0x1596ee(0x233)](_0x499749);}async[a74_0x28f6b5(0x1ce)](_0x524fcf,_0x1d116a){const _0x3cfc85=a74_0x28f6b5;return await this[_0x3cfc85(0x1e5)][_0x3cfc85(0x1ce)](_0x524fcf,_0x1d116a);}async['listFolders'](_0x4d34bd){const _0x46cc85=a74_0x28f6b5;return await this['client'][_0x46cc85(0x211)](_0x4d34bd);}async[a74_0x28f6b5(0x202)](_0x387ff9){const _0x3f2360=a74_0x28f6b5;return await this[_0x3f2360(0x1e5)][_0x3f2360(0x1ef)](_0x387ff9);}async[a74_0x28f6b5(0x1fd)](_0x1f54e4,_0x1b83f8){const _0x250914=a74_0x28f6b5;return await this[_0x250914(0x1e5)][_0x250914(0x1fd)](_0x1f54e4,_0x1b83f8);}async['getActivation'](_0x5b95d6,_0x4bf7a0,_0x10c85c){const _0x2d6a1c=a74_0x28f6b5;return await this['client'][_0x2d6a1c(0x1f0)](_0x5b95d6,_0x4bf7a0,_0x10c85c);}async[a74_0x28f6b5(0x1f3)](_0x866b1b,_0x419b3e,_0x389108){const _0x3efdef=a74_0x28f6b5;return await this[_0x3efdef(0x1e5)]['createActivation'](_0x866b1b,_0x419b3e,_0x389108);}async['updateActivation'](_0x566be5,_0x2ba084,_0x681503,_0x5f19b4){const _0xd19bfd=a74_0x28f6b5;return await this[_0xd19bfd(0x1e5)][_0xd19bfd(0x1bb)](_0x566be5,_0x2ba084,_0x681503,_0x5f19b4);}async['deleteActivation'](_0x34fac7,_0x56a2c4,_0x10098b){const _0x3b0154=a74_0x28f6b5;return await this['client'][_0x3b0154(0x1f4)](_0x34fac7,_0x56a2c4,_0x10098b);}async[a74_0x28f6b5(0x203)](_0x478d9f){const _0x5829fb=a74_0x28f6b5;return await this[_0x5829fb(0x1e5)]['getParentSegmentSQL'](_0x478d9f);}async['getSegmentSQL'](_0x39600d,_0x50f830){const _0x534f1f=a74_0x28f6b5;return await this[_0x534f1f(0x1e5)][_0x534f1f(0x213)](_0x39600d,_0x50f830);}async[a74_0x28f6b5(0x1dd)](_0x3a9e73){const _0x29e63a=a74_0x28f6b5,_0x311b96=await this['listParents'](),_0x3076c2=_0x311b96[_0x29e63a(0x20b)](_0x17aa7a=>_0x17aa7a[_0x29e63a(0x1bd)]['name']===_0x3a9e73);if(!_0x3076c2)throw new SDKError(ErrorCode[_0x29e63a(0x1cd)],_0x29e63a(0x205)+_0x3a9e73);return _0x3076c2['id'];}async[a74_0x28f6b5(0x22a)](_0x17c325){const _0x2cbf02=a74_0x28f6b5;let _0x2e41d3=_0x17c325;return!/^\d+$/['test'](_0x17c325)&&(_0x2e41d3=await this[_0x2cbf02(0x1dd)](_0x17c325)),await this[_0x2cbf02(0x1e5)][_0x2cbf02(0x1e4)](_0x2e41d3);}async['resolveSegmentId'](_0x46656e,_0x40d44b){const _0x4fa248=a74_0x28f6b5,_0x547f91=await this['listSegments'](_0x46656e),_0x219a7a=_0x547f91['find'](_0x2ffb7a=>_0x2ffb7a[_0x4fa248(0x1f1)]===_0x40d44b);if(!_0x219a7a)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x4fa248(0x1d0)+_0x40d44b+_0x4fa248(0x208)+_0x46656e);return _0x219a7a['id'];}async[a74_0x28f6b5(0x1ed)](_0x3c948c,_0x2f222a){const _0x1c66ad=a74_0x28f6b5,_0x2d6a90=await this['listFolders'](_0x3c948c),_0x54a23b=_0x2d6a90['find'](_0x52d697=>_0x52d697[_0x1c66ad(0x1f1)]===_0x2f222a);if(!_0x54a23b)throw new SDKError(ErrorCode[_0x1c66ad(0x1cd)],_0x1c66ad(0x207)+_0x2f222a+_0x1c66ad(0x208)+_0x3c948c);return _0x54a23b['id'];}async[a74_0x28f6b5(0x1c9)](_0x7e47e9){const _0x4a9156=a74_0x28f6b5,_0x1f68b6=await this[_0x4a9156(0x1f9)](_0x7e47e9),[_0x1c1a87,_0x41c94d]=await Promise[_0x4a9156(0x1fc)]([this['client']['getAudienceAttributes'](_0x1f68b6),this[_0x4a9156(0x1e5)][_0x4a9156(0x237)](_0x1f68b6)]),_0xbf15bc=[];for(const _0x2368e7 of _0x1c1a87){_0xbf15bc[_0x4a9156(0x201)]({'name':_0x2368e7[_0x4a9156(0x1f1)],'type':_0x2368e7['type'],'source':_0x4a9156(0x1b4),'parentDatabaseName':_0x2368e7['parentDatabaseName'],'parentTableName':_0x2368e7['parentTableName'],'parentColumn':_0x2368e7['parentColumn'],'groupingName':_0x2368e7[_0x4a9156(0x1c2)]??undefined});}for(const _0x13dec2 of _0x41c94d){const _0x21fe19=_0x13dec2[_0x4a9156(0x1f1)];if(_0x13dec2[_0x4a9156(0x1e1)]&&Array[_0x4a9156(0x1bc)](_0x13dec2[_0x4a9156(0x1e1)]))for(const _0x588334 of _0x13dec2[_0x4a9156(0x1e1)]){_0x588334['name']&&_0x588334[_0x4a9156(0x1d4)]&&_0xbf15bc['push']({'name':_0x21fe19+'.'+_0x588334[_0x4a9156(0x1f1)],'type':_0x588334[_0x4a9156(0x1d4)],'source':_0x4a9156(0x1c3),'behaviorName':_0x21fe19,'parentDatabaseName':_0x13dec2[_0x4a9156(0x1d9)],'parentTableName':_0x13dec2[_0x4a9156(0x1ae)],'parentColumn':_0x588334[_0x4a9156(0x1c1)]});}}return _0xbf15bc;}async[a74_0x28f6b5(0x209)](_0x961764){const _0x10f76d=a74_0x28f6b5;return await this[_0x10f76d(0x1e5)][_0x10f76d(0x1c7)](_0x961764);}async[a74_0x28f6b5(0x1b2)](_0x488dba,_0x2331a8){const _0x5a2389=a74_0x28f6b5,_0x17c444=await this['resolveParentIdOrName'](_0x488dba);return await this[_0x5a2389(0x1e5)][_0x5a2389(0x227)](_0x17c444,_0x2331a8);}async[a74_0x28f6b5(0x1ff)](_0x2a80db){const _0x225c29=a74_0x28f6b5,_0x2d8b0d=await this[_0x225c29(0x1f9)](_0x2a80db);return await this['client'][_0x225c29(0x1d8)](_0x2d8b0d);}async[a74_0x28f6b5(0x224)](_0x2e3753){const _0xf6ae9=a74_0x28f6b5,_0x1d90eb=await this[_0xf6ae9(0x1ff)](_0x2e3753),_0x263b11=apiToYaml(_0x1d90eb);return toYamlString(_0x263b11);}async[a74_0x28f6b5(0x1db)](_0x78df11){const _0x19c8b8=a74_0x28f6b5,_0x25cd82=typeof _0x78df11===_0x19c8b8(0x23d)?parseYamlString(_0x78df11):_0x78df11,_0x20e482=yamlToApi(_0x25cd82);let _0x427be1=null,_0x4efa75='';try{_0x427be1=await this[_0x19c8b8(0x1ff)](_0x25cd82[_0x19c8b8(0x1f1)]);const _0x2c2638=apiToYaml(_0x427be1);_0x4efa75=toYamlString(_0x2c2638);}catch{}const _0x229ecc=toYamlString(_0x25cd82),_0x1a8215=generateDiff(_0x4efa75,_0x229ecc),_0x527e05=formatDiffWithColors(_0x1a8215),_0xa3328e=_0x427be1===null,_0x1efee5=hasChanges(_0x1a8215),_0x17678b={'isNew':_0xa3328e,'id':_0x427be1?.['id']||'','name':_0x25cd82[_0x19c8b8(0x1f1)],'diff':_0x1a8215,'diffFormatted':_0x527e05,'hasChanges':_0x1efee5},_0x3416a0=async()=>{const _0x40409f=_0x19c8b8;return _0xa3328e?await this[_0x40409f(0x209)](_0x20e482):await this[_0x40409f(0x1b2)](_0x427be1['id'],_0x20e482);};return{..._0x17678b,'apply':_0x3416a0};}async['validateParentYaml'](_0x612c5a,_0x2d7eac={}){const _0x11dae5=a74_0x28f6b5,_0x67a8ee=typeof _0x612c5a==='string'?parseYamlString(_0x612c5a):_0x612c5a,_0x9ce43d=[];let _0xac4ed5=!![];const _0x4f9e93=_0x5d4869=>_0x2d7eac[_0x11dae5(0x232)]?.(_0x5d4869),_0x4a4b9a={'name':_0x67a8ee[_0x11dae5(0x1f1)],'master':{'database':_0x67a8ee[_0x11dae5(0x1c8)][_0x11dae5(0x1da)],'table':_0x67a8ee[_0x11dae5(0x1c8)][_0x11dae5(0x235)],'schemaValid':![]},'attributes':[],'behaviors':[],'errors':_0x9ce43d,'allValid':!![]},_0x285ab1=async _0x10e57d=>{const _0x4a6527=_0x11dae5;try{const _0x57d266=await this[_0x4a6527(0x226)][_0x4a6527(0x1d1)](_0x10e57d);return{'data':_0x57d266['data']};}catch(_0x383b00){const _0x250e06=_0x383b00 instanceof Error?_0x383b00[_0x4a6527(0x217)]:String(_0x383b00);return{'data':[],'error':_0x250e06};}};_0x4f9e93(_0x11dae5(0x220)+_0x67a8ee['master'][_0x11dae5(0x1da)]+'.'+_0x67a8ee[_0x11dae5(0x1c8)]['table']);const _0x4660e0=generateSchemaValidationSQL(_0x67a8ee[_0x11dae5(0x1c8)][_0x11dae5(0x1da)],_0x67a8ee[_0x11dae5(0x1c8)][_0x11dae5(0x235)]),_0x3d3e66=await _0x285ab1(_0x4660e0);if(_0x3d3e66[_0x11dae5(0x234)])_0x4a4b9a['master']['schemaValid']=![],_0x4a4b9a[_0x11dae5(0x1c8)][_0x11dae5(0x1f8)]=_0x3d3e66['error'],_0x9ce43d[_0x11dae5(0x201)](_0x11dae5(0x1d3)+_0x3d3e66[_0x11dae5(0x234)]),_0xac4ed5=![];else{_0x4a4b9a['master'][_0x11dae5(0x231)]=!![],_0x4f9e93(_0x11dae5(0x20e));const _0x477b12=await _0x285ab1(generateMasterCountSQL(_0x67a8ee));!_0x477b12[_0x11dae5(0x234)]&&_0x477b12[_0x11dae5(0x1df)][_0x11dae5(0x216)]>0x0&&(_0x4a4b9a[_0x11dae5(0x1c8)][_0x11dae5(0x204)]=_0x477b12[_0x11dae5(0x1df)][0x0][_0x11dae5(0x1ba)]);}if(_0x2d7eac[_0x11dae5(0x1c8)])return _0x4a4b9a[_0x11dae5(0x1c4)]=_0xac4ed5,_0x4a4b9a;const _0x5dddb1=async _0x4d6d09=>{const _0x550573=_0x11dae5,_0x183229={'name':_0x4d6d09[_0x550573(0x1f1)],'database':_0x4d6d09['source'][_0x550573(0x1da)],'table':_0x4d6d09[_0x550573(0x214)][_0x550573(0x235)],'joinKey':_0x4d6d09['join'][_0x550573(0x212)],'foreignKey':_0x4d6d09[_0x550573(0x1bf)][_0x550573(0x1b3)],'columns':getAttributeColumns(_0x4d6d09),'schemaValid':![]};_0x4f9e93(_0x550573(0x206)+_0x4d6d09[_0x550573(0x1f1)]);const _0x5de673=await _0x285ab1(generateAttributeSchemaSQL(_0x67a8ee,_0x4d6d09));if(_0x5de673[_0x550573(0x234)])_0x183229['schemaError']=_0x5de673[_0x550573(0x234)];else{_0x183229[_0x550573(0x231)]=!![],_0x4f9e93(_0x550573(0x1b5)+_0x4d6d09[_0x550573(0x1f1)]);const _0x166dee=await _0x285ab1(generateAttributeCoverageSQL(_0x67a8ee,_0x4d6d09));!_0x166dee[_0x550573(0x234)]&&_0x166dee[_0x550573(0x1df)][_0x550573(0x216)]>0x0&&(_0x183229['matchedCount']=_0x166dee['data'][0x0][_0x550573(0x223)],_0x4a4b9a[_0x550573(0x1c8)]['rowCount']&&_0x4a4b9a[_0x550573(0x1c8)][_0x550573(0x204)]>0x0&&(_0x183229[_0x550573(0x1e2)]=_0x183229['matchedCount']/_0x4a4b9a[_0x550573(0x1c8)][_0x550573(0x204)]*0x64));}return _0x183229;},_0x3b0adb=async(_0x4c3a50,_0x212ab1)=>{const _0x1aee5b=_0x11dae5,_0x118a67={'name':_0x4c3a50[_0x1aee5b(0x1f1)],'database':_0x4c3a50[_0x1aee5b(0x214)][_0x1aee5b(0x1da)],'table':_0x4c3a50[_0x1aee5b(0x214)][_0x1aee5b(0x235)],'joinKey':_0x4c3a50[_0x1aee5b(0x1bf)][_0x1aee5b(0x212)],'foreignKey':_0x4c3a50['join'][_0x1aee5b(0x1b3)],'columns':getBehaviorColumns(_0x4c3a50),'schemaValid':![]};_0x4f9e93(_0x1aee5b(0x21a)+_0x4c3a50['name']);const _0x2a4e32=await _0x285ab1(generateBehaviorSchemaSQL(_0x67a8ee,_0x4c3a50));if(_0x2a4e32[_0x1aee5b(0x234)])_0x118a67[_0x1aee5b(0x1f8)]=_0x2a4e32[_0x1aee5b(0x234)];else{_0x118a67[_0x1aee5b(0x231)]=!![],_0x4f9e93(_0x1aee5b(0x20c)+_0x4c3a50[_0x1aee5b(0x1f1)]+'\x20('+_0x212ab1+')');const _0x433ceb=await _0x285ab1(generateBehaviorStatsSQL(_0x67a8ee,_0x4c3a50,_0x212ab1));!_0x433ceb[_0x1aee5b(0x234)]&&_0x433ceb['data'][_0x1aee5b(0x216)]>0x0&&(_0x118a67[_0x1aee5b(0x1be)]=_0x433ceb[_0x1aee5b(0x1df)][0x0][_0x1aee5b(0x1e8)],_0x118a67[_0x1aee5b(0x1fb)]=_0x433ceb[_0x1aee5b(0x1df)][0x0]['total_events'],_0x4a4b9a['master'][_0x1aee5b(0x204)]&&_0x4a4b9a[_0x1aee5b(0x1c8)][_0x1aee5b(0x204)]>0x0&&(_0x118a67[_0x1aee5b(0x1f6)]=_0x118a67[_0x1aee5b(0x1be)]/_0x4a4b9a[_0x1aee5b(0x1c8)][_0x1aee5b(0x204)]*0x64));}return _0x118a67;},_0x56b0ab=(_0x609322,_0x519cf4)=>{const _0x4b9492=_0x11dae5;_0x4a4b9a[_0x4b9492(0x1bd)]=_0x609322,_0x4a4b9a[_0x4b9492(0x22b)]=_0x519cf4;for(const _0x4c73d5 of _0x609322){!_0x4c73d5[_0x4b9492(0x231)]&&(_0x9ce43d['push'](_0x4b9492(0x1c0)+_0x4c73d5[_0x4b9492(0x1f1)]+'\x27:\x20'+_0x4c73d5['schemaError']),_0xac4ed5=![]);}for(const _0x2a498b of _0x519cf4){!_0x2a498b[_0x4b9492(0x231)]&&(_0x9ce43d['push'](_0x4b9492(0x1ea)+_0x2a498b[_0x4b9492(0x1f1)]+_0x4b9492(0x236)+_0x2a498b[_0x4b9492(0x1f8)]),_0xac4ed5=![]);}},_0x426d5d=_0x2d7eac['interval']||DEFAULT_TIME_RANGE;if(typeof _0x2d7eac[_0x11dae5(0x1b4)]===_0x11dae5(0x23d)){const _0x1b6d64=findAttributeByName(_0x67a8ee,_0x2d7eac[_0x11dae5(0x1b4)]);if(!_0x1b6d64)throw new SDKError(ErrorCode[_0x11dae5(0x1cd)],'Attribute\x20\x27'+_0x2d7eac[_0x11dae5(0x1b4)]+_0x11dae5(0x21f));const _0x51c6f5=await _0x5dddb1(_0x1b6d64);return _0x56b0ab([_0x51c6f5],[]),_0x4a4b9a[_0x11dae5(0x1c4)]=_0xac4ed5,_0x4a4b9a;}if(_0x2d7eac[_0x11dae5(0x1b4)]===!![]){_0x4f9e93(_0x11dae5(0x1f7));const _0x1ad96d=await Promise[_0x11dae5(0x1fc)]((_0x67a8ee['attributes']||[])[_0x11dae5(0x229)](_0x300992=>_0x5dddb1(_0x300992)));return _0x56b0ab(_0x1ad96d,[]),_0x4a4b9a[_0x11dae5(0x1c4)]=_0xac4ed5,_0x4a4b9a;}if(typeof _0x2d7eac['behavior']===_0x11dae5(0x23d)){const _0x568e05=findBehaviorByName(_0x67a8ee,_0x2d7eac['behavior']);if(!_0x568e05)throw new SDKError(ErrorCode[_0x11dae5(0x1cd)],_0x11dae5(0x1ea)+_0x2d7eac[_0x11dae5(0x1c3)]+'\x27\x20not\x20found');const _0x467d3b=await _0x3b0adb(_0x568e05,_0x426d5d);return _0x56b0ab([],[_0x467d3b]),_0x4a4b9a[_0x11dae5(0x1c4)]=_0xac4ed5,_0x4a4b9a;}if(_0x2d7eac[_0x11dae5(0x1c3)]===!![]){_0x4f9e93(_0x11dae5(0x210));const _0x38b6bf=await Promise[_0x11dae5(0x1fc)]((_0x67a8ee[_0x11dae5(0x22b)]||[])[_0x11dae5(0x229)](_0x5946e6=>_0x3b0adb(_0x5946e6,_0x426d5d)));return _0x56b0ab([],_0x38b6bf),_0x4a4b9a[_0x11dae5(0x1c4)]=_0xac4ed5,_0x4a4b9a;}if(_0x2d7eac[_0x11dae5(0x1fe)]){_0x4f9e93('Validating\x20all\x20attributes\x20in\x20parallel...');const _0x1dd61e=await Promise[_0x11dae5(0x1fc)]((_0x67a8ee[_0x11dae5(0x1bd)]||[])[_0x11dae5(0x229)](_0x8396db=>_0x5dddb1(_0x8396db)));return _0x56b0ab(_0x1dd61e,[]),_0x4a4b9a[_0x11dae5(0x1c4)]=_0xac4ed5,_0x4a4b9a;}_0x4f9e93('Validating\x20all\x20attributes\x20and\x20behaviors\x20in\x20parallel...');const [_0x594d90,_0x3501b2]=await Promise[_0x11dae5(0x1fc)]([Promise[_0x11dae5(0x1fc)]((_0x67a8ee[_0x11dae5(0x1bd)]||[])['map'](_0x1e4f7f=>_0x5dddb1(_0x1e4f7f))),Promise['all']((_0x67a8ee['behaviors']||[])['map'](_0x52e337=>_0x3b0adb(_0x52e337,_0x426d5d)))]);return _0x56b0ab(_0x594d90,_0x3501b2),_0x4a4b9a[_0x11dae5(0x1c4)]=_0xac4ed5,_0x4a4b9a;}async[a74_0x28f6b5(0x238)](_0x286312,_0x4d85bf={}){const _0x822988=a74_0x28f6b5,_0x31ca37=typeof _0x286312===_0x822988(0x23d)?parseYamlString(_0x286312):_0x286312,_0x11683c=[];let _0xb7f08e=!![];const _0x2de16e=_0xd249dd=>_0x4d85bf['onProgress']?.(_0xd249dd),_0x3439aa={'name':_0x31ca37[_0x822988(0x1f1)],'master':{'database':_0x31ca37[_0x822988(0x1c8)][_0x822988(0x1da)],'table':_0x31ca37['master']['table'],'schemaValid':!![]},'attributes':[],'behaviors':[],'errors':_0x11683c,'allValid':!![]},_0xd50355=async _0x1b6c5c=>{const _0x5034ca=_0x822988;try{const _0x6e93b6=await this[_0x5034ca(0x226)][_0x5034ca(0x1d1)](_0x1b6c5c);return{'data':_0x6e93b6[_0x5034ca(0x1df)]};}catch(_0x383dab){const _0x394136=_0x383dab instanceof Error?_0x383dab[_0x5034ca(0x217)]:String(_0x383dab);return{'data':[],'error':_0x394136};}};if(_0x4d85bf[_0x822988(0x1c8)]){_0x2de16e('Fetching\x20master\x20sample\x20data...');const _0x34f836=generateMasterSampleSQL(_0x31ca37,DEFAULT_SAMPLE_LIMIT),_0xcb586b=await _0xd50355(_0x34f836);return!_0xcb586b[_0x822988(0x234)]?_0x3439aa[_0x822988(0x239)]=_0xcb586b[_0x822988(0x1df)]:(_0x11683c[_0x822988(0x201)]('Master\x20table:\x20'+_0xcb586b[_0x822988(0x234)]),_0xb7f08e=![]),_0x3439aa[_0x822988(0x1c4)]=_0xb7f08e,_0x3439aa;}if(_0x4d85bf[_0x822988(0x1b4)]){const _0x1b4fb4=findAttributeByName(_0x31ca37,_0x4d85bf[_0x822988(0x1b4)]);if(!_0x1b4fb4)throw new SDKError(ErrorCode[_0x822988(0x1cd)],'Attribute\x20\x27'+_0x4d85bf['attribute']+'\x27\x20not\x20found');_0x2de16e(_0x822988(0x228)+_0x1b4fb4[_0x822988(0x1f1)]);const _0x26448b=generateAttributeSampleSQL(_0x31ca37,_0x1b4fb4,DEFAULT_SAMPLE_LIMIT),_0x4e1705=await _0xd50355(_0x26448b);return!_0x4e1705[_0x822988(0x234)]?_0x3439aa[_0x822988(0x239)]=_0x4e1705[_0x822988(0x1df)]:(_0x11683c['push'](_0x822988(0x1c0)+_0x1b4fb4[_0x822988(0x1f1)]+_0x822988(0x236)+_0x4e1705[_0x822988(0x234)]),_0xb7f08e=![]),_0x3439aa[_0x822988(0x1c4)]=_0xb7f08e,_0x3439aa;}if(_0x4d85bf['behavior']){const _0x863772=findBehaviorByName(_0x31ca37,_0x4d85bf[_0x822988(0x1c3)]);if(!_0x863772)throw new SDKError(ErrorCode[_0x822988(0x1cd)],_0x822988(0x1ea)+_0x4d85bf[_0x822988(0x1c3)]+_0x822988(0x21f));const _0x4baff9=_0x4d85bf[_0x822988(0x1cf)]||DEFAULT_TIME_RANGE;_0x2de16e(_0x822988(0x228)+_0x863772['name']+'\x20('+_0x4baff9+')');const _0xed58cb=generateBehaviorSampleSQL(_0x31ca37,_0x863772,DEFAULT_SAMPLE_LIMIT,_0x4baff9),_0x2fecb1=await _0xd50355(_0xed58cb);return!_0x2fecb1[_0x822988(0x234)]?_0x3439aa[_0x822988(0x239)]=_0x2fecb1[_0x822988(0x1df)]:(_0x11683c[_0x822988(0x201)](_0x822988(0x1ea)+_0x863772[_0x822988(0x1f1)]+_0x822988(0x236)+_0x2fecb1[_0x822988(0x234)]),_0xb7f08e=![]),_0x3439aa[_0x822988(0x1c4)]=_0xb7f08e,_0x3439aa;}if(_0x4d85bf[_0x822988(0x1fe)]){_0x2de16e(_0x822988(0x1b1));const _0x23ec8f=generateEnrichedSQL(_0x31ca37,DEFAULT_SAMPLE_LIMIT),_0x140bcc=await _0xd50355(_0x23ec8f);return!_0x140bcc['error']?_0x3439aa[_0x822988(0x239)]=_0x140bcc['data']:(_0x11683c[_0x822988(0x201)](_0x822988(0x219)+_0x140bcc[_0x822988(0x234)]),_0xb7f08e=![]),_0x3439aa[_0x822988(0x1c4)]=_0xb7f08e,_0x3439aa;}return _0x3439aa[_0x822988(0x1c4)]=_0xb7f08e,_0x3439aa;}async[a74_0x28f6b5(0x1c6)](_0x12ff04,_0x34888d){const _0x37afcc=a74_0x28f6b5;return await this['client'][_0x37afcc(0x1c6)](_0x12ff04,_0x34888d);}async['updateSegmentById'](_0x4948a9,_0x26947b,_0x5abe44){const _0x372b2a=a74_0x28f6b5;return await this[_0x372b2a(0x1e5)][_0x372b2a(0x1ad)](_0x4948a9,_0x26947b,_0x5abe44);}async[a74_0x28f6b5(0x1eb)](_0x1ec807){const _0x1fda42=a74_0x28f6b5;return await this[_0x1fda42(0x1e5)]['deleteSegment'](_0x1ec807);}async[a74_0x28f6b5(0x21d)](_0x230d25,_0x15c85b){const _0x5556f3=a74_0x28f6b5,_0x490e38=await this[_0x5556f3(0x1f9)](_0x230d25);return await this['client'][_0x5556f3(0x1af)](_0x490e38,_0x15c85b);}async[a74_0x28f6b5(0x1f9)](_0x1cafa6){const _0x55c5c0=a74_0x28f6b5;if(/^\d+$/[_0x55c5c0(0x20a)](_0x1cafa6))return _0x1cafa6;return await this[_0x55c5c0(0x1dd)](_0x1cafa6);}async[a74_0x28f6b5(0x1d7)](_0x5c45cd,_0x1ecccf){const _0x11cc02=a74_0x28f6b5,[_0x45dff8,_0x49dcc0]=await Promise[_0x11cc02(0x1fc)]([this['resolveFolderId'](_0x5c45cd,_0x1ecccf)[_0x11cc02(0x200)](()=>!![])[_0x11cc02(0x1d6)](()=>![]),this[_0x11cc02(0x240)](_0x5c45cd,_0x1ecccf)[_0x11cc02(0x200)](()=>!![])[_0x11cc02(0x1d6)](()=>![])]);if(_0x45dff8&&_0x49dcc0)return _0x11cc02(0x215);else{if(_0x45dff8)return _0x11cc02(0x22f);else{if(_0x49dcc0)return _0x11cc02(0x1d5);}}throw new SDKError(ErrorCode[_0x11cc02(0x1cd)],_0x11cc02(0x20d)+_0x1ecccf+_0x11cc02(0x21c));}async[a74_0x28f6b5(0x1b0)](_0x21b0d2,_0x267fb4,_0x5aef83){const _0x36597e=a74_0x28f6b5,[_0x2bbdc6,_0x1d2b3f]=await Promise[_0x36597e(0x1fc)]([this['listFolders'](_0x21b0d2),this[_0x36597e(0x233)](_0x21b0d2)]),_0x419be6=_0x5aef83?_0x2bbdc6[_0x36597e(0x23a)](_0x391f84=>_0x391f84[_0x36597e(0x22e)]===_0x5aef83):_0x2bbdc6['filter'](_0x570344=>!_0x570344[_0x36597e(0x22e)]),_0x3c76c7=_0x5aef83?_0x1d2b3f['filter'](_0x466044=>_0x466044['segmentFolderId']===_0x5aef83):_0x1d2b3f[_0x36597e(0x23a)](_0x2a7b90=>!_0x2a7b90['segmentFolderId']),_0x462d62=_0x419be6[_0x36597e(0x1f2)](_0x3427b4=>_0x3427b4[_0x36597e(0x1f1)]===_0x267fb4),_0x5d572c=_0x3c76c7[_0x36597e(0x1f2)](_0x59ffc5=>_0x59ffc5[_0x36597e(0x1f1)]===_0x267fb4);if(_0x462d62&&_0x5d572c)return _0x36597e(0x215);else{if(_0x462d62)return _0x36597e(0x22f);else{if(_0x5d572c)return _0x36597e(0x1d5);}}throw new SDKError(ErrorCode[_0x36597e(0x1cd)],_0x36597e(0x20d)+_0x267fb4+_0x36597e(0x1d2)+(_0x5aef83?'folder':_0x36597e(0x1f5)));}async['traversePath'](_0x3c6dff){const _0x48a97b=a74_0x28f6b5;if(_0x3c6dff[_0x48a97b(0x216)]===0x0)throw new SDKError(ErrorCode[_0x48a97b(0x1c5)],'Path\x20cannot\x20be\x20empty');const _0x3f55fe=_0x3c6dff[0x0],_0x5642e1=await this[_0x48a97b(0x1dd)](_0x3f55fe);if(_0x3c6dff['length']===0x1)return{'parentId':_0x5642e1,'parentName':_0x3f55fe,'type':_0x48a97b(0x221),'fullPath':_0x3f55fe};const _0x5b5614=await this[_0x48a97b(0x1ff)](_0x5642e1),_0x2e07aa=_0x5b5614['rootFolderId'],_0x1a6c11=[];let _0x44fcd3=_0x2e07aa;for(let _0xb3f001=0x1;_0xb3f001<_0x3c6dff['length']-0x1;_0xb3f001++){const _0x231ddc=_0x3c6dff[_0xb3f001],_0x54e87f=await this[_0x48a97b(0x21e)](_0x5642e1),_0xee4f2e=_0x44fcd3?_0x54e87f[_0x48a97b(0x20b)](_0x3bf783=>_0x3bf783[_0x48a97b(0x1f1)]===_0x231ddc&&_0x3bf783[_0x48a97b(0x22e)]===_0x44fcd3):_0x54e87f[_0x48a97b(0x20b)](_0x341c8e=>_0x341c8e[_0x48a97b(0x1f1)]===_0x231ddc&&!_0x341c8e[_0x48a97b(0x22e)]);if(!_0xee4f2e)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x48a97b(0x1cb)+_0x231ddc+_0x48a97b(0x1dc));_0x1a6c11[_0x48a97b(0x201)](_0x231ddc),_0x44fcd3=_0xee4f2e['id'];}const _0x20c15c=_0x3c6dff[_0x3c6dff[_0x48a97b(0x216)]-0x1],_0x568a89=await this[_0x48a97b(0x1b0)](_0x5642e1,_0x20c15c,_0x44fcd3);if(_0x568a89===_0x48a97b(0x215)||_0x568a89===_0x48a97b(0x22f)){const _0x5a9083=await this['listFolders'](_0x5642e1),_0x5528ce=_0x44fcd3?_0x5a9083['find'](_0x410b7f=>_0x410b7f['name']===_0x20c15c&&_0x410b7f['parentFolderId']===_0x44fcd3):_0x5a9083[_0x48a97b(0x20b)](_0x1c4c5=>_0x1c4c5[_0x48a97b(0x1f1)]===_0x20c15c&&!_0x1c4c5[_0x48a97b(0x22e)]);if(!_0x5528ce)throw new SDKError(ErrorCode[_0x48a97b(0x1cd)],_0x48a97b(0x1cb)+_0x20c15c+_0x48a97b(0x21f));return _0x1a6c11['push'](_0x20c15c),{'parentId':_0x5642e1,'parentName':_0x3f55fe,'folderId':_0x5528ce['id'],'folderPath':_0x1a6c11,'type':_0x48a97b(0x22f),'fullPath':_0x3c6dff['join']('/')};}else{const _0x5e6637=await this[_0x48a97b(0x233)](_0x5642e1),_0x205f3a=_0x44fcd3?_0x5e6637[_0x48a97b(0x20b)](_0x9ef59a=>_0x9ef59a[_0x48a97b(0x1f1)]===_0x20c15c&&_0x9ef59a[_0x48a97b(0x1e3)]===_0x44fcd3):_0x5e6637['find'](_0x2567b6=>_0x2567b6[_0x48a97b(0x1f1)]===_0x20c15c&&!_0x2567b6['segmentFolderId']);if(!_0x205f3a)throw new SDKError(ErrorCode[_0x48a97b(0x1cd)],_0x48a97b(0x222)+_0x20c15c+_0x48a97b(0x21f));return{'parentId':_0x5642e1,'parentName':_0x3f55fe,'folderId':_0x44fcd3,'folderPath':_0x1a6c11[_0x48a97b(0x216)]>0x0?_0x1a6c11:undefined,'segmentId':_0x205f3a['id'],'segmentName':_0x20c15c,'type':_0x48a97b(0x1d5),'fullPath':_0x3c6dff['join']('/')};}}async[a74_0x28f6b5(0x1ca)](_0xbd1f6e){const _0x448361=a74_0x28f6b5,_0x28e281=parsePath(_0xbd1f6e);if(!_0x28e281['isAbsolute'])throw new SDKError(ErrorCode[_0x448361(0x1c5)],'Path\x20must\x20be\x20absolute\x20(cannot\x20start\x20with\x20.\x20or\x20..)');return await this[_0x448361(0x1e7)](_0x28e281[_0x448361(0x1ec)]);}async[a74_0x28f6b5(0x1fa)](_0x39300c,_0x2e2ae5){const _0xa18a74=a74_0x28f6b5,[_0x20bd0f,_0xbf0156]=await Promise[_0xa18a74(0x1fc)]([this[_0xa18a74(0x21e)](_0x39300c),this[_0xa18a74(0x233)](_0x39300c)]);if(_0x2e2ae5){const _0x516b17=_0x20bd0f[_0xa18a74(0x23a)](_0x45791e=>_0x45791e[_0xa18a74(0x22e)]===_0x2e2ae5),_0x52a652=_0xbf0156[_0xa18a74(0x23a)](_0x1aeef7=>_0x1aeef7['segmentFolderId']===_0x2e2ae5);return{'folders':_0x516b17,'segments':_0x52a652};}const _0x3c9b65=await this[_0xa18a74(0x1ff)](_0x39300c),_0xddfd83=_0x3c9b65['rootFolderId'];if(_0xddfd83){const _0x259cc3=_0x20bd0f[_0xa18a74(0x23a)](_0x5b75b8=>_0x5b75b8[_0xa18a74(0x22e)]===_0xddfd83),_0x2a3677=_0xbf0156[_0xa18a74(0x23a)](_0x236f35=>_0x236f35['segmentFolderId']===_0xddfd83);return{'folders':_0x259cc3,'segments':_0x2a3677};}const _0x40cf28=_0x20bd0f[_0xa18a74(0x23a)](_0x45962b=>!_0x45962b['parentFolderId']),_0x5428be=_0xbf0156[_0xa18a74(0x23a)](_0x301b34=>!_0x301b34[_0xa18a74(0x1e3)]);return{'folders':_0x40cf28,'segments':_0x5428be};}async['listRecursive'](_0x448f91,_0x3870f2,_0x2f02d7=0x0,_0x585858=0xa){const _0x21e6cd=a74_0x28f6b5;if(_0x2f02d7>=_0x585858)throw new SDKError(ErrorCode[_0x21e6cd(0x1c5)],'Maximum\x20recursion\x20depth\x20('+_0x585858+_0x21e6cd(0x1b6));const {folders:_0xb54fe6,segments:_0x47adcf}=await this['listUnified'](_0x448f91,_0x3870f2),_0x1c16df=[];for(const _0x19b17a of _0xb54fe6){const _0xab871c=await this[_0x21e6cd(0x20f)](_0x448f91,_0x19b17a['id'],_0x2f02d7+0x1,_0x585858);_0x1c16df[_0x21e6cd(0x201)]({'type':_0x21e6cd(0x22f),'id':_0x19b17a['id'],'name':_0x19b17a['name'],'children':_0xab871c[_0x21e6cd(0x216)]>0x0?_0xab871c:undefined,'metadata':{'description':_0x19b17a[_0x21e6cd(0x23b)]||undefined,'folderCount':_0xab871c[_0x21e6cd(0x23a)](_0x265dc3=>_0x265dc3['type']==='folder')['length'],'segmentCount':_0xab871c['filter'](_0x901bdc=>_0x901bdc[_0x21e6cd(0x1d4)]===_0x21e6cd(0x1d5))[_0x21e6cd(0x216)],'createdAt':_0x19b17a['createdAt'],'updatedAt':_0x19b17a[_0x21e6cd(0x218)]}});}for(const _0x56dd81 of _0x47adcf){_0x1c16df[_0x21e6cd(0x201)]({'type':_0x21e6cd(0x1d5),'id':_0x56dd81['id'],'name':_0x56dd81['name'],'population':_0x56dd81[_0x21e6cd(0x230)],'metadata':{'description':_0x56dd81['description'],'createdAt':_0x56dd81['createdAt'],'updatedAt':_0x56dd81['updatedAt']}});}return _0x1c16df;}}
|
package/dist/sdk/user.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a75_0x5539(_0x503014,_0x577340){_0x503014=_0x503014-0x155;const _0x10b727=a75_0x10b7();let _0x55395e=_0x10b727[_0x503014];return _0x55395e;}const a75_0x893ec0=a75_0x5539;(function(_0x4091e4,_0x3fb02f){const _0x25c812=a75_0x5539,_0x7c8d91=_0x4091e4();while(!![]){try{const _0x247caf=-parseInt(_0x25c812(0x169))/0x1+-parseInt(_0x25c812(0x15d))/0x2*(-parseInt(_0x25c812(0x157))/0x3)+parseInt(_0x25c812(0x164))/0x4*(-parseInt(_0x25c812(0x163))/0x5)+-parseInt(_0x25c812(0x161))/0x6+parseInt(_0x25c812(0x160))/0x7*(-parseInt(_0x25c812(0x16d))/0x8)+-parseInt(_0x25c812(0x15a))/0x9+-parseInt(_0x25c812(0x165))/0xa*(-parseInt(_0x25c812(0x15b))/0xb);if(_0x247caf===_0x3fb02f)break;else _0x7c8d91['push'](_0x7c8d91['shift']());}catch(_0x5e8c7d){_0x7c8d91['push'](_0x7c8d91['shift']());}}}(a75_0x10b7,0x723aa));import{TDApiClient}from'../client/td-api-client.js';function a75_0x10b7(){const _0x72cc5d=['client','email','7cqZQlz','3277308lIAyAO','profile','128500FaDNiY','56nsCRXt','4965230ToLslB','find','default','buildEmailToIdMap','139025MVJmKw','listUsers','map','buildUserMaps','6680056oTIGrW','toLowerCase','list','getCurrent','1077804LONHeo','findByEmail','findById','4445559cPcQet','55pNlVcx','buildIdToEmailMap','2RUcjWq'];a75_0x10b7=function(){return _0x72cc5d;};return a75_0x10b7();}import{loadCachedUsers,saveCachedUsers,clearUserCache}from'../core/user-cache.js';export class UserSDK{['client'];[a75_0x893ec0(0x162)];constructor(_0x4e2ea2){const _0x2bd615=a75_0x893ec0;this[_0x2bd615(0x15e)]=new TDApiClient(_0x4e2ea2,_0x4e2ea2['logger']),this[_0x2bd615(0x162)]=_0x4e2ea2[_0x2bd615(0x162)]||_0x2bd615(0x167);}async[a75_0x893ec0(0x156)](){const _0x4dee12=a75_0x893ec0;return await this[_0x4dee12(0x15e)]['getUserInfo']();}async[a75_0x893ec0(0x155)](_0x276a73=![]){const _0x80f65f=a75_0x893ec0;if(!_0x276a73){const _0x1f95c9=loadCachedUsers(this[_0x80f65f(0x162)]);if(_0x1f95c9)return _0x1f95c9;}const _0x43d2f9=await this[_0x80f65f(0x15e)][_0x80f65f(0x16a)]();return saveCachedUsers(this[_0x80f65f(0x162)],_0x43d2f9),_0x43d2f9;}['clearCache'](){const _0x283cea=a75_0x893ec0;clearUserCache(this[_0x283cea(0x162)]);}async[a75_0x893ec0(0x158)](_0x4231dd){const _0x4ab87d=a75_0x893ec0,_0x3d2f79=await this[_0x4ab87d(0x155)]();return _0x3d2f79[_0x4ab87d(0x166)](_0xe4d61f=>_0xe4d61f[_0x4ab87d(0x15f)][_0x4ab87d(0x16e)]()===_0x4231dd['toLowerCase']());}async[a75_0x893ec0(0x159)](_0x591229){const _0x1a170c=a75_0x893ec0,_0x3abd0c=await this['list']();return _0x3abd0c[_0x1a170c(0x166)](_0x1a2d1c=>_0x1a2d1c['id']===_0x591229);}async[a75_0x893ec0(0x168)](){const _0x227216=a75_0x893ec0,_0x6cf172=await this[_0x227216(0x155)]();return new Map(_0x6cf172[_0x227216(0x16b)](_0x4d8479=>[_0x4d8479['email'][_0x227216(0x16e)](),_0x4d8479['id']]));}async[a75_0x893ec0(0x15c)](){const _0x1aed0d=a75_0x893ec0,_0x3d8a1f=await this[_0x1aed0d(0x155)]();return new Map(_0x3d8a1f[_0x1aed0d(0x16b)](_0x4677f6=>[_0x4677f6['id'],_0x4677f6['email']]));}async[a75_0x893ec0(0x16c)](){const _0x5c645d=a75_0x893ec0,_0x34c7ea=await this[_0x5c645d(0x155)]();return{'emailToId':new Map(_0x34c7ea[_0x5c645d(0x16b)](_0x440cb2=>[_0x440cb2[_0x5c645d(0x15f)][_0x5c645d(0x16e)](),_0x440cb2['id']])),'idToEmail':new Map(_0x34c7ea[_0x5c645d(0x16b)](_0xae634a=>[_0xae634a['id'],_0xae634a[_0x5c645d(0x15f)]]))};}}
|
package/dist/sdk/workflow.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a76_0x4dbd(_0x36b040,_0x22c6e9){_0x36b040=_0x36b040-0x1ab;const _0x392bec=a76_0x392b();let _0x4dbdca=_0x392bec[_0x36b040];return _0x4dbdca;}const a76_0x49062f=a76_0x4dbd;(function(_0x2c25b2,_0x25d041){const _0x45675d=a76_0x4dbd,_0x1ed1b8=_0x2c25b2();while(!![]){try{const _0x4fa270=-parseInt(_0x45675d(0x1b8))/0x1*(-parseInt(_0x45675d(0x1c2))/0x2)+parseInt(_0x45675d(0x1d0))/0x3+-parseInt(_0x45675d(0x1db))/0x4+parseInt(_0x45675d(0x1cd))/0x5+-parseInt(_0x45675d(0x1ee))/0x6+-parseInt(_0x45675d(0x1c6))/0x7+-parseInt(_0x45675d(0x1f5))/0x8*(parseInt(_0x45675d(0x1f4))/0x9);if(_0x4fa270===_0x25d041)break;else _0x1ed1b8['push'](_0x1ed1b8['shift']());}catch(_0x5ad269){_0x1ed1b8['push'](_0x1ed1b8['shift']());}}}(a76_0x392b,0xafdbb));import{WorkflowApiClient}from'../client/workflow-client.js';import{shouldIncludeInArchive,WORKFLOW_FILE_EXTENSION}from'../utils/workflow-utils.js';export class WorkflowSDK{static ['NUMERIC_ID_PATTERN']=/^\d+$/;[a76_0x49062f(0x20a)];constructor(_0x563e76){const _0x56e2fa=a76_0x49062f;this[_0x56e2fa(0x20a)]=new WorkflowApiClient(_0x563e76,_0x563e76[_0x56e2fa(0x1ec)]);}async['resolveProjectId'](_0x8b4c1a){const _0x5ad7d4=a76_0x49062f;if(WorkflowSDK[_0x5ad7d4(0x1bd)][_0x5ad7d4(0x208)](_0x8b4c1a))return{'id':_0x8b4c1a,'name':_0x8b4c1a};const _0x3fccde=await this[_0x5ad7d4(0x20a)][_0x5ad7d4(0x1bf)]({'name_pattern':_0x8b4c1a}),_0x18d641=_0x3fccde[_0x5ad7d4(0x1e5)]['find'](_0x492df3=>_0x492df3[_0x5ad7d4(0x1d6)]===_0x8b4c1a);if(!_0x18d641)throw new Error(_0x5ad7d4(0x1fe)+_0x8b4c1a);return{'id':_0x18d641['id'],'name':_0x18d641['name']};}async[a76_0x49062f(0x1d8)](_0x3ffbc2,_0x66773f){const _0x37d0c0=a76_0x49062f,_0x52c49c=await this[_0x37d0c0(0x20a)][_0x37d0c0(0x1bf)]({'name_pattern':_0x3ffbc2,..._0x66773f});return _0x52c49c[_0x37d0c0(0x1e5)][_0x37d0c0(0x1b9)](_0x39276b=>({..._0x39276b,'project_id':_0x39276b['id'],'project_name':_0x39276b[_0x37d0c0(0x1d6)]}));}async[a76_0x49062f(0x1fc)](_0x2f06c3,_0x33de5e){const _0x9536c0=a76_0x49062f,_0x1350e4=await this['client'][_0x9536c0(0x1fa)]({'project_name':_0x2f06c3,..._0x33de5e});return _0x1350e4[_0x9536c0(0x1e5)][_0x9536c0(0x1b9)](_0x29bc44=>({'project_id':_0x29bc44[_0x9536c0(0x1e3)]?.['id'],'project_name':_0x29bc44[_0x9536c0(0x1e3)]?.[_0x9536c0(0x1d6)],'workflow_id':_0x29bc44['id'],'workflow_name':_0x29bc44[_0x9536c0(0x1d6)],'revision':_0x29bc44[_0x9536c0(0x1b2)],'timezone':_0x29bc44[_0x9536c0(0x1b6)],'config':_0x29bc44['config'],'id':_0x29bc44['id'],'name':_0x29bc44[_0x9536c0(0x1d6)],'project':_0x29bc44['project']}));}async[a76_0x49062f(0x1bb)](_0x3c1f5f){const _0x21dc3c=a76_0x49062f;let _0x4a6b51;if(_0x3c1f5f?.[_0x21dc3c(0x1af)]){let _0x4b43ce,_0x3881f5=![];while(!_0x3881f5){const _0x232291=await this['client'][_0x21dc3c(0x1bf)]({'limit':0x64,'last_id':_0x4b43ce}),_0x34f592=_0x232291[_0x21dc3c(0x1e5)][_0x21dc3c(0x1c3)](_0x1b6323=>_0x1b6323[_0x21dc3c(0x1d6)]===_0x3c1f5f[_0x21dc3c(0x1af)]);if(_0x34f592){_0x4a6b51=_0x34f592['id'],_0x3881f5=!![];break;}if(!_0x232291[_0x21dc3c(0x1e2)]||_0x232291[_0x21dc3c(0x1e5)][_0x21dc3c(0x1f9)]===0x0)break;_0x4b43ce=_0x232291[_0x21dc3c(0x1e2)];}if(!_0x4a6b51)throw new Error('Project\x20not\x20found:\x20'+_0x3c1f5f['projectName']);}const _0x17b09a=await this['client']['listSessions']({'project_id':_0x4a6b51,'project_name':_0x3c1f5f?.[_0x21dc3c(0x1af)],'workflow_name':_0x3c1f5f?.[_0x21dc3c(0x1be)],'status':_0x3c1f5f?.[_0x21dc3c(0x1dd)],'from_time':_0x3c1f5f?.['fromTime'],'to_time':_0x3c1f5f?.['toTime'],'limit':_0x3c1f5f?.[_0x21dc3c(0x1ac)],'last_id':_0x3c1f5f?.[_0x21dc3c(0x1d5)]});return _0x17b09a[_0x21dc3c(0x1e5)]['map'](_0xa777c4=>({'project_id':_0xa777c4[_0x21dc3c(0x1e3)]?.['id'],'project_name':_0xa777c4[_0x21dc3c(0x1e3)]?.[_0x21dc3c(0x1d6)],'workflow_id':_0xa777c4['workflow']?.['id'],'workflow_name':_0xa777c4[_0x21dc3c(0x1e9)]?.[_0x21dc3c(0x1d6)],'session_id':_0xa777c4['id'],'sessionUuid':_0xa777c4[_0x21dc3c(0x1d7)],'sessionTime':_0xa777c4[_0x21dc3c(0x1b0)],'lastAttempt':_0xa777c4[_0x21dc3c(0x1b7)],'id':_0xa777c4['id'],'project':_0xa777c4[_0x21dc3c(0x1e3)],'workflow':_0xa777c4[_0x21dc3c(0x1e9)]}));}async[a76_0x49062f(0x1c4)](_0x5c4c05){const _0x31ea6f=a76_0x49062f,_0x5836ca=await this[_0x31ea6f(0x20a)][_0x31ea6f(0x1da)]({'project_name':_0x5c4c05?.[_0x31ea6f(0x1af)],'workflow_name':_0x5c4c05?.[_0x31ea6f(0x1be)],'include_retried':_0x5c4c05?.[_0x31ea6f(0x209)],'limit':_0x5c4c05?.[_0x31ea6f(0x1ac)],'last_id':_0x5c4c05?.[_0x31ea6f(0x1d5)]});return _0x5836ca[_0x31ea6f(0x1e5)][_0x31ea6f(0x1b9)](_0x432b3c=>({'project_id':_0x432b3c[_0x31ea6f(0x1e3)]?.['id'],'project_name':_0x432b3c[_0x31ea6f(0x1e3)]?.[_0x31ea6f(0x1d6)],'workflow_id':_0x432b3c[_0x31ea6f(0x1e9)]?.['id'],'workflow_name':_0x432b3c[_0x31ea6f(0x1e9)]?.['name'],'session_id':_0x432b3c[_0x31ea6f(0x1b5)],'sessionUuid':_0x432b3c[_0x31ea6f(0x1d7)],'sessionTime':_0x432b3c[_0x31ea6f(0x1b0)],'attempt_id':_0x432b3c['id'],'attempt_index':_0x432b3c['index'],'retryAttemptName':_0x432b3c[_0x31ea6f(0x1b4)],'done':_0x432b3c[_0x31ea6f(0x1fb)],'success':_0x432b3c[_0x31ea6f(0x1e6)],'cancelRequested':_0x432b3c[_0x31ea6f(0x1ae)],'params':_0x432b3c[_0x31ea6f(0x1f3)],'createdAt':_0x432b3c[_0x31ea6f(0x1c9)],'finishedAt':_0x432b3c[_0x31ea6f(0x1ad)],'id':_0x432b3c['id'],'index':_0x432b3c[_0x31ea6f(0x1c1)],'project':_0x432b3c[_0x31ea6f(0x1e3)],'workflow':_0x432b3c['workflow']}));}async[a76_0x49062f(0x1f7)](_0x43776d){const _0x5532bb=a76_0x49062f,_0xe7c34f=await this[_0x5532bb(0x20a)][_0x5532bb(0x20f)](_0x43776d);return _0xe7c34f;}async[a76_0x49062f(0x1ed)](_0x539d30,_0x4bd9df=![]){const _0x73064d=a76_0x49062f,_0x2b8e78=await this[_0x73064d(0x20a)][_0x73064d(0x214)](_0x539d30,_0x4bd9df);return _0x2b8e78['map'](_0x3b7ca0=>({'task_id':_0x3b7ca0['id'],'task_name':_0x3b7ca0[_0x73064d(0x1ef)],'parentId':_0x3b7ca0[_0x73064d(0x1e7)],'config':_0x3b7ca0[_0x73064d(0x1f2)],'upstreams':_0x3b7ca0[_0x73064d(0x1c0)],'state':_0x3b7ca0[_0x73064d(0x1d4)],'exportParams':_0x3b7ca0['exportParams'],'storeParams':_0x3b7ca0[_0x73064d(0x1e4)],'stateParams':_0x3b7ca0['stateParams'],'updatedAt':_0x3b7ca0[_0x73064d(0x205)],'retryAt':_0x3b7ca0[_0x73064d(0x1dc)],'startedAt':_0x3b7ca0['startedAt'],'error':_0x3b7ca0[_0x73064d(0x1df)],'isGroup':_0x3b7ca0[_0x73064d(0x1ce)],'id':_0x3b7ca0['id'],'fullName':_0x3b7ca0[_0x73064d(0x1ef)]}));}async[a76_0x49062f(0x200)](_0x36c653,_0x2ec1a6){const _0x35c6cc=a76_0x49062f;return await this[_0x35c6cc(0x20a)][_0x35c6cc(0x1ea)](_0x36c653,_0x2ec1a6);}async['logs'](_0x19109d,_0x47e2b4){const _0x59777b=a76_0x49062f,_0x1ab32f=await import(_0x59777b(0x1f8)),{promisify:_0xdab664}=await import('util'),_0x1c7b51=_0xdab664(_0x1ab32f[_0x59777b(0x204)]),_0x340b30=await this[_0x59777b(0x20a)][_0x59777b(0x1ea)](_0x19109d,_0x47e2b4);if(_0x340b30['length']===0x0)return'';const _0x28484a=[];for(const _0x1cced5 of _0x340b30){if(!_0x1cced5['direct'])continue;const _0x4772de=await fetch(_0x1cced5['direct']);if(!_0x4772de['ok'])throw new Error('Failed\x20to\x20download\x20log\x20file:\x20'+_0x4772de['status']);const _0x54479d=Buffer[_0x59777b(0x211)](await _0x4772de[_0x59777b(0x1cc)]()),_0x3504fd=await _0x1c7b51(_0x54479d);_0x28484a[_0x59777b(0x1d3)](_0x3504fd[_0x59777b(0x20c)](_0x59777b(0x1d1)));}return _0x28484a[_0x59777b(0x1bc)]('\x0a');}async[a76_0x49062f(0x207)](_0x49fc35,_0x2b9939){const _0x133b7a=a76_0x49062f,_0x47be7d=await this[_0x133b7a(0x20a)][_0x133b7a(0x1b1)](_0x49fc35,_0x2b9939);return _0x47be7d?.[_0x133b7a(0x206)]??'Kill\x20request\x20accepted';}async[a76_0x49062f(0x201)](_0x595acd,_0x2e3f32){const _0x432ef4=a76_0x49062f,_0x3614f0=await this[_0x432ef4(0x20a)]['retrySession'](_0x595acd,{'from_task':_0x2e3f32?.[_0x432ef4(0x20b)],'retry_params':_0x2e3f32?.['retryParams']});return{'attemptId':_0x3614f0['id'],'sessionId':_0x3614f0['sessionId']};}async[a76_0x49062f(0x1e8)](_0x412929,_0xfd029e){const _0x2d500a=a76_0x49062f,_0x46ccb7=await this[_0x2d500a(0x20a)][_0x2d500a(0x1e8)](_0x412929,{'resume_from':_0xfd029e?.['resumeFrom'],'retry_params':_0xfd029e?.['retryParams'],'force':_0xfd029e?.[_0x2d500a(0x1eb)]});return{'attemptId':_0x46ccb7['id'],'sessionId':_0x46ccb7[_0x2d500a(0x1b5)]};}async['run'](_0x4d8ddd,_0x218d93={},_0x341e00){const _0x42c85a=a76_0x49062f,_0x3e4442=_0x4d8ddd['indexOf']('.');let _0x3a6981,_0x51dfea;if(_0x3e4442===-0x1)throw new Error(_0x42c85a(0x1d9));_0x3a6981=_0x4d8ddd[_0x42c85a(0x1e0)](0x0,_0x3e4442),_0x51dfea=_0x4d8ddd[_0x42c85a(0x1e0)](_0x3e4442+0x1);if(!_0x3a6981||!_0x51dfea)throw new Error(_0x42c85a(0x20d)+_0x4d8ddd+_0x42c85a(0x1cb));const _0x596951=_0x341e00?.[_0x42c85a(0x1b0)]||new Date()[_0x42c85a(0x212)]();return await this[_0x42c85a(0x20a)]['startAttempt']({'projectName':_0x3a6981,'workflowName':_0x51dfea,'sessionTime':_0x596951,'params':_0x218d93});}async['download'](_0x45a27b,_0xd9d07f,_0x413164){const _0x7f4619=a76_0x49062f,{promises:_0x38f0cf}=await import('fs'),_0x2ed26a=await import(_0x7f4619(0x20e)),_0x12026b=await import('os'),_0xdfef83=await import(_0x7f4619(0x202)),{id:_0x423306,name:_0x201248}=await this['resolveProjectId'](_0x45a27b),_0x5b1238=_0x12026b[_0x7f4619(0x1d2)](),_0x1050e0=_0x2ed26a[_0x7f4619(0x1bc)](_0x5b1238,_0x7f4619(0x1ab)+_0x423306+'-'+Date[_0x7f4619(0x1c8)]()+_0x7f4619(0x215));try{await this[_0x7f4619(0x20a)][_0x7f4619(0x1de)](_0x423306,_0x1050e0,_0x413164?.[_0x7f4619(0x1b2)]);const _0x2535de=_0x2ed26a[_0x7f4619(0x1bc)](_0xd9d07f,_0x201248);await _0x38f0cf[_0x7f4619(0x1cf)](_0x2535de,{'recursive':!![]}),await _0xdfef83['extract']({'file':_0x1050e0,'cwd':_0x2535de,'gzip':!![]});const _0x1510e5=async _0x31c07c=>{const _0x57f430=_0x7f4619;let _0x1477fb=0x0;const _0x1f674f=await _0x38f0cf[_0x57f430(0x1b3)](_0x31c07c,{'withFileTypes':!![]});for(const _0x94a505 of _0x1f674f){const _0x2a7493=_0x2ed26a[_0x57f430(0x1bc)](_0x31c07c,_0x94a505[_0x57f430(0x1d6)]);if(_0x94a505[_0x57f430(0x1e1)]())_0x1477fb++;else _0x94a505[_0x57f430(0x210)]()&&(_0x1477fb+=await _0x1510e5(_0x2a7493));}return _0x1477fb;},_0xe3e561=await _0x1510e5(_0x2535de);return{'projectName':_0x201248,'revision':_0x413164?.[_0x7f4619(0x1b2)]||'latest','filesExtracted':_0xe3e561};}finally{try{await _0x38f0cf[_0x7f4619(0x1f1)](_0x1050e0);}catch{}}}async[a76_0x49062f(0x1d3)](_0x2a13fe,_0x317c6f){const _0x5ebf0b=a76_0x49062f,{promises:_0x497751}=await import('fs'),_0x5cbfa7=await import(_0x5ebf0b(0x20e)),_0x2961f3=await import(_0x5ebf0b(0x202)),_0x275c4a=_0x317c6f?.[_0x5ebf0b(0x1af)]||_0x5cbfa7[_0x5ebf0b(0x1f6)](_0x2a13fe),_0x503f71=_0x317c6f?.[_0x5ebf0b(0x1b2)]||new Date()[_0x5ebf0b(0x212)]()['replace'](/[:.]/g,'-');try{await _0x497751[_0x5ebf0b(0x1c5)](_0x2a13fe);}catch{throw new Error(_0x5ebf0b(0x1c7)+_0x2a13fe);}if(!_0x317c6f?.['skipValidation']){const _0x15ade9=await _0x497751['readdir'](_0x2a13fe),_0x2b09cd=_0x15ade9[_0x5ebf0b(0x1fd)](_0x497863=>_0x497863['endsWith'](WORKFLOW_FILE_EXTENSION));if(_0x2b09cd['length']===0x0)throw new Error('No\x20'+WORKFLOW_FILE_EXTENSION+'\x20workflow\x20files\x20found\x20in\x20project\x20directory');for(const _0x9fefd7 of _0x2b09cd){const _0x17cb64=_0x5cbfa7[_0x5ebf0b(0x1bc)](_0x2a13fe,_0x9fefd7);try{await _0x497751[_0x5ebf0b(0x1c5)](_0x17cb64);}catch{throw new Error('Cannot\x20read\x20workflow\x20file:\x20'+_0x9fefd7);}}}const _0x428ba7=async(_0xa00b02,_0x3cb588='')=>{const _0x16e04f=_0x5ebf0b,_0x2889ca=await _0x497751[_0x16e04f(0x1b3)](_0xa00b02,{'withFileTypes':!![]}),_0x22897e=[];for(const _0x4dc1c7 of _0x2889ca){const _0x1cd1f2=_0x5cbfa7['join'](_0x3cb588,_0x4dc1c7[_0x16e04f(0x1d6)]),_0x172496=_0x5cbfa7[_0x16e04f(0x1bc)](_0xa00b02,_0x4dc1c7[_0x16e04f(0x1d6)]);if(!shouldIncludeInArchive(_0x4dc1c7[_0x16e04f(0x1d6)]))continue;_0x4dc1c7[_0x16e04f(0x210)]()?_0x22897e[_0x16e04f(0x1d3)](...await _0x428ba7(_0x172496,_0x1cd1f2)):_0x22897e['push'](_0x1cd1f2);}return _0x22897e;},_0x2c3297=await _0x428ba7(_0x2a13fe),_0x39ac7b=await import('os'),_0x1910b0=_0x39ac7b[_0x5ebf0b(0x1d2)](),_0x2b9c3a=_0x5cbfa7[_0x5ebf0b(0x1bc)](_0x1910b0,_0x5ebf0b(0x1ba)+Date[_0x5ebf0b(0x1c8)]()+_0x5ebf0b(0x215));try{await _0x2961f3[_0x5ebf0b(0x1ca)]({'file':_0x2b9c3a,'gzip':!![],'cwd':_0x2a13fe,'portable':!![]},_0x2c3297);const _0x5dc2ad=await this['client'][_0x5ebf0b(0x1ff)](_0x275c4a,_0x503f71,_0x2b9c3a,{'scheduleFrom':_0x317c6f?.[_0x5ebf0b(0x203)],'clearSchedule':_0x317c6f?.['clearSchedule'],'clearScheduleAll':_0x317c6f?.['clearScheduleAll']});return{'projectId':_0x5dc2ad['id'],'projectName':_0x5dc2ad['name'],'revision':_0x5dc2ad[_0x5ebf0b(0x1b2)]};}finally{try{await _0x497751[_0x5ebf0b(0x1f1)](_0x2b9c3a);}catch{}}}async['delete'](_0x46f8ba){const _0x43375b=a76_0x49062f,{id:_0x453c2d}=await this[_0x43375b(0x213)](_0x46f8ba),_0x3f1cab=await this[_0x43375b(0x20a)][_0x43375b(0x1f0)](_0x453c2d);return{'projectId':_0x3f1cab['id'],'projectName':_0x3f1cab['name']};}}function a76_0x392b(){const _0x395541=['push','state','last_id','name','sessionUuid','projects','Workflow\x20must\x20be\x20specified\x20as\x20\x22project.workflow\x22\x20format','listAttempts','493364UzbWov','retryAt','status','downloadProjectArchive','error','substring','isFile','lastId','project','storeParams','data','success','parentId','retryAttempt','workflow','listLogFiles','force','logger','tasks','4938732tlpBEV','fullName','deleteProject','unlink','config','params','9DIjHRq','4864792CwXjBv','basename','attempt','zlib','length','listWorkflows','done','workflows','filter','Project\x20not\x20found:\x20','uploadProjectArchive','logFiles','retrySession','tar','scheduleFrom','gunzip','updatedAt','message','kill','test','includeRetried','client','fromTask','toString','Invalid\x20workflow\x20format:\x20','path','getAttempt','isDirectory','from','toISOString','resolveProjectId','getAttemptTasks','.tar.gz','tdx-workflow-','limit','finishedAt','cancelRequested','projectName','sessionTime','killAttempt','revision','readdir','retryAttemptName','sessionId','timezone','lastAttempt','1gjBxoL','map','tdx-workflow-push-','sessions','join','NUMERIC_ID_PATTERN','workflowName','listProjects','upstreams','index','2293096QEduon','find','attempts','access','6175757xVDHeP','Project\x20directory\x20not\x20found:\x20','now','createdAt','create','.\x20Expected\x20\x22project.workflow\x22','arrayBuffer','4207120NaSFBM','isGroup','mkdir','3507468ivIzsw','utf-8','tmpdir'];a76_0x392b=function(){return _0x395541;};return a76_0x392b();}
|
|
1
|
+
const a76_0x24ec84=a76_0x5640;function a76_0x5640(_0x7ad714,_0x514287){_0x7ad714=_0x7ad714-0x193;const _0x10d48f=a76_0x10d4();let _0x5640ea=_0x10d48f[_0x7ad714];return _0x5640ea;}(function(_0x2b4085,_0x57c256){const _0x4d36fc=a76_0x5640,_0x1ddb7e=_0x2b4085();while(!![]){try{const _0x35892e=-parseInt(_0x4d36fc(0x1a0))/0x1+-parseInt(_0x4d36fc(0x1dc))/0x2+parseInt(_0x4d36fc(0x1b4))/0x3+-parseInt(_0x4d36fc(0x1f7))/0x4+parseInt(_0x4d36fc(0x1d9))/0x5+parseInt(_0x4d36fc(0x1db))/0x6*(-parseInt(_0x4d36fc(0x1b3))/0x7)+parseInt(_0x4d36fc(0x1d0))/0x8;if(_0x35892e===_0x57c256)break;else _0x1ddb7e['push'](_0x1ddb7e['shift']());}catch(_0xe8d9c5){_0x1ddb7e['push'](_0x1ddb7e['shift']());}}}(a76_0x10d4,0x8b971));import{WorkflowApiClient}from'../client/workflow-client.js';function a76_0x10d4(){const _0x24a238=['listLogFiles','upstreams','success','5561460IvmMLr','filter','204ZcJzBq','713304OdGCte','message','.\x20Expected\x20\x22project.workflow\x22','listWorkflows','config','client','status','clearScheduleAll','latest','isDirectory','force','tmpdir','create','killAttempt','projectName','getAttemptTasks','toString','toTime','tdx-workflow-','mkdir','index','push','logs','Invalid\x20workflow\x20format:\x20','map','done','tar','4247676HiVSIk','createdAt','No\x20','retryAttempt','getAttempt','data','run','readdir','fromTime','deleteProject','listSessions','join','cancelRequested','download','toISOString','workflowName','workflow','access','replace','1135808mJqAXr','util','retryParams','unlink','name','uploadProjectArchive','delete','indexOf','listAttempts','.tar.gz','zlib','last_id','state','revision','Cannot\x20read\x20workflow\x20file:\x20','gunzip','attempts','\x20workflow\x20files\x20found\x20in\x20project\x20directory','arrayBuffer','218918jdnWKj','1168611lUIHVe','scheduleFrom','listProjects','sessionUuid','sessionTime','tasks','kill','direct','fullName','lastId','params','isFile','isGroup','sessions','find','extract','tdx-workflow-push-','sessionId','endsWith','path','limit','now','length','substring','project','retrySession','utf-8','NUMERIC_ID_PATTERN','21501016ATYmEr','Failed\x20to\x20download\x20log\x20file:\x20','storeParams','includeRetried','Project\x20not\x20found:\x20','resolveProjectId'];a76_0x10d4=function(){return _0x24a238;};return a76_0x10d4();}import{shouldIncludeInArchive,WORKFLOW_FILE_EXTENSION}from'../utils/workflow-utils.js';export class WorkflowSDK{static ['NUMERIC_ID_PATTERN']=/^\d+$/;[a76_0x24ec84(0x1e1)];constructor(_0x20de38){this['client']=new WorkflowApiClient(_0x20de38,_0x20de38['logger']);}async[a76_0x24ec84(0x1d5)](_0x377efb){const _0x4382c8=a76_0x24ec84;if(WorkflowSDK[_0x4382c8(0x1cf)]['test'](_0x377efb))return{'id':_0x377efb,'name':_0x377efb};const _0x2b7805=await this['client'][_0x4382c8(0x1b6)]({'name_pattern':_0x377efb}),_0xbbc671=_0x2b7805[_0x4382c8(0x1fc)][_0x4382c8(0x1c2)](_0xb449f2=>_0xb449f2[_0x4382c8(0x1a4)]===_0x377efb);if(!_0xbbc671)throw new Error(_0x4382c8(0x1d4)+_0x377efb);return{'id':_0xbbc671['id'],'name':_0xbbc671[_0x4382c8(0x1a4)]};}async['projects'](_0x39cde4,_0x58d846){const _0x2e8877=a76_0x24ec84,_0x41bac9=await this[_0x2e8877(0x1e1)][_0x2e8877(0x1b6)]({'name_pattern':_0x39cde4,..._0x58d846});return _0x41bac9[_0x2e8877(0x1fc)][_0x2e8877(0x1f4)](_0x62c0d=>({..._0x62c0d,'project_id':_0x62c0d['id'],'project_name':_0x62c0d[_0x2e8877(0x1a4)]}));}async['workflows'](_0x44eebb,_0x3493bd){const _0x1345e3=a76_0x24ec84,_0x34236e=await this[_0x1345e3(0x1e1)][_0x1345e3(0x1df)]({'project_name':_0x44eebb,..._0x3493bd});return _0x34236e[_0x1345e3(0x1fc)][_0x1345e3(0x1f4)](_0x1e533f=>({'project_id':_0x1e533f[_0x1345e3(0x1cc)]?.['id'],'project_name':_0x1e533f[_0x1345e3(0x1cc)]?.[_0x1345e3(0x1a4)],'workflow_id':_0x1e533f['id'],'workflow_name':_0x1e533f[_0x1345e3(0x1a4)],'revision':_0x1e533f[_0x1345e3(0x1ad)],'timezone':_0x1e533f['timezone'],'config':_0x1e533f[_0x1345e3(0x1e0)],'id':_0x1e533f['id'],'name':_0x1e533f[_0x1345e3(0x1a4)],'project':_0x1e533f['project']}));}async[a76_0x24ec84(0x1c1)](_0x5e2ad4){const _0x3e297b=a76_0x24ec84;let _0x2eefbf;if(_0x5e2ad4?.[_0x3e297b(0x1ea)]){let _0x3afbf7,_0x2fc330=![];while(!_0x2fc330){const _0x1caa04=await this[_0x3e297b(0x1e1)][_0x3e297b(0x1b6)]({'limit':0x64,'last_id':_0x3afbf7}),_0x4db156=_0x1caa04[_0x3e297b(0x1fc)][_0x3e297b(0x1c2)](_0x330b0a=>_0x330b0a[_0x3e297b(0x1a4)]===_0x5e2ad4['projectName']);if(_0x4db156){_0x2eefbf=_0x4db156['id'],_0x2fc330=!![];break;}if(!_0x1caa04[_0x3e297b(0x1bd)]||_0x1caa04['data'][_0x3e297b(0x1ca)]===0x0)break;_0x3afbf7=_0x1caa04[_0x3e297b(0x1bd)];}if(!_0x2eefbf)throw new Error('Project\x20not\x20found:\x20'+_0x5e2ad4[_0x3e297b(0x1ea)]);}const _0x4c1fbd=await this[_0x3e297b(0x1e1)][_0x3e297b(0x197)]({'project_id':_0x2eefbf,'project_name':_0x5e2ad4?.[_0x3e297b(0x1ea)],'workflow_name':_0x5e2ad4?.[_0x3e297b(0x19c)],'status':_0x5e2ad4?.[_0x3e297b(0x1e2)],'from_time':_0x5e2ad4?.[_0x3e297b(0x195)],'to_time':_0x5e2ad4?.[_0x3e297b(0x1ed)],'limit':_0x5e2ad4?.[_0x3e297b(0x1c8)],'last_id':_0x5e2ad4?.['last_id']});return _0x4c1fbd[_0x3e297b(0x1fc)]['map'](_0x4d713b=>({'project_id':_0x4d713b[_0x3e297b(0x1cc)]?.['id'],'project_name':_0x4d713b[_0x3e297b(0x1cc)]?.['name'],'workflow_id':_0x4d713b['workflow']?.['id'],'workflow_name':_0x4d713b[_0x3e297b(0x19d)]?.[_0x3e297b(0x1a4)],'session_id':_0x4d713b['id'],'sessionUuid':_0x4d713b[_0x3e297b(0x1b7)],'sessionTime':_0x4d713b['sessionTime'],'lastAttempt':_0x4d713b['lastAttempt'],'id':_0x4d713b['id'],'project':_0x4d713b['project'],'workflow':_0x4d713b[_0x3e297b(0x19d)]}));}async[a76_0x24ec84(0x1b0)](_0x2d56ba){const _0x36c5f0=a76_0x24ec84,_0xcf7c97=await this[_0x36c5f0(0x1e1)][_0x36c5f0(0x1a8)]({'project_name':_0x2d56ba?.['projectName'],'workflow_name':_0x2d56ba?.[_0x36c5f0(0x19c)],'include_retried':_0x2d56ba?.[_0x36c5f0(0x1d3)],'limit':_0x2d56ba?.['limit'],'last_id':_0x2d56ba?.[_0x36c5f0(0x1ab)]});return _0xcf7c97[_0x36c5f0(0x1fc)][_0x36c5f0(0x1f4)](_0x252159=>({'project_id':_0x252159[_0x36c5f0(0x1cc)]?.['id'],'project_name':_0x252159[_0x36c5f0(0x1cc)]?.[_0x36c5f0(0x1a4)],'workflow_id':_0x252159[_0x36c5f0(0x19d)]?.['id'],'workflow_name':_0x252159[_0x36c5f0(0x19d)]?.[_0x36c5f0(0x1a4)],'session_id':_0x252159['sessionId'],'sessionUuid':_0x252159[_0x36c5f0(0x1b7)],'sessionTime':_0x252159['sessionTime'],'attempt_id':_0x252159['id'],'attempt_index':_0x252159[_0x36c5f0(0x1f0)],'retryAttemptName':_0x252159['retryAttemptName'],'done':_0x252159[_0x36c5f0(0x1f5)],'success':_0x252159[_0x36c5f0(0x1d8)],'cancelRequested':_0x252159[_0x36c5f0(0x199)],'params':_0x252159[_0x36c5f0(0x1be)],'createdAt':_0x252159[_0x36c5f0(0x1f8)],'finishedAt':_0x252159['finishedAt'],'id':_0x252159['id'],'index':_0x252159['index'],'project':_0x252159[_0x36c5f0(0x1cc)],'workflow':_0x252159['workflow']}));}async['attempt'](_0x4786c9){const _0x45284c=a76_0x24ec84,_0x4119e7=await this[_0x45284c(0x1e1)][_0x45284c(0x1fb)](_0x4786c9);return _0x4119e7;}async[a76_0x24ec84(0x1b9)](_0xd2632b,_0x5d7bf9=![]){const _0x3360e9=a76_0x24ec84,_0x2b51af=await this['client'][_0x3360e9(0x1eb)](_0xd2632b,_0x5d7bf9);return _0x2b51af[_0x3360e9(0x1f4)](_0x283f37=>({'task_id':_0x283f37['id'],'task_name':_0x283f37[_0x3360e9(0x1bc)],'parentId':_0x283f37['parentId'],'config':_0x283f37[_0x3360e9(0x1e0)],'upstreams':_0x283f37[_0x3360e9(0x1d7)],'state':_0x283f37[_0x3360e9(0x1ac)],'exportParams':_0x283f37['exportParams'],'storeParams':_0x283f37[_0x3360e9(0x1d2)],'stateParams':_0x283f37['stateParams'],'updatedAt':_0x283f37['updatedAt'],'retryAt':_0x283f37['retryAt'],'startedAt':_0x283f37['startedAt'],'error':_0x283f37['error'],'isGroup':_0x283f37[_0x3360e9(0x1c0)],'id':_0x283f37['id'],'fullName':_0x283f37[_0x3360e9(0x1bc)]}));}async['logFiles'](_0x5a62eb,_0x936db){const _0x1026ec=a76_0x24ec84;return await this[_0x1026ec(0x1e1)][_0x1026ec(0x1d6)](_0x5a62eb,_0x936db);}async[a76_0x24ec84(0x1f2)](_0x5b7938,_0x43cc32){const _0x41fbba=a76_0x24ec84,_0x42f601=await import(_0x41fbba(0x1aa)),{promisify:_0x2e7e1a}=await import(_0x41fbba(0x1a1)),_0x49253a=_0x2e7e1a(_0x42f601[_0x41fbba(0x1af)]),_0x9f4bd3=await this['client'][_0x41fbba(0x1d6)](_0x5b7938,_0x43cc32);if(_0x9f4bd3[_0x41fbba(0x1ca)]===0x0)return'';const _0x446703=[];for(const _0x709bbd of _0x9f4bd3){if(!_0x709bbd['direct'])continue;const _0x5c7111=await fetch(_0x709bbd[_0x41fbba(0x1bb)]);if(!_0x5c7111['ok'])throw new Error(_0x41fbba(0x1d1)+_0x5c7111['status']);const _0xfd1126=Buffer['from'](await _0x5c7111[_0x41fbba(0x1b2)]()),_0xd522dc=await _0x49253a(_0xfd1126);_0x446703['push'](_0xd522dc[_0x41fbba(0x1ec)](_0x41fbba(0x1ce)));}return _0x446703['join']('\x0a');}async[a76_0x24ec84(0x1ba)](_0x3b3ef4,_0x2f905d){const _0xee48aa=a76_0x24ec84,_0x251360=await this[_0xee48aa(0x1e1)][_0xee48aa(0x1e9)](_0x3b3ef4,_0x2f905d);return _0x251360?.[_0xee48aa(0x1dd)]??'Kill\x20request\x20accepted';}async['retrySession'](_0x4d9e82,_0x8f30ae){const _0x5c12bb=a76_0x24ec84,_0xfcd73f=await this[_0x5c12bb(0x1e1)][_0x5c12bb(0x1cd)](_0x4d9e82,{'from_task':_0x8f30ae?.['fromTask'],'retry_params':_0x8f30ae?.['retryParams']});return{'attemptId':_0xfcd73f['id'],'sessionId':_0xfcd73f[_0x5c12bb(0x1c5)]};}async['retryAttempt'](_0x484590,_0x1be62c){const _0x2cee46=a76_0x24ec84,_0x45ace5=await this[_0x2cee46(0x1e1)][_0x2cee46(0x1fa)](_0x484590,{'resume_from':_0x1be62c?.['resumeFrom'],'retry_params':_0x1be62c?.[_0x2cee46(0x1a2)],'force':_0x1be62c?.[_0x2cee46(0x1e6)]});return{'attemptId':_0x45ace5['id'],'sessionId':_0x45ace5[_0x2cee46(0x1c5)]};}async[a76_0x24ec84(0x193)](_0x239437,_0x289271={},_0x29196){const _0x55eefa=a76_0x24ec84,_0x4676e1=_0x239437[_0x55eefa(0x1a7)]('.');let _0x5c6a39,_0x13724a;if(_0x4676e1===-0x1)throw new Error('Workflow\x20must\x20be\x20specified\x20as\x20\x22project.workflow\x22\x20format');_0x5c6a39=_0x239437[_0x55eefa(0x1cb)](0x0,_0x4676e1),_0x13724a=_0x239437[_0x55eefa(0x1cb)](_0x4676e1+0x1);if(!_0x5c6a39||!_0x13724a)throw new Error(_0x55eefa(0x1f3)+_0x239437+_0x55eefa(0x1de));const _0x3fc00b=_0x29196?.[_0x55eefa(0x1b8)]||new Date()[_0x55eefa(0x19b)]();return await this[_0x55eefa(0x1e1)]['startAttempt']({'projectName':_0x5c6a39,'workflowName':_0x13724a,'sessionTime':_0x3fc00b,'params':_0x289271});}async[a76_0x24ec84(0x19a)](_0xf9e3e2,_0x47543f,_0x3a3d4d){const _0x38ff6b=a76_0x24ec84,{promises:_0x532c95}=await import('fs'),_0x1683d5=await import(_0x38ff6b(0x1c7)),_0xc076=await import('os'),_0x55c85d=await import(_0x38ff6b(0x1f6)),{id:_0x51d96c,name:_0x2a9e2e}=await this['resolveProjectId'](_0xf9e3e2),_0x23ad22=_0xc076[_0x38ff6b(0x1e7)](),_0x16ccdc=_0x1683d5[_0x38ff6b(0x198)](_0x23ad22,_0x38ff6b(0x1ee)+_0x51d96c+'-'+Date[_0x38ff6b(0x1c9)]()+_0x38ff6b(0x1a9));try{await this[_0x38ff6b(0x1e1)]['downloadProjectArchive'](_0x51d96c,_0x16ccdc,_0x3a3d4d?.[_0x38ff6b(0x1ad)]);const _0x4754a9=_0x1683d5[_0x38ff6b(0x198)](_0x47543f,_0x2a9e2e);await _0x532c95[_0x38ff6b(0x1ef)](_0x4754a9,{'recursive':!![]}),await _0x55c85d[_0x38ff6b(0x1c3)]({'file':_0x16ccdc,'cwd':_0x4754a9,'gzip':!![]});const _0x14e9d5=async _0x5e7280=>{const _0x454d07=_0x38ff6b;let _0x175ce2=0x0;const _0x34f755=await _0x532c95[_0x454d07(0x194)](_0x5e7280,{'withFileTypes':!![]});for(const _0x42cd87 of _0x34f755){const _0x402b27=_0x1683d5[_0x454d07(0x198)](_0x5e7280,_0x42cd87[_0x454d07(0x1a4)]);if(_0x42cd87[_0x454d07(0x1bf)]())_0x175ce2++;else _0x42cd87[_0x454d07(0x1e5)]()&&(_0x175ce2+=await _0x14e9d5(_0x402b27));}return _0x175ce2;},_0x3eeee0=await _0x14e9d5(_0x4754a9);return{'projectName':_0x2a9e2e,'revision':_0x3a3d4d?.['revision']||_0x38ff6b(0x1e4),'filesExtracted':_0x3eeee0};}finally{try{await _0x532c95[_0x38ff6b(0x1a3)](_0x16ccdc);}catch{}}}async[a76_0x24ec84(0x1f1)](_0x374416,_0x3d19bf){const _0x1f80d8=a76_0x24ec84,{promises:_0x1418fb}=await import('fs'),_0x321d68=await import(_0x1f80d8(0x1c7)),_0x53928b=await import('tar'),_0x57054b=_0x3d19bf?.[_0x1f80d8(0x1ea)]||_0x321d68['basename'](_0x374416),_0x5218dc=_0x3d19bf?.[_0x1f80d8(0x1ad)]||new Date()['toISOString']()[_0x1f80d8(0x19f)](/[:.]/g,'-');try{await _0x1418fb[_0x1f80d8(0x19e)](_0x374416);}catch{throw new Error('Project\x20directory\x20not\x20found:\x20'+_0x374416);}if(!_0x3d19bf?.['skipValidation']){const _0x39715d=await _0x1418fb[_0x1f80d8(0x194)](_0x374416),_0x5c97a9=_0x39715d[_0x1f80d8(0x1da)](_0x11277b=>_0x11277b[_0x1f80d8(0x1c6)](WORKFLOW_FILE_EXTENSION));if(_0x5c97a9['length']===0x0)throw new Error(_0x1f80d8(0x1f9)+WORKFLOW_FILE_EXTENSION+_0x1f80d8(0x1b1));for(const _0x52e531 of _0x5c97a9){const _0x24be38=_0x321d68[_0x1f80d8(0x198)](_0x374416,_0x52e531);try{await _0x1418fb[_0x1f80d8(0x19e)](_0x24be38);}catch{throw new Error(_0x1f80d8(0x1ae)+_0x52e531);}}}const _0x171fa4=async(_0x24a790,_0x5ec505='')=>{const _0x8c27eb=_0x1f80d8,_0x4b3e29=await _0x1418fb[_0x8c27eb(0x194)](_0x24a790,{'withFileTypes':!![]}),_0x38a5b1=[];for(const _0x4a06b7 of _0x4b3e29){const _0x22492f=_0x321d68[_0x8c27eb(0x198)](_0x5ec505,_0x4a06b7[_0x8c27eb(0x1a4)]),_0x345f30=_0x321d68['join'](_0x24a790,_0x4a06b7[_0x8c27eb(0x1a4)]);if(!shouldIncludeInArchive(_0x4a06b7['name']))continue;_0x4a06b7['isDirectory']()?_0x38a5b1[_0x8c27eb(0x1f1)](...await _0x171fa4(_0x345f30,_0x22492f)):_0x38a5b1[_0x8c27eb(0x1f1)](_0x22492f);}return _0x38a5b1;},_0x1f64e6=await _0x171fa4(_0x374416),_0x5420d1=await import('os'),_0x1cdcf0=_0x5420d1[_0x1f80d8(0x1e7)](),_0x2027bd=_0x321d68[_0x1f80d8(0x198)](_0x1cdcf0,_0x1f80d8(0x1c4)+Date[_0x1f80d8(0x1c9)]()+_0x1f80d8(0x1a9));try{await _0x53928b[_0x1f80d8(0x1e8)]({'file':_0x2027bd,'gzip':!![],'cwd':_0x374416,'portable':!![]},_0x1f64e6);const _0x17534c=await this[_0x1f80d8(0x1e1)][_0x1f80d8(0x1a5)](_0x57054b,_0x5218dc,_0x2027bd,{'scheduleFrom':_0x3d19bf?.[_0x1f80d8(0x1b5)],'clearSchedule':_0x3d19bf?.['clearSchedule'],'clearScheduleAll':_0x3d19bf?.[_0x1f80d8(0x1e3)]});return{'projectId':_0x17534c['id'],'projectName':_0x17534c['name'],'revision':_0x17534c[_0x1f80d8(0x1ad)]};}finally{try{await _0x1418fb[_0x1f80d8(0x1a3)](_0x2027bd);}catch{}}}async[a76_0x24ec84(0x1a6)](_0x39749e){const _0x2e8e79=a76_0x24ec84,{id:_0x1670dc}=await this[_0x2e8e79(0x1d5)](_0x39749e),_0x137a31=await this[_0x2e8e79(0x1e1)][_0x2e8e79(0x196)](_0x1670dc);return{'projectId':_0x137a31['id'],'projectName':_0x137a31['name']};}}
|
package/dist/types/endpoints.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a81_0x36b1dc=a81_0x3f4f;(function(_0xdd1118,_0x34a280){const _0x4dfb90=a81_0x3f4f,_0x500809=_0xdd1118();while(!![]){try{const _0x11d27a=-parseInt(_0x4dfb90(0x75))/0x1*(-parseInt(_0x4dfb90(0x79))/0x2)+parseInt(_0x4dfb90(0xa2))/0x3+parseInt(_0x4dfb90(0xb5))/0x4*(-parseInt(_0x4dfb90(0x86))/0x5)+parseInt(_0x4dfb90(0x72))/0x6+parseInt(_0x4dfb90(0xa4))/0x7+parseInt(_0x4dfb90(0xa1))/0x8*(parseInt(_0x4dfb90(0x95))/0x9)+-parseInt(_0x4dfb90(0x88))/0xa;if(_0x11d27a===_0x34a280)break;else _0x500809['push'](_0x500809['shift']());}catch(_0x61b0dc){_0x500809['push'](_0x500809['shift']());}}}(a81_0x4c48,0xc5bb7));export const TD_ENDPOINTS={'us01':a81_0x36b1dc(0x8b),'jp01':'https://api.treasuredata.co.jp','eu01':'https://api.eu01.treasuredata.com','ap02':a81_0x36b1dc(0x7b),'ap03':a81_0x36b1dc(0x78),'dev-us01':a81_0x36b1dc(0x7f),'dev-eu01':a81_0x36b1dc(0xbd),'stg-us01':a81_0x36b1dc(0x74),'stg-jp01':a81_0x36b1dc(0xb3),'stg-ap03':'https://api-staging.ap03.treasuredata.com'};export const CDP_ENDPOINTS={'us01':a81_0x36b1dc(0xbc),'jp01':a81_0x36b1dc(0x80),'eu01':a81_0x36b1dc(0xa7),'ap02':a81_0x36b1dc(0x77),'ap03':a81_0x36b1dc(0xab),'dev-us01':'https://api-development-cdp.us01.treasuredata.com','dev-eu01':a81_0x36b1dc(0xaf),'stg-us01':a81_0x36b1dc(0x99),'stg-jp01':a81_0x36b1dc(0xae),'stg-ap03':a81_0x36b1dc(0xb8)};export const WORKFLOW_ENDPOINTS={'us01':a81_0x36b1dc(0x90),'jp01':a81_0x36b1dc(0x9e),'eu01':a81_0x36b1dc(0xb6),'ap02':'https://api-workflow.ap02.treasuredata.com','ap03':a81_0x36b1dc(0xb4),'dev-us01':a81_0x36b1dc(0x93),'dev-eu01':'https://api-development-workflow.eu01.treasuredata.com','stg-us01':a81_0x36b1dc(0x83),'stg-jp01':a81_0x36b1dc(0x89),'stg-ap03':'https://api-staging-workflow.ap03.treasuredata.com'};export const TRINO_ENDPOINTS={'us01':a81_0x36b1dc(0xb7),'jp01':'https://api-presto.treasuredata.co.jp','eu01':a81_0x36b1dc(0x8c),'ap02':a81_0x36b1dc(0x92),'ap03':a81_0x36b1dc(0xa0),'dev-us01':a81_0x36b1dc(0xa3),'dev-eu01':a81_0x36b1dc(0xb0),'stg-us01':a81_0x36b1dc(0x8a),'stg-jp01':a81_0x36b1dc(0x7c),'stg-ap03':a81_0x36b1dc(0x98)};function a81_0x4c48(){const _0x21b440=['https://api-staging-cdp.treasuredata.co.jp','https://api-development-cdp.eu01.treasuredata.com','https://api-development-presto.eu01.treasuredata.com','No\x20endpoint\x20defined\x20for\x20API\x20type\x20\x27','https://engage-api.ap02.treasuredata.com','https://api-staging.treasuredata.co.jp','https://api-workflow.ap03.treasuredata.com','148siGPUm','https://api-workflow.eu01.treasuredata.com','https://api-presto.treasuredata.com','https://api-staging-cdp.ap03.treasuredata.com','https://engage-api.treasuredata.com','.treasuredata.com','https://engage-api.eu01.treasuredata.com','https://api-cdp.treasuredata.com','https://api-development.eu01.treasuredata.com','837840QoENpr','https://console.ap03.treasuredata.com','https://api-staging.us01.treasuredata.com','174571VxBvQx','https://engage-api-development.us01.treasuredata.com','https://api-cdp.ap02.treasuredata.com','https://api.ap03.treasuredata.com','4zzgIMS','https://llm-api-staging.us01.treasuredata.com','https://api.ap02.treasuredata.com','https://api-staging-presto.treasuredata.co.jp','\x27\x20and\x20site\x20\x27','https://console-next.ap03.treasuredata.com','https://api-development.treasuredata.com','https://api-cdp.treasuredata.co.jp','https://console-staging-next.us01.treasuredata.com','https://console-staging-next.treasuredata.co.jp','https://api-staging-workflow.us01.treasuredata.com','https://console-development-next.us01.treasuredata.com','https://console.','33230IStozj','https://console-next.us01.treasuredata.com','25016510AfgTXT','https://api-staging-workflow.treasuredata.co.jp','https://api-staging-presto.treasuredata.com','https://api.treasuredata.com','https://api-presto.eu01.treasuredata.com','https://console-staging.treasuredata.co.jp','https://llm-api.treasuredata.com','https://llm-api.treasuredata.co.jp','https://api-workflow.treasuredata.com','https://engage-api.treasuredata.co.jp','https://api-presto.ap02.treasuredata.com','https://api-development-workflow.us01.treasuredata.com','https://engage-api.ap03.treasuredata.com','180sQdjST','https://llm-api-development.us01.treasuredata.com','https://console-staging.us01.treasuredata.com','https://api-staging-presto.ap03.treasuredata.com','https://api-staging-cdp.us01.treasuredata.com','https://console-next.treasuredata.co.jp','https://console-staging.ap03.treasuredata.com','https://engage-api-staging.ap03.treasuredata.com','https://console-development-next.eu01.treasuredata.com','https://api-workflow.treasuredata.co.jp','https://llm-api-staging.ap03.treasuredata.com','https://api-presto.ap03.treasuredata.com','419128vSOsfO','2284110Ouoapl','https://api-development-presto.treasuredata.com','8816444dCcWcF','https://console-development.eu01.treasuredata.com','https://llm-api.ap03.treasuredata.com','https://api-cdp.eu01.treasuredata.com','https://llm-api.ap02.treasuredata.com','https://engage-api-staging.us01.treasuredata.com','https://console.eu01.treasuredata.com','https://api-cdp.ap03.treasuredata.com','https://llm-api.eu01.treasuredata.com','https://console-next.'];a81_0x4c48=function(){return _0x21b440;};return a81_0x4c48();}function a81_0x3f4f(_0x5f0294,_0x202be2){_0x5f0294=_0x5f0294-0x72;const _0x4c482b=a81_0x4c48();let _0x3f4f8f=_0x4c482b[_0x5f0294];return _0x3f4f8f;}export const LLM_ENDPOINTS={'us01':a81_0x36b1dc(0x8e),'jp01':a81_0x36b1dc(0x8f),'eu01':a81_0x36b1dc(0xac),'ap02':a81_0x36b1dc(0xa8),'ap03':a81_0x36b1dc(0xa6),'dev-us01':a81_0x36b1dc(0x96),'dev-eu01':'https://llm-api-development.eu01.treasuredata.com','stg-us01':a81_0x36b1dc(0x7a),'stg-jp01':'https://llm-api-staging.treasuredata.co.jp','stg-ap03':a81_0x36b1dc(0x9f)};export const ENGAGE_ENDPOINTS={'us01':a81_0x36b1dc(0xb9),'jp01':a81_0x36b1dc(0x91),'eu01':a81_0x36b1dc(0xbb),'ap02':a81_0x36b1dc(0xb2),'ap03':a81_0x36b1dc(0x94),'dev-us01':a81_0x36b1dc(0x76),'dev-eu01':'https://engage-api-development.eu01.treasuredata.com','stg-us01':a81_0x36b1dc(0xa9),'stg-jp01':'https://engage-api-staging.treasuredata.co.jp','stg-ap03':a81_0x36b1dc(0x9c)};export const CONSOLE_ENDPOINTS={'us01':'https://console.treasuredata.com','jp01':'https://console.treasuredata.co.jp','eu01':a81_0x36b1dc(0xaa),'ap02':'https://console.ap02.treasuredata.com','ap03':a81_0x36b1dc(0x73),'dev-us01':'https://console-development.treasuredata.com','dev-eu01':a81_0x36b1dc(0xa5),'stg-us01':a81_0x36b1dc(0x97),'stg-jp01':a81_0x36b1dc(0x8d),'stg-ap03':a81_0x36b1dc(0x9b)};export const CONSOLE_NEXT_ENDPOINTS={'us01':a81_0x36b1dc(0x87),'jp01':a81_0x36b1dc(0x9a),'eu01':'https://console-next.eu01.treasuredata.com','ap02':'https://console-next.ap02.treasuredata.com','ap03':a81_0x36b1dc(0x7e),'dev-us01':a81_0x36b1dc(0x84),'dev-eu01':a81_0x36b1dc(0x9d),'stg-us01':a81_0x36b1dc(0x81),'stg-jp01':a81_0x36b1dc(0x82),'stg-ap03':'https://console-staging-next.ap03.treasuredata.com'};export function getConsoleUrl(_0x528eda,_0x175091){const _0x13a120=a81_0x36b1dc,_0x2ff77a=CONSOLE_ENDPOINTS[_0x528eda]||_0x13a120(0x85)+_0x528eda+_0x13a120(0xba);return _0x175091?''+_0x2ff77a+_0x175091:_0x2ff77a;}export function getConsoleNextUrl(_0xe56885,_0x1294f0){const _0x518aa7=a81_0x36b1dc,_0x2bd886=CONSOLE_NEXT_ENDPOINTS[_0xe56885]||_0x518aa7(0xad)+_0xe56885+'.treasuredata.com';return _0x1294f0?''+_0x2bd886+_0x1294f0:_0x2bd886;}export const API_ENDPOINTS={'td':TD_ENDPOINTS,'cdp':CDP_ENDPOINTS,'workflow':WORKFLOW_ENDPOINTS,'trino':TRINO_ENDPOINTS,'llm':LLM_ENDPOINTS,'engage':ENGAGE_ENDPOINTS};export function getEndpoint(_0x4672ce,_0x3263d2='td'){const _0x3993da=a81_0x36b1dc,_0x535ca7=API_ENDPOINTS[_0x3263d2]?.[_0x4672ce];if(!_0x535ca7)throw new Error(_0x3993da(0xb1)+_0x3263d2+_0x3993da(0x7d)+_0x4672ce+'\x27');return _0x535ca7;}
|
package/dist/types/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a83_0xe41695=a83_0x1d8a;function a83_0x65ca(){const _0x38ca46=['1117972XQxAZL','1330740PHRdfp','3maDDDN','22LsZmdY','8212596wPnDza','2137040FEBqou','jp01','28189vjeDrj','909FmOHWG','dev-us01','4476sEhpUa','348RmHvpl','5670trqsjc','30QUpXtW','us01'];a83_0x65ca=function(){return _0x38ca46;};return a83_0x65ca();}function a83_0x1d8a(_0x1db3a1,_0x48258d){_0x1db3a1=_0x1db3a1-0xd7;const _0x65cad=a83_0x65ca();let _0x1d8aab=_0x65cad[_0x1db3a1];return _0x1d8aab;}(function(_0x30ff90,_0x4f115f){const _0x55d966=a83_0x1d8a,_0x1ba440=_0x30ff90();while(!![]){try{const _0x283669=parseInt(_0x55d966(0xd7))/0x1*(-parseInt(_0x55d966(0xda))/0x2)+-parseInt(_0x55d966(0xde))/0x3*(parseInt(_0x55d966(0xdc))/0x4)+-parseInt(_0x55d966(0xdd))/0x5+-parseInt(_0x55d966(0xd8))/0x6*(parseInt(_0x55d966(0xe3))/0x7)+-parseInt(_0x55d966(0xe1))/0x8+parseInt(_0x55d966(0xe4))/0x9*(-parseInt(_0x55d966(0xd9))/0xa)+-parseInt(_0x55d966(0xdf))/0xb*(-parseInt(_0x55d966(0xe0))/0xc);if(_0x283669===_0x4f115f)break;else _0x1ba440['push'](_0x1ba440['shift']());}catch(_0x1a4e3e){_0x1ba440['push'](_0x1ba440['shift']());}}}(a83_0x65ca,0x30586));export const SITE_ALIASES={'us':'us01','aws':a83_0xe41695(0xdb),'jp':'jp01','aws-tokyo':a83_0xe41695(0xe2),'dev':a83_0xe41695(0xe5),'stg':'stg-us01'};export{getEndpoint,API_ENDPOINTS}from'./endpoints.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a88_0x4133(_0x43081d,_0x518e20){_0x43081d=_0x43081d-0x1b0;const _0x37fb87=a88_0x37fb();let _0x4133c6=_0x37fb87[_0x43081d];return _0x4133c6;}function a88_0x37fb(){const _0x57b615=['length','3pkWQfa','Agent\x20reference\x20cannot\x20be\x20empty','Project\x20name\x20cannot\x20be\x20empty','5533923AOPqxb','35842SZwaII','Invalid\x20agent\x20reference\x20format:\x20','4cnSZRg','10DivYkP','286040anIsXE','6266565uPHFHU','4024625NJMeLR','11221980YYcZfH','203XEpusX','Agent\x20name\x20cannot\x20be\x20empty','39488493tXSHiA','trim'];a88_0x37fb=function(){return _0x57b615;};return a88_0x37fb();}(function(_0x4c080d,_0x4fb2e0){const _0x3c89d9=a88_0x4133,_0x42f633=_0x4c080d();while(!![]){try{const _0x1a464f=parseInt(_0x3c89d9(0x1bf))/0x1*(-parseInt(_0x3c89d9(0x1b2))/0x2)+-parseInt(_0x3c89d9(0x1b1))/0x3*(-parseInt(_0x3c89d9(0x1b4))/0x4)+-parseInt(_0x3c89d9(0x1b8))/0x5+parseInt(_0x3c89d9(0x1b9))/0x6+parseInt(_0x3c89d9(0x1ba))/0x7*(parseInt(_0x3c89d9(0x1b6))/0x8)+parseInt(_0x3c89d9(0x1b7))/0x9+parseInt(_0x3c89d9(0x1b5))/0xa*(-parseInt(_0x3c89d9(0x1bc))/0xb);if(_0x1a464f===_0x4fb2e0)break;else _0x42f633['push'](_0x42f633['shift']());}catch(_0x3f07ba){_0x42f633['push'](_0x42f633['shift']());}}}(a88_0x37fb,0xf40b0));export function parseAgentRef(_0x10142b){const _0x44439a=a88_0x4133;if(!_0x10142b||_0x10142b[_0x44439a(0x1bd)]()==='')throw new Error(_0x44439a(0x1c0));const _0x4cb67d=_0x10142b[_0x44439a(0x1bd)](),_0x51d22f=_0x4cb67d['split']('/');if(_0x51d22f['length']===0x1)return{'projectName':_0x51d22f[0x0],'agentName':undefined};else{if(_0x51d22f[_0x44439a(0x1be)]===0x2){const [_0x5ded67,_0x4fb2be]=_0x51d22f;if(!_0x5ded67||_0x5ded67[_0x44439a(0x1bd)]()==='')throw new Error(_0x44439a(0x1b0));if(!_0x4fb2be||_0x4fb2be[_0x44439a(0x1bd)]()==='')throw new Error(_0x44439a(0x1bb));return{'projectName':_0x5ded67[_0x44439a(0x1bd)](),'agentName':_0x4fb2be[_0x44439a(0x1bd)]()};}else throw new Error(_0x44439a(0x1b3)+_0x10142b+'.\x20Expected\x20\x22project_name\x22\x20or\x20\x22project_name/agent_name\x22');}}
|
package/dist/utils/async.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x47349b,_0x4549a1){const _0x1d35d8=a89_0x3708,_0x3ab61e=_0x47349b();while(!![]){try{const _0x94182a=-parseInt(_0x1d35d8(0x16d))/0x1*(-parseInt(_0x1d35d8(0x167))/0x2)+parseInt(_0x1d35d8(0x16b))/0x3*(-parseInt(_0x1d35d8(0x161))/0x4)+parseInt(_0x1d35d8(0x163))/0x5*(parseInt(_0x1d35d8(0x169))/0x6)+parseInt(_0x1d35d8(0x166))/0x7+parseInt(_0x1d35d8(0x160))/0x8+parseInt(_0x1d35d8(0x16c))/0x9*(parseInt(_0x1d35d8(0x164))/0xa)+-parseInt(_0x1d35d8(0x16a))/0xb*(parseInt(_0x1d35d8(0x15f))/0xc);if(_0x94182a===_0x4549a1)break;else _0x3ab61e['push'](_0x3ab61e['shift']());}catch(_0x6dc26d){_0x3ab61e['push'](_0x3ab61e['shift']());}}}(a89_0x5b40,0xac5a3));function a89_0x5b40(){const _0x1bb423=['all','1658930bvGKau','24vGbUde','push','318vwNXrC','7249YCHgkL','3bvRCGz','638721CSLeWr','65601hqhKIU','17844XLdJyL','4151384RMqIcl','4460432VYVTQj','map','45020LXHKOe','110uttSLt'];a89_0x5b40=function(){return _0x1bb423;};return a89_0x5b40();}function a89_0x3708(_0x299a38,_0xa5be4f){_0x299a38=_0x299a38-0x15f;const _0x5b401c=a89_0x5b40();let _0x370868=_0x5b401c[_0x299a38];return _0x370868;}export async function batchAsync(_0x13e516,_0x739562,_0x4df56c=0xa){const _0x51bd5b=a89_0x3708,_0x26de49=[];for(let _0x164cf7=0x0;_0x164cf7<_0x13e516['length'];_0x164cf7+=_0x4df56c){const _0x3ecea2=_0x13e516['slice'](_0x164cf7,_0x164cf7+_0x4df56c),_0xbf34c=await Promise[_0x51bd5b(0x165)](_0x3ecea2[_0x51bd5b(0x162)](_0x739562));_0x26de49[_0x51bd5b(0x168)](..._0xbf34c);}return _0x26de49;}
|
package/dist/utils/chat-cache.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x2e7673,_0x24e4e3){const _0x8997a0=a90_0x51c3,_0xcb160b=_0x2e7673();while(!![]){try{const _0x3afd9f=parseInt(_0x8997a0(0x17d))/0x1*(parseInt(_0x8997a0(0x17a))/0x2)+parseInt(_0x8997a0(0x181))/0x3+-parseInt(_0x8997a0(0x179))/0x4+-parseInt(_0x8997a0(0x184))/0x5+-parseInt(_0x8997a0(0x178))/0x6+-parseInt(_0x8997a0(0x17f))/0x7+parseInt(_0x8997a0(0x183))/0x8*(parseInt(_0x8997a0(0x17c))/0x9);if(_0x3afd9f===_0x24e4e3)break;else _0xcb160b['push'](_0xcb160b['shift']());}catch(_0x242ea1){_0xcb160b['push'](_0xcb160b['shift']());}}}(a90_0xac71,0x61e28));import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{join}from'path';function getCacheDir(){const _0x49a01a=a90_0x51c3;return join(process['cwd'](),_0x49a01a(0x182),_0x49a01a(0x17e));}function a90_0x51c3(_0x19c43e,_0x302e0f){_0x19c43e=_0x19c43e-0x178;const _0xac71f4=a90_0xac71();let _0x51c3da=_0xac71f4[_0x19c43e];return _0x51c3da;}function getLastChatIdPath(){const _0x499aca=a90_0x51c3;return join(getCacheDir(),_0x499aca(0x180));}function ensureCacheDir(){const _0x25e4a6=getCacheDir();!existsSync(_0x25e4a6)&&mkdirSync(_0x25e4a6,{'recursive':!![]});}export function saveLastChatId(_0x3abbe9){ensureCacheDir();const _0x2ba91b=getLastChatIdPath();writeFileSync(_0x2ba91b,_0x3abbe9,'utf-8');}function a90_0xac71(){const _0x4159aa=['37DnHSQj','tdx','1234170Qejflc','last_chat_id','638535YezuOl','.cache','882608ooYUTJ','876390syLAGj','utf-8','2773590sndtgF','1307440MsUSsd','6228TYiZiN','trim','99cukmMb'];a90_0xac71=function(){return _0x4159aa;};return a90_0xac71();}export function loadLastChatId(){const _0x2e6f10=a90_0x51c3,_0x48ff18=getLastChatIdPath();if(!existsSync(_0x48ff18))return undefined;try{const _0xf89fd=readFileSync(_0x48ff18,_0x2e6f10(0x185))[_0x2e6f10(0x17b)]();return _0xf89fd||undefined;}catch{return undefined;}}export function clearLastChatId(){const _0x3108a8=a90_0x51c3,_0x2f777b=getLastChatIdPath();if(existsSync(_0x2f777b))try{writeFileSync(_0x2f777b,'',_0x3108a8(0x185));}catch{}}
|
package/dist/utils/colors.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x5c38ab,_0x12c011){const _0x14022b=a91_0xb712,_0x38b20a=_0x5c38ab();while(!![]){try{const _0x85667=-parseInt(_0x14022b(0x1db))/0x1+-parseInt(_0x14022b(0x1e6))/0x2+parseInt(_0x14022b(0x1e8))/0x3*(parseInt(_0x14022b(0x1d6))/0x4)+-parseInt(_0x14022b(0x1e2))/0x5+parseInt(_0x14022b(0x1d3))/0x6*(-parseInt(_0x14022b(0x1d4))/0x7)+-parseInt(_0x14022b(0x1de))/0x8*(-parseInt(_0x14022b(0x1ea))/0x9)+parseInt(_0x14022b(0x1d8))/0xa*(parseInt(_0x14022b(0x1cf))/0xb);if(_0x85667===_0x12c011)break;else _0x38b20a['push'](_0x38b20a['shift']());}catch(_0x3864b0){_0x38b20a['push'](_0x38b20a['shift']());}}}(a91_0x189c,0x36ae5));import{Chalk}from'chalk';export function shouldUseColor(_0x3559c1={}){const _0x42b4b7=a91_0xb712;if(_0x3559c1['noColor']===!![])return![];if(_0x3559c1[_0x42b4b7(0x1e5)]===!![])return!![];if(process[_0x42b4b7(0x1d7)][_0x42b4b7(0x1e3)]!==undefined)return![];return process['stdout'][_0x42b4b7(0x1d5)]??![];}export function getChalk(_0x1c617b={}){if(shouldUseColor(_0x1c617b))return new Chalk({'level':0x3});return new Chalk({'level':0x0});}export function colorBorder(_0xb6e94e,_0x57fd95={}){const _0x150d7c=a91_0xb712;return getChalk(_0x57fd95)[_0x150d7c(0x1e0)](_0xb6e94e);}export function colorHeader(_0x38ccb4,_0xfd8221={}){return getChalk(_0xfd8221)['cyan'](_0x38ccb4);}export function colorType(_0x2e2070,_0x3563bc={}){const _0x2a2987=a91_0xb712;return getChalk(_0x3563bc)[_0x2a2987(0x1e0)](_0x2e2070);}export function colorJSONKey(_0x5e812b,_0x593442={}){const _0x3590b9=a91_0xb712;return getChalk(_0x593442)[_0x3590b9(0x1dc)](_0x5e812b);}export function colorJSONString(_0x185a17,_0x3b4564={}){const _0x13b5c8=a91_0xb712;return getChalk(_0x3b4564)[_0x13b5c8(0x1d1)](_0x185a17);}export function colorJSONNumber(_0x4da4e4,_0x33f0a5={}){return getChalk(_0x33f0a5)['cyan'](_0x4da4e4);}export function colorJSONBoolean(_0x576c4a,_0x2ff19a={}){const _0x35535d=a91_0xb712;return getChalk(_0x2ff19a)[_0x35535d(0x1cd)](_0x576c4a);}function a91_0xb712(_0x281cdc,_0x47c879){_0x281cdc=_0x281cdc-0x1cd;const _0x189cb2=a91_0x189c();let _0xb7126a=_0x189cb2[_0x281cdc];return _0xb7126a;}export function colorJSONNull(_0x54a772,_0x48e422={}){const _0x13dfee=a91_0xb712;return getChalk(_0x48e422)[_0x13dfee(0x1e0)](_0x54a772);}export function colorizeJSONCompact(_0x377f2d,_0x428491={}){const _0x4c3f28=a91_0xb712;if(!shouldUseColor(_0x428491))return JSON[_0x4c3f28(0x1dd)](_0x377f2d);if(_0x377f2d===null)return colorJSONNull('null',_0x428491);if(typeof _0x377f2d==='boolean')return colorJSONBoolean(String(_0x377f2d),_0x428491);if(typeof _0x377f2d==='number')return colorJSONNumber(String(_0x377f2d),_0x428491);if(typeof _0x377f2d===_0x4c3f28(0x1ce))return colorJSONString(JSON[_0x4c3f28(0x1dd)](_0x377f2d),_0x428491);if(Array['isArray'](_0x377f2d)){if(_0x377f2d['length']===0x0)return'[]';const _0x51f911=_0x377f2d[_0x4c3f28(0x1e9)](_0x35d5c7=>colorizeJSONCompact(_0x35d5c7,_0x428491));return'['+_0x51f911['join'](',')+']';}if(typeof _0x377f2d==='object'){const _0x405cf8=Object[_0x4c3f28(0x1d2)](_0x377f2d);if(_0x405cf8[_0x4c3f28(0x1e1)]===0x0)return'{}';const _0x3566c3=_0x405cf8['map'](([_0x814673,_0x3b2681])=>{const _0x546762=_0x4c3f28,_0x3ddb64=colorJSONKey(JSON[_0x546762(0x1dd)](_0x814673),_0x428491),_0x2ffbfa=colorizeJSONCompact(_0x3b2681,_0x428491);return _0x3ddb64+':'+_0x2ffbfa;});return'{'+_0x3566c3['join'](',')+'}';}return String(_0x377f2d);}function a91_0x189c(){const _0x227f43=['1376485oCyHIj','NO_COLOR','isArray','color','113450gdgJSr','number','27DFHuKF','map','594JSpqWX','yellow','string','44XkcFeI','repeat','green','entries','6PCbHeR','2345861vYhwHd','isTTY','185372UDpOZz','env','1868610Usbsrt','boolean','object','355055KCVKdC','blue','stringify','9896mNKwuh','join','dim','length'];a91_0x189c=function(){return _0x227f43;};return a91_0x189c();}export function colorizeJSON(_0x12f922,_0x41e7d7={},_0x46229a=0x0){const _0x13761f=a91_0xb712;if(!shouldUseColor(_0x41e7d7))return JSON[_0x13761f(0x1dd)](_0x12f922,null,0x2);const _0x4a9117='\x20'['repeat'](_0x46229a),_0x5b2e5a=_0x46229a+0x2;if(_0x12f922===null)return colorJSONNull('null',_0x41e7d7);if(typeof _0x12f922===_0x13761f(0x1d9))return colorJSONBoolean(String(_0x12f922),_0x41e7d7);if(typeof _0x12f922===_0x13761f(0x1e7))return colorJSONNumber(String(_0x12f922),_0x41e7d7);if(typeof _0x12f922===_0x13761f(0x1ce))return colorJSONString(JSON[_0x13761f(0x1dd)](_0x12f922),_0x41e7d7);if(Array[_0x13761f(0x1e4)](_0x12f922)){if(_0x12f922[_0x13761f(0x1e1)]===0x0)return'[]';const _0xf2b57=_0x12f922['map'](_0x407d81=>{const _0x2c669b=colorizeJSON(_0x407d81,_0x41e7d7,_0x5b2e5a);return''+'\x20'['repeat'](_0x5b2e5a)+_0x2c669b;});return'[\x0a'+_0xf2b57[_0x13761f(0x1df)](',\x0a')+('\x0a'+_0x4a9117+']');}if(typeof _0x12f922===_0x13761f(0x1da)){const _0x42a666=Object['entries'](_0x12f922);if(_0x42a666['length']===0x0)return'{}';const _0x4985ab=_0x42a666['map'](([_0x3774af,_0x43621d])=>{const _0x31ced7=_0x13761f,_0x32fd0e=colorJSONKey(JSON[_0x31ced7(0x1dd)](_0x3774af),_0x41e7d7),_0x41ff54=colorizeJSON(_0x43621d,_0x41e7d7,_0x5b2e5a);return''+'\x20'[_0x31ced7(0x1d0)](_0x5b2e5a)+_0x32fd0e+':\x20'+_0x41ff54;});return'{\x0a'+_0x4985ab['join'](',\x0a')+('\x0a'+_0x4a9117+'}');}return String(_0x12f922);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x34925c,_0x463e72){const _0x31a757=a92_0x2367,_0x3040ec=_0x34925c();while(!![]){try{const _0x3ac92f=parseInt(_0x31a757(0x15f))/0x1+-parseInt(_0x31a757(0x189))/0x2+-parseInt(_0x31a757(0x18b))/0x3*(parseInt(_0x31a757(0x169))/0x4)+-parseInt(_0x31a757(0x185))/0x5*(-parseInt(_0x31a757(0x17c))/0x6)+-parseInt(_0x31a757(0x16f))/0x7+parseInt(_0x31a757(0x167))/0x8*(parseInt(_0x31a757(0x180))/0x9)+-parseInt(_0x31a757(0x17e))/0xa;if(_0x3ac92f===_0x463e72)break;else _0x3040ec['push'](_0x3040ec['shift']());}catch(_0x35a623){_0x3040ec['push'](_0x3040ec['shift']());}}}(a92_0x1855,0xb4d74));import{writeFileSync}from'fs';import{spawn}from'child_process';import{resolveOutputFormat}from'./format-detector.js';import{colorBorder,colorizeJSON,colorizeJSONCompact,shouldUseColor}from'./colors.js';function a92_0x1855(){const _0x24101b=['padEnd','query','1617742DbWErx','inherit','bigint','string','json','[error]','resolve','jsonl','tsv','trim','limit','number','─┬─','6bATpuc','noColor','7580350KqTuQR','yellow','1918467HoIFip','isTTY','map','stdin','color','7001935AcBhTj','forEach','format','double','1406562CzMAEj','max','9VLsmpJ','stringify','repeat','[logs]','less','object','table','isInteger','stderr','log','cyan','[query]','blue','filter','debug','end','split','Results\x20saved\x20to\x20','FINISHED','pipe','length','cmdout','rule','No\x20data','boolean','906537jErxIq','error','red','varchar','join','magenta','spawn','bold','24TsVTXF','close','684356ydhtqu','output','push','entries'];a92_0x1855=function(){return _0x24101b;};return a92_0x1855();}import a92_0x3b1f0a from'chalk';import{DEFAULT_DISPLAY_LIMIT}from'./constants.js';import{formatAsTable,formatAsJSON,formatAsJSONL,formatQueryResult}from'./formatters.js';export function isStructuredFormat(_0x578be3){const _0xee4bb1=a92_0x2367;return _0x578be3[_0xee4bb1(0x187)]===_0xee4bb1(0x173)||_0x578be3[_0xee4bb1(0x187)]===_0xee4bb1(0x176)||_0x578be3[_0xee4bb1(0x187)]===_0xee4bb1(0x177)||_0x578be3[_0xee4bb1(0x187)]===_0xee4bb1(0x14c)||_0x578be3[_0xee4bb1(0x173)]===!![]||_0x578be3[_0xee4bb1(0x176)]===!![]||_0x578be3['tsv']===!![]||_0x578be3[_0xee4bb1(0x14c)]===!![];}export function parseOutputOptions(_0x5e8699){const _0x52b182=a92_0x2367;return{'format':_0x5e8699[_0x52b182(0x187)]||'table','output':_0x5e8699[_0x52b182(0x16a)]||'','limit':_0x5e8699[_0x52b182(0x179)],'color':_0x5e8699[_0x52b182(0x184)],'noColor':_0x5e8699[_0x52b182(0x17d)]};}function convertSDKResultToQueryResult(_0x158d67){const _0x55e895=a92_0x2367,_0x1a85b2=[];if(_0x158d67[_0x55e895(0x15a)]>0x0){const _0x4fb3eb=_0x158d67[0x0];for(const [_0x58dd75,_0x15fc51]of Object['entries'](_0x4fb3eb)){let _0x507966=_0x55e895(0x162);if(typeof _0x15fc51===_0x55e895(0x17a))_0x507966=Number[_0x55e895(0x14d)](_0x15fc51)?_0x55e895(0x171):_0x55e895(0x188);else{if(typeof _0x15fc51===_0x55e895(0x15e))_0x507966='boolean';else _0x15fc51===null&&(_0x507966=_0x55e895(0x162));}_0x1a85b2[_0x55e895(0x16b)]({'name':_0x58dd75,'type':_0x507966});}}return{'queryId':'sdk-result','columns':_0x1a85b2,'data':_0x158d67,'stats':{'state':_0x55e895(0x158),'queued':![],'scheduled':!![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x158d67[_0x55e895(0x15a)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}};}export async function formatSDKOutput(_0x1db1fe,_0x244876){const _0x33ca1e=convertSDKResultToQueryResult(_0x1db1fe);return formatQueryOutput(_0x33ca1e,_0x244876);}function a92_0x2367(_0x5c1aaf,_0x2c0e82){_0x5c1aaf=_0x5c1aaf-0x14a;const _0x18555e=a92_0x1855();let _0x236701=_0x18555e[_0x5c1aaf];return _0x236701;}export async function formatQueryOutput(_0x74b873,_0x1a6dda){const _0xc58d04=a92_0x2367,{format:_0x3cf5eb,limit:_0x14ba7a,output:_0x560f0d,color:_0x489d86,noColor:_0x249194}=_0x1a6dda,_0x5433ea=Boolean(_0x560f0d)&&!_0x489d86,_0x965aca={'color':_0x489d86,'noColor':_0x249194||_0x5433ea};if(_0x3cf5eb===_0xc58d04(0x14c)){const _0x4c8ca9=shouldUseLess(_0x3cf5eb,_0x560f0d);return formatAsTable(_0x74b873,_0x14ba7a,_0x4c8ca9,_0x965aca);}else{if(_0x3cf5eb===_0xc58d04(0x173))return formatAsJSON(_0x74b873,_0x965aca);else return _0x3cf5eb===_0xc58d04(0x176)?formatAsJSONL(_0x74b873,_0x965aca):formatQueryResult(_0x74b873,_0x3cf5eb);}}function shouldUseLess(_0x43a1fa,_0x4faae4){const _0x101d3d=a92_0x2367;return _0x43a1fa===_0x101d3d(0x14c)&&process['stdout'][_0x101d3d(0x181)]&&!_0x4faae4;}export function resolveOutputOptions(_0x1be3a7){const _0x565d07=a92_0x2367,_0x3be37a=resolveOutputFormat(_0x1be3a7[_0x565d07(0x187)],_0x1be3a7[_0x565d07(0x16a)],_0x565d07(0x14c));let _0x3a94bd=typeof _0x1be3a7['limit']===_0x565d07(0x17a)?_0x1be3a7[_0x565d07(0x179)]:parseInt(_0x1be3a7[_0x565d07(0x179)]||String(DEFAULT_DISPLAY_LIMIT),0xa);const _0x352d61=_0x1be3a7['output']||'';return shouldUseLess(_0x3be37a,_0x352d61)&&(_0x3a94bd=Infinity),{'format':_0x3be37a,'output':_0x352d61,'limit':_0x3a94bd,'color':_0x1be3a7[_0x565d07(0x184)],'noColor':_0x1be3a7[_0x565d07(0x17d)]};}export function writeOutput(_0x1672aa,_0x30e54b,_0xe9e98c){const _0x3be1df=a92_0x2367;return _0x30e54b?(writeFileSync(_0x30e54b,_0x1672aa),console[_0x3be1df(0x160)](_0x3be1df(0x157)+_0x30e54b),Promise[_0x3be1df(0x175)]()):shouldUseLess(_0xe9e98c||'','')?new Promise(_0x36ed2d=>{const _0x5750d6=_0x3be1df,_0x20f417=spawn(_0x5750d6(0x14a),['-FXRSn'],{'stdio':[_0x5750d6(0x159),'inherit',_0x5750d6(0x170)]});let _0x264002=![];_0x20f417['on'](_0x5750d6(0x160),()=>{const _0x45f444=_0x5750d6;!_0x264002&&(_0x264002=!![],console[_0x45f444(0x14f)](_0x1672aa),_0x36ed2d());}),_0x20f417['on'](_0x5750d6(0x168),()=>{!_0x264002&&(_0x264002=!![],_0x36ed2d());}),_0x20f417['on'](_0x5750d6(0x165),()=>{const _0x252173=_0x5750d6;!_0x264002&&_0x20f417[_0x252173(0x183)]&&(_0x20f417[_0x252173(0x183)]['on'](_0x252173(0x160),()=>{}),_0x20f417['stdin']['write'](_0x1672aa),_0x20f417[_0x252173(0x183)][_0x252173(0x155)]());}),!_0x20f417['stdin']&&(!_0x264002&&(_0x264002=!![],console[_0x5750d6(0x14f)](_0x1672aa),_0x36ed2d()));}):(console[_0x3be1df(0x14f)](_0x1672aa),Promise[_0x3be1df(0x175)]());}export async function handleSDKOutput(_0x4b5554,_0x516cc2){const _0x4945e8=a92_0x2367,_0x9e4bfd=resolveOutputOptions(_0x516cc2),_0x191db0=await formatSDKOutput(_0x4b5554,_0x9e4bfd);await writeOutput(_0x191db0,_0x9e4bfd['output']||undefined,_0x9e4bfd[_0x4945e8(0x187)]);}export async function handleQueryOutput(_0x21d310,_0x2e4857){const _0x49bc73=a92_0x2367,_0x4c7bd9=resolveOutputOptions(_0x2e4857),_0x134bc5=await formatQueryOutput(_0x21d310,_0x4c7bd9);await writeOutput(_0x134bc5,_0x4c7bd9[_0x49bc73(0x16a)]||undefined,_0x4c7bd9[_0x49bc73(0x187)]);}async function formatSingleObject(_0x54047e,_0x2cc147){const _0x10a512=a92_0x2367,{format:_0x1118c6,color:_0xa1ed50,noColor:_0x3668d0}=_0x2cc147,_0x428003={'color':_0xa1ed50,'noColor':_0x3668d0};if(_0x1118c6===_0x10a512(0x173)){if(shouldUseColor(_0x428003))return colorizeJSON(_0x54047e,_0x428003);return JSON[_0x10a512(0x18c)](_0x54047e,null,0x2);}else{if(_0x1118c6==='jsonl'){if(shouldUseColor(_0x428003))return colorizeJSONCompact(_0x54047e,_0x428003);return JSON[_0x10a512(0x18c)](_0x54047e);}else{if(_0x1118c6==='tsv')return Object[_0x10a512(0x16c)](_0x54047e)[_0x10a512(0x182)](([_0x5d0432,_0x297873])=>_0x5d0432+'\x09'+_0x297873)[_0x10a512(0x163)]('\x0a');else{const _0x25e421=Object[_0x10a512(0x16c)](_0x54047e);if(_0x25e421[_0x10a512(0x15a)]===0x0)return _0x10a512(0x15d);const _0x1aa2e3=_0x54047e['debug'],_0x28fb51=_0x54047e[_0x10a512(0x16e)],_0x48ad19=_0x54047e['params'],_0x229b5e=_0x54047e[_0x10a512(0x15c)],_0x4ed44b=_0x28fb51?typeof _0x28fb51===_0x10a512(0x172)?_0x28fb51:JSON['stringify'](_0x28fb51,null,0x2):undefined,_0x5a2a36=_0x48ad19&&Object['keys'](_0x48ad19)['length']>0x0?JSON[_0x10a512(0x18c)](_0x48ad19,null,0x2):undefined,_0x4f7d28=_0x229b5e&&Object['keys'](_0x229b5e)[_0x10a512(0x15a)]>0x0?JSON[_0x10a512(0x18c)](_0x229b5e,null,0x2):undefined,_0x3f58bd=_0x25e421[_0x10a512(0x153)](([_0x47061d])=>_0x47061d!==_0x10a512(0x154)&&_0x47061d!==_0x10a512(0x16e)&&_0x47061d!=='params'&&_0x47061d!==_0x10a512(0x15c)),_0x46eb47=Math[_0x10a512(0x18a)](..._0x3f58bd['map'](([_0x1df6b9])=>_0x1df6b9[_0x10a512(0x15a)])),_0x5b1ef7=Math['max'](..._0x3f58bd[_0x10a512(0x182)](([,_0x36d535])=>{const _0x16b1ac=_0x10a512;try{const _0x58f191=_0x36d535===null||_0x36d535===undefined?'':typeof _0x36d535===_0x16b1ac(0x14b)?JSON['stringify'](_0x36d535):String(_0x36d535),_0x496681=_0x58f191[_0x16b1ac(0x156)]('\x0a');return Math[_0x16b1ac(0x18a)](..._0x496681[_0x16b1ac(0x182)](_0x2ce910=>_0x2ce910[_0x16b1ac(0x15a)]),0x0);}catch{return 0x0;}}),0x14),_0x41d65d=[];_0x41d65d[_0x10a512(0x16b)](colorBorder('┌─'+'─'['repeat'](_0x46eb47)+_0x10a512(0x17b)+'─'['repeat'](_0x5b1ef7)+'─┐',_0x428003)),_0x3f58bd[_0x10a512(0x186)](([_0x5d2b09,_0x1fe945])=>{const _0x554510=_0x10a512;let _0x2cce9b;try{_0x2cce9b=_0x1fe945===null||_0x1fe945===undefined?'':typeof _0x1fe945==='object'?JSON[_0x554510(0x18c)](_0x1fe945):String(_0x1fe945);}catch{_0x2cce9b='[Object]';}const _0x229b7e=_0x5d2b09['padEnd'](_0x46eb47),_0x1763b1=_0x2cce9b['split']('\x0a');_0x1763b1['forEach']((_0x56ae88,_0x4767e6)=>{const _0x4e8c=_0x554510,_0x99b4cd=colorBorder('│',_0x428003);_0x4767e6===0x0?_0x41d65d[_0x4e8c(0x16b)](_0x99b4cd+'\x20'+_0x229b7e+'\x20'+_0x99b4cd+'\x20'+_0x56ae88['padEnd'](_0x5b1ef7)+'\x20'+_0x99b4cd):_0x41d65d[_0x4e8c(0x16b)](_0x99b4cd+'\x20'+'\x20'['repeat'](_0x46eb47)+'\x20'+_0x99b4cd+'\x20'+_0x56ae88[_0x4e8c(0x16d)](_0x5b1ef7)+'\x20'+_0x99b4cd);});}),_0x41d65d[_0x10a512(0x16b)](colorBorder('└─'+'─'[_0x10a512(0x18d)](_0x46eb47)+'─┴─'+'─'[_0x10a512(0x18d)](_0x5b1ef7)+'─┘',_0x428003));_0x4ed44b&&(_0x41d65d[_0x10a512(0x16b)](''),_0x41d65d[_0x10a512(0x16b)](String(a92_0x3b1f0a[_0x10a512(0x17f)][_0x10a512(0x166)](_0x10a512(0x151)))),_0x41d65d['push'](_0x4ed44b));_0x5a2a36&&(_0x41d65d[_0x10a512(0x16b)](''),_0x41d65d[_0x10a512(0x16b)](String(a92_0x3b1f0a[_0x10a512(0x152)][_0x10a512(0x166)]('[params]'))),_0x41d65d[_0x10a512(0x16b)](_0x5a2a36));_0x4f7d28&&(_0x41d65d[_0x10a512(0x16b)](''),_0x41d65d['push'](String(a92_0x3b1f0a[_0x10a512(0x164)]['bold']('[rule]'))),_0x41d65d['push'](_0x4f7d28));if(_0x1aa2e3){if(_0x1aa2e3[_0x10a512(0x14e)]){_0x41d65d[_0x10a512(0x16b)](''),_0x41d65d[_0x10a512(0x16b)](String(a92_0x3b1f0a[_0x10a512(0x161)][_0x10a512(0x166)](_0x10a512(0x174))));const _0xfa0148=_0x1aa2e3[_0x10a512(0x14e)][_0x10a512(0x156)]('\x0a');_0xfa0148[_0x10a512(0x186)](_0x472f38=>{const _0x242fbc=_0x10a512;_0x472f38[_0x242fbc(0x178)]()&&_0x41d65d[_0x242fbc(0x16b)](_0x472f38);});}if(_0x1aa2e3[_0x10a512(0x15b)]){_0x41d65d[_0x10a512(0x16b)](''),_0x41d65d[_0x10a512(0x16b)](String(a92_0x3b1f0a[_0x10a512(0x150)][_0x10a512(0x166)](_0x10a512(0x18e))));const _0x3db825=_0x1aa2e3[_0x10a512(0x15b)][_0x10a512(0x156)]('\x0a');_0x3db825[_0x10a512(0x186)](_0x3721b6=>{const _0x3fb029=_0x10a512;_0x3721b6[_0x3fb029(0x178)]()&&_0x41d65d[_0x3fb029(0x16b)](_0x3721b6);});}}return _0x41d65d[_0x10a512(0x163)]('\x0a');}}}}export async function handleSingleObjectOutput(_0x1f26f5,_0x45369d){const _0x55b463=a92_0x2367;if(_0x45369d[_0x55b463(0x187)]===_0x55b463(0x14c)){await handleSDKOutput([_0x1f26f5],_0x45369d);return;}const _0x5b27b5=resolveOutputOptions(_0x45369d),_0x477bd4=await formatSingleObject(_0x1f26f5,_0x5b27b5);await writeOutput(_0x477bd4,_0x5b27b5[_0x55b463(0x16a)]||undefined,_0x5b27b5[_0x55b463(0x187)]);}
|
|
1
|
+
(function(_0x3629f2,_0xa393c3){const _0x846b89=a92_0x48d4,_0x2131ab=_0x3629f2();while(!![]){try{const _0x2e7d11=-parseInt(_0x846b89(0x1a6))/0x1+-parseInt(_0x846b89(0x19d))/0x2*(parseInt(_0x846b89(0x177))/0x3)+parseInt(_0x846b89(0x171))/0x4*(parseInt(_0x846b89(0x18b))/0x5)+-parseInt(_0x846b89(0x17c))/0x6+parseInt(_0x846b89(0x1a1))/0x7*(parseInt(_0x846b89(0x19f))/0x8)+-parseInt(_0x846b89(0x194))/0x9*(-parseInt(_0x846b89(0x168))/0xa)+-parseInt(_0x846b89(0x17e))/0xb*(-parseInt(_0x846b89(0x195))/0xc);if(_0x2e7d11===_0xa393c3)break;else _0x2131ab['push'](_0x2131ab['shift']());}catch(_0x137683){_0x2131ab['push'](_0x2131ab['shift']());}}}(a92_0x26e8,0x1b821));import{writeFileSync}from'fs';function a92_0x26e8(){const _0x25c07b=['output','boolean','[params]','params','repeat','9zZloUu','write','map','jsonl','limit','408186Dxgbzh','join','341OJlhjq','[query]','end','format','split','stderr','entries','padEnd','close','inherit','keys','max','pipe','194125TsaWwg','less','cmdout','json','bold','tsv','error','[rule]','resolve','9uNnqSM','62388TrqMxc','forEach','isInteger','color','push','double','varchar','red','118718xkGdZh','isTTY','89536SdBCJz','length','77sMTzXN','stringify','trim','-FXRSn','debug','218609pHlERv','blue','log','spawn','rule','query','─┴─','2154590KcRkfV','cyan','Results\x20saved\x20to\x20','noColor','filter','object','stdin','stdout','table','8MuUfxH'];a92_0x26e8=function(){return _0x25c07b;};return a92_0x26e8();}import{spawn}from'child_process';import{resolveOutputFormat}from'./format-detector.js';import{colorBorder,colorizeJSON,colorizeJSONCompact,shouldUseColor}from'./colors.js';import a92_0x1ba0b0 from'chalk';import{DEFAULT_DISPLAY_LIMIT}from'./constants.js';import{formatAsTable,formatAsJSON,formatAsJSONL,formatQueryResult}from'./formatters.js';export function isStructuredFormat(_0x40a61c){const _0x3a4a4e=a92_0x48d4;return _0x40a61c[_0x3a4a4e(0x181)]===_0x3a4a4e(0x18e)||_0x40a61c[_0x3a4a4e(0x181)]===_0x3a4a4e(0x17a)||_0x40a61c[_0x3a4a4e(0x181)]===_0x3a4a4e(0x190)||_0x40a61c[_0x3a4a4e(0x181)]===_0x3a4a4e(0x170)||_0x40a61c[_0x3a4a4e(0x18e)]===!![]||_0x40a61c[_0x3a4a4e(0x17a)]===!![]||_0x40a61c[_0x3a4a4e(0x190)]===!![]||_0x40a61c[_0x3a4a4e(0x170)]===!![];}export function parseOutputOptions(_0x514267){const _0x89b9d8=a92_0x48d4;return{'format':_0x514267[_0x89b9d8(0x181)]||_0x89b9d8(0x170),'output':_0x514267[_0x89b9d8(0x172)]||'','limit':_0x514267['limit'],'color':_0x514267[_0x89b9d8(0x198)],'noColor':_0x514267['noColor']};}function convertSDKResultToQueryResult(_0x1efa24){const _0x5888a1=a92_0x48d4,_0x1a634d=[];if(_0x1efa24[_0x5888a1(0x1a0)]>0x0){const _0x55de03=_0x1efa24[0x0];for(const [_0x131678,_0x593679]of Object[_0x5888a1(0x184)](_0x55de03)){let _0x26ba99='varchar';if(typeof _0x593679==='number')_0x26ba99=Number[_0x5888a1(0x197)](_0x593679)?'bigint':_0x5888a1(0x19a);else{if(typeof _0x593679===_0x5888a1(0x173))_0x26ba99=_0x5888a1(0x173);else _0x593679===null&&(_0x26ba99=_0x5888a1(0x19b));}_0x1a634d['push']({'name':_0x131678,'type':_0x26ba99});}}return{'queryId':'sdk-result','columns':_0x1a634d,'data':_0x1efa24,'stats':{'state':'FINISHED','queued':![],'scheduled':!![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x1efa24['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}};}export async function formatSDKOutput(_0x1a1d25,_0x420c0f){const _0x32c321=convertSDKResultToQueryResult(_0x1a1d25);return formatQueryOutput(_0x32c321,_0x420c0f);}export async function formatQueryOutput(_0x544d7d,_0x33701a){const _0x7ca427=a92_0x48d4,{format:_0x57a29a,limit:_0x1b7f22,output:_0x2c34c6,color:_0x32d1c1,noColor:_0x132c6d}=_0x33701a,_0x577ba8=Boolean(_0x2c34c6)&&!_0x32d1c1,_0x1b6cec={'color':_0x32d1c1,'noColor':_0x132c6d||_0x577ba8};if(_0x57a29a==='table'){const _0x582c3c=shouldUseLess(_0x57a29a,_0x2c34c6);return formatAsTable(_0x544d7d,_0x1b7f22,_0x582c3c,_0x1b6cec);}else{if(_0x57a29a==='json')return formatAsJSON(_0x544d7d,_0x1b6cec);else return _0x57a29a===_0x7ca427(0x17a)?formatAsJSONL(_0x544d7d,_0x1b6cec):formatQueryResult(_0x544d7d,_0x57a29a);}}function shouldUseLess(_0x1f5ce0,_0x278eab){const _0xc7495a=a92_0x48d4;return _0x1f5ce0===_0xc7495a(0x170)&&process[_0xc7495a(0x16f)][_0xc7495a(0x19e)]&&!_0x278eab;}export function resolveOutputOptions(_0x477d5d){const _0x12e0ed=a92_0x48d4,_0x424519=resolveOutputFormat(_0x477d5d[_0x12e0ed(0x181)],_0x477d5d['output'],_0x12e0ed(0x170));let _0x140449=typeof _0x477d5d['limit']==='number'?_0x477d5d['limit']:parseInt(_0x477d5d[_0x12e0ed(0x17b)]||String(DEFAULT_DISPLAY_LIMIT),0xa);const _0x41fd16=_0x477d5d['output']||'';return shouldUseLess(_0x424519,_0x41fd16)&&(_0x140449=Infinity),{'format':_0x424519,'output':_0x41fd16,'limit':_0x140449,'color':_0x477d5d[_0x12e0ed(0x198)],'noColor':_0x477d5d[_0x12e0ed(0x16b)]};}function a92_0x48d4(_0x2dcb99,_0x2dbeaf){_0x2dcb99=_0x2dcb99-0x167;const _0x26e848=a92_0x26e8();let _0x48d430=_0x26e848[_0x2dcb99];return _0x48d430;}export function writeOutput(_0x399dfc,_0x34ddea,_0x499a1f){const _0x2946aa=a92_0x48d4;return _0x34ddea?(writeFileSync(_0x34ddea,_0x399dfc),console[_0x2946aa(0x191)](_0x2946aa(0x16a)+_0x34ddea),Promise['resolve']()):shouldUseLess(_0x499a1f||'','')?new Promise(_0xf8eb58=>{const _0x285a55=_0x2946aa,_0x4ca1dc=spawn(_0x285a55(0x18c),[_0x285a55(0x1a4)],{'stdio':[_0x285a55(0x18a),_0x285a55(0x187),_0x285a55(0x187)]});let _0xe0d587=![];_0x4ca1dc['on'](_0x285a55(0x191),()=>{const _0xc45cee=_0x285a55;!_0xe0d587&&(_0xe0d587=!![],console[_0xc45cee(0x1a8)](_0x399dfc),_0xf8eb58());}),_0x4ca1dc['on'](_0x285a55(0x186),()=>{!_0xe0d587&&(_0xe0d587=!![],_0xf8eb58());}),_0x4ca1dc['on'](_0x285a55(0x1a9),()=>{const _0x35c774=_0x285a55;!_0xe0d587&&_0x4ca1dc[_0x35c774(0x16e)]&&(_0x4ca1dc[_0x35c774(0x16e)]['on'](_0x35c774(0x191),()=>{}),_0x4ca1dc['stdin'][_0x35c774(0x178)](_0x399dfc),_0x4ca1dc[_0x35c774(0x16e)][_0x35c774(0x180)]());}),!_0x4ca1dc['stdin']&&(!_0xe0d587&&(_0xe0d587=!![],console[_0x285a55(0x1a8)](_0x399dfc),_0xf8eb58()));}):(console['log'](_0x399dfc),Promise[_0x2946aa(0x193)]());}export async function handleSDKOutput(_0x21c474,_0x49d3a9){const _0x48e0f1=a92_0x48d4,_0x2a00a0=resolveOutputOptions(_0x49d3a9),_0x57e168=await formatSDKOutput(_0x21c474,_0x2a00a0);await writeOutput(_0x57e168,_0x2a00a0[_0x48e0f1(0x172)]||undefined,_0x2a00a0[_0x48e0f1(0x181)]);}export async function handleQueryOutput(_0xabae40,_0x9df124){const _0x45b500=a92_0x48d4,_0x54d852=resolveOutputOptions(_0x9df124),_0x4d908e=await formatQueryOutput(_0xabae40,_0x54d852);await writeOutput(_0x4d908e,_0x54d852[_0x45b500(0x172)]||undefined,_0x54d852[_0x45b500(0x181)]);}async function formatSingleObject(_0x172abe,_0x37f0cf){const _0x18c36d=a92_0x48d4,{format:_0x3e7b6a,color:_0x26d7c2,noColor:_0x29d96d}=_0x37f0cf,_0xa66cdd={'color':_0x26d7c2,'noColor':_0x29d96d};if(_0x3e7b6a===_0x18c36d(0x18e)){if(shouldUseColor(_0xa66cdd))return colorizeJSON(_0x172abe,_0xa66cdd);return JSON[_0x18c36d(0x1a2)](_0x172abe,null,0x2);}else{if(_0x3e7b6a===_0x18c36d(0x17a)){if(shouldUseColor(_0xa66cdd))return colorizeJSONCompact(_0x172abe,_0xa66cdd);return JSON[_0x18c36d(0x1a2)](_0x172abe);}else{if(_0x3e7b6a===_0x18c36d(0x190))return Object[_0x18c36d(0x184)](_0x172abe)[_0x18c36d(0x179)](([_0x56ef70,_0x2b8b38])=>_0x56ef70+'\x09'+_0x2b8b38)[_0x18c36d(0x17d)]('\x0a');else{const _0x302576=Object[_0x18c36d(0x184)](_0x172abe);if(_0x302576[_0x18c36d(0x1a0)]===0x0)return'No\x20data';const _0x333729=_0x172abe['debug'],_0x400331=_0x172abe['query'],_0x4ff15b=_0x172abe[_0x18c36d(0x175)],_0x2200d6=_0x172abe[_0x18c36d(0x1aa)],_0x5cc2a5=_0x400331?typeof _0x400331==='string'?_0x400331:JSON[_0x18c36d(0x1a2)](_0x400331,null,0x2):undefined,_0x5c9c24=_0x4ff15b&&Object[_0x18c36d(0x188)](_0x4ff15b)[_0x18c36d(0x1a0)]>0x0?JSON[_0x18c36d(0x1a2)](_0x4ff15b,null,0x2):undefined,_0x361180=_0x2200d6&&Object[_0x18c36d(0x188)](_0x2200d6)[_0x18c36d(0x1a0)]>0x0?JSON[_0x18c36d(0x1a2)](_0x2200d6,null,0x2):undefined,_0x52fd21=_0x302576[_0x18c36d(0x16c)](([_0x5eb6e1])=>_0x5eb6e1!==_0x18c36d(0x1a5)&&_0x5eb6e1!==_0x18c36d(0x1ab)&&_0x5eb6e1!=='params'&&_0x5eb6e1!==_0x18c36d(0x1aa)),_0x5b65cd=Math[_0x18c36d(0x189)](..._0x52fd21[_0x18c36d(0x179)](([_0x521284])=>_0x521284[_0x18c36d(0x1a0)])),_0x414df4=Math[_0x18c36d(0x189)](..._0x52fd21[_0x18c36d(0x179)](([,_0x394a79])=>{const _0x3a5e74=_0x18c36d;try{const _0x39eca0=_0x394a79===null||_0x394a79===undefined?'':typeof _0x394a79===_0x3a5e74(0x16d)?JSON[_0x3a5e74(0x1a2)](_0x394a79):String(_0x394a79),_0x7480a5=_0x39eca0[_0x3a5e74(0x182)]('\x0a');return Math[_0x3a5e74(0x189)](..._0x7480a5[_0x3a5e74(0x179)](_0x185f9f=>_0x185f9f[_0x3a5e74(0x1a0)]),0x0);}catch{return 0x0;}}),0x14),_0x4e8b36=[];_0x4e8b36[_0x18c36d(0x199)](colorBorder('┌─'+'─'['repeat'](_0x5b65cd)+'─┬─'+'─'[_0x18c36d(0x176)](_0x414df4)+'─┐',_0xa66cdd)),_0x52fd21[_0x18c36d(0x196)](([_0x1fe676,_0x356a31])=>{const _0x17cf76=_0x18c36d;let _0x3d5c83;try{_0x3d5c83=_0x356a31===null||_0x356a31===undefined?'':typeof _0x356a31===_0x17cf76(0x16d)?JSON[_0x17cf76(0x1a2)](_0x356a31):String(_0x356a31);}catch{_0x3d5c83='[Object]';}const _0x420d3b=_0x1fe676['padEnd'](_0x5b65cd),_0x59bab2=_0x3d5c83[_0x17cf76(0x182)]('\x0a');_0x59bab2[_0x17cf76(0x196)]((_0x201a26,_0x60c28)=>{const _0x4e267b=_0x17cf76,_0x3cfb7a=colorBorder('│',_0xa66cdd);_0x60c28===0x0?_0x4e8b36['push'](_0x3cfb7a+'\x20'+_0x420d3b+'\x20'+_0x3cfb7a+'\x20'+_0x201a26[_0x4e267b(0x185)](_0x414df4)+'\x20'+_0x3cfb7a):_0x4e8b36[_0x4e267b(0x199)](_0x3cfb7a+'\x20'+'\x20'[_0x4e267b(0x176)](_0x5b65cd)+'\x20'+_0x3cfb7a+'\x20'+_0x201a26[_0x4e267b(0x185)](_0x414df4)+'\x20'+_0x3cfb7a);});}),_0x4e8b36[_0x18c36d(0x199)](colorBorder('└─'+'─'[_0x18c36d(0x176)](_0x5b65cd)+_0x18c36d(0x167)+'─'[_0x18c36d(0x176)](_0x414df4)+'─┘',_0xa66cdd));_0x5cc2a5&&(_0x4e8b36[_0x18c36d(0x199)](''),_0x4e8b36[_0x18c36d(0x199)](String(a92_0x1ba0b0['yellow'][_0x18c36d(0x18f)](_0x18c36d(0x17f)))),_0x4e8b36[_0x18c36d(0x199)](_0x5cc2a5));_0x5c9c24&&(_0x4e8b36[_0x18c36d(0x199)](''),_0x4e8b36['push'](String(a92_0x1ba0b0[_0x18c36d(0x1a7)][_0x18c36d(0x18f)](_0x18c36d(0x174)))),_0x4e8b36['push'](_0x5c9c24));_0x361180&&(_0x4e8b36['push'](''),_0x4e8b36[_0x18c36d(0x199)](String(a92_0x1ba0b0['magenta'][_0x18c36d(0x18f)](_0x18c36d(0x192)))),_0x4e8b36['push'](_0x361180));if(_0x333729){if(_0x333729[_0x18c36d(0x183)]){_0x4e8b36[_0x18c36d(0x199)](''),_0x4e8b36[_0x18c36d(0x199)](String(a92_0x1ba0b0[_0x18c36d(0x19c)][_0x18c36d(0x18f)]('[error]')));const _0x1ab51b=_0x333729[_0x18c36d(0x183)][_0x18c36d(0x182)]('\x0a');_0x1ab51b[_0x18c36d(0x196)](_0x1f9b1a=>{const _0x1a7a53=_0x18c36d;_0x1f9b1a[_0x1a7a53(0x1a3)]()&&_0x4e8b36[_0x1a7a53(0x199)](_0x1f9b1a);});}if(_0x333729[_0x18c36d(0x18d)]){_0x4e8b36[_0x18c36d(0x199)](''),_0x4e8b36[_0x18c36d(0x199)](String(a92_0x1ba0b0[_0x18c36d(0x169)][_0x18c36d(0x18f)]('[logs]')));const _0x54b02d=_0x333729[_0x18c36d(0x18d)][_0x18c36d(0x182)]('\x0a');_0x54b02d[_0x18c36d(0x196)](_0x42c48d=>{const _0x5a7bbf=_0x18c36d;_0x42c48d[_0x5a7bbf(0x1a3)]()&&_0x4e8b36[_0x5a7bbf(0x199)](_0x42c48d);});}}return _0x4e8b36[_0x18c36d(0x17d)]('\x0a');}}}}export async function handleSingleObjectOutput(_0x4427b9,_0x41406f){const _0x2d9033=a92_0x48d4;if(_0x41406f['format']==='table'){await handleSDKOutput([_0x4427b9],_0x41406f);return;}const _0x35e755=resolveOutputOptions(_0x41406f),_0x15a191=await formatSingleObject(_0x4427b9,_0x35e755);await writeOutput(_0x15a191,_0x35e755[_0x2d9033(0x172)]||undefined,_0x35e755[_0x2d9033(0x181)]);}
|
package/dist/utils/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x2bb444,_0x3003f4){const _0x2029c1=a93_0x2ebc,_0x48b406=_0x2bb444();while(!![]){try{const _0x5d6872=parseInt(_0x2029c1(0x13f))/0x1+parseInt(_0x2029c1(0x142))/0x2*(-parseInt(_0x2029c1(0x144))/0x3)+-parseInt(_0x2029c1(0x13b))/0x4+-parseInt(_0x2029c1(0x143))/0x5*(parseInt(_0x2029c1(0x13c))/0x6)+-parseInt(_0x2029c1(0x145))/0x7+-parseInt(_0x2029c1(0x13d))/0x8*(parseInt(_0x2029c1(0x141))/0x9)+parseInt(_0x2029c1(0x140))/0xa;if(_0x5d6872===_0x3003f4)break;else _0x48b406['push'](_0x48b406['shift']());}catch(_0x1816e3){_0x48b406['push'](_0x48b406['shift']());}}}(a93_0x1d3e,0xb9ae5));export const DEFAULT_DISPLAY_LIMIT=0x28;export const DEFAULT_LISTING_LIMIT=0x2710;export const DEFAULT_LLM_LIMIT=0x32;function a93_0x2ebc(_0x3902d0,_0x5e426f){_0x3902d0=_0x3902d0-0x13b;const _0x1d3e7a=a93_0x1d3e();let _0x2ebc25=_0x1d3e7a[_0x3902d0];return _0x2ebc25;}export function resolveLimit(_0x52c067,_0x3b2f54){const _0x43ab01=a93_0x2ebc;if(_0x52c067===undefined)return _0x3b2f54;if(typeof _0x52c067===_0x43ab01(0x13e))return _0x52c067;return parseInt(_0x52c067,0xa);}function a93_0x1d3e(){const _0x3f2e0d=['5320938MUdAZN','4551480lABCCW','30IoWZHT','551032quGnLC','number','194686rZUKBa','52603010YepKVL','189EPzStk','4xozmFp','184495WcQseQ','1748220jqtvjW'];a93_0x1d3e=function(){return _0x3f2e0d;};return a93_0x1d3e();}
|
package/dist/utils/diff.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3ae83b,_0x5b2f7e){const _0x47f59e=a94_0x1e3a,_0x8db7fa=_0x3ae83b();while(!![]){try{const _0x193bc3=parseInt(_0x47f59e(0xca))/0x1+parseInt(_0x47f59e(0xcb))/0x2+-parseInt(_0x47f59e(0xc3))/0x3+parseInt(_0x47f59e(0xce))/0x4*(parseInt(_0x47f59e(0xb9))/0x5)+parseInt(_0x47f59e(0xbe))/0x6+parseInt(_0x47f59e(0xbb))/0x7+-parseInt(_0x47f59e(0xd4))/0x8*(parseInt(_0x47f59e(0xc7))/0x9);if(_0x193bc3===_0x5b2f7e)break;else _0x8db7fa['push'](_0x8db7fa['shift']());}catch(_0x1fef53){_0x8db7fa['push'](_0x8db7fa['shift']());}}}(a94_0x1d4d,0x4be3a));import a94_0x433379 from'chalk';export function generateDiff(_0x1a92b7,_0x2a0a10){const _0x2d4b41=a94_0x1e3a,_0x531f38=_0x1a92b7[_0x2d4b41(0xc0)]('\x0a'),_0x14375c=_0x2a0a10[_0x2d4b41(0xc0)]('\x0a'),_0x339fc5=[],_0x5fd39d=computeLCS(_0x531f38,_0x14375c);let _0x244ad6=0x0,_0x1cc87=0x0,_0x2a6068=0x0;while(_0x244ad6<_0x531f38[_0x2d4b41(0xba)]||_0x1cc87<_0x14375c[_0x2d4b41(0xba)]){if(_0x2a6068<_0x5fd39d[_0x2d4b41(0xba)]&&_0x244ad6<_0x531f38[_0x2d4b41(0xba)]&&_0x531f38[_0x244ad6]===_0x5fd39d[_0x2a6068])_0x1cc87<_0x14375c[_0x2d4b41(0xba)]&&_0x14375c[_0x1cc87]===_0x5fd39d[_0x2a6068]?(_0x339fc5[_0x2d4b41(0xb6)]({'type':_0x2d4b41(0xb5),'content':_0x531f38[_0x244ad6]}),_0x244ad6++,_0x1cc87++,_0x2a6068++):(_0x339fc5[_0x2d4b41(0xb6)]({'type':_0x2d4b41(0xd3),'content':_0x14375c[_0x1cc87]}),_0x1cc87++);else{if(_0x2a6068<_0x5fd39d[_0x2d4b41(0xba)]&&_0x1cc87<_0x14375c[_0x2d4b41(0xba)]&&_0x14375c[_0x1cc87]===_0x5fd39d[_0x2a6068])_0x339fc5[_0x2d4b41(0xb6)]({'type':_0x2d4b41(0xc5),'content':_0x531f38[_0x244ad6]}),_0x244ad6++;else{if(_0x244ad6<_0x531f38[_0x2d4b41(0xba)]&&(_0x2a6068>=_0x5fd39d[_0x2d4b41(0xba)]||_0x531f38[_0x244ad6]!==_0x5fd39d[_0x2a6068]))_0x339fc5[_0x2d4b41(0xb6)]({'type':'removed','content':_0x531f38[_0x244ad6]}),_0x244ad6++;else _0x1cc87<_0x14375c['length']&&(_0x339fc5[_0x2d4b41(0xb6)]({'type':_0x2d4b41(0xd3),'content':_0x14375c[_0x1cc87]}),_0x1cc87++);}}}return _0x339fc5;}function a94_0x1d4d(){const _0x164877=['1045656OKZCQr','green','removed','old','5335947sBpINV','size','content','120109RYwETR','827498AMdhrK','\x20\x20...','join','148876XBrvxZ','padStart','cyan','repeat','map','added','8GhBvfl','max','add','type','unchanged','push','dim','fill','15GsZzWR','length','2772168iiDBoj','unshift','min','1264428vEpFjp','new','split','\x20-\x20','red'];a94_0x1d4d=function(){return _0x164877;};return a94_0x1d4d();}function computeLCS(_0xa8a06a,_0x1cbc1c){const _0x1c493c=a94_0x1e3a,_0x2e0097=_0xa8a06a[_0x1c493c(0xba)],_0x5f241f=_0x1cbc1c[_0x1c493c(0xba)],_0x45b019=Array(_0x2e0097+0x1)[_0x1c493c(0xb8)](null)[_0x1c493c(0xd2)](()=>Array(_0x5f241f+0x1)[_0x1c493c(0xb8)](0x0));for(let _0x488c5d=0x1;_0x488c5d<=_0x2e0097;_0x488c5d++){for(let _0xa6d803=0x1;_0xa6d803<=_0x5f241f;_0xa6d803++){_0xa8a06a[_0x488c5d-0x1]===_0x1cbc1c[_0xa6d803-0x1]?_0x45b019[_0x488c5d][_0xa6d803]=_0x45b019[_0x488c5d-0x1][_0xa6d803-0x1]+0x1:_0x45b019[_0x488c5d][_0xa6d803]=Math['max'](_0x45b019[_0x488c5d-0x1][_0xa6d803],_0x45b019[_0x488c5d][_0xa6d803-0x1]);}}const _0x188843=[];let _0x5b6c0e=_0x2e0097,_0x709617=_0x5f241f;while(_0x5b6c0e>0x0&&_0x709617>0x0){if(_0xa8a06a[_0x5b6c0e-0x1]===_0x1cbc1c[_0x709617-0x1])_0x188843[_0x1c493c(0xbc)](_0xa8a06a[_0x5b6c0e-0x1]),_0x5b6c0e--,_0x709617--;else _0x45b019[_0x5b6c0e-0x1][_0x709617]>_0x45b019[_0x5b6c0e][_0x709617-0x1]?_0x5b6c0e--:_0x709617--;}return _0x188843;}export function formatDiffWithColors(_0x531b94,_0x42bc5f=0x3){const _0x4ab371=a94_0x1e3a,_0x5d963d=new Set();_0x531b94['forEach']((_0x55fea4,_0x5662c3)=>{const _0x22db24=a94_0x1e3a;_0x55fea4[_0x22db24(0xd7)]!==_0x22db24(0xb5)&&_0x5d963d[_0x22db24(0xd6)](_0x5662c3);});if(_0x5d963d[_0x4ab371(0xc8)]===0x0)return'';const _0x328048=new Set();for(const _0x2f5956 of _0x5d963d){for(let _0x20213b=Math[_0x4ab371(0xd5)](0x0,_0x2f5956-_0x42bc5f);_0x20213b<=Math[_0x4ab371(0xbd)](_0x531b94[_0x4ab371(0xba)]-0x1,_0x2f5956+_0x42bc5f);_0x20213b++){_0x328048[_0x4ab371(0xd6)](_0x20213b);}}const _0x14888d=[];let _0x596bcc=-0x1;const _0x501b43=_0x531b94[_0x4ab371(0xba)],_0x185a7e=Math[_0x4ab371(0xd5)](0x3,String(_0x501b43)[_0x4ab371(0xba)]),_0x2408aa=[];let _0x3a9599=0x0,_0x2a6714=0x0;for(const _0x3b3452 of _0x531b94){if(_0x3b3452['type']===_0x4ab371(0xc5))_0x3a9599++,_0x2408aa['push']({'old':_0x3a9599,'new':0x0});else _0x3b3452['type']==='added'?(_0x2a6714++,_0x2408aa[_0x4ab371(0xb6)]({'old':0x0,'new':_0x2a6714})):(_0x3a9599++,_0x2a6714++,_0x2408aa['push']({'old':_0x3a9599,'new':_0x2a6714}));}for(let _0x4abf17=0x0;_0x4abf17<_0x531b94[_0x4ab371(0xba)];_0x4abf17++){if(!_0x328048['has'](_0x4abf17))continue;_0x596bcc!==-0x1&&_0x4abf17>_0x596bcc+0x1&&_0x14888d[_0x4ab371(0xb6)](a94_0x433379[_0x4ab371(0xd0)](_0x4ab371(0xcc)));_0x596bcc=_0x4abf17;const _0xaf854f=_0x531b94[_0x4abf17],_0x52601f=_0x2408aa[_0x4abf17],_0x169cc6=_0x52601f['old']>0x0?String(_0x52601f[_0x4ab371(0xc6)])[_0x4ab371(0xcf)](_0x185a7e):'\x20'[_0x4ab371(0xd1)](_0x185a7e),_0x306883=_0x52601f[_0x4ab371(0xbf)]>0x0?String(_0x52601f[_0x4ab371(0xbf)])['padStart'](_0x185a7e):'\x20'[_0x4ab371(0xd1)](_0x185a7e);switch(_0xaf854f[_0x4ab371(0xd7)]){case _0x4ab371(0xc5):_0x14888d[_0x4ab371(0xb6)](a94_0x433379[_0x4ab371(0xc2)](_0x169cc6+'\x20'+_0x306883+_0x4ab371(0xc1)+_0xaf854f[_0x4ab371(0xc9)]));break;case _0x4ab371(0xd3):_0x14888d[_0x4ab371(0xb6)](a94_0x433379[_0x4ab371(0xc4)](_0x169cc6+'\x20'+_0x306883+'\x20+\x20'+_0xaf854f['content']));break;default:_0x14888d[_0x4ab371(0xb6)](a94_0x433379[_0x4ab371(0xb7)](_0x169cc6+'\x20'+_0x306883+'\x20\x20\x20'+_0xaf854f[_0x4ab371(0xc9)]));break;}}return _0x14888d[_0x4ab371(0xcd)]('\x0a');}function a94_0x1e3a(_0x392d71,_0x41bc23){_0x392d71=_0x392d71-0xb5;const _0x1d4de1=a94_0x1d4d();let _0x1e3a40=_0x1d4de1[_0x392d71];return _0x1e3a40;}export function hasChanges(_0x2bb61a){const _0x2b73a8=a94_0x1e3a;return _0x2bb61a['some'](_0x3993a1=>_0x3993a1['type']!==_0x2b73a8(0xb5));}
|