rado 0.2.21 → 0.2.22

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.
@@ -1,8 +1,8 @@
1
1
  // src/define/Column.ts
2
2
  import { Callable } from "../util/Callable.js";
3
3
  import { Expr, ExprData } from "./Expr.js";
4
- var DATA = Symbol("DATA");
5
- var TYPE = Symbol("tYPE");
4
+ var DATA = Symbol("Column.Data");
5
+ var TYPE = Symbol("Column.Type");
6
6
  var ColumnType = /* @__PURE__ */ ((ColumnType2) => {
7
7
  ColumnType2["String"] = "String";
8
8
  ColumnType2["Integer"] = "Integer";
@@ -17,7 +17,7 @@ var Column;
17
17
  Column2.Type = TYPE;
18
18
  })(Column || (Column = {}));
19
19
  var ValueColumn = class extends Callable {
20
- [(TYPE, DATA)];
20
+ [DATA];
21
21
  constructor(data) {
22
22
  super(() => this);
23
23
  this[DATA] = data;
@@ -63,7 +63,7 @@ var PrimaryColumn = class extends ValueColumn {
63
63
  [Column.IsPrimary];
64
64
  };
65
65
  var ObjectColumn = class extends Callable {
66
- [(TYPE, DATA)];
66
+ [DATA];
67
67
  constructor(data) {
68
68
  super(() => this);
69
69
  this[DATA] = data;
@@ -1,13 +1,12 @@
1
- import { Cursor } from './Cursor';
2
1
  import { Fields } from './Fields';
3
2
  import { OrderBy } from './OrderBy';
4
3
  import { ParamData } from './Param';
5
- import { Query } from './Query';
4
+ import { Query, QueryData } from './Query';
6
5
  import { Selection } from './Selection';
7
6
  import { Target } from './Target';
7
+ declare const DATA: unique symbol;
8
8
  declare const TO_EXPR: unique symbol;
9
9
  declare const IS_EXPR: unique symbol;
10
- declare const DATA: unique symbol;
11
10
  export declare enum UnOpType {
12
11
  Not = "Not",
13
12
  IsNull = "IsNull"
@@ -34,101 +33,87 @@ export declare enum BinOpType {
34
33
  Concat = "Concat"
35
34
  }
36
35
  export declare enum ExprType {
37
- UnOp = "UnOp",
38
- BinOp = "BinOp",
39
- Field = "Field",
40
- Param = "Param",
41
- Call = "Call",
42
- Query = "Query",
43
- Record = "Record",
44
- Row = "Row",
45
- Map = "Map",
46
- Filter = "Filter",
47
- Merge = "Merge",
48
- Case = "Case"
36
+ UnOp = "ExprData.UnOp",
37
+ BinOp = "ExprData.BinOp",
38
+ Field = "ExprData.Field",
39
+ Param = "ExprData.Param",
40
+ Call = "ExprData.Call",
41
+ Query = "ExprData.Query",
42
+ Record = "ExprData.Record",
43
+ Row = "ExprData.Row",
44
+ Map = "ExprData.Map",
45
+ Filter = "ExprData.Filter",
46
+ Merge = "ExprData.Merge"
49
47
  }
50
- export type ExprData = ExprData.UnOp | ExprData.BinOp | ExprData.Field | ExprData.Param | ExprData.Call | ExprData.Query | ExprData.Record | ExprData.Merge | ExprData.Row | ExprData.Map | ExprData.Filter | ExprData.Case;
48
+ export type ExprData = ExprData.UnOp | ExprData.BinOp | ExprData.Field | ExprData.Param | ExprData.Call | ExprData.Query | ExprData.Record | ExprData.Merge | ExprData.Row | ExprData.Map | ExprData.Filter;
51
49
  export declare namespace ExprData {
52
- type UnOp = {
53
- type: ExprType.UnOp;
50
+ class UnOp {
54
51
  op: UnOpType;
55
52
  expr: ExprData;
56
- };
57
- type BinOp = {
58
- type: ExprType.BinOp;
53
+ type: ExprType.UnOp;
54
+ constructor(op: UnOpType, expr: ExprData);
55
+ }
56
+ class BinOp {
59
57
  op: BinOpType;
60
58
  a: ExprData;
61
59
  b: ExprData;
62
- };
63
- type Field = {
64
- type: ExprType.Field;
60
+ type: ExprType.BinOp;
61
+ constructor(op: BinOpType, a: ExprData, b: ExprData);
62
+ }
63
+ class Field {
65
64
  expr: ExprData;
66
65
  field: string;
67
- };
68
- type Param = {
69
- type: ExprType.Param;
66
+ type: ExprType.Field;
67
+ constructor(expr: ExprData, field: string);
68
+ }
69
+ class Param {
70
70
  param: ParamData;
71
- };
72
- type Call = {
73
- type: ExprType.Call;
71
+ type: ExprType.Param;
72
+ constructor(param: ParamData);
73
+ }
74
+ class Call {
74
75
  method: string;
75
76
  params: Array<ExprData>;
76
- };
77
- type Query = {
77
+ type: ExprType.Call;
78
+ constructor(method: string, params: Array<ExprData>);
79
+ }
80
+ class Query {
81
+ query: QueryData.Select;
78
82
  type: ExprType.Query;
79
- query: Query.Select;
80
- };
81
- type Record = {
82
- type: ExprType.Record;
83
+ constructor(query: QueryData.Select);
84
+ }
85
+ class Record {
83
86
  fields: {
84
87
  [key: string]: ExprData;
85
88
  };
86
- };
87
- type Merge = {
88
- type: ExprType.Merge;
89
+ type: ExprType.Record;
90
+ constructor(fields: {
91
+ [key: string]: ExprData;
92
+ });
93
+ }
94
+ class Merge {
89
95
  a: ExprData;
90
96
  b: ExprData;
91
- };
92
- type Row = {
93
- type: ExprType.Row;
97
+ type: ExprType.Merge;
98
+ constructor(a: ExprData, b: ExprData);
99
+ }
100
+ class Row {
94
101
  target: Target;
95
- };
96
- type Map = {
97
- type: ExprType.Map;
102
+ type: ExprType.Row;
103
+ constructor(target: Target);
104
+ }
105
+ class Map {
98
106
  target: Target;
99
107
  result: ExprData;
100
- };
101
- type Filter = {
102
- type: ExprType.Filter;
108
+ type: ExprType.Map;
109
+ constructor(target: Target, result: ExprData);
110
+ }
111
+ class Filter {
103
112
  target: Target;
104
113
  condition: ExprData;
105
- };
106
- type Case = {
107
- type: ExprType.Case;
108
- expr: ExprData;
109
- cases: {
110
- [key: string]: ExprData;
111
- };
112
- defaultCase?: ExprData;
113
- };
114
- }
115
- export declare namespace ExprData {
116
- function UnOp(op: UnOpType, expr: ExprData): ExprData;
117
- function BinOp(op: BinOpType, a: ExprData, b: ExprData): ExprData;
118
- function Field(expr: ExprData, field: string): ExprData;
119
- function Param(param: ParamData): ExprData;
120
- function Call(method: string, params: Array<ExprData>): ExprData;
121
- function Query(query: Query.Select): ExprData;
122
- function Record(fields: {
123
- [key: string]: ExprData;
124
- }): ExprData;
125
- function Merge(a: ExprData, b: ExprData): ExprData;
126
- function Row(target: Target): ExprData;
127
- function Map(target: Target, result: ExprData): ExprData;
128
- function Filter(target: Target, condition: ExprData): ExprData;
129
- function Case(expr: ExprData, cases: {
130
- [key: string]: ExprData;
131
- }, defaultCase?: ExprData): ExprData;
114
+ type: ExprType.Filter;
115
+ constructor(target: Target, condition: ExprData);
116
+ }
132
117
  function create(input: any): ExprData;
133
118
  }
134
119
  /** Expression or value of type T */
@@ -142,13 +127,13 @@ export declare class Expr<T> {
142
127
  not(): Expr<boolean>;
143
128
  or(this: Expr<boolean>, that: EV<boolean>): Expr<boolean>;
144
129
  and(this: Expr<boolean>, that: EV<boolean>): Expr<boolean>;
145
- is(that: EV<T> | Cursor.SelectSingle<T>): Expr<boolean>;
130
+ is(that: EV<T> | Query.SelectSingle<T>): Expr<boolean>;
146
131
  isConstant(value: T): boolean;
147
132
  isNot(that: EV<T>): Expr<boolean>;
148
133
  isNull(): Expr<boolean>;
149
134
  isNotNull(): Expr<boolean>;
150
- isIn(that: EV<Array<T>> | Cursor.SelectMultiple<T>): Expr<boolean>;
151
- isNotIn(that: EV<Array<T>> | Cursor.SelectMultiple<T>): Expr<boolean>;
135
+ isIn(that: EV<Array<T>> | Query.SelectMultiple<T>): Expr<boolean>;
136
+ isNotIn(that: EV<Array<T>> | Query.SelectMultiple<T>): Expr<boolean>;
152
137
  isGreater(that: EV<any>): Expr<boolean>;
153
138
  isGreaterOrEqual(that: EV<any>): Expr<boolean>;
154
139
  isLess(that: EV<any>): Expr<boolean>;
@@ -178,10 +163,10 @@ export declare class Expr<T> {
178
163
  get<T>(name: string): Expr<T>;
179
164
  }
180
165
  export declare namespace Expr {
181
- const NULL: Expr<null>;
182
166
  const Data: typeof DATA;
183
167
  const IsExpr: typeof IS_EXPR;
184
168
  const ToExpr: typeof TO_EXPR;
169
+ const NULL: Expr<null>;
185
170
  function value<T>(value: T): Expr<T>;
186
171
  function create<T>(input: EV<T>): Expr<T>;
187
172
  function and(...conditions: Array<EV<boolean>>): Expr<boolean>;
@@ -3,9 +3,9 @@ import { OrderDirection } from "./OrderBy.js";
3
3
  import { ParamData, ParamType } from "./Param.js";
4
4
  import { Target } from "./Target.js";
5
5
  var { fromEntries, entries } = Object;
6
+ var DATA = Symbol("Expr.Data");
6
7
  var TO_EXPR = Symbol("Expr.ToExpr");
7
8
  var IS_EXPR = Symbol("Expr.IsExpr");
8
- var DATA = Symbol("Expr.Data");
9
9
  var UnOpType = /* @__PURE__ */ ((UnOpType2) => {
10
10
  UnOpType2["Not"] = "Not";
11
11
  UnOpType2["IsNull"] = "IsNull";
@@ -34,84 +34,120 @@ var BinOpType = /* @__PURE__ */ ((BinOpType2) => {
34
34
  return BinOpType2;
35
35
  })(BinOpType || {});
36
36
  var ExprType = /* @__PURE__ */ ((ExprType2) => {
37
- ExprType2["UnOp"] = "UnOp";
38
- ExprType2["BinOp"] = "BinOp";
39
- ExprType2["Field"] = "Field";
40
- ExprType2["Param"] = "Param";
41
- ExprType2["Call"] = "Call";
42
- ExprType2["Query"] = "Query";
43
- ExprType2["Record"] = "Record";
44
- ExprType2["Row"] = "Row";
45
- ExprType2["Map"] = "Map";
46
- ExprType2["Filter"] = "Filter";
47
- ExprType2["Merge"] = "Merge";
48
- ExprType2["Case"] = "Case";
37
+ ExprType2["UnOp"] = "ExprData.UnOp";
38
+ ExprType2["BinOp"] = "ExprData.BinOp";
39
+ ExprType2["Field"] = "ExprData.Field";
40
+ ExprType2["Param"] = "ExprData.Param";
41
+ ExprType2["Call"] = "ExprData.Call";
42
+ ExprType2["Query"] = "ExprData.Query";
43
+ ExprType2["Record"] = "ExprData.Record";
44
+ ExprType2["Row"] = "ExprData.Row";
45
+ ExprType2["Map"] = "ExprData.Map";
46
+ ExprType2["Filter"] = "ExprData.Filter";
47
+ ExprType2["Merge"] = "ExprData.Merge";
49
48
  return ExprType2;
50
49
  })(ExprType || {});
51
50
  var ExprData;
52
51
  ((ExprData2) => {
53
- function UnOp(op, expr) {
54
- return { type: "UnOp" /* UnOp */, op, expr };
52
+ class UnOp {
53
+ constructor(op, expr) {
54
+ this.op = op;
55
+ this.expr = expr;
56
+ }
57
+ type = "ExprData.UnOp" /* UnOp */;
55
58
  }
56
59
  ExprData2.UnOp = UnOp;
57
- function BinOp(op, a, b) {
58
- return { type: "BinOp" /* BinOp */, op, a, b };
60
+ class BinOp {
61
+ constructor(op, a, b) {
62
+ this.op = op;
63
+ this.a = a;
64
+ this.b = b;
65
+ }
66
+ type = "ExprData.BinOp" /* BinOp */;
59
67
  }
60
68
  ExprData2.BinOp = BinOp;
61
- function Field(expr, field) {
62
- return { type: "Field" /* Field */, expr, field };
69
+ class Field {
70
+ constructor(expr, field) {
71
+ this.expr = expr;
72
+ this.field = field;
73
+ }
74
+ type = "ExprData.Field" /* Field */;
63
75
  }
64
76
  ExprData2.Field = Field;
65
- function Param(param) {
66
- return { type: "Param" /* Param */, param };
77
+ class Param {
78
+ constructor(param) {
79
+ this.param = param;
80
+ }
81
+ type = "ExprData.Param" /* Param */;
67
82
  }
68
83
  ExprData2.Param = Param;
69
- function Call(method, params) {
70
- return { type: "Call" /* Call */, method, params };
84
+ class Call {
85
+ constructor(method, params) {
86
+ this.method = method;
87
+ this.params = params;
88
+ }
89
+ type = "ExprData.Call" /* Call */;
71
90
  }
72
91
  ExprData2.Call = Call;
73
- function Query(query) {
74
- return { type: "Query" /* Query */, query };
92
+ class Query {
93
+ constructor(query) {
94
+ this.query = query;
95
+ }
96
+ type = "ExprData.Query" /* Query */;
75
97
  }
76
98
  ExprData2.Query = Query;
77
- function Record(fields) {
78
- return { type: "Record" /* Record */, fields };
99
+ class Record {
100
+ constructor(fields) {
101
+ this.fields = fields;
102
+ }
103
+ type = "ExprData.Record" /* Record */;
79
104
  }
80
105
  ExprData2.Record = Record;
81
- function Merge(a, b) {
82
- return { type: "Merge" /* Merge */, a, b };
106
+ class Merge {
107
+ constructor(a, b) {
108
+ this.a = a;
109
+ this.b = b;
110
+ }
111
+ type = "ExprData.Merge" /* Merge */;
83
112
  }
84
113
  ExprData2.Merge = Merge;
85
- function Row(target) {
86
- return { type: "Row" /* Row */, target };
114
+ class Row {
115
+ constructor(target) {
116
+ this.target = target;
117
+ }
118
+ type = "ExprData.Row" /* Row */;
87
119
  }
88
120
  ExprData2.Row = Row;
89
- function Map(target, result) {
90
- return { type: "Map" /* Map */, target, result };
121
+ class Map {
122
+ constructor(target, result) {
123
+ this.target = target;
124
+ this.result = result;
125
+ }
126
+ type = "ExprData.Map" /* Map */;
91
127
  }
92
128
  ExprData2.Map = Map;
93
- function Filter(target, condition) {
94
- return { type: "Filter" /* Filter */, target, condition };
129
+ class Filter {
130
+ constructor(target, condition) {
131
+ this.target = target;
132
+ this.condition = condition;
133
+ }
134
+ type = "ExprData.Filter" /* Filter */;
95
135
  }
96
136
  ExprData2.Filter = Filter;
97
- function Case(expr, cases, defaultCase) {
98
- return { type: "Case" /* Case */, expr, cases, defaultCase };
99
- }
100
- ExprData2.Case = Case;
101
137
  function create(input) {
102
138
  if (input === null || input === void 0)
103
- return ExprData2.Param(ParamData.Value(null));
139
+ return new ExprData2.Param(new ParamData.Value(null));
104
140
  if (input && (typeof input === "function" || typeof input === "object") && input[TO_EXPR])
105
141
  input = input[TO_EXPR]();
106
142
  if (Expr.isExpr(input))
107
143
  return input[DATA];
108
144
  if (input && typeof input === "object" && !Array.isArray(input))
109
- return ExprData2.Record(
145
+ return new ExprData2.Record(
110
146
  fromEntries(
111
147
  entries(input).map(([key, value]) => [key, ExprData2.create(value)])
112
148
  )
113
149
  );
114
- return ExprData2.Param(ParamData.Value(input));
150
+ return new ExprData2.Param(new ParamData.Value(input));
115
151
  }
116
152
  ExprData2.create = create;
117
153
  })(ExprData || (ExprData = {}));
@@ -128,7 +164,7 @@ var Expr = class {
128
164
  return { expr: this[DATA], order: OrderDirection.Desc };
129
165
  }
130
166
  not() {
131
- return new Expr(ExprData.UnOp("Not" /* Not */, this[DATA]));
167
+ return new Expr(new ExprData.UnOp("Not" /* Not */, this[DATA]));
132
168
  }
133
169
  or(that) {
134
170
  const a = this;
@@ -137,7 +173,7 @@ var Expr = class {
137
173
  return b;
138
174
  if (a.isConstant(true) || b.isConstant(false))
139
175
  return this;
140
- return new Expr(ExprData.BinOp("Or" /* Or */, a[DATA], b[DATA]));
176
+ return new Expr(new ExprData.BinOp("Or" /* Or */, a[DATA], b[DATA]));
141
177
  }
142
178
  and(that) {
143
179
  const a = this;
@@ -146,21 +182,22 @@ var Expr = class {
146
182
  return this;
147
183
  if (a.isConstant(true) || b.isConstant(false))
148
184
  return b;
149
- return new Expr(ExprData.BinOp("And" /* And */, a[DATA], b[DATA]));
185
+ return new Expr(new ExprData.BinOp("And" /* And */, a[DATA], b[DATA]));
150
186
  }
151
187
  is(that) {
152
188
  if (that === null || Expr.isExpr(that) && that.isConstant(null))
153
189
  return this.isNull();
154
190
  return new Expr(
155
- ExprData.BinOp("Equals" /* Equals */, this[DATA], ExprData.create(that))
191
+ new ExprData.BinOp("Equals" /* Equals */, this[DATA], ExprData.create(that))
156
192
  );
157
193
  }
158
194
  isConstant(value) {
159
195
  switch (this[DATA].type) {
160
- case "Param" /* Param */:
161
- switch (this[DATA].param.type) {
196
+ case "ExprData.Param" /* Param */:
197
+ const param = this[DATA].param;
198
+ switch (param.type) {
162
199
  case ParamType.Value:
163
- return this[DATA].param.value === value;
200
+ return param.value === value;
164
201
  default:
165
202
  return false;
166
203
  }
@@ -172,33 +209,33 @@ var Expr = class {
172
209
  if (that === null || Expr.isExpr(that) && that.isConstant(null))
173
210
  return this.isNotNull();
174
211
  return new Expr(
175
- ExprData.BinOp("NotEquals" /* NotEquals */, this[DATA], ExprData.create(that))
212
+ new ExprData.BinOp("NotEquals" /* NotEquals */, this[DATA], ExprData.create(that))
176
213
  );
177
214
  }
178
215
  isNull() {
179
- return new Expr(ExprData.UnOp("IsNull" /* IsNull */, this[DATA]));
216
+ return new Expr(new ExprData.UnOp("IsNull" /* IsNull */, this[DATA]));
180
217
  }
181
218
  isNotNull() {
182
219
  return this.isNull().not();
183
220
  }
184
221
  isIn(that) {
185
222
  return new Expr(
186
- ExprData.BinOp("In" /* In */, this[DATA], ExprData.create(that))
223
+ new ExprData.BinOp("In" /* In */, this[DATA], ExprData.create(that))
187
224
  );
188
225
  }
189
226
  isNotIn(that) {
190
227
  return new Expr(
191
- ExprData.BinOp("NotIn" /* NotIn */, this[DATA], ExprData.create(that))
228
+ new ExprData.BinOp("NotIn" /* NotIn */, this[DATA], ExprData.create(that))
192
229
  );
193
230
  }
194
231
  isGreater(that) {
195
232
  return new Expr(
196
- ExprData.BinOp("Greater" /* Greater */, this[DATA], ExprData.create(that))
233
+ new ExprData.BinOp("Greater" /* Greater */, this[DATA], ExprData.create(that))
197
234
  );
198
235
  }
199
236
  isGreaterOrEqual(that) {
200
237
  return new Expr(
201
- ExprData.BinOp(
238
+ new ExprData.BinOp(
202
239
  "GreaterOrEqual" /* GreaterOrEqual */,
203
240
  this[DATA],
204
241
  ExprData.create(that)
@@ -207,62 +244,66 @@ var Expr = class {
207
244
  }
208
245
  isLess(that) {
209
246
  return new Expr(
210
- ExprData.BinOp("Less" /* Less */, this[DATA], ExprData.create(that))
247
+ new ExprData.BinOp("Less" /* Less */, this[DATA], ExprData.create(that))
211
248
  );
212
249
  }
213
250
  isLessOrEqual(that) {
214
251
  return new Expr(
215
- ExprData.BinOp("LessOrEqual" /* LessOrEqual */, this[DATA], ExprData.create(that))
252
+ new ExprData.BinOp(
253
+ "LessOrEqual" /* LessOrEqual */,
254
+ this[DATA],
255
+ ExprData.create(that)
256
+ )
216
257
  );
217
258
  }
218
259
  add(that) {
219
260
  return new Expr(
220
- ExprData.BinOp("Add" /* Add */, this[DATA], ExprData.create(that))
261
+ new ExprData.BinOp("Add" /* Add */, this[DATA], ExprData.create(that))
221
262
  );
222
263
  }
223
264
  substract(that) {
224
265
  return new Expr(
225
- ExprData.BinOp("Subt" /* Subt */, this[DATA], ExprData.create(that))
266
+ new ExprData.BinOp("Subt" /* Subt */, this[DATA], ExprData.create(that))
226
267
  );
227
268
  }
228
269
  multiply(that) {
229
270
  return new Expr(
230
- ExprData.BinOp("Mult" /* Mult */, this[DATA], ExprData.create(that))
271
+ new ExprData.BinOp("Mult" /* Mult */, this[DATA], ExprData.create(that))
231
272
  );
232
273
  }
233
274
  remainder(that) {
234
275
  return new Expr(
235
- ExprData.BinOp("Mod" /* Mod */, this[DATA], ExprData.create(that))
276
+ new ExprData.BinOp("Mod" /* Mod */, this[DATA], ExprData.create(that))
236
277
  );
237
278
  }
238
279
  divide(that) {
239
280
  return new Expr(
240
- ExprData.BinOp("Div" /* Div */, this[DATA], ExprData.create(that))
281
+ new ExprData.BinOp("Div" /* Div */, this[DATA], ExprData.create(that))
241
282
  );
242
283
  }
243
284
  concat(that) {
244
285
  return new Expr(
245
- ExprData.BinOp("Concat" /* Concat */, this[DATA], ExprData.create(that))
286
+ new ExprData.BinOp("Concat" /* Concat */, this[DATA], ExprData.create(that))
246
287
  );
247
288
  }
248
289
  like(that) {
249
290
  return new Expr(
250
- ExprData.BinOp("Like" /* Like */, this[DATA], ExprData.create(that))
291
+ new ExprData.BinOp("Like" /* Like */, this[DATA], ExprData.create(that))
251
292
  );
252
293
  }
253
294
  glob(that) {
254
295
  return new Expr(
255
- ExprData.BinOp("Glob" /* Glob */, this[DATA], ExprData.create(that))
296
+ new ExprData.BinOp("Glob" /* Glob */, this[DATA], ExprData.create(that))
256
297
  );
257
298
  }
258
299
  match(that) {
259
300
  return new Expr(
260
- ExprData.BinOp("Match" /* Match */, this[DATA], ExprData.create(that))
301
+ new ExprData.BinOp("Match" /* Match */, this[DATA], ExprData.create(that))
261
302
  );
262
303
  }
263
304
  with(that) {
264
305
  return new Expr(
265
- ExprData.Merge(this[DATA], ExprData.create(that))
306
+ new ExprData.Merge(this[DATA], ExprData.create(that))
266
307
  );
267
308
  }
268
309
  /**
@@ -296,21 +337,21 @@ var Expr = class {
296
337
  }
297
338
  filter(fn) {
298
339
  const alias = `__${Math.random().toString(36).slice(2, 9)}`;
299
- const target = Target.Expr(this[DATA], alias);
340
+ const target = new Target.Expr(this[DATA], alias);
300
341
  return new Expr(
301
- ExprData.Filter(
342
+ new ExprData.Filter(
302
343
  target,
303
- ExprData.create(fn(new Expr(ExprData.Row(target)).dynamic()))
344
+ ExprData.create(fn(new Expr(new ExprData.Row(target)).dynamic()))
304
345
  )
305
346
  );
306
347
  }
307
348
  map(fn) {
308
349
  const alias = `__${Math.random().toString(36).slice(2, 9)}`;
309
- const target = Target.Expr(this[DATA], alias);
350
+ const target = new Target.Expr(this[DATA], alias);
310
351
  return new Expr(
311
- ExprData.Map(
352
+ new ExprData.Map(
312
353
  target,
313
- ExprData.create(fn(new Expr(ExprData.Row(target)).dynamic()))
354
+ ExprData.create(fn(new Expr(new ExprData.Row(target)).dynamic()))
314
355
  )
315
356
  );
316
357
  }
@@ -318,16 +359,16 @@ var Expr = class {
318
359
  return this;
319
360
  }
320
361
  get(name) {
321
- return new Expr(ExprData.Field(this[DATA], name));
362
+ return new Expr(new ExprData.Field(this[DATA], name));
322
363
  }
323
364
  };
324
365
  ((Expr2) => {
325
- Expr2.NULL = create(null);
326
366
  Expr2.Data = DATA;
327
367
  Expr2.IsExpr = IS_EXPR;
328
368
  Expr2.ToExpr = TO_EXPR;
369
+ Expr2.NULL = create(null);
329
370
  function value(value2) {
330
- return new Expr2(ExprData.Param(ParamData.Value(value2)));
371
+ return new Expr2(new ExprData.Param(new ParamData.Value(value2)));
331
372
  }
332
373
  Expr2.value = value;
333
374
  function create(input) {
@@ -2,7 +2,7 @@
2
2
  import { Expr, ExprData } from "./Expr.js";
3
3
  function get(_, method) {
4
4
  return (...args) => {
5
- return new Expr(ExprData.Call(method, args.map(ExprData.create)));
5
+ return new Expr(new ExprData.Call(method, args.map(ExprData.create)));
6
6
  };
7
7
  }
8
8
  var Functions = new Proxy(/* @__PURE__ */ Object.create(null), { get });
@@ -1,9 +1,9 @@
1
- import { Cursor } from './Cursor';
1
+ import { Query } from './Query';
2
2
  import { Selection } from './Selection';
3
3
  import { Table } from './Table';
4
- export declare function select<X extends Selection>(selection: X): Cursor.SelectMultiple<Selection.Infer<X>>;
5
- export declare function from<Row>(source: Table<Row> | Cursor.SelectMultiple<Row>): Cursor.SelectMultiple<Row>;
6
- export declare function update<Row>(table: Table<Row>): Cursor.Update<Row>;
7
- export declare function insertInto<Row>(table: Table<Row>): Cursor.Insert<Row>;
8
- export declare function deleteFrom<Row>(table: Table<Row>): Cursor.Delete;
9
- export declare function create(...tables: Array<Table<any>>): Cursor.Batch;
4
+ export declare function select<X extends Selection>(selection: X): Query.SelectMultiple<Selection.Infer<X>>;
5
+ export declare function from<Row>(source: Table<Row> | Query.SelectMultiple<Row>): Query.SelectMultiple<Row>;
6
+ export declare function update<Row>(table: Table<Row>): Query.Update<Row>;
7
+ export declare function insertInto<Row>(table: Table<Row>): Query.Insert<Row>;
8
+ export declare function deleteFrom<Row>(table: Table<Row>): Query.Delete;
9
+ export declare function create(...tables: Array<Table<any>>): Query.Batch;