@rwillians/qx 0.1.13 → 0.1.15
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 +13 -19
- package/dist/cjs/bun-sqlite.js +2 -2
- package/dist/esm/bun-sqlite.js +2 -2
- package/dist/types/bun-sqlite.d.ts +2 -2
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -51,34 +51,28 @@ console.log(user);
|
|
|
51
51
|
Here's the basics of what I need from an ORM, thus it's my priority to
|
|
52
52
|
build it first:
|
|
53
53
|
|
|
54
|
-
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
the query that can be encoded to JSON, mostly for three reasons:
|
|
54
|
+
- Defining model fields should be very similar to defining a schema
|
|
55
|
+
with [Zod](https://zod.dev) (with support for validation refiements
|
|
56
|
+
and transformations).
|
|
57
|
+
- The model should have a schema compatible with [standard schema](https://github.com/standard-schema/standard-schema),
|
|
58
|
+
meaning it should be interoperable with [Zod](https://zod.dev),
|
|
59
|
+
[ArkType](https://arktype.io), [Joi](https://joi.dev), etc.
|
|
60
|
+
- It should have a SQL-Like, type-safe, fluent query builder api that
|
|
61
|
+
works even for NoSQL databases¹, allowing us to write queries once
|
|
62
|
+
then use them with any supported database.
|
|
63
|
+
- The query builder should output a plain map representation of the
|
|
64
|
+
query that can be encoded to JSON, mostly for three reasons:
|
|
66
65
|
1. It's easy to test;
|
|
67
66
|
2. Makes it easier to debug queries; and
|
|
68
67
|
3. Makes `qx` more modular, allowing the community to build
|
|
69
68
|
their own extensions.
|
|
70
|
-
-
|
|
69
|
+
- The query results should be type-safe.
|
|
71
70
|
|
|
72
71
|
_¹ Some database adapters might not support all query features, that's
|
|
73
72
|
expected._
|
|
74
73
|
|
|
75
74
|
Once this vision is fullfilled, `qx` will become `v1.0.0`.
|
|
76
75
|
|
|
77
|
-
> [!NOTE]
|
|
78
|
-
> Migrations are not part of the scope yet, sorry.
|
|
79
|
-
> I don't like the way migrations work in most ORMs, so I'll take my
|
|
80
|
-
> time to figure out what coulde be a better way to do it.
|
|
81
|
-
|
|
82
76
|
|
|
83
77
|
## Components
|
|
84
78
|
|
|
@@ -99,7 +93,7 @@ library:
|
|
|
99
93
|
Database adapters are per driver implementation. Quex ships with a few
|
|
100
94
|
hand picked built-in database adapters:
|
|
101
95
|
|
|
102
|
-
- [
|
|
96
|
+
- [x] bun-sqlite3 (prioritary)
|
|
103
97
|
- [ ] bun-postgres
|
|
104
98
|
- [ ] mongodb
|
|
105
99
|
|
package/dist/cjs/bun-sqlite.js
CHANGED
|
@@ -508,7 +508,7 @@ exports.connect = connect;
|
|
|
508
508
|
/**
|
|
509
509
|
* @public An in-memory database connection.
|
|
510
510
|
* @since 0.1.12
|
|
511
|
-
* @version
|
|
511
|
+
* @version 2
|
|
512
512
|
*/
|
|
513
|
-
const inmemory = connect(':memory:');
|
|
513
|
+
const inmemory = () => connect(':memory:');
|
|
514
514
|
exports.inmemory = inmemory;
|
package/dist/esm/bun-sqlite.js
CHANGED
|
@@ -504,9 +504,9 @@ const connect = (...args) => new BunSQLite(new Database(...args));
|
|
|
504
504
|
/**
|
|
505
505
|
* @public An in-memory database connection.
|
|
506
506
|
* @since 0.1.12
|
|
507
|
-
* @version
|
|
507
|
+
* @version 2
|
|
508
508
|
*/
|
|
509
|
-
const inmemory = connect(':memory:');
|
|
509
|
+
const inmemory = () => connect(':memory:');
|
|
510
510
|
// // // // // // // // // // // // // // // // // // // // // // // //
|
|
511
511
|
// EXPORTS //
|
|
512
512
|
// // // // // // // // // // // // // // // // // // // // // // // //
|
|
@@ -53,7 +53,7 @@ declare const connect: (...args: ConstructorParameters<typeof Database>) => BunS
|
|
|
53
53
|
/**
|
|
54
54
|
* @public An in-memory database connection.
|
|
55
55
|
* @since 0.1.12
|
|
56
|
-
* @version
|
|
56
|
+
* @version 2
|
|
57
57
|
*/
|
|
58
|
-
declare const inmemory: BunSQLite;
|
|
58
|
+
declare const inmemory: () => BunSQLite;
|
|
59
59
|
export { connect, inmemory, };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rwillians/qx",
|
|
3
3
|
"description": "A teeny tiny ORM for SQLite.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.15",
|
|
5
5
|
"author": "Rafael Willians <me@rwillians.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"require": "./dist/cjs/bun-sqlite.js",
|
|
37
37
|
"default": "./dist/cjs/bun-sqlite.js"
|
|
38
38
|
},
|
|
39
|
-
"./
|
|
40
|
-
"types": "./dist/types/
|
|
41
|
-
"import": "./dist/esm/
|
|
42
|
-
"require": "./dist/cjs/
|
|
43
|
-
"default": "./dist/cjs/
|
|
39
|
+
"./console-logger": {
|
|
40
|
+
"types": "./dist/types/console-logger.d.ts",
|
|
41
|
+
"import": "./dist/esm/console-logger.js",
|
|
42
|
+
"require": "./dist/cjs/console-logger.js",
|
|
43
|
+
"default": "./dist/cjs/console-logger.js"
|
|
44
44
|
},
|
|
45
45
|
"./experimental-migration": {
|
|
46
46
|
"types": "./dist/types/experimental-migration.d.ts",
|