@treasuredata/tdx 0.9.1 → 0.9.2
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/agent-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/context-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/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/agent/agent-yaml.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.d.ts +27 -20
- package/dist/sdk/llm.d.ts.map +1 -1
- package/dist/sdk/llm.js +1 -1
- package/dist/sdk/llm.js.map +1 -1
- package/dist/sdk/query.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.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-config.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/journey-utils.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/llm-backup-utils.js +1 -1
- package/dist/utils/model-aliases.js +1 -1
- package/dist/utils/model-factors.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/segment-path-parser.js +1 -1
- package/dist/utils/segment-ref-parser.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sql-parser.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-config.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/tree-formatter.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/dist/utils/workflow-utils.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a3_0x49974b=a3_0x5285;function a3_0x1861(){const _0x9a034a=['/entities/segments/','createActivation','/entities/folders/','parentFolder','request','DELETE','/entities/parent_segments','segment-journey','400VIADZC','getParentSegmentSQL','9370720iujJhE','isArray','getSegment','state','listActivations','application/json','6789076KtDGur','scheduleType','666210TcVcHe','timezone','application/vnd.treasuredata.v1+json','/entities/journeys?folder_id=','sql','/audiences','getParentSegment','audienceId','listParentSegments','listJourneyActivations','updatedAt','/detail','connectionId','/segments/','PUT','9NqajPC','/syndications','none','475060OTSnBw','map','getSegmentFolder','columns','?realtime=','parentFolderId','PATCH','/behaviors','attributes','/activations','countPopulation','updateActivation','getActivation','/audiences/','deleteSegment','syndicationBehavior','authHeaders','data','/entities/journeys/','44484IFcbga','apiKey','/resume','paused','9488367KgbOvQ','listSegments','/folders','cdp','journeyBundleId','/syndications/','emailRecipients','GET','getAudienceAttributes','createJourneyActivation','description','createSegmentFolder','folder-segment','relationships','allColumns','listJourneys','createdAt','POST','journeyId','deleteActivation','query','site','updateParentSegment','activationTemplateId','resumeJourney','getSegmentSQL','pauseJourney','/pause','createJourney','/run','name','/segments','getAudienceBehaviors','rule','createSegment','httpClient','1086368XjJoUF','getJourney','notifyOn','createJourneySegment'];a3_0x1861=function(){return _0x9a034a;};return a3_0x1861();}(function(_0x3618ce,_0x45dadb){const _0x3c268d=a3_0x5285,_0x1d63c6=_0x3618ce();while(!![]){try{const _0x10f48e=parseInt(_0x3c268d(0x111))/0x1+-parseInt(_0x3c268d(0x127))/0x2+-parseInt(_0x3c268d(0x136))/0x3*(parseInt(_0x3c268d(0x139))/0x4)+-parseInt(_0x3c268d(0x11d))/0x5*(parseInt(_0x3c268d(0x14c))/0x6)+parseInt(_0x3c268d(0x125))/0x7+-parseInt(_0x3c268d(0x11f))/0x8+parseInt(_0x3c268d(0x150))/0x9;if(_0x10f48e===_0x45dadb)break;else _0x1d63c6['push'](_0x1d63c6['shift']());}catch(_0xebc208){_0x1d63c6['push'](_0x1d63c6['shift']());}}}(a3_0x1861,0xa04ff));function a3_0x5285(_0x4bfb1a,_0x2a4640){_0x4bfb1a=_0x4bfb1a-0x104;const _0x1861cb=a3_0x1861();let _0x52857e=_0x1861cb[_0x4bfb1a];return _0x52857e;}import{HTTPClient}from'./http-client.js';import{getEndpoint}from'../types/index.js';import{getAuthHeaders,toHeaderRecord}from'../core/auth.js';export class CDPApiClient{[a3_0x49974b(0x110)];[a3_0x49974b(0x149)];constructor(_0x1559ca,_0xa3f760){const _0x1abb1f=a3_0x49974b,_0x569282=getEndpoint(_0x1559ca[_0x1abb1f(0x165)],_0x1abb1f(0x153));this[_0x1abb1f(0x149)]=toHeaderRecord(getAuthHeaders(_0x1559ca['site'],_0x1559ca[_0x1abb1f(0x14d)])),this[_0x1abb1f(0x110)]=new HTTPClient(_0x569282,{...this['authHeaders'],'Accept':'application/vnd.treasuredata.v1+json','Content-Type':_0x1abb1f(0x124)},_0xa3f760);}async[a3_0x49974b(0x12f)](){const _0xb8a03a=a3_0x49974b,_0x36e60d=_0xb8a03a(0x11b),_0x57d9bf=await this[_0xb8a03a(0x110)]['request'](_0xb8a03a(0x157),_0x36e60d);return Array[_0xb8a03a(0x120)](_0x57d9bf)?_0x57d9bf:_0x57d9bf[_0xb8a03a(0x14a)];}async[a3_0x49974b(0x12d)](_0x843438){const _0x5df67f=a3_0x49974b,_0x293fba='/entities/parent_segments/'+_0x843438,_0x1b49fb=await this[_0x5df67f(0x110)]['request']('GET',_0x293fba);return _0x5df67f(0x14a)in _0x1b49fb?_0x1b49fb[_0x5df67f(0x14a)]:_0x1b49fb;}async[a3_0x49974b(0x151)](_0x3e583e){const _0x485418=a3_0x49974b,_0x2ad4e1=_0x485418(0x146)+_0x3e583e+_0x485418(0x10c),_0x1f08e8=await this['httpClient'][_0x485418(0x119)]('GET',_0x2ad4e1);return Array['isArray'](_0x1f08e8)?_0x1f08e8:_0x1f08e8[_0x485418(0x14a)];}async['getSegment'](_0x22dc2b,_0x2ed35e){const _0xc9a15=a3_0x49974b,_0x26d592=_0xc9a15(0x146)+_0x22dc2b+_0xc9a15(0x134)+_0x2ed35e,_0x582d81=await this[_0xc9a15(0x110)][_0xc9a15(0x119)](_0xc9a15(0x157),_0x26d592);return'data'in _0x582d81?_0x582d81[_0xc9a15(0x14a)]:_0x582d81;}async['listSegmentFolders'](_0x37f29d){const _0x50f942=a3_0x49974b,_0x577270=_0x50f942(0x146)+_0x37f29d+_0x50f942(0x152),_0x4b9c0d=await this[_0x50f942(0x110)]['request'](_0x50f942(0x157),_0x577270);return Array[_0x50f942(0x120)](_0x4b9c0d)?_0x4b9c0d:_0x4b9c0d['data'];}async[a3_0x49974b(0x13b)](_0x23ea64){const _0x365447=a3_0x49974b,_0x5274d2=_0x365447(0x117)+_0x23ea64,_0x299404=await this[_0x365447(0x110)][_0x365447(0x119)]('GET',_0x5274d2);return _0x365447(0x14a)in _0x299404?_0x299404['data']:_0x299404;}async[a3_0x49974b(0x123)](_0x2a66ac,_0x5c7767){const _0x1246d7=a3_0x49974b,_0x52e584=_0x1246d7(0x146)+_0x2a66ac+'/segments/'+_0x5c7767+_0x1246d7(0x137),_0x39a9df=await this['httpClient'][_0x1246d7(0x119)](_0x1246d7(0x157),_0x52e584);return Array[_0x1246d7(0x120)](_0x39a9df)?_0x39a9df:_0x39a9df['data'];}async[a3_0x49974b(0x145)](_0x589f12,_0x4cb320,_0x5e26f5){const _0x973c6a=a3_0x49974b,_0xf7daec=_0x973c6a(0x146)+_0x589f12+_0x973c6a(0x134)+_0x4cb320+_0x973c6a(0x155)+_0x5e26f5,_0x2206c0=await this[_0x973c6a(0x110)][_0x973c6a(0x119)](_0x973c6a(0x157),_0xf7daec);return'data'in _0x2206c0?_0x2206c0[_0x973c6a(0x14a)]:_0x2206c0;}async[a3_0x49974b(0x116)](_0xcf79b1,_0x2b0b0b,_0x90c28b){const _0x548578=a3_0x49974b,_0x272681=_0x548578(0x146)+_0xcf79b1+'/segments/'+_0x2b0b0b+_0x548578(0x137),_0x173c19=await this[_0x548578(0x110)][_0x548578(0x119)](_0x548578(0x161),_0x272681,{'body':_0x90c28b});return _0x173c19;}async[a3_0x49974b(0x144)](_0xfd47aa,_0x163ac7,_0x25fc19,_0x189531){const _0x55b83d=a3_0x49974b,_0x23a9d9=_0x55b83d(0x146)+_0xfd47aa+_0x55b83d(0x134)+_0x163ac7+_0x55b83d(0x155)+_0x25fc19,_0x3d6c70=await this['httpClient'][_0x55b83d(0x119)]('PUT',_0x23a9d9,{'body':_0x189531});return _0x3d6c70;}async[a3_0x49974b(0x163)](_0x2ad1bd,_0x366027,_0x346fc1){const _0x542643=a3_0x49974b,_0x1a49fc=_0x542643(0x146)+_0x2ad1bd+'/segments/'+_0x366027+'/syndications/'+_0x346fc1;await this['httpClient'][_0x542643(0x119)](_0x542643(0x11a),_0x1a49fc);}async[a3_0x49974b(0x11e)](_0x5521e5){const _0x48e47c=a3_0x49974b,_0x58671d=_0x48e47c(0x146)+_0x5521e5+'/segments/query',_0x2a6e5b=await this[_0x48e47c(0x110)][_0x48e47c(0x119)](_0x48e47c(0x161),_0x58671d,{'body':{'format':'sql'}});return _0x2a6e5b['sql']||_0x2a6e5b['query']||'';}async[a3_0x49974b(0x106)](_0x4ed82b,_0x3688f1){const _0xe9cbe1=a3_0x49974b,_0x4819d0=await this[_0xe9cbe1(0x121)](_0x4ed82b,_0x3688f1),_0x26dd12={'format':_0xe9cbe1(0x12b)};'rule'in _0x4819d0&&_0x4819d0[_0xe9cbe1(0x10e)]&&(_0x26dd12[_0xe9cbe1(0x10e)]=_0x4819d0[_0xe9cbe1(0x10e)]);const _0x43afbf=_0xe9cbe1(0x146)+_0x4ed82b+'/segments/query',_0x114c52=await this['httpClient'][_0xe9cbe1(0x119)]('POST',_0x43afbf,{'body':_0x26dd12});return _0x114c52[_0xe9cbe1(0x12b)]||_0x114c52[_0xe9cbe1(0x164)]||'';}async['createParentSegment'](_0x124c70){const _0x5c255d=a3_0x49974b,_0x12cf6e=_0x5c255d(0x12c),_0x4a4eba=await this['httpClient']['request'](_0x5c255d(0x161),_0x12cf6e,{'body':_0x124c70,'headers':{'Content-Type':'application/vnd.treasuredata.v1+json'}});return _0x4a4eba;}async[a3_0x49974b(0x166)](_0x656fdf,_0x567508){const _0x1718ce=a3_0x49974b,_0x256a06='/audiences/'+_0x656fdf,_0x773984=await this['httpClient'][_0x1718ce(0x119)](_0x1718ce(0x135),_0x256a06,{'body':_0x567508,'headers':{'Content-Type':'application/vnd.treasuredata.v1+json'}});return _0x773984;}async['getParentSegmentFull'](_0x523061){const _0x5b091b=a3_0x49974b,_0x473920=_0x5b091b(0x146)+_0x523061,_0x49d0b8=await this[_0x5b091b(0x110)][_0x5b091b(0x119)](_0x5b091b(0x157),_0x473920,{'headers':{'Accept':_0x5b091b(0x129)}});return _0x49d0b8;}async[a3_0x49974b(0x158)](_0x5125a9){const _0x34d00d=a3_0x49974b,_0x16b210=_0x34d00d(0x146)+_0x5125a9+'/attributes',_0x51bb9f=await this['httpClient'][_0x34d00d(0x119)](_0x34d00d(0x157),_0x16b210);return _0x51bb9f;}async[a3_0x49974b(0x10d)](_0xa3eb79,_0x12ecda){const _0x43b684=a3_0x49974b;let _0x34a229=_0x43b684(0x146)+_0xa3eb79+_0x43b684(0x140);_0x12ecda!==undefined&&(_0x34a229+=_0x43b684(0x13d)+_0x12ecda);const _0x55b9b8=await this['httpClient'][_0x43b684(0x119)](_0x43b684(0x157),_0x34a229);return _0x55b9b8;}async[a3_0x49974b(0x10f)](_0x19c87e,_0x6e27ca){const _0x13577e=a3_0x49974b,_0x4eaa4d=_0x13577e(0x146)+_0x19c87e+_0x13577e(0x10c),_0x307290=await this[_0x13577e(0x110)][_0x13577e(0x119)]('POST',_0x4eaa4d,{'body':_0x6e27ca});return _0x307290;}async[a3_0x49974b(0x114)](_0x5d1930){const _0xc86334=a3_0x49974b,_0x5331cc='/entities/segments',_0xc68dd2={'type':_0xc86334(0x11c),'attributes':{'name':_0x5d1930[_0xc86334(0x10b)],'description':_0x5d1930[_0xc86334(0x15a)]||'','journeyId':_0x5d1930[_0xc86334(0x162)],'rule':_0x5d1930[_0xc86334(0x10e)],'countPopulation':_0x5d1930[_0xc86334(0x143)]??!![]},'relationships':{'parentFolder':{'data':{'id':_0x5d1930[_0xc86334(0x13e)],'type':_0xc86334(0x15c)}}}},_0x21623d=await this['httpClient']['request']('POST',_0x5331cc,{'body':_0xc68dd2,'headers':{'Content-Type':_0xc86334(0x129)}});return _0x21623d[_0xc86334(0x14a)]['id'];}async['updateSegment'](_0x5cfe75,_0x1a1bf0,_0x24bb9e){const _0x53958c=a3_0x49974b,_0x496c21='/audiences/'+_0x5cfe75+_0x53958c(0x134)+_0x1a1bf0,_0x258fb7=await this[_0x53958c(0x110)][_0x53958c(0x119)]('PUT',_0x496c21,{'body':_0x24bb9e});return _0x258fb7;}async[a3_0x49974b(0x147)](_0x1e4bd7){const _0xfeba7f=a3_0x49974b,_0x546487=_0xfeba7f(0x115)+_0x1e4bd7;await this[_0xfeba7f(0x110)]['request'](_0xfeba7f(0x11a),_0x546487);}async[a3_0x49974b(0x15b)](_0x43307f,_0x3b496b){const _0x51b6b0=a3_0x49974b,_0x32ec53=_0x51b6b0(0x146)+_0x43307f+'/folders',_0x3ea3dc=await this[_0x51b6b0(0x110)][_0x51b6b0(0x119)](_0x51b6b0(0x161),_0x32ec53,{'body':_0x3b496b});if(_0x51b6b0(0x14a)in _0x3ea3dc&&_0x3ea3dc[_0x51b6b0(0x14a)]){const _0x1c4e85=_0x3ea3dc[_0x51b6b0(0x14a)];return{'id':_0x1c4e85['id'],'name':_0x1c4e85[_0x51b6b0(0x10b)],'description':_0x1c4e85[_0x51b6b0(0x15a)],'audienceId':_0x1c4e85[_0x51b6b0(0x12e)]||String(_0x43307f),'parentFolderId':_0x1c4e85[_0x51b6b0(0x13e)],'createdAt':_0x1c4e85[_0x51b6b0(0x160)],'updatedAt':_0x1c4e85[_0x51b6b0(0x131)]};}return _0x3ea3dc;}async['runParentSegment'](_0x20928f){const _0x51e3de=a3_0x49974b,_0x3a6c10=_0x51e3de(0x146)+_0x20928f+_0x51e3de(0x10a),_0x53a056=await this['httpClient'][_0x51e3de(0x119)](_0x51e3de(0x161),_0x3a6c10);return _0x53a056;}async[a3_0x49974b(0x15f)](_0x57a2dc){const _0x215663=a3_0x49974b,_0x258c9c=_0x215663(0x12a)+_0x57a2dc,_0x1c02ad=await this[_0x215663(0x110)][_0x215663(0x119)](_0x215663(0x157),_0x258c9c);return _0x1c02ad[_0x215663(0x14a)][_0x215663(0x13a)](_0x16eca6=>({'id':_0x16eca6['id'],'name':_0x16eca6['attributes'][_0x215663(0x10b)],'journeyBundleName':_0x16eca6['attributes']['journeyBundleName'],'journeyBundleId':_0x16eca6[_0x215663(0x141)][_0x215663(0x154)],'versionNumber':_0x16eca6['attributes']['versionNumber'],'description':_0x16eca6[_0x215663(0x141)][_0x215663(0x15a)],'state':_0x16eca6[_0x215663(0x141)][_0x215663(0x122)],'paused':_0x16eca6['attributes'][_0x215663(0x14f)],'audienceId':_0x16eca6['attributes'][_0x215663(0x12e)],'folderId':_0x16eca6[_0x215663(0x15d)]?.[_0x215663(0x118)]?.['data']?.['id'],'createdAt':_0x16eca6['attributes'][_0x215663(0x160)],'updatedAt':_0x16eca6[_0x215663(0x141)][_0x215663(0x131)]}));}async[a3_0x49974b(0x112)](_0x37d7da){const _0x1a4e64=a3_0x49974b,_0x352de2=_0x1a4e64(0x14b)+_0x37d7da,_0x3fed98=await this[_0x1a4e64(0x110)]['request'](_0x1a4e64(0x157),_0x352de2);return _0x1a4e64(0x14a)in _0x3fed98?_0x3fed98[_0x1a4e64(0x14a)]:_0x3fed98;}async[a3_0x49974b(0x109)](_0x43ec00){const _0x1c03ac=a3_0x49974b,_0x9af024='/entities/journeys',_0x27bded=await this['httpClient'][_0x1c03ac(0x119)](_0x1c03ac(0x161),_0x9af024,{'body':_0x43ec00,'headers':{'Content-Type':'application/vnd.treasuredata.v1+json'}});return _0x1c03ac(0x14a)in _0x27bded?_0x27bded[_0x1c03ac(0x14a)]:_0x27bded;}async['updateJourney'](_0x4946dc,_0x5d54f0){const _0x4f9e95=a3_0x49974b,_0x2a1feb=_0x4f9e95(0x14b)+_0x4946dc,_0x5880cd=await this['httpClient'][_0x4f9e95(0x119)](_0x4f9e95(0x13f),_0x2a1feb,{'body':_0x5d54f0,'headers':{'Content-Type':_0x4f9e95(0x129)}});return _0x4f9e95(0x14a)in _0x5880cd?_0x5880cd[_0x4f9e95(0x14a)]:_0x5880cd;}async['updateJourneyDetail'](_0x4a3936,_0x3dfc2a){const _0x8e3e9f=a3_0x49974b,_0x4dfa37=_0x8e3e9f(0x14b)+_0x4a3936+_0x8e3e9f(0x132),_0x4ae7ac=await this[_0x8e3e9f(0x110)][_0x8e3e9f(0x119)]('POST',_0x4dfa37,{'body':_0x3dfc2a,'headers':{'Content-Type':_0x8e3e9f(0x129)}});return'data'in _0x4ae7ac?_0x4ae7ac[_0x8e3e9f(0x14a)]:_0x4ae7ac;}async['getJourneyStatistics'](_0x3355c8){const _0x19b9b2=a3_0x49974b,_0x4c2ba7=_0x19b9b2(0x14b)+_0x3355c8+'/statistics',_0x1d4237=await this[_0x19b9b2(0x110)][_0x19b9b2(0x119)]('GET',_0x4c2ba7);return _0x19b9b2(0x14a)in _0x1d4237?_0x1d4237[_0x19b9b2(0x14a)]:_0x1d4237;}async[a3_0x49974b(0x107)](_0x49e2f2){const _0x366d05=a3_0x49974b,_0x99b95d=_0x366d05(0x14b)+_0x49e2f2+_0x366d05(0x108),_0x3891b9=await this[_0x366d05(0x110)]['request']('PATCH',_0x99b95d);return'data'in _0x3891b9?_0x3891b9[_0x366d05(0x14a)]:_0x3891b9;}async[a3_0x49974b(0x105)](_0xeb59f7){const _0x430c38=a3_0x49974b,_0x1b1268=_0x430c38(0x14b)+_0xeb59f7+_0x430c38(0x14e),_0x4fc7f7=await this['httpClient'][_0x430c38(0x119)]('PATCH',_0x1b1268);return _0x430c38(0x14a)in _0x4fc7f7?_0x4fc7f7[_0x430c38(0x14a)]:_0x4fc7f7;}async['getJourneyActivation'](_0x33f00e,_0xae1bcb){const _0x4f8a27=a3_0x49974b,_0x2bcf27='/entities/journeys/'+_0x33f00e+'/activations/'+_0xae1bcb,_0x126726=await this['httpClient'][_0x4f8a27(0x119)](_0x4f8a27(0x157),_0x2bcf27);return _0x4f8a27(0x14a)in _0x126726?_0x126726[_0x4f8a27(0x14a)]:_0x126726;}async[a3_0x49974b(0x130)](_0xef70af){const _0x25c3d3=a3_0x49974b,_0x32092c='/entities/journeys/'+_0xef70af+_0x25c3d3(0x142),_0x249205=await this[_0x25c3d3(0x110)][_0x25c3d3(0x119)](_0x25c3d3(0x157),_0x32092c);return _0x25c3d3(0x14a)in _0x249205?_0x249205[_0x25c3d3(0x14a)]:_0x249205;}async[a3_0x49974b(0x159)](_0xbc0c19,_0x58478f){const _0x43cac4=a3_0x49974b,_0x3ee982=_0x43cac4(0x14b)+_0xbc0c19+_0x43cac4(0x142),_0x44586f={'name':_0x58478f['name'],'scheduleType':_0x58478f[_0x43cac4(0x126)]||_0x43cac4(0x138),'connectionId':String(_0x58478f[_0x43cac4(0x133)]),'columns':_0x58478f[_0x43cac4(0x13c)]??[],'notifyOn':_0x58478f[_0x43cac4(0x113)]??[],..._0x58478f[_0x43cac4(0x15a)]!==undefined&&{'description':_0x58478f[_0x43cac4(0x15a)]},..._0x58478f[_0x43cac4(0x15e)]!==undefined&&{'allColumns':_0x58478f[_0x43cac4(0x15e)]},..._0x58478f[_0x43cac4(0x128)]!==undefined&&{'timezone':_0x58478f[_0x43cac4(0x128)]},..._0x58478f['connectorConfig']!==undefined&&{'connectorConfig':_0x58478f['connectorConfig']},..._0x58478f[_0x43cac4(0x156)]!==undefined&&{'emailRecipients':_0x58478f[_0x43cac4(0x156)]},..._0x58478f[_0x43cac4(0x104)]!==undefined&&{'activationTemplateId':_0x58478f[_0x43cac4(0x104)]},..._0x58478f[_0x43cac4(0x148)]!==undefined&&{'syndicationBehavior':_0x58478f[_0x43cac4(0x148)]}},_0x21dd6e=await this['httpClient'][_0x43cac4(0x119)]('POST',_0x3ee982,{'body':{'type':'journeyActivationStep','attributes':{'activationParams':_0x44586f}},'headers':{'Content-Type':_0x43cac4(0x129)}});return _0x43cac4(0x14a)in _0x21dd6e?_0x21dd6e[_0x43cac4(0x14a)]:_0x21dd6e;}}
|
|
1
|
+
function a3_0x47f1(_0x852ea8,_0x1c63a2){_0x852ea8=_0x852ea8-0xef;const _0x1eb73e=a3_0x1eb7();let _0x47f189=_0x1eb73e[_0x852ea8];return _0x47f189;}function a3_0x1eb7(){const _0x2abb3d=['map','journeyId','GET','countPopulation','activationTemplateId','deleteSegment','createJourney','5452447nfpfPw','createActivation','isArray','timezone','/segments/','/entities/journeys?folder_id=','getAudienceBehaviors','createJourneyActivation','rule','/syndications/','/segments/query','/run','383215dwZxlZ','emailRecipients','getJourneyActivation','POST','getActivation','sql','getParentSegment','application/vnd.treasuredata.v1+json','request','none','?realtime=','updateSegment','getSegment','allColumns','1576068VnPxTu','listSegmentFolders','111768sJgKpq','/behaviors','name','createdAt','application/json','listJourneyActivations','description','connectorConfig','journeyBundleId','6HiwGfy','updatedAt','listParentSegments','876FyyaCV','site','/attributes','audienceId','PATCH','/statistics','438QlyfpW','updateParentSegment','updateJourney','data','columns','/folders','getJourney','createParentSegment','syndicationBehavior','paused','createSegment','/entities/folders/','/audiences/','20ohWflX','authHeaders','listActivations','DELETE','pauseJourney','runParentSegment','getSegmentFolder','attributes','/audiences','updateJourneyDetail','listJourneys','getAudienceAttributes','createJourneySegment','312807kgJVgC','396qwxDMJ','httpClient','PUT','listSegments','notifyOn','/entities/journeys/','getParentSegmentFull','22827HBSntv','query','/segments','relationships','versionNumber','createSegmentFolder','getSegmentSQL','/syndications','scheduleType','resumeJourney','deleteActivation','2897860LlZtWU','/detail','/activations','journeyBundleName','apiKey','journeyActivationStep'];a3_0x1eb7=function(){return _0x2abb3d;};return a3_0x1eb7();}const a3_0x46fc14=a3_0x47f1;(function(_0x1eceb8,_0x307f77){const _0x112cd4=a3_0x47f1,_0x2ad612=_0x1eceb8();while(!![]){try{const _0x2df237=-parseInt(_0x112cd4(0x155))/0x1+-parseInt(_0x112cd4(0x101))/0x2*(-parseInt(_0x112cd4(0x123))/0x3)+parseInt(_0x112cd4(0x10e))/0x4*(parseInt(_0x112cd4(0x147))/0x5)+-parseInt(_0x112cd4(0xf8))/0x6*(parseInt(_0x112cd4(0x13b))/0x7)+parseInt(_0x112cd4(0xef))/0x8*(-parseInt(_0x112cd4(0x11c))/0x9)+-parseInt(_0x112cd4(0x12e))/0xa+parseInt(_0x112cd4(0x11b))/0xb*(parseInt(_0x112cd4(0xfb))/0xc);if(_0x2df237===_0x307f77)break;else _0x2ad612['push'](_0x2ad612['shift']());}catch(_0x4fb5b7){_0x2ad612['push'](_0x2ad612['shift']());}}}(a3_0x1eb7,0xd36c4));import{HTTPClient}from'./http-client.js';import{getEndpoint}from'../types/index.js';import{getAuthHeaders,toHeaderRecord}from'../core/auth.js';export class CDPApiClient{['httpClient'];['authHeaders'];constructor(_0x4592f6,_0x1a5d06){const _0x4a1d84=a3_0x47f1,_0x22177f=getEndpoint(_0x4592f6[_0x4a1d84(0xfc)],'cdp');this[_0x4a1d84(0x10f)]=toHeaderRecord(getAuthHeaders(_0x4592f6['site'],_0x4592f6[_0x4a1d84(0x132)])),this['httpClient']=new HTTPClient(_0x22177f,{...this[_0x4a1d84(0x10f)],'Accept':'application/vnd.treasuredata.v1+json','Content-Type':_0x4a1d84(0xf3)},_0x1a5d06);}async[a3_0x46fc14(0xfa)](){const _0x3b26f0=a3_0x46fc14,_0x5d9f6a='/entities/parent_segments',_0x3650cb=await this[_0x3b26f0(0x11d)][_0x3b26f0(0x14f)](_0x3b26f0(0x136),_0x5d9f6a);return Array[_0x3b26f0(0x13d)](_0x3650cb)?_0x3650cb:_0x3650cb[_0x3b26f0(0x104)];}async[a3_0x46fc14(0x14d)](_0x33f820){const _0x3ba8d3=a3_0x46fc14,_0x5c644a='/entities/parent_segments/'+_0x33f820,_0x3280b9=await this[_0x3ba8d3(0x11d)]['request']('GET',_0x5c644a);return _0x3ba8d3(0x104)in _0x3280b9?_0x3280b9[_0x3ba8d3(0x104)]:_0x3280b9;}async[a3_0x46fc14(0x11f)](_0x45847d){const _0x507965=a3_0x46fc14,_0xbf5f63=_0x507965(0x10d)+_0x45847d+'/segments',_0x177937=await this[_0x507965(0x11d)][_0x507965(0x14f)](_0x507965(0x136),_0xbf5f63);return Array[_0x507965(0x13d)](_0x177937)?_0x177937:_0x177937[_0x507965(0x104)];}async['getSegment'](_0x559e46,_0x386567){const _0x3f4e82=a3_0x46fc14,_0x57098a=_0x3f4e82(0x10d)+_0x559e46+_0x3f4e82(0x13f)+_0x386567,_0x5c0ab9=await this[_0x3f4e82(0x11d)][_0x3f4e82(0x14f)](_0x3f4e82(0x136),_0x57098a);return'data'in _0x5c0ab9?_0x5c0ab9[_0x3f4e82(0x104)]:_0x5c0ab9;}async[a3_0x46fc14(0x156)](_0x3002db){const _0x2ab140=a3_0x46fc14,_0x4e8f68='/audiences/'+_0x3002db+_0x2ab140(0x106),_0x710d55=await this[_0x2ab140(0x11d)]['request'](_0x2ab140(0x136),_0x4e8f68);return Array['isArray'](_0x710d55)?_0x710d55:_0x710d55[_0x2ab140(0x104)];}async[a3_0x46fc14(0x114)](_0x3dc2c5){const _0x447d98=a3_0x46fc14,_0x52415b=_0x447d98(0x10c)+_0x3dc2c5,_0x435ea3=await this[_0x447d98(0x11d)][_0x447d98(0x14f)](_0x447d98(0x136),_0x52415b);return _0x447d98(0x104)in _0x435ea3?_0x435ea3[_0x447d98(0x104)]:_0x435ea3;}async[a3_0x46fc14(0x110)](_0x24d980,_0x2936ce){const _0x3a820d=a3_0x46fc14,_0x385589='/audiences/'+_0x24d980+_0x3a820d(0x13f)+_0x2936ce+_0x3a820d(0x12a),_0x20d903=await this['httpClient'][_0x3a820d(0x14f)]('GET',_0x385589);return Array[_0x3a820d(0x13d)](_0x20d903)?_0x20d903:_0x20d903[_0x3a820d(0x104)];}async[a3_0x46fc14(0x14b)](_0x32fc8a,_0x25927e,_0x106ead){const _0x327a5a=a3_0x46fc14,_0x31cd40=_0x327a5a(0x10d)+_0x32fc8a+_0x327a5a(0x13f)+_0x25927e+_0x327a5a(0x144)+_0x106ead,_0x2328d4=await this['httpClient'][_0x327a5a(0x14f)](_0x327a5a(0x136),_0x31cd40);return'data'in _0x2328d4?_0x2328d4[_0x327a5a(0x104)]:_0x2328d4;}async[a3_0x46fc14(0x13c)](_0x308493,_0x36d59a,_0x2977f4){const _0x3552bc=a3_0x46fc14,_0x30cc7e=_0x3552bc(0x10d)+_0x308493+'/segments/'+_0x36d59a+'/syndications',_0x103829=await this[_0x3552bc(0x11d)][_0x3552bc(0x14f)](_0x3552bc(0x14a),_0x30cc7e,{'body':_0x2977f4});return _0x103829;}async['updateActivation'](_0x44210c,_0x3c6c46,_0x3ff9d0,_0x294f99){const _0xd24f1a=a3_0x46fc14,_0x350085=_0xd24f1a(0x10d)+_0x44210c+_0xd24f1a(0x13f)+_0x3c6c46+_0xd24f1a(0x144)+_0x3ff9d0,_0x21fdec=await this[_0xd24f1a(0x11d)]['request'](_0xd24f1a(0x11e),_0x350085,{'body':_0x294f99});return _0x21fdec;}async[a3_0x46fc14(0x12d)](_0x90f8ae,_0x542465,_0x45f7e3){const _0x40de23=a3_0x46fc14,_0x24105d='/audiences/'+_0x90f8ae+_0x40de23(0x13f)+_0x542465+'/syndications/'+_0x45f7e3;await this[_0x40de23(0x11d)][_0x40de23(0x14f)](_0x40de23(0x111),_0x24105d);}async['getParentSegmentSQL'](_0x56d916){const _0x3d81d6=a3_0x46fc14,_0x1b0d9f='/audiences/'+_0x56d916+_0x3d81d6(0x145),_0x4837f8=await this['httpClient'][_0x3d81d6(0x14f)](_0x3d81d6(0x14a),_0x1b0d9f,{'body':{'format':'sql'}});return _0x4837f8[_0x3d81d6(0x14c)]||_0x4837f8[_0x3d81d6(0x124)]||'';}async[a3_0x46fc14(0x129)](_0x16583e,_0x61c14b){const _0x19d3bd=a3_0x46fc14,_0x2795b9=await this[_0x19d3bd(0x153)](_0x16583e,_0x61c14b),_0x57a903={'format':_0x19d3bd(0x14c)};_0x19d3bd(0x143)in _0x2795b9&&_0x2795b9[_0x19d3bd(0x143)]&&(_0x57a903['rule']=_0x2795b9['rule']);const _0x4a41cf=_0x19d3bd(0x10d)+_0x16583e+_0x19d3bd(0x145),_0x55bae5=await this[_0x19d3bd(0x11d)][_0x19d3bd(0x14f)](_0x19d3bd(0x14a),_0x4a41cf,{'body':_0x57a903});return _0x55bae5['sql']||_0x55bae5[_0x19d3bd(0x124)]||'';}async[a3_0x46fc14(0x108)](_0x14167c){const _0x3d1028=a3_0x46fc14,_0x4b5e5d=_0x3d1028(0x116),_0x40ec91=await this[_0x3d1028(0x11d)][_0x3d1028(0x14f)]('POST',_0x4b5e5d,{'body':_0x14167c,'headers':{'Content-Type':_0x3d1028(0x14e)}});return _0x40ec91;}async[a3_0x46fc14(0x102)](_0x425613,_0x26be6a){const _0x4b7c33=a3_0x46fc14,_0xe75d26=_0x4b7c33(0x10d)+_0x425613,_0x475df5=await this[_0x4b7c33(0x11d)]['request'](_0x4b7c33(0x11e),_0xe75d26,{'body':_0x26be6a,'headers':{'Content-Type':_0x4b7c33(0x14e)}});return _0x475df5;}async[a3_0x46fc14(0x122)](_0x2255cb){const _0x3adfe6=a3_0x46fc14,_0xd1bf33='/audiences/'+_0x2255cb,_0x14f5c1=await this['httpClient']['request'](_0x3adfe6(0x136),_0xd1bf33,{'headers':{'Accept':_0x3adfe6(0x14e)}});return _0x14f5c1;}async[a3_0x46fc14(0x119)](_0x43749e){const _0xcc3b48=a3_0x46fc14,_0xa49294='/audiences/'+_0x43749e+_0xcc3b48(0xfd),_0x4cb63e=await this[_0xcc3b48(0x11d)][_0xcc3b48(0x14f)](_0xcc3b48(0x136),_0xa49294);return _0x4cb63e;}async[a3_0x46fc14(0x141)](_0x5a4ec8,_0x326cad){const _0x24ce48=a3_0x46fc14;let _0x359bfc=_0x24ce48(0x10d)+_0x5a4ec8+_0x24ce48(0xf0);_0x326cad!==undefined&&(_0x359bfc+=_0x24ce48(0x151)+_0x326cad);const _0x19cebf=await this[_0x24ce48(0x11d)][_0x24ce48(0x14f)]('GET',_0x359bfc);return _0x19cebf;}async[a3_0x46fc14(0x10b)](_0x597242,_0x5a6304){const _0x27cf92=a3_0x46fc14,_0x13e0ac=_0x27cf92(0x10d)+_0x597242+_0x27cf92(0x125),_0x2acaf4=await this[_0x27cf92(0x11d)][_0x27cf92(0x14f)](_0x27cf92(0x14a),_0x13e0ac,{'body':_0x5a6304});return _0x2acaf4;}async[a3_0x46fc14(0x11a)](_0x452af9){const _0x413ec5=a3_0x46fc14,_0x2f6984='/entities/segments',_0xeeb555={'type':'segment-journey','attributes':{'name':_0x452af9[_0x413ec5(0xf1)],'description':_0x452af9[_0x413ec5(0xf5)]||'','journeyId':_0x452af9[_0x413ec5(0x135)],'rule':_0x452af9[_0x413ec5(0x143)],'countPopulation':_0x452af9[_0x413ec5(0x137)]??!![]},'relationships':{'parentFolder':{'data':{'id':_0x452af9['parentFolderId'],'type':'folder-segment'}}}},_0x28996d=await this[_0x413ec5(0x11d)][_0x413ec5(0x14f)](_0x413ec5(0x14a),_0x2f6984,{'body':_0xeeb555,'headers':{'Content-Type':'application/vnd.treasuredata.v1+json'}});return _0x28996d[_0x413ec5(0x104)]['id'];}async[a3_0x46fc14(0x152)](_0x233912,_0x4bcc39,_0x4e8c06){const _0x3ccf3f=a3_0x46fc14,_0x33335a=_0x3ccf3f(0x10d)+_0x233912+_0x3ccf3f(0x13f)+_0x4bcc39,_0x544756=await this[_0x3ccf3f(0x11d)][_0x3ccf3f(0x14f)](_0x3ccf3f(0x11e),_0x33335a,{'body':_0x4e8c06});return _0x544756;}async[a3_0x46fc14(0x139)](_0x1ce067){const _0xe0420c=a3_0x46fc14,_0x33a73f='/entities/segments/'+_0x1ce067;await this['httpClient'][_0xe0420c(0x14f)](_0xe0420c(0x111),_0x33a73f);}async[a3_0x46fc14(0x128)](_0x158e2f,_0x168b57){const _0xa1ef8e=a3_0x46fc14,_0x2d22b6=_0xa1ef8e(0x10d)+_0x158e2f+'/folders',_0x5b4606=await this[_0xa1ef8e(0x11d)][_0xa1ef8e(0x14f)](_0xa1ef8e(0x14a),_0x2d22b6,{'body':_0x168b57});if(_0xa1ef8e(0x104)in _0x5b4606&&_0x5b4606[_0xa1ef8e(0x104)]){const _0x214ac6=_0x5b4606['data'];return{'id':_0x214ac6['id'],'name':_0x214ac6[_0xa1ef8e(0xf1)],'description':_0x214ac6['description'],'audienceId':_0x214ac6[_0xa1ef8e(0xfe)]||String(_0x158e2f),'parentFolderId':_0x214ac6['parentFolderId'],'createdAt':_0x214ac6[_0xa1ef8e(0xf2)],'updatedAt':_0x214ac6[_0xa1ef8e(0xf9)]};}return _0x5b4606;}async[a3_0x46fc14(0x113)](_0x4ebd4e){const _0x3f9331=a3_0x46fc14,_0x531c45='/audiences/'+_0x4ebd4e+_0x3f9331(0x146),_0x2649ca=await this[_0x3f9331(0x11d)][_0x3f9331(0x14f)](_0x3f9331(0x14a),_0x531c45);return _0x2649ca;}async[a3_0x46fc14(0x118)](_0x338bc9){const _0xe8d044=a3_0x46fc14,_0xd92bed=_0xe8d044(0x140)+_0x338bc9,_0x1ca517=await this[_0xe8d044(0x11d)][_0xe8d044(0x14f)]('GET',_0xd92bed);return _0x1ca517[_0xe8d044(0x104)][_0xe8d044(0x134)](_0x164dcc=>({'id':_0x164dcc['id'],'name':_0x164dcc[_0xe8d044(0x115)][_0xe8d044(0xf1)],'journeyBundleName':_0x164dcc[_0xe8d044(0x115)][_0xe8d044(0x131)],'journeyBundleId':_0x164dcc[_0xe8d044(0x115)][_0xe8d044(0xf7)],'versionNumber':_0x164dcc['attributes'][_0xe8d044(0x127)],'description':_0x164dcc['attributes'][_0xe8d044(0xf5)],'state':_0x164dcc[_0xe8d044(0x115)]['state'],'paused':_0x164dcc[_0xe8d044(0x115)][_0xe8d044(0x10a)],'audienceId':_0x164dcc[_0xe8d044(0x115)][_0xe8d044(0xfe)],'folderId':_0x164dcc[_0xe8d044(0x126)]?.['parentFolder']?.['data']?.['id'],'createdAt':_0x164dcc['attributes'][_0xe8d044(0xf2)],'updatedAt':_0x164dcc[_0xe8d044(0x115)][_0xe8d044(0xf9)]}));}async[a3_0x46fc14(0x107)](_0x17dc1f){const _0x2e54a3=a3_0x46fc14,_0x59959b=_0x2e54a3(0x121)+_0x17dc1f,_0x524bdd=await this['httpClient'][_0x2e54a3(0x14f)](_0x2e54a3(0x136),_0x59959b);return _0x2e54a3(0x104)in _0x524bdd?_0x524bdd[_0x2e54a3(0x104)]:_0x524bdd;}async[a3_0x46fc14(0x13a)](_0x10427c){const _0x406cd0=a3_0x46fc14,_0x5211fa='/entities/journeys',_0x1b11d0=await this[_0x406cd0(0x11d)]['request'](_0x406cd0(0x14a),_0x5211fa,{'body':_0x10427c,'headers':{'Content-Type':_0x406cd0(0x14e)}});return'data'in _0x1b11d0?_0x1b11d0[_0x406cd0(0x104)]:_0x1b11d0;}async[a3_0x46fc14(0x103)](_0x94eb1f,_0x1fc288){const _0x1956c2=a3_0x46fc14,_0x3cd9a0=_0x1956c2(0x121)+_0x94eb1f,_0x192d73=await this[_0x1956c2(0x11d)][_0x1956c2(0x14f)](_0x1956c2(0xff),_0x3cd9a0,{'body':_0x1fc288,'headers':{'Content-Type':'application/vnd.treasuredata.v1+json'}});return _0x1956c2(0x104)in _0x192d73?_0x192d73[_0x1956c2(0x104)]:_0x192d73;}async[a3_0x46fc14(0x117)](_0xb0fca8,_0x22973b){const _0x44dca9=a3_0x46fc14,_0x153b18=_0x44dca9(0x121)+_0xb0fca8+_0x44dca9(0x12f),_0x485b9e=await this[_0x44dca9(0x11d)][_0x44dca9(0x14f)](_0x44dca9(0x14a),_0x153b18,{'body':_0x22973b,'headers':{'Content-Type':_0x44dca9(0x14e)}});return'data'in _0x485b9e?_0x485b9e[_0x44dca9(0x104)]:_0x485b9e;}async['getJourneyStatistics'](_0x367fad){const _0x1d8598=a3_0x46fc14,_0x18441e=_0x1d8598(0x121)+_0x367fad+_0x1d8598(0x100),_0xd1928c=await this[_0x1d8598(0x11d)][_0x1d8598(0x14f)](_0x1d8598(0x136),_0x18441e);return _0x1d8598(0x104)in _0xd1928c?_0xd1928c[_0x1d8598(0x104)]:_0xd1928c;}async[a3_0x46fc14(0x112)](_0x2a0f7e){const _0xc754eb=a3_0x46fc14,_0x180481=_0xc754eb(0x121)+_0x2a0f7e+'/pause',_0x4dffc3=await this[_0xc754eb(0x11d)][_0xc754eb(0x14f)](_0xc754eb(0xff),_0x180481);return _0xc754eb(0x104)in _0x4dffc3?_0x4dffc3[_0xc754eb(0x104)]:_0x4dffc3;}async[a3_0x46fc14(0x12c)](_0x236ad5){const _0x28c411=a3_0x46fc14,_0x2672b4=_0x28c411(0x121)+_0x236ad5+'/resume',_0x291f0a=await this[_0x28c411(0x11d)][_0x28c411(0x14f)]('PATCH',_0x2672b4);return _0x28c411(0x104)in _0x291f0a?_0x291f0a['data']:_0x291f0a;}async[a3_0x46fc14(0x149)](_0x19dcc8,_0x3d1ba0){const _0x420df9=a3_0x46fc14,_0x560d65='/entities/journeys/'+_0x19dcc8+'/activations/'+_0x3d1ba0,_0x32ab2c=await this['httpClient'][_0x420df9(0x14f)](_0x420df9(0x136),_0x560d65);return _0x420df9(0x104)in _0x32ab2c?_0x32ab2c[_0x420df9(0x104)]:_0x32ab2c;}async[a3_0x46fc14(0xf4)](_0x40dc49){const _0xf34fb6=a3_0x46fc14,_0x9f2c1c=_0xf34fb6(0x121)+_0x40dc49+'/activations',_0x58038f=await this[_0xf34fb6(0x11d)][_0xf34fb6(0x14f)](_0xf34fb6(0x136),_0x9f2c1c);return'data'in _0x58038f?_0x58038f[_0xf34fb6(0x104)]:_0x58038f;}async[a3_0x46fc14(0x142)](_0x4badd3,_0x12c115){const _0x179a05=a3_0x46fc14,_0x1d9221='/entities/journeys/'+_0x4badd3+_0x179a05(0x130),_0x4be679={'name':_0x12c115[_0x179a05(0xf1)],'scheduleType':_0x12c115[_0x179a05(0x12b)]||_0x179a05(0x150),'connectionId':String(_0x12c115['connectionId']),'columns':_0x12c115[_0x179a05(0x105)]??[],'notifyOn':_0x12c115[_0x179a05(0x120)]??[],..._0x12c115[_0x179a05(0xf5)]!==undefined&&{'description':_0x12c115[_0x179a05(0xf5)]},..._0x12c115[_0x179a05(0x154)]!==undefined&&{'allColumns':_0x12c115[_0x179a05(0x154)]},..._0x12c115[_0x179a05(0x13e)]!==undefined&&{'timezone':_0x12c115[_0x179a05(0x13e)]},..._0x12c115[_0x179a05(0xf6)]!==undefined&&{'connectorConfig':_0x12c115[_0x179a05(0xf6)]},..._0x12c115[_0x179a05(0x148)]!==undefined&&{'emailRecipients':_0x12c115[_0x179a05(0x148)]},..._0x12c115[_0x179a05(0x138)]!==undefined&&{'activationTemplateId':_0x12c115[_0x179a05(0x138)]},..._0x12c115[_0x179a05(0x109)]!==undefined&&{'syndicationBehavior':_0x12c115[_0x179a05(0x109)]}},_0x2173ff=await this[_0x179a05(0x11d)]['request'](_0x179a05(0x14a),_0x1d9221,{'body':{'type':_0x179a05(0x133),'attributes':{'activationParams':_0x4be679}},'headers':{'Content-Type':_0x179a05(0x14e)}});return _0x179a05(0x104)in _0x2173ff?_0x2173ff['data']:_0x2173ff;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a4_0x141fa0=a4_0x4a31;function a4_0x1ecc(){const _0x35ddee=['/api/workspaces','211299zWLppL','filter[name]','12daNoVB','/api/workspaces?','1340050xtTGIW','PATCH','26QiPBVf','append','status','deleteWorkspace','35379MiRaSl','launchCampaign','apiKey','toString','updateTemplate','370NDFCch','workspaces','ownerName','application/json','GET','listCampaigns','httpClient','deleteTemplate','612477xBhjLa','site','application/vnd.api+json','/duplicate','getTemplate','limit','stringify','page[limit]','offset','engage','resumeCampaign','include','page[offset]','listWorkspaces','updateCampaign','/api/campaigns','/api/email_templates/','getCampaign','filter[owner_user.name]','filter[campaignType]','/api/workspaces/','200AQbTjS','filter[workspaceId]','updateWorkspace','/pause','POST','1824480IingrV','getWorkspace','filter[status]','1274046GMcCEJ','duplicateCampaign','logger','deleteCampaign','request','pauseCampaign','createCampaign','DELETE','createWorkspace','campaignType','emailTemplates','name','createTemplate','37328AvXjQF','workspaceId','sort','/api/campaigns/','/api/email_templates'];a4_0x1ecc=function(){return _0x35ddee;};return a4_0x1ecc();}(function(_0x2fda44,_0x1cb68d){const _0x44352e=a4_0x4a31,_0x1d6c11=_0x2fda44();while(!![]){try{const _0x5a95a3=-parseInt(_0x44352e(0x1a9))/0x1*(parseInt(_0x44352e(0x1b5))/0x2)+-parseInt(_0x44352e(0x1c6))/0x3+-parseInt(_0x44352e(0x1b1))/0x4*(-parseInt(_0x44352e(0x1b3))/0x5)+-parseInt(_0x44352e(0x1e3))/0x6+-parseInt(_0x44352e(0x1e0))/0x7+parseInt(_0x44352e(0x1db))/0x8*(parseInt(_0x44352e(0x1b9))/0x9)+-parseInt(_0x44352e(0x1be))/0xa*(-parseInt(_0x44352e(0x1af))/0xb);if(_0x5a95a3===_0x1cb68d)break;else _0x1d6c11['push'](_0x1d6c11['shift']());}catch(_0x4eb3e1){_0x1d6c11['push'](_0x1d6c11['shift']());}}}(a4_0x1ecc,0x6e04a));function a4_0x4a31(_0x4c5b17,_0x8b32b1){_0x4c5b17=_0x4c5b17-0x1a5;const _0x1eccc5=a4_0x1ecc();let _0x4a31e8=_0x1eccc5[_0x4c5b17];return _0x4a31e8;}import{HTTPClient}from'./http-client.js';import{getEndpoint}from'../types/index.js';import{getAuthHeaders,toHeaderRecord}from'../core/auth.js';export class EngageApiClient{['httpClient'];constructor(_0x4df7a0){const _0x33fa3a=a4_0x4a31,_0x2a4298=getEndpoint(_0x4df7a0[_0x33fa3a(0x1c7)],_0x33fa3a(0x1cf)),_0xda9902=toHeaderRecord(getAuthHeaders(_0x4df7a0['site'],_0x4df7a0[_0x33fa3a(0x1bb)]));this[_0x33fa3a(0x1c4)]=new HTTPClient(_0x2a4298,_0xda9902,_0x4df7a0[_0x33fa3a(0x1e5)]);}async[a4_0x141fa0(0x1c3)](_0x36be08={}){const _0xa13170=a4_0x141fa0,_0x33ba3c=new URLSearchParams();_0x36be08['campaignType']&&_0x33ba3c[_0xa13170(0x1b6)](_0xa13170(0x1d9),_0x36be08[_0xa13170(0x1a5)]);_0x36be08[_0xa13170(0x1b7)]&&_0x33ba3c[_0xa13170(0x1b6)](_0xa13170(0x1e2),_0x36be08[_0xa13170(0x1b7)]);_0x36be08[_0xa13170(0x1aa)]&&_0x33ba3c[_0xa13170(0x1b6)](_0xa13170(0x1dc),_0x36be08[_0xa13170(0x1aa)]);_0x36be08[_0xa13170(0x1cb)]!==undefined&&_0x33ba3c['append'](_0xa13170(0x1cd),_0x36be08['limit'][_0xa13170(0x1bc)]());_0x36be08['offset']!==undefined&&_0x33ba3c[_0xa13170(0x1b6)]('page[offset]',_0x36be08[_0xa13170(0x1ce)]['toString']());_0x36be08[_0xa13170(0x1ab)]&&_0x33ba3c[_0xa13170(0x1b6)](_0xa13170(0x1ab),_0x36be08[_0xa13170(0x1ab)]);_0x36be08[_0xa13170(0x1d1)]&&_0x33ba3c[_0xa13170(0x1b6)](_0xa13170(0x1d1),_0x36be08[_0xa13170(0x1d1)]);const _0x2767e7=_0x33ba3c[_0xa13170(0x1bc)](),_0x1405d8=_0x2767e7?'/api/campaigns?'+_0x2767e7:_0xa13170(0x1d5);return await this[_0xa13170(0x1c4)][_0xa13170(0x1e7)]('GET',_0x1405d8,{'headers':{'Accept':'application/vnd.api+json'}});}async[a4_0x141fa0(0x1d7)](_0x52633a){const _0x40c97d=a4_0x141fa0;return await this['httpClient']['request'](_0x40c97d(0x1c2),_0x40c97d(0x1ac)+encodeURIComponent(_0x52633a),{'headers':{'Accept':_0x40c97d(0x1c8)}});}async[a4_0x141fa0(0x1e9)](_0x2dd935){const _0x434583=a4_0x141fa0,_0xa9edee={'data':{'type':'campaigns','attributes':_0x2dd935}};return await this[_0x434583(0x1c4)]['request'](_0x434583(0x1df),'/api/campaigns',{'headers':{'Content-Type':_0x434583(0x1c8),'Accept':_0x434583(0x1c8)},'body':JSON['stringify'](_0xa9edee)});}async[a4_0x141fa0(0x1d4)](_0x433788,_0x3f9725){const _0x29bb2e=a4_0x141fa0,_0xac27fe={'data':{'type':'campaigns','id':_0x433788,'attributes':_0x3f9725}};return await this[_0x29bb2e(0x1c4)][_0x29bb2e(0x1e7)](_0x29bb2e(0x1b4),_0x29bb2e(0x1ac)+encodeURIComponent(_0x433788),{'headers':{'Content-Type':_0x29bb2e(0x1c8),'Accept':'application/vnd.api+json'},'body':JSON[_0x29bb2e(0x1cc)](_0xac27fe)});}async[a4_0x141fa0(0x1e6)](_0x536409){const _0xec2c04=a4_0x141fa0;await this[_0xec2c04(0x1c4)]['request'](_0xec2c04(0x1ea),'/api/campaigns/'+encodeURIComponent(_0x536409),{'headers':{'Accept':'application/vnd.api+json'}});}async[a4_0x141fa0(0x1ba)](_0x485a9b){const _0x186bcd=a4_0x141fa0;await this[_0x186bcd(0x1c4)]['request'](_0x186bcd(0x1df),_0x186bcd(0x1ac)+encodeURIComponent(_0x485a9b)+'/launch',{'headers':{'Content-Type':_0x186bcd(0x1c1),'Accept':_0x186bcd(0x1c1)},'body':JSON['stringify']({})});}async[a4_0x141fa0(0x1e8)](_0x4cf725){const _0x1415fb=a4_0x141fa0;await this[_0x1415fb(0x1c4)][_0x1415fb(0x1e7)](_0x1415fb(0x1df),'/api/campaigns/'+encodeURIComponent(_0x4cf725)+_0x1415fb(0x1de),{'headers':{'Content-Type':_0x1415fb(0x1c1),'Accept':_0x1415fb(0x1c1)},'body':JSON[_0x1415fb(0x1cc)]({})});}async[a4_0x141fa0(0x1d0)](_0x2adde8){const _0x200d2a=a4_0x141fa0;await this[_0x200d2a(0x1c4)]['request'](_0x200d2a(0x1df),'/api/campaigns/'+encodeURIComponent(_0x2adde8)+'/resume',{'headers':{'Content-Type':_0x200d2a(0x1c1),'Accept':'application/json'},'body':JSON[_0x200d2a(0x1cc)]({})});}async[a4_0x141fa0(0x1e4)](_0x2af138){const _0x6d9ab2=a4_0x141fa0;return await this['httpClient'][_0x6d9ab2(0x1e7)](_0x6d9ab2(0x1df),_0x6d9ab2(0x1ac)+encodeURIComponent(_0x2af138)+_0x6d9ab2(0x1c9),{'headers':{'Content-Type':_0x6d9ab2(0x1c1),'Accept':_0x6d9ab2(0x1c8)},'body':JSON[_0x6d9ab2(0x1cc)]({})});}async['listTemplates'](_0x5e1db9={}){const _0x381e41=a4_0x141fa0,_0x4d4749=new URLSearchParams();_0x5e1db9['workspaceId']&&_0x4d4749[_0x381e41(0x1b6)](_0x381e41(0x1dc),_0x5e1db9[_0x381e41(0x1aa)]);_0x5e1db9['limit']!==undefined&&_0x4d4749[_0x381e41(0x1b6)](_0x381e41(0x1cd),_0x5e1db9[_0x381e41(0x1cb)][_0x381e41(0x1bc)]());_0x5e1db9[_0x381e41(0x1ce)]!==undefined&&_0x4d4749[_0x381e41(0x1b6)](_0x381e41(0x1d2),_0x5e1db9[_0x381e41(0x1ce)][_0x381e41(0x1bc)]());_0x5e1db9[_0x381e41(0x1ab)]&&_0x4d4749[_0x381e41(0x1b6)](_0x381e41(0x1ab),_0x5e1db9['sort']);const _0x152b75=_0x4d4749[_0x381e41(0x1bc)](),_0x262c25=_0x152b75?'/api/email_templates?'+_0x152b75:_0x381e41(0x1ad);return await this[_0x381e41(0x1c4)]['request'](_0x381e41(0x1c2),_0x262c25,{'headers':{'Accept':_0x381e41(0x1c8)}});}async[a4_0x141fa0(0x1ca)](_0x3d5714){const _0x1fb65e=a4_0x141fa0;return await this['httpClient'][_0x1fb65e(0x1e7)](_0x1fb65e(0x1c2),'/api/email_templates/'+encodeURIComponent(_0x3d5714),{'headers':{'Accept':'application/vnd.api+json'}});}async[a4_0x141fa0(0x1a8)](_0x3d4e2b){const _0x3ec95f=a4_0x141fa0,_0x127ce8={'data':{'type':_0x3ec95f(0x1a6),'attributes':_0x3d4e2b}};return await this[_0x3ec95f(0x1c4)][_0x3ec95f(0x1e7)]('POST','/api/email_templates',{'headers':{'Content-Type':_0x3ec95f(0x1c8),'Accept':_0x3ec95f(0x1c8)},'body':JSON[_0x3ec95f(0x1cc)](_0x127ce8)});}async[a4_0x141fa0(0x1bd)](_0x479648,_0x2c495e){const _0x1d9ae8=a4_0x141fa0,_0x46be22={'data':{'type':_0x1d9ae8(0x1a6),'id':_0x479648,'attributes':_0x2c495e}};return await this['httpClient']['request']('PATCH',_0x1d9ae8(0x1d6)+encodeURIComponent(_0x479648),{'headers':{'Content-Type':'application/vnd.api+json','Accept':'application/vnd.api+json'},'body':JSON['stringify'](_0x46be22)});}async[a4_0x141fa0(0x1c5)](_0xb29535){const _0x538967=a4_0x141fa0;await this[_0x538967(0x1c4)][_0x538967(0x1e7)](_0x538967(0x1ea),'/api/email_templates/'+encodeURIComponent(_0xb29535),{'headers':{'Accept':_0x538967(0x1c8)}});}async[a4_0x141fa0(0x1d3)](_0x2e5324={}){const _0x15eba7=a4_0x141fa0,_0x477570=new URLSearchParams();_0x2e5324[_0x15eba7(0x1a7)]&&_0x477570[_0x15eba7(0x1b6)](_0x15eba7(0x1b0),_0x2e5324['name']);_0x2e5324[_0x15eba7(0x1c0)]&&_0x477570['append'](_0x15eba7(0x1d8),_0x2e5324['ownerName']);_0x2e5324[_0x15eba7(0x1cb)]!==undefined&&_0x477570['append']('page[limit]',_0x2e5324[_0x15eba7(0x1cb)][_0x15eba7(0x1bc)]());_0x2e5324[_0x15eba7(0x1ce)]!==undefined&&_0x477570['append']('page[offset]',_0x2e5324['offset'][_0x15eba7(0x1bc)]());_0x2e5324['sort']&&_0x477570[_0x15eba7(0x1b6)]('sort',_0x2e5324[_0x15eba7(0x1ab)]);const _0x251122=_0x477570['toString'](),_0x5dc0e9=_0x251122?_0x15eba7(0x1b2)+_0x251122:_0x15eba7(0x1ae);return await this[_0x15eba7(0x1c4)]['request'](_0x15eba7(0x1c2),_0x5dc0e9,{'headers':{'Accept':_0x15eba7(0x1c8)}});}async[a4_0x141fa0(0x1e1)](_0x4cab01){const _0x1ec5c2=a4_0x141fa0;return await this[_0x1ec5c2(0x1c4)][_0x1ec5c2(0x1e7)](_0x1ec5c2(0x1c2),'/api/workspaces/'+encodeURIComponent(_0x4cab01),{'headers':{'Accept':'application/vnd.api+json'}});}async[a4_0x141fa0(0x1eb)](_0x1d6885){const _0x479e25=a4_0x141fa0,_0x1a2d45={'data':{'type':_0x479e25(0x1bf),'attributes':_0x1d6885}};return await this['httpClient'][_0x479e25(0x1e7)](_0x479e25(0x1df),_0x479e25(0x1ae),{'headers':{'Content-Type':_0x479e25(0x1c8),'Accept':_0x479e25(0x1c8)},'body':JSON[_0x479e25(0x1cc)](_0x1a2d45)});}async[a4_0x141fa0(0x1dd)](_0x389a6d,_0x2d0ef2){const _0x3009c0=a4_0x141fa0,_0x312682={'data':{'type':'workspaces','id':_0x389a6d,'attributes':_0x2d0ef2}};return await this[_0x3009c0(0x1c4)][_0x3009c0(0x1e7)](_0x3009c0(0x1b4),_0x3009c0(0x1da)+encodeURIComponent(_0x389a6d),{'headers':{'Content-Type':_0x3009c0(0x1c8),'Accept':_0x3009c0(0x1c8)},'body':JSON['stringify'](_0x312682)});}async[a4_0x141fa0(0x1b8)](_0x5dd0c7){const _0x45ecb6=a4_0x141fa0;await this[_0x45ecb6(0x1c4)][_0x45ecb6(0x1e7)](_0x45ecb6(0x1ea),_0x45ecb6(0x1da)+encodeURIComponent(_0x5dd0c7),{'headers':{'Accept':'application/vnd.api+json'}});}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a5_0x2da1b4=a5_0x4c4e;(function(_0x424f75,_0x1b04db){const _0x26e655=a5_0x4c4e,_0xa1f51a=_0x424f75();while(!![]){try{const _0x29625a=-parseInt(_0x26e655(0x1a7))/0x1*(-parseInt(_0x26e655(0x1c2))/0x2)+parseInt(_0x26e655(0x1b6))/0x3+-parseInt(_0x26e655(0x1b3))/0x4*(parseInt(_0x26e655(0x1cb))/0x5)+parseInt(_0x26e655(0x1f6))/0x6+-parseInt(_0x26e655(0x1d6))/0x7+parseInt(_0x26e655(0x1d5))/0x8+parseInt(_0x26e655(0x1be))/0x9*(-parseInt(_0x26e655(0x1e6))/0xa);if(_0x29625a===_0x1b04db)break;else _0xa1f51a['push'](_0xa1f51a['shift']());}catch(_0x3c1dd0){_0xa1f51a['push'](_0xa1f51a['shift']());}}}(a5_0x1eda,0x614a5));import{ErrorCode,SDKError}from'../sdk/errors.js';import a5_0x4f4f47 from'json-bigint';function a5_0x4c4e(_0x318447,_0x30d404){_0x318447=_0x318447-0x1a1;const _0x1eda4c=a5_0x1eda();let _0x4c4e06=_0x1eda4c[_0x318447];return _0x4c4e06;}const DEFAULT_RETRY_CONFIG={'maxRetries':0x3,'baseDelay':0x3e8,'maxDelay':0x1f40};function isRetryableStatus(_0x1e0b52){return _0x1e0b52>=0x1f4||_0x1e0b52===0x1ad;}function isNonRetryable429(_0x2b705a){const _0x452015=a5_0x4c4e;return _0x2b705a[_0x452015(0x1f7)]('already\x20running');}function getRetryDelay(_0x265cf8,_0x36a4a8){const _0x40e88d=a5_0x4c4e,_0x2c3ca2=Math[_0x40e88d(0x1a2)](_0x36a4a8[_0x40e88d(0x1ef)]*Math['pow'](0x2,_0x265cf8),_0x36a4a8[_0x40e88d(0x1ce)]);return Math['random']()*_0x2c3ca2;}function statusCodeToErrorCode(_0x23a1f6){const _0x12061d=a5_0x4c4e;if(_0x23a1f6===0x191)return ErrorCode[_0x12061d(0x1a1)];else{if(_0x23a1f6===0x193)return ErrorCode[_0x12061d(0x1ea)];else{if(_0x23a1f6===0x194)return ErrorCode['NOT_FOUND'];else{if(_0x23a1f6===0x1ad)return ErrorCode[_0x12061d(0x1d1)];else return _0x23a1f6>=0x1f4?ErrorCode[_0x12061d(0x1c5)]:ErrorCode['INVALID_ARGUMENT'];}}}}export class HTTPClientError extends Error{[a5_0x2da1b4(0x1b5)];[a5_0x2da1b4(0x1da)];[a5_0x2da1b4(0x1c0)];constructor(_0x2bb6d9,_0x19c0e4,_0x46abb3){const _0x2bec80=a5_0x2da1b4,_0x36e6b0=statusCodeToErrorCode(_0x19c0e4);super('['+_0x36e6b0+']\x20'+_0x2bb6d9),this[_0x2bec80(0x1b5)]=_0x19c0e4,this[_0x2bec80(0x1da)]=_0x46abb3,this[_0x2bec80(0x1cf)]=_0x2bec80(0x1ae),this[_0x2bec80(0x1c0)]=_0x36e6b0;}}function a5_0x1eda(){const _0x2ee2ab=['text','30284NMtnYj','about:blank','status','1913823mqKwZo','sleep','string','request','logger',']\x20Request\x20failed\x20with\x20','stringify','safeParseJSON','6837255eKpgCc','retrying\x20in\x20','code','maxRetries','4202OSntrO','body','Error\x20response\x20body:\x20','UNAVAILABLE','instance','HTTP_REQUEST_FAILURE','HTTP\x20','arrayBuffer','retryConfig','110swMnad','warn','Request\x20cancelled\x20by\x20user','maxDelay','name','parse','RATE_LIMITED','Request\x20to\x20','message','status_code','4867944vGnLoy','4362176WxksVN','An\x20error\x20occurred','abort','baseUrl','problemDetails','forEach','ms...','signal','headers','extractErrorMessage','[binary\x20data]','get','aborted','combineSignals','detail','parseProblemDetails','10wVQUmp','info','Content-Type','\x20failed:\x20','PERMISSION_DENIED','type','length',']\x20Request\x20failed\x20with\x20HTTP\x20','Request\x20failed\x20after\x20retries','baseDelay','trace','\x0a\x20\x20Details:\x20','severity','object','defaultHeaders','round','817938EYFupq','includes','UNAUTHENTICATED','min','addEventListener','errors','Request:\x20','error','269ohbFpn','handleErrorResponse','request\x20body:\x20','requestSSE',']\x20Request\x20to\x20','[Retry\x20',']:\x20','HTTPClientError','statusText','title','INTERNAL'];a5_0x1eda=function(){return _0x2ee2ab;};return a5_0x1eda();}export class HTTPClient{[a5_0x2da1b4(0x1ca)];[a5_0x2da1b4(0x1d9)];[a5_0x2da1b4(0x1f4)];[a5_0x2da1b4(0x1ba)];constructor(_0x90623a,_0x486599,_0x3baf57,_0x36471d){const _0x370365=a5_0x2da1b4;this[_0x370365(0x1d9)]=_0x90623a,this[_0x370365(0x1f4)]=_0x486599,this['retryConfig']={...DEFAULT_RETRY_CONFIG,..._0x36471d},this[_0x370365(0x1ba)]=_0x3baf57;}async[a5_0x2da1b4(0x1b9)](_0x2890d7,_0x6b2105,_0x515cca={}){const _0x413e93=a5_0x2da1b4,{headers:headers={},body:_0x4b8fac,timeout:timeout=0x7530,retries:retries=this[_0x413e93(0x1ca)][_0x413e93(0x1c1)],signal:_0x4488b4,includeHeaders:includeHeaders=![],responseType:responseType='json'}=_0x515cca,_0xc37dad=''+this[_0x413e93(0x1d9)]+_0x6b2105;this[_0x413e93(0x1ba)][_0x413e93(0x1e7)](_0x413e93(0x1a5)+_0x2890d7+'\x20'+_0xc37dad);const _0x22e0a2={...this[_0x413e93(0x1f4)],...headers};if(_0x4b8fac&&!_0x22e0a2['Content-Type']){if(_0x4b8fac instanceof Buffer){}else _0x22e0a2[_0x413e93(0x1e8)]='application/json';}let _0xf6c6b9;_0x4b8fac&&(_0x4b8fac instanceof Buffer?_0xf6c6b9=_0x4b8fac:_0xf6c6b9=typeof _0x4b8fac==='string'?_0x4b8fac:JSON[_0x413e93(0x1bc)](_0x4b8fac));_0xf6c6b9&&this[_0x413e93(0x1ba)]['debug'](_0x413e93(0x1a9)+(typeof _0xf6c6b9===_0x413e93(0x1b8)?_0xf6c6b9:_0x413e93(0x1e0)));let _0x579447=null;for(let _0x5401fb=0x0;_0x5401fb<=retries;_0x5401fb++){try{const _0x3f4000=new AbortController(),_0x219b57=setTimeout(()=>_0x3f4000[_0x413e93(0x1d8)](),timeout);if(_0x4488b4){if(_0x4488b4[_0x413e93(0x1e2)])throw new Error(_0x413e93(0x1cd));_0x4488b4[_0x413e93(0x1a3)](_0x413e93(0x1d8),()=>_0x3f4000[_0x413e93(0x1d8)](),{'once':!![]});}const _0xde2e5f=await fetch(_0xc37dad,{'method':_0x2890d7,'headers':_0x22e0a2,'body':_0xf6c6b9,'signal':_0x3f4000[_0x413e93(0x1dd)]});clearTimeout(_0x219b57);if(_0x5401fb<retries&&isRetryableStatus(_0xde2e5f[_0x413e93(0x1b5)])){if(_0xde2e5f['status']===0x1ad){const _0x5ca49e=await _0xde2e5f['text']();if(isNonRetryable429(_0x5ca49e)){const _0x3232b7=this[_0x413e93(0x1df)](_0x5ca49e)||_0xde2e5f[_0x413e93(0x1af)];throw new HTTPClientError(_0x3232b7,_0xde2e5f[_0x413e93(0x1b5)]);}}const _0x1bf755=_0xde2e5f[_0x413e93(0x1de)][_0x413e93(0x1e1)]('Retry-After'),_0x8968f=_0x1bf755?parseInt(_0x1bf755,0xa)*0x3e8:getRetryDelay(_0x5401fb,this[_0x413e93(0x1ca)]);console[_0x413e93(0x1cc)]('[Retry\x20'+(_0x5401fb+0x1)+'/'+retries+_0x413e93(0x1bb)+_0xde2e5f[_0x413e93(0x1b5)]+',\x20'+(_0x413e93(0x1bf)+Math[_0x413e93(0x1f5)](_0x8968f)+_0x413e93(0x1dc))),await this['sleep'](_0x8968f);continue;}!_0xde2e5f['ok']&&await this[_0x413e93(0x1a8)](_0xde2e5f);let _0x112ff6;if(responseType==='arraybuffer'){const _0x2cf5fc=await _0xde2e5f[_0x413e93(0x1c9)]();_0x112ff6=Buffer['from'](_0x2cf5fc);}else responseType===_0x413e93(0x1b2)?_0x112ff6=await _0xde2e5f[_0x413e93(0x1b2)]():_0x112ff6=await this[_0x413e93(0x1bd)](_0xde2e5f);this['logger']['debug']('Response\x20['+_0xde2e5f[_0x413e93(0x1b5)]+_0x413e93(0x1ad)+_0x2890d7+'\x20'+_0x6b2105),this[_0x413e93(0x1ba)][_0x413e93(0x1f0)](JSON[_0x413e93(0x1bc)](_0x112ff6,null,0x2));if(includeHeaders){const _0x3b45ee={};return _0xde2e5f['headers'][_0x413e93(0x1db)]((_0x5d1e4a,_0x39357f)=>{_0x3b45ee[_0x39357f]=_0x5d1e4a;}),{'data':_0x112ff6,'status':_0xde2e5f[_0x413e93(0x1b5)],'headers':_0x3b45ee};}return _0x112ff6;}catch(_0x420782){_0x579447=_0x420782 instanceof Error?_0x420782:new Error(String(_0x420782));if(_0x420782 instanceof HTTPClientError){if(!isRetryableStatus(_0x420782[_0x413e93(0x1b5)])||_0x420782[_0x413e93(0x1b5)]===0x1ad&&isNonRetryable429(_0x420782[_0x413e93(0x1d3)]))throw _0x420782;}if(_0x5401fb>=retries)throw _0x579447;const _0x25b5d4=getRetryDelay(_0x5401fb,this[_0x413e93(0x1ca)]);let _0x456aea;_0x579447 instanceof HTTPClientError?_0x456aea=_0x413e93(0x1ac)+(_0x5401fb+0x1)+'/'+retries+_0x413e93(0x1ed)+_0x579447[_0x413e93(0x1b5)]+':\x20'+_0x579447[_0x413e93(0x1d3)]+',\x20'+(_0x413e93(0x1bf)+Math[_0x413e93(0x1f5)](_0x25b5d4)+_0x413e93(0x1dc)):_0x456aea=_0x413e93(0x1ac)+(_0x5401fb+0x1)+'/'+retries+_0x413e93(0x1ab)+_0xc37dad+_0x413e93(0x1e9)+_0x579447[_0x413e93(0x1d3)]+',\x20'+(_0x413e93(0x1bf)+Math['round'](_0x25b5d4)+_0x413e93(0x1dc)),console[_0x413e93(0x1cc)](_0x456aea),await this[_0x413e93(0x1b7)](_0x25b5d4);}}if(_0x579447&&!(_0x579447 instanceof HTTPClientError))throw new SDKError(ErrorCode[_0x413e93(0x1c7)],_0x413e93(0x1d2)+_0xc37dad+_0x413e93(0x1e9)+_0x579447['message'],_0x579447);throw _0x579447||new SDKError(ErrorCode[_0x413e93(0x1b1)],_0x413e93(0x1ee));}async[a5_0x2da1b4(0x1bd)](_0x7136ac){const _0x32ed6e=a5_0x2da1b4,_0x39383b=await _0x7136ac[_0x32ed6e(0x1b2)]();if(!_0x39383b)return null;try{const _0x56d2dc=a5_0x4f4f47({'storeAsString':!![]});return _0x56d2dc[_0x32ed6e(0x1d0)](_0x39383b);}catch{return{'body':_0x39383b};}}[a5_0x2da1b4(0x1e5)](_0x5740f3,_0x480907){const _0x152143=a5_0x2da1b4;if(!_0x5740f3||typeof _0x5740f3!==_0x152143(0x1f3))return undefined;let _0x2330e4=_0x5740f3;_0x2330e4[_0x152143(0x1a4)]&&typeof _0x2330e4['errors']===_0x152143(0x1f3)&&(_0x2330e4=_0x2330e4['errors']);if(_0x2330e4[_0x152143(0x1eb)]||_0x2330e4[_0x152143(0x1b0)]||_0x2330e4[_0x152143(0x1e4)])return{'type':_0x2330e4[_0x152143(0x1eb)]||'about:blank','title':_0x2330e4[_0x152143(0x1b0)]||'Error','status':_0x2330e4['status']||_0x480907,'detail':_0x2330e4[_0x152143(0x1e4)]||_0x152143(0x1d7),'instance':_0x2330e4[_0x152143(0x1c6)]||'',..._0x2330e4};const _0x51ddcd=_0x2330e4[_0x152143(0x1d3)]||_0x2330e4[_0x152143(0x1a6)]||_0x2330e4[_0x152143(0x1b2)];if(typeof _0x51ddcd===_0x152143(0x1b8))return{'type':_0x152143(0x1b4),'title':_0x2330e4[_0x152143(0x1f2)]||'Error','status':_0x2330e4[_0x152143(0x1d4)]||_0x480907,'detail':_0x51ddcd,'instance':'',..._0x2330e4};return undefined;}async[a5_0x2da1b4(0x1a8)](_0x188307){const _0x5d4b21=a5_0x2da1b4,_0x52a58a=await this[_0x5d4b21(0x1bd)](_0x188307),_0x10cd23=this[_0x5d4b21(0x1e5)](_0x52a58a,_0x188307[_0x5d4b21(0x1b5)]);_0x52a58a&&this[_0x5d4b21(0x1ba)]['debug'](_0x5d4b21(0x1c4)+JSON[_0x5d4b21(0x1bc)](_0x52a58a));let _0x463d7f;if(_0x10cd23?.['detail'])_0x463d7f=_0x10cd23[_0x5d4b21(0x1e4)];else _0x52a58a?_0x463d7f=_0x5d4b21(0x1c8)+_0x188307['status']+':\x20'+_0x188307['statusText']+_0x5d4b21(0x1f1)+JSON[_0x5d4b21(0x1bc)](_0x52a58a):_0x463d7f=_0x5d4b21(0x1c8)+_0x188307[_0x5d4b21(0x1b5)]+':\x20'+_0x188307[_0x5d4b21(0x1af)];throw new HTTPClientError(_0x463d7f,_0x188307[_0x5d4b21(0x1b5)],_0x10cd23);}['sleep'](_0x16adb9){return new Promise(_0x24219d=>setTimeout(_0x24219d,_0x16adb9));}['extractErrorMessage'](_0x5e7d1c){const _0x28c9de=a5_0x2da1b4;try{const _0x23c7aa=JSON[_0x28c9de(0x1d0)](_0x5e7d1c);return _0x23c7aa[_0x28c9de(0x1e4)]||_0x23c7aa[_0x28c9de(0x1d3)]||_0x23c7aa['error']||null;}catch{return _0x5e7d1c[_0x28c9de(0x1ec)]<0x1f4?_0x5e7d1c:null;}}async[a5_0x2da1b4(0x1aa)](_0x42ef66,_0x52fd19,_0x507607={}){const _0x16d553=a5_0x2da1b4,{headers:headers={},body:_0x432ec9,timeout:timeout=0x7530,signal:_0x1d38ee}=_0x507607,_0x3f7f06=''+this[_0x16d553(0x1d9)]+_0x52fd19,_0xf1aeee={...this[_0x16d553(0x1f4)],...headers},_0x2a6d2b=new AbortController(),_0x1303fe=setTimeout(()=>_0x2a6d2b[_0x16d553(0x1d8)](),timeout),_0x9617d8=_0x1d38ee?[_0x2a6d2b[_0x16d553(0x1dd)],_0x1d38ee]:[_0x2a6d2b[_0x16d553(0x1dd)]],_0x1bb31e=this['combineSignals'](_0x9617d8);try{const _0x54db2c={'method':_0x42ef66,'headers':_0xf1aeee,'signal':_0x1bb31e};if(_0x432ec9){if(typeof _0x432ec9===_0x16d553(0x1b8))_0x54db2c[_0x16d553(0x1c3)]=_0x432ec9;else _0x432ec9 instanceof Buffer?_0x54db2c['body']=_0x432ec9:_0x54db2c['body']=JSON['stringify'](_0x432ec9);}const _0x21bc83=await fetch(_0x3f7f06,_0x54db2c);return clearTimeout(_0x1303fe),!_0x21bc83['ok']&&await this[_0x16d553(0x1a8)](_0x21bc83),_0x21bc83;}catch(_0xe410a5){clearTimeout(_0x1303fe);if(_0xe410a5 instanceof HTTPClientError)throw _0xe410a5;if(_0xe410a5['name']==='AbortError')throw new Error(_0x16d553(0x1cd));throw _0xe410a5;}}[a5_0x2da1b4(0x1e3)](_0x27de9c){const _0x5db270=a5_0x2da1b4,_0x1ddbd9=new AbortController();for(const _0x2ad794 of _0x27de9c){if(_0x2ad794[_0x5db270(0x1e2)])return _0x1ddbd9['abort'](),_0x1ddbd9[_0x5db270(0x1dd)];_0x2ad794[_0x5db270(0x1a3)](_0x5db270(0x1d8),()=>_0x1ddbd9[_0x5db270(0x1d8)](),{'once':!![]});}return _0x1ddbd9['signal'];}}
|
|
1
|
+
function a5_0x76ff(_0x3e7818,_0x171e9a){_0x3e7818=_0x3e7818-0x118;const _0x3cee47=a5_0x3cee();let _0x76ff14=_0x3cee47[_0x3e7818];return _0x76ff14;}const a5_0x8f40e4=a5_0x76ff;(function(_0x16b9fa,_0x3049bc){const _0x34f6cb=a5_0x76ff,_0x12f380=_0x16b9fa();while(!![]){try{const _0x4015d4=parseInt(_0x34f6cb(0x11e))/0x1+parseInt(_0x34f6cb(0x13a))/0x2+-parseInt(_0x34f6cb(0x144))/0x3*(parseInt(_0x34f6cb(0x160))/0x4)+parseInt(_0x34f6cb(0x130))/0x5*(parseInt(_0x34f6cb(0x135))/0x6)+-parseInt(_0x34f6cb(0x15a))/0x7+-parseInt(_0x34f6cb(0x15b))/0x8*(parseInt(_0x34f6cb(0x168))/0x9)+-parseInt(_0x34f6cb(0x166))/0xa;if(_0x4015d4===_0x3049bc)break;else _0x12f380['push'](_0x12f380['shift']());}catch(_0x135ef9){_0x12f380['push'](_0x12f380['shift']());}}}(a5_0x3cee,0x53d56));import{ErrorCode,SDKError}from'../sdk/errors.js';import a5_0xe1492d from'json-bigint';function a5_0x3cee(){const _0x156e17=['json','message','status_code','title','type','RATE_LIMITED','debug',']\x20Request\x20to\x20','Request\x20cancelled\x20by\x20user','includes','combineSignals','pow','already\x20running','safeParseJSON','Content-Type','extractErrorMessage','1094265yGJuHT','body','maxRetries','length','maxDelay','18QzpVQN','parse','handleErrorResponse','retrying\x20in\x20','HTTPClientError','1358298LRMYCt',']\x20Request\x20failed\x20with\x20','ms...','trace','signal','about:blank','addEventListener','NOT_FOUND','status','requestSSE','7569ZwtWkV','stringify','text','statusText','error','\x20failed:\x20','HTTP_REQUEST_FAILURE','min','detail','object','retryConfig','[binary\x20data]','An\x20error\x20occurred',']:\x20','defaultHeaders','Response\x20[','random','aborted','severity','from','Request\x20failed\x20after\x20retries','request','1516046tZGMYy','424RDVZad','parseProblemDetails','logger','forEach','abort','524pLdORD','string','INVALID_ARGUMENT','[Retry\x20','headers','problemDetails','6640580mFsmld','Error\x20response\x20body:\x20','14922zKjGbg','sleep','Request:\x20','HTTP\x20','round','baseUrl','warn','instance','306697lDgjyz','code'];a5_0x3cee=function(){return _0x156e17;};return a5_0x3cee();}const DEFAULT_RETRY_CONFIG={'maxRetries':0x3,'baseDelay':0x3e8,'maxDelay':0x1f40};function isRetryableStatus(_0x8e43e8){return _0x8e43e8>=0x1f4||_0x8e43e8===0x1ad;}function isNonRetryable429(_0x23da34){const _0x489333=a5_0x76ff;return _0x23da34[_0x489333(0x129)](_0x489333(0x12c));}function getRetryDelay(_0x34d42d,_0x1fb810){const _0x3bfdea=a5_0x76ff,_0x23a958=Math[_0x3bfdea(0x14b)](_0x1fb810['baseDelay']*Math[_0x3bfdea(0x12b)](0x2,_0x34d42d),_0x1fb810[_0x3bfdea(0x134)]);return Math[_0x3bfdea(0x154)]()*_0x23a958;}function statusCodeToErrorCode(_0x5409c9){const _0x135df0=a5_0x76ff;if(_0x5409c9===0x191)return ErrorCode['UNAUTHENTICATED'];else{if(_0x5409c9===0x193)return ErrorCode['PERMISSION_DENIED'];else{if(_0x5409c9===0x194)return ErrorCode[_0x135df0(0x141)];else{if(_0x5409c9===0x1ad)return ErrorCode[_0x135df0(0x125)];else return _0x5409c9>=0x1f4?ErrorCode['UNAVAILABLE']:ErrorCode[_0x135df0(0x162)];}}}}export class HTTPClientError extends Error{[a5_0x8f40e4(0x142)];[a5_0x8f40e4(0x165)];[a5_0x8f40e4(0x11f)];constructor(_0x49b81d,_0x4f7dcd,_0x20792f){const _0x303b29=a5_0x8f40e4,_0x351b19=statusCodeToErrorCode(_0x4f7dcd);super('['+_0x351b19+']\x20'+_0x49b81d),this[_0x303b29(0x142)]=_0x4f7dcd,this['problemDetails']=_0x20792f,this['name']=_0x303b29(0x139),this[_0x303b29(0x11f)]=_0x351b19;}}export class HTTPClient{[a5_0x8f40e4(0x14e)];[a5_0x8f40e4(0x11b)];[a5_0x8f40e4(0x152)];[a5_0x8f40e4(0x15d)];constructor(_0x23997f,_0xf93666,_0x3e16fa,_0x5c08a8){const _0x53ce37=a5_0x8f40e4;this[_0x53ce37(0x11b)]=_0x23997f,this[_0x53ce37(0x152)]=_0xf93666,this[_0x53ce37(0x14e)]={...DEFAULT_RETRY_CONFIG,..._0x5c08a8},this[_0x53ce37(0x15d)]=_0x3e16fa;}async[a5_0x8f40e4(0x159)](_0x50bbde,_0x4c403b,_0x1c190c={}){const _0x4dc8c0=a5_0x8f40e4,{headers:headers={},body:_0x2cff4c,timeout:timeout=0x7530,retries:retries=this['retryConfig'][_0x4dc8c0(0x132)],signal:_0x1e858b,includeHeaders:includeHeaders=![],responseType:responseType=_0x4dc8c0(0x120)}=_0x1c190c,_0x182a9d=''+this['baseUrl']+_0x4c403b;this['logger']['info'](_0x4dc8c0(0x118)+_0x50bbde+'\x20'+_0x182a9d);const _0x6a4f63={...this[_0x4dc8c0(0x152)],...headers};if(_0x2cff4c&&!_0x6a4f63[_0x4dc8c0(0x12e)]){if(_0x2cff4c instanceof Buffer){}else _0x6a4f63['Content-Type']='application/json';}let _0x31a4ea;_0x2cff4c&&(_0x2cff4c instanceof Buffer?_0x31a4ea=_0x2cff4c:_0x31a4ea=typeof _0x2cff4c===_0x4dc8c0(0x161)?_0x2cff4c:JSON[_0x4dc8c0(0x145)](_0x2cff4c));_0x31a4ea&&this['logger'][_0x4dc8c0(0x126)]('request\x20body:\x20'+(typeof _0x31a4ea===_0x4dc8c0(0x161)?_0x31a4ea:_0x4dc8c0(0x14f)));let _0x57ae9e=null;for(let _0x12fb37=0x0;_0x12fb37<=retries;_0x12fb37++){try{const _0x337003=new AbortController(),_0x25fef7=setTimeout(()=>_0x337003[_0x4dc8c0(0x15f)](),timeout);if(_0x1e858b){if(_0x1e858b['aborted'])throw new Error(_0x4dc8c0(0x128));_0x1e858b[_0x4dc8c0(0x140)](_0x4dc8c0(0x15f),()=>_0x337003['abort'](),{'once':!![]});}const _0x9db64e=await fetch(_0x182a9d,{'method':_0x50bbde,'headers':_0x6a4f63,'body':_0x31a4ea,'signal':_0x337003[_0x4dc8c0(0x13e)]});clearTimeout(_0x25fef7);if(_0x12fb37<retries&&isRetryableStatus(_0x9db64e[_0x4dc8c0(0x142)])){if(_0x9db64e[_0x4dc8c0(0x142)]===0x1ad){const _0x55c24d=await _0x9db64e[_0x4dc8c0(0x146)]();if(isNonRetryable429(_0x55c24d)){const _0x398b9b=this[_0x4dc8c0(0x12f)](_0x55c24d)||_0x9db64e[_0x4dc8c0(0x147)];throw new HTTPClientError(_0x398b9b,_0x9db64e[_0x4dc8c0(0x142)]);}}const _0x2380f0=_0x9db64e[_0x4dc8c0(0x164)]['get']('Retry-After'),_0x3f0e44=_0x2380f0?parseInt(_0x2380f0,0xa)*0x3e8:getRetryDelay(_0x12fb37,this[_0x4dc8c0(0x14e)]);console[_0x4dc8c0(0x11c)]('[Retry\x20'+(_0x12fb37+0x1)+'/'+retries+_0x4dc8c0(0x13b)+_0x9db64e['status']+',\x20'+(_0x4dc8c0(0x138)+Math[_0x4dc8c0(0x11a)](_0x3f0e44)+_0x4dc8c0(0x13c))),await this[_0x4dc8c0(0x169)](_0x3f0e44);continue;}!_0x9db64e['ok']&&await this[_0x4dc8c0(0x137)](_0x9db64e);let _0x187196;if(responseType==='arraybuffer'){const _0x2f50e6=await _0x9db64e['arrayBuffer']();_0x187196=Buffer[_0x4dc8c0(0x157)](_0x2f50e6);}else responseType==='text'?_0x187196=await _0x9db64e[_0x4dc8c0(0x146)]():_0x187196=await this[_0x4dc8c0(0x12d)](_0x9db64e);this[_0x4dc8c0(0x15d)][_0x4dc8c0(0x126)](_0x4dc8c0(0x153)+_0x9db64e[_0x4dc8c0(0x142)]+_0x4dc8c0(0x151)+_0x50bbde+'\x20'+_0x4c403b),this['logger'][_0x4dc8c0(0x13d)](JSON['stringify'](_0x187196,null,0x2));if(includeHeaders){const _0xdc4834={};return _0x9db64e['headers'][_0x4dc8c0(0x15e)]((_0x13b068,_0x3c0b23)=>{_0xdc4834[_0x3c0b23]=_0x13b068;}),{'data':_0x187196,'status':_0x9db64e[_0x4dc8c0(0x142)],'headers':_0xdc4834};}return _0x187196;}catch(_0x44beeb){_0x57ae9e=_0x44beeb instanceof Error?_0x44beeb:new Error(String(_0x44beeb));if(_0x44beeb instanceof HTTPClientError){if(!isRetryableStatus(_0x44beeb['status'])||_0x44beeb['status']===0x1ad&&isNonRetryable429(_0x44beeb[_0x4dc8c0(0x121)]))throw _0x44beeb;}if(_0x12fb37>=retries)throw _0x57ae9e;const _0x28943b=getRetryDelay(_0x12fb37,this['retryConfig']);let _0x20cdcc;_0x57ae9e instanceof HTTPClientError?_0x20cdcc=_0x4dc8c0(0x163)+(_0x12fb37+0x1)+'/'+retries+']\x20Request\x20failed\x20with\x20HTTP\x20'+_0x57ae9e['status']+':\x20'+_0x57ae9e[_0x4dc8c0(0x121)]+',\x20'+(_0x4dc8c0(0x138)+Math['round'](_0x28943b)+_0x4dc8c0(0x13c)):_0x20cdcc=_0x4dc8c0(0x163)+(_0x12fb37+0x1)+'/'+retries+_0x4dc8c0(0x127)+_0x182a9d+_0x4dc8c0(0x149)+_0x57ae9e[_0x4dc8c0(0x121)]+',\x20'+('retrying\x20in\x20'+Math[_0x4dc8c0(0x11a)](_0x28943b)+'ms...'),console[_0x4dc8c0(0x11c)](_0x20cdcc),await this[_0x4dc8c0(0x169)](_0x28943b);}}if(_0x57ae9e&&!(_0x57ae9e instanceof HTTPClientError))throw new SDKError(ErrorCode[_0x4dc8c0(0x14a)],'Request\x20to\x20'+_0x182a9d+_0x4dc8c0(0x149)+_0x57ae9e[_0x4dc8c0(0x121)],_0x57ae9e);throw _0x57ae9e||new SDKError(ErrorCode['INTERNAL'],_0x4dc8c0(0x158));}async[a5_0x8f40e4(0x12d)](_0x265f4d){const _0x18937b=a5_0x8f40e4,_0x3f0eed=await _0x265f4d[_0x18937b(0x146)]();if(!_0x3f0eed)return null;try{const _0x16292d=a5_0xe1492d({'storeAsString':!![]});return _0x16292d[_0x18937b(0x136)](_0x3f0eed);}catch{return{'body':_0x3f0eed};}}[a5_0x8f40e4(0x15c)](_0x2b38ac,_0xd7d49d){const _0x12a0cd=a5_0x8f40e4;if(!_0x2b38ac||typeof _0x2b38ac!=='object')return undefined;let _0x2ff0a8=_0x2b38ac;_0x2ff0a8['errors']&&typeof _0x2ff0a8['errors']===_0x12a0cd(0x14d)&&(_0x2ff0a8=_0x2ff0a8['errors']);if(_0x2ff0a8[_0x12a0cd(0x124)]||_0x2ff0a8[_0x12a0cd(0x123)]||_0x2ff0a8['detail'])return{'type':_0x2ff0a8[_0x12a0cd(0x124)]||'about:blank','title':_0x2ff0a8[_0x12a0cd(0x123)]||'Error','status':_0x2ff0a8[_0x12a0cd(0x142)]||_0xd7d49d,'detail':_0x2ff0a8[_0x12a0cd(0x14c)]||_0x12a0cd(0x150),'instance':_0x2ff0a8[_0x12a0cd(0x11d)]||'',..._0x2ff0a8};const _0x3e51ac=_0x2ff0a8[_0x12a0cd(0x121)]||_0x2ff0a8[_0x12a0cd(0x148)]||_0x2ff0a8['text'];if(typeof _0x3e51ac===_0x12a0cd(0x161))return{'type':_0x12a0cd(0x13f),'title':_0x2ff0a8[_0x12a0cd(0x156)]||'Error','status':_0x2ff0a8[_0x12a0cd(0x122)]||_0xd7d49d,'detail':_0x3e51ac,'instance':'',..._0x2ff0a8};return undefined;}async[a5_0x8f40e4(0x137)](_0x3f61f7){const _0x52ca2c=a5_0x8f40e4,_0x2c1f2e=await this[_0x52ca2c(0x12d)](_0x3f61f7),_0x5c7ed6=this[_0x52ca2c(0x15c)](_0x2c1f2e,_0x3f61f7[_0x52ca2c(0x142)]);_0x2c1f2e&&this[_0x52ca2c(0x15d)][_0x52ca2c(0x126)](_0x52ca2c(0x167)+JSON['stringify'](_0x2c1f2e));let _0x3176cd;if(_0x5c7ed6?.[_0x52ca2c(0x14c)])_0x3176cd=_0x5c7ed6[_0x52ca2c(0x14c)];else _0x2c1f2e?_0x3176cd='HTTP\x20'+_0x3f61f7[_0x52ca2c(0x142)]+':\x20'+_0x3f61f7[_0x52ca2c(0x147)]+'\x0a\x20\x20Details:\x20'+JSON[_0x52ca2c(0x145)](_0x2c1f2e):_0x3176cd=_0x52ca2c(0x119)+_0x3f61f7[_0x52ca2c(0x142)]+':\x20'+_0x3f61f7[_0x52ca2c(0x147)];throw new HTTPClientError(_0x3176cd,_0x3f61f7[_0x52ca2c(0x142)],_0x5c7ed6);}[a5_0x8f40e4(0x169)](_0x3a44d4){return new Promise(_0x21fd38=>setTimeout(_0x21fd38,_0x3a44d4));}[a5_0x8f40e4(0x12f)](_0x5880e8){const _0x34eea8=a5_0x8f40e4;try{const _0x51d2fb=JSON[_0x34eea8(0x136)](_0x5880e8);return _0x51d2fb['detail']||_0x51d2fb[_0x34eea8(0x121)]||_0x51d2fb[_0x34eea8(0x148)]||null;}catch{return _0x5880e8[_0x34eea8(0x133)]<0x1f4?_0x5880e8:null;}}async[a5_0x8f40e4(0x143)](_0x14b88f,_0x474b90,_0x1435c1={}){const _0x50582e=a5_0x8f40e4,{headers:headers={},body:_0x281691,timeout:timeout=0x7530,signal:_0x20f65b}=_0x1435c1,_0x2f87ee=''+this['baseUrl']+_0x474b90,_0x595cee={...this[_0x50582e(0x152)],...headers},_0x34ab0c=new AbortController(),_0x4bf93b=setTimeout(()=>_0x34ab0c['abort'](),timeout),_0x395254=_0x20f65b?[_0x34ab0c[_0x50582e(0x13e)],_0x20f65b]:[_0x34ab0c[_0x50582e(0x13e)]],_0xc65f72=this[_0x50582e(0x12a)](_0x395254);try{const _0xce1bc0={'method':_0x14b88f,'headers':_0x595cee,'signal':_0xc65f72};if(_0x281691){if(typeof _0x281691===_0x50582e(0x161))_0xce1bc0[_0x50582e(0x131)]=_0x281691;else _0x281691 instanceof Buffer?_0xce1bc0[_0x50582e(0x131)]=_0x281691:_0xce1bc0['body']=JSON[_0x50582e(0x145)](_0x281691);}const _0x448345=await fetch(_0x2f87ee,_0xce1bc0);return clearTimeout(_0x4bf93b),!_0x448345['ok']&&await this['handleErrorResponse'](_0x448345),_0x448345;}catch(_0x231311){clearTimeout(_0x4bf93b);if(_0x231311 instanceof HTTPClientError)throw _0x231311;if(_0x231311['name']==='AbortError')throw new Error('Request\x20cancelled\x20by\x20user');throw _0x231311;}}['combineSignals'](_0x55bffd){const _0x54b092=a5_0x8f40e4,_0x2fe520=new AbortController();for(const _0x3d7d6d of _0x55bffd){if(_0x3d7d6d[_0x54b092(0x155)])return _0x2fe520[_0x54b092(0x15f)](),_0x2fe520['signal'];_0x3d7d6d['addEventListener']('abort',()=>_0x2fe520[_0x54b092(0x15f)](),{'once':!![]});}return _0x2fe520[_0x54b092(0x13e)];}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a6_0x263e17=a6_0x38c3;(function(_0x756df1,_0x4d143f){const _0x557e41=a6_0x38c3,_0x2b918c=_0x756df1();while(!![]){try{const _0xbdab2=-parseInt(_0x557e41(0xc1))/0x1*(parseInt(_0x557e41(0x9d))/0x2)+-parseInt(_0x557e41(0xca))/0x3*(parseInt(_0x557e41(0x85))/0x4)+-parseInt(_0x557e41(0xd2))/0x5+-parseInt(_0x557e41(0xe4))/0x6*(parseInt(_0x557e41(0xd8))/0x7)+-parseInt(_0x557e41(0xba))/0x8*(-parseInt(_0x557e41(0xd4))/0x9)+-parseInt(_0x557e41(0xcb))/0xa+parseInt(_0x557e41(0xdb))/0xb;if(_0xbdab2===_0x4d143f)break;else _0x2b918c['push'](_0x2b918c['shift']());}catch(_0x47ee8a){_0x2b918c['push'](_0x2b918c['shift']());}}}(a6_0x1f34,0xa44e4));function a6_0x1f34(){const _0x303c9e=['?filter[project_id]=','3267570FjezPb','/api/projects/','144252KHyvyp','/api/users/current_settings','updatePrompt','createIntegration','30821vmcczA','prompt','agents','32599347IRXXjg','description','/api/agents/','/api/chats?','application/json','/api/projects','startsWith','/api/prompts','ms...','1242ngtByT','LLM_EMPTY_MESSAGE','LLM_CHAT_CREATION_FAILURE','Failed\x20to\x20create\x20chat:\x20unexpected\x20error','-last_conversation_at','trim','page[limit]','/api/prompts/','listChats','listPrompts','warn','deleteProject','listAgents','getAgent','/api/integrations?filter[projectId]=','4xCLuXl','search','paginateAll',']\x20Streaming\x20SSE\x20stream\x20for\x20chatId:\x20','/api/prompts?filter[projectId]=','/api/chats/','integrations','DELETE','http','baseUrl','listKnowledgeBases','updateAgentFull','/api/projects?page[limit]=','getChatInfo','knowledge_bases','site','apiKey','createAgentFull','Please\x20provide\x20a\x20non-empty\x20message\x20to\x20continue\x20the\x20chat.','continueChat','next','llm','data','LLM_STREAM_ERROR','1030544kASPZh','updateIntegration','/api/knowledge_bases','length','startChat','authHeaders','links','\x20with\x20message\x20size:\x20','push','text/event-stream','/api/agents','/api/knowledge_bases/','/api/knowledge_bases?filter[projectId]=','PATCH','httpClient','debug','&page[limit]=50','reasoningEffort','append','createAgent',']\x20Chat\x20creation\x20returned\x20empty\x20ID,\x20retrying\x20in\x20','/history','getUserSettings','GET','/continue','/api/integrations','POST','name','getProject','344WCrDDY','[Retry\x20','starterMessage','requestSSE','Failed\x20to\x20create\x20chat\x20after\x20','request','maxToolIterations','2RtNMAO','getChatHistory','projectId','projects','sort','pathname','Message\x20cannot\x20be\x20empty\x20or\x20whitespace\x20only','status','application/vnd.api+json','931683uqJpSI','737450HdZdHk','logger','updateKnowledgeBase','agentId','/api/chats','systemPrompt'];a6_0x1f34=function(){return _0x303c9e;};return a6_0x1f34();}import{HTTPClient}from'./http-client.js';import{getEndpoint}from'../types/index.js';import{getAuthHeaders,toHeaderRecord}from'../core/auth.js';import{parseSSEStream}from'../utils/sse-parser.js';function a6_0x38c3(_0x23c549,_0x9bfb40){_0x23c549=_0x23c549-0x77;const _0x1f347e=a6_0x1f34();let _0x38c3b6=_0x1f347e[_0x23c549];return _0x38c3b6;}import{ErrorCode,SDKError}from'../sdk/errors.js';export class LLMApiClient{[a6_0x263e17(0xab)];[a6_0x263e17(0x8e)];[a6_0x263e17(0xa2)];[a6_0x263e17(0xcc)];constructor(_0x1cb515,_0x1badfe){const _0x86d451=a6_0x263e17;this[_0x86d451(0x8e)]=getEndpoint(_0x1cb515[_0x86d451(0x94)],_0x86d451(0x9a)),this['authHeaders']=toHeaderRecord(getAuthHeaders(_0x1cb515[_0x86d451(0x94)],_0x1cb515[_0x86d451(0x95)])),this[_0x86d451(0xcc)]=_0x1badfe,this[_0x86d451(0xab)]=new HTTPClient(this[_0x86d451(0x8e)],this['authHeaders'],_0x1badfe);}async[a6_0x263e17(0x87)](_0x29a631){const _0x3d74ba=a6_0x263e17,_0x4fc868=[];let _0x33a7c5=_0x29a631;while(_0x33a7c5){const _0x1f6ada=await this[_0x3d74ba(0xab)][_0x3d74ba(0xbf)](_0x3d74ba(0xb4),_0x33a7c5);_0x1f6ada[_0x3d74ba(0x9b)]&&_0x4fc868[_0x3d74ba(0xa5)](..._0x1f6ada[_0x3d74ba(0x9b)]);_0x33a7c5=_0x1f6ada[_0x3d74ba(0xa3)]?.[_0x3d74ba(0x99)];if(_0x33a7c5&&_0x33a7c5[_0x3d74ba(0xe1)](_0x3d74ba(0x8d))){const _0x382424=new URL(_0x33a7c5);_0x33a7c5=_0x382424[_0x3d74ba(0xc6)]+_0x382424[_0x3d74ba(0x86)];}}return _0x4fc868;}async[a6_0x263e17(0xb3)](){const _0x1132f6=a6_0x263e17;return await this[_0x1132f6(0xab)]['request']('GET',_0x1132f6(0xd5));}async['createProject'](_0x21c341){const _0x38be7c=a6_0x263e17,_0x546544={'data':{'type':_0x38be7c(0xc4),'attributes':{'name':_0x21c341[_0x38be7c(0xb8)],..._0x21c341['description']&&{'description':_0x21c341[_0x38be7c(0xdc)]}}}},_0x158104=await this[_0x38be7c(0xab)][_0x38be7c(0xbf)]('POST',_0x38be7c(0xe0),{'headers':{'Content-Type':_0x38be7c(0xc9),'Accept':_0x38be7c(0xc9)},'body':_0x546544});return _0x158104[_0x38be7c(0x9b)];}async[a6_0x263e17(0x81)](_0x588ddb){const _0x10c528=a6_0x263e17,_0x4d7b3e=_0x10c528(0xd3)+encodeURIComponent(_0x588ddb);await this[_0x10c528(0xab)]['request'](_0x10c528(0x8c),_0x4d7b3e);}async['listProjects'](_0x1f033e=0x32){const _0x405fc2=a6_0x263e17;return this[_0x405fc2(0x87)](_0x405fc2(0x91)+_0x1f033e);}async['listAgents'](_0x3f8f07){const _0xd2ca53=a6_0x263e17;let _0x101c84=_0xd2ca53(0xa7);_0x3f8f07&&(_0x101c84+=_0xd2ca53(0xd1)+encodeURIComponent(_0x3f8f07));const _0xea2f14=await this[_0xd2ca53(0xab)][_0xd2ca53(0xbf)](_0xd2ca53(0xb4),_0x101c84);return _0xea2f14['data']||[];}async[a6_0x263e17(0x83)](_0x5053bb){const _0x369737=a6_0x263e17,_0x3bbc46='/api/agents/'+encodeURIComponent(_0x5053bb),_0x499d3e=await this[_0x369737(0xab)][_0x369737(0xbf)](_0x369737(0xb4),_0x3bbc46);return _0x499d3e['data'];}async[a6_0x263e17(0xb0)](_0x180069){const _0xde7b25=a6_0x263e17,_0x4941e3={'name':_0x180069['name'],'projectId':_0x180069[_0xde7b25(0xc3)],'modelType':_0x180069['modelType'],'maxToolIterations':_0x180069[_0xde7b25(0xc0)]??0x4,'temperature':_0x180069['temperature']??0.7};_0x180069[_0xde7b25(0xd0)]!==undefined&&(_0x4941e3[_0xde7b25(0xd0)]=_0x180069['systemPrompt']);_0x180069['starterMessage']&&(_0x4941e3[_0xde7b25(0xbc)]=_0x180069[_0xde7b25(0xbc)]);_0x180069[_0xde7b25(0xae)]&&(_0x4941e3['reasoningEffort']=_0x180069[_0xde7b25(0xae)]);const _0x2808dc={'data':{'type':_0xde7b25(0xda),'attributes':_0x4941e3}},_0x5668eb=await this['httpClient'][_0xde7b25(0xbf)](_0xde7b25(0xb7),_0xde7b25(0xa7),{'headers':{'Content-Type':_0xde7b25(0xc9),'Accept':_0xde7b25(0xc9)},'body':_0x2808dc});return _0x5668eb[_0xde7b25(0x9b)];}async['updateAgent'](_0x30d6f7,_0x1cadc7){const _0x55e6b8=a6_0x263e17,_0x47ec38={'data':{'type':_0x55e6b8(0xda),'id':_0x30d6f7,'attributes':{..._0x1cadc7[_0x55e6b8(0xb8)]&&{'name':_0x1cadc7[_0x55e6b8(0xb8)]},..._0x1cadc7[_0x55e6b8(0xdc)]&&{'description':_0x1cadc7['description']},..._0x1cadc7[_0x55e6b8(0xd9)]&&{'prompt':_0x1cadc7[_0x55e6b8(0xd9)]},..._0x1cadc7['starterMessage']&&{'starter_message':_0x1cadc7['starterMessage']},..._0x1cadc7[_0x55e6b8(0xae)]&&{'reasoningEffort':_0x1cadc7[_0x55e6b8(0xae)]}}}},_0x7782b7=_0x55e6b8(0xdd)+encodeURIComponent(_0x30d6f7),_0x56b300=await this[_0x55e6b8(0xab)][_0x55e6b8(0xbf)](_0x55e6b8(0xaa),_0x7782b7,{'body':_0x47ec38});return _0x56b300[_0x55e6b8(0x9b)];}async['deleteAgent'](_0x22e694){const _0xe9dd6d=a6_0x263e17,_0x53b2b7=_0xe9dd6d(0xdd)+encodeURIComponent(_0x22e694);await this['httpClient']['request'](_0xe9dd6d(0x8c),_0x53b2b7);}async[a6_0x263e17(0x7e)](_0x40ffde=0x32){const _0x185a48=a6_0x263e17,_0x292611=new URLSearchParams();_0x292611[_0x185a48(0xaf)](_0x185a48(0x7c),String(_0x40ffde)),_0x292611[_0x185a48(0xaf)](_0x185a48(0xc5),_0x185a48(0x7a));const _0x5a48ee=_0x185a48(0xde)+_0x292611['toString'](),_0x40211d=await this[_0x185a48(0xab)][_0x185a48(0xbf)]('GET',_0x5a48ee);return _0x40211d[_0x185a48(0x9b)]||[];}async[a6_0x263e17(0x92)](_0x1c90f9){const _0x515f56=a6_0x263e17,_0x5abed2='/api/chats/'+encodeURIComponent(_0x1c90f9),_0xa0e4d2=await this[_0x515f56(0xab)]['request'](_0x515f56(0xb4),_0x5abed2);return _0xa0e4d2[_0x515f56(0x9b)];}async[a6_0x263e17(0xc2)](_0x238129){const _0x10bafb=a6_0x263e17,_0x56bf29=_0x10bafb(0x8a)+encodeURIComponent(_0x238129)+_0x10bafb(0xb2);return await this[_0x10bafb(0xab)][_0x10bafb(0xbf)](_0x10bafb(0xb4),_0x56bf29);}async[a6_0x263e17(0xa1)](_0x3ad386){const _0x13940d=a6_0x263e17,_0xf0a36f={'data':{'type':'chats','attributes':{'agentId':_0x3ad386[_0x13940d(0xce)]}}},_0x4d0663=0x3,_0x1b89be=[0x3e8,0x7d0,0xfa0];for(let _0x2feb51=0x0;_0x2feb51<=_0x4d0663;_0x2feb51++){const _0x5d2447=await this[_0x13940d(0xab)][_0x13940d(0xbf)](_0x13940d(0xb7),_0x13940d(0xcf),{'headers':{'Content-Type':_0x13940d(0xc9),'Accept':_0x13940d(0xc9)},'body':_0xf0a36f});if(_0x5d2447[_0x13940d(0x9b)]&&_0x5d2447[_0x13940d(0x9b)]['id'])return _0x5d2447[_0x13940d(0x9b)];if(_0x2feb51>=_0x4d0663)throw new SDKError(ErrorCode[_0x13940d(0x78)],_0x13940d(0xbe)+(_0x4d0663+0x1)+'\x20attempts:\x20API\x20returned\x20empty\x20chat\x20ID');const _0x4a9669=_0x1b89be[_0x2feb51];console[_0x13940d(0x80)](_0x13940d(0xbb)+(_0x2feb51+0x1)+'/'+_0x4d0663+_0x13940d(0xb1)+_0x4a9669+_0x13940d(0xe3)),await new Promise(_0x28862b=>setTimeout(_0x28862b,_0x4a9669));}throw new SDKError(ErrorCode[_0x13940d(0x78)],_0x13940d(0x79));}async*[a6_0x263e17(0x98)](_0x193dc7,_0x21ea6f,_0x22daf0){const _0x5cd841=a6_0x263e17,_0x22b955=_0x21ea6f[_0x5cd841(0x7b)]();if(!_0x22b955)throw new SDKError(ErrorCode[_0x5cd841(0x77)],_0x5cd841(0xc7),undefined,{'helpText':_0x5cd841(0x97)});this['logger'][_0x5cd841(0xac)]('Continuing\x20chat\x20'+_0x193dc7+_0x5cd841(0xa4)+_0x21ea6f[_0x5cd841(0xa0)]+'\x20characters');const _0x37cf95='/api/chats/'+encodeURIComponent(_0x193dc7)+_0x5cd841(0xb5),_0x1b6f2f={'input':_0x21ea6f};try{const _0x3f31da=await this[_0x5cd841(0xab)][_0x5cd841(0xbd)](_0x5cd841(0xb7),_0x37cf95,{'headers':{'Content-Type':_0x5cd841(0xdf),'Accept':_0x5cd841(0xa6)},'body':_0x1b6f2f,'signal':_0x22daf0});this[_0x5cd841(0xcc)][_0x5cd841(0xac)]('['+_0x3f31da[_0x5cd841(0xc8)]+_0x5cd841(0x88)+_0x193dc7),yield*parseSSEStream(_0x3f31da,this[_0x5cd841(0xcc)]);}catch(_0x343343){throw new SDKError(ErrorCode[_0x5cd841(0x9c)],'Failed\x20to\x20continue\x20chat\x20(chatId:\x20'+_0x193dc7+',\x20message\x20length:\x20'+_0x21ea6f[_0x5cd841(0xa0)]+')',_0x343343);}}async[a6_0x263e17(0xb9)](_0x29c894){const _0x2151e8=a6_0x263e17,_0x27e897=_0x2151e8(0xd3)+encodeURIComponent(_0x29c894),_0x51f872=await this['httpClient']['request'](_0x2151e8(0xb4),_0x27e897);return _0x51f872['data'];}async[a6_0x263e17(0x8f)](_0xb931dc){const _0xd0d488=a6_0x263e17;return this['paginateAll'](_0xd0d488(0xa9)+encodeURIComponent(_0xb931dc)+_0xd0d488(0xad));}async['createKnowledgeBase'](_0x54ea73){const _0x551afe=a6_0x263e17,_0xbafbb7={'data':{'type':_0x551afe(0x93),'attributes':_0x54ea73}},_0x39a3df=await this[_0x551afe(0xab)][_0x551afe(0xbf)](_0x551afe(0xb7),_0x551afe(0x9f),{'headers':{'Content-Type':_0x551afe(0xc9),'Accept':'application/vnd.api+json'},'body':_0xbafbb7});return _0x39a3df[_0x551afe(0x9b)];}async[a6_0x263e17(0x7f)](_0x349687){const _0x17d8e5=a6_0x263e17;return this[_0x17d8e5(0x87)](_0x17d8e5(0x89)+encodeURIComponent(_0x349687)+'&page[limit]=50');}async['createPrompt'](_0x36548d){const _0x5b0294=a6_0x263e17,{jsonSchemaHint:_0x1ef332,..._0x328dd4}=_0x36548d,_0x2c34b6={'data':{'type':'prompts','attributes':_0x328dd4}},_0x4198f1=await this[_0x5b0294(0xab)][_0x5b0294(0xbf)](_0x5b0294(0xb7),_0x5b0294(0xe2),{'headers':{'Content-Type':'application/vnd.api+json','Accept':_0x5b0294(0xc9)},'body':_0x2c34b6});return _0x4198f1['data'];}async['listIntegrations'](_0x3fce6e){const _0x1ffed1=a6_0x263e17;return this[_0x1ffed1(0x87)](_0x1ffed1(0x84)+encodeURIComponent(_0x3fce6e)+_0x1ffed1(0xad));}async[a6_0x263e17(0xd7)](_0x36e351){const _0x16bc5a=a6_0x263e17,_0x2b2610={'data':{'type':_0x16bc5a(0x8b),'attributes':_0x36e351}},_0x332315=await this[_0x16bc5a(0xab)]['request'](_0x16bc5a(0xb7),_0x16bc5a(0xb6),{'headers':{'Content-Type':_0x16bc5a(0xc9),'Accept':'application/vnd.api+json'},'body':_0x2b2610});return _0x332315[_0x16bc5a(0x9b)];}async['listAgentsFull'](_0x5f582d){const _0x4e3dae=a6_0x263e17,_0x487880=await this[_0x4e3dae(0x82)](_0x5f582d),_0x4cba4e=[];for(const _0x1d27b of _0x487880){const _0x339a45=_0x4e3dae(0xdd)+encodeURIComponent(_0x1d27b['id']),_0x59a1de=await this['httpClient']['request'](_0x4e3dae(0xb4),_0x339a45);_0x4cba4e[_0x4e3dae(0xa5)](_0x59a1de[_0x4e3dae(0x9b)]);}return _0x4cba4e;}async[a6_0x263e17(0x96)](_0x49246a){const _0x2ef587=a6_0x263e17,_0x5f13b4={'data':{'type':_0x2ef587(0xda),'attributes':_0x49246a}},_0x288f27=await this[_0x2ef587(0xab)]['request'](_0x2ef587(0xb7),'/api/agents',{'headers':{'Content-Type':_0x2ef587(0xc9),'Accept':_0x2ef587(0xc9)},'body':_0x5f13b4});return _0x288f27[_0x2ef587(0x9b)];}async[a6_0x263e17(0x90)](_0x105fa3,_0x7b589c){const _0x5593a5=a6_0x263e17,_0x1a169d={'data':{'type':'agents','id':_0x105fa3,'attributes':_0x7b589c}},_0x593a71=_0x5593a5(0xdd)+encodeURIComponent(_0x105fa3),_0x5b9aa5=await this[_0x5593a5(0xab)][_0x5593a5(0xbf)]('PATCH',_0x593a71,{'headers':{'Content-Type':_0x5593a5(0xc9),'Accept':_0x5593a5(0xc9)},'body':_0x1a169d});return _0x5b9aa5[_0x5593a5(0x9b)];}async[a6_0x263e17(0xcd)](_0x247131,_0x5792f0){const _0x1bf926=a6_0x263e17,_0x4c2ec4={'data':{'type':_0x1bf926(0x93),'id':_0x247131,'attributes':_0x5792f0}},_0x2e1504=_0x1bf926(0xa8)+encodeURIComponent(_0x247131),_0x3b54ec=await this['httpClient'][_0x1bf926(0xbf)](_0x1bf926(0xaa),_0x2e1504,{'headers':{'Content-Type':_0x1bf926(0xc9),'Accept':_0x1bf926(0xc9)},'body':_0x4c2ec4});return _0x3b54ec['data'];}async[a6_0x263e17(0xd6)](_0x25cbe6,_0x514f6){const _0x3bc9df=a6_0x263e17,{jsonSchemaHint:_0x33425f,..._0x679796}=_0x514f6,_0x359cce={'data':{'type':'prompts','id':_0x25cbe6,'attributes':_0x679796}},_0xe55369=_0x3bc9df(0x7d)+encodeURIComponent(_0x25cbe6),_0x328e96=await this[_0x3bc9df(0xab)][_0x3bc9df(0xbf)]('PATCH',_0xe55369,{'headers':{'Content-Type':_0x3bc9df(0xc9),'Accept':_0x3bc9df(0xc9)},'body':_0x359cce});return _0x328e96[_0x3bc9df(0x9b)];}async[a6_0x263e17(0x9e)](_0x25e993,_0x153d9d){const _0x56d525=a6_0x263e17,_0x167da6={'data':{'type':'integrations','id':_0x25e993,'attributes':_0x153d9d}},_0x548a60='/api/integrations/'+encodeURIComponent(_0x25e993),_0x4d22dd=await this[_0x56d525(0xab)][_0x56d525(0xbf)](_0x56d525(0xaa),_0x548a60,{'headers':{'Content-Type':_0x56d525(0xc9),'Accept':_0x56d525(0xc9)},'body':_0x167da6});return _0x4d22dd[_0x56d525(0x9b)];}}
|
|
1
|
+
const a6_0x5b6c5b=a6_0x208b;(function(_0x1fe917,_0x43cfd5){const _0x5eb0c4=a6_0x208b,_0x58ea4f=_0x1fe917();while(!![]){try{const _0x2ee463=-parseInt(_0x5eb0c4(0x11a))/0x1*(parseInt(_0x5eb0c4(0xc8))/0x2)+-parseInt(_0x5eb0c4(0xc6))/0x3*(-parseInt(_0x5eb0c4(0xf7))/0x4)+parseInt(_0x5eb0c4(0x10c))/0x5*(-parseInt(_0x5eb0c4(0x101))/0x6)+parseInt(_0x5eb0c4(0x10b))/0x7+parseInt(_0x5eb0c4(0xbf))/0x8+parseInt(_0x5eb0c4(0xd2))/0x9*(parseInt(_0x5eb0c4(0xeb))/0xa)+parseInt(_0x5eb0c4(0xc5))/0xb*(-parseInt(_0x5eb0c4(0xf6))/0xc);if(_0x2ee463===_0x43cfd5)break;else _0x58ea4f['push'](_0x58ea4f['shift']());}catch(_0x1f98c7){_0x58ea4f['push'](_0x58ea4f['shift']());}}}(a6_0x1754,0xebe15));function a6_0x208b(_0x48e919,_0x505d0e){_0x48e919=_0x48e919-0xb3;const _0x17548e=a6_0x1754();let _0x208bff=_0x17548e[_0x48e919];return _0x208bff;}import{HTTPClient}from'./http-client.js';import{getEndpoint}from'../types/index.js';import{getAuthHeaders,toHeaderRecord}from'../core/auth.js';import{parseSSEStream}from'../utils/sse-parser.js';function a6_0x1754(){const _0x109eaf=['reasoningEffort','llm','projects','chats','deleteProject','startChat','createKnowledgeBase','DELETE','getUserSettings','listAgents','Continuing\x20chat\x20','startsWith','5nrsmmN','POST','createAgentFull','temperature','/api/integrations/','description','/api/knowledge_bases?filter[projectId]=','agents','maxToolIterations','baseUrl','getProject','http','Failed\x20to\x20continue\x20chat\x20(chatId:\x20','ms...','/api/knowledge_bases','warn','PATCH','Failed\x20to\x20create\x20chat\x20after\x20','GET','httpClient','/api/chats?','1549440NMnDEf','site','/api/chats/','next','/api/prompts/','request','3753959jVVyri','4294425dvicXi','Message\x20cannot\x20be\x20empty\x20or\x20whitespace\x20only','4436VLQYaT','text/event-stream','knowledge_bases','data','&page[limit]=50','continueChat','push','LLM_CHAT_CREATION_FAILURE','listAgentsFull','debug','131643OEiQnA','apiKey','listIntegrations',']\x20Streaming\x20SSE\x20stream\x20for\x20chatId:\x20','trim','/api/agents','application/json',',\x20message\x20length:\x20','/api/projects','createIntegration','authHeaders','/history','/api/integrations','page[limit]','listProjects','\x20with\x20message\x20size:\x20','/api/chats','getChatHistory','/api/knowledge_bases/','links','toString','starterMessage','updateAgentFull','systemPrompt','/api/prompts','1030WVeSzN','updateAgent','prompts','length','append','/api/agents/','search','sort','listChats','logger','/api/projects/','72RakTga','4rPbUhe','LLM_STREAM_ERROR','name','/api/users/current_settings','paginateAll','application/vnd.api+json','status','/api/prompts?filter[projectId]=','-last_conversation_at','getChatInfo','78EbzbQi','updateKnowledgeBase','createPrompt','modelType','createProject','prompt','pathname','agentId','Please\x20provide\x20a\x20non-empty\x20message\x20to\x20continue\x20the\x20chat.','\x20characters','358946yKkBrk','60825riaerY','integrations'];a6_0x1754=function(){return _0x109eaf;};return a6_0x1754();}import{ErrorCode,SDKError}from'../sdk/errors.js';export class LLMApiClient{[a6_0x5b6c5b(0xbd)];['baseUrl'];[a6_0x5b6c5b(0xdc)];[a6_0x5b6c5b(0xf4)];constructor(_0x527342,_0xc1a0d8){const _0x2bfcc3=a6_0x5b6c5b;this[_0x2bfcc3(0xb3)]=getEndpoint(_0x527342['site'],_0x2bfcc3(0x10f)),this[_0x2bfcc3(0xdc)]=toHeaderRecord(getAuthHeaders(_0x527342[_0x2bfcc3(0xc0)],_0x527342[_0x2bfcc3(0xd3)])),this[_0x2bfcc3(0xf4)]=_0xc1a0d8,this['httpClient']=new HTTPClient(this['baseUrl'],this[_0x2bfcc3(0xdc)],_0xc1a0d8);}async['paginateAll'](_0x2fd90a){const _0x818d6=a6_0x5b6c5b,_0x830138=[];let _0x31070b=_0x2fd90a;while(_0x31070b){const _0x4423cc=await this[_0x818d6(0xbd)]['request']('GET',_0x31070b);_0x4423cc[_0x818d6(0xcb)]&&_0x830138[_0x818d6(0xce)](..._0x4423cc[_0x818d6(0xcb)]);_0x31070b=_0x4423cc[_0x818d6(0xe5)]?.[_0x818d6(0xc2)];if(_0x31070b&&_0x31070b[_0x818d6(0x119)](_0x818d6(0xb5))){const _0x2ac4b2=new URL(_0x31070b);_0x31070b=_0x2ac4b2[_0x818d6(0x107)]+_0x2ac4b2[_0x818d6(0xf1)];}}return _0x830138;}async[a6_0x5b6c5b(0x116)](){const _0x2772a5=a6_0x5b6c5b;return await this[_0x2772a5(0xbd)][_0x2772a5(0xc4)](_0x2772a5(0xbc),_0x2772a5(0xfa));}async[a6_0x5b6c5b(0x105)](_0x4e3bbd){const _0x41a278=a6_0x5b6c5b,_0x48d8ad={'data':{'type':_0x41a278(0x110),'attributes':{'name':_0x4e3bbd[_0x41a278(0xf9)],..._0x4e3bbd[_0x41a278(0x11f)]&&{'description':_0x4e3bbd[_0x41a278(0x11f)]}}}},_0xbb8126=await this[_0x41a278(0xbd)][_0x41a278(0xc4)](_0x41a278(0x11b),_0x41a278(0xda),{'headers':{'Content-Type':_0x41a278(0xfc),'Accept':_0x41a278(0xfc)},'body':_0x48d8ad});return _0xbb8126[_0x41a278(0xcb)];}async[a6_0x5b6c5b(0x112)](_0x4a51a2){const _0x166d08=a6_0x5b6c5b,_0x4fe0ca=_0x166d08(0xf5)+encodeURIComponent(_0x4a51a2);await this[_0x166d08(0xbd)][_0x166d08(0xc4)](_0x166d08(0x115),_0x4fe0ca);}async[a6_0x5b6c5b(0xe0)](_0x3c4116=0x32){return this['paginateAll']('/api/projects?page[limit]='+_0x3c4116);}async[a6_0x5b6c5b(0x117)](_0x306ca1){const _0x49e324=a6_0x5b6c5b;let _0x1a8659=_0x49e324(0xd7);_0x306ca1&&(_0x1a8659+='?filter[project_id]='+encodeURIComponent(_0x306ca1));const _0x49f337=await this[_0x49e324(0xbd)]['request'](_0x49e324(0xbc),_0x1a8659);return _0x49f337[_0x49e324(0xcb)]||[];}async['getAgent'](_0x4f2c19){const _0x4a9293=a6_0x5b6c5b,_0x195eaa=_0x4a9293(0xf0)+encodeURIComponent(_0x4f2c19),_0x232b6f=await this[_0x4a9293(0xbd)][_0x4a9293(0xc4)](_0x4a9293(0xbc),_0x195eaa);return _0x232b6f[_0x4a9293(0xcb)];}async['createAgent'](_0x517622){const _0x3ec3a6=a6_0x5b6c5b,_0x15721f={'name':_0x517622['name'],'projectId':_0x517622['projectId'],'modelType':_0x517622[_0x3ec3a6(0x104)],'maxToolIterations':_0x517622[_0x3ec3a6(0x122)]??0x4,'temperature':_0x517622[_0x3ec3a6(0x11d)]??0.7};_0x517622[_0x3ec3a6(0xe9)]!==undefined&&(_0x15721f[_0x3ec3a6(0xe9)]=_0x517622['systemPrompt']);_0x517622[_0x3ec3a6(0xe7)]&&(_0x15721f[_0x3ec3a6(0xe7)]=_0x517622[_0x3ec3a6(0xe7)]);_0x517622[_0x3ec3a6(0x10e)]&&(_0x15721f[_0x3ec3a6(0x10e)]=_0x517622[_0x3ec3a6(0x10e)]);const _0x2f0272={'data':{'type':'agents','attributes':_0x15721f}},_0x23b01b=await this[_0x3ec3a6(0xbd)]['request'](_0x3ec3a6(0x11b),_0x3ec3a6(0xd7),{'headers':{'Content-Type':_0x3ec3a6(0xfc),'Accept':_0x3ec3a6(0xfc)},'body':_0x2f0272});return _0x23b01b[_0x3ec3a6(0xcb)];}async[a6_0x5b6c5b(0xec)](_0x5ed1bc,_0xd1e88a){const _0x8e39e8=a6_0x5b6c5b,_0x16a95a={'data':{'type':_0x8e39e8(0x121),'id':_0x5ed1bc,'attributes':{..._0xd1e88a[_0x8e39e8(0xf9)]&&{'name':_0xd1e88a[_0x8e39e8(0xf9)]},..._0xd1e88a[_0x8e39e8(0x11f)]&&{'description':_0xd1e88a[_0x8e39e8(0x11f)]},..._0xd1e88a[_0x8e39e8(0x106)]&&{'prompt':_0xd1e88a[_0x8e39e8(0x106)]},..._0xd1e88a[_0x8e39e8(0xe7)]&&{'starter_message':_0xd1e88a['starterMessage']},..._0xd1e88a[_0x8e39e8(0x10e)]&&{'reasoningEffort':_0xd1e88a[_0x8e39e8(0x10e)]}}}},_0x1135b6=_0x8e39e8(0xf0)+encodeURIComponent(_0x5ed1bc),_0x3cdae5=await this['httpClient'][_0x8e39e8(0xc4)](_0x8e39e8(0xba),_0x1135b6,{'body':_0x16a95a});return _0x3cdae5['data'];}async['deleteAgent'](_0x24d265){const _0x1dd1f8=a6_0x5b6c5b,_0x2d2491=_0x1dd1f8(0xf0)+encodeURIComponent(_0x24d265);await this[_0x1dd1f8(0xbd)]['request'](_0x1dd1f8(0x115),_0x2d2491);}async[a6_0x5b6c5b(0xf3)](_0x5aa3db=0x32){const _0x73daf3=a6_0x5b6c5b,_0x52befe=new URLSearchParams();_0x52befe[_0x73daf3(0xef)](_0x73daf3(0xdf),String(_0x5aa3db)),_0x52befe['append'](_0x73daf3(0xf2),_0x73daf3(0xff));const _0x42bb68=_0x73daf3(0xbe)+_0x52befe[_0x73daf3(0xe6)](),_0x3a6a26=await this[_0x73daf3(0xbd)]['request'](_0x73daf3(0xbc),_0x42bb68);return _0x3a6a26[_0x73daf3(0xcb)]||[];}async[a6_0x5b6c5b(0x100)](_0x458067){const _0x6b83d2=a6_0x5b6c5b,_0x3c07a8=_0x6b83d2(0xc1)+encodeURIComponent(_0x458067),_0x826ca8=await this['httpClient'][_0x6b83d2(0xc4)](_0x6b83d2(0xbc),_0x3c07a8);return _0x826ca8['data'];}async[a6_0x5b6c5b(0xe3)](_0x192fd3){const _0x120920=a6_0x5b6c5b,_0x19b773=_0x120920(0xc1)+encodeURIComponent(_0x192fd3)+_0x120920(0xdd);return await this[_0x120920(0xbd)]['request'](_0x120920(0xbc),_0x19b773);}async[a6_0x5b6c5b(0x113)](_0x299f4f){const _0x38ca68=a6_0x5b6c5b,_0x13b498={'data':{'type':_0x38ca68(0x111),'attributes':{'agentId':_0x299f4f[_0x38ca68(0x108)]}}},_0x26b9be=0x3,_0x3b45a3=[0x3e8,0x7d0,0xfa0];for(let _0x2e3e0a=0x0;_0x2e3e0a<=_0x26b9be;_0x2e3e0a++){const _0x434622=await this['httpClient'][_0x38ca68(0xc4)](_0x38ca68(0x11b),_0x38ca68(0xe2),{'headers':{'Content-Type':_0x38ca68(0xfc),'Accept':_0x38ca68(0xfc)},'body':_0x13b498});if(_0x434622[_0x38ca68(0xcb)]&&_0x434622['data']['id'])return _0x434622['data'];if(_0x2e3e0a>=_0x26b9be)throw new SDKError(ErrorCode[_0x38ca68(0xcf)],_0x38ca68(0xbb)+(_0x26b9be+0x1)+'\x20attempts:\x20API\x20returned\x20empty\x20chat\x20ID');const _0x152e5c=_0x3b45a3[_0x2e3e0a];console[_0x38ca68(0xb9)]('[Retry\x20'+(_0x2e3e0a+0x1)+'/'+_0x26b9be+']\x20Chat\x20creation\x20returned\x20empty\x20ID,\x20retrying\x20in\x20'+_0x152e5c+_0x38ca68(0xb7)),await new Promise(_0x26382b=>setTimeout(_0x26382b,_0x152e5c));}throw new SDKError(ErrorCode[_0x38ca68(0xcf)],'Failed\x20to\x20create\x20chat:\x20unexpected\x20error');}async*[a6_0x5b6c5b(0xcd)](_0x50bb06,_0x520dc5,_0x2e56f9){const _0x583896=a6_0x5b6c5b,_0x52db02=_0x520dc5[_0x583896(0xd6)]();if(!_0x52db02)throw new SDKError(ErrorCode['LLM_EMPTY_MESSAGE'],_0x583896(0xc7),undefined,{'helpText':_0x583896(0x109)});this[_0x583896(0xf4)][_0x583896(0xd1)](_0x583896(0x118)+_0x50bb06+_0x583896(0xe1)+_0x520dc5[_0x583896(0xee)]+_0x583896(0x10a));const _0x4080f5=_0x583896(0xc1)+encodeURIComponent(_0x50bb06)+'/continue',_0x38aed7={'input':_0x520dc5};try{const _0x35c555=await this[_0x583896(0xbd)]['requestSSE'](_0x583896(0x11b),_0x4080f5,{'headers':{'Content-Type':_0x583896(0xd8),'Accept':_0x583896(0xc9)},'body':_0x38aed7,'signal':_0x2e56f9});this['logger'][_0x583896(0xd1)]('['+_0x35c555[_0x583896(0xfd)]+_0x583896(0xd5)+_0x50bb06),yield*parseSSEStream(_0x35c555,this[_0x583896(0xf4)]);}catch(_0x31e11c){throw new SDKError(ErrorCode[_0x583896(0xf8)],_0x583896(0xb6)+_0x50bb06+_0x583896(0xd9)+_0x520dc5[_0x583896(0xee)]+')',_0x31e11c);}}async[a6_0x5b6c5b(0xb4)](_0x22f1d2){const _0x3f2080=a6_0x5b6c5b,_0x33be0d=_0x3f2080(0xf5)+encodeURIComponent(_0x22f1d2),_0x2ec239=await this['httpClient'][_0x3f2080(0xc4)](_0x3f2080(0xbc),_0x33be0d);return _0x2ec239['data'];}async['listKnowledgeBases'](_0x34a15d){const _0x291db6=a6_0x5b6c5b;return this[_0x291db6(0xfb)](_0x291db6(0x120)+encodeURIComponent(_0x34a15d)+_0x291db6(0xcc));}async[a6_0x5b6c5b(0x114)](_0x32cdce){const _0x2cc32f=a6_0x5b6c5b,_0x46a275={'data':{'type':_0x2cc32f(0xca),'attributes':_0x32cdce}},_0x353908=await this[_0x2cc32f(0xbd)][_0x2cc32f(0xc4)]('POST',_0x2cc32f(0xb8),{'headers':{'Content-Type':_0x2cc32f(0xfc),'Accept':_0x2cc32f(0xfc)},'body':_0x46a275});return _0x353908[_0x2cc32f(0xcb)];}async['listPrompts'](_0x18439e){const _0x267abf=a6_0x5b6c5b;return this[_0x267abf(0xfb)](_0x267abf(0xfe)+encodeURIComponent(_0x18439e)+_0x267abf(0xcc));}async[a6_0x5b6c5b(0x103)](_0x589b0b){const _0x24fb46=a6_0x5b6c5b,{jsonSchemaHint:_0x3a643e,..._0x3c9054}=_0x589b0b,_0x58f111={'data':{'type':'prompts','attributes':_0x3c9054}},_0x1ca2a7=await this[_0x24fb46(0xbd)][_0x24fb46(0xc4)](_0x24fb46(0x11b),_0x24fb46(0xea),{'headers':{'Content-Type':_0x24fb46(0xfc),'Accept':'application/vnd.api+json'},'body':_0x58f111});return _0x1ca2a7[_0x24fb46(0xcb)];}async[a6_0x5b6c5b(0xd4)](_0x3c6d03){const _0xca88d1=a6_0x5b6c5b;return this[_0xca88d1(0xfb)]('/api/integrations?filter[projectId]='+encodeURIComponent(_0x3c6d03)+'&page[limit]=50');}async[a6_0x5b6c5b(0xdb)](_0x4f5c76){const _0x474845=a6_0x5b6c5b,_0x50d898={'data':{'type':_0x474845(0x10d),'attributes':_0x4f5c76}},_0x51a843=await this[_0x474845(0xbd)][_0x474845(0xc4)](_0x474845(0x11b),_0x474845(0xde),{'headers':{'Content-Type':_0x474845(0xfc),'Accept':_0x474845(0xfc)},'body':_0x50d898});return _0x51a843[_0x474845(0xcb)];}async[a6_0x5b6c5b(0xd0)](_0xe5a54b){const _0x1dd42f=a6_0x5b6c5b,_0x19c69c=await this['listAgents'](_0xe5a54b),_0xdc1f7a=[];for(const _0x4a91fa of _0x19c69c){const _0x3c5501=_0x1dd42f(0xf0)+encodeURIComponent(_0x4a91fa['id']),_0x46a06c=await this[_0x1dd42f(0xbd)][_0x1dd42f(0xc4)](_0x1dd42f(0xbc),_0x3c5501);_0xdc1f7a[_0x1dd42f(0xce)](_0x46a06c[_0x1dd42f(0xcb)]);}return _0xdc1f7a;}async[a6_0x5b6c5b(0x11c)](_0x5291ac){const _0x51d678=a6_0x5b6c5b,_0x2df2ec={'data':{'type':_0x51d678(0x121),'attributes':_0x5291ac}},_0x5192e8=await this['httpClient'][_0x51d678(0xc4)](_0x51d678(0x11b),_0x51d678(0xd7),{'headers':{'Content-Type':_0x51d678(0xfc),'Accept':_0x51d678(0xfc)},'body':_0x2df2ec});return _0x5192e8[_0x51d678(0xcb)];}async[a6_0x5b6c5b(0xe8)](_0xbce8d8,_0x1935e5){const _0x1e5301=a6_0x5b6c5b,_0x545f99={'data':{'type':_0x1e5301(0x121),'id':_0xbce8d8,'attributes':_0x1935e5}},_0x2699e8=_0x1e5301(0xf0)+encodeURIComponent(_0xbce8d8),_0x3d0c64=await this[_0x1e5301(0xbd)]['request'](_0x1e5301(0xba),_0x2699e8,{'headers':{'Content-Type':_0x1e5301(0xfc),'Accept':_0x1e5301(0xfc)},'body':_0x545f99});return _0x3d0c64[_0x1e5301(0xcb)];}async[a6_0x5b6c5b(0x102)](_0x2a9f28,_0x51fb4e){const _0x212f49=a6_0x5b6c5b,_0x55840d={'data':{'type':_0x212f49(0xca),'id':_0x2a9f28,'attributes':_0x51fb4e}},_0x28c1b9=_0x212f49(0xe4)+encodeURIComponent(_0x2a9f28),_0x19f147=await this[_0x212f49(0xbd)][_0x212f49(0xc4)]('PATCH',_0x28c1b9,{'headers':{'Content-Type':_0x212f49(0xfc),'Accept':_0x212f49(0xfc)},'body':_0x55840d});return _0x19f147[_0x212f49(0xcb)];}async['updatePrompt'](_0x2fb6df,_0x51b835){const _0x3f363a=a6_0x5b6c5b,{jsonSchemaHint:_0x3041f1,..._0x25d557}=_0x51b835,_0x164305={'data':{'type':_0x3f363a(0xed),'id':_0x2fb6df,'attributes':_0x25d557}},_0x5ca3f8=_0x3f363a(0xc3)+encodeURIComponent(_0x2fb6df),_0x34d2a0=await this[_0x3f363a(0xbd)][_0x3f363a(0xc4)](_0x3f363a(0xba),_0x5ca3f8,{'headers':{'Content-Type':_0x3f363a(0xfc),'Accept':_0x3f363a(0xfc)},'body':_0x164305});return _0x34d2a0[_0x3f363a(0xcb)];}async['updateIntegration'](_0x4cfe9b,_0xe4f4c0){const _0x257320=a6_0x5b6c5b,_0x14bab2={'data':{'type':'integrations','id':_0x4cfe9b,'attributes':_0xe4f4c0}},_0x2de8b3=_0x257320(0x11e)+encodeURIComponent(_0x4cfe9b),_0x4fb287=await this[_0x257320(0xbd)][_0x257320(0xc4)]('PATCH',_0x2de8b3,{'headers':{'Content-Type':_0x257320(0xfc),'Accept':'application/vnd.api+json'},'body':_0x14bab2});return _0x4fb287[_0x257320(0xcb)];}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a7_0x4281(){const _0x68d444=['acquire','766870EHZnNq','max','858340tprFEl','getAvailableTokens','refill','reset','tryAcquire','tokens','1800216mapZlc','maxTokens','24nzrjVi','8ViQcbR','floor','171irDBNo','974590hySoDq','lastRefill','ceil','205965CHJLDC','min','refillRate','windowMs','maxRequests','1284168AZOyyJ','now','228447ZkMCKv'];a7_0x4281=function(){return _0x68d444;};return a7_0x4281();}const a7_0x2fcec4=a7_0x57a5;(function(_0x483f52,_0x1ada64){const _0x53a7f7=a7_0x57a5,_0x2749a0=_0x483f52();while(!![]){try{const _0x1749fc=-parseInt(_0x53a7f7(0x1fc))/0x1+parseInt(_0x53a7f7(0x209))/0x2*(-parseInt(_0x53a7f7(0x1f5))/0x3)+-parseInt(_0x53a7f7(0x1fa))/0x4+-parseInt(_0x53a7f7(0x1fe))/0x5+-parseInt(_0x53a7f7(0x206))/0x6+parseInt(_0x53a7f7(0x200))/0x7*(-parseInt(_0x53a7f7(0x208))/0x8)+-parseInt(_0x53a7f7(0x20b))/0x9*(-parseInt(_0x53a7f7(0x20c))/0xa);if(_0x1749fc===_0x1ada64)break;else _0x2749a0['push'](_0x2749a0['shift']());}catch(_0x1986fd){_0x2749a0['push'](_0x2749a0['shift']());}}}(a7_0x4281,0x32606));function a7_0x57a5(_0x21ad80,_0x39221f){_0x21ad80=_0x21ad80-0x1f4;const _0x42819b=a7_0x4281();let _0x57a501=_0x42819b[_0x21ad80];return _0x57a501;}export class RateLimiter{[a7_0x2fcec4(0x205)];[a7_0x2fcec4(0x20d)];[a7_0x2fcec4(0x207)];['refillRate'];constructor(_0x1a71e9){const _0x4c56f3=a7_0x2fcec4;this[_0x4c56f3(0x207)]=_0x1a71e9['maxRequests'],this[_0x4c56f3(0x205)]=_0x1a71e9['maxRequests'],this[_0x4c56f3(0x20d)]=Date[_0x4c56f3(0x1fb)](),this[_0x4c56f3(0x1f7)]=_0x1a71e9[_0x4c56f3(0x1f9)]/_0x1a71e9[_0x4c56f3(0x1f8)];}async[a7_0x2fcec4(0x1fd)](){const _0x5436c7=a7_0x2fcec4;while(!![]){this['refill']();if(this[_0x5436c7(0x205)]>=0x1){this['tokens']-=0x1;return;}const _0x20b88b=Math[_0x5436c7(0x1ff)](0x1,Math[_0x5436c7(0x1f4)](0x1/this['refillRate']));await this['sleep'](_0x20b88b);}}[a7_0x2fcec4(0x204)](){const _0x632179=a7_0x2fcec4;this[_0x632179(0x202)]();if(this[_0x632179(0x205)]>=0x1)return this[_0x632179(0x205)]-=0x1,!![];return![];}[a7_0x2fcec4(0x202)](){const _0x3dfd84=a7_0x2fcec4,_0xafbe77=Date[_0x3dfd84(0x1fb)](),_0x3beeeb=_0xafbe77-this[_0x3dfd84(0x20d)];if(_0x3beeeb>0x0){const _0x2e4034=_0x3beeeb*this['refillRate'];this['tokens']=Math[_0x3dfd84(0x1f6)](this[_0x3dfd84(0x207)],this[_0x3dfd84(0x205)]+_0x2e4034),this[_0x3dfd84(0x20d)]=_0xafbe77;}}[a7_0x2fcec4(0x201)](){const _0x2c561c=a7_0x2fcec4;return this['refill'](),Math[_0x2c561c(0x20a)](this[_0x2c561c(0x205)]);}[a7_0x2fcec4(0x203)](){const _0x1f2dbb=a7_0x2fcec4;this[_0x1f2dbb(0x205)]=this['maxTokens'],this['lastRefill']=Date['now']();}['sleep'](_0x5ab9f7){return new Promise(_0x28b6a4=>setTimeout(_0x28b6a4,_0x5ab9f7));}}export const defaultRateLimiter=new RateLimiter({'maxRequests':0x64,'windowMs':0xea60});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a8_0x503925=a8_0xcf31;(function(_0x47888d,_0x515292){const _0x64403a=a8_0xcf31,_0x286427=_0x47888d();while(!![]){try{const _0x423337=parseInt(_0x64403a(0xad))/0x1+parseInt(_0x64403a(0xc1))/0x2+-parseInt(_0x64403a(0x9f))/0x3+parseInt(_0x64403a(0xa2))/0x4*(parseInt(_0x64403a(0xd6))/0x5)+-parseInt(_0x64403a(0xb3))/0x6+parseInt(_0x64403a(0xa9))/0x7+-parseInt(_0x64403a(0xd3))/0x8;if(_0x423337===_0x515292)break;else _0x286427['push'](_0x286427['shift']());}catch(_0x36f6fa){_0x286427['push'](_0x286427['shift']());}}}(a8_0x1cf5,0xe29f5));import{HTTPClient}from'./http-client.js';import{getEndpoint}from'../types/index.js';import{getAuthHeaders,toHeaderRecord}from'../core/auth.js';function a8_0xcf31(_0x50dc8c,_0x1837e0){_0x50dc8c=_0x50dc8c-0x98;const _0x1cf5fa=a8_0x1cf5();let _0xcf3126=_0x1cf5fa[_0x50dc8c];return _0xcf3126;}export class TDApiClient{[a8_0x503925(0xc2)];[a8_0x503925(0xcb)];constructor(_0x4c1569,_0x1b7d83){const _0x58e11a=a8_0x503925,_0x279ddc=getEndpoint(_0x4c1569['site'],'td');this[_0x58e11a(0xcb)]=toHeaderRecord(getAuthHeaders(_0x4c1569[_0x58e11a(0xb9)],_0x4c1569[_0x58e11a(0xc5)])),this[_0x58e11a(0xc2)]=new HTTPClient(_0x279ddc,this[_0x58e11a(0xcb)],_0x1b7d83);}async[a8_0x503925(0xc4)](){const _0x48ba33=a8_0x503925,_0x34c7ed=await this[_0x48ba33(0xc2)][_0x48ba33(0xb6)]('GET',_0x48ba33(0xc3));return _0x34c7ed['databases'];}async['showDatabase'](_0x72e3b8){const _0x747ae2=a8_0x503925,_0x4a71a6=await this[_0x747ae2(0xc2)]['request'](_0x747ae2(0xcd),_0x747ae2(0xb7)+encodeURIComponent(_0x72e3b8));return _0x4a71a6;}async[a8_0x503925(0xb5)](_0x32f799){const _0x300609=a8_0x503925;await this[_0x300609(0xc2)][_0x300609(0xb6)](_0x300609(0xa6),_0x300609(0xa5)+encodeURIComponent(_0x32f799));}async[a8_0x503925(0xc7)](_0x441c64){const _0x2d380e=a8_0x503925;await this[_0x2d380e(0xc2)][_0x2d380e(0xb6)](_0x2d380e(0xa6),_0x2d380e(0xbe)+encodeURIComponent(_0x441c64));}async['listTables'](_0x67512b){const _0x5a38c2=a8_0x503925,_0x13d38d=await this[_0x5a38c2(0xc2)]['request'](_0x5a38c2(0xcd),_0x5a38c2(0xb4)+encodeURIComponent(_0x67512b));return _0x13d38d[_0x5a38c2(0xcf)];}async[a8_0x503925(0xd5)](_0x56ac1a,_0x3bc1cb){const _0x3cd3cc=a8_0x503925,_0x23ea63=await this['httpClient'][_0x3cd3cc(0xb6)](_0x3cd3cc(0xcd),'/v3/table/show/'+encodeURIComponent(_0x56ac1a)+'/'+encodeURIComponent(_0x3bc1cb));return _0x23ea63;}async[a8_0x503925(0xc8)](_0x864e74,_0x4f385e){const _0x53d64d=a8_0x503925;await this[_0x53d64d(0xc2)][_0x53d64d(0xb6)](_0x53d64d(0xa6),_0x53d64d(0x9d)+encodeURIComponent(_0x864e74)+'/'+encodeURIComponent(_0x4f385e));}async[a8_0x503925(0xce)](_0x304789,_0xb70357){const _0x4113c1=a8_0x503925;await this['httpClient']['request'](_0x4113c1(0xa6),_0x4113c1(0xa0)+encodeURIComponent(_0x304789)+'/'+encodeURIComponent(_0xb70357));}async[a8_0x503925(0xd7)](_0x1e7e03,_0x108e0b){const _0x30c49c=a8_0x503925,_0x52bbb0=await this[_0x30c49c(0xc2)][_0x30c49c(0xb6)](_0x30c49c(0xa6),_0x30c49c(0xab)+encodeURIComponent(_0x1e7e03),{'body':{'query':_0x108e0b}});return _0x52bbb0;}async[a8_0x503925(0xa3)](_0x3e46d2,_0x379872){const _0x5f54cf=a8_0x503925,_0x390f90=await this[_0x5f54cf(0xc2)][_0x5f54cf(0xb6)]('POST',_0x5f54cf(0xcc)+encodeURIComponent(_0x3e46d2),{'body':{'query':_0x379872}});return _0x390f90;}async[a8_0x503925(0xb1)](_0x2ed908){const _0x2f1811=a8_0x503925,_0x2f1285=new URLSearchParams();if(_0x2ed908?.[_0x2f1811(0xa1)]!==undefined)_0x2f1285[_0x2f1811(0xbf)](_0x2f1811(0xa1),_0x2ed908['from'][_0x2f1811(0xac)]());if(_0x2ed908?.['to']!==undefined)_0x2f1285[_0x2f1811(0xbf)]('to',_0x2ed908['to'][_0x2f1811(0xac)]());if(_0x2ed908?.[_0x2f1811(0xca)])_0x2f1285[_0x2f1811(0xbf)]('status',_0x2ed908['status']);const _0x467d5f=_0x2f1285['toString'](),_0xf4b9e3=_0x467d5f?_0x2f1811(0xba)+_0x467d5f:_0x2f1811(0x99),_0x493e8b=await this[_0x2f1811(0xc2)][_0x2f1811(0xb6)]('GET',_0xf4b9e3);return _0x493e8b['jobs'];}async['showJob'](_0x118027){const _0x288a59=a8_0x503925,_0x3076dc=await this['httpClient'][_0x288a59(0xb6)](_0x288a59(0xcd),_0x288a59(0x9a)+encodeURIComponent(_0x118027));return _0x3076dc;}async[a8_0x503925(0xd2)](_0x6e0ef7){const _0x3a36e9=a8_0x503925;await this[_0x3a36e9(0xc2)][_0x3a36e9(0xb6)]('POST','/v3/job/kill/'+encodeURIComponent(_0x6e0ef7));}async[a8_0x503925(0xd1)](){const _0x1f27bd=a8_0x503925,_0x5210a9=await this[_0x1f27bd(0xc2)][_0x1f27bd(0xb6)]('GET',_0x1f27bd(0xae)),_0x54387f=parseInt(_0x5210a9['id'],0xa),_0x3328c8=parseInt(_0x5210a9[_0x1f27bd(0xaa)],0xa);return{..._0x5210a9,'id':Number[_0x1f27bd(0xc6)](_0x54387f)?0x0:_0x54387f,'account_id':Number[_0x1f27bd(0xc6)](_0x3328c8)?undefined:_0x3328c8};}async[a8_0x503925(0xc9)](){const _0x4b1ff2=a8_0x503925,_0x562e66=await this[_0x4b1ff2(0xc2)]['request'](_0x4b1ff2(0xcd),_0x4b1ff2(0xb0));return _0x562e66['users'];}async['getJobResult'](_0x46d3f8){const _0x5b9c0e=a8_0x503925,_0x15ecca=await this[_0x5b9c0e(0xc2)]['request']('GET',_0x5b9c0e(0x9e)+encodeURIComponent(_0x46d3f8)+'?header=true',{'headers':{'Accept':_0x5b9c0e(0xb2)},'responseType':_0x5b9c0e(0xa4)});if(typeof _0x15ecca===_0x5b9c0e(0xd4)){const _0xf8dfb4=_0x15ecca[_0x5b9c0e(0xbc)]('\x0a')['filter'](_0x863df6=>_0x863df6[_0x5b9c0e(0xbd)]());if(_0xf8dfb4[_0x5b9c0e(0xb8)]===0x0)return[];let _0x273265;try{_0x273265=JSON[_0x5b9c0e(0xbb)](_0xf8dfb4[0x0]);}catch(_0x2b9787){return console[_0x5b9c0e(0xd0)](_0x5b9c0e(0xaf)+(_0x2b9787 instanceof Error?_0x2b9787['message']:String(_0x2b9787))),[];}const _0x5a724a=[];for(let _0x4e0bc9=0x1;_0x4e0bc9<_0xf8dfb4[_0x5b9c0e(0xb8)];_0x4e0bc9++){const _0x2216ef=_0xf8dfb4[_0x4e0bc9][_0x5b9c0e(0xbd)]();if(!_0x2216ef)continue;try{const _0x5a2bfb=JSON[_0x5b9c0e(0xbb)](_0x2216ef),_0x50458c={};_0x273265[_0x5b9c0e(0x9b)]((_0x15f00d,_0x6e680a)=>{_0x50458c[_0x15f00d]=_0x5a2bfb[_0x6e680a];}),_0x5a724a[_0x5b9c0e(0x98)](_0x50458c);}catch(_0x41963c){console['warn'](_0x5b9c0e(0xa7)+(_0x4e0bc9+0x1)+':\x20'+(_0x41963c instanceof Error?_0x41963c['message']:String(_0x41963c)));}}return _0x5a724a;}return[];}async[a8_0x503925(0x9c)](){const _0x545fca=a8_0x503925;return await this['httpClient'][_0x545fca(0xb6)](_0x545fca(0xcd),_0x545fca(0xa8));}async['getConnection'](_0x151339){const _0x10702c=a8_0x503925;return await this['httpClient']['request'](_0x10702c(0xcd),_0x10702c(0xc0)+_0x151339);}}export function createTDApiClient(_0x4f834f,_0x2479b0){return new TDApiClient(_0x4f834f,_0x2479b0);}function a8_0x1cf5(){const _0x3ef73e=['isNaN','deleteDatabase','createTable','listUsers','status','authHeaders','/v3/job/issue/presto/','GET','deleteTable','tables','warn','getUserInfo','cancelJob','1729688jbOneM','string','showTable','5sIgfEb','submitHiveJob','push','/v3/job/list','/v3/job/show/','forEach','listConnections','/v3/table/create/','/v3/job/result/','2323491ceqKmX','/v3/table/delete/','from','106184MrZDfP','submitPrestoJob','text','/v3/database/create/','POST','Failed\x20to\x20parse\x20NDJSON\x20line\x20','/v4/connectors','4077381LNKbEr','account_id','/v3/job/issue/hive/','toString','1454495fOxYCJ','/v4/users/current','Failed\x20to\x20parse\x20column\x20names:\x20','/v3/user/list','listJobs','application/json','5228298noOrnT','/v3/table/list/','createDatabase','request','/v3/database/show/','length','site','/v3/job/list?','parse','split','trim','/v3/database/delete/','append','/v4/connectors/','1453624EKUDIa','httpClient','/v3/database/list','listDatabases','apiKey'];a8_0x1cf5=function(){return _0x3ef73e;};return a8_0x1cf5();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a9_0x1e89cd=a9_0x1f01;(function(_0x36c008,_0x2ea89b){const _0x10d2c5=a9_0x1f01,_0x1a8b9c=_0x36c008();while(!![]){try{const _0x3196a4=parseInt(_0x10d2c5(0x213))/0x1*(-parseInt(_0x10d2c5(0x217))/0x2)+parseInt(_0x10d2c5(0x20e))/0x3+parseInt(_0x10d2c5(0x1db))/0x4*(parseInt(_0x10d2c5(0x1e7))/0x5)+-parseInt(_0x10d2c5(0x20b))/0x6+-parseInt(_0x10d2c5(0x1ee))/0x7*(parseInt(_0x10d2c5(0x1ef))/0x8)+parseInt(_0x10d2c5(0x1e6))/0x9*(-parseInt(_0x10d2c5(0x21b))/0xa)+parseInt(_0x10d2c5(0x21e))/0xb*(parseInt(_0x10d2c5(0x1fb))/0xc);if(_0x3196a4===_0x2ea89b)break;else _0x1a8b9c['push'](_0x1a8b9c['shift']());}catch(_0x373783){_0x1a8b9c['push'](_0x1a8b9c['shift']());}}}(a9_0x5e52,0x18e6f));import{HTTPClient}from'./http-client.js';import{getEndpoint}from'../types/index.js';function a9_0x5e52(){const _0x332712=['min',']\x20Query\x20ID:\x20','padStart','executeQuery','ALREADY_EXISTS','isTTY','split','TRINO_INSUFFICIENT_RESOURCES','dim','X-Trino-Schema','412uIeiRh','apiKey','[query]','PERMISSION_DENIED','completedSplits','text/plain','join','forEach','max','x-td-jobid','X-TD-JobId','8199BixmEs','1010LyJdEJ','repeat','TRINO_NOT_FOUND','INTERNAL','toLocaleString','Invalid\x20nextUri\x20format:\x20','Warning:\x20Large\x20result\x20set\x20(','2051kJFYZv','3992gQihDB','TRINO_USER_CANCELLED','map','processedRows','error','Query\x20cancelled\x20by\x20user','site','errorName','Failed\x20to\x20cancel\x20query:','errorType','columns','errorLocation','6213912IoHvdt','convertRowsToObjects','warn','httpClient','cancelQuery','push','length','red','message','jobId','state','X-Trino-Catalog','INTERNAL_ERROR','TRINO_SYNTAX_ERROR','streamResults','pathname','845484jprcHf','request','nextUri','316512SqUVSP','TRINO_INVALID_ARGUMENT','EXTERNAL','stdout','stats','32471ROILKp','warnings','/v1/statement','TRINO_INTERNAL_ERROR','6XdGEBY','checkResponseError','name','totalSplits','1730CGaTgW','USER_ERROR','data','11QcdzhF'];a9_0x5e52=function(){return _0x332712;};return a9_0x5e52();}import{getTrinoHeaders}from'../core/auth.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{Chalk}from'chalk';export class TrinoApiClient{[a9_0x1e89cd(0x1fe)];constructor(_0x2e613a,_0x26a35b){const _0x58773c=a9_0x1e89cd,_0x302278=getEndpoint(_0x2e613a[_0x58773c(0x1f5)],'trino'),_0x5933d2=getTrinoHeaders(_0x2e613a['site'],_0x2e613a[_0x58773c(0x1dc)]);this[_0x58773c(0x1fe)]=new HTTPClient(_0x302278,_0x5933d2,_0x26a35b);}async[a9_0x1e89cd(0x222)](_0x228807,_0x4c8f32={}){const _0x47c87a=a9_0x1e89cd,{catalog:_0x2d164d,schema:_0x26af38,timeout:_0x2d86e8,signal:_0x5de539,onJobId:_0x558485,onProgress:_0x1ee306}=_0x4c8f32,_0x11c2e0={'Content-Type':_0x47c87a(0x1e0)};(_0x2d164d||_0x26af38)&&(_0x11c2e0[_0x47c87a(0x206)]=_0x2d164d||'td');_0x26af38&&(_0x11c2e0[_0x47c87a(0x1da)]=_0x26af38);const _0x35cf05=await this[_0x47c87a(0x1fe)][_0x47c87a(0x20c)]('POST',_0x47c87a(0x215),{'headers':_0x11c2e0,'body':_0x228807,'timeout':_0x2d86e8,'signal':_0x5de539,'includeHeaders':!![]}),_0xe9dbb=_0x35cf05[_0x47c87a(0x21d)],_0x51f1fe=_0x35cf05['headers'],_0x545bb5=_0x51f1fe[_0x47c87a(0x1e4)]||_0x51f1fe[_0x47c87a(0x1e5)];_0x545bb5&&_0x558485&&_0x558485(_0x545bb5);this[_0x47c87a(0x218)](_0xe9dbb,_0xe9dbb['id'],_0x228807);const _0x58c6be=await this['streamResults'](_0xe9dbb,_0x228807,_0x5de539,_0x1ee306);return _0x545bb5&&(_0x58c6be[_0x47c87a(0x204)]=_0x545bb5),_0x58c6be;}async[a9_0x1e89cd(0x209)](_0x2062d2,_0x4b17aa,_0x425985,_0x355cb8){const _0x5de7c3=a9_0x1e89cd,_0x1fa5b1=_0x2062d2['id'];let _0x4b19b8=[];const _0x1ced42=[],_0x1543ca=[];let _0x286b4b=_0x2062d2;const _0x1a03ce=0x186a0;_0x286b4b[_0x5de7c3(0x1f9)]&&(_0x4b19b8=_0x286b4b[_0x5de7c3(0x1f9)]);_0x286b4b[_0x5de7c3(0x21d)]&&_0x1ced42['push'](..._0x286b4b[_0x5de7c3(0x21d)]);_0x286b4b[_0x5de7c3(0x214)]&&_0x1543ca[_0x5de7c3(0x200)](..._0x286b4b[_0x5de7c3(0x214)]);_0x355cb8&&_0x286b4b[_0x5de7c3(0x212)]&&_0x355cb8({'state':_0x286b4b[_0x5de7c3(0x212)][_0x5de7c3(0x205)],'processedRows':_0x286b4b['stats'][_0x5de7c3(0x1f2)],'completedSplits':_0x286b4b[_0x5de7c3(0x212)][_0x5de7c3(0x1df)],'totalSplits':_0x286b4b[_0x5de7c3(0x212)][_0x5de7c3(0x21a)]});while(_0x286b4b[_0x5de7c3(0x20d)]){if(_0x425985?.['aborted']){await this[_0x5de7c3(0x1ff)](_0x286b4b[_0x5de7c3(0x20d)]);throw new Error(_0x5de7c3(0x1f4));}let _0x50636d;try{_0x50636d=new URL(_0x286b4b['nextUri'])[_0x5de7c3(0x20a)];}catch{throw new Error(_0x5de7c3(0x1ec)+_0x286b4b['nextUri']);}_0x286b4b=await this['httpClient'][_0x5de7c3(0x20c)]('GET',_0x50636d,{'signal':_0x425985}),this[_0x5de7c3(0x218)](_0x286b4b,_0x1fa5b1,_0x4b17aa),_0x286b4b['columns']&&_0x4b19b8[_0x5de7c3(0x201)]===0x0&&(_0x4b19b8=_0x286b4b[_0x5de7c3(0x1f9)]),_0x286b4b[_0x5de7c3(0x21d)]&&(_0x1ced42[_0x5de7c3(0x200)](..._0x286b4b[_0x5de7c3(0x21d)]),_0x1ced42[_0x5de7c3(0x201)]>_0x1a03ce&&_0x1ced42[_0x5de7c3(0x201)]%0xc350===0x0&&console['warn'](_0x5de7c3(0x1ed)+_0x1ced42[_0x5de7c3(0x201)][_0x5de7c3(0x1eb)]()+'\x20rows)\x20-\x20'+'consider\x20adding\x20LIMIT\x20clause')),_0x286b4b[_0x5de7c3(0x214)]&&_0x1543ca[_0x5de7c3(0x200)](..._0x286b4b[_0x5de7c3(0x214)]),_0x355cb8&&_0x286b4b[_0x5de7c3(0x212)]&&_0x355cb8({'state':_0x286b4b[_0x5de7c3(0x212)][_0x5de7c3(0x205)],'processedRows':_0x286b4b[_0x5de7c3(0x212)][_0x5de7c3(0x1f2)],'completedSplits':_0x286b4b[_0x5de7c3(0x212)][_0x5de7c3(0x1df)],'totalSplits':_0x286b4b[_0x5de7c3(0x212)][_0x5de7c3(0x21a)]});}const _0x3c318c=this[_0x5de7c3(0x1fc)](_0x4b19b8,_0x1ced42);return{'queryId':_0x1fa5b1,'columns':_0x4b19b8,'data':_0x3c318c,'stats':_0x286b4b['stats'],'warnings':_0x1543ca[_0x5de7c3(0x201)]>0x0?_0x1543ca:undefined};}[a9_0x1e89cd(0x218)](_0x582b09,_0x5ee07e,_0xca7f8c){const _0x302abe=a9_0x1e89cd;if(!_0x582b09[_0x302abe(0x1f3)])return;const _0x4ccdd2=_0x582b09[_0x302abe(0x1f3)],_0x4a20d2=mapTrinoErrorToErrorCode(_0x4ccdd2),_0x2eb67c=process[_0x302abe(0x211)][_0x302abe(0x1d6)]?new Chalk({'level':0x3}):new Chalk({'level':0x0}),_0x209113='['+_0x4ccdd2[_0x302abe(0x1f6)]+_0x302abe(0x220)+_0x5ee07e;let _0x47f850=_0x2eb67c[_0x302abe(0x202)](_0x209113+'\x0a'+_0x4ccdd2[_0x302abe(0x203)]);if(_0xca7f8c&&_0x4ccdd2[_0x302abe(0x1fa)]){const {lineNumber:_0x3048a8,columnNumber:_0xde7035}=_0x4ccdd2['errorLocation'];_0x47f850+='\x0a\x0a'+_0x2eb67c[_0x302abe(0x1d9)](_0x302abe(0x1dd))+'\x0a'+formatSqlErrorContext(_0xca7f8c,_0x3048a8,_0xde7035);}throw new SDKError(_0x4a20d2,_0x47f850,_0x4ccdd2);}[a9_0x1e89cd(0x1fc)](_0x1d7b9c,_0x577bd){const _0x4dedc3=a9_0x1e89cd;if(_0x1d7b9c['length']===0x0)return _0x577bd;return _0x577bd[_0x4dedc3(0x1f1)](_0x298c3a=>{const _0x464ae=_0x4dedc3,_0x261ba1={};return _0x1d7b9c[_0x464ae(0x1e2)]((_0x199610,_0x465652)=>{const _0x62ba54=_0x464ae;_0x261ba1[_0x199610[_0x62ba54(0x219)]]=_0x298c3a[_0x465652];}),_0x261ba1;});}async['cancelQuery'](_0x1147a6){const _0x81b00a=a9_0x1e89cd;try{const _0x50663d=new URL(_0x1147a6)[_0x81b00a(0x20a)];await this['httpClient'][_0x81b00a(0x20c)]('DELETE',_0x50663d);}catch(_0x4e8890){console[_0x81b00a(0x1fd)](_0x81b00a(0x1f7),_0x4e8890);}}}function formatSqlErrorContext(_0x24b428,_0x4836fb,_0x50ab9f){const _0x54e19d=a9_0x1e89cd,_0x44d774=_0x24b428[_0x54e19d(0x1d7)]('\x0a');if(_0x4836fb<0x1||_0x4836fb>_0x44d774[_0x54e19d(0x201)])return _0x24b428;const _0xce70e5=_0x4836fb-0x1,_0x31d3b3=Math[_0x54e19d(0x1e3)](0x0,_0xce70e5-0x2),_0x27dc36=Math[_0x54e19d(0x21f)](_0x44d774[_0x54e19d(0x201)],_0xce70e5+0x3),_0xdf6f44=[],_0xed80b1=process[_0x54e19d(0x211)][_0x54e19d(0x1d6)]?new Chalk({'level':0x3}):new Chalk({'level':0x0});for(let _0x31c321=_0x31d3b3;_0x31c321<_0x27dc36;_0x31c321++){const _0x31a190=_0x31c321===_0xce70e5?'>\x20':'\x20\x20',_0x81892f=String(_0x31c321+0x1)[_0x54e19d(0x221)](0x3,'\x20'),_0x3cd187=_0xed80b1[_0x54e19d(0x1d9)](''+_0x31a190+_0x81892f+'\x20|');_0xdf6f44[_0x54e19d(0x200)](_0x3cd187+'\x20'+_0x44d774[_0x31c321]);if(_0x31c321===_0xce70e5){const _0x22ae54=0x8+(_0x50ab9f-0x1);_0xdf6f44[_0x54e19d(0x200)]('\x20'[_0x54e19d(0x1e8)](_0x22ae54)+'^');}}return _0xdf6f44[_0x54e19d(0x1e1)]('\x0a');}function a9_0x1f01(_0xe090aa,_0x44ccf6){_0xe090aa=_0xe090aa-0x1d5;const _0x5e5246=a9_0x5e52();let _0x1f01ec=_0x5e5246[_0xe090aa];return _0x1f01ec;}function mapTrinoErrorToErrorCode(_0x3b71ab){const _0xb2efcf=a9_0x1e89cd,_0x3e07fe=_0x3b71ab[_0xb2efcf(0x1f8)],_0x4737e9=_0x3b71ab['errorCode'];if(_0x3e07fe===_0xb2efcf(0x21c))switch(_0x4737e9){case 0x1:return ErrorCode[_0xb2efcf(0x208)];case 0x3:return ErrorCode[_0xb2efcf(0x1f0)];case 0x4:return ErrorCode[_0xb2efcf(0x1de)];case 0x5:case 0x2c:case 0x2d:case 0x2e:case 0x2f:return ErrorCode[_0xb2efcf(0x1e9)];case 0xc:case 0x31:case 0x32:return ErrorCode[_0xb2efcf(0x1d5)];default:return ErrorCode[_0xb2efcf(0x20f)];}else{if(_0x3e07fe===_0xb2efcf(0x207))return ErrorCode[_0xb2efcf(0x216)];else{if(_0x3e07fe==='INSUFFICIENT_RESOURCES')return ErrorCode[_0xb2efcf(0x1d8)];else{if(_0x3e07fe===_0xb2efcf(0x210))return ErrorCode['TRINO_INTERNAL_ERROR'];}}}return ErrorCode[_0xb2efcf(0x1ea)];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a10_0x24bb(_0x12d809,_0x1abd12){_0x12d809=_0x12d809-0x1c4;const _0x8e5e9d=a10_0x8e5e();let _0x24bb2d=_0x8e5e9d[_0x12d809];return _0x24bb2d;}const a10_0x51c04b=a10_0x24bb;(function(_0x2c2a12,_0x503b49){const _0x386261=a10_0x24bb,_0x5504ec=_0x2c2a12();while(!![]){try{const _0xa9bf5e=parseInt(_0x386261(0x207))/0x1+-parseInt(_0x386261(0x219))/0x2+-parseInt(_0x386261(0x21c))/0x3+parseInt(_0x386261(0x1e0))/0x4*(parseInt(_0x386261(0x216))/0x5)+parseInt(_0x386261(0x1d2))/0x6+parseInt(_0x386261(0x1c6))/0x7+-parseInt(_0x386261(0x1e2))/0x8;if(_0xa9bf5e===_0x503b49)break;else _0x5504ec['push'](_0x5504ec['shift']());}catch(_0x36bca6){_0x5504ec['push'](_0x5504ec['shift']());}}}(a10_0x8e5e,0x88257));import{HTTPClient}from'./http-client.js';function a10_0x8e5e(){const _0x8e7fd8=['workflow','/tasks','last_id','killAttempt','listAttempts','limit','include_retried','lastId','to_time','scheduleFrom','append','listSessions','1001423MgvUTT','clear_schedule_all','/logs','projectName','offset','force','/api/workflows?','/archive','allowQueueing','/api/projects?','PUT','tasks','reason','uploadProjectArchive','/api/projects','5cSlUqK','project_name','/files?','869692kZwXYD','workflowId','resume_from','704085MfGVuQ','search_project_name','writeFile','application/gzip','/api/projects/','clearScheduleAll','toString','task','1273832TstkZd','getTaskLogs','revision','workflow_name','workflowName','/api/attempts?','retryAttempt','arraybuffer','/tasks?','authHeaders','/api/workflows','request','6493650hOzsva','/logs?','params','/sessions','getAttempt','listWorkflows','deleteProject','include_subtasks','project','httpClient','/tasks/','getAttemptTasks','clear_schedule','from_task','2282572ibEYQv','clearSchedule','12872968jVGceE','/archive?','/retry','true','readFile','from_time','GET','name_pattern','site','project_id','listLogFiles','downloadProjectArchive','DELETE','attempts','/api/logs/','status','retry_params','replace','/api/attempts/','name','schedule_from','workflows','/files','retryAttemptName','POST'];a10_0x8e5e=function(){return _0x8e7fd8;};return a10_0x8e5e();}import{getEndpoint}from'../types/index.js';import{getAuthHeaders,toHeaderRecord}from'../core/auth.js';import{matchGlobPattern}from'../utils/string-utils.js';export class WorkflowApiClient{['httpClient'];[a10_0x51c04b(0x1cf)];constructor(_0x590d6f,_0x42166a){const _0x16e5c8=a10_0x51c04b,_0x480f0b=getEndpoint(_0x590d6f[_0x16e5c8(0x1ea)],_0x16e5c8(0x1fb));this[_0x16e5c8(0x1cf)]=toHeaderRecord(getAuthHeaders(_0x590d6f['site'],_0x590d6f['apiKey'])),this[_0x16e5c8(0x1db)]=new HTTPClient(_0x480f0b,this[_0x16e5c8(0x1cf)],_0x42166a);}async['listProjects'](_0x42921d){const _0x2e61f4=a10_0x51c04b,_0x5a7dc8=new URLSearchParams();if(_0x42921d?.[_0x2e61f4(0x200)])_0x5a7dc8[_0x2e61f4(0x205)]('limit',String(_0x42921d[_0x2e61f4(0x200)]));if(_0x42921d?.['last_id'])_0x5a7dc8['append']('last_id',_0x42921d[_0x2e61f4(0x1fd)]);if(_0x42921d?.[_0x2e61f4(0x1e9)]){const _0xc3814a=_0x42921d[_0x2e61f4(0x1e9)][_0x2e61f4(0x1f3)](/[*?]/g,'');_0xc3814a&&_0x5a7dc8[_0x2e61f4(0x205)]('name_pattern',_0xc3814a);}const _0x48d17b=_0x5a7dc8[_0x2e61f4(0x1c4)](),_0x3f23cc=_0x48d17b?_0x2e61f4(0x210)+_0x48d17b:_0x2e61f4(0x215),_0x58959a=await this['httpClient']['request'](_0x2e61f4(0x1e8),_0x3f23cc);let _0x3830af=_0x58959a['projects']||[];return _0x42921d?.[_0x2e61f4(0x1e9)]&&(_0x3830af=_0x3830af['filter'](_0x239a82=>{const _0x10a0ed=_0x2e61f4;return matchGlobPattern(_0x239a82[_0x10a0ed(0x1f5)],_0x42921d[_0x10a0ed(0x1e9)]);})),{'data':_0x3830af,'lastId':_0x58959a['lastId']};}async[a10_0x51c04b(0x1d7)](_0x2938e3){const _0x4210be=a10_0x51c04b,_0xa0b066=new URLSearchParams();if(_0x2938e3?.[_0x4210be(0x200)])_0xa0b066['append'](_0x4210be(0x200),String(_0x2938e3[_0x4210be(0x200)]));if(_0x2938e3?.[_0x4210be(0x1fd)])_0xa0b066[_0x4210be(0x205)](_0x4210be(0x1fd),_0x2938e3[_0x4210be(0x1fd)]);if(_0x2938e3?.[_0x4210be(0x217)]){const _0x23a4a9=_0x2938e3[_0x4210be(0x217)][_0x4210be(0x1f3)](/[*?]/g,'');_0x23a4a9&&(_0xa0b066['append'](_0x4210be(0x1e9),_0x23a4a9),_0xa0b066['append'](_0x4210be(0x21d),'true'));}const _0x9efce=_0xa0b066[_0x4210be(0x1c4)](),_0x4c94f4=_0x9efce?_0x4210be(0x20d)+_0x9efce:_0x4210be(0x1d0),_0x2937ec=await this[_0x4210be(0x1db)][_0x4210be(0x1d1)](_0x4210be(0x1e8),_0x4c94f4);let _0x1b161b=_0x2937ec[_0x4210be(0x1f7)]||[];return _0x2938e3?.[_0x4210be(0x217)]&&(_0x1b161b=_0x1b161b['filter'](_0x5be66b=>{const _0x174adf=_0x4210be,_0x559001=_0x5be66b[_0x174adf(0x1da)]?.[_0x174adf(0x1f5)];if(!_0x559001)return![];return matchGlobPattern(_0x559001,_0x2938e3[_0x174adf(0x217)]);})),{'data':_0x1b161b,'lastId':_0x2937ec[_0x4210be(0x202)]};}async[a10_0x51c04b(0x206)](_0x18bdfe){const _0x3cfa83=a10_0x51c04b;let _0x28a4ac='/api/sessions';_0x18bdfe?.[_0x3cfa83(0x1eb)]&&(_0x28a4ac=_0x3cfa83(0x220)+encodeURIComponent(_0x18bdfe[_0x3cfa83(0x1eb)])+_0x3cfa83(0x1d5));const _0x4ad4e0=new URLSearchParams();if(_0x18bdfe?.[_0x3cfa83(0x1c9)])_0x4ad4e0[_0x3cfa83(0x205)](_0x3cfa83(0x1fb),_0x18bdfe[_0x3cfa83(0x1c9)]);if(_0x18bdfe?.[_0x3cfa83(0x1f1)])_0x4ad4e0[_0x3cfa83(0x205)](_0x3cfa83(0x1f1),_0x18bdfe[_0x3cfa83(0x1f1)]);if(_0x18bdfe?.[_0x3cfa83(0x1e7)])_0x4ad4e0[_0x3cfa83(0x205)](_0x3cfa83(0x1e7),_0x18bdfe[_0x3cfa83(0x1e7)]);if(_0x18bdfe?.['to_time'])_0x4ad4e0['append'](_0x3cfa83(0x203),_0x18bdfe[_0x3cfa83(0x203)]);if(_0x18bdfe?.[_0x3cfa83(0x200)])_0x4ad4e0[_0x3cfa83(0x205)]('limit',String(_0x18bdfe[_0x3cfa83(0x200)]));if(_0x18bdfe?.[_0x3cfa83(0x1fd)])_0x4ad4e0[_0x3cfa83(0x205)](_0x3cfa83(0x1fd),_0x18bdfe[_0x3cfa83(0x1fd)]);const _0x41bcfd=_0x4ad4e0[_0x3cfa83(0x1c4)]();_0x41bcfd&&(_0x28a4ac=_0x28a4ac+'?'+_0x41bcfd);const _0x1f1a24=await this['httpClient'][_0x3cfa83(0x1d1)](_0x3cfa83(0x1e8),_0x28a4ac);return{'data':_0x1f1a24['sessions']||[],'lastId':_0x1f1a24[_0x3cfa83(0x202)]};}async[a10_0x51c04b(0x1ff)](_0x11b0ee){const _0x343954=a10_0x51c04b,_0x2d9004=new URLSearchParams();if(_0x11b0ee?.[_0x343954(0x217)])_0x2d9004[_0x343954(0x205)](_0x343954(0x1da),_0x11b0ee[_0x343954(0x217)]);if(_0x11b0ee?.[_0x343954(0x1c9)])_0x2d9004[_0x343954(0x205)](_0x343954(0x1fb),_0x11b0ee[_0x343954(0x1c9)]);if(_0x11b0ee?.[_0x343954(0x201)])_0x2d9004['append'](_0x343954(0x201),'1');if(_0x11b0ee?.[_0x343954(0x200)])_0x2d9004[_0x343954(0x205)](_0x343954(0x200),String(_0x11b0ee[_0x343954(0x200)]));if(_0x11b0ee?.[_0x343954(0x1fd)])_0x2d9004['append'](_0x343954(0x1fd),_0x11b0ee['last_id']);const _0x47ca5c=_0x2d9004[_0x343954(0x1c4)](),_0x2bbffc=_0x47ca5c?_0x343954(0x1cb)+_0x47ca5c:'/api/attempts',_0x13a1c8=await this[_0x343954(0x1db)]['request'](_0x343954(0x1e8),_0x2bbffc);return{'data':_0x13a1c8[_0x343954(0x1ef)]||[],'lastId':_0x13a1c8[_0x343954(0x202)]};}async[a10_0x51c04b(0x1d6)](_0x20b3a5){const _0x4e639e=a10_0x51c04b;return await this[_0x4e639e(0x1db)]['request'](_0x4e639e(0x1e8),'/api/attempts/'+encodeURIComponent(_0x20b3a5));}async[a10_0x51c04b(0x1dd)](_0x4cfc72,_0xa284f=![]){const _0x583f43=a10_0x51c04b,_0x28f254=new URLSearchParams();_0xa284f&&_0x28f254[_0x583f43(0x205)](_0x583f43(0x1d9),_0x583f43(0x1e5));const _0x49b50c=_0x28f254[_0x583f43(0x1c4)](),_0x222c50=_0x49b50c?'/api/attempts/'+encodeURIComponent(_0x4cfc72)+_0x583f43(0x1ce)+_0x49b50c:'/api/attempts/'+encodeURIComponent(_0x4cfc72)+_0x583f43(0x1fc),_0x3e4d5e=await this[_0x583f43(0x1db)][_0x583f43(0x1d1)]('GET',_0x222c50);return _0x3e4d5e[_0x583f43(0x212)]||[];}async[a10_0x51c04b(0x1c7)](_0x34e963,_0xb5a890,_0x566cbe){const _0x538df8=a10_0x51c04b,_0x21d6f5=new URLSearchParams();_0x566cbe?.['offset']!==undefined&&_0x21d6f5[_0x538df8(0x205)](_0x538df8(0x20b),String(_0x566cbe['offset']));_0x566cbe?.[_0x538df8(0x200)]!==undefined&&_0x21d6f5[_0x538df8(0x205)]('limit',String(_0x566cbe[_0x538df8(0x200)]));const _0xbe1670=_0x21d6f5[_0x538df8(0x1c4)](),_0x3cd802=_0xbe1670?_0x538df8(0x1f4)+encodeURIComponent(_0x34e963)+_0x538df8(0x1dc)+encodeURIComponent(_0xb5a890)+_0x538df8(0x1d3)+_0xbe1670:'/api/attempts/'+encodeURIComponent(_0x34e963)+_0x538df8(0x1dc)+encodeURIComponent(_0xb5a890)+_0x538df8(0x209),_0x41dc1b=await this[_0x538df8(0x1db)]['request']('GET',_0x3cd802);return _0x41dc1b['logs']||[];}async[a10_0x51c04b(0x1ec)](_0x53b1f5,_0x3e515f){const _0x290d16=a10_0x51c04b,_0x7a2f96=new URLSearchParams();_0x3e515f&&_0x7a2f96['append'](_0x290d16(0x1c5),_0x3e515f);const _0x35cfb6=_0x7a2f96[_0x290d16(0x1c4)](),_0x5e61ab=_0x35cfb6?_0x290d16(0x1f0)+encodeURIComponent(_0x53b1f5)+_0x290d16(0x218)+_0x35cfb6:_0x290d16(0x1f0)+encodeURIComponent(_0x53b1f5)+_0x290d16(0x1f8),_0x7bd59c=await this[_0x290d16(0x1db)]['request'](_0x290d16(0x1e8),_0x5e61ab);return _0x7bd59c['files']||[];}async[a10_0x51c04b(0x1fe)](_0x4248a9,_0x114877){const _0x2b97a6=a10_0x51c04b,_0x5e71c6={};return _0x114877&&(_0x5e71c6[_0x2b97a6(0x213)]=_0x114877),await this['httpClient'][_0x2b97a6(0x1d1)]('POST',_0x2b97a6(0x1f4)+encodeURIComponent(_0x4248a9)+'/kill',{'body':_0x5e71c6});}async['retrySession'](_0x4c14d9,_0x1b3611){const _0x3aa542=a10_0x51c04b,_0xcfddcc={};return _0x1b3611?.['from_task']&&(_0xcfddcc[_0x3aa542(0x1df)]=_0x1b3611[_0x3aa542(0x1df)]),_0x1b3611?.[_0x3aa542(0x1f2)]&&(_0xcfddcc[_0x3aa542(0x1f2)]=_0x1b3611['retry_params']),await this[_0x3aa542(0x1db)][_0x3aa542(0x1d1)]('POST','/api/sessions/'+encodeURIComponent(_0x4c14d9)+_0x3aa542(0x1e4),{'body':_0xcfddcc});}async[a10_0x51c04b(0x1cc)](_0x4a7202,_0x4f7434){const _0x23b55f=a10_0x51c04b,_0x2d0bce={};return _0x4f7434?.['resume_from']&&(_0x2d0bce['resume_from']=_0x4f7434[_0x23b55f(0x21b)]),_0x4f7434?.['retry_params']&&(_0x2d0bce['retry_params']=_0x4f7434['retry_params']),_0x4f7434?.[_0x23b55f(0x20c)]&&(_0x2d0bce['force']=_0x4f7434[_0x23b55f(0x20c)]),await this['httpClient']['request'](_0x23b55f(0x1fa),'/api/attempts/'+encodeURIComponent(_0x4a7202)+_0x23b55f(0x1e4),{'body':_0x2d0bce});}async['startAttempt'](_0x2a6937){const _0x20ef2c=a10_0x51c04b,_0x4578e0={'sessionTime':_0x2a6937['sessionTime'],'params':_0x2a6937[_0x20ef2c(0x1d4)]};return _0x2a6937[_0x20ef2c(0x21a)]&&(_0x4578e0[_0x20ef2c(0x21a)]=_0x2a6937[_0x20ef2c(0x21a)]),_0x2a6937['projectName']&&(_0x4578e0['projectName']=_0x2a6937[_0x20ef2c(0x20a)]),_0x2a6937[_0x20ef2c(0x1ca)]&&(_0x4578e0[_0x20ef2c(0x1ca)]=_0x2a6937['workflowName']),_0x2a6937['retryAttemptName']&&(_0x4578e0[_0x20ef2c(0x1f9)]=_0x2a6937['retryAttemptName']),_0x2a6937[_0x20ef2c(0x20f)]!==undefined&&(_0x4578e0[_0x20ef2c(0x20f)]=_0x2a6937[_0x20ef2c(0x20f)]),await this[_0x20ef2c(0x1db)][_0x20ef2c(0x1d1)](_0x20ef2c(0x211),'/api/attempts',{'body':_0x4578e0});}async[a10_0x51c04b(0x1ed)](_0x12acaf,_0x396254,_0x21d721){const _0x1a2af2=a10_0x51c04b,{promises:_0x569e13}=await import('fs'),_0x23c38a=new URLSearchParams();_0x21d721&&_0x23c38a[_0x1a2af2(0x205)](_0x1a2af2(0x1c8),_0x21d721);const _0xbbed=_0x23c38a['toString'](),_0x9a1b2=_0xbbed?_0x1a2af2(0x220)+encodeURIComponent(_0x12acaf)+_0x1a2af2(0x1e3)+_0xbbed:_0x1a2af2(0x220)+encodeURIComponent(_0x12acaf)+_0x1a2af2(0x20e),_0x3530fc=await this[_0x1a2af2(0x1db)][_0x1a2af2(0x1d1)]('GET',_0x9a1b2,{'headers':{'Accept':_0x1a2af2(0x21f)},'responseType':_0x1a2af2(0x1cd)});return await _0x569e13[_0x1a2af2(0x21e)](_0x396254,_0x3530fc),_0x396254;}async[a10_0x51c04b(0x214)](_0x44ec6a,_0x3f3c53,_0x4f37d4,_0x376291){const _0x3b6a67=a10_0x51c04b,{promises:_0x4a5400}=await import('fs'),_0x410dc4=new URLSearchParams();_0x410dc4['append'](_0x3b6a67(0x1da),_0x44ec6a),_0x410dc4[_0x3b6a67(0x205)]('revision',_0x3f3c53);_0x376291?.[_0x3b6a67(0x204)]&&_0x410dc4[_0x3b6a67(0x205)](_0x3b6a67(0x1f6),_0x376291['scheduleFrom']);_0x376291?.[_0x3b6a67(0x1e1)]&&_0x376291[_0x3b6a67(0x1e1)]['forEach'](_0x271d81=>{const _0x30f84e=_0x3b6a67;_0x410dc4[_0x30f84e(0x205)](_0x30f84e(0x1de),_0x271d81);});_0x376291?.[_0x3b6a67(0x221)]&&_0x410dc4[_0x3b6a67(0x205)](_0x3b6a67(0x208),_0x3b6a67(0x1e5));const _0x59606c=_0x410dc4[_0x3b6a67(0x1c4)](),_0x59406e='/api/projects?'+_0x59606c,_0x5b54f6=await _0x4a5400[_0x3b6a67(0x1e6)](_0x4f37d4);return await this['httpClient']['request'](_0x3b6a67(0x211),_0x59406e,{'body':_0x5b54f6,'headers':{'Content-Type':_0x3b6a67(0x21f)}});}async[a10_0x51c04b(0x1d8)](_0x24ec87){const _0x1b2a3d=a10_0x51c04b;return await this[_0x1b2a3d(0x1db)][_0x1b2a3d(0x1d1)](_0x1b2a3d(0x1ee),_0x1b2a3d(0x220)+encodeURIComponent(_0x24ec87));}}
|
|
1
|
+
function a10_0x3522(_0x2548e3,_0x53b934){_0x2548e3=_0x2548e3-0x1ab;const _0x49f5ee=a10_0x49f5();let _0x352238=_0x49f5ee[_0x2548e3];return _0x352238;}const a10_0x5da50c=a10_0x3522;function a10_0x49f5(){const _0xe95e6a=['scheduleFrom','getAttemptTasks','getTaskLogs','/logs','project_name','httpClient','/api/attempts?','/archive','/api/attempts','listSessions','application/gzip','DELETE','retry_params','project','toString','workflow_name','params','from_time','/api/attempts/','workflowName','7455964RyVzNA','resume_from','/api/workflows?','getAttempt','listLogFiles','120gzPwtt','workflowId','listAttempts','238008EZrVND','attempts','allowQueueing','14580920IhsxUb','listWorkflows','append','offset','startAttempt','include_subtasks','site','/tasks?','clearSchedule','7UUIljM','POST','1467930oQiWDa','writeFile','lastId','name_pattern','GET','downloadProjectArchive','187ISNwza','readFile','include_retried','tasks','to_time','workflows','status','limit','request','project_id','listProjects','sessionTime','apiKey','arraybuffer','projectName','/tasks','retryAttemptName','/api/projects/','schedule_from','from_task','true','/api/projects?','revision','name','killAttempt','authHeaders','24790420kQobFJ','/files?','last_id','/api/logs/','/retry','replace','workflow','retrySession','filter','PUT','/tasks/','uploadProjectArchive','16270amnvMq','/api/workflows','/logs?','/files','4018419vDPnBy','/kill','/api/sessions'];a10_0x49f5=function(){return _0xe95e6a;};return a10_0x49f5();}(function(_0x4db0e7,_0x41de34){const _0x32f24b=a10_0x3522,_0x3ff575=_0x4db0e7();while(!![]){try{const _0x3719f4=parseInt(_0x32f24b(0x1da))/0x1*(-parseInt(_0x32f24b(0x200))/0x2)+parseInt(_0x32f24b(0x1d4))/0x3+parseInt(_0x32f24b(0x1be))/0x4+-parseInt(_0x32f24b(0x1c3))/0x5*(parseInt(_0x32f24b(0x1c6))/0x6)+parseInt(_0x32f24b(0x1d2))/0x7*(-parseInt(_0x32f24b(0x1c9))/0x8)+parseInt(_0x32f24b(0x204))/0x9+parseInt(_0x32f24b(0x1f4))/0xa;if(_0x3719f4===_0x41de34)break;else _0x3ff575['push'](_0x3ff575['shift']());}catch(_0x358253){_0x3ff575['push'](_0x3ff575['shift']());}}}(a10_0x49f5,0xeff9e));import{HTTPClient}from'./http-client.js';import{getEndpoint}from'../types/index.js';import{getAuthHeaders,toHeaderRecord}from'../core/auth.js';import{matchGlobPattern}from'../utils/string-utils.js';export class WorkflowApiClient{['httpClient'];['authHeaders'];constructor(_0x56204c,_0x2b9f5d){const _0x5ab32b=a10_0x3522,_0x1f5f91=getEndpoint(_0x56204c['site'],_0x5ab32b(0x1fa));this[_0x5ab32b(0x1f3)]=toHeaderRecord(getAuthHeaders(_0x56204c[_0x5ab32b(0x1cf)],_0x56204c[_0x5ab32b(0x1e6)])),this['httpClient']=new HTTPClient(_0x1f5f91,this[_0x5ab32b(0x1f3)],_0x2b9f5d);}async[a10_0x5da50c(0x1e4)](_0x2f43ed){const _0x3df7c9=a10_0x5da50c,_0xc11378=new URLSearchParams();if(_0x2f43ed?.[_0x3df7c9(0x1e1)])_0xc11378[_0x3df7c9(0x1cb)](_0x3df7c9(0x1e1),String(_0x2f43ed[_0x3df7c9(0x1e1)]));if(_0x2f43ed?.['last_id'])_0xc11378[_0x3df7c9(0x1cb)](_0x3df7c9(0x1f6),_0x2f43ed[_0x3df7c9(0x1f6)]);if(_0x2f43ed?.[_0x3df7c9(0x1d7)]){const _0x10f928=_0x2f43ed[_0x3df7c9(0x1d7)][_0x3df7c9(0x1f9)](/[*?]/g,'');_0x10f928&&_0xc11378[_0x3df7c9(0x1cb)](_0x3df7c9(0x1d7),_0x10f928);}const _0x40b46a=_0xc11378[_0x3df7c9(0x1b8)](),_0x4d8fdf=_0x40b46a?_0x3df7c9(0x1ef)+_0x40b46a:'/api/projects',_0x2dcdb3=await this[_0x3df7c9(0x1af)][_0x3df7c9(0x1e2)](_0x3df7c9(0x1d8),_0x4d8fdf);let _0x176029=_0x2dcdb3['projects']||[];return _0x2f43ed?.[_0x3df7c9(0x1d7)]&&(_0x176029=_0x176029[_0x3df7c9(0x1fc)](_0x4afd4b=>{const _0xaef6d3=_0x3df7c9;return matchGlobPattern(_0x4afd4b[_0xaef6d3(0x1f1)],_0x2f43ed[_0xaef6d3(0x1d7)]);})),{'data':_0x176029,'lastId':_0x2dcdb3['lastId']};}async[a10_0x5da50c(0x1ca)](_0x5f3fa8){const _0x12db74=a10_0x5da50c,_0x2c7f30=new URLSearchParams();if(_0x5f3fa8?.[_0x12db74(0x1e1)])_0x2c7f30['append'](_0x12db74(0x1e1),String(_0x5f3fa8['limit']));if(_0x5f3fa8?.['last_id'])_0x2c7f30[_0x12db74(0x1cb)](_0x12db74(0x1f6),_0x5f3fa8['last_id']);if(_0x5f3fa8?.[_0x12db74(0x1ae)]){const _0x21428d=_0x5f3fa8[_0x12db74(0x1ae)][_0x12db74(0x1f9)](/[*?]/g,'');_0x21428d&&(_0x2c7f30[_0x12db74(0x1cb)]('name_pattern',_0x21428d),_0x2c7f30[_0x12db74(0x1cb)]('search_project_name',_0x12db74(0x1ee)));}const _0x80de7=_0x2c7f30[_0x12db74(0x1b8)](),_0x4ae969=_0x80de7?_0x12db74(0x1c0)+_0x80de7:_0x12db74(0x201),_0x4a92cb=await this['httpClient'][_0x12db74(0x1e2)]('GET',_0x4ae969);let _0x3dce20=_0x4a92cb[_0x12db74(0x1df)]||[];return _0x5f3fa8?.[_0x12db74(0x1ae)]&&(_0x3dce20=_0x3dce20['filter'](_0x11b8f1=>{const _0x4ddc21=_0x12db74,_0x51c707=_0x11b8f1[_0x4ddc21(0x1b7)]?.[_0x4ddc21(0x1f1)];if(!_0x51c707)return![];return matchGlobPattern(_0x51c707,_0x5f3fa8[_0x4ddc21(0x1ae)]);})),{'data':_0x3dce20,'lastId':_0x4a92cb[_0x12db74(0x1d6)]};}async[a10_0x5da50c(0x1b3)](_0x2a4438){const _0x151c3b=a10_0x5da50c;let _0x5ec172=_0x151c3b(0x206);_0x2a4438?.['project_id']&&(_0x5ec172='/api/projects/'+encodeURIComponent(_0x2a4438[_0x151c3b(0x1e3)])+'/sessions');const _0x416509=new URLSearchParams();if(_0x2a4438?.[_0x151c3b(0x1b9)])_0x416509[_0x151c3b(0x1cb)]('workflow',_0x2a4438[_0x151c3b(0x1b9)]);if(_0x2a4438?.['status'])_0x416509[_0x151c3b(0x1cb)](_0x151c3b(0x1e0),_0x2a4438['status']);if(_0x2a4438?.[_0x151c3b(0x1bb)])_0x416509['append'](_0x151c3b(0x1bb),_0x2a4438['from_time']);if(_0x2a4438?.[_0x151c3b(0x1de)])_0x416509[_0x151c3b(0x1cb)](_0x151c3b(0x1de),_0x2a4438[_0x151c3b(0x1de)]);if(_0x2a4438?.[_0x151c3b(0x1e1)])_0x416509[_0x151c3b(0x1cb)](_0x151c3b(0x1e1),String(_0x2a4438[_0x151c3b(0x1e1)]));if(_0x2a4438?.[_0x151c3b(0x1f6)])_0x416509[_0x151c3b(0x1cb)](_0x151c3b(0x1f6),_0x2a4438[_0x151c3b(0x1f6)]);const _0x29fa7f=_0x416509[_0x151c3b(0x1b8)]();_0x29fa7f&&(_0x5ec172=_0x5ec172+'?'+_0x29fa7f);const _0x5ee6d6=await this[_0x151c3b(0x1af)]['request'](_0x151c3b(0x1d8),_0x5ec172);return{'data':_0x5ee6d6['sessions']||[],'lastId':_0x5ee6d6[_0x151c3b(0x1d6)]};}async[a10_0x5da50c(0x1c5)](_0x2fb4d9){const _0x482133=a10_0x5da50c,_0x1d0d40=new URLSearchParams();if(_0x2fb4d9?.['project_name'])_0x1d0d40[_0x482133(0x1cb)]('project',_0x2fb4d9[_0x482133(0x1ae)]);if(_0x2fb4d9?.[_0x482133(0x1b9)])_0x1d0d40[_0x482133(0x1cb)]('workflow',_0x2fb4d9['workflow_name']);if(_0x2fb4d9?.[_0x482133(0x1dc)])_0x1d0d40[_0x482133(0x1cb)](_0x482133(0x1dc),'1');if(_0x2fb4d9?.[_0x482133(0x1e1)])_0x1d0d40[_0x482133(0x1cb)](_0x482133(0x1e1),String(_0x2fb4d9[_0x482133(0x1e1)]));if(_0x2fb4d9?.[_0x482133(0x1f6)])_0x1d0d40[_0x482133(0x1cb)](_0x482133(0x1f6),_0x2fb4d9[_0x482133(0x1f6)]);const _0x51a884=_0x1d0d40['toString'](),_0xf545aa=_0x51a884?_0x482133(0x1b0)+_0x51a884:'/api/attempts',_0x4d7f0e=await this[_0x482133(0x1af)][_0x482133(0x1e2)](_0x482133(0x1d8),_0xf545aa);return{'data':_0x4d7f0e[_0x482133(0x1c7)]||[],'lastId':_0x4d7f0e[_0x482133(0x1d6)]};}async[a10_0x5da50c(0x1c1)](_0x158abe){const _0x319351=a10_0x5da50c;return await this['httpClient']['request']('GET',_0x319351(0x1bc)+encodeURIComponent(_0x158abe));}async[a10_0x5da50c(0x1ab)](_0x1e82b6,_0x10cdb5=![]){const _0x1f7525=a10_0x5da50c,_0x3f7baf=new URLSearchParams();_0x10cdb5&&_0x3f7baf[_0x1f7525(0x1cb)](_0x1f7525(0x1ce),_0x1f7525(0x1ee));const _0x3a2bf2=_0x3f7baf[_0x1f7525(0x1b8)](),_0x376b2d=_0x3a2bf2?_0x1f7525(0x1bc)+encodeURIComponent(_0x1e82b6)+_0x1f7525(0x1d0)+_0x3a2bf2:_0x1f7525(0x1bc)+encodeURIComponent(_0x1e82b6)+_0x1f7525(0x1e9),_0x3cade9=await this[_0x1f7525(0x1af)][_0x1f7525(0x1e2)](_0x1f7525(0x1d8),_0x376b2d);return _0x3cade9[_0x1f7525(0x1dd)]||[];}async[a10_0x5da50c(0x1ac)](_0x5c2a18,_0x2fe157,_0x149afe){const _0x2531cb=a10_0x5da50c,_0x52bace=new URLSearchParams();_0x149afe?.['offset']!==undefined&&_0x52bace['append']('offset',String(_0x149afe[_0x2531cb(0x1cc)]));_0x149afe?.[_0x2531cb(0x1e1)]!==undefined&&_0x52bace['append'](_0x2531cb(0x1e1),String(_0x149afe['limit']));const _0x363c11=_0x52bace[_0x2531cb(0x1b8)](),_0x3e6a8d=_0x363c11?_0x2531cb(0x1bc)+encodeURIComponent(_0x5c2a18)+_0x2531cb(0x1fe)+encodeURIComponent(_0x2fe157)+_0x2531cb(0x202)+_0x363c11:_0x2531cb(0x1bc)+encodeURIComponent(_0x5c2a18)+_0x2531cb(0x1fe)+encodeURIComponent(_0x2fe157)+_0x2531cb(0x1ad),_0x5046df=await this['httpClient']['request'](_0x2531cb(0x1d8),_0x3e6a8d);return _0x5046df['logs']||[];}async[a10_0x5da50c(0x1c2)](_0xdea1dc,_0x5542e8){const _0x31109b=a10_0x5da50c,_0x28d63f=new URLSearchParams();_0x5542e8&&_0x28d63f[_0x31109b(0x1cb)]('task',_0x5542e8);const _0x68b19b=_0x28d63f[_0x31109b(0x1b8)](),_0x2e08b1=_0x68b19b?_0x31109b(0x1f7)+encodeURIComponent(_0xdea1dc)+_0x31109b(0x1f5)+_0x68b19b:_0x31109b(0x1f7)+encodeURIComponent(_0xdea1dc)+_0x31109b(0x203),_0xa2a358=await this[_0x31109b(0x1af)][_0x31109b(0x1e2)](_0x31109b(0x1d8),_0x2e08b1);return _0xa2a358['files']||[];}async[a10_0x5da50c(0x1f2)](_0x3b64ac,_0x1de39b){const _0x4171ab=a10_0x5da50c,_0x182bc6={};return _0x1de39b&&(_0x182bc6['reason']=_0x1de39b),await this[_0x4171ab(0x1af)][_0x4171ab(0x1e2)](_0x4171ab(0x1d3),'/api/attempts/'+encodeURIComponent(_0x3b64ac)+_0x4171ab(0x205),{'body':_0x182bc6});}async[a10_0x5da50c(0x1fb)](_0x453e03,_0x194a01){const _0x42eaee=a10_0x5da50c,_0x303da3={};return _0x194a01?.[_0x42eaee(0x1ed)]&&(_0x303da3[_0x42eaee(0x1ed)]=_0x194a01[_0x42eaee(0x1ed)]),_0x194a01?.[_0x42eaee(0x1b6)]&&(_0x303da3[_0x42eaee(0x1b6)]=_0x194a01[_0x42eaee(0x1b6)]),await this[_0x42eaee(0x1af)]['request'](_0x42eaee(0x1d3),'/api/sessions/'+encodeURIComponent(_0x453e03)+_0x42eaee(0x1f8),{'body':_0x303da3});}async['retryAttempt'](_0x7bf51e,_0xadd9f){const _0x4b5238=a10_0x5da50c,_0x57a387={};return _0xadd9f?.[_0x4b5238(0x1bf)]&&(_0x57a387[_0x4b5238(0x1bf)]=_0xadd9f['resume_from']),_0xadd9f?.[_0x4b5238(0x1b6)]&&(_0x57a387['retry_params']=_0xadd9f[_0x4b5238(0x1b6)]),_0xadd9f?.['force']&&(_0x57a387['force']=_0xadd9f['force']),await this[_0x4b5238(0x1af)][_0x4b5238(0x1e2)](_0x4b5238(0x1d3),_0x4b5238(0x1bc)+encodeURIComponent(_0x7bf51e)+_0x4b5238(0x1f8),{'body':_0x57a387});}async[a10_0x5da50c(0x1cd)](_0x500493){const _0x2937d0=a10_0x5da50c,_0xf98c56={'sessionTime':_0x500493[_0x2937d0(0x1e5)],'params':_0x500493[_0x2937d0(0x1ba)]};return _0x500493[_0x2937d0(0x1c4)]&&(_0xf98c56[_0x2937d0(0x1c4)]=_0x500493[_0x2937d0(0x1c4)]),_0x500493[_0x2937d0(0x1e8)]&&(_0xf98c56[_0x2937d0(0x1e8)]=_0x500493['projectName']),_0x500493['workflowName']&&(_0xf98c56[_0x2937d0(0x1bd)]=_0x500493[_0x2937d0(0x1bd)]),_0x500493[_0x2937d0(0x1ea)]&&(_0xf98c56['retryAttemptName']=_0x500493['retryAttemptName']),_0x500493[_0x2937d0(0x1c8)]!==undefined&&(_0xf98c56[_0x2937d0(0x1c8)]=_0x500493[_0x2937d0(0x1c8)]),await this[_0x2937d0(0x1af)][_0x2937d0(0x1e2)](_0x2937d0(0x1fd),_0x2937d0(0x1b2),{'body':_0xf98c56});}async[a10_0x5da50c(0x1d9)](_0xe6a13a,_0x36238f,_0x1dc213){const _0x39b0b7=a10_0x5da50c,{promises:_0x2ecce3}=await import('fs'),_0x3616de=new URLSearchParams();_0x1dc213&&_0x3616de[_0x39b0b7(0x1cb)](_0x39b0b7(0x1f0),_0x1dc213);const _0x591bb2=_0x3616de[_0x39b0b7(0x1b8)](),_0x25f182=_0x591bb2?'/api/projects/'+encodeURIComponent(_0xe6a13a)+'/archive?'+_0x591bb2:_0x39b0b7(0x1eb)+encodeURIComponent(_0xe6a13a)+_0x39b0b7(0x1b1),_0x5a829d=await this[_0x39b0b7(0x1af)][_0x39b0b7(0x1e2)](_0x39b0b7(0x1d8),_0x25f182,{'headers':{'Accept':_0x39b0b7(0x1b4)},'responseType':_0x39b0b7(0x1e7)});return await _0x2ecce3[_0x39b0b7(0x1d5)](_0x36238f,_0x5a829d),_0x36238f;}async[a10_0x5da50c(0x1ff)](_0x31fc75,_0x42664d,_0x3a1955,_0x41bcec){const _0x1206d7=a10_0x5da50c,{promises:_0x4dcb26}=await import('fs'),_0x5aa5ad=new URLSearchParams();_0x5aa5ad[_0x1206d7(0x1cb)](_0x1206d7(0x1b7),_0x31fc75),_0x5aa5ad[_0x1206d7(0x1cb)](_0x1206d7(0x1f0),_0x42664d);_0x41bcec?.['scheduleFrom']&&_0x5aa5ad[_0x1206d7(0x1cb)](_0x1206d7(0x1ec),_0x41bcec[_0x1206d7(0x207)]);_0x41bcec?.[_0x1206d7(0x1d1)]&&_0x41bcec[_0x1206d7(0x1d1)]['forEach'](_0x432577=>{_0x5aa5ad['append']('clear_schedule',_0x432577);});_0x41bcec?.['clearScheduleAll']&&_0x5aa5ad[_0x1206d7(0x1cb)]('clear_schedule_all',_0x1206d7(0x1ee));const _0x487aaa=_0x5aa5ad[_0x1206d7(0x1b8)](),_0x11f7e9=_0x1206d7(0x1ef)+_0x487aaa,_0x31f0cf=await _0x4dcb26[_0x1206d7(0x1db)](_0x3a1955);return await this[_0x1206d7(0x1af)][_0x1206d7(0x1e2)](_0x1206d7(0x1fd),_0x11f7e9,{'body':_0x31f0cf,'headers':{'Content-Type':_0x1206d7(0x1b4)}});}async['deleteProject'](_0x1cac61){const _0x4607a6=a10_0x5da50c;return await this[_0x4607a6(0x1af)][_0x4607a6(0x1e2)](_0x4607a6(0x1b5),_0x4607a6(0x1eb)+encodeURIComponent(_0x1cac61));}}
|