palbase 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/index.js +2 -2
- package/dist/backend/engine.js +2 -2
- package/dist/backend/env.js +1 -1
- package/dist/backend/index.js +9 -9
- package/dist/backend/stack.js +1 -1
- package/dist/backend/test.js +2 -2
- package/dist/chunks/5VTGMNPL.js +20 -0
- package/dist/chunks/{ZBOJEH7K.js → BO5KR2EQ.js} +2 -2
- package/dist/chunks/{PJVWGUIT.js → BRBCWPR3.js} +1 -1
- package/dist/chunks/DB3SIBKB.js +2 -0
- package/dist/chunks/EGNEXFTZ.js +2 -0
- package/dist/chunks/{HEXIIGWS.js → FZ3MQOVA.js} +2 -2
- package/dist/chunks/{SU7BP6VF.js → JSJVV43D.js} +1 -1
- package/dist/chunks/K6RRNI23.js +4 -0
- package/dist/chunks/{KDSWK3XW.js → KDWDPSL2.js} +1 -1
- package/dist/chunks/P4Z5E6ZI.js +2 -0
- package/dist/chunks/PDOHT46N.js +2 -0
- package/dist/chunks/PGPQGKH2.js +18 -0
- package/dist/chunks/{G3BK7L3J.js → RBA6V3UO.js} +2 -2
- package/dist/chunks/{X3MTLJRV.js → RO5Y5YU4.js} +1 -1
- package/dist/chunks/{BKVU4I5R.js → TUGRIOFX.js} +2 -2
- package/dist/chunks/WEI32SAJ.js +13 -0
- package/dist/chunks/{5ZJCEQV5.js → WINBISC2.js} +3 -3
- package/dist/chunks/Z5JVQNAZ.js +2 -0
- package/dist/cli.js +121 -120
- package/dist/refuse/ai.js +1 -1
- package/dist/refuse/backend.js +1 -1
- package/dist/refuse/server.js +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/testing.js +2 -2
- package/dist/web/index.js +2 -2
- package/dist/web/palbe.js +2 -2
- package/dist/web/paywall.js +2 -2
- package/dist/web/ssr.js +2 -2
- package/dist/web/vite.js +2 -2
- package/package.json +2 -2
- package/types/ai/src/ai.d.ts +44 -15
- package/types/ai/src/chats.d.ts +442 -12
- package/types/ai/src/index.d.ts +4 -4
- package/types/ai/src/tools.d.ts +158 -21
- package/types/backend/src/bootstrap.d.ts +8 -0
- package/types/backend/src/container.d.ts +9 -0
- package/types/backend/src/database.d.ts +17 -2
- package/types/backend/src/engine.d.ts +2 -0
- package/types/backend/src/gateways.d.ts +19 -0
- package/types/backend/src/index.d.ts +1 -0
- package/types/backend/src/runtime.d.ts +12 -0
- package/types/backend/src/testing/unit.d.ts +3 -1
- package/types/internal/src/chat.d.ts +168 -3
- package/types/internal/src/modules/ai.d.ts +1305 -57
- package/types/internal/src/modules/auth.d.ts +14 -2
- package/types/internal/src/modules/events.d.ts +2 -2
- package/types/internal/src/modules/machines.d.ts +57 -1
- package/types/internal/src/modules/notify.d.ts +6 -6
- package/types/internal/src/modules/purchases.d.ts +357 -13
- package/types/internal/src/modules/realtime.d.ts +36 -0
- package/types/internal/src/modules/stores.d.ts +259 -22
- package/types/internal/src/transport.d.ts +5 -0
- package/types/server/src/auth/jwt.d.ts +1 -6
- package/types/web/src/auth.d.ts +15 -4
- package/types/web/src/backends.d.ts +1 -1
- package/types/web/src/chat.d.ts +215 -4
- package/types/web/src/client.d.ts +28 -0
- package/types/web/src/gateways.d.ts +4 -3
- package/types/web/src/index.d.ts +3 -2
- package/types/web/src/session.d.ts +11 -1
- package/types/web/src/voice.d.ts +36 -0
- package/dist/chunks/3ALGILOX.js +0 -2
- package/dist/chunks/AIIKXCWN.js +0 -2
- package/dist/chunks/ELEE7XO2.js +0 -18
- package/dist/chunks/G7E26S3Y.js +0 -13
- package/dist/chunks/H2EPK74V.js +0 -20
- package/dist/chunks/JS3TTUHS.js +0 -2
- package/dist/chunks/L3NTI4AZ.js +0 -2
- package/dist/chunks/LEBVOSG6.js +0 -4
- package/dist/chunks/OIA7KLRW.js +0 -2
package/dist/chunks/AIIKXCWN.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! palbase 0.7.0 — Palbase SDK License (see LICENSE) */
|
|
2
|
-
import{c as s}from"./JS3TTUHS.js";import{a as n}from"./SU7BP6VF.js";var x=["ai.response.completed","ai.response.failed","file.deleted","file.moved","file.uploaded","purchases.catalog.applied","purchases.catalog.changed","purchases.credits.depleted","purchases.credits.low","purchases.customer.changed","purchases.customer.erased","purchases.customer.merged","purchases.entitlement.changed","purchases.ownership.transferred","purchases.paywall.published","purchases.purchase.completed","purchases.quota.exhausted","purchases.quota.threshold","purchases.refund.changed","purchases.store.changed","purchases.subscription.changed","stores.action.changed","stores.app.changed","stores.apple.changed","stores.delivery.changed","stores.delivery.requested","stores.group.changed","stores.package.changed"];var a={};n(a,{client:()=>h});function h(t){return{async listAgents(e){return t.send({op:"ListAgents",method:"GET",path:"/ai/agents",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async putAgent(e){return t.send({op:"PutAgent",method:"PUT",path:"/ai/agents/"+s("PutAgent","name",e.path.name),auth:[["SecretKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async deleteAgent(e){return t.send({op:"DeleteAgent",method:"DELETE",path:"/ai/agents/"+s("DeleteAgent","name",e.path.name),auth:[["SecretKeyAuth"]],answers:{204:"empty"},signal:e.signal})},async listChats(e){return t.send({op:"ListChats",method:"GET",path:"/ai/chats",auth:[["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async createChat(e){return t.send({op:"CreateChat",method:"POST",path:"/ai/chats",auth:[["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{201:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getChat(e){return t.send({op:"GetChat",method:"GET",path:"/ai/chats/"+s("GetChat","chat_id",e.path.chat_id),auth:[["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async deleteChat(e){return t.send({op:"DeleteChat",method:"DELETE",path:"/ai/chats/"+s("DeleteChat","chat_id",e.path.chat_id),auth:[["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{204:"empty"},signal:e.signal})},async decideChatApproval(e){return t.send({op:"DecideChatApproval",method:"POST",path:"/ai/chats/"+s("DecideChatApproval","chat_id",e.path.chat_id)+"/approvals/"+s("DecideChatApproval","approval_id",e.path.approval_id),auth:[["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async putChatMember(e){return t.send({op:"PutChatMember",method:"PUT",path:"/ai/chats/"+s("PutChatMember","chat_id",e.path.chat_id)+"/members/"+s("PutChatMember","user_id",e.path.user_id),auth:[["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async deleteChatMember(e){return t.send({op:"DeleteChatMember",method:"DELETE",path:"/ai/chats/"+s("DeleteChatMember","chat_id",e.path.chat_id)+"/members/"+s("DeleteChatMember","user_id",e.path.user_id),auth:[["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{204:"empty"},signal:e.signal})},async listChatMessages(e){return t.send({op:"ListChatMessages",method:"GET",path:"/ai/chats/"+s("ListChatMessages","chat_id",e.path.chat_id)+"/messages",auth:[["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{200:"json"},query:e.query,signal:e.signal})},async sendChatMessage(e){return t.send({op:"SendChatMessage",method:"POST",path:"/ai/chats/"+s("SendChatMessage","chat_id",e.path.chat_id)+"/messages",auth:[["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{200:"json",202:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async putChatPipe(e){return t.send({op:"PutChatPipe",method:"PUT",path:"/ai/chats/"+s("PutChatPipe","chat_id",e.path.chat_id)+"/pipe",auth:[["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async deleteChatPipe(e){return t.send({op:"DeleteChatPipe",method:"DELETE",path:"/ai/chats/"+s("DeleteChatPipe","chat_id",e.path.chat_id)+"/pipe",auth:[["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{204:"empty"},signal:e.signal})},async sendSubagentMessage(e){return t.send({op:"SendSubagentMessage",method:"POST",path:"/ai/chats/"+s("SendSubagentMessage","chat_id",e.path.chat_id)+"/runs/"+s("SendSubagentMessage","run_id",e.path.run_id)+"/messages",auth:[["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{202:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async stopChat(e){return t.send({op:"StopChat",method:"POST",path:"/ai/chats/"+s("StopChat","chat_id",e.path.chat_id)+"/stop",auth:[["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async answerChatToolCall(e){return t.send({op:"AnswerChatToolCall",method:"POST",path:"/ai/chats/"+s("AnswerChatToolCall","chat_id",e.path.chat_id)+"/tool-outputs/"+s("AnswerChatToolCall","call_id",e.path.call_id),auth:[["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async listChatTurnArtifacts(e){return t.send({op:"ListChatTurnArtifacts",method:"GET",path:"/ai/chats/"+s("ListChatTurnArtifacts","chat_id",e.path.chat_id)+"/turns/"+s("ListChatTurnArtifacts","response_id",e.path.response_id)+"/artifacts",auth:[["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async getChatTurnArtifact(e){return t.send({op:"GetChatTurnArtifact",method:"GET",path:"/ai/chats/"+s("GetChatTurnArtifact","chat_id",e.path.chat_id)+"/turns/"+s("GetChatTurnArtifact","response_id",e.path.response_id)+"/artifacts/"+s("GetChatTurnArtifact","artifact_id",e.path.artifact_id),auth:[["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{200:"raw"},signal:e.signal})},async getChatTurnCost(e){return t.send({op:"GetChatTurnCost",method:"GET",path:"/ai/chats/"+s("GetChatTurnCost","chat_id",e.path.chat_id)+"/turns/"+s("GetChatTurnCost","response_id",e.path.response_id)+"/cost",auth:[["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async startChatVoice(e){return t.send({op:"StartChatVoice",method:"POST",path:"/ai/chats/"+s("StartChatVoice","chat_id",e.path.chat_id)+"/voice",auth:[["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{201:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async closeChatVoice(e){return t.send({op:"CloseChatVoice",method:"DELETE",path:"/ai/chats/"+s("CloseChatVoice","chat_id",e.path.chat_id)+"/voice/"+s("CloseChatVoice","voice_id",e.path.voice_id),auth:[["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async commandChatVoice(e){return t.send({op:"CommandChatVoice",method:"POST",path:"/ai/chats/"+s("CommandChatVoice","chat_id",e.path.chat_id)+"/voice/"+s("CommandChatVoice","voice_id",e.path.voice_id)+"/commands",auth:[["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{202:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async createEmbeddings(e){return t.send({op:"CreateEmbeddings",method:"POST",path:"/ai/embeddings",auth:[["SecretKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async listEndpoints(e){return t.send({op:"ListEndpoints",method:"GET",path:"/ai/endpoints",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async putEndpoint(e){return t.send({op:"PutEndpoint",method:"PUT",path:"/ai/endpoints/"+s("PutEndpoint","name",e.path.name),auth:[["SecretKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async deleteEndpoint(e){return t.send({op:"DeleteEndpoint",method:"DELETE",path:"/ai/endpoints/"+s("DeleteEndpoint","name",e.path.name),auth:[["SecretKeyAuth"]],answers:{204:"empty"},signal:e.signal})},async createImage(e){return t.send({op:"CreateImage",method:"POST",path:"/ai/images",auth:[["SecretKeyAuth"]],answers:{202:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getImage(e){return t.send({op:"GetImage",method:"GET",path:"/ai/images/"+s("GetImage","image_id",e.path.image_id),auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async getImageFile(e){return t.send({op:"GetImageFile",method:"GET",path:"/ai/images/"+s("GetImageFile","image_id",e.path.image_id)+"/files/"+s("GetImageFile","position",e.path.position),auth:[["SecretKeyAuth"]],answers:{200:"raw"},signal:e.signal})},async listModels(e){return t.send({op:"ListModels",method:"GET",path:"/ai/models",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async listProviders(e){return t.send({op:"ListProviders",method:"GET",path:"/ai/providers",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async connectProvider(e){return t.send({op:"ConnectProvider",method:"PUT",path:"/ai/providers/"+s("ConnectProvider","provider",e.path.provider),auth:[["SecretKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async disconnectProvider(e){return t.send({op:"DisconnectProvider",method:"DELETE",path:"/ai/providers/"+s("DisconnectProvider","provider",e.path.provider),auth:[["SecretKeyAuth"]],answers:{204:"empty"},signal:e.signal})},async listRepos(e){return t.send({op:"ListRepos",method:"GET",path:"/ai/repos",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async putRepo(e){return t.send({op:"PutRepo",method:"PUT",path:"/ai/repos/"+s("PutRepo","name",e.path.name),auth:[["SecretKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async deleteRepo(e){return t.send({op:"DeleteRepo",method:"DELETE",path:"/ai/repos/"+s("DeleteRepo","name",e.path.name),auth:[["SecretKeyAuth"]],answers:{204:"empty"},signal:e.signal})},async createResponse(e){return t.send({op:"CreateResponse",method:"POST",path:"/ai/responses",auth:[["SecretKeyAuth"]],answers:{200:"raw",202:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getResponse(e){return t.send({op:"GetResponse",method:"GET",path:"/ai/responses/"+s("GetResponse","response_id",e.path.response_id),auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async cancelResponse(e){return t.send({op:"CancelResponse",method:"POST",path:"/ai/responses/"+s("CancelResponse","response_id",e.path.response_id)+"/cancel",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async followResponse(e){return t.send({op:"FollowResponse",method:"GET",path:"/ai/responses/"+s("FollowResponse","response_id",e.path.response_id)+"/live",auth:[["SecretKeyAuth"]],answers:{200:"raw"},query:e.query,signal:e.signal})},async getSettings(e){return t.send({op:"GetSettings",method:"GET",path:"/ai/settings",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async putSettings(e){return t.send({op:"PutSettings",method:"PUT",path:"/ai/settings",auth:[["SecretKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async listUsage(e){return t.send({op:"ListUsage",method:"GET",path:"/ai/usage",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})}}}var r={};n(r,{client:()=>b});function b(t){return{async alias(e){return t.send({op:"Alias",method:"POST",path:"/analytics/alias",auth:[["ApiKeyAuth"],["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{202:"empty"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async batch(e){return t.send({op:"Batch",method:"POST",path:"/analytics/batch",auth:[["ApiKeyAuth"],["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{202:"json",207:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getEventBreakdown(e){return t.send({op:"GetEventBreakdown",method:"GET",path:"/analytics/breakdown",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e.query,signal:e.signal})},async capture(e){return t.send({op:"Capture",method:"POST",path:"/analytics/capture",auth:[["ApiKeyAuth"],["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{202:"empty"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async sendConsoleHistory(e){return t.send({op:"SendConsoleHistory",method:"POST",path:"/analytics/console-breadcrumbs",auth:[["ApiKeyAuth"],["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{202:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getConsoleConfig(e){return t.send({op:"GetConsoleConfig",method:"GET",path:"/analytics/console-breadcrumbs/config",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async listConsoleRecords(e){return t.send({op:"ListConsoleRecords",method:"GET",path:"/analytics/console-records",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async listEventNames(e){return t.send({op:"ListEventNames",method:"GET",path:"/analytics/event-names",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async listEvents(e){return t.send({op:"ListEvents",method:"GET",path:"/analytics/events",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async getEventTimeline(e){return t.send({op:"GetEventTimeline",method:"GET",path:"/analytics/events/timeline",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async runFunnel(e){return t.send({op:"RunFunnel",method:"POST",path:"/analytics/funnel",auth:[["SecretKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async identify(e){return t.send({op:"Identify",method:"POST",path:"/analytics/identify",auth:[["ApiKeyAuth"],["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{202:"empty"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async page(e){return t.send({op:"Page",method:"POST",path:"/analytics/page",auth:[["ApiKeyAuth"],["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{202:"empty"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async sendPerf(e){return t.send({op:"SendPerf",method:"POST",path:"/analytics/perf",auth:[["ApiKeyAuth"],["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{202:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async listPerfGroups(e){return t.send({op:"ListPerfGroups",method:"GET",path:"/analytics/perf/client",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async getPerfConfig(e){return t.send({op:"GetPerfConfig",method:"GET",path:"/analytics/perf/config",auth:[["ApiKeyAuth"],["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{200:"json",304:"empty"},headers:e?.headers,signal:e?.signal})},async getPerfTimeline(e){return t.send({op:"GetPerfTimeline",method:"GET",path:"/analytics/perf/timeline",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e.query,signal:e.signal})},async listRequestLines(e){return t.send({op:"ListRequestLines",method:"GET",path:"/analytics/requests",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async getMachineTraffic(e){return t.send({op:"GetMachineTraffic",method:"GET",path:"/analytics/machines/"+s("GetMachineTraffic","name",e.path.name)+"/traffic",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e.query,signal:e.signal})},async runRetention(e){return t.send({op:"RunRetention",method:"POST",path:"/analytics/retention",auth:[["SecretKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async screen(e){return t.send({op:"Screen",method:"POST",path:"/analytics/screen",auth:[["ApiKeyAuth"],["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{202:"empty"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getSettings(e){return t.send({op:"GetSettings",method:"GET",path:"/analytics/settings",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async putSettings(e){return t.send({op:"PutSettings",method:"PUT",path:"/analytics/settings",auth:[["SecretKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getSummary(e){return t.send({op:"GetSummary",method:"GET",path:"/analytics/summary",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async listTraces(e){return t.send({op:"ListTraces",method:"GET",path:"/analytics/traces",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async sendTrace(e){return t.send({op:"SendTrace",method:"POST",path:"/analytics/traces",auth:[["ApiKeyAuth"],["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{202:"empty"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async sendTraceBatch(e){return t.send({op:"SendTraceBatch",method:"POST",path:"/analytics/traces/batch",auth:[["ApiKeyAuth"],["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{202:"json",207:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getTraceHops(e){return t.send({op:"GetTraceHops",method:"GET",path:"/analytics/traces/by-trace",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e.query,signal:e.signal})},async listSessionTraces(e){return t.send({op:"ListSessionTraces",method:"GET",path:"/analytics/traces/session",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e.query,signal:e.signal})},async getTraceSummary(e){return t.send({op:"GetTraceSummary",method:"GET",path:"/analytics/traces/summary",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async getTraceTimeline(e){return t.send({op:"GetTraceTimeline",method:"GET",path:"/analytics/traces/timeline",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})}}}var i={};n(i,{client:()=>_});function _(t){return{async getAppleAppSiteAssociation(e){return t.send({op:"GetAppleAppSiteAssociation",method:"GET",path:"/.well-known/apple-app-site-association",auth:[],answers:{200:"json"},signal:e?.signal})},async getAssetLinks(e){return t.send({op:"GetAssetLinks",method:"GET",path:"/.well-known/assetlinks.json",auth:[],answers:{200:"json"},signal:e?.signal})},async getJwks(e){return t.send({op:"GetJWKS",method:"GET",path:"/.well-known/jwks.json",auth:[],answers:{200:"json"},signal:e?.signal})},async getOidcDiscovery(e){return t.send({op:"GetOIDCDiscovery",method:"GET",path:"/.well-known/openid-configuration",auth:[],answers:{200:"json"},signal:e?.signal})},async getWebAuthnRelatedOrigins(e){return t.send({op:"GetWebAuthnRelatedOrigins",method:"GET",path:"/.well-known/webauthn",auth:[],answers:{200:"json"},signal:e?.signal})},async adminVerifyDeviceAssertion(e){return t.send({op:"AdminVerifyDeviceAssertion",method:"POST",path:"/admin/attest/devices/assert",auth:[["AdminAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async adminGetAttestPolicy(e){return t.send({op:"AdminGetAttestPolicy",method:"GET",path:"/admin/attest/devices/attest-policy",auth:[["AdminAuth"]],answers:{200:"json"},signal:e?.signal})},async adminGetAttestObservations(e){return t.send({op:"AdminGetAttestObservations",method:"GET",path:"/admin/attest/devices/observations",auth:[["AdminAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async adminRecordAttestObservations(e){return t.send({op:"AdminRecordAttestObservations",method:"POST",path:"/admin/attest/devices/observations",auth:[["AdminAuth"]],answers:{204:"empty"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async adminListAuditEvents(e){return t.send({op:"AdminListAuditEvents",method:"GET",path:"/admin/audit",auth:[["AdminAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async adminExportAuditEvents(e){return t.send({op:"AdminExportAuditEvents",method:"GET",path:"/admin/audit/export",auth:[["AdminAuth"]],answers:{200:"raw"},query:e?.query,signal:e?.signal})},async adminVerifyAuditTrail(e){return t.send({op:"AdminVerifyAuditTrail",method:"GET",path:"/admin/audit/verify",auth:[["AdminAuth"]],answers:{200:"json"},signal:e?.signal})},async adminGetAuthSettings(e){return t.send({op:"AdminGetAuthSettings",method:"GET",path:"/admin/auth-settings",auth:[["AdminAuth"]],answers:{200:"json"},signal:e?.signal})},async adminUpdateAuthSettings(e){return t.send({op:"AdminUpdateAuthSettings",method:"PUT",path:"/admin/auth-settings",auth:[["AdminAuth"]],answers:{200:"json"},headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async adminGetBreachWatch(e){return t.send({op:"AdminGetBreachWatch",method:"GET",path:"/admin/breach-watch",auth:[["AdminAuth"]],answers:{200:"json"},signal:e?.signal})},async adminListHooks(e){return t.send({op:"AdminListHooks",method:"GET",path:"/admin/hooks",auth:[["AdminAuth"]],answers:{200:"json"},signal:e?.signal})},async adminCreateHook(e){return t.send({op:"AdminCreateHook",method:"POST",path:"/admin/hooks",auth:[["AdminAuth"]],answers:{201:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async adminUpdateHook(e){return t.send({op:"AdminUpdateHook",method:"PUT",path:"/admin/hooks/"+s("AdminUpdateHook","id",e.path.id),auth:[["AdminAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async adminDeleteHook(e){return t.send({op:"AdminDeleteHook",method:"DELETE",path:"/admin/hooks/"+s("AdminDeleteHook","id",e.path.id),auth:[["AdminAuth"]],answers:{204:"empty"},signal:e.signal})},async adminListHookExecutions(e){return t.send({op:"AdminListHookExecutions",method:"GET",path:"/admin/hooks/"+s("AdminListHookExecutions","id",e.path.id)+"/executions",auth:[["AdminAuth"]],answers:{200:"json"},query:e.query,signal:e.signal})},async adminListIntegrations(e){return t.send({op:"AdminListIntegrations",method:"GET",path:"/admin/integrations",auth:[["AdminAuth"]],answers:{200:"json"},signal:e?.signal})},async adminPutIntegration(e){return t.send({op:"AdminPutIntegration",method:"PUT",path:"/admin/integrations/"+s("AdminPutIntegration","name",e.path.name),auth:[["AdminAuth"]],answers:{204:"empty"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async adminDeleteIntegration(e){return t.send({op:"AdminDeleteIntegration",method:"DELETE",path:"/admin/integrations/"+s("AdminDeleteIntegration","name",e.path.name),auth:[["AdminAuth"]],answers:{204:"empty"},signal:e.signal})},async adminListOAuthClients(e){return t.send({op:"AdminListOAuthClients",method:"GET",path:"/admin/oauth-clients",auth:[["AdminAuth"]],answers:{200:"json"},signal:e?.signal})},async adminCreateOAuthClient(e){return t.send({op:"AdminCreateOAuthClient",method:"POST",path:"/admin/oauth-clients",auth:[["AdminAuth"]],answers:{201:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async adminGetOAuthClient(e){return t.send({op:"AdminGetOAuthClient",method:"GET",path:"/admin/oauth-clients/"+s("AdminGetOAuthClient","id",e.path.id),auth:[["AdminAuth"]],answers:{200:"json"},signal:e.signal})},async adminDeleteOAuthClient(e){return t.send({op:"AdminDeleteOAuthClient",method:"DELETE",path:"/admin/oauth-clients/"+s("AdminDeleteOAuthClient","id",e.path.id),auth:[["AdminAuth"]],answers:{204:"empty"},signal:e.signal})},async adminUpdateOAuthClient(e){return t.send({op:"AdminUpdateOAuthClient",method:"PATCH",path:"/admin/oauth-clients/"+s("AdminUpdateOAuthClient","id",e.path.id),auth:[["AdminAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async adminListProviders(e){return t.send({op:"AdminListProviders",method:"GET",path:"/admin/providers",auth:[["AdminAuth"]],answers:{200:"json"},signal:e?.signal})},async adminGetPhoneSettings(e){return t.send({op:"AdminGetPhoneSettings",method:"GET",path:"/admin/providers/phone/settings",auth:[["AdminAuth"]],answers:{200:"json"},signal:e?.signal})},async adminUpdatePhoneSettings(e){return t.send({op:"AdminUpdatePhoneSettings",method:"PUT",path:"/admin/providers/phone/settings",auth:[["AdminAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async adminToggleProvider(e){return t.send({op:"AdminToggleProvider",method:"POST",path:"/admin/providers/"+s("AdminToggleProvider","name",e.path.name),auth:[["AdminAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async adminListRoles(e){return t.send({op:"AdminListRoles",method:"GET",path:"/admin/roles",auth:[["AdminAuth"]],answers:{200:"json"},signal:e?.signal})},async adminUpsertRole(e){return t.send({op:"AdminUpsertRole",method:"PUT",path:"/admin/roles/"+s("AdminUpsertRole","name",e.path.name),auth:[["AdminAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async adminDeleteRole(e){return t.send({op:"AdminDeleteRole",method:"DELETE",path:"/admin/roles/"+s("AdminDeleteRole","name",e.path.name),auth:[["AdminAuth"]],answers:{200:"json"},query:e.query,signal:e.signal})},async adminListServiceAccounts(e){return t.send({op:"AdminListServiceAccounts",method:"GET",path:"/admin/service-accounts",auth:[["AdminAuth"]],answers:{200:"json"},signal:e?.signal})},async adminCreateServiceAccount(e){return t.send({op:"AdminCreateServiceAccount",method:"POST",path:"/admin/service-accounts",auth:[["AdminAuth"]],answers:{201:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async adminGetServiceAccount(e){return t.send({op:"AdminGetServiceAccount",method:"GET",path:"/admin/service-accounts/"+s("AdminGetServiceAccount","id",e.path.id),auth:[["AdminAuth"]],answers:{200:"json"},signal:e.signal})},async adminRevokeServiceAccount(e){return t.send({op:"AdminRevokeServiceAccount",method:"DELETE",path:"/admin/service-accounts/"+s("AdminRevokeServiceAccount","id",e.path.id),auth:[["AdminAuth"]],answers:{204:"empty"},signal:e.signal})},async adminRotateServiceAccount(e){return t.send({op:"AdminRotateServiceAccount",method:"POST",path:"/admin/service-accounts/"+s("AdminRotateServiceAccount","id",e.path.id)+"/rotate",auth:[["AdminAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,signal:e.signal})},async adminListSessions(e){return t.send({op:"AdminListSessions",method:"GET",path:"/admin/sessions",auth:[["AdminAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async adminRevokeSession(e){return t.send({op:"AdminRevokeSession",method:"DELETE",path:"/admin/sessions/"+s("AdminRevokeSession","id",e.path.id),auth:[["AdminAuth"]],answers:{204:"empty"},signal:e.signal})},async adminListSigningKeys(e){return t.send({op:"AdminListSigningKeys",method:"GET",path:"/admin/signing-keys",auth:[["AdminAuth"]],answers:{200:"json"},signal:e?.signal})},async adminRotateSigningKey(e){return t.send({op:"AdminRotateSigningKey",method:"POST",path:"/admin/signing-keys/rotate",auth:[["AdminAuth"]],answers:{200:"json"},signal:e?.signal})},async socialAdminConfig(e){return t.send({op:"SocialAdminConfig",method:"GET",path:"/admin/social-auth",auth:[["AdminAuth"]],answers:{200:"json"},signal:e?.signal})},async socialCredentialPut(e){return t.send({op:"SocialCredentialPut",method:"PUT",path:"/admin/social-auth/credentials/"+s("SocialCredentialPut","key",e.path.key),auth:[["AdminAuth"]],answers:{200:"json"},headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async socialCredentialDelete(e){return t.send({op:"SocialCredentialDelete",method:"DELETE",path:"/admin/social-auth/credentials/"+s("SocialCredentialDelete","key",e.path.key),auth:[["AdminAuth"]],answers:{204:"empty"},headers:e.headers,signal:e.signal})},async socialProviderPatch(e){return t.send({op:"SocialProviderPatch",method:"PATCH",path:"/admin/social-auth/providers/"+s("SocialProviderPatch","provider",e.path.provider),auth:[["AdminAuth"]],answers:{200:"json"},headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async adminGetStats(e){return t.send({op:"AdminGetStats",method:"GET",path:"/admin/stats",auth:[["AdminAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async adminSendTestTemplate(e){return t.send({op:"AdminSendTestTemplate",method:"POST",path:"/admin/templates/"+s("AdminSendTestTemplate","key",e.path.key)+"/send-test",auth:[["AdminAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async adminListTestUsers(e){return t.send({op:"AdminListTestUsers",method:"GET",path:"/admin/test-users",auth:[["AdminAuth"]],answers:{200:"json"},signal:e?.signal})},async adminCreateTestUsers(e){return t.send({op:"AdminCreateTestUsers",method:"POST",path:"/admin/test-users",auth:[["AdminAuth"]],answers:{201:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async adminSetTestUserPhone(e){return t.send({op:"AdminSetTestUserPhone",method:"PUT",path:"/admin/test-users/phone",auth:[["AdminAuth"]],answers:{204:"empty"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async adminDeleteTestUser(e){return t.send({op:"AdminDeleteTestUser",method:"DELETE",path:"/admin/test-users/"+s("AdminDeleteTestUser","uid",e.path.uid),auth:[["AdminAuth"]],answers:{204:"empty"},signal:e.signal})},async adminCreateCustomToken(e){return t.send({op:"AdminCreateCustomToken",method:"POST",path:"/admin/token/custom",auth:[["AdminAuth"]],answers:{201:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async adminListUsers(e){return t.send({op:"AdminListUsers",method:"GET",path:"/admin/users",auth:[["AdminAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async adminCreateUser(e){return t.send({op:"AdminCreateUser",method:"POST",path:"/admin/users",auth:[["AdminAuth"]],answers:{201:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async adminImportUsers(e){return t.send({op:"AdminImportUsers",method:"POST",path:"/admin/users/import",auth:[["AdminAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async adminGetUser(e){return t.send({op:"AdminGetUser",method:"GET",path:"/admin/users/"+s("AdminGetUser","uid",e.path.uid),auth:[["AdminAuth"]],answers:{200:"json"},signal:e.signal})},async adminDeleteUser(e){return t.send({op:"AdminDeleteUser",method:"DELETE",path:"/admin/users/"+s("AdminDeleteUser","uid",e.path.uid),auth:[["AdminAuth"]],answers:{204:"empty"},signal:e.signal})},async adminUpdateUser(e){return t.send({op:"AdminUpdateUser",method:"PATCH",path:"/admin/users/"+s("AdminUpdateUser","uid",e.path.uid),auth:[["AdminAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async adminBanUser(e){return t.send({op:"AdminBanUser",method:"POST",path:"/admin/users/"+s("AdminBanUser","uid",e.path.uid)+"/ban",auth:[["AdminAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async adminListUserConsents(e){return t.send({op:"AdminListUserConsents",method:"GET",path:"/admin/users/"+s("AdminListUserConsents","uid",e.path.uid)+"/consents",auth:[["AdminAuth"]],answers:{200:"json"},signal:e.signal})},async adminRevokeUserCredentials(e){return t.send({op:"AdminRevokeUserCredentials",method:"POST",path:"/admin/users/"+s("AdminRevokeUserCredentials","uid",e.path.uid)+"/credentials/revoke-all",auth:[["AdminAuth"]],answers:{200:"json"},signal:e.signal})},async adminExportUser(e){return t.send({op:"AdminExportUser",method:"GET",path:"/admin/users/"+s("AdminExportUser","uid",e.path.uid)+"/export",auth:[["AdminAuth"]],answers:{200:"json"},signal:e.signal})},async adminListUserMfaFactors(e){return t.send({op:"AdminListUserMFAFactors",method:"GET",path:"/admin/users/"+s("AdminListUserMFAFactors","uid",e.path.uid)+"/mfa",auth:[["AdminAuth"]],answers:{200:"json"},signal:e.signal})},async adminResetUserMfa(e){return t.send({op:"AdminResetUserMFA",method:"DELETE",path:"/admin/users/"+s("AdminResetUserMFA","uid",e.path.uid)+"/mfa",auth:[["AdminAuth"]],answers:{204:"empty"},signal:e.signal})},async adminResetUserPassword(e){return t.send({op:"AdminResetUserPassword",method:"POST",path:"/admin/users/"+s("AdminResetUserPassword","uid",e.path.uid)+"/reset-password",auth:[["AdminAuth"]],answers:{200:"json"},signal:e.signal})},async adminListUserRoles(e){return t.send({op:"AdminListUserRoles",method:"GET",path:"/admin/users/"+s("AdminListUserRoles","uid",e.path.uid)+"/roles",auth:[["AdminAuth"]],answers:{200:"json"},signal:e.signal})},async adminAssignUserRole(e){return t.send({op:"AdminAssignUserRole",method:"PUT",path:"/admin/users/"+s("AdminAssignUserRole","uid",e.path.uid)+"/roles/"+s("AdminAssignUserRole","role",e.path.role),auth:[["AdminAuth"]],answers:{200:"json"},signal:e.signal})},async adminRevokeUserRole(e){return t.send({op:"AdminRevokeUserRole",method:"DELETE",path:"/admin/users/"+s("AdminRevokeUserRole","uid",e.path.uid)+"/roles/"+s("AdminRevokeUserRole","role",e.path.role),auth:[["AdminAuth"]],answers:{200:"json"},signal:e.signal})},async adminRevokeUserSessions(e){return t.send({op:"AdminRevokeUserSessions",method:"POST",path:"/admin/users/"+s("AdminRevokeUserSessions","uid",e.path.uid)+"/sessions/revoke-all",auth:[["AdminAuth"]],answers:{204:"empty"},signal:e.signal})},async adminUnbanUser(e){return t.send({op:"AdminUnbanUser",method:"POST",path:"/admin/users/"+s("AdminUnbanUser","uid",e.path.uid)+"/unban",auth:[["AdminAuth"]],answers:{200:"json"},signal:e.signal})},async signInAnonymously(e){return t.send({op:"SignInAnonymously",method:"POST",path:"/auth/anonymous",auth:[["ApiKeyAuth"]],answers:{201:"json"},headers:e?.headers,body:{kind:"json",contentType:"application/json",value:e?.body},signal:e?.signal})},async convertAnonymousUser(e){return t.send({op:"ConvertAnonymousUser",method:"POST",path:"/auth/anonymous/convert",auth:[["ApiKeyAuth","userJWT"]],answers:{202:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async verifyAnonymousConversion(e){return t.send({op:"VerifyAnonymousConversion",method:"POST",path:"/auth/anonymous/convert/verify",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async devicePendingRequest(e){return t.send({op:"DevicePendingRequest",method:"GET",path:"/auth/device/requests/"+s("DevicePendingRequest","user_code",e.path.user_code),auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e.signal})},async deviceVerifyPage(e){return t.send({op:"DeviceVerifyPage",method:"GET",path:"/auth/device/verify",auth:[["ApiKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async deviceVerifySubmit(e){return t.send({op:"DeviceVerifySubmit",method:"POST",path:"/auth/device/verify",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},body:{kind:"form",contentType:"application/x-www-form-urlencoded",value:e.body},signal:e.signal})},async listDevices(e){return t.send({op:"ListDevices",method:"GET",path:"/auth/devices",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e?.signal})},async attestAndroidDevice(e){return t.send({op:"AttestAndroidDevice",method:"POST",path:"/auth/devices/attest/android",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async attestIosDevice(e){return t.send({op:"AttestIOSDevice",method:"POST",path:"/auth/devices/attest/ios",auth:[["ApiKeyAuth"]],answers:{200:"json"},headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async bindDeviceKey(e){return t.send({op:"BindDeviceKey",method:"POST",path:"/auth/devices/bind",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async createDeviceChallenge(e){return t.send({op:"CreateDeviceChallenge",method:"POST",path:"/auth/devices/challenge",auth:[["ApiKeyAuth"]],answers:{200:"json"},headers:e?.headers,signal:e?.signal})},async verifyAndroidIntegrity(e){return t.send({op:"VerifyAndroidIntegrity",method:"POST",path:"/auth/devices/verify/android",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async deleteDevice(e){return t.send({op:"DeleteDevice",method:"DELETE",path:"/auth/devices/"+s("DeleteDevice","id",e.path.id),auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e.signal})},async verifyDeviceSignature(e){return t.send({op:"VerifyDeviceSignature",method:"POST",path:"/auth/devices/"+s("VerifyDeviceSignature","id",e.path.id)+"/verify",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async listIdentities(e){return t.send({op:"ListIdentities",method:"GET",path:"/auth/identities",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e?.signal})},async unlinkIdentity(e){return t.send({op:"UnlinkIdentity",method:"DELETE",path:"/auth/identities/"+s("UnlinkIdentity","id",e.path.id),auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e.signal})},async createInstallation(e){return t.send({op:"CreateInstallation",method:"POST",path:"/auth/installations",auth:[["ApiKeyAuth","userJWT"]],answers:{201:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async bindInstallation(e){return t.send({op:"BindInstallation",method:"POST",path:"/auth/installations/"+s("BindInstallation","id",e.path.id)+"/bind",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async refreshInstallation(e){return t.send({op:"RefreshInstallation",method:"POST",path:"/auth/installations/"+s("RefreshInstallation","id",e.path.id)+"/refresh",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e.signal})},async revokeInstallation(e){return t.send({op:"RevokeInstallation",method:"POST",path:"/auth/installations/"+s("RevokeInstallation","id",e.path.id)+"/revoke",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e.signal})},async unbindInstallation(e){return t.send({op:"UnbindInstallation",method:"POST",path:"/auth/installations/"+s("UnbindInstallation","id",e.path.id)+"/unbind",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e.signal})},async login(e){return t.send({op:"Login",method:"POST",path:"/auth/login",auth:[["ApiKeyAuth"]],answers:{200:"json"},headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async logout(e){return t.send({op:"Logout",method:"POST",path:"/auth/logout",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e?.signal})},async magicLinkRequest(e){return t.send({op:"MagicLinkRequest",method:"POST",path:"/auth/magic-link",auth:[["ApiKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async magicLinkVerify(e){return t.send({op:"MagicLinkVerify",method:"POST",path:"/auth/magic-link/verify",auth:[["ApiKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getMe(e){return t.send({op:"GetMe",method:"GET",path:"/auth/me",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e?.signal})},async updateMe(e){return t.send({op:"UpdateMe",method:"PATCH",path:"/auth/me",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async mfaChallenge(e){return t.send({op:"MfaChallenge",method:"POST",path:"/auth/mfa/challenge",auth:[["ApiKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async mfaEmailChallenge(e){return t.send({op:"MfaEmailChallenge",method:"POST",path:"/auth/mfa/email/challenge",auth:[["ApiKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async mfaEmailEnroll(e){return t.send({op:"MfaEmailEnroll",method:"POST",path:"/auth/mfa/email/enroll",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e?.signal})},async mfaEmailVerify(e){return t.send({op:"MfaEmailVerify",method:"POST",path:"/auth/mfa/email/verify",auth:[["ApiKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async mfaEnroll(e){return t.send({op:"MfaEnroll",method:"POST",path:"/auth/mfa/enroll",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async mfaListFactors(e){return t.send({op:"MfaListFactors",method:"GET",path:"/auth/mfa/factors",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e?.signal})},async mfaRemoveFactor(e){return t.send({op:"MfaRemoveFactor",method:"DELETE",path:"/auth/mfa/factors/"+s("MfaRemoveFactor","id",e.path.id),auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async mfaRecovery(e){return t.send({op:"MfaRecovery",method:"POST",path:"/auth/mfa/recovery",auth:[["ApiKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async mfaRegenerateRecoveryCodes(e){return t.send({op:"MfaRegenerateRecoveryCodes",method:"POST",path:"/auth/mfa/recovery-codes/regenerate",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e?.signal})},async mfaSmsChallenge(e){return t.send({op:"MfaSMSChallenge",method:"POST",path:"/auth/mfa/sms/challenge",auth:[["ApiKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async mfaSmsEnroll(e){return t.send({op:"MfaSMSEnroll",method:"POST",path:"/auth/mfa/sms/enroll",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async mfaSmsVerifyEnrollment(e){return t.send({op:"MfaSMSVerifyEnrollment",method:"POST",path:"/auth/mfa/sms/verify",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async mfaVerifyEnrollment(e){return t.send({op:"MfaVerifyEnrollment",method:"POST",path:"/auth/mfa/verify",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async socialCallbackApple(e){return t.send({op:"SocialCallbackApple",method:"GET",path:"/auth/oauth/callback/apple",auth:[],answers:{},signal:e?.signal})},async socialCallbackApplePost(e){return t.send({op:"SocialCallbackApplePost",method:"POST",path:"/auth/oauth/callback/apple",auth:[],answers:{303:"redirect"},body:{kind:"form",contentType:"application/x-www-form-urlencoded",value:e.body},signal:e.signal})},async socialCallbackGitHub(e){return t.send({op:"SocialCallbackGitHub",method:"GET",path:"/auth/oauth/callback/github",auth:[],answers:{303:"redirect"},query:e.query,signal:e.signal})},async socialCallbackGitHubPost(e){return t.send({op:"SocialCallbackGitHubPost",method:"POST",path:"/auth/oauth/callback/github",auth:[],answers:{},signal:e?.signal})},async socialCallbackGoogle(e){return t.send({op:"SocialCallbackGoogle",method:"GET",path:"/auth/oauth/callback/google",auth:[],answers:{303:"redirect"},query:e.query,signal:e.signal})},async socialCallbackGooglePost(e){return t.send({op:"SocialCallbackGooglePost",method:"POST",path:"/auth/oauth/callback/google",auth:[],answers:{},signal:e?.signal})},async socialCallbackMicrosoft(e){return t.send({op:"SocialCallbackMicrosoft",method:"GET",path:"/auth/oauth/callback/microsoft",auth:[],answers:{303:"redirect"},query:e.query,signal:e.signal})},async socialCallbackMicrosoftPost(e){return t.send({op:"SocialCallbackMicrosoftPost",method:"POST",path:"/auth/oauth/callback/microsoft",auth:[],answers:{},signal:e?.signal})},async socialConfig(e){return t.send({op:"SocialConfig",method:"GET",path:"/auth/oauth/config",auth:[["ApiKeyAuth"]],answers:{200:"json"},query:e.query,signal:e.signal})},async socialBegin(e){return t.send({op:"SocialBegin",method:"POST",path:"/auth/oauth/transactions",auth:[["ApiKeyAuth"]],answers:{201:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async socialCancel(e){return t.send({op:"SocialCancel",method:"POST",path:"/auth/oauth/transactions/"+s("SocialCancel","id",e.path.id)+"/cancel",auth:[["ApiKeyAuth"]],answers:{204:"empty"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async socialComplete(e){return t.send({op:"SocialComplete",method:"POST",path:"/auth/oauth/transactions/"+s("SocialComplete","id",e.path.id)+"/complete",auth:[["ApiKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async requestPhoneOtp(e){return t.send({op:"RequestPhoneOTP",method:"POST",path:"/auth/otp",auth:[["ApiKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async verifyPhoneOtp(e){return t.send({op:"VerifyPhoneOTP",method:"POST",path:"/auth/otp/verify",auth:[["ApiKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async hostedRecoveryApprovalPage(e){return t.send({op:"HostedRecoveryApprovalPage",method:"GET",path:"/auth/pages/recovery-approval",auth:[],answers:{200:"raw"},query:e?.query,signal:e?.signal})},async hostedRecoveryApprovalSubmit(e){return t.send({op:"HostedRecoveryApprovalSubmit",method:"POST",path:"/auth/pages/recovery-approval",auth:[],answers:{200:"raw"},body:{kind:"form",contentType:"application/x-www-form-urlencoded",value:e.body},signal:e.signal})},async hostedRecoveryContactPage(e){return t.send({op:"HostedRecoveryContactPage",method:"GET",path:"/auth/pages/recovery-contact",auth:[],answers:{200:"raw"},query:e?.query,signal:e?.signal})},async hostedRecoveryContactSubmit(e){return t.send({op:"HostedRecoveryContactSubmit",method:"POST",path:"/auth/pages/recovery-contact",auth:[],answers:{200:"raw"},body:{kind:"form",contentType:"application/x-www-form-urlencoded",value:e.body},signal:e.signal})},async hostedResetPasswordPage(e){return t.send({op:"HostedResetPasswordPage",method:"GET",path:"/auth/pages/reset-password",auth:[],answers:{200:"raw"},query:e?.query,signal:e?.signal})},async hostedResetPasswordSubmit(e){return t.send({op:"HostedResetPasswordSubmit",method:"POST",path:"/auth/pages/reset-password",auth:[],answers:{200:"raw"},body:{kind:"form",contentType:"application/x-www-form-urlencoded",value:e.body},signal:e.signal})},async hostedVerifyEmailPage(e){return t.send({op:"HostedVerifyEmailPage",method:"GET",path:"/auth/pages/verify-email",auth:[],answers:{200:"raw"},query:e?.query,signal:e?.signal})},async hostedVerifyEmailSubmit(e){return t.send({op:"HostedVerifyEmailSubmit",method:"POST",path:"/auth/pages/verify-email",auth:[],answers:{200:"raw"},body:{kind:"form",contentType:"application/x-www-form-urlencoded",value:e.body},signal:e.signal})},async passwordChange(e){return t.send({op:"PasswordChange",method:"POST",path:"/auth/password/change",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async passwordResetRequest(e){return t.send({op:"PasswordResetRequest",method:"POST",path:"/auth/password/reset",auth:[["ApiKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async passwordResetConfirm(e){return t.send({op:"PasswordResetConfirm",method:"POST",path:"/auth/password/reset/confirm",auth:[["ApiKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async setPassword(e){return t.send({op:"SetPassword",method:"POST",path:"/auth/password/set",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async powChallenge(e){return t.send({op:"PowChallenge",method:"POST",path:"/auth/pow/challenge",auth:[["ApiKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async approveRecovery(e){return t.send({op:"ApproveRecovery",method:"POST",path:"/auth/recovery/approve",auth:[["ApiKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async listRecoveryContacts(e){return t.send({op:"ListRecoveryContacts",method:"GET",path:"/auth/recovery/contacts",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e?.signal})},async addRecoveryContact(e){return t.send({op:"AddRecoveryContact",method:"POST",path:"/auth/recovery/contacts",auth:[["ApiKeyAuth","userJWT"]],answers:{201:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async deleteRecoveryContact(e){return t.send({op:"DeleteRecoveryContact",method:"DELETE",path:"/auth/recovery/contacts/"+s("DeleteRecoveryContact","id",e.path.id),auth:[["ApiKeyAuth","userJWT"]],answers:{204:"empty"},signal:e.signal})},async verifyRecoveryContact(e){return t.send({op:"VerifyRecoveryContact",method:"POST",path:"/auth/recovery/contacts/"+s("VerifyRecoveryContact","id",e.path.id)+"/verify",auth:[["ApiKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async denyRecovery(e){return t.send({op:"DenyRecovery",method:"POST",path:"/auth/recovery/deny",auth:[["ApiKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async initiateRecovery(e){return t.send({op:"InitiateRecovery",method:"POST",path:"/auth/recovery/initiate",auth:[["ApiKeyAuth"]],answers:{200:"json",202:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getRecoveryStatus(e){return t.send({op:"GetRecoveryStatus",method:"GET",path:"/auth/recovery/status",auth:[["ApiKeyAuth"]],answers:{200:"json"},query:e.query,signal:e.signal})},async resendVerification(e){return t.send({op:"ResendVerification",method:"POST",path:"/auth/resend-verification",auth:[["ApiKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async listSessions(e){return t.send({op:"ListSessions",method:"GET",path:"/auth/sessions",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e?.signal})},async revokeAllSessions(e){return t.send({op:"RevokeAllSessions",method:"DELETE",path:"/auth/sessions",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e?.signal})},async revokeSession(e){return t.send({op:"RevokeSession",method:"DELETE",path:"/auth/sessions/"+s("RevokeSession","id",e.path.id),auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e.signal})},async signup(e){return t.send({op:"Signup",method:"POST",path:"/auth/signup",auth:[["ApiKeyAuth"]],answers:{201:"json"},headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async stepUp(e){return t.send({op:"StepUp",method:"POST",path:"/auth/step-up",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async stepUpStatus(e){return t.send({op:"StepUpStatus",method:"GET",path:"/auth/step-up/status",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e?.signal})},async stepUpWebAuthnBegin(e){return t.send({op:"StepUpWebAuthnBegin",method:"POST",path:"/auth/step-up/webauthn/begin",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e?.signal})},async exchangeCustomToken(e){return t.send({op:"ExchangeCustomToken",method:"POST",path:"/auth/token/exchange",auth:[["ApiKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async refreshToken(e){return t.send({op:"RefreshToken",method:"POST",path:"/auth/token/refresh",auth:[["ApiKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async revokeRefreshToken(e){return t.send({op:"RevokeRefreshToken",method:"POST",path:"/auth/token/revoke",auth:[["ApiKeyAuth"]],answers:{200:"empty"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async listTransactions(e){return t.send({op:"ListTransactions",method:"GET",path:"/auth/transactions",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async createTransaction(e){return t.send({op:"CreateTransaction",method:"POST",path:"/auth/transactions",auth:[["ApiKeyAuth","userJWT"]],answers:{201:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getTransaction(e){return t.send({op:"GetTransaction",method:"GET",path:"/auth/transactions/"+s("GetTransaction","id",e.path.id),auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e.signal})},async approveTransaction(e){return t.send({op:"ApproveTransaction",method:"POST",path:"/auth/transactions/"+s("ApproveTransaction","id",e.path.id)+"/approve",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async denyTransaction(e){return t.send({op:"DenyTransaction",method:"POST",path:"/auth/transactions/"+s("DenyTransaction","id",e.path.id)+"/deny",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async listTrustedDevices(e){return t.send({op:"ListTrustedDevices",method:"GET",path:"/auth/trusted-devices",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e?.signal})},async registerTrustedDevice(e){return t.send({op:"RegisterTrustedDevice",method:"POST",path:"/auth/trusted-devices",auth:[["ApiKeyAuth","userJWT"]],answers:{201:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async revokeTrustedDevice(e){return t.send({op:"RevokeTrustedDevice",method:"DELETE",path:"/auth/trusted-devices/"+s("RevokeTrustedDevice","id",e.path.id),auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e.signal})},async verifyTokenUser(e){return t.send({op:"VerifyTokenUser",method:"GET",path:"/auth/user",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e?.signal})},async deleteAccount(e){return t.send({op:"DeleteAccount",method:"DELETE",path:"/auth/user",auth:[["ApiKeyAuth","userJWT"]],answers:{204:"empty"},body:{kind:"json",contentType:"application/json",value:e?.body},signal:e?.signal})},async listConsents(e){return t.send({op:"ListConsents",method:"GET",path:"/auth/user/consents",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e?.signal})},async recordConsent(e){return t.send({op:"RecordConsent",method:"POST",path:"/auth/user/consents",auth:[["ApiKeyAuth","userJWT"]],answers:{201:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async revokeConsent(e){return t.send({op:"RevokeConsent",method:"DELETE",path:"/auth/user/consents/"+s("RevokeConsent","id",e.path.id),auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e.signal})},async verifyEmail(e){return t.send({op:"VerifyEmail",method:"POST",path:"/auth/verify-email",auth:[["ApiKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async webauthnListCredentials(e){return t.send({op:"WebauthnListCredentials",method:"GET",path:"/auth/webauthn/credentials",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e?.signal})},async webauthnRenameCredential(e){return t.send({op:"WebauthnRenameCredential",method:"PUT",path:"/auth/webauthn/credentials/"+s("WebauthnRenameCredential","id",e.path.id),auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async webauthnDeleteCredential(e){return t.send({op:"WebauthnDeleteCredential",method:"DELETE",path:"/auth/webauthn/credentials/"+s("WebauthnDeleteCredential","id",e.path.id),auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e.signal})},async webauthnLoginBegin(e){return t.send({op:"WebauthnLoginBegin",method:"POST",path:"/auth/webauthn/login/begin",auth:[["ApiKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e?.body},signal:e?.signal})},async webauthnLoginFinish(e){return t.send({op:"WebauthnLoginFinish",method:"POST",path:"/auth/webauthn/login/finish",auth:[["ApiKeyAuth"]],answers:{200:"json"},query:e.query,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async webauthnRecoveryBegin(e){return t.send({op:"WebauthnRecoveryBegin",method:"POST",path:"/auth/webauthn/recovery/begin",auth:[["ApiKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async webauthnRecoveryFinish(e){return t.send({op:"WebauthnRecoveryFinish",method:"POST",path:"/auth/webauthn/recovery/finish",auth:[["ApiKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async webauthnRecoveryRegisterBegin(e){return t.send({op:"WebauthnRecoveryRegisterBegin",method:"POST",path:"/auth/webauthn/recovery/register/begin",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e?.body},signal:e?.signal})},async webauthnRecoveryRegisterFinish(e){return t.send({op:"WebauthnRecoveryRegisterFinish",method:"POST",path:"/auth/webauthn/recovery/register/finish",auth:[["ApiKeyAuth","userJWT"]],answers:{201:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async webauthnRegisterBegin(e){return t.send({op:"WebauthnRegisterBegin",method:"POST",path:"/auth/webauthn/register/begin",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e?.body},signal:e?.signal})},async webauthnRegisterFinish(e){return t.send({op:"WebauthnRegisterFinish",method:"POST",path:"/auth/webauthn/register/finish",auth:[["ApiKeyAuth","userJWT"]],answers:{201:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async webauthnSignupBegin(e){return t.send({op:"WebauthnSignupBegin",method:"POST",path:"/auth/webauthn/signup/begin",auth:[["ApiKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async webauthnSignupFinish(e){return t.send({op:"WebauthnSignupFinish",method:"POST",path:"/auth/webauthn/signup/finish",auth:[["ApiKeyAuth"]],answers:{201:"json"},query:e.query,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async oauthAuthorize(e){return t.send({op:"OauthAuthorize",method:"GET",path:"/oauth/authorize",auth:[],answers:{302:"redirect",303:"redirect"},query:e?.query,signal:e?.signal})},async oauthAuthorizePost(e){return t.send({op:"OauthAuthorizePost",method:"POST",path:"/oauth/authorize",auth:[],answers:{302:"redirect",303:"redirect"},body:{kind:"form",contentType:"application/x-www-form-urlencoded",value:e.body},signal:e.signal})},async oauthAuthorizeCallback(e){return t.send({op:"OauthAuthorizeCallback",method:"GET",path:"/oauth/authorize/callback",auth:[],answers:{303:"redirect"},query:e.query,signal:e.signal})},async oauthDeviceAuthorize(e){return t.send({op:"OauthDeviceAuthorize",method:"POST",path:"/oauth/device",auth:[["OAuthClient"],[]],answers:{200:"json"},body:{kind:"form",contentType:"application/x-www-form-urlencoded",value:e.body},signal:e.signal})},async oauthIntrospect(e){return t.send({op:"OauthIntrospect",method:"POST",path:"/oauth/introspect",auth:[["AdminAuth"],["OAuthClient"],[]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async oauthLogout(e){return t.send({op:"OauthLogout",method:"GET",path:"/oauth/logout",auth:[],answers:{302:"redirect"},query:e?.query,signal:e?.signal})},async oauthLogoutPost(e){return t.send({op:"OauthLogoutPost",method:"POST",path:"/oauth/logout",auth:[],answers:{302:"redirect"},body:{kind:"form",contentType:"application/x-www-form-urlencoded",value:e?.body},signal:e?.signal})},async oauthPar(e){return t.send({op:"OauthPAR",method:"POST",path:"/oauth/par",auth:[["OAuthClient"],[]],answers:{201:"json"},body:{kind:"form",contentType:"application/x-www-form-urlencoded",value:e.body},signal:e.signal})},async oauthRevoke(e){return t.send({op:"OauthRevoke",method:"POST",path:"/oauth/revoke",auth:[["OAuthClient"],[]],answers:{200:"empty"},body:{kind:"form",contentType:"application/x-www-form-urlencoded",value:e.body},signal:e.signal})},async oauthToken(e){return t.send({op:"OauthToken",method:"POST",path:"/oauth/token",auth:[["OAuthClient"],[]],answers:{200:"json"},body:{kind:"form",contentType:"application/x-www-form-urlencoded",value:e.body},signal:e.signal})},async oauthUserinfo(e){return t.send({op:"OauthUserinfo",method:"GET",path:"/oauth/userinfo",auth:[["OAuthAccessToken"]],answers:{200:"json"},signal:e?.signal})},async oauthUserinfoPost(e){return t.send({op:"OauthUserinfoPost",method:"POST",path:"/oauth/userinfo",auth:[["OAuthAccessToken"]],answers:{200:"json"},signal:e?.signal})},async ownerCliCode(e){return t.send({op:"OwnerCLICode",method:"POST",path:"/auth/cli/owner-code",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})}}}var o={};n(o,{client:()=>P});function P(t){return{async getCacheEntry(e){return t.send({op:"GetCacheEntry",method:"GET",path:"/cache/entry",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e.query,signal:e.signal})},async putCacheEntry(e){return t.send({op:"PutCacheEntry",method:"PUT",path:"/cache/entry",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e.query,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async deleteCacheEntry(e){return t.send({op:"DeleteCacheEntry",method:"DELETE",path:"/cache/entry",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e.query,signal:e.signal})},async incrementCacheEntry(e){return t.send({op:"IncrementCacheEntry",method:"POST",path:"/cache/entry/increment",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e.query,signal:e.signal})},async getCacheUsage(e){return t.send({op:"GetCacheUsage",method:"GET",path:"/cache/usage",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})}}}var l={};n(l,{client:()=>A});function A(t){return{async getValues(e){return t.send({op:"GetValues",method:"GET",path:"/flags",auth:[["ApiKeyAuth"],["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{200:"json"},headers:e?.headers,signal:e?.signal})},async batchUserValues(e){return t.send({op:"BatchUserValues",method:"POST",path:"/flags/batch",auth:[["SecretKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getDelta(e){return t.send({op:"GetDelta",method:"GET",path:"/flags/delta",auth:[["ApiKeyAuth"],["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{200:"json",304:"empty"},query:e?.query,headers:e?.headers,signal:e?.signal})},async getEvaluations(e){return t.send({op:"GetEvaluations",method:"GET",path:"/flags/evaluations",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async getCurrentInstallations(e){return t.send({op:"GetCurrentInstallations",method:"GET",path:"/flags/installations/current",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async getInstallationsDaily(e){return t.send({op:"GetInstallationsDaily",method:"GET",path:"/flags/installations/daily",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async getSnapshot(e){return t.send({op:"GetSnapshot",method:"GET",path:"/flags/snapshot",auth:[["ApiKeyAuth"],["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{200:"json",304:"empty"},headers:e?.headers,signal:e?.signal})},async listDefinitions(e){return t.send({op:"ListDefinitions",method:"GET",path:"/flags/system",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async getDefinition(e){return t.send({op:"GetDefinition",method:"GET",path:"/flags/system/"+s("GetDefinition","key",e.path.key),auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async putDefinition(e){return t.send({op:"PutDefinition",method:"PUT",path:"/flags/system/"+s("PutDefinition","key",e.path.key),auth:[["SecretKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async deleteDefinition(e){return t.send({op:"DeleteDefinition",method:"DELETE",path:"/flags/system/"+s("DeleteDefinition","key",e.path.key),auth:[["SecretKeyAuth"]],answers:{204:"empty"},signal:e.signal})},async activateTemplates(e){return t.send({op:"ActivateTemplates",method:"POST",path:"/flags/templates/activation",auth:[["SecretKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getActiveTemplate(e){return t.send({op:"GetActiveTemplate",method:"GET",path:"/flags/templates/active",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async getTemplateCapabilities(e){return t.send({op:"GetTemplateCapabilities",method:"GET",path:"/flags/templates/capabilities",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async getTemplateDraft(e){return t.send({op:"GetTemplateDraft",method:"GET",path:"/flags/templates/draft",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async createTemplateDraft(e){return t.send({op:"CreateTemplateDraft",method:"POST",path:"/flags/templates/draft",auth:[["SecretKeyAuth"]],answers:{201:"json"},headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async discardTemplateDraft(e){return t.send({op:"DiscardTemplateDraft",method:"DELETE",path:"/flags/templates/draft",auth:[["SecretKeyAuth"]],answers:{204:"empty"},headers:e.headers,signal:e.signal})},async putTemplateParameter(e){return t.send({op:"PutTemplateParameter",method:"PUT",path:"/flags/templates/draft/parameters/"+s("PutTemplateParameter","key",e.path.key),auth:[["SecretKeyAuth"]],answers:{200:"json"},headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async removeTemplateParameter(e){return t.send({op:"RemoveTemplateParameter",method:"DELETE",path:"/flags/templates/draft/parameters/"+s("RemoveTemplateParameter","key",e.path.key),auth:[["SecretKeyAuth"]],answers:{200:"json"},headers:e.headers,signal:e.signal})},async reviewTemplateDraft(e){return t.send({op:"ReviewTemplateDraft",method:"GET",path:"/flags/templates/draft/review",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async publishTemplate(e){return t.send({op:"PublishTemplate",method:"POST",path:"/flags/templates/publish",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getPublishReceipt(e){return t.send({op:"GetPublishReceipt",method:"POST",path:"/flags/templates/publish/receipt",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async restoreTemplateVersion(e){return t.send({op:"RestoreTemplateVersion",method:"POST",path:"/flags/templates/restore/"+s("RestoreTemplateVersion","version",e.path.version),auth:[["SecretKeyAuth"]],answers:{201:"json"},headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async listTemplateVersions(e){return t.send({op:"ListTemplateVersions",method:"GET",path:"/flags/templates/versions",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async getTemplateVersion(e){return t.send({op:"GetTemplateVersion",method:"GET",path:"/flags/templates/versions/"+s("GetTemplateVersion","version",e.path.version),auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async getUserValues(e){return t.send({op:"GetUserValues",method:"GET",path:"/flags/users/"+s("GetUserValues","user_id",e.path.user_id),auth:[["SecretKeyAuth"]],answers:{200:"json"},headers:e.headers,signal:e.signal})},async putUserValues(e){return t.send({op:"PutUserValues",method:"PUT",path:"/flags/users/"+s("PutUserValues","user_id",e.path.user_id),auth:[["SecretKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async deleteUserValues(e){return t.send({op:"DeleteUserValues",method:"DELETE",path:"/flags/users/"+s("DeleteUserValues","user_id",e.path.user_id),auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async putUserValue(e){return t.send({op:"PutUserValue",method:"PUT",path:"/flags/users/"+s("PutUserValue","user_id",e.path.user_id)+"/"+s("PutUserValue","key",e.path.key),auth:[["SecretKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async deleteUserValue(e){return t.send({op:"DeleteUserValue",method:"DELETE",path:"/flags/users/"+s("DeleteUserValue","user_id",e.path.user_id)+"/"+s("DeleteUserValue","key",e.path.key),auth:[["SecretKeyAuth"]],answers:{200:"json"},headers:e.headers,signal:e.signal})}}}var p={};n(p,{client:()=>R});function R(t){return{async listMachines(e){return t.send({op:"ListMachines",method:"GET",path:"/machines",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async createMachine(e){return t.send({op:"CreateMachine",method:"POST",path:"/machines",auth:[["SecretKeyAuth"]],answers:{201:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async listMachineSizes(e){return t.send({op:"ListMachineSizes",method:"GET",path:"/machines/sizes",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async getMachineNetwork(e){return t.send({op:"GetMachineNetwork",method:"GET",path:"/machines/network",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async connectGitHub(e){return t.send({op:"ConnectGitHub",method:"POST",path:"/machines/github/connect",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async listInstallations(e){return t.send({op:"ListInstallations",method:"GET",path:"/machines/github/installations",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async linkInstallation(e){return t.send({op:"LinkInstallation",method:"POST",path:"/machines/github/installations",auth:[["SecretKeyAuth"]],answers:{201:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async unlinkInstallation(e){return t.send({op:"UnlinkInstallation",method:"DELETE",path:"/machines/github/installations/"+s("UnlinkInstallation","installation",e.path.installation),auth:[["SecretKeyAuth"]],answers:{204:"empty"},signal:e.signal})},async listRepositories(e){return t.send({op:"ListRepositories",method:"GET",path:"/machines/github/repositories",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async getMachine(e){return t.send({op:"GetMachine",method:"GET",path:"/machines/"+s("GetMachine","name",e.path.name),auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async deleteMachine(e){return t.send({op:"DeleteMachine",method:"DELETE",path:"/machines/"+s("DeleteMachine","name",e.path.name),auth:[["SecretKeyAuth"]],answers:{204:"empty"},signal:e.signal})},async updateMachine(e){return t.send({op:"UpdateMachine",method:"PATCH",path:"/machines/"+s("UpdateMachine","name",e.path.name),auth:[["SecretKeyAuth"]],answers:{200:"json"},headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async listBuilds(e){return t.send({op:"ListBuilds",method:"GET",path:"/machines/"+s("ListBuilds","name",e.path.name)+"/builds",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e.query,signal:e.signal})},async deployMachine(e){return t.send({op:"DeployMachine",method:"POST",path:"/machines/"+s("DeployMachine","name",e.path.name)+"/builds",auth:[["SecretKeyAuth"]],answers:{202:"json"},signal:e.signal})},async getBuild(e){return t.send({op:"GetBuild",method:"GET",path:"/machines/"+s("GetBuild","name",e.path.name)+"/builds/"+s("GetBuild","build",e.path.build),auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async getBuildLog(e){return t.send({op:"GetBuildLog",method:"GET",path:"/machines/"+s("GetBuildLog","name",e.path.name)+"/builds/"+s("GetBuildLog","build",e.path.build)+"/log",auth:[["SecretKeyAuth"]],answers:{200:"raw"},signal:e.signal})},async rollbackMachine(e){return t.send({op:"RollbackMachine",method:"POST",path:"/machines/"+s("RollbackMachine","name",e.path.name)+"/rollback",auth:[["SecretKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async listDatabases(e){return t.send({op:"ListDatabases",method:"GET",path:"/databases",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async createDatabase(e){return t.send({op:"CreateDatabase",method:"POST",path:"/databases",auth:[["SecretKeyAuth"]],answers:{201:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async listDatabaseSizes(e){return t.send({op:"ListDatabaseSizes",method:"GET",path:"/databases/sizes",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async getDatabase(e){return t.send({op:"GetDatabase",method:"GET",path:"/databases/"+s("GetDatabase","name",e.path.name),auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async deleteDatabase(e){return t.send({op:"DeleteDatabase",method:"DELETE",path:"/databases/"+s("DeleteDatabase","name",e.path.name),auth:[["SecretKeyAuth"]],answers:{204:"empty"},signal:e.signal})},async updateDatabase(e){return t.send({op:"UpdateDatabase",method:"PATCH",path:"/databases/"+s("UpdateDatabase","name",e.path.name),auth:[["SecretKeyAuth"]],answers:{200:"json",202:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async undeleteDatabase(e){return t.send({op:"UndeleteDatabase",method:"POST",path:"/databases/"+s("UndeleteDatabase","name",e.path.name)+"/undelete",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async purgeDatabase(e){return t.send({op:"PurgeDatabase",method:"POST",path:"/databases/"+s("PurgeDatabase","name",e.path.name)+"/purge",auth:[["SecretKeyAuth"]],answers:{204:"empty"},signal:e.signal})},async getDatabaseCredentials(e){return t.send({op:"GetDatabaseCredentials",method:"GET",path:"/databases/"+s("GetDatabaseCredentials","name",e.path.name)+"/credentials",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async changeDatabasePassword(e){return t.send({op:"ChangeDatabasePassword",method:"POST",path:"/databases/"+s("ChangeDatabasePassword","name",e.path.name)+"/password",auth:[["SecretKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async readMachineLogs(e){return t.send({op:"ReadMachineLogs",method:"GET",path:"/machines/"+s("ReadMachineLogs","name",e.path.name)+"/logs",auth:[["SecretKeyAuth"]],answers:{200:"raw"},query:e.query,signal:e.signal})},async getMachineMetrics(e){return t.send({op:"GetMachineMetrics",method:"GET",path:"/machines/"+s("GetMachineMetrics","name",e.path.name)+"/metrics",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e.query,signal:e.signal})},async getMachineContract(e){return t.send({op:"GetMachineContract",method:"GET",path:"/machines/"+s("GetMachineContract","name",e.path.name)+"/openapi",auth:[["SecretKeyAuth"]],answers:{200:"json",304:"empty"},headers:e.headers,signal:e.signal})},async restoreDatabase(e){return t.send({op:"RestoreDatabase",method:"POST",path:"/databases/"+s("RestoreDatabase","name",e.path.name)+"/restore",auth:[["SecretKeyAuth"]],answers:{202:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getDatabaseSchema(e){return t.send({op:"GetDatabaseSchema",method:"GET",path:"/databases/"+s("GetDatabaseSchema","name",e.path.name)+"/schema",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async getDatabaseMetrics(e){return t.send({op:"GetDatabaseMetrics",method:"GET",path:"/databases/"+s("GetDatabaseMetrics","name",e.path.name)+"/metrics",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e.query,signal:e.signal})},async queryDatabase(e){return t.send({op:"QueryDatabase",method:"POST",path:"/databases/"+s("QueryDatabase","name",e.path.name)+"/sql",auth:[["SecretKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async listCrons(e){return t.send({op:"ListCrons",method:"GET",path:"/machines/"+s("ListCrons","name",e.path.name)+"/crons",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async listCronRuns(e){return t.send({op:"ListCronRuns",method:"GET",path:"/machines/"+s("ListCronRuns","name",e.path.name)+"/crons/"+s("ListCronRuns","cron",e.path.cron)+"/runs",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async runCron(e){return t.send({op:"RunCron",method:"POST",path:"/machines/"+s("RunCron","name",e.path.name)+"/crons/"+s("RunCron","cron",e.path.cron)+"/run",auth:[["SecretKeyAuth"]],answers:{201:"json"},signal:e.signal})},async pauseCron(e){return t.send({op:"PauseCron",method:"POST",path:"/machines/"+s("PauseCron","name",e.path.name)+"/crons/"+s("PauseCron","cron",e.path.cron)+"/pause",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async resumeCron(e){return t.send({op:"ResumeCron",method:"POST",path:"/machines/"+s("ResumeCron","name",e.path.name)+"/crons/"+s("ResumeCron","cron",e.path.cron)+"/resume",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async listTasks(e){return t.send({op:"ListTasks",method:"GET",path:"/machines/"+s("ListTasks","name",e.path.name)+"/tasks",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e.query,signal:e.signal})},async enqueueTask(e){return t.send({op:"EnqueueTask",method:"POST",path:"/machines/"+s("EnqueueTask","name",e.path.name)+"/tasks",auth:[["SecretKeyAuth"]],answers:{200:"json",201:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getTask(e){return t.send({op:"GetTask",method:"GET",path:"/machines/"+s("GetTask","name",e.path.name)+"/tasks/"+s("GetTask","task",e.path.task),auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async cancelTask(e){return t.send({op:"CancelTask",method:"POST",path:"/machines/"+s("CancelTask","name",e.path.name)+"/tasks/"+s("CancelTask","task",e.path.task)+"/cancel",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async retryTask(e){return t.send({op:"RetryTask",method:"POST",path:"/machines/"+s("RetryTask","name",e.path.name)+"/tasks/"+s("RetryTask","task",e.path.task)+"/retry",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async listTaskTypes(e){return t.send({op:"ListTaskTypes",method:"GET",path:"/machines/"+s("ListTaskTypes","name",e.path.name)+"/task-types",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})}}}var d={};n(d,{client:()=>S});function S(t){return{async getDeliverability(e){return t.send({op:"GetDeliverability",method:"GET",path:"/notify/deliverability",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async listDevices(e){return t.send({op:"ListDevices",method:"GET",path:"/notify/devices",auth:[["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async registerDevice(e){return t.send({op:"RegisterDevice",method:"POST",path:"/notify/devices",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getDeviceStats(e){return t.send({op:"GetDeviceStats",method:"GET",path:"/notify/devices/stats",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async deleteMyDevice(e){return t.send({op:"DeleteMyDevice",method:"DELETE",path:"/notify/devices/"+s("DeleteMyDevice","device_id",e.path.device_id),auth:[["ApiKeyAuth","userJWT"]],answers:{204:"empty"},idempotent:!0,headers:e.headers,signal:e.signal})},async sendEmail(e){return t.send({op:"SendEmail",method:"POST",path:"/notify/email",auth:[["SecretKeyAuth"]],answers:{202:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async listNotifyMessages(e){return t.send({op:"ListNotifyMessages",method:"GET",path:"/notify/messages",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async getNotifyMessage(e){return t.send({op:"GetNotifyMessage",method:"GET",path:"/notify/messages/"+s("GetNotifyMessage","id",e.path.id),auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async getMetricsSummary(e){return t.send({op:"GetMetricsSummary",method:"GET",path:"/notify/metrics/summary",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async getMyPreferences(e){return t.send({op:"GetMyPreferences",method:"GET",path:"/notify/preferences",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e?.signal})},async setMyPreferences(e){return t.send({op:"SetMyPreferences",method:"PUT",path:"/notify/preferences",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async listNotifyProviders(e){return t.send({op:"ListNotifyProviders",method:"GET",path:"/notify/providers",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async putNotifyProvider(e){return t.send({op:"PutNotifyProvider",method:"PUT",path:"/notify/providers/"+s("PutNotifyProvider","channel",e.path.channel)+"/"+s("PutNotifyProvider","provider",e.path.provider),auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async deleteNotifyProvider(e){return t.send({op:"DeleteNotifyProvider",method:"DELETE",path:"/notify/providers/"+s("DeleteNotifyProvider","channel",e.path.channel)+"/"+s("DeleteNotifyProvider","provider",e.path.provider),auth:[["SecretKeyAuth"]],answers:{204:"empty"},idempotent:!0,headers:e.headers,signal:e.signal})},async sendPush(e){return t.send({op:"SendPush",method:"POST",path:"/notify/push",auth:[["SecretKeyAuth"]],answers:{202:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getNotifySettings(e){return t.send({op:"GetNotifySettings",method:"GET",path:"/notify/settings",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async putNotifySettings(e){return t.send({op:"PutNotifySettings",method:"PUT",path:"/notify/settings",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async sendSms(e){return t.send({op:"SendSMS",method:"POST",path:"/notify/sms",auth:[["SecretKeyAuth"]],answers:{202:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async listEmailTemplates(e){return t.send({op:"ListEmailTemplates",method:"GET",path:"/notify/templates/email",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async getEmailTemplate(e){return t.send({op:"GetEmailTemplate",method:"GET",path:"/notify/templates/email/"+s("GetEmailTemplate","slug",e.path.slug)+"/"+s("GetEmailTemplate","locale",e.path.locale),auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async putEmailTemplate(e){return t.send({op:"PutEmailTemplate",method:"PUT",path:"/notify/templates/email/"+s("PutEmailTemplate","slug",e.path.slug)+"/"+s("PutEmailTemplate","locale",e.path.locale),auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async deleteEmailTemplate(e){return t.send({op:"DeleteEmailTemplate",method:"DELETE",path:"/notify/templates/email/"+s("DeleteEmailTemplate","slug",e.path.slug)+"/"+s("DeleteEmailTemplate","locale",e.path.locale),auth:[["SecretKeyAuth"]],answers:{204:"empty"},idempotent:!0,headers:e.headers,signal:e.signal})},async listSmsTemplates(e){return t.send({op:"ListSMSTemplates",method:"GET",path:"/notify/templates/sms",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async getSmsTemplate(e){return t.send({op:"GetSMSTemplate",method:"GET",path:"/notify/templates/sms/"+s("GetSMSTemplate","slug",e.path.slug)+"/"+s("GetSMSTemplate","locale",e.path.locale),auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async putSmsTemplate(e){return t.send({op:"PutSMSTemplate",method:"PUT",path:"/notify/templates/sms/"+s("PutSMSTemplate","slug",e.path.slug)+"/"+s("PutSMSTemplate","locale",e.path.locale),auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async deleteSmsTemplate(e){return t.send({op:"DeleteSMSTemplate",method:"DELETE",path:"/notify/templates/sms/"+s("DeleteSMSTemplate","slug",e.path.slug)+"/"+s("DeleteSMSTemplate","locale",e.path.locale),auth:[["SecretKeyAuth"]],answers:{204:"empty"},idempotent:!0,headers:e.headers,signal:e.signal})},async listWhatsAppTemplates(e){return t.send({op:"ListWhatsAppTemplates",method:"GET",path:"/notify/templates/whatsapp",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async getWhatsAppTemplate(e){return t.send({op:"GetWhatsAppTemplate",method:"GET",path:"/notify/templates/whatsapp/"+s("GetWhatsAppTemplate","slug",e.path.slug)+"/"+s("GetWhatsAppTemplate","locale",e.path.locale),auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async putWhatsAppTemplate(e){return t.send({op:"PutWhatsAppTemplate",method:"PUT",path:"/notify/templates/whatsapp/"+s("PutWhatsAppTemplate","slug",e.path.slug)+"/"+s("PutWhatsAppTemplate","locale",e.path.locale),auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async deleteWhatsAppTemplate(e){return t.send({op:"DeleteWhatsAppTemplate",method:"DELETE",path:"/notify/templates/whatsapp/"+s("DeleteWhatsAppTemplate","slug",e.path.slug)+"/"+s("DeleteWhatsAppTemplate","locale",e.path.locale),auth:[["SecretKeyAuth"]],answers:{204:"empty"},idempotent:!0,headers:e.headers,signal:e.signal})},async listTopics(e){return t.send({op:"ListTopics",method:"GET",path:"/notify/topics",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async createTopic(e){return t.send({op:"CreateTopic",method:"POST",path:"/notify/topics",auth:[["SecretKeyAuth"]],answers:{201:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async deleteTopic(e){return t.send({op:"DeleteTopic",method:"DELETE",path:"/notify/topics/"+s("DeleteTopic","name",e.path.name),auth:[["SecretKeyAuth"]],answers:{204:"empty"},idempotent:!0,headers:e.headers,signal:e.signal})},async changeTopic(e){return t.send({op:"ChangeTopic",method:"PATCH",path:"/notify/topics/"+s("ChangeTopic","name",e.path.name),auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async addTopicSubscribers(e){return t.send({op:"AddTopicSubscribers",method:"POST",path:"/notify/topics/"+s("AddTopicSubscribers","name",e.path.name)+"/subscribers",auth:[["SecretKeyAuth"]],answers:{204:"empty"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async removeTopicSubscriber(e){return t.send({op:"RemoveTopicSubscriber",method:"DELETE",path:"/notify/topics/"+s("RemoveTopicSubscriber","name",e.path.name)+"/subscribers/"+s("RemoveTopicSubscriber","user_id",e.path.user_id),auth:[["SecretKeyAuth"]],answers:{204:"empty"},idempotent:!0,headers:e.headers,signal:e.signal})},async followTopic(e){return t.send({op:"FollowTopic",method:"POST",path:"/notify/topics/"+s("FollowTopic","name",e.path.name)+"/subscription",auth:[["ApiKeyAuth","userJWT"]],answers:{204:"empty"},idempotent:!0,headers:e.headers,signal:e.signal})},async unfollowTopic(e){return t.send({op:"UnfollowTopic",method:"DELETE",path:"/notify/topics/"+s("UnfollowTopic","name",e.path.name)+"/subscription",auth:[["ApiKeyAuth","userJWT"]],answers:{204:"empty"},idempotent:!0,headers:e.headers,signal:e.signal})},async listUserDevices(e){return t.send({op:"ListUserDevices",method:"GET",path:"/notify/users/"+s("ListUserDevices","user_id",e.path.user_id)+"/devices",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async getUserPreferences(e){return t.send({op:"GetUserPreferences",method:"GET",path:"/notify/users/"+s("GetUserPreferences","user_id",e.path.user_id)+"/preferences",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async setUserPreferences(e){return t.send({op:"SetUserPreferences",method:"PUT",path:"/notify/users/"+s("SetUserPreferences","user_id",e.path.user_id)+"/preferences",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async startVerification(e){return t.send({op:"StartVerification",method:"POST",path:"/notify/verifications",auth:[["SecretKeyAuth"]],answers:{202:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async checkVerification(e){return t.send({op:"CheckVerification",method:"POST",path:"/notify/verifications/check",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async receiveSendGridEvents(e){return t.send({op:"ReceiveSendGridEvents",method:"POST",path:"/notify/webhooks/email/sendgrid",auth:[],answers:{204:"empty"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async receiveTwilioStatus(e){return t.send({op:"ReceiveTwilioStatus",method:"POST",path:"/notify/webhooks/sms/twilio",auth:[],answers:{204:"empty"},body:{kind:"form",contentType:"application/x-www-form-urlencoded",value:e.body},signal:e.signal})},async receiveVonageReceiptQuery(e){return t.send({op:"ReceiveVonageReceiptQuery",method:"GET",path:"/notify/webhooks/sms/vonage",auth:[],answers:{204:"empty"},query:e?.query,signal:e?.signal})},async receiveVonageReceipt(e){return t.send({op:"ReceiveVonageReceipt",method:"POST",path:"/notify/webhooks/sms/vonage",auth:[],answers:{204:"empty"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async subscribeMetaWebhook(e){return t.send({op:"SubscribeMetaWebhook",method:"GET",path:"/notify/webhooks/whatsapp/meta",auth:[],answers:{200:"raw"},query:e.query,signal:e.signal})},async receiveMetaNotification(e){return t.send({op:"ReceiveMetaNotification",method:"POST",path:"/notify/webhooks/whatsapp/meta",auth:[],answers:{204:"empty"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async sendWhatsApp(e){return t.send({op:"SendWhatsApp",method:"POST",path:"/notify/whatsapp",auth:[["SecretKeyAuth"]],answers:{202:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async listWhatsAppInbound(e){return t.send({op:"ListWhatsAppInbound",method:"GET",path:"/notify/whatsapp/inbound",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})}}}var g={};n(g,{client:()=>v});function v(t){return{async getAppleAccount(e){return t.send({op:"GetAppleAccount",method:"GET",path:"/purchases/apple",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async disconnectApple(e){return t.send({op:"DisconnectApple",method:"DELETE",path:"/purchases/apple",auth:[["SecretKeyAuth"]],answers:{204:"empty"},idempotent:!0,headers:e?.headers,signal:e?.signal})},async getAppleAccountToken(e){return t.send({op:"GetAppleAccountToken",method:"POST",path:"/purchases/apple/account-token",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e?.signal})},async getAppleConnectPage(e){return t.send({op:"GetAppleConnectPage",method:"GET",path:"/purchases/apple/connect",auth:[],answers:{200:"raw"},signal:e?.signal})},async connectAppleKey(e){return t.send({op:"ConnectAppleKey",method:"POST",path:"/purchases/apple/connect",auth:[],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async createAppleGrant(e){return t.send({op:"CreateAppleGrant",method:"POST",path:"/purchases/apple/grants",auth:[["SecretKeyAuth"]],answers:{201:"json"},idempotent:!0,headers:e?.headers,signal:e?.signal})},async getAppleReadiness(e){return t.send({op:"GetAppleReadiness",method:"GET",path:"/purchases/apple/readiness",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async reportAppleTransactions(e){return t.send({op:"ReportAppleTransactions",method:"POST",path:"/purchases/apple/transactions",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async setXcodeCertificate(e){return t.send({op:"SetXcodeCertificate",method:"PUT",path:"/purchases/apple/xcode-certificate",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async clearXcodeCertificate(e){return t.send({op:"ClearXcodeCertificate",method:"DELETE",path:"/purchases/apple/xcode-certificate",auth:[["SecretKeyAuth"]],answers:{204:"empty"},idempotent:!0,headers:e?.headers,signal:e?.signal})},async getCatalog(e){return t.send({op:"GetCatalog",method:"GET",path:"/purchases/catalog",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async saveCatalog(e){return t.send({op:"SaveCatalog",method:"PUT",path:"/purchases/catalog",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async planCatalog(e){return t.send({op:"PlanCatalog",method:"POST",path:"/purchases/catalog/plans",auth:[["SecretKeyAuth"]],answers:{201:"json"},idempotent:!0,headers:e?.headers,signal:e?.signal})},async getCatalogPlan(e){return t.send({op:"GetCatalogPlan",method:"GET",path:"/purchases/catalog/plans/"+s("GetCatalogPlan","plan_id",e.path.plan_id),auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async confirmCatalogPlan(e){return t.send({op:"ConfirmCatalogPlan",method:"POST",path:"/purchases/catalog/plans/"+s("ConfirmCatalogPlan","plan_id",e.path.plan_id)+"/confirm",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async declineCatalogPlan(e){return t.send({op:"DeclineCatalogPlan",method:"POST",path:"/purchases/catalog/plans/"+s("DeclineCatalogPlan","plan_id",e.path.plan_id)+"/decline",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,signal:e.signal})},async validateCatalog(e){return t.send({op:"ValidateCatalog",method:"POST",path:"/purchases/catalog/validate",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async listCharts(e){return t.send({op:"ListCharts",method:"GET",path:"/purchases/charts",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async getChartsOverview(e){return t.send({op:"GetChartsOverview",method:"GET",path:"/purchases/charts/overview",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async getChart(e){return t.send({op:"GetChart",method:"GET",path:"/purchases/charts/"+s("GetChart","chart",e.path.chart),auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e.query,signal:e.signal})},async getStripeConnectPage(e){return t.send({op:"GetStripeConnectPage",method:"GET",path:"/purchases/connect",auth:[],answers:{200:"raw"},signal:e?.signal})},async connectStripeKey(e){return t.send({op:"ConnectStripeKey",method:"POST",path:"/purchases/connect",auth:[],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getCustomer(e){return t.send({op:"GetCustomer",method:"GET",path:"/purchases/customers/"+s("GetCustomer","customer_id",e.path.customer_id),auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async grantCredits(e){return t.send({op:"GrantCredits",method:"POST",path:"/purchases/customers/"+s("GrantCredits","customer_id",e.path.customer_id)+"/credits",auth:[["SecretKeyAuth"]],answers:{201:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async listCreditEntries(e){return t.send({op:"ListCreditEntries",method:"GET",path:"/purchases/customers/"+s("ListCreditEntries","customer_id",e.path.customer_id)+"/credits/entries",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e.query,signal:e.signal})},async forgiveCredits(e){return t.send({op:"ForgiveCredits",method:"POST",path:"/purchases/customers/"+s("ForgiveCredits","customer_id",e.path.customer_id)+"/credits/forgive",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async grantEntitlement(e){return t.send({op:"GrantEntitlement",method:"POST",path:"/purchases/customers/"+s("GrantEntitlement","customer_id",e.path.customer_id)+"/grants",auth:[["SecretKeyAuth"]],answers:{201:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async revokeGrant(e){return t.send({op:"RevokeGrant",method:"DELETE",path:"/purchases/customers/"+s("RevokeGrant","customer_id",e.path.customer_id)+"/grants/"+s("RevokeGrant","grant_id",e.path.grant_id),auth:[["SecretKeyAuth"]],answers:{204:"empty"},idempotent:!0,headers:e.headers,signal:e.signal})},async holdSpend(e){return t.send({op:"HoldSpend",method:"POST",path:"/purchases/customers/"+s("HoldSpend","customer_id",e.path.customer_id)+"/holds",auth:[["SecretKeyAuth"]],answers:{200:"json",201:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async setCustomerLimit(e){return t.send({op:"SetCustomerLimit",method:"PUT",path:"/purchases/customers/"+s("SetCustomerLimit","customer_id",e.path.customer_id)+"/limits/"+s("SetCustomerLimit","limit_key",e.path.limit_key),auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async clearCustomerLimit(e){return t.send({op:"ClearCustomerLimit",method:"DELETE",path:"/purchases/customers/"+s("ClearCustomerLimit","customer_id",e.path.customer_id)+"/limits/"+s("ClearCustomerLimit","limit_key",e.path.limit_key),auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,signal:e.signal})},async grantLimit(e){return t.send({op:"GrantLimit",method:"POST",path:"/purchases/customers/"+s("GrantLimit","customer_id",e.path.customer_id)+"/limits/"+s("GrantLimit","limit_key",e.path.limit_key)+"/grants",auth:[["SecretKeyAuth"]],answers:{200:"json",201:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async spend(e){return t.send({op:"Spend",method:"POST",path:"/purchases/customers/"+s("Spend","customer_id",e.path.customer_id)+"/spend",auth:[["SecretKeyAuth"]],answers:{200:"json",201:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async commitSpend(e){return t.send({op:"CommitSpend",method:"POST",path:"/purchases/customers/"+s("CommitSpend","customer_id",e.path.customer_id)+"/spends/"+s("CommitSpend","spend_id",e.path.spend_id)+"/commit",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async extendHold(e){return t.send({op:"ExtendHold",method:"POST",path:"/purchases/customers/"+s("ExtendHold","customer_id",e.path.customer_id)+"/spends/"+s("ExtendHold","spend_id",e.path.spend_id)+"/extend",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async releaseSpend(e){return t.send({op:"ReleaseSpend",method:"POST",path:"/purchases/customers/"+s("ReleaseSpend","customer_id",e.path.customer_id)+"/spends/"+s("ReleaseSpend","spend_id",e.path.spend_id)+"/release",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async reverseSpend(e){return t.send({op:"ReverseSpend",method:"POST",path:"/purchases/customers/"+s("ReverseSpend","customer_id",e.path.customer_id)+"/spends/"+s("ReverseSpend","spend_id",e.path.spend_id)+"/reverse",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async listExperiments(e){return t.send({op:"ListExperiments",method:"GET",path:"/purchases/experiments",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async startExperiment(e){return t.send({op:"StartExperiment",method:"POST",path:"/purchases/experiments",auth:[["SecretKeyAuth"]],answers:{201:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getExperiment(e){return t.send({op:"GetExperiment",method:"GET",path:"/purchases/experiments/"+s("GetExperiment","experiment_id",e.path.experiment_id),auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async getExperimentResults(e){return t.send({op:"GetExperimentResults",method:"GET",path:"/purchases/experiments/"+s("GetExperimentResults","experiment_id",e.path.experiment_id)+"/results",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e.query,signal:e.signal})},async stopExperiment(e){return t.send({op:"StopExperiment",method:"POST",path:"/purchases/experiments/"+s("StopExperiment","experiment_id",e.path.experiment_id)+"/stop",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,signal:e.signal})},async declareExperimentWinner(e){return t.send({op:"DeclareExperimentWinner",method:"POST",path:"/purchases/experiments/"+s("DeclareExperimentWinner","experiment_id",e.path.experiment_id)+"/winner",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getMyCustomerInfo(e){return t.send({op:"GetMyCustomerInfo",method:"GET",path:"/purchases/me",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},signal:e?.signal})},async mergeGuest(e){return t.send({op:"MergeGuest",method:"POST",path:"/purchases/me/merge",auth:[["ApiKeyAuth","userJWT"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async createMergeGrant(e){return t.send({op:"CreateMergeGrant",method:"POST",path:"/purchases/me/merge-grant",auth:[["ApiKeyAuth","userJWT"]],answers:{201:"json"},signal:e?.signal})},async getOfferings(e){return t.send({op:"GetOfferings",method:"GET",path:"/purchases/offerings",auth:[["ApiKeyAuth"],["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async listPaywalls(e){return t.send({op:"ListPaywalls",method:"GET",path:"/purchases/paywalls",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async createPaywall(e){return t.send({op:"CreatePaywall",method:"POST",path:"/purchases/paywalls",auth:[["SecretKeyAuth"]],answers:{201:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async listPaywallAssets(e){return t.send({op:"ListPaywallAssets",method:"GET",path:"/purchases/paywalls/assets",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async registerPaywallAsset(e){return t.send({op:"RegisterPaywallAsset",method:"POST",path:"/purchases/paywalls/assets",auth:[["SecretKeyAuth"]],answers:{201:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async deletePaywallAsset(e){return t.send({op:"DeletePaywallAsset",method:"DELETE",path:"/purchases/paywalls/assets/"+s("DeletePaywallAsset","asset_id",e.path.asset_id),auth:[["SecretKeyAuth"]],answers:{204:"empty"},idempotent:!0,headers:e.headers,signal:e.signal})},async listPaywallTemplates(e){return t.send({op:"ListPaywallTemplates",method:"GET",path:"/purchases/paywalls/templates",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async getPaywallTemplateAsset(e){return t.send({op:"GetPaywallTemplateAsset",method:"GET",path:"/purchases/paywalls/templates/"+s("GetPaywallTemplateAsset","key",e.path.key)+"/assets/"+s("GetPaywallTemplateAsset","asset_id",e.path.asset_id),auth:[["SecretKeyAuth"]],answers:{200:"raw",304:"empty"},headers:e.headers,signal:e.signal})},async validatePaywall(e){return t.send({op:"ValidatePaywall",method:"POST",path:"/purchases/paywalls/validate",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getPaywall(e){return t.send({op:"GetPaywall",method:"GET",path:"/purchases/paywalls/"+s("GetPaywall","paywall_id",e.path.paywall_id),auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async deletePaywall(e){return t.send({op:"DeletePaywall",method:"DELETE",path:"/purchases/paywalls/"+s("DeletePaywall","paywall_id",e.path.paywall_id),auth:[["SecretKeyAuth"]],answers:{204:"empty"},idempotent:!0,headers:e.headers,signal:e.signal})},async savePaywallDraft(e){return t.send({op:"SavePaywallDraft",method:"PUT",path:"/purchases/paywalls/"+s("SavePaywallDraft","paywall_id",e.path.paywall_id)+"/draft",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async publishPaywall(e){return t.send({op:"PublishPaywall",method:"POST",path:"/purchases/paywalls/"+s("PublishPaywall","paywall_id",e.path.paywall_id)+"/publish",auth:[["SecretKeyAuth"]],answers:{200:"json",201:"json"},idempotent:!0,headers:e.headers,signal:e.signal})},async listPaywallVersions(e){return t.send({op:"ListPaywallVersions",method:"GET",path:"/purchases/paywalls/"+s("ListPaywallVersions","paywall_id",e.path.paywall_id)+"/versions",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e.query,signal:e.signal})},async getPaywallVersion(e){return t.send({op:"GetPaywallVersion",method:"GET",path:"/purchases/paywalls/"+s("GetPaywallVersion","paywall_id",e.path.paywall_id)+"/versions/"+s("GetPaywallVersion","version",e.path.version),auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async listPlacements(e){return t.send({op:"ListPlacements",method:"GET",path:"/purchases/placements",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async listAttributeKeys(e){return t.send({op:"ListAttributeKeys",method:"GET",path:"/purchases/placements/attributes",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async setPlacement(e){return t.send({op:"SetPlacement",method:"PUT",path:"/purchases/placements/"+s("SetPlacement","placement",e.path.placement),auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async deletePlacement(e){return t.send({op:"DeletePlacement",method:"DELETE",path:"/purchases/placements/"+s("DeletePlacement","placement",e.path.placement),auth:[["SecretKeyAuth"]],answers:{204:"empty"},idempotent:!0,headers:e.headers,signal:e.signal})},async recordPaywallExposure(e){return t.send({op:"RecordPaywallExposure",method:"POST",path:"/purchases/placements/"+s("RecordPaywallExposure","placement",e.path.placement)+"/exposures",auth:[["ApiKeyAuth"],["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{204:"empty"},headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getPlacementPaywall(e){return t.send({op:"GetPlacementPaywall",method:"GET",path:"/purchases/placements/"+s("GetPlacementPaywall","placement",e.path.placement)+"/paywall",auth:[["ApiKeyAuth"],["ApiKeyAuth","userJWT"],["SecretKeyAuth"]],answers:{200:"json",204:"empty",304:"empty"},query:e.query,headers:e.headers,signal:e.signal})},async previewPlacement(e){return t.send({op:"PreviewPlacement",method:"POST",path:"/purchases/placements/"+s("PreviewPlacement","placement",e.path.placement)+"/resolve-preview",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getPlacementResults(e){return t.send({op:"GetPlacementResults",method:"GET",path:"/purchases/placements/"+s("GetPlacementResults","placement",e.path.placement)+"/results",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e.query,signal:e.signal})},async getPlacementRules(e){return t.send({op:"GetPlacementRules",method:"GET",path:"/purchases/placements/"+s("GetPlacementRules","placement",e.path.placement)+"/rules",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async setPlacementRules(e){return t.send({op:"SetPlacementRules",method:"PUT",path:"/purchases/placements/"+s("SetPlacementRules","placement",e.path.placement)+"/rules",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getSettings(e){return t.send({op:"GetSettings",method:"GET",path:"/purchases/settings",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async updateSettings(e){return t.send({op:"UpdateSettings",method:"PUT",path:"/purchases/settings",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getStripeAccount(e){return t.send({op:"GetStripeAccount",method:"GET",path:"/purchases/stripe",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async disconnectStripe(e){return t.send({op:"DisconnectStripe",method:"DELETE",path:"/purchases/stripe",auth:[["SecretKeyAuth"]],answers:{204:"empty"},idempotent:!0,headers:e?.headers,signal:e?.signal})},async checkStripeAccount(e){return t.send({op:"CheckStripeAccount",method:"POST",path:"/purchases/stripe/check",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e?.headers,signal:e?.signal})},async createCheckout(e){return t.send({op:"CreateCheckout",method:"POST",path:"/purchases/stripe/checkout",auth:[["ApiKeyAuth","userJWT"]],answers:{201:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async createStripeGrant(e){return t.send({op:"CreateStripeGrant",method:"POST",path:"/purchases/stripe/grants",auth:[["SecretKeyAuth"]],answers:{201:"json"},idempotent:!0,headers:e?.headers,signal:e?.signal})},async createPortalSession(e){return t.send({op:"CreatePortalSession",method:"POST",path:"/purchases/stripe/portal",auth:[["ApiKeyAuth","userJWT"]],answers:{201:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async receiveAppleNotification(e){return t.send({op:"ReceiveAppleNotification",method:"POST",path:"/purchases/webhooks/apple",auth:[],answers:{200:"empty"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async receiveStripeEvent(e){return t.send({op:"ReceiveStripeEvent",method:"POST",path:"/purchases/webhooks/stripe",auth:[],answers:{200:"empty"},headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})}}}var y={};n(y,{client:()=>w});function w(t){return{async broadcast(e){return t.send({op:"Broadcast",method:"POST",path:"/realtime/broadcast",auth:[["SecretKeyAuth"]],answers:{202:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getChannels(e){return t.send({op:"GetChannels",method:"GET",path:"/realtime/channels",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async putChannels(e){return t.send({op:"PutChannels",method:"PUT",path:"/realtime/channels",auth:[["SecretKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getLimits(e){return t.send({op:"GetLimits",method:"GET",path:"/realtime/limits",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async putLimits(e){return t.send({op:"PutLimits",method:"PUT",path:"/realtime/limits",auth:[["SecretKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async writeState(e){return t.send({op:"WriteState",method:"POST",path:"/realtime/state",auth:[["SecretKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getStats(e){return t.send({op:"GetStats",method:"GET",path:"/realtime/stats",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})}}}var u={};n(u,{client:()=>f});function f(t){return{async listSecretAudit(e){return t.send({op:"ListSecretAudit",method:"GET",path:"/secrets/audit",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async listSecrets(e){return t.send({op:"ListSecrets",method:"GET",path:"/secrets/"+s("ListSecrets","environment",e.path.environment),auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e.query,signal:e.signal})},async getEnvironmentValues(e){return t.send({op:"GetEnvironmentValues",method:"GET",path:"/secrets/"+s("GetEnvironmentValues","environment",e.path.environment)+"/values",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async getSecret(e){return t.send({op:"GetSecret",method:"GET",path:"/secrets/"+s("GetSecret","environment",e.path.environment)+"/"+s("GetSecret","name",e.path.name),auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async putSecret(e){return t.send({op:"PutSecret",method:"PUT",path:"/secrets/"+s("PutSecret","environment",e.path.environment)+"/"+s("PutSecret","name",e.path.name),auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async deleteSecret(e){return t.send({op:"DeleteSecret",method:"DELETE",path:"/secrets/"+s("DeleteSecret","environment",e.path.environment)+"/"+s("DeleteSecret","name",e.path.name),auth:[["SecretKeyAuth"]],answers:{204:"empty"},idempotent:!0,headers:e.headers,signal:e.signal})},async rollbackSecret(e){return t.send({op:"RollbackSecret",method:"POST",path:"/secrets/"+s("RollbackSecret","environment",e.path.environment)+"/"+s("RollbackSecret","name",e.path.name)+"/rollback",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async listSecretVersions(e){return t.send({op:"ListSecretVersions",method:"GET",path:"/secrets/"+s("ListSecretVersions","environment",e.path.environment)+"/"+s("ListSecretVersions","name",e.path.name)+"/versions",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e.query,signal:e.signal})}}}var c={};n(c,{client:()=>T});function T(t){return{async listBuckets(e){return t.send({op:"ListBuckets",method:"GET",path:"/storage/buckets",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async getBucket(e){return t.send({op:"GetBucket",method:"GET",path:"/storage/buckets/"+s("GetBucket","bucket",e.path.bucket),auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async putBucket(e){return t.send({op:"PutBucket",method:"PUT",path:"/storage/buckets/"+s("PutBucket","bucket",e.path.bucket),auth:[["SecretKeyAuth"]],answers:{200:"json",201:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async deleteBucket(e){return t.send({op:"DeleteBucket",method:"DELETE",path:"/storage/buckets/"+s("DeleteBucket","bucket",e.path.bucket),auth:[["SecretKeyAuth"]],answers:{204:"empty"},signal:e.signal})},async copyObject(e){return t.send({op:"CopyObject",method:"POST",path:"/storage/buckets/"+s("CopyObject","bucket",e.path.bucket)+"/copy",auth:[["SecretKeyAuth"]],answers:{201:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async moveObject(e){return t.send({op:"MoveObject",method:"POST",path:"/storage/buckets/"+s("MoveObject","bucket",e.path.bucket)+"/move",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async listObjects(e){return t.send({op:"ListObjects",method:"GET",path:"/storage/buckets/"+s("ListObjects","bucket",e.path.bucket)+"/objects",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e.query,signal:e.signal})},async getObject(e){return t.send({op:"GetObject",method:"GET",path:"/storage/buckets/"+s("GetObject","bucket",e.path.bucket)+"/objects/"+s("GetObject","path",e.path.path),auth:[["SecretKeyAuth"]],answers:{200:"raw",206:"raw",304:"empty"},query:e.query,headers:e.headers,signal:e.signal})},async putObject(e){return t.send({op:"PutObject",method:"PUT",path:"/storage/buckets/"+s("PutObject","bucket",e.path.bucket)+"/objects/"+s("PutObject","path",e.path.path),auth:[["SecretKeyAuth"]],answers:{200:"json",201:"json"},query:e.query,headers:e.headers,body:{kind:"raw",contentType:e.contentType??"application/octet-stream",value:e.body},signal:e.signal})},async deleteObject(e){return t.send({op:"DeleteObject",method:"DELETE",path:"/storage/buckets/"+s("DeleteObject","bucket",e.path.bucket)+"/objects/"+s("DeleteObject","path",e.path.path),auth:[["SecretKeyAuth"]],answers:{204:"empty"},signal:e.signal})},async headObject(e){return t.send({op:"HeadObject",method:"HEAD",path:"/storage/buckets/"+s("HeadObject","bucket",e.path.bucket)+"/objects/"+s("HeadObject","path",e.path.path),auth:[["SecretKeyAuth"]],answers:{200:"empty",304:"empty"},query:e.query,headers:e.headers,signal:e.signal})},async createSignedUrl(e){return t.send({op:"CreateSignedUrl",method:"POST",path:"/storage/buckets/"+s("CreateSignedUrl","bucket",e.path.bucket)+"/signed-urls",auth:[["SecretKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async createUploadUrl(e){return t.send({op:"CreateUploadUrl",method:"POST",path:"/storage/buckets/"+s("CreateUploadUrl","bucket",e.path.bucket)+"/upload-urls",auth:[["SecretKeyAuth"]],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getPublicObject(e){return t.send({op:"GetPublicObject",method:"GET",path:"/storage/public/"+s("GetPublicObject","bucket",e.path.bucket)+"/"+s("GetPublicObject","path",e.path.path),auth:[],answers:{200:"raw",206:"raw",304:"empty"},query:e.query,headers:e.headers,signal:e.signal})},async headPublicObject(e){return t.send({op:"HeadPublicObject",method:"HEAD",path:"/storage/public/"+s("HeadPublicObject","bucket",e.path.bucket)+"/"+s("HeadPublicObject","path",e.path.path),auth:[],answers:{200:"empty",304:"empty"},query:e.query,headers:e.headers,signal:e.signal})},async getSignedObject(e){return t.send({op:"GetSignedObject",method:"GET",path:"/storage/signed/"+s("GetSignedObject","bucket",e.path.bucket)+"/"+s("GetSignedObject","path",e.path.path),auth:[],answers:{200:"raw",206:"raw",304:"empty"},query:e.query,headers:e.headers,signal:e.signal})},async putSignedObject(e){return t.send({op:"PutSignedObject",method:"PUT",path:"/storage/signed/"+s("PutSignedObject","bucket",e.path.bucket)+"/"+s("PutSignedObject","path",e.path.path),auth:[],answers:{200:"json",201:"json"},query:e.query,headers:e.headers,body:{kind:"raw",contentType:e.contentType??"application/octet-stream",value:e.body},signal:e.signal})},async headSignedObject(e){return t.send({op:"HeadSignedObject",method:"HEAD",path:"/storage/signed/"+s("HeadSignedObject","bucket",e.path.bucket)+"/"+s("HeadSignedObject","path",e.path.path),auth:[],answers:{200:"empty",304:"empty"},query:e.query,headers:e.headers,signal:e.signal})},async getStorageStats(e){return t.send({op:"GetStorageStats",method:"GET",path:"/storage/stats",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async upload(e){return t.send({op:"Upload",method:"POST",path:"/storage/upload/"+s("Upload","machine",e.path.machine)+"/"+s("Upload","route",e.path.route),auth:[["ApiKeyAuth","userJWT"],["ApiKeyAuth"]],answers:{},body:{kind:"raw",contentType:e.contentType??"multipart/form-data",value:e.body},signal:e.signal})}}}var m={};n(m,{client:()=>k});function k(t){return{async listActions(e){return t.send({op:"ListActions",method:"GET",path:"/stores/actions",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async getAction(e){return t.send({op:"GetAction",method:"GET",path:"/stores/actions/"+s("GetAction","action_id",e.path.action_id),auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async confirmAction(e){return t.send({op:"ConfirmAction",method:"POST",path:"/stores/actions/"+s("ConfirmAction","action_id",e.path.action_id)+"/confirm",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async declineAction(e){return t.send({op:"DeclineAction",method:"POST",path:"/stores/actions/"+s("DeclineAction","action_id",e.path.action_id)+"/decline",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,signal:e.signal})},async getAppleAccount(e){return t.send({op:"GetAppleAccount",method:"GET",path:"/stores/apple",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async disconnectApple(e){return t.send({op:"DisconnectApple",method:"DELETE",path:"/stores/apple",auth:[["SecretKeyAuth"]],answers:{204:"empty"},idempotent:!0,headers:e?.headers,signal:e?.signal})},async checkAppleAccount(e){return t.send({op:"CheckAppleAccount",method:"POST",path:"/stores/apple/check",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e?.headers,signal:e?.signal})},async createAppleGrant(e){return t.send({op:"CreateAppleGrant",method:"POST",path:"/stores/apple/grants",auth:[["SecretKeyAuth"]],answers:{201:"json"},idempotent:!0,headers:e?.headers,signal:e?.signal})},async getSandboxReadiness(e){return t.send({op:"GetSandboxReadiness",method:"GET",path:"/stores/apple/readiness",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async listSandboxTesters(e){return t.send({op:"ListSandboxTesters",method:"GET",path:"/stores/apple/sandbox-testers",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async clearSandboxPurchaseHistory(e){return t.send({op:"ClearSandboxPurchaseHistory",method:"POST",path:"/stores/apple/sandbox-testers/clear-purchase-history",auth:[["SecretKeyAuth"]],answers:{202:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async updateSandboxTester(e){return t.send({op:"UpdateSandboxTester",method:"PATCH",path:"/stores/apple/sandbox-testers/"+s("UpdateSandboxTester","tester_id",e.path.tester_id),auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async listApps(e){return t.send({op:"ListApps",method:"GET",path:"/stores/apps",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e?.signal})},async listFeedback(e){return t.send({op:"ListFeedback",method:"GET",path:"/stores/apps/"+s("ListFeedback","app_id",e.path.app_id)+"/feedback",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async listGroups(e){return t.send({op:"ListGroups",method:"GET",path:"/stores/apps/"+s("ListGroups","app_id",e.path.app_id)+"/groups",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async createGroup(e){return t.send({op:"CreateGroup",method:"POST",path:"/stores/apps/"+s("CreateGroup","app_id",e.path.app_id)+"/groups",auth:[["SecretKeyAuth"]],answers:{201:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async linkApp(e){return t.send({op:"LinkApp",method:"POST",path:"/stores/apps/"+s("LinkApp","app_id",e.path.app_id)+"/link",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async createPackage(e){return t.send({op:"CreatePackage",method:"POST",path:"/stores/apps/"+s("CreatePackage","app_id",e.path.app_id)+"/packages",auth:[["SecretKeyAuth"]],answers:{200:"json",201:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getReviewInfo(e){return t.send({op:"GetReviewInfo",method:"GET",path:"/stores/apps/"+s("GetReviewInfo","app_id",e.path.app_id)+"/testflight/review-info",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e.query,signal:e.signal})},async setReviewInfo(e){return t.send({op:"SetReviewInfo",method:"PUT",path:"/stores/apps/"+s("SetReviewInfo","app_id",e.path.app_id)+"/testflight/review-info",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async getConnectPage(e){return t.send({op:"GetConnectPage",method:"GET",path:"/stores/connect",auth:[],answers:{200:"raw"},signal:e?.signal})},async connectAppleKey(e){return t.send({op:"ConnectAppleKey",method:"POST",path:"/stores/connect",auth:[],answers:{200:"json"},body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async deleteGroup(e){return t.send({op:"DeleteGroup",method:"DELETE",path:"/stores/groups/"+s("DeleteGroup","group_id",e.path.group_id),auth:[["SecretKeyAuth"]],answers:{204:"empty"},idempotent:!0,headers:e.headers,signal:e.signal})},async renameGroup(e){return t.send({op:"RenameGroup",method:"PATCH",path:"/stores/groups/"+s("RenameGroup","group_id",e.path.group_id),auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async addGroupBuild(e){return t.send({op:"AddGroupBuild",method:"POST",path:"/stores/groups/"+s("AddGroupBuild","group_id",e.path.group_id)+"/builds",auth:[["SecretKeyAuth"]],answers:{204:"empty"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async listTesters(e){return t.send({op:"ListTesters",method:"GET",path:"/stores/groups/"+s("ListTesters","group_id",e.path.group_id)+"/testers",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async setTesters(e){return t.send({op:"SetTesters",method:"PUT",path:"/stores/groups/"+s("SetTesters","group_id",e.path.group_id)+"/testers",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async listPackages(e){return t.send({op:"ListPackages",method:"GET",path:"/stores/packages",auth:[["SecretKeyAuth"]],answers:{200:"json"},query:e?.query,signal:e?.signal})},async getPackage(e){return t.send({op:"GetPackage",method:"GET",path:"/stores/packages/"+s("GetPackage","package_id",e.path.package_id),auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async uploadArtifact(e){return t.send({op:"UploadArtifact",method:"PUT",path:"/stores/packages/"+s("UploadArtifact","package_id",e.path.package_id)+"/artifact",auth:[],answers:{200:"json"},headers:e.headers,body:{kind:"raw",contentType:e.contentType??"application/octet-stream",value:e.body},signal:e.signal})},async planBetaReview(e){return t.send({op:"PlanBetaReview",method:"POST",path:"/stores/packages/"+s("PlanBetaReview","package_id",e.path.package_id)+"/beta-review",auth:[["SecretKeyAuth"]],answers:{201:"json"},idempotent:!0,headers:e.headers,signal:e.signal})},async listDeliveries(e){return t.send({op:"ListDeliveries",method:"GET",path:"/stores/packages/"+s("ListDeliveries","package_id",e.path.package_id)+"/deliveries",auth:[["SecretKeyAuth"]],answers:{200:"json"},signal:e.signal})},async deliver(e){return t.send({op:"Deliver",method:"POST",path:"/stores/packages/"+s("Deliver","package_id",e.path.package_id)+"/deliveries",auth:[["SecretKeyAuth"]],answers:{200:"json",202:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async planExpire(e){return t.send({op:"PlanExpire",method:"POST",path:"/stores/packages/"+s("PlanExpire","package_id",e.path.package_id)+"/expire",auth:[["SecretKeyAuth"]],answers:{201:"json"},idempotent:!0,headers:e.headers,signal:e.signal})},async planExportCompliance(e){return t.send({op:"PlanExportCompliance",method:"POST",path:"/stores/packages/"+s("PlanExportCompliance","package_id",e.path.package_id)+"/export-compliance",auth:[["SecretKeyAuth"]],answers:{201:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async setWhatToTest(e){return t.send({op:"SetWhatToTest",method:"PUT",path:"/stores/packages/"+s("SetWhatToTest","package_id",e.path.package_id)+"/what-to-test",auth:[["SecretKeyAuth"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})}}}export{a,r as b,i as c,o as d,l as e,p as f,d as g,g as h,y as i,u as j,c as k,m as l,x as m};
|
package/dist/chunks/ELEE7XO2.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/*! palbase 0.7.0 — Palbase SDK License (see LICENSE) */
|
|
2
|
-
import{a as J,c as pe,d as ue,e as me}from"./OIA7KLRW.js";import{a as fe}from"./KDSWK3XW.js";import{a as ie}from"./AIIKXCWN.js";import{a as de,b as ce,c as le}from"./ZBOJEH7K.js";import{b as O,d as se}from"./JS3TTUHS.js";async function*ge(e,t={}){let r=e.getReader(),n=new TextDecoder,o="",p="",c=[],f,a=()=>{r.cancel().catch(()=>{})};t.signal?.addEventListener("abort",a,{once:!0});try{if(t.signal?.aborted)return;for(;;){let{done:s,value:i}=await r.read();if(s||t.signal?.aborted)return;t.onBytes?.(),o+=n.decode(i,{stream:!0});for(let l=o.indexOf(`
|
|
3
|
-
`);l>=0;l=o.indexOf(`
|
|
4
|
-
`)){let h=o.slice(0,o[l-1]==="\r"?l-1:l);o=o.slice(l+1),h===""?(p!==""&&(yield f===void 0?{event:p,data:c.join(`
|
|
5
|
-
`)}:{event:p,data:c.join(`
|
|
6
|
-
`),id:f}),p="",c=[],f=void 0):h.startsWith("event:")?p=Z(h,6):h.startsWith("data:")?c.push(Z(h,5)):h.startsWith("id:")&&(f=Z(h,3))}}}finally{t.signal?.removeEventListener("abort",a);try{await r.cancel()}catch{}}}function Z(e,t){let r=e.slice(t);return r.startsWith(" ")?r.slice(1):r}var Be=/\s/;function z(e,t){for(;t<e.length&&Be.test(e[t]);)t++;return t}function he(e,t){let r="";for(let n=t+1;n<e.length;n++){let o=e[n];if(o==='"')return{value:r,complete:!0,empty:!1,at:n+1};if(o!=="\\"){r+=o;continue}let p=e[n+1];if(p===void 0)break;if(p==="u"){let c=e.slice(n+2,n+6);if(c.length<4)break;r+=String.fromCharCode(Number.parseInt(c,16)),n+=5;continue}r+={n:`
|
|
7
|
-
`,t:" ",r:"\r",b:"\b",f:"\f"}[p]??p,n++}return{value:r,complete:!1,empty:!1,at:e.length}}function Y(e,t){t=z(e,t);let r=e[t];if(r===void 0)return{value:void 0,complete:!1,empty:!0,at:t};if(r==='"')return he(e,t);if(r==="{")return De(e,t);if(r==="[")return Ne(e,t);let n=t;for(;n<e.length&&/[-+0-9.A-Za-z]/.test(e[n]);)n++;if(n===e.length)return{value:void 0,complete:!1,empty:!0,at:n};try{return{value:JSON.parse(e.slice(t,n)),complete:!0,empty:!1,at:n}}catch{return{value:void 0,complete:!1,empty:!0,at:e.length}}}function De(e,t){let r={},n=t+1;for(;;){if(n=z(e,n),e[n]==="}")return{value:r,complete:!0,empty:!1,at:n+1};if(e[n]===","){n++;continue}if(e[n]!=='"')return{value:r,complete:!1,empty:!1,at:e.length};let o=he(e,n);if(!o.complete)return{value:r,complete:!1,empty:!1,at:e.length};if(n=z(e,o.at),e[n]!==":")return{value:r,complete:!1,empty:!1,at:e.length};let p=Y(e,n+1);if(p.empty||Object.defineProperty(r,o.value,{value:p.value,enumerable:!0,writable:!0,configurable:!0}),!p.complete)return{value:r,complete:!1,empty:!1,at:e.length};n=p.at}}function Ne(e,t){let r=[],n=t+1;for(;;){if(n=z(e,n),e[n]==="]")return{value:r,complete:!0,empty:!1,at:n+1};if(e[n]===","){n++;continue}if(n>=e.length)return{value:r,complete:!1,empty:!1,at:n};let o=Y(e,n);if(o.empty||r.push(o.value),!o.complete)return{value:r,complete:!1,empty:!1,at:e.length};n=o.at}}function V(e){let t=Y(e,0);return t.empty?void 0:t.value}var b=class extends Error{path;constructor(t,r){super(`${t}: ${r}`),this.name="AISchemaError",this.path=t}},Ue=new Set(["type","properties","required","additionalProperties","items","enum","description","title","minimum","maximum","minLength","maxLength","minItems","maxItems"]),Je=new Set(["format","pattern","exclusiveMinimum","exclusiveMaximum","multipleOf","uniqueItems","contentEncoding","contentMediaType","default","examples","readOnly","writeOnly","deprecated","$comment"]),ze=new Set(["object","array","string","integer","number","boolean"]),ye=12,we=512,Le=/^[A-Za-z][A-Za-z0-9_-]{0,63}$/;function L(e,t="answer"){if(!Le.test(t))throw new b(t||"(name)","a schema name starts with a letter and holds letters, digits, _ and -, 64 at most");let r=e?.["~standard"];if(!r||r.version!==1||typeof r.validate!="function")throw new b(t,"not a Standard Schema: pass a zod (4.2+), valibot or arktype schema");if(!r.jsonSchema||typeof r.jsonSchema.output!="function")throw new b(t,`${r.vendor}'s schema cannot say itself as JSON Schema; use a version that implements Standard JSON Schema`);let n;try{n=r.jsonSchema.output({target:"draft-2020-12",libraryOptions:{unrepresentable:"throw"}})}catch(c){throw new b(t,`the schema has a part JSON Schema cannot say (${c.message}): a function, a transform, a date \u2014 give the model a string and convert it after`)}if(n.type!=="object")throw new b(t,"the answer is an object: wrap the value in z.object({ \u2026 })");let p=X(n,t,0,{properties:0});return{name:t,json:p,async check(c){let f=await r.validate(c);if(f.issues){let a=f.issues[0],s=(a?.path??[]).map(i=>String(typeof i=="object"?i.key:i)).join(".");throw new b(s?`${t}.${s}`:t,`the model's answer does not match the schema: ${a?.message??"invalid"}`)}return f.value}}}function X(e,t,r,n){if(r>ye)throw new b(t,`nests deeper than ${ye} levels, the most the provider takes`);for(let c of["anyOf","oneOf","allOf"])if(c in e)throw new b(t,qe(e[c])??"is a union of several shapes: the provider holds a model to one shape per field \u2014 use an enum, or one object with every field");for(let c of["$ref","$defs","definitions","$dynamicRef"])if(c in e)throw new b(t,"refers to another schema (a recursive or shared type): the provider takes no references \u2014 write the shape out, a bounded number of levels deep");if(e.type==="object"&&("propertyNames"in e||"patternProperties"in e||e.additionalProperties!==void 0&&e.additionalProperties!==!1))throw new b(t,"accepts fields it does not name (a record, passthrough or catchall): the provider holds a model only to the fields named \u2014 name them");for(let c of["prefixItems","patternProperties","propertyNames","not","if","then","else","dependentRequired","dependentSchemas","const","minProperties","maxProperties","contains","unevaluatedProperties","unevaluatedItems"])if(c in e)throw new b(t,`uses ${c}, which the provider cannot hold a model to`);if(Array.isArray(e.type))throw new b(t,`may be ${e.type.join(" or ")}: one type per field \u2014 a nullable field is not expressible; give it a value that means "none" (an empty string, an enum member)`);let o=e.type;if(typeof o!="string"&&!("enum"in e))throw new b(t,"has no type: the provider holds a model only to a typed value");if(typeof o=="string"&&!ze.has(o))throw new b(t,`is of type ${o}, which the provider does not take`);let p={};for(let[c,f]of Object.entries(e))if(!(c==="$schema"||c==="id"||c==="$id")&&!Je.has(c)){if(!Ue.has(c))throw new b(t,`uses ${c}, which the provider cannot hold a model to`);p[c]=f}if("enum"in e&&typeof o!="string"){let c=e.enum,f=new Set(c.map(a=>a===null?"null":typeof a));if(f.size!==1||f.has("null"))throw new b(t,"an enum of values of several types (or with null): one type per field");p.type=f.has("string")?"string":f.has("boolean")?"boolean":"number"}if(o==="object"){let c=e.properties??{},f=Object.keys(c);if(f.length===0)throw new b(t,"is an object with no fields (a record, or any object): the provider holds a model only to named fields \u2014 name them");if(e.additionalProperties!==void 0&&e.additionalProperties!==!1)throw new b(t,"accepts fields it does not name (passthrough, catchall, record): the provider holds a model only to the fields named");if(n.properties+=f.length,n.properties>we)throw new b(t,`the schema has more than ${we} fields in all, the most the provider takes`);let a=new Set(e.required??[]),s={};for(let i of f){if(!a.has(i))throw new b(`${t}.${i}`,'is optional: the provider makes the model write every field \u2014 make it required (give it a value that means "none"), or leave it out of the schema');s[i]=X(c[i],`${t}.${i}`,r+1,n)}p.properties=s,p.required=f,p.additionalProperties=!1}if(o==="array"){let c=e.items;if(!c||typeof c!="object"||Array.isArray(c))throw new b(t,"is a list with no one shape for its items: the provider takes a list of one shape");p.items=X(c,`${t}[]`,r+1,n)}return p}function qe(e){if(Array.isArray(e)&&e.length===2&&e.some(t=>t?.type==="null"))return'is nullable: the provider makes the model write a value of one type \u2014 drop .nullable() and give it a value that means "none"'}var Ge=new Set(["image/png","image/jpeg","image/webp","image/gif"]);function q(e){return Array.isArray(e)&&e.length>0&&e.every(be)?e.map(Se):be(e)?[Se(e)]:e==null?[{type:"text",text:""}]:typeof e=="string"?[{type:"text",text:e}]:[{type:"text",text:JSON.stringify(e)??String(e)}]}function be(e){if(typeof e!="object"||e===null)return!1;let t=e;return t.type==="text"?typeof t.text=="string":t.type==="image"?(typeof t.mediaType=="string"||typeof t.media_type=="string")&&(typeof t.data=="string"||t.data instanceof Uint8Array):t.type===void 0&&typeof t.mediaType=="string"&&t.bytes instanceof Uint8Array}function Se(e){if("type"in e&&e.type==="text")return{type:"text",text:e.text};let t="bytes"in e||"mediaType"in e?e.mediaType:e.media_type;if(!Ge.has(t))throw new TypeError(`a tool's picture is image/png, image/jpeg, image/webp or image/gif (got ${JSON.stringify(t)})`);let r="bytes"in e?e.bytes:e.data;return{type:"image",media_type:t,data:typeof r=="string"?r:Ke(r)}}function Ke(e){let t="";for(let r=0;r<e.length;r+=32768)t+=String.fromCharCode(...e.subarray(r,r+32768));return btoa(t)}var Fe=Symbol.for("palbase.ai.declared"),We=Symbol.for("palbase.ai.tool_error"),Q=class extends Error{constructor(t){super(t),this.name="ToolError",Object.defineProperty(this,We,{value:!0})}};function K(){let e=globalThis,t=e[Fe]??={tools:new Map,agents:new Map,repos:new Map,twice:new Set};return t.repos??=new Map,t}function ee(e,t,r,n){let o=e.get(r);o===void 0?e.set(r,n):o!==n&&K().twice.add(`${t}:${r}`)}var ke=/^[A-Za-z][A-Za-z0-9_-]{0,63}$/,R=/^[a-z][a-z0-9_-]{0,63}$/;function Te(e,t){if(e===void 0)return{type:"object",properties:{}};let r=e?.["~standard"];if(!r||r.version!==1||typeof r.validate!="function")throw new TypeError(`${t}: input is a Standard Schema \u2014 a zod (4.2+), valibot or arktype object schema`);if(!r.jsonSchema||typeof r.jsonSchema.output!="function")throw new TypeError(`${t}: ${r.vendor}'s schema cannot say itself as JSON Schema; use a version that implements Standard JSON Schema`);let n;try{n=r.jsonSchema.output({target:"draft-2020-12",libraryOptions:{unrepresentable:"throw"}})}catch(f){throw new TypeError(`${t}: the input has a part JSON Schema cannot say (${f.message}) \u2014 a function, a transform, a date: take a string and convert it in run`)}if(n.type!=="object")throw new TypeError(`${t}: a tool takes an object \u2014 wrap the input in z.object({ \u2026 })`);let o=JSON.stringify(n);if(/"\$(ref|defs|dynamicRef)"/.test(o))throw new TypeError(`${t}: the input refers to another schema (a recursive or shared type) \u2014 write the shape out`);let{$schema:p,...c}=n;return c}function xe(e){let t=`ai.tool(${JSON.stringify(e?.name??null)})`;if(typeof e?.name!="string"||!ke.test(e.name))throw new TypeError(`${t}: name is letters, digits, _ and -, starting with a letter, at most 64`);if(typeof e.description!="string"||e.description.trim()==="")throw new TypeError(`${t}: description says what it does \u2014 the agent reads it to choose`);if(typeof e.run!="function")throw new TypeError(`${t}: run(input, ctx) is what a call does`);if(e.machine!==void 0&&!R.test(e.machine))throw new TypeError(`${t}: machine is the name of one of the project's machines`);if(e.input===void 0)throw new TypeError(`${t}: input is what it takes \u2014 z.object({}) for nothing`);let r=Te(e.input,t),n=e.input["~standard"],o=e.run,p={source:"backend",name:e.name,description:e.description,input:e.input,parameters:r,approval:e.approval===!0,...e.machine!==void 0?{machine:e.machine}:{},async call(c,f){let a=await n.validate(c);if(a.issues){let s=a.issues[0],i=(s?.path??[]).map(l=>String(typeof l=="object"?l.key:l)).join(".");return{output:[{type:"text",text:`the input does not match ${e.name}'s schema${i?` at ${i}`:""}: ${s?.message??"invalid"}`}],is_error:!0}}return{output:q(await o(a.value,f)),is_error:!1}}};return Object.freeze(p),ee(K().tools,"tool",p.name,p),p}function Ae(e){let t=`ai.clientTool(${JSON.stringify(e?.name??null)})`;if(typeof e?.name!="string"||!ke.test(e.name))throw new TypeError(`${t}: name is letters, digits, _ and -, starting with a letter, at most 64`);if(typeof e.description!="string"||e.description.trim()==="")throw new TypeError(`${t}: description says what it does \u2014 the agent reads it to choose`);return Object.freeze({source:"client",name:e.name,description:e.description,parameters:Te(e.input,t),approval:e.approval===!0})}var He=/^[A-Za-z0-9_.-]{1,100}\/[A-Za-z0-9_.-]{1,100}$/;function ve(e){let t=e??{};if(typeof t.name!="string"||!R.test(t.name))throw new TypeError("ai.repo: name is lowercase letters, digits, _ and -, starting with a letter, at most 64");if(typeof t.repository!="string"||!He.test(t.repository))throw new TypeError(`ai.repo(${JSON.stringify(t.name)}): repository is a GitHub repository, owner/name`);if(typeof t.token!="function")throw new TypeError(`ai.repo(${JSON.stringify(t.name)}): token is the function that gives a token for one clone or push`);if(t.machine!==void 0&&!R.test(t.machine))throw new TypeError(`ai.repo(${JSON.stringify(t.name)}): machine is the project's machine that gives its tokens`);let r=t.token,n={kind:"repo",name:t.name,repository:t.repository,defaultBranch:t.defaultBranch??"main",...t.machine!==void 0?{machine:t.machine}:{},async token(o){return await r(o)}};return ee(K().repos,"repo",t.name,n),n}function Re(e,t,r={}){let n=`ai.agent(${JSON.stringify(e??null)})`;if(typeof e!="string"||!R.test(e))throw new TypeError(`${n}: name is lowercase letters, digits, _ and -, starting with a letter, at most 64`);if(typeof t!="function")throw new TypeError(`${n}: the agent is a function of the turn's context that returns its definition`);if(r.machine!==void 0&&!R.test(r.machine))throw new TypeError(`${n}: machine is the name of one of the project's machines`);let o={kind:"agent",name:e,...r.machine!==void 0?{machine:r.machine}:{},async resolve(p){let c=await t(p),f=F(c,`${n} for chat ${p.chatId}`);if(f.backend!==void 0)throw new TypeError(`${n}: a backend's agent is its definition \u2014 it names no other backend`);return{definition:f,tools:Ze(c)}}};return Object.freeze(o),ee(K().agents,"agent",e,o),o}function Ze(e){return[...e.tools??[],...(e.subagents??[]).flatMap(r=>r.tools??[])].filter(r=>r.source==="backend")}function G(e,t){if(typeof e!="object"||e===null)throw new TypeError(`${t}: a tool is ai.tool(\u2026), ai.clientTool(\u2026), { source: 'https', name } or { source: 'mcp', name }`);let r=e.approval===!0?{approval:!0}:{};switch(e.source){case"backend":if(typeof e.call!="function")throw new TypeError(`${t}: a backend tool is made with ai.tool({ name, description, input, run })`);return{source:"backend",name:e.name,description:e.description,parameters:e.parameters,...r,...e.machine!==void 0?{machine:e.machine}:{}};case"client":return{source:"client",name:e.name,description:e.description,parameters:e.parameters,...r};case"https":if(typeof e.name!="string"||!R.test(e.name))throw new TypeError(`${t}: { source: 'https', name } names an endpoint the project put`);return{source:"https",name:e.name,...r};case"mcp":if(typeof e.name!="string"||!R.test(e.name))throw new TypeError(`${t}: { source: 'mcp', name } names an MCP server the project put`);return{source:"mcp",name:e.name,...r,...e.only!==void 0?{only:[...e.only]}:{}};default:throw new TypeError(`${t}: a tool's source is backend, client, https or mcp (got ${JSON.stringify(e.source)})`)}}function F(e,t){if(typeof e!="object"||e===null)throw new TypeError(`${t}: a definition is { instructions, model, tools, subagents, maxToolCalls }`);let r={};return e.instructions!==void 0&&(r.instructions=e.instructions),e.model!==void 0&&(r.model=e.model),e.maxToolCalls!==void 0&&(r.max_tool_calls=e.maxToolCalls),e.tools!==void 0&&(r.tools=e.tools.map(n=>G(n,t))),e.subagents!==void 0&&(r.subagents=e.subagents.map(n=>({name:n.name,description:n.description,...n.instructions!==void 0?{instructions:n.instructions}:{},...n.model!==void 0?{model:n.model}:{},...n.required!==void 0?{required:n.required}:{},...n.tools!==void 0?{tools:n.tools.map(o=>G(o,`${t} subagent ${n.name}`))}:{}}))),r}function Pe(e,t){let r={approve:e};return t.reason!==void 0&&(r.reason=t.reason),t.as!==void 0&&(r.as=t.as),r}function Ee(){return"cm_"+crypto.randomUUID()}async function te(e,t,r=4){for(let n=1;;n++)try{return await e()}catch(o){if(n>=r||!(o instanceof O)||o.status===429||t?.aborted)throw o;let p=le(o,n,30);if(p===void 0)throw o;await new Promise((c,f)=>{let a=setTimeout(c,p*1e3);t?.addEventListener("abort",()=>(clearTimeout(a),f(t.reason)),{once:!0})})}}function _e(e){return{clients:e.clients,userMessagesPerMinute:e.user_messages_per_minute,historyLimitBytes:e.history_limit_bytes,historyBytes:e.history_bytes}}function Ye(e){return new Proxy(e,{get(t,r){let n=t[r];return typeof n=="function"?(...o)=>J(n.apply(t,o)):n}})}function Ce(e){let t=Ye(e),r={async create(a){let s=typeof a.agent=="object"&&a.agent!==null?a.agent.name:a.agent;if(s===void 0&&a.definition===void 0)throw new TypeError("chats.create: an agent (a named agent of the project) or a definition of the chat's own");let i={agent:s??"assistant"};return a.definition!==void 0&&(i.definition=F(a.definition,"chats.create")),a.title!==void 0&&(i.title=a.title),a.metadata!==void 0&&(i.metadata=a.metadata),a.members!==void 0&&(i.members=a.members.map(l=>({user_id:l.userId,...l.name!==void 0?{name:l.name}:{},...l.owner!==void 0?{owner:l.owner}:{}}))),a.workspace!==void 0&&(i.workspace={repos:a.workspace.repos.map(l=>({repo:typeof l.repo=="string"?l.repo:l.repo.name,...l.branch!==void 0?{branch:l.branch}:{}})),...a.workspace.autoPush!==void 0?{auto_push:a.workspace.autoPush}:{}}),(await t.createChat({body:i,signal:a.signal})).data},async get(a,s={}){return(await t.getChat({path:{chat_id:a},signal:s.signal})).data},async list(a={}){return(await t.listChats({query:{member:a.member},signal:a.signal})).data.chats},async delete(a){await t.deleteChat({path:{chat_id:a}})},members:{async put(a,s,i){let l={};return i.name!==void 0&&(l.name=i.name),i.owner!==void 0&&(l.owner=i.owner),(await t.putChatMember({path:{chat_id:a,user_id:s},body:l})).data},async delete(a,s){await t.deleteChatMember({path:{chat_id:a,user_id:s}})}},async send(a,s){let i={client_id:s.clientId??Ee(),text:s.text};return s.delivery!==void 0&&(i.delivery=s.delivery),s.as!==void 0&&(i.as=s.as),s.budget!==void 0&&(i.budget={max_cost_usd:s.budget.maxCostUsd}),te(async()=>(await t.sendChatMessage({path:{chat_id:a},body:i,signal:s.signal})).data,s.signal)},async turnCost(a,s,i={}){let l=(await t.getChatTurnCost({path:{chat_id:a,response_id:s},signal:i.signal})).data;return{chatId:l.chat_id,responseId:l.response_id,inputTokens:l.input_tokens,outputTokens:l.output_tokens,costNanoUsd:l.cost_nano_usd,unpriced:l.unpriced,final:l.final}},async artifacts(a,s,i={}){return(await t.listChatTurnArtifacts({path:{chat_id:a,response_id:s},signal:i.signal})).data.artifacts.map(h=>({id:h.id,mediaType:h.media_type,...h.logical_type?{logicalType:h.logical_type}:{},sizeBytes:h.size_bytes,checksum:h.checksum,createdAt:h.created_at}))},async artifact(a,s,i,l={}){return(await t.getChatTurnArtifact({path:{chat_id:a,response_id:s,artifact_id:i},signal:l.signal})).data},async messages(a,s={}){let i=(await t.listChatMessages({path:{chat_id:a},query:{limit:s.limit,cursor:s.cursor},signal:s.signal})).data;return i.next_cursor===void 0?{messages:i.messages}:{messages:i.messages,nextCursor:i.next_cursor}},events(a){if(typeof a!="string"||!/^chat_[0-9a-f]{32}$/.test(a))throw new TypeError(`chats.events(id): a chat's id, chat_ and 32 hex digits (got ${JSON.stringify(a)})`);return Object.freeze({kind:"ai.chat",chatId:a,async pipe(s,i={}){await t.putChatPipe({path:{chat_id:a},body:{topic:s},signal:i.signal})},async unpipe(s={}){await t.deleteChatPipe({path:{chat_id:a},signal:s.signal})}})},async stop(a){return(await t.stopChat({path:{chat_id:a}})).data.stopped},async approve(a,s,i={}){return(await t.decideChatApproval({path:{chat_id:a,approval_id:s},body:Pe(!0,i)})).data},async deny(a,s,i={}){return(await t.decideChatApproval({path:{chat_id:a,approval_id:s},body:Pe(!1,i)})).data},async answer(a,s,i,l={}){let h={output:q(i)};l.isError&&(h.is_error=!0),l.as!==void 0&&(h.as=l.as);try{return await te(()=>t.answerChatToolCall({path:{chat_id:a,call_id:s},body:h})),!0}catch(v){if(v instanceof O&&v.status===409)return!1;throw v}},async sendToSubagent(a,s,i,l={}){let h={client_id:l.clientId??Ee(),text:i};l.as!==void 0&&(h.as=l.as);let v=await te(async()=>(await t.sendSubagentMessage({path:{chat_id:a,run_id:s},body:h})).data);return{runId:v.run_id,clientId:v.client_id}}},n={async put(a,s){let i=typeof a=="string"?a:a.name,l=typeof a=="string"?s:a;if(typeof i!="string"||!R.test(i))throw new TypeError("agents.put: name is lowercase letters, digits, _ and -, starting with a letter, at most 64");if(l===void 0)throw new TypeError(`agents.put(${JSON.stringify(i)}): its definition, or a backend's ai.agent`);let h;if(l.kind==="agent"){let v=l;if(v.name!==i)throw new TypeError(`agents.put(${JSON.stringify(i)}): the backend's agent is named ${JSON.stringify(v.name)} \u2014 its machine is asked for it by that name`);h={backend:v.machine??"backend"}}else h=F(l,`agents.put(${JSON.stringify(i)})`);return(await t.putAgent({path:{name:i},body:h})).data},async list(){return(await t.listAgents({})).data.agents},async delete(a){await t.deleteAgent({path:{name:a}})}},o={async put(a,s){let i={kind:s.kind,url:s.url};return s.description!==void 0&&(i.description=s.description),s.parameters!==void 0&&(i.parameters=s.parameters),s.approval!==void 0&&(i.approval=s.approval),(await t.putEndpoint({path:{name:a},body:i})).data},async list(){return(await t.listEndpoints({})).data.endpoints},async delete(a){await t.deleteEndpoint({path:{name:a}})}},p={async get(){return _e((await t.getSettings({})).data)},async put(a){let s={};return a.clients!==void 0&&(s.clients=a.clients),a.userMessagesPerMinute!==void 0&&(s.user_messages_per_minute=a.userMessagesPerMinute),a.historyLimitBytes!==void 0&&(s.history_limit_bytes=a.historyLimitBytes),_e((await t.putSettings({body:s})).data)}},c=a=>({name:a.name,repository:a.repository,defaultBranch:a.default_branch,backend:a.backend,createdAt:a.created_at});return{chats:r,agents:n,endpoints:o,settings:p,repos:{async put(a,s){let i=typeof a=="string"?a:a.name;if(typeof i!="string"||!R.test(i))throw new TypeError("repos.put: name is lowercase letters, digits, _ and -, starting with a letter, at most 64");let l=typeof a=="string"?{repository:s?.repository??"",...s?.defaultBranch?{default_branch:s.defaultBranch}:{},...s?.backend?{backend:s.backend}:{}}:{repository:a.repository,default_branch:a.defaultBranch,...a.machine?{backend:a.machine}:{}};return c((await t.putRepo({path:{name:i},body:l})).data)},async list(){return(await t.listRepos({})).data.repos.map(c)},async delete(a){await t.deleteRepo({path:{name:a}})}}}}var Ve=/^pb_[a-z0-9]+_s/;function Ie(e){let t=globalThis;return t.process?.env?.[e]??t.Deno?.env?.get(e)}function ne(){return"ai_"+crypto.randomUUID()}function re(e){if(e.prepared)return e;let t=e;return{name:"answer",schema:t,prepared:L(t,"answer")}}var Oe=4,Xe=/^[a-z][a-z0-9-]{1,62}$/;function Qe(e){if(!Array.isArray(e))throw new TypeError("images is a list of { bucket, path } (a file of the project's storage) or { url } (an https address)");if(e.length>Oe)throw new TypeError(`a question takes ${Oe} pictures at most (got ${e.length})`);return e.map((t,r)=>{let n=t??{};if("data"in n||"bytes"in n||t instanceof Uint8Array)throw new TypeError(`images[${r}]: a picture is given where it is, not as its bytes \u2014 upload it to the project's storage (storage.from(bucket).upload(path, file)) and give { bucket, path }, or give { url }`);if(typeof n.url=="string"){if(n.bucket!==void 0||n.path!==void 0)throw new TypeError(`images[${r}] is { bucket, path } or { url }, not both`);let o;try{o=new URL(n.url)}catch{throw new TypeError(`images[${r}].url is not an address: ${JSON.stringify(n.url.slice(0,80))}`)}if(o.protocol!=="https:"||n.url.length>2048)throw new TypeError(`images[${r}].url is an https address of 2048 characters at most`);return{url:n.url}}if(typeof n.bucket!="string"||!Xe.test(n.bucket)||typeof n.path!="string"||n.path==="")throw new TypeError(`images[${r}] is { bucket, path } \u2014 a file of the project's storage \u2014 or { url }`);return{bucket:n.bucket,path:n.path}})}function W(e,t={},r){if(e.prompt===void 0&&e.messages===void 0)throw new TypeError("ask a model something: prompt, or messages");let n={...t};if(e.prompt!==void 0&&(n.input=e.prompt),e.messages!==void 0&&(n.messages=e.messages),e.instructions!==void 0&&(n.instructions=e.instructions),e.model!==void 0&&(n.model=e.model),e.metadata!==void 0&&(n.metadata=e.metadata),e.images!==void 0&&(n.images=Qe(e.images)),e.tools!==void 0&&(n.tools=e.tools.map((o,p)=>{if(o?.source==="client")throw new TypeError(`tools[${p}]: ${o.name} is a client tool \u2014 an app answers it, in a chat; a one-shot answer has no app to wait for`);let c=G(o,`tools[${p}]`);return c.source==="backend"&&c.machine===void 0&&r!==void 0&&(c.machine=r),c})),e.maxToolCalls!==void 0){if(!e.tools?.length)throw new TypeError("maxToolCalls bounds the calls of the tools given: give tools");if(!Number.isInteger(e.maxToolCalls)||e.maxToolCalls<1||e.maxToolCalls>200)throw new TypeError(`maxToolCalls is a whole number, 1 to 200 (got ${String(e.maxToolCalls)})`);n.max_tool_calls=e.maxToolCalls}return n}var I=class extends Error{code;response;constructor(t){super(t.error?.message??`the response ended ${t.status}`),this.name="AIResponseError",this.code=t.error?.code??t.status,this.response=t}};function et(e){let t=Uint8Array.from(atob(e),o=>o.charCodeAt(0)),r=new DataView(t.buffer,t.byteOffset,t.byteLength),n=new Array(t.byteLength/4);for(let o=0;o<n.length;o++)n[o]=r.getFloat32(o*4,!0);return n}async function $e(e){let t,r;e instanceof Uint8Array?(t=e,r=Me(t)):typeof Blob<"u"&&e instanceof Blob?(t=new Uint8Array(await e.arrayBuffer()),r=e.type||Me(t)):(t=e.bytes,r=e.mediaType);let n="";for(let o=0;o<t.length;o+=32768)n+=String.fromCharCode(...t.subarray(o,o+32768));return{media_type:r,data:btoa(n)}}function Me(e){return e[0]===137&&e[1]===80?"image/png":e[0]===255&&e[1]===216?"image/jpeg":e[8]===87&&e[9]===69&&e[10]===66&&e[11]===80?"image/webp":"application/octet-stream"}function tt(e){let t=e.url??Ie("PALBASE_URL"),r=e.secretKey??Ie("PALBASE_SECRET_KEY");if(typeof t!="string"||t==="")throw new TypeError("url is the project address (https://<ref>.<domain>) \u2014 or set PALBASE_URL");if(typeof r!="string"||!Ve.test(r))throw new TypeError("secretKey is the project secret key (pb_<ref>_s\u2026) \u2014 or set PALBASE_SECRET_KEY; a model call is billed to the project, so it is never made with a publishable key");let n=ce(se({baseUrl:t,credentials:{secretKey:r},fetch:e.fetch}),e.retry??de);return ie.client(n)}function nt(e){return new Proxy({},{get:(t,r)=>e.ai[r]})}function rt(e={}){if(fe())throw new TypeError("palbase/ai runs on a server: it speaks with the project secret key, which never goes into a browser or a mobile app \u2014 call your backend, and let it ask the model");if(e.machine!==void 0&&!R.test(e.machine))throw new TypeError("machine is the name of one of the project's machines");let t=e.server?nt(e.server):tt(e),r=e.resumeFor??12e4;async function n(d,u,g=ne()){return J(t.createResponse({headers:{"Idempotency-Key":g},body:d,signal:u}))}async function o(d,u={}){return(await t.getResponse({path:{response_id:d},signal:u.signal})).data}async function p(d,u,g,y,S){let k=0,x=d,P=ne(),M=()=>Date.now()+r,j=M();for(let B=0;;B++)try{if(x||(u===null?x=(await n({...S,stream:!0},y,P)).data:x=(await t.followResponse({path:{response_id:u},query:{offset:k},signal:y})).data),!x.body)throw new Error("the stream has no body");for await(let w of ge(x.body)){let A=JSON.parse(w.data);switch(w.event){case"response":u===null&&(u=A.id,g.admitted(A));break;case"delta":{let $=A.offset+pe(A.text);if($>k){let H=A.offset>=k?A.text:me(A.text,k-A.offset);g.delta(k,H),k=$}j=M();break}case"reset":A.offset<k&&(k=A.offset,g.reset(k));break;case"terminal":return A}}throw new Error("the stream ended before its answer did")}catch(w){if(x=null,y?.aborted||w instanceof O&&w.status>0&&w.status<500&&w.status!==429||u===null&&!(w instanceof O)||Date.now()>j)throw w;await new Promise(A=>setTimeout(A,Math.min(250*2**Math.min(B,4),4e3)))}}function c(d){if(d.status!=="completed")throw new I(d);return d.text??""}function f(d,u){let g=W(d,u?{schema:u.prepared.json,schema_name:u.name}:{},e.machine),y=[],S=!1,k,x=null,P=()=>{let m=x;x=null,m?.()},M,j,B=new Promise((m,T)=>{M=m,j=T});B.catch(()=>{});let w="",A=p(null,null,{admitted:m=>M(m.id),delta:(m,T)=>{w+=T,y.push(T),P()},reset:m=>{let T=ue(w,m);w=w.slice(0,T),y.push("\0reset:"+T),P()}},d.signal,g).then(m=>{let T=m.status==="completed"?m.text??"":"";return T.length>w.length&&T.startsWith(w)&&(y.push(T.slice(w.length)),w=T),S=!0,P(),m},m=>{throw S=!0,k=m,j(m),P(),m});A.catch(()=>{});async function*$(){for(let m=0;;m++){for(;m>=y.length;){if(S){if(k)throw k;return}await new Promise(T=>x=T)}yield y[m]}}async function*H(){for await(let m of $())m.startsWith("\0reset:")||(yield m)}async function*je(){let m="",T="";for await(let N of $()){N.startsWith("\0reset:")?m=m.slice(0,Number(N.slice(7))):m+=N;let _=V(m);if(_===void 0)continue;let C=JSON.stringify(_);C!==T&&(T=C,yield _)}}let D=A.then(m=>{if(m.status!=="completed")throw new I(m);return m});D.catch(()=>{});let ae=u?D.then(m=>u.prepared.check(m.output)):Promise.reject(new TypeError("object is a schema stream's"));ae.catch(()=>{});let oe=D.then(m=>m.text??w);return oe.catch(()=>{}),{id:B,response:D,text:oe,get textStream(){return H()},get partialObjectStream(){return je()},object:ae,toResponse(m={}){let T=new TextEncoder,N=new ReadableStream({async start(C){try{for await(let U of $())U.startsWith("\0reset:")?C.enqueue(T.encode(`event: reset
|
|
8
|
-
data: ${JSON.stringify({offset:Number(U.slice(7))})}
|
|
9
|
-
|
|
10
|
-
`)):C.enqueue(T.encode(`data: ${JSON.stringify({text:U})}
|
|
11
|
-
|
|
12
|
-
`));let E=await D;C.enqueue(T.encode(`event: done
|
|
13
|
-
data: ${JSON.stringify({id:E.id,text:E.text,output:E.output,usage:E.usage})}
|
|
14
|
-
|
|
15
|
-
`))}catch(E){let U=E instanceof I||E instanceof O?E.code:"stream_failed";C.enqueue(T.encode(`event: error
|
|
16
|
-
data: ${JSON.stringify({code:U})}
|
|
17
|
-
|
|
18
|
-
`))}finally{C.close()}}}),_=new Headers(m.headers);return _.set("content-type","text/event-stream"),_.set("cache-control","no-store"),_.set("x-accel-buffering","no"),new globalThis.Response(N,{...m,headers:_})}}}async function a(d,u){return p(null,null,{admitted:()=>{},delta:()=>{},reset:()=>{}},d.signal,W(d,u,e.machine))}let{chats:s,agents:i,endpoints:l,settings:h,repos:v}=Ce(t);return{module:t,chats:s,agents:i,endpoints:l,settings:h,repos:v,tool:xe,clientTool:Ae,agent:Re,repo:ve,async ask(d,u={}){let g=typeof d=="string"?{...u,prompt:d}:d;return c(await a(g,{}))},async generate(d){let u=re(d.schema),g={schema:u.prepared.json,schema_name:u.name};if(d.background){let k=(await n(W(d,{...g,background:!0},e.machine),d.signal)).data;return{id:k.id,status:k.status}}let y=await a(d,g);if(y.status!=="completed")throw new I(y);return u.prepared.check(y.output)},stream(d){return f(d,d.schema?re(d.schema):void 0)},async start(d){let u=(await n(W(d,{background:!0},e.machine),d.signal)).data;return{id:u.id,status:u.status}},schema(d,u){return{name:d,schema:u,prepared:L(u,d)}},response:o,async result(d,u){let g=re(u),y=await o(d);if(y.status!=="completed")throw new I(y);return g.prepared.check(y.output)},async cancel(d){return(await t.cancelResponse({path:{response_id:d}})).data},async embed(d,u={}){let g=Array.isArray(d)?d:[d],y=[];for(let S=0;S<g.length;S+=1024){let k=await t.createEmbeddings({body:{input:g.slice(S,S+1024),model:u.model,dimensions:u.dimensions},signal:u.signal});for(let x of k.data.vectors)y.push(et(x))}return Array.isArray(d)?y:y[0]},async image(d){let u={prompt:d.prompt};for(let S of["model","size","quality","background","format","count"])d[S]!==void 0&&(u[S]=d[S]);d.references?.length&&(u.references=await Promise.all(d.references.map($e))),d.mask&&(u.mask=await $e(d.mask));let g=(await t.createImage({headers:{"Idempotency-Key":ne()},body:u,signal:d.signal})).data;for(let S=0;g.status==="running";S++){if(await new Promise(k=>setTimeout(k,Math.min(500+S*250,3e3))),d.signal?.aborted)throw d.signal.reason;g=(await t.getImage({path:{image_id:g.id},signal:d.signal})).data}if(g.status!=="completed")throw new Error(`the image failed: ${g.error?.code??"image_failed"}: ${g.error?.message??""}`);let y=await Promise.all(g.files.map(async S=>{let x=(await t.getImageFile({path:{image_id:g.id,position:S.position},signal:d.signal})).data;return{mediaType:S.media_type,bytes:new Uint8Array(await x.arrayBuffer())}}));return{id:g.id,model:g.model,pictures:y,costNanoUSD:g.usage?.cost_nano_usd??0,save(S,k,x=0){let P=y[x];if(!P)throw new RangeError(`the job made ${y.length} picture(s)`);return S.upload(k,P.bytes,{contentType:P.mediaType})}}},async models(){return(await t.listModels({})).data},async usage(d={}){let u=(await t.listUsage({query:{kind:d.kind,limit:d.limit,cursor:d.cursor}})).data;return{usage:u.usage,nextCursor:u.next_cursor}},async connectProvider(d,u){return(await t.connectProvider({path:{provider:d},body:{key:u}})).data},async disconnectProvider(d){await t.disconnectProvider({path:{provider:d}})}}}export{V as a,b,L as c,Q as d,I as e,rt as f};
|
package/dist/chunks/G7E26S3Y.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/*! palbase 0.7.0 — Palbase SDK License (see LICENSE) */
|
|
2
|
-
import{b as M,d as x}from"./OIA7KLRW.js";import{d as P}from"./ZBOJEH7K.js";import{a as b,b as D,e as $}from"./JS3TTUHS.js";var p=class extends Error{kind;code;status;requestId;fields;retryAfter;data;constructor(e,n){super(n.message,n.cause===void 0?void 0:{cause:n.cause}),this.name="BackendError",this.kind=e,this.code=n.code,this.status=n.status??0,this.requestId=n.requestId,this.fields=n.fields,this.retryAfter=n.retryAfter,this.data=n.data}};function q(t){return t instanceof p||typeof t=="object"&&t!==null&&t.name==="BackendError"&&typeof t.kind=="string"}function T(t){let e=t.body,n={code:t.code,message:t.message,status:t.status,requestId:t.requestId??ge(e,"request_id"),data:k(e,"data"),cause:t};if(t.code==="network_error")return new p("network",n);if(t.status===401)return new p("unauthorized",n);if(t.status===429)return new p("rateLimited",{...n,retryAfter:fe(e)??t.retryAfter});let r=le(e);return t.status===400&&r?new p("validation",{...n,fields:r}):new p("server",n)}function I(t){return t instanceof D||t instanceof Error&&t.name==="PalbaseError"}function J(t){return Array.isArray(t)&&t.length>0&&t.every(e=>typeof e=="object"&&e!==null&&typeof e.field=="string"&&typeof e.message=="string")}function le(t){let e=k(k(t,"data"),"fields");if(J(e))return e;let n=k(t,"fields");return J(n)?n:void 0}function fe(t){return B(t,"retry_after")??B(k(t,"data"),"retryAfter")}function k(t,e){if(typeof t=="object"&&t!==null)return t[e]}function B(t,e){let n=k(t,e);return typeof n=="number"?n:void 0}function ge(t,e){let n=k(t,e);return typeof n=="string"?n:void 0}var he=/^[A-Za-z_$][A-Za-z0-9_$]*$/,ye=Object.freeze(["adoptSession","analytics","appContext","appVersion","auth","callOnSignOut","cancelCallOnSignOut","configuration","consent","currentSession","flags","installation","module","moduleDirectory","notify","onSessionChange","onSignOut","preferences","realtime","scope","send","socket","storage","storedUserId","telemetry","transport","version","palbe","data","stores","purchases","messaging","notifications","perf","debug","equals","hashCode","toString","self","Type","init","deinit","subscript","then","constructor","__proto__"]),me=new Set(ye),we=new Set(["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf","__proto__","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"]);function R(t){return t==="then"||t==="toJSON"||we.has(t)}function K(t){return t==="call"||t==="join"||R(t)}function U(t){return typeof t=="string"&&he.test(t)&&!me.has(t)&&!R(t)}function L(t){return typeof t=="string"&&/^[a-z][a-z0-9-]{0,62}$/.test(t)}function F(t){$(t)}function W(t){return $(t).origin}var C=class{me;messages=new Map;responses=new Map;order=[];turn=null;calls=new Map;listeners=new Set;enders=new Set;snapshot;told=!1;ended=!1;constructor(e=()=>{}){this.me=e}get state(){return this.snapshot??=this.build()}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}async*[Symbol.asyncIterator](){let e,n,r=this.subscribe(()=>e?.()),s=()=>e?.();this.enders.add(s);try{for(;;){let o=this.state;if(o!==n){n=o,yield o;continue}if(this.ended)return;await new Promise(a=>e=a)}}finally{r(),this.enders.delete(s)}}end(){if(!this.ended){this.ended=!0;for(let e of[...this.enders])e()}}takePayload(e){let n=M(e);n&&this.take(n)}take(e){if(!this.ended){switch(e.type){case"message":this.heard(e.message);return;case"turn":{let n=this.response(e.response_id);n.status=e.status,n.waiting=e.waiting,n.error=e.error,e.user_id!==void 0&&(n.startedBy=e.user_id),this.turn=e;break}case"text":{let n=this.response(e.response_id);n.text=n.text.slice(0,x(n.text,e.offset))+e.text;break}case"reset":{let n=this.response(e.response_id);n.text=n.text.slice(0,x(n.text,e.offset));break}case"tool":{this.response(typeof e.agent_response_id=="string"&&e.agent_response_id!==""?e.agent_response_id:e.response_id).marks.set(`tool:${e.call_id}`,e),this.calls.set(e.call_id,e);break}case"agent":{if(this.response(e.parent_response_id).marks.set(e.run_id?`agent:${e.run_id}`:`agent:seq:${e.seq}`,e),!e.response_id)break;let n=this.response(e.response_id);if(n.runId=e.run_id,n.agent=e.name,n.parentId===null){n.parentId=e.parent_response_id;let r=this.order.findIndex(s=>s.type==="response"&&s.key===e.response_id);r>=0&&this.order.splice(r,1)}break}}this.changed()}}heard(e){let n=ve(e),r=this.messages.get(n),s=e.status==="delivered"||e.status==="failed"?e.status:"pending";this.messages.set(n,{clientId:e.client_id,id:e.id??r?.id??null,text:e.text,author:e.author??null,authorName:e.author_name??"",delivery:e.delivery??"next",status:r?.status==="delivered"?"delivered":s,error:e.error??null,responseId:e.response_id??r?.responseId??null,createdAt:e.created_at??r?.createdAt??"",mine:!1}),r||this.place(e,n),this.changed()}place(e,n){let r=e.response_id??null,o=r!==null&&![...this.messages.entries()].some(([a,i])=>a!==n&&i.responseId===r)?this.order.findIndex(a=>a.type==="response"&&a.key===r):-1;o>=0?this.order.splice(o,0,{type:"message",key:n}):this.order.push({type:"message",key:n})}response(e){let n=this.responses.get(e);return n||(n={id:e,status:null,waiting:null,error:null,text:"",marks:new Map,runId:null,agent:null,parentId:null,startedBy:void 0},this.responses.set(e,n),this.order.push({type:"response",key:e})),n}changed(){this.snapshot=void 0,!this.told&&(this.told=!0,queueMicrotask(()=>{this.told=!1;let e=this.state;for(let n of[...this.listeners])try{n(e)}catch{}}))}build(){let e=this.me(),n=d=>e!==void 0&&d.startedBy===e,r=new Map;for(let d of this.responses.values()){let u=d.parentId!==null?this.responses.get(d.parentId)??d:d;r.set(d.id,be(d,u.startedBy??null,n(u)))}let s=new Map([...this.messages].map(([d,u])=>[d,e!==void 0&&u.author===e?{...u,mine:!0}:u])),o=[...s.values()],a=[];for(let d of this.order)d.type==="message"?a.push({type:"message",message:s.get(d.key)}):this.responses.get(d.key).parentId===null&&a.push({type:"response",response:r.get(d.key)});let i=[...this.calls.values()].filter(d=>r.get(d.response_id)?.mine===!0);return{items:a,messages:o,responses:[...r.values()],turn:this.turn,waiting:{approvals:i.filter(d=>d.status==="awaiting_approval"),outputs:i.filter(d=>d.status==="awaiting_output")}}}};function ve(t){return`${t.author??""}\0${t.client_id}`}function be(t,e,n){let r=[...t.marks.values()].map((a,i)=>({m:a,i,at:x(t.text,Math.max(0,Number(a.text_offset)||0))}));r.sort((a,i)=>a.at-i.at||a.i-i.i);let s=[],o=0;for(let{m:a,at:i}of r)i>o&&s.push({type:"text",text:t.text.slice(o,i)}),o=Math.max(o,i),s.push(a.type==="tool"?{type:"tool",tool:a}:{type:"agent",agent:a});return o<t.text.length&&s.push({type:"text",text:t.text.slice(o)}),{id:t.id,status:t.status,waiting:t.waiting,error:t.error,text:t.text,parts:s,runId:t.runId,agent:t.agent,parentId:t.parentId,startedBy:e,mine:n}}var O=class extends Error{reason;constructor(e,n){super(e),this.name="GatewayError",this.reason=n}},z=new WeakMap;async function V(t,e,n,r={},s=()=>{}){let{pattern:o,events:a,messages:i,durable:d,chat:u}=ke(e),l=Ee(o,n),h=z.get(t);h||z.set(t,h=new Map);let E=h,g=E.get(l)??{count:0};E.set(l,g),g.count++;let f=t.channel(l,d&&r.history!==!1?{after:0}:{});if(u&&!g.chat){let c=new C(s);g.chat=c,g.unchat=f.on("broadcast",w=>{w.event==="chat"&&c.takePayload(w.payload)})}let v=()=>{--g.count>0||(E.delete(l),g.unchat?.(),g.chat?.end(),f.leave())};try{await f.join()}catch{let c=f.state==="refused"?H(f.refusal,"unavailable"):"socket closed";throw v(),new O(`gateway ${JSON.stringify(l)} was not joined: ${c}`,c)}let S=!1,_=new Set,j=()=>{if(!S){S=!0,ue();for(let c of[..._])c();v()}},ue=f.onClosed(j),A=c=>{if(S)return()=>{};let w=f.on("broadcast",m=>{typeof m.event=="string"&&a.has(m.event)&&c(m.event,b(m.payload))}),y=()=>{_.delete(y),w()};return _.add(y),y},G={topic:l,get seq(){return f.logSeq},on(c,w){if(typeof c=="function")return A((y,m)=>c({event:y,payload:m}));if(!a.has(c))throw new TypeError(`gateway ${JSON.stringify(o)} declares no event ${JSON.stringify(String(c))}`);if(typeof w!="function")throw new TypeError(`gateway ${JSON.stringify(o)}: on(${JSON.stringify(c)}, \u2026) takes the function the event is handed to`);return A((y,m)=>{y===c&&w(m)})},off(c){_.has(c)&&c()},async send(c,w){if(!i.has(c))throw new TypeError(`gateway ${JSON.stringify(o)} declares no message ${JSON.stringify(String(c))}`);let y=S?{status:"error",response:{reason:"not joined"}}:await f.push("broadcast",{type:"broadcast",event:c,payload:w});if(y.status==="ok")return b(y.response.reply);let m=H(y.response,"unavailable");throw new O(`gateway ${JSON.stringify(l)} did not take ${JSON.stringify(c)}: ${m}`,m)},leave:j};return u&&Object.defineProperty(G,"chat",{value:g.chat,enumerable:!0}),G}function ke(t){let e=typeof t=="object"&&t!==null?t:{},n=r=>Array.isArray(r)&&r.every(s=>typeof s=="string");if(typeof e.pattern!="string"||e.pattern===""||!n(e.events)||!n(e.messages))throw new TypeError("join takes a gateway of the backend's generated module: its pattern, its events and its messages");return{pattern:e.pattern,events:new Set(e.events),messages:new Set(e.messages),durable:e.durable===!0,chat:e.chat===!0}}function Ee(t,e){let n=typeof e=="object"&&e!==null?e:{};return t.split(":").map(r=>{if(!(r.startsWith("{")&&r.endsWith("}")&&r.length>2))return r;let s=r.slice(1,-1),o=Object.hasOwn(n,s)?n[s]:void 0;if(typeof o!="string"||o==="")throw new TypeError(`gateway ${JSON.stringify(t)} needs a value for ${JSON.stringify(s)}`);if(o.includes(":"))throw new TypeError(`gateway ${JSON.stringify(t)}: the value of ${JSON.stringify(s)} is one segment of the channel's name and cannot hold ":"`);return o}).join(":")}function H(t,e){let n=t?.reason;return typeof n=="string"&&n!==""?n:e}var N=class{pending="";dataLines=[];eventName;consume(e){this.pending+=e.replace(/\r\n/g,`
|
|
3
|
-
`);let n=[],r=this.pending.indexOf(`
|
|
4
|
-
`);for(;r!==-1;){let s=this.pending.slice(0,r);this.pending=this.pending.slice(r+1);let o=s.endsWith("\r")?s.slice(0,-1):s;if(o==="")this.dataLines.length>0&&n.push({event:this.eventName,payload:this.dataLines.join(`
|
|
5
|
-
`)}),this.dataLines=[],this.eventName=void 0;else if(!o.startsWith(":")){if(o.startsWith("data:")){let a=o.slice(5);this.dataLines.push(a.startsWith(" ")?a.slice(1):a)}else if(o.startsWith("event:")){let a=o.slice(6);this.eventName=a.startsWith(" ")?a.slice(1):a}}r=this.pending.indexOf(`
|
|
6
|
-
`)}return n}};async function*Q(t,e){let n=t.getReader(),r=new TextDecoder,s=new N;try{for(;;){let{done:o,value:a}=await n.read();if(o)break;for(let i of s.consume(r.decode(a,{stream:!0}))){if(i.event==="error")throw new p("network",{code:"stream_failed",message:`stream failed: ${i.payload}`});let d;try{d=JSON.parse(i.payload)}catch{throw new p("decode",{code:"invalid_frame",message:`stream frame is not valid JSON: ${i.payload.slice(0,120)}`})}yield b(d)}}}finally{e.abort();try{await n.cancel()}catch{}}}var Se={},Z=new WeakMap;function tt(t,e,n,r,s,o=()=>{}){Z.set(t,{project:e,machine:n,storage:r,socket:s,me:o})}var X=new Map,Y=new WeakMap;function nt(t,e,n,r,s){if(!U(e))throw new p("validation",{code:"reserved_namespace",message:`Cannot register backend ${JSON.stringify(String(e))}: a backend's name is an identifier the client does not keep.`});let o=W(t);if(!L(n))throw new TypeError(`${JSON.stringify(String(n))} is not a machine's name: a lowercase letter, then lowercase letters, digits and -`);F(r),ne(s);for(let a of Object.keys(s))if(K(a))throw ee(a);(X.get(e)??_e(e)).set(o,{machine:n,url:r,tree:s})}function _e(t){let e=new Map;return X.set(t,e),Object.defineProperty(Se,t,{configurable:!0,get(){return xe(this,t,e)}}),e}function xe(t,e,n){let r=Z.get(t);if(!r)return;let s=n.get(r.project);if(!s)throw new TypeError(`pb.${e} is the backend of ${[...n.keys()].join(" and ")}: this client is ${r.project}'s, and its user's session never goes to another project's machine`);let o=Y.get(t);o||Y.set(t,o=new Map);let a=o.get(e);if(a?.registration===s)return a.ns;let i={machine:()=>r.machine(s.url),storage:r.storage,name:s.machine},d=Object.assign({call:(u,l,h)=>Ie(i.machine,u,l,h),join:(u,l,h)=>V(r.socket,u,l,h,r.me)},re(s.tree,i));return o.set(e,{registration:s,ns:d}),d}function ee(t){return new p("validation",{code:"reserved_namespace",message:`Cannot register endpoint namespace ${JSON.stringify(t)}: the name is reserved.`})}function te(t){return typeof t.path=="string"&&typeof t.method=="string"}function Re(t,e){if(t.pathParams!==void 0){if(!Array.isArray(t.pathParams)||!t.pathParams.every(n=>typeof n=="string"))throw new p("validation",{code:"invalid_namespace_tree",message:`Descriptor '${e}': pathParams must be an array of strings.`});for(let n of t.pathParams)if(!t.path.includes(`{${n}}`))throw new p("validation",{code:"invalid_namespace_tree",message:`Descriptor '${e}': pathParams entry '${n}' has no '{${n}}' placeholder in the path.`})}if(t.sse!==void 0&&typeof t.sse!="boolean")throw new p("validation",{code:"invalid_namespace_tree",message:`Descriptor '${e}': sse must be a boolean.`});if(t.idempotent!==void 0&&typeof t.idempotent!="boolean")throw new p("validation",{code:"invalid_namespace_tree",message:`Descriptor '${e}': idempotent must be a boolean.`});if(t.upload!==void 0&&typeof t.upload!="boolean")throw new p("validation",{code:"invalid_namespace_tree",message:`Descriptor '${e}': upload must be a boolean.`});if(t.upload===!0&&(t.method!=="POST"||t.sse===!0))throw new p("validation",{code:"invalid_namespace_tree",message:`Descriptor '${e}': an upload endpoint is a POST, and no stream.`});if(t.sse===!0&&t.input==="query")throw new p("validation",{code:"invalid_namespace_tree",message:`Descriptor '${e}': an sse endpoint cannot take query input.`});if(t.input!==void 0&&t.input!=="body"&&t.input!=="query"&&t.input!=="none")throw new p("validation",{code:"invalid_namespace_tree",message:`Descriptor '${e}': input must be 'body', 'query' or 'none'.`});if(t.errors!==void 0){for(let[n,r]of Object.entries(t.errors))if(typeof r!="function")throw new p("validation",{code:"invalid_namespace_tree",message:`Descriptor '${e}': errors['${n}'] must be a function.`})}}function ne(t){if(typeof t!="object"||t===null)throw new p("validation",{code:"invalid_namespace_tree",message:"Namespace tree nodes must be plain objects."});let e=Object.getPrototypeOf(t);if(e!==Object.prototype&&e!==null)throw new p("validation",{code:"invalid_namespace_tree",message:"Namespace tree nodes must be plain objects."});for(let[n,r]of Object.entries(t)){if(R(n))throw ee(n);typeof r=="object"&&r!==null&&te(r)?(r.method=r.method.toUpperCase(),Re(r,r.path)):ne(r)}}function re(t,e){if(te(t))return t.upload===!0?async(...r)=>Pe(e,t,r):async(...r)=>ae(e.machine(),t,r);let n={};for(let[r,s]of Object.entries(t))n[r]=re(s,e);return n}function se(t){if(t==null)return"";let e=Object.entries(t).filter(([,r])=>r!=null).sort(([r],[s])=>r<s?-1:r>s?1:0);return e.length===0?"":`?${e.map(([r,s])=>{if(typeof s!="string"&&typeof s!="number"&&typeof s!="boolean")throw new p("validation",{code:"invalid_query_value",message:`Query parameter '${r}' must be a string, number, or boolean.`});return`${encodeURIComponent(r)}=${encodeURIComponent(String(s))}`}).join("&")}`}function Ce(t,e,n){let r=String(n);if(r===""||r==="."||r==="..")throw new p("validation",{code:"invalid_path_parameter",message:`${t.path}: path parameter '${e}' cannot be ${r===""?"empty":JSON.stringify(r)}`});return encodeURIComponent(r)}function oe(t,e){let n=t.pathParams??[],r=t.path;for(let s=0;s<n.length;s++){let o=e[s];if(typeof o!="string"&&typeof o!="number")throw new p("validation",{code:"missing_path_param",message:`${t.path}: path parameter '${n[s]}' must be a string or number`});r=r.replace(`{${n[s]}}`,Ce(t,n[s],o))}return r}var Oe=new Set(["POST","PUT","PATCH","DELETE"]);async function ae(t,e,n){let r=e.pathParams??[],s=oe(e,n);if(e.input==="none"&&n.length>r.length+1)throw new p("validation",{code:"unexpected_argument",message:`${e.path}: endpoint takes no input \u2014 pass only path params and options`});let o=e.input==="none"?void 0:n[r.length],a=e.input==="none"?r.length:r.length+1,i=n[a],d;if(e.input==="query")s+=se(o);else if(e.input!=="none")if(e.method==="GET"){if(o!==void 0)throw new p("validation",{code:"unsupported_get_input",message:`${e.path}: GET endpoints take no body input`})}else d=o;let u={...i?.headers};Oe.has(e.method)&&!Object.keys(u).some(l=>l.toLowerCase()==="idempotency-key")&&(u["Idempotency-Key"]=P());try{return e.sse===!0?await Ae(t,e,s,d,u,i?.signal):await je(t,e,s,d,u,i?.signal)}catch(l){throw ie(e,l)}}function ie(t,e){return t.errors&&q(e)&&Object.hasOwn(t.errors,e.code)?t.errors[e.code](e):e}var $e=[["ApiKeyAuth","userJWT"],["ApiKeyAuth"]];async function Pe(t,e,n){let r=e.pathParams??[],s=oe(e,n),o=e.input==="none"?r.length:r.length+1;if(n.length>o+2)throw new p("validation",{code:"unexpected_argument",message:`${e.path}: an upload takes its path params, ${e.input==="none"?"":"its input, "}the file and options`});let a=e.input==="none"?void 0:n[r.length],i=n[o],d=n[o+1];if(!(i instanceof Blob))throw new p("validation",{code:"invalid_file",message:`${e.path}: the file is a Blob (a File is one)`});let u=`/storage/upload/${t.name}/${encodeURIComponent(s.slice(1))}`;e.input==="query"&&(u+=se(a));let l=Te(e.input==="query"?void 0:a,i),h=l.body.size,E=0,g=f=>{E=f;try{d?.onProgress?.({loaded:f,total:h})}catch{}};d?.onProgress&&g(0);try{let f;try{let v={op:`Upload ${e.path}`,method:"POST",path:u,auth:$e,answers:de,body:{kind:"raw",contentType:l.type,value:l.body},signal:d?.signal,...d?.onProgress?{onUploadProgress:S=>g(S)}:{}};f=(await t.storage.send(v)).data}catch(v){throw I(v)?T(v):v}return d?.onProgress&&E<h&&g(h),await ce(e,f,d?.signal)}catch(f){throw ie(e,f)}}function Te(t,e){let n=`Palbase-${P()}`,r=i=>i.replaceAll('"',"_").replace(/[\r\n]/g,""),s=typeof e.name=="string"?e.name:"blob",o=(i,d)=>`--${n}\r
|
|
7
|
-
Content-Disposition: form-data; ${i}\r
|
|
8
|
-
Content-Type: ${d}\r
|
|
9
|
-
\r
|
|
10
|
-
`,a=[];return t!==void 0&&a.push(o('name="body"',"application/json"),JSON.stringify(t),`\r
|
|
11
|
-
`),a.push(o(`name="file"; filename="${r(s)}"`,r(e.type)||"application/octet-stream"),e,`\r
|
|
12
|
-
--${n}--\r
|
|
13
|
-
`),{body:new Blob(a),type:`multipart/form-data; boundary=${n}`}}async function Ie(t,e,n,r){if(typeof e!="string"||e===""||e==="/")throw new p("validation",{code:"invalid_endpoint_name",message:'Endpoint name must be a non-empty path like "todos/create"'});let s=e.startsWith("/")?e:`/${e}`;return ae(t(),{method:"POST",path:s},[n,r])}var de=Object.fromEntries(Array.from({length:100},(t,e)=>[200+e,"raw"])),Ne=[["userJWT"],[]];async function pe(t,e,n,r,s,o){let a={op:`${e.method} ${e.path}`,method:e.method,path:n,auth:Ne,answers:de,headers:s,...r===void 0?{}:{body:{kind:"json",contentType:"application/json",value:r}},idempotent:e.idempotent===!0,signal:o};try{return(await t.send(a)).data}catch(i){throw I(i)?T(i):i}}async function je(t,e,n,r,s,o){return ce(e,await pe(t,e,n,r,s,o),o)}async function ce(t,e,n){let r=e.headers.get("x-request-id")??void 0,s;try{s=await e.text()}catch(o){throw n?.aborted?o:new p("network",{code:"network_error",message:`${t.method} ${t.path}: the answer did not arrive whole`,status:e.status,requestId:r,cause:o})}if(s!=="")try{return b(JSON.parse(s))}catch(o){throw new p("decode",{code:"invalid_json",message:`${t.method} ${t.path}: the answer is not JSON`,status:e.status,requestId:r,cause:o})}}async function Ae(t,e,n,r,s,o){let a=new AbortController;o&&(o.aborted?a.abort():o.addEventListener("abort",()=>a.abort(),{once:!0}));let i=await pe(t,e,n,r,{accept:"text/event-stream",...s},a.signal);if(!i.body)throw new p("network",{code:"empty_stream",message:"the server answered a streaming route with no body",status:i.status});return Q(i.body,a)}export{p as a,q as b,ye as c,U as d,O as e,Se as f,tt as g,nt as h};
|