@botpress/api 0.7.0 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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.3_openapi-types@12.1.0/node_modules/@bpinternal/opapi/dist/index.mjs
258875
+ // ../../node_modules/.pnpm/@bpinternal+opapi@0.3.4_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.3_openapi-types@12.1.0/node_modules/@bpinternal/opapi/dist/index.mjs
258919
+ // ../../node_modules/.pnpm/@bpinternal+opapi@0.3.4_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.3_openapi-types@12.1.0/node_modules/@bpinternal/opapi/dist/index.mjs
265908
+ // ../../node_modules/.pnpm/@bpinternal+opapi@0.3.4_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.3_openapi-types@12.1.0/node_modules/@bpinternal/opapi/dist/index.mjs
269503
+ // ../../node_modules/.pnpm/@bpinternal+opapi@0.3.4_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);
@@ -425650,6 +425650,24 @@ var generateClient = async (state2, dir = ".", openApiGeneratorEndpoint, postPro
425650
425650
  removeLineFromFiles(dir, invalidLine);
425651
425651
  log_default.info("");
425652
425652
  };
425653
+ function generateErrorsFile(errors, dir = ".") {
425654
+ initDirectory(dir);
425655
+ log_default.info("Generating error types");
425656
+ if (!errors || errors.length === 0) {
425657
+ throw new import_verror.VError("No errors defined");
425658
+ }
425659
+ const errorCode = generateErrors(errors);
425660
+ log_default.info("");
425661
+ log_default.info("Saving generated files");
425662
+ saveFile(dir, "errors.ts", errorCode);
425663
+ log_default.info("");
425664
+ log_default.info(`Appending header to typescript files in ${import_chalk.default.blue(dir)}`);
425665
+ appendHeaders(dir, tsFileHeader);
425666
+ log_default.info("");
425667
+ log_default.info("Removing invalid line from typescript files");
425668
+ removeLineFromFiles(dir, invalidLine);
425669
+ log_default.info("");
425670
+ }
425653
425671
  function generateOpenapi(state2, dir = ".") {
425654
425672
  initDirectory(dir);
425655
425673
  log_default.info("Generating openapi content");
@@ -425824,7 +425842,8 @@ var createOpapiFromState = (state2) => {
425824
425842
  exportTypesBySection: (dir = ".") => generateTypesBySection(state2, dir),
425825
425843
  exportServer: (dir = ".", useExpressTypes) => generateServer(state2, dir, useExpressTypes),
425826
425844
  exportOpenapi: (dir = ".") => generateOpenapi(state2, dir),
425827
- exportState: (dir = ".") => exportStateAsTypescript(state2, dir)
425845
+ exportState: (dir = ".") => exportStateAsTypescript(state2, dir),
425846
+ exportErrors: (dir = ".") => generateErrorsFile(state2.errors ?? [], dir)
425828
425847
  };
425829
425848
  };
425830
425849
  function OpenApi(props) {
@@ -427035,6 +427054,130 @@ var state = {
427035
427054
  },
427036
427055
  parameters: {}
427037
427056
  },
