rado 0.2.18 → 0.2.19

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.
@@ -274,15 +274,13 @@ var Expr = class {
274
274
  dynamic(...path) {
275
275
  return new Proxy(
276
276
  (...args) => {
277
- const method = path.pop();
278
- const e = path.length > 0 ? this.get(path.join(".")) : this;
277
+ const method = path[path.length - 1];
278
+ const e = path.length > 1 ? this.get(path.slice(0, -1).join(".")) : this;
279
279
  return e[method]?.apply(e, args);
280
280
  },
281
281
  {
282
282
  get: (_, key) => {
283
283
  const e = path.length > 0 ? this.get(path.join(".")) : this;
284
- if (key === "expr")
285
- return e[DATA];
286
284
  if (typeof key !== "string")
287
285
  return e[key];
288
286
  return this.dynamic(...path, key);
@@ -16,7 +16,8 @@ var {
16
16
  assign,
17
17
  getPrototypeOf,
18
18
  setPrototypeOf,
19
- getOwnPropertyDescriptor
19
+ getOwnPropertyDescriptor,
20
+ getOwnPropertyNames
20
21
  } = Object;
21
22
  var { ownKeys } = Reflect;
22
23
  var Table;
@@ -66,7 +67,8 @@ function createTable(data) {
66
67
  })
67
68
  );
68
69
  const toExpr = () => new Expr(row);
69
- const ownKeys2 = ["prototype", ...cols];
70
+ const funcNames = getOwnPropertyNames(call);
71
+ const ownKeys2 = Array.from(/* @__PURE__ */ new Set([...funcNames, ...cols]));
70
72
  let res;
71
73
  if (!hasKeywords) {
72
74
  res = assign(call, expressions, { [DATA]: data, [Expr.ToExpr]: toExpr });
@@ -88,10 +90,16 @@ function createTable(data) {
88
90
  return ownKeys2;
89
91
  },
90
92
  getOwnPropertyDescriptor(target2, key) {
91
- if (key === "prototype")
92
- return getOwnPropertyDescriptor(target2, key);
93
+ const value = get2(key);
94
+ const descriptor = getOwnPropertyDescriptor(call, key);
95
+ if (descriptor)
96
+ return {
97
+ ...descriptor,
98
+ enumerable: cols.includes(key),
99
+ value
100
+ };
93
101
  return {
94
- value: get2(key),
102
+ value,
95
103
  enumerable: true,
96
104
  configurable: true
97
105
  };
@@ -27,6 +27,7 @@ interface SyncDriver {
27
27
  }
28
28
  declare abstract class SyncDriver extends DriverBase {
29
29
  transactionId: number;
30
+ constructor(formatter: Formatter);
30
31
  abstract prepareStatement(stmt: Statement, discardAfter: boolean): SyncPreparedStatement;
31
32
  abstract schemaInstructions(tableName: string): SchemaInstructions | undefined;
32
33
  prepare<T extends Array<Expr<any>>, R>(create: (...params: T) => Cursor<R>): (...params: ParamTypes<T>) => R;
@@ -58,6 +59,7 @@ interface AsyncDriver {
58
59
  }
59
60
  declare abstract class AsyncDriver extends DriverBase {
60
61
  transactionId: number;
62
+ constructor(formatter: Formatter);
61
63
  abstract isolate(): [connection: AsyncDriver, release: () => Promise<void>];
62
64
  abstract prepareStatement(stmt: Statement, discardAfter: boolean): AsyncPreparedStatement;
63
65
  abstract schemaInstructions(tableName: string): Promise<SchemaInstructions | undefined>;
@@ -59,7 +59,11 @@ var DriverBase = class {
59
59
  }
60
60
  };
61
61
  var SyncDriver = class extends DriverBase {
62
- transactionId = 0;
62
+ transactionId;
63
+ constructor(formatter) {
64
+ super(formatter);
65
+ this.transactionId = 0;
66
+ }
63
67
  prepare(create) {
64
68
  const [query, compiled] = this.compile(create);
65
69
  const prepared = this.prepareStatement(compiled, false);
@@ -165,7 +169,11 @@ var SyncDriver = class extends DriverBase {
165
169
  }
166
170
  };
167
171
  var AsyncDriver = class extends DriverBase {
168
- transactionId = 0;
172
+ transactionId;
173
+ constructor(formatter) {
174
+ super(formatter);
175
+ this.transactionId = 0;
176
+ }
169
177
  prepare(create) {
170
178
  const [query, compiled] = this.compile(create);
171
179
  const prepared = this.prepareStatement(compiled, false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rado",
3
- "version": "0.2.18",
3
+ "version": "0.2.19",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -39,7 +39,7 @@
39
39
  "better-sqlite3": "^7.5.1",
40
40
  "bun-types": "^0.5.0",
41
41
  "cross-env": "^7.0.3",
42
- "esbuild": "^0.16.16",
42
+ "esbuild": "^0.17.7",
43
43
  "glob": "^8.0.3",
44
44
  "rimraf": "^4.1.2",
45
45
  "sade": "^1.8.1",
@@ -55,6 +55,6 @@
55
55
  },
56
56
  "packageManager": "yarn@3.3.1",
57
57
  "resolutions": {
58
- "esbuild": "0.16.16"
58
+ "esbuild": "0.17.7"
59
59
  }
60
60
  }