@botpress/api 0.5.3 → 0.5.5

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.
@@ -2577,7 +2577,7 @@ export declare const state: {
2577
2577
  listWorkspaceMembers: {
2578
2578
  name: string;
2579
2579
  description: string;
2580
- section: "workspaceMembers";
2580
+ section: "workspaceMember";
2581
2581
  method: "get";
2582
2582
  path: string;
2583
2583
  parameters: {
@@ -2635,7 +2635,7 @@ export declare const state: {
2635
2635
  deleteWorkspaceMember: {
2636
2636
  name: string;
2637
2637
  description: string;
2638
- section: "workspaceMembers";
2638
+ section: "workspaceMember";
2639
2639
  method: "delete";
2640
2640
  path: string;
2641
2641
  parameters: {
@@ -2657,7 +2657,7 @@ export declare const state: {
2657
2657
  createWorkspaceMember: {
2658
2658
  name: string;
2659
2659
  description: string;
2660
- section: "workspaceMembers";
2660
+ section: "workspaceMember";
2661
2661
  method: "post";
2662
2662
  path: string;
2663
2663
  requestBody: {
@@ -2709,7 +2709,7 @@ export declare const state: {
2709
2709
  updateWorkspaceMember: {
2710
2710
  name: string;
2711
2711
  description: string;
2712
- section: "workspaceMembers";
2712
+ section: "workspaceMember";
2713
2713
  method: "put";
2714
2714
  path: string;
2715
2715
  parameters: {
@@ -3990,6 +3990,7 @@ export declare const state: {
3990
3990
  Bot: true;
3991
3991
  Integration: true;
3992
3992
  Workspace: true;
3993
+ WorkspaceMember: true;
3993
3994
  User: true;
3994
3995
  Conversation: true;
3995
3996
  Event: true;
@@ -4664,6 +4665,30 @@ export declare const state: {
4664
4665
  additionalProperties: false;
4665
4666
  };
4666
4667
  };
4668
+ WorkspaceMember: {
4669
+ section: "workspaceMember";
4670
+ schema: {
4671
+ type: "object";
4672
+ properties: {
4673
+ id: {
4674
+ type: "string";
4675
+ };
4676
+ userId: {
4677
+ type: "string";
4678
+ format: string;
4679
+ };
4680
+ email: {
4681
+ type: "string";
4682
+ };
4683
+ role: {
4684
+ type: "string";
4685
+ enum: string[];
4686
+ };
4687
+ };
4688
+ required: string[];
4689
+ additionalProperties: false;
4690
+ };
4691
+ };
4667
4692
  User: {
4668
4693
  section: "user";
4669
4694
  schema: {
@@ -4975,8 +5000,8 @@ export declare const state: {
4975
5000
  } | {
4976
5001
  description: string;
4977
5002
  title: string;
4978
- name: "workspaceMembers";
5003
+ name: "workspaceMember";
4979
5004
  operations: string[];
4980
- schema?: undefined;
5005
+ schema: string;
4981
5006
  })[];
4982
5007
  };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export declare const api: {
2
- getModelRef: (name: "Bot" | "Integration" | "Workspace" | "User" | "Conversation" | "Event" | "Message" | "State" | "File") => import("@bpinternal/opapi").OpenApiZodAny;
3
- addOperation: <Path extends string>(operationProps: import("@bpinternal/opapi").Operation<"x-workspace-id", "user" | "conversation" | "event" | "message" | "file" | "state" | "hub" | "action" | "bot" | "integration" | "workspace" | "workspaceMembers", Path, "zod-schema">) => void;
2
+ getModelRef: (name: "Bot" | "Integration" | "Workspace" | "WorkspaceMember" | "User" | "Conversation" | "Event" | "Message" | "State" | "File") => import("@bpinternal/opapi").OpenApiZodAny;
3
+ addOperation: <Path extends string>(operationProps: import("@bpinternal/opapi").Operation<"x-workspace-id", "user" | "conversation" | "event" | "message" | "file" | "state" | "hub" | "action" | "bot" | "integration" | "workspace" | "workspaceMember", Path, "zod-schema">) => void;
4
4
  exportClient: (dir: string | undefined, openapiGeneratorEndpoint: string, postProcessors?: import("@bpinternal/opapi").OpenApiPostProcessors | undefined) => Promise<void>;
5
5
  exportTypesBySection: (dir?: string | undefined) => Promise<void>;
6
6
  exportServer: (dir: string | undefined, useExpressTypes: boolean) => Promise<void>;
package/dist/index.js CHANGED
@@ -258872,7 +258872,7 @@ __export(src_exports, {
258872
258872
  });
258873
258873
  module.exports = __toCommonJS(src_exports);
258874
258874
 
258875
- // ../../node_modules/.pnpm/@bpinternal+opapi@0.3.0_openapi-types@12.1.0/node_modules/@bpinternal/opapi/dist/index.mjs
258875
+ // ../../node_modules/.pnpm/@bpinternal+opapi@0.3.1_openapi-types@12.1.0/node_modules/@bpinternal/opapi/dist/index.mjs
258876
258876
  var import_zod_openapi = __toESM(require_src(), 1);
258877
258877
  var import_zod_openapi2 = __toESM(require_src(), 1);
258878
258878
  var import_chalk = __toESM(require_source(), 1);
@@ -258916,7 +258916,7 @@ var title = (str2) => {
258916
258916
  return str2.split(/(?=[A-Z])|[\.\-\s_]/).map((s) => s.trim()).filter((s) => !!s).map((s) => capitalize(s.toLowerCase())).join(" ");
258917
258917
  };
258918
258918
 
258919
- // ../../node_modules/.pnpm/@bpinternal+opapi@0.3.0_openapi-types@12.1.0/node_modules/@bpinternal/opapi/dist/index.mjs
258919
+ // ../../node_modules/.pnpm/@bpinternal+opapi@0.3.1_openapi-types@12.1.0/node_modules/@bpinternal/opapi/dist/index.mjs
258920
258920
  var import_decompress = __toESM(require_decompress(), 1);
258921
258921
  var import_fs2 = __toESM(require("fs"), 1);
258922
258922
  var import_promises = __toESM(require("fs/promises"), 1);
@@ -265905,7 +265905,7 @@ async function openapiTS(schema3, options = {}) {
265905
265905
  }
265906
265906
  var dist_default = openapiTS;
265907
265907
 
265908
- // ../../node_modules/.pnpm/@bpinternal+opapi@0.3.0_openapi-types@12.1.0/node_modules/@bpinternal/opapi/dist/index.mjs
265908
+ // ../../node_modules/.pnpm/@bpinternal+opapi@0.3.1_openapi-types@12.1.0/node_modules/@bpinternal/opapi/dist/index.mjs
265909
265909
  var import_zod_openapi3 = __toESM(require_src(), 1);
265910
265910
  var import_openapi3_ts = __toESM(require_dist3(), 1);
265911
265911
  var import_verror2 = __toESM(require_verror(), 1);
@@ -269500,7 +269500,7 @@ var z = /* @__PURE__ */ Object.freeze({
269500
269500
  ZodError
269501
269501
  });
269502
269502
 
269503
- // ../../node_modules/.pnpm/@bpinternal+opapi@0.3.0_openapi-types@12.1.0/node_modules/@bpinternal/opapi/dist/index.mjs
269503
+ // ../../node_modules/.pnpm/@bpinternal+opapi@0.3.1_openapi-types@12.1.0/node_modules/@bpinternal/opapi/dist/index.mjs
269504
269504
  var import_openapi_parser = __toESM(require_lib11(), 1);
269505
269505
  var import_json_schema_to_typescript = __toESM(require_src3(), 1);
269506
269506
  var import_zod_openapi4 = __toESM(require_src(), 1);
@@ -424710,10 +424710,9 @@ ${operations.map((operation) => generateMethod(operation)).join("\n")}
424710
424710
  ${operations.map((operation) => generatePropsType(operation)).join("\n")}
424711
424711
 
424712
424712
  function getError(err: Error) {
424713
- if (axios.isAxiosError(err)) {
424714
- return errorFrom(err.response?.data)
424713
+ if (axios.isAxiosError(err) && err.response?.data) {
424714
+ return errorFrom(err.response.data)
424715
424715
  }
424716
-
424717
424716
  return errorFrom(err)
424718
424717
  }
424719
424718
  `;
@@ -424926,6 +424925,19 @@ ${Object.entries(codes).map(([name, code]) => ` ${name}: ${code},`).join("\n")}
424926
424925
 
424927
424926
  type ErrorCode = typeof codes[keyof typeof codes]
424928
424927
 
424928
+ declare const window: any
424929
+ type CryptoLib = { getRandomValues(array: Uint8Array): number[] }
424930
+
424931
+ let cryptoLib: CryptoLib =
424932
+ typeof window !== 'undefined' && typeof window.document !== 'undefined'
424933
+ ? window.crypto
424934
+ ? window.crypto // Note: On browsers we need to use window.crypto instead of the imported crypto module as the latter is externalized and doesn't have getRandomValues().
424935
+ : {
424936
+ // Fallback in case crypto isn't available.
424937
+ getRandomValues: (array: Uint8Array) => new Uint8Array(array.map(() => Math.floor(Math.random() * 256))),
424938
+ }
424939
+ : crypto
424940
+
424929
424941
  abstract class BaseApiError<Code extends ErrorCode, Type extends string, Description extends string> extends Error {
424930
424942
  public readonly isApiError = true
424931
424943
 
@@ -428490,7 +428502,7 @@ var state = {
428490
428502
  listWorkspaceMembers: {
428491
428503
  name: "listWorkspaceMembers",
428492
428504
  description: "Lists all the members in a workspace",
428493
- section: "workspaceMembers",
428505
+ section: "workspaceMember",
428494
428506
  method: "get",
428495
428507
  path: "/v1/admin/workspace-members",
428496
428508
  parameters: {
@@ -428555,7 +428567,7 @@ var state = {
428555
428567
  deleteWorkspaceMember: {
428556
428568
  name: "deleteWorkspaceMember",
428557
428569
  description: "Remove a member of a workspace",
428558
- section: "workspaceMembers",
428570
+ section: "workspaceMember",
428559
428571
  method: "delete",
428560
428572
  path: "/v1/admin/workspace-members/{id}",
428561
428573
  parameters: {
@@ -428577,7 +428589,7 @@ var state = {
428577
428589
  createWorkspaceMember: {
428578
428590
  name: "createWorkspaceMember",
428579
428591
  description: "Add a member to the workspace",
428580
- section: "workspaceMembers",
428592
+ section: "workspaceMember",
428581
428593
  method: "post",
428582
428594
  path: "/v1/admin/workspace-members",
428583
428595
  requestBody: {
@@ -428643,7 +428655,7 @@ var state = {
428643
428655
  updateWorkspaceMember: {
428644
428656
  name: "updateWorkspaceMember",
428645
428657
  description: "Update the member of a workspace",
428646
- section: "workspaceMembers",
428658
+ section: "workspaceMember",
428647
428659
  method: "put",
428648
428660
  path: "/v1/admin/workspace-members/{id}",
428649
428661
  parameters: {
@@ -429801,7 +429813,7 @@ var state = {
429801
429813
  title: "Botpress API",
429802
429814
  description: "API for Botpress Cloud",
429803
429815
  server: "https://api.botpress.cloud",
429804
- version: "0.5.3",
429816
+ version: "0.5.5",
429805
429817
  prefix: "v1"
429806
429818
  },
429807
429819
  errors: [
@@ -429999,6 +430011,7 @@ var state = {
429999
430011
  Bot: true,
430000
430012
  Integration: true,
430001
430013
  Workspace: true,
430014
+ WorkspaceMember: true,
430002
430015
  User: true,
430003
430016
  Conversation: true,
430004
430017
  Event: true,
@@ -430737,6 +430750,37 @@ var state = {
430737
430750
  additionalProperties: false
430738
430751
  }
430739
430752
  },
430753
+ WorkspaceMember: {
430754
+ section: "workspaceMember",
430755
+ schema: {
430756
+ type: "object",
430757
+ properties: {
430758
+ id: {
430759
+ type: "string"
430760
+ },
430761
+ userId: {
430762
+ type: "string",
430763
+ format: "uuid"
430764
+ },
430765
+ email: {
430766
+ type: "string"
430767
+ },
430768
+ role: {
430769
+ type: "string",
430770
+ enum: [
430771
+ "viewer",
430772
+ "billing",
430773
+ "developer",
430774
+ "manager",
430775
+ "administrator",
430776
+ "owner"
430777
+ ]
430778
+ }
430779
+ },
430780
+ required: ["id", "email", "role"],
430781
+ additionalProperties: false
430782
+ }
430783
+ },
430740
430784
  User: {
430741
430785
  section: "user",
430742
430786
  schema: {
@@ -431138,14 +431182,15 @@ var state = {
431138
431182
  },
431139
431183
  {
431140
431184
  description: "",
431141
- title: "Workspace Members",
431142
- name: "workspaceMembers",
431185
+ title: "Workspace Member",
431186
+ name: "workspaceMember",
431143
431187
  operations: [
431144
431188
  "listWorkspaceMembers",
431145
431189
  "deleteWorkspaceMember",
431146
431190
  "createWorkspaceMember",
431147
431191
  "updateWorkspaceMember"
431148
- ]
431192
+ ],
431193
+ schema: "WorkspaceMember"
431149
431194
  }
431150
431195
  ]
431151
431196
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botpress/api",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -13,15 +13,15 @@
13
13
  "build": "pnpm run build:type && pnpm run build:impl"
14
14
  },
15
15
  "devDependencies": {
16
- "esbuild": "^0.16.10",
17
- "esb-node": "0.0.1",
18
- "@botpress/common": "*",
19
16
  "@botpress/bridge": "*",
20
17
  "@botpress/cloud-manager": "*",
18
+ "@botpress/common": "*",
21
19
  "@botpress/storage": "*",
20
+ "esb-node": "0.0.1",
21
+ "esbuild": "^0.16.10",
22
22
  "zod": "^3.20.6"
23
23
  },
24
24
  "dependencies": {
25
- "@bpinternal/opapi": "0.3.0"
25
+ "@bpinternal/opapi": "0.3.1"
26
26
  }
27
27
  }
@@ -1 +1 @@
1
- {"sections":[{"description":"","title":"User","name":"user","operations":["createUser","getUser","listUsers","getOrCreateUser","updateUser","deleteUser"],"schema":"User"},{"description":"","title":"Conversation","name":"conversation","operations":["createConversation","getConversation","listConversations","getOrCreateConversation","updateConversation","deleteConversation"],"schema":"Conversation"},{"description":"","title":"Event","name":"event","operations":["createEvent","getEvent","listEvents"],"schema":"Event"},{"description":"","title":"Message","name":"message","operations":["createMessage","getOrCreateMessage","getMessage","updateMessage","listMessages","deleteMessage"],"schema":"Message"},{"description":"","title":"File","name":"file","operations":["createFile","getFile","downloadFile","deleteFile","listFiles"],"schema":"File"},{"description":"","title":"State","name":"state","operations":["getState","setState","patchState"],"schema":"State"},{"description":"","title":"Hub","name":"hub","operations":["listPublicIntegrations","getPublicIntegrationById","getPublicIntegration"]},{"description":"","title":"Action","name":"action","operations":["callAction"]},{"description":"","title":"Bot","name":"bot","operations":["createBot","updateBot","transferBot","listBots","getBot","deleteBot","getBotLogs","getBotWebchat","getBotAnalytics"],"schema":"Bot"},{"description":"","title":"Integration","name":"integration","operations":["createIntegration","updateIntegration","listIntegrations","getIntegration","getIntegrationLogs","getIntegrationByName","deleteIntegration"],"schema":"Integration"},{"description":"","title":"Workspace","name":"workspace","operations":["createWorkspace","getWorkspace","updateWorkspace","listWorkspaces","changeWorkspacePlan","deleteWorkspace","getAuditRecords"],"schema":"Workspace"},{"description":"","title":"Workspace Members","name":"workspaceMembers","operations":["listWorkspaceMembers","deleteWorkspaceMember","createWorkspaceMember","updateWorkspaceMember"]}],"errors":[{"status":500,"type":"Unknown","description":"An unknown error occurred"},{"status":500,"type":"Internal","description":"An internal error occurred"},{"status":401,"type":"Unauthorized","description":"The request requires to be authenticated."},{"status":403,"type":"Forbidden","description":"The requested action can't be peform by this resource."},{"status":413,"type":"PayloadTooLarge","description":"The request payload is too large."},{"status":400,"type":"InvalidPayload","description":"The request payload is invalid."},{"status":415,"type":"UnsupportedMediaType","description":"The request is invalid because the content-type is not supported."},{"status":405,"type":"MethodNotFound","description":"The requested method does not exist."},{"status":404,"type":"ResourceNotFound","description":"The requested resource does not exist."},{"status":400,"type":"InvalidJsonSchema","description":"The provided JSON schema is invalid."},{"status":400,"type":"InvalidDataFormat","description":"The provided data doesn't respect the provided JSON schema."},{"status":400,"type":"InvalidIdentifier","description":"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."},{"status":409,"type":"RelationConflict","description":"The resource is not related with another resource. This is usually caused when providing two resources that aren't linked together."},{"status":400,"type":"ReferenceNotFound","description":"The provided resource reference is missing. This is usually caused when providing an invalid id inside the payload of a request."},{"status":400,"type":"InvalidQuery","description":"The provided query is invalid. This is usually caused when providing an invalid parameter for querying a resource."},{"status":400,"type":"Runtime","description":"An error happened during the execution of a runtime (bot or integration)."},{"status":409,"type":"AlreadyExists","description":"The record attempted to be created already exists."},{"status":429,"type":"RateLimited","description":"The request has been rate limited."},{"status":402,"type":"PaymentRequired","description":"A payment is required to perform this request."}]}
1
+ {"sections":[{"description":"","title":"User","name":"user","operations":["createUser","getUser","listUsers","getOrCreateUser","updateUser","deleteUser"],"schema":"User"},{"description":"","title":"Conversation","name":"conversation","operations":["createConversation","getConversation","listConversations","getOrCreateConversation","updateConversation","deleteConversation"],"schema":"Conversation"},{"description":"","title":"Event","name":"event","operations":["createEvent","getEvent","listEvents"],"schema":"Event"},{"description":"","title":"Message","name":"message","operations":["createMessage","getOrCreateMessage","getMessage","updateMessage","listMessages","deleteMessage"],"schema":"Message"},{"description":"","title":"File","name":"file","operations":["createFile","getFile","downloadFile","deleteFile","listFiles"],"schema":"File"},{"description":"","title":"State","name":"state","operations":["getState","setState","patchState"],"schema":"State"},{"description":"","title":"Hub","name":"hub","operations":["listPublicIntegrations","getPublicIntegrationById","getPublicIntegration"]},{"description":"","title":"Action","name":"action","operations":["callAction"]},{"description":"","title":"Bot","name":"bot","operations":["createBot","updateBot","transferBot","listBots","getBot","deleteBot","getBotLogs","getBotWebchat","getBotAnalytics"],"schema":"Bot"},{"description":"","title":"Integration","name":"integration","operations":["createIntegration","updateIntegration","listIntegrations","getIntegration","getIntegrationLogs","getIntegrationByName","deleteIntegration"],"schema":"Integration"},{"description":"","title":"Workspace","name":"workspace","operations":["createWorkspace","getWorkspace","updateWorkspace","listWorkspaces","changeWorkspacePlan","deleteWorkspace","getAuditRecords"],"schema":"Workspace"},{"description":"","title":"Workspace Member","name":"workspaceMember","operations":["listWorkspaceMembers","deleteWorkspaceMember","createWorkspaceMember","updateWorkspaceMember"],"schema":"WorkspaceMember"}],"errors":[{"status":500,"type":"Unknown","description":"An unknown error occurred"},{"status":500,"type":"Internal","description":"An internal error occurred"},{"status":401,"type":"Unauthorized","description":"The request requires to be authenticated."},{"status":403,"type":"Forbidden","description":"The requested action can't be peform by this resource."},{"status":413,"type":"PayloadTooLarge","description":"The request payload is too large."},{"status":400,"type":"InvalidPayload","description":"The request payload is invalid."},{"status":415,"type":"UnsupportedMediaType","description":"The request is invalid because the content-type is not supported."},{"status":405,"type":"MethodNotFound","description":"The requested method does not exist."},{"status":404,"type":"ResourceNotFound","description":"The requested resource does not exist."},{"status":400,"type":"InvalidJsonSchema","description":"The provided JSON schema is invalid."},{"status":400,"type":"InvalidDataFormat","description":"The provided data doesn't respect the provided JSON schema."},{"status":400,"type":"InvalidIdentifier","description":"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."},{"status":409,"type":"RelationConflict","description":"The resource is not related with another resource. This is usually caused when providing two resources that aren't linked together."},{"status":400,"type":"ReferenceNotFound","description":"The provided resource reference is missing. This is usually caused when providing an invalid id inside the payload of a request."},{"status":400,"type":"InvalidQuery","description":"The provided query is invalid. This is usually caused when providing an invalid parameter for querying a resource."},{"status":400,"type":"Runtime","description":"An error happened during the execution of a runtime (bot or integration)."},{"status":409,"type":"AlreadyExists","description":"The record attempted to be created already exists."},{"status":429,"type":"RateLimited","description":"The request has been rate limited."},{"status":402,"type":"PaymentRequired","description":"A payment is required to perform this request."}]}