@singlestore/client
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -0,1 +1,2 @@ | ||
import * as _singlestore_ai from '@singlestore/ai'; | ||
import { AI } from '@singlestore/ai'; | ||
@@ -14,6 +15,5 @@ import * as mysql2 from 'mysql2'; | ||
config: WorkspaceConnectionConfig; | ||
private _client; | ||
client: Pool; | ||
constructor(config: WorkspaceConnectionConfig); | ||
get client(): Pool; | ||
connect(): Promise<void>; | ||
static create(config: WorkspaceConnectionConfig): WorkspaceConnection; | ||
disconnect(): Promise<void>; | ||
@@ -181,3 +181,3 @@ } | ||
stream: true; | ||
} ? AsyncIterable<string> : string : never : never>; | ||
} ? _singlestore_ai.ChatCompletionStream : string : never : never>; | ||
} | ||
@@ -228,3 +228,3 @@ | ||
ai?: AI; | ||
}): Promise<Workspace<T>>; | ||
}): Workspace<T>; | ||
database<U extends Extract<keyof T["databases"], string> | (string & {})>(name: U): WorkspaceDatabase<T["databases"][U]>; | ||
@@ -240,5 +240,5 @@ createDatabase<T extends WorkspaceDatabaseType>(schema: WorkspaceDatabaseSchema<T>): Promise<WorkspaceDatabase<T>>; | ||
}); | ||
workspace<T extends WorkspaceType>(config: Omit<Parameters<typeof Workspace.connect>[0], "ai">): Promise<Workspace<T>>; | ||
workspace<T extends WorkspaceType>(config: Omit<Parameters<typeof Workspace.connect>[0], "ai">): Workspace<T>; | ||
} | ||
export { type DatabaseTablesToRecords, QueryBuilder, type QueryBuilderArgs, type QueryFilters, QueryFiltersBuilder, type QueryOptions, QueryOptionsBuilder, type QuerySchema, SingleStoreClient, Workspace, WorkspaceColumn, type WorkspaceColumnSchema, type WorkspaceColumnType, WorkspaceConnection, type WorkspaceConnectionConfig, WorkspaceDatabase, type WorkspaceDatabaseSchema, type WorkspaceDatabaseType, type WorkspaceSchema, WorkspaceTable, type WorkspaceTableSchema, type WorkspaceTableType, type WorkspaceType }; |
@@ -78,21 +78,13 @@ "use strict"; | ||
var import_promise = require("mysql2/promise"); | ||
var WorkspaceConnection = class { | ||
var WorkspaceConnection = class _WorkspaceConnection { | ||
constructor(config) { | ||
this.config = config; | ||
this.client = (0, import_promise.createPool)(__spreadValues({ multipleStatements: true }, this.config)); | ||
} | ||
get client() { | ||
if (!this._client) { | ||
throw new Error("Not connected"); | ||
} | ||
return this._client; | ||
static create(config) { | ||
return new _WorkspaceConnection(config); | ||
} | ||
connect() { | ||
return __async(this, null, function* () { | ||
this._client = (0, import_promise.createPool)(__spreadValues({ multipleStatements: true }, this.config)); | ||
}); | ||
} | ||
disconnect() { | ||
return __async(this, null, function* () { | ||
yield this.client.end(); | ||
this._client = void 0; | ||
}); | ||
@@ -459,14 +451,11 @@ } | ||
static connect(_a) { | ||
return __async(this, null, function* () { | ||
var _b = _a, { | ||
ai, | ||
name | ||
} = _b, config = __objRest(_b, [ | ||
"ai", | ||
"name" | ||
]); | ||
const connection = new WorkspaceConnection(config); | ||
yield connection.connect(); | ||
return new _Workspace(connection, name, ai); | ||
}); | ||
var _b = _a, { | ||
ai, | ||
name | ||
} = _b, config = __objRest(_b, [ | ||
"ai", | ||
"name" | ||
]); | ||
const connection = new WorkspaceConnection(config); | ||
return new _Workspace(connection, name, ai); | ||
} | ||
@@ -473,0 +462,0 @@ database(name) { |
{ | ||
"name": "@singlestore/client", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"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
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
124823
1152