@treasuredata/tdx 0.14.1 → 0.14.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 +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-proxy.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/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/passthrough-server.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/endpoints.js.map +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-aliases.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.d.ts.map +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js.map +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.d.ts +60 -0
- package/dist/sdk/workflow/workflow-utils.d.ts.map +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js.map +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a68_0x2c3e(){const _0x487623=['415HZDiCB','append','updateTemplate','/launch','/api/campaigns?','page[limit]','site','/duplicate','sort','/api/campaigns','56651TvgORU','/resume','9104VNJlVH','campaigns','emailTemplates','1096700hSORMk','/api/workspaces/','updateWorkspace','updateCampaign','51jNyDKH','GET','9DGwczY','POST','workspaces','filter[campaignType]','offset','/api/email_templates','logger','workspaceId','createTemplate','deleteWorkspace','102QrMZCp','getWorkspace','duplicateCampaign','listTemplates','page[offset]','deleteTemplate','4333120uArARA','limit','request','launchCampaign','80862rwTpzc','deleteCampaign','apiKey','status','/api/email_templates?','filter[status]','filter[workspaceId]','/api/campaigns/','PATCH','engage','278584iHudFz','filter[name]','toString','listWorkspaces','DELETE','filter[owner_user.name]','campaignType','application/json','10526zdDYcC','include','/api/workspaces','application/vnd.api+json','ownerName','name','getTemplate','createWorkspace','stringify','/api/email_templates/','httpClient'];a68_0x2c3e=function(){return _0x487623;};return a68_0x2c3e();}function a68_0x41c9(_0xa6a996,_0x5ec449){_0xa6a996=_0xa6a996-0x136;const _0x2c3e89=a68_0x2c3e();let _0x41c9fd=_0x2c3e89[_0xa6a996];return _0x41c9fd;}const a68_0x11fd3c=a68_0x41c9;(function(_0x4522c7,_0x6be10b){const _0x4d7ec3=a68_0x41c9,_0x3f6108=_0x4522c7();while(!![]){try{const _0x3803e1=parseInt(_0x4d7ec3(0x16e))/0x1+-parseInt(_0x4d7ec3(0x13a))/0x2*(-parseInt(_0x4d7ec3(0x158))/0x3)+parseInt(_0x4d7ec3(0x151))/0x4*(-parseInt(_0x4d7ec3(0x145))/0x5)+-parseInt(_0x4d7ec3(0x164))/0x6*(parseInt(_0x4d7ec3(0x14f))/0x7)+parseInt(_0x4d7ec3(0x178))/0x8+-parseInt(_0x4d7ec3(0x15a))/0x9*(parseInt(_0x4d7ec3(0x154))/0xa)+parseInt(_0x4d7ec3(0x16a))/0xb;if(_0x3803e1===_0x6be10b)break;else _0x3f6108['push'](_0x3f6108['shift']());}catch(_0x527852){_0x3f6108['push'](_0x3f6108['shift']());}}}(a68_0x2c3e,0x27c65));import{HTTPClient}from'./http-client.js';import{getEndpoint}from'../types/index.js';import{getAuthHeaders,toHeaderRecord}from'../../core/auth.js';export class EngageApiClient{['httpClient'];constructor(_0x42faa1){const _0x2e492e=a68_0x41c9,_0x2a612c=getEndpoint(_0x42faa1[_0x2e492e(0x14b)],_0x2e492e(0x177)),_0x192904=toHeaderRecord(getAuthHeaders(_0x42faa1[_0x2e492e(0x14b)],_0x42faa1[_0x2e492e(0x170)]));this[_0x2e492e(0x144)]=new HTTPClient(_0x2a612c,_0x192904,_0x42faa1[_0x2e492e(0x160)]);}async['listCampaigns'](_0x4baa79={}){const _0x4f200f=a68_0x41c9,_0x343860=new URLSearchParams();_0x4baa79['campaignType']&&_0x343860[_0x4f200f(0x146)](_0x4f200f(0x15d),_0x4baa79[_0x4f200f(0x138)]);_0x4baa79['status']&&_0x343860['append'](_0x4f200f(0x173),_0x4baa79[_0x4f200f(0x171)]);_0x4baa79[_0x4f200f(0x161)]&&_0x343860[_0x4f200f(0x146)](_0x4f200f(0x174),_0x4baa79[_0x4f200f(0x161)]);_0x4baa79['limit']!==undefined&&_0x343860['append']('page[limit]',_0x4baa79[_0x4f200f(0x16b)][_0x4f200f(0x17a)]());_0x4baa79[_0x4f200f(0x15e)]!==undefined&&_0x343860[_0x4f200f(0x146)](_0x4f200f(0x168),_0x4baa79[_0x4f200f(0x15e)]['toString']());_0x4baa79[_0x4f200f(0x14d)]&&_0x343860[_0x4f200f(0x146)](_0x4f200f(0x14d),_0x4baa79[_0x4f200f(0x14d)]);_0x4baa79['include']&&_0x343860['append']('include',_0x4baa79[_0x4f200f(0x13b)]);const _0xbe1922=_0x343860[_0x4f200f(0x17a)](),_0x1a853b=_0xbe1922?_0x4f200f(0x149)+_0xbe1922:_0x4f200f(0x14e);return await this[_0x4f200f(0x144)][_0x4f200f(0x16c)](_0x4f200f(0x159),_0x1a853b,{'headers':{'Accept':_0x4f200f(0x13d)}});}async['getCampaign'](_0x4e1b27){const _0x19af3b=a68_0x41c9;return await this[_0x19af3b(0x144)][_0x19af3b(0x16c)](_0x19af3b(0x159),_0x19af3b(0x175)+encodeURIComponent(_0x4e1b27),{'headers':{'Accept':_0x19af3b(0x13d)}});}async['createCampaign'](_0x2529db){const _0x426f46=a68_0x41c9,_0x27e2f7={'data':{'type':_0x426f46(0x152),'attributes':_0x2529db}};return await this[_0x426f46(0x144)]['request'](_0x426f46(0x15b),_0x426f46(0x14e),{'headers':{'Content-Type':_0x426f46(0x13d),'Accept':_0x426f46(0x13d)},'body':JSON['stringify'](_0x27e2f7)});}async[a68_0x11fd3c(0x157)](_0x1adaf6,_0x5cf3cf){const _0x389db2=a68_0x11fd3c,_0x847a90={'data':{'type':_0x389db2(0x152),'id':_0x1adaf6,'attributes':_0x5cf3cf}};return await this['httpClient']['request'](_0x389db2(0x176),'/api/campaigns/'+encodeURIComponent(_0x1adaf6),{'headers':{'Content-Type':_0x389db2(0x13d),'Accept':_0x389db2(0x13d)},'body':JSON[_0x389db2(0x142)](_0x847a90)});}async[a68_0x11fd3c(0x16f)](_0x2ee845){const _0x307360=a68_0x11fd3c;await this[_0x307360(0x144)][_0x307360(0x16c)](_0x307360(0x136),_0x307360(0x175)+encodeURIComponent(_0x2ee845),{'headers':{'Accept':'application/vnd.api+json'}});}async[a68_0x11fd3c(0x16d)](_0x2eb9ef){const _0x5d5d49=a68_0x11fd3c;await this[_0x5d5d49(0x144)][_0x5d5d49(0x16c)]('POST',_0x5d5d49(0x175)+encodeURIComponent(_0x2eb9ef)+_0x5d5d49(0x148),{'headers':{'Content-Type':'application/json','Accept':_0x5d5d49(0x139)},'body':JSON['stringify']({})});}async['pauseCampaign'](_0x1352a0){const _0x1ca8a7=a68_0x11fd3c;await this[_0x1ca8a7(0x144)]['request'](_0x1ca8a7(0x15b),_0x1ca8a7(0x175)+encodeURIComponent(_0x1352a0)+'/pause',{'headers':{'Content-Type':_0x1ca8a7(0x139),'Accept':_0x1ca8a7(0x139)},'body':JSON[_0x1ca8a7(0x142)]({})});}async['resumeCampaign'](_0x53e404){const _0x1cb97a=a68_0x11fd3c;await this[_0x1cb97a(0x144)][_0x1cb97a(0x16c)](_0x1cb97a(0x15b),_0x1cb97a(0x175)+encodeURIComponent(_0x53e404)+_0x1cb97a(0x150),{'headers':{'Content-Type':_0x1cb97a(0x139),'Accept':'application/json'},'body':JSON[_0x1cb97a(0x142)]({})});}async[a68_0x11fd3c(0x166)](_0x367f22){const _0x598beb=a68_0x11fd3c;return await this['httpClient'][_0x598beb(0x16c)](_0x598beb(0x15b),'/api/campaigns/'+encodeURIComponent(_0x367f22)+_0x598beb(0x14c),{'headers':{'Content-Type':_0x598beb(0x139),'Accept':_0x598beb(0x13d)},'body':JSON['stringify']({})});}async[a68_0x11fd3c(0x167)](_0x2c2af0={}){const _0x4b7632=a68_0x11fd3c,_0x353a01=new URLSearchParams();_0x2c2af0[_0x4b7632(0x161)]&&_0x353a01[_0x4b7632(0x146)](_0x4b7632(0x174),_0x2c2af0['workspaceId']);_0x2c2af0['limit']!==undefined&&_0x353a01[_0x4b7632(0x146)](_0x4b7632(0x14a),_0x2c2af0[_0x4b7632(0x16b)][_0x4b7632(0x17a)]());_0x2c2af0[_0x4b7632(0x15e)]!==undefined&&_0x353a01[_0x4b7632(0x146)](_0x4b7632(0x168),_0x2c2af0[_0x4b7632(0x15e)]['toString']());_0x2c2af0[_0x4b7632(0x14d)]&&_0x353a01[_0x4b7632(0x146)]('sort',_0x2c2af0[_0x4b7632(0x14d)]);const _0x5ad5f0=_0x353a01['toString'](),_0x11a45b=_0x5ad5f0?_0x4b7632(0x172)+_0x5ad5f0:_0x4b7632(0x15f);return await this['httpClient'][_0x4b7632(0x16c)](_0x4b7632(0x159),_0x11a45b,{'headers':{'Accept':_0x4b7632(0x13d)}});}async[a68_0x11fd3c(0x140)](_0x54e070){const _0x217169=a68_0x11fd3c;return await this[_0x217169(0x144)][_0x217169(0x16c)]('GET',_0x217169(0x143)+encodeURIComponent(_0x54e070),{'headers':{'Accept':_0x217169(0x13d)}});}async[a68_0x11fd3c(0x162)](_0x573fb3){const _0x553bba=a68_0x11fd3c,_0x4889e3={'data':{'type':'emailTemplates','attributes':_0x573fb3}};return await this[_0x553bba(0x144)]['request'](_0x553bba(0x15b),_0x553bba(0x15f),{'headers':{'Content-Type':_0x553bba(0x13d),'Accept':'application/vnd.api+json'},'body':JSON[_0x553bba(0x142)](_0x4889e3)});}async[a68_0x11fd3c(0x147)](_0x2ab6d7,_0x24c891){const _0x576c96=a68_0x11fd3c,_0x5b96b5={'data':{'type':_0x576c96(0x153),'id':_0x2ab6d7,'attributes':_0x24c891}};return await this['httpClient']['request']('PATCH',_0x576c96(0x143)+encodeURIComponent(_0x2ab6d7),{'headers':{'Content-Type':'application/vnd.api+json','Accept':'application/vnd.api+json'},'body':JSON[_0x576c96(0x142)](_0x5b96b5)});}async[a68_0x11fd3c(0x169)](_0xafe19e){const _0x3dd893=a68_0x11fd3c;await this['httpClient'][_0x3dd893(0x16c)](_0x3dd893(0x136),_0x3dd893(0x143)+encodeURIComponent(_0xafe19e),{'headers':{'Accept':_0x3dd893(0x13d)}});}async[a68_0x11fd3c(0x17b)](_0x1a8f67={}){const _0x17bdea=a68_0x11fd3c,_0x50100f=new URLSearchParams();_0x1a8f67[_0x17bdea(0x13f)]&&_0x50100f[_0x17bdea(0x146)](_0x17bdea(0x179),_0x1a8f67[_0x17bdea(0x13f)]);_0x1a8f67['ownerName']&&_0x50100f[_0x17bdea(0x146)](_0x17bdea(0x137),_0x1a8f67[_0x17bdea(0x13e)]);_0x1a8f67[_0x17bdea(0x16b)]!==undefined&&_0x50100f[_0x17bdea(0x146)](_0x17bdea(0x14a),_0x1a8f67[_0x17bdea(0x16b)]['toString']());_0x1a8f67[_0x17bdea(0x15e)]!==undefined&&_0x50100f['append'](_0x17bdea(0x168),_0x1a8f67[_0x17bdea(0x15e)][_0x17bdea(0x17a)]());_0x1a8f67[_0x17bdea(0x14d)]&&_0x50100f['append'](_0x17bdea(0x14d),_0x1a8f67[_0x17bdea(0x14d)]);const _0x5745ce=_0x50100f[_0x17bdea(0x17a)](),_0x28e11c=_0x5745ce?'/api/workspaces?'+_0x5745ce:_0x17bdea(0x13c);return await this[_0x17bdea(0x144)][_0x17bdea(0x16c)](_0x17bdea(0x159),_0x28e11c,{'headers':{'Accept':_0x17bdea(0x13d)}});}async[a68_0x11fd3c(0x165)](_0x2da4d2){const _0x101253=a68_0x11fd3c;return await this[_0x101253(0x144)][_0x101253(0x16c)](_0x101253(0x159),'/api/workspaces/'+encodeURIComponent(_0x2da4d2),{'headers':{'Accept':_0x101253(0x13d)}});}async[a68_0x11fd3c(0x141)](_0x410da7){const _0x3e5169=a68_0x11fd3c,_0xa7757d={'data':{'type':_0x3e5169(0x15c),'attributes':_0x410da7}};return await this['httpClient'][_0x3e5169(0x16c)](_0x3e5169(0x15b),'/api/workspaces',{'headers':{'Content-Type':_0x3e5169(0x13d),'Accept':_0x3e5169(0x13d)},'body':JSON['stringify'](_0xa7757d)});}async[a68_0x11fd3c(0x156)](_0x3fb675,_0x55a1a5){const _0x37ca4d=a68_0x11fd3c,_0x305040={'data':{'type':_0x37ca4d(0x15c),'id':_0x3fb675,'attributes':_0x55a1a5}};return await this[_0x37ca4d(0x144)]['request'](_0x37ca4d(0x176),_0x37ca4d(0x155)+encodeURIComponent(_0x3fb675),{'headers':{'Content-Type':_0x37ca4d(0x13d),'Accept':'application/vnd.api+json'},'body':JSON['stringify'](_0x305040)});}async[a68_0x11fd3c(0x163)](_0xe3f688){const _0x35bf10=a68_0x11fd3c;await this[_0x35bf10(0x144)][_0x35bf10(0x16c)](_0x35bf10(0x136),_0x35bf10(0x155)+encodeURIComponent(_0xe3f688),{'headers':{'Accept':_0x35bf10(0x13d)}});}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a69_0x3d563e=a69_0x4891;(function(_0x15bcce,_0x42451a){const _0xc03798=a69_0x4891,_0x5439d4=_0x15bcce();while(!![]){try{const _0x229d85=-parseInt(_0xc03798(0x119))/0x1+-parseInt(_0xc03798(0xf2))/0x2+parseInt(_0xc03798(0xee))/0x3*(parseInt(_0xc03798(0xfb))/0x4)+-parseInt(_0xc03798(0x113))/0x5+parseInt(_0xc03798(0xdc))/0x6*(-parseInt(_0xc03798(0x108))/0x7)+-parseInt(_0xc03798(0xdd))/0x8*(parseInt(_0xc03798(0x10a))/0x9)+parseInt(_0xc03798(0xeb))/0xa*(parseInt(_0xc03798(0x112))/0xb);if(_0x229d85===_0x42451a)break;else _0x5439d4['push'](_0x5439d4['shift']());}catch(_0x2fd4af){_0x5439d4['push'](_0x5439d4['shift']());}}}(a69_0x4bf7,0x2fe91));import{ErrorCode,SDKError}from'../errors.js';import a69_0x1cf36c from'json-bigint';function a69_0x4891(_0x294016,_0x22cc8a){_0x294016=_0x294016-0xd1;const _0x4bf716=a69_0x4bf7();let _0x489115=_0x4bf716[_0x294016];return _0x489115;}const DEFAULT_RETRY_CONFIG={'maxRetries':0x3,'baseDelay':0x3e8,'maxDelay':0x1f40};function isRetryableStatus(_0x2e6b19){return _0x2e6b19>=0x1f4||_0x2e6b19===0x1ad;}function isNonRetryable429(_0xab6367){const _0x385ec3=a69_0x4891;return _0xab6367['includes'](_0x385ec3(0x122));}function getRetryDelay(_0x369f2b,_0x4df4e9){const _0xbca8fa=a69_0x4891,_0x2710bb=Math[_0xbca8fa(0xdb)](_0x4df4e9[_0xbca8fa(0x124)]*Math[_0xbca8fa(0xd3)](0x2,_0x369f2b),_0x4df4e9[_0xbca8fa(0xd1)]);return Math[_0xbca8fa(0x125)]()*_0x2710bb;}function a69_0x4bf7(){const _0x115ea4=['An\x20error\x20occurred','string','Content-Type','56mnapls','request\x20body:\x20','application/json','safeParseJSON','AbortError',']\x20Request\x20failed\x20with\x20HTTP\x20','[Retry\x20','error','debug','errors','detail','maxRetries','name','6034qViieb','warn','9KGGtoP','signal','logger','sleep','handleErrorResponse','severity','text','[binary\x20data]','110geyLkn','449290yhWfJH','HTTP\x20','request','extractErrorMessage','statusText','Error','54524oTCYHH','object','PERMISSION_DENIED','instance','Request\x20failed\x20after\x20retries','status_code','about:blank','body','parse','already\x20running','defaultHeaders','baseDelay','random','maxDelay','type','pow','parseProblemDetails','title','INTERNAL','retrying\x20in\x20','INVALID_ARGUMENT','UNAUTHENTICATED','abort','min','1494YDkWeV','1442488FOIMTL','message','addEventListener','round','Request\x20to\x20','Request\x20cancelled\x20by\x20user','Request:\x20','stringify','length','forEach','arraybuffer','HTTP_REQUEST_FAILURE','retryConfig','headers','690380iKXQIX','baseUrl','requestSSE','62787TLjgSL','ms...',']\x20Request\x20to\x20','problemDetails','495628PUBEKd','RATE_LIMITED','status','info','\x20failed:\x20','aborted'];a69_0x4bf7=function(){return _0x115ea4;};return a69_0x4bf7();}function statusCodeToErrorCode(_0x179d37){const _0x25d6b6=a69_0x4891;if(_0x179d37===0x191)return ErrorCode[_0x25d6b6(0xd9)];else{if(_0x179d37===0x193)return ErrorCode[_0x25d6b6(0x11b)];else{if(_0x179d37===0x194)return ErrorCode['NOT_FOUND'];else{if(_0x179d37===0x1ad)return ErrorCode[_0x25d6b6(0xf3)];else return _0x179d37>=0x1f4?ErrorCode['UNAVAILABLE']:ErrorCode[_0x25d6b6(0xd8)];}}}}export class HTTPClientError extends Error{[a69_0x3d563e(0xf4)];[a69_0x3d563e(0xf1)];['code'];constructor(_0x34cef5,_0x20743d,_0x6605d4){const _0x42a3c3=a69_0x3d563e,_0x5bb2d3=statusCodeToErrorCode(_0x20743d);super('['+_0x5bb2d3+']\x20'+_0x34cef5),this[_0x42a3c3(0xf4)]=_0x20743d,this[_0x42a3c3(0xf1)]=_0x6605d4,this[_0x42a3c3(0x107)]='HTTPClientError',this['code']=_0x5bb2d3;}}export class HTTPClient{[a69_0x3d563e(0xe9)];[a69_0x3d563e(0xec)];[a69_0x3d563e(0x123)];[a69_0x3d563e(0x10c)];constructor(_0x6aa9,_0x3ca338,_0x35fdef,_0x51d6a7){const _0x3b42eb=a69_0x3d563e;this[_0x3b42eb(0xec)]=_0x6aa9,this[_0x3b42eb(0x123)]=_0x3ca338,this[_0x3b42eb(0xe9)]={...DEFAULT_RETRY_CONFIG,..._0x51d6a7},this['logger']=_0x35fdef;}async[a69_0x3d563e(0x115)](_0x715142,_0x3997a3,_0x4bb1c9={}){const _0x3a8b6b=a69_0x3d563e,{headers:headers={},body:_0x2a00f6,timeout:timeout=0x7530,retries:retries=this[_0x3a8b6b(0xe9)][_0x3a8b6b(0x106)],signal:_0x3f1f26,includeHeaders:includeHeaders=![],responseType:responseType='json'}=_0x4bb1c9,_0x5e3e79=''+this[_0x3a8b6b(0xec)]+_0x3997a3;this[_0x3a8b6b(0x10c)][_0x3a8b6b(0xf5)](_0x3a8b6b(0xe3)+_0x715142+'\x20'+_0x5e3e79);const _0x3e4d9c={...this['defaultHeaders'],...headers};if(_0x2a00f6&&!_0x3e4d9c[_0x3a8b6b(0xfa)]){if(_0x2a00f6 instanceof Buffer){}else _0x3e4d9c[_0x3a8b6b(0xfa)]=_0x3a8b6b(0xfd);}let _0x1800cb;_0x2a00f6&&(_0x2a00f6 instanceof Buffer?_0x1800cb=_0x2a00f6:_0x1800cb=typeof _0x2a00f6===_0x3a8b6b(0xf9)?_0x2a00f6:JSON[_0x3a8b6b(0xe4)](_0x2a00f6));_0x1800cb&&this[_0x3a8b6b(0x10c)][_0x3a8b6b(0x103)](_0x3a8b6b(0xfc)+(typeof _0x1800cb===_0x3a8b6b(0xf9)?_0x1800cb:_0x3a8b6b(0x111)));let _0x41b14c=null;for(let _0x19b607=0x0;_0x19b607<=retries;_0x19b607++){try{const _0x7eb4bb=new AbortController(),_0x5cf969=setTimeout(()=>_0x7eb4bb[_0x3a8b6b(0xda)](),timeout);if(_0x3f1f26){if(_0x3f1f26[_0x3a8b6b(0xf7)])throw new Error('Request\x20cancelled\x20by\x20user');_0x3f1f26[_0x3a8b6b(0xdf)](_0x3a8b6b(0xda),()=>_0x7eb4bb[_0x3a8b6b(0xda)](),{'once':!![]});}const _0x51b4af=await fetch(_0x5e3e79,{'method':_0x715142,'headers':_0x3e4d9c,'body':_0x1800cb,'signal':_0x7eb4bb[_0x3a8b6b(0x10b)]});clearTimeout(_0x5cf969);if(_0x19b607<retries&&isRetryableStatus(_0x51b4af[_0x3a8b6b(0xf4)])){if(_0x51b4af['status']===0x1ad){const _0x461517=await _0x51b4af[_0x3a8b6b(0x110)]();if(isNonRetryable429(_0x461517)){const _0x1e707c=this[_0x3a8b6b(0x116)](_0x461517)||_0x51b4af[_0x3a8b6b(0x117)];throw new HTTPClientError(_0x1e707c,_0x51b4af[_0x3a8b6b(0xf4)]);}}const _0x632cf9=_0x51b4af[_0x3a8b6b(0xea)]['get']('Retry-After'),_0x252112=_0x632cf9?parseInt(_0x632cf9,0xa)*0x3e8:getRetryDelay(_0x19b607,this[_0x3a8b6b(0xe9)]);console[_0x3a8b6b(0x109)]('[Retry\x20'+(_0x19b607+0x1)+'/'+retries+']\x20Request\x20failed\x20with\x20'+_0x51b4af['status']+',\x20'+(_0x3a8b6b(0xd7)+Math[_0x3a8b6b(0xe0)](_0x252112)+_0x3a8b6b(0xef))),await this['sleep'](_0x252112);continue;}!_0x51b4af['ok']&&await this['handleErrorResponse'](_0x51b4af);let _0x288ab8;if(responseType===_0x3a8b6b(0xe7)){const _0x4f47af=await _0x51b4af['arrayBuffer']();_0x288ab8=Buffer['from'](_0x4f47af);}else responseType==='text'?_0x288ab8=await _0x51b4af['text']():_0x288ab8=await this[_0x3a8b6b(0xfe)](_0x51b4af);this[_0x3a8b6b(0x10c)][_0x3a8b6b(0x103)]('Response\x20['+_0x51b4af['status']+']:\x20'+_0x715142+'\x20'+_0x3997a3),this[_0x3a8b6b(0x10c)]['trace'](JSON[_0x3a8b6b(0xe4)](_0x288ab8,null,0x2));if(includeHeaders){const _0x26f9bd={};return _0x51b4af['headers'][_0x3a8b6b(0xe6)]((_0x128c46,_0x16f6d3)=>{_0x26f9bd[_0x16f6d3]=_0x128c46;}),{'data':_0x288ab8,'status':_0x51b4af[_0x3a8b6b(0xf4)],'headers':_0x26f9bd};}return _0x288ab8;}catch(_0x3aa19c){_0x41b14c=_0x3aa19c instanceof Error?_0x3aa19c:new Error(String(_0x3aa19c));if(_0x3aa19c instanceof HTTPClientError){if(!isRetryableStatus(_0x3aa19c['status'])||_0x3aa19c['status']===0x1ad&&isNonRetryable429(_0x3aa19c[_0x3a8b6b(0xde)]))throw _0x3aa19c;}if(_0x19b607>=retries)throw _0x41b14c;const _0x5314b1=getRetryDelay(_0x19b607,this['retryConfig']);let _0x505234;_0x41b14c instanceof HTTPClientError?_0x505234=_0x3a8b6b(0x101)+(_0x19b607+0x1)+'/'+retries+_0x3a8b6b(0x100)+_0x41b14c['status']+':\x20'+_0x41b14c['message']+',\x20'+('retrying\x20in\x20'+Math[_0x3a8b6b(0xe0)](_0x5314b1)+'ms...'):_0x505234=_0x3a8b6b(0x101)+(_0x19b607+0x1)+'/'+retries+_0x3a8b6b(0xf0)+_0x5e3e79+_0x3a8b6b(0xf6)+_0x41b14c[_0x3a8b6b(0xde)]+',\x20'+('retrying\x20in\x20'+Math['round'](_0x5314b1)+_0x3a8b6b(0xef)),console[_0x3a8b6b(0x109)](_0x505234),await this[_0x3a8b6b(0x10d)](_0x5314b1);}}if(_0x41b14c&&!(_0x41b14c instanceof HTTPClientError))throw new SDKError(ErrorCode[_0x3a8b6b(0xe8)],_0x3a8b6b(0xe1)+_0x5e3e79+'\x20failed:\x20'+_0x41b14c[_0x3a8b6b(0xde)],_0x41b14c);throw _0x41b14c||new SDKError(ErrorCode[_0x3a8b6b(0xd6)],_0x3a8b6b(0x11d));}async[a69_0x3d563e(0xfe)](_0x2e0169){const _0x11d64b=a69_0x3d563e,_0x37d9e8=await _0x2e0169[_0x11d64b(0x110)]();if(!_0x37d9e8)return null;try{const _0x4f2a19=a69_0x1cf36c({'storeAsString':!![]});return _0x4f2a19[_0x11d64b(0x121)](_0x37d9e8);}catch{return{'body':_0x37d9e8};}}[a69_0x3d563e(0xd4)](_0x3818d5,_0x350f9f){const _0x158422=a69_0x3d563e;if(!_0x3818d5||typeof _0x3818d5!==_0x158422(0x11a))return undefined;let _0x53316d=_0x3818d5;_0x53316d[_0x158422(0x104)]&&typeof _0x53316d[_0x158422(0x104)]===_0x158422(0x11a)&&(_0x53316d=_0x53316d[_0x158422(0x104)]);if(_0x53316d[_0x158422(0xd2)]||_0x53316d['title']||_0x53316d[_0x158422(0x105)])return{'type':_0x53316d['type']||_0x158422(0x11f),'title':_0x53316d[_0x158422(0xd5)]||_0x158422(0x118),'status':_0x53316d[_0x158422(0xf4)]||_0x350f9f,'detail':_0x53316d[_0x158422(0x105)]||_0x158422(0xf8),'instance':_0x53316d[_0x158422(0x11c)]||'',..._0x53316d};const _0x14141c=_0x53316d[_0x158422(0xde)]||_0x53316d['error']||_0x53316d[_0x158422(0x110)];if(typeof _0x14141c===_0x158422(0xf9))return{'type':_0x158422(0x11f),'title':_0x53316d[_0x158422(0x10f)]||_0x158422(0x118),'status':_0x53316d[_0x158422(0x11e)]||_0x350f9f,'detail':_0x14141c,'instance':'',..._0x53316d};return undefined;}async['handleErrorResponse'](_0x15b0f8){const _0x227716=a69_0x3d563e,_0x190dbd=await this[_0x227716(0xfe)](_0x15b0f8),_0x1b702b=this[_0x227716(0xd4)](_0x190dbd,_0x15b0f8[_0x227716(0xf4)]);_0x190dbd&&this[_0x227716(0x10c)][_0x227716(0x103)]('Error\x20response\x20body:\x20'+JSON[_0x227716(0xe4)](_0x190dbd));let _0x2e4bd7;if(_0x1b702b?.[_0x227716(0x105)])_0x2e4bd7=_0x1b702b[_0x227716(0x105)];else _0x190dbd?_0x2e4bd7=_0x227716(0x114)+_0x15b0f8[_0x227716(0xf4)]+':\x20'+_0x15b0f8['statusText']+'\x0a\x20\x20Details:\x20'+JSON[_0x227716(0xe4)](_0x190dbd):_0x2e4bd7=_0x227716(0x114)+_0x15b0f8[_0x227716(0xf4)]+':\x20'+_0x15b0f8[_0x227716(0x117)];throw new HTTPClientError(_0x2e4bd7,_0x15b0f8[_0x227716(0xf4)],_0x1b702b);}['sleep'](_0x394854){return new Promise(_0x24f2aa=>setTimeout(_0x24f2aa,_0x394854));}[a69_0x3d563e(0x116)](_0x258246){const _0x2f1753=a69_0x3d563e;try{const _0x32f06e=JSON[_0x2f1753(0x121)](_0x258246);return _0x32f06e[_0x2f1753(0x105)]||_0x32f06e[_0x2f1753(0xde)]||_0x32f06e[_0x2f1753(0x102)]||null;}catch{return _0x258246[_0x2f1753(0xe5)]<0x1f4?_0x258246:null;}}async[a69_0x3d563e(0xed)](_0x2b9735,_0x293599,_0x3fe602={}){const _0x414505=a69_0x3d563e,{headers:headers={},body:_0x126fe9,timeout:timeout=0x7530,signal:_0xb3d5f3}=_0x3fe602,_0x55a8f2=''+this[_0x414505(0xec)]+_0x293599,_0x291f6f={...this[_0x414505(0x123)],...headers},_0x1497d7=new AbortController(),_0x44128d=setTimeout(()=>_0x1497d7['abort'](),timeout),_0xabb4f2=_0xb3d5f3?[_0x1497d7[_0x414505(0x10b)],_0xb3d5f3]:[_0x1497d7[_0x414505(0x10b)]],_0x57d5ed=this['combineSignals'](_0xabb4f2);try{const _0x1cc4b4={'method':_0x2b9735,'headers':_0x291f6f,'signal':_0x57d5ed};if(_0x126fe9){if(typeof _0x126fe9===_0x414505(0xf9))_0x1cc4b4[_0x414505(0x120)]=_0x126fe9;else _0x126fe9 instanceof Buffer?_0x1cc4b4['body']=_0x126fe9:_0x1cc4b4['body']=JSON[_0x414505(0xe4)](_0x126fe9);}const _0x6afc88=await fetch(_0x55a8f2,_0x1cc4b4);return clearTimeout(_0x44128d),!_0x6afc88['ok']&&await this[_0x414505(0x10e)](_0x6afc88),_0x6afc88;}catch(_0x3ed781){clearTimeout(_0x44128d);if(_0x3ed781 instanceof HTTPClientError)throw _0x3ed781;if(_0x3ed781[_0x414505(0x107)]===_0x414505(0xff))throw new Error(_0x414505(0xe2));throw _0x3ed781;}}['combineSignals'](_0x4e9934){const _0x38f444=a69_0x3d563e,_0x3c39e9=new AbortController();for(const _0x51c24b of _0x4e9934){if(_0x51c24b['aborted'])return _0x3c39e9[_0x38f444(0xda)](),_0x3c39e9[_0x38f444(0x10b)];_0x51c24b[_0x38f444(0xdf)](_0x38f444(0xda),()=>_0x3c39e9[_0x38f444(0xda)](),{'once':!![]});}return _0x3c39e9[_0x38f444(0x10b)];}}
|
|
1
|
+
const a69_0x9a23=a69_0x2f3f;(function(_0x205658,_0x12f2c3){const _0x38ac2e=a69_0x2f3f,_0x16794e=_0x205658();while(!![]){try{const _0x2c7623=-parseInt(_0x38ac2e(0x1d2))/0x1*(-parseInt(_0x38ac2e(0x1c7))/0x2)+parseInt(_0x38ac2e(0x1c5))/0x3+parseInt(_0x38ac2e(0x20b))/0x4*(parseInt(_0x38ac2e(0x207))/0x5)+parseInt(_0x38ac2e(0x20f))/0x6+parseInt(_0x38ac2e(0x219))/0x7*(parseInt(_0x38ac2e(0x1c4))/0x8)+parseInt(_0x38ac2e(0x1f0))/0x9*(-parseInt(_0x38ac2e(0x1e1))/0xa)+-parseInt(_0x38ac2e(0x20e))/0xb*(parseInt(_0x38ac2e(0x218))/0xc);if(_0x2c7623===_0x12f2c3)break;else _0x16794e['push'](_0x16794e['shift']());}catch(_0x1fd6ed){_0x16794e['push'](_0x16794e['shift']());}}}(a69_0x4b18,0xe2ce5));function a69_0x2f3f(_0x1df70e,_0x2b5746){_0x1df70e=_0x1df70e-0x1be;const _0x4b1834=a69_0x4b18();let _0x2f3fcb=_0x4b1834[_0x1df70e];return _0x2f3fcb;}import{ErrorCode,SDKError}from'../errors.js';import a69_0x2f77b0 from'json-bigint';const DEFAULT_RETRY_CONFIG={'maxRetries':0x3,'baseDelay':0x3e8,'maxDelay':0x1f40};function isRetryableStatus(_0x4b30c1){return _0x4b30c1>=0x1f4||_0x4b30c1===0x1ad;}function isNonRetryable429(_0xf98d15){const _0x2f4844=a69_0x2f3f;return _0xf98d15[_0x2f4844(0x1ce)](_0x2f4844(0x1c3));}function a69_0x4b18(){const _0x4c0308=['756TgBDgd','14ULfInT','abort','logger','INTERNAL','An\x20error\x20occurred','string','\x20failed:\x20','already\x20running','2695720AaKgMm','1369674PiwaeP','extractErrorMessage','2NshoTD','NOT_FOUND','handleErrorResponse','request',']\x20Request\x20to\x20','pow','retrying\x20in\x20','includes',']\x20Request\x20failed\x20with\x20HTTP\x20','type','baseUrl','673245qrKQKF','Error','errors','maxDelay','info','maxRetries','sleep','statusText','combineSignals','PERMISSION_DENIED','error','defaultHeaders','RATE_LIMITED','retryConfig','title','70qlTHSt','debug','safeParseJSON','name','status','severity','stringify','Request\x20cancelled\x20by\x20user','from','Error\x20response\x20body:\x20','Content-Type','HTTP_REQUEST_FAILURE','ms...','request\x20body:\x20','instance','1089162gqXzVt','[Retry\x20','forEach','HTTPClientError','message','Request\x20to\x20','HTTP\x20','arrayBuffer','Request\x20failed\x20after\x20retries','code','get','length','round','min','aborted','signal','UNAVAILABLE','warn','AbortError','text','body','addEventListener','application/json','8816890QTEjQS','json','arraybuffer','detail','4KPnSUG','about:blank','parse','486343csESoR','5966586PrBlLM','problemDetails','INVALID_ARGUMENT',']\x20Request\x20failed\x20with\x20','headers','object','\x0a\x20\x20Details:\x20','[binary\x20data]','parseProblemDetails'];a69_0x4b18=function(){return _0x4c0308;};return a69_0x4b18();}function getRetryDelay(_0xb3de0c,_0xc7f860){const _0x478358=a69_0x2f3f,_0x107dbe=Math[_0x478358(0x1fd)](_0xc7f860['baseDelay']*Math[_0x478358(0x1cc)](0x2,_0xb3de0c),_0xc7f860[_0x478358(0x1d5)]);return Math['random']()*_0x107dbe;}function statusCodeToErrorCode(_0x25fc48){const _0x12445e=a69_0x2f3f;if(_0x25fc48===0x191)return ErrorCode['UNAUTHENTICATED'];else{if(_0x25fc48===0x193)return ErrorCode[_0x12445e(0x1db)];else{if(_0x25fc48===0x194)return ErrorCode[_0x12445e(0x1c8)];else{if(_0x25fc48===0x1ad)return ErrorCode[_0x12445e(0x1de)];else return _0x25fc48>=0x1f4?ErrorCode[_0x12445e(0x200)]:ErrorCode[_0x12445e(0x211)];}}}}export class HTTPClientError extends Error{[a69_0x9a23(0x1e5)];[a69_0x9a23(0x210)];[a69_0x9a23(0x1f9)];constructor(_0x5ac789,_0x4ab782,_0x4405d7){const _0x933184=a69_0x9a23,_0x5696b5=statusCodeToErrorCode(_0x4ab782);super('['+_0x5696b5+']\x20'+_0x5ac789),this[_0x933184(0x1e5)]=_0x4ab782,this[_0x933184(0x210)]=_0x4405d7,this[_0x933184(0x1e4)]=_0x933184(0x1f3),this['code']=_0x5696b5;}}export class HTTPClient{[a69_0x9a23(0x1df)];[a69_0x9a23(0x1d1)];[a69_0x9a23(0x1dd)];[a69_0x9a23(0x1be)];constructor(_0x2dceb7,_0x4afbb8,_0x52c896,_0x13bf00){const _0x53ee28=a69_0x9a23;this['baseUrl']=_0x2dceb7,this[_0x53ee28(0x1dd)]=_0x4afbb8,this[_0x53ee28(0x1df)]={...DEFAULT_RETRY_CONFIG,..._0x13bf00},this['logger']=_0x52c896;}async[a69_0x9a23(0x1ca)](_0x23420b,_0x1e7add,_0x88f7ed={}){const _0x5cafc8=a69_0x9a23,{headers:headers={},body:_0x9e645c,timeout:timeout=0x7530,retries:retries=this[_0x5cafc8(0x1df)][_0x5cafc8(0x1d7)],signal:_0x571854,includeHeaders:includeHeaders=![],responseType:responseType=_0x5cafc8(0x208)}=_0x88f7ed,_0x1814da=''+this[_0x5cafc8(0x1d1)]+_0x1e7add;this['logger'][_0x5cafc8(0x1d6)]('Request:\x20'+_0x23420b+'\x20'+_0x1814da);const _0xd02994={...this[_0x5cafc8(0x1dd)],...headers};if(_0x9e645c&&!_0xd02994[_0x5cafc8(0x1eb)]){if(_0x9e645c instanceof Buffer){}else _0xd02994[_0x5cafc8(0x1eb)]=_0x5cafc8(0x206);}let _0x2a12b7;_0x9e645c&&(_0x9e645c instanceof Buffer?_0x2a12b7=_0x9e645c:_0x2a12b7=typeof _0x9e645c===_0x5cafc8(0x1c1)?_0x9e645c:JSON[_0x5cafc8(0x1e7)](_0x9e645c));_0x2a12b7&&this[_0x5cafc8(0x1be)][_0x5cafc8(0x1e2)](_0x5cafc8(0x1ee)+(typeof _0x2a12b7===_0x5cafc8(0x1c1)?_0x2a12b7:_0x5cafc8(0x216)));let _0x28ea9e=null;for(let _0x502b43=0x0;_0x502b43<=retries;_0x502b43++){try{const _0x4f3b0a=new AbortController(),_0x55850e=setTimeout(()=>_0x4f3b0a[_0x5cafc8(0x21a)](),timeout);if(_0x571854){if(_0x571854[_0x5cafc8(0x1fe)])throw new Error(_0x5cafc8(0x1e8));_0x571854[_0x5cafc8(0x205)](_0x5cafc8(0x21a),()=>_0x4f3b0a[_0x5cafc8(0x21a)](),{'once':!![]});}const _0x8ac823=await fetch(_0x1814da,{'method':_0x23420b,'headers':_0xd02994,'body':_0x2a12b7,'signal':_0x4f3b0a[_0x5cafc8(0x1ff)]});clearTimeout(_0x55850e);if(_0x502b43<retries&&isRetryableStatus(_0x8ac823[_0x5cafc8(0x1e5)])){if(_0x8ac823[_0x5cafc8(0x1e5)]===0x1ad){const _0x483972=await _0x8ac823[_0x5cafc8(0x203)]();if(isNonRetryable429(_0x483972)){const _0x56d847=this[_0x5cafc8(0x1c6)](_0x483972)||_0x8ac823['statusText'];throw new HTTPClientError(_0x56d847,_0x8ac823[_0x5cafc8(0x1e5)]);}}const _0x2ed814=_0x8ac823['headers'][_0x5cafc8(0x1fa)]('Retry-After'),_0xda79c1=_0x2ed814?parseInt(_0x2ed814,0xa)*0x3e8:getRetryDelay(_0x502b43,this[_0x5cafc8(0x1df)]);console[_0x5cafc8(0x201)](_0x5cafc8(0x1f1)+(_0x502b43+0x1)+'/'+retries+_0x5cafc8(0x212)+_0x8ac823['status']+',\x20'+(_0x5cafc8(0x1cd)+Math[_0x5cafc8(0x1fc)](_0xda79c1)+_0x5cafc8(0x1ed))),await this[_0x5cafc8(0x1d8)](_0xda79c1);continue;}!_0x8ac823['ok']&&await this['handleErrorResponse'](_0x8ac823);let _0x271326;if(responseType===_0x5cafc8(0x209)){const _0x3a2bdd=await _0x8ac823[_0x5cafc8(0x1f7)]();_0x271326=Buffer[_0x5cafc8(0x1e9)](_0x3a2bdd);}else responseType===_0x5cafc8(0x203)?_0x271326=await _0x8ac823[_0x5cafc8(0x203)]():_0x271326=await this['safeParseJSON'](_0x8ac823);this['logger'][_0x5cafc8(0x1e2)]('Response\x20['+_0x8ac823[_0x5cafc8(0x1e5)]+']:\x20'+_0x23420b+'\x20'+_0x1e7add),this[_0x5cafc8(0x1be)]['trace'](JSON[_0x5cafc8(0x1e7)](_0x271326,null,0x2));if(includeHeaders){const _0x3d5344={};return _0x8ac823[_0x5cafc8(0x213)][_0x5cafc8(0x1f2)]((_0x37ea66,_0x4d975d)=>{_0x3d5344[_0x4d975d]=_0x37ea66;}),{'data':_0x271326,'status':_0x8ac823['status'],'headers':_0x3d5344};}return _0x271326;}catch(_0x3628a8){_0x28ea9e=_0x3628a8 instanceof Error?_0x3628a8:new Error(String(_0x3628a8));if(_0x3628a8 instanceof HTTPClientError){if(!isRetryableStatus(_0x3628a8['status'])||_0x3628a8[_0x5cafc8(0x1e5)]===0x1ad&&isNonRetryable429(_0x3628a8['message']))throw _0x3628a8;}if(_0x502b43>=retries)throw _0x28ea9e;const _0x4225e2=getRetryDelay(_0x502b43,this['retryConfig']);let _0x6e209f;_0x28ea9e instanceof HTTPClientError?_0x6e209f=_0x5cafc8(0x1f1)+(_0x502b43+0x1)+'/'+retries+_0x5cafc8(0x1cf)+_0x28ea9e[_0x5cafc8(0x1e5)]+':\x20'+_0x28ea9e[_0x5cafc8(0x1f4)]+',\x20'+(_0x5cafc8(0x1cd)+Math['round'](_0x4225e2)+_0x5cafc8(0x1ed)):_0x6e209f=_0x5cafc8(0x1f1)+(_0x502b43+0x1)+'/'+retries+_0x5cafc8(0x1cb)+_0x1814da+_0x5cafc8(0x1c2)+_0x28ea9e[_0x5cafc8(0x1f4)]+',\x20'+(_0x5cafc8(0x1cd)+Math[_0x5cafc8(0x1fc)](_0x4225e2)+_0x5cafc8(0x1ed)),console[_0x5cafc8(0x201)](_0x6e209f),await this[_0x5cafc8(0x1d8)](_0x4225e2);}}if(_0x28ea9e&&!(_0x28ea9e instanceof HTTPClientError))throw new SDKError(ErrorCode[_0x5cafc8(0x1ec)],_0x5cafc8(0x1f5)+_0x1814da+_0x5cafc8(0x1c2)+_0x28ea9e[_0x5cafc8(0x1f4)],_0x28ea9e);throw _0x28ea9e||new SDKError(ErrorCode[_0x5cafc8(0x1bf)],_0x5cafc8(0x1f8));}async['safeParseJSON'](_0x22899f){const _0x1281ea=a69_0x9a23,_0x4f7508=await _0x22899f[_0x1281ea(0x203)]();if(!_0x4f7508)return null;try{const _0xd7a7ff=a69_0x2f77b0({'storeAsString':!![]});return _0xd7a7ff[_0x1281ea(0x20d)](_0x4f7508);}catch{return{'body':_0x4f7508};}}['parseProblemDetails'](_0x14d636,_0x5dd266){const _0x595e54=a69_0x9a23;if(!_0x14d636||typeof _0x14d636!==_0x595e54(0x214))return undefined;let _0x51f83b=_0x14d636;_0x51f83b[_0x595e54(0x1d4)]&&typeof _0x51f83b[_0x595e54(0x1d4)]===_0x595e54(0x214)&&(_0x51f83b=_0x51f83b['errors']);if(_0x51f83b[_0x595e54(0x1d0)]||_0x51f83b['title']||_0x51f83b[_0x595e54(0x20a)])return{'type':_0x51f83b[_0x595e54(0x1d0)]||_0x595e54(0x20c),'title':_0x51f83b[_0x595e54(0x1e0)]||_0x595e54(0x1d3),'status':_0x51f83b[_0x595e54(0x1e5)]||_0x5dd266,'detail':_0x51f83b[_0x595e54(0x20a)]||_0x595e54(0x1c0),'instance':_0x51f83b[_0x595e54(0x1ef)]||'',..._0x51f83b};const _0x50c511=_0x51f83b[_0x595e54(0x1f4)]||_0x51f83b[_0x595e54(0x1dc)]||_0x51f83b[_0x595e54(0x203)];if(typeof _0x50c511==='string')return{'type':_0x595e54(0x20c),'title':_0x51f83b[_0x595e54(0x1e6)]||_0x595e54(0x1d3),'status':_0x51f83b['status_code']||_0x5dd266,'detail':_0x50c511,'instance':'',..._0x51f83b};return undefined;}async[a69_0x9a23(0x1c9)](_0x49595d){const _0x53d7d9=a69_0x9a23,_0x31d870=await this[_0x53d7d9(0x1e3)](_0x49595d),_0x45a307=this[_0x53d7d9(0x217)](_0x31d870,_0x49595d[_0x53d7d9(0x1e5)]);_0x31d870&&this[_0x53d7d9(0x1be)][_0x53d7d9(0x1e2)](_0x53d7d9(0x1ea)+JSON['stringify'](_0x31d870));let _0x10d27c;if(_0x45a307?.[_0x53d7d9(0x20a)])_0x10d27c=_0x45a307[_0x53d7d9(0x20a)];else _0x31d870?_0x10d27c='HTTP\x20'+_0x49595d[_0x53d7d9(0x1e5)]+':\x20'+_0x49595d['statusText']+_0x53d7d9(0x215)+JSON[_0x53d7d9(0x1e7)](_0x31d870):_0x10d27c=_0x53d7d9(0x1f6)+_0x49595d[_0x53d7d9(0x1e5)]+':\x20'+_0x49595d[_0x53d7d9(0x1d9)];throw new HTTPClientError(_0x10d27c,_0x49595d[_0x53d7d9(0x1e5)],_0x45a307);}['sleep'](_0x3a1d6a){return new Promise(_0x1bb411=>setTimeout(_0x1bb411,_0x3a1d6a));}[a69_0x9a23(0x1c6)](_0x51983d){const _0x5d4e96=a69_0x9a23;try{const _0x3c2465=JSON[_0x5d4e96(0x20d)](_0x51983d);return _0x3c2465[_0x5d4e96(0x20a)]||_0x3c2465[_0x5d4e96(0x1f4)]||_0x3c2465[_0x5d4e96(0x1dc)]||null;}catch{return _0x51983d[_0x5d4e96(0x1fb)]<0x1f4?_0x51983d:null;}}async['requestSSE'](_0x8e9407,_0x40bab9,_0xf0a0d2={}){const _0x531f7a=a69_0x9a23,{headers:headers={},body:_0x1347b9,timeout:timeout=0x7530,signal:_0xccaf02}=_0xf0a0d2,_0x8262=''+this[_0x531f7a(0x1d1)]+_0x40bab9,_0x204372={...this[_0x531f7a(0x1dd)],...headers},_0x4fd4e9=new AbortController(),_0x3a0f7f=setTimeout(()=>_0x4fd4e9[_0x531f7a(0x21a)](),timeout),_0x541ec5=_0xccaf02?[_0x4fd4e9['signal'],_0xccaf02]:[_0x4fd4e9[_0x531f7a(0x1ff)]],_0xa1fc0b=this[_0x531f7a(0x1da)](_0x541ec5);try{const _0x12484d={'method':_0x8e9407,'headers':_0x204372,'signal':_0xa1fc0b};if(_0x1347b9){if(typeof _0x1347b9===_0x531f7a(0x1c1))_0x12484d['body']=_0x1347b9;else _0x1347b9 instanceof Buffer?_0x12484d[_0x531f7a(0x204)]=_0x1347b9:_0x12484d['body']=JSON['stringify'](_0x1347b9);}const _0x13a4c2=await fetch(_0x8262,_0x12484d);return clearTimeout(_0x3a0f7f),!_0x13a4c2['ok']&&await this[_0x531f7a(0x1c9)](_0x13a4c2),_0x13a4c2;}catch(_0x1a9409){clearTimeout(_0x3a0f7f);if(_0x1a9409 instanceof HTTPClientError)throw _0x1a9409;if(_0x1a9409[_0x531f7a(0x1e4)]===_0x531f7a(0x202))throw new Error('Request\x20cancelled\x20by\x20user');throw _0x1a9409;}}[a69_0x9a23(0x1da)](_0x1d98bd){const _0x1c5690=a69_0x9a23,_0x1327b8=new AbortController();for(const _0x345f51 of _0x1d98bd){if(_0x345f51[_0x1c5690(0x1fe)])return _0x1327b8[_0x1c5690(0x21a)](),_0x1327b8[_0x1c5690(0x1ff)];_0x345f51['addEventListener']('abort',()=>_0x1327b8['abort'](),{'once':!![]});}return _0x1327b8[_0x1c5690(0x1ff)];}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a70_0x9931fc=a70_0xffc2;(function(_0x4236ac,_0x403662){const _0x3dfc9f=a70_0xffc2,_0x4d8959=_0x4236ac();while(!![]){try{const _0x10a5b4=parseInt(_0x3dfc9f(0x15b))/0x1+parseInt(_0x3dfc9f(0xfc))/0x2*(-parseInt(_0x3dfc9f(0x132))/0x3)+parseInt(_0x3dfc9f(0x11e))/0x4+-parseInt(_0x3dfc9f(0x142))/0x5*(-parseInt(_0x3dfc9f(0x140))/0x6)+-parseInt(_0x3dfc9f(0x118))/0x7*(-parseInt(_0x3dfc9f(0x104))/0x8)+parseInt(_0x3dfc9f(0x15c))/0x9+-parseInt(_0x3dfc9f(0x10a))/0xa;if(_0x10a5b4===_0x403662)break;else _0x4d8959['push'](_0x4d8959['shift']());}catch(_0x154fc3){_0x4d8959['push'](_0x4d8959['shift']());}}}(a70_0x2d4e,0xa9764));function a70_0xffc2(_0x3eaa5b,_0x45bd17){_0x3eaa5b=_0x3eaa5b-0xe7;const _0x2d4e40=a70_0x2d4e();let _0xffc2f8=_0x2d4e40[_0x3eaa5b];return _0xffc2f8;}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 a70_0x2d4e(){const _0x331da4=['webSearchTools','description','temperature','getChatHistory','38mjMgVl','/api/integrations','integrations','httpClient','&page[limit]=50','updateAgentResponse','map','-last_conversation_at','8cuUeBx','/api/users/current_settings','Failed\x20to\x20create\x20chat:\x20unexpected\x20error','getChatInfo','?filter[project_id]=','/api/tool_targets?filter[targetType]=ImageGenerator&filter[project_id]=','31268500SmkjYy','Failed\x20to\x20continue\x20chat\x20(chatId:\x20','/api/projects','continueChat','request','/api/chats?','/api/prompts?filter[projectId]=','getUserSettings','createPrompt','/api/text_knowledge_bases','site','getAgent','DELETE','startsWith','6434435BHHfdN','listIntegrations','/api/knowledge_bases?filter[projectId]=','Continuing\x20chat\x20','createTextKnowledgeBase','http','3154352YRiDrh','startChat','projects','reasoningEffort','createAgent','debug','listKnowledgeBases','/api/integrations?filter[projectId]=','baseUrl','application/vnd.api+json','data','/api/tool_targets?filter[targetType]=TextKnowledgeBase&filter[project_id]=','createAgentResponse','userLocation','PATCH','projectId','/api/chats/','createImageGenerator','gpt-4o','createIntegration','10704YjOVKE','/api/prompts','medium','/api/projects/','prompts','nova-canvas','Please\x20provide\x20a\x20non-empty\x20message\x20to\x20continue\x20the\x20chat.','filters','createWebSearchTool','systemPrompt','maxToolIterations','createProject','LLM_EMPTY_MESSAGE','prompt','1806OPqwpN','/api/chats','5155qklYYL','/api/projects?page[limit]=',']\x20Chat\x20creation\x20returned\x20empty\x20ID,\x20retrying\x20in\x20','chats','knowledge_bases','/api/image_generators','listPrompts','updateTextKnowledgeBase','append','imageGenerators','push','LLM_STREAM_ERROR','[Retry\x20','updateKnowledgeBase','links','You\x20are\x20a\x20helpful\x20search\x20assistant.','imageModelType','page[limit]','/history','San\x20Francisco','textKnowledgeBases','trim','toString','GET','ms...','649947oizEmJ','10986183zvtwbb','deleteAgent','requestSSE','/api/agents/','listImageGenerators','\x20characters','search','/api/prompts/','agents','logger','/api/text_knowledge_bases/','/api/tool_targets?filter[targetType]=WebSearchTool&filter[project_id]=','\x20attempts:\x20API\x20returned\x20empty\x20chat\x20ID','getProject','starterMessage','length','authHeaders','listProjects','name','application/json','/api/agents','createKnowledgeBase','listAgents','POST','Message\x20cannot\x20be\x20empty\x20or\x20whitespace\x20only','status','paginateAll','/api/knowledge_bases/','LLM_CHAT_CREATION_FAILURE'];a70_0x2d4e=function(){return _0x331da4;};return a70_0x2d4e();}import{ErrorCode,SDKError}from'../errors.js';export class LLMApiClient{[a70_0x9931fc(0xff)];[a70_0x9931fc(0x126)];[a70_0x9931fc(0xeb)];[a70_0x9931fc(0x165)];constructor(_0x21ef5d,_0x1eef5b){const _0x2c8b9b=a70_0x9931fc;this[_0x2c8b9b(0x126)]=getEndpoint(_0x21ef5d[_0x2c8b9b(0x114)],'llm'),this['authHeaders']=toHeaderRecord(getAuthHeaders(_0x21ef5d['site'],_0x21ef5d['apiKey'])),this['logger']=_0x1eef5b,this[_0x2c8b9b(0xff)]=new HTTPClient(this['baseUrl'],this['authHeaders'],_0x1eef5b);}async[a70_0x9931fc(0xf5)](_0x2adc73){const _0x52a35e=a70_0x9931fc,_0x20bc98=[];let _0x25e98b=_0x2adc73;while(_0x25e98b){const _0x39bd48=await this[_0x52a35e(0xff)]['request'](_0x52a35e(0x159),_0x25e98b);_0x39bd48[_0x52a35e(0x128)]&&_0x20bc98[_0x52a35e(0x14c)](..._0x39bd48['data']);_0x25e98b=_0x39bd48[_0x52a35e(0x150)]?.['next'];if(_0x25e98b&&_0x25e98b[_0x52a35e(0x117)](_0x52a35e(0x11d))){const _0x14eb02=new URL(_0x25e98b);_0x25e98b=_0x14eb02['pathname']+_0x14eb02[_0x52a35e(0x162)];}}return _0x20bc98;}async[a70_0x9931fc(0x111)](){const _0x5a509b=a70_0x9931fc;return await this[_0x5a509b(0xff)][_0x5a509b(0x10e)](_0x5a509b(0x159),_0x5a509b(0x105));}async[a70_0x9931fc(0x13d)](_0x175763){const _0x984599=a70_0x9931fc,_0x1bde4a={'data':{'type':_0x984599(0x120),'attributes':{'name':_0x175763[_0x984599(0xed)],..._0x175763[_0x984599(0xf9)]&&{'description':_0x175763[_0x984599(0xf9)]}}}},_0x53a8b9=await this['httpClient'][_0x984599(0x10e)](_0x984599(0xf2),_0x984599(0x10c),{'headers':{'Content-Type':_0x984599(0x127),'Accept':'application/vnd.api+json'},'body':_0x1bde4a});return _0x53a8b9[_0x984599(0x128)];}async['deleteProject'](_0x4e7bf4){const _0x536ee4=a70_0x9931fc,_0x554116=_0x536ee4(0x135)+encodeURIComponent(_0x4e7bf4);await this[_0x536ee4(0xff)][_0x536ee4(0x10e)](_0x536ee4(0x116),_0x554116);}async[a70_0x9931fc(0xec)](_0x2fc17c=0x32){const _0x3ceee4=a70_0x9931fc;return this[_0x3ceee4(0xf5)](_0x3ceee4(0x143)+_0x2fc17c);}async[a70_0x9931fc(0xf1)](_0x4a298f){const _0x2042ad=a70_0x9931fc;let _0xc4fb18='/api/agents';_0x4a298f&&(_0xc4fb18+=_0x2042ad(0x108)+encodeURIComponent(_0x4a298f));const _0x26448e=await this[_0x2042ad(0xff)][_0x2042ad(0x10e)](_0x2042ad(0x159),_0xc4fb18);return _0x26448e[_0x2042ad(0x128)]||[];}async[a70_0x9931fc(0x115)](_0x52659f){const _0x20915b=a70_0x9931fc,_0x4a9862='/api/agents/'+encodeURIComponent(_0x52659f),_0x3e13b4=await this[_0x20915b(0xff)][_0x20915b(0x10e)](_0x20915b(0x159),_0x4a9862);return _0x3e13b4[_0x20915b(0x128)];}async[a70_0x9931fc(0x122)](_0x1601e0){const _0x533787=a70_0x9931fc,_0x1b5f09={'name':_0x1601e0['name'],'projectId':_0x1601e0[_0x533787(0x12d)],'modelType':_0x1601e0['modelType'],'maxToolIterations':_0x1601e0[_0x533787(0x13c)]??0x4,'temperature':_0x1601e0[_0x533787(0xfa)]??0.7};_0x1601e0[_0x533787(0x13b)]!==undefined&&(_0x1b5f09[_0x533787(0x13b)]=_0x1601e0['systemPrompt']);_0x1601e0[_0x533787(0xe9)]&&(_0x1b5f09['starterMessage']=_0x1601e0[_0x533787(0xe9)]);_0x1601e0[_0x533787(0x121)]&&(_0x1b5f09[_0x533787(0x121)]=_0x1601e0[_0x533787(0x121)]);const _0x23c1dd={'data':{'type':'agents','attributes':_0x1b5f09}},_0x1ffd09=await this['httpClient'][_0x533787(0x10e)](_0x533787(0xf2),_0x533787(0xef),{'headers':{'Content-Type':'application/vnd.api+json','Accept':_0x533787(0x127)},'body':_0x23c1dd});return _0x1ffd09[_0x533787(0x128)];}async['updateAgent'](_0x2a77b1,_0x4af015){const _0x1a36bc=a70_0x9931fc,_0x341786={'data':{'type':_0x1a36bc(0x164),'id':_0x2a77b1,'attributes':{..._0x4af015[_0x1a36bc(0xed)]&&{'name':_0x4af015['name']},..._0x4af015[_0x1a36bc(0xf9)]&&{'description':_0x4af015['description']},..._0x4af015[_0x1a36bc(0x13f)]&&{'prompt':_0x4af015[_0x1a36bc(0x13f)]},..._0x4af015[_0x1a36bc(0xe9)]&&{'starter_message':_0x4af015[_0x1a36bc(0xe9)]},..._0x4af015[_0x1a36bc(0x121)]&&{'reasoningEffort':_0x4af015['reasoningEffort']}}}},_0x3ee641=_0x1a36bc(0x15f)+encodeURIComponent(_0x2a77b1),_0x4ec0ed=await this[_0x1a36bc(0xff)][_0x1a36bc(0x10e)](_0x1a36bc(0x12c),_0x3ee641,{'body':_0x341786});return _0x4ec0ed[_0x1a36bc(0x128)];}async[a70_0x9931fc(0x15d)](_0x342a2e){const _0x1254b3=a70_0x9931fc,_0x3cd412=_0x1254b3(0x15f)+encodeURIComponent(_0x342a2e);await this[_0x1254b3(0xff)][_0x1254b3(0x10e)](_0x1254b3(0x116),_0x3cd412);}async['listChats'](_0x100c19=0x32){const _0x39293b=a70_0x9931fc,_0xd71608=new URLSearchParams();_0xd71608[_0x39293b(0x14a)](_0x39293b(0x153),String(_0x100c19)),_0xd71608['append']('sort',_0x39293b(0x103));const _0x316f84=_0x39293b(0x10f)+_0xd71608[_0x39293b(0x158)](),_0x1bb0c1=await this[_0x39293b(0xff)][_0x39293b(0x10e)](_0x39293b(0x159),_0x316f84);return _0x1bb0c1['data']||[];}async[a70_0x9931fc(0x107)](_0xe85608){const _0x2a2f97=a70_0x9931fc,_0x44ca26='/api/chats/'+encodeURIComponent(_0xe85608),_0x6e86b2=await this[_0x2a2f97(0xff)]['request']('GET',_0x44ca26);return _0x6e86b2[_0x2a2f97(0x128)];}async[a70_0x9931fc(0xfb)](_0x4649e5){const _0x48dbc6=a70_0x9931fc,_0x5b5de9=_0x48dbc6(0x12e)+encodeURIComponent(_0x4649e5)+_0x48dbc6(0x154);return await this['httpClient'][_0x48dbc6(0x10e)](_0x48dbc6(0x159),_0x5b5de9);}async[a70_0x9931fc(0x11f)](_0x2403a6){const _0x132307=a70_0x9931fc,_0x20ea4b={'data':{'type':_0x132307(0x145),'attributes':{'agentId':_0x2403a6['agentId']}}},_0x8f9ca3=0x3,_0x39e86b=[0x3e8,0x7d0,0xfa0];for(let _0x5d2b80=0x0;_0x5d2b80<=_0x8f9ca3;_0x5d2b80++){const _0x1f27e7=await this[_0x132307(0xff)][_0x132307(0x10e)](_0x132307(0xf2),_0x132307(0x141),{'headers':{'Content-Type':_0x132307(0x127),'Accept':_0x132307(0x127)},'body':_0x20ea4b});if(_0x1f27e7[_0x132307(0x128)]&&_0x1f27e7[_0x132307(0x128)]['id'])return _0x1f27e7[_0x132307(0x128)];if(_0x5d2b80>=_0x8f9ca3)throw new SDKError(ErrorCode[_0x132307(0xf7)],'Failed\x20to\x20create\x20chat\x20after\x20'+(_0x8f9ca3+0x1)+_0x132307(0xe7));const _0x379491=_0x39e86b[_0x5d2b80];console['warn'](_0x132307(0x14e)+(_0x5d2b80+0x1)+'/'+_0x8f9ca3+_0x132307(0x144)+_0x379491+_0x132307(0x15a)),await new Promise(_0x1911bf=>setTimeout(_0x1911bf,_0x379491));}throw new SDKError(ErrorCode[_0x132307(0xf7)],_0x132307(0x106));}async*[a70_0x9931fc(0x10d)](_0x2406f2,_0x361293,_0x4432e9){const _0x1ffe52=a70_0x9931fc,_0x12124e=_0x361293[_0x1ffe52(0x157)]();if(!_0x12124e)throw new SDKError(ErrorCode[_0x1ffe52(0x13e)],_0x1ffe52(0xf3),undefined,{'helpText':_0x1ffe52(0x138)});this[_0x1ffe52(0x165)]['debug'](_0x1ffe52(0x11b)+_0x2406f2+'\x20with\x20message\x20size:\x20'+_0x361293[_0x1ffe52(0xea)]+_0x1ffe52(0x161));const _0x2dd791=_0x1ffe52(0x12e)+encodeURIComponent(_0x2406f2)+'/continue',_0x4856d1={'input':_0x361293};try{const _0x546002=await this['httpClient'][_0x1ffe52(0x15e)]('POST',_0x2dd791,{'headers':{'Content-Type':_0x1ffe52(0xee),'Accept':'text/event-stream'},'body':_0x4856d1,'signal':_0x4432e9});this[_0x1ffe52(0x165)][_0x1ffe52(0x123)]('['+_0x546002[_0x1ffe52(0xf4)]+']\x20Streaming\x20SSE\x20stream\x20for\x20chatId:\x20'+_0x2406f2),yield*parseSSEStream(_0x546002,this['logger']);}catch(_0x5b2b16){throw new SDKError(ErrorCode[_0x1ffe52(0x14d)],_0x1ffe52(0x10b)+_0x2406f2+',\x20message\x20length:\x20'+_0x361293['length']+')',_0x5b2b16);}}async[a70_0x9931fc(0xe8)](_0x4cffe0){const _0x2fb065=a70_0x9931fc,_0x9dbd93=_0x2fb065(0x135)+encodeURIComponent(_0x4cffe0),_0x120159=await this[_0x2fb065(0xff)]['request'](_0x2fb065(0x159),_0x9dbd93);return _0x120159[_0x2fb065(0x128)];}async[a70_0x9931fc(0x124)](_0x3529bf){const _0xc10c72=a70_0x9931fc;return this[_0xc10c72(0xf5)](_0xc10c72(0x11a)+encodeURIComponent(_0x3529bf)+_0xc10c72(0x100));}async[a70_0x9931fc(0xf0)](_0x4a3724){const _0x5ead08=a70_0x9931fc,_0x1ce8a5={'data':{'type':_0x5ead08(0x146),'attributes':_0x4a3724}},_0x3e7e12=await this[_0x5ead08(0xff)][_0x5ead08(0x10e)](_0x5ead08(0xf2),'/api/knowledge_bases',{'headers':{'Content-Type':_0x5ead08(0x127),'Accept':'application/vnd.api+json'},'body':_0x1ce8a5});return _0x3e7e12['data'];}async['listTextKnowledgeBases'](_0x466475){const _0x452014=a70_0x9931fc,_0x49c700=await this[_0x452014(0xf5)](_0x452014(0x129)+encodeURIComponent(_0x466475)+_0x452014(0x100));return _0x49c700[_0x452014(0x102)](_0x4c1219=>({..._0x4c1219,'type':'textKnowledgeBases'}));}async['getTextKnowledgeBase'](_0x1bd4b7){const _0x12e362=a70_0x9931fc,_0x240326=await this[_0x12e362(0xff)][_0x12e362(0x10e)]('GET',_0x12e362(0x166)+encodeURIComponent(_0x1bd4b7),{'headers':{'Accept':_0x12e362(0x127)}});return _0x240326['data'];}async[a70_0x9931fc(0x11c)](_0x16c35f){const _0xa11cfc=a70_0x9931fc,_0x4491f5={'data':{'type':_0xa11cfc(0x156),'attributes':_0x16c35f}},_0x4e420d=await this[_0xa11cfc(0xff)][_0xa11cfc(0x10e)](_0xa11cfc(0xf2),_0xa11cfc(0x113),{'headers':{'Content-Type':_0xa11cfc(0x127),'Accept':'application/vnd.api+json'},'body':_0x4491f5});return _0x4e420d['data'];}async[a70_0x9931fc(0x149)](_0x411053,_0x51a9a1){const _0x4574f7=a70_0x9931fc,_0x20ae9f={'data':{'type':'textKnowledgeBases','id':_0x411053,'attributes':_0x51a9a1}},_0x2516ce=await this['httpClient'][_0x4574f7(0x10e)](_0x4574f7(0x12c),_0x4574f7(0x166)+encodeURIComponent(_0x411053),{'headers':{'Content-Type':_0x4574f7(0x127),'Accept':_0x4574f7(0x127)},'body':_0x20ae9f});return _0x2516ce['data'];}async[a70_0x9931fc(0x12f)](_0x588a86){const _0x55f025=a70_0x9931fc,_0x85e75c={'data':{'type':_0x55f025(0x14b),'attributes':{..._0x588a86,'imageModelType':_0x588a86[_0x55f025(0x152)]||_0x55f025(0x137),'imageReturnMode':_0x588a86['imageReturnMode']||'ID'}}},_0x1c203c=await this['httpClient'][_0x55f025(0x10e)](_0x55f025(0xf2),_0x55f025(0x147),{'headers':{'Content-Type':'application/vnd.api+json','Accept':_0x55f025(0x127)},'body':_0x85e75c});return _0x1c203c[_0x55f025(0x128)];}async[a70_0x9931fc(0x13a)](_0x203a4f){const _0x224d89=a70_0x9931fc,_0xa871ea={'data':{'type':'webSearchTools','attributes':{'projectId':_0x203a4f[_0x224d89(0x12d)],'name':_0x203a4f[_0x224d89(0xed)],'modelType':_0x203a4f['modelType']||_0x224d89(0x130),'searchContextSize':_0x203a4f['searchContextSize']||_0x224d89(0x134),'userLocation':_0x203a4f[_0x224d89(0x12b)]||{'type':'approximate','country':'US','city':_0x224d89(0x155),'region':'California','timezone':'America/Los_Angeles'},'systemPrompt':_0x203a4f[_0x224d89(0x13b)]||_0x224d89(0x151),'filters':_0x203a4f[_0x224d89(0x139)]||{'allowed_domains':[]}}}},_0x299058=await this[_0x224d89(0xff)][_0x224d89(0x10e)](_0x224d89(0xf2),'/api/web_search_tools',{'headers':{'Content-Type':_0x224d89(0x127),'Accept':'application/vnd.api+json'},'body':_0xa871ea});return _0x299058['data'];}async[a70_0x9931fc(0x160)](_0x25f65e){const _0xbb24ad=a70_0x9931fc,_0x27428a=await this[_0xbb24ad(0xf5)](_0xbb24ad(0x109)+encodeURIComponent(_0x25f65e)+_0xbb24ad(0x100));return _0x27428a[_0xbb24ad(0x102)](_0x7955cd=>({..._0x7955cd,'type':'imageGenerators'}));}async['listWebSearchTools'](_0x502aae){const _0x4507db=a70_0x9931fc,_0x58b4cf=await this[_0x4507db(0xf5)](_0x4507db(0x167)+encodeURIComponent(_0x502aae)+_0x4507db(0x100));return _0x58b4cf[_0x4507db(0x102)](_0x28fb38=>({..._0x28fb38,'type':_0x4507db(0xf8)}));}async[a70_0x9931fc(0x148)](_0x117679){const _0x3f7cc8=a70_0x9931fc;return this[_0x3f7cc8(0xf5)](_0x3f7cc8(0x110)+encodeURIComponent(_0x117679)+_0x3f7cc8(0x100));}async[a70_0x9931fc(0x112)](_0xe669a7){const _0xa0169b=a70_0x9931fc,{jsonSchemaHint:_0x244e4d,..._0x8533dc}=_0xe669a7,_0x5e21b3={'data':{'type':_0xa0169b(0x136),'attributes':_0x8533dc}},_0x7772f4=await this[_0xa0169b(0xff)][_0xa0169b(0x10e)](_0xa0169b(0xf2),_0xa0169b(0x133),{'headers':{'Content-Type':_0xa0169b(0x127),'Accept':_0xa0169b(0x127)},'body':_0x5e21b3});return _0x7772f4[_0xa0169b(0x128)];}async[a70_0x9931fc(0x119)](_0x358509){const _0xf58989=a70_0x9931fc;return this[_0xf58989(0xf5)](_0xf58989(0x125)+encodeURIComponent(_0x358509)+_0xf58989(0x100));}async[a70_0x9931fc(0x131)](_0x584d1e){const _0x1bd9e8=a70_0x9931fc,_0x33b6f8={'data':{'type':_0x1bd9e8(0xfe),'attributes':_0x584d1e}},_0x32447c=await this[_0x1bd9e8(0xff)]['request']('POST',_0x1bd9e8(0xfd),{'headers':{'Content-Type':_0x1bd9e8(0x127),'Accept':_0x1bd9e8(0x127)},'body':_0x33b6f8});return _0x32447c[_0x1bd9e8(0x128)];}async['listAgentsFull'](_0x10834b){const _0x2f3c3d=a70_0x9931fc,_0x29a95c=await this[_0x2f3c3d(0xf1)](_0x10834b),_0x242350=[];for(const _0x4ccd52 of _0x29a95c){const _0x442fad=_0x2f3c3d(0x15f)+encodeURIComponent(_0x4ccd52['id']),_0x574194=await this[_0x2f3c3d(0xff)][_0x2f3c3d(0x10e)](_0x2f3c3d(0x159),_0x442fad);_0x242350[_0x2f3c3d(0x14c)](_0x574194[_0x2f3c3d(0x128)]);}return _0x242350;}async[a70_0x9931fc(0x12a)](_0x1bdc9d){const _0x3601f7=a70_0x9931fc,_0x447852={'data':{'type':_0x3601f7(0x164),'attributes':_0x1bdc9d}},_0xcffe0c=await this[_0x3601f7(0xff)][_0x3601f7(0x10e)](_0x3601f7(0xf2),_0x3601f7(0xef),{'headers':{'Content-Type':_0x3601f7(0x127),'Accept':_0x3601f7(0x127)},'body':_0x447852});return _0xcffe0c['data'];}async[a70_0x9931fc(0x101)](_0x422a5d,_0x57ab6d){const _0xb3d3b1=a70_0x9931fc,_0x367cf7={'data':{'type':_0xb3d3b1(0x164),'id':_0x422a5d,'attributes':_0x57ab6d}},_0x365be3=_0xb3d3b1(0x15f)+encodeURIComponent(_0x422a5d),_0x5d20e5=await this['httpClient'][_0xb3d3b1(0x10e)](_0xb3d3b1(0x12c),_0x365be3,{'headers':{'Content-Type':_0xb3d3b1(0x127),'Accept':_0xb3d3b1(0x127)},'body':_0x367cf7});return _0x5d20e5[_0xb3d3b1(0x128)];}async[a70_0x9931fc(0x14f)](_0x420f68,_0x2b3e21){const _0xd8d0cd=a70_0x9931fc,_0x190a38={'data':{'type':'knowledge_bases','id':_0x420f68,'attributes':_0x2b3e21}},_0x253542=_0xd8d0cd(0xf6)+encodeURIComponent(_0x420f68),_0x53df10=await this[_0xd8d0cd(0xff)]['request'](_0xd8d0cd(0x12c),_0x253542,{'headers':{'Content-Type':_0xd8d0cd(0x127),'Accept':_0xd8d0cd(0x127)},'body':_0x190a38});return _0x53df10['data'];}async['updatePrompt'](_0x311128,_0x20e576){const _0x339f5e=a70_0x9931fc,{jsonSchemaHint:_0xe0ea5c,..._0x3fed99}=_0x20e576,_0x24636d={'data':{'type':_0x339f5e(0x136),'id':_0x311128,'attributes':_0x3fed99}},_0x1f3812=_0x339f5e(0x163)+encodeURIComponent(_0x311128),_0x105caa=await this[_0x339f5e(0xff)][_0x339f5e(0x10e)](_0x339f5e(0x12c),_0x1f3812,{'headers':{'Content-Type':'application/vnd.api+json','Accept':_0x339f5e(0x127)},'body':_0x24636d});return _0x105caa[_0x339f5e(0x128)];}async['updateIntegration'](_0xc93722,_0x56666b){const _0x2819c4=a70_0x9931fc,_0x2b584e={'data':{'type':_0x2819c4(0xfe),'id':_0xc93722,'attributes':_0x56666b}},_0x3a93c0='/api/integrations/'+encodeURIComponent(_0xc93722),_0x4d2a4a=await this[_0x2819c4(0xff)][_0x2819c4(0x10e)]('PATCH',_0x3a93c0,{'headers':{'Content-Type':'application/vnd.api+json','Accept':_0x2819c4(0x127)},'body':_0x2b584e});return _0x4d2a4a[_0x2819c4(0x128)];}}
|
|
1
|
+
const a70_0x28b4f5=a70_0x4abe;(function(_0xdc49c7,_0x586500){const _0x142c12=a70_0x4abe,_0x26d6c3=_0xdc49c7();while(!![]){try{const _0x2576b0=parseInt(_0x142c12(0x13a))/0x1+-parseInt(_0x142c12(0x170))/0x2+-parseInt(_0x142c12(0x164))/0x3*(parseInt(_0x142c12(0x131))/0x4)+parseInt(_0x142c12(0x14e))/0x5*(-parseInt(_0x142c12(0x1a4))/0x6)+-parseInt(_0x142c12(0x161))/0x7+-parseInt(_0x142c12(0x1a7))/0x8+parseInt(_0x142c12(0x17e))/0x9;if(_0x2576b0===_0x586500)break;else _0x26d6c3['push'](_0x26d6c3['shift']());}catch(_0x323904){_0x26d6c3['push'](_0x26d6c3['shift']());}}}(a70_0x2295,0xcc9ca));import{HTTPClient}from'./http-client.js';function a70_0x4abe(_0x38fbc0,_0x26da68){_0x38fbc0=_0x38fbc0-0x12f;const _0x2295ba=a70_0x2295();let _0x4abe28=_0x2295ba[_0x38fbc0];return _0x4abe28;}function a70_0x2295(){const _0x10fdc4=['PATCH','/api/text_knowledge_bases','application/vnd.api+json','medium','listIntegrations','toString','\x20with\x20message\x20size:\x20','filters','Please\x20provide\x20a\x20non-empty\x20message\x20to\x20continue\x20the\x20chat.','3054406wCUjSC','/api/projects','starterMessage','apiKey','deleteProject','knowledge_bases','DELETE','/api/knowledge_bases/','You\x20are\x20a\x20helpful\x20search\x20assistant.','getChatHistory','/api/integrations','[Retry\x20','Message\x20cannot\x20be\x20empty\x20or\x20whitespace\x20only','/api/text_knowledge_bases/','45220572dMdAqf','projectId','http','/api/image_generators','-last_conversation_at','/api/users/current_settings','getUserSettings','createKnowledgeBase','createAgent','createWebSearchTool','listPrompts','listImageGenerators','listChats','agents','/api/chats?','deleteAgent','nova-canvas','LLM_EMPTY_MESSAGE','trim','/api/chats','page[limit]','links','createProject','httpClient','description','textKnowledgeBases','ms...',']\x20Streaming\x20SSE\x20stream\x20for\x20chatId:\x20','createIntegration','\x20attempts:\x20API\x20returned\x20empty\x20chat\x20ID','search','prompts','imageModelType','Failed\x20to\x20create\x20chat:\x20unexpected\x20error','approximate','chats','/api/integrations?filter[projectId]=','/api/knowledge_bases','12jqTmCS','append','/api/web_search_tools','10416048XNCmBe','LLM_STREAM_ERROR','systemPrompt','listProjects','startChat','/api/integrations/','agentId','Continuing\x20chat\x20','listAgents','4aBiSRW','request','/api/chats/','listWebSearchTools','application/json','getProject','Failed\x20to\x20create\x20chat\x20after\x20','Failed\x20to\x20continue\x20chat\x20(chatId:\x20','POST','1258413ABPiVW','requestSSE','map','/api/tool_targets?filter[targetType]=ImageGenerator&filter[project_id]=','modelType','sort','site','status','paginateAll','getTextKnowledgeBase','/api/knowledge_bases?filter[projectId]=','next','logger','/api/agents','updateTextKnowledgeBase','baseUrl','continueChat','imageGenerators','&page[limit]=50','imageReturnMode','2138010iBabDx','authHeaders','reasoningEffort','pathname','/api/projects/','LLM_CHAT_CREATION_FAILURE','/api/agents/','integrations','listKnowledgeBases','/history',',\x20message\x20length:\x20','length','userLocation','/continue','push','updateKnowledgeBase','name','debug','data','4419597gEfuuK','GET',']\x20Chat\x20creation\x20returned\x20empty\x20ID,\x20retrying\x20in\x20','3387141cwwNEu','webSearchTools','updatePrompt'];a70_0x2295=function(){return _0x10fdc4;};return a70_0x2295();}import{getEndpoint}from'../types/index.js';import{getAuthHeaders,toHeaderRecord}from'../../core/auth.js';import{parseSSEStream}from'../../utils/sse-parser.js';import{ErrorCode,SDKError}from'../errors.js';export class LLMApiClient{[a70_0x28b4f5(0x195)];['baseUrl'];[a70_0x28b4f5(0x14f)];[a70_0x28b4f5(0x146)];constructor(_0x5cd4bd,_0x21b1b2){const _0x286077=a70_0x28b4f5;this[_0x286077(0x149)]=getEndpoint(_0x5cd4bd[_0x286077(0x140)],'llm'),this[_0x286077(0x14f)]=toHeaderRecord(getAuthHeaders(_0x5cd4bd['site'],_0x5cd4bd[_0x286077(0x173)])),this['logger']=_0x21b1b2,this['httpClient']=new HTTPClient(this[_0x286077(0x149)],this[_0x286077(0x14f)],_0x21b1b2);}async[a70_0x28b4f5(0x142)](_0xc020ee){const _0x58f745=a70_0x28b4f5,_0x13ff6a=[];let _0x313a76=_0xc020ee;while(_0x313a76){const _0x2ce93f=await this[_0x58f745(0x195)][_0x58f745(0x132)](_0x58f745(0x162),_0x313a76);_0x2ce93f[_0x58f745(0x160)]&&_0x13ff6a[_0x58f745(0x15c)](..._0x2ce93f[_0x58f745(0x160)]);_0x313a76=_0x2ce93f[_0x58f745(0x193)]?.[_0x58f745(0x145)];if(_0x313a76&&_0x313a76['startsWith'](_0x58f745(0x180))){const _0x4d80eb=new URL(_0x313a76);_0x313a76=_0x4d80eb[_0x58f745(0x151)]+_0x4d80eb[_0x58f745(0x19c)];}}return _0x13ff6a;}async[a70_0x28b4f5(0x184)](){const _0x1b9e96=a70_0x28b4f5;return await this[_0x1b9e96(0x195)][_0x1b9e96(0x132)]('GET',_0x1b9e96(0x183));}async[a70_0x28b4f5(0x194)](_0x425aa4){const _0x201b7b=a70_0x28b4f5,_0x3cfee8={'data':{'type':'projects','attributes':{'name':_0x425aa4[_0x201b7b(0x15e)],..._0x425aa4[_0x201b7b(0x196)]&&{'description':_0x425aa4['description']}}}},_0x46b878=await this[_0x201b7b(0x195)][_0x201b7b(0x132)](_0x201b7b(0x139),_0x201b7b(0x171),{'headers':{'Content-Type':_0x201b7b(0x169),'Accept':_0x201b7b(0x169)},'body':_0x3cfee8});return _0x46b878[_0x201b7b(0x160)];}async[a70_0x28b4f5(0x174)](_0x27a62b){const _0x275bd7=a70_0x28b4f5,_0x1f17aa=_0x275bd7(0x152)+encodeURIComponent(_0x27a62b);await this['httpClient'][_0x275bd7(0x132)]('DELETE',_0x1f17aa);}async[a70_0x28b4f5(0x1aa)](_0x121b3e=0x32){const _0x503ca0=a70_0x28b4f5;return this[_0x503ca0(0x142)]('/api/projects?page[limit]='+_0x121b3e);}async[a70_0x28b4f5(0x130)](_0x457510){const _0x37cb44=a70_0x28b4f5;let _0xa8de9e=_0x37cb44(0x147);_0x457510&&(_0xa8de9e+='?filter[project_id]='+encodeURIComponent(_0x457510));const _0x1f66c3=await this[_0x37cb44(0x195)][_0x37cb44(0x132)](_0x37cb44(0x162),_0xa8de9e);return _0x1f66c3[_0x37cb44(0x160)]||[];}async['getAgent'](_0x1cb7b4){const _0x565ca4=a70_0x28b4f5,_0x1ddbec='/api/agents/'+encodeURIComponent(_0x1cb7b4),_0x46d50b=await this[_0x565ca4(0x195)][_0x565ca4(0x132)](_0x565ca4(0x162),_0x1ddbec);return _0x46d50b[_0x565ca4(0x160)];}async[a70_0x28b4f5(0x186)](_0x26cda2){const _0x208476=a70_0x28b4f5,_0x4d0ff7={'name':_0x26cda2[_0x208476(0x15e)],'projectId':_0x26cda2[_0x208476(0x17f)],'modelType':_0x26cda2[_0x208476(0x13e)],'maxToolIterations':_0x26cda2['maxToolIterations']??0x4,'temperature':_0x26cda2['temperature']??0.7};_0x26cda2[_0x208476(0x1a9)]!==undefined&&(_0x4d0ff7[_0x208476(0x1a9)]=_0x26cda2[_0x208476(0x1a9)]);_0x26cda2[_0x208476(0x172)]&&(_0x4d0ff7[_0x208476(0x172)]=_0x26cda2[_0x208476(0x172)]);_0x26cda2[_0x208476(0x150)]&&(_0x4d0ff7['reasoningEffort']=_0x26cda2[_0x208476(0x150)]);const _0x1034aa={'data':{'type':_0x208476(0x18b),'attributes':_0x4d0ff7}},_0x4ed139=await this[_0x208476(0x195)][_0x208476(0x132)](_0x208476(0x139),_0x208476(0x147),{'headers':{'Content-Type':_0x208476(0x169),'Accept':_0x208476(0x169)},'body':_0x1034aa});return _0x4ed139['data'];}async['updateAgent'](_0x21c4e9,_0x2ab7ad){const _0x4cae0c=a70_0x28b4f5,_0x30167a={'data':{'type':_0x4cae0c(0x18b),'id':_0x21c4e9,'attributes':{..._0x2ab7ad['name']&&{'name':_0x2ab7ad[_0x4cae0c(0x15e)]},..._0x2ab7ad[_0x4cae0c(0x196)]&&{'description':_0x2ab7ad['description']},..._0x2ab7ad['prompt']&&{'prompt':_0x2ab7ad['prompt']},..._0x2ab7ad[_0x4cae0c(0x172)]&&{'starter_message':_0x2ab7ad[_0x4cae0c(0x172)]},..._0x2ab7ad[_0x4cae0c(0x150)]&&{'reasoningEffort':_0x2ab7ad[_0x4cae0c(0x150)]}}}},_0x573d48='/api/agents/'+encodeURIComponent(_0x21c4e9),_0x5811e5=await this[_0x4cae0c(0x195)][_0x4cae0c(0x132)]('PATCH',_0x573d48,{'body':_0x30167a});return _0x5811e5[_0x4cae0c(0x160)];}async[a70_0x28b4f5(0x18d)](_0x1b44ef){const _0x254ad9=a70_0x28b4f5,_0x2881d4=_0x254ad9(0x154)+encodeURIComponent(_0x1b44ef);await this[_0x254ad9(0x195)]['request'](_0x254ad9(0x176),_0x2881d4);}async[a70_0x28b4f5(0x18a)](_0x413405=0x32){const _0x10d73f=a70_0x28b4f5,_0x3fbd60=new URLSearchParams();_0x3fbd60['append'](_0x10d73f(0x192),String(_0x413405)),_0x3fbd60[_0x10d73f(0x1a5)](_0x10d73f(0x13f),_0x10d73f(0x182));const _0x35d291=_0x10d73f(0x18c)+_0x3fbd60[_0x10d73f(0x16c)](),_0x18481b=await this[_0x10d73f(0x195)][_0x10d73f(0x132)](_0x10d73f(0x162),_0x35d291);return _0x18481b['data']||[];}async['getChatInfo'](_0x419083){const _0x5763a5=a70_0x28b4f5,_0x3a0387=_0x5763a5(0x133)+encodeURIComponent(_0x419083),_0x3a439d=await this['httpClient'][_0x5763a5(0x132)](_0x5763a5(0x162),_0x3a0387);return _0x3a439d['data'];}async[a70_0x28b4f5(0x179)](_0x2e4481){const _0x438787=a70_0x28b4f5,_0x124483=_0x438787(0x133)+encodeURIComponent(_0x2e4481)+_0x438787(0x157);return await this[_0x438787(0x195)][_0x438787(0x132)](_0x438787(0x162),_0x124483);}async[a70_0x28b4f5(0x1ab)](_0xe15cae){const _0x2699fa=a70_0x28b4f5,_0x368745={'data':{'type':_0x2699fa(0x1a1),'attributes':{'agentId':_0xe15cae[_0x2699fa(0x1ad)]}}},_0x52cec6=0x3,_0x489207=[0x3e8,0x7d0,0xfa0];for(let _0x14bbdc=0x0;_0x14bbdc<=_0x52cec6;_0x14bbdc++){const _0x9a0922=await this[_0x2699fa(0x195)][_0x2699fa(0x132)]('POST',_0x2699fa(0x191),{'headers':{'Content-Type':'application/vnd.api+json','Accept':_0x2699fa(0x169)},'body':_0x368745});if(_0x9a0922[_0x2699fa(0x160)]&&_0x9a0922[_0x2699fa(0x160)]['id'])return _0x9a0922[_0x2699fa(0x160)];if(_0x14bbdc>=_0x52cec6)throw new SDKError(ErrorCode[_0x2699fa(0x153)],_0x2699fa(0x137)+(_0x52cec6+0x1)+_0x2699fa(0x19b));const _0x353f13=_0x489207[_0x14bbdc];console['warn'](_0x2699fa(0x17b)+(_0x14bbdc+0x1)+'/'+_0x52cec6+_0x2699fa(0x163)+_0x353f13+_0x2699fa(0x198)),await new Promise(_0x2feceb=>setTimeout(_0x2feceb,_0x353f13));}throw new SDKError(ErrorCode[_0x2699fa(0x153)],_0x2699fa(0x19f));}async*[a70_0x28b4f5(0x14a)](_0x512e93,_0x2f0a8b,_0x121e49){const _0x5b33ec=a70_0x28b4f5,_0x5b2d27=_0x2f0a8b[_0x5b33ec(0x190)]();if(!_0x5b2d27)throw new SDKError(ErrorCode[_0x5b33ec(0x18f)],_0x5b33ec(0x17c),undefined,{'helpText':_0x5b33ec(0x16f)});this['logger'][_0x5b33ec(0x15f)](_0x5b33ec(0x12f)+_0x512e93+_0x5b33ec(0x16d)+_0x2f0a8b['length']+'\x20characters');const _0xfe5d90=_0x5b33ec(0x133)+encodeURIComponent(_0x512e93)+_0x5b33ec(0x15b),_0x2a8f9b={'input':_0x2f0a8b};try{const _0x261c1d=await this[_0x5b33ec(0x195)][_0x5b33ec(0x13b)](_0x5b33ec(0x139),_0xfe5d90,{'headers':{'Content-Type':_0x5b33ec(0x135),'Accept':'text/event-stream'},'body':_0x2a8f9b,'signal':_0x121e49});this['logger'][_0x5b33ec(0x15f)]('['+_0x261c1d[_0x5b33ec(0x141)]+_0x5b33ec(0x199)+_0x512e93),yield*parseSSEStream(_0x261c1d,this[_0x5b33ec(0x146)]);}catch(_0x3b91e7){throw new SDKError(ErrorCode[_0x5b33ec(0x1a8)],_0x5b33ec(0x138)+_0x512e93+_0x5b33ec(0x158)+_0x2f0a8b[_0x5b33ec(0x159)]+')',_0x3b91e7);}}async[a70_0x28b4f5(0x136)](_0x2e2970){const _0x5688e6=a70_0x28b4f5,_0x526b8b='/api/projects/'+encodeURIComponent(_0x2e2970),_0xf721fb=await this[_0x5688e6(0x195)][_0x5688e6(0x132)]('GET',_0x526b8b);return _0xf721fb[_0x5688e6(0x160)];}async[a70_0x28b4f5(0x156)](_0x3cbcfc){const _0x2affe1=a70_0x28b4f5;return this[_0x2affe1(0x142)](_0x2affe1(0x144)+encodeURIComponent(_0x3cbcfc)+_0x2affe1(0x14c));}async[a70_0x28b4f5(0x185)](_0x2d4982){const _0x3574a5=a70_0x28b4f5,_0x47c0e6={'data':{'type':_0x3574a5(0x175),'attributes':_0x2d4982}},_0x5bdf4f=await this[_0x3574a5(0x195)][_0x3574a5(0x132)](_0x3574a5(0x139),_0x3574a5(0x1a3),{'headers':{'Content-Type':'application/vnd.api+json','Accept':_0x3574a5(0x169)},'body':_0x47c0e6});return _0x5bdf4f['data'];}async['listTextKnowledgeBases'](_0x50bb02){const _0x342d75=a70_0x28b4f5,_0x180380=await this[_0x342d75(0x142)]('/api/tool_targets?filter[targetType]=TextKnowledgeBase&filter[project_id]='+encodeURIComponent(_0x50bb02)+_0x342d75(0x14c));return _0x180380[_0x342d75(0x13c)](_0x5c6356=>({..._0x5c6356,'type':_0x342d75(0x197)}));}async[a70_0x28b4f5(0x143)](_0x4337d9){const _0x3689ff=a70_0x28b4f5,_0x2c10bc=await this[_0x3689ff(0x195)][_0x3689ff(0x132)](_0x3689ff(0x162),'/api/text_knowledge_bases/'+encodeURIComponent(_0x4337d9),{'headers':{'Accept':_0x3689ff(0x169)}});return _0x2c10bc[_0x3689ff(0x160)];}async['createTextKnowledgeBase'](_0x5682cc){const _0x509b17=a70_0x28b4f5,_0x3fb062={'data':{'type':_0x509b17(0x197),'attributes':_0x5682cc}},_0xa393ab=await this[_0x509b17(0x195)][_0x509b17(0x132)]('POST',_0x509b17(0x168),{'headers':{'Content-Type':_0x509b17(0x169),'Accept':_0x509b17(0x169)},'body':_0x3fb062});return _0xa393ab[_0x509b17(0x160)];}async[a70_0x28b4f5(0x148)](_0x49bdf4,_0x328875){const _0x5604b6=a70_0x28b4f5,_0x2bffbd={'data':{'type':'textKnowledgeBases','id':_0x49bdf4,'attributes':_0x328875}},_0x4162ab=await this[_0x5604b6(0x195)][_0x5604b6(0x132)]('PATCH',_0x5604b6(0x17d)+encodeURIComponent(_0x49bdf4),{'headers':{'Content-Type':_0x5604b6(0x169),'Accept':_0x5604b6(0x169)},'body':_0x2bffbd});return _0x4162ab[_0x5604b6(0x160)];}async['createImageGenerator'](_0x5965be){const _0x5afefe=a70_0x28b4f5,_0x5ca04a={'data':{'type':_0x5afefe(0x14b),'attributes':{..._0x5965be,'imageModelType':_0x5965be[_0x5afefe(0x19e)]||_0x5afefe(0x18e),'imageReturnMode':_0x5965be[_0x5afefe(0x14d)]||'ID'}}},_0x3121ae=await this[_0x5afefe(0x195)][_0x5afefe(0x132)](_0x5afefe(0x139),_0x5afefe(0x181),{'headers':{'Content-Type':'application/vnd.api+json','Accept':_0x5afefe(0x169)},'body':_0x5ca04a});return _0x3121ae[_0x5afefe(0x160)];}async[a70_0x28b4f5(0x187)](_0x490744){const _0x906f60=a70_0x28b4f5,_0x10531e={'data':{'type':'webSearchTools','attributes':{'projectId':_0x490744[_0x906f60(0x17f)],'name':_0x490744[_0x906f60(0x15e)],'modelType':_0x490744[_0x906f60(0x13e)]||'gpt-4o','searchContextSize':_0x490744['searchContextSize']||_0x906f60(0x16a),'userLocation':_0x490744[_0x906f60(0x15a)]||{'type':_0x906f60(0x1a0),'country':'US','city':'San\x20Francisco','region':'California','timezone':'America/Los_Angeles'},'systemPrompt':_0x490744[_0x906f60(0x1a9)]||_0x906f60(0x178),'filters':_0x490744[_0x906f60(0x16e)]||{'allowed_domains':[]}}}},_0x584b7c=await this[_0x906f60(0x195)][_0x906f60(0x132)](_0x906f60(0x139),_0x906f60(0x1a6),{'headers':{'Content-Type':_0x906f60(0x169),'Accept':_0x906f60(0x169)},'body':_0x10531e});return _0x584b7c[_0x906f60(0x160)];}async[a70_0x28b4f5(0x189)](_0x31a317){const _0x52435f=a70_0x28b4f5,_0x37dd80=await this[_0x52435f(0x142)](_0x52435f(0x13d)+encodeURIComponent(_0x31a317)+_0x52435f(0x14c));return _0x37dd80['map'](_0x51f55f=>({..._0x51f55f,'type':'imageGenerators'}));}async[a70_0x28b4f5(0x134)](_0x45095d){const _0x320e20=a70_0x28b4f5,_0x48e1e0=await this[_0x320e20(0x142)]('/api/tool_targets?filter[targetType]=WebSearchTool&filter[project_id]='+encodeURIComponent(_0x45095d)+_0x320e20(0x14c));return _0x48e1e0[_0x320e20(0x13c)](_0x179b56=>({..._0x179b56,'type':_0x320e20(0x165)}));}async[a70_0x28b4f5(0x188)](_0x5367ab){const _0x3418a2=a70_0x28b4f5;return this['paginateAll']('/api/prompts?filter[projectId]='+encodeURIComponent(_0x5367ab)+_0x3418a2(0x14c));}async['createPrompt'](_0x276bbf){const _0x2f46cd=a70_0x28b4f5,{jsonSchemaHint:_0x532071,..._0x450982}=_0x276bbf,_0x3f9a40={'data':{'type':'prompts','attributes':_0x450982}},_0x299ade=await this[_0x2f46cd(0x195)][_0x2f46cd(0x132)]('POST','/api/prompts',{'headers':{'Content-Type':_0x2f46cd(0x169),'Accept':_0x2f46cd(0x169)},'body':_0x3f9a40});return _0x299ade[_0x2f46cd(0x160)];}async[a70_0x28b4f5(0x16b)](_0x4ec2f6){const _0x56a53e=a70_0x28b4f5;return this['paginateAll'](_0x56a53e(0x1a2)+encodeURIComponent(_0x4ec2f6)+_0x56a53e(0x14c));}async[a70_0x28b4f5(0x19a)](_0x55d48f){const _0x511cd9=a70_0x28b4f5,_0x566895={'data':{'type':_0x511cd9(0x155),'attributes':_0x55d48f}},_0xe142c6=await this[_0x511cd9(0x195)][_0x511cd9(0x132)](_0x511cd9(0x139),_0x511cd9(0x17a),{'headers':{'Content-Type':_0x511cd9(0x169),'Accept':_0x511cd9(0x169)},'body':_0x566895});return _0xe142c6[_0x511cd9(0x160)];}async['listAgentsFull'](_0x41dee7){const _0x3ec858=a70_0x28b4f5,_0x40d551=await this['listAgents'](_0x41dee7),_0x4f32a7=[];for(const _0x352cc2 of _0x40d551){const _0x2e13c3=_0x3ec858(0x154)+encodeURIComponent(_0x352cc2['id']),_0x3ff7d7=await this[_0x3ec858(0x195)][_0x3ec858(0x132)](_0x3ec858(0x162),_0x2e13c3);_0x4f32a7['push'](_0x3ff7d7['data']);}return _0x4f32a7;}async['createAgentResponse'](_0xb7b941){const _0x5594a5=a70_0x28b4f5,_0x32508a={'data':{'type':_0x5594a5(0x18b),'attributes':_0xb7b941}},_0x12081d=await this['httpClient'][_0x5594a5(0x132)]('POST','/api/agents',{'headers':{'Content-Type':'application/vnd.api+json','Accept':_0x5594a5(0x169)},'body':_0x32508a});return _0x12081d['data'];}async['updateAgentResponse'](_0x29e192,_0x38aeb7){const _0x3707f4=a70_0x28b4f5,_0x49d80a={'data':{'type':'agents','id':_0x29e192,'attributes':_0x38aeb7}},_0x40a713=_0x3707f4(0x154)+encodeURIComponent(_0x29e192),_0x226807=await this[_0x3707f4(0x195)][_0x3707f4(0x132)]('PATCH',_0x40a713,{'headers':{'Content-Type':'application/vnd.api+json','Accept':_0x3707f4(0x169)},'body':_0x49d80a});return _0x226807[_0x3707f4(0x160)];}async[a70_0x28b4f5(0x15d)](_0x4f7254,_0x2ff2a9){const _0x13b238=a70_0x28b4f5,_0x6371f0={'data':{'type':_0x13b238(0x175),'id':_0x4f7254,'attributes':_0x2ff2a9}},_0x4c3331=_0x13b238(0x177)+encodeURIComponent(_0x4f7254),_0x24b461=await this[_0x13b238(0x195)]['request'](_0x13b238(0x167),_0x4c3331,{'headers':{'Content-Type':_0x13b238(0x169),'Accept':'application/vnd.api+json'},'body':_0x6371f0});return _0x24b461[_0x13b238(0x160)];}async[a70_0x28b4f5(0x166)](_0x23db1c,_0x34e92d){const _0x3aa39b=a70_0x28b4f5,{jsonSchemaHint:_0x3742a1,..._0x69abcf}=_0x34e92d,_0x13bd10={'data':{'type':_0x3aa39b(0x19d),'id':_0x23db1c,'attributes':_0x69abcf}},_0xd0dca3='/api/prompts/'+encodeURIComponent(_0x23db1c),_0x17e7f8=await this['httpClient']['request']('PATCH',_0xd0dca3,{'headers':{'Content-Type':_0x3aa39b(0x169),'Accept':_0x3aa39b(0x169)},'body':_0x13bd10});return _0x17e7f8['data'];}async['updateIntegration'](_0x845013,_0x15db11){const _0x132848=a70_0x28b4f5,_0xe208fe={'data':{'type':_0x132848(0x155),'id':_0x845013,'attributes':_0x15db11}},_0x3992a8=_0x132848(0x1ac)+encodeURIComponent(_0x845013),_0x2a0813=await this[_0x132848(0x195)][_0x132848(0x132)](_0x132848(0x167),_0x3992a8,{'headers':{'Content-Type':_0x132848(0x169),'Accept':'application/vnd.api+json'},'body':_0xe208fe});return _0x2a0813[_0x132848(0x160)];}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a71_0x1c5a(_0x447b07,_0x1313d1){_0x447b07=_0x447b07-0x180;const _0x44775d=a71_0x4477();let _0x1c5a2c=_0x44775d[_0x447b07];return _0x1c5a2c;}function a71_0x4477(){const _0x3aed1b=['refill','floor','lastRefill','11lqznDS','acquire','refillRate','ceil','maxTokens','274NUIlAk','994789lGNzTZ','73930ErrvxL','5OzAfKm','windowMs','18831DxpTkW','now','maxRequests','1558722JRDkoB','51289UNgsUT','tokens','2306116fPsXaR','720IvfdvV','1521AGmWBq','max','sleep','min','reset','18432816VCqNsL'];a71_0x4477=function(){return _0x3aed1b;};return a71_0x4477();}const a71_0xf39eda=a71_0x1c5a;(function(_0x4adde8,_0x56d656){const _0x5a8792=a71_0x1c5a,_0x167de8=_0x4adde8();while(!![]){try{const _0x254f9b=parseInt(_0x5a8792(0x181))/0x1+parseInt(_0x5a8792(0x180))/0x2*(parseInt(_0x5a8792(0x185))/0x3)+-parseInt(_0x5a8792(0x18b))/0x4*(parseInt(_0x5a8792(0x183))/0x5)+-parseInt(_0x5a8792(0x188))/0x6+-parseInt(_0x5a8792(0x189))/0x7*(parseInt(_0x5a8792(0x18c))/0x8)+-parseInt(_0x5a8792(0x18d))/0x9*(parseInt(_0x5a8792(0x182))/0xa)+-parseInt(_0x5a8792(0x196))/0xb*(-parseInt(_0x5a8792(0x192))/0xc);if(_0x254f9b===_0x56d656)break;else _0x167de8['push'](_0x167de8['shift']());}catch(_0x15c6bb){_0x167de8['push'](_0x167de8['shift']());}}}(a71_0x4477,0x9da0b));export class RateLimiter{[a71_0xf39eda(0x18a)];[a71_0xf39eda(0x195)];[a71_0xf39eda(0x19a)];['refillRate'];constructor(_0x2041c7){const _0x5a1bfe=a71_0xf39eda;this['maxTokens']=_0x2041c7[_0x5a1bfe(0x187)],this[_0x5a1bfe(0x18a)]=_0x2041c7[_0x5a1bfe(0x187)],this[_0x5a1bfe(0x195)]=Date[_0x5a1bfe(0x186)](),this[_0x5a1bfe(0x198)]=_0x2041c7[_0x5a1bfe(0x187)]/_0x2041c7[_0x5a1bfe(0x184)];}async[a71_0xf39eda(0x197)](){const _0x418bf3=a71_0xf39eda;while(!![]){this['refill']();if(this[_0x418bf3(0x18a)]>=0x1){this['tokens']-=0x1;return;}const _0x319e69=Math[_0x418bf3(0x18e)](0x1,Math[_0x418bf3(0x199)](0x1/this[_0x418bf3(0x198)]));await this[_0x418bf3(0x18f)](_0x319e69);}}['tryAcquire'](){const _0x3575fe=a71_0xf39eda;this[_0x3575fe(0x193)]();if(this['tokens']>=0x1)return this[_0x3575fe(0x18a)]-=0x1,!![];return![];}[a71_0xf39eda(0x193)](){const _0x2923be=a71_0xf39eda,_0x1a17db=Date[_0x2923be(0x186)](),_0x4be71d=_0x1a17db-this[_0x2923be(0x195)];if(_0x4be71d>0x0){const _0x11b468=_0x4be71d*this['refillRate'];this[_0x2923be(0x18a)]=Math[_0x2923be(0x190)](this['maxTokens'],this[_0x2923be(0x18a)]+_0x11b468),this[_0x2923be(0x195)]=_0x1a17db;}}['getAvailableTokens'](){const _0xc2c750=a71_0xf39eda;return this[_0xc2c750(0x193)](),Math[_0xc2c750(0x194)](this['tokens']);}[a71_0xf39eda(0x191)](){const _0x39b53b=a71_0xf39eda;this[_0x39b53b(0x18a)]=this['maxTokens'],this[_0x39b53b(0x195)]=Date[_0x39b53b(0x186)]();}['sleep'](_0x536db7){return new Promise(_0x4595d0=>setTimeout(_0x4595d0,_0x536db7));}}export const defaultRateLimiter=new RateLimiter({'maxRequests':0x64,'windowMs':0xea60});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a72_0x43e944=a72_0x26d7;(function(_0x49cffc,_0x2a8d15){const _0x326775=a72_0x26d7,_0x4737fa=_0x49cffc();while(!![]){try{const _0x1de4a1=parseInt(_0x326775(0x1bc))/0x1*(-parseInt(_0x326775(0x1b2))/0x2)+parseInt(_0x326775(0x1bf))/0x3+parseInt(_0x326775(0x18e))/0x4+-parseInt(_0x326775(0x17d))/0x5*(parseInt(_0x326775(0x18f))/0x6)+-parseInt(_0x326775(0x1b1))/0x7*(parseInt(_0x326775(0x1ac))/0x8)+parseInt(_0x326775(0x199))/0x9+parseInt(_0x326775(0x19f))/0xa;if(_0x1de4a1===_0x2a8d15)break;else _0x4737fa['push'](_0x4737fa['shift']());}catch(_0x2df54b){_0x4737fa['push'](_0x4737fa['shift']());}}}(a72_0x4ab9,0x97306));function a72_0x26d7(_0x18e893,_0x55f083){_0x18e893=_0x18e893-0x17d;const _0x4ab9a6=a72_0x4ab9();let _0x26d7a1=_0x4ab9a6[_0x18e893];return _0x26d7a1;}import{HTTPClient}from'./http-client.js';import{getEndpoint}from'../types/index.js';import{getAuthHeaders,toHeaderRecord}from'../../core/auth.js';export class TDApiClient{[a72_0x43e944(0x19d)];[a72_0x43e944(0x1a8)];constructor(_0x469916,_0x2483dc){const _0x4ff7b9=a72_0x43e944,_0x2941e0=getEndpoint(_0x469916[_0x4ff7b9(0x1ae)],'td');this[_0x4ff7b9(0x1a8)]=toHeaderRecord(getAuthHeaders(_0x469916[_0x4ff7b9(0x1ae)],_0x469916['apiKey'])),this[_0x4ff7b9(0x19d)]=new HTTPClient(_0x2941e0,this[_0x4ff7b9(0x1a8)],_0x2483dc);}async[a72_0x43e944(0x1a0)](){const _0x3eabe4=a72_0x43e944,_0x51adb6=await this[_0x3eabe4(0x19d)][_0x3eabe4(0x18c)](_0x3eabe4(0x192),_0x3eabe4(0x1a6));return _0x51adb6['databases'];}async[a72_0x43e944(0x19e)](_0x44645e){const _0x55d825=a72_0x43e944,_0x306551=await this['httpClient']['request'](_0x55d825(0x192),_0x55d825(0x17e)+encodeURIComponent(_0x44645e));return _0x306551;}async[a72_0x43e944(0x1a4)](_0x30cdb7){const _0x13aa81=a72_0x43e944;await this[_0x13aa81(0x19d)][_0x13aa81(0x18c)](_0x13aa81(0x1a2),_0x13aa81(0x1aa)+encodeURIComponent(_0x30cdb7));}async[a72_0x43e944(0x1ba)](_0xd5d766){const _0x46f013=a72_0x43e944;await this['httpClient'][_0x46f013(0x18c)](_0x46f013(0x1a2),_0x46f013(0x190)+encodeURIComponent(_0xd5d766));}async['listTables'](_0x581ada){const _0x5dcd2c=a72_0x43e944,_0x376657=await this[_0x5dcd2c(0x19d)][_0x5dcd2c(0x18c)]('GET',_0x5dcd2c(0x1c2)+encodeURIComponent(_0x581ada));return _0x376657[_0x5dcd2c(0x1c3)];}async[a72_0x43e944(0x17f)](_0xd9dba3,_0x1ee75c){const _0x30bab6=a72_0x43e944,_0x5cde3a=await this[_0x30bab6(0x19d)][_0x30bab6(0x18c)](_0x30bab6(0x192),_0x30bab6(0x1af)+encodeURIComponent(_0xd9dba3)+'/'+encodeURIComponent(_0x1ee75c));return _0x5cde3a;}async['createTable'](_0xe01a3d,_0x169206){const _0x3afabd=a72_0x43e944;await this[_0x3afabd(0x19d)]['request'](_0x3afabd(0x1a2),_0x3afabd(0x186)+encodeURIComponent(_0xe01a3d)+'/'+encodeURIComponent(_0x169206));}async[a72_0x43e944(0x1a7)](_0x2f95ea,_0x3a76a5){const _0x2bd6ab=a72_0x43e944;await this[_0x2bd6ab(0x19d)][_0x2bd6ab(0x18c)]('POST','/v3/table/delete/'+encodeURIComponent(_0x2f95ea)+'/'+encodeURIComponent(_0x3a76a5));}async['submitHiveJob'](_0x5b5812,_0xeb6866){const _0x27d9ea=a72_0x43e944,_0x17c1f9=await this['httpClient'][_0x27d9ea(0x18c)](_0x27d9ea(0x1a2),'/v3/job/issue/hive/'+encodeURIComponent(_0x5b5812),{'body':{'query':_0xeb6866}});return _0x17c1f9;}async[a72_0x43e944(0x1a5)](_0x19d761,_0x238e9a){const _0x2a692c=a72_0x43e944,_0x379831=await this[_0x2a692c(0x19d)][_0x2a692c(0x18c)](_0x2a692c(0x1a2),_0x2a692c(0x1bd)+encodeURIComponent(_0x19d761),{'body':{'query':_0x238e9a}});return _0x379831;}async['listJobs'](_0x40cee4){const _0x40e099=a72_0x43e944,_0x21f4ca=new URLSearchParams();if(_0x40cee4?.[_0x40e099(0x1a3)]!==undefined)_0x21f4ca['append'](_0x40e099(0x1a3),_0x40cee4['from'][_0x40e099(0x182)]());if(_0x40cee4?.['to']!==undefined)_0x21f4ca['append']('to',_0x40cee4['to'][_0x40e099(0x182)]());if(_0x40cee4?.['status'])_0x21f4ca['append']('status',_0x40cee4[_0x40e099(0x195)]);const _0x480ae2=_0x21f4ca[_0x40e099(0x182)](),_0x26446c=_0x480ae2?_0x40e099(0x18b)+_0x480ae2:'/v3/job/list',_0x496dbc=await this[_0x40e099(0x19d)][_0x40e099(0x18c)](_0x40e099(0x192),_0x26446c);return _0x496dbc[_0x40e099(0x1c5)];}async[a72_0x43e944(0x187)](_0x428e43){const _0x5965fc=a72_0x43e944,_0x4c3b7d=await this['httpClient'][_0x5965fc(0x18c)](_0x5965fc(0x192),_0x5965fc(0x1a9)+encodeURIComponent(_0x428e43));return _0x4c3b7d;}async[a72_0x43e944(0x1be)](_0xce0152){const _0x431341=a72_0x43e944;await this[_0x431341(0x19d)][_0x431341(0x18c)](_0x431341(0x1a2),_0x431341(0x18d)+encodeURIComponent(_0xce0152));}async[a72_0x43e944(0x193)](){const _0x131159=a72_0x43e944,_0x57268d=await this['httpClient'][_0x131159(0x18c)](_0x131159(0x192),'/v4/users/current'),_0x486861=parseInt(_0x57268d['id'],0xa),_0x7482cb=parseInt(_0x57268d['account_id'],0xa);return{..._0x57268d,'id':Number[_0x131159(0x197)](_0x486861)?0x0:_0x486861,'account_id':Number[_0x131159(0x197)](_0x7482cb)?undefined:_0x7482cb};}async[a72_0x43e944(0x191)](){const _0x26d0e5=a72_0x43e944,_0x50dc3c=await this[_0x26d0e5(0x19d)][_0x26d0e5(0x18c)](_0x26d0e5(0x192),_0x26d0e5(0x1b3));return _0x50dc3c[_0x26d0e5(0x181)];}async[a72_0x43e944(0x188)](_0x3b2e85){const _0x45f84d=a72_0x43e944,_0x4b70fb=await this['httpClient'][_0x45f84d(0x18c)](_0x45f84d(0x192),_0x45f84d(0x19c)+encodeURIComponent(_0x3b2e85)+_0x45f84d(0x185),{'headers':{'Accept':_0x45f84d(0x1c0)},'responseType':_0x45f84d(0x196)});if(typeof _0x4b70fb==='string'){const _0x32a4e5=_0x4b70fb[_0x45f84d(0x1ab)]('\x0a')[_0x45f84d(0x1bb)](_0x16e0bb=>_0x16e0bb[_0x45f84d(0x1a1)]());if(_0x32a4e5[_0x45f84d(0x189)]===0x0)return[];let _0x2ca601;try{_0x2ca601=JSON[_0x45f84d(0x1b5)](_0x32a4e5[0x0]);}catch(_0x6d20b){return console[_0x45f84d(0x1b7)](_0x45f84d(0x1b8)+(_0x6d20b instanceof Error?_0x6d20b['message']:String(_0x6d20b))),[];}const _0x3b4457=[];for(let _0x3b2242=0x1;_0x3b2242<_0x32a4e5[_0x45f84d(0x189)];_0x3b2242++){const _0x2b766c=_0x32a4e5[_0x3b2242]['trim']();if(!_0x2b766c)continue;try{const _0x3148bc=JSON[_0x45f84d(0x1b5)](_0x2b766c),_0xe5ab08={};_0x2ca601[_0x45f84d(0x1b6)]((_0x3cb0b7,_0x3ae1cd)=>{_0xe5ab08[_0x3cb0b7]=_0x3148bc[_0x3ae1cd];}),_0x3b4457[_0x45f84d(0x1ad)](_0xe5ab08);}catch(_0x2518e7){console['warn'](_0x45f84d(0x18a)+(_0x3b2242+0x1)+':\x20'+(_0x2518e7 instanceof Error?_0x2518e7[_0x45f84d(0x1b9)]:String(_0x2518e7)));}}return _0x3b4457;}return[];}async['listConnections'](){const _0x4f9eec=a72_0x43e944;return await this['httpClient'][_0x4f9eec(0x18c)](_0x4f9eec(0x192),_0x4f9eec(0x19b));}async[a72_0x43e944(0x198)](_0x462d3d){const _0x34a1b0=a72_0x43e944;return await this[_0x34a1b0(0x19d)][_0x34a1b0(0x18c)]('GET',_0x34a1b0(0x1b0)+_0x462d3d);}async[a72_0x43e944(0x184)](_0x43ead3){const _0x1d98e1=a72_0x43e944;return await this[_0x1d98e1(0x19d)]['request']('GET',_0x1d98e1(0x19a)+encodeURIComponent(_0x43ead3)+_0x1d98e1(0x183));}async[a72_0x43e944(0x1c4)](_0x6775fb){const _0x13c12a=a72_0x43e944;return await this[_0x13c12a(0x19d)][_0x13c12a(0x18c)](_0x13c12a(0x192),_0x13c12a(0x194)+encodeURIComponent(_0x6775fb));}async[a72_0x43e944(0x180)](){const _0x87d6f=a72_0x43e944;return await this[_0x87d6f(0x19d)][_0x87d6f(0x18c)]('GET',_0x87d6f(0x1b4));}async['validateConnectorConfig'](_0x21dfa5,_0x27b836,_0x2c2dff){const _0x1a6945=a72_0x43e944;return await this[_0x1a6945(0x19d)]['request'](_0x1a6945(0x1a2),_0x1a6945(0x1c1),{'body':{'type':_0x21dfa5,'connection_id':_0x27b836,'settings':_0x2c2dff}});}}function a72_0x4ab9(){const _0x4aa740=['text','isNaN','getConnection','5209056njJcqv','/v4/form_schemas/','/v4/connectors','/v3/job/result/','httpClient','showDatabase','6377750WKKMuE','listDatabases','trim','POST','from','createDatabase','submitPrestoJob','/v3/database/list','deleteTable','authHeaders','/v3/job/show/','/v3/database/create/','split','3168jkcgGV','push','site','/v3/table/show/','/v4/connectors/','8813wXRoEA','6334wRFNPL','/v3/user/list','/v4/connector_metadata','parse','forEach','warn','Failed\x20to\x20parse\x20column\x20names:\x20','message','deleteDatabase','filter','357BNrSYJ','/v3/job/issue/presto/','cancelJob','3581055pdTHsl','application/json','/v3/connector_configs/validate_with_connection','/v3/table/list/','tables','getConnectorMetadata','jobs','1711180IKwbHa','/v3/database/show/','showTable','listConnectorMetadata','users','toString','/output','getOutputFormSchema','?header=true','/v3/table/create/','showJob','getJobResult','length','Failed\x20to\x20parse\x20NDJSON\x20line\x20','/v3/job/list?','request','/v3/job/kill/','3459668FyPRuF','18BYgGbk','/v3/database/delete/','listUsers','GET','getUserInfo','/v4/connector_metadata/','status'];a72_0x4ab9=function(){return _0x4aa740;};return a72_0x4ab9();}export function createTDApiClient(_0x128456,_0x5c3fc2){return new TDApiClient(_0x128456,_0x5c3fc2);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a73_0x4b7220=a73_0x2f76;(function(_0x17803b,_0x18be97){const _0x1da03a=a73_0x2f76,_0x4168e0=_0x17803b();while(!![]){try{const _0x33ee58=-parseInt(_0x1da03a(0x1d3))/0x1*(-parseInt(_0x1da03a(0x1bf))/0x2)+parseInt(_0x1da03a(0x1a8))/0x3+parseInt(_0x1da03a(0x1b0))/0x4+-parseInt(_0x1da03a(0x1a7))/0x5*(parseInt(_0x1da03a(0x1b2))/0x6)+-parseInt(_0x1da03a(0x1b5))/0x7+parseInt(_0x1da03a(0x1af))/0x8+parseInt(_0x1da03a(0x1b6))/0x9*(-parseInt(_0x1da03a(0x1ab))/0xa);if(_0x33ee58===_0x18be97)break;else _0x4168e0['push'](_0x4168e0['shift']());}catch(_0xace2d6){_0x4168e0['push'](_0x4168e0['shift']());}}}(a73_0x3b09,0x6cb03));import{HTTPClient}from'./http-client.js';import{getEndpoint}from'../types/index.js';function a73_0x2f76(_0x97a8a0,_0x445fdc){_0x97a8a0=_0x97a8a0-0x19c;const _0x3b09e5=a73_0x3b09();let _0x2f765c=_0x3b09e5[_0x97a8a0];return _0x2f765c;}import{getTrinoHeaders}from'../../core/auth.js';import{SDKError,ErrorCode}from'../errors.js';import{Chalk}from'chalk';function a73_0x3b09(){const _0x131e53=['streamResults','1355xdXMOU','pathname','completedSplits','warnings','length','DELETE','INTERNAL','push','join','X-TD-JobId','min','isTTY','httpClient','convertRowsToObjects','toLocaleString','apiKey','headers','GET','executeQuery','INTERNAL_ERROR','request','nextUri','errorLocation','error','15SMFOuD','2138970oXhhKJ','TRINO_NOT_FOUND','ALREADY_EXISTS','20jBrQxB','stdout','aborted','columns','3909024RhdExw','1511464oiNiWd','dim','515550wQWOqq','padStart','text/plain','3806257kFUAoc','4442562tvjEtK','PERMISSION_DENIED','totalSplits','[query]','processedRows','Warning:\x20Large\x20result\x20set\x20(','TRINO_INTERNAL_ERROR','split','jobId','966hXMLsv','TRINO_SYNTAX_ERROR','errorName','errorCode','max','data','forEach','red','map','x-td-jobid','stats','TRINO_INSUFFICIENT_RESOURCES','warn','consider\x20adding\x20LIMIT\x20clause','INSUFFICIENT_RESOURCES','site','state','checkResponseError','cancelQuery'];a73_0x3b09=function(){return _0x131e53;};return a73_0x3b09();}export class TrinoApiClient{[a73_0x4b7220(0x1df)];constructor(_0xf9b75b,_0x5f277d){const _0x2a03fe=a73_0x4b7220,_0x456997=getEndpoint(_0xf9b75b['site'],'trino'),_0x21c321=getTrinoHeaders(_0xf9b75b[_0x2a03fe(0x1ce)],_0xf9b75b[_0x2a03fe(0x19e)]);this[_0x2a03fe(0x1df)]=new HTTPClient(_0x456997,_0x21c321,_0x5f277d);}async[a73_0x4b7220(0x1a1)](_0x32d121,_0x5b700d={}){const _0x84e328=a73_0x4b7220,{catalog:_0x228d65,schema:_0x40ba43,timeout:_0x44ef28,signal:_0x5391ef,onJobId:_0x48019e,onProgress:_0x2f61b6}=_0x5b700d,_0x5d69b9={'Content-Type':_0x84e328(0x1b4)};(_0x228d65||_0x40ba43)&&(_0x5d69b9['X-Trino-Catalog']=_0x228d65||'td');_0x40ba43&&(_0x5d69b9['X-Trino-Schema']=_0x40ba43);const _0x4c8174=await this['httpClient'][_0x84e328(0x1a3)]('POST','/v1/statement',{'headers':_0x5d69b9,'body':_0x32d121,'timeout':_0x44ef28,'signal':_0x5391ef,'includeHeaders':!![]}),_0x368784=_0x4c8174['data'],_0x356a77=_0x4c8174[_0x84e328(0x19f)],_0x538807=_0x356a77[_0x84e328(0x1c8)]||_0x356a77[_0x84e328(0x1dc)];_0x538807&&_0x48019e&&_0x48019e(_0x538807);this[_0x84e328(0x1d0)](_0x368784,_0x368784['id'],_0x32d121);const _0x257f0a=await this['streamResults'](_0x368784,_0x32d121,_0x5391ef,_0x2f61b6);return _0x538807&&(_0x257f0a[_0x84e328(0x1be)]=_0x538807),_0x257f0a;}async[a73_0x4b7220(0x1d2)](_0x4bce02,_0x6c31e0,_0x517711,_0x28f0a5){const _0x181e99=a73_0x4b7220,_0x2e6f9a=_0x4bce02['id'];let _0xd69353=[];const _0x2c1957=[],_0x51adcb=[];let _0x404e2a=_0x4bce02;const _0x132aa7=0x186a0;_0x404e2a[_0x181e99(0x1ae)]&&(_0xd69353=_0x404e2a[_0x181e99(0x1ae)]);_0x404e2a[_0x181e99(0x1c4)]&&_0x2c1957[_0x181e99(0x1da)](..._0x404e2a[_0x181e99(0x1c4)]);_0x404e2a['warnings']&&_0x51adcb[_0x181e99(0x1da)](..._0x404e2a['warnings']);_0x28f0a5&&_0x404e2a[_0x181e99(0x1c9)]&&_0x28f0a5({'state':_0x404e2a['stats'][_0x181e99(0x1cf)],'processedRows':_0x404e2a[_0x181e99(0x1c9)][_0x181e99(0x1ba)],'completedSplits':_0x404e2a[_0x181e99(0x1c9)][_0x181e99(0x1d5)],'totalSplits':_0x404e2a[_0x181e99(0x1c9)][_0x181e99(0x1b8)]});while(_0x404e2a['nextUri']){if(_0x517711?.[_0x181e99(0x1ad)]){await this[_0x181e99(0x1d1)](_0x404e2a[_0x181e99(0x1a4)]);throw new Error('Query\x20cancelled\x20by\x20user');}let _0x3be3d7;try{_0x3be3d7=new URL(_0x404e2a[_0x181e99(0x1a4)])['pathname'];}catch{throw new Error('Invalid\x20nextUri\x20format:\x20'+_0x404e2a[_0x181e99(0x1a4)]);}_0x404e2a=await this[_0x181e99(0x1df)][_0x181e99(0x1a3)](_0x181e99(0x1a0),_0x3be3d7,{'signal':_0x517711}),this[_0x181e99(0x1d0)](_0x404e2a,_0x2e6f9a,_0x6c31e0),_0x404e2a['columns']&&_0xd69353['length']===0x0&&(_0xd69353=_0x404e2a[_0x181e99(0x1ae)]),_0x404e2a[_0x181e99(0x1c4)]&&(_0x2c1957[_0x181e99(0x1da)](..._0x404e2a[_0x181e99(0x1c4)]),_0x2c1957[_0x181e99(0x1d7)]>_0x132aa7&&_0x2c1957['length']%0xc350===0x0&&console[_0x181e99(0x1cb)](_0x181e99(0x1bb)+_0x2c1957[_0x181e99(0x1d7)][_0x181e99(0x19d)]()+'\x20rows)\x20-\x20'+_0x181e99(0x1cc))),_0x404e2a[_0x181e99(0x1d6)]&&_0x51adcb[_0x181e99(0x1da)](..._0x404e2a[_0x181e99(0x1d6)]),_0x28f0a5&&_0x404e2a[_0x181e99(0x1c9)]&&_0x28f0a5({'state':_0x404e2a['stats'][_0x181e99(0x1cf)],'processedRows':_0x404e2a[_0x181e99(0x1c9)]['processedRows'],'completedSplits':_0x404e2a[_0x181e99(0x1c9)][_0x181e99(0x1d5)],'totalSplits':_0x404e2a['stats'][_0x181e99(0x1b8)]});}const _0x2c5554=this[_0x181e99(0x19c)](_0xd69353,_0x2c1957);return{'queryId':_0x2e6f9a,'columns':_0xd69353,'data':_0x2c5554,'stats':_0x404e2a[_0x181e99(0x1c9)],'warnings':_0x51adcb[_0x181e99(0x1d7)]>0x0?_0x51adcb:undefined};}[a73_0x4b7220(0x1d0)](_0x15bec3,_0xc57efc,_0x10f126){const _0x46da04=a73_0x4b7220;if(!_0x15bec3[_0x46da04(0x1a6)])return;const _0x583667=_0x15bec3['error'],_0x135e50=mapTrinoErrorToErrorCode(_0x583667),_0x58a019=process[_0x46da04(0x1ac)][_0x46da04(0x1de)]?new Chalk({'level':0x3}):new Chalk({'level':0x0}),_0x1bf7a8='['+_0x583667[_0x46da04(0x1c1)]+']\x20Query\x20ID:\x20'+_0xc57efc;let _0x1225b1=_0x58a019[_0x46da04(0x1c6)](_0x1bf7a8+'\x0a'+_0x583667['message']);if(_0x10f126&&_0x583667[_0x46da04(0x1a5)]){const {lineNumber:_0x31e496,columnNumber:_0x330b1c}=_0x583667['errorLocation'];_0x1225b1+='\x0a\x0a'+_0x58a019[_0x46da04(0x1b1)](_0x46da04(0x1b9))+'\x0a'+formatSqlErrorContext(_0x10f126,_0x31e496,_0x330b1c);}throw new SDKError(_0x135e50,_0x1225b1,_0x583667);}['convertRowsToObjects'](_0x9ef06f,_0x5bdd40){const _0x5a0b86=a73_0x4b7220;if(_0x9ef06f['length']===0x0)return _0x5bdd40;return _0x5bdd40[_0x5a0b86(0x1c7)](_0x1fb67a=>{const _0x2e4338=_0x5a0b86,_0x2d4c88={};return _0x9ef06f[_0x2e4338(0x1c5)]((_0x49da2c,_0x3ca33e)=>{_0x2d4c88[_0x49da2c['name']]=_0x1fb67a[_0x3ca33e];}),_0x2d4c88;});}async['cancelQuery'](_0x2150c6){const _0x565da8=a73_0x4b7220;try{const _0xad5fa6=new URL(_0x2150c6)[_0x565da8(0x1d4)];await this[_0x565da8(0x1df)][_0x565da8(0x1a3)](_0x565da8(0x1d8),_0xad5fa6);}catch(_0x375b3c){console['warn']('Failed\x20to\x20cancel\x20query:',_0x375b3c);}}}function formatSqlErrorContext(_0x423f6e,_0xcb874,_0x461934){const _0x23529a=a73_0x4b7220,_0x502bf4=_0x423f6e[_0x23529a(0x1bd)]('\x0a');if(_0xcb874<0x1||_0xcb874>_0x502bf4['length'])return _0x423f6e;const _0x1237d4=_0xcb874-0x1,_0xc9c391=Math[_0x23529a(0x1c3)](0x0,_0x1237d4-0x2),_0x3d00c6=Math[_0x23529a(0x1dd)](_0x502bf4[_0x23529a(0x1d7)],_0x1237d4+0x3),_0x4d9e2d=[],_0x193f8c=process[_0x23529a(0x1ac)][_0x23529a(0x1de)]?new Chalk({'level':0x3}):new Chalk({'level':0x0});for(let _0x1638db=_0xc9c391;_0x1638db<_0x3d00c6;_0x1638db++){const _0x270b64=_0x1638db===_0x1237d4?'>\x20':'\x20\x20',_0x492541=String(_0x1638db+0x1)[_0x23529a(0x1b3)](0x3,'\x20'),_0x4eb4ab=_0x193f8c[_0x23529a(0x1b1)](''+_0x270b64+_0x492541+'\x20|');_0x4d9e2d[_0x23529a(0x1da)](_0x4eb4ab+'\x20'+_0x502bf4[_0x1638db]);if(_0x1638db===_0x1237d4){const _0x22ea3b=0x8+(_0x461934-0x1);_0x4d9e2d[_0x23529a(0x1da)]('\x20'['repeat'](_0x22ea3b)+'^');}}return _0x4d9e2d[_0x23529a(0x1db)]('\x0a');}function mapTrinoErrorToErrorCode(_0xfae5d){const _0x33c296=a73_0x4b7220,_0x131c82=_0xfae5d['errorType'],_0x24d5af=_0xfae5d[_0x33c296(0x1c2)];if(_0x131c82==='USER_ERROR')switch(_0x24d5af){case 0x1:return ErrorCode[_0x33c296(0x1c0)];case 0x3:return ErrorCode['TRINO_USER_CANCELLED'];case 0x4:return ErrorCode[_0x33c296(0x1b7)];case 0x5:case 0x2c:case 0x2d:case 0x2e:case 0x2f:return ErrorCode[_0x33c296(0x1a9)];case 0xc:case 0x31:case 0x32:return ErrorCode[_0x33c296(0x1aa)];default:return ErrorCode['TRINO_INVALID_ARGUMENT'];}else{if(_0x131c82===_0x33c296(0x1a2))return ErrorCode[_0x33c296(0x1bc)];else{if(_0x131c82===_0x33c296(0x1cd))return ErrorCode[_0x33c296(0x1ca)];else{if(_0x131c82==='EXTERNAL')return ErrorCode['TRINO_INTERNAL_ERROR'];}}}return ErrorCode[_0x33c296(0x1d9)];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a74_0x2738f3=a74_0x333e;(function(_0x3bf456,_0x1dc74f){const _0x46713e=a74_0x333e,_0x419f7c=_0x3bf456();while(!![]){try{const _0x3f291d=parseInt(_0x46713e(0x114))/0x1*(-parseInt(_0x46713e(0x118))/0x2)+-parseInt(_0x46713e(0xe4))/0x3*(parseInt(_0x46713e(0xf7))/0x4)+-parseInt(_0x46713e(0xe0))/0x5*(parseInt(_0x46713e(0xdb))/0x6)+-parseInt(_0x46713e(0xd7))/0x7+-parseInt(_0x46713e(0x12b))/0x8+parseInt(_0x46713e(0x129))/0x9+-parseInt(_0x46713e(0xf4))/0xa*(-parseInt(_0x46713e(0xf3))/0xb);if(_0x3f291d===_0x1dc74f)break;else _0x419f7c['push'](_0x419f7c['shift']());}catch(_0x3536f3){_0x419f7c['push'](_0x419f7c['shift']());}}}(a74_0x187c,0x19caa));function a74_0x333e(_0x383657,_0x19435d){_0x383657=_0x383657-0xca;const _0x187c59=a74_0x187c();let _0x333eea=_0x187c59[_0x383657];return _0x333eea;}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{[a74_0x2738f3(0x110)];[a74_0x2738f3(0x115)];constructor(_0x3f70cf,_0x4fb445){const _0x46b06d=a74_0x2738f3,_0x46d6cb=getEndpoint(_0x3f70cf['site'],'workflow');this[_0x46b06d(0x115)]=toHeaderRecord(getAuthHeaders(_0x3f70cf[_0x46b06d(0x126)],_0x3f70cf['apiKey'])),this['httpClient']=new HTTPClient(_0x46d6cb,this[_0x46b06d(0x115)],_0x4fb445);}async[a74_0x2738f3(0x109)](_0x371972){const _0x2a28b9=a74_0x2738f3,_0x2924cd=new URLSearchParams();if(_0x371972?.[_0x2a28b9(0xcf)])_0x2924cd[_0x2a28b9(0xfc)]('count',String(_0x371972[_0x2a28b9(0xcf)]));if(_0x371972?.[_0x2a28b9(0xdc)])_0x2924cd[_0x2a28b9(0xfc)](_0x2a28b9(0xdc),_0x371972['last_id']);if(_0x371972?.[_0x2a28b9(0xcc)]){const _0x580a30=_0x371972['name_pattern'][_0x2a28b9(0x128)](/[*?]/g,'');_0x580a30&&_0x2924cd[_0x2a28b9(0xfc)](_0x2a28b9(0xcc),_0x580a30);}const _0xcb1e65=_0x2924cd['toString'](),_0x157e29=_0xcb1e65?_0x2a28b9(0x10b)+_0xcb1e65:_0x2a28b9(0x130),_0x14a964=await this['httpClient'][_0x2a28b9(0xd1)](_0x2a28b9(0xd3),_0x157e29),_0x109413=_0x14a964[_0x2a28b9(0xde)]||[],_0x273af2=_0x109413[_0x2a28b9(0x131)]>0x0?_0x109413[_0x109413[_0x2a28b9(0x131)]-0x1]['id']:undefined;let _0x84df20=_0x109413;return _0x371972?.['name_pattern']&&(_0x84df20=_0x84df20[_0x2a28b9(0xee)](_0x139b56=>{const _0x128b57=_0x2a28b9;return matchGlobPattern(_0x139b56[_0x128b57(0xd4)],_0x371972[_0x128b57(0xcc)]);})),{'data':_0x84df20,'lastId':_0x273af2,'rawCount':_0x109413[_0x2a28b9(0x131)]};}async[a74_0x2738f3(0x11d)](_0x157927){const _0x836c54=a74_0x2738f3,_0x27cd8e=new URLSearchParams();if(_0x157927?.[_0x836c54(0xcf)])_0x27cd8e[_0x836c54(0xfc)]('count',String(_0x157927[_0x836c54(0xcf)]));if(_0x157927?.[_0x836c54(0xdc)])_0x27cd8e[_0x836c54(0xfc)](_0x836c54(0xdc),_0x157927['last_id']);if(_0x157927?.['project_name']){const _0xa18de8=_0x157927[_0x836c54(0xce)][_0x836c54(0x128)](/[*?]/g,'');_0xa18de8&&(_0x27cd8e['append'](_0x836c54(0xcc),_0xa18de8),_0x27cd8e[_0x836c54(0xfc)](_0x836c54(0xf0),_0x836c54(0xf1)));}const _0x5a1318=_0x27cd8e['toString'](),_0x1971ff=_0x5a1318?_0x836c54(0x10e)+_0x5a1318:'/api/workflows',_0x39605c=await this[_0x836c54(0x110)][_0x836c54(0xd1)](_0x836c54(0xd3),_0x1971ff),_0x2ac9a5=_0x39605c[_0x836c54(0xda)]||[],_0x43c090=_0x2ac9a5[_0x836c54(0x131)]>0x0?_0x2ac9a5[_0x2ac9a5[_0x836c54(0x131)]-0x1]['id']:undefined;let _0x5e316d=_0x2ac9a5;return _0x157927?.['project_name']&&(_0x5e316d=_0x5e316d['filter'](_0x444e33=>{const _0x5a5840=_0x836c54,_0x581025=_0x444e33['project']?.[_0x5a5840(0xd4)];if(!_0x581025)return![];return matchGlobPattern(_0x581025,_0x157927['project_name']);})),{'data':_0x5e316d,'lastId':_0x43c090,'rawCount':_0x2ac9a5['length']};}async[a74_0x2738f3(0xfb)](_0x1f71e5){const _0x1cf70d=a74_0x2738f3;let _0x37262e='/api/sessions';_0x1f71e5?.['project_id']&&(_0x37262e=_0x1cf70d(0x122)+encodeURIComponent(_0x1f71e5[_0x1cf70d(0x121)])+_0x1cf70d(0xd0));const _0x1f5a6b=new URLSearchParams();if(_0x1f71e5?.['workflow_name'])_0x1f5a6b['append'](_0x1cf70d(0x117),_0x1f71e5[_0x1cf70d(0xeb)]);if(_0x1f71e5?.[_0x1cf70d(0x100)])_0x1f5a6b[_0x1cf70d(0xfc)]('status',_0x1f71e5[_0x1cf70d(0x100)]);if(_0x1f71e5?.[_0x1cf70d(0x108)])_0x1f5a6b[_0x1cf70d(0xfc)](_0x1cf70d(0x108),_0x1f71e5[_0x1cf70d(0x108)]);if(_0x1f71e5?.['to_time'])_0x1f5a6b['append'](_0x1cf70d(0xf9),_0x1f71e5[_0x1cf70d(0xf9)]);if(_0x1f71e5?.[_0x1cf70d(0xcf)])_0x1f5a6b[_0x1cf70d(0xfc)](_0x1cf70d(0xea),String(_0x1f71e5[_0x1cf70d(0xcf)]));if(_0x1f71e5?.[_0x1cf70d(0xdc)])_0x1f5a6b[_0x1cf70d(0xfc)](_0x1cf70d(0xdc),_0x1f71e5['last_id']);const _0x3bcf93=_0x1f5a6b[_0x1cf70d(0x11e)]();_0x3bcf93&&(_0x37262e=_0x37262e+'?'+_0x3bcf93);const _0x56faa0=await this[_0x1cf70d(0x110)][_0x1cf70d(0xd1)]('GET',_0x37262e),_0x1b3a17=_0x56faa0[_0x1cf70d(0xed)]||[],_0x3fad27=_0x1b3a17[_0x1cf70d(0x131)]>0x0?_0x1b3a17[_0x1b3a17[_0x1cf70d(0x131)]-0x1]['id']:undefined;return{'data':_0x1b3a17,'lastId':_0x3fad27};}async[a74_0x2738f3(0xe8)](_0x321e3a){const _0xc53b0=a74_0x2738f3,_0x238141=new URLSearchParams();if(_0x321e3a?.[_0xc53b0(0xce)])_0x238141[_0xc53b0(0xfc)](_0xc53b0(0xff),_0x321e3a[_0xc53b0(0xce)]);if(_0x321e3a?.[_0xc53b0(0xeb)])_0x238141['append'](_0xc53b0(0x117),_0x321e3a['workflow_name']);if(_0x321e3a?.[_0xc53b0(0x124)])_0x238141[_0xc53b0(0xfc)](_0xc53b0(0x124),'1');if(_0x321e3a?.['limit'])_0x238141[_0xc53b0(0xfc)](_0xc53b0(0xea),String(_0x321e3a[_0xc53b0(0xcf)]));if(_0x321e3a?.[_0xc53b0(0xdc)])_0x238141[_0xc53b0(0xfc)]('last_id',_0x321e3a[_0xc53b0(0xdc)]);const _0x3b765f=_0x238141[_0xc53b0(0x11e)](),_0x3af100=_0x3b765f?_0xc53b0(0xcd)+_0x3b765f:_0xc53b0(0xdf),_0xe83953=await this['httpClient'][_0xc53b0(0xd1)]('GET',_0x3af100),_0x5864f6=_0xe83953[_0xc53b0(0x11a)]||[],_0x4e1715=_0x5864f6[_0xc53b0(0x131)]>0x0?_0x5864f6[_0x5864f6[_0xc53b0(0x131)]-0x1]['id']:undefined;return{'data':_0x5864f6,'lastId':_0x4e1715};}async[a74_0x2738f3(0xef)](_0x5a81f4){const _0x5300e8=a74_0x2738f3;return await this[_0x5300e8(0x110)][_0x5300e8(0xd1)]('GET',_0x5300e8(0xfd)+encodeURIComponent(_0x5a81f4));}async[a74_0x2738f3(0x12c)](_0x17f007,_0x50e0cb=![]){const _0x239ed9=a74_0x2738f3,_0x2ac2e0=new URLSearchParams();_0x50e0cb&&_0x2ac2e0[_0x239ed9(0xfc)](_0x239ed9(0x12d),'true');const _0x303a0b=_0x2ac2e0[_0x239ed9(0x11e)](),_0x5d5baa=_0x303a0b?_0x239ed9(0xfd)+encodeURIComponent(_0x17f007)+'/tasks?'+_0x303a0b:'/api/attempts/'+encodeURIComponent(_0x17f007)+_0x239ed9(0xfe),_0x2d76b4=await this[_0x239ed9(0x110)][_0x239ed9(0xd1)](_0x239ed9(0xd3),_0x5d5baa);return _0x2d76b4[_0x239ed9(0x134)]||[];}async[a74_0x2738f3(0xd2)](_0x3b173b,_0x5d66f5,_0x431cd9){const _0x4ad969=a74_0x2738f3,_0xb40fa9=new URLSearchParams();_0x431cd9?.[_0x4ad969(0x127)]!==undefined&&_0xb40fa9['append'](_0x4ad969(0x127),String(_0x431cd9[_0x4ad969(0x127)]));_0x431cd9?.[_0x4ad969(0xcf)]!==undefined&&_0xb40fa9[_0x4ad969(0xfc)](_0x4ad969(0xcf),String(_0x431cd9[_0x4ad969(0xcf)]));const _0xe613a5=_0xb40fa9[_0x4ad969(0x11e)](),_0x36cf26=_0xe613a5?_0x4ad969(0xfd)+encodeURIComponent(_0x3b173b)+_0x4ad969(0xfa)+encodeURIComponent(_0x5d66f5)+_0x4ad969(0xe2)+_0xe613a5:_0x4ad969(0xfd)+encodeURIComponent(_0x3b173b)+_0x4ad969(0xfa)+encodeURIComponent(_0x5d66f5)+_0x4ad969(0xe9),_0x3a759c=await this[_0x4ad969(0x110)][_0x4ad969(0xd1)](_0x4ad969(0xd3),_0x36cf26);return _0x3a759c['logs']||[];}async[a74_0x2738f3(0x119)](_0x60cd7e,_0x804049){const _0x4a5440=a74_0x2738f3,_0x302bc7=new URLSearchParams();_0x804049&&_0x302bc7[_0x4a5440(0xfc)]('task',_0x804049);const _0x3e02c7=_0x302bc7[_0x4a5440(0x11e)](),_0x53026c=_0x3e02c7?'/api/logs/'+encodeURIComponent(_0x60cd7e)+_0x4a5440(0x104)+_0x3e02c7:_0x4a5440(0xd6)+encodeURIComponent(_0x60cd7e)+_0x4a5440(0x123),_0x5e26c9=await this[_0x4a5440(0x110)][_0x4a5440(0xd1)](_0x4a5440(0xd3),_0x53026c);return _0x5e26c9[_0x4a5440(0x11c)]||[];}async[a74_0x2738f3(0xca)](_0x54cc6c,_0x3329f9){const _0x1d8bad=a74_0x2738f3,_0x5c1944={};return _0x3329f9&&(_0x5c1944[_0x1d8bad(0x12a)]=_0x3329f9),await this[_0x1d8bad(0x110)][_0x1d8bad(0xd1)]('POST',_0x1d8bad(0xfd)+encodeURIComponent(_0x54cc6c)+_0x1d8bad(0xf2),{'body':_0x5c1944});}async[a74_0x2738f3(0xe3)](_0x45ae80,_0x43d962){const _0x1da66d=a74_0x2738f3,_0x342a99={};return _0x43d962?.[_0x1da66d(0x10a)]&&(_0x342a99[_0x1da66d(0x10a)]=_0x43d962[_0x1da66d(0x10a)]),_0x43d962?.[_0x1da66d(0x125)]&&(_0x342a99[_0x1da66d(0x125)]=_0x43d962['retry_params']),await this[_0x1da66d(0x110)]['request'](_0x1da66d(0xcb),_0x1da66d(0x11f)+encodeURIComponent(_0x45ae80)+_0x1da66d(0x120),{'body':_0x342a99});}async[a74_0x2738f3(0xd8)](_0x14a15d,_0x13c64e){const _0x17583c=a74_0x2738f3,_0x325b86={};return _0x13c64e?.['resume_from']&&(_0x325b86[_0x17583c(0x11b)]=_0x13c64e[_0x17583c(0x11b)]),_0x13c64e?.[_0x17583c(0x125)]&&(_0x325b86[_0x17583c(0x125)]=_0x13c64e[_0x17583c(0x125)]),_0x13c64e?.[_0x17583c(0x106)]&&(_0x325b86[_0x17583c(0x106)]=_0x13c64e[_0x17583c(0x106)]),await this[_0x17583c(0x110)]['request'](_0x17583c(0xcb),'/api/attempts/'+encodeURIComponent(_0x14a15d)+'/retry',{'body':_0x325b86});}async[a74_0x2738f3(0x116)](_0x54c1c1){const _0x37cc04=a74_0x2738f3,_0x120532={'sessionTime':_0x54c1c1[_0x37cc04(0xd5)],'params':_0x54c1c1[_0x37cc04(0xf5)]};return _0x54c1c1[_0x37cc04(0x10d)]&&(_0x120532['workflowId']=_0x54c1c1['workflowId']),_0x54c1c1[_0x37cc04(0xdd)]&&(_0x120532[_0x37cc04(0xdd)]=_0x54c1c1[_0x37cc04(0xdd)]),_0x54c1c1[_0x37cc04(0x12e)]&&(_0x120532[_0x37cc04(0x12e)]=_0x54c1c1[_0x37cc04(0x12e)]),_0x54c1c1['retryAttemptName']&&(_0x120532['retryAttemptName']=_0x54c1c1[_0x37cc04(0x105)]),_0x54c1c1[_0x37cc04(0xec)]!==undefined&&(_0x120532[_0x37cc04(0xec)]=_0x54c1c1[_0x37cc04(0xec)]),await this['httpClient'][_0x37cc04(0xd1)](_0x37cc04(0x111),_0x37cc04(0xdf),{'body':_0x120532});}async['downloadProjectArchive'](_0x9ef22d,_0x349a29,_0xddab21){const _0x26fbd7=a74_0x2738f3,{promises:_0x4079db}=await import('fs'),_0x51dda=new URLSearchParams();_0xddab21&&_0x51dda[_0x26fbd7(0xfc)](_0x26fbd7(0x10c),_0xddab21);const _0x693082=_0x51dda[_0x26fbd7(0x11e)](),_0x5c2e68=_0x693082?_0x26fbd7(0x122)+encodeURIComponent(_0x9ef22d)+'/archive?'+_0x693082:'/api/projects/'+encodeURIComponent(_0x9ef22d)+'/archive',_0x4bdb97=await this['httpClient'][_0x26fbd7(0xd1)]('GET',_0x5c2e68,{'headers':{'Accept':_0x26fbd7(0x103)},'responseType':'arraybuffer'});return await _0x4079db[_0x26fbd7(0x12f)](_0x349a29,_0x4bdb97),_0x349a29;}async[a74_0x2738f3(0x101)](_0x245e35,_0x5b035b,_0x3968bc,_0x39fd51){const _0x44f0cb=a74_0x2738f3,{promises:_0x8290d8}=await import('fs'),_0x259ca5=new URLSearchParams();_0x259ca5[_0x44f0cb(0xfc)]('project',_0x245e35),_0x259ca5['append'](_0x44f0cb(0x10c),_0x5b035b);_0x39fd51?.[_0x44f0cb(0x107)]&&_0x259ca5[_0x44f0cb(0xfc)]('schedule_from',_0x39fd51[_0x44f0cb(0x107)]);_0x39fd51?.[_0x44f0cb(0xe1)]&&_0x39fd51[_0x44f0cb(0xe1)][_0x44f0cb(0x133)](_0x5f20eb=>{const _0x4fe293=_0x44f0cb;_0x259ca5[_0x4fe293(0xfc)](_0x4fe293(0x113),_0x5f20eb);});_0x39fd51?.[_0x44f0cb(0x112)]&&_0x259ca5[_0x44f0cb(0xfc)](_0x44f0cb(0xf8),'true');const _0x2cd73a=_0x259ca5[_0x44f0cb(0x11e)](),_0x310333=_0x44f0cb(0x10b)+_0x2cd73a,_0x29a04c=await _0x8290d8[_0x44f0cb(0xe6)](_0x3968bc);return await this[_0x44f0cb(0x110)][_0x44f0cb(0xd1)](_0x44f0cb(0x111),_0x310333,{'body':_0x29a04c,'headers':{'Content-Type':_0x44f0cb(0x103)}});}async[a74_0x2738f3(0x102)](_0x431fd0){const _0xb74e70=a74_0x2738f3;return await this[_0xb74e70(0x110)][_0xb74e70(0xd1)]('GET',_0xb74e70(0x122)+encodeURIComponent(_0x431fd0));}async[a74_0x2738f3(0xd9)](_0x313b84){const _0x23ca1c=a74_0x2738f3;return await this[_0x23ca1c(0x110)][_0x23ca1c(0xd1)](_0x23ca1c(0xe5),_0x23ca1c(0x122)+encodeURIComponent(_0x313b84));}async[a74_0x2738f3(0xe7)](_0x2cf0b9){const _0x31a8f1=a74_0x2738f3,_0x3682fc=await this[_0x31a8f1(0x110)][_0x31a8f1(0xd1)](_0x31a8f1(0xd3),'/api/projects/'+encodeURIComponent(_0x2cf0b9)+'/secrets');return _0x3682fc['secrets']||[];}async[a74_0x2738f3(0xf6)](_0x50693c,_0x433c1a,_0xd1f4e){const _0xa4a189=a74_0x2738f3;await this[_0xa4a189(0x110)][_0xa4a189(0xd1)](_0xa4a189(0x111),_0xa4a189(0x122)+encodeURIComponent(_0x50693c)+_0xa4a189(0x132)+encodeURIComponent(_0x433c1a),{'body':{'value':_0xd1f4e}});}async[a74_0x2738f3(0x10f)](_0x13956e,_0x5bd2ae){const _0x4b374f=a74_0x2738f3;await this[_0x4b374f(0x110)]['request'](_0x4b374f(0xe5),_0x4b374f(0x122)+encodeURIComponent(_0x13956e)+_0x4b374f(0x132)+encodeURIComponent(_0x5bd2ae));}}function a74_0x187c(){const _0x3fb14f=['params','setSecret','363160fqZShz','clear_schedule_all','to_time','/tasks/','listSessions','append','/api/attempts/','/tasks','project','status','uploadProjectArchive','getProject','application/gzip','/files?','retryAttemptName','force','scheduleFrom','from_time','listProjects','from_task','/api/projects?','revision','workflowId','/api/workflows?','deleteSecret','httpClient','PUT','clearScheduleAll','clear_schedule','2007UFCgYq','authHeaders','startAttempt','workflow','128KbREnT','listLogFiles','attempts','resume_from','files','listWorkflows','toString','/api/sessions/','/retry','project_id','/api/projects/','/files','include_retried','retry_params','site','offset','replace','284571RzRwHv','reason','1540416rNnEXG','getAttemptTasks','include_subtasks','workflowName','writeFile','/api/projects','length','/secrets/','forEach','tasks','killAttempt','POST','name_pattern','/api/attempts?','project_name','limit','/sessions','request','getTaskLogs','GET','name','sessionTime','/api/logs/','834792EyNefa','retryAttempt','deleteProject','workflows','6AqEKCy','last_id','projectName','projects','/api/attempts','165815LdLJVp','clearSchedule','/logs?','retrySession','6MAeOJX','DELETE','readFile','listSecrets','listAttempts','/logs','page_size','workflow_name','allowQueueing','sessions','filter','getAttempt','search_project_name','true','/kill','13321xMtMdV','6020KzthUq'];a74_0x187c=function(){return _0x3fb14f;};return a74_0x187c();}
|
|
1
|
+
const a74_0x52578b=a74_0x91b4;(function(_0x4fd5f7,_0x560844){const _0x5de283=a74_0x91b4,_0x363a66=_0x4fd5f7();while(!![]){try{const _0x25f649=parseInt(_0x5de283(0xd9))/0x1+parseInt(_0x5de283(0xbb))/0x2+parseInt(_0x5de283(0xb4))/0x3*(-parseInt(_0x5de283(0xa0))/0x4)+-parseInt(_0x5de283(0xd7))/0x5*(parseInt(_0x5de283(0xc3))/0x6)+parseInt(_0x5de283(0xec))/0x7*(parseInt(_0x5de283(0xff))/0x8)+-parseInt(_0x5de283(0xb2))/0x9*(parseInt(_0x5de283(0xc5))/0xa)+parseInt(_0x5de283(0xf8))/0xb;if(_0x25f649===_0x560844)break;else _0x363a66['push'](_0x363a66['shift']());}catch(_0x4030b3){_0x363a66['push'](_0x363a66['shift']());}}}(a74_0x3f78,0xea500));import{HTTPClient}from'./http-client.js';import{getEndpoint}from'../types/index.js';import{getAuthHeaders,toHeaderRecord}from'../../core/auth.js';function a74_0x3f78(){const _0x121570=['project_name','logs','include_retried','getAttemptTasks','deleteProject','filter','uploadProjectArchive','/api/sessions','12953511iXNBuA','/logs','15KjlgFH','/secrets/','allowQueueing','length','/archive','site','name_pattern','411238EiVigS','listSessions','projects','to_time','workflowName','status','listLogFiles','append','48QAolhi','retry_params','10wfQdEa','/sessions','toString','clearSchedule','/secrets','application/gzip','retryAttemptName','force','/retry','workflowId','/api/sessions/','/api/logs/','offset','count','/api/workflows?','workflow','GET','getAttempt','870420qMuyoJ','writeFile','839028LCMcPB','projectName','files','replace','/tasks?','limit','killAttempt','resume_from','/files','/api/projects/','params','from_task','retryAttempt','/api/attempts?','revision','request','authHeaders','/tasks/','name','338366wBajNj','/files?','/api/attempts','listWorkflows','listProjects','project','last_id','secrets','apiKey','workflows','/api/attempts/','page_size','24876984oyYETT','include_subtasks','true','/tasks','PUT','scheduleFrom','DELETE','184Rhdqjf','getTaskLogs','search_project_name','setSecret','workflow_name','/archive?','from_time','501016itYPZq','POST','attempts','getProject','httpClient','tasks','task','/api/projects?','deleteSecret','/logs?'];a74_0x3f78=function(){return _0x121570;};return a74_0x3f78();}function a74_0x91b4(_0x5310cd,_0x597fd7){_0x5310cd=_0x5310cd-0x9c;const _0x3f785d=a74_0x3f78();let _0x91b43a=_0x3f785d[_0x5310cd];return _0x91b43a;}import{matchGlobPattern}from'../../utils/string-utils.js';export class WorkflowApiClient{['httpClient'];['authHeaders'];constructor(_0x56bbba,_0x19761f){const _0x2c3677=a74_0x91b4,_0x5865e4=getEndpoint(_0x56bbba[_0x2c3677(0xb9)],_0x2c3677(0xd4));this[_0x2c3677(0xe9)]=toHeaderRecord(getAuthHeaders(_0x56bbba[_0x2c3677(0xb9)],_0x56bbba[_0x2c3677(0xf4)])),this[_0x2c3677(0xa4)]=new HTTPClient(_0x5865e4,this[_0x2c3677(0xe9)],_0x19761f);}async[a74_0x52578b(0xf0)](_0x427dfa){const _0x3ac603=a74_0x52578b,_0x1323e0=new URLSearchParams();if(_0x427dfa?.['limit'])_0x1323e0[_0x3ac603(0xc2)]('count',String(_0x427dfa[_0x3ac603(0xde)]));if(_0x427dfa?.['last_id'])_0x1323e0[_0x3ac603(0xc2)](_0x3ac603(0xf2),_0x427dfa[_0x3ac603(0xf2)]);if(_0x427dfa?.[_0x3ac603(0xba)]){const _0x68b053=_0x427dfa[_0x3ac603(0xba)][_0x3ac603(0xdc)](/[*?]/g,'');_0x68b053&&_0x1323e0[_0x3ac603(0xc2)](_0x3ac603(0xba),_0x68b053);}const _0x1187ed=_0x1323e0['toString'](),_0x5c288f=_0x1187ed?_0x3ac603(0xa7)+_0x1187ed:'/api/projects',_0x8cfd2e=await this[_0x3ac603(0xa4)][_0x3ac603(0xe8)]('GET',_0x5c288f),_0x365aa2=_0x8cfd2e[_0x3ac603(0xbd)]||[],_0x56f39f=_0x365aa2[_0x3ac603(0xb7)]>0x0?_0x365aa2[_0x365aa2['length']-0x1]['id']:undefined;let _0x6c32b7=_0x365aa2;return _0x427dfa?.[_0x3ac603(0xba)]&&(_0x6c32b7=_0x6c32b7[_0x3ac603(0xaf)](_0x2ad28a=>{const _0x5835cc=_0x3ac603;return matchGlobPattern(_0x2ad28a[_0x5835cc(0xeb)],_0x427dfa[_0x5835cc(0xba)]);})),{'data':_0x6c32b7,'lastId':_0x56f39f,'rawCount':_0x365aa2[_0x3ac603(0xb7)]};}async[a74_0x52578b(0xef)](_0x2b97a7){const _0x9946b1=a74_0x52578b,_0x373dbf=new URLSearchParams();if(_0x2b97a7?.[_0x9946b1(0xde)])_0x373dbf[_0x9946b1(0xc2)](_0x9946b1(0xd2),String(_0x2b97a7[_0x9946b1(0xde)]));if(_0x2b97a7?.[_0x9946b1(0xf2)])_0x373dbf[_0x9946b1(0xc2)](_0x9946b1(0xf2),_0x2b97a7['last_id']);if(_0x2b97a7?.[_0x9946b1(0xaa)]){const _0x306691=_0x2b97a7[_0x9946b1(0xaa)]['replace'](/[*?]/g,'');_0x306691&&(_0x373dbf[_0x9946b1(0xc2)](_0x9946b1(0xba),_0x306691),_0x373dbf[_0x9946b1(0xc2)](_0x9946b1(0x101),_0x9946b1(0xfa)));}const _0x5098b0=_0x373dbf['toString'](),_0x4186c=_0x5098b0?_0x9946b1(0xd3)+_0x5098b0:'/api/workflows',_0x120787=await this[_0x9946b1(0xa4)][_0x9946b1(0xe8)]('GET',_0x4186c),_0x45ba80=_0x120787[_0x9946b1(0xf5)]||[],_0x461305=_0x45ba80[_0x9946b1(0xb7)]>0x0?_0x45ba80[_0x45ba80[_0x9946b1(0xb7)]-0x1]['id']:undefined;let _0x4f5de7=_0x45ba80;return _0x2b97a7?.[_0x9946b1(0xaa)]&&(_0x4f5de7=_0x4f5de7['filter'](_0x19899e=>{const _0x377bb4=_0x9946b1,_0x5f326e=_0x19899e[_0x377bb4(0xf1)]?.[_0x377bb4(0xeb)];if(!_0x5f326e)return![];return matchGlobPattern(_0x5f326e,_0x2b97a7['project_name']);})),{'data':_0x4f5de7,'lastId':_0x461305,'rawCount':_0x45ba80[_0x9946b1(0xb7)]};}async[a74_0x52578b(0xbc)](_0x2a027b){const _0xded82a=a74_0x52578b;let _0x5e7d28=_0xded82a(0xb1);_0x2a027b?.['project_id']&&(_0x5e7d28=_0xded82a(0xe2)+encodeURIComponent(_0x2a027b['project_id'])+_0xded82a(0xc6));const _0x49d20a=new URLSearchParams();if(_0x2a027b?.[_0xded82a(0x9d)])_0x49d20a[_0xded82a(0xc2)]('workflow',_0x2a027b['workflow_name']);if(_0x2a027b?.[_0xded82a(0xc0)])_0x49d20a['append']('status',_0x2a027b[_0xded82a(0xc0)]);if(_0x2a027b?.[_0xded82a(0x9f)])_0x49d20a['append'](_0xded82a(0x9f),_0x2a027b[_0xded82a(0x9f)]);if(_0x2a027b?.[_0xded82a(0xbe)])_0x49d20a[_0xded82a(0xc2)](_0xded82a(0xbe),_0x2a027b[_0xded82a(0xbe)]);if(_0x2a027b?.['limit'])_0x49d20a[_0xded82a(0xc2)]('page_size',String(_0x2a027b[_0xded82a(0xde)]));if(_0x2a027b?.[_0xded82a(0xf2)])_0x49d20a[_0xded82a(0xc2)]('last_id',_0x2a027b['last_id']);const _0x37c9a1=_0x49d20a[_0xded82a(0xc7)]();_0x37c9a1&&(_0x5e7d28=_0x5e7d28+'?'+_0x37c9a1);const _0x9a9892=await this[_0xded82a(0xa4)][_0xded82a(0xe8)](_0xded82a(0xd5),_0x5e7d28),_0x5cf6fe=_0x9a9892['sessions']||[],_0x35df7c=_0x5cf6fe[_0xded82a(0xb7)]>0x0?_0x5cf6fe[_0x5cf6fe[_0xded82a(0xb7)]-0x1]['id']:undefined;return{'data':_0x5cf6fe,'lastId':_0x35df7c};}async['listAttempts'](_0x2e46ff){const _0x125370=a74_0x52578b,_0x41d09c=new URLSearchParams();if(_0x2e46ff?.[_0x125370(0xaa)])_0x41d09c[_0x125370(0xc2)](_0x125370(0xf1),_0x2e46ff['project_name']);if(_0x2e46ff?.[_0x125370(0x9d)])_0x41d09c[_0x125370(0xc2)](_0x125370(0xd4),_0x2e46ff[_0x125370(0x9d)]);if(_0x2e46ff?.[_0x125370(0xac)])_0x41d09c['append']('include_retried','1');if(_0x2e46ff?.['limit'])_0x41d09c[_0x125370(0xc2)](_0x125370(0xf7),String(_0x2e46ff[_0x125370(0xde)]));if(_0x2e46ff?.[_0x125370(0xf2)])_0x41d09c[_0x125370(0xc2)]('last_id',_0x2e46ff[_0x125370(0xf2)]);const _0x1f48c1=_0x41d09c[_0x125370(0xc7)](),_0x254a38=_0x1f48c1?_0x125370(0xe6)+_0x1f48c1:_0x125370(0xee),_0x128cc3=await this[_0x125370(0xa4)][_0x125370(0xe8)](_0x125370(0xd5),_0x254a38),_0x4c9d18=_0x128cc3[_0x125370(0xa2)]||[],_0x1300e0=_0x4c9d18[_0x125370(0xb7)]>0x0?_0x4c9d18[_0x4c9d18[_0x125370(0xb7)]-0x1]['id']:undefined;return{'data':_0x4c9d18,'lastId':_0x1300e0};}async[a74_0x52578b(0xd6)](_0x52d62e){const _0x2e3aaf=a74_0x52578b;return await this[_0x2e3aaf(0xa4)]['request'](_0x2e3aaf(0xd5),_0x2e3aaf(0xf6)+encodeURIComponent(_0x52d62e));}async[a74_0x52578b(0xad)](_0xb3d345,_0x103368=![]){const _0xedaaf9=a74_0x52578b,_0x3789df=new URLSearchParams();_0x103368&&_0x3789df['append'](_0xedaaf9(0xf9),'true');const _0x27871f=_0x3789df[_0xedaaf9(0xc7)](),_0x2621b4=_0x27871f?_0xedaaf9(0xf6)+encodeURIComponent(_0xb3d345)+_0xedaaf9(0xdd)+_0x27871f:_0xedaaf9(0xf6)+encodeURIComponent(_0xb3d345)+_0xedaaf9(0xfb),_0xb2556e=await this['httpClient'][_0xedaaf9(0xe8)]('GET',_0x2621b4);return _0xb2556e[_0xedaaf9(0xa5)]||[];}async[a74_0x52578b(0x100)](_0x296e19,_0x55ec79,_0x51f049){const _0x377faf=a74_0x52578b,_0x5ecb15=new URLSearchParams();_0x51f049?.['offset']!==undefined&&_0x5ecb15[_0x377faf(0xc2)](_0x377faf(0xd1),String(_0x51f049[_0x377faf(0xd1)]));_0x51f049?.[_0x377faf(0xde)]!==undefined&&_0x5ecb15[_0x377faf(0xc2)](_0x377faf(0xde),String(_0x51f049[_0x377faf(0xde)]));const _0x4272bb=_0x5ecb15[_0x377faf(0xc7)](),_0x2cb2a8=_0x4272bb?'/api/attempts/'+encodeURIComponent(_0x296e19)+_0x377faf(0xea)+encodeURIComponent(_0x55ec79)+_0x377faf(0xa9)+_0x4272bb:_0x377faf(0xf6)+encodeURIComponent(_0x296e19)+_0x377faf(0xea)+encodeURIComponent(_0x55ec79)+_0x377faf(0xb3),_0x3f7b3e=await this[_0x377faf(0xa4)][_0x377faf(0xe8)]('GET',_0x2cb2a8);return _0x3f7b3e[_0x377faf(0xab)]||[];}async[a74_0x52578b(0xc1)](_0x3c081b,_0xf0202a){const _0x3aef83=a74_0x52578b,_0x59dbd4=new URLSearchParams();_0xf0202a&&_0x59dbd4[_0x3aef83(0xc2)](_0x3aef83(0xa6),_0xf0202a);const _0x5e234c=_0x59dbd4[_0x3aef83(0xc7)](),_0x3dfdbd=_0x5e234c?_0x3aef83(0xd0)+encodeURIComponent(_0x3c081b)+_0x3aef83(0xed)+_0x5e234c:'/api/logs/'+encodeURIComponent(_0x3c081b)+_0x3aef83(0xe1),_0x3aefd7=await this[_0x3aef83(0xa4)][_0x3aef83(0xe8)](_0x3aef83(0xd5),_0x3dfdbd);return _0x3aefd7[_0x3aef83(0xdb)]||[];}async[a74_0x52578b(0xdf)](_0x49bb18,_0x22d551){const _0x58f5de=a74_0x52578b,_0x497aee={};return _0x22d551&&(_0x497aee['reason']=_0x22d551),await this[_0x58f5de(0xa4)][_0x58f5de(0xe8)](_0x58f5de(0xa1),_0x58f5de(0xf6)+encodeURIComponent(_0x49bb18)+'/kill',{'body':_0x497aee});}async['retrySession'](_0x2b8c85,_0x1a06d1){const _0x487202=a74_0x52578b,_0x4d78a6={};return _0x1a06d1?.[_0x487202(0xe4)]&&(_0x4d78a6[_0x487202(0xe4)]=_0x1a06d1['from_task']),_0x1a06d1?.[_0x487202(0xc4)]&&(_0x4d78a6['retry_params']=_0x1a06d1[_0x487202(0xc4)]),await this[_0x487202(0xa4)][_0x487202(0xe8)](_0x487202(0xa1),_0x487202(0xcf)+encodeURIComponent(_0x2b8c85)+_0x487202(0xcd),{'body':_0x4d78a6});}async[a74_0x52578b(0xe5)](_0x43fccb,_0x11263b){const _0x306002=a74_0x52578b,_0x4becdb={};return _0x11263b?.[_0x306002(0xe0)]&&(_0x4becdb[_0x306002(0xe0)]=_0x11263b[_0x306002(0xe0)]),_0x11263b?.[_0x306002(0xc4)]&&(_0x4becdb[_0x306002(0xc4)]=_0x11263b[_0x306002(0xc4)]),_0x11263b?.[_0x306002(0xcc)]&&(_0x4becdb[_0x306002(0xcc)]=_0x11263b[_0x306002(0xcc)]),await this['httpClient'][_0x306002(0xe8)](_0x306002(0xa1),_0x306002(0xf6)+encodeURIComponent(_0x43fccb)+'/retry',{'body':_0x4becdb});}async['startAttempt'](_0x736399){const _0x317e2=a74_0x52578b,_0x3a85ca={'sessionTime':_0x736399['sessionTime'],'params':_0x736399[_0x317e2(0xe3)]};return _0x736399[_0x317e2(0xce)]&&(_0x3a85ca[_0x317e2(0xce)]=_0x736399[_0x317e2(0xce)]),_0x736399[_0x317e2(0xda)]&&(_0x3a85ca[_0x317e2(0xda)]=_0x736399[_0x317e2(0xda)]),_0x736399['workflowName']&&(_0x3a85ca[_0x317e2(0xbf)]=_0x736399[_0x317e2(0xbf)]),_0x736399[_0x317e2(0xcb)]&&(_0x3a85ca['retryAttemptName']=_0x736399[_0x317e2(0xcb)]),_0x736399[_0x317e2(0xb6)]!==undefined&&(_0x3a85ca[_0x317e2(0xb6)]=_0x736399[_0x317e2(0xb6)]),await this[_0x317e2(0xa4)][_0x317e2(0xe8)]('PUT',_0x317e2(0xee),{'body':_0x3a85ca});}async['downloadProjectArchive'](_0x49af09,_0x58e9ba,_0x20a329){const _0x3c3425=a74_0x52578b,{promises:_0x33ae3f}=await import('fs'),_0xa1ab8=new URLSearchParams();_0x20a329&&_0xa1ab8['append'](_0x3c3425(0xe7),_0x20a329);const _0x488a43=_0xa1ab8[_0x3c3425(0xc7)](),_0x13cc37=_0x488a43?_0x3c3425(0xe2)+encodeURIComponent(_0x49af09)+_0x3c3425(0x9e)+_0x488a43:_0x3c3425(0xe2)+encodeURIComponent(_0x49af09)+_0x3c3425(0xb8),_0x2e43e8=await this[_0x3c3425(0xa4)][_0x3c3425(0xe8)](_0x3c3425(0xd5),_0x13cc37,{'headers':{'Accept':_0x3c3425(0xca)},'responseType':'arraybuffer'});return await _0x33ae3f[_0x3c3425(0xd8)](_0x58e9ba,_0x2e43e8),_0x58e9ba;}async[a74_0x52578b(0xb0)](_0x3a9a48,_0x15a069,_0x28b65f,_0xe8cb1b){const _0x379b70=a74_0x52578b,{promises:_0x3f3a53}=await import('fs'),_0x1034ff=new URLSearchParams();_0x1034ff[_0x379b70(0xc2)](_0x379b70(0xf1),_0x3a9a48),_0x1034ff[_0x379b70(0xc2)]('revision',_0x15a069);_0xe8cb1b?.['scheduleFrom']&&_0x1034ff['append']('schedule_from',_0xe8cb1b[_0x379b70(0xfd)]);_0xe8cb1b?.[_0x379b70(0xc8)]&&_0xe8cb1b[_0x379b70(0xc8)]['forEach'](_0x4ccb7d=>{_0x1034ff['append']('clear_schedule',_0x4ccb7d);});_0xe8cb1b?.['clearScheduleAll']&&_0x1034ff[_0x379b70(0xc2)]('clear_schedule_all','true');const _0x2eca70=_0x1034ff[_0x379b70(0xc7)](),_0x5cb28d=_0x379b70(0xa7)+_0x2eca70,_0xe5342e=await _0x3f3a53['readFile'](_0x28b65f);return await this[_0x379b70(0xa4)][_0x379b70(0xe8)](_0x379b70(0xfc),_0x5cb28d,{'body':_0xe5342e,'headers':{'Content-Type':_0x379b70(0xca)}});}async[a74_0x52578b(0xa3)](_0x507c95){const _0x4582a9=a74_0x52578b;return await this[_0x4582a9(0xa4)][_0x4582a9(0xe8)](_0x4582a9(0xd5),_0x4582a9(0xe2)+encodeURIComponent(_0x507c95));}async[a74_0x52578b(0xae)](_0x46d923){const _0x142e5c=a74_0x52578b;return await this[_0x142e5c(0xa4)]['request'](_0x142e5c(0xfe),_0x142e5c(0xe2)+encodeURIComponent(_0x46d923));}async['listSecrets'](_0x8e4d39){const _0x75caa0=a74_0x52578b,_0x578484=await this[_0x75caa0(0xa4)][_0x75caa0(0xe8)](_0x75caa0(0xd5),_0x75caa0(0xe2)+encodeURIComponent(_0x8e4d39)+_0x75caa0(0xc9));return _0x578484[_0x75caa0(0xf3)]||[];}async[a74_0x52578b(0x9c)](_0x1e2901,_0x424bf5,_0x538cce){const _0x2f81a8=a74_0x52578b;await this['httpClient'][_0x2f81a8(0xe8)](_0x2f81a8(0xfc),_0x2f81a8(0xe2)+encodeURIComponent(_0x1e2901)+_0x2f81a8(0xb5)+encodeURIComponent(_0x424bf5),{'body':{'value':_0x538cce}});}async[a74_0x52578b(0xa8)](_0x3deb7a,_0x5e1115){const _0x7e99c9=a74_0x52578b;await this[_0x7e99c9(0xa4)][_0x7e99c9(0xe8)](_0x7e99c9(0xfe),'/api/projects/'+encodeURIComponent(_0x3deb7a)+'/secrets/'+encodeURIComponent(_0x5e1115));}}
|