427057
+ listPersonalAccessTokens: {
427058
+ name: "listPersonalAccessTokens",
427059
+ description: "List PATs (Personal Access Tokens) of account.",
427060
+ method: "get",
427061
+ path: "/v1/admin/account/pats",
427062
+ section: "account",
427063
+ disableDefaultParameters: {
427064
+ "x-workspace-id": true
427065
+ },
427066
+ response: {
427067
+ description: "Success",
427068
+ schema: {
427069
+ type: "object",
427070
+ properties: {
427071
+ pats: {
427072
+ type: "array",
427073
+ items: {
427074
+ type: "object",
427075
+ properties: {
427076
+ id: {
427077
+ type: "string"
427078
+ },
427079
+ createdAt: {
427080
+ type: "string",
427081
+ format: "date-time"
427082
+ },
427083
+ note: {
427084
+ type: "string"
427085
+ }
427086
+ },
427087
+ required: ["id", "createdAt", "note"]
427088
+ }
427089
+ }
427090
+ },
427091
+ required: ["pats"],
427092
+ title: "listPersonalAccessTokensResponse",
427093
+ additionalProperties: false
427094
+ }
427095
+ },
427096
+ parameters: {}
427097
+ },
427098
+ createPersonalAccessToken: {
427099
+ name: "createPersonalAccessToken",
427100
+ description: "Create a PAT",
427101
+ method: "post",
427102
+ path: "/v1/admin/account/pats",
427103
+ section: "account",
427104
+ disableDefaultParameters: {
427105
+ "x-workspace-id": true
427106
+ },
427107
+ requestBody: {
427108
+ description: "",
427109
+ schema: {
427110
+ type: "object",
427111
+ properties: {
427112
+ note: {
427113
+ type: "string",
427114
+ description: "Note to identify the PAT"
427115
+ }
427116
+ },
427117
+ required: ["note"],
427118
+ title: "createPersonalAccessTokenBody",
427119
+ additionalProperties: false
427120
+ }
427121
+ },
427122
+ response: {
427123
+ description: "Success",
427124
+ schema: {
427125
+ type: "object",
427126
+ properties: {
427127
+ pat: {
427128
+ type: "object",
427129
+ properties: {
427130
+ id: {
427131
+ type: "string"
427132
+ },
427133
+ createdAt: {
427134
+ type: "string",
427135
+ format: "date-time"
427136
+ },
427137
+ note: {
427138
+ type: "string"
427139
+ },
427140
+ value: {
427141
+ type: "string",
427142
+ description: "The PAT value. This will only be returned here when created and cannot be retrieved later."
427143
+ }
427144
+ },
427145
+ required: ["id", "createdAt", "note", "value"],
427146
+ additionalProperties: false
427147
+ }
427148
+ },
427149
+ required: ["pat"],
427150
+ title: "createPersonalAccessTokenResponse",
427151
+ additionalProperties: false
427152
+ }
427153
+ },
427154
+ parameters: {}
427155
+ },
427156
+ deletePersonalAccessToken: {
427157
+ name: "deletePersonalAccessToken",
427158
+ description: "Delete a PAT",
427159
+ method: "delete",
427160
+ path: "/v1/admin/account/pats/{id}",
427161
+ section: "account",
427162
+ disableDefaultParameters: {
427163
+ "x-workspace-id": true
427164
+ },
427165
+ parameters: {
427166
+ id: {
427167
+ type: "string",
427168
+ description: "ID of Personal Access Token",
427169
+ in: "path"
427170
+ }
427171
+ },
427172
+ response: {
427173
+ description: "Success",
427174
+ schema: {
427175
+ type: "object",
427176
+ title: "deletePersonalAccessTokenResponse",
427177
+ additionalProperties: false
427178
+ }
427179
+ }
427180
+ },
427038
427181
  listPublicIntegrations: {
427039
427182
  name: "listPublicIntegrations",
427040
427183
  description: "List public integration",
@@ -428179,6 +428322,206 @@ var state = {
428179
428322
  }
428180
428323
  }
428181
428324
  },
