remult 0.25.8-exp.11 → 0.25.8-exp.12
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/esm/remult-better-sqlite3.js +1 -2
- package/esm/remult-bun-sqlite.js +41 -0
- package/esm/src/remult3/remult3.js +1 -0
- package/package.json +6 -1
- package/remult-better-sqlite3.js +1 -7
- package/remult-bun-sqlite.d.ts +11 -0
- package/remult-bun-sqlite.js +56 -0
- package/src/remult3/remult3.js +1 -0
|
@@ -38,8 +38,7 @@ export class BetterSqlite3SqlResult {
|
|
|
38
38
|
result;
|
|
39
39
|
constructor(result) {
|
|
40
40
|
this.result = result;
|
|
41
|
-
this.rows =
|
|
42
|
-
result.map((row) => Object.keys(row).reduce((prev, curr) => ({ ...prev, [curr]: row[curr] }), {}));
|
|
41
|
+
this.rows = result;
|
|
43
42
|
}
|
|
44
43
|
rows;
|
|
45
44
|
getColumnKeyInResultForIndexInSelect(index) {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { SqliteCoreDataProvider } from "./remult-sqlite-core.js";
|
|
2
|
+
export class BunSqliteDataProvider extends SqliteCoreDataProvider {
|
|
3
|
+
constructor(db) {
|
|
4
|
+
super(() => new BunSqliteCommand(db), async () => { db.close(); });
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
class BunSqliteCommand {
|
|
8
|
+
db;
|
|
9
|
+
values = {};
|
|
10
|
+
i = 0;
|
|
11
|
+
constructor(db) {
|
|
12
|
+
this.db = db;
|
|
13
|
+
}
|
|
14
|
+
async execute(sql) {
|
|
15
|
+
const s = this.db.query(sql);
|
|
16
|
+
return new BunSqliteSqlResult(s.all(this.values));
|
|
17
|
+
}
|
|
18
|
+
addParameterAndReturnSqlToken(val) {
|
|
19
|
+
return this.param(val);
|
|
20
|
+
}
|
|
21
|
+
param(val) {
|
|
22
|
+
if (val instanceof Date)
|
|
23
|
+
val = val.valueOf();
|
|
24
|
+
if (typeof val === "boolean")
|
|
25
|
+
val = val ? 1 : 0;
|
|
26
|
+
const key = ':' + (this.i++);
|
|
27
|
+
this.values[key] = (val);
|
|
28
|
+
return key;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
class BunSqliteSqlResult {
|
|
32
|
+
result;
|
|
33
|
+
constructor(result) {
|
|
34
|
+
this.result = result;
|
|
35
|
+
this.rows = result;
|
|
36
|
+
}
|
|
37
|
+
rows;
|
|
38
|
+
getColumnKeyInResultForIndexInSelect(index) {
|
|
39
|
+
return Object.keys(this.result[0])[index];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -2,6 +2,7 @@ export {};
|
|
|
2
2
|
//p1 - implement generic sqlite support better-sqlite3/ bun sqlite
|
|
3
3
|
//p1 - `preprocessApiFindOptions`, naming - allow find options preprocessor for api calls, to use for authorization
|
|
4
4
|
//p1 - admin url1 - pocketbase use /_ for the admin //{allowed?:Allowed,url?:string}
|
|
5
|
+
//p1 - document new sqlite providers
|
|
5
6
|
//p1 - article auth.js with express
|
|
6
7
|
//p1 - document offline support
|
|
7
8
|
//p1 - fix getting started article
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "remult",
|
|
3
|
-
"version": "0.25.8-exp.
|
|
3
|
+
"version": "0.25.8-exp.12",
|
|
4
4
|
"description": "A CRUD framework for full-stack TypeScript",
|
|
5
5
|
"homepage": "https://remult.dev",
|
|
6
6
|
"repository": {
|
|
@@ -111,6 +111,11 @@
|
|
|
111
111
|
"import": "./esm/remult-better-sqlite3.js",
|
|
112
112
|
"types": "./remult-better-sqlite3.d.ts"
|
|
113
113
|
},
|
|
114
|
+
"./remult-bun-sqlite": {
|
|
115
|
+
"require": "./remult-bun-sqlite.js",
|
|
116
|
+
"import": "./esm/remult-bun-sqlite.js",
|
|
117
|
+
"types": "./remult-bun-sqlite.d.ts"
|
|
118
|
+
},
|
|
114
119
|
"./migrations": {
|
|
115
120
|
"require": "./migrations/index.js",
|
|
116
121
|
"import": "./esm/migrations/index.js",
|
package/remult-better-sqlite3.js
CHANGED
|
@@ -54,13 +54,7 @@ var BetterSqlite3Command = /** @class */ (function () {
|
|
|
54
54
|
var BetterSqlite3SqlResult = /** @class */ (function () {
|
|
55
55
|
function BetterSqlite3SqlResult(result) {
|
|
56
56
|
this.result = result;
|
|
57
|
-
this.rows =
|
|
58
|
-
result.map(function (row) {
|
|
59
|
-
return Object.keys(row).reduce(function (prev, curr) {
|
|
60
|
-
var _a;
|
|
61
|
-
return (tslib_1.__assign(tslib_1.__assign({}, prev), (_a = {}, _a[curr] = row[curr], _a)));
|
|
62
|
-
}, {});
|
|
63
|
-
});
|
|
57
|
+
this.rows = result;
|
|
64
58
|
}
|
|
65
59
|
BetterSqlite3SqlResult.prototype.getColumnKeyInResultForIndexInSelect = function (index) {
|
|
66
60
|
return Object.keys(this.result[0])[index];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SqliteCoreDataProvider } from "./remult-sqlite-core.js";
|
|
2
|
+
type Database = {
|
|
3
|
+
close(): void;
|
|
4
|
+
query(sql: string): {
|
|
5
|
+
all(args?: any): any[];
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
export declare class BunSqliteDataProvider extends SqliteCoreDataProvider {
|
|
9
|
+
constructor(db: Database);
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BunSqliteDataProvider = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var remult_sqlite_core_js_1 = require("./remult-sqlite-core.js");
|
|
6
|
+
var BunSqliteDataProvider = /** @class */ (function (_super) {
|
|
7
|
+
tslib_1.__extends(BunSqliteDataProvider, _super);
|
|
8
|
+
function BunSqliteDataProvider(db) {
|
|
9
|
+
var _this = _super.call(this, function () { return new BunSqliteCommand(db); }, function () { return tslib_1.__awaiter(_this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) {
|
|
10
|
+
db.close();
|
|
11
|
+
return [2 /*return*/];
|
|
12
|
+
}); }); }) || this;
|
|
13
|
+
return _this;
|
|
14
|
+
}
|
|
15
|
+
return BunSqliteDataProvider;
|
|
16
|
+
}(remult_sqlite_core_js_1.SqliteCoreDataProvider));
|
|
17
|
+
exports.BunSqliteDataProvider = BunSqliteDataProvider;
|
|
18
|
+
var BunSqliteCommand = /** @class */ (function () {
|
|
19
|
+
function BunSqliteCommand(db) {
|
|
20
|
+
this.db = db;
|
|
21
|
+
this.values = {};
|
|
22
|
+
this.i = 0;
|
|
23
|
+
}
|
|
24
|
+
BunSqliteCommand.prototype.execute = function (sql) {
|
|
25
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
26
|
+
var s;
|
|
27
|
+
return tslib_1.__generator(this, function (_a) {
|
|
28
|
+
s = this.db.query(sql);
|
|
29
|
+
return [2 /*return*/, new BunSqliteSqlResult(s.all(this.values))];
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
BunSqliteCommand.prototype.addParameterAndReturnSqlToken = function (val) {
|
|
34
|
+
return this.param(val);
|
|
35
|
+
};
|
|
36
|
+
BunSqliteCommand.prototype.param = function (val) {
|
|
37
|
+
if (val instanceof Date)
|
|
38
|
+
val = val.valueOf();
|
|
39
|
+
if (typeof val === "boolean")
|
|
40
|
+
val = val ? 1 : 0;
|
|
41
|
+
var key = ':' + (this.i++);
|
|
42
|
+
this.values[key] = (val);
|
|
43
|
+
return key;
|
|
44
|
+
};
|
|
45
|
+
return BunSqliteCommand;
|
|
46
|
+
}());
|
|
47
|
+
var BunSqliteSqlResult = /** @class */ (function () {
|
|
48
|
+
function BunSqliteSqlResult(result) {
|
|
49
|
+
this.result = result;
|
|
50
|
+
this.rows = result;
|
|
51
|
+
}
|
|
52
|
+
BunSqliteSqlResult.prototype.getColumnKeyInResultForIndexInSelect = function (index) {
|
|
53
|
+
return Object.keys(this.result[0])[index];
|
|
54
|
+
};
|
|
55
|
+
return BunSqliteSqlResult;
|
|
56
|
+
}());
|
package/src/remult3/remult3.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
//p1 - implement generic sqlite support better-sqlite3/ bun sqlite
|
|
4
4
|
//p1 - `preprocessApiFindOptions`, naming - allow find options preprocessor for api calls, to use for authorization
|
|
5
5
|
//p1 - admin url1 - pocketbase use /_ for the admin //{allowed?:Allowed,url?:string}
|
|
6
|
+
//p1 - document new sqlite providers
|
|
6
7
|
//p1 - article auth.js with express
|
|
7
8
|
//p1 - document offline support
|
|
8
9
|
//p1 - fix getting started article
|