@npayload/sdk 0.0.0-stage → 5.0.4
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/LICENSE +21 -0
- package/README.md +156 -2
- package/dist/chunk-22PYMXSS.mjs +1 -0
- package/dist/chunk-26BFOUGE.mjs +1 -0
- package/dist/chunk-2N25V56J.mjs +20 -0
- package/dist/chunk-2OCUKD3K.mjs +1 -0
- package/dist/chunk-2PCG57PX.mjs +1 -0
- package/dist/chunk-2XQXDEXA.mjs +1 -0
- package/dist/chunk-455C67EN.mjs +1 -0
- package/dist/chunk-4HVQZC7R.mjs +1 -0
- package/dist/chunk-4NWQCPI4.mjs +1 -0
- package/dist/chunk-52ZB3ZAG.mjs +1 -0
- package/dist/chunk-5SMWYS7Z.mjs +1 -0
- package/dist/chunk-5YK2JKKH.mjs +17 -0
- package/dist/chunk-6NCRQ746.mjs +9 -0
- package/dist/chunk-6RMN6EHY.mjs +1 -0
- package/dist/chunk-6ZOPXG44.mjs +64 -0
- package/dist/chunk-76OM2ZBO.mjs +5 -0
- package/dist/chunk-A7HA64P6.mjs +1 -0
- package/dist/chunk-APBVAT7F.mjs +1 -0
- package/dist/chunk-BBHWYMQA.mjs +1 -0
- package/dist/chunk-BMMAZIUY.mjs +1 -0
- package/dist/chunk-CJDCY2NH.mjs +1 -0
- package/dist/chunk-EL7XOWA4.mjs +1 -0
- package/dist/chunk-EXNCOEHS.mjs +1 -0
- package/dist/chunk-FAO3QJC5.mjs +1 -0
- package/dist/chunk-FNAZW7X3.mjs +3 -0
- package/dist/chunk-GEJT7NMK.mjs +1 -0
- package/dist/chunk-GGXNXM73.mjs +1 -0
- package/dist/chunk-GKDZ7663.mjs +1 -0
- package/dist/chunk-HTQLUO4J.mjs +1 -0
- package/dist/chunk-II74EBLQ.mjs +1 -0
- package/dist/chunk-JBAV2AQK.mjs +1 -0
- package/dist/chunk-KUJJYP3K.mjs +22 -0
- package/dist/chunk-LJNU5QHZ.mjs +1 -0
- package/dist/chunk-LT2DQLXJ.mjs +1 -0
- package/dist/chunk-MDW42OG6.mjs +8 -0
- package/dist/chunk-MPYL6HQR.mjs +1 -0
- package/dist/chunk-OA73YMB6.mjs +6 -0
- package/dist/chunk-PKG2R6XN.mjs +1 -0
- package/dist/chunk-QUJ2IZXU.mjs +1 -0
- package/dist/chunk-RIBBVOCC.mjs +1 -0
- package/dist/chunk-TQFAYJEP.mjs +4 -0
- package/dist/chunk-UMQ2SWSM.mjs +5 -0
- package/dist/chunk-WE3NRBO6.mjs +1 -0
- package/dist/chunk-XLK55DEY.mjs +1 -0
- package/dist/chunk-YHY7Y4HD.mjs +4 -0
- package/dist/chunk-YQVQTVHK.mjs +2 -0
- package/dist/cli/index.d.mts +54 -0
- package/dist/cli/index.d.ts +54 -0
- package/dist/cli/index.js +852 -0
- package/dist/cli/index.mjs +696 -0
- package/dist/events/index.d.mts +10 -0
- package/dist/events/index.d.ts +10 -0
- package/dist/events/index.js +1 -0
- package/dist/events/index.mjs +1 -0
- package/dist/index.d.mts +49687 -0
- package/dist/index.d.ts +49687 -0
- package/dist/index.js +2 -0
- package/dist/index.mjs +2 -0
- package/package.json +120 -4
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as bt,b as ba,c as Na,d as va,g as Sa,h as _a,i as ka,j as Ta,k as Ca}from"./chunk-II74EBLQ.mjs";import{b as Ea,c as Wu,d as Ou,e as $u}from"./chunk-CJDCY2NH.mjs";import{a as Uu,b as zu,c as Fu,d as ju,e as Du,f as Lu}from"./chunk-2XQXDEXA.mjs";import{a as Nt,b as qu,c as Bu}from"./chunk-GKDZ7663.mjs";import{a as fa}from"./chunk-BMMAZIUY.mjs";import{a as Ge,b as ya,c as Ra,d as Pa,f as yr,h as ga}from"./chunk-WE3NRBO6.mjs";import{C as Tu,D as pa,E as yt,F as ua,G as Cu,H as $e,I as xu,J as Au,K as lr,L as re,M as ca,O as Rt,S as mr,V as wa,W as Pt,X as Ae,Y as Ie,a as cr,c as Oe,ca as hr,da as oe,e as ea,ea as Iu,f as ra,fa as gt,ga as Gu,ha as Mu,ia as la,ja as ma,ka as ha,l as wr,m as oa,ma as Hu,n as sa,o as mt,p as ht,q as ta,r as na,s as aa,u as ia,y as da}from"./chunk-YHY7Y4HD.mjs";import"./chunk-GGXNXM73.mjs";import{a as v,c as A}from"./chunk-LJNU5QHZ.mjs";var _={};A(_,{BadRequestError:()=>u,ForbiddenError:()=>w,NotFoundError:()=>l,OauthScope:()=>Ku,TooManyRequestsError:()=>m,UnauthorizedError:()=>c,account:()=>vt,analytics:()=>_t,audit:()=>kt,billing:()=>Ct,connect:()=>Bt,embed:()=>Sn,events:()=>Ot,feed:()=>Jt,notify:()=>Xt,pipes:()=>on,primus:()=>bn,tenants:()=>vn,webhooks:()=>En});var vt={};A(vt,{environments:()=>xa});var xa={};var _t={};A(_t,{ListRollupsRequestGranularity:()=>Ia,PercentileSketchesRequestGranularity:()=>Ga,SnapshotSummaryRequestGranularity:()=>Ha,TopKSketchesRequestGranularity:()=>Ma,events:()=>Aa,rollups:()=>ft,sketches:()=>Et,summary:()=>St});var Aa={};var ft={};A(ft,{ListRollupsRequestGranularity:()=>Ia});var Ia={Minute:"minute",Hour:"hour",Day:"day"};var Et={};A(Et,{PercentileSketchesRequestGranularity:()=>Ga,TopKSketchesRequestGranularity:()=>Ma});var Ga={Minute:"minute",Hour:"hour",Day:"day"};var Ma={Minute:"minute",Hour:"hour",Day:"day"};var St={};A(St,{SnapshotSummaryRequestGranularity:()=>Ha});var Ha={Minute:"minute",Hour:"hour",Day:"day"};var kt={};A(kt,{chain:()=>qa,events:()=>Ba});var qa={};var Ba={};var Ct={};A(Ct,{ListInvoicesInvoicesRequestStatus:()=>$a,connectAccounts:()=>Fa,credits:()=>ja,disputes:()=>Da,dunning:()=>La,feedListings:()=>Oa,functions:()=>za,invoices:()=>Tt,paymentMethods:()=>Ka,payouts:()=>Wa,revenue:()=>Xa,subscriptions:()=>Ua,tax:()=>Qa,taxIds:()=>Ja,testClocks:()=>Va,usage:()=>Ya});var Ua={};var za={};var Fa={};var ja={};var Da={};var La={};var Wa={};var Oa={};var Tt={};A(Tt,{ListInvoicesInvoicesRequestStatus:()=>$a});var $a={Paid:"paid",Open:"open",PastDue:"past_due",Uncollectible:"uncollectible",Void:"void",Draft:"draft"};var Ka={};var Ja={};var Qa={};var Va={};var Ya={};var Xa={};var Bt={};A(Bt,{GetEcosystemGraphConnectInsightsRequestDirection:()=>ai,GetEcosystemGraphConnectInsightsRequestEnvKind:()=>ni,GetEcosystemGraphConnectInsightsRequestInclude:()=>di,GetEcosystemGraphConnectInsightsRequestStatus:()=>ii,GetGrantUsageConnectAccessRequestPeriod:()=>wi,ListBridgesConnectBridgesRequestStatus:()=>Za,ListConsentsConnectTenantApprovalRequestStatus:()=>ei,ListMyGrantsConnectAccessRequestDirection:()=>ui,ListMyGrantsConnectAccessRequestEnvKind:()=>ci,ListMyGrantsConnectAccessRequestStatus:()=>pi,ListPartnerAppTenantApprovalsConnectRequestStatus:()=>Ri,ListPartnerTenantApprovalsConnectTenantApprovalRequestStatus:()=>ri,ListPlatformConnectApprovalsConnectTenantApprovalRequestStatus:()=>oi,ListPublishGrantsRequestDirection:()=>gi,ListReceiptsByGrantConsentReceiptsRequestStatus:()=>li,ListTenantApprovalsConnectTenantApprovalRequestStatus:()=>si,connect:()=>Ht,connectAccess:()=>Gt,connectBridges:()=>xt,connectExplore:()=>ti,connectInsights:()=>It,connectPartner:()=>mi,connectProfile:()=>hi,connectTenantApproval:()=>At,consentReceipts:()=>Mt,entityNat:()=>yi,identityBridges:()=>Pi,publishGrants:()=>qt});var xt={};A(xt,{ListBridgesConnectBridgesRequestStatus:()=>Za});var Za={Pending:"pending",Active:"active",Suspended:"suspended",Archived:"archived"};var At={};A(At,{ListConsentsConnectTenantApprovalRequestStatus:()=>ei,ListPartnerTenantApprovalsConnectTenantApprovalRequestStatus:()=>ri,ListPlatformConnectApprovalsConnectTenantApprovalRequestStatus:()=>oi,ListTenantApprovalsConnectTenantApprovalRequestStatus:()=>si});var ei={Active:"active",Revoked:"revoked",Frozen:"frozen",Delisted:"delisted",Expired:"expired"};var ri={Active:"active",Revoked:"revoked",Frozen:"frozen",Delisted:"delisted",Expired:"expired"};var oi={Active:"active",Revoked:"revoked",Frozen:"frozen",Delisted:"delisted",Expired:"expired"};var si={Active:"active",Revoked:"revoked",Frozen:"frozen",Delisted:"delisted",Expired:"expired"};var ti={};var It={};A(It,{GetEcosystemGraphConnectInsightsRequestDirection:()=>ai,GetEcosystemGraphConnectInsightsRequestEnvKind:()=>ni,GetEcosystemGraphConnectInsightsRequestInclude:()=>di,GetEcosystemGraphConnectInsightsRequestStatus:()=>ii});var ni={Sandbox:"sandbox",Production:"production"};var ai={Given:"given",Received:"received"};var ii={Pending:"pending",Active:"active",Rejected:"rejected",Revoked:"revoked",Expired:"expired",Suspended:"suspended"};var di={Feeds:"feeds"};var Gt={};A(Gt,{GetGrantUsageConnectAccessRequestPeriod:()=>wi,ListMyGrantsConnectAccessRequestDirection:()=>ui,ListMyGrantsConnectAccessRequestEnvKind:()=>ci,ListMyGrantsConnectAccessRequestStatus:()=>pi});var pi={Pending:"pending",Active:"active",Rejected:"rejected",Revoked:"revoked",Expired:"expired",Suspended:"suspended"};var ui={Sent:"sent",Received:"received"};var ci={Sandbox:"sandbox",Production:"production"};var wi={SevenD:"7d",ThirtyD:"30d",Custom:"custom"};var Mt={};A(Mt,{ListReceiptsByGrantConsentReceiptsRequestStatus:()=>li});var li={Active:"active",Revoked:"revoked",Frozen:"frozen",Delisted:"delisted",Expired:"expired"};var mi={};var hi={};var yi={};var Ht={};A(Ht,{ListPartnerAppTenantApprovalsConnectRequestStatus:()=>Ri});var Ri={Active:"active",Revoked:"revoked",Frozen:"frozen",Delisted:"delisted",Expired:"expired"};var Pi={};var qt={};A(qt,{ListPublishGrantsRequestDirection:()=>gi});var gi={Granted:"granted",Held:"held"};var Ot={};A(Ot,{ListByAppDeliveriesRequestStatus:()=>Ei,ListByAppDlqRequestStatus:()=>_i,ListByAppSubscriptionsRequestStatus:()=>Ai,ListByChannelReceiptsRequestStatus:()=>ji,ListBySubscriptionDeliveriesRequestStatus:()=>Si,ListBySubscriptionDlqRequestStatus:()=>ki,ListChannelsRequestStatus:()=>Ni,ListKeysAppDpopKeysRequestStatus:()=>Ti,ListPaginatedChannelsRequestStatus:()=>vi,ListSubscriptionsRequestStatus:()=>Ii,ListWithStatsChannelsRequestStatus:()=>fi,SearchMessagesObservabilityRequestStatus:()=>zi,adapters:()=>bi,appDpopKeys:()=>jt,archiveReplay:()=>Ui,catalogue:()=>Ci,channelDetail:()=>Fi,channels:()=>Ut,consume:()=>Li,consumerGroups:()=>Mi,deliveries:()=>zt,deliveryReceipts:()=>Oi,dlq:()=>Ft,exactlyOnce:()=>Ki,exchanges:()=>Ji,kvStore:()=>Vi,messages:()=>xi,observability:()=>Lt,queueAdmin:()=>rd,queueBatch:()=>Zi,queueQueries:()=>ed,queues:()=>Xi,receipts:()=>Wt,scheduling:()=>Hi,security:()=>Di,snapshots:()=>qi,sources:()=>Yi,stats:()=>$i,streams:()=>Wi,subscriptions:()=>Dt,systemEvents:()=>od,tieredStorage:()=>Gi,timeTravel:()=>Bi,transactional:()=>Qi});var bi={};var Ut={};A(Ut,{ListChannelsRequestStatus:()=>Ni,ListPaginatedChannelsRequestStatus:()=>vi,ListWithStatsChannelsRequestStatus:()=>fi});var Ni={Active:"active",Paused:"paused",Archived:"archived"};var vi={Active:"active",Paused:"paused",Archived:"archived"};var fi={Active:"active",Paused:"paused",Archived:"archived"};var zt={};A(zt,{ListByAppDeliveriesRequestStatus:()=>Ei,ListBySubscriptionDeliveriesRequestStatus:()=>Si});var Ei={Pending:"pending",Inflight:"inflight",Delivered:"delivered",Retrying:"retrying",Failed:"failed",DeadLettered:"dead_lettered",Skipped:"skipped"};var Si={Pending:"pending",Inflight:"inflight",Delivered:"delivered",Retrying:"retrying",Failed:"failed",DeadLettered:"dead_lettered",Skipped:"skipped"};var Ft={};A(Ft,{ListByAppDlqRequestStatus:()=>_i,ListBySubscriptionDlqRequestStatus:()=>ki});var _i={Pending:"pending",Reprocessing:"reprocessing",Reprocessed:"reprocessed",Discarded:"discarded"};var ki={Pending:"pending",Reprocessing:"reprocessing",Reprocessed:"reprocessed",Discarded:"discarded"};var jt={};A(jt,{ListKeysAppDpopKeysRequestStatus:()=>Ti});var Ti={Active:"active",Revoked:"revoked"};var Ci={};var xi={};var Dt={};A(Dt,{ListByAppSubscriptionsRequestStatus:()=>Ai,ListSubscriptionsRequestStatus:()=>Ii});var Ai={Active:"active",Paused:"paused",Disabled:"disabled",Archived:"archived"};var Ii={Active:"active",Paused:"paused",Disabled:"disabled",Archived:"archived"};var Gi={};var Mi={};var Hi={};var qi={};var Bi={};var Ui={};var Lt={};A(Lt,{SearchMessagesObservabilityRequestStatus:()=>zi});var zi={Pending:"pending",Processing:"processing",Delivered:"delivered",Failed:"failed"};var Fi={};var Wt={};A(Wt,{ListByChannelReceiptsRequestStatus:()=>ji});var ji={Delivered:"delivered",Acknowledged:"acknowledged",Processed:"processed",Rejected:"rejected",Expired:"expired"};var Di={};var Li={};var Wi={};var Oi={};var $i={};var Ki={};var Ji={};var Qi={};var Vi={};var Yi={};var Xi={};var Zi={};var ed={};var rd={};var od={};var Jt={};A(Jt,{ListCustomersRequestStatus:()=>sd,ListPublishedListingsRequestEnvironment:()=>nd,ListPublishedListingsRequestPriceTier:()=>td,customers:()=>$t,feedDeliveryBindings:()=>ud,listings:()=>Kt,publisherReputation:()=>pd,publishers:()=>dd,reviews:()=>id,subscriptions:()=>ad});var $t={};A($t,{ListCustomersRequestStatus:()=>sd});var sd={Pending:"pending",Active:"active",Paused:"paused",Cancelled:"cancelled",Expired:"expired"};var Kt={};A(Kt,{ListPublishedListingsRequestEnvironment:()=>nd,ListPublishedListingsRequestPriceTier:()=>td});var td={Free:"free",FlatRate:"flat_rate",UsageBased:"usage_based",Tiered:"tiered"};var nd={Sandbox:"sandbox",Production:"production"};var ad={};var id={};var dd={};var pd={};var ud={};var Xt={};A(Xt,{ClearPreferencesRequestChannel:()=>ld,ListDispatchesRequestStatus:()=>cd,ListInboxRequestStatus:()=>wd,dispatches:()=>Qt,inbox:()=>Vt,preferences:()=>Yt,summary:()=>md,templates:()=>hd,types:()=>yd});var Qt={};A(Qt,{ListDispatchesRequestStatus:()=>cd});var cd={Queued:"queued",Sending:"sending",Sent:"sent",Failed:"failed",Dlq:"dlq"};var Vt={};A(Vt,{ListInboxRequestStatus:()=>wd});var wd={Unread:"unread",Read:"read",Archived:"archived"};var Yt={};A(Yt,{ClearPreferencesRequestChannel:()=>ld});var ld={Email:"email",Sms:"sms",Push:"push",Inapp:"inapp",Slack:"slack"};var md={};var hd={};var yd={};var on={};A(on,{ListApprovalRequestsGovernanceRequestStatus:()=>Ed,ListDecisionsDecisionsRequestGateState:()=>Nd,ListDlqEntriesDlqRequestStatus:()=>vd,agentExecutions:()=>Rd,analyses:()=>Pd,connectors:()=>bd,decisions:()=>Zt,dlq:()=>en,executions:()=>fd,governance:()=>rn,recordDlq:()=>Sd,tools:()=>_d,watermarks:()=>kd,webhooks:()=>Td,workflows:()=>gd});var Rd={};var Pd={};var gd={};var bd={};var Zt={};A(Zt,{ListDecisionsDecisionsRequestGateState:()=>Nd});var Nd={AutoApproved:"auto-approved",PendingHumanApproval:"pending-human-approval",Approved:"approved",Rejected:"rejected",Expired:"expired"};var en={};A(en,{ListDlqEntriesDlqRequestStatus:()=>vd});var vd={Pending:"pending",Retrying:"retrying",Resolved:"resolved",Discarded:"discarded",Exhausted:"exhausted"};var fd={};var rn={};A(rn,{ListApprovalRequestsGovernanceRequestStatus:()=>Ed});var Ed={Pending:"pending",Approved:"approved",Rejected:"rejected",Revoked:"revoked"};var Sd={};var _d={};var kd={};var Td={};var bn={};A(bn,{AggregateMetricsObservabilityRequestAggregation:()=>Zd,ArchiveAgentsResponse:()=>nn,DiscoverToolsRequestSource:()=>pp,GetErrorDistributionObservabilityRequestByField:()=>ep,GetHistoryUsageRequestGranularity:()=>cp,GetUsageDashboardBrainConfigRequestRange:()=>Id,ListAgentGoalsRequestStatus:()=>Cd,ListAgentsRequestStatus:()=>xd,ListApprovalsRequestStatus:()=>Ad,ListByAgentMemoriesRequestType:()=>Yd,ListConversationsRequestStatus:()=>Hd,ListIntegrationsRequestStatus:()=>Dd,ListMemoriesRequestType:()=>Vd,ListSelfKnowledgeRequestCategory:()=>op,ListToolsRequestSource:()=>dp,ListTriggersRequestType:()=>up,ListWithStatsConversationsRequestStatus:()=>qd,RemoveAgentsResponse:()=>tn,SearchDualAuthRagResponse:()=>ln,actions:()=>Bd,agentGoals:()=>sn,agents:()=>an,approvals:()=>dn,brainConfig:()=>pn,brainModels:()=>Gd,configPromotion:()=>Md,conversations:()=>un,delegations:()=>Ud,entitlements:()=>zd,execution:()=>Fd,guardrailOutcomes:()=>jd,integrations:()=>cn,killSwitch:()=>Ld,learning:()=>Wd,mcpConnect:()=>$d,mcpOauth:()=>Jd,mcpServers:()=>Kd,memories:()=>wn,memoriesEncrypted:()=>Qd,memory:()=>Xd,observability:()=>hn,overview:()=>rp,rag:()=>mn,selfKnowledge:()=>yn,skillSynthesis:()=>sp,skills:()=>tp,spendCap:()=>np,stats:()=>Od,teams:()=>ap,tenants:()=>ip,tools:()=>Rn,triggers:()=>Pn,usage:()=>gn,webhooks:()=>wp});var sn={};A(sn,{ListAgentGoalsRequestStatus:()=>Cd});var Cd={Active:"active",Completed:"completed",Paused:"paused",Abandoned:"abandoned"};var an={};A(an,{ArchiveAgentsResponse:()=>nn,ListAgentsRequestStatus:()=>xd,RemoveAgentsResponse:()=>tn});var xd={Active:"active",Paused:"paused",Archived:"archived",All:"all"};var tn;(s=>s.Brain={Archived:"archived",Absent:"absent",None:"none"})(tn||={});var nn;(s=>s.Brain={Archived:"archived",Absent:"absent",None:"none"})(nn||={});var dn={};A(dn,{ListApprovalsRequestStatus:()=>Ad});var Ad={Pending:"pending",Approved:"approved",Rejected:"rejected",Expired:"expired",AutoApproved:"auto_approved"};var pn={};A(pn,{GetUsageDashboardBrainConfigRequestRange:()=>Id});var Id={SevenD:"7d",ThirtyD:"30d",NinetyD:"90d"};var Gd={};var Md={};var un={};A(un,{ListConversationsRequestStatus:()=>Hd,ListWithStatsConversationsRequestStatus:()=>qd});var Hd={Active:"active",Archived:"archived",Deleted:"deleted"};var qd={Active:"active",Archived:"archived",Deleted:"deleted"};var Bd={};var Ud={};var zd={};var Fd={};var jd={};var cn={};A(cn,{ListIntegrationsRequestStatus:()=>Dd});var Dd={Active:"active",Expired:"expired",Revoked:"revoked"};var Ld={};var Wd={};var Od={};var $d={};var Kd={};var Jd={};var Qd={};var wn={};A(wn,{ListByAgentMemoriesRequestType:()=>Yd,ListMemoriesRequestType:()=>Vd});var Vd={Working:"working",Session:"session",LongTerm:"long_term",Shared:"shared"};var Yd={Working:"working",Session:"session",LongTerm:"long_term",Shared:"shared"};var Xd={};var mn={};A(mn,{SearchDualAuthRagResponse:()=>ln});var ln;(s=>s.Rerank={Rrf:"rrf",Mmr:"mmr"})(ln||={});var hn={};A(hn,{AggregateMetricsObservabilityRequestAggregation:()=>Zd,GetErrorDistributionObservabilityRequestByField:()=>ep});var Zd={Sum:"sum",Avg:"avg",Min:"min",Max:"max",Count:"count",P50:"p50",P95:"p95",P99:"p99"};var ep={Type:"type",Source:"source",Fingerprint:"fingerprint",Status:"status"};var rp={};var yn={};A(yn,{ListSelfKnowledgeRequestCategory:()=>op});var op={Strength:"strength",Weakness:"weakness",FailurePattern:"failure_pattern",Improvement:"improvement"};var sp={};var tp={};var np={};var ap={};var ip={};var Rn={};A(Rn,{DiscoverToolsRequestSource:()=>pp,ListToolsRequestSource:()=>dp});var dp={Builtin:"builtin",Skill:"skill",Mcp:"mcp",Integration:"integration"};var pp={Builtin:"builtin",Skill:"skill",Mcp:"mcp",Integration:"integration"};var Pn={};A(Pn,{ListTriggersRequestType:()=>up});var up={Cron:"cron",Event:"event",Webhook:"webhook",Message:"message"};var gn={};A(gn,{GetHistoryUsageRequestGranularity:()=>cp});var cp={Hour:"hour",Day:"day",Week:"week"};var wp={};var vn={};A(vn,{ListTenantsRequestStatus:()=>lp,actAs:()=>mp,tenants:()=>Nn});var Nn={};A(Nn,{ListTenantsRequestStatus:()=>lp});var lp={Pending:"pending",Active:"active",Suspended:"suspended",Closed:"closed",Inactive:"inactive"};var mp={};var En={};A(En,{ListWebhooksRequestStatus:()=>hp,webhooks:()=>fn});var fn={};A(fn,{ListWebhooksRequestStatus:()=>hp});var hp={Active:"active",Paused:"paused",Revoked:"revoked"};var Sn={};A(Sn,{origins:()=>yp,sessions:()=>Rp});var yp={};var Rp={};var Ku={AgentWebhooksRead:"agent_webhooks:read",AgentWebhooksWrite:"agent_webhooks:write",AgentsAdmin:"agents:admin",AgentsExecute:"agents:execute",AgentsRead:"agents:read",AgentsWrite:"agents:write",ApprovalsRead:"approvals:read",ApprovalsWrite:"approvals:write",BillingRead:"billing:read",BrainAdmin:"brain:admin",BrainRead:"brain:read",BrainWrite:"brain:write",ConnectionsRead:"connections:read",ConnectionsWrite:"connections:write",ConversationsAdmin:"conversations:admin",ConversationsRead:"conversations:read",ConversationsWrite:"conversations:write",ExecutionsAdmin:"executions:admin",ExecutionsExecute:"executions:execute",ExecutionsRead:"executions:read",GuardrailsAdmin:"guardrails:admin",GuardrailsRead:"guardrails:read",MemoryAdmin:"memory:admin",MemoryRead:"memory:read",MemoryWrite:"memory:write",SkillsAdmin:"skills:admin",SkillsRead:"skills:read",SkillsWrite:"skills:write",TeamsAdmin:"teams:admin",TeamsRead:"teams:read",TeamsWrite:"teams:write",TenantsAdmin:"tenants:admin",TenantsRead:"tenants:read",TenantsWrite:"tenants:write",ToolsAdmin:"tools:admin",ToolsRead:"tools:read",ToolsWrite:"tools:write",TriggersAdmin:"triggers:admin",TriggersRead:"triggers:read",TriggersWrite:"triggers:write"};var le=v((N,s,e)=>JSON.stringify(N,s,e),"toJson");var a=class N extends Error{static{v(this,"NPayloadError")}statusCode;body;rawResponse;constructor({message:s,statusCode:e,body:t,rawResponse:r}){super(Ju({message:s,statusCode:e,body:t})),Object.setPrototypeOf(this,N.prototype),this.statusCode=e,this.body=t,this.rawResponse=r}};function Ju({message:N,statusCode:s,body:e}){let t=[];return N!=null&&t.push(N),s!=null&&t.push(`Status code: ${s.toString()}`),e!=null&&t.push(`Body: ${le(e,void 0,2)}`),t.join(`
|
|
2
|
+
`)}v(Ju,"buildMessage");var p=class N extends Error{static{v(this,"NPayloadTimeoutError")}constructor(s){super(s),Object.setPrototypeOf(this,N.prototype)}};var u=class N extends a{static{v(this,"BadRequestError")}constructor(s,e){super({message:"BadRequestError",statusCode:400,body:s,rawResponse:e}),Object.setPrototypeOf(this,N.prototype)}};var c=class N extends a{static{v(this,"UnauthorizedError")}constructor(s,e){super({message:"UnauthorizedError",statusCode:401,body:s,rawResponse:e}),Object.setPrototypeOf(this,N.prototype)}};var w=class N extends a{static{v(this,"ForbiddenError")}constructor(s,e){super({message:"ForbiddenError",statusCode:403,body:s,rawResponse:e}),Object.setPrototypeOf(this,N.prototype)}};var l=class N extends a{static{v(this,"NotFoundError")}constructor(s,e){super({message:"NotFoundError",statusCode:404,body:s,rawResponse:e}),Object.setPrototypeOf(this,N.prototype)}};var m=class N extends a{static{v(this,"TooManyRequestsError")}constructor(s,e){super({message:"TooManyRequestsError",statusCode:429,body:s,rawResponse:e}),Object.setPrototypeOf(this,N.prototype)}};var P={Production:"https://api.npayload.com",Sandbox:"https://api.sandbox.npayload.com"};var Ke;typeof globalThis.Headers<"u"?Ke=globalThis.Headers:Ke=class Pp{static{v(this,"Headers")}headers;constructor(s){if(this.headers=new Map,s)if(s instanceof Pp)s.forEach((e,t)=>this.append(t,e));else if(Array.isArray(s))for(let[e,t]of s)if(typeof e=="string"&&typeof t=="string")this.append(e,t);else throw new TypeError("Each header entry must be a [string, string] tuple");else for(let[e,t]of Object.entries(s))if(typeof t=="string")this.append(e,t);else throw new TypeError("Header values must be strings")}append(s,e){let t=s.toLowerCase(),r=this.headers.get(t)||[];this.headers.set(t,[...r,e])}delete(s){let e=s.toLowerCase();this.headers.delete(e)}get(s){let e=s.toLowerCase(),t=this.headers.get(e);return t?t.join(", "):null}has(s){let e=s.toLowerCase();return this.headers.has(e)}set(s,e){let t=s.toLowerCase();this.headers.set(t,[e])}forEach(s,e){let t=e?s.bind(e):s;this.headers.forEach((r,o)=>t(r.join(", "),o,this))}getSetCookie(){return this.headers.get("set-cookie")||[]}*entries(){for(let[s,e]of this.headers.entries())yield[s,e.join(", ")]}*keys(){yield*this.headers.keys()}*values(){for(let s of this.headers.values())yield s.join(", ")}[Symbol.iterator](){return this.entries()}};var _n={headers:new Ke,redirected:!1,status:499,statusText:"Client Closed Request",type:"error",url:""},kn={headers:new Ke,redirected:!1,status:0,statusText:"Unknown Error",type:"error",url:""};function Tn(N){return{headers:N.headers,redirected:N.redirected,status:N.status,statusText:N.statusText,type:N.type,url:N.url}}v(Tn,"toRawResponse");var i={get:v(async N=>typeof N=="function"?N():N,"get")};import Qu from"qs";function gp(N,s){return Object.keys(s??{}).length>0?`${N}?${Qu.stringify(s,{arrayFormat:"repeat"})}`:N}v(gp,"createRequestUrl");var q=Vu();function Vu(){return typeof window<"u"&&typeof window.document<"u"?{type:"browser",version:window.navigator.userAgent}:typeof globalThis<"u"&&globalThis?.navigator?.userAgent==="Cloudflare-Workers"?{type:"workerd"}:typeof EdgeRuntime=="string"?{type:"edge-runtime"}:typeof self=="object"&&typeof self?.importScripts=="function"&&(self.constructor?.name==="DedicatedWorkerGlobalScope"||self.constructor?.name==="ServiceWorkerGlobalScope"||self.constructor?.name==="SharedWorkerGlobalScope")?{type:"web-worker"}:typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u"?{type:"deno",version:Deno.version.deno}:typeof Bun<"u"&&typeof Bun.version<"u"?{type:"bun",version:Bun.version}:typeof process<"u"&&"version"in process&&!!process.version&&"versions"in process&&!!process.versions?.node?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:typeof navigator<"u"&&navigator?.product==="ReactNative"?{type:"react-native"}:{type:"unknown"}}v(Vu,"evaluateRuntime");async function bp(){return q.type==="node"&&q.parsedVersion!=null&&q.parsedVersion>=18?fetch:q.type==="node"?(await import("node-fetch")).default:typeof fetch=="function"?fetch:(await import("node-fetch")).default}v(bp,"getFetchFn");async function Np({body:N,type:s}){return s.includes("json")?le(N):N}v(Np,"getRequestBody");async function vp(N){return q.type==="node"&&q.parsedVersion!=null&&q.parsedVersion>=18?new(await import("./chunk-EXNCOEHS.mjs")).Node18UniversalStreamWrapper(N):q.type!=="node"&&typeof fetch=="function"?new(await import("./chunk-PKG2R6XN.mjs")).UndiciStreamWrapper(N):new(await import("./chunk-GEJT7NMK.mjs")).NodePre18StreamWrapper(N)}v(vp,"chooseStreamWrapper");async function fp(N,s){if(N.body!=null&&s==="blob")return await N.blob();if(N.body!=null&&s==="arrayBuffer")return await N.arrayBuffer();if(N.body!=null&&s==="sse")return N.body;if(N.body!=null&&s==="streaming")return vp(N.body);if(N.body!=null&&s==="text")return await N.text();{let e=await N.text();if(e.length>0)try{return JSON.parse(e)}catch{return{ok:!1,error:{reason:"non-json",statusCode:N.status,rawBody:e}}}else return}}v(fp,"getResponseBody");var Yu="timeout";function Ep(N){let s=new AbortController,e=setTimeout(()=>s.abort(Yu),N);return{signal:s.signal,abortId:e}}v(Ep,"getTimeoutSignal");function Sp(...N){let s=N.length===1&&Array.isArray(N[0])?N[0]:N,e=new AbortController;for(let t of s){if(t.aborted){e.abort(t?.reason);break}t.addEventListener("abort",()=>e.abort(t?.reason),{signal:e.signal})}return e.signal}v(Sp,"anySignal");var _p=v(async(N,s,e,t,r,o,n,d,b)=>{let f=[],E;if(o!=null){let{signal:I,abortId:Q}=Ep(o);E=Q,f.push(I)}n!=null&&f.push(n);let C=Sp(f),x=await N(s,{method:e,headers:t,body:r,signal:C,credentials:d?"include":void 0,duplex:b});return E!=null&&clearTimeout(E),x},"makeRequest");function Xu(N){let s=1+(Math.random()*2-1)*.2;return N*s}v(Xu,"addJitter");async function kp(N,s=2){let e=await N();for(let t=0;t<s&&([408,429].includes(e.status)||e.status>=500);++t){let r=Math.min(1e3*Math.pow(2,t),6e4),o=Xu(r);await new Promise(n=>setTimeout(n,o)),e=await N()}return e}v(kp,"requestWithRetries");async function Zu(N){let s={};if(N.body!==void 0&&N.contentType!=null&&(s["Content-Type"]=N.contentType),N.headers==null)return s;for(let[e,t]of Object.entries(N.headers)){let r=await i.get(t);if(typeof r=="string"){s[e]=r;continue}r!=null&&(s[e]=`${r}`)}return s}v(Zu,"getHeaders");async function ec(N){let s=gp(N.url,N.queryParameters),e=await Np({body:N.body,type:N.requestType==="json"?"json":"other"}),t=await bp();try{let r=await kp(async()=>_p(t,s,N.method,await Zu(N),e,N.timeoutMs,N.abortSignal,N.withCredentials,N.duplex),N.maxRetries),o=await fp(r,N.responseType);return r.status>=200&&r.status<400?{ok:!0,body:o,headers:r.headers,rawResponse:Tn(r)}:{ok:!1,error:{reason:"status-code",statusCode:r.status,body:o},rawResponse:Tn(r)}}catch(r){return N.abortSignal!=null&&N.abortSignal.aborted?{ok:!1,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:_n}:r instanceof Error&&r.name==="AbortError"?{ok:!1,error:{reason:"timeout"},rawResponse:_n}:r instanceof Error?{ok:!1,error:{reason:"unknown",errorMessage:r.message},rawResponse:kn}:{ok:!1,error:{reason:"unknown",errorMessage:le(r)},rawResponse:kn}}}v(ec,"fetcherImpl");var y=ec;var h=class N extends Promise{static{v(this,"HttpResponsePromise")}innerPromise;unwrappedPromise;constructor(s){super(e=>{e(void 0)}),this.innerPromise=s}static fromFunction(s,...e){return new N(s(...e))}static interceptFunction(s){return(...e)=>N.fromPromise(s(...e))}static fromPromise(s){return new N(s)}static fromExecutor(s){let e=new Promise(s);return new N(e)}static fromResult(s){let e=Promise.resolve(s);return new N(e)}unwrap(){return this.unwrappedPromise||(this.unwrappedPromise=this.innerPromise.then(({data:s})=>s)),this.unwrappedPromise}then(s,e){return this.unwrap().then(s,e)}catch(s){return this.unwrap().catch(s)}finally(s){return this.unwrap().finally(s)}async withRawResponse(){return await this.innerPromise}};function R(...N){let s={};for(let[e,t]of N.filter(r=>r!=null).flatMap(r=>Object.entries(r)))t!=null?s[e]=t:e in s&&delete s[e];return s}v(R,"mergeHeaders");function g(...N){let s={};for(let[e,t]of N.filter(r=>r!=null).flatMap(r=>Object.entries(r)))t!=null&&(s[e]=t);return s}v(g,"mergeOnlyDefinedHeaders");import vc from"url-join";import Rr from"url-join";var Pr=class{static{v(this,"Environments")}_options;constructor(s){this._options=s}list(s){return h.fromPromise(this.__list(s))}async __list(s){let e=await(this._options.fetcher??y)({url:Rr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/account/environments"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/account/environments.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}create(s,e){return h.fromPromise(this.__create(s,e))}async __create(s,e){let t=await(this._options.fetcher??y)({url:Rr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/account/environments"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/account/environments.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}show(s,e){return h.fromPromise(this.__show(s,e))}async __show(s,e){let{slug:t}=s,r=await(this._options.fetcher??y)({url:Rr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/account/environments/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/account/environments/{slug}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}clone(s,e){return h.fromPromise(this.__clone(s,e))}async __clone(s,e){let{slug:t,...r}=s,o=await(this._options.fetcher??y)({url:Rr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/account/environments/${encodeURIComponent(t)}/clone`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/account/environments/{slug}/clone.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};var gr=class{static{v(this,"Account")}_options;_environments;constructor(s){this._options=s}get environments(){return this._environments??=new Pr(this._options)}};import rc from"url-join";var br=class{static{v(this,"Events")}_options;constructor(s){this._options=s}tail(s,e){return h.fromPromise(this.__tail(s,e))}async __tail(s,e){let{appId:t,eventName:r,fromTs:o,toTs:n,limit:d}=s,b={};b.appId=t,b.eventName=r,o!=null&&(b.fromTs=o.toString()),n!=null&&(b.toTs=n.toString()),d!=null&&(b.limit=d.toString());let f=await(this._options.fetcher??y)({url:rc(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/analytics/events/tail"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:b,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(f.ok)return{data:f.body,rawResponse:f.rawResponse};if(f.error.reason==="status-code")switch(f.error.statusCode){case 400:throw new u(f.error.body,f.rawResponse);case 401:throw new c(f.error.body,f.rawResponse);case 403:throw new w(f.error.body,f.rawResponse);case 404:throw new l(f.error.body,f.rawResponse);case 429:throw new m(f.error.body,f.rawResponse);default:throw new a({statusCode:f.error.statusCode,body:f.error.body,rawResponse:f.rawResponse})}switch(f.error.reason){case"non-json":throw new a({statusCode:f.error.statusCode,body:f.error.rawBody,rawResponse:f.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/analytics/events/tail.");case"unknown":throw new a({message:f.error.errorMessage,rawResponse:f.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import oc from"url-join";var Nr=class{static{v(this,"Rollups")}_options;constructor(s){this._options=s}list(s,e){return h.fromPromise(this.__list(s,e))}async __list(s,e){let{appId:t,eventName:r,envId:o,granularity:n,start:d,end:b,pageSize:f,cursor:E}=s,C={};C.appId=t,r!=null&&(C.eventName=r),o!=null&&(C.envId=o),n!=null&&(C.granularity=n),C.start=d.toString(),C.end=b.toString(),f!=null&&(C.pageSize=f.toString()),E!==void 0&&(C.cursor=E);let x=await(this._options.fetcher??y)({url:oc(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/analytics/rollups"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:C,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(x.ok)return{data:x.body,rawResponse:x.rawResponse};if(x.error.reason==="status-code")switch(x.error.statusCode){case 400:throw new u(x.error.body,x.rawResponse);case 401:throw new c(x.error.body,x.rawResponse);case 403:throw new w(x.error.body,x.rawResponse);case 404:throw new l(x.error.body,x.rawResponse);case 429:throw new m(x.error.body,x.rawResponse);default:throw new a({statusCode:x.error.statusCode,body:x.error.body,rawResponse:x.rawResponse})}switch(x.error.reason){case"non-json":throw new a({statusCode:x.error.statusCode,body:x.error.rawBody,rawResponse:x.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/analytics/rollups.");case"unknown":throw new a({message:x.error.errorMessage,rawResponse:x.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Tp from"url-join";var vr=class{static{v(this,"Sketches")}_options;constructor(s){this._options=s}percentile(s,e){return h.fromPromise(this.__percentile(s,e))}async __percentile(s,e){let{appId:t,envId:r,eventName:o,granularity:n,bucketStart:d,dimensionName:b,quantile:f}=s,E={};E.appId=t,E.envId=r,E.eventName=o,E.granularity=n,E.bucketStart=d.toString(),E.dimensionName=b,E.quantile=f.toString();let C=await(this._options.fetcher??y)({url:Tp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/analytics/sketches/percentile"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:E,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(C.ok)return{data:C.body,rawResponse:C.rawResponse};if(C.error.reason==="status-code")switch(C.error.statusCode){case 400:throw new u(C.error.body,C.rawResponse);case 401:throw new c(C.error.body,C.rawResponse);case 403:throw new w(C.error.body,C.rawResponse);case 404:throw new l(C.error.body,C.rawResponse);case 429:throw new m(C.error.body,C.rawResponse);default:throw new a({statusCode:C.error.statusCode,body:C.error.body,rawResponse:C.rawResponse})}switch(C.error.reason){case"non-json":throw new a({statusCode:C.error.statusCode,body:C.error.rawBody,rawResponse:C.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/analytics/sketches/percentile.");case"unknown":throw new a({message:C.error.errorMessage,rawResponse:C.rawResponse})}}topK(s,e){return h.fromPromise(this.__topK(s,e))}async __topK(s,e){let{appId:t,envId:r,eventName:o,granularity:n,bucketStart:d,dimensionName:b,n:f}=s,E={};E.appId=t,E.envId=r,E.eventName=o,E.granularity=n,E.bucketStart=d.toString(),E.dimensionName=b,E.n=f.toString();let C=await(this._options.fetcher??y)({url:Tp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/analytics/sketches/topk"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:E,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(C.ok)return{data:C.body,rawResponse:C.rawResponse};if(C.error.reason==="status-code")switch(C.error.statusCode){case 400:throw new u(C.error.body,C.rawResponse);case 401:throw new c(C.error.body,C.rawResponse);case 403:throw new w(C.error.body,C.rawResponse);case 404:throw new l(C.error.body,C.rawResponse);case 429:throw new m(C.error.body,C.rawResponse);default:throw new a({statusCode:C.error.statusCode,body:C.error.body,rawResponse:C.rawResponse})}switch(C.error.reason){case"non-json":throw new a({statusCode:C.error.statusCode,body:C.error.rawBody,rawResponse:C.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/analytics/sketches/topk.");case"unknown":throw new a({message:C.error.errorMessage,rawResponse:C.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import sc from"url-join";var fr=class{static{v(this,"Summary")}_options;constructor(s){this._options=s}snapshot(s,e){return h.fromPromise(this.__snapshot(s,e))}async __snapshot(s,e){let{appId:t,eventName:r,envId:o,start:n,end:d,granularity:b}=s,f={};f.appId=t,r!=null&&(f.eventName=r),o!=null&&(f.envId=o),f.start=n.toString(),f.end=d.toString(),b!=null&&(f.granularity=b);let E=await(this._options.fetcher??y)({url:sc(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/analytics/summary"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:f,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(E.ok)return{data:E.body,rawResponse:E.rawResponse};if(E.error.reason==="status-code")switch(E.error.statusCode){case 400:throw new u(E.error.body,E.rawResponse);case 401:throw new c(E.error.body,E.rawResponse);case 403:throw new w(E.error.body,E.rawResponse);case 404:throw new l(E.error.body,E.rawResponse);case 429:throw new m(E.error.body,E.rawResponse);default:throw new a({statusCode:E.error.statusCode,body:E.error.body,rawResponse:E.rawResponse})}switch(E.error.reason){case"non-json":throw new a({statusCode:E.error.statusCode,body:E.error.rawBody,rawResponse:E.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/analytics/summary.");case"unknown":throw new a({message:E.error.errorMessage,rawResponse:E.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};var Er=class{static{v(this,"Analytics")}_options;_events;_rollups;_sketches;_summary;constructor(s){this._options=s}get events(){return this._events??=new br(this._options)}get rollups(){return this._rollups??=new Nr(this._options)}get sketches(){return this._sketches??=new vr(this._options)}get summary(){return this._summary??=new fr(this._options)}};import tc from"url-join";var Sr=class{static{v(this,"Chain")}_options;constructor(s){this._options=s}verifyStatus(s){return h.fromPromise(this.__verifyStatus(s))}async __verifyStatus(s){let e=await(this._options.fetcher??y)({url:tc(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/audit/chain/status"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/audit/chain/status.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Cn from"url-join";var _r=class{static{v(this,"Events")}_options;constructor(s){this._options=s}get(s,e){return h.fromPromise(this.__get(s,e))}async __get(s,e){let{gid:t}=s,r={};r.gid=t;let o=await(this._options.fetcher??y)({url:Cn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/audit/events/get"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/audit/events/get.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}list(s={},e){return h.fromPromise(this.__list(s,e))}async __list(s={},e){let{appId:t,envId:r,action:o,rowActor:n,tenantId:d,cursor:b,limit:f,start:E,end:C}=s,x={};t!=null&&(x.appId=t),r!=null&&(x.envId=r),o!=null&&(x.action=o),n!=null&&(x.rowActor=n),d!=null&&(x.tenantId=d),b!=null&&(x.cursor=b),f!=null&&(x.limit=f.toString()),E!=null&&(x.start=E.toString()),C!=null&&(x.end=C.toString());let I=await(this._options.fetcher??y)({url:Cn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/audit/events/list"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:x,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(I.ok)return{data:I.body,rawResponse:I.rawResponse};if(I.error.reason==="status-code")switch(I.error.statusCode){case 400:throw new u(I.error.body,I.rawResponse);case 401:throw new c(I.error.body,I.rawResponse);case 403:throw new w(I.error.body,I.rawResponse);case 404:throw new l(I.error.body,I.rawResponse);case 429:throw new m(I.error.body,I.rawResponse);default:throw new a({statusCode:I.error.statusCode,body:I.error.body,rawResponse:I.rawResponse})}switch(I.error.reason){case"non-json":throw new a({statusCode:I.error.statusCode,body:I.error.rawBody,rawResponse:I.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/audit/events/list.");case"unknown":throw new a({message:I.error.errorMessage,rawResponse:I.rawResponse})}}stats(s={},e){return h.fromPromise(this.__stats(s,e))}async __stats(s={},e){let{appId:t,envId:r,start:o,end:n}=s,d={};t!=null&&(d.appId=t),r!=null&&(d.envId=r),o!=null&&(d.start=o.toString()),n!=null&&(d.end=n.toString());let b=await(this._options.fetcher??y)({url:Cn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/audit/events/stats"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:d,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(b.ok)return{data:b.body,rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new u(b.error.body,b.rawResponse);case 401:throw new c(b.error.body,b.rawResponse);case 403:throw new w(b.error.body,b.rawResponse);case 404:throw new l(b.error.body,b.rawResponse);case 429:throw new m(b.error.body,b.rawResponse);default:throw new a({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}switch(b.error.reason){case"non-json":throw new a({statusCode:b.error.statusCode,body:b.error.rawBody,rawResponse:b.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/audit/events/stats.");case"unknown":throw new a({message:b.error.errorMessage,rawResponse:b.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};var kr=class{static{v(this,"Audit")}_options;_chain;_events;constructor(s){this._options=s}get chain(){return this._chain??=new Sr(this._options)}get events(){return this._events??=new _r(this._options)}};import se from"url-join";var Tr=class{static{v(this,"Subscriptions")}_options;constructor(s){this._options=s}accountStatus(s){return h.fromPromise(this.__accountStatus(s))}async __accountStatus(s){let e=await(this._options.fetcher??y)({url:se(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/account-status"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/billing/account-status.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}createSetupIntent(s){return h.fromPromise(this.__createSetupIntent(s))}async __createSetupIntent(s){let e=await(this._options.fetcher??y)({url:se(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/payment-methods/setup-intent"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/billing/payment-methods/setup-intent.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}listSubscriptions(s={},e){return h.fromPromise(this.__listSubscriptions(s,e))}async __listSubscriptions(s={},e){let{limit:t,cursor:r,status:o}=s,n={};t!=null&&(n.limit=t.toString()),r!=null&&(n.cursor=r),o!=null&&(n.status=o);let d=await(this._options.fetcher??y)({url:se(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/subscriptions"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/billing/subscriptions.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}createSubscription(s,e){return h.fromPromise(this.__createSubscription(s,e))}async __createSubscription(s,e){let t=await(this._options.fetcher??y)({url:se(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/subscriptions"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/billing/subscriptions.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}retrieveSubscription(s,e){return h.fromPromise(this.__retrieveSubscription(s,e))}async __retrieveSubscription(s,e){let{subscriptionId:t}=s,r=await(this._options.fetcher??y)({url:se(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/billing/subscriptions/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/billing/subscriptions/{subscriptionId}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}cancelSubscription(s={},e){return h.fromPromise(this.__cancelSubscription(s,e))}async __cancelSubscription(s={},e){let t=await(this._options.fetcher??y)({url:se(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/subscriptions/cancel"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/billing/subscriptions/cancel.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}confirmSubscriptionPayment(s,e){return h.fromPromise(this.__confirmSubscriptionPayment(s,e))}async __confirmSubscriptionPayment(s,e){let t=await(this._options.fetcher??y)({url:se(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/subscriptions/confirm-payment"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/billing/subscriptions/confirm-payment.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}previewTierChange(s,e){return h.fromPromise(this.__previewTierChange(s,e))}async __previewTierChange(s,e){let t=await(this._options.fetcher??y)({url:se(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/subscriptions/preview"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/billing/subscriptions/preview.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}reactivateSubscription(s){return h.fromPromise(this.__reactivateSubscription(s))}async __reactivateSubscription(s){let e=await(this._options.fetcher??y)({url:se(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/subscriptions/reactivate"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/billing/subscriptions/reactivate.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}applyTierChange(s,e){return h.fromPromise(this.__applyTierChange(s,e))}async __applyTierChange(s,e){let t=await(this._options.fetcher??y)({url:se(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/subscriptions/tier-change"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/billing/subscriptions/tier-change.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Cr from"url-join";var xr=class{static{v(this,"Functions")}_options;constructor(s){this._options=s}setBillingAddress(s,e){return h.fromPromise(this.__setBillingAddress(s,e))}async __setBillingAddress(s,e){let t=await(this._options.fetcher??y)({url:Cr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/account/address"),method:"PATCH",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PATCH /v1/billing/account/address.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}updateBillingEmail(s,e){return h.fromPromise(this.__updateBillingEmail(s,e))}async __updateBillingEmail(s,e){let t=await(this._options.fetcher??y)({url:Cr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/account/email"),method:"PATCH",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PATCH /v1/billing/account/email.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}listPlanCatalogue(s){return h.fromPromise(this.__listPlanCatalogue(s))}async __listPlanCatalogue(s){let e=await(this._options.fetcher??y)({url:Cr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/plans/catalogue"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/billing/plans/catalogue.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}listTierChangesForOrg(s={},e){return h.fromPromise(this.__listTierChangesForOrg(s,e))}async __listTierChangesForOrg(s={},e){let{limit:t}=s,r={};t!=null&&(r.limit=t.toString());let o=await(this._options.fetcher??y)({url:Cr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/plans/tier-changes"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/billing/plans/tier-changes.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Cp from"url-join";var Ar=class{static{v(this,"ConnectAccounts")}_options;constructor(s){this._options=s}ensureConnectAccount(s={},e){return h.fromPromise(this.__ensureConnectAccount(s,e))}async __ensureConnectAccount(s={},e){let t=await(this._options.fetcher??y)({url:Cp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/connect-accounts/ensure"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/billing/connect-accounts/ensure.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}createAccountSession(s,e){return h.fromPromise(this.__createAccountSession(s,e))}async __createAccountSession(s,e){let t=await(this._options.fetcher??y)({url:Cp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/connect-accounts/session"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/billing/connect-accounts/session.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import nc from"url-join";var Ir=class{static{v(this,"Credits")}_options;constructor(s){this._options=s}listCredits(s={},e){return h.fromPromise(this.__listCredits(s,e))}async __listCredits(s={},e){let{sinceMs:t,limit:r}=s,o={};t!=null&&(o.sinceMs=t.toString()),r!=null&&(o.limit=r.toString());let n=await(this._options.fetcher??y)({url:nc(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/credits"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/billing/credits.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import xp from"url-join";var Gr=class{static{v(this,"Disputes")}_options;constructor(s){this._options=s}listDisputes(s={},e){return h.fromPromise(this.__listDisputes(s,e))}async __listDisputes(s={},e){let{limit:t,cursor:r,status:o}=s,n={};t!=null&&(n.limit=t.toString()),r!=null&&(n.cursor=r),o!=null&&(n.status=o);let d=await(this._options.fetcher??y)({url:xp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/disputes"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/billing/disputes.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}retrieveDispute(s,e){return h.fromPromise(this.__retrieveDispute(s,e))}async __retrieveDispute(s,e){let{disputeId:t}=s,r=await(this._options.fetcher??y)({url:xp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/billing/disputes/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/billing/disputes/{disputeId}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Ap from"url-join";var Mr=class{static{v(this,"Dunning")}_options;constructor(s){this._options=s}listDelinquencies(s={},e){return h.fromPromise(this.__listDelinquencies(s,e))}async __listDelinquencies(s={},e){let{limit:t,cursor:r,state:o}=s,n={};t!=null&&(n.limit=t.toString()),r!=null&&(n.cursor=r),o!=null&&(n.state=o);let d=await(this._options.fetcher??y)({url:Ap(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/dunning"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/billing/dunning.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}getRecoveryStatus(s){return h.fromPromise(this.__getRecoveryStatus(s))}async __getRecoveryStatus(s){let e=await(this._options.fetcher??y)({url:Ap(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/dunning/recovery-status"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/billing/dunning/recovery-status.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Hr from"url-join";var qr=class{static{v(this,"Payouts")}_options;constructor(s){this._options=s}getEarningsSummary(s={},e){return h.fromPromise(this.__getEarningsSummary(s,e))}async __getEarningsSummary(s={},e){let{sinceMs:t}=s,r={};t!=null&&(r.sinceMs=t.toString());let o=await(this._options.fetcher??y)({url:Hr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/earnings/summary"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/billing/earnings/summary.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}listPayouts(s={},e){return h.fromPromise(this.__listPayouts(s,e))}async __listPayouts(s={},e){let{sinceMs:t,limit:r}=s,o={};t!=null&&(o.sinceMs=t.toString()),r!=null&&(o.limit=r.toString());let n=await(this._options.fetcher??y)({url:Hr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/payouts"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/billing/payouts.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getRevenueSummary(s={},e){return h.fromPromise(this.__getRevenueSummary(s,e))}async __getRevenueSummary(s={},e){let{sinceMs:t}=s,r={};t!=null&&(r.sinceMs=t.toString());let o=await(this._options.fetcher??y)({url:Hr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/revenue/summary"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/billing/revenue/summary.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}list(s={},e){return h.fromPromise(this.__list(s,e))}async __list(s={},e){let{cursor:t,limit:r}=s,o={};t!=null&&(o.cursor=t),r!=null&&(o.limit=r.toString());let n=await(this._options.fetcher??y)({url:Hr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/feeds/payouts"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/payouts.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Br from"url-join";var Ur=class{static{v(this,"FeedListings")}_options;constructor(s){this._options=s}canSubscribeToListing(s={},e){return h.fromPromise(this.__canSubscribeToListing(s,e))}async __canSubscribeToListing(s={},e){let{listingGid:t}=s,r={};t!=null&&(r.listingGid=t);let o=await(this._options.fetcher??y)({url:Br(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/feed-listings/can-subscribe"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/billing/feed-listings/can-subscribe.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getDefaultPaymentMethodPreview(s){return h.fromPromise(this.__getDefaultPaymentMethodPreview(s))}async __getDefaultPaymentMethodPreview(s){let e=await(this._options.fetcher??y)({url:Br(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/feed-listings/default-payment-method-preview"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/billing/feed-listings/default-payment-method-preview.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}subscribeToListing(s,e){return h.fromPromise(this.__subscribeToListing(s,e))}async __subscribeToListing(s,e){let t=await(this._options.fetcher??y)({url:Br(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/feed-listings/subscribe"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/billing/feed-listings/subscribe.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}subscribeToListingWithSavedCard(s,e){return h.fromPromise(this.__subscribeToListingWithSavedCard(s,e))}async __subscribeToListingWithSavedCard(s,e){let t=await(this._options.fetcher??y)({url:Br(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/feed-listings/subscribe-with-saved-card"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/billing/feed-listings/subscribe-with-saved-card.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import xn from"url-join";var zr=class{static{v(this,"Invoices")}_options;constructor(s){this._options=s}listInvoices(s={},e){return h.fromPromise(this.__listInvoices(s,e))}async __listInvoices(s={},e){let{limit:t,startingAfter:r,createdAfter:o,createdBefore:n,status:d}=s,b={};t!=null&&(b.limit=t.toString()),r!=null&&(b.startingAfter=r),o!=null&&(b.createdAfter=o.toString()),n!=null&&(b.createdBefore=n.toString()),d!=null&&(b.status=d);let f=await(this._options.fetcher??y)({url:xn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/invoices"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:b,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(f.ok)return{data:f.body,rawResponse:f.rawResponse};if(f.error.reason==="status-code")switch(f.error.statusCode){case 400:throw new u(f.error.body,f.rawResponse);case 401:throw new c(f.error.body,f.rawResponse);case 403:throw new w(f.error.body,f.rawResponse);case 404:throw new l(f.error.body,f.rawResponse);case 429:throw new m(f.error.body,f.rawResponse);default:throw new a({statusCode:f.error.statusCode,body:f.error.body,rawResponse:f.rawResponse})}switch(f.error.reason){case"non-json":throw new a({statusCode:f.error.statusCode,body:f.error.rawBody,rawResponse:f.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/billing/invoices.");case"unknown":throw new a({message:f.error.errorMessage,rawResponse:f.rawResponse})}}retrieveInvoice(s,e){return h.fromPromise(this.__retrieveInvoice(s,e))}async __retrieveInvoice(s,e){let{invoiceId:t}=s,r=await(this._options.fetcher??y)({url:xn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/billing/invoices/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/billing/invoices/{invoiceId}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getInvoicePdfUrl(s,e){return h.fromPromise(this.__getInvoicePdfUrl(s,e))}async __getInvoicePdfUrl(s,e){let{invoiceId:t}=s,r=await(this._options.fetcher??y)({url:xn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/billing/invoices/${encodeURIComponent(t)}/pdf`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/billing/invoices/{invoiceId}/pdf.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Fr from"url-join";var jr=class{static{v(this,"PaymentMethods")}_options;constructor(s){this._options=s}listPaymentMethods(s){return h.fromPromise(this.__listPaymentMethods(s))}async __listPaymentMethods(s){let e=await(this._options.fetcher??y)({url:Fr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/payment-methods"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/billing/payment-methods.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}attachPaymentMethod(s,e){return h.fromPromise(this.__attachPaymentMethod(s,e))}async __attachPaymentMethod(s,e){let t=await(this._options.fetcher??y)({url:Fr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/payment-methods/attach"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/billing/payment-methods/attach.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}detachPaymentMethod(s,e){return h.fromPromise(this.__detachPaymentMethod(s,e))}async __detachPaymentMethod(s,e){let t=await(this._options.fetcher??y)({url:Fr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/payment-methods/detach"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/billing/payment-methods/detach.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}setDefaultPaymentMethod(s,e){return h.fromPromise(this.__setDefaultPaymentMethod(s,e))}async __setDefaultPaymentMethod(s,e){let t=await(this._options.fetcher??y)({url:Fr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/payment-methods/set-default"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/billing/payment-methods/set-default.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import An from"url-join";var Dr=class{static{v(this,"TaxIds")}_options;constructor(s){this._options=s}listTaxIds(s){return h.fromPromise(this.__listTaxIds(s))}async __listTaxIds(s){let e=await(this._options.fetcher??y)({url:An(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/tax-ids"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/billing/tax-ids.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}addTaxId(s,e){return h.fromPromise(this.__addTaxId(s,e))}async __addTaxId(s,e){let t=await(this._options.fetcher??y)({url:An(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/tax-ids"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/billing/tax-ids.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}removeTaxId(s,e){return h.fromPromise(this.__removeTaxId(s,e))}async __removeTaxId(s,e){let{taxIdId:t}=s,r=await(this._options.fetcher??y)({url:An(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/billing/tax-ids/${encodeURIComponent(t)}`),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/billing/tax-ids/{taxIdId}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import ac from"url-join";var Lr=class{static{v(this,"Tax")}_options;constructor(s){this._options=s}previewTax(s,e){return h.fromPromise(this.__previewTax(s,e))}async __previewTax(s,e){let t=await(this._options.fetcher??y)({url:ac(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/tax/preview"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/billing/tax/preview.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import ic from"url-join";var Wr=class{static{v(this,"TestClocks")}_options;constructor(s){this._options=s}advanceTestClock(s,e){return h.fromPromise(this.__advanceTestClock(s,e))}async __advanceTestClock(s,e){let t=await(this._options.fetcher??y)({url:ic(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/test-clock/advance"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/billing/test-clock/advance.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Ip from"url-join";var Or=class{static{v(this,"Usage")}_options;constructor(s){this._options=s}getQuotas(s){return h.fromPromise(this.__getQuotas(s))}async __getQuotas(s){let e=await(this._options.fetcher??y)({url:Ip(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/usage/quotas"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/billing/usage/quotas.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}getUsageSummary(s={},e){return h.fromPromise(this.__getUsageSummary(s,e))}async __getUsageSummary(s={},e){let{periodStart:t,periodEnd:r}=s,o={};t!=null&&(o.periodStart=t.toString()),r!=null&&(o.periodEnd=r.toString());let n=await(this._options.fetcher??y)({url:Ip(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/billing/usage/summary"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/billing/usage/summary.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Gp from"url-join";var $r=class{static{v(this,"Revenue")}_options;constructor(s){this._options=s}customer(s,e){return h.fromPromise(this.__customer(s,e))}async __customer(s,e){let{subscriptionGid:t,sinceMs:r}=s,o={};r!=null&&(o.sinceMs=r.toString());let n=await(this._options.fetcher??y)({url:Gp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/revenue/customers/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/revenue/customers/{subscriptionGid}.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}listings(s={},e){return h.fromPromise(this.__listings(s,e))}async __listings(s={},e){let{sinceMs:t}=s,r={};t!=null&&(r.sinceMs=t.toString());let o=await(this._options.fetcher??y)({url:Gp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/feeds/revenue/listings"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/revenue/listings.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};var Kr=class{static{v(this,"Billing")}_options;_subscriptions;_functions;_connectAccounts;_credits;_disputes;_dunning;_payouts;_feedListings;_invoices;_paymentMethods;_taxIds;_tax;_testClocks;_usage;_revenue;constructor(s){this._options=s}get subscriptions(){return this._subscriptions??=new Tr(this._options)}get functions(){return this._functions??=new xr(this._options)}get connectAccounts(){return this._connectAccounts??=new Ar(this._options)}get credits(){return this._credits??=new Ir(this._options)}get disputes(){return this._disputes??=new Gr(this._options)}get dunning(){return this._dunning??=new Mr(this._options)}get payouts(){return this._payouts??=new qr(this._options)}get feedListings(){return this._feedListings??=new Ur(this._options)}get invoices(){return this._invoices??=new zr(this._options)}get paymentMethods(){return this._paymentMethods??=new jr(this._options)}get taxIds(){return this._taxIds??=new Dr(this._options)}get tax(){return this._tax??=new Lr(this._options)}get testClocks(){return this._testClocks??=new Wr(this._options)}get usage(){return this._usage??=new Or(this._options)}get revenue(){return this._revenue??=new $r(this._options)}};import Mp from"url-join";var Jr=class{static{v(this,"ConnectBridges")}_options;constructor(s){this._options=s}listBridges(s={},e){return h.fromPromise(this.__listBridges(s,e))}async __listBridges(s={},e){let{status:t,sourceOrgId:r,targetOrgId:o,cursor:n,limit:d}=s,b={};t!=null&&(b.status=t),r!=null&&(b.sourceOrgId=r),o!=null&&(b.targetOrgId=o),n!=null&&(b.cursor=n),d!=null&&(b.limit=d.toString());let f=await(this._options.fetcher??y)({url:Mp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/connect/bridges"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:b,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(f.ok)return{data:f.body,rawResponse:f.rawResponse};if(f.error.reason==="status-code")switch(f.error.statusCode){case 400:throw new u(f.error.body,f.rawResponse);case 401:throw new c(f.error.body,f.rawResponse);case 403:throw new w(f.error.body,f.rawResponse);case 404:throw new l(f.error.body,f.rawResponse);case 429:throw new m(f.error.body,f.rawResponse);default:throw new a({statusCode:f.error.statusCode,body:f.error.body,rawResponse:f.rawResponse})}switch(f.error.reason){case"non-json":throw new a({statusCode:f.error.statusCode,body:f.error.rawBody,rawResponse:f.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/connect/bridges.");case"unknown":throw new a({message:f.error.errorMessage,rawResponse:f.rawResponse})}}retrieveBridge(s,e){return h.fromPromise(this.__retrieveBridge(s,e))}async __retrieveBridge(s,e){let{bridgeGid:t}=s,r=await(this._options.fetcher??y)({url:Mp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/bridges/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/connect/bridges/{bridgeGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Je from"url-join";var Qr=class{static{v(this,"ConnectTenantApproval")}_options;constructor(s){this._options=s}listConsents(s={},e){return h.fromPromise(this.__listConsents(s,e))}async __listConsents(s={},e){let{grantGid:t,status:r,app:o,cursor:n,limit:d}=s,b={};t!=null&&(b.grantGid=t),r!=null&&(b.status=r),o!=null&&(b.app=o),n!=null&&(b.cursor=n),d!=null&&(b.limit=d.toString());let f=await(this._options.fetcher??y)({url:Je(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/connect/consents"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:b,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(f.ok)return{data:f.body,rawResponse:f.rawResponse};if(f.error.reason==="status-code")switch(f.error.statusCode){case 400:throw new u(f.error.body,f.rawResponse);case 401:throw new c(f.error.body,f.rawResponse);case 403:throw new w(f.error.body,f.rawResponse);case 404:throw new l(f.error.body,f.rawResponse);case 429:throw new m(f.error.body,f.rawResponse);default:throw new a({statusCode:f.error.statusCode,body:f.error.body,rawResponse:f.rawResponse})}switch(f.error.reason){case"non-json":throw new a({statusCode:f.error.statusCode,body:f.error.rawBody,rawResponse:f.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/connect/consents.");case"unknown":throw new a({message:f.error.errorMessage,rawResponse:f.rawResponse})}}listPartnerTenantApprovals(s={},e){return h.fromPromise(this.__listPartnerTenantApprovals(s,e))}async __listPartnerTenantApprovals(s={},e){let{status:t,cursor:r,limit:o}=s,n={};t!=null&&(n.status=t),r!=null&&(n.cursor=r),o!=null&&(n.limit=o.toString());let d=await(this._options.fetcher??y)({url:Je(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/connect/partner/tenant-approvals"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/connect/partner/tenant-approvals.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}listPlatformConnectApprovals(s,e){return h.fromPromise(this.__listPlatformConnectApprovals(s,e))}async __listPlatformConnectApprovals(s,e){let{connectGid:t,status:r,cursor:o,limit:n}=s,d={};r!=null&&(d.status=r),o!=null&&(d.cursor=o),n!=null&&(d.limit=n.toString());let b=await(this._options.fetcher??y)({url:Je(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/platform-connects/${encodeURIComponent(t)}/approvals`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:d,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(b.ok)return{data:b.body,rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new u(b.error.body,b.rawResponse);case 401:throw new c(b.error.body,b.rawResponse);case 403:throw new w(b.error.body,b.rawResponse);case 404:throw new l(b.error.body,b.rawResponse);case 429:throw new m(b.error.body,b.rawResponse);default:throw new a({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}switch(b.error.reason){case"non-json":throw new a({statusCode:b.error.statusCode,body:b.error.rawBody,rawResponse:b.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/connect/platform-connects/{connectGid}/approvals.");case"unknown":throw new a({message:b.error.errorMessage,rawResponse:b.rawResponse})}}listTenantApprovals(s,e){return h.fromPromise(this.__listTenantApprovals(s,e))}async __listTenantApprovals(s,e){let{grantGid:t,status:r,cursor:o,limit:n}=s,d={};d.grantGid=t,r!=null&&(d.status=r),o!=null&&(d.cursor=o),n!=null&&(d.limit=n.toString());let b=await(this._options.fetcher??y)({url:Je(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/connect/tenant-approvals"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:d,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(b.ok)return{data:b.body,rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new u(b.error.body,b.rawResponse);case 401:throw new c(b.error.body,b.rawResponse);case 403:throw new w(b.error.body,b.rawResponse);case 404:throw new l(b.error.body,b.rawResponse);case 429:throw new m(b.error.body,b.rawResponse);default:throw new a({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}switch(b.error.reason){case"non-json":throw new a({statusCode:b.error.statusCode,body:b.error.rawBody,rawResponse:b.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/connect/tenant-approvals.");case"unknown":throw new a({message:b.error.errorMessage,rawResponse:b.rawResponse})}}getTenantApproval(s,e){return h.fromPromise(this.__getTenantApproval(s,e))}async __getTenantApproval(s,e){let{approvalGid:t}=s,r=await(this._options.fetcher??y)({url:Je(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/tenant-approvals/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/connect/tenant-approvals/{approvalGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import In from"url-join";var Vr=class{static{v(this,"ConnectExplore")}_options;constructor(s){this._options=s}listExploreApps(s={},e){return h.fromPromise(this.__listExploreApps(s,e))}async __listExploreApps(s={},e){let{platformSlug:t,search:r,cursor:o,limit:n}=s,d={};t!=null&&(d.platformSlug=t),r!=null&&(d.search=r),o!=null&&(d.cursor=o),n!=null&&(d.limit=n.toString());let b=await(this._options.fetcher??y)({url:In(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/connect/explore"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:d,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(b.ok)return{data:b.body,rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new u(b.error.body,b.rawResponse);case 401:throw new c(b.error.body,b.rawResponse);case 403:throw new w(b.error.body,b.rawResponse);case 404:throw new l(b.error.body,b.rawResponse);case 429:throw new m(b.error.body,b.rawResponse);default:throw new a({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}switch(b.error.reason){case"non-json":throw new a({statusCode:b.error.statusCode,body:b.error.rawBody,rawResponse:b.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/connect/explore.");case"unknown":throw new a({message:b.error.errorMessage,rawResponse:b.rawResponse})}}getExploreApp(s,e){return h.fromPromise(this.__getExploreApp(s,e))}async __getExploreApp(s,e){let{appId:t}=s,r=await(this._options.fetcher??y)({url:In(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/explore/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/connect/explore/{appId}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}searchExploreApps(s,e){return h.fromPromise(this.__searchExploreApps(s,e))}async __searchExploreApps(s,e){let{query:t,cursor:r,limit:o}=s,n={};n.query=t,r!=null&&(n.cursor=r),o!=null&&(n.limit=o.toString());let d=await(this._options.fetcher??y)({url:In(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/connect/explore/search"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/connect/explore/search.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Hp from"url-join";var Yr=class{static{v(this,"ConnectInsights")}_options;constructor(s){this._options=s}getPublisherCompliance(s,e){return h.fromPromise(this.__getPublisherCompliance(s,e))}async __getPublisherCompliance(s,e){let{appId:t,publisherOrgId:r}=s,o={};r!=null&&(o.publisherOrgId=r);let n=await(this._options.fetcher??y)({url:Hp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/explore/${encodeURIComponent(t)}/compliance`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/connect/explore/{appId}/compliance.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getEcosystemGraph(s={},e){return h.fromPromise(this.__getEcosystemGraph(s,e))}async __getEcosystemGraph(s={},e){let{partnerSlug:t,envKind:r,direction:o,status:n,include:d}=s,b={};t!=null&&(b.partnerSlug=t),r!=null&&(b.envKind=r),o!=null&&(b.direction=o),n!=null&&(b.status=n),d!=null&&(b.include=d);let f=await(this._options.fetcher??y)({url:Hp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/connect/graph"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:b,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(f.ok)return{data:f.body,rawResponse:f.rawResponse};if(f.error.reason==="status-code")switch(f.error.statusCode){case 400:throw new u(f.error.body,f.rawResponse);case 401:throw new c(f.error.body,f.rawResponse);case 403:throw new w(f.error.body,f.rawResponse);case 404:throw new l(f.error.body,f.rawResponse);case 429:throw new m(f.error.body,f.rawResponse);default:throw new a({statusCode:f.error.statusCode,body:f.error.body,rawResponse:f.rawResponse})}switch(f.error.reason){case"non-json":throw new a({statusCode:f.error.statusCode,body:f.error.rawBody,rawResponse:f.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/connect/graph.");case"unknown":throw new a({message:f.error.errorMessage,rawResponse:f.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import te from"url-join";var Xr=class{static{v(this,"ConnectAccess")}_options;constructor(s){this._options=s}listMyGrants(s={},e){return h.fromPromise(this.__listMyGrants(s,e))}async __listMyGrants(s={},e){let{status:t,direction:r,app:o,envKind:n,cursor:d,limit:b}=s,f={};t!=null&&(f.status=t),r!=null&&(f.direction=r),o!=null&&(f.app=o),n!=null&&(f.envKind=n),d!=null&&(f.cursor=d),b!=null&&(f.limit=b.toString());let E=await(this._options.fetcher??y)({url:te(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/connect/grants"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:f,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(E.ok)return{data:E.body,rawResponse:E.rawResponse};if(E.error.reason==="status-code")switch(E.error.statusCode){case 400:throw new u(E.error.body,E.rawResponse);case 401:throw new c(E.error.body,E.rawResponse);case 403:throw new w(E.error.body,E.rawResponse);case 404:throw new l(E.error.body,E.rawResponse);case 429:throw new m(E.error.body,E.rawResponse);default:throw new a({statusCode:E.error.statusCode,body:E.error.body,rawResponse:E.rawResponse})}switch(E.error.reason){case"non-json":throw new a({statusCode:E.error.statusCode,body:E.error.rawBody,rawResponse:E.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/connect/grants.");case"unknown":throw new a({message:E.error.errorMessage,rawResponse:E.rawResponse})}}getGrant(s,e){return h.fromPromise(this.__getGrant(s,e))}async __getGrant(s,e){let{grantGid:t}=s,r=await(this._options.fetcher??y)({url:te(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/grants/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/connect/grants/{grantGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}pauseGrant(s,e){return h.fromPromise(this.__pauseGrant(s,e))}async __pauseGrant(s,e){let{grantGid:t}=s,r=await(this._options.fetcher??y)({url:te(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/grants/${encodeURIComponent(t)}/pause`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/connect/grants/{grantGid}/pause.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getGrantRates(s,e){return h.fromPromise(this.__getGrantRates(s,e))}async __getGrantRates(s,e){let{grantGid:t}=s,r=await(this._options.fetcher??y)({url:te(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/grants/${encodeURIComponent(t)}/rates`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/connect/grants/{grantGid}/rates.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}replayDroppedForGrant(s,e){return h.fromPromise(this.__replayDroppedForGrant(s,e))}async __replayDroppedForGrant(s,e){let{grantGid:t,...r}=s,o=await(this._options.fetcher??y)({url:te(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/grants/${encodeURIComponent(t)}/replay-dropped`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/connect/grants/{grantGid}/replay-dropped.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}resumeGrant(s,e){return h.fromPromise(this.__resumeGrant(s,e))}async __resumeGrant(s,e){let{grantGid:t}=s,r=await(this._options.fetcher??y)({url:te(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/grants/${encodeURIComponent(t)}/resume`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/connect/grants/{grantGid}/resume.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getGrantTrustScore(s,e){return h.fromPromise(this.__getGrantTrustScore(s,e))}async __getGrantTrustScore(s,e){let{grantGid:t}=s,r=await(this._options.fetcher??y)({url:te(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/grants/${encodeURIComponent(t)}/trust-score`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/connect/grants/{grantGid}/trust-score.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getGrantUsage(s,e){return h.fromPromise(this.__getGrantUsage(s,e))}async __getGrantUsage(s,e){let{grantGid:t,period:r,windowStartMs:o,windowEndMs:n}=s,d={};r!=null&&(d.period=r),o!=null&&(d.windowStartMs=o.toString()),n!=null&&(d.windowEndMs=n.toString());let b=await(this._options.fetcher??y)({url:te(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/grants/${encodeURIComponent(t)}/usage`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:d,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(b.ok)return{data:b.body,rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new u(b.error.body,b.rawResponse);case 401:throw new c(b.error.body,b.rawResponse);case 403:throw new w(b.error.body,b.rawResponse);case 404:throw new l(b.error.body,b.rawResponse);case 429:throw new m(b.error.body,b.rawResponse);default:throw new a({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}switch(b.error.reason){case"non-json":throw new a({statusCode:b.error.statusCode,body:b.error.rawBody,rawResponse:b.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/connect/grants/{grantGid}/usage.");case"unknown":throw new a({message:b.error.errorMessage,rawResponse:b.rawResponse})}}resumeAllGrantsForOrg(s){return h.fromPromise(this.__resumeAllGrantsForOrg(s))}async __resumeAllGrantsForOrg(s){let e=await(this._options.fetcher??y)({url:te(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/connect/grants/resume-all"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/connect/grants/resume-all.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}suspendAllGrantsForOrg(s={},e){return h.fromPromise(this.__suspendAllGrantsForOrg(s,e))}async __suspendAllGrantsForOrg(s={},e){let t=await(this._options.fetcher??y)({url:te(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/connect/grants/suspend-all"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/connect/grants/suspend-all.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import dc from"url-join";var Zr=class{static{v(this,"ConsentReceipts")}_options;constructor(s){this._options=s}listReceiptsByGrant(s,e){return h.fromPromise(this.__listReceiptsByGrant(s,e))}async __listReceiptsByGrant(s,e){let{grantGid:t,status:r,cursor:o,limit:n}=s,d={};r!=null&&(d.status=r),o!=null&&(d.cursor=o),n!=null&&(d.limit=n.toString());let b=await(this._options.fetcher??y)({url:dc(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/grants/${encodeURIComponent(t)}/consents`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:d,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(b.ok)return{data:b.body,rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new u(b.error.body,b.rawResponse);case 401:throw new c(b.error.body,b.rawResponse);case 403:throw new w(b.error.body,b.rawResponse);case 404:throw new l(b.error.body,b.rawResponse);case 429:throw new m(b.error.body,b.rawResponse);default:throw new a({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}switch(b.error.reason){case"non-json":throw new a({statusCode:b.error.statusCode,body:b.error.rawBody,rawResponse:b.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/connect/grants/{grantGid}/consents.");case"unknown":throw new a({message:b.error.errorMessage,rawResponse:b.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import pc from"url-join";var eo=class{static{v(this,"ConnectPartner")}_options;constructor(s){this._options=s}getPartnerAuditFeed(s={},e){return h.fromPromise(this.__getPartnerAuditFeed(s,e))}async __getPartnerAuditFeed(s={},e){let{cursor:t,limit:r,action:o}=s,n={};t!=null&&(n.cursor=t),r!=null&&(n.limit=r.toString()),o!=null&&(n.action=o);let d=await(this._options.fetcher??y)({url:pc(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/connect/partner/audit"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/connect/partner/audit.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import uc from"url-join";var ro=class{static{v(this,"ConnectProfile")}_options;constructor(s){this._options=s}getAppProfile(s){return h.fromPromise(this.__getAppProfile(s))}async __getAppProfile(s){let e=await(this._options.fetcher??y)({url:uc(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/connect/profile"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/connect/profile.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import qp from"url-join";var oo=class{static{v(this,"EntityNat")}_options;constructor(s){this._options=s}resolveEntity(s,e){return h.fromPromise(this.__resolveEntity(s,e))}async __resolveEntity(s,e){let{entityTypeSlug:t,localEntityId:r}=s,o={};o.entityTypeSlug=t,o.localEntityId=r;let n=await(this._options.fetcher??y)({url:qp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/entity-nat/resolve"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/entity-nat/resolve.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}reverseResolve(s,e){return h.fromPromise(this.__reverseResolve(s,e))}async __reverseResolve(s,e){let{universalEntityToken:t}=s,r={};r.universalEntityToken=t;let o=await(this._options.fetcher??y)({url:qp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/entity-nat/reverse-resolve"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/entity-nat/reverse-resolve.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import H from"url-join";var so=class{static{v(this,"Connect")}_options;constructor(s){this._options=s}createBridge(s,e){return h.fromPromise(this.__createBridge(s,e))}async __createBridge(s,e){let t=await(this._options.fetcher??y)({url:H(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/connect/bridges"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/connect/bridges.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}confirmBridge(s,e){return h.fromPromise(this.__confirmBridge(s,e))}async __confirmBridge(s,e){let{gid:t}=s,r=await(this._options.fetcher??y)({url:H(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/bridges/${encodeURIComponent(t)}/confirm`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/connect/bridges/{gid}/confirm.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}requestAccess(s,e){return h.fromPromise(this.__requestAccess(s,e))}async __requestAccess(s,e){let t=await(this._options.fetcher??y)({url:H(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/connect/grants"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/connect/grants.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}approveAccess(s,e){return h.fromPromise(this.__approveAccess(s,e))}async __approveAccess(s,e){let{grantId:t,...r}=s,o=await(this._options.fetcher??y)({url:H(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/grants/${encodeURIComponent(t)}/approve`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/connect/grants/{grantId}/approve.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}listRevocationAudit(s,e){return h.fromPromise(this.__listRevocationAudit(s,e))}async __listRevocationAudit(s,e){let{grantId:t}=s,r=await(this._options.fetcher??y)({url:H(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/grants/${encodeURIComponent(t)}/audit`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/connect/grants/{grantId}/audit.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}rejectAccess(s,e){return h.fromPromise(this.__rejectAccess(s,e))}async __rejectAccess(s,e){let{grantId:t,...r}=s,o=await(this._options.fetcher??y)({url:H(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/grants/${encodeURIComponent(t)}/reject`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/connect/grants/{grantId}/reject.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}revokeGrant(s,e){return h.fromPromise(this.__revokeGrant(s,e))}async __revokeGrant(s,e){let{grantId:t,...r}=s,o=await(this._options.fetcher??y)({url:H(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/grants/${encodeURIComponent(t)}/revoke`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/connect/grants/{grantId}/revoke.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}listPartnerGovernedApps(s={},e){return h.fromPromise(this.__listPartnerGovernedApps(s,e))}async __listPartnerGovernedApps(s={},e){let{cursor:t,limit:r}=s,o={};t!=null&&(o.cursor=t),r!=null&&(o.limit=r.toString());let n=await(this._options.fetcher??y)({url:H(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/connect/partner/apps"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/connect/partner/apps.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}partnerDelistApp(s,e){return h.fromPromise(this.__partnerDelistApp(s,e))}async __partnerDelistApp(s,e){let{targetAppId:t,...r}=s,o=await(this._options.fetcher??y)({url:H(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/partner/apps/${encodeURIComponent(t)}/delist`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/connect/partner/apps/{targetAppId}/delist.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}partnerFreezeApp(s,e){return h.fromPromise(this.__partnerFreezeApp(s,e))}async __partnerFreezeApp(s,e){let{targetAppId:t,...r}=s,o=await(this._options.fetcher??y)({url:H(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/partner/apps/${encodeURIComponent(t)}/freeze`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/connect/partner/apps/{targetAppId}/freeze.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}partnerReinstateApp(s,e){return h.fromPromise(this.__partnerReinstateApp(s,e))}async __partnerReinstateApp(s,e){let{targetAppId:t,...r}=s,o=await(this._options.fetcher??y)({url:H(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/partner/apps/${encodeURIComponent(t)}/reinstate`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/connect/partner/apps/{targetAppId}/reinstate.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}listPartnerAppTenantApprovals(s,e){return h.fromPromise(this.__listPartnerAppTenantApprovals(s,e))}async __listPartnerAppTenantApprovals(s,e){let{targetAppId:t,status:r,cursor:o,limit:n}=s,d={};r!=null&&(d.status=r),o!=null&&(d.cursor=o),n!=null&&(d.limit=n.toString());let b=await(this._options.fetcher??y)({url:H(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/partner/apps/${encodeURIComponent(t)}/tenant-approvals`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:d,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(b.ok)return{data:b.body,rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new u(b.error.body,b.rawResponse);case 401:throw new c(b.error.body,b.rawResponse);case 403:throw new w(b.error.body,b.rawResponse);case 404:throw new l(b.error.body,b.rawResponse);case 429:throw new m(b.error.body,b.rawResponse);default:throw new a({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}switch(b.error.reason){case"non-json":throw new a({statusCode:b.error.statusCode,body:b.error.rawBody,rawResponse:b.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/connect/partner/apps/{targetAppId}/tenant-approvals.");case"unknown":throw new a({message:b.error.errorMessage,rawResponse:b.rawResponse})}}partnerOverrideTenantApproval(s,e){return h.fromPromise(this.__partnerOverrideTenantApproval(s,e))}async __partnerOverrideTenantApproval(s,e){let{targetTenantApprovalGid:t,...r}=s,o=await(this._options.fetcher??y)({url:H(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/partner/tenant-approvals/${encodeURIComponent(t)}/override`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/connect/partner/tenant-approvals/{targetTenantApprovalGid}/override.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}updateAppProfile(s,e){return h.fromPromise(this.__updateAppProfile(s,e))}async __updateAppProfile(s,e){let{appId:t,...r}=s,o=await(this._options.fetcher??y)({url:H(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/profile/${encodeURIComponent(t)}`),method:"PATCH",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PATCH /v1/connect/profile/{appId}.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}initiateTenantApproval(s,e){return h.fromPromise(this.__initiateTenantApproval(s,e))}async __initiateTenantApproval(s,e){let t=await(this._options.fetcher??y)({url:H(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/connect/tenant-approvals"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/connect/tenant-approvals.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}revokeTenantApproval(s,e){return h.fromPromise(this.__revokeTenantApproval(s,e))}async __revokeTenantApproval(s,e){let{approvalId:t,...r}=s,o=await(this._options.fetcher??y)({url:H(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/tenant-approvals/${encodeURIComponent(t)}/revoke`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/connect/tenant-approvals/{approvalId}/revoke.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Bp from"url-join";var to=class{static{v(this,"IdentityBridges")}_options;constructor(s){this._options=s}archiveBridge(s,e){return h.fromPromise(this.__archiveBridge(s,e))}async __archiveBridge(s,e){let{gid:t}=s,r=await(this._options.fetcher??y)({url:Bp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/bridges/${encodeURIComponent(t)}/archive`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/connect/bridges/{gid}/archive.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}suspendBridge(s,e){return h.fromPromise(this.__suspendBridge(s,e))}async __suspendBridge(s,e){let{gid:t}=s,r=await(this._options.fetcher??y)({url:Bp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/bridges/${encodeURIComponent(t)}/suspend`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/connect/bridges/{gid}/suspend.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Me from"url-join";var no=class{static{v(this,"PublishGrants")}_options;constructor(s){this._options=s}list(s,e){return h.fromPromise(this.__list(s,e))}async __list(s,e){let{direction:t,status:r,cursor:o,limit:n}=s,d={};d.direction=t,r!=null&&(d.status=r),o!=null&&(d.cursor=o),n!=null&&(d.limit=n.toString());let b=await(this._options.fetcher??y)({url:Me(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/connect/publish-grants"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:d,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(b.ok)return{data:b.body,rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new u(b.error.body,b.rawResponse);case 401:throw new c(b.error.body,b.rawResponse);case 403:throw new w(b.error.body,b.rawResponse);case 404:throw new l(b.error.body,b.rawResponse);case 429:throw new m(b.error.body,b.rawResponse);default:throw new a({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}switch(b.error.reason){case"non-json":throw new a({statusCode:b.error.statusCode,body:b.error.rawBody,rawResponse:b.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/connect/publish-grants.");case"unknown":throw new a({message:b.error.errorMessage,rawResponse:b.rawResponse})}}create(s,e){return h.fromPromise(this.__create(s,e))}async __create(s,e){let{"Idempotency-Key":t,...r}=s,o=await(this._options.fetcher??y)({url:Me(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/connect/publish-grants"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":t??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/connect/publish-grants.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}retrieve(s,e){return h.fromPromise(this.__retrieve(s,e))}async __retrieve(s,e){let{id:t}=s,r=await(this._options.fetcher??y)({url:Me(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/publish-grants/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/connect/publish-grants/{id}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}pause(s,e){return h.fromPromise(this.__pause(s,e))}async __pause(s,e){let{id:t}=s,r=await(this._options.fetcher??y)({url:Me(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/publish-grants/${encodeURIComponent(t)}/pause`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/connect/publish-grants/{id}/pause.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}resume(s,e){return h.fromPromise(this.__resume(s,e))}async __resume(s,e){let{id:t}=s,r=await(this._options.fetcher??y)({url:Me(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/publish-grants/${encodeURIComponent(t)}/resume`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/connect/publish-grants/{id}/resume.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}revoke(s,e){return h.fromPromise(this.__revoke(s,e))}async __revoke(s,e){let{id:t}=s,r=await(this._options.fetcher??y)({url:Me(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/connect/publish-grants/${encodeURIComponent(t)}/revoke`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/connect/publish-grants/{id}/revoke.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};var ao=class{static{v(this,"Connect")}_options;_connectBridges;_connectTenantApproval;_connectExplore;_connectInsights;_connectAccess;_consentReceipts;_connectPartner;_connectProfile;_entityNat;_connect;_identityBridges;_publishGrants;constructor(s){this._options=s}get connectBridges(){return this._connectBridges??=new Jr(this._options)}get connectTenantApproval(){return this._connectTenantApproval??=new Qr(this._options)}get connectExplore(){return this._connectExplore??=new Vr(this._options)}get connectInsights(){return this._connectInsights??=new Yr(this._options)}get connectAccess(){return this._connectAccess??=new Xr(this._options)}get consentReceipts(){return this._consentReceipts??=new Zr(this._options)}get connectPartner(){return this._connectPartner??=new eo(this._options)}get connectProfile(){return this._connectProfile??=new ro(this._options)}get entityNat(){return this._entityNat??=new oo(this._options)}get connect(){return this._connect??=new so(this._options)}get identityBridges(){return this._identityBridges??=new to(this._options)}get publishGrants(){return this._publishGrants??=new no(this._options)}};import Up from"url-join";var io=class{static{v(this,"Origins")}_options;constructor(s){this._options=s}list(s,e){return h.fromPromise(this.__list(s,e))}async __list(s,e){let{appGID:t,envId:r}=s,o={};o.appGID=t,o.envId=r;let n=await(this._options.fetcher??y)({url:Up(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/embed/origins"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/embed/origins.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}set(s,e){return h.fromPromise(this.__set(s,e))}async __set(s,e){let t=await(this._options.fetcher??y)({url:Up(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/embed/origins"),method:"PUT",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PUT /v1/embed/origins.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import zp from"url-join";var po=class{static{v(this,"Sessions")}_options;constructor(s){this._options=s}create(s,e){return h.fromPromise(this.__create(s,e))}async __create(s,e){let t=await(this._options.fetcher??y)({url:zp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/embed/sessions"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/embed/sessions.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}revoke(s,e){return h.fromPromise(this.__revoke(s,e))}async __revoke(s,e){let{sessionGid:t}=s,r=await(this._options.fetcher??y)({url:zp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/embed/sessions/${encodeURIComponent(t)}/revoke`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/embed/sessions/{sessionGid}/revoke.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};var uo=class{static{v(this,"Embed")}_options;_origins;_sessions;constructor(s){this._options=s}get origins(){return this._origins??=new io(this._options)}get sessions(){return this._sessions??=new po(this._options)}};import Qe from"url-join";var co=class{static{v(this,"Adapters")}_options;constructor(s){this._options=s}listAdapters(s){return h.fromPromise(this.__listAdapters(s))}async __listAdapters(s){let e=await(this._options.fetcher??y)({url:Qe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/adapters"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/adapters.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}createAdapter(s,e){return h.fromPromise(this.__createAdapter(s,e))}async __createAdapter(s,e){let t=await(this._options.fetcher??y)({url:Qe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/adapters"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/adapters.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}getAdapter(s,e){return h.fromPromise(this.__getAdapter(s,e))}async __getAdapter(s,e){let{adapterGid:t}=s,r=await(this._options.fetcher??y)({url:Qe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/adapters/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/adapters/{adapterGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteAdapter(s,e){return h.fromPromise(this.__deleteAdapter(s,e))}async __deleteAdapter(s,e){let{adapterGid:t}=s,r=await(this._options.fetcher??y)({url:Qe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/adapters/${encodeURIComponent(t)}`),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/adapters/{adapterGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateAdapter(s,e){return h.fromPromise(this.__updateAdapter(s,e))}async __updateAdapter(s,e){let{adapterGid:t,...r}=s,o=await(this._options.fetcher??y)({url:Qe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/adapters/${encodeURIComponent(t)}`),method:"PATCH",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PATCH /v1/adapters/{adapterGid}.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import W from"url-join";var wo=class{static{v(this,"Channels")}_options;constructor(s){this._options=s}listAppIds(s={},e){return h.fromPromise(this.__listAppIds(s,e))}async __listAppIds(s={},e){let{includeArchived:t}=s,r={};t!=null&&(r.includeArchived=t.toString());let o=await(this._options.fetcher??y)({url:W(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/apps"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/apps.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}list(s={},e){return h.fromPromise(this.__list(s,e))}async __list(s={},e){let{status:t,excludeFeedReceiving:r,includeArchived:o}=s,n={};t!=null&&(n.status=t),r!=null&&(n.excludeFeedReceiving=r.toString()),o!=null&&(n.includeArchived=o.toString());let d=await(this._options.fetcher??y)({url:W(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/apps/channels"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/apps/channels.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}create(s,e){return h.fromPromise(this.__create(s,e))}async __create(s,e){let{"Idempotency-Key":t,...r}=s,o=await(this._options.fetcher??y)({url:W(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/apps/channels"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":t??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/apps/channels.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getBySlug(s,e){return h.fromPromise(this.__getBySlug(s,e))}async __getBySlug(s,e){let{slug:t}=s,r=await(this._options.fetcher??y)({url:W(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/apps/channels/by-slug/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/apps/channels/by-slug/{slug}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listPaginated(s={},e){return h.fromPromise(this.__listPaginated(s,e))}async __listPaginated(s={},e){let{status:t,cursor:r,limit:o,includeArchived:n,fields:d}=s,b={};t!=null&&(b.status=t),r!=null&&(b.cursor=r),o!=null&&(b.limit=o.toString()),n!=null&&(b.includeArchived=n.toString()),d!=null&&(b.fields=d);let f=await(this._options.fetcher??y)({url:W(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/apps/channels/paginated"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:b,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(f.ok)return{data:f.body,rawResponse:f.rawResponse};if(f.error.reason==="status-code")switch(f.error.statusCode){case 400:throw new u(f.error.body,f.rawResponse);case 401:throw new c(f.error.body,f.rawResponse);case 403:throw new w(f.error.body,f.rawResponse);case 404:throw new l(f.error.body,f.rawResponse);case 429:throw new m(f.error.body,f.rawResponse);default:throw new a({statusCode:f.error.statusCode,body:f.error.body,rawResponse:f.rawResponse})}switch(f.error.reason){case"non-json":throw new a({statusCode:f.error.statusCode,body:f.error.rawBody,rawResponse:f.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/apps/channels/paginated.");case"unknown":throw new a({message:f.error.errorMessage,rawResponse:f.rawResponse})}}listWithStats(s={},e){return h.fromPromise(this.__listWithStats(s,e))}async __listWithStats(s={},e){let{status:t,includeArchived:r}=s,o={};t!=null&&(o.status=t),r!=null&&(o.includeArchived=r.toString());let n=await(this._options.fetcher??y)({url:W(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/apps/channels/stats"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/apps/channels/stats.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}get(s,e){return h.fromPromise(this.__get(s,e))}async __get(s,e){let{channelGid:t}=s,r=await(this._options.fetcher??y)({url:W(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/channels/{channelGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}remove(s,e){return h.fromPromise(this.__remove(s,e))}async __remove(s,e){let{channelGid:t}=s,r=await(this._options.fetcher??y)({url:W(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}`),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/channels/{channelGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(s,e){return h.fromPromise(this.__update(s,e))}async __update(s,e){let{channelGid:t,...r}=s,o=await(this._options.fetcher??y)({url:W(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}`),method:"PATCH",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PATCH /v1/channels/{channelGid}.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}archive(s,e){return h.fromPromise(this.__archive(s,e))}async __archive(s,e){let{channelGid:t}=s,r=await(this._options.fetcher??y)({url:W(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/archive`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/channels/{channelGid}/archive.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}pause(s,e){return h.fromPromise(this.__pause(s,e))}async __pause(s,e){let{channelGid:t}=s,r=await(this._options.fetcher??y)({url:W(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/pause`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/channels/{channelGid}/pause.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}resume(s,e){return h.fromPromise(this.__resume(s,e))}async __resume(s,e){let{channelGid:t}=s,r=await(this._options.fetcher??y)({url:W(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/resume`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/channels/{channelGid}/resume.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import He from"url-join";var lo=class{static{v(this,"Deliveries")}_options;constructor(s){this._options=s}listByApp(s={},e){return h.fromPromise(this.__listByApp(s,e))}async __listByApp(s={},e){let{status:t,limit:r}=s,o={};t!=null&&(o.status=t),r!=null&&(o.limit=r.toString());let n=await(this._options.fetcher??y)({url:He(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/apps/deliveries"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/apps/deliveries.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}get(s,e){return h.fromPromise(this.__get(s,e))}async __get(s,e){let{deliveryGid:t}=s,r=await(this._options.fetcher??y)({url:He(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/deliveries/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/deliveries/{deliveryGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}cancel(s,e){return h.fromPromise(this.__cancel(s,e))}async __cancel(s,e){let{deliveryGid:t}=s,r=await(this._options.fetcher??y)({url:He(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/deliveries/${encodeURIComponent(t)}/cancel`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/deliveries/{deliveryGid}/cancel.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}retry(s,e){return h.fromPromise(this.__retry(s,e))}async __retry(s,e){let{deliveryGid:t}=s,r=await(this._options.fetcher??y)({url:He(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/deliveries/${encodeURIComponent(t)}/retry`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/deliveries/{deliveryGid}/retry.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listByMessage(s,e){return h.fromPromise(this.__listByMessage(s,e))}async __listByMessage(s,e){let{messageGid:t}=s,r=await(this._options.fetcher??y)({url:He(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/messages/${encodeURIComponent(t)}/deliveries`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/messages/{messageGid}/deliveries.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listBySubscription(s,e){return h.fromPromise(this.__listBySubscription(s,e))}async __listBySubscription(s,e){let{subscriptionGid:t,status:r,limit:o}=s,n={};r!=null&&(n.status=r),o!=null&&(n.limit=o.toString());let d=await(this._options.fetcher??y)({url:He(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}/deliveries`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/subscriptions/{subscriptionGid}/deliveries.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import V from"url-join";var mo=class{static{v(this,"Dlq")}_options;constructor(s){this._options=s}listByApp(s={},e){return h.fromPromise(this.__listByApp(s,e))}async __listByApp(s={},e){let{status:t,limit:r,cursor:o}=s,n={};t!=null&&(n.status=t),r!=null&&(n.limit=r.toString()),o!=null&&(n.cursor=o);let d=await(this._options.fetcher??y)({url:V(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/apps/dlq"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/apps/dlq.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}get(s,e){return h.fromPromise(this.__get(s,e))}async __get(s,e){let{dlqEntryGid:t}=s,r=await(this._options.fetcher??y)({url:V(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/dlq/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/dlq/{dlqEntryGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}discard(s,e){return h.fromPromise(this.__discard(s,e))}async __discard(s,e){let{dlqEntryGid:t,...r}=s,o=await(this._options.fetcher??y)({url:V(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/dlq/${encodeURIComponent(t)}/discard`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/dlq/{dlqEntryGid}/discard.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}reprocess(s,e){return h.fromPromise(this.__reprocess(s,e))}async __reprocess(s,e){let{dlqEntryGid:t}=s,r=await(this._options.fetcher??y)({url:V(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/dlq/${encodeURIComponent(t)}/reprocess`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/dlq/{dlqEntryGid}/reprocess.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}bulkDiscard(s,e){return h.fromPromise(this.__bulkDiscard(s,e))}async __bulkDiscard(s,e){let t=await(this._options.fetcher??y)({url:V(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/dlq/discard"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/dlq/discard.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}reprocessWithFilter(s={},e){return h.fromPromise(this.__reprocessWithFilter(s,e))}async __reprocessWithFilter(s={},e){let t=await(this._options.fetcher??y)({url:V(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/dlq/reprocess"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/dlq/reprocess.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}bulkReprocess(s,e){return h.fromPromise(this.__bulkReprocess(s,e))}async __bulkReprocess(s,e){let t=await(this._options.fetcher??y)({url:V(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/dlq/retry"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/dlq/retry.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}listBySubscription(s,e){return h.fromPromise(this.__listBySubscription(s,e))}async __listBySubscription(s,e){let{subscriptionGid:t,status:r,limit:o}=s,n={};r!=null&&(n.status=r),o!=null&&(n.limit=o.toString());let d=await(this._options.fetcher??y)({url:V(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}/dlq`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/subscriptions/{subscriptionGid}/dlq.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}reprocessAllPending(s,e){return h.fromPromise(this.__reprocessAllPending(s,e))}async __reprocessAllPending(s,e){let{subscriptionGid:t,...r}=s,o=await(this._options.fetcher??y)({url:V(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}/dlq/reprocess`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/dlq/reprocess.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getStats(s,e){return h.fromPromise(this.__getStats(s,e))}async __getStats(s,e){let{subscriptionGid:t}=s,r=await(this._options.fetcher??y)({url:V(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}/dlq/stats`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/subscriptions/{subscriptionGid}/dlq/stats.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getTrend(s,e){return h.fromPromise(this.__getTrend(s,e))}async __getTrend(s,e){let{subscriptionGid:t,hours:r}=s,o={};r!=null&&(o.hours=r.toString());let n=await(this._options.fetcher??y)({url:V(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}/dlq/trend`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/subscriptions/{subscriptionGid}/dlq/trend.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Gn from"url-join";var ho=class{static{v(this,"AppDpopKeys")}_options;constructor(s){this._options=s}listKeys(s={},e){return h.fromPromise(this.__listKeys(s,e))}async __listKeys(s={},e){let{status:t,cursor:r,limit:o}=s,n={};t!=null&&(n.status=t),r!=null&&(n.cursor=r),o!=null&&(n.limit=o.toString());let d=await(this._options.fetcher??y)({url:Gn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/apps/dpop-keys"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/apps/dpop-keys.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}register(s,e){return h.fromPromise(this.__register(s,e))}async __register(s,e){let t=await(this._options.fetcher??y)({url:Gn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/apps/dpop-keys"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/apps/dpop-keys.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}revokeByThumbprint(s,e){return h.fromPromise(this.__revokeByThumbprint(s,e))}async __revokeByThumbprint(s,e){let{jwkThumbprint:t,reason:r}=s,o={};r!=null&&(o.reason=r);let n=await(this._options.fetcher??y)({url:Gn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/apps/dpop-keys/${encodeURIComponent(t)}`),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/apps/dpop-keys/{jwkThumbprint}.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import z from"url-join";var yo=class{static{v(this,"Catalogue")}_options;constructor(s){this._options=s}listEventTypes(s={},e){return h.fromPromise(this.__listEventTypes(s,e))}async __listEventTypes(s={},e){let{domain:t,status:r,tag:o}=s,n={};t!=null&&(n.domain=t),r!=null&&(n.status=r),o!=null&&(n.tag=o);let d=await(this._options.fetcher??y)({url:z(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/apps/events/types"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/apps/events/types.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}registerEventType(s,e){return h.fromPromise(this.__registerEventType(s,e))}async __registerEventType(s,e){let t=await(this._options.fetcher??y)({url:z(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/apps/events/types"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/apps/events/types.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}listDeprecated(s){return h.fromPromise(this.__listDeprecated(s))}async __listDeprecated(s){let e=await(this._options.fetcher??y)({url:z(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/apps/events/types/deprecated"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/apps/events/types/deprecated.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}getEventTypeByGid(s,e){return h.fromPromise(this.__getEventTypeByGid(s,e))}async __getEventTypeByGid(s,e){let{eventTypeGid:t}=s,r=await(this._options.fetcher??y)({url:z(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/events/types/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/events/types/{eventTypeGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateEventType(s,e){return h.fromPromise(this.__updateEventType(s,e))}async __updateEventType(s,e){let{eventTypeGid:t,...r}=s,o=await(this._options.fetcher??y)({url:z(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/events/types/${encodeURIComponent(t)}`),method:"PATCH",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PATCH /v1/events/types/{eventTypeGid}.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}activateEventType(s,e){return h.fromPromise(this.__activateEventType(s,e))}async __activateEventType(s,e){let{eventTypeGid:t}=s,r=await(this._options.fetcher??y)({url:z(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/events/types/${encodeURIComponent(t)}/activate`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/events/types/{eventTypeGid}/activate.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}checkCompatibility(s,e){return h.fromPromise(this.__checkCompatibility(s,e))}async __checkCompatibility(s,e){let{eventTypeGid:t,...r}=s,o=await(this._options.fetcher??y)({url:z(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/events/types/${encodeURIComponent(t)}/compatibility`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/events/types/{eventTypeGid}/compatibility.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getConsumers(s,e){return h.fromPromise(this.__getConsumers(s,e))}async __getConsumers(s,e){let{eventTypeGid:t}=s,r=await(this._options.fetcher??y)({url:z(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/events/types/${encodeURIComponent(t)}/consumers`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/events/types/{eventTypeGid}/consumers.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deprecateEventType(s,e){return h.fromPromise(this.__deprecateEventType(s,e))}async __deprecateEventType(s,e){let{eventTypeGid:t,...r}=s,o=await(this._options.fetcher??y)({url:z(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/events/types/${encodeURIComponent(t)}/deprecate`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/events/types/{eventTypeGid}/deprecate.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getImpactAnalysis(s,e){return h.fromPromise(this.__getImpactAnalysis(s,e))}async __getImpactAnalysis(s,e){let{eventTypeGid:t}=s,r=await(this._options.fetcher??y)({url:z(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/events/types/${encodeURIComponent(t)}/impact`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/events/types/{eventTypeGid}/impact.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getVersions(s,e){return h.fromPromise(this.__getVersions(s,e))}async __getVersions(s,e){let{eventTypeGid:t}=s,r=await(this._options.fetcher??y)({url:z(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/events/types/${encodeURIComponent(t)}/versions`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/events/types/{eventTypeGid}/versions.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}registerVersion(s,e){return h.fromPromise(this.__registerVersion(s,e))}async __registerVersion(s,e){let{eventTypeGid:t,...r}=s,o=await(this._options.fetcher??y)({url:z(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/events/types/${encodeURIComponent(t)}/versions`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/events/types/{eventTypeGid}/versions.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getEventTypeByName(s,e){return h.fromPromise(this.__getEventTypeByName(s,e))}async __getEventTypeByName(s,e){let{name:t}=s,r=await(this._options.fetcher??y)({url:z(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/events/types/by-name/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/events/types/by-name/{name}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import me from"url-join";var Ro=class{static{v(this,"Messages")}_options;constructor(s){this._options=s}listByApp(s={},e){return h.fromPromise(this.__listByApp(s,e))}async __listByApp(s={},e){let{limit:t}=s,r={};t!=null&&(r.limit=t.toString());let o=await(this._options.fetcher??y)({url:me(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/apps/messages"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/apps/messages.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}list(s,e){return h.fromPromise(this.__list(s,e))}async __list(s,e){let{channelGid:t,limit:r,afterTimestamp:o}=s,n={};r!=null&&(n.limit=r.toString()),o!=null&&(n.afterTimestamp=o.toString());let d=await(this._options.fetcher??y)({url:me(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/messages`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/channels/{channelGid}/messages.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}publish(s,e){return h.fromPromise(this.__publish(s,e))}async __publish(s,e){let{channelGid:t,"Idempotency-Key":r,...o}=s,n=await(this._options.fetcher??y)({url:me(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/messages`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/channels/{channelGid}/messages.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}publishBatch(s,e){return h.fromPromise(this.__publishBatch(s,e))}async __publishBatch(s,e){let{channelGid:t,"Idempotency-Key":r,...o}=s,n=await(this._options.fetcher??y)({url:me(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/messages/batch`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/channels/{channelGid}/messages/batch.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}publishBatchNpp(s,e){return h.fromPromise(this.__publishBatchNpp(s,e))}async __publishBatchNpp(s,e){let{channelGid:t,...r}=s,o=await(this._options.fetcher??y)({url:me(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/messages/batch-npp`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/channels/{channelGid}/messages/batch-npp.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}publishGroup(s,e){return h.fromPromise(this.__publishGroup(s,e))}async __publishGroup(s,e){let{channelGid:t,...r}=s,o=await(this._options.fetcher??y)({url:me(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/messages/group`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/channels/{channelGid}/messages/group.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}listByPartition(s,e){return h.fromPromise(this.__listByPartition(s,e))}async __listByPartition(s,e){let{channelGid:t,partitionKey:r,limit:o}=s,n={};o!=null&&(n.limit=o.toString());let d=await(this._options.fetcher??y)({url:me(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/messages/partition/${encodeURIComponent(r)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/channels/{channelGid}/messages/partition/{partitionKey}.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}get(s,e){return h.fromPromise(this.__get(s,e))}async __get(s,e){let{messageGid:t}=s,r=await(this._options.fetcher??y)({url:me(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/messages/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/messages/{messageGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import F from"url-join";var Po=class{static{v(this,"Subscriptions")}_options;constructor(s){this._options=s}listByApp(s={},e){return h.fromPromise(this.__listByApp(s,e))}async __listByApp(s={},e){let{status:t}=s,r={};t!=null&&(r.status=t);let o=await(this._options.fetcher??y)({url:F(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/apps/subscriptions"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/apps/subscriptions.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}subscribe(s,e){return h.fromPromise(this.__subscribe(s,e))}async __subscribe(s,e){let{channelGid:t,...r}=s,o=await(this._options.fetcher??y)({url:F(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/subscribe`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/channels/{channelGid}/subscribe.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}list(s,e){return h.fromPromise(this.__list(s,e))}async __list(s,e){let{channelGid:t,status:r}=s,o={};r!=null&&(o.status=r);let n=await(this._options.fetcher??y)({url:F(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/subscriptions`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/channels/{channelGid}/subscriptions.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}create(s,e){return h.fromPromise(this.__create(s,e))}async __create(s,e){let{channelGid:t,"Idempotency-Key":r,...o}=s,n=await(this._options.fetcher??y)({url:F(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/subscriptions`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/channels/{channelGid}/subscriptions.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}get(s,e){return h.fromPromise(this.__get(s,e))}async __get(s,e){let{subscriptionGid:t}=s,r=await(this._options.fetcher??y)({url:F(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/subscriptions/{subscriptionGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}remove(s,e){return h.fromPromise(this.__remove(s,e))}async __remove(s,e){let{subscriptionGid:t}=s,r=await(this._options.fetcher??y)({url:F(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}`),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/subscriptions/{subscriptionGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(s,e){return h.fromPromise(this.__update(s,e))}async __update(s,e){let{subscriptionGid:t,...r}=s,o=await(this._options.fetcher??y)({url:F(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}`),method:"PATCH",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PATCH /v1/subscriptions/{subscriptionGid}.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}archive(s,e){return h.fromPromise(this.__archive(s,e))}async __archive(s,e){let{subscriptionGid:t}=s,r=await(this._options.fetcher??y)({url:F(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}/archive`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/archive.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}pause(s,e){return h.fromPromise(this.__pause(s,e))}async __pause(s,e){let{subscriptionGid:t}=s,r=await(this._options.fetcher??y)({url:F(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}/pause`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/pause.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}resume(s,e){return h.fromPromise(this.__resume(s,e))}async __resume(s,e){let{subscriptionGid:t}=s,r=await(this._options.fetcher??y)({url:F(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}/resume`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/resume.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}rotateSecret(s,e){return h.fromPromise(this.__rotateSecret(s,e))}async __rotateSecret(s,e){let{subscriptionGid:t,...r}=s,o=await(this._options.fetcher??y)({url:F(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}/rotate`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/rotate.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}revealSecret(s,e){return h.fromPromise(this.__revealSecret(s,e))}async __revealSecret(s,e){let{subscriptionGid:t}=s,r=await(this._options.fetcher??y)({url:F(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}/secret/reveal`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/secret/reveal.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}unsubscribe(s,e){return h.fromPromise(this.__unsubscribe(s,e))}async __unsubscribe(s,e){let{subscriptionGid:t}=s,r=await(this._options.fetcher??y)({url:F(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}/unsubscribe`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/unsubscribe.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import cc from"url-join";var go=class{static{v(this,"TieredStorage")}_options;constructor(s){this._options=s}getColdTierReplay(s,e){return h.fromPromise(this.__getColdTierReplay(s,e))}async __getColdTierReplay(s,e){let{channelGid:t,...r}=s,o=await(this._options.fetcher??y)({url:cc(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/cold-tier/replay`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/channels/{channelGid}/cold-tier/replay.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import ne from"url-join";var bo=class{static{v(this,"ConsumerGroups")}_options;constructor(s){this._options=s}listGroups(s,e){return h.fromPromise(this.__listGroups(s,e))}async __listGroups(s,e){let{channelGid:t}=s,r=await(this._options.fetcher??y)({url:ne(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/consumer-groups`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/channels/{channelGid}/consumer-groups.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}createGroup(s,e){return h.fromPromise(this.__createGroup(s,e))}async __createGroup(s,e){let{channelGid:t,...r}=s,o=await(this._options.fetcher??y)({url:ne(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/consumer-groups`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/channels/{channelGid}/consumer-groups.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getGroup(s,e){return h.fromPromise(this.__getGroup(s,e))}async __getGroup(s,e){let{groupGid:t}=s,r=await(this._options.fetcher??y)({url:ne(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/consumer-groups/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/consumer-groups/{groupGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteGroup(s,e){return h.fromPromise(this.__deleteGroup(s,e))}async __deleteGroup(s,e){let{groupGid:t}=s,r=await(this._options.fetcher??y)({url:ne(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/consumer-groups/${encodeURIComponent(t)}`),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/consumer-groups/{groupGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateGroup(s,e){return h.fromPromise(this.__updateGroup(s,e))}async __updateGroup(s,e){let{groupGid:t,...r}=s,o=await(this._options.fetcher??y)({url:ne(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/consumer-groups/${encodeURIComponent(t)}`),method:"PATCH",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PATCH /v1/consumer-groups/{groupGid}.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}joinGroup(s,e){return h.fromPromise(this.__joinGroup(s,e))}async __joinGroup(s,e){let{groupGid:t,...r}=s,o=await(this._options.fetcher??y)({url:ne(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/consumer-groups/${encodeURIComponent(t)}/members`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/consumer-groups/{groupGid}/members.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}leaveGroup(s,e){return h.fromPromise(this.__leaveGroup(s,e))}async __leaveGroup(s,e){let{groupGid:t,subscriptionGid:r}=s,o=await(this._options.fetcher??y)({url:ne(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/consumer-groups/${encodeURIComponent(t)}/members/${encodeURIComponent(r)}`),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/consumer-groups/{groupGid}/members/{subscriptionGid}.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}receive(s,e){return h.fromPromise(this.__receive(s,e))}async __receive(s,e){let{groupGid:t,subscriptionGid:r,...o}=s,n=await(this._options.fetcher??y)({url:ne(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/consumer-groups/${encodeURIComponent(t)}/members/${encodeURIComponent(r)}/receive`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/consumer-groups/{groupGid}/members/{subscriptionGid}/receive.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}pauseGroup(s,e){return h.fromPromise(this.__pauseGroup(s,e))}async __pauseGroup(s,e){let{groupGid:t}=s,r=await(this._options.fetcher??y)({url:ne(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/consumer-groups/${encodeURIComponent(t)}/pause`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/consumer-groups/{groupGid}/pause.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}resumeGroup(s,e){return h.fromPromise(this.__resumeGroup(s,e))}async __resumeGroup(s,e){let{groupGid:t}=s,r=await(this._options.fetcher??y)({url:ne(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/consumer-groups/${encodeURIComponent(t)}/resume`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/consumer-groups/{groupGid}/resume.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import qe from"url-join";var No=class{static{v(this,"Scheduling")}_options;constructor(s){this._options=s}scheduleMessage(s,e){return h.fromPromise(this.__scheduleMessage(s,e))}async __scheduleMessage(s,e){let{channelGid:t,"Idempotency-Key":r,...o}=s,n=await(this._options.fetcher??y)({url:qe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/schedule`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/channels/{channelGid}/schedule.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}scheduleDelay(s,e){return h.fromPromise(this.__scheduleDelay(s,e))}async __scheduleDelay(s,e){let{channelGid:t,"Idempotency-Key":r,...o}=s,n=await(this._options.fetcher??y)({url:qe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/schedule/delay`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/channels/{channelGid}/schedule/delay.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}listScheduled(s,e){return h.fromPromise(this.__listScheduled(s,e))}async __listScheduled(s,e){let{channelGid:t}=s,r=await(this._options.fetcher??y)({url:qe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/scheduled-messages`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/channels/{channelGid}/scheduled-messages.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getScheduledStatus(s,e){return h.fromPromise(this.__getScheduledStatus(s,e))}async __getScheduledStatus(s,e){let{scheduledMessageGid:t}=s,r=await(this._options.fetcher??y)({url:qe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/scheduled-messages/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/scheduled-messages/{scheduledMessageGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateScheduled(s,e){return h.fromPromise(this.__updateScheduled(s,e))}async __updateScheduled(s,e){let{scheduledMessageGid:t,...r}=s,o=await(this._options.fetcher??y)({url:qe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/scheduled-messages/${encodeURIComponent(t)}`),method:"PATCH",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PATCH /v1/scheduled-messages/{scheduledMessageGid}.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}cancelScheduled(s,e){return h.fromPromise(this.__cancelScheduled(s,e))}async __cancelScheduled(s,e){let{scheduledMessageGid:t,...r}=s,o=await(this._options.fetcher??y)({url:qe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/scheduled-messages/${encodeURIComponent(t)}/cancel`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/scheduled-messages/{scheduledMessageGid}/cancel.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import vo from"url-join";var fo=class{static{v(this,"Snapshots")}_options;constructor(s){this._options=s}seekToTimestamp(s,e){return h.fromPromise(this.__seekToTimestamp(s,e))}async __seekToTimestamp(s,e){let{channelGid:t,...r}=s,o=await(this._options.fetcher??y)({url:vo(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/seek-to-timestamp`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/channels/{channelGid}/seek-to-timestamp.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}seekToSnapshot(s,e){return h.fromPromise(this.__seekToSnapshot(s,e))}async __seekToSnapshot(s,e){let{snapshotGid:t}=s,r=await(this._options.fetcher??y)({url:vo(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/snapshots/${encodeURIComponent(t)}/seek`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/snapshots/{snapshotGid}/seek.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listSnapshots(s,e){return h.fromPromise(this.__listSnapshots(s,e))}async __listSnapshots(s,e){let{subscriptionGid:t}=s,r=await(this._options.fetcher??y)({url:vo(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}/snapshots`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/subscriptions/{subscriptionGid}/snapshots.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}createSnapshot(s,e){return h.fromPromise(this.__createSnapshot(s,e))}async __createSnapshot(s,e){let{subscriptionGid:t,...r}=s,o=await(this._options.fetcher??y)({url:vo(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}/snapshots`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/snapshots.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Eo from"url-join";var So=class{static{v(this,"TimeTravel")}_options;constructor(s){this._options=s}diffChannelBetween(s,e){return h.fromPromise(this.__diffChannelBetween(s,e))}async __diffChannelBetween(s,e){let{channelGid:t,...r}=s,o=await(this._options.fetcher??y)({url:Eo(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/time-travel/diff`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/channels/{channelGid}/time-travel/diff.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getChannelSnapshotAtTime(s,e){return h.fromPromise(this.__getChannelSnapshotAtTime(s,e))}async __getChannelSnapshotAtTime(s,e){let{channelGid:t,...r}=s,o=await(this._options.fetcher??y)({url:Eo(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/time-travel/snapshot`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/channels/{channelGid}/time-travel/snapshot.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getChannelSnapshotAtTimeWithGrantApi(s,e){return h.fromPromise(this.__getChannelSnapshotAtTimeWithGrantApi(s,e))}async __getChannelSnapshotAtTimeWithGrantApi(s,e){let{channelGid:t,...r}=s,o=await(this._options.fetcher??y)({url:Eo(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/time-travel/snapshot/grant`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/channels/{channelGid}/time-travel/snapshot/grant.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getMessageAtTime(s,e){return h.fromPromise(this.__getMessageAtTime(s,e))}async __getMessageAtTime(s,e){let{messageGid:t,...r}=s,o=await(this._options.fetcher??y)({url:Eo(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/messages/${encodeURIComponent(t)}/time-travel`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/messages/{messageGid}/time-travel.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Ve from"url-join";var _o=class{static{v(this,"ArchiveReplay")}_options;constructor(s){this._options=s}getArchiveStatus(s,e){return h.fromPromise(this.__getArchiveStatus(s,e))}async __getArchiveStatus(s,e){let{channelGid:t}=s,r=await(this._options.fetcher??y)({url:Ve(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/archive-status`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/channels/{channelGid}/archive-status.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}archiveChannel(s,e){return h.fromPromise(this.__archiveChannel(s,e))}async __archiveChannel(s,e){let{channelGid:t}=s,r=await(this._options.fetcher??y)({url:Ve(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/messages/archive`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/channels/{channelGid}/messages/archive.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}restoreChannel(s,e){return h.fromPromise(this.__restoreChannel(s,e))}async __restoreChannel(s,e){let{channelGid:t}=s,r=await(this._options.fetcher??y)({url:Ve(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/restore`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/channels/{channelGid}/restore.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}replayMessages(s,e){return h.fromPromise(this.__replayMessages(s,e))}async __replayMessages(s,e){let{targetChannelGid:t,...r}=s,o=await(this._options.fetcher??y)({url:Ve(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/replay`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/channels/{targetChannelGid}/replay.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}replayMessagesWithGrant(s,e){return h.fromPromise(this.__replayMessagesWithGrant(s,e))}async __replayMessagesWithGrant(s,e){let{targetChannelGid:t,...r}=s,o=await(this._options.fetcher??y)({url:Ve(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/replay-with-grant`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/channels/{targetChannelGid}/replay-with-grant.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Ye from"url-join";var ko=class{static{v(this,"Observability")}_options;constructor(s){this._options=s}getChannelDeliveryOverview(s,e){return h.fromPromise(this.__getChannelDeliveryOverview(s,e))}async __getChannelDeliveryOverview(s,e){let{channelGid:t}=s,r=await(this._options.fetcher??y)({url:Ye(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/delivery-overview`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/channels/{channelGid}/delivery-overview.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getChannelSubscriptionHealth(s,e){return h.fromPromise(this.__getChannelSubscriptionHealth(s,e))}async __getChannelSubscriptionHealth(s,e){let{channelGid:t}=s,r=await(this._options.fetcher??y)({url:Ye(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/subscriptions/health`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/channels/{channelGid}/subscriptions/health.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getDeliveryTimeline(s,e){return h.fromPromise(this.__getDeliveryTimeline(s,e))}async __getDeliveryTimeline(s,e){let{deliveryGid:t}=s,r=await(this._options.fetcher??y)({url:Ye(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/deliveries/${encodeURIComponent(t)}/timeline`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/deliveries/{deliveryGid}/timeline.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getMessageDeliveryStatus(s,e){return h.fromPromise(this.__getMessageDeliveryStatus(s,e))}async __getMessageDeliveryStatus(s,e){let{messageGid:t}=s,r=await(this._options.fetcher??y)({url:Ye(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/messages/${encodeURIComponent(t)}/delivery-status`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/messages/{messageGid}/delivery-status.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}searchMessages(s={},e){return h.fromPromise(this.__searchMessages(s,e))}async __searchMessages(s={},e){let{channelGid:t,routingKey:r,status:o,fromDate:n,toDate:d,limit:b}=s,f={};t!=null&&(f.channelGid=t),r!=null&&(f.routingKey=r),o!=null&&(f.status=o),n!=null&&(f.fromDate=n.toString()),d!=null&&(f.toDate=d.toString()),b!=null&&(f.limit=b.toString());let E=await(this._options.fetcher??y)({url:Ye(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/messages/search"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:f,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(E.ok)return{data:E.body,rawResponse:E.rawResponse};if(E.error.reason==="status-code")switch(E.error.statusCode){case 400:throw new u(E.error.body,E.rawResponse);case 401:throw new c(E.error.body,E.rawResponse);case 403:throw new w(E.error.body,E.rawResponse);case 404:throw new l(E.error.body,E.rawResponse);case 429:throw new m(E.error.body,E.rawResponse);default:throw new a({statusCode:E.error.statusCode,body:E.error.body,rawResponse:E.rawResponse})}switch(E.error.reason){case"non-json":throw new a({statusCode:E.error.statusCode,body:E.error.rawBody,rawResponse:E.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/messages/search.");case"unknown":throw new a({message:E.error.errorMessage,rawResponse:E.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import wc from"url-join";var To=class{static{v(this,"ChannelDetail")}_options;constructor(s){this._options=s}getChannelDetail(s,e){return h.fromPromise(this.__getChannelDetail(s,e))}async __getChannelDetail(s,e){let{channelGid:t}=s,r=await(this._options.fetcher??y)({url:wc(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/detail`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/channels/{channelGid}/detail.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import ge from"url-join";var Co=class{static{v(this,"Receipts")}_options;constructor(s){this._options=s}listByChannel(s,e){return h.fromPromise(this.__listByChannel(s,e))}async __listByChannel(s,e){let{channelGid:t,status:r,limit:o,cursor:n}=s,d={};r!=null&&(d.status=r),o!=null&&(d.limit=o.toString()),n!=null&&(d.cursor=n.toString());let b=await(this._options.fetcher??y)({url:ge(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/receipts`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:d,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(b.ok)return{data:b.body,rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new u(b.error.body,b.rawResponse);case 401:throw new c(b.error.body,b.rawResponse);case 403:throw new w(b.error.body,b.rawResponse);case 404:throw new l(b.error.body,b.rawResponse);case 429:throw new m(b.error.body,b.rawResponse);default:throw new a({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}switch(b.error.reason){case"non-json":throw new a({statusCode:b.error.statusCode,body:b.error.rawBody,rawResponse:b.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/channels/{channelGid}/receipts.");case"unknown":throw new a({message:b.error.errorMessage,rawResponse:b.rawResponse})}}getByDelivery(s,e){return h.fromPromise(this.__getByDelivery(s,e))}async __getByDelivery(s,e){let{deliveryGid:t}=s,r=await(this._options.fetcher??y)({url:ge(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/deliveries/${encodeURIComponent(t)}/receipt`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/deliveries/{deliveryGid}/receipt.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listByMessage(s,e){return h.fromPromise(this.__listByMessage(s,e))}async __listByMessage(s,e){let{messageGid:t,limit:r}=s,o={};r!=null&&(o.limit=r.toString());let n=await(this._options.fetcher??y)({url:ge(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/messages/${encodeURIComponent(t)}/receipts`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/messages/{messageGid}/receipts.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}get(s,e){return h.fromPromise(this.__get(s,e))}async __get(s,e){let{gid:t}=s,r=await(this._options.fetcher??y)({url:ge(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/receipts/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/receipts/{gid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}acknowledge(s,e){return h.fromPromise(this.__acknowledge(s,e))}async __acknowledge(s,e){let{receiptGid:t,...r}=s,o=await(this._options.fetcher??y)({url:ge(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/receipts/${encodeURIComponent(t)}/acknowledge`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/receipts/{receiptGid}/acknowledge.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}listBySubscription(s,e){return h.fromPromise(this.__listBySubscription(s,e))}async __listBySubscription(s,e){let{subscriptionGid:t,limit:r,cursor:o}=s,n={};r!=null&&(n.limit=r.toString()),o!=null&&(n.cursor=o.toString());let d=await(this._options.fetcher??y)({url:ge(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}/receipts`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/subscriptions/{subscriptionGid}/receipts.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}getStats(s,e){return h.fromPromise(this.__getStats(s,e))}async __getStats(s,e){let{subscriptionGid:t,startTime:r,endTime:o}=s,n={};r!=null&&(n.startTime=r.toString()),o!=null&&(n.endTime=o.toString());let d=await(this._options.fetcher??y)({url:ge(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}/receipts/stats`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/subscriptions/{subscriptionGid}/receipts/stats.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import lc from"url-join";var xo=class{static{v(this,"Security")}_options;constructor(s){this._options=s}scanChannelSample(s,e){return h.fromPromise(this.__scanChannelSample(s,e))}async __scanChannelSample(s,e){let{channelGid:t,limit:r}=s,o={};r!=null&&(o.limit=r.toString());let n=await(this._options.fetcher??y)({url:lc(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/security/scan-sample`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/channels/{channelGid}/security/scan-sample.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Mn from"url-join";var Ao=class{static{v(this,"Consume")}_options;constructor(s){this._options=s}seek(s,e){return h.fromPromise(this.__seek(s,e))}async __seek(s,e){let{channelGid:t,...r}=s,o=await(this._options.fetcher??y)({url:Mn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/seek`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/channels/{channelGid}/seek.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}ack(s,e){return h.fromPromise(this.__ack(s,e))}async __ack(s,e){let{subscriptionGid:t,...r}=s,o=await(this._options.fetcher??y)({url:Mn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}/ack`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/ack.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}flowCredit(s,e){return h.fromPromise(this.__flowCredit(s,e))}async __flowCredit(s,e){let{subscriptionGid:t,...r}=s,o=await(this._options.fetcher??y)({url:Mn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}/flow-credit`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/flow-credit.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import be from"url-join";var Io=class{static{v(this,"Streams")}_options;constructor(s){this._options=s}openCrossOrgStream(s,e){return h.fromPromise(this.__openCrossOrgStream(s,e))}async __openCrossOrgStream(s,e){let{channelGid:t,publisherAppId:r,subscriberOrgId:o}=s,n={};n.publisherAppId=r,n.subscriberOrgId=o;let d=await(this._options.fetcher??y)({url:be(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/streams/cross-org`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/channels/{channelGid}/streams/cross-org.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}readFromOffsetWithGrant(s,e){return h.fromPromise(this.__readFromOffsetWithGrant(s,e))}async __readFromOffsetWithGrant(s,e){let{channelGid:t,...r}=s,o=await(this._options.fetcher??y)({url:be(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/streams/cross-org/read`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/channels/{channelGid}/streams/cross-org/read.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getOffset(s,e){return h.fromPromise(this.__getOffset(s,e))}async __getOffset(s,e){let{channelGid:t,consumerId:r}=s,o={};o.consumerId=r;let n=await(this._options.fetcher??y)({url:be(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/streams/offset`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/channels/{channelGid}/streams/offset.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}commitOffset(s,e){return h.fromPromise(this.__commitOffset(s,e))}async __commitOffset(s,e){let{channelGid:t,...r}=s,o=await(this._options.fetcher??y)({url:be(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/streams/offset`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/channels/{channelGid}/streams/offset.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}listOffsets(s,e){return h.fromPromise(this.__listOffsets(s,e))}async __listOffsets(s,e){let{channelGid:t}=s,r=await(this._options.fetcher??y)({url:be(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/streams/offsets`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/channels/{channelGid}/streams/offsets.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}readFromOffset(s,e){return h.fromPromise(this.__readFromOffset(s,e))}async __readFromOffset(s,e){let{channelGid:t,offset:r,limit:o,subscriptionGid:n}=s,d={};d.offset=r.toString(),o!=null&&(d.limit=o.toString()),n!=null&&(d.subscriptionGid=n);let b=await(this._options.fetcher??y)({url:be(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/streams/read`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:d,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(b.ok)return{data:b.body,rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new u(b.error.body,b.rawResponse);case 401:throw new c(b.error.body,b.rawResponse);case 403:throw new w(b.error.body,b.rawResponse);case 404:throw new l(b.error.body,b.rawResponse);case 429:throw new m(b.error.body,b.rawResponse);default:throw new a({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}switch(b.error.reason){case"non-json":throw new a({statusCode:b.error.statusCode,body:b.error.rawBody,rawResponse:b.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/channels/{channelGid}/streams/read.");case"unknown":throw new a({message:b.error.errorMessage,rawResponse:b.rawResponse})}}seekToTimestamp(s,e){return h.fromPromise(this.__seekToTimestamp(s,e))}async __seekToTimestamp(s,e){let{channelGid:t,...r}=s,o=await(this._options.fetcher??y)({url:be(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/channels/${encodeURIComponent(t)}/streams/seek`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/channels/{channelGid}/streams/seek.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Xe from"url-join";var Go=class{static{v(this,"DeliveryReceipts")}_options;constructor(s){this._options=s}getByDelivery(s,e){return h.fromPromise(this.__getByDelivery(s,e))}async __getByDelivery(s,e){let{deliveryGid:t}=s,r=await(this._options.fetcher??y)({url:Xe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/delivery-receipts/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/delivery-receipts/{deliveryGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}confirm(s,e){return h.fromPromise(this.__confirm(s,e))}async __confirm(s,e){let{deliveryGid:t,...r}=s,o=await(this._options.fetcher??y)({url:Xe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/delivery-receipts/${encodeURIComponent(t)}/confirm`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/delivery-receipts/{deliveryGid}/confirm.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}listBySubscription(s,e){return h.fromPromise(this.__listBySubscription(s,e))}async __listBySubscription(s,e){let{subscriptionGid:t,limit:r}=s,o={};r!=null&&(o.limit=r.toString());let n=await(this._options.fetcher??y)({url:Xe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}/delivery-receipts`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/subscriptions/{subscriptionGid}/delivery-receipts.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getHealth(s,e){return h.fromPromise(this.__getHealth(s,e))}async __getHealth(s,e){let{subscriptionGid:t}=s,r=await(this._options.fetcher??y)({url:Xe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}/webhook-health`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/subscriptions/{subscriptionGid}/webhook-health.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listDegraded(s){return h.fromPromise(this.__listDegraded(s))}async __listDegraded(s){let e=await(this._options.fetcher??y)({url:Xe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/webhook-health/degraded"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/webhook-health/degraded.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import mc from"url-join";var Mo=class{static{v(this,"Stats")}_options;constructor(s){this._options=s}retrieve(s){return h.fromPromise(this.__retrieve(s))}async __retrieve(s){let e=await(this._options.fetcher??y)({url:mc(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/events/stats"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/events/stats.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Hn from"url-join";var Ho=class{static{v(this,"ExactlyOnce")}_options;constructor(s){this._options=s}isDelivered(s,e){return h.fromPromise(this.__isDelivered(s,e))}async __isDelivered(s,e){let{subscriptionGid:t,messageGid:r}=s,o={};o.subscriptionGid=t,o.messageGid=r;let n=await(this._options.fetcher??y)({url:Hn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/exactly-once/delivered"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/exactly-once/delivered.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}generateDeliveryToken(s,e){return h.fromPromise(this.__generateDeliveryToken(s,e))}async __generateDeliveryToken(s,e){let t=await(this._options.fetcher??y)({url:Hn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/exactly-once/tokens"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/exactly-once/tokens.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}confirmDelivery(s,e){return h.fromPromise(this.__confirmDelivery(s,e))}async __confirmDelivery(s,e){let{token:t,...r}=s,o=await(this._options.fetcher??y)({url:Hn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/exactly-once/tokens/${encodeURIComponent(t)}/confirm`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/exactly-once/tokens/{token}/confirm.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import B from"url-join";var qo=class{static{v(this,"Exchanges")}_options;constructor(s){this._options=s}removeBinding(s,e){return h.fromPromise(this.__removeBinding(s,e))}async __removeBinding(s,e){let{bindingGid:t}=s,r=await(this._options.fetcher??y)({url:B(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/exchange-bindings/${encodeURIComponent(t)}`),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/exchange-bindings/{bindingGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}list(s){return h.fromPromise(this.__list(s))}async __list(s){let e=await(this._options.fetcher??y)({url:B(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/exchanges"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/exchanges.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}create(s,e){return h.fromPromise(this.__create(s,e))}async __create(s,e){let t=await(this._options.fetcher??y)({url:B(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/exchanges"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/exchanges.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}get(s,e){return h.fromPromise(this.__get(s,e))}async __get(s,e){let{exchangeGid:t}=s,r=await(this._options.fetcher??y)({url:B(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/exchanges/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/exchanges/{exchangeGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}remove(s,e){return h.fromPromise(this.__remove(s,e))}async __remove(s,e){let{exchangeGid:t}=s,r=await(this._options.fetcher??y)({url:B(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/exchanges/${encodeURIComponent(t)}`),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/exchanges/{exchangeGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(s,e){return h.fromPromise(this.__update(s,e))}async __update(s,e){let{exchangeGid:t,...r}=s,o=await(this._options.fetcher??y)({url:B(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/exchanges/${encodeURIComponent(t)}`),method:"PATCH",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PATCH /v1/exchanges/{exchangeGid}.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}listBindings(s,e){return h.fromPromise(this.__listBindings(s,e))}async __listBindings(s,e){let{exchangeGid:t}=s,r=await(this._options.fetcher??y)({url:B(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/exchanges/${encodeURIComponent(t)}/bindings`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/exchanges/{exchangeGid}/bindings.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}createBinding(s,e){return h.fromPromise(this.__createBinding(s,e))}async __createBinding(s,e){let{exchangeGid:t,...r}=s,o=await(this._options.fetcher??y)({url:B(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/exchanges/${encodeURIComponent(t)}/bindings`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/exchanges/{exchangeGid}/bindings.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}disable(s,e){return h.fromPromise(this.__disable(s,e))}async __disable(s,e){let{exchangeGid:t}=s,r=await(this._options.fetcher??y)({url:B(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/exchanges/${encodeURIComponent(t)}/disable`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/exchanges/{exchangeGid}/disable.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}dryRun(s,e){return h.fromPromise(this.__dryRun(s,e))}async __dryRun(s,e){let{exchangeGid:t,...r}=s,o=await(this._options.fetcher??y)({url:B(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/exchanges/${encodeURIComponent(t)}/dry-run`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/exchanges/{exchangeGid}/dry-run.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}enable(s,e){return h.fromPromise(this.__enable(s,e))}async __enable(s,e){let{exchangeGid:t}=s,r=await(this._options.fetcher??y)({url:B(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/exchanges/${encodeURIComponent(t)}/enable`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/exchanges/{exchangeGid}/enable.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}publishToExchange(s,e){return h.fromPromise(this.__publishToExchange(s,e))}async __publishToExchange(s,e){let{exchangeGid:t,"Idempotency-Key":r,...o}=s,n=await(this._options.fetcher??y)({url:B(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/exchanges/${encodeURIComponent(t)}/publish`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/exchanges/{exchangeGid}/publish.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getByGid(s,e){return h.fromPromise(this.__getByGid(s,e))}async __getByGid(s,e){let{gid:t}=s,r=await(this._options.fetcher??y)({url:B(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/exchanges/${encodeURIComponent(t)}/raw`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/exchanges/{gid}/raw.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listWithStats(s){return h.fromPromise(this.__listWithStats(s))}async __listWithStats(s){let e=await(this._options.fetcher??y)({url:B(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/exchanges/stats"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/exchanges/stats.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import qn from"url-join";var Bo=class{static{v(this,"Transactional")}_options;constructor(s){this._options=s}listDeliveriesByGroupGrantFifo(s,e){return h.fromPromise(this.__listDeliveriesByGroupGrantFifo(s,e))}async __listDeliveriesByGroupGrantFifo(s,e){let{groupId:t,grantId:r}=s,o=await(this._options.fetcher??y)({url:qn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/groups/${encodeURIComponent(t)}/grants/${encodeURIComponent(r)}/deliveries`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/groups/{groupId}/grants/{grantId}/deliveries.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}consumeAndPublish(s,e){return h.fromPromise(this.__consumeAndPublish(s,e))}async __consumeAndPublish(s,e){let t=await(this._options.fetcher??y)({url:qn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/messages/transactional"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/messages/transactional.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}consumeAndPublishMulti(s,e){return h.fromPromise(this.__consumeAndPublishMulti(s,e))}async __consumeAndPublishMulti(s,e){let t=await(this._options.fetcher??y)({url:qn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/messages/transactional/multi"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/messages/transactional/multi.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Ze from"url-join";var Uo=class{static{v(this,"KvStore")}_options;constructor(s){this._options=s}getEntry(s,e){return h.fromPromise(this.__getEntry(s,e))}async __getEntry(s,e){let{channelGid:t,key:r}=s,o=await(this._options.fetcher??y)({url:Ze(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/kv/${encodeURIComponent(t)}/${encodeURIComponent(r)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/kv/{channelGid}/{key}.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}setEntry(s,e){return h.fromPromise(this.__setEntry(s,e))}async __setEntry(s,e){let{channelGid:t,key:r,...o}=s,n=await(this._options.fetcher??y)({url:Ze(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/kv/${encodeURIComponent(t)}/${encodeURIComponent(r)}`),method:"PUT",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PUT /v1/kv/{channelGid}/{key}.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}deleteEntry(s,e){return h.fromPromise(this.__deleteEntry(s,e))}async __deleteEntry(s,e){let{channelGid:t,key:r}=s,o=await(this._options.fetcher??y)({url:Ze(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/kv/${encodeURIComponent(t)}/${encodeURIComponent(r)}`),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/kv/{channelGid}/{key}.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getHistory(s,e){return h.fromPromise(this.__getHistory(s,e))}async __getHistory(s,e){let{channelGid:t,key:r,limit:o}=s,n={};o!=null&&(n.limit=o.toString());let d=await(this._options.fetcher??y)({url:Ze(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/kv/${encodeURIComponent(t)}/${encodeURIComponent(r)}/history`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/kv/{channelGid}/{key}/history.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}listKeys(s,e){return h.fromPromise(this.__listKeys(s,e))}async __listKeys(s,e){let{channelGid:t,limit:r}=s,o={};r!=null&&(o.limit=r.toString());let n=await(this._options.fetcher??y)({url:Ze(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/kv/${encodeURIComponent(t)}/keys`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/kv/{channelGid}/keys.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import er from"url-join";var zo=class{static{v(this,"Sources")}_options;constructor(s){this._options=s}listSources(s){return h.fromPromise(this.__listSources(s))}async __listSources(s){let e=await(this._options.fetcher??y)({url:er(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/sources"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/sources.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}getSource(s,e){return h.fromPromise(this.__getSource(s,e))}async __getSource(s,e){let{sourceGid:t}=s,r=await(this._options.fetcher??y)({url:er(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/sources/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/sources/{sourceGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}removeSource(s,e){return h.fromPromise(this.__removeSource(s,e))}async __removeSource(s,e){let{sourceGid:t}=s,r=await(this._options.fetcher??y)({url:er(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/sources/${encodeURIComponent(t)}`),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/sources/{sourceGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}pauseSource(s,e){return h.fromPromise(this.__pauseSource(s,e))}async __pauseSource(s,e){let{sourceGid:t}=s,r=await(this._options.fetcher??y)({url:er(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/sources/${encodeURIComponent(t)}/pause`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/sources/{sourceGid}/pause.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}resumeSource(s,e){return h.fromPromise(this.__resumeSource(s,e))}async __resumeSource(s,e){let{sourceGid:t}=s,r=await(this._options.fetcher??y)({url:er(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/sources/${encodeURIComponent(t)}/resume`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/sources/{sourceGid}/resume.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Bn from"url-join";var Fo=class{static{v(this,"Queues")}_options;constructor(s){this._options=s}deleteMessage(s,e){return h.fromPromise(this.__deleteMessage(s,e))}async __deleteMessage(s,e){let{subscriptionGid:t,receiptHandle:r}=s,o=await(this._options.fetcher??y)({url:Bn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}/messages/${encodeURIComponent(r)}`),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/subscriptions/{subscriptionGid}/messages/{receiptHandle}.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}changeMessageVisibility(s,e){return h.fromPromise(this.__changeMessageVisibility(s,e))}async __changeMessageVisibility(s,e){let{subscriptionGid:t,receiptHandle:r,...o}=s,n=await(this._options.fetcher??y)({url:Bn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}/messages/${encodeURIComponent(r)}/visibility`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/messages/{receiptHandle}/visibility.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}receiveMessages(s,e){return h.fromPromise(this.__receiveMessages(s,e))}async __receiveMessages(s,e){let{subscriptionGid:t,...r}=s,o=await(this._options.fetcher??y)({url:Bn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}/messages/receive`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/messages/receive.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Fp from"url-join";var jo=class{static{v(this,"QueueBatch")}_options;constructor(s){this._options=s}deleteMessageBatch(s,e){return h.fromPromise(this.__deleteMessageBatch(s,e))}async __deleteMessageBatch(s,e){let{subscriptionGid:t,...r}=s,o=await(this._options.fetcher??y)({url:Fp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}/messages/batch-delete`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/messages/batch-delete.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}changeMessageVisibilityBatch(s,e){return h.fromPromise(this.__changeMessageVisibilityBatch(s,e))}async __changeMessageVisibilityBatch(s,e){let{subscriptionGid:t,...r}=s,o=await(this._options.fetcher??y)({url:Fp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}/messages/batch-visibility`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/messages/batch-visibility.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import jp from"url-join";var Do=class{static{v(this,"QueueQueries")}_options;constructor(s){this._options=s}getQueueInfo(s,e){return h.fromPromise(this.__getQueueInfo(s,e))}async __getQueueInfo(s,e){let{subscriptionGid:t}=s,r=await(this._options.fetcher??y)({url:jp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}/queue`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/subscriptions/{subscriptionGid}/queue.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listMessages(s,e){return h.fromPromise(this.__listMessages(s,e))}async __listMessages(s,e){let{subscriptionGid:t,limit:r}=s,o={};r!=null&&(o.limit=r.toString());let n=await(this._options.fetcher??y)({url:jp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}/queue/messages`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/subscriptions/{subscriptionGid}/queue/messages.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Dp from"url-join";var Lo=class{static{v(this,"QueueAdmin")}_options;constructor(s){this._options=s}updateQueueConfig(s,e){return h.fromPromise(this.__updateQueueConfig(s,e))}async __updateQueueConfig(s,e){let{subscriptionGid:t,...r}=s,o=await(this._options.fetcher??y)({url:Dp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}/queue/config`),method:"PATCH",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PATCH /v1/subscriptions/{subscriptionGid}/queue/config.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}purgeQueue(s,e){return h.fromPromise(this.__purgeQueue(s,e))}async __purgeQueue(s,e){let{subscriptionGid:t}=s,r=await(this._options.fetcher??y)({url:Dp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/subscriptions/${encodeURIComponent(t)}/queue/purge`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/queue/purge.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import rr from"url-join";var Wo=class{static{v(this,"SystemEvents")}_options;constructor(s){this._options=s}listCatalog(s){return h.fromPromise(this.__listCatalog(s))}async __listCatalog(s){let e=await(this._options.fetcher??y)({url:rr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/system-events/catalog"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/system-events/catalog.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}subscribe(s,e){return h.fromPromise(this.__subscribe(s,e))}async __subscribe(s,e){let t=await(this._options.fetcher??y)({url:rr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/system-events/subscriptions"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/system-events/subscriptions.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}unsubscribe(s,e){return h.fromPromise(this.__unsubscribe(s,e))}async __unsubscribe(s,e){let{subscriptionGid:t}=s,r=await(this._options.fetcher??y)({url:rr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/system-events/subscriptions/${encodeURIComponent(t)}`),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/system-events/subscriptions/{subscriptionGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listDeliveries(s,e){return h.fromPromise(this.__listDeliveries(s,e))}async __listDeliveries(s,e){let{subscriptionGid:t,limit:r}=s,o={};r!=null&&(o.limit=r.toString());let n=await(this._options.fetcher??y)({url:rr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/system-events/subscriptions/${encodeURIComponent(t)}/deliveries`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/system-events/subscriptions/{subscriptionGid}/deliveries.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}rotateSecret(s,e){return h.fromPromise(this.__rotateSecret(s,e))}async __rotateSecret(s,e){let{subscriptionGid:t}=s,r=await(this._options.fetcher??y)({url:rr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/system-events/subscriptions/${encodeURIComponent(t)}/rotate`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/system-events/subscriptions/{subscriptionGid}/rotate.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};var Oo=class{static{v(this,"Events")}_options;_adapters;_channels;_deliveries;_dlq;_appDpopKeys;_catalogue;_messages;_subscriptions;_tieredStorage;_consumerGroups;_scheduling;_snapshots;_timeTravel;_archiveReplay;_observability;_channelDetail;_receipts;_security;_consume;_streams;_deliveryReceipts;_stats;_exactlyOnce;_exchanges;_transactional;_kvStore;_sources;_queues;_queueBatch;_queueQueries;_queueAdmin;_systemEvents;constructor(s){this._options=s}get adapters(){return this._adapters??=new co(this._options)}get channels(){return this._channels??=new wo(this._options)}get deliveries(){return this._deliveries??=new lo(this._options)}get dlq(){return this._dlq??=new mo(this._options)}get appDpopKeys(){return this._appDpopKeys??=new ho(this._options)}get catalogue(){return this._catalogue??=new yo(this._options)}get messages(){return this._messages??=new Ro(this._options)}get subscriptions(){return this._subscriptions??=new Po(this._options)}get tieredStorage(){return this._tieredStorage??=new go(this._options)}get consumerGroups(){return this._consumerGroups??=new bo(this._options)}get scheduling(){return this._scheduling??=new No(this._options)}get snapshots(){return this._snapshots??=new fo(this._options)}get timeTravel(){return this._timeTravel??=new So(this._options)}get archiveReplay(){return this._archiveReplay??=new _o(this._options)}get observability(){return this._observability??=new ko(this._options)}get channelDetail(){return this._channelDetail??=new To(this._options)}get receipts(){return this._receipts??=new Co(this._options)}get security(){return this._security??=new xo(this._options)}get consume(){return this._consume??=new Ao(this._options)}get streams(){return this._streams??=new Io(this._options)}get deliveryReceipts(){return this._deliveryReceipts??=new Go(this._options)}get stats(){return this._stats??=new Mo(this._options)}get exactlyOnce(){return this._exactlyOnce??=new Ho(this._options)}get exchanges(){return this._exchanges??=new qo(this._options)}get transactional(){return this._transactional??=new Bo(this._options)}get kvStore(){return this._kvStore??=new Uo(this._options)}get sources(){return this._sources??=new zo(this._options)}get queues(){return this._queues??=new Fo(this._options)}get queueBatch(){return this._queueBatch??=new jo(this._options)}get queueQueries(){return this._queueQueries??=new Do(this._options)}get queueAdmin(){return this._queueAdmin??=new Lo(this._options)}get systemEvents(){return this._systemEvents??=new Wo(this._options)}};import Lp from"url-join";var $o=class{static{v(this,"Customers")}_options;constructor(s){this._options=s}list(s={},e){return h.fromPromise(this.__list(s,e))}async __list(s={},e){let{listingGid:t,status:r,cursor:o,limit:n}=s,d={};t!=null&&(d.listingGid=t),r!=null&&(d.status=r),o!=null&&(d.cursor=o),n!=null&&(d.limit=n.toString());let b=await(this._options.fetcher??y)({url:Lp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/feeds/customers"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:d,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(b.ok)return{data:b.body,rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new u(b.error.body,b.rawResponse);case 401:throw new c(b.error.body,b.rawResponse);case 403:throw new w(b.error.body,b.rawResponse);case 404:throw new l(b.error.body,b.rawResponse);case 429:throw new m(b.error.body,b.rawResponse);default:throw new a({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}switch(b.error.reason){case"non-json":throw new a({statusCode:b.error.statusCode,body:b.error.rawBody,rawResponse:b.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/customers.");case"unknown":throw new a({message:b.error.errorMessage,rawResponse:b.rawResponse})}}retrieve(s,e){return h.fromPromise(this.__retrieve(s,e))}async __retrieve(s,e){let{subscriptionGid:t}=s,r=await(this._options.fetcher??y)({url:Lp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/customers/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/customers/{subscriptionGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import M from"url-join";var Ko=class{static{v(this,"Listings")}_options;constructor(s){this._options=s}enrichment(s){return h.fromPromise(this.__enrichment(s))}async __enrichment(s){let e=await(this._options.fetcher??y)({url:M(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/feeds/enrichment/listings"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/enrichment/listings.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}promise(s,e){return h.fromPromise(this.__promise(s,e))}async __promise(s,e){let{listingGid:t,at:r}=s,o={};r!=null&&(o.at=r.toString());let n=await(this._options.fetcher??y)({url:M(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/listings/${encodeURIComponent(t)}/promise`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/listings/{listingGid}/promise.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}declarePromise(s,e){return h.fromPromise(this.__declarePromise(s,e))}async __declarePromise(s,e){let{listingGid:t,...r}=s,o=await(this._options.fetcher??y)({url:M(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/listings/${encodeURIComponent(t)}/promise`),method:"PUT",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PUT /v1/feeds/listings/{listingGid}/promise.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}get(s,e){return h.fromPromise(this.__get(s,e))}async __get(s,e){let{listingGid:t}=s,r=await(this._options.fetcher??y)({url:M(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/mirror/listings/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/mirror/listings/{listingGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listEligibleListingChannelApps(s){return h.fromPromise(this.__listEligibleListingChannelApps(s))}async __listEligibleListingChannelApps(s){let e=await(this._options.fetcher??y)({url:M(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/feeds/listing-eligible-apps"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/listing-eligible-apps.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}listPublished(s={},e){return h.fromPromise(this.__listPublished(s,e))}async __listPublished(s={},e){let{limit:t,cursor:r,domain:o,category:n,priceTier:d,query:b,environment:f}=s,E={};t!=null&&(E.limit=t.toString()),r!=null&&(E.cursor=r),o!=null&&(E.domain=o),n!=null&&(E.category=n),d!=null&&(E.priceTier=d),b!=null&&(E.query=b),f!=null&&(E.environment=f);let C=await(this._options.fetcher??y)({url:M(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/feeds/listings"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:E,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(C.ok)return{data:C.body,rawResponse:C.rawResponse};if(C.error.reason==="status-code")switch(C.error.statusCode){case 400:throw new u(C.error.body,C.rawResponse);case 401:throw new c(C.error.body,C.rawResponse);case 403:throw new w(C.error.body,C.rawResponse);case 404:throw new l(C.error.body,C.rawResponse);case 429:throw new m(C.error.body,C.rawResponse);default:throw new a({statusCode:C.error.statusCode,body:C.error.body,rawResponse:C.rawResponse})}switch(C.error.reason){case"non-json":throw new a({statusCode:C.error.statusCode,body:C.error.rawBody,rawResponse:C.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/listings.");case"unknown":throw new a({message:C.error.errorMessage,rawResponse:C.rawResponse})}}create(s,e){return h.fromPromise(this.__create(s,e))}async __create(s,e){let t=await(this._options.fetcher??y)({url:M(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/feeds/listings"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/feeds/listings.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}getByGid(s,e){return h.fromPromise(this.__getByGid(s,e))}async __getByGid(s,e){let{gid:t}=s,r=await(this._options.fetcher??y)({url:M(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/listings/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/listings/{gid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(s,e){return h.fromPromise(this.__update(s,e))}async __update(s,e){let{listingGid:t,...r}=s,o=await(this._options.fetcher??y)({url:M(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/listings/${encodeURIComponent(t)}`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/feeds/listings/{listingGid}.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}archive(s,e){return h.fromPromise(this.__archive(s,e))}async __archive(s,e){let{listingGid:t}=s,r=await(this._options.fetcher??y)({url:M(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/listings/${encodeURIComponent(t)}`),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/feeds/listings/{listingGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updatePricing(s,e){return h.fromPromise(this.__updatePricing(s,e))}async __updatePricing(s,e){let{listingGid:t,...r}=s,o=await(this._options.fetcher??y)({url:M(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/listings/${encodeURIComponent(t)}/pricing`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/feeds/listings/{listingGid}/pricing.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}publish(s,e){return h.fromPromise(this.__publish(s,e))}async __publish(s,e){let{listingGid:t,"Idempotency-Key":r}=s,o=await(this._options.fetcher??y)({url:M(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/listings/${encodeURIComponent(t)}/publish`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/feeds/listings/{listingGid}/publish.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}submitForReview(s,e){return h.fromPromise(this.__submitForReview(s,e))}async __submitForReview(s,e){let{listingGid:t,"Idempotency-Key":r,...o}=s,n=await(this._options.fetcher??y)({url:M(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/listings/${encodeURIComponent(t)}/submit`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/feeds/listings/{listingGid}/submit.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}unpublish(s,e){return h.fromPromise(this.__unpublish(s,e))}async __unpublish(s,e){let{listingGid:t}=s,r=await(this._options.fetcher??y)({url:M(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/listings/${encodeURIComponent(t)}/unpublish`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/feeds/listings/{listingGid}/unpublish.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}withdrawSubmission(s,e){return h.fromPromise(this.__withdrawSubmission(s,e))}async __withdrawSubmission(s,e){let{listingGid:t}=s,r=await(this._options.fetcher??y)({url:M(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/listings/${encodeURIComponent(t)}/withdraw`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/feeds/listings/{listingGid}/withdraw.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}generateUploadUrl(s){return h.fromPromise(this.__generateUploadUrl(s))}async __generateUploadUrl(s){let e=await(this._options.fetcher??y)({url:M(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/feeds/listings/upload-url"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/feeds/listings/upload-url.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}canCreateListing(s){return h.fromPromise(this.__canCreateListing(s))}async __canCreateListing(s){let e=await(this._options.fetcher??y)({url:M(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/feeds/publisher-eligibility"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/publisher-eligibility.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}listByPublisherWire(s,e){return h.fromPromise(this.__listByPublisherWire(s,e))}async __listByPublisherWire(s,e){let{publisherGid:t,limit:r,cursor:o}=s,n={};r!=null&&(n.limit=r.toString()),o!=null&&(n.cursor=o);let d=await(this._options.fetcher??y)({url:M(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/publishers/${encodeURIComponent(t)}/listings`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/publishers/{publisherGid}/listings.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}getBySlug(s,e){return h.fromPromise(this.__getBySlug(s,e))}async __getBySlug(s,e){let{publisherSlug:t,listingSlug:r}=s,o=await(this._options.fetcher??y)({url:M(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/publishers/${encodeURIComponent(t)}/listings/${encodeURIComponent(r)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/publishers/{publisherSlug}/listings/{listingSlug}.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}resolveByRef(s,e){return h.fromPromise(this.__resolveByRef(s,e))}async __resolveByRef(s,e){let{publisherSlug:t,listingSlug:r}=s,o=await(this._options.fetcher??y)({url:M(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/resolve/${encodeURIComponent(t)}/${encodeURIComponent(r)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/resolve/{publisherSlug}/{listingSlug}.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Y from"url-join";var Jo=class{static{v(this,"Subscriptions")}_options;constructor(s){this._options=s}getEnrichmentForSubscriber(s={},e){return h.fromPromise(this.__getEnrichmentForSubscriber(s,e))}async __getEnrichmentForSubscriber(s={},e){let{subscriberOrgId:t}=s,r={};t!=null&&(r.subscriberOrgId=t);let o=await(this._options.fetcher??y)({url:Y(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/feeds/enrichment/subscriptions"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/enrichment/subscriptions.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getTrialStatus(s,e){return h.fromPromise(this.__getTrialStatus(s,e))}async __getTrialStatus(s,e){let{subscriptionGid:t}=s,r=await(this._options.fetcher??y)({url:Y(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/subscriptions/${encodeURIComponent(t)}/trial`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/subscriptions/{subscriptionGid}/trial.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}subscribe(s,e){return h.fromPromise(this.__subscribe(s,e))}async __subscribe(s,e){let{listingGid:t,...r}=s,o=await(this._options.fetcher??y)({url:Y(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/listings/${encodeURIComponent(t)}/subscribe`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/feeds/listings/{listingGid}/subscribe.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}countByPublisher(s,e){return h.fromPromise(this.__countByPublisher(s,e))}async __countByPublisher(s,e){let{publisherGid:t}=s,r=await(this._options.fetcher??y)({url:Y(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/publishers/${encodeURIComponent(t)}/subscriber-count`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/publishers/{publisherGid}/subscriber-count.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listBySubscriber(s={},e){return h.fromPromise(this.__listBySubscriber(s,e))}async __listBySubscriber(s={},e){let{status:t}=s,r={};t!=null&&(r.status=t);let o=await(this._options.fetcher??y)({url:Y(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/feeds/subscriptions"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/subscriptions.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getByGid(s,e){return h.fromPromise(this.__getByGid(s,e))}async __getByGid(s,e){let{gid:t}=s,r=await(this._options.fetcher??y)({url:Y(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/subscriptions/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/subscriptions/{gid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}cancel(s,e){return h.fromPromise(this.__cancel(s,e))}async __cancel(s,e){let{gid:t,reason:r}=s,o={};r!=null&&(o.reason=r);let n=await(this._options.fetcher??y)({url:Y(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/subscriptions/${encodeURIComponent(t)}`),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/feeds/subscriptions/{gid}.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}convertTrialToPaid(s,e){return h.fromPromise(this.__convertTrialToPaid(s,e))}async __convertTrialToPaid(s,e){let{gid:t,...r}=s,o=await(this._options.fetcher??y)({url:Y(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/subscriptions/${encodeURIComponent(t)}/convert-to-paid`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/feeds/subscriptions/{gid}/convert-to-paid.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}pause(s,e){return h.fromPromise(this.__pause(s,e))}async __pause(s,e){let{gid:t}=s,r=await(this._options.fetcher??y)({url:Y(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/subscriptions/${encodeURIComponent(t)}/pause`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/feeds/subscriptions/{gid}/pause.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}resume(s,e){return h.fromPromise(this.__resume(s,e))}async __resume(s,e){let{gid:t}=s,r=await(this._options.fetcher??y)({url:Y(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/subscriptions/${encodeURIComponent(t)}/resume`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/feeds/subscriptions/{gid}/resume.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listBySubscriberEnriched(s){return h.fromPromise(this.__listBySubscriberEnriched(s))}async __listBySubscriberEnriched(s){let e=await(this._options.fetcher??y)({url:Y(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/feeds/subscriptions/enriched"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/subscriptions/enriched.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Be from"url-join";var Qo=class{static{v(this,"Reviews")}_options;constructor(s){this._options=s}listByListing(s,e){return h.fromPromise(this.__listByListing(s,e))}async __listByListing(s,e){let{listingGid:t,limit:r}=s,o={};r!=null&&(o.limit=r.toString());let n=await(this._options.fetcher??y)({url:Be(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/listings/${encodeURIComponent(t)}/reviews`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/listings/{listingGid}/reviews.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getListingStatsBatch(s,e){return h.fromPromise(this.__getListingStatsBatch(s,e))}async __getListingStatsBatch(s,e){let t=await(this._options.fetcher??y)({url:Be(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/feeds/listings/review-stats"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/feeds/listings/review-stats.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}get(s,e){return h.fromPromise(this.__get(s,e))}async __get(s,e){let{reviewGid:t}=s,r=await(this._options.fetcher??y)({url:Be(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/reviews/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/reviews/{reviewGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}flagReview(s,e){return h.fromPromise(this.__flagReview(s,e))}async __flagReview(s,e){let{reviewGid:t,...r}=s,o=await(this._options.fetcher??y)({url:Be(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/reviews/${encodeURIComponent(t)}/flag`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/feeds/reviews/{reviewGid}/flag.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}respondToReview(s,e){return h.fromPromise(this.__respondToReview(s,e))}async __respondToReview(s,e){let{reviewGid:t,...r}=s,o=await(this._options.fetcher??y)({url:Be(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/reviews/${encodeURIComponent(t)}/respond`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/feeds/reviews/{reviewGid}/respond.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}create(s,e){return h.fromPromise(this.__create(s,e))}async __create(s,e){let{feedSubscriptionGid:t,...r}=s,o=await(this._options.fetcher??y)({url:Be(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/subscriptions/${encodeURIComponent(t)}/reviews`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/feeds/subscriptions/{feedSubscriptionGid}/reviews.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import he from"url-join";var Vo=class{static{v(this,"Publishers")}_options;constructor(s){this._options=s}get(s,e){return h.fromPromise(this.__get(s,e))}async __get(s,e){let{publisherGid:t}=s,r=await(this._options.fetcher??y)({url:he(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/mirror/publishers/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/mirror/publishers/{publisherGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listVerified(s={},e){return h.fromPromise(this.__listVerified(s,e))}async __listVerified(s={},e){let{limit:t}=s,r={};t!=null&&(r.limit=t.toString());let o=await(this._options.fetcher??y)({url:he(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/feeds/publishers"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/publishers.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}register(s,e){return h.fromPromise(this.__register(s,e))}async __register(s,e){let t=await(this._options.fetcher??y)({url:he(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/feeds/publishers"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/feeds/publishers.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}getByGid(s,e){return h.fromPromise(this.__getByGid(s,e))}async __getByGid(s,e){let{gid:t}=s,r=await(this._options.fetcher??y)({url:he(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/publishers/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/publishers/{gid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(s,e){return h.fromPromise(this.__update(s,e))}async __update(s,e){let{publisherGid:t,...r}=s,o=await(this._options.fetcher??y)({url:he(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/publishers/${encodeURIComponent(t)}`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/feeds/publishers/{publisherGid}.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}revokePublisher(s,e){return h.fromPromise(this.__revokePublisher(s,e))}async __revokePublisher(s,e){let{publisherGid:t,...r}=s,o=await(this._options.fetcher??y)({url:he(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/publishers/${encodeURIComponent(t)}/revoke`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/feeds/publishers/{publisherGid}/revoke.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getBySlug(s,e){return h.fromPromise(this.__getBySlug(s,e))}async __getBySlug(s,e){let{slug:t}=s,r=await(this._options.fetcher??y)({url:he(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/publishers/by-slug/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/publishers/by-slug/{slug}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getMine(s){return h.fromPromise(this.__getMine(s))}async __getMine(s){let e=await(this._options.fetcher??y)({url:he(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/feeds/publishers/me"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/publishers/me.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import hc from"url-join";var Yo=class{static{v(this,"PublisherReputation")}_options;constructor(s){this._options=s}getOwnReputation(s){return h.fromPromise(this.__getOwnReputation(s))}async __getOwnReputation(s){let e=await(this._options.fetcher??y)({url:hc(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/feeds/reputation/me"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/reputation/me.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import yc from"url-join";var Xo=class{static{v(this,"FeedDeliveryBindings")}_options;constructor(s){this._options=s}listBindings(s,e){return h.fromPromise(this.__listBindings(s,e))}async __listBindings(s,e){let{feedSubscriptionGid:t}=s,r=await(this._options.fetcher??y)({url:yc(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/feeds/subscriptions/${encodeURIComponent(t)}/bindings`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/feeds/subscriptions/{feedSubscriptionGid}/bindings.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};var Zo=class{static{v(this,"Feed")}_options;_customers;_listings;_subscriptions;_reviews;_publishers;_publisherReputation;_feedDeliveryBindings;constructor(s){this._options=s}get customers(){return this._customers??=new $o(this._options)}get listings(){return this._listings??=new Ko(this._options)}get subscriptions(){return this._subscriptions??=new Jo(this._options)}get reviews(){return this._reviews??=new Qo(this._options)}get publishers(){return this._publishers??=new Vo(this._options)}get publisherReputation(){return this._publisherReputation??=new Yo(this._options)}get feedDeliveryBindings(){return this._feedDeliveryBindings??=new Xo(this._options)}};import Rc from"url-join";var es=class{static{v(this,"Dispatches")}_options;constructor(s){this._options=s}list(s,e){return h.fromPromise(this.__list(s,e))}async __list(s,e){let{appId:t,status:r,cursor:o,limit:n}=s,d={};d.appId=t,r!=null&&(d.status=r),o!==void 0&&(d.cursor=o),n!=null&&(d.limit=n.toString());let b=await(this._options.fetcher??y)({url:Rc(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/notifications/dispatches"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:d,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(b.ok)return{data:b.body,rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new u(b.error.body,b.rawResponse);case 401:throw new c(b.error.body,b.rawResponse);case 403:throw new w(b.error.body,b.rawResponse);case 404:throw new l(b.error.body,b.rawResponse);case 429:throw new m(b.error.body,b.rawResponse);default:throw new a({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}switch(b.error.reason){case"non-json":throw new a({statusCode:b.error.statusCode,body:b.error.rawBody,rawResponse:b.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/notifications/dispatches.");case"unknown":throw new a({message:b.error.errorMessage,rawResponse:b.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import rs from"url-join";var os=class{static{v(this,"Inbox")}_options;constructor(s){this._options=s}list(s,e){return h.fromPromise(this.__list(s,e))}async __list(s,e){let{appId:t,user:r,status:o,cursor:n,limit:d}=s,b={};b.appId=t,b.user=r,o!=null&&(b.status=o),n!==void 0&&(b.cursor=n),d!=null&&(b.limit=d.toString());let f=await(this._options.fetcher??y)({url:rs(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/notifications/inbox"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:b,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(f.ok)return{data:f.body,rawResponse:f.rawResponse};if(f.error.reason==="status-code")switch(f.error.statusCode){case 400:throw new u(f.error.body,f.rawResponse);case 401:throw new c(f.error.body,f.rawResponse);case 403:throw new w(f.error.body,f.rawResponse);case 404:throw new l(f.error.body,f.rawResponse);case 429:throw new m(f.error.body,f.rawResponse);default:throw new a({statusCode:f.error.statusCode,body:f.error.body,rawResponse:f.rawResponse})}switch(f.error.reason){case"non-json":throw new a({statusCode:f.error.statusCode,body:f.error.rawBody,rawResponse:f.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/notifications/inbox.");case"unknown":throw new a({message:f.error.errorMessage,rawResponse:f.rawResponse})}}archive(s,e){return h.fromPromise(this.__archive(s,e))}async __archive(s,e){let{gid:t,"Idempotency-Key":r,...o}=s,n=await(this._options.fetcher??y)({url:rs(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/notifications/inbox/${encodeURIComponent(t)}/archive`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/notifications/inbox/{gid}/archive.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}markRead(s,e){return h.fromPromise(this.__markRead(s,e))}async __markRead(s,e){let{gid:t,"Idempotency-Key":r,...o}=s,n=await(this._options.fetcher??y)({url:rs(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/notifications/inbox/${encodeURIComponent(t)}/mark-read`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/notifications/inbox/{gid}/mark-read.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}markAllRead(s,e){return h.fromPromise(this.__markAllRead(s,e))}async __markAllRead(s,e){let{"Idempotency-Key":t,...r}=s,o=await(this._options.fetcher??y)({url:rs(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/notifications/inbox/mark-all-read"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":t??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/notifications/inbox/mark-all-read.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Ue from"url-join";var ss=class{static{v(this,"Preferences")}_options;constructor(s){this._options=s}list(s,e){return h.fromPromise(this.__list(s,e))}async __list(s,e){let{appId:t,user:r}=s,o={};o.appId=t,o.user=r;let n=await(this._options.fetcher??y)({url:Ue(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/notifications/preferences"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/notifications/preferences.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}upsert(s,e){return h.fromPromise(this.__upsert(s,e))}async __upsert(s,e){let{"Idempotency-Key":t,...r}=s,o=await(this._options.fetcher??y)({url:Ue(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/notifications/preferences"),method:"PUT",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":t??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PUT /v1/notifications/preferences.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}clear(s,e){return h.fromPromise(this.__clear(s,e))}async __clear(s,e){let{appId:t,user:r,typeSlug:o,channel:n,"Idempotency-Key":d}=s,b={};b.appId=t,b.user=r,o!=null&&(b.typeSlug=o),n!=null&&(b.channel=n);let f=await(this._options.fetcher??y)({url:Ue(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/notifications/preferences"),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":d??void 0}),e?.headers),queryParameters:b,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(f.ok)return{data:f.body,rawResponse:f.rawResponse};if(f.error.reason==="status-code")switch(f.error.statusCode){case 400:throw new u(f.error.body,f.rawResponse);case 401:throw new c(f.error.body,f.rawResponse);case 403:throw new w(f.error.body,f.rawResponse);case 404:throw new l(f.error.body,f.rawResponse);case 429:throw new m(f.error.body,f.rawResponse);default:throw new a({statusCode:f.error.statusCode,body:f.error.body,rawResponse:f.rawResponse})}switch(f.error.reason){case"non-json":throw new a({statusCode:f.error.statusCode,body:f.error.rawBody,rawResponse:f.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/notifications/preferences.");case"unknown":throw new a({message:f.error.errorMessage,rawResponse:f.rawResponse})}}setDigestCadence(s,e){return h.fromPromise(this.__setDigestCadence(s,e))}async __setDigestCadence(s,e){let{"Idempotency-Key":t,...r}=s,o=await(this._options.fetcher??y)({url:Ue(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/notifications/preferences/digest"),method:"PUT",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":t??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PUT /v1/notifications/preferences/digest.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}setGlobalMute(s,e){return h.fromPromise(this.__setGlobalMute(s,e))}async __setGlobalMute(s,e){let{"Idempotency-Key":t,...r}=s,o=await(this._options.fetcher??y)({url:Ue(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/notifications/preferences/global-mute"),method:"PUT",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":t??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PUT /v1/notifications/preferences/global-mute.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}setQuietHours(s,e){return h.fromPromise(this.__setQuietHours(s,e))}async __setQuietHours(s,e){let{"Idempotency-Key":t,...r}=s,o=await(this._options.fetcher??y)({url:Ue(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/notifications/preferences/quiet-hours"),method:"PUT",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":t??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PUT /v1/notifications/preferences/quiet-hours.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Pc from"url-join";var ts=class{static{v(this,"Summary")}_options;constructor(s){this._options=s}get(s,e){return h.fromPromise(this.__get(s,e))}async __get(s,e){let{appId:t,user:r}=s,o={};o.appId=t,o.user=r;let n=await(this._options.fetcher??y)({url:Pc(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/notifications/summary"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/notifications/summary.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Ne from"url-join";var ns=class{static{v(this,"Templates")}_options;constructor(s){this._options=s}list(s,e){return h.fromPromise(this.__list(s,e))}async __list(s,e){let{appId:t,typeSlug:r,includeRetired:o,limit:n}=s,d={};d.appId=t,r!=null&&(d.typeSlug=r),o!=null&&(d.includeRetired=o.toString()),n!=null&&(d.limit=n.toString());let b=await(this._options.fetcher??y)({url:Ne(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/notifications/templates"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:d,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(b.ok)return{data:b.body,rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new u(b.error.body,b.rawResponse);case 401:throw new c(b.error.body,b.rawResponse);case 403:throw new w(b.error.body,b.rawResponse);case 404:throw new l(b.error.body,b.rawResponse);case 429:throw new m(b.error.body,b.rawResponse);default:throw new a({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}switch(b.error.reason){case"non-json":throw new a({statusCode:b.error.statusCode,body:b.error.rawBody,rawResponse:b.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/notifications/templates.");case"unknown":throw new a({message:b.error.errorMessage,rawResponse:b.rawResponse})}}create(s,e){return h.fromPromise(this.__create(s,e))}async __create(s,e){let{"Idempotency-Key":t,...r}=s,o=await(this._options.fetcher??y)({url:Ne(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/notifications/templates"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":t??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/notifications/templates.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}get(s,e){return h.fromPromise(this.__get(s,e))}async __get(s,e){let{gid:t,appId:r}=s,o={};o.appId=r;let n=await(this._options.fetcher??y)({url:Ne(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/notifications/templates/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/notifications/templates/{gid}.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}update(s,e){return h.fromPromise(this.__update(s,e))}async __update(s,e){let{gid:t,"Idempotency-Key":r,...o}=s,n=await(this._options.fetcher??y)({url:Ne(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/notifications/templates/${encodeURIComponent(t)}`),method:"PATCH",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PATCH /v1/notifications/templates/{gid}.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}retire(s,e){return h.fromPromise(this.__retire(s,e))}async __retire(s,e){let{gid:t,"Idempotency-Key":r,...o}=s,n=await(this._options.fetcher??y)({url:Ne(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/notifications/templates/${encodeURIComponent(t)}/retire`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/notifications/templates/{gid}/retire.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}sendTest(s,e){return h.fromPromise(this.__sendTest(s,e))}async __sendTest(s,e){let{gid:t,"Idempotency-Key":r,...o}=s,n=await(this._options.fetcher??y)({url:Ne(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/notifications/templates/${encodeURIComponent(t)}/test-send`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/notifications/templates/{gid}/test-send.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}preview(s,e){return h.fromPromise(this.__preview(s,e))}async __preview(s,e){let{"Idempotency-Key":t,...r}=s,o=await(this._options.fetcher??y)({url:Ne(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/notifications/templates/preview"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":t??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/notifications/templates/preview.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Wp from"url-join";var as=class{static{v(this,"Types")}_options;constructor(s){this._options=s}list(s,e){return h.fromPromise(this.__list(s,e))}async __list(s,e){let{appId:t,limit:r}=s,o={};o.appId=t,r!=null&&(o.limit=r.toString());let n=await(this._options.fetcher??y)({url:Wp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/notifications/types"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/notifications/types.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}get(s,e){return h.fromPromise(this.__get(s,e))}async __get(s,e){let{typeSlug:t,appId:r,version:o}=s,n={};n.appId=r,o!=null&&(n.version=o.toString());let d=await(this._options.fetcher??y)({url:Wp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/notifications/types/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/notifications/types/{typeSlug}.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};var is=class{static{v(this,"Notify")}_options;_dispatches;_inbox;_preferences;_summary;_templates;_types;constructor(s){this._options=s}get dispatches(){return this._dispatches??=new es(this._options)}get inbox(){return this._inbox??=new os(this._options)}get preferences(){return this._preferences??=new ss(this._options)}get summary(){return this._summary??=new ts(this._options)}get templates(){return this._templates??=new ns(this._options)}get types(){return this._types??=new as(this._options)}};import Op from"url-join";var ds=class{static{v(this,"AgentExecutions")}_options;constructor(s){this._options=s}listAgentExecutions(s={},e){return h.fromPromise(this.__listAgentExecutions(s,e))}async __listAgentExecutions(s={},e){let{workflowGid:t,limit:r,cursor:o}=s,n={};t!=null&&(n.workflowGid=t),r!=null&&(n.limit=r.toString()),o!=null&&(n.cursor=o);let d=await(this._options.fetcher??y)({url:Op(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/pipes/agent-executions"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/agent-executions.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}getAgentExecution(s,e){return h.fromPromise(this.__getAgentExecution(s,e))}async __getAgentExecution(s,e){let{agentExecutionGid:t}=s,r=await(this._options.fetcher??y)({url:Op(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/agent-executions/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/agent-executions/{agentExecutionGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import $p from"url-join";var ps=class{static{v(this,"Analyses")}_options;constructor(s){this._options=s}listAnalyses(s={},e){return h.fromPromise(this.__listAnalyses(s,e))}async __listAnalyses(s={},e){let{workflowGid:t,limit:r,cursor:o}=s,n={};t!=null&&(n.workflowGid=t),r!=null&&(n.limit=r.toString()),o!=null&&(n.cursor=o);let d=await(this._options.fetcher??y)({url:$p(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/pipes/analyses"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/analyses.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}getAnalysis(s,e){return h.fromPromise(this.__getAnalysis(s,e))}async __getAnalysis(s,e){let{analysisGid:t}=s,r=await(this._options.fetcher??y)({url:$p(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/analyses/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/analyses/{analysisGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import X from"url-join";var us=class{static{v(this,"Workflows")}_options;constructor(s){this._options=s}listConnectors(s={},e){return h.fromPromise(this.__listConnectors(s,e))}async __listConnectors(s={},e){let{limit:t,cursor:r}=s,o={};t!=null&&(o.limit=t.toString()),r!=null&&(o.cursor=r);let n=await(this._options.fetcher??y)({url:X(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/pipes/connectors"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/connectors.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}listWorkflows(s={},e){return h.fromPromise(this.__listWorkflows(s,e))}async __listWorkflows(s={},e){let{limit:t,cursor:r}=s,o={};t!=null&&(o.limit=t.toString()),r!=null&&(o.cursor=r);let n=await(this._options.fetcher??y)({url:X(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/pipes/workflows"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/workflows.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}createWorkflow(s,e){return h.fromPromise(this.__createWorkflow(s,e))}async __createWorkflow(s,e){let t=await(this._options.fetcher??y)({url:X(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/pipes/workflows"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/pipes/workflows.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}getWorkflow(s,e){return h.fromPromise(this.__getWorkflow(s,e))}async __getWorkflow(s,e){let{workflowGid:t}=s,r=await(this._options.fetcher??y)({url:X(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/workflows/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/workflows/{workflowGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteWorkflow(s,e){return h.fromPromise(this.__deleteWorkflow(s,e))}async __deleteWorkflow(s,e){let{workflowGid:t}=s,r=await(this._options.fetcher??y)({url:X(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/workflows/${encodeURIComponent(t)}`),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/pipes/workflows/{workflowGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateWorkflow(s,e){return h.fromPromise(this.__updateWorkflow(s,e))}async __updateWorkflow(s,e){let{workflowGid:t,...r}=s,o=await(this._options.fetcher??y)({url:X(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/workflows/${encodeURIComponent(t)}`),method:"PATCH",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PATCH /v1/pipes/workflows/{workflowGid}.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}activateWorkflow(s,e){return h.fromPromise(this.__activateWorkflow(s,e))}async __activateWorkflow(s,e){let{workflowGid:t}=s,r=await(this._options.fetcher??y)({url:X(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/workflows/${encodeURIComponent(t)}/activate`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/pipes/workflows/{workflowGid}/activate.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}archiveWorkflow(s,e){return h.fromPromise(this.__archiveWorkflow(s,e))}async __archiveWorkflow(s,e){let{workflowGid:t}=s,r=await(this._options.fetcher??y)({url:X(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/workflows/${encodeURIComponent(t)}/archive`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/pipes/workflows/{workflowGid}/archive.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateWorkflowMeta(s,e){return h.fromPromise(this.__updateWorkflowMeta(s,e))}async __updateWorkflowMeta(s,e){let{workflowGid:t,...r}=s,o=await(this._options.fetcher??y)({url:X(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/workflows/${encodeURIComponent(t)}/meta`),method:"PATCH",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PATCH /v1/pipes/workflows/{workflowGid}/meta.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}pauseWorkflow(s,e){return h.fromPromise(this.__pauseWorkflow(s,e))}async __pauseWorkflow(s,e){let{workflowGid:t}=s,r=await(this._options.fetcher??y)({url:X(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/workflows/${encodeURIComponent(t)}/pause`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/pipes/workflows/{workflowGid}/pause.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateWorkflowTriggerConfig(s,e){return h.fromPromise(this.__updateWorkflowTriggerConfig(s,e))}async __updateWorkflowTriggerConfig(s,e){let{workflowGid:t,...r}=s,o=await(this._options.fetcher??y)({url:X(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/workflows/${encodeURIComponent(t)}/trigger-config`),method:"PATCH",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PATCH /v1/pipes/workflows/{workflowGid}/trigger-config.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import ve from"url-join";var cs=class{static{v(this,"Connectors")}_options;constructor(s){this._options=s}listCredentials(s={},e){return h.fromPromise(this.__listCredentials(s,e))}async __listCredentials(s={},e){let{limit:t,cursor:r}=s,o={};t!=null&&(o.limit=t.toString()),r!=null&&(o.cursor=r);let n=await(this._options.fetcher??y)({url:ve(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/pipes/credentials"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/credentials.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}storeCredential(s,e){return h.fromPromise(this.__storeCredential(s,e))}async __storeCredential(s,e){let t=await(this._options.fetcher??y)({url:ve(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/pipes/credentials"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/pipes/credentials.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}deleteCredential(s,e){return h.fromPromise(this.__deleteCredential(s,e))}async __deleteCredential(s,e){let{credentialGid:t}=s,r=await(this._options.fetcher??y)({url:ve(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/credentials/${encodeURIComponent(t)}`),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/pipes/credentials/{credentialGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateCredential(s,e){return h.fromPromise(this.__updateCredential(s,e))}async __updateCredential(s,e){let{credentialGid:t,...r}=s,o=await(this._options.fetcher??y)({url:ve(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/credentials/${encodeURIComponent(t)}`),method:"PATCH",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PATCH /v1/pipes/credentials/{credentialGid}.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}revokeCredential(s,e){return h.fromPromise(this.__revokeCredential(s,e))}async __revokeCredential(s,e){let{credentialGid:t}=s,r=await(this._options.fetcher??y)({url:ve(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/credentials/${encodeURIComponent(t)}/revoke`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/pipes/credentials/{credentialGid}/revoke.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}rotateCredential(s,e){return h.fromPromise(this.__rotateCredential(s,e))}async __rotateCredential(s,e){let{credentialGid:t,...r}=s,o=await(this._options.fetcher??y)({url:ve(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/credentials/${encodeURIComponent(t)}/rotate`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/pipes/credentials/{credentialGid}/rotate.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}testCredentialPublic(s,e){return h.fromPromise(this.__testCredentialPublic(s,e))}async __testCredentialPublic(s,e){let t=await(this._options.fetcher??y)({url:ve(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/pipes/credentials/test"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/pipes/credentials/test.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import ws from"url-join";var ls=class{static{v(this,"Decisions")}_options;constructor(s){this._options=s}listDecisions(s={},e){return h.fromPromise(this.__listDecisions(s,e))}async __listDecisions(s={},e){let{gateState:t,workflowGid:r,limit:o,cursor:n}=s,d={};t!=null&&(d.gateState=t),r!=null&&(d.workflowGid=r),o!=null&&(d.limit=o.toString()),n!=null&&(d.cursor=n);let b=await(this._options.fetcher??y)({url:ws(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/pipes/decisions"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:d,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(b.ok)return{data:b.body,rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new u(b.error.body,b.rawResponse);case 401:throw new c(b.error.body,b.rawResponse);case 403:throw new w(b.error.body,b.rawResponse);case 404:throw new l(b.error.body,b.rawResponse);case 429:throw new m(b.error.body,b.rawResponse);default:throw new a({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}switch(b.error.reason){case"non-json":throw new a({statusCode:b.error.statusCode,body:b.error.rawBody,rawResponse:b.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/decisions.");case"unknown":throw new a({message:b.error.errorMessage,rawResponse:b.rawResponse})}}getDecision(s,e){return h.fromPromise(this.__getDecision(s,e))}async __getDecision(s,e){let{decisionGid:t}=s,r=await(this._options.fetcher??y)({url:ws(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/decisions/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/decisions/{decisionGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}approveDecision(s,e){return h.fromPromise(this.__approveDecision(s,e))}async __approveDecision(s,e){let{decisionGid:t,...r}=s,o=await(this._options.fetcher??y)({url:ws(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/decisions/${encodeURIComponent(t)}/approve`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/pipes/decisions/{decisionGid}/approve.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}rejectDecision(s,e){return h.fromPromise(this.__rejectDecision(s,e))}async __rejectDecision(s,e){let{decisionGid:t,...r}=s,o=await(this._options.fetcher??y)({url:ws(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/decisions/${encodeURIComponent(t)}/reject`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/pipes/decisions/{decisionGid}/reject.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import ms from"url-join";var hs=class{static{v(this,"Dlq")}_options;constructor(s){this._options=s}listDlqEntries(s={},e){return h.fromPromise(this.__listDlqEntries(s,e))}async __listDlqEntries(s={},e){let{status:t,limit:r,cursor:o}=s,n={};t!=null&&(n.status=t),r!=null&&(n.limit=r.toString()),o!=null&&(n.cursor=o);let d=await(this._options.fetcher??y)({url:ms(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/pipes/dlq"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/dlq.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}getDlqEntry(s,e){return h.fromPromise(this.__getDlqEntry(s,e))}async __getDlqEntry(s,e){let{dlqEntryId:t}=s,r=await(this._options.fetcher??y)({url:ms(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/dlq/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/dlq/{dlqEntryId}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}discardDlqEntry(s,e){return h.fromPromise(this.__discardDlqEntry(s,e))}async __discardDlqEntry(s,e){let{dlqEntryId:t}=s,r=await(this._options.fetcher??y)({url:ms(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/dlq/${encodeURIComponent(t)}/discard`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/pipes/dlq/{dlqEntryId}/discard.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getDlqStats(s){return h.fromPromise(this.__getDlqStats(s))}async __getDlqStats(s){let e=await(this._options.fetcher??y)({url:ms(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/pipes/dlq/stats"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/dlq/stats.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import ze from"url-join";var ys=class{static{v(this,"Executions")}_options;constructor(s){this._options=s}getExecution(s,e){return h.fromPromise(this.__getExecution(s,e))}async __getExecution(s,e){let{executionGid:t}=s,r=await(this._options.fetcher??y)({url:ze(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/executions/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/executions/{executionGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}cancelExecution(s,e){return h.fromPromise(this.__cancelExecution(s,e))}async __cancelExecution(s,e){let{executionGid:t}=s,r=await(this._options.fetcher??y)({url:ze(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/executions/${encodeURIComponent(t)}/cancel`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/pipes/executions/{executionGid}/cancel.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getExecutionStatus(s,e){return h.fromPromise(this.__getExecutionStatus(s,e))}async __getExecutionStatus(s,e){let{executionGid:t}=s,r=await(this._options.fetcher??y)({url:ze(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/executions/${encodeURIComponent(t)}/status`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/executions/{executionGid}/status.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listExecutions(s,e){return h.fromPromise(this.__listExecutions(s,e))}async __listExecutions(s,e){let{workflowGid:t,status:r,limit:o,cursor:n}=s,d={};r!=null&&(d.status=r),o!=null&&(d.limit=o.toString()),n!=null&&(d.cursor=n);let b=await(this._options.fetcher??y)({url:ze(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/workflows/${encodeURIComponent(t)}/executions`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:d,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(b.ok)return{data:b.body,rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new u(b.error.body,b.rawResponse);case 401:throw new c(b.error.body,b.rawResponse);case 403:throw new w(b.error.body,b.rawResponse);case 404:throw new l(b.error.body,b.rawResponse);case 429:throw new m(b.error.body,b.rawResponse);default:throw new a({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}switch(b.error.reason){case"non-json":throw new a({statusCode:b.error.statusCode,body:b.error.rawBody,rawResponse:b.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/workflows/{workflowGid}/executions.");case"unknown":throw new a({message:b.error.errorMessage,rawResponse:b.rawResponse})}}executeNode(s,e){return h.fromPromise(this.__executeNode(s,e))}async __executeNode(s,e){let{workflowGid:t,nodeId:r,...o}=s,n=await(this._options.fetcher??y)({url:ze(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/workflows/${encodeURIComponent(t)}/nodes/${encodeURIComponent(r)}/execute`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/pipes/workflows/{workflowGid}/nodes/{nodeId}/execute.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}triggerExecution(s,e){return h.fromPromise(this.__triggerExecution(s,e))}async __triggerExecution(s,e){let{workflowGid:t,"Idempotency-Key":r,...o}=s,n=await(this._options.fetcher??y)({url:ze(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/workflows/${encodeURIComponent(t)}/trigger`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/pipes/workflows/{workflowGid}/trigger.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import j from"url-join";var Rs=class{static{v(this,"Governance")}_options;constructor(s){this._options=s}getGovernanceSettings(s){return h.fromPromise(this.__getGovernanceSettings(s))}async __getGovernanceSettings(s){let e=await(this._options.fetcher??y)({url:j(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/pipes/governance"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/governance.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}updateGovernanceSettings(s={},e){return h.fromPromise(this.__updateGovernanceSettings(s,e))}async __updateGovernanceSettings(s={},e){let t=await(this._options.fetcher??y)({url:j(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/pipes/governance"),method:"PATCH",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PATCH /v1/pipes/governance.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}addToAllowlist(s,e){return h.fromPromise(this.__addToAllowlist(s,e))}async __addToAllowlist(s,e){let t=await(this._options.fetcher??y)({url:j(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/pipes/governance/allowlist"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/pipes/governance/allowlist.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}removeFromAllowlist(s={},e){return h.fromPromise(this.__removeFromAllowlist(s,e))}async __removeFromAllowlist(s={},e){let{connectorIds:t}=s,r={};t!=null&&(Array.isArray(t)?r.connectorIds=t.map(n=>n):r.connectorIds=t);let o=await(this._options.fetcher??y)({url:j(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/pipes/governance/allowlist"),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/pipes/governance/allowlist.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}listApprovalRequests(s={},e){return h.fromPromise(this.__listApprovalRequests(s,e))}async __listApprovalRequests(s={},e){let{status:t,limit:r,cursor:o}=s,n={};t!=null&&(n.status=t),r!=null&&(n.limit=r.toString()),o!=null&&(n.cursor=o);let d=await(this._options.fetcher??y)({url:j(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/pipes/governance/approvals"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/governance/approvals.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}requestConnectorApproval(s,e){return h.fromPromise(this.__requestConnectorApproval(s,e))}async __requestConnectorApproval(s,e){let t=await(this._options.fetcher??y)({url:j(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/pipes/governance/approvals"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/pipes/governance/approvals.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}approveConnectorRequest(s,e){return h.fromPromise(this.__approveConnectorRequest(s,e))}async __approveConnectorRequest(s,e){let{requestId:t,...r}=s,o=await(this._options.fetcher??y)({url:j(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/governance/approvals/${encodeURIComponent(t)}/approve`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/pipes/governance/approvals/{requestId}/approve.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}rejectConnectorRequest(s,e){return h.fromPromise(this.__rejectConnectorRequest(s,e))}async __rejectConnectorRequest(s,e){let{requestId:t,...r}=s,o=await(this._options.fetcher??y)({url:j(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/governance/approvals/${encodeURIComponent(t)}/reject`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/pipes/governance/approvals/{requestId}/reject.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}listPendingApprovals(s={},e){return h.fromPromise(this.__listPendingApprovals(s,e))}async __listPendingApprovals(s={},e){let{limit:t,cursor:r}=s,o={};t!=null&&(o.limit=t.toString()),r!=null&&(o.cursor=r);let n=await(this._options.fetcher??y)({url:j(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/pipes/governance/approvals/pending"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/governance/approvals/pending.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}listGovernanceAuditLogs(s={},e){return h.fromPromise(this.__listGovernanceAuditLogs(s,e))}async __listGovernanceAuditLogs(s={},e){let{limit:t,cursor:r,eventType:o,targetType:n,targetId:d,actorId:b}=s,f={};t!=null&&(f.limit=t.toString()),r!=null&&(f.cursor=r),o!=null&&(f.eventType=o),n!=null&&(f.targetType=n),d!=null&&(f.targetId=d),b!=null&&(f.actorId=b);let E=await(this._options.fetcher??y)({url:j(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/pipes/governance/audit"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:f,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(E.ok)return{data:E.body,rawResponse:E.rawResponse};if(E.error.reason==="status-code")switch(E.error.statusCode){case 400:throw new u(E.error.body,E.rawResponse);case 401:throw new c(E.error.body,E.rawResponse);case 403:throw new w(E.error.body,E.rawResponse);case 404:throw new l(E.error.body,E.rawResponse);case 429:throw new m(E.error.body,E.rawResponse);default:throw new a({statusCode:E.error.statusCode,body:E.error.body,rawResponse:E.rawResponse})}switch(E.error.reason){case"non-json":throw new a({statusCode:E.error.statusCode,body:E.error.rawBody,rawResponse:E.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/governance/audit.");case"unknown":throw new a({message:E.error.errorMessage,rawResponse:E.rawResponse})}}addToBlocklist(s,e){return h.fromPromise(this.__addToBlocklist(s,e))}async __addToBlocklist(s,e){let t=await(this._options.fetcher??y)({url:j(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/pipes/governance/blocklist"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/pipes/governance/blocklist.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}removeFromBlocklist(s={},e){return h.fromPromise(this.__removeFromBlocklist(s,e))}async __removeFromBlocklist(s={},e){let{connectorIds:t}=s,r={};t!=null&&(Array.isArray(t)?r.connectorIds=t.map(n=>n):r.connectorIds=t);let o=await(this._options.fetcher??y)({url:j(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/pipes/governance/blocklist"),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/pipes/governance/blocklist.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}revokeConnectorApproval(s,e){return h.fromPromise(this.__revokeConnectorApproval(s,e))}async __revokeConnectorApproval(s,e){let{connectorGid:t,...r}=s,o=await(this._options.fetcher??y)({url:j(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/governance/connectors/${encodeURIComponent(t)}/revoke`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/pipes/governance/connectors/{connectorGid}/revoke.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import or from"url-join";var Ps=class{static{v(this,"RecordDlq")}_options;constructor(s){this._options=s}listRecordDlq(s={},e){return h.fromPromise(this.__listRecordDlq(s,e))}async __listRecordDlq(s={},e){let{workflowGid:t,status:r,limit:o,cursor:n}=s,d={};t!=null&&(d.workflowGid=t),r!=null&&(d.status=r),o!=null&&(d.limit=o.toString()),n!=null&&(d.cursor=n);let b=await(this._options.fetcher??y)({url:or(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/pipes/record-dlq"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:d,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(b.ok)return{data:b.body,rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new u(b.error.body,b.rawResponse);case 401:throw new c(b.error.body,b.rawResponse);case 403:throw new w(b.error.body,b.rawResponse);case 404:throw new l(b.error.body,b.rawResponse);case 429:throw new m(b.error.body,b.rawResponse);default:throw new a({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}switch(b.error.reason){case"non-json":throw new a({statusCode:b.error.statusCode,body:b.error.rawBody,rawResponse:b.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/record-dlq.");case"unknown":throw new a({message:b.error.errorMessage,rawResponse:b.rawResponse})}}getRecordDlqEntry(s,e){return h.fromPromise(this.__getRecordDlqEntry(s,e))}async __getRecordDlqEntry(s,e){let{entryGid:t}=s,r=await(this._options.fetcher??y)({url:or(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/record-dlq/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/record-dlq/{entryGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}discardRecordDlqEntry(s,e){return h.fromPromise(this.__discardRecordDlqEntry(s,e))}async __discardRecordDlqEntry(s,e){let{entryGid:t,...r}=s,o=await(this._options.fetcher??y)({url:or(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/record-dlq/${encodeURIComponent(t)}/discard`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/pipes/record-dlq/{entryGid}/discard.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}replayRecordDlqEntry(s,e){return h.fromPromise(this.__replayRecordDlqEntry(s,e))}async __replayRecordDlqEntry(s,e){let{entryGid:t}=s,r=await(this._options.fetcher??y)({url:or(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/record-dlq/${encodeURIComponent(t)}/replay`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/pipes/record-dlq/{entryGid}/replay.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getRecordDlqStats(s={},e){return h.fromPromise(this.__getRecordDlqStats(s,e))}async __getRecordDlqStats(s={},e){let{workflowGid:t}=s,r={};t!=null&&(r.workflowGid=t);let o=await(this._options.fetcher??y)({url:or(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/pipes/record-dlq/stats"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/record-dlq/stats.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Kp from"url-join";var gs=class{static{v(this,"Tools")}_options;constructor(s){this._options=s}listTools(s={},e){return h.fromPromise(this.__listTools(s,e))}async __listTools(s={},e){let{stage:t,limit:r,cursor:o}=s,n={};t!=null&&(n.stage=t),r!=null&&(n.limit=r.toString()),o!=null&&(n.cursor=o);let d=await(this._options.fetcher??y)({url:Kp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/pipes/tools"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/tools.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}getTool(s,e){return h.fromPromise(this.__getTool(s,e))}async __getTool(s,e){let{toolName:t}=s,r=await(this._options.fetcher??y)({url:Kp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/tools/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/tools/{toolName}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Un from"url-join";var bs=class{static{v(this,"Watermarks")}_options;constructor(s){this._options=s}listWatermarks(s={},e){return h.fromPromise(this.__listWatermarks(s,e))}async __listWatermarks(s={},e){let{workflowGid:t,limit:r,cursor:o}=s,n={};t!=null&&(n.workflowGid=t),r!=null&&(n.limit=r.toString()),o!=null&&(n.cursor=o);let d=await(this._options.fetcher??y)({url:Un(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/pipes/watermarks"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/watermarks.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}getWatermark(s,e){return h.fromPromise(this.__getWatermark(s,e))}async __getWatermark(s,e){let{sourceId:t,workflowGid:r}=s,o={};o.workflowGid=r;let n=await(this._options.fetcher??y)({url:Un(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/watermarks/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/watermarks/{sourceId}.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}resetWatermark(s,e){return h.fromPromise(this.__resetWatermark(s,e))}async __resetWatermark(s,e){let{watermarkGid:t,...r}=s,o=await(this._options.fetcher??y)({url:Un(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/watermarks/${encodeURIComponent(t)}/reset`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/pipes/watermarks/{watermarkGid}/reset.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import zn from"url-join";var Ns=class{static{v(this,"Webhooks")}_options;constructor(s){this._options=s}listWebhookWorkflows(s={},e){return h.fromPromise(this.__listWebhookWorkflows(s,e))}async __listWebhookWorkflows(s={},e){let{limit:t,cursor:r}=s,o={};t!=null&&(o.limit=t.toString()),r!=null&&(o.cursor=r);let n=await(this._options.fetcher??y)({url:zn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/pipes/webhook-triggers"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/webhook-triggers.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getTriggerUrl(s,e){return h.fromPromise(this.__getTriggerUrl(s,e))}async __getTriggerUrl(s,e){let{workflowGid:t}=s,r=await(this._options.fetcher??y)({url:zn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/webhook-triggers/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/pipes/webhook-triggers/{workflowGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}rotateWebhookSecret(s,e){return h.fromPromise(this.__rotateWebhookSecret(s,e))}async __rotateWebhookSecret(s,e){let{workflowGid:t}=s,r=await(this._options.fetcher??y)({url:zn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/pipes/webhook-triggers/${encodeURIComponent(t)}/rotate-secret`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/pipes/webhook-triggers/{workflowGid}/rotate-secret.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};var vs=class{static{v(this,"Pipes")}_options;_agentExecutions;_analyses;_workflows;_connectors;_decisions;_dlq;_executions;_governance;_recordDlq;_tools;_watermarks;_webhooks;constructor(s){this._options=s}get agentExecutions(){return this._agentExecutions??=new ds(this._options)}get analyses(){return this._analyses??=new ps(this._options)}get workflows(){return this._workflows??=new us(this._options)}get connectors(){return this._connectors??=new cs(this._options)}get decisions(){return this._decisions??=new ls(this._options)}get dlq(){return this._dlq??=new hs(this._options)}get executions(){return this._executions??=new ys(this._options)}get governance(){return this._governance??=new Rs(this._options)}get recordDlq(){return this._recordDlq??=new Ps(this._options)}get tools(){return this._tools??=new gs(this._options)}get watermarks(){return this._watermarks??=new bs(this._options)}get webhooks(){return this._webhooks??=new Ns(this._options)}};import Fe from"url-join";var fs=class{static{v(this,"AgentGoals")}_options;constructor(s){this._options=s}list(s,e){return h.fromPromise(this.__list(s,e))}async __list(s,e){let{agentGid:t,status:r,limit:o}=s,n={};n.agentGid=t,r!=null&&(n.status=r),o!=null&&(n.limit=o.toString());let d=await(this._options.fetcher??y)({url:Fe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/agent-goals"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/agent-goals.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}create(s,e){return h.fromPromise(this.__create(s,e))}async __create(s,e){let t=await(this._options.fetcher??y)({url:Fe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/agent-goals"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/agent-goals.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}retrieve(s,e){return h.fromPromise(this.__retrieve(s,e))}async __retrieve(s,e){let{goalGid:t}=s,r=await(this._options.fetcher??y)({url:Fe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/agent-goals/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/agent-goals/{goalGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(s,e){return h.fromPromise(this.__update(s,e))}async __update(s,e){let{goalGid:t,...r}=s,o=await(this._options.fetcher??y)({url:Fe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/agent-goals/${encodeURIComponent(t)}`),method:"PATCH",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PATCH /v1/primus/agent-goals/{goalGid}.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}recordProgress(s,e){return h.fromPromise(this.__recordProgress(s,e))}async __recordProgress(s,e){let{goalGid:t,...r}=s,o=await(this._options.fetcher??y)({url:Fe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/agent-goals/${encodeURIComponent(t)}/progress`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/agent-goals/{goalGid}/progress.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}setStatus(s,e){return h.fromPromise(this.__setStatus(s,e))}async __setStatus(s,e){let{goalGid:t,...r}=s,o=await(this._options.fetcher??y)({url:Fe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/agent-goals/${encodeURIComponent(t)}/status`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/agent-goals/{goalGid}/status.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import O from"url-join";var Es=class{static{v(this,"Agents")}_options;constructor(s){this._options=s}list(s={},e){return h.fromPromise(this.__list(s,e))}async __list(s={},e){let{activeOnly:t,status:r,limit:o,cursor:n}=s,d={};t!=null&&(d.activeOnly=t.toString()),r!=null&&(d.status=r),o!=null&&(d.limit=o.toString()),n!=null&&(d.cursor=n);let b=await(this._options.fetcher??y)({url:O(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/agents"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:d,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(b.ok)return{data:b.body,rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new u(b.error.body,b.rawResponse);case 401:throw new c(b.error.body,b.rawResponse);case 403:throw new w(b.error.body,b.rawResponse);case 404:throw new l(b.error.body,b.rawResponse);case 429:throw new m(b.error.body,b.rawResponse);default:throw new a({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}switch(b.error.reason){case"non-json":throw new a({statusCode:b.error.statusCode,body:b.error.rawBody,rawResponse:b.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/agents.");case"unknown":throw new a({message:b.error.errorMessage,rawResponse:b.rawResponse})}}create(s,e){return h.fromPromise(this.__create(s,e))}async __create(s,e){let t=await(this._options.fetcher??y)({url:O(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/agents"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/agents.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}retrieve(s,e){return h.fromPromise(this.__retrieve(s,e))}async __retrieve(s,e){let{agentGid:t}=s,r=await(this._options.fetcher??y)({url:O(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/agents/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/agents/{agentGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}remove(s,e){return h.fromPromise(this.__remove(s,e))}async __remove(s,e){let{agentGid:t}=s,r=await(this._options.fetcher??y)({url:O(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/agents/${encodeURIComponent(t)}`),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/primus/agents/{agentGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(s,e){return h.fromPromise(this.__update(s,e))}async __update(s,e){let{agentGid:t,...r}=s,o=await(this._options.fetcher??y)({url:O(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/agents/${encodeURIComponent(t)}`),method:"PATCH",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PATCH /v1/primus/agents/{agentGid}.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}activate(s,e){return h.fromPromise(this.__activate(s,e))}async __activate(s,e){let{agentGid:t}=s,r=await(this._options.fetcher??y)({url:O(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/agents/${encodeURIComponent(t)}/activate`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/agents/{agentGid}/activate.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}archive(s,e){return h.fromPromise(this.__archive(s,e))}async __archive(s,e){let{agentGid:t}=s,r=await(this._options.fetcher??y)({url:O(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/agents/${encodeURIComponent(t)}/archive`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/agents/{agentGid}/archive.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}invoke(s,e){return h.fromPromise(this.__invoke(s,e))}async __invoke(s,e){let{agentGid:t,traceparent:r,...o}=s,n=await(this._options.fetcher??y)({url:O(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/agents/${encodeURIComponent(t)}/invoke`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader(),traceparent:r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/agents/{agentGid}/invoke.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}pause(s,e){return h.fromPromise(this.__pause(s,e))}async __pause(s,e){let{agentGid:t}=s,r=await(this._options.fetcher??y)({url:O(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/agents/${encodeURIComponent(t)}/pause`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/agents/{agentGid}/pause.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}run(s,e){return h.fromPromise(this.__run(s,e))}async __run(s,e){let{agentGid:t,traceparent:r,...o}=s,n=await(this._options.fetcher??y)({url:O(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/agents/${encodeURIComponent(t)}/run`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader(),traceparent:r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/agents/{agentGid}/run.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}assignSkill(s,e){return h.fromPromise(this.__assignSkill(s,e))}async __assignSkill(s,e){let{agentGid:t,...r}=s,o=await(this._options.fetcher??y)({url:O(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/agents/${encodeURIComponent(t)}/skills/assign`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/agents/{agentGid}/skills/assign.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}unassignSkill(s,e){return h.fromPromise(this.__unassignSkill(s,e))}async __unassignSkill(s,e){let{agentGid:t,...r}=s,o=await(this._options.fetcher??y)({url:O(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/agents/${encodeURIComponent(t)}/skills/unassign`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/agents/{agentGid}/skills/unassign.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import ue from"url-join";var Ss=class{static{v(this,"Approvals")}_options;constructor(s){this._options=s}list(s={},e){return h.fromPromise(this.__list(s,e))}async __list(s={},e){let{status:t}=s,r={};t!=null&&(r.status=t);let o=await(this._options.fetcher??y)({url:ue(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/approvals"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/approvals.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}create(s,e){return h.fromPromise(this.__create(s,e))}async __create(s,e){let t=await(this._options.fetcher??y)({url:ue(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/approvals"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/approvals.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}retrieve(s,e){return h.fromPromise(this.__retrieve(s,e))}async __retrieve(s,e){let{approvalGid:t}=s,r=await(this._options.fetcher??y)({url:ue(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/approvals/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/approvals/{approvalGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}approve(s,e){return h.fromPromise(this.__approve(s,e))}async __approve(s,e){let{approvalGid:t,...r}=s,o=await(this._options.fetcher??y)({url:ue(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/approvals/${encodeURIComponent(t)}/approve`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/approvals/{approvalGid}/approve.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}reject(s,e){return h.fromPromise(this.__reject(s,e))}async __reject(s,e){let{approvalGid:t,...r}=s,o=await(this._options.fetcher??y)({url:ue(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/approvals/${encodeURIComponent(t)}/reject`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/approvals/{approvalGid}/reject.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}listByAgent(s,e){return h.fromPromise(this.__listByAgent(s,e))}async __listByAgent(s,e){let{agentGid:t,pendingOnly:r}=s,o={};o.agentGid=t,r!=null&&(o.pendingOnly=r.toString());let n=await(this._options.fetcher??y)({url:ue(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/approvals/by-agent"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/approvals/by-agent.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}listPending(s){return h.fromPromise(this.__listPending(s))}async __listPending(s){let e=await(this._options.fetcher??y)({url:ue(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/approvals/pending"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/approvals/pending.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}pendingCount(s){return h.fromPromise(this.__pendingCount(s))}async __pendingCount(s){let e=await(this._options.fetcher??y)({url:ue(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/approvals/pending/count"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/approvals/pending/count.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}getPendingSummary(s){return h.fromPromise(this.__getPendingSummary(s))}async __getPendingSummary(s){let e=await(this._options.fetcher??y)({url:ue(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/approvals/pending/summary"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/approvals/pending/summary.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import fe from"url-join";var _s=class{static{v(this,"BrainConfig")}_options;constructor(s){this._options=s}getConfig(s){return h.fromPromise(this.__getConfig(s))}async __getConfig(s){let e=await(this._options.fetcher??y)({url:fe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/brain/config"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/brain/config.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}configure(s,e){return h.fromPromise(this.__configure(s,e))}async __configure(s,e){let t=await(this._options.fetcher??y)({url:fe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/brain/config"),method:"PUT",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PUT /v1/primus/brain/config.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}deleteConfig(s){return h.fromPromise(this.__deleteConfig(s))}async __deleteConfig(s){let e=await(this._options.fetcher??y)({url:fe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/brain/config"),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/primus/brain/config.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}getLlmDashboard(s){return h.fromPromise(this.__getLlmDashboard(s))}async __getLlmDashboard(s){let e=await(this._options.fetcher??y)({url:fe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/brain/llm-dashboard"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/brain/llm-dashboard.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}storeProviderKey(s,e){return h.fromPromise(this.__storeProviderKey(s,e))}async __storeProviderKey(s,e){let t=await(this._options.fetcher??y)({url:fe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/brain/provider-keys"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/brain/provider-keys.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}listProviderModels(s,e){return h.fromPromise(this.__listProviderModels(s,e))}async __listProviderModels(s,e){let t=await(this._options.fetcher??y)({url:fe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/brain/provider-models"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/brain/provider-models.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}getUsageDashboard(s={},e){return h.fromPromise(this.__getUsageDashboard(s,e))}async __getUsageDashboard(s={},e){let{range:t}=s,r={};t!=null&&(r.range=t);let o=await(this._options.fetcher??y)({url:fe(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/brain/usage-dashboard"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/brain/usage-dashboard.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Jp from"url-join";var ks=class{static{v(this,"BrainModels")}_options;constructor(s){this._options=s}list(s={},e){return h.fromPromise(this.__list(s,e))}async __list(s={},e){let{provider:t}=s,r={};t!=null&&(r.provider=t);let o=await(this._options.fetcher??y)({url:Jp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/brain/models"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/brain/models.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}refresh(s={},e){return h.fromPromise(this.__refresh(s,e))}async __refresh(s={},e){let t=await(this._options.fetcher??y)({url:Jp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/brain/models/refresh"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/brain/models/refresh.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Qp from"url-join";var Ts=class{static{v(this,"ConfigPromotion")}_options;constructor(s){this._options=s}applyConfigBundle(s,e){return h.fromPromise(this.__applyConfigBundle(s,e))}async __applyConfigBundle(s,e){let t=await(this._options.fetcher??y)({url:Qp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/config/apply"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/config/apply.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}exportConfig(s){return h.fromPromise(this.__exportConfig(s))}async __exportConfig(s){let e=await(this._options.fetcher??y)({url:Qp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/config/export"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/config/export.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import ce from"url-join";var Cs=class{static{v(this,"Conversations")}_options;constructor(s){this._options=s}list(s={},e){return h.fromPromise(this.__list(s,e))}async __list(s={},e){let{status:t,limit:r,cursor:o}=s,n={};t!=null&&(n.status=t),r!=null&&(n.limit=r.toString()),o!=null&&(n.cursor=o);let d=await(this._options.fetcher??y)({url:ce(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/conversations"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/conversations.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}create(s,e){return h.fromPromise(this.__create(s,e))}async __create(s,e){let t=await(this._options.fetcher??y)({url:ce(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/conversations"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/conversations.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}retrieve(s,e){return h.fromPromise(this.__retrieve(s,e))}async __retrieve(s,e){let{conversationGid:t}=s,r=await(this._options.fetcher??y)({url:ce(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/conversations/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/conversations/{conversationGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}remove(s,e){return h.fromPromise(this.__remove(s,e))}async __remove(s,e){let{conversationGid:t}=s,r=await(this._options.fetcher??y)({url:ce(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/conversations/${encodeURIComponent(t)}`),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/primus/conversations/{conversationGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(s,e){return h.fromPromise(this.__update(s,e))}async __update(s,e){let{conversationGid:t,...r}=s,o=await(this._options.fetcher??y)({url:ce(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/conversations/${encodeURIComponent(t)}`),method:"PATCH",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PATCH /v1/primus/conversations/{conversationGid}.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}archive(s,e){return h.fromPromise(this.__archive(s,e))}async __archive(s,e){let{conversationGid:t}=s,r=await(this._options.fetcher??y)({url:ce(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/conversations/${encodeURIComponent(t)}/archive`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/conversations/{conversationGid}/archive.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getWithMessages(s,e){return h.fromPromise(this.__getWithMessages(s,e))}async __getWithMessages(s,e){let{conversationGid:t,messageLimit:r}=s,o={};r!=null&&(o.messageLimit=r.toString());let n=await(this._options.fetcher??y)({url:ce(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/conversations/${encodeURIComponent(t)}/messages`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/conversations/{conversationGid}/messages.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}listByAgent(s,e){return h.fromPromise(this.__listByAgent(s,e))}async __listByAgent(s,e){let{agentGid:t,includeArchived:r}=s,o={};o.agentGid=t,r!=null&&(o.includeArchived=r.toString());let n=await(this._options.fetcher??y)({url:ce(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/conversations/by-agent"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/conversations/by-agent.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}listWithStats(s={},e){return h.fromPromise(this.__listWithStats(s,e))}async __listWithStats(s={},e){let{status:t,limit:r}=s,o={};t!=null&&(o.status=t),r!=null&&(o.limit=r.toString());let n=await(this._options.fetcher??y)({url:ce(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/conversations/stats"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/conversations/stats.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Vp from"url-join";var xs=class{static{v(this,"Actions")}_options;constructor(s){this._options=s}send(s,e){return h.fromPromise(this.__send(s,e))}async __send(s,e){let{conversationGid:t,...r}=s,o=await(this._options.fetcher??y)({url:Vp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/conversations/${encodeURIComponent(t)}/send`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/conversations/{conversationGid}/send.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}testFire(s,e){return h.fromPromise(this.__testFire(s,e))}async __testFire(s,e){let{triggerGid:t}=s,r=await(this._options.fetcher??y)({url:Vp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/triggers/${encodeURIComponent(t)}/test-fire`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/triggers/{triggerGid}/test-fire.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Fn from"url-join";var As=class{static{v(this,"Delegations")}_options;constructor(s){this._options=s}listByDelegate(s,e){return h.fromPromise(this.__listByDelegate(s,e))}async __listByDelegate(s,e){let{agentGid:t,limit:r}=s,o={};o.agentGid=t,r!=null&&(o.limit=r.toString());let n=await(this._options.fetcher??y)({url:Fn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/delegations/by-delegate"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/delegations/by-delegate.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}listByDelegator(s,e){return h.fromPromise(this.__listByDelegator(s,e))}async __listByDelegator(s,e){let{agentGid:t,limit:r}=s,o={};o.agentGid=t,r!=null&&(o.limit=r.toString());let n=await(this._options.fetcher??y)({url:Fn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/delegations/by-delegator"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/delegations/by-delegator.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}listByTeam(s,e){return h.fromPromise(this.__listByTeam(s,e))}async __listByTeam(s,e){let{teamGid:t,limit:r}=s,o={};o.teamGid=t,r!=null&&(o.limit=r.toString());let n=await(this._options.fetcher??y)({url:Fn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/delegations/by-team"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/delegations/by-team.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import gc from"url-join";var Is=class{static{v(this,"Entitlements")}_options;constructor(s){this._options=s}retrieve(s){return h.fromPromise(this.__retrieve(s))}async __retrieve(s){let e=await(this._options.fetcher??y)({url:gc(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/entitlements"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/entitlements.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import U from"url-join";var Gs=class{static{v(this,"Execution")}_options;constructor(s){this._options=s}list(s={},e){return h.fromPromise(this.__list(s,e))}async __list(s={},e){let{agentGid:t,status:r,includeLeadRuns:o,limit:n}=s,d={};t!=null&&(d.agentGid=t),r!=null&&(d.status=r),o!=null&&(d.includeLeadRuns=o.toString()),n!=null&&(d.limit=n.toString());let b=await(this._options.fetcher??y)({url:U(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/executions"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:d,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(b.ok)return{data:b.body,rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new u(b.error.body,b.rawResponse);case 401:throw new c(b.error.body,b.rawResponse);case 403:throw new w(b.error.body,b.rawResponse);case 404:throw new l(b.error.body,b.rawResponse);case 429:throw new m(b.error.body,b.rawResponse);default:throw new a({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}switch(b.error.reason){case"non-json":throw new a({statusCode:b.error.statusCode,body:b.error.rawBody,rawResponse:b.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/executions.");case"unknown":throw new a({message:b.error.errorMessage,rawResponse:b.rawResponse})}}create(s,e){return h.fromPromise(this.__create(s,e))}async __create(s,e){let t=await(this._options.fetcher??y)({url:U(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/executions"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/executions.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}retrieve(s,e){return h.fromPromise(this.__retrieve(s,e))}async __retrieve(s,e){let{executionGid:t}=s,r=await(this._options.fetcher??y)({url:U(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/executions/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/executions/{executionGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}approve(s,e){return h.fromPromise(this.__approve(s,e))}async __approve(s,e){let{executionGid:t}=s,r=await(this._options.fetcher??y)({url:U(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/executions/${encodeURIComponent(t)}/approve`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/executions/{executionGid}/approve.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}cancel(s,e){return h.fromPromise(this.__cancel(s,e))}async __cancel(s,e){let{executionGid:t,...r}=s,o=await(this._options.fetcher??y)({url:U(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/executions/${encodeURIComponent(t)}/cancel`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/executions/{executionGid}/cancel.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getDetails(s,e){return h.fromPromise(this.__getDetails(s,e))}async __getDetails(s,e){let{executionGid:t}=s,r=await(this._options.fetcher??y)({url:U(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/executions/${encodeURIComponent(t)}/details`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/executions/{executionGid}/details.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}streamEvents(s,e){return h.fromPromise(this.__streamEvents(s,e))}async __streamEvents(s,e){let{executionGid:t,afterSequence:r}=s,o={};r!=null&&(o.afterSequence=r.toString());let n=await(this._options.fetcher??y)({url:U(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/executions/${encodeURIComponent(t)}/events`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/executions/{executionGid}/events.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}reject(s,e){return h.fromPromise(this.__reject(s,e))}async __reject(s,e){let{executionGid:t,...r}=s,o=await(this._options.fetcher??y)({url:U(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/executions/${encodeURIComponent(t)}/reject`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/executions/{executionGid}/reject.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}traces(s,e){return h.fromPromise(this.__traces(s,e))}async __traces(s,e){let{executionGid:t}=s,r=await(this._options.fetcher??y)({url:U(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/executions/${encodeURIComponent(t)}/traces`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/executions/{executionGid}/traces.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}createBatch(s,e){return h.fromPromise(this.__createBatch(s,e))}async __createBatch(s,e){let t=await(this._options.fetcher??y)({url:U(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/executions/batch"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/executions/batch.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}listByAgent(s,e){return h.fromPromise(this.__listByAgent(s,e))}async __listByAgent(s,e){let{agentGid:t,status:r,limit:o}=s,n={};n.agentGid=t,r!=null&&(n.status=r),o!=null&&(n.limit=o.toString());let d=await(this._options.fetcher??y)({url:U(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/executions/by-agent"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/executions/by-agent.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}listByConversation(s,e){return h.fromPromise(this.__listByConversation(s,e))}async __listByConversation(s,e){let{conversationGid:t,limit:r}=s,o={};o.conversationGid=t,r!=null&&(o.limit=r.toString());let n=await(this._options.fetcher??y)({url:U(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/executions/by-conversation"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/executions/by-conversation.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getPendingApprovals(s={},e){return h.fromPromise(this.__getPendingApprovals(s,e))}async __getPendingApprovals(s={},e){let{agentGid:t}=s,r={};t!=null&&(r.agentGid=t);let o=await(this._options.fetcher??y)({url:U(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/executions/pending-approvals"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/executions/pending-approvals.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getStats(s={},e){return h.fromPromise(this.__getStats(s,e))}async __getStats(s={},e){let{agentGid:t,timeRange:r}=s,o={};t!=null&&(o.agentGid=t),r!=null&&(o.timeRange=r.toString());let n=await(this._options.fetcher??y)({url:U(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/executions/stats"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/executions/stats.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Yp from"url-join";var Ms=class{static{v(this,"GuardrailOutcomes")}_options;constructor(s){this._options=s}list(s={},e){return h.fromPromise(this.__list(s,e))}async __list(s={},e){let{agentGid:t,limit:r}=s,o={};t!=null&&(o.agentGid=t),r!=null&&(o.limit=r.toString());let n=await(this._options.fetcher??y)({url:Yp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/guardrails/outcomes"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/guardrails/outcomes.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}retrieve(s,e){return h.fromPromise(this.__retrieve(s,e))}async __retrieve(s,e){let{outcomeGid:t}=s,r=await(this._options.fetcher??y)({url:Yp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/guardrails/outcomes/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/guardrails/outcomes/{outcomeGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import sr from"url-join";var Hs=class{static{v(this,"Integrations")}_options;constructor(s){this._options=s}list(s={},e){return h.fromPromise(this.__list(s,e))}async __list(s={},e){let{status:t,activeOnly:r}=s,o={};t!=null&&(o.status=t),r!=null&&(o.activeOnly=r.toString());let n=await(this._options.fetcher??y)({url:sr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/integrations"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/integrations.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}retrieve(s,e){return h.fromPromise(this.__retrieve(s,e))}async __retrieve(s,e){let{connectionGid:t}=s,r=await(this._options.fetcher??y)({url:sr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/integrations/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/integrations/{connectionGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}disconnect(s,e){return h.fromPromise(this.__disconnect(s,e))}async __disconnect(s,e){let{connectionGid:t}=s,r=await(this._options.fetcher??y)({url:sr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/integrations/${encodeURIComponent(t)}/disconnect`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/integrations/{connectionGid}/disconnect.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}refresh(s,e){return h.fromPromise(this.__refresh(s,e))}async __refresh(s,e){let{connectionGid:t}=s,r=await(this._options.fetcher??y)({url:sr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/integrations/${encodeURIComponent(t)}/refresh`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/integrations/{connectionGid}/refresh.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}connect(s,e){return h.fromPromise(this.__connect(s,e))}async __connect(s,e){let t=await(this._options.fetcher??y)({url:sr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/integrations/connect"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/integrations/connect.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Ee from"url-join";var qs=class{static{v(this,"KillSwitch")}_options;constructor(s){this._options=s}list(s={},e){return h.fromPromise(this.__list(s,e))}async __list(s={},e){let{level:t,agentGid:r}=s,o={};t!=null&&(o.level=t),r!=null&&(o.agentGid=r);let n=await(this._options.fetcher??y)({url:Ee(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/kill-switch"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/kill-switch.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}retrieve(s,e){return h.fromPromise(this.__retrieve(s,e))}async __retrieve(s,e){let{killSwitchGid:t}=s,r=await(this._options.fetcher??y)({url:Ee(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/kill-switch/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/kill-switch/{killSwitchGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}activate(s,e){return h.fromPromise(this.__activate(s,e))}async __activate(s,e){let t=await(this._options.fetcher??y)({url:Ee(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/kill-switch/activate"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/kill-switch/activate.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}listActive(s){return h.fromPromise(this.__listActive(s))}async __listActive(s){let e=await(this._options.fetcher??y)({url:Ee(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/kill-switch/active"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/kill-switch/active.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}checkBlocking(s,e){return h.fromPromise(this.__checkBlocking(s,e))}async __checkBlocking(s,e){let{agentGid:t}=s,r={};r.agentGid=t;let o=await(this._options.fetcher??y)({url:Ee(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/kill-switch/check"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/kill-switch/check.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}deactivate(s,e){return h.fromPromise(this.__deactivate(s,e))}async __deactivate(s,e){let t=await(this._options.fetcher??y)({url:Ee(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/kill-switch/deactivate"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/kill-switch/deactivate.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}status(s={},e){return h.fromPromise(this.__status(s,e))}async __status(s={},e){let{agentGid:t}=s,r={};t!=null&&(r.agentGid=t);let o=await(this._options.fetcher??y)({url:Ee(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/kill-switch/status"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/kill-switch/status.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import we from"url-join";var Bs=class{static{v(this,"Learning")}_options;constructor(s){this._options=s}listFeedback(s={},e){return h.fromPromise(this.__listFeedback(s,e))}async __listFeedback(s={},e){let{agentGid:t,limit:r}=s,o={};t!=null&&(o.agentGid=t),r!=null&&(o.limit=r.toString());let n=await(this._options.fetcher??y)({url:we(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/learning/feedback"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/learning/feedback.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}submitFeedback(s,e){return h.fromPromise(this.__submitFeedback(s,e))}async __submitFeedback(s,e){let t=await(this._options.fetcher??y)({url:we(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/learning/feedback"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/learning/feedback.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}listFeedbackByAgent(s,e){return h.fromPromise(this.__listFeedbackByAgent(s,e))}async __listFeedbackByAgent(s,e){let{agentGid:t,timeRange:r,limit:o}=s,n={};n.agentGid=t,r!=null&&(n.timeRange=r.toString()),o!=null&&(n.limit=o.toString());let d=await(this._options.fetcher??y)({url:we(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/learning/feedback/by-agent"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/learning/feedback/by-agent.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}listPatterns(s={},e){return h.fromPromise(this.__listPatterns(s,e))}async __listPatterns(s={},e){let{agentGid:t,type:r,limit:o}=s,n={};t!=null&&(n.agentGid=t),r!=null&&(n.type=r),o!=null&&(n.limit=o.toString());let d=await(this._options.fetcher??y)({url:we(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/learning/patterns"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/learning/patterns.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}listPatternsByAgent(s,e){return h.fromPromise(this.__listPatternsByAgent(s,e))}async __listPatternsByAgent(s,e){let{agentGid:t,timeRange:r,type:o,limit:n}=s,d={};d.agentGid=t,r!=null&&(d.timeRange=r.toString()),o!=null&&(d.type=o),n!=null&&(d.limit=n.toString());let b=await(this._options.fetcher??y)({url:we(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/learning/patterns/by-agent"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:d,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(b.ok)return{data:b.body,rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new u(b.error.body,b.rawResponse);case 401:throw new c(b.error.body,b.rawResponse);case 403:throw new w(b.error.body,b.rawResponse);case 404:throw new l(b.error.body,b.rawResponse);case 429:throw new m(b.error.body,b.rawResponse);default:throw new a({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}switch(b.error.reason){case"non-json":throw new a({statusCode:b.error.statusCode,body:b.error.rawBody,rawResponse:b.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/learning/patterns/by-agent.");case"unknown":throw new a({message:b.error.errorMessage,rawResponse:b.rawResponse})}}setPatternActive(s,e){return h.fromPromise(this.__setPatternActive(s,e))}async __setPatternActive(s,e){let t=await(this._options.fetcher??y)({url:we(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/learning/patterns/set-active"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/learning/patterns/set-active.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}listPredictions(s,e){return h.fromPromise(this.__listPredictions(s,e))}async __listPredictions(s,e){let{agentGid:t,status:r,limit:o}=s,n={};n.agentGid=t,r!=null&&(n.status=r),o!=null&&(n.limit=o.toString());let d=await(this._options.fetcher??y)({url:we(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/learning/predictions"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/learning/predictions.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}listProactiveActions(s,e){return h.fromPromise(this.__listProactiveActions(s,e))}async __listProactiveActions(s,e){let{agentGid:t,status:r,limit:o}=s,n={};n.agentGid=t,r!=null&&(n.status=r),o!=null&&(n.limit=o.toString());let d=await(this._options.fetcher??y)({url:we(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/learning/proactive-actions"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/learning/proactive-actions.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}decideProactiveAction(s,e){return h.fromPromise(this.__decideProactiveAction(s,e))}async __decideProactiveAction(s,e){let t=await(this._options.fetcher??y)({url:we(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/learning/proactive-actions/decide"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/learning/proactive-actions/decide.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import bc from"url-join";var Us=class{static{v(this,"Stats")}_options;constructor(s){this._options=s}retrieve(s,e){return h.fromPromise(this.__retrieve(s,e))}async __retrieve(s,e){let{agentGid:t,timeRange:r}=s,o={};o.agentGid=t,r!=null&&(o.timeRange=r.toString());let n=await(this._options.fetcher??y)({url:bc(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/learning/stats"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/learning/stats.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import jn from"url-join";var zs=class{static{v(this,"McpConnect")}_options;constructor(s){this._options=s}listConnections(s){return h.fromPromise(this.__listConnections(s))}async __listConnections(s){let e=await(this._options.fetcher??y)({url:jn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/mcp-connections"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/mcp-connections.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}revokeConnection(s,e){return h.fromPromise(this.__revokeConnection(s,e))}async __revokeConnection(s,e){let{credentialGid:t}=s,r=await(this._options.fetcher??y)({url:jn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/mcp-connections/${encodeURIComponent(t)}/revoke`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/mcp-connections/{credentialGid}/revoke.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}beginConnect(s,e){return h.fromPromise(this.__beginConnect(s,e))}async __beginConnect(s,e){let{mcpServerGid:t}=s,r=await(this._options.fetcher??y)({url:jn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/mcp-servers/${encodeURIComponent(t)}/connect/begin`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/mcp-servers/{mcpServerGid}/connect/begin.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import ye from"url-join";var Fs=class{static{v(this,"McpServers")}_options;constructor(s){this._options=s}list(s){return h.fromPromise(this.__list(s))}async __list(s){let e=await(this._options.fetcher??y)({url:ye(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/mcp-servers"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/mcp-servers.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}connect(s,e){return h.fromPromise(this.__connect(s,e))}async __connect(s,e){let t=await(this._options.fetcher??y)({url:ye(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/mcp-servers"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/mcp-servers.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}retrieve(s,e){return h.fromPromise(this.__retrieve(s,e))}async __retrieve(s,e){let{mcpServerGid:t}=s,r=await(this._options.fetcher??y)({url:ye(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/mcp-servers/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/mcp-servers/{mcpServerGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}disconnect(s,e){return h.fromPromise(this.__disconnect(s,e))}async __disconnect(s,e){let{mcpServerGid:t}=s,r=await(this._options.fetcher??y)({url:ye(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/mcp-servers/${encodeURIComponent(t)}/disconnect`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/mcp-servers/{mcpServerGid}/disconnect.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}reconnect(s,e){return h.fromPromise(this.__reconnect(s,e))}async __reconnect(s,e){let{mcpServerGid:t}=s,r=await(this._options.fetcher??y)({url:ye(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/mcp-servers/${encodeURIComponent(t)}/reconnect`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/mcp-servers/{mcpServerGid}/reconnect.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}rename(s,e){return h.fromPromise(this.__rename(s,e))}async __rename(s,e){let{mcpServerGid:t,...r}=s,o=await(this._options.fetcher??y)({url:ye(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/mcp-servers/${encodeURIComponent(t)}/rename`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/mcp-servers/{mcpServerGid}/rename.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}rotateAuth(s,e){return h.fromPromise(this.__rotateAuth(s,e))}async __rotateAuth(s,e){let{mcpServerGid:t,...r}=s,o=await(this._options.fetcher??y)({url:ye(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/mcp-servers/${encodeURIComponent(t)}/rotate-auth`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/mcp-servers/{mcpServerGid}/rotate-auth.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}test(s,e){return h.fromPromise(this.__test(s,e))}async __test(s,e){let t=await(this._options.fetcher??y)({url:ye(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/mcp-servers/test"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/mcp-servers/test.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Xp from"url-join";var js=class{static{v(this,"McpOauth")}_options;constructor(s){this._options=s}beginOauth(s,e){return h.fromPromise(this.__beginOauth(s,e))}async __beginOauth(s,e){let{mcpServerGid:t}=s,r=await(this._options.fetcher??y)({url:Xp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/mcp-servers/${encodeURIComponent(t)}/oauth/begin`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/mcp-servers/{mcpServerGid}/oauth/begin.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}setPreregisteredClient(s,e){return h.fromPromise(this.__setPreregisteredClient(s,e))}async __setPreregisteredClient(s,e){let{mcpServerGid:t,...r}=s,o=await(this._options.fetcher??y)({url:Xp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/mcp-servers/${encodeURIComponent(t)}/oauth/client`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/mcp-servers/{mcpServerGid}/oauth/client.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Dn from"url-join";var Ds=class{static{v(this,"MemoriesEncrypted")}_options;constructor(s){this._options=s}decryptMemory(s,e){return h.fromPromise(this.__decryptMemory(s,e))}async __decryptMemory(s,e){let{memoryGid:t,...r}=s,o=await(this._options.fetcher??y)({url:Dn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/memories/${encodeURIComponent(t)}/decrypt`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/memories/{memoryGid}/decrypt.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getEncryption(s,e){return h.fromPromise(this.__getEncryption(s,e))}async __getEncryption(s,e){let{memoryGid:t,revealNonce:r}=s,o={};r!=null&&(o.revealNonce=r.toString());let n=await(this._options.fetcher??y)({url:Dn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/memories/${encodeURIComponent(t)}/encryption`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/memories/{memoryGid}/encryption.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}reencrypt(s,e){return h.fromPromise(this.__reencrypt(s,e))}async __reencrypt(s,e){let{memoryGid:t}=s,r=await(this._options.fetcher??y)({url:Dn(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/memories/${encodeURIComponent(t)}/reencrypt`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/memories/{memoryGid}/reencrypt.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import ae from"url-join";var Ls=class{static{v(this,"Memories")}_options;constructor(s){this._options=s}list(s={},e){return h.fromPromise(this.__list(s,e))}async __list(s={},e){let{type:t,limit:r}=s,o={};t!=null&&(o.type=t),r!=null&&(o.limit=r.toString());let n=await(this._options.fetcher??y)({url:ae(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/memory"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/memory.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}create(s,e){return h.fromPromise(this.__create(s,e))}async __create(s,e){let t=await(this._options.fetcher??y)({url:ae(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/memory"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/memory.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}retrieve(s,e){return h.fromPromise(this.__retrieve(s,e))}async __retrieve(s,e){let{memoryGid:t}=s,r=await(this._options.fetcher??y)({url:ae(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/memory/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/memory/{memoryGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}remove(s,e){return h.fromPromise(this.__remove(s,e))}async __remove(s,e){let{memoryGid:t}=s,r=await(this._options.fetcher??y)({url:ae(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/memory/${encodeURIComponent(t)}`),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/primus/memory/{memoryGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(s,e){return h.fromPromise(this.__update(s,e))}async __update(s,e){let{memoryGid:t,...r}=s,o=await(this._options.fetcher??y)({url:ae(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/memory/${encodeURIComponent(t)}`),method:"PATCH",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PATCH /v1/primus/memory/{memoryGid}.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}quarantine(s,e){return h.fromPromise(this.__quarantine(s,e))}async __quarantine(s,e){let{memoryGid:t,...r}=s,o=await(this._options.fetcher??y)({url:ae(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/memory/${encodeURIComponent(t)}/quarantine`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/memory/{memoryGid}/quarantine.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}unquarantine(s,e){return h.fromPromise(this.__unquarantine(s,e))}async __unquarantine(s,e){let{memoryGid:t}=s,r=await(this._options.fetcher??y)({url:ae(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/memory/${encodeURIComponent(t)}/unquarantine`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/memory/{memoryGid}/unquarantine.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listByAgent(s,e){return h.fromPromise(this.__listByAgent(s,e))}async __listByAgent(s,e){let{agentGid:t,type:r,limit:o}=s,n={};n.agentGid=t,r!=null&&(n.type=r),o!=null&&(n.limit=o.toString());let d=await(this._options.fetcher??y)({url:ae(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/memory/by-agent"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/memory/by-agent.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}listByConversation(s,e){return h.fromPromise(this.__listByConversation(s,e))}async __listByConversation(s,e){let{conversationGid:t}=s,r={};r.conversationGid=t;let o=await(this._options.fetcher??y)({url:ae(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/memory/by-conversation"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/memory/by-conversation.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}listQuarantined(s){return h.fromPromise(this.__listQuarantined(s))}async __listQuarantined(s){let e=await(this._options.fetcher??y)({url:ae(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/memory/quarantined"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/memory/quarantined.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Re from"url-join";var Ws=class{static{v(this,"Memory")}_options;constructor(s){this._options=s}recall(s,e){return h.fromPromise(this.__recall(s,e))}async __recall(s,e){let{agentGid:t,query:r,type:o,limit:n,cursor:d}=s,b={};b.agentGid=t,r!=null&&(b.query=r),o!=null&&(b.type=o),n!=null&&(b.limit=n.toString()),d!=null&&(b.cursor=d);let f=await(this._options.fetcher??y)({url:Re(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/memory/recall"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:b,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(f.ok)return{data:f.body,rawResponse:f.rawResponse};if(f.error.reason==="status-code")switch(f.error.statusCode){case 400:throw new u(f.error.body,f.rawResponse);case 401:throw new c(f.error.body,f.rawResponse);case 403:throw new w(f.error.body,f.rawResponse);case 404:throw new l(f.error.body,f.rawResponse);case 429:throw new m(f.error.body,f.rawResponse);default:throw new a({statusCode:f.error.statusCode,body:f.error.body,rawResponse:f.rawResponse})}switch(f.error.reason){case"non-json":throw new a({statusCode:f.error.statusCode,body:f.error.rawBody,rawResponse:f.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/memory/recall.");case"unknown":throw new a({message:f.error.errorMessage,rawResponse:f.rawResponse})}}store(s,e){return h.fromPromise(this.__store(s,e))}async __store(s,e){let t=await(this._options.fetcher??y)({url:Re(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/memory/store"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/memory/store.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}getLineage(s,e){return h.fromPromise(this.__getLineage(s,e))}async __getLineage(s,e){let{memoryGid:t}=s,r=await(this._options.fetcher??y)({url:Re(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/memory/store/${encodeURIComponent(t)}/lineage`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/memory/store/{memoryGid}/lineage.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getRetrievalHistory(s,e){return h.fromPromise(this.__getRetrievalHistory(s,e))}async __getRetrievalHistory(s,e){let{memoryGid:t,days:r}=s,o={};r!=null&&(o.days=r.toString());let n=await(this._options.fetcher??y)({url:Re(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/memory/store/${encodeURIComponent(t)}/retrieval-history`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/memory/store/{memoryGid}/retrieval-history.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}listByTeam(s,e){return h.fromPromise(this.__listByTeam(s,e))}async __listByTeam(s,e){let{teamGid:t,limit:r}=s,o={};o.teamGid=t,r!=null&&(o.limit=r.toString());let n=await(this._options.fetcher??y)({url:Re(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/memory/store/by-team"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/memory/store/by-team.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}list(s={},e){return h.fromPromise(this.__list(s,e))}async __list(s={},e){let{type:t,limit:r}=s,o={};t!=null&&(o.type=t),r!=null&&(o.limit=r.toString());let n=await(this._options.fetcher??y)({url:Re(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/memory/store/list"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/memory/store/list.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getQuarantineSummary(s){return h.fromPromise(this.__getQuarantineSummary(s))}async __getQuarantineSummary(s){let e=await(this._options.fetcher??y)({url:Re(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/memory/store/quarantine-summary"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/memory/store/quarantine-summary.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}listQuarantined(s={},e){return h.fromPromise(this.__listQuarantined(s,e))}async __listQuarantined(s={},e){let{limit:t}=s,r={};t!=null&&(r.limit=t.toString());let o=await(this._options.fetcher??y)({url:Re(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/memory/store/quarantined"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/memory/store/quarantined.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Zp from"url-join";var Os=class{static{v(this,"Rag")}_options;constructor(s){this._options=s}searchDualAuth(s,e){return h.fromPromise(this.__searchDualAuth(s,e))}async __searchDualAuth(s,e){let t=await(this._options.fetcher??y)({url:Zp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/memory/search"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/memory/search.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}searchExplainDualAuth(s,e){return h.fromPromise(this.__searchExplainDualAuth(s,e))}async __searchExplainDualAuth(s,e){let t=await(this._options.fetcher??y)({url:Zp(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/memory/search/explain"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/memory/search/explain.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import $ from"url-join";var $s=class{static{v(this,"Observability")}_options;constructor(s){this._options=s}getMetrics(s,e){return h.fromPromise(this.__getMetrics(s,e))}async __getMetrics(s,e){let{name:t,startTime:r,endTime:o,agentGid:n,labels:d}=s,b={};b.name=t,b.startTime=r.toString(),o!=null&&(b.endTime=o.toString()),n!=null&&(b.agentGid=n),d!=null&&(b.labels=le(d));let f=await(this._options.fetcher??y)({url:$(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/metrics"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:b,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(f.ok)return{data:f.body,rawResponse:f.rawResponse};if(f.error.reason==="status-code")switch(f.error.statusCode){case 400:throw new u(f.error.body,f.rawResponse);case 401:throw new c(f.error.body,f.rawResponse);case 403:throw new w(f.error.body,f.rawResponse);case 404:throw new l(f.error.body,f.rawResponse);case 429:throw new m(f.error.body,f.rawResponse);default:throw new a({statusCode:f.error.statusCode,body:f.error.body,rawResponse:f.rawResponse})}switch(f.error.reason){case"non-json":throw new a({statusCode:f.error.statusCode,body:f.error.rawBody,rawResponse:f.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/metrics.");case"unknown":throw new a({message:f.error.errorMessage,rawResponse:f.rawResponse})}}aggregateMetrics(s,e){return h.fromPromise(this.__aggregateMetrics(s,e))}async __aggregateMetrics(s,e){let{name:t,startTime:r,endTime:o,aggregation:n,groupBy:d}=s,b={};b.name=t,b.startTime=r.toString(),o!=null&&(b.endTime=o.toString()),b.aggregation=n,d!=null&&(b.groupBy=d);let f=await(this._options.fetcher??y)({url:$(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/metrics/aggregate"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:b,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(f.ok)return{data:f.body,rawResponse:f.rawResponse};if(f.error.reason==="status-code")switch(f.error.statusCode){case 400:throw new u(f.error.body,f.rawResponse);case 401:throw new c(f.error.body,f.rawResponse);case 403:throw new w(f.error.body,f.rawResponse);case 404:throw new l(f.error.body,f.rawResponse);case 429:throw new m(f.error.body,f.rawResponse);default:throw new a({statusCode:f.error.statusCode,body:f.error.body,rawResponse:f.rawResponse})}switch(f.error.reason){case"non-json":throw new a({statusCode:f.error.statusCode,body:f.error.rawBody,rawResponse:f.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/metrics/aggregate.");case"unknown":throw new a({message:f.error.errorMessage,rawResponse:f.rawResponse})}}getSystemMetrics(s){return h.fromPromise(this.__getSystemMetrics(s))}async __getSystemMetrics(s){let e=await(this._options.fetcher??y)({url:$(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/metrics/system"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/metrics/system.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}getActiveAlerts(s={},e){return h.fromPromise(this.__getActiveAlerts(s,e))}async __getActiveAlerts(s={},e){let{severity:t}=s,r={};t!=null&&(r.severity=t);let o=await(this._options.fetcher??y)({url:$(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/observability/alerts"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/observability/alerts.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}acknowledgeAlert(s,e){return h.fromPromise(this.__acknowledgeAlert(s,e))}async __acknowledgeAlert(s,e){let t=await(this._options.fetcher??y)({url:$(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/observability/alerts/acknowledge"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/observability/alerts/acknowledge.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}resolveAlert(s,e){return h.fromPromise(this.__resolveAlert(s,e))}async __resolveAlert(s,e){let t=await(this._options.fetcher??y)({url:$(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/observability/alerts/resolve"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/observability/alerts/resolve.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}getErrors(s={},e){return h.fromPromise(this.__getErrors(s,e))}async __getErrors(s={},e){let{status:t,limit:r}=s,o={};t!=null&&(o.status=t),r!=null&&(o.limit=r.toString());let n=await(this._options.fetcher??y)({url:$(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/observability/errors"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/observability/errors.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}listErrorsByAgent(s,e){return h.fromPromise(this.__listErrorsByAgent(s,e))}async __listErrorsByAgent(s,e){let{agentGid:t,status:r,limit:o}=s,n={};n.agentGid=t,r!=null&&(n.status=r),o!=null&&(n.limit=o.toString());let d=await(this._options.fetcher??y)({url:$(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/observability/errors/by-agent"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/observability/errors/by-agent.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}listErrorsByExecution(s,e){return h.fromPromise(this.__listErrorsByExecution(s,e))}async __listErrorsByExecution(s,e){let{executionGid:t,limit:r}=s,o={};o.executionGid=t,r!=null&&(o.limit=r.toString());let n=await(this._options.fetcher??y)({url:$(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/observability/errors/by-execution"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/observability/errors/by-execution.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getErrorDistribution(s,e){return h.fromPromise(this.__getErrorDistribution(s,e))}async __getErrorDistribution(s,e){let{startTime:t,endTime:r,byField:o,limit:n}=s,d={};d.startTime=t.toString(),r!=null&&(d.endTime=r.toString()),o!=null&&(d.byField=o),n!=null&&(d.limit=n.toString());let b=await(this._options.fetcher??y)({url:$(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/observability/errors/distribution"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:d,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(b.ok)return{data:b.body,rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new u(b.error.body,b.rawResponse);case 401:throw new c(b.error.body,b.rawResponse);case 403:throw new w(b.error.body,b.rawResponse);case 404:throw new l(b.error.body,b.rawResponse);case 429:throw new m(b.error.body,b.rawResponse);default:throw new a({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}switch(b.error.reason){case"non-json":throw new a({statusCode:b.error.statusCode,body:b.error.rawBody,rawResponse:b.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/observability/errors/distribution.");case"unknown":throw new a({message:b.error.errorMessage,rawResponse:b.rawResponse})}}resolveError(s,e){return h.fromPromise(this.__resolveError(s,e))}async __resolveError(s,e){let t=await(this._options.fetcher??y)({url:$(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/observability/errors/resolve"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/observability/errors/resolve.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}getTrace(s,e){return h.fromPromise(this.__getTrace(s,e))}async __getTrace(s,e){let{traceId:t}=s,r=await(this._options.fetcher??y)({url:$(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/observability/traces/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/observability/traces/{traceId}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import tr from"url-join";var Ks=class{static{v(this,"Overview")}_options;constructor(s){this._options=s}getActiveTriggers(s={},e){return h.fromPromise(this.__getActiveTriggers(s,e))}async __getActiveTriggers(s={},e){let{limit:t}=s,r={};t!=null&&(r.limit=t.toString());let o=await(this._options.fetcher??y)({url:tr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/overview/active-triggers"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/overview/active-triggers.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getMemoryHealth(s){return h.fromPromise(this.__getMemoryHealth(s))}async __getMemoryHealth(s){let e=await(this._options.fetcher??y)({url:tr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/overview/memory-health"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/overview/memory-health.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}getMetricsSummary(s){return h.fromPromise(this.__getMetricsSummary(s))}async __getMetricsSummary(s){let e=await(this._options.fetcher??y)({url:tr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/overview/metrics-summary"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/overview/metrics-summary.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}getStats(s){return h.fromPromise(this.__getStats(s))}async __getStats(s){let e=await(this._options.fetcher??y)({url:tr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/overview/stats"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/overview/stats.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}getTopAgents(s={},e){return h.fromPromise(this.__getTopAgents(s,e))}async __getTopAgents(s={},e){let{limit:t}=s,r={};t!=null&&(r.limit=t.toString());let o=await(this._options.fetcher??y)({url:tr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/overview/top-agents"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/overview/top-agents.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import nr from"url-join";var Js=class{static{v(this,"SelfKnowledge")}_options;constructor(s){this._options=s}list(s={},e){return h.fromPromise(this.__list(s,e))}async __list(s={},e){let{category:t,activeOnly:r,limit:o}=s,n={};t!=null&&(n.category=t),r!=null&&(n.activeOnly=r.toString()),o!=null&&(n.limit=o.toString());let d=await(this._options.fetcher??y)({url:nr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/self-knowledge"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/self-knowledge.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}record(s,e){return h.fromPromise(this.__record(s,e))}async __record(s,e){let t=await(this._options.fetcher??y)({url:nr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/self-knowledge"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/self-knowledge.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}retrieve(s,e){return h.fromPromise(this.__retrieve(s,e))}async __retrieve(s,e){let{knowledgeGid:t}=s,r=await(this._options.fetcher??y)({url:nr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/self-knowledge/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/self-knowledge/{knowledgeGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}setActive(s,e){return h.fromPromise(this.__setActive(s,e))}async __setActive(s,e){let{knowledgeGid:t,...r}=s,o=await(this._options.fetcher??y)({url:nr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/self-knowledge/${encodeURIComponent(t)}/active`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/self-knowledge/{knowledgeGid}/active.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}validate(s,e){return h.fromPromise(this.__validate(s,e))}async __validate(s,e){let{knowledgeGid:t}=s,r=await(this._options.fetcher??y)({url:nr(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/self-knowledge/${encodeURIComponent(t)}/validate`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/self-knowledge/{knowledgeGid}/validate.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import ar from"url-join";var Qs=class{static{v(this,"SkillSynthesis")}_options;constructor(s){this._options=s}list(s,e){return h.fromPromise(this.__list(s,e))}async __list(s,e){let{agentGid:t,status:r,category:o}=s,n={};n.agentGid=t,r!=null&&(n.status=r),o!=null&&(n.category=o);let d=await(this._options.fetcher??y)({url:ar(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/skill-synthesis"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/skill-synthesis.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}retrieve(s,e){return h.fromPromise(this.__retrieve(s,e))}async __retrieve(s,e){let{skillGid:t}=s,r=await(this._options.fetcher??y)({url:ar(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/skill-synthesis/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/skill-synthesis/{skillGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}promote(s,e){return h.fromPromise(this.__promote(s,e))}async __promote(s,e){let{skillGid:t,...r}=s,o=await(this._options.fetcher??y)({url:ar(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/skill-synthesis/${encodeURIComponent(t)}/promote`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/skill-synthesis/{skillGid}/promote.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getForTool(s,e){return h.fromPromise(this.__getForTool(s,e))}async __getForTool(s,e){let{agentGid:t}=s,r={};r.agentGid=t;let o=await(this._options.fetcher??y)({url:ar(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/skill-synthesis/for-tool"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/skill-synthesis/for-tool.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}runPipeline(s={},e){return h.fromPromise(this.__runPipeline(s,e))}async __runPipeline(s={},e){let t=await(this._options.fetcher??y)({url:ar(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/skill-synthesis/run-pipeline"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/skill-synthesis/run-pipeline.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Z from"url-join";var Vs=class{static{v(this,"Skills")}_options;constructor(s){this._options=s}list(s={},e){return h.fromPromise(this.__list(s,e))}async __list(s={},e){let{category:t,enabledOnly:r,includeBuiltIn:o}=s,n={};t!=null&&(n.category=t),r!=null&&(n.enabledOnly=r.toString()),o!=null&&(n.includeBuiltIn=o.toString());let d=await(this._options.fetcher??y)({url:Z(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/skills"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/skills.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}create(s,e){return h.fromPromise(this.__create(s,e))}async __create(s,e){let t=await(this._options.fetcher??y)({url:Z(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/skills"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/skills.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}retrieve(s,e){return h.fromPromise(this.__retrieve(s,e))}async __retrieve(s,e){let{skillGid:t}=s,r=await(this._options.fetcher??y)({url:Z(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/skills/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/skills/{skillGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}remove(s,e){return h.fromPromise(this.__remove(s,e))}async __remove(s,e){let{skillGid:t}=s,r=await(this._options.fetcher??y)({url:Z(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/skills/${encodeURIComponent(t)}`),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/primus/skills/{skillGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(s,e){return h.fromPromise(this.__update(s,e))}async __update(s,e){let{skillGid:t,...r}=s,o=await(this._options.fetcher??y)({url:Z(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/skills/${encodeURIComponent(t)}`),method:"PATCH",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PATCH /v1/primus/skills/{skillGid}.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}disable(s,e){return h.fromPromise(this.__disable(s,e))}async __disable(s,e){let{skillGid:t}=s,r=await(this._options.fetcher??y)({url:Z(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/skills/${encodeURIComponent(t)}/disable`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/skills/{skillGid}/disable.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}enable(s,e){return h.fromPromise(this.__enable(s,e))}async __enable(s,e){let{skillGid:t}=s,r=await(this._options.fetcher??y)({url:Z(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/skills/${encodeURIComponent(t)}/enable`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/skills/{skillGid}/enable.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getWithExecutions(s,e){return h.fromPromise(this.__getWithExecutions(s,e))}async __getWithExecutions(s,e){let{skillGid:t,executionLimit:r}=s,o={};r!=null&&(o.executionLimit=r.toString());let n=await(this._options.fetcher??y)({url:Z(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/skills/${encodeURIComponent(t)}/executions`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/skills/{skillGid}/executions.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getStats(s,e){return h.fromPromise(this.__getStats(s,e))}async __getStats(s,e){let{skillGid:t,limit:r,startTime:o,endTime:n}=s,d={};r!=null&&(d.limit=r.toString()),o!=null&&(d.startTime=o.toString()),n!=null&&(d.endTime=n.toString());let b=await(this._options.fetcher??y)({url:Z(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/skills/${encodeURIComponent(t)}/stats`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:d,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(b.ok)return{data:b.body,rawResponse:b.rawResponse};if(b.error.reason==="status-code")switch(b.error.statusCode){case 400:throw new u(b.error.body,b.rawResponse);case 401:throw new c(b.error.body,b.rawResponse);case 403:throw new w(b.error.body,b.rawResponse);case 404:throw new l(b.error.body,b.rawResponse);case 429:throw new m(b.error.body,b.rawResponse);default:throw new a({statusCode:b.error.statusCode,body:b.error.body,rawResponse:b.rawResponse})}switch(b.error.reason){case"non-json":throw new a({statusCode:b.error.statusCode,body:b.error.rawBody,rawResponse:b.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/skills/{skillGid}/stats.");case"unknown":throw new a({message:b.error.errorMessage,rawResponse:b.rawResponse})}}listBuiltIn(s={},e){return h.fromPromise(this.__listBuiltIn(s,e))}async __listBuiltIn(s={},e){let{category:t}=s,r={};t!=null&&(r.category=t);let o=await(this._options.fetcher??y)({url:Z(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/skills/built-in"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/skills/built-in.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}listByCategory(s,e){return h.fromPromise(this.__listByCategory(s,e))}async __listByCategory(s,e){let{category:t}=s,r={};r.category=t;let o=await(this._options.fetcher??y)({url:Z(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/skills/by-category"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/skills/by-category.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import eu from"url-join";var Ys=class{static{v(this,"SpendCap")}_options;constructor(s){this._options=s}retrieve(s){return h.fromPromise(this.__retrieve(s))}async __retrieve(s){let e=await(this._options.fetcher??y)({url:eu(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/spend-cap"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/spend-cap.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}update(s,e){return h.fromPromise(this.__update(s,e))}async __update(s,e){let t=await(this._options.fetcher??y)({url:eu(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/spend-cap"),method:"PUT",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PUT /v1/primus/spend-cap.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import ee from"url-join";var Xs=class{static{v(this,"Teams")}_options;constructor(s){this._options=s}list(s={},e){return h.fromPromise(this.__list(s,e))}async __list(s={},e){let{status:t}=s,r={};t!=null&&(r.status=t);let o=await(this._options.fetcher??y)({url:ee(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/teams"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/teams.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}create(s={},e){return h.fromPromise(this.__create(s,e))}async __create(s={},e){let t=await(this._options.fetcher??y)({url:ee(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/teams"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/teams.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}retrieve(s,e){return h.fromPromise(this.__retrieve(s,e))}async __retrieve(s,e){let{teamGid:t}=s,r=await(this._options.fetcher??y)({url:ee(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/teams/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/teams/{teamGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}remove(s,e){return h.fromPromise(this.__remove(s,e))}async __remove(s,e){let{teamGid:t,reason:r}=s,o={};r!=null&&(o.reason=r);let n=await(this._options.fetcher??y)({url:ee(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/teams/${encodeURIComponent(t)}`),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/primus/teams/{teamGid}.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}update(s,e){return h.fromPromise(this.__update(s,e))}async __update(s,e){let{teamGid:t,...r}=s,o=await(this._options.fetcher??y)({url:ee(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/teams/${encodeURIComponent(t)}`),method:"PATCH",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PATCH /v1/primus/teams/{teamGid}.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}assignAgent(s,e){return h.fromPromise(this.__assignAgent(s,e))}async __assignAgent(s,e){let t=await(this._options.fetcher??y)({url:ee(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/teams/assign"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/teams/assign.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}delegateByTag(s,e){return h.fromPromise(this.__delegateByTag(s,e))}async __delegateByTag(s,e){let t=await(this._options.fetcher??y)({url:ee(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/teams/delegate"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/teams/delegate.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}addMember(s,e){return h.fromPromise(this.__addMember(s,e))}async __addMember(s,e){let t=await(this._options.fetcher??y)({url:ee(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/teams/members"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/teams/members.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}removeMember(s,e){return h.fromPromise(this.__removeMember(s,e))}async __removeMember(s,e){let t=await(this._options.fetcher??y)({url:ee(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/teams/remove-member"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/teams/remove-member.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}unassignAgent(s,e){return h.fromPromise(this.__unassignAgent(s,e))}async __unassignAgent(s,e){let t=await(this._options.fetcher??y)({url:ee(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/teams/unassign"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/teams/unassign.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}createWithSpecialists(s={},e){return h.fromPromise(this.__createWithSpecialists(s,e))}async __createWithSpecialists(s={},e){let t=await(this._options.fetcher??y)({url:ee(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/teams/with-specialists"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/teams/with-specialists.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Se from"url-join";var Zs=class{static{v(this,"Tenants")}_options;constructor(s){this._options=s}list(s){return h.fromPromise(this.__list(s))}async __list(s){let e=await(this._options.fetcher??y)({url:Se(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/tenants"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/tenants.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}create(s,e){return h.fromPromise(this.__create(s,e))}async __create(s,e){let t=await(this._options.fetcher??y)({url:Se(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/tenants"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/tenants.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}retrieve(s,e){return h.fromPromise(this.__retrieve(s,e))}async __retrieve(s,e){let{tenantGid:t}=s,r=await(this._options.fetcher??y)({url:Se(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/tenants/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/tenants/{tenantGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(s,e){return h.fromPromise(this.__update(s,e))}async __update(s,e){let{tenantGid:t,...r}=s,o=await(this._options.fetcher??y)({url:Se(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/tenants/${encodeURIComponent(t)}`),method:"PATCH",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PATCH /v1/primus/tenants/{tenantGid}.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}archive(s,e){return h.fromPromise(this.__archive(s,e))}async __archive(s,e){let{tenantGid:t}=s,r=await(this._options.fetcher??y)({url:Se(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/tenants/${encodeURIComponent(t)}/archive`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/tenants/{tenantGid}/archive.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}suspend(s,e){return h.fromPromise(this.__suspend(s,e))}async __suspend(s,e){let{tenantGid:t}=s,r=await(this._options.fetcher??y)({url:Se(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/tenants/${encodeURIComponent(t)}/suspend`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/tenants/{tenantGid}/suspend.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getByExternalId(s,e){return h.fromPromise(this.__getByExternalId(s,e))}async __getByExternalId(s,e){let{externalId:t}=s,r={};r.externalId=t;let o=await(this._options.fetcher??y)({url:Se(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/tenants/by-external-id"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/tenants/by-external-id.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import K from"url-join";var et=class{static{v(this,"Tools")}_options;constructor(s){this._options=s}list(s={},e){return h.fromPromise(this.__list(s,e))}async __list(s={},e){let{source:t,enabledOnly:r}=s,o={};t!=null&&(o.source=t),r!=null&&(o.enabledOnly=r.toString());let n=await(this._options.fetcher??y)({url:K(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/tools"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/tools.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}create(s,e){return h.fromPromise(this.__create(s,e))}async __create(s,e){let t=await(this._options.fetcher??y)({url:K(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/tools"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/tools.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}retrieve(s,e){return h.fromPromise(this.__retrieve(s,e))}async __retrieve(s,e){let{toolGid:t}=s,r=await(this._options.fetcher??y)({url:K(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/tools/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/tools/{toolGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}remove(s,e){return h.fromPromise(this.__remove(s,e))}async __remove(s,e){let{toolGid:t}=s,r=await(this._options.fetcher??y)({url:K(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/tools/${encodeURIComponent(t)}`),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/primus/tools/{toolGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(s,e){return h.fromPromise(this.__update(s,e))}async __update(s,e){let{toolGid:t,...r}=s,o=await(this._options.fetcher??y)({url:K(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/tools/${encodeURIComponent(t)}`),method:"PATCH",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PATCH /v1/primus/tools/{toolGid}.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}disable(s,e){return h.fromPromise(this.__disable(s,e))}async __disable(s,e){let{toolGid:t}=s,r=await(this._options.fetcher??y)({url:K(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/tools/${encodeURIComponent(t)}/disable`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/tools/{toolGid}/disable.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}enable(s,e){return h.fromPromise(this.__enable(s,e))}async __enable(s,e){let{toolGid:t}=s,r=await(this._options.fetcher??y)({url:K(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/tools/${encodeURIComponent(t)}/enable`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/tools/{toolGid}/enable.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}testCall(s,e){return h.fromPromise(this.__testCall(s,e))}async __testCall(s,e){let{toolGid:t,...r}=s,o=await(this._options.fetcher??y)({url:K(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/tools/${encodeURIComponent(t)}/test`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/tools/{toolGid}/test.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}getByName(s,e){return h.fromPromise(this.__getByName(s,e))}async __getByName(s,e){let{name:t}=s,r={};r.name=t;let o=await(this._options.fetcher??y)({url:K(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/tools/by-name"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/tools/by-name.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}importFromOpenApi(s={},e){return h.fromPromise(this.__importFromOpenApi(s,e))}async __importFromOpenApi(s={},e){let t=await(this._options.fetcher??y)({url:K(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/tools/import"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/tools/import.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}getStats(s={},e){return h.fromPromise(this.__getStats(s,e))}async __getStats(s={},e){let{agentGid:t,toolName:r,startTime:o,endTime:n,limit:d}=s,b={};t!=null&&(b.agentGid=t),r!=null&&(b.toolName=r),o!=null&&(b.startTime=o.toString()),n!=null&&(b.endTime=n.toString()),d!=null&&(b.limit=d.toString());let f=await(this._options.fetcher??y)({url:K(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/tools/stats"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:b,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(f.ok)return{data:f.body,rawResponse:f.rawResponse};if(f.error.reason==="status-code")switch(f.error.statusCode){case 400:throw new u(f.error.body,f.rawResponse);case 401:throw new c(f.error.body,f.rawResponse);case 403:throw new w(f.error.body,f.rawResponse);case 404:throw new l(f.error.body,f.rawResponse);case 429:throw new m(f.error.body,f.rawResponse);default:throw new a({statusCode:f.error.statusCode,body:f.error.body,rawResponse:f.rawResponse})}switch(f.error.reason){case"non-json":throw new a({statusCode:f.error.statusCode,body:f.error.rawBody,rawResponse:f.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/tools/stats.");case"unknown":throw new a({message:f.error.errorMessage,rawResponse:f.rawResponse})}}discover(s={},e){return h.fromPromise(this.__discover(s,e))}async __discover(s={},e){let{source:t,enabledOnly:r}=s,o={};t!=null&&(o.source=t),r!=null&&(o.enabledOnly=r.toString());let n=await(this._options.fetcher??y)({url:K(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/tools"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/tools.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import ie from"url-join";var rt=class{static{v(this,"Triggers")}_options;constructor(s){this._options=s}list(s={},e){return h.fromPromise(this.__list(s,e))}async __list(s={},e){let{type:t,enabled:r}=s,o={};t!=null&&(o.type=t),r!=null&&(o.enabled=r.toString());let n=await(this._options.fetcher??y)({url:ie(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/triggers"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/triggers.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}create(s,e){return h.fromPromise(this.__create(s,e))}async __create(s,e){let t=await(this._options.fetcher??y)({url:ie(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/triggers"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/triggers.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}retrieve(s,e){return h.fromPromise(this.__retrieve(s,e))}async __retrieve(s,e){let{triggerGid:t}=s,r=await(this._options.fetcher??y)({url:ie(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/triggers/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/triggers/{triggerGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}remove(s,e){return h.fromPromise(this.__remove(s,e))}async __remove(s,e){let{triggerGid:t}=s,r=await(this._options.fetcher??y)({url:ie(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/triggers/${encodeURIComponent(t)}`),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/primus/triggers/{triggerGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(s,e){return h.fromPromise(this.__update(s,e))}async __update(s,e){let{triggerGid:t,...r}=s,o=await(this._options.fetcher??y)({url:ie(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/triggers/${encodeURIComponent(t)}`),method:"PATCH",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PATCH /v1/primus/triggers/{triggerGid}.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}disable(s,e){return h.fromPromise(this.__disable(s,e))}async __disable(s,e){let{triggerGid:t}=s,r=await(this._options.fetcher??y)({url:ie(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/triggers/${encodeURIComponent(t)}/disable`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/triggers/{triggerGid}/disable.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}enable(s,e){return h.fromPromise(this.__enable(s,e))}async __enable(s,e){let{triggerGid:t}=s,r=await(this._options.fetcher??y)({url:ie(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/triggers/${encodeURIComponent(t)}/enable`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/triggers/{triggerGid}/enable.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getWithExecutions(s,e){return h.fromPromise(this.__getWithExecutions(s,e))}async __getWithExecutions(s,e){let{triggerGid:t,executionLimit:r}=s,o={};r!=null&&(o.executionLimit=r.toString());let n=await(this._options.fetcher??y)({url:ie(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/triggers/${encodeURIComponent(t)}/executions`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/triggers/{triggerGid}/executions.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}rotateSecret(s,e){return h.fromPromise(this.__rotateSecret(s,e))}async __rotateSecret(s,e){let{triggerGid:t}=s,r=await(this._options.fetcher??y)({url:ie(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/triggers/${encodeURIComponent(t)}/rotate-secret`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/triggers/{triggerGid}/rotate-secret.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listByAgent(s,e){return h.fromPromise(this.__listByAgent(s,e))}async __listByAgent(s,e){let{agentGid:t,enabledOnly:r}=s,o={};o.agentGid=t,r!=null&&(o.enabledOnly=r.toString());let n=await(this._options.fetcher??y)({url:ie(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/triggers/by-agent"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/triggers/by-agent.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import ot from"url-join";var st=class{static{v(this,"Usage")}_options;constructor(s){this._options=s}byTenant(s,e){return h.fromPromise(this.__byTenant(s,e))}async __byTenant(s,e){let{tenantId:t,dayUtcMs:r}=s,o={};o.tenantId=t,o.dayUtcMs=r.toString();let n=await(this._options.fetcher??y)({url:ot(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/usage/by-tenant"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/usage/by-tenant.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getHistory(s,e){return h.fromPromise(this.__getHistory(s,e))}async __getHistory(s,e){let{startMs:t,endMs:r,granularity:o}=s,n={};n.startMs=t.toString(),n.endMs=r.toString(),o!=null&&(n.granularity=o);let d=await(this._options.fetcher??y)({url:ot(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/usage/history"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/usage/history.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}checkLimits(s){return h.fromPromise(this.__checkLimits(s))}async __checkLimits(s){let e=await(this._options.fetcher??y)({url:ot(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/usage/limits"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/usage/limits.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}getSummary(s={},e){return h.fromPromise(this.__getSummary(s,e))}async __getSummary(s={},e){let{tenantId:t}=s,r={};t!=null&&(r.tenantId=t);let o=await(this._options.fetcher??y)({url:ot(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/usage/summary"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/usage/summary.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Ln from"url-join";var tt=class{static{v(this,"Webhooks")}_options;constructor(s){this._options=s}list(s){return h.fromPromise(this.__list(s))}async __list(s){let e=await(this._options.fetcher??y)({url:Ln(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/webhooks"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/primus/webhooks.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}create(s,e){return h.fromPromise(this.__create(s,e))}async __create(s,e){let t=await(this._options.fetcher??y)({url:Ln(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/webhooks"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/webhooks.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}remove(s,e){return h.fromPromise(this.__remove(s,e))}async __remove(s,e){let{webhookId:t}=s,r=await(this._options.fetcher??y)({url:Ln(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/primus/webhooks/${encodeURIComponent(t)}`),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/primus/webhooks/{webhookId}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};var nt=class{static{v(this,"Primus")}_options;_agentGoals;_agents;_approvals;_brainConfig;_brainModels;_configPromotion;_conversations;_actions;_delegations;_entitlements;_execution;_guardrailOutcomes;_integrations;_killSwitch;_learning;_stats;_mcpConnect;_mcpServers;_mcpOauth;_memoriesEncrypted;_memories;_memory;_rag;_observability;_overview;_selfKnowledge;_skillSynthesis;_skills;_spendCap;_teams;_tenants;_tools;_triggers;_usage;_webhooks;constructor(s){this._options=s}get agentGoals(){return this._agentGoals??=new fs(this._options)}get agents(){return this._agents??=new Es(this._options)}get approvals(){return this._approvals??=new Ss(this._options)}get brainConfig(){return this._brainConfig??=new _s(this._options)}get brainModels(){return this._brainModels??=new ks(this._options)}get configPromotion(){return this._configPromotion??=new Ts(this._options)}get conversations(){return this._conversations??=new Cs(this._options)}get actions(){return this._actions??=new xs(this._options)}get delegations(){return this._delegations??=new As(this._options)}get entitlements(){return this._entitlements??=new Is(this._options)}get execution(){return this._execution??=new Gs(this._options)}get guardrailOutcomes(){return this._guardrailOutcomes??=new Ms(this._options)}get integrations(){return this._integrations??=new Hs(this._options)}get killSwitch(){return this._killSwitch??=new qs(this._options)}get learning(){return this._learning??=new Bs(this._options)}get stats(){return this._stats??=new Us(this._options)}get mcpConnect(){return this._mcpConnect??=new zs(this._options)}get mcpServers(){return this._mcpServers??=new Fs(this._options)}get mcpOauth(){return this._mcpOauth??=new js(this._options)}get memoriesEncrypted(){return this._memoriesEncrypted??=new Ds(this._options)}get memories(){return this._memories??=new Ls(this._options)}get memory(){return this._memory??=new Ws(this._options)}get rag(){return this._rag??=new Os(this._options)}get observability(){return this._observability??=new $s(this._options)}get overview(){return this._overview??=new Ks(this._options)}get selfKnowledge(){return this._selfKnowledge??=new Js(this._options)}get skillSynthesis(){return this._skillSynthesis??=new Qs(this._options)}get skills(){return this._skills??=new Vs(this._options)}get spendCap(){return this._spendCap??=new Ys(this._options)}get teams(){return this._teams??=new Xs(this._options)}get tenants(){return this._tenants??=new Zs(this._options)}get tools(){return this._tools??=new et(this._options)}get triggers(){return this._triggers??=new rt(this._options)}get usage(){return this._usage??=new st(this._options)}get webhooks(){return this._webhooks??=new tt(this._options)}};import ir from"url-join";var at=class{static{v(this,"Tenants")}_options;constructor(s){this._options=s}list(s={},e){return h.fromPromise(this.__list(s,e))}async __list(s={},e){let{platformId:t,status:r}=s,o={};t!=null&&(o.platformId=t),r!=null&&(o.status=r);let n=await(this._options.fetcher??y)({url:ir(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/tenants"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/tenants.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}upsert(s,e){return h.fromPromise(this.__upsert(s,e))}async __upsert(s,e){let t=await(this._options.fetcher??y)({url:ir(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/tenants"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/tenants.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}activate(s,e){return h.fromPromise(this.__activate(s,e))}async __activate(s,e){let{tenantId:t}=s,r=await(this._options.fetcher??y)({url:ir(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/tenants/${encodeURIComponent(t)}/activate`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/tenants/{tenantId}/activate.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}close(s,e){return h.fromPromise(this.__close(s,e))}async __close(s,e){let{tenantId:t,"Idempotency-Key":r}=s,o=await(this._options.fetcher??y)({url:ir(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/tenants/${encodeURIComponent(t)}/close`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/tenants/{tenantId}/close.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}suspend(s,e){return h.fromPromise(this.__suspend(s,e))}async __suspend(s,e){let{tenantId:t}=s,r=await(this._options.fetcher??y)({url:ir(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/tenants/${encodeURIComponent(t)}/suspend`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/tenants/{tenantId}/suspend.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};import Nc from"url-join";var it=class{static{v(this,"ActAs")}_options;constructor(s){this._options=s}actAs(s,e){return h.fromPromise(this.__actAs(s,e))}async __actAs(s,e){let t=await(this._options.fetcher??y)({url:Nc(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/tenants/act-as"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new u(t.error.body,t.rawResponse);case 401:throw new c(t.error.body,t.rawResponse);case 403:throw new w(t.error.body,t.rawResponse);case 404:throw new l(t.error.body,t.rawResponse);case 429:throw new m(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/tenants/act-as.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};var dt=class{static{v(this,"Tenants")}_options;_tenants;_actAs;constructor(s){this._options=s}get tenants(){return this._tenants??=new at(this._options)}get actAs(){return this._actAs??=new it(this._options)}};import _e from"url-join";var pt=class{static{v(this,"Webhooks")}_options;constructor(s){this._options=s}list(s={},e){return h.fromPromise(this.__list(s,e))}async __list(s={},e){let{status:t,cursor:r,limit:o}=s,n={};t!=null&&(n.status=t),r!=null&&(n.cursor=r),o!=null&&(n.limit=o.toString());let d=await(this._options.fetcher??y)({url:_e(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/webhooks"),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 400:throw new u(d.error.body,d.rawResponse);case 401:throw new c(d.error.body,d.rawResponse);case 403:throw new w(d.error.body,d.rawResponse);case 404:throw new l(d.error.body,d.rawResponse);case 429:throw new m(d.error.body,d.rawResponse);default:throw new a({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new a({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/webhooks.");case"unknown":throw new a({message:d.error.errorMessage,rawResponse:d.rawResponse})}}create(s,e){return h.fromPromise(this.__create(s,e))}async __create(s,e){let{"Idempotency-Key":t,...r}=s,o=await(this._options.fetcher??y)({url:_e(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/webhooks"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":t??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/webhooks.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}get(s,e){return h.fromPromise(this.__get(s,e))}async __get(s,e){let{webhookGid:t}=s,r=await(this._options.fetcher??y)({url:_e(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/webhooks/${encodeURIComponent(t)}`),method:"GET",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling GET /v1/webhooks/{webhookGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}revoke(s,e){return h.fromPromise(this.__revoke(s,e))}async __revoke(s,e){let{webhookGid:t,reason:r}=s,o={};r!=null&&(o.reason=r);let n=await(this._options.fetcher??y)({url:_e(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/webhooks/${encodeURIComponent(t)}`),method:"DELETE",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new u(n.error.body,n.rawResponse);case 401:throw new c(n.error.body,n.rawResponse);case 403:throw new w(n.error.body,n.rawResponse);case 404:throw new l(n.error.body,n.rawResponse);case 429:throw new m(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new p("Timeout exceeded when calling DELETE /v1/webhooks/{webhookGid}.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}update(s,e){return h.fromPromise(this.__update(s,e))}async __update(s,e){let{webhookGid:t,...r}=s,o=await(this._options.fetcher??y)({url:_e(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/webhooks/${encodeURIComponent(t)}`),method:"PATCH",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling PATCH /v1/webhooks/{webhookGid}.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}revealSecret(s,e){return h.fromPromise(this.__revealSecret(s,e))}async __revealSecret(s,e){let{webhookGid:t}=s,r=await(this._options.fetcher??y)({url:_e(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/webhooks/${encodeURIComponent(t)}/reveal-secret`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new u(r.error.body,r.rawResponse);case 401:throw new c(r.error.body,r.rawResponse);case 403:throw new w(r.error.body,r.rawResponse);case 404:throw new l(r.error.body,r.rawResponse);case 429:throw new m(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/webhooks/{webhookGid}/reveal-secret.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}rotateSecret(s,e){return h.fromPromise(this.__rotateSecret(s,e))}async __rotateSecret(s,e){let{webhookGid:t,...r}=s,o=await(this._options.fetcher??y)({url:_e(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,`v1/webhooks/${encodeURIComponent(t)}/rotate-secret`),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")switch(o.error.statusCode){case 400:throw new u(o.error.body,o.rawResponse);case 401:throw new c(o.error.body,o.rawResponse);case 403:throw new w(o.error.body,o.rawResponse);case 404:throw new l(o.error.body,o.rawResponse);case 429:throw new m(o.error.body,o.rawResponse);default:throw new a({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse})}switch(o.error.reason){case"non-json":throw new a({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/webhooks/{webhookGid}/rotate-secret.");case"unknown":throw new a({message:o.error.errorMessage,rawResponse:o.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};var ut=class{static{v(this,"Webhooks")}_options;_webhooks;constructor(s){this._options=s}get webhooks(){return this._webhooks??=new pt(this._options)}};var je=class{static{v(this,"NPayloadClient")}_options;_account;_analytics;_audit;_billing;_connect;_embed;_events;_feed;_notify;_pipes;_primus;_tenants;_webhooks;constructor(s){this._options={...s,headers:R({"X-Fern-Language":"JavaScript","X-Fern-Runtime":q.type,"X-Fern-Runtime-Version":q.version},s?.headers)}}get account(){return this._account??=new gr(this._options)}get analytics(){return this._analytics??=new Er(this._options)}get audit(){return this._audit??=new kr(this._options)}get billing(){return this._billing??=new Kr(this._options)}get connect(){return this._connect??=new ao(this._options)}get embed(){return this._embed??=new uo(this._options)}get events(){return this._events??=new Oo(this._options)}get feed(){return this._feed??=new Zo(this._options)}get notify(){return this._notify??=new is(this._options)}get pipes(){return this._pipes??=new vs(this._options)}get primus(){return this._primus??=new nt(this._options)}get tenants(){return this._tenants??=new dt(this._options)}get webhooks(){return this._webhooks??=new ut(this._options)}chatStream(s){return h.fromPromise(this.__chatStream(s))}async __chatStream(s){let e=await(this._options.fetcher??y)({url:vc(await i.get(this._options.baseUrl)??await i.get(this._options.environment)??P.Production,"v1/primus/chat/stream-pipeline"),method:"POST",headers:R(this._options?.headers,g({Authorization:await this._getAuthorizationHeader()}),s?.headers),timeoutMs:s?.timeoutInSeconds!=null?s.timeoutInSeconds*1e3:6e4,maxRetries:s?.maxRetries,abortSignal:s?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new u(e.error.body,e.rawResponse);case 401:throw new c(e.error.body,e.rawResponse);case 403:throw new w(e.error.body,e.rawResponse);case 404:throw new l(e.error.body,e.rawResponse);case 429:throw new m(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new p("Timeout exceeded when calling POST /v1/primus/chat/stream-pipeline.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await i.get(this._options.token)}`}};var De=class extends a{static{v(this,"NPayloadPlanRequiredError")}code;product;upgradeUrl;requestId;constructor(s){super({message:s.message,statusCode:402,body:{code:s.code,message:s.message,...s.npp!==void 0?{npp:s.npp}:{}},...s.rawResponse!==void 0?{rawResponse:s.rawResponse}:{}}),Object.setPrototypeOf(this,new.target.prototype),this.name="NPayloadPlanRequiredError",this.code=s.code,this.product=s.product,this.upgradeUrl=s.upgradeUrl,this.requestId=s.requestId}};var Le=class extends a{static{v(this,"NPayloadSourceNotAllowedError")}code;reason;requestId;constructor(s){let e=s.statusCode??403;super({message:s.message,statusCode:e,body:{code:s.code,message:s.message},...s.rawResponse!==void 0?{rawResponse:s.rawResponse}:{}}),Object.setPrototypeOf(this,new.target.prototype),this.name="NPayloadSourceNotAllowedError",this.code=s.code,this.reason=s.code.toLowerCase()==="source_network_not_declared"?"not_declared":"not_allowed",this.requestId=s.requestId}},We=class extends a{static{v(this,"NPayloadFingerprintNotEnrolledError")}code;fingerprint;requestId;constructor(s){let e=s.statusCode??403;super({message:s.message,statusCode:e,body:{code:s.code,message:s.message,...s.fingerprint!==void 0?{fingerprint:s.fingerprint}:{}},...s.rawResponse!==void 0?{rawResponse:s.rawResponse}:{}}),Object.setPrototypeOf(this,new.target.prototype),this.name="NPayloadFingerprintNotEnrolledError",this.code=s.code,this.fingerprint=s.fingerprint,this.requestId=s.requestId}};var ke={specVersions:{cell:"5.0.4",feed:"1.0.0",primus:"3.0.0"},apiVersions:["v1"],shapes:[{a:{p:["circuitBreaker","circuitState","config","createdAt","credentialsVaultKey","description","gid","healthy","lastHealthCheck","name","orgAdapterRegistryId","status","tags","type","updatedAt","usage","version"],c:{circuitBreaker:{p:["failureCount","halfOpenAt","lastFailureAt","openedAt","state","successCount"]},lastHealthCheck:{p:["healthy","latencyMs","message","timestamp"]},usage:{p:["lastUsedAt","totalFailed","totalMessages","totalSuccessful"]}}}},{p:["gid"]},{p:["circuitBreaker","circuitState","config","createdAt","credentialsVaultKey","description","gid","healthy","lastHealthCheck","name","orgAdapterRegistryId","status","tags","type","updatedAt","usage","version"],c:{circuitBreaker:{p:["failureCount","halfOpenAt","lastFailureAt","openedAt","state","successCount"]},lastHealthCheck:{p:["healthy","latencyMs","message","timestamp"]},usage:{p:["lastUsedAt","totalFailed","totalMessages","totalSuccessful"]}}},{p:["success"]},{p:["deleted","gid"]},{a:{p:["connectGrantGid","effectiveRetentionMs","feedListingGid","gid","kernelTable","kernelTableId","name","origin","routedSchemaRef","slug","status","threatScan","type"],c:{routedSchemaRef:{a:{p:["eventType","version"]}},threatScan:{p:["level","required"]}}}},{p:["effectiveRetentionMs","gid","kernelTable","kernelTableId","name","routedSchemaRef","slug","status","threatScan","type"],c:{routedSchemaRef:{a:{p:["eventType","version"]}},threatScan:{p:["level","required"]}}},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["effectiveRetentionMs","gid","kernelTable","kernelTableId","name","routedSchemaRef","slug","status","threatScan","type"],c:{routedSchemaRef:{a:{p:["eventType","version"]}},threatScan:{p:["level","required"]}}}}}},{a:{p:["effectiveRetentionMs","gid","kernelTable","kernelTableId","name","routedSchemaRef","slug","stats","status","threatScan","type"],c:{routedSchemaRef:{a:{p:["eventType","version"]}},stats:{p:["bindingCount","dlqDepth","groupCount","messageCount","subCount"]},threatScan:{p:["level","required"]}}}},{a:{p:["attemptCount","attemptHistory","createdAt","deliveredAt","expiresAt","gid","lastAttemptAt","lastError","maxAttempts","messageGid","metadata","nextAttemptAt","partitionKey","response","scheduledAt","status","subscriptionGid","tombstonedAt","updatedAt"],c:{attemptHistory:{a:{p:["attemptNumber","attemptedAt","error","latencyMs","statusCode"]}},lastError:{p:["code","message","retryable"]},response:{p:["latencyMs","statusCode"]}}}},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["adapterDlqSlug","adapterType","attemptCount","createdAt","expiresAt","failedAt","failureAttempts","failureCount","failureReason","frameHash","frameSeq","gid","hlcTimestamp","lastError","lastErrorMessage","lastFailureReason","lastFailureTimestamp","lastHttpStatus","messageGid","orgId","originalMetadata","originalPayload","producerThumbprint","rejectionReason","reprocessHistory","reprocessResult","reprocessedAt","reprocessedBy","status","subscriptionGid","suppressedFailureEmits","updatedAt"],c:{reprocessHistory:{a:{p:["actor","at","note","result"]}},suppressedFailureEmits:{a:{p:["eventType","failureSourceChannelSlug","failureSourceSubscriptionGid","reason","redirectedTo","targetChannelSlug"]}}}}}}},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["algorithm","createdAt","gid","jwkThumbprint","revokedAt","status"]}}}},{p:["gid","jwkThumbprint"]},{p:["gid","status"]},{a:{p:["action","channels","createdAt","currentVersion","deprecated","deprecatedFields","deprecationMessage","description","displayName","domain","entity","gid","name","ownership","publisherDeclaration","schema","status","sunsetDate","tags","updatedAt"],c:{ownership:{p:["contact","slackChannel","team"]},publisherDeclaration:{p:["eventTypeName","signedAt","signedBy","statement"]},schema:{p:["definition","format"]}}}},{a:{p:["action","channels","createdAt","currentVersion","deprecated","deprecatedFields","deprecationMessage","description","displayName","domain","entity","gid","name","ownership","publisherDeclaration","status","sunsetDate","tags","updatedAt"],c:{ownership:{p:["contact","slackChannel","team"]},publisherDeclaration:{p:["eventTypeName","signedAt","signedBy","statement"]}}}},{a:{p:["attributes","channelGid","connectTier","createdAt","deliveryStats","entityRef","expiresAt","federationEntityId","gid","grantId","groupId","groupSequence","groupSize","idempotencyKey","isGroupComplete","metadata","originalMessageGid","originalPublishedAt","partitionKey","payload","priority","publishedAt","routingKey","sequenceNumber","status","storageTier","tenantId","tombstonedAt","updatedAt"],c:{deliveryStats:{p:["delivered","failed","pending","total"]},entityRef:{p:["id","sourceId","type","uet","untranslated"]},metadata:{p:["causationId","contentType","correlationId","entityRefs","source","traceId"]}}}},{a:{p:["channelGid","deliveryConfig","filterGap","gid","hasWebhookSecret","kernelCursorId","name","status","type"],c:{deliveryConfig:{p:["maxPerMinute"]},filterGap:{a:{p:["operator","path"]}}}}},{p:["channelGid","fromTime","metadataOnly","recordCount","records","tier","toTime"],c:{records:{a:{p:["checksum","gid","size","timestamp"]}}}},{a:{p:["channelGid","createdAt","description","gid","kernelCursorId","maxConcurrency","metadata","name","rebalanceOnMemberChange","status","strategy","updatedAt"]}},{a:{p:["cancelReason","cancelledAt","channelGid","createdAt","deliverAt","deliveredMessageGid","failureReason","gid","idempotencyKey","metadata","partitionKey","payload","priority","routingKey","status"]}},{p:["redeliveryCount"]},{p:["added","addedCount","channelGid","fromTime","toTime"],c:{added:{a:{p:["attributes","channelGid","createdAt","gid","metadata","partitionKey","payload","priority","publishedAt","routingKey","sequenceNumber","status"]}}}},{p:["asOf","channelGid","messageCount","messages"],c:{messages:{a:{p:["attributes","channelGid","createdAt","gid","metadata","partitionKey","payload","priority","publishedAt","routingKey","sequenceNumber","status"]}}}},{p:["asOf","grantId","messageCount","messages","reason","skipped"],c:{messages:{a:{p:["attributes","channelGid","createdAt","gid","metadata","partitionKey","payload","priority","publishedAt","routingKey","sequenceNumber","status"]}}}},{p:["connectGrantGid","effectiveRetentionMs","feedListingGid","gid","kernelTable","kernelTableId","name","origin","routedSchemaRef","slug","status","threatScan","type"],c:{routedSchemaRef:{a:{p:["eventType","version"]}},threatScan:{p:["level","required"]}}},{p:["gid","name","slug","status","type"]},{p:["archived","success","suspendedSubscriptions"]},{p:["channelGid","isArchived","messageCount","newestMessageAt","oldestMessageAt","status","totalPayloadSize"]},{p:["channelGid","channelName","last24h","subscriptions"],c:{last24h:{p:["avgDeliveryTimeMs","deliveriesFailed","deliveriesSuccessful","deliveriesTotal","messagesPublished"]},subscriptions:{a:{p:["gid","health","name","pendingDeliveries"]}}}},{p:["channel","recentMessages","stats","subscribers"],c:{channel:{p:["gid","name","slug","status","type"]},recentMessages:{a:{p:["channelGid","createdAt","gid","partitionKey","payload","publishedAt","status"]}},stats:{p:["dlqDepth","messageCount","subscriberCount"]},subscribers:{a:{p:["channelGid","gid","hasWebhookSecret","name","status","type"]}}}},{p:["alreadyArchived","success"]},{p:["messageIds","published"]},{p:["accepted","deferred","recordCount","responseFrameB64"]},{p:["groupId","messageIds"]},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["acknowledgment","channelGid","createdAt","deliveryGid","expiresAt","gid","messageGid","metadata","proof","status","subscriptionGid","updatedAt"],c:{acknowledgment:{p:["acknowledgedAt","metadata","processedAt","receivedAt"]},proof:{p:["deliveredAt","endpoint","latencyMs","receiptId","responseHash","signatureVerified","statusCode"]}}}}}},{p:["channelGid","checks","safe","sample","scanned","threshold","worstRiskScore","worstSeverity"],c:{checks:{p:["pii","schema","threat"],c:{pii:{p:["findingsCount","highestSeverity","safe"]},schema:{p:["findingsCount","highestSeverity","safe"]},threat:{p:["findingsCount","highestSeverity","safe"]}}},sample:{a:{p:["findings","findingsCount","highestSeverity","messageGid","riskScore","safe","unscannable"],c:{findings:{a:{p:["category","check","path","severity"]}}}}}}},{p:["appliedOffset","appliedTimestamp","mode","ok","reason","watermark"]},{p:["eventTypes","grantId"]},{a:{p:["attributes","channelGid","createdAt","gid","metadata","partitionKey","payload","priority","publishedAt","routingKey","sequenceNumber","status"]}},{a:{p:["committedAt","consumerId","lag","latestSequence","offset"]}},{p:["cursor","subscriptionGid"]},{p:["channelGid","deliveryConfig","filterGap","gid","hasWebhookSecret","kernelCursorId","name","status","type","webhookSecret"],c:{deliveryConfig:{p:["maxPerMinute"]},filterGap:{a:{p:["operator","path"]}}}},{a:{p:["avgLatencyMs","endpoint","health","issues","last24h","name","subscriptionGid","successRate","type"],c:{issues:{a:{p:["message","severity","since","type"]}},last24h:{p:["delivered","failed","pending","total"]}}}},{p:["copiedCount","failedCount","firstCopyTime","lastCopyTime","messageGids","replayed"]},{p:["messageGids","reason","replayed","skipped"]},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["confirmedBySource","confirmedByTarget","entityTypeSlug","gid","sandbox","sourceOrg","sourceOrgId","status","syncedAt","targetOrg","targetOrgId"],c:{sourceOrg:{p:["displayName","handle"]},targetOrg:{p:["displayName","handle"]}}}}}},{p:["confirmedBySource","confirmedByTarget","entityTypeSlug","gid","sandbox","sourceOrg","sourceOrgId","status","syncedAt","targetOrg","targetOrgId"],c:{sourceOrg:{p:["displayName","handle"]},targetOrg:{p:["displayName","handle"]}}},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["approvalGid","createdAt","grantGid","platformSlug","receipt","status","storeName","tenantId","updatedAt"],c:{receipt:{p:["approvedAt","approvedBy","humanSummary","receiptId","scope","signature","signingKeyId"],c:{approvedBy:{p:["actorType","email"]},scope:{p:["allowedFields","channelIds","denyFields","eventTypeSlugs"]}}}}}}}},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["appId","appName","appType","connectDescription","connectVisibility","connectedAppCount","description","orgName","platformSlug","publishedEventTypes"]}}}},{p:["appId","appName","appType","connectDescription","connectVisibility","connectedAppCount","description","orgName","platformSlug","publishedEventTypes"]},{p:["connectedApps","deliverySuccessRate30d","piiViolations30d","publishToDeliverLatencyMs","publisherOrgId","redFlag","trustScore"],c:{publishToDeliverLatencyMs:{p:["p50","p99"]}}},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["approvedBy","callerRole","connectReceivingChannelGid","createdAt","eventTypes","expiresAt","gid","limit","platformSlug","publisherAppId","publisherAppName","publisherDeclaration","publisherEnvKind","publisherOrg","publisherOrgId","publisherOrgName","publisherRegion","rates","requestedBy","residencyConsent","scope","scopeDetail","status","subscriberAppId","subscriberAppName","subscriberEnvKind","subscriberOrg","subscriberOrgId","subscriberOrgName","subscriberRegion","tenantApprovedCount","tenantTotalCount","trustScore","trustScoreAtRequest","updatedAt"],c:{limit:{p:["perDay","perSecond"]},publisherDeclaration:{p:["signature","signedAt","statement"]},publisherOrg:{p:["displayName","handle"]},rates:{p:["asOf","droppedToday","eventsPerSecondNow","peakBucketStart","peakEventsPerSecond","todayCount"]},scope:{p:["allowedFields","denyFields","eventTypeSlugs"]},scopeDetail:{p:["allowedFields","channels","eventTypes","removedFields"],c:{channels:{a:{p:["id","name"]}}}},subscriberOrg:{p:["displayName","handle"]}}}}}},{p:["approvedBy","callerRole","connectReceivingChannelGid","createdAt","eventTypes","expiresAt","gid","limit","platformSlug","publisherAppId","publisherAppName","publisherDeclaration","publisherEnvKind","publisherOrg","publisherOrgId","publisherOrgName","publisherRegion","rates","requestedBy","residencyConsent","scope","scopeDetail","status","subscriberAppId","subscriberAppName","subscriberEnvKind","subscriberOrg","subscriberOrgId","subscriberOrgName","subscriberRegion","supportContact","trustScore","trustScoreAtRequest","updatedAt"],c:{limit:{p:["perDay","perSecond"]},publisherDeclaration:{p:["signature","signedAt","statement"]},publisherOrg:{p:["displayName","handle"]},rates:{p:["asOf","droppedToday","eventsPerSecondNow","peakBucketStart","peakEventsPerSecond","todayCount"]},scope:{p:["allowedFields","denyFields","eventTypeSlugs"]},scopeDetail:{p:["allowedFields","channels","eventTypes","removedFields"],c:{channels:{a:{p:["id","name"]}}}},subscriberOrg:{p:["displayName","handle"]},supportContact:{p:["publisherContact","subscriberContact"],c:{publisherContact:{p:["email","escalationUrl","hoursTimezone"]},subscriberContact:{p:["email","escalationUrl","hoursTimezone"]}}}}},{p:["gid","publisherAppId","publisherOrgId","status","subscriberAppId","subscriberOrgId","updatedAt"]},{p:["asOf","callerRole","droppedByReason","droppedToday","eventsPerSecondNow","grantGid","limitPerDay","limitPerSecond","peakBucketStart","peakEventsPerSecond","todayCount"],c:{droppedByReason:{p:["other","outOfScope","overLimit","paused"]}}},{p:["dryRun","remaining","replayed","skipped","wouldReplay"]},{p:["coldStart","deliveryCount","grantAgeDays","grantGid","redFlag","trustScore","unverified"]},{p:["callerRole","daily","delivered","failed","failuresByReason","grantGid","lastDeliveredAt","latencyP50","latencyP95","latencyP99","perTenantBreakdown","period","publishLatencyP50","publishLatencyP95","publishLatencyP99","published","windowEndMs","windowStartMs"],c:{daily:{a:{p:["day","delivered","failed","published"]}},perTenantBreakdown:{a:{p:["delivered","failed","tenantId"]}}}},{p:["resumedCount","resumedGids"]},{p:["pauseAllId","reason","suspendedCount","suspendedGids"]},{p:["asOf","edges","graph","layoutKey","nodes"],c:{edges:{a:{p:["count","direction","eventsPerSecondNow","from","grantGid","kind","peakBucketStart","peakEventsPerSecond","status","to"]}},nodes:{a:{p:["count","displayName","handle","id","kind","name","org","self","sold"]}}}},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["action","actorId","actorType","after","before","context","createdAt","diff","gid","orgId","resourceId","resourceType","timestamp"],c:{context:{p:["ip","requestId","traceId","userAgent"]}}}}}},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["createdAt","expiresAt","gid","grantGid","ownerEmail","platformSlug","status","subscriberAppId","subscriberOrgId","tenantId","updatedAt"]}}}},{p:["appId","appName","appType","complianceBadges","connectDescription","connectVisibility","connectedAppCount","description","orgName","platformSlug","publishedEventTypes","slaStatement","subtype","supportContact"],c:{supportContact:{p:["email","escalationUrl","hoursTimezone"]}}},{p:["createdAt","expiresAt","gid","grantGid","ownerEmail","platformSlug","status","subscriberAppId","subscriberOrgId","tenantId","updatedAt"]},{p:["channelGid","createdAt","description","gid","kernelCursorId","maxConcurrency","members","metadata","name","rebalanceOnMemberChange","status","strategy","updatedAt"],c:{members:{a:{p:["committedAt","committedOffset","consumerId","joinedAt","kernelCursorId","lastHeartbeatAt","messagesProcessed","offset","status","subscriptionGid"]}}}},{p:["deleted","events","gid"],c:{events:{a:{p:["groupGid","reason","type"]}}}},{p:["groupGid","kernelCursorId","status","subscriptionGid"]},{p:["delivered","messages","ok","reason"],c:{messages:{a:{p:["body","messageId","receiptHandle","sequence"]}}}},{p:["attemptCount","attemptHistory","createdAt","deliveredAt","expiresAt","gid","lastAttemptAt","lastError","maxAttempts","messageGid","metadata","nextAttemptAt","partitionKey","response","scheduledAt","status","subscriptionGid","tombstonedAt","updatedAt"],c:{attemptHistory:{a:{p:["attemptNumber","attemptedAt","error","latencyMs","statusCode"]}},lastError:{p:["code","message","retryable"]},response:{p:["latencyMs","statusCode"]}}},{p:["canceled","success"]},{p:["newDeliveryGid","success"]},{p:["acknowledgment","channelGid","createdAt","deliveryGid","expiresAt","gid","messageGid","metadata","proof","status","subscriptionGid","updatedAt"],c:{acknowledgment:{p:["acknowledgedAt","metadata","processedAt","receivedAt"]},proof:{p:["deliveredAt","endpoint","latencyMs","receiptId","responseHash","signatureVerified","statusCode"]}}},{p:["currentStatus","deliveryGid","messageGid","subscriptionGid","timeline"],c:{timeline:{a:{p:["details","event","timestamp"],c:{details:{p:["attemptNumber","error","latencyMs","reason","status","statusCode"]}}}}}},{p:["createdAt","deferUntil","deliveryGid","gid","processingTimeMs","reason","responseCode","status"]},{p:["deliveryGid","receiptGid","status"]},{p:["adapterDlqSlug","adapterType","attemptCount","createdAt","expiresAt","failedAt","failureAttempts","failureCount","failureReason","frameHash","frameSeq","gid","hlcTimestamp","lastError","lastErrorMessage","lastFailureReason","lastFailureTimestamp","lastHttpStatus","messageGid","orgId","originalMetadata","originalPayload","producerThumbprint","rejectionReason","reprocessHistory","reprocessResult","reprocessedAt","reprocessedBy","status","subscriptionGid","suppressedFailureEmits","updatedAt"],c:{reprocessHistory:{a:{p:["actor","at","note","result"]}},suppressedFailureEmits:{a:{p:["eventType","failureSourceChannelSlug","failureSourceSubscriptionGid","reason","redirectedTo","targetChannelSlug"]}}}},{p:["message","success"]},{p:["discarded","errors","skipped","success"],c:{errors:{a:{p:["error","id"]}}}},{p:["candidateBound","dryRun","matchCount","reprocessed","truncated"]},{p:["errors","processed","skipped","skippedCircuitOpen","success"],c:{errors:{a:{p:["error","id"]}}}},{p:["uet"]},{p:["entityTypeSlug","localEntityId"]},{p:["messagesPublished","totalChannels","totalSubscriptions"]},{p:["action","channels","createdAt","currentVersion","deprecated","deprecatedFields","deprecationMessage","description","displayName","domain","entity","gid","name","ownership","publisherDeclaration","status","sunsetDate","tags","updatedAt"],c:{ownership:{p:["contact","slackChannel","team"]},publisherDeclaration:{p:["eventTypeName","signedAt","signedBy","statement"]}}},{p:["breakingChanges","compatible","warnings"]},{a:{p:["appId","gid","lastReceivedAt","registeredAt","subscriptionGid"]}},{p:["channelCount","consumerCount","consumers","eventType","latestVersion","versions"],c:{consumers:{a:{p:["appId","gid","lastReceivedAt","registeredAt","subscriptionGid"]}},eventType:{p:["action","channels","createdAt","currentVersion","deprecated","deprecatedFields","deprecationMessage","description","displayName","domain","entity","gid","name","ownership","publisherDeclaration","status","sunsetDate","tags","updatedAt"],c:{ownership:{p:["contact","slackChannel","team"]},publisherDeclaration:{p:["eventTypeName","signedAt","signedBy","statement"]}}},versions:{a:{p:["changelog","compatibility","envId","example","gid","publishedAt","publishedBy","schema","status","version"],c:{compatibility:{p:["breakingChanges","checkedAgainst","mode","result"]},schema:{p:["definition","format"]}}}}}},{a:{p:["changelog","compatibility","envId","example","gid","publishedAt","publishedBy","schema","status","version"],c:{compatibility:{p:["breakingChanges","checkedAgainst","mode","result"]},schema:{p:["definition","format"]}}}},{p:["confirmedAt","delivered","status","token"]},{p:["alreadyExists","status","token"]},{p:["alreadyConfirmed","success"]},{a:{p:["config","createdAt","gid","name","status","type","updatedAt"],c:{config:{p:["headersMatchMode"]}}}},{p:["config","createdAt","gid","name","status","type","updatedAt"],c:{config:{p:["headersMatchMode"]}}},{p:["bindingsDeleted"]},{a:{p:["channelGid","channelName","createdAt","exchangeGid","gid","headerRules","routingKey"]}},{p:["channelGid","channelName","createdAt","exchangeGid","gid","headerRules","routingKey"]},{a:{p:["bindingGid","channelGid"]}},{p:["count","deliveries","exchangeGid","exchangeType"],c:{deliveries:{a:{p:["bindingGid","channelGid","messageGid"]}}}},{a:{p:["bindingsCount","config","createdAt","gid","name","status","type","updatedAt"],c:{config:{p:["headersMatchMode"]}}}},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["arrivingPerSecond","billingCycle","bindingCount","currentPeriodEnd","displayName","listingGid","messagesThisPeriod","status","subscribedAt","subscriberOrg","subscriberOrgId","subscriptionGid","supportEmail","tierName","totalBytes"],c:{subscriberOrg:{p:["displayName","handle"]}}}}}},{p:["arrivals","arrivingPerSecond","billingCycle","bindingCount","currentPeriodEnd","displayName","listingGid","messagesThisPeriod","status","subscribedAt","subscriberOrg","subscriberOrgId","subscriptionGid","supportEmail","tierName","totalBytes"],c:{arrivals:{p:["buckets","today"],c:{buckets:{a:{p:["count","start"]}}}},subscriberOrg:{p:["displayName","handle"]}}},{a:{p:["arrivingPerSecond","byStatus","customers","listingGid"],c:{byStatus:{p:["active","cancelled","expired","paused","pending"]}}}},{a:{p:["activeBindingCount","bindingCount","messageCount","messagesThisPeriod","subscriptionGid","totalBytes"]}},{p:["afterRevoke","listingGid","region","resaleAllowed","retentionDays","signature","signedAt","signer"],c:{signer:{p:["displayName","handle"]}}},{p:["listingGid","signedAt"]},{a:{p:["body","createdAt","gid","helpfulVotes","publisherResponse","publisherResponseAt","rating","reviewerOrgId","status","title","unhelpfulVotes","updatedAt"]}},{p:["basePrice","categories","category","description","freeTierLimit","gid","name","namespace","pricePerMessage","pricingModel","publishedAt","publisher","publisherGid","publisherSlug","shortDescription","slug","status","syncedFromAdminAt","syncedFromAdminVersion","tags","trialDays"],c:{publisher:{p:["averageRating","description","logoUrl","name","publisherGid","slug","status","supportEmail","supportUrl","websiteUrl"]}}},{p:["averageRating","description","logoUrl","name","payoutsEnabled","publisherGid","slug","status","stripeAccountStatus","supportEmail","supportUrl","suspendedAt","suspendedReason","syncedFromAdminAt","syncedFromAdminVersion","verifiedAt","websiteUrl"]},{p:["deliverySuccessRate","lastActivity","score","suspensionCount","trend"]},{p:["body","createdAt","gid","helpfulVotes","publisherResponse","publisherResponseAt","rating","reviewerOrgId","status","title","unhelpfulVotes","updatedAt"]},{a:{p:["createdAt","deliverySubscriptionGid","feedSubscriptionGid","gid","lastDeliveredAt","messagesDelivered","receivingChannel","receivingChannelGid","status","targetAppGid","targetAppSlug","targetEnvId","updatedAt"],c:{receivingChannel:{p:["arrivingPerSecond","envId","gid","name"]}}}},{p:["deliveryState","isTrial","paused","quota","quotaRemaining","subscriptionGid","testMessagesDelivered","trialDaysRemaining"]},{p:["deleted","revision","value"]},{p:["messageGid","revision"]},{a:{p:["channelGid","createdAt","gid","partitionKey","payload","publishedAt","status"]}},{p:["attributes","channelGid","createdAt","gid","metadata","partitionKey","payload","priority","publishedAt","routingKey","sequenceNumber","status"]},{p:["attributes","channelGid","connectTier","createdAt","deliveryStats","entityRef","expiresAt","federationEntityId","gid","grantId","groupId","groupSequence","groupSize","idempotencyKey","isGroupComplete","metadata","originalMessageGid","originalPublishedAt","partitionKey","payload","priority","publishedAt","routingKey","sequenceNumber","status","storageTier","tenantId","tombstonedAt","updatedAt"],c:{deliveryStats:{p:["delivered","failed","pending","total"]},entityRef:{p:["id","sourceId","type","uet","untranslated"]},metadata:{p:["causationId","contentType","correlationId","entityRefs","pipeDepth","source","traceId"]}}},{p:["channelGid","createdAt","deliveries","messageGid","routingKey","status","subscriptionDeliveries"],c:{deliveries:{p:["delivered","failed","pending","total"]},subscriptionDeliveries:{a:{p:["attemptCount","deliveredAt","httpStatusCode","lastAttemptAt","lastError","maxAttempts","nextRetryAt","status","subscriptionGid","subscriptionName"]}}}},{a:{p:["acknowledgment","createdAt","deliveryGid","expiresAt","gid","messageGid","metadata","proof","status","subscriptionGid","updatedAt"],c:{acknowledgment:{p:["acknowledgedAt","metadata","processedAt","receivedAt"]},proof:{p:["deliveredAt","endpoint","latencyMs","receiptId","responseHash","signatureVerified","statusCode"]}}}},{p:["messages","total"],c:{messages:{a:{p:["createdAt","deliveryStats","messageGid","routingKey","status"],c:{deliveryStats:{p:["delivered","failed","pending","total"]}}}}}},{p:["cursor","data","hasMore"],c:{data:{a:{p:["agentId","endedAt","errorCode","errorMessage","executionGid","finalReasoning","gid","goal","iterationsUsed","maxIterations","maxTokens","startedAt","status","tokensUsed","trace","workflowGid"],c:{trace:{a:{p:["error","input","iteration","output","timestamp","toolName"]}}}}}}},{p:["agentId","endedAt","errorCode","errorMessage","executionGid","finalReasoning","gid","goal","iterationsUsed","maxIterations","maxTokens","startedAt","status","tokensUsed","trace","workflowGid"],c:{trace:{a:{p:["error","input","iteration","output","timestamp","toolName"]}}}},{p:["cursor","data","hasMore"],c:{data:{a:{p:["confidence","createdAt","errorCode","errorMessage","evidence","executionGid","findingType","gid","inputRecordIds","latencyMs","nodeId","proposedDecision","retryCount","status","tokensUsed","workflowGid"]}}}},{p:["confidence","createdAt","errorCode","errorMessage","evidence","executionGid","findingType","gid","inputRecordIds","latencyMs","nodeId","proposedDecision","retryCount","status","tokensUsed","workflowGid"]},{p:["cursor","data","hasMore"],c:{data:{a:{p:["actions","auth","category","createdAt","description","docsUrl","gid","icon","id","isSystem","name","status","supportedRegions","tier","triggers","updatedAt"],c:{actions:{a:{p:["description","id","inputSchema","name","outputSchema"]}},auth:{p:["config","provider","scopes","type"]},triggers:{a:{p:["description","eventType","id","name","outputSchema"]}}}}}}},{p:["cursor","data","hasMore"],c:{data:{a:{p:["auth","connectorId","createdAt","gid","lastUsedAt","name","status","updatedAt","usageCount"],c:{auth:{p:["expiresAt","nangoConnectionId","type","vaultSecretId"]}}}}}},{p:["auth","connectorId","createdAt","gid","lastUsedAt","name","status","updatedAt","usageCount"],c:{auth:{p:["expiresAt","nangoConnectionId","type","vaultSecretId"]}}},{p:["credentialGid","updated"]},{p:["credentialGid","deleted"]},{p:["credentialGid","status"]},{p:["credentialGid","rotated"]},{p:["error","success"]},{p:["cursor","data","hasMore"],c:{data:{a:{p:["actNodeId","actedAt","analysisGid","analysisInput","committedAt","committedDecision","createdAt","envId","executionGid","expiresAt","gateState","gid","humanActedAt","humanActor","humanRationale","nodeId","policy","proposedDecision","workflowGid"],c:{policy:{p:["config","kind"]}}}}}},{p:["actNodeId","actedAt","analysisGid","analysisInput","committedAt","committedDecision","createdAt","envId","executionGid","expiresAt","gateState","gid","humanActedAt","humanActor","humanRationale","nodeId","policy","proposedDecision","workflowGid"],c:{policy:{p:["config","kind"]}}},{p:["decisionGid","firstActorPreserved","gateState"]},{p:["cursor","data","hasMore"],c:{data:{a:{p:["createdAt","dlqEntryId","error","failedAt","gid","lastRetryAt","maxRetries","nextRetryAt","nodeId","resolutionNotes","resolvedAt","resolvedBy","retryCount","status","updatedAt"],c:{error:{p:["code","message","stack"]}}}}}},{p:["createdAt","dlqEntryId","error","failedAt","gid","lastRetryAt","maxRetries","nextRetryAt","nodeId","resolutionNotes","resolvedAt","resolvedBy","retryCount","status","updatedAt"],c:{error:{p:["code","message","stack"]}}},{p:["discardedAt","discardedBy","dlqEntryId","status"]},{p:["discarded","exhausted","pending","resolved","retrying","total"]},{p:["createdAt","endedAt","envId","error","gid","nodeRuns","status","timing","triggeredBy","updatedAt"],c:{error:{p:["code","message","nodeId","stack"]},nodeRuns:{a:{p:["completedAt","error","nodeId","nodeType","startedAt","status"]}},timing:{p:["completedAt","durationMs","startedAt"]}}},{p:["allowedCategories","allowedConnectors","allowedTiers","auditConfig","autoApproveInternalConnectors","blockedConnectors","createdAt","maxCredentialsPerConnector","mode","organizationId","requireFirstUseApproval","updatedAt","updatedBy"],c:{auditConfig:{p:["logAllActions","logCredentialAccess","retentionDays"]}}},{p:["cursor","data","hasMore"],c:{data:{a:{p:["connectorId","gid","requestReason","requestedAt","requestedBy","reviewNotes","reviewedAt","reviewedBy","revokeReason","revokedAt","revokedBy","status"]}}}},{p:["requestGid"]},{p:["cursor","data","hasMore"],c:{data:{a:{p:["actorId","actorType","eventType","gid","reason","targetId","targetType","timestamp"]}}}},{p:["cursor","data","hasMore"],c:{data:{a:{p:["createdAt","discardReason","discardedAt","discardedBy","errorCode","errorMessage","executionGid","gid","lastReplayedAt","nodeId","recordId","recordKey","replayedBy","retryCount","status","workflowGid"]}}}},{p:["createdAt","discardReason","discardedAt","discardedBy","errorCode","errorMessage","executionGid","gid","lastReplayedAt","nodeId","recordId","recordKey","replayedBy","retryCount","status","workflowGid"]},{p:["entryGid","firstActorPreserved","status"]},{p:["entryGid","status"]},{p:["byStatus","total"],c:{byStatus:{p:["discarded","pending","replayed","resolved"]}}},{p:["cursor","data","hasMore"],c:{data:{a:{p:["description","inputSchema","name","outputSchema","requiresApproval","stage","supportsIdempotency"]}}}},{p:["description","inputSchema","name","outputSchema","requiresApproval","stage","supportsIdempotency"]},{p:["cursor","data","hasMore"],c:{data:{a:{p:["advancedAt","createdAt","envId","gid","priorValue","resetAt","resetBy","resetReason","sourceId","value","workflowGid"]}}}},{p:["advancedAt","createdAt","envId","gid","priorValue","resetAt","resetBy","resetReason","sourceId","value","workflowGid"]},{p:["newValue","priorValue","resetAt","resetBy","watermarkGid"]},{p:["cursor","data","hasMore"],c:{data:{a:{p:["gid","name","status","triggerUrl"]}}}},{p:["allowedIps","hasSecret","methods","requiredHeaders","responseMode","url"]},{p:["newSecret"]},{p:["cursor","data","hasMore"],c:{data:{a:{p:["createdAt","definition","description","envId","gid","name","stats","status","triggerConfig","updatedAt","version"],c:{definition:{p:["edges","nodes","viewport"],c:{viewport:{p:["x","y","zoom"]}}},stats:{p:["avgDurationMs","failedRuns","lastRunAt","successfulRuns","totalRuns"]},triggerConfig:{p:["config","type"]}}}}}},{p:["createdAt","definition","description","envId","gid","name","stats","status","triggerConfig","updatedAt","version"],c:{definition:{p:["edges","nodes","viewport"],c:{viewport:{p:["x","y","zoom"]}}},stats:{p:["avgDurationMs","failedRuns","lastRunAt","successfulRuns","totalRuns"]},triggerConfig:{p:["config","type"]}}},{p:["version"]},{p:["deleted","workflowGid"]},{p:["status","workflowGid"]},{p:["cursor","data","hasMore"],c:{data:{a:{p:["createdAt","endedAt","envId","error","gid","nodeRuns","status","timing","triggeredBy","updatedAt"],c:{error:{p:["code","message","nodeId","stack"]},nodeRuns:{a:{p:["completedAt","error","nodeId","nodeType","startedAt","status"]}},timing:{p:["completedAt","durationMs","startedAt"]}}}}}},{p:["nodeId","scheduled"]},{p:["gid","idempotent"]},{p:["triggerConfig","workflowGid"],c:{triggerConfig:{p:["config","type"]}}},{p:["cancelReason","cancelledAt","channelGid","createdAt","deliverAt","deliveredMessageGid","failureReason","gid","idempotencyKey","metadata","partitionKey","payload","priority","routingKey","status"]},{a:{p:["channelId","gid","metrics","name","status","url"]}},{p:["channelId","gid","metrics","name","status","url"]},{p:["gid","removed"]},{a:{p:["acknowledgedUpTo","createdAt","createdBy","gid","metadata","name","offset","pendingCount","subscriptionGid"]}},{p:["channelGid","deliveryConfig","filterGap","gid","hasWebhookSecret","kernelCursorId","name","status","type"],c:{deliveryConfig:{p:["maxPerMinute"]},filterGap:{a:{p:["operator","path"]}}}},{p:["channelGid","deliveryConfig","filterGap","gid","hasWebhookSecret","name","status","type"],c:{deliveryConfig:{p:["maxPerMinute"]},filterGap:{a:{p:["operator","path"]}}}},{p:["archived","canceledDeliveries","success"]},{p:["acked","deadLettered","duplicateTokens","extended","notFound","ok","processed","reason","rejected","rejectedDuplicateSeqs","tokensRedeemed"]},{a:{p:["createdAt","deferUntil","deliveryGid","gid","processingTimeMs","reason","responseCode","status","subscriptionGid"]}},{a:{p:["adapterDlqSlug","adapterType","attemptCount","createdAt","expiresAt","failedAt","failureAttempts","failureCount","failureReason","frameHash","frameSeq","gid","hlcTimestamp","lastError","lastErrorMessage","lastFailureReason","lastFailureTimestamp","lastHttpStatus","messageGid","orgId","originalMetadata","originalPayload","producerThumbprint","rejectionReason","reprocessHistory","reprocessResult","reprocessedAt","reprocessedBy","status","subscriptionGid","suppressedFailureEmits","updatedAt"],c:{reprocessHistory:{a:{p:["actor","at","note","result"]}},suppressedFailureEmits:{a:{p:["eventType","failureSourceChannelSlug","failureSourceSubscriptionGid","reason","redirectedTo","targetChannelSlug"]}}}}},{p:["errors","processed","success","total"],c:{errors:{a:{p:["error","id"]}}}},{p:["discarded","newestPendingAt","oldestPendingAt","pending","reprocessed","reprocessing","total"]},{p:["buckets","summary"],c:{buckets:{a:{p:["count","hour","timestamp"]}},summary:{p:["bucketSizeMs","currentPending","totalInWindow","windowEndMs","windowStartMs"]}}},{p:["credit","delivered","lag","longPollWaitMs","messages","ok","outstandingCredit","reason"],c:{messages:{a:{p:["body","messageId","partitionKey","partitionSlot","receiptHandle","sequence"]}}}},{p:["failed","successful"],c:{failed:{a:{p:["error","receiptHandle"]}}}},{p:["messages"],c:{messages:{a:{p:["attributes","body","messageId","receiptHandle"],c:{attributes:{p:["approximateFirstReceiveTimestamp","approximateReceiveCount","sentTimestamp"]}}}}}},{p:["queue","stats"],c:{queue:{p:["config","createdAt","gid","stats","status","updatedAt"],c:{config:{p:["delaySeconds","dlq","maxReceiveMessages","receiveWaitTimeSeconds","retentionDays","visibilityTimeoutSeconds"],c:{dlq:{p:["enabled","maxReceiveCount"]}}},stats:{p:["approximateMessageCount","approximateNotVisibleCount","oldestMessageTimestamp"]}}},stats:{p:["available","inflight"]}}},{a:{p:["availableAt","createdAt","deduplicationId","expiresAt","firstReceivedAt","gid","hasReceiptHandle","lastReceivedAt","partitionKey","priority","receiveCount","sentTimestamp","status","updatedAt","visibilityDeadline"]}},{p:["purgedCount"]},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["acknowledgment","createdAt","deliveryGid","expiresAt","gid","messageGid","metadata","proof","status","subscriptionGid","updatedAt"],c:{acknowledgment:{p:["acknowledgedAt","metadata","processedAt","receivedAt"]},proof:{p:["deliveredAt","endpoint","latencyMs","receiptId","responseHash","signatureVerified","statusCode"]}}}}}},{p:["byStatus","latency","total"],c:{byStatus:{p:["acknowledged","delivered","expired","processed","rejected"]},latency:{p:["avg","max","min","p50","p95","p99"]}}},{p:["previousExpiresAt","webhookSecret"]},{p:["webhookSecret"]},{p:["ok","released","subscriptionRetained"]},{p:["availabilityPercent","avgLatencyMs","consecutiveFailures","consecutiveSuccesses","degradedThreshold","lastFailureAt","lastSuccessAt","recoveryThreshold","state","stateChangedAt","subscriptionGid","totalDeliveries","totalFailures","totalSuccesses","unhealthyThreshold","updatedAt"]},{a:{p:["description","lastDelivery","projectionVersion","recentFailureCount","samplePayload","slug","subscription","title"],c:{lastDelivery:{p:["at","ok","statusCode"]},subscription:{p:["channelGid","gid","hasWebhookSecret","name","status","type"]}}}},{p:["channelGid","gid","hasWebhookSecret","name","status","type","webhookSecret"]},{p:["ok"]},{a:{p:["at","errorCode","ok","statusCode"]}},{a:{p:["availabilityPercent","avgLatencyMs","consecutiveFailures","consecutiveSuccesses","degradedThreshold","lastFailureAt","lastSuccessAt","recoveryThreshold","state","stateChangedAt","subscriptionGid","totalDeliveries","totalFailures","totalSuccesses","unhealthyThreshold","updatedAt"]}},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["allowedIps","channelGid","createdAt","description","gid","hasSigningSecret","metadata","name","payload","previousSigningSecretExpiresAt","rateLimit","responseMode","revokedAt","revokedBy","revokedReason","signingSecretRotatedAt","status","updatedAt"],c:{payload:{p:["contentTypes","maxSize","transformScript"]},rateLimit:{p:["burstLimit","requestsPerMinute","requestsPerSecond"]}}}}}},{p:["allowedIps","channelGid","createdAt","description","gid","hasSigningSecret","metadata","name","payload","previousSigningSecretExpiresAt","rateLimit","responseMode","revokedAt","revokedBy","revokedReason","signingSecret","signingSecretRotatedAt","status","updatedAt"],c:{payload:{p:["contentTypes","maxSize","transformScript"]},rateLimit:{p:["burstLimit","requestsPerMinute","requestsPerSecond"]}}},{p:["allowedIps","channelGid","createdAt","description","gid","hasSigningSecret","metadata","name","payload","previousSigningSecretExpiresAt","rateLimit","responseMode","revokedAt","revokedBy","revokedReason","signingSecretRotatedAt","status","updatedAt"],c:{payload:{p:["contentTypes","maxSize","transformScript"]},rateLimit:{p:["burstLimit","requestsPerMinute","requestsPerSecond"]}}},{p:["gid","revokedAt","status"]},{p:["previousExpiresAt","signingSecret"]},{p:["environments"],c:{environments:{a:{p:["createdAt","envId","gid","kind","name","pool","slug","status"]}}}},{p:["environment"],c:{environment:{p:["createdAt","envId","gid","kind","name","pool","slug","status"]}}},{p:["bound","cellId","created","environment","pool"],c:{environment:{p:["createdAt","envId","gid","kind","name","pool","slug","status"]}}},{p:["jobGid","targetEnvironment"],c:{targetEnvironment:{p:["createdAt","envId","gid","kind","name","pool","slug","status"]}}},{p:["events","fromTs","limit","toTs"],c:{events:{a:{p:["env","eventName","gid","occurredAt"]}}}},{p:["continueCursor","granularityUsed","isDone","page"],c:{page:{a:{p:["appId","bucketStart","count","deploymentId","env","errorCount","eventName","firstEventAt","gid","lastEventAt","orgId","source","sumBytes","sumDuration","updatedAt"]}}}},{p:["quantile","totalCount","value"]},{p:["entries","totalCount"],c:{entries:{a:{p:["count","error","key"]}}}},{p:["granularityUsed","scannedRows","series","totals","truncated"]},{p:["asOfTs","sources"],c:{sources:{a:{p:["latestAnchor","sourceDeploymentId","status"],c:{latestAnchor:{p:["asOfTs","latestHash","receivedAt","rowCount","signingKeyKid"]}}}}}},{p:["action","actor","appId","env","envId","gid","hash","hashPrev","payload","tenantId","ts"],c:{actor:{p:["id","kind","name"]}}},{p:["cursor","entries","hasMore"],c:{entries:{a:{p:["action","actor","appId","env","envId","gid","hash","hashPrev","payload","target","tenantId","ts"],c:{actor:{p:["id","kind","name"]},target:{p:["gid","kind"]}}}}}},{p:["actors","events","lastVerifiedAt","sensitiveActions","truncated"],c:{actors:{p:["humans","systems"]}}},{p:["converted","inTrial","status","subscriptionStatus","suspendedReason","tier","trialDaysLeft","trialEndsAt","trialExpired","upgradeUrl"]},{p:["chargesEnabled","created","detailsSubmitted","ok","payoutsEnabled","requirementsCurrentlyDue","stripeAccountId"]},{p:["accountId","clientSecret","expiresAt","ok"]},{p:["count","credits"],c:{credits:{a:{p:["amountCents","appliedAt","appliedToInvoiceGid","currency","evidence","generatedAt","gid","incidentId","orgId","period","status"],c:{evidence:{p:["incidentId","measuredUptime","notes","tierCreditAmountCents"]}}}}}},{p:["created","stripeCustomerId","testClockId"]},{p:["cursor","disputes","hasMore"],c:{disputes:{a:{p:["amountCents","chargeId","closedAt","createdAt","currency","id","reason","status"]}}}},{p:["amountCents","chargeId","closedAt","createdAt","currency","id","reason","status"]},{p:["cursor","delinquencies","hasMore"],c:{delinquencies:{a:{p:["attempts","firstFailedAt","graceUntil","id","lastAttemptAt","orgId","resolvedAt","state","stripeCustomerId","stripeInvoiceId"]}}}},{p:["attempts","graceUntil","invoiceId","isDelinquent","nextRetryAt","state"]},{p:["byPeriod","currency","failedCents","paidOutCents","payoutCount","pendingCents","totalEarnedCents","totalGrossCents","totalPlatformFeeCents"],c:{byPeriod:{a:{p:["earnedCents","grossCents","payoutCount","period","platformFeeCents"]}}}},{p:["message","ok","reason"]},{p:["brand","expMonth","expYear","last4"]},{p:["clientSecret","customerId","isTrial","ok","requiresAction","subscriptionId"]},{p:["clientSecret","customerId","latestInvoicePaymentIntentStatus","message","ok","reason","requiresAction","subscriptionId","subscriptionStatus"]},{p:["admin","billingSvc","ok","ts"],c:{admin:{p:["apiVersion","reachable"]},billingSvc:{p:["outageGid","reachable","stripeOutageActive"]}}},{p:["hasMore","invoices"],c:{invoices:{a:{p:["amountDue","amountPaid","created","currency","hostedInvoiceUrl","id","invoicePdf","number","periodEnd","periodStart","status","totalCents"]}}}},{p:["amountDue","amountPaid","created","currency","hostedInvoiceUrl","id","invoicePdf","number","periodEnd","periodStart","status","totalCents"]},{p:["url"]},{a:{p:["brand","expMonth","expYear","id","isDefault","last4"]}},{p:["deduped","paymentMethodId","success"]},{p:["clientSecret","setupIntentId"]},{p:["count","payouts"],c:{payouts:{a:{p:["currency","failureReason","generatedAt","gid","period","platformFeeBps","platformFeeCents","publisherAmountCents","sentAt","status","stripeTransferId","subscriberPaidCents"]}}}},{a:{p:["baseCents","baseCentsYearly","inclusions","planName","tier"]}},{a:{p:["actor","actorRef","effectiveAt","fromTier","gid","id","isTrial","reason","stripeInvoiceId","stripeSubscriptionId","toTier"]}},{p:["currency","grossCents","netCents","paymentCount","platformFeeCents","refundedCount","refundedNetCents"]},{p:["cursor","hasMore","subscriptions"],c:{subscriptions:{a:{p:["cancelAtPeriodEnd","currentPeriodEnd","currentPeriodStart","id","interval","status","tier","trialEnd"]}}}},{p:["clientSecret","status","subscriptionId"]},{p:["cancelAtPeriodEnd","currentPeriodEnd","currentPeriodStart","id","interval","status","tier","trialEnd"]},{p:["cancelAtPeriodEnd","status"]},{p:["clientSecret","requiresAction","status"]},{p:["currency","immediateChargeCents","nextInvoiceCents","nextInvoiceDate"]},{p:["status","subscriptionId"]},{a:{p:["country","id","type","value"]}},{p:["country","id","type","value"]},{p:["available","breakdown","calculationId","currency","reverseCharge","subtotalCents","taxCents","totalCents"],c:{breakdown:{a:{p:["amountCents","jurisdiction","rate"]}}}},{p:["frozenTime","status","testClockId"]},{p:["quotas","tier"],c:{quotas:{p:["active_federations","active_pipes","channels_active","publisher_listings","subscriptions_active","webhooks_active"],c:{active_federations:{p:["current","limit","remaining"]},active_pipes:{p:["current","limit","remaining"]},channels_active:{p:["current","limit","remaining"]},publisher_listings:{p:["current","limit","remaining"]},subscriptions_active:{p:["current","limit","remaining"]},webhooks_active:{p:["current","limit","remaining"]}}}}},{p:["baseCents","grandTotalCents","meters","period","tier","totalUsageCents"],c:{meters:{p:["agent_runs","ai_usage_cents","audit_retention_gb","connector_invocations","data_storage_gb","deliveries","egress_bytes","entity_resolutions","identity_bridge_lookups","llm_input_tokens","llm_output_tokens","memory_storage_gb","messages_published","pipe_steps","scheduled_messages","skill_executions","stream_replay_reads","tool_invocations"],c:{agent_runs:{p:["included","overage","overageCents","used"]},ai_usage_cents:{p:["included","overage","overageCents","used"]},audit_retention_gb:{p:["included","overage","overageCents","used"]},connector_invocations:{p:["included","overage","overageCents","used"]},data_storage_gb:{p:["included","overage","overageCents","used"]},deliveries:{p:["included","overage","overageCents","used"]},egress_bytes:{p:["included","overage","overageCents","used"]},entity_resolutions:{p:["included","overage","overageCents","used"]},identity_bridge_lookups:{p:["included","overage","overageCents","used"]},llm_input_tokens:{p:["included","overage","overageCents","used"]},llm_output_tokens:{p:["included","overage","overageCents","used"]},memory_storage_gb:{p:["included","overage","overageCents","used"]},messages_published:{p:["included","overage","overageCents","used"]},pipe_steps:{p:["included","overage","overageCents","used"]},scheduled_messages:{p:["included","overage","overageCents","used"]},skill_executions:{p:["included","overage","overageCents","used"]},stream_replay_reads:{p:["included","overage","overageCents","used"]},tool_invocations:{p:["included","overage","overageCents","used"]}}},period:{p:["end","start"]}}},{p:["status"]},{p:["items"],c:{items:{a:{p:["action","actor","grantId","ipAddress","logHash","newStatus","prevStatus","previousLogHash","reasonText","source","tenantApprovalId","timestamp","userAgent"],c:{actor:{p:["email","id","kind","name","via"]}}}}}},{p:["revokedApprovals","success"]},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["appId","appType","approvalCounts","connectVisibility","createdAt","description","governanceStatus","name","orgId","platformSlug","slug","status","updatedAt"],c:{approvalCounts:{p:["active","delisted","expired","frozen","revoked","total"]}}}}}},{p:["affectedCount","partnerOrgId","targetAppId"]},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["createdAt","evidence","expiresAt","frozenAt","frozenReason","gid","grantGid","status","subscriberAppId","subscriberOrgId","tenantId","updatedAt"],c:{evidence:{p:["consentMethod","consentedAt"]}}}}}},{p:["newStatus","partnerOrgId","tenantApprovalGid"]},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["activatedAt","channelId","createdAt","environmentKind","eventTypes","expiresAt","granteeAppId","granteeOrgId","grantorAppId","grantorOrgId","id","revokedBy","status","updatedAt"]}}}},{p:["id","status"]},{p:["activatedAt","channelId","createdAt","environmentKind","eventTypes","expiresAt","granteeAppId","granteeOrgId","grantorAppId","grantorOrgId","id","revokedBy","status","updatedAt"]},{p:["challengeId","consentUrl","expiresAt"]},{p:["eligibleAppGids","items"],c:{items:{a:{p:["gid","status"]}}}},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["bannerUrl","category","cellId","channelGid","createdAt","description","documentationUrl","domain","environment","gid","iconUrl","name","pricing","publishedAt","publisherGid","publisherSlug","samplePayload","shortDescription","slug","stats","status","tags","updatedAt","visibility"],c:{pricing:{p:["model","revenueSplit"]},stats:{p:["rating","reviewCount","subscriptions","views"]}}}}}},{p:["bannerUrl","category","cellId","channelGid","createdAt","description","documentationUrl","environment","gid","iconUrl","name","pricing","publishedAt","publisherGid","publisherSlug","samplePayload","shortDescription","slug","stats","status","tags","updatedAt","visibility"],c:{pricing:{p:["model","revenueSplit"]},stats:{p:["rating","reviewCount","subscriptions","views"]}}},{p:["uploadUrl"]},{p:["balance","hasMore","items","nextCursor"],c:{balance:{p:["availableCents","heldBackCents","nextRelease","openDebtsCents","pendingCents"],c:{nextRelease:{p:["amountCents","releaseOn"]}}},items:{a:{p:["amountCents","currency","releasedOn","status"]}}}},{p:["allowed","message","reason"]},{a:{p:["billing","createdAt","defaultRevenueSplit","description","gid","logoUrl","name","notificationPreferences","payoutDestination","slug","stats","status","supportEmail","supportUrl","taxProfile","updatedAt","verifiedAt","websiteUrl"],c:{billing:{p:["chargesEnabled","onboardingComplete","payoutsEnabled","stripeAccountStatus"]},notificationPreferences:{p:["payoutEmails"]},stats:{p:["totalListings","totalRevenueCents","totalSubscribers"]},taxProfile:{p:["country","taxId"]}}}},{p:["billing","createdAt","defaultRevenueSplit","description","gid","logoUrl","name","notificationPreferences","payoutDestination","slug","stats","status","supportEmail","supportUrl","taxProfile","updatedAt","verifiedAt","websiteUrl"],c:{billing:{p:["chargesEnabled","onboardingComplete","payoutsEnabled","stripeAccountStatus"]},notificationPreferences:{p:["payoutEmails"]},stats:{p:["totalListings","totalRevenueCents","totalSubscribers"]},taxProfile:{p:["country","taxId"]}}},{p:["continueCursor","isDone","page"],c:{page:{a:{p:["bannerUrl","category","cellId","channelGid","createdAt","description","documentationUrl","domain","environment","gid","iconUrl","name","pricing","publishedAt","publisherGid","publisherSlug","rejectionReason","reviewFeedback","reviewedAt","samplePayload","shortDescription","slug","stats","status","submittedAt","tags","updatedAt","visibility"],c:{pricing:{p:["model","revenueSplit"]},stats:{p:["rating","reviewCount","subscriptions","views"]}}}}}},{p:["active","total"]},{p:["billing","createdAt","defaultRevenueSplit","description","gid","logoUrl","name","notificationPreferences","payoutDestination","slug","stats","status","supportEmail","supportUrl","taxProfile","updatedAt","verifiedAt","websiteUrl"],c:{billing:{p:["chargesEnabled","detailsSubmitted","email","onboardingComplete","payoutsEnabled","requirementsCurrentlyDue","stripeAccountId","stripeAccountStatus","updatedAt"]},notificationPreferences:{p:["payoutEmails"]},stats:{p:["totalListings","totalRevenueCents","totalSubscribers"]},taxProfile:{p:["country","taxId"]}}},{p:["buyable","category","description","documentationUrl","environment","gid","iconUrl","licence","name","pricing","publisherGid","publisherSlug","ref","salesState","samplePayload","shortDescription","slug","status","subscriberAgreementVersion","tags","visibility"],c:{licence:{p:["type","url","version"]},pricing:{p:["model","revenueSplit"]}}},{p:["currency","grossCents","listingGid","netCents","paymentCount","platformFeeCents","refundedCount","subscriptionGid","window"],c:{window:{p:["sinceMs","untilMs"]}}},{p:["currency","listings","window"],c:{listings:{a:{p:["grossCents","listingGid","netCents","paymentCount","platformFeeCents","refundedCount"]}},window:{p:["sinceMs","untilMs"]}}},{p:["decisionId","status"]},{a:{p:["activatedAt","billingCycle","cancelledAt","createdAt","currentPeriodEnd","currentPeriodStart","environment","expiresAt","gid","listingGid","mode","paymentStatus","publisherGid","status","targetAppGids","tierName","updatedAt"]}},{p:["activatedAt","billingCycle","cancelledAt","createdAt","currentPeriodEnd","currentPeriodStart","environment","expiresAt","gid","listingGid","mode","paymentStatus","publisherGid","status","targetAppGids","tierName","updatedAt"]},{p:["alreadyPaid","gid","mode"]},{a:{p:["basePrice","listingIconUrl","listingName","listingSlug","pricingModel","publisherName","publisherSlug","subscription"],c:{subscription:{p:["activatedAt","billingCycle","cancelledAt","createdAt","currentPeriodEnd","currentPeriodStart","environment","expiresAt","gid","listingGid","mode","paymentStatus","publisherGid","status","targetAppGids","tierName","updatedAt"]}}}},{p:["cursor","data","hasMore"],c:{data:{a:{p:["appId","attemptCount","channel","completedAt","enqueuedAt","gid","lastAttemptAt","orgId","recipientId","status","statusHistory","typeSlug"]}}}},{p:["cursor","data","hasMore"],c:{data:{a:{p:["appId","archivedAt","body","channel","createdAt","dataJson","deepLink","expiresAt","gid","orgId","readAt","recipientId","shell","snoozedUntil","status","title","typeSlug"]}}}},{p:["archived"]},{p:["updated"]},{p:["data"],c:{data:{a:{p:["appId","channel","createdAt","digestCadence","globalMute","optIn","orgId","quietHoursEnd","quietHoursStart","recipientId","typeSlug","updatedAt"]}}}},{p:["cleared"]},{p:["unreadCount"]},{a:{p:["bodyTemplate","channel","createdAt","gid","locale","requiredVars","retired","subjectTemplate","typeSlug","updatedAt","version"]}},{p:["bodyTemplate","channel","createdAt","gid","locale","requiredVars","retired","subjectTemplate","typeSlug","updatedAt","version"]},{p:["retired"]},{p:["dispatchGid","emailQueued","inboxGid"]},{p:["body","subject","version"]},{p:["data"],c:{data:{a:{p:["appId","appliesIn","createdAt","defaultChannels","defaultLocale","gid","orgId","payloadSchemaJson","requiredVars","retired","severity","typeSlug","updatedAt","version"]}}}},{p:["appliesIn","createdAt","defaultChannels","defaultLocale","gid","payloadSchemaJson","requiredVars","retired","severity","typeSlug","updatedAt","version"]},{a:{p:["agentGid","boundaries","completedAt","constraints","createdAt","description","gid","lastActivityAt","milestones","name","priority","progress","schedule","status","type","updatedAt"],c:{constraints:{p:["allowedTimeWindows","maxCostPerAction","maxDailyActions","requiresApproval"]},milestones:{a:{p:["completed","completedAt","name"]}}}}},{p:["agentGid","boundaries","completedAt","constraints","createdAt","description","gid","lastActivityAt","milestones","name","priority","progress","schedule","status","type","updatedAt"],c:{constraints:{p:["allowedTimeWindows","maxCostPerAction","maxDailyActions","requiresApproval"]},milestones:{a:{p:["completed","completedAt","name"]}}}},{p:["progress"]},{p:["status","success","terminal"]},{a:{p:["archivedAt","avatar","connectionGids","createdAt","defaultModel","description","gid","isDiscoverable","language","leadAgentGid","maxTurns","name","personality","role","skillGids","slug","status","systemPrompt","tenantId","trustLevel","updatedAt"]}},{p:["archivedAt","avatar","connectionGids","createdAt","defaultModel","description","gid","isDiscoverable","language","leadAgentGid","maxTurns","name","personality","role","skillGids","slug","status","systemPrompt","tenantId","trustLevel","updatedAt"]},{p:["archivedAt","brain","gid","recoveryDeadlineMs","status"]},{p:["archivedAt","brain","gid"]},{p:["conversationId","executionId","output","status"]},{p:["conversationId","executionId","output"]},{p:["alreadyAssigned","success"]},{a:{p:["actionDescription","actionPayload","actionType","agentGid","approvedBy","conversationGid","createdAt","expiresAt","gid","reason","rejectedBy","requiredApprover","resolvedAt","riskFactors","riskTier","status","updatedAt"]}},{p:["actionDescription","actionPayload","actionType","agentGid","approvedBy","conversationGid","createdAt","expiresAt","gid","reason","rejectedBy","requiredApprover","resolvedAt","riskFactors","riskTier","status","updatedAt"]},{p:["approverBreakdown","count","oldestAgeMs"],c:{approverBreakdown:{a:{p:["count","requiredApprover"]}}}},{p:["createdAt","defaultModel","defaultProvider","gid","mode","providers","routing","tokenBudget","updatedAt"],c:{providers:{a:{p:["baseUrl","enabled","keyRef","models","name"]}},tokenBudget:{p:["perMonth","perRun"]}}},{p:["configId","gid"]},{p:["config","providers","stats"],c:{config:{p:["defaultModel","defaultProvider","mode","providers","routing","tokenBudget"],c:{providers:{a:{p:["baseUrl","enabled","keyRef","models","name"]}},tokenBudget:{p:["perMonth","perRun"]}}},providers:{a:{p:["apiKeyMasked","configured","defaultModel","displayName","enabled","modelsCount","name","status","usage24h","usageSharePct"]}},stats:{p:["attribution","cost24h","latencyP50","latencyP99","requests24h","tokens24h","windowCapHit"]}}},{p:["models","providers"],c:{models:{a:{p:["cachedPer1M","capabilities","contextWindow","deprecatedAt","gid","inputPer1M","label","latencyClass","modelId","outputPer1M","privacyClass","provider","source","syncedAt"]}},providers:{a:{p:["lastError","lastSyncedAt","provider","source","stale","syncState"]}}}},{p:["queued","skipped"],c:{queued:{a:{p:["provider"]}},skipped:{a:{p:["provider","reason"]}}}},{p:["keyRef"]},{p:["error","models"],c:{models:{a:{p:["id","label"]}}}},{p:["notes","range","stats","topAgents"],c:{notes:{p:["costSource","providerAttribution","readCap"]},stats:{p:["budgetConsumedPct","costInRange","requestsInRange","tokensInRange","windowCapHit"]},topAgents:{a:{p:["agentGid","costInRange","latencyP95","name","providerDots","rank","requestsInRange","tokensInRange","tokensSharePct","trend7d"]}}}},{p:["counts","ok","results"],c:{results:{a:{p:["action","family","gid","name"]}}}},{p:["agentGoals","agents","brainConfig","mcpServers","runnerEnvs","schemaVersion","skills","tools","triggers"]},{a:{p:["agentGid","appId","createdAt","envId","externalId","gid","lastMessageAt","source","status","summary","tenantId","title","updatedAt"]}},{p:["agentGid","appId","createdAt","envId","externalId","gid","lastMessageAt","source","status","summary","tenantId","title","updatedAt"]},{p:["agentGid","appId","createdAt","envId","externalId","gid","lastMessageAt","messages","source","status","summary","tenantId","title","updatedAt"],c:{messages:{a:{p:["agentGid","appId","compacted","content","conversationGid","createdAt","envId","expiresAt","externalMessageId","externalSenderId","gid","modelUsed","role","source","tokenCount","toolCallId","toolCalls","toolName","updatedAt"],c:{toolCalls:{a:{p:["arguments","id","name"]}}}}}}},{a:{p:["agentGid","agentName","appId","createdAt","envId","gid","lastMessageAt","lastMessagePreview","lastMessageRole","messageCount","status","summary","title","updatedAt"]}},{a:{p:["createdAt","delegateId","delegatorId","gid","parentSessionId","sessionId","status","taskCapabilities","taskDeadline","taskDescription","taskPriority","updatedAt","workflowId"]}},{a:{p:["createdAt","delegateId","delegateName","delegatorId","gid","parentSessionId","sessionId","status","taskCapabilities","taskDeadline","taskDescription","taskPriority","updatedAt","workflowId"]}},{p:["capabilities","limits","tier","upgradeTo"],c:{limits:{p:["usedAgents"]}}},{a:{p:["agentGid","approvalGid","arguments","attempts","batchGid","batchIndex","completedAt","conversationGid","createdAt","durationMs","error","gid","maxAttempts","metrics","output","parentExecutionGid","priority","skillGid","startedAt","status","toolName","triggerSource","triggerType","type"],c:{metrics:{p:["completedAt","durationMs","queuedAt","retries","startedAt","tokensUsed","turnsUsed"],c:{tokensUsed:{p:["input","output","total"]}}}}}},{p:["agentGid","approvalGid","arguments","attempts","batchGid","batchIndex","completedAt","conversationGid","createdAt","durationMs","error","gid","maxAttempts","metrics","output","parentExecutionGid","priority","skillGid","startedAt","status","toolName","triggerSource","triggerType","type"],c:{metrics:{p:["completedAt","durationMs","queuedAt","retries","startedAt","tokensUsed","turnsUsed"],c:{tokensUsed:{p:["input","output","total"]}}}}},{p:["alreadyTerminal","status"]},{p:["actor","agent","conversation","execution"],c:{actor:{p:["displayName","sourceId","type"]},agent:{p:["gid","name"]},conversation:{p:["gid","title"]},execution:{p:["agentGid","approvalGid","arguments","attempts","batchGid","batchIndex","completedAt","conversationGid","createdAt","durationMs","error","gid","maxAttempts","metrics","output","parentExecutionGid","priority","skillGid","startedAt","status","toolName","triggerSource","triggerType","type"],c:{metrics:{p:["completedAt","durationMs","queuedAt","retries","startedAt","tokensUsed","turnsUsed"],c:{tokensUsed:{p:["input","output","total"]}}}}}}},{a:{p:["conversationGid","data","executionGid","expiresAt","gid","sequence","timestamp","type"]}},{a:{p:["durationMs","endTime","error","gid","logs","operation","parentSpanId","service","spanId","startTime","status","tags","traceId"],c:{logs:{a:{p:["level","message","timestamp"]}}}}},{p:["executionGids","gid"]},{p:["avgDurationMs","cancelled","completed","failed","pending","running","toolUsage","total"]},{a:{p:["agentGid","conversationGid","executionGid","gid","guardrail","occurredAt","outcome","reason","subject","toolName"]}},{p:["agentGid","conversationGid","executionGid","gid","guardrail","occurredAt","outcome","reason","subject","toolName"]},{a:{p:["accountEmail","accountId","createdAt","gid","lastUsedAt","name","provider","scopes","status","tokenExpiresAt","updatedAt"]}},{p:["accountEmail","accountId","createdAt","gid","lastUsedAt","name","provider","scopes","status","tokenExpiresAt","updatedAt"]},{p:["disconnected"]},{p:["scheduled"]},{a:{p:["activatedAt","appId","autoResumeAt","createdAt","deactivatedAt","envId","gid","isActive","level","reason","resolutionNotes","resolvedAt","resolvedBy","targetAgentGid","threatLevel","turnedOnBy","updatedAt"],c:{turnedOnBy:{p:["clientId","kind","memberId"]}}}},{p:["activatedAt","appId","autoResumeAt","createdAt","deactivatedAt","envId","gid","isActive","level","reason","resolutionNotes","resolvedAt","resolvedBy","targetAgentGid","threatLevel","turnedOnBy","updatedAt"],c:{turnedOnBy:{p:["clientId","kind","memberId"]}}},{p:["active","agentBlocked","blockingLevel","states"],c:{states:{a:{p:["activatedAt","appId","autoResumeAt","createdAt","deactivatedAt","envId","gid","isActive","level","reason","resolutionNotes","resolvedAt","resolvedBy","targetAgentGid","threatLevel","turnedOnBy","updatedAt"],c:{turnedOnBy:{p:["clientId","kind","memberId"]}}}}}},{a:{p:["agentGid","appId","comment","conversationGid","correction","createdAt","envId","executionGid","gid","messageGid","metadata","ownerId","ownerType","processedAt","processedInto","rating","sentiment","type"],c:{processedInto:{p:["patternId"]}}}},{p:["feedbackGid"]},{a:{p:["agentGid","appId","confidence","consolidatedAt","createdAt","derivedFrom","envId","frequency","gid","isActive","lastAppliedAt","ownerId","ownerType","pattern","type","updatedAt"],c:{derivedFrom:{p:["executionIds","feedbackIds"]},pattern:{p:["contextSignals","description","expectedOutcome"]}}}},{p:["isActive","success"]},{a:{p:["agentGid","appId","confidence","createdAt","description","envId","expiresAt","gid","outcome","ownerId","ownerType","proposedAction","resolvedAt","signals","status","title","type"],c:{outcome:{p:["actualValue","success","userFeedback"]},proposedAction:{p:["description","parameters","skillGid","type"]},signals:{a:{p:["source","type","weight"]}}}}},{a:{p:["agentGid","appId","approvalGid","completedAt","createdAt","description","envId","error","executedAt","executionId","gid","goalGid","ownerId","ownerType","parameters","predictionGid","result","skillGid","status","title","type","userDecision","userDecisionAt","userModification"]}},{p:["decision","status"]},{p:["feedback","patterns","timeRange"],c:{feedback:{p:["avgRating","corrections","negative","positive","total"]},patterns:{p:["active","avgConfidence","byType","total"]}}},{a:{p:["gid","lastError","mcpServerGid","status","tokenExpiresAt","updatedAt"]}},{a:{p:["authMethod","createdAt","description","gid","hasSecret","lastError","lastSyncedAt","mcpProtocolVersion","name","serverInfo","serverUrl","status","toolCount","updatedAt"]}},{p:["discoveredTools","gid","lastError","status"],c:{discoveredTools:{a:{p:["description","name"]}}}},{p:["authMethod","createdAt","description","gid","hasSecret","lastError","lastSyncedAt","mcpProtocolVersion","name","serverInfo","serverUrl","status","toolCount","updatedAt"]},{p:["authorizeUrl","expiresAt"]},{p:["disabledTools"]},{p:["confidential","gid"]},{p:["error","status","toolCount"]},{p:["gid","rotatedAt"]},{p:["error","ok","toolCount","tools"],c:{tools:{a:{p:["description","name"]}}}},{p:["content","contentType","gid","importance","key","tags","type"]},{p:["algorithm","authTagPreviewHash","ciphertextPreviewHash","encryptedAt","keyVersion","memoryGid","nonce","nonceB64Masked","nonceMasked","sizeBytes","sizeBytesOverhead","sizeBytesPlaintext","updatedAt","vaultSecretId"]},{p:["keyVersionAfter","keyVersionBefore","memoryGid","success"]},{a:{p:["accessCount","agentGid","contentType","conversationGid","createdAt","expiresAt","gid","importance","isQuarantined","key","lastAccessedAt","quarantineReason","quarantinedAt","scope","sizeBytes","source","sourceId","tags","type","updatedAt"]}},{p:["accessCount","agentGid","contentType","conversationGid","createdAt","expiresAt","gid","importance","isQuarantined","key","lastAccessedAt","quarantineReason","quarantinedAt","scope","sizeBytes","source","sourceId","tags","type","updatedAt"]},{p:["memories","nextCursor"],c:{memories:{a:{p:["accessCount","agentGid","contentType","conversationGid","createdAt","expiresAt","gid","importance","isQuarantined","key","lastAccessedAt","quarantineReason","quarantinedAt","scope","sizeBytes","source","sourceId","tags","type","updatedAt"]}}}},{p:["executionTimeMs","keywordLeg","memories","rerank","totalFound"],c:{keywordLeg:{p:["bound","candidates","ran","skippedReason"]},memories:{a:{p:["matchType","memory","score"],c:{memory:{p:["accessCount","agentGid","contentType","conversationGid","createdAt","expiresAt","gid","importance","isQuarantined","key","lastAccessedAt","quarantineReason","quarantinedAt","scope","sizeBytes","source","sourceId","tags","type","updatedAt"]}}}}}},{p:["executionTimeMs","memories","query","totalFound"],c:{memories:{a:{p:["decayFactor","finalScore","importanceFactor","keywordScore","matchType","memoryGid","rank","rrfScore","vectorScore"]}}}},{p:["compactedAt","compactedFromMessages","conversation","downstreamMemories","memory"],c:{compactedFromMessages:{a:{p:["content","conversationGid","createdAt","gid","role"]}},conversation:{p:["gid","title"]},downstreamMemories:{a:{p:["gid","type"]}},memory:{p:["accessCount","agentGid","createdAt","gid","importance","lastAccessedAt","scope","tags","type","updatedAt"]}}},{p:["avgRank","days","memoryGid","neverFellOutOfTopK","series","totalRetrievals"],c:{series:{a:{p:["count","day"]}}}},{p:["inputsCount","memoriesCount","total"]},{p:["hasMore","items"],c:{items:{a:{p:["agentGid","contentType","createdAt","gid","quarantineReason","type","updatedAt"]}}}},{a:{p:["gid","labels","name","timestamp","type","value"]}},{p:["count","value"]},{p:["agents","conversations","executions","memories","timestamp"],c:{agents:{p:["active","total"]},conversations:{p:["activeToday","total"]},executions:{p:["lastDay","lastHour","successRate","total"]},memories:{p:["total"]}}},{a:{p:["gid","lastTriggeredAt","message","metadata","name","severity","source","status","triggerCount","triggeredAt"]}},{a:{p:["count","fingerprint","firstOccurrence","gid","lastOccurrence","message","metadata","resolvedAt","source","stack","status","type"]}},{p:["buckets","byField","endTime","startTime","totalErrors","uniqueGroups"],c:{buckets:{a:{p:["count","firstSeen","key","lastSeen"]}}}},{a:{p:["agentGid","endTime","error","gid","logs","operation","parentSpanId","service","spanId","startTime","status","tags","traceId"],c:{logs:{a:{p:["level","message","timestamp"]}}}}},{p:["enabledCount","items","total"],c:{items:{a:{p:["enabled","fires24h","gid","lastTriggeredAt","name","triggerCount","type"]}}}},{p:["algorithm","lastWrite","quarantined","scopes","total"],c:{scopes:{p:["private","team","tenant"]}}},{p:["errorCount24h","errorRate24h","latencyP50Ms","latencyP95Ms","latencyP99Ms","rate24h","ratePerHour","sparkline"]},{p:["agents","conversations","executions","memories","skills","triggers"],c:{agents:{p:["active","total"]},conversations:{p:["total"]},executions:{p:["last24h","total"]},memories:{p:["active","total"]},skills:{p:["active","total"]},triggers:{p:["active","total"]}}},{p:["items"],c:{items:{a:{p:["approach","gid","name","runs7d","sparkline","status","successRate"]}}}},{a:{p:["appId","category","confidence","createdAt","description","discoveredAt","envId","evidence","gid","isActive","key","lastValidated","ownerId","ownerType","source","updatedAt","value"]}},{p:["appId","category","confidence","createdAt","description","discoveredAt","envId","evidence","gid","isActive","key","lastValidated","ownerId","ownerType","source","updatedAt","value"]},{p:["lastValidated","success"]},{a:{p:["agentGid","appId","category","createdAt","definition","description","envId","gid","name","ownerId","ownerType","promotedAt","sourcePatternGid","status","successRate","updatedAt","usageCount","validationResults"],c:{definition:{p:["parameters","toolSequence","triggerConditions"]}}}},{p:["agentGid","appId","category","createdAt","definition","description","envId","gid","name","ownerId","ownerType","promotedAt","sourcePatternGid","status","successRate","updatedAt","usageCount","validationResults"],c:{definition:{p:["parameters","toolSequence","triggerConditions"]}}},{a:{p:["category","description","name","parameters","skillGid"],c:{parameters:{a:{p:["description","name","required","type"]}}}}},{p:["draftsCreated","errors","message","promoted","stagesRun","synthesized"]},{a:{p:["appId","category","createdAt","definition","description","enabled","envId","executor","gid","icon","isBuiltIn","limits","name","ownerId","ownerType","sandboxId","slug","tenantId","updatedAt"],c:{definition:{p:["containerImage","endpoint","examples","systemPrompt","tools"],c:{examples:{a:{p:["input","output"]}}}},limits:{p:["maxCost","maxExecutionTime","maxMemory"]}}}},{p:["appId","category","createdAt","definition","description","enabled","envId","executor","gid","icon","isBuiltIn","limits","name","ownerId","ownerType","sandboxId","slug","tenantId","updatedAt"],c:{definition:{p:["containerImage","endpoint","examples","systemPrompt","tools"],c:{examples:{a:{p:["input","output"]}}}},limits:{p:["maxCost","maxExecutionTime","maxMemory"]}}},{p:["appId","category","createdAt","definition","description","enabled","envId","executions","executor","gid","icon","isBuiltIn","limits","name","ownerId","ownerType","sandboxId","slug","tenantId","updatedAt"],c:{definition:{p:["containerImage","endpoint","examples","systemPrompt","tools"],c:{examples:{a:{p:["input","output"]}}}},executions:{a:{p:["agentGid","appId","completedAt","conversationGid","cost","durationMs","envId","error","executorType","expiresAt","gid","input","output","ownerId","ownerType","skillGid","startedAt","status","tokensUsed","updatedAt"]}},limits:{p:["maxCost","maxExecutionTime","maxMemory"]}}},{p:["avgDurationMs","invocations","p95DurationMs","recent","skillGid","successCount","successRatePct"],c:{recent:{a:{p:["completedAt","cost","durationMs","error","gid","startedAt","status","tokensUsed"]}}}},{p:["capCents","periodStart","resetsAt","spentCents"]},{p:["capCents"]},{p:["lead","specialists"],c:{lead:{p:["agentGid","createdAt","description","gid","name","status"]},specialists:{a:{p:["agentGid","createdAt","description","gid","name","role","skillGids","status"]}}}},{p:["alreadyExists","gid","teamId"]},{p:["activeCount","lead","specialistCount","specialists"],c:{lead:{p:["agentGid","createdAt","description","gid","name","status","systemPrompt","updatedAt"]},specialists:{a:{p:["agentGid","createdAt","description","gid","name","role","skillGids","status"]}}}},{p:["archivedAt","archivedCount","status","success","teamGid"]},{p:["agentGid","leadAgentGid","success"]},{p:["capabilityMatchReason","result","specialistAgentId","specialistName"],c:{result:{p:["error","metrics","response","status"],c:{metrics:{p:["durationMs","tokensUsed","turnsUsed"],c:{tokensUsed:{p:["input","output","total"]}}}}}}},{p:["agentId","memberRole"]},{p:["agentGid","success"]},{p:["alreadyExists","gid","specialistAgentIds","teamId"]},{a:{p:["createdAt","externalId","gid","metadata","name","status","updatedAt"]}},{p:["createdAt","externalId","gid","metadata","name","status","updatedAt"]},{a:{p:["authType","category","createdAt","description","enabled","endpoint","executor","gid","hasSecret","headers","lastUsedAt","name","outputSchema","ownerId","ownerType","parameters","requiresApproval","riskLevel","scopes","slug","source","sourceId","timeout","updatedAt","uri","usageCount"]}},{p:["gid","hmacSecret"]},{p:["authType","category","createdAt","description","enabled","endpoint","executor","gid","hasSecret","headers","lastUsedAt","name","outputSchema","ownerId","ownerType","parameters","requiresApproval","riskLevel","scopes","slug","source","sourceId","timeout","updatedAt","uri","usageCount"]},{p:["error","latencyMs","ok","request","response","signed","sizeBytes","status","statusText"],c:{request:{p:["body","headers","method","url"]},response:{p:["body","headers"]}}},{p:["count","tools"]},{p:["buckets","endTime","startTime","totalInvocations","uniqueTools"],c:{buckets:{a:{p:["avgDurationMs","invocations","p95DurationMs","successCount","successRatePct","toolName"]}}}},{a:{p:["action","agentGid","appId","conditions","config","createdAt","description","enabled","envId","gid","lastTriggeredAt","name","ownerId","ownerType","sandboxId","slug","tenantId","triggerCount","type","updatedAt"],c:{action:{p:["goal","maxTurns","skillGids"]},conditions:{a:{p:["field","operator","value"]}},config:{p:["channel","cronExpression","eventType","webhookId","webhookSecret"]}}}},{p:["gid","webhookSecret"]},{p:["action","agentGid","appId","conditions","config","createdAt","description","enabled","envId","gid","lastTriggeredAt","name","ownerId","ownerType","sandboxId","slug","tenantId","triggerCount","type","updatedAt"],c:{action:{p:["goal","maxTurns","skillGids"]},conditions:{a:{p:["field","operator","value"]}},config:{p:["channel","cronExpression","eventType","webhookId","webhookSecret"]}}},{p:["action","agentGid","appId","conditions","config","createdAt","description","enabled","envId","executions","gid","lastTriggeredAt","name","ownerId","ownerType","sandboxId","slug","tenantId","triggerCount","type","updatedAt"],c:{action:{p:["goal","maxTurns","skillGids"]},conditions:{a:{p:["field","operator","value"]}},config:{p:["channel","cronExpression","eventType","webhookId","webhookSecret"]},executions:{a:{p:["agentGid","appId","completedAt","envId","error","expiresAt","gid","ownerId","ownerType","result","startedAt","status","triggerGid","updatedAt"]}}}},{p:["executionGid"]},{p:["appId","dayUtcMs","envId","invocations","orgId","tenantId"]},{p:["history","total"],c:{history:{a:{p:["executions","timestamp","tokens"]}}}},{p:["executions","tokens"],c:{executions:{p:["limit","remaining","used"]},tokens:{p:["limit","remaining","used"]}}},{p:["agentRuns","chatMessages","memoriesStored","skillExecutions","tokensUsed"]},{a:{p:["createdAt","enabled","events","gid","status","url"]}},{p:["gid","secret"]}],ops:[["GET","/v1/account/environments",204],["POST","/v1/account/environments",205],["GET","/v1/account/environments/{slug}",205],["POST","/v1/account/environments/{slug}/clone",207],["GET","/v1/adapters",0],["POST","/v1/adapters",1],["DELETE","/v1/adapters/{adapterGid}",4],["GET","/v1/adapters/{adapterGid}",2],["PATCH","/v1/adapters/{adapterGid}",3],["GET","/v1/analytics/events/tail",208],["GET","/v1/analytics/rollups",209],["GET","/v1/analytics/sketches/percentile",210],["GET","/v1/analytics/sketches/topk",211],["GET","/v1/analytics/summary",212],["GET","/v1/apps/channels",5],["POST","/v1/apps/channels",6],["GET","/v1/apps/channels/by-slug/{slug}",6],["GET","/v1/apps/channels/paginated",7],["GET","/v1/apps/channels/stats",8],["GET","/v1/apps/deliveries",9],["GET","/v1/apps/dlq",10],["GET","/v1/apps/dpop-keys",11],["POST","/v1/apps/dpop-keys",12],["DELETE","/v1/apps/dpop-keys/{thumbprint}",13],["GET","/v1/apps/events/types",14],["GET","/v1/apps/events/types/deprecated",15],["GET","/v1/apps/messages",16],["GET","/v1/apps/subscriptions",17],["GET","/v1/audit/chain/status",213],["GET","/v1/audit/events/get",214],["GET","/v1/audit/events/list",215],["GET","/v1/audit/events/stats",216],["GET","/v1/billing/account-status",217],["PATCH","/v1/billing/account/address",3],["PATCH","/v1/billing/account/email",3],["POST","/v1/billing/connect-accounts/ensure",218],["POST","/v1/billing/connect-accounts/session",219],["GET","/v1/billing/credits",220],["GET","/v1/billing/disputes",222],["GET","/v1/billing/disputes/{disputeId}",223],["GET","/v1/billing/dunning",224],["GET","/v1/billing/dunning/recovery-status",225],["GET","/v1/billing/earnings/summary",226],["GET","/v1/billing/feed-listings/can-subscribe",227],["GET","/v1/billing/feed-listings/default-payment-method-preview",228],["POST","/v1/billing/feed-listings/subscribe",229],["POST","/v1/billing/feed-listings/subscribe-with-saved-card",230],["GET","/v1/billing/invoices",232],["GET","/v1/billing/invoices/{invoiceId}",233],["GET","/v1/billing/invoices/{invoiceId}/pdf",234],["GET","/v1/billing/payment-methods",235],["POST","/v1/billing/payment-methods/attach",236],["POST","/v1/billing/payment-methods/detach",3],["POST","/v1/billing/payment-methods/set-default",3],["POST","/v1/billing/payment-methods/setup-intent",237],["GET","/v1/billing/payouts",238],["GET","/v1/billing/plans/catalogue",239],["GET","/v1/billing/plans/tier-changes",240],["GET","/v1/billing/revenue/summary",241],["GET","/v1/billing/subscriptions",242],["POST","/v1/billing/subscriptions",243],["POST","/v1/billing/subscriptions/cancel",245],["POST","/v1/billing/subscriptions/confirm-payment",246],["POST","/v1/billing/subscriptions/preview",247],["POST","/v1/billing/subscriptions/reactivate",245],["POST","/v1/billing/subscriptions/tier-change",248],["GET","/v1/billing/subscriptions/{subscriptionId}",244],["GET","/v1/billing/tax-ids",249],["POST","/v1/billing/tax-ids",250],["DELETE","/v1/billing/tax-ids/{taxIdId}",3],["POST","/v1/billing/tax/preview",251],["POST","/v1/billing/test-clock/advance",252],["GET","/v1/billing/usage/quotas",253],["GET","/v1/billing/usage/summary",254],["POST","/v1/channels/{channelGid}/cold-tier/replay",18],["GET","/v1/channels/{channelGid}/consumer-groups",19],["GET","/v1/channels/{channelGid}/scheduled-messages",20],["POST","/v1/channels/{channelGid}/seek-to-timestamp",21],["POST","/v1/channels/{channelGid}/time-travel/diff",22],["POST","/v1/channels/{channelGid}/time-travel/snapshot",23],["POST","/v1/channels/{channelGid}/time-travel/snapshot/grant",24],["DELETE","/v1/channels/{channelId}",27],["GET","/v1/channels/{channelId}",25],["PATCH","/v1/channels/{channelId}",26],["POST","/v1/channels/{channelId}/archive",3],["GET","/v1/channels/{channelId}/archive-status",28],["GET","/v1/channels/{channelId}/delivery-overview",29],["GET","/v1/channels/{channelId}/detail",30],["GET","/v1/channels/{channelId}/messages",16],["POST","/v1/channels/{channelId}/messages",1],["POST","/v1/channels/{channelId}/messages/archive",31],["POST","/v1/channels/{channelId}/messages/batch",32],["POST","/v1/channels/{channelId}/messages/batch-npp",33],["POST","/v1/channels/{channelId}/messages/group",34],["GET","/v1/channels/{channelId}/messages/partition/{partitionKey}",16],["POST","/v1/channels/{channelId}/pause",3],["GET","/v1/channels/{channelId}/receipts",35],["POST","/v1/channels/{channelId}/restore",3],["POST","/v1/channels/{channelId}/resume",3],["GET","/v1/channels/{channelId}/security/scan-sample",36],["POST","/v1/channels/{channelId}/seek",37],["GET","/v1/channels/{channelId}/streams/cross-org",38],["POST","/v1/channels/{channelId}/streams/cross-org/read",39],["POST","/v1/channels/{channelId}/streams/offset",3],["GET","/v1/channels/{channelId}/streams/offsets",40],["GET","/v1/channels/{channelId}/streams/read",39],["POST","/v1/channels/{channelId}/streams/seek",3],["POST","/v1/channels/{channelId}/subscribe",41],["GET","/v1/channels/{channelId}/subscriptions",17],["POST","/v1/channels/{channelId}/subscriptions",42],["GET","/v1/channels/{channelId}/subscriptions/health",43],["POST","/v1/channels/{targetChannelGid}/replay",44],["POST","/v1/channels/{targetChannelGid}/replay-with-grant",45],["GET","/v1/connect/bridges",46],["POST","/v1/connect/bridges",1],["GET","/v1/connect/bridges/{bridgeGid}",47],["POST","/v1/connect/bridges/{bridgeGid}/archive",13],["POST","/v1/connect/bridges/{bridgeGid}/confirm",255],["POST","/v1/connect/bridges/{bridgeGid}/suspend",13],["GET","/v1/connect/consents",48],["GET","/v1/connect/explore",49],["GET","/v1/connect/explore/search",49],["GET","/v1/connect/explore/{appId}",50],["GET","/v1/connect/explore/{appId}/compliance",51],["GET","/v1/connect/grants",52],["POST","/v1/connect/grants",13],["POST","/v1/connect/grants/resume-all",59],["POST","/v1/connect/grants/suspend-all",60],["GET","/v1/connect/grants/{grantId}",53],["POST","/v1/connect/grants/{grantId}/approve",3],["GET","/v1/connect/grants/{grantId}/audit",256],["GET","/v1/connect/grants/{grantId}/consents",48],["POST","/v1/connect/grants/{grantId}/pause",54],["GET","/v1/connect/grants/{grantId}/rates",55],["POST","/v1/connect/grants/{grantId}/reject",3],["POST","/v1/connect/grants/{grantId}/replay-dropped",56],["POST","/v1/connect/grants/{grantId}/resume",54],["POST","/v1/connect/grants/{grantId}/revoke",257],["GET","/v1/connect/grants/{grantId}/trust-score",57],["GET","/v1/connect/grants/{grantId}/usage",58],["GET","/v1/connect/graph",61],["GET","/v1/connect/partner/apps",258],["POST","/v1/connect/partner/apps/{appId}/delist",259],["POST","/v1/connect/partner/apps/{appId}/freeze",259],["POST","/v1/connect/partner/apps/{appId}/reinstate",259],["GET","/v1/connect/partner/apps/{appId}/tenant-approvals",260],["GET","/v1/connect/partner/audit",62],["GET","/v1/connect/partner/tenant-approvals",63],["POST","/v1/connect/partner/tenant-approvals/{approvalGid}/override",261],["GET","/v1/connect/platform-connects/{connectGid}/approvals",63],["GET","/v1/connect/profile",64],["PATCH","/v1/connect/profile/{appId}",3],["GET","/v1/connect/publish-grants",262],["POST","/v1/connect/publish-grants",263],["GET","/v1/connect/publish-grants/{id}",264],["POST","/v1/connect/publish-grants/{id}/pause",263],["POST","/v1/connect/publish-grants/{id}/resume",263],["POST","/v1/connect/publish-grants/{id}/revoke",263],["GET","/v1/connect/tenant-approvals",63],["POST","/v1/connect/tenant-approvals",265],["GET","/v1/connect/tenant-approvals/{approvalGid}",65],["POST","/v1/connect/tenant-approvals/{approvalGid}/revoke",3],["DELETE","/v1/consumer-groups/{consumerGroupGid}",67],["GET","/v1/consumer-groups/{consumerGroupGid}",66],["POST","/v1/consumer-groups/{consumerGroupGid}/members",68],["DELETE","/v1/consumer-groups/{consumerGroupGid}/members/{subscriptionGid}",3],["POST","/v1/consumer-groups/{consumerGroupGid}/members/{subscriptionGid}/receive",69],["POST","/v1/consumer-groups/{consumerGroupGid}/pause",13],["POST","/v1/consumer-groups/{consumerGroupGid}/resume",13],["GET","/v1/deliveries/{deliveryGid}",70],["POST","/v1/deliveries/{deliveryGid}/cancel",71],["POST","/v1/deliveries/{deliveryGid}/retry",72],["GET","/v1/deliveries/{deliveryId}/receipt",73],["GET","/v1/deliveries/{deliveryId}/timeline",74],["GET","/v1/delivery-receipts/{deliveryId}",75],["POST","/v1/delivery-receipts/{deliveryId}/confirm",76],["POST","/v1/dlq/discard",79],["POST","/v1/dlq/reprocess",80],["POST","/v1/dlq/retry",81],["GET","/v1/dlq/{dlqEntryId}",77],["POST","/v1/dlq/{dlqEntryId}/discard",78],["POST","/v1/dlq/{dlqEntryId}/reprocess",78],["GET","/v1/entity-nat/resolve",82],["GET","/v1/entity-nat/reverse-resolve",83],["GET","/v1/events/stats",84],["GET","/v1/events/types/by-name/{name}",85],["GET","/v1/events/types/{eventTypeGid}",85],["POST","/v1/events/types/{eventTypeGid}/compatibility",86],["GET","/v1/events/types/{eventTypeGid}/consumers",87],["GET","/v1/events/types/{eventTypeGid}/impact",88],["GET","/v1/events/types/{eventTypeGid}/versions",89],["GET","/v1/exactly-once/delivered",90],["POST","/v1/exactly-once/tokens",91],["POST","/v1/exactly-once/tokens/{token}/confirm",92],["DELETE","/v1/exchange-bindings/{binding_gid}",3],["GET","/v1/exchanges",93],["POST","/v1/exchanges",94],["GET","/v1/exchanges/stats",100],["DELETE","/v1/exchanges/{exchange_gid}",95],["GET","/v1/exchanges/{exchange_gid}",94],["PATCH","/v1/exchanges/{exchange_gid}",94],["GET","/v1/exchanges/{exchange_gid}/bindings",96],["POST","/v1/exchanges/{exchange_gid}/bindings",97],["POST","/v1/exchanges/{exchange_gid}/disable",3],["POST","/v1/exchanges/{exchange_gid}/dry-run",98],["POST","/v1/exchanges/{exchange_gid}/enable",3],["POST","/v1/exchanges/{exchange_gid}/publish",99],["GET","/v1/exchanges/{exchange_gid}/raw",94],["GET","/v1/feeds/customers",101],["GET","/v1/feeds/customers/{subscriptionId}",102],["GET","/v1/feeds/enrichment/listings",103],["GET","/v1/feeds/enrichment/subscriptions",104],["GET","/v1/feeds/listing-eligible-apps",266],["GET","/v1/feeds/listings",267],["POST","/v1/feeds/listings",1],["POST","/v1/feeds/listings/upload-url",269],["DELETE","/v1/feeds/listings/{listingId}",196],["GET","/v1/feeds/listings/{listingId}",268],["POST","/v1/feeds/listings/{listingId}",196],["POST","/v1/feeds/listings/{listingId}/pricing",196],["GET","/v1/feeds/listings/{listingId}/promise",105],["PUT","/v1/feeds/listings/{listingId}/promise",106],["POST","/v1/feeds/listings/{listingId}/publish",196],["GET","/v1/feeds/listings/{listingId}/reviews",107],["POST","/v1/feeds/listings/{listingId}/submit",196],["POST","/v1/feeds/listings/{listingId}/subscribe",13],["POST","/v1/feeds/listings/{listingId}/unpublish",196],["POST","/v1/feeds/listings/{listingId}/withdraw",196],["GET","/v1/feeds/mirror/listings/{listingId}",108],["GET","/v1/feeds/mirror/publishers/{publisherId}",109],["GET","/v1/feeds/payouts",270],["GET","/v1/feeds/publisher-eligibility",271],["GET","/v1/feeds/publishers",272],["POST","/v1/feeds/publishers",13],["GET","/v1/feeds/publishers/by-slug/{slug}",273],["GET","/v1/feeds/publishers/me",276],["GET","/v1/feeds/publishers/{publisherId}",273],["POST","/v1/feeds/publishers/{publisherId}",196],["GET","/v1/feeds/publishers/{publisherId}/listings",274],["POST","/v1/feeds/publishers/{publisherId}/revoke",196],["GET","/v1/feeds/publishers/{publisherId}/subscriber-count",275],["GET","/v1/feeds/publishers/{publisherSlug}/listings/{listingSlug}",268],["GET","/v1/feeds/reputation/me",110],["GET","/v1/feeds/resolve/{publisherSlug}/{listingSlug}",277],["GET","/v1/feeds/revenue/customers/{subscriptionId}",278],["GET","/v1/feeds/revenue/listings",279],["GET","/v1/feeds/reviews/{reviewId}",111],["POST","/v1/feeds/reviews/{reviewId}/flag",1],["POST","/v1/feeds/reviews/{reviewId}/respond",1],["GET","/v1/feeds/subscriptions",281],["GET","/v1/feeds/subscriptions/enriched",284],["DELETE","/v1/feeds/subscriptions/{subscriptionId}",196],["GET","/v1/feeds/subscriptions/{subscriptionId}",282],["GET","/v1/feeds/subscriptions/{subscriptionId}/bindings",112],["POST","/v1/feeds/subscriptions/{subscriptionId}/convert-to-paid",283],["POST","/v1/feeds/subscriptions/{subscriptionId}/pause",196],["POST","/v1/feeds/subscriptions/{subscriptionId}/resume",196],["POST","/v1/feeds/subscriptions/{subscriptionId}/reviews",1],["GET","/v1/feeds/subscriptions/{subscriptionId}/trial",113],["GET","/v1/groups/{groupId}/grants/{grantId}/deliveries",9],["DELETE","/v1/kv/{channelGid}/{key}",3],["GET","/v1/kv/{channelGid}/{key}",114],["PUT","/v1/kv/{channelGid}/{key}",115],["GET","/v1/kv/{channelGid}/{key}/history",116],["GET","/v1/messages/search",121],["GET","/v1/messages/{messageGid}/deliveries",9],["POST","/v1/messages/{messageGid}/time-travel",117],["GET","/v1/messages/{messageId}",118],["GET","/v1/messages/{messageId}/delivery-status",119],["GET","/v1/messages/{messageId}/receipts",120],["GET","/v1/notifications/dispatches",285],["GET","/v1/notifications/inbox",286],["POST","/v1/notifications/inbox/mark-all-read",288],["POST","/v1/notifications/inbox/{gid}/archive",287],["POST","/v1/notifications/inbox/{gid}/mark-read",288],["DELETE","/v1/notifications/preferences",290],["GET","/v1/notifications/preferences",289],["PUT","/v1/notifications/preferences",288],["PUT","/v1/notifications/preferences/digest",288],["PUT","/v1/notifications/preferences/global-mute",288],["PUT","/v1/notifications/preferences/quiet-hours",288],["GET","/v1/notifications/summary",291],["GET","/v1/notifications/templates",292],["POST","/v1/notifications/templates",1],["POST","/v1/notifications/templates/preview",296],["GET","/v1/notifications/templates/{gid}",293],["PATCH","/v1/notifications/templates/{gid}",288],["POST","/v1/notifications/templates/{gid}/retire",294],["POST","/v1/notifications/templates/{gid}/test-send",295],["GET","/v1/notifications/types",297],["GET","/v1/notifications/types/{typeSlug}",298],["GET","/v1/pipes/agent-executions",122],["GET","/v1/pipes/agent-executions/{agentExecutionGid}",123],["GET","/v1/pipes/analyses",124],["GET","/v1/pipes/analyses/{analysisGid}",125],["GET","/v1/pipes/connectors",126],["GET","/v1/pipes/credentials",127],["POST","/v1/pipes/credentials",128],["POST","/v1/pipes/credentials/test",133],["DELETE","/v1/pipes/credentials/{credentialId}",130],["PATCH","/v1/pipes/credentials/{credentialId}",129],["POST","/v1/pipes/credentials/{credentialId}/revoke",131],["POST","/v1/pipes/credentials/{credentialId}/rotate",132],["GET","/v1/pipes/decisions",134],["GET","/v1/pipes/decisions/{decisionGid}",135],["POST","/v1/pipes/decisions/{decisionGid}/approve",136],["POST","/v1/pipes/decisions/{decisionGid}/reject",136],["GET","/v1/pipes/dlq",137],["GET","/v1/pipes/dlq/stats",140],["GET","/v1/pipes/dlq/{dlqEntryId}",138],["POST","/v1/pipes/dlq/{dlqEntryId}/discard",139],["GET","/v1/pipes/executions/{executionId}",141],["POST","/v1/pipes/executions/{executionId}/cancel",13],["GET","/v1/pipes/executions/{executionId}/status",141],["GET","/v1/pipes/governance",142],["PATCH","/v1/pipes/governance",142],["DELETE","/v1/pipes/governance/allowlist",3],["POST","/v1/pipes/governance/allowlist",3],["GET","/v1/pipes/governance/approvals",143],["POST","/v1/pipes/governance/approvals",144],["GET","/v1/pipes/governance/approvals/pending",143],["POST","/v1/pipes/governance/approvals/{requestId}/approve",3],["POST","/v1/pipes/governance/approvals/{requestId}/reject",3],["GET","/v1/pipes/governance/audit",145],["DELETE","/v1/pipes/governance/blocklist",3],["POST","/v1/pipes/governance/blocklist",3],["POST","/v1/pipes/governance/connectors/{connectorGid}/revoke",3],["GET","/v1/pipes/record-dlq",146],["GET","/v1/pipes/record-dlq/stats",150],["GET","/v1/pipes/record-dlq/{entryGid}",147],["POST","/v1/pipes/record-dlq/{entryGid}/discard",148],["POST","/v1/pipes/record-dlq/{entryGid}/replay",149],["GET","/v1/pipes/tools",151],["GET","/v1/pipes/tools/{toolName}",152],["GET","/v1/pipes/watermarks",153],["GET","/v1/pipes/watermarks/{sourceId}",154],["POST","/v1/pipes/watermarks/{watermarkGid}/reset",155],["GET","/v1/pipes/webhook-triggers",156],["GET","/v1/pipes/webhook-triggers/{workflowId}",157],["POST","/v1/pipes/webhook-triggers/{workflowId}/rotate-secret",158],["GET","/v1/pipes/workflows",159],["POST","/v1/pipes/workflows",160],["DELETE","/v1/pipes/workflows/{workflowId}",162],["GET","/v1/pipes/workflows/{workflowId}",160],["PATCH","/v1/pipes/workflows/{workflowId}",161],["POST","/v1/pipes/workflows/{workflowId}/activate",163],["POST","/v1/pipes/workflows/{workflowId}/archive",163],["GET","/v1/pipes/workflows/{workflowId}/executions",164],["PATCH","/v1/pipes/workflows/{workflowId}/meta",161],["POST","/v1/pipes/workflows/{workflowId}/nodes/{nodeId}/execute",165],["POST","/v1/pipes/workflows/{workflowId}/pause",163],["POST","/v1/pipes/workflows/{workflowId}/trigger",166],["PATCH","/v1/pipes/workflows/{workflowId}/trigger-config",167],["GET","/v1/primus/agent-goals",299],["POST","/v1/primus/agent-goals",1],["GET","/v1/primus/agent-goals/{goalId}",300],["PATCH","/v1/primus/agent-goals/{goalId}",3],["POST","/v1/primus/agent-goals/{goalId}/progress",301],["POST","/v1/primus/agent-goals/{goalId}/status",302],["GET","/v1/primus/agents",303],["POST","/v1/primus/agents",1],["DELETE","/v1/primus/agents/{agentId}",305],["GET","/v1/primus/agents/{agentId}",304],["PATCH","/v1/primus/agents/{agentId}",1],["POST","/v1/primus/agents/{agentId}/activate",1],["POST","/v1/primus/agents/{agentId}/archive",306],["POST","/v1/primus/agents/{agentId}/invoke",307],["POST","/v1/primus/agents/{agentId}/pause",1],["POST","/v1/primus/agents/{agentId}/run",308],["POST","/v1/primus/agents/{agentId}/skills/assign",309],["POST","/v1/primus/agents/{agentId}/skills/unassign",3],["GET","/v1/primus/approvals",310],["POST","/v1/primus/approvals",1],["GET","/v1/primus/approvals/by-agent",310],["GET","/v1/primus/approvals/pending",310],["GET","/v1/primus/approvals/pending/summary",312],["GET","/v1/primus/approvals/{approvalId}",311],["POST","/v1/primus/approvals/{approvalId}/approve",1],["POST","/v1/primus/approvals/{approvalId}/reject",1],["DELETE","/v1/primus/brain/config",4],["GET","/v1/primus/brain/config",313],["PUT","/v1/primus/brain/config",314],["GET","/v1/primus/brain/llm-dashboard",315],["GET","/v1/primus/brain/models",316],["POST","/v1/primus/brain/models/refresh",317],["POST","/v1/primus/brain/provider-keys",318],["POST","/v1/primus/brain/provider-models",319],["GET","/v1/primus/brain/usage-dashboard",320],["POST","/v1/primus/config/apply",321],["GET","/v1/primus/config/export",322],["GET","/v1/primus/conversations",323],["POST","/v1/primus/conversations",1],["GET","/v1/primus/conversations/by-agent",323],["GET","/v1/primus/conversations/stats",326],["DELETE","/v1/primus/conversations/{conversationId}",1],["GET","/v1/primus/conversations/{conversationId}",324],["PATCH","/v1/primus/conversations/{conversationId}",1],["POST","/v1/primus/conversations/{conversationId}/archive",1],["GET","/v1/primus/conversations/{conversationId}/messages",325],["POST","/v1/primus/conversations/{conversationId}/send",1],["GET","/v1/primus/delegations/by-delegate",327],["GET","/v1/primus/delegations/by-delegator",327],["GET","/v1/primus/delegations/by-team",328],["GET","/v1/primus/entitlements",329],["GET","/v1/primus/executions",330],["POST","/v1/primus/executions",13],["POST","/v1/primus/executions/batch",336],["GET","/v1/primus/executions/by-agent",330],["GET","/v1/primus/executions/by-conversation",330],["GET","/v1/primus/executions/pending-approvals",330],["GET","/v1/primus/executions/stats",337],["GET","/v1/primus/executions/{executionId}",331],["POST","/v1/primus/executions/{executionId}/approve",3],["POST","/v1/primus/executions/{executionId}/cancel",332],["GET","/v1/primus/executions/{executionId}/details",333],["GET","/v1/primus/executions/{executionId}/events",334],["POST","/v1/primus/executions/{executionId}/reject",3],["GET","/v1/primus/executions/{executionId}/traces",335],["GET","/v1/primus/guardrails/outcomes",338],["GET","/v1/primus/guardrails/outcomes/{outcomeId}",339],["GET","/v1/primus/integrations",340],["POST","/v1/primus/integrations/connect",1],["GET","/v1/primus/integrations/{connectionId}",341],["POST","/v1/primus/integrations/{connectionId}/disconnect",342],["POST","/v1/primus/integrations/{connectionId}/refresh",343],["GET","/v1/primus/kill-switch",344],["POST","/v1/primus/kill-switch/activate",1],["GET","/v1/primus/kill-switch/active",344],["GET","/v1/primus/kill-switch/check",345],["POST","/v1/primus/kill-switch/deactivate",3],["GET","/v1/primus/kill-switch/status",346],["GET","/v1/primus/kill-switch/{killSwitchId}",345],["GET","/v1/primus/learning/feedback",347],["POST","/v1/primus/learning/feedback",348],["GET","/v1/primus/learning/feedback/by-agent",347],["GET","/v1/primus/learning/patterns",349],["GET","/v1/primus/learning/patterns/by-agent",349],["POST","/v1/primus/learning/patterns/set-active",350],["GET","/v1/primus/learning/predictions",351],["GET","/v1/primus/learning/proactive-actions",352],["POST","/v1/primus/learning/proactive-actions/decide",353],["GET","/v1/primus/learning/stats",354],["GET","/v1/primus/mcp-connections",355],["POST","/v1/primus/mcp-connections/{credentialId}/revoke",1],["GET","/v1/primus/mcp-servers",356],["POST","/v1/primus/mcp-servers",357],["POST","/v1/primus/mcp-servers/test",364],["GET","/v1/primus/mcp-servers/{mcpServerId}",358],["POST","/v1/primus/mcp-servers/{mcpServerId}/connect/begin",359],["POST","/v1/primus/mcp-servers/{mcpServerId}/disconnect",360],["POST","/v1/primus/mcp-servers/{mcpServerId}/oauth/client",361],["POST","/v1/primus/mcp-servers/{mcpServerId}/reconnect",362],["POST","/v1/primus/mcp-servers/{mcpServerId}/rename",1],["POST","/v1/primus/mcp-servers/{mcpServerId}/rotate-auth",363],["POST","/v1/primus/memories/{memoryId}/decrypt",365],["GET","/v1/primus/memories/{memoryId}/encryption",366],["POST","/v1/primus/memories/{memoryId}/reencrypt",367],["GET","/v1/primus/memory",368],["POST","/v1/primus/memory",1],["GET","/v1/primus/memory/by-agent",368],["GET","/v1/primus/memory/by-conversation",368],["GET","/v1/primus/memory/quarantined",368],["GET","/v1/primus/memory/recall",370],["POST","/v1/primus/memory/search",371],["POST","/v1/primus/memory/search/explain",372],["POST","/v1/primus/memory/store",1],["GET","/v1/primus/memory/store/by-team",368],["GET","/v1/primus/memory/store/list",368],["GET","/v1/primus/memory/store/quarantine-summary",375],["GET","/v1/primus/memory/store/quarantined",376],["GET","/v1/primus/memory/store/{memoryId}/lineage",373],["GET","/v1/primus/memory/store/{memoryId}/retrieval-history",374],["DELETE","/v1/primus/memory/{memoryId}",3],["GET","/v1/primus/memory/{memoryId}",369],["PATCH","/v1/primus/memory/{memoryId}",3],["POST","/v1/primus/memory/{memoryId}/quarantine",3],["POST","/v1/primus/memory/{memoryId}/unquarantine",78],["GET","/v1/primus/metrics",377],["GET","/v1/primus/metrics/aggregate",378],["GET","/v1/primus/metrics/system",379],["GET","/v1/primus/observability/alerts",380],["POST","/v1/primus/observability/alerts/acknowledge",3],["POST","/v1/primus/observability/alerts/resolve",3],["GET","/v1/primus/observability/errors",381],["GET","/v1/primus/observability/errors/by-agent",381],["GET","/v1/primus/observability/errors/by-execution",381],["GET","/v1/primus/observability/errors/distribution",382],["POST","/v1/primus/observability/errors/resolve",3],["GET","/v1/primus/observability/traces/{traceId}",383],["GET","/v1/primus/overview/active-triggers",384],["GET","/v1/primus/overview/memory-health",385],["GET","/v1/primus/overview/metrics-summary",386],["GET","/v1/primus/overview/stats",387],["GET","/v1/primus/overview/top-agents",388],["GET","/v1/primus/self-knowledge",389],["POST","/v1/primus/self-knowledge",1],["GET","/v1/primus/self-knowledge/{knowledgeId}",390],["POST","/v1/primus/self-knowledge/{knowledgeId}/active",350],["POST","/v1/primus/self-knowledge/{knowledgeId}/validate",391],["GET","/v1/primus/skill-synthesis",392],["GET","/v1/primus/skill-synthesis/for-tool",394],["POST","/v1/primus/skill-synthesis/run-pipeline",395],["GET","/v1/primus/skill-synthesis/{skillId}",393],["POST","/v1/primus/skill-synthesis/{skillId}/promote",3],["GET","/v1/primus/skills",396],["POST","/v1/primus/skills",1],["GET","/v1/primus/skills/built-in",396],["GET","/v1/primus/skills/by-category",396],["DELETE","/v1/primus/skills/{skillId}",1],["GET","/v1/primus/skills/{skillId}",397],["PATCH","/v1/primus/skills/{skillId}",1],["POST","/v1/primus/skills/{skillId}/disable",1],["POST","/v1/primus/skills/{skillId}/enable",1],["GET","/v1/primus/skills/{skillId}/executions",398],["GET","/v1/primus/skills/{skillId}/stats",399],["GET","/v1/primus/spend-cap",400],["PUT","/v1/primus/spend-cap",401],["GET","/v1/primus/teams",402],["POST","/v1/primus/teams",403],["POST","/v1/primus/teams/assign",406],["POST","/v1/primus/teams/delegate",407],["POST","/v1/primus/teams/members",408],["POST","/v1/primus/teams/remove-member",3],["POST","/v1/primus/teams/unassign",409],["POST","/v1/primus/teams/with-specialists",410],["DELETE","/v1/primus/teams/{teamId}",405],["GET","/v1/primus/teams/{teamId}",404],["PATCH","/v1/primus/teams/{teamId}",3],["GET","/v1/primus/tenants",411],["POST","/v1/primus/tenants",1],["GET","/v1/primus/tenants/by-external-id",412],["GET","/v1/primus/tenants/{tenantId}",412],["PATCH","/v1/primus/tenants/{tenantId}",1],["POST","/v1/primus/tenants/{tenantId}/archive",3],["POST","/v1/primus/tenants/{tenantId}/suspend",3],["GET","/v1/primus/tools",413],["POST","/v1/primus/tools",414],["GET","/v1/primus/tools/by-name",415],["POST","/v1/primus/tools/import",417],["GET","/v1/primus/tools/stats",418],["DELETE","/v1/primus/tools/{toolId}",1],["GET","/v1/primus/tools/{toolId}",415],["PATCH","/v1/primus/tools/{toolId}",1],["POST","/v1/primus/tools/{toolId}/disable",1],["POST","/v1/primus/tools/{toolId}/enable",1],["POST","/v1/primus/tools/{toolId}/test",416],["GET","/v1/primus/triggers",419],["POST","/v1/primus/triggers",420],["GET","/v1/primus/triggers/by-agent",419],["DELETE","/v1/primus/triggers/{triggerId}",1],["GET","/v1/primus/triggers/{triggerId}",421],["PATCH","/v1/primus/triggers/{triggerId}",1],["POST","/v1/primus/triggers/{triggerId}/disable",1],["POST","/v1/primus/triggers/{triggerId}/enable",1],["GET","/v1/primus/triggers/{triggerId}/executions",422],["POST","/v1/primus/triggers/{triggerId}/rotate-secret",420],["POST","/v1/primus/triggers/{triggerId}/test-fire",423],["GET","/v1/primus/usage/by-tenant",424],["GET","/v1/primus/usage/history",425],["GET","/v1/primus/usage/limits",426],["GET","/v1/primus/usage/summary",427],["GET","/v1/primus/webhooks",428],["POST","/v1/primus/webhooks",429],["DELETE","/v1/primus/webhooks/{webhookId}",171],["GET","/v1/receipts/{receiptId}",73],["POST","/v1/receipts/{receiptId}/acknowledge",3],["GET","/v1/scheduled-messages/{scheduledMessageGid}",168],["PATCH","/v1/scheduled-messages/{scheduledMessageGid}",168],["POST","/v1/scheduled-messages/{scheduledMessageGid}/cancel",168],["POST","/v1/snapshots/{snapshotGid}/seek",21],["GET","/v1/sources",169],["DELETE","/v1/sources/{sourceGid}",171],["GET","/v1/sources/{sourceGid}",170],["POST","/v1/sources/{sourceGid}/pause",13],["POST","/v1/sources/{sourceGid}/resume",13],["GET","/v1/subscriptions/{subscriptionGid}/deliveries",9],["GET","/v1/subscriptions/{subscriptionGid}/snapshots",172],["DELETE","/v1/subscriptions/{subscriptionId}",175],["GET","/v1/subscriptions/{subscriptionId}",173],["PATCH","/v1/subscriptions/{subscriptionId}",174],["POST","/v1/subscriptions/{subscriptionId}/ack",176],["POST","/v1/subscriptions/{subscriptionId}/archive",3],["GET","/v1/subscriptions/{subscriptionId}/delivery-receipts",177],["GET","/v1/subscriptions/{subscriptionId}/dlq",178],["POST","/v1/subscriptions/{subscriptionId}/dlq/reprocess",179],["GET","/v1/subscriptions/{subscriptionId}/dlq/stats",180],["GET","/v1/subscriptions/{subscriptionId}/dlq/trend",181],["POST","/v1/subscriptions/{subscriptionId}/flow-credit",182],["POST","/v1/subscriptions/{subscriptionId}/messages/batch-delete",183],["POST","/v1/subscriptions/{subscriptionId}/messages/batch-visibility",183],["POST","/v1/subscriptions/{subscriptionId}/messages/receive",184],["DELETE","/v1/subscriptions/{subscriptionId}/messages/{receiptHandle}",3],["POST","/v1/subscriptions/{subscriptionId}/messages/{receiptHandle}/visibility",3],["POST","/v1/subscriptions/{subscriptionId}/pause",3],["GET","/v1/subscriptions/{subscriptionId}/queue",185],["PATCH","/v1/subscriptions/{subscriptionId}/queue/config",3],["GET","/v1/subscriptions/{subscriptionId}/queue/messages",186],["POST","/v1/subscriptions/{subscriptionId}/queue/purge",187],["GET","/v1/subscriptions/{subscriptionId}/receipts",188],["GET","/v1/subscriptions/{subscriptionId}/receipts/stats",189],["POST","/v1/subscriptions/{subscriptionId}/resume",3],["POST","/v1/subscriptions/{subscriptionId}/rotate",190],["POST","/v1/subscriptions/{subscriptionId}/secret/reveal",191],["POST","/v1/subscriptions/{subscriptionId}/unsubscribe",192],["GET","/v1/subscriptions/{subscriptionId}/webhook-health",193],["GET","/v1/system-events/catalog",194],["POST","/v1/system-events/subscriptions",195],["DELETE","/v1/system-events/subscriptions/{subscriptionId}",196],["GET","/v1/system-events/subscriptions/{subscriptionId}/deliveries",197],["POST","/v1/system-events/subscriptions/{subscriptionId}/rotate",191],["GET","/v1/tools",413],["GET","/v1/webhook-health/degraded",198],["GET","/v1/webhooks",199],["POST","/v1/webhooks",200],["DELETE","/v1/webhooks/{webhookId}",202],["GET","/v1/webhooks/{webhookId}",201],["PATCH","/v1/webhooks/{webhookId}",201],["POST","/v1/webhooks/{webhookId}/reveal-secret",203],["POST","/v1/webhooks/{webhookId}/rotate-secret",203]]};var fc=Object.freeze({});function Ec(N){if(N!==null&&typeof N=="object"){let s=N._extra;if(s!==null&&typeof s=="object")return s}return fc}v(Ec,"extraOf");var ru;function Sc(){let N=new Map;for(let[s,e,t]of ke.ops){let r=ke.shapes[t];if(!r)continue;let o=0,n=e.split("/").map(b=>/^\{[^}]+\}$/.test(b)?(o++,"[^/]+"):b.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("/"),d=N.get(s)??[];d.push({re:new RegExp(`^${n}/?$`),params:o,shape:r}),N.set(s,d)}return N}v(Sc,"compile");function _c(N){try{return new URL(N).pathname}catch{let e=(N.split(/[?#]/)[0]??N).replace(/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,"");return e.startsWith("/")?e:`/${e}`}}v(_c,"pathOf");function kc(N,s){ru??=Sc();let e=ru.get(N.toUpperCase());if(!e)return;let t=_c(s),r;for(let o of e)o.re.test(t)&&(!r||o.params<r.params)&&(r=o);return r?.shape}v(kc,"knownShapeFor");function ou(N){if(N===null||typeof N!="object"||Array.isArray(N))return!1;let s=Object.getPrototypeOf(N);return s===Object.prototype||s===null}v(ou,"isPlainObject");function su(N,s){Object.prototype.hasOwnProperty.call(N,"_extra")||!Object.isExtensible(N)||Object.defineProperty(N,"_extra",{value:Object.freeze(s),enumerable:!1,configurable:!0,writable:!1})}v(su,"defineExtra");var tu=new WeakMap;function Tc(N){let s=tu.get(N);return s||(s=new Set(N.p),tu.set(N,s)),s}v(Tc,"knownOf");var Cc=12;function dr(N,s,e){if(e>Cc)return;if("a"in s){if(Array.isArray(N)){for(let o of N)dr(o,s.a,e+1);return}if(ou(N)){su(N,{...N});for(let o of Object.values(N))Array.isArray(o)&&dr(o,s.a,e+1)}return}if(Array.isArray(N)){for(let o of N)dr(o,s,e+1);return}if(!ou(N))return;let t=Tc(s),r={};for(let[o,n]of Object.entries(N))t.has(o)||(r[o]=n);if(su(N,r),s.c)for(let[o,n]of Object.entries(s.c))o in N&&dr(N[o],n,e+1)}v(dr,"apply");function nu(N,s,e){try{let t=kc(N,s);t&&dr(e,t,0)}catch{}return e}v(nu,"attachExtra");async function au(N){if(!(N.publisher||!N.provision))try{await N.provision()}catch(s){throw uu(s)}}v(au,"provisionOnFirstUse");async function xc(N,s){if(N.kernelDoorPublisherFor)try{return await N.kernelDoorPublisherFor(s)}catch(e){throw uu(e)}}v(xc,"kernelDoorPublisherOnFirstUse");function uu(N){let s=Te(N);if(s!==void 0)return s;if(N instanceof hr||N instanceof Oe)return N;let e=new oe(`NPP transport could not be set up: ${N instanceof Error?N.message:String(N)}`);return Object.defineProperty(e,"cause",{value:N,configurable:!0,writable:!0}),e}v(uu,"provisioningFailure");var Ac=/\/v1\/channels\/([^/?]+)\/messages(?:\?|$)/,Ic=/\/v1\/channels\/([^/?]+)\/subscribe(?:\?|$)/,Gc=new Set(["GET","POST","PUT","PATCH","DELETE"]);function iu(N){try{return JSON.parse(N)}catch{return}}v(iu,"safeJson");function J(N){return{status:N,statusText:"",headers:new Headers,url:"",redirected:!1,type:"default"}}v(J,"emptyRawResponse");function du(N){if(!N)return;let s={};for(let[e,t]of Object.entries(N))t!=null&&(typeof t=="string"||typeof t=="number"||typeof t=="boolean"?s[e]=t:s[e]=JSON.stringify(t));return Object.keys(s).length>0?s:void 0}v(du,"flattenQuery");function Mc(N){let s=N;if(typeof N=="string")try{s=JSON.parse(N)}catch{return}if(s===null||typeof s!="object"||Array.isArray(s))return;let e=s.idempotencyKey;return typeof e=="string"&&e!==""?e:void 0}v(Mc,"callerIdempotencyKey");function Hc(N){for(let[s,e]of Object.entries(Wn(N)??{}))if(s.toLowerCase()==="idempotency-key"&&e!=="")return e}v(Hc,"callerIdempotencyHeader");function Wn(N){if(!N)return;let s={};for(let[e,t]of Object.entries(N)){if(t==null||e.toLowerCase()==="authorization")continue;let r=typeof t=="function"?t():t;r!=null&&(s[e]=r)}return Object.keys(s).length>0?s:void 0}v(Wn,"resolveHeaders");function pu(N,s){return!s||N&&Object.keys(N).some(t=>t.toLowerCase()==="content-type")?N:{...N??{},"Content-Type":s}}v(pu,"withContentType");function cu(N,s){return v(async function(t){let r=t.method.toUpperCase();if(!Gc.has(r))return{ok:!1,rawResponse:J(0),error:{reason:"unknown",errorMessage:`Unsupported method ${t.method}`}};let o=r==="POST"?Ac.exec(t.url):null;if(o&&s&&s.transport==="npp"){let f=(typeof t.body=="string"?iu(t.body):t.body)??{},E=new Set(["payload","qosLevel","channelId"]);if(Hc(t.headers)===void 0&&"payload"in f&&Object.keys(f).every(x=>E.has(x)||f[x]===void 0)){let x=decodeURIComponent(o[1]),I=await xc(s,x);if(!I){if(await au(s),!s.publisher)throw new oe(s.refusal?`NPP transport selected but not provisioned: ${s.refusal}`:'NPP transport selected but not provisioned. Pass an edgeUrl (or set NPAYLOAD_EDGE_URL), use NPayload.connect(), or pass transport: "http".');I=s.publisher}let Q=f.payload,G=await I.publish(x,Q,{...f.qosLevel!==void 0?{qosLevel:f.qosLevel}:{},...typeof f.routingKey=="string"?{routingKey:f.routingKey}:{}}).catch(de=>{throw Te(de)??de});if(!G.accepted){if(G.statusCode===da.REJECTED_OTHER&&G.error!==void 0&&ua(G.error.reason))throw new De({message:`PLAN_REQUIRED: this app publishes only on a plan, so the message was not published; choose a plan at ${yt}`,code:"PLAN_REQUIRED",product:pa,upgradeUrl:yt,npp:{statusCode:G.statusCode,statusName:G.statusName,httpStatus:G.httpStatus,reason:G.error.reason,errorCode:G.error.code,errorName:G.error.name},rawResponse:J(402)});return{ok:!1,rawResponse:J(G.httpStatus),error:{reason:"status-code",statusCode:G.httpStatus,body:{code:"NPP_PUBLISH_REJECTED",message:la(G),bulkAckStatus:G.statusCode,bulkAckStatusName:G.statusName,...G.error?{error:G.error}:{},...G.upstream?{upstream:G.upstream}:{}}}}}return{ok:!0,body:bt({gid:G.gid,status:"accepted",statusCode:G.statusCode,statusName:G.statusName,sequence:G.sequence,httpStatus:G.httpStatus,transport:"npp"}),rawResponse:J(200)}}}let n=r==="POST"?Ic.exec(t.url):null;if(n&&s&&s.transport==="npp"){if(await au(s),!s.publisher)throw new oe(s.refusal?`NPP transport selected but not provisioned: ${s.refusal}`:'NPP transport selected but not provisioned (pass edgeUrl / NPAYLOAD_EDGE_URL, use NPayload.connect(), or transport: "http").');let b=decodeURIComponent(n[1]),E=(typeof t.body=="string"?iu(t.body):t.body)??{},C=E.consumerId??E.consumer_id??`consumer-${b}`;return{ok:!0,body:await s.publisher.subscribe(b,{consumerId:C,...E.mode!==void 0?{mode:E.mode}:{},...E.deliveryPreference!==void 0?{deliveryPreference:E.deliveryPreference}:{}}).catch(I=>{throw Te(I)??I}),rawResponse:J(200)}}let d=Mc(t.body);try{let b=await N.send({method:r,...d!==void 0?{idempotencyKey:d}:{},path:t.url,...du(t.queryParameters)?{query:du(t.queryParameters)}:{},...pu(Wn(t.headers),t.contentType)?{headers:pu(Wn(t.headers),t.contentType)}:{},...t.body!==void 0?{body:t.body}:{},...t.timeoutMs!==void 0?{timeoutMs:t.timeoutMs}:{},...t.maxRetries!==void 0?{maxAttempts:t.maxRetries+1}:{},...t.abortSignal!==void 0?{signal:t.abortSignal}:{}}),f=nu(r,t.url,b);return{ok:!0,body:o?bt(f):f,rawResponse:J(200)}}catch(b){if(b instanceof wr)throw On(b);if(b instanceof mt)throw wu(b);if(b instanceof ht)throw lu(b);if(b instanceof Oe){if(b.status!=null)return{ok:!1,rawResponse:J(b.status),error:{reason:"status-code",statusCode:b.status,body:{code:b.code,message:b.message}}};throw b}throw b}},"kernelFetcher")}v(cu,"createKernelFetcher");function wu(N){let s=N.status??403;return new Le({message:N.message,code:N.code,statusCode:s,...N.requestId!==void 0?{requestId:N.requestId}:{},rawResponse:J(s)})}v(wu,"toPublicSourceRefusal");function lu(N){let s=N.status??403;return new We({message:N.message,code:N.code,statusCode:s,...N.requestId!==void 0?{requestId:N.requestId}:{},...N.fingerprint!==void 0?{fingerprint:N.fingerprint}:{},rawResponse:J(s)})}v(lu,"toPublicFingerprintRefusal");function Te(N){if(N instanceof mt)return wu(N);if(N instanceof ht)return lu(N);if(N instanceof hr){let s=N.upstreamCode,e=N.status??403,t=N.details.upstreamMessage;if(s!==void 0&&oa(s)){let r=s.toLowerCase()==="source_network_not_declared";return new Le({message:t??(r?na:ta),code:s,statusCode:e,rawResponse:J(e)})}if(s!==void 0&&sa(s))return new We({message:t??aa,code:s,statusCode:e,rawResponse:J(e)})}}v(Te,"toPublicCallerRefusal");function On(N){return new De({message:N.message,code:N.code,...N.product!==void 0?{product:N.product}:{},...N.upgradeUrl!==void 0?{upgradeUrl:N.upgradeUrl}:{},...N.requestId!==void 0?{requestId:N.requestId}:{},rawResponse:J(402)})}v(On,"toPublicPlanRefusal");var qc="Pass the door and the node keys of that estate (the door option, or KERNEL_DOOR_URL, and nodeKeys), or name nothing outside npayload's production hosts to use its production estate.";function Bc(N){let s=N.env??(typeof process<"u"?process.env:{});return new Ge(Ae([["the door option",N.door],["the nodeKeys URL",typeof N.nodeKeys=="string"?N.nodeKeys:void 0],...Ie(s)]),()=>qc)}v(Bc,"loneDoorGuard");function Uc(N,s,e){let t=$e({door:N.door,...N.env!==void 0?{env:N.env}:{}});t.kind==="kernel"&&t.url!==void 0&&s.check(t.url),typeof N.nodeKeys=="string"&&s.check(N.nodeKeys);let r=v(f=>{try{return f()}catch(E){throw E instanceof oe&&e.push(E),E}},"kept"),o=ya(s,N.fetch),n={...N,fetch:v((async(f,E)=>{try{return await o(f,E)}catch(C){throw C instanceof oe&&e.push(C),C}}),"fetch")},d=N.webSocket,b=globalThis.WebSocket;return(d!==void 0||typeof b=="function")&&(n.webSocket=f=>r(()=>(s.check(f),d!==void 0?d(f):new b(f)))),n}v(Uc,"holdOptions");async function hu(N,s,e){let t=[],r=Uc(s,e,t);try{return await N(r)}catch(o){throw t[0]??o}}v(hu,"connectHeld");var mu=Symbol.for("npayload.kernelDoor.held"),pr=lr;if(pr[mu]!==!0){let N=pr.connect.bind(lr);pr.connect=s=>hu(N,s,Bc(s)),pr[mu]=!0}function yu(N,s){return hu(pr.connect,N,s)}v(yu,"connectUnderGuard");var zc="The transport dials the API its baseUrl option names alone: pass that estate's API as baseUrl (its auth host as authUrl), or name nothing outside npayload's production hosts to use its production API.",Ru=Symbol.for("npayload.transport.http"),Pu=Symbol.for("npayload.transport.http.config");function Kn(N){return typeof N=="object"&&N!==null&&N[Ru]===!0}v(Kn,"isHttpTransport");function Jn(N){return N[Pu]}v(Jn,"httpTransportConfig");var $n=class{static{v(this,"HttpTransport")}kind="http";baseUrl;config;kernelPromise;constructor(s){if(!s||typeof s.clientId!="string"||s.clientId.length===0)throw new Error("HttpTransport requires clientId");this.config=s,Object.defineProperty(this,Ru,{value:!0}),Object.defineProperty(this,Pu,{value:s}),this.baseUrl=(s.baseUrl??mr).replace(/\/+$/,"")}async kernel(){return this.kernelPromise||(this.kernelPromise=(async()=>{let s=this.config.dpopPrivateJwk??(await cr()).privateJwk,e=typeof process<"u"?process.env:{},t=new Ge(Ae([["baseUrl",this.config.baseUrl],["authUrl",this.config.authUrl],...Ie(e)]),()=>zc);return yr({clientId:this.config.clientId,dpopPrivateJwk:s,baseUrl:this.baseUrl,authUrl:this.config.authUrl??this.baseUrl,...this.config.appId!==void 0?{appId:this.config.appId}:{},...this.config.hmacSecret!==void 0?{clientSecret:this.config.hmacSecret}:{},...this.config.environment!==void 0?{environment:this.config.environment}:{}},t)})()),this.kernelPromise}async send(s){return(await this.kernel()).send(s)}};var Ce={create(N,s){return{url:`${N}/v1/sources`,method:"POST",contentType:"application/json",body:{channel:s.channel,wsUrl:s.wsUrl,...s.subscribe!==void 0?{subscribe:s.subscribe}:{},...s.map!==void 0?{map:s.map}:{},...s.key!==void 0?{key:s.key}:{},...s.name!==void 0?{name:s.name}:{}}}},list(N){return{url:`${N}/v1/sources`,method:"GET"}},get(N,s){return{url:`${N}/v1/sources/${encodeURIComponent(s)}`,method:"GET"}},pause(N,s){return{url:`${N}/v1/sources/${encodeURIComponent(s)}/pause`,method:"POST"}},resume(N,s){return{url:`${N}/v1/sources/${encodeURIComponent(s)}/resume`,method:"POST"}},remove(N,s){return{url:`${N}/v1/sources/${encodeURIComponent(s)}`,method:"DELETE"}}},ur=class{static{v(this,"SourcesResource")}fetcher;baseUrl;constructor(s,e){this.fetcher=s,this.baseUrl=e}async create(s){let e=Ce.create(this.baseUrl,s);return(await this.fetcher(e)).body}async list(){return(await this.fetcher(Ce.list(this.baseUrl))).body}async get(s){return(await this.fetcher(Ce.get(this.baseUrl,s))).body}async pause(s){return(await this.fetcher(Ce.pause(this.baseUrl,s))).body}async resume(s){return(await this.fetcher(Ce.resume(this.baseUrl,s))).body}async remove(s){return(await this.fetcher(Ce.remove(this.baseUrl,s))).body}};var Fc={debug:v((N,s)=>s?console.debug(`[npayload] ${N}`,s):console.debug(`[npayload] ${N}`),"debug"),info:v((N,s)=>s?console.info(`[npayload] ${N}`,s):console.info(`[npayload] ${N}`),"info"),warn:v((N,s)=>s?console.warn(`[npayload] ${N}`,s):console.warn(`[npayload] ${N}`),"warn"),error:v((N,s)=>s?console.error(`[npayload] ${N}`,s):console.error(`[npayload] ${N}`),"error")},jc={debug:v(()=>{},"debug"),info:v(()=>{},"info"),warn:v(()=>{},"warn"),error:v(()=>{},"error")},Dc=["token","secret","hmacsecret","privatekey","password","authorization","cookie"];function ct(N,s=0){if(s>5)return N;let e={};for(let[t,r]of Object.entries(N))Dc.some(o=>t.toLowerCase().includes(o))?e[t]="[REDACTED]":r&&typeof r=="object"&&!Array.isArray(r)?e[t]=ct(r,s+1):e[t]=r;return e}v(ct,"redactSensitive");var gu=new WeakMap,Lc=["list","add","rotateSecret","revoke"],bu={grants:"connectAccess",bridges:"connectBridges",explore:"connectExplore",profile:"connectProfile",partner:"connectPartner",approvals:"connectTenantApproval"},Qn={request:["connect","requestAccess"],approve:["connect","approveAccess"],reject:["connect","rejectAccess"],revoke:["connect","revokeGrant"],list:["connectAccess","listMyGrants"],retrieve:["connectAccess","getGrant"]},Wc=new Set(["constructor","toJSON","toString"]);function Vn(N,s,e,t){if(t>3)return;let r=Object.getPrototypeOf(N);if(!(!r||r===Object.prototype))for(let o of Object.getOwnPropertyNames(r)){if(Wc.has(o)||o.startsWith("_"))continue;let n=Object.getOwnPropertyDescriptor(r,o);if(n)if(typeof n.get=="function"){let d;try{d=N[o]}catch{continue}d!==null&&typeof d=="object"&&Vn(d,`${s}${o}.`,e,t+1)}else typeof n.value=="function"&&t>0&&e.add(`${s}${o}`)}}v(Vn,"collectMethods");var Oc=new Set(["d","p","q","dp","dq","qi","oth","k"]);function $c(N){let s=N.publicJwk,e=s!==null&&typeof s=="object"?{...s}:{...N},t={};for(let[r,o]of Object.entries(e))t[r]=Oc.has(r)?"[REDACTED]":o;return t.d="[REDACTED]",t}v($c,"redactPrivateJwk");var Yn=class N{static{v(this,"NPayload")}generated;kernel;nppHolder;clientId;configSnapshot;appId;baseUrl;primusApiUrl;kernelFetcher;aiFacade;sourcesResource;nppProvisionPromise;channelAnswers=new Map;firstKernelAnswers=new Map;kernelDoorPublisherPromise;constructor(s){this.configSnapshot=s;let e=typeof process<"u"?process.env:{},t=Jc(s.transport,e),r=ew(t),o=r.publisher!==void 0?ha(r.publisher):void 0,n=r.http!==void 0?Jn(r.http):void 0,d=n??s;this.clientId=d.clientId,this.appId=d.appId,this.baseUrl=r.http!==void 0?r.http.baseUrl:s.baseUrl??mr;let b=r.http!==void 0?n?.authUrl??this.baseUrl:s.authUrl??this.baseUrl;vu.set(this,b),this.primusApiUrl=s.primusApiUrl??(typeof process<"u"?process.env?.NPAYLOAD_PRIMUS_API_URL:void 0);let f=Pt(this.baseUrl)!==void 0||Pt(wa(b)??this.baseUrl)!==void 0,E=r.http!==void 0?Qc:Xc,C=new Ge(Ae([["baseUrl",s.baseUrl],["authUrl",s.authUrl],["edgeUrl",s.edgeUrl],["primusApiUrl",s.primusApiUrl],["door",s.door],["the transport's edgeUrl",o],["the transport's baseUrl",n?.baseUrl],["the transport's authUrl",n?.authUrl],...Ie(e)]),xe=>xe!=="edge"?E:`${f?`${E} `:""}${o!==void 0?Yc:Vc}`),x=n?.dpopPrivateJwk??s.dpopPrivateJwk,I=d.hmacSecret,Q=d.environment;this.kernel=yr({clientId:this.clientId,dpopPrivateJwk:x,baseUrl:"",authUrl:b,...this.appId!==void 0?{appId:this.appId}:{},...I!==void 0?{clientSecret:I}:{},...Q!==void 0?{environment:Q}:{}},C);let G=r.kind==="npp"&&typeof t=="string",de=fa({edge:o??s.edgeUrl??e.NPAYLOAD_EDGE_URL,npp:G,guard:C,...G?{provisioning:[Pa(this.kernel),Zc(this.baseUrl)]}:{}});if(this.nppHolder={transport:r.kind,...de.edgeUrl!==void 0?{edgeUrl:de.edgeUrl,edgeNamed:de.named}:{},...de.refusal!==void 0?{refusal:de.refusal}:{},...r.publisher&&de.refusal===void 0?{publisher:r.publisher}:{}},this.nppHolder.publisher&&ga(r.publisher,C),this.nppHolder.transport==="npp"&&this.nppHolder.edgeUrl&&!this.nppHolder.publisher){let xe=this.nppHolder.edgeUrl;this.nppHolder.provision=()=>(this.nppProvisionPromise||(this.nppProvisionPromise=this.provisionNpp(xe).catch(pe=>{throw this.nppProvisionPromise=void 0,pe})),this.nppProvisionPromise),this.nppHolder.kernelDoorPublisherFor=pe=>this.kernelDoorPublisherFor(xe,pe)}let lt=cu(this.kernel,this.nppHolder);this.kernelFetcher=lt,this.generated=new je({baseUrl:this.baseUrl,token:v(()=>"dpop-kernel-owned","token"),fetcher:lt});let ku=v(async xe=>{let pe=await lt(xe);if(!pe.ok)throw Object.assign(new Error("np.sources request failed"),{error:pe.error,status:pe.rawResponse?.status});return{ok:!0,body:pe.body,rawResponse:{status:pe.rawResponse?.status??200}}},"sourceFetcher");this.sourcesResource=new ur(ku,this.baseUrl)}channelGidCache=new Map;eventsFacade;async resolveChannelGid(s){if(/^chn?_/.test(s)||/^ch_/.test(s))return s;let e=this.channelGidCache.get(s);if(e)return e;let t=await this.generated.events.channels.getBySlug({slug:s});return this.channelGidCache.set(s,t.gid),t.gid}get events(){if(this.eventsFacade)return this.eventsFacade;let s=this.generated.events,e=v((t,r,o)=>this.resolveChannelGid(t).then(n=>s.messages.publish({...o,channelGid:n,payload:r})),"publish");return this.eventsFacade=new Proxy(s,{get:v((t,r,o)=>r==="publish"?e:r==="webhooks"?this.eventsWebhooks():Reflect.get(t,r,o),"get")}),this.eventsFacade}eventsWebhooksSurface;eventsWebhooks(){if(this.eventsWebhooksSurface)return this.eventsWebhooksSurface;let s=this.generated.webhooks.webhooks;return this.eventsWebhooksSurface=Object.freeze({register:s.create.bind(s),list:s.list.bind(s),retrieve:s.get.bind(s),update:s.update.bind(s),delete:s.revoke.bind(s),rotateSecret:s.rotateSecret.bind(s),revealSecret:s.revealSecret.bind(s)}),this.eventsWebhooksSurface}methodCatalog;listMethods(){if(this.methodCatalog)return this.methodCatalog;let s=new Set;Vn(this.generated,"",s,0),Vn(this.sourcesResource,"sources.",s,0),s.add("events.publish");for(let t of Object.keys(this.eventsWebhooks()))s.add(`events.webhooks.${t}`);for(let t of Lc)s.add(`webhooks.${t}`);for(let[t,r]of Object.entries(bu)){let o=`connect.${r}.`;for(let n of[...s])n.startsWith(o)&&s.add(`connect.${t}.${n.slice(o.length)}`)}for(let t of Object.keys(Qn))s.add(`connect.grants.${t}`);let e=Object.freeze([...s].sort());for(let t of e)this.kernel.registerMethod(t);return this.methodCatalog=e,e}async health(){let s=Date.now(),e=new Date(s).toISOString();try{return await this.kernel.send({method:"GET",path:`${this.baseUrl}/health`,maxAttempts:1,timeoutMs:5e3}),{ok:!0,baseUrl:this.baseUrl,latencyMs:Date.now()-s,checkedAt:e}}catch(t){let r=t.status,o=t?.code;return{ok:!1,baseUrl:this.baseUrl,latencyMs:Date.now()-s,checkedAt:e,...typeof r=="number"?{status:r}:{},error:t instanceof Error?`${t.name}: ${t.message}`:String(t),...typeof o=="string"&&o!==""?{code:o}:{},...t instanceof Error?{type:t.name}:{}}}}version(){return{sdkVersion:Nt,specVersion:ke.specVersions.cell??"",specVersions:{...ke.specVersions},supportedApiVersions:[...ke.apiVersions]}}get door(){return $e({door:this.configSnapshot.door,edgeUrl:this.nppHolder.edgeUrl})}async connectKernelDoor(s){let e=this.door,t={...s,door:e.kind==="kernel"?e.url:void 0,env:{}},r=Ra(this.kernel),o=typeof s.nodeKeys=="string"?s.nodeKeys:void 0;return yu(t,r.with([["the nodeKeys URL",o]]))}config(){let{dpopPrivateJwk:s,transport:e,...t}=this.configSnapshot,r={...t};return delete r.edgeUrl,Object.freeze({...ct(r),baseUrl:this.baseUrl,authUrl:vu.get(this)??this.baseUrl,...this.nppHolder.edgeUrl!==void 0?{edgeUrl:this.nppHolder.edgeUrl}:{},transport:typeof e=="string"?e:this.nppHolder.transport,dpopPrivateJwk:$c(s)})}connectFacade;get connect(){if(this.connectFacade)return this.connectFacade;let s=this.generated.connect,e=bu,t,r=v(n=>typeof n=="string"&&Object.prototype.hasOwnProperty.call(Qn,n),"isGrantVerb"),o=v(()=>t??=new Proxy(s.connectAccess,{get:v((n,d,b)=>{if(!r(d))return Reflect.get(n,d,b);let[f,E]=Qn[d],C=s[f];return C[E].bind(C)},"get"),has:v((n,d)=>r(d)||Reflect.has(n,d),"has")}),"grantsFacade");return this.connectFacade=new Proxy(s,{get:v((n,d,b)=>d==="grants"||d==="connectAccess"?o():typeof d=="string"&&d in e?Reflect.get(n,e[d],b):Reflect.get(n,d,b),"get")}),this.connectFacade}get pipes(){return this.generated.pipes}get primus(){if(!this.aiFacade)if(this.primusApiUrl&&this.primusApiUrl!==this.baseUrl){let s=new je({baseUrl:this.primusApiUrl,token:v(()=>"dpop-kernel-owned","token"),fetcher:this.kernelFetcher});this.aiFacade=s.primus}else this.aiFacade=this.generated.primus;return this.aiFacade}get feed(){return this.generated.feed}get analytics(){return this.generated.analytics}get billing(){return this.generated.billing}get notify(){return this.generated.notify}get account(){return this.generated.account}get embed(){return this.generated.embed}get tenants(){return this.generated.tenants}get webhooks(){let s=gu.get(this);if(s)return s;let e=this.generated.webhooks,t={listChannelWebhooks:v(()=>e.webhooks.list({}),"listChannelWebhooks"),listAgentWebhookTriggers:v(()=>this.primus.triggers.list({type:"webhook"}),"listAgentWebhookTriggers"),channel:v(d=>this.generated.events.channels.get({channelGid:d}),"channel"),listAgents:v(()=>this.primus.agents.list(),"listAgents"),createChannelWebhook:v(d=>e.webhooks.create(d),"createChannelWebhook"),createAgentWebhookTrigger:v(d=>this.primus.triggers.create(d),"createAgentWebhookTrigger"),rotateChannelWebhookSecret:v(d=>e.webhooks.rotateSecret({webhookGid:d}),"rotateChannelWebhookSecret"),revokeChannelWebhook:v(d=>e.webhooks.revoke({webhookGid:d}),"revokeChannelWebhook"),removeAgentTrigger:v(d=>this.primus.triggers.remove({triggerGid:d}),"removeAgentTrigger")},r={list:v(()=>Sa(t),"list"),add:v(d=>_a(t,d),"add"),rotateSecret:v(d=>ka(t,d),"rotateSecret"),revoke:v(d=>Ta(t,d),"revoke")},o=v(d=>typeof d=="string"&&Object.prototype.hasOwnProperty.call(r,d),"isVerb"),n=new Proxy(e,{get:v((d,b,f)=>o(b)?r[b]:Reflect.get(d,b,f),"get"),has:v((d,b)=>o(b)||Reflect.has(d,b),"has")});return gu.set(this,n),n}get audit(){return this.generated.audit}get sources(){return this.sourcesResource}get transport(){return this.nppHolder.transport}async identity(){let s=(await this.mintToken()).token,e=ca(s);return{clientId:this.clientId,orgId:re(e["npayload/orgId"])??re(e.orgId)??re(e.org)??re(e.org_id)??re(e.sub),appId:this.appId??re(e["npayload/appId"])??re(e.appId)??re(e.app)??re(e.app_id)}}fingerprint(){return this.kernel.auth.fingerprint()}async enroll(){let s=await this.kernel.auth.fingerprint();this.kernel.auth.invalidate();let e=await this.mintToken(),t=e.scopes.length>0?Nu.filter(r=>ia(e.scopes,r.scope)):Nu;for(let r of t)try{return await this.kernel.send({method:"GET",path:`${this.baseUrl}${r.path}`,query:{limit:1}}),{fingerprint:s,read:!0}}catch(o){let n=Te(o);if(n!==void 0)throw n;if(o instanceof ea||o instanceof ra)continue;throw Kc(o)}return{fingerprint:s,read:!1}}async mintToken(){try{return await this.kernel.auth.getAccessToken([])}catch(s){throw Te(s)??s}}static async connect(s){let e=typeof process<"u"?process.env:{},t=Kn(s.transport)?Jn(s.transport)?.dpopPrivateJwk:void 0,r=s.dpopPrivateJwk??t??Ea(e)??(await cr()).privateJwk,o=s.appId??e.NPAYLOAD_APP_ID,n=s.hmacSecret??e.NPAYLOAD_HMAC_SECRET,d=new N({...s,dpopPrivateJwk:r,...o!==void 0?{appId:o}:{},...n!==void 0?{hmacSecret:n}:{}}),{transport:b,edgeUrl:f,edgeNamed:E}=d.nppHolder;if((s.transport===void 0||typeof s.transport=="string")&&b==="npp"&&E===!0&&f!==void 0)try{await d.provisionNpp(f)}catch(x){throw Te(x)??x}return d}async provisionNpp(s){this.nppHolder.publisher=await ba(this.kernel,{baseUrl:this.baseUrl,edgeUrl:s,clientId:this.clientId,appId:this.appId,kernelHasNoBaseUrl:!0})}async kernelDoorPublisherFor(s,e){let t;if(this.channelAnswers.has(e))t=this.channelAnswers.get(e);else{try{t=await this.readChannelAnswer(e)}catch{return}this.channelAnswers.set(e,t),Rt(t)&&this.firstKernelAnswers.set(e,t)}if(Rt(t)){if(!this.kernel.config.clientSecret)throw new gt("KERNEL_CONFIG",`channel ${e} is published through the kernel frame door at ${s}, whose access token is minted with the app's client secret, and this client holds none: pass hmacSecret (or set NPAYLOAD_HMAC_SECRET). Nothing was sent.`);return this.kernelDoorPublisherPromise||(this.kernelDoorPublisherPromise=Na(this.kernel,{baseUrl:this.baseUrl,frameDoorUrl:s,clientId:this.clientId,appId:this.appId,kernelHasNoBaseUrl:!0,readChannel:v(r=>{if(this.firstKernelAnswers.has(r)){let o=this.firstKernelAnswers.get(r);return this.firstKernelAnswers.delete(r),Promise.resolve(o)}return this.readChannelAnswer(r)},"readChannel"),producerEpoch:v(r=>Promise.resolve(va(r)),"producerEpoch")}).catch(r=>{throw this.kernelDoorPublisherPromise=void 0,r})),this.kernelDoorPublisherPromise}}readChannelAnswer(s){return this.kernel.send({method:"GET",path:`${this.baseUrl.replace(/\/+$/,"")}/v1/channels/{channelId}`,pathParams:{channelId:s}})}},Nu=[{scope:"channels:read",path:"/v1/apps/channels/paginated"},{scope:"messages:read",path:"/v1/apps/messages"},{scope:"keys:write",path:"/v1/apps/dpop-keys"}];function Kc(N){return N instanceof wr?On(N):N instanceof Oe&&N.status!==void 0?new a({message:N.message,statusCode:N.status,body:{code:N.code,message:N.message}}):N}v(Kc,"toPublicHttpError");function Jc(N,s){return N??(s.NPAYLOAD_TRANSPORT==="http"?"http":"npp")}v(Jc,"resolveTransportOption");var vu=new WeakMap,Qc="The client dials the API its HttpTransport names: build the transport with that estate's API as baseUrl (its auth host as authUrl), or name nothing outside npayload's production hosts to use its production API.",Vc='Pass the edge of that estate as edgeUrl (or set NPAYLOAD_EDGE_URL), or pass transport: "http".',Yc='Build the transport with the edge of that estate, or pass transport: "http".',Xc="The client dials the API its baseUrl option names alone: pass that estate's API as baseUrl (its auth host as authUrl, and its edge as edgeUrl), or name nothing outside npayload's production hosts to use its production API.";function Zc(N){return`${N.replace(/\/+$/,"")}/v1/apps/dpop-keys`}v(Zc,"keyRegistrationUrl");function ew(N){if(N===void 0)return{kind:"npp"};if(typeof N=="string")return{kind:N};if(Kn(N))return{kind:"http",http:N};if(ma(N))return{kind:"npp",publisher:N};throw new oe(`The client sends through an NppTransport or an HttpTransport of this package (built from either of its module formats); a transport of kind ${JSON.stringify(N.kind)} that is neither is refused, so no request goes elsewhere than it names. Pass that transport's kind as a string, or build an HttpTransport with this package.`)}v(ew,"selectTransport");var D=class extends Ca{static{v(this,"WebhookVerificationError")}verificationCode;constructor(s,e){super(s,{type:"webhook_error",code:e,status:400}),this.name="WebhookVerificationError",this.verificationCode=e,Object.setPrototypeOf(this,new.target.prototype)}},rw=300,Su=/^[0-9a-fA-F]{64}$/,L={signature:"X-NPayload-Signature",timestamp:"X-NPayload-Timestamp",signaturePrevious:"X-NPayload-Signature-Previous",messageId:"X-NPayload-Message-Id",deliveryId:"X-NPayload-Delivery-Id",channelGid:"X-NPayload-Channel-Gid",publishedAt:"X-NPayload-Published-At",metadata:"X-NPayload-Metadata"},Xn=class{static{v(this,"WebhookHandler")}async constructEvent(s,e,t,r){let o=fu(e,r),{timestamp:n}=await this._verifyOrThrow(s,o,t,r),d=typeof s=="string"?s:Eu(s),b;try{b=JSON.parse(d)}catch{throw new D("Webhook body is not valid JSON","INVALID_PAYLOAD")}let{headers:f}=o,E={id:f?Pe(f,L.messageId)??"":"",type:"",data:b,timestamp:n,signature:o.signature};if(f){let C=Pe(f,L.deliveryId);C!==void 0&&(E.deliveryId=C);let x=Pe(f,L.channelGid);x!==void 0&&(E.channelGid=x);let I=Pe(f,L.publishedAt);if(I!==void 0){let G=Number(I);Number.isFinite(G)&&(E.publishedAt=G)}let Q=Pe(f,L.metadata);if(Q!==void 0){let G=iw(Q);G!==void 0&&(E.metadata=G)}}return E}async verify(s,e,t,r){try{return await this._verifyOrThrow(s,fu(e,r),t,r),!0}catch{return!1}}async _verifyOrThrow(s,e,t,r){if(!e.signature)throw new D("Missing webhook signature","MISSING_SIGNATURE");if(!t)throw new D("Missing webhook secret","MISSING_SECRET");let{timestamp:o,hashes:n}=ow(e),d=r?.tolerance??rw,b=Math.floor(Date.now()/1e3),f=Math.abs(b-o);if(f>d)throw new D(`Webhook timestamp is too old or too far in the future (age: ${f}s, tolerance: ${d}s)`,"TIMESTAMP_EXPIRED");let E=typeof s=="string"?s:Eu(s),C=`${o}.${E}`,x=[t];r?.previousSecret&&x.push(r.previousSecret);for(let I of x){let Q=await dw(I,C);for(let G of n)if(await pw(G,Q))return{timestamp:o}}throw new D("Webhook signature verification failed","INVALID_SIGNATURE")}};function fu(N,s){if(typeof N=="string")return{signature:N,timestampHeader:s?.timestamp===void 0?void 0:String(s.timestamp),previousSignature:s?.previousSignature};if(typeof N!="object"||N===null)return{signature:""};let e=aw(N);return{headers:e,signature:Pe(e,L.signature)??"",timestampHeader:Pe(e,L.timestamp),previousSignature:Pe(e,L.signaturePrevious)}}v(fu,"resolveSignatureInput");function ow(N){let s=[],e;if(N.signature.includes("=")){let t=_u(N.signature);e=t.timestamp,s.push(t.hash.toLowerCase())}else{if(!Su.test(N.signature))throw new D(`Invalid signature: ${L.signature} is neither a hex HMAC-SHA256 nor a t=<ts>,v1=<hex> value`,"MALFORMED_SIGNATURE");if(N.timestampHeader===void 0)throw new D(`Invalid signature: a hex ${L.signature} needs its ${L.timestamp} \u2014 hand constructEvent the delivery headers, or pass the header value as options.timestamp`,"MALFORMED_SIGNATURE");e=sw(N.timestampHeader),s.push(N.signature.toLowerCase())}if(N.previousSignature){let t=tw(N.previousSignature);t!==void 0&&s.push(t)}return{timestamp:e,hashes:s}}v(ow,"parseSignatureInput");function sw(N){let s=N.trim(),e=/^\d+$/.test(s)?Number(s):NaN;if(!Number.isFinite(e)||e<=0)throw new D(`Invalid signature: ${L.timestamp} is not a unix-seconds value`,"MALFORMED_SIGNATURE");return e}v(sw,"parseTimestampHeader");function tw(N){if(N.includes("="))try{return _u(N).hash.toLowerCase()}catch{return}return Su.test(N)?N.toLowerCase():void 0}v(tw,"extractHash");function _u(N){let s=N.split(","),e,t;for(let r of s){let[o,...n]=r.trim().split("="),d=n.join("=");o==="t"?e=parseInt(d,10):o==="v1"&&(t=d)}if(e===void 0||isNaN(e))throw new D("Invalid signature header: missing or invalid timestamp","MALFORMED_SIGNATURE");if(!t)throw new D("Invalid signature header: missing v1 hash","MALFORMED_SIGNATURE");return{timestamp:e,hash:t}}v(_u,"parseSignatureHeader");function nw(N){return typeof N=="object"&&N!==null&&typeof N.get=="function"}v(nw,"isHeadersLike");function aw(N){let s=N.headers;return typeof s=="object"&&s!==null?s:N}v(aw,"resolveHeaderSource");function Pe(N,s){if(nw(N)){let t=N.get(s);return typeof t=="string"?t:void 0}let e=s.toLowerCase();for(let[t,r]of Object.entries(N))if(t.toLowerCase()===e)return typeof r=="string"?r:Array.isArray(r)&&typeof r[0]=="string"?r[0]:void 0}v(Pe,"readHeader");function iw(N){try{let s=JSON.parse(N);if(typeof s=="object"&&s!==null&&!Array.isArray(s))return s}catch{}}v(iw,"parseMetadataHeader");async function dw(N,s){let e=new TextEncoder,t=await crypto.subtle.importKey("raw",e.encode(N),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),r=await crypto.subtle.sign("HMAC",t,e.encode(s));return uw(r)}v(dw,"computeHmacSha256");async function pw(N,s){let e=new TextEncoder,t=new Uint8Array(await crypto.subtle.digest("SHA-256",e.encode(N))),r=new Uint8Array(await crypto.subtle.digest("SHA-256",e.encode(s)));if(t.length!==r.length)return!1;let o=0;for(let n=0;n<t.length;n++)o|=t[n]^r[n];return o===0}v(pw,"timingSafeEqual");function uw(N){return Array.from(new Uint8Array(N)).map(s=>s.toString(16).padStart(2,"0")).join("")}v(uw,"arrayBufferToHex");function Eu(N){return typeof N.toString=="function"?N.toString("utf-8"):new TextDecoder().decode(N)}v(Eu,"bufferToString");var wt=class{constructor(s,e){this.listFn=s;this.args=e}static{v(this,"AutoPaginator")}async*[Symbol.asyncIterator](){let s,e=!0;for(;e;){let t=await this.listFn({...this.args,cursor:s});for(let r of t.data)yield r;if(e=t.hasMore,s=t.cursor,e&&!s)break}}async toArray(){let s=[];for await(let e of this)s.push(e);return s}};function cw(N,s){return new wt(N,s??{})}v(cw,"autoPaginate");function ww(N,s){return s?{timeout:s.timeout??N.timeout,idempotencyKey:s.idempotencyKey,headers:{...N.headers,...s.headers},maxRetries:s.maxRetries??N.maxRetries,apiVersion:s.apiVersion??N.apiVersion}:N}v(ww,"mergeRequestOptions");var Zn=class{static{v(this,"NPayloadEventEmitter")}listeners=new Map;on(s,e){return this.listeners.has(s)||this.listeners.set(s,new Set),this.listeners.get(s).add(e),this}off(s,e){return this.listeners.get(s)?.delete(e),this}emit(s,e){this.listeners.get(s)?.forEach(t=>{try{t(e)}catch{}})}listenerCount(s){return this.listeners.get(s)?.size??0}removeAllListeners(){this.listeners.clear()}};export{wt as AutoPaginator,$u as CONNECT_CONFIG_RESOURCES,Wu as CONNECT_CONTRACT_HASH,Fu as EVENTS_CONFIG_RESOURCES,Uu as EVENTS_CONTRACT_HASH,$n as HttpTransport,Tu as KERNEL_DOOR_URL_ENV,Cu as KernelDoorError,xu as KernelDoorKey,lr as KernelDoorSession,Au as KernelSubscription,Yn as NPayload,_ as NPayloadApi,a as NPayloadError,Zn as NPayloadEventEmitter,We as NPayloadFingerprintNotEnrolledError,De as NPayloadPlanRequiredError,Le as NPayloadSourceNotAllowedError,p as NPayloadTimeoutError,gt as NppKernelDoorError,Mu as NppProtocolError,Gu as NppRefusedError,Hu as NppTransport,hr as NppTransportError,Lu as PRIMUS_CONFIG_RESOURCES,ju as PRIMUS_CONTRACT_HASH,qu as SDK_NAME,Nt as SDK_VERSION,Ce as SourceRequests,ur as SourcesResource,Iu as TransportRefusedError,oe as TransportUnavailableError,Bu as USER_AGENT,L as WEBHOOK_DELIVERY_HEADERS,Xn as WebhookHandler,D as WebhookVerificationError,cw as autoPaginate,Fc as defaultLogger,Ou as defineConnectConfig,zu as defineEventsConfig,Du as definePrimusConfig,Ec as extraOf,ww as mergeRequestOptions,ct as redactSensitive,$e as resolveDoor,jc as silentLogger};
|