@singlestore/client
Advanced tools
Comparing version 0.0.23 to 0.0.24
import * as _singlestore_ai from '@singlestore/ai'; | ||
import { AI } from '@singlestore/ai'; | ||
import { AIBase, AI } from '@singlestore/ai'; | ||
import * as mysql2_promise from 'mysql2/promise'; | ||
@@ -28,3 +28,3 @@ import { PoolOptions, Pool, ResultSetHeader, RowDataPacket } from 'mysql2/promise'; | ||
} | ||
interface ColumnInfo<T extends string> { | ||
interface ColumnInfo<T extends string = string> { | ||
name: T; | ||
@@ -44,3 +44,3 @@ type: string; | ||
constructor(_connection: Connection, databaseName: string, tableName: string, name: string); | ||
static normalizeInfo<T extends string>(info: any): ColumnInfo<T>; | ||
static normalizeInfo<T extends string = string>(info: any): ColumnInfo<T>; | ||
static schemaToClauses(schema: ColumnSchema): string; | ||
@@ -123,3 +123,3 @@ static add(connection: Connection, databaseName: string, tableName: string, schema: ColumnSchema): Promise<Column>; | ||
} | ||
interface TableSchema<T extends TableType> { | ||
interface TableSchema<T extends TableType = TableType> { | ||
name: string; | ||
@@ -133,6 +133,6 @@ columns: { | ||
} | ||
interface TableInfo<T extends string> { | ||
interface TableInfo<T extends string = string> { | ||
name: T; | ||
} | ||
interface TableInfoExtended<T extends string> extends TableInfo<T> { | ||
interface TableInfoExtended<T extends string = string> extends TableInfo<T> { | ||
tableType: string; | ||
@@ -143,3 +143,3 @@ distributed: boolean; | ||
type ColumnName<T extends TableType> = Extract<keyof T["columns"], string>; | ||
declare class Table<T extends TableType = TableType, U extends AI = AI> { | ||
declare class Table<T extends TableType = TableType, U extends AIBase = AI> { | ||
private _connection; | ||
@@ -153,5 +153,5 @@ databaseName: string; | ||
private get ai(); | ||
static normalizeInfo<T extends string, U extends boolean>(info: any, extended?: U): U extends true ? TableInfoExtended<T> : TableInfo<T>; | ||
static normalizeInfo<T extends string = string, U extends boolean = boolean>(info: any, extended?: U): U extends true ? TableInfoExtended<T> : TableInfo<T>; | ||
static schemaToClauses(schema: TableSchema<any>): string; | ||
static create<T extends TableType = TableType, U extends AI = AI>(connection: Connection, databaseName: string, schema: TableSchema<T>, ai?: U): Promise<Table<T, U>>; | ||
static create<T extends TableType = TableType, U extends AIBase = AI>(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[]]>; | ||
@@ -192,3 +192,3 @@ showInfo<T extends boolean>(extended?: T): Promise<T extends true ? TableInfoExtended<string> : TableInfo<string>>; | ||
} | ||
interface DatabaseSchema<T extends DatabaseType> { | ||
interface DatabaseSchema<T extends DatabaseType = DatabaseType> { | ||
name: string; | ||
@@ -199,6 +199,6 @@ tables?: { | ||
} | ||
interface DatabaseInfo<T extends string> { | ||
interface DatabaseInfo<T extends string = string> { | ||
name: T; | ||
} | ||
interface DatabaseInfoExtended<T extends string> extends DatabaseInfo<T> { | ||
interface DatabaseInfoExtended<T extends string = string> extends DatabaseInfo<T> { | ||
commits: number; | ||
@@ -225,3 +225,3 @@ role: string; | ||
type TableName<T extends DatabaseType> = Extract<keyof T["tables"], string>; | ||
declare class Database<T extends DatabaseType = DatabaseType, U extends AI = AI> { | ||
declare class Database<T extends DatabaseType = DatabaseType, U extends AIBase = AI> { | ||
private _connection; | ||
@@ -232,4 +232,4 @@ name: string; | ||
constructor(_connection: Connection, name: string, workspaceName?: string | undefined, _ai?: U | undefined); | ||
static normalizeInfo<T extends string, U extends boolean>(info: any, extended?: U): U extends true ? DatabaseInfoExtended<T> : DatabaseInfo<T>; | ||
static create<T extends DatabaseType = DatabaseType, U extends AI = AI>(connection: Connection, schema: DatabaseSchema<T>, workspaceName?: string, ai?: U): Promise<Database<T, U>>; | ||
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 drop(connection: Connection, name: string): Promise<[ResultSetHeader, mysql2_promise.FieldPacket[]]>; | ||
@@ -266,3 +266,3 @@ showInfo<T extends boolean>(extended?: T): Promise<T extends true ? DatabaseInfoExtended<string> : DatabaseInfo<string>>; | ||
showTablesInfo<U extends boolean>(extended?: U): Promise<(U extends true ? TableInfoExtended<Extract<keyof T["tables"], string>> : TableInfo<Extract<keyof T["tables"], string>>)[]>; | ||
createTable<T extends TableType>(schema: TableSchema<T>): Promise<Table<T, U>>; | ||
createTable<T extends TableType = TableType>(schema: TableSchema<T>): Promise<Table<T, U>>; | ||
dropTable(name: TableName<T> | (string & {})): Promise<[ResultSetHeader, mysql2_promise.FieldPacket[]]>; | ||
@@ -275,3 +275,3 @@ query<T extends any[]>(statement: string): Promise<T>; | ||
} | ||
interface WorkspaceSchema<T extends WorkspaceType> { | ||
interface WorkspaceSchema<T extends WorkspaceType = WorkspaceType> { | ||
name: string; | ||
@@ -282,8 +282,8 @@ databases: { | ||
} | ||
interface ConnectWorkspaceConfig<T extends WorkspaceType, U extends AI> extends ConnectionConfig { | ||
interface ConnectWorkspaceConfig<T extends WorkspaceType = WorkspaceType, U extends AIBase = AI> extends ConnectionConfig { | ||
name?: WorkspaceSchema<T>["name"]; | ||
ai?: U; | ||
} | ||
type DatabaseName<T extends WorkspaceType> = Extract<keyof T["databases"], string>; | ||
declare class Workspace<T extends WorkspaceType = WorkspaceType, U extends AI = AI> { | ||
type DatabaseName<T extends WorkspaceType = WorkspaceType> = Extract<keyof T["databases"], string>; | ||
declare class Workspace<T extends WorkspaceType = WorkspaceType, U extends AIBase = AI> { | ||
connection: Connection; | ||
@@ -293,5 +293,5 @@ name?: string | undefined; | ||
constructor(connection: Connection, name?: string | undefined, _ai?: U | undefined); | ||
static connect<T extends WorkspaceType = WorkspaceType, U extends AI = AI>({ ai, name, ...config }: ConnectWorkspaceConfig<T, U>): Workspace<T, U>; | ||
static connect<T extends WorkspaceType = WorkspaceType, U extends AIBase = AI>({ 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>; | ||
createDatabase<T extends DatabaseType>(schema: DatabaseSchema<T>): Promise<Database<T, U>>; | ||
createDatabase<T extends DatabaseType = DatabaseType>(schema: DatabaseSchema<T>): Promise<Database<T, U>>; | ||
dropDatabase(name: DatabaseName<T> | (string & {})): Promise<[mysql2.ResultSetHeader, mysql2.FieldPacket[]]>; | ||
@@ -301,8 +301,8 @@ showDatabasesInfo<U extends boolean>(extended?: U): Promise<(U extends true ? DatabaseInfoExtended<Extract<keyof T["databases"], string>> : DatabaseInfo<Extract<keyof T["databases"], string>>)[]>; | ||
interface SingleStoreClientConfig<T extends AI> { | ||
interface SingleStoreClientConfig<T extends AIBase> { | ||
ai?: T; | ||
} | ||
interface WorkspaceConfig<T extends WorkspaceType, U extends AI> extends Omit<ConnectWorkspaceConfig<T, U>, "ai"> { | ||
interface WorkspaceConfig<T extends WorkspaceType = WorkspaceType, U extends AIBase = AI> extends Omit<ConnectWorkspaceConfig<T, U>, "ai"> { | ||
} | ||
declare class SingleStoreClient<T extends AI = AI> { | ||
declare class SingleStoreClient<T extends AIBase = AI> { | ||
private _ai; | ||
@@ -309,0 +309,0 @@ constructor(config?: SingleStoreClientConfig<T>); |
{ | ||
"name": "@singlestore/client", | ||
"version": "0.0.23", | ||
"version": "0.0.24", | ||
"license": "Apache-2.0", | ||
@@ -21,3 +21,3 @@ "sideEffects": false, | ||
"scripts": { | ||
"build": "tsup", | ||
"build": "npm run clean && tsup", | ||
"clean": "rm -rf dist", | ||
@@ -24,0 +24,0 @@ "dev": "tsup --watch", |
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
147847
44
2
6
1
44