Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@singlestore/client

Package Overview
Dependencies
Maintainers
0
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@singlestore/client - npm Package Compare versions

Comparing version 0.0.39 to 0.0.40

1184

dist/index.d.ts

@@ -5,4 +5,3 @@ import * as mysql2_promise from 'mysql2/promise';

export { escape } from 'mysql2';
import { AnyAI } from '@singlestore/ai';
import { CreateChatCompletionResult } from '@singlestore/ai/chat-completions';
import { AnyAI, CreateChatCompletionResult } from '@singlestore/ai';

@@ -19,148 +18,2 @@ interface ConnectionConfig extends Partial<Omit<PoolOptions, "name" | "database">> {

type BillingMetric = "ComputeCredit" | "StorageAvgByte";
interface BillingUsageSchema {
resourceID: string;
resourceName: string;
resourceType: string;
startTime: string;
endTime: string;
value: string;
}
interface StorageAvgByteBillingUsageSchema extends BillingUsageSchema {
}
interface StorageAvgByteBillingUsage extends Omit<StorageAvgByteBillingUsageSchema, "startTime" | "endTime"> {
startTime: Date;
endTime: Date;
}
interface ComputeCreditBillingUsageSchema extends BillingUsageSchema {
ownerID: string | null | undefined;
}
interface ComputeCreditBillingUsage extends Omit<ComputeCreditBillingUsageSchema, "startTime" | "endTime"> {
startTime: Date;
endTime: Date;
}
interface Billing<TMetric extends BillingMetric, TUsage extends StorageAvgByteBillingUsage | ComputeCreditBillingUsage> {
metric: TMetric;
description: string;
usage: TUsage[];
}
interface StorageAvgByteBilling extends Billing<"StorageAvgByte", StorageAvgByteBillingUsage> {
}
interface ComputeCreditBilling extends Billing<"ComputeCredit", ComputeCreditBillingUsage> {
}
type APIVersion = 1 | 2;
declare class API {
private readonly _apiKey?;
private readonly _version;
private readonly _baseURL;
constructor(_apiKey?: string | undefined, _version?: APIVersion);
execute<T = any>(url: string, { version, ...params }?: RequestInit & {
version?: APIVersion;
}): Promise<T>;
}
declare abstract class APIManager {
protected readonly _api: API;
protected abstract readonly _baseURL: string;
constructor(_api: API);
protected _execute<T = any>(...[url, params]: Partial<Parameters<API["execute"]>>): Promise<T>;
}
interface GetBillingParams {
metric: BillingMetric;
startTime: Date;
endTime: Date;
aggregateBy?: "hour" | "day" | "month";
}
declare class BillingManager extends APIManager {
protected _baseURL: string;
get<T extends GetBillingParams, _TReturnType = T["metric"] extends "ComputeCredit" ? ComputeCreditBilling[] : StorageAvgByteBilling[]>({ metric, startTime, endTime, aggregateBy }: T): Promise<_TReturnType>;
}
interface JobRuntime {
name: "notebooks-cpu-small" | "notebooks-cpu-medium" | "notebooks-gpu-t4";
description: string;
}
interface JobMetadata {
count: number;
avgDurationInSeconds: number | null;
maxDurationInSeconds: number | null;
status: "Unknown" | "Scheduled" | "Running" | "Completed" | "Failed" | "Error" | "Canceled";
}
interface JobScheduleSchema {
mode: "Recurring" | "Once";
startAt: string | null;
executionIntervalInMinutes: number | null;
}
interface JobSchedule extends Omit<JobScheduleSchema, "startAt"> {
startAt: Date | null;
}
interface JobTargetConfig {
targetID: string;
targetType: "Workspace" | "Cluster" | "VirtualWorkspace";
resumeTarget: boolean;
databaseName: string;
}
interface JobExecutionConfig {
notebookPath: string;
createSnapshot: boolean;
maxAllowedExecutionDurationInMinutes: number;
}
interface JobSchema {
jobID: string;
name: string;
description: string | null;
enqueuedBy: string;
jobMetadata: JobMetadata[];
schedule: JobScheduleSchema;
targetConfig: JobTargetConfig;
executionConfig: JobExecutionConfig;
completedExecutionsCount: number;
createdAt: string;
terminatedAt: string | null;
}
interface JobParameter {
type: "string" | "integer" | "float" | "boolean";
name: string;
value: string;
}
interface JobExecutionSchema {
id: string;
number: number;
jobID: string;
scheduledStartTime: string;
startedAt: string | null;
finishedAt: string | null;
snapshotNotebookPath: string | null;
status: "Scheduled" | "Running" | "Completed" | "Failed";
}
interface JobExecution extends Omit<JobExecutionSchema, "scheduledStartTime" | "startedAt" | "finishedAt"> {
scheduledStartTime: Date;
startedAt: Date | null;
finishedAt: Date | null;
}
declare class Job extends APIManager {
id: JobSchema["jobID"];
name: JobSchema["name"];
description: JobSchema["description"];
enqueuedBy: JobSchema["enqueuedBy"];
executionConfig: JobSchema["executionConfig"];
metadata: JobSchema["jobMetadata"];
targetConfig: JobSchema["targetConfig"];
completedExecutionsCount: JobSchema["completedExecutionsCount"];
schedule: JobSchedule;
createdAt: Date;
terminatedAt: Date | null;
protected _baseURL: string;
constructor(_api: API, id: JobSchema["jobID"], name: JobSchema["name"], description: JobSchema["description"], enqueuedBy: JobSchema["enqueuedBy"], executionConfig: JobSchema["executionConfig"], metadata: JobSchema["jobMetadata"], targetConfig: JobSchema["targetConfig"], completedExecutionsCount: JobSchema["completedExecutionsCount"], schedule: JobSchedule, createdAt: Date, terminatedAt: Date | null);
static getBaseURL(id: JobSchema["jobID"]): string;
static delete(api: API, id: JobSchema["jobID"]): Promise<boolean>;
static getExecutions(api: API, id: JobSchema["jobID"], start: number, end: number): Promise<JobExecution[]>;
static getParameters(api: API, id: JobSchema["jobID"]): Promise<JobParameter[]>;
delete(): Promise<boolean>;
getExecutions(start: number, end: number): Promise<JobExecution[]>;
getParameters(): Promise<JobParameter[]>;
}
type Defined<T> = Exclude<T, undefined>;

@@ -172,309 +25,56 @@ type Optional<T extends Record<any, any>, K extends keyof T> = Omit<T, K> & {

interface CreateJobBody {
name?: JobSchema["name"];
description?: JobSchema["description"];
executionConfig: {
runtimeName?: string;
notebookPath: string;
createSnapshot?: boolean;
};
parameters?: JobParameter[];
schedule: Optional<JobSchedule, "executionIntervalInMinutes" | "startAt">;
targetConfig?: Optional<JobTargetConfig, "databaseName" | "resumeTarget">;
type ColumnName = string;
type ColumnType = any;
interface ColumnSchema {
name: ColumnName;
type: string;
nullable: boolean;
primaryKey: boolean;
autoIncrement: boolean;
default: any;
clauses: string[];
}
declare class JobManager extends APIManager {
protected _baseURL: string;
private _create;
create(body: CreateJobBody): Promise<Job>;
get(id: JobSchema["jobID"]): Promise<Job>;
delete(...args: Tail<Parameters<typeof Job.delete>>): Promise<boolean>;
getExecutions(...args: Tail<Parameters<typeof Job.getExecutions>>): Promise<JobExecution[]>;
getParameters(...args: Tail<Parameters<typeof Job.getParameters>>): Promise<JobParameter[]>;
getRuntimes(): Promise<JobRuntime[]>;
interface AddColumnSchema extends Optional<ColumnSchema, "nullable" | "primaryKey" | "autoIncrement" | "default" | "clauses"> {
}
interface OrganizationSchema {
orgID: string;
name: string;
interface ColumnInfo<TName extends ColumnName> {
name: TName;
type: string;
null: string;
key: string;
default: any;
extra: string;
}
interface Organization extends Omit<OrganizationSchema, "orgID"> {
id: string;
declare class Column<TName extends ColumnName, TTableName extends TableName, TDatabaseName extends DatabaseName> {
private _client;
private _path;
name: TName;
tableName: TTableName;
databaseName: TDatabaseName;
constructor(_client: ConnectionClient, _path: string, name: TName, tableName: TTableName, databaseName: TDatabaseName);
static schemaToClauses(schema: Partial<ColumnSchema>): string;
static drop<TName extends ColumnName, TTableName extends TableName, TDatabaseName extends DatabaseName>(client: ConnectionClient, databaseName: TDatabaseName, tableName: TTableName, name: TName): Promise<[ResultSetHeader, FieldPacket[]]>;
static normalizeInfo<TName extends ColumnName>(info: any): ColumnInfo<TName>;
static modify<TName extends ColumnName>(client: ConnectionClient, path: string, name: TName, schema: Partial<Omit<ColumnSchema, "name">>): Promise<[ResultSetHeader, FieldPacket[]]>;
static rename<TName extends ColumnName>(client: ConnectionClient, path: string, name: TName, newName: ColumnName): Promise<[ResultSetHeader, FieldPacket[]]>;
static showInfo<TName extends ColumnName, TTableName extends TableName, TDatabaseName extends DatabaseName>(client: ConnectionClient, databaseName: TDatabaseName, tableName: TTableName, name: TName): Promise<ColumnInfo<TName>>;
drop(): Promise<[ResultSetHeader, FieldPacket[]]>;
modify(...args: Parameters<typeof Column.modify> extends [any, any, any, ...infer Rest] ? Rest : never): Promise<[ResultSetHeader, FieldPacket[]]>;
rename(...[newName, ...args]: Parameters<typeof Column.rename> extends [any, any, any, ...infer Rest] ? Rest : never): Promise<[ResultSetHeader, FieldPacket[]]>;
showInfo(): Promise<ColumnInfo<TName>>;
}
declare class OrganizationManager extends APIManager {
protected _baseURL: string;
get(): Promise<Organization>;
declare class ColumnManager<TTableName extends TableName, TTableType extends TableType, TDatabaseName extends DatabaseName> {
private _client;
tableName: TTableName;
databaseName: TDatabaseName;
private _path;
constructor(_client: ConnectionClient, tableName: TTableName, databaseName: TDatabaseName);
use<TName extends TableColumnName<TTableType> | (ColumnName & {})>(name: TName): Column<TName, TTableName, TDatabaseName>;
add<TSchema extends AddColumnSchema>(schema: TSchema): Promise<Column<TSchema["name"], TTableName, TDatabaseName>>;
drop(name: TableColumnName<TTableType> | (ColumnName & {})): Promise<[ResultSetHeader, mysql2_promise.FieldPacket[]]>;
modify(name: TableColumnName<TTableType> | (ColumnName & {}), ...args: Parameters<typeof Column.modify> extends [any, any, any, ...infer Rest] ? Rest : never): Promise<[ResultSetHeader, mysql2_promise.FieldPacket[]]>;
rename(name: TableColumnName<TTableType> | (ColumnName & {}), ...args: Parameters<typeof Column.rename> extends [any, any, any, ...infer Rest] ? Rest : never): Promise<[ResultSetHeader, mysql2_promise.FieldPacket[]]>;
showInfo<TName extends TableColumnName<TTableType> | (ColumnName & {})>(name: TName, ...args: Parameters<typeof Column.showInfo> extends [any, any, any, any, ...infer Rest] ? Rest : never): Promise<ColumnInfo<TName>>;
}
type RegionProvider = "AWS" | "GCP" | "Azure";
type RegionName = "US West 2 (Oregon)" | "US East 1 (N. Virginia)" | "Europe West 1 (Ireland)" | "Europe Central 1 (Frankfurt)" | "US East 1 (N. Virginia) - HD2" | "Asia Pacific Northeast 2 (Seoul)" | "Asia Pacific Southeast 1 (Singapore)" | "Asia Pacific Southeast 3 (Jakarta)" | "Europe West 2 (London)" | "Middle East 1 (UAE)" | "Asia Pacific Southeast 2 (Sydney)" | "US East 2 (Ohio)" | "Europe West 3 (Paris)" | "Canada Central 1 (Montreal)" | "Africa South 1 (Cape Town)" | "South America East 1 (Sao Paulo)" | "Asia Pacific South 1 (Mumbai)" | "Europe North 1 (Stockholm)";
interface RegionSchema {
regionID: string;
region: RegionName;
provider: RegionProvider;
}
interface Region extends Omit<RegionSchema, "regionID" | "region"> {
id: string;
name: RegionName;
}
declare class RegionManager extends APIManager {
protected _baseURL: string;
get<T extends {
id: RegionSchema["regionID"];
} | {
name: RegionSchema["region"];
} | undefined = undefined, _ReturnType = T extends {
id: RegionSchema["regionID"];
} | {
name: RegionSchema["region"];
} ? Region | undefined : Region[]>(where?: T): Promise<_ReturnType>;
}
interface SecretSchema {
secretID: string;
name: string;
value: string | undefined;
lastUpdatedBy: string;
lastUpdatedAt: string;
createdBy: string;
createdAt: string;
}
declare class Secret extends APIManager {
id: SecretSchema["secretID"];
name: SecretSchema["name"];
value: SecretSchema["value"];
lastUpdatedBy: SecretSchema["lastUpdatedBy"];
lastUpdatedAt: Date;
createdBy: SecretSchema["createdBy"];
createdAt: Date;
protected _baseURL: string;
constructor(api: API, id: SecretSchema["secretID"], name: SecretSchema["name"], value: SecretSchema["value"], lastUpdatedBy: SecretSchema["lastUpdatedBy"], lastUpdatedAt: Date, createdBy: SecretSchema["createdBy"], createdAt: Date);
static getBaseURL(id: SecretSchema["secretID"]): string;
static update(api: API, id: SecretSchema["secretID"], value: Defined<SecretSchema["value"]>): Promise<Secret>;
static delete(api: API, id: SecretSchema["secretID"]): Promise<SecretSchema["secretID"]>;
update(value: Defined<SecretSchema["value"]>): Promise<Secret>;
delete(): Promise<string>;
}
interface CreateSecretBody {
name: SecretSchema["name"];
value: Defined<SecretSchema["value"]>;
}
declare class SecretManager extends APIManager {
protected _baseURL: string;
private _create;
create(body: CreateSecretBody): Promise<Secret>;
get<T extends {
id: SecretSchema["secretID"];
} | {
name: SecretSchema["name"];
} | undefined = undefined, _TReturnType = T extends undefined ? Secret[] : Secret | undefined>(where?: T): Promise<_TReturnType>;
update(...args: Tail<Parameters<typeof Secret.update>>): Promise<Secret>;
delete(...args: Tail<Parameters<typeof Secret.delete>>): Promise<string>;
}
interface TeamMemberTeamSchema {
teamID: string;
name: string;
description: string;
}
interface TeamMemberTeam extends Omit<TeamMemberTeamSchema, "teamID"> {
id: string;
}
interface TeamMemberUserSchema {
userID: string;
firstName: string;
lastName: string;
email: string;
}
interface TeamMemberUser extends Omit<TeamMemberUserSchema, "userID"> {
id: string;
}
interface TeamSchema {
teamID: string;
name: string;
description: string;
memberTeams: TeamMemberTeamSchema[] | undefined;
memberUsers: TeamMemberUserSchema[] | undefined;
createdAt: string;
}
interface UpdateTeamBody extends Partial<Pick<TeamSchema, "name" | "description">> {
}
declare class Team extends APIManager {
id: TeamSchema["teamID"];
name: TeamSchema["name"];
description: TeamSchema["description"];
memberTeams: TeamMemberTeam[] | undefined;
memberUsers: TeamMemberUser[] | undefined;
createdAt: Date;
protected _baseURL: string;
constructor(api: API, id: TeamSchema["teamID"], name: TeamSchema["name"], description: TeamSchema["description"], memberTeams: TeamMemberTeam[] | undefined, memberUsers: TeamMemberUser[] | undefined, createdAt: Date);
static getBaseURL(id: TeamSchema["teamID"]): string;
static update(api: API, id: TeamSchema["teamID"], body: UpdateTeamBody): Promise<TeamSchema["teamID"]>;
static delete(api: API, id: TeamSchema["teamID"]): Promise<TeamSchema["teamID"]>;
static addMemberTeams(api: API, id: TeamSchema["teamID"], teamIDs: TeamMemberTeamSchema["teamID"][]): Promise<TeamSchema["teamID"]>;
static removeMemberTeams(api: API, id: TeamSchema["teamID"], teamIDs: TeamMemberTeamSchema["teamID"][]): Promise<TeamSchema["teamID"]>;
static addMemberUsers(api: API, id: TeamSchema["teamID"], userIDs: TeamMemberUserSchema["userID"][]): Promise<TeamSchema["teamID"]>;
static removeMemberUsers(api: API, id: TeamSchema["teamID"], userIDs: TeamMemberUserSchema["userID"][]): Promise<TeamSchema["teamID"]>;
update(body: UpdateTeamBody): Promise<string>;
delete(): Promise<string>;
addMemberTeams(teamIDs: TeamMemberTeamSchema["teamID"][]): Promise<string>;
removeMemberTeams(teamIDs: TeamMemberTeamSchema["teamID"][]): Promise<string>;
addMemberUsers(userIDs: TeamMemberUserSchema["userID"][]): Promise<string>;
removeMemberUsers(userIDs: TeamMemberUserSchema["userID"][]): Promise<string>;
}
interface CreateTeamBody {
name: TeamSchema["name"];
description?: TeamSchema["description"];
memberTeams?: TeamMemberTeamSchema["teamID"][];
memberUsers?: TeamMemberUserSchema["userID"][];
}
declare class TeamManager extends APIManager {
protected _baseURL: string;
private _create;
create({ memberTeams, memberUsers, ...body }: CreateTeamBody): Promise<Team>;
get<T extends {
id: TeamSchema["teamID"];
} | {
name: TeamSchema["name"];
} | {
description: TeamSchema["description"];
} | undefined = undefined, _TReturnType = T extends undefined ? Team[] : Team | undefined>(where?: T): Promise<_TReturnType>;
update(...args: Parameters<typeof Team.update> extends [any, ...infer Rest] ? Rest : never): Promise<string>;
delete(...args: Tail<Parameters<typeof Team.delete>>): Promise<string>;
addMemberTeams(...args: Tail<Parameters<typeof Team.addMemberTeams>>): Promise<string>;
removeMemberTeams(...args: Tail<Parameters<typeof Team.removeMemberTeams>>): Promise<string>;
addMemberUsers(...args: Tail<Parameters<typeof Team.addMemberUsers>>): Promise<string>;
removeMemberUsers(...args: Tail<Parameters<typeof Team.removeMemberUsers>>): Promise<string>;
}
interface PrivateConnectionSchema {
privateConnectionID: string;
workspaceGroupID: string;
workspaceID: string;
serviceName: string;
type: "INBOUND" | "OUTBOUND";
status: "PENDING" | "ACTIVE" | "DELETED";
allowList: string;
outboundAllowList: string;
createdAt: string;
deletedAt: string;
updatedAt: string;
activeAt: string;
}
interface PrivateConnection extends Omit<PrivateConnectionSchema, "createdAt" | "deletedAt" | "updatedAt" | "activeAt"> {
createdAt: Date;
deletedAt: Date;
updatedAt: Date;
activeAt: Date;
}
interface GetWorkspacePrivateConnectionParams<TIsKai extends boolean | undefined> {
isKai?: TIsKai;
}
declare class WorkspacePrivateConnectionManager extends APIManager {
private _workspaceID;
private _groupID;
protected _baseURL: string;
constructor(api: API, _workspaceID: WorkspaceSchema["workspaceID"], _groupID: WorkspaceSchema["workspaceGroupID"]);
static getBaseURL(workspaceID: WorkspaceSchema["workspaceID"]): string;
get<TIsKai extends boolean | undefined = undefined>(params?: GetWorkspacePrivateConnectionParams<TIsKai>): Promise<TIsKai extends undefined ? PrivateConnectionSchema[] : {
serviceName: string;
}>;
outbundAllowList(): Promise<{
outboundAllowList: string;
}[]>;
}
type WorkspaceSize = string;
interface WorkspaceResumeAttachmentSchema {
attachment: "READWRITE" | "READONLY";
database: string;
error: string;
success: boolean;
}
interface WorkspaceResumeAttachment extends Omit<WorkspaceResumeAttachmentSchema, "attachment"> {
type: WorkspaceResumeAttachmentSchema["attachment"];
}
interface WorkspaceAutoSuspendSchema {
suspendType: "IDLE" | "SCHEDULED";
idleAfterSeconds: number;
idleChangedAt: string | undefined;
scheduledChangedAt: string | undefined;
scheduledSuspendAt: string | undefined;
suspendTypeChangedAt: string | undefined;
}
interface WorkspaceAutoSuspend extends Omit<WorkspaceAutoSuspendSchema, "idleChangedAt" | "scheduledChangedAt" | "scheduledSuspendAt" | "suspendTypeChangedAt"> {
idleChangedAt: Date | undefined;
scheduledChangedAt: Date | undefined;
scheduledSuspendAt: Date | undefined;
suspendTypeChangedAt: Date | undefined;
}
interface WorkspaceSchema {
workspaceID: string;
workspaceGroupID: string;
name: string;
endpoint: string;
size: WorkspaceSize;
state: "ACTIVE" | "PENDING" | "SUSPENDED" | "FAILED" | "TERMINATED";
scaleFactor: 1 | 2 | 4;
scalingProgress: number | undefined;
cacheConfig: 1 | 2 | 4;
kaiEnabled: boolean;
deploymentType: "PRODUCTION" | "NON-PRODUCTION";
createdAt: string;
lastResumedAt: string | undefined;
terminatedAt: string | undefined;
autoSuspend: WorkspaceAutoSuspendSchema | undefined;
resumeAttachments: WorkspaceResumeAttachmentSchema[];
}
interface UpdateWorkspaceBody extends Partial<Pick<WorkspaceSchema, "size" | "deploymentType" | "cacheConfig" | "scaleFactor">> {
enableKai?: boolean;
autoSuspend?: {
suspendType?: WorkspaceAutoSuspendSchema["suspendType"] | "DISABLED";
suspendAfterSeconds?: number;
};
}
interface ResumeWorkspaceBody {
disableAutoSuspend?: boolean;
}
interface ConnectWorkspaceConfig$1<TName extends WorkspaceSchema["name"] | undefined, TAI extends AnyAI | undefined> extends Omit<CreateWorkspaceConnectionConfig<TName, TAI>, "name" | "host" | "ai"> {
}
declare class Workspace<TName extends WorkspaceSchema["name"], TAI extends AnyAI | undefined> extends APIManager {
private _ai;
id: WorkspaceSchema["workspaceID"];
groupID: WorkspaceSchema["workspaceGroupID"];
name: TName;
endpoint: WorkspaceSchema["endpoint"];
size: WorkspaceSchema["size"];
state: WorkspaceSchema["state"];
scaleFactor: WorkspaceSchema["scaleFactor"];
scalingProgress: WorkspaceSchema["scalingProgress"];
cacheConfig: WorkspaceSchema["cacheConfig"];
kaiEnabled: WorkspaceSchema["kaiEnabled"];
deploymentType: WorkspaceSchema["deploymentType"];
createdAt: Date;
lastResumedAt: Date | undefined;
terminatedAt: Date | undefined;
autoSuspend: WorkspaceAutoSuspend | undefined;
resumeAttachments: WorkspaceResumeAttachment[] | undefined;
protected _baseURL: string;
privateConnection: WorkspacePrivateConnectionManager;
constructor(api: API, _ai: TAI, id: WorkspaceSchema["workspaceID"], groupID: WorkspaceSchema["workspaceGroupID"], name: TName, endpoint: WorkspaceSchema["endpoint"], size: WorkspaceSchema["size"], state: WorkspaceSchema["state"], scaleFactor: WorkspaceSchema["scaleFactor"], scalingProgress: WorkspaceSchema["scalingProgress"], cacheConfig: WorkspaceSchema["cacheConfig"], kaiEnabled: WorkspaceSchema["kaiEnabled"], deploymentType: WorkspaceSchema["deploymentType"], createdAt: Date, lastResumedAt: Date | undefined, terminatedAt: Date | undefined, autoSuspend: WorkspaceAutoSuspend | undefined, resumeAttachments: WorkspaceResumeAttachment[] | undefined);
static getBaseURL(id: WorkspaceSchema["workspaceID"]): string;
static update(api: API, id: WorkspaceSchema["workspaceID"], body: UpdateWorkspaceBody): Promise<WorkspaceSchema["workspaceID"]>;
static delete(api: API, id: WorkspaceSchema["workspaceID"]): Promise<WorkspaceSchema["workspaceID"]>;
static resume(api: API, id: WorkspaceSchema["workspaceID"], body?: ResumeWorkspaceBody): Promise<WorkspaceSchema["workspaceID"]>;
static suspend(api: API, id: WorkspaceSchema["workspaceID"]): Promise<WorkspaceSchema["workspaceID"]>;
static getState(api: API, id: WorkspaceSchema["workspaceID"]): Promise<WorkspaceSchema["state"]>;
connect(config: ConnectWorkspaceConfig$1<TName, TAI>): WorkspaceConnection<TName, TAI>;
update(body: UpdateWorkspaceBody): Promise<string>;
delete(): Promise<string>;
resume(body?: ResumeWorkspaceBody): Promise<string>;
suspend(): Promise<string>;
getState(): Promise<"PENDING" | "ACTIVE" | "SUSPENDED" | "FAILED" | "TERMINATED">;
}
type MergeUnion<T> = (T extends any ? (i: T) => void : never) extends (i: infer U) => void ? {

@@ -537,2 +137,3 @@ [K in keyof U]: U[K];

}
type AnyQueryBuilderParams = QueryBuilderParams<any, any, any, any, any>;
type ExtractSelectedQueryColumns<TTableType extends TableType, TDatabaseType extends DatabaseType, TJoinClauseAs extends string, TJoinClauses extends JoinClause<TTableType, TDatabaseType, TJoinClauseAs>[], TSelectClause extends SelectClause<TTableType, TDatabaseType, TJoinClauseAs, TJoinClauses>> = TSelectClause extends (infer TColumn)[] ? MergeUnion<TColumn extends "*" ? TTableType : TColumn extends keyof TTableType ? {

@@ -551,2 +152,27 @@ [K in TColumn]: TTableType[K];

} : never> : never;
declare class QueryBuilder<TTableType extends TableType, TDatabaseType extends DatabaseType> {
private _databaseName;
private _tableName;
constructor(_databaseName: string, _tableName: string);
buildJoinClause<TJoinClauseAs extends string, TJoinClauses extends JoinClause<TTableType, TDatabaseType, TJoinClauseAs>[]>(clauses?: TJoinClauses): string;
buildSelectClause<TJoinClauseAs extends string, TJoinClauses extends JoinClause<TTableType, TDatabaseType, TJoinClauseAs>[]>(clauses?: SelectClause<TTableType, TDatabaseType, TJoinClauseAs, TJoinClauses>, joinClauses?: TJoinClauses): string;
buildFromClause(hasJoinClauses?: boolean): string;
buildWhereCondition(column: string, operator: string, value: any): string;
buildWhereClause<TJoinClauseAs extends string, TJoinClauses extends JoinClause<TTableType, TDatabaseType, TJoinClauseAs>[]>(clauses?: WhereClause<TTableType, TDatabaseType, TJoinClauseAs, TJoinClauses>, joinClauses?: TJoinClauses): string;
buildGroupByClause<TJoinClauseAs extends string, TJoinClauses extends JoinClause<TTableType, TDatabaseType, TJoinClauseAs>[]>(clauses?: GroupByClause<TTableType, TDatabaseType, TJoinClauseAs, TJoinClauses>, joinClauses?: TJoinClauses, aliases?: string[]): string;
buildOrderByClause<TJoinClauseAs extends string, TJoinClauses extends JoinClause<TTableType, TDatabaseType, TJoinClauseAs>[]>(clauses?: OrderByClause<TTableType, TDatabaseType, TJoinClauseAs, TJoinClauses>, joinClauses?: TJoinClauses, aliases?: string[]): string;
buildLimitClause(limit?: number): string;
buildOffsetClause(offset?: number): string;
buildClauses<TJoinClauseAs extends string, TJoinClauses extends JoinClause<TTableType, TDatabaseType, TJoinClauseAs>[], TSelectClause extends SelectClause<TTableType, TDatabaseType, TJoinClauseAs, TJoinClauses>>(params?: QueryBuilderParams<TTableType, TDatabaseType, TJoinClauseAs, TJoinClauses, TSelectClause>): {
select: string;
from: string;
join: string;
where: string;
groupBy: string;
orderBy: string;
limit: string;
offset: string;
};
buildQuery<TJoinClauseAs extends string, TJoinClauses extends JoinClause<TTableType, TDatabaseType, TJoinClauseAs>[], TSelectClause extends SelectClause<TTableType, TDatabaseType, TJoinClauseAs, TJoinClauses>>(params?: QueryBuilderParams<TTableType, TDatabaseType, TJoinClauseAs, TJoinClauses, TSelectClause>): string;
}

@@ -626,140 +252,147 @@ type TableName = string;

type ColumnName = string;
type ColumnType = any;
interface ColumnSchema {
name: ColumnName;
type: string;
nullable: boolean;
primaryKey: boolean;
autoIncrement: boolean;
default: any;
clauses: string[];
type APIVersion = 1 | 2;
declare class API {
private readonly _apiKey?;
private readonly _version;
private readonly _baseURL;
constructor(_apiKey?: string | undefined, _version?: APIVersion);
execute<T = any>(url: string, { version, ...params }?: RequestInit & {
version?: APIVersion;
}): Promise<T>;
}
interface AddColumnSchema extends Optional<ColumnSchema, "nullable" | "primaryKey" | "autoIncrement" | "default" | "clauses"> {
declare abstract class APIManager {
protected readonly _api: API;
protected abstract readonly _baseURL: string;
constructor(_api: API);
protected _execute<T = any>(...[url, params]: Partial<Parameters<API["execute"]>>): Promise<T>;
}
interface ColumnInfo<TName extends ColumnName> {
name: TName;
type: string;
null: string;
key: string;
default: any;
extra: string;
interface PrivateConnectionSchema {
privateConnectionID: string;
workspaceGroupID: string;
workspaceID: string;
serviceName: string;
type: "INBOUND" | "OUTBOUND";
status: "PENDING" | "ACTIVE" | "DELETED";
allowList: string;
outboundAllowList: string;
createdAt: string;
deletedAt: string;
updatedAt: string;
activeAt: string;
}
declare class Column<TName extends ColumnName, TTableName extends TableName, TDatabaseName extends DatabaseName> {
private _client;
private _path;
name: TName;
tableName: TTableName;
databaseName: TDatabaseName;
constructor(_client: ConnectionClient, _path: string, name: TName, tableName: TTableName, databaseName: TDatabaseName);
static schemaToClauses(schema: Partial<ColumnSchema>): string;
static drop<TName extends ColumnName, TTableName extends TableName, TDatabaseName extends DatabaseName>(client: ConnectionClient, databaseName: TDatabaseName, tableName: TTableName, name: TName): Promise<[ResultSetHeader, FieldPacket[]]>;
static normalizeInfo<TName extends ColumnName>(info: any): ColumnInfo<TName>;
static modify<TName extends ColumnName>(client: ConnectionClient, path: string, name: TName, schema: Partial<Omit<ColumnSchema, "name">>): Promise<[ResultSetHeader, FieldPacket[]]>;
static rename<TName extends ColumnName>(client: ConnectionClient, path: string, name: TName, newName: ColumnName): Promise<[ResultSetHeader, FieldPacket[]]>;
static showInfo<TName extends ColumnName, TTableName extends TableName, TDatabaseName extends DatabaseName>(client: ConnectionClient, databaseName: TDatabaseName, tableName: TTableName, name: TName): Promise<ColumnInfo<TName>>;
drop(): Promise<[ResultSetHeader, FieldPacket[]]>;
modify(...args: Parameters<typeof Column.modify> extends [any, any, any, ...infer Rest] ? Rest : never): Promise<[ResultSetHeader, FieldPacket[]]>;
rename(...[newName, ...args]: Parameters<typeof Column.rename> extends [any, any, any, ...infer Rest] ? Rest : never): Promise<[ResultSetHeader, FieldPacket[]]>;
showInfo(): Promise<ColumnInfo<TName>>;
interface PrivateConnection extends Omit<PrivateConnectionSchema, "createdAt" | "deletedAt" | "updatedAt" | "activeAt"> {
createdAt: Date;
deletedAt: Date;
updatedAt: Date;
activeAt: Date;
}
declare class ColumnManager<TTableName extends TableName, TTableType extends TableType, TDatabaseName extends DatabaseName> {
private _client;
tableName: TTableName;
databaseName: TDatabaseName;
private _path;
constructor(_client: ConnectionClient, tableName: TTableName, databaseName: TDatabaseName);
use<TName extends TableColumnName<TTableType> | (ColumnName & {})>(name: TName): Column<TName, TTableName, TDatabaseName>;
add<TSchema extends AddColumnSchema>(schema: TSchema): Promise<Column<TSchema["name"], TTableName, TDatabaseName>>;
drop(name: TableColumnName<TTableType> | (ColumnName & {})): Promise<[ResultSetHeader, mysql2_promise.FieldPacket[]]>;
modify(name: TableColumnName<TTableType> | (ColumnName & {}), ...args: Parameters<typeof Column.modify> extends [any, any, any, ...infer Rest] ? Rest : never): Promise<[ResultSetHeader, mysql2_promise.FieldPacket[]]>;
rename(name: TableColumnName<TTableType> | (ColumnName & {}), ...args: Parameters<typeof Column.rename> extends [any, any, any, ...infer Rest] ? Rest : never): Promise<[ResultSetHeader, mysql2_promise.FieldPacket[]]>;
showInfo<TName extends TableColumnName<TTableType> | (ColumnName & {})>(name: TName, ...args: Parameters<typeof Column.showInfo> extends [any, any, any, any, ...infer Rest] ? Rest : never): Promise<ColumnInfo<TName>>;
interface GetWorkspacePrivateConnectionParams<TIsKai extends boolean | undefined> {
isKai?: TIsKai;
}
declare class WorkspacePrivateConnectionManager extends APIManager {
private _workspaceID;
private _groupID;
protected _baseURL: string;
constructor(api: API, _workspaceID: WorkspaceSchema["workspaceID"], _groupID: WorkspaceSchema["workspaceGroupID"]);
static getBaseURL(workspaceID: WorkspaceSchema["workspaceID"]): string;
get<TIsKai extends boolean | undefined = undefined>(params?: GetWorkspacePrivateConnectionParams<TIsKai>): Promise<TIsKai extends undefined ? PrivateConnectionSchema[] : {
serviceName: string;
}>;
outbundAllowList(): Promise<{
outboundAllowList: string;
}[]>;
}
type DatabaseName = string;
interface DatabaseType {
name: DatabaseName;
tables: Record<PropertyKey, TableType>;
type WorkspaceSize = string;
interface WorkspaceResumeAttachmentSchema {
attachment: "READWRITE" | "READONLY";
database: string;
error: string;
success: boolean;
}
interface DatabaseSchema<TType extends DatabaseType> {
name: TType["name"];
tables?: {
[K in keyof TType["tables"]]: Omit<CreateTableSchema<Extract<K, string>, TType["tables"][K]>, "name">;
interface WorkspaceResumeAttachment extends Omit<WorkspaceResumeAttachmentSchema, "attachment"> {
type: WorkspaceResumeAttachmentSchema["attachment"];
}
interface WorkspaceAutoSuspendSchema {
suspendType: "IDLE" | "SCHEDULED";
idleAfterSeconds: number;
idleChangedAt: string | undefined;
scheduledChangedAt: string | undefined;
scheduledSuspendAt: string | undefined;
suspendTypeChangedAt: string | undefined;
}
interface WorkspaceAutoSuspend extends Omit<WorkspaceAutoSuspendSchema, "idleChangedAt" | "scheduledChangedAt" | "scheduledSuspendAt" | "suspendTypeChangedAt"> {
idleChangedAt: Date | undefined;
scheduledChangedAt: Date | undefined;
scheduledSuspendAt: Date | undefined;
suspendTypeChangedAt: Date | undefined;
}
interface WorkspaceSchema {
workspaceID: string;
workspaceGroupID: string;
name: string;
endpoint: string;
size: WorkspaceSize;
state: "ACTIVE" | "PENDING" | "SUSPENDED" | "FAILED" | "TERMINATED";
scaleFactor: 1 | 2 | 4;
scalingProgress: number | undefined;
cacheConfig: 1 | 2 | 4;
kaiEnabled: boolean;
deploymentType: "PRODUCTION" | "NON-PRODUCTION";
createdAt: string;
lastResumedAt: string | undefined;
terminatedAt: string | undefined;
autoSuspend: WorkspaceAutoSuspendSchema | undefined;
resumeAttachments: WorkspaceResumeAttachmentSchema[];
}
interface UpdateWorkspaceBody extends Partial<Pick<WorkspaceSchema, "size" | "deploymentType" | "cacheConfig" | "scaleFactor">> {
enableKai?: boolean;
autoSuspend?: {
suspendType?: WorkspaceAutoSuspendSchema["suspendType"] | "DISABLED";
suspendAfterSeconds?: number;
};
}
interface DatabaseInfo<TType extends DatabaseType> {
name: TType["name"];
interface ResumeWorkspaceBody {
disableAutoSuspend?: boolean;
}
interface DatabaseInfoExtended<TType extends DatabaseType> extends DatabaseInfo<TType> {
commits: number;
role: string;
state: string;
position: string;
details: string;
asyncSlaves: number;
syncSlaves: string;
consensusSlaves: number;
committedPosition: string;
hardenedPosition: string;
replayPosition: string;
term: number;
lastPageTerm: number;
memoryMBs: number;
pendingIOs: number;
pendingBlobFSyncs: number;
interface ConnectWorkspaceConfig<TName extends WorkspaceSchema["name"] | undefined, TAI extends AnyAI | undefined> extends Omit<CreateWorkspaceConnectionConfig<TName, TAI>, "name" | "host" | "ai"> {
}
type DatabaseTableName<TType extends DatabaseType> = Extract<keyof TType["tables"], string>;
declare class Database<TType extends DatabaseType, TWorkspaceName extends WorkspaceSchema["name"] | undefined, TAI extends AnyAI | undefined> {
private _client;
declare class Workspace<TName extends WorkspaceSchema["name"], TAI extends AnyAI | undefined> extends APIManager {
private _ai;
name: TType["name"];
workspaceName: TWorkspaceName;
table: TableManager<TType, TAI>;
constructor(_client: ConnectionClient, _ai: TAI, name: TType["name"], workspaceName: TWorkspaceName);
static drop<TName extends DatabaseName>(client: ConnectionClient, name: TName): Promise<[ResultSetHeader, mysql2_promise.FieldPacket[]]>;
static normalizeInfo<TType extends DatabaseType, TExtended extends boolean, _ReturnType = TExtended extends true ? DatabaseInfoExtended<TType> : DatabaseInfo<TType>>(info: any, extended?: TExtended): _ReturnType;
drop(...args: Parameters<typeof Database.drop> extends [any, any, ...infer Rest] ? Rest : never): Promise<[ResultSetHeader, mysql2_promise.FieldPacket[]]>;
showInfo<TExtended extends boolean = false>(extended?: TExtended): Promise<TExtended extends true ? DatabaseInfoExtended<TType> : DatabaseInfo<TType>>;
showTablesInfo<TExtended extends boolean = false>(extended?: TExtended): Promise<(TExtended extends true ? TableInfoExtended<Extract<keyof TType["tables"], string>> : TableInfo<Extract<keyof TType["tables"], string>>)[]>;
describe(): Promise<{
tables: {
columns: ColumnInfo<Extract<keyof (Extract<keyof TType["tables"], string> extends infer T ? T extends Extract<keyof TType["tables"], string> ? T extends Extract<keyof TType["tables"], string> ? TType["tables"][T] : TableType : never : never), string>>[];
tableType: string;
distributed: boolean;
storageType: string;
name: Extract<keyof TType["tables"], string>;
}[];
commits: number;
role: string;
state: string;
position: string;
details: string;
asyncSlaves: number;
syncSlaves: string;
consensusSlaves: number;
committedPosition: string;
hardenedPosition: string;
replayPosition: string;
term: number;
lastPageTerm: number;
memoryMBs: number;
pendingIOs: number;
pendingBlobFSyncs: number;
name: TType["name"];
}>;
query<TReturnType extends any[]>(statement: string): Promise<TReturnType[]>;
id: WorkspaceSchema["workspaceID"];
groupID: WorkspaceSchema["workspaceGroupID"];
name: TName;
endpoint: WorkspaceSchema["endpoint"];
size: WorkspaceSchema["size"];
state: WorkspaceSchema["state"];
scaleFactor: WorkspaceSchema["scaleFactor"];
scalingProgress: WorkspaceSchema["scalingProgress"];
cacheConfig: WorkspaceSchema["cacheConfig"];
kaiEnabled: WorkspaceSchema["kaiEnabled"];
deploymentType: WorkspaceSchema["deploymentType"];
createdAt: Date;
lastResumedAt: Date | undefined;
terminatedAt: Date | undefined;
autoSuspend: WorkspaceAutoSuspend | undefined;
resumeAttachments: WorkspaceResumeAttachment[] | undefined;
protected _baseURL: string;
privateConnection: WorkspacePrivateConnectionManager;
constructor(api: API, _ai: TAI, id: WorkspaceSchema["workspaceID"], groupID: WorkspaceSchema["workspaceGroupID"], name: TName, endpoint: WorkspaceSchema["endpoint"], size: WorkspaceSchema["size"], state: WorkspaceSchema["state"], scaleFactor: WorkspaceSchema["scaleFactor"], scalingProgress: WorkspaceSchema["scalingProgress"], cacheConfig: WorkspaceSchema["cacheConfig"], kaiEnabled: WorkspaceSchema["kaiEnabled"], deploymentType: WorkspaceSchema["deploymentType"], createdAt: Date, lastResumedAt: Date | undefined, terminatedAt: Date | undefined, autoSuspend: WorkspaceAutoSuspend | undefined, resumeAttachments: WorkspaceResumeAttachment[] | undefined);
static getBaseURL(id: WorkspaceSchema["workspaceID"]): string;
static update(api: API, id: WorkspaceSchema["workspaceID"], body: UpdateWorkspaceBody): Promise<WorkspaceSchema["workspaceID"]>;
static delete(api: API, id: WorkspaceSchema["workspaceID"]): Promise<WorkspaceSchema["workspaceID"]>;
static resume(api: API, id: WorkspaceSchema["workspaceID"], body?: ResumeWorkspaceBody): Promise<WorkspaceSchema["workspaceID"]>;
static suspend(api: API, id: WorkspaceSchema["workspaceID"]): Promise<WorkspaceSchema["workspaceID"]>;
static getState(api: API, id: WorkspaceSchema["workspaceID"]): Promise<WorkspaceSchema["state"]>;
connect(config: ConnectWorkspaceConfig<TName, TAI>): WorkspaceConnection<TName, TAI>;
update(body: UpdateWorkspaceBody): Promise<string>;
delete(): Promise<string>;
resume(body?: ResumeWorkspaceBody): Promise<string>;
suspend(): Promise<string>;
getState(): Promise<"PENDING" | "ACTIVE" | "SUSPENDED" | "FAILED" | "TERMINATED">;
}
declare class DatabaseManager<TWorkspaceName extends WorkspaceSchema["name"] | undefined, TAI extends AnyAI | undefined> {
private _client;
private _ai;
workspaceName: TWorkspaceName;
constructor(_client: ConnectionClient, _ai: TAI, workspaceName: TWorkspaceName);
use<TType extends DatabaseType>(name: TType["name"]): Database<TType, TWorkspaceName, TAI>;
create<TType extends DatabaseType>(schema: DatabaseSchema<TType>): Promise<Database<TType, TWorkspaceName, TAI>>;
drop(...args: Tail<Parameters<typeof Database.drop>>): Promise<[ResultSetHeader, mysql2_promise.FieldPacket[]]>;
}
interface CreateWorkspaceConnectionConfig<TName extends WorkspaceSchema["name"] | undefined, TAI extends AnyAI | undefined> extends ConnectionConfig {

@@ -777,2 +410,40 @@ name?: TName;

interface OrganizationSchema {
orgID: string;
name: string;
}
interface Organization extends Omit<OrganizationSchema, "orgID"> {
id: string;
}
declare class OrganizationManager extends APIManager {
protected _baseURL: string;
get(): Promise<Organization>;
}
type RegionProvider = "AWS" | "GCP" | "Azure";
type RegionName = "US West 2 (Oregon)" | "US East 1 (N. Virginia)" | "Europe West 1 (Ireland)" | "Europe Central 1 (Frankfurt)" | "US East 1 (N. Virginia) - HD2" | "Asia Pacific Northeast 2 (Seoul)" | "Asia Pacific Southeast 1 (Singapore)" | "Asia Pacific Southeast 3 (Jakarta)" | "Europe West 2 (London)" | "Middle East 1 (UAE)" | "Asia Pacific Southeast 2 (Sydney)" | "US East 2 (Ohio)" | "Europe West 3 (Paris)" | "Canada Central 1 (Montreal)" | "Africa South 1 (Cape Town)" | "South America East 1 (Sao Paulo)" | "Asia Pacific South 1 (Mumbai)" | "Europe North 1 (Stockholm)";
interface RegionSchema {
regionID: string;
region: RegionName;
provider: RegionProvider;
}
interface Region extends Omit<RegionSchema, "regionID" | "region"> {
id: string;
name: RegionName;
}
declare class RegionManager extends APIManager {
protected _baseURL: string;
get<T extends {
id: RegionSchema["regionID"];
} | {
name: RegionSchema["region"];
} | undefined = undefined, _ReturnType = T extends {
id: RegionSchema["regionID"];
} | {
name: RegionSchema["region"];
} ? Region | undefined : Region[]>(where?: T): Promise<_ReturnType>;
}
type WorkspaceGroupStageContent = string | any[];

@@ -885,2 +556,3 @@ interface WorkspaceGroupStageSchema {

}
declare const updateWindowDaysMap: Record<number, WorkspaceGroupUpdateWindow["day"]>;
declare class WorkspaceGroup<TAI extends AnyAI | undefined> extends APIManager {

@@ -987,2 +659,366 @@ private _ai;

type DatabaseName = string;
interface DatabaseType {
name: DatabaseName;
tables: Record<PropertyKey, TableType>;
}
interface DatabaseSchema<TType extends DatabaseType> {
name: TType["name"];
tables?: {
[K in keyof TType["tables"]]: Omit<CreateTableSchema<Extract<K, string>, TType["tables"][K]>, "name">;
};
}
interface DatabaseInfo<TType extends DatabaseType> {
name: TType["name"];
}
interface DatabaseInfoExtended<TType extends DatabaseType> extends DatabaseInfo<TType> {
commits: number;
role: string;
state: string;
position: string;
details: string;
asyncSlaves: number;
syncSlaves: string;
consensusSlaves: number;
committedPosition: string;
hardenedPosition: string;
replayPosition: string;
term: number;
lastPageTerm: number;
memoryMBs: number;
pendingIOs: number;
pendingBlobFSyncs: number;
}
type DatabaseTableName<TType extends DatabaseType> = Extract<keyof TType["tables"], string>;
type InferDatabaseType<T> = T extends Database<infer TType, any, any> ? TType : never;
type DatabaseTablesToRecords<TTables extends DatabaseType["tables"]> = {
[K in keyof TTables]: TTables[K][];
};
type AnyDatabase = Database<DatabaseType, any, any>;
declare class Database<TType extends DatabaseType, TWorkspaceName extends WorkspaceSchema["name"] | undefined, TAI extends AnyAI | undefined> {
private _client;
private _ai;
name: TType["name"];
workspaceName: TWorkspaceName;
table: TableManager<TType, TAI>;
constructor(_client: ConnectionClient, _ai: TAI, name: TType["name"], workspaceName: TWorkspaceName);
static drop<TName extends DatabaseName>(client: ConnectionClient, name: TName): Promise<[ResultSetHeader, mysql2_promise.FieldPacket[]]>;
static normalizeInfo<TType extends DatabaseType, TExtended extends boolean, _ReturnType = TExtended extends true ? DatabaseInfoExtended<TType> : DatabaseInfo<TType>>(info: any, extended?: TExtended): _ReturnType;
drop(...args: Parameters<typeof Database.drop> extends [any, any, ...infer Rest] ? Rest : never): Promise<[ResultSetHeader, mysql2_promise.FieldPacket[]]>;
showInfo<TExtended extends boolean = false>(extended?: TExtended): Promise<TExtended extends true ? DatabaseInfoExtended<TType> : DatabaseInfo<TType>>;
showTablesInfo<TExtended extends boolean = false>(extended?: TExtended): Promise<(TExtended extends true ? TableInfoExtended<Extract<keyof TType["tables"], string>> : TableInfo<Extract<keyof TType["tables"], string>>)[]>;
describe(): Promise<{
tables: {
columns: ColumnInfo<Extract<keyof (Extract<keyof TType["tables"], string> extends infer T ? T extends Extract<keyof TType["tables"], string> ? T extends Extract<keyof TType["tables"], string> ? TType["tables"][T] : TableType : never : never), string>>[];
tableType: string;
distributed: boolean;
storageType: string;
name: Extract<keyof TType["tables"], string>;
}[];
commits: number;
role: string;
state: string;
position: string;
details: string;
asyncSlaves: number;
syncSlaves: string;
consensusSlaves: number;
committedPosition: string;
hardenedPosition: string;
replayPosition: string;
term: number;
lastPageTerm: number;
memoryMBs: number;
pendingIOs: number;
pendingBlobFSyncs: number;
name: TType["name"];
}>;
query<TReturnType extends any[]>(statement: string): Promise<TReturnType[]>;
}
declare class DatabaseManager<TWorkspaceName extends WorkspaceSchema["name"] | undefined, TAI extends AnyAI | undefined> {
private _client;
private _ai;
workspaceName: TWorkspaceName;
constructor(_client: ConnectionClient, _ai: TAI, workspaceName: TWorkspaceName);
use<TType extends DatabaseType>(name: TType["name"]): Database<TType, TWorkspaceName, TAI>;
create<TType extends DatabaseType>(schema: DatabaseSchema<TType>): Promise<Database<TType, TWorkspaceName, TAI>>;
drop(...args: Tail<Parameters<typeof Database.drop>>): Promise<[ResultSetHeader, mysql2_promise.FieldPacket[]]>;
}
type BillingMetric = "ComputeCredit" | "StorageAvgByte";
interface BillingUsageSchema {
resourceID: string;
resourceName: string;
resourceType: string;
startTime: string;
endTime: string;
value: string;
}
interface StorageAvgByteBillingUsageSchema extends BillingUsageSchema {
}
interface StorageAvgByteBillingUsage extends Omit<StorageAvgByteBillingUsageSchema, "startTime" | "endTime"> {
startTime: Date;
endTime: Date;
}
interface ComputeCreditBillingUsageSchema extends BillingUsageSchema {
ownerID: string | null | undefined;
}
interface ComputeCreditBillingUsage extends Omit<ComputeCreditBillingUsageSchema, "startTime" | "endTime"> {
startTime: Date;
endTime: Date;
}
interface BillingSchema<T extends BillingMetric> {
metric: T;
description: string;
Usage: (T extends "ComputeCredit" ? ComputeCreditBillingUsageSchema : StorageAvgByteBillingUsageSchema)[];
}
interface Billing<TMetric extends BillingMetric, TUsage extends StorageAvgByteBillingUsage | ComputeCreditBillingUsage> {
metric: TMetric;
description: string;
usage: TUsage[];
}
interface StorageAvgByteBilling extends Billing<"StorageAvgByte", StorageAvgByteBillingUsage> {
}
interface ComputeCreditBilling extends Billing<"ComputeCredit", ComputeCreditBillingUsage> {
}
interface GetBillingParams {
metric: BillingMetric;
startTime: Date;
endTime: Date;
aggregateBy?: "hour" | "day" | "month";
}
declare class BillingManager extends APIManager {
protected _baseURL: string;
get<T extends GetBillingParams, _TReturnType = T["metric"] extends "ComputeCredit" ? ComputeCreditBilling[] : StorageAvgByteBilling[]>({ metric, startTime, endTime, aggregateBy }: T): Promise<_TReturnType>;
}
interface JobRuntime {
name: "notebooks-cpu-small" | "notebooks-cpu-medium" | "notebooks-gpu-t4";
description: string;
}
interface JobMetadata {
count: number;
avgDurationInSeconds: number | null;
maxDurationInSeconds: number | null;
status: "Unknown" | "Scheduled" | "Running" | "Completed" | "Failed" | "Error" | "Canceled";
}
interface JobScheduleSchema {
mode: "Recurring" | "Once";
startAt: string | null;
executionIntervalInMinutes: number | null;
}
interface JobSchedule extends Omit<JobScheduleSchema, "startAt"> {
startAt: Date | null;
}
interface JobTargetConfig {
targetID: string;
targetType: "Workspace" | "Cluster" | "VirtualWorkspace";
resumeTarget: boolean;
databaseName: string;
}
interface JobExecutionConfig {
notebookPath: string;
createSnapshot: boolean;
maxAllowedExecutionDurationInMinutes: number;
}
interface JobSchema {
jobID: string;
name: string;
description: string | null;
enqueuedBy: string;
jobMetadata: JobMetadata[];
schedule: JobScheduleSchema;
targetConfig: JobTargetConfig;
executionConfig: JobExecutionConfig;
completedExecutionsCount: number;
createdAt: string;
terminatedAt: string | null;
}
interface JobParameter {
type: "string" | "integer" | "float" | "boolean";
name: string;
value: string;
}
interface JobExecutionSchema {
id: string;
number: number;
jobID: string;
scheduledStartTime: string;
startedAt: string | null;
finishedAt: string | null;
snapshotNotebookPath: string | null;
status: "Scheduled" | "Running" | "Completed" | "Failed";
}
interface JobExecution extends Omit<JobExecutionSchema, "scheduledStartTime" | "startedAt" | "finishedAt"> {
scheduledStartTime: Date;
startedAt: Date | null;
finishedAt: Date | null;
}
declare class Job extends APIManager {
id: JobSchema["jobID"];
name: JobSchema["name"];
description: JobSchema["description"];
enqueuedBy: JobSchema["enqueuedBy"];
executionConfig: JobSchema["executionConfig"];
metadata: JobSchema["jobMetadata"];
targetConfig: JobSchema["targetConfig"];
completedExecutionsCount: JobSchema["completedExecutionsCount"];
schedule: JobSchedule;
createdAt: Date;
terminatedAt: Date | null;
protected _baseURL: string;
constructor(_api: API, id: JobSchema["jobID"], name: JobSchema["name"], description: JobSchema["description"], enqueuedBy: JobSchema["enqueuedBy"], executionConfig: JobSchema["executionConfig"], metadata: JobSchema["jobMetadata"], targetConfig: JobSchema["targetConfig"], completedExecutionsCount: JobSchema["completedExecutionsCount"], schedule: JobSchedule, createdAt: Date, terminatedAt: Date | null);
static getBaseURL(id: JobSchema["jobID"]): string;
static delete(api: API, id: JobSchema["jobID"]): Promise<boolean>;
static getExecutions(api: API, id: JobSchema["jobID"], start: number, end: number): Promise<JobExecution[]>;
static getParameters(api: API, id: JobSchema["jobID"]): Promise<JobParameter[]>;
delete(): Promise<boolean>;
getExecutions(start: number, end: number): Promise<JobExecution[]>;
getParameters(): Promise<JobParameter[]>;
}
interface CreateJobBody {
name?: JobSchema["name"];
description?: JobSchema["description"];
executionConfig: {
runtimeName?: string;
notebookPath: string;
createSnapshot?: boolean;
};
parameters?: JobParameter[];
schedule: Optional<JobSchedule, "executionIntervalInMinutes" | "startAt">;
targetConfig?: Optional<JobTargetConfig, "databaseName" | "resumeTarget">;
}
declare class JobManager extends APIManager {
protected _baseURL: string;
private _create;
create(body: CreateJobBody): Promise<Job>;
get(id: JobSchema["jobID"]): Promise<Job>;
delete(...args: Tail<Parameters<typeof Job.delete>>): Promise<boolean>;
getExecutions(...args: Tail<Parameters<typeof Job.getExecutions>>): Promise<JobExecution[]>;
getParameters(...args: Tail<Parameters<typeof Job.getParameters>>): Promise<JobParameter[]>;
getRuntimes(): Promise<JobRuntime[]>;
}
interface SecretSchema {
secretID: string;
name: string;
value: string | undefined;
lastUpdatedBy: string;
lastUpdatedAt: string;
createdBy: string;
createdAt: string;
}
declare class Secret extends APIManager {
id: SecretSchema["secretID"];
name: SecretSchema["name"];
value: SecretSchema["value"];
lastUpdatedBy: SecretSchema["lastUpdatedBy"];
lastUpdatedAt: Date;
createdBy: SecretSchema["createdBy"];
createdAt: Date;
protected _baseURL: string;
constructor(api: API, id: SecretSchema["secretID"], name: SecretSchema["name"], value: SecretSchema["value"], lastUpdatedBy: SecretSchema["lastUpdatedBy"], lastUpdatedAt: Date, createdBy: SecretSchema["createdBy"], createdAt: Date);
static getBaseURL(id: SecretSchema["secretID"]): string;
static update(api: API, id: SecretSchema["secretID"], value: Defined<SecretSchema["value"]>): Promise<Secret>;
static delete(api: API, id: SecretSchema["secretID"]): Promise<SecretSchema["secretID"]>;
update(value: Defined<SecretSchema["value"]>): Promise<Secret>;
delete(): Promise<string>;
}
interface CreateSecretBody {
name: SecretSchema["name"];
value: Defined<SecretSchema["value"]>;
}
declare class SecretManager extends APIManager {
protected _baseURL: string;
private _create;
create(body: CreateSecretBody): Promise<Secret>;
get<T extends {
id: SecretSchema["secretID"];
} | {
name: SecretSchema["name"];
} | undefined = undefined, _TReturnType = T extends undefined ? Secret[] : Secret | undefined>(where?: T): Promise<_TReturnType>;
update(...args: Tail<Parameters<typeof Secret.update>>): Promise<Secret>;
delete(...args: Tail<Parameters<typeof Secret.delete>>): Promise<string>;
}
interface TeamMemberTeamSchema {
teamID: string;
name: string;
description: string;
}
interface TeamMemberTeam extends Omit<TeamMemberTeamSchema, "teamID"> {
id: string;
}
interface TeamMemberUserSchema {
userID: string;
firstName: string;
lastName: string;
email: string;
}
interface TeamMemberUser extends Omit<TeamMemberUserSchema, "userID"> {
id: string;
}
interface TeamSchema {
teamID: string;
name: string;
description: string;
memberTeams: TeamMemberTeamSchema[] | undefined;
memberUsers: TeamMemberUserSchema[] | undefined;
createdAt: string;
}
interface UpdateTeamBody extends Partial<Pick<TeamSchema, "name" | "description">> {
}
declare class Team extends APIManager {
id: TeamSchema["teamID"];
name: TeamSchema["name"];
description: TeamSchema["description"];
memberTeams: TeamMemberTeam[] | undefined;
memberUsers: TeamMemberUser[] | undefined;
createdAt: Date;
protected _baseURL: string;
constructor(api: API, id: TeamSchema["teamID"], name: TeamSchema["name"], description: TeamSchema["description"], memberTeams: TeamMemberTeam[] | undefined, memberUsers: TeamMemberUser[] | undefined, createdAt: Date);
static getBaseURL(id: TeamSchema["teamID"]): string;
static update(api: API, id: TeamSchema["teamID"], body: UpdateTeamBody): Promise<TeamSchema["teamID"]>;
static delete(api: API, id: TeamSchema["teamID"]): Promise<TeamSchema["teamID"]>;
static addMemberTeams(api: API, id: TeamSchema["teamID"], teamIDs: TeamMemberTeamSchema["teamID"][]): Promise<TeamSchema["teamID"]>;
static removeMemberTeams(api: API, id: TeamSchema["teamID"], teamIDs: TeamMemberTeamSchema["teamID"][]): Promise<TeamSchema["teamID"]>;
static addMemberUsers(api: API, id: TeamSchema["teamID"], userIDs: TeamMemberUserSchema["userID"][]): Promise<TeamSchema["teamID"]>;
static removeMemberUsers(api: API, id: TeamSchema["teamID"], userIDs: TeamMemberUserSchema["userID"][]): Promise<TeamSchema["teamID"]>;
update(body: UpdateTeamBody): Promise<string>;
delete(): Promise<string>;
addMemberTeams(teamIDs: TeamMemberTeamSchema["teamID"][]): Promise<string>;
removeMemberTeams(teamIDs: TeamMemberTeamSchema["teamID"][]): Promise<string>;
addMemberUsers(userIDs: TeamMemberUserSchema["userID"][]): Promise<string>;
removeMemberUsers(userIDs: TeamMemberUserSchema["userID"][]): Promise<string>;
}
interface CreateTeamBody {
name: TeamSchema["name"];
description?: TeamSchema["description"];
memberTeams?: TeamMemberTeamSchema["teamID"][];
memberUsers?: TeamMemberUserSchema["userID"][];
}
declare class TeamManager extends APIManager {
protected _baseURL: string;
private _create;
create({ memberTeams, memberUsers, ...body }: CreateTeamBody): Promise<Team>;
get<T extends {
id: TeamSchema["teamID"];
} | {
name: TeamSchema["name"];
} | {
description: TeamSchema["description"];
} | undefined = undefined, _TReturnType = T extends undefined ? Team[] : Team | undefined>(where?: T): Promise<_TReturnType>;
update(...args: Parameters<typeof Team.update> extends [any, ...infer Rest] ? Rest : never): Promise<string>;
delete(...args: Tail<Parameters<typeof Team.delete>>): Promise<string>;
addMemberTeams(...args: Tail<Parameters<typeof Team.addMemberTeams>>): Promise<string>;
removeMemberTeams(...args: Tail<Parameters<typeof Team.removeMemberTeams>>): Promise<string>;
addMemberUsers(...args: Tail<Parameters<typeof Team.addMemberUsers>>): Promise<string>;
removeMemberUsers(...args: Tail<Parameters<typeof Team.removeMemberUsers>>): Promise<string>;
}
interface SingleStoreClientConfig<TAI extends AnyAI | undefined> {

@@ -992,3 +1028,3 @@ ai?: TAI;

}
interface ConnectWorkspaceConfig<TName extends WorkspaceSchema["name"] | undefined, TAI extends AnyAI | undefined> extends Omit<CreateWorkspaceConnectionConfig<TName, TAI>, "ai"> {
interface ConnectConfig<TName extends WorkspaceSchema["name"] | undefined, TAI extends AnyAI | undefined> extends Omit<CreateWorkspaceConnectionConfig<TName, TAI>, "ai"> {
}

@@ -1006,5 +1042,5 @@ declare class SingleStoreClient<TAI extends AnyAI | undefined = undefined> {

constructor(config?: SingleStoreClientConfig<TAI>);
connect<TName extends WorkspaceSchema["name"] | undefined = undefined>(config: ConnectWorkspaceConfig<TName, TAI>): WorkspaceConnection<TName, TAI>;
connect<TName extends WorkspaceSchema["name"] | undefined = undefined>(config: ConnectConfig<TName, TAI>): WorkspaceConnection<TName, TAI>;
}
export { type ConnectWorkspaceConfig, Connection, type ConnectionClient, type ConnectionConfig, SingleStoreClient, type SingleStoreClientConfig };
export { API, APIManager, type APIVersion, type AddColumnSchema, type AnyDatabase, type AnyQueryBuilderParams, type Billing, BillingManager, type BillingMetric, type BillingSchema, type BillingUsageSchema, Column, type ColumnInfo, ColumnManager, type ColumnName, type ColumnSchema, type ColumnType, type ComputeCreditBilling, type ComputeCreditBillingUsage, type ComputeCreditBillingUsageSchema, type ConnectConfig, type ConnectWorkspaceConfig, Connection, type ConnectionClient, type ConnectionConfig, type CreateJobBody, type CreateSecretBody, type CreateTableSchema, type CreateTeamBody, type CreateWorkspaceConnectionConfig, type CreateWorkspaceGroupBody, Database, type DatabaseInfo, type DatabaseInfoExtended, DatabaseManager, type DatabaseName, type DatabaseSchema, type DatabaseTableName, type DatabaseTablesToRecords, type DatabaseType, type ExtractJoinClauseColumns, type ExtractSelectedQueryColumns, type GetBillingParams, type GetWorkspaceGroupParams, type GetWorkspaceGroupSelectParam, type GetWorkspaceGroupWhereParam, type GetWorkspaceParams, type GetWorkspacePrivateConnectionParams, type GetWorkspaceSelectParam, type GetWorkspaceWhereParam, type GroupByClause, type InferDatabaseType, Job, type JobExecution, type JobExecutionConfig, type JobExecutionSchema, JobManager, type JobMetadata, type JobParameter, type JobRuntime, type JobSchedule, type JobScheduleSchema, type JobSchema, type JobTargetConfig, type JoinClause, type OrderByClause, type OrderByDirection, type Organization, OrganizationManager, type OrganizationSchema, type PrivateConnection, type PrivateConnectionSchema, QueryBuilder, type QueryBuilderParams, type Region, RegionManager, type RegionName, type RegionProvider, type RegionSchema, type ReplicatedDatabaseSchema, type ResumeWorkspaceBody, Secret, SecretManager, type SecretSchema, type SelectClause, SingleStoreClient, type SingleStoreClientConfig, type StorageAvgByteBilling, type StorageAvgByteBillingUsage, type StorageAvgByteBillingUsageSchema, type StorageDRStatusSchema, Table, type TableColumnName, type TableInfo, type TableInfoExtended, TableManager, type TableName, type TableSchema, type TableType, Team, TeamManager, type TeamMemberTeam, type TeamMemberTeamSchema, type TeamMemberUser, type TeamMemberUserSchema, type TeamSchema, type UpdateTeamBody, type UpdateWorkspaceBody, type UpdateWorkspaceGroupBody, type UpdateWorkspaceGroupStageBody, type VectorScoreKey, type WhereClause, type WhereOperator, Workspace, type WorkspaceAutoSuspend, type WorkspaceAutoSuspendSchema, WorkspaceConnection, WorkspaceGroup, WorkspaceGroupManager, type WorkspaceGroupSchema, WorkspaceGroupStage, type WorkspaceGroupStageContent, WorkspaceGroupStageManager, type WorkspaceGroupStageSchema, WorkspaceGroupStorageManager, type WorkspaceGroupUpdateWindow, type WorkspaceGroupUpdateWindowSchema, WorkspaceManager, WorkspacePrivateConnectionManager, type WorkspaceResumeAttachment, type WorkspaceResumeAttachmentSchema, type WorkspaceSchema, type WorkspaceSize, updateWindowDaysMap };

@@ -23,3 +23,2 @@ "use strict";

__export(src_exports, {
Connection: () => Connection,
SingleStoreClient: () => SingleStoreClient,

@@ -31,15 +30,2 @@ escape: () => import_mysql22.escape

// src/connection.ts
var import_promise = require("mysql2/promise");
var Connection = class {
constructor(config) {
this.config = config;
this.client = (0, import_promise.createPool)({ multipleStatements: true, ...this.config });
}
client;
async disconnect() {
await this.client.end();
}
};
// src/api/api.ts

@@ -497,2 +483,15 @@ var API = class {

// src/connection.ts
var import_promise = require("mysql2/promise");
var Connection = class {
constructor(config) {
this.config = config;
this.client = (0, import_promise.createPool)({ multipleStatements: true, ...this.config });
}
client;
async disconnect() {
await this.client.end();
}
};
// src/column/column.ts

@@ -1576,3 +1575,2 @@ var Column = class _Column {

0 && (module.exports = {
Connection,
SingleStoreClient,

@@ -1579,0 +1577,0 @@ escape

{
"name": "@singlestore/client",
"version": "0.0.39",
"version": "0.0.40",
"license": "Apache-2.0",

@@ -18,87 +18,2 @@ "sideEffects": false,

"require": "./dist/index.js"
},
"./api": {
"types": "./dist/api/index.d.ts",
"import": "./dist/api/index.mjs",
"require": "./dist/api/index.js"
},
"./billing": {
"types": "./dist/billing/index.d.ts",
"import": "./dist/billing/index.mjs",
"require": "./dist/billing/index.js"
},
"./column": {
"types": "./dist/column/index.d.ts",
"import": "./dist/column/index.mjs",
"require": "./dist/column/index.js"
},
"./database": {
"types": "./dist/database/index.d.ts",
"import": "./dist/database/index.mjs",
"require": "./dist/database/index.js"
},
"./job": {
"types": "./dist/job/index.d.ts",
"import": "./dist/job/index.mjs",
"require": "./dist/job/index.js"
},
"./organization": {
"types": "./dist/organization/index.d.ts",
"import": "./dist/organization/index.mjs",
"require": "./dist/organization/index.js"
},
"./private-connection": {
"types": "./dist/private-connection/index.d.ts",
"import": "./dist/private-connection/index.mjs",
"require": "./dist/private-connection/index.js"
},
"./query": {
"types": "./dist/query/index.d.ts",
"import": "./dist/query/index.mjs",
"require": "./dist/query/index.js"
},
"./region": {
"types": "./dist/region/index.d.ts",
"import": "./dist/region/index.mjs",
"require": "./dist/region/index.js"
},
"./secret": {
"types": "./dist/secret/index.d.ts",
"import": "./dist/secret/index.mjs",
"require": "./dist/secret/index.js"
},
"./table": {
"types": "./dist/table/index.d.ts",
"import": "./dist/table/index.mjs",
"require": "./dist/table/index.js"
},
"./team": {
"types": "./dist/team/index.d.ts",
"import": "./dist/team/index.mjs",
"require": "./dist/team/index.js"
},
"./workspace": {
"types": "./dist/workspace/index.d.ts",
"import": "./dist/workspace/index.mjs",
"require": "./dist/workspace/index.js"
},
"./workspace/private-connection": {
"types": "./dist/workspace/private-connection/index.d.ts",
"import": "./dist/workspace/private-connection/index.mjs",
"require": "./dist/workspace/private-connection/index.js"
},
"./workspace-group": {
"types": "./dist/workspace-group/index.d.ts",
"import": "./dist/workspace-group/index.mjs",
"require": "./dist/workspace-group/index.js"
},
"./stage": {
"types": "./dist/stage/index.d.ts",
"import": "./dist/stage/index.mjs",
"require": "./dist/stage/index.js"
},
"./storage": {
"types": "./dist/storage/index.d.ts",
"import": "./dist/storage/index.mjs",
"require": "./dist/storage/index.js"
}

@@ -105,0 +20,0 @@ },

@@ -200,2 +200,4 @@ # SingleStore Client

- [Get Storage Status](#get-storage-status)
- [Connection](#connection)
- [Execute Custom Query](#execute-custom-query)

@@ -1611,1 +1613,11 @@ </details>

---
### Connection
#### Execute Custom Query
```ts
const result = await connection.client.execute("<SQL_QUERY>");
```
---

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc