rado 1.0.0-preview.4 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/dist/compat.d.ts +8 -0
- package/dist/compat.js +7 -0
- package/dist/core/Builder.d.ts +2 -2
- package/dist/core/Column.d.ts +7 -6
- package/dist/core/Column.js +11 -0
- package/dist/core/Database.d.ts +3 -1
- package/dist/core/Query.d.ts +5 -1
- package/dist/core/Query.js +6 -0
- package/dist/core/Resolver.d.ts +4 -0
- package/dist/core/Resolver.js +4 -0
- package/dist/core/Schema.d.ts +6 -3
- package/dist/core/Table.d.ts +3 -9
- package/dist/core/expr/Conditions.d.ts +3 -1
- package/dist/core/expr/Conditions.js +5 -0
- package/dist/core/query/Delete.d.ts +7 -5
- package/dist/core/query/Delete.js +6 -4
- package/dist/core/query/Insert.d.ts +1 -1
- package/dist/core/query/Insert.js +1 -3
- package/dist/core/query/Select.d.ts +2 -2
- package/dist/core/query/Update.d.ts +5 -4
- package/dist/core/query/Update.js +9 -4
- package/dist/driver/better-sqlite3.js +1 -1
- package/dist/driver/bun-sqlite.js +1 -1
- package/dist/driver/mysql2.js +11 -3
- package/dist/driver/pg.js +5 -2
- package/dist/driver/pglite.js +5 -3
- package/dist/driver/sql.js.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/mysql/{MysqlBuilder.js → builder.js} +1 -1
- package/dist/mysql/{MysqlColumns.d.ts → columns.d.ts} +3 -1
- package/dist/mysql/{MysqlColumns.js → columns.js} +1 -1
- package/dist/mysql/{MysqlDialect.js → dialect.js} +1 -1
- package/dist/mysql/{MysqlDiff.js → diff.js} +2 -2
- package/dist/mysql/transactions.d.ts +3 -0
- package/dist/mysql/transactions.js +20 -0
- package/dist/mysql.d.ts +3 -3
- package/dist/mysql.js +3 -3
- package/dist/{sqlite/SqliteBuilder.js → postgres/builder.js} +1 -1
- package/dist/postgres/{PostgresColumns.d.ts → columns.d.ts} +5 -3
- package/dist/postgres/{PostgresColumns.js → columns.js} +1 -1
- package/dist/postgres/{PostgresDialect.js → dialect.js} +1 -1
- package/dist/postgres/{PostgresDiff.js → diff.js} +3 -3
- package/dist/postgres/transactions.d.ts +2 -0
- package/dist/postgres/transactions.js +12 -0
- package/dist/postgres.d.ts +3 -3
- package/dist/postgres.js +3 -3
- package/dist/{postgres/PostgresBuilder.js → sqlite/builder.js} +1 -1
- package/dist/sqlite/{SqliteColumns.js → columns.js} +1 -1
- package/dist/sqlite/{SqliteDialect.js → dialect.js} +1 -1
- package/dist/sqlite/{SqliteDiff.js → diff.js} +3 -3
- package/dist/sqlite/{SqliteFunctions.js → functions.js} +1 -1
- package/dist/sqlite.d.ts +4 -4
- package/dist/sqlite.js +4 -4
- package/dist/universal/{UniversalColumns.js → columns.js} +1 -1
- package/dist/universal/{UniversalFunctions.js → functions.js} +1 -1
- package/dist/universal/{UniversalTransaction.js → transactions.js} +1 -1
- package/dist/universal.d.ts +3 -3
- package/dist/universal.js +3 -3
- package/package.json +4 -5
- package/dist/interop.d.ts +0 -3
- package/dist/interop.js +0 -0
- /package/dist/mysql/{MysqlBuilder.d.ts → builder.d.ts} +0 -0
- /package/dist/mysql/{MysqlDialect.d.ts → dialect.d.ts} +0 -0
- /package/dist/mysql/{MysqlDiff.d.ts → diff.d.ts} +0 -0
- /package/dist/postgres/{PostgresBuilder.d.ts → builder.d.ts} +0 -0
- /package/dist/postgres/{PostgresDialect.d.ts → dialect.d.ts} +0 -0
- /package/dist/postgres/{PostgresDiff.d.ts → diff.d.ts} +0 -0
- /package/dist/sqlite/{SqliteBuilder.d.ts → builder.d.ts} +0 -0
- /package/dist/sqlite/{SqliteColumns.d.ts → columns.d.ts} +0 -0
- /package/dist/sqlite/{SqliteDialect.d.ts → dialect.d.ts} +0 -0
- /package/dist/sqlite/{SqliteDiff.d.ts → diff.d.ts} +0 -0
- /package/dist/sqlite/{SqliteFunctions.d.ts → functions.d.ts} +0 -0
- /package/dist/universal/{UniversalColumns.d.ts → columns.d.ts} +0 -0
- /package/dist/universal/{UniversalFunctions.d.ts → functions.d.ts} +0 -0
- /package/dist/universal/{UniversalTransaction.d.ts → transactions.d.ts} +0 -0
package/README.md
CHANGED
package/dist/compat.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HasSql } from './core/Internal.js';
|
|
2
|
+
import type { Sql } from './core/Sql.js';
|
|
3
|
+
import type { Table, TableDefinition, TableFields, TableInsert, TableRow } from './core/Table.js';
|
|
4
|
+
export type InferSelectModel<T> = T extends Table<infer Definition> ? TableRow<Definition> : never;
|
|
5
|
+
export type InferInsertModel<T> = T extends Table<infer Definition> ? TableInsert<Definition> : never;
|
|
6
|
+
export type SQL<T = unknown> = Sql<T>;
|
|
7
|
+
export type SQLWrapper<T = unknown> = HasSql<T>;
|
|
8
|
+
export declare function getTableColumns<Definition extends TableDefinition>(table: Table<Definition>): TableFields<Definition>;
|
package/dist/compat.js
ADDED
package/dist/core/Builder.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type HasQuery, type HasSql, type HasTarget, internalData } from './Internal.js';
|
|
2
2
|
import type { IsPostgres, QueryMeta } from './MetaData.js';
|
|
3
3
|
import type { QueryData } from './Query.js';
|
|
4
4
|
import { type SelectionInput } from './Selection.js';
|
|
@@ -18,7 +18,7 @@ declare class BuilderBase<Meta extends QueryMeta> {
|
|
|
18
18
|
selectDistinctOn<Input extends SelectionInput>(this: Builder<IsPostgres>, columns: Array<HasSql>, selection: Input): WithSelection<Input, Meta>;
|
|
19
19
|
update<Definition extends TableDefinition>(table: Table<Definition>): UpdateTable<Definition, Meta>;
|
|
20
20
|
insert<Definition extends TableDefinition>(into: Table<Definition>): InsertInto<Definition, Meta>;
|
|
21
|
-
delete(from:
|
|
21
|
+
delete<Definition extends TableDefinition>(from: Table<Definition>): DeleteFrom<Definition, Meta>;
|
|
22
22
|
}
|
|
23
23
|
export type CTE<Input = unknown> = Input & HasTarget & HasQuery;
|
|
24
24
|
export declare class Builder<Meta extends QueryMeta> extends BuilderBase<Meta> {
|
package/dist/core/Column.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { DriverSpecs } from './Driver.js';
|
|
2
|
-
import type { HasSql } from './Internal.js';
|
|
3
2
|
import { internalData } from './Internal.js';
|
|
4
3
|
import { type Sql } from './Sql.js';
|
|
5
4
|
import type { Field, FieldData } from './expr/Field.js';
|
|
@@ -12,10 +11,10 @@ export interface ColumnData {
|
|
|
12
11
|
notNull?: boolean;
|
|
13
12
|
isUnique?: boolean;
|
|
14
13
|
autoIncrement?: boolean;
|
|
15
|
-
defaultValue?():
|
|
14
|
+
defaultValue?(): Sql;
|
|
16
15
|
references?(): FieldData;
|
|
17
|
-
onUpdate?:
|
|
18
|
-
onDelete?:
|
|
16
|
+
onUpdate?: Sql;
|
|
17
|
+
onDelete?: Sql;
|
|
19
18
|
mapFromDriverValue?(value: unknown, specs: DriverSpecs): unknown;
|
|
20
19
|
mapToDriverValue?(value: unknown): unknown;
|
|
21
20
|
}
|
|
@@ -23,18 +22,20 @@ type WithoutNull<Value> = Exclude<Value, null>;
|
|
|
23
22
|
export declare class Column<Value = unknown> {
|
|
24
23
|
readonly [internalData]: ColumnData;
|
|
25
24
|
constructor(data: ColumnData);
|
|
26
|
-
notNull(): RequiredColumn<
|
|
25
|
+
notNull(): RequiredColumn<Value>;
|
|
27
26
|
default(value: Input<WithoutNull<Value>> | (() => Input<WithoutNull<Value>>)): Column<WithoutNull<Value>>;
|
|
27
|
+
defaultNow(): Column<WithoutNull<Value>>;
|
|
28
28
|
primaryKey(): Column<WithoutNull<Value>>;
|
|
29
29
|
unique(name?: string): Column<Value>;
|
|
30
30
|
references(foreignField: Field | (() => Field)): Column<Value>;
|
|
31
|
+
$type<T>(): Column<null extends Value ? T | null : T>;
|
|
31
32
|
}
|
|
32
33
|
export declare class JsonColumn<Value = unknown> extends Column<Value> {
|
|
33
34
|
private brand;
|
|
34
35
|
constructor(data: ColumnData);
|
|
35
36
|
}
|
|
36
37
|
declare const required: unique symbol;
|
|
37
|
-
export interface RequiredColumn<Value = unknown> extends Column<Value
|
|
38
|
+
export interface RequiredColumn<Value = unknown> extends Column<WithoutNull<Value>> {
|
|
38
39
|
[required]: true;
|
|
39
40
|
}
|
|
40
41
|
export interface Columns {
|
package/dist/core/Column.js
CHANGED
|
@@ -21,6 +21,14 @@ var Column = class _Column {
|
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
+
defaultNow() {
|
|
25
|
+
return new _Column({
|
|
26
|
+
...getData(this),
|
|
27
|
+
defaultValue() {
|
|
28
|
+
return sql.unsafe("now()");
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
24
32
|
primaryKey() {
|
|
25
33
|
return new _Column({ ...getData(this), primary: true });
|
|
26
34
|
}
|
|
@@ -37,6 +45,9 @@ var Column = class _Column {
|
|
|
37
45
|
}
|
|
38
46
|
});
|
|
39
47
|
}
|
|
48
|
+
$type() {
|
|
49
|
+
return this;
|
|
50
|
+
}
|
|
40
51
|
};
|
|
41
52
|
var JsonColumn = class extends Column {
|
|
42
53
|
constructor(data) {
|
package/dist/core/Database.d.ts
CHANGED
|
@@ -22,7 +22,9 @@ export declare class Database<Meta extends QueryMeta = Either> extends Builder<M
|
|
|
22
22
|
migrate(...tables: Array<Table>): Deliver<Meta, void>;
|
|
23
23
|
batch<Queries extends Array<HasSql | HasQuery>>(queries: Queries): QueryBatch<unknown, Meta>;
|
|
24
24
|
execute(input: HasSql): Deliver<Meta, void>;
|
|
25
|
-
transaction<T>(run: (tx: Transaction<Meta>) => T, options?: TransactionOptions[Meta['dialect']]):
|
|
25
|
+
transaction<T>(this: Database<Sync>, run: (tx: Transaction<Meta>) => T, options?: TransactionOptions[Meta['dialect']]): T;
|
|
26
|
+
transaction<T>(this: Database<Async>, run: (tx: Transaction<Meta>) => Promise<T>, options?: TransactionOptions[Meta['dialect']]): Promise<T>;
|
|
27
|
+
transaction<T>(run: (tx: Transaction<Meta>) => T | Promise<T>, options?: TransactionOptions[Meta['dialect']]): Deliver<Meta, T>;
|
|
26
28
|
}
|
|
27
29
|
export interface TransactionOptions {
|
|
28
30
|
universal: never;
|
package/dist/core/Query.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type HasQuery, type HasResolver, type HasSql, type HasTarget, internalData, internalQuery } from './Internal.js';
|
|
2
2
|
import type { Deliver, QueryMeta } from './MetaData.js';
|
|
3
3
|
import type { PreparedStatement, Resolver } from './Resolver.js';
|
|
4
4
|
import type { Sql } from './Sql.js';
|
|
@@ -29,6 +29,10 @@ export declare abstract class Query<Result, Meta extends QueryMeta> extends Exec
|
|
|
29
29
|
get(db?: HasResolver): Deliver<Meta, Result>;
|
|
30
30
|
run(db?: HasResolver): Deliver<Meta, void>;
|
|
31
31
|
prepare<Inputs extends Record<string, unknown>>(name?: string): PreparedQuery<Result, Inputs, Meta>;
|
|
32
|
+
toSQL(): {
|
|
33
|
+
sql: string;
|
|
34
|
+
params: Array<unknown>;
|
|
35
|
+
};
|
|
32
36
|
}
|
|
33
37
|
export interface PreparedQuery<Result, Inputs extends Record<string, unknown>, Meta extends QueryMeta> extends PreparedStatement<Meta> {
|
|
34
38
|
all(inputs?: Inputs): Deliver<Meta, Array<Result>>;
|
package/dist/core/Query.js
CHANGED
|
@@ -80,6 +80,12 @@ var Query = class extends Executable {
|
|
|
80
80
|
prepare(name) {
|
|
81
81
|
return getData(this).resolver.prepare(this, name);
|
|
82
82
|
}
|
|
83
|
+
toSQL() {
|
|
84
|
+
const { resolver } = getData(this);
|
|
85
|
+
if (!resolver)
|
|
86
|
+
throw new Error("Query has no resolver");
|
|
87
|
+
return resolver.toSQL(this);
|
|
88
|
+
}
|
|
83
89
|
};
|
|
84
90
|
export {
|
|
85
91
|
Query,
|
package/dist/core/Resolver.d.ts
CHANGED
|
@@ -8,6 +8,10 @@ export declare class Resolver<Meta extends QueryMeta = QueryMeta> {
|
|
|
8
8
|
#private;
|
|
9
9
|
private brand;
|
|
10
10
|
constructor(driver: Driver, dialect: Dialect);
|
|
11
|
+
toSQL(query: HasQuery): {
|
|
12
|
+
sql: string;
|
|
13
|
+
params: Array<unknown>;
|
|
14
|
+
};
|
|
11
15
|
prepare(query: HasQuery, name?: string): PreparedStatement<Meta>;
|
|
12
16
|
batch(queries: Array<HasSql | HasQuery>): Batch<Meta>;
|
|
13
17
|
}
|
package/dist/core/Resolver.js
CHANGED
|
@@ -10,6 +10,10 @@ var Resolver = class {
|
|
|
10
10
|
this.#driver = driver;
|
|
11
11
|
this.#dialect = dialect;
|
|
12
12
|
}
|
|
13
|
+
toSQL(query) {
|
|
14
|
+
const emitter = this.#dialect.emit(query);
|
|
15
|
+
return { sql: emitter.sql, params: emitter.bind() };
|
|
16
|
+
}
|
|
13
17
|
prepare(query, name) {
|
|
14
18
|
const isSelection = hasSelection(query);
|
|
15
19
|
const mapRow = isSelection ? getSelection(query).mapRow : void 0;
|
package/dist/core/Schema.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { type Table, type TableConfig, type TableDefinition } from './Table.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
type Prefix<SchemaName extends string, TableName extends string> = `${SchemaName}.${TableName}`;
|
|
3
|
+
export interface Schema<SchemaName extends string> {
|
|
4
|
+
table<Definition extends TableDefinition, TableName extends string>(tableName: TableName, columns: Definition, config?: (self: Table<Definition>) => TableConfig<Prefix<SchemaName, TableName>>): Table<Definition, Prefix<SchemaName, TableName>>;
|
|
5
|
+
}
|
|
6
|
+
export declare function schema<SchemaName extends string>(schemaName: SchemaName): Schema<SchemaName>;
|
|
7
|
+
export {};
|
package/dist/core/Table.d.ts
CHANGED
|
@@ -38,18 +38,12 @@ export type TableFields<Definition extends TableDefinition, TableName extends st
|
|
|
38
38
|
export type TableRow<Definition extends TableDefinition> = {
|
|
39
39
|
[K in keyof Definition]: Definition[K] extends Column<infer T> ? T : never;
|
|
40
40
|
} & {};
|
|
41
|
-
type IsReq<Col> = Col extends RequiredColumn ? true : false;
|
|
42
|
-
type Required<D> = {
|
|
43
|
-
[K in keyof D as true extends IsReq<D[K]> ? K : never]: D[K];
|
|
44
|
-
};
|
|
45
|
-
type Optional<D> = {
|
|
46
|
-
[K in keyof D as false extends IsReq<D[K]> ? K : never]: D[K];
|
|
47
|
-
};
|
|
41
|
+
type IsReq<Col> = Col extends RequiredColumn<infer Value> ? null extends Value ? true : false : false;
|
|
48
42
|
type RequiredInput<D> = {
|
|
49
|
-
readonly [K in keyof
|
|
43
|
+
readonly [K in keyof D as true extends IsReq<D[K]> ? K : never]: D[K] extends Column<infer V> ? Input<V> : never;
|
|
50
44
|
};
|
|
51
45
|
type OptionalInput<D> = {
|
|
52
|
-
readonly [K in keyof
|
|
46
|
+
readonly [K in keyof D as false extends IsReq<D[K]> ? K : never]?: D[K] extends Column<infer V> ? Input<V> : never;
|
|
53
47
|
};
|
|
54
48
|
export type TableInsert<Definition extends TableDefinition> = RequiredInput<Definition> & OptionalInput<Definition>;
|
|
55
49
|
export type TableUpdate<Definition extends TableDefinition> = {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type HasSql } from '../Internal.js';
|
|
2
2
|
import { type Sql } from '../Sql.js';
|
|
3
|
+
import type { Select } from '../query/Select.js';
|
|
3
4
|
import { type Input } from './Input.js';
|
|
4
5
|
export declare const eq: <T>(left: Input<T>, right: Input<T>) => Sql<boolean>;
|
|
5
6
|
export declare const ne: <T>(left: Input<T>, right: Input<T>) => Sql<boolean>;
|
|
@@ -28,3 +29,4 @@ export declare function desc<T>(input: HasSql<T>): Sql;
|
|
|
28
29
|
export declare function distinct<T>(input: HasSql<T>): Sql;
|
|
29
30
|
export declare function when<In, Out>(compare: Input<In>, ...cases: Array<[condition: Input<In>, result: Input<Out>] | Input<Out>>): Sql<Out>;
|
|
30
31
|
export declare function when<Out>(...cases: Array<[condition: Input<boolean>, result: Input<Out>] | Input<Out>>): Sql<Out>;
|
|
32
|
+
export declare function exists<T>(query: Select<T>): Sql<boolean>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/core/expr/Conditions.ts
|
|
2
|
+
import { getQuery } from "../Internal.js";
|
|
2
3
|
import { sql } from "../Sql.js";
|
|
3
4
|
import { input } from "./Input.js";
|
|
4
5
|
function binop(operator) {
|
|
@@ -92,6 +93,9 @@ function when(...cases) {
|
|
|
92
93
|
sql`end`
|
|
93
94
|
]);
|
|
94
95
|
}
|
|
96
|
+
function exists(query) {
|
|
97
|
+
return sql`exists (${getQuery(query)})`;
|
|
98
|
+
}
|
|
95
99
|
export {
|
|
96
100
|
and,
|
|
97
101
|
arrayContained,
|
|
@@ -102,6 +106,7 @@ export {
|
|
|
102
106
|
desc,
|
|
103
107
|
distinct,
|
|
104
108
|
eq,
|
|
109
|
+
exists,
|
|
105
110
|
gt,
|
|
106
111
|
gte,
|
|
107
112
|
ilike,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { QueryMeta } from '../MetaData.js';
|
|
1
|
+
import { type HasSql, type HasTable, internalData, internalQuery, internalSelection } from '../Internal.js';
|
|
2
|
+
import type { IsPostgres, IsSqlite, QueryMeta } from '../MetaData.js';
|
|
3
3
|
import { Query, type QueryData } from '../Query.js';
|
|
4
4
|
import { type Selection, type SelectionInput, type SelectionRow } from '../Selection.js';
|
|
5
5
|
import { type Sql } from '../Sql.js';
|
|
6
|
+
import type { TableDefinition, TableRow } from '../Table.js';
|
|
6
7
|
export interface DeleteData<Meta extends QueryMeta = QueryMeta> extends QueryData<Meta> {
|
|
7
8
|
from: HasTable;
|
|
8
9
|
where?: HasSql;
|
|
@@ -14,7 +15,8 @@ export declare class Delete<Result, Meta extends QueryMeta = QueryMeta> extends
|
|
|
14
15
|
constructor(data: DeleteData<Meta>);
|
|
15
16
|
get [internalQuery](): Sql;
|
|
16
17
|
}
|
|
17
|
-
export declare class DeleteFrom<Meta extends QueryMeta> extends Delete<void, Meta> {
|
|
18
|
-
where(
|
|
19
|
-
returning<
|
|
18
|
+
export declare class DeleteFrom<Definition extends TableDefinition, Meta extends QueryMeta> extends Delete<void, Meta> {
|
|
19
|
+
where(...where: Array<HasSql<boolean> | undefined>): DeleteFrom<Definition, Meta>;
|
|
20
|
+
returning(this: DeleteFrom<Definition, IsPostgres | IsSqlite>): Delete<TableRow<Definition>, Meta>;
|
|
21
|
+
returning<Input extends SelectionInput>(this: DeleteFrom<Definition, IsPostgres | IsSqlite>, returning: Input): Delete<SelectionRow<Input>, Meta>;
|
|
20
22
|
}
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
selection
|
|
11
11
|
} from "../Selection.js";
|
|
12
12
|
import { sql } from "../Sql.js";
|
|
13
|
+
import { and } from "../expr/Conditions.js";
|
|
13
14
|
var Delete = class extends Query {
|
|
14
15
|
[internalData];
|
|
15
16
|
constructor(data) {
|
|
@@ -23,13 +24,14 @@ var Delete = class extends Query {
|
|
|
23
24
|
}
|
|
24
25
|
};
|
|
25
26
|
var DeleteFrom = class _DeleteFrom extends Delete {
|
|
26
|
-
where(
|
|
27
|
-
return new _DeleteFrom({ ...getData(this), where:
|
|
27
|
+
where(...where) {
|
|
28
|
+
return new _DeleteFrom({ ...getData(this), where: and(...where) });
|
|
28
29
|
}
|
|
29
30
|
returning(returning) {
|
|
31
|
+
const data = getData(this);
|
|
30
32
|
return new Delete({
|
|
31
|
-
...
|
|
32
|
-
returning: selection(returning)
|
|
33
|
+
...data,
|
|
34
|
+
returning: selection(returning ?? data.from)
|
|
33
35
|
});
|
|
34
36
|
}
|
|
35
37
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type HasSql, type HasTable, internalData, internalQuery, internalSelection } from '../Internal.js';
|
|
2
2
|
import type { IsPostgres, IsSqlite, QueryMeta } from '../MetaData.js';
|
|
3
3
|
import { Query, type QueryData } from '../Query.js';
|
|
4
4
|
import { type Selection, type SelectionInput, type SelectionRow } from '../Selection.js';
|
|
@@ -80,13 +80,11 @@ var InsertInto = class {
|
|
|
80
80
|
return sql`(${sql.join(
|
|
81
81
|
Object.entries(table.columns).map(([key, column]) => {
|
|
82
82
|
const value = row[key];
|
|
83
|
-
const { defaultValue,
|
|
83
|
+
const { defaultValue, mapToDriverValue } = getData(column);
|
|
84
84
|
if (value !== void 0)
|
|
85
85
|
return input(mapToDriverValue?.(value) ?? value);
|
|
86
86
|
if (defaultValue)
|
|
87
87
|
return defaultValue();
|
|
88
|
-
if (notNull)
|
|
89
|
-
throw new Error(`Column "${key}" is not nullable`);
|
|
90
88
|
return sql.chunk("emitDefaultValue", void 0);
|
|
91
89
|
}),
|
|
92
90
|
sql`, `
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type HasSelection, type HasSql, type HasTable, type HasTarget, internalData, internalQuery, internalSelection } from '../Internal.js';
|
|
2
2
|
import type { QueryMeta } from '../MetaData.js';
|
|
3
3
|
import type { Query } from '../Query.js';
|
|
4
4
|
import { type IsNullable, type MakeNullable, type Selection, type SelectionRecord, type SelectionRow } from '../Selection.js';
|
|
@@ -35,7 +35,7 @@ export declare class Select<Input, Meta extends QueryMeta = QueryMeta> extends U
|
|
|
35
35
|
rightJoin(right: HasTable, on: HasSql<boolean>): Select<Input, Meta>;
|
|
36
36
|
innerJoin(right: HasTable, on: HasSql<boolean>): Select<Input, Meta>;
|
|
37
37
|
fullJoin(right: HasTable, on: HasSql<boolean>): Select<Input, Meta>;
|
|
38
|
-
where(...where: Array<HasSql<boolean
|
|
38
|
+
where(...where: Array<HasSql<boolean> | undefined>): Select<Input, Meta>;
|
|
39
39
|
groupBy(...exprs: Array<HasSql>): Select<Input, Meta>;
|
|
40
40
|
having(having: HasSql<boolean>): Select<Input, Meta>;
|
|
41
41
|
orderBy(...exprs: Array<HasSql>): Select<Input, Meta>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type HasSql, type HasTable, internalData, internalQuery, internalSelection } from '../Internal.js';
|
|
2
2
|
import type { IsPostgres, IsSqlite, QueryMeta } from '../MetaData.js';
|
|
3
3
|
import { Query, type QueryData } from '../Query.js';
|
|
4
4
|
import { type Selection, type SelectionInput, type SelectionRow } from '../Selection.js';
|
|
5
5
|
import { type Sql } from '../Sql.js';
|
|
6
|
-
import type { TableDefinition, TableUpdate } from '../Table.js';
|
|
6
|
+
import type { TableDefinition, TableRow, TableUpdate } from '../Table.js';
|
|
7
7
|
export interface UpdateData<Meta extends QueryMeta = QueryMeta> extends QueryData<Meta> {
|
|
8
8
|
table: HasTable;
|
|
9
9
|
set?: HasSql;
|
|
@@ -18,6 +18,7 @@ export declare class Update<Result, Meta extends QueryMeta = QueryMeta> extends
|
|
|
18
18
|
}
|
|
19
19
|
export declare class UpdateTable<Definition extends TableDefinition, Meta extends QueryMeta> extends Update<void, Meta> {
|
|
20
20
|
set(values: TableUpdate<Definition>): UpdateTable<Definition, Meta>;
|
|
21
|
-
where(where: HasSql<boolean>): UpdateTable<Definition, Meta>;
|
|
22
|
-
returning
|
|
21
|
+
where(...where: Array<HasSql<boolean> | undefined>): UpdateTable<Definition, Meta>;
|
|
22
|
+
returning(this: UpdateTable<Definition, IsPostgres | IsSqlite>): Update<TableRow<Definition>, Meta>;
|
|
23
|
+
returning<Input extends SelectionInput>(this: UpdateTable<Definition, IsPostgres | IsSqlite>, returning?: Input): Update<SelectionRow<Input>, Meta>;
|
|
23
24
|
}
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
selection
|
|
12
12
|
} from "../Selection.js";
|
|
13
13
|
import { sql } from "../Sql.js";
|
|
14
|
+
import { and } from "../expr/Conditions.js";
|
|
14
15
|
import { input } from "../expr/Input.js";
|
|
15
16
|
var Update = class extends Query {
|
|
16
17
|
[internalData];
|
|
@@ -39,13 +40,17 @@ var UpdateTable = class _UpdateTable extends Update {
|
|
|
39
40
|
);
|
|
40
41
|
return new _UpdateTable({ ...getData(this), set });
|
|
41
42
|
}
|
|
42
|
-
where(where) {
|
|
43
|
-
return new _UpdateTable({
|
|
43
|
+
where(...where) {
|
|
44
|
+
return new _UpdateTable({
|
|
45
|
+
...getData(this),
|
|
46
|
+
where: and(...where)
|
|
47
|
+
});
|
|
44
48
|
}
|
|
45
49
|
returning(returning) {
|
|
50
|
+
const data = getData(this);
|
|
46
51
|
return new Update({
|
|
47
|
-
...
|
|
48
|
-
returning: selection(returning)
|
|
52
|
+
...data,
|
|
53
|
+
returning: selection(returning ?? data.table)
|
|
49
54
|
});
|
|
50
55
|
}
|
|
51
56
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/driver/better-sqlite3.ts
|
|
2
2
|
import { SyncDatabase } from "../core/Database.js";
|
|
3
3
|
import { sqliteDialect } from "../sqlite.js";
|
|
4
|
-
import { sqliteDiff } from "../sqlite/
|
|
4
|
+
import { sqliteDiff } from "../sqlite/diff.js";
|
|
5
5
|
var PreparedStatement = class {
|
|
6
6
|
constructor(stmt, isSelection) {
|
|
7
7
|
this.stmt = stmt;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/driver/bun-sqlite.ts
|
|
2
2
|
import { SyncDatabase } from "../core/Database.js";
|
|
3
3
|
import { sqliteDialect } from "../sqlite.js";
|
|
4
|
-
import { sqliteDiff } from "../sqlite/
|
|
4
|
+
import { sqliteDiff } from "../sqlite/diff.js";
|
|
5
5
|
var PreparedStatement = class {
|
|
6
6
|
constructor(stmt) {
|
|
7
7
|
this.stmt = stmt;
|
package/dist/driver/mysql2.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// src/driver/mysql2.ts
|
|
2
2
|
import { AsyncDatabase } from "../core/Database.js";
|
|
3
|
-
import { mysqlDialect } from "../mysql/
|
|
4
|
-
import { mysqlDiff } from "../mysql/
|
|
3
|
+
import { mysqlDialect } from "../mysql/dialect.js";
|
|
4
|
+
import { mysqlDiff } from "../mysql/diff.js";
|
|
5
|
+
import { setTransaction, startTransaction } from "../mysql/transactions.js";
|
|
5
6
|
var PreparedStatement = class {
|
|
6
7
|
constructor(client, sql, name) {
|
|
7
8
|
this.client = client;
|
|
@@ -54,7 +55,14 @@ var Mysql2Driver = class _Mysql2Driver {
|
|
|
54
55
|
const client = isPool(this.client) ? await this.client.getConnection() : this.client;
|
|
55
56
|
const driver = new _Mysql2Driver(client, this.depth + 1);
|
|
56
57
|
try {
|
|
57
|
-
await client.query(
|
|
58
|
+
await client.query(
|
|
59
|
+
this.depth > 0 ? `savepoint d${this.depth}` : startTransaction(options)
|
|
60
|
+
);
|
|
61
|
+
if (this.depth === 0) {
|
|
62
|
+
const setOptions = setTransaction(options);
|
|
63
|
+
if (setOptions)
|
|
64
|
+
await client.query(setOptions);
|
|
65
|
+
}
|
|
58
66
|
const result = await run(driver);
|
|
59
67
|
await client.query(
|
|
60
68
|
this.depth > 0 ? `release savepoint d${this.depth}` : "commit"
|
package/dist/driver/pg.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// src/driver/pg.ts
|
|
2
2
|
import { AsyncDatabase } from "../core/Database.js";
|
|
3
|
-
import { postgresDialect } from "../postgres/
|
|
4
|
-
import { postgresDiff } from "../postgres/
|
|
3
|
+
import { postgresDialect } from "../postgres/dialect.js";
|
|
4
|
+
import { postgresDiff } from "../postgres/diff.js";
|
|
5
|
+
import { setTransaction } from "../postgres/transactions.js";
|
|
5
6
|
var PreparedStatement = class {
|
|
6
7
|
constructor(client, sql, name) {
|
|
7
8
|
this.client = client;
|
|
@@ -69,6 +70,8 @@ var PgDriver = class _PgDriver {
|
|
|
69
70
|
const client = "totalCount" in this.client ? await this.client.connect() : this.client;
|
|
70
71
|
try {
|
|
71
72
|
await client.query(this.depth > 0 ? `savepoint d${this.depth}` : "begin");
|
|
73
|
+
if (this.depth === 0)
|
|
74
|
+
await client.query(setTransaction(options));
|
|
72
75
|
const result = await run(new _PgDriver(client, this.depth + 1));
|
|
73
76
|
await client.query(
|
|
74
77
|
this.depth > 0 ? `release savepoint d${this.depth}` : "commit"
|
package/dist/driver/pglite.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// src/driver/pglite.ts
|
|
2
2
|
import { AsyncDatabase } from "../index.js";
|
|
3
|
-
import { postgresDialect } from "../postgres/
|
|
4
|
-
import { postgresDiff } from "../postgres/
|
|
3
|
+
import { postgresDialect } from "../postgres/dialect.js";
|
|
4
|
+
import { postgresDiff } from "../postgres/diff.js";
|
|
5
|
+
import { setTransaction } from "../postgres/transactions.js";
|
|
5
6
|
var PreparedStatement = class {
|
|
6
7
|
constructor(client, sql) {
|
|
7
8
|
this.client = client;
|
|
@@ -59,7 +60,8 @@ var PGliteDriver = class _PGliteDriver {
|
|
|
59
60
|
}
|
|
60
61
|
async transaction(run, options) {
|
|
61
62
|
if (this.depth === 0 && "transaction" in this.client)
|
|
62
|
-
return this.client.transaction((tx) => {
|
|
63
|
+
return this.client.transaction(async (tx) => {
|
|
64
|
+
await tx.query(setTransaction(options));
|
|
63
65
|
return run(new _PGliteDriver(tx, this.depth + 1));
|
|
64
66
|
});
|
|
65
67
|
await this.exec(`savepoint d${this.depth}`);
|
package/dist/driver/sql.js.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/driver/sql.js.ts
|
|
2
2
|
import { SyncDatabase } from "../core/Database.js";
|
|
3
3
|
import { sqliteDialect } from "../sqlite.js";
|
|
4
|
-
import { sqliteDiff } from "../sqlite/
|
|
4
|
+
import { sqliteDiff } from "../sqlite/diff.js";
|
|
5
5
|
var PreparedStatement = class {
|
|
6
6
|
constructor(client, stmt) {
|
|
7
7
|
this.client = client;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './compat.js';
|
|
1
2
|
export * from './core/Column.js';
|
|
2
3
|
export * from './core/Constraint.js';
|
|
3
4
|
export * from './core/Database.js';
|
|
@@ -15,4 +16,3 @@ export * from './core/query/Update.js';
|
|
|
15
16
|
export * from './core/Selection.js';
|
|
16
17
|
export * from './core/Sql.js';
|
|
17
18
|
export * from './core/Table.js';
|
|
18
|
-
export * from './interop.js';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
+
export * from "./compat.js";
|
|
2
3
|
export * from "./core/Column.js";
|
|
3
4
|
export * from "./core/Constraint.js";
|
|
4
5
|
export * from "./core/Database.js";
|
|
@@ -16,4 +17,3 @@ export * from "./core/query/Update.js";
|
|
|
16
17
|
export * from "./core/Selection.js";
|
|
17
18
|
export * from "./core/Sql.js";
|
|
18
19
|
export * from "./core/Table.js";
|
|
19
|
-
export * from "./interop.js";
|
|
@@ -14,10 +14,12 @@ export declare function boolean(name?: string): Column<boolean | null>;
|
|
|
14
14
|
export declare function char(name?: string, options?: {
|
|
15
15
|
length: number;
|
|
16
16
|
}): Column<string | null>;
|
|
17
|
+
export declare function date(name?: string, options?: {
|
|
18
|
+
mode: 'string';
|
|
19
|
+
}): Column<string | null>;
|
|
17
20
|
export declare function date(name: string | undefined, options: {
|
|
18
21
|
mode: 'date';
|
|
19
22
|
}): Column<Date | null>;
|
|
20
|
-
export declare function date(name?: string): Column<string | null>;
|
|
21
23
|
export declare function datetime(name?: string, options?: {
|
|
22
24
|
fsp?: Precision;
|
|
23
25
|
}): Column<Date | null>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/mysql/transactions.ts
|
|
2
|
+
function startTransaction(options) {
|
|
3
|
+
return [
|
|
4
|
+
"start transaction",
|
|
5
|
+
options.withConsistentSnapshot && "with consistent snapshot",
|
|
6
|
+
options.accessMode
|
|
7
|
+
].filter(Boolean).join(" ");
|
|
8
|
+
}
|
|
9
|
+
function setTransaction(options) {
|
|
10
|
+
if (!options.isolationLevel)
|
|
11
|
+
return;
|
|
12
|
+
return [
|
|
13
|
+
"set transaction",
|
|
14
|
+
options.isolationLevel && `isolation level ${options.isolationLevel}`
|
|
15
|
+
].filter(Boolean).join(" ");
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
setTransaction,
|
|
19
|
+
startTransaction
|
|
20
|
+
};
|
package/dist/mysql.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ export { index, uniqueIndex } from './core/Index.js';
|
|
|
2
2
|
export { except, exceptAll, intersect, intersectAll, union, unionAll } from './core/query/Union.js';
|
|
3
3
|
export { schema as mysqlSchema } from './core/Schema.js';
|
|
4
4
|
export { alias, table as mysqlTable } from './core/Table.js';
|
|
5
|
-
export * from './mysql/
|
|
6
|
-
export * from './mysql/
|
|
7
|
-
export * from './mysql/
|
|
5
|
+
export * from './mysql/builder.js';
|
|
6
|
+
export * from './mysql/columns.js';
|
|
7
|
+
export * from './mysql/dialect.js';
|
package/dist/mysql.js
CHANGED
|
@@ -10,9 +10,9 @@ import {
|
|
|
10
10
|
} from "./core/query/Union.js";
|
|
11
11
|
import { schema } from "./core/Schema.js";
|
|
12
12
|
import { alias, table } from "./core/Table.js";
|
|
13
|
-
export * from "./mysql/
|
|
14
|
-
export * from "./mysql/
|
|
15
|
-
export * from "./mysql/
|
|
13
|
+
export * from "./mysql/builder.js";
|
|
14
|
+
export * from "./mysql/columns.js";
|
|
15
|
+
export * from "./mysql/dialect.js";
|
|
16
16
|
export {
|
|
17
17
|
alias,
|
|
18
18
|
except,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type Column, JsonColumn } from '../core/Column.js';
|
|
2
2
|
type Precision = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
3
3
|
type IntervalFields = 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'year to month' | 'day to hour' | 'day to minute' | 'day to second' | 'hour to minute' | 'hour to second' | 'minute to second';
|
|
4
4
|
export declare function bigint(name: string | undefined, options: {
|
|
@@ -13,10 +13,12 @@ export declare function char(name?: string, options?: {
|
|
|
13
13
|
length: number;
|
|
14
14
|
}): Column<string | null>;
|
|
15
15
|
export declare function cidr(name?: string): Column<string | null>;
|
|
16
|
+
export declare function date(name?: string, options?: {
|
|
17
|
+
mode: 'string';
|
|
18
|
+
}): Column<string | null>;
|
|
16
19
|
export declare function date(name: string | undefined, options: {
|
|
17
20
|
mode: 'date';
|
|
18
21
|
}): Column<Date | null>;
|
|
19
|
-
export declare function date(name?: string): Column<string | null>;
|
|
20
22
|
export declare function doublePrecision(name?: string): Column<number | null>;
|
|
21
23
|
export declare function inet(name?: string): Column<string | null>;
|
|
22
24
|
export declare function integer(name?: string): Column<number | null>;
|
|
@@ -26,7 +28,7 @@ export declare function interval(name?: string, options?: {
|
|
|
26
28
|
fields?: IntervalFields;
|
|
27
29
|
precision?: Precision;
|
|
28
30
|
}): Column<string | null>;
|
|
29
|
-
export declare function serial(name?: string): Column<number
|
|
31
|
+
export declare function serial(name?: string): Column<number>;
|
|
30
32
|
export declare function boolean(name?: string): Column<boolean | null>;
|
|
31
33
|
export declare function blob(name?: string): Column<Uint8Array | null>;
|
|
32
34
|
export declare function text(name?: string): Column<string | null>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/postgres/
|
|
1
|
+
// src/postgres/diff.ts
|
|
2
2
|
import { getData, getTable } from "../core/Internal.js";
|
|
3
3
|
import { sql } from "../core/Sql.js";
|
|
4
4
|
import { table } from "../core/Table.js";
|
|
@@ -15,8 +15,8 @@ import {
|
|
|
15
15
|
when
|
|
16
16
|
} from "../core/expr/Conditions.js";
|
|
17
17
|
import { concat, txGenerator } from "../universal.js";
|
|
18
|
-
import * as column from "./
|
|
19
|
-
import { postgresDialect } from "./
|
|
18
|
+
import * as column from "./columns.js";
|
|
19
|
+
import { postgresDialect } from "./dialect.js";
|
|
20
20
|
var Attr = table("pg_attribute", {
|
|
21
21
|
name: column.text("attname").notNull(),
|
|
22
22
|
typId: column.oid("atttypid").notNull(),
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// src/postgres/transactions.ts
|
|
2
|
+
function setTransaction(options) {
|
|
3
|
+
return [
|
|
4
|
+
"set transaction",
|
|
5
|
+
options.isolationLevel && `isolation level ${options.isolationLevel}`,
|
|
6
|
+
options.accessMode,
|
|
7
|
+
options.deferrable ? "deferrable" : "not deferrable"
|
|
8
|
+
].filter(Boolean).join(" ");
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
setTransaction
|
|
12
|
+
};
|
package/dist/postgres.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ export { index, uniqueIndex } from './core/Index.js';
|
|
|
2
2
|
export { except, exceptAll, intersect, intersectAll, union, unionAll } from './core/query/Union.js';
|
|
3
3
|
export { schema as pgSchema } from './core/Schema.js';
|
|
4
4
|
export { alias, table as pgTable } from './core/Table.js';
|
|
5
|
-
export * from './postgres/
|
|
6
|
-
export * from './postgres/
|
|
7
|
-
export * from './postgres/
|
|
5
|
+
export * from './postgres/builder.js';
|
|
6
|
+
export * from './postgres/columns.js';
|
|
7
|
+
export * from './postgres/dialect.js';
|
package/dist/postgres.js
CHANGED
|
@@ -10,9 +10,9 @@ import {
|
|
|
10
10
|
} from "./core/query/Union.js";
|
|
11
11
|
import { schema } from "./core/Schema.js";
|
|
12
12
|
import { alias, table } from "./core/Table.js";
|
|
13
|
-
export * from "./postgres/
|
|
14
|
-
export * from "./postgres/
|
|
15
|
-
export * from "./postgres/
|
|
13
|
+
export * from "./postgres/builder.js";
|
|
14
|
+
export * from "./postgres/columns.js";
|
|
15
|
+
export * from "./postgres/dialect.js";
|
|
16
16
|
export {
|
|
17
17
|
alias,
|
|
18
18
|
except,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
// src/sqlite/
|
|
1
|
+
// src/sqlite/diff.ts
|
|
2
2
|
import { Rollback } from "../core/Database.js";
|
|
3
3
|
import { getData, getQuery, getTable } from "../core/Internal.js";
|
|
4
4
|
import { sql } from "../core/Sql.js";
|
|
5
5
|
import { table } from "../core/Table.js";
|
|
6
6
|
import { eq } from "../core/expr/Conditions.js";
|
|
7
7
|
import { txGenerator } from "../universal.js";
|
|
8
|
-
import * as column from "./
|
|
9
|
-
import { sqliteDialect } from "./
|
|
8
|
+
import * as column from "./columns.js";
|
|
9
|
+
import { sqliteDialect } from "./dialect.js";
|
|
10
10
|
var TableInfo = table("TableInfo", {
|
|
11
11
|
cid: column.integer().notNull(),
|
|
12
12
|
name: column.text().notNull(),
|
package/dist/sqlite.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { index, uniqueIndex } from './core/Index.js';
|
|
2
2
|
export { except, intersect, union, unionAll } from './core/query/Union.js';
|
|
3
3
|
export { alias, table as sqliteTable } from './core/Table.js';
|
|
4
|
-
export * from './sqlite/
|
|
5
|
-
export * from './sqlite/
|
|
6
|
-
export * from './sqlite/
|
|
7
|
-
export * from './sqlite/
|
|
4
|
+
export * from './sqlite/builder.js';
|
|
5
|
+
export * from './sqlite/columns.js';
|
|
6
|
+
export * from './sqlite/dialect.js';
|
|
7
|
+
export * from './sqlite/functions.js';
|
package/dist/sqlite.js
CHANGED
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
unionAll
|
|
8
8
|
} from "./core/query/Union.js";
|
|
9
9
|
import { alias, table } from "./core/Table.js";
|
|
10
|
-
export * from "./sqlite/
|
|
11
|
-
export * from "./sqlite/
|
|
12
|
-
export * from "./sqlite/
|
|
13
|
-
export * from "./sqlite/
|
|
10
|
+
export * from "./sqlite/builder.js";
|
|
11
|
+
export * from "./sqlite/columns.js";
|
|
12
|
+
export * from "./sqlite/dialect.js";
|
|
13
|
+
export * from "./sqlite/functions.js";
|
|
14
14
|
export {
|
|
15
15
|
alias,
|
|
16
16
|
except,
|
package/dist/universal.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './universal/
|
|
2
|
-
export * from './universal/
|
|
3
|
-
export * from './universal/
|
|
1
|
+
export * from './universal/columns.js';
|
|
2
|
+
export * from './universal/functions.js';
|
|
3
|
+
export * from './universal/transactions.js';
|
package/dist/universal.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// src/universal.ts
|
|
2
|
-
export * from "./universal/
|
|
3
|
-
export * from "./universal/
|
|
4
|
-
export * from "./universal/
|
|
2
|
+
export * from "./universal/columns.js";
|
|
3
|
+
export * from "./universal/functions.js";
|
|
4
|
+
export * from "./universal/transactions.js";
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rado",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "rm -rf dist && tsc -p tsconfig.build.json && bun build.ts",
|
|
8
8
|
"size": "esbuild src/index.ts --bundle --minify --format=esm --outdir=dist",
|
|
9
|
-
"profile": "
|
|
9
|
+
"profile": "PROFILE=true bun build.ts && cd bin && (rimraf CPU*.cpuprofile || true) && node --cpu-prof --cpu-prof-interval=100 test && speedscope CPU*.cpuprofile",
|
|
10
10
|
"prepublishOnly": "rm -rf dist && bun run build",
|
|
11
11
|
"cycles": "madge --warning --circular src/index.ts",
|
|
12
12
|
"test:bun": "bun test",
|
|
@@ -32,15 +32,14 @@
|
|
|
32
32
|
"@electric-sql/pglite": "^0.1.5",
|
|
33
33
|
"@sqlite.org/sqlite-wasm": "^3.42.0-build4",
|
|
34
34
|
"@types/better-sqlite3": "^5.4.1",
|
|
35
|
+
"@types/bun": "^1.1.6",
|
|
35
36
|
"@types/glob": "^8.0.0",
|
|
36
37
|
"@types/pg": "^8.11.5",
|
|
37
38
|
"@types/sql.js": "^1.4.2",
|
|
38
39
|
"better-sqlite3": "^11.0.0",
|
|
39
|
-
"bun-types": "^0.5.0",
|
|
40
|
-
"cross-env": "^7.0.3",
|
|
41
40
|
"esbuild": "^0.18.11",
|
|
42
41
|
"glob": "^8.0.3",
|
|
43
|
-
"madge": "^
|
|
42
|
+
"madge": "^8.0.0",
|
|
44
43
|
"mysql2": "^3.9.7",
|
|
45
44
|
"pg": "^8.11.5",
|
|
46
45
|
"rimraf": "^4.1.2",
|
package/dist/interop.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { TableApi, TableInsert, TableRow } from './core/Table.js';
|
|
2
|
-
export type InferSelectModel<Table> = Table extends TableApi<infer Definition> ? TableRow<Definition> : never;
|
|
3
|
-
export type InferInsertModel<Table> = Table extends TableApi<infer Definition> ? TableInsert<Definition> : never;
|
package/dist/interop.js
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|