@singlestore/client
Advanced tools
Comparing version 0.0.24 to 0.0.25
import * as _singlestore_ai from '@singlestore/ai'; | ||
import { AIBase, AI } from '@singlestore/ai'; | ||
import { AI } from '@singlestore/ai'; | ||
import * as mysql2_promise from 'mysql2/promise'; | ||
@@ -138,4 +138,6 @@ import { PoolOptions, Pool, ResultSetHeader, RowDataPacket } from 'mysql2/promise'; | ||
} | ||
type ColumnName<T extends TableType> = Extract<keyof T["columns"], string>; | ||
declare class Table<T extends TableType = TableType, U extends AIBase = AI> { | ||
type ColumnName<T extends TableType = TableType> = Extract<keyof T["columns"], string>; | ||
type VectorScoreKey = "v_score"; | ||
type ExtractAICreateChatCompletionsOptions<U extends AI | undefined> = U extends AI ? Parameters<U["chatCompletions"]["create"]>[1] : never; | ||
declare class Table<T extends TableType = TableType, U extends AI | undefined = undefined> { | ||
private _connection; | ||
@@ -146,3 +148,3 @@ databaseName: string; | ||
private _path; | ||
vScoreKey: "v_score"; | ||
vScoreKey: VectorScoreKey; | ||
constructor(_connection: Connection, databaseName: string, name: string, _ai?: U | undefined); | ||
@@ -152,3 +154,3 @@ private get ai(); | ||
static schemaToClauses(schema: TableSchema<any>): string; | ||
static create<T extends TableType = TableType, U extends AIBase = AI>(connection: Connection, databaseName: string, schema: TableSchema<T>, ai?: U): Promise<Table<T, U>>; | ||
static create<T extends TableType = TableType, U extends AI | undefined = undefined>(connection: Connection, databaseName: string, schema: TableSchema<T>, ai?: U): Promise<Table<T, U>>; | ||
static drop(connection: Connection, databaseName: string, name: string): Promise<[ResultSetHeader, mysql2_promise.FieldPacket[]]>; | ||
@@ -173,3 +175,3 @@ showInfo<T extends boolean>(extended?: T): Promise<T extends true ? TableInfoExtended<string> : TableInfo<string>>; | ||
} & RowDataPacket)[]>; | ||
createChatCompletion<K extends Exclude<Parameters<U["chatCompletions"]["create"]>[1], undefined>>(...args: [search: { | ||
createChatCompletion<K extends ExtractAICreateChatCompletionsOptions<U>>(...args: [search: { | ||
prompt: string; | ||
@@ -220,4 +222,4 @@ vectorColumn: ColumnName<T>; | ||
}; | ||
type TableName<T extends DatabaseType> = Extract<keyof T["tables"], string>; | ||
declare class Database<T extends DatabaseType = DatabaseType, U extends AIBase = AI> { | ||
type TableName<T extends DatabaseType = DatabaseType> = Extract<keyof T["tables"], string>; | ||
declare class Database<T extends DatabaseType = DatabaseType, U extends AI | undefined = undefined> { | ||
private _connection; | ||
@@ -229,3 +231,3 @@ name: string; | ||
static normalizeInfo<T extends string = string, U extends boolean = boolean>(info: any, extended?: U): U extends true ? DatabaseInfoExtended<T> : DatabaseInfo<T>; | ||
static create<T extends DatabaseType = DatabaseType, U extends AIBase = AI>(connection: Connection, schema: DatabaseSchema<T>, workspaceName?: string, ai?: U): Promise<Database<T, U>>; | ||
static create<T extends DatabaseType = DatabaseType, U extends AI | undefined = undefined>(connection: Connection, schema: DatabaseSchema<T>, workspaceName?: string, ai?: U): Promise<Database<T, U>>; | ||
static drop(connection: Connection, name: string): Promise<[ResultSetHeader, mysql2_promise.FieldPacket[]]>; | ||
@@ -276,3 +278,3 @@ showInfo<T extends boolean>(extended?: T): Promise<T extends true ? DatabaseInfoExtended<string> : DatabaseInfo<string>>; | ||
} | ||
interface ConnectWorkspaceConfig<T extends WorkspaceType = WorkspaceType, U extends AIBase = AI> extends ConnectionConfig { | ||
interface ConnectWorkspaceConfig<T extends WorkspaceType = WorkspaceType, U extends AI | undefined = undefined> extends ConnectionConfig { | ||
name?: WorkspaceSchema<T>["name"]; | ||
@@ -282,3 +284,3 @@ ai?: U; | ||
type DatabaseName<T extends WorkspaceType = WorkspaceType> = Extract<keyof T["databases"], string>; | ||
declare class Workspace<T extends WorkspaceType = WorkspaceType, U extends AIBase = AI> { | ||
declare class Workspace<T extends WorkspaceType = WorkspaceType, U extends AI | undefined = undefined> { | ||
connection: Connection; | ||
@@ -288,3 +290,3 @@ name?: string | undefined; | ||
constructor(connection: Connection, name?: string | undefined, _ai?: U | undefined); | ||
static connect<T extends WorkspaceType = WorkspaceType, U extends AIBase = AI>({ ai, name, ...config }: ConnectWorkspaceConfig<T, U>): Workspace<T, U>; | ||
static connect<T extends WorkspaceType = WorkspaceType, U extends AI | undefined = undefined>({ ai, name, ...config }: ConnectWorkspaceConfig<T, U>): Workspace<T, U>; | ||
database<N, K extends DatabaseName<T> | (string & {}) = DatabaseName<T> | (string & {})>(name: K): Database<N extends DatabaseType ? N : T["databases"][K] extends DatabaseType ? T["databases"][K] : DatabaseType, U>; | ||
@@ -296,13 +298,13 @@ createDatabase<T extends DatabaseType = DatabaseType>(schema: DatabaseSchema<T>): Promise<Database<T, U>>; | ||
interface SingleStoreClientConfig<T extends AIBase> { | ||
ai?: T; | ||
interface SingleStoreClientConfig { | ||
ai?: AI; | ||
} | ||
interface WorkspaceConfig<T extends WorkspaceType = WorkspaceType, U extends AIBase = AI> extends Omit<ConnectWorkspaceConfig<T, U>, "ai"> { | ||
interface WorkspaceConfig<T extends WorkspaceType = WorkspaceType, U extends AI | undefined = undefined> extends Omit<ConnectWorkspaceConfig<T, U>, "ai"> { | ||
} | ||
declare class SingleStoreClient<T extends AIBase = AI> { | ||
private _ai; | ||
constructor(config?: SingleStoreClientConfig<T>); | ||
workspace<U extends WorkspaceType = WorkspaceType>(config: WorkspaceConfig<U, T>): Workspace<U, T>; | ||
declare class SingleStoreClient<T extends SingleStoreClientConfig = SingleStoreClientConfig> { | ||
_ai: T["ai"] extends AI ? T["ai"] : undefined; | ||
constructor(config?: T); | ||
workspace<U extends WorkspaceType = WorkspaceType>(config: WorkspaceConfig<U, T["ai"]>): Workspace<U, T["ai"]>; | ||
} | ||
export { Column, type ColumnInfo, type ColumnSchema, type ColumnType, type ConnectWorkspaceConfig, Connection, type ConnectionConfig, Database, type DatabaseInfo, type DatabaseInfoExtended, type DatabaseSchema, type DatabaseTablesToRecords, type DatabaseType, QueryBuilder, type QueryBuilderArgs, type QueryFilters, QueryFiltersBuilder, type QueryOptions, QueryOptionsBuilder, type QuerySchema, SingleStoreClient, type SingleStoreClientConfig, Table, type TableInfo, type TableInfoExtended, type TableSchema, type TableType, Workspace, type WorkspaceConfig, type WorkspaceSchema, type WorkspaceType, queryOptionKeys }; |
{ | ||
"name": "@singlestore/client", | ||
"version": "0.0.24", | ||
"version": "0.0.25", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
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
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
149253
1283