rado 0.2.18 → 0.2.20
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/dist/define/Expr.js +2 -4
- package/dist/define/Table.js +13 -6
- package/dist/lib/Driver.d.ts +2 -0
- package/dist/lib/Driver.js +10 -2
- package/package.json +3 -3
package/dist/define/Expr.js
CHANGED
|
@@ -274,15 +274,13 @@ var Expr = class {
|
|
|
274
274
|
dynamic(...path) {
|
|
275
275
|
return new Proxy(
|
|
276
276
|
(...args) => {
|
|
277
|
-
const method = path.
|
|
278
|
-
const e = path.length >
|
|
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);
|
package/dist/define/Table.js
CHANGED
|
@@ -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
|
|
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,13 +90,18 @@ function createTable(data) {
|
|
|
88
90
|
return ownKeys2;
|
|
89
91
|
},
|
|
90
92
|
getOwnPropertyDescriptor(target2, key) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
const value = get2(key);
|
|
94
|
+
const descriptor = getOwnPropertyDescriptor(call, key);
|
|
95
|
+
const res2 = descriptor ? {
|
|
96
|
+
...descriptor,
|
|
97
|
+
enumerable: cols.includes(key)
|
|
98
|
+
} : {
|
|
95
99
|
enumerable: true,
|
|
96
100
|
configurable: true
|
|
97
101
|
};
|
|
102
|
+
if (value !== void 0)
|
|
103
|
+
res2.value = value;
|
|
104
|
+
return res2;
|
|
98
105
|
}
|
|
99
106
|
});
|
|
100
107
|
}
|
package/dist/lib/Driver.d.ts
CHANGED
|
@@ -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>;
|
package/dist/lib/Driver.js
CHANGED
|
@@ -59,7 +59,11 @@ var DriverBase = class {
|
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
61
|
var SyncDriver = class extends DriverBase {
|
|
62
|
-
transactionId
|
|
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
|
|
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.
|
|
3
|
+
"version": "0.2.20",
|
|
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.
|
|
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.
|
|
58
|
+
"esbuild": "0.17.7"
|
|
59
59
|
}
|
|
60
60
|
}
|