@botpress/client 0.27.0 → 0.29.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/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { AxiosRequestConfig, AxiosInstance, AxiosError } from 'axios';
2
2
  import * as axios from 'axios';
3
3
  export { axios };
4
+ import { IAxiosRetryConfig } from 'axios-retry';
4
5
 
5
6
  type Primitive = string | number | boolean;
6
7
  type Value<P extends Primitive> = P | P[] | Record<string, P>;
@@ -11044,6 +11045,7 @@ type ClientOutputs = Simplify<{
11044
11045
  [T in Operation]: Awaited<ReturnType<IClient[T]>>;
11045
11046
  }>;
11046
11047
  type Headers = Record<string, string | string[]>;
11048
+ type RetryConfig = IAxiosRetryConfig;
11047
11049
  type ClientProps = {
11048
11050
  integrationId?: string;
11049
11051
  workspaceId?: string;
@@ -11052,6 +11054,7 @@ type ClientProps = {
11052
11054
  apiUrl?: string;
11053
11055
  timeout?: number;
11054
11056
  headers?: Headers;
11057
+ retry?: RetryConfig;
11055
11058
  };
11056
11059
  type ClientConfig = {
11057
11060
  apiUrl: string;
@@ -11313,13 +11316,230 @@ declare class UploadFileError extends Error {
11313
11316
  } | undefined);
11314
11317
  }
11315
11318
 
11319
+ type ListOperation = keyof {
11320
+ [K in Operation as ClientInputs[K] extends {
11321
+ nextToken?: string | undefined;
11322
+ } ? K : never]: null;
11323
+ };
11324
+ type ListInputs = {
11325
+ [K in ListOperation]: Omit<ClientInputs[K], 'nextToken'>;
11326
+ };
11327
+ type PageLister<R> = (t: {
11328
+ nextToken?: string;
11329
+ }) => Promise<{
11330
+ items: R[];
11331
+ meta: {
11332
+ nextToken?: string;
11333
+ };
11334
+ }>;
11335
+ declare class AsyncCollection<T> {
11336
+ private _list;
11337
+ constructor(_list: PageLister<T>);
11338
+ [Symbol.asyncIterator](): AsyncGenerator<Awaited<T>, void, unknown>;
11339
+ collect(props?: {
11340
+ limit?: number;
11341
+ }): Promise<T[]>;
11342
+ }
11343
+ declare class Lister {
11344
+ private client;
11345
+ constructor(client: Client$1);
11346
+ readonly conversations: (props: ListInputs['listConversations']) => AsyncCollection<{
11347
+ id: string;
11348
+ currentTaskId?: string | undefined;
11349
+ createdAt: string;
11350
+ updatedAt: string;
11351
+ channel: string;
11352
+ integration: string;
11353
+ tags: {
11354
+ [k: string]: string;
11355
+ };
11356
+ }>;
11357
+ readonly participants: (props: ListInputs['listParticipants']) => AsyncCollection<{
11358
+ id: string;
11359
+ createdAt: string;
11360
+ updatedAt: string;
11361
+ tags: {
11362
+ [k: string]: string;
11363
+ };
11364
+ name?: string | undefined;
11365
+ pictureUrl?: string | undefined;
11366
+ }>;
11367
+ readonly events: (props: ListInputs['listEvents']) => AsyncCollection<{
11368
+ id: string;
11369
+ createdAt: string;
11370
+ type: string;
11371
+ payload: {
11372
+ [k: string]: any;
11373
+ };
11374
+ conversationId?: string | undefined;
11375
+ userId?: string | undefined;
11376
+ messageId?: string | undefined;
11377
+ status: "pending" | "processed" | "ignored" | "failed";
11378
+ failureReason: string | null;
11379
+ }>;
11380
+ readonly messages: (props: ListInputs['listMessages']) => AsyncCollection<{
11381
+ id: string;
11382
+ createdAt: string;
11383
+ type: string;
11384
+ payload: {
11385
+ [k: string]: any;
11386
+ };
11387
+ direction: "incoming" | "outgoing";
11388
+ userId: string;
11389
+ conversationId: string;
11390
+ tags: {
11391
+ [k: string]: string;
11392
+ };
11393
+ }>;
11394
+ readonly users: (props: ListInputs['listUsers']) => AsyncCollection<{
11395
+ id: string;
11396
+ createdAt: string;
11397
+ updatedAt: string;
11398
+ tags: {
11399
+ [k: string]: string;
11400
+ };
11401
+ name?: string | undefined;
11402
+ pictureUrl?: string | undefined;
11403
+ }>;
11404
+ readonly tasks: (props: ListInputs['listTasks']) => AsyncCollection<{
11405
+ id: string;
11406
+ title: string;
11407
+ description: string;
11408
+ type: string;
11409
+ data: {
11410
+ [k: string]: any;
11411
+ };
11412
+ status: "pending" | "failed" | "in_progress" | "completed" | "blocked" | "paused" | "timeout" | "cancelled";
11413
+ parentTaskId?: string | undefined;
11414
+ conversationId?: string | undefined;
11415
+ userId?: string | undefined;
11416
+ timeoutAt: string;
11417
+ createdAt: string;
11418
+ updatedAt: string;
11419
+ failureReason?: string | undefined;
11420
+ tags: {
11421
+ [k: string]: string;
11422
+ };
11423
+ }>;
11424
+ readonly publicIntegrations: (props: ListInputs['listPublicIntegrations']) => AsyncCollection<{
11425
+ id: string;
11426
+ name: string;
11427
+ version: string;
11428
+ createdAt: string;
11429
+ updatedAt: string;
11430
+ title: string;
11431
+ description: string;
11432
+ iconUrl: string;
11433
+ public: boolean;
11434
+ verificationStatus: "pending" | "unapproved" | "approved" | "rejected";
11435
+ ownerWorkspace: {
11436
+ id: string;
11437
+ handle: string | null;
11438
+ name: string;
11439
+ };
11440
+ }>;
11441
+ readonly bots: (props: ListInputs['listBots']) => AsyncCollection<{
11442
+ id: string;
11443
+ createdAt: string;
11444
+ updatedAt: string;
11445
+ name: string;
11446
+ deployedAt?: string | undefined;
11447
+ }>;
11448
+ readonly botIssues: (props: ListInputs['listBotIssues']) => AsyncCollection<{
11449
+ id: string;
11450
+ code: string;
11451
+ createdAt: string;
11452
+ lastSeenAt: string;
11453
+ title: string;
11454
+ description: string;
11455
+ groupedData: {
11456
+ [k: string]: {
11457
+ raw: string;
11458
+ pretty?: string | undefined;
11459
+ };
11460
+ };
11461
+ eventsCount: number;
11462
+ category: "configuration" | "user_code" | "limits" | "other";
11463
+ resolutionLink: string | null;
11464
+ }>;
11465
+ readonly workspaces: (props: ListInputs['listWorkspaces']) => AsyncCollection<UpdateWorkspaceResponse>;
11466
+ readonly publicWorkspaces: (props: ListInputs['listPublicWorkspaces']) => AsyncCollection<GetPublicWorkspaceResponse>;
11467
+ readonly workspaceMembers: (props: ListInputs['listWorkspaceMembers']) => AsyncCollection<{
11468
+ id: string;
11469
+ userId?: string | undefined;
11470
+ email: string;
11471
+ createdAt: string;
11472
+ role: "viewer" | "billing" | "developer" | "manager" | "administrator" | "owner";
11473
+ profilePicture?: string | undefined;
11474
+ displayName?: string | undefined;
11475
+ }>;
11476
+ readonly integrations: (props: ListInputs['listIntegrations']) => AsyncCollection<{
11477
+ id: string;
11478
+ name: string;
11479
+ version: string;
11480
+ createdAt: string;
11481
+ updatedAt: string;
11482
+ title: string;
11483
+ description: string;
11484
+ iconUrl: string;
11485
+ public: boolean;
11486
+ verificationStatus: "pending" | "unapproved" | "approved" | "rejected";
11487
+ }>;
11488
+ readonly interfaces: (props: ListInputs['listInterfaces']) => AsyncCollection<{
11489
+ id: string;
11490
+ createdAt: string;
11491
+ updatedAt: string;
11492
+ name: string;
11493
+ version: string;
11494
+ }>;
11495
+ readonly activities: (props: ListInputs['listActivities']) => AsyncCollection<{
11496
+ id: string;
11497
+ description: string;
11498
+ taskId: string;
11499
+ category: "unknown" | "capture" | "bot_message" | "user_message" | "agent_message" | "event" | "action" | "task_status" | "subtask_status" | "exception";
11500
+ data: {
11501
+ [k: string]: any;
11502
+ };
11503
+ createdAt: string;
11504
+ }>;
11505
+ readonly files: (props: ListInputs['listFiles']) => AsyncCollection<{
11506
+ id: string;
11507
+ botId: string;
11508
+ key: string;
11509
+ url: string;
11510
+ size: number | null;
11511
+ contentType: string;
11512
+ tags: {
11513
+ [k: string]: string;
11514
+ };
11515
+ createdAt: string;
11516
+ updatedAt: string;
11517
+ accessPolicies: ("integrations" | "public_content")[];
11518
+ index: boolean;
11519
+ status: "upload_pending" | "upload_failed" | "upload_completed" | "indexing_pending" | "indexing_failed" | "indexing_completed";
11520
+ failedStatusReason?: string | undefined;
11521
+ expiresAt?: string | undefined;
11522
+ }>;
11523
+ readonly filePassages: (props: ListInputs['listFilePassages']) => AsyncCollection<{
11524
+ id: string;
11525
+ content: string;
11526
+ meta: {
11527
+ type?: "chunk" | undefined;
11528
+ subtype?: "code" | "title" | "subtitle" | "paragraph" | "list" | "blockquote" | "table" | undefined;
11529
+ pageNumber?: number | undefined;
11530
+ position?: number | undefined;
11531
+ };
11532
+ }>;
11533
+ }
11534
+
11316
11535
  declare class Client extends Client$1 implements IClient {
11317
11536
  readonly config: Readonly<ClientConfig>;
11318
11537
  constructor(clientProps?: ClientProps);
11538
+ get list(): Lister;
11319
11539
  /**
11320
11540
  * Create/update and upload a file in a single step. Returns an object containing the file metadata and the URL to retrieve the file.
11321
11541
  */
11322
11542
  readonly uploadFile: ({ key, index, tags, contentType, accessPolicies, content, url, expiresAt, }: ClientInputs['uploadFile']) => Promise<ClientOutputs['uploadFile']>;
11323
11543
  }
11324
11544
 
11325
- export { type Account, AlreadyExistsError, type ApiError, type Bot, BreakingChangesError, Client, type ClientConfig, type ClientInputs, type ClientOutputs, type ClientParams, type ClientProps, type ClientReturn, type Column, type Conversation, type ErrorType, type Event, type File, ForbiddenError, type IClient, type Integration, type Interface, InternalError, InvalidDataFormatError, InvalidIdentifierError, InvalidJsonSchemaError, InvalidPayloadError, InvalidQueryError, type Issue, type IssueEvent, LimitExceededError, type Message, MethodNotFoundError, type Operation, PayloadTooLargeError, PaymentRequiredError, QuotaExceededError, RateLimitedError, ReferenceConstraintError, ReferenceNotFoundError, RelationConflictError, ResourceLockedConflictError, ResourceNotFoundError, type Row, RuntimeError, type State, type Table, UnauthorizedError, UnknownError, UnsupportedMediaTypeError, UploadFileError, type Usage, type User, type Workspace, type WorkspaceMember, errorFrom, isApiError };
11545
+ export { type Account, AlreadyExistsError, type ApiError, type Bot, BreakingChangesError, Client, type ClientConfig, type ClientInputs, type ClientOutputs, type ClientParams, type ClientProps, type ClientReturn, type Column, type Conversation, type ErrorType, type Event, type File, ForbiddenError, type IClient, type Integration, type Interface, InternalError, InvalidDataFormatError, InvalidIdentifierError, InvalidJsonSchemaError, InvalidPayloadError, InvalidQueryError, type Issue, type IssueEvent, LimitExceededError, type Message, MethodNotFoundError, type Operation, PayloadTooLargeError, PaymentRequiredError, QuotaExceededError, RateLimitedError, ReferenceConstraintError, ReferenceNotFoundError, RelationConflictError, ResourceLockedConflictError, ResourceNotFoundError, type RetryConfig, type Row, RuntimeError, type State, type Table, UnauthorizedError, UnknownError, UnsupportedMediaTypeError, UploadFileError, type Usage, type User, type Workspace, type WorkspaceMember, errorFrom, isApiError };