@botpress/client 0.0.13 → 0.1.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/bundle.cjs +6 -6
- package/dist/bundle.cjs.map +4 -4
- package/dist/gen/api.d.ts +583 -197
- package/dist/gen/base.d.ts +1 -1
- package/dist/gen/common.d.ts +1 -1
- package/dist/gen/configuration.d.ts +1 -1
- package/dist/gen/index.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +1 -1
- package/openapi.ts +5 -0
- package/package.json +13 -10
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import ue from"axios";import*as Qt from"axios";import{isBrowser as W,isNode as K}from"browser-or-node";var $="https://api.botpress.cloud",Y="BP_API_URL",Z="BP_BOT_ID",X="BP_INTEGRATION_ID",ee="BP_WORKSPACE_ID",te="BP_TOKEN";function J(r){let t=se(r),e={};return t.workspaceId&&(e["x-workspace-id"]=t.workspaceId),t.botId&&(e["x-bot-id"]=t.botId),t.integrationId&&(e["x-integration-id"]=t.integrationId),t.token&&(e.Authorization=`Bearer ${t.token}`),{host:t.host??$,withCredentials:W,headers:e}}function se(r){return W?r:K?ae(r):r}function ae(r){let t={...r,host:r.host??process.env[Y]??$,botId:r.botId??process.env[Z],integrationId:r.integrationId??process.env[X],workspaceId:r.workspaceId??process.env[ee]},e=t.token??process.env[te];return e&&(t.token=e),t}var m=class extends Error{constructor(e,s,n,a,o){super(a);this.code=e;this.description=s;this.type=n;this.message=a;this.error=o}isApiError=!0;toJSON(){return{code:this.code,type:this.type,message:this.message}}},re=r=>typeof r=="object"&&!Array.isArray(r)&&r!==null,ne=r=>r instanceof m||re(r)&&r.isApiError===!0,B=class extends m{constructor(t,e){super(500,"An unknown error occurred","Unknown",t,e)}},O=class extends m{constructor(t,e){super(500,"An internal error occurred","Internal",t,e)}},V=class extends m{constructor(t,e){super(401,"The request requires to be authenticated.","Unauthorized",t,e)}},D=class extends m{constructor(t,e){super(403,"The requested action can't be peform by this resource.","Forbidden",t,e)}},T=class extends m{constructor(t,e){super(413,"The request payload is too large.","PayloadTooLarge",t,e)}},E=class extends m{constructor(t,e){super(400,"The request payload is invalid.","InvalidPayload",t,e)}},M=class extends m{constructor(t,e){super(415,"The request is invalid because the content-type is not supported.","UnsupportedMediaType",t,e)}},w=class extends m{constructor(t,e){super(405,"The requested method does not exist.","MethodNotFound",t,e)}},S=class extends m{constructor(t,e){super(404,"The requested resource does not exist.","ResourceNotFound",t,e)}},L=class extends m{constructor(t,e){super(400,"The provided JSON schema is invalid.","InvalidJsonSchema",t,e)}},G=class extends m{constructor(t,e){super(400,"The provided data doesn't respect the provided JSON schema.","InvalidDataFormat",t,e)}},F=class extends m{constructor(t,e){super(400,"The provided identifier is not valid. An identifier must start with a lowercase letter, be between 2 and 100 characters long and use only alphanumeric characters.","InvalidIdentifier",t,e)}},k=class extends m{constructor(t,e){super(409,"The resource is not related with another resource. This is usually caused when providing two resources that aren't linked together.","RelationConflict",t,e)}},_=class extends m{constructor(t,e){super(400,"The provided resource reference is missing. This is usually caused when providing an invalid id inside the payload of a request.","ReferenceNotFound",t,e)}},N=class extends m{constructor(t,e){super(400,"The provided query is invalid. This is usually caused when providing an invalid parameter for querying a resource.","InvalidQuery",t,e)}},j=class extends m{constructor(t,e){super(400,"An error happened during the execution of a runtime (bot or integration).","Runtime",t,e)}},oe={Unknown:B,Internal:O,Unauthorized:V,Forbidden:D,PayloadTooLarge:T,InvalidPayload:E,UnsupportedMediaType:M,MethodNotFound:w,ResourceNotFound:S,InvalidJsonSchema:L,InvalidDataFormat:G,InvalidIdentifier:F,RelationConflict:k,ReferenceNotFound:_,InvalidQuery:N,Runtime:j},Q=r=>ne(r)?r:r instanceof Error?new B(r.message,r):r===null?new B("An unknown error occurred"):typeof r=="string"?new B(r):typeof r!="object"?new B("An unknown error occurred"):ie(r);function ie(r){if("code"in r&&"type"in r&&"message"in r){if(typeof r.message!="string")return new B("An unknown error occurred");if(typeof r.type!="string")return new B(r.message);let t=oe[r.type];return t?new t(r.message):new B(r.message)}return new B("An unknown error occurred")}import pe from"axios";import A from"axios";import le from"axios";var u="https://api.botpress.cloud".replace(/\/+$/,"");var b=class{constructor(t,e=u,s=le){this.basePath=e;this.axios=s;t&&(this.configuration=t,this.basePath=t.basePath||this.basePath)}configuration},q=class extends Error{constructor(e,s){super(s);this.field=e;this.name="RequiredError"}};var g="https://example.com",C=function(r,t,e){if(e==null)throw new q(t,`Required parameter ${t} was null or undefined when calling ${r}.`)};function H(r,t,e=""){t!=null&&(typeof t=="object"?Array.isArray(t)?t.forEach(s=>H(r,s,e)):Object.keys(t).forEach(s=>H(r,t[s],`${e}${e!==""?".":""}${s}`)):r.has(e)?r.append(e,t):r.set(e,t))}var d=function(r,...t){let e=new URLSearchParams(r.search);H(e,t),r.search=e.toString()},x=function(r,t,e){let s=typeof r!="string";return(s&&e&&e.isJsonMime?e.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(r!==void 0?r:{}):r||""},h=function(r){return r.pathname+r.search+r.hash},y=function(r,t,e,s){return(n=t,a=e)=>{let o={...r.options,url:(s?.basePath||a)+r.url};return n.request(o)}};var ce=function(r){return{callAction:async(t,e={})=>{let s="/v1/chat/actions",n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"POST",...a,...e},i={},c={};i["Content-Type"]="application/json",d(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},o.data=x(t,o,r),{url:h(n),options:o}},configureIntegration:async(t,e={})=>{let s="/v1/chat/integrations/configure",n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"POST",...a,...e},i={},c={};i["Content-Type"]="application/json",d(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},o.data=x(t,o,r),{url:h(n),options:o}},createBot:async(t,e={})=>{let s="/v1/admin/bots",n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"POST",...a,...e},i={},c={};i["Content-Type"]="application/json",d(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},o.data=x(t,o,r),{url:h(n),options:o}},createConversation:async(t,e={})=>{let s="/v1/chat/conversations",n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"POST",...a,...e},i={},c={};i["Content-Type"]="application/json",d(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},o.data=x(t,o,r),{url:h(n),options:o}},createEvent:async(t,e={})=>{let s="/v1/chat/events",n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"POST",...a,...e},i={},c={};i["Content-Type"]="application/json",d(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},o.data=x(t,o,r),{url:h(n),options:o}},createFile:async(t,e={})=>{let s="/v1/storage/files",n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"POST",...a,...e},i={},c={};i["Content-Type"]="application/json",d(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},o.data=x(t,o,r),{url:h(n),options:o}},createIntegration:async(t,e={})=>{let s="/v1/admin/integrations",n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"POST",...a,...e},i={},c={};i["Content-Type"]="application/json",d(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},o.data=x(t,o,r),{url:h(n),options:o}},createMessage:async(t,e={})=>{let s="/v1/chat/messages",n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"POST",...a,...e},i={},c={};i["Content-Type"]="application/json",d(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},o.data=x(t,o,r),{url:h(n),options:o}},createUser:async(t,e={})=>{let s="/v1/chat/users",n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"POST",...a,...e},i={},c={};i["Content-Type"]="application/json",d(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},o.data=x(t,o,r),{url:h(n),options:o}},deleteBot:async(t,e={})=>{C("deleteBot","id",t);let s="/v1/admin/bots/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"DELETE",...a,...e},i={};d(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:h(n),options:o}},deleteConversation:async(t,e={})=>{C("deleteConversation","id",t);let s="/v1/chat/conversations/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"DELETE",...a,...e},i={};d(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:h(n),options:o}},deleteFile:async(t,e={})=>{C("deleteFile","id",t);let s="/v1/storage/files/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"DELETE",...a,...e},i={};d(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:h(n),options:o}},deleteIntegration:async(t,e={})=>{C("deleteIntegration","id",t);let s="/v1/admin/integrations/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"DELETE",...a,...e},i={};d(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:h(n),options:o}},deleteMessage:async(t,e={})=>{C("deleteMessage","id",t);let s="/v1/chat/messages/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"DELETE",...a,...e},i={};d(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:h(n),options:o}},deleteUser:async(t,e={})=>{C("deleteUser","id",t);let s="/v1/chat/users/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"DELETE",...a,...e},i={};d(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:h(n),options:o}},downloadFile:async(t,e={})=>{C("downloadFile","id",t);let s="/v1/storage/files/{id}/download".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"GET",...a,...e},i={};d(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:h(n),options:o}},getBot:async(t,e={})=>{C("getBot","id",t);let s="/v1/admin/bots/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"GET",...a,...e},i={};d(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:h(n),options:o}},getBotAnalytics:async(t,e,s,n={})=>{C("getBotAnalytics","id",t),C("getBotAnalytics","startDate",e),C("getBotAnalytics","endDate",s);let a="/v1/admin/bots/{id}/analytics".replace("{id}",encodeURIComponent(String(t))),o=new URL(a,g),i;r&&(i=r.baseOptions);let c={method:"GET",...i,...n},l={},p={};e!==void 0&&(p.startDate=e),s!==void 0&&(p.endDate=s),d(o,p);let P=i&&i.headers?i.headers:{};return c.headers={...l,...P,...n.headers},{url:h(o),options:c}},getBotLogs:async(t,e={})=>{C("getBotLogs","id",t);let s="/v1/admin/bots/{id}/logs".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"GET",...a,...e},i={};d(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:h(n),options:o}},getBotWebchat:async(t,e,s={})=>{C("getBotWebchat","id",t),C("getBotWebchat","type",e);let n="/v1/admin/bots/{id}/webchat".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,g),o;r&&(o=r.baseOptions);let i={method:"GET",...o,...s},c={},l={};e!==void 0&&(l.type=e),d(a,l);let p=o&&o.headers?o.headers:{};return i.headers={...c,...p,...s.headers},{url:h(a),options:i}},getConversation:async(t,e={})=>{C("getConversation","id",t);let s="/v1/chat/conversations/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"GET",...a,...e},i={};d(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:h(n),options:o}},getEvent:async(t,e={})=>{C("getEvent","id",t);let s="/v1/chat/events/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"GET",...a,...e},i={};d(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:h(n),options:o}},getFile:async(t,e={})=>{C("getFile","id",t);let s="/v1/storage/files/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"GET",...a,...e},i={};d(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:h(n),options:o}},getIntegration:async(t,e={})=>{C("getIntegration","id",t);let s="/v1/admin/integrations/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"GET",...a,...e},i={};d(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:h(n),options:o}},getIntegrationByName:async(t,e,s={})=>{C("getIntegrationByName","name",t),C("getIntegrationByName","version",e);let n="/v1/admin/integrations/{name}/{version}".replace("{name}",encodeURIComponent(String(t))).replace("{version}",encodeURIComponent(String(e))),a=new URL(n,g),o;r&&(o=r.baseOptions);let i={method:"GET",...o,...s},c={};d(a,{});let p=o&&o.headers?o.headers:{};return i.headers={...c,...p,...s.headers},{url:h(a),options:i}},getIntegrationLogs:async(t,e={})=>{C("getIntegrationLogs","id",t);let s="/v1/admin/integrations/{id}/logs".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"GET",...a,...e},i={};d(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:h(n),options:o}},getMessage:async(t,e={})=>{C("getMessage","id",t);let s="/v1/chat/messages/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"GET",...a,...e},i={};d(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:h(n),options:o}},getOrCreateConversation:async(t,e={})=>{let s="/v1/chat/conversations/get-or-create",n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"POST",...a,...e},i={},c={};i["Content-Type"]="application/json",d(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},o.data=x(t,o,r),{url:h(n),options:o}},getOrCreateMessage:async(t,e={})=>{let s="/v1/chat/messages/get-or-create",n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"POST",...a,...e},i={},c={};i["Content-Type"]="application/json",d(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},o.data=x(t,o,r),{url:h(n),options:o}},getOrCreateUser:async(t,e={})=>{let s="/v1/chat/users/get-or-create",n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"POST",...a,...e},i={},c={};i["Content-Type"]="application/json",d(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},o.data=x(t,o,r),{url:h(n),options:o}},getPublicIntegration:async(t,e,s={})=>{C("getPublicIntegration","name",t),C("getPublicIntegration","version",e);let n="/v1/admin/hub/integrations/{name}/{version}".replace("{name}",encodeURIComponent(String(t))).replace("{version}",encodeURIComponent(String(e))),a=new URL(n,g),o;r&&(o=r.baseOptions);let i={method:"GET",...o,...s},c={};d(a,{});let p=o&&o.headers?o.headers:{};return i.headers={...c,...p,...s.headers},{url:h(a),options:i}},getPublicIntegrationById:async(t,e={})=>{C("getPublicIntegrationById","id",t);let s="/v1/admin/hub/integrations/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"GET",...a,...e},i={};d(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:h(n),options:o}},getState:async(t,e,s,n={})=>{C("getState","type",t),C("getState","id",e),C("getState","name",s);let a="/v1/chat/states/{type}/{id}/{name}".replace("{type}",encodeURIComponent(String(t))).replace("{id}",encodeURIComponent(String(e))).replace("{name}",encodeURIComponent(String(s))),o=new URL(a,g),i;r&&(i=r.baseOptions);let c={method:"GET",...i,...n},l={};d(o,{});let P=i&&i.headers?i.headers:{};return c.headers={...l,...P,...n.headers},{url:h(o),options:c}},getUser:async(t,e={})=>{C("getUser","id",t);let s="/v1/chat/users/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"GET",...a,...e},i={};d(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:h(n),options:o}},getWorkspace:async(t,e={})=>{C("getWorkspace","id",t);let s="/v1/admin/workspaces/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"GET",...a,...e},i={};d(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:h(n),options:o}},introspect:async(t,e={})=>{let s="/v1/admin/introspect",n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"POST",...a,...e},i={},c={};i["Content-Type"]="application/json",d(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},o.data=x(t,o,r),{url:h(n),options:o}},listBots:async(t,e={})=>{let s="/v1/admin/bots",n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"GET",...a,...e},i={},c={};t!==void 0&&(c.nextToken=t),d(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:h(n),options:o}},listConversations:async(t,e,s,n={})=>{let a="/v1/chat/conversations",o=new URL(a,g),i;r&&(i=r.baseOptions);let c={method:"GET",...i,...n},l={},p={};t!==void 0&&(p.nextToken=t),e!==void 0&&(p.tags=e),s&&(p.participantIds=s),d(o,p);let P=i&&i.headers?i.headers:{};return c.headers={...l,...P,...n.headers},{url:h(o),options:c}},listEvents:async(t,e,s={})=>{let n="/v1/chat/events",a=new URL(n,g),o;r&&(o=r.baseOptions);let i={method:"GET",...o,...s},c={},l={};t!==void 0&&(l.nextToken=t),e!==void 0&&(l.type=e),d(a,l);let p=o&&o.headers?o.headers:{};return i.headers={...c,...p,...s.headers},{url:h(a),options:i}},listFiles:async(t,e,s={})=>{C("listFiles","botId",t);let n="/v1/storage/files",a=new URL(n,g),o;r&&(o=r.baseOptions);let i={method:"GET",...o,...s},c={},l={};e!==void 0&&(l.nextToken=e),t!==void 0&&(l.botId=t),d(a,l);let p=o&&o.headers?o.headers:{};return i.headers={...c,...p,...s.headers},{url:h(a),options:i}},listIntegrations:async(t,e,s,n={})=>{let a="/v1/admin/integrations",o=new URL(a,g),i;r&&(i=r.baseOptions);let c={method:"GET",...i,...n},l={},p={};t!==void 0&&(p.nextToken=t),e!==void 0&&(p.name=e),s!==void 0&&(p.version=s),d(o,p);let P=i&&i.headers?i.headers:{};return c.headers={...l,...P,...n.headers},{url:h(o),options:c}},listMessages:async(t,e,s,n={})=>{let a="/v1/chat/messages",o=new URL(a,g),i;r&&(i=r.baseOptions);let c={method:"GET",...i,...n},l={},p={};t!==void 0&&(p.nextToken=t),e!==void 0&&(p.conversationId=e),s!==void 0&&(p.tags=s),d(o,p);let P=i&&i.headers?i.headers:{};return c.headers={...l,...P,...n.headers},{url:h(o),options:c}},listPublicIntegrations:async(t,e,s,n={})=>{let a="/v1/admin/hub/integrations",o=new URL(a,g),i;r&&(i=r.baseOptions);let c={method:"GET",...i,...n},l={},p={};t!==void 0&&(p.nextToken=t),e!==void 0&&(p.name=e),s!==void 0&&(p.version=s),d(o,p);let P=i&&i.headers?i.headers:{};return c.headers={...l,...P,...n.headers},{url:h(o),options:c}},listUsers:async(t,e,s,n={})=>{let a="/v1/chat/users",o=new URL(a,g),i;r&&(i=r.baseOptions);let c={method:"GET",...i,...n},l={},p={};t!==void 0&&(p.nextToken=t),e!==void 0&&(p.conversationId=e),s!==void 0&&(p.tags=s),d(o,p);let P=i&&i.headers?i.headers:{};return c.headers={...l,...P,...n.headers},{url:h(o),options:c}},listWorkspaces:async(t,e={})=>{let s="/v1/admin/workspaces",n=new URL(s,g),a;r&&(a=r.baseOptions);let o={method:"GET",...a,...e},i={},c={};t!==void 0&&(c.nextToken=t),d(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:h(n),options:o}},patchState:async(t,e,s,n,a={})=>{C("patchState","type",t),C("patchState","id",e),C("patchState","name",s);let o="/v1/chat/states/{type}/{id}/{name}".replace("{type}",encodeURIComponent(String(t))).replace("{id}",encodeURIComponent(String(e))).replace("{name}",encodeURIComponent(String(s))),i=new URL(o,g),c;r&&(c=r.baseOptions);let l={method:"PATCH",...c,...a},p={},P={};p["Content-Type"]="application/json",d(i,P);let U=c&&c.headers?c.headers:{};return l.headers={...p,...U,...a.headers},l.data=x(n,l,r),{url:h(i),options:l}},setState:async(t,e,s,n,a={})=>{C("setState","type",t),C("setState","id",e),C("setState","name",s);let o="/v1/chat/states/{type}/{id}/{name}".replace("{type}",encodeURIComponent(String(t))).replace("{id}",encodeURIComponent(String(e))).replace("{name}",encodeURIComponent(String(s))),i=new URL(o,g),c;r&&(c=r.baseOptions);let l={method:"POST",...c,...a},p={},P={};p["Content-Type"]="application/json",d(i,P);let U=c&&c.headers?c.headers:{};return l.headers={...p,...U,...a.headers},l.data=x(n,l,r),{url:h(i),options:l}},transferBot:async(t,e,s={})=>{C("transferBot","id",t);let n="/v1/admin/bots/{id}/transfer".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,g),o;r&&(o=r.baseOptions);let i={method:"POST",...o,...s},c={},l={};c["Content-Type"]="application/json",d(a,l);let p=o&&o.headers?o.headers:{};return i.headers={...c,...p,...s.headers},i.data=x(e,i,r),{url:h(a),options:i}},updateBot:async(t,e,s={})=>{C("updateBot","id",t);let n="/v1/admin/bots/{id}".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,g),o;r&&(o=r.baseOptions);let i={method:"PUT",...o,...s},c={},l={};c["Content-Type"]="application/json",d(a,l);let p=o&&o.headers?o.headers:{};return i.headers={...c,...p,...s.headers},i.data=x(e,i,r),{url:h(a),options:i}},updateConversation:async(t,e,s={})=>{C("updateConversation","id",t);let n="/v1/chat/conversations/{id}".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,g),o;r&&(o=r.baseOptions);let i={method:"PUT",...o,...s},c={},l={};c["Content-Type"]="application/json",d(a,l);let p=o&&o.headers?o.headers:{};return i.headers={...c,...p,...s.headers},i.data=x(e,i,r),{url:h(a),options:i}},updateIntegration:async(t,e,s={})=>{C("updateIntegration","id",t);let n="/v1/admin/integrations/{id}".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,g),o;r&&(o=r.baseOptions);let i={method:"PUT",...o,...s},c={},l={};c["Content-Type"]="application/json",d(a,l);let p=o&&o.headers?o.headers:{};return i.headers={...c,...p,...s.headers},i.data=x(e,i,r),{url:h(a),options:i}},updateMessage:async(t,e,s={})=>{C("updateMessage","id",t);let n="/v1/chat/messages/{id}".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,g),o;r&&(o=r.baseOptions);let i={method:"PUT",...o,...s},c={},l={};c["Content-Type"]="application/json",d(a,l);let p=o&&o.headers?o.headers:{};return i.headers={...c,...p,...s.headers},i.data=x(e,i,r),{url:h(a),options:i}},updateUser:async(t,e,s={})=>{C("updateUser","id",t);let n="/v1/chat/users/{id}".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,g),o;r&&(o=r.baseOptions);let i={method:"PUT",...o,...s},c={},l={};c["Content-Type"]="application/json",d(a,l);let p=o&&o.headers?o.headers:{};return i.headers={...c,...p,...s.headers},i.data=x(e,i,r),{url:h(a),options:i}}}},R=function(r){let t=ce(r);return{async callAction(e,s){let n=await t.callAction(e,s);return y(n,A,u,r)},async configureIntegration(e,s){let n=await t.configureIntegration(e,s);return y(n,A,u,r)},async createBot(e,s){let n=await t.createBot(e,s);return y(n,A,u,r)},async createConversation(e,s){let n=await t.createConversation(e,s);return y(n,A,u,r)},async createEvent(e,s){let n=await t.createEvent(e,s);return y(n,A,u,r)},async createFile(e,s){let n=await t.createFile(e,s);return y(n,A,u,r)},async createIntegration(e,s){let n=await t.createIntegration(e,s);return y(n,A,u,r)},async createMessage(e,s){let n=await t.createMessage(e,s);return y(n,A,u,r)},async createUser(e,s){let n=await t.createUser(e,s);return y(n,A,u,r)},async deleteBot(e,s){let n=await t.deleteBot(e,s);return y(n,A,u,r)},async deleteConversation(e,s){let n=await t.deleteConversation(e,s);return y(n,A,u,r)},async deleteFile(e,s){let n=await t.deleteFile(e,s);return y(n,A,u,r)},async deleteIntegration(e,s){let n=await t.deleteIntegration(e,s);return y(n,A,u,r)},async deleteMessage(e,s){let n=await t.deleteMessage(e,s);return y(n,A,u,r)},async deleteUser(e,s){let n=await t.deleteUser(e,s);return y(n,A,u,r)},async downloadFile(e,s){let n=await t.downloadFile(e,s);return y(n,A,u,r)},async getBot(e,s){let n=await t.getBot(e,s);return y(n,A,u,r)},async getBotAnalytics(e,s,n,a){let o=await t.getBotAnalytics(e,s,n,a);return y(o,A,u,r)},async getBotLogs(e,s){let n=await t.getBotLogs(e,s);return y(n,A,u,r)},async getBotWebchat(e,s,n){let a=await t.getBotWebchat(e,s,n);return y(a,A,u,r)},async getConversation(e,s){let n=await t.getConversation(e,s);return y(n,A,u,r)},async getEvent(e,s){let n=await t.getEvent(e,s);return y(n,A,u,r)},async getFile(e,s){let n=await t.getFile(e,s);return y(n,A,u,r)},async getIntegration(e,s){let n=await t.getIntegration(e,s);return y(n,A,u,r)},async getIntegrationByName(e,s,n){let a=await t.getIntegrationByName(e,s,n);return y(a,A,u,r)},async getIntegrationLogs(e,s){let n=await t.getIntegrationLogs(e,s);return y(n,A,u,r)},async getMessage(e,s){let n=await t.getMessage(e,s);return y(n,A,u,r)},async getOrCreateConversation(e,s){let n=await t.getOrCreateConversation(e,s);return y(n,A,u,r)},async getOrCreateMessage(e,s){let n=await t.getOrCreateMessage(e,s);return y(n,A,u,r)},async getOrCreateUser(e,s){let n=await t.getOrCreateUser(e,s);return y(n,A,u,r)},async getPublicIntegration(e,s,n){let a=await t.getPublicIntegration(e,s,n);return y(a,A,u,r)},async getPublicIntegrationById(e,s){let n=await t.getPublicIntegrationById(e,s);return y(n,A,u,r)},async getState(e,s,n,a){let o=await t.getState(e,s,n,a);return y(o,A,u,r)},async getUser(e,s){let n=await t.getUser(e,s);return y(n,A,u,r)},async getWorkspace(e,s){let n=await t.getWorkspace(e,s);return y(n,A,u,r)},async introspect(e,s){let n=await t.introspect(e,s);return y(n,A,u,r)},async listBots(e,s){let n=await t.listBots(e,s);return y(n,A,u,r)},async listConversations(e,s,n,a){let o=await t.listConversations(e,s,n,a);return y(o,A,u,r)},async listEvents(e,s,n){let a=await t.listEvents(e,s,n);return y(a,A,u,r)},async listFiles(e,s,n){let a=await t.listFiles(e,s,n);return y(a,A,u,r)},async listIntegrations(e,s,n,a){let o=await t.listIntegrations(e,s,n,a);return y(o,A,u,r)},async listMessages(e,s,n,a){let o=await t.listMessages(e,s,n,a);return y(o,A,u,r)},async listPublicIntegrations(e,s,n,a){let o=await t.listPublicIntegrations(e,s,n,a);return y(o,A,u,r)},async listUsers(e,s,n,a){let o=await t.listUsers(e,s,n,a);return y(o,A,u,r)},async listWorkspaces(e,s){let n=await t.listWorkspaces(e,s);return y(n,A,u,r)},async patchState(e,s,n,a,o){let i=await t.patchState(e,s,n,a,o);return y(i,A,u,r)},async setState(e,s,n,a,o){let i=await t.setState(e,s,n,a,o);return y(i,A,u,r)},async transferBot(e,s,n){let a=await t.transferBot(e,s,n);return y(a,A,u,r)},async updateBot(e,s,n){let a=await t.updateBot(e,s,n);return y(a,A,u,r)},async updateConversation(e,s,n){let a=await t.updateConversation(e,s,n);return y(a,A,u,r)},async updateIntegration(e,s,n){let a=await t.updateIntegration(e,s,n);return y(a,A,u,r)},async updateMessage(e,s,n){let a=await t.updateMessage(e,s,n);return y(a,A,u,r)},async updateUser(e,s,n){let a=await t.updateUser(e,s,n);return y(a,A,u,r)}}};var I=class extends b{callAction(t={},e){return R(this.configuration).callAction(t.callActionBody,e).then(s=>s(this.axios,this.basePath))}configureIntegration(t={},e){return R(this.configuration).configureIntegration(t.configureIntegrationBody,e).then(s=>s(this.axios,this.basePath))}createBot(t={},e){return R(this.configuration).createBot(t.createBotBody,e).then(s=>s(this.axios,this.basePath))}createConversation(t={},e){return R(this.configuration).createConversation(t.createConversationBody,e).then(s=>s(this.axios,this.basePath))}createEvent(t={},e){return R(this.configuration).createEvent(t.createEventBody,e).then(s=>s(this.axios,this.basePath))}createFile(t={},e){return R(this.configuration).createFile(t.createFileBody,e).then(s=>s(this.axios,this.basePath))}createIntegration(t={},e){return R(this.configuration).createIntegration(t.createIntegrationBody,e).then(s=>s(this.axios,this.basePath))}createMessage(t={},e){return R(this.configuration).createMessage(t.createMessageBody,e).then(s=>s(this.axios,this.basePath))}createUser(t={},e){return R(this.configuration).createUser(t.createUserBody,e).then(s=>s(this.axios,this.basePath))}deleteBot(t,e){return R(this.configuration).deleteBot(t.id,e).then(s=>s(this.axios,this.basePath))}deleteConversation(t,e){return R(this.configuration).deleteConversation(t.id,e).then(s=>s(this.axios,this.basePath))}deleteFile(t,e){return R(this.configuration).deleteFile(t.id,e).then(s=>s(this.axios,this.basePath))}deleteIntegration(t,e){return R(this.configuration).deleteIntegration(t.id,e).then(s=>s(this.axios,this.basePath))}deleteMessage(t,e){return R(this.configuration).deleteMessage(t.id,e).then(s=>s(this.axios,this.basePath))}deleteUser(t,e){return R(this.configuration).deleteUser(t.id,e).then(s=>s(this.axios,this.basePath))}downloadFile(t,e){return R(this.configuration).downloadFile(t.id,e).then(s=>s(this.axios,this.basePath))}getBot(t,e){return R(this.configuration).getBot(t.id,e).then(s=>s(this.axios,this.basePath))}getBotAnalytics(t,e){return R(this.configuration).getBotAnalytics(t.id,t.startDate,t.endDate,e).then(s=>s(this.axios,this.basePath))}getBotLogs(t,e){return R(this.configuration).getBotLogs(t.id,e).then(s=>s(this.axios,this.basePath))}getBotWebchat(t,e){return R(this.configuration).getBotWebchat(t.id,t.type,e).then(s=>s(this.axios,this.basePath))}getConversation(t,e){return R(this.configuration).getConversation(t.id,e).then(s=>s(this.axios,this.basePath))}getEvent(t,e){return R(this.configuration).getEvent(t.id,e).then(s=>s(this.axios,this.basePath))}getFile(t,e){return R(this.configuration).getFile(t.id,e).then(s=>s(this.axios,this.basePath))}getIntegration(t,e){return R(this.configuration).getIntegration(t.id,e).then(s=>s(this.axios,this.basePath))}getIntegrationByName(t,e){return R(this.configuration).getIntegrationByName(t.name,t.version,e).then(s=>s(this.axios,this.basePath))}getIntegrationLogs(t,e){return R(this.configuration).getIntegrationLogs(t.id,e).then(s=>s(this.axios,this.basePath))}getMessage(t,e){return R(this.configuration).getMessage(t.id,e).then(s=>s(this.axios,this.basePath))}getOrCreateConversation(t={},e){return R(this.configuration).getOrCreateConversation(t.getOrCreateConversationBody,e).then(s=>s(this.axios,this.basePath))}getOrCreateMessage(t={},e){return R(this.configuration).getOrCreateMessage(t.getOrCreateMessageBody,e).then(s=>s(this.axios,this.basePath))}getOrCreateUser(t={},e){return R(this.configuration).getOrCreateUser(t.getOrCreateUserBody,e).then(s=>s(this.axios,this.basePath))}getPublicIntegration(t,e){return R(this.configuration).getPublicIntegration(t.name,t.version,e).then(s=>s(this.axios,this.basePath))}getPublicIntegrationById(t,e){return R(this.configuration).getPublicIntegrationById(t.id,e).then(s=>s(this.axios,this.basePath))}getState(t,e){return R(this.configuration).getState(t.type,t.id,t.name,e).then(s=>s(this.axios,this.basePath))}getUser(t,e){return R(this.configuration).getUser(t.id,e).then(s=>s(this.axios,this.basePath))}getWorkspace(t,e){return R(this.configuration).getWorkspace(t.id,e).then(s=>s(this.axios,this.basePath))}introspect(t={},e){return R(this.configuration).introspect(t.introspectBody,e).then(s=>s(this.axios,this.basePath))}listBots(t={},e){return R(this.configuration).listBots(t.nextToken,e).then(s=>s(this.axios,this.basePath))}listConversations(t={},e){return R(this.configuration).listConversations(t.nextToken,t.tags,t.participantIds,e).then(s=>s(this.axios,this.basePath))}listEvents(t={},e){return R(this.configuration).listEvents(t.nextToken,t.type,e).then(s=>s(this.axios,this.basePath))}listFiles(t,e){return R(this.configuration).listFiles(t.botId,t.nextToken,e).then(s=>s(this.axios,this.basePath))}listIntegrations(t={},e){return R(this.configuration).listIntegrations(t.nextToken,t.name,t.version,e).then(s=>s(this.axios,this.basePath))}listMessages(t={},e){return R(this.configuration).listMessages(t.nextToken,t.conversationId,t.tags,e).then(s=>s(this.axios,this.basePath))}listPublicIntegrations(t={},e){return R(this.configuration).listPublicIntegrations(t.nextToken,t.name,t.version,e).then(s=>s(this.axios,this.basePath))}listUsers(t={},e){return R(this.configuration).listUsers(t.nextToken,t.conversationId,t.tags,e).then(s=>s(this.axios,this.basePath))}listWorkspaces(t={},e){return R(this.configuration).listWorkspaces(t.nextToken,e).then(s=>s(this.axios,this.basePath))}patchState(t,e){return R(this.configuration).patchState(t.type,t.id,t.name,t.patchStateBody,e).then(s=>s(this.axios,this.basePath))}setState(t,e){return R(this.configuration).setState(t.type,t.id,t.name,t.setStateBody,e).then(s=>s(this.axios,this.basePath))}transferBot(t,e){return R(this.configuration).transferBot(t.id,t.transferBotBody,e).then(s=>s(this.axios,this.basePath))}updateBot(t,e){return R(this.configuration).updateBot(t.id,t.updateBotBody,e).then(s=>s(this.axios,this.basePath))}updateConversation(t,e){return R(this.configuration).updateConversation(t.id,t.updateConversationBody,e).then(s=>s(this.axios,this.basePath))}updateIntegration(t,e){return R(this.configuration).updateIntegration(t.id,t.updateIntegrationBody,e).then(s=>s(this.axios,this.basePath))}updateMessage(t,e){return R(this.configuration).updateMessage(t.id,t.updateMessageBody,e).then(s=>s(this.axios,this.basePath))}updateUser(t,e){return R(this.configuration).updateUser(t.id,t.updateUserBody,e).then(s=>s(this.axios,this.basePath))}};var v=class{_innerClient;constructor(t,e,s){this._innerClient=new I(t,e,s)}createConversation=t=>this._innerClient.createConversation({createConversationBody:t}).then(e=>e.data).catch(e=>{throw f(e)});getConversation=t=>this._innerClient.getConversation(t).then(e=>e.data).catch(e=>{throw f(e)});listConversations=t=>this._innerClient.listConversations(t).then(e=>e.data).catch(e=>{throw f(e)});getOrCreateConversation=t=>this._innerClient.getOrCreateConversation({getOrCreateConversationBody:t}).then(e=>e.data).catch(e=>{throw f(e)});updateConversation=({id:t,...e})=>this._innerClient.updateConversation({id:t,updateConversationBody:e}).then(s=>s.data).catch(s=>{throw f(s)});deleteConversation=t=>this._innerClient.deleteConversation(t).then(e=>e.data).catch(e=>{throw f(e)});createEvent=t=>this._innerClient.createEvent({createEventBody:t}).then(e=>e.data).catch(e=>{throw f(e)});getEvent=t=>this._innerClient.getEvent(t).then(e=>e.data).catch(e=>{throw f(e)});listEvents=t=>this._innerClient.listEvents(t).then(e=>e.data).catch(e=>{throw f(e)});createMessage=t=>this._innerClient.createMessage({createMessageBody:t}).then(e=>e.data).catch(e=>{throw f(e)});getOrCreateMessage=t=>this._innerClient.getOrCreateMessage({getOrCreateMessageBody:t}).then(e=>e.data).catch(e=>{throw f(e)});getMessage=t=>this._innerClient.getMessage(t).then(e=>e.data).catch(e=>{throw f(e)});updateMessage=({id:t,...e})=>this._innerClient.updateMessage({id:t,updateMessageBody:e}).then(s=>s.data).catch(s=>{throw f(s)});listMessages=t=>this._innerClient.listMessages(t).then(e=>e.data).catch(e=>{throw f(e)});deleteMessage=t=>this._innerClient.deleteMessage(t).then(e=>e.data).catch(e=>{throw f(e)});createUser=t=>this._innerClient.createUser({createUserBody:t}).then(e=>e.data).catch(e=>{throw f(e)});getUser=t=>this._innerClient.getUser(t).then(e=>e.data).catch(e=>{throw f(e)});listUsers=t=>this._innerClient.listUsers(t).then(e=>e.data).catch(e=>{throw f(e)});getOrCreateUser=t=>this._innerClient.getOrCreateUser({getOrCreateUserBody:t}).then(e=>e.data).catch(e=>{throw f(e)});updateUser=({id:t,...e})=>this._innerClient.updateUser({id:t,updateUserBody:e}).then(s=>s.data).catch(s=>{throw f(s)});deleteUser=t=>this._innerClient.deleteUser(t).then(e=>e.data).catch(e=>{throw f(e)});getState=t=>this._innerClient.getState(t).then(e=>e.data).catch(e=>{throw f(e)});setState=({type:t,id:e,name:s,...n})=>this._innerClient.setState({type:t,id:e,name:s,setStateBody:n}).then(a=>a.data).catch(a=>{throw f(a)});patchState=({type:t,id:e,name:s,...n})=>this._innerClient.patchState({type:t,id:e,name:s,patchStateBody:n}).then(a=>a.data).catch(a=>{throw f(a)});callAction=t=>this._innerClient.callAction({callActionBody:t}).then(e=>e.data).catch(e=>{throw f(e)});configureIntegration=t=>this._innerClient.configureIntegration({configureIntegrationBody:t}).then(e=>e.data).catch(e=>{throw f(e)});listPublicIntegrations=t=>this._innerClient.listPublicIntegrations(t).then(e=>e.data).catch(e=>{throw f(e)});getPublicIntegrationById=t=>this._innerClient.getPublicIntegrationById(t).then(e=>e.data).catch(e=>{throw f(e)});getPublicIntegration=t=>this._innerClient.getPublicIntegration(t).then(e=>e.data).catch(e=>{throw f(e)});createBot=t=>this._innerClient.createBot({createBotBody:t}).then(e=>e.data).catch(e=>{throw f(e)});updateBot=({id:t,...e})=>this._innerClient.updateBot({id:t,updateBotBody:e}).then(s=>s.data).catch(s=>{throw f(s)});transferBot=({id:t,...e})=>this._innerClient.transferBot({id:t,transferBotBody:e}).then(s=>s.data).catch(s=>{throw f(s)});listBots=t=>this._innerClient.listBots(t).then(e=>e.data).catch(e=>{throw f(e)});getBot=t=>this._innerClient.getBot(t).then(e=>e.data).catch(e=>{throw f(e)});deleteBot=t=>this._innerClient.deleteBot(t).then(e=>e.data).catch(e=>{throw f(e)});getBotLogs=t=>this._innerClient.getBotLogs(t).then(e=>e.data).catch(e=>{throw f(e)});getBotWebchat=t=>this._innerClient.getBotWebchat(t).then(e=>e.data).catch(e=>{throw f(e)});getBotAnalytics=t=>this._innerClient.getBotAnalytics(t).then(e=>e.data).catch(e=>{throw f(e)});getWorkspace=t=>this._innerClient.getWorkspace(t).then(e=>e.data).catch(e=>{throw f(e)});listWorkspaces=t=>this._innerClient.listWorkspaces(t).then(e=>e.data).catch(e=>{throw f(e)});createIntegration=t=>this._innerClient.createIntegration({createIntegrationBody:t}).then(e=>e.data).catch(e=>{throw f(e)});updateIntegration=({id:t,...e})=>this._innerClient.updateIntegration({id:t,updateIntegrationBody:e}).then(s=>s.data).catch(s=>{throw f(s)});listIntegrations=t=>this._innerClient.listIntegrations(t).then(e=>e.data).catch(e=>{throw f(e)});getIntegration=t=>this._innerClient.getIntegration(t).then(e=>e.data).catch(e=>{throw f(e)});getIntegrationLogs=t=>this._innerClient.getIntegrationLogs(t).then(e=>e.data).catch(e=>{throw f(e)});getIntegrationByName=t=>this._innerClient.getIntegrationByName(t).then(e=>e.data).catch(e=>{throw f(e)});deleteIntegration=t=>this._innerClient.deleteIntegration(t).then(e=>e.data).catch(e=>{throw f(e)});introspect=t=>this._innerClient.introspect({introspectBody:t}).then(e=>e.data).catch(e=>{throw f(e)});createFile=t=>this._innerClient.createFile({createFileBody:t}).then(e=>e.data).catch(e=>{throw f(e)});getFile=t=>this._innerClient.getFile(t).then(e=>e.data).catch(e=>{throw f(e)});downloadFile=t=>this._innerClient.downloadFile(t).then(e=>e.data).catch(e=>{throw f(e)});deleteFile=t=>this._innerClient.deleteFile(t).then(e=>e.data).catch(e=>{throw f(e)});listFiles=t=>this._innerClient.listFiles(t).then(e=>e.data).catch(e=>{throw f(e)})};function f(r){return pe.isAxiosError(r)?Q(r.response?.data):Q(r)}var z=class extends v{config;constructor(t={}){let e=J(t),{host:s,headers:n,withCredentials:a,timeout:o}=e,i=ue.create({maxBodyLength:100*1024*1024,maxContentLength:1024*1024*1024,timeout:o??6e4,withCredentials:a,headers:n});super(void 0,s,i),this.config=e}};export{z as Client,D as ForbiddenError,O as InternalError,G as InvalidDataFormatError,F as InvalidIdentifierError,L as InvalidJsonSchemaError,E as InvalidPayloadError,N as InvalidQueryError,w as MethodNotFoundError,T as PayloadTooLargeError,_ as ReferenceNotFoundError,k as RelationConflictError,S as ResourceNotFoundError,j as RuntimeError,V as UnauthorizedError,B as UnknownError,M as UnsupportedMediaTypeError,Qt as axios,Q as errorFrom,ne as isApiError};
|
|
1
|
+
import ue from"axios";import*as Qt from"axios";import{isBrowser as H,isNode as K}from"browser-or-node";var $="https://api.botpress.cloud",Y="BP_API_URL",Z="BP_BOT_ID",X="BP_INTEGRATION_ID",ee="BP_WORKSPACE_ID",te="BP_TOKEN";function J(r){let t=se(r),e={};return t.workspaceId&&(e["x-workspace-id"]=t.workspaceId),t.botId&&(e["x-bot-id"]=t.botId),t.integrationId&&(e["x-integration-id"]=t.integrationId),t.token&&(e.Authorization=`Bearer ${t.token}`),{host:t.host??$,withCredentials:H,headers:e}}function se(r){return H?r:K?ae(r):r}function ae(r){let t={...r,host:r.host??process.env[Y]??$,botId:r.botId??process.env[Z],integrationId:r.integrationId??process.env[X],workspaceId:r.workspaceId??process.env[ee]},e=t.token??process.env[te];return e&&(t.token=e),t}var m=class extends Error{constructor(e,s,n,a,o){super(a);this.code=e;this.description=s;this.type=n;this.message=a;this.error=o}isApiError=!0;toJSON(){return{code:this.code,type:this.type,message:this.message}}},re=r=>typeof r=="object"&&!Array.isArray(r)&&r!==null,ne=r=>r instanceof m||re(r)&&r.isApiError===!0,P=class extends m{constructor(t,e){super(500,"An unknown error occurred","Unknown",t,e)}},V=class extends m{constructor(t,e){super(500,"An internal error occurred","Internal",t,e)}},O=class extends m{constructor(t,e){super(401,"The request requires to be authenticated.","Unauthorized",t,e)}},T=class extends m{constructor(t,e){super(403,"The requested action can't be peform by this resource.","Forbidden",t,e)}},D=class extends m{constructor(t,e){super(413,"The request payload is too large.","PayloadTooLarge",t,e)}},E=class extends m{constructor(t,e){super(400,"The request payload is invalid.","InvalidPayload",t,e)}},S=class extends m{constructor(t,e){super(415,"The request is invalid because the content-type is not supported.","UnsupportedMediaType",t,e)}},M=class extends m{constructor(t,e){super(405,"The requested method does not exist.","MethodNotFound",t,e)}},w=class extends m{constructor(t,e){super(404,"The requested resource does not exist.","ResourceNotFound",t,e)}},G=class extends m{constructor(t,e){super(400,"The provided JSON schema is invalid.","InvalidJsonSchema",t,e)}},L=class extends m{constructor(t,e){super(400,"The provided data doesn't respect the provided JSON schema.","InvalidDataFormat",t,e)}},k=class extends m{constructor(t,e){super(400,"The provided identifier is not valid. An identifier must start with a lowercase letter, be between 2 and 100 characters long and use only alphanumeric characters.","InvalidIdentifier",t,e)}},F=class extends m{constructor(t,e){super(409,"The resource is not related with another resource. This is usually caused when providing two resources that aren't linked together.","RelationConflict",t,e)}},_=class extends m{constructor(t,e){super(400,"The provided resource reference is missing. This is usually caused when providing an invalid id inside the payload of a request.","ReferenceNotFound",t,e)}},N=class extends m{constructor(t,e){super(400,"The provided query is invalid. This is usually caused when providing an invalid parameter for querying a resource.","InvalidQuery",t,e)}},j=class extends m{constructor(t,e){super(400,"An error happened during the execution of a runtime (bot or integration).","Runtime",t,e)}},oe={Unknown:P,Internal:V,Unauthorized:O,Forbidden:T,PayloadTooLarge:D,InvalidPayload:E,UnsupportedMediaType:S,MethodNotFound:M,ResourceNotFound:w,InvalidJsonSchema:G,InvalidDataFormat:L,InvalidIdentifier:k,RelationConflict:F,ReferenceNotFound:_,InvalidQuery:N,Runtime:j},Q=r=>ne(r)?r:r instanceof Error?new P(r.message,r):r===null?new P("An unknown error occurred"):typeof r=="string"?new P(r):typeof r!="object"?new P("An unknown error occurred"):ie(r);function ie(r){if("code"in r&&"type"in r&&"message"in r){if(typeof r.message!="string")return new P("An unknown error occurred");if(typeof r.type!="string")return new P(r.message);let t=oe[r.type];return t?new t(r.message):new P(r.message)}return new P("An unknown error occurred")}import pe from"axios";import A from"axios";import le from"axios";var u="https://api.botpress.cloud".replace(/\/+$/,"");var I=class{constructor(t,e=u,s=le){this.basePath=e;this.axios=s;t&&(this.configuration=t,this.basePath=t.basePath||this.basePath)}configuration},b=class extends Error{constructor(e,s){super(s);this.field=e;this.name="RequiredError"}};var d="https://example.com",C=function(r,t,e){if(e==null)throw new b(t,`Required parameter ${t} was null or undefined when calling ${r}.`)};function W(r,t,e=""){t!=null&&(typeof t=="object"?Array.isArray(t)?t.forEach(s=>W(r,s,e)):Object.keys(t).forEach(s=>W(r,t[s],`${e}${e!==""?".":""}${s}`)):r.has(e)?r.append(e,t):r.set(e,t))}var g=function(r,...t){let e=new URLSearchParams(r.search);W(e,t),r.search=e.toString()},x=function(r,t,e){let s=typeof r!="string";return(s&&e&&e.isJsonMime?e.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(r!==void 0?r:{}):r||""},y=function(r){return r.pathname+r.search+r.hash},h=function(r,t,e,s){return(n=t,a=e)=>{let o={...r.options,url:(s?.basePath||a)+r.url};return n.request(o)}};var ce=function(r){return{callAction:async(t,e={})=>{let s="/v1/chat/actions",n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"POST",...a,...e},i={},c={};i["Content-Type"]="application/json",g(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},o.data=x(t,o,r),{url:y(n),options:o}},configureIntegration:async(t,e={})=>{let s="/v1/chat/integrations/configure",n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"POST",...a,...e},i={},c={};i["Content-Type"]="application/json",g(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},o.data=x(t,o,r),{url:y(n),options:o}},createBot:async(t,e={})=>{let s="/v1/admin/bots",n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"POST",...a,...e},i={},c={};i["Content-Type"]="application/json",g(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},o.data=x(t,o,r),{url:y(n),options:o}},createConversation:async(t,e={})=>{let s="/v1/chat/conversations",n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"POST",...a,...e},i={},c={};i["Content-Type"]="application/json",g(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},o.data=x(t,o,r),{url:y(n),options:o}},createEvent:async(t,e={})=>{let s="/v1/chat/events",n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"POST",...a,...e},i={},c={};i["Content-Type"]="application/json",g(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},o.data=x(t,o,r),{url:y(n),options:o}},createFile:async(t,e={})=>{let s="/v1/storage/files",n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"POST",...a,...e},i={},c={};i["Content-Type"]="application/json",g(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},o.data=x(t,o,r),{url:y(n),options:o}},createIntegration:async(t,e={})=>{let s="/v1/admin/integrations",n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"POST",...a,...e},i={},c={};i["Content-Type"]="application/json",g(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},o.data=x(t,o,r),{url:y(n),options:o}},createMessage:async(t,e={})=>{let s="/v1/chat/messages",n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"POST",...a,...e},i={},c={};i["Content-Type"]="application/json",g(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},o.data=x(t,o,r),{url:y(n),options:o}},createUser:async(t,e={})=>{let s="/v1/chat/users",n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"POST",...a,...e},i={},c={};i["Content-Type"]="application/json",g(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},o.data=x(t,o,r),{url:y(n),options:o}},deleteBot:async(t,e={})=>{C("deleteBot","id",t);let s="/v1/admin/bots/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"DELETE",...a,...e},i={};g(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:y(n),options:o}},deleteConversation:async(t,e={})=>{C("deleteConversation","id",t);let s="/v1/chat/conversations/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"DELETE",...a,...e},i={};g(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:y(n),options:o}},deleteFile:async(t,e={})=>{C("deleteFile","id",t);let s="/v1/storage/files/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"DELETE",...a,...e},i={};g(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:y(n),options:o}},deleteIntegration:async(t,e={})=>{C("deleteIntegration","id",t);let s="/v1/admin/integrations/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"DELETE",...a,...e},i={};g(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:y(n),options:o}},deleteMessage:async(t,e={})=>{C("deleteMessage","id",t);let s="/v1/chat/messages/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"DELETE",...a,...e},i={};g(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:y(n),options:o}},deleteUser:async(t,e={})=>{C("deleteUser","id",t);let s="/v1/chat/users/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"DELETE",...a,...e},i={};g(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:y(n),options:o}},downloadFile:async(t,e={})=>{C("downloadFile","id",t);let s="/v1/storage/files/{id}/download".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"GET",...a,...e},i={};g(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:y(n),options:o}},getBot:async(t,e={})=>{C("getBot","id",t);let s="/v1/admin/bots/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"GET",...a,...e},i={};g(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:y(n),options:o}},getBotAnalytics:async(t,e,s,n={})=>{C("getBotAnalytics","id",t),C("getBotAnalytics","startDate",e),C("getBotAnalytics","endDate",s);let a="/v1/admin/bots/{id}/analytics".replace("{id}",encodeURIComponent(String(t))),o=new URL(a,d),i;r&&(i=r.baseOptions);let c={method:"GET",...i,...n},l={},p={};e!==void 0&&(p.startDate=e),s!==void 0&&(p.endDate=s),g(o,p);let B=i&&i.headers?i.headers:{};return c.headers={...l,...B,...n.headers},{url:y(o),options:c}},getBotLogs:async(t,e={})=>{C("getBotLogs","id",t);let s="/v1/admin/bots/{id}/logs".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"GET",...a,...e},i={};g(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:y(n),options:o}},getBotWebchat:async(t,e,s={})=>{C("getBotWebchat","id",t),C("getBotWebchat","type",e);let n="/v1/admin/bots/{id}/webchat".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,d),o;r&&(o=r.baseOptions);let i={method:"GET",...o,...s},c={},l={};e!==void 0&&(l.type=e),g(a,l);let p=o&&o.headers?o.headers:{};return i.headers={...c,...p,...s.headers},{url:y(a),options:i}},getConversation:async(t,e={})=>{C("getConversation","id",t);let s="/v1/chat/conversations/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"GET",...a,...e},i={};g(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:y(n),options:o}},getEvent:async(t,e={})=>{C("getEvent","id",t);let s="/v1/chat/events/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"GET",...a,...e},i={};g(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:y(n),options:o}},getFile:async(t,e={})=>{C("getFile","id",t);let s="/v1/storage/files/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"GET",...a,...e},i={};g(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:y(n),options:o}},getIntegration:async(t,e={})=>{C("getIntegration","id",t);let s="/v1/admin/integrations/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"GET",...a,...e},i={};g(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:y(n),options:o}},getIntegrationByName:async(t,e,s={})=>{C("getIntegrationByName","name",t),C("getIntegrationByName","version",e);let n="/v1/admin/integrations/{name}/{version}".replace("{name}",encodeURIComponent(String(t))).replace("{version}",encodeURIComponent(String(e))),a=new URL(n,d),o;r&&(o=r.baseOptions);let i={method:"GET",...o,...s},c={};g(a,{});let p=o&&o.headers?o.headers:{};return i.headers={...c,...p,...s.headers},{url:y(a),options:i}},getIntegrationLogs:async(t,e={})=>{C("getIntegrationLogs","id",t);let s="/v1/admin/integrations/{id}/logs".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"GET",...a,...e},i={};g(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:y(n),options:o}},getMessage:async(t,e={})=>{C("getMessage","id",t);let s="/v1/chat/messages/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"GET",...a,...e},i={};g(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:y(n),options:o}},getOrCreateConversation:async(t,e={})=>{let s="/v1/chat/conversations/get-or-create",n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"POST",...a,...e},i={},c={};i["Content-Type"]="application/json",g(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},o.data=x(t,o,r),{url:y(n),options:o}},getOrCreateMessage:async(t,e={})=>{let s="/v1/chat/messages/get-or-create",n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"POST",...a,...e},i={},c={};i["Content-Type"]="application/json",g(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},o.data=x(t,o,r),{url:y(n),options:o}},getOrCreateUser:async(t,e={})=>{let s="/v1/chat/users/get-or-create",n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"POST",...a,...e},i={},c={};i["Content-Type"]="application/json",g(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},o.data=x(t,o,r),{url:y(n),options:o}},getPublicIntegration:async(t,e,s={})=>{C("getPublicIntegration","name",t),C("getPublicIntegration","version",e);let n="/v1/admin/hub/integrations/{name}/{version}".replace("{name}",encodeURIComponent(String(t))).replace("{version}",encodeURIComponent(String(e))),a=new URL(n,d),o;r&&(o=r.baseOptions);let i={method:"GET",...o,...s},c={};g(a,{});let p=o&&o.headers?o.headers:{};return i.headers={...c,...p,...s.headers},{url:y(a),options:i}},getPublicIntegrationById:async(t,e={})=>{C("getPublicIntegrationById","id",t);let s="/v1/admin/hub/integrations/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"GET",...a,...e},i={};g(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:y(n),options:o}},getState:async(t,e,s,n={})=>{C("getState","type",t),C("getState","id",e),C("getState","name",s);let a="/v1/chat/states/{type}/{id}/{name}".replace("{type}",encodeURIComponent(String(t))).replace("{id}",encodeURIComponent(String(e))).replace("{name}",encodeURIComponent(String(s))),o=new URL(a,d),i;r&&(i=r.baseOptions);let c={method:"GET",...i,...n},l={};g(o,{});let B=i&&i.headers?i.headers:{};return c.headers={...l,...B,...n.headers},{url:y(o),options:c}},getUser:async(t,e={})=>{C("getUser","id",t);let s="/v1/chat/users/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"GET",...a,...e},i={};g(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:y(n),options:o}},getWorkspace:async(t,e={})=>{C("getWorkspace","id",t);let s="/v1/admin/workspaces/{id}".replace("{id}",encodeURIComponent(String(t))),n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"GET",...a,...e},i={};g(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:y(n),options:o}},introspect:async(t,e={})=>{let s="/v1/admin/introspect",n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"POST",...a,...e},i={},c={};i["Content-Type"]="application/json",g(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},o.data=x(t,o,r),{url:y(n),options:o}},listBots:async(t,e={})=>{let s="/v1/admin/bots",n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"GET",...a,...e},i={},c={};t!==void 0&&(c.nextToken=t),g(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:y(n),options:o}},listConversations:async(t,e,s,n={})=>{let a="/v1/chat/conversations",o=new URL(a,d),i;r&&(i=r.baseOptions);let c={method:"GET",...i,...n},l={},p={};t!==void 0&&(p.nextToken=t),e!==void 0&&(p.tags=e),s&&(p.participantIds=s),g(o,p);let B=i&&i.headers?i.headers:{};return c.headers={...l,...B,...n.headers},{url:y(o),options:c}},listEvents:async(t,e,s={})=>{let n="/v1/chat/events",a=new URL(n,d),o;r&&(o=r.baseOptions);let i={method:"GET",...o,...s},c={},l={};t!==void 0&&(l.nextToken=t),e!==void 0&&(l.type=e),g(a,l);let p=o&&o.headers?o.headers:{};return i.headers={...c,...p,...s.headers},{url:y(a),options:i}},listFiles:async(t,e,s={})=>{C("listFiles","botId",t);let n="/v1/storage/files",a=new URL(n,d),o;r&&(o=r.baseOptions);let i={method:"GET",...o,...s},c={},l={};e!==void 0&&(l.nextToken=e),t!==void 0&&(l.botId=t),g(a,l);let p=o&&o.headers?o.headers:{};return i.headers={...c,...p,...s.headers},{url:y(a),options:i}},listIntegrations:async(t,e,s,n={})=>{let a="/v1/admin/integrations",o=new URL(a,d),i;r&&(i=r.baseOptions);let c={method:"GET",...i,...n},l={},p={};t!==void 0&&(p.nextToken=t),e!==void 0&&(p.name=e),s!==void 0&&(p.version=s),g(o,p);let B=i&&i.headers?i.headers:{};return c.headers={...l,...B,...n.headers},{url:y(o),options:c}},listMessages:async(t,e,s,n={})=>{let a="/v1/chat/messages",o=new URL(a,d),i;r&&(i=r.baseOptions);let c={method:"GET",...i,...n},l={},p={};t!==void 0&&(p.nextToken=t),e!==void 0&&(p.conversationId=e),s!==void 0&&(p.tags=s),g(o,p);let B=i&&i.headers?i.headers:{};return c.headers={...l,...B,...n.headers},{url:y(o),options:c}},listPublicIntegrations:async(t,e,s,n={})=>{let a="/v1/admin/hub/integrations",o=new URL(a,d),i;r&&(i=r.baseOptions);let c={method:"GET",...i,...n},l={},p={};t!==void 0&&(p.nextToken=t),e!==void 0&&(p.name=e),s!==void 0&&(p.version=s),g(o,p);let B=i&&i.headers?i.headers:{};return c.headers={...l,...B,...n.headers},{url:y(o),options:c}},listUsers:async(t,e,s,n={})=>{let a="/v1/chat/users",o=new URL(a,d),i;r&&(i=r.baseOptions);let c={method:"GET",...i,...n},l={},p={};t!==void 0&&(p.nextToken=t),e!==void 0&&(p.conversationId=e),s!==void 0&&(p.tags=s),g(o,p);let B=i&&i.headers?i.headers:{};return c.headers={...l,...B,...n.headers},{url:y(o),options:c}},listWorkspaces:async(t,e={})=>{let s="/v1/admin/workspaces",n=new URL(s,d),a;r&&(a=r.baseOptions);let o={method:"GET",...a,...e},i={},c={};t!==void 0&&(c.nextToken=t),g(n,c);let l=a&&a.headers?a.headers:{};return o.headers={...i,...l,...e.headers},{url:y(n),options:o}},patchState:async(t,e,s,n,a={})=>{C("patchState","type",t),C("patchState","id",e),C("patchState","name",s);let o="/v1/chat/states/{type}/{id}/{name}".replace("{type}",encodeURIComponent(String(t))).replace("{id}",encodeURIComponent(String(e))).replace("{name}",encodeURIComponent(String(s))),i=new URL(o,d),c;r&&(c=r.baseOptions);let l={method:"PATCH",...c,...a},p={},B={};p["Content-Type"]="application/json",g(i,B);let v=c&&c.headers?c.headers:{};return l.headers={...p,...v,...a.headers},l.data=x(n,l,r),{url:y(i),options:l}},setState:async(t,e,s,n,a={})=>{C("setState","type",t),C("setState","id",e),C("setState","name",s);let o="/v1/chat/states/{type}/{id}/{name}".replace("{type}",encodeURIComponent(String(t))).replace("{id}",encodeURIComponent(String(e))).replace("{name}",encodeURIComponent(String(s))),i=new URL(o,d),c;r&&(c=r.baseOptions);let l={method:"POST",...c,...a},p={},B={};p["Content-Type"]="application/json",g(i,B);let v=c&&c.headers?c.headers:{};return l.headers={...p,...v,...a.headers},l.data=x(n,l,r),{url:y(i),options:l}},transferBot:async(t,e,s={})=>{C("transferBot","id",t);let n="/v1/admin/bots/{id}/transfer".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,d),o;r&&(o=r.baseOptions);let i={method:"POST",...o,...s},c={},l={};c["Content-Type"]="application/json",g(a,l);let p=o&&o.headers?o.headers:{};return i.headers={...c,...p,...s.headers},i.data=x(e,i,r),{url:y(a),options:i}},updateBot:async(t,e,s={})=>{C("updateBot","id",t);let n="/v1/admin/bots/{id}".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,d),o;r&&(o=r.baseOptions);let i={method:"PUT",...o,...s},c={},l={};c["Content-Type"]="application/json",g(a,l);let p=o&&o.headers?o.headers:{};return i.headers={...c,...p,...s.headers},i.data=x(e,i,r),{url:y(a),options:i}},updateConversation:async(t,e,s={})=>{C("updateConversation","id",t);let n="/v1/chat/conversations/{id}".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,d),o;r&&(o=r.baseOptions);let i={method:"PUT",...o,...s},c={},l={};c["Content-Type"]="application/json",g(a,l);let p=o&&o.headers?o.headers:{};return i.headers={...c,...p,...s.headers},i.data=x(e,i,r),{url:y(a),options:i}},updateIntegration:async(t,e,s={})=>{C("updateIntegration","id",t);let n="/v1/admin/integrations/{id}".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,d),o;r&&(o=r.baseOptions);let i={method:"PUT",...o,...s},c={},l={};c["Content-Type"]="application/json",g(a,l);let p=o&&o.headers?o.headers:{};return i.headers={...c,...p,...s.headers},i.data=x(e,i,r),{url:y(a),options:i}},updateMessage:async(t,e,s={})=>{C("updateMessage","id",t);let n="/v1/chat/messages/{id}".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,d),o;r&&(o=r.baseOptions);let i={method:"PUT",...o,...s},c={},l={};c["Content-Type"]="application/json",g(a,l);let p=o&&o.headers?o.headers:{};return i.headers={...c,...p,...s.headers},i.data=x(e,i,r),{url:y(a),options:i}},updateUser:async(t,e,s={})=>{C("updateUser","id",t);let n="/v1/chat/users/{id}".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,d),o;r&&(o=r.baseOptions);let i={method:"PUT",...o,...s},c={},l={};c["Content-Type"]="application/json",g(a,l);let p=o&&o.headers?o.headers:{};return i.headers={...c,...p,...s.headers},i.data=x(e,i,r),{url:y(a),options:i}}}},f=function(r){let t=ce(r);return{async callAction(e,s){let n=await t.callAction(e,s);return h(n,A,u,r)},async configureIntegration(e,s){let n=await t.configureIntegration(e,s);return h(n,A,u,r)},async createBot(e,s){let n=await t.createBot(e,s);return h(n,A,u,r)},async createConversation(e,s){let n=await t.createConversation(e,s);return h(n,A,u,r)},async createEvent(e,s){let n=await t.createEvent(e,s);return h(n,A,u,r)},async createFile(e,s){let n=await t.createFile(e,s);return h(n,A,u,r)},async createIntegration(e,s){let n=await t.createIntegration(e,s);return h(n,A,u,r)},async createMessage(e,s){let n=await t.createMessage(e,s);return h(n,A,u,r)},async createUser(e,s){let n=await t.createUser(e,s);return h(n,A,u,r)},async deleteBot(e,s){let n=await t.deleteBot(e,s);return h(n,A,u,r)},async deleteConversation(e,s){let n=await t.deleteConversation(e,s);return h(n,A,u,r)},async deleteFile(e,s){let n=await t.deleteFile(e,s);return h(n,A,u,r)},async deleteIntegration(e,s){let n=await t.deleteIntegration(e,s);return h(n,A,u,r)},async deleteMessage(e,s){let n=await t.deleteMessage(e,s);return h(n,A,u,r)},async deleteUser(e,s){let n=await t.deleteUser(e,s);return h(n,A,u,r)},async downloadFile(e,s){let n=await t.downloadFile(e,s);return h(n,A,u,r)},async getBot(e,s){let n=await t.getBot(e,s);return h(n,A,u,r)},async getBotAnalytics(e,s,n,a){let o=await t.getBotAnalytics(e,s,n,a);return h(o,A,u,r)},async getBotLogs(e,s){let n=await t.getBotLogs(e,s);return h(n,A,u,r)},async getBotWebchat(e,s,n){let a=await t.getBotWebchat(e,s,n);return h(a,A,u,r)},async getConversation(e,s){let n=await t.getConversation(e,s);return h(n,A,u,r)},async getEvent(e,s){let n=await t.getEvent(e,s);return h(n,A,u,r)},async getFile(e,s){let n=await t.getFile(e,s);return h(n,A,u,r)},async getIntegration(e,s){let n=await t.getIntegration(e,s);return h(n,A,u,r)},async getIntegrationByName(e,s,n){let a=await t.getIntegrationByName(e,s,n);return h(a,A,u,r)},async getIntegrationLogs(e,s){let n=await t.getIntegrationLogs(e,s);return h(n,A,u,r)},async getMessage(e,s){let n=await t.getMessage(e,s);return h(n,A,u,r)},async getOrCreateConversation(e,s){let n=await t.getOrCreateConversation(e,s);return h(n,A,u,r)},async getOrCreateMessage(e,s){let n=await t.getOrCreateMessage(e,s);return h(n,A,u,r)},async getOrCreateUser(e,s){let n=await t.getOrCreateUser(e,s);return h(n,A,u,r)},async getPublicIntegration(e,s,n){let a=await t.getPublicIntegration(e,s,n);return h(a,A,u,r)},async getPublicIntegrationById(e,s){let n=await t.getPublicIntegrationById(e,s);return h(n,A,u,r)},async getState(e,s,n,a){let o=await t.getState(e,s,n,a);return h(o,A,u,r)},async getUser(e,s){let n=await t.getUser(e,s);return h(n,A,u,r)},async getWorkspace(e,s){let n=await t.getWorkspace(e,s);return h(n,A,u,r)},async introspect(e,s){let n=await t.introspect(e,s);return h(n,A,u,r)},async listBots(e,s){let n=await t.listBots(e,s);return h(n,A,u,r)},async listConversations(e,s,n,a){let o=await t.listConversations(e,s,n,a);return h(o,A,u,r)},async listEvents(e,s,n){let a=await t.listEvents(e,s,n);return h(a,A,u,r)},async listFiles(e,s,n){let a=await t.listFiles(e,s,n);return h(a,A,u,r)},async listIntegrations(e,s,n,a){let o=await t.listIntegrations(e,s,n,a);return h(o,A,u,r)},async listMessages(e,s,n,a){let o=await t.listMessages(e,s,n,a);return h(o,A,u,r)},async listPublicIntegrations(e,s,n,a){let o=await t.listPublicIntegrations(e,s,n,a);return h(o,A,u,r)},async listUsers(e,s,n,a){let o=await t.listUsers(e,s,n,a);return h(o,A,u,r)},async listWorkspaces(e,s){let n=await t.listWorkspaces(e,s);return h(n,A,u,r)},async patchState(e,s,n,a,o){let i=await t.patchState(e,s,n,a,o);return h(i,A,u,r)},async setState(e,s,n,a,o){let i=await t.setState(e,s,n,a,o);return h(i,A,u,r)},async transferBot(e,s,n){let a=await t.transferBot(e,s,n);return h(a,A,u,r)},async updateBot(e,s,n){let a=await t.updateBot(e,s,n);return h(a,A,u,r)},async updateConversation(e,s,n){let a=await t.updateConversation(e,s,n);return h(a,A,u,r)},async updateIntegration(e,s,n){let a=await t.updateIntegration(e,s,n);return h(a,A,u,r)},async updateMessage(e,s,n){let a=await t.updateMessage(e,s,n);return h(a,A,u,r)},async updateUser(e,s,n){let a=await t.updateUser(e,s,n);return h(a,A,u,r)}}};var q=class extends I{callAction(t={},e){return f(this.configuration).callAction(t.callActionBody,e).then(s=>s(this.axios,this.basePath))}configureIntegration(t={},e){return f(this.configuration).configureIntegration(t.configureIntegrationBody,e).then(s=>s(this.axios,this.basePath))}createBot(t={},e){return f(this.configuration).createBot(t.createBotBody,e).then(s=>s(this.axios,this.basePath))}createConversation(t={},e){return f(this.configuration).createConversation(t.createConversationBody,e).then(s=>s(this.axios,this.basePath))}createEvent(t={},e){return f(this.configuration).createEvent(t.createEventBody,e).then(s=>s(this.axios,this.basePath))}createFile(t={},e){return f(this.configuration).createFile(t.createFileBody,e).then(s=>s(this.axios,this.basePath))}createIntegration(t={},e){return f(this.configuration).createIntegration(t.createIntegrationBody,e).then(s=>s(this.axios,this.basePath))}createMessage(t={},e){return f(this.configuration).createMessage(t.createMessageBody,e).then(s=>s(this.axios,this.basePath))}createUser(t={},e){return f(this.configuration).createUser(t.createUserBody,e).then(s=>s(this.axios,this.basePath))}deleteBot(t,e){return f(this.configuration).deleteBot(t.id,e).then(s=>s(this.axios,this.basePath))}deleteConversation(t,e){return f(this.configuration).deleteConversation(t.id,e).then(s=>s(this.axios,this.basePath))}deleteFile(t,e){return f(this.configuration).deleteFile(t.id,e).then(s=>s(this.axios,this.basePath))}deleteIntegration(t,e){return f(this.configuration).deleteIntegration(t.id,e).then(s=>s(this.axios,this.basePath))}deleteMessage(t,e){return f(this.configuration).deleteMessage(t.id,e).then(s=>s(this.axios,this.basePath))}deleteUser(t,e){return f(this.configuration).deleteUser(t.id,e).then(s=>s(this.axios,this.basePath))}downloadFile(t,e){return f(this.configuration).downloadFile(t.id,e).then(s=>s(this.axios,this.basePath))}getBot(t,e){return f(this.configuration).getBot(t.id,e).then(s=>s(this.axios,this.basePath))}getBotAnalytics(t,e){return f(this.configuration).getBotAnalytics(t.id,t.startDate,t.endDate,e).then(s=>s(this.axios,this.basePath))}getBotLogs(t,e){return f(this.configuration).getBotLogs(t.id,e).then(s=>s(this.axios,this.basePath))}getBotWebchat(t,e){return f(this.configuration).getBotWebchat(t.id,t.type,e).then(s=>s(this.axios,this.basePath))}getConversation(t,e){return f(this.configuration).getConversation(t.id,e).then(s=>s(this.axios,this.basePath))}getEvent(t,e){return f(this.configuration).getEvent(t.id,e).then(s=>s(this.axios,this.basePath))}getFile(t,e){return f(this.configuration).getFile(t.id,e).then(s=>s(this.axios,this.basePath))}getIntegration(t,e){return f(this.configuration).getIntegration(t.id,e).then(s=>s(this.axios,this.basePath))}getIntegrationByName(t,e){return f(this.configuration).getIntegrationByName(t.name,t.version,e).then(s=>s(this.axios,this.basePath))}getIntegrationLogs(t,e){return f(this.configuration).getIntegrationLogs(t.id,e).then(s=>s(this.axios,this.basePath))}getMessage(t,e){return f(this.configuration).getMessage(t.id,e).then(s=>s(this.axios,this.basePath))}getOrCreateConversation(t={},e){return f(this.configuration).getOrCreateConversation(t.getOrCreateConversationBody,e).then(s=>s(this.axios,this.basePath))}getOrCreateMessage(t={},e){return f(this.configuration).getOrCreateMessage(t.getOrCreateMessageBody,e).then(s=>s(this.axios,this.basePath))}getOrCreateUser(t={},e){return f(this.configuration).getOrCreateUser(t.getOrCreateUserBody,e).then(s=>s(this.axios,this.basePath))}getPublicIntegration(t,e){return f(this.configuration).getPublicIntegration(t.name,t.version,e).then(s=>s(this.axios,this.basePath))}getPublicIntegrationById(t,e){return f(this.configuration).getPublicIntegrationById(t.id,e).then(s=>s(this.axios,this.basePath))}getState(t,e){return f(this.configuration).getState(t.type,t.id,t.name,e).then(s=>s(this.axios,this.basePath))}getUser(t,e){return f(this.configuration).getUser(t.id,e).then(s=>s(this.axios,this.basePath))}getWorkspace(t,e){return f(this.configuration).getWorkspace(t.id,e).then(s=>s(this.axios,this.basePath))}introspect(t={},e){return f(this.configuration).introspect(t.introspectBody,e).then(s=>s(this.axios,this.basePath))}listBots(t={},e){return f(this.configuration).listBots(t.nextToken,e).then(s=>s(this.axios,this.basePath))}listConversations(t={},e){return f(this.configuration).listConversations(t.nextToken,t.tags,t.participantIds,e).then(s=>s(this.axios,this.basePath))}listEvents(t={},e){return f(this.configuration).listEvents(t.nextToken,t.type,e).then(s=>s(this.axios,this.basePath))}listFiles(t,e){return f(this.configuration).listFiles(t.botId,t.nextToken,e).then(s=>s(this.axios,this.basePath))}listIntegrations(t={},e){return f(this.configuration).listIntegrations(t.nextToken,t.name,t.version,e).then(s=>s(this.axios,this.basePath))}listMessages(t={},e){return f(this.configuration).listMessages(t.nextToken,t.conversationId,t.tags,e).then(s=>s(this.axios,this.basePath))}listPublicIntegrations(t={},e){return f(this.configuration).listPublicIntegrations(t.nextToken,t.name,t.version,e).then(s=>s(this.axios,this.basePath))}listUsers(t={},e){return f(this.configuration).listUsers(t.nextToken,t.conversationId,t.tags,e).then(s=>s(this.axios,this.basePath))}listWorkspaces(t={},e){return f(this.configuration).listWorkspaces(t.nextToken,e).then(s=>s(this.axios,this.basePath))}patchState(t,e){return f(this.configuration).patchState(t.type,t.id,t.name,t.patchStateBody,e).then(s=>s(this.axios,this.basePath))}setState(t,e){return f(this.configuration).setState(t.type,t.id,t.name,t.setStateBody,e).then(s=>s(this.axios,this.basePath))}transferBot(t,e){return f(this.configuration).transferBot(t.id,t.transferBotBody,e).then(s=>s(this.axios,this.basePath))}updateBot(t,e){return f(this.configuration).updateBot(t.id,t.updateBotBody,e).then(s=>s(this.axios,this.basePath))}updateConversation(t,e){return f(this.configuration).updateConversation(t.id,t.updateConversationBody,e).then(s=>s(this.axios,this.basePath))}updateIntegration(t,e){return f(this.configuration).updateIntegration(t.id,t.updateIntegrationBody,e).then(s=>s(this.axios,this.basePath))}updateMessage(t,e){return f(this.configuration).updateMessage(t.id,t.updateMessageBody,e).then(s=>s(this.axios,this.basePath))}updateUser(t,e){return f(this.configuration).updateUser(t.id,t.updateUserBody,e).then(s=>s(this.axios,this.basePath))}};var U=class{_innerClient;constructor(t,e,s){this._innerClient=new q(t,e,s)}createConversation=t=>this._innerClient.createConversation({createConversationBody:t}).then(e=>e.data).catch(e=>{throw R(e)});getConversation=t=>this._innerClient.getConversation(t).then(e=>e.data).catch(e=>{throw R(e)});listConversations=t=>this._innerClient.listConversations(t).then(e=>e.data).catch(e=>{throw R(e)});getOrCreateConversation=t=>this._innerClient.getOrCreateConversation({getOrCreateConversationBody:t}).then(e=>e.data).catch(e=>{throw R(e)});updateConversation=({id:t,...e})=>this._innerClient.updateConversation({id:t,updateConversationBody:e}).then(s=>s.data).catch(s=>{throw R(s)});deleteConversation=t=>this._innerClient.deleteConversation(t).then(e=>e.data).catch(e=>{throw R(e)});createEvent=t=>this._innerClient.createEvent({createEventBody:t}).then(e=>e.data).catch(e=>{throw R(e)});getEvent=t=>this._innerClient.getEvent(t).then(e=>e.data).catch(e=>{throw R(e)});listEvents=t=>this._innerClient.listEvents(t).then(e=>e.data).catch(e=>{throw R(e)});createMessage=t=>this._innerClient.createMessage({createMessageBody:t}).then(e=>e.data).catch(e=>{throw R(e)});getOrCreateMessage=t=>this._innerClient.getOrCreateMessage({getOrCreateMessageBody:t}).then(e=>e.data).catch(e=>{throw R(e)});getMessage=t=>this._innerClient.getMessage(t).then(e=>e.data).catch(e=>{throw R(e)});updateMessage=({id:t,...e})=>this._innerClient.updateMessage({id:t,updateMessageBody:e}).then(s=>s.data).catch(s=>{throw R(s)});listMessages=t=>this._innerClient.listMessages(t).then(e=>e.data).catch(e=>{throw R(e)});deleteMessage=t=>this._innerClient.deleteMessage(t).then(e=>e.data).catch(e=>{throw R(e)});createUser=t=>this._innerClient.createUser({createUserBody:t}).then(e=>e.data).catch(e=>{throw R(e)});getUser=t=>this._innerClient.getUser(t).then(e=>e.data).catch(e=>{throw R(e)});listUsers=t=>this._innerClient.listUsers(t).then(e=>e.data).catch(e=>{throw R(e)});getOrCreateUser=t=>this._innerClient.getOrCreateUser({getOrCreateUserBody:t}).then(e=>e.data).catch(e=>{throw R(e)});updateUser=({id:t,...e})=>this._innerClient.updateUser({id:t,updateUserBody:e}).then(s=>s.data).catch(s=>{throw R(s)});deleteUser=t=>this._innerClient.deleteUser(t).then(e=>e.data).catch(e=>{throw R(e)});getState=t=>this._innerClient.getState(t).then(e=>e.data).catch(e=>{throw R(e)});setState=({type:t,id:e,name:s,...n})=>this._innerClient.setState({type:t,id:e,name:s,setStateBody:n}).then(a=>a.data).catch(a=>{throw R(a)});patchState=({type:t,id:e,name:s,...n})=>this._innerClient.patchState({type:t,id:e,name:s,patchStateBody:n}).then(a=>a.data).catch(a=>{throw R(a)});callAction=t=>this._innerClient.callAction({callActionBody:t}).then(e=>e.data).catch(e=>{throw R(e)});configureIntegration=t=>this._innerClient.configureIntegration({configureIntegrationBody:t}).then(e=>e.data).catch(e=>{throw R(e)});listPublicIntegrations=t=>this._innerClient.listPublicIntegrations(t).then(e=>e.data).catch(e=>{throw R(e)});getPublicIntegrationById=t=>this._innerClient.getPublicIntegrationById(t).then(e=>e.data).catch(e=>{throw R(e)});getPublicIntegration=t=>this._innerClient.getPublicIntegration(t).then(e=>e.data).catch(e=>{throw R(e)});createBot=t=>this._innerClient.createBot({createBotBody:t}).then(e=>e.data).catch(e=>{throw R(e)});updateBot=({id:t,...e})=>this._innerClient.updateBot({id:t,updateBotBody:e}).then(s=>s.data).catch(s=>{throw R(s)});transferBot=({id:t,...e})=>this._innerClient.transferBot({id:t,transferBotBody:e}).then(s=>s.data).catch(s=>{throw R(s)});listBots=t=>this._innerClient.listBots(t).then(e=>e.data).catch(e=>{throw R(e)});getBot=t=>this._innerClient.getBot(t).then(e=>e.data).catch(e=>{throw R(e)});deleteBot=t=>this._innerClient.deleteBot(t).then(e=>e.data).catch(e=>{throw R(e)});getBotLogs=t=>this._innerClient.getBotLogs(t).then(e=>e.data).catch(e=>{throw R(e)});getBotWebchat=t=>this._innerClient.getBotWebchat(t).then(e=>e.data).catch(e=>{throw R(e)});getBotAnalytics=t=>this._innerClient.getBotAnalytics(t).then(e=>e.data).catch(e=>{throw R(e)});getWorkspace=t=>this._innerClient.getWorkspace(t).then(e=>e.data).catch(e=>{throw R(e)});listWorkspaces=t=>this._innerClient.listWorkspaces(t).then(e=>e.data).catch(e=>{throw R(e)});createIntegration=t=>this._innerClient.createIntegration({createIntegrationBody:t}).then(e=>e.data).catch(e=>{throw R(e)});updateIntegration=({id:t,...e})=>this._innerClient.updateIntegration({id:t,updateIntegrationBody:e}).then(s=>s.data).catch(s=>{throw R(s)});listIntegrations=t=>this._innerClient.listIntegrations(t).then(e=>e.data).catch(e=>{throw R(e)});getIntegration=t=>this._innerClient.getIntegration(t).then(e=>e.data).catch(e=>{throw R(e)});getIntegrationLogs=t=>this._innerClient.getIntegrationLogs(t).then(e=>e.data).catch(e=>{throw R(e)});getIntegrationByName=t=>this._innerClient.getIntegrationByName(t).then(e=>e.data).catch(e=>{throw R(e)});deleteIntegration=t=>this._innerClient.deleteIntegration(t).then(e=>e.data).catch(e=>{throw R(e)});introspect=t=>this._innerClient.introspect({introspectBody:t}).then(e=>e.data).catch(e=>{throw R(e)});createFile=t=>this._innerClient.createFile({createFileBody:t}).then(e=>e.data).catch(e=>{throw R(e)});getFile=t=>this._innerClient.getFile(t).then(e=>e.data).catch(e=>{throw R(e)});downloadFile=t=>this._innerClient.downloadFile(t).then(e=>e.data).catch(e=>{throw R(e)});deleteFile=t=>this._innerClient.deleteFile(t).then(e=>e.data).catch(e=>{throw R(e)});listFiles=t=>this._innerClient.listFiles(t).then(e=>e.data).catch(e=>{throw R(e)})};function R(r){return pe.isAxiosError(r)?Q(r.response?.data):Q(r)}var z=class extends U{config;constructor(t={}){let e=J(t),{host:s,headers:n,withCredentials:a,timeout:o}=e,i=ue.create({maxBodyLength:100*1024*1024,maxContentLength:1024*1024*1024,timeout:o??6e4,withCredentials:a,headers:n});super(void 0,s,i),this.config=e}};export{z as Client,T as ForbiddenError,V as InternalError,L as InvalidDataFormatError,k as InvalidIdentifierError,G as InvalidJsonSchemaError,E as InvalidPayloadError,N as InvalidQueryError,M as MethodNotFoundError,D as PayloadTooLargeError,_ as ReferenceNotFoundError,F as RelationConflictError,w as ResourceNotFoundError,j as RuntimeError,O as UnauthorizedError,P as UnknownError,S as UnsupportedMediaTypeError,Qt as axios,Q as errorFrom,ne as isApiError};
|
package/openapi.ts
ADDED
package/package.json
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botpress/client",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Botpress Client",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"license": "MIT",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build:type": "tsc --emitDeclarationOnly --declaration --target es2019 --module commonjs --moduleResolution node --lib es2019",
|
|
11
|
+
"build:browser": "esbuild --bundle --external:axios --external:browser-or-node --platform=browser --format=esm --minify --outfile=dist/index.mjs src/index.ts",
|
|
12
|
+
"build:node": "esbuild --bundle --external:axios --external:browser-or-node --platform=node --minify --sourcemap --outfile=dist/index.cjs src/index.ts",
|
|
13
|
+
"build:bundle": "esbuild --bundle --platform=node --minify --sourcemap --outfile=dist/bundle.cjs src/index.ts",
|
|
14
|
+
"build": "pnpm build:type && pnpm build:node && pnpm build:browser && pnpm build:bundle",
|
|
15
|
+
"type:check": "tsc --noEmit --target es2019 --module commonjs --moduleResolution node --lib es2019",
|
|
16
|
+
"generate": "ts-node ./openapi.ts"
|
|
17
|
+
},
|
|
9
18
|
"dependencies": {
|
|
10
19
|
"axios": "1.2.5",
|
|
11
20
|
"browser-or-node": "^2.1.1",
|
|
12
21
|
"type-fest": "^3.4.0"
|
|
13
22
|
},
|
|
14
23
|
"devDependencies": {
|
|
15
|
-
"esbuild": "^0.16.12"
|
|
16
|
-
|
|
17
|
-
"scripts": {
|
|
18
|
-
"build:type": "tsc --emitDeclarationOnly --declaration --target es2019 --module commonjs --moduleResolution node --lib es2019",
|
|
19
|
-
"build:browser": "esbuild --bundle --external:axios --external:browser-or-node --platform=browser --format=esm --minify --outfile=dist/index.mjs src/index.ts",
|
|
20
|
-
"build:node": "esbuild --bundle --external:axios --external:browser-or-node --platform=node --minify --sourcemap --outfile=dist/index.cjs src/index.ts",
|
|
21
|
-
"build:bundle": "esbuild --bundle --platform=node --minify --sourcemap --outfile=dist/bundle.cjs src/index.ts",
|
|
22
|
-
"build": "pnpm build:type && pnpm build:node && pnpm build:browser && pnpm build:bundle"
|
|
24
|
+
"esbuild": "^0.16.12",
|
|
25
|
+
"@botpress/api": "0.3.0"
|
|
23
26
|
}
|
|
24
|
-
}
|
|
27
|
+
}
|