@botpress/client
Advanced tools
Comparing version 0.3.2 to 0.3.4
@@ -0,3 +1,3 @@ | ||
type Headers = Record<string, string | string[]>; | ||
export type ClientProps = { | ||
host?: string; | ||
integrationId?: string; | ||
@@ -7,10 +7,13 @@ workspaceId?: string; | ||
token?: string; | ||
apiUrl?: string; | ||
timeout?: number; | ||
headers?: Headers; | ||
}; | ||
export type ClientConfig = { | ||
host: string; | ||
headers: Record<string, string>; | ||
apiUrl: string; | ||
headers: Headers; | ||
withCredentials: boolean; | ||
timeout?: number; | ||
timeout: number; | ||
}; | ||
export declare function getClientConfig(clientProps: ClientProps): ClientConfig; | ||
export {}; |
@@ -5,3 +5,3 @@ /** | ||
* | ||
* The version of the OpenAPI document: 0.5.1 | ||
* The version of the OpenAPI document: 0.5.4 | ||
* | ||
@@ -8,0 +8,0 @@ * |
import { AxiosInstance } from 'axios'; | ||
import type { Merge, Except } from 'type-fest'; | ||
import { Configuration, DefaultApiCreateConversationRequest, DefaultApiGetConversationRequest, DefaultApiListConversationsRequest, DefaultApiGetOrCreateConversationRequest, DefaultApiUpdateConversationRequest, DefaultApiDeleteConversationRequest, DefaultApiCreateEventRequest, DefaultApiGetEventRequest, DefaultApiListEventsRequest, DefaultApiCreateMessageRequest, DefaultApiGetOrCreateMessageRequest, DefaultApiGetMessageRequest, DefaultApiUpdateMessageRequest, DefaultApiListMessagesRequest, DefaultApiDeleteMessageRequest, DefaultApiCreateUserRequest, DefaultApiGetUserRequest, DefaultApiListUsersRequest, DefaultApiGetOrCreateUserRequest, DefaultApiUpdateUserRequest, DefaultApiDeleteUserRequest, DefaultApiGetStateRequest, DefaultApiSetStateRequest, DefaultApiPatchStateRequest, DefaultApiCallActionRequest, DefaultApiConfigureIntegrationRequest, DefaultApiListPublicIntegrationsRequest, DefaultApiGetPublicIntegrationByIdRequest, DefaultApiGetPublicIntegrationRequest, DefaultApiCreateBotRequest, DefaultApiUpdateBotRequest, DefaultApiTransferBotRequest, DefaultApiListBotsRequest, DefaultApiGetBotRequest, DefaultApiDeleteBotRequest, DefaultApiGetBotLogsRequest, DefaultApiGetBotWebchatRequest, DefaultApiGetBotAnalyticsRequest, DefaultApiCreateWorkspaceRequest, DefaultApiGetWorkspaceRequest, DefaultApiUpdateWorkspaceRequest, DefaultApiListWorkspacesRequest, DefaultApiChangeWorkspacePlanRequest, DefaultApiDeleteWorkspaceRequest, DefaultApiGetAuditRecordsRequest, DefaultApiCreateIntegrationRequest, DefaultApiUpdateIntegrationRequest, DefaultApiListIntegrationsRequest, DefaultApiGetIntegrationRequest, DefaultApiGetIntegrationLogsRequest, DefaultApiGetIntegrationByNameRequest, DefaultApiDeleteIntegrationRequest, DefaultApiListWorkspaceMembersRequest, DefaultApiDeleteWorkspaceMemberRequest, DefaultApiCreateWorkspaceMemberRequest, DefaultApiUpdateWorkspaceMemberRequest, DefaultApiIntrospectRequest, DefaultApiCreateFileRequest, DefaultApiGetFileRequest, DefaultApiDownloadFileRequest, DefaultApiDeleteFileRequest, DefaultApiListFilesRequest } from '.'; | ||
import { Configuration, DefaultApiCreateConversationRequest, DefaultApiGetConversationRequest, DefaultApiListConversationsRequest, DefaultApiGetOrCreateConversationRequest, DefaultApiUpdateConversationRequest, DefaultApiDeleteConversationRequest, DefaultApiCreateEventRequest, DefaultApiGetEventRequest, DefaultApiListEventsRequest, DefaultApiCreateMessageRequest, DefaultApiGetOrCreateMessageRequest, DefaultApiGetMessageRequest, DefaultApiUpdateMessageRequest, DefaultApiListMessagesRequest, DefaultApiDeleteMessageRequest, DefaultApiCreateUserRequest, DefaultApiGetUserRequest, DefaultApiListUsersRequest, DefaultApiGetOrCreateUserRequest, DefaultApiUpdateUserRequest, DefaultApiDeleteUserRequest, DefaultApiGetStateRequest, DefaultApiSetStateRequest, DefaultApiPatchStateRequest, DefaultApiCallActionRequest, DefaultApiConfigureIntegrationRequest, DefaultApiListPublicIntegrationsRequest, DefaultApiGetPublicIntegrationByIdRequest, DefaultApiGetPublicIntegrationRequest, DefaultApiCreateBotRequest, DefaultApiUpdateBotRequest, DefaultApiTransferBotRequest, DefaultApiListBotsRequest, DefaultApiGetBotRequest, DefaultApiDeleteBotRequest, DefaultApiGetBotLogsRequest, DefaultApiGetBotWebchatRequest, DefaultApiGetBotAnalyticsRequest, DefaultApiCreateWorkspaceRequest, DefaultApiGetWorkspaceRequest, DefaultApiUpdateWorkspaceRequest, DefaultApiListWorkspacesRequest, DefaultApiChangeWorkspacePlanRequest, DefaultApiDeleteWorkspaceRequest, DefaultApiGetAuditRecordsRequest, DefaultApiListWorkspaceMembersRequest, DefaultApiDeleteWorkspaceMemberRequest, DefaultApiCreateWorkspaceMemberRequest, DefaultApiUpdateWorkspaceMemberRequest, DefaultApiCreateIntegrationRequest, DefaultApiUpdateIntegrationRequest, DefaultApiListIntegrationsRequest, DefaultApiGetIntegrationRequest, DefaultApiGetIntegrationLogsRequest, DefaultApiGetIntegrationByNameRequest, DefaultApiDeleteIntegrationRequest, DefaultApiIntrospectRequest, DefaultApiCreateFileRequest, DefaultApiGetFileRequest, DefaultApiDownloadFileRequest, DefaultApiDeleteFileRequest, DefaultApiListFilesRequest } from '.'; | ||
export declare class ApiClient { | ||
@@ -52,2 +52,6 @@ private _innerClient; | ||
getAuditRecords: (props: GetAuditRecordsProps) => Promise<import("./api").GetAuditRecordsResponse>; | ||
listWorkspaceMembers: (props: ListWorkspaceMembersProps) => Promise<import("./api").ListWorkspaceMembersResponse>; | ||
deleteWorkspaceMember: (props: DeleteWorkspaceMemberProps) => Promise<object>; | ||
createWorkspaceMember: (createWorkspaceMemberBody: CreateWorkspaceMemberProps) => Promise<import("./api").CreateWorkspaceMemberResponse>; | ||
updateWorkspaceMember: ({ id, ...updateWorkspaceMemberBody }: UpdateWorkspaceMemberProps) => Promise<import("./api").UpdateWorkspaceMemberResponse>; | ||
createIntegration: (createIntegrationBody: CreateIntegrationProps) => Promise<import("./api").CreateIntegrationResponse>; | ||
@@ -60,6 +64,2 @@ updateIntegration: ({ id, ...updateIntegrationBody }: UpdateIntegrationProps) => Promise<import("./api").UpdateIntegrationResponse>; | ||
deleteIntegration: (props: DeleteIntegrationProps) => Promise<object>; | ||
listWorkspaceMembers: (props: ListWorkspaceMembersProps) => Promise<import("./api").ListWorkspaceMembersResponse>; | ||
deleteWorkspaceMember: (props: DeleteWorkspaceMemberProps) => Promise<object>; | ||
createWorkspaceMember: (createWorkspaceMemberBody: CreateWorkspaceMemberProps) => Promise<import("./api").CreateWorkspaceMemberResponse>; | ||
updateWorkspaceMember: ({ id, ...updateWorkspaceMemberBody }: UpdateWorkspaceMemberProps) => Promise<import("./api").UpdateWorkspaceMemberResponse>; | ||
introspect: (introspectBody: IntrospectProps) => Promise<import("./api").IntrospectResponse>; | ||
@@ -117,2 +117,6 @@ createFile: (createFileBody: CreateFileProps) => Promise<import("./api").CreateFileResponse>; | ||
export type GetAuditRecordsProps = Merge<DefaultApiGetAuditRecordsRequest, {}>; | ||
export type ListWorkspaceMembersProps = Merge<DefaultApiListWorkspaceMembersRequest, {}>; | ||
export type DeleteWorkspaceMemberProps = Merge<DefaultApiDeleteWorkspaceMemberRequest, {}>; | ||
export type CreateWorkspaceMemberProps = Merge<Except<DefaultApiCreateWorkspaceMemberRequest, 'createWorkspaceMemberBody'>, NonNullable<DefaultApiCreateWorkspaceMemberRequest['createWorkspaceMemberBody']>>; | ||
export type UpdateWorkspaceMemberProps = Merge<Except<DefaultApiUpdateWorkspaceMemberRequest, 'updateWorkspaceMemberBody'>, NonNullable<DefaultApiUpdateWorkspaceMemberRequest['updateWorkspaceMemberBody']>>; | ||
export type CreateIntegrationProps = Merge<Except<DefaultApiCreateIntegrationRequest, 'createIntegrationBody'>, NonNullable<DefaultApiCreateIntegrationRequest['createIntegrationBody']>>; | ||
@@ -125,6 +129,2 @@ export type UpdateIntegrationProps = Merge<Except<DefaultApiUpdateIntegrationRequest, 'updateIntegrationBody'>, NonNullable<DefaultApiUpdateIntegrationRequest['updateIntegrationBody']>>; | ||
export type DeleteIntegrationProps = Merge<DefaultApiDeleteIntegrationRequest, {}>; | ||
export type ListWorkspaceMembersProps = Merge<DefaultApiListWorkspaceMembersRequest, {}>; | ||
export type DeleteWorkspaceMemberProps = Merge<DefaultApiDeleteWorkspaceMemberRequest, {}>; | ||
export type CreateWorkspaceMemberProps = Merge<Except<DefaultApiCreateWorkspaceMemberRequest, 'createWorkspaceMemberBody'>, NonNullable<DefaultApiCreateWorkspaceMemberRequest['createWorkspaceMemberBody']>>; | ||
export type UpdateWorkspaceMemberProps = Merge<Except<DefaultApiUpdateWorkspaceMemberRequest, 'updateWorkspaceMemberBody'>, NonNullable<DefaultApiUpdateWorkspaceMemberRequest['updateWorkspaceMemberBody']>>; | ||
export type IntrospectProps = Merge<Except<DefaultApiIntrospectRequest, 'introspectBody'>, NonNullable<DefaultApiIntrospectRequest['introspectBody']>>; | ||
@@ -131,0 +131,0 @@ export type CreateFileProps = Merge<Except<DefaultApiCreateFileRequest, 'createFileBody'>, NonNullable<DefaultApiCreateFileRequest['createFileBody']>>; |
@@ -6,3 +6,3 @@ /// <reference types="node" /> | ||
* | ||
* The version of the OpenAPI document: 0.5.1 | ||
* The version of the OpenAPI document: 0.5.4 | ||
* | ||
@@ -9,0 +9,0 @@ * |
@@ -5,3 +5,3 @@ /** | ||
* | ||
* The version of the OpenAPI document: 0.5.1 | ||
* The version of the OpenAPI document: 0.5.4 | ||
* | ||
@@ -8,0 +8,0 @@ * |
@@ -26,5 +26,7 @@ declare const codes: { | ||
readonly error?: Error | undefined; | ||
readonly id?: string | undefined; | ||
readonly isApiError = true; | ||
constructor(code: Code, description: Description, type: Type, message: string, error?: Error | undefined); | ||
constructor(code: Code, description: Description, type: Type, message: string, error?: Error | undefined, id?: string | undefined); | ||
toJSON(): { | ||
id: string | undefined; | ||
code: Code; | ||
@@ -34,2 +36,3 @@ type: Type; | ||
}; | ||
static generateId(): string; | ||
} | ||
@@ -42,3 +45,3 @@ export declare const isApiError: (thrown: unknown) => thrown is ApiError; | ||
export declare class UnknownError extends BaseApiError<500, UnknownType, 'An unknown error occurred'> { | ||
constructor(message: string, error?: Error); | ||
constructor(message: string, error?: Error, id?: string); | ||
} | ||
@@ -50,3 +53,3 @@ type InternalType = 'Internal'; | ||
export declare class InternalError extends BaseApiError<500, InternalType, 'An internal error occurred'> { | ||
constructor(message: string, error?: Error); | ||
constructor(message: string, error?: Error, id?: string); | ||
} | ||
@@ -58,3 +61,3 @@ type UnauthorizedType = 'Unauthorized'; | ||
export declare class UnauthorizedError extends BaseApiError<401, UnauthorizedType, 'The request requires to be authenticated.'> { | ||
constructor(message: string, error?: Error); | ||
constructor(message: string, error?: Error, id?: string); | ||
} | ||
@@ -66,3 +69,3 @@ type ForbiddenType = 'Forbidden'; | ||
export declare class ForbiddenError extends BaseApiError<403, ForbiddenType, 'The requested action can\'t be peform by this resource.'> { | ||
constructor(message: string, error?: Error); | ||
constructor(message: string, error?: Error, id?: string); | ||
} | ||
@@ -74,3 +77,3 @@ type PayloadTooLargeType = 'PayloadTooLarge'; | ||
export declare class PayloadTooLargeError extends BaseApiError<413, PayloadTooLargeType, 'The request payload is too large.'> { | ||
constructor(message: string, error?: Error); | ||
constructor(message: string, error?: Error, id?: string); | ||
} | ||
@@ -82,3 +85,3 @@ type InvalidPayloadType = 'InvalidPayload'; | ||
export declare class InvalidPayloadError extends BaseApiError<400, InvalidPayloadType, 'The request payload is invalid.'> { | ||
constructor(message: string, error?: Error); | ||
constructor(message: string, error?: Error, id?: string); | ||
} | ||
@@ -90,3 +93,3 @@ type UnsupportedMediaTypeType = 'UnsupportedMediaType'; | ||
export declare class UnsupportedMediaTypeError extends BaseApiError<415, UnsupportedMediaTypeType, 'The request is invalid because the content-type is not supported.'> { | ||
constructor(message: string, error?: Error); | ||
constructor(message: string, error?: Error, id?: string); | ||
} | ||
@@ -98,3 +101,3 @@ type MethodNotFoundType = 'MethodNotFound'; | ||
export declare class MethodNotFoundError extends BaseApiError<405, MethodNotFoundType, 'The requested method does not exist.'> { | ||
constructor(message: string, error?: Error); | ||
constructor(message: string, error?: Error, id?: string); | ||
} | ||
@@ -106,3 +109,3 @@ type ResourceNotFoundType = 'ResourceNotFound'; | ||
export declare class ResourceNotFoundError extends BaseApiError<404, ResourceNotFoundType, 'The requested resource does not exist.'> { | ||
constructor(message: string, error?: Error); | ||
constructor(message: string, error?: Error, id?: string); | ||
} | ||
@@ -114,3 +117,3 @@ type InvalidJsonSchemaType = 'InvalidJsonSchema'; | ||
export declare class InvalidJsonSchemaError extends BaseApiError<400, InvalidJsonSchemaType, 'The provided JSON schema is invalid.'> { | ||
constructor(message: string, error?: Error); | ||
constructor(message: string, error?: Error, id?: string); | ||
} | ||
@@ -122,3 +125,3 @@ type InvalidDataFormatType = 'InvalidDataFormat'; | ||
export declare class InvalidDataFormatError extends BaseApiError<400, InvalidDataFormatType, 'The provided data doesn\'t respect the provided JSON schema.'> { | ||
constructor(message: string, error?: Error); | ||
constructor(message: string, error?: Error, id?: string); | ||
} | ||
@@ -130,3 +133,3 @@ type InvalidIdentifierType = 'InvalidIdentifier'; | ||
export declare class InvalidIdentifierError extends BaseApiError<400, InvalidIdentifierType, '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.'> { | ||
constructor(message: string, error?: Error); | ||
constructor(message: string, error?: Error, id?: string); | ||
} | ||
@@ -138,3 +141,3 @@ type RelationConflictType = 'RelationConflict'; | ||
export declare class RelationConflictError extends BaseApiError<409, RelationConflictType, 'The resource is not related with another resource. This is usually caused when providing two resources that aren\'t linked together.'> { | ||
constructor(message: string, error?: Error); | ||
constructor(message: string, error?: Error, id?: string); | ||
} | ||
@@ -146,3 +149,3 @@ type ReferenceNotFoundType = 'ReferenceNotFound'; | ||
export declare class ReferenceNotFoundError extends BaseApiError<400, ReferenceNotFoundType, 'The provided resource reference is missing. This is usually caused when providing an invalid id inside the payload of a request.'> { | ||
constructor(message: string, error?: Error); | ||
constructor(message: string, error?: Error, id?: string); | ||
} | ||
@@ -154,3 +157,3 @@ type InvalidQueryType = 'InvalidQuery'; | ||
export declare class InvalidQueryError extends BaseApiError<400, InvalidQueryType, 'The provided query is invalid. This is usually caused when providing an invalid parameter for querying a resource.'> { | ||
constructor(message: string, error?: Error); | ||
constructor(message: string, error?: Error, id?: string); | ||
} | ||
@@ -162,3 +165,3 @@ type RuntimeType = 'Runtime'; | ||
export declare class RuntimeError extends BaseApiError<400, RuntimeType, 'An error happened during the execution of a runtime (bot or integration).'> { | ||
constructor(message: string, error?: Error); | ||
constructor(message: string, error?: Error, id?: string); | ||
} | ||
@@ -170,3 +173,3 @@ type AlreadyExistsType = 'AlreadyExists'; | ||
export declare class AlreadyExistsError extends BaseApiError<409, AlreadyExistsType, 'The record attempted to be created already exists.'> { | ||
constructor(message: string, error?: Error); | ||
constructor(message: string, error?: Error, id?: string); | ||
} | ||
@@ -178,3 +181,3 @@ type RateLimitedType = 'RateLimited'; | ||
export declare class RateLimitedError extends BaseApiError<429, RateLimitedType, 'The request has been rate limited.'> { | ||
constructor(message: string, error?: Error); | ||
constructor(message: string, error?: Error, id?: string); | ||
} | ||
@@ -186,3 +189,3 @@ type PaymentRequiredType = 'PaymentRequired'; | ||
export declare class PaymentRequiredError extends BaseApiError<402, PaymentRequiredType, 'A payment is required to perform this request.'> { | ||
constructor(message: string, error?: Error); | ||
constructor(message: string, error?: Error, id?: string); | ||
} | ||
@@ -189,0 +192,0 @@ export type ErrorType = 'Unknown' | 'Internal' | 'Unauthorized' | 'Forbidden' | 'PayloadTooLarge' | 'InvalidPayload' | 'UnsupportedMediaType' | 'MethodNotFound' | 'ResourceNotFound' | 'InvalidJsonSchema' | 'InvalidDataFormat' | 'InvalidIdentifier' | 'RelationConflict' | 'ReferenceNotFound' | 'InvalidQuery' | 'Runtime' | 'AlreadyExists' | 'RateLimited' | 'PaymentRequired'; |
@@ -5,3 +5,3 @@ /** | ||
* | ||
* The version of the OpenAPI document: 0.5.1 | ||
* The version of the OpenAPI document: 0.5.4 | ||
* | ||
@@ -8,0 +8,0 @@ * |
@@ -0,9 +1,9 @@ | ||
import { ClientProps, ClientConfig } from './config'; | ||
import { ApiClient as AutoGeneratedClient } from './gen/client'; | ||
export * as axios from 'axios'; | ||
import { ClientProps, ClientConfig } from './config'; | ||
export type { Message, Conversation, User, State, Event, ModelFile as File, Bot, Integration } from './gen'; | ||
export * from './gen/errors'; | ||
import { ApiClient as AutoGeneratedClient } from './gen/client'; | ||
export declare class Client extends AutoGeneratedClient { | ||
readonly config: ClientConfig; | ||
readonly config: Readonly<ClientConfig>; | ||
constructor(clientProps?: ClientProps); | ||
} |
{ | ||
"name": "@botpress/client", | ||
"version": "0.3.2", | ||
"version": "0.3.4", | ||
"description": "Botpress Client", | ||
@@ -11,3 +11,3 @@ "main": "./dist/index.cjs", | ||
"build:type": "tsc --emitDeclarationOnly --declaration --target es2019 --module commonjs --moduleResolution node --lib es2019", | ||
"build:browser": "esbuild --bundle --external:axios --external:browser-or-node --platform=browser --format=esm --minify --outfile=dist/index.mjs src/index.ts", | ||
"build:browser": "esbuild --bundle --external:crypto --external:axios --external:browser-or-node --platform=browser --format=esm --minify --outfile=dist/index.mjs src/index.ts", | ||
"build:node": "esbuild --bundle --external:axios --external:browser-or-node --platform=node --minify --sourcemap --outfile=dist/index.cjs src/index.ts", | ||
@@ -25,5 +25,5 @@ "build:bundle": "esbuild --bundle --platform=node --minify --sourcemap --outfile=dist/bundle.cjs src/index.ts", | ||
"devDependencies": { | ||
"@botpress/api": "0.5.1", | ||
"@botpress/api": "0.5.4", | ||
"esbuild": "^0.16.12" | ||
} | ||
} |
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 too big to display
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 8 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 8 instances in 1 package
2173476
8782