428325
+ listWorkspaceUsages: {
428326
+ name: "listWorkspaceUsages",
428327
+ description: "List workspace usages",
428328
+ section: "workspace",
428329
+ method: "get",
428330
+ path: "/v1/admin/workspaces/{id}/usages",
428331
+ disableDefaultParameters: {
428332
+ "x-workspace-id": true
428333
+ },
428334
+ parameters: {
428335
+ id: {
428336
+ type: "string",
428337
+ description: "Workspace ID",
428338
+ in: "path"
428339
+ },
428340
+ type: {
428341
+ in: "query",
428342
+ description: "Type of usage",
428343
+ type: "string",
428344
+ enum: [
428345
+ "invocation_timeout",
428346
+ "invocation_calls",
428347
+ "storage_count",
428348
+ "bot_count",
428349
+ "knowledgebase_vector_count",
428350
+ "bot_ratelimit",
428351
+ "table_row_count",
428352
+ "workspace_member_count"
428353
+ ],
428354
+ required: true
428355
+ },
428356
+ period: {
428357
+ in: "query",
428358
+ description: "Period to get",
428359
+ type: "string",
428360
+ required: false
428361
+ }
428362
+ },
428363
+ response: {
428364
+ description: "Success",
428365
+ schema: {
428366
+ type: "object",
428367
+ properties: {
428368
+ usages: {
428369
+ type: "array",
428370
+ items: {
428371
+ $ref: "#/components/schemas/Usage"
428372
+ }
428373
+ }
428374
+ },
428375
+ required: ["usages"],
428376
+ title: "listWorkspaceUsagesResponse",
428377
+ additionalProperties: false
428378
+ }
428379
+ }
428380
+ },
428381
+ getWorkspaceQuota: {
428382
+ name: "getWorkspaceQuota",
428383
+ description: "Get workspace quota",
428384
+ section: "workspace",
428385
+ method: "get",
428386
+ path: "/v1/admin/workspaces/{id}/quota",
428387
+ disableDefaultParameters: {
428388
+ "x-workspace-id": true
428389
+ },
428390
+ parameters: {
428391
+ id: {
428392
+ type: "string",
428393
+ description: "Workspace ID",
428394
+ in: "path"
428395
+ },
428396
+ type: {
428397
+ in: "query",
428398
+ description: "Type of usage",
428399
+ type: "string",
428400
+ enum: [
428401
+ "invocation_timeout",
428402
+ "invocation_calls",
428403
+ "storage_count",
428404
+ "bot_count",
428405
+ "knowledgebase_vector_count",
428406
+ "bot_ratelimit",
428407
+ "table_row_count",
428408
+ "workspace_member_count"
428409
+ ],
428410
+ required: true
428411
+ },
428412
+ period: {
428413
+ in: "query",
428414
+ description: "Period to get",
428415
+ type: "string",
428416
+ required: false
428417
+ }
428418
+ },
428419
+ response: {
428420
+ description: "Success",
428421
+ schema: {
428422
+ type: "object",
428423
+ properties: {
428424
+ quota: {
428425
+ type: "object",
428426
+ properties: {
428427
+ period: {
428428
+ type: "string",
428429
+ description: "Period of the quota that it is applied to"
428430
+ },
428431
+ value: {
428432
+ type: "number",
428433
+ description: "Value of the quota that is used"
428434
+ },
428435
+ type: {
428436
+ type: "string",
428437
+ enum: [
428438
+ "invocation_timeout",
428439
+ "invocation_calls",
428440
+ "storage_count",
428441
+ "bot_count",
428442
+ "knowledgebase_vector_count",
428443
+ "bot_ratelimit",
428444
+ "table_row_count",
428445
+ "workspace_member_count"
428446
+ ],
428447
+ description: "Usage type that can be used"
428448
+ }
428449
+ },
428450
+ required: ["period", "value", "type"],
428451
+ additionalProperties: false
428452
+ }
428453
+ },
428454
+ required: ["quota"],
428455
+ title: "getWorkspaceQuotaResponse",
428456
+ additionalProperties: false
428457
+ }
428458
+ }
428459
+ },
428460
+ listWorkspaceQuotas: {
428461
+ name: "listWorkspaceQuotas",
428462
+ description: "List workspace quotas",
428463
+ section: "workspace",
428464
+ method: "get",
428465
+ path: "/v1/admin/workspaces/{id}/quotas",
428466
+ disableDefaultParameters: {
428467
+ "x-workspace-id": true
428468
+ },
428469
+ parameters: {
428470
+ id: {
428471
+ type: "string",
428472
+ description: "Workspace ID",
428473
+ in: "path"
428474
+ },
428475
+ period: {
428476
+ in: "query",
428477
+ description: "Period to get",
428478
+ type: "string",
428479
+ required: false
428480
+ }
428481
+ },
428482
+ response: {
428483
+ description: "Success",
428484
+ schema: {
428485
+ type: "object",
428486
+ properties: {
428487
+ quotas: {
428488
+ type: "array",
428489
+ items: {
428490
+ type: "object",
428491
+ properties: {
428492
+ period: {
428493
+ type: "string",
428494
+ description: "Period of the quota that it is applied to"
428495
+ },
428496
+ value: {
428497
+ type: "number",
428498
+ description: "Value of the quota that is used"
428499
+ },
428500
+ type: {
428501
+ type: "string",
428502
+ enum: [
428503
+ "invocation_timeout",
428504
+ "invocation_calls",
428505
+ "storage_count",
428506
+ "bot_count",
428507
+ "knowledgebase_vector_count",
428508
+ "bot_ratelimit",
428509
+ "table_row_count",
428510
+ "workspace_member_count"
428511
+ ],
428512
+ description: "Usage type that can be used"
428513
+ }
428514
+ },
428515
+ required: ["period", "value", "type"]
428516
+ }
428517
+ }
428518
+ },
428519
+ required: ["quotas"],
428520
+ title: "listWorkspaceQuotasResponse",
428521
+ additionalProperties: false
428522
+ }
428523
+ }
428524
+ },
428182
428525
  updateWorkspace: {
428183
428526
  name: "updateWorkspace",
428184
428527
  description: "Update workspace",
@@ -429682,6 +430025,102 @@ var state = {
429682
430025
  }
429683
430026
  }
429684
430027
  },
