rado 0.2.5 → 0.2.7

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 CHANGED
@@ -3,9 +3,7 @@
3
3
  Fully typed, lightweight TypeScript query builder.
4
4
  Currently focused on SQLite.
5
5
 
6
- ```
7
- npm install rado
8
- ```
6
+ <pre>npm install <a href="https://www.npmjs.com/package/rado">rado</a></pre>
9
7
 
10
8
  - Definition via TypeScript types
11
9
  - Composable queries
@@ -70,8 +68,8 @@ User().select({
70
68
  })
71
69
  ```
72
70
 
73
- You can call the `posts` helper method defined in the example schema to achieve
74
- the same:
71
+ You can call the `posts` helper method defined in the example schema below
72
+ to achieve the same:
75
73
 
76
74
  ```ts
77
75
  User().select({
@@ -109,9 +107,12 @@ User({id: 1}).innerJoin(Post({userId: User.id})).select({
109
107
  Create expressions to select complex values:
110
108
 
111
109
  ```ts
110
+ import {iif} from 'rado/sqlite'
112
111
  Person().select({
113
112
  name: Person.firstName.concat(' ').concat(Person.lastName),
114
- isMario: Person.firstName.is('Mario')
113
+ isMario: Person.firstName.is('Mario'),
114
+ isActor: Person.id.isIn(Actor().select(Actor.personId)),
115
+ email: iif(Person.email.isNotNull(), Person.email, 'its.me@mario')
115
116
  })
116
117
  ```
117
118
 
@@ -171,8 +172,8 @@ import {table, column} from 'rado'
171
172
  const User = table({
172
173
  // Pass a definition under a key with the actual name of the table in database
173
174
  user: class {
174
- id = column.integer().primaryKey()
175
- username = column.string()
175
+ id = column.integer.primaryKey()
176
+ username = column.string
176
177
 
177
178
  // Define helper methods directly on the model
178
179
  posts() {
@@ -183,9 +184,9 @@ const User = table({
183
184
 
184
185
  const Post = table({
185
186
  post: class {
186
- id = column.integer().primaryKey()
187
- userId = column.integer().references(() => User.id)
188
- content = column.string()
187
+ id = column.integer.primaryKey()
188
+ userId = column.integer.references(() => User.id)
189
+ content = column.string
189
190
 
190
191
  author() {
191
192
  return User({id: this.userId}).sure()
@@ -199,15 +200,15 @@ const Post = table({
199
200
 
200
201
  const Tag = table({
201
202
  tag: class {
202
- id = column.integer().primaryKey()
203
- name = column.string()
203
+ id = column.integer.primaryKey()
204
+ name = column.string
204
205
  }
205
206
  })
206
207
 
207
208
  const PostTags = table({
208
209
  post_tag: class {
209
- postId = column.integer().references(() => Post.id)
210
- tagId = column.integer().references(() => Tag.id)
210
+ postId = column.integer.references(() => Post.id)
211
+ tagId = column.integer.references(() => Tag.id)
211
212
  }
212
213
  })
213
214
  ```
@@ -257,7 +258,7 @@ for await (const row of db.iterate(allPosts)) {
257
258
  #### Transactions
258
259
 
259
260
  Run transactions within the `transaction` method which will isolate a connection
260
- for you and can optionally return a result:
261
+ and can optionally return a result:
261
262
 
262
263
  ```ts
263
264
  const firstUserId = db.transaction(tx => {
@@ -1,4 +1,6 @@
1
+ import { Callable } from '../util/Callable';
1
2
  import { EV, Expr, ExprData } from './Expr';
3
+ import { Fields } from './Fields';
2
4
  export declare enum ColumnType {
3
5
  String = "String",
4
6
  Integer = "Integer",
@@ -7,7 +9,7 @@ export declare enum ColumnType {
7
9
  Json = "Json"
8
10
  }
9
11
  interface PartialColumnData {
10
- type: ColumnType;
12
+ type?: ColumnType;
11
13
  name?: string;
12
14
  nullable?: boolean;
13
15
  defaultValue?: ExprData | (() => ExprData);
@@ -21,38 +23,81 @@ export interface ColumnData extends PartialColumnData {
21
23
  type: ColumnType;
22
24
  name: string;
23
25
  }
24
- export declare class Column<T> extends Expr<T> {
25
- data: PartialColumnData;
26
- constructor(data: PartialColumnData);
27
- name(name: string): Column<T>;
28
- nullable(): Column<T | null>;
29
- autoIncrement(): OptionalColumn<T>;
30
- primaryKey<K = string>(create?: () => EV<T>): PrimaryColumn<T, K>;
31
- references<X extends T>(column: Expr<X> | (() => Expr<X>)): Column<X>;
32
- unique(): this;
33
- defaultValue(create: () => EV<T>): OptionalColumn<T>;
34
- defaultValue(value: EV<T>): OptionalColumn<T>;
26
+ export interface Column<T> {
27
+ [Column.type]: T;
28
+ [Column.data]: PartialColumnData;
35
29
  }
36
30
  export declare namespace Column {
31
+ const data: unique symbol;
32
+ const type: unique symbol;
37
33
  const isOptional: unique symbol;
34
+ const isNullable: unique symbol;
38
35
  const isPrimary: unique symbol;
39
36
  }
40
- export declare class OptionalColumn<T> extends Column<T> {
37
+ interface ValueColumn<T> extends Expr<T> {
38
+ <X = T>(): ValueColumn<T extends X ? T : Array<any> | null extends T ? Array<X> | null : T extends Array<any> ? Array<X> : T extends null ? X | null : X>;
39
+ }
40
+ declare class ValueColumn<T> extends Callable implements Column<T> {
41
+ [Column.type]: T;
42
+ [Column.data]: PartialColumnData;
43
+ constructor(data: PartialColumnData);
44
+ get nullable(): ValueColumn<T | null>;
45
+ get unique(): ValueColumn<T>;
46
+ get autoIncrement(): OptionalColumn<T>;
47
+ primaryKey<K = string>(create?: () => EV<T>): PrimaryColumn<T, K>;
48
+ references<X extends T>(column: Expr<X> | (() => Expr<X>)): ValueColumn<X>;
49
+ defaultValue(value: DefaultValue<T>): OptionalColumn<T>;
50
+ }
51
+ export declare class OptionalColumn<T> extends ValueColumn<T> {
41
52
  [Column.isOptional]: true;
42
53
  }
43
- export declare class PrimaryColumn<T, K> extends Column<PrimaryKey<T, K>> {
54
+ export declare class PrimaryColumn<T, K> extends ValueColumn<PrimaryKey<T, K>> {
44
55
  [Column.isPrimary]: K;
45
56
  }
57
+ interface ObjectColumn<T> {
58
+ <X = T>(): Column<T extends X ? T : T extends null ? X | null : X> & Fields<X>;
59
+ }
60
+ declare class ObjectColumn<T> extends Callable implements Column<T> {
61
+ [Column.type]: T;
62
+ [Column.data]: PartialColumnData;
63
+ constructor(data: PartialColumnData);
64
+ get nullable(): ObjectColumn<T | null>;
65
+ get unique(): ObjectColumn<T>;
66
+ defaultValue<X extends T = T>(value: DefaultValue<X>): Column<X> & Fields<X>;
67
+ }
68
+ export declare class OptionalObjectColumn<T> extends ObjectColumn<T> {
69
+ [Column.isOptional]: true;
70
+ }
46
71
  export type PrimaryKey<T, K> = string extends K ? T : T & {
47
72
  [Column.isPrimary]: K;
48
73
  };
49
- export declare const column: {
50
- string<T extends string = string>(): Column<T>;
51
- integer<T_1 extends number = number>(): Column<T_1>;
52
- number<T_2 extends number = number>(): Column<T_2>;
53
- boolean<T_3 extends boolean = boolean>(): Column<T_3>;
54
- json<T_4 = any>(): Column<T_4>;
55
- object<T_5 extends object = object>(): Column<T_5> & Expr<T_5> & { [K in keyof T_5]: Expr<T_5[K]>; };
56
- array<T_6 = any>(): Column<T_6[]>;
57
- };
74
+ type DefaultValue<T> = EV<T> | (() => EV<T>);
75
+ interface UnTyped {
76
+ (name: string): UnTyped;
77
+ }
78
+ declare class UnTyped extends Callable {
79
+ [Column.data]: PartialColumnData;
80
+ constructor(data?: PartialColumnData);
81
+ get nullable(): NullableUnTyped;
82
+ get unique(): UnTyped;
83
+ get string(): ValueColumn<string>;
84
+ get integer(): ValueColumn<number>;
85
+ get number(): ValueColumn<number>;
86
+ get boolean(): ValueColumn<boolean>;
87
+ get json(): ValueColumn<any>;
88
+ get object(): ObjectColumn<{}>;
89
+ get array(): ValueColumn<any[]>;
90
+ }
91
+ declare class NullableUnTyped {
92
+ [Column.data]: PartialColumnData;
93
+ get unique(): UnTyped;
94
+ get string(): ValueColumn<string | null>;
95
+ get integer(): ValueColumn<number | null>;
96
+ get number(): ValueColumn<number | null>;
97
+ get boolean(): ValueColumn<boolean | null>;
98
+ get json(): ValueColumn<any | null>;
99
+ get object(): ObjectColumn<{} | null>;
100
+ get array(): ValueColumn<Array<any> | null>;
101
+ }
102
+ export declare const column: UnTyped;
58
103
  export {};
@@ -1,4 +1,5 @@
1
1
  // src/define/Column.ts
2
+ import { Callable } from "../util/Callable.js";
2
3
  import { Expr, ExprData } from "./Expr.js";
3
4
  var ColumnType = /* @__PURE__ */ ((ColumnType2) => {
4
5
  ColumnType2["String"] = "String";
@@ -8,80 +9,149 @@ var ColumnType = /* @__PURE__ */ ((ColumnType2) => {
8
9
  ColumnType2["Json"] = "Json";
9
10
  return ColumnType2;
10
11
  })(ColumnType || {});
11
- var Column = class extends Expr {
12
+ var Column;
13
+ ((Column2) => {
14
+ Column2.data = Symbol("columnData");
15
+ Column2.type = Symbol("columnType");
16
+ })(Column || (Column = {}));
17
+ var ValueColumn = class extends Callable {
18
+ [Column.type];
19
+ [Column.data];
12
20
  constructor(data) {
13
- super(void 0);
14
- this.data = data;
21
+ super((defaultValue) => {
22
+ return new ValueColumn({
23
+ ...this[Column.data],
24
+ defaultValue: createDefaultValue(defaultValue)
25
+ });
26
+ });
27
+ this[Column.data] = data;
15
28
  }
16
- name(name) {
17
- return new Column({ ...this.data, name });
29
+ get nullable() {
30
+ return new ValueColumn({ ...this[Column.data], nullable: true });
18
31
  }
19
- nullable() {
20
- return new Column({ ...this.data, nullable: true });
32
+ get unique() {
33
+ return new ValueColumn({ ...this[Column.data], unique: true });
21
34
  }
22
- autoIncrement() {
23
- return new OptionalColumn({ ...this.data, autoIncrement: true });
35
+ get autoIncrement() {
36
+ return new OptionalColumn({ ...this[Column.data], autoIncrement: true });
24
37
  }
25
38
  primaryKey(create) {
26
39
  return new PrimaryColumn({
27
- ...this.data,
40
+ ...this[Column.data],
28
41
  primaryKey: true,
29
- defaultValue: create ? () => ExprData.create(create()) : this.data.defaultValue
42
+ defaultValue: create ? () => ExprData.create(create()) : this[Column.data].defaultValue
30
43
  });
31
44
  }
32
45
  references(column2) {
33
- return new Column({
34
- ...this.data,
46
+ return new ValueColumn({
47
+ ...this[Column.data],
35
48
  references() {
36
- return ExprData.create(typeof column2 === "function" ? column2() : column2);
49
+ return ExprData.create(column2 instanceof Expr ? column2 : column2());
37
50
  }
38
51
  });
39
52
  }
40
- unique() {
41
- return new Column({ ...this.data, unique: true });
42
- }
43
53
  defaultValue(value) {
44
54
  return new OptionalColumn({
45
- ...this.data,
46
- defaultValue: typeof value === "function" ? () => ExprData.create(value()) : ExprData.create(value)
55
+ ...this[Column.data],
56
+ defaultValue: createDefaultValue(value)
47
57
  });
48
58
  }
49
59
  };
50
- ((Column2) => {
51
- })(Column || (Column = {}));
52
- var OptionalColumn = class extends Column {
60
+ function createDefaultValue(value) {
61
+ return typeof value === "function" && !(value instanceof Expr) ? () => ExprData.create(value()) : ExprData.create(value);
62
+ }
63
+ var OptionalColumn = class extends ValueColumn {
53
64
  [Column.isOptional];
54
65
  };
55
- var PrimaryColumn = class extends Column {
66
+ var PrimaryColumn = class extends ValueColumn {
56
67
  [Column.isPrimary];
57
68
  };
58
- var column = {
59
- string() {
60
- return new Column({ type: "String" /* String */ });
61
- },
62
- integer() {
63
- return new Column({ type: "Integer" /* Integer */ });
64
- },
65
- number() {
66
- return new Column({ type: "Number" /* Number */ });
67
- },
68
- boolean() {
69
- return new Column({ type: "Boolean" /* Boolean */ });
70
- },
71
- json() {
72
- return new Column({ type: "Json" /* Json */ });
73
- },
74
- object() {
75
- return new Column({ type: "Json" /* Json */ });
76
- },
77
- array() {
78
- return new Column({ type: "Json" /* Json */ });
69
+ var ObjectColumn = class extends Callable {
70
+ [Column.type];
71
+ [Column.data];
72
+ constructor(data) {
73
+ super(() => this);
74
+ this[Column.data] = data;
75
+ }
76
+ get nullable() {
77
+ return new ObjectColumn({ ...this[Column.data], nullable: true });
78
+ }
79
+ get unique() {
80
+ return new ObjectColumn({ ...this[Column.data], unique: true });
81
+ }
82
+ defaultValue(value) {
83
+ return new OptionalObjectColumn({
84
+ ...this[Column.data],
85
+ defaultValue: createDefaultValue(value)
86
+ });
87
+ }
88
+ };
89
+ var OptionalObjectColumn = class extends ObjectColumn {
90
+ [Column.isOptional];
91
+ };
92
+ var UnTyped = class extends Callable {
93
+ [Column.data];
94
+ constructor(data = {}) {
95
+ super((name) => {
96
+ return new ValueColumn({ ...data, name });
97
+ });
98
+ this[Column.data] = data;
99
+ }
100
+ get nullable() {
101
+ return new UnTyped({ ...this[Column.data], nullable: true });
102
+ }
103
+ get unique() {
104
+ return new UnTyped({ ...this[Column.data], unique: true });
105
+ }
106
+ get string() {
107
+ return new ValueColumn({
108
+ ...this[Column.data],
109
+ type: "String" /* String */
110
+ });
111
+ }
112
+ get integer() {
113
+ return new ValueColumn({
114
+ ...this[Column.data],
115
+ type: "Integer" /* Integer */
116
+ });
117
+ }
118
+ get number() {
119
+ return new ValueColumn({
120
+ ...this[Column.data],
121
+ type: "Number" /* Number */
122
+ });
123
+ }
124
+ get boolean() {
125
+ return new ValueColumn({
126
+ ...this[Column.data],
127
+ type: "Boolean" /* Boolean */
128
+ });
129
+ }
130
+ get json() {
131
+ return new ValueColumn({
132
+ ...this[Column.data],
133
+ type: "Json" /* Json */
134
+ });
135
+ }
136
+ get object() {
137
+ return new ObjectColumn({
138
+ ...this[Column.data],
139
+ type: "Json" /* Json */
140
+ });
141
+ }
142
+ get array() {
143
+ return new ValueColumn({
144
+ ...this[Column.data],
145
+ type: "Json" /* Json */
146
+ });
79
147
  }
80
148
  };
149
+ var column = new UnTyped();
81
150
  export {
82
151
  Column,
83
152
  ColumnType,
84
153
  OptionalColumn,
154
+ OptionalObjectColumn,
85
155
  PrimaryColumn,
86
156
  column
87
157
  };
@@ -126,7 +126,10 @@ export declare const ExprData: {
126
126
  };
127
127
  /** Expression or value of type T */
128
128
  export type EV<T> = Expr<T> | T;
129
- export declare class Expr<T> {
129
+ declare class Empty {
130
+ }
131
+ declare const callable: typeof Empty;
132
+ export declare class Expr<T> extends callable {
130
133
  expr: ExprData;
131
134
  static NULL: Expr<null>;
132
135
  static toExpr: symbol;
@@ -172,3 +175,4 @@ export declare namespace Expr {
172
175
  [K in keyof T]: Expr<T[K]>;
173
176
  };
174
177
  }
178
+ export {};
@@ -9,6 +9,7 @@ var __publicField = (obj, key, value) => {
9
9
  import { OrderDirection } from "./OrderBy.js";
10
10
  import { ParamData, ParamType } from "./Param.js";
11
11
  import { Target } from "./Target.js";
12
+ var { fromEntries, entries, getPrototypeOf } = Object;
12
13
  var UnOpType = /* @__PURE__ */ ((UnOpType2) => {
13
14
  UnOpType2["Not"] = "Not";
14
15
  UnOpType2["IsNull"] = "IsNull";
@@ -91,17 +92,14 @@ var ExprData = {
91
92
  create(input) {
92
93
  if (input === null || input === void 0)
93
94
  return ExprData.Param(ParamData.Value(null));
94
- if (input && typeof input[Expr.toExpr] === "function")
95
+ if (input && (typeof input === "function" || typeof input === "object") && input[Expr.toExpr])
95
96
  input = input[Expr.toExpr]();
96
97
  if (input instanceof Expr)
97
98
  return input.expr;
98
99
  if (input && typeof input === "object" && !Array.isArray(input))
99
100
  return ExprData.Record(
100
- Object.fromEntries(
101
- Object.entries(input).map(([key, value]) => [
102
- key,
103
- ExprData.create(value)
104
- ])
101
+ fromEntries(
102
+ entries(input).map(([key, value]) => [key, ExprData.create(value)])
105
103
  )
106
104
  );
107
105
  return ExprData.Param(ParamData.Value(input));
@@ -121,14 +119,33 @@ function isConstant(e, value) {
121
119
  return false;
122
120
  }
123
121
  }
124
- var _Expr = class {
122
+ function dotAccess(expr, path) {
123
+ return new Expr(ExprData.Field(expr.expr, path.join(".")));
124
+ }
125
+ function exprAccess(expr, ...path) {
126
+ return new Proxy(expr, {
127
+ apply(target, thisArg, args) {
128
+ const proto = getPrototypeOf(expr);
129
+ const method = path.pop();
130
+ const e = path.length > 0 ? dotAccess(expr, path) : expr;
131
+ return proto[method].apply(e, args);
132
+ },
133
+ get(_, key) {
134
+ const e = path.length > 0 ? dotAccess(expr, path) : expr;
135
+ if (key === "expr")
136
+ return e.expr;
137
+ if (typeof key !== "string")
138
+ return e[key];
139
+ return exprAccess(expr, ...path, key);
140
+ }
141
+ });
142
+ }
143
+ var callable = Function;
144
+ var _Expr = class extends callable {
125
145
  constructor(expr) {
146
+ super();
126
147
  this.expr = expr;
127
- return new Proxy(this, {
128
- get(target, key) {
129
- return key in target ? target[key] : target.get(key);
130
- }
131
- });
148
+ return exprAccess(this);
132
149
  }
133
150
  static value(value) {
134
151
  return new _Expr(ExprData.Param(ParamData.Value(value)));
@@ -1,10 +1,9 @@
1
- import { OptionalColumn, PrimaryColumn, PrimaryKey } from './Column';
2
1
  import { Expr } from './Expr';
3
2
  type ObjectUnion<T> = {
4
3
  [K in T extends infer P ? keyof P : never]: T extends infer P ? K extends keyof P ? P[K] : never : never;
5
4
  };
6
5
  type RecordField<T> = Expr<T> & FieldsOf<ObjectUnion<T>>;
7
- type Field<T> = [T] extends [Array<any>] ? Expr<T> : [T] extends [PrimaryColumn<infer V, infer K>] ? Expr<PrimaryKey<V, K>> : [T] extends [OptionalColumn<infer V>] ? Field<V> : [T] extends [number | string | boolean] ? Expr<T> : [T] extends [Record<string, any> | null] ? RecordField<T> : Expr<T>;
6
+ type Field<T> = [T] extends [Array<any>] ? Expr<T> : [T] extends [number | string | boolean] ? Expr<T> : [T] extends [Record<string, any> | null] ? RecordField<T> : Expr<T>;
8
7
  type FieldsOf<Row> = Row extends Record<string, any> ? {
9
8
  [K in keyof Row]-?: Field<Row[K]>;
10
9
  } : never;
@@ -14,16 +14,15 @@ export interface TableData {
14
14
  indexes: Record<string, IndexData>;
15
15
  };
16
16
  }
17
- interface TableProto<Definition> {
17
+ export interface TableInstance<Definition> {
18
18
  (conditions: {
19
19
  [K in keyof Definition]?: Definition[K] extends Column<infer V> ? EV<V> : never;
20
20
  }): Cursor.TableSelect<Definition>;
21
21
  (...conditions: Array<EV<boolean>>): Cursor.TableSelect<Definition>;
22
22
  }
23
- declare class TableProto<Definition> {
23
+ export declare class TableInstance<Definition> {
24
24
  [Selection.__tableType](): Table.Select<Definition>;
25
25
  get [table.data](): TableData;
26
- [table.meta](): TableMeta;
27
26
  get name(): unknown;
28
27
  get length(): unknown;
29
28
  get call(): unknown;
@@ -31,7 +30,7 @@ declare class TableProto<Definition> {
31
30
  get bind(): unknown;
32
31
  get prototype(): unknown;
33
32
  }
34
- export type Table<Definition> = Definition & TableProto<Definition>;
33
+ export type Table<Definition> = Definition & TableInstance<Definition>;
35
34
  export declare namespace Table {
36
35
  export type Of<Row> = Table<{
37
36
  [K in keyof Row as K extends string ? K : never]: Column<Row[K]>;
@@ -2,7 +2,6 @@
2
2
  import { Column } from "./Column.js";
3
3
  import { Cursor } from "./Cursor.js";
4
4
  import { BinOpType, Expr, ExprData } from "./Expr.js";
5
- import { Selection } from "./Selection.js";
6
5
  import { Target } from "./Target.js";
7
6
  var {
8
7
  keys,
@@ -15,39 +14,6 @@ var {
15
14
  getOwnPropertyDescriptor
16
15
  } = Object;
17
16
  var { ownKeys } = Reflect;
18
- var TableProto = class {
19
- [Selection.__tableType]() {
20
- throw "assert";
21
- }
22
- get [table.data]() {
23
- throw "assert";
24
- }
25
- [table.meta]() {
26
- throw "assert";
27
- }
28
- // Clear the Function prototype, not sure if there's a better way
29
- // as mapped types (Omit) will remove the callable signature. We define them
30
- // in a class getter since it's the only way to also mark them as non-enumarable
31
- // Seems open: Microsoft/TypeScript#27575
32
- get name() {
33
- throw "assert";
34
- }
35
- get length() {
36
- throw "assert";
37
- }
38
- get call() {
39
- throw "assert";
40
- }
41
- get apply() {
42
- throw "assert";
43
- }
44
- get bind() {
45
- throw "assert";
46
- }
47
- get prototype() {
48
- throw "assert";
49
- }
50
- };
51
17
  function keysOf(input) {
52
18
  const methods = [];
53
19
  while (input = getPrototypeOf(input)) {
@@ -90,7 +56,7 @@ function createTable(data) {
90
56
  const ownKeys2 = ["prototype", ...cols];
91
57
  let res;
92
58
  if (!hasKeywords) {
93
- res = assign(call, expressions, { [table.data]: data });
59
+ res = assign(call, expressions, { [table.data]: data, [Expr.toExpr]: toExpr });
94
60
  setPrototypeOf(call, getPrototypeOf(data.definition));
95
61
  } else {
96
62
  let get2 = function(key) {
@@ -135,13 +101,14 @@ function table(define) {
135
101
  columns: fromEntries(
136
102
  entries(getOwnPropertyDescriptors(columns)).map(([name2, descriptor]) => {
137
103
  const column = columns[name2];
138
- if (!(column instanceof Column))
139
- throw new Error(`Property ${name2} is not a column`);
140
- const { data } = column;
104
+ const data = column[Column.data];
105
+ if (!data.type)
106
+ throw new Error(`Column ${name2} has no type`);
141
107
  return [
142
108
  name2,
143
109
  {
144
110
  ...data,
111
+ type: data.type,
145
112
  name: data.name || name2,
146
113
  enumerable: descriptor.enumerable
147
114
  }
@@ -3,11 +3,9 @@ import { Expr } from '../define/Expr';
3
3
  import { Query } from '../define/Query';
4
4
  import { SchemaInstructions } from '../define/Schema';
5
5
  import { Table } from '../define/Table';
6
+ import { Callable } from '../util/Callable';
6
7
  import { Formatter } from './Formatter';
7
8
  import { Statement } from './Statement';
8
- declare class Callable extends Function {
9
- constructor(fn: Function);
10
- }
11
9
  declare abstract class DriverBase extends Callable {
12
10
  formatter: Formatter;
13
11
  constructor(formatter: Formatter);
@@ -5,16 +5,7 @@ import { ParamData } from "../define/Param.js";
5
5
  import { Query, QueryType } from "../define/Query.js";
6
6
  import { Schema } from "../define/Schema.js";
7
7
  import { table } from "../define/Table.js";
8
- var Callable = class extends Function {
9
- constructor(fn) {
10
- super();
11
- return new Proxy(this, {
12
- apply(_, thisArg, input) {
13
- return fn.apply(thisArg, input);
14
- }
15
- });
16
- }
17
- };
8
+ import { Callable } from "../util/Callable.js";
18
9
  function isTemplateStringsArray(input) {
19
10
  return Boolean(Array.isArray(input) && input.raw);
20
11
  }
File without changes
@@ -1,4 +1,4 @@
1
- // src/lib/Callable.ts
1
+ // src/util/Callable.ts
2
2
  var Callable = class extends Function {
3
3
  constructor(fn) {
4
4
  super();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rado",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",