litedbmodel 2.2.10 → 2.2.11
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 +8 -5
- package/dist/DBHandler.d.ts +2 -28
- package/dist/DBHandler.d.ts.map +1 -1
- package/dist/DBHandler.js.map +1 -1
- package/dist/DBModel.d.ts +14 -12
- package/dist/DBModel.d.ts.map +1 -1
- package/dist/DBModel.js +71 -72
- package/dist/DBModel.js.map +1 -1
- package/dist/Middleware.d.ts +19 -17
- package/dist/Middleware.d.ts.map +1 -1
- package/dist/Middleware.js +30 -33
- package/dist/Middleware.js.map +1 -1
- package/dist/drivers/mysql.d.ts.map +1 -1
- package/dist/drivers/mysql.js +1 -0
- package/dist/drivers/mysql.js.map +1 -1
- package/dist/drivers/postgres.d.ts.map +1 -1
- package/dist/drivers/postgres.js +42 -22
- package/dist/drivers/postgres.js.map +1 -1
- package/dist/drivers/types.d.ts +2 -26
- package/dist/drivers/types.d.ts.map +1 -1
- package/dist/drivers/types.js.map +1 -1
- package/dist/index.cjs +211 -152
- package/dist/scp/connection-routing.d.ts +50 -18
- package/dist/scp/connection-routing.d.ts.map +1 -1
- package/dist/scp/connection-routing.js +55 -24
- package/dist/scp/connection-routing.js.map +1 -1
- package/dist/scp/dbmodel-runtime.d.ts +3 -0
- package/dist/scp/dbmodel-runtime.d.ts.map +1 -1
- package/dist/scp/dbmodel-runtime.js +2 -0
- package/dist/scp/dbmodel-runtime.js.map +1 -1
- package/dist/scp/exec-context.d.ts.map +1 -1
- package/dist/scp/exec-context.js +54 -46
- package/dist/scp/exec-context.js.map +1 -1
- package/dist/scp/index.cjs +99 -48
- package/dist/scp/index.mjs +96 -47
- package/dist/scp/makesql/pool-executor.d.ts +4 -1
- package/dist/scp/makesql/pool-executor.d.ts.map +1 -1
- package/dist/scp/makesql/pool-executor.js +21 -3
- package/dist/scp/makesql/pool-executor.js.map +1 -1
- package/dist/types.d.ts +9 -7
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/docs/BENCHMARK.md +1 -1
- package/docs/COMPARISON.md +2 -2
- package/docs/api/README.md +1 -1
- package/docs/api/classes/Conditions.md +1 -1
- package/docs/api/classes/DBHandler.md +16 -16
- package/docs/api/classes/DBModel.md +94 -93
- package/docs/api/classes/LimitExceededError.md +8 -8
- package/docs/api/classes/Middleware.md +35 -31
- package/docs/api/classes/SqlRaw.md +1 -1
- package/docs/api/classes/SqlRef.md +1 -1
- package/docs/api/classes/Values.md +1 -1
- package/docs/api/classes/WriteInReadOnlyContextError.md +5 -5
- package/docs/api/classes/WriteOutsideTransactionError.md +5 -5
- package/docs/api/functions/belongsTo.md +1 -1
- package/docs/api/functions/closeAllPools.md +2 -2
- package/docs/api/functions/condsToRecord.md +1 -1
- package/docs/api/functions/createMiddleware.md +4 -4
- package/docs/api/functions/createPostgresDriver.md +2 -2
- package/docs/api/functions/createSqliteDriver.md +1 -1
- package/docs/api/functions/dbCast.md +1 -1
- package/docs/api/functions/dbCastIn.md +1 -1
- package/docs/api/functions/dbDynamic.md +1 -1
- package/docs/api/functions/dbFalse.md +1 -1
- package/docs/api/functions/dbImmediate.md +1 -1
- package/docs/api/functions/dbIn.md +1 -1
- package/docs/api/functions/dbNotNull.md +1 -1
- package/docs/api/functions/dbNow.md +1 -1
- package/docs/api/functions/dbNull.md +1 -1
- package/docs/api/functions/dbRaw.md +1 -1
- package/docs/api/functions/dbTrue.md +1 -1
- package/docs/api/functions/dbUuid.md +1 -1
- package/docs/api/functions/dbUuidIn.md +1 -1
- package/docs/api/functions/formatLocalDate.md +1 -1
- package/docs/api/functions/formatUTCDate.md +1 -1
- package/docs/api/functions/getDBConfig.md +2 -2
- package/docs/api/functions/getDBHandler.md +2 -2
- package/docs/api/functions/getTransactionConnection.md +2 -2
- package/docs/api/functions/getTransactionContext.md +2 -2
- package/docs/api/functions/hasMany.md +1 -1
- package/docs/api/functions/hasOne.md +1 -1
- package/docs/api/functions/initDBHandler.md +2 -2
- package/docs/api/functions/isAnySqlFragment.md +1 -1
- package/docs/api/functions/isConnectionError.md +1 -1
- package/docs/api/functions/isSqlCondition.md +1 -1
- package/docs/api/functions/isSqlFragment.md +1 -1
- package/docs/api/functions/isSqlRaw.md +1 -1
- package/docs/api/functions/isSqlRef.md +1 -1
- package/docs/api/functions/isSqlTypedFragment.md +1 -1
- package/docs/api/functions/model.md +1 -1
- package/docs/api/functions/parentRef.md +1 -1
- package/docs/api/functions/sql.md +1 -1
- package/docs/api/globals.md +5 -5
- package/docs/api/interfaces/Column.md +1 -1
- package/docs/api/interfaces/ColumnDecorator.md +1 -1
- package/docs/api/interfaces/ColumnOptions.md +1 -1
- package/docs/api/interfaces/CreatedMiddlewareClass.md +7 -7
- package/docs/api/interfaces/DBConfig.md +29 -14
- package/docs/api/interfaces/DBConfigOptions.md +8 -8
- package/docs/api/interfaces/DeleteOptions.md +4 -4
- package/docs/api/interfaces/InsertOptions.md +8 -8
- package/docs/api/interfaces/LimitConfig.md +4 -4
- package/docs/api/interfaces/MiddlewareConfig.md +15 -15
- package/docs/api/interfaces/ModelClassDecorator.md +1 -1
- package/docs/api/interfaces/ModelOptions.md +1 -1
- package/docs/api/interfaces/PkeyResult.md +1 -1
- package/docs/api/interfaces/RelationDecorator.md +1 -1
- package/docs/api/interfaces/SelectOptions.md +17 -17
- package/docs/api/interfaces/SqlCondition.md +1 -1
- package/docs/api/interfaces/SqlFragment.md +1 -1
- package/docs/api/interfaces/SqlTypedFragment.md +1 -1
- package/docs/api/interfaces/TransactionOptions.md +7 -7
- package/docs/api/interfaces/UpdateManyOptions.md +4 -4
- package/docs/api/interfaces/UpdateOptions.md +4 -4
- package/package.json +2 -2
package/docs/COMPARISON.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
A detailed comparison of litedbmodel with popular TypeScript/JavaScript ORMs.
|
|
4
4
|
|
|
5
5
|
<!--@embedoc:package_version label="Benchmark figures"-->
|
|
6
|
-
**Benchmark figures:** litedbmodel **2.2.
|
|
6
|
+
**Benchmark figures:** litedbmodel **2.2.11**
|
|
7
7
|
<!--@embedoc:end-->
|
|
8
8
|
|
|
9
9
|
> The only performance number on this page is the machine-computed win count below; the full
|
|
@@ -760,7 +760,7 @@ class AuditMiddleware extends Middleware {
|
|
|
760
760
|
|
|
761
761
|
DBModel.use(AuditMiddleware);
|
|
762
762
|
|
|
763
|
-
// Per-request context access
|
|
763
|
+
// Per-request context access (inside Middleware.run at the request entry)
|
|
764
764
|
const ctx = AuditMiddleware.getCurrentContext();
|
|
765
765
|
ctx.tenantId = req.user.tenantId;
|
|
766
766
|
```
|
package/docs/api/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[**litedbmodel v2.2.
|
|
1
|
+
[**litedbmodel v2.2.11**](../README.md)
|
|
2
2
|
|
|
3
3
|
***
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: DBHandler
|
|
8
8
|
|
|
9
|
-
Defined in: [DBHandler.ts:
|
|
9
|
+
Defined in: [DBHandler.ts:148](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBHandler.ts#L148)
|
|
10
10
|
|
|
11
11
|
Database handler - wraps a driver and provides a unified interface.
|
|
12
12
|
|
|
@@ -30,7 +30,7 @@ const result = await handler.execute('SELECT * FROM users WHERE id = $1', [1]);
|
|
|
30
30
|
new DBHandler(config: DBConfig, options?: DBHandlerOptions): DBHandler;
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
Defined in: [DBHandler.ts:
|
|
33
|
+
Defined in: [DBHandler.ts:154](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBHandler.ts#L154)
|
|
34
34
|
|
|
35
35
|
#### Parameters
|
|
36
36
|
|
|
@@ -48,16 +48,16 @@ Defined in: [DBHandler.ts:185](https://github.com/foo-ogawa/litedbmodel/blob/mai
|
|
|
48
48
|
### getDriverType()
|
|
49
49
|
|
|
50
50
|
```ts
|
|
51
|
-
getDriverType(): "postgres" | "
|
|
51
|
+
getDriverType(): "postgres" | "sqlite" | "mysql";
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
Defined in: [DBHandler.ts:
|
|
54
|
+
Defined in: [DBHandler.ts:172](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBHandler.ts#L172)
|
|
55
55
|
|
|
56
56
|
Get the driver type
|
|
57
57
|
|
|
58
58
|
#### Returns
|
|
59
59
|
|
|
60
|
-
`"postgres"` \| `"
|
|
60
|
+
`"postgres"` \| `"sqlite"` \| `"mysql"`
|
|
61
61
|
|
|
62
62
|
***
|
|
63
63
|
|
|
@@ -67,7 +67,7 @@ Get the driver type
|
|
|
67
67
|
getDriver(): DBDriver;
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
Defined in: [DBHandler.ts:
|
|
70
|
+
Defined in: [DBHandler.ts:179](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBHandler.ts#L179)
|
|
71
71
|
|
|
72
72
|
Get the underlying driver
|
|
73
73
|
|
|
@@ -83,7 +83,7 @@ Get the underlying driver
|
|
|
83
83
|
execute(sql: string, params?: unknown[]): Promise<QueryResult>;
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
Defined in: [DBHandler.ts:
|
|
86
|
+
Defined in: [DBHandler.ts:186](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBHandler.ts#L186)
|
|
87
87
|
|
|
88
88
|
Execute a SQL query
|
|
89
89
|
|
|
@@ -106,7 +106,7 @@ Execute a SQL query
|
|
|
106
106
|
executeWrite(sql: string, params?: unknown[]): Promise<QueryResult>;
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
-
Defined in: [DBHandler.ts:
|
|
109
|
+
Defined in: [DBHandler.ts:196](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBHandler.ts#L196)
|
|
110
110
|
|
|
111
111
|
Execute a write query (INSERT/UPDATE/DELETE)
|
|
112
112
|
|
|
@@ -129,7 +129,7 @@ Execute a write query (INSERT/UPDATE/DELETE)
|
|
|
129
129
|
executeOnWriter(sql: string, params?: unknown[]): Promise<QueryResult>;
|
|
130
130
|
```
|
|
131
131
|
|
|
132
|
-
Defined in: [DBHandler.ts:
|
|
132
|
+
Defined in: [DBHandler.ts:206](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBHandler.ts#L206)
|
|
133
133
|
|
|
134
134
|
Execute a query on writer pool (for withWriter context)
|
|
135
135
|
|
|
@@ -152,7 +152,7 @@ Execute a query on writer pool (for withWriter context)
|
|
|
152
152
|
hasWriterPool(): boolean;
|
|
153
153
|
```
|
|
154
154
|
|
|
155
|
-
Defined in: [DBHandler.ts:
|
|
155
|
+
Defined in: [DBHandler.ts:216](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBHandler.ts#L216)
|
|
156
156
|
|
|
157
157
|
Check if writer pool is configured
|
|
158
158
|
|
|
@@ -168,7 +168,7 @@ Check if writer pool is configured
|
|
|
168
168
|
getConnection(): Promise<DBConnection>;
|
|
169
169
|
```
|
|
170
170
|
|
|
171
|
-
Defined in: [DBHandler.ts:
|
|
171
|
+
Defined in: [DBHandler.ts:223](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBHandler.ts#L223)
|
|
172
172
|
|
|
173
173
|
Get a connection from the pool (for transactions)
|
|
174
174
|
|
|
@@ -184,7 +184,7 @@ Get a connection from the pool (for transactions)
|
|
|
184
184
|
withConnection(connection: DBConnection): DBHandler;
|
|
185
185
|
```
|
|
186
186
|
|
|
187
|
-
Defined in: [DBHandler.ts:
|
|
187
|
+
Defined in: [DBHandler.ts:230](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBHandler.ts#L230)
|
|
188
188
|
|
|
189
189
|
Create handler with specific connection (for transaction)
|
|
190
190
|
|
|
@@ -206,7 +206,7 @@ Create handler with specific connection (for transaction)
|
|
|
206
206
|
close(): Promise<void>;
|
|
207
207
|
```
|
|
208
208
|
|
|
209
|
-
Defined in: [DBHandler.ts:
|
|
209
|
+
Defined in: [DBHandler.ts:242](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBHandler.ts#L242)
|
|
210
210
|
|
|
211
211
|
Close all connections
|
|
212
212
|
|
|
@@ -222,7 +222,7 @@ Close all connections
|
|
|
222
222
|
setLogger(logger: Logger): void;
|
|
223
223
|
```
|
|
224
224
|
|
|
225
|
-
Defined in: [DBHandler.ts:
|
|
225
|
+
Defined in: [DBHandler.ts:249](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBHandler.ts#L249)
|
|
226
226
|
|
|
227
227
|
Set logger
|
|
228
228
|
|
|
@@ -244,7 +244,7 @@ Set logger
|
|
|
244
244
|
getPool(): unknown;
|
|
245
245
|
```
|
|
246
246
|
|
|
247
|
-
Defined in: [DBHandler.ts:
|
|
247
|
+
Defined in: [DBHandler.ts:258](https://github.com/foo-ogawa/litedbmodel/blob/main/src/DBHandler.ts#L258)
|
|
248
248
|
|
|
249
249
|
Get the underlying PostgreSQL pool (for backward compatibility)
|
|
250
250
|
|