430028
+ getUsage: {
430029
+ name: "getUsage",
430030
+ path: "/v1/admin/usages/{id}",
430031
+ description: "Get usage",
430032
+ method: "get",
430033
+ section: "usage",
430034
+ parameters: {
430035
+ type: {
430036
+ in: "query",
430037
+ description: "Type of usage",
430038
+ type: "string",
430039
+ enum: [
430040
+ "invocation_timeout",
430041
+ "invocation_calls",
430042
+ "storage_count",
430043
+ "bot_count",
430044
+ "knowledgebase_vector_count",
430045
+ "bot_ratelimit",
430046
+ "table_row_count",
430047
+ "workspace_member_count"
430048
+ ],
430049
+ required: true
430050
+ },
430051
+ period: {
430052
+ in: "query",
430053
+ description: "Period to get",
430054
+ type: "string",
430055
+ required: false
430056
+ },
430057
+ id: {
430058
+ type: "string",
430059
+ description: "id of a bot or a workspace depending on the usage type",
430060
+ in: "path"
430061
+ }
430062
+ },
430063
+ response: {
430064
+ description: "Success",
430065
+ schema: {
430066
+ type: "object",
430067
+ properties: {
430068
+ usage: {
430069
+ $ref: "#/components/schemas/Usage"
430070
+ }
430071
+ },
430072
+ required: ["usage"],
430073
+ title: "getUsageResponse",
430074
+ additionalProperties: false
430075
+ }
430076
+ }
430077
+ },
430078
+ listUsageHistory: {
430079
+ name: "listUsageHistory",
430080
+ path: "/v1/admin/usages/{id}/history",
430081
+ method: "get",
430082
+ description: "Get usage history",
430083
+ parameters: {
430084
+ type: {
430085
+ in: "query",
430086
+ description: "Type of usage",
430087
+ type: "string",
430088
+ enum: [
430089
+ "invocation_timeout",
430090
+ "invocation_calls",
430091
+ "storage_count",
430092
+ "bot_count",
430093
+ "knowledgebase_vector_count",
430094
+ "bot_ratelimit",
430095
+ "table_row_count",
430096
+ "workspace_member_count"
430097
+ ],
430098
+ required: true
430099
+ },
430100
+ id: {
430101
+ type: "string",
430102
+ description: "id of a bot or a workspace depending on the usage type",
430103
+ in: "path"
430104
+ }
430105
+ },
430106
+ response: {
430107
+ description: "Success",
430108
+ schema: {
430109
+ type: "object",
430110
+ properties: {
430111
+ usages: {
430112
+ type: "array",
430113
+ items: {
430114
+ $ref: "#/components/schemas/Usage"
430115
+ }
430116
+ }
430117
+ },
430118
+ required: ["usages"],
430119
+ title: "listUsageHistoryResponse",
430120
+ additionalProperties: false
430121
+ }
430122
+ }
430123
+ },
429685
430124
  introspect: {
429686
430125
  name: "introspect",
429687
430126
  description: "Introspect the API",
@@ -429900,7 +430339,7 @@ var state = {
429900
430339
  title: "Botpress API",
429901
430340
  description: "API for Botpress Cloud",
429902
430341
  server: "https://api.botpress.cloud",
429903
- version: "0.7.0",
430342
+ version: "0.7.2",
429904
430343
  prefix: "v1"
429905
430344
  },
429906
430345
  errors: [
@@ -429998,6 +430437,16 @@ var state = {
429998
430437
  status: 402,
429999
430438
  type: "PaymentRequired",
430000
430439
  description: "A payment is required to perform this request."
430440
+ },
430441
+ {
430442
+ status: 403,
430443
+ type: "QuotaExceeded",
430444
+ description: "The request exceeds the allowed quota. Quotas are a soft limit that can be increased."
430445
+ },
430446
+ {
430447
+ status: 413,
430448
+ type: "LimitExceeded",
430449
+ description: "The request exceeds the allowed limit. Limits are a hard limit that cannot be increased."
430001
430450
  }
430002
430451
  ],
430003
430452
  refs: {
@@ -430017,6 +430466,7 @@ var state = {
430017
430466
  patchStateBody: true,
430018
430467
  callActionBody: true,
430019
430468
  configureIntegrationBody: true,
430469
+ createPersonalAccessTokenBody: true,
430020
430470
  createBotBody: true,
430021
430471
  updateBotBody: true,
430022
430472
  transferBotBody: true,
@@ -430058,6 +430508,9 @@ var state = {
430058
430508
  callActionResponse: true,
430059
430509
  configureIntegrationResponse: true,
430060
430510
  getAccountResponse: true,
430511
+ listPersonalAccessTokensResponse: true,
430512
+ createPersonalAccessTokenResponse: true,
430513
+ deletePersonalAccessTokenResponse: true,
430061
430514
  listPublicIntegrationsResponse: true,
430062
430515
  getPublicIntegrationByIdResponse: true,
430063
430516
  getPublicIntegrationResponse: true,
@@ -430072,6 +430525,9 @@ var state = {
430072
430525
  getBotAnalyticsResponse: true,
430073
430526
  createWorkspaceResponse: true,
430074
430527
  getWorkspaceResponse: true,
430528
+ listWorkspaceUsagesResponse: true,
430529
+ getWorkspaceQuotaResponse: true,
430530
+ listWorkspaceQuotasResponse: true,
430075
430531
  updateWorkspaceResponse: true,
430076
430532
  listWorkspacesResponse: true,
430077
430533
  changeWorkspacePlanResponse: true,
@@ -430088,6 +430544,8 @@ var state = {
430088
430544
  getIntegrationLogsResponse: true,
430089
430545
  getIntegrationByNameResponse: true,
430090
430546
  deleteIntegrationResponse: true,
430547
+ getUsageResponse: true,
430548
+ listUsageHistoryResponse: true,
430091
430549
  introspectResponse: true,
430092
430550
  createFileResponse: true,
430093
430551
  getFileResponse: true,
@@ -430101,6 +430559,7 @@ var state = {
430101
430559
  Workspace: true,
430102
430560
  WorkspaceMember: true,
430103
430561
  Account: true,
430562
+ Usage: true,
430104
430563
  User: true,
430105
430564
  Conversation: true,
430106
430565
  Event: true,
@@ -430891,6 +431350,46 @@ var state = {
430891
431350
  additionalProperties: false
430892
431351
  }
430893
431352
  },
431353
+ Usage: {
431354
+ section: "usage",
431355
+ schema: {
431356
+ type: "object",
431357
+ properties: {
431358
+ id: {
431359
+ type: "string",
431360
+ description: "Id of the usage that it is linked to. It can either be a workspace id or a bot id"
431361
+ },
431362
+ period: {
431363
+ type: "string",
431364
+ description: "Period of the quota that it is applied to"
431365
+ },
431366
+ value: {
431367
+ type: "number",
431368
+ description: "Value of the current usage"
431369
+ },
431370
+ quota: {
431371
+ type: "number",
431372
+ description: "Quota of the current usage"
431373
+ },
431374
+ type: {
431375
+ type: "string",
431376
+ enum: [
431377
+ "invocation_timeout",
431378
+ "invocation_calls",
431379
+ "storage_count",
431380
+ "bot_count",
431381
+ "knowledgebase_vector_count",
431382
+ "bot_ratelimit",
431383
+ "table_row_count",
431384
+ "workspace_member_count"
431385
+ ],
431386
+ description: "Usage type that can be used"
431387
+ }
431388
+ },
431389
+ required: ["id", "period", "value", "quota", "type"],
431390
+ additionalProperties: false
431391
+ }
431392
+ },
430894
431393
  User: {
430895
431394
  section: "user",
430896
431395
  schema: {
@@ -431282,6 +431781,9 @@ var state = {
431282
431781
  operations: [
431283
431782
  "createWorkspace",
431284
431783
  "getWorkspace",
431784
+ "listWorkspaceUsages",
431785
+ "getWorkspaceQuota",
431786
+ "listWorkspaceQuotas",
431285
431787
  "updateWorkspace",
431286
431788
  "listWorkspaces",
431287
431789
  "changeWorkspacePlan",
@@ -431306,8 +431808,20 @@ var state = {
431306
431808
  description: "",
431307
431809
  title: "Account",
431308
431810
  name: "account",
431309
- operations: ["getAccount"],
431811
+ operations: [
431812
+ "getAccount",
431813
+ "listPersonalAccessTokens",
431814
+ "createPersonalAccessToken",
431815
+ "deletePersonalAccessToken"
431816
+ ],
431310
431817
  schema: "Account"
431818
+ },
431819
+ {
431820
+ description: "",
431821
+ title: "Usage",
431822
+ name: "usage",
431823
+ operations: ["getUsage"],
431824
+ schema: "Usage"
431311
431825
  }
431312
431826
  ]
431313
431827
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botpress/api",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -22,6 +22,6 @@
22
22
  "zod": "^3.20.6"
23
23
  },
24
24
  "dependencies": {
25
- "@bpinternal/opapi": "0.3.3"
25
+ "@bpinternal/opapi": "0.3.4"
26
26
  }
27
27
  }