@botpress/client
Advanced tools
Comparing version 0.20.0 to 0.20.1
@@ -1,18 +0,2 @@ | ||
type Headers = Record<string, string | string[]>; | ||
export type ClientProps = { | ||
integrationId?: string; | ||
workspaceId?: string; | ||
botId?: string; | ||
token?: string; | ||
apiUrl?: string; | ||
timeout?: number; | ||
headers?: Headers; | ||
}; | ||
export type ClientConfig = { | ||
apiUrl: string; | ||
headers: Headers; | ||
withCredentials: boolean; | ||
timeout: number; | ||
}; | ||
export declare function getClientConfig(clientProps: ClientProps): ClientConfig; | ||
export {}; | ||
import * as types from './types'; | ||
export declare function getClientConfig(clientProps: types.ClientProps): types.ClientConfig; |
@@ -1,68 +0,4 @@ | ||
/// <reference types="node" /> | ||
import { AxiosError } from 'axios'; | ||
import { ClientProps, ClientConfig } from './config'; | ||
import { Client as AutoGeneratedClient } from './gen'; | ||
import { CreateFileInput } from './gen/operations/createFile'; | ||
import { GetFileResponse } from './gen/operations/getFile'; | ||
export { isApiError } from './gen/errors'; | ||
export * as axios from 'axios'; | ||
export type { Message, Conversation, User, State, Event, File, Bot, Integration, Issue, IssueEvent, Account, Workspace, Usage, } from './gen/models'; | ||
export * from './gen/errors'; | ||
export declare class Client extends AutoGeneratedClient { | ||
readonly config: Readonly<ClientConfig>; | ||
constructor(clientProps?: ClientProps); | ||
/** | ||
* Creates and uploads a new file in a single step. Returns an object containing the file metadata and the URL to retrieve the file. | ||
*/ | ||
createAndUploadFile: ({ name, index, tags, contentType, accessPolicies, content, url, }: Omit<CreateFileInput, "size"> & { | ||
content?: string | Buffer | undefined; | ||
url?: string | undefined; | ||
}) => Promise<GetFileResponse>; | ||
} | ||
export declare class CreateAndUploadFileError extends Error { | ||
readonly innerError?: AxiosError<unknown, any> | undefined; | ||
readonly file?: { | ||
id: string; | ||
botId: string; | ||
name: string | null; | ||
size: number | null; | ||
contentType: string; | ||
tags: { | ||
[k: string]: string; | ||
}; | ||
createdAt: string; | ||
updatedAt: string; | ||
accessPolicies: ("integrations" | "public_content")[]; | ||
index: boolean; | ||
status: "upload_pending" | "upload_failed" | "upload_completed" | "indexing_pending" | "indexing_failed" | "indexing_completed"; | ||
failedStatusReason?: string | undefined; | ||
uploadUrl: string; | ||
} | undefined; | ||
constructor(message: string, innerError?: AxiosError<unknown, any> | undefined, file?: { | ||
id: string; | ||
botId: string; | ||
name: string | null; | ||
size: number | null; | ||
contentType: string; | ||
tags: { | ||
[k: string]: string; | ||
}; | ||
createdAt: string; | ||
updatedAt: string; | ||
accessPolicies: ("integrations" | "public_content")[]; | ||
index: boolean; | ||
status: "upload_pending" | "upload_failed" | "upload_completed" | "indexing_pending" | "indexing_failed" | "indexing_completed"; | ||
failedStatusReason?: string | undefined; | ||
uploadUrl: string; | ||
} | undefined); | ||
} | ||
type Simplify<T> = { | ||
[KeyType in keyof T]: Simplify<T[KeyType]>; | ||
} & {}; | ||
type PickMatching<T, V> = { | ||
[K in keyof T as T[K] extends V ? K : never]: T[K]; | ||
}; | ||
type ExtractMethods<T> = PickMatching<T, (...rest: any[]) => any>; | ||
type FunctionNames = keyof ExtractMethods<Client>; | ||
export type ClientParams<T extends FunctionNames> = Simplify<Parameters<Client[T]>[0]>; | ||
export type ClientReturn<T extends FunctionNames> = Simplify<Awaited<ReturnType<Client[T]>>>; | ||
export * from './types'; | ||
export * from './errors'; | ||
export * from './client'; |
{ | ||
"name": "@botpress/client", | ||
"version": "0.20.0", | ||
"version": "0.20.1", | ||
"description": "Botpress Client", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.cjs", |
@@ -16,5 +16,5 @@ # Botpress Client | ||
```ts | ||
import { Client, ClientReturn } from '@botpress/client' | ||
import { Client, ClientOutputs } from '@botpress/client' | ||
type Bot = ClientReturn<'listBots'>['bots'][number] | ||
type Bot = ClientOutputs['listBots']['bots'][number] | ||
@@ -21,0 +21,0 @@ const main = async () => { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 10 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 11 instances in 1 package
144
13496
